Commit Graph

263 Commits

Author SHA1 Message Date
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 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 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 d78cbe3f66 Merge: one way to set up harnesses (pipelines harness setup) 2026-11-02 16:14:50 +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 80022ea41a Keep observing chats with an in-flight turn after the last client leaves
Chat attention notifications (questions, approvals, finished replies) come
from a session's event stream, which the hub only read while a room existed;
detach destroyed the room when the last client left, so a turn that finished
or asked with the app closed notified nobody.

A room whose last client leaves now stays observing, unattended, while its
turn is in flight or it holds an unanswered question/approval, and is torn
down when the turn ends (or after 6h for a stuck turn); at most 16 such rooms.
At server start, recently used open sessions whose harness reports a running
turn (OpenCode /api/session/active, Codex thread/turns/list) are observed
again so their reply still notifies. Settings, dedupe and app_notifications
recording are unchanged.
2026-11-02 16:07:42 +00:00
alan 3e100f78f3 Document the current install, harnesses and notifications
Rewrite the README around the server, web/Android app and CLI, and
replace docs/install.md with the current native install (all-or-nothing
Docker web build, flags from setup-native.py, lifecycle commands, data
locations, password, upgrading). Add docs/harnesses.md and
docs/notifications.md; point ntfy.md at the new overview and fix its
topic name.
2026-11-02 15:54:25 +00:00
alan eed3806efb Add a home-restricted folder picker to the new-chat dialog
Server: list_directory returns a directory_listing (path, home, parent,
entries with is_dir/is_git_repo/hidden, truncated) confined to the server
user's home subtree after cleaning and resolving symlinks, refusing pseudo
filesystems and capping entries at 2000. Documented in docs/cli.md.

App: "Choose folder…" in the create dialog opens a picker (full-screen page
on phones, large dialog on wide windows, Material and Cupertino) with
breadcrumbs, filter, Show hidden, git badges, dimmed files, recent folders,
inline errors and "Start chat here". The probe app gains a folder fixture
for captures.
2026-11-01 21:51:48 +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 d35739cb49 Release session export gates whose recovery is exhausted or overdue
An exhausted export recovery job left its run parked forever in the
export wait, reserving the workspace and refusing later scheduled runs
(runs 221/226: OpenCode sessions above the 8 MiB export bound are
always truncated, so every retry stays partial).

