Commit Graph

250 Commits

Author SHA1 Message Date
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
alan c83fb5406c Test: read the phone's clear and ack frames in either order 2026-11-04 17:47:17 +00:00
alan 57f5219628 Artifacts: runner-internal turn files move to a Debugging files group
Each recorded artifact now carries a server group (deliverable or debug).
public/ files are deliverables; input/memory/history/output.md, session
exports and private/ scratch are debugging files. The app's Artifacts tab
lists deliverables and the Debug toggle reveals a separate Debugging files
group (older servers fall back to the filename rule); the TUI lists
deliverables first and marks debug rows; artifact search excludes debug
files unless include_debug / --debug-files is set.
2026-11-04 17:43:47 +00:00
alan 70391b17c2 Stage diffs: clean Git files take their baseline from the index blob
On a large Git workspace the 32 MiB retained-text budget was spent
alphabetically on files that never change, so small late edits were
recorded with no_patch. The stage-start snapshot now keeps text only for
files dirty or untracked at start; a clean tracked file keeps its hash and
stage-0 index blob id. When it changes or is deleted, the after capture
reads that blob in one `git cat-file --batch` and uses it only if its
SHA-256 matches the start read, so stage commits/resets do not move the
baseline and filters or assume-unchanged never yield a wrong patch. The
after capture shares unchanged files' representation instead of spending
budget on them again.

FileChange gains no_patch_reason (binary, file_size, budget, lines,
evidence_size, git_status, baseline). Non-Git workspaces keep their
behaviour.
2026-11-04 17:08:01 +00:00
alan a627b38ef3 Merge main; use the shared chatShutdownDetacher for OpenCode and Codex
OpenCode and Codex chats implement Detach (called by chatManager.Close)
instead of a parallel DetachSessions interface. Docs follow the Claude Code
host and the systemd KillMode=process unit. The opt-in live restart check
copies only the stage provider's login row into its scratch OpenCode
database, builds the CLI for skill install and removes its scratch tree.
2026-11-04 16:24:17 +00:00
alan aa8eddd686 Keep OpenCode/Codex chat and stage sessions running across server restarts
A stopping server no longer interrupts harness sessions. Runs are canceled
with a shutdown cause, so stage clients leave admitted sessions running and
owned; start-up recovery re-adopts live OpenCode V2 stage sessions (wait,
read back the result, continue the graph), restarts unadmitted visits,
continues runs between stages, and falls back to interrupted with a reason
when the harness is gone. Chats with live work are recorded on shutdown and
reattached on start; turns that ended during the downtime are folded in
from history. The server-spawned V2 chat serve is now a detached owned
service. PIPELINES_SHUTDOWN_SESSIONS=stop restores the old behaviour.
2026-11-04 16:17:08 +00:00
alan 6b22389cae Merge: Claude Code chats survive server restarts via a detachable host 2026-11-04 16:15:06 +00:00
alan c810437aa5 Claude Code chats survive server restarts in a detachable host
A pipelines-claude-host process owns each claude -p CLI and its pipes,
spools its stream-json output with offsets and serves a private Unix
socket. The server detaches on shutdown and reattaches on start,
replaying the spool to rebuild turns, approvals, questions, background
tasks and the live model. Explicit close, idle release and CLI exit stop
the host; a crashed host falls back to --resume with a notice.
2026-11-04 16:09:56 +00:00
alan 9351cd7d74 Merge: pipeline stages run on their own OpenCode service with stage-only limits 2026-11-04 14:12:38 +00:00
alan b655278674 Run OpenCode stages on a Pipelines-owned stage service with their own limits
Stages now run on a detached Pipelines-owned opencode serve started with
OPENCODE_CONFIG_CONTENT carrying stage tool_output (16384 bytes / 400 lines)
and compaction.auto defaults, configurable through PIPELINES_OPENCODE_STAGE_*.
Chats keep their existing service and configuration; a server-spawned chat
serve can take PIPELINES_OPENCODE_CHAT_CONFIG. The service shares the user's
OpenCode config, credentials and session database, keeps a stable private
registration so retained references (recovery, interrupt, export) stay valid,
revives on the same port after a crash, replaces itself when idle after a
settings change, and is stopped on shutdown only when idle.
PIPELINES_OPENCODE_STAGE_SERVICE=shared restores the previous behaviour.
2026-11-04 14:04:35 +00:00
alan 3c31bca87f Merge main; align lint and skill practices with essential memory/history and the four graded examples 2026-11-04 13:08:47 +00:00
alan 37e941bbba Authoring lint: required checks, undeclared outcomes, delivery claims, loop limits, silent guards, boilerplate 2026-11-04 13:04:11 +00:00
alan d7e54f4612 Merge: short essential memory per stage; full history on demand 2026-11-04 13:01:16 +00:00
alan 538143554c Split stage memory into capped essential memory.md and full history.md
Every stage used to be told to read memory.md, the full output of every
earlier turn (19 KB average, 92 KB max), and paid for it on each model call.
memory.md is now essential memory, hard-capped at 4 KB and inlined in the
prompt: the task, the previous stage's # handoff section (or its truncated
output head), a one-line-per-stage outcome ledger and the server-captured
changed files. history.md keeps the old full memory on disk; read-capable
stages are pointed at it and input.md for on-demand detail, and it is never
inlined. The prompt asks each stage for a short # handoff section.
2026-11-04 13:00:48 +00:00
alan e5c015f6ed Merge: no UI-review auto-skip without complete change capture; capture lists over-budget changes
# Conflicts:
#	internal/protocol/runs.go
2026-11-04 12:58:45 +00:00
alan f16d61cdfa Skip fallback needs complete, empty evidence; capture lists over-budget changes
The server skip fallback for stages with a skipped edge now applies only
when every earlier visit recorded a complete file-change capture with no
changed files and no image artifact. Any change (no repo-specific UI path
or extension list), any partial/unavailable/missing capture, a human
decision or a checkpoint-retry prefix runs the model. auto_skip=false opts
a stage out. The fallback verdict names the server fallback.

