Files
SubMiner/src/types/sync-ui.ts
T
sudacode 806c56a99b refactor(sync): collapse 11 sync args into forwarded token array
- Replace syncHost/syncSnapshotPath/… with syncCliTokens: string[] passed verbatim to --sync-cli sync
- Move sync CLI validation from launcher to parseSyncCliTokens (app-side single owner)
- Extract resolveImmersionDbPath to shared db-path.ts importable by both launcher and app
- Delete driver.ts; inline types into libsql-driver.ts and hard-wire openLibsqlSyncDb
- Drop OpenSyncDb injection from mergeSnapshotIntoDb and createDbSnapshot
2026-07-12 22:31:59 -07:00

82 lines
2.3 KiB
TypeScript

import type { SyncProgressEvent } from '../shared/sync/sync-events';
import type { SyncDirection, SyncHostsState } from '../shared/sync/sync-hosts-store';
export type { SyncProgressEvent } from '../shared/sync/sync-events';
export type { SyncDirection, SyncHostEntry, SyncHostsState } from '../shared/sync/sync-hosts-store';
export interface SyncUiSnapshotFile {
path: string;
name: string;
sizeBytes: number;
modifiedAtMs: number;
}
export type SyncUiRunKind = 'host-sync' | 'merge' | 'check' | 'snapshot';
export interface SyncUiRunState {
running: boolean;
runId: number | null;
kind: SyncUiRunKind | null;
host: string | null;
}
export interface SyncUiSnapshot {
dbPath: string;
hosts: SyncHostsState;
snapshotsDir: string;
snapshots: SyncUiSnapshotFile[];
run: SyncUiRunState;
}
export interface SyncUiRunRequest {
host: string;
direction?: SyncDirection;
force?: boolean;
}
export interface SyncUiStartResult {
started: boolean;
runId: number | null;
reason: string | null;
}
export interface SyncUiCheckResult {
host: string;
sshOk: boolean;
remoteCommand: string | null;
remoteVersion: string | null;
ok: boolean;
error: string | null;
}
export interface SyncUiProgressPayload {
runId: number;
kind: SyncUiRunKind;
host: string | null;
event: SyncProgressEvent;
}
export interface SyncUiHostUpdateRequest {
host: string;
label?: string | null;
direction?: SyncDirection;
autoSync?: boolean;
}
export interface SyncUiAPI {
getSnapshot: () => Promise<SyncUiSnapshot>;
saveHost: (update: SyncUiHostUpdateRequest) => Promise<void>;
removeHost: (host: string) => Promise<void>;
setAutoSyncInterval: (minutes: number) => Promise<void>;
runSync: (request: SyncUiRunRequest) => Promise<SyncUiStartResult>;
cancelRun: () => Promise<boolean>;
checkHost: (host: string) => Promise<SyncUiCheckResult>;
createSnapshot: () => Promise<SyncUiStartResult>;
mergeSnapshotFile: (path: string, force?: boolean) => Promise<SyncUiStartResult>;
deleteSnapshot: (path: string) => Promise<void>;
revealSnapshot: (path: string) => Promise<boolean>;
pickSnapshotFile: () => Promise<string | null>;
onProgress: (listener: (payload: SyncUiProgressPayload) => void) => () => void;
onStateChanged: (listener: () => void) => () => void;
}