Interface: SessionHookContext
Makaio Framework / hooks / SessionHookContext
Interface: SessionHookContext
Section titled “Interface: SessionHookContext”Defined in: ../../../packages/hooks/src/types/hook-context.ts:70
Session enrichment props shared across session-aware hooks.
Hooks that operate within a session context (PreUserMessage, PostTurn, etc.) can extend this interface to get access to session and history data.
Enrichment is optional - fields may be undefined if sessionId wasn’t available or if the lookup failed (graceful degradation).
Host code augments this interface via declaration merging to add
host-owned fields (e.g., project, worktree) contributed by a
SessionSubjects.enrichContext handler.
Extended by
Section titled “Extended by”Indexable
Section titled “Indexable”[
key:string]:unknown
Properties
Section titled “Properties”
readonlybus:IMakaioBus
Defined in: ../../../packages/hooks/src/types/hook-context.ts:76
Bus instance for making requests
contextExtensions
Section titled “contextExtensions”
readonlycontextExtensions:Record<string,unknown>
Defined in: ../../../packages/hooks/src/types/hook-context.ts:82
Arbitrary context extensions contributed by the host-registered
SessionSubjects.enrichContext handler. Framework spreads these onto
the context object at hook-call time. Empty object in OSS mode.
recentHistory
Section titled “recentHistory”
readonlyrecentHistory:object[]
Defined in: ../../../packages/hooks/src/types/hook-context.ts:74
Recent turn history, oldest first (up to 10 turns)
completedAt?
Section titled “completedAt?”
optionalcompletedAt?:number
Turn completion timestamp (Unix ms)
error?
Section titled “error?”
optionalerror?:string
Error message if status is ‘error’
sessionId
Section titled “sessionId”sessionId:
string
Session this turn belongs to
startedAt
Section titled “startedAt”startedAt:
number
Turn start timestamp (Unix ms)
status
Section titled “status”status:
"error"|"completed"|"active"=TurnStatusSchema
Turn status
turnId
Section titled “turnId”turnId:
string
Unique turn identifier
turnNumber
Section titled “turnNumber”turnNumber:
number
Monotonic per-session ordinal (1-based), assigned by turn storage at creation.
usage?
Section titled “usage?”
optionalusage?:object
Aggregated usage/cost for this turn. Populated on turn completion.
usage.byAgent?
Section titled “usage.byAgent?”
optionalbyAgent?:Record<string, {cost?:number;inputTokens:number;outputTokens:number; }>
Optional per-agent breakdown (for multi-agent turns)
usage.total
Section titled “usage.total”total:
object=UsageMetricsSchema
Total aggregated usage across all agents
usage.total.cost?
Section titled “usage.total.cost?”
optionalcost?:number
Computed cost in USD (optional, requires pricing data)
usage.total.inputTokens
Section titled “usage.total.inputTokens”inputTokens:
number
Input tokens consumed
usage.total.outputTokens
Section titled “usage.total.outputTokens”outputTokens:
number
Output tokens generated
session?
Section titled “session?”
readonlyoptionalsession?:IMakaioSession
Defined in: ../../../packages/hooks/src/types/hook-context.ts:72
Session object (populated when sessionId is available)