Commit Graph

2844 Commits

Author SHA1 Message Date
alan ca2f7eee32 App: add a selectable app design with a Terminal look
AppDesign builds each design's light and dark ThemeData with an
AppDesignTokens extension (corner radius, flat surfaces, frame colour,
ANSI accents, prompt glyph). Settings gains a Design picker stored per
device; the theme hosts rebuild live. Terminal is monospace (bundled
RobotoMono), near-black or paper, flat 1px frames with 3px corners, and
draws the chat transcript as prompt lines, tool dot/result lines and
bracketed follow-up lines. Default keeps its exact themes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 16:43:59 +00:00
alan 9a6363b80e Chat: draw agent follow-ups and automatic continues apart from the operator
The server now names a user turn's origin (followup, auto_continue,
auto_switch, scheduled) on chat messages, user frames and queued prompts,
from the prompt's operation id while it holds the prompt and from its own
text prefixes in history read later. Origin is a new field, so older
clients keep treating these as ordinary user turns.

The app draws an agent follow-up, auto-continue and account-switch prompt
as a quiet outlined card on the agent's side with an icon, label and the
schedule facts from the preamble; the operator's own scheduled message
keeps its bubble with a small Scheduled mark. Find searches the drawn text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 15:40:34 +00:00
alan 608b6b8edb App: open a chat with one round trip
The thread controller asks chat_subscribe to carry the newest history page
(history: true, limit 200) and applies it from the reply; a server that
leaves the page out is asked with chat_messages as before. Deltas arriving
before the reply are recorded from the start of the subscribe, and settle
against the page's live_seq exactly as for a separate read.

Also documents the subscribe history field and benchmarks the indexed page
at limits 20 and 100.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 15:09:02 +00:00
alan 686690f7b4 Server: serve a Claude chat's history page from a per-file line index
Reading a history page parsed the whole session file (tens of MB) on every
chat_messages. A per-file index now records which lines build each shown
message; a page re-reads and replays only its own messages' lines, and the
index follows appends by reading only the new bytes. Results match the
whole-file read (compared page by page on synthetic transcripts); shapes the
index cannot replay exactly fall back to the whole-file read.

chat_subscribe may ask (history: true) for the newest page in its reply,
read once the subscription is attached, saving the client a round trip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 14:58:57 +00:00
alan 17baa9e24c Merge branch 'worktree-agent-ab99684776b58ed55' 2026-12-03 14:44:18 +00:00
alan cf4579ab15 App: keep a left chat's cached transcript following its live frames
A left conversation stays subscribed on the server for the rest of the
connection, but the cached transcript was frozen when it was left. A reply
that arrived in the background only appeared after the reopened view's
subscribe and newest-page read (~1-2s over the network on large chats).
The cache now folds the session's chat events into the kept transcript,
so the reply is drawn the moment the chat opens; the page still replaces it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 14:43:52 +00:00
alan 32df4c8569 Merge branch 'worktree-agent-a5f621112ab3cad4f'
# Conflicts:
#	app/lib/features/chat/domain/chat_shown_run.dart
2026-12-03 14:43:11 +00:00
alan f96d9de103 Skill: keep the main skill under its size cap after the merge
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 14:42:42 +00:00
alan 414fa23908 Merge branch 'worktree-agent-a3cb3553b5c91a345' 2026-12-03 14:38:18 +00:00
alan 672d1f95cc Merge main (findings ledger, loop continuation) into usage-limit branch
Keeps the findings ledger, extra visits and on_exhausted=decide alongside the
run budget, failure classes, quota parking and error-loop backoff.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 14:35:54 +00:00
alan b3c9575fde Runs park on usage limits; failure classes, harness error policy, run budgets
- A stage refused for a Claude usage limit no longer fails its run: the
  runner tries the chats' Claude account auto-switch (per-home setting) and
  reruns the visit, else parks the run in the new waiting_quota status
  (persisted, with reset/resume time in run summaries, details and events)
  and resumes the same visit at reset + 1 min, also after a restart.
  resume_run / `pipelines resume` resumes now; cancel works on parked runs.
  The rerun visit gets a "# Previous attempt" interruption note. Subscription
  limits no longer say "top up the provider account".
