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
10 changes: 7 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ on:

permissions:
contents: read
# [2026-09-07]-[npm OIDC trusted publishing: no long-lived NPM_TOKEN; requires the package's Trusted Publisher on npmjs.com to match repo/workflow/environment]-[publish authenticates via short-lived OIDC tokens; provenance is generated automatically]
id-token: write

jobs:
publish:
# [2026-09-06]-[only main-branch releases may publish to npm; dev-branch releases are ignored]-[prevents accidental npm publish from dev]
if: github.event.release.target_commitish == 'main'
# [2026-09-07]-[route the publish through the release-publish environment: required-reviewer approval gate + branch/tag policy (environment needs a v* tag rule since release runs carry refs/tags/*)]-[each release waits for manual approval before npm publish]
environment: release-publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
Expand All @@ -19,7 +23,8 @@ jobs:

- uses: actions/setup-node@v5
with:
node-version: 22
# [2026-09-07]-[trusted publishing needs npm >= 11.5.1; node 22's bundled npm is too old]-[node 24 ships a compatible npm]
node-version: 24
registry-url: https://registry.npmjs.org/

- name: Verify tag matches package version
Expand All @@ -43,7 +48,6 @@ jobs:
- name: Build
run: bun run build

# [2026-09-07]-[OIDC trusted publishing: npm exchanges the workflow's OIDC token for a short-lived publish token; no NODE_AUTH_TOKEN]-[long-lived NPM_TOKEN secret is no longer used by this workflow]
- name: Publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

This project follows [Semantic Versioning](https://semver.org/). Release notes describe user-visible behavior; implementation details remain in the technical specification and commit history.

## [1.0.2] - 2026-09-07

### Added

- **Version line in the TUI sidebar marquee row** — the rainbow `switchman` title now shows the running version (local builds append the checked commit short SHA) and, when the 24h-cached update check reports a newer release, a green `→ v<latest>` tag (`→ origin/main` for local builds; suppressed by `/switchman-ignore` exactly like the update banner). The blinking bold-red `[RESTART NEEDED]` tag — previously keyed only on pending shell registration (`active-matrix.json.restartRequired`) — now also covers installed-but-not-loaded upgrades: it lights up when `/switchman-update` touched `upgraded.flag` this session or the on-disk package version differs from the running one (out-of-band upgrades), merging with the shell-registration case into one indicator; both clear naturally after a restart. All sources are fail-open: missing state renders just the bare running version.

### Fixed

- **Language-preference ask no longer lost after a skipped first turn** — the ask directive was injected only on a session's first turn (one-shot in-memory latch), and main models routinely skipped the question and dove into the task, so unconfigured projects were never prompted again. Two layers fix it: the latch resets on every new user message (the ask re-surfaces at the start of each user turn until the config is persisted to `.switchman/settings.json`), and a hard gate denies write/edit/bash/task calls with an ask-first error while the project is unconfigured — the question no longer depends on the model's goodwill. A completed question call the user declines waives the gate and the ask for that session; `lang.ask: false` silences both. The directive is also pushed as the first injected system part and is never injected into shell/internal sessions.

## [1.0.1] - 2026-09-07

### Added
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ The log also shows `[opencode-switchman] injected N model shells (agents)` — N

### Sidebar status panel (TUI plugin, optional)

v0.2.0 adds a live `switchman` panel at the bottom of the OpenCode TUI sidebar; v1.0.0 polishes it into a fully aligned, English-localized operational view. Observed provider water levels render as gradient bars on a globally aligned 8-column grid (labels, bars, and reset times line up across provider blocks; any non-zero quota paints at least one filled cell), with peak-period warnings, per-provider observe-only tags (collapsed when every provider observes), the current head candidate for each of the six lanes, restart-required badges for newly detected models/providers, and the most recent status notice. The panel polls local state every 2 seconds; non-banner notices never flood `stderr` or cover the input box. It is a separate TUI Slot plugin (`src/tui.tsx`, exported at `opencode-switchman/tui`) and is independent of the server-side hook plugin above.
v0.2.0 adds a live `switchman` panel at the bottom of the OpenCode TUI sidebar; v1.0.0 polishes it into a fully aligned, English-localized operational view. Observed provider water levels render as gradient bars on a globally aligned 8-column grid (labels, bars, and reset times line up across provider blocks; any non-zero quota paints at least one filled cell), with peak-period warnings, per-provider observe-only tags (collapsed when every provider observes), the current head candidate for each of the six lanes, restart-required badges for newly detected models/providers, a version line on the marquee row (the running version — local builds append the checked commit short SHA — plus a green `→ v<latest>` when the update check reports a newer release, `→ origin/main` for local builds; the blinking `[RESTART NEEDED]` tag also lights up while an installed upgrade awaits a restart), and the most recent status notice. The panel polls local state every 2 seconds; non-banner notices never flood `stderr` or cover the input box. It is a separate TUI Slot plugin (`src/tui.tsx`, exported at `opencode-switchman/tui`) and is independent of the server-side hook plugin above.

> **Recommended workflow**: set the plugin up in the TUI first — pick model favorites, tune `/poolConfig` and `/modelRank`, and watch the sidebar while it routes. The desktop app is an optional alternative afterwards (it shares the same config and state); the TUI is simply where the operational surface — dialogs, sidebar, banners — is richest.

Expand Down Expand Up @@ -188,11 +188,12 @@ Both commands can also be driven directly via the bundled CLI: `node <pkg>/dist/

- **Shell subagent context hard cap**: every shell subagent session now has a hard context cap (`context.subagentForceTokens`, default 100k tokens) — past the cap every tool call is denied with a wrap-up order, the subagent hands back a detailed progress summary as its task result, and the session can never be resumed via `task_id` (persistent registry); configured via `context.subagentCap` (see [Subagent context hard cap](#subagent-context-hard-cap)).
- **Always-on per-call read budget (core routing algorithm update)**: the old per-tool one-time nudge (a coupon models rationally burned via retry/probing) is replaced by a deterministic budget gate. Every read is costed against `context.readBudgetTokens` (default 1500, clamped 200..20000) from turn 1 — over-budget reads are auto-bounded (a `limit` is appended in place) or denied with exact bounded-retry params; a per-turn 2× self-read cap (resetting on user turns) stops read chains; un-estimable tool outputs are charged post-hoc. Watermarks keep lifecycle duties only (soft = advice, hard = wrap-up deny, force = auto-handover). Delivery/verification bash (git, test/lint, build) passes at every tier; unbounded archaeology (`git log -p` without `-n`) is denied at every tier with a scoping hint.
- **Per-project language preference**: a per-turn `[LANG]` iron-rule line pins the conversation / comments & commits / docs languages, captured by a first-use ask (once per session), persisted per project, adjustable via `/switchman-lang`.
- **Per-project language preference**: a per-turn `[LANG]` iron-rule line pins the conversation / comments & commits / docs languages, captured by a first-use ask (re-surfaced at the start of every user turn until configured, and enforced by a hard gate — write/edit/bash/task calls are denied with an ask-first error while the project is unconfigured; the user's decline waives the gate for that session), persisted per project, adjustable via `/switchman-lang`.
- **Todo discipline**: protocol §0.7 plus a per-turn `[TODO]` status line keeps the main session's todo list real-time current (delegated-shell results included).
- **/expert expert consultation** and **bundled agent skills**: dispatch requirements to the strongest cross-family expert; opinionated skills sync into the opencode global skills dir at startup (add/overwrite-only, marker-gated cleanup, fail-open).
- **Review-lane last resort**: with no cross-family read-only shell alive, the chain keeps the best ro shells and same-family review is allowed with a `DOWNGRADED` note instead of an empty chain.
- **Auto-handover robustness**: numbered `[backup]` sessions (survives restarts, never recycles numbers), compaction routed through the same channel as the manual `/compact`, and a detached compaction leg that can no longer deadlock the session.
- **Sidebar version line**: the marquee row shows the running version and, when the update check reports a newer release, the latest version; the blinking `[RESTART NEEDED]` tag now also covers installed-but-not-loaded upgrades (see [Sidebar status panel](#sidebar-status-panel-tui-plugin-optional)).
- **tmux pane mirroring**: when the opencode server itself runs inside tmux, every dispatched subagent opens as a live `opencode attach` pane stacked in a right-hand column of the home tmux window — capped visible panes with a FIFO queue, in-place respawn, auto re-evening on completion, and full fail-open safety (see [tmux pane mirroring](#tmux-pane-mirroring-optional)).

### v1.0.0 — English-first stable release
Expand Down Expand Up @@ -231,7 +232,7 @@ See the complete, user-facing release notes and migration guide in [CHANGELOG.md
| `injection.mode` | `chain` | Shell injection face: `chain` = six lane chains ∪ favorites/visible models (saves ~6-10k tokens of task-tool description per session; naming an off-chain model gets a `denyUninjected` hint to enable it in model management), `all` = every usable model (old behavior). Startup-level: restart to apply |
| `dispatch.autoRedirect` | `true` | On a dispatch deny, rewrite `subagent_type` in-flight to the chain-head candidate the deny message already names (single hop, same-snapshot guard re-check) — the first dispatch lands on the best available shell instead of burning deny-and-retry rounds; `false` restores deny-and-retry |
| `relay.image` | `true` | Vision-less main models: user-attached images are decoded to disk and replaced with path text + reading guidance (delegate a vision-lane shell or an MCP vision tool); local paths / http URLs pass through; fully fail-open |
| `lang.enabled / ask / candidates` | `true / true / factory list` | Per-project language preference: per-turn `[LANG]` iron-rule line (conversation / comments & commits / docs), first-use ask once per session, persisted to `.switchman/settings.json` (AGENTS.md marker as read-only fallback), `/switchman-lang` re-asks |
| `lang.enabled / ask / candidates` | `true / true / factory list` | Per-project language preference: per-turn `[LANG]` iron-rule line (conversation / comments & commits / docs), first-use ask re-surfaced every user turn until configured and enforced by a hard gate (write/edit/bash/task denied while unconfigured; decline waives per session), persisted to `.switchman/settings.json` (AGENTS.md marker as read-only fallback), `/switchman-lang` re-asks |
| `lanes` | built-in chains | Custom per-lane shell chains (override built-in preference order); keys = economy/mechanical/main/hard/vision/review |
| `workspace.enabled / dirname` | `true / ".switchman"` | Artifact workspace: per main session, a `<project-root>/.switchman/<yyyy-mm-dd>/<sessionId>-<title>/` folder whose path is injected into the dispatcher protocol every turn; holds `SESSION.md` / `dispatches.jsonl` / `media/`. Disabled = no folders created and the protocol section is neutralized |
| `tmux.enabled / rightPct / maxPanes / mini` | `true / 60 / 3 / false` | tmux pane mirroring (effective only when the opencode server itself runs inside tmux): every dispatched subagent opens as a live `opencode attach` pane in a right-hand column of the home tmux window; `rightPct` = right column width percent (10..90, main pane keeps the rest), `maxPanes` = max visible subagent panes (1..4; extra dispatches wait in a FIFO queue), `mini` = minimal attach interface instead of the full TUI |
Expand Down
Loading