Capture compares over-budget text by hash and, in Git, lists paths it
could not compare when their git status changes, marked no_patch, so a
large workspace no longer records files: [] for a real edit. Run detail
gains a warnings list for partial/unavailable captures, also printed by
inspect on stderr.
2026-11-04 12:56:40 +00:00
alan e727c3fd07 Merge main into run token usage branch 2026-11-03 22:21:38 +00:00
alan 3227d61caf Token usage: keep cache/reasoning split, count only recorded steps, cost only when positive; captures fixture, docs and notes 2026-11-03 22:16:49 +00:00
alan 8c7093d1e6 Merge: chat list shows running turns and background tasks for every chat 2026-11-03 19:54:35 +00:00
alan 45c933c176 Chat list: spinner and background-task badge from server activity on every row
The list applies chat_activity pushes and each row's activity by seq, so
every listed chat shows a running turn, not only the chat open here. An
idle chat with running background tasks wears a quiet badge with tooltip and
semantics "Background tasks running (N)". Older servers keep the old
behaviour. List rows that never changed carry the server's current seq so
they order after snapshots kept from an earlier server process.
2026-11-03 19:53:52 +00:00
alan 1b98877d88 Chat list activity: turn running and background tasks on every row, pushed to every connection
chat_sessions rows carry activity (turn_running, background_tasks, seq) from
the hub's own state, and chat_activity is pushed to every connection when a
session's turn starts or ends or its running background-task count changes.
A room whose last viewer left stays observed while background tasks run,
bounded by the unattended limits; a Claude Code process exit ends its tasks.
2026-11-03 19:45:43 +00:00
alan a48e4a5b6a Replace starters with four graded examples seeded into new databases
The template catalog is now Example 1-4: one stage, two stages (handoff),
feedback loop (runner-owned limits, retries, timeout) and human decision
(type=human approve/revise/abort with notify hooks). All read-only or leave
changes uncommitted; none commits, pushes or deploys.