A gate is now releasable when its job is exhausted: the visit keeps its
partial/unavailable evidence and diagnostic (still repairable), the run
continues to its next stage or terminal, and the workspace is freed.
Gates older than 15 minutes with a pending, lease-expired or missing job
are exhausted by a bounded wait. The worker reconciles on its first
tick after startup and every 30 seconds, so existing wedged runs recover
after a restart. Truncation diagnostics now name the size bound.
2026-11-01 17:24:56 +00:00
alan d1846441cc Stream ntfy notifications to app clients over /connect
Record every notification published to ntfy (run outbox, stage notify
hooks, chat question/approval/reply) in a persisted app_notifications
outbox and stream it to subscribe_notifications clients with an after
cursor; clear_notifications and ack_attention clear across devices, as do
runs leaving waiting, deleted runs and answered chat questions. Add the
notify.ntfy_enabled setting (default on) to stop only the ntfy publish.
2026-11-01 02:03:58 +00:00
alan 31e89e872b Add run size_bytes and delete_runs to free disk space
Every run summary carries size_bytes (artifact tree, server-created Pi
session directories and an estimate of the run's database rows), cached in
pipeline_runs.size_bytes, invalidated by triggers, measured when a run
finishes and backfilled in the background. delete_runs removes terminal
runs with every scoped row and server-owned file, refuses active ones with
a reason, and pushes runs_removed to subscribers. pipelines runs rm is the
CLI form; retention apply now shares the complete row deletion.
2026-10-31 22:11:14 +00:00
alan b109ab3e06 Notify on run end only for runs marked Notify me
Auto runs no longer alert on failure or success; only notify_mode on does,
unless the run_finished setting (now 'Notify when any run ends', default off)
opts into every run end. Waiting still notifies auto and on runs. The setting
is stored under a new key so a value saved under the old meaning is ignored.
2026-10-31 16:52:04 +00:00
alan be932c846f Catch up a moved main in the delivery gate before landing
When canonical main is not an ancestor of the item HEAD, the gate now
merges main into the item workspace under the delivery lock, re-runs the
declared checks on the merged commit, and fast-forwards main to it. A
conflicting merge is aborted with the workspace verified unchanged and a
diagnostic naming the files. Successful catch-ups are logged.
2026-10-31 15:24:12 +00:00
alan d1aa36163a Sync Needs-you dismissals and chat read state across devices 2026-10-31 12:47:25 +00:00
alan 13c4035175 fix(turns): keep the run task in every stage's input
Later visits' input.md held only the previous stage's output, so the
operator's task reached only the first stage; when a Prepare stage
summarised (paths, HEAD), Code never saw the task or its acceptance
checklist and either blocked (run #202) or did part of it (#195, #197,
#198). Later inputs now carry the run prompt under '# Run task' (headings
demoted) before '# Previous turn output'.
2026-10-31 02:52:16 +00:00
alan 498c6f17a6 Add server notification settings with app checkboxes
Persist three global ntfy switches in server_settings: run_finished
(default on: auto-mode runs notify on success, read inside the
transition transaction; on/off modes unchanged), chat_needs_you
(default on: gates chat question/approval alerts) and
chat_reply_finished (default off: one alert per finished assistant
turn). Expose notification_settings / set_notification_settings over
the websocket protocol, add a Phone notifications section with
Material and Cupertino checkboxes in Settings, document the settings,
and keep the cli, tui, stage and pipeline test packages from
inheriting a real ntfy configuration.
2026-10-30 21:36:27 +00:00
alan 40ba2ac117 Open ntfy notifications in the app and notify chats that need the operator
Run notifications now always click through to pipelines://run/<id>; a valid
PIPELINES_WEB_PUBLIC_URL adds an "Open in browser" ntfy view action instead
of replacing the click. Queued rows derive links from the run id at delivery,
so legacy rows holding a web URL still open the app.

Unresolved chat questions/forms and permission requests publish one async,
bounded notification to the system destination (pipelines://chat/<id> plus the
browser action), deduplicated per form/request id across reconnects and
replays. stage.PublishNtfy gains optional, strictly validated view actions.
Server tests now clear the operator's real ntfy environment.
2026-10-30 20:40:06 +00:00
alan 41a3be8715 Keep web Material styling and preserve visible installer access URLs 2026-10-26 18:37:13 +00:00
alan 9bad1bd824 feat(install): pipelines update re-runs the recorded install from the source checkout; --fresh skips Docker migration 2026-10-23 23:37:35 +01:00
alan 8527506da1 chore: remove the JavaScript web client and the Kotlin Android app; the Flutter app replaces both 2026-10-23 21:46:58 +01:00
alan 83d013f10e docs: record Claude Code chat backend deployment 2026-10-22 18:23:48 +01:00
alan 0acd7346bb feat(chat): add Claude Code chat backend 2026-10-22 18:20:10 +01:00
alan ceffd5d0d1 fix(stage): retain inline audit payloads once without losing native evidence 2026-10-21 16:59:20 +01:00
alan 22801a9b06 fix(stage): align session export render cap with artifact bound
Six computed Flutter runs stopped at the export handoff gate because the
rendered session.html cap was 2 MiB while their complete sessions (well inside
the 8 MiB source read bound) rendered between 2.25 and 4.28 MiB once html
escaping and the readable projection duplicated native text.

Raise SessionExportFileLimit to 8 MiB, the server's existing per-artifact file
bound, so a complete export is still listed and served. Normal export
verification, versioned repair and the handoff gate keep using the single
shared constant. The source read bound is unchanged, and an over-cap render is
still visibly truncated and recorded partial.

Add focused regressions for a complete export above the old cap, an over-new-cap
file rejected as partial, repair above the old cap leaving original evidence
untouched, the gate accepting the larger repair, and the constant staying inside
the artifact file bound. Update the artifact, handoff-gate and operations docs
and record the diagnosis in docs/notes/session-export-render-cap.md.
2026-10-21 15:26:29 +01:00
alan 184ce78b65 fix(notify): resolve web links for transactional outbox deliveries 2026-10-21 13:16:20 +01:00
alan 9ee2e003bf fix(notify): open configured web run pages from ntfy 2026-10-21 13:05:10 +01:00
alan de987555e9 docs: record independent scheduling and navigation deployment 2026-10-21 02:12:58 +01:00
alan 1e4654381e feat(web): manage independent schedules and restore recorded stage navigation 2026-10-21 02:06:15 +01:00
alan 7e790126c5 docs: record verified native chat metrics deployment 2026-10-21 00:40:14 +01:00
alan 0b8595f16e feat(web): display reported chat throughput tokens context and cost 2026-10-21 00:27:12 +01:00
alan 8899dd150f docs: record reasoning effort verification and deployment 2026-10-20 23:53:13 +01:00
alan 724de27561 feat(stage): honor per-stage reasoning effort across native harnesses 2026-10-20 23:51:14 +01:00
alan 6f4543444c docs: record verified local deployment and export repairs 2026-10-20 22:37:03 +01:00
alan ba8a981932 fix(chat): preserve fresh compaction state across reconnect history 2026-10-20 22:24:29 +01:00
alan d8b111913e feat(web): show native context compaction activity in chat 2026-10-20 22:15:03 +01:00
alan e29be1181f fix(audit): reserve bounded repair capacity outside user file quota 2026-10-20 22:00:43 +01:00
alan 128e134f98 docs(alpha): record final checks and in-installer model setup 2026-10-20 21:59:34 +01:00
alan da6daa9db5 Resolve configured host models during native installation
Read OpenCode V2's resolved default Model.Info through its authenticated CLI API from HOME when saved profile fields are missing. Preserve valid saved models, explicit --model and unrelated settings. Record the selected stage model in the native server environment so web starters have an actual default.

Run the existing read-only model picker inside ./install when a terminal needs a choice; fail noninteractive or cancelled/incomplete setup before claiming ready or starting services. Do not parse JSONC, open login flows, create sessions or run inference. Document the one-step configuration path.

Checks: 61 mocked native installer/lifecycle tests, 8 entrypoint tests, sh -n install install.sh, git diff --check. API/schema checked against official OpenCode V2 documentation. No operator CLI/service/model calls, live install, restart, deployment or native Linux verification.
2026-10-20 21:56:32 +01:00
alan d3c7e6e784 fix: allow cold managed service discovery only at stage admission 2026-10-20 21:53:52 +01:00
alan bb98bde4fc fix: pin native exports to stage execution service 2026-10-20 21:47:04 +01:00
alan 1f867d4827 docs(alpha): record isolated proxy authentication verification 2026-10-20 21:46:59 +01:00
alan a40898f79a docs(alpha): simplify native setup and verify generic starter creation 2026-10-20 21:42:34 +01:00
alan dce2d759d7 fix(audit): match export ownership and inventory receipts in browser 2026-10-20 21:42:34 +01:00
alan bb32383bbe Route native service commands and configure fresh authoring role
Select native installs only via explicit PIPELINES_PREFIX or the matching owned prefix/bin/pipelines executable. Route enable/status/disable to the existing native supervisor; validate registration ownership, label and command, keep preview read-only, and disable login registration before stopping. Never fall back to a standalone service for an invalid explicit prefix.

Fresh native installs explicitly enable authoring, while reinstalls preserve false or missing legacy role settings. Add explicit --allow-authoring/--no-authoring overrides and pass the server flag only for manifest true. Print a copyable native enable command and update installation help/docs. No Docker configuration changes.

Checks: 54 mocked native installer/lifecycle tests; 8 entrypoint tests; offline Go installation/CLI tests and vet; gofmt clean; shell syntax and diff checks. No live install, restart, deployment, permission/config changes, or native Linux verification.
2026-10-20 21:41:28 +01:00