24 Commits

Author SHA1 Message Date
alan 50535dc5ea Merge branch 'worktree-agent-a7f96a1eb9a56587d'
# Conflicts:
#	cmd/pipelines-server/main.go
#	internal/server/websocket.go
#	scripts/manage.py
#	scripts/setup-native.py
#	web/serve.mjs
#	web/src/peerRelay.js
2026-11-10 01:25:04 +00:00
alan e43f9fa50c Hash the web password and revoke sessions server-side
Store a scrypt hash (migrating a plaintext password without changing it),
sign sessions with a generation that ./password and --revoke-all rotate,
make logout a same-origin POST that revokes the token, add sign out everywhere,
and close proxied websockets whose session ends. Enforce a strength rule for
new passwords, back off logins per client and server-wide, check Origin on
login, tighten next, add security headers and a __Host- cookie over https.
2026-11-10 01:21:28 +00:00
alan a0f2cfec16 Merge branch 'worktree-agent-ac54c8919e940163a'
# Conflicts:
#	scripts/setup-native.py
2026-11-10 01:07:12 +00:00
alan ad6cdab418 Listen on loopback and tailnet by default; make the plain-HTTP LAN opt-in
The web proxy binds the wildcard and drops connections that are not
loopback or Tailscale at both ends. A LAN listener is opt-in (web.lan) and
refuses sign-in and signed-in pages over plain HTTP unless
web.lan_plain_login is set. Existing installs keep their bind address with
a warning. Without the LAN the mDNS advert carries only the tailnet and
public routes (lan=0).
2026-11-10 01:02:02 +00:00
alan 12a74247ae Create the server token at install and document the security boundary 2026-11-10 00:59:39 +00:00
alan b67ae34ca1 Stage ntfy output on installation filesystem before atomic replacement 2026-11-08 19:02:26 +00:00
alan bd9509b744 Preserve Node tool-manager shim names during native installation 2026-11-08 16:54:17 +00:00
alan c2a8f5ff16 Retain Codex interaction callbacks across server restarts 2026-11-05 14:32:59 +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 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 62b56e66d0 Serve one web app: route the tailnet address to the installed proxy
./install retires the pre-native standalone web agent (net.awan.pipelines.web,
kept as .disabled) and, when the public web URL is a tailnet HTTPS address,
points tailscale serve at the installed web proxy, failing the install if it
cannot.
2026-10-31 20:26:16 +00:00
alan 53be2e5334 Install and start the server only together with the web app
./install builds the web app and the server before replacing either, and
fails without Docker or on a failed build, leaving the old pair in place.
The supervisor and start refuse to run the server when the web app is not
installed.
2026-10-31 19:08:25 +00:00
alan 41a3be8715 Keep web Material styling and preserve visible installer access URLs 2026-10-26 18:37:13 +00:00
alan 3d0c034394 fix(install): a fresh install creates ntfy accounts without prompts (database created first; phone uses the web password) 2026-10-23 23:38:51 +01: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 7958d1830e feat(install): build the Flutter web app in Docker, optional ./install --apk, chosen web password, startup report 2026-10-23 21:45:14 +01:00
alan 9ee2e003bf fix(notify): open configured web run pages from ntfy 2026-10-21 13:05:10 +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 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
alan ae6ba6ae10 Install authenticated native web proxy with user autostart
Register the existing native supervisor with launchd/systemd, include the dependency-free authenticated web proxy, detect Node, and keep the API loopback by default. Preserve existing web credentials and configured host harness defaults. Clarify single-step setup, lifecycle selection, and optional ntfy limits.

Checks: 44 mocked native installer/lifecycle tests; 8 entrypoint tests; 42 Docker installer tests; GOPROXY=off GOTOOLCHAIN=local go test ./internal/installation ./cmd/pipelines; sh -n install install.sh; git diff --check. No live install, deployment, restart, downloads, real autostart/login verification or native Linux verification.
2026-10-20 21:31:36 +01:00
alan 8c1eea53a9 Report a stale client and refuse an unreadable newer server
Exchange a build/protocol identity so an older CLI can no longer talk to a
newer native server silently:

- protocol carries ProtocolVersion and every server frame (including the
  unsolicited welcome) is stamped with the server build and protocol, so a
  client that never pings still learns the server identity.
- buildinfo.Compare classifies the relationship as InSync/Warn/Refuse and
  names both builds; the client Watch reports one warning per connection and
  returns a hard error when the server speaks a newer, uninterpretable
  protocol so the caller never acts on the frame.
