Commit Graph

280 Commits

Author SHA1 Message Date
alan c2b992542b Tell the next stage what failed when an error edge leads onward
A failed visit was recorded on its step only, so a landing gate that sent
the run back to implement gave the implementer nothing about which checks
failed. The diagnostic (bounded) is now the next stage's previous output
and a memory entry.
2026-11-11 00:39:36 +00:00
alan 532ba48927 Run every pipeline run in its own worktree
A fresh run started from a repository's main checkout gets its own
worktree and branch next to the repository, so runs never share a tree
or see the operator's uncommitted work, and several can run at once.
Retries and runs started in a linked worktree keep their directory. A
clean, landed run tree is removed after success; anything else is kept.

The delivery gate commits what the land stage left uncommitted in a run
worktree, and no longer requires the operator's main checkout to be
clean: Git's fast-forward refuses safely when a local change conflicts.
2026-11-10 16:06:40 +00:00
alan 1ad85de1f1 Keep step-up elevation for the signed-in session and stop gating terminals
The proxy forwards an HMAC-derived session id (X-Pipelines-Session) on
/connect and POST /files; the server trusts it only on token-authenticated
requests and keys elevation by it, so reconnects stay elevated up to a 24 h
cap. Terminals rely on their su -l login. The app no longer forgets the
elevation on disconnect and asks again only on a fresh refusal.
2026-11-10 03:00:45 +00:00
alan 50535dc5ea Merge branch 'worktree-agent-a7f96a1eb9a56587d'
# Conflicts:
#	cmd/pipelines-server/main.go
#	internal/server/websocket.go
#	scripts/manage.py
#	scripts/setup-native.py
#	web/serve.mjs
#	web/src/peerRelay.js
2026-11-10 01:25:04 +00:00
alan f11ff8650d Require step-up password confirmation for shells, terminals and file changes
A new elevate request verifies the web sign-in password (scrypt hash, read-only,
rate-limited, constant time) and elevates that connection for 15 minutes.
chat_shell_run/input, rename/move/delete, terminal_open/input and POST /files
(via a per-connection upload token) are refused with code elevation_required
until then.
2026-11-10 01:21:15 +00:00
alan 41e9b10c9d Merge branch 'worktree-agent-a37f45fa108430592'
# Conflicts:
#	internal/server/websocket.go
2026-11-10 01:00:49 +00:00
alan 84f7e33872 Guard the Go server's request boundary: loopback Host, no Origin on /connect, shared token
The server answered any Host, so a DNS-rebinding page reached /connect (101)
and could drive terminals. Every route now refuses a non-loopback Host on a
loopback connection (421), /connect refuses any Origin (403), and a server
started with -token-file requires X-Pipelines-Token (401; /mcp and /healthz
exempt). The CLI/TUI send the token only to loopback URLs.
2026-11-10 00:59:39 +00:00
alan ec5c690bea Split the terminal lifetime tests from the login tests 2026-11-10 00:45:39 +00:00
alan 227c036aa5 Start machine terminals at the su login prompt instead of tmux
A new terminal runs su -l for the server's own account in its PTY, so the
operator types the account password before getting a shell. Opening is
refused when su is missing, the server runs as root, or su opens a shell
without asking. The Pipelines-owned tmux backing, its reattach and its
persisted session names are removed: terminals end with the server and
are listed as ended. A starting server ends leftover pipelines-term_*
sessions on tmux -L pipelines only.
2026-11-10 00:37:11 +00:00
alan f2520a09b8 Keep dismissed shell commands and restore them without a time limit
A dismissed run keeps its command, status, times and output within the
usual history bounds. chat_shell_runs lists dismissed runs apart
(chat_shell_dismissed_runs), chat_shell_run_output still reads them, and
the purge timer and startup purge are gone. Rows an older server purged
are listed with purged set and cannot be restored.
2026-11-09 23:29:25 +00:00
alan 9bbd9e0c9b Merge branch 'worktree-agent-a2791c24c562412e3'
# Conflicts:
#	app/lib/features/chat/conversation/chat_thread_view.dart
#	internal/protocol/message.go
2026-11-09 22:07:45 +00:00
alan acd160b49e Add the app's terminal surface: bottom panel, floating window and full-screen page 2026-11-09 21:42:52 +00:00
alan a5842e6b3b Format terminal manager 2026-11-09 21:30:23 +00:00
alan 277384c864 Add persistent machine terminals with tmux-backed reattach 2026-11-09 21:30:15 +00:00
alan 03123c23fd Dismiss and restore operator shell commands per chat
chat_shell_dismiss hides finished runs from every readback and pushes a
dismissal frame to every watcher; chat_shell_restore undoes it within a
30 s window, after which the command, output and error are purged and only
a tombstone remains, reported by chat_shell_runs for clients that missed
the event.
2026-11-09 21:22:07 +00:00
alan 8f06f12d49 Merge branch 'worktree-agent-a26df8b0059ab1b12' 2026-11-09 20:54:12 +00:00
alan 2332143e5b Fit chat terminals to their output, keep pastes and keys in the terminal
Finished terminals are sized synchronously from their rows at the view's
width (the post-frame fit made the transcript re-anchor forever); blank rows
xterm.dart keeps when rewrapping are dropped; desktop typing uses key events;
the composer leaves Cmd/Ctrl-V to a focused terminal; Ctrl-A reaches the
process. The probe fixture gains coloured terminal runs and an interactive
login. Notes record behaviour, protocol, security and verification.
2026-11-09 20:51:59 +00:00
alan 06001697c8 Add per-chat thinking levels for Codex, Claude Code and OpenCode
Codex: model/list supportedReasoningEfforts per model, turn/start effort,
thread reasoningEffort as the current level. Claude Code: initialize
supportedEffortLevels, apply_flag_settings effortLevel at the next turn
start. OpenCode v2: model variants via the session model endpoint.
chat_effort sets a level; rows and chat_models carry the levels; Codex and
Claude levels persist in operator_sessions.chat_effort and are re-applied
before every turn.
2026-11-09 20:07:41 +00:00
alan 355b722a1d Run chat shell commands in a pseudo-terminal with typed input and resize
Commands start in a PTY (creack/pty; macOS and Linux) of the client's size
with TERM=xterm-256color in their own session. chat_shell_input writes typed
UTF-8 text in order through a bounded queue; chat_shell_resize sets the size.
Output stays the raw terminal stream with byte offsets as sequence numbers,
chat_shell_run_output resumes from an offset, and a plain-text rendering is
persisted for Copy output and Send to agent. Input is never stored or logged.
2026-11-09 19:57:46 +00:00
alan 96b71d122e Merge branch 'worktree-agent-aae8756320b8309f6'
# Conflicts:
#	app/lib/features/chat/conversation/chat_thread_view.dart
#	app/tool/perf/perf_fixture.dart
#	internal/protocol/message.go
#	internal/server/chat_hub.go
2026-11-09 16:56:55 +00:00
alan f3ddd3e1ec Attribute OpenCode code-mode tool calls, keep same-instant shown items in order, and record the chat tools notes 2026-11-09 16:55:28 +00:00
alan 9791f09230 Serve the Pipelines chat tools over a loopback MCP endpoint and register it with Claude Code, Codex and OpenCode chats 2026-11-09 16:34:21 +00:00
alan 7841aa7dea Merge branch 'worktree-agent-a672970b929d7358c'
# Conflicts:
#	internal/pipeline/store.go
#	internal/server/chat_hub.go
2026-11-09 16:21:55 +00:00
alan 0696ab849a Record each chat turn's workspace changes for every harness
Snapshot the chat directory with internal/filediff when a turn starts and
compare it when the turn ends; store changed turns (newest 100 per chat),
push chat_turn_diffs summaries, attach them to chat_messages replies and
serve one turn's patches through chat_turn_diff.
2026-11-09 16:08:35 +00:00
alan e6bc57c901 Run operator shell commands in a chat's directory on the server
chat_shell_run starts $SHELL -lc in the chat session's directory in its own
process group, streams merged output to every watcher of the session, keeps a
1 MiB tail and persists each run; chat_shell_stop interrupts the group and
kills it after a grace period. chat_shell_share queues an ordinary prompt
with the command and a bounded output tail.
2026-11-09 15:55:14 +00:00
alan c61490aeb0 Add rename_path, move_path and delete_path for home files
The chat Files panel needs to rename, move and delete entries. Three
websocket requests, dispatched beside list_directory, operate on one
entry inside the operator's home and reply with path_mutated {path} or
an error frame (does not exist, already exists, is not empty, outside
the home directory, cannot be moved into itself).

