/** * Pure REST handlers for `/api/projects/*`. * * Extracted from the deleted Hono `routes.ts` so the relay envelope dispatcher * (Batch 3) can call them with a parsed payload instead of a Hono context. * * Contract: * - Inputs are already-parsed JSON objects (or `unknown` shapes the handler * validates). The dispatcher upstream parses the relay envelope body. * - Outputs are the wire shapes the landing client already expects, so the * Batch 3 dispatcher can JSON-stringify them straight into the response * envelope without remapping. * - Errors are thrown as typed `HandlerError` subclasses; the dispatcher * maps `BAD_REQUEST` → 400-equivalent and `NOT_FOUND` → 404-equivalent. * - Stream teardown on project delete is the caller's responsibility — the * handler returns the cascaded session ids so the dispatcher can hand * them to `SessionStreamManager.disposeProjectStreams` BEFORE the SQL * cascade has already torn down (in our model the cascade has already * happened by the time we return; that's intentional and matches the * old route's ordering — the manager is best-effort cleanup). */ import type { SessionStore } from "../storage.js"; import type { WireProject, WireSessionSummary } from "../wire.js"; export interface WireProjectObservation { id: string; content: string; relevance: string; createdAt: number; sessionId: string; } export declare function handleGetProjectObservations(store: SessionStore, id: string, limit?: number): WireProjectObservation[]; export interface CreateProjectInputRaw { name?: unknown; path?: unknown; createIfMissing?: unknown; } export interface UpdateProjectInputRaw { name?: unknown; path?: unknown; } export declare function handleListProjects(store: SessionStore): WireProject[]; /** Async relay-path twin of {@link handleListProjects}. */ export declare function handleListProjectsAsync(store: SessionStore): Promise; export declare function handleCreateProject(store: SessionStore, body: CreateProjectInputRaw): WireProject; export declare function handleGetProject(store: SessionStore, id: string): WireProject; /** Async relay-path twin of {@link handleGetProject}. */ export declare function handleGetProjectAsync(store: SessionStore, id: string): Promise; export declare function handleUpdateProject(store: SessionStore, id: string, body: UpdateProjectInputRaw): WireProject; export interface DeleteProjectResult { /** Session ids that belonged to the project (cascade-deleted). */ sessionIds: string[]; } export declare function handleDeleteProject(store: SessionStore, id: string): DeleteProjectResult; export interface BindStudioInputRaw { studioProjectId?: unknown; studioTeamId?: unknown; studioProjectName?: unknown; } export interface BindStudioResult { project: WireProject; studioProjectId: string; studioProjectName: string; studioTeamId?: string; } /** * Bind a local project directory to an Aexol Studio project by writing * `.aexol/aexol.jsonc` into the project's filesystem path. */ export declare function handleBindStudioProject(store: SessionStore, id: string, body: BindStudioInputRaw): Promise; export interface UnbindStudioResult { project: WireProject; studioProjectId: string | null; } /** * Unbind a local project directory from its Aexol Studio project by * removing `.aexol/aexol.jsonc` from the project's filesystem path. * * Returns the studioProjectId that was previously bound (null when there * was no binding), so callers can emit a `project_studio_unbound` meta-event * with the correct id even though the file is already gone on return. */ export declare function handleUnbindStudioProject(store: SessionStore, id: string): Promise; export declare function handleListSessionsByProject(store: SessionStore, id: string): WireSessionSummary[]; /** Async relay-path twin of {@link handleListSessionsByProject}. */ export declare function handleListSessionsByProjectAsync(store: SessionStore, id: string): Promise; export interface CleanupProjectSessionsInputRaw { olderThanDays?: unknown; } export interface CleanupProjectSessionsResult { deleted: number; ids: string[]; } export declare function handleCleanupProjectSessions(store: SessionStore, id: string, body: CleanupProjectSessionsInputRaw): CleanupProjectSessionsResult; //# sourceMappingURL=projects.d.ts.map