import { type Static } from '@sinclair/typebox'; import type { RuleHostInput } from './internalization/rule-host-contracts.js'; import type { RuleContextV2 } from './internalization/rule-context-v2.js'; import type { GoldenTraceCaseInput } from './internalization/artificer-output.js'; import type { ToolSemanticRegistry } from './internalization/tool-semantic-registry.js'; export declare const CorrectionApplicationModeSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"shadow">, import("@sinclair/typebox").TLiteral<"live">]>; export declare const GoldenTraceDecisionSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"allow">, import("@sinclair/typebox").TLiteral<"block">, import("@sinclair/typebox").TLiteral<"propose_correction">]>; export declare const GoldenTraceCaseKindSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"negative">, import("@sinclair/typebox").TLiteral<"positive">]>; export declare const GoldenTraceCaseSchema: import("@sinclair/typebox").TObject<{ caseId: import("@sinclair/typebox").TString; kind: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"negative">, import("@sinclair/typebox").TLiteral<"positive">]>; toolName: import("@sinclair/typebox").TString; params: import("@sinclair/typebox").TRecord; expectedDecision: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"allow">, import("@sinclair/typebox").TLiteral<"block">, import("@sinclair/typebox").TLiteral<"propose_correction">]>; expectedProposedParams: import("@sinclair/typebox").TOptional>; expectedApplicationMode: import("@sinclair/typebox").TOptional, import("@sinclair/typebox").TLiteral<"live">]>>; sourceRefs: import("@sinclair/typebox").TOptional; candidateId: import("@sinclair/typebox").TOptional; artifactId: import("@sinclair/typebox").TOptional; auditEventId: import("@sinclair/typebox").TOptional; }>>; ruleContext: import("@sinclair/typebox").TOptional; }>; export declare const GoldenTraceSchema: import("@sinclair/typebox").TObject<{ traceId: import("@sinclair/typebox").TString; sourcePainId: import("@sinclair/typebox").TOptional; sourceCandidateId: import("@sinclair/typebox").TOptional; sourceArtifactId: import("@sinclair/typebox").TOptional; cases: import("@sinclair/typebox").TArray, import("@sinclair/typebox").TLiteral<"positive">]>; toolName: import("@sinclair/typebox").TString; params: import("@sinclair/typebox").TRecord; expectedDecision: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"allow">, import("@sinclair/typebox").TLiteral<"block">, import("@sinclair/typebox").TLiteral<"propose_correction">]>; expectedProposedParams: import("@sinclair/typebox").TOptional>; expectedApplicationMode: import("@sinclair/typebox").TOptional, import("@sinclair/typebox").TLiteral<"live">]>>; sourceRefs: import("@sinclair/typebox").TOptional; candidateId: import("@sinclair/typebox").TOptional; artifactId: import("@sinclair/typebox").TOptional; auditEventId: import("@sinclair/typebox").TOptional; }>>; ruleContext: import("@sinclair/typebox").TOptional; }>>; createdAt: import("@sinclair/typebox").TString; version: import("@sinclair/typebox").TLiteral<1>; }>; export type CorrectionApplicationMode = Static; export type GoldenTraceDecision = Static; export type GoldenTraceCaseKind = Static; export type GoldenTraceCase = Omit, 'ruleContext'> & { readonly ruleContext?: RuleContextV2; }; export type GoldenTrace = Omit, 'cases'> & { cases: GoldenTraceCase[]; }; export interface GoldenTraceValidationResult { valid: boolean; errors: string[]; } export interface ToolCallSnapshot { toolName: string; params: Record; } export interface SyntheticRuleHostInputOverrides { workspace?: Partial; session?: Partial; evolution?: Partial; derived?: Partial; normalizedPath?: string | null; context?: RuleContextV2; } /** * Options for createSyntheticRuleHostInput (PRI-439 Phase 3). * * When `projectDir` is provided and `overrides.normalizedPath` is NOT set, * the action snapshot is built via `buildRuleHostAction` — extracting the * file path from `snapshot.params` and normalizing it against `projectDir`. * This produces a non-null `normalizedPath` that matches the production * OpenClaw Gate, so path-based rules can be validated in Golden Trace replay. * * When `projectDir` is NOT provided, `normalizedPath` falls back to `null` * (backwards compat with existing callers that don't have a project dir). * * PRI-634-F Phase 2: when `toolSemantics` is provided, the canonical kind is * resolved from the SAME registry the production gate uses, echoed onto * `action.canonicalKind`, and used to derive the bash/write extraction hints * inside buildRuleHostAction — closing the replay/production divergence where * bash command extraction and write-tool synthetic paths never fired in * replay. Absent → legacy behavior (no canonicalKind, no derived hints). */ export interface CreateSyntheticRuleHostInputOptions { projectDir?: string; toolSemantics?: ToolSemanticRegistry; } export interface GoldenTraceFixtureInput { toolName: string; negativeParams: Record; positiveParams: Record; expectedDecision: GoldenTraceDecision; expectedProposedParams?: Record; expectedApplicationMode?: CorrectionApplicationMode; sourcePainId?: string; sourceCandidateId?: string; sourceArtifactId?: string; createdAt?: string; } export declare function validateGoldenTraceCase(input: unknown): GoldenTraceValidationResult; export declare function validateGoldenTrace(input: unknown): GoldenTraceValidationResult; export declare function createSyntheticRuleHostInput(snapshot: ToolCallSnapshot, overrides?: SyntheticRuleHostInputOverrides, options?: CreateSyntheticRuleHostInputOptions): RuleHostInput; export declare function createGoldenTraceFixture(input: GoldenTraceFixtureInput): GoldenTrace; /** * Input for buildGoldenTraceFromArtificer (RuleHost MVP Activation, PRD Decision 5). * * `cases` accepts a shape compatible with both the strict `GoldenTraceCaseInput` * interface (artificer TS callers) and the TypeBox `GoldenTraceCaseInputTypebox` * static type (L2 tool params decoded from JSON, where `ruleContext` is `unknown` * until runtime-validated). Each entry is re-validated by `validateGoldenTraceCase` * before use, so a loose input type here is safe — Runtime Contract Rule 4. */ export interface BuildGoldenTraceFromArtificerInput { readonly cases: readonly (Omit & { readonly ruleContext?: unknown; })[]; readonly sourceArtifactId?: string; /** Override for createdAt; defaults to current ISO-8601 UTC timestamp. */ readonly createdAt?: string; } export type BuildGoldenTraceResult = { readonly ok: true; readonly trace: GoldenTrace; } | { readonly ok: false; readonly reason: string; }; /** * Wrap Artificer's 2-10 GoldenTraceCaseInput[] into a complete GoldenTrace with * metadata (traceId / createdAt / version). Unlike createGoldenTraceFixture * (fixed 2-case shape), this preserves an arbitrary number of cases. * * Returns a discriminated union rather than throwing: 0 cases, missing * positive/negative partner, or malformed input yields `{ ok: false, reason }` * so the caller (Evaluator assembly) can degrade gracefully without try/catch. * * The produced GoldenTrace is validated against validateGoldenTrace() before * returning; a result with ok=true always passes structural validation. */ export declare function buildGoldenTraceFromArtificer(input: BuildGoldenTraceFromArtificerInput): BuildGoldenTraceResult; //# sourceMappingURL=golden-trace.d.ts.map