# Pie v0.7.0 — Concurrent sessions + custom OpenAI-compat providers

**Release date:** 2026-05-08
**Manifest:** `0.7.0`
**Artifact:** `pie-0.7.0.zip` (208 KB)
**SHA-256:** `e4bd9285118c54a30147dcbc07ae34ce3e8bfbec79ea17fb2f4c13df5007d3eb`

This release ships two large pieces. **Concurrent sessions** — multiple agent loops can now run in parallel without blocking each other; opening a new session no longer stops the task you left running, and the side panel keeps each session's stream wired even when you switch tabs in the drawer. **Custom OpenAI-compat providers** — Settings has a new "CUSTOM PROVIDERS" section where you can register any OpenAI-compatible endpoint (your own proxy, a self-hosted gateway, an Azure deployment, etc.) with per-model `vision` / `tools` / `maxContextTokens` capability flags, and use it as a first-class provider alongside the eight built-ins. A small per-model vision-guard fix and a repo rename round it out.

---

## ✨ Highlights

### Concurrent sessions (closes #30, M3-U6+)

- **Sessions run in parallel.** Starting a new session no longer stops the one you left running, and switching the active session in the drawer no longer interrupts whichever stream is in flight. The "stop the current task before starting a new session" guard from v0.6.x is gone — `createAndActivate` just spins up a fresh slot, and the old loop keeps streaming in the background until it finishes (or you Stop it explicitly).
- **Per-session panel state.** The side panel's runtime state migrated from a global single-tenant model to a per-session `Map<sessionId, SessionRuntimeSlot>` hub. `streamingRef`, `agentMessagesRef`, `confirmStateRef`, `pinnedTabsRef`, `currentFocusTabIdRef`, etc. are all keyed by session — what you see in chat is just whatever slot the active session points at.
- **Per-session port hub.** `portsRef` is now `Map<sessionId, Port>` and every port's `chat-chunk` / `chat-done` / `chat-error` / `agent-step` / `agent-confirm-request` / `agent-done-task` / `session-confirm` / `session-toast` / disconnect message goes through a `createPortHandlers(sessionId)` factory. Background streams are routed to the slot that owns them, not to "the current panel".
- **Background sessions stay alive.** When you switch sessions, the previous session's port stays connected, its keep-alive 25 s tick keeps the SW awake, and `agent-done-task` still arrives even if you're looking at another session's chat. The slot's `streaming` flag flips to `false` and the toast / drawer indicator updates.
- **SW changes that go with it.**
  - The R13(c) `evictOnSetActive` call site is removed — `setActive` no longer stops the previous session's loop just because the active pointer moved.
  - The SW `keepAliveAlarm` is now scoped to the set of in-flight tasks (started on first `chat-start` / `resume-task`, stopped when the last in-flight task finishes), instead of running unconditionally for the side panel's lifetime.
- **Cross-layer regression test.** `tests/cross-layer/agent-done-task-transit.test.ts` exercises the wire path "SW emits `agent-done-task` for session B → panel receives on its background-routed handler → updates slot B → drawer indicator clears → active session A's UI is untouched". This is the explicit invariant called out in `feedback_cross_layer_integration_tests.md`: high unit test count doesn't replace a wire-transit integration test.
- **What's still serial.** Agent loops run concurrently; tool dispatch on the same `pinnedTabId` is still serialised via the existing `queueTabOp` mutex, the cross-session `R7` lock still prevents two sessions from touching the same tab in conflicting ways, and CDP `ownerToken={sessionId, tabId}` is unchanged — concurrent sessions don't loosen any of the M3 sandbox invariants.
- **Trace doc.** `docs/solutions/2026-05-03-multi-session-invariant-trace.md` §M3-U6 (appended).

### Custom OpenAI-compat providers (closes #41)

- **Bring your own endpoint.** Settings → **CUSTOM PROVIDERS** (new section, sibling to "MY CONFIGS") lets you register a provider with a name, base URL, and a list of models. Once created, a custom provider is selectable from the New-Config wizard exactly like a built-in. Use it for self-hosted gateways, Azure OpenAI deployments, OpenAI-compatible proxies (LiteLLM, OneAPI, etc.), or third-party providers Pie doesn't ship as a built-in.
- **Per-model capability flags.** Each model entry has `vision`, `tools`, and `maxContextTokens` editable in the form's "Advanced" section, mirroring the per-model `ModelMeta` schema introduced in v0.6.0. The image-attach button and tool-use eligibility follow the same rules as built-in models.
- **Provider × N instance.** Custom providers fit the existing "one provider, multiple instances" model — you can have `MyGateway: Work` and `MyGateway: Personal` instances under one custom provider, each with its own API key / nickname / active model.
- **Test connection.** The form has a **Test connection** button that calls `${baseUrl}/v1/models` (or `${baseUrl}/models` if the base already ends in `/vN`) with the optional API key and reports whether the endpoint responds. The shared `fetchOpenAICompatModels` helper auto-normalises the base URL so you can paste either form.
- **Wire-level shape.**
  - New entity `StoredCustomProvider { id, name, baseUrl, models: CustomModelMeta[] }` stored under `custom_provider_${uuid}` with an index at `custom_providers_index`.
  - `Provider` widened to `BuiltinProvider | \`custom:${string}\`` — old data with `provider: "openai"` etc. stays valid (zero-migration).
  - `streamChatByProvider` record replaced by `dispatchStreamChat(config)` function that resolves built-ins from the registry and custom providers from storage.
  - Custom providers always go through `_shared/openai-compat-core.ts` with standard Bearer auth and no provider-specific hooks.
