# Changelog

All notable changes to the `pi-intercom` extension will be documented in this file.

## [Unreleased]

## [0.16.1] - 2026-10-04

### Highlights
- An intercom message that wakes an idle session now starts a normal turn, with everything your other extensions add to the prompt. Providers such as pi-claude-bridge no longer fail on that turn or get stuck afterwards.
- You can see when a message woke a session: the transcript shows a short "New intercom message above." line.
- Press Ctrl+O to read the full text of messages you send, not just the first line or so.

### Fixed
- A message that arrived while a session was idle started a turn without other extensions' `before_agent_start` additions to the prompt. Providers that check the prompt, such as pi-claude-bridge, failed that turn, and the session could stay broken afterwards. The message is now added to the session first, and the session wakes through a normal prompt, so those additions are included. The transcript shows the wake as a short "New intercom message above." line. Sessions already broken by the old behavior need the manual fix described in issue #152. Thanks to [@BGamboa13](https://github.com/BGamboa13) for issue #152 and [@pmontiel-x](https://github.com/pmontiel-x) for the follow-up diagnosis.
- Pressing Ctrl+O now shows the full message of an outgoing `intercom` or `contact_supervisor` call. Before, long messages stayed cut off at a short preview even when expanded. Thanks to [@summer-tt](https://github.com/summer-tt) for PR #153.

## [0.16.0] - 2026-09-30

### Highlights
- Hand your work to another session with `/handover`. Pi writes up what this session learned, decided, and changed, and the other session picks up the next task without starting from scratch.
- Hand over to Pi sessions on your other computers. The `/handover` picker lists sessions on this machine and, when you ask, on your saved Herdr machines.
- Press `h` in the Alt+M session list to hand over to the highlighted session.
- On Windows, the broker no longer starts through a VBScript file that security tools flagged, and opening a Herdr project pane now starts Pi.

### Added
- `/handover <target> [next task]` and the intercom tool's `handover` action hand your session's context to another session. Pi summarizes what the session learned, decided, and changed, and the receiving session starts on the next task. You can edit the summary before sending it. If you give a project path and no session is running there, a Herdr pane opens one. `name@machine` targets on saved Herdr machines work too.
- `/handover` with no arguments opens a picker. Choose a session on this machine, start a new session in a project, or load Pi sessions from your other Herdr machines. In the Alt+M session list, press `h` to hand over to the highlighted session.

### Changed
- On Windows, the broker no longer starts through a `broker-launch.vbs` file, which endpoint security tools flagged as suspicious. It now runs as one hidden Node process, the same way as on other platforms, and a failed start shows the broker's error output. If you set a custom `brokerCommand` on Windows, it must point to an executable, not a `.cmd` shim. Thanks to [@jhonruda25](https://github.com/jhonruda25) for issue #142.

### Fixed
- You can now send to Pi sessions on another machine even if they were never renamed in Herdr. Address them as `full-session-uuid@machine`. Before, only renamed sessions could be found.
- Opening a Herdr project pane now starts Pi on Windows. The command was sent in quotes, and PowerShell printed it as text instead of running it. Thanks to [@elliot-chung](https://github.com/elliot-chung) for #143.
- When another machine can't be reached, the error now shows Herdr's reason instead of raw debug output. If that machine's Herdr server is too old to list sessions, the error says how to update it.

## [0.15.0] - 2026-09-27

### Highlights
- Send one-way text messages to Pi sessions on saved Herdr machines with `name@machine` addressing.
- Keep remote brokers local-only while SSH carries messages between machines.
- See a clear `unverified cross-machine` label on messages received from another machine.
- Update pi-intercom on Windows without open Pi sessions locking the installed package.

### Added
- Added one-way text `send` to `name@machine` or `full-session-uuid@machine` over SSH through enabled Herdr saved machines. Remote brokers remain local-only, received messages are clearly marked as unverified, and unsupported operations fail with a clear error. Thanks to [@odfalik](https://github.com/odfalik) for issue #138 and the original prototype.

### Fixed
- Open Pi sessions no longer prevent package updates on Windows. Thanks to [@XWIlluDelu](https://github.com/XWIlluDelu) for #139.

## [0.14.0] - 2026-09-23

### Highlights
- Coordinate with other sessions from scripts or over SSH using the new command-line client.
- Keep messages from interrupting your input with optional human-first delivery.
- Find sessions more easily with Herdr locations and a shorter session list.
- Messages arriving during compaction now reach their destination afterward.

### Added
- Added a command-line client with `list`, `send`, and `ask` commands for scripts and coordination over SSH. Thanks to [@pinion05](https://github.com/pinion05) for #131 and issue #130.
- Added opt-in `busyDelivery: "human-first"` to hold peer messages while you're typing and deliver them at turn boundaries. The default behavior is unchanged. Thanks to [@SiebertLanhove](https://github.com/SiebertLanhove) for #128.
- Extensions can use the `intercom:session-identity` event to give a session a fixed ID without changing its readable name. Thanks to [@Q-xuan](https://github.com/Q-xuan) for raising the readable child name problem in nicobailon/pi-subagents#2432.
- `list` now shows the workspace, tab, and pane for sessions hosted in Herdr. Thanks to [@odfalik](https://github.com/odfalik) for #129.

### Changed
- `list` and `list-cwd` show a one-line summary in the TUI; expand it to see every session. The model still sees the full list. Thanks to [@SiebertLanhove](https://github.com/SiebertLanhove) for #127.

### Fixed
- Messages held for delivery now report when they're queued or dropped, including after cancellation, supersession, a reply, or session shutdown.
- Messages arriving during compaction are delivered afterward instead of being lost. Thanks to [@alexjc](https://github.com/alexjc) for #133.

## [0.13.0] - 2026-09-02

### Highlights
- You can now give the current session a friendly alias from pi-intercom.
- Aliases show up right away in the session list, messages, replies, overlays, and incoming-message displays.
- Windows broker startup is more reliable with non-ASCII profile paths and stricter Windows Script Host setups.

### Added
- Added `/alias <name>` plus the interactive `/alias` and `/alias menu` forms for naming the current session. Thanks to [@yceachan](https://github.com/yceachan) for issue #122.

### Fixed
- Fixed hidden Windows broker startup when the user profile path contains non-ASCII characters or Windows Script Host cannot infer the VBScript engine. Thanks to [@maelo1028](https://github.com/maelo1028) for issue #121 and [@Agustin-Prieto](https://github.com/Agustin-Prieto) for issue #123.

## [0.12.1] - 2026-08-29

### Highlights
- Replies to inbound asks are now harder to send to the wrong local session by mistake.
- The `intercom` tool now stays in the active tool set, which avoids a late-session prompt-cache reset when intercom first becomes useful.
- Existing configs that still mention `toolVisibility` keep loading; the old setting is simply ignored.

### Fixed
- Refuse non-reply `send` calls to a different target during a turn triggered by an inbound ask, preventing CWD hierarchy or roster guesses from misdirecting replies. Thanks to [@yceachan](https://github.com/yceachan) for issue #117.

### Removed
- Removed `toolVisibility` and the `after-first-use` reveal path. The generic `intercom` schema and prompt snippet now stay stable for provider prompt caches, and existing `toolVisibility` config keys are ignored. Thanks to [@XWIlluDelu](https://github.com/XWIlluDelu) for issue #118.

## [0.12.0] - 2026-08-22

### Highlights
- Extensions can now ask pi-intercom to send a message through the current session without losing user consent, sender attribution, or delivery feedback.
- Teams can isolate intercom traffic with `PI_INTERCOM_SCOPE_ID`, so unrelated sessions do not see or receive each other's scoped messages.
- The generic `intercom` tool can stay hidden until it is first useful, keeping quiet sessions less cluttered.

### Added
- Added a consent-aware extension outbox API with `intercom:outbox-request` and `intercom:outbox-result` events for notify-only same-process extension sends. Outbox sends honor `confirmSend`, always return a terminal result for valid request IDs, use scoped target resolution, and leave attributed sender-side transcript traces. Thanks to [@elecnix](https://github.com/elecnix) for #110.
- Added opt-in broker-enforced routing scopes through `PI_INTERCOM_SCOPE_ID`. Scoped sessions only see, route, recover mailbox messages, receive presence events, and use extension-bus owner, publish, and state traffic with sessions in the exact same opaque scope. Unscoped sessions keep existing behavior. Thanks to [@YeungKC](https://github.com/YeungKC) for issue #112.
- Added opt-in `after-first-use` visibility for the generic `intercom` tool, keeping its model schema and prompt out of unused sessions until an inbound message, overlay send, or bundled skill load reveals it. Broker reception and the child-only `contact_supervisor` tool remain available while it is hidden. Thanks to [@XWIlluDelu](https://github.com/XWIlluDelu) for PR #111.

## [0.11.0] - 2026-08-19

### Highlights
- Messages can no longer land on a stale peer: if the target session restarted or was replaced, the send fails clearly or retries against the live session instead of silently reaching the wrong endpoint.
- Retrying a send with the same message ID is now safe. Identical retries never deliver twice, and reusing an ID with different content is rejected.
- Send results now include structured delivery details (state, error code, whether a retry is safe), so failures are actionable instead of guesswork.
- The session list now shows each peer's tmux pane ID, making it easier to find and drive the right terminal.
- Delivered blocking asks leave a local pending-ask record, so you can see what a peer is still waiting on.

### Added
- Endpoint-bound direct delivery: sends target the exact live session and safely retry once when the target reconnects mid-send, with bounded replay protection for repeated message IDs. Thanks to [@xiangbianpangde](https://github.com/xiangbianpangde) for #106.
- Local pending-ask records for delivered blocking asks. Thanks to [@bcanvural](https://github.com/bcanvural) for issue #104.
- tmux pane IDs in the session roster. Thanks to [@odfalik](https://github.com/odfalik) for issue #102 and PR #101.

### Changed
- Reusing a message ID with different content now fails with a clear error instead of relying on receiver-side duplicate suppression.
- Clarified that agents should re-list stale intercom session IDs and skip self-targets.

## [0.10.1] - 2026-08-12

### Fixed
- Resolve the default broker `tsx` launcher from flat plugin-store installs when package resolution fails, and include broker stderr when startup exits early. Thanks to Eduardo Marquez (`DocksDocks`) for issue #97.
- Preserve attachments when replying through `intercom({ action: "reply" })`. Thanks to Ruoshan Huang (`ruoshan`) for issue #99.

## [0.10.0] - 2026-08-09

### Added
- Added cwd-scoped `send` and `ask` targeting plus `openProjectPaneIfMissing` for visible cross-codebase peer conversations through Herdr project panes.

### Changed
- Cleaned intercom tool copy, visible-peer skill guidance, and broker protocol validation structure.

### Fixed
- Surface malformed intercom config errors with path context instead of silently falling back to defaults.
- Fail blocking `ask` and supervisor-decision requests immediately when the target is not connected instead of accepting a mailbox delivery that can wait until timeout.
- Prevent disconnected mailbox routing from delivering a message back to its sender or transferring mail through runtime-only unnamed-session aliases. Thanks to ELA718 for PR #93.
- Extend unnamed-session fallback aliases with enough session-ID characters to distinguish UUIDv7 sessions started close together.

## [0.9.3] - 2026-08-08

### Fixed
- Allow replies to target pending asks by a unique sender session-ID prefix. Thanks to Benjamin Jesuiter (`bjesuiter`) for PR #85.
- Detect half-open broker sockets and reconnect clients. Thanks to Nicolas Marchildon (`elecnix`) for issue #89 and PR #88.
- Hand busy interactive inbound messages directly to Selesai's safe steering queue instead of waiting for aggregate idle, preventing stale coordination from appearing hours after it was received. Thanks to Xiangzhe (`xz-dev`) for issue #86 and PR #87.
- Treat a public send to the sole pending asker as its reply. Thanks to Grant Hutchins (`nertzy`) for PR #90.
- Display session-ID prefixes that distinguish listed sessions. Thanks to Chris Goddard (`chrisgoddard`) for issue #83.

## [0.9.2] - 2026-08-03

### Fixed
- Avoid relaunching standalone Selesai executables as the Node runtime when starting the default broker process. Thanks to ZacharyQin for PR #82 and to jeffutter and awaae001 for confirming the impact.

## [0.9.1] - 2026-07-30

### Fixed
- Scoped name-based queued-mail redelivery to sessions that also match the target's directory. A disconnected session's queued messages, including replies addressed to its exact session ID, could previously be delivered to an unrelated same-named session in a different project folder. Directories compare through the same normalization used by `list-cwd`, so a relaunch reporting the same directory via a trailing slash or symlink still receives its mail.

### Changed
- Rewrote the broker frame reader as a bounded state machine and made frame writes a single allocation, removing quadratic `Buffer.concat` accumulation on fragmented socket reads (up to ~28x faster on heavily fragmented frames).
- Cached the collapsed preview and width-keyed wrapped body lines in the inline message renderer, cutting repeated rerender cost of long messages by ~2-3x while keeping live theme changes applied per render.

## [0.9.0] - 2026-07-29

### Added
- Added a bounded in-memory broker mailbox so replies to recently disconnected named CLI senders are queued and delivered when a process reconnects with the same name. Thanks to Luke (`valkyriweb`) for issue #63.
- Added protocol-visible delivery metadata, receiver lifecycle receipts, receiver-side inbound message dedupe, explicit cancel/supersede controls, and clearer ask-timeout receipts for ordered delivery diagnostics. Thanks to Donnie Thomas (`donnielrt`) for issue #65.

## [0.8.0] - 2026-07-29

### Added
- Added opt-in restart-stable intercom session IDs via `PI_INTERCOM_STABLE_ID` or `stableId` in `config.json`. Thanks to iRonin for issue #39.
- Added `/intercom-id` to insert a stable handoff snippet for the current session into the editor. Thanks to dataforxyz for PR #60.
- Added `intercom({ action: "list-cwd" })` to list peers scoped to the same working directory. Thanks to iRonin for PR #58.
- Added live context-window usage to session presence and list output. Thanks to iRonin for PR #59.
- Added a silent namespaced extension bus for non-conversational extension coordination. Thanks to Kieran Bond for PR #69.

## [0.7.0] - 2026-07-29

### Changed
- Documented `PI_INTERCOM_ASK_TIMEOUT_MS` for configurable ask/supervisor timeouts. Thanks to wiansapu for issue #14.
- Clarified session addressing copy so the short IDs shown by `list` are documented as usable prefixes. Thanks to Grant Hutchins for PR #66.
- Updated Selesai runtime peer metadata and tool schemas for the `@earendil-works` package scope and Selesai-bundled `typebox`/`pi-ai` packages.
- Centralized pi-intercom runtime and config paths under `SELESAI_CODING_AGENT_DIR` when set, defaulting to `~/.selesai/agent`.
- Hardened default broker auto-spawn to launch the resolved bundled `tsx` CLI through the current Node executable instead of resolving `npx` through `PATH`; custom `brokerCommand`/`brokerArgs` remain available as advanced trusted config.
- Added an `inboundTrigger` policy (`always`, `replies`, or `never`) so users can reduce inbound auto-trigger risk while preserving existing behavior by default.
- Made inline intercom messages collapse and expand with Selesai's `Ctrl+O` custom-message toggle while keeping sender, preview, reply, and attachment cues visible. Thanks to RyanKim17920 for PR #32.
- Improved inline message theme hierarchy with separate semantic styling for borders, headers, body text, and metadata. Thanks to Sreenath for PR #68.

### Fixed
- Added broker-owned local trust metadata, clearer stable-ID trust boundaries for duplicate names, per-connection rate limiting, and no-op presence coalescing for local IPC abuse hardening.
- Added an inbound broker frame size cap to reject oversized local IPC messages before buffering their payloads.
- Restricted Unix intercom runtime directory, socket, PID, and spawn-lock permissions.
- Rechecked single-flight ask state after session target resolution so concurrent regular asks fail safely instead of crashing on an unhandled rejected reply waiter.
- Refused broker-level mutual asks that would deadlock two sessions, and cleared outstanding ask edges when asks are replied to, cancelled, or disconnected.
- Stabilized intercom session addressing across reconnects, idle `/name` changes, replaced Selesai sessions, supervisor routing, pending replies, and short-ID targeting.
- Aligned intercom overlay widths with their rendered modal boxes. Thanks to Cat for PR #43.
- Marked failed `intercom` and `contact_supervisor` tool results through Selesai's `tool_result` error flag path while preserving structured renderer details.
- Limited the intercom overlay to TUI mode and unsubscribed subagent relay event handlers during session shutdown.
- Added an opt-in Windows localhost TCP transport using a dynamic port, broker protocol health checks, and a local endpoint secret instead of a fixed-port default.
- Stabilized reply/supervisor routing by respecting explicit reply targets, suppressing legacy supervisor tools when native supervisor channels are present, and clearing replied idle-queued asks. Thanks to ThanhNT29Jacky for PR #64.

## [0.6.0] - 2026-05-03

### Added
- Added `brokerCommand` and `brokerArgs` config options for choosing the broker runtime command. Thanks to William Fligor for PR #12.

## [0.5.0] - 2026-05-03

### Changed
- Busy interactive sessions now queue inbound intercom messages until the receiver is idle instead of aborting the active turn.
- Sessions now publish automatic lifecycle status (`idle`, `thinking`, or `tool:<name>`) through intercom presence updates.
- Deferred startup connection, delayed inbound flushes, overlay work, reconnect attempts, and relay callbacks now guard against stale session contexts after shutdown or reload.
- `intercom` and `contact_supervisor` tool calls/results now use compact custom transcript renderers.

## [0.4.1] - 2026-05-02

### Added
- Added `contact_supervisor` `reason: "interview_request"` for child subagents to send structured supervisor interviews, wait for a reply, and receive parsed JSON replies in tool result details when available.

### Fixed
- Busy non-interactive sessions now auto-reply to top-level intercom messages instead of aborting and losing the message.

## [0.4.0] - 2026-05-02

### Added
- Added a `contact_supervisor` tool for `pi-subagents` child sessions so delegated agents can request supervisor decisions or send meaningful progress updates with run metadata.
- Documented subagent-to-supervisor escalation in the README and bundled `pi-intercom` skill.

### Fixed
- Made inline intercom message cards use the available terminal width instead of a narrow fixed width.
- Cleared supervisor ask waiters correctly after cancellation or delivery failure so subagents can ask again.

### Changed
- Stopped tracking `package-lock.json` and ignored local `progress.md` memory files.

## [0.3.0] - 2026-04-27

### Added
- Added `pi-subagents` grouped result relay support over `pi-intercom`, including delivery acknowledgments so parent runs can return compact receipts only after the orchestrator receives the result message.

## [0.2.1] - 2026-04-26

### Fixed
- Delivered `pi-subagents` needs-attention control events to the orchestrator over intercom.

## [0.2.0] - 2026-04-22

### Added
- Added receiver-side `reply` ergonomics for inbound asks. Agents can now use `intercom({ action: "reply", message })` in the triggered turn or later against a single pending ask, plus `intercom({ action: "pending" })` to inspect unresolved inbound asks.

### Fixed
- Migrated extension tool schemas from `@sinclair/typebox` to `typebox` 1.x so packaged installs follow Selesai's current extension runtime contract.
- Included `reply-tracker.ts` in the published package so installed extensions can load the new reply-tracking helper at runtime.
- Updated the integration test harness to set `USERPROFILE` alongside `HOME`, keeping temp-home isolation reliable on Windows.

### Changed
- Moved TypeBox from `peerDependencies` to a real `dependencies` entry so `selesai install` production installs keep the schema package available at runtime.
- Incoming ask reply hints now prefer `intercom({ action: "reply", ... })` instead of exposing raw `to` and `replyTo` identifiers.
- Updated the bundled `pi-intercom` skill and README examples to prefer `reply`/`pending` over manual reply threading.

## [0.1.11] - 2026-04-20

### Added
- Bundled `pi-intercom` skill with coordination patterns, error handling, constraints, and optional cmux/tmux peer-session spawning for visible multi-session workflows.
- `pi.skills` manifest in `package.json` so `selesai install` loads the skill automatically.
- AGENTS.md snippet in README recommending a project-level coordination hint for agents.
- Attachments example to Quick Start section in README.

### Changed
- Incoming message reply hints now say "To reply, use the intercom tool:" instead of "— reply:" so agents are more likely to use the intercom tool instead of replying inline.
- `ask` action now documents the one-at-a-time constraint in the Tool Reference.
- `status` action now clarifies that the session count includes the current session.
- Broker startup no longer uses a non-null assertion for sender session lookup in the `send` handler — missing sessions now produce a `delivery_failed` response instead of a crash.
- Broker spawn lock error handling tightened to check `instanceof Error` before accessing `.code`.
- Broker PID parsing now guards against `NaN` from corrupt PID files.
- `isConnected()` readability cleanup in `IntercomClient`.
- README file structure updated to include `broker/paths.ts`, test files, and `skills/` directory.
- README runtime files section now clarifies that `broker.sock` is macOS/Linux only; Windows uses a named pipe.
- README mermaid diagram changed "Unix Socket" to "Local Socket/Pipe" for cross-platform accuracy.
- README broker limitation rephrased from "must be running" to "auto-spawns on first use and exits when idle."
- README Install section now mentions that the bundled skill is registered on startup.

## [0.1.10] - 2026-04-17

### Fixed
- Broker startup now works on Windows by launching the local `tsx` CLI through a hidden `wscript.exe` helper without treating the helper's expected early exit as a broker failure.

### Changed
- The broker now uses a Windows named pipe instead of a Unix socket on Windows, while keeping the existing Unix socket transport on macOS and Linux.

## [0.1.9] - 2026-04-17

### Fixed
- Declared the extension entry in `package.json` via `pi.extensions` so `selesai install npm:pi-intercom` can discover and load the extension from the npm package.

### Changed
- Added `pi-package` package metadata plus peer dependency declarations for every Selesai runtime package the extension imports, including `@mariozechner/pi-tui`.

## [0.1.8] - 2026-04-14

### Changed
- Intercom sessions now reconnect automatically after broker disconnects or sleep/wake interruptions instead of staying offline until reload or restart.
- Replaced raw runtime `console.error` intercom disconnect logging with silent recovery so transient broker churn no longer splashes stray text into the Selesai TUI.

## [0.1.7] - 2026-04-13

### Changed
- Unnamed sessions now register a runtime-only `subagent-chat-<id>` intercom alias instead of persisting a generic session title into Selesai session history, so `selesai --resume` can keep showing transcript snippets while unnamed sessions remain reachable over intercom.
- Intercom presence updates now refresh the advertised session name during later turn/intercom activity, so renaming a session does not leave subagents and peers targeting a stale startup alias.

## [0.1.6] - 2026-04-13

### Changed
- Busy incoming intercom messages now try a graceful detach handshake with `pi-subagents` before falling back to interrupting the active turn.
- Reply follow-ups are deferred and re-delivered as follow-up wakeups so final confirmation messages stop causing unnecessary `Operation aborted` interruptions.
- Unnamed sessions now auto-register a stable `session-<id>` display name so orchestrators and delegated children can target each other reliably without a manual `/name`.

## [0.1.5] - 2026-04-13

### Changed
- Switched intercom send confirmation to opt-in. `send` now delivers immediately by default, and interactive confirmation only appears when `confirmSend: true` is set in `~/.selesai/agent/intercom/config.json`.
- Replaced the old inverted `autoSend` config with `confirmSend` to make the behavior easier to understand.

## [0.1.4] - 2026-04-13

### Added
- Added an MIT `LICENSE` file and set `package.json` `license` to `MIT`.

### Changed
- Updated `README.md` to mention the `pi-subagents` integration and link to https://github.com/nicobailon/pi-subagents.

## [0.1.3] - 2026-04-10

### Changed
- **Clearer self vs peer identity** — `intercom({ action: "list" })` now shows `Current session` and `Other sessions`, includes short session IDs, and marks same-folder peers with `[same cwd]` so agents are less likely to mistake another session in the same repo for themselves.
- **Picker self anchor** — The session picker now shows the current session as a disabled `[self]` row at the top while keeping only peer sessions selectable.

## [0.1.2] - 2026-04-04

### Changed
- **Reply flows skip approval** — `send` calls that include `replyTo` now bypass the confirmation dialog so reply-hint conversations can continue without an extra approval step.
- **Overlay readability** — The session picker now shows session name/model on the first line and the cwd on a second line with middle truncation, making long paths much easier to distinguish.
- **Documentation clarity** — The README now explains which sessions appear in the picker, how sessions become intercom-connected, and the difference between user-facing `/intercom` usage and agent tool calls.

### Fixed
- **Compose overlay crash** — Replaced the invalid `tui.scheduleRender()` calls with `tui.requestRender()`, fixing the compose overlay crash while typing or sending.
- **Overlay panel chrome** — Restored bordered modal rendering for the session picker and compose overlay so they display as proper overlays instead of floating unboxed content.

## [0.1.1] - 2026-04-04

### Changed
- Added a `promptSnippet` for the `intercom` tool so Selesai 0.59+ includes it in the default tool prompt section and improves session-to-session coordination discoverability.

### Changed
- **Selesai compatibility refresh** — Updated the extension to match current Selesai lifecycle and custom UI APIs, including `session_start` / `session_shutdown` and injected `ctx.ui.custom()` keybindings.
- **Overlay keybindings** — The session picker and compose overlay now use injected, namespaced Selesai keybindings instead of reading editor-global bindings directly.
- **Session list correlation** — `list` / `sessions` now carry a `requestId`, so a delayed broker reply cannot be mistaken for a newer session-list request.
- **Reply sends skip approval** — `send` calls that include `replyTo` now bypass the confirmation dialog so reply-hint flows work without an extra approval step.
- **Documentation accuracy** — The README now matches the current implementation, including request correlation, persistence behavior, broker disconnect behavior, and the file layout.

### Fixed
- **Protocol state handling** — Broker and client now reject malformed, unknown, duplicate, and out-of-order protocol messages instead of silently accepting them.
- **Duplicate-name routing** — Sends to a duplicated session name now fail with an explicit error instead of routing to the first match.
- **Delivery failure visibility** — `delivery_failed.reason` now flows through the client, tool results, and compose overlay error UI.
- **Disconnect and startup errors** — Broker spawn failures, early broker exits, protocol failures, and disconnects now preserve the real error instead of collapsing to generic messages.
- **Disconnect-time writes** — Client operations now fail cleanly during disconnect instead of writing to a closing socket and triggering `write after end` errors.
- **Late-response handling** — Timed-out send/list requests no longer disconnect the client, and delayed list responses can no longer contaminate a later request with stale data.
- **Config validation** — Invalid intercom config values are now reported and ignored instead of silently producing a broken runtime config.

## [0.1.0] - 2026-03-12

### Added
- **`ask` action** — `intercom({ action: "ask", to, message })` now sends a message and blocks until the recipient replies, returning the reply as the tool result. Includes a 10-minute timeout, abort handling, disconnect handling, and shutdown cleanup.
- **Exact reply hints** — Incoming messages can now include a ready-to-run reply command that uses the sender's exact session ID as `to` and the original message ID as `replyTo`, making synchronous `ask`/reply flows reliable.
- **Attachment body rendering for incoming messages** — Incoming attachment contents are now appended to the agent-visible message body so recipients can read attached file/snippet/context content directly.
- **Planner/worker workflow documentation** — README now documents the intended planner-worker loop, including `send` vs `ask`, clarification patterns, and reply-hint behavior.

### Changed
- **Session target resolution** — `send` and `ask` now resolve a unique case-insensitive session name to its exact session ID before sending. Ambiguous names are rejected instead of guessed.
- **Duplicate-name presentation** — Session labels are now disambiguated consistently across `list`, the session picker, the compose overlay, and send notifications by appending a short session ID when names collide.
- **Send confirmation dialog** — Confirmation text now includes attachment content previews and `replyTo` metadata so outgoing messages are reviewed accurately before sending.
- **Inline message rendering** — The custom inline renderer now shows the fully rendered message body, optional reply command, attachment summaries, and reply metadata consistently with what the agent receives.

### Fixed
- **False `ask` completions from unrelated messages** — Reply matching now requires an exact `replyTo` match and the expected sender, preventing unrelated incoming messages from unblocking a waiting `ask`.
- **Self-targeted messages** — `send` and `ask` now reject attempts to message the current session instead of allowing loops or self-waits.
- **Undelivered `ask` cleanup** — If an `ask` message is not delivered, the waiting state is torn down cleanly instead of lingering.
- **Inline renderer/body mismatch** — The custom message renderer now matches the actual delivered message body for messages with attachments instead of showing a reduced view.
- **Duplicate-name ambiguity when self shares a name** — Duplicate-name detection now considers all connected sessions, so another session is still disambiguated when it shares a name with the current session.
- **`broker/client.ts` `sessions` switch scoping** — Braced the `sessions` case to avoid block-scoping hazards in the message handler.