- run/retry into an account known to be limited are deferred (quota_policy
  defer/refuse/now; CLI refuses under --json/--yes unless --defer or --now).
- failure_class on runs (quota, loop_exhausted, timeout, permission_denied,
  harness_error, blocked, environment, canceled, interrupted, budget,
  check_failed, other) in RunSummary/RunDetail/events, CLI inspect/runs/wait/
  stats and the app failure line.
- Claude permission denials (permission_denials / refused tool results) fail
  a blocked visit with permission_denied naming the tool use.
- Harness failures are classified transient vs deterministic; deterministic
  ones (and a repeated empty readback) skip error self-loops; transient
  self-loops back off 15 s, 1 min, 4 min.
- Whole-run USD budget: run --budget, server default (run-budget /
  get/set_run_settings); 80% warning notification, stop with class budget.
- App: waiting_quota status/filter with resume time, Resume now and Cancel,
  failure class wording. Docs and skill references updated.

Merges main (check stage, delivery gate, Claude stage restart survival,
schedule changes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 14:34:53 +00:00
alan ea858804b8 Merge main into the engine loop improvements
Keep both intents: check stages, allow_workspace_changes, outcome repair
counts and Claude stage re-adoption from main beside the findings gate,
resume_session, applyLimitOn and exhaustion decisions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 14:24:27 +00:00
alan b1b9d32b62 Merge branch 'app-findings-ledger' into worktree-agent-ad304d5ff057a67c9 2026-12-03 14:22:34 +00:00
alan 34b8b94223 Engine: run findings ledger, findings gate, loop continuation, larger memory, loop lint, retry partial work, resume_session
- Runner-owned findings ledger per run: stages report a # findings section
  (new items and F<n> status changes); stable IDs, persisted (run_loop_state),
  in RunDetail.findings, findings.md, memory.md, inspect.
- type=findings gate stage routes open/clear on the ledger mechanically.
- retry --extra-visits N [--stage KEY] continues an exhausted loop; limits
  on_exhausted=decide parks the run on accept/continue/abort.
- Essential memory cap 20 KB, task never truncated, handoff and open findings
  ahead of the outcome ledger.
- Lint rejects limits.on outcomes on forward edges; warns on ineffective
  limits and resume_session.
- A resumed retry carries the failed visit's output.md and private/ under
  previous-attempt/.
- resume_session=true resumes a Claude stage's previous session on loop visits.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 14:22:28 +00:00
alan ff96fcea23 Merge branch 'main' into worktree-agent-a3cb3553b5c91a345 2026-12-03 14:21:22 +00:00
alan b024038114 Capture fixture: run card graph maps, pipeline graph under graph=1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 14:21:22 +00:00
alan 074aba7f6a Merge branch 'worktree-agent-add3194df2bcbd3c5'
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 14:21:07 +00:00
alan f78b589435 Merge branch 'worktree-agent-a253897b0ed5fef4b' 2026-12-03 12:59:07 +00:00
alan 0dbb40e100 Merge branch 'worktree-agent-ae3af4174afca7f4d'
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 12:59:07 +00:00
alan bfc2c9ff76 UI skip test: force a partial capture with a protected directory
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 12:57:16 +00:00
alan 7872e57d40 Run card mini-map and stage strip; graph edge hover highlight
The show_run card carries the run's graph and per-stage progress (bounded by
the graph, not the run length) and draws a still mini-map with the run graph
plus a stage strip with status, visits and time. Hovering or tapping an edge
in the pipeline and run graphs highlights it, its label and endpoints, with a
tooltip naming from -> to, the outcome and, for runs, how often it was taken.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 12:56:51 +00:00
alan f061675fc1 Claude stages survive server restarts; non-repo folders don't falsely overlap; busy scheduled runs wait
- Claude stage CLIs now run in their own session (setsid) with the prompt from
  a file and stream-json written straight to cli-<n>.out in the evidence
  directory; owner.json records pid/pgid, session, invocation and output. A
  server shutdown leaves the CLI running and owned (ErrDetached). Start-up
  recovery re-adopts it (stage.ClaudeStageReattachable): the next process
  re-reads the output, follows the live CLI until it exits, or reads the
  result it left while the server was down; one that ended without a result
  marks the run interrupted with a clear reason. The outcome repair follow-up
  is re-adopted too (or asked again if its CLI died without a reply).
