MCPcopy Index your code
hub / github.com/TanStack/ai / createAIDevtoolsEventEnvelope

Function createAIDevtoolsEventEnvelope

packages/ai-event-client/src/envelope.ts:82–112  ·  view source on GitHub ↗
(
  input: AIDevtoolsEventEnvelopeInput,
)

Source from the content-addressed store, hash-verified

80}
81
82export 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
114export function getAIDevtoolsRuntimeId(): string {
115 return getRuntimeId()

Callers 4

emitEventMethod · 0.90
createEnvelopeMethod · 0.90
DevtoolsContentFunction · 0.90
envelope.test.tsFile · 0.90

Calls 2

getRuntimeIdFunction · 0.85
idPartFunction · 0.85

Tested by

no test coverage detected