Hyperflow UI
Reference

@hyperflow/client

Public transport, authentication, REST, and WebSocket contracts.

Start here

Initialize hyperflow once, then use the domain service that owns the operation.

import { hyperflow } from "@hyperflow/client";

await hyperflow.init({
  apiUrl: "https://api.example.com",
  wsUrl: "wss://api.example.com/ws",
});
AreaPublic entry pointUse it for
Authenticationhyperflow.authLogin, current user, tokens, logout
Sessions: readshyperflow.httpSessionLists, reads, usage, HTTP-only operations
Sessions: livehyperflow.wsSessionMutations, acts, subscriptions, live events
Runtimehyperflow.runtimeRuntime resources and reload state
Knowledge basehyperflow.knowledgeBaseLibrary operations
Memoryhyperflow.memoryUser memory and imports
Providershyperflow.providerAuth, hyperflow.providerUsageProvider login and usage
Workspaceshyperflow.workspacesAvailable Cloud workspaces

For session changes and live events, prefer hyperflow.wsSession. Use hyperflow.httpSession only for reads and operations that have no WebSocket counterpart. hyperflow.ws is a lower-level transport for advanced protocol integrations.

Find an API

Start with Hyperflow, then choose the service that owns the operation. Types appear with the service that returns or accepts them.

AreaUse it for
Setup, authentication and transportInitialize the singleton once, choose token storage, and use authentication before accessing other services.
Configuration and model catalogRead runtime configuration and the model catalog used by the application.
SessionsUse REST only for reads without a WebSocket counterpart. Use the WebSocket service for mutations, history, subscriptions, and live events.
Runtime, providers and workspacesInspect runtime resources, provider state and usage, and available Cloud workspaces.
Knowledge base, files and memoryManage knowledge-base documents, uploaded files, and the user memory collection.
WebSocket and advanced utilitiesUse the low-level WebSocket client only when the session services do not cover the protocol operation you need.

Setup, authentication and transport

Initialize the singleton once, choose token storage, and use authentication before accessing other services.

Hyperflow

Singleton Hyperflow client that coordinates domain services.

MemberType
readyPromisePromise<void>
A Promise that resolves when the client is fully initialized.
Useful for framework integrations (for example, React Suspense via use()).
initializedboolean
Indicates whether the client has been initialized.
authAuthService
Authentication: login, current user, WebSocket token, logout.
configConfigService
Runtime configuration from GET /config.
modelsCatalogModelsCatalogService
Chat models catalog grouped by active ChatClient.
memoryMemoryService
User memories and import operations via MemoryService.
filesFilesService
Public Client API.
knowledgeBaseKnowledgeBaseService
Knowledge Base documents, search, uploads, and indexing.
providerAuthProviderAuthService
Provider OAuth login bootstrap.
providerUsageProviderUsageService
Provider usage snapshots for model providers.
runtimeRuntimeService
Runtime resources, studio status, and runtime reload control.
workspacesWorkspaceService
Active Cloud workspaces for the authenticated user.
httpSessionHttpSessionService
Session reads and HTTP-only operations: list/get, usage, tool approval, custom-group listing.
wsWebSocketClient
Low-level WebSocket transport (advanced).
wsSessionWsSessionService
Session mutations, act history, subscriptions, and live push events.

init

Initializes the client with the provided configuration.

declare const service: {
  "init"(config: ClientConfig): Promise<void>;
};
ParameterType
configClientConfig

Returns: Promise<void>.

AuthService

Authentication API — hyperflow.auth → AuthService.

authorize

POST /auth/authorize — authenticates a user and stores returned tokens.

declare const service: {
  "authorize"(credentials: AuthorizeInput): Promise<AuthorizeResult>;
};
ParameterType
credentialsAuthorizeInput

Returns: Promise<AuthorizeResult>.

getCurrentUser

GET /auth/my_account — fetches the currently authenticated user.

declare const service: {
  "getCurrentUser"(): Promise<User>;
};

Returns: Promise<User>.

updateMyAccount

PUT /auth/my_account — updates the current user's profile.

declare const service: {
  "updateMyAccount"(input: UpdateMyAccountInput): Promise<User>;
};
ParameterType
inputUpdateMyAccountInput

Returns: Promise<User>.

changePassword

POST /auth/change_password — changes the current user's password.

declare const service: {
  "changePassword"(input: ChangePasswordInput): Promise<void>;
};
ParameterType
inputChangePasswordInput

Returns: Promise<void>.

getWsToken

POST /auth/ws — requests a short-lived token for WebSocket auth.

declare const service: {
  "getWsToken"(): Promise<WebSocketAuthTokenResult>;
};

Returns: Promise<WebSocketAuthTokenResult>.

getCloudLogoutUrl

Builds the browser URL that ends the Hyperflow Cloud session via Kratos.

declare const service: {
  "getCloudLogoutUrl"(returnTo: string): string;
};
ParameterType
returnTostring

Returns: string.

logout

Local only — clears stored authentication tokens (no HTTP call).

declare const service: {
  "logout"(): void;
};

Returns: void.

Supporting contracts

AuthorizeInput

Credentials used to authorize a Hyperflow user session.

/**
 * Auth wire and entity types.
 *
 * Consumed by {@link AuthService}.
 */
/**
 * Credentials used to authorize a Hyperflow user session.
 */
export type AuthorizeInput = {
  /** User e-mail address. */
  email: string;
  /** Clear-text password for the session. */
  password: string;
  /** Optional flag that asks the backend to keep the session longer. */
  rememberMe?: boolean;
};

AuthorizeResult

Response returned after a successful authorization request.

/**
 * Response returned after a successful authorization request.
 */
export type AuthorizeResult = {
  /** Access token used for authenticated API requests. */
  accessToken: string;
  /** CSRF token paired with the access token. */
  csrfToken: string;
  /** Authenticated user payload. */
  user: User;
};

Related types: User.

AuthTokens

Represents a pair of authentication tokens used to authorize requests.

/**
 * Represents a pair of authentication tokens used to authorize requests.
 */
export type AuthTokens = {
  /** Bearer access token. */
  accessToken: string;
  /** CSRF token paired with the access token. */
  csrfToken: string;
};

ChangePasswordInput

Credentials required to change the authenticated user's password.

/** Credentials required to change the authenticated user's password. */
export type ChangePasswordInput = {
  currentPassword: string;
  newPassword: string;
  confirmPassword: string;
};

ClientConfig

Configuration options for the Hyperflow client.

/**
 * Configuration options for the Hyperflow client.
 */
export interface ClientConfig {
  /** Read fresh client capabilities when starting or resuming each act. */
  getActTolerations?: () => readonly ToolToleration[];
  /** Base URL of the Hyperflow REST API. */
  apiUrl: string;
  /** WebSocket endpoint URL. */
  wsUrl: string;
  /** Optional Hyperflow Cloud API base URL for workspace requests. */
  cloudApiUrl?: string;
  /** Identity portal origin used to end a Hyperflow Cloud browser session. */
  authBaseUrl?: string;
  /**
   * Storage backend for authentication tokens.
   * Defaults to `localStorageTokenStorage` (browser `localStorage`).
   * Pass `memoryTokenStorage()` for Node.js or SSR environments.
   */
  tokenStorage?: TokenStorage;
  /** Refreshes expired tokens and returns the replacement pair. */
  refreshTokens?: () => Promise<AuthTokens>;
  /** Called when the session expires and the token refresh fails. */
  onLogout?: () => void;
  /** Client heartbeat interval for WebSocket ping events. */
  wsPingIntervalMs?: number;
  /** Initial reconnect delay after a WebSocket disconnect. */
  wsReconnectBaseDelayMs?: number;
  /** Maximum reconnect delay for WebSocket backoff. */
  wsReconnectMaxDelayMs?: number;
  /** WebSocket transport strategy for multi-tab sharing. */
  wsTransport?: WsTransportMode;
  /** Optional SharedWorker script URL override. */
  sharedWorkerUrl?: string;
}

Related types: AuthTokens, TokenStorage, WsTransportMode, ToolToleration.

TokenStorage

Interface for reading and writing authentication tokens. Implement this to support custom storage backends (e.g. cookies, memory, secure storage).

/**
 * Interface for reading and writing authentication tokens.
 * Implement this to support custom storage backends (e.g. cookies, memory, secure storage).
 */
export interface TokenStorage {
  /** Returns the current tokens, or `null` if none are stored. */
  getTokens(): AuthTokens | null;
  /** Persists the given tokens. */
  setTokens(tokens: AuthTokens): void;
  /** Removes all stored tokens. */
  clearTokens(): void;
}

Related types: AuthTokens.

UpdateMyAccountInput

Editable fields of the authenticated user's account.

/** Editable fields of the authenticated user's account. */
export type UpdateMyAccountInput = {
  email?: string | null;
  firstName?: string | null;
  lastName?: string | null;
};

User

Hyperflow user model returned by the auth endpoints.

/**
 * Hyperflow user model returned by the auth endpoints.
 */
export type User = {
  /** Numeric user identifier. */
  id: number;
  /** Primary e-mail address. */
  email: string;
  /** Optional first name. */
  firstName?: string;
  /** Optional last name. */
  lastName?: string;
  /** Whether the account is enabled. */
  enabled: boolean;
  /** Creation timestamp returned by the backend. */
  created_at: string;
  /** Last update timestamp returned by the backend. */
  updated_at: string;
};

WsTransportMode

type WsTransportMode = "auto" | "direct" | "shared-worker" | "broadcast";

Configuration and model catalog

Read runtime configuration and the model catalog used by the application.

ConfigService

Runtime configuration API — hyperflow.config → ConfigService.

getConfig

GET /config — fetches runtime configuration from the server.

declare const service: {
  "getConfig"(): Promise<ConfigResponse>;
};

Returns: Promise<ConfigResponse>.

ModelsCatalogService

Models catalog API — hyperflow.modelsCatalog → ModelsCatalogService.

listByChatClient

GET /models-catalog/by-chat-client — models grouped by active ChatClient.

declare const service: {
  "listByChatClient"(): Promise<ChatClientModelGroup[]>;
};

Returns: Promise<ChatClientModelGroup[]>.

Supporting contracts

AgentSelectorChildComponent

Child node in the composer agent selector tree.

/**
 * Config wire and entity types.
 *
 * Consumed by {@link ConfigService}.
 */
/** Child node in the composer agent selector tree. */
export type AgentSelectorChildComponent =
  | {
      c: "agent";
      id: string;
    }
  | {
      c: "separator";
    };

AuthMode

Authentication mode reported by the server.

  • none — auth disabled
  • simple — local login form
  • hyperflowCloud — proxy-level auth (no local login page)
/**
 * Authentication mode reported by the server.
 * - `none` — auth disabled
 * - `simple` — local login form
 * - `hyperflowCloud` — proxy-level auth (no local login page)
 */
export type AuthMode = "none" | "simple" | "hyperflowCloud";

CatalogModel

type CatalogModel = {
  id: number;
  modelId: string;
  displayName: string;
  provider: string;
  protocol: string;
  contextWindow: number | null;
  maxOutputTokens: number | null;
  inputCostPer1m: number | null;
  cachedInputCostPer1m: number | null;
  outputCostPer1m: number | null;
  tokenizerId: string | null;
  tokenizerMode: string;
  chatTemplateId: string | null;
  tokenizerSource: string;
  tokenizerConfidence: string;
  capabilities: ModelCapabilityFlags;
  modelType: ModelType;
  source: string;
  lastFetchedAt: string;
};

