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.
@@ -1411,7 +1411,7 @@ import { z } from "zod";
1411
1411
 
1412
1412
  // src/server-meta.ts
1413
1413
  var SERVER_NAME = "crosscheck-agent";
1414
- var SERVER_VERSION = true ? "0.2.22" : "0.0.0-dev";
1414
+ var SERVER_VERSION = true ? "0.2.23" : "0.0.0-dev";
1415
1415
 
1416
1416
  // src/tools/audit.ts
1417
1417
  import { readdirSync, readFileSync as readFileSync3, statSync } from "fs";
@@ -9205,6 +9205,63 @@ function isObj6(v) {
9205
9205
  return typeof v === "object" && v !== null && !Array.isArray(v);
9206
9206
  }
9207
9207
 
9208
+ // src/core/debate-compaction.ts
9209
+ var DEFAULT_PRIOR_BUDGET_CHARS = 12e3;
9210
+ function renderTurn(e) {
9211
+ return `[${e.provider} \u2014 round ${e.round}]
9212
+ ${e.response ?? "(error)"}`;
9213
+ }
9214
+ function buildPriorTurns(transcript, opts = {}) {
9215
+ if (transcript.length === 0) {
9216
+ return { body: "", includedTurns: 0, omittedTurns: 0, chars: 0 };
9217
+ }
9218
+ const rendered = transcript.map(renderTurn);
9219
+ const full = rendered.join("\n\n");
9220
+ if (!opts.compress) {
9221
+ return { body: full, includedTurns: transcript.length, omittedTurns: 0, chars: full.length };
9222
+ }
9223
+ const budget = Math.max(0, opts.budgetChars ?? DEFAULT_PRIOR_BUDGET_CHARS);
9224
+ if (full.length <= budget) {
9225
+ return { body: full, includedTurns: transcript.length, omittedTurns: 0, chars: full.length };
9226
+ }
9227
+ const latestRound = Math.max(...transcript.map((e) => e.round));
9228
+ const keep = /* @__PURE__ */ new Set();
9229
+ let spent = 0;
9230
+ for (let i = transcript.length - 1; i >= 0; i -= 1) {
9231
+ const isLatest = transcript[i].round === latestRound;
9232
+ const cost = rendered[i].length + 2;
9233
+ if (isLatest) {
9234
+ keep.add(i);
9235
+ spent += cost;
9236
+ continue;
9237
+ }
9238
+ if (spent + cost > budget) continue;
9239
+ keep.add(i);
9240
+ spent += cost;
9241
+ }
9242
+ const parts = [];
9243
+ let omitted = 0;
9244
+ let pendingGap = 0;
9245
+ for (let i = 0; i < transcript.length; i += 1) {
9246
+ if (keep.has(i)) {
9247
+ if (pendingGap > 0) {
9248
+ parts.push(`[${pendingGap} earlier turn(s) omitted for length]`);
9249
+ pendingGap = 0;
9250
+ }
9251
+ parts.push(rendered[i]);
9252
+ } else {
9253
+ omitted += 1;
9254
+ pendingGap += 1;
9255
+ }
9256
+ }
9257
+ if (pendingGap > 0) parts.push(`[${pendingGap} earlier turn(s) omitted for length]`);
9258
+ const body = parts.join("\n\n");
9259
+ return { body, includedTurns: keep.size, omittedTurns: omitted, chars: body.length };
9260
+ }
9261
+ function buildModeratorTranscript(transcript) {
9262
+ return transcript.map(renderTurn).join("\n\n");
9263
+ }
9264
+
9208
9265
  // src/tools/debate.ts
9209
9266
  import { performance as performance10 } from "perf_hooks";
