import type { ICommandDefinition } from '@push.rocks/smartrust'; // ==================== Repository Config ==================== export interface IRepositoryConfig { version: number; id: string; createdAt: string; chunking: IChunkingConfig; compression: string; encryption?: IEncryptionConfig; packTargetSize: number; } export interface IChunkingConfig { algorithm: string; minSize: number; avgSize: number; maxSize: number; } export interface IEncryptionConfig { algorithm: string; kdf: string; kdfParams: IKdfParams; } export interface IKdfParams { memory: number; iterations: number; parallelism: number; } // ==================== Snapshots ==================== export interface ISnapshot { id: string; version: number; createdAt: string; tags: Record; originalSize: number; storedSize: number; chunkCount: number; newChunks: number; reusedChunks: number; items: ISnapshotItem[]; } export interface ISnapshotItem { name: string; type: string; size: number; chunks: string[]; } export interface ISnapshotFilter { tags?: Record; after?: string; before?: string; } // ==================== Ingest ==================== export interface IInitOptions { passphrase?: string; chunking?: Partial; packTargetSize?: number; } export interface IOpenOptions { passphrase?: string; } export interface IIngestOptions { tags?: Record; items?: IIngestItemOptions[]; } export interface IIngestItemOptions { name: string; type?: string; } export interface IIngestItem { stream: NodeJS.ReadableStream; name: string; type?: string; } // ==================== Restore ==================== export interface IRestoreOptions { item?: string; } // ==================== Maintenance ==================== export interface IVerifyOptions { level?: 'quick' | 'standard' | 'full'; } export interface IVerifyResult { ok: boolean; errors: IVerifyError[]; stats: { packsChecked: number; chunksChecked: number; snapshotsChecked: number; }; } export interface IVerifyError { pack?: string; chunk?: string; snapshot?: string; error: string; } export interface IRetentionPolicy { keepLast?: number; keepDays?: number; keepWeeks?: number; keepMonths?: number; } export interface IPruneResult { removedSnapshots: number; removedPacks: number; rewrittenPacks: number; freedBytes: number; dryRun: boolean; } export interface IRepairResult { indexRebuilt: boolean; indexedChunks: number; staleLocksRemoved: number; packsRepaired: number; errors: string[]; } export interface IUnlockOptions { force?: boolean; } // ==================== Events ==================== export interface IIngestProgress { operation: string; percentage: number; message: string; } export interface IIngestComplete { snapshotId: string; originalSize: number; storedSize: number; newChunks: number; reusedChunks: number; } // ==================== IPC Command Map ==================== export type TContainerArchiveCommands = { init: ICommandDefinition< { path: string; passphrase?: string }, IRepositoryConfig >; open: ICommandDefinition< { path: string; passphrase?: string }, IRepositoryConfig >; close: ICommandDefinition< Record, Record >; ingest: ICommandDefinition< { socketPath: string; tags?: Record; items?: IIngestItemOptions[]; }, { snapshot: ISnapshot } >; ingestMulti: ICommandDefinition< { tags?: Record; items: Array<{ name: string; type: string; socketPath: string }>; }, { snapshot: ISnapshot } >; restore: ICommandDefinition< { snapshotId: string; socketPath: string; item?: string; }, Record >; listSnapshots: ICommandDefinition< { filter?: ISnapshotFilter }, { snapshots: ISnapshot[] } >; getSnapshot: ICommandDefinition< { snapshotId: string }, { snapshot: ISnapshot } >; verify: ICommandDefinition< { level: string }, IVerifyResult >; repair: ICommandDefinition< Record, IRepairResult >; prune: ICommandDefinition< { retention: IRetentionPolicy; dryRun?: boolean }, IPruneResult >; reindex: ICommandDefinition< Record, { indexedChunks: number } >; unlock: ICommandDefinition< { force?: boolean }, { removedLocks: number } >; };