convex-durable-agents 0.2.5 → 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 (37) hide show
  1. package/README.md +1 -0
  2. package/dist/client/handler.d.ts +2 -0
  3. package/dist/client/handler.d.ts.map +1 -1
  4. package/dist/client/handler.js +1 -0
  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/react/test/happy-dom-setup.d.ts +2 -0
  11. package/dist/react/test/happy-dom-setup.d.ts.map +1 -0
  12. package/dist/react/test/happy-dom-setup.js +28 -0
  13. package/dist/react/test/happy-dom-setup.js.map +1 -0
  14. package/package.json +24 -21
  15. package/src/client/handler.ts +3 -0
  16. package/src/client/streamer.test.ts +187 -0
  17. package/src/client/streamer.ts +10 -3
  18. package/src/client/tools.test.ts +48 -0
  19. package/src/component/messages.test.ts +40 -0
  20. package/src/component/streams.test.ts +118 -0
  21. package/src/component/threads.test.ts +48 -0
  22. package/src/react/__fixtures__/01-early-streaming-start.json +35 -0
  23. package/src/react/__fixtures__/02-reasoning-complete-tool-call.json +85 -0
  24. package/src/react/__fixtures__/03-new-round-seq2.json +89 -0
  25. package/src/react/__fixtures__/04-tool-call-error-seq3.json +145 -0
  26. package/src/react/__fixtures__/05-later-round-seq5.json +117 -0
  27. package/src/react/__fixtures__/06-text-streaming-seq6.json +162 -0
  28. package/src/react/__fixtures__/07-text-streaming-more-seq6.json +212 -0
  29. package/src/react/__fixtures__/08-fully-committed-seq6.json +188 -0
  30. package/src/react/__snapshots__/apply-streaming-updates.test.ts.snap +1357 -0
  31. package/src/react/__snapshots__/use-thread-messages.test.tsx.snap +1429 -0
  32. package/src/react/agent-chat.test.tsx +155 -0
  33. package/src/react/apply-streaming-updates.test.ts +28 -0
  34. package/src/react/test/happy-dom-setup.ts +31 -0
  35. package/src/react/use-thread-messages.test.tsx +702 -0
  36. package/src/utils/msg.test.ts +34 -0
  37. package/src/utils/retry.test.ts +214 -0