Related types: ModelCapabilityFlags, ModelType.

ChatClientModelGroup

type ChatClientModelGroup = {
  chatClientRef: string;
  catalogProvider: string;
  usageProvider: string;
  models: CatalogModel[];
};

Related types: CatalogModel.

ChatOptions

Default chat options from GET /config.

/** Default chat options from `GET /config`. */
export type ChatOptions = {
  /** Agent id used when a session has no explicit active agent. */
  defaultAgentId: string;
};

ComposerComponent

Composer slot component descriptor from frontendConfig.composer.

/** Composer slot component descriptor from `frontendConfig.composer`. */
export type ComposerComponent =
  | {
      c: "agent_selector";
      children?: AgentSelectorChildComponent[] | null;
    }
  | {
      c: "model_selector";
    }
  | {
      c: "context_window_meter";
    }
  | {
      c: "toolhost_selector";
    }
  | {
      c: "tool_policy_selector";
    };

Related types: AgentSelectorChildComponent.

ComposerConfig

Composer layout slots returned in GET /config.

/** Composer layout slots returned in `GET /config`. */
export type ComposerConfig = ComposerConfigInner & {
  inSession?: ComposerConfigInner | null;
};

Related types: ComposerConfigInner.

ComposerConfigInner

Composer layout slots returned in GET /config.

/** Composer layout slots returned in `GET /config`. */
export type ComposerConfigInner = {
  disclaimer?: ComposerDisclaimerConfig | null;
  slotLeft?: ComposerComponent[] | null;
  slotRight?: ComposerComponent[] | null;
  slotTopLeft?: ComposerComponent[] | null;
  slotTopRight?: ComposerComponent[] | null;
  slotBottomLeft?: ComposerComponent[] | null;
  slotBottomRight?: ComposerComponent[] | null;
  slotBottom?: ComposerComponent[] | null;
};

Related types: ComposerComponent, ComposerDisclaimerConfig.

ComposerDisclaimerConfig

Optional plain-text composer warning settings.

/** Optional plain-text composer warning settings. */
export type ComposerDisclaimerConfig = {
  /** False hides the warning; absent or null inherits, defaulting to true. */
  enabled?: boolean | null;
  /** Language-tag translations; blank values inherit the corresponding text. */
  text?: Record<string, string> | null;
};

ConfigResponse

Response shape from GET /config.

/**
 * Response shape from `GET /config`.
 *
 * Wire field `frontendConfig` is unchanged; maps to UI composer layout.
 */
export type ConfigResponse = {
  authEnabled: boolean;
  authMode?: AuthMode;
  frontendConfig?: FrontendConfig | null;
  chatOptions: ChatOptions;
  sessionOptions?: SessionOptions | null;
};

Related types: AuthMode, ChatOptions, FrontendConfig, SessionOptions.

FrontendConfig

UI configuration subtree of ConfigResponse.

/** UI configuration subtree of {@link ConfigResponse}. */
export type FrontendConfig = {
  composer?: ComposerConfig | null;
  sessionOptionsComponents?: SessionOptionsComponent[] | null;
};

Related types: ComposerConfig, SessionOptionsComponent.

ModelCapabilityFlags

type ModelCapabilityFlags = {
  image: boolean;
  video: boolean;
  audio: boolean;
  tools: boolean;
  streaming: boolean;
  reasoning: boolean;
  reasoningLevels?: ReasoningLevel[] | null;
};

Related types: ReasoningLevel.

ModelType

type ModelType = "llm" | "embedding" | "image" | "audio";

SessionOptions

Session defaults consumed by the composer from GET /config.

/** Session defaults consumed by the composer from `GET /config`. */
export type SessionOptions = {
  /** Default toolhost used unless the user explicitly selects another host. */
  toolhost?: ToolhostDefaultConfig | null;
};

Related types: ToolhostDefaultConfig.

SessionOptionsComponent

Composer components that can also be exposed as session options.

/** Composer components that can also be exposed as session options. */
export type SessionOptionsComponent = Exclude<
  ComposerComponent,
  {
    c: "context_window_meter";
  }
>;

Related types: ComposerComponent.

ToolhostDefaultConfig

Concrete toolhost id/name or availability-based preference for new sessions.

/** Concrete toolhost id/name or availability-based preference for new sessions. */
export type ToolhostDefaultConfig =
  | string
  | {
      policy: ToolhostDefaultPolicy;
    };

Related types: ToolhostDefaultPolicy.

ToolhostDefaultPolicy

Availability-based toolhost preference used for newly-created sessions.

/** Availability-based toolhost preference used for newly-created sessions. */
export type ToolhostDefaultPolicy = "localPrefered" | "cloudPrefered";

Sessions

Use REST only for reads without a WebSocket counterpart. Use the WebSocket service for mutations, history, subscriptions, and live events.

HttpSessionService

Session REST API — hyperflow.httpSession → HttpSessionService.

listSessions

GET /sessions — lists sessions with optional filters and grouping.

declare const service: {
  "listSessions"(params?: ListSessionsParams): Promise<SessionListResponse>;
};
ParameterType
paramsListSessionsParams

Returns: Promise<SessionListResponse>.

getSession

GET /sessions/{id} — fetches a single session by id.

declare const service: {
  "getSession"(id: string): Promise<Session>;
};
ParameterType
idstring

Returns: Promise<Session>.

getUsage

GET /sessions/{id}/usage — fetches token usage for a session.

declare const service: {
  "getUsage"(sessionId: string): Promise<SessionUsage>;
};
ParameterType
sessionIdstring

Returns: Promise<SessionUsage>.

listCustomGroups

GET /session-custom-groups — lists custom sidebar groups.

declare const service: {
  "listCustomGroups"(): Promise<SessionCustomGroup[]>;
};

Returns: Promise<SessionCustomGroup[]>.

approveTool

POST /tool/approve — approves a pending tool execution (HITL).

declare const service: {
  "approveTool"(request: ApproveToolRequest): Promise<void>;
};
ParameterType
requestApproveToolRequest

Returns: Promise<void>.

cancelBackgroundTask

POST /sessions/{id}/tasks/{taskId}/cancel — cancels a running background task.

declare const service: {
  "cancelBackgroundTask"(sessionId: string, taskId: string): Promise<BackgroundTask>;
};
ParameterType
sessionIdstring
taskIdstring

Returns: Promise<BackgroundTask>.

deleteBackgroundTask

DELETE /sessions/{id}/tasks/{taskId} — removes a finished background task.

declare const service: {
  "deleteBackgroundTask"(sessionId: string, taskId: string): Promise<void>;
};
ParameterType
sessionIdstring
taskIdstring

Returns: Promise<void>.

WsSessionService

Session WebSocket API — hyperflow.wsSession → WsSessionService.

subscribeSession

session.subscribe — starts receiving push events; re-subscribes after reconnect.

declare const service: {
  "subscribeSession"(sessionId: string): void;
};
ParameterType
sessionIdstring

Returns: void.

replaySession

session.replay — requests convergence state after subscribe or reconnect. Pass the last known item id to resume an in-progress act from that point.

declare const service: {
  "replaySession"(sessionId: string, afterItemId?: string | null): void;
};
ParameterType
sessionIdstring
afterItemIdstring | null

Returns: void.

createSession

session.create → session.created — creates a session.

declare const service: {
  "createSession"(input?: CreateSessionInput): Promise<Session>;
};
ParameterType
inputCreateSessionInput

Returns: Promise<Session>.

updateSession

session.update → session.updated — patches a session.

declare const service: {
  "updateSession"(sessionId: string, input: UpdateSessionInput): Promise<Session>;
};
ParameterType
sessionIdstring
inputUpdateSessionInput

Returns: Promise<Session>.

rewindSession

session.rewind → session.rewound — removes acts at and after the pivot act.

declare const service: {
  "rewindSession"(sessionId: string, actId: string): Promise<SessionRewindResult>;
};
ParameterType
sessionIdstring
actIdstring

Returns: Promise<SessionRewindResult>.

forkSession

session.fork → session.forked — creates a new session from a pivot act.

declare const service: {
  "forkSession"(sessionId: string, actId: string): Promise<SessionForkResult>;
};
ParameterType
sessionIdstring
actIdstring

Returns: Promise<SessionForkResult>.

deleteSession

session.delete → session.deleted — deletes a session.

declare const service: {
  "deleteSession"(sessionId: string): Promise<void>;
};
ParameterType
sessionIdstring

Returns: Promise<void>.

createItem

session.item.create → session.item.create.accepted — creates a session item.

declare const service: {
  "createItem"(sessionId: string, item: ClientSessionItem): Promise<void>;
};
ParameterType
sessionIdstring
itemClientSessionItem

Returns: Promise<void>.

listActs

session.acts.list → session.acts.listed — requests a page of session acts.

declare const service: {
  "listActs"(sessionId: string, params?: ListSessionActsParams): Promise<SessionActsPage>;
};
ParameterType
sessionIdstring
paramsListSessionActsParams

Returns: Promise<SessionActsPage>.

listBackgroundTasks

session.background_tasks.list — lists background tasks for a session.

declare const service: {
  "listBackgroundTasks"(sessionId: string): Promise<BackgroundTask[]>;
};
ParameterType
sessionIdstring

Returns: Promise<BackgroundTask[]>.

getBackgroundTask

session.background_task.get — reads the latest task state and output.

declare const service: {
  "getBackgroundTask"(sessionId: string, taskId: string): Promise<BackgroundTask>;
};
ParameterType
sessionIdstring
taskIdstring

Returns: Promise<BackgroundTask>.

startAct

session.agent.act — starts a new agent act for a session.

declare const service: {
  "startAct"(sessionId: string, agentId?: string | null, options?: StartActOptions): void;
};
ParameterType
sessionIdstring
agentIdstring | null
optionsStartActOptions

Returns: void.

abortAct

session.agent.abort_act — aborts the active agent act.

declare const service: {
  "abortAct"(sessionId: string): void;
};
ParameterType
sessionIdstring

Returns: void.

generateTitle

session.title.generate — starts async title generation.

declare const service: {
  "generateTitle"(sessionId: string): void;
};
ParameterType
sessionIdstring

Returns: void.

createCustomGroup

session_custom_group.create → session_custom_group.created — creates a custom group.

declare const service: {
  "createCustomGroup"(name: string): Promise<SessionCustomGroup>;
};
ParameterType
namestring

Returns: Promise<SessionCustomGroup>.

updateCustomGroup

session_custom_group.update → session_custom_group.updated — renames a custom group.

declare const service: {
  "updateCustomGroup"(groupId: string, name: string): Promise<SessionCustomGroup>;
};
ParameterType
groupIdstring
namestring

Returns: Promise<SessionCustomGroup>.

deleteCustomGroup

session_custom_group.delete → session_custom_group.deleted — deletes a custom group.

declare const service: {
  "deleteCustomGroup"(groupId: string): Promise<void>;
};
ParameterType
groupIdstring

Returns: Promise<void>.

unsubscribeSession

session.unsubscribe — stops receiving push events for a session.

declare const service: {
  "unsubscribeSession"(sessionId: string): void;
};
ParameterType
sessionIdstring

Returns: void.

deliverClientToolResult

Push handler — registers a callback for session-scoped server events.

declare const service: {
  "deliverClientToolResult"(sessionId: string, toolCallId: string, result: unknown): void;
};
ParameterType
sessionIdstring
toolCallIdstring
resultunknown

