chorus-codes 0.8.7 → 0.8.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +2 -2
  3. package/.next/build-manifest.json +2 -2
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  6. package/.next/server/app/_global-error.html +1 -1
  7. package/.next/server/app/_global-error.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  14. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/.next/server/app/_not-found.html +1 -1
  16. package/.next/server/app/_not-found.rsc +1 -1
  17. package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  18. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  19. package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  20. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  21. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  22. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  23. package/.next/server/app/connect/page_client-reference-manifest.js +1 -1
  24. package/.next/server/app/demo/[scenario]/page_client-reference-manifest.js +1 -1
  25. package/.next/server/app/new/page_client-reference-manifest.js +1 -1
  26. package/.next/server/app/new.html +1 -1
  27. package/.next/server/app/new.rsc +1 -1
  28. package/.next/server/app/new.segments/_full.segment.rsc +1 -1
  29. package/.next/server/app/new.segments/_head.segment.rsc +1 -1
  30. package/.next/server/app/new.segments/_index.segment.rsc +1 -1
  31. package/.next/server/app/new.segments/_tree.segment.rsc +1 -1
  32. package/.next/server/app/new.segments/new/__PAGE__.segment.rsc +1 -1
  33. package/.next/server/app/new.segments/new.segment.rsc +1 -1
  34. package/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  35. package/.next/server/app/onboarding.html +1 -1
  36. package/.next/server/app/onboarding.rsc +1 -1
  37. package/.next/server/app/onboarding.segments/_full.segment.rsc +1 -1
  38. package/.next/server/app/onboarding.segments/_head.segment.rsc +1 -1
  39. package/.next/server/app/onboarding.segments/_index.segment.rsc +1 -1
  40. package/.next/server/app/onboarding.segments/_tree.segment.rsc +1 -1
  41. package/.next/server/app/onboarding.segments/onboarding/__PAGE__.segment.rsc +1 -1
  42. package/.next/server/app/onboarding.segments/onboarding.segment.rsc +1 -1
  43. package/.next/server/app/page_client-reference-manifest.js +1 -1
  44. package/.next/server/app/personas/page_client-reference-manifest.js +1 -1
  45. package/.next/server/app/personas.html +1 -1
  46. package/.next/server/app/personas.rsc +1 -1
  47. package/.next/server/app/personas.segments/_full.segment.rsc +1 -1
  48. package/.next/server/app/personas.segments/_head.segment.rsc +1 -1
  49. package/.next/server/app/personas.segments/_index.segment.rsc +1 -1
  50. package/.next/server/app/personas.segments/_tree.segment.rsc +1 -1
  51. package/.next/server/app/personas.segments/personas/__PAGE__.segment.rsc +1 -1
  52. package/.next/server/app/personas.segments/personas.segment.rsc +1 -1
  53. package/.next/server/app/runs/[runId]/page_client-reference-manifest.js +1 -1
  54. package/.next/server/app/runs/page_client-reference-manifest.js +1 -1
  55. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  56. package/.next/server/app/settings/permissions/page_client-reference-manifest.js +1 -1
  57. package/.next/server/app/settings.html +1 -1
  58. package/.next/server/app/settings.rsc +1 -1
  59. package/.next/server/app/settings.segments/_full.segment.rsc +1 -1
  60. package/.next/server/app/settings.segments/_head.segment.rsc +1 -1
  61. package/.next/server/app/settings.segments/_index.segment.rsc +1 -1
  62. package/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
  63. package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +1 -1
  64. package/.next/server/app/settings.segments/settings.segment.rsc +1 -1
  65. package/.next/server/app/templates/page_client-reference-manifest.js +1 -1
  66. package/.next/server/app/templates.html +1 -1
  67. package/.next/server/app/templates.rsc +1 -1
  68. package/.next/server/app/templates.segments/_full.segment.rsc +1 -1
  69. package/.next/server/app/templates.segments/_head.segment.rsc +1 -1
  70. package/.next/server/app/templates.segments/_index.segment.rsc +1 -1
  71. package/.next/server/app/templates.segments/_tree.segment.rsc +1 -1
  72. package/.next/server/app/templates.segments/templates/__PAGE__.segment.rsc +1 -1
  73. package/.next/server/app/templates.segments/templates.segment.rsc +1 -1
  74. package/.next/server/app-paths-manifest.json +2 -2
  75. package/.next/server/chunks/597.js +1 -1
  76. package/.next/server/middleware-build-manifest.js +1 -1
  77. package/.next/server/pages/404.html +1 -1
  78. package/.next/server/pages/500.html +1 -1
  79. package/.next/server/server-reference-manifest.json +1 -1
  80. package/.next/static/chunks/977-e49df4d223b9e655.js +1 -0
  81. package/.next/trace +20 -20
  82. package/.next/trace-build +1 -1
  83. package/dist/daemon/template-adapter.js +144 -76
  84. package/dist/daemon/template-adapter.js.map +1 -1
  85. package/package.json +1 -1
  86. package/.next/static/chunks/977-26354f62110c63d4.js +0 -1
  87. /package/.next/static/{2-XAEHWtrjGewQajCM5pM → hmC83z5NnKa77tLC3wdHa}/_buildManifest.js +0 -0
  88. /package/.next/static/{2-XAEHWtrjGewQajCM5pM → hmC83z5NnKa77tLC3wdHa}/_ssgManifest.js +0 -0
