Interface: PostStepContext
Makaio Framework / hooks / PostStepContext
Interface: PostStepContext
Section titled “Interface: PostStepContext”Defined in: ../../../packages/hooks/src/types/hook-context.ts:219
PostStep context with step completion data.
Intercepts: AgentSubjects.step.finished event
Provides access to step type, metadata, and optional filtering. Enriches with session, recentHistory, and project when available.
Use stepType to filter for specific step types:
- ‘reasoning’: Thinking/reasoning blocks (extended thinking enabled)
- ‘tool_use’: Tool calls
- ‘text’: Regular text message blocks
Extends
Section titled “Extends”Indexable
Section titled “Indexable”[
key:string]:unknown
Properties
Section titled “Properties”adapterId
Section titled “adapterId”
readonlyadapterId:string
Defined in: ../../../packages/hooks/src/types/hook-context.ts:226
Adapter instance
adapterName
Section titled “adapterName”
readonlyadapterName:string
Defined in: ../../../packages/hooks/src/types/hook-context.ts:228
Adapter type name
agentId
Section titled “agentId”
readonlyagentId:string
Defined in: ../../../packages/hooks/src/types/hook-context.ts:224
Agent that completed the step
blockIndex
Section titled “blockIndex”
readonlyblockIndex:number
Defined in: ../../../packages/hooks/src/types/hook-context.ts:234
Content block index
readonlybus:IMakaioBus
Defined in: ../../../packages/hooks/src/types/hook-context.ts:76
Bus instance for making requests
Inherited from
Section titled “Inherited from”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.
Inherited from
Section titled “Inherited from”SessionHookContext.contextExtensions
correlationId?
Section titled “correlationId?”
readonlyoptionalcorrelationId?:string
Defined in: ../../../packages/hooks/src/types/hook-context.ts:249
Correlation identifier for tracing
hookEvent
Section titled “hookEvent”
readonlyhookEvent:"PostStep"
Defined in: ../../../packages/hooks/src/types/hook-context.ts:220
messageId?
Section titled “messageId?”
readonlyoptionalmessageId?:string
Defined in: ../../../packages/hooks/src/types/hook-context.ts:230
Message ID being processed
payload
Section titled “payload”
readonlypayload:object
Defined in: ../../../packages/hooks/src/types/hook-context.ts:247
Full step.finished payload for advanced use
adapterId
Section titled “adapterId”adapterId:
string
Adapter instance identifier (required)
adapterName
Section titled “adapterName”adapterName:
string
Adapter type name (e.g., ‘claude-code’) (required)
adapterSessionId
Section titled “adapterSessionId”adapterSessionId:
string
Provider’s native session ID (e.g., Claude conversation ID)
agentId
Section titled “agentId”agentId:
string
Unique agent identifier (required)
blockIndex
Section titled “blockIndex”blockIndex:
number
Content block index in the turn
clientId?
Section titled “clientId?”
optionalclientId?:string
Client identifier for the owning application/runtime when known.
content
Section titled “content”content: {
content:string;type:"text"; } | {source: {data:string;mimeType:string;type:"base64"; } | {mimeType?:string;type:"url";url:string; };type:"image"; } | {source: {data:string;mimeType:string;type:"base64"; } | {mimeType?:string;type:"url";url:string; };type:"document"; } | {attachmentType:"file"|"directory";displayName?:string;fileName:string;filePath:string;source: {data:string;mimeType:string;type:"base64"; } | {mimeType?:string;type:"url";url:string; };type:"attachment"; } | {content:string;metadata?:Record<string,unknown>;type:"reasoning"; } | {args:Record<string,unknown>;name:string;toolCallId:string;type:"tool_call"; } | {isError?:boolean;output:string;toolCallId:string;type:"tool_output"; } =SessionMessageBlockSchema
Step content for PostStep hooks (text, reasoning, tool_call, or tool_output)
Union Members
Section titled “Union Members”Type Literal
Section titled “Type Literal”{ content: string; type: "text"; }
Type Literal
Section titled “Type Literal”{ source: { data: string; mimeType: string; type: "base64"; } | { mimeType?: string; type: "url"; url: string; }; type: "image"; }
Type Literal
Section titled “Type Literal”{ source: { data: string; mimeType: string; type: "base64"; } | { mimeType?: string; type: "url"; url: string; }; type: "document"; }
Type Literal
Section titled “Type Literal”{ attachmentType: "file" | "directory"; displayName?: string; fileName: string; filePath: string; source: { data: string; mimeType: string; type: "base64"; } | { mimeType?: string; type: "url"; url: string; }; type: "attachment"; }
attachmentType
Section titled “attachmentType”attachmentType:
"file"|"directory"=AttachmentTypeSchema
Whether the attachment is a file or directory
displayName?
Section titled “displayName?”
optionaldisplayName?:string
Optional human-readable display name override
fileName
Section titled “fileName”fileName:
string
Original filename with extension (e.g. “api-spec.yaml”) — for display and type inference
filePath
Section titled “filePath”filePath:
string
Server-side file path — always populated before message reaches adapters
source
Section titled “source”source: {
data:string;mimeType:string;type:"base64"; } | {mimeType?:string;type:"url";url:string; } =ContentSourceSchema
Inline content — base64 for binary, raw string for text
type:
"attachment"
Type Literal
Section titled “Type Literal”{ content: string; metadata?: Record<string, unknown>; type: "reasoning"; }
content
Section titled “content”content:
string
metadata?
Section titled “metadata?”
optionalmetadata?:Record<string,unknown>
Optional provider/runtime metadata for reasoning blocks.
type:
"reasoning"
Type Literal
Section titled “Type Literal”{ args: Record<string, unknown>; name: string; toolCallId: string; type: "tool_call"; }
Type Literal
Section titled “Type Literal”{ isError?: boolean; output: string; toolCallId: string; type: "tool_output"; }
messageId?
Section titled “messageId?”
optionalmessageId?:string
Message ID being processed
occurredAt?
Section titled “occurredAt?”
optionaloccurredAt?:number
Event occurrence timestamp in epoch milliseconds when known.
providerConfigId?
Section titled “providerConfigId?”
optionalproviderConfigId?:string
Resolved provider configuration identifier when known.
sessionId?
Section titled “sessionId?”
optionalsessionId?:string
Makaio session ID (NOT provider’s native session ID)
stepType
Section titled “stepType”stepType:
"text"|"reasoning"|"tool_use"=StepTypeSchema
Step type (content block type)
turnId?
Section titled “turnId?”
optionalturnId?:string
Turn ID from the session orchestrator. Optional for backward compatibility.
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
Inherited from
Section titled “Inherited from”SessionHookContext.recentHistory
session?
Section titled “session?”
readonlyoptionalsession?:IMakaioSession
Defined in: ../../../packages/hooks/src/types/hook-context.ts:72
Session object (populated when sessionId is available)
Inherited from
Section titled “Inherited from”sessionId?
Section titled “sessionId?”
readonlyoptionalsessionId?:string
Defined in: ../../../packages/hooks/src/types/hook-context.ts:222
Session ID where step completed
stepContent?
Section titled “stepContent?”
readonlyoptionalstepContent?: {content:string;type:"text"; } | {source: {data:string;mimeType:string;type:"base64"; } | {mimeType?:string;type:"url";url:string; };type:"image"; } | {source: {data:string;mimeType:string;type:"base64"; } | {mimeType?:string;type:"url";url:string; };type:"document"; } | {attachmentType:"file"|"directory";displayName?:string;fileName:string;filePath:string;source: {data:string;mimeType:string;type:"base64"; } | {mimeType?:string;type:"url";url:string; };type:"attachment"; } | {content:string;metadata?:Record<string,unknown>;type:"reasoning"; } | {args:Record<string,unknown>;name:string;toolCallId:string;type:"tool_call"; } | {isError?:boolean;output:string;toolCallId:string;type:"tool_output"; }
Defined in: ../../../packages/hooks/src/types/hook-context.ts:245
Step content block (if available).
Fetched from message storage with retry logic. May be undefined if:
- messageId not available
- Message not yet persisted (timing window)
- Block index out of range
Contains actual content: reasoning text, tool args, or message text.
Union Members
Section titled “Union Members”Type Literal
Section titled “Type Literal”{ content: string; type: "text"; }
Type Literal
Section titled “Type Literal”{ source: { data: string; mimeType: string; type: "base64"; } | { mimeType?: string; type: "url"; url: string; }; type: "image"; }
Type Literal
Section titled “Type Literal”{ source: { data: string; mimeType: string; type: "base64"; } | { mimeType?: string; type: "url"; url: string; }; type: "document"; }
Type Literal
Section titled “Type Literal”{ attachmentType: "file" | "directory"; displayName?: string; fileName: string; filePath: string; source: { data: string; mimeType: string; type: "base64"; } | { mimeType?: string; type: "url"; url: string; }; type: "attachment"; }
attachmentType
Section titled “attachmentType”attachmentType:
"file"|"directory"=AttachmentTypeSchema
Whether the attachment is a file or directory
displayName?
Section titled “displayName?”
optionaldisplayName?:string
Optional human-readable display name override
fileName
Section titled “fileName”fileName:
string
Original filename with extension (e.g. “api-spec.yaml”) — for display and type inference
filePath
Section titled “filePath”filePath:
string
Server-side file path — always populated before message reaches adapters
source
Section titled “source”source: {
data:string;mimeType:string;type:"base64"; } | {mimeType?:string;type:"url";url:string; } =ContentSourceSchema
Inline content — base64 for binary, raw string for text
type:
"attachment"
Type Literal
Section titled “Type Literal”{ content: string; metadata?: Record<string, unknown>; type: "reasoning"; }
content
Section titled “content”content:
string
metadata?
Section titled “metadata?”
optionalmetadata?:Record<string,unknown>
Optional provider/runtime metadata for reasoning blocks.
type:
"reasoning"
Type Literal
Section titled “Type Literal”{ args: Record<string, unknown>; name: string; toolCallId: string; type: "tool_call"; }
Type Literal
Section titled “Type Literal”{ isError?: boolean; output: string; toolCallId: string; type: "tool_output"; }
stepType
Section titled “stepType”
readonlystepType:"text"|"reasoning"|"tool_use"
Defined in: ../../../packages/hooks/src/types/hook-context.ts:232
Step type (reasoning, tool_use, text)
Methods
Section titled “Methods”next()
Section titled “next()”next():
Promise<void>
Defined in: ../../../packages/hooks/src/types/hook-context.ts:253
Continue to the next interceptor in the chain.
Returns
Section titled “Returns”Promise<void>
stopPropagation()
Section titled “stopPropagation()”stopPropagation():
void
Defined in: ../../../packages/hooks/src/types/hook-context.ts:257
Stop propagation of this event.
Returns
Section titled “Returns”void