@@ -181,10 +181,10 @@ func TestSimple(t *testing.T) {
181181
182182 expectedEvents := []Event {
183183 UserMessage ("Hi" ),
184- StreamStarted (),
184+ StreamStarted (sess . ID , "root" ),
185185 AgentChoice ("root" , "Hello" ),
186186 TokenUsage (3 , 2 , 5 , 0 , 0 ),
187- StreamStopped (),
187+ StreamStopped (sess . ID , "root" ),
188188 }
189189
190190 require .Equal (t , expectedEvents , events )
@@ -206,14 +206,14 @@ func TestMultipleContentChunks(t *testing.T) {
206206
207207 expectedEvents := []Event {
208208 UserMessage ("Please greet me" ),
209- StreamStarted (),
209+ StreamStarted (sess . ID , "root" ),
210210 AgentChoice ("root" , "Hello " ),
211211 AgentChoice ("root" , "there, " ),
212212 AgentChoice ("root" , "how " ),
213213 AgentChoice ("root" , "are " ),
214214 AgentChoice ("root" , "you?" ),
215215 TokenUsage (8 , 12 , 20 , 0 , 0 ),
216- StreamStopped (),
216+ StreamStopped (sess . ID , "root" ),
217217 }
218218
219219 require .Equal (t , expectedEvents , events )
@@ -233,12 +233,12 @@ func TestWithReasoning(t *testing.T) {
233233
234234 expectedEvents := []Event {
235235 UserMessage ("Hi" ),
236- StreamStarted (),
236+ StreamStarted (sess . ID , "root" ),
237237 AgentChoiceReasoning ("root" , "Let me think about this..." ),
238238 AgentChoiceReasoning ("root" , " I should respond politely." ),
239239 AgentChoice ("root" , "Hello, how can I help you?" ),
240240 TokenUsage (10 , 15 , 25 , 0 , 0 ),
241- StreamStopped (),
241+ StreamStopped (sess . ID , "root" ),
242242 }
243243
244244 require .Equal (t , expectedEvents , events )
@@ -259,13 +259,13 @@ func TestMixedContentAndReasoning(t *testing.T) {
259259
260260 expectedEvents := []Event {
261261 UserMessage ("Hi there" ),
262- StreamStarted (),
262+ StreamStarted (sess . ID , "root" ),
263263 AgentChoiceReasoning ("root" , "The user wants a greeting" ),
264264 AgentChoice ("root" , "Hello!" ),
265265 AgentChoiceReasoning ("root" , " I should be friendly" ),
266266 AgentChoice ("root" , " How can I help you today?" ),
267267 TokenUsage (15 , 20 , 35 , 0 , 0 ),
268- StreamStopped (),
268+ StreamStopped (sess . ID , "root" ),
269269 }
270270
271271 require .Equal (t , expectedEvents , events )
@@ -318,66 +318,6 @@ func TestErrorEvent(t *testing.T) {
318318 require .Contains (t , errorEvent .Error , "simulated error" )
319319}
320320
321- func TestRuntimeRunStream_TableDriven (t * testing.T ) {
322- tests := []struct {
323- name string
324- streamBuilder func () * streamBuilder
325- userMessage string
326- expectedEvents []Event
327- }{
328- {
329- name : "single_word_response" ,
330- streamBuilder : func () * streamBuilder {
331- return newStreamBuilder ().AddContent ("Yes" ).AddStopWithUsage (2 , 1 )
332- },
333- userMessage : "Confirm" ,
334- expectedEvents : []Event {
335- UserMessage ("Confirm" ),
336- StreamStarted (),
337- AgentChoice ("root" , "Yes" ),
338- TokenUsage (2 , 1 , 3 , 0 , 0 ),
339- StreamStopped (),
340- },
341- },
342- {
343- name : "reasoning_only_response" ,
344- streamBuilder : func () * streamBuilder {
345- return newStreamBuilder ().AddReasoning ("Thinking..." ).AddStopWithUsage (5 , 3 )
346- },
347- userMessage : "Think about this" ,
348- expectedEvents : []Event {
349- UserMessage ("Think about this" ),
350- StreamStarted (),
351- AgentChoiceReasoning ("root" , "Thinking..." ),
352- TokenUsage (5 , 3 , 8 , 0 , 0 ),
353- StreamStopped (),
354- },
355- },
356- {
357- name : "zero_token_response" ,
358- streamBuilder : func () * streamBuilder {
359- return newStreamBuilder ().AddStopWithUsage (0 , 0 )
360- },
361- userMessage : "Empty" ,
362- expectedEvents : []Event {
363- UserMessage ("Empty" ),
364- StreamStarted (),
365- TokenUsage (0 , 0 , 0 , 0 , 0 ),
366- StreamStopped (),
367- },
368- },
369- }
370-
371- for _ , tt := range tests {
372- t .Run (tt .name , func (t * testing.T ) {
373- stream := tt .streamBuilder ().Build ()
374- sess := session .New (session .WithUserMessage ("" , tt .userMessage ))
375- events := runSession (t , sess , stream )
376- require .Equal (t , tt .expectedEvents , events )
377- })
378- }
379- }
380-
381321func TestContextCancellation (t * testing.T ) {
382322 stream := newStreamBuilder ().
383323 AddContent ("This should not complete" ).
0 commit comments