package/.next/trace-build CHANGED
@@ -1 +1 @@
1
- [{"name":"run-webpack","duration":10497560,"timestamp":6668089494488,"id":14,"parentId":1,"tags":{},"startTime":1778059459921,"traceId":"174ac2abfb9ebbdd"},{"name":"run-typescript","duration":5364622,"timestamp":6668099995189,"id":2099,"parentId":1,"tags":{},"startTime":1778059470421,"traceId":"174ac2abfb9ebbdd"},{"name":"static-check","duration":535340,"timestamp":6668105399784,"id":2102,"parentId":1,"tags":{},"startTime":1778059475826,"traceId":"174ac2abfb9ebbdd"},{"name":"static-generation","duration":1430187,"timestamp":6668106126802,"id":2142,"parentId":1,"tags":{},"startTime":1778059476553,"traceId":"174ac2abfb9ebbdd"},{"name":"collect-build-traces","duration":6129873,"timestamp":6668105935533,"id":2139,"parentId":1,"tags":{},"startTime":1778059476362,"traceId":"174ac2abfb9ebbdd"},{"name":"telemetry-flush","duration":33,"timestamp":6668112067125,"id":2151,"parentId":1,"tags":{},"startTime":1778059482493,"traceId":"174ac2abfb9ebbdd"},{"name":"next-build","duration":22662709,"timestamp":6668089404458,"id":1,"tags":{"buildMode":"default","version":"16.2.4","bundler":"webpack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1778059459830,"traceId":"174ac2abfb9ebbdd"}]
1
+ [{"name":"run-webpack","duration":10743011,"timestamp":6670325208104,"id":14,"parentId":1,"tags":{},"startTime":1778061695634,"traceId":"f02d898778399ea0"},{"name":"run-typescript","duration":5660443,"timestamp":6670335955353,"id":2100,"parentId":1,"tags":{},"startTime":1778061706381,"traceId":"f02d898778399ea0"},{"name":"static-check","duration":419952,"timestamp":6670341653977,"id":2103,"parentId":1,"tags":{},"startTime":1778061712080,"traceId":"f02d898778399ea0"},{"name":"static-generation","duration":1384663,"timestamp":6670342239447,"id":2143,"parentId":1,"tags":{},"startTime":1778061712665,"traceId":"f02d898778399ea0"},{"name":"collect-build-traces","duration":6022041,"timestamp":6670342074379,"id":2140,"parentId":1,"tags":{},"startTime":1778061712500,"traceId":"f02d898778399ea0"},{"name":"telemetry-flush","duration":32,"timestamp":6670348098033,"id":2152,"parentId":1,"tags":{},"startTime":1778061718524,"traceId":"f02d898778399ea0"},{"name":"next-build","duration":22982912,"timestamp":6670325115161,"id":1,"tags":{"buildMode":"default","version":"16.2.4","bundler":"webpack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1778061695541,"traceId":"f02d898778399ea0"}]
@@ -37,6 +37,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.adaptTemplate = adaptTemplate;
40
+ exports.voicesToModelKeys = voicesToModelKeys;
41
+ exports.capabilityScore = capabilityScore;
40
42
  const yaml_1 = __importDefault(require("yaml"));
41
43
  /**
42
44
  * Pure function. Takes the canonical YAML and the user's voices,
@@ -78,48 +80,40 @@ function adaptTemplate(canonicalYaml, voices) {
78
80
  for (const phase of parsed.phases) {
79
81
  if (!phase)
80
82
  continue;
81
- // Track lineages already filled in this phase so we can prefer a
82
- // different lineage when substituting (diversity preservation).
83
+ // Sequential slot assignment in template order. Each slot's
84
+ // assignment honors its preferred lineage when possible, then
85
+ // falls through to a diversity-preserving substitute (a lineage
86
+ // not yet used in this phase), then last-ditch any-available.
87
+ //
88
+ // Two diversity dimensions tracked per phase:
89
+ // usedLineages — which lineages are filled (prefer unused next)
90
+ // usedTuples — which (lineage, model) pairs are filled
91
+ // (rotate across multiple voices within a lineage
92
+ // so 3 anthropic slots get opus + sonnet + haiku,
93
+ // not opus three times)
83
94
  const usedLineages = new Set();
95
+ const usedTuples = new Set();
84
96
  if (phase.doer) {
85
- const result = pickForSlot(phase.doer.lineage, byLineage, byFamily, usedLineages);
86
- if (result) {
87
- if (phase.doer.lineage !== result.lineage ||
88
- !sameModels(phase.doer.models, result.models)) {
89
- changed = true;
90
- }
91
- phase.doer.lineage = result.lineage;
92
- phase.doer.models = result.models;
93
- usedLineages.add(result.lineage);
94
- }
95
- else {
96
- if ((phase.doer.models?.length ?? 0) > 0)
97
- changed = true;
97
+ const assigned = assignSlot(phase.doer, byLineage, byFamily, usedLineages, usedTuples);
98
+ if (!assigned) {
98
99
  phase.doer.models = [];
99
100
  isComplete = false;
100
101
  }
101
102
  }
102
103
  if (phase.reviewer?.candidates) {
103
104
  for (const slot of phase.reviewer.candidates) {
104
- const result = pickForSlot(slot.lineage, byLineage, byFamily, usedLineages);
105
- if (result) {
106
- if (slot.lineage !== result.lineage ||
107
- !sameModels(slot.models, result.models)) {
108
- changed = true;
109
- }
110
- slot.lineage = result.lineage;
111
- slot.models = result.models;
112
- usedLineages.add(result.lineage);
113
- }
114
- else {
115
- if ((slot.models?.length ?? 0) > 0)
116
- changed = true;
105
+ const assigned = assignSlot(slot, byLineage, byFamily, usedLineages, usedTuples);
106
+ if (!assigned) {
117
107
  slot.models = [];
118
108
  isComplete = false;
119
109
  }
120
110
  }
121
111
  }
122
112
  }
113
+ // changed flag — compare round-tripped JSON. Cheap, deterministic,
114
+ // catches lineage swaps + model reductions in one shot.
115
+ changed =
116
+ JSON.stringify(parsed) !== JSON.stringify(yaml_1.default.parse(canonicalYaml));
123
117
  // Re-serialise. yaml lib preserves keys/order and quoting style well
124
118
  // enough for builtin templates that are themselves machine-authored.
125
119
  // Hand-edited templates aren't passed to this function (caller gates
@@ -127,52 +121,50 @@ function adaptTemplate(canonicalYaml, voices) {
127
121
  const output = yaml_1.default.stringify(parsed, { lineWidth: 0 });
128
122
  return { yaml: output, isComplete, changed };
129
123
  }
130
- function pickForSlot(preferredLineage, byLineage, byFamily, usedInPhase) {
131
- if (!preferredLineage) {
132
- // Slot doesn't specify a lineage. Don't touch — caller's intent.
133
- return null;
134
- }
135
- // 1. Exact lineage match: best case. Use the user's actual voices
136
- // for that lineage; primary first, rest as fallbacks.
124
+ /**
125
+ * Assign a single slot. Returns true iff the slot was actually
126
+ * written into. Sequential resolution:
127
+ * 1. Exact lineage match.
128
+ * 2. Vendor-family match (template wants moonshot, user has
129
+ * opencode-go/kimi with vendor_family=moonshot).
130
+ * 3. Diversity-preserving substitute: a lineage not yet used in
131
+ * this phase. Maximizes cross-lineage reviewer diversity.
132
+ * 4. Last-ditch: any available lineage (accepts duplication).
133
+ * 5. No voices anywhere → returns false; caller marks incomplete.
134
+ */
135
+ function assignSlot(slot, byLineage, byFamily, usedInPhase, usedTuples) {
136
+ const preferredLineage = slot.lineage;
137
+ if (!preferredLineage)
138
+ return false;
137
139
  const direct = byLineage.get(preferredLineage);
138
140
  if (direct && direct.length > 0) {
139
- return {
140
- lineage: preferredLineage,
141
- models: voicesToModelKeys(direct),
142
- };
141
+ slot.lineage = preferredLineage;
142
+ slot.models = voicesToModelKeys(direct, usedTuples);
143
+ usedInPhase.add(preferredLineage);
144
+ return true;
143
145
  }
144
- // 2. Vendor-family match: e.g., template wants lineage=moonshot,
145
- // user has `opencode-go/kimi-k2.5` (lineage=opencode,
146
- // vendor_family=moonshot). The model family is preserved; only
147
- // the transport changes.
148
146
  const familyMatch = byFamily.get(preferredLineage);
149
147
  if (familyMatch && familyMatch.length > 0) {
150
- return {
151
- lineage: familyMatch[0].lineage,
152
- models: voicesToModelKeys(familyMatch),
153
- };
148
+ slot.lineage = familyMatch[0].lineage;
149
+ slot.models = voicesToModelKeys(familyMatch, usedTuples);
150
+ usedInPhase.add(familyMatch[0].lineage);
151
+ return true;
154
152
  }
155
- // 3. Diversity-preserving substitute: prefer a lineage not yet used
156
- // in this phase. Iteration order of Map preserves insertion order
157
- // (deterministic for a stable voices list).
158
153
  for (const [lineage, voices] of byLineage) {
159
154
  if (!usedInPhase.has(lineage)) {
160
- return {
161
- lineage,
162
- models: voicesToModelKeys(voices),
163
- };
155
+ slot.lineage = lineage;
156
+ slot.models = voicesToModelKeys(voices, usedTuples);
157
+ usedInPhase.add(lineage);
158
+ return true;
164
159
  }
165
160
  }
166
- // 4. Last-ditch: any lineage at all, even if already used. Better a
167
- // repeated reviewer than an empty slot.
168
161
  for (const [lineage, voices] of byLineage) {
169
- return {
170
- lineage,
171
- models: voicesToModelKeys(voices),
172
- };
162
+ slot.lineage = lineage;
163
+ slot.models = voicesToModelKeys(voices, usedTuples);
164
+ usedInPhase.add(lineage);
165
+ return true;
173
166
  }
174
- // 5. User has no enabled voices anywhere. Slot stays empty.
175
- return null;
167
+ return false;
176
168
  }
177
169
  /**
178
170
  * Voices reference one of two id forms in the wire/template space:
@@ -181,23 +173,99 @@ function pickForSlot(preferredLineage, byLineage, byFamily, usedInPhase) {
181
173
  * dispatch via the HTTP shim (see chorus-086).
182
174
  * - All other voices (CLI-backed) use the bare `model_id` because
183
175
  * the CLI shim is keyed by lineage + model_id.
176
+ *
177
+ * Returns AT MOST 1 model — the highest-ranked voice for the lineage.
178
+ * Pre-fix the adapter dumped every available voice into the slot's
179
+ * fallback chain (per chorus-083), which produced 5+ form rows per
180
+ * slot and confused users.
181
+ *
182
+ * `usedTuples` (lineage:model_id) tracks what's already been assigned
183
+ * in this phase so multiple slots wanting the same lineage rotate
184
+ * through available models instead of all picking the same top one.
185
+ * Without rotation, review-only's 3 opencode reviewer slots all got
186
+ * the same kimi model — wasted API calls and no internal diversity.
184
187
  */
185
- function voicesToModelKeys(voices) {
186
- const out = [];
187
- for (const v of voices) {
188
- out.push(v.provider === 'openrouter' ? v.id : v.model_id);
188
+ function voicesToModelKeys(voices, usedTuples) {
189
+ if (voices.length === 0)
190
+ return [];
191
+ const ranked = [...voices].sort((a, b) => capabilityScore(b) - capabilityScore(a));
192
+ const tupleKey = (v) => `${v.lineage}:${v.model_id}`;
193
+ // Prefer the highest-ranked voice whose (lineage, model_id) tuple
194
+ // hasn't been used elsewhere in this phase. If all are used, fall
195
+ // through to the top — duplication is acceptable as last resort.
196
+ let pick = ranked[0];
197
+ if (usedTuples) {
198
+ for (const v of ranked) {
199
+ if (!usedTuples.has(tupleKey(v))) {
200
+ pick = v;
201
+ break;
202
+ }
203
+ }
204
+ usedTuples.add(tupleKey(pick));
189
205
  }
190
- // Dedup defensive two voices for the same model from different
191
- // sources would otherwise both appear in the fallback chain.
192
- return Array.from(new Set(out));
206
+ return [pick.provider === 'openrouter' ? pick.id : pick.model_id];
193
207
  }
194
- function sameModels(a, b) {
195
- if (!a || a.length !== b.length)
196
- return false;
197
- for (let i = 0; i < a.length; i += 1) {
198
- if (a[i] !== b[i])
199
- return false;
208
+ /**
209
+ * Capability heuristic for ordering voices within a lineage.
210
+ *
211
+ * Picks the top model when the user has multiple voices for the slot's
212
+ * lineage. Higher score = more capable. The function is per-family —
213
+ * Anthropic Opus beats Sonnet beats Haiku, OpenAI gpt-5.5 beats 5.4,
214
+ * Gemini 3.x beats 2.x, Pro beats Flash, and so on.
215
+ *
216
+ * Heuristic by design: model naming changes over time, so this scoring
217
+ * will need touch-ups when new models land. Keep the logic in one
218
+ * function to make those updates easy. Falls back to 0 (alphabetical
219
+ * tiebreaker via the sort's stability) for unknown models — better
220
+ * than picking arbitrarily.
221
+ */
222
+ function capabilityScore(v) {
223
+ const id = v.model_id.toLowerCase();
224
+ let score = 0;
225
+ // Anthropic family tier.
226
+ if (id.includes('opus'))
227
+ score += 1000;
228
+ else if (id.includes('sonnet'))
229
+ score += 700;
230
+ else if (id.includes('haiku'))
231
+ score += 400;
232
+ // OpenAI / Codex (gpt-X.Y).
233
+ const gptMatch = id.match(/gpt-(\d+)\.(\d+)/);
234
+ if (gptMatch) {
235
+ score += Number.parseInt(gptMatch[1], 10) * 100;
236
+ score += Number.parseInt(gptMatch[2], 10) * 10;
237
+ // -codex variant counts as production (vs preview).
238
+ if (id.includes('-codex'))
239
+ score += 5;
240
+ }
241
+ // Gemini family — major.minor with pro/flash modifier.
242
+ const geminiMatch = id.match(/gemini-(\d+)\.(\d+)/);
243
+ if (geminiMatch) {
244
+ score += Number.parseInt(geminiMatch[1], 10) * 100;
245
+ score += Number.parseInt(geminiMatch[2], 10) * 10;
246
+ if (id.includes('pro'))
247
+ score += 50;
248
+ else if (id.includes('flash'))
249
+ score += 20;
250
+ if (id.includes('preview'))
251
+ score += 5;
252
+ }
253
+ // Kimi (k2.x). Thinking variant scores higher than base.
254
+ const kimiMatch = id.match(/k(\d+)\.(\d+)/);
255
+ if (kimiMatch) {
256
+ score += Number.parseInt(kimiMatch[1], 10) * 100;
257
+ score += Number.parseInt(kimiMatch[2], 10) * 10;
258
+ if (id.includes('thinking'))
259
+ score += 50;
260
+ if (id.includes('turbo'))
261
+ score += 30;
262
+ }
263
+ // Anthropic version suffix (-4-7 > -4-6 > -4-5).
264
+ const versionMatch = id.match(/-(\d+)-(\d+)$/);
265
+ if (versionMatch) {
266
+ score += Number.parseInt(versionMatch[1], 10) * 5;
267
+ score += Number.parseInt(versionMatch[2], 10);
200
268
  }
201
- return true;
269
+ return score;
202
270
  }
203
271
  //# sourceMappingURL=template-adapter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"template-adapter.js","sourceRoot":"","sources":["../../src/daemon/template-adapter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;;;;;AA4CH,sCAqGC;AA/ID,gDAAwB;AAsCxB;;;GAGG;AACH,SAAgB,aAAa,CAC3B,aAAqB,EACrB,MAAe;IAEf,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAChD,+DAA+D;IAC/D,kEAAkE;IAClE,MAAM,SAAS,GAAG,IAAI,GAAG,EAAmB,CAAC;IAC7C,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAmB,CAAC;IAC5C,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,MAAM,EAAE,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QAC1C,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACX,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC7B,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;YACpB,MAAM,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;YAC/C,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACX,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,aAAa,EAA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EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC;YAAE,KAAK,IAAI,EAAE,CAAC;QACzC,IAAI,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;YAAE,KAAK,IAAI,EAAE,CAAC;IACxC,CAAC;IAED,iDAAiD;IACjD,MAAM,YAAY,GAAG,EAAE,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAC/C,IAAI,YAAY,EAAE,CAAC;QACjB,KAAK,IAAI,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;QAClD,KAAK,IAAI,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chorus-codes",
3
- "version": "0.8.7",
3
+ "version": "0.8.9",
4
4
  "description": "Driver-agnostic multi-LLM peer review for code decisions. Bring your own CLI; Chorus convenes 2-4 other LLMs to review the work before you ship.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "99x Agency",
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[977],{52:(e,t,r)=>{r.d(t,{A:()=>a});let a=(0,r(3884).A)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},862:(e,t,r)=>{r.d(t,{$:()=>a});function a(e){return!!e&&e.phases[0]?.kind==="review_only"}},2116:(e,t,r)=>{r.d(t,{A:()=>a});let a=(0,r(3884).A)("clipboard-list",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]])},2865:(e,t,r)=>{r.d(t,{A:()=>a});let a=(0,r(3884).A)("file-code-corner",[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]])},2956:(e,t,r)=>{r.d(t,{A:()=>a});let a=(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)=>{r.d(t,{A:()=>a});let a=(0,r(3884).A)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},3734:(e,t,r)=>{r.d(t,{JR:()=>c,QJ:()=>s,VW:()=>d,YM:()=>m,m_:()=>i,r2:()=>u,u5:()=>l,x0:()=>p,ze:()=>a});let a={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 s(e){return e?a[e]??e:""}function d(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 p={claude:"claude-opus-4-7",codex:"gpt-5.5",gemini:"gemini-3.1-pro-preview",opencode:"kimi-k2.6",kimi:"kimi-k2.6",openrouter:""};function m(e){if(e)return p[e]}let u={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"}}},4030:(e,t,r)=>{r.d(t,{A:()=>a});let a=(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"}]])},4579:(e,t,r)=>{r.d(t,{A:()=>a});let a=(0,r(3884).A)("git-pull-request",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]])},4608:(e,t,r)=>{r.d(t,{A:()=>a});let a=(0,r(3884).A)("shuffle",[["path",{d:"m18 14 4 4-4 4",key:"10pe0f"}],["path",{d:"m18 2 4 4-4 4",key:"pucp1d"}],["path",{d:"M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22",key:"1ailkh"}],["path",{d:"M2 6h1.972a4 4 0 0 1 3.6 2.2",key:"km57vx"}],["path",{d:"M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45",key:"os18l9"}]])},5358:(e,t,r)=>{r.d(t,{LiveRunReal:()=>Y});var a=r(9442),n=r(2573),s=r.n(n),d=r(3884);let i=(0,d.A)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);var o=r(6074),l=r(862),c=r(7296);function p({work:e}){let[t,r]=(0,o.useState)(!1),n=(0,c.t)(e),s=e.trim()!==n.trim()||e.length>100;return(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("button",{type:"button",onClick:s?()=>r(e=>!e):void 0,title:s?t?"Hide full brief":"Click to show full brief":n,disabled:!s,className:"block w-full min-w-0 text-left disabled:cursor-default",children:(0,a.jsx)("h1",{className:"truncate text-sm font-medium tracking-tight",children:n})}),s&&t&&(0,a.jsx)("pre",{className:"mt-2 max-h-72 overflow-auto whitespace-pre-wrap break-words rounded-md border border-border bg-background px-5 py-4 font-mono text-[12px] leading-relaxed text-foreground/90",children:e})]})}var m=r(6891),u=r(4608),h=r(6289),x=r(4030),g=r(3734);let f=Object.fromEntries(Object.entries(g.r2).map(([e,t])=>[e,t.gradient]));var b=r(2956),y=r(3149);function w({state:e}){switch(e){case"done":return(0,a.jsxs)("span",{className:"flex items-center gap-1 rounded-md bg-emerald-500/10 px-1.5 py-0.5 text-[10px] font-medium text-emerald-400",children:[(0,a.jsx)(b.A,{className:"h-3 w-3"})," DONE"]});case"errored":return(0,a.jsxs)("span",{className:"flex items-center gap-1 rounded-md bg-destructive/10 px-1.5 py-0.5 text-[10px] font-medium text-destructive",children:[(0,a.jsx)(x.A,{className:"h-3 w-3"})," ERRORED"]});case"working":return(0,a.jsxs)("span",{className:"flex items-center gap-1 rounded-md bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary",children:[(0,a.jsx)(y.A,{className:"h-3 w-3 animate-spin"})," WORKING"]});case"pending":return(0,a.jsx)("span",{className:"flex items-center gap-1 rounded-md bg-muted/40 px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground/80",children:"QUEUED"});default:return(0,a.jsx)("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground",children:"IDLE"})}}function v({participant:e,isActive:t,liveTail:r,chatTerminal:n,chatId:s,reviewOnly:d,swaps:i}){var l,c;let p,b,[y,j]=(0,o.useState)(!1),N=function(e){let t;if(!e)return null;let r=e.trimStart();if(!/^##\s+(?:REVIEWER|DOER)\s+FAILED/i.test(r))return null;let a=r.match(/\*\*Kind:\*\*\s*(.+?)(?:\n|$)/),n=a?a[1].trim():"failed",s=r.match(/\*\*Resets:\*\*\s*(.+?)(?:\n|$)/);if(s){let e=Date.parse(s[1].trim());Number.isFinite(e)&&(t=e)}let d=r.search(/\n\n[^*]/),i=d>=0?r.slice(d+2).trim():"",o=i.length>0?i:"(no error message reported)",l=function(e){switch(e){case"quota_exhausted":return"Check your subscription dashboard or swap the account in CHORUS_CODEX_HOME / chorus settings.";case"stream_failure":return"Subprocess died mid-stream — check disk space and CLI version.";case"cli_failed":case"cli_error":return"Re-auth the CLI (codex/gemini/opencode login) and retry.";default:return}}(n);return{kind:n,message:o,...l?{cta:l}:{},...t?{resetAt:t}:{}}}(e.answer),A=e.pending?"pending":e.hasAnswer?"done":N||n?"errored":"working",$="opencode-cli"===e.binaryUsed?"opencode":e.lineage;return(0,a.jsxs)("div",{className:`flex h-[320px] flex-col overflow-hidden rounded-lg border transition-[opacity,border-color,box-shadow] duration-300 ${f[$]??"bg-card"} ${"done"===A?"border-emerald-500/30":"working"===A?"border-primary/60 shadow-[0_0_0_1px_rgba(124,58,237,0.25),0_0_24px_-6px_rgba(124,58,237,0.45)] animate-pulse-soft":"errored"===A?"border-destructive/40":"pending"===A?"border-border/40 opacity-50 grayscale-[0.6]":"border-border"}`,children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2 border-b border-border bg-card/60 px-4 py-3",children:[(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-2 text-xs leading-none",children:[(0,a.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${(0,g.JR)($)} ${"working"===A?"animate-pulse-soft":""}`}),(0,a.jsx)("span",{className:"font-medium capitalize text-foreground",children:e.role}),(0,a.jsx)("span",{className:"text-muted-foreground",children:"\xb7"}),(0,a.jsx)("span",{className:"uppercase tracking-wider text-muted-foreground",children:(0,g.u5)($)}),(e.modelUsed??e.model)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-muted-foreground/60",children:"\xb7"}),(0,a.jsx)("span",{className:"truncate font-mono text-muted-foreground",children:e.modelUsed??e.model})]})]}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5",children:["working"===A&&s&&(0,a.jsx)("button",{type:"button",disabled:y,onClick:async()=>{if(!y){j(!0);try{let t=await fetch(`/api/daemon/chats/${s}/participants/${encodeURIComponent(e.participant)}/cancel`,{method:"POST"});if(!t.ok)return void j(!1);let r=await t.json();if(!r.ok){window.alert(`Couldn't cancel: ${r.error?.message??"unknown error"}`),j(!1);return}setTimeout(()=>j(!1),15e3)}catch{j(!1)}}},"aria-label":"Cancel this reviewer",title:"Cancel this reviewer (chat continues with others)",className:"grid h-6 w-6 shrink-0 place-items-center rounded-md border border-border bg-card/40 text-muted-foreground transition hover:border-destructive/40 hover:text-destructive disabled:cursor-not-allowed disabled:opacity-50",children:(0,a.jsx)(m.A,{className:"h-3 w-3"})}),(0,a.jsx)(w,{state:A})]})]}),i&&i.length>0&&(b=i.slice().sort((e,t)=>e.fallbackIdx-t.fallbackIdx),(0,a.jsx)("div",{className:"space-y-1.5 border-b border-amber-500/30 bg-amber-500/5 px-4 py-2 text-[11px]",children:b.map((e,t)=>{let r="lineage_fallback"===e.reason,n=t===b.length-1;return(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)(u.A,{className:"mt-0.5 h-3 w-3 shrink-0 text-amber-300"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,a.jsx)("div",{className:"font-medium uppercase tracking-wider text-[10px] text-amber-300",children:r?"Cross-lineage fallback":"Model fallback"}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5 text-[11px] text-amber-100/90",children:[(0,a.jsxs)("span",{className:"text-amber-100/60 line-through",children:[e.fromLineage,"/",e.fromModel]}),(0,a.jsx)(h.A,{className:"h-3 w-3 shrink-0 text-amber-300"}),(0,a.jsxs)("span",{className:n?"font-medium text-amber-100":"text-amber-100/60 line-through",children:[e.toLineage,"/",e.toModel]}),n&&(0,a.jsx)("span",{className:"rounded bg-amber-500/15 px-1 py-0.5 font-mono text-[9px] text-amber-200",children:"actually ran"})]})]})]},`${e.fromLineage}-${e.fromModel}-${t}`)})})),e.warnings&&e.warnings.length>0&&(0,a.jsx)("div",{className:"space-y-1 border-b border-amber-500/30 bg-amber-500/5 px-4 py-2 text-[11px] text-amber-200/90",children:e.warnings.map((e,t)=>(0,a.jsxs)("div",{className:"flex items-start gap-1.5",children:[(0,a.jsx)(x.A,{className:"mt-0.5 h-3 w-3 shrink-0 text-amber-400"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("span",{className:"font-medium uppercase tracking-wider text-[10px] text-amber-300",children:e.kind}),(0,a.jsx)("div",{className:"mt-0.5 break-words font-mono text-[11px] leading-snug text-amber-100/85",children:e.message})]})]},t))}),(0,a.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden px-4 py-3 font-mono text-xs leading-relaxed text-muted-foreground",children:e.findingsPreview&&e.findingsPreview.length>0?e.findingsPreview.map((e,t)=>(0,a.jsx)("div",{className:"py-0.5 text-foreground/90",children:e},t)):"working"===A&&r&&r.length>0?(0,a.jsx)("div",{className:"flex min-h-0 flex-1 flex-col-reverse overflow-y-auto",children:(0,a.jsx)("pre",{className:"whitespace-pre-wrap break-words text-foreground/85",children:r})}):"working"===A?(0,a.jsx)("div",{className:"text-muted-foreground",children:"Thinking…"}):"pending"===A?(0,a.jsx)("div",{className:"text-muted-foreground/70",children:d?"Queued — waiting for an open slot.":"Queued — runs after the doer."}):"errored"===A?N?(0,a.jsxs)("div",{className:"space-y-1.5 text-destructive/90",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("span",{className:"text-[10px] font-semibold uppercase tracking-wider",children:N.kind}),N.resetAt&&(0,a.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:["Resets ",function(e){let t=e-Date.now();if(t<=0)return"now";let r=Math.round(t/1e3);if(r<60)return`in ${r}s`;let a=Math.round(r/60);if(a<60)return`in ${a}m`;let n=Math.round(a/60);if(n<24){let t=new Date(e);return`at ${t.getHours().toString().padStart(2,"0")}:${t.getMinutes().toString().padStart(2,"0")}`}let s=Math.round(n/24);return`in ${s}d`}(N.resetAt)]})]}),(0,a.jsx)("div",{className:"whitespace-pre-wrap break-words text-foreground/85",children:N.message}),N.cta&&(0,a.jsx)("div",{className:"text-[11px] text-muted-foreground/80",children:N.cta})]}):(0,a.jsx)("div",{className:"text-destructive/80",children:"The program finished but didn't produce any output."}):"done"===A&&e.answer?(0,a.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto",children:(0,a.jsx)("pre",{className:"whitespace-pre-wrap break-words text-foreground/85",children:e.answer})}):(0,a.jsx)("div",{className:"text-muted-foreground/70",children:"No output yet."})}),(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 border-t border-border bg-card/60 px-4 py-2 font-mono text-[10px] text-muted-foreground",children:[(0,a.jsx)("span",{className:"truncate",children:e.binaryUsed??e.agentName}),(0,a.jsxs)("span",{className:"flex shrink-0 items-center gap-2",children:[void 0!==e.durationMs&&(0,a.jsx)("span",{title:"Wall-clock time the CLI took to finish.",children:function(e){if(e<1e3)return`${e} ms`;let t=e/1e3;if(t<60)return`${t.toFixed(1)}s`;let r=Math.floor(t/60),a=Math.round(t-60*r);return`${r}m${a.toString().padStart(2,"0")}s`}(e.durationMs)}),e.usage?.costUsd!==void 0&&(0,a.jsx)("span",{title:"USD cost reported by the CLI for this run.",children:(l=e.usage.costUsd)<=0?"$0.00":l<.01?"<$0.01":l<1?`$${l.toFixed(3)}`:`$${l.toFixed(2)}`}),e.usage&&k(e.usage)&&(0,a.jsx)("span",{title:(c=e.usage,p=[],void 0!==c.inputTokens&&p.push(`in ${c.inputTokens.toLocaleString()}`),void 0!==c.outputTokens&&p.push(`out ${c.outputTokens.toLocaleString()}`),void 0!==c.cachedInputTokens&&p.push(`cached ${c.cachedInputTokens.toLocaleString()}`),p.join(" \xb7 ")),children:k(e.usage)}),(0,a.jsx)("span",{children:e.hasAnswer?`${(e.answer?.length??0).toLocaleString()} B`:"—"})]})]})]})}function k(e){let t=(e.inputTokens??0)+(e.outputTokens??0);return t<=0?null:t<1e3?`${t} tok`:`${(t/1e3).toFixed(1)}k tok`}function j({round:e,isLatest:t,activeFor:r,liveTails:n,chatTerminal:s,reviewOnly:d,chatId:i,swaps:o}){let l=d?e.participants.filter(e=>"doer"!==e.role):e.participants,c=(o??[]).filter(t=>t.round===e.round);return(0,a.jsxs)("section",{children:[!d&&(0,a.jsxs)("h2",{className:"mb-3 text-xs uppercase tracking-wider text-muted-foreground",children:["Round ",e.round,t&&(0,a.jsx)("span",{className:"ml-2 rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary",children:"current"})]}),(0,a.jsx)("div",{className:"grid items-start gap-4 sm:grid-cols-2 xl:grid-cols-3",children:l.map(e=>{let t;return(0,a.jsx)(v,{participant:e,isActive:r(e),liveTail:n[e.participant],chatTerminal:s,chatId:i,reviewOnly:d,swaps:(t=e.participant.replace(/^(reviewer-|doer-)/,""),c.filter(e=>e.agent===t))},e.participant)})})]})}let N={claude:"claude-code",codex:"codex-cli",gemini:"gemini-cli",opencode:"opencode-cli",kimi:"kimi-cli",openrouter:"openrouter"},A={anthropic:"claude",openai:"codex",google:"gemini",opencode:"opencode",moonshot:"kimi"},$={drafting:{text:"DRAFTING \xb7 doer working",color:"primary"},reviewing:{text:"REVIEWING \xb7 cross-lineage check",color:"primary"},approved:{text:"APPROVED",color:"emerald"},merged:{text:"PR OPENED",color:"emerald"},blocked:{text:"BLOCKED \xb7 ship error",color:"amber"},no_review:{text:"NO REVIEW \xb7 reviewers unavailable",color:"amber"},failed:{text:"FAILED",color:"destructive"},cancelled:{text:"CANCELLED",color:"muted"}},M={primary:"bg-primary",emerald:"bg-emerald-400",amber:"bg-amber-400",destructive:"bg-destructive",muted:"bg-muted-foreground"},C=["approved","merged","blocked","failed","cancelled","no_review"];function E(e,t){return t&&t.startsWith("openrouter:")?"openrouter":A[e]??e}let S=(0,d.A)("rotate-cw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]),R=(0,d.A)("repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);var _=r(8420),I=r(5902);function T({chatId:e,status:t,isTerminal:r,template:n,onCancel:d}){let i=(0,I.useRouter)(),[l,c]=(0,o.useState)(!1),[p,u]=(0,o.useState)(!1),h=async()=>{c(!0);try{let t=await fetch(`/api/daemon/chats/${e}/rerun`,{method:"POST"});if(!t.ok){window.alert("Couldn't start a new run — Chorus didn't respond. Try restarting it from your terminal: chorus start"),c(!1);return}let r=await t.json();if(!r.ok){let e=r.error?.message??"Unknown error from Chorus.";window.alert(`Couldn't start a new run: ${e}`),c(!1);return}let a=r.data?.slug??r.data?.id;a?(i.push(`/runs/${a}`),i.refresh()):(window.alert("Chorus accepted the retry but didn't return a chat id. Refresh and try again."),c(!1))}catch{window.alert("Retry failed. Network error."),c(!1)}},x=async()=>{if(window.confirm("Delete this chat permanently? This removes all reviewer output and history. You cannot undo this.")){u(!0);try{(await fetch(`/api/daemon/chats/${e}`,{method:"DELETE"})).ok?(i.push("/runs"),i.refresh()):(window.alert("Couldn't delete this chat — Chorus didn't respond. Try restarting it from your terminal: chorus start"),u(!1))}catch{window.alert("Delete failed. Network error."),u(!1)}}};return(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:["cancelled"===t||"failed"===t?(0,a.jsxs)("button",{type:"button",disabled:l,onClick:h,className:"flex items-center gap-1.5 rounded-md border border-primary/40 bg-primary/10 px-3 py-1.5 text-xs font-medium text-primary transition hover:border-primary hover:bg-primary/20 disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)(S,{className:`h-3.5 w-3.5 ${l?"animate-spin":""}`}),l?"Restarting…":"Retry"]}):(0,a.jsxs)("button",{type:"button",disabled:r,onClick:async()=>{await fetch(`/api/daemon/chats/${e}/cancel`,{method:"POST"}),d()},className:"flex items-center gap-1.5 rounded-md border border-border bg-card px-3 py-1.5 text-xs font-medium text-muted-foreground transition hover:border-destructive/40 hover:text-destructive disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)(m.A,{className:"h-3.5 w-3.5"}),"Cancel"]}),r&&n&&(0,a.jsxs)(s(),{href:`/new?template=${encodeURIComponent(n.id)}`,className:"flex items-center gap-1.5 rounded-md border border-border bg-card px-3 py-1.5 text-xs font-medium text-muted-foreground transition hover:border-primary/40 hover:text-primary",children:[(0,a.jsx)(R,{className:"h-3.5 w-3.5"}),"Run again"]}),(0,a.jsxs)("button",{type:"button",disabled:p,onClick:x,className:"flex items-center gap-1.5 rounded-md border border-border bg-card px-3 py-1.5 text-xs font-medium text-muted-foreground transition hover:border-destructive/40 hover:text-destructive disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)(_.A,{className:"h-3.5 w-3.5"}),p?"Deleting…":"Delete"]})]})}var L=r(52),D=r(2116),O=r(2865),U=r(9410),P=r(9208),z=r(7618),V=r(4579),F=r(9812),H=r(9707);let W={review:L.A,review_only:L.A,plan:D.A,spec:O.A,tests:U.A,implement:P.A,verify:z.A,pr:V.A,divergence:u.A,recon:F.A},q={pending:"bg-muted-foreground/20 text-muted-foreground",active:"bg-primary/20 text-primary ring-2 ring-primary/40 ring-offset-2 ring-offset-background",done:"bg-emerald-500/20 text-emerald-300",blocked:"bg-amber-500/20 text-amber-300",skipped:"bg-muted-foreground/10 text-muted-foreground/50 line-through"},G={pending:"queued",active:"active",done:"done",blocked:"blocked",skipped:"skipped"};function K({phases:e,activeIndex:t,states:r,onSelect:n}){return(0,a.jsx)("div",{className:"flex items-center gap-0 overflow-x-auto pb-1",children:e.map((s,d)=>{let i=r[d]??"pending",o=W[s.kind],l=n&&("done"===i||"active"===i);return(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsxs)("button",{type:"button",disabled:!l,onClick:()=>l&&n?.(d),className:`group flex items-center gap-2 rounded-md border px-3 py-1.5 text-left transition ${d===t?"border-primary/40 bg-primary/5":"done"===i?"border-emerald-500/30 bg-emerald-500/5":"blocked"===i?"border-amber-500/40 bg-amber-500/5":"border-border bg-card/30"} ${l?"hover:border-foreground/30":"cursor-default"}`,children:[(0,a.jsx)("span",{className:`grid h-6 w-6 shrink-0 place-items-center rounded-md ${q[i]}`,children:"done"===i?(0,a.jsx)(H.A,{className:"h-3.5 w-3.5"}):"active"===i?(0,a.jsx)(y.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,a.jsx)(o,{className:"h-3.5 w-3.5"})}),(0,a.jsxs)("span",{className:"flex flex-col leading-tight",children:[(0,a.jsxs)("span",{className:"text-[10px] font-medium uppercase tracking-wider text-muted-foreground",children:[String(d+1).padStart(2,"0")," \xb7 ",G[i]]}),(0,a.jsx)("span",{className:`text-xs font-medium ${"skipped"===i?"text-muted-foreground/50":"text-foreground"}`,children:s.name})]})]}),d<e.length-1&&(0,a.jsx)("span",{className:`mx-1.5 h-px w-6 ${"done"===r[d]?"bg-emerald-500/40":"bg-border"}`})]},s.id)})})}function Q({template:e,status:t,totalPhases:r,completedPhaseCount:n,rounds:s,enrichedRounds:d,prUrl:i,shipError:o}){return(0,a.jsx)("div",{className:"border-b border-border bg-card/20 px-4 py-3 sm:px-8",children:(0,a.jsxs)("div",{className:"mx-auto flex w-full flex-col gap-3",children:[i&&(0,a.jsxs)("div",{className:"rounded-md border border-emerald-500/40 bg-emerald-500/5 px-4 py-3",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-emerald-300",children:[(0,a.jsx)(b.A,{className:"h-4 w-4"}),"Pull request opened"]}),(0,a.jsx)("a",{href:i,target:"_blank",rel:"noreferrer",className:"rounded-md border border-emerald-500/40 bg-emerald-500/10 px-3 py-1.5 text-xs font-medium text-emerald-300 transition hover:bg-emerald-500/20",children:"View PR →"})]}),(0,a.jsx)("p",{className:"mt-1 break-all font-mono text-[11px] text-emerald-200/70",children:i})]}),o&&!i&&(0,a.jsxs)("div",{className:"rounded-md border border-amber-500/40 bg-amber-500/5 px-4 py-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm font-medium text-amber-300",children:[(0,a.jsx)(x.A,{className:"h-4 w-4"}),"Ship phase blocked"]}),(0,a.jsx)("p",{className:"mt-1 break-words font-mono text-[11px] text-amber-200/80",children:o}),(0,a.jsx)("p",{className:"mt-2 text-[11px] leading-relaxed text-muted-foreground",children:"The reviewers approved the doer's output, but chorus couldn't open a PR. Resolve the issue above and re-run."})]}),e?.phases&&e.phases.length>0&&(0,a.jsx)("div",{className:"flex justify-center",children:(0,a.jsx)(K,{phases:e.phases,activeIndex:Math.min(n,r-1),states:e.phases.map((e,r)=>"approved"===t?"done":"no_review"===t?r<n?"done":"blocked":"failed"===t||"cancelled"===t?r<n?"done":"skipped":r<n?"done":r===n?"active":"pending")})}),(0,a.jsx)(J,{template:e,status:t,totalPhases:r,completedPhaseCount:n,rounds:s,enrichedRounds:d})]})})}function J({template:e,status:t,totalPhases:r,completedPhaseCount:n,rounds:s,enrichedRounds:d}){let i=e?.maxRounds??1,o="approved"===t||"merged"===t||"no_review"===t||"blocked"===t||"failed"===t||"cancelled"===t,l=r>1,c=!l&&i>1,p=d[d.length-1],m=p?.participants.filter(e=>"reviewer"===e.role)??[],u=m.length,h=m.filter(e=>e.hasAnswer).length;if(!l&&!c&&!(!l&&!c&&u>1))return null;let x=l?r:c?i:u,g=l?Math.min(n,r):c?Math.min(Math.max(s.length,1),i):h,f=l&&o?x:g,b=l?`${f} / ${x} phases`:c?`Round ${f} / ${x}`:`${f} / ${x} complete`;return(0,a.jsxs)("div",{className:"mx-auto flex w-full max-w-xs items-center gap-2",children:[(0,a.jsx)("div",{className:"flex h-1 flex-1 overflow-hidden rounded-full bg-muted",children:(0,a.jsx)("div",{className:`transition-[width] duration-700 ease-out ${"approved"===t?"bg-emerald-400":"bg-primary"}`,style:{width:`${f/x*100}%`}})}),(0,a.jsx)("span",{className:"shrink-0 font-mono text-[10px] tabular-nums text-muted-foreground",children:b})]})}function Y({chatId:e,initialStatus:t,initialRounds:r,templateId:n,template:d,work:c,projectName:m,initialPrUrl:u,initialShipError:h,initialVerdict:x,demoDataSource:f}){var b,y;let[w,v]=(0,o.useState)(t),[k,A]=(0,o.useState)(x),[S,R]=(0,o.useState)(r),[_,I]=(0,o.useState)(new Set),[L,D]=(0,o.useState)(u),[O,U]=(0,o.useState)(h),[P,z]=(0,o.useState)({}),[V,F]=(0,o.useState)(-1),[H,W]=(0,o.useState)({}),[q,G]=(0,o.useState)([]),K=e=>`${e.round}:${e.phaseId}:${e.role}:${e.agent}:${e.fromLineage}:${e.fromModel}`,J=e=>{G(t=>{let r=new Set(t.map(K)),a=[...t];for(let t of e){let e=K(t);r.has(e)||(r.add(e),a.push(t))}return a})},B=C.includes(w);(0,o.useEffect)(()=>{if(B||f)return;let t=setInterval(async()=>{try{let t=await fetch(`/api/run-artifacts/${e}`);if(!t.ok)return;let r=await t.json();R(r.rounds),Array.isArray(r.swaps)&&r.swaps.length>0&&J(r.swaps)}catch{}},8e3);return()=>clearInterval(t)},[e,B,f]),(0,o.useEffect)(()=>{if(B)return;let t=f?f.createEventSource():new EventSource(`/api/daemon/chats/${e}/stream`);return t.onmessage=r=>{try{let a=JSON.parse(r.data),n=a.payload.role,s=a.payload.agent,d=a.payload.phaseId;if("phase_start"===a.type&&n&&s&&d&&(I(e=>{let t=new Set(e);return t.add(`${n}-${s}-${d}`),t}),f)){let e=f.fetchArtifacts();R(e.rounds),Array.isArray(e.swaps)&&J(e.swaps)}if("phase_progress"===a.type&&n&&s){let e=a.payload.output;if("string"==typeof e&&e.length>0){let t=`${n}-${s}`;z(r=>({...r,[t]:e}))}}if(("phase_done"===a.type||"phase_failed"===a.type)&&(I(new Set),"phase_done"===a.type)){let e=a.payload?.phaseIdx??-1;Number.isInteger(e)&&e>=0&&F(t=>e>t?e:t)}if("cli_warning"===a.type&&s&&n){let e="doer"===n?`doer-${s}`:`reviewer-${s}`,t=a.payload.reason??void 0,r=t??a.payload.kind??"warning",d=a.payload.message??"(no detail)";if(W(t=>{let n={...t},s=n[e]??[];return s.some(e=>e.kind===r&&e.message===d)?t:(n[e]=[...s,{kind:r,message:d,ts:a.ts??Date.now()}],n)}),("lineage_fallback"===t||"model_fallback"===t)&&"string"==typeof a.payload.fromLineage&&"string"==typeof a.payload.toLineage){let e=a.payload.round??1,r=a.payload.phaseId??"",d=a.payload.fromModel??"(default)",i=a.payload.toModel??"(default)",o=a.payload.fallbackIdx??0,l={round:e,phaseId:r,role:n,agent:s,reason:t,fromLineage:a.payload.fromLineage,toLineage:a.payload.toLineage,fromModel:d,toModel:i,fallbackIdx:o,ts:a.ts??Date.now()};G(e=>{let t=K(l);return e.some(e=>K(e)===t)?e:[...e,l]})}}if("participant_done"===a.type)if(f){let e=f.fetchArtifacts();R(e.rounds),Array.isArray(e.swaps)&&J(e.swaps)}else fetch(`/api/run-artifacts/${e}`).then(e=>e.ok?e.json():null).then(e=>{e&&(R(e.rounds),Array.isArray(e.swaps)&&J(e.swaps))}).catch(()=>{});if("chat_done"===a.type){let r=a.payload.status;"merged"===r?v("merged"):"blocked"===r?v("blocked"):"no_review"===r?v("no_review"):"failed"===r?v("failed"):"cancelled"===r?v("cancelled"):v("approved");let n=a.payload.verdict;"string"==typeof n&&n.length>0&&A(n);let s=a.payload.prUrl;"string"==typeof s&&s.length>0&&D(s);let d=a.payload.shipError;if("string"==typeof d&&d.length>0&&U(d),t.close(),f){let e=f.fetchArtifacts();R(e.rounds),Array.isArray(e.swaps)&&J(e.swaps)}else fetch(`/api/run-artifacts/${e}`).then(e=>e.ok?e.json():null).then(e=>{e&&(R(e.rounds),Array.isArray(e.swaps)&&J(e.swaps))}).catch(()=>{})}}catch{}},()=>t.close()},[e,B,f]),(0,o.useEffect)(()=>{if(f)return;let t=!1;return fetch(`/api/run-artifacts/${e}`).then(e=>e.ok?e.json():null).then(e=>{!t&&e&&Array.isArray(e.swaps)&&J(e.swaps)}).catch(()=>{}),()=>{t=!0}},[e,f]);let X=(b=w,y=k,"approved"===b&&y&&"approved"!==y?"request_changes"===y?{text:"REVIEW \xb7 CHANGES REQUESTED",color:"amber"}:{text:`REVIEW \xb7 ${y.toUpperCase()}`,color:"amber"}:$[b]??{text:b.toUpperCase(),color:"muted"}),Z=d?.phases?.length??1,ee=(0,o.useMemo)(()=>"approved"===w||"merged"===w||"no_review"===w||"blocked"===w?Z:"failed"===w||"cancelled"===w?0:Math.min(Math.max(0,V+1),Z),[w,Z,V]),et=(0,o.useMemo)(()=>(0,l.$)(d),[d]),er=(0,o.useMemo)(()=>(function(e,t,r){if(!t?.phases?.length)return e;let a=(0,l.$)(t),n=function(e,t){let r=e.phases[0],a=(e,t)=>t?.[0]??(0,g.YM)(e),n=[];if(!t){let e=r.doer.models?.[0],t=E(r.doer.lineage,e);n.push({role:"doer",lineage:t,model:e??a(t,r.doer.models)})}for(let[e,t]of(r.reviewer?.candidatesWithModels??[]).entries()){let r=t.models?.[0],s=E(t.lineage,r);n.push({role:"reviewer",lineage:s,model:r??a(s,t.models),reviewerIdx:e})}return n}(t,a);return e.map(e=>{let t=[],a=new Set;for(let s of n){let n="doer"===s.role?`doer-${s.lineage}`:`reviewer-${s.lineage}-${s.reviewerIdx}`,d=e.participants.find(e=>"doer"===s.role?"doer"===e.role&&e.lineage===s.lineage:"reviewer"===e.role&&e.lineage===s.lineage&&parseInt(e.participant.match(/-(\d+)$/)?.[1]??"0",10)===s.reviewerIdx);d?(t.push({...d,model:s.model,...r[d.participant]?{warnings:r[d.participant]}:{}}),a.add(d.participant)):t.push({participant:n,role:s.role,agentName:N[s.lineage]??s.lineage,lineage:s.lineage,hasAnswer:!1,model:s.model,pending:!0,...r[n]?{warnings:r[n]}:{}})}for(let n of e.participants)a.has(n.participant)||t.push({...n,...r[n.participant]?{warnings:r[n.participant]}:{}});return{...e,participants:t}})})(S,d,H),[S,d,H]),ea=er[er.length-1],en=er.slice(0,-1);return(0,a.jsxs)("div",{className:"flex h-full flex-col",children:[(0,a.jsxs)("div",{className:"sticky top-0 z-20 border-b border-border bg-card/80 backdrop-blur-sm px-4 py-3 sm:px-8",children:[(0,a.jsxs)("div",{className:"mb-2 flex w-full items-center justify-between gap-3",children:[(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,a.jsxs)(s(),{href:"/runs",className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground transition hover:text-foreground",children:[(0,a.jsx)(i,{className:"h-3 w-3"}),(0,a.jsx)("span",{children:m??"Runs"})]}),(0,a.jsx)("span",{className:"text-muted-foreground/40",children:"\xb7"}),(0,a.jsxs)("span",{title:X.text,className:"inline-flex shrink-0 items-center gap-1.5 text-[11px] uppercase tracking-wider text-muted-foreground",children:[(0,a.jsx)("span",{className:`h-2 w-2 shrink-0 rounded-full ${M[X.color]} ${B?"":"animate-pulse-soft"}`}),w]}),(d||n)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("span",{className:"text-muted-foreground/40",children:"\xb7"}),(0,a.jsxs)(s(),{href:`/templates${d?`#${encodeURIComponent(d.id)}`:""}`,title:d?`Template: ${d.name}`:`Template (deleted): ${n}`,className:"inline-flex min-w-0 shrink items-center gap-1.5 text-[11px] text-muted-foreground transition hover:text-primary",children:[(0,a.jsx)("span",{className:"font-mono uppercase tracking-wider",children:"tpl"}),(0,a.jsx)("span",{className:"truncate font-medium text-foreground",children:d?.name??n})]})]})]}),(0,a.jsx)(T,{chatId:e,status:w,isTerminal:B,template:d,onCancel:()=>v("cancelled")})]}),(0,a.jsx)("div",{className:"min-w-0",children:(0,a.jsx)(p,{work:c})})]}),(0,a.jsx)(Q,{template:d,status:w,totalPhases:Z,completedPhaseCount:ee,rounds:S,enrichedRounds:er,prUrl:L,shipError:O}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto px-4 py-6 sm:px-8",children:(0,a.jsxs)("div",{className:"mx-auto w-full space-y-8",children:[0===S.length&&(0,a.jsx)("div",{className:"rounded-lg border border-dashed border-border p-12 text-center text-sm text-muted-foreground",children:"Waiting for first phase to start…"}),ea&&(0,a.jsx)(j,{round:ea,isLatest:!0,activeFor:e=>{let t=`${e.participant}-`;for(let e of _)if(e.startsWith(t))return!0;return!1},liveTails:P,chatTerminal:B,reviewOnly:et,chatId:e,swaps:q}),!et&&en.length>0&&(0,a.jsxs)("details",{className:"rounded-lg border border-border bg-card",children:[(0,a.jsxs)("summary",{className:"cursor-pointer px-4 py-3 text-xs uppercase tracking-wider text-muted-foreground hover:text-foreground",children:["Earlier rounds (",en.length,")"]}),(0,a.jsx)("div",{className:"space-y-6 border-t border-border p-4",children:en.slice().reverse().map(e=>(0,a.jsx)(j,{round:e,activeFor:()=>!1,liveTails:{},chatTerminal:B,swaps:q},e.round))})]})]})})]})}},6289:(e,t,r)=>{r.d(t,{A:()=>a});let a=(0,r(3884).A)("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]])},7618:(e,t,r)=>{r.d(t,{A:()=>a});let a=(0,r(3884).A)("flask-conical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]])},8420:(e,t,r)=>{r.d(t,{A:()=>a});let a=(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"}]])},9208:(e,t,r)=>{r.d(t,{A:()=>a});let a=(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"}]])},9410:(e,t,r)=>{r.d(t,{A:()=>a});let a=(0,r(3884).A)("test-tube-diagonal",[["path",{d:"M21 7 6.82 21.18a2.83 2.83 0 0 1-3.99-.01a2.83 2.83 0 0 1 0-4L17 3",key:"1ub6xw"}],["path",{d:"m16 2 6 6",key:"1gw87d"}],["path",{d:"M12 16H4",key:"1cjfip"}]])},9707:(e,t,r)=>{r.d(t,{A:()=>a});let a=(0,r(3884).A)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},9812:(e,t,r)=>{r.d(t,{A:()=>a});let a=(0,r(3884).A)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]])}}]);