@heybeaux/lattice-adapter-parliament 0.2.1 → 0.3.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.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { TieredCircuitBreakerConfig, TieredCircuitBreaker, ConsensusReducerConfig, StateContract } from '@heybeaux/lattice-core';
1
+ import { TieredCircuitBreakerConfig, TieredCircuitBreaker, ConsensusReducerConfig, EmbeddingProvider, StateContract, PolicyEvidenceRow, TieredValidationResult } from '@heybeaux/lattice-core';
2
+ export { EmbeddingProvider, PolicyEvidenceRow } from '@heybeaux/lattice-core';
2
3
 
3
4
  /**
4
5
  * @heybeaux/lattice-adapter-parliament
@@ -41,6 +42,8 @@ interface ParliamentConfig {
41
42
  modelConfigs?: Record<string, ParliamentModelConfig>;
42
43
  /** Default model configuration (applied to all models without specific config) */
43
44
  defaultModelConfig?: ParliamentModelConfig;
45
+ /** Embedding provider for semantic consensus comparison */
46
+ embeddingProvider?: EmbeddingProvider;
44
47
  }
45
48
  /**
46
49
  * Result from wrapping a Parliament deliberation.
@@ -102,14 +105,18 @@ declare class ParliamentCircuitBreaker {
102
105
  *
103
106
  * Detects disagreements between model responses, computes agreement
104
107
  * ratios, and flags conflicts for the synthesizer to resolve.
108
+ *
109
+ * When an embeddingProvider is supplied, the consensus fields
110
+ * (mainPoint, supportingArguments, conclusion) are compared using
111
+ * cosine similarity (≥0.85 = agreeing) instead of exact string equality.
105
112
  */
106
113
  declare class ParliamentReducer {
107
114
  private reducer;
108
- constructor(config?: ConsensusReducerConfig);
115
+ constructor(config?: ConsensusReducerConfig, embeddingProvider?: EmbeddingProvider);
109
116
  /**
110
117
  * Reduce multiple model responses into a consensus.
111
118
  */
112
- reduce(contracts: StateContract[], traceId?: string): {
119
+ reduce(contracts: StateContract[], traceId?: string): Promise<{
113
120
  consensus: unknown;
114
121
  conflicts: Array<{
115
122
  field: string;
@@ -122,7 +129,7 @@ declare class ParliamentReducer {
122
129
  agreementRatio: number;
123
130
  consensusReached: boolean;
124
131
  reducedContract: StateContract;
125
- };
132
+ }>;
126
133
  }
127
134
  /**
128
135
  * Run a full Parliament deliberation with Lattice coordination.
@@ -134,5 +141,73 @@ declare class ParliamentReducer {
134
141
  * @returns ParliamentDeliberationResult
135
142
  */
136
143
  declare function runParliamentDeliberation(topic: string, models: ParliamentModel[], modelCalls: Map<string, (prompt: string) => Promise<unknown>>, config?: ParliamentConfig): Promise<ParliamentDeliberationResult>;
144
+ /**
145
+ * Shape of the `governance` block on a SonderEvent envelope. Surfaces the
146
+ * L0 evidence row trail produced by the Lattice breaker plus the
147
+ * `+`-joined list of tiers that actually ran.
148
+ *
149
+ * - `tier` is `'+'`-joined and includes only tiers that ran (Spec 1 R8).
150
+ * Skipped tiers (e.g. L1/L2/L3 after an L0 fail) MUST NOT appear.
151
+ * - `evidence` carries the full per-rule audit trail from L0. Empty array
152
+ * when no policy was bound; absent only when no validation ran at all.
153
+ * - `policySet` / `policySetVersion` mirror the bound `PolicyRuleSet`.
154
+ * Present iff L0 ran; absent otherwise.
155
+ */
156
+ interface SonderGovernanceBlock {
157
+ /** `+`-joined list of tiers that actually ran (e.g. `'L0+L1'`). */
158
+ tier: string;
159
+ /** Pass/fail/uncertain — derived from the underlying ValidationResult. */
160
+ verdict: 'pass' | 'fail';
161
+ /** L0 evidence rows, in rule-set order. Empty array when L0 didn't run. */
162
+ evidence: PolicyEvidenceRow[];
163
+ /** PolicyRuleSet.id when L0 ran. */
164
+ policySet?: string;
165
+ /** PolicyRuleSet.version when L0 ran. */
166
+ policySetVersion?: string;
167
+ /** Optional reject reason — present when verdict === 'fail'. */
168
+ reason?: string;
169
+ }
170
+ /**
171
+ * Build the SonderEvent `governance` block from a Lattice contract +
172
+ * the breaker's {@link TieredValidationResult}. Pulls L0 evidence /
173
+ * policy identifiers from `contract.metadata.l0` (when present) and
174
+ * computes the `+`-joined `tier` string from `validation.tiersRun`.
175
+ *
176
+ * Spec 1 R8: `tier` lists only tiers that actually ran. Spec 1 R7:
177
+ * downstream signers consume this block and apply the sign-refusal rule.
178
+ */
179
+ declare function buildGovernanceBlock(contract: StateContract, validation: TieredValidationResult): SonderGovernanceBlock;
180
+ /**
181
+ * Error thrown by {@link assertSonderEventSignable} when a SonderEvent
182
+ * envelope would violate Spec 1 R7's signing invariant. The `code`
183
+ * field is a stable machine identifier; the message is human-facing.
184
+ */
185
+ declare class SignRefusedError extends Error {
186
+ /**
187
+ * Stable identifier — currently always `'l0-evidence-missing'`,
188
+ * reserved for future R7 violations.
189
+ */
190
+ readonly code: 'l0-evidence-missing';
191
+ constructor(
192
+ /**
193
+ * Stable identifier — currently always `'l0-evidence-missing'`,
194
+ * reserved for future R7 violations.
195
+ */
196
+ code: 'l0-evidence-missing', message?: string);
197
+ }
198
+ /**
199
+ * Spec 1 R7 — refuse to sign a SonderEvent whose `governance.tier`
200
+ * mentions any of `L1`, `L2`, `L3` but whose `governance.evidence` is
201
+ * empty or absent. Sonder's runtime calls this immediately before the
202
+ * ed25519 signing step; throwing here aborts the signature.
203
+ *
204
+ * Why this matters: without L0 evidence the audit trail cannot prove
205
+ * the deterministic policy tier ran, so cryptographic provenance over
206
+ * the validation chain would be a lie. Refusing to sign is the
207
+ * cheapest enforcement boundary in the system.
208
+ *
209
+ * @throws {SignRefusedError} when the envelope violates R7.
210
+ */
211
+ declare function assertSonderEventSignable(governance: SonderGovernanceBlock): void;
137
212
 
138
- export { ParliamentCircuitBreaker, type ParliamentConfig, type ParliamentDeliberationResult, type ParliamentModel, type ParliamentModelConfig, ParliamentReducer, runParliamentDeliberation, wrapParliamentModel };
213
+ export { ParliamentCircuitBreaker, type ParliamentConfig, type ParliamentDeliberationResult, type ParliamentModel, type ParliamentModelConfig, ParliamentReducer, SignRefusedError, type SonderGovernanceBlock, assertSonderEventSignable, buildGovernanceBlock, runParliamentDeliberation, wrapParliamentModel };
package/dist/index.js CHANGED
@@ -46,19 +46,21 @@ var ParliamentCircuitBreaker = class {
46
46
  };
47
47
  var ParliamentReducer = class {
48
48
  reducer;
49
- constructor(config) {
49
+ constructor(config, embeddingProvider) {
50
50
  this.reducer = new ConsensusReducer({
51
51
  conflictStrategy: config?.conflictStrategy ?? "flag-only",
52
52
  minAgreementRatio: config?.minAgreementRatio ?? 0.6,
53
53
  consensusFields: config?.consensusFields ?? ["mainPoint", "supportingArguments", "conclusion"],
54
- includeIndividualOutputs: config?.includeIndividualOutputs ?? true
54
+ includeIndividualOutputs: config?.includeIndividualOutputs ?? true,
55
+ embeddingProvider: embeddingProvider ?? config?.embeddingProvider,
56
+ embeddingThreshold: config?.embeddingThreshold ?? 0.85
55
57
  });
56
58
  }
57
59
  /**
58
60
  * Reduce multiple model responses into a consensus.
59
61
  */
60
- reduce(contracts, traceId) {
61
- const result = this.reducer.reduce(contracts);
62
+ async reduce(contracts, traceId) {
63
+ const result = await this.reducer.reduce(contracts);
62
64
  const reducedContract = this.reducer.createReducedContract(result, contracts, "parliament-reducer", null);
63
65
  return {
64
66
  consensus: result.output,
@@ -104,8 +106,8 @@ async function runParliamentDeliberation(topic, models, modelCalls, config) {
104
106
  });
105
107
  }
106
108
  }
107
- const reducer = new ParliamentReducer(config?.reducer);
108
- const reduction = reducer.reduce(modelContracts, traceId);
109
+ const reducer = new ParliamentReducer(config?.reducer, config?.embeddingProvider);
110
+ const reduction = await reducer.reduce(modelContracts, traceId);
109
111
  if (auditLog) {
110
112
  auditLog.append({
111
113
  type: "consensus",
@@ -131,9 +133,51 @@ async function runParliamentDeliberation(topic, models, modelCalls, config) {
131
133
  traceId
132
134
  };
133
135
  }
136
+ function buildGovernanceBlock(contract, validation) {
137
+ const l0 = contract.metadata.l0;
138
+ const tiersRun = validation.tiersRun ?? [validation.tier];
139
+ const tier = tiersRun.join("+");
140
+ const verdict = validation.passed ? "pass" : "fail";
141
+ const block = {
142
+ tier,
143
+ verdict,
144
+ evidence: l0?.evidence ?? []
145
+ };
146
+ if (l0) {
147
+ block.policySet = l0.ruleSetId;
148
+ block.policySetVersion = l0.ruleSetVersion;
149
+ }
150
+ if (!validation.passed && validation.reason) {
151
+ block.reason = validation.reason;
152
+ }
153
+ return block;
154
+ }
155
+ var SignRefusedError = class extends Error {
156
+ constructor(code, message) {
157
+ super(message ?? `Sonder sign refused: ${code}`);
158
+ this.code = code;
159
+ this.name = "SignRefusedError";
160
+ }
161
+ code;
162
+ };
163
+ function assertSonderEventSignable(governance) {
164
+ const tiers = governance.tier.split("+");
165
+ const mentionsLaterTiers = tiers.includes("L1") || tiers.includes("L2") || tiers.includes("L3");
166
+ const evidence = governance.evidence;
167
+ const evidenceMissing = !evidence || evidence.length === 0;
168
+ if (mentionsLaterTiers && evidenceMissing) {
169
+ throw new SignRefusedError(
170
+ "l0-evidence-missing",
171
+ `Sonder sign refused (l0-evidence-missing): governance.tier="${governance.tier}" mentions L1/L2/L3 but governance.evidence is empty`
172
+ );
173
+ }
174
+ }
134
175
  export {
135
176
  ParliamentCircuitBreaker,
136
177
  ParliamentReducer,
178
+ SignRefusedError,
179
+ assertSonderEventSignable,
180
+ buildGovernanceBlock,
137
181
  runParliamentDeliberation,
138
182
  wrapParliamentModel
139
183
  };
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @heybeaux/lattice-adapter-parliament\n *\n * Wraps Parliament's multi-model deliberations with Lattice State Contracts,\n * Circuit Breakers, and ConsensusReducer for coordinated, auditable synthesis.\n */\n\nimport {\n createContract,\n TieredCircuitBreaker,\n ConsensusReducer,\n ComplianceAuditLog,\n wrapAgent,\n HandoffFailure,\n EventEmitter,\n globalEmitter,\n redactContract,\n} from '@heybeaux/lattice-core';\nimport type {\n TieredCircuitBreakerConfig,\n ConsensusReducerConfig,\n StateContract,\n} from '@heybeaux/lattice-core';\n\n// ─── Types ────────────────────────────────────────────────\n\n/**\n * A Parliament model participant.\n */\nexport interface ParliamentModel {\n /** Unique identifier for the model (e.g., 'claude-opus-4-6') */\n id: string;\n /** Role in the deliberation (proposer, expander, pragmatist, etc.) */\n role: string;\n /** Whether this model is adversarial (skeptic, devils-advocate) */\n isAdversarial?: boolean;\n}\n\n/**\n * Configuration for wrapping a Parliament model.\n */\nexport interface ParliamentModelConfig {\n /** Circuit breaker configuration (defaults: L1+L2 for cooperative, L1 for adversarial) */\n breaker?: TieredCircuitBreakerConfig;\n /** Whether to redact sensitive data before validation (default: true) */\n redactForValidation?: boolean;\n /** Whether to run in shadow mode (validate but don't block) (default: true) */\n shadowMode?: boolean;\n}\n\n/**\n * Configuration for the Parliament integration.\n */\nexport interface ParliamentConfig {\n /** Audit log path (optional — if provided, all deliberations are logged) */\n auditLogPath?: string;\n /** ConsensusReducer configuration */\n reducer?: ConsensusReducerConfig;\n /** Per-model configurations (optional) */\n modelConfigs?: Record<string, ParliamentModelConfig>;\n /** Default model configuration (applied to all models without specific config) */\n defaultModelConfig?: ParliamentModelConfig;\n}\n\n/**\n * Result from wrapping a Parliament deliberation.\n */\nexport interface ParliamentDeliberationResult {\n /** State Contracts for each model response */\n modelContracts: StateContract[];\n /** The consensus/synthesis output */\n consensus: unknown;\n /** Conflicts detected between models */\n conflicts: Array<{\n field: string;\n values: Array<{ agentId: string; value: unknown }>;\n resolution: string;\n }>;\n /** Agreement ratio (0-1) */\n agreementRatio: number;\n /** Whether consensus was reached */\n consensusReached: boolean;\n /** Total deliberation time in milliseconds */\n totalDurationMs: number;\n /** Trace ID for the deliberation */\n traceId: string;\n}\n\n// ─── wrapParliamentModel ──────────────────────────────────\n\n/**\n * Wrap a Parliament model call with Lattice State Contracts and Circuit Breakers.\n *\n * The wrapped model:\n * 1. Executes the original model call\n * 2. Creates a State Contract with the model's response\n * 3. Validates through Circuit Breaker (L1+L2 for cooperative, L1 for adversarial)\n * 4. Returns the State Contract\n *\n * @param model - The Parliament model definition\n * @param modelCall - The model call function: (prompt) => Promise<response>\n * @param config - Configuration for this model\n * @returns A wrapped function that returns StateContract instead of raw response\n */\nexport function wrapParliamentModel(\n model: ParliamentModel,\n modelCall: (prompt: string) => Promise<unknown>,\n config?: ParliamentModelConfig,\n) {\n const shadowMode = config?.shadowMode ?? true;\n const breakerConfig = config?.breaker ?? (\n model.isAdversarial\n ? { tier: 'L1' as const }\n : { tier: 'L1+L2' as const, l2Threshold: 0.7 }\n );\n\n const wrapped = wrapAgent(\n async (prompt: string) => modelCall(prompt),\n {\n id: model.id,\n breaker: breakerConfig,\n },\n );\n\n return async (\n prompt: string,\n traceId?: string,\n ): Promise<{ contract: StateContract; passed: boolean }> => {\n try {\n const contract = await wrapped(prompt, traceId);\n return { contract, passed: true };\n } catch (error) {\n if (error instanceof HandoffFailure) {\n // In shadow mode, return the failed contract without blocking\n if (shadowMode) {\n return { contract: error.contract, passed: false };\n }\n throw error;\n }\n throw error;\n }\n };\n}\n\n// ─── ParliamentCircuitBreaker ─────────────────────────────\n\n/**\n * A pre-configured circuit breaker for Parliament model responses.\n *\n * Cooperative models use L1+L2 validation.\n * Adversarial models use L1 only (they're supposed to be contrarian).\n */\nexport class ParliamentCircuitBreaker {\n private breakers: Map<string, TieredCircuitBreaker> = new Map();\n\n constructor(models: ParliamentModel[], configs?: Record<string, TieredCircuitBreakerConfig>) {\n for (const model of models) {\n const config = configs?.[model.id] ?? (\n model.isAdversarial\n ? { tier: 'L1' as const }\n : { tier: 'L1+L2' as const, l2Threshold: 0.7 }\n );\n this.breakers.set(model.id, new TieredCircuitBreaker(config));\n }\n }\n\n get(agentId: string): TieredCircuitBreaker | undefined {\n return this.breakers.get(agentId);\n }\n}\n\n// ─── ParliamentReducer ────────────────────────────────────\n\n/**\n * A ConsensusReducer configured for Parliament synthesis.\n *\n * Detects disagreements between model responses, computes agreement\n * ratios, and flags conflicts for the synthesizer to resolve.\n */\nexport class ParliamentReducer {\n private reducer: ConsensusReducer;\n\n constructor(config?: ConsensusReducerConfig) {\n this.reducer = new ConsensusReducer({\n conflictStrategy: config?.conflictStrategy ?? 'flag-only',\n minAgreementRatio: config?.minAgreementRatio ?? 0.6,\n consensusFields: config?.consensusFields ?? ['mainPoint', 'supportingArguments', 'conclusion'],\n includeIndividualOutputs: config?.includeIndividualOutputs ?? true,\n });\n }\n\n /**\n * Reduce multiple model responses into a consensus.\n */\n reduce(\n contracts: StateContract[],\n traceId?: string,\n ): {\n consensus: unknown;\n conflicts: Array<{\n field: string;\n values: Array<{ agentId: string; value: unknown }>;\n resolution: string;\n }>;\n agreementRatio: number;\n consensusReached: boolean;\n reducedContract: StateContract;\n } {\n const result = this.reducer.reduce(contracts);\n const reducedContract = this.reducer.createReducedContract(result, contracts, 'parliament-reducer', null);\n\n return {\n consensus: result.output,\n conflicts: result.conflicts,\n agreementRatio: result.agreementRatio,\n consensusReached: result.consensus,\n reducedContract,\n };\n }\n}\n\n// ─── ParliamentDeliberation ───────────────────────────────\n\n/**\n * Run a full Parliament deliberation with Lattice coordination.\n *\n * @param topic - The deliberation topic\n * @param models - Array of Parliament models to run\n * @param modelCalls - Map of model ID to model call function\n * @param config - Parliament configuration\n * @returns ParliamentDeliberationResult\n */\nexport async function runParliamentDeliberation(\n topic: string,\n models: ParliamentModel[],\n modelCalls: Map<string, (prompt: string) => Promise<unknown>>,\n config?: ParliamentConfig,\n): Promise<ParliamentDeliberationResult> {\n const start = Date.now();\n const traceId = createContract({\n fromAgent: 'parliament-topic',\n inputs: { topic },\n outputs: {},\n budget: { tokensUsed: 0, callsMade: 0, wallClockMs: 0 },\n }).traceId;\n\n // Set up audit log if configured\n let auditLog: ComplianceAuditLog | undefined;\n if (config?.auditLogPath) {\n auditLog = new ComplianceAuditLog({ logPath: config.auditLogPath });\n }\n\n // Run each model\n const modelContracts: StateContract[] = [];\n const modelResults: Array<{ model: ParliamentModel; result: { contract: StateContract; passed: boolean } }> = [];\n\n for (const model of models) {\n const modelCall = modelCalls.get(model.id);\n if (!modelCall) {\n continue;\n }\n\n const modelConfig = config?.modelConfigs?.[model.id] ?? config?.defaultModelConfig;\n const wrappedModel = wrapParliamentModel(model, modelCall, modelConfig);\n const result = await wrappedModel(topic, traceId);\n\n modelContracts.push(result.contract);\n modelResults.push({ model, result });\n\n // Log to audit if configured\n if (auditLog) {\n auditLog.append({\n agentId: model.id,\n modelRole: model.role,\n isAdversarial: model.isAdversarial ?? false,\n passed: result.passed,\n traceId,\n contractId: result.contract.id,\n });\n }\n }\n\n // Run consensus reduction\n const reducer = new ParliamentReducer(config?.reducer);\n const reduction = reducer.reduce(modelContracts, traceId);\n\n // Log consensus to audit\n if (auditLog) {\n auditLog.append({\n type: 'consensus',\n traceId,\n agreementRatio: reduction.agreementRatio,\n consensusReached: reduction.consensusReached,\n conflictCount: reduction.conflicts.length,\n modelCount: modelContracts.length,\n validModelCount: modelResults.filter(r => r.result.passed).length,\n });\n }\n\n return {\n modelContracts,\n consensus: reduction.consensus,\n conflicts: reduction.conflicts.map(c => ({\n field: c.field,\n values: c.values.map(v => ({ agentId: v.agentId, value: v.value })),\n resolution: c.resolution,\n })),\n agreementRatio: reduction.agreementRatio,\n consensusReached: reduction.consensusReached,\n totalDurationMs: Date.now() - start,\n traceId,\n };\n}\n\n\n"],"mappings":";AAOA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AAuFA,SAAS,oBACd,OACA,WACA,QACA;AACA,QAAM,aAAa,QAAQ,cAAc;AACzC,QAAM,gBAAgB,QAAQ,YAC5B,MAAM,gBACF,EAAE,MAAM,KAAc,IACtB,EAAE,MAAM,SAAkB,aAAa,IAAI;AAGjD,QAAM,UAAU;AAAA,IACd,OAAO,WAAmB,UAAU,MAAM;AAAA,IAC1C;AAAA,MACE,IAAI,MAAM;AAAA,MACV,SAAS;AAAA,IACX;AAAA,EACF;AAEA,SAAO,OACL,QACA,YAC0D;AAC1D,QAAI;AACF,YAAM,WAAW,MAAM,QAAQ,QAAQ,OAAO;AAC9C,aAAO,EAAE,UAAU,QAAQ,KAAK;AAAA,IAClC,SAAS,OAAO;AACd,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,IAC7D,CAAC;AAAA,EACH;AAEA,SAAO;AAAA,IACL;AAAA,IACA,WAAW,UAAU;AAAA,IACrB,WAAW,UAAU,UAAU,IAAI,QAAM;AAAA,MACvC,OAAO,EAAE;AAAA,MACT,QAAQ,EAAE,OAAO,IAAI,QAAM,EAAE,SAAS,EAAE,SAAS,OAAO,EAAE,MAAM,EAAE;AAAA,MAClE,YAAY,EAAE;AAAA,IAChB,EAAE;AAAA,IACF,gBAAgB,UAAU;AAAA,IAC1B,kBAAkB,UAAU;AAAA,IAC5B,iBAAiB,KAAK,IAAI,IAAI;AAAA,IAC9B;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @heybeaux/lattice-adapter-parliament\n *\n * Wraps Parliament's multi-model deliberations with Lattice State Contracts,\n * Circuit Breakers, and ConsensusReducer for coordinated, auditable synthesis.\n */\n\nimport {\n createContract,\n TieredCircuitBreaker,\n ConsensusReducer,\n ComplianceAuditLog,\n wrapAgent,\n HandoffFailure,\n EventEmitter,\n globalEmitter,\n redactContract,\n} from '@heybeaux/lattice-core';\nimport type {\n TieredCircuitBreakerConfig,\n ConsensusReducerConfig,\n StateContract,\n EmbeddingProvider,\n PolicyEvidenceRow,\n TieredValidationResult,\n ValidationTier,\n} from '@heybeaux/lattice-core';\n\nexport type { EmbeddingProvider, PolicyEvidenceRow };\n\n// ─── Types ────────────────────────────────────────────────\n\n/**\n * A Parliament model participant.\n */\nexport interface ParliamentModel {\n /** Unique identifier for the model (e.g., 'claude-opus-4-6') */\n id: string;\n /** Role in the deliberation (proposer, expander, pragmatist, etc.) */\n role: string;\n /** Whether this model is adversarial (skeptic, devils-advocate) */\n isAdversarial?: boolean;\n}\n\n/**\n * Configuration for wrapping a Parliament model.\n */\nexport interface ParliamentModelConfig {\n /** Circuit breaker configuration (defaults: L1+L2 for cooperative, L1 for adversarial) */\n breaker?: TieredCircuitBreakerConfig;\n /** Whether to redact sensitive data before validation (default: true) */\n redactForValidation?: boolean;\n /** Whether to run in shadow mode (validate but don't block) (default: true) */\n shadowMode?: boolean;\n}\n\n/**\n * Configuration for the Parliament integration.\n */\nexport interface ParliamentConfig {\n /** Audit log path (optional — if provided, all deliberations are logged) */\n auditLogPath?: string;\n /** ConsensusReducer configuration */\n reducer?: ConsensusReducerConfig;\n /** Per-model configurations (optional) */\n modelConfigs?: Record<string, ParliamentModelConfig>;\n /** Default model configuration (applied to all models without specific config) */\n defaultModelConfig?: ParliamentModelConfig;\n /** Embedding provider for semantic consensus comparison */\n embeddingProvider?: EmbeddingProvider;\n}\n\n/**\n * Result from wrapping a Parliament deliberation.\n */\nexport interface ParliamentDeliberationResult {\n /** State Contracts for each model response */\n modelContracts: StateContract[];\n /** The consensus/synthesis output */\n consensus: unknown;\n /** Conflicts detected between models */\n conflicts: Array<{\n field: string;\n values: Array<{ agentId: string; value: unknown }>;\n resolution: string;\n }>;\n /** Agreement ratio (0-1) */\n agreementRatio: number;\n /** Whether consensus was reached */\n consensusReached: boolean;\n /** Total deliberation time in milliseconds */\n totalDurationMs: number;\n /** Trace ID for the deliberation */\n traceId: string;\n}\n\n// ─── wrapParliamentModel ──────────────────────────────────\n\n/**\n * Wrap a Parliament model call with Lattice State Contracts and Circuit Breakers.\n *\n * The wrapped model:\n * 1. Executes the original model call\n * 2. Creates a State Contract with the model's response\n * 3. Validates through Circuit Breaker (L1+L2 for cooperative, L1 for adversarial)\n * 4. Returns the State Contract\n *\n * @param model - The Parliament model definition\n * @param modelCall - The model call function: (prompt) => Promise<response>\n * @param config - Configuration for this model\n * @returns A wrapped function that returns StateContract instead of raw response\n */\nexport function wrapParliamentModel(\n model: ParliamentModel,\n modelCall: (prompt: string) => Promise<unknown>,\n config?: ParliamentModelConfig,\n) {\n const shadowMode = config?.shadowMode ?? true;\n const breakerConfig = config?.breaker ?? (\n model.isAdversarial\n ? { tier: 'L1' as const }\n : { tier: 'L1+L2' as const, l2Threshold: 0.7 }\n );\n\n const wrapped = wrapAgent(\n async (prompt: string) => modelCall(prompt),\n {\n id: model.id,\n breaker: breakerConfig,\n },\n );\n\n return async (\n prompt: string,\n traceId?: string,\n ): Promise<{ contract: StateContract; passed: boolean }> => {\n try {\n const contract = await wrapped(prompt, traceId);\n return { contract, passed: true };\n } catch (error) {\n if (error instanceof HandoffFailure) {\n // In shadow mode, return the failed contract without blocking\n if (shadowMode) {\n return { contract: error.contract, passed: false };\n }\n throw error;\n }\n throw error;\n }\n };\n}\n\n// ─── ParliamentCircuitBreaker ─────────────────────────────\n\n/**\n * A pre-configured circuit breaker for Parliament model responses.\n *\n * Cooperative models use L1+L2 validation.\n * Adversarial models use L1 only (they're supposed to be contrarian).\n */\nexport class ParliamentCircuitBreaker {\n private breakers: Map<string, TieredCircuitBreaker> = new Map();\n\n constructor(models: ParliamentModel[], configs?: Record<string, TieredCircuitBreakerConfig>) {\n for (const model of models) {\n const config = configs?.[model.id] ?? (\n model.isAdversarial\n ? { tier: 'L1' as const }\n : { tier: 'L1+L2' as const, l2Threshold: 0.7 }\n );\n this.breakers.set(model.id, new TieredCircuitBreaker(config));\n }\n }\n\n get(agentId: string): TieredCircuitBreaker | undefined {\n return this.breakers.get(agentId);\n }\n}\n\n// ─── ParliamentReducer ────────────────────────────────────\n\n/**\n * A ConsensusReducer configured for Parliament synthesis.\n *\n * Detects disagreements between model responses, computes agreement\n * ratios, and flags conflicts for the synthesizer to resolve.\n *\n * When an embeddingProvider is supplied, the consensus fields\n * (mainPoint, supportingArguments, conclusion) are compared using\n * cosine similarity (≥0.85 = agreeing) instead of exact string equality.\n */\nexport class ParliamentReducer {\n private reducer: ConsensusReducer;\n\n constructor(config?: ConsensusReducerConfig, embeddingProvider?: EmbeddingProvider) {\n this.reducer = new ConsensusReducer({\n conflictStrategy: config?.conflictStrategy ?? 'flag-only',\n minAgreementRatio: config?.minAgreementRatio ?? 0.6,\n consensusFields: config?.consensusFields ?? ['mainPoint', 'supportingArguments', 'conclusion'],\n includeIndividualOutputs: config?.includeIndividualOutputs ?? true,\n embeddingProvider: embeddingProvider ?? config?.embeddingProvider,\n embeddingThreshold: config?.embeddingThreshold ?? 0.85,\n });\n }\n\n /**\n * Reduce multiple model responses into a consensus.\n */\n async reduce(\n contracts: StateContract[],\n traceId?: string,\n ): Promise<{\n consensus: unknown;\n conflicts: Array<{\n field: string;\n values: Array<{ agentId: string; value: unknown }>;\n resolution: string;\n }>;\n agreementRatio: number;\n consensusReached: boolean;\n reducedContract: StateContract;\n }> {\n const result = await this.reducer.reduce(contracts);\n const reducedContract = this.reducer.createReducedContract(result, contracts, 'parliament-reducer', null);\n\n return {\n consensus: result.output,\n conflicts: result.conflicts,\n agreementRatio: result.agreementRatio,\n consensusReached: result.consensus,\n reducedContract,\n };\n }\n}\n\n// ─── ParliamentDeliberation ───────────────────────────────\n\n/**\n * Run a full Parliament deliberation with Lattice coordination.\n *\n * @param topic - The deliberation topic\n * @param models - Array of Parliament models to run\n * @param modelCalls - Map of model ID to model call function\n * @param config - Parliament configuration\n * @returns ParliamentDeliberationResult\n */\nexport async function runParliamentDeliberation(\n topic: string,\n models: ParliamentModel[],\n modelCalls: Map<string, (prompt: string) => Promise<unknown>>,\n config?: ParliamentConfig,\n): Promise<ParliamentDeliberationResult> {\n const start = Date.now();\n const traceId = createContract({\n fromAgent: 'parliament-topic',\n inputs: { topic },\n outputs: {},\n budget: { tokensUsed: 0, callsMade: 0, wallClockMs: 0 },\n }).traceId;\n\n // Set up audit log if configured\n let auditLog: ComplianceAuditLog | undefined;\n if (config?.auditLogPath) {\n auditLog = new ComplianceAuditLog({ logPath: config.auditLogPath });\n }\n\n // Run each model\n const modelContracts: StateContract[] = [];\n const modelResults: Array<{ model: ParliamentModel; result: { contract: StateContract; passed: boolean } }> = [];\n\n for (const model of models) {\n const modelCall = modelCalls.get(model.id);\n if (!modelCall) {\n continue;\n }\n\n const modelConfig = config?.modelConfigs?.[model.id] ?? config?.defaultModelConfig;\n const wrappedModel = wrapParliamentModel(model, modelCall, modelConfig);\n const result = await wrappedModel(topic, traceId);\n\n modelContracts.push(result.contract);\n modelResults.push({ model, result });\n\n // Log to audit if configured\n if (auditLog) {\n auditLog.append({\n agentId: model.id,\n modelRole: model.role,\n isAdversarial: model.isAdversarial ?? false,\n passed: result.passed,\n traceId,\n contractId: result.contract.id,\n });\n }\n }\n\n // Run consensus reduction\n const reducer = new ParliamentReducer(config?.reducer, config?.embeddingProvider);\n const reduction = await reducer.reduce(modelContracts, traceId);\n\n // Log consensus to audit\n if (auditLog) {\n auditLog.append({\n type: 'consensus',\n traceId,\n agreementRatio: reduction.agreementRatio,\n consensusReached: reduction.consensusReached,\n conflictCount: reduction.conflicts.length,\n modelCount: modelContracts.length,\n validModelCount: modelResults.filter(r => r.result.passed).length,\n });\n }\n\n return {\n modelContracts,\n consensus: reduction.consensus,\n conflicts: reduction.conflicts.map(c => ({\n field: c.field,\n values: c.values.map(v => ({ agentId: v.agentId, value: v.value })),\n resolution: c.resolution,\n })),\n agreementRatio: reduction.agreementRatio,\n consensusReached: reduction.consensusReached,\n totalDurationMs: Date.now() - start,\n traceId,\n };\n}\n\n// ─── Governance / Sonder envelope ────────────────────────\n\n/**\n * Shape of the `governance` block on a SonderEvent envelope. Surfaces the\n * L0 evidence row trail produced by the Lattice breaker plus the\n * `+`-joined list of tiers that actually ran.\n *\n * - `tier` is `'+'`-joined and includes only tiers that ran (Spec 1 R8).\n * Skipped tiers (e.g. L1/L2/L3 after an L0 fail) MUST NOT appear.\n * - `evidence` carries the full per-rule audit trail from L0. Empty array\n * when no policy was bound; absent only when no validation ran at all.\n * - `policySet` / `policySetVersion` mirror the bound `PolicyRuleSet`.\n * Present iff L0 ran; absent otherwise.\n */\nexport interface SonderGovernanceBlock {\n /** `+`-joined list of tiers that actually ran (e.g. `'L0+L1'`). */\n tier: string;\n /** Pass/fail/uncertain — derived from the underlying ValidationResult. */\n verdict: 'pass' | 'fail';\n /** L0 evidence rows, in rule-set order. Empty array when L0 didn't run. */\n evidence: PolicyEvidenceRow[];\n /** PolicyRuleSet.id when L0 ran. */\n policySet?: string;\n /** PolicyRuleSet.version when L0 ran. */\n policySetVersion?: string;\n /** Optional reject reason — present when verdict === 'fail'. */\n reason?: string;\n}\n\n/**\n * Build the SonderEvent `governance` block from a Lattice contract +\n * the breaker's {@link TieredValidationResult}. Pulls L0 evidence /\n * policy identifiers from `contract.metadata.l0` (when present) and\n * computes the `+`-joined `tier` string from `validation.tiersRun`.\n *\n * Spec 1 R8: `tier` lists only tiers that actually ran. Spec 1 R7:\n * downstream signers consume this block and apply the sign-refusal rule.\n */\nexport function buildGovernanceBlock(\n contract: StateContract,\n validation: TieredValidationResult,\n): SonderGovernanceBlock {\n const l0 = (contract.metadata as {\n l0?: {\n ruleSetId: string;\n ruleSetVersion: string;\n evidence: PolicyEvidenceRow[];\n };\n }).l0;\n\n const tiersRun: ValidationTier[] = validation.tiersRun ?? [validation.tier];\n const tier = tiersRun.join('+');\n const verdict: 'pass' | 'fail' = validation.passed ? 'pass' : 'fail';\n\n const block: SonderGovernanceBlock = {\n tier,\n verdict,\n evidence: l0?.evidence ?? [],\n };\n if (l0) {\n block.policySet = l0.ruleSetId;\n block.policySetVersion = l0.ruleSetVersion;\n }\n if (!validation.passed && validation.reason) {\n block.reason = validation.reason;\n }\n return block;\n}\n\n/**\n * Error thrown by {@link assertSonderEventSignable} when a SonderEvent\n * envelope would violate Spec 1 R7's signing invariant. The `code`\n * field is a stable machine identifier; the message is human-facing.\n */\nexport class SignRefusedError extends Error {\n constructor(\n /**\n * Stable identifier — currently always `'l0-evidence-missing'`,\n * reserved for future R7 violations.\n */\n public readonly code: 'l0-evidence-missing',\n message?: string,\n ) {\n super(message ?? `Sonder sign refused: ${code}`);\n this.name = 'SignRefusedError';\n }\n}\n\n/**\n * Spec 1 R7 — refuse to sign a SonderEvent whose `governance.tier`\n * mentions any of `L1`, `L2`, `L3` but whose `governance.evidence` is\n * empty or absent. Sonder's runtime calls this immediately before the\n * ed25519 signing step; throwing here aborts the signature.\n *\n * Why this matters: without L0 evidence the audit trail cannot prove\n * the deterministic policy tier ran, so cryptographic provenance over\n * the validation chain would be a lie. Refusing to sign is the\n * cheapest enforcement boundary in the system.\n *\n * @throws {SignRefusedError} when the envelope violates R7.\n */\nexport function assertSonderEventSignable(\n governance: SonderGovernanceBlock,\n): void {\n const tiers = governance.tier.split('+');\n const mentionsLaterTiers =\n tiers.includes('L1') || tiers.includes('L2') || tiers.includes('L3');\n const evidence = governance.evidence;\n const evidenceMissing = !evidence || evidence.length === 0;\n\n if (mentionsLaterTiers && evidenceMissing) {\n throw new SignRefusedError(\n 'l0-evidence-missing',\n `Sonder sign refused (l0-evidence-missing): governance.tier=\"${governance.tier}\" mentions L1/L2/L3 but governance.evidence is empty`,\n );\n }\n}\n\n\n"],"mappings":";AAOA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AA+FA,SAAS,oBACd,OACA,WACA,QACA;AACA,QAAM,aAAa,QAAQ,cAAc;AACzC,QAAM,gBAAgB,QAAQ,YAC5B,MAAM,gBACF,EAAE,MAAM,KAAc,IACtB,EAAE,MAAM,SAAkB,aAAa,IAAI;AAGjD,QAAM,UAAU;AAAA,IACd,OAAO,WAAmB,UAAU,MAAM;AAAA,IAC1C;AAAA,MACE,IAAI,MAAM;AAAA,MACV,SAAS;AAAA,IACX;AAAA,EACF;AAEA,SAAO,OACL,QACA,YAC0D;AAC1D,QAAI;AACF,YAAM,WAAW,MAAM,QAAQ,QAAQ,OAAO;AAC9C,aAAO,EAAE,UAAU,QAAQ,KAAK;AAAA,IAClC,SAAS,OAAO;AACd,UAAI,iBAAiB,gBAAgB;AAEnC,YAAI,YAAY;AACd,iBAAO,EAAE,UAAU,MAAM,UAAU,QAAQ,MAAM;AAAA,QACnD;AACA,cAAM;AAAA,MACR;AACA,YAAM;AAAA,IACR;AAAA,EACF;AACF;AAUO,IAAM,2BAAN,MAA+B;AAAA,EAC5B,WAA8C,oBA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EACF;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heybeaux/lattice-adapter-parliament",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Lattice coordination layer for Parliament — wraps multi-model deliberations with State Contracts and Circuit Breakers",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",