@cjhyy/code-shell-arena 0.8.0

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 (102) hide show
  1. package/README.md +46 -0
  2. package/dist/arena.d.ts +45 -0
  3. package/dist/arena.js +362 -0
  4. package/dist/capability.d.ts +43 -0
  5. package/dist/capability.js +453 -0
  6. package/dist/context/context-tools.d.ts +16 -0
  7. package/dist/context/context-tools.js +272 -0
  8. package/dist/context/within-root.d.ts +7 -0
  9. package/dist/context/within-root.js +15 -0
  10. package/dist/detect-mode.d.ts +20 -0
  11. package/dist/detect-mode.js +78 -0
  12. package/dist/digest-builder.d.ts +25 -0
  13. package/dist/digest-builder.js +120 -0
  14. package/dist/index.d.ts +25 -0
  15. package/dist/index.js +23 -0
  16. package/dist/index.runtime.d.ts +13 -0
  17. package/dist/index.runtime.js +11 -0
  18. package/dist/iterate/convergence.d.ts +25 -0
  19. package/dist/iterate/convergence.js +103 -0
  20. package/dist/iterate/formats/index.d.ts +22 -0
  21. package/dist/iterate/formats/index.js +283 -0
  22. package/dist/iterate/index.d.ts +11 -0
  23. package/dist/iterate/index.js +9 -0
  24. package/dist/iterate/iterative-arena.d.ts +31 -0
  25. package/dist/iterate/iterative-arena.js +252 -0
  26. package/dist/iterate/parse.d.ts +42 -0
  27. package/dist/iterate/parse.js +123 -0
  28. package/dist/iterate/phases/argue.d.ts +22 -0
  29. package/dist/iterate/phases/argue.js +165 -0
  30. package/dist/iterate/phases/revise.d.ts +16 -0
  31. package/dist/iterate/phases/revise.js +62 -0
  32. package/dist/iterate/phases/tournament.d.ts +34 -0
  33. package/dist/iterate/phases/tournament.js +113 -0
  34. package/dist/iterate/tools/web-tools.d.ts +13 -0
  35. package/dist/iterate/tools/web-tools.js +54 -0
  36. package/dist/iterate/types.d.ts +152 -0
  37. package/dist/iterate/types.js +8 -0
  38. package/dist/ledger.d.ts +47 -0
  39. package/dist/ledger.js +159 -0
  40. package/dist/lenses/architecture.d.ts +5 -0
  41. package/dist/lenses/architecture.js +22 -0
  42. package/dist/lenses/engineering.d.ts +5 -0
  43. package/dist/lenses/engineering.js +22 -0
  44. package/dist/lenses/general.d.ts +5 -0
  45. package/dist/lenses/general.js +20 -0
  46. package/dist/lenses/index.d.ts +16 -0
  47. package/dist/lenses/index.js +47 -0
  48. package/dist/lenses/product.d.ts +5 -0
  49. package/dist/lenses/product.js +22 -0
  50. package/dist/model-presets.d.ts +23 -0
  51. package/dist/model-presets.js +44 -0
  52. package/dist/phases/adjudication.d.ts +25 -0
  53. package/dist/phases/adjudication.js +142 -0
  54. package/dist/phases/build-consensus.d.ts +30 -0
  55. package/dist/phases/build-consensus.js +85 -0
  56. package/dist/phases/claim-registry.d.ts +26 -0
  57. package/dist/phases/claim-registry.js +60 -0
  58. package/dist/phases/cross-review.d.ts +47 -0
  59. package/dist/phases/cross-review.js +224 -0
  60. package/dist/phases/debate-rounds.d.ts +28 -0
  61. package/dist/phases/debate-rounds.js +161 -0
  62. package/dist/phases/participant-research.d.ts +39 -0
  63. package/dist/phases/participant-research.js +322 -0
  64. package/dist/phases/planning-detail-expansion.d.ts +39 -0
  65. package/dist/phases/planning-detail-expansion.js +120 -0
  66. package/dist/planner.d.ts +28 -0
  67. package/dist/planner.js +312 -0
  68. package/dist/providers/docs.d.ts +7 -0
  69. package/dist/providers/docs.js +111 -0
  70. package/dist/providers/git.d.ts +8 -0
  71. package/dist/providers/git.js +174 -0
  72. package/dist/providers/index.d.ts +32 -0
  73. package/dist/providers/index.js +132 -0
  74. package/dist/providers/none.d.ts +7 -0
  75. package/dist/providers/none.js +11 -0
  76. package/dist/providers/repo.d.ts +7 -0
  77. package/dist/providers/repo.js +258 -0
  78. package/dist/render/session.d.ts +17 -0
  79. package/dist/render/session.js +190 -0
  80. package/dist/render/terminal.d.ts +34 -0
  81. package/dist/render/terminal.js +286 -0
  82. package/dist/strategies/discussion.d.ts +25 -0
  83. package/dist/strategies/discussion.js +143 -0
  84. package/dist/strategies/index.d.ts +15 -0
  85. package/dist/strategies/index.js +28 -0
  86. package/dist/strategies/language-wrapper.d.ts +17 -0
  87. package/dist/strategies/language-wrapper.js +102 -0
  88. package/dist/strategies/lens-wrapper.d.ts +16 -0
  89. package/dist/strategies/lens-wrapper.js +236 -0
  90. package/dist/strategies/planning.d.ts +30 -0
  91. package/dist/strategies/planning.js +225 -0
  92. package/dist/strategies/review.d.ts +26 -0
  93. package/dist/strategies/review.js +168 -0
  94. package/dist/strategies/utils.d.ts +36 -0
  95. package/dist/strategies/utils.js +603 -0
  96. package/dist/tools/selector.d.ts +17 -0
  97. package/dist/tools/selector.js +61 -0
  98. package/dist/transitions.d.ts +53 -0
  99. package/dist/transitions.js +97 -0
  100. package/dist/types.d.ts +518 -0
  101. package/dist/types.js +27 -0
  102. package/package.json +45 -0
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Convergence detection — when has the draft stabilized enough to stop?
3
+ */
4
+ /**
5
+ * Cheap O(n) approximation of "how different is new vs old".
6
+ * Returns 0..1 where 0 = identical, 1 = completely different.
7
+ *
8
+ * Uses character-trigram Jaccard distance — fast, good enough for "is the
9
+ * author actually changing anything substantial?".
10
+ */
11
+ export function diffRatio(a, b) {
12
+ if (a === b)
13
+ return 0;
14
+ if (!a || !b)
15
+ return 1;
16
+ const trigrams = (s) => {
17
+ const out = new Set();
18
+ for (let i = 0; i < s.length - 2; i++)
19
+ out.add(s.slice(i, i + 3));
20
+ return out;
21
+ };
22
+ const A = trigrams(a);
23
+ const B = trigrams(b);
24
+ let inter = 0;
25
+ for (const t of A)
26
+ if (B.has(t))
27
+ inter++;
28
+ const union = A.size + B.size - inter;
29
+ if (union === 0)
30
+ return 0;
31
+ const jaccard = inter / union; // similarity
32
+ return 1 - jaccard;
33
+ }
34
+ /**
35
+ * Default convergence rule:
36
+ * stop if blockers == 0 AND
37
+ * (all critiques are minor/nit/praise OR diff < 5% from last version)
38
+ *
39
+ * Round 1 never converges (need at least one revision pass).
40
+ */
41
+ export function defaultConvergence(args) {
42
+ const { round, critiques, draft, previousDraft } = args;
43
+ const blockerCount = critiques.filter((c) => c.severity === "blocker").length;
44
+ const majorCount = critiques.filter((c) => c.severity === "major").length;
45
+ const totalCritiques = critiques.length;
46
+ const diffFromPrevious = previousDraft ? diffRatio(previousDraft.content, draft.content) : 1;
47
+ // Round 1 (the v1) — always do at least one revision pass, never converge here.
48
+ if (round === 1) {
49
+ return {
50
+ blockerCount,
51
+ majorCount,
52
+ totalCritiques,
53
+ diffFromPrevious,
54
+ shouldStop: false,
55
+ reason: "running",
56
+ };
57
+ }
58
+ // Special case: zero critiques is almost always a parsing/timeout failure
59
+ // on the critic side, NOT a sign of convergence. Treat as "running" so
60
+ // the next round has a chance — the loop will naturally stop at maxRounds.
61
+ if (totalCritiques === 0) {
62
+ return {
63
+ blockerCount,
64
+ majorCount,
65
+ totalCritiques,
66
+ diffFromPrevious,
67
+ shouldStop: false,
68
+ reason: "running",
69
+ };
70
+ }
71
+ // Hard floor: no blockers AND no majors → all that's left is polish.
72
+ // Require at least 3 critiques so a single low-effort response can't
73
+ // declare false convergence.
74
+ if (blockerCount === 0 && majorCount === 0 && totalCritiques >= 3) {
75
+ return {
76
+ blockerCount,
77
+ majorCount,
78
+ totalCritiques,
79
+ diffFromPrevious,
80
+ shouldStop: true,
81
+ reason: "all_minor_or_praise",
82
+ };
83
+ }
84
+ // Soft floor: no blockers AND draft barely moved → author is stuck or done.
85
+ if (blockerCount === 0 && diffFromPrevious < 0.05) {
86
+ return {
87
+ blockerCount,
88
+ majorCount,
89
+ totalCritiques,
90
+ diffFromPrevious,
91
+ shouldStop: true,
92
+ reason: "blockers_zero_and_stable",
93
+ };
94
+ }
95
+ return {
96
+ blockerCount,
97
+ majorCount,
98
+ totalCritiques,
99
+ diffFromPrevious,
100
+ shouldStop: false,
101
+ reason: "running",
102
+ };
103
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Format packs — prompt templates for code vs document iteration.
3
+ *
4
+ * Each format provides four prompt builders:
5
+ * - draftPrompt: used in tournament v1 (every participant writes a candidate)
6
+ * - mergePrompt: used in v1 merge (author reads anonymized candidates → v1)
7
+ * - argueSystem: system prompt for critics
8
+ * - argueUser: user prompt that wraps the current draft for critique
9
+ * - revisePrompt: used to produce v(N+1) given v(N) + critiques
10
+ */
11
+ import type { Critique, Draft, DraftCandidate, IterateFormat, IterateSubject } from "../types.js";
12
+ export interface FormatPack {
13
+ format: IterateFormat;
14
+ draftPrompt(subject: IterateSubject, minLength: number): string;
15
+ mergePrompt(subject: IterateSubject, candidates: DraftCandidate[], minLength: number): string;
16
+ argueSystem(format: IterateFormat): string;
17
+ argueUser(subject: IterateSubject, draft: Draft, lens?: string): string;
18
+ revisePrompt(subject: IterateSubject, previous: Draft, critiques: Critique[], minLength: number): string;
19
+ }
20
+ export declare const codeFormat: FormatPack;
21
+ export declare const documentFormat: FormatPack;
22
+ export declare function getFormat(format: IterateFormat): FormatPack;
@@ -0,0 +1,283 @@
1
+ /**
2
+ * Format packs — prompt templates for code vs document iteration.
3
+ *
4
+ * Each format provides four prompt builders:
5
+ * - draftPrompt: used in tournament v1 (every participant writes a candidate)
6
+ * - mergePrompt: used in v1 merge (author reads anonymized candidates → v1)
7
+ * - argueSystem: system prompt for critics
8
+ * - argueUser: user prompt that wraps the current draft for critique
9
+ * - revisePrompt: used to produce v(N+1) given v(N) + critiques
10
+ */
11
+ const COMMON_DRAFT_RULES = `
12
+ Hard rules:
13
+ - Output the FULL artifact, not a sketch or outline.
14
+ - No "...", "(continued)", "see above", "TBD", or placeholders.
15
+ - Don't pad with filler. Every section must carry information.
16
+ - Length is a floor, not a target — go beyond it if the topic warrants.
17
+
18
+ Factual discipline (CRITICAL — fabrication = blocker-level defect):
19
+ - Do NOT invent specific numbers, percentages, dollar amounts, market sizes,
20
+ user-research counts, or "industry averages" you cannot verify.
21
+ - Do NOT invent URLs, report IDs, document numbers, citation references.
22
+ - Do NOT invent named people, companies, or product code-names.
23
+ - For unknowable specifics, write a placeholder with the exact form:
24
+ [需调研: 具体说明] e.g. "[需调研: 实际行业流失率基准]"
25
+ [TBD: short reason] e.g. "[TBD: confirm Stripe rate limits]"
26
+ These placeholders are EXPECTED. Reviewers will not fault you for them.
27
+ - General qualitative claims are fine ("annual growth typically in the
28
+ double digits"); specific numbers without a verifiable source are NOT.
29
+ - If you have web-search tools available, USE them before stating any
30
+ specific number or citing any source.
31
+ `;
32
+ function formatCritiquesForPrompt(critiques) {
33
+ return critiques
34
+ .map((c, i) => `[${i + 1}] id=${c.id} severity=${c.severity} category=${c.category} from=${c.critic}\n` +
35
+ ` anchor: "${c.anchor}"\n` +
36
+ ` comment: ${c.comment}` +
37
+ (c.suggestion ? `\n suggestion: ${c.suggestion}` : ""))
38
+ .join("\n\n");
39
+ }
40
+ // ─── Code format ────────────────────────────────────────────────
41
+ export const codeFormat = {
42
+ format: "code",
43
+ draftPrompt(subject, minLength) {
44
+ return `You are writing a complete code artifact for the following task.
45
+
46
+ Task: ${subject.label}
47
+ Description: ${subject.description}
48
+ ${subject.sources?.length ? `Source files for context: ${subject.sources.join(", ")}` : ""}
49
+
50
+ This draft will compete with drafts from other participants in a tournament round.
51
+ A merger will then read all drafts (anonymously) and pick the strongest parts.
52
+ Make your draft strong, distinct, complete, and self-contained.
53
+
54
+ Output requirements:
55
+ - Compile-ready code in the appropriate language (infer from sources / description).
56
+ - Include tests if behavior is non-trivial.
57
+ - Inline comments only where the WHY is non-obvious — names should explain WHAT.
58
+ - At least ${minLength} characters of substantive code (filler will be cut by the merger).
59
+ ${COMMON_DRAFT_RULES}`;
60
+ },
61
+ mergePrompt(subject, candidates, minLength) {
62
+ const blocks = candidates
63
+ .map((c) => `--- ${c.anonymousLabel} ---\n${c.content}\n--- end ${c.anonymousLabel} ---`)
64
+ .join("\n\n");
65
+ return `Below are ${candidates.length} draft solutions for the same task, presented anonymously.
66
+ Your job: produce a single v1 by merging the strongest parts of each.
67
+
68
+ Task: ${subject.label}
69
+ Description: ${subject.description}
70
+
71
+ ${blocks}
72
+
73
+ Merging rules:
74
+ - For each section / function / module, pick the strongest version OR write a new one inspired by the best ideas.
75
+ - Inline EVERYTHING. Do not write "see Draft B for the auth helper" — copy the auth helper in.
76
+ - v1 must be COMPLETE and at least ${minLength} characters of substantive code.
77
+ - After the code, output a 'mergeRationale' section: one short paragraph per major decision, "From Draft X I took ____, because ____. I rejected ____ because ____."
78
+
79
+ Output format (literally — these markers will be parsed):
80
+
81
+ <v1_content>
82
+ {full code goes here}
83
+ </v1_content>
84
+
85
+ <merge_rationale>
86
+ {your rationale here}
87
+ </merge_rationale>`;
88
+ },
89
+ argueSystem() {
90
+ return `You are reviewing a code artifact. Find every meaningful issue.
91
+
92
+ You may have access to a web_search tool — USE IT to verify any specific
93
+ claim, library version, API behavior, or external reference made in the
94
+ draft before deciding whether it's a fabrication.
95
+
96
+ For each issue:
97
+ - "anchor": quote 5-15 words verbatim from the draft to locate the issue.
98
+ - "severity": "blocker" (must fix), "major" (should fix), "minor" (nice to fix), "nit" (style), or "praise" (good — don't gut this).
99
+ - "category": "correctness" | "completeness" | "clarity" | "evidence" | "structure" | "style" | "fabrication" | "other".
100
+ - "comment": what's wrong and what you'd do. If you used web_search, cite the URL.
101
+ - "suggestion": optional concrete fix.
102
+ - "evidence": optional array of {url, snippet} pairs supporting your critique.
103
+
104
+ FABRICATION DETECTION (top priority):
105
+ Any specific number, citation, URL, version string, API endpoint, library
106
+ function, or named entity that you cannot verify is a "fabrication"
107
+ critique with severity = "blocker". Be especially suspicious of:
108
+ - "Industry average is X%" / "Surveys show N=..."
109
+ - Documentation URLs with suspiciously generic paths
110
+ - Library/API names that "sound right" but you can't confirm exist
111
+
112
+ Aim for 8-20 critiques. Include PRAISE for parts that are genuinely good — this prevents the author from accidentally gutting them in the next revision.
113
+
114
+ Output strictly as JSON: {"critiques": [{...}, ...]}`;
115
+ },
116
+ argueUser(subject, draft, lens) {
117
+ return `Task: ${subject.label}
118
+ ${lens ? `Review lens: ${lens}\n` : ""}
119
+ Current draft (v${draft.version}, by ${draft.author}):
120
+
121
+ ${draft.content}
122
+
123
+ Now produce your critiques as JSON.`;
124
+ },
125
+ revisePrompt(subject, previous, critiques, minLength) {
126
+ return `You wrote v${previous.version}. Critics raised ${critiques.length} points.
127
+ Rewrite the artifact as v${previous.version + 1}.
128
+
129
+ Task: ${subject.label}
130
+ Description: ${subject.description}
131
+
132
+ Current draft (v${previous.version}):
133
+ ${previous.content}
134
+
135
+ Critiques:
136
+ ${formatCritiquesForPrompt(critiques)}
137
+
138
+ Rules:
139
+ - ADDRESS every blocker and major. You may disagree, but say why in changelog.
140
+ - Preserve PRAISE-tagged parts unless a later critique contradicts.
141
+ - Output the COMPLETE new artifact (at least ${minLength} chars), not a diff.
142
+ - After the code, output a JSON block:
143
+
144
+ <v_next_content>
145
+ {full code goes here}
146
+ </v_next_content>
147
+
148
+ <v_next_meta>
149
+ {
150
+ "acceptedCritiques": ["id1", "id2", ...],
151
+ "rejectedCritiques": [{"id": "id3", "reason": "..."}, ...],
152
+ "changelog": "what changed and why, in 1-3 short paragraphs"
153
+ }
154
+ </v_next_meta>`;
155
+ },
156
+ };
157
+ // ─── Document format ────────────────────────────────────────────
158
+ export const documentFormat = {
159
+ format: "document",
160
+ draftPrompt(subject, minLength) {
161
+ return `You are writing a complete long-form document for the following subject.
162
+
163
+ Subject: ${subject.label}
164
+ Description: ${subject.description}
165
+ ${subject.sources?.length ? `Reference materials: ${subject.sources.join(", ")}` : ""}
166
+
167
+ This draft will compete with drafts from other participants in a tournament round.
168
+ A merger will then read all drafts (anonymously) and pick the strongest parts.
169
+ Make your draft strong, distinct, complete, and self-contained.
170
+
171
+ Document requirements:
172
+ - Use clear hierarchical structure (## sections, ### subsections).
173
+ - Every section must carry concrete information: examples, comparisons, trade-offs, numbers.
174
+ - Cite sources inline with [n] footnotes when you make factual claims.
175
+ - At least ${minLength} characters of substantive prose (filler will be cut by the merger).
176
+ ${COMMON_DRAFT_RULES}`;
177
+ },
178
+ mergePrompt(subject, candidates, minLength) {
179
+ const blocks = candidates
180
+ .map((c) => `--- ${c.anonymousLabel} ---\n${c.content}\n--- end ${c.anonymousLabel} ---`)
181
+ .join("\n\n");
182
+ return `Below are ${candidates.length} draft documents for the same subject, presented anonymously.
183
+ Your job: produce a single v1 markdown document by merging the strongest parts.
184
+
185
+ Subject: ${subject.label}
186
+ Description: ${subject.description}
187
+
188
+ ${blocks}
189
+
190
+ Merging rules:
191
+ - Pick the strongest section from each draft, OR write a new section that combines their best ideas.
192
+ - DO NOT write "see Draft B for ____" — inline everything.
193
+ - The final v1 must be COMPLETE and at least ${minLength} characters.
194
+ - Maintain coherent voice and consistent structure across sections.
195
+
196
+ Output format (literally — these markers will be parsed):
197
+
198
+ <v1_content>
199
+ {full markdown document}
200
+ </v1_content>
201
+
202
+ <merge_rationale>
203
+ {1-3 short paragraphs: from which draft you took which section, why; what you rejected, why}
204
+ </merge_rationale>`;
205
+ },
206
+ argueSystem() {
207
+ return `You are reviewing a long-form document. Find every meaningful issue.
208
+
209
+ You may have access to a web_search tool — USE IT to verify any specific
210
+ number, citation, market figure, named survey, or external reference
211
+ before deciding whether it's a fabrication.
212
+
213
+ For each issue:
214
+ - "anchor": quote 5-15 words verbatim from the document to locate the issue.
215
+ - "severity": "blocker" | "major" | "minor" | "nit" | "praise".
216
+ - "category": "correctness" | "completeness" | "clarity" | "evidence" | "structure" | "style" | "fabrication" | "other".
217
+ - "comment": what's wrong / missing / weak. If you used web_search, cite the URL.
218
+ - "suggestion": optional concrete fix or content to add.
219
+ - "evidence": optional array of {url, snippet} pairs supporting your critique.
220
+
221
+ FABRICATION DETECTION (top priority):
222
+ The document is far more likely to fail because of fabricated facts than
223
+ because of missing sections. Treat every specific number / report ID /
224
+ URL / dollar figure / "industry average" / named survey as suspect until
225
+ verified. Mark as severity = "blocker" if:
226
+ - The number cannot be found via web_search.
227
+ - The cited URL doesn't resolve to the claimed source.
228
+ - The "report ID" / "document number" appears made up.
229
+ - The named survey / interviewee count cannot be traced.
230
+ A draft full of citations that don't check out is worse than a draft
231
+ that honestly writes "[需调研: ...]". Reward the latter.
232
+
233
+ Aim for 8-20 critiques. Don't be polite — depth, missing sections, weak claims, and structural issues matter more than typos. Include PRAISE for genuinely strong parts so the author doesn't gut them on revision.
234
+
235
+ Output strictly as JSON: {"critiques": [{...}, ...]}`;
236
+ },
237
+ argueUser(subject, draft, lens) {
238
+ return `Subject: ${subject.label}
239
+ ${lens ? `Review lens: ${lens}\n` : ""}
240
+ Current document (v${draft.version}, by ${draft.author}):
241
+
242
+ ${draft.content}
243
+
244
+ Now produce your critiques as JSON.`;
245
+ },
246
+ revisePrompt(subject, previous, critiques, minLength) {
247
+ return `You wrote v${previous.version}. Critics raised ${critiques.length} points.
248
+ Rewrite the document as v${previous.version + 1}.
249
+
250
+ Subject: ${subject.label}
251
+ Description: ${subject.description}
252
+
253
+ Current document (v${previous.version}):
254
+ ${previous.content}
255
+
256
+ Critiques:
257
+ ${formatCritiquesForPrompt(critiques)}
258
+
259
+ Rules:
260
+ - ADDRESS every blocker and major. You may disagree, but say why in changelog.
261
+ - Preserve PRAISE-tagged parts.
262
+ - Expand sections that were called out as thin / missing examples / lacking evidence.
263
+ - Output the COMPLETE new document (at least ${minLength} chars).
264
+
265
+ Output format (literally — these markers will be parsed):
266
+
267
+ <v_next_content>
268
+ {full markdown document}
269
+ </v_next_content>
270
+
271
+ <v_next_meta>
272
+ {
273
+ "acceptedCritiques": ["id1", "id2", ...],
274
+ "rejectedCritiques": [{"id": "id3", "reason": "..."}, ...],
275
+ "changelog": "what changed and why, in 1-3 short paragraphs"
276
+ }
277
+ </v_next_meta>`;
278
+ },
279
+ };
280
+ // ─── Selector ───────────────────────────────────────────────────
281
+ export function getFormat(format) {
282
+ return format === "code" ? codeFormat : documentFormat;
283
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Arena Iterate — multi-model authoring loop.
3
+ *
4
+ * Public API for the iterate mode.
5
+ */
6
+ export { IterativeArena } from "./iterative-arena.js";
7
+ export { defaultConvergence, diffRatio } from "./convergence.js";
8
+ export { codeFormat, documentFormat, getFormat } from "./formats/index.js";
9
+ export type { FormatPack } from "./formats/index.js";
10
+ export type { AuthorRotation, CheckpointAction, CheckpointContext, CheckpointFn, ConvergenceSignal, Critique, CritiqueCategory, CritiqueEvidence, CritiqueSeverity, Draft, DraftCandidate, IterateConfig, IterateFormat, IterateProgressEvent, IterateResult, IterateSubject, Round, StoppedReason, } from "./types.js";
11
+ export { ITERATE_WEB_TOOLS, hasWebSearchProvider } from "./tools/web-tools.js";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Arena Iterate — multi-model authoring loop.
3
+ *
4
+ * Public API for the iterate mode.
5
+ */
6
+ export { IterativeArena } from "./iterative-arena.js";
7
+ export { defaultConvergence, diffRatio } from "./convergence.js";
8
+ export { codeFormat, documentFormat, getFormat } from "./formats/index.js";
9
+ export { ITERATE_WEB_TOOLS, hasWebSearchProvider } from "./tools/web-tools.js";
@@ -0,0 +1,31 @@
1
+ /**
2
+ * IterativeArena — multi-model authoring loop.
3
+ *
4
+ * Pipeline:
5
+ * 1. v1: tournament (default) or single-author
6
+ * 2. for each round 2..maxRounds:
7
+ * a. argue (parallel critics)
8
+ * b. checkpoint (optional human pause)
9
+ * c. convergence check
10
+ * d. if not converged: revise → next round
11
+ * 3. final draft = last round's draft
12
+ */
13
+ import type { IterateConfig, IterateResult } from "./types.js";
14
+ export declare class IterativeArena {
15
+ private readonly config;
16
+ constructor(config: IterateConfig);
17
+ run(): Promise<IterateResult>;
18
+ /**
19
+ * Critics for a round = the whole pool minus whoever wrote the draft under
20
+ * review, so nobody critiques their own text.
21
+ *
22
+ * This used to return `config.critics` verbatim, ignoring rotation. Once
23
+ * `round-robin`/`best-critic` promoted critic B to author, B kept reviewing
24
+ * the draft B had just written, while the original author A never entered the
25
+ * critic pool at all — the exact opposite of the intent documented here.
26
+ */
27
+ private criticsForRound;
28
+ private checkConvergence;
29
+ private pickNextAuthor;
30
+ private finalize;
31
+ }