SNA

Core Configuration

Configuration helpers and environment variables exposed by `@sna-sdk/core`.

Core Configuration

getConfig, setConfig, and resetConfig let applications inspect or override runtime configuration. Environment variables remain the easiest way to configure hosted processes.

Configuration is resolved in this order:

PrioritySourceNotes
1SDK defaultsDefined in packages/core/src/config.ts.
2SNA_* environment variablesUseful for standalone server processes and Electron launchers.
3setConfig(partial)Applies to the current Node process. In-process launchers use this path.
4Per-call parametersRoute handlers and runtime calls can still override specific fields.
VariableMeaning
SNA_PORTPreferred server port. Defaults to 3099.
SNA_MODELDefault model name. Defaults to claude-sonnet-4-6.
SNA_PERMISSION_MODEDefault permission mode. Supports default, acceptEdits, bypassPermissions, and plan.
SNA_MAX_SESSIONSMaximum concurrent sessions. Defaults to 5.
SNA_DB_PATHExplicit SQLite database path. Defaults to data/sna.db.
SNA_DATA_DIRDirectory for SNA data such as images. Defaults to <cwd>/data.
SNA_PERMISSION_TIMEOUT_MSPermission prompt timeout in milliseconds. 0 means the app is responsible for responding.

Default values

FieldDefaultDescription
port3099HTTP server port used by the standalone server and browser discovery.
modelclaude-sonnet-4-6Default model passed to runtime adapters when a call does not specify one.
defaultProviderclaude-codeDefault runtime id used by routes and helpers unless overridden.
defaultPermissionModedefaultBaseline permission policy for agent operations.
maxSessions5Maximum number of concurrent server-side sessions.
maxEventBuffer500In-memory event buffer size per session.
permissionTimeoutMs0Permission prompts do not auto-deny unless the host opts in.
runOnceTimeoutMs120000Default one-shot execution timeout.
pollIntervalMs500SSE polling interval for agent events.
keepaliveIntervalMs15000SSE keepalive interval.
skillPollMs2000WebSocket skill event poll interval.
dbPathdata/sna.dbSQLite database path when no environment override is set.
dataDir<cwd>/dataBase directory for non-row assets.

Function reference

getConfig()

Returns the effective SNA configuration after defaults, environment variables, and runtime overrides are applied.

Use it for diagnostics, server startup logging, and host settings screens that need to display the active value rather than only the saved preference.

setConfig(partial)

Applies runtime overrides for the current process. Use it in embedded hosts that receive settings from an application preferences screen, IPC message, or test fixture.

setConfig merges the provided fields into the current config. It does not clear previous overrides; call resetConfig() first if the caller needs a clean baseline.

resetConfig()

Clears runtime overrides and returns configuration resolution to defaults plus environment variables. Use it in tests to avoid leaking configuration between cases.

SnaConfig

The typed shape of SNA configuration. Prefer this type when building host-level settings UIs or validating configuration objects.

langfuse and apiProxyPort are optional. They are only active when the host explicitly configures tracing or debug proxy capture.

On this page