MCPcopy Create free account
hub / github.com/WJX20/claude-code / executeSessionStartHooks

Function executeSessionStartHooks

src/utils/hooks.ts:3962–3987  ·  view source on GitHub ↗
(
  source: 'startup' | 'resume' | 'clear' | 'compact',
  sessionId?: string,
  agentType?: string,
  model?: string,
  signal?: AbortSignal,
  timeoutMs: number = TOOL_HOOK_EXECUTION_TIMEOUT_MS,
  forceSyncExecution?: boolean,
)

Source from the content-addressed store, hash-verified

3960 * @returns Async generator that yields progress messages and hook results
3961 */
3962export async function* executeSessionStartHooks(
3963 source: 'startup' | 'resume' | 'clear' | 'compact',
3964 sessionId?: string,
3965 agentType?: string,
3966 model?: string,
3967 signal?: AbortSignal,
3968 timeoutMs: number = TOOL_HOOK_EXECUTION_TIMEOUT_MS,
3969 forceSyncExecution?: boolean,
3970): AsyncGenerator<AggregatedHookResult> {
3971 const hookInput: SessionStartHookInput = {
3972 ...createBaseHookInput(undefined, sessionId),
3973 hook_event_name: 'SessionStart',
3974 source,
3975 agent_type: agentType,
3976 model,
3977 }
3978
3979 yield* executeHooks({
3980 hookInput,
3981 toolUseID: randomUUID(),
3982 matchQuery: source,
3983 signal,
3984 timeoutMs,
3985 forceSyncExecution,
3986 })
3987}
3988
3989/**
3990 * Execute setup hooks if configured

Callers 1

processSessionStartHooksFunction · 0.85

Calls 2

createBaseHookInputFunction · 0.85
executeHooksFunction · 0.85

Tested by

no test coverage detected