- client.ReceiveNotice decodes the raw frame so an unmodeled top-level field
  produces a one-time "unrecognized field(s)" notice instead of being dropped
  silently (the case that hid the artifacts field).
- CLI routes warnings to stderr, keeps machine JSON stdout clean and fails
  non-zero on a refused mismatch; ping/connection print the client/server
  relationship. The TUI surfaces the same notices through the shared log.
- scripts/setup-native.py now warns when an older `pipelines` earlier on PATH
  shadows prefix/bin/pipelines, naming both paths and versions, without
  installing or modifying anything else.
- Docs, the packaged debugging skill reference and README no longer imply the
  installed CLI always matches the server.

Tests cover the comparison table, unknown-field detection and caching, the
server identity stamping on pong and welcome, the CLI/TUI reporting paths and
the installer PATH shadowing warning.
2026-10-16 18:37:01 +01:00
alan 914345cb31 Move harness profiles between host and Docker and stop silent draft retargeting
Native installs left Docker-era harness profiles in harnesses.json, so every
authoring launch failed trying to reach a Docker service, and a retained draft
bound to the old Docker server was silently projected onto the configured one.

- harness: add Profile.Mode and VerifyDockerLink as the single mode/verification
  helpers. `harness setup --host` configures or converts a host profile and
  clears docker_directory; reconfiguring a Docker-linked profile re-verifies the
  recorded directory still owns compose.yaml and fails naming it instead of
  saving a link that cannot launch. Setup's summary and `harness list` (via the
  new List/ListView shape) report the resulting mode and, for Docker, the
  directory, without changing the stored Config schema.
- setup-native.py: after build/install-skill it writes host (no docker_directory)
  profiles for the detected harnesses, defaulting to the detected OpenCode profile
  rather than a stale pi default, taking models from --model or the existing valid
  profile and never inventing one; it clears a stale Docker link and preserves
  unrelated keys/profiles. Detection-only: no harness install, upgrade or download.
- draft: add Draft.Resolve, the shared mismatch helper, which projects a draft
  onto the configured server and returns a dual-URL notice. CLI validate/submit
  and the TUI draft browser use it so a foreign draft is never silently
  retargeted; the TUI pre-wraps the notice to the panel width.
- Tests cover the Docker->host and host->host transitions, the missing-directory
  failure, installer write/migration (Python), and the CLI/TUI notice, using the
  real config file path in a temp dir.
- Update help text, README, docs and the packaged authoring skill reference to
  describe host as the default and the Docker-linked case.
2026-10-15 19:53:10 +01:00
alan 8adc6b8080 Bind the native server to the LAN so the phone client can reach it
The native install hardcoded -addr 127.0.0.1, so the server was unreachable from
the phone: the emulator worked because it proxies to the host loopback, but a
real device could not connect even though ntfy (bound to 0.0.0.0:8090) worked.

The bind address is now a manifest setting (server_address() in manage.py, with
older manifests still defaulting to loopback) and setup-native.py records it,
defaulting to 0.0.0.0 like the Docker install did and offering
--bind-address 127.0.0.1 for a loopback-only server. An invalid address is
rejected, and setup prints the phone client URL.

Verified: scripts test suite 116 tests OK, and after reinstalling the server
listens on *:8080 and answers {"healthy":true} on 127.0.0.1, 10.0.0.75,
10.0.0.249 and the tailnet address.
2026-10-15 01:57:27 +01:00
alan a70e3aef4b Install Pipelines natively by default on macOS and Linux
Add scripts/setup-native.py and make ./install (and --native) build the server, the CLI
and ntfy from source into ~/.local/share/pipelines, detect an existing host OpenCode
and Pi instead of installing them, install the packaged authoring skill, migrate an
existing Docker database and ntfy auth store, save the host client default and start
both services. ./install --docker keeps the previous Docker server + ntfy
installation unchanged.

ntfy is compiled from its pinned Go module on every host because upstream publishes
no macOS server binary (its darwin asset is built with -tags noserver); its cgo
SQLite driver is why a C compiler is now required natively. The ntfy credential
bootstrap and the client default writer are shared by both installers,
installation.Load resolves symlinked prefixes, the Docker migration copies the
SQLite write-ahead log so the newest definitions and runs are not lost, and the
account subcommands read the generated configuration through NTFY_CONFIG_FILE.

Verified on macOS: 115 Python tests, go build/vet/test, and scratch installs that
migrate 9 pipelines and 31 runs, build ntfy v2.30.0 and start both services healthy
on spare ports before stopping them.
2026-10-13 17:20:14 +01:00