zephyr-agent
Version:
Zephyr plugin agent
44 lines • 2.06 kB
text/typescript
import type { ChangeAttribution, ChangeAttributionRange, ChangeSession } from 'zephyr-edge-contract';
export { readAttributionConfig, type AttributionConfig } from './config.mjs';
export interface SourceFile {
hash: string;
mode: string;
content: string;
attribution: ChangeAttributionRange[];
/** Matching committed bytes; blame is deferred until this file differs in a comparison. */
committed?: boolean;
}
export interface SourceRecord {
schemaVersion: 1;
id: string;
fingerprint: string;
baseCommit: string;
dirty: boolean;
capturedAt: string;
workspaceHuman?: string;
sessions?: Record<string, ChangeSession>;
files: Record<string, SourceFile>;
}
export interface SourceCapture {
phase: 'build-start' | 'publication';
root: string;
gitDir: string;
record?: SourceRecord;
reason?: string;
storage?: 'local' | 'remote';
}
export declare function attributionRepository(directory: string): {
root: string;
gitDir: string;
};
/** Opt-in capture. The saved scope is Git-eligible files, not all build inputs. */
export declare function captureSource(directory: string, phase?: SourceCapture['phase']): SourceCapture | undefined;
/** Store a version-to-source receipt separately from build assets. */
export declare function finishSourceCapture(directory: string, start: SourceCapture | undefined, version: string): ChangeAttribution | undefined;
export declare function loadSourceRecord(directory: string, id: string): SourceRecord;
export declare function loadVersionAttribution(directory: string, version: string): ChangeAttribution;
/** Enrich only changed comparison files. Never mutate an immutable source receipt. */
export declare function comparisonFile(directory: string, record: SourceRecord, file: string): SourceFile | undefined;
/** Exact Git HEAD baseline for a captured dirty tree, applying the same exclusions. */
export declare function sourceCommitBaseline(directory: string, captured: SourceRecord): SourceRecord;
//# sourceMappingURL=source.d.mts.map