(
request: InvocationRequest,
known?: { continuation: InvocationRequest['continuation'] },
)
| 519 | } |
| 520 | |
| 521 | function snapshotInvocationRequest( |
| 522 | request: InvocationRequest, |
| 523 | known?: { continuation: InvocationRequest['continuation'] }, |
| 524 | ): InvocationRequest { |
| 525 | const continuation = known ? known.continuation : request.continuation; |
| 526 | const snapshot: InvocationRequest = { |
| 527 | sessionId: request.sessionId, |
| 528 | ...(request.invocationId !== undefined ? { invocationId: request.invocationId } : {}), |
| 529 | ...(request.runId !== undefined ? { runId: request.runId } : {}), |
| 530 | turnId: request.turnId, |
| 531 | text: request.text, |
| 532 | source: request.source, |
| 533 | ...(request.orchestration !== undefined |
| 534 | ? { orchestration: cloneAndFreezeSnapshotValue(request.orchestration) } |
| 535 | : {}), |
| 536 | ...(request.toolMode !== undefined ? { toolMode: request.toolMode } : {}), |
| 537 | ...(request.maxSteps !== undefined ? { maxSteps: request.maxSteps } : {}), |
| 538 | ...(request.attachments !== undefined |
| 539 | ? { attachments: cloneAndFreezeSnapshotValue(request.attachments) } |
| 540 | : {}), |
| 541 | ...(request.quotes !== undefined |
| 542 | ? { quotes: cloneAndFreezeSnapshotValue(request.quotes) } |
| 543 | : {}), |
| 544 | ...(request.inlineReferences !== undefined |
| 545 | ? { inlineReferences: cloneAndFreezeSnapshotValue(request.inlineReferences) } |
| 546 | : {}), |
| 547 | ...(request.context !== undefined |
| 548 | ? { context: cloneAndFreezeSnapshotValue(request.context) } |
| 549 | : {}), |
| 550 | ...(request.runtimeContext !== undefined |
| 551 | ? { runtimeContext: cloneAndFreezeSnapshotValue(request.runtimeContext) } |
| 552 | : {}), |
| 553 | ...(continuation !== undefined |
| 554 | ? { continuation: cloneAndFreezeSnapshotValue(continuation) } |
| 555 | : {}), |
| 556 | ...(request.initialRuntimeEvent !== undefined |
| 557 | ? { initialRuntimeEvent: cloneAndFreezeSnapshotValue(request.initialRuntimeEvent) } |
| 558 | : {}), |
| 559 | ...(request.branch !== undefined ? { branch: request.branch } : {}), |
| 560 | ...(request.lineage !== undefined |
| 561 | ? { lineage: cloneAndFreezeSnapshotValue(request.lineage) } |
| 562 | : {}), |
| 563 | ...(request.pullSteering !== undefined ? { pullSteering: request.pullSteering } : {}), |
| 564 | ...(request.ackSteering !== undefined ? { ackSteering: request.ackSteering } : {}), |
| 565 | ...(request.nackSteering !== undefined ? { nackSteering: request.nackSteering } : {}), |
| 566 | ...(request.abortSignal !== undefined ? { abortSignal: request.abortSignal } : {}), |
| 567 | }; |
| 568 | return Object.freeze(snapshot); |
| 569 | } |
| 570 | |
| 571 | function cloneAndFreezeSnapshotValue<T>(value: T): T { |
| 572 | if (Array.isArray(value)) { |
no test coverage detected