@@ -0,0 +1,188 @@
1
+ {
2
+ "description": "08-fully-committed-seq6",
3
+ "logLine": 32052,
4
+ "messages": [
5
+ {
6
+ "id": "LT8PGDxTlpf0lVZs",
7
+ "role": "user",
8
+ "parts": [
9
+ {
10
+ "text": "get me a weather forecast for this weekend",
11
+ "type": "text"
12
+ }
13
+ ],
14
+ "metadata": {
15
+ "key": "jn7a2st357bqyzrcetv78j0fmx80yd8n-LT8PGDxTlpf0lVZs",
16
+ "status": "success",
17
+ "_creationTime": 1770783020905.086
18
+ }
19
+ },
20
+ {
21
+ "id": "vsOhda95lumMg4QZ",
22
+ "role": "assistant",
23
+ "parts": [
24
+ {
25
+ "type": "step-start"
26
+ },
27
+ {
28
+ "providerMetadata": {
29
+ "bedrock": {
30
+ "signature": "AxB2kT9pLmNcDfEgHiJkLmNoPqRsTuVwXyZ0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEFghijklmnopqrstuvwxyz0123456789abcdefABCDEF"
31
+ }
32
+ },
33
+ "state": "done",
34
+ "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.\n\nLet me read the Weather CAPABILITY.md to see how to query it.",
35
+ "type": "reasoning"
36
+ },
37
+ {
38
+ "input": {
39
+ "path": "capabilities/weather/CAPABILITY.md"
40
+ },
41
+ "output": "---\nname: Weather\ndescription: Weather provides current conditions, hourly and multi-day forecasts for any location worldwide\n---\n\n# Weather Service\n\nGlobal weather data provider with current observations and forecasts.\n\n## Data Overview\n\n- Current conditions: temperature, humidity, wind, visibility\n- Hourly forecasts: up to 48 hours ahead\n- Daily forecasts: up to 10 days ahead\n- Historical data: past 30 days\n\n## Examples\n\nGet a multi-day forecast:\n\n```typescript\nconst forecast = await getWeather(\"weatherprod\", {\n location: \"San Francisco, CA\",\n type: \"daily\",\n days: 7,\n});\nconsole.log(forecast);\n```\n\nGet current conditions:\n\n```typescript\nconst current = await getWeather(\"weatherprod\", {\n location: \"New York, NY\",\n type: \"current\",\n});\nconsole.log(current);\n```\n\n## Guidelines\n\n- Always specify a location string with city and state/country.\n- Use type \"daily\" for multi-day forecasts and \"current\" for present conditions.\n",
42
+ "state": "output-available",
43
+ "toolCallId": "tooluse_4X05H1krEnm7rFppLQw1pi",
44
+ "type": "tool-readFile"
45
+ },
46
+ {
47
+ "type": "step-start"
48
+ },
49
+ {
50
+ "state": "done",
51
+ "text": "Now let me fetch the weekend forecast for your area:",
52
+ "type": "text"
53
+ },
54
+ {
55
+ "errorText": "Code execution failed:\nWeather API request failed: Bad Request\nWeatherApiError: Weather API request failed: Bad Request\n at getWeather (/workspace/services/executor/.cache/revision-envs/k970rr9s6zxgkh8rg4fdbbhw3d80yzhs/bundle.mjs:2141:15)\n at async <anonymous> (script.ts:2:35)\n at async executeTypeScript (/workspace/services/executor/src/exec.ts:507:14)\n at processTicksAndRejections (native:7:39)\n{\"messages\":[{\"type\":\"FATAL\",\"text\":\"Invalid date range specified.\"}]}\n{\"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}",
56
+ "input": {
57
+ "code": "\nconst forecast = await getWeather(\"weatherprod\", {\n location: \"San Francisco, CA\",\n type: \"daily\",\n startDate: \"2026-02-14\",\n endDate: \"2026-02-15\",\n});\nconsole.log(\"Weekend Forecast\");\nconsole.log(\"================\");\nconsole.log(JSON.stringify(forecast, null, 2));\n",
58
+ "description": "Get weekend weather forecast"
59
+ },
60
+ "state": "output-error",
61
+ "toolCallId": "tooluse_g3zTfupLSe8DI2Yla3gzG1",
62
+ "type": "tool-runCode"
63
+ },
64
+ {
65
+ "type": "step-start"
66
+ },
67
+ {
68
+ "state": "done",
69
+ "text": "Let me fix the query parameters:",
70
+ "type": "text"
71
+ },
72
+ {
73
+ "errorText": "TypeScript compilation failed:\nLine 10:9: Property 'forEach' does not exist on type 'GetWeatherResult'. (TS2339)",
74
+ "input": {
75
+ "code": "\nconst forecast = await getWeather(\"weatherprod\", {\n location: \"San Francisco, CA\",\n type: \"daily\",\n days: 3,\n});\nconsole.log(\"Weekend Weather Forecast\");\nconsole.log(\"========================\");\nforecast.forEach((day: any) => {\n console.log(`${day.date}: High ${day.high}°F / Low ${day.low}°F | ${day.condition}`);\n});\n",
76
+ "description": "Get weekend weather forecast"
77
+ },
78
+ "state": "output-error",
79
+ "toolCallId": "tooluse_vGo3riHmTITFJfPvsE2y4k",
80
+ "type": "tool-runCode"
81
+ },
82
+ {
83
+ "type": "step-start"
84
+ },
85
+ {
86
+ "input": {
87
+ "path": "capabilities/weather/capability.d.ts"
88
+ },
89
+ "output": "type WeatherConnection =\n/** Our primary weather data provider */\n\"weatherprod\"\n/** Development environment, ONLY use for testing */\n | \"weatherlocal\";\ntype GetWeatherArgs = {\n /** City and state/country */\n location: string;\n /** Type of forecast */\n type: \"current\" | \"hourly\" | \"daily\";\n /** Number of days for daily forecast */\n days?: number;\n};\ntype GetWeatherResult = {\n days: { date: string; high: number; low: number; condition: string; wind_mph: number; humidity: number }[];\n};\n/** Fetches weather data for a given location */\ndeclare function getWeather(capability: WeatherConnection, args: GetWeatherArgs): Promise<GetWeatherResult>;\n",
90
+ "state": "output-available",
91
+ "toolCallId": "tooluse_v9PWcsLQJZUTtTDVH28ORv",
92
+ "type": "tool-readFile"
93
+ },
94
+ {
95
+ "type": "step-start"
96
+ },
97
+ {
98
+ "input": {
99
+ "code": "\nconst forecast = await getWeather(\"weatherprod\", {\n location: \"San Francisco, CA\",\n type: \"daily\",\n days: 3,\n});\nconsole.log(\"Weekend Weather Forecast\");\nconsole.log(\"========================\");\nforecast.days.forEach((day: any) => {\n console.log(`${day.date}: High ${day.high}°F / Low ${day.low}°F | ${day.condition} | Wind ${day.wind_mph} mph`);\n});\n",
100
+ "description": "Get weekend weather forecast"
101
+ },
102
+ "output": {
103
+ "output": "Weekend Weather Forecast\n========================\n2026-02-13: High 62°F / Low 48°F | Partly Cloudy | Wind 12 mph\n2026-02-14: High 58°F / Low 45°F | Rain | Wind 18 mph\n2026-02-15: High 64°F / Low 50°F | Sunny | Wind 8 mph",
104
+ "truncated": false
105
+ },
106
+ "state": "output-available",
107
+ "toolCallId": "tooluse_lr7lv14lzsTmfrxUp3XJ4x",
108
+ "type": "tool-runCode"
109
+ },
110
+ {
111
+ "type": "step-start"
112
+ },
113
+ {
114
+ "state": "done",
115
+ "text": "**Weekend Weather Forecast - San Francisco**\n\n| Day | High | Low | Condition | Wind |\n|---|---|---|---|---|\n| Friday Feb 13 | 62°F | 48°F | Partly Cloudy | 12 mph |\n| Saturday Feb 14 | 58°F | 45°F | Rain | 18 mph |\n| Sunday Feb 15 | 64°F | 50°F | Sunny | 8 mph |\n\n**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.",
116
+ "type": "text"
117
+ }
118
+ ],
119
+ "metadata": {
120
+ "key": "jn7a2st357bqyzrcetv78j0fmx80yd8n-vsOhda95lumMg4QZ",
121
+ "status": "success",
122
+ "_creationTime": 1770783024158.487,
123
+ "committedSeq": 6
124
+ }
125
+ }
126
+ ],
127
+ "streamingUpdates": {
128
+ "messages": [
129
+ {
130
+ "msgId": "vsOhda95lumMg4QZ",
131
+ "parts": [
132
+ {
133
+ "messageId": "vsOhda95lumMg4QZ",
134
+ "seq": 6,
135
+ "type": "start"
136
+ },
137
+ {
138
+ "seq": 6,
139
+ "type": "start-step"
140
+ },
141
+ {
142
+ "id": "0",
143
+ "seq": 6,
144
+ "type": "text-start"
145
+ },
146
+ {
147
+ "delta": "**Weekend Weather Forecast - San Francisco**\n\n| Day | High | Low | Condition | Wind |\n|---|---|---|---|---|\n| Friday Feb 13 | 62°F | 48°F | Partly Cloudy | 12 mph |\n| Saturday Feb 14 | 58°F | 45°F | Rai",
148
+ "id": "0",
149
+ "seq": 6,
150
+ "type": "text-delta"
151
+ },
152
+ {
153
+ "delta": "n | 18 mph |\n| Sunday Feb 15 | 64°F | 50°F | Sunny | 8 mph |\n\n**Summary:** Saturday looks rainy with cooler temperatures, so bring an umbrella. Sunday",
154
+ "id": "0",
155
+ "seq": 6,
156
+ "type": "text-delta"
157
+ },
158
+ {
159
+ "delta": " should clear up nicely with warm sunshine and light winds, perfect for outdoor plans",
160
+ "id": "0",
161
+ "seq": 6,
162
+ "type": "text-delta"
163
+ },
164
+ {
165
+ "delta": ".",
166
+ "id": "0",
167
+ "seq": 6,
168
+ "type": "text-delta"
169
+ },
170
+ {
171
+ "id": "0",
172
+ "seq": 6,
173
+ "type": "text-end"
174
+ },
175
+ {
176
+ "seq": 6,
177
+ "type": "finish-step"
178
+ },
179
+ {
180
+ "finishReason": "stop",
181
+ "seq": 6,
182
+ "type": "finish"
183
+ }
184
+ ]
185
+ }
186
+ ]
187
+ }
188
+ }