mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 15:02:32 +00:00
Release v0.22.5
This commit is contained in:
parent
93d000b19d
commit
295f51b53f
14 changed files with 133 additions and 121 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue