MCPcopy Create free account
hub / github.com/apache/maka / decodeTurnStartInput

Function decodeTurnStartInput

packages/runtime-host/src/protocol/turn.ts:312–332  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

310} as const;
311
312function decodeTurnStartInput(value: unknown): TurnStartInput {
313 const record = requireShapedRecord(
314 value,
315 'turn.start input',
316 ['sessionId', 'turnId', 'content'],
317 ['skillIds', 'turnOrchestration', 'maxSteps'],
318 );
319 const skillIds = decodeSkillIds(record.skillIds);
320 return {
321 sessionId: requireEntityId(record.sessionId, 'sessionId'),
322 turnId: requireEntityId(record.turnId, 'turnId'),
323 content: decodeMessageContent(record.content, skillIds.length > 0),
324 ...(skillIds.length > 0 ? { skillIds } : {}),
325 ...(record.turnOrchestration !== undefined
326 ? { turnOrchestration: decodeTurnOrchestration(record.turnOrchestration) }
327 : {}),
328 ...(record.maxSteps !== undefined
329 ? { maxSteps: requirePositiveSafeInteger(record.maxSteps, 'maxSteps') }
330 : {}),
331 };
332}
333
334function requirePositiveSafeInteger(value: unknown, label: string): number {
335 const decoded = requireCount(value, label);

Callers

nothing calls this directly

Calls 6

decodeMessageContentFunction · 0.90
requireShapedRecordFunction · 0.85
decodeSkillIdsFunction · 0.85
requireEntityIdFunction · 0.85
decodeTurnOrchestrationFunction · 0.85

Tested by

no test coverage detected