feat: add user-level WeChat channel accounts

This commit is contained in:
2026-09-14 00:26:29 +08:00
parent 46e7f6f1cd
commit b7d8b1298f
15 changed files with 575 additions and 63 deletions

View File

@@ -177,6 +177,9 @@ export interface CloudChannelView {
policy_revision?: number;
adoption_state?: 'available' | 'managed_elsewhere' | 'managed_external' | string;
managed_agent_slug?: string | null;
target_agent_slug?: string | null;
target_agent_name?: string | null;
target_agent_published_version?: number | null;
}
export type CloudChannelAccountView = Partial<CloudChannelView> & {
id: string;
@@ -190,6 +193,26 @@ export interface CloudChannelBindingPage {
available_accounts?: CloudChannelAccountView[];
}
export interface CloudChannelConnectionPage { items: CloudChannelView[] }
export interface CloudUserChannelAccount {
id: string;
display_name: string;
binding_id: string | null;
revision: number;
enabled: boolean;
status: string;
health: string;
blockers: string[];
target_agent_slug: string | null;
target_agent_name: string | null;
target_agent_published_version: number | null;
access_mode?: string;
policy_revision?: number;
provider_generation?: string;
desired_state?: string;
last_confirmed_at?: string | null;
}
export interface CloudChannelAccountPage { items: CloudUserChannelAccount[] }
export interface CloudChannelAccountMutation { channel: CloudUserChannelAccount; target_agent?: string | null; wechat?: Record<string, unknown>; disconnected?: boolean }
export interface CloudChannelOperation {
operation_id: string;
status: 'pending' | 'completed' | 'failed' | 'unknown' | string;
@@ -392,6 +415,18 @@ export interface CloudAgentOperations {
deleteAttachment: Op<Thread & { file_id: string }, { message: string }>;
files: Op<Thread & { path: string }, { files: CloudFile[] }>;
channelConnections: Op<Record<string, never>, CloudChannelConnectionPage>;
channelAccounts: Op<Record<string, never>, CloudChannelAccountPage>;
createChannelAccount: Op<Operation & { display_name: string; account_key?: string }, CloudChannelAccountMutation>;
routeChannelAccount: Op<{ channel_account_id: string; operation_id: string; target_agent_slug: string | null; expected_revision: number; enabled: boolean }, CloudChannelAccountMutation>;
enableChannelAccount: Op<{ channel_account_id: string; operation_id: string; expected_revision: number }, CloudChannelAccountMutation>;
pauseChannelAccount: Op<{ channel_account_id: string; operation_id: string; expected_revision: number }, CloudChannelAccountMutation>;
disconnectChannelAccount: Op<{ channel_account_id: string; operation_id: string; expected_revision: number }, CloudChannelAccountMutation>;
channelAccountWechatBindStart: Op<{ channel_account_id: string; operation_id: string; force: boolean }, CloudWechatBindState>;
channelAccountWechatBindStatus: Op<{ channel_account_id: string; session_key: string }, CloudWechatBindState>;
channelAccountWechatBindVerification: Op<{ channel_account_id: string; operation_id: string; session_key: string; verify_code: string }, CloudWechatBindState>;
channelAccountWechatBindAccount: Op<{ channel_account_id: string }, CloudChannelAccountStatus>;
channelAccountWechatUnbind: Op<{ channel_account_id: string; operation_id: string }, CloudChannelAccountStatus>;
channelAccountOperation: Op<{ operation_id: string }, CloudChannelOperation>;
channelBindings: Op<Agent, CloudChannelBindingPage>;
createChannelBinding: Op<Agent & Operation & { display_name: string; channel_account_id?: string }, CloudChannelMutation>;
switchChannelBindingAgent: Op<Agent & { channel_account_id: string; operation_id: string; target_agent_slug: string; expected_revision: number; enabled: boolean }, CloudChannelMutation>;