@magpie-community/opencode-trae-auth 0.2.3 → 0.2.4

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.
Files changed (3) hide show
  1. package/README.md +6 -1
  2. package/index.mjs +24 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -122,7 +122,12 @@ it, as Max mode does.
122
122
 
123
123
  Reasoning: the models reason, but Trae's request takes no effort or
124
124
  thinking level, so the plugin lists no variants and a level an agent
125
- picks does nothing.
125
+ picks does nothing. Every model it lists says so in its `capabilities`
126
+ (`reasoning: true`, with `toolcall`, `temperature`, `attachment`, the
127
+ input and output modalities and an empty `variants`), the fallback
128
+ list's own capabilities kept where it has an entry: magpie reads
129
+ `capabilities.reasoning` alone for a model a plugin lists, and a model
130
+ without it is shown as one that doesn't reason (0.2.4).
126
131
 
127
132
  When no
128
133
  list can be read, the plugin uses the realm's own fallback list. Trae CN's
package/index.mjs CHANGED
@@ -1804,6 +1804,13 @@ const makePlugin = (site) => async ({ client }) => {
1804
1804
  return [...out.values()].map((x) => x.m)
1805
1805
  }
1806
1806
 
1807
+ // modelOf is a model of the account's list as OpenCode's provider
1808
+ // carries one. A model of the site's fallback list has capabilities
1809
+ // already (magpie's host spreads the config's into them); one the list
1810
+ // doesn't have gets them from MODEL's flat fields, so that magpie reads
1811
+ // it as a model that reasons rather than one that doesn't (its host
1812
+ // reads capabilities.reasoning alone, host.js). The fallback list stays
1813
+ // the authority where it has an entry.
1807
1814
  const modelOf = (provider, m) => {
1808
1815
  const id = String(m.config_name)
1809
1816
  const was = provider.models?.[id] ?? {}
@@ -1811,7 +1818,23 @@ const makePlugin = (site) => async ({ client }) => {
1811
1818
  const ctx = Number(m.context_window_tokens?.dev ?? m.context_window_size?.max?.[0] ?? m.context_window_size?.max ?? m.context_window_tokens?.max ?? m.prompt_max_tokens) || was.limit?.context || MODEL.limit.context
1812
1819
  const out = Number(devModel(m)?.max_tokens) || was.limit?.output || 0
1813
1820
  const name = m.display_config?.display_name || m.display_name || m.display_model_name || was.name || id
1814
- return { ...MODEL, ...was, id, providerID: site.id, name: String(name), limit: { context: ctx, output: out }, api: was.api ?? { id, url: site.hosts.api, npm: "@ai-sdk/openai-compatible" } }
1821
+ const input = (k) => (MODEL.modalities?.input ?? []).includes(k)
1822
+ return {
1823
+ ...MODEL, ...was, id, providerID: site.id, name: String(name), limit: { context: ctx, output: out },
1824
+ api: was.api ?? { id, url: site.hosts.api, npm: "@ai-sdk/openai-compatible" },
1825
+ capabilities: {
1826
+ ...(was.capabilities ?? {}),
1827
+ reasoning: was.capabilities?.reasoning ?? MODEL.reasoning,
1828
+ temperature: was.capabilities?.temperature ?? MODEL.temperature,
1829
+ attachment: was.capabilities?.attachment ?? MODEL.attachment,
1830
+ toolcall: was.capabilities?.toolcall ?? MODEL.tool_call,
1831
+ input: was.capabilities?.input ?? { text: true, image: input("image"), audio: input("audio"), video: input("video"), pdf: input("pdf") },
1832
+ output: was.capabilities?.output ?? { text: true, image: false, audio: false, video: false, pdf: false },
1833
+ },
1834
+ // Trae's request takes no effort or thinking level, so a model has
1835
+ // none to pick from (see the README's Reasoning)
1836
+ variants: was.variants ?? {},
1837
+ }
1815
1838
  }
1816
1839
 
1817
1840
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpie-community/opencode-trae-auth",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "OpenCode provider plugins for Trae: Trae CN (trae.cn) and Trae Global (trae.ai), free tier included, with Trae's own browser sign-in",
5
5
  "type": "module",
6
6
  "main": "./index.mjs",