A brand-new database (schema created by this Open) gets the examples once at
server start, bound to the configured default model and harness. A
server_settings marker records the decision, so removed examples never come
back and existing installs are marked without any pipeline being added or
rewritten.
2026-11-03 19:35:47 +00:00
alan ad4233f7b8 Chat: /new continues the same chat on a fresh session
The composer's /new used to create a separate chat. It now sends
chat_new_session. The server starts a fresh native session on the chat's
own harness (OpenCode, Codex or Claude Code) and re-keys the
operator_sessions row in one transaction. The chat keeps its title,
directory, backend, colour, star, model and mode. The old row is kept
unlisted with replaced_by, and its native session stays resumable.

The reply and the chat_session_changed push carry previous_id, so every
client swaps the row in place and an open conversation follows it to the
fresh, empty transcript with a notice.
2026-11-03 14:06:44 +00:00
alan 6ca415c134 Search: order results newest first in every group
Chat hits sort by the chat's last use whatever field matched, and run,
step, field, artifact and pipeline hits sort by their own date, before
the result cap applies so the cap drops the oldest. Each kind's row scan
also walks newest first. Score still reports the match tier. The app
sorts both groups newest first as well.
2026-11-03 13:35:27 +00:00
alan 63a67e0621 Merge: search finds chats and opens them 2026-11-03 13:02:16 +00:00
alan bff7115e4e Search: find operator chats by title, directory and message text
A search with kind chat matches the operator-session registry's titles and
directories and the newest messages of recent transcripts through the chat
broker (bounded count, concurrency and one-second budget), answered off the
connection's read loop. The all-kind search is unchanged for older clients.

The app sends the chat search after its run search and shows a Chats group
with title, harness, directory and snippet; a chat hit opens that chat in the
Chat tab. The probe fixture answers chat searches over ?chats=N.
2026-11-03 13:01:53 +00:00
alan a12a7b3d66 Claude chats: pass the chat title as --name so terminal resume lists them by name
Spawns pass the session title with --name (Claude Code records it as the
transcript's custom-title). A rename tells the harness the new title for its
next spawn, and the first routing of a session after a restart hands it the
registry title.
2026-11-03 12:31:31 +00:00
alan d34185b56c Merge: chat colours, Ctrl+1-9, starred chats alphabetical
# Conflicts:
#	app/lib/features/chat/conversation/chat_thread_view.dart
#	app/tool/perf/perf_fixture.dart
#	internal/protocol/chat.go
#	internal/server/chat_close.go
#	internal/server/chat_sessions.go
2026-11-03 11:22:50 +00:00
alan 1de74f76bb Chat info: Session section with native id, resume command and export
The chat information sheet gains a Session section: the harness's native
session id (copy), harness, directory, a verified resume command (copy)
and Export conversation (Markdown), Export JSON and, for Claude Code,
Export native session (the JSONL transcript).

Server: chat_sessions rows carry resume_command and native_export; new
chat_export command builds Markdown/JSON from the same paged history
chat_messages serves (bounded at 8 MiB), refuses non-operator sessions.
App: exports go through the artifact file bridge (web download, share
sheet on phones).
2026-11-03 10:59:41 +00:00
alan a4c191a416 Chats: a shared highlight colour per chat, pushed live with star and rename
chat_color {session_id, color|null} stores a palette name (red, orange,
amber, green, teal, blue, purple, pink) on the operator-session row; rows
and replies carry it as color. Colour, star and rename changes are pushed
to every other connection as chat_session_changed.
2026-11-03 10:53:38 +00:00
alan 10049b8062 Chat info: account quota per harness (Claude rate_limit_event, Codex account/rateLimits, OpenCode unsupported)
Usage frames carry optional usage.account {harness, source, plan, as_of,
windows[{id,label,used_percent,resets_at}], unsupported}. Claude Code quota
comes from its rate_limit_event stream lines and the initialize account
(plan), shared across chats on the same account. Codex reads
account/rateLimits/read once per connection (re-read when a chat opens after
5 min) and merges account/rateLimits/updated. OpenCode exposes no quota API
and says so. The app's chat info sheet shows an Account usage section with a
progress bar and reset countdown per window, Material and Cupertino.
2026-11-02 18:57:13 +00:00