chorus-codes 0.8.18 → 0.8.20

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 (123) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +2 -2
  3. package/.next/prerender-manifest.json +3 -3
  4. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  5. package/.next/server/app/_global-error.html +1 -1
  6. package/.next/server/app/_global-error.rsc +1 -1
  7. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  14. package/.next/server/app/_not-found.html +1 -1
  15. package/.next/server/app/_not-found.rsc +1 -1
  16. package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  17. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  18. package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  19. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  20. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  21. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  22. package/.next/server/app/connect/page.js +1 -1
  23. package/.next/server/app/connect/page.js.nft.json +1 -1
  24. package/.next/server/app/connect/page_client-reference-manifest.js +1 -1
  25. package/.next/server/app/demo/[scenario]/page.js +1 -1
  26. package/.next/server/app/demo/[scenario]/page.js.nft.json +1 -1
  27. package/.next/server/app/demo/[scenario]/page_client-reference-manifest.js +1 -1
  28. package/.next/server/app/new/page.js +1 -1
  29. package/.next/server/app/new/page.js.nft.json +1 -1
  30. package/.next/server/app/new/page_client-reference-manifest.js +1 -1
  31. package/.next/server/app/new.html +1 -1
  32. package/.next/server/app/new.rsc +2 -2
  33. package/.next/server/app/new.segments/_full.segment.rsc +2 -2
  34. package/.next/server/app/new.segments/_head.segment.rsc +1 -1
  35. package/.next/server/app/new.segments/_index.segment.rsc +1 -1
  36. package/.next/server/app/new.segments/_tree.segment.rsc +1 -1
  37. package/.next/server/app/new.segments/new/__PAGE__.segment.rsc +2 -2
  38. package/.next/server/app/new.segments/new.segment.rsc +1 -1
  39. package/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  40. package/.next/server/app/onboarding.html +1 -1
  41. package/.next/server/app/onboarding.rsc +1 -1
  42. package/.next/server/app/onboarding.segments/_full.segment.rsc +1 -1
  43. package/.next/server/app/onboarding.segments/_head.segment.rsc +1 -1
  44. package/.next/server/app/onboarding.segments/_index.segment.rsc +1 -1
  45. package/.next/server/app/onboarding.segments/_tree.segment.rsc +1 -1
  46. package/.next/server/app/onboarding.segments/onboarding/__PAGE__.segment.rsc +1 -1
  47. package/.next/server/app/onboarding.segments/onboarding.segment.rsc +1 -1
  48. package/.next/server/app/page.js +1 -1
  49. package/.next/server/app/page.js.nft.json +1 -1
  50. package/.next/server/app/page_client-reference-manifest.js +1 -1
  51. package/.next/server/app/personas/page.js +1 -1
  52. package/.next/server/app/personas/page.js.nft.json +1 -1
  53. package/.next/server/app/personas/page_client-reference-manifest.js +1 -1
  54. package/.next/server/app/personas.html +1 -1
  55. package/.next/server/app/personas.rsc +2 -2
  56. package/.next/server/app/personas.segments/_full.segment.rsc +2 -2
  57. package/.next/server/app/personas.segments/_head.segment.rsc +1 -1
  58. package/.next/server/app/personas.segments/_index.segment.rsc +1 -1
  59. package/.next/server/app/personas.segments/_tree.segment.rsc +1 -1
  60. package/.next/server/app/personas.segments/personas/__PAGE__.segment.rsc +2 -2
  61. package/.next/server/app/personas.segments/personas.segment.rsc +1 -1
  62. package/.next/server/app/runs/[runId]/page.js +1 -1
  63. package/.next/server/app/runs/[runId]/page.js.nft.json +1 -1
  64. package/.next/server/app/runs/[runId]/page_client-reference-manifest.js +1 -1
  65. package/.next/server/app/runs/page.js +1 -1
  66. package/.next/server/app/runs/page.js.nft.json +1 -1
  67. package/.next/server/app/runs/page_client-reference-manifest.js +1 -1
  68. package/.next/server/app/settings/page.js +1 -1
  69. package/.next/server/app/settings/page.js.nft.json +1 -1
  70. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  71. package/.next/server/app/settings/permissions/page.js +1 -1
  72. package/.next/server/app/settings/permissions/page.js.nft.json +1 -1
  73. package/.next/server/app/settings/permissions/page_client-reference-manifest.js +1 -1
  74. package/.next/server/app/settings.html +1 -1
  75. package/.next/server/app/settings.rsc +2 -2
  76. package/.next/server/app/settings.segments/_full.segment.rsc +2 -2
  77. package/.next/server/app/settings.segments/_head.segment.rsc +1 -1
  78. package/.next/server/app/settings.segments/_index.segment.rsc +1 -1
  79. package/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
  80. package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +2 -2
  81. package/.next/server/app/settings.segments/settings.segment.rsc +1 -1
  82. package/.next/server/app/templates/page.js +2 -2
  83. package/.next/server/app/templates/page.js.nft.json +1 -1
  84. package/.next/server/app/templates/page_client-reference-manifest.js +1 -1
  85. package/.next/server/app/templates.html +1 -1
  86. package/.next/server/app/templates.rsc +2 -2
  87. package/.next/server/app/templates.segments/_full.segment.rsc +2 -2
  88. package/.next/server/app/templates.segments/_head.segment.rsc +1 -1
  89. package/.next/server/app/templates.segments/_index.segment.rsc +1 -1
  90. package/.next/server/app/templates.segments/_tree.segment.rsc +1 -1
  91. package/.next/server/app/templates.segments/templates/__PAGE__.segment.rsc +2 -2
  92. package/.next/server/app/templates.segments/templates.segment.rsc +1 -1
  93. package/.next/server/chunks/541.js +5 -0
  94. package/.next/server/chunks/95.js +1 -1
  95. package/.next/server/middleware-build-manifest.js +1 -1
  96. package/.next/server/pages/404.html +1 -1
  97. package/.next/server/pages/500.html +1 -1
  98. package/.next/server/server-reference-manifest.json +1 -1
  99. package/.next/static/chunks/344-17db55a402a0742b.js +1 -0
  100. package/.next/static/chunks/832-18bf24783a3a5332.js +5 -0
  101. package/.next/static/chunks/app/connect/{page-ffca0d7a439c908e.js → page-a3a0af374f90ad4c.js} +1 -1
  102. package/.next/static/chunks/app/demo/[scenario]/{page-6307259fba2e5fdf.js → page-6a0e4aec4bb96fee.js} +1 -1
  103. package/.next/static/chunks/app/new/{page-9d62ec50108c7961.js → page-b96d75506030acf8.js} +1 -1
  104. package/.next/static/chunks/app/{page-ad539065ba9128bb.js → page-35375a7c8b3d117a.js} +1 -1
  105. package/.next/static/chunks/app/personas/{page-c1a7624aea8c6ae2.js → page-3884f8907107a4e6.js} +1 -1
  106. package/.next/static/chunks/app/runs/[runId]/{page-b3364baa47b77ce9.js → page-b5bcf0c093389207.js} +1 -1
  107. package/.next/static/chunks/app/runs/{page-a91204fa64867e92.js → page-376175c1ac803558.js} +1 -1
  108. package/.next/static/chunks/app/settings/{page-69e9f3ca7747b72c.js → page-1792a3e289409b2d.js} +1 -1
  109. package/.next/static/chunks/app/settings/permissions/{page-1004af2ee3990f03.js → page-c90795aa9299bbe8.js} +1 -1
  110. package/.next/static/chunks/app/templates/page-1449b0aea2e7cb68.js +1 -0
  111. package/.next/trace +20 -20
  112. package/.next/trace-build +1 -1
  113. package/dist/daemon/index.js +1 -1
  114. package/dist/daemon/index.js.map +1 -1
  115. package/dist/daemon/routes/system.js +36 -0
  116. package/dist/daemon/routes/system.js.map +1 -1
  117. package/package.json +1 -1
  118. package/.next/server/chunks/557.js +0 -5
  119. package/.next/static/chunks/344-57b337448af965da.js +0 -1
  120. package/.next/static/chunks/720-9732eeb760e004e3.js +0 -5
  121. package/.next/static/chunks/app/templates/page-67b63a2565d8de09.js +0 -1
  122. /package/.next/static/{v29WlDqdToqFWfVlaj9CH → t0TPCOxqf83myfdgRDXNm}/_buildManifest.js +0 -0
  123. /package/.next/static/{v29WlDqdToqFWfVlaj9CH → t0TPCOxqf83myfdgRDXNm}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[91],{4372:(e,n,t)=>{"use strict";t.d(n,{G:()=>a});var i=t(9442),o=t(821),r=t(8344);function a({children:e}){return(0,i.jsxs)("div",{className:"flex h-screen w-screen overflow-hidden bg-background text-foreground",children:[(0,i.jsx)(o.AppSidebar,{}),(0,i.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,i.jsx)(r.MobileTopBar,{}),(0,i.jsx)("main",{className:"flex-1 overflow-y-auto",children:e})]})]})}},5249:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>R});var i=t(9442),o=t(6074),r=t(5902),a=t(4372),s=t(1245);function d(e,n){let t=[],i=!1,o={onmessage:null,onerror:null,onopen:null,readyState:0,url:"mock://demo",withCredentials:!1,addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!0,close:()=>{for(let e of(i=!0,t))clearTimeout(e)}};for(let r of[...e].sort((e,n)=>e.atMs-n.atMs)){let e=setTimeout(()=>{if(i)return;if(n){let e=r.payload;n("string"==typeof e.type?e.type:"",e.payload??{})}let e=o.onmessage;e&&e({data:JSON.stringify(r.payload)})},r.atMs);t.push(e)}return o}let c="review",l="**Verdict: approve**\n\n",p=[{agentName:"codex-cli-0",lineage:"codex",model:"gpt-5.5",binaryUsed:"codex",doneAtMs:3200,durationMs:3e3,usage:{inputTokens:6480,outputTokens:380,costUsd:.0094},answer:"## Codex review: `divide(a, b)`\n\n"+l+'Math is correct, types flow naturally, function is small and obvious. Approving with two notes.\n\n**The current helper:**\n```ts\nexport function divide(a: number, b: number) {\n return a / b;\n}\n```\n\n**Two minors before merge:**\n1. **Add a divide-by-zero guard.** `divide(x, 0)` silently returns `Infinity` — a footgun in any pipeline that math-chains:\n ```ts\n if (b === 0) throw new RangeError("divide: zero divisor");\n ```\n2. **Add a JSDoc block.** Three lines. Saves the next reader from reading the body to learn the type contract.'},{agentName:"gemini-cli-1",lineage:"gemini",model:"gemini-3.1-pro-preview",binaryUsed:"gemini-cli",doneAtMs:4400,durationMs:4200,usage:{inputTokens:6720,outputTokens:720,costUsd:.0258},answer:"## Gemini review: `divide(a, b)`\n\n"+l+'No structural issues. The function does one thing and the implementation matches its name. Approving with a strong suggestion to harden the test surface.\n\n**Suggested spec coverage:**\n```ts\ndescribe("divide", () => {\n it("returns a / b for finite inputs", () => {\n expect(divide(10, 2)).toBe(5);\n });\n it("rejects zero divisor", () => {\n expect(() => divide(10, 0)).toThrow();\n });\n it("rejects NaN", () => {\n expect(() => divide(NaN, 2)).toThrow();\n });\n it("rejects Infinity", () => {\n expect(() => divide(Infinity, 2)).toThrow();\n });\n});\n```\n\nFour cases close every hole I see by construction.'},{agentName:"claude-code-2",lineage:"claude",model:"claude-opus-4-7",binaryUsed:"claude-code",doneAtMs:5400,durationMs:5200,usage:{inputTokens:7100,outputTokens:1240,costUsd:.0517},answer:"## Claude review: `divide(a, b)`\n\n"+l+'Reads cleanly. The function does one thing and is trivially testable. Approving with two notes — neither blocking.\n\n**Note 1 — Zero-guard.**\n`divide(x, 0)` returns `Infinity` in JavaScript. That value flows silently through arithmetic and ends up in logs/dashboards as a real number. A typed error would prevent the silent corruption:\n```ts\nclass DivideError extends Error {}\nif (b === 0) throw new DivideError("zero divisor");\n```\n\n**Note 2 — Currency callers.**\nIf this lives on a billing/ledger hot path, prefer integer-cents or `decimal.js` over floats. IEEE 754 will accumulate cent-level drift in a high-volume ledger:\n```ts\n// safer for currency:\nexport function divideMoney(cents: number, n: number): number {\n return Math.round(cents / n);\n}\n```'},{agentName:"opencode-cli-3",lineage:"opencode",model:"opencode-go/kimi-k2.6",binaryUsed:"opencode",doneAtMs:2700,durationMs:2500,usage:{inputTokens:6240,outputTokens:280,costUsd:.0042},answer:"## Kimi review (via opencode)\n\n"+l+'Pragmatic helper. The math is correct; the holes are at the boundary, not the body. Approving — both fixes below are 60-second jobs that can land in a follow-up if you want to ship now.\n\n**Suggested patch:**\n```ts\n/**\n * Divide two finite numbers. Throws on zero divisor or non-finite input.\n */\nexport function divide(a: number, b: number): number {\n if (b === 0) throw new Error("divide: zero divisor");\n return a / b;\n}\n```\n\nAnd one test:\n```ts\nexpect(() => divide(1, 0)).toThrow("zero divisor");\n```'},{agentName:"opencode-cli-4",lineage:"opencode",model:"opencode-go/deepseek-v4-pro",binaryUsed:"opencode",doneAtMs:6200,durationMs:6e3,usage:{inputTokens:7340,outputTokens:1460,costUsd:.0228},answer:'## DeepSeek review (via opencode)\n\n**Verdict: request changes**\n\nThree blockers in a financial context. This helper would land me in a post-mortem inside three months on a busy ledger.\n\n**Blocker 1 — No divide-by-zero guard.**\n```ts\ndivide(100, 0); // → Infinity, silent corruption downstream\n```\nRequired:\n```ts\nif (b === 0) throw new DivideError("zero");\n```\n\n**Blocker 2 — No input validation.**\n```ts\ndivide("5" as any, 2); // → 2.5 (silent string coercion)\ndivide(NaN, 2); // → NaN (poisons later math)\ndivide(undefined as any, 2); // → NaN\n```\nRequired: `Number.isFinite(a) && Number.isFinite(b)` at the top.\n\n**Blocker 3 — Floats for money.**\nIEEE 754 + currency = audit-trail nightmare. Use integer-cents or `decimal.js`. Reproducer:\n```ts\n0.1 + 0.2 === 0.3; // false\ndivide(0.3, 0.1); // 2.9999999999999996\n```'},{agentName:"opencode-cli-5",lineage:"opencode",model:"opencode-go/qwen3.6-plus",binaryUsed:"opencode",doneAtMs:3700,durationMs:3500,usage:{inputTokens:6420,outputTokens:320,costUsd:.0061},answer:"## Qwen review (via opencode)\n\n"+l+"Reads cleanly. No defects in the body.\n\n**Minor — Missing documentation.**\nThree lines of JSDoc would let editor tooling surface the contract:\n```ts\n/**\n * @param a - dividend (finite number)\n * @param b - divisor (finite, non-zero)\n * @returns the quotient a / b\n */\n```\n\nHelpful for downstream callers, not blocking the merge."}];function u(e){return{participant:`reviewer-${e.agentName}`,role:"reviewer",agentName:e.agentName,lineage:e.lineage,hasAnswer:!1,model:e.model,pending:!1}}let h=[{round:1,participants:p.map(u)}],m={id:"demo-simple-6way",name:"External Review \xb7 Six Voices",description:"Six reviewers critique the artifact independently.",category:"review",agreementThreshold:"majority",onThresholdMet:"ask-user",maxRounds:1,driver:"external",driverHandoff:!1,verificationGate:"auto",costCapUsd:0,yoloDefault:!1,onError:"fail",notify:"dashboard-only",yaml:"",authorHandle:"demo",forks:0,popularity:0,phases:[{id:c,name:"External Review",description:"Six lineages critique the supplied artifact independently.",kind:"review_only",gate:"auto",doer:{lineage:"claude",models:[]},reviewer:{require:2,crossLineage:!0,candidates:["codex","gemini","claude","opencode"],candidatesWithModels:p.map(e=>({lineage:e.lineage,models:[e.model]}))},artifact:{label:"Artifact",hint:"",maxBytes:1048576},inputs:{include:[],exclude:[]},iterate:{max:1,onMax:"fail"},blindSpots:[],execution:"parallel",builtin:!0}]},v=e=>({type:"phase_start",payload:{phaseIdx:0,phaseId:c,kind:"review_only",role:"reviewer",agent:e},ts:Date.now()}),g=(e,n,t)=>({type:"phase_progress",payload:{phaseId:c,round:1,role:"reviewer",agent:e,elapsedMs:t,output:n},ts:Date.now()}),f=e=>({type:"participant_done",payload:{phaseId:c,round:1,role:"reviewer",agent:e},ts:Date.now()}),w={"codex-cli-0":"## Reviewing src/util/divide.ts\n\nCurrent implementation:\n```ts\nexport function divide(a: number, b: number) {\n return a / b;\n}\n```\n\nChecking input handling first.\n\nSpotted: no zero-guard. `divide(x, 0)` silently returns `Infinity`. In a billing pipeline that math-chains downstream, that becomes a ledger row.\n\nNo JSDoc either — readers have to read the body to learn the type contract.\n\nVerdict drafting: two minors, leaning approve with notes.","gemini-cli-1":"## Review \xb7 `divide(a, b)`\n\nReading the helper. Checking the type contract first:\n```ts\n(a: number, b: number) => number\n```\n\nCoverage gaps surfacing: `NaN`, `Infinity`, zero divisor — none asserted.\n\nDrafting a four-case spec block to close the holes by construction:\n```ts\nexpect(divide(10, 2)).toBe(5);\nexpect(() => divide(10, 0)).toThrow();\nexpect(() => divide(NaN, 2)).toThrow();\nexpect(() => divide(Infinity, 2)).toThrow();\n```\n\nApproving with this spec block as a follow-up.","claude-code-2":"## Review: divide helper\n\nLoading + cross-referencing the two callers:\n```ts\n// /billing/invoice.ts:42 — currently produces silent Infinity\nconst unitPrice = divide(invoice.total, invoice.quantity);\n\n// /reports/avg.ts:18 — already wraps in try/catch\nconst average = divide(sum, count);\n```\n\n`/billing/invoice.ts:42` is the smoking gun — confirms the silent-Infinity bug class is real, not theoretical.\n\nRecommendation:\n1. Add a zero-guard returning a typed `DivideError`.\n2. Stage `divideMoney(cents, n)` for currency callers in a follow-up.\n\nApproving the helper rewrite with these two notes.","opencode-cli-3":'## Kimi review (via opencode)\n\nInspecting `divide(a, b)`. Quick pass — math is correct, the holes are at the boundary.\n\nSuggested patch:\n```ts\n/** Divide two finite numbers. Throws on zero divisor or non-finite input. */\nexport function divide(a: number, b: number): number {\n if (b === 0) throw new Error("divide: zero divisor");\n return a / b;\n}\n```\n\nApproving — both fixes are 60-second jobs.',"opencode-cli-4":'## DeepSeek review (via opencode)\n\nLoading `divide()` + the two callers + the existing spec.\n\nReproducing the failure modes locally:\n```ts\ndivide(100, 0); // Infinity (silent corruption)\ndivide("5", 2); // 2.5 (silent string coercion)\ndivide(0.3, 0.1); // 2.9999999999999996 (IEEE 754)\n```\n\nThree blockers, all reproducible in <30 lines:\n1. **No divide-by-zero guard** — required: `Number.isFinite` check + typed error.\n2. **No input validation** — TypeScript types are erased at runtime; `as any` slips through.\n3. **Floats for money** — IEEE 754 + currency = audit-trail nightmare. Need integer-cents.\n\nWill request changes.',"opencode-cli-5":"## Qwen review (via opencode)\n\nQuick read — public API surface only.\n\nNo defects in the body. The implementation matches its name.\n\nDocumentation gap noted — three lines of JSDoc would let editor tooling surface the contract:\n```ts\n/**\n * @param a - dividend (finite number)\n * @param b - divisor (finite, non-zero)\n * @returns the quotient a / b\n */\n```\n\nApproving — JSDoc is the only minor."},b=(()=>{let e=[];for(let[n,t]of p.entries())e.push({atMs:200+20*n,payload:v(t.agentName)});for(let n of p){let t=function(e){let n=Math.floor(.3*e.length),t=Math.floor(.65*e.length);return[e.slice(0,n),e.slice(0,t),e]}(w[n.agentName]),i=[.25,.55,.85].map(e=>Math.round(n.doneAtMs*e));for(let[o,r]of t.entries())e.push({atMs:i[o],payload:g(n.agentName,r,i[o])})}for(let n of p)e.push({atMs:n.doneAtMs,payload:f(n.agentName)});let n=Math.max(...p.map(e=>e.doneAtMs));return e.push({atMs:n+200,payload:{type:"phase_done",payload:{phaseId:c,phaseIdx:0,kind:"review_only"},ts:Date.now()}}),e.push({atMs:n+400,payload:{type:"chat_done",payload:{status:"completed",verdict:"request_changes"},ts:Date.now()}}),e})(),y={agentName:"claude-code-doer",lineage:"claude",model:"claude-opus-4-7",binaryUsed:"claude-code",doneAtMs:3700,durationMs:3500},k=[{agentName:"codex-cli-0",lineage:"codex",model:"gpt-5.5",binaryUsed:"codex",doneAtMs:2800,durationMs:2600},{agentName:"gemini-cli-1",lineage:"gemini",model:"gemini-3.1-pro-preview",binaryUsed:"gemini-cli",doneAtMs:3500,durationMs:3300},{agentName:"claude-code-2",lineage:"claude",model:"claude-sonnet-4-6",binaryUsed:"claude-code",doneAtMs:3100,durationMs:2900},{agentName:"opencode-cli-3",lineage:"opencode",model:"opencode-go/kimi-k2.6",binaryUsed:"opencode",doneAtMs:3900,durationMs:3700},{agentName:"opencode-cli-4",lineage:"opencode",model:"opencode-go/deepseek-v4-pro",binaryUsed:"opencode",doneAtMs:4500,durationMs:4300}],T=[y,...k],x=[{id:"plan",name:"Plan",kind:"plan",description:"Doer drafts the implementation approach; three reviewers critique.",streams:["## Plan: divide() helper rewrite\n\n**Goal:** production-safe wrapper over `a / b`.\n\n**Three deliverables:**\n1. Zero-guard returning a typed `DivideError`.\n2. Strict input validation (numbers only, finite, non-NaN).\n3. Switch currency callers to integer-cents (`divideMoney(cents, n)` follow-up PR).\n\n**Acceptance tests:**\n```ts\nexpect(divide(10, 2)).toBe(5);\nexpect(() => divide(10, 0)).toThrow(DivideError);\nexpect(() => divide(NaN, 2)).toThrow(DivideError);\nexpect(() => divide(Infinity, 2)).toThrow(DivideError);\n```\n\n**Risks:** API churn for two callers (`/billing/invoice.ts:42`, `/reports/avg.ts:18`). Mitigation: ship v2 alongside, deprecate v1 over one minor.\n\n**Rollback:** revert single commit; no schema/migration touched.","## Codex review \xb7 plan\n\nReading the plan…\n\nThree-piece breakdown looks right:\n- zero-guard ✓\n- input validation ✓\n- decimal precision ✓\n\nAcceptance tests match the spec contract.\n\n**Approve** — sound plan. One ask: add a `bigint` handling note. The current plan is implicitly Number-only, which is the right call, but worth saying so explicitly so the next reader does not assume `BigInt` support.","## Gemini review \xb7 plan\n\nCross-checking acceptance tests against the spec contract:\n```ts\ndivide(10, 2) // 5 ✓\ndivide(10, 0) // throw ✓\ndivide(NaN, 2) // throw ✓\ndivide(Inf, 2) // throw ✓\n```\n\nConcrete enough to drive TDD.\n\n**Approve** — explicit zero-guard is the right move. One follow-up: surface the deprecation timeline in the PR body so the two affected callers can plan their cutover.","## Claude (sonnet) review \xb7 plan\n\nReading the plan + skimming the existing call sites.\n\nThree-piece breakdown is right. The `divideMoney` carve-out is the right ergonomic — keep `divide` for general arithmetic, steer money paths to integer-cents.\n\n**Approve** — one ask: pin the deprecation timeline (one minor? one major?) so the two callers can plan.","## Kimi review (via opencode) \xb7 plan\n\nPlan looks tight. Three deliverables map cleanly to three commits if you want to split for review.\n\nAcceptance test set is the right shape — unit tests against the contract, not the implementation.\n\n**Approve** — pragmatic and shippable.","## DeepSeek review \xb7 plan\n\nPulling the existing `divide()` implementation for context:\n```ts\nexport function divide(a, b) { return a / b; }\n```\n\nCross-checking against the silent-Infinity bug class.\n\nNeed a non-finite-input row added to the acceptance tests:\n```ts\nexpect(() => divide(Number.POSITIVE_INFINITY, 2)).toThrow(DivideError);\nexpect(() => divide(2, Number.NEGATIVE_INFINITY)).toThrow(DivideError);\n```\n\nThe silent-Infinity bug is what triggered this rewrite, so the test set should explicitly cover both directions.\n\n**Approve with notes** — solid plan, just close that gap."],usage:[{inputTokens:6420,outputTokens:1840,costUsd:.0682},{inputTokens:5800,outputTokens:380,costUsd:.0094},{inputTokens:6020,outputTokens:540,costUsd:.0241},{inputTokens:6020,outputTokens:410,costUsd:.0086},{inputTokens:6240,outputTokens:320,costUsd:.0048},{inputTokens:6280,outputTokens:1140,costUsd:.0488}]},{id:"spec",name:"Spec",kind:"spec",description:"Doer derives the API contract; reviewers check alignment.",streams:['## Spec: `divide(a, b)`\n\n```ts\nexport class DivideError extends Error {\n constructor(public readonly reason: "zero" | "non-finite") {\n super(`divide: ${reason}`);\n this.name = "DivideError";\n }\n}\n\nexport function divide(a: number, b: number): number;\n```\n\n**Contract:**\n- `b === 0` → throws `DivideError("zero")`\n- `!Number.isFinite(a)` → throws `DivideError("non-finite")`\n- `!Number.isFinite(b)` → throws `DivideError("non-finite")`\n- otherwise → returns `a / b`\n\n**Order of checks:** non-finite first so `divide(NaN, 0)` reports the more specific failure.',"## Codex review \xb7 spec\n\nReading the type signature:\n```ts\n(a: number, b: number) => number\n```\n\nClean. Examples cover happy + zero + non-finite.\n\n**Approve** — suggest adding NaN explicitly to the example block:\n```ts\nexpect(() => divide(NaN, 5)).toThrow(/non-finite/);\n```\n\n`Number.isFinite(NaN)` returns false so it is covered, but enumerating it makes the intent explicit.",'## Gemini review \xb7 spec\n\nThe `reason` discriminant on the error class is the right ergonomic for callers that need to branch:\n```ts\ntry { return divide(a, b); }\ncatch (err) {\n if (err instanceof DivideError && err.reason === "zero") return 0;\n throw err;\n}\n```\n\nThat pattern beats string parsing on `err.message`.\n\n**Approve** — no structural concerns.','## Claude (sonnet) review \xb7 spec\n\n`DivideError` class is well-scoped. The `name = "DivideError"` assignment is the kind of detail that pays off in stack traces:\n```\nDivideError: divide: zero\n at /billing/invoice.ts:42\n```\n\n**Approve.**',"## Kimi review (via opencode) \xb7 spec\n\nType signature is unambiguous. The `reason` discriminant lets callers branch on failure type without string parsing.\n\nOrder-of-checks (non-finite first) is the right call.\n\n**Approve** — ready for implement.","## DeepSeek review \xb7 spec\n\nLoading spec + cross-checking against plan.\n\nExamples should include negatives and -Infinity:\n```ts\nexpect(divide(-10, 2)).toBe(-5);\nexpect(divide(10, -2)).toBe(-5);\nexpect(() => divide(Number.NEGATIVE_INFINITY, 2)).toThrow();\n```\n\nThe spec contract handles them correctly via `Number.isFinite`, but the example block sets the test surface and should be exhaustive.\n\n**Approve with notes.**"],usage:[{inputTokens:7240,outputTokens:1620,costUsd:.0731},{inputTokens:6500,outputTokens:320,costUsd:.0086},{inputTokens:6720,outputTokens:460,costUsd:.0218},{inputTokens:6720,outputTokens:380,costUsd:.0078},{inputTokens:6900,outputTokens:280,costUsd:.0042},{inputTokens:6980,outputTokens:980,costUsd:.0431}]},{id:"implement",name:"Implement",kind:"implement",description:"Doer writes the code blind to tests; reviewers find bugs.",streams:['## Implementation: `src/util/divide.ts`\n\n```ts\nexport class DivideError extends Error {\n constructor(public readonly reason: "zero" | "non-finite") {\n super(`divide: ${reason}`);\n this.name = "DivideError";\n }\n}\n\nexport function divide(a: number, b: number): number {\n if (!Number.isFinite(a) || !Number.isFinite(b)) {\n throw new DivideError("non-finite");\n }\n if (b === 0) {\n throw new DivideError("zero");\n }\n return a / b;\n}\n```\n\n**Notes:**\n- Non-finite check first so `divide(NaN, 0)` reports `"non-finite"`, not `"zero"`.\n- `name` set on `DivideError` so stack traces read `DivideError: divide: zero`.','## Codex review \xb7 diff\n\nPulling the diff. Reading each branch:\n\n✓ `Number.isFinite` — rejects NaN, \xb1Infinity, non-numbers via type system.\n✓ Zero-check after — order is correct.\n✓ `DivideError` extends `Error` with `name` set.\n\nOrder of checks decision is the correct call:\n```ts\ndivide(NaN, 0); // → "non-finite" (more specific failure first)\n```\n\n**Approve** — implementation is clean. Nothing to push back on.','## Gemini review \xb7 diff\n\nThe patch matches the spec line-for-line.\n\nThe `name` assignment on `DivideError`:\n```ts\nthis.name = "DivideError";\n```\n\nis the kind of detail that pays off the first time someone reads a stack trace — `DivideError: divide: zero` is actionable; `Error: divide: zero` looks like a generic throw and gets noise-suppressed.\n\n**Approve.**',"## Claude (sonnet) review \xb7 diff\n\nReads cleanly. Inline validation is fine for two args; would extract `isInvalid()` if this grew.\n\nThe `name` assignment on `DivideError` is the right detail — actionable stack traces over generic `Error: ...` lines.\n\n**Approve.**","## Kimi review (via opencode) \xb7 diff\n\nSmall, obvious, complete. 13 lines that do exactly what the spec said.\n\nReads in one breath:\n```ts\nif (!Number.isFinite(a) || !Number.isFinite(b)) throw …;\nif (b === 0) throw …;\nreturn a / b;\n```\n\n**Approve.**","## DeepSeek review \xb7 diff\n\nDiff loaded. Walking each branch.\n\nWant a `-0` test note before merge — JavaScript treats `-0 === 0` as `true`, so the existing zero-guard catches it, but the test pins the behaviour:\n```ts\nexpect(divide(10, -2)).toBe(-5);\nexpect(() => divide(10, -0)).toThrow(/zero/); // -0 === 0\n```\n\nThe `-0` case is the easy miss — without the test, an accidental refactor to `if (b !== 0)` would pass the existing suite.\n\n**Approve with notes.**"],usage:[{inputTokens:8120,outputTokens:1980,costUsd:.0892},{inputTokens:7300,outputTokens:280,costUsd:.0072},{inputTokens:7440,outputTokens:460,costUsd:.0214},{inputTokens:7440,outputTokens:320,costUsd:.0066},{inputTokens:7620,outputTokens:360,costUsd:.0054},{inputTokens:7720,outputTokens:1180,costUsd:.0508}]},{id:"verify",name:"Verify",kind:"verify",description:"Run the test suite; reviewers confirm coverage.",streams:['## Verify\n\n```\n$ pnpm test src/util/divide.test.ts\n\n ✓ divide > returns a / b for valid inputs\n ✓ divide > handles negative dividends\n ✓ divide > handles negative divisors\n ✓ divide > -0 is treated as 0 (throws "zero")\n ✓ divide > throws "zero" for b=0\n ✓ divide > throws "non-finite" for NaN\n ✓ divide > throws "non-finite" for \xb1Infinity\n ✓ divide > non-finite check precedes zero check\n ✓ DivideError > extends Error\n ✓ DivideError > exposes reason discriminant\n\n Tests: 12 passed (12)\n Coverage: 100% lines, 100% branches\n Lint: clean\n Types: clean\n Time: 1.42s\n```',"## Codex review \xb7 verify\n\nTest report loaded.\n\n✓ 12/12 pass, 0 fail, 0 skip\n✓ Coverage 100/100/100\n✓ Lint + types clean\n\nEvery spec case has a corresponding test. The `-0` row is what the implement-phase review asked for; merged correctly.\n\n**Approve** — nothing to add.","## Gemini review \xb7 verify\n\nReading the report:\n```\nTests: 12 passed (12)\nCoverage: 100% lines, 100% branches\n```\n\nNo flakes, no skips. The `Tests: 12 passed (12)` line is exactly what the merge gate looks for.\n\nCoverage 100/100/100 satisfies the production-utility bar.\n\n**Approve.**","## Claude (sonnet) review \xb7 verify\n\n12 tests for a 13-line function is honest coverage, not theatre. Each test asserts a real boundary condition.\n\nThe `non-finite check precedes zero check` assertion is doing real work — it pins the order-of-checks decision so a future refactor cannot silently swap them.\n\n**Approve.**","## Kimi review (via opencode) \xb7 verify\n\n✓ 12/12 pass\n✓ Coverage 100/100/100\n✓ No flakes, no skips\n\nShip it.\n\n**Approve.**","## DeepSeek review \xb7 verify\n\nPulling test report + spec for cross-check.\n\n12 tests for a 13-line function is honest coverage, not theatre. Each test asserts a real boundary:\n\n- happy path \xd7 4\n- zero divisor + -0\n- NaN + \xb1Infinity\n- order-of-checks invariant\n- DivideError shape + discriminant\n\nThe `non-finite check precedes zero check` assertion pins the order-of-checks decision so a future refactor cannot silently swap them.\n\n**Approve.**"],usage:[{inputTokens:8980,outputTokens:1340,costUsd:.0641},{inputTokens:8060,outputTokens:80,costUsd:.0021},{inputTokens:8230,outputTokens:360,costUsd:.0179},{inputTokens:8230,outputTokens:280,costUsd:.0058},{inputTokens:8410,outputTokens:220,costUsd:.0033},{inputTokens:8520,outputTokens:1060,costUsd:.0418}]},{id:"pr",name:"Ship",kind:"pr",description:"Doer drafts the PR; reviewers approve merge.",streams:["## PR draft\n\n**Title:** `feat(util): production-safe divide() with DivideError + 100% branch coverage`\n\n**Body:**\n```\nIntroduces a hardened `divide()` per the attached spec.\n\nWhat:\n- New DivideError class with typed reason discriminant\n- divide(a, b) rejects non-finite + zero divisor\n- 12 new tests; 100% line + branch coverage\n- Two existing callers updated\n\nWhy:\n- Silent Infinity from divide(x, 0) was a footgun in /billing\n- IEEE 754 currency math driving audit-trail drift; companion\n divideMoney(cents, n) lands in #4129\n\nRisk:\n- Two callers updated; no other call sites in repo\n- Rollback: revert this commit (no schema touched)\n- Backward-compat: divide() v1 stays exported for one minor\n\nCloses #4127\n```","## Codex review \xb7 PR\n\nTitle is clear and accurate. Body follows the What/Why/Risk structure the merge gate expects.\n\nTwo-caller scope is small enough to revert cleanly if needed.\n\nCloses link is correct.\n\n**Approve merge.**","## Gemini review \xb7 PR\n\nContext is well-summarised. Calling out `divideMoney` as the follow-up PR (#4129) sets the right expectation for reviewers.\n\n`Closes #4127` ties the work to the original bug report — the audit trail is intact.\n\n**Approve merge.**","## Claude (sonnet) review \xb7 PR\n\nNo surprises. Two-caller scope is bounded, rollback is a single revert, backward-compat note covers the cutover.\n\nOn-call will not be paged at 3am over this one.\n\n**Approve merge.**","## Kimi review (via opencode) \xb7 PR\n\nTitle + body land the message in three sentences. Verify report linked. Risk section names the actual callers.\n\nShip it.\n\n**Approve merge.**","## DeepSeek review \xb7 PR\n\nPR + verify report cross-loaded. Risk + rollback note is the kind of thing on-call appreciates.\n\nVerify report (12 tests, 100% branch) is linked. Closes link to #4127 ties the work to the original bug.\n\nBackward-compat note covers the cutover window:\n> divide() v1 stays exported for one minor before removal\n\nNothing held back.\n\n**Approve merge.**"],usage:[{inputTokens:9420,outputTokens:1480,costUsd:.0712},{inputTokens:8460,outputTokens:60,costUsd:.0017},{inputTokens:8640,outputTokens:320,costUsd:.0163},{inputTokens:8640,outputTokens:280,costUsd:.0058},{inputTokens:8820,outputTokens:240,costUsd:.0036},{inputTokens:8930,outputTokens:920,costUsd:.0388}]}];function N(e,n){return{participant:`${e}-${n.agentName}`,role:e,agentName:n.agentName,lineage:n.lineage,hasAnswer:!1,model:n.model,pending:!1}}function E(e,n,t,i){return{participant:`${e}-${n.agentName}`,role:e,agentName:n.agentName,lineage:n.lineage,hasAnswer:!0,answer:t,durationMs:n.durationMs,model:n.model,binaryUsed:n.binaryUsed,modelUsed:n.model,usage:i}}function M(){return[N("doer",y),...k.map(e=>N("reviewer",e))]}let D=[{round:1,participants:M()}],A={id:"demo-complex-6way",name:"Plan → Ship Workflow",description:"Five-phase workflow with five reviewers per phase.",category:"review",agreementThreshold:"majority",onThresholdMet:"auto-finalize",maxRounds:1,driver:"external",driverHandoff:!1,verificationGate:"auto",costCapUsd:0,yoloDefault:!1,onError:"fail",notify:"dashboard-only",yaml:"",authorHandle:"demo",forks:0,popularity:0,phases:x.map(e=>({id:e.id,name:e.name,description:e.description,kind:e.kind,gate:"auto",doer:{lineage:"claude",models:["claude-opus-4-7"]},reviewer:{require:2,crossLineage:!0,candidates:["codex","gemini","opencode"],candidatesWithModels:k.map(e=>({lineage:e.lineage,models:[e.model]}))},artifact:{label:"Artifact",hint:"",maxBytes:1048576},inputs:{include:[],exclude:[]},iterate:{max:1,onMax:"fail"},blindSpots:[],execution:"parallel",builtin:!0}))},I=(e,n,t)=>{let i=[],o=n.id;for(let[r,a]of T.entries())i.push({atMs:t+30*r,payload:{type:"phase_start",payload:{phaseIdx:e,phaseId:o,kind:n.kind,role:0===r?"doer":"reviewer",agent:a.agentName},ts:Date.now()}});for(let[e,r]of T.entries()){let a=0===e?"doer":"reviewer",s=function(e){let n=Math.floor(.3*e.length),t=Math.floor(.65*e.length);return[e.slice(0,n),e.slice(0,t),e]}(n.streams[e]),d=[.25,.55,.85].map(e=>Math.round(r.doneAtMs*e));for(let[e,n]of s.entries())i.push({atMs:t+d[e],payload:{type:"phase_progress",payload:{phaseId:o,round:1,role:a,agent:r.agentName,elapsedMs:d[e],output:n},ts:Date.now()}})}for(let[e,n]of T.entries()){let r=0===e?"doer":"reviewer";i.push({atMs:t+n.doneAtMs,payload:{type:"participant_done",payload:{phaseId:o,round:1,role:r,agent:n.agentName},ts:Date.now()}})}return i.push({atMs:t+5e3-100,payload:{type:"phase_done",payload:{phaseId:o,phaseIdx:e,kind:n.kind},ts:Date.now()}}),i},U=(()=>{let e=[];for(let[n,t]of x.entries())e.push(...I(n,t,200+5e3*n));return e.push({atMs:200+5e3*x.length+300,payload:{type:"chat_done",payload:{status:"merged",verdict:"approve",prUrl:"https://github.com/example/repo/pull/4128"},ts:Date.now()}}),e})(),S={"simple-6way":{template:m,initialRounds:h,work:"Review src/util/divide.ts for production-readiness — six lineages, one pass, blockers welcome.",buildDataSource:function(){let e={currentParticipants:p.map(u)};return{createEventSource:()=>d(b,(n,t)=>{!function(e,n,t){if("participant_done"!==n)return;let i=t.agent;if(!i)return;let o=p.find(e=>e.agentName===i);o&&(e.currentParticipants=e.currentParticipants.map(e=>e.agentName===i?{participant:`reviewer-${o.agentName}`,role:"reviewer",agentName:o.agentName,lineage:o.lineage,hasAnswer:!0,answer:o.answer,durationMs:o.durationMs,model:o.model,binaryUsed:o.binaryUsed,modelUsed:o.model,usage:o.usage}:e))}(e,n,t)}),fetchArtifacts:()=>({rounds:[{round:1,participants:e.currentParticipants}]})}}},"complex-6way":{template:A,initialRounds:D,work:"feat(util): production-safe divide() — Plan → Spec → Implement → Verify → Ship • closes #4127",buildDataSource:function(){let e={currentPhaseIdx:0,currentParticipants:M()};return{createEventSource:()=>d(U,(n,t)=>{!function(e,n,t){if("phase_start"===n){let n=t.phaseIdx;"number"==typeof n&&n!==e.currentPhaseIdx&&(e.currentPhaseIdx=n,e.currentParticipants=M());return}if("participant_done"===n){let n=t.agent;if(!n)return;let i=T.findIndex(e=>e.agentName===n);if(i<0)return;let o=T[i],r=x[e.currentPhaseIdx];if(!r)return;let a=E(0===i?"doer":"reviewer",o,r.streams[i],r.usage[i]);e.currentParticipants=e.currentParticipants.map(e=>e.agentName===n?a:e);return}if("chat_done"===n){let n=x[x.length-1];e.currentParticipants=T.map((e,t)=>E(0===t?"doer":"reviewer",e,n.streams[t],n.usage[t])),e.currentPhaseIdx=x.length-1}}(e,n,t)}),fetchArtifacts:()=>({rounds:[{round:1,participants:e.currentParticipants}]})}}}};function R({params:e}){let{scenario:n}=(0,o.use)(e),t=S[n];t||(0,r.notFound)();let d=(0,o.useMemo)(()=>`demo-${n}-${Math.random().toString(36).slice(2,8)}`,[n]),c=(0,o.useMemo)(()=>t.buildDataSource(),[t]);return(0,i.jsx)(a.G,{children:(0,i.jsx)("div",{className:"mx-auto max-w-[1700px] px-6 py-6",children:(0,i.jsx)(s.LiveRunReal,{chatId:d,initialStatus:"reviewing",initialRounds:t.initialRounds,template:t.template,templateId:t.template.id,work:t.work,demoDataSource:c})})})}},6255:(e,n,t)=>{Promise.resolve().then(t.bind(t,5249))}},e=>{e.O(0,[116,720,641,344,245,506,128,358],()=>e(e.s=6255)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[91],{4372:(e,n,t)=>{"use strict";t.d(n,{G:()=>a});var i=t(9442),o=t(821),r=t(8344);function a({children:e}){return(0,i.jsxs)("div",{className:"flex h-screen w-screen overflow-hidden bg-background text-foreground",children:[(0,i.jsx)(o.AppSidebar,{}),(0,i.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,i.jsx)(r.MobileTopBar,{}),(0,i.jsx)("main",{className:"flex-1 overflow-y-auto",children:e})]})]})}},5249:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>R});var i=t(9442),o=t(6074),r=t(5902),a=t(4372),s=t(1245);function d(e,n){let t=[],i=!1,o={onmessage:null,onerror:null,onopen:null,readyState:0,url:"mock://demo",withCredentials:!1,addEventListener:()=>{},removeEventListener:()=>{},dispatchEvent:()=>!0,close:()=>{for(let e of(i=!0,t))clearTimeout(e)}};for(let r of[...e].sort((e,n)=>e.atMs-n.atMs)){let e=setTimeout(()=>{if(i)return;if(n){let e=r.payload;n("string"==typeof e.type?e.type:"",e.payload??{})}let e=o.onmessage;e&&e({data:JSON.stringify(r.payload)})},r.atMs);t.push(e)}return o}let c="review",l="**Verdict: approve**\n\n",p=[{agentName:"codex-cli-0",lineage:"codex",model:"gpt-5.5",binaryUsed:"codex",doneAtMs:3200,durationMs:3e3,usage:{inputTokens:6480,outputTokens:380,costUsd:.0094},answer:"## Codex review: `divide(a, b)`\n\n"+l+'Math is correct, types flow naturally, function is small and obvious. Approving with two notes.\n\n**The current helper:**\n```ts\nexport function divide(a: number, b: number) {\n return a / b;\n}\n```\n\n**Two minors before merge:**\n1. **Add a divide-by-zero guard.** `divide(x, 0)` silently returns `Infinity` — a footgun in any pipeline that math-chains:\n ```ts\n if (b === 0) throw new RangeError("divide: zero divisor");\n ```\n2. **Add a JSDoc block.** Three lines. Saves the next reader from reading the body to learn the type contract.'},{agentName:"gemini-cli-1",lineage:"gemini",model:"gemini-3.1-pro-preview",binaryUsed:"gemini-cli",doneAtMs:4400,durationMs:4200,usage:{inputTokens:6720,outputTokens:720,costUsd:.0258},answer:"## Gemini review: `divide(a, b)`\n\n"+l+'No structural issues. The function does one thing and the implementation matches its name. Approving with a strong suggestion to harden the test surface.\n\n**Suggested spec coverage:**\n```ts\ndescribe("divide", () => {\n it("returns a / b for finite inputs", () => {\n expect(divide(10, 2)).toBe(5);\n });\n it("rejects zero divisor", () => {\n expect(() => divide(10, 0)).toThrow();\n });\n it("rejects NaN", () => {\n expect(() => divide(NaN, 2)).toThrow();\n });\n it("rejects Infinity", () => {\n expect(() => divide(Infinity, 2)).toThrow();\n });\n});\n```\n\nFour cases close every hole I see by construction.'},{agentName:"claude-code-2",lineage:"claude",model:"claude-opus-4-7",binaryUsed:"claude-code",doneAtMs:5400,durationMs:5200,usage:{inputTokens:7100,outputTokens:1240,costUsd:.0517},answer:"## Claude review: `divide(a, b)`\n\n"+l+'Reads cleanly. The function does one thing and is trivially testable. Approving with two notes — neither blocking.\n\n**Note 1 — Zero-guard.**\n`divide(x, 0)` returns `Infinity` in JavaScript. That value flows silently through arithmetic and ends up in logs/dashboards as a real number. A typed error would prevent the silent corruption:\n```ts\nclass DivideError extends Error {}\nif (b === 0) throw new DivideError("zero divisor");\n```\n\n**Note 2 — Currency callers.**\nIf this lives on a billing/ledger hot path, prefer integer-cents or `decimal.js` over floats. IEEE 754 will accumulate cent-level drift in a high-volume ledger:\n```ts\n// safer for currency:\nexport function divideMoney(cents: number, n: number): number {\n return Math.round(cents / n);\n}\n```'},{agentName:"opencode-cli-3",lineage:"opencode",model:"opencode-go/kimi-k2.6",binaryUsed:"opencode",doneAtMs:2700,durationMs:2500,usage:{inputTokens:6240,outputTokens:280,costUsd:.0042},answer:"## Kimi review (via opencode)\n\n"+l+'Pragmatic helper. The math is correct; the holes are at the boundary, not the body. Approving — both fixes below are 60-second jobs that can land in a follow-up if you want to ship now.\n\n**Suggested patch:**\n```ts\n/**\n * Divide two finite numbers. Throws on zero divisor or non-finite input.\n */\nexport function divide(a: number, b: number): number {\n if (b === 0) throw new Error("divide: zero divisor");\n return a / b;\n}\n```\n\nAnd one test:\n```ts\nexpect(() => divide(1, 0)).toThrow("zero divisor");\n```'},{agentName:"opencode-cli-4",lineage:"opencode",model:"opencode-go/deepseek-v4-pro",binaryUsed:"opencode",doneAtMs:6200,durationMs:6e3,usage:{inputTokens:7340,outputTokens:1460,costUsd:.0228},answer:'## DeepSeek review (via opencode)\n\n**Verdict: request changes**\n\nThree blockers in a financial context. This helper would land me in a post-mortem inside three months on a busy ledger.\n\n**Blocker 1 — No divide-by-zero guard.**\n```ts\ndivide(100, 0); // → Infinity, silent corruption downstream\n```\nRequired:\n```ts\nif (b === 0) throw new DivideError("zero");\n```\n\n**Blocker 2 — No input validation.**\n```ts\ndivide("5" as any, 2); // → 2.5 (silent string coercion)\ndivide(NaN, 2); // → NaN (poisons later math)\ndivide(undefined as any, 2); // → NaN\n```\nRequired: `Number.isFinite(a) && Number.isFinite(b)` at the top.\n\n**Blocker 3 — Floats for money.**\nIEEE 754 + currency = audit-trail nightmare. Use integer-cents or `decimal.js`. Reproducer:\n```ts\n0.1 + 0.2 === 0.3; // false\ndivide(0.3, 0.1); // 2.9999999999999996\n```'},{agentName:"opencode-cli-5",lineage:"opencode",model:"opencode-go/qwen3.6-plus",binaryUsed:"opencode",doneAtMs:3700,durationMs:3500,usage:{inputTokens:6420,outputTokens:320,costUsd:.0061},answer:"## Qwen review (via opencode)\n\n"+l+"Reads cleanly. No defects in the body.\n\n**Minor — Missing documentation.**\nThree lines of JSDoc would let editor tooling surface the contract:\n```ts\n/**\n * @param a - dividend (finite number)\n * @param b - divisor (finite, non-zero)\n * @returns the quotient a / b\n */\n```\n\nHelpful for downstream callers, not blocking the merge."}];function u(e){return{participant:`reviewer-${e.agentName}`,role:"reviewer",agentName:e.agentName,lineage:e.lineage,hasAnswer:!1,model:e.model,pending:!1}}let h=[{round:1,participants:p.map(u)}],m={id:"demo-simple-6way",name:"External Review \xb7 Six Voices",description:"Six reviewers critique the artifact independently.",category:"review",agreementThreshold:"majority",onThresholdMet:"ask-user",maxRounds:1,driver:"external",driverHandoff:!1,verificationGate:"auto",costCapUsd:0,yoloDefault:!1,onError:"fail",notify:"dashboard-only",yaml:"",authorHandle:"demo",forks:0,popularity:0,phases:[{id:c,name:"External Review",description:"Six lineages critique the supplied artifact independently.",kind:"review_only",gate:"auto",doer:{lineage:"claude",models:[]},reviewer:{require:2,crossLineage:!0,candidates:["codex","gemini","claude","opencode"],candidatesWithModels:p.map(e=>({lineage:e.lineage,models:[e.model]}))},artifact:{label:"Artifact",hint:"",maxBytes:1048576},inputs:{include:[],exclude:[]},iterate:{max:1,onMax:"fail"},blindSpots:[],execution:"parallel",builtin:!0}]},v=e=>({type:"phase_start",payload:{phaseIdx:0,phaseId:c,kind:"review_only",role:"reviewer",agent:e},ts:Date.now()}),g=(e,n,t)=>({type:"phase_progress",payload:{phaseId:c,round:1,role:"reviewer",agent:e,elapsedMs:t,output:n},ts:Date.now()}),f=e=>({type:"participant_done",payload:{phaseId:c,round:1,role:"reviewer",agent:e},ts:Date.now()}),w={"codex-cli-0":"## Reviewing src/util/divide.ts\n\nCurrent implementation:\n```ts\nexport function divide(a: number, b: number) {\n return a / b;\n}\n```\n\nChecking input handling first.\n\nSpotted: no zero-guard. `divide(x, 0)` silently returns `Infinity`. In a billing pipeline that math-chains downstream, that becomes a ledger row.\n\nNo JSDoc either — readers have to read the body to learn the type contract.\n\nVerdict drafting: two minors, leaning approve with notes.","gemini-cli-1":"## Review \xb7 `divide(a, b)`\n\nReading the helper. Checking the type contract first:\n```ts\n(a: number, b: number) => number\n```\n\nCoverage gaps surfacing: `NaN`, `Infinity`, zero divisor — none asserted.\n\nDrafting a four-case spec block to close the holes by construction:\n```ts\nexpect(divide(10, 2)).toBe(5);\nexpect(() => divide(10, 0)).toThrow();\nexpect(() => divide(NaN, 2)).toThrow();\nexpect(() => divide(Infinity, 2)).toThrow();\n```\n\nApproving with this spec block as a follow-up.","claude-code-2":"## Review: divide helper\n\nLoading + cross-referencing the two callers:\n```ts\n// /billing/invoice.ts:42 — currently produces silent Infinity\nconst unitPrice = divide(invoice.total, invoice.quantity);\n\n// /reports/avg.ts:18 — already wraps in try/catch\nconst average = divide(sum, count);\n```\n\n`/billing/invoice.ts:42` is the smoking gun — confirms the silent-Infinity bug class is real, not theoretical.\n\nRecommendation:\n1. Add a zero-guard returning a typed `DivideError`.\n2. Stage `divideMoney(cents, n)` for currency callers in a follow-up.\n\nApproving the helper rewrite with these two notes.","opencode-cli-3":'## Kimi review (via opencode)\n\nInspecting `divide(a, b)`. Quick pass — math is correct, the holes are at the boundary.\n\nSuggested patch:\n```ts\n/** Divide two finite numbers. Throws on zero divisor or non-finite input. */\nexport function divide(a: number, b: number): number {\n if (b === 0) throw new Error("divide: zero divisor");\n return a / b;\n}\n```\n\nApproving — both fixes are 60-second jobs.',"opencode-cli-4":'## DeepSeek review (via opencode)\n\nLoading `divide()` + the two callers + the existing spec.\n\nReproducing the failure modes locally:\n```ts\ndivide(100, 0); // Infinity (silent corruption)\ndivide("5", 2); // 2.5 (silent string coercion)\ndivide(0.3, 0.1); // 2.9999999999999996 (IEEE 754)\n```\n\nThree blockers, all reproducible in <30 lines:\n1. **No divide-by-zero guard** — required: `Number.isFinite` check + typed error.\n2. **No input validation** — TypeScript types are erased at runtime; `as any` slips through.\n3. **Floats for money** — IEEE 754 + currency = audit-trail nightmare. Need integer-cents.\n\nWill request changes.',"opencode-cli-5":"## Qwen review (via opencode)\n\nQuick read — public API surface only.\n\nNo defects in the body. The implementation matches its name.\n\nDocumentation gap noted — three lines of JSDoc would let editor tooling surface the contract:\n```ts\n/**\n * @param a - dividend (finite number)\n * @param b - divisor (finite, non-zero)\n * @returns the quotient a / b\n */\n```\n\nApproving — JSDoc is the only minor."},b=(()=>{let e=[];for(let[n,t]of p.entries())e.push({atMs:200+20*n,payload:v(t.agentName)});for(let n of p){let t=function(e){let n=Math.floor(.3*e.length),t=Math.floor(.65*e.length);return[e.slice(0,n),e.slice(0,t),e]}(w[n.agentName]),i=[.25,.55,.85].map(e=>Math.round(n.doneAtMs*e));for(let[o,r]of t.entries())e.push({atMs:i[o],payload:g(n.agentName,r,i[o])})}for(let n of p)e.push({atMs:n.doneAtMs,payload:f(n.agentName)});let n=Math.max(...p.map(e=>e.doneAtMs));return e.push({atMs:n+200,payload:{type:"phase_done",payload:{phaseId:c,phaseIdx:0,kind:"review_only"},ts:Date.now()}}),e.push({atMs:n+400,payload:{type:"chat_done",payload:{status:"completed",verdict:"request_changes"},ts:Date.now()}}),e})(),y={agentName:"claude-code-doer",lineage:"claude",model:"claude-opus-4-7",binaryUsed:"claude-code",doneAtMs:3700,durationMs:3500},k=[{agentName:"codex-cli-0",lineage:"codex",model:"gpt-5.5",binaryUsed:"codex",doneAtMs:2800,durationMs:2600},{agentName:"gemini-cli-1",lineage:"gemini",model:"gemini-3.1-pro-preview",binaryUsed:"gemini-cli",doneAtMs:3500,durationMs:3300},{agentName:"claude-code-2",lineage:"claude",model:"claude-sonnet-4-6",binaryUsed:"claude-code",doneAtMs:3100,durationMs:2900},{agentName:"opencode-cli-3",lineage:"opencode",model:"opencode-go/kimi-k2.6",binaryUsed:"opencode",doneAtMs:3900,durationMs:3700},{agentName:"opencode-cli-4",lineage:"opencode",model:"opencode-go/deepseek-v4-pro",binaryUsed:"opencode",doneAtMs:4500,durationMs:4300}],T=[y,...k],x=[{id:"plan",name:"Plan",kind:"plan",description:"Doer drafts the implementation approach; three reviewers critique.",streams:["## Plan: divide() helper rewrite\n\n**Goal:** production-safe wrapper over `a / b`.\n\n**Three deliverables:**\n1. Zero-guard returning a typed `DivideError`.\n2. Strict input validation (numbers only, finite, non-NaN).\n3. Switch currency callers to integer-cents (`divideMoney(cents, n)` follow-up PR).\n\n**Acceptance tests:**\n```ts\nexpect(divide(10, 2)).toBe(5);\nexpect(() => divide(10, 0)).toThrow(DivideError);\nexpect(() => divide(NaN, 2)).toThrow(DivideError);\nexpect(() => divide(Infinity, 2)).toThrow(DivideError);\n```\n\n**Risks:** API churn for two callers (`/billing/invoice.ts:42`, `/reports/avg.ts:18`). Mitigation: ship v2 alongside, deprecate v1 over one minor.\n\n**Rollback:** revert single commit; no schema/migration touched.","## Codex review \xb7 plan\n\nReading the plan…\n\nThree-piece breakdown looks right:\n- zero-guard ✓\n- input validation ✓\n- decimal precision ✓\n\nAcceptance tests match the spec contract.\n\n**Approve** — sound plan. One ask: add a `bigint` handling note. The current plan is implicitly Number-only, which is the right call, but worth saying so explicitly so the next reader does not assume `BigInt` support.","## Gemini review \xb7 plan\n\nCross-checking acceptance tests against the spec contract:\n```ts\ndivide(10, 2) // 5 ✓\ndivide(10, 0) // throw ✓\ndivide(NaN, 2) // throw ✓\ndivide(Inf, 2) // throw ✓\n```\n\nConcrete enough to drive TDD.\n\n**Approve** — explicit zero-guard is the right move. One follow-up: surface the deprecation timeline in the PR body so the two affected callers can plan their cutover.","## Claude (sonnet) review \xb7 plan\n\nReading the plan + skimming the existing call sites.\n\nThree-piece breakdown is right. The `divideMoney` carve-out is the right ergonomic — keep `divide` for general arithmetic, steer money paths to integer-cents.\n\n**Approve** — one ask: pin the deprecation timeline (one minor? one major?) so the two callers can plan.","## Kimi review (via opencode) \xb7 plan\n\nPlan looks tight. Three deliverables map cleanly to three commits if you want to split for review.\n\nAcceptance test set is the right shape — unit tests against the contract, not the implementation.\n\n**Approve** — pragmatic and shippable.","## DeepSeek review \xb7 plan\n\nPulling the existing `divide()` implementation for context:\n```ts\nexport function divide(a, b) { return a / b; }\n```\n\nCross-checking against the silent-Infinity bug class.\n\nNeed a non-finite-input row added to the acceptance tests:\n```ts\nexpect(() => divide(Number.POSITIVE_INFINITY, 2)).toThrow(DivideError);\nexpect(() => divide(2, Number.NEGATIVE_INFINITY)).toThrow(DivideError);\n```\n\nThe silent-Infinity bug is what triggered this rewrite, so the test set should explicitly cover both directions.\n\n**Approve with notes** — solid plan, just close that gap."],usage:[{inputTokens:6420,outputTokens:1840,costUsd:.0682},{inputTokens:5800,outputTokens:380,costUsd:.0094},{inputTokens:6020,outputTokens:540,costUsd:.0241},{inputTokens:6020,outputTokens:410,costUsd:.0086},{inputTokens:6240,outputTokens:320,costUsd:.0048},{inputTokens:6280,outputTokens:1140,costUsd:.0488}]},{id:"spec",name:"Spec",kind:"spec",description:"Doer derives the API contract; reviewers check alignment.",streams:['## Spec: `divide(a, b)`\n\n```ts\nexport class DivideError extends Error {\n constructor(public readonly reason: "zero" | "non-finite") {\n super(`divide: ${reason}`);\n this.name = "DivideError";\n }\n}\n\nexport function divide(a: number, b: number): number;\n```\n\n**Contract:**\n- `b === 0` → throws `DivideError("zero")`\n- `!Number.isFinite(a)` → throws `DivideError("non-finite")`\n- `!Number.isFinite(b)` → throws `DivideError("non-finite")`\n- otherwise → returns `a / b`\n\n**Order of checks:** non-finite first so `divide(NaN, 0)` reports the more specific failure.',"## Codex review \xb7 spec\n\nReading the type signature:\n```ts\n(a: number, b: number) => number\n```\n\nClean. Examples cover happy + zero + non-finite.\n\n**Approve** — suggest adding NaN explicitly to the example block:\n```ts\nexpect(() => divide(NaN, 5)).toThrow(/non-finite/);\n```\n\n`Number.isFinite(NaN)` returns false so it is covered, but enumerating it makes the intent explicit.",'## Gemini review \xb7 spec\n\nThe `reason` discriminant on the error class is the right ergonomic for callers that need to branch:\n```ts\ntry { return divide(a, b); }\ncatch (err) {\n if (err instanceof DivideError && err.reason === "zero") return 0;\n throw err;\n}\n```\n\nThat pattern beats string parsing on `err.message`.\n\n**Approve** — no structural concerns.','## Claude (sonnet) review \xb7 spec\n\n`DivideError` class is well-scoped. The `name = "DivideError"` assignment is the kind of detail that pays off in stack traces:\n```\nDivideError: divide: zero\n at /billing/invoice.ts:42\n```\n\n**Approve.**',"## Kimi review (via opencode) \xb7 spec\n\nType signature is unambiguous. The `reason` discriminant lets callers branch on failure type without string parsing.\n\nOrder-of-checks (non-finite first) is the right call.\n\n**Approve** — ready for implement.","## DeepSeek review \xb7 spec\n\nLoading spec + cross-checking against plan.\n\nExamples should include negatives and -Infinity:\n```ts\nexpect(divide(-10, 2)).toBe(-5);\nexpect(divide(10, -2)).toBe(-5);\nexpect(() => divide(Number.NEGATIVE_INFINITY, 2)).toThrow();\n```\n\nThe spec contract handles them correctly via `Number.isFinite`, but the example block sets the test surface and should be exhaustive.\n\n**Approve with notes.**"],usage:[{inputTokens:7240,outputTokens:1620,costUsd:.0731},{inputTokens:6500,outputTokens:320,costUsd:.0086},{inputTokens:6720,outputTokens:460,costUsd:.0218},{inputTokens:6720,outputTokens:380,costUsd:.0078},{inputTokens:6900,outputTokens:280,costUsd:.0042},{inputTokens:6980,outputTokens:980,costUsd:.0431}]},{id:"implement",name:"Implement",kind:"implement",description:"Doer writes the code blind to tests; reviewers find bugs.",streams:['## Implementation: `src/util/divide.ts`\n\n```ts\nexport class DivideError extends Error {\n constructor(public readonly reason: "zero" | "non-finite") {\n super(`divide: ${reason}`);\n this.name = "DivideError";\n }\n}\n\nexport function divide(a: number, b: number): number {\n if (!Number.isFinite(a) || !Number.isFinite(b)) {\n throw new DivideError("non-finite");\n }\n if (b === 0) {\n throw new DivideError("zero");\n }\n return a / b;\n}\n```\n\n**Notes:**\n- Non-finite check first so `divide(NaN, 0)` reports `"non-finite"`, not `"zero"`.\n- `name` set on `DivideError` so stack traces read `DivideError: divide: zero`.','## Codex review \xb7 diff\n\nPulling the diff. Reading each branch:\n\n✓ `Number.isFinite` — rejects NaN, \xb1Infinity, non-numbers via type system.\n✓ Zero-check after — order is correct.\n✓ `DivideError` extends `Error` with `name` set.\n\nOrder of checks decision is the correct call:\n```ts\ndivide(NaN, 0); // → "non-finite" (more specific failure first)\n```\n\n**Approve** — implementation is clean. Nothing to push back on.','## Gemini review \xb7 diff\n\nThe patch matches the spec line-for-line.\n\nThe `name` assignment on `DivideError`:\n```ts\nthis.name = "DivideError";\n```\n\nis the kind of detail that pays off the first time someone reads a stack trace — `DivideError: divide: zero` is actionable; `Error: divide: zero` looks like a generic throw and gets noise-suppressed.\n\n**Approve.**',"## Claude (sonnet) review \xb7 diff\n\nReads cleanly. Inline validation is fine for two args; would extract `isInvalid()` if this grew.\n\nThe `name` assignment on `DivideError` is the right detail — actionable stack traces over generic `Error: ...` lines.\n\n**Approve.**","## Kimi review (via opencode) \xb7 diff\n\nSmall, obvious, complete. 13 lines that do exactly what the spec said.\n\nReads in one breath:\n```ts\nif (!Number.isFinite(a) || !Number.isFinite(b)) throw …;\nif (b === 0) throw …;\nreturn a / b;\n```\n\n**Approve.**","## DeepSeek review \xb7 diff\n\nDiff loaded. Walking each branch.\n\nWant a `-0` test note before merge — JavaScript treats `-0 === 0` as `true`, so the existing zero-guard catches it, but the test pins the behaviour:\n```ts\nexpect(divide(10, -2)).toBe(-5);\nexpect(() => divide(10, -0)).toThrow(/zero/); // -0 === 0\n```\n\nThe `-0` case is the easy miss — without the test, an accidental refactor to `if (b !== 0)` would pass the existing suite.\n\n**Approve with notes.**"],usage:[{inputTokens:8120,outputTokens:1980,costUsd:.0892},{inputTokens:7300,outputTokens:280,costUsd:.0072},{inputTokens:7440,outputTokens:460,costUsd:.0214},{inputTokens:7440,outputTokens:320,costUsd:.0066},{inputTokens:7620,outputTokens:360,costUsd:.0054},{inputTokens:7720,outputTokens:1180,costUsd:.0508}]},{id:"verify",name:"Verify",kind:"verify",description:"Run the test suite; reviewers confirm coverage.",streams:['## Verify\n\n```\n$ pnpm test src/util/divide.test.ts\n\n ✓ divide > returns a / b for valid inputs\n ✓ divide > handles negative dividends\n ✓ divide > handles negative divisors\n ✓ divide > -0 is treated as 0 (throws "zero")\n ✓ divide > throws "zero" for b=0\n ✓ divide > throws "non-finite" for NaN\n ✓ divide > throws "non-finite" for \xb1Infinity\n ✓ divide > non-finite check precedes zero check\n ✓ DivideError > extends Error\n ✓ DivideError > exposes reason discriminant\n\n Tests: 12 passed (12)\n Coverage: 100% lines, 100% branches\n Lint: clean\n Types: clean\n Time: 1.42s\n```',"## Codex review \xb7 verify\n\nTest report loaded.\n\n✓ 12/12 pass, 0 fail, 0 skip\n✓ Coverage 100/100/100\n✓ Lint + types clean\n\nEvery spec case has a corresponding test. The `-0` row is what the implement-phase review asked for; merged correctly.\n\n**Approve** — nothing to add.","## Gemini review \xb7 verify\n\nReading the report:\n```\nTests: 12 passed (12)\nCoverage: 100% lines, 100% branches\n```\n\nNo flakes, no skips. The `Tests: 12 passed (12)` line is exactly what the merge gate looks for.\n\nCoverage 100/100/100 satisfies the production-utility bar.\n\n**Approve.**","## Claude (sonnet) review \xb7 verify\n\n12 tests for a 13-line function is honest coverage, not theatre. Each test asserts a real boundary condition.\n\nThe `non-finite check precedes zero check` assertion is doing real work — it pins the order-of-checks decision so a future refactor cannot silently swap them.\n\n**Approve.**","## Kimi review (via opencode) \xb7 verify\n\n✓ 12/12 pass\n✓ Coverage 100/100/100\n✓ No flakes, no skips\n\nShip it.\n\n**Approve.**","## DeepSeek review \xb7 verify\n\nPulling test report + spec for cross-check.\n\n12 tests for a 13-line function is honest coverage, not theatre. Each test asserts a real boundary:\n\n- happy path \xd7 4\n- zero divisor + -0\n- NaN + \xb1Infinity\n- order-of-checks invariant\n- DivideError shape + discriminant\n\nThe `non-finite check precedes zero check` assertion pins the order-of-checks decision so a future refactor cannot silently swap them.\n\n**Approve.**"],usage:[{inputTokens:8980,outputTokens:1340,costUsd:.0641},{inputTokens:8060,outputTokens:80,costUsd:.0021},{inputTokens:8230,outputTokens:360,costUsd:.0179},{inputTokens:8230,outputTokens:280,costUsd:.0058},{inputTokens:8410,outputTokens:220,costUsd:.0033},{inputTokens:8520,outputTokens:1060,costUsd:.0418}]},{id:"pr",name:"Ship",kind:"pr",description:"Doer drafts the PR; reviewers approve merge.",streams:["## PR draft\n\n**Title:** `feat(util): production-safe divide() with DivideError + 100% branch coverage`\n\n**Body:**\n```\nIntroduces a hardened `divide()` per the attached spec.\n\nWhat:\n- New DivideError class with typed reason discriminant\n- divide(a, b) rejects non-finite + zero divisor\n- 12 new tests; 100% line + branch coverage\n- Two existing callers updated\n\nWhy:\n- Silent Infinity from divide(x, 0) was a footgun in /billing\n- IEEE 754 currency math driving audit-trail drift; companion\n divideMoney(cents, n) lands in #4129\n\nRisk:\n- Two callers updated; no other call sites in repo\n- Rollback: revert this commit (no schema touched)\n- Backward-compat: divide() v1 stays exported for one minor\n\nCloses #4127\n```","## Codex review \xb7 PR\n\nTitle is clear and accurate. Body follows the What/Why/Risk structure the merge gate expects.\n\nTwo-caller scope is small enough to revert cleanly if needed.\n\nCloses link is correct.\n\n**Approve merge.**","## Gemini review \xb7 PR\n\nContext is well-summarised. Calling out `divideMoney` as the follow-up PR (#4129) sets the right expectation for reviewers.\n\n`Closes #4127` ties the work to the original bug report — the audit trail is intact.\n\n**Approve merge.**","## Claude (sonnet) review \xb7 PR\n\nNo surprises. Two-caller scope is bounded, rollback is a single revert, backward-compat note covers the cutover.\n\nOn-call will not be paged at 3am over this one.\n\n**Approve merge.**","## Kimi review (via opencode) \xb7 PR\n\nTitle + body land the message in three sentences. Verify report linked. Risk section names the actual callers.\n\nShip it.\n\n**Approve merge.**","## DeepSeek review \xb7 PR\n\nPR + verify report cross-loaded. Risk + rollback note is the kind of thing on-call appreciates.\n\nVerify report (12 tests, 100% branch) is linked. Closes link to #4127 ties the work to the original bug.\n\nBackward-compat note covers the cutover window:\n> divide() v1 stays exported for one minor before removal\n\nNothing held back.\n\n**Approve merge.**"],usage:[{inputTokens:9420,outputTokens:1480,costUsd:.0712},{inputTokens:8460,outputTokens:60,costUsd:.0017},{inputTokens:8640,outputTokens:320,costUsd:.0163},{inputTokens:8640,outputTokens:280,costUsd:.0058},{inputTokens:8820,outputTokens:240,costUsd:.0036},{inputTokens:8930,outputTokens:920,costUsd:.0388}]}];function N(e,n){return{participant:`${e}-${n.agentName}`,role:e,agentName:n.agentName,lineage:n.lineage,hasAnswer:!1,model:n.model,pending:!1}}function E(e,n,t,i){return{participant:`${e}-${n.agentName}`,role:e,agentName:n.agentName,lineage:n.lineage,hasAnswer:!0,answer:t,durationMs:n.durationMs,model:n.model,binaryUsed:n.binaryUsed,modelUsed:n.model,usage:i}}function M(){return[N("doer",y),...k.map(e=>N("reviewer",e))]}let D=[{round:1,participants:M()}],A={id:"demo-complex-6way",name:"Plan → Ship Workflow",description:"Five-phase workflow with five reviewers per phase.",category:"review",agreementThreshold:"majority",onThresholdMet:"auto-finalize",maxRounds:1,driver:"external",driverHandoff:!1,verificationGate:"auto",costCapUsd:0,yoloDefault:!1,onError:"fail",notify:"dashboard-only",yaml:"",authorHandle:"demo",forks:0,popularity:0,phases:x.map(e=>({id:e.id,name:e.name,description:e.description,kind:e.kind,gate:"auto",doer:{lineage:"claude",models:["claude-opus-4-7"]},reviewer:{require:2,crossLineage:!0,candidates:["codex","gemini","opencode"],candidatesWithModels:k.map(e=>({lineage:e.lineage,models:[e.model]}))},artifact:{label:"Artifact",hint:"",maxBytes:1048576},inputs:{include:[],exclude:[]},iterate:{max:1,onMax:"fail"},blindSpots:[],execution:"parallel",builtin:!0}))},I=(e,n,t)=>{let i=[],o=n.id;for(let[r,a]of T.entries())i.push({atMs:t+30*r,payload:{type:"phase_start",payload:{phaseIdx:e,phaseId:o,kind:n.kind,role:0===r?"doer":"reviewer",agent:a.agentName},ts:Date.now()}});for(let[e,r]of T.entries()){let a=0===e?"doer":"reviewer",s=function(e){let n=Math.floor(.3*e.length),t=Math.floor(.65*e.length);return[e.slice(0,n),e.slice(0,t),e]}(n.streams[e]),d=[.25,.55,.85].map(e=>Math.round(r.doneAtMs*e));for(let[e,n]of s.entries())i.push({atMs:t+d[e],payload:{type:"phase_progress",payload:{phaseId:o,round:1,role:a,agent:r.agentName,elapsedMs:d[e],output:n},ts:Date.now()}})}for(let[e,n]of T.entries()){let r=0===e?"doer":"reviewer";i.push({atMs:t+n.doneAtMs,payload:{type:"participant_done",payload:{phaseId:o,round:1,role:r,agent:n.agentName},ts:Date.now()}})}return i.push({atMs:t+5e3-100,payload:{type:"phase_done",payload:{phaseId:o,phaseIdx:e,kind:n.kind},ts:Date.now()}}),i},U=(()=>{let e=[];for(let[n,t]of x.entries())e.push(...I(n,t,200+5e3*n));return e.push({atMs:200+5e3*x.length+300,payload:{type:"chat_done",payload:{status:"merged",verdict:"approve",prUrl:"https://github.com/example/repo/pull/4128"},ts:Date.now()}}),e})(),S={"simple-6way":{template:m,initialRounds:h,work:"Review src/util/divide.ts for production-readiness — six lineages, one pass, blockers welcome.",buildDataSource:function(){let e={currentParticipants:p.map(u)};return{createEventSource:()=>d(b,(n,t)=>{!function(e,n,t){if("participant_done"!==n)return;let i=t.agent;if(!i)return;let o=p.find(e=>e.agentName===i);o&&(e.currentParticipants=e.currentParticipants.map(e=>e.agentName===i?{participant:`reviewer-${o.agentName}`,role:"reviewer",agentName:o.agentName,lineage:o.lineage,hasAnswer:!0,answer:o.answer,durationMs:o.durationMs,model:o.model,binaryUsed:o.binaryUsed,modelUsed:o.model,usage:o.usage}:e))}(e,n,t)}),fetchArtifacts:()=>({rounds:[{round:1,participants:e.currentParticipants}]})}}},"complex-6way":{template:A,initialRounds:D,work:"feat(util): production-safe divide() — Plan → Spec → Implement → Verify → Ship • closes #4127",buildDataSource:function(){let e={currentPhaseIdx:0,currentParticipants:M()};return{createEventSource:()=>d(U,(n,t)=>{!function(e,n,t){if("phase_start"===n){let n=t.phaseIdx;"number"==typeof n&&n!==e.currentPhaseIdx&&(e.currentPhaseIdx=n,e.currentParticipants=M());return}if("participant_done"===n){let n=t.agent;if(!n)return;let i=T.findIndex(e=>e.agentName===n);if(i<0)return;let o=T[i],r=x[e.currentPhaseIdx];if(!r)return;let a=E(0===i?"doer":"reviewer",o,r.streams[i],r.usage[i]);e.currentParticipants=e.currentParticipants.map(e=>e.agentName===n?a:e);return}if("chat_done"===n){let n=x[x.length-1];e.currentParticipants=T.map((e,t)=>E(0===t?"doer":"reviewer",e,n.streams[t],n.usage[t])),e.currentPhaseIdx=x.length-1}}(e,n,t)}),fetchArtifacts:()=>({rounds:[{round:1,participants:e.currentParticipants}]})}}}};function R({params:e}){let{scenario:n}=(0,o.use)(e),t=S[n];t||(0,r.notFound)();let d=(0,o.useMemo)(()=>`demo-${n}-${Math.random().toString(36).slice(2,8)}`,[n]),c=(0,o.useMemo)(()=>t.buildDataSource(),[t]);return(0,i.jsx)(a.G,{children:(0,i.jsx)("div",{className:"mx-auto max-w-[1700px] px-6 py-6",children:(0,i.jsx)(s.LiveRunReal,{chatId:d,initialStatus:"reviewing",initialRounds:t.initialRounds,template:t.template,templateId:t.template.id,work:t.work,demoDataSource:c})})})}},6255:(e,n,t)=>{Promise.resolve().then(t.bind(t,5249))}},e=>{e.O(0,[116,832,641,344,245,506,128,358],()=>e(e.s=6255)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[359],{63:(e,t,r)=>{"use strict";r.d(t,{Zp:()=>n});var s=r(9442);r(6074);var a=r(7362);function n({className:e,...t}){return(0,s.jsx)("div",{"data-slot":"card",className:(0,a.cn)("flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm",e),...t})}},862:(e,t,r)=>{"use strict";function s(e){return!!e&&e.phases[0]?.kind==="review_only"}r.d(t,{$:()=>s})},2471:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]])},2919:(e,t,r)=>{Promise.resolve().then(r.bind(r,6141))},3734:(e,t,r)=>{"use strict";r.d(t,{JR:()=>c,QJ:()=>n,VW:()=>o,YM:()=>m,m_:()=>i,r2:()=>x,u5:()=>l,x0:()=>u,ze:()=>s});let s={anthropic:"Claude",openai:"Codex",google:"Gemini",opencode:"OpenCode",moonshot:"Kimi"},a={anthropic:"bg-violet-400",openai:"bg-orange-400",google:"bg-blue-400",opencode:"bg-emerald-400",moonshot:"bg-pink-400"};function n(e){return e?s[e]??e:""}function o(e){return e?a[e]??"bg-muted":"bg-muted"}let i={claude:"Claude",codex:"Codex",gemini:"Gemini",opencode:"OpenCode",kimi:"Kimi",openrouter:"OpenRouter"},d={claude:"bg-violet-400",codex:"bg-orange-400",gemini:"bg-blue-400",opencode:"bg-emerald-400",kimi:"bg-pink-400",openrouter:"bg-cyan-400"};function l(e){return e?i[e]??e:""}function c(e){return e?d[e]??"bg-muted":"bg-muted"}let u={claude:"claude-opus-4-7",codex:"gpt-5.5",gemini:"gemini-2.5-pro",opencode:"kimi-k2.6",kimi:"kimi-k2.6",openrouter:""};function m(e){if(e)return u[e]}let x={claude:{dot:"bg-violet-400",ring:"ring-violet-400/40",gradient:"bg-gradient-to-b from-violet-500/15 to-card"},codex:{dot:"bg-orange-400",ring:"ring-orange-400/40",gradient:"bg-gradient-to-b from-orange-500/15 to-card"},gemini:{dot:"bg-blue-400",ring:"ring-blue-400/40",gradient:"bg-gradient-to-b from-blue-500/15 to-card"},opencode:{dot:"bg-emerald-400",ring:"ring-emerald-400/40",gradient:"bg-gradient-to-b from-emerald-500/15 to-card"},kimi:{dot:"bg-pink-400",ring:"ring-pink-400/40",gradient:"bg-gradient-to-b from-pink-500/15 to-card"},openrouter:{dot:"bg-cyan-400",ring:"ring-cyan-400/40",gradient:"bg-gradient-to-b from-cyan-500/15 to-card"}}},4372:(e,t,r)=>{"use strict";r.d(t,{G:()=>o});var s=r(9442),a=r(821),n=r(8344);function o({children:e}){return(0,s.jsxs)("div",{className:"flex h-screen w-screen overflow-hidden bg-background text-foreground",children:[(0,s.jsx)(a.AppSidebar,{}),(0,s.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,s.jsx)(n.MobileTopBar,{}),(0,s.jsx)("main",{className:"flex-1 overflow-y-auto",children:e})]})]})}},5702:(e,t,r)=>{"use strict";r.d(t,{E:()=>d});var s=r(9442);r(6074);var a=r(9056),n=r(8113),o=r(7362);let i=(0,a.F)("inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function d({className:e,variant:t="default",asChild:r=!1,...a}){let l=r?n.bL:"span";return(0,s.jsx)(l,{"data-slot":"badge","data-variant":t,className:(0,o.cn)(i({variant:t}),e),...a})}},6141:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>N});var s=r(9442),a=r(8821),n=r(2471),o=r(5902),i=r(6074),d=r(4372),l=r(6457),c=r(5702),u=r(6185),m=r(6441),x=r(862);function p({icon:e,label:t,value:r,wide:a,children:n}){let[o,d]=(0,i.useState)(!1);return(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsxs)("button",{type:"button",onClick:()=>d(e=>!e),className:"flex items-center gap-2 rounded-md border border-border bg-card px-3 py-1.5 text-sm transition hover:border-muted-foreground/40",children:[(0,s.jsx)("span",{className:"text-muted-foreground",children:e}),(0,s.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:t}),(0,s.jsx)("span",{className:"font-medium",children:r})]}),o&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"fixed inset-0 z-10",onClick:()=>d(!1)}),(0,s.jsx)("div",{className:`absolute left-0 top-full z-20 mt-1 rounded-md border border-border bg-popover p-1.5 shadow-xl ${a?"w-80":"w-56"}`,onClick:()=>d(!1),children:n})]})]})}var g=r(6289);let h=(0,r(3884).A)("dollar-sign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);var f=r(63),b=r(3734);function v({template:e,prompt:t,setPrompt:r,reviewOnly:a,artifactSpec:n,billingMode:o,costEstimate:i,overCap:d,isPending:l,onStart:c}){return(0,s.jsxs)(s.Fragment,{children:[a&&n&&(0,s.jsxs)("div",{className:"mb-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[(0,s.jsx)("span",{className:"font-medium text-foreground",children:n.label}),(0,s.jsx)("span",{className:"text-muted-foreground/60",children:"\xb7"}),(0,s.jsxs)("span",{children:["cap ",(n.maxBytes/1024).toLocaleString()," KB"]})]}),(0,s.jsxs)(f.Zp,{className:"overflow-hidden p-0 mb-4",children:[(0,s.jsx)("textarea",{value:t,onChange:e=>r(e.target.value),placeholder:a&&n?n.hint:"Describe what you want chorus to weigh in on. Paste code, errors, design docs — anything the reviewers should see.",className:`block w-full resize-none border-0 bg-transparent px-5 py-4 text-sm text-foreground placeholder:text-muted-foreground/70 focus:outline-none ${a?"font-mono text-[12px] leading-relaxed":""}`,rows:a?16:10,spellCheck:!a}),(0,s.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border bg-card/40 px-5 py-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsx)(j,{template:e,reviewOnly:a}),(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3 sm:justify-end",children:[(0,s.jsx)(y,{billingMode:o,costEstimate:i,overCap:d,template:e}),(0,s.jsxs)("button",{type:"button",onClick:c,disabled:!t||d||l,className:`inline-flex shrink-0 items-center gap-2 whitespace-nowrap rounded-md px-4 py-2 text-sm font-medium transition ${!t||d||l?"cursor-not-allowed bg-muted text-muted-foreground":"bg-primary text-primary-foreground hover:bg-primary/90"}`,children:[l?"Starting...":a?"Send for review":"Start the run",(0,s.jsx)(g.A,{className:"h-4 w-4"})]})]})]})]})]})}function j({template:e,reviewOnly:t}){return(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[!t&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:`h-1.5 w-1.5 rounded-full ${(0,b.JR)(e.phases[0]?.doer.lineage)}`}),"Doer: ",e.phases[0]?.doer.lineage]}),(0,s.jsx)("span",{className:"text-muted-foreground/50",children:"\xb7"})]}),(0,s.jsx)(w,{template:e}),e.phases.length>1&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"text-muted-foreground/50",children:"\xb7"}),(0,s.jsxs)("span",{className:"font-mono text-[10px]",children:[e.phases.length," phases"]})]})]})}function w({template:e}){let t=e.phases[0]?.reviewer.candidatesWithModels??[],r=new Map;for(let e of t)r.set(e.lineage,(r.get(e.lineage)??0)+1);return(0,s.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:"text-muted-foreground/80",children:"Reviewers:"}),t.map((e,t)=>{let a=(r.get(e.lineage)??0)>1,n=e.models?.[0]?.split("/").pop()??e.models?.[0],o=a&&n?`${e.lineage} \xb7 ${n}`:e.lineage;return(0,s.jsxs)("span",{className:"flex items-center gap-1",title:e.models?.[0]?`${e.lineage} \xb7 ${e.models[0]}`:e.lineage,children:[(0,s.jsx)("span",{className:`h-1.5 w-1.5 rounded-full ${(0,b.JR)(e.lineage)}`}),o]},`${e.lineage}-${e.models?.[0]??"default"}-${t}`)}),e.phases[0]?.reviewer.crossLineage&&(0,s.jsx)(c.E,{variant:"outline",className:"ml-1 border-border font-mono text-[9px] uppercase",title:"Reviewer must be a different lineage than the doer",children:"cross-lineage"})]})}function y({billingMode:e,costEstimate:t,overCap:r,template:a}){return"subscription"===e?(0,s.jsxs)("div",{className:"flex items-center gap-1.5 font-mono text-[10px] text-muted-foreground",title:`~${t.inputTokens.toLocaleString()} input tokens \xd7 ${t.reviewerCount} reviewers — counts against your CLI subscription quota, not billed per call`,children:["Subscription quota \xb7 ~",t.inputTokens.toLocaleString()," tok"]}):(0,s.jsxs)("div",{className:`flex items-center gap-1.5 font-mono text-[10px] ${r?"text-rose-300":"text-muted-foreground"}`,title:`~${t.inputTokens.toLocaleString()} input tokens \xd7 ${t.reviewerCount} reviewers; up to ${t.maxRounds} round${t.maxRounds>1?"s":""} on disagreement`,children:[(0,s.jsx)(h,{className:"h-3 w-3"}),t.maxRounds>1?`~$${t.usd.toFixed(3)} – $${t.usdRangeMax.toFixed(3)} est`:`~$${t.usd.toFixed(3)} est`,a.costCapUsd>0&&(0,s.jsxs)("span",{className:"text-muted-foreground/60",children:["/ cap $",a.costCapUsd.toFixed(2)]})]})}function N(){return(0,s.jsx)(i.Suspense,{fallback:(0,s.jsx)(d.G,{children:(0,s.jsx)("div",{className:"p-8 text-sm text-muted-foreground",children:"Loading…"})}),children:(0,s.jsx)(k,{})})}function k(){let e=(0,o.useSearchParams)(),t=(0,o.useRouter)(),[r,g]=(0,i.useTransition)(),[h,f]=(0,i.useState)([]),[b,j]=(0,i.useState)(null),[w,y]=(0,i.useState)(null);(0,i.useEffect)(()=>{(0,u.eG)().then(f).catch(e=>j(e instanceof u.$v?e.message:"Failed to load templates"))},[]);let[N,k]=(0,i.useState)("api");(0,i.useEffect)(()=>{(0,m.Dl)().then(e=>k(e.mode)).catch(()=>{})},[]);let $=e.get("template")??h[0]?.id??"",[C,S]=(0,i.useState)(""),R=[],M=h.find(e=>e.id===$)??h[0],E=(0,i.useMemo)(()=>(function(e){let{template:t,prompt:r,attachments:s}=e,a=t?.phases?.[0]?.reviewer?.candidates?.length??3,n=Math.max(1,t?.maxRounds??1),o=Math.ceil(r.length/4)+1500*s.length+(t?.estimatedBaselineTokens??800),i=(3e-6*o+.018000000000000002)*a;return{usd:i,usdRangeMax:i*n,inputTokens:o,reviewerCount:a,maxRounds:n}})({template:M,prompt:C,attachments:R}),[C,R,M]),F=!!("subscription"!==N&&M?.costCapUsd&&M.costCapUsd>0&&E.usdRangeMax>M.costCapUsd),[L,P]=(0,i.useState)(!1),[A,T]=(0,i.useState)(""),O=(0,x.$)(M),G=O?M?.phases?.[0]?.artifact:void 0;async function z(){if(M&&C){if(O&&G){let e=new TextEncoder().encode(C).length;if(e>G.maxBytes)return void y(`Artifact is ${e.toLocaleString()} bytes; this template caps at ${G.maxBytes.toLocaleString()}. Trim it down.`)}y(null),g(async()=>{try{let e=A.trim(),r=await (0,u.RL)({work:O?function(e){let t="Review the supplied artifact independently.";if(!e)return t;for(let t of e.split("\n")){let e=t.trim();if(0===e.length||e.startsWith("```")||e.startsWith("~~~"))continue;if(e.length<=80)return e;let r=e.slice(0,80),s=r.lastIndexOf(" ");return(s>40?r.slice(0,s):r)+"…"}return t}(C):C,templateId:M.id,files:R.length>0?R.map(e=>e.name):void 0,...O?{artifact:C}:{},...!O&&e.length>0?{repoPath:e}:{},yolo:L});t.push(`/runs/${r.slug||r.id}`)}catch(e){y(e instanceof u.$v?e.message:"Failed to create chat")}})}}return b?(0,s.jsx)(d.G,{children:(0,s.jsx)("div",{className:"mx-auto w-full max-w-6xl px-4 py-6 sm:px-6 sm:py-8 md:px-8 md:py-10",children:(0,s.jsxs)("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4",children:[(0,s.jsx)("p",{className:"text-sm text-destructive",children:"Error loading templates"}),(0,s.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:b})]})})}):M?(0,s.jsx)(d.G,{children:(0,s.jsxs)("div",{className:"mx-auto w-full max-w-6xl px-4 py-6 sm:px-6 sm:py-8 md:px-8 md:py-10",children:[(0,s.jsx)(l.z,{eyebrow:"New chat",title:O?"Paste an artifact. Get reviews.":"Paste a task. Pick a template.",subtitle:O?"Chorus skips the doer and runs your text past three reviewers. Single pass — revise yourself and resubmit for another round.":"Chorus runs it past your reviewers and reports consensus."}),w&&(0,s.jsx)("div",{className:"mb-4 rounded-lg border border-destructive/50 bg-destructive/10 p-4",children:(0,s.jsx)("p",{className:"text-sm text-destructive",children:w})}),(0,s.jsx)("div",{className:"mb-4 flex flex-wrap items-center gap-2",children:(0,s.jsx)(p,{icon:(0,s.jsx)(a.A,{className:"h-3.5 w-3.5"}),label:"Template",value:M?.name||"Select a template",wide:!0,children:(0,s.jsx)("ul",{className:"space-y-1",children:h.map(r=>{let a=!1===r.isComplete;return(0,s.jsx)("li",{children:(0,s.jsxs)("button",{type:"button",disabled:a,onClick:()=>{if(a)return;let s=new URLSearchParams(e);s.set("template",r.id),t.push(`/new?${s.toString()}`)},className:`block w-full rounded-md p-2 text-left transition ${a?"cursor-not-allowed opacity-50":r.id===$?"bg-accent":"hover:bg-accent/50"}`,children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"text-sm font-medium",children:r.name}),(0,x.$)(r)&&(0,s.jsx)(c.E,{variant:"outline",className:"border-blue-500/30 bg-blue-500/10 font-mono text-[9px] uppercase text-blue-300",children:"review only"}),a&&(0,s.jsx)(c.E,{variant:"outline",className:"border-amber-500/40 bg-amber-500/10 font-mono text-[9px] uppercase text-amber-300",children:"needs setup"})]}),(0,s.jsx)("div",{className:"text-xs text-muted-foreground line-clamp-1",children:a?"Edit this template's YAML to fill in models for your fleet.":r.description})]})},r.id)})})})}),(0,s.jsx)(v,{template:M,prompt:C,setPrompt:S,reviewOnly:O,artifactSpec:G,billingMode:N,costEstimate:E,overCap:F,isPending:r,onStart:z}),F&&(0,s.jsxs)("div",{className:"mb-4 flex items-start gap-2 rounded-md border border-rose-500/30 bg-rose-500/5 px-3 py-2 text-[11px] text-rose-200",children:[(0,s.jsx)(n.A,{className:"mt-0.5 h-3 w-3 shrink-0 text-rose-400"}),(0,s.jsxs)("span",{children:["Estimated cost"," ",(0,s.jsxs)("span",{className:"font-mono",children:["$",E.usd.toFixed(3)]})," ","exceeds template cap"," ",(0,s.jsxs)("span",{className:"font-mono",children:["$",M.costCapUsd.toFixed(2)]}),". Trim attachments, shorten the prompt, or raise the cap in template settings."]})]}),(0,s.jsxs)("div",{className:`mb-4 rounded-lg border border-dashed border-border bg-card/30 p-4 ${O?"opacity-50":""}`,children:[(0,s.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,s.jsxs)("span",{className:"text-sm font-medium text-foreground",children:["Target repo"," ",(0,s.jsx)("span",{className:"text-muted-foreground",children:"(optional)"})]}),(0,s.jsx)(c.E,{variant:"outline",className:"border-emerald-500/30 bg-emerald-500/10 font-mono text-[10px] uppercase text-emerald-300",children:"opens PR"})]}),(0,s.jsx)("input",{type:"text",value:O?"":A,onChange:e=>T(e.target.value),disabled:O,placeholder:"/absolute/path/to/repo",className:"w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-xs text-foreground placeholder:text-muted-foreground/50 focus:outline-none focus:ring-1 focus:ring-primary disabled:cursor-not-allowed disabled:opacity-60",spellCheck:!1}),(0,s.jsx)("p",{className:"mt-2 text-[11px] text-muted-foreground",children:O?"Review-only templates have no doer and no Ship phase, so there's nothing to commit. Pick a template with a doer (e.g. Tri-Review) to open a PR.":(0,s.jsxs)(s.Fragment,{children:["When set: doer makes real edits in this repo. After reviewers agree, chorus opens a PR via"," ",(0,s.jsx)("code",{className:"rounded bg-muted px-1",children:"gh pr create"})," (no auto-merge — you review + click Merge in GitHub). Leave blank to skip the Ship phase."]})})]}),(0,s.jsxs)("button",{type:"button",onClick:()=>P(e=>!e),className:`mb-4 flex w-full items-start justify-between gap-3 rounded-lg border px-4 py-3 text-left transition ${L?"border-rose-500/40 bg-rose-500/5":"border-dashed border-border bg-card/30 hover:border-foreground/30"}`,children:[(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("span",{className:`mt-0.5 grid h-7 w-7 place-items-center rounded-md text-sm ${L?"bg-rose-500/20 text-rose-300":"bg-card text-muted-foreground"}`,children:"\uD83D\uDE80"}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Yolo mode"}),(0,s.jsx)(c.E,{variant:"outline",className:"border-rose-500/30 bg-rose-500/10 font-mono text-[10px] uppercase text-rose-300",children:"unsafe"})]}),(0,s.jsx)("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:L?"Reviewer gates auto-approve. Permission prompts auto-allow. The driver merges without asking. Cost cap still enforced.":"Skip every ask-user gate for this single run. Useful for trusted templates or trivial fixes."})]})]}),(0,s.jsx)("span",{className:`flex h-5 w-9 shrink-0 items-center rounded-full border p-0.5 transition ${L?"border-rose-500/40 bg-rose-500/20":"border-border bg-card"}`,children:(0,s.jsx)("span",{className:`h-3.5 w-3.5 rounded-full transition-transform ${L?"translate-x-4 bg-rose-400":"bg-muted-foreground/50"}`})})]})]})}):(0,s.jsx)(d.G,{children:(0,s.jsx)("div",{className:"mx-auto w-full max-w-6xl px-4 py-12 text-sm text-muted-foreground sm:px-6 md:px-8",children:"Loading templates…"})})}},6289:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])},6457:(e,t,r)=>{"use strict";r.d(t,{z:()=>a});var s=r(9442);function a({eyebrow:e,title:t,subtitle:r,action:n}){return(0,s.jsxs)("header",{className:"mb-6 flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:e}),(0,s.jsx)("h1",{className:"mt-1 text-2xl font-semibold tracking-tight",children:t}),r&&(0,s.jsx)("p",{className:"mt-2 max-w-2xl text-sm leading-relaxed text-muted-foreground",children:r})]}),n&&(0,s.jsx)("div",{className:"shrink-0 self-start sm:self-auto",children:n})]})}},9056:(e,t,r)=>{"use strict";r.d(t,{F:()=>o});var s=r(142);let a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,n=s.$,o=(e,t)=>r=>{var s;if((null==t?void 0:t.variants)==null)return n(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:o,defaultVariants:i}=t,d=Object.keys(o).map(e=>{let t=null==r?void 0:r[e],s=null==i?void 0:i[e];if(null===t)return null;let n=a(t)||a(s);return o[e][n]}),l=r&&Object.entries(r).reduce((e,t)=>{let[r,s]=t;return void 0===s||(e[r]=s),e},{});return n(e,d,null==t||null==(s=t.compoundVariants)?void 0:s.reduce((e,t)=>{let{class:r,className:s,...a}=t;return Object.entries(a).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...i,...l}[t]):({...i,...l})[t]===r})?[...e,r,s]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}}},e=>{e.O(0,[116,720,641,344,506,128,358],()=>e(e.s=2919)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[359],{63:(e,t,r)=>{"use strict";r.d(t,{Zp:()=>n});var s=r(9442);r(6074);var a=r(7362);function n({className:e,...t}){return(0,s.jsx)("div",{"data-slot":"card",className:(0,a.cn)("flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm",e),...t})}},862:(e,t,r)=>{"use strict";function s(e){return!!e&&e.phases[0]?.kind==="review_only"}r.d(t,{$:()=>s})},2471:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]])},2919:(e,t,r)=>{Promise.resolve().then(r.bind(r,6141))},3734:(e,t,r)=>{"use strict";r.d(t,{JR:()=>c,QJ:()=>n,VW:()=>o,YM:()=>m,m_:()=>i,r2:()=>x,u5:()=>l,x0:()=>u,ze:()=>s});let s={anthropic:"Claude",openai:"Codex",google:"Gemini",opencode:"OpenCode",moonshot:"Kimi"},a={anthropic:"bg-violet-400",openai:"bg-orange-400",google:"bg-blue-400",opencode:"bg-emerald-400",moonshot:"bg-pink-400"};function n(e){return e?s[e]??e:""}function o(e){return e?a[e]??"bg-muted":"bg-muted"}let i={claude:"Claude",codex:"Codex",gemini:"Gemini",opencode:"OpenCode",kimi:"Kimi",openrouter:"OpenRouter"},d={claude:"bg-violet-400",codex:"bg-orange-400",gemini:"bg-blue-400",opencode:"bg-emerald-400",kimi:"bg-pink-400",openrouter:"bg-cyan-400"};function l(e){return e?i[e]??e:""}function c(e){return e?d[e]??"bg-muted":"bg-muted"}let u={claude:"claude-opus-4-7",codex:"gpt-5.5",gemini:"gemini-2.5-pro",opencode:"kimi-k2.6",kimi:"kimi-k2.6",openrouter:""};function m(e){if(e)return u[e]}let x={claude:{dot:"bg-violet-400",ring:"ring-violet-400/40",gradient:"bg-gradient-to-b from-violet-500/15 to-card"},codex:{dot:"bg-orange-400",ring:"ring-orange-400/40",gradient:"bg-gradient-to-b from-orange-500/15 to-card"},gemini:{dot:"bg-blue-400",ring:"ring-blue-400/40",gradient:"bg-gradient-to-b from-blue-500/15 to-card"},opencode:{dot:"bg-emerald-400",ring:"ring-emerald-400/40",gradient:"bg-gradient-to-b from-emerald-500/15 to-card"},kimi:{dot:"bg-pink-400",ring:"ring-pink-400/40",gradient:"bg-gradient-to-b from-pink-500/15 to-card"},openrouter:{dot:"bg-cyan-400",ring:"ring-cyan-400/40",gradient:"bg-gradient-to-b from-cyan-500/15 to-card"}}},4372:(e,t,r)=>{"use strict";r.d(t,{G:()=>o});var s=r(9442),a=r(821),n=r(8344);function o({children:e}){return(0,s.jsxs)("div",{className:"flex h-screen w-screen overflow-hidden bg-background text-foreground",children:[(0,s.jsx)(a.AppSidebar,{}),(0,s.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,s.jsx)(n.MobileTopBar,{}),(0,s.jsx)("main",{className:"flex-1 overflow-y-auto",children:e})]})]})}},5702:(e,t,r)=>{"use strict";r.d(t,{E:()=>d});var s=r(9442);r(6074);var a=r(9056),n=r(8113),o=r(7362);let i=(0,a.F)("inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function d({className:e,variant:t="default",asChild:r=!1,...a}){let l=r?n.bL:"span";return(0,s.jsx)(l,{"data-slot":"badge","data-variant":t,className:(0,o.cn)(i({variant:t}),e),...a})}},6141:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>N});var s=r(9442),a=r(8821),n=r(2471),o=r(5902),i=r(6074),d=r(4372),l=r(6457),c=r(5702),u=r(6185),m=r(6441),x=r(862);function p({icon:e,label:t,value:r,wide:a,children:n}){let[o,d]=(0,i.useState)(!1);return(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsxs)("button",{type:"button",onClick:()=>d(e=>!e),className:"flex items-center gap-2 rounded-md border border-border bg-card px-3 py-1.5 text-sm transition hover:border-muted-foreground/40",children:[(0,s.jsx)("span",{className:"text-muted-foreground",children:e}),(0,s.jsx)("span",{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:t}),(0,s.jsx)("span",{className:"font-medium",children:r})]}),o&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"fixed inset-0 z-10",onClick:()=>d(!1)}),(0,s.jsx)("div",{className:`absolute left-0 top-full z-20 mt-1 rounded-md border border-border bg-popover p-1.5 shadow-xl ${a?"w-80":"w-56"}`,onClick:()=>d(!1),children:n})]})]})}var g=r(6289);let h=(0,r(3884).A)("dollar-sign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);var f=r(63),b=r(3734);function v({template:e,prompt:t,setPrompt:r,reviewOnly:a,artifactSpec:n,billingMode:o,costEstimate:i,overCap:d,isPending:l,onStart:c}){return(0,s.jsxs)(s.Fragment,{children:[a&&n&&(0,s.jsxs)("div",{className:"mb-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[(0,s.jsx)("span",{className:"font-medium text-foreground",children:n.label}),(0,s.jsx)("span",{className:"text-muted-foreground/60",children:"\xb7"}),(0,s.jsxs)("span",{children:["cap ",(n.maxBytes/1024).toLocaleString()," KB"]})]}),(0,s.jsxs)(f.Zp,{className:"overflow-hidden p-0 mb-4",children:[(0,s.jsx)("textarea",{value:t,onChange:e=>r(e.target.value),placeholder:a&&n?n.hint:"Describe what you want chorus to weigh in on. Paste code, errors, design docs — anything the reviewers should see.",className:`block w-full resize-none border-0 bg-transparent px-5 py-4 text-sm text-foreground placeholder:text-muted-foreground/70 focus:outline-none ${a?"font-mono text-[12px] leading-relaxed":""}`,rows:a?16:10,spellCheck:!a}),(0,s.jsxs)("div",{className:"flex flex-col gap-3 border-t border-border bg-card/40 px-5 py-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsx)(j,{template:e,reviewOnly:a}),(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3 sm:justify-end",children:[(0,s.jsx)(y,{billingMode:o,costEstimate:i,overCap:d,template:e}),(0,s.jsxs)("button",{type:"button",onClick:c,disabled:!t||d||l,className:`inline-flex shrink-0 items-center gap-2 whitespace-nowrap rounded-md px-4 py-2 text-sm font-medium transition ${!t||d||l?"cursor-not-allowed bg-muted text-muted-foreground":"bg-primary text-primary-foreground hover:bg-primary/90"}`,children:[l?"Starting...":a?"Send for review":"Start the run",(0,s.jsx)(g.A,{className:"h-4 w-4"})]})]})]})]})]})}function j({template:e,reviewOnly:t}){return(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[!t&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:`h-1.5 w-1.5 rounded-full ${(0,b.JR)(e.phases[0]?.doer.lineage)}`}),"Doer: ",e.phases[0]?.doer.lineage]}),(0,s.jsx)("span",{className:"text-muted-foreground/50",children:"\xb7"})]}),(0,s.jsx)(w,{template:e}),e.phases.length>1&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"text-muted-foreground/50",children:"\xb7"}),(0,s.jsxs)("span",{className:"font-mono text-[10px]",children:[e.phases.length," phases"]})]})]})}function w({template:e}){let t=e.phases[0]?.reviewer.candidatesWithModels??[],r=new Map;for(let e of t)r.set(e.lineage,(r.get(e.lineage)??0)+1);return(0,s.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,s.jsx)("span",{className:"text-muted-foreground/80",children:"Reviewers:"}),t.map((e,t)=>{let a=(r.get(e.lineage)??0)>1,n=e.models?.[0]?.split("/").pop()??e.models?.[0],o=a&&n?`${e.lineage} \xb7 ${n}`:e.lineage;return(0,s.jsxs)("span",{className:"flex items-center gap-1",title:e.models?.[0]?`${e.lineage} \xb7 ${e.models[0]}`:e.lineage,children:[(0,s.jsx)("span",{className:`h-1.5 w-1.5 rounded-full ${(0,b.JR)(e.lineage)}`}),o]},`${e.lineage}-${e.models?.[0]??"default"}-${t}`)}),e.phases[0]?.reviewer.crossLineage&&(0,s.jsx)(c.E,{variant:"outline",className:"ml-1 border-border font-mono text-[9px] uppercase",title:"Reviewer must be a different lineage than the doer",children:"cross-lineage"})]})}function y({billingMode:e,costEstimate:t,overCap:r,template:a}){return"subscription"===e?(0,s.jsxs)("div",{className:"flex items-center gap-1.5 font-mono text-[10px] text-muted-foreground",title:`~${t.inputTokens.toLocaleString()} input tokens \xd7 ${t.reviewerCount} reviewers — counts against your CLI subscription quota, not billed per call`,children:["Subscription quota \xb7 ~",t.inputTokens.toLocaleString()," tok"]}):(0,s.jsxs)("div",{className:`flex items-center gap-1.5 font-mono text-[10px] ${r?"text-rose-300":"text-muted-foreground"}`,title:`~${t.inputTokens.toLocaleString()} input tokens \xd7 ${t.reviewerCount} reviewers; up to ${t.maxRounds} round${t.maxRounds>1?"s":""} on disagreement`,children:[(0,s.jsx)(h,{className:"h-3 w-3"}),t.maxRounds>1?`~$${t.usd.toFixed(3)} – $${t.usdRangeMax.toFixed(3)} est`:`~$${t.usd.toFixed(3)} est`,a.costCapUsd>0&&(0,s.jsxs)("span",{className:"text-muted-foreground/60",children:["/ cap $",a.costCapUsd.toFixed(2)]})]})}function N(){return(0,s.jsx)(i.Suspense,{fallback:(0,s.jsx)(d.G,{children:(0,s.jsx)("div",{className:"p-8 text-sm text-muted-foreground",children:"Loading…"})}),children:(0,s.jsx)(k,{})})}function k(){let e=(0,o.useSearchParams)(),t=(0,o.useRouter)(),[r,g]=(0,i.useTransition)(),[h,f]=(0,i.useState)([]),[b,j]=(0,i.useState)(null),[w,y]=(0,i.useState)(null);(0,i.useEffect)(()=>{(0,u.eG)().then(f).catch(e=>j(e instanceof u.$v?e.message:"Failed to load templates"))},[]);let[N,k]=(0,i.useState)("api");(0,i.useEffect)(()=>{(0,m.Dl)().then(e=>k(e.mode)).catch(()=>{})},[]);let $=e.get("template")??h[0]?.id??"",[C,S]=(0,i.useState)(""),R=[],M=h.find(e=>e.id===$)??h[0],E=(0,i.useMemo)(()=>(function(e){let{template:t,prompt:r,attachments:s}=e,a=t?.phases?.[0]?.reviewer?.candidates?.length??3,n=Math.max(1,t?.maxRounds??1),o=Math.ceil(r.length/4)+1500*s.length+(t?.estimatedBaselineTokens??800),i=(3e-6*o+.018000000000000002)*a;return{usd:i,usdRangeMax:i*n,inputTokens:o,reviewerCount:a,maxRounds:n}})({template:M,prompt:C,attachments:R}),[C,R,M]),F=!!("subscription"!==N&&M?.costCapUsd&&M.costCapUsd>0&&E.usdRangeMax>M.costCapUsd),[L,P]=(0,i.useState)(!1),[A,T]=(0,i.useState)(""),O=(0,x.$)(M),G=O?M?.phases?.[0]?.artifact:void 0;async function z(){if(M&&C){if(O&&G){let e=new TextEncoder().encode(C).length;if(e>G.maxBytes)return void y(`Artifact is ${e.toLocaleString()} bytes; this template caps at ${G.maxBytes.toLocaleString()}. Trim it down.`)}y(null),g(async()=>{try{let e=A.trim(),r=await (0,u.RL)({work:O?function(e){let t="Review the supplied artifact independently.";if(!e)return t;for(let t of e.split("\n")){let e=t.trim();if(0===e.length||e.startsWith("```")||e.startsWith("~~~"))continue;if(e.length<=80)return e;let r=e.slice(0,80),s=r.lastIndexOf(" ");return(s>40?r.slice(0,s):r)+"…"}return t}(C):C,templateId:M.id,files:R.length>0?R.map(e=>e.name):void 0,...O?{artifact:C}:{},...!O&&e.length>0?{repoPath:e}:{},yolo:L});t.push(`/runs/${r.slug||r.id}`)}catch(e){y(e instanceof u.$v?e.message:"Failed to create chat")}})}}return b?(0,s.jsx)(d.G,{children:(0,s.jsx)("div",{className:"mx-auto w-full max-w-6xl px-4 py-6 sm:px-6 sm:py-8 md:px-8 md:py-10",children:(0,s.jsxs)("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4",children:[(0,s.jsx)("p",{className:"text-sm text-destructive",children:"Error loading templates"}),(0,s.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:b})]})})}):M?(0,s.jsx)(d.G,{children:(0,s.jsxs)("div",{className:"mx-auto w-full max-w-6xl px-4 py-6 sm:px-6 sm:py-8 md:px-8 md:py-10",children:[(0,s.jsx)(l.z,{eyebrow:"New chat",title:O?"Paste an artifact. Get reviews.":"Paste a task. Pick a template.",subtitle:O?"Chorus skips the doer and runs your text past three reviewers. Single pass — revise yourself and resubmit for another round.":"Chorus runs it past your reviewers and reports consensus."}),w&&(0,s.jsx)("div",{className:"mb-4 rounded-lg border border-destructive/50 bg-destructive/10 p-4",children:(0,s.jsx)("p",{className:"text-sm text-destructive",children:w})}),(0,s.jsx)("div",{className:"mb-4 flex flex-wrap items-center gap-2",children:(0,s.jsx)(p,{icon:(0,s.jsx)(a.A,{className:"h-3.5 w-3.5"}),label:"Template",value:M?.name||"Select a template",wide:!0,children:(0,s.jsx)("ul",{className:"space-y-1",children:h.map(r=>{let a=!1===r.isComplete;return(0,s.jsx)("li",{children:(0,s.jsxs)("button",{type:"button",disabled:a,onClick:()=>{if(a)return;let s=new URLSearchParams(e);s.set("template",r.id),t.push(`/new?${s.toString()}`)},className:`block w-full rounded-md p-2 text-left transition ${a?"cursor-not-allowed opacity-50":r.id===$?"bg-accent":"hover:bg-accent/50"}`,children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"text-sm font-medium",children:r.name}),(0,x.$)(r)&&(0,s.jsx)(c.E,{variant:"outline",className:"border-blue-500/30 bg-blue-500/10 font-mono text-[9px] uppercase text-blue-300",children:"review only"}),a&&(0,s.jsx)(c.E,{variant:"outline",className:"border-amber-500/40 bg-amber-500/10 font-mono text-[9px] uppercase text-amber-300",children:"needs setup"})]}),(0,s.jsx)("div",{className:"text-xs text-muted-foreground line-clamp-1",children:a?"Edit this template's YAML to fill in models for your fleet.":r.description})]})},r.id)})})})}),(0,s.jsx)(v,{template:M,prompt:C,setPrompt:S,reviewOnly:O,artifactSpec:G,billingMode:N,costEstimate:E,overCap:F,isPending:r,onStart:z}),F&&(0,s.jsxs)("div",{className:"mb-4 flex items-start gap-2 rounded-md border border-rose-500/30 bg-rose-500/5 px-3 py-2 text-[11px] text-rose-200",children:[(0,s.jsx)(n.A,{className:"mt-0.5 h-3 w-3 shrink-0 text-rose-400"}),(0,s.jsxs)("span",{children:["Estimated cost"," ",(0,s.jsxs)("span",{className:"font-mono",children:["$",E.usd.toFixed(3)]})," ","exceeds template cap"," ",(0,s.jsxs)("span",{className:"font-mono",children:["$",M.costCapUsd.toFixed(2)]}),". Trim attachments, shorten the prompt, or raise the cap in template settings."]})]}),(0,s.jsxs)("div",{className:`mb-4 rounded-lg border border-dashed border-border bg-card/30 p-4 ${O?"opacity-50":""}`,children:[(0,s.jsxs)("div",{className:"mb-2 flex items-center gap-2",children:[(0,s.jsxs)("span",{className:"text-sm font-medium text-foreground",children:["Target repo"," ",(0,s.jsx)("span",{className:"text-muted-foreground",children:"(optional)"})]}),(0,s.jsx)(c.E,{variant:"outline",className:"border-emerald-500/30 bg-emerald-500/10 font-mono text-[10px] uppercase text-emerald-300",children:"opens PR"})]}),(0,s.jsx)("input",{type:"text",value:O?"":A,onChange:e=>T(e.target.value),disabled:O,placeholder:"/absolute/path/to/repo",className:"w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-xs text-foreground placeholder:text-muted-foreground/50 focus:outline-none focus:ring-1 focus:ring-primary disabled:cursor-not-allowed disabled:opacity-60",spellCheck:!1}),(0,s.jsx)("p",{className:"mt-2 text-[11px] text-muted-foreground",children:O?"Review-only templates have no doer and no Ship phase, so there's nothing to commit. Pick a template with a doer (e.g. Tri-Review) to open a PR.":(0,s.jsxs)(s.Fragment,{children:["When set: doer makes real edits in this repo. After reviewers agree, chorus opens a PR via"," ",(0,s.jsx)("code",{className:"rounded bg-muted px-1",children:"gh pr create"})," (no auto-merge — you review + click Merge in GitHub). Leave blank to skip the Ship phase."]})})]}),(0,s.jsxs)("button",{type:"button",onClick:()=>P(e=>!e),className:`mb-4 flex w-full items-start justify-between gap-3 rounded-lg border px-4 py-3 text-left transition ${L?"border-rose-500/40 bg-rose-500/5":"border-dashed border-border bg-card/30 hover:border-foreground/30"}`,children:[(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("span",{className:`mt-0.5 grid h-7 w-7 place-items-center rounded-md text-sm ${L?"bg-rose-500/20 text-rose-300":"bg-card text-muted-foreground"}`,children:"\uD83D\uDE80"}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Yolo mode"}),(0,s.jsx)(c.E,{variant:"outline",className:"border-rose-500/30 bg-rose-500/10 font-mono text-[10px] uppercase text-rose-300",children:"unsafe"})]}),(0,s.jsx)("p",{className:"mt-0.5 text-[11px] text-muted-foreground",children:L?"Reviewer gates auto-approve. Permission prompts auto-allow. The driver merges without asking. Cost cap still enforced.":"Skip every ask-user gate for this single run. Useful for trusted templates or trivial fixes."})]})]}),(0,s.jsx)("span",{className:`flex h-5 w-9 shrink-0 items-center rounded-full border p-0.5 transition ${L?"border-rose-500/40 bg-rose-500/20":"border-border bg-card"}`,children:(0,s.jsx)("span",{className:`h-3.5 w-3.5 rounded-full transition-transform ${L?"translate-x-4 bg-rose-400":"bg-muted-foreground/50"}`})})]})]})}):(0,s.jsx)(d.G,{children:(0,s.jsx)("div",{className:"mx-auto w-full max-w-6xl px-4 py-12 text-sm text-muted-foreground sm:px-6 md:px-8",children:"Loading templates…"})})}},6289:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])},6457:(e,t,r)=>{"use strict";r.d(t,{z:()=>a});var s=r(9442);function a({eyebrow:e,title:t,subtitle:r,action:n}){return(0,s.jsxs)("header",{className:"mb-6 flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:e}),(0,s.jsx)("h1",{className:"mt-1 text-2xl font-semibold tracking-tight",children:t}),r&&(0,s.jsx)("p",{className:"mt-2 max-w-2xl text-sm leading-relaxed text-muted-foreground",children:r})]}),n&&(0,s.jsx)("div",{className:"shrink-0 self-start sm:self-auto",children:n})]})}},9056:(e,t,r)=>{"use strict";r.d(t,{F:()=>o});var s=r(142);let a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,n=s.$,o=(e,t)=>r=>{var s;if((null==t?void 0:t.variants)==null)return n(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:o,defaultVariants:i}=t,d=Object.keys(o).map(e=>{let t=null==r?void 0:r[e],s=null==i?void 0:i[e];if(null===t)return null;let n=a(t)||a(s);return o[e][n]}),l=r&&Object.entries(r).reduce((e,t)=>{let[r,s]=t;return void 0===s||(e[r]=s),e},{});return n(e,d,null==t||null==(s=t.compoundVariants)?void 0:s.reduce((e,t)=>{let{class:r,className:s,...a}=t;return Object.entries(a).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...i,...l}[t]):({...i,...l})[t]===r})?[...e,r,s]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}}},e=>{e.O(0,[116,832,641,344,506,128,358],()=>e(e.s=2919)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{1195:(e,t,r)=>{"use strict";r.d(t,{OpencodeFleetCard:()=>x});var s=r(9442),n=r(6074),d=r(5445),a=r(9707),i=r(4030),o=r(2956),l=r(3734),c=r(7847),m=r(4411),u=r(7362);function x({health:e,voices:t}){let[r,i]=(0,n.useState)(!1),[o,g]=(0,n.useState)(t),[h,b]=(0,n.useState)(null),[f,v]=(0,n.useState)(null);async function y(e){v(e.id),b(null);try{let t=await (0,c.updateVoice)(e.id,{enabled:!e.enabled});g(e=>e.map(e=>e.id===t.id?t:e))}catch(e){b(e instanceof m.$?e.message:"Couldn't save. Is the daemon running?")}finally{v(null)}}let N=new Map;for(let e of o){let t=e.model_id.indexOf("/"),r=t>0?e.model_id.slice(0,t):"other",s=N.get(r)??[];s.push(e),N.set(r,s)}let j=Array.from(N.keys()).sort(),k=o.filter(e=>e.enabled).length;return(0,s.jsxs)("div",{className:(0,u.cn)("rounded-lg border border-border transition-colors hover:border-foreground/20",l.r2.opencode.gradient),children:[(0,s.jsxs)("button",{type:"button",onClick:()=>i(e=>!e),className:"flex w-full items-center gap-3 p-3 text-left",children:[(0,s.jsx)("span",{className:(0,u.cn)("h-2 w-2 shrink-0 rounded-full",l.r2.opencode.dot)}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("div",{className:"text-sm font-medium",children:"OpenCode"}),(0,s.jsxs)("div",{className:"mt-0.5 flex items-center gap-2",children:[(0,s.jsx)(p,{status:e.status}),(0,s.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:[k," model",1===k?"":"s"," enabled"]})]})]}),(0,s.jsx)(d.A,{className:(0,u.cn)("h-4 w-4 shrink-0 text-muted-foreground transition-transform",r&&"rotate-180")})]}),r&&(0,s.jsxs)("div",{className:"space-y-3 border-t border-border bg-card/50 p-3",children:[h&&(0,s.jsx)("p",{className:"text-[11px] text-destructive",children:h}),0===o.length?(0,s.jsxs)("p",{className:"text-[11px] text-muted-foreground",children:["No OpenCode voices detected yet. Run ",(0,s.jsx)("code",{className:"rounded bg-muted px-1",children:"opencode models"})," ","and restart the daemon."]}):(0,s.jsxs)("div",{className:"space-y-3",children:[j.map(e=>{let t=N.get(e)??[];return(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsxs)("p",{className:"text-[11px] font-mono text-muted-foreground/80",children:[e,"/"]}),(0,s.jsx)("div",{className:"grid grid-cols-1 gap-1 sm:grid-cols-2",children:t.map(t=>{let r=t.enabled,n=t.model_id.slice(e.length+1);return(0,s.jsxs)("button",{type:"button",disabled:f===t.id,onClick:()=>y(t),title:t.model_id,className:(0,u.cn)("flex items-center gap-2 rounded border px-2 py-1.5 text-left text-[11px] transition disabled:opacity-60",r?"border-primary/50 bg-primary/10 text-foreground":"border-border bg-card hover:border-muted-foreground/30 text-muted-foreground"),children:[(0,s.jsx)("div",{className:(0,u.cn)("grid h-3 w-3 shrink-0 place-items-center rounded-sm border transition",r?"border-primary bg-primary text-primary-foreground":"border-border"),children:r&&(0,s.jsx)(a.A,{className:"h-2 w-2"})}),(0,s.jsx)("span",{className:"truncate font-mono",children:n})]},t.id)})})]},e)}),(0,s.jsx)("p",{className:"text-[11px] leading-relaxed text-muted-foreground/70",children:"Toggles save automatically. Templates and the New Chat dialog will only offer models you've enabled here."})]})]})]})}function p({status:e}){switch(e){case"auth_invalid":case"quota_exhausted":case"rate_limited":return(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-destructive/10 px-2 py-0.5 text-[10px] font-medium text-destructive",children:[(0,s.jsx)(i.A,{className:"h-3 w-3"}),"auth_invalid"===e?"Auth broken":"quota_exhausted"===e?"Quota out":"Rate-limited"]});default:return(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-emerald-500/10 px-2 py-0.5 text-[10px] font-medium text-emerald-300",children:[(0,s.jsx)(o.A,{className:"h-3 w-3"}),"Connected"]})}}},2956:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},3734:(e,t,r)=>{"use strict";r.d(t,{JR:()=>c,QJ:()=>d,VW:()=>a,YM:()=>u,m_:()=>i,r2:()=>x,u5:()=>l,x0:()=>m,ze:()=>s});let s={anthropic:"Claude",openai:"Codex",google:"Gemini",opencode:"OpenCode",moonshot:"Kimi"},n={anthropic:"bg-violet-400",openai:"bg-orange-400",google:"bg-blue-400",opencode:"bg-emerald-400",moonshot:"bg-pink-400"};function d(e){return e?s[e]??e:""}function a(e){return e?n[e]??"bg-muted":"bg-muted"}let i={claude:"Claude",codex:"Codex",gemini:"Gemini",opencode:"OpenCode",kimi:"Kimi",openrouter:"OpenRouter"},o={claude:"bg-violet-400",codex:"bg-orange-400",gemini:"bg-blue-400",opencode:"bg-emerald-400",kimi:"bg-pink-400",openrouter:"bg-cyan-400"};function l(e){return e?i[e]??e:""}function c(e){return e?o[e]??"bg-muted":"bg-muted"}let m={claude:"claude-opus-4-7",codex:"gpt-5.5",gemini:"gemini-2.5-pro",opencode:"kimi-k2.6",kimi:"kimi-k2.6",openrouter:""};function u(e){if(e)return m[e]}let x={claude:{dot:"bg-violet-400",ring:"ring-violet-400/40",gradient:"bg-gradient-to-b from-violet-500/15 to-card"},codex:{dot:"bg-orange-400",ring:"ring-orange-400/40",gradient:"bg-gradient-to-b from-orange-500/15 to-card"},gemini:{dot:"bg-blue-400",ring:"ring-blue-400/40",gradient:"bg-gradient-to-b from-blue-500/15 to-card"},opencode:{dot:"bg-emerald-400",ring:"ring-emerald-400/40",gradient:"bg-gradient-to-b from-emerald-500/15 to-card"},kimi:{dot:"bg-pink-400",ring:"ring-pink-400/40",gradient:"bg-gradient-to-b from-pink-500/15 to-card"},openrouter:{dot:"bg-cyan-400",ring:"ring-cyan-400/40",gradient:"bg-gradient-to-b from-cyan-500/15 to-card"}}},3761:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]])},4030:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("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"}]])},5445:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},5626:(e,t,r)=>{Promise.resolve().then(r.bind(r,6501)),Promise.resolve().then(r.t.bind(r,2573,23)),Promise.resolve().then(r.bind(r,821)),Promise.resolve().then(r.bind(r,9823)),Promise.resolve().then(r.bind(r,8344)),Promise.resolve().then(r.bind(r,1195)),Promise.resolve().then(r.bind(r,8359))},6289:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])},8359:(e,t,r)=>{"use strict";r.d(t,{OpenRouterFleetCard:()=>b});var s=r(9442),n=r(6074),d=r(2573),a=r.n(d),i=r(5445),o=r(4030),l=r(6289),c=r(9707),m=r(3761),u=r(2956),x=r(3734),p=r(7847),g=r(4411),h=r(7362);function b({voices:e,health:t}){let r=t?.status==="auth_invalid",[d,f]=(0,n.useState)(r),[v,y]=(0,n.useState)(e),[N,j]=(0,n.useState)(null),[k,w]=(0,n.useState)(null);async function A(e){w(e.id),j(null);try{let t=await (0,p.updateVoice)(e.id,{enabled:!e.enabled});y(e=>e.map(e=>e.id===t.id?t:e))}catch(e){j(e instanceof g.$?e.message:"Couldn't save. Is the daemon running?")}finally{w(null)}}let C=v.filter(e=>e.enabled).length;return(0,s.jsxs)("div",{className:(0,h.cn)("rounded-lg border border-border transition-colors hover:border-foreground/20",x.r2.openrouter.gradient),children:[(0,s.jsxs)("button",{type:"button",onClick:()=>f(e=>!e),className:"flex w-full items-center gap-3 p-3 text-left",children:[(0,s.jsx)("span",{className:(0,h.cn)("h-2 w-2 shrink-0 rounded-full",x.r2.openrouter.dot)}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("div",{className:"text-sm font-medium",children:"OpenRouter"}),(0,s.jsxs)("div",{className:"mt-0.5 flex items-center gap-2",children:[function(e){switch(e){case"quota_exhausted":return(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-destructive/10 px-2 py-0.5 text-[10px] font-medium text-destructive",children:[(0,s.jsx)(o.A,{className:"h-3 w-3"}),"Credits out"]});case"auth_invalid":return(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-destructive/10 px-2 py-0.5 text-[10px] font-medium text-destructive",children:[(0,s.jsx)(o.A,{className:"h-3 w-3"}),"Auth broken"]});case"rate_limited":return(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-amber-500/10 px-2 py-0.5 text-[10px] font-medium text-amber-300",children:[(0,s.jsx)(m.A,{className:"h-3 w-3"}),"Rate-limited"]});default:return(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-emerald-500/10 px-2 py-0.5 text-[10px] font-medium text-emerald-300",children:[(0,s.jsx)(u.A,{className:"h-3 w-3"}),"Configured"]})}}(t?.status??"healthy"),(0,s.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:[C," model",1===C?"":"s"," enabled"]})]})]}),(0,s.jsx)(i.A,{className:(0,h.cn)("h-4 w-4 shrink-0 text-muted-foreground transition-transform",d&&"rotate-180")})]}),d&&(0,s.jsxs)("div",{className:"space-y-2 border-t border-border bg-card/50 p-3",children:[r&&(0,s.jsxs)("div",{className:"flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 p-2.5",children:[(0,s.jsx)(o.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-destructive"}),(0,s.jsxs)("div",{className:"min-w-0 flex-1 space-y-1.5",children:[(0,s.jsxs)("p",{className:"text-[11px] leading-relaxed text-destructive",children:["OpenRouter rejected the saved API key",t?.message?`: ${t.message}`:"."]}),(0,s.jsxs)(a(),{href:"/connect",className:"inline-flex items-center gap-1 rounded border border-destructive/50 bg-destructive/10 px-2 py-1 text-[11px] font-medium text-destructive transition hover:bg-destructive/20",children:["Fix on Connect",(0,s.jsx)(l.A,{className:"h-3 w-3"})]})]})]}),N&&(0,s.jsx)("p",{className:"text-[11px] text-destructive",children:N}),0===v.length?(0,s.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"No OpenRouter voices yet. Add some on the Connect page."}):(0,s.jsx)("div",{className:"grid grid-cols-1 gap-1",children:v.map(e=>(0,s.jsxs)("button",{type:"button",disabled:k===e.id,onClick:()=>A(e),title:e.model_id,className:(0,h.cn)("flex items-center gap-2 rounded border px-2 py-1.5 text-left text-[11px] transition disabled:opacity-60",e.enabled?"border-primary/50 bg-primary/10 text-foreground":"border-border bg-card text-muted-foreground hover:border-muted-foreground/30"),children:[(0,s.jsx)("div",{className:(0,h.cn)("grid h-3 w-3 shrink-0 place-items-center rounded-sm border transition",e.enabled?"border-primary bg-primary text-primary-foreground":"border-border"),children:e.enabled&&(0,s.jsx)(c.A,{className:"h-2 w-2"})}),(0,s.jsx)("span",{className:"truncate font-mono",children:e.model_id})]},e.id))}),!r&&(0,s.jsx)("p",{className:"text-[11px] leading-relaxed text-muted-foreground/70",children:"Add or replace your API key on Connect. Toggles save automatically."})]})]})}},9707:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},9823:(e,t,r)=>{"use strict";r.d(t,{LineageFleetCard:()=>h});var s=r(9442),n=r(6074),d=r(5445),a=r(9707),i=r(4030),o=r(3761),l=r(2956),c=r(3734),m=r(7847),u=r(4411),x=r(7362);let p={anthropic:"claude",openai:"codex",google:"gemini",opencode:"opencode",moonshot:"kimi"},g={dot:"bg-muted-foreground/40",gradient:"bg-gradient-to-br from-muted/30 via-card to-card"};function h({lineage:e,label:t,voices:r,health:i}){let o,[l,f]=(0,n.useState)(!1),[v,y]=(0,n.useState)(r),[N,j]=(0,n.useState)(null),[k,w]=(0,n.useState)(null);async function A(e){w(e.id),j(null);try{let t=await (0,m.updateVoice)(e.id,{enabled:!e.enabled});y(e=>e.map(e=>e.id===t.id?t:e))}catch(e){j(e instanceof u.$?e.message:"Couldn't save. Is the daemon running?")}finally{w(null)}}let C=v.filter(e=>e.enabled).length,_=(o=p[e])?c.r2[o]:g;return(0,s.jsxs)("div",{className:(0,x.cn)("rounded-lg border border-border transition-colors hover:border-foreground/20",_.gradient),children:[(0,s.jsxs)("button",{type:"button",onClick:()=>f(e=>!e),className:"flex w-full items-center gap-3 p-3 text-left",children:[(0,s.jsx)("span",{className:(0,x.cn)("h-2 w-2 shrink-0 rounded-full",_.dot)}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("div",{className:"text-sm font-medium",children:t}),(0,s.jsxs)("div",{className:"mt-0.5 flex items-center gap-2",children:[(0,s.jsx)(b,{status:i.status}),(0,s.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:[C," model",1===C?"":"s"," enabled"]})]})]}),(0,s.jsx)(d.A,{className:(0,x.cn)("h-4 w-4 shrink-0 text-muted-foreground transition-transform",l&&"rotate-180")})]}),l&&(0,s.jsxs)("div",{className:"space-y-2 border-t border-border bg-card/50 p-3",children:[N&&(0,s.jsx)("p",{className:"text-[11px] text-destructive",children:N}),0===v.length?(0,s.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"No voices detected for this provider yet."}):(0,s.jsx)("div",{className:"grid grid-cols-1 gap-1",children:v.map(e=>{let t=e.enabled;return(0,s.jsxs)("button",{type:"button",disabled:k===e.id,onClick:()=>A(e),title:e.model_id,className:(0,x.cn)("flex items-center gap-2 rounded border px-2 py-1.5 text-left text-[11px] transition disabled:opacity-60",t?"border-primary/50 bg-primary/10 text-foreground":"border-border bg-card hover:border-muted-foreground/30 text-muted-foreground"),children:[(0,s.jsx)("div",{className:(0,x.cn)("grid h-3 w-3 shrink-0 place-items-center rounded-sm border transition",t?"border-primary bg-primary text-primary-foreground":"border-border"),children:t&&(0,s.jsx)(a.A,{className:"h-2 w-2"})}),(0,s.jsx)("span",{className:"truncate font-mono",children:e.model_id})]},e.id)})}),(0,s.jsx)("p",{className:"text-[11px] leading-relaxed text-muted-foreground/70",children:"Toggles save automatically. Voice list is curated per chorus release — new models appear after upgrades."})]})]})}function b({status:e}){switch(e){case"auth_invalid":return(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-destructive/10 px-2 py-0.5 text-[10px] font-medium text-destructive",children:[(0,s.jsx)(i.A,{className:"h-3 w-3"}),"Auth broken"]});case"quota_exhausted":return(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-destructive/10 px-2 py-0.5 text-[10px] font-medium text-destructive",children:[(0,s.jsx)(i.A,{className:"h-3 w-3"}),"Quota out"]});case"rate_limited":return(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-amber-500/10 px-2 py-0.5 text-[10px] font-medium text-amber-300",children:[(0,s.jsx)(o.A,{className:"h-3 w-3"}),"Rate-limited"]});default:return(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-emerald-500/10 px-2 py-0.5 text-[10px] font-medium text-emerald-300",children:[(0,s.jsx)(l.A,{className:"h-3 w-3"}),"Connected"]})}}}},e=>{e.O(0,[116,720,641,344,506,128,358],()=>e(e.s=5626)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[974],{1195:(e,t,r)=>{"use strict";r.d(t,{OpencodeFleetCard:()=>x});var s=r(9442),n=r(6074),d=r(5445),a=r(9707),i=r(4030),o=r(2956),l=r(3734),c=r(7847),m=r(4411),u=r(7362);function x({health:e,voices:t}){let[r,i]=(0,n.useState)(!1),[o,g]=(0,n.useState)(t),[h,b]=(0,n.useState)(null),[f,v]=(0,n.useState)(null);async function y(e){v(e.id),b(null);try{let t=await (0,c.updateVoice)(e.id,{enabled:!e.enabled});g(e=>e.map(e=>e.id===t.id?t:e))}catch(e){b(e instanceof m.$?e.message:"Couldn't save. Is the daemon running?")}finally{v(null)}}let N=new Map;for(let e of o){let t=e.model_id.indexOf("/"),r=t>0?e.model_id.slice(0,t):"other",s=N.get(r)??[];s.push(e),N.set(r,s)}let j=Array.from(N.keys()).sort(),k=o.filter(e=>e.enabled).length;return(0,s.jsxs)("div",{className:(0,u.cn)("rounded-lg border border-border transition-colors hover:border-foreground/20",l.r2.opencode.gradient),children:[(0,s.jsxs)("button",{type:"button",onClick:()=>i(e=>!e),className:"flex w-full items-center gap-3 p-3 text-left",children:[(0,s.jsx)("span",{className:(0,u.cn)("h-2 w-2 shrink-0 rounded-full",l.r2.opencode.dot)}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("div",{className:"text-sm font-medium",children:"OpenCode"}),(0,s.jsxs)("div",{className:"mt-0.5 flex items-center gap-2",children:[(0,s.jsx)(p,{status:e.status}),(0,s.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:[k," model",1===k?"":"s"," enabled"]})]})]}),(0,s.jsx)(d.A,{className:(0,u.cn)("h-4 w-4 shrink-0 text-muted-foreground transition-transform",r&&"rotate-180")})]}),r&&(0,s.jsxs)("div",{className:"space-y-3 border-t border-border bg-card/50 p-3",children:[h&&(0,s.jsx)("p",{className:"text-[11px] text-destructive",children:h}),0===o.length?(0,s.jsxs)("p",{className:"text-[11px] text-muted-foreground",children:["No OpenCode voices detected yet. Run ",(0,s.jsx)("code",{className:"rounded bg-muted px-1",children:"opencode models"})," ","and restart the daemon."]}):(0,s.jsxs)("div",{className:"space-y-3",children:[j.map(e=>{let t=N.get(e)??[];return(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsxs)("p",{className:"text-[11px] font-mono text-muted-foreground/80",children:[e,"/"]}),(0,s.jsx)("div",{className:"grid grid-cols-1 gap-1 sm:grid-cols-2",children:t.map(t=>{let r=t.enabled,n=t.model_id.slice(e.length+1);return(0,s.jsxs)("button",{type:"button",disabled:f===t.id,onClick:()=>y(t),title:t.model_id,className:(0,u.cn)("flex items-center gap-2 rounded border px-2 py-1.5 text-left text-[11px] transition disabled:opacity-60",r?"border-primary/50 bg-primary/10 text-foreground":"border-border bg-card hover:border-muted-foreground/30 text-muted-foreground"),children:[(0,s.jsx)("div",{className:(0,u.cn)("grid h-3 w-3 shrink-0 place-items-center rounded-sm border transition",r?"border-primary bg-primary text-primary-foreground":"border-border"),children:r&&(0,s.jsx)(a.A,{className:"h-2 w-2"})}),(0,s.jsx)("span",{className:"truncate font-mono",children:n})]},t.id)})})]},e)}),(0,s.jsx)("p",{className:"text-[11px] leading-relaxed text-muted-foreground/70",children:"Toggles save automatically. Templates and the New Chat dialog will only offer models you've enabled here."})]})]})]})}function p({status:e}){switch(e){case"auth_invalid":case"quota_exhausted":case"rate_limited":return(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-destructive/10 px-2 py-0.5 text-[10px] font-medium text-destructive",children:[(0,s.jsx)(i.A,{className:"h-3 w-3"}),"auth_invalid"===e?"Auth broken":"quota_exhausted"===e?"Quota out":"Rate-limited"]});default:return(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-emerald-500/10 px-2 py-0.5 text-[10px] font-medium text-emerald-300",children:[(0,s.jsx)(o.A,{className:"h-3 w-3"}),"Connected"]})}}},2956:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},3734:(e,t,r)=>{"use strict";r.d(t,{JR:()=>c,QJ:()=>d,VW:()=>a,YM:()=>u,m_:()=>i,r2:()=>x,u5:()=>l,x0:()=>m,ze:()=>s});let s={anthropic:"Claude",openai:"Codex",google:"Gemini",opencode:"OpenCode",moonshot:"Kimi"},n={anthropic:"bg-violet-400",openai:"bg-orange-400",google:"bg-blue-400",opencode:"bg-emerald-400",moonshot:"bg-pink-400"};function d(e){return e?s[e]??e:""}function a(e){return e?n[e]??"bg-muted":"bg-muted"}let i={claude:"Claude",codex:"Codex",gemini:"Gemini",opencode:"OpenCode",kimi:"Kimi",openrouter:"OpenRouter"},o={claude:"bg-violet-400",codex:"bg-orange-400",gemini:"bg-blue-400",opencode:"bg-emerald-400",kimi:"bg-pink-400",openrouter:"bg-cyan-400"};function l(e){return e?i[e]??e:""}function c(e){return e?o[e]??"bg-muted":"bg-muted"}let m={claude:"claude-opus-4-7",codex:"gpt-5.5",gemini:"gemini-2.5-pro",opencode:"kimi-k2.6",kimi:"kimi-k2.6",openrouter:""};function u(e){if(e)return m[e]}let x={claude:{dot:"bg-violet-400",ring:"ring-violet-400/40",gradient:"bg-gradient-to-b from-violet-500/15 to-card"},codex:{dot:"bg-orange-400",ring:"ring-orange-400/40",gradient:"bg-gradient-to-b from-orange-500/15 to-card"},gemini:{dot:"bg-blue-400",ring:"ring-blue-400/40",gradient:"bg-gradient-to-b from-blue-500/15 to-card"},opencode:{dot:"bg-emerald-400",ring:"ring-emerald-400/40",gradient:"bg-gradient-to-b from-emerald-500/15 to-card"},kimi:{dot:"bg-pink-400",ring:"ring-pink-400/40",gradient:"bg-gradient-to-b from-pink-500/15 to-card"},openrouter:{dot:"bg-cyan-400",ring:"ring-cyan-400/40",gradient:"bg-gradient-to-b from-cyan-500/15 to-card"}}},3761:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]])},4030:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("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"}]])},5445:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},5626:(e,t,r)=>{Promise.resolve().then(r.bind(r,6501)),Promise.resolve().then(r.t.bind(r,2573,23)),Promise.resolve().then(r.bind(r,821)),Promise.resolve().then(r.bind(r,9823)),Promise.resolve().then(r.bind(r,8344)),Promise.resolve().then(r.bind(r,1195)),Promise.resolve().then(r.bind(r,8359))},6289:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])},8359:(e,t,r)=>{"use strict";r.d(t,{OpenRouterFleetCard:()=>b});var s=r(9442),n=r(6074),d=r(2573),a=r.n(d),i=r(5445),o=r(4030),l=r(6289),c=r(9707),m=r(3761),u=r(2956),x=r(3734),p=r(7847),g=r(4411),h=r(7362);function b({voices:e,health:t}){let r=t?.status==="auth_invalid",[d,f]=(0,n.useState)(r),[v,y]=(0,n.useState)(e),[N,j]=(0,n.useState)(null),[k,w]=(0,n.useState)(null);async function A(e){w(e.id),j(null);try{let t=await (0,p.updateVoice)(e.id,{enabled:!e.enabled});y(e=>e.map(e=>e.id===t.id?t:e))}catch(e){j(e instanceof g.$?e.message:"Couldn't save. Is the daemon running?")}finally{w(null)}}let C=v.filter(e=>e.enabled).length;return(0,s.jsxs)("div",{className:(0,h.cn)("rounded-lg border border-border transition-colors hover:border-foreground/20",x.r2.openrouter.gradient),children:[(0,s.jsxs)("button",{type:"button",onClick:()=>f(e=>!e),className:"flex w-full items-center gap-3 p-3 text-left",children:[(0,s.jsx)("span",{className:(0,h.cn)("h-2 w-2 shrink-0 rounded-full",x.r2.openrouter.dot)}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("div",{className:"text-sm font-medium",children:"OpenRouter"}),(0,s.jsxs)("div",{className:"mt-0.5 flex items-center gap-2",children:[function(e){switch(e){case"quota_exhausted":return(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-destructive/10 px-2 py-0.5 text-[10px] font-medium text-destructive",children:[(0,s.jsx)(o.A,{className:"h-3 w-3"}),"Credits out"]});case"auth_invalid":return(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-destructive/10 px-2 py-0.5 text-[10px] font-medium text-destructive",children:[(0,s.jsx)(o.A,{className:"h-3 w-3"}),"Auth broken"]});case"rate_limited":return(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-amber-500/10 px-2 py-0.5 text-[10px] font-medium text-amber-300",children:[(0,s.jsx)(m.A,{className:"h-3 w-3"}),"Rate-limited"]});default:return(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-emerald-500/10 px-2 py-0.5 text-[10px] font-medium text-emerald-300",children:[(0,s.jsx)(u.A,{className:"h-3 w-3"}),"Configured"]})}}(t?.status??"healthy"),(0,s.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:[C," model",1===C?"":"s"," enabled"]})]})]}),(0,s.jsx)(i.A,{className:(0,h.cn)("h-4 w-4 shrink-0 text-muted-foreground transition-transform",d&&"rotate-180")})]}),d&&(0,s.jsxs)("div",{className:"space-y-2 border-t border-border bg-card/50 p-3",children:[r&&(0,s.jsxs)("div",{className:"flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 p-2.5",children:[(0,s.jsx)(o.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-destructive"}),(0,s.jsxs)("div",{className:"min-w-0 flex-1 space-y-1.5",children:[(0,s.jsxs)("p",{className:"text-[11px] leading-relaxed text-destructive",children:["OpenRouter rejected the saved API key",t?.message?`: ${t.message}`:"."]}),(0,s.jsxs)(a(),{href:"/connect",className:"inline-flex items-center gap-1 rounded border border-destructive/50 bg-destructive/10 px-2 py-1 text-[11px] font-medium text-destructive transition hover:bg-destructive/20",children:["Fix on Connect",(0,s.jsx)(l.A,{className:"h-3 w-3"})]})]})]}),N&&(0,s.jsx)("p",{className:"text-[11px] text-destructive",children:N}),0===v.length?(0,s.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"No OpenRouter voices yet. Add some on the Connect page."}):(0,s.jsx)("div",{className:"grid grid-cols-1 gap-1",children:v.map(e=>(0,s.jsxs)("button",{type:"button",disabled:k===e.id,onClick:()=>A(e),title:e.model_id,className:(0,h.cn)("flex items-center gap-2 rounded border px-2 py-1.5 text-left text-[11px] transition disabled:opacity-60",e.enabled?"border-primary/50 bg-primary/10 text-foreground":"border-border bg-card text-muted-foreground hover:border-muted-foreground/30"),children:[(0,s.jsx)("div",{className:(0,h.cn)("grid h-3 w-3 shrink-0 place-items-center rounded-sm border transition",e.enabled?"border-primary bg-primary text-primary-foreground":"border-border"),children:e.enabled&&(0,s.jsx)(c.A,{className:"h-2 w-2"})}),(0,s.jsx)("span",{className:"truncate font-mono",children:e.model_id})]},e.id))}),!r&&(0,s.jsx)("p",{className:"text-[11px] leading-relaxed text-muted-foreground/70",children:"Add or replace your API key on Connect. Toggles save automatically."})]})]})}},9707:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},9823:(e,t,r)=>{"use strict";r.d(t,{LineageFleetCard:()=>h});var s=r(9442),n=r(6074),d=r(5445),a=r(9707),i=r(4030),o=r(3761),l=r(2956),c=r(3734),m=r(7847),u=r(4411),x=r(7362);let p={anthropic:"claude",openai:"codex",google:"gemini",opencode:"opencode",moonshot:"kimi"},g={dot:"bg-muted-foreground/40",gradient:"bg-gradient-to-br from-muted/30 via-card to-card"};function h({lineage:e,label:t,voices:r,health:i}){let o,[l,f]=(0,n.useState)(!1),[v,y]=(0,n.useState)(r),[N,j]=(0,n.useState)(null),[k,w]=(0,n.useState)(null);async function A(e){w(e.id),j(null);try{let t=await (0,m.updateVoice)(e.id,{enabled:!e.enabled});y(e=>e.map(e=>e.id===t.id?t:e))}catch(e){j(e instanceof u.$?e.message:"Couldn't save. Is the daemon running?")}finally{w(null)}}let C=v.filter(e=>e.enabled).length,_=(o=p[e])?c.r2[o]:g;return(0,s.jsxs)("div",{className:(0,x.cn)("rounded-lg border border-border transition-colors hover:border-foreground/20",_.gradient),children:[(0,s.jsxs)("button",{type:"button",onClick:()=>f(e=>!e),className:"flex w-full items-center gap-3 p-3 text-left",children:[(0,s.jsx)("span",{className:(0,x.cn)("h-2 w-2 shrink-0 rounded-full",_.dot)}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("div",{className:"text-sm font-medium",children:t}),(0,s.jsxs)("div",{className:"mt-0.5 flex items-center gap-2",children:[(0,s.jsx)(b,{status:i.status}),(0,s.jsxs)("span",{className:"text-[10px] text-muted-foreground",children:[C," model",1===C?"":"s"," enabled"]})]})]}),(0,s.jsx)(d.A,{className:(0,x.cn)("h-4 w-4 shrink-0 text-muted-foreground transition-transform",l&&"rotate-180")})]}),l&&(0,s.jsxs)("div",{className:"space-y-2 border-t border-border bg-card/50 p-3",children:[N&&(0,s.jsx)("p",{className:"text-[11px] text-destructive",children:N}),0===v.length?(0,s.jsx)("p",{className:"text-[11px] text-muted-foreground",children:"No voices detected for this provider yet."}):(0,s.jsx)("div",{className:"grid grid-cols-1 gap-1",children:v.map(e=>{let t=e.enabled;return(0,s.jsxs)("button",{type:"button",disabled:k===e.id,onClick:()=>A(e),title:e.model_id,className:(0,x.cn)("flex items-center gap-2 rounded border px-2 py-1.5 text-left text-[11px] transition disabled:opacity-60",t?"border-primary/50 bg-primary/10 text-foreground":"border-border bg-card hover:border-muted-foreground/30 text-muted-foreground"),children:[(0,s.jsx)("div",{className:(0,x.cn)("grid h-3 w-3 shrink-0 place-items-center rounded-sm border transition",t?"border-primary bg-primary text-primary-foreground":"border-border"),children:t&&(0,s.jsx)(a.A,{className:"h-2 w-2"})}),(0,s.jsx)("span",{className:"truncate font-mono",children:e.model_id})]},e.id)})}),(0,s.jsx)("p",{className:"text-[11px] leading-relaxed text-muted-foreground/70",children:"Toggles save automatically. Voice list is curated per chorus release — new models appear after upgrades."})]})]})}function b({status:e}){switch(e){case"auth_invalid":return(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-destructive/10 px-2 py-0.5 text-[10px] font-medium text-destructive",children:[(0,s.jsx)(i.A,{className:"h-3 w-3"}),"Auth broken"]});case"quota_exhausted":return(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-destructive/10 px-2 py-0.5 text-[10px] font-medium text-destructive",children:[(0,s.jsx)(i.A,{className:"h-3 w-3"}),"Quota out"]});case"rate_limited":return(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-amber-500/10 px-2 py-0.5 text-[10px] font-medium text-amber-300",children:[(0,s.jsx)(o.A,{className:"h-3 w-3"}),"Rate-limited"]});default:return(0,s.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-emerald-500/10 px-2 py-0.5 text-[10px] font-medium text-emerald-300",children:[(0,s.jsx)(l.A,{className:"h-3 w-3"}),"Connected"]})}}}},e=>{e.O(0,[116,832,641,344,506,128,358],()=>e(e.s=5626)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[406],{2956:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},3149:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},4030:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("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"}]])},4052:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},4696:(e,t,r)=>{Promise.resolve().then(r.bind(r,5921))},5921:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>D});var s=r(9442),n=r(6074),a=r(3149);let l=(0,r(3884).A)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);var i=r(8420),d=r(4052),o=r(4372),c=r(63),u=r(5702),m=r(6457),p=r(8191),x=r(9315),h=r(6458),b=r(6891),f=r(1853),g=r(6185),v=r(4030),y=r(7362),j=r(3734);let w=/^[a-z0-9][a-z0-9-]{1,63}$/,N=[{value:"",label:"No preference"},{value:"anthropic",label:j.ze.anthropic},{value:"openai",label:j.ze.openai},{value:"google",label:j.ze.google},{value:"opencode",label:j.ze.opencode},{value:"moonshot",label:j.ze.moonshot}],k={id:"",label:"",one_liner:"",recommended_lineage:"",system_prompt:"# Worldview\n\nDescribe the lens this persona uses to read code and findings.\n\n# What you look for\n\n- ...\n- ...\n\n# Tone\n\nHow the persona writes — terse, exhaustive, contrarian, etc.\n"};function _(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64)}function C({label:e,hint:t,issue:r,span2:n,children:a}){return(0,s.jsxs)("label",{className:(0,y.cn)("flex flex-col gap-1",n&&"sm:col-span-2"),children:[(0,s.jsxs)("span",{className:"flex items-baseline justify-between gap-2",children:[(0,s.jsx)("span",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:e}),t&&(0,s.jsx)("span",{className:"text-[10px] text-muted-foreground/70",children:t})]}),a,r&&(0,s.jsx)("span",{className:"text-[10px] text-destructive",children:r.message})]})}function S({form:e,setField:t,setIdDirty:r,isEdit:n,isBuiltin:a,issues:l}){return(0,s.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 py-5",children:[n&&a&&(0,s.jsx)("div",{className:"mb-4 rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-200",children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(v.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),(0,s.jsx)("div",{children:"Built-in persona. Saving demotes it to a user copy so the boot-time seed leaves it alone — you'll no longer receive upstream updates for this id."})]})}),(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[(0,s.jsx)(C,{label:"Label",hint:"Human-friendly name shown in the picker",issue:l.find(e=>"label"===e.field),children:(0,s.jsx)("input",{type:"text",value:e.label,onChange:e=>t("label",e.target.value),placeholder:"Security Skeptic",className:"h-9 w-full rounded-md border border-border bg-background px-3 text-sm outline-none transition focus:border-primary/60"})}),(0,s.jsx)(C,{label:"ID",hint:n?"Locked once created":"Lowercase, dashes — auto-derived from label",issue:l.find(e=>"id"===e.field),children:(0,s.jsx)("input",{type:"text",value:e.id,disabled:n,onChange:e=>{r(!0),t("id",e.target.value)},placeholder:"security-skeptic",className:(0,y.cn)("h-9 w-full rounded-md border border-border bg-background px-3 font-mono text-sm outline-none transition focus:border-primary/60",n&&"cursor-not-allowed opacity-60")})}),(0,s.jsx)(C,{label:"One-liner",hint:"Shown under the label in the persona list",issue:l.find(e=>"one_liner"===e.field),span2:!0,children:(0,s.jsx)("input",{type:"text",value:e.one_liner,onChange:e=>t("one_liner",e.target.value),placeholder:"Reads every diff like an attacker.",className:"h-9 w-full rounded-md border border-border bg-background px-3 text-sm outline-none transition focus:border-primary/60"})}),(0,s.jsx)(C,{label:"Recommended lineage",hint:"Optional — pickers can default to this CLI",span2:!0,children:(0,s.jsx)("select",{value:e.recommended_lineage,onChange:e=>t("recommended_lineage",e.target.value),className:"h-9 w-full rounded-md border border-border bg-background px-3 text-sm outline-none transition focus:border-primary/60",children:N.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label},e.value))})})]}),(0,s.jsx)("div",{className:"mt-5",children:(0,s.jsx)(C,{label:"System prompt",hint:"Prepended to the doer / reviewer ask at run time. Markdown.",issue:l.find(e=>"system_prompt"===e.field),children:(0,s.jsx)("textarea",{value:e.system_prompt,onChange:e=>t("system_prompt",e.target.value),spellCheck:!1,className:"min-h-[280px] w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-[12px] leading-relaxed outline-none transition focus:border-primary/60"})})})]})}var A=r(2956);function $({saveError:e,issues:t,valid:r,saving:n,deleting:l,confirmingDelete:d,canSave:o,isEdit:c,isBuiltin:u,onCancel:m,onSave:p,onDelete:x}){return(0,s.jsxs)("div",{className:"flex flex-col gap-2 border-t border-border bg-card/40 px-6 py-3",children:[e&&(0,s.jsx)("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:(0,s.jsxs)("div",{className:"flex items-start gap-1.5",children:[(0,s.jsx)(v.A,{className:"mt-0.5 h-3 w-3 shrink-0"}),(0,s.jsx)("div",{className:"flex-1 leading-snug",children:e})]})}),(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:r?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(A.A,{className:"h-3 w-3 text-emerald-400"}),(0,s.jsx)("span",{children:"Ready to save"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(v.A,{className:"h-3 w-3 text-destructive/80"}),(0,s.jsxs)("span",{children:[t.length," ",1===t.length?"issue":"issues"," to resolve"]})]})}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[c&&!u&&(0,s.jsxs)("button",{type:"button",onClick:x,disabled:l||n,className:(0,y.cn)("inline-flex h-9 items-center gap-1.5 rounded-md border px-3 text-sm font-medium transition",d?"border-destructive bg-destructive/15 text-destructive hover:bg-destructive/25":"border-border bg-card text-muted-foreground hover:border-destructive/50 hover:text-destructive"),children:[l?(0,s.jsx)(a.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(i.A,{className:"h-3.5 w-3.5"}),l?"Deleting…":d?"Click again to confirm":"Delete"]}),(0,s.jsx)("button",{type:"button",onClick:m,className:"h-9 rounded-md border border-border bg-card px-4 text-sm font-medium text-muted-foreground transition hover:border-muted-foreground/30 hover:text-foreground",children:"Cancel"}),(0,s.jsxs)("button",{type:"button",disabled:!o,onClick:p,className:(0,y.cn)("inline-flex h-9 items-center gap-1.5 rounded-md px-4 text-sm font-medium shadow-sm transition",o?"bg-primary text-primary-foreground hover:bg-primary/90":"cursor-not-allowed bg-muted text-muted-foreground/60 shadow-none"),children:[n&&(0,s.jsx)(a.A,{className:"h-3.5 w-3.5 animate-spin"}),n?"Saving…":c?"Save changes":"Save persona"]})]})]})]})}function E({editing:e,trigger:t,onSaved:r,onDeleted:a,defaultOpen:l}){let[i,o]=(0,n.useState)(!!l),c=!!e,u=!!e?.builtin,m=(0,n.useMemo)(()=>e?{id:e.id,label:e.label,one_liner:e.one_liner,recommended_lineage:e.recommended_lineage??"",system_prompt:e.system_prompt??""}:k,[e?.id,e?.updated_at]),[p,v]=(0,n.useState)(m),[y,j]=(0,n.useState)(!1),[N,C]=(0,n.useState)(!1),[A,D]=(0,n.useState)(!1),[z,M]=(0,n.useState)(null),[q,I]=(0,n.useState)(c);(0,n.useEffect)(()=>{v(m),M(null),D(!1),I(c)},[m,c]);let O=(0,n.useRef)(m);(0,n.useEffect)(()=>{O.current=m});let L=(0,n.useMemo)(()=>{let e,t;return e=[],(t=c?p.id:p.id||_(p.label))?w.test(t)||e.push({field:"id",message:"id must be lowercase letters, numbers, dashes (2–64 chars)"}):e.push({field:"id",message:"id is required"}),p.label.trim()||e.push({field:"label",message:"label is required"}),p.one_liner.trim()||e.push({field:"one_liner",message:"one-liner is required"}),p.system_prompt.trim()||e.push({field:"system_prompt",message:"system prompt is required"}),e},[p,c]),F=0===L.length;function P(){v(O.current),j(!1),C(!1),M(null),D(!1),I(c)}function R(e){o(e),e||setTimeout(P,200)}async function T(){if(!F||y)return;let t=c?e.id:p.id||_(p.label);j(!0),M(null);try{let e=await (0,g.qI)({id:t,label:p.label.trim(),one_liner:p.one_liner.trim(),system_prompt:p.system_prompt,recommended_lineage:p.recommended_lineage||null});r?.(e.id),R(!1)}catch(e){M(e instanceof g.$v||e instanceof Error?e.message:"Save failed (unknown error)")}finally{j(!1)}}async function V(){if(e&&!u&&!N){if(!A){D(!0),setTimeout(()=>D(e=>!e&&e),8e3);return}C(!0),M(null);try{await (0,g.K7)(e.id),a?.(e.id),R(!1)}catch(e){M(e instanceof g.$v||e instanceof Error?e.message:"Delete failed (unknown error)"),D(!1)}finally{C(!1)}}}let W=F&&!y&&!N,B=t??(c?(0,s.jsx)("button",{type:"button","aria-label":`Edit persona ${e.label}`,className:"grid h-7 w-7 place-items-center rounded-md border border-border bg-card text-muted-foreground transition hover:border-muted-foreground/40 hover:bg-accent/60 hover:text-foreground",children:(0,s.jsx)(d.A,{className:"h-3.5 w-3.5"})}):(0,s.jsxs)("button",{type:"button","aria-label":"New persona",className:"inline-flex shrink-0 items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground shadow-sm transition hover:bg-primary/90",children:[(0,s.jsx)(x.A,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:"New persona"})]})),K=c?`Edit persona — ${e.label}`:"New persona",Z=c?u?"Saving promotes this built-in to a user-owned row at the same id so your edits survive daemon restarts.":"Edit the worldview, recommended lineage, and system prompt.":"Personas are reusable worldviews that prepend to a doer or reviewer's prompt.";return(0,s.jsxs)(f.lG,{open:i,onOpenChange:R,children:[(0,s.jsx)(f.zM,{asChild:!0,children:B}),(0,s.jsxs)(f.Cf,{showCloseButton:!1,className:"flex max-h-[85vh] w-[min(96vw,720px)] flex-col gap-0 overflow-hidden border-border bg-card p-0 shadow-2xl sm:max-w-none",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 border-b border-border px-6 py-4",children:[(0,s.jsx)("div",{className:"grid h-9 w-9 shrink-0 place-items-center rounded-md bg-primary/15 text-primary ring-1 ring-primary/20",children:(0,s.jsx)(h.A,{className:"h-4 w-4"})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)(f.L3,{className:"text-[15px] font-semibold leading-tight tracking-tight",children:K}),(0,s.jsx)(f.rr,{className:"mt-0.5 text-xs text-muted-foreground",children:Z})]}),(0,s.jsx)("button",{type:"button",onClick:()=>R(!1),className:"grid h-7 w-7 place-items-center rounded-md text-muted-foreground transition hover:bg-accent hover:text-foreground","aria-label":"Close",children:(0,s.jsx)(b.A,{className:"h-4 w-4"})})]}),(0,s.jsx)(S,{form:p,setField:function(e,t){v(r=>{let s={...r,[e]:t};return"label"!==e||q||c||(s.id=_(String(t))),s})},setIdDirty:I,isEdit:c,isBuiltin:u,issues:L}),(0,s.jsx)($,{saveError:z,issues:L,valid:F,saving:y,deleting:N,confirmingDelete:A,canSave:W,isEdit:c,isBuiltin:u,onCancel:()=>R(!1),onSave:T,onDelete:V})]})]})}function D(){let[e,t]=(0,n.useState)([]),[r,x]=(0,n.useState)(null),[h,b]=(0,n.useState)(""),[f,v]=(0,n.useState)(null),[y,w]=(0,n.useState)(!1),[N,k]=(0,n.useState)(0),[_,C]=(0,n.useState)(null),[S,A]=(0,n.useState)(null),[$,D]=(0,n.useState)(null),[z,M]=(0,n.useState)(null),[q,I]=(0,n.useState)(null),[O,L]=(0,n.useState)(null),F=(0,n.useCallback)(async e=>{try{let r=[...await (0,g.UT)()].sort((e,t)=>e.builtin!==t.builtin?e.builtin?-1:1:e.label.localeCompare(t.label));t(r),e&&r.find(t=>t.id===e)?b(e):r.length>0?b(e=>r.find(t=>t.id===e)?e:r[0].id):b(""),k(e=>e+1)}catch(e){x(e instanceof g.$v?e.message:"Failed to load personas")}},[]);async function P(e){if(!q&&!e.builtin){if(z!==e.id){M(e.id),L(null),setTimeout(()=>{M(t=>t===e.id?null:t)},8e3);return}I(e.id),L(null);try{await (0,g.K7)(e.id),M(null),await F()}catch(e){L(e instanceof g.$v||e instanceof Error?e.message:"Delete failed (unknown error)"),M(null)}finally{I(null)}}}async function R(t){if(!S){A(t.id),D(null);try{let r=t.system_prompt&&t.system_prompt.length>0?t:await (0,g.dW)(t.id),s=new Set(e.map(e=>e.id)),n=function({sourceId:e,taken:t,maxAttempts:r=100,uniqueSuffix:s=Date.now}){let n=`${e}-copy`;if(!t.has(n))return n;for(let e=2;e<r;e++){let r=`${n}-${e}`;if(!t.has(r))return r}return`${n}-${s()}`}({sourceId:t.id,taken:s}),a=await (0,g.qI)({id:n,label:`${r.label} (copy)`,one_liner:r.one_liner,system_prompt:r.system_prompt??"",recommended_lineage:r.recommended_lineage??null,forked_from:r.forked_from??r.id});C(a.id),await F(a.id)}catch(e){D(e instanceof g.$v||e instanceof Error?e.message:"Duplicate failed (unknown error)")}finally{A(null)}}}return((0,n.useEffect)(()=>{F()},[F]),(0,n.useEffect)(()=>{if(!h)return void v(null);let e=!1;return w(!0),(0,g.dW)(h).then(t=>{e||v(t)}).catch(()=>{e||v(null)}).finally(()=>{e||w(!1)}),()=>{e=!0}},[h,N]),r)?(0,s.jsx)(o.G,{children:(0,s.jsx)("div",{className:"mx-auto w-full max-w-6xl px-4 py-6 sm:px-6 sm:py-8 md:px-8 md:py-10",children:(0,s.jsxs)("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4",children:[(0,s.jsx)("p",{className:"text-sm text-destructive",children:"Error loading personas"}),(0,s.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:r})]})})}):(0,s.jsx)(o.G,{children:(0,s.jsxs)("div",{className:"mx-auto w-full max-w-6xl px-4 py-6 sm:px-6 sm:py-8 md:px-8 md:py-10",children:[(0,s.jsx)(m.z,{eyebrow:"Personas",title:"Reviewer worldviews",subtitle:(0,s.jsxs)(s.Fragment,{children:["Each persona is a set of instructions that teaches the same model to look for different things. Same Claude or Codex, different worldview, wildly different findings. Use any of them via the"," ",(0,s.jsx)("code",{className:"font-mono text-foreground/80",children:"invoke_persona"})," MCP tool from inside Claude Code, Cursor, Codex, or any editor with chorus wired up."]}),action:(0,s.jsx)(E,{onSaved:e=>F(e)})}),$&&(0,s.jsxs)("div",{className:"mb-4 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:["Duplicate failed: ",$]}),O&&(0,s.jsxs)("div",{className:"mb-4 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:["Delete failed: ",O]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-[1fr_1.2fr]",children:[(0,s.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[e.map(e=>{let t=e.id===h;return(0,s.jsxs)("div",{role:"button",tabIndex:0,onClick:()=>b(e.id),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),b(e.id))},className:`group relative cursor-pointer rounded-xl text-left transition focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/60 ${t?"ring-2 ring-primary/60 ring-offset-2 ring-offset-background":""}`,children:[(0,s.jsx)(c.Zp,{className:"bg-card p-4 transition group-hover:border-muted-foreground/30",children:(0,s.jsx)("div",{className:"flex items-start justify-between gap-3",children:(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)("span",{className:"text-sm font-semibold",children:e.label}),e.builtin?(0,s.jsx)(u.E,{variant:"outline",className:"border-border text-[10px]",children:"built-in"}):(0,s.jsx)(u.E,{className:"bg-primary/15 text-[10px] text-primary",children:"user"}),e.recommended_lineage&&(0,s.jsxs)("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[(0,s.jsx)("span",{className:`h-1.5 w-1.5 rounded-full ${(0,j.VW)(e.recommended_lineage)}`}),(0,j.QJ)(e.recommended_lineage)]})]}),(0,s.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:e.one_liner}),(0,s.jsxs)("p",{className:"mt-1 font-mono text-[10px] text-muted-foreground/70",children:["id: ",e.id]})]})})}),(0,s.jsxs)("div",{className:`absolute bottom-3 right-3 flex items-center gap-1.5 transition ${t?"opacity-100":"opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"}`,onClick:t=>{t.stopPropagation(),b(e.id)},onKeyDown:e=>e.stopPropagation(),children:[(0,s.jsx)("button",{type:"button","aria-label":`Duplicate persona ${e.label}`,title:"Duplicate",disabled:S===e.id,onClick:()=>R(e),className:"grid h-7 w-7 place-items-center rounded-md border border-border bg-card text-muted-foreground transition hover:border-muted-foreground/40 hover:bg-accent/60 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",children:S===e.id?(0,s.jsx)(a.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(l,{className:"h-3.5 w-3.5"})}),!e.builtin&&(0,s.jsx)("button",{type:"button","aria-label":z===e.id?`Confirm delete persona ${e.label}`:`Delete persona ${e.label}`,title:z===e.id?"Click again to confirm":"Delete",disabled:q===e.id,onClick:()=>P(e),className:`grid h-7 w-7 place-items-center rounded-md border transition disabled:cursor-not-allowed disabled:opacity-50 ${z===e.id?"border-destructive bg-destructive/15 text-destructive":"border-border bg-card text-muted-foreground hover:border-destructive/50 hover:text-destructive"}`,children:q===e.id?(0,s.jsx)(a.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(i.A,{className:"h-3.5 w-3.5"})}),f&&f.id===e.id?(0,s.jsx)(E,{editing:f,defaultOpen:_===e.id,onSaved:t=>{_===e.id&&C(null),F(t)},onDeleted:()=>{_===e.id&&C(null),F()}},`${e.id}:${_===e.id?"auto":"manual"}`):(0,s.jsx)("button",{type:"button","aria-label":`Edit persona ${e.label}`,title:"Edit",onClick:()=>{b(e.id),C(e.id)},className:"grid h-7 w-7 place-items-center rounded-md border border-border bg-card text-muted-foreground transition hover:border-muted-foreground/40 hover:bg-accent/60 hover:text-foreground",children:(0,s.jsx)(d.A,{className:"h-3.5 w-3.5"})})]})]},e.id)}),0===e.length&&(0,s.jsx)(c.Zp,{className:"bg-card p-4 text-center text-sm text-muted-foreground",children:"No personas yet. Daemon may still be seeding — refresh in a second."})]}),f?(0,s.jsx)(p.N,{filename:`${f.id}.md`,charCount:f.system_prompt?.length??0,footer:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("span",{children:["Invoke via"," ",(0,s.jsxs)("code",{className:"rounded bg-muted/40 px-1 font-mono text-[10px] text-foreground/80",children:["invoke_persona(",`{ personaId: "${f.id}" }`,")"]})]}),f.builtin&&(0,s.jsxs)("span",{children:["edit at"," ",(0,s.jsxs)("code",{className:"font-mono text-[10px]",children:["prompts/personas/",f.id,".md"]})]})]}),children:f.system_prompt??""}):y?(0,s.jsx)(c.Zp,{className:"bg-card p-4 text-center text-muted-foreground",children:(0,s.jsx)("p",{className:"text-sm",children:"Loading persona…"})}):(0,s.jsx)(c.Zp,{className:"bg-card p-4 text-center text-muted-foreground",children:(0,s.jsx)("p",{className:"text-sm",children:"Select a persona to view its prompt."})})]})]})})}},6458:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]])},8420:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]])},9056:(e,t,r)=>{"use strict";r.d(t,{F:()=>l});var s=r(142);let n=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,a=s.$,l=(e,t)=>r=>{var s;if((null==t?void 0:t.variants)==null)return a(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:l,defaultVariants:i}=t,d=Object.keys(l).map(e=>{let t=null==r?void 0:r[e],s=null==i?void 0:i[e];if(null===t)return null;let a=n(t)||n(s);return l[e][a]}),o=r&&Object.entries(r).reduce((e,t)=>{let[r,s]=t;return void 0===s||(e[r]=s),e},{});return a(e,d,null==t||null==(s=t.compoundVariants)?void 0:s.reduce((e,t)=>{let{class:r,className:s,...n}=t;return Object.entries(n).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...i,...o}[t]):({...i,...o})[t]===r})?[...e,r,s]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}},9208:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("code-xml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]])}},e=>{e.O(0,[116,720,641,344,744,506,128,358],()=>e(e.s=4696)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[406],{2956:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]])},3149:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},4030:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("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"}]])},4052:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]])},4696:(e,t,r)=>{Promise.resolve().then(r.bind(r,5921))},5921:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>D});var s=r(9442),n=r(6074),a=r(3149);let l=(0,r(3884).A)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);var i=r(8420),d=r(4052),o=r(4372),c=r(63),u=r(5702),m=r(6457),p=r(8191),x=r(9315),h=r(6458),b=r(6891),f=r(1853),g=r(6185),v=r(4030),y=r(7362),j=r(3734);let w=/^[a-z0-9][a-z0-9-]{1,63}$/,N=[{value:"",label:"No preference"},{value:"anthropic",label:j.ze.anthropic},{value:"openai",label:j.ze.openai},{value:"google",label:j.ze.google},{value:"opencode",label:j.ze.opencode},{value:"moonshot",label:j.ze.moonshot}],k={id:"",label:"",one_liner:"",recommended_lineage:"",system_prompt:"# Worldview\n\nDescribe the lens this persona uses to read code and findings.\n\n# What you look for\n\n- ...\n- ...\n\n# Tone\n\nHow the persona writes — terse, exhaustive, contrarian, etc.\n"};function _(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64)}function C({label:e,hint:t,issue:r,span2:n,children:a}){return(0,s.jsxs)("label",{className:(0,y.cn)("flex flex-col gap-1",n&&"sm:col-span-2"),children:[(0,s.jsxs)("span",{className:"flex items-baseline justify-between gap-2",children:[(0,s.jsx)("span",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:e}),t&&(0,s.jsx)("span",{className:"text-[10px] text-muted-foreground/70",children:t})]}),a,r&&(0,s.jsx)("span",{className:"text-[10px] text-destructive",children:r.message})]})}function S({form:e,setField:t,setIdDirty:r,isEdit:n,isBuiltin:a,issues:l}){return(0,s.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 py-5",children:[n&&a&&(0,s.jsx)("div",{className:"mb-4 rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-2 text-[11px] text-amber-200",children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(v.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),(0,s.jsx)("div",{children:"Built-in persona. Saving demotes it to a user copy so the boot-time seed leaves it alone — you'll no longer receive upstream updates for this id."})]})}),(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:[(0,s.jsx)(C,{label:"Label",hint:"Human-friendly name shown in the picker",issue:l.find(e=>"label"===e.field),children:(0,s.jsx)("input",{type:"text",value:e.label,onChange:e=>t("label",e.target.value),placeholder:"Security Skeptic",className:"h-9 w-full rounded-md border border-border bg-background px-3 text-sm outline-none transition focus:border-primary/60"})}),(0,s.jsx)(C,{label:"ID",hint:n?"Locked once created":"Lowercase, dashes — auto-derived from label",issue:l.find(e=>"id"===e.field),children:(0,s.jsx)("input",{type:"text",value:e.id,disabled:n,onChange:e=>{r(!0),t("id",e.target.value)},placeholder:"security-skeptic",className:(0,y.cn)("h-9 w-full rounded-md border border-border bg-background px-3 font-mono text-sm outline-none transition focus:border-primary/60",n&&"cursor-not-allowed opacity-60")})}),(0,s.jsx)(C,{label:"One-liner",hint:"Shown under the label in the persona list",issue:l.find(e=>"one_liner"===e.field),span2:!0,children:(0,s.jsx)("input",{type:"text",value:e.one_liner,onChange:e=>t("one_liner",e.target.value),placeholder:"Reads every diff like an attacker.",className:"h-9 w-full rounded-md border border-border bg-background px-3 text-sm outline-none transition focus:border-primary/60"})}),(0,s.jsx)(C,{label:"Recommended lineage",hint:"Optional — pickers can default to this CLI",span2:!0,children:(0,s.jsx)("select",{value:e.recommended_lineage,onChange:e=>t("recommended_lineage",e.target.value),className:"h-9 w-full rounded-md border border-border bg-background px-3 text-sm outline-none transition focus:border-primary/60",children:N.map(e=>(0,s.jsx)("option",{value:e.value,children:e.label},e.value))})})]}),(0,s.jsx)("div",{className:"mt-5",children:(0,s.jsx)(C,{label:"System prompt",hint:"Prepended to the doer / reviewer ask at run time. Markdown.",issue:l.find(e=>"system_prompt"===e.field),children:(0,s.jsx)("textarea",{value:e.system_prompt,onChange:e=>t("system_prompt",e.target.value),spellCheck:!1,className:"min-h-[280px] w-full rounded-md border border-border bg-background px-3 py-2 font-mono text-[12px] leading-relaxed outline-none transition focus:border-primary/60"})})})]})}var A=r(2956);function $({saveError:e,issues:t,valid:r,saving:n,deleting:l,confirmingDelete:d,canSave:o,isEdit:c,isBuiltin:u,onCancel:m,onSave:p,onDelete:x}){return(0,s.jsxs)("div",{className:"flex flex-col gap-2 border-t border-border bg-card/40 px-6 py-3",children:[e&&(0,s.jsx)("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:(0,s.jsxs)("div",{className:"flex items-start gap-1.5",children:[(0,s.jsx)(v.A,{className:"mt-0.5 h-3 w-3 shrink-0"}),(0,s.jsx)("div",{className:"flex-1 leading-snug",children:e})]})}),(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:r?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(A.A,{className:"h-3 w-3 text-emerald-400"}),(0,s.jsx)("span",{children:"Ready to save"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(v.A,{className:"h-3 w-3 text-destructive/80"}),(0,s.jsxs)("span",{children:[t.length," ",1===t.length?"issue":"issues"," to resolve"]})]})}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[c&&!u&&(0,s.jsxs)("button",{type:"button",onClick:x,disabled:l||n,className:(0,y.cn)("inline-flex h-9 items-center gap-1.5 rounded-md border px-3 text-sm font-medium transition",d?"border-destructive bg-destructive/15 text-destructive hover:bg-destructive/25":"border-border bg-card text-muted-foreground hover:border-destructive/50 hover:text-destructive"),children:[l?(0,s.jsx)(a.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(i.A,{className:"h-3.5 w-3.5"}),l?"Deleting…":d?"Click again to confirm":"Delete"]}),(0,s.jsx)("button",{type:"button",onClick:m,className:"h-9 rounded-md border border-border bg-card px-4 text-sm font-medium text-muted-foreground transition hover:border-muted-foreground/30 hover:text-foreground",children:"Cancel"}),(0,s.jsxs)("button",{type:"button",disabled:!o,onClick:p,className:(0,y.cn)("inline-flex h-9 items-center gap-1.5 rounded-md px-4 text-sm font-medium shadow-sm transition",o?"bg-primary text-primary-foreground hover:bg-primary/90":"cursor-not-allowed bg-muted text-muted-foreground/60 shadow-none"),children:[n&&(0,s.jsx)(a.A,{className:"h-3.5 w-3.5 animate-spin"}),n?"Saving…":c?"Save changes":"Save persona"]})]})]})]})}function E({editing:e,trigger:t,onSaved:r,onDeleted:a,defaultOpen:l}){let[i,o]=(0,n.useState)(!!l),c=!!e,u=!!e?.builtin,m=(0,n.useMemo)(()=>e?{id:e.id,label:e.label,one_liner:e.one_liner,recommended_lineage:e.recommended_lineage??"",system_prompt:e.system_prompt??""}:k,[e?.id,e?.updated_at]),[p,v]=(0,n.useState)(m),[y,j]=(0,n.useState)(!1),[N,C]=(0,n.useState)(!1),[A,D]=(0,n.useState)(!1),[z,M]=(0,n.useState)(null),[q,I]=(0,n.useState)(c);(0,n.useEffect)(()=>{v(m),M(null),D(!1),I(c)},[m,c]);let O=(0,n.useRef)(m);(0,n.useEffect)(()=>{O.current=m});let L=(0,n.useMemo)(()=>{let e,t;return e=[],(t=c?p.id:p.id||_(p.label))?w.test(t)||e.push({field:"id",message:"id must be lowercase letters, numbers, dashes (2–64 chars)"}):e.push({field:"id",message:"id is required"}),p.label.trim()||e.push({field:"label",message:"label is required"}),p.one_liner.trim()||e.push({field:"one_liner",message:"one-liner is required"}),p.system_prompt.trim()||e.push({field:"system_prompt",message:"system prompt is required"}),e},[p,c]),F=0===L.length;function P(){v(O.current),j(!1),C(!1),M(null),D(!1),I(c)}function R(e){o(e),e||setTimeout(P,200)}async function T(){if(!F||y)return;let t=c?e.id:p.id||_(p.label);j(!0),M(null);try{let e=await (0,g.qI)({id:t,label:p.label.trim(),one_liner:p.one_liner.trim(),system_prompt:p.system_prompt,recommended_lineage:p.recommended_lineage||null});r?.(e.id),R(!1)}catch(e){M(e instanceof g.$v||e instanceof Error?e.message:"Save failed (unknown error)")}finally{j(!1)}}async function V(){if(e&&!u&&!N){if(!A){D(!0),setTimeout(()=>D(e=>!e&&e),8e3);return}C(!0),M(null);try{await (0,g.K7)(e.id),a?.(e.id),R(!1)}catch(e){M(e instanceof g.$v||e instanceof Error?e.message:"Delete failed (unknown error)"),D(!1)}finally{C(!1)}}}let W=F&&!y&&!N,B=t??(c?(0,s.jsx)("button",{type:"button","aria-label":`Edit persona ${e.label}`,className:"grid h-7 w-7 place-items-center rounded-md border border-border bg-card text-muted-foreground transition hover:border-muted-foreground/40 hover:bg-accent/60 hover:text-foreground",children:(0,s.jsx)(d.A,{className:"h-3.5 w-3.5"})}):(0,s.jsxs)("button",{type:"button","aria-label":"New persona",className:"inline-flex shrink-0 items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-primary-foreground shadow-sm transition hover:bg-primary/90",children:[(0,s.jsx)(x.A,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:"New persona"})]})),K=c?`Edit persona — ${e.label}`:"New persona",Z=c?u?"Saving promotes this built-in to a user-owned row at the same id so your edits survive daemon restarts.":"Edit the worldview, recommended lineage, and system prompt.":"Personas are reusable worldviews that prepend to a doer or reviewer's prompt.";return(0,s.jsxs)(f.lG,{open:i,onOpenChange:R,children:[(0,s.jsx)(f.zM,{asChild:!0,children:B}),(0,s.jsxs)(f.Cf,{showCloseButton:!1,className:"flex max-h-[85vh] w-[min(96vw,720px)] flex-col gap-0 overflow-hidden border-border bg-card p-0 shadow-2xl sm:max-w-none",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 border-b border-border px-6 py-4",children:[(0,s.jsx)("div",{className:"grid h-9 w-9 shrink-0 place-items-center rounded-md bg-primary/15 text-primary ring-1 ring-primary/20",children:(0,s.jsx)(h.A,{className:"h-4 w-4"})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)(f.L3,{className:"text-[15px] font-semibold leading-tight tracking-tight",children:K}),(0,s.jsx)(f.rr,{className:"mt-0.5 text-xs text-muted-foreground",children:Z})]}),(0,s.jsx)("button",{type:"button",onClick:()=>R(!1),className:"grid h-7 w-7 place-items-center rounded-md text-muted-foreground transition hover:bg-accent hover:text-foreground","aria-label":"Close",children:(0,s.jsx)(b.A,{className:"h-4 w-4"})})]}),(0,s.jsx)(S,{form:p,setField:function(e,t){v(r=>{let s={...r,[e]:t};return"label"!==e||q||c||(s.id=_(String(t))),s})},setIdDirty:I,isEdit:c,isBuiltin:u,issues:L}),(0,s.jsx)($,{saveError:z,issues:L,valid:F,saving:y,deleting:N,confirmingDelete:A,canSave:W,isEdit:c,isBuiltin:u,onCancel:()=>R(!1),onSave:T,onDelete:V})]})]})}function D(){let[e,t]=(0,n.useState)([]),[r,x]=(0,n.useState)(null),[h,b]=(0,n.useState)(""),[f,v]=(0,n.useState)(null),[y,w]=(0,n.useState)(!1),[N,k]=(0,n.useState)(0),[_,C]=(0,n.useState)(null),[S,A]=(0,n.useState)(null),[$,D]=(0,n.useState)(null),[z,M]=(0,n.useState)(null),[q,I]=(0,n.useState)(null),[O,L]=(0,n.useState)(null),F=(0,n.useCallback)(async e=>{try{let r=[...await (0,g.UT)()].sort((e,t)=>e.builtin!==t.builtin?e.builtin?-1:1:e.label.localeCompare(t.label));t(r),e&&r.find(t=>t.id===e)?b(e):r.length>0?b(e=>r.find(t=>t.id===e)?e:r[0].id):b(""),k(e=>e+1)}catch(e){x(e instanceof g.$v?e.message:"Failed to load personas")}},[]);async function P(e){if(!q&&!e.builtin){if(z!==e.id){M(e.id),L(null),setTimeout(()=>{M(t=>t===e.id?null:t)},8e3);return}I(e.id),L(null);try{await (0,g.K7)(e.id),M(null),await F()}catch(e){L(e instanceof g.$v||e instanceof Error?e.message:"Delete failed (unknown error)"),M(null)}finally{I(null)}}}async function R(t){if(!S){A(t.id),D(null);try{let r=t.system_prompt&&t.system_prompt.length>0?t:await (0,g.dW)(t.id),s=new Set(e.map(e=>e.id)),n=function({sourceId:e,taken:t,maxAttempts:r=100,uniqueSuffix:s=Date.now}){let n=`${e}-copy`;if(!t.has(n))return n;for(let e=2;e<r;e++){let r=`${n}-${e}`;if(!t.has(r))return r}return`${n}-${s()}`}({sourceId:t.id,taken:s}),a=await (0,g.qI)({id:n,label:`${r.label} (copy)`,one_liner:r.one_liner,system_prompt:r.system_prompt??"",recommended_lineage:r.recommended_lineage??null,forked_from:r.forked_from??r.id});C(a.id),await F(a.id)}catch(e){D(e instanceof g.$v||e instanceof Error?e.message:"Duplicate failed (unknown error)")}finally{A(null)}}}return((0,n.useEffect)(()=>{F()},[F]),(0,n.useEffect)(()=>{if(!h)return void v(null);let e=!1;return w(!0),(0,g.dW)(h).then(t=>{e||v(t)}).catch(()=>{e||v(null)}).finally(()=>{e||w(!1)}),()=>{e=!0}},[h,N]),r)?(0,s.jsx)(o.G,{children:(0,s.jsx)("div",{className:"mx-auto w-full max-w-6xl px-4 py-6 sm:px-6 sm:py-8 md:px-8 md:py-10",children:(0,s.jsxs)("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-4",children:[(0,s.jsx)("p",{className:"text-sm text-destructive",children:"Error loading personas"}),(0,s.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:r})]})})}):(0,s.jsx)(o.G,{children:(0,s.jsxs)("div",{className:"mx-auto w-full max-w-6xl px-4 py-6 sm:px-6 sm:py-8 md:px-8 md:py-10",children:[(0,s.jsx)(m.z,{eyebrow:"Personas",title:"Reviewer worldviews",subtitle:(0,s.jsxs)(s.Fragment,{children:["Each persona is a set of instructions that teaches the same model to look for different things. Same Claude or Codex, different worldview, wildly different findings. Use any of them via the"," ",(0,s.jsx)("code",{className:"font-mono text-foreground/80",children:"invoke_persona"})," MCP tool from inside Claude Code, Cursor, Codex, or any editor with chorus wired up."]}),action:(0,s.jsx)(E,{onSaved:e=>F(e)})}),$&&(0,s.jsxs)("div",{className:"mb-4 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:["Duplicate failed: ",$]}),O&&(0,s.jsxs)("div",{className:"mb-4 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:["Delete failed: ",O]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-[1fr_1.2fr]",children:[(0,s.jsxs)("div",{className:"flex min-w-0 flex-col gap-2",children:[e.map(e=>{let t=e.id===h;return(0,s.jsxs)("div",{role:"button",tabIndex:0,onClick:()=>b(e.id),onKeyDown:t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),b(e.id))},className:`group relative cursor-pointer rounded-xl text-left transition focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/60 ${t?"ring-2 ring-primary/60 ring-offset-2 ring-offset-background":""}`,children:[(0,s.jsx)(c.Zp,{className:"bg-card p-4 transition group-hover:border-muted-foreground/30",children:(0,s.jsx)("div",{className:"flex items-start justify-between gap-3",children:(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)("span",{className:"text-sm font-semibold",children:e.label}),e.builtin?(0,s.jsx)(u.E,{variant:"outline",className:"border-border text-[10px]",children:"built-in"}):(0,s.jsx)(u.E,{className:"bg-primary/15 text-[10px] text-primary",children:"user"}),e.recommended_lineage&&(0,s.jsxs)("span",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:[(0,s.jsx)("span",{className:`h-1.5 w-1.5 rounded-full ${(0,j.VW)(e.recommended_lineage)}`}),(0,j.QJ)(e.recommended_lineage)]})]}),(0,s.jsx)("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:e.one_liner}),(0,s.jsxs)("p",{className:"mt-1 font-mono text-[10px] text-muted-foreground/70",children:["id: ",e.id]})]})})}),(0,s.jsxs)("div",{className:`absolute bottom-3 right-3 flex items-center gap-1.5 transition ${t?"opacity-100":"opacity-0 group-hover:opacity-100 group-focus-within:opacity-100"}`,onClick:t=>{t.stopPropagation(),b(e.id)},onKeyDown:e=>e.stopPropagation(),children:[(0,s.jsx)("button",{type:"button","aria-label":`Duplicate persona ${e.label}`,title:"Duplicate",disabled:S===e.id,onClick:()=>R(e),className:"grid h-7 w-7 place-items-center rounded-md border border-border bg-card text-muted-foreground transition hover:border-muted-foreground/40 hover:bg-accent/60 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",children:S===e.id?(0,s.jsx)(a.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(l,{className:"h-3.5 w-3.5"})}),!e.builtin&&(0,s.jsx)("button",{type:"button","aria-label":z===e.id?`Confirm delete persona ${e.label}`:`Delete persona ${e.label}`,title:z===e.id?"Click again to confirm":"Delete",disabled:q===e.id,onClick:()=>P(e),className:`grid h-7 w-7 place-items-center rounded-md border transition disabled:cursor-not-allowed disabled:opacity-50 ${z===e.id?"border-destructive bg-destructive/15 text-destructive":"border-border bg-card text-muted-foreground hover:border-destructive/50 hover:text-destructive"}`,children:q===e.id?(0,s.jsx)(a.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,s.jsx)(i.A,{className:"h-3.5 w-3.5"})}),f&&f.id===e.id?(0,s.jsx)(E,{editing:f,defaultOpen:_===e.id,onSaved:t=>{_===e.id&&C(null),F(t)},onDeleted:()=>{_===e.id&&C(null),F()}},`${e.id}:${_===e.id?"auto":"manual"}`):(0,s.jsx)("button",{type:"button","aria-label":`Edit persona ${e.label}`,title:"Edit",onClick:()=>{b(e.id),C(e.id)},className:"grid h-7 w-7 place-items-center rounded-md border border-border bg-card text-muted-foreground transition hover:border-muted-foreground/40 hover:bg-accent/60 hover:text-foreground",children:(0,s.jsx)(d.A,{className:"h-3.5 w-3.5"})})]})]},e.id)}),0===e.length&&(0,s.jsx)(c.Zp,{className:"bg-card p-4 text-center text-sm text-muted-foreground",children:"No personas yet. Daemon may still be seeding — refresh in a second."})]}),f?(0,s.jsx)(p.N,{filename:`${f.id}.md`,charCount:f.system_prompt?.length??0,footer:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("span",{children:["Invoke via"," ",(0,s.jsxs)("code",{className:"rounded bg-muted/40 px-1 font-mono text-[10px] text-foreground/80",children:["invoke_persona(",`{ personaId: "${f.id}" }`,")"]})]}),f.builtin&&(0,s.jsxs)("span",{children:["edit at"," ",(0,s.jsxs)("code",{className:"font-mono text-[10px]",children:["prompts/personas/",f.id,".md"]})]})]}),children:f.system_prompt??""}):y?(0,s.jsx)(c.Zp,{className:"bg-card p-4 text-center text-muted-foreground",children:(0,s.jsx)("p",{className:"text-sm",children:"Loading persona…"})}):(0,s.jsx)(c.Zp,{className:"bg-card p-4 text-center text-muted-foreground",children:(0,s.jsx)("p",{className:"text-sm",children:"Select a persona to view its prompt."})})]})]})})}},6458:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]])},8420:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]])},9056:(e,t,r)=>{"use strict";r.d(t,{F:()=>l});var s=r(142);let n=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,a=s.$,l=(e,t)=>r=>{var s;if((null==t?void 0:t.variants)==null)return a(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:l,defaultVariants:i}=t,d=Object.keys(l).map(e=>{let t=null==r?void 0:r[e],s=null==i?void 0:i[e];if(null===t)return null;let a=n(t)||n(s);return l[e][a]}),o=r&&Object.entries(r).reduce((e,t)=>{let[r,s]=t;return void 0===s||(e[r]=s),e},{});return a(e,d,null==t||null==(s=t.compoundVariants)?void 0:s.reduce((e,t)=>{let{class:r,className:s,...n}=t;return Object.entries(n).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...i,...o}[t]):({...i,...o})[t]===r})?[...e,r,s]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}},9208:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("code-xml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]])}},e=>{e.O(0,[116,832,641,344,744,506,128,358],()=>e(e.s=4696)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[308],{4720:(e,s,n)=>{Promise.resolve().then(n.bind(n,821)),Promise.resolve().then(n.bind(n,1245)),Promise.resolve().then(n.bind(n,8344))}},e=>{e.O(0,[116,720,641,344,245,506,128,358],()=>e(e.s=4720)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[308],{4720:(e,s,n)=>{Promise.resolve().then(n.bind(n,821)),Promise.resolve().then(n.bind(n,1245)),Promise.resolve().then(n.bind(n,8344))}},e=>{e.O(0,[116,832,641,344,245,506,128,358],()=>e(e.s=4720)),_N_E=e.O()}]);
@@ -1 +1 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[529],{1240:(e,r,t)=>{Promise.resolve().then(t.bind(t,821)),Promise.resolve().then(t.bind(t,8344)),Promise.resolve().then(t.bind(t,2897))},2897:(e,r,t)=>{"use strict";t.d(r,{RunsTable:()=>c});var s=t(9442),a=t(9812),n=t(6891),o=t(2573),l=t.n(o),d=t(6074),i=t(5702),u=t(7296);function c({chats:e}){let[r,t]=(0,d.useState)(""),[o,m]=(0,d.useState)(""),[x,b]=(0,d.useState)(""),v=(0,d.useMemo)(()=>{let r=new Set;for(let t of e)r.add(t.templateId);return Array.from(r).sort()},[e]),g=(0,d.useMemo)(()=>{let r=new Set;for(let t of e)r.add(t.status);return Array.from(r).sort()},[e]),h=(0,d.useMemo)(()=>{let t=r.trim().toLowerCase();return e.filter(e=>(!o||e.templateId===o)&&(!x||e.status===x)&&(!t||(0,u.t)(e.work).toLowerCase().includes(t)||e.work.toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||(e.slug??"").toLowerCase().includes(t)))},[e,r,o,x]),f=!!(r||o||x);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-center",children:[(0,s.jsxs)("div",{className:"relative flex-1",children:[(0,s.jsx)(a.A,{className:"pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),(0,s.jsx)("input",{type:"search",value:r,onChange:e=>t(e.target.value),placeholder:"Search by title, work, chat id, or slug…",className:"w-full rounded-md border border-border bg-card py-2 pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground focus:border-primary/40 focus:outline-none"})]}),(0,s.jsxs)("select",{value:o,onChange:e=>m(e.target.value),className:"rounded-md border border-border bg-card px-3 py-2 text-sm text-foreground focus:border-primary/40 focus:outline-none","aria-label":"Filter by template",children:[(0,s.jsx)("option",{value:"",children:"All templates"}),v.map(e=>(0,s.jsx)("option",{value:e,children:e},e))]}),(0,s.jsxs)("select",{value:x,onChange:e=>b(e.target.value),className:"rounded-md border border-border bg-card px-3 py-2 text-sm text-foreground focus:border-primary/40 focus:outline-none","aria-label":"Filter by status",children:[(0,s.jsx)("option",{value:"",children:"All statuses"}),g.map(e=>(0,s.jsx)("option",{value:e,children:e},e))]}),f&&(0,s.jsxs)("button",{type:"button",onClick:()=>{t(""),m(""),b("")},className:"flex items-center gap-1 rounded-md border border-border bg-card px-3 py-2 text-xs text-muted-foreground transition hover:border-destructive/40 hover:text-destructive",children:[(0,s.jsx)(n.A,{className:"h-3 w-3"}),"Clear"]})]}),(0,s.jsx)("p",{className:"mb-3 text-xs text-muted-foreground",children:h.length===e.length?`${e.length} chat${1===e.length?"":"s"}`:`${h.length} of ${e.length} chat${1===e.length?"":"s"}`}),(0,s.jsx)("div",{className:"space-y-2",children:0===h.length?(0,s.jsx)("div",{className:"rounded-lg border border-border bg-card/30 p-8 text-center",children:(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:f?"No chats match these filters.":"No chats yet. Start a new one!"})}):h.map(e=>(0,s.jsx)(l(),{href:`/runs/${e.slug||e.id}`,className:"group flex items-start justify-between gap-4 rounded-lg border border-border bg-card p-4 transition hover:border-muted-foreground/30 hover:bg-card/80",children:(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"mb-1 flex items-center gap-2",children:[(0,s.jsx)("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:e.status}),(0,s.jsx)(i.E,{variant:"outline",className:"border-border font-mono text-[10px]",children:e.templateId})]}),(0,s.jsx)("h3",{className:"line-clamp-1 text-sm font-medium text-foreground",children:(0,u.t)(e.work)}),(0,s.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:new Date(e.createdAt).toLocaleString()})]})},e.id))})]})}},5702:(e,r,t)=>{"use strict";t.d(r,{E:()=>d});var s=t(9442);t(6074);var a=t(9056),n=t(8113),o=t(7362);let l=(0,a.F)("inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function d({className:e,variant:r="default",asChild:t=!1,...a}){let i=t?n.bL:"span";return(0,s.jsx)(i,{"data-slot":"badge","data-variant":r,className:(0,o.cn)(l({variant:r}),e),...a})}},9056:(e,r,t)=>{"use strict";t.d(r,{F:()=>o});var s=t(142);let a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,n=s.$,o=(e,r)=>t=>{var s;if((null==r?void 0:r.variants)==null)return n(e,null==t?void 0:t.class,null==t?void 0:t.className);let{variants:o,defaultVariants:l}=r,d=Object.keys(o).map(e=>{let r=null==t?void 0:t[e],s=null==l?void 0:l[e];if(null===r)return null;let n=a(r)||a(s);return o[e][n]}),i=t&&Object.entries(t).reduce((e,r)=>{let[t,s]=r;return void 0===s||(e[t]=s),e},{});return n(e,d,null==r||null==(s=r.compoundVariants)?void 0:s.reduce((e,r)=>{let{class:t,className:s,...a}=r;return Object.entries(a).every(e=>{let[r,t]=e;return Array.isArray(t)?t.includes({...l,...i}[r]):({...l,...i})[r]===t})?[...e,t,s]:e},[]),null==t?void 0:t.class,null==t?void 0:t.className)}},9812:(e,r,t)=>{"use strict";t.d(r,{A:()=>s});let s=(0,t(3884).A)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]])}},e=>{e.O(0,[116,720,641,344,506,128,358],()=>e(e.s=1240)),_N_E=e.O()}]);
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[529],{1240:(e,r,t)=>{Promise.resolve().then(t.bind(t,821)),Promise.resolve().then(t.bind(t,8344)),Promise.resolve().then(t.bind(t,2897))},2897:(e,r,t)=>{"use strict";t.d(r,{RunsTable:()=>c});var s=t(9442),a=t(9812),n=t(6891),o=t(2573),l=t.n(o),d=t(6074),i=t(5702),u=t(7296);function c({chats:e}){let[r,t]=(0,d.useState)(""),[o,m]=(0,d.useState)(""),[x,b]=(0,d.useState)(""),v=(0,d.useMemo)(()=>{let r=new Set;for(let t of e)r.add(t.templateId);return Array.from(r).sort()},[e]),g=(0,d.useMemo)(()=>{let r=new Set;for(let t of e)r.add(t.status);return Array.from(r).sort()},[e]),h=(0,d.useMemo)(()=>{let t=r.trim().toLowerCase();return e.filter(e=>(!o||e.templateId===o)&&(!x||e.status===x)&&(!t||(0,u.t)(e.work).toLowerCase().includes(t)||e.work.toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||(e.slug??"").toLowerCase().includes(t)))},[e,r,o,x]),f=!!(r||o||x);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"mb-4 flex flex-col gap-2 sm:flex-row sm:items-center",children:[(0,s.jsxs)("div",{className:"relative flex-1",children:[(0,s.jsx)(a.A,{className:"pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),(0,s.jsx)("input",{type:"search",value:r,onChange:e=>t(e.target.value),placeholder:"Search by title, work, chat id, or slug…",className:"w-full rounded-md border border-border bg-card py-2 pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground focus:border-primary/40 focus:outline-none"})]}),(0,s.jsxs)("select",{value:o,onChange:e=>m(e.target.value),className:"rounded-md border border-border bg-card px-3 py-2 text-sm text-foreground focus:border-primary/40 focus:outline-none","aria-label":"Filter by template",children:[(0,s.jsx)("option",{value:"",children:"All templates"}),v.map(e=>(0,s.jsx)("option",{value:e,children:e},e))]}),(0,s.jsxs)("select",{value:x,onChange:e=>b(e.target.value),className:"rounded-md border border-border bg-card px-3 py-2 text-sm text-foreground focus:border-primary/40 focus:outline-none","aria-label":"Filter by status",children:[(0,s.jsx)("option",{value:"",children:"All statuses"}),g.map(e=>(0,s.jsx)("option",{value:e,children:e},e))]}),f&&(0,s.jsxs)("button",{type:"button",onClick:()=>{t(""),m(""),b("")},className:"flex items-center gap-1 rounded-md border border-border bg-card px-3 py-2 text-xs text-muted-foreground transition hover:border-destructive/40 hover:text-destructive",children:[(0,s.jsx)(n.A,{className:"h-3 w-3"}),"Clear"]})]}),(0,s.jsx)("p",{className:"mb-3 text-xs text-muted-foreground",children:h.length===e.length?`${e.length} chat${1===e.length?"":"s"}`:`${h.length} of ${e.length} chat${1===e.length?"":"s"}`}),(0,s.jsx)("div",{className:"space-y-2",children:0===h.length?(0,s.jsx)("div",{className:"rounded-lg border border-border bg-card/30 p-8 text-center",children:(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:f?"No chats match these filters.":"No chats yet. Start a new one!"})}):h.map(e=>(0,s.jsx)(l(),{href:`/runs/${e.slug||e.id}`,className:"group flex items-start justify-between gap-4 rounded-lg border border-border bg-card p-4 transition hover:border-muted-foreground/30 hover:bg-card/80",children:(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"mb-1 flex items-center gap-2",children:[(0,s.jsx)("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:e.status}),(0,s.jsx)(i.E,{variant:"outline",className:"border-border font-mono text-[10px]",children:e.templateId})]}),(0,s.jsx)("h3",{className:"line-clamp-1 text-sm font-medium text-foreground",children:(0,u.t)(e.work)}),(0,s.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:new Date(e.createdAt).toLocaleString()})]})},e.id))})]})}},5702:(e,r,t)=>{"use strict";t.d(r,{E:()=>d});var s=t(9442);t(6074);var a=t(9056),n=t(8113),o=t(7362);let l=(0,a.F)("inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function d({className:e,variant:r="default",asChild:t=!1,...a}){let i=t?n.bL:"span";return(0,s.jsx)(i,{"data-slot":"badge","data-variant":r,className:(0,o.cn)(l({variant:r}),e),...a})}},9056:(e,r,t)=>{"use strict";t.d(r,{F:()=>o});var s=t(142);let a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,n=s.$,o=(e,r)=>t=>{var s;if((null==r?void 0:r.variants)==null)return n(e,null==t?void 0:t.class,null==t?void 0:t.className);let{variants:o,defaultVariants:l}=r,d=Object.keys(o).map(e=>{let r=null==t?void 0:t[e],s=null==l?void 0:l[e];if(null===r)return null;let n=a(r)||a(s);return o[e][n]}),i=t&&Object.entries(t).reduce((e,r)=>{let[t,s]=r;return void 0===s||(e[t]=s),e},{});return n(e,d,null==r||null==(s=r.compoundVariants)?void 0:s.reduce((e,r)=>{let{class:t,className:s,...a}=r;return Object.entries(a).every(e=>{let[r,t]=e;return Array.isArray(t)?t.includes({...l,...i}[r]):({...l,...i})[r]===t})?[...e,t,s]:e},[]),null==t?void 0:t.class,null==t?void 0:t.className)}},9812:(e,r,t)=>{"use strict";t.d(r,{A:()=>s});let s=(0,t(3884).A)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]])}},e=>{e.O(0,[116,832,641,344,506,128,358],()=>e(e.s=1240)),_N_E=e.O()}]);
@@ -22,4 +22,4 @@ defaults:
22
22
  notifications:
23
23
  mcp_enabled: ${e.mcpEnabled}
24
24
  webhook_url: ${e.webhookUrl?`"${e.webhookUrl}"`:'""'}
25
- `},[r,c,m,h,j,N,A,D,T]);return(0,s.jsx)(l.G,{children:(0,s.jsxs)("div",{className:"mx-auto w-full max-w-6xl px-4 py-6 sm:px-6 sm:py-8 md:px-8 md:py-10",children:[(0,s.jsx)(i.z,{eyebrow:"Settings",title:"Workspace",subtitle:"Defaults applied to every chat. Templates can override these per-run. The MCP server can read & patch this config — your main Claude can configure Chorus for you.",action:(0,s.jsxs)("div",{className:"flex rounded-md border border-border bg-card p-0.5",children:[(0,s.jsxs)("button",{type:"button",onClick:()=>t("form"),className:`flex items-center gap-1.5 rounded-sm px-3 py-1.5 text-xs font-medium transition ${"form"===e?"bg-primary/15 text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,s.jsx)(n,{className:"h-3.5 w-3.5"}),"Form"]}),(0,s.jsxs)("button",{type:"button",onClick:()=>t("yaml"),className:`flex items-center gap-1.5 rounded-sm px-3 py-1.5 text-xs font-medium transition ${"yaml"===e?"bg-primary/15 text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,s.jsx)(d.A,{className:"h-3.5 w-3.5"}),"YAML"]})]})}),"yaml"===e?(0,s.jsx)(B,{yaml:R}):(0,s.jsx)(Y,{maxConcurrent:r,setMaxConcurrent:o,driverPolicies:c,reviewerPolicies:m,cyclePolicy:function(e,t){"driver"===e?u(e=>({...e,[t]:w(e[t])})):x(e=>({...e,[t]:w(e[t])}))},allowedDirs:h,setAllowedDirs:p,newDir:f,setNewDir:b,addDir:function(){let e=f.trim();!e||h.includes(e)||(p(t=>[...t,e]),b(""))},defaultDriver:j,setDefaultDriver:k,defaultCostCap:N,setDefaultCostCap:C,defaultThreshold:A,setDefaultThreshold:S,webhookUrl:T,setWebhookUrl:M,mcpEnabled:D,setMcpEnabled:E,privacyTier:$,setPrivacyTier:P,webhookTestState:_,testWebhook:function(){"running"!==_&&(O("running"),setTimeout(()=>{O(T.startsWith("https://")?"ok":"fail"),setTimeout(()=>O("idle"),2200)},1100))}})]})})}},4030:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("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"}]])},4372:(e,t,r)=>{"use strict";r.d(t,{G:()=>n});var s=r(9442),a=r(821),o=r(8344);function n({children:e}){return(0,s.jsxs)("div",{className:"flex h-screen w-screen overflow-hidden bg-background text-foreground",children:[(0,s.jsx)(a.AppSidebar,{}),(0,s.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,s.jsx)(o.MobileTopBar,{}),(0,s.jsx)("main",{className:"flex-1 overflow-y-auto",children:e})]})]})}},5702:(e,t,r)=>{"use strict";r.d(t,{E:()=>l});var s=r(9442);r(6074);var a=r(9056),o=r(8113),n=r(7362);let d=(0,a.F)("inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function l({className:e,variant:t="default",asChild:r=!1,...a}){let i=r?o.bL:"span";return(0,s.jsx)(i,{"data-slot":"badge","data-variant":t,className:(0,n.cn)(d({variant:t}),e),...a})}},6457:(e,t,r)=>{"use strict";r.d(t,{z:()=>a});var s=r(9442);function a({eyebrow:e,title:t,subtitle:r,action:o}){return(0,s.jsxs)("header",{className:"mb-6 flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:e}),(0,s.jsx)("h1",{className:"mt-1 text-2xl font-semibold tracking-tight",children:t}),r&&(0,s.jsx)("p",{className:"mt-2 max-w-2xl text-sm leading-relaxed text-muted-foreground",children:r})]}),o&&(0,s.jsx)("div",{className:"shrink-0 self-start sm:self-auto",children:o})]})}},6527:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("folder-lock",[["rect",{width:"8",height:"5",x:"14",y:"17",rx:"1",key:"19aais"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2.5",key:"1w6v7t"}],["path",{d:"M20 17v-2a2 2 0 1 0-4 0v2",key:"pwaxnr"}]])},6624:(e,t,r)=>{Promise.resolve().then(r.bind(r,3810))},7978:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("sliders-vertical",[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]])},9056:(e,t,r)=>{"use strict";r.d(t,{F:()=>n});var s=r(142);let a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,o=s.$,n=(e,t)=>r=>{var s;if((null==t?void 0:t.variants)==null)return o(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:n,defaultVariants:d}=t,l=Object.keys(n).map(e=>{let t=null==r?void 0:r[e],s=null==d?void 0:d[e];if(null===t)return null;let o=a(t)||a(s);return n[e][o]}),i=r&&Object.entries(r).reduce((e,t)=>{let[r,s]=t;return void 0===s||(e[r]=s),e},{});return o(e,l,null==t||null==(s=t.compoundVariants)?void 0:s.reduce((e,t)=>{let{class:r,className:s,...a}=t;return Object.entries(a).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...d,...i}[t]):({...d,...i})[t]===r})?[...e,r,s]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}},9208:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("code-xml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]])},9707:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])}},e=>{e.O(0,[116,720,641,344,506,128,358],()=>e(e.s=6624)),_N_E=e.O()}]);
25
+ `},[r,c,m,h,j,N,A,D,T]);return(0,s.jsx)(l.G,{children:(0,s.jsxs)("div",{className:"mx-auto w-full max-w-6xl px-4 py-6 sm:px-6 sm:py-8 md:px-8 md:py-10",children:[(0,s.jsx)(i.z,{eyebrow:"Settings",title:"Workspace",subtitle:"Defaults applied to every chat. Templates can override these per-run. The MCP server can read & patch this config — your main Claude can configure Chorus for you.",action:(0,s.jsxs)("div",{className:"flex rounded-md border border-border bg-card p-0.5",children:[(0,s.jsxs)("button",{type:"button",onClick:()=>t("form"),className:`flex items-center gap-1.5 rounded-sm px-3 py-1.5 text-xs font-medium transition ${"form"===e?"bg-primary/15 text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,s.jsx)(n,{className:"h-3.5 w-3.5"}),"Form"]}),(0,s.jsxs)("button",{type:"button",onClick:()=>t("yaml"),className:`flex items-center gap-1.5 rounded-sm px-3 py-1.5 text-xs font-medium transition ${"yaml"===e?"bg-primary/15 text-foreground":"text-muted-foreground hover:text-foreground"}`,children:[(0,s.jsx)(d.A,{className:"h-3.5 w-3.5"}),"YAML"]})]})}),"yaml"===e?(0,s.jsx)(B,{yaml:R}):(0,s.jsx)(Y,{maxConcurrent:r,setMaxConcurrent:o,driverPolicies:c,reviewerPolicies:m,cyclePolicy:function(e,t){"driver"===e?u(e=>({...e,[t]:w(e[t])})):x(e=>({...e,[t]:w(e[t])}))},allowedDirs:h,setAllowedDirs:p,newDir:f,setNewDir:b,addDir:function(){let e=f.trim();!e||h.includes(e)||(p(t=>[...t,e]),b(""))},defaultDriver:j,setDefaultDriver:k,defaultCostCap:N,setDefaultCostCap:C,defaultThreshold:A,setDefaultThreshold:S,webhookUrl:T,setWebhookUrl:M,mcpEnabled:D,setMcpEnabled:E,privacyTier:$,setPrivacyTier:P,webhookTestState:_,testWebhook:function(){"running"!==_&&(O("running"),setTimeout(()=>{O(T.startsWith("https://")?"ok":"fail"),setTimeout(()=>O("idle"),2200)},1100))}})]})})}},4030:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("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"}]])},4372:(e,t,r)=>{"use strict";r.d(t,{G:()=>n});var s=r(9442),a=r(821),o=r(8344);function n({children:e}){return(0,s.jsxs)("div",{className:"flex h-screen w-screen overflow-hidden bg-background text-foreground",children:[(0,s.jsx)(a.AppSidebar,{}),(0,s.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,s.jsx)(o.MobileTopBar,{}),(0,s.jsx)("main",{className:"flex-1 overflow-y-auto",children:e})]})]})}},5702:(e,t,r)=>{"use strict";r.d(t,{E:()=>l});var s=r(9442);r(6074);var a=r(9056),o=r(8113),n=r(7362);let d=(0,a.F)("inline-flex w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-full border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3",{variants:{variant:{default:"bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"bg-destructive text-white focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40 [a&]:hover:bg-destructive/90",outline:"border-border text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground",ghost:"[a&]:hover:bg-accent [a&]:hover:text-accent-foreground",link:"text-primary underline-offset-4 [a&]:hover:underline"}},defaultVariants:{variant:"default"}});function l({className:e,variant:t="default",asChild:r=!1,...a}){let i=r?o.bL:"span";return(0,s.jsx)(i,{"data-slot":"badge","data-variant":t,className:(0,n.cn)(d({variant:t}),e),...a})}},6457:(e,t,r)=>{"use strict";r.d(t,{z:()=>a});var s=r(9442);function a({eyebrow:e,title:t,subtitle:r,action:o}){return(0,s.jsxs)("header",{className:"mb-6 flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("p",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:e}),(0,s.jsx)("h1",{className:"mt-1 text-2xl font-semibold tracking-tight",children:t}),r&&(0,s.jsx)("p",{className:"mt-2 max-w-2xl text-sm leading-relaxed text-muted-foreground",children:r})]}),o&&(0,s.jsx)("div",{className:"shrink-0 self-start sm:self-auto",children:o})]})}},6527:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("folder-lock",[["rect",{width:"8",height:"5",x:"14",y:"17",rx:"1",key:"19aais"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2.5",key:"1w6v7t"}],["path",{d:"M20 17v-2a2 2 0 1 0-4 0v2",key:"pwaxnr"}]])},6624:(e,t,r)=>{Promise.resolve().then(r.bind(r,3810))},7978:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("sliders-vertical",[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]])},9056:(e,t,r)=>{"use strict";r.d(t,{F:()=>n});var s=r(142);let a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,o=s.$,n=(e,t)=>r=>{var s;if((null==t?void 0:t.variants)==null)return o(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:n,defaultVariants:d}=t,l=Object.keys(n).map(e=>{let t=null==r?void 0:r[e],s=null==d?void 0:d[e];if(null===t)return null;let o=a(t)||a(s);return n[e][o]}),i=r&&Object.entries(r).reduce((e,t)=>{let[r,s]=t;return void 0===s||(e[r]=s),e},{});return o(e,l,null==t||null==(s=t.compoundVariants)?void 0:s.reduce((e,t)=>{let{class:r,className:s,...a}=t;return Object.entries(a).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...d,...i}[t]):({...d,...i})[t]===r})?[...e,r,s]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}},9208:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("code-xml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]])},9707:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});let s=(0,r(3884).A)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])}},e=>{e.O(0,[116,832,641,344,506,128,358],()=>e(e.s=6624)),_N_E=e.O()}]);