import type { FabricExecutionOutcomeV1, FabricExecutionTraceObserver } from "./trace.js"; export declare const FABRIC_ASSESSMENT_TRACE_KIND: "pi-fabric.assessment"; export declare const FABRIC_ASSESSMENT_TRACE_VERSION: 1; export declare const FABRIC_ASSESSMENT_TRACE_MAX_BYTES: number; export type FabricAssessmentSourceV1 = "agent" | "jev" | "classifier" | "provider"; export interface FabricAssessmentUsageV1 { input: number; output: number; cacheRead: number; cacheWrite: number; totalTokens: number; /** USD, present only when the operation reported a cost. */ cost?: number; } export interface FabricAssessmentOperationV1 { /** Joins with the execution trace operation of the same sequence. */ sequence: number; ref: string; outcome: FabricExecutionOutcomeV1; durationMs: number; source?: FabricAssessmentSourceV1; model?: string; usage?: FabricAssessmentUsageV1; } export interface FabricAssessmentTraceV1 { kind: typeof FABRIC_ASSESSMENT_TRACE_KIND; version: typeof FABRIC_ASSESSMENT_TRACE_VERSION; outcome: FabricExecutionOutcomeV1; /** Whole-program wall time. */ durationMs: number; operations: FabricAssessmentOperationV1[]; /** Totals cover every observed operation, including dropped ones. */ totals: { operations: number; succeeded: number; failed: number; usage: FabricAssessmentUsageV1; }; counts: { droppedOperations: number; }; } export interface FabricAssessmentAttribution { source?: FabricAssessmentSourceV1; model?: string; usage?: FabricAssessmentUsageV1; } /** * Reads the usage shapes Fabric operations already report: Pi `Usage` * (`cost.total`), agent run `AgentUsage` (`cost` number), and Jev * (`input_tokens`/`output_tokens`). Anything else yields no usage. */ export declare const readFabricAssessmentUsage: (value: unknown) => FabricAssessmentUsageV1 | undefined; /** * Opt-in, non-deterministic companion to the execution trace: timings, * model attribution, and token usage per operation. It never holds * arguments, results, source, or error prose. Memory stays bounded: past * MAX_OPERATIONS detailed rows, settled operations fold into the totals. */ export declare class FabricAssessmentRecorder implements FabricExecutionTraceObserver { #private; readonly now: () => number; constructor(now?: () => number); issued(sequence: number, ref: string): void; settled(sequence: number, outcome: FabricExecutionOutcomeV1, result: unknown): void; /** Explicit attribution for usage that is not part of an operation result (classifier). */ attribute(sequence: number, attribution: FabricAssessmentAttribution): void; seal(outcome: FabricExecutionOutcomeV1): FabricAssessmentTraceV1; } /** Drops trailing operations (never totals) until the projection fits. */ export declare const trimFabricAssessmentTrace: (trace: FabricAssessmentTraceV1, maxBytes: number) => FabricAssessmentTraceV1; export declare const isFabricAssessmentTraceV1: (value: unknown) => value is FabricAssessmentTraceV1; export declare const readFabricAssessmentTraceV1: (value: unknown) => FabricAssessmentTraceV1 | undefined; //# sourceMappingURL=assessment.d.ts.map