ai-consensus-core 0.9.0

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.
@@ -0,0 +1,303 @@
1
+ import { z } from "zod";
2
+ export declare const PersonaSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ name: z.ZodString;
5
+ emoji: z.ZodOptional<z.ZodString>;
6
+ color: z.ZodOptional<z.ZodString>;
7
+ description: z.ZodString;
8
+ systemPrompt: z.ZodString;
9
+ }, "strip", z.ZodTypeAny, {
10
+ id: string;
11
+ name: string;
12
+ description: string;
13
+ systemPrompt: string;
14
+ emoji?: string | undefined;
15
+ color?: string | undefined;
16
+ }, {
17
+ id: string;
18
+ name: string;
19
+ description: string;
20
+ systemPrompt: string;
21
+ emoji?: string | undefined;
22
+ color?: string | undefined;
23
+ }>;
24
+ export type Persona = z.infer<typeof PersonaSchema>;
25
+ export declare const ParticipantSchema: z.ZodObject<{
26
+ id: z.ZodString;
27
+ modelId: z.ZodString;
28
+ persona: z.ZodObject<{
29
+ id: z.ZodString;
30
+ name: z.ZodString;
31
+ emoji: z.ZodOptional<z.ZodString>;
32
+ color: z.ZodOptional<z.ZodString>;
33
+ description: z.ZodString;
34
+ systemPrompt: z.ZodString;
35
+ }, "strip", z.ZodTypeAny, {
36
+ id: string;
37
+ name: string;
38
+ description: string;
39
+ systemPrompt: string;
40
+ emoji?: string | undefined;
41
+ color?: string | undefined;
42
+ }, {
43
+ id: string;
44
+ name: string;
45
+ description: string;
46
+ systemPrompt: string;
47
+ emoji?: string | undefined;
48
+ color?: string | undefined;
49
+ }>;
50
+ label: z.ZodOptional<z.ZodString>;
51
+ }, "strip", z.ZodTypeAny, {
52
+ id: string;
53
+ modelId: string;
54
+ persona: {
55
+ id: string;
56
+ name: string;
57
+ description: string;
58
+ systemPrompt: string;
59
+ emoji?: string | undefined;
60
+ color?: string | undefined;
61
+ };
62
+ label?: string | undefined;
63
+ }, {
64
+ id: string;
65
+ modelId: string;
66
+ persona: {
67
+ id: string;
68
+ name: string;
69
+ description: string;
70
+ systemPrompt: string;
71
+ emoji?: string | undefined;
72
+ color?: string | undefined;
73
+ };
74
+ label?: string | undefined;
75
+ }>;
76
+ export type Participant = z.infer<typeof ParticipantSchema>;
77
+ export declare const PHASES: readonly ["initial-analysis", "counterarguments", "evidence-assessment", "synthesis"];
78
+ export type Phase = (typeof PHASES)[number];
79
+ export interface TokenUsage {
80
+ inputTokens: number;
81
+ outputTokens: number;
82
+ totalTokens: number;
83
+ }
84
+ export interface ModelCallRequest {
85
+ /** Participant that originated the request, or "judge" for the synthesizer. */
86
+ participantId: string;
87
+ /** Opaque provider model id (e.g. "claude-opus-4-5", "gpt-4o"). */
88
+ modelId: string;
89
+ /** 1-based round index. Judge calls use the final round number. */
90
+ round: number;
91
+ /** Phase of this call; "synthesis" is used for the judge. */
92
+ phase: Phase;
93
+ /** Full system prompt (persona + round instructions). */
94
+ system: string;
95
+ /** The user's question (CVP) or synthesis context (judge). */
96
+ user: string;
97
+ /** Sampling temperature hint — 0.7 for participants, 0.3 for judge. */
98
+ temperature: number;
99
+ /** Maximum output token hint. */
100
+ maxOutputTokens: number;
101
+ /** Propagates cancellation. Honor this. */
102
+ signal?: AbortSignal;
103
+ /** Optional streaming sink; callers MAY call this with partial tokens. */
104
+ onToken?: (token: string) => void;
105
+ }
106
+ export interface ModelCallResponse {
107
+ /** Full assistant content, including the trailing `CONFIDENCE: N` line. */
108
+ content: string;
109
+ /** Optional token usage, if the provider surfaces it. */
110
+ usage?: TokenUsage;
111
+ }
112
+ export type ModelCaller = (request: ModelCallRequest) => Promise<ModelCallResponse>;
113
+ export interface ParticipantResponse {
114
+ participantId: string;
115
+ modelId: string;
116
+ personaId: string;
117
+ round: number;
118
+ phase: Phase;
119
+ content: string;
120
+ /** 0-100, parsed from the `CONFIDENCE: N` trailing line. Defaults to 50 if absent. */
121
+ confidence: number;
122
+ /** If the ModelCaller threw or reported an error, present and non-empty. Responses with errors are excluded from consensus score and disagreement detection. */
123
+ error?: string;
124
+ usage?: TokenUsage;
125
+ startedAt: number;
126
+ completedAt: number;
127
+ durationMs: number;
128
+ }
129
+ export interface Disagreement {
130
+ /** Stable id: `r<round>-<a>-<b>`. */
131
+ id: string;
132
+ round: number;
133
+ participantAId: string;
134
+ participantBId: string;
135
+ /** Absolute confidence delta (0-100). */
136
+ severity: number;
137
+ /** Short human label (e.g. "Risk Analyst vs Optimistic Futurist"). */
138
+ label: string;
139
+ }
140
+ export interface RoundResult {
141
+ round: number;
142
+ phase: Phase;
143
+ label: string;
144
+ blind: boolean;
145
+ responses: ParticipantResponse[];
146
+ averageConfidence: number;
147
+ stddev: number;
148
+ /** Consensus score: `round(clamp(avg - 0.5 * stddev, 0, 100))`. */
149
+ score: number;
150
+ disagreements: Disagreement[];
151
+ startedAt: number;
152
+ completedAt: number;
153
+ durationMs: number;
154
+ }
155
+ export interface SynthesisResult {
156
+ modelId: string;
157
+ content: string;
158
+ majorityPosition: string;
159
+ minorityPositions: string;
160
+ unresolvedDisputes: string;
161
+ /** 0-100, from the `JUDGE_CONFIDENCE: N` trailing line. Defaults to 50 if absent. */
162
+ judgeConfidence: number;
163
+ usage?: TokenUsage;
164
+ startedAt: number;
165
+ completedAt: number;
166
+ durationMs: number;
167
+ }
168
+ export type StopReason = "max-rounds" | "converged" | "aborted";
169
+ export interface ConsensusResult {
170
+ question: string;
171
+ participants: Participant[];
172
+ rounds: RoundResult[];
173
+ roundsCompleted: number;
174
+ finalScore: number;
175
+ finalAverageConfidence: number;
176
+ finalStddev: number;
177
+ stopReason: StopReason;
178
+ earlyStop?: {
179
+ round: number;
180
+ delta: number;
181
+ reason: string;
182
+ };
183
+ synthesis?: SynthesisResult;
184
+ startedAt: number;
185
+ completedAt: number;
186
+ durationMs: number;
187
+ }
188
+ export interface ConsensusOptions {
189
+ /** The question/prompt to run consensus on. Required, non-empty. */
190
+ question: string;
191
+ /** Ordered list of participants. At least two are required. */
192
+ participants: Participant[];
193
+ /** Max number of rounds. Bounded to [1, 10]. Defaults to 4. */
194
+ maxRounds?: number;
195
+ /** Enable early stopping when |Δscore| ≤ `convergenceDelta`. Defaults to true. */
196
+ earlyStop?: boolean;
197
+ /** Convergence threshold (consensus-score delta). Defaults to 3. */
198
+ convergenceDelta?: number;
199
+ /** Confidence-delta threshold for disagreement detection. Defaults to 20. */
200
+ disagreementThreshold?: number;
201
+ /** Run round 1 in parallel with no cross-visibility. Defaults to true. */
202
+ blindFirstRound?: boolean;
203
+ /** Shuffle speaking order on rounds 2+. Defaults to true. */
204
+ randomizeOrder?: boolean;
205
+ /** Temperature for participant calls. Defaults to 0.7. */
206
+ participantTemperature?: number;
207
+ /** Max output tokens per participant call. Defaults to 1500. */
208
+ maxOutputTokens?: number;
209
+ /** Optional judge synthesis. If provided, runs after the final round. */
210
+ judge?: {
211
+ /** Judge model id (passed to the ModelCaller). */
212
+ modelId: string;
213
+ /** Optional override. If omitted, the engine's default ModelCaller is used. */
214
+ caller?: ModelCaller;
215
+ /** Temperature for judge. Defaults to 0.3. */
216
+ temperature?: number;
217
+ /** Max output tokens for judge. Defaults to 1500. */
218
+ maxOutputTokens?: number;
219
+ };
220
+ /** Non-negative integer. If set, uses a seeded PRNG so round-order randomization is deterministic. */
221
+ randomSeed?: number;
222
+ /** Propagates cancellation to every ModelCaller and aborts the loop. */
223
+ signal?: AbortSignal;
224
+ }
225
+ export interface RoundStartEvent {
226
+ round: number;
227
+ phase: Phase;
228
+ label: string;
229
+ blind: boolean;
230
+ participantIds: string[];
231
+ }
232
+ export interface ParticipantStartEvent {
233
+ round: number;
234
+ phase: Phase;
235
+ participantId: string;
236
+ modelId: string;
237
+ personaId: string;
238
+ }
239
+ export interface ParticipantTokenEvent {
240
+ round: number;
241
+ participantId: string;
242
+ token: string;
243
+ }
244
+ export interface ParticipantCompleteEvent {
245
+ round: number;
246
+ phase: Phase;
247
+ response: ParticipantResponse;
248
+ }
249
+ export interface ConfidenceUpdateEvent {
250
+ round: number;
251
+ participantId: string;
252
+ confidence: number;
253
+ /** Running mean of all confidences seen so far in this round (including this one). */
254
+ runningAverage: number;
255
+ }
256
+ export interface DisagreementDetectedEvent {
257
+ round: number;
258
+ disagreement: Disagreement;
259
+ }
260
+ export interface RoundCompleteEvent {
261
+ round: number;
262
+ phase: Phase;
263
+ averageConfidence: number;
264
+ stddev: number;
265
+ score: number;
266
+ disagreements: Disagreement[];
267
+ responses: ParticipantResponse[];
268
+ durationMs: number;
269
+ }
270
+ export interface EarlyStopEvent {
271
+ round: number;
272
+ delta: number;
273
+ reason: string;
274
+ }
275
+ export interface SynthesisStartEvent {
276
+ modelId: string;
277
+ }
278
+ export interface SynthesisTokenEvent {
279
+ token: string;
280
+ }
281
+ export interface SynthesisCompleteEvent {
282
+ synthesis: SynthesisResult;
283
+ }
284
+ export interface FinalResultEvent {
285
+ result: ConsensusResult;
286
+ }
287
+ export interface ConsensusEventMap {
288
+ roundStart: (event: RoundStartEvent) => void;
289
+ participantStart: (event: ParticipantStartEvent) => void;
290
+ participantToken: (event: ParticipantTokenEvent) => void;
291
+ participantComplete: (event: ParticipantCompleteEvent) => void;
292
+ confidenceUpdate: (event: ConfidenceUpdateEvent) => void;
293
+ disagreementDetected: (event: DisagreementDetectedEvent) => void;
294
+ roundComplete: (event: RoundCompleteEvent) => void;
295
+ earlyStop: (event: EarlyStopEvent) => void;
296
+ synthesisStart: (event: SynthesisStartEvent) => void;
297
+ synthesisToken: (event: SynthesisTokenEvent) => void;
298
+ synthesisComplete: (event: SynthesisCompleteEvent) => void;
299
+ finalResult: (event: FinalResultEvent) => void;
300
+ error: (error: Error) => void;
301
+ }
302
+ export type ConsensusEventName = keyof ConsensusEventMap;
303
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,aAAa;;;;;;;;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AAI,CAAC;IACjE,aAAa,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC;IACnD,SAAS,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IAC3C,cAAc,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACrD,cAAc,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACrD,iBAAiB,EAAE,CAAC,KAAK,EAAE,sBAAsB,KAAK,IAAI,CAAC;IAC3D,WAAW,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC/C,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAC/B;AAED,MAAM,MAAM,kBAAkB,GAAG,MAAM,iBAAiB,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,31 @@
1
+ import { z } from "zod";
2
+ // ─────────────────────────────────────────────────────────────
3
+ // Persona
4
+ // ─────────────────────────────────────────────────────────────
5
+ export const PersonaSchema = z.object({
6
+ id: z.string().min(1),
7
+ name: z.string().min(1),
8
+ emoji: z.string().optional(),
9
+ color: z.string().optional(),
10
+ description: z.string(),
11
+ systemPrompt: z.string().min(1),
12
+ });
13
+ // ─────────────────────────────────────────────────────────────
14
+ // Participant
15
+ // ─────────────────────────────────────────────────────────────
16
+ export const ParticipantSchema = z.object({
17
+ id: z.string().min(1),
18
+ modelId: z.string().min(1),
19
+ persona: PersonaSchema,
20
+ label: z.string().optional(),
21
+ });
22
+ // ─────────────────────────────────────────────────────────────
23
+ // Phases
24
+ // ─────────────────────────────────────────────────────────────
25
+ export const PHASES = [
26
+ "initial-analysis",
27
+ "counterarguments",
28
+ "evidence-assessment",
29
+ "synthesis",
30
+ ];
31
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,gEAAgE;AAChE,UAAU;AACV,gEAAgE;AAEhE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACrB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAChC,CAAC,CAAC;AAIH,gEAAgE;AAChE,cAAc;AACd,gEAAgE;AAEhE,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACrB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,OAAO,EAAE,aAAa;IACtB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAAC,CAAC;AAIH,gEAAgE;AAChE,SAAS;AACT,gEAAgE;AAEhE,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,kBAAkB;IAClB,kBAAkB;IAClB,qBAAqB;IACrB,WAAW;CACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "ai-consensus-core",
3
+ "version": "0.9.0",
4
+ "description": "Dependency-light TypeScript implementation of the Consensus Validation Protocol (CVP): multi-model debate with confidence-weighted scoring, disagreement detection, and optional judge synthesis.",
5
+ "keywords": [
6
+ "consensus",
7
+ "cvp",
8
+ "multi-agent",
9
+ "llm",
10
+ "ai",
11
+ "anthropic",
12
+ "openai",
13
+ "grok",
14
+ "debate",
15
+ "roundtable",
16
+ "mcp",
17
+ "entropyvortex"
18
+ ],
19
+ "license": "MIT",
20
+ "author": "Marcelo Ceccon <https://github.com/marceloceccon>",
21
+ "homepage": "https://github.com/entropyvortex/ai-consensus-core#readme",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/entropyvortex/ai-consensus-core.git"
25
+ },
26
+ "bugs": {
27
+ "url": "https://github.com/entropyvortex/ai-consensus-core/issues"
28
+ },
29
+ "type": "module",
30
+ "main": "./dist/index.js",
31
+ "types": "./dist/index.d.ts",
32
+ "exports": {
33
+ ".": {
34
+ "types": "./dist/index.d.ts",
35
+ "import": "./dist/index.js",
36
+ "default": "./dist/index.js"
37
+ },
38
+ "./package.json": "./package.json"
39
+ },
40
+ "sideEffects": false,
41
+ "files": [
42
+ "dist",
43
+ "README.md",
44
+ "LICENSE"
45
+ ],
46
+ "scripts": {
47
+ "build": "tsc -p tsconfig.build.json",
48
+ "dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput",
49
+ "typecheck": "tsc -p tsconfig.json --noEmit",
50
+ "test": "vitest run",
51
+ "test:watch": "vitest",
52
+ "test:coverage": "vitest run --coverage",
53
+ "clean": "rm -rf dist coverage *.tsbuildinfo",
54
+ "prepublishOnly": "npm run clean && npm run build && npm run test"
55
+ },
56
+ "dependencies": {
57
+ "zod": "^3.24.1"
58
+ },
59
+ "devDependencies": {
60
+ "@types/node": "^22.10.5",
61
+ "@vitest/coverage-v8": "^4.1.4",
62
+ "typescript": "^5.7.2",
63
+ "vitest": "^4.1.4"
64
+ },
65
+ "engines": {
66
+ "node": ">=20"
67
+ },
68
+ "publishConfig": {
69
+ "access": "public"
70
+ }
71
+ }