9210
9267
  var DEFERRED_OPTS4 = [
@@ -9253,6 +9310,9 @@ async function runDebate(args, opts) {
9253
9310
  1,
9254
9311
  Math.trunc(Number(args["max_rounds"] ?? 3)) || 3
9255
9312
  );
9313
+ const compressRounds = args["compress_rounds"] === true;
9314
+ const priorBudgetChars = Math.trunc(Number(args["prior_budget_chars"] ?? DEFAULT_PRIOR_BUDGET_CHARS)) || DEFAULT_PRIOR_BUDGET_CHARS;
9315
+ let compactionMeta = null;
9256
9316
  const sessionId = typeof args["session_id"] === "string" ? args["session_id"] : null;
9257
9317
  const breakerEnv = await maybeBreakerEnvelope(
9258
9318
  opts.storage,
@@ -9363,7 +9423,7 @@ async function runDebate(args, opts) {
9363
9423
  const roundMessages = [
9364
9424
  {
9365
9425
  role: "system",
9366
- content: `You are debating peers from other model families. Round ${rnd}/${maxRounds}. Disagree where warranted, concede where right, and keep replies short and specific.`
9426
+ content: "You are debating peers from other model families. Disagree where warranted, concede where right, and keep replies short and specific."
9367
9427
  }
9368
9428
  ];
9369
9429
  if (context) {
@@ -9375,13 +9435,22 @@ ${context}` });
9375
9435
  TOPIC: ${topic}` : `TOPIC: ${topic}`;
9376
9436
  roundMessages.push({ role: "user", content: topicLine });
9377
9437
  if (transcript.length > 0) {
9378
- const prior = transcript.map(
9379
- (e) => `[${e.provider} \u2014 round ${e.round}]
9380
- ${e.response ?? "(error)"}`
9381
- ).join("\n\n");
9438
+ const prior = buildPriorTurns(transcript, {
9439
+ compress: compressRounds,
9440
+ budgetChars: priorBudgetChars
9441
+ });
9442
+ if (prior.omittedTurns > 0) compactionMeta = {
9443
+ omitted_turns: prior.omittedTurns,
9444
+ included_turns: prior.includedTurns,
9445
+ budget_chars: priorBudgetChars
9446
+ };
9382
9447
  roundMessages.push({ role: "user", content: `PRIOR TURNS:
9383
- ${prior}` });
9448
+ ${prior.body}` });
9384
9449
  }
9450
+ roundMessages.push({
9451
+ role: "user",
9452
+ content: `This is round ${rnd} of ${maxRounds}. Reply for this round.`
9453
+ });
9385
9454
  for (const p of selected) {
9386
9455
  const entry = await callPanelist(p, roundMessages);
9387
9456
  const withRound = { ...entry, round: rnd };
@@ -9429,10 +9498,7 @@ ${prior}` });
9429
9498
  let coReasoned = false;
9430
9499
  if (moderator) {
9431
9500
  const synthProvider = superRequested && opts.providers["anthropic"] ? retargetForSuper(opts.providers["anthropic"]) : upgraded ? retargetProvider(opts.providers["anthropic"], UPGRADE_MODEL) : moderator;
9432
- const condensed = transcript.map(
9433
- (e) => `[${e.provider} \u2014 round ${e.round}]
9434
- ${e.response ?? "(error)"}`
9435
- ).join("\n\n");
9501
+ const condensed = buildModeratorTranscript(transcript);
9436
9502
  const persona = buildPersonaInjection({
9437
9503
  toolName: "debate",
9438
9504
  prompt: topic,
@@ -9515,6 +9581,7 @@ ${condensed}`
9515
9581
  synthesis
9516
9582
  };
9517
9583
  if (personaMeta && personaMeta.used !== null) result["persona"] = personaMeta;
9584
+ if (compactionMeta) result["round_compaction"] = compactionMeta;
9518
9585
  if (upgraded) {
9519
9586
  result["reasoning_upgrade"] = {
9520
9587
  applied: true,
@@ -11834,7 +11901,7 @@ var CHECK_INTERVAL_SECONDS = 3 * 24 * 60 * 60;
11834
11901
  var DEFAULT_PACKAGE = "crosscheck-cli";
11835
11902
  var FETCH_TIMEOUT_MS = 3e3;
11836
11903
  function engineVersion() {
11837
- return true ? "0.2.22" : "0.0.0-dev";
11904
+ return true ? "0.2.23" : "0.0.0-dev";
11838
11905
  }
11839
11906
  function defaultUpdateCachePath() {
11840
11907
  const base = process.env["CROSSCHECK_DATA_DIR"] || path9.join(os.homedir() || os.tmpdir(), ".crosscheck");