Returns: void.

onSessionEvent

Registers a callback for server events belonging to one subscribed session.

declare const service: {
  "onSessionEvent"(sessionId: string, handler: (event: ServerEvent) => void): () => void;
};
ParameterType
sessionIdstring
handler(event: ServerEvent) => void

Returns: () => void.

onAppEvent

Push handler — registers a callback for app-wide server events.

declare const service: {
  "onAppEvent"(handler: (event: AppEvent) => void): () => void;
};
ParameterType
handler(event: AppEvent) => void

Returns: () => void.

Supporting contracts

AgentAuthRequiredRequest

Pending agent OAuth state from session.agent.auth_required. Set completed when session.agent.device_authorization.completed arrives.

/**
 * Pending agent OAuth state from `session.agent.auth_required`.
 * Set `completed` when `session.agent.device_authorization.completed` arrives.
 */
export type AgentAuthRequiredRequest = {
  actId: string;
  flows: OAuthFlows;
  completed?: true;
};

Related types: OAuthFlows.

AgentMode

Named session agent mode applied alongside approval policy.

/** Named session agent mode applied alongside approval policy. */
export type AgentMode = {
  name: string;
  deny: string[];
  allow: string[];
};

ApprovalPolicy

type ApprovalPolicy = "ask" | "always" /* | "auto"*/;

ApproveToolRequest

type ApproveToolRequest = {
  agentId: string;
  toolName: string;
  authorizationType: ToolAuthorizationType;
  reference?: string;
  validationSchema?: Record<string, unknown>;
};

Related types: ToolAuthorizationType.

Audience

Session WebSocket protocol types.

/**
 * Session WebSocket protocol types.
 *
 * ## Client events
 * Outbound `session.*` and `session_custom_group.*` frames sent by
 * {@link WsSessionService} via {@link WebSocketClient.request} or `send`.
 * See {@link ClientEvent}.
 *
 * ## Server events
 * Inbound push frames delivered to `onSessionEvent` / `onAppEvent` handlers.
 * See {@link ServerEvent}.
 */
export type Audience = "all" | "agent" | "user" | "none";

BackgroundTask

Background task state delivered by the Session API.

/** Background task state delivered by the Session API. */
export type BackgroundTask = {
  id: string;
  sessionId: string;
  userId: number;
  agentId?: string | null;
  actId?: string | null;
  toolCallId?: string | null;
  label?: string | null;
  description?: string | null;
  metadata?: Record<string, unknown> | null;
  status: BackgroundTaskStatus;
  wake: boolean;
  toolhost?: string | null;
  output?: string | null;
  result?: unknown;
  error?: string | null;
  createdAt: string;
  finishedAt?: string | null;
};

Related types: BackgroundTaskStatus.

BackgroundTaskStatus

A long-running agent operation associated with a session.

/** A long-running agent operation associated with a session. */
export type BackgroundTaskStatus =
  | "running"
  | "completed"
  | "failed"
  | "cancelled"
  | "timed_out";

ClientEvent

type ClientEvent =
  | {
      type: "auth";
      eventId?: string;
      token: string;
    }
  | {
      type: "ping";
      eventId?: string;
    }
  | {
      type: "app.subscribe";
      eventId?: string;
    }
  | ({
      type: "session.create";
      eventId?: string;
    } & CreateSessionInput)
  | ({
      type: "session.update";
      eventId?: string;
      sessionId: string;
    } & UpdateSessionInput)
  | {
      type: "session.delete";
      eventId?: string;
      sessionId: string;
    }
  | {
      type: "session.rewind";
      eventId?: string;
      sessionId: string;
      actId: string;
    }
  | {
      type: "session.fork";
      eventId?: string;
      sessionId: string;
      actId: string;
    }
  | {
      type: "session.acts.list";
      eventId?: string;
      sessionId: string;
      first?: number;
      last?: number;
      beforeIndex?: number;
      afterIndex?: number;
      limit?: number;
      includeSessionChanges?: boolean;
    }
  | {
      type: "session.replay";
      eventId?: string;
      sessionId: string;
      afterItemId?: string | null;
    }
  | {
      type: "session.title.generate";
      eventId?: string;
      sessionId: string;
    }
  | {
      type: "session.title.abort_generate";
      eventId?: string;
      sessionId: string;
    }
  | {
      type: "session.item.create";
      eventId?: string;
      sessionId: string;
      item: ClientSessionItem;
    }
  | {
      type: "session.item.delete";
      eventId?: string;
      sessionId: string;
      itemId: string;
    }
  | {
      type: "session.agent.act";
      tolerations?: ToolToleration[];
      eventId?: string;
      sessionId: string;
      agentId?: string | null;
    }
  | {
      type: "session.agent.abort_act";
      eventId?: string;
      sessionId: string;
    }
  | {
      type: "session.subscribe";
      eventId?: string;
      sessionId: string;
    }
  | {
      type: "session.unsubscribe";
      eventId?: string;
      sessionId: string;
    }
  | {
      type: "session.agent.subscribe";
      eventId?: string;
      sessionId: string;
      agentId: string;
    }
  | {
      type: "session.agent.unsubscribe";
      eventId?: string;
      sessionId: string;
      agentId: string;
    }
  | {
      type: "session.user.typing.start";
      eventId?: string;
      sessionId: string;
    }
  | {
      type: "session.user.typing.stop";
      eventId?: string;
      sessionId: string;
    }
  | {
      type: "session.background_tasks.list";
      eventId?: string;
      sessionId: string;
    }
  | {
      type: "session.background_task.get";
      eventId?: string;
      sessionId: string;
      taskId: string;
    }
  | {
      type: "session.tool.result";
      eventId?: string;
      sessionId: string;
      toolCallId: string;
      /** Arbitrary JSON result produced by the client-executed tool. */
      result: unknown;
    }
  | ({
      type: "session_custom_group.create";
      eventId?: string;
    } & SessionCustomGroupInput)
  | ({
      type: "session_custom_group.update";
      eventId?: string;
      groupId: string;
    } & SessionCustomGroupInput)
  | {
      type: "session_custom_group.delete";
      eventId?: string;
      groupId: string;
    };

Related types: ClientSessionItem, CreateSessionInput, SessionCustomGroupInput, ToolToleration, UpdateSessionInput.

ClientSessionItem

Payload for session.item.create (id/actId optional).

/** Payload for `session.item.create` (id/actId optional). */
export type ClientSessionItem = {
  id?: string;
  actId?: string;
  type: Exclude<
    SessionItemType,
    "session_change" | "background_task" | "background_task_completed"
  >;
  audience?: Audience;
  metadata?: Record<string, unknown> | null;
  role?: "system" | "user" | "assistant";
  content?: MessageInputContent[];
  reasonText?: string;
  function?: {
    name: string;
    arguments: Record<string, unknown>;
  };
  toolCallId?: string;
  resultType?: "result" | "input_required";
  result?: ToolOutputContent[];
};

Related types: Audience, MessageInputContent, SessionItemType, ToolOutputContent.

CompactedItemAudience

type CompactedItemAudience = {
  id: string;
  audience: Audience;
};

Related types: Audience.

ContextWindowState

type ContextWindowState = {
  systemPromptTokens: number;
  toolDefinitionsTokens: number;
  messagesTokens: number;
  promptOverheadTokens: number;
  promptTotalTokens: number;
  completionTokens: number;
  tokenAccountingMode: string;
  tokenUsageSource: string;
  totalContextWindow: number;
  totalUsed: number;
};

CreateSessionInput

Input for session.create / REST session creation.

/** Input for `session.create` / REST session creation. */
export type CreateSessionInput = {
  title?: string | null;
  activeAgentId?: string | null;
  agents?: SessionAgentsMap | null;
  customGroupId?: string | null;
  titleGenerationOptions?: TitleGenerationOptions | null;
  backgroundMode?: boolean | null;
  approvalPolicy?: ApprovalPolicy | null;
  toolhost?: string | null;
  agentMode?: AgentMode | null;
};

Related types: AgentMode, ApprovalPolicy, SessionAgentsMap, TitleGenerationOptions.

DeviceAuthorizationCompletedBody

type DeviceAuthorizationCompletedBody = {
  actId: string;
  sessionId: string;
};

InProgressItem

type InProgressItem =
  | {
      kind: "reasoning_activity";
      activity: ReasoningActivity;
    }
  | {
      kind: "reasoning";
      itemId?: string | null;
      reasonText: string;
    }
  | {
      kind: "message";
      itemId?: string | null;
      text: string;
    }
  | {
      kind: "tool_call";
      itemId?: string | null;
      callId: string;
      name: string;
      arguments: string;
    };

Related types: ReasoningActivity.

InputRequestOption

type InputRequestOption = {
  label: string;
  value?: string;
  description?: string;
};

InputRequestQuestion

type InputRequestQuestion = {
  question: string;
  header?: string;
  multiSelect?: boolean;
  options?: InputRequestOption[];
};

Related types: InputRequestOption.

InputRequests

Structured multiple-choice/free-text form for inputRequests.

/** Structured multiple-choice/free-text form for `inputRequests`. */
export type InputRequests = {
  questions: InputRequestQuestion[];
};

Related types: InputRequestQuestion.

ListSessionActsParams

type ListSessionActsParams = {
  first?: number;
  last?: number;
  beforeIndex?: number;
  afterIndex?: number;
  limit?: number;
  includeSessionChanges?: boolean;
};

ListSessionsGroupBy

type ListSessionsGroupBy = "none" | "status" | "custom";

ListSessionsParams

Query parameters for GET /sessions.

/** Query parameters for `GET /sessions`. */
export type ListSessionsParams = {
  page?: number;
  perPage?: number;
  title?: string;
  createdAtFrom?: string;
  createdAtTo?: string;
  lastActivityAtFrom?: string;
  lastActivityAtTo?: string;
  sortCreatedAt?: SortDirection;
  sortLastActivityAt?: SortDirection;
  sortId?: SortDirection;
  groupBy?: ListSessionsGroupBy;
};

Related types: ListSessionsGroupBy, SortDirection.

MessageContent

type MessageContent = MessageTextContent | MessageImageContent | MessageFileContent;

Related types: MessageFileContent, MessageImageContent, MessageTextContent.

MessageFileContent

type MessageFileContent = {
  type: "file";
  file: MessageFilePayload;
};

Related types: MessageFilePayload.

MessageFileInput

type MessageFileInput =
  | (Omit<MessageFilePayload, "uri" | "bytes"> & {
      uri: string;
      bytes?: never;
      uploadId?: string;
    })
  | (Omit<MessageFilePayload, "uri" | "bytes"> & {
      bytes: number[];
      uri?: never;
      uploadId?: never;
    });

Related types: MessageFilePayload.

MessageFilePayload

type MessageFilePayload = {
  name?: string;
  /** Wire format field (snake_case per Hyperflow WS API). */
  mime_type?: string;
  uri?: string;
  bytes?: number[];
};

MessageImageContent

type MessageImageContent = {
  type: "image";
  image: MessageImagePayload;
};

Related types: MessageImagePayload.

MessageImagePayload

type MessageImagePayload = {
  name?: string;
  /** Wire format field (snake_case per Hyperflow WS API). */
  mime_type?: string;
  uri?: string;
  bytes?: number[];
};

MessageInputContent

type MessageInputContent =
  | MessageTextContent
  | MessageImageContent
  | {
      type: "file";
      file: MessageFileInput;
    };

