()
| 13 | const port = parseInt(process.env.AIMOCK_PORT || "4010", 10); |
| 14 | |
| 15 | async function main() { |
| 16 | const mock = new LLMock({ port }); |
| 17 | |
| 18 | // Catch-all fixture: respond to any chat-completion request with a |
| 19 | // short text reply. Predicate returns true unconditionally so we |
| 20 | // don't depend on sequenceIndex bookkeeping (OpenCode may issue |
| 21 | // multiple requests per session: model-list probe, chat completion, |
| 22 | // possibly a follow-up). |
| 23 | mock.on( |
| 24 | { predicate: () => true }, |
| 25 | { |
| 26 | content: "hello", |
| 27 | }, |
| 28 | ); |
| 29 | |
| 30 | await mock.start(); |
| 31 | console.log(`aimock-opencode listening on http://127.0.0.1:${port}`); |
| 32 | } |
| 33 | |
| 34 | main().catch((err) => { |
| 35 | console.error("aimock-opencode failed to start:", err); |
no test coverage detected