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.
@@ -1444,7 +1444,7 @@ var import_zod = require("zod");
1444
1444
 
1445
1445
  // src/server-meta.ts
1446
1446
  var SERVER_NAME = "crosscheck-agent";
1447
- var SERVER_VERSION = true ? "0.2.22" : "0.0.0-dev";
1447
+ var SERVER_VERSION = true ? "0.2.23" : "0.0.0-dev";
1448
1448
 
1449
1449
  // src/tools/audit.ts
1450
1450
  var import_node_fs4 = require("fs");
@@ -9221,6 +9221,63 @@ function isObj6(v) {
9221
9221
  return typeof v === "object" && v !== null && !Array.isArray(v);
9222
9222
  }
9223
9223
 
9224
+ // src/core/debate-compaction.ts
9225
+ var DEFAULT_PRIOR_BUDGET_CHARS = 12e3;
9226
+ function renderTurn(e) {
9227
+ return `[${e.provider} \u2014 round ${e.round}]
9228
+ ${e.response ?? "(error)"}`;
9229
+ }
9230
+ function buildPriorTurns(transcript, opts = {}) {
9231
+ if (transcript.length === 0) {
9232
+ return { body: "", includedTurns: 0, omittedTurns: 0, chars: 0 };
9233
+ }
9234
+ const rendered = transcript.map(renderTurn);
9235
+ const full = rendered.join("\n\n");
9236
+ if (!opts.compress) {
9237
+ return { body: full, includedTurns: transcript.length, omittedTurns: 0, chars: full.length };
9238
+ }
9239
+ const budget = Math.max(0, opts.budgetChars ?? DEFAULT_PRIOR_BUDGET_CHARS);
9240
+ if (full.length <= budget) {
9241
+ return { body: full, includedTurns: transcript.length, omittedTurns: 0, chars: full.length };
9242
+ }
9243
+ const latestRound = Math.max(...transcript.map((e) => e.round));
9244
+ const keep = /* @__PURE__ */ new Set();
9245
+ let spent = 0;
9246
+ for (let i = transcript.length - 1; i >= 0; i -= 1) {
9247
+ const isLatest = transcript[i].round === latestRound;
9248
+ const cost = rendered[i].length + 2;
9249
+ if (isLatest) {
9250
+ keep.add(i);
9251
+ spent += cost;
9252
+ continue;
9253
+ }
9254
+ if (spent + cost > budget) continue;
9255
+ keep.add(i);
9256
+ spent += cost;
9257
+ }
9258
+ const parts = [];
9259
+ let omitted = 0;
9260
+ let pendingGap = 0;
9261
+ for (let i = 0; i < transcript.length; i += 1) {
9262
+ if (keep.has(i)) {
9263
+ if (pendingGap > 0) {
9264
+ parts.push(`[${pendingGap} earlier turn(s) omitted for length]`);
9265
+ pendingGap = 0;
9266
+ }
9267
+ parts.push(rendered[i]);
9268
+ } else {
9269
+ omitted += 1;
9270
+ pendingGap += 1;
9271
+ }
9272
+ }
9273
+ if (pendingGap > 0) parts.push(`[${pendingGap} earlier turn(s) omitted for length]`);
9274
+ const body = parts.join("\n\n");
9275
+ return { body, includedTurns: keep.size, omittedTurns: omitted, chars: body.length };
9276
+ }
9277
+ function buildModeratorTranscript(transcript) {
9278
+ return transcript.map(renderTurn).join("\n\n");
9279
+ }
9280
+
9224
9281
  // src/tools/debate.ts
9225
9282
  var import_node_perf_hooks9 = require("perf_hooks");
