Release v0.22.5

This commit is contained in:
Mario Zechner 2025-12-17 01:22:13 +01:00
parent 93d000b19d
commit 295f51b53f
14 changed files with 133 additions and 121 deletions

View file

@ -2,6 +2,12 @@
## [Unreleased]
## [0.22.5] - 2025-12-17
### Fixed
- Fixed `--session` flag not saving sessions in print mode (`-p`). The session manager was never receiving events because no subscriber was attached.
## [0.22.4] - 2025-12-17
### Added

View file

@ -1,6 +1,6 @@
{
"name": "@mariozechner/pi-coding-agent",
"version": "0.22.4",
"version": "0.22.5",
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
"type": "module",
"piConfig": {
@ -39,9 +39,9 @@
"prepublishOnly": "npm run clean && npm run build"
},
"dependencies": {
"@mariozechner/pi-agent-core": "^0.22.4",
"@mariozechner/pi-ai": "^0.22.4",
"@mariozechner/pi-tui": "^0.22.4",
"@mariozechner/pi-agent-core": "^0.22.5",
"@mariozechner/pi-ai": "^0.22.5",
"@mariozechner/pi-tui": "^0.22.5",
"chalk": "^5.5.0",
"diff": "^8.0.2",
"glob": "^11.0.3",

View file

@ -203,6 +203,10 @@ export class SessionManager {
// Use custom session file path
this.sessionFile = resolve(customSessionPath);
this.loadSessionId();
// If file doesn't exist, loadSessionId() won't set sessionId, so generate one
if (!this.sessionId) {
this.sessionId = uuidv4();
}
// Mark as initialized since we're loading an existing session
this.sessionInitialized = existsSync(this.sessionFile);
// Load entries into memory

View file

@ -28,10 +28,11 @@ export async function runPrintMode(
initialAttachments?: Attachment[],
): Promise<void> {
// Hook runner already has no-op UI context by default (set in main.ts)
// Set up hooks for print mode (no UI, ephemeral session)
// Set up hooks for print mode (no UI)
const hookRunner = session.hookRunner;
if (hookRunner) {
hookRunner.setSessionFile(null); // Print mode is ephemeral
// Use actual session file if configured (via --session), otherwise null
hookRunner.setSessionFile(session.sessionFile);
hookRunner.onError((err) => {
console.error(`Hook error (${err.hookPath}): ${err.error}`);
});
@ -43,12 +44,13 @@ export async function runPrintMode(
await hookRunner.emit({ type: "session_start" });
}
if (mode === "json") {
// Output all events as JSON
session.subscribe((event) => {
// Always subscribe to enable session persistence via _handleAgentEvent
session.subscribe((event) => {
// In JSON mode, output all events
if (mode === "json") {
console.log(JSON.stringify(event));
});
}
}
});
// Send initial message with attachments
if (initialMessage) {