@kernlang/agon 0.1.2 → 0.1.4

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.
@@ -1,6 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
- ENGINE_COLORS,
3
+ stripReasoning,
4
+ stripTuiChrome
5
+ } from "./chunk-6ANHPXGZ.js";
6
+ import {
4
7
  filterDefaultOrchestrationEngines,
5
8
  getSessionAllowList,
6
9
  handleCesarBrain,
@@ -9,7 +12,10 @@ import {
9
12
  runDelegate,
10
13
  runForge,
11
14
  runTribunal
12
- } from "./chunk-IA4AR2R4.js";
15
+ } from "./chunk-FCCH7IPJ.js";
16
+ import {
17
+ ENGINE_COLORS
18
+ } from "./chunk-WE32YJKT.js";
13
19
  import {
14
20
  AgentSession,
15
21
  AgentTeam,
@@ -49,7 +55,7 @@ import {
49
55
  spawnWithTimeout,
50
56
  tracker,
51
57
  worktreeChangedDiff
52
- } from "./chunk-7PMMOQZ7.js";
58
+ } from "./chunk-C22VTCS6.js";
53
59
 
54
60
  // src/generated/handlers/plan-mode.ts
55
61
  import { writeFileSync as writeFileSync2, mkdirSync as mkdirSync3 } from "fs";
@@ -194,98 +200,6 @@ function buildConsensus(outcomes, minVerified, minPair) {
194
200
  };
195
201
  }
196
202
 
197
- // src/generated/blocks/engine-helpers.ts
198
- function parseToolInputPayload(input) {
199
- const rawInput = String(input ?? "");
200
- let parsed = {};
201
- try {
202
- if (rawInput.trim().startsWith("{")) {
203
- parsed = JSON.parse(rawInput);
204
- }
205
- } catch (e) {
206
- parsed = {};
207
- }
208
- return { rawInput, parsed };
209
- }
210
- function extractPatchText(rawInput, parsed) {
211
- const values = [parsed?.patch, parsed?.content, parsed?.diff, parsed?.input].filter((value) => typeof value === "string" && value.trim().length > 0);
212
- const fromParsed = values.find((value) => value.includes("*** Begin Patch") || value.includes("diff --git") || value.split("\n").some((line) => line.startsWith("@@")));
213
- if (fromParsed) {
214
- return fromParsed;
215
- }
216
- if (rawInput.includes("*** Begin Patch") || rawInput.includes("diff --git") || rawInput.split("\n").some((line) => line.startsWith("@@"))) {
217
- return rawInput;
218
- }
219
- return values[0] ?? "";
220
- }
221
- function parsePatchPreview(rawInput, parsed) {
222
- const patchText = extractPatchText(rawInput, parsed);
223
- const files = [];
224
- const lines = [];
225
- let additions = 0;
226
- let deletions = 0;
227
- const addFile = (filePath) => {
228
- const clean = filePath.trim().replace(/^["']|["']$/g, "");
229
- if (clean && !files.includes(clean)) files.push(clean);
230
- };
231
- for (const line of patchText.split("\n")) {
232
- const customFile = line.match(/^\*\*\* (?:Update|Add|Delete) File: (.+)$/);
233
- if (customFile) {
234
- addFile(customFile[1]);
235
- continue;
236
- }
237
- const diffFile = line.match(/^diff --git a\/(.+?) b\/(.+)$/);
238
- if (diffFile) {
239
- addFile(diffFile[2]);
240
- continue;
241
- }
242
- if (line.startsWith("+++ b/")) {
243
- addFile(line.slice("+++ b/".length));
244
- continue;
245
- }
246
- if (line.startsWith("--- a/")) {
247
- addFile(line.slice("--- a/".length));
248
- continue;
249
- }
250
- if (line.startsWith("@@")) {
251
- lines.push(line);
252
- continue;
253
- }
254
- if (line.startsWith("+") && !line.startsWith("+++")) {
255
- additions += 1;
256
- lines.push(line);
257
- continue;
258
- }
259
- if (line.startsWith("-") && !line.startsWith("---")) {
260
- deletions += 1;
261
- lines.push(line);
262
- }
263
- }
264
- return { files, lines, additions, deletions };
265
- }
266
- function extractSummary(text, maxLen) {
267
- let s = text.replace(/<think>[\s\S]*?<\/think>\s*/gi, "");
268
- s = s.replace(/^#+\s+.+\n/gm, "");
269
- s = s.replace(/^\s*[-*]\s+/gm, "");
270
- s = s.replace(/\*\*/g, "");
271
- s = s.trim();
272
- const firstSentence = s.match(/^[^.!?\n]{10,}[.!?]/);
273
- const summary = firstSentence ? firstSentence[0] : s.slice(0, maxLen);
274
- return summary.length > maxLen ? summary.slice(0, maxLen - 1) + "\u2026" : summary;
275
- }
276
- function stripReasoning(text) {
277
- return text.replace(/<(think|thinking|reasoning)>[\s\S]*?<\/\1>\s*/gi, "").trim();
278
- }
279
- function stripTuiChrome(text) {
280
- const hadChrome = /[·✢✳✶✻✽⎿]/.test(text);
281
- let s = text.replace(/[·✢✳✴✵✶✷✸✹✺✻✼✽✾⎿]/g, "").replace(/❯/g, "");
282
- if (hadChrome) {
283
- s = s.replace(/[A-Z][^\n…]{0,40}…/g, "");
284
- s = s.replace(/^[\s\d%]+/, "");
285
- }
286
- return s.replace(/[ \t]{2,}/g, " ").replace(/\n{3,}/g, "\n\n").trim();
287
- }
288
-
289
203
  // src/generated/handlers/review.ts
290
204
  function resolveReviewTarget(target, cwd) {
291
205
  const t = (target ?? "uncommitted").trim();
@@ -2709,9 +2623,6 @@ ${tResult.summary}` },
2709
2623
 
2710
2624
  export {
2711
2625
  buildConsensus,
2712
- parseToolInputPayload,
2713
- parsePatchPreview,
2714
- extractSummary,
2715
2626
  resolveReviewTarget,
2716
2627
  selectReviewEngine,
2717
2628
  extractReviewFindings,
@@ -2724,4 +2635,4 @@ export {
2724
2635
  handleExitPlanMode,
2725
2636
  buildStepExecutors
2726
2637
  };
2727
- //# sourceMappingURL=chunk-GLQ5IQ5X.js.map
2638
+ //# sourceMappingURL=chunk-O6YP55RV.js.map