9226
9283
  var DEFERRED_OPTS4 = [
@@ -9269,6 +9326,9 @@ async function runDebate(args, opts) {
9269
9326
  1,
9270
9327
  Math.trunc(Number(args["max_rounds"] ?? 3)) || 3
9271
9328
  );
9329
+ const compressRounds = args["compress_rounds"] === true;
9330
+ const priorBudgetChars = Math.trunc(Number(args["prior_budget_chars"] ?? DEFAULT_PRIOR_BUDGET_CHARS)) || DEFAULT_PRIOR_BUDGET_CHARS;
9331
+ let compactionMeta = null;
9272
9332
  const sessionId = typeof args["session_id"] === "string" ? args["session_id"] : null;
9273
9333
  const breakerEnv = await maybeBreakerEnvelope(
9274
9334
  opts.storage,
@@ -9379,7 +9439,7 @@ async function runDebate(args, opts) {
9379
9439
  const roundMessages = [
9380
9440
  {
9381
9441
  role: "system",
9382
- content: `You are debating peers from other model families. Round ${rnd}/${maxRounds}. Disagree where warranted, concede where right, and keep replies short and specific.`
9442
+ content: "You are debating peers from other model families. Disagree where warranted, concede where right, and keep replies short and specific."
9383
9443
  }
9384
9444
  ];
9385
9445
  if (context) {
@@ -9391,13 +9451,22 @@ ${context}` });
9391
9451
  TOPIC: ${topic}` : `TOPIC: ${topic}`;
9392
9452
  roundMessages.push({ role: "user", content: topicLine });
9393
9453
  if (transcript.length > 0) {
9394
- const prior = transcript.map(
9395
- (e) => `[${e.provider} \u2014 round ${e.round}]
9396
- ${e.response ?? "(error)"}`
9397
- ).join("\n\n");
9454
+ const prior = buildPriorTurns(transcript, {
9455
+ compress: compressRounds,
9456
+ budgetChars: priorBudgetChars
9457
+ });
9458
+ if (prior.omittedTurns > 0) compactionMeta = {
9459
+ omitted_turns: prior.omittedTurns,
9460
+ included_turns: prior.includedTurns,
9461
+ budget_chars: priorBudgetChars
9462
+ };
9398
9463
  roundMessages.push({ role: "user", content: `PRIOR TURNS:
9399
- ${prior}` });
9464
+ ${prior.body}` });
9400
9465
  }
9466
+ roundMessages.push({
9467
+ role: "user",
9468
+ content: `This is round ${rnd} of ${maxRounds}. Reply for this round.`
9469
+ });
9401
9470
  for (const p of selected) {
9402
9471
  const entry = await callPanelist(p, roundMessages);
9403
9472
  const withRound = { ...entry, round: rnd };
@@ -9445,10 +9514,7 @@ ${prior}` });
9445
9514
  let coReasoned = false;
9446
9515
  if (moderator) {
9447
9516
  const synthProvider = superRequested && opts.providers["anthropic"] ? retargetForSuper(opts.providers["anthropic"]) : upgraded ? retargetProvider(opts.providers["anthropic"], UPGRADE_MODEL) : moderator;
9448
- const condensed = transcript.map(
9449
- (e) => `[${e.provider} \u2014 round ${e.round}]
9450
- ${e.response ?? "(error)"}`
9451
- ).join("\n\n");
9517
+ const condensed = buildModeratorTranscript(transcript);
9452
9518
  const persona = buildPersonaInjection({
9453
9519
  toolName: "debate",
9454
9520
  prompt: topic,
@@ -9531,6 +9597,7 @@ ${condensed}`
9531
9597
  synthesis
9532
9598
  };
9533
9599
  if (personaMeta && personaMeta.used !== null) result["persona"] = personaMeta;
9600
+ if (compactionMeta) result["round_compaction"] = compactionMeta;
9534
9601
  if (upgraded) {
9535
9602
  result["reasoning_upgrade"] = {
9536
9603
  applied: true,
@@ -11850,7 +11917,7 @@ var CHECK_INTERVAL_SECONDS = 3 * 24 * 60 * 60;
11850
11917
  var DEFAULT_PACKAGE = "crosscheck-cli";
11851
11918
  var FETCH_TIMEOUT_MS = 3e3;
11852
11919
  function engineVersion() {
11853
- return true ? "0.2.22" : "0.0.0-dev";
11920
+ return true ? "0.2.23" : "0.0.0-dev";
11854
11921
  }
11855
11922
  function defaultUpdateCachePath() {
11856
11923
  const base = process.env["CROSSCHECK_DATA_DIR"] || import_node_path12.default.join(import_node_os2.default.homedir() || import_node_os2.default.tmpdir(), ".crosscheck");