Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
chore: remove stale duplicate files from shared root
Gener60f695613526
diff --git a/src/shared/api-types.ts b/src/shared/api-types.tsdeleted file mode 100644index 645e3c96f..000000000--- a/src/shared/api-types.ts+++ /dev/null@@ -1,73 +0,0 @@-import type {- User,- Workspace,- Agent,- AgentRuntime,- Conversation,- Message,- AgentTask,- TaskMessage,- MachineToken,-} from "./types";--export interface ApiResponse<T> {- data: T;-}--export interface ApiListResponse<T> {- data: T[];- total?: number;-}--export interface ApiErrorResponse {- error: string;- code?: string;-}--export type GetUserResponse = ApiResponse<User>;-export type ListWorkspacesResponse = ApiListResponse<Workspace>;-export type GetWorkspaceResponse = ApiResponse<Workspace>;--export type ListAgentsResponse = ApiListResponse<Agent>;-export type GetAgentResponse = ApiResponse<Agent>;--export type ListRuntimesResponse = ApiListResponse<AgentRuntime>;-export type GetRuntimeResponse = ApiResponse<AgentRuntime>;--export type ListConversationsResponse = ApiListResponse<Conversation>;-export type GetConversationResponse = ApiResponse<Conversation>;--export type ListMessagesResponse = ApiListResponse<Message>;--export type ListTasksResponse = ApiListResponse<AgentTask>;-export type GetTaskResponse = ApiResponse<AgentTask>;--export type ListTaskMessagesResponse = ApiListResponse<TaskMessage>;--export type ListMachineTokensResponse = ApiListResponse<MachineToken>;--export interface CreateWorkspaceRequest {- name: string;-}--export interface UpdateAgentRequest {- name?: string;- description?: string;- instructions?: string;- runtime_config?: Record<string, unknown>;- max_concurrent_tasks?: number;-}--export interface SendMessageRequest {- content: string;-}--export interface CreateMachineTokenRequest {- name: string;-}--export interface CreateMachineTokenResponse {- token: string;- id: string;- name: string;-}diff --git a/src/shared/constants.ts b/src/shared/constants.tsdeleted file mode 100644index 303126b24..000000000--- a/src/shared/constants.ts+++ /dev/null@@ -1,53 +0,0 @@-export const AgentStatus = {- ACTIVE: "active",- INACTIVE: "inactive",- ERROR: "error",-} as const;--export type AgentStatusType = (typeof AgentStatus)[keyof typeof AgentStatus];--export const RuntimeStatus = {- ONLINE: "online",- OFFLINE: "offline",- ERROR: "error",-} as const;--export type RuntimeStatusType =- (typeof RuntimeStatus)[keyof typeof RuntimeStatus];--export const TaskStatus = {- QUEUED: "queued",- DISPATCHED: "dispatched",- RUNNING: "running",- COMPLETED: "completed",- FAILED: "failed",- CANCELLED: "cancelled",-} as const;--export type TaskStatusType = (typeof TaskStatus)[keyof typeof TaskStatus];--export const TASK_TYPES = {- USER_DM_MESSAGE: "user_dm_message",- EMAIL_NOTIFICATION: "email_notification",- CALENDAR_EVENT: "calendar_event",-} as const;--export type TaskType = (typeof TASK_TYPES)[keyof typeof TASK_TYPES];--export const MessageRole = {- USER: "user",- ASSISTANT: "assistant",-} as const;--export type MessageRoleType = (typeof MessageRole)[keyof typeof MessageRole];--// Timing constants-export const POLL_INTERVAL_MS = Number(process.env.POLL_INTERVAL_MS) || 3_000;-export const OFFLINE_THRESHOLD_MS = Number(process.env.OFFLINE_THRESHOLD_MS) || 9_000;-export const EVENT_POLL_INTERVAL_MS = Number(process.env.EVENT_POLL_INTERVAL_MS) || 2_000;-export const AGENT_HANDLE_MIN_LENGTH = 4;--// Local dev URLs (used for service-binding fallbacks)-export const DEV_WEB_URL = process.env.ALOOK_SERVER_URL || "http://localhost:3000";-export const DEV_WS_DO_URL = process.env.DEV_WS_DO_URL || "http://localhost:8789";-export const DEV_EMAIL_WORKER_URL = process.env.DEV_EMAIL_WORKER_URL || "http://localhost:8788";diff --git a/src/shared/index.ts b/src/shared/index.tsdeleted file mode 100644index b00ce8767..000000000--- a/src/shared/index.ts+++ /dev/null@@ -1,131 +0,0 @@-// Types-export type {- User,- Workspace,- Agent,- AgentRuntime,- Conversation,- Message,- AgentTask,- TaskAgentData,- TaskMessage,- MachineToken,- Email,- EmailAttachment,- LoginResponse,- CreateAgentRequest,- WsMessage,-} from "./types";--// API types-export type {- ApiResponse,- ApiListResponse,- ApiErrorResponse,- GetUserResponse,- ListWorkspacesResponse,- GetWorkspaceResponse,- ListAgentsResponse,- GetAgentResponse,- ListRuntimesResponse,- GetRuntimeResponse,- ListConversationsResponse,- GetConversationResponse,- ListMessagesResponse,- ListTasksResponse,- GetTaskResponse,- ListTaskMessagesResponse,- ListMachineTokensResponse,- CreateWorkspaceRequest,- UpdateAgentRequest,- SendMessageRequest,- CreateMachineTokenRequest,- CreateMachineTokenResponse,-} from "./api-types";--// Constants-export {- AgentStatus,- RuntimeStatus,- TaskStatus,- MessageRole,- POLL_INTERVAL_MS,- OFFLINE_THRESHOLD_MS,- EVENT_POLL_INTERVAL_MS,- AGENT_HANDLE_MIN_LENGTH,- DEV_WEB_URL,- DEV_WS_DO_URL,- DEV_EMAIL_WORKER_URL,-} from "./constants";--export type {- AgentStatusType,- RuntimeStatusType,- TaskStatusType,- MessageRoleType,-} from "./constants";--// Schemas-export {- TaskStatusSchema,- ClaimedTaskRowSchema,- TaskAgentDataApiSchema,- TaskApiBaseSchema,- TaskApiSchema,- PollRequestSchema,- PollResponseSchema,- RegisterResponseSchema,- DaemonRuntimeItemSchema,- ActivateTokenRuntimeSchema,- ActivateTokenRequestSchema,- RegisterDaemonRequestSchema,- DeregisterRequestSchema,- CompleteTaskRequestSchema,- FailTaskRequestSchema,- MessageItemSchema,- ReportMessagesRequestSchema,- CreateAgentRequestSchema,- UpdateAgentRequestSchema,- CreateConversationRequestSchema,- CreateMessageRequestSchema,- EmailAttachmentSchema,- SendEmailRequestSchema,- UpdateEmailStatusRequestSchema,- EmailNotifyRequestSchema,- CreateWorkspaceRequestSchema,-} from "./schemas";--export type {- ClaimedTaskRow,- TaskAgentDataApi,- TaskApiBase,- TaskApi,- PollRequest,- PollResponse,- RegisterResponse,- DaemonRuntimeItem,- ActivateTokenRuntime,- ActivateTokenRequest,- RegisterDaemonRequest,- DeregisterRequest,- CompleteTaskRequest,- FailTaskRequest,- MessageItem,- ReportMessagesRequest,-} from "./schemas";--// Database-export { createDb } from "./db/index";-export type { Database } from "./db/index";-export * as schema from "./db/schema";-export * as queries from "./db/queries-index";--// Logger-export { Logger, createLogger } from "./logger"-export type { LogLevel, LoggerOptions } from "./logger"--// Utils-export { parseEmailHandle, toAlookAddress, isValidHandle } from "./utils/email";-export { isValidToken, isValidEmail } from "./utils/validation";-export { isOnline, formatStatus } from "./utils/status";-export { isUniqueConstraintError } from "./utils/db-errors";diff --git a/src/shared/schemas.test.ts b/src/shared/schemas.test.tsdeleted file mode 100644index 185f35189..000000000--- a/src/shared/schemas.test.ts+++ /dev/null@@ -1,333 +0,0 @@-import { describe, it, expect } from "vitest";-import {- TaskStatusSchema,- ClaimedTaskRowSchema,- TaskApiBaseSchema,- TaskApiSchema,- TaskAgentDataApiSchema,- PollRequestSchema,- PollResponseSchema,- RegisterDaemonRequestSchema,- DaemonRuntimeItemSchema,- DeregisterRequestSchema,- CompleteTaskRequestSchema,- FailTaskRequestSchema,- ReportMessagesRequestSchema,-} from "./schemas";--// ----------------------------------------------------------------------------// TaskStatusSchema-// -----------------------------------------------------------------------------describe("TaskStatusSchema", () => {- it("accepts all valid statuses", () => {- for (const s of ["queued", "dispatched", "running", "completed", "failed", "cancelled"]) {- expect(TaskStatusSchema.parse(s)).toBe(s);- }- });-- it("rejects invalid status strings", () => {- expect(() => TaskStatusSchema.parse("pending")).toThrow();- expect(() => TaskStatusSchema.parse("unknown")).toThrow();- });-});--// ----------------------------------------------------------------------------// ClaimedTaskRowSchema-// -----------------------------------------------------------------------------function validRow() {- return {- id: "t1",- agentId: "a1",- runtimeId: "r1",- workspaceId: "w1",- conversationId: "c1",- prompt: "do something",- type: "user_dm_message",- status: "dispatched",- priority: 5,- result: null,- context: { foo: "bar" },- sessionId: "sess-1",- createdAt: "2024-01-01T00:00:00Z",- dispatchedAt: "2024-01-01T00:01:00Z",- startedAt: null,- completedAt: null,- error: null,- };-}--describe("ClaimedTaskRowSchema", () => {- it("parses a valid raw SQL row with all columns", () => {- const row = validRow();- const parsed = ClaimedTaskRowSchema.parse(row);- expect(parsed.id).toBe("t1");- expect(parsed.context).toEqual({ foo: "bar" });- expect(parsed.sessionId).toBe("sess-1");- });-- it("coerces string timestamps to Date objects", () => {- const parsed = ClaimedTaskRowSchema.parse(validRow());- expect(parsed.createdAt).toBeInstanceOf(Date);- expect(parsed.dispatchedAt).toBeInstanceOf(Date);- });-- it("throws on missing runtime_id field", () => {- const row = validRow();- delete (row as any).runtimeId;- expect(() => ClaimedTaskRowSchema.parse(row)).toThrow();- });-- it("throws on wrong type (e.g., runtimeId: 123)", () => {- const row = { ...validRow(), runtimeId: 123 };- expect(() => ClaimedTaskRowSchema.parse(row)).toThrow();- });-});--// ----------------------------------------------------------------------------// TaskApiBaseSchema-// -----------------------------------------------------------------------------function validTaskApiBase() {- return {- id: "t1",- agent_id: "a1",- runtime_id: "r1",- conversation_id: "c1",- workspace_id: "w1",- prompt: "do something",- status: "dispatched",- priority: 5,- dispatched_at: "2024-01-01T00:01:00Z",- started_at: null,- completed_at: null,- result: null,- error: null,- created_at: "2024-01-01T00:00:00Z",- type: "user_dm_message",- };-}--describe("TaskApiBaseSchema", () => {- it("parses a valid task response with string timestamps", () => {- const parsed = TaskApiBaseSchema.parse(validTaskApiBase());- expect(parsed.id).toBe("t1");- expect(parsed.priority).toBe(5);- });-- it("does not include context field", () => {- const input = { ...validTaskApiBase(), context: { foo: "bar" } };- const parsed = TaskApiBaseSchema.parse(input);- expect("context" in parsed).toBe(false);- });-});--// ----------------------------------------------------------------------------// TaskApiSchema-// -----------------------------------------------------------------------------describe("TaskApiSchema", () => {- it("accepts optional agent", () => {- const input = {- ...validTaskApiBase(),- agent: { instructions: "be helpful", name: "bot", runtime_config: {} },- };- const parsed = TaskApiSchema.parse(input);- expect(parsed.agent?.name).toBe("bot");- });-});--// ----------------------------------------------------------------------------// TaskAgentDataApiSchema-// -----------------------------------------------------------------------------describe("TaskAgentDataApiSchema", () => {- it("does not require id field", () => {- const parsed = TaskAgentDataApiSchema.parse({- instructions: "help",- name: "bot",- });- expect(parsed.name).toBe("bot");- expect(parsed.runtime_config).toEqual({});- });-});--// ----------------------------------------------------------------------------// PollRequestSchema-// -----------------------------------------------------------------------------describe("PollRequestSchema", () => {- it("accepts daemon_id and defaults max_tasks to 1", () => {- const parsed = PollRequestSchema.parse({ daemon_id: "d1" });- expect(parsed.daemon_id).toBe("d1");- expect(parsed.max_tasks).toBe(1);- });-- it("rejects missing daemon_id", () => {- expect(() => PollRequestSchema.parse({})).toThrow();- });-- it("rejects empty daemon_id", () => {- expect(() => PollRequestSchema.parse({ daemon_id: "" })).toThrow();- });-- it("rejects max_tasks: 0", () => {- expect(() => PollRequestSchema.parse({ daemon_id: "d1", max_tasks: 0 })).toThrow();- });-- it("rejects old-format body with runtime_ids", () => {- // runtime_ids is no longer recognized — daemon_id is required- expect(() => PollRequestSchema.parse({ runtime_ids: ["r1"] })).toThrow();- });-});--// ----------------------------------------------------------------------------// PollResponseSchema-// -----------------------------------------------------------------------------describe("PollResponseSchema", () => {- it("accepts empty tasks array", () => {- const parsed = PollResponseSchema.parse({ tasks: [] });- expect(parsed.tasks).toEqual([]);- });-- it("accepts tasks with valid task objects", () => {- const parsed = PollResponseSchema.parse({- tasks: [validTaskApiBase()],- });- expect(parsed.tasks[0].id).toBe("t1");- });-- it("accepts evicted: true", () => {- const parsed = PollResponseSchema.parse({ tasks: [], evicted: true });- expect(parsed.evicted).toBe(true);- });-- it("accepts missing evicted field", () => {- const parsed = PollResponseSchema.parse({ tasks: [] });- expect(parsed.evicted).toBeUndefined();- });-});--// ----------------------------------------------------------------------------// RegisterDaemonRequestSchema-// -----------------------------------------------------------------------------describe("RegisterDaemonRequestSchema", () => {- it("requires workspace_id and daemon_id (min length 1)", () => {- expect(() =>- RegisterDaemonRequestSchema.parse({- workspace_id: "",- daemon_id: "d1",- runtimes: [{}],- }),- ).toThrow();-- expect(() =>- RegisterDaemonRequestSchema.parse({- workspace_id: "w1",- daemon_id: "",- runtimes: [{}],- }),- ).toThrow();- });-- it("requires at least one runtime in array", () => {- expect(() =>- RegisterDaemonRequestSchema.parse({- workspace_id: "w1",- daemon_id: "d1",- runtimes: [],- }),- ).toThrow();- });-- it("defaults device_name and cli_version to empty string", () => {- const parsed = RegisterDaemonRequestSchema.parse({- workspace_id: "w1",- daemon_id: "d1",- runtimes: [{ type: "claude" }],- });- expect(parsed.device_name).toBe("");- expect(parsed.cli_version).toBe("");- });-});--// ----------------------------------------------------------------------------// DaemonRuntimeItemSchema-// -----------------------------------------------------------------------------describe("DaemonRuntimeItemSchema", () => {- it("accepts all fields as optional strings", () => {- const parsed = DaemonRuntimeItemSchema.parse({});- expect(parsed).toBeDefined();- });-});--// ----------------------------------------------------------------------------// DeregisterRequestSchema-// -----------------------------------------------------------------------------describe("DeregisterRequestSchema", () => {- it("accepts daemon_id (string, min 1)", () => {- const parsed = DeregisterRequestSchema.parse({ daemon_id: "d1" });- expect(parsed.daemon_id).toBe("d1");- });-- it("rejects missing daemon_id", () => {- expect(() => DeregisterRequestSchema.parse({})).toThrow();- });-- it("rejects empty daemon_id", () => {- expect(() => DeregisterRequestSchema.parse({ daemon_id: "" })).toThrow();- });-});---// ----------------------------------------------------------------------------// CompleteTaskRequestSchema-// -----------------------------------------------------------------------------describe("CompleteTaskRequestSchema", () => {- it("accepts empty object (all fields optional)", () => {- const parsed = CompleteTaskRequestSchema.parse({});- expect(parsed).toBeDefined();- });-});--// ----------------------------------------------------------------------------// FailTaskRequestSchema-// -----------------------------------------------------------------------------describe("FailTaskRequestSchema", () => {- it("defaults error to empty string when missing", () => {- const parsed = FailTaskRequestSchema.parse({});- expect(parsed.error).toBe("");- });-});--// ----------------------------------------------------------------------------// ReportMessagesRequestSchema-// -----------------------------------------------------------------------------describe("ReportMessagesRequestSchema", () => {- it("requires seq (number) and type (string) in each message item", () => {- const parsed = ReportMessagesRequestSchema.parse({- messages: [{ seq: 1, type: "text" }],- });- expect(parsed.messages[0].seq).toBe(1);-- expect(() =>- ReportMessagesRequestSchema.parse({- messages: [{ type: "text" }],- }),- ).toThrow();-- expect(() =>- ReportMessagesRequestSchema.parse({- messages: [{ seq: 1 }],- }),- ).toThrow();- });-});diff --git a/src/shared/schemas.ts b/src/shared/schemas.tsdeleted file mode 100644index 4bf9e5648..000000000--- a/src/shared/schemas.ts+++ /dev/null@@ -1,294 +0,0 @@-import { z } from "zod";-import { TASK_TYPES } from "./constants";--// ----------------------------------------------------------------------------// Task status-// -----------------------------------------------------------------------------export const TaskStatusSchema = z.enum([- "queued",- "dispatched",- "running",- "completed",- "failed",- "cancelled",-]);--// ----------------------------------------------------------------------------// Raw SQL row from agent_task_queue (boundary: DB -> App)-// -----------------------------------------------------------------------------export const ClaimedTaskRowSchema = z.object({- id: z.string(),- agentId: z.string(),- runtimeId: z.string(),- workspaceId: z.string(),- conversationId: z.string(),- prompt: z.string(),- status: z.string(),- priority: z.coerce.number(),- result: z.unknown().nullable(),- context: z.unknown().nullable(),- type: z.string().default(TASK_TYPES.USER_DM_MESSAGE),- sessionId: z.string().nullable(),- createdAt: z.coerce.date(),- dispatchedAt: z.coerce.date().nullable(),- startedAt: z.coerce.date().nullable(),- completedAt: z.coerce.date().nullable(),- error: z.string().nullable(),-});-export type ClaimedTaskRow = z.infer<typeof ClaimedTaskRowSchema>;--// ----------------------------------------------------------------------------// API wire format — task agent data (embedded in claim response)-// -----------------------------------------------------------------------------export const TaskAgentDataApiSchema = z.object({- instructions: z.string(),- name: z.string(),- runtime_config: z.record(z.string(), z.unknown()).default({}),-});-export type TaskAgentDataApi = z.infer<typeof TaskAgentDataApiSchema>;--// ----------------------------------------------------------------------------// API wire format — base task (output of taskToResponse)-// -----------------------------------------------------------------------------export const TaskApiBaseSchema = z.object({- id: z.string(),- agent_id: z.string(),- runtime_id: z.string(),- conversation_id: z.string(),- workspace_id: z.string(),- prompt: z.string(),- status: z.string(),- priority: z.number(),- dispatched_at: z.string().nullable(),- started_at: z.string().nullable(),- completed_at: z.string().nullable(),- result: z.unknown().nullable(),- error: z.string().nullable(),- created_at: z.string(),- type: z.string(),-});-export type TaskApiBase = z.infer<typeof TaskApiBaseSchema>;--// ----------------------------------------------------------------------------// API wire format — full task (claim response includes agent + prior session)-// -----------------------------------------------------------------------------export const TaskApiSchema = TaskApiBaseSchema.extend({- agent: TaskAgentDataApiSchema.nullable().optional(),-});-export type TaskApi = z.infer<typeof TaskApiSchema>;--// ----------------------------------------------------------------------------// Poll request/response (replaces heartbeat + per-runtime claim)-// -----------------------------------------------------------------------------export const PollRequestSchema = z.object({- runtime_ids: z.array(z.string().min(1)).min(1),- max_tasks: z.number().int().min(1).default(1),-});-export type PollRequest = z.infer<typeof PollRequestSchema>;--export const PollResponseSchema = z.object({- tasks: z.array(TaskApiSchema),- evicted: z.boolean().optional(),-});-export type PollResponse = z.infer<typeof PollResponseSchema>;--// ----------------------------------------------------------------------------// Register response-// -----------------------------------------------------------------------------export const RegisterResponseSchema = z.object({- runtimes: z.array(z.object({ id: z.string() })),-});-export type RegisterResponse = z.infer<typeof RegisterResponseSchema>;--// ----------------------------------------------------------------------------// Daemon API request schemas-// -----------------------------------------------------------------------------export const DaemonRuntimeItemSchema = z.object({- type: z.string().optional(),- provider: z.string().optional(),- runtime_mode: z.string().optional(),- name: z.string().optional(),- version: z.string().optional(),- status: z.string().optional(),- model: z.string().optional(),-});-export type DaemonRuntimeItem = z.infer<typeof DaemonRuntimeItemSchema>;--export const ActivateTokenRuntimeSchema = z.object({- type: z.string().min(1),- version: z.string().optional().default(""),-});-export type ActivateTokenRuntime = z.infer<typeof ActivateTokenRuntimeSchema>;--export const ActivateTokenRequestSchema = z.object({- token: z.string().min(1),- hostname: z.string().min(1),- runtimes: z.array(ActivateTokenRuntimeSchema).min(1),-});-export type ActivateTokenRequest = z.infer<typeof ActivateTokenRequestSchema>;--export const RegisterDaemonRequestSchema = z.object({- workspace_id: z.string().min(1),- daemon_id: z.string().min(1),- device_name: z.string().optional().default(""),- cli_version: z.string().optional().default(""),- runtimes: z.array(DaemonRuntimeItemSchema).min(1),-});-export type RegisterDaemonRequest = z.infer<typeof RegisterDaemonRequestSchema>;--export const DeregisterRequestSchema = z.object({- runtime_ids: z.array(z.string()).default([]),-});-export type DeregisterRequest = z.infer<typeof DeregisterRequestSchema>;---export const CompleteTaskRequestSchema = z.object({- output: z.string().optional(),- session_id: z.string().optional(),- branch_name: z.string().optional(),-});-export type CompleteTaskRequest = z.infer<typeof CompleteTaskRequestSchema>;--export const FailTaskRequestSchema = z.object({- error: z.string().optional().default(""),-});-export type FailTaskRequest = z.infer<typeof FailTaskRequestSchema>;--export const MessageItemSchema = z.object({- seq: z.number(),- type: z.string(),- tool: z.string().optional(),- call_id: z.string().optional(),- content: z.string().optional(),- input: z.record(z.string(), z.unknown()).optional(),- output: z.string().optional(),-});-export type MessageItem = z.infer<typeof MessageItemSchema>;--export const ReportMessagesRequestSchema = z.object({- messages: z.array(MessageItemSchema),-});-export type ReportMessagesRequest = z.infer<typeof ReportMessagesRequestSchema>;--// ----------------------------------------------------------------------------// Agent request schemas-// -----------------------------------------------------------------------------const RuntimeConfigSchema = z- .object({ model: z.string().max(100).optional() })- .passthrough()- .optional();--export const CreateAgentRequestSchema = z.object({- name: z.string().min(1, "name is required"),- description: z.string().optional().default(""),- instructions: z.string().optional().default(""),- runtime_id: z.string().min(1, "runtime_id is required"),- runtime_config: RuntimeConfigSchema,- max_concurrent_tasks: z.number().int().optional(),- email_handle: z.string().optional(),-});-export type CreateAgentRequest = z.infer<typeof CreateAgentRequestSchema>;--export const UpdateAgentRequestSchema = z- .object({- name: z.string().min(1).optional(),- description: z.string().optional(),- instructions: z.string().optional(),- runtime_id: z.string().min(1).optional(),- runtime_config: RuntimeConfigSchema,- })- .refine(- (v) =>- v.name !== undefined ||- v.description !== undefined ||- v.instructions !== undefined ||- v.runtime_id !== undefined ||- v.runtime_config !== undefined,- { message: "at least one field is required" },- );-export type UpdateAgentRequest = z.infer<typeof UpdateAgentRequestSchema>;--// ----------------------------------------------------------------------------// Conversation request schemas-// -----------------------------------------------------------------------------export const CreateConversationRequestSchema = z.object({- agent_id: z.string().min(1, "agent_id is required"),-});-export type CreateConversationRequest = z.infer<- typeof CreateConversationRequestSchema->;--// ----------------------------------------------------------------------------// Message request schema (JSON body only — FormData path is separate)-// -----------------------------------------------------------------------------export const CreateMessageRequestSchema = z.object({- content: z.string().min(1, "content is required"),-});-export type CreateMessageRequest = z.infer<typeof CreateMessageRequestSchema>;--// ----------------------------------------------------------------------------// Email request schemas-// -----------------------------------------------------------------------------export const EmailAttachmentSchema = z.object({- key: z.string().min(1),- filename: z.string().min(1),- size: z.number().int().nonnegative().optional(),- contentType: z.string().min(1),-});--export const SendEmailRequestSchema = z.object({- agentId: z.string().min(1, "agentId is required"),- to: z.string().min(1, "to is required"),- subject: z.string().min(1, "subject is required"),- htmlBody: z.string().default(""),- inReplyTo: z.string().optional(),- references: z.string().optional(),- attachments: z.array(EmailAttachmentSchema).optional(),-});-export type SendEmailRequest = z.infer<typeof SendEmailRequestSchema>;--export const UpdateEmailStatusRequestSchema = z.object({- status: z.enum(["unread", "read", "archived"]),-});-export type UpdateEmailStatusRequest = z.infer<- typeof UpdateEmailStatusRequestSchema->;--export const EmailNotifyRequestSchema = z.object({- agentId: z.string().min(1),- workspaceId: z.string().min(1),- r2Key: z.string().min(1),- from: z.string().min(1),- to: z.string().optional(),- subject: z.string().min(1),- isWhitelisted: z.boolean(),- forwarded: z.boolean().optional().default(false),- messageId: z.string().optional().default(""),- inReplyTo: z.string().optional().default(""),- references: z.string().optional().default(""),-});-export type EmailNotifyRequest = z.infer<typeof EmailNotifyRequestSchema>;--// ----------------------------------------------------------------------------// Workspace request schemas-// -----------------------------------------------------------------------------export const CreateWorkspaceRequestSchema = z.object({- name: z.string().min(1, "name is required"),- slug: z.string().min(1, "slug is required"),-});-export type CreateWorkspaceRequest = z.infer<- typeof CreateWorkspaceRequestSchema->;diff --git a/src/shared/types.ts b/src/shared/types.tsdeleted file mode 100644index 692a2a31e..000000000--- a/src/shared/types.ts+++ /dev/null@@ -1,121 +0,0 @@-export interface User {- id: string;- name: string;- email: string;- avatar_url: string | null;- created_at: string;- updated_at: string;-}--export interface Workspace {- id: string;- name: string;- slug: string;- created_at: string;- updated_at: string;-}--export interface Agent {- id: string;- workspace_id: string;- runtime_id: string;- name: string;- description: string;- instructions: string;- runtime_mode: string;- runtime_config: Record<string, unknown>;- status: string;- max_concurrent_tasks: number;- created_at: string;- updated_at: string;-}--export interface AgentRuntime {- id: string;- workspace_id: string;- daemon_id: string | null;- name: string;- runtime_mode: string;- provider: string;- status: string;- device_info: string;- metadata: Record<string, unknown>;- last_seen_at: string | null;- created_at: string;- updated_at: string;-}--export interface Conversation {- id: string;- agent_id: string;- title: string;- created_at: string;- message_count?: number;-}--export interface Message {- id: string;- conversation_id: string;- role: "user" | "assistant";- content: string;- task_id: string | null;- created_at: string;-}--/** @deprecated Use TaskApiSchema from schemas.ts for runtime validation. */-export interface AgentTask {- id: string;- agent_id: string;- runtime_id: string;- conversation_id: string;- workspace_id: string;- prompt: string;- status: string;- priority: number;- dispatched_at: string | null;- started_at: string | null;- completed_at: string | null;- result: unknown;- error: string | null;- agent?: TaskAgentData;- created_at: string;- type: string;-}--export interface TaskAgentData {- id: string;- name: string;- instructions: string;-}--export interface TaskMessage {- id: string;- task_id: string;- seq: number;- type: string;- tool: string;- content: string;- input?: Record<string, unknown>;- output: string;-}--export interface MachineToken {- id: string;- name: string;- last_used_at: string | null;- created_at: string;-}--export interface LoginResponse {- token: string;- user: User;-}--export interface CreateAgentRequest {- name: string;- description?: string;- instructions?: string;- runtime_id: string;- runtime_config?: Record<string, unknown>;- max_concurrent_tasks?: number;-}