import type { AgentChatMode, ProjectRegistration } from './types'; /** * サーバーによる恒久的な認証拒否が起こりうる WebSocket トランスポートの種別。 * 新しいトランスポートを追加する際はここに追記する(タイポを型で弾くため)。 */ export type TransportKind = 'terminal' | 'vscode'; export interface IpcStartMessage { type: 'start'; project: ProjectRegistration; agentId: string; options: { pollInterval: number; heartbeatInterval: number; agentChatMode?: AgentChatMode; defaultProjectDir?: string; verbose?: boolean; }; } export interface IpcShutdownMessage { type: 'shutdown'; /** * Drain budget (ms) for the graceful shutdown of the receiving worker (see * `ProjectAgent.shutdown`). Sent by `ChildProcessManager` as * `FORK_SHUTDOWN_DRAIN_TIMEOUT_MS`, a smaller budget than the top-level * `SHUTDOWN_DRAIN_TIMEOUT_MS` because the parent force-kills a child that * has not exited within `CHILD_PROCESS_STOP_TIMEOUT_MS`. Optional so older * senders (and direct IPC messages in tests) still type-check; the receiver * falls back to a default when absent. */ drainTimeoutMs?: number; } export interface IpcUpdateMessage { type: 'update'; } export interface IpcTokenUpdateMessage { type: 'token_update'; token: string; } export interface IpcBusyQueryMessage { type: 'busy_query'; } export type ParentToChildMessage = IpcStartMessage | IpcShutdownMessage | IpcUpdateMessage | IpcTokenUpdateMessage | IpcBusyQueryMessage; export interface IpcStartedMessage { type: 'started'; tenantCode: string; projectCode: string; } export interface IpcErrorMessage { type: 'error'; tenantCode: string; projectCode: string; message: string; } export interface IpcStoppedMessage { type: 'stopped'; tenantCode: string; projectCode: string; } export interface IpcBusyResponseMessage { type: 'busy_response'; tenantCode: string; projectCode: string; busy: boolean; } export interface IpcUpdateCompleteMessage { type: 'update_complete'; tenantCode: string; projectCode: string; } /** * 子プロセス内の WebSocket 接続が、サーバーによる恒久的な認証拒否 * (無効なトークン、Agent ID トークンバインディング不一致)で切断され、 * 再接続を停止したことを親プロセスに通知する。子プロセス自体は他の * トランスポート(AppSync 等)のために生存し続けるため子プロセスの exit * では検知できず、この通知がないと親も監視基盤も気づけない。 */ export interface IpcAuthRejectedMessage { type: 'auth_rejected'; tenantCode: string; projectCode: string; /** 拒否されたトランスポート */ transport: TransportKind; } export type ChildToParentMessage = IpcStartedMessage | IpcErrorMessage | IpcStoppedMessage | IpcBusyResponseMessage | IpcUpdateCompleteMessage | IpcAuthRejectedMessage; export declare function isParentToChildMessage(msg: unknown): msg is ParentToChildMessage; export declare function isChildToParentMessage(msg: unknown): msg is ChildToParentMessage; //# sourceMappingURL=ipc-types.d.ts.map