Adds a session_directory extension event that fires before session manager
creation, allowing extensions to customize the session directory path based
on cwd, git branch, or other context.
- Extensions can return a custom sessionDir in the event handler
- CLI --session-dir flag takes precedence over extension-provided paths
- If multiple extensions return a sessionDir, the last one wins
- Enables implementing branch-based sessions as an extension instead of core feature
This provides the extension point needed to implement git branch-based
session directories without adding the complexity to core.
Closes#1729
* feat(coding-agent): add fold/unfold to tree branch navigation
Remap left/right arrow keys in the session tree to jump between branch
segment starts (first child of each branching point). Left on a foldable
node (root or segment start) folds it, hiding its descendants. Right on
a folded node unfolds it. Nested fold state is preserved. Search and
filter changes reset all folds.
Folded branches show ⊞ in the connector (├⊞/└⊞) or as a prefix for
roots. Active path marker • appears after the fold indicator.
Add Page Up/Down support for paging through the tree list, consistent
with session selector and config selector.
* feat(coding-agent): improve tree branch folding closes#1724
---------
Co-authored-by: Sviatoslav Abakumov <dust.harvesting@gmail.com>
Only set app-level handlers on custom editors if they haven't defined
their own. This allows custom editors (e.g. vim mode) to implement
custom escape handling instead of being overwritten.
Closes#1838
Add manual retry loop (10 attempts, 20ms delay) around lockfile.lockSync()
in FileAuthStorageBackend and FileSettingsStorage. Previously, concurrent
pi processes would fail immediately on ELOCKED, causing auth.json to load
as empty and surfacing misleading 'No API key found' errors.
fixes#1871
Add configurable initial filter mode for the session tree navigator.
Users who always switch to a specific filter (e.g. no-tools via Ctrl+T)
can now set it as default in settings.
Same pattern as doubleEscapeAction (#404). Filter infra from #747.
Use visibleWidth/truncateToWidth for footer path and stats truncation so wide Unicode text cannot overflow terminal width.
Add regression tests for wide session/model/provider names and document the fix in changelog.
closes#1833
The previous fix (83b57924) replaced require.resolve() with bare
specifier fallbacks to avoid ERR_PACKAGE_PATH_NOT_EXPORTED for ESM-only
packages like pi-ai. However, bare specifiers are not valid jiti alias
targets, breaking extension loading in global npm installs.
Use import.meta.resolve() as the fallback instead. It respects the
"import" exports condition and returns a real file path.
When enabled, /tree navigation skips the 'Summarize branch?' prompt and
defaults to no summary, reducing friction for users who never want branch
summaries.
Closes#1791
GNU screen does not support truecolor escape sequences. When pi emits
truecolor SGR sequences (e.g. \x1b[38;2;102;102;102m for the dim color
#666666), screen misparses the semicolon-separated parameters as
individual SGR codes. The RGB value 102;102;102 maps directly to
SGR 102 (bright green background), which then bleeds into every
subsequent \x1b[2K line-erase, producing a bright green background
on most info/status messages.
detectColorMode() now returns '256color' for any TERM value that is
'screen', starts with 'screen-' (e.g. screen-256color), or starts
with 'screen.' (e.g. screen.xterm-256color). The existing COLORTERM
check at the top of the function already handles the opt-in case for
users who have configured screen's truecolor passthrough.
Messages submitted while a branch summary was being generated were
processed immediately instead of being queued. This happened because
isCompacting only checked compaction abort controllers, not the branch
summary abort controller.
Include _branchSummaryAbortController in the isCompacting getter so all
existing guards (message queueing, reload blocking) also apply during
branch summarization.