crosscheck-mcp 0.2.22 → 0.2.23

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.
@@ -2331,7 +2331,7 @@ import { z } from "zod";
2331
2331
  // src/server-meta.ts
2332
2332
  init_esm_shims();
2333
2333
  var SERVER_NAME = "crosscheck-agent";
2334
- var SERVER_VERSION = true ? "0.2.22" : "0.0.0-dev";
2334
+ var SERVER_VERSION = true ? "0.2.23" : "0.0.0-dev";
2335
2335
 
2336
2336
  // src/tools/audit.ts
2337
2337
  init_esm_shims();
@@ -10198,6 +10198,66 @@ function isObj6(v) {
10198
10198
 
10199
10199
  // src/tools/debate.ts
10200
10200
  init_esm_shims();
10201
+
10202
+ // src/core/debate-compaction.ts
10203
+ init_esm_shims();
10204
+ var DEFAULT_PRIOR_BUDGET_CHARS = 12e3;
10205
+ function renderTurn(e) {
10206
+ return `[${e.provider} \u2014 round ${e.round}]
10207
+ ${e.response ?? "(error)"}`;
10208
+ }
10209
+ function buildPriorTurns(transcript, opts = {}) {
10210
+ if (transcript.length === 0) {
10211
+ return { body: "", includedTurns: 0, omittedTurns: 0, chars: 0 };
10212
+ }
10213
+ const rendered = transcript.map(renderTurn);
10214
+ const full = rendered.join("\n\n");
10215
+ if (!opts.compress) {
10216
+ return { body: full, includedTurns: transcript.length, omittedTurns: 0, chars: full.length };
10217
+ }
10218
+ const budget = Math.max(0, opts.budgetChars ?? DEFAULT_PRIOR_BUDGET_CHARS);
10219
+ if (full.length <= budget) {
10220
+ return { body: full, includedTurns: transcript.length, omittedTurns: 0, chars: full.length };
10221
+ }
10222
+ const latestRound = Math.max(...transcript.map((e) => e.round));
10223
+ const keep = /* @__PURE__ */ new Set();
10224
+ let spent = 0;
10225
+ for (let i = transcript.length - 1; i >= 0; i -= 1) {
10226
+ const isLatest = transcript[i].round === latestRound;
10227
+ const cost = rendered[i].length + 2;
10228
+ if (isLatest) {
10229
+ keep.add(i);
10230
+ spent += cost;
10231
+ continue;
10232
+ }
10233
+ if (spent + cost > budget) continue;
10234
+ keep.add(i);
10235
+ spent += cost;
10236
+ }
10237
+ const parts = [];
10238
+ let omitted = 0;
10239
+ let pendingGap = 0;
10240
+ for (let i = 0; i < transcript.length; i += 1) {
10241
+ if (keep.has(i)) {
10242
+ if (pendingGap > 0) {
10243
+ parts.push(`[${pendingGap} earlier turn(s) omitted for length]`);
10244
+ pendingGap = 0;
10245
+ }
10246
+ parts.push(rendered[i]);
10247
+ } else {
10248
+ omitted += 1;
10249
+ pendingGap += 1;
10250
+ }
10251
+ }
10252
+ if (pendingGap > 0) parts.push(`[${pendingGap} earlier turn(s) omitted for length]`);
10253
+ const body = parts.join("\n\n");
10254
+ return { body, includedTurns: keep.size, omittedTurns: omitted, chars: body.length };
10255
+ }
10256
+ function buildModeratorTranscript(transcript) {
10257
+ return transcript.map(renderTurn).join("\n\n");
10258
+ }
10259
+
10260
+ // src/tools/debate.ts
10201
10261
  import { performance as performance10 } from "perf_hooks";
10202
10262
  var DEFERRED_OPTS4 = [
10203
10263
  // empty — every debate opt runs natively when its deps
@@ -10245,6 +10305,9 @@ async function runDebate(args, opts) {
10245
10305
  1,
10246
10306
  Math.trunc(Number(args["max_rounds"] ?? 3)) || 3
10247
10307
  );
10308
+ const compressRounds = args["compress_rounds"] === true;
10309
+ const priorBudgetChars = Math.trunc(Number(args["prior_budget_chars"] ?? DEFAULT_PRIOR_BUDGET_CHARS)) || DEFAULT_PRIOR_BUDGET_CHARS;
10310
+ let compactionMeta = null;
10248
10311
  const sessionId = typeof args["session_id"] === "string" ? args["session_id"] : null;
10249
10312
  const breakerEnv = await maybeBreakerEnvelope(
10250
10313
  opts.storage,
@@ -10355,7 +10418,7 @@ async function runDebate(args, opts) {
10355
10418
  const roundMessages = [
10356
10419
  {
10357
10420
  role: "system",
10358
- content: `You are debating peers from other model families. Round ${rnd}/${maxRounds}. Disagree where warranted, concede where right, and keep replies short and specific.`
10421
+ content: "You are debating peers from other model families. Disagree where warranted, concede where right, and keep replies short and specific."
10359
10422
  }
10360
10423
  ];
10361
10424
  if (context) {
@@ -10367,13 +10430,22 @@ ${context}` });
10367
10430
  TOPIC: ${topic}` : `TOPIC: ${topic}`;
10368
10431
  roundMessages.push({ role: "user", content: topicLine });
10369
10432
  if (transcript.length > 0) {
10370
- const prior = transcript.map(
10371
- (e) => `[${e.provider} \u2014 round ${e.round}]
10372
- ${e.response ?? "(error)"}`
10373
- ).join("\n\n");
10433
+ const prior = buildPriorTurns(transcript, {
10434
+ compress: compressRounds,
10435
+ budgetChars: priorBudgetChars
10436
+ });
10437
+ if (prior.omittedTurns > 0) compactionMeta = {
10438
+ omitted_turns: prior.omittedTurns,
10439
+ included_turns: prior.includedTurns,
10440
+ budget_chars: priorBudgetChars
10441
+ };
10374
10442
  roundMessages.push({ role: "user", content: `PRIOR TURNS:
10375
- ${prior}` });
10443
+ ${prior.body}` });
10376
10444
  }
10445
+ roundMessages.push({
10446
+ role: "user",
10447
+ content: `This is round ${rnd} of ${maxRounds}. Reply for this round.`
10448
+ });
10377
10449
  for (const p of selected) {
10378
10450
  const entry = await callPanelist(p, roundMessages);
10379
10451
  const withRound = { ...entry, round: rnd };
@@ -10421,10 +10493,7 @@ ${prior}` });
10421
10493
  let coReasoned = false;
10422
10494
  if (moderator) {
10423
10495
  const synthProvider = superRequested && opts.providers["anthropic"] ? retargetForSuper(opts.providers["anthropic"]) : upgraded ? retargetProvider(opts.providers["anthropic"], UPGRADE_MODEL) : moderator;
10424
- const condensed = transcript.map(
10425
- (e) => `[${e.provider} \u2014 round ${e.round}]
10426
- ${e.response ?? "(error)"}`
10427
- ).join("\n\n");
10496
+ const condensed = buildModeratorTranscript(transcript);
10428
10497
  const persona = buildPersonaInjection({
10429
10498
  toolName: "debate",
10430
10499
  prompt: topic,
@@ -10507,6 +10576,7 @@ ${condensed}`
10507
10576
  synthesis
10508
10577
  };
10509
10578
  if (personaMeta && personaMeta.used !== null) result["persona"] = personaMeta;
10579
+ if (compactionMeta) result["round_compaction"] = compactionMeta;
10510
10580
  if (upgraded) {
10511
10581
  result["reasoning_upgrade"] = {
10512
10582
  applied: true,
@@ -12840,7 +12910,7 @@ var CHECK_INTERVAL_SECONDS = 3 * 24 * 60 * 60;
12840
12910
  var DEFAULT_PACKAGE = "crosscheck-cli";
12841
12911
  var FETCH_TIMEOUT_MS = 3e3;
12842
12912
  function engineVersion() {
12843
- return true ? "0.2.22" : "0.0.0-dev";
12913
+ return true ? "0.2.23" : "0.0.0-dev";
12844
12914
  }
12845
12915
  function defaultUpdateCachePath() {
12846
12916
  const base = process.env["CROSSCHECK_DATA_DIR"] || path10.join(os.homedir() || os.tmpdir(), ".crosscheck");