convex-durable-agents 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +1 -0
  2. package/dist/client/handler.d.ts +4 -0
  3. package/dist/client/handler.d.ts.map +1 -1
  4. package/dist/client/handler.js +25 -3
  5. package/dist/client/handler.js.map +1 -1
  6. package/dist/client/streamer.d.ts +3 -1
  7. package/dist/client/streamer.d.ts.map +1 -1
  8. package/dist/client/streamer.js +9 -3
  9. package/dist/client/streamer.js.map +1 -1
  10. package/dist/component/tool_calls.d.ts +1 -0
  11. package/dist/component/tool_calls.d.ts.map +1 -1
  12. package/dist/component/tool_calls.js +7 -0
  13. package/dist/component/tool_calls.js.map +1 -1
  14. package/dist/react/test/happy-dom-setup.d.ts +2 -0
  15. package/dist/react/test/happy-dom-setup.d.ts.map +1 -0
  16. package/dist/react/test/happy-dom-setup.js +28 -0
  17. package/dist/react/test/happy-dom-setup.js.map +1 -0
  18. package/dist/utils/msg.d.ts +3 -0
  19. package/dist/utils/msg.d.ts.map +1 -0
  20. package/dist/utils/msg.js +7 -0
  21. package/dist/utils/msg.js.map +1 -0
  22. package/package.json +24 -21
  23. package/src/client/handler.ts +33 -2
  24. package/src/client/streamer.test.ts +187 -0
  25. package/src/client/streamer.ts +10 -3
  26. package/src/client/tools.test.ts +48 -0
  27. package/src/component/messages.test.ts +40 -0
  28. package/src/component/streams.test.ts +118 -0
  29. package/src/component/threads.test.ts +48 -0
  30. package/src/component/tool_calls.ts +9 -0
  31. package/src/react/__fixtures__/01-early-streaming-start.json +35 -0
  32. package/src/react/__fixtures__/02-reasoning-complete-tool-call.json +85 -0
  33. package/src/react/__fixtures__/03-new-round-seq2.json +89 -0
  34. package/src/react/__fixtures__/04-tool-call-error-seq3.json +145 -0
  35. package/src/react/__fixtures__/05-later-round-seq5.json +117 -0
  36. package/src/react/__fixtures__/06-text-streaming-seq6.json +162 -0
  37. package/src/react/__fixtures__/07-text-streaming-more-seq6.json +212 -0
  38. package/src/react/__fixtures__/08-fully-committed-seq6.json +188 -0
  39. package/src/react/__snapshots__/apply-streaming-updates.test.ts.snap +1357 -0
  40. package/src/react/__snapshots__/use-thread-messages.test.tsx.snap +1429 -0
  41. package/src/react/agent-chat.test.tsx +155 -0
  42. package/src/react/apply-streaming-updates.test.ts +28 -0
  43. package/src/react/test/happy-dom-setup.ts +31 -0
  44. package/src/react/use-thread-messages.test.tsx +702 -0
  45. package/src/utils/msg.test.ts +34 -0
  46. package/src/utils/msg.ts +8 -0
  47. package/src/utils/retry.test.ts +214 -0
