Replace the process-global os.chdir() with an in-memory dictionary
keyed by session ID (passed via X-Session-Id header). Multiple
concurrent chat sessions now maintain independent working directories.
- GET/POST /files/cwd read X-Session-Id to resolve per-session cwd
- POST /execute falls back to session cwd when no cwd param provided
- POST /api/terminals spawns PTY in the session's cwd
- 7-day sliding TTL for session entries
- Fully backward compatible: no header = fs.home default
- GET /system returns a structured system prompt grounding the LLM in
the environment (OS, hostname, user, shell, Python version) with
directives for tool usage
- Gated by OPEN_TERMINAL_ENABLE_SYSTEM_PROMPT env var (default: true)
- Advertised via features.system in GET /api/config for consumer discovery
- OPEN_TERMINAL_SYSTEM_PROMPT env var for full prompt override
- Endpoint excluded from OpenAPI schema, auth-protected
The _FILE mutual-exclusivity guard silently passed when the plain env
var was set to an empty string, because empty strings are falsy.
Python: changed `if value and file_path` to
`if value is not None and file_path is not None`, and the fallback
return from `value or default` to
`value if value is not None else default`.
entrypoint.sh: changed ${!var:-} to ${!var+set} to test whether the
variable is defined at all, not just non-empty.
entrypoint-slim.sh: changed -n tests to ${var+set} via eval, matching
the bash entrypoint semantics.
Add OPEN_TERMINAL_LOG_FLUSH_INTERVAL and OPEN_TERMINAL_LOG_FLUSH_BUFFER
env vars to control how frequently process output is flushed to disk.
Default 0 preserves existing per-chunk flush behaviour.
Setting FLUSH_INTERVAL=1 reduces fsyncs from ~250/sec to ~1/sec for
high-output commands, preventing I/O storms that can make ARM/eMMC
systems unresponsive.
- Centralize flush control in BoundedLogWriter
- Remove per-chunk flush() from PtyRunner, PipeRunner, WinPtyRunner
- Add explicit final flush before writing process end marker
- Bump version to 0.11.18
- Add log rotation: when a process log exceeds MAX_PROCESS_LOG_SIZE (default
50 MB), the oldest half is discarded and writing continues so the most
recent output is always available. Prevents unbounded memory growth that
caused ~26 GB OOM kills.
- Add tail-optimized log reads: _read_log with tail parameter now reads from
the end of the file instead of loading the entire file into memory.
- Add OPEN_TERMINAL_MAX_LOG_SIZE (default 50 MB) and
OPEN_TERMINAL_LOG_RETENTION (default 7 days) configuration.
- Use timestamp-prefixed process IDs (YYYYMMDD-HHMMSS-<random>) so log files
sort chronologically in the filesystem.
- Extract log management into utils/log.py to reduce main.py size.
When enabled, reads the X-User-Id header (set by the OWUI proxy),
provisions a per-user Linux account on first access (useradd -m),
and runs all commands, file operations, and terminal sessions as
that user via sudo -u. chmod 700 on home directories provides
kernel-enforced isolation between users.
New environment variables:
- OPEN_TERMINAL_MULTI_USER (default: false)
- OPEN_TERMINAL_USER_PREFIX (default: empty)
- OPEN_TERMINAL_UVICORN_LOOP (default: auto)
Closes#38
Multi-session Jupyter notebook execution via REST endpoints.
Each session gets its own kernel via nbclient.
Supports per-cell execution with rich outputs (images, HTML, LaTeX).
- POST /notebooks — create session (starts kernel)
- POST /notebooks/{id}/execute — execute cell
- GET /notebooks/{id} — session status
- DELETE /notebooks/{id} — stop kernel
nbclient and ipykernel are now core dependencies.
OPEN_TERMINAL_ENABLE_NOTEBOOKS env var to enable/disable.
Bump version 0.9.3 → 0.10.0
When OPEN_TERMINAL_EXECUTE_TIMEOUT is set (env var or execute_timeout
in config.toml), the execute and get_process_status endpoints will use
it as the default wait time when the caller omits the wait parameter.
This helps smaller LLM models get command output inline without needing
to call get_process_status separately.
Closes#17
Terminal sessions now set the TERM environment variable (default
xterm-256color) so programs emit ANSI color codes. Configurable via
OPEN_TERMINAL_TERM environment variable or 'term' in config.toml.
- Add OPEN_TERMINAL_ENABLE_TERMINAL env var / enable_terminal config
option to enable/disable the interactive terminal (default: true)
- Add GET /api/config endpoint for client-side feature discovery
- When disabled, all /api/terminals routes and WebSocket endpoint
are not mounted
- Bump version to 0.8.1
- Close leaked PTY file descriptors when subprocess creation fails
- Return 503 with descriptive message when PTY devices are exhausted
- Add MAX_TERMINAL_SESSIONS (default 16, env OPEN_TERMINAL_MAX_SESSIONS)
- Prune dead sessions before checking the session limit
- Bump version to 0.7.2
Load settings from /etc/open-terminal/config.toml (system) and
$XDG_CONFIG_HOME/open-terminal/config.toml (user). Supports host, port,
api_key, cors_allowed_origins, log_dir, and binary_mime_prefixes.
CLI flags and environment variables still take precedence. A --config
flag allows pointing to a custom config file.
Closes#11
Change the default LOG_DIR from ~/.open-terminal/logs to
$XDG_STATE_HOME/open-terminal/logs (defaults to
~/.local/state/open-terminal/logs when XDG_STATE_HOME is unset).
The OPEN_TERMINAL_LOG_DIR env var override is unchanged.
Closes#12
Allow loading the API key from a file via OPEN_TERMINAL_API_KEY_FILE,
following the convention used by the official PostgreSQL Docker image.
- Add _resolve_file_env() helper in env.py
- Add file_env shell function in entrypoint.sh
- Add _FILE fallback in cli.py run command
- Update README with Docker Compose example
- Bump version to 0.4.3
Closes#14
- Text files: return JSON with content string (unchanged)
- Supported binary types (image/* by default): return raw binary
with proper Content-Type header
- Unsupported binary types: 415 error
- New env var OPEN_TERMINAL_BINARY_MIME_PREFIXES (comma-separated,
default: 'image') controls which binary types are allowed
- Persist all process stdout/stderr to JSONL log files for audit
- Add offset-based polling (next_offset) for stateless incremental reads
- Add tail parameter to bound response size for AI agents
- Remove in-memory output buffer and drain-on-read pattern
- Organize logs under ~/.open-terminal/logs/processes/
- Add aiofiles dependency for async file I/O
- Remove OPEN_TERMINAL_MAX_OUTPUT_LINES (no longer needed)