types(shared): add credentials/oauth channels, events, and desktop-api
- Add IPC_CHANNELS entries for credentials list/save/remove/test and oauth start/cancel/prompt/manual-code - Extend DesktopEvent union with oauth:*, credentials-changed, and agent-event variants used by pi-mono runtime and settings UI - Extend DesktopApi CredentialsApi with listCredentials / saveCredential / removeCredential / testCredential and OAuth submit helpers
This commit is contained in:
1 parent
1f310a121e
commit
ef90a58fa2
3 files changed
+100
-1
No files matched your search
@@ -133,4 +133,14 @@ export const IPC_CHANNELS = {
|
||||
windowMaximize: "window:maximize",
|
||||
windowClose: "window:close",
|
||||
windowIsMaximized: "window:isMaximized",
|
||||
// Credentials (pi-mono)
|
||||
credentialsList: "credentials:list",
|
||||
credentialsSave: "credentials:save",
|
||||
credentialsRemove: "credentials:remove",
|
||||
credentialsTest: "credentials:test",
|
||||
// OAuth (pi-mono)
|
||||
oauthStart: "oauth:start",
|
||||
oauthCancel: "oauth:cancel",
|
||||
oauthPromptResponse: "oauth:submit-prompt",
|
||||
oauthManualCodeResponse: "oauth:submit-manual-code",
|
||||
} as const;
|
||||
@@ -1,9 +1,28 @@
|
||||
import type { z } from "zod";
|
||||
import type { secretInputSchema } from "../schemas-company";
|
||||
import type { deleteEntitySchema } from "../schemas-badges";
|
||||
import type {
|
||||
CredentialSummary,
|
||||
SaveCredentialInput,
|
||||
} from "../schemas-credentials";
|
||||
import type {
|
||||
OAuthStartInput,
|
||||
OAuthPromptResponseInput,
|
||||
OAuthManualCodeResponseInput,
|
||||
} from "../schemas-oauth";
|
||||
import type { DesktopResult } from "./common";
|
||||
|
||||
export type CredentialsApi = {
|
||||
saveSecret: (input: z.infer<typeof secretInputSchema>) => Promise<DesktopResult<string>>;
|
||||
deleteSecret: (input: z.infer<typeof deleteEntitySchema>) => Promise<DesktopResult<boolean>>;
|
||||
// pi-mono credentials
|
||||
listCredentials: () => Promise<DesktopResult<CredentialSummary[]>>;
|
||||
saveCredential: (input: SaveCredentialInput) => Promise<DesktopResult<CredentialSummary>>;
|
||||
removeCredential: (input: { connectorId: string }) => Promise<DesktopResult<boolean>>;
|
||||
testCredential: (input: { connectorId: string }) => Promise<DesktopResult<{ ok: boolean; message: string }>>;
|
||||
// pi-mono OAuth
|
||||
startOAuth: (input: OAuthStartInput) => Promise<DesktopResult<boolean>>;
|
||||
cancelOAuth: (input: { connectorId: string }) => Promise<DesktopResult<boolean>>;
|
||||
submitOAuthPrompt: (input: OAuthPromptResponseInput) => Promise<DesktopResult<boolean>>;
|
||||
submitOAuthManualCode: (input: OAuthManualCodeResponseInput) => Promise<DesktopResult<boolean>>;
|
||||
};
|
||||
Reference in new issue
Block a user