- Workspace overlap: two folders outside any repository overlap only when
  they are the same folder or the inner one lies within the outer run's
  declared write paths; nested-repository rules are unchanged.
- Scheduled admissions refused for a busy workspace are recorded as
  "delayed" and retried every 5 min for up to 2 h (env-configurable), then
  started or skipped with the reason; the operator gets a low-priority app
  notice (and ntfy when enabled) when a scheduled run is delayed or skipped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 12:55:12 +00:00
alan 57ea922c59 Read-only enforcement applies to stages with shell but no edit
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 12:55:10 +00:00
alan 8138cdc3d9 Linux desktop: optimized release build, installer, Linux gaps
Build: split Dart debug info out of libapp.so (13.96 -> 11.27 MB, symbols
kept in the cache) and fix icon tree shaking, which Flutter 3.44's Linux
CMake backend silently disables by quoting the define; the build image
patches its SDK copy (MaterialIcons 1.6 MB -> 25 KB). Impeller cannot be
enabled in a Linux release build and was slower in a profile-build bench.

Install: `./install --linux --install` installs the bundle into
<prefix>/lib/app-linux with com.pipelines.app.desktop (the GTK/Wayland
app id), its icon and a ~/.local/bin/pipelines-app link, through
scripts/install-linux-app.sh.