Related types: MessageFileInput, MessageImageContent, MessageTextContent.

MessageTextContent

type MessageTextContent = {
  type: "text";
  text: string;
};

OAuthAuthorizationFlow

OAuth flow payloads for session.agent.auth_required and session.agent.device_authorization.completed.

/**
 * OAuth flow payloads for `session.agent.auth_required` and
 * `session.agent.device_authorization.completed`.
 */
export type OAuthAuthorizationFlow = {
  actId: string;
  sessionId: string;
  authorizationUri: string;
  initiatedFromChatId?: string;
};

OAuthDeviceFlow

type OAuthDeviceFlow = {
  actId: string;
  sessionId: string;
  verificationUri: string;
  userCode: string;
};

OAuthFlows

Tagged union (flow: "device" | "authorization").

/** Tagged union (`flow`: `"device"` | `"authorization"`). */
export type OAuthFlows =
  | ({
      flow: "device";
    } & OAuthDeviceFlow)
  | ({
      flow: "authorization";
    } & OAuthAuthorizationFlow);

Related types: OAuthAuthorizationFlow, OAuthDeviceFlow.

Pagination

Pagination metadata on session list responses.

/** Pagination metadata on session list responses. */
export type Pagination = {
  page: number;
  perPage: number;
};

ReasoningActivity

type ReasoningActivity = {
  itemId: string;
  status: "started" | "progress" | "completed";
  encrypted?: boolean;
};

ReasoningLevel

Named reasoning-effort levels accepted by the Hyperflow backend.

/** Named reasoning-effort levels accepted by the Hyperflow backend. */
export type ReasoningLevel =
  | "none"
  | "minimal"
  | "low"
  | "medium"
  | "high"
  | "xhigh"
  | "max"
  | "ultra";

ResponseDelta

type ResponseDelta =
  | {
      kind: "content";
      text: string;
    }
  | {
      kind: "thinking";
      text: string;
    }
  | {
      kind: "tool_call_start";
      callId: string;
      name: string;
    }
  | {
      kind: "tool_call_arguments";
      callId: string;
      delta: string;
    }
  | {
      kind: "tool_output";
      callId: string;
      delta: ToolOutputContent[];
    };

Related types: ToolOutputContent.

ServerEvent

type ServerEvent =
  | {
      type: "auth.ok";
      eventId?: string;
      userId: number;
    }
  | {
      type: "auth.failed";
      eventId?: string;
      message: string;
    }
  | {
      type: "pong";
      eventId?: string;
    }
  | {
      type: "app.subscribed";
      eventId?: string;
    }
  | {
      type: "session.subscribed";
      eventId?: string;
      sessionId: string;
    }
  | {
      type: "session.unsubscribed";
      eventId?: string;
      sessionId: string;
    }
  | {
      type: "session.agent.subscribed";
      eventId?: string;
      sessionId: string;
      agentId: string;
    }
  | {
      type: "session.agent.unsubscribed";
      eventId?: string;
      sessionId: string;
      agentId: string;
    }
  | {
      type: "session.agent.act.queued";
      eventId?: string;
      sessionId: string;
      agentId: string;
      actId: string;
    }
  | {
      type: "session.item.create.accepted";
      eventId?: string;
      sessionId: string;
    }
  | {
      type: "session.user.typing.ack";
      eventId?: string;
      sessionId: string;
      isTyping: boolean;
    }
  | {
      type: "session.title.abort_generate.ack";
      eventId?: string;
      sessionId: string;
    }
  | {
      type: "session.agent.abort_act.ack";
      eventId?: string;
      sessionId: string;
    }
  | {
      type: "error";
      eventId?: string;
      code: string;
      message: string;
    }
  | {
      type: "session.created";
      eventId?: string;
      session: Session;
    }
  | {
      type: "session.updated";
      eventId?: string;
      session: Session;
    }
  | {
      type: "session.rewound";
      eventId?: string;
      sessionId: string;
      removedFromIndex: number;
      pivotUserMessage?: SessionItem;
    }
  | {
      type: "session.forked";
      eventId?: string;
      sessionId: string;
      session: Session;
      pivotUserMessage?: SessionItem;
    }
  | {
      type: "session.agent.options_changed";
      sessionId: string;
      agentId: string;
      changes: SessionAgentOptionChange[];
    }
  | {
      type: "session.deleted";
      eventId?: string;
      sessionId: string;
    }
  | {
      type: "session.status";
      eventId?: string;
      sessionId: string;
      status: string;
    }
  | {
      type: "session.item.created";
      sessionId: string;
      item: SessionItem;
    }
  | {
      type: "session.item.deleted";
      sessionId: string;
      itemId: string;
    }
  | {
      type: "session.acts.listed";
      eventId?: string;
      sessionId: string;
      acts: SessionActWithItems[];
      hasMore: boolean;
    }
  | {
      type: "session.replayed";
      eventId?: string;
      sessionId: string;
      acts: SessionActWithItems[];
    }
  | {
      type: "session.agent.act_state.before_act";
      sessionId: string;
      agentId: string;
      actId: string;
    }
  | {
      type: "session.agent.act_state.generate";
      sessionId: string;
      agentId: string;
      actId: string;
    }
  | {
      type: "session.agent.act_state.after_items";
      sessionId: string;
      agentId: string;
      actId: string;
    }
  | {
      type: "session.agent.act_state.act_completed";
      sessionId: string;
      agentId: string;
      actId: string;
    }
  | {
      type: "session.agent.act_state.act_aborted";
      sessionId: string;
      agentId: string;
      actId: string;
    }
  | {
      type: "session.context_window_state";
      sessionId: string;
      actId: string;
      state: ContextWindowState;
    }
  | {
      type: "session.context_compaction.started";
      sessionId: string;
      actId: string;
      compactionItemId: string;
      info: {
        messageCount: number;
        currentTokens: number;
        contextWindow: number;
      };
    }
  | {
      type: "session.context_compacted";
      sessionId: string;
      actId: string;
      compactionItemId: string;
      updatedItems: CompactedItemAudience[];
      summaryItems: SessionItem[];
    }
  | {
      type: "session.response.reasoning_activity";
      sessionId: string;
      actId: string;
      seq: number;
      activity: ReasoningActivity;
    }
  | {
      type: "session.response.delta";
      sessionId: string;
      actId: string;
      itemId?: string | null;
      delta: ResponseDelta;
      seq?: number;
    }
  | {
      type: "session.response.in_progress";
      eventId?: string;
      sessionId: string;
      actId: string;
      seq: number;
      items: InProgressItem[];
    }
  | {
      type: "session.item.stats";
      sessionId: string;
      actId: string;
      itemId: string;
      stats: Record<string, unknown>;
    }
  | {
      type: "session.response.done";
      sessionId: string;
      actId: string;
      item: SessionItem;
    }
  | {
      type: "session.title.delta";
      eventId?: string;
      sessionId: string;
      delta: string;
    }
  | {
      type: "session.title.done";
      eventId?: string;
      sessionId: string;
      title: string;
    }
  | {
      type: "session.title.failed";
      eventId?: string;
      sessionId: string;
      message: string;
    }
  | {
      type: "session.user.is_typing";
      sessionId: string;
      userId: number;
      isTyping: boolean;
    }
  | {
      type: "session.agent.auth_required";
      sessionId: string;
      actId: string;
      flows: OAuthFlows;
    }
  | {
      type: "session.agent.device_authorization.completed";
      sessionId: string;
      actId: string;
      data: DeviceAuthorizationCompletedBody;
    }
  | {
      type: "session.tool.execution_approval.requested";
      sessionId: string;
      actId: string;
      request: ToolExecutionApprovalRequest;
    }
  | {
      type: "session.tool.input_required";
      sessionId: string;
      actId: string;
      toolCallId: string;
      inputRequests?: unknown;
      requestState?: string;
    }
  | {
      type: "session.tool.client_call";
      executorConnectionId: string;
      sessionId: string;
      actId?: string;
      toolCallId: string;
      name: string;
      arguments?: Record<string, unknown>;
      /** `blocking`: the act waits inline for `session.tool.result`. `notify`: fire-and-forget. */
      mode: "blocking" | "notify";
      /** Only the participant that launched the act executes and delivers. */
      executorUserId?: number;
      timeoutMs?: number;
    }
  | {
      type: "session.tool.result.ack";
      sessionId: string;
      toolCallId: string;
      delivery: string;
    }
  | {
      type: "session.background_tasks.listed";
      eventId?: string;
      sessionId: string;
      tasks: BackgroundTask[];
    }
  | {
      type: "session.background_task.updated";
      eventId?: string;
      sessionId: string;
      task: BackgroundTask;
    }
  | {
      type: "session.background_task.output";
      sessionId: string;
      taskId: string;
      chunk: string;
    }
  | {
      type: "session_custom_group.created";
      eventId?: string;
      group: SessionCustomGroup;
    }
  | {
      type: "session_custom_group.updated";
      eventId?: string;
      group: SessionCustomGroup;
    }
  | {
      type: "session_custom_group.deleted";
      eventId?: string;
      groupId: string;
    };

Related types: BackgroundTask, CompactedItemAudience, ContextWindowState, DeviceAuthorizationCompletedBody, InProgressItem, OAuthFlows, ReasoningActivity, ResponseDelta, Session, SessionActWithItems, SessionAgentOptionChange, SessionCustomGroup, SessionItem, ToolExecutionApprovalRequest.

Session

Session entity returned by REST and WebSocket APIs (camelCase wire format).

/**
 * Session entity returned by REST and WebSocket APIs (camelCase wire format).
 */
export type Session = {
  id: string;
  title?: string | null;
  customGroupId?: string | null;
  status: SessionStatus;
  /**
   * When true, the agent keeps running after the client disconnects.
   * Defaults to `true` on the server when omitted at create time.
   * Not exposed in the default Chakra composer UI yet.
   */
  backgroundMode: boolean;
  activeAgentId: string;
  agents: SessionAgentsMap;
  titleGenerationOptions: TitleGenerationOptions;
  approvalPolicy?: ApprovalPolicy;
  /**
   * Remote toolhost name; null/omitted = co-located in-process tools.
   * Patchable via `session.update` / `session.agent.options_changed`.
   */
  toolhost?: string | null;
  /** Runtime-defined mode applied to the active agent. */
  agentMode?: AgentMode | null;
  lastActivityAt?: string | null;
  createdAt: string;
  updatedAt: string;
  isArchived: boolean;
  archivedAt?: string | null;
};

Related types: AgentMode, ApprovalPolicy, SessionAgentsMap, SessionStatus, TitleGenerationOptions.

SessionAct

type SessionAct = {
  /** Distinguishes agent execution from persisted session configuration changes. */
  kind?: "agent_act" | "session_change_set";
  id: number;
  sessionId: string;
  actId: string;
  index: number;
  status: string;
  agentId?: string | null;
  startedAt?: string | null;
  completedAt?: string | null;
  abortRequestedAt?: string | null;
  lastError?: string | null;
  contextWindowState?: ContextWindowState | null;
  createdAt: string;
};

Related types: ContextWindowState.

SessionActsPage

type SessionActsPage = {
  acts: SessionActWithItems[];
  hasMore: boolean;
};

Related types: SessionActWithItems.

SessionActUsageRow

