opencode-magi 0.0.0-dev-20260721051451 → 0.0.0-dev-20260721051539

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,25 @@
1
1
  import { isArray } from "./assertion";
2
+ import { createExec } from "./exec";
2
3
  export async function getModels(input) {
3
4
  const providers = await input.client.config
4
5
  .providers({ directory: input.directory })
5
6
  .catch(() => input.client.provider.list({ directory: input.directory }));
6
7
  const data = "data" in providers ? providers.data : undefined;
7
8
  const all = data && "providers" in data ? data.providers : data?.all;
8
- return isArray(all)
9
+ const models = isArray(all)
9
10
  ? all.flatMap((provider) => {
10
11
  const models = Object.keys(provider.models);
11
12
  return provider.id ? models.map((id) => `${provider.id}/${id}`) : models;
12
13
  })
13
14
  : [];
15
+ if (models.length)
16
+ return models;
17
+ else
18
+ try {
19
+ const output = await createExec(input.directory)("opencode models");
20
+ return output.split("\n").filter((model) => model.includes("/"));
21
+ }
22
+ catch {
23
+ return [];
24
+ }
14
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-magi",
3
- "version": "0.0.0-dev-20260721051451",
3
+ "version": "0.0.0-dev-20260721051539",
4
4
  "description": "Multi-agent PR review and merge orchestration plugin for OpenCode.",
5
5
  "license": "MIT",
6
6
  "author": "Hirotomo Yamada <hirotomo.yamada@avap.co.jp>",