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

@ -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) {