type SessionActUsageRow = {
  actId: string | null;
  model: string;
  clientType: string;
  clientName: string | null;
  totalInput: number;
  totalCached: number;
  totalOutput: number;
  calls: number;
  cacheHitPct: number | null;
};

SessionActWithItems

type SessionActWithItems = SessionAct & {
  items: SessionItem[];
};

Related types: SessionAct, SessionItem.

SessionAgent

Agent configuration keyed by agent ID in session payloads.

/**
 * Agent configuration keyed by agent ID in session payloads.
 */
export type SessionAgent = SessionAgentLLMSource & {
  think?: ThinkMode | null;
  numPredict?: number | null;
  temperature?: number | null;
  seed?: string | null;
  stop?: string | null;
  topP?: number | null;
  numCtx?: number | null;
  minP?: number | null;
  topK?: number | null;
  repeatPenalty?: number | null;
  repeatLastN?: number | null;
  frequencyPenalty?: number | null;
  presencePenalty?: number | null;
};

Related types: SessionAgentLLMSource, ThinkMode.

SessionAgentLLMSource

type SessionAgentLLMSource =
  | {
      chatClientRef: string;
      model: string;
    }
  | {
      chatModelRef: string;
    };

SessionAgentOptionChange

type SessionAgentOptionChange =
  | {
      type: "activeAgent";
      previous: string | null;
      current: string | null;
    }
  | {
      type: "chatClientRef";
      previous: string | null;
      current: string | null;
    }
  | {
      type: "model";
      previous: string | null;
      current: string | null;
    }
  | {
      type: "think";
      previous: ThinkMode | null;
      current: ThinkMode | null;
    }
  | {
      type: "toolhost";
      previous: string | null;
      current: string | null;
    }
  | {
      type: "approvalPolicy";
      previous: ApprovalPolicy;
      current: ApprovalPolicy;
    }
  | {
      type: "agentMode";
      previous: AgentMode | null;
      current: AgentMode | null;
    };

Related types: AgentMode, ApprovalPolicy, ThinkMode.

SessionAgentsMap

type SessionAgentsMap = Record<string, SessionAgent>;

Related types: SessionAgent.

SessionCustomGroup

Custom sidebar group.

/** Custom sidebar group. */
export type SessionCustomGroup = {
  id: string;
  name: string;
  metadata?: Record<string, unknown>;
  createdAt?: string;
  updatedAt?: string;
};

SessionCustomGroupInput

Input for custom group create/update over WebSocket.

/** Input for custom group create/update over WebSocket. */
export type SessionCustomGroupInput = {
  name: string;
  metadata?: Record<string, unknown>;
};

SessionForkResult

type SessionForkResult = {
  sessionId: string;
  session: Session;
  pivotUserMessage?: SessionItem;
};

Related types: Session, SessionItem.

SessionItem

Session item wire format (camelCase envelope, flattened inner by type).

/**
 * Session item wire format (camelCase envelope, flattened inner by `type`).
 */
export type SessionItem = {
  id: string;
  actId: string;
  index: number;
  type: SessionItemType;
  audience?: Audience;
  metadata?: Record<string, unknown> | null;
  role?: "system" | "user" | "assistant";
  content?: MessageContent[];
  reasonText?: string;
  function?: {
    name: string;
    arguments: Record<string, unknown>;
  };
  toolCallId?: string;
  resultType?: "result" | "input_required";
  inputRequests?: unknown;
  requestState?: string | null;
  result?: ToolOutputContent[];
  outputStats?: Record<string, unknown> | null;
  agentId?: string;
  changes?: SessionAgentOptionChange[];
  taskId?: string;
  status?: string;
  label?: string | null;
  description?: string | null;
  wake?: boolean;
  startedAt?: string;
  completedAt?: string | null;
};

Related types: Audience, MessageContent, SessionAgentOptionChange, SessionItemType, ToolOutputContent.

SessionItemType

type SessionItemType =
  | "message"
  | "reasoning"
  | "tool_call"
  | "tool_output"
  | "session_change"
  | "agent_context_compaction"
  | "session_change"
  | "background_task"
  | "background_task_completed";

SessionListGroup

Normalized group bucket in a session list response.

/** Normalized group bucket in a session list response. */
export type SessionListGroup = {
  key: string;
  name: string;
  sessions: Session[];
  customGroup?: SessionCustomGroup | null;
};

Related types: Session, SessionCustomGroup.

SessionListGroupedByCustom

type SessionListGroupedByCustom = {
  groupType: "custom";
  data: Array<{
    name: string;
    data: Session[];
    customGroup?: SessionCustomGroup | null;
  }>;
};

Related types: Session, SessionCustomGroup.

SessionListGroupedByStatus

type SessionListGroupedByStatus = {
  groupType: "status";
  data: Array<{
    name: string;
    data: Session[];
  }>;
};

Related types: Session.

SessionListResponse

Paginated session list envelope from GET /sessions.

/** Paginated session list envelope from `GET /sessions`. */
export type SessionListResponse = {
  data: SessionListResponseData;
  pagination: Pagination;
};

Related types: Pagination, SessionListResponseData.

SessionListResponseData

type SessionListResponseData =
  | Session[]
  | SessionListGroupedByStatus
  | SessionListGroupedByCustom
  | SessionListGroupedByStatus[]
  | SessionListGroupedByCustom[];

Related types: Session, SessionListGroupedByCustom, SessionListGroupedByStatus.

SessionRewindResult

type SessionRewindResult = {
  sessionId: string;
  removedFromIndex: number;
  pivotUserMessage?: SessionItem;
};

Related types: SessionItem.

SessionStatus

Session status returned by the Hyperflow Session API.

/**
 * Session wire and entity types.
 *
 * Consumed by {@link HttpSessionService}, {@link WsSessionService}, and session helpers.
 */
/**
 * Session status returned by the Hyperflow Session API.
 */
export type SessionStatus = "idle" | "active" | "need_user_input" | "error";

SessionUsage

type SessionUsage = {
  acts: SessionActUsageRow[];
  totalInput: number;
  totalCached: number;
  totalOutput: number;
  cacheHitPct: number | null;
  calls: number;
};

Related types: SessionActUsageRow.

SortDirection

type SortDirection = "asc" | "desc";

StartActOptions

interface StartActOptions {
  tolerations?: readonly ToolToleration[];
}

Related types: ToolToleration.

ThinkMode

Think/reasoning depth for session agents.

/** Think/reasoning depth for session agents. */
export type ThinkMode = boolean | ReasoningLevel;

Related types: ReasoningLevel.

TitleGenerationOptions

Options for async session title generation.

/** Options for async session title generation. */
export type TitleGenerationOptions = {
  enabled: boolean;
  completionClientRef?: string | null;
  chatModelRef?: string | null;
  model?: string | null;
  prompt?: string | null;
  maxLength?: number | null;
  parallelGeneration?: boolean | null;
};

ToolAuthorizationType

type ToolAuthorizationType = "TOOL" | "SESSION" | "APP";

ToolCallFunction

type ToolCallFunction = {
  name: string;
  arguments: Record<string, unknown> | string;
};

ToolExecutionApprovalRequest

Tool execution approval request from session.tool.execution_approval.requested.

/**
 * Tool execution approval request from `session.tool.execution_approval.requested`.
 */
export type ToolExecutionApprovalRequest = {
  actId: string;
  toolCallId: string;
  function: ToolCallFunction;
  toolDefinition?: unknown;
  argumentsNotGranted?: boolean;
};

Related types: ToolCallFunction.

ToolInputRequiredRequest

type ToolInputRequiredRequest = {
  actId: string;
  toolCallId: string;
  inputRequests?: InputRequests;
  requestState?: string;
};

Related types: InputRequests.

ToolOutputContent

type ToolOutputContent =
  | ToolOutputTextContent
  | {
      type: "file";
      file: unknown;
    }
  | {
      type: "image";
      image: unknown;
    }
  | {
      type: "data";
      data: unknown;
    };

Related types: ToolOutputTextContent.

ToolOutputTextContent

type ToolOutputTextContent = {
  type: "text";
  text: string;
};

ToolToleration

Exact requirements advertised by the client for one agent execution.

/** Exact requirements advertised by the client for one agent execution. */
export interface ToolToleration {
  key: string;
  value: string;
}

UpdateSessionInput

Partial session patch sent via session.update or REST PATCH /sessions/{id}.

/**
 * Partial session patch sent via `session.update` or REST `PATCH /sessions/{id}`.
 */
export type UpdateSessionInput = {
  title?: string | null;
  /** Custom sidebar project assignment; null moves the session out of any project. */
  customGroupId?: string | null;
  activeAgentId?: string | null;
  agents?: SessionAgentsMap | null;
  titleGenerationOptions?: TitleGenerationOptions | null;
  backgroundMode?: boolean | null;
  status?: SessionStatus | null;
  approvalPolicy?: ApprovalPolicy | null;
  /** Empty string clears toolhost back to co-located. */
  toolhost?: string | null;
  agentMode?: AgentMode | null;
};

Related types: AgentMode, ApprovalPolicy, SessionAgentsMap, SessionStatus, TitleGenerationOptions.

Runtime, providers and workspaces

Inspect runtime resources, provider state and usage, and available Cloud workspaces.

RuntimeService

Runtime control and resources API — hyperflow.runtime → RuntimeService.

getAgents

GET /runtime/resources/agents — compact links for chat agents.

declare const service: {
  "getAgents"(): Promise<ResourceLinks>;
};

Returns: Promise<ResourceLinks>.

getAgent

GET /runtime/resources/agents/{name} — chat-agent defaults and manifest fields.

declare const service: {
  "getAgent"(name: string): Promise<AgentResource | null>;
};
ParameterType
namestring

Returns: Promise<AgentResource | null>.

getTools

GET /runtime/resources/tools — tool metadata and localized labels.

declare const service: {
  "getTools"(acceptLanguage?: string): Promise<Record<string, ResourceLink>>;
};
ParameterType
acceptLanguagestring

Returns: Promise<Record<string, ResourceLink>>.

listToolhosts

GET /toolhosts — connected toolhosts available for tool execution.

declare const service: {
  "listToolhosts"(): Promise<ToolhostInfo[]>;
};

Returns: Promise<ToolhostInfo[]>.

getStudioPendingReloadStatus

Convenience wrapper — returns pendingReload from queryStudioStatus.

declare const service: {
  "getStudioPendingReloadStatus"(): Promise<boolean>;
};

Returns: Promise<boolean>.

queryStudioStatus

GET /studio/status — normalized studio reload flag.

declare const service: {
  "queryStudioStatus"(): Promise<StudioStatus>;
};

Returns: Promise<StudioStatus>.

reloadRuntime

POST /runtime/reload — triggers a runtime reload on the server.

declare const service: {
  "reloadRuntime"(): Promise<RuntimeReloadResponse>;
};

Returns: Promise<RuntimeReloadResponse>.

probeRuntimeAvailability

GET /chat (probe) — lightweight reachability check after reload.

declare const service: {
  "probeRuntimeAvailability"(): Promise<boolean>;
};

Returns: Promise<boolean>.

ProviderAuthService

Provider auth API — hyperflow.providerAuth → ProviderAuthService.

getStatus

GET /hack/auth/{resource} — reads provider OAuth status.

declare const service: {
  "getStatus"(resource: string): Promise<ProviderAuthStatus>;
};
ParameterType
resourcestring

Returns: Promise<ProviderAuthStatus>.

startLogin

POST /hack/auth/{resource}/login — starts a provider OAuth login.

