refactor(contracts): compose DesktopApi from per-domain sub-interfaces

Split the flat 134-method DesktopApi interface into 12 domain
sub-interfaces (companies, agents, tasks, runs, approvals,
communication, threads, credentials, skills, budget, automation,
window) under src/shared/contracts/desktop-api/. desktop-api.ts
now intersects them to preserve the exact external flat shape;
window.agentCompany consumers and preload wiring are untouched.
This commit is contained in:
ZacharyZhang-NY committed 2026-04-16 23:28:08 -04:00
1 parent 0f881097bc
commit 5f147e0b9a
14 files changed
+319 -283

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
import type { z } from "zod";
import type { RunLogChunk, RunRecord } from "../../types";
import type { cancelRunSchema, runLogChunkSchema, runLogSchema, startRunSchema } from "../schemas-execution";
import type { entityGetterSchema } from "../schemas-badges";
import type { DesktopResult, RunEventRecord } from "./common";
export type RunsApi = {
startTaskRun: (input: z.infer<typeof startRunSchema>) => Promise<DesktopResult<string>>;
cancelRun: (input: z.infer<typeof cancelRunSchema>) => Promise<DesktopResult<boolean>>;
getRunLog: (input: z.infer<typeof runLogSchema>) => Promise<DesktopResult<string>>;
getRunLogChunk: (input: z.infer<typeof runLogChunkSchema>) => Promise<DesktopResult<RunLogChunk>>;
getRun: (input: z.infer<typeof entityGetterSchema>) => Promise<DesktopResult<RunRecord>>;
listRunEvents: (companyId: string, runId: string, opts?: { offset?: number; limit?: number }) => Promise<DesktopResult<RunEventRecord[]>>;
recoveryRetry: (taskId: string, agentId: string, companyId: string) => Promise<DesktopResult<null>>;
recoveryDismiss: (taskId: string) => Promise<DesktopResult<null>>;
recoveryFail: (taskId: string) => Promise<DesktopResult<null>>;
};