import type { PreviewBlock, StreamEvent } from './format' import type { IdentityIconId } from './identity-icons' import type { MoiContext } from './moi-context' import type { WorkspaceTheme } from './themes' import type { AttachmentInput, WidgetConfig } from 'moi' export type { AttachmentInput, ViewConfig, WidgetConfig } from 'moi' // A custom UI unit embedded in a workspace. export type AppletKind = 'view' | 'widget' // What a bundled applet's `moi` module may call on its host-attached bridge. // Inputs stay unknown at this trust boundary; the browser host narrows them. export type AppletBridge = { addChatAttachment: (input: unknown) => void navigate: (url: unknown) => void resolveUrl: (url: unknown) => string sendChatMessage: (input: unknown, context?: unknown) => void } export type AppletInfo = { id: string // Content revision of the built bundle (`-` of index.js). // Absent when the build output cannot be statted. revision?: string } export type WidgetInfo = AppletInfo & { config: WidgetConfig } // A view is a full-screen, agent-authored "app" (`.moi/views/.tsx`), // shown one-at-a-time in the workspace nav. Same build/RPC machinery as a // widget, minus the grid: no sizing, the view owns its own layout and scroll. export type PendingView = { id: string status: 'draft' | 'starting' | 'submitted' | 'failed' title?: string icon?: string requirements: string // The chat running the build: usually the view tab's own chat, or the // pinned chat when one is pinned. Ownership lives in the chat's `tabId`. buildSessionId?: string error?: string } export type CompiledView = { id: string status: 'compiled' title: string icon?: string requiredEnv?: string[] revision?: string } export type ViewInfo = PendingView | CompiledView // ---- Applet error journal (see docs/self-correction.md) ------------------ // Where an applet error was observed. `build` and `rpc` are recorded // server-side (bundle pipeline, RPC route); `load`/`render`/`window`/`runtime` // are browser-side and reach the journal via POST // /api/workspaces/:id/applet-log. `runtime` is the applet API refusing a // request rather than code throwing — a `navigate` to a view that no longer // exists, a `sendChatMessage` dropped by the rate limit — which the applet's // own code never sees. export type AppletLogSource = 'build' | 'load' | 'render' | 'window' | 'rpc' | 'runtime' // One journal entry, as returned to `moi debug logs`. `kind`/`name` attribute // the applet when known; `module`/`fn` pin down the server function for `rpc` // entries. `count` dedups repeats of the identical error (crash loops are one // line, not a hundred); `ts` is the LAST occurrence. export type AppletLogEntry = { ts: number source: AppletLogSource kind?: AppletKind name?: string module?: string fn?: string message: string stack?: string count: number } // The browser-reported subset (the server-side sources can't be spoofed by a // tab — the POST route rejects them). `kind`/`name` are optional because a // `runtime` entry may have no applet to blame: a stale bookmark pointing at a // deleted view is the host redirecting, not an applet misbehaving. export type AppletClientErrorSource = 'load' | 'render' | 'window' | 'runtime' export type AppletClientError = { source: AppletClientErrorSource kind?: AppletKind name?: string message: string stack?: string } // A Scratchpad draw/view operation issued by `moi scratch`. Mutations run // server-side against a headless tldraw store; `view` relays to a live tab. The // server assigns each add op a `name` (the `--id`, or a generated one) so the // derived tldraw shape id is deterministic and addressable later. Arrow endpoints // bind to a shape (by name) or sit at a free point. See docs/moi-scratchpad.md. export type ScratchPoint = { x: number; y: number } export type ScratchArrowEnd = { name: string } | ScratchPoint // The Scratchpad's color palette — the same six swatches the UI toolbar offers, // so the agent can only paint what the user can. The CLI also accepts an arbitrary // hex and snaps it to the nearest of these (tldraw shapes hold a palette color, not // free hex). export type ScratchColor = 'black' | 'grey' | 'blue' | 'green' | 'yellow' | 'red' // tldraw's DefaultSizeStyle, exposed under two friendlier CLI names for the two // shapes that use it: arrows take `--stroke small|large` (line weight), text & // notes take `--font-size regular|big` (label size). Both map onto the same // underlying tldraw size — `small`/`regular` → 'm', `large`/`big` → 'xl'. export type ScratchSize = 'm' | 'xl' // Fill style for rectangles — the UI toolbar's four options. The CLI takes // `none|semi|pattern|solid`; ops carry the tldraw DefaultFillStyle value. Note the // tldraw quirk (see defaultFills / FILL_OPTIONS in client/features/scratchpad/scratchpad-controls.tsx): // fill value 'solid' paints the lighter "semi" color, while 'fill' paints the true // solid (body === border). Keep the names in sync with that client list. export type ScratchFill = 'none' | 'solid' | 'pattern' | 'fill' // Optional styling carried by every add op. Omitted fields fall back to the // shape's tldraw default. `size` is set from `--stroke` (arrows) or `--font-size` // (text/notes); `fill` from `--fill` (rectangles). export type ScratchStyle = { color?: ScratchColor; size?: ScratchSize; fill?: ScratchFill } // Resize preset for `add image`: 'lo' caps the long side smaller (default, keeps // the canvas light), 'hi' allows more pixels when detail matters. export type ScratchImageQuality = 'lo' | 'hi' export type ScratchOp = | ({ kind: 'add-text'; name: string; x: number; y: number; text: string } & ScratchStyle) | ({ kind: 'add-rect' name: string x: number y: number w: number h: number text?: string } & ScratchStyle) | ({ kind: 'add-note'; name: string; x: number; y: number; text: string } & ScratchStyle) // Add an image from a local file `path` — the server resizes it to fit the // canvas and embeds it (color/stroke don't apply, so no ScratchStyle). // `quality` picks the resize preset: 'lo' (default, smaller) or 'hi' (sharper). | { kind: 'add-image' name: string x: number y: number path: string quality?: ScratchImageQuality } | ({ kind: 'add-arrow' name: string from: ScratchArrowEnd to: ScratchArrowEnd // Right-angle (orthogonal) routing for clean diagrams; default is a curved arc. elbow?: boolean } & ScratchStyle) | { kind: 'move'; name: string; x: number; y: number } | { kind: 'set'; name: string; text: string } | { kind: 'delete'; name: string } | { kind: 'clear' } | { kind: 'view' } // What a tab returns after running an op: a shape's `name` for add ops, a PNG // data URL for `view`, or a bare ack for mutations. export type ScratchOpResult = { name: string } | { image: string } | { ok: true } // The process that last persisted `.moi/.scratchpad.json` (always the server — // browser saves funnel through it). Stamped on save so an older reader hitting // the snapshot can name the version it needs (see lib/scratchpad-skew.ts). export type ScratchpadWriter = { moi: string; tldraw: string } // Attachments: caller input → upload receipt → send reference → resolved data. // Text skips uploading. Origin and drawing purpose follow the attachment. export type DrawingPurpose = 'annotation' | 'sketch' // Host-stamped ID of the applet or workspace tab that created the attachment. export type AttachmentOrigin = { source: string } export type TextAttachment = Partial & { label: string; text: string } type FileAttachment = Partial & { mediaType: string path: string // Only set when the file contains a drawing image. purpose?: DrawingPurpose } type ImageAttachment = Partial & { mediaType: string label: string purpose?: DrawingPurpose } // Resolved payloads: JSON-safe data shared by prompts and transcript replay. export type Attachment = | ({ type: 'text' } & TextAttachment) | ({ type: 'file' } & FileAttachment) | ({ type: 'image' } & ImageAttachment) // Caller input: text or a browser file / workspace-relative path. export type TextAttachmentInput = Omit, 'type'> // Upload receipt: returned by the upload API before sending the message. // Bytes or an absolute file path live in the server's workspace-scoped store. export type UploadKind = 'image' | 'file' export type UploadInfo = { id: string kind: UploadKind // Normalized media type (images are re-encoded to a vision-safe type). mediaType: string filename: string size: number // Pixel dimensions, for images only — lets the composer reserve space. width?: number height?: number } // Send reference: inline text or an upload ID for the server to resolve. // Drawing purpose belongs to this message's use of the uploaded image. export type MessageAttachment = | ({ type: 'text' } & TextAttachment) | ({ type: 'upload'; uploadId: string; purpose?: DrawingPurpose } & Partial) // Client → server messages, routed by workspaceId over the shared WebSocket. export type SelectedSessionScope = 'shared' | 'browser-tab' export type ClientMessage = | { type: 'chat' workspaceId: string content: string sessionId: string isNew: boolean // Where this tab keeps its selected session. Browser-tab selection must // not update the workspace's shared selection or switch other tabs. selectedSessionScope?: SelectedSessionScope // Text and upload references for this turn. The server resolves uploads // and describes all attachments together, preserving their order. attachments?: MessageAttachment[] // Client-chosen stable id for the user's turn. The server tells the // adapter to use this id when the SDK echoes the user input back, so // the optimistic bubble the client rendered gets upserted in place. optimisticId?: string // Model id to run this turn with (from the picker / `supportedModels()` // `value`). Omitted means the server's default. Applied per turn, so it // can change between messages in the same session. model?: string // Reasoning effort for this turn (one of the model's `supportedEffortLevels`). // Omitted means the provider default. Harnesses apply changes before the // next send (see server/harness/claude-code/session.ts). effort?: string // Select processing speed. Omitted uses normal, overriding provider defaults. speedMode?: SpeedMode // Opt into live token-by-token streaming for this turn. Omitted/false runs // the current whole-block behavior. Only honored for providers that report // `supportsStreaming` (Claude Code); ignored otherwise. Like effort, a // change forces the live session to rebuild. stream?: boolean // Structured moi context (lib/moi-context.ts): ambient workspace state // snapshotted at send time, assembled by // client/features/workspace/moi-context.ts. The server renders it per // harness; display paths strip the rendered envelope from bubbles. context?: MoiContext } | { type: 'stop'; workspaceId: string; sessionId: string } // Reply to a relayed Scratchpad op (see ScratchpadOpMessage). Carries the // op's correlation id so the server settles the right pending CLI request. | { type: 'scratchpad:op-result'; opId: string; result?: ScratchOpResult; error?: string } // Session details supplied by the agent backend. export type SessionSummary = { sessionId: string summary: string lastModified: number cwd?: string // Where the conversation originates when the backend routes external // channels into it (OpenClaw: telegram/irc/discord/…; absent = app chat). origin?: { provider: string; label?: string } // Session flavor beyond a plain chat: scheduled cron runs and spawned // subagent sessions get a badge in the chat selector. flavor?: 'chat' | 'cron' | 'subagent' } // Missing speed mode behaves as normal. export type SpeedMode = 'normal' | 'fast' | 'ultrafast' // Per-chat agent settings, overriding the workspace defaults in // `.moi/.workspace.json`. A chat reopens with the model/effort/speed mode it // last ran with; a brand-new chat is seeded from the workspace defaults. export type SessionConfig = { model?: string effort?: string speedMode?: SpeedMode } export type SessionFork = { fromSessionId: string // Last copied turn in the child. Without a cutoff, show its full history. throughMessageId?: string noticeIds?: string[] } // Moi's own record of one chat. Titles and history stay with the agent. export type WorkspaceSessionState = { // The view tab that owns this chat; absent means the overview. tabId?: WorkspaceTabId config?: SessionConfig fork?: SessionFork } // Per-user chat state for one workspace, kept in Moi's data dir and served by // GET /api/workspaces/:id/state. Every write returns it and publishes it as // `state:changed`. export type WorkspaceState = { // Goes up by one with every saved change. Lets clients drop an older copy // that arrives after a newer one. revision: number // Applies to every tab and overrides `selected`. pinnedSessionId?: string // The chat each tab shows. selected: Partial> sessions: Record // Views not compiled yet, keyed by view id. pendingViews: Record> } // A chat-list row: the agent's session plus the tab that owns it. export type SessionInfo = SessionSummary & { tabId?: WorkspaceTabId } // App-wide settings, persisted server-side as `settings.json` in Moi's data // dir and exposed via GET/PATCH /api/settings. Every key has a default, so // GET always returns a complete object. export type AppSettings = { showOnboarding: boolean // Apply bundled workspace-skill updates automatically when a workspace // with outdated skills is opened, instead of prompting each time. autoUpdateSkills: boolean } // Client-safe startup config, served by GET /api/config. Deployment settings // come from config.json and MOI_* env overrides. See server/app-config.ts. export type AppEnvironment = 'local' | 'cloud' export type ClientAppConfig = { environment: AppEnvironment collab: boolean // Demo mode: workspace creation is blocked; the UI offers the // cloud-demo promo dialog instead. demo: boolean // Link target for the cloud-demo promo dialog. demoInstallUrl: string } export type UpdateStatus = { runningVersion: string availableVersion: string | null } export type UpdateResult = { installedVersion: string } // Re-export the display format export type { Citation, Part, PreviewBlock, ResultSummary, SessionSnapshot, StreamEvent, StreamPreview, SubagentRecord, SubagentStatus, SystemNotice, ToolCall, ToolCaller, ToolState, Turn, TurnMeta, TurnOrigin, ViewState } from './format' // Server → Client messages. // The chat socket is app-wide, so every conversation frame carries both a // `workspaceId` and a `sessionId` — the client routes each frame to the right // `(workspaceId, sessionId)` slice of its cache. export type ServerMessage = | (StreamEvent & { sessionId: string; workspaceId: string }) | PreviewFrame | StatusMessage | SessionRenamedMessage | SessionsChangedMessage | SessionArchivedMessage | WorkspaceSwitchMessage | ErrorFrame | StoppedFrame | StatusSnapshotMessage | ScratchpadOpMessage // A live token-by-token snapshot of an assistant message still being generated. // Ephemeral: it is NOT a StreamEvent, never persisted, and never folded into the // durable transcript (React Query cache). The client keeps it in a separate // ephemeral store and discards it the instant the real `turn` for `messageId` // lands. `blocks[].text` is CUMULATIVE, so a lost/reordered/duplicated frame is // simply overwritten by the next one — it can never corrupt the transcript. export type PreviewFrame = { type: 'preview' workspaceId: string sessionId: string // API message id (`msg_...`), globally unique — the accumulator key, so // concurrent streams (parallel subagents) never collide. Matches the eventual // turn's `meta.apiMessageId`, which is how the client clears this preview. messageId: string // null = top-level assistant; a tool_use id = a subagent's nested stream. parentToolUseId: string | null blocks: PreviewBlock[] } // A Scratchpad op relayed to the tab(s) showing `workspaceId`'s canvas. Only // `view` travels this way now (rendering needs the browser); mutations run // server-side. The tab with a live editor for that workspace executes it and // replies with a matching `scratchpad:op-result` (correlated by `opId`). export type ScratchpadOpMessage = { type: 'scratchpad:op' workspaceId: string opId: string op: ScratchOp } // Frame as constructed by callers of `broadcast(workspaceId, frame)` — the // `workspaceId` is stamped on by `broadcast`, so callers omit it. export type BroadcastFrame = | (StreamEvent & { sessionId: string }) | Omit | Omit | Omit | Omit | Omit | Omit | Omit // Sent to a client right after it connects (and re-broadcast periodically): the // authoritative set of non-idle sessions across all workspaces. The client // treats it as ground truth — any session NOT listed is marked idle — which // clears a spinner whose terminal `status` frame was lost (disconnect window, // dropped frame, harness gap). export type StatusSnapshotMessage = { type: 'status_snapshot' sessions: { workspaceId: string; sessionId: string; activity: SessionActivity }[] } export type WorkspaceSwitchMessage = { type: 'workspace:switch' workspaceId: string } export type WorkspaceType = 'claude-code' | 'openclaw' | 'codex' | 'hermes' export type WorkspaceSkillStatus = { name: string path: string installed: string | null bundled: string | null } export type WorkspaceSkillsStatus = { skills: WorkspaceSkillStatus[] updateAvailable: boolean } export type WorkspaceSkillsUpdateFailure = WorkspaceSkillsStatus & { error: string } export type HarnessInstallations = Record // Shared runtime/account readiness and the current sign-in attempt. export type HarnessStatus = { availability: HarnessAvailability; login?: HarnessLoginState } export type HarnessStatuses = Record export type HarnessAvailability = | { status: 'available' } | { status: 'login-required'; reason: string } | { status: 'unavailable'; reason: string; code?: 'not-installed' } // Public instructions for an in-progress harness login. Credentials stay in the CLI. export type HarnessLogin = { id: string url: string codeUrl?: string userCode?: string } // The global auth endpoint exposes startup separately from usable sign-in instructions. // The connection panel polls this state until sign-in completes or fails. export type HarnessLoginState = | { state: 'starting' } | ({ state: 'pending' } & HarnessLogin) | { state: 'failed'; reason: string } export type WorkspaceIcon = | { type: 'emoji'; value: string; background?: 'theme' } | { type: 'glyph'; value: IdentityIconId; background?: 'theme' } | { type: 'upload'; value: string } // One connector's status, as surfaced by GET /api/workspaces/:id/mcp. // Includes standalone MCP servers and individual hosted apps. export type McpServerState = 'connected' | 'failed' | 'needs-auth' | 'pending' | 'disabled' export type McpServer = { name: string status: McpServerState displayName?: string iconUrl?: string } export type WorkspaceEntry = { id: string path: string addedAt: string type?: WorkspaceType // Display name captured at add time (e.g. OpenClaw IDENTITY.md "Name:" or // basename). Persisted so we don't re-probe the gateway for each listing. // The list endpoint overrides this with the live layout `name` when set. name?: string // Workspace icon override. Undefined uses the provider icon. icon?: WorkspaceIcon // Merged in from the layout so app-wide workspace lists can paint a themed // icon without inheriting the active workspace's color. theme?: WorkspaceTheme // Home-relative rendering of `path` (e.g. "~/.openclaw/workspace"). Set by // the server on the wire — clients render it as-is. displayPath?: string // OpenClaw-specific metadata captured at add time. "lastRunAt" is a snapshot, // not live — refresh on demand if it ever needs to stay accurate. agentId?: string isDefault?: boolean lastRunAt?: string } export type DiscoveredWorkspace = { path: string displayPath?: string // Deduplicated in canonical provider order; empty for folders without agent history. types: WorkspaceType[] } export type SessionRenamedMessage = { type: 'session_renamed' workspaceId: string from: string to: string } export type SessionsChangedMessage = { type: 'sessions_changed' workspaceId: string sessionId: string } export type SessionArchivedMessage = { type: 'session_archived' workspaceId: string sessionId: string } export type ErrorFrame = { kind: 'error' workspaceId: string sessionId: string content: string // A failed steer or interrupt leaves the current run active. Older senders // omit this field and retain terminal-error behavior. terminal?: boolean } export type StoppedFrame = { kind: 'stopped' workspaceId: string sessionId: string } // Unified per-session activity state, mirrored from each harness's native // lifecycle signal (CC `session_state_changed`, Codex `turn/*`, OpenClaw run // lifecycle) rather than derived by counting messages: // running — the agent is working; the client shows the loader/Stop // requires-action — waiting for user input; no loader/Stop. Input notices // provide the answer form independently of this state. // idle — everything else, including interrupted/failed turns export type SessionActivity = 'idle' | 'running' | 'requires-action' export type StatusMessage = { type: 'status' workspaceId: string sessionId: string activity: SessionActivity } // Workspace layout persistence export type LayoutGridItem = { i: string; x: number; y: number } // Persisted layout of the workspace panel: // fullscreen — full-width workspace with chat in a floating popup // split — workspace content with a docked chat sidebar on the right export type LayoutMode = 'fullscreen' | 'split' export type WorkspaceTabId = 'overview' | 'scratchpad' | `views/${string}` // Open tabs plus the workspace's saved DEFAULT tab. `active` is not live focus // state — the live active tab is each browser tab's URL (`/workspace/:id/`). // The saved default answers one question: where a bare `/workspace/:id` lands // (and which row `moi tabs` marks). Navigating writes it, so it tracks the last // tab switch, last writer wins across clients. export type WorkspaceTabsState = { open: WorkspaceTabId[] active: WorkspaceTabId } export type { AgentTheme, ColorTheme, FontTheme, RadiusTheme, WorkspaceTheme } from './themes' export type WorkspaceLayoutSave = Omit & { tabs?: WorkspaceTabsState // Captured when the edit is made, so delayed saves cannot restore another harness's defaults. harness?: WorkspaceType } export type WorkspaceLayout = { version: 1 widgetGrid: LayoutGridItem[] layoutMode: LayoutMode // Open tabs and active tab for the fullscreen/split workspace chrome. The // `open` order is persisted so future drag-reordering has one source of truth. tabs: WorkspaceTabsState // User-set display-name override. When empty/undefined the API falls back to // the workspace folder name, so the resolved name always comes from the API. name?: string // Workspace icon override. Emoji and glyphs may use a themed background. icon?: WorkspaceIcon // Model id chosen in the composer picker (`supportedModels()` `value`, an // alias like `sonnet`). Persisted so the choice survives a reload. Sent with // each chat frame; undefined means the agent runs on the SDK default. Note // the transcript records the *resolved* id (e.g. `claude-sonnet-4-6`), which // doesn't map back to these aliases — hence we persist the pick here. // // This (with `selectedEffort` and `selectedSpeedMode`) is the *workspace // default*: the value the picker edits when no session is open, and the seed a // brand-new session copies. Once a session exists it carries its own per-session // override (see `SessionConfig`). selectedModel?: string // Reasoning-effort default for new sessions (a `supportedEffortLevels` value). selectedEffort?: string // Speed default for new sessions. Undefined behaves as normal. selectedSpeedMode?: SpeedMode theme?: WorkspaceTheme } // GET /api/workspaces/:id: layout plus the local workspace registration. export type WorkspaceLayoutResponse = WorkspaceLayout & { cwd: string name: string provider?: WorkspaceType agentId?: string } // One applet's thumbnail freshness record. Image bytes live as files in the // workspace's `.moi/.cache/thumbnails/` (server/applets/thumbnails.ts), never in // `.workspace.json` — the layout file stays small and commit-safe. export type AppletThumbnail = { kind: AppletKind id: string revision: string capturedAt: string viewedAt: string // How long the last successful capture took on this client, in ms. Lets the // capture hook skip routine re-captures of applets that are slow to // screenshot (see SLOW_CAPTURE_MS) instead of janking the main thread. captureMs?: number } export type AppletThumbnailUpdate = { id: string revision: string // A string replaces the stored image, null records a failed or skipped // attempt (the previous image survives), undefined only touches recency. image?: string | null captureMs?: number } export type AppletThumbnailBatch = { kind: AppletKind thumbnails: AppletThumbnailUpdate[] } // Home-screen workspace card preview: widgets in grid order, then recent views, // capped to the loose stack's visible depth. A workspace with no captured // applets may instead carry its oldest session's first message. export type WorkspacePreview = { thumbnails: string[] firstUserMessage?: string updatedAt?: number theme?: WorkspaceLayout['theme'] } // One effective env var, as surfaced by GET /api/workspaces/:id/env. Values are // NEVER returned — the API masks both `.env` and custom secrets, so editing is // write-only. Presence in the list (with `source`) is all the UI needs. export type WorkspaceEnvVar = { key: string // `dotenv`: only from a `.env` file. `custom`: only a UI-managed secret. // `both`: a custom secret shadowing a `.env` value (custom wins). source: 'dotenv' | 'custom' | 'both' // The `.env` files that declare this key (when dotenv-sourced). files?: string[] } // GET /api/workspaces/:id/env payload — the env view for the settings UI. export type WorkspaceEnvView = { vars: WorkspaceEnvVar[] // Discovered `.env` files with how many keys each holds (values masked). files: { file: string; count: number }[] inheritDotenv: boolean // Where custom secrets are stored: the OS keychain (Bun.secrets) when // available, else a 0600 file fallback. Surfaced so the UI can warn. backend: 'keychain' | 'file' // Keys declared via widget `config.requiredEnv`, with whether they're visible // to widgets in the effective env and which widgets asked for them. required: { key: string; satisfied: boolean; widgets: string[] }[] } // Normalized capability flags shared across backends. An absent flag means // "unknown / not reported by this backend", not "unsupported". // A model a workspace's agent backend can run — the raw shape from the Claude // Agent SDK's supportedModels(), passed through as-is (server/agent.ts). OpenClaw // maps its catalog onto value/displayName. export type Model = { // Id used to select the model (Claude `value`; OpenClaw catalog id). value: string // Canonical wire model id this row resolves to (Claude, e.g. 'default' and // 'opus[1m]' both → 'claude-opus-4-8[1m]'; Hermes maps its structured ACP // default the same way). Lets the picker map a synthetic "default" entry // onto the concrete model it points at. resolvedModel?: string // Human-readable label (Claude `displayName`; OpenClaw `name`). displayName: string // One-line blurb (Claude: "Most efficient for everyday tasks"). Not shown by // the picker. Absent for OpenClaw. description?: string // Heading this model sits under in the picker (Hermes: the upstream provider, // e.g. 'Ollama'). Absent when the backend serves one flat catalog. group?: string // Machine id of that group (Hermes: 'ollama-launch' for the 'Ollama' heading). // Unlike `group`, the backend does not reword it — use it as the key whenever // a provider needs pinning, ordering or storing. providerId?: string // Effort/reasoning support (Claude). `supportedEffortLevels` can include values // the SDK under-types (e.g. 'xhigh'), so it stays string[]. supportsEffort?: boolean supportedEffortLevels?: string[] // Provider-resolved effort default when the user hasn't picked one (OpenClaw // `thinkingDefault`, which differs per model — `low`/`medium`/`off`). Must be // one of `supportedEffortLevels`. defaultEffort?: string supportsAdaptiveThinking?: boolean supportsFastMode?: boolean supportsUltrafastMode?: boolean supportsAutoMode?: boolean } // GET /api/workspaces/:id/harness. Model changes arrive on refetch; // `harness:updated` events refresh availability. export type WorkspaceHarness = { /** Credential overrides require workspace readiness instead of shared account status. */ hasAuthOverrides?: boolean isFolderMissing?: boolean // The harness that produced this snapshot — matches the workspace // provider. provider: WorkspaceType // Runtime presence and provider auth state, from the server-side cache. availability: HarnessAvailability models: Model[] // Whether this provider supports live token-by-token streaming (the picker // shows the "Live typing" toggle only when true). Provider-wide, not per-model // — Claude Code streams uniformly via `includePartialMessages`. supportsStreaming?: boolean // Whether the provider can archive chats from the chat selector. supportsArchiving?: boolean }