/** * Lifecycle state of an agent session. * * Transitions follow the state machine: `starting → idle ↔ active ↔ waiting → stopped`. * * @docLink packages/sdk/concepts#core-types */ export type SessionState = "starting" | "idle" | "active" | "waiting" | "stopped"; /** * A single rendered line of session output. * * Discriminated union so UI layers (ink, HTML, plain text) handle each case explicitly. * Text content accumulates in-place during streaming; a new `text` line is opened for * each agent response turn and sealed when the next non-text event arrives. * * @docLink packages/sdk/concepts#core-types */ export type OutputLine = { type: "user"; content: string; } | { type: "text"; content: string; } | { type: "tool"; name: string; } | { type: "question"; text: string; } | { type: "error"; message: string; } | { type: "status"; phase: string; } | { type: "system"; message: string; } | { type: "subagent"; name: string; status: "started" | "finished"; description: string; } | { type: "separator"; }; /** * How the agent process is hosted. * * Use `{ type: "local" }` (default) to run the agent in-process via `LocalRuntime`. * Use `{ type: "remote"; url: string }` to connect to a pre-running agent over WebSocket. * * @docLink packages/sdk/concepts#core-types */ export type SessionMode = { type: "local"; } | { type: "remote"; url: string; }; /** * Options for {@link createAgentSession}. * * Controls workspace directory selection, inline agent configuration, mount and connector * declarations, the initial prompt, and whether to run the agent in-process or via WebSocket. * * @docLink packages/sdk/concepts#create-agent-session-options */ export interface CreateAgentSessionOptions { /** * Path to an existing directory to use as the agent working directory. * If omitted, a temp directory is created under /tmp/skaile-sdk/ * and deleted when the session stops (unless keepWorkspace is true). */ workspaceDir?: string; /** * Inline agent configuration — serialised to skaile.yaml in the workspace dir. * If workspaceDir already contains a skaile.yaml, this is merged on top. */ agent?: { driver?: string; model?: string; provider?: string; maxTurns?: number; permissionMode?: "auto" | "interactive"; }; /** Mount declarations written to skaile.yaml (filesystem-mounted resources). */ mounts?: MountConfig[]; /** Connector declarations written to skaile.yaml (tool-accessed backends). */ connectors?: ConnectorConfig[]; /** Path to SOUL.md / RULES.md directory. Passed to startAgentServer(). */ agentDir?: string; /** Initial prompt sent immediately after startup. */ initialPrompt?: string; /** How to run the agent. Defaults to "local". */ mode?: SessionMode; /** * When true, a temp workspace directory is not deleted on session stop. * No effect when workspaceDir is an existing directory. */ keepWorkspace?: boolean; } /** * Mount declaration for skaile.yaml (filesystem-mounted resources). * * Mounts attach external storage (local directories, git repos, S3 buckets, etc.) to a * workspace-relative path so the agent can read or write files from that source. * * @docLink packages/sdk/concepts#create-agent-session-options */ export interface MountConfig { id: string; /** Mount driver: "local", "git", "s3", "webdav", "sharepoint". */ driver: string; /** What to mount: URL, bucket path, host filesystem path. */ source: string; /** Workspace-relative mount point (default: .mounts/). */ target?: string; access?: "read-only" | "read-write"; auth?: string; options?: Record; } /** * Connector declaration for skaile.yaml (tool-accessed backends). * * Connectors expose tool-accessible backends (databases, caches, state stores, etc.) to * the agent. Unlike mounts, they do not occupy a filesystem path — the agent interacts * with them via generated tools. * * @docLink packages/sdk/concepts#create-agent-session-options */ export interface ConnectorConfig { id: string; /** Connector adapter: "postgres", "redis", "sqlite", "memory", "xstate", "xstate-store", "yjs", etc. */ adapter: string; access?: "read-only" | "read-write"; auth?: string; options?: Record; } //# sourceMappingURL=types.d.ts.map