37 Commits

Author SHA1 Message Date
alan bd07abcde8 Run pipeline stages on Claude Code (harness=claude)
A model stage with harness=claude, provider=anthropic and a Claude model id
runs one claude -p process per visit with the server user's Claude sign-in.
Only the declared tools exist (--tools) and nothing else is approved
(--permission-mode dontAsk); edits are approved only below the run directory
and the stage's artifacts directory. A permissions block, run write paths,
delivery=true and reasoning_effort none/minimal are refused, not widened.

Usage comes from the CLI's final result and counts toward budgets. Failures
are fixed text; billing, quota and rate-limit refusals map to
ErrProviderQuota. The redacted stream is the session export and evidence.
provider-check --harness claude and model overrides are covered.
2026-11-11 10:30:37 +00:00
alan 9246c168ac Add opt-in live thinking-level checks and notes 2026-11-09 20:22:33 +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 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 3fbfb85ace Observe native Claude automations and preserve pending timers 2026-11-08 15:52:22 +00:00
alan 9d3358be47 Expose session-owned chat automation metadata 2026-11-08 15:24:23 +00:00
alan 692eb181c3 Merge conservative legacy task readback recovery 2026-11-07 16:41:58 +00:00
alan d0f616babc Keep trimmed legacy host task readback explicitly incomplete 2026-11-07 16:40:44 +00:00
alan d30b99e18e Merge metadata-only startup reattachment and unknown-readback handling 2026-11-07 16:37:01 +00:00
alan 63a89ec99c Retry retained Claude hosts from metadata readback without spawning work 2026-11-07 16:36:48 +00:00
alan 886e3ea2b7 Merge replay boundary and native task identity reconnect regressions 2026-11-07 16:30:00 +00:00
alan 723ed3aa68 Prove task recovery beyond spool trim and order live events after snapshots 2026-11-07 16:28:26 +00:00
alan b15597662f Preserve independent background sessions through owner shutdown and idle cleanup 2026-11-07 16:23:20 +00:00
alan 4ead2abdbf Restore hosted background tasks and preserve live hosts on reconnect failure 2026-11-07 16:22:51 +00:00
alan fd82eaa576 Restore hosted background tasks and preserve live hosts on reconnect failure 2026-11-07 16:22:38 +00:00
alan 6421554bfe Expose recorded background task timing and progress metadata 2026-11-06 15:08:34 +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 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 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 edc1543874 Merge: background-task notices grouped in the chat 2026-11-03 12:45:18 +00:00
alan 1a9db0206c Chat: group consecutive background-task notices into one collapsed chip
Two or more consecutive Claude Code task notices fold into one
task_notices row: a chip 'N background tasks' (tinted when one failed)
that opens a sheet with one compact row per task (outcome icon, summary,
outcome word), like the tools and permissions chips. A lone notice stays
one line. The server also treats Claude Code's [SYSTEM NOTIFICATION]
banner as harness text, so a bannered notification without an origin is
still a notice, never the operator's turn. The chat fixture gains
?tasks=N.
2026-11-03 12:44:57 +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 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 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
alan 9393345acb Merge: worktree-agent-adedec543a1830ea7 2026-11-02 16:47:33 +00:00
alan 07d4740d0c Show injected Claude input as agent reports and notices, not operator bubbles
Claude Code records subagent/peer reports, task notifications, reminders and
skill bodies as user-role entries. Classify them server-side (history and live
stream) by origin/isMeta/queued_command mode: reports become kind agent_report,
task notifications kind notice, harness meta is hidden, and the mid-turn
wrapper is unwrapped to the operator's text. The app draws a collapsed Agent
report card and a one-line system notice on the agent's side.
2026-11-02 16:44:07 +00:00
alan b4382b08ad Apply the chat directory's environment and account to Claude Code chats
Claude Code chats now start with the chat directory's own environment:
direnv (allowed .envrc only, via direnv export json) and mise (mise env
--json), cached per directory and invalidated when config, watched files or
allow records change. A blocked .envrc is logged and shown in the chat as a
notice and never applied. When the directory chooses the Claude account
(CLAUDE_CONFIG_DIR, API key or token variables), the server's service token
and login-file fallbacks are skipped and inherited credentials dropped.
Transcripts in a directory's CLAUDE_CONFIG_DIR are found for history,
resume and after a restart. PWD is set to the chat directory.
2026-11-02 16:37:20 +00:00
alan 108c29f9eb One harness setup path: pipelines harness setup <claude|codex|opencode|pi>
Checks the CLI on the server's PATH (install command when missing), signs in
with the harness's own login only when needed (--login forces it), keeps the
OpenCode/Pi model pickers, and verifies with the server's check. Works on
native and Docker installs (Docker delegates to the container setup); --host
is a hidden compatibility alias. harness list shows all four harnesses'
installed/signed-in/configured/default status. ./install --opencode|--pi now
point to the command; ./install ends with the next-step hint.
2026-11-02 16:11:04 +00:00
alan e42f9cc031 Send mid-turn chat prompts to the harness and queue the rest durably on the server
Claude Code (stream-json stdin) and Codex (turn/steer pinned to the active
turn) receive a prompt sent while a turn runs immediately. Other harnesses
(OpenCode) get a durable chat_prompt_queue row owned by the session: it
survives the last client detaching and a server restart, is delivered in
order when the turn ends with or without a client, and is deduplicated by
operation id. chat_subscribe carries the queue, chat_queue frames report
delivered/removed/failed changes, and chat_unqueue removes a waiting prompt.
2026-11-01 18:30:20 +00:00
alan 429e175b95 Report a busy chat on subscribe after a reload
The room that records a server-run turn is torn down when its last client
leaves, so a page reload re-subscribed to a new room that no longer knew the
turn was running and never replayed the step-started marker. Claude Code does
not re-announce a running turn to a new stream either, so the activity row and
Stop control vanished until the next streamed delta.

