( draft: ToolFixtureRecordDraft, )
| 465 | } |
| 466 | |
| 467 | export function createToolFixtureRecord( |
| 468 | draft: ToolFixtureRecordDraft, |
| 469 | ): ToolFixtureRecord { |
| 470 | const createdAt = draft.createdAt ?? Date.now() |
| 471 | const fixtureScope = draft.hookId ?? draft.threadId ?? 'global' |
| 472 | const fixtureKey = draft.toolCallId ?? createdAt |
| 473 | |
| 474 | return { |
| 475 | id: draft.id ?? `fixture:${fixtureScope}:${draft.toolName}:${fixtureKey}`, |
| 476 | createdAt, |
| 477 | ...(draft.name ? { name: draft.name } : {}), |
| 478 | ...(draft.hookId ? { hookId: draft.hookId } : {}), |
| 479 | ...(draft.threadId ? { threadId: draft.threadId } : {}), |
| 480 | ...(draft.runId ? { runId: draft.runId } : {}), |
| 481 | toolName: draft.toolName, |
| 482 | input: draft.input, |
| 483 | output: draft.output ?? null, |
| 484 | ...(draft.execute !== undefined ? { execute: draft.execute } : {}), |
| 485 | ...(draft.message ? { message: draft.message } : {}), |
| 486 | ...(draft.toolCallId ? { toolCallId: draft.toolCallId } : {}), |
| 487 | ...(draft.messageId ? { messageId: draft.messageId } : {}), |
| 488 | ...(draft.errorText ? { errorText: draft.errorText } : {}), |
| 489 | } |
| 490 | } |
| 491 | |
| 492 | function createTimelineEvent( |
| 493 | eventType: string, |
no test coverage detected