gadget/packages/api/src/messages/drone.ts
Rob Colbert e1a446a3f3 Phase 5: Implement workspace persistence and crash recovery
- Create WorkspaceService for managing .gadget/ directory
- Implement workspace.json for persistent identity (workspaceId UUID)
- Add work order cache for crash recovery
- Update drone registration to include workspaceId
- Add crash recovery socket events (requestCrashRecovery, crashRecoveryResponse)
- Implement crash recovery handler in DroneSession
- Write work order cache before processing, remove after completion
2026-04-29 16:44:02 -04:00

50 lines
1.3 KiB
TypeScript

// src/messages/drone.ts
// Copyright (C) 2026 Rob Colbert <rob.colbert@openplatform.us>
// Licensed under the Apache License, Version 2.0
import { IChatSession } from "../interfaces/chat-session.ts";
import { IChatTurn } from "../interfaces/chat-turn.ts";
import { IDroneRegistration } from "../interfaces/drone-registration.ts";
import { IProject } from "../interfaces/project.ts";
export type ProcessWorkOrderCallback = (
success: boolean,
message?: string,
) => void;
export type ProcessWorkOrderMessage = (
registration: IDroneRegistration,
project: IProject,
chatSession: IChatSession,
turn: IChatTurn,
cb: ProcessWorkOrderCallback,
) => void;
export type ThinkingMessage = (content: string) => void;
export type ResponseMessage = (content: string) => void;
export type ToolCallMessage = (
callId: string,
name: string,
params: string,
response: string,
) => void;
export type WorkOrderCompleteMessage = (
workOrderId: string,
success: boolean,
message?: string,
) => void;
export type RequestCrashRecoveryMessage = (data: {
workspaceId: string;
turnId: string;
chatSessionId: string;
}) => void;
export type CrashRecoveryResponseMessage = (data: {
turnId: string;
action: "discard" | "retry";
retryDelay?: number;
}) => void;