Merge main into run token usage branch

This commit is contained in:
2026-11-03 22:21:38 +00:00
118 changed files with 4294 additions and 1483 deletions
+13
View File
@@ -95,6 +95,19 @@ Claude Code also accepts `/clear` in `-p --input-format stream-json` mode, but
the CLI then picks the new session id itself. Re-keying keeps one path for all
three harnesses and lets the server choose the id.
## Chat list activity
Every `chat_sessions` row carries `activity` (turn running, running background
tasks), and `chat_activity` pushes each change to every connection (see
`docs/cli.md`). Background tasks are the same shells all three harnesses already
report: OpenCode shells, Codex `commandExecution` items, and Claude Code
background Bash and Agent/Task subagents. A chat whose last viewer left stays
observed while its tasks run, so their exits are seen. That is bounded by the
unattended limits (16 chats, 6 hours) and by the harness: when a Claude Code
process exits, its background tasks are reported exited because they ran inside
it. After an OpenCode or Codex stream reconnects, the shell set is re-read from
the harness.
## Web interaction contract
All advertised chat adapters (OpenCode V2, Codex and Claude Code) implement the
+26 -18
View File
@@ -153,7 +153,7 @@ pipelines edit # fuzzy pipeline selection
pipelines edit "bug fix" # ask the harness what to change
pipelines edit "bug fix" "Add a review step"
pipelines new "release notes" "Summarize changes and notify my phone"
pipelines new "Add a feature" --template task
pipelines new "Add a feature" --template feedback-loop
```
`new` opens the configured harness (Pi or OpenCode; host by default, or
@@ -214,27 +214,21 @@ is not ownership (the kernel lock is). This is a local-filesystem lock, not a
distributed lease; hard-link database aliases and filesystems without reliable
advisory locking are unsupported.
Use `:templates` for four simple, manual-only starters: task, review, research,
and plan/implement/review. **Submit template** (`s` or Enter) asks for a
Use `:templates` for the four manual-only examples, read in order: one stage,
two stages, a feedback loop and a human decision (`examples/README.md`). A
brand-new database already holds them as ordinary pipelines; the server seeds
them once and never again, so removing them or upgrading never brings them back.
**Submit template** (`s` or Enter) asks for a
name without opening an editor. Enter saves a retained draft, then a separate
confirmation publishes it as a new pipeline. Esc before naming creates nothing;
Esc at publication keeps the draft. **Customize** (`e`) opens the editor picker
instead. Both paths inherit the configured default model and preserve existing
pipelines/history. The research starter requires configured web search support.
Starter stages use goal-appropriate tools: the task worker and the three-stage
implementer edit and run checks, the task, planner and review stages may
search/fetch official sources only when external knowledge is genuinely needed,
the three-stage implementer has no web tools and follows the planner's research,
the standalone review stage never edits or runs commands and says so explicitly,
and the three-stage reviewer independently inspects the real changes and receives
the planner-owned acceptance checks rather than the implementer's summary,
approving only when the applicable acceptance checks were independently observed
passing and no unresolved substantive issue remains. The task and three-stage
templates end in a committer stage that stages the runner's captured changed paths
and commits locally without ever pushing; a genuine operator gate is a `type=human`
decision stage, never a model stage pretending to approve. Editing a bundled
template source changes no installed or published definition; a starter becomes an
immutable version only after explicit authoring and publication.
pipelines/history. Only the stages that make the requested change (`implement`,
`act`) may edit; the others read, and the loop's reviewer also runs read-only
checks. No example commits, pushes or deploys. A genuine operator gate is a
`type=human` decision stage, never a model stage pretending to approve. Editing a
bundled template source changes no installed or published definition; a template
becomes an immutable version only after explicit authoring and publication.
Home's `n` / `:new` and **Customize** (`e`) on a template first ask how to author the new
pipeline: **nvim** opens a retained Markdown draft file, or a configured harness
@@ -477,6 +471,20 @@ sessions pipeline runs create. The protocol types are:
for the run that owns them. The list is fail-closed: with no registry and no
store it returns an empty list, never the endpoint's whole session list. A
session is never marked `busy`: any number of clients may watch and write one.
Each row carries `activity` (`turn_running`, `background_tasks`, `seq`): the
server's live view of the session. An older server omits it.
- `chat_activity` is pushed to every open connection, not only the chat's
watchers, when a session's turn starts or ends or its count of running
background tasks changes (shells, background commands, Claude Code background
Bash and subagents, Codex command executions). The body is `chat_activity`
(`session_id`, `turn_running`, `background_tasks`, `seq`). It is sent on those
transitions only, never per output chunk. `seq` increases with every change
and keeps increasing across a restart, so a client keeps the snapshot (list
row or push) with the larger `seq`. Background tasks are counted only while
the server observes the session: after a chat's last viewer leaves, the
server keeps observing it while its tasks run (bounded like an unattended
turn: at most 16 such chats and 6 hours). Once released it reports none
rather than a stale count.
- `chat_subscribe` attaches a connection to one session's shared live stream (body
`session_id`) and replays the session's still-pending approval requests, so every
client that watches a session sees every frame any client's turn produces — the
+4 -3
View File
@@ -146,9 +146,10 @@ go run ./cmd/pipelines --url ws://127.0.0.1:8081/connect ping --json
```
If the TUI is on another machine, use an SSH/VPN tunnel instead of exposing the
unauthenticated pipeline port publicly. The bundled examples are not automatically
submitted. Open `:templates` and use **Submit template** to name/review/publish a
simple starter, or **Customize** to edit it first. All bundled starters are manual-only.
unauthenticated pipeline port publicly. A brand-new database starts with the four
bundled example pipelines, seeded once; an existing database is never changed.
Open `:templates` and use **Submit template** to name/review/publish another copy,
or **Customize** to edit it first. All bundled examples are manual-only.
## 4. Android
+7 -7
View File
@@ -29,15 +29,15 @@ sandbox for model tools.
1. Pick a disposable project without secrets or valuable uncommitted changes.
A remote browser selects a directory on the **server**, not its own computer.
2. Open **Settings → Templates** in the web app or `:templates` in the TUI.
Create the read-only **review** starter first. Fresh databases have no
published pipelines; choosing a template creates one explicitly.
2. A fresh database already holds the four example pipelines
(`examples/README.md`). Run the read-only **Example 1: one stage** first.
3. Ask it to review one short file. Watch the graph and inspect the retained
report and the stage's **Audit → Session** evidence.
4. Try a research or document starter. Check citations and quoted source content
yourself; a successful stage is not proof of factual accuracy.
5. Only then try an editing starter. Inspect actual changes and test evidence,
not just the model's summary. Keep version control/backups.
4. Try **Example 2: two stages** on a few local files. Check the result against
the sources yourself; a successful stage is not proof of factual accuracy.
5. Only then try an editing example (**feedback loop**, **human decision**).
Inspect actual changes and test evidence, not just the model's summary. Keep
version control/backups.
Editing a draft does not publish it. Publication creates an immutable version;
runs retain the version they used. Export/import bundles contain **definitions
+4 -3
View File
@@ -379,9 +379,10 @@ File-attachment bytes are stored by ntfy, not permanently archived in SQLite;
run metadata stores the delivered filename/URL, and workspace files may later
change. Download attachments before your ntfy retention expires.
Bundled starters do not require notification or schedule setup. Add a `notify`
block to the stages of your own workflow using the example above; configure the
system phone connection first. Adding a schedule activates it on publication,
Bundled examples need no schedule setup. **Example 4: human decision** shows
`notify` hooks (`plan` on failure, `decide` on `waiting`, `act` on success and
failure); they only deliver once the system phone connection is configured. Add a
`notify` block to the stages of your own workflow the same way. Adding a schedule activates it on publication,
so review it explicitly rather than copying a scheduled niche example.
References: [publishing](https://docs.ntfy.sh/publish/),
+1 -1
View File
@@ -106,7 +106,7 @@ Its complete model/web/phone execution was **not tested**. It used dated web
evidence → verify/enrich → Markdown report → native ntfy attachment through the
system connection; the LiveChart schedule was fetched during that investigation.
Removing its bundled starter does not remove its published history. Current
snapshot fixtures use the generic `examples/three-stage.md` starter.
snapshot fixtures use the generic `examples/human-decision.md` example.
`PIPELINES_UX_SNAPSHOT_DIR=<directory> go test ./internal/tui -run
TestUIUXReviewSnapshots -count=1` regenerates the existing snapshots without server