| 1 | /** |
| 2 | * Thread title generation on OpenCode 2's free tier, recorded live against |
| 3 | * 2.0.18 with `opencode/big-pickle` on 2026-09-30: an ask-all temporary |
| 4 | * session, one prompt, the reply read from the event stream, the session |
| 5 | * removed. (A deny-all session is refused on the free tier: the spike's |
| 6 | * `text_generation` recording.) |
| 7 | */ |
| 8 | import type { ProviderReplayEntry } from "@t3tools/contracts"; |
| 9 | |
| 10 | export const OPENCODE2_TITLE_GENERATION: ReadonlyArray<ProviderReplayEntry> = [ |
| 11 | { type: "expect_outbound", label: "event.subscribe", frame: { type: "event.subscribe" } }, |
| 12 | { |
| 13 | type: "emit_inbound", |
| 14 | label: "server.connected", |
| 15 | frame: { |
| 16 | type: "sdk.event", |
| 17 | event: { id: "evt_0f137a1d2001lU10ZRa5EiLHAw", type: "server.connected", data: {} }, |
| 18 | }, |
| 19 | }, |
| 20 | { |
| 21 | type: "expect_outbound", |
| 22 | label: "session.create", |
| 23 | frame: { |
| 24 | type: "session.create", |
| 25 | input: { |
| 26 | title: "T3 Code generateThreadTitle", |
| 27 | location: { directory: "<any>" }, |
| 28 | model: { providerID: "opencode", id: "big-pickle" }, |
| 29 | permissions: [{ action: "*", resource: "*", effect: "ask" }], |
| 30 | }, |
| 31 | }, |
| 32 | }, |
| 33 | { |
| 34 | type: "emit_inbound", |
| 35 | label: "session.create.response", |
| 36 | frame: { |
| 37 | type: "sdk.response", |
| 38 | operation: "session.create", |
| 39 | data: { |
| 40 | data: { |
| 41 | id: "ses_f0ec85cf6ffebfalpvV2E9nocu", |
| 42 | projectID: "global", |
| 43 | model: { id: "big-pickle", providerID: "opencode", variant: "default" }, |
| 44 | cost: 0, |
| 45 | tokens: { input: 0, output: 0, reasoning: 0, cache: { read: 0, write: 0 } }, |
| 46 | time: { created: 1790753350431, updated: 1790753350431 }, |
| 47 | title: "T3 Code generateThreadTitle", |
| 48 | permissions: [{ action: "*", resource: "*", effect: "ask" }], |
| 49 | location: { directory: "<work>" }, |
| 50 | }, |
| 51 | }, |
| 52 | }, |
| 53 | }, |
| 54 | { |
| 55 | type: "emit_inbound", |
| 56 | label: "session.created", |
| 57 | frame: { |
| 58 | type: "sdk.event", |
| 59 | event: { |
| 60 | id: "evt_0f137a31f001y6hIo9JFrLXhBa", |
| 61 | created: 1790753350431, |
| 62 | type: "session.created", |
| 63 | location: { directory: "<work>" }, |
| 64 | data: { |
| 65 | sessionID: "ses_f0ec85cf6ffebfalpvV2E9nocu", |
| 66 | slug: "quiet-lagoon", |
| 67 | version: "2.0.18", |
| 68 | projectID: "global", |
| 69 | location: { directory: "<work>" }, |
| 70 | subpath: "", |
| 71 | title: "T3 Code generateThreadTitle", |
| 72 | permissions: [{ action: "*", resource: "*", effect: "ask" }], |
| 73 | model: { id: "big-pickle", providerID: "opencode" }, |
| 74 | }, |
| 75 | durable: { aggregateID: "ses_f0ec85cf6ffebfalpvV2E9nocu", seq: 0, version: 1 }, |
| 76 | }, |
| 77 | }, |
| 78 | }, |
| 79 | { |
| 80 | type: "emit_inbound", |
| 81 | label: "project.updated", |
| 82 | frame: { |
| 83 | type: "sdk.event", |
| 84 | event: { |
| 85 | id: "evt_0f137a32a001SNTdr1fGy7x8KA", |
| 86 | created: 1790753350442, |
| 87 | type: "project.updated", |
| 88 | data: { |
| 89 | id: "global", |
| 90 | canonical: "<work>", |
| 91 | vcs: "git", |
| 92 | time: { created: 1790744321645, updated: 1790744321645, active: 1790753350441 }, |
| 93 | sandboxes: [], |
| 94 | }, |
| 95 | }, |
| 96 | }, |
| 97 | }, |
| 98 | { |
| 99 | type: "expect_outbound", |
| 100 | label: "session.prompt", |
| 101 | frame: { |
| 102 | type: "session.prompt", |
| 103 | input: { sessionID: "ses_f0ec85cf6ffebfalpvV2E9nocu", text: "<any>" }, |
| 104 | }, |
| 105 | }, |
| 106 | { |
| 107 | type: "emit_inbound", |
| 108 | label: "session.prompt.response", |
| 109 | frame: { |
| 110 | type: "sdk.response", |
| 111 | operation: "session.prompt", |
| 112 | data: { |
| 113 | data: { |
| 114 | id: "msg_0f137a333001NQCSi7im6QbeRu", |
| 115 | sessionID: "ses_f0ec85cf6ffebfalpvV2E9nocu", |
| 116 | time: { created: 1790753350454 }, |
| 117 | type: "user", |
| 118 | payload: { |
| 119 | text: 'You write concise thread titles for coding conversations. Return only a JSON object with key "title". Title: at most 5 words, no quotes. User message: "fix the login redirect loop after oauth"', |
| 120 | }, |
| 121 | delivery: "steer", |
| 122 | }, |
| 123 | }, |
| 124 | }, |
| 125 | }, |
| 126 | { |
| 127 | type: "emit_inbound", |
| 128 | label: "session.inbox.enqueued", |
| 129 | frame: { |
| 130 | type: "sdk.event", |
| 131 | event: { |
| 132 | id: "evt_0f137a336001aSMpzX88Wc2ggd", |
| 133 | created: 1790753350454, |
| 134 | type: "session.inbox.enqueued", |
| 135 | location: { directory: "<work>" }, |
| 136 | data: { |
| 137 | inboxID: "msg_0f137a333001NQCSi7im6QbeRu", |
| 138 | sessionID: "ses_f0ec85cf6ffebfalpvV2E9nocu", |
| 139 | item: { |
| 140 | type: "user", |
| 141 | payload: { |
| 142 | text: 'You write concise thread titles for coding conversations. Return only a JSON object with key "title". Title: at most 5 words, no quotes. User message: "fix the login redirect loop after oauth"', |
| 143 | }, |
| 144 | delivery: "steer", |
| 145 | }, |
| 146 | }, |
| 147 | durable: { aggregateID: "ses_f0ec85cf6ffebfalpvV2E9nocu", seq: 1, version: 1 }, |
| 148 | }, |
| 149 | }, |
| 150 | }, |
| 151 | { |
| 152 | type: "emit_inbound", |
| 153 | label: "session.execution.started", |
| 154 | frame: { |
| 155 | type: "sdk.event", |
| 156 | event: { |
| 157 | id: "evt_0f137a33b001LaQlIPhw6OXE4K", |
| 158 | created: 1790753350459, |
| 159 | type: "session.execution.started", |
| 160 | data: { sessionID: "ses_f0ec85cf6ffebfalpvV2E9nocu" }, |
| 161 | durable: { aggregateID: "ses_f0ec85cf6ffebfalpvV2E9nocu", seq: 2, version: 1 }, |
| 162 | }, |
| 163 | }, |
| 164 | }, |
| 165 | { |
| 166 | type: "emit_inbound", |
| 167 | label: "session.instructions.updated", |
| 168 | frame: { |
| 169 | type: "sdk.event", |
| 170 | event: { |
| 171 | id: "evt_0f137a355001zRM26oGzBOQK1I", |
| 172 | created: 1790753350485, |
| 173 | metadata: { instructions: { initial: true } }, |
| 174 | type: "session.instructions.updated", |
| 175 | location: { directory: "<work>" }, |
| 176 | data: { |
| 177 | sessionID: "ses_f0ec85cf6ffebfalpvV2E9nocu", |
| 178 | delta: { |
| 179 | "core/environment": "00e638e6e54c2bb7786ab0bade9b0f8fcb6401b64ef49fc25025dc97dc2d61ac", |
| 180 | "core/date": "5a13dc24ad554b3e0bf9583fa4a5c52e130b32720d0a9562fd0e9b0ab14210a9", |
| 181 | "core/codemode": "616a7ad8b8e40e8a71eab238dfbbe9eaf0f4a9e6fdad853226d075bfe602e1e6", |
| 182 | "core/skill-guidance": |
| 183 | "b2aff856e4c0afa54b6d56ecdc438d66a6333b36a3b62677bb1a96da62079118", |
| 184 | }, |
| 185 | }, |
| 186 | durable: { aggregateID: "ses_f0ec85cf6ffebfalpvV2E9nocu", seq: 3, version: 2 }, |
| 187 | }, |
| 188 | }, |
| 189 | }, |
| 190 | { |
| 191 | type: "emit_inbound", |
| 192 | label: "session.inbox.delivered", |
| 193 | frame: { |
| 194 | type: "sdk.event", |
| 195 | event: { |
| 196 | id: "evt_0f137a358001Nb4SR6NyY00Zo5", |
| 197 | created: 1790753350489, |
| 198 | type: "session.inbox.delivered", |
| 199 | location: { directory: "<work>" }, |
| 200 | data: { |
| 201 | sessionID: "ses_f0ec85cf6ffebfalpvV2E9nocu", |
| 202 | inboxID: "msg_0f137a333001NQCSi7im6QbeRu", |
| 203 | }, |
| 204 | durable: { aggregateID: "ses_f0ec85cf6ffebfalpvV2E9nocu", seq: 4, version: 1 }, |
| 205 | }, |
| 206 | }, |
| 207 | }, |
| 208 | { |
| 209 | type: "emit_inbound", |
| 210 | label: "session.step.started", |
| 211 | frame: { |
| 212 | type: "sdk.event", |
| 213 | event: { |
| 214 | id: "evt_0f137a9a1001mdhCnni47bUQ1S", |
| 215 | created: 1790753352097, |
| 216 | type: "session.step.started", |
| 217 | location: { directory: "<work>" }, |
| 218 | data: { |
| 219 | sessionID: "ses_f0ec85cf6ffebfalpvV2E9nocu", |
| 220 | agent: "build", |
| 221 | model: { id: "big-pickle", providerID: "opencode", variant: "default" }, |
| 222 | assistantMessageID: "msg_0f137a376001CNO3tIF0OHqFsx", |
| 223 | snapshot: "5ecf8511987b833d27b391b832f802775c5ca199", |
| 224 | started: 1790753350567, |
| 225 | }, |
| 226 | durable: { aggregateID: "ses_f0ec85cf6ffebfalpvV2E9nocu", seq: 5, version: 1 }, |
| 227 | }, |
| 228 | }, |
| 229 | }, |
| 230 | { |
| 231 | type: "emit_inbound", |
| 232 | label: "session.text.started", |
| 233 | frame: { |
| 234 | type: "sdk.event", |
| 235 | event: { |
| 236 | id: "evt_0f137a9a5001wyccz82SmtjxpF", |
| 237 | created: 1790753352101, |
| 238 | type: "session.text.started", |
| 239 | location: { directory: "<work>" }, |
| 240 | data: { |
| 241 | sessionID: "ses_f0ec85cf6ffebfalpvV2E9nocu", |
| 242 | assistantMessageID: "msg_0f137a376001CNO3tIF0OHqFsx", |
| 243 | ordinal: 0, |
| 244 | }, |
| 245 | durable: { aggregateID: "ses_f0ec85cf6ffebfalpvV2E9nocu", seq: 6, version: 1 }, |
| 246 | }, |
| 247 | }, |
| 248 | }, |
| 249 | { |
| 250 | type: "emit_inbound", |
| 251 | label: "session.text.delta", |
| 252 | frame: { |
| 253 | type: "sdk.event", |
| 254 | event: { |
| 255 | id: "evt_0f137a9b5001pgNezPn61VhcVj", |
| 256 | created: 1790753352117, |
| 257 | type: "session.text.delta", |
| 258 | location: { directory: "<work>" }, |
| 259 | data: { |
| 260 | sessionID: "ses_f0ec85cf6ffebfalpvV2E9nocu", |
| 261 | assistantMessageID: "msg_0f137a376001CNO3tIF0OHqFsx", |
| 262 | ordinal: 0, |
| 263 | delta: '{"title": "Fix OAuth Login Redirect Loop"}', |
| 264 | }, |
| 265 | }, |
| 266 | }, |
| 267 | }, |
| 268 | { |
| 269 | type: "emit_inbound", |
| 270 | label: "session.text.ended", |
| 271 | frame: { |
| 272 | type: "sdk.event", |
| 273 | event: { |
| 274 | id: "evt_0f137a9b6001W0DZEOeIf3qavZ", |
| 275 | created: 1790753352118, |
| 276 | type: "session.text.ended", |
| 277 | location: { directory: "<work>" }, |
| 278 | data: { |
| 279 | sessionID: "ses_f0ec85cf6ffebfalpvV2E9nocu", |
| 280 | assistantMessageID: "msg_0f137a376001CNO3tIF0OHqFsx", |
| 281 | ordinal: 0, |
| 282 | text: '{"title": "Fix OAuth Login Redirect Loop"}', |
| 283 | }, |
| 284 | durable: { aggregateID: "ses_f0ec85cf6ffebfalpvV2E9nocu", seq: 7, version: 1 }, |
| 285 | }, |
| 286 | }, |
| 287 | }, |
| 288 | { |
| 289 | type: "emit_inbound", |
| 290 | label: "session.step.streamed", |
| 291 | frame: { |
| 292 | type: "sdk.event", |
| 293 | event: { |
| 294 | id: "evt_0f137a9ba0012p1Dt72Qx5gAbw", |
| 295 | created: 1790753352122, |
| 296 | type: "session.step.streamed", |
| 297 | location: { directory: "<work>" }, |
| 298 | data: { |
| 299 | sessionID: "ses_f0ec85cf6ffebfalpvV2E9nocu", |
| 300 | assistantMessageID: "msg_0f137a376001CNO3tIF0OHqFsx", |
| 301 | }, |
| 302 | durable: { aggregateID: "ses_f0ec85cf6ffebfalpvV2E9nocu", seq: 8, version: 1 }, |
| 303 | }, |
| 304 | }, |
| 305 | }, |
| 306 | { |
| 307 | type: "emit_inbound", |
| 308 | label: "session.step.ended", |
| 309 | frame: { |
| 310 | type: "sdk.event", |
| 311 | event: { |
| 312 | id: "evt_0f137a9c8001CVVUaPgaXOAnJ3", |
| 313 | created: 1790753352136, |
| 314 | type: "session.step.ended", |
| 315 | location: { directory: "<work>" }, |
| 316 | data: { |
| 317 | sessionID: "ses_f0ec85cf6ffebfalpvV2E9nocu", |
| 318 | assistantMessageID: "msg_0f137a376001CNO3tIF0OHqFsx", |
| 319 | finish: "stop", |
| 320 | rawFinish: "stop", |
| 321 | cost: 0, |
| 322 | tokens: { input: 8927, output: 11, reasoning: 0, cache: { read: 487, write: 0 } }, |
| 323 | snapshot: "5ecf8511987b833d27b391b832f802775c5ca199", |
| 324 | files: [], |
| 325 | }, |
| 326 | durable: { aggregateID: "ses_f0ec85cf6ffebfalpvV2E9nocu", seq: 9, version: 1 }, |
| 327 | }, |
| 328 | }, |
| 329 | }, |
| 330 | { |
| 331 | type: "emit_inbound", |
| 332 | label: "session.usage.updated", |
| 333 | frame: { |
| 334 | type: "sdk.event", |
| 335 | event: { |
| 336 | id: "evt_0f137a9cd001vwSgA3M8W9SR9P", |
| 337 | created: 1790753352141, |
| 338 | type: "session.usage.updated", |
| 339 | data: { |
| 340 | sessionID: "ses_f0ec85cf6ffebfalpvV2E9nocu", |
| 341 | cost: 0, |
| 342 | tokens: { input: 8927, output: 11, reasoning: 0, cache: { read: 487, write: 0 } }, |
| 343 | }, |
| 344 | }, |
| 345 | }, |
| 346 | }, |
| 347 | { |
| 348 | type: "emit_inbound", |
| 349 | label: "session.execution.succeeded", |
| 350 | frame: { |
| 351 | type: "sdk.event", |
| 352 | event: { |
| 353 | id: "evt_0f137a9ce001qLIAQz6psEXDM3", |
| 354 | created: 1790753352142, |
| 355 | type: "session.execution.succeeded", |
| 356 | data: { sessionID: "ses_f0ec85cf6ffebfalpvV2E9nocu" }, |
| 357 | durable: { aggregateID: "ses_f0ec85cf6ffebfalpvV2E9nocu", seq: 10, version: 1 }, |
| 358 | }, |
| 359 | }, |
| 360 | }, |
| 361 | { |
| 362 | type: "expect_outbound", |
| 363 | label: "session.remove", |
| 364 | frame: { type: "session.remove", input: { sessionID: "ses_f0ec85cf6ffebfalpvV2E9nocu" } }, |
| 365 | }, |
| 366 | { |
| 367 | type: "emit_inbound", |
| 368 | label: "session.remove.response", |
| 369 | frame: { type: "sdk.response", operation: "session.remove", data: null }, |
| 370 | }, |
| 371 | ]; |