(state: State)
| 274 | } |
| 275 | |
| 276 | function open(state: State): string { |
| 277 | const id = take(state, "msg", "msg") |
| 278 | feed(state, { |
| 279 | type: "message.updated", |
| 280 | properties: { |
| 281 | sessionID: state.id, |
| 282 | info: { |
| 283 | id, |
| 284 | sessionID: state.id, |
| 285 | role: "assistant", |
| 286 | time: { |
| 287 | created: Date.now(), |
| 288 | }, |
| 289 | parentID: `user_${id}`, |
| 290 | modelID: "demo", |
| 291 | providerID: "demo", |
| 292 | mode: "demo", |
| 293 | agent: "demo", |
| 294 | path: { |
| 295 | cwd: process.cwd(), |
| 296 | root: process.cwd(), |
| 297 | }, |
| 298 | cost: 0.001, |
| 299 | tokens: { |
| 300 | input: 120, |
| 301 | output: 320, |
| 302 | reasoning: 80, |
| 303 | cache: { |
| 304 | read: 0, |
| 305 | write: 0, |
| 306 | }, |
| 307 | }, |
| 308 | }, |
| 309 | }, |
| 310 | } as Event) |
| 311 | return id |
| 312 | } |
| 313 | |
| 314 | async function emitText(state: State, body: string, signal?: AbortSignal): Promise<void> { |
| 315 | const msg = open(state) |
no test coverage detected