declare const service: {
  "startLogin"(resource: string): Promise<ProviderLoginResponse>;
};
ParameterType
resourcestring

Returns: Promise<ProviderLoginResponse>.

ProviderUsageService

Provider usage API — hyperflow.providerUsage → ProviderUsageService.

list

GET /provider-usage — usage snapshots for all providers.

declare const service: {
  "list"(): Promise<ProviderUsageResponse>;
};

Returns: Promise<ProviderUsageResponse>.

get

GET /provider-usage/{provider} — usage snapshot for one provider.

declare const service: {
  "get"(provider: string): Promise<ProviderUsageResponse>;
};
ParameterType
providerstring

Returns: Promise<ProviderUsageResponse>.

WorkspaceService

Cloud workspace API — hyperflow.workspaces → WorkspaceService.

list

GET /workspaces — lists active Cloud workspaces for the current user.

declare const service: {
  "list"(): Promise<CloudWorkspace[]>;
};

Returns: Promise<CloudWorkspace[]>.

Supporting contracts

AgentModeSpec

Runtime-defined mode metadata exposed by an agent manifest.

/** Runtime-defined mode metadata exposed by an agent manifest. */
export type AgentModeSpec = {
  name: string;
  default?: boolean | null;
  label?: string | null;
  description?: string | null;
  deny?: string[] | null;
  allow?: string[] | null;
  reminder?: string | null;
};

AgentResource

Runtime agent detail used to resolve composer defaults.

/**
 * Runtime agent detail used to resolve composer defaults.
 *
 * The backend returns the full chat-agent manifest plus top-level `options`.
 * The client models the stable LLM fields that session composer needs and
 * keeps unknown manifest fields opaque.
 */
export type AgentResource = {
  apiVersion?: string;
  name: string;
  kind: string;
  description?: string | null;
  chatClientRef?: string | null;
  chatModelRef?: string | null;
  model?: string | null;
  think?: ThinkMode | null;
  options?: {
    think?: ThinkMode | null;
    [key: string]: unknown;
  } | null;
  modes?: AgentModeSpec[] | null;
  [key: string]: unknown;
};

Related types: ThinkMode, AgentModeSpec.

CloudWorkspace

An active Cloud workspace available to the authenticated user.

/**
 * Cloud workspace wire types.
 *
 * Consumed by {@link WorkspaceService}.
 */
/** An active Cloud workspace available to the authenticated user. */
export type CloudWorkspace = {
  id: string;
  name: string;
  slug?: string;
  status?: string;
  tenantId?: string;
  tenantType?: string;
  runtimeStatus?: string;
  primaryUrl?: string;
  /** Workspace favicon assets; absent URLs use the application's default icon. */
  branding?: {
    faviconPng32Url?: string | null;
    faviconPng192Url?: string | null;
    faviconIcoUrl?: string | null;
  };
};

HostMeta

Host metadata for a connected toolhost.

/** Host metadata for a connected toolhost. */
export type HostMeta = {
  hostname?: string;
  os?: string;
  os_version?: string;
  arch?: string;
  client_version?: string;
};

Icon

Web App Manifest-style icon served from runtime /res paths.

/**
 * Web App Manifest-style icon served from runtime `/res` paths.
 */
export type Icon = {
  src: string;
  mimeType?: string | null;
  sizes?: string[] | null;
  colorScheme?: "light" | "dark" | string | null;
  title?: string | null;
};

ProviderAuthStatus

type ProviderAuthStatus = {
  resource: string;
  provider: string;
  authenticated: boolean;
  scope: string;
  expiresAt?: number | null;
};

ProviderLoginResponse

Provider auth wire types.

/**
 * Provider auth wire types.
 *
 * Consumed by {@link ProviderAuthService}.
 */
export type ProviderLoginResponse =
  | {
      flow: "authorization";
      provider: string;
      authorizationUrl: string;
      sessionId: string;
    }
  | {
      flow: "device";
      provider: string;
      verificationUri: string;
      userCode: string;
      sessionId: string;
    };

ProviderUsageConnection

type ProviderUsageConnection = {
  provider: string;
  connectionId: string;
  connectionName: string;
  status: ProviderUsageStatus;
  windows: UsageWindow[];
  updatedAt: string | null;
  error?: string | null;
  plan?: string | null;
};

Related types: ProviderUsageStatus, UsageWindow.

ProviderUsageResponse

type ProviderUsageResponse = {
  providers: ProviderUsageSummary[];
  connections: ProviderUsageConnection[];
};

Related types: ProviderUsageConnection, ProviderUsageSummary.

ProviderUsageStatus

Provider usage wire types.

/**
 * Provider usage wire types.
 *
 * Consumed by {@link ProviderUsageService}.
 */
export type ProviderUsageStatus =
  | "available"
  | "not-configured"
  | "unauthorized"
  | "unavailable"
  | "mocked";

ProviderUsageSummary

type ProviderUsageSummary = {
  provider: string;
  displayName: string;
  status: ProviderUsageStatus;
  windows: UsageWindow[];
  updatedAt: string | null;
  error?: string | null;
  plan?: string | null;
};

Related types: ProviderUsageStatus, UsageWindow.

Compact resource info returned by runtime resource collection endpoints.

/**
 * Compact resource info returned by runtime resource collection endpoints.
 */
export type ResourceLink = {
  /** Resource name. */
  name: string;
  /** Runtime resource kind. */
  kind: string;
  /** Direct link to the full resource. */
  href: string;
  /** Optional human-readable description. */
  description?: string | null;
  icons?: Icon[] | null;
  mcpClientRef?: string | null;
  labels?: ToolLabelTemplates | null;
};

Related types: Icon, ToolLabelTemplates.

Map of runtime resource id to compact link.

/** Map of runtime resource id to compact link. */
export type ResourceLinks = Record<string, ResourceLink>;

Related types: ResourceLink.

RuntimeReloadResponse

Raw response returned by the runtime reload endpoint.

/**
 * Raw response returned by the runtime reload endpoint.
 */
export type RuntimeReloadResponse = {
  data?: unknown;
};

StudioStatus

Normalized runtime status used by the client.

/**
 * Normalized runtime status used by the client.
 */
export type StudioStatus = {
  /** True when the studio reports a pending runtime reload. */
  pendingReload: boolean;
};

ToolhostChange

App-wide WebSocket notification for toolhost connection changes.

/** App-wide WebSocket notification for toolhost connection changes. */
export type ToolhostChange = ToolhostInfo & {
  /** Whether the toolhost connected to or disconnected from the runtime. */
  action: "attached" | "detached";
};

Related types: ToolhostInfo.

ToolhostInfo

Connected toolhost exposed by the runtime.

/** Connected toolhost exposed by the runtime. */
export type ToolhostInfo = {
  /** Stable runtime id. */
  id: string;
  /** Runtime toolhost name used in session payloads. */
  name: string;
  /** Toolhost execution kind. */
  kind?: "cloud" | "remote";
  /** True when the runtime marks this as the default toolhost. */
  is_default?: boolean;
  /** True when the toolhost is private to the current user. */
  is_private?: boolean;
  /** True when the toolhost represents the user's desktop host. */
  is_desktop?: boolean;
  /** Host metadata reported by desktop or remote toolhosts. */
  host?: HostMeta;
  /** Tool names available through this toolhost. */
  tools: string[];
};

Related types: HostMeta.

ToolLabelTemplates

