( input: AIDevtoolsEventEnvelopeInput, )
| 80 | } |
| 81 | |
| 82 | export function createAIDevtoolsEventEnvelope( |
| 83 | input: AIDevtoolsEventEnvelopeInput, |
| 84 | ): AIDevtoolsEventEnvelope { |
| 85 | const resolvedRuntimeId = input.runtimeId ?? getRuntimeId() |
| 86 | const eventId = |
| 87 | input.eventId && input.eventId.length > 0 |
| 88 | ? input.eventId |
| 89 | : [ |
| 90 | input.source, |
| 91 | input.eventType, |
| 92 | idPart(resolvedRuntimeId), |
| 93 | idPart(input.clientId), |
| 94 | idPart(input.requestId), |
| 95 | idPart(input.streamId), |
| 96 | idPart(input.hookId), |
| 97 | idPart(input.threadId), |
| 98 | idPart(input.runId), |
| 99 | idPart(input.messageId), |
| 100 | idPart(input.toolCallId), |
| 101 | idPart(input.sequence), |
| 102 | input.timestamp, |
| 103 | getRuntimeId(), |
| 104 | eventCounter++, |
| 105 | ].join(':') |
| 106 | |
| 107 | return { |
| 108 | ...input, |
| 109 | runtimeId: resolvedRuntimeId, |
| 110 | eventId, |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | export function getAIDevtoolsRuntimeId(): string { |
| 115 | return getRuntimeId() |
no test coverage detected