Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/prime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,16 @@ ${rubric}
return JSON.stringify({ hookSpecificOutput: { hookEventName: 'SessionStart', additionalContext: head + corpus } })
}

function writePrimePayload(payload: string): void {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one-call wrapper only renames process.stdout.write and adds no behavior. keep the direct call.

process.stdout.write(payload)
}

/** Write the payload to stdout, or nothing. Swallows every error: a hook must never disrupt session start. */
export function emitPrime(): void {
try {
const payload = primePayload()
if (payload !== null) {
process.stdout.write(payload)
writePrimePayload(payload)
}
} catch {
/* never break session start */
Expand Down