| 120 | } |
| 121 | |
| 122 | function eventPatch(next: FooterEvent): FooterPatch | undefined { |
| 123 | if (next.type === "queue") { |
| 124 | return { queue: next.queue } |
| 125 | } |
| 126 | |
| 127 | if (next.type === "first") { |
| 128 | return { first: next.first } |
| 129 | } |
| 130 | |
| 131 | if (next.type === "model") { |
| 132 | return { model: next.model } |
| 133 | } |
| 134 | |
| 135 | if (next.type === "turn.send") { |
| 136 | return { |
| 137 | phase: "running", |
| 138 | status: "sending prompt", |
| 139 | queue: next.queue, |
| 140 | interrupt: 0, |
| 141 | exit: 0, |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | if (next.type === "turn.wait") { |
| 146 | return { |
| 147 | phase: "running", |
| 148 | status: "waiting for assistant", |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | if (next.type === "turn.idle") { |
| 153 | return { |
| 154 | phase: "idle", |
| 155 | status: "", |
| 156 | queue: next.queue, |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | if (next.type === "stream.patch") { |
| 161 | return next.patch |
| 162 | } |
| 163 | |
| 164 | return undefined |
| 165 | } |
| 166 | |
| 167 | export class RunFooter implements FooterApi { |
| 168 | private closed = false |