Locale templates for tool timeline labels (from res/locales/*.properties).

/**
 * Locale templates for tool timeline labels (from `res/locales/*.properties`).
 */
export type ToolLabelTemplates = {
  group?: string | null;
  groupPlural?: string | null;
  running?: string | null;
  completed?: string | null;
  error?: string | null;
  contentTitle?: string | null;
  contentInput?: string | null;
};

UsageWindow

type UsageWindow = {
  label: string;
  limit: number | null;
  remainingPercent: number | null;
  resetAt: string | null;
  unit: string | null;
  used: number | null;
  usedPercent: number | null;
};

Knowledge base, files and memory

Manage knowledge-base documents, uploaded files, and the user memory collection.

KnowledgeBaseService

Knowledge Base API — hyperflow.knowledgeBase → KnowledgeBaseService.

listKnowledgeBases

GET /studio/knowledge-base — lists configured Knowledge Bases.

declare const service: {
  "listKnowledgeBases"(): Promise<KnowledgeBaseSummary[]>;
};

Returns: Promise<KnowledgeBaseSummary[]>.

listFiles

GET /studio/knowledge-base/{name}/files — lists stored documents.

declare const service: {
  "listFiles"(name: string): Promise<KnowledgeBaseFileList>;
};
ParameterType
namestring

Returns: Promise<KnowledgeBaseFileList>.

uploadFile

POST /studio/knowledge-base/{name} — uploads a document without blocking for indexing.

declare const service: {
  "uploadFile"(
    name: string,
    file: File,
    onProgress?: UploadProgressHandler,
    signal?: AbortSignal,
  ): Promise<KnowledgeBaseUploadResult>;
};
ParameterType
namestring
fileFile
onProgressUploadProgressHandler
signalAbortSignal

Returns: Promise<KnowledgeBaseUploadResult>.

deleteFile

DELETE /studio/knowledge-base/{name}/files/{filename} — removes a document.

declare const service: {
  "deleteFile"(name: string, filename: string): Promise<void>;
};
ParameterType
namestring
filenamestring

Returns: Promise<void>.

POST /studio/knowledge-base/{name}/search — searches indexed documents.

declare const service: {
  "search"(
    name: string,
    query: string,
    topK?: number,
    signal?: AbortSignal,
  ): Promise<KnowledgeBaseSearchResult[]>;
};
ParameterType
namestring
querystring
topKnumber
signalAbortSignal

Returns: Promise<KnowledgeBaseSearchResult[]>.

sync

POST /runtime/resources/knowledge-bases/{name}/sync — starts document indexing.

declare const service: {
  "sync"(name: string): Promise<KnowledgeBaseSyncResult>;
};
ParameterType
namestring

Returns: Promise<KnowledgeBaseSyncResult>.

FilesService

Public Client API.

list

Public Client API.

declare const service: {
  "list"(query?: FileListQuery, signal?: AbortSignal): Promise<FilePage>;
};
ParameterType
queryFileListQuery
signalAbortSignal

Returns: Promise<FilePage>.

get

Public Client API.

declare const service: {
  "get"(id: string, signal?: AbortSignal): Promise<FileInfo>;
};
ParameterType
idstring
signalAbortSignal

Returns: Promise<FileInfo>.

usages

Public Client API.

declare const service: {
  "usages"(id: string, signal?: AbortSignal): Promise<FileUsages>;
};
ParameterType
idstring
signalAbortSignal

Returns: Promise<FileUsages>.

upload

Public Client API.

declare const service: {
  "upload"(files: File[], options?: FileUploadOptions): Promise<FileInfo[]>;
};
ParameterType
filesFile[]
optionsFileUploadOptions

Returns: Promise<FileInfo[]>.

reserveUpload

Public Client API.

declare const service: {
  "reserveUpload"(): Promise<FileUploadReservation>;
};

Returns: Promise<FileUploadReservation>.

uploadReserved

Public Client API.

declare const service: {
  "uploadReserved"(
    id: string,
    file: File,
    options?: FileUploadOptions,
  ): Promise<FileInfo>;
};
ParameterType
idstring
fileFile
optionsFileUploadOptions

Returns: Promise<FileInfo>.

releaseUpload

Public Client API.

declare const service: {
  "releaseUpload"(id: string): Promise<void>;
};
ParameterType
idstring

Returns: Promise<void>.

renewUpload

Public Client API.

declare const service: {
  "renewUpload"(id: string): Promise<FileUploadReservation>;
};
ParameterType
idstring

Returns: Promise<FileUploadReservation>.

prepared

Public Client API.

declare const service: {
  "prepared"(id: string, signal?: AbortSignal): Promise<PreparedDocumentContent>;
};
ParameterType
idstring
signalAbortSignal

Returns: Promise<PreparedDocumentContent>.

content

Public Client API.

declare const service: {
  "content"(id: string, signal?: AbortSignal): Promise<Blob>;
};
ParameterType
idstring
signalAbortSignal

Returns: Promise<Blob>.

thumbnail

Public Client API.

declare const service: {
  "thumbnail"(id: string, signal?: AbortSignal): Promise<Blob>;
};
ParameterType
idstring
signalAbortSignal

Returns: Promise<Blob>.

archive

Public Client API.

declare const service: {
  "archive"(id: string, signal?: AbortSignal): Promise<FileInfo>;
};
ParameterType
idstring
signalAbortSignal

Returns: Promise<FileInfo>.

restore

Public Client API.

declare const service: {
  "restore"(id: string, signal?: AbortSignal): Promise<FileInfo>;
};
ParameterType
idstring
signalAbortSignal

Returns: Promise<FileInfo>.

delete

Public Client API.

declare const service: {
  "delete"(id: string, signal?: AbortSignal): Promise<void>;
};
ParameterType
idstring
signalAbortSignal

Returns: Promise<void>.

prepareSelection

Public Client API.

declare const service: {
  "prepareSelection"(
    selection: FileSelectionInput,
    signal?: AbortSignal,
  ): Promise<PreparedFileSelection>;
};
ParameterType
selectionFileSelectionInput
signalAbortSignal

Returns: Promise<PreparedFileSelection>.

startOperation

Public Client API.

declare const service: {
  "startOperation"(
    selectionId: string,
    action: FileAction,
    signal?: AbortSignal,
  ): Promise<FileOperation>;
};
ParameterType
selectionIdstring
actionFileAction
signalAbortSignal

Returns: Promise<FileOperation>.

getOperation

Public Client API.

declare const service: {
  "getOperation"(id: string, signal?: AbortSignal): Promise<FileOperation>;
};
ParameterType
idstring
signalAbortSignal

Returns: Promise<FileOperation>.

operationResults

Public Client API.

declare const service: {
  "operationResults"(
    id: string,
    query?: FileOperationResultsQuery,
    signal?: AbortSignal,
  ): Promise<FileOperationResults>;
};
ParameterType
idstring
queryFileOperationResultsQuery
signalAbortSignal

Returns: Promise<FileOperationResults>.

retryOperation

Public Client API.

declare const service: {
  "retryOperation"(id: string, signal?: AbortSignal): Promise<FileOperation>;
};
ParameterType
idstring
signalAbortSignal

Returns: Promise<FileOperation>.

MemoryService

Memory API — hyperflow.memory → MemoryService.

listMyMemories

GET /memory/me — lists the authenticated user's memories.

declare const service: {
  "listMyMemories"(params?: ListMemoriesParams): Promise<MemoryListResult>;
};
ParameterType
paramsListMemoriesParams

Returns: Promise<MemoryListResult>.

updateMemory

PUT /memory/{id} — updates one memory.

declare const service: {
  "updateMemory"(memoryId: string, input: UpdateMemoryInput): Promise<MemoryItem>;
};
ParameterType
memoryIdstring
inputUpdateMemoryInput

Returns: Promise<MemoryItem>.

deleteMemory

DELETE /memory/{id} — removes one memory.

declare const service: {
  "deleteMemory"(memoryId: string): Promise<void>;
};
ParameterType
memoryIdstring

Returns: Promise<void>.

previewClaudeImport

POST /memory/import/claude/preview — parses external memory text.

declare const service: {
  "previewClaudeImport"(content: string): Promise<MemoryImportPreview>;
};
ParameterType
contentstring

Returns: Promise<MemoryImportPreview>.

importClaudeMemories

POST /memory/import/claude — imports parsed memory drafts.

declare const service: {
  "importClaudeMemories"(memories: ImportedMemoryDraft[]): Promise<MemoryImportResult>;
};
ParameterType
memoriesImportedMemoryDraft[]

Returns: Promise<MemoryImportResult>.

Supporting contracts

DocumentPreparationInfo

type DocumentPreparationInfo = {
  format: string;
  unitKind: "page" | "slide" | "sheet" | "section";
  unitCount: number;
  preparedUnits: number[];
  unitsWithoutText: number[];
  truncated: boolean;
  version: string;
};

FileAction

type FileAction = "archive" | "restore" | "delete";

FileInfo

type FileInfo = LibraryFile & {
  preview?: FilePreviewInfo | null;
  preparation?: DocumentPreparationInfo | null;
  inUse: boolean;
  canDelete: boolean;
  canArchive: boolean;
  canRestore: boolean;
};

Related types: DocumentPreparationInfo, FilePreviewInfo, LibraryFile.

FileListQuery

type FileListQuery = {
  page?: number;
  perPage?: number;
  q?: string;
  mimeType?: string;
  kind?: "image" | "document" | "other" | undefined;
  origin?: LibraryFile["origin"] | undefined;
  inUse?: boolean;
  createdFrom?: string;
  createdTo?: string;
  view?: FileView;
  sortBy?: FileSort;
  sortDirection?: FileOrder;
};

Related types: FileOrder, FileSort, FileView, LibraryFile.

FileOperation

type FileOperation = {
  id: string;
  userId: number;
  action: FileAction | null;
  status: "prepared" | "queued" | "running" | "completed";
  total: number;
  processed: number;
  succeeded: number;
  failed: number;
  protected: number;
  unavailable: number;
  expiresAt: string;
  createdAt: string;
  updatedAt: string;
};

Related types: FileAction.

FileOperationItem

type FileOperationItem = {
  id: string;
  operationId: string;
  fileId: string;
  name: string;
  inUse: boolean;
  archived: boolean;
  status: "pending" | "succeeded" | "protected" | "unavailable" | "failed";
  errorCode: string | null;
  errorMessage: string | null;
  attempts: number;
};

FileOperationResults

type FileOperationResults = {
  items: FileOperationItem[];
  page: number;
  perPage: number;
  total: number;
  hasMore: boolean;
};

Related types: FileOperationItem.

FileOperationResultsQuery

type FileOperationResultsQuery = {
  page?: number;
  perPage?: number;
  status?: FileOperationItem["status"];
};

Related types: FileOperationItem.

FileOrder

type FileOrder = "asc" | "desc";

FilePage

type FilePage = {
  items: FileInfo[];
  page: number;
  perPage: number;
  total: number;
  hasMore: boolean;
};

Related types: FileInfo.

FilePreviewInfo

type FilePreviewInfo = {
  status: "queued" | "running" | "ready" | "failed";
  pipelineVersion: number;
  errorCode: string | null;
};

FileSelectionInput

type FileSelectionInput =
  | {
      ids: string[];
      query?: never;
      excludedIds?: string[];
    }
  | {
      query: FileListQuery;
      ids?: never;
      excludedIds?: string[];
    };

Related types: FileListQuery.

FileSort

type FileSort = "name" | "created_at" | "size";

FileUploadOptions

type FileUploadOptions = {
  signal?: AbortSignal;
  onProgress?: (percent: number) => void;
};

FileUploadReservation

type FileUploadReservation = {
  id: string;
  userId: number;
  fileId: string | null;
  status:
    | "reserved"
    | "uploading"
    | "ready"
    | "committing"
    | "committing_released"
    | "committed"
    | "released";
  expiresAt: string;
  createdAt: string;
};

FileUsages

type FileUsages = {
  sessions: Array<{
    sessionId: string;
    title: string | null;
    attachments: number;
  }>;
  hasRestrictedUsages: boolean;
};

FileView

type FileView = "active" | "archived" | "all";

ImportedMemoryDraft

A parsed memory that can be confirmed before import.

/** A parsed memory that can be confirmed before import. */
export type ImportedMemoryDraft = {
  subject: string;
  content: string;
};

KnowledgeBaseFile

A document stored in a Knowledge Base.

/** A document stored in a Knowledge Base. */
export type KnowledgeBaseFile = {
  filename: string;
  bytes: number;
  mimeType: string;
  modifiedAt?: string | null;
  indexed: boolean;
};

KnowledgeBaseFileList

Response returned when listing the documents of a Knowledge Base.

/** Response returned when listing the documents of a Knowledge Base. */
export type KnowledgeBaseFileList = {
  kb: string;
  files: KnowledgeBaseFile[];
};

Related types: KnowledgeBaseFile.

KnowledgeBaseSearchResult

A semantic-search match returned by a Knowledge Base.

/** A semantic-search match returned by a Knowledge Base. */
export type KnowledgeBaseSearchResult = {
  filename: string;
  source: string;
  snippet: string;
  score: number;
  rank: number;
  pageNumber?: number | null;
};

KnowledgeBaseSummary

A configured Knowledge Base available to the current workspace.

/**
 * Knowledge Base wire types.
 *
 * Consumed by {@link KnowledgeBaseService}.
 */
/** A configured Knowledge Base available to the current workspace. */
export type KnowledgeBaseSummary = {
  name: string;
  description?: string | null;
  path?: string | null;
};

KnowledgeBaseSyncResult

Response returned when indexing is scheduled explicitly.

/** Response returned when indexing is scheduled explicitly. */
export type KnowledgeBaseSyncResult = {
  jobId: string;
};

KnowledgeBaseUploadResult

Response returned after accepting an uploaded document.

/** Response returned after accepting an uploaded document. */
export type KnowledgeBaseUploadResult = {
  kb: string;
  saved: Array<{
    filename: string;
    bytes: number;
  }>;
  jobId?: string | null;
};

LibraryFile

type LibraryFile = {
  id: string;
  userId: number;
  name: string;
  mimeType: string;
  size: number;
  contentHash: string;
  origin: "upload" | "tool_output" | "derived";
  parentId: string | null;
  visible: boolean;
  archivedAt: string | null;
  deletionStatus: "active" | "deleting" | "delete_failed";
  createdAt: string;
};

ListMemoriesParams

Pagination controls for the authenticated-user memory list.

/** Pagination controls for the authenticated-user memory list. */
export type ListMemoriesParams = {
  limit?: number;
  offset?: number;
};

MemoryImportFailure

One memory that the backend could not import.

/** One memory that the backend could not import. */
export type MemoryImportFailure = {
  subject?: string | null;
  error?: string | null;
};

MemoryImportPreview

Parsed memories available for confirmation before import.

/** Parsed memories available for confirmation before import. */
export type MemoryImportPreview = {
  memories: ImportedMemoryDraft[];
  total: number;
};

Related types: ImportedMemoryDraft.

MemoryImportResult

Outcome returned after importing a batch of memories.

/** Outcome returned after importing a batch of memories. */
export type MemoryImportResult = {
  imported: number;
  skippedDuplicates: number;
  failed: MemoryImportFailure[];
  memoryIds: string[];
};

Related types: MemoryImportFailure.

MemoryItem

A persistent memory belonging to the authenticated user.

/** Wire types returned by the authenticated-user memory endpoints. */
/** A persistent memory belonging to the authenticated user. */
export type MemoryItem = {
  id: string;
  scopeType: string;
  scopeId?: string | null;
  subject: string;
  content: string;
  context?: string | null;
  keywords: string[];
  tags: string[];
  links: string[];
  importanceScore: number;
  accessCount: number;
  evolutionCount: number;
  createdAt: string;
  updatedAt: string;
};

MemoryListResult

A paginated page of persistent memories.

/** A paginated page of persistent memories. */
export type MemoryListResult = {
  memories: MemoryItem[];
  total: number;
  limit: number;
  offset: number;
};

Related types: MemoryItem.

PreparedDocumentContent

type PreparedDocumentContent = {
  info: DocumentPreparationInfo;
  units: Array<{
    index: number;
    markdown: string;
    hasNativeText: boolean;
    truncated: boolean;
  }>;
};

Related types: DocumentPreparationInfo.

PreparedFileSelection

type PreparedFileSelection = {
  id: string;
  total: number;
  inUse: number;
  archived: number;
  expiresAt: string;
};

UpdateMemoryInput

Editable fields for an existing persistent memory.

/** Editable fields for an existing persistent memory. */
export type UpdateMemoryInput = {
  subject?: string | null;
  content?: string | null;
  context?: string | null;
  keywords?: string[] | null;
  tags?: string[] | null;
  importanceScore?: number | null;
};

UploadProgressHandler

Receives upload percentage updates from zero through one hundred.

/** Receives upload percentage updates from zero through one hundred. */
export type UploadProgressHandler = (progress: number) => void;

WebSocket and advanced utilities

Use the low-level WebSocket client only when the session services do not cover the protocol operation you need.

WebSocketClient

Public WebSocket facade. Delegates to the transport from createWebSocketTransport; does not implement auth, ping, or reconnect (see WebSocketSessionCore ).

start

Starts the selected WebSocket transport.

declare const service: {
  "start"(): Promise<void>;
};

Returns: Promise<void>.

stop

Stops the transport and releases its connection.

declare const service: {
  "stop"(): void;
};

Returns: void.

send

Sends a fire-and-forget protocol event.

declare const service: {
  "send"(event: ClientEvent): void;
};
ParameterType
eventClientEvent

Returns: void.

request

Sends a client event and waits for the correlated server response via eventId. Not suitable for multi-frame replies such as session.replay — use WebSocketClient.send instead.

declare const service: {
  "request"(event: ClientEvent): Promise<ParsedWsEvent>;
};
ParameterType
eventClientEvent

Returns: Promise<ParsedWsEvent>.

on

Registers a handler for one protocol event type and returns its unsubscribe function.

declare const service: {
  "on"(type: string, handler: (event: ParsedWsEvent) => void): () => void;
};
ParameterType
typestring
handler(event: ParsedWsEvent) => void

Returns: () => void.

onSession

Registers a handler for events belonging to one session.

declare const service: {
  "onSession"(sessionId: string, handler: (event: ServerEvent) => void): () => void;
};
ParameterType
sessionIdstring
handler(event: ServerEvent) => void

Returns: () => void.

onApp

Registers a handler for application-wide events.

declare const service: {
  "onApp"(handler: (event: AppEvent) => void): () => void;
};
ParameterType
handler(event: AppEvent) => void

Returns: () => void.

onAny

Registers a handler for every parsed server event.

declare const service: {
  "onAny"(handler: (event: ParsedWsEvent) => void): () => void;
};
ParameterType
handler(event: ParsedWsEvent) => void

Returns: () => void.

onStateChange

Registers a connection-state listener.

declare const service: {
  "onStateChange"(listener: WebSocketStateListener): () => void;
};
ParameterType
listenerWebSocketStateListener

Returns: () => void.

onReady

Registers a callback invoked whenever the transport becomes ready.

declare const service: {
  "onReady"(listener: WebSocketReadyListener): () => void;
};
ParameterType
listenerWebSocketReadyListener

Returns: () => void.

Supporting contracts

AppEvent

type AppEvent = AppKnowledgeBaseEvent | AppSessionEvent | AppToolhostEvent;

Related types: AppKnowledgeBaseEvent, AppSessionEvent, AppToolhostEvent.

AppKnowledgeBaseEvent

App-level events forwarded by app.subscribe (distinct from session ServerEvent).

/**
 * App-level events forwarded by `app.subscribe` (distinct from session ServerEvent).
 */
export type AppKnowledgeBaseEvent = {
  type: "kb";
  data: {
    kbName: string;
  } & KnowledgeBaseProgress;
};

Related types: KnowledgeBaseProgress.

AppSessionEvent

type AppSessionEvent = {
  type: "session";
  data: Record<string, unknown>;
};

AppToolhostEvent

type AppToolhostEvent = {
  type: "toolhost";
  data: ToolhostChange;
};

Related types: ToolhostChange.

KnowledgeBaseIndexingStats

type KnowledgeBaseIndexingStats = {
  documents_processed: number;
  documents_failed: number;
  chunks_created: number;
  [key: string]: unknown;
};

KnowledgeBaseProgress

type KnowledgeBaseProgress =
  | {
      Started: {
        source: string;
        total_files: number;
      };
    }
  | {
      Processing: {
        source: string;
        file: string;
        current: number;
        total: number;
        current_chunk?: number;
        total_chunks?: number;
      };
    }
  | {
      Completed: {
        source: string;
        stats: KnowledgeBaseIndexingStats;
      };
    }
  | {
      Error: {
        source: string;
        file: string;
        error: string;
      };
    };

Related types: KnowledgeBaseIndexingStats.

ParsedWsEvent

type ParsedWsEvent = ServerEvent | AppEvent;

Related types: ServerEvent, AppEvent.

WebSocketAuthTokenResult

WebSocket auth token returned by POST /auth/ws.

/**
 * WebSocket auth token returned by `POST /auth/ws`.
 */
export type WebSocketAuthTokenResult = {
  token: string;
  expiresAt: string;
};

WebSocketConnectionState

type WebSocketConnectionState =
  | "idle"
  | "connecting"
  | "authenticating"
  | "ready"
  | "reconnecting"
  | "stopped";

WebSocketReadyListener

type WebSocketReadyListener = () => void;

WebSocketStateListener

type WebSocketStateListener = (state: WebSocketConnectionState) => void;

Related types: WebSocketConnectionState.

On this page

Start hereFind an APISetup, authentication and transportHyperflowinitAuthServiceauthorizegetCurrentUserupdateMyAccountchangePasswordgetWsTokengetCloudLogoutUrllogoutSupporting contractsAuthorizeInputAuthorizeResultAuthTokensChangePasswordInputClientConfigTokenStorageUpdateMyAccountInputUserWsTransportModeConfiguration and model catalogConfigServicegetConfigModelsCatalogServicelistByChatClientSupporting contractsAgentSelectorChildComponentAuthModeCatalogModelChatClientModelGroupChatOptionsComposerComponentComposerConfigComposerConfigInnerComposerDisclaimerConfigConfigResponseFrontendConfigModelCapabilityFlagsModelTypeSessionOptionsSessionOptionsComponentToolhostDefaultConfigToolhostDefaultPolicySessionsHttpSessionServicelistSessionsgetSessiongetUsagelistCustomGroupsapproveToolcancelBackgroundTaskdeleteBackgroundTaskWsSessionServicesubscribeSessionreplaySessioncreateSessionupdateSessionrewindSessionforkSessiondeleteSessioncreateItemlistActslistBackgroundTasksgetBackgroundTaskstartActabortActgenerateTitlecreateCustomGroupupdateCustomGroupdeleteCustomGroupunsubscribeSessiondeliverClientToolResultonSessionEventonAppEventSupporting contractsAgentAuthRequiredRequestAgentModeApprovalPolicyApproveToolRequestAudienceBackgroundTaskBackgroundTaskStatusClientEventClientSessionItemCompactedItemAudienceContextWindowStateCreateSessionInputDeviceAuthorizationCompletedBodyInProgressItemInputRequestOptionInputRequestQuestionInputRequestsListSessionActsParamsListSessionsGroupByListSessionsParamsMessageContentMessageFileContentMessageFileInputMessageFilePayloadMessageImageContentMessageImagePayloadMessageInputContentMessageTextContentOAuthAuthorizationFlowOAuthDeviceFlowOAuthFlowsPaginationReasoningActivityReasoningLevelResponseDeltaServerEventSessionSessionActSessionActsPageSessionActUsageRowSessionActWithItemsSessionAgentSessionAgentLLMSourceSessionAgentOptionChangeSessionAgentsMapSessionCustomGroupSessionCustomGroupInputSessionForkResultSessionItemSessionItemTypeSessionListGroupSessionListGroupedByCustomSessionListGroupedByStatusSessionListResponseSessionListResponseDataSessionRewindResultSessionStatusSessionUsageSortDirectionStartActOptionsThinkModeTitleGenerationOptionsToolAuthorizationTypeToolCallFunctionToolExecutionApprovalRequestToolInputRequiredRequestToolOutputContentToolOutputTextContentToolTolerationUpdateSessionInputRuntime, providers and workspacesRuntimeServicegetAgentsgetAgentgetToolslistToolhostsgetStudioPendingReloadStatusqueryStudioStatusreloadRuntimeprobeRuntimeAvailabilityProviderAuthServicegetStatusstartLoginProviderUsageServicelistgetWorkspaceServicelistSupporting contractsAgentModeSpecAgentResourceCloudWorkspaceHostMetaIconProviderAuthStatusProviderLoginResponseProviderUsageConnectionProviderUsageResponseProviderUsageStatusProviderUsageSummaryResourceLinkResourceLinksRuntimeReloadResponseStudioStatusToolhostChangeToolhostInfoToolLabelTemplatesUsageWindowKnowledge base, files and memoryKnowledgeBaseServicelistKnowledgeBaseslistFilesuploadFiledeleteFilesearchsyncFilesServicelistgetusagesuploadreserveUploaduploadReservedreleaseUploadrenewUploadpreparedcontentthumbnailarchiverestoredeleteprepareSelectionstartOperationgetOperationoperationResultsretryOperationMemoryServicelistMyMemoriesupdateMemorydeleteMemorypreviewClaudeImportimportClaudeMemoriesSupporting contractsDocumentPreparationInfoFileActionFileInfoFileListQueryFileOperationFileOperationItemFileOperationResultsFileOperationResultsQueryFileOrderFilePageFilePreviewInfoFileSelectionInputFileSortFileUploadOptionsFileUploadReservationFileUsagesFileViewImportedMemoryDraftKnowledgeBaseFileKnowledgeBaseFileListKnowledgeBaseSearchResultKnowledgeBaseSummaryKnowledgeBaseSyncResultKnowledgeBaseUploadResultLibraryFileListMemoriesParamsMemoryImportFailureMemoryImportPreviewMemoryImportResultMemoryItemMemoryListResultPreparedDocumentContentPreparedFileSelectionUpdateMemoryInputUploadProgressHandlerWebSocket and advanced utilitiesWebSocketClientstartstopsendrequestononSessiononApponAnyonStateChangeonReadySupporting contractsAppEventAppKnowledgeBaseEventAppSessionEventAppToolhostEventKnowledgeBaseIndexingStatsKnowledgeBaseProgressParsedWsEventWebSocketAuthTokenResultWebSocketConnectionStateWebSocketReadyListenerWebSocketStateListener