/** * Typed client for the ours-cowork v1 private management-socket protocol. * * Cowork owns room state. Fleet only invokes the versioned JSON RPC exposed * by Cowork's Unix socket and projects the response into orchestration data. */ import type { Socket } from 'node:net'; import type { RoomHistoryEvidence } from './types.js'; export interface CoworkRoomCreateResult { room_id: string; identity_name: string; identity_cid: string; } export interface CoworkInviteAcceptResult { seat_cid: string; seat_state: 'pending' | 'active'; } export interface CoworkInviteResult { invite: string; invite_id: string; min_accepts: number; } export interface CoworkSeatInfo { identity_cid: string; display_name: string; invite_id: string; role: string; seat_state: 'pending' | 'active' | 'removed'; } export interface CoworkRoomInfo { room_id: string; identity_name: string; identity_cid: string; room_name: string; state: 'provisioning' | 'active' | 'closing' | 'closed'; anonymous: boolean; seats: CoworkSeatInfo[]; goal?: string; briefing?: string; role_briefings: Record; } export interface CoworkRoleBriefingInfo { role: string; text: string; version: number; updated_at: string; } export interface CoworkHistoryPage { records: RoomHistoryEvidence[]; raw_count: number; next_after: number; } export interface CoworkAdapter { available(): Promise; createRoom(opts: { room_name: string; goal: string; briefing: string; quiet_membership?: boolean; anonymous?: boolean; }): Promise; acceptInvite(roomId: string, invite: string, opts: { role: string; expected_cid: string; }): Promise; issueInvite(roomId: string, opts: { mode?: 'one_time' | 'public'; role: string; min_accepts: number; }): Promise; revokeInvite(roomId: string, inviteId: string): Promise; setRoleBriefing(roomId: string, opts: { role: string; text: string; }): Promise; setRoleCommands(roomId: string, opts: { role: string; commands: Array<'*' | 'list-members' | 'remove-member'>; }): Promise; getHistory(roomId: string, opts?: { after?: number; limit?: number; }): Promise; getRoom(roomId: string): Promise; listRooms(): Promise; closeRoom(roomId: string): Promise; deleteRoom(roomId: string): Promise; getSeats(roomId: string): Promise; recoverRoom(roomId: string): Promise; } export declare class CoworkUnavailableError extends Error { constructor(message?: string, options?: ErrorOptions); } export declare class CoworkProtocolError extends Error { readonly operation: string; readonly code: string; constructor(operation: string, message: string, code?: string, options?: ErrorOptions); } export interface CoworkAdapterOptions { configPath?: string; socketPath?: string; timeoutMs?: number; env?: NodeJS.ProcessEnv; home?: string; connect?: (path: string) => Socket; } /** Resolve the same config/state inputs as ours-cowork and return its Unix socket. */ export declare function resolveCoworkSocketPath(options?: CoworkAdapterOptions): string; export declare function createCoworkAdapter(options?: CoworkAdapterOptions): CoworkAdapter;