feat(agent): add controlled task execution
This commit is contained in:
@@ -91,6 +91,35 @@ describe("OpencodeRuntimeAdapter.ensureClient", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("OpencodeRuntimeAdapter.resolveAvailableModel", () => {
|
||||
it("selects the first preferred model actually exposed by OpenCode", async () => {
|
||||
const client = {
|
||||
config: {
|
||||
providers: async () => ({
|
||||
data: {
|
||||
providers: [{
|
||||
id: "deepseek",
|
||||
models: {
|
||||
"deepseek-flash": {},
|
||||
"deepseek-v4-pro": {},
|
||||
},
|
||||
}],
|
||||
default: {},
|
||||
},
|
||||
}),
|
||||
},
|
||||
} as unknown as OpencodeClient;
|
||||
const runtime = Object.assign(Object.create(OpencodeRuntimeAdapter.prototype), {
|
||||
ensureClient: async () => client,
|
||||
}) as OpencodeRuntimeAdapter;
|
||||
|
||||
await expect(runtime.resolveAvailableModel([
|
||||
"deepseek/deepseek-v4-flash",
|
||||
"deepseek/deepseek-v4-pro",
|
||||
])).resolves.toBe("deepseek/deepseek-v4-pro");
|
||||
});
|
||||
});
|
||||
|
||||
describe("resolveEmbeddedOpencodePort", () => {
|
||||
it("falls back to a dynamic port when the configured port is occupied", async () => {
|
||||
const server = createServer();
|
||||
|
||||
Reference in New Issue
Block a user