import { DirectoryListing, PiSessionHistoryItem, RemovedSessionItem, SessionSummary, WorkspaceSummary } from "../../types/hub.mjs"; import { LaunchProfileCatalog, LaunchSelection, WebTemplateRailWorkspaceDiscovery } from "@agimon-ai/po-core/web"; import { TranscriptPage, TranscriptPageRequest } from "@agimon-ai/po-core/sessionProtocol"; //#region src/web/lib/hubApi.d.ts export type CreateSessionResult = { sessionId: string; session?: SessionSummary; workspace?: WorkspaceSummary; } | { error: string; }; export type WorkspaceResult = { workspace: WorkspaceSummary; } | { error: string; }; export type WorkspacesResult = { workspaces: WorkspaceSummary[]; } | { error: string; }; /** Lists one server folder's visible child directories for the workspace folder browser. */ export declare function listDirectory(folder?: string): Promise; /** A 404 is an older server; malformed config and transport failures are not manual fallback. */ export declare function discoverWorkspaces(path: string): Promise; export declare function listWorkspaces(signal?: AbortSignal): Promise; /** Every live and dormant session of these workspaces, over HTTP; one failed workspace fails the whole list. */ export declare function listSessions(workspaceIds: readonly string[], signal?: AbortSignal): Promise<{ sessions: unknown[]; } | { error: string; }>; /** * Admits a server-side repository root without starting a session. A name alone * asks the server to create the workspace in its default folder. */ export declare function admitWorkspace(input: { root?: string; name?: string; declaration?: string; instructions?: string; }): Promise; /** Loads current REST metadata, including HTTP-only workspace instructions. */ export declare function getWorkspace(workspaceId: string, signal?: AbortSignal): Promise; /** Saves HTTP-only instructions through the existing settings step-up gate. Empty clears them. */ export declare function setWorkspaceInstructions(workspaceId: string, instructions: string): Promise; /** The sandbox a workspace's new sessions run in; null runs them on this host. */ export type WorkspaceSandboxRequest = 'container' | null; /** * Turns the container on or off for one workspace. Behind the settings step-up * gate: it changes where this machine runs a workspace's agents, so a remote * caller proves itself first. A 409 is the host refusing, with its reason. */ export declare function setWorkspaceSandbox(workspaceId: string, sandbox: WorkspaceSandboxRequest): Promise; export type RemoveWorkspaceResult = { ok: true; } | { error: string; }; /** Removes a workspace and its sessions from Po without touching its project files on disk. */ export declare function removeWorkspace(workspaceId: string): Promise; /** Starts a session in an already admitted workspace. */ export declare function createWorkspaceSession(workspaceId: string, input?: { name?: string; selection?: LaunchSelection; bot?: true; }): Promise; /** Starts a plain session with its own host-owned folder, without admitting a user workspace. */ export declare function createGeneralSessionRequest(input?: { name?: string; selection?: LaunchSelection; bot?: true; }, hostId?: string): Promise; export type EnsureHomeCoordinatorResult = { sessionId: string; created: boolean; } | { error: string; }; /** * Finds, revives or creates the home coordinator with this persona, and gives every existing workspace its own * coordinator. Safe to call again: an existing home coordinator answers `created: false`. */ export declare function ensureHomeCoordinator(input: { profile: string; model?: string; name: string; }): Promise; export type AddCoordinatorResult = EnsureHomeCoordinatorResult | { profileRequired: true; error: string; }; /** Create directly with the host's persona, or retry with a request-local choice. */ export declare function addCoordinator(workspaceId?: string, hostId?: string, profile?: string, bot?: true): Promise; export type SetSessionRoleResult = { ok: true; } | { error: string; }; /** * Promotes a session to its workspace's coordinator, demoting any other, or demotes it. Live sessions restart to take * the role. Step-up gated because promoting a dormant session revives it. */ export declare function setSessionRole(sessionId: string, coordinator: boolean): Promise; export interface CreateProfileInput { alias: string; displayName: string; preset: 'focused' | 'friendly' | 'creative' | 'persuasive'; } /** Save on the coordinator's captured computer, without changing its default profile. */ export declare function createProfile(input: CreateProfileInput, hostId?: string): Promise<{ name: string; } | { error: string; }>; /** A fresh catalog for this exact workspace or Home host. Failures stay explicit and never switch hosts. */ export declare function listLaunchProfiles(workspaceId?: string, signal?: AbortSignal, hostId?: string): Promise; /** Compatibility flow for callers that have not admitted a workspace yet. */ export declare function createSession(input: { cwd: string; name?: string; }): Promise; export type StopSessionResult = { ok: true; } | { error: string; }; /** Asks the hub to stop a session's server; the rail card leaves once the server withdraws its record. */ export declare function stopSession(sessionId: string): Promise; export type RestartSessionResult = { ok: true; } | { error: string; }; /** * Asks the hub to replace a session's server, keeping its id. * * A running server reads the composition once. Restart syncs workspace changes * before reopening the session, so changed extensions and APIs take effect. */ export declare function restartSession(sessionId: string): Promise; /** Same-host only: the URL carries ownership, the destination body carries a local workspace id. */ export declare function moveSession(sessionId: string, workspaceId: string): Promise; export type ReviveSessionResult = { ok: true; } | { deferred: true; } | { error: string; }; /** * Asks the hub to reopen a recorded session it has not started yet. * * Step-up gated like creating one, because it is the same act: an agent begins * running in a directory. The card turns live when the resulting upsert lands. */ export declare function reviveSession(sessionId: string, options?: { silent?: boolean; }): Promise; export type SessionGroupsResult = { ok: true; } | { error: string; }; /** Replaces one session's groups, live or dormant. The rail card updates when the hub's upsert lands. */ export declare function setSessionGroups(sessionId: string, groups: readonly string[]): Promise; /** Renames a group on every session in it. */ export declare function renameSessionGroup(from: string, to: string, hostId?: string): Promise; /** Takes a group off every session in it. */ export declare function deleteSessionGroup(name: string, hostId?: string): Promise; export declare function readDormantTranscriptPage(sessionId: string, request: TranscriptPageRequest, signal?: AbortSignal): Promise; export type SessionHistoryResult = { sessions: PiSessionHistoryItem[]; } | { error: string; }; /** Lists the Pi threads saved for a live session's workspace. */ export declare function listSessionHistory(sessionId: string): Promise; export type ResumeSessionResult = { sessionId: string; session?: SessionSummary; } | { error: string; }; /** Lists saved history without requiring a live session in the workspace. */ export declare function listWorkspaceHistory(workspaceId: string): Promise; export type RemovedSessionsResult = { sessions: RemovedSessionItem[]; } | { error: string; }; /** Lists a workspace's removed sessions that can still be restored, newest first. */ export declare function listRemovedSessions(workspaceId: string): Promise; export type RestoreRemovedSessionResult = { ok: true; } | { error: string; }; /** Returns a removed session to History; it then resumes from there. */ export declare function restoreRemovedSession(workspaceId: string, sessionId: string): Promise; /** Starts one saved thread without replacing another live session. */ export declare function resumeWorkspaceSession(workspaceId: string, targetSessionId: string): Promise; /** Replaces one live card with a selected Pi thread from the same workspace. */ export declare function resumeSession(sessionId: string, targetSessionId: string): Promise; /** File paths under a session's cwd matching the query, for @ completion. */ export declare function searchSessionFiles(sessionId: string, query: string): Promise; /** * Directories the typed path could complete to, for the new-session picker. * The hub lists the parent directory's children and filters them by the * trailing segment as a regular expression. */ export declare function searchDirectories(query: string): Promise; /** Folders under home that already hold Po settings; empty when the hub cannot say. */ export declare function listPoFolders(): Promise; //#endregion //# sourceMappingURL=hubApi.d.mts.map