(
client: OpencodeClient,
config: RunnerConfig,
title: string,
)
| 306 | } |
| 307 | |
| 308 | async function createSession( |
| 309 | client: OpencodeClient, |
| 310 | config: RunnerConfig, |
| 311 | title: string, |
| 312 | ): Promise<string> { |
| 313 | const response = await withRetry(config, `session.create:${title}`, (_attempt, signal) => |
| 314 | client.session.create({ |
| 315 | query: { directory: config.projectDirectory }, |
| 316 | body: { title }, |
| 317 | signal, |
| 318 | }), |
| 319 | ); |
| 320 | const sessionId = response.data?.id; |
| 321 | if (typeof sessionId !== "string" || sessionId.length === 0) { |
| 322 | throw new Error(`Session create returned invalid id for ${title}`); |
| 323 | } |
| 324 | return sessionId; |
| 325 | } |
| 326 | |
| 327 | async function deleteSession( |
| 328 | client: OpencodeClient, |
no test coverage detected