fix(hooks): require invocation signals
This commit is contained in:
@@ -132,7 +132,7 @@ export function apply(ctx: Context, config: Config): void {
|
|||||||
point: string,
|
point: string,
|
||||||
matchQuery: string,
|
matchQuery: string,
|
||||||
payload: unknown,
|
payload: unknown,
|
||||||
opts: { agent?: Agent; turn?: number; signal?: AbortSignal },
|
opts: { agent?: Agent; turn?: number; readonly signal: AbortSignal },
|
||||||
): Promise<MergedHookOutcome> {
|
): Promise<MergedHookOutcome> {
|
||||||
const groups: MatcherGroup[] = parsed[point] ?? []
|
const groups: MatcherGroup[] = parsed[point] ?? []
|
||||||
const outputs: HookOutput[] = []
|
const outputs: HookOutput[] = []
|
||||||
@@ -159,7 +159,7 @@ export function apply(ctx: Context, config: Config): void {
|
|||||||
defaultTimeoutMs,
|
defaultTimeoutMs,
|
||||||
...hookEnv ? { env: hookEnv } : {},
|
...hookEnv ? { env: hookEnv } : {},
|
||||||
...workdir !== undefined ? { cwd: workdir } : {},
|
...workdir !== undefined ? { cwd: workdir } : {},
|
||||||
...opts.signal ? { signal: opts.signal } : {},
|
signal: opts.signal,
|
||||||
trailingNewline: true,
|
trailingNewline: true,
|
||||||
// Discard a `hookSpecificOutput` block whose `hookEventName` names a
|
// Discard a `hookSpecificOutput` block whose `hookEventName` names a
|
||||||
// different event than the one firing (the schemas key it by event).
|
// different event than the one firing (the schemas key it by event).
|
||||||
|
|||||||
@@ -106,7 +106,12 @@ export function apply(ctx: Context, config: Config): void {
|
|||||||
point: string,
|
point: string,
|
||||||
matchQuery: string,
|
matchQuery: string,
|
||||||
payload: unknown,
|
payload: unknown,
|
||||||
opts: { agent?: Agent; turn?: number; signal?: AbortSignal; plainStdoutAsContext?: boolean },
|
opts: {
|
||||||
|
agent?: Agent
|
||||||
|
turn?: number
|
||||||
|
readonly signal: AbortSignal
|
||||||
|
plainStdoutAsContext?: boolean
|
||||||
|
},
|
||||||
): Promise<MergedHookOutcome> {
|
): Promise<MergedHookOutcome> {
|
||||||
const groups: MatcherGroup[] = parsed[point] ?? []
|
const groups: MatcherGroup[] = parsed[point] ?? []
|
||||||
const outputs: HookOutput[] = []
|
const outputs: HookOutput[] = []
|
||||||
@@ -129,7 +134,7 @@ export function apply(ctx: Context, config: Config): void {
|
|||||||
payload,
|
payload,
|
||||||
defaultTimeoutMs,
|
defaultTimeoutMs,
|
||||||
...workdir !== undefined ? { cwd: workdir } : {},
|
...workdir !== undefined ? { cwd: workdir } : {},
|
||||||
...opts.signal ? { signal: opts.signal } : {},
|
signal: opts.signal,
|
||||||
trailingNewline: false, // Codex writes stdin without a trailing newline.
|
trailingNewline: false, // Codex writes stdin without a trailing newline.
|
||||||
// Discard a `hookSpecificOutput` block naming a different event.
|
// Discard a `hookSpecificOutput` block naming a different event.
|
||||||
expectedEventName: point,
|
expectedEventName: point,
|
||||||
|
|||||||
Reference in New Issue
Block a user