chat_subscribe now also replays the marker when the room's stream announced a
turn (CLI-originated or re-announced on attach) or when the broker reports its
own turn in flight through the optional chatTurnReporter (Claude Code reads its
in-process running flag; the chat manager routes it without I/O).
2026-10-31 22:09:11 +00:00
alan d7ad468b78 Stop repeating streamed Claude text when assistant blocks arrive split
Claude Code emits one assistant event per content block, so a text block that
streamed at index 1 after a redacted (empty) thinking block arrives alone at
index 0 of its event. The translator aligned completed blocks by that local
index and cleared stream state after every event, found no streamed text, and
re-emitted the whole paragraph as a new text part. Claim the streamed block of
the same kind whose text prefixes the completed one, and keep stream state for
the whole message (reset on message_start or a new message id).
2026-10-31 20:37:48 +00:00
alan ef07c95b0c fix(claude): list background commands and agents as running tasks
A Bash call with run_in_background and an Agent call return at once
('Command running in background…' / 'Async agent launched…'), so the
chat's task list counted them finished immediately and showed 0 tasks.
They now stay running until Claude Code's task notification (the
<task-notification> text or the SDK's task_notification message)
reports completion, with the exit code from its summary.
2026-10-31 00:16:06 +00:00
alan 6d430948a6 feat(chat): per-chat permission modes for Claude, Codex and OpenCode 2026-10-24 18:16:10 +01:00
alan 819473c7b2 fix(chat): Claude chats sign in with the operator's login file when the service's default login is not signed in 2026-10-24 00:37:01 +01:00
alan b490728c55 feat(chat): Claude Code chats use a service token from a private file when the server runs in the background 2026-10-23 23:09:52 +01:00
alan 0acd7346bb feat(chat): add Claude Code chat backend 2026-10-22 18:20:10 +01:00