(event, mode, context = '')
| 31 | } |
| 32 | |
| 33 | function writeHookOutput(event, mode, context = '') { |
| 34 | if (isCopilot) { |
| 35 | // Copilot reads additionalContext on SessionStart; ignores output elsewhere. |
| 36 | process.stdout.write(JSON.stringify( |
| 37 | event === 'SessionStart' && context ? { additionalContext: context } : {})); |
| 38 | return; |
| 39 | } |
| 40 | if (isCodex) { |
| 41 | const output = { systemMessage: `PONYTAIL:${mode.toUpperCase()}` }; |
| 42 | if (context) { |
| 43 | output.hookSpecificOutput = { |
| 44 | hookEventName: event, |
| 45 | additionalContext: context, |
| 46 | }; |
| 47 | } |
| 48 | process.stdout.write(JSON.stringify(output)); |
| 49 | return; |
| 50 | } |
| 51 | // Native Claude: SessionStart accepts raw stdout, but SubagentStart needs the |
| 52 | // hookSpecificOutput JSON form or the context is dropped. |
| 53 | if (event === 'SubagentStart') { |
| 54 | process.stdout.write(JSON.stringify( |
| 55 | { hookSpecificOutput: { hookEventName: event, additionalContext: context } })); |
| 56 | return; |
| 57 | } |
| 58 | process.stdout.write(context); |
| 59 | } |
| 60 | |
| 61 | module.exports = { |
| 62 | clearMode, |
no outgoing calls
no test coverage detected