- **Cascade-block on delete.** Deleting a custom provider that still has instance references throws and prompts you to delete the instances first, the same UX as deleting a built-in instance with active sessions.
- **What's explicitly out of scope.** Editing built-in provider base URLs (still locked to `defaultBaseUrl`), custom providers running native protocols (Anthropic / Gemini wire format), per-instance base URL overrides, custom HTTP headers UI, and remote preset libraries are all punted — see the spec doc for the rationale.
- **Spec / trace.** `docs/specs/2026-05-07-custom-providers-design.md`; `docs/solutions/2026-05-07-custom-providers-invariant-trace.md`.

## 🐞 Fixes

- **Screenshot vision guard reads per-model flag (closes #35, #39).** The agent's screenshot tools (`capture_visible_tab` / `capture_fullpage_tab`) used to consult a per-provider vision boolean that v0.6.0 had already turned into per-model `ModelMeta.vision`. The guard now reads the active instance's resolved model meta, so a provider with mixed text-only / vision models lets the screenshot tool fire on vision models and fail-fast on the text-only ones (instead of "always allowed" or "always blocked" depending on which way the stale flag was set).

## 📝 Other changes

- **Repo renamed `WiseriaAI/Pie` → `WiseriaAI/pie-ai-agent`.** All README / docs links updated. Old GitHub URLs redirect, but new clones / Releases pages should use the new name.
- **`docs/ARCHITECTURE.md` added** — high-level invariants + module map, linked from README.
- **`LICENSE`** restored to the canonical Apache-2.0 text.
- **README** now leads with browser-automation capabilities; BYOK explanation moved further down.

## ⚠️ Permissions

No changes. `manifest.json` `permissions` and `host_permissions` are identical to v0.6.1. Custom OpenAI-compat providers reuse the existing `<all_urls>` host permission that v0.6.0 already required for streaming + `/v1/models` fetches against arbitrary endpoints. Reload the unpacked extension to pick up the new bundle, but Chrome won't prompt for any new capabilities.

## 📦 Install

### Option A — GitHub Release zip

1. Download `pie-0.7.0.zip` from the **Assets** section of this release.
2. (Optional) Verify the SHA-256:
   ```bash
   shasum -a 256 pie-0.7.0.zip
   # expected: e4bd9285118c54a30147dcbc07ae34ce3e8bfbec79ea17fb2f4c13df5007d3eb
   ```
3. Unzip to a directory you'll keep around (Chrome reads from this directory at runtime — don't delete it after install).
4. Open `chrome://extensions`, enable **Developer mode** (top right).
5. Click **Load unpacked** and select the unzipped directory.
6. Pin Pie to the toolbar; click the icon to open the side panel.

### Option B — Build from source

```bash
git clone https://github.com/WiseriaAI/pie-ai-agent.git
cd pie-ai-agent && pnpm install && pnpm build
```

Then load `dist/` as an unpacked extension.

## Upgrading from v0.6.1

- Manifest bumped `0.6.1 → 0.7.0`. **Reload the unpacked extension** (`chrome://extensions → reload`) to pick up the new bundle.
- **No storage migration.** Existing instances, sessions, skills, custom-model pools, and `skip-permissions` toggle are untouched. The custom-provider storage keys are new, so old installs simply have no entries until you create one.
- **Concurrent sessions is opt-out, not opt-in** — the v0.6.x "stop current task before starting new session" guard is gone unconditionally. If you preferred that behaviour (e.g. you only want one model burning tokens at a time), use Stop on the existing session before opening a new one.
- **Background sessions can keep streaming when you close the side panel** as long as the SW stays alive. The keep-alive timer is now scoped to in-flight tasks, so an idle panel no longer keeps the SW pinned.

## 🔗 Links

- **Roadmap:** [`docs/ROADMAP.md`](../ROADMAP.md)
- **Concurrent sessions spec:** [`docs/specs/2026-05-08-concurrent-sessions-design.md`](../superpowers/specs/2026-05-08-concurrent-sessions-design.md)
- **Concurrent sessions plan:** [`docs/plans/2026-05-08-concurrent-sessions-plan.md`](../superpowers/plans/2026-05-08-concurrent-sessions-plan.md)
- **Concurrent sessions trace:** [`docs/solutions/2026-05-03-multi-session-invariant-trace.md`](../solutions/2026-05-03-multi-session-invariant-trace.md) §M3-U6
- **Custom providers spec:** [`docs/specs/2026-05-07-custom-providers-design.md`](../superpowers/specs/2026-05-07-custom-providers-design.md)
- **Custom providers trace:** [`docs/solutions/2026-05-07-custom-providers-invariant-trace.md`](../solutions/2026-05-07-custom-providers-invariant-trace.md)
- **Previous release:** [v0.6.1](./v0.6.1.md)
- **Issues closed:** [#30](https://github.com/WiseriaAI/pie-ai-agent/issues/30), [#35](https://github.com/WiseriaAI/pie-ai-agent/issues/35), [#39](https://github.com/WiseriaAI/pie-ai-agent/issues/39), [#41](https://github.com/WiseriaAI/pie-ai-agent/issues/41)
