| 129 | } |
| 130 | |
| 131 | private async handlePartUpdated(event: EventMessagePartUpdated) { |
| 132 | const part = event.properties.part |
| 133 | const sessionId = part.sessionID || event.properties.sessionID |
| 134 | const session = await Effect.runPromise(this.input.session.tryGet(sessionId)) |
| 135 | if (!session) return |
| 136 | |
| 137 | await Effect.runPromise( |
| 138 | this.input.session.recordPartMetadata({ |
| 139 | sessionId: session.id, |
| 140 | messageId: part.messageID, |
| 141 | partId: part.id, |
| 142 | partType: part.type, |
| 143 | role: part.type === "reasoning" ? "assistant" : undefined, |
| 144 | ignored: part.type === "text" ? part.ignored : undefined, |
| 145 | toolCallId: part.type === "tool" ? part.callID : undefined, |
| 146 | metadata: "metadata" in part ? part.metadata : undefined, |
| 147 | }), |
| 148 | ) |
| 149 | if (part.type === "tool") { |
| 150 | await this.handleToolPart(session.id, part, session.cwd) |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | private async handlePartDelta(event: EventMessagePartDelta) { |
| 155 | const props = event.properties |