Linux gaps: notifications through the freedesktop daemon; HTML artifacts
explain the missing web view instead of throwing; no Share for files;
a GTK clipboard reader for pasting files and screenshots (Ctrl+V and
Omarchy's Super+V); GTK header bar only on GNOME; window icon.

Bench: native fixture frame log, wheel/mark steps and
tool/perf/linux_desktop_bench.py (private Xvfb); results in
app/notes/linux-desktop-optimized.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 12:54:18 +00:00
alan 87016ef5dc Engine: check stages, harness-agnostic delivery, read-only enforcement, complete captures
- New `type=check` stage: the server runs a `commands` block (sh -c, per
  command_timeout, workspace env) and routes on pass/fail; per-command status,
  exit code, duration and bounded output are recorded and the failing output is
  the handoff. With delivery=true it is the landing gate (commit leftovers,
  merge moved main, checks in a fresh candidate worktree, fast-forward main).
  Parser/registry, lint (silent guards), format docs, CLI inspect, app graph and
  run detail rendering.
- delivery=true is accepted on every harness (and on check stages).
- permissions.shell on claude stages maps to Bash(cmd) / Bash(prefix:*) rules
  instead of a bare Bash allow; stages without edit that change the workspace
  fail the visit with the changed files listed (allow_workspace_changes=true
  opts out; artifacts, public and harness state dirs are ignored).
- File-change capture: symlinks compared by target, untouched protected files no
  longer make captures partial, untracked caches/dependency/build output left
  out, lockfiles listed without patch, huge files compared by metadata, raised
  patch/line limits. Outcome repair follow-ups are logged and counted on the
  step (control.outcome_repairs).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 12:52:16 +00:00
alan 61c7eee2b0 App: open a chat, the terminal or a diff in a new window
"Open in new window" sits beside Float: the chat pane and chat list row
menus, a floating chat window's title bar, the terminal options menu and
the diff bar, plus Alt+Shift+Y for the chat with the keyboard (listed in
the shortcut help). Once the window opens the item leaves the main window
as Float takes a pane out of the tiling.

The window is its own app instance at /window/chat/<id>,
/window/terminal?tab=<key> or /window/diff/<token>: only that item, named
after it, with "Bring back to main window". It has its own connection and
writes no shared layout (no open-chat workspace, window store or terminal
layout) and posts no notifications, so they stay the main window's.

Web opens a popup window (a blocked popup offers a tab); Linux and macOS
start a second process with --detached (Flutter's multi-window API is still
experimental); Android and iOS hide the action. The capture kit gains a
follow step for windows a page opens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 12:47:42 +00:00
alan ebe79ebed0 App: findings ledger tab, retry extra visits and exhaustion decisions
Run detail gains a Findings tab (open-count badge) listing the server's
findings ledger with status and minimum-severity filters and expandable
event history; visit grants show as an Extra visits summary fact. The
resume retry prompt can grant 1-5 extra visits to the exhausted stage or a
chosen graph stage (never sent on restart), suggested when the run failed
on a visit limit. A loop-exhaustion decision waiting on a model stage is
now decidable from its recorded options, with readable labels, targets and
the visit count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 12:45:51 +00:00
alan c4de1de27b Merge branch 'main' into worktree-agent-a7c8c1a6937e97e84
Resolve chat_room.go: keep main's bounded chatSub queue (ready channel, no ch) in attachSub; the subscribe live-turn marker is still queued at attach under h.mu through enqueueChatLocked, and an existing subscriber whose queue is full is overflowed (resync) after the hub lock is released.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 01:11:11 +00:00
alan c0b2bda474 Server: rename the scoped search's rune-length helper so it doesn't clash
Merging the reliability branch added another utf16Len; 66a12207 also
records the merge of worktree-agent-a588aaf81441341cd.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 01:08:21 +00:00
alan 66a12207b9 Unattended test: build the subscription the current way
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 01:08:01 +00:00
alan bbeb90339b Run tab keys test: read the selected tab from the top segments on wide layouts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 01:07:34 +00:00
alan dd86454657 Merge branch 'worktree-agent-a717651aa412e3b7c'
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 01:00:02 +00:00
alan 1e7984d1b8 Merge branch 'worktree-agent-ac4392b2750312e98' 2026-12-03 00:59:38 +00:00
alan ff5d8595e4 Cheatsheet: J/K and arrows move between changed files in the wide Changes view
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 00:57:51 +00:00
alan a6db4ba20e App: run tabs under the header on wide layouts, stable Artifacts tab, spelled-out pipeline status, shared list selection, code block header and edge fades
- Run detail: on a wide window (>= 840, pane >= 600) the tabs are Material
  segments under the run header; phones keep the floating bottom bar.
  Artifacts is always a tab, badged with its count and disabled with 0 (its
  tooltip says why), so Changes never moves.
- Pipelines list: 'Failed · last run 19 Oct' beside the status dot; facts on
  the next line; compact rows keep 'Failed · 19 Oct'.
- Settings: Disconnect is outlined beside a tonal Reconnect.
- Lists: one selection style (tonal fill plus one leading accent bar) for
  runs, pipelines and chats; chat's border, fill and pointer removed.
- Transcript: overflowing blocks fade at the edge with a chevron instead of
  a 'Scroll horizontally' line (semantics hint kept); code blocks get a
  header strip with language and Copy; lighter light-mode code fill.
- Runs list: rows under a day heading show only the time of day.
- Artifact search reveal re-centres once the lazy list's extent settles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 00:55:50 +00:00
alan d7a3ab000f Merge branch 'main' into worktree-agent-a7c8c1a6937e97e84
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 00:51:37 +00:00
alan 8384c229a6 Merge branch 'worktree-agent-ae57d5ca18be911ad' 2026-12-03 00:51:08 +00:00
alan 243e5e7b7b Chat subscribe: queue the live-turn marker as the client attaches
TestChatFanoutToSeveralClients flaked (tablet frame 0 = step, want text):
chat_subscribe decided whether to replay a `step started` marker only after
writing its reply and attaching the stream, then sent it. A turn another
client started in between was already being fanned out live to the new
subscriber, so the marker arrived after that turn's user frame, and could
even arrive after its `step ended`, leaving the client showing a turn that
had finished. The marker is now decided and queued in the same critical
section that makes the client a fan-out target, and the new subscriber's
writer starts only after the subscribe reply is written, so the reply comes
first and the marker precedes every live frame of the turn it stands for.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 00:51:03 +00:00
alan 84028a5f24 Merge branch 'worktree-agent-a85504335ecc45672' into worktree-agent-a717651aa412e3b7c 2026-12-03 00:49:51 +00:00
alan 12c7642e35 Chat quick switcher MRU, Closed section and markers; Alt+N, Alt+J and run tab keys
Ctrl+K lists open chats most recently used first (tracked on open and pane
focus, persisted per server) and preselects the previous chat, so Ctrl+K,
Enter returns to it. Rows mark needs you / working / unread; a query also
lists matching closed chats under Closed, and choosing one reopens it.
Alt+N (Option+N) starts a new chat and Alt+J (Option+J) opens the next chat
waiting for you, unread or failed, cycling; the terminal keeps both. In run
detail, bare 1-4 switch tabs when not typing. Cheatsheet entries added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 00:49:36 +00:00
alan 393f06fa88 Chat find: re-register a highlight whose shared entry another text removed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 00:46:00 +00:00
alan 878012ad4c Runner: gofmt
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 00:42:27 +00:00
alan 2ea7eb9db0 Runner: no I/O under the runner lock; retry run settlement
- Run worktree creation happens outside r.mu; the source tree is protected
  from storage maintenance meanwhile and the reservation is re-checked under
  the lock before the run is recorded (a refused tree is discarded).
- getRun/listRuns read the store without r.mu; listRuns finds failed runs
  with an active cleanup agent in one query (partial index) instead of a
  detail read per failed run.
- finishRunState writes the deliverable and walks the run size without the
  lock; FinishRun retries transient failures with backoff (a refused
  transition is final).
- Launch teardown retries a failed read with backoff instead of keeping the
  reservation forever; a kept run that cannot be read at reattach is retried
  and then marked interrupted (stopping its adopted session first).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 00:42:25 +00:00
alan c7e0b8b84e Chat tests: accept text deltas joined in a subscriber's queue
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 00:41:48 +00:00
alan 65579c8b42 Merge branches 'worktree-agent-a6019135c1d229f82' and 'worktree-agent-a64fb2f79d15cc2be' into worktree-agent-a717651aa412e3b7c 2026-12-03 00:41:39 +00:00
alan 8bd219e636 Chat: find in chat (Ctrl+F / Cmd+F)
A find bar over the transcript: query, Match case, n of N (counted from
the newest), Enter for an older match and Shift+Enter for a newer one.
Matches are painted over the rendered text, code blocks included, without
restyling it; the current match is scrolled into view. Matches in history
not loaded yet come from the server's chat:<id>-scoped search and are
reached by loading older pages. Esc closes and returns to the composer.
The key is the pane's, so a focused terminal keeps Ctrl+F. Fixture answers
scoped searches for captures; cheatsheet lists the key. The scoped search
matches the query as typed, spaces included, like the client.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 00:41:39 +00:00
alan c316bc9bc8 Chat and runs: tell a slow client to resync instead of dropping it silently; join queued deltas
A chat subscriber whose queue fills is detached and its writer ends the
stream with a resync frame (the app re-attaches and re-reads history); a run
subscriber gets a final runs_resync and the app subscribes again and
re-reads the Runs list and open detail. Consecutive text/reasoning deltas of
one part are joined in a chat subscriber's queue; joined numbered frames carry
seq_from and delta_lens so the app trims exactly the prefix a history page
already holds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 00:39:38 +00:00
alan ab6b2bb632 Scheduler: skip unreadable schedules, admit claimed runs asynchronously
A schedule that cannot be parsed or claimed is logged and skipped instead
of aborting the tick for every schedule. Claimed runs are admitted on their
own goroutines, so a slow start (worktree creation) no longer makes the
next due schedule look missed; lateness is measured at claim time. An
invalid interval no longer divides by zero.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 00:37:50 +00:00
alan fbc09528ec Chat list: order chat_session_changed pushes by a registry revision
operator_sessions gains a revision bumped by a trigger on every update; the
wire row carries it, and the app ignores a push (or a list read) older than
the row it holds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 00:34:16 +00:00
alan b95ec83918 Merge branch 'worktree-agent-a96b82d1c1cee18ca' 2026-12-03 00:33:07 +00:00