The entry's parent folder and the move destination are resolved through
symlinks and must stay inside home; the entry's own symlink is never
followed, so a link is renamed, moved or removed as a link. The home
directory itself, anything outside it and pseudo filesystems are
refused. A folder is deleted only when empty unless recursive is set;
os.RemoveAll unlinks symlinks rather than descending into them.
2026-11-09 01:32:31 +00:00
alan 49f36a9456 Merge branch 'worktree-agent-ab6edc0d99947642f' 2026-11-09 00:11:40 +00:00
alan 929e4cc017 Advertise tailnet and public routes in server discovery
The mDNS record now carries ts= (tailnet IPv4 addresses) and public= (the
installer's HTTPS origin from PIPELINES_WEB_PUBLIC_URL) in TXT, and browse,
the discover_servers RPC and /discovery return every route to a machine as
addresses with kinds lan, tailscale and public. Endpoint stays the LAN route
for older clients. Unsafe ts/public values are dropped.
2026-11-08 23:59:19 +00:00
alan 81460c4a4d Add POST /files to store an uploaded file inside a home folder
The handler reuses the home-path resolution of GET /files, refuses special
filesystems and non-directories, writes with O_EXCL so an existing name is
answered 409 instead of overwritten, enforces the chat upload size limit and
replies with the stored name, path and size.
2026-11-08 23:57:53 +00:00
alan 349428f11d Discover LAN servers and relay authenticated browser peer connections 2026-11-08 21:58:23 +00:00
alan 9d3358be47 Expose session-owned chat automation metadata 2026-11-08 15:24:23 +00:00
alan 6699d10eb8 Retry initial recovered chat stream attachment failures 2026-11-07 16:43:24 +00:00
alan 62406f7fdb Hold external chat admission until live turn recovery completes 2026-11-07 16:41:02 +00:00
alan 132a94192a Recover background chat observers from durable live membership 2026-11-07 16:33:49 +00:00
alan 23cbcfc091 Merge branch 'ws-delivery' 2026-11-07 01:42:55 +00:00
alan 1a0f999fb1 Show prompts delivered into the running reply distinctly 2026-11-07 01:42:48 +00:00
alan dbf6398231 Correct CPU core counts and report incomplete data size scans 2026-11-07 01:38:59 +00:00
alan 95849f636a Add server stats websocket reporting 2026-11-07 01:35:39 +00:00
alan 46627c7204 Merge branch 'ws-files-http' 2026-11-07 00:54:53 +00:00
alan c4ccbb3f95 Add file size and modified time to directory listings 2026-11-07 00:54:36 +00:00
alan bfe89432bb Add contained home file endpoint 2026-11-07 00:53:15 +00:00
alan 0f49b31ca3 Clarify managed session storage and excluded native histories 2026-11-06 21:40:42 +00:00
alan 6abc309009 Expose storage usage and safe persisted age or size retention 2026-11-06 21:34:55 +00:00
alan aa19c82156 Protect containing worktrees from deleting nested checkouts 2026-11-06 21:29:51 +00:00
alan 18eec34f56 Measure server data and registered worktree storage safely 2026-11-06 21:27:11 +00:00
alan 6421554bfe Expose recorded background task timing and progress metadata 2026-11-06 15:08:34 +00:00
alan af178b83a1 Show recorded OpenCode models in the chat list 2026-11-05 13:42:01 +00:00
alan f5bf8ada8a Merge: archive and unarchive pipelines
# Conflicts:
#	internal/cli/commands.go
#	internal/pipeline/store.go
2026-11-04 23:39:02 +00:00
alan 06bf580154 Archive pipelines: hide unused ones while keeping their history
archived_at on pipelines (migrated in place). archive_pipeline and
unarchive_pipeline by id or name with an expected-version guard;
list_pipelines hides archived unless include_archived. Archived
pipelines refuse runs, retries, new versions and name reuse, and
cannot be archived while an enabled schedule points at them.
CLI archive/unarchive and list --archived/--all, docs and skill note.
2026-11-04 23:25:55 +00:00
alan cedfc22e45 Pipeline runs use the workspace's directory environment
Resolve the run workspace's environment with workenv (direnv, parent
.envrc, mise; same account rule as Claude chats) at run start and resume,
and apply it to Pi stage processes, a per-environment Pipelines-owned
OpenCode stage service (keyed by a hash of the change, reused across runs,
idle ones stopped after PIPELINES_OPENCODE_STAGE_IDLE_TIMEOUT, revived per
registration), delivery-gate checks and merges, plain-stage opencode CLI
calls and file-change capture git reads. Record the directory, .envrc
files, sources and variable names (never values) on the run detail; a
blocked .envrc becomes a run warning.
2026-11-04 18:08:42 +00:00