# Changelog

## 0.3.4
- Fixed: regression introduced by 0.3.3 — summoned worker that hit a transient error mid-task (and then recovered via retry) would hang after finishing: Report never sent back, pane not closed, required manual `/quit`
  - Symptom: long tasks (which tend to hit rate-limit/429 at least once) got stuck; tiny tasks that succeeded on first try worked fine
  - Root cause: in the `agent_end` error branch, `currTask` was nulled and the task stashed into `pendingClose`; but the `agent_start` handler (which fires when retry begins) only cleared the close timer and forgot to restore `currTask`. So when retry succeeded and the final `agent_end (stop)` arrived, `if (!currTask) return` short-circuited — no reply, no close
  - Fix: in the `agent_start` handler, restore `currTask = pendingClose.task` before clearing `pendingClose`

## 0.3.3
- Fixed: worker pane closed prematurely when LLM provider was rate-limited or transiently failed
  - Symptom: summoned workers would vanish mid-task, and the main pane would receive a meaningless/garbled Report
  - Root cause: `pane-comm/interceptor.ts` closed the worker pane on every `agent_end`. pi core emits an intermediate `agent_end` (with `stopReason: 'error'`) right before retrying, so the close-pane was killing the worker before its built-in auto-retry (max 3, exponential 2s/4s/8s) could run
  - Fix: differentiate `agent_end` by `stopReason`
    - `error` (intermediate, retry pending) → schedule a 10s deferred close; cancel it on the next `agent_start` (which fires when retry begins)
    - `stop` (normal completion) → keep original behavior, reply and close immediately
  - 10s threshold covers the worst-case backoff (baseDelay 2s × 2^2 = 8s) plus 2s margin; if no `agent_start` arrives, retry is exhausted or the error is non-retryable, and the pane closes silently without sending a fake Report
  - See `docs/worker-pane-retry-bug分析.md` for full analysis, event-sequence diagrams, and future-work options

## 0.3.2
- Remind Lisa to use Skills
- Remind Lisa not to delete or move files and directories

## 0.3.1
- Added: **Summon** — summon assistants to a floating pane to execute tasks
  - Registered as a pi tool; LLM can invoke `summon` to call a configured assistant
  - Added `/summon-setup` command: interactive TUI wizard to pick models and assign aliases
  - session_start auto-validates assistant configs (removes unavailable models)
  - First startup with no assistants → auto-launch setup wizard; partial invalidation → warn on startup
- Added: `callWorker` abstraction layer (`pane-comm/callWorker.ts`)
  - Extracted pane creation + readiness wait + message sending into a standalone module
  - /dd and /dc commands now call `callWorker`; removed `sendDelegate`
- Changed: config system overhaul
  - Migrated from "project-level override + package defaults" to a single user-level config (`~/.pi/agent/pi-in-zellij.json`)
  - First run auto-copies defaults from package
  - Added `saveConfig()`, `invalidateConfigCache()`, `AssistantConfig` type
- Changed: message protocol extended with `assistant` field (`msg-protocol.ts`)
- Changed: interceptor — added Summon branch handling; pane close now uses assistant alias instead of hardcoded `'worker'`
- Changed: UI prompts and notifications switched to English

## 0.2.3
- Fixed: removed debug `console.log` that polluted main pi TUI input
- Changed: error logging in worker readiness handler uses `console.error` instead of `console.log`

## 0.2.2
- Fixed: /dd command on Linux — prompt no longer requires manual Enter
  - Root cause: fixed sleep (1s) was too short for slower Linux startup
  - Solution: readiness file polling via `session_start` event, adaptive wait with 5s timeout
- Changed: `startupWaitSeconds` → `maxWaitSeconds` in config (default: 5)
- Added: CHANGELOG.md included in npm package

## 0.2.1
- Added: recursive scanning of nested directories for agent files

## 0.2.0
- Added: delegate with context via /dc command
- Added: auto-save and restore floating pane positions in zellij

## 0.1.0
- Initial release
- Multi-pane communication support (/dd)
- External editor support (alt+e)
