| 27 | } |
| 28 | |
| 29 | function assistant(id: string, parentID: string, text: string): MessageV2.WithParts { |
| 30 | return { |
| 31 | info: { |
| 32 | id, |
| 33 | sessionID, |
| 34 | role: "assistant", |
| 35 | parentID, |
| 36 | modelID: "claude-sonnet-4-20250514", |
| 37 | providerID: "anthropic", |
| 38 | mode: "build", |
| 39 | path: { cwd: "/", root: "/" }, |
| 40 | cost: 0, |
| 41 | tokens: { input: 0, output: 0, reasoning: 0, cache: { read: 0, write: 0 } }, |
| 42 | time: { created: 0 }, |
| 43 | }, |
| 44 | parts: [ |
| 45 | { |
| 46 | id: "p_" + id, |
| 47 | sessionID, |
| 48 | messageID: id, |
| 49 | type: "text", |
| 50 | text, |
| 51 | }, |
| 52 | ], |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | function userText(msg: ModelMessage): string { |
| 57 | if (msg.role !== "user" || !Array.isArray(msg.content)) return "" |