(description: string, _task: Schedule<string>)
| 183 | abortSignal: options?.abortSignal |
| 184 | }); |
| 185 | |
| 186 | return result.toUIMessageStreamResponse(); |
| 187 | } |
| 188 | |
| 189 | async executeTask(description: string, _task: Schedule<string>) { |
| 190 | // Do the actual work here (send email, call API, etc.) |
| 191 | console.log(`Executing scheduled task: ${description}`); |
| 192 | |
| 193 | // Notify connected clients via a broadcast event. |
| 194 | // We use broadcast() instead of saveMessages() to avoid injecting |
| 195 | // into chat history — that would cause the AI to see the notification |
| 196 | // as new context and potentially loop. |
| 197 | this.broadcast( |
| 198 | JSON.stringify({ |
| 199 | type: "scheduled-task", |
| 200 | description, |
| 201 | timestamp: new Date().toISOString() |
| 202 | }) |
| 203 | ); |
nothing calls this directly
no outgoing calls
no test coverage detected