Initial pipelines server, CLI, TUI, and Go installation
This commit is contained in:
+118
@@ -0,0 +1,118 @@
|
||||
# CLI and agent authoring
|
||||
|
||||
`pipelines help` lists commands; `pipelines help edit` (or `edit --help`) shows
|
||||
command-specific flags and examples. Installed commands work from any directory.
|
||||
The installed command is a compiled Go binary; only service lifecycle management
|
||||
delegates to the private Python helper. The binary discovers its manifest through
|
||||
the system command symlink. A separately `go install ./cmd/pipelines`-installed
|
||||
binary can select a managed installation using `PIPELINES_PREFIX`.
|
||||
For source development, use `go run ./cmd/pipelines help`; start the native server
|
||||
separately. Set `PIPELINES_URL` or pass `--url` to select another server.
|
||||
|
||||
## Draft-first OpenCode workflow
|
||||
|
||||
```sh
|
||||
pipelines edit # fuzzy pipeline selection
|
||||
pipelines edit "bug fix" # ask OpenCode what to change
|
||||
pipelines edit "bug fix" "Add a review step"
|
||||
pipelines new "release notes" "Summarize changes and notify my phone"
|
||||
pipelines new "weekly digest" --template scheduled-summary
|
||||
```
|
||||
|
||||
`new` asks for a name when omitted. `edit` accepts an exact name or ID, with names
|
||||
taking precedence over numeric IDs. Both copy a definition into a private draft
|
||||
and launch the host OpenCode interface. An isolated authoring workspace contains
|
||||
the bundled `pipelines` skill and format reference. The CLI creates an OpenCode
|
||||
session and **explicitly activates the skill with `resume=false` before opening
|
||||
the interface**. It does not modify shared OpenCode configuration or copy login
|
||||
credentials. Your OpenCode permissions remain in effect; auto-approval is not used.
|
||||
|
||||
The skill encourages editing only the draft, running server validation, summarizing
|
||||
the changes, and leaving submission to the user. This is an instruction, not a
|
||||
security sandbox: an agent with CLI/shell access can submit when explicitly asked.
|
||||
Every submission, including agent-issued `submit`/`rpc`, still uses server validation.
|
||||
|
||||
For agents or scripts that should not open a terminal:
|
||||
|
||||
```sh
|
||||
pipelines new "release notes" --no-open
|
||||
pipelines edit "bug fix" --json
|
||||
pipelines drafts --json
|
||||
pipelines validate /path/to/pipeline-123.md --json
|
||||
pipelines submit /path/to/pipeline-123.md --json
|
||||
```
|
||||
|
||||
`--json` never opens an editor or picker; provide a name explicitly. It returns
|
||||
draft metadata including `path`, `name`, `server`, `create_only`, and `base_version`.
|
||||
`--no-open` prints the path and review commands. `$PIPELINES_DRAFT_DIR` overrides
|
||||
the shared cache directory. CLI and TUI drafts use private Markdown plus metadata
|
||||
sidecars; `submit FILE` can publish either. External files require `--name NAME`.
|
||||
|
||||
New drafts use create-only submissions and cannot overwrite existing names.
|
||||
Edits carry a latest-version guard checked atomically by the server. On conflict,
|
||||
inspect/export the latest version and reconcile the draft. `--force` explicitly
|
||||
bypasses the version guard only, **never** syntax, graph, model, tool, schedule,
|
||||
or notification validation. Original versions/sources remain immutable.
|
||||
Submitting activates included schedules, so review them before publishing.
|
||||
|
||||
## CLI/TUI capability map
|
||||
|
||||
| TUI action | Agent-capable CLI |
|
||||
| --- | --- |
|
||||
| Browse/search pipelines | `list --json`, `show NAME --json` |
|
||||
| Original source and history | `export NAME --version N`, `versions NAME --json` |
|
||||
| Browse templates/source | `templates --json`, `template KEY --source` |
|
||||
| Create or edit a definition | `new`, `edit`, `drafts` |
|
||||
| Validate and publish | `validate FILE`, `submit FILE` |
|
||||
| Start a run | `run NAME PROMPT --yes --json` |
|
||||
| Run history/inspection | `runs --json`, `inspect ID --json` |
|
||||
| Cancel | `cancel ID --json` |
|
||||
| Connection and phone settings | `connection --json`, `ping --json` |
|
||||
| Operational diagnostics | installed `logs`, `status`, `doctor` |
|
||||
|
||||
The TUI does not spawn CLI processes for each request. Both front ends share
|
||||
`internal/client`'s command transport and `internal/draft`'s persisted drafts;
|
||||
the server owns all validation, persistence, execution, and schedules. `rpc`
|
||||
exposes the full protocol as an escape hatch, so no server command is TUI-only:
|
||||
|
||||
```sh
|
||||
printf '%s' '{"type":"get_pipeline","pipeline_id":1,"version":1}' | pipelines rpc -
|
||||
```
|
||||
|
||||
Existing protocol commands: `ping`, `list_pipelines`, `get_pipeline`,
|
||||
`list_templates`, `validate`, `submit`, `run_pipeline`, `list_runs`, `get_run`,
|
||||
`cancel_run`. See `internal/protocol/message.go` for JSON envelopes. Mutating RPCs
|
||||
have real effects; they are not previews. TUI-only animation, scrolling, and
|
||||
transient client logs are presentation, not separate server capabilities.
|
||||
|
||||
## Scripted runs
|
||||
|
||||
```sh
|
||||
cd ~/repos/project
|
||||
pipelines run "bug fix" "Fix the layout" --yes --json
|
||||
pipelines run "bug fix" "Fix the layout" --yes --json --wait --timeout 10m
|
||||
pipelines run "bug fix" "Fix the layout" --yes --json \
|
||||
--allow-tools --write-paths internal/example.go --request-key my-unique-task
|
||||
```
|
||||
|
||||
Runs default to the current directory and latest accepted version. The server
|
||||
checks allowed workspace roots, including symlink resolution. `--version` chooses
|
||||
an immutable version in JSON mode. `--yes` never grants tools implicitly.
|
||||
Go-specific file editing and restricted Go shell checks remain in effect.
|
||||
`--wait` polls until terminal status, returns nonzero on failure/cancellation,
|
||||
and does not cancel a run when waiting times out. Reuse `--request-key` to prevent
|
||||
duplicate work. Without JSON, `run` opens the existing interactive composer and
|
||||
live inspector; Enter inserts a newline, Ctrl+S continues.
|
||||
|
||||
JSON results go to stdout, errors to stderr (JSON error envelopes when requested),
|
||||
and failures exit nonzero. Export/template `--source` deliberately prints raw
|
||||
Markdown. `--timeout` bounds each server request and the optional wait duration.
|
||||
|
||||
## Verification scope
|
||||
|
||||
CLI integration tests exercise draft/validate/submit/history/conflict handling and
|
||||
scripted run/inspection/cancellation through a real local WebSocket server (the
|
||||
run test uses a controlled executor, not a model). The isolated installed CLI
|
||||
also exercised the actual OpenCode API's session creation and skill activation,
|
||||
while capturing interactive launch arguments to avoid a model turn. Full
|
||||
model-driven authoring and Linux execution are **not tested**.
|
||||
+138
@@ -0,0 +1,138 @@
|
||||
# Pipeline server + ntfy in one Compose project (Android)
|
||||
|
||||
## Local pipeline server, Docker ntfy
|
||||
|
||||
To reuse your host OpenCode login without container authentication:
|
||||
|
||||
```sh
|
||||
docker compose up -d ntfy
|
||||
# Bootstrap ntfy users/token as described below, then:
|
||||
sh scripts/run-local-server.sh
|
||||
go run ./cmd/tui -url ws://127.0.0.1:8080/connect
|
||||
```
|
||||
|
||||
Do not run `docker compose up -d` for this mode: that starts the pipeline container
|
||||
too. The local launcher uses the existing host database and OpenCode account,
|
||||
publishes via localhost:8090, and advertises `.env`'s `NTFY_BASE_URL` to the TUI.
|
||||
The top bar shows **ntfy**, the external server URL, and topic beside the pipeline
|
||||
server address on every page.
|
||||
No credentials are included in the public setup data. Stop any existing local
|
||||
pipeline server before launching another against the same database/port.
|
||||
|
||||
`compose.yaml` runs two services: `pipelines` (Go server + OpenCode V2) and `ntfy`.
|
||||
The pipeline server publishes internally to `http://ntfy/pipelines`; Android connects
|
||||
to your host's LAN/VPN URL. No host OpenCode service or credential database is
|
||||
mounted. Separate volumes persist pipeline history, workspace files, OpenCode
|
||||
credentials/sessions, and ntfy data. Do not use `docker compose down -v` unless
|
||||
you intend to delete those volumes.
|
||||
|
||||
**Verification:** `docker compose build pipelines` completed, and
|
||||
`docker compose up -d ntfy` started ntfy. A local authenticated Markdown upload
|
||||
was accepted with a phone-facing attachment URL. The local server's WebSocket
|
||||
advertised the public URL/topic and accepted the notification test pipeline.
|
||||
Go race tests and vet passed. Pipeline-container startup/model authentication
|
||||
and Android delivery are still **not tested**. Existing host history is preserved;
|
||||
the local server was restarted with notification configuration.
|
||||
|
||||
## 1. Local settings
|
||||
|
||||
Start Docker Desktop/Colima/your Docker daemon first. Choose the host address your
|
||||
phone can reach. Example (replace the LAN IP):
|
||||
|
||||
```sh
|
||||
python3 scripts/configure-compose.py \
|
||||
--ntfy-url http://192.168.1.20:8090 \
|
||||
--bind-address 0.0.0.0
|
||||
docker compose config --quiet
|
||||
```
|
||||
|
||||
The helper detects the **host's timezone** and writes it to `.env`, so the Linux
|
||||
containers do not silently schedule in UTC. It refuses to overwrite `.env` or an
|
||||
existing token. If detection is unavailable, use `--timezone Europe/London` (or
|
||||
your actual IANA timezone). Rerun/edit settings if you move/change timezones.
|
||||
|
||||
The helper creates an empty, protected token file for bootstrap; no notifications
|
||||
are sent until it is filled. `.env`, `secrets/`, and `data/` are git-ignored and
|
||||
excluded from image builds. Default pipeline port is **8081**, bound to host
|
||||
loopback, avoiding the existing native server on 8080. Android does not need
|
||||
access to the unauthenticated pipeline API.
|
||||
|
||||
Use HTTP only on a trusted LAN or encrypted VPN. For public access, use HTTPS
|
||||
with a reverse proxy/VPN; configure the external URL in `NTFY_BASE_URL`. The
|
||||
container's attachment URLs use that external URL, not the internal service name.
|
||||
`NTFY_BIND_ADDRESS=0.0.0.0` explicitly exposes port 8090; firewall it appropriately.
|
||||
|
||||
## 2. Bootstrap ntfy users and token
|
||||
|
||||
```sh
|
||||
docker compose up -d ntfy
|
||||
docker compose exec ntfy ntfy user add pipeline-publisher
|
||||
docker compose exec ntfy ntfy access pipeline-publisher pipelines write-only
|
||||
docker compose exec ntfy ntfy user add phone-reader
|
||||
docker compose exec ntfy ntfy access phone-reader pipelines read-only
|
||||
docker compose exec -T ntfy ntfy token add pipeline-publisher | python3 scripts/save-ntfy-token.py
|
||||
```
|
||||
|
||||
User creation prompts for passwords. Keep `secrets/` mode **0700** on the host.
|
||||
The helper extracts only the raw token (the ntfy CLI includes prose in its response)
|
||||
and makes the final file readable inside the non-root pipeline container: local Compose
|
||||
file secrets are bind mounts and do not reliably remap uid/mode. Its private parent
|
||||
directory protects the source file from other host users. Do not commit tokens
|
||||
or paste them into a chat. Recreating/replacing the secret file requires restarting
|
||||
the pipeline container. The application accepts `_TOKEN_FILE` or `_TOKEN`, not
|
||||
both, and never puts the token in model prompts, outputs, or diagnostics.
|
||||
|
||||
## 3. Authenticate OpenCode, then start the server
|
||||
|
||||
```sh
|
||||
docker compose build pipelines
|
||||
docker compose run --rm --no-deps --entrypoint opencode pipelines auth login
|
||||
docker compose up -d
|
||||
docker compose logs -f pipelines
|
||||
```
|
||||
|
||||
Select **OpenCode Go** and follow its authentication flow. Credentials are stored
|
||||
in the dedicated `opencode-home` volume, separate from your host account. These
|
||||
container commands are **not tested** here. The image includes Go/git for the
|
||||
existing narrowly approved verification tools; the actual server runs as uid 10001.
|
||||
The Docker workspace is persistent and separate from your host checkout.
|
||||
|
||||
Connect the native TUI:
|
||||
|
||||
```sh
|
||||
go run ./cmd/tui -url ws://127.0.0.1:8081/connect
|
||||
```
|
||||
|
||||
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. Copy `examples/anime-digest.md` into an editor draft to create that
|
||||
pipeline; submitting activates its daily 19:00 schedule.
|
||||
|
||||
## 4. Android
|
||||
|
||||
Install ntfy, add the custom server `http://192.168.1.20:8090` (or your HTTPS/VPN
|
||||
URL), sign in as `phone-reader`, and subscribe to **pipelines**. This is the single
|
||||
system-wide notification topic, shared by every pipeline. Grant notifications
|
||||
and background operation as required by your Android app/device. Outside your
|
||||
LAN, enable the VPN or use your HTTPS address. `localhost` on Android is the
|
||||
phone, not your server. No iOS/APNS upstream is needed for this Android setup.
|
||||
|
||||
Use the app to confirm a test notification and download an attachment before
|
||||
relying on unattended schedules. This phone/background-delivery check has **not
|
||||
been performed**. Attachments/messages expire after seven days in this config.
|
||||
|
||||
## Existing data and rebuilds
|
||||
|
||||
The containers initially use a fresh SQLite database; the host's `pipelines.db`
|
||||
is left untouched. To migrate, first stop the host pipeline server (preventing
|
||||
two schedulers), make a consistent SQLite backup, and import it into the stopped
|
||||
container's `/data/pipelines.db`. Copying only a live `.db` without its WAL is
|
||||
unsafe. Do not import over an existing container database without backing it up.
|
||||
The database import and OpenCode session-recovery implications are **not tested**.
|
||||
|
||||
Rebuild executable changes with `docker compose up -d --build pipelines`.
|
||||
The workspace volume does not automatically replace its existing source tree
|
||||
on image rebuild; back it up and update it explicitly if you need new source for
|
||||
Go verification. Do not delete it casually: it may contain user-created artifacts.
|
||||
`compose.yaml` currently uses ntfy's `latest` tag; pin a tested version/digest
|
||||
before production. OpenCode is pinned to `2.0.20`.
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
# Install and test
|
||||
|
||||
Run as your normal user, **not** with sudo. Requires Python 3, a running Docker
|
||||
daemon with Compose, and OpenCode V2 connected to OpenCode Go. Source installs
|
||||
also require Go 1.27+. Platform archives contain the server, CLI, and TUI binaries. If OpenCode
|
||||
is absent and npm is available, the installer offers a private pinned CLI install;
|
||||
Docker itself is not installed automatically.
|
||||
|
||||
```sh
|
||||
./install.sh
|
||||
# Optional: expose the command in /usr/local/bin (sudo for the symlink only):
|
||||
./install.sh --system-command
|
||||
```
|
||||
|
||||
Setup prompts for phone username, password, and global notification topic. Blank
|
||||
password generates one. `--yes` accepts defaults and generates a password;
|
||||
`--password-file PATH` supplies one without putting it in shell arguments.
|
||||
Phone connection details are saved privately in
|
||||
`~/.local/share/pipelines/secrets/phone-login.txt`. Configure the ntfy phone app
|
||||
with those credentials and subscribe to that topic. Phone delivery still needs
|
||||
an actual device test. Prefer Tailscale or HTTPS; HTTP exposes credentials on an
|
||||
untrusted network.
|
||||
|
||||
The native server and Docker ntfy are managed together:
|
||||
|
||||
```sh
|
||||
pipelines # dashboard; b opens rendered templates
|
||||
pipelines status
|
||||
pipelines doctor
|
||||
pipelines stop
|
||||
pipelines start
|
||||
pipelines restart
|
||||
pipelines logs
|
||||
```
|
||||
|
||||
Default command path is `~/.local/bin/pipelines`; add `~/.local/bin` to PATH if
|
||||
needed. It points directly to a compiled Go binary, not a shell launcher.
|
||||
Source installation builds all binaries with `go install`. Service registration uses
|
||||
per-user launchd on macOS or systemd on Linux.
|
||||
`--no-autostart` uses background supervision instead. Services retain the current
|
||||
user's OpenCode config/login, without exporting credentials into Docker.
|
||||
`--system-command` is a system PATH shortcut to this user's install, **not** a
|
||||
shared multi-user service. Other users should install their own instance.
|
||||
|
||||
## Run in a repository
|
||||
|
||||
```sh
|
||||
cd ~/repos/my-project
|
||||
pipelines run # fuzzy pipeline picker, then prompt
|
||||
pipelines run "bug fix" # prompt composer
|
||||
pipelines run "bug fix" "Fix the layout" # explicit execution confirmation
|
||||
pipelines run "bug fix" "Fix the layout" --yes
|
||||
```
|
||||
|
||||
The composer supports multiline typing/paste: **Enter** adds a newline,
|
||||
**Ctrl+S** or **Alt+Enter** continues. The current directory is recorded as the
|
||||
run workspace. After confirmation, the live run inspector opens.
|
||||
`--yes` requires a supplied name and nonempty prompt and does not approve tools.
|
||||
Use `--allow-tools` with `--yes` to explicitly approve declared tools;
|
||||
`--write-paths "internal/example.go"` grants exact existing Go-file edits.
|
||||
Current edit tooling is Go-specific, not arbitrary repository editing.
|
||||
|
||||
Installer workspace roots default to the user's home directory. Restrict them
|
||||
using repeatable `--workspace-root ~/repos` on initial setup. Runs outside those
|
||||
roots (including symlink escapes) are rejected by the server. Raw native servers
|
||||
default to their working directory; add `-workspace-root` to permit other repos.
|
||||
Do not expose the unauthenticated pipeline server to untrusted users.
|
||||
|
||||
## Templates and data
|
||||
|
||||
New databases are empty. Press **b** on Home or use `:templates` to browse optional
|
||||
examples, with rendered Markdown previews and **v** for source. Select a template,
|
||||
choose a unique name, edit it in `$VISUAL`/`$EDITOR` (or an available fallback),
|
||||
then explicitly submit. Existing names cannot be overwritten by this flow.
|
||||
Submitting a scheduled template activates its schedule; previewing never does.
|
||||
|
||||
Uninstall retains pipeline history, credentials, and the isolated ntfy volume:
|
||||
|
||||
```sh
|
||||
./uninstall.sh
|
||||
# Explicitly delete this installation's retained data too:
|
||||
./uninstall.sh --purge
|
||||
```
|
||||
|
||||
Reinstall at the same prefix to reuse retained data. Host OpenCode remains
|
||||
separate. Partial installations require inspection or explicit purge before retry.
|
||||
Use `--prefix PATH --bin-dir PATH --server-port PORT --ntfy-port PORT` for isolated
|
||||
testing; each prefix has its own Compose project and volume.
|
||||
|
||||
## Tester archives
|
||||
|
||||
```sh
|
||||
python3 scripts/package.py --platform darwin-arm64 --version 0.1.0-beta.1
|
||||
# Also: darwin-amd64, linux-amd64, linux-arm64, source
|
||||
```
|
||||
|
||||
Outputs go to `dist/` with a SHA-256 checksum. Archives include only allowlisted
|
||||
source, examples, docs, installation scripts, and optional release binaries—no
|
||||
databases, runtime drafts, `.env`, logs, or secrets. Extract, then run `./install.sh`.
|
||||
Cross-built Linux binaries, Linux systemd, system PATH installation, and automatic
|
||||
npm installation require separate execution tests; build success is not a runtime test.
|
||||
@@ -0,0 +1,52 @@
|
||||
# Installation verification
|
||||
|
||||
Executed on macOS (arm64), using an isolated prefix and ports 18080/18090;
|
||||
the development database and services were not targets of these checks.
|
||||
|
||||
- `go test -race -count=1 ./...`: passed, including fresh empty database,
|
||||
template catalog/create-only protection, workspace allowlisting and symlink
|
||||
rejection, multiline prompt, and run-state regressions.
|
||||
- `go vet ./...`: passed.
|
||||
- `python3 -m unittest discover -s scripts -p 'test_*.py'`: 14 passed (including
|
||||
unchanged argument forwarding to the shared CLI).
|
||||
- `./install.sh --yes --no-autostart --prefix <isolated> --bin-dir <isolated>`:
|
||||
installed native binaries plus isolated Docker ntfy, with private credentials.
|
||||
- Isolated `pipelines doctor`: both health endpoints and host OpenCode API passed.
|
||||
- Actual pseudo-terminal check (`check-install-cli.py` in the session's temporary
|
||||
storage): rendered template browser, editor return without automatic submission,
|
||||
explicit submission, fuzzy CLI selection, multiline composer, and supplied
|
||||
name/prompt confirmation passed.
|
||||
- Isolated `pipelines restart`, retained-data uninstall, reinstall, and a second
|
||||
terminal check: passed; the submitted pipeline survived reinstall.
|
||||
- Authenticated HTTP publication and phone-reader polling: passed. Actual Android
|
||||
app reception is **not tested**.
|
||||
|
||||
Full model-driven repository changes, launchd autostart, Linux systemd, privileged
|
||||
`--system-command`, and automatic npm CLI installation are **not tested**.
|
||||
Existing Go-file edit-scope restrictions still apply.
|
||||
|
||||
## CLI authoring checks
|
||||
|
||||
- `check-author-cli.py` (session temporary storage): isolated installed help,
|
||||
JSON draft/validate/submit/export/history, and real OpenCode session/skill
|
||||
activation passed. Interactive launch arguments were captured without a model turn.
|
||||
- `check-author-picker.py`: actual terminal fuzzy `edit` selection, draft creation,
|
||||
and real skill preload passed, again without a model turn.
|
||||
- CLI/server regression tests cover stale-version rejection, invalid submission
|
||||
rejection even with `--force`, create-only collisions, headless run idempotency,
|
||||
inspection/cancellation, and bounded waiting that leaves an active run intact
|
||||
on timeout. Execution is controlled in these tests, not a live model.
|
||||
|
||||
Full interactive model-driven pipeline authoring is **not tested**.
|
||||
|
||||
## Compiled Go command
|
||||
|
||||
- `GOBIN=<isolated> go install ./cmd/pipelines ./cmd/server ./cmd/tui`: passed.
|
||||
- Source installer now uses `go install`; isolated installation and retained-data
|
||||
reinstall passed. The command symlink resolved to a Mach-O Go binary, not a script.
|
||||
- Compiled command `help`, `list --json`, README three-stage example validation /
|
||||
submission, `doctor`, and `restart`: passed against isolated services.
|
||||
- A separately Go-installed CLI selected the same installation using
|
||||
`PIPELINES_PREFIX` and read the retained pipeline successfully.
|
||||
|
||||
Privileged `/usr/local/bin` linking, launchd, and Linux remain **not tested**.
|
||||
+150
@@ -0,0 +1,150 @@
|
||||
# Self-hosted ntfy delivery
|
||||
|
||||
Every stage can have an optional `notify` property block. Notifications go to
|
||||
your own ntfy instance and can attach Markdown and output files. It does not ask
|
||||
an LLM to handle credentials or run curl. The full Markdown remains in the run
|
||||
audit as well as the ntfy attachment. A separate HTML report viewer is not included.
|
||||
|
||||
## Per-stage notifications (recommended)
|
||||
|
||||
````markdown
|
||||
# stage compose
|
||||
|
||||
```notify
|
||||
on=success,failure
|
||||
artifacts=markdown,files
|
||||
```
|
||||
|
||||
...stage output, prompt, tools, edges, and configs...
|
||||
````
|
||||
|
||||
- `on` is `success`, `failure`, or `success,failure`. A failure is an execution
|
||||
error, the `error` outcome, or a route to `#failure`; any other completed stage
|
||||
is a success. This reports the stage's result, not the final run's result.
|
||||
- All notification hooks use one system-wide server-to-phone connection. Stages
|
||||
do not choose topics or addresses. Configure `PIPELINES_NTFY_URL` (publishing
|
||||
topic URL), `PIPELINES_NTFY_PUBLIC_URL` (phone-facing server base URL), and
|
||||
`PIPELINES_NTFY_TOKEN` or `PIPELINES_NTFY_TOKEN_FILE` once on the server.
|
||||
The topic is `pipelines` in the provided setup. No block means no notifications.
|
||||
Legacy `destination` lines remain parseable for immutable-history compatibility
|
||||
but no longer select a connection for notification hooks. Explicit native
|
||||
`type=ntfy` stages retain their separate destination configuration.
|
||||
- `artifacts=markdown` sends the string in `output.markdown` as `digest.md`.
|
||||
- `artifacts=files` sends paths listed in `output.artifacts`, e.g.
|
||||
`["reports/result.txt", "screenshots/chart.png"]`. Model stages with this policy
|
||||
are instructed to list files they actually created/modified. No workspace scan
|
||||
or file discovery occurs; an invalid model response may leave no artifact list.
|
||||
- Both artifact kinds can be selected. Each file gets a separate notification
|
||||
(ntfy supports one attachment per notification). If none were produced, an
|
||||
event-only notification is still sent, including on failure.
|
||||
- Files must be workspace-relative regular files, at most 1 MiB each and 10 files
|
||||
per stage. Traversal, absolute paths, symlinks, hidden paths, known database/key
|
||||
paths, `secrets/`, and `node_modules/` are rejected. These guards are not a
|
||||
content scanner/DLP system: only list files you intend to share.
|
||||
- Notifications have a 30-second total budget, with no automatic retries. Their
|
||||
receipts/failures appear in the selected run stage's **Metadata**, separately
|
||||
from output. They do not change routing or convert a successful stage into a
|
||||
failed run. A crash can leave a `sending` receipt with uncertain delivery;
|
||||
notifications are not replayed during recovery. Go checks/file edits still
|
||||
require manual approval; this setting does not grant extra tool access.
|
||||
|
||||
## Explicit delivery stage (optional)
|
||||
|
||||
The preceding stage must output three nonempty UTF-8 strings: `title`, `summary`,
|
||||
and `markdown`. Title/summary must be single-line (256/2048 byte limits); Markdown
|
||||
is limited to 1 MiB. Native delivery stages do not accept model prompts/tools or
|
||||
inline credentials. They require `destination` and a `success` edge:
|
||||
|
||||
````markdown
|
||||
# stage notify
|
||||
|
||||
```configs
|
||||
type=ntfy
|
||||
destination=anime
|
||||
```
|
||||
|
||||
```edges
|
||||
success -> #success
|
||||
error -> #failure
|
||||
```
|
||||
````
|
||||
|
||||
Configure the **pipeline server process** outside the pipeline file:
|
||||
|
||||
```sh
|
||||
export PIPELINES_NTFY_ANIME_URL='https://ntfy.your-domain.example/anime'
|
||||
# Set PIPELINES_NTFY_ANIME_TOKEN securely to a publishing user's access token.
|
||||
go run ./cmd/server
|
||||
```
|
||||
|
||||
The URL includes one topic, without credentials, query parameters, or a fragment.
|
||||
Other destinations use the same pattern: `destination=reports` reads
|
||||
`PIPELINES_NTFY_REPORTS_URL` and `PIPELINES_NTFY_REPORTS_TOKEN` (or `_TOKEN_FILE`
|
||||
pointing to a secret file). Set only one token source. Destination names
|
||||
use lowercase letters, digits, and underscores. A token is optional only when
|
||||
the configured server permits anonymous publishing; private deployments need it.
|
||||
Never put tokens in a prompt, committed file, or chat. Environment credentials
|
||||
are inherited by subprocesses: do not grant untrusted stages shell/code-execution
|
||||
access. Prefer a dedicated publishing user with write-only access to this topic.
|
||||
|
||||
## Local server
|
||||
|
||||
The root `compose.yaml` runs **both the pipeline server and ntfy** with persistent
|
||||
volumes, internal service networking, and a private topic. See the
|
||||
[Docker + Android setup](docker.md) for bootstrap, credentials, and timezone
|
||||
detection. The previous ntfy-only Compose file has been replaced. Docker's daemon
|
||||
was unavailable; deployment is **not tested**. HTTP integration tests use an
|
||||
ntfy-compatible test server, not a running ntfy instance.
|
||||
|
||||
Use a TLS reverse proxy or a private VPN (e.g. Tailscale). A phone cannot reach
|
||||
your computer's `127.0.0.1`; that address is only for local publishing/proxying.
|
||||
To bind the container to a particular LAN/VPN interface, explicitly set
|
||||
`NTFY_BIND_ADDRESS` to that interface IP. Do not expose an unauthenticated server,
|
||||
or send access tokens over public plain HTTP. Set `NTFY_BASE_URL` to the same
|
||||
address your phone uses so attachment URLs resolve correctly. If the pipeline
|
||||
server is another container, localhost is that container, not the ntfy host.
|
||||
|
||||
## Phone
|
||||
|
||||
Install the ntfy app, add your own server, authenticate with the reader account,
|
||||
and subscribe to `anime`. Ensure notifications and required background operation
|
||||
are allowed. Outside your home network, both topic subscriptions and attachment
|
||||
downloads need access to your server through VPN or public HTTPS.
|
||||
|
||||
For **iOS instant notifications**, ntfy's current documentation requires
|
||||
`NTFY_UPSTREAM_BASE_URL=https://ntfy.sh` (or an APNS-connected upstream with a
|
||||
custom app). The upstream sends wake-up requests; message content is fetched
|
||||
from your instance. This is not completely independent of third-party push
|
||||
infrastructure. Without upstream forwarding, delivery can be substantially
|
||||
delayed. Phone delivery/background behavior has **not been tested** here.
|
||||
|
||||
## Execution and failure behavior
|
||||
|
||||
- Publishing is bounded to 20 seconds and does not follow redirects.
|
||||
- No automatic publish retry: timeouts or malformed acknowledgments may mean the
|
||||
notification was delivered but its acknowledgment was lost. Inspect ntfy
|
||||
before retrying an ambiguous failure.
|
||||
- For the optional native `type=ntfy` stage, a confirmed response adds `delivery` metadata (destination name, message ID,
|
||||
attachment URL, filename) to the existing output. Failures take the error route
|
||||
and are recorded in normal run/step audits, without remote response bodies or
|
||||
credentials in diagnostics.
|
||||
- Repeating the same run request key does not publish again. A new run or a graph
|
||||
loop visiting delivery again can send another notification; content-level
|
||||
"only new items" deduplication is not yet implemented. For the initial digest,
|
||||
keep notification last with no feedback edge.
|
||||
- Markdown reports remain available in pipeline run history even after ntfy expires its
|
||||
attachment. Configure ntfy retention for your needs; its attachment directory
|
||||
must be dedicated to ntfy, not shared with other files.
|
||||
|
||||
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.
|
||||
|
||||
`examples/anime-digest.md` provides discover → compose with per-stage notification hooks and daily 19:00
|
||||
scheduling. It uses direct `webfetch` of Jikan's current-season API, avoiding the
|
||||
unconfigured OpenCode search-provider selection. The example is a file only;
|
||||
submitting it activates its schedule. Its anime/model/phone path is **not tested**.
|
||||
|
||||
References: [publishing](https://docs.ntfy.sh/publish/),
|
||||
[server configuration](https://docs.ntfy.sh/config/),
|
||||
[iOS self-hosting](https://docs.ntfy.sh/config/#ios-instant-notifications).
|
||||
@@ -0,0 +1,42 @@
|
||||
# UI/UX review: October 8, 2026
|
||||
|
||||
Five independent read-only reviewer sessions inspected executed `Model.View`
|
||||
renders of Home, pipeline details, selected/focused/scrolled stages, native
|
||||
delivery, and run inspection at 80/120/160 columns. Fixes were applied between
|
||||
rounds. Snapshot review does not establish color accessibility or phone delivery.
|
||||
|
||||
| Round | Findings and changes |
|
||||
| --- | --- |
|
||||
| 1 | Added stage row ranges, horizontal graph overflow arrows/pan hint, and full-height column separators. |
|
||||
| 2 | Balanced graph/detail space; expanded focused details; added textual focus/selection and complete selected-run headings; made title truncation explicit. |
|
||||
| 3 | Exposed tools/notify in narrow configuration columns; preserved run statuses separately from shortened names; corrected run page size. |
|
||||
| 4 | Made pinned field headings follow the actual scrolled group; exposed page-scroll keys; preserved HTTP/HTTPS in compact endpoint text. |
|
||||
| 5 | No material remaining usability findings in the reviewed renders. |
|
||||
|
||||
Requested changes: `n`/`p` select next/previous stages on pipeline details,
|
||||
wrap at either end, reset detail scroll, and reveal the selected graph stage.
|
||||
Home `n` still creates a pipeline; text-entry/modal pages retain their own keys.
|
||||
The global ntfy server URL/topic now appear in the top bar beside the server
|
||||
address, instead of a home-page panel. Extremely narrow terminals truncate text
|
||||
with an ellipsis rather than overflowing.
|
||||
|
||||
Verification executed after changes:
|
||||
|
||||
- `go test -race -count=1 ./...`
|
||||
- `go vet ./...`
|
||||
- Go server and TUI builds.
|
||||
- Actual TUI through a pseudo-terminal: connected to the local server, opened
|
||||
the published anime pipeline, verified top-bar ntfy URL/topic, `n`/`p`
|
||||
next/previous/wrap, Tab focus, Esc home, and Home `n` opening the draft form.
|
||||
|
||||
`PIPELINES_UX_SNAPSHOT_DIR=<directory> go test ./internal/tui -run
|
||||
TestUIUXReviewSnapshots -count=1` regenerates rendered snapshots without server
|
||||
mutations. Temporary snapshot/reviewer artifacts are under the session's
|
||||
approved temporary directory, not committed runtime data.
|
||||
|
||||
The real anime pipeline is `examples/anime-today.md`: dated web evidence →
|
||||
verify/enrich → Markdown report → native ntfy attachment, using the system
|
||||
connection. It is submitted as **anime episodes today v1**, pipeline **8**, with
|
||||
no schedule. Its full model/web/phone execution has **not been tested**. The
|
||||
LiveChart schedule was fetched during source investigation; the final delivery
|
||||
stage uses the existing native publisher, not credentials handled by a model.
|
||||
Reference in New Issue
Block a user