107 lines
3.9 KiB
TypeScript
107 lines
3.9 KiB
TypeScript
import type {
|
|
GitCheckoutInput,
|
|
GitCreateBranchInput,
|
|
GitCreateWorktreeInput,
|
|
GitCreateWorktreeResult,
|
|
GitInitInput,
|
|
GitListBranchesInput,
|
|
GitListBranchesResult,
|
|
GitPullInput,
|
|
GitPullResult,
|
|
GitRemoveWorktreeInput,
|
|
GitRunStackedActionInput,
|
|
GitRunStackedActionResult,
|
|
GitStatusInput,
|
|
GitStatusResult,
|
|
} from "./git";
|
|
import type { ProjectSearchEntriesInput, ProjectSearchEntriesResult } from "./project";
|
|
import type { ServerConfig } from "./server";
|
|
import type {
|
|
TerminalClearInput,
|
|
TerminalCloseInput,
|
|
TerminalEvent,
|
|
TerminalOpenInput,
|
|
TerminalResizeInput,
|
|
TerminalSessionSnapshot,
|
|
TerminalWriteInput,
|
|
} from "./terminal";
|
|
import type { ServerUpsertKeybindingInput, ServerUpsertKeybindingResult } from "./server";
|
|
import type {
|
|
ClientOrchestrationCommand,
|
|
OrchestrationGetFullThreadDiffInput,
|
|
OrchestrationGetFullThreadDiffResult,
|
|
OrchestrationGetTurnDiffInput,
|
|
OrchestrationGetTurnDiffResult,
|
|
OrchestrationEvent,
|
|
OrchestrationReadModel,
|
|
} from "./orchestration";
|
|
import { EditorId } from "./editor";
|
|
|
|
export interface DesktopBridge {
|
|
getWsUrl: () => string | null;
|
|
pickFolder: () => Promise<string | null>;
|
|
confirm: (message: string) => Promise<boolean>;
|
|
showContextMenu: <T extends string>(
|
|
items: readonly { id: T; label: string }[],
|
|
position?: { x: number; y: number },
|
|
) => Promise<T | null>;
|
|
openExternal: (url: string) => Promise<boolean>;
|
|
onMenuAction: (listener: (action: string) => void) => () => void;
|
|
}
|
|
|
|
export interface NativeApi {
|
|
dialogs: {
|
|
pickFolder: () => Promise<string | null>;
|
|
confirm: (message: string) => Promise<boolean>;
|
|
};
|
|
terminal: {
|
|
open: (input: TerminalOpenInput) => Promise<TerminalSessionSnapshot>;
|
|
write: (input: TerminalWriteInput) => Promise<void>;
|
|
resize: (input: TerminalResizeInput) => Promise<void>;
|
|
clear: (input: TerminalClearInput) => Promise<void>;
|
|
restart: (input: TerminalOpenInput) => Promise<TerminalSessionSnapshot>;
|
|
close: (input: TerminalCloseInput) => Promise<void>;
|
|
onEvent: (callback: (event: TerminalEvent) => void) => () => void;
|
|
};
|
|
projects: {
|
|
searchEntries: (input: ProjectSearchEntriesInput) => Promise<ProjectSearchEntriesResult>;
|
|
};
|
|
shell: {
|
|
openInEditor: (cwd: string, editor: EditorId) => Promise<void>;
|
|
openExternal: (url: string) => Promise<void>;
|
|
};
|
|
git: {
|
|
// Existing branch/worktree API
|
|
listBranches: (input: GitListBranchesInput) => Promise<GitListBranchesResult>;
|
|
createWorktree: (input: GitCreateWorktreeInput) => Promise<GitCreateWorktreeResult>;
|
|
removeWorktree: (input: GitRemoveWorktreeInput) => Promise<void>;
|
|
createBranch: (input: GitCreateBranchInput) => Promise<void>;
|
|
checkout: (input: GitCheckoutInput) => Promise<void>;
|
|
init: (input: GitInitInput) => Promise<void>;
|
|
// Stacked action API
|
|
pull: (input: GitPullInput) => Promise<GitPullResult>;
|
|
status: (input: GitStatusInput) => Promise<GitStatusResult>;
|
|
runStackedAction: (input: GitRunStackedActionInput) => Promise<GitRunStackedActionResult>;
|
|
};
|
|
contextMenu: {
|
|
show: <T extends string>(
|
|
items: readonly { id: T; label: string }[],
|
|
position?: { x: number; y: number },
|
|
) => Promise<T | null>;
|
|
};
|
|
server: {
|
|
getConfig: () => Promise<ServerConfig>;
|
|
upsertKeybinding: (input: ServerUpsertKeybindingInput) => Promise<ServerUpsertKeybindingResult>;
|
|
};
|
|
orchestration: {
|
|
getSnapshot: () => Promise<OrchestrationReadModel>;
|
|
dispatchCommand: (command: ClientOrchestrationCommand) => Promise<{ sequence: number }>;
|
|
getTurnDiff: (input: OrchestrationGetTurnDiffInput) => Promise<OrchestrationGetTurnDiffResult>;
|
|
getFullThreadDiff: (
|
|
input: OrchestrationGetFullThreadDiffInput,
|
|
) => Promise<OrchestrationGetFullThreadDiffResult>;
|
|
replayEvents: (fromSequenceExclusive: number) => Promise<OrchestrationEvent[]>;
|
|
onDomainEvent: (callback: (event: OrchestrationEvent) => void) => () => void;
|
|
};
|
|
}
|