// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { CoderMcpWorkspaceConfig } from "./CoderMcpWorkspaceConfig";
import type { FolderSession } from "./FolderSession";
import type { ForwardedPort } from "./ForwardedPort";
import type { PersistedTerminal } from "./PersistedTerminal";

/**
 * Persisted UI session for one workspace. Holds one
 * [`FolderSession`] per bound folder, plus a pointer to which folder
 * was active at last save. Lives at
 * `<workspaces_dir>/<id>/session.json` from Phase 7.5 onward —
 * previously it was `AppState.last_session` in the global
 * `state.json`, and the IDE wipes that legacy slot on first run.
 */
export type WorkspaceSession = { 
/**
 * Folders bound into the workspace, in insertion order — same
 * order the folder bars render in.
 */
folders: Array<FolderSession>, 
/**
 * Absolute path of the active folder, if any. Must match one of
 * `folders[].folder_path` when set.
 */
active_folder_path: string | null, 
/**
 * Per-workspace lock on the coder's active provider. When set,
 * the runner ignores
 * [`crate::app_state::CoderAppState::active_provider`] for
 * this workspace and uses the locked value — so toggling the
 * global default from another workspace's modal doesn't bleed
 * into a workspace the user pinned. `None` (the default) means
 * "follow the global active_provider, just like before".
 *
 * This is per-workspace because a single user often runs
 * different repos against different providers (e.g. one repo
 * always against Anthropic for cache-friendliness, another
 * happily flipping between HF and OpenRouter). Storing the
 * lock here rather than in `AppState` keeps the global default
 * genuinely global while letting individual workspaces opt out.
 */
coder_provider_lock?: CoderProviderLock | null, 
/**
 * User-declared host-to-dev port forwards. Each entry is
 * served by the workspace's proxy sidecar
 * (`moon-ws-<id>-ports-1`); the sidecar is recreated
 * whenever this list changes — the dev container itself
 * stays untouched, so terminals + any in-flight
 * `bun dev` survive port edits.
 *
 * Empty list = no sidecar running. Persisted in
 * `session.json` so the user's per-workspace mappings
 * (workspace A: `3000 -> 3000`; workspace B:
 * `3001 -> 3000`) survive restarts and don't fight over
 * the host's port space across workspaces. See
 * [`crate::ports`] for the wire shape.
 */
forwarded_ports?: Array<ForwardedPort>, 
/**
 * HF Hub bucket bound to this workspace, if any. When set,
 * the runner pushes session JSONLs to the bucket on
 * `TurnEnded` (autosync) or on the user's explicit "Upload"
 * click (manual). See [`crate::coder_hub`] for the
 * destination shape (`<namespace>/<name>` on the Hub) and
 * the per-session `uploaded` cache. `None` (the default)
 * means "no Hub binding; sessions stay local".
 */
coder_hub_bucket?: CoderHubBucket | null, 
/**
 * Per-workspace MCP server state: which servers (preset or
 * custom) are enabled here, plus any user-defined custom
 * servers. Backend-managed like the other coder fields —
 * `session_save`'s merge keeps the on-disk value through
 * frontend persist ticks; the `coder_mcp_*` commands are the
 * only writers. See [`crate::coder_mcp`].
 */
coder_mcp?: CoderMcpWorkspaceConfig, 
/**
 * Per-folder "this folder's `docker-compose.yml` project was
 * `Running` when the IDE quit last time" map, keyed by the
 * folder's absolute path. `shutdown::stop_all` populates
 * this immediately before issuing `docker compose stop` for
 * each folder; on next launch,
 * `shutdown::auto_resume_project_composes` reads it and
 * brings the marked folders back up with `compose up -d`.
 *
 * Cleared (for a folder) by Stop / Down clicks in the UI so
 * quitting from a deliberately-stopped state doesn't
 * auto-resurrect the project. Backend-managed: the
 * `session_save` merge in `commands::session` keeps the
 * on-disk value through frontend persist ticks. A missing
 * entry, or `false`, means "don't auto-start"; that's also
 * what happens after a corrupt-session fallback, which is
 * the right safe default.
 */
compose_auto_resume?: { [key in string]: boolean }, 
/**
 * Terminal tabs to re-spawn on next launch, in tab order.
 * Each entry is a *recipe* — target, owning folder, and the
 * shell-history line the terminal last ran — not a live PTY
 * (the process dies with the IDE). The frontend snapshots
 * this on every persist tick and replays it on launch by
 * spawning fresh shells with each command prefilled.
 *
 * Per-workspace by necessity: a `container` terminal names
 * this workspace's `moon-ws-<id>-dev-1` and each `folder`
 * belongs to this workspace's bound set. Keeping the list
 * in `session.json` (not the machine-global `state.json`)
 * is what stops workspace A's terminals from leaking into
 * workspace B. See [ADR
 * 0050](../../specs/decisions/0050-terminal-persistence-and-restart.md).
 */
terminals?: Array<PersistedTerminal>, };
