40 lines
1.7 KiB
TypeScript
40 lines
1.7 KiB
TypeScript
import { Plugin, Model, Provider } from "@opencode/plugin/effect";
|
|
import { fromPromise } from "@opencode/plugin/promise/adapter";
|
|
import { Effect } from "effect";
|
|
import agents from "../../src/agents/agents.js";
|
|
|
|
export default Plugin.define({
|
|
id: agents.id,
|
|
effect: (context) =>
|
|
Effect.gen(function* () {
|
|
const providerID = Provider.ID.make("fixture");
|
|
yield* context.provider.transform((editor) =>
|
|
editor.add({
|
|
// Copy own fields like the former spread; the editor accepts plain info.
|
|
info: Object.assign({}, Provider.Info.empty(providerID), {
|
|
name: "Isolated fixture",
|
|
activation: "enabled" as const,
|
|
package: "@opencode/ai/providers/openai-compatible",
|
|
settings: { baseURL: process.env["FIXTURE_MODEL_URL"] ?? "" },
|
|
}),
|
|
models: ["gpt-6-luna", "gpt-6.1-sol", "gpt-6-astra"].map((id) =>
|
|
Model.Info.default(providerID, Model.ID.make(id)),
|
|
),
|
|
}),
|
|
);
|
|
yield* fromPromise(agents).effect({
|
|
...context,
|
|
options: {
|
|
agents: {
|
|
"fast-lo": "fixture/gpt-6-luna",
|
|
"fast-hi": "fixture/gpt-6-luna",
|
|
"good-lo": "fixture/gpt-6.1-sol",
|
|
"good-hi": "fixture/gpt-6.1-sol",
|
|
"deep-lo": "fixture/gpt-6-astra",
|
|
"deep-hi": "fixture/gpt-6-astra",
|
|
},
|
|
},
|
|
});
|
|
}),
|
|
});
|