(model: string, cwd: string)
| 52 | } |
| 53 | |
| 54 | function getOrCreateThread(model: string, cwd: string): Thread { |
| 55 | const key = sessionKey(model, cwd); |
| 56 | const cached = threadCache.get(key); |
| 57 | if (cached) { |
| 58 | return cached; |
| 59 | } |
| 60 | |
| 61 | const thread = codexClient.startThread({ |
| 62 | model, |
| 63 | sandboxMode: DEFAULT_SANDBOX, |
| 64 | workingDirectory: cwd, |
| 65 | }); |
| 66 | threadCache.set(key, thread); |
| 67 | return thread; |
| 68 | } |
| 69 | |
| 70 | const codexAgent: Agent.Definition<(typeof models)[number]> = { |
| 71 | async run(model, prompt, options) { |