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