Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,22 @@ jobs:
env:
LUAU: ${{ github.workspace }}/luau-bin/luau
TERN_SIDEPULSE_REQUIRE_LUAU: "1"

sidepulse-contract:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check out SidePulse at the verified revision (the inteliwear/sidepulse#72 merge)
uses: actions/checkout@v4
with:
repository: inteliwear/sidepulse
ref: ad4a5217fd3a833cfa2a12e1eaf055f22948cd53
path: sidepulse
persist-credentials: false
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- run: python -m unittest tests.test_sidepulse_contract -v
env:
SIDEPULSE_SRC: ${{ github.workspace }}/sidepulse/src
TERN_SIDEPULSE_REQUIRE_CONTRACT: "1"
10 changes: 6 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Changelog

## Unreleased
## 0.2.0 — 2026-11-10

- Per-pane rows in the coordinator (`tern_sidepulse/coordinator.py`, `tern_sidepulse/reducer.py`): observations are keyed by `(host, pane)` (`local`, or a remote host's `address`, `name`, or `id:<n>`) and deduplicated across windows by mode priority (`blocked_error`, `waiting_for_input`, `working`, `completed`, `idle_ready`) and newest label, while the SidePulse hook-event transport continues to emit one combined session (`OMP in Tern`).
- In-memory session labels (`window.luau`, `tern_sidepulse/reducer.py`, `tests/test_privacy.py`, `tests/test_rows.py`): when a window has at least one OMP pane, `window.luau` reads `cx.session:panes()` and `cx.session:tabs()` at most once per 5 s pass and labels each OMP pane from its user-given tab name (`TabInfo.name`) or its own `PaneInfo.title` (cut to 256 UTF-8 bytes in the window and sanitized in the coordinator to at most 96 characters without control, surrogate, or private-use characters). Labels and host keys stay in coordinator memory only and never appear in `coordinator.log`, `doctor.json`, `bridge.py status`, coordinator acknowledgements, or the SidePulse payload (`status` and `doctor` report row counts and allow-listed diagnostic counters only).
- **Breaking requirement — SidePulse with `program_status` ([inteliwear/sidepulse#72](https://github.com/inteliwear/sidepulse/pull/72))**: Requires a SidePulse build installed or updated with `sidepulse update` on or after 2026-11-10 (merge commit `ad4a5217`). When an older SidePulse is present (`relay-events.sock` without `program-status.sock`), `tern-sidepulse: doctor` reports an error on `receiver` (`this SidePulse predates program status`) with the remedy `sidepulse update`. Use `tern-sidepulse` `0.1.0` for older SidePulse builds.
- SidePulse program-status transport (`tern_sidepulse/transport.py`, `tern_sidepulse/coordinator.py`, `tern_sidepulse/doctor.py`): replaces the 0.1.0 hook-event transport (`events.sock`, `relay-events.sock`, `UserPromptSubmit`/`Interrupt`/… hook-event lines, and the single combined `tern-sidepulse:<install_id>` session) with `SidePulseTransport` over SidePulse's `program-status.sock` (`$XDG_STATE_HOME/sidepulse/agent-monitor/program-status.sock`, `~/.local/state/sidepulse/agent-monitor/program-status.sock`, or `/tmp/sidepulse-status-<uid>/<sha256(path)[:16]>.sock` when the `program-status.sock` path exceeds 96 bytes). Each OMP session is reported as its own row under salted scope `tern-sidepulse-<24 hex>` (`sha256(install_id NUL host NUL pane)[:24]`, salted by `install_id` from `identity.json`), mapped to states `working`, `blocked` (`waiting_for_input`), `error` (`blocked_error`), `done` (`completed`), `idle` (`idle_ready`), and `clear` across at most 32 rows (most urgent first). Unchanged rows are not resent; active rows (`working`, `blocked`, `error`) refresh every 300 s; retries reuse `request_id` with 2, 4, 8, 16, 30 s backoff and wake immediately when a socket appears or changes; SidePulse restarts (including a move to another socket candidate) resubmit every current row except delivered `done` rows; and a scope ledger (`<runtime dir>/program-scopes.json`, mode `0600`, salted scope hashes only) written before each scope's first report lets the next coordinator overwrite still-open panes in place and clear stale ones after a 15 s grace period following a crash (at once if they would exceed the 32-row cap). An exiting coordinator keeps clearing rows for up to 2 s, and `disable` now stops the coordinator after clearing its rows, so the coordinator that `enable` lets the next snapshot start reads `config.json` afresh.
- Per-pane rows and session labels (`window.luau`, `tern_sidepulse/coordinator.py`, `tern_sidepulse/reducer.py`, `tests/test_privacy.py`, `tests/test_rows.py`, `tests/test_transport.py`): observations are keyed by `(host, pane)` (`local`, or a remote host's `address`, `name`, or `id:<n>`) and deduplicated across windows by mode priority (`blocked_error`, `waiting_for_input`, `working`, `completed`, `idle_ready`) and newest non-empty label. When a window has at least one OMP pane, `window.luau` reads `cx.session:panes()` and `cx.session:tabs()` at most once per 5 s pass and labels each OMP pane from its user-given tab name (`TabInfo.name`) or its own `PaneInfo.title` (cut to 256 UTF-8 bytes in the window and sanitized in the coordinator to at most 96 characters without control, surrogate, or private-use characters). Sanitized labels are sent to SidePulse in `context.title` by default (`"labels": false` in `<plugin data dir>/config.json` sends `"title": ""` and `"display_name": "OMP in Tern"` instead); host keys never appear outside coordinator memory, pane ids and host keys never leave the Mac (SidePulse reports and `program-scopes.json` carry salted scope hashes only), and labels never appear in `coordinator.log`, `doctor.json`, `bridge.py status`, coordinator replies, or `program-scopes.json`.
- Configuration, environment, CLI, and status updates (`tern_sidepulse/cli.py`, `tern_sidepulse/client.py`, `tern_sidepulse/doctor.py`): `<plugin data dir>/config.json` takes `program_sockets` (replacing `ui_sockets` and `service_sockets`, which are ignored if still present) and `labels` (`false` disables labels); `TERN_SIDEPULSE_PROGRAM_SOCKETS` replaces `TERN_SIDEPULSE_UI_SOCKETS` and `TERN_SIDEPULSE_SERVICE_SOCKETS`; `bridge.py coordinator --program-socket PATH` (repeatable) replaces `--ui-socket` and `--service-socket`; `doctor` replaces `receiver_ui` and `receiver_service` with `receiver` (plus `receiver_rejections` when SidePulse rejects a report) and shows `install <first 8 chars>…` on its `identity` check; and `status` drops `session_id` in favour of per-mode `rows` counts, `rows_total`, `rows_labelled`, `status.transport`, and `delivery = {"program_status": …}` in coordinator replies.
- Snapshot budget and request limits (`window.luau`, `tern_sidepulse/limits.py`): the window keeps each encoded snapshot within 192 KiB by dropping labels and retrying once (`labels_dropped`), host keys are capped at 128 bytes in the window and 128 characters in the coordinator, and the coordinator request cap is raised from 256 KiB to 1 MiB.
- Headless Luau window harness (`tests/luau/`, `tests/test_luau_harness.py`, `.github/workflows/ci.yml`): runs the real `window.luau` under the `luau` 0.745 CLI across the backoff/interpreter/latch/role test drive (`drive_backoff.luau`, scenarios A–G), the label and host-key drive (`drive_labels.luau`, scenarios L1–L12), and the snapshot-budget drive (`drive_budget.luau`, scenarios B1–B3), bringing the suite to 155 unit and integration tests.
- Headless Luau window harness and contract checks (`tests/luau/`, `tests/test_luau_harness.py`, `tests/test_sidepulse_contract.py`, `.github/workflows/ci.yml`): runs the real `window.luau` under the `luau` 0.745 CLI across the backoff/interpreter/latch/role test drive (`drive_backoff.luau`, scenarios A–G), the label and host-key drive (`drive_labels.luau`, scenarios L1–L12), and the snapshot-budget drive (`drive_budget.luau`, scenarios B1–B3), and checks the `program_status` wire contract against SidePulse `ad4a5217`.

## 0.1.0 — 2026-11-05

Expand Down
42 changes: 23 additions & 19 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ behavior claims are backed by evidence, privacy boundaries stay intact, and the
`TERN_SIDEPULSE_REQUIRE_LUAU=1` to fail instead of skipping when `luau` is absent). An Oh My Pi session started at
the repository root runs the same analysis while editing: [`.omp/lsp.json`](.omp/lsp.json) launches `luau-lsp lsp`
with these definitions on the standard (non-Roblox) platform, for diagnostics and hover on `.luau` files.
- **Tern 0.9.12 on macOS**: required only for manual end-to-end checks against a live Tern window and SidePulse's agent
monitor (`events.sock` and `relay-events.sock`); see [`docs/compatibility.md`](docs/compatibility.md) for the probe
and integration checks.
- **Tern 0.9.12 or later on macOS**: required only for manual end-to-end checks against a live Tern window and SidePulse's
`program-status.sock` receiver; see [`docs/compatibility.md`](docs/compatibility.md) for the probe and integration
checks.
- **Headless Chrome and `ffmpeg` (with `ffprobe` and `libx264`; `/opt/homebrew/bin/gifsicle` optional)**: required only
when regenerating brand artwork (`assets/*.png`) or demo media (`docs/media/*`) with `scripts/render_assets.py`.

Expand All @@ -34,8 +34,9 @@ python3 -B -m unittest discover -s tests -t . -v # -B keeps bytecode out of a
luau-lsp analyze --definitions=types/tern.d.luau window.luau
```

Set `SIDEPULSE_PYTHON` to a SidePulse interpreter (defaults to `~/.local/share/sidepulse/venv/bin/python` when present)
to run `tests/test_sidepulse_contract.py` against the installed SidePulse normalizer, and set
Set `SIDEPULSE_SRC=<sidepulse checkout>/src` to run the optional SidePulse contract test
(`SIDEPULSE_SRC=<sidepulse checkout>/src python3 -m unittest tests.test_sidepulse_contract`, skipped without it; CI
runs it against `inteliwear/sidepulse` at `ad4a5217` with `TERN_SIDEPULSE_REQUIRE_CONTRACT=1`), and set
`TERN_SIDEPULSE_SLOW_TESTS=1` to include the 20 s default-limits timing test in `tests/test_e2e.py`.

## Working with a linked checkout
Expand All @@ -57,22 +58,25 @@ to run `tests/test_sidepulse_contract.py` against the installed SidePulse normal
## Invariants and documentation standards

1. **Standard library only**: do not add third-party Python packages, external runtime tools, or network calls.
2. **Privacy invariants (`tests/test_privacy.py`, `tests/test_rows.py`)**: the window observer (`window.luau`) reads
only `pane`, `state`, `kind`, `program`, `host`, and `alive` from `cx.agents:list()`; `id`, `state`, `panes`, `kind`,
`address`, and `name` from `cx.hosts:list()`; `surface.role` from `cx.session:surface(pane, {nodes = 1, depth = 1})`;
and, at most once per 5 s pass when the window has at least one OMP pane, `pane`, `tab`, and `title` from
`cx.session:panes()` and `id` and `name` from `cx.session:tabs()`. Labels come only from user-given tab names
(`TabInfo.name`) and OMP panes' own `PaneInfo.title` (never `TabInfo.title`), and the plugin never reads working
directories, model names, commands, prompts, assistant text, tool arguments, or transcript paths. Labels and host
keys stay in the coordinator's memory only: they are never logged in `coordinator.log`, persisted to disk, returned
by `bridge.py status` or `doctor.json`, echoed in coordinator acknowledgements or rejections, or sent to SidePulse by
the hook-event transport. `tests/test_privacy.py` pins that sentinels in labels, host keys, and extra client fields
never leave the coordinator, `doctor.json` filters window diagnostics to allow-listed integer counters, and the
SidePulse socket payload's `line` object carries only its seven fixed status keys plus `"prompt"` on `working`
events (where `"prompt"` is always the constant `"OMP in Tern"`, never user prompt text or a pane label).
2. **Privacy invariants (`tests/test_privacy.py`, `tests/test_rows.py`, `tests/test_transport.py`)**: the window
observer (`window.luau`) reads only `pane`, `state`, `kind`, `program`, `host`, and `alive` from `cx.agents:list()`;
`id`, `state`, `panes`, `kind`, `address`, and `name` from `cx.hosts:list()`; `surface.role` from
`cx.session:surface(pane, {nodes = 1, depth = 1})`; and, at most once per 5 s pass when the window has at least one
OMP pane, `pane`, `tab`, and `title` from `cx.session:panes()` and `id` and `name` from `cx.session:tabs()`. Labels
come only from user-given tab names (`TabInfo.name`) and OMP panes' own `PaneInfo.title` (never `TabInfo.title`),
and the plugin never reads working directories (`cwd`), model names, commands, prompts, assistant text, tool
arguments, or transcript paths. By default, sanitized labels are sent only to SidePulse in `program_status` reports
(`context.title`), and setting `"labels": false` in `<plugin data dir>/config.json` sends `"title": ""` and
`"display_name": "OMP in Tern"` instead. Host keys never appear outside coordinator memory, and pane ids and host
keys never leave the Mac: SidePulse scopes (`tern-sidepulse-<24 hex>`), `context.session_id`, and the write-ahead
scope ledger (`program-scopes.json`) hold only salted `sha256(install_id NUL host NUL pane)[:24]` hashes (`install_id`
from `identity.json`; local `status` and `doctor.json` list pane ids of active outcome notices). Labels and host keys never appear in
`coordinator.log`, `doctor.json`, `bridge.py status`, coordinator acknowledgements or rejections, or
`program-scopes.json`, a rejected report logs fixed text only (never SidePulse's error string), and `doctor.json`
filters window diagnostics to allow-listed integer counters.
3. **Exact versions in documentation**: compatibility and behavior claims in `README.md` and
[`docs/compatibility.md`](docs/compatibility.md) name the exact Tern, OMP, SidePulse, and macOS versions they were
exercised against, and never describe a local socket write as physical LED output.
exercised against, and never describe a local socket write or acknowledged report as physical LED output.

## Brand, media, and public site

Expand Down
Loading
Loading