Variable: TurnStorageSchemas
Makaio Framework / services-core/turn/schemas / TurnStorageSchemas
Variable: TurnStorageSchemas
Section titled “Variable: TurnStorageSchemas”
constTurnStorageSchemas:object
Defined in: ../../../packages/services/core/src/turn/schemas.ts:22
Zod schemas for all turn storage bus subjects.
Each entry becomes a subject identifier as storage:turn.<key>.
Type Declaration
Section titled “Type Declaration”complete
Section titled “complete”complete:
object
Complete a turn (mark as completed or error).
Subject: storage:turn.complete
Type: Request (RPC)
complete.request
Section titled “complete.request”request:
ZodObject<{error:ZodOptional<ZodString>;expectedStatus:ZodOptional<ZodEnum<{active:"active";completed:"completed";error:"error"; }>>;status:ZodEnum<{completed:"completed";error:"error"; }>;turnId:ZodString;usage:ZodOptional<ZodObject<{byAgent:ZodOptional<ZodRecord<ZodString,ZodObject<{cost: …;inputTokens: …;outputTokens: …; },$strip>>>;total:ZodObject<{cost:ZodOptional<ZodNumber>;inputTokens:ZodNumber;outputTokens:ZodNumber; },$strip>; },$strip>>; },$strip>
complete.response
Section titled “complete.response”response:
ZodObject<{transitioned:ZodBoolean;turn:ZodObject<{completedAt:ZodOptional<ZodNumber>;error:ZodOptional<ZodString>;sessionId:ZodString;startedAt:ZodNumber;status:ZodEnum<{active:"active";completed:"completed";error:"error"; }>;turnId:ZodString;turnNumber:ZodNumber;usage:ZodOptional<ZodObject<{byAgent:ZodOptional<ZodRecord<…, …>>;total:ZodObject<{cost: …;inputTokens: …;outputTokens: …; },$strip>; },$strip>>; },$strip>; },$strip>
create
Section titled “create”create:
object
Create a new turn.
Subject: storage:turn.create
Type: Request (RPC)
create.request
Section titled “create.request”request:
ZodObject<{sessionId:ZodString;turnId:ZodOptional<ZodString>; },$strip>
create.response
Section titled “create.response”response:
ZodObject<{turn:ZodObject<{completedAt:ZodOptional<ZodNumber>;error:ZodOptional<ZodString>;sessionId:ZodString;startedAt:ZodNumber;status:ZodEnum<{active:"active";completed:"completed";error:"error"; }>;turnId:ZodString;turnNumber:ZodNumber;usage:ZodOptional<ZodObject<{byAgent:ZodOptional<ZodRecord<…, …>>;total:ZodObject<{cost: …;inputTokens: …;outputTokens: …; },$strip>; },$strip>>; },$strip>; },$strip>
get:
object
Get a turn by ID.
Subject: storage:turn.get
Type: Request (RPC)
get.request
Section titled “get.request”request:
ZodObject<{turnId:ZodString; },$strip>
get.response
Section titled “get.response”response:
ZodObject<{turn:ZodNullable<ZodObject<{completedAt:ZodOptional<ZodNumber>;error:ZodOptional<ZodString>;sessionId:ZodString;startedAt:ZodNumber;status:ZodEnum<{active:"active";completed:"completed";error:"error"; }>;turnId:ZodString;turnNumber:ZodNumber;usage:ZodOptional<ZodObject<{byAgent:ZodOptional<…>;total:ZodObject<…, …>; },$strip>>; },$strip>>; },$strip>
getActive
Section titled “getActive”getActive:
object
Get the active turn for a session (if any).
Subject: storage:turn.getActive
Type: Request (RPC)
getActive.request
Section titled “getActive.request”request:
ZodObject<{sessionId:ZodString; },$strip>
getActive.response
Section titled “getActive.response”response:
ZodObject<{turn:ZodNullable<ZodObject<{completedAt:ZodOptional<ZodNumber>;error:ZodOptional<ZodString>;sessionId:ZodString;startedAt:ZodNumber;status:ZodEnum<{active:"active";completed:"completed";error:"error"; }>;turnId:ZodString;turnNumber:ZodNumber;usage:ZodOptional<ZodObject<{byAgent:ZodOptional<…>;total:ZodObject<…, …>; },$strip>>; },$strip>>; },$strip>
getBySession
Section titled “getBySession”getBySession:
object
List turns for a session.
Subject: storage:turn.getBySession
Type: Request (RPC)
getBySession.request
Section titled “getBySession.request”request:
ZodObject<{limit:ZodOptional<ZodNumber>;sessionId:ZodString;status:ZodOptional<ZodEnum<{active:"active";completed:"completed";error:"error"; }>>; },$strip>
getBySession.response
Section titled “getBySession.response”response:
ZodObject<{turns:ZodArray<ZodObject<{completedAt:ZodOptional<ZodNumber>;error:ZodOptional<ZodString>;sessionId:ZodString;startedAt:ZodNumber;status:ZodEnum<{active:"active";completed:"completed";error:"error"; }>;turnId:ZodString;turnNumber:ZodNumber;usage:ZodOptional<ZodObject<{byAgent:ZodOptional<…>;total:ZodObject<…, …>; },$strip>>; },$strip>>; },$strip>
listActive
Section titled “listActive”listActive:
object
List all active turns across all sessions.
Used at startup to identify orphaned turns left active after a process crash.
No session filter — returns every turn with status 'active'.
Subject: storage:turn.listActive
Type: Request (RPC)
listActive.request
Section titled “listActive.request”request:
ZodObject<{ },$strip>
listActive.response
Section titled “listActive.response”response:
ZodObject<{turns:ZodArray<ZodObject<{completedAt:ZodOptional<ZodNumber>;error:ZodOptional<ZodString>;sessionId:ZodString;startedAt:ZodNumber;status:ZodEnum<{active:"active";completed:"completed";error:"error"; }>;turnId:ZodString;turnNumber:ZodNumber;usage:ZodOptional<ZodObject<{byAgent:ZodOptional<…>;total:ZodObject<…, …>; },$strip>>; },$strip>>; },$strip>
set:
object
Store or update a turn with full data.
Subject: storage:turn.set
Type: Request (RPC)
Used for imports and backfills that need to preserve timestamps/usage.
set.request
Section titled “set.request”request:
ZodObject<{turn:ZodObject<{completedAt:ZodOptional<ZodNumber>;error:ZodOptional<ZodString>;sessionId:ZodString;startedAt:ZodNumber;status:ZodEnum<{active:"active";completed:"completed";error:"error"; }>;turnId:ZodString;turnNumber:ZodNumber;usage:ZodOptional<ZodObject<{byAgent:ZodOptional<ZodRecord<…, …>>;total:ZodObject<{cost: …;inputTokens: …;outputTokens: …; },$strip>; },$strip>>; },$strip>; },$strip>
set.response
Section titled “set.response”response:
ZodObject<{turn:ZodObject<{completedAt:ZodOptional<ZodNumber>;error:ZodOptional<ZodString>;sessionId:ZodString;startedAt:ZodNumber;status:ZodEnum<{active:"active";completed:"completed";error:"error"; }>;turnId:ZodString;turnNumber:ZodNumber;usage:ZodOptional<ZodObject<{byAgent:ZodOptional<ZodRecord<…, …>>;total:ZodObject<{cost: …;inputTokens: …;outputTokens: …; },$strip>; },$strip>>; },$strip>; },$strip>