@@ -0,0 +1,1429 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`useThreadMessages with fixtures > 01-early-streaming-start (log line 31988) 1`] = `
4
+ {
5
+ "isComplete": false,
6
+ "isFailed": false,
7
+ "isLoading": false,
8
+ "isRunning": true,
9
+ "isStopped": false,
10
+ "messages": [
11
+ {
12
+ "id": "LT8PGDxTlpf0lVZs",
13
+ "metadata": {
14
+ "_creationTime": 1770783020905.086,
15
+ "committedSeq": undefined,
16
+ "key": "fixture-thread-LT8PGDxTlpf0lVZs",
17
+ "status": "success",
18
+ },
19
+ "parts": [
20
+ {
21
+ "text": "get me a weather forecast for this weekend",
22
+ "type": "text",
23
+ },
24
+ ],
25
+ "role": "user",
26
+ },
27
+ {
28
+ "id": "vsOhda95lumMg4QZ",
29
+ "parts": [],
30
+ "role": "assistant",
31
+ },
32
+ ],
33
+ "status": "streaming",
34
+ }
35
+ `;
36
+
37
+ exports[`useThreadMessages with fixtures > 02-reasoning-complete-tool-call (log line 31998) 1`] = `
38
+ {
39
+ "isComplete": false,
40
+ "isFailed": false,
41
+ "isLoading": false,
42
+ "isRunning": true,
43
+ "isStopped": false,
44
+ "messages": [
45
+ {
46
+ "id": "LT8PGDxTlpf0lVZs",
47
+ "metadata": {
48
+ "_creationTime": 1770783020905.086,
49
+ "committedSeq": undefined,
50
+ "key": "fixture-thread-LT8PGDxTlpf0lVZs",
51
+ "status": "success",
52
+ },
53
+ "parts": [
54
+ {
55
+ "text": "get me a weather forecast for this weekend",
56
+ "type": "text",
57
+ },
58
+ ],
59
+ "role": "user",
60
+ },
61
+ {
62
+ "id": "vsOhda95lumMg4QZ",
63
+ "parts": [
64
+ {
65
+ "type": "step-start",
66
+ },
67
+ {
68
+ "providerMetadata": undefined,
69
+ "state": "done",
70
+ "text": "The user wants a weather forecast for this weekend. I should use the Weather capability which provides "current conditions, hourly and multi-day forecasts for any location worldwide". That should have what I need for a weekend forecast.
71
+
72
+ Let me read the Weather CAPABILITY.md to see how to query it.",
73
+ "type": "reasoning",
74
+ },
75
+ {
76
+ "errorText": undefined,
77
+ "input": undefined,
78
+ "output": undefined,
79
+ "preliminary": undefined,
80
+ "providerExecuted": undefined,
81
+ "rawInput": undefined,
82
+ "state": "input-streaming",
83
+ "title": undefined,
84
+ "toolCallId": "tooluse_4X05H1krEnm7rFppLQw1pi",
85
+ "type": "tool-readFile",
86
+ },
87
+ ],
88
+ "role": "assistant",
89
+ },
90
+ ],
91
+ "status": "streaming",
92
+ }
93
+ `;
94
+
95
+ exports[`useThreadMessages with fixtures > 03-new-round-seq2 (log line 32006) 1`] = `
96
+ {
97
+ "isComplete": false,
98
+ "isFailed": false,
99
+ "isLoading": false,
100
+ "isRunning": true,
101
+ "isStopped": false,
102
+ "messages": [
103
+ {
104
+ "id": "LT8PGDxTlpf0lVZs",
105
+ "metadata": {
106
+ "_creationTime": 1770783020905.086,
107
+ "committedSeq": undefined,
108
+ "key": "fixture-thread-LT8PGDxTlpf0lVZs",
109
+ "status": "success",
110
+ },
111
+ "parts": [
112
+ {
113
+ "text": "get me a weather forecast for this weekend",
114
+ "type": "text",
115
+ },
116
+ ],
117
+ "role": "user",
118
+ },
119
+ {
120
+ "id": "vsOhda95lumMg4QZ",
121
+ "metadata": {
122
+ "_creationTime": 1770783024158.487,
123
+ "committedSeq": 1,
124
+ "key": "fixture-thread-vsOhda95lumMg4QZ",
125
+ "status": "success",
126
+ },
127
+ "parts": [
128
+ {
129
+ "type": "step-start",
130
+ },
131
+ {
132
+ "providerMetadata": {
133
+ "bedrock": {
134
+ "signature": "AxB2kT9pLmNcDfEgHiJkLmNoPqRsTuVwXyZ0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEF",
135
+ },
136
+ },
137
+ "state": "done",
138
+ "text": "The user wants a weather forecast for this weekend. I should use the Weather capability which provides "current conditions, hourly and multi-day forecasts for any location worldwide". That should have what I need for a weekend forecast.
139
+
140
+ Let me read the Weather CAPABILITY.md to see how to query it.",
141
+ "type": "reasoning",
142
+ },
143
+ {
144
+ "input": {
145
+ "path": "capabilities/weather/CAPABILITY.md",
146
+ },
147
+ "output": "---
148
+ name: Weather
149
+ description: Weather provides current conditions, hourly and multi-day forecasts for any location worldwide
150
+ ---
151
+
152
+ # Weather Service
153
+
154
+ Global weather data provider with current observations and forecasts.
155
+
156
+ ## Data Overview
157
+
158
+ - Current conditions: temperature, humidity, wind, visibility
159
+ - Hourly forecasts: up to 48 hours ahead
160
+ - Daily forecasts: up to 10 days ahead
161
+ - Historical data: past 30 days
162
+
163
+ ## Examples
164
+
165
+ Get a multi-day forecast:
166
+
167
+ \`\`\`typescript
168
+ const forecast = await getWeather("weatherprod", {
169
+ location: "San Francisco, CA",
170
+ type: "daily",
171
+ days: 7,
172
+ });
173
+ console.log(forecast);
174
+ \`\`\`
175
+
176
+ Get current conditions:
177
+
178
+ \`\`\`typescript
179
+ const current = await getWeather("weatherprod", {
180
+ location: "New York, NY",
181
+ type: "current",
182
+ });
183
+ console.log(current);
184
+ \`\`\`
185
+
186
+ ## Guidelines
187
+
188
+ - Always specify a location string with city and state/country.
189
+ - Use type "daily" for multi-day forecasts and "current" for present conditions.
190
+ ",
191
+ "state": "output-available",
192
+ "toolCallId": "tooluse_4X05H1krEnm7rFppLQw1pi",
193
+ "type": "tool-readFile",
194
+ },
195
+ {
196
+ "type": "step-start",
197
+ },
198
+ {
199
+ "providerMetadata": undefined,
200
+ "state": "done",
201
+ "text": "Now let me fetch the weekend forecast for your area:",
202
+ "type": "text",
203
+ },
204
+ ],
205
+ "role": "assistant",
206
+ },
207
+ ],
208
+ "status": "streaming",
209
+ }
210
+ `;
211
+
212
+ exports[`useThreadMessages with fixtures > 04-tool-call-error-seq3 (log line 32020) 1`] = `
213
+ {
214
+ "isComplete": false,
215
+ "isFailed": false,
216
+ "isLoading": false,
217
+ "isRunning": true,
218
+ "isStopped": false,
219
+ "messages": [
220
+ {
221
+ "id": "LT8PGDxTlpf0lVZs",
222
+ "metadata": {
223
+ "_creationTime": 1770783020905.086,
224
+ "committedSeq": undefined,
225
+ "key": "fixture-thread-LT8PGDxTlpf0lVZs",
226
+ "status": "success",
227
+ },
228
+ "parts": [
229
+ {
230
+ "text": "get me a weather forecast for this weekend",
231
+ "type": "text",
232
+ },
233
+ ],
234
+ "role": "user",
235
+ },
236
+ {
237
+ "id": "vsOhda95lumMg4QZ",
238
+ "metadata": {
239
+ "_creationTime": 1770783024158.487,
240
+ "committedSeq": 2,
241
+ "key": "fixture-thread-vsOhda95lumMg4QZ",
242
+ "status": "success",
243
+ },
244
+ "parts": [
245
+ {
246
+ "type": "step-start",
247
+ },
248
+ {
249
+ "providerMetadata": {
250
+ "bedrock": {
251
+ "signature": "AxB2kT9pLmNcDfEgHiJkLmNoPqRsTuVwXyZ0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEF",
252
+ },
253
+ },
254
+ "state": "done",
255
+ "text": "The user wants a weather forecast for this weekend. I should use the Weather capability which provides "current conditions, hourly and multi-day forecasts for any location worldwide". That should have what I need for a weekend forecast.
256
+
257
+ Let me read the Weather CAPABILITY.md to see how to query it.",
258
+ "type": "reasoning",
259
+ },
260
+ {
261
+ "input": {
262
+ "path": "capabilities/weather/CAPABILITY.md",
263
+ },
264
+ "output": "---
265
+ name: Weather
266
+ description: Weather provides current conditions, hourly and multi-day forecasts for any location worldwide
267
+ ---
268
+
269
+ # Weather Service
270
+
271
+ Global weather data provider with current observations and forecasts.
272
+
273
+ ## Data Overview
274
+
275
+ - Current conditions: temperature, humidity, wind, visibility
276
+ - Hourly forecasts: up to 48 hours ahead
277
+ - Daily forecasts: up to 10 days ahead
278
+ - Historical data: past 30 days
279
+
280
+ ## Examples
281
+
282
+ Get a multi-day forecast:
283
+
284
+ \`\`\`typescript
285
+ const forecast = await getWeather("weatherprod", {
286
+ location: "San Francisco, CA",
287
+ type: "daily",
288
+ days: 7,
289
+ });
290
+ console.log(forecast);
291
+ \`\`\`
292
+
293
+ Get current conditions:
294
+
295
+ \`\`\`typescript
296
+ const current = await getWeather("weatherprod", {
297
+ location: "New York, NY",
298
+ type: "current",
299
+ });
300
+ console.log(current);
301
+ \`\`\`
302
+
303
+ ## Guidelines
304
+
305
+ - Always specify a location string with city and state/country.
306
+ - Use type "daily" for multi-day forecasts and "current" for present conditions.
307
+ ",
308
+ "state": "output-available",
309
+ "toolCallId": "tooluse_4X05H1krEnm7rFppLQw1pi",
310
+ "type": "tool-readFile",
311
+ },
312
+ {
313
+ "type": "step-start",
314
+ },
315
+ {
316
+ "state": "done",
317
+ "text": "Now let me fetch the weekend forecast for your area:",
318
+ "type": "text",
319
+ },
320
+ {
321
+ "errorText": "Code execution failed:
322
+ Weather API request failed: Bad Request
323
+ WeatherApiError: Weather API request failed: Bad Request
324
+ at getWeather (/workspace/services/executor/.cache/revision-envs/k970rr9s6zxgkh8rg4fdbbhw3d80yzhs/bundle.mjs:2141:15)
325
+ at async <anonymous> (script.ts:2:35)
326
+ at async executeTypeScript (/workspace/services/executor/src/exec.ts:507:14)
327
+ at processTicksAndRejections (native:7:39)
328
+ {"messages":[{"type":"FATAL","text":"Invalid date range specified."}]}
329
+ {"headers":{"cache-control":"no-store, no-cache, must-revalidate, max-age=0","content-length":"52","content-type":"application/json; charset=UTF-8","date":"Wed, 11 Feb 2026 04:10:27 GMT"},"status":400}",
330
+ "input": {
331
+ "code": "
332
+ const forecast = await getWeather("weatherprod", {
333
+ location: "San Francisco, CA",
334
+ type: "daily",
335
+ startDate: "2026-02-14",
336
+ endDate: "2026-02-15",
337
+ });
338
+ console.log("Weekend Forecast");
339
+ console.log("================");
340
+ console.log(JSON.stringify(forecast, null, 2));
341
+ ",
342
+ "description": "Get weekend weather forecast",
343
+ },
344
+ "state": "output-error",
345
+ "toolCallId": "tooluse_g3zTfupLSe8DI2Yla3gzG1",
346
+ "type": "tool-runCode",
347
+ },
348
+ {
349
+ "type": "step-start",
350
+ },
351
+ {
352
+ "state": "done",
353
+ "text": "Let me fix the query parameters:",
354
+ "type": "text",
355
+ },
356
+ {
357
+ "errorText": undefined,
358
+ "input": {
359
+ "code": "
360
+ const forecast = await getWeather("weatherprod", {
361
+ location: "San Francisco, CA",
362
+ type: "daily",
363
+ days: 3,
364
+ });
365
+ console.log("Weekend Weather Forecast");
366
+ console.log("========================");
367
+ forecast.days.forEach((day: any) => {
368
+ console.log(\`\${day.date}: High \${day.high}°F / Low \${day.low}°F | \${day.condition} | Wind \${day.wind_mph} mph\`);
369
+ });
370
+ ",
371
+ "description": "Get weekend weather forecast",
372
+ },
373
+ "output": undefined,
374
+ "preliminary": undefined,
375
+ "providerExecuted": undefined,
376
+ "rawInput": undefined,
377
+ "state": "input-available",
378
+ "toolCallId": "tooluse_vGo3riHmTITFJfPvsE2y4k",
379
+ "type": "tool-runCode",
380
+ },
381
+ {
382
+ "type": "step-start",
383
+ },
384
+ {
385
+ "providerMetadata": undefined,
386
+ "state": "done",
387
+ "text": "Let me fix the query parameters:",
388
+ "type": "text",
389
+ },
390
+ ],
391
+ "role": "assistant",
392
+ },
393
+ ],
394
+ "status": "streaming",
395
+ }
396
+ `;
397
+
398
+ exports[`useThreadMessages with fixtures > 05-later-round-seq5 (log line 32032) 1`] = `
399
+ {
400
+ "isComplete": false,
401
+ "isFailed": false,
402
+ "isLoading": false,
403
+ "isRunning": true,
404
+ "isStopped": false,
405
+ "messages": [
406
+ {
407
+ "id": "LT8PGDxTlpf0lVZs",
408
+ "metadata": {
409
+ "_creationTime": 1770783020905.086,
410
+ "committedSeq": undefined,
411
+ "key": "fixture-thread-LT8PGDxTlpf0lVZs",
412
+ "status": "success",
413
+ },
414
+ "parts": [
415
+ {
416
+ "text": "get me a weather forecast for this weekend",
417
+ "type": "text",
418
+ },
419
+ ],
420
+ "role": "user",
421
+ },
422
+ {
423
+ "id": "vsOhda95lumMg4QZ",
424
+ "metadata": {
425
+ "_creationTime": 1770783024158.487,
426
+ "committedSeq": 4,
427
+ "key": "fixture-thread-vsOhda95lumMg4QZ",
428
+ "status": "success",
429
+ },
430
+ "parts": [
431
+ {
432
+ "type": "step-start",
433
+ },
434
+ {
435
+ "providerMetadata": {
436
+ "bedrock": {
437
+ "signature": "AxB2kT9pLmNcDfEgHiJkLmNoPqRsTuVwXyZ0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEF",
438
+ },
439
+ },
440
+ "state": "done",
441
+ "text": "The user wants a weather forecast for this weekend. I should use the Weather capability which provides "current conditions, hourly and multi-day forecasts for any location worldwide". That should have what I need for a weekend forecast.
442
+
443
+ Let me read the Weather CAPABILITY.md to see how to query it.",
444
+ "type": "reasoning",
445
+ },
446
+ {
447
+ "input": {
448
+ "path": "capabilities/weather/CAPABILITY.md",
449
+ },
450
+ "output": "---
451
+ name: Weather
452
+ description: Weather provides current conditions, hourly and multi-day forecasts for any location worldwide
453
+ ---
454
+
455
+ # Weather Service
456
+
457
+ Global weather data provider with current observations and forecasts.
458
+
459
+ ## Data Overview
460
+
461
+ - Current conditions: temperature, humidity, wind, visibility
462
+ - Hourly forecasts: up to 48 hours ahead
463
+ - Daily forecasts: up to 10 days ahead
464
+ - Historical data: past 30 days
465
+
466
+ ## Examples
467
+
468
+ Get a multi-day forecast:
469
+
470
+ \`\`\`typescript
471
+ const forecast = await getWeather("weatherprod", {
472
+ location: "San Francisco, CA",
473
+ type: "daily",
474
+ days: 7,
475
+ });
476
+ console.log(forecast);
477
+ \`\`\`
478
+
479
+ Get current conditions:
480
+
481
+ \`\`\`typescript
482
+ const current = await getWeather("weatherprod", {
483
+ location: "New York, NY",
484
+ type: "current",
485
+ });
486
+ console.log(current);
487
+ \`\`\`
488
+
489
+ ## Guidelines
490
+
491
+ - Always specify a location string with city and state/country.
492
+ - Use type "daily" for multi-day forecasts and "current" for present conditions.
493
+ ",
494
+ "state": "output-available",
495
+ "toolCallId": "tooluse_4X05H1krEnm7rFppLQw1pi",
496
+ "type": "tool-readFile",
497
+ },
498
+ {
499
+ "type": "step-start",
500
+ },
501
+ {
502
+ "state": "done",
503
+ "text": "Now let me fetch the weekend forecast for your area:",
504
+ "type": "text",
505
+ },
506
+ {
507
+ "errorText": "Code execution failed:
508
+ Weather API request failed: Bad Request
509
+ WeatherApiError: Weather API request failed: Bad Request
510
+ at getWeather (/workspace/services/executor/.cache/revision-envs/k970rr9s6zxgkh8rg4fdbbhw3d80yzhs/bundle.mjs:2141:15)
511
+ at async <anonymous> (script.ts:2:35)
512
+ at async executeTypeScript (/workspace/services/executor/src/exec.ts:507:14)
513
+ at processTicksAndRejections (native:7:39)
514
+ {"messages":[{"type":"FATAL","text":"Invalid date range specified."}]}
515
+ {"headers":{"cache-control":"no-store, no-cache, must-revalidate, max-age=0","content-length":"52","content-type":"application/json; charset=UTF-8","date":"Wed, 11 Feb 2026 04:10:27 GMT"},"status":400}",
516
+ "input": {
517
+ "code": "
518
+ const forecast = await getWeather("weatherprod", {
519
+ location: "San Francisco, CA",
520
+ type: "daily",
521
+ startDate: "2026-02-14",
522
+ endDate: "2026-02-15",
523
+ });
524
+ console.log("Weekend Forecast");
525
+ console.log("================");
526
+ console.log(JSON.stringify(forecast, null, 2));
527
+ ",
528
+ "description": "Get weekend weather forecast",
529
+ },
530
+ "state": "output-error",
531
+ "toolCallId": "tooluse_g3zTfupLSe8DI2Yla3gzG1",
532
+ "type": "tool-runCode",
533
+ },
534
+ {
535
+ "type": "step-start",
536
+ },
537
+ {
538
+ "state": "done",
539
+ "text": "Let me fix the query parameters:",
540
+ "type": "text",
541
+ },
542
+ {
543
+ "errorText": "TypeScript compilation failed:
544
+ Line 10:9: Property 'forEach' does not exist on type 'GetWeatherResult'. (TS2339)",
545
+ "input": {
546
+ "code": "
547
+ const forecast = await getWeather("weatherprod", {
548
+ location: "San Francisco, CA",
549
+ type: "daily",
550
+ days: 3,
551
+ });
552
+ console.log("Weekend Weather Forecast");
553
+ console.log("========================");
554
+ forecast.forEach((day: any) => {
555
+ console.log(\`\${day.date}: High \${day.high}°F / Low \${day.low}°F | \${day.condition}\`);
556
+ });
557
+ ",
558
+ "description": "Get weekend weather forecast",
559
+ },
560
+ "state": "output-error",
561
+ "toolCallId": "tooluse_vGo3riHmTITFJfPvsE2y4k",
562
+ "type": "tool-runCode",
563
+ },
564
+ {
565
+ "type": "step-start",
566
+ },
567
+ {
568
+ "input": {
569
+ "path": "capabilities/weather/capability.d.ts",
570
+ },
571
+ "output": "type WeatherConnection =
572
+ /** Our primary weather data provider */
573
+ "weatherprod"
574
+ /** Development environment, ONLY use for testing */
575
+ | "weatherlocal";
576
+ type GetWeatherArgs = {
577
+ /** City and state/country */
578
+ location: string;
579
+ /** Type of forecast */
580
+ type: "current" | "hourly" | "daily";
581
+ /** Number of days for daily forecast */
582
+ days?: number;
583
+ };
584
+ type GetWeatherResult = {
585
+ days: { date: string; high: number; low: number; condition: string; wind_mph: number; humidity: number }[];
586
+ };
587
+ /** Fetches weather data for a given location */
588
+ declare function getWeather(capability: WeatherConnection, args: GetWeatherArgs): Promise<GetWeatherResult>;
589
+ ",
590
+ "state": "output-available",
591
+ "toolCallId": "tooluse_v9PWcsLQJZUTtTDVH28ORv",
592
+ "type": "tool-readFile",
593
+ },
594
+ ],
595
+ "role": "assistant",
596
+ },
597
+ ],
598
+ "status": "streaming",
599
+ }
600
+ `;
601
+
602
+ exports[`useThreadMessages with fixtures > 06-text-streaming-seq6 (log line 32044) 1`] = `
603
+ {
604
+ "isComplete": false,
605
+ "isFailed": false,
606
+ "isLoading": false,
607
+ "isRunning": true,
608
+ "isStopped": false,
609
+ "messages": [
610
+ {
611
+ "id": "LT8PGDxTlpf0lVZs",
612
+ "metadata": {
613
+ "_creationTime": 1770783020905.086,
614
+ "committedSeq": undefined,
615
+ "key": "fixture-thread-LT8PGDxTlpf0lVZs",
616
+ "status": "success",
617
+ },
618
+ "parts": [
619
+ {
620
+ "text": "get me a weather forecast for this weekend",
621
+ "type": "text",
622
+ },
623
+ ],
624
+ "role": "user",
625
+ },
626
+ {
627
+ "id": "vsOhda95lumMg4QZ",
628
+ "metadata": {
629
+ "_creationTime": 1770783024158.487,
630
+ "committedSeq": 5,
631
+ "key": "fixture-thread-vsOhda95lumMg4QZ",
632
+ "status": "success",
633
+ },
634
+ "parts": [
635
+ {
636
+ "type": "step-start",
637
+ },
638
+ {
639
+ "providerMetadata": {
640
+ "bedrock": {
641
+ "signature": "AxB2kT9pLmNcDfEgHiJkLmNoPqRsTuVwXyZ0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEF",
642
+ },
643
+ },
644
+ "state": "done",
645
+ "text": "The user wants a weather forecast for this weekend. I should use the Weather capability which provides "current conditions, hourly and multi-day forecasts for any location worldwide". That should have what I need for a weekend forecast.
646
+
647
+ Let me read the Weather CAPABILITY.md to see how to query it.",
648
+ "type": "reasoning",
649
+ },
650
+ {
651
+ "input": {
652
+ "path": "capabilities/weather/CAPABILITY.md",
653
+ },
654
+ "output": "---
655
+ name: Weather
656
+ description: Weather provides current conditions, hourly and multi-day forecasts for any location worldwide
657
+ ---
658
+
659
+ # Weather Service
660
+
661
+ Global weather data provider with current observations and forecasts.
662
+
663
+ ## Data Overview
664
+
665
+ - Current conditions: temperature, humidity, wind, visibility
666
+ - Hourly forecasts: up to 48 hours ahead
667
+ - Daily forecasts: up to 10 days ahead
668
+ - Historical data: past 30 days
669
+
670
+ ## Examples
671
+
672
+ Get a multi-day forecast:
673
+
674
+ \`\`\`typescript
675
+ const forecast = await getWeather("weatherprod", {
676
+ location: "San Francisco, CA",
677
+ type: "daily",
678
+ days: 7,
679
+ });
680
+ console.log(forecast);
681
+ \`\`\`
682
+
683
+ Get current conditions:
684
+
685
+ \`\`\`typescript
686
+ const current = await getWeather("weatherprod", {
687
+ location: "New York, NY",
688
+ type: "current",
689
+ });
690
+ console.log(current);
691
+ \`\`\`
692
+
693
+ ## Guidelines
694
+
695
+ - Always specify a location string with city and state/country.
696
+ - Use type "daily" for multi-day forecasts and "current" for present conditions.
697
+ ",
698
+ "state": "output-available",
699
+ "toolCallId": "tooluse_4X05H1krEnm7rFppLQw1pi",
700
+ "type": "tool-readFile",
701
+ },
702
+ {
703
+ "type": "step-start",
704
+ },
705
+ {
706
+ "state": "done",
707
+ "text": "Now let me fetch the weekend forecast for your area:",
708
+ "type": "text",
709
+ },
710
+ {
711
+ "errorText": "Code execution failed:
712
+ Weather API request failed: Bad Request
713
+ WeatherApiError: Weather API request failed: Bad Request
714
+ at getWeather (/workspace/services/executor/.cache/revision-envs/k970rr9s6zxgkh8rg4fdbbhw3d80yzhs/bundle.mjs:2141:15)
715
+ at async <anonymous> (script.ts:2:35)
716
+ at async executeTypeScript (/workspace/services/executor/src/exec.ts:507:14)
717
+ at processTicksAndRejections (native:7:39)
718
+ {"messages":[{"type":"FATAL","text":"Invalid date range specified."}]}
719
+ {"headers":{"cache-control":"no-store, no-cache, must-revalidate, max-age=0","content-length":"52","content-type":"application/json; charset=UTF-8","date":"Wed, 11 Feb 2026 04:10:27 GMT"},"status":400}",
720
+ "input": {
721
+ "code": "
722
+ const forecast = await getWeather("weatherprod", {
723
+ location: "San Francisco, CA",
724
+ type: "daily",
725
+ startDate: "2026-02-14",
726
+ endDate: "2026-02-15",
727
+ });
728
+ console.log("Weekend Forecast");
729
+ console.log("================");
730
+ console.log(JSON.stringify(forecast, null, 2));
731
+ ",
732
+ "description": "Get weekend weather forecast",
733
+ },
734
+ "state": "output-error",
735
+ "toolCallId": "tooluse_g3zTfupLSe8DI2Yla3gzG1",
736
+ "type": "tool-runCode",
737
+ },
738
+ {
739
+ "type": "step-start",
740
+ },
741
+ {
742
+ "state": "done",
743
+ "text": "Let me fix the query parameters:",
744
+ "type": "text",
745
+ },
746
+ {
747
+ "errorText": "TypeScript compilation failed:
748
+ Line 10:9: Property 'forEach' does not exist on type 'GetWeatherResult'. (TS2339)",
749
+ "input": {
750
+ "code": "
751
+ const forecast = await getWeather("weatherprod", {
752
+ location: "San Francisco, CA",
753
+ type: "daily",
754
+ days: 3,
755
+ });
756
+ console.log("Weekend Weather Forecast");
757
+ console.log("========================");
758
+ forecast.forEach((day: any) => {
759
+ console.log(\`\${day.date}: High \${day.high}°F / Low \${day.low}°F | \${day.condition}\`);
760
+ });
761
+ ",
762
+ "description": "Get weekend weather forecast",
763
+ },
764
+ "state": "output-error",
765
+ "toolCallId": "tooluse_vGo3riHmTITFJfPvsE2y4k",
766
+ "type": "tool-runCode",
767
+ },
768
+ {
769
+ "type": "step-start",
770
+ },
771
+ {
772
+ "input": {
773
+ "path": "capabilities/weather/capability.d.ts",
774
+ },
775
+ "output": "type WeatherConnection =
776
+ /** Our primary weather data provider */
777
+ "weatherprod"
778
+ /** Development environment, ONLY use for testing */
779
+ | "weatherlocal";
780
+ type GetWeatherArgs = {
781
+ /** City and state/country */
782
+ location: string;
783
+ /** Type of forecast */
784
+ type: "current" | "hourly" | "daily";
785
+ /** Number of days for daily forecast */
786
+ days?: number;
787
+ };
788
+ type GetWeatherResult = {
789
+ days: { date: string; high: number; low: number; condition: string; wind_mph: number; humidity: number }[];
790
+ };
791
+ /** Fetches weather data for a given location */
792
+ declare function getWeather(capability: WeatherConnection, args: GetWeatherArgs): Promise<GetWeatherResult>;
793
+ ",
794
+ "state": "output-available",
795
+ "toolCallId": "tooluse_v9PWcsLQJZUTtTDVH28ORv",
796
+ "type": "tool-readFile",
797
+ },
798
+ {
799
+ "type": "step-start",
800
+ },
801
+ {
802
+ "input": {
803
+ "code": "
804
+ const forecast = await getWeather("weatherprod", {
805
+ location: "San Francisco, CA",
806
+ type: "daily",
807
+ days: 3,
808
+ });
809
+ console.log("Weekend Weather Forecast");
810
+ console.log("========================");
811
+ forecast.days.forEach((day: any) => {
812
+ console.log(\`\${day.date}: High \${day.high}°F / Low \${day.low}°F | \${day.condition} | Wind \${day.wind_mph} mph\`);
813
+ });
814
+ ",
815
+ "description": "Get weekend weather forecast",
816
+ },
817
+ "output": {
818
+ "output": "Weekend Weather Forecast
819
+ ========================
820
+ 2026-02-13: High 62°F / Low 48°F | Partly Cloudy | Wind 12 mph
821
+ 2026-02-14: High 58°F / Low 45°F | Rain | Wind 18 mph
822
+ 2026-02-15: High 64°F / Low 50°F | Sunny | Wind 8 mph",
823
+ "truncated": false,
824
+ },
825
+ "state": "output-available",
826
+ "toolCallId": "tooluse_lr7lv14lzsTmfrxUp3XJ4x",
827
+ "type": "tool-runCode",
828
+ },
829
+ {
830
+ "type": "step-start",
831
+ },
832
+ {
833
+ "state": "streaming",
834
+ "text": "**Weekend Weather Forecast - San Francisco**
835
+
836
+ | Day | High | Low | Condition | Wind |
837
+ |---|---|---|---|---|
838
+ | Friday Feb 13 | 62°F | 48°F | Partly Cloudy | 12 mph |
839
+ | Saturday Feb 14 | 58°F | 45°F | Rai",
840
+ "type": "text",
841
+ },
842
+ {
843
+ "type": "step-start",
844
+ },
845
+ {
846
+ "providerMetadata": undefined,
847
+ "state": "streaming",
848
+ "text": "**Weekend Weather Forecast - San Francisco**
849
+
850
+ | Day | High | Low | Condition | Wind |
851
+ |---|---|---|---|---|
852
+ | Friday Feb 13 | 62°F | 48°F | Partly Cloudy | 12 mph |
853
+ | Saturday Feb 14 | 58°F | 45°F | Rain | 18 mph |
854
+ | Sunday Feb 15 | 64°F | 50°F | Sunny | 8 mph |
855
+
856
+ **Summary:** Saturday looks rainy with cooler temperatures, so bring an umbrella. Sunday",
857
+ "type": "text",
858
+ },
859
+ ],
860
+ "role": "assistant",
861
+ },
862
+ ],
863
+ "status": "streaming",
864
+ }
865
+ `;
866
+
867
+ exports[`useThreadMessages with fixtures > 07-text-streaming-more-seq6 (log line 32050) 1`] = `
868
+ {
869
+ "isComplete": false,
870
+ "isFailed": false,
871
+ "isLoading": false,
872
+ "isRunning": true,
873
+ "isStopped": false,
874
+ "messages": [
875
+ {
876
+ "id": "LT8PGDxTlpf0lVZs",
877
+ "metadata": {
878
+ "_creationTime": 1770783020905.086,
879
+ "committedSeq": undefined,
880
+ "key": "fixture-thread-LT8PGDxTlpf0lVZs",
881
+ "status": "success",
882
+ },
883
+ "parts": [
884
+ {
885
+ "text": "get me a weather forecast for this weekend",
886
+ "type": "text",
887
+ },
888
+ ],
889
+ "role": "user",
890
+ },
891
+ {
892
+ "id": "vsOhda95lumMg4QZ",
893
+ "metadata": {
894
+ "_creationTime": 1770783024158.487,
895
+ "committedSeq": 5,
896
+ "key": "fixture-thread-vsOhda95lumMg4QZ",
897
+ "status": "success",
898
+ },
899
+ "parts": [
900
+ {
901
+ "type": "step-start",
902
+ },
903
+ {
904
+ "providerMetadata": {
905
+ "bedrock": {
906
+ "signature": "AxB2kT9pLmNcDfEgHiJkLmNoPqRsTuVwXyZ0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEF",
907
+ },
908
+ },
909
+ "state": "done",
910
+ "text": "The user wants a weather forecast for this weekend. I should use the Weather capability which provides "current conditions, hourly and multi-day forecasts for any location worldwide". That should have what I need for a weekend forecast.
911
+
912
+ Let me read the Weather CAPABILITY.md to see how to query it.",
913
+ "type": "reasoning",
914
+ },
915
+ {
916
+ "input": {
917
+ "path": "capabilities/weather/CAPABILITY.md",
918
+ },
919
+ "output": "---
920
+ name: Weather
921
+ description: Weather provides current conditions, hourly and multi-day forecasts for any location worldwide
922
+ ---
923
+
924
+ # Weather Service
925
+
926
+ Global weather data provider with current observations and forecasts.
927
+
928
+ ## Data Overview
929
+
930
+ - Current conditions: temperature, humidity, wind, visibility
931
+ - Hourly forecasts: up to 48 hours ahead
932
+ - Daily forecasts: up to 10 days ahead
933
+ - Historical data: past 30 days
934
+
935
+ ## Examples
936
+
937
+ Get a multi-day forecast:
938
+
939
+ \`\`\`typescript
940
+ const forecast = await getWeather("weatherprod", {
941
+ location: "San Francisco, CA",
942
+ type: "daily",
943
+ days: 7,
944
+ });
945
+ console.log(forecast);
946
+ \`\`\`
947
+
948
+ Get current conditions:
949
+
950
+ \`\`\`typescript
951
+ const current = await getWeather("weatherprod", {
952
+ location: "New York, NY",
953
+ type: "current",
954
+ });
955
+ console.log(current);
956
+ \`\`\`
957
+
958
+ ## Guidelines
959
+
960
+ - Always specify a location string with city and state/country.
961
+ - Use type "daily" for multi-day forecasts and "current" for present conditions.
962
+ ",
963
+ "state": "output-available",
964
+ "toolCallId": "tooluse_4X05H1krEnm7rFppLQw1pi",
965
+ "type": "tool-readFile",
966
+ },
967
+ {
968
+ "type": "step-start",
969
+ },
970
+ {
971
+ "state": "done",
972
+ "text": "Now let me fetch the weekend forecast for your area:",
973
+ "type": "text",
974
+ },
975
+ {
976
+ "errorText": "Code execution failed:
977
+ Weather API request failed: Bad Request
978
+ WeatherApiError: Weather API request failed: Bad Request
979
+ at getWeather (/workspace/services/executor/.cache/revision-envs/k970rr9s6zxgkh8rg4fdbbhw3d80yzhs/bundle.mjs:2141:15)
980
+ at async <anonymous> (script.ts:2:35)
981
+ at async executeTypeScript (/workspace/services/executor/src/exec.ts:507:14)
982
+ at processTicksAndRejections (native:7:39)
983
+ {"messages":[{"type":"FATAL","text":"Invalid date range specified."}]}
984
+ {"headers":{"cache-control":"no-store, no-cache, must-revalidate, max-age=0","content-length":"52","content-type":"application/json; charset=UTF-8","date":"Wed, 11 Feb 2026 04:10:27 GMT"},"status":400}",
985
+ "input": {
986
+ "code": "
987
+ const forecast = await getWeather("weatherprod", {
988
+ location: "San Francisco, CA",
989
+ type: "daily",
990
+ startDate: "2026-02-14",
991
+ endDate: "2026-02-15",
992
+ });
993
+ console.log("Weekend Forecast");
994
+ console.log("================");
995
+ console.log(JSON.stringify(forecast, null, 2));
996
+ ",
997
+ "description": "Get weekend weather forecast",
998
+ },
999
+ "state": "output-error",
1000
+ "toolCallId": "tooluse_g3zTfupLSe8DI2Yla3gzG1",
1001
+ "type": "tool-runCode",
1002
+ },
1003
+ {
1004
+ "type": "step-start",
1005
+ },
1006
+ {
1007
+ "state": "done",
1008
+ "text": "Let me fix the query parameters:",
1009
+ "type": "text",
1010
+ },
1011
+ {
1012
+ "errorText": "TypeScript compilation failed:
1013
+ Line 10:9: Property 'forEach' does not exist on type 'GetWeatherResult'. (TS2339)",
1014
+ "input": {
1015
+ "code": "
1016
+ const forecast = await getWeather("weatherprod", {
1017
+ location: "San Francisco, CA",
1018
+ type: "daily",
1019
+ days: 3,
1020
+ });
1021
+ console.log("Weekend Weather Forecast");
1022
+ console.log("========================");
1023
+ forecast.forEach((day: any) => {
1024
+ console.log(\`\${day.date}: High \${day.high}°F / Low \${day.low}°F | \${day.condition}\`);
1025
+ });
1026
+ ",
1027
+ "description": "Get weekend weather forecast",
1028
+ },
1029
+ "state": "output-error",
1030
+ "toolCallId": "tooluse_vGo3riHmTITFJfPvsE2y4k",
1031
+ "type": "tool-runCode",
1032
+ },
1033
+ {
1034
+ "type": "step-start",
1035
+ },
1036
+ {
1037
+ "input": {
1038
+ "path": "capabilities/weather/capability.d.ts",
1039
+ },
1040
+ "output": "type WeatherConnection =
1041
+ /** Our primary weather data provider */
1042
+ "weatherprod"
1043
+ /** Development environment, ONLY use for testing */
1044
+ | "weatherlocal";
1045
+ type GetWeatherArgs = {
1046
+ /** City and state/country */
1047
+ location: string;
1048
+ /** Type of forecast */
1049
+ type: "current" | "hourly" | "daily";
1050
+ /** Number of days for daily forecast */
1051
+ days?: number;
1052
+ };
1053
+ type GetWeatherResult = {
1054
+ days: { date: string; high: number; low: number; condition: string; wind_mph: number; humidity: number }[];
1055
+ };
1056
+ /** Fetches weather data for a given location */
1057
+ declare function getWeather(capability: WeatherConnection, args: GetWeatherArgs): Promise<GetWeatherResult>;
1058
+ ",
1059
+ "state": "output-available",
1060
+ "toolCallId": "tooluse_v9PWcsLQJZUTtTDVH28ORv",
1061
+ "type": "tool-readFile",
1062
+ },
1063
+ {
1064
+ "type": "step-start",
1065
+ },
1066
+ {
1067
+ "input": {
1068
+ "code": "
1069
+ const forecast = await getWeather("weatherprod", {
1070
+ location: "San Francisco, CA",
1071
+ type: "daily",
1072
+ days: 3,
1073
+ });
1074
+ console.log("Weekend Weather Forecast");
1075
+ console.log("========================");
1076
+ forecast.days.forEach((day: any) => {
1077
+ console.log(\`\${day.date}: High \${day.high}°F / Low \${day.low}°F | \${day.condition} | Wind \${day.wind_mph} mph\`);
1078
+ });
1079
+ ",
1080
+ "description": "Get weekend weather forecast",
1081
+ },
1082
+ "output": {
1083
+ "output": "Weekend Weather Forecast
1084
+ ========================
1085
+ 2026-02-13: High 62°F / Low 48°F | Partly Cloudy | Wind 12 mph
1086
+ 2026-02-14: High 58°F / Low 45°F | Rain | Wind 18 mph
1087
+ 2026-02-15: High 64°F / Low 50°F | Sunny | Wind 8 mph",
1088
+ "truncated": false,
1089
+ },
1090
+ "state": "output-available",
1091
+ "toolCallId": "tooluse_lr7lv14lzsTmfrxUp3XJ4x",
1092
+ "type": "tool-runCode",
1093
+ },
1094
+ {
1095
+ "type": "step-start",
1096
+ },
1097
+ {
1098
+ "state": "streaming",
1099
+ "text": "**Weekend Weather Forecast - San Francisco**
1100
+
1101
+ | Day | High | Low | Condition | Wind |
1102
+ |---|---|---|---|---|
1103
+ | Friday Feb 13 | 62°F | 48°F | Partly Cloudy | 12 mph |
1104
+ | Saturday Feb 14 | 58°F | 45°F | Rai",
1105
+ "type": "text",
1106
+ },
1107
+ {
1108
+ "type": "step-start",
1109
+ },
1110
+ {
1111
+ "state": "streaming",
1112
+ "text": "**Weekend Weather Forecast - San Francisco**
1113
+
1114
+ | Day | High | Low | Condition | Wind |
1115
+ |---|---|---|---|---|
1116
+ | Friday Feb 13 | 62°F | 48°F | Partly Cloudy | 12 mph |
1117
+ | Saturday Feb 14 | 58°F | 45°F | Rain | 18 mph |
1118
+ | Sunday Feb 15 | 64°F | 50°F | Sunny | 8 mph |
1119
+
1120
+ **Summary:** Saturday looks rainy with cooler temperatures, so bring an umbrella. Sunday",
1121
+ "type": "text",
1122
+ },
1123
+ {
1124
+ "type": "step-start",
1125
+ },
1126
+ {
1127
+ "state": "streaming",
1128
+ "text": "**Weekend Weather Forecast - San Francisco**
1129
+
1130
+ | Day | High | Low | Condition | Wind |
1131
+ |---|---|---|---|---|
1132
+ | Friday Feb 13 | 62°F | 48°F | Partly Cloudy | 12 mph |
1133
+ | Saturday Feb 14 | 58°F | 45°F | Rain | 18 mph |
1134
+ | Sunday Feb 15 | 64°F | 50°F | Sunny | 8 mph |
1135
+
1136
+ **Summary:** Saturday looks rainy with cooler temperatures, so bring an umbrella. Sunday should clear up nicely with warm sunshine",
1137
+ "type": "text",
1138
+ },
1139
+ {
1140
+ "type": "step-start",
1141
+ },
1142
+ {
1143
+ "state": "streaming",
1144
+ "text": "**Weekend Weather Forecast - San Francisco**
1145
+
1146
+ | Day | High | Low | Condition | Wind |
1147
+ |---|---|---|---|---|
1148
+ | Friday Feb 13 | 62°F | 48°F | Partly Cloudy | 12 mph |
1149
+ | Saturday Feb 14 | 58°F | 45°F | Rain | 18 mph |
1150
+ | Sunday Feb 15 | 64°F | 50°F | Sunny | 8 mph |
1151
+
1152
+ **Summary:** Saturday looks rainy with cooler temperatures, so bring an umbrella. Sunday should clear up nicely with warm sunshine and light winds, perfect for outdoor plans",
1153
+ "type": "text",
1154
+ },
1155
+ {
1156
+ "type": "step-start",
1157
+ },
1158
+ {
1159
+ "providerMetadata": undefined,
1160
+ "state": "done",
1161
+ "text": "**Weekend Weather Forecast - San Francisco**
1162
+
1163
+ | Day | High | Low | Condition | Wind |
1164
+ |---|---|---|---|---|
1165
+ | Friday Feb 13 | 62°F | 48°F | Partly Cloudy | 12 mph |
1166
+ | Saturday Feb 14 | 58°F | 45°F | Rain | 18 mph |
1167
+ | Sunday Feb 15 | 64°F | 50°F | Sunny | 8 mph |
1168
+
1169
+ **Summary:** Saturday looks rainy with cooler temperatures, so bring an umbrella. Sunday should clear up nicely with warm sunshine and light winds, perfect for outdoor plans.",
1170
+ "type": "text",
1171
+ },
1172
+ ],
1173
+ "role": "assistant",
1174
+ },
1175
+ ],
1176
+ "status": "streaming",
1177
+ }
1178
+ `;
1179
+
1180
+ exports[`useThreadMessages with fixtures > 08-fully-committed-seq6 (log line 32052) 1`] = `
1181
+ {
1182
+ "isComplete": false,
1183
+ "isFailed": false,
1184
+ "isLoading": false,
1185
+ "isRunning": true,
1186
+ "isStopped": false,
1187
+ "messages": [
1188
+ {
1189
+ "id": "LT8PGDxTlpf0lVZs",
1190
+ "metadata": {
1191
+ "_creationTime": 1770783020905.086,
1192
+ "committedSeq": undefined,
1193
+ "key": "fixture-thread-LT8PGDxTlpf0lVZs",
1194
+ "status": "success",
1195
+ },
1196
+ "parts": [
1197
+ {
1198
+ "text": "get me a weather forecast for this weekend",
1199
+ "type": "text",
1200
+ },
1201
+ ],
1202
+ "role": "user",
1203
+ },
1204
+ {
1205
+ "id": "vsOhda95lumMg4QZ",
1206
+ "metadata": {
1207
+ "_creationTime": 1770783024158.487,
1208
+ "committedSeq": 6,
1209
+ "key": "fixture-thread-vsOhda95lumMg4QZ",
1210
+ "status": "success",
1211
+ },
1212
+ "parts": [
1213
+ {
1214
+ "type": "step-start",
1215
+ },
1216
+ {
1217
+ "providerMetadata": {
1218
+ "bedrock": {
1219
+ "signature": "AxB2kT9pLmNcDfEgHiJkLmNoPqRsTuVwXyZ0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEF",
1220
+ },
1221
+ },
1222
+ "state": "done",
1223
+ "text": "The user wants a weather forecast for this weekend. I should use the Weather capability which provides "current conditions, hourly and multi-day forecasts for any location worldwide". That should have what I need for a weekend forecast.
1224
+
1225
+ Let me read the Weather CAPABILITY.md to see how to query it.",
1226
+ "type": "reasoning",
1227
+ },
1228
+ {
1229
+ "input": {
1230
+ "path": "capabilities/weather/CAPABILITY.md",
1231
+ },
1232
+ "output": "---
1233
+ name: Weather
1234
+ description: Weather provides current conditions, hourly and multi-day forecasts for any location worldwide
1235
+ ---
1236
+
1237
+ # Weather Service
1238
+
1239
+ Global weather data provider with current observations and forecasts.
1240
+
1241
+ ## Data Overview
1242
+
1243
+ - Current conditions: temperature, humidity, wind, visibility
1244
+ - Hourly forecasts: up to 48 hours ahead
1245
+ - Daily forecasts: up to 10 days ahead
1246
+ - Historical data: past 30 days
1247
+
1248
+ ## Examples
1249
+
1250
+ Get a multi-day forecast:
1251
+
1252
+ \`\`\`typescript
1253
+ const forecast = await getWeather("weatherprod", {
1254
+ location: "San Francisco, CA",
1255
+ type: "daily",
1256
+ days: 7,
1257
+ });
1258
+ console.log(forecast);
1259
+ \`\`\`
1260
+
1261
+ Get current conditions:
1262
+
1263
+ \`\`\`typescript
1264
+ const current = await getWeather("weatherprod", {
1265
+ location: "New York, NY",
1266
+ type: "current",
1267
+ });
1268
+ console.log(current);
1269
+ \`\`\`
1270
+
1271
+ ## Guidelines
1272
+
1273
+ - Always specify a location string with city and state/country.
1274
+ - Use type "daily" for multi-day forecasts and "current" for present conditions.
1275
+ ",
1276
+ "state": "output-available",
1277
+ "toolCallId": "tooluse_4X05H1krEnm7rFppLQw1pi",
1278
+ "type": "tool-readFile",
1279
+ },
1280
+ {
1281
+ "type": "step-start",
1282
+ },
1283
+ {
1284
+ "state": "done",
1285
+ "text": "Now let me fetch the weekend forecast for your area:",
1286
+ "type": "text",
1287
+ },
1288
+ {
1289
+ "errorText": "Code execution failed:
1290
+ Weather API request failed: Bad Request
1291
+ WeatherApiError: Weather API request failed: Bad Request
1292
+ at getWeather (/workspace/services/executor/.cache/revision-envs/k970rr9s6zxgkh8rg4fdbbhw3d80yzhs/bundle.mjs:2141:15)
1293
+ at async <anonymous> (script.ts:2:35)
1294
+ at async executeTypeScript (/workspace/services/executor/src/exec.ts:507:14)
1295
+ at processTicksAndRejections (native:7:39)
1296
+ {"messages":[{"type":"FATAL","text":"Invalid date range specified."}]}
1297
+ {"headers":{"cache-control":"no-store, no-cache, must-revalidate, max-age=0","content-length":"52","content-type":"application/json; charset=UTF-8","date":"Wed, 11 Feb 2026 04:10:27 GMT"},"status":400}",
1298
+ "input": {
1299
+ "code": "
1300
+ const forecast = await getWeather("weatherprod", {
1301
+ location: "San Francisco, CA",
1302
+ type: "daily",
1303
+ startDate: "2026-02-14",
1304
+ endDate: "2026-02-15",
1305
+ });
1306
+ console.log("Weekend Forecast");
1307
+ console.log("================");
1308
+ console.log(JSON.stringify(forecast, null, 2));
1309
+ ",
1310
+ "description": "Get weekend weather forecast",
1311
+ },
1312
+ "state": "output-error",
1313
+ "toolCallId": "tooluse_g3zTfupLSe8DI2Yla3gzG1",
1314
+ "type": "tool-runCode",
1315
+ },
1316
+ {
1317
+ "type": "step-start",
1318
+ },
1319
+ {
1320
+ "state": "done",
1321
+ "text": "Let me fix the query parameters:",
1322
+ "type": "text",
1323
+ },
1324
+ {
1325
+ "errorText": "TypeScript compilation failed:
1326
+ Line 10:9: Property 'forEach' does not exist on type 'GetWeatherResult'. (TS2339)",
1327
+ "input": {
1328
+ "code": "
1329
+ const forecast = await getWeather("weatherprod", {
1330
+ location: "San Francisco, CA",
1331
+ type: "daily",
1332
+ days: 3,
1333
+ });
1334
+ console.log("Weekend Weather Forecast");
1335
+ console.log("========================");
1336
+ forecast.forEach((day: any) => {
1337
+ console.log(\`\${day.date}: High \${day.high}°F / Low \${day.low}°F | \${day.condition}\`);
1338
+ });
1339
+ ",
1340
+ "description": "Get weekend weather forecast",
1341
+ },
1342
+ "state": "output-error",
1343
+ "toolCallId": "tooluse_vGo3riHmTITFJfPvsE2y4k",
1344
+ "type": "tool-runCode",
1345
+ },
1346
+ {
1347
+ "type": "step-start",
1348
+ },
1349
+ {
1350
+ "input": {
1351
+ "path": "capabilities/weather/capability.d.ts",
1352
+ },
1353
+ "output": "type WeatherConnection =
1354
+ /** Our primary weather data provider */
1355
+ "weatherprod"
1356
+ /** Development environment, ONLY use for testing */
1357
+ | "weatherlocal";
1358
+ type GetWeatherArgs = {
1359
+ /** City and state/country */
1360
+ location: string;
1361
+ /** Type of forecast */
1362
+ type: "current" | "hourly" | "daily";
1363
+ /** Number of days for daily forecast */
1364
+ days?: number;
1365
+ };
1366
+ type GetWeatherResult = {
1367
+ days: { date: string; high: number; low: number; condition: string; wind_mph: number; humidity: number }[];
1368
+ };
1369
+ /** Fetches weather data for a given location */
1370
+ declare function getWeather(capability: WeatherConnection, args: GetWeatherArgs): Promise<GetWeatherResult>;
1371
+ ",
1372
+ "state": "output-available",
1373
+ "toolCallId": "tooluse_v9PWcsLQJZUTtTDVH28ORv",
1374
+ "type": "tool-readFile",
1375
+ },
1376
+ {
1377
+ "type": "step-start",
1378
+ },
1379
+ {
1380
+ "input": {
1381
+ "code": "
1382
+ const forecast = await getWeather("weatherprod", {
1383
+ location: "San Francisco, CA",
1384
+ type: "daily",
1385
+ days: 3,
1386
+ });
1387
+ console.log("Weekend Weather Forecast");
1388
+ console.log("========================");
1389
+ forecast.days.forEach((day: any) => {
1390
+ console.log(\`\${day.date}: High \${day.high}°F / Low \${day.low}°F | \${day.condition} | Wind \${day.wind_mph} mph\`);
1391
+ });
1392
+ ",
1393
+ "description": "Get weekend weather forecast",
1394
+ },
1395
+ "output": {
1396
+ "output": "Weekend Weather Forecast
1397
+ ========================
1398
+ 2026-02-13: High 62°F / Low 48°F | Partly Cloudy | Wind 12 mph
1399
+ 2026-02-14: High 58°F / Low 45°F | Rain | Wind 18 mph
1400
+ 2026-02-15: High 64°F / Low 50°F | Sunny | Wind 8 mph",
1401
+ "truncated": false,
1402
+ },
1403
+ "state": "output-available",
1404
+ "toolCallId": "tooluse_lr7lv14lzsTmfrxUp3XJ4x",
1405
+ "type": "tool-runCode",
1406
+ },
1407
+ {
1408
+ "type": "step-start",
1409
+ },
1410
+ {
1411
+ "state": "done",
1412
+ "text": "**Weekend Weather Forecast - San Francisco**
1413
+
1414
+ | Day | High | Low | Condition | Wind |
1415
+ |---|---|---|---|---|
1416
+ | Friday Feb 13 | 62°F | 48°F | Partly Cloudy | 12 mph |
1417
+ | Saturday Feb 14 | 58°F | 45°F | Rain | 18 mph |
1418
+ | Sunday Feb 15 | 64°F | 50°F | Sunny | 8 mph |
1419
+
1420
+ **Summary:** Saturday looks rainy with cooler temperatures, so bring an umbrella. Sunday should clear up nicely with warm sunshine and light winds, perfect for outdoor plans.",
1421
+ "type": "text",
1422
+ },
1423
+ ],
1424
+ "role": "assistant",
1425
+ },
1426
+ ],
1427
+ "status": "streaming",
1428
+ }
1429
+ `;