//#region src/lateral-leak/merge-guard.d.ts /** * `MergeAgentSidewaysInjectionGuard` - layered on top of the * `Agent.fanOut(...)` `'judge-merge'` strategy. Computes a * per-child `sourceTrust` score in `[0.0, 1.0]` and flags merges * where a low-trust child's contribution-weight exceeds the * configured `maxLowTrustWeight` threshold. * * @packageDocumentation */ /** * Trust-class baseline used by the guard's `sourceTrust` * computation. Mirrors the DEC-149 trust-class taxonomy from * `@graphorin/provider`. * * @stable */ type TrustClass = 'loopback' | 'public-tls' | 'public-mtls' | 'untrusted-skill'; /** * Tool-source provenance multiplier. Mirrors the `ContentOrigin` * annotation from `@graphorin/memory.context-engine`. * * @stable */ type ContentOriginKind = 'built-in' | 'user-defined' | 'trusted-skill' | 'untrusted-skill' | 'mcp' | 'web-search'; /** * Per-agent guard configuration accepted by * `createAgent({ mergeGuard })`. * * @stable */ interface MergeGuardConfig { readonly strictness: 'off' | 'detect' | 'detect-and-flag' | 'detect-and-block'; /** Default `0.3`. */ readonly maxLowTrustWeight?: number; /** Default `0.5`. */ readonly lowTrustThreshold?: number; /** Operator overrides for known agent ids. */ readonly sourceTrustOverrides?: Readonly>; } /** * Per-child input descriptor for {@link computeSourceTrust}. * * @stable */ interface ChildTrustInput { readonly agentId: string; readonly trustClass: TrustClass; readonly origin: ContentOriginKind; /** Rolling trust score in `[0.0, 1.0]`. Defaults to `1.0`. */ readonly historyAdjustment?: number; } /** * Compose `baseline * provenance * historyAdjustment` and clamp. * * @stable */ declare function computeSourceTrust(input: ChildTrustInput, overrides?: Readonly>): number; /** * Pure decision returned by {@link evaluateMerge}. * * @stable */ interface MergeBiasDecision { readonly biased: boolean; readonly offendingChild?: string; readonly contributionWeight?: number; readonly sourceTrust?: number; readonly decision: 'pass-through' | 'flag' | 'block'; } /** * Evaluate whether the merge is biased - a child with * `sourceTrust < lowTrustThreshold` contributing more than * `maxLowTrustWeight` of the merged output. * * Inputs are pre-computed per-child trust scores together with the * estimated contribution weights (token-count overlap between each * child's output and the merged output, normalized to sum to ~1.0). * * @stable */ declare function evaluateMerge(perChild: ReadonlyArray<{ readonly agentId: string; readonly sourceTrust: number; readonly contributionWeight: number; }>, cfg: MergeGuardConfig): MergeBiasDecision; //#endregion export { ChildTrustInput, ContentOriginKind, MergeBiasDecision, MergeGuardConfig, TrustClass, computeSourceTrust, evaluateMerge }; //# sourceMappingURL=merge-guard.d.ts.map