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.
@@ -2352,7 +2352,7 @@ var import_zod = require("zod");
2352
2352
  // src/server-meta.ts
2353
2353
  init_cjs_shims();
2354
2354
  var SERVER_NAME = "crosscheck-agent";
2355
- var SERVER_VERSION = true ? "0.2.22" : "0.0.0-dev";
2355
+ var SERVER_VERSION = true ? "0.2.23" : "0.0.0-dev";
2356
2356
 
2357
2357
  // src/tools/audit.ts
2358
2358
  init_cjs_shims();
@@ -10202,6 +10202,66 @@ function isObj6(v) {
10202
10202
 
10203
10203
  // src/tools/debate.ts
10204
10204
  init_cjs_shims();
10205
+
10206
+ // src/core/debate-compaction.ts
10207
+ init_cjs_shims();
10208
+ var DEFAULT_PRIOR_BUDGET_CHARS = 12e3;
10209
+ function renderTurn(e) {
10210
+ return `[${e.provider} \u2014 round ${e.round}]
10211
+ ${e.response ?? "(error)"}`;
10212
+ }
10213
+ function buildPriorTurns(transcript, opts = {}) {
10214
+ if (transcript.length === 0) {
10215
+ return { body: "", includedTurns: 0, omittedTurns: 0, chars: 0 };
10216
+ }
10217
+ const rendered = transcript.map(renderTurn);
10218
+ const full = rendered.join("\n\n");
10219
+ if (!opts.compress) {
10220
+ return { body: full, includedTurns: transcript.length, omittedTurns: 0, chars: full.length };
10221
+ }
10222
+ const budget = Math.max(0, opts.budgetChars ?? DEFAULT_PRIOR_BUDGET_CHARS);
10223
+ if (full.length <= budget) {
10224
+ return { body: full, includedTurns: transcript.length, omittedTurns: 0, chars: full.length };
10225
+ }
10226
+ const latestRound = Math.max(...transcript.map((e) => e.round));
10227
+ const keep = /* @__PURE__ */ new Set();
10228
+ let spent = 0;
10229
+ for (let i = transcript.length - 1; i >= 0; i -= 1) {
10230
+ const isLatest = transcript[i].round === latestRound;
10231
+ const cost = rendered[i].length + 2;
10232
+ if (isLatest) {
10233
+ keep.add(i);
10234
+ spent += cost;
10235
+ continue;
10236
+ }
10237
+ if (spent + cost > budget) continue;
10238
+ keep.add(i);
10239
+ spent += cost;
10240
+ }
10241
+ const parts = [];
10242
+ let omitted = 0;
10243
+ let pendingGap = 0;
10244
+ for (let i = 0; i < transcript.length; i += 1) {
10245
+ if (keep.has(i)) {
10246
+ if (pendingGap > 0) {
10247
+ parts.push(`[${pendingGap} earlier turn(s) omitted for length]`);
10248
+ pendingGap = 0;
10249
+ }
10250
+ parts.push(rendered[i]);
10251
+ } else {
10252
+ omitted += 1;
10253
+ pendingGap += 1;
10254
+ }
10255
+ }
10256
+ if (pendingGap > 0) parts.push(`[${pendingGap} earlier turn(s) omitted for length]`);
10257
+ const body = parts.join("\n\n");
10258
+ return { body, includedTurns: keep.size, omittedTurns: omitted, chars: body.length };
10259
+ }
10260
+ function buildModeratorTranscript(transcript) {
10261
+ return transcript.map(renderTurn).join("\n\n");
10262
+ }
10263
+
10264
+ // src/tools/debate.ts
10205
10265
  var import_node_perf_hooks9 = require("perf_hooks");
10206
10266
  var DEFERRED_OPTS4 = [
10207
10267
  // empty — every debate opt runs natively when its deps
@@ -10249,6 +10309,9 @@ async function runDebate(args, opts) {
10249
10309
  1,
10250
10310
  Math.trunc(Number(args["max_rounds"] ?? 3)) || 3
10251
10311
  );
10312
+ const compressRounds = args["compress_rounds"] === true;
10313
+ const priorBudgetChars = Math.trunc(Number(args["prior_budget_chars"] ?? DEFAULT_PRIOR_BUDGET_CHARS)) || DEFAULT_PRIOR_BUDGET_CHARS;
10314
+ let compactionMeta = null;
10252
10315
  const sessionId = typeof args["session_id"] === "string" ? args["session_id"] : null;
10253
10316
  const breakerEnv = await maybeBreakerEnvelope(
10254
10317
  opts.storage,
@@ -10359,7 +10422,7 @@ async function runDebate(args, opts) {
10359
10422
  const roundMessages = [
10360
10423
  {
10361
10424
  role: "system",
10362
- content: `You are debating peers from other model families. Round ${rnd}/${maxRounds}. Disagree where warranted, concede where right, and keep replies short and specific.`
10425
+ content: "You are debating peers from other model families. Disagree where warranted, concede where right, and keep replies short and specific."
10363
10426
  }
10364
10427
  ];
10365
10428
  if (context) {
@@ -10371,13 +10434,22 @@ ${context}` });
10371
10434
  TOPIC: ${topic}` : `TOPIC: ${topic}`;
10372
10435
  roundMessages.push({ role: "user", content: topicLine });
10373
10436
  if (transcript.length > 0) {
10374
- const prior = transcript.map(
10375
- (e) => `[${e.provider} \u2014 round ${e.round}]
10376
- ${e.response ?? "(error)"}`
10377
- ).join("\n\n");
10437
+ const prior = buildPriorTurns(transcript, {
10438
+ compress: compressRounds,
10439
+ budgetChars: priorBudgetChars
10440
+ });
10441
+ if (prior.omittedTurns > 0) compactionMeta = {
10442
+ omitted_turns: prior.omittedTurns,
10443
+ included_turns: prior.includedTurns,
10444
+ budget_chars: priorBudgetChars
10445
+ };
10378
10446
  roundMessages.push({ role: "user", content: `PRIOR TURNS:
10379
- ${prior}` });
10447
+ ${prior.body}` });
10380
10448
  }
10449
+ roundMessages.push({
10450
+ role: "user",
10451
+ content: `This is round ${rnd} of ${maxRounds}. Reply for this round.`
10452
+ });
10381
10453
  for (const p of selected) {
10382
10454
  const entry = await callPanelist(p, roundMessages);
10383
10455
  const withRound = { ...entry, round: rnd };
@@ -10425,10 +10497,7 @@ ${prior}` });
10425
10497
  let coReasoned = false;
10426
10498
  if (moderator) {
10427
10499
  const synthProvider = superRequested && opts.providers["anthropic"] ? retargetForSuper(opts.providers["anthropic"]) : upgraded ? retargetProvider(opts.providers["anthropic"], UPGRADE_MODEL) : moderator;
10428
- const condensed = transcript.map(
10429
- (e) => `[${e.provider} \u2014 round ${e.round}]
10430
- ${e.response ?? "(error)"}`
10431
- ).join("\n\n");
10500
+ const condensed = buildModeratorTranscript(transcript);
10432
10501
  const persona = buildPersonaInjection({
10433
10502
  toolName: "debate",
10434
10503
  prompt: topic,
@@ -10511,6 +10580,7 @@ ${condensed}`
10511
10580
  synthesis
10512
10581
  };
10513
10582
  if (personaMeta && personaMeta.used !== null) result["persona"] = personaMeta;
10583
+ if (compactionMeta) result["round_compaction"] = compactionMeta;
10514
10584
  if (upgraded) {
10515
10585
  result["reasoning_upgrade"] = {
10516
10586
  applied: true,
@@ -12844,7 +12914,7 @@ var CHECK_INTERVAL_SECONDS = 3 * 24 * 60 * 60;
12844
12914
  var DEFAULT_PACKAGE = "crosscheck-cli";
12845
12915
  var FETCH_TIMEOUT_MS = 3e3;
12846
12916
  function engineVersion() {
12847
- return true ? "0.2.22" : "0.0.0-dev";
12917
+ return true ? "0.2.23" : "0.0.0-dev";
12848
12918
  }
12849
12919
  function defaultUpdateCachePath() {
12850
12920
  const base = process.env["CROSSCHECK_DATA_DIR"] || import_node_path13.default.join(import_node_os2.default.homedir() || import_node_os2.default.tmpdir(), ".crosscheck");