Repository navigation
[blocked on core release] Run engines on ai-consensus-core; add Compare attempts engine - #19
Merged
Merged
Conversation
Replace the protocol code lib/consensus-engine.ts duplicated from ai-consensus-core with core's exports: round prompts, trailing-marker confidence parsing, consensus score, disagreement detection, judge prompts and section parsing, the claim extractor and the cost-cap error. Every model call goes through lib/core-caller.ts, a core ModelCaller over the Vercel AI SDK (streaming via onToken, usage mapped with the chars/4 fallback, abort wired, provider errors formatted as before). The CVP, Blind Jury and Red Team loops stay local and unchanged: Blind Jury and Red Team have no core equivalent, and ConsensusEngine.run() would reject Roundtable's 1-seat runs and parse the first CONFIDENCE marker instead of the last. All 578 existing tests pass unmodified. The /api/consensus participant rebuild and rate limiter move to lib/route-guards.ts for reuse; responses are unchanged.
A fourth engine judges 2-6 pasted solutions to one task, with optional check results: blind jurors under per-juror shuffled neutral labels, quote-verified findings, Borda count and Kendall's W, a rebuttal round only when the jurors split, then the non-voting judge. Attempt labels never reach a model. - POST /api/adjudicate (SSE) with the same guards as /api/consensus - Setup: engine card, task wording, attempts editor with check results - Run: verdict or "no clear winner" with the reason, ranking with points, agreement, juror status, findings with the dropped count, judge synthesis and cost - Not saved to History and not part of the engine sweep The one edit to an existing test is a type annotation in page-sweep.test.tsx (Record<EngineType, number> no longer covers the widened union); its assertions are unchanged.
marceloceccon
marked this pull request as ready for review
November 20, 2026 23:00
This was referenced Nov 20, 2026
marceloceccon
added a commit
that referenced
this pull request
Nov 21, 2026
package.json has required ai-consensus-core ^0.13.0 since #19, but the version was not published, so pnpm-lock.yaml could not include it and every CI run (and the Dependabot security update for next/minimatch) failed at install. 0.13.0 is now on npm; this adds it to the lockfile (integrity matches the published tarball). Lockfile only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
1. Engines run on
ai-consensus-core(refactor:commit). Roundtable did not depend on core; it carried its own copy of the protocol.lib/consensus-engine.tsnow uses core for:getRoundMeta;extractConfidence; core now uses Roundtable's last-marker semantics);consensusScoreanddetectDisagreements;CostCapExceededError.lib/core-caller.ts, a coreModelCallerover the Vercel AI SDK: streaming viaonToken, usage mapped (provider-reported, else the same chars/4 heuristic), abort wired, provider errors formatted as before./api/consensus's participant rebuild and rate limiter moved tolib/route-guards.ts, shared with the new route. Responses are unchanged.2. Compare attempts engine (
feat:commit).AdjudicationEngine: blind jurors under shuffled neutral labels, quote-verified findings, Borda + Kendall's W, a rebuttal round only on a split, then the judge.POST /api/adjudicate(SSE), with the same guards as/api/consensusplus attempt and check limits. The jurors are the seated panel.Why
The brief asked Roundtable to consume the engine and delete duplicated protocol code. The duplicated primitives are gone and every provider call goes through the core
ModelCaller. Compare attempts gives the best-of-N comparison a UI.Deviation: the CVP loop stays local
The brief asked for the protocol implementations to be replaced by core. I measured this before changing anything. On a spike, CVP ran through
ConsensusEngine.run()against published core 0.12.0, with the unmodifiedtests/consensus-engine.test.tsas the contract [executed]:extractConfidencenow reads the last marker (approved core change in feat: attempt adjudication engine; port claim extractor and cost cap (0.13.0) ai-consensus-core#6).Matching Roundtable through
run()now needs one thing: a 1-seat allowance in core's exportedConsensusOptions. The brief says to stop and ask before changing an existing public export, so I didn't. The three loops (CVP, Blind Jury, Red Team) stay local on core primitives.If you approve that field, or accept that 1-seat CVP runs are rejected, moving CVP onto
run()is a small follow-up; a working bridge exists on a local spike branch.How it was verified
tests/page-sweep.test.tsx.Record<EngineType, number>→Record<string, number>, because the union gained"compare-attempts"; assertions are unchanged.onError, plus an unresolvable model;streamTextargument (system prompt, user prompt, temperature, max tokens) was identical, and the full SSE event sequence was identical with timings normalised.pnpm lint,pnpm format:check,pnpm test(622/622) andAI_PROVIDERS="[]" pnpm build(Next type validation included) all pass on Node 24 [executed]. The first commit on its own also typechecks and passes 584 tests [executed].What is left
maxDuration, and returns partial results.