* Convert an SDKToolProgressMessage to a SystemMessage. * We use a system message instead of ProgressMessage since the Progress type * is a complex union that requires tool-specific data we don't have from CCR.
( msg: SDKToolProgressMessage, )
| 109 | * is a complex union that requires tool-specific data we don't have from CCR. |
| 110 | */ |
| 111 | function convertToolProgressMessage( |
| 112 | msg: SDKToolProgressMessage, |
| 113 | ): SystemMessage { |
| 114 | return { |
| 115 | type: 'system', |
| 116 | subtype: 'informational', |
| 117 | content: `Tool ${msg.tool_name} running for ${msg.elapsed_time_seconds}s…`, |
| 118 | level: 'info', |
| 119 | uuid: msg.uuid, |
| 120 | timestamp: new Date().toISOString(), |
| 121 | toolUseID: msg.tool_use_id, |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | /** |
| 126 | * Convert an SDKCompactBoundaryMessage to a SystemMessage |