opencode-cmd-provider 0.1.0 → 0.1.1

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.1 - 2026-08-15
4
+
5
+ Fix: emit `text-start`/`text-end` and `reasoning-start`/`reasoning-end` stream parts. The live Command Code API sends start/end events with ids; the AI SDK's streamText consumer requires them before deltas, so reasoning-capable models (e.g. `deepseek/deepseek-v4-flash`) failed with "reasoning part <id> not found".
6
+
3
7
  ## 0.1.0 - 2026-08-15
4
8
 
5
- Initial release: Command Code provider + plugin for opencode.
9
+ Initial release: Command Code provider + plugin for opencode. Published to npm as `opencode-cmd-provider@0.1.0` (`latest`), tagged `v0.1.0`.
10
+
11
+ - `createCommandCode(options)` AI SDK provider (LanguageModelV3) + `default` V1 opencode plugin module in one package.
12
+ - `/connect` browser auth flow, `COMMANDCODE_API_KEY` env var, and legacy auth file support (`~/.commandcode/auth.json`, `~/.omp/agent/auth.json`, `~/.pi/agent/auth.json`).
13
+ - Model catalog fetch, parse, and cache with offline fallback; pricing/cost display; image input; reasoning effort.
14
+ - Config-declared `models` map required under `provider.commandcode` until `commandcode` lands in opencode's models.dev catalog.
package/README.md CHANGED
@@ -1,11 +1,14 @@
1
1
  # opencode-cmd-provider
2
2
 
3
3
  [![CI](https://github.com/rashidrazak/opencode-cmd-provider/actions/workflows/ci.yml/badge.svg)](https://github.com/rashidrazak/opencode-cmd-provider/actions/workflows/ci.yml)
4
+ [![npm](https://img.shields.io/npm/v/opencode-cmd-provider)](https://www.npmjs.com/package/opencode-cmd-provider)
4
5
 
5
6
  A provider and plugin for [opencode](https://opencode.ai) that connects to the [Command Code](https://commandcode.ai) Provider API.
6
7
 
7
8
  > **Disclaimer:** This is an unofficial, community-maintained integration. It is not affiliated with, endorsed by, or supported by Command Code. You need your own Command Code account and API key or subscription. Command Code's terms, availability, and pricing apply.
8
9
 
10
+ > **Disclaimer:** This is an unofficial, community-maintained integration. It is not affiliated with, endorsed by, or supported by Command Code. You need your own Command Code account and API key or subscription. Command Code's terms, availability, and pricing apply.
11
+
9
12
  ## Install
10
13
 
11
14
  Add the package to your opencode configuration:
@@ -25,20 +28,27 @@ Add the package to your opencode configuration:
25
28
  "name": "Claude Sonnet 5",
26
29
  "limit": { "context": 200000, "output": 65536 },
27
30
  },
31
+ "deepseek/deepseek-v4-flash": {
32
+ "name": "DeepSeek V4 Flash",
33
+ },
28
34
  },
29
35
  },
30
36
  },
31
37
  }
32
38
  ```
33
39
 
34
- > **The `models` map is required.** opencode only fires a provider's `models`
35
- > discovery hook for providers already in its [models.dev](https://models.dev)
36
- > catalog, and `commandcode` is not in that catalog yet. Declaring the models you
37
- > want in `provider.commandcode.models` is what makes them appear in `/models`
38
- > and usable with `opencode run --model commandcode/...`. The reference config is
39
- > the one written by `scripts/opencode-fixture.mjs`. When `commandcode` lands in
40
- > the models.dev catalog, this map becomes optional and discovery works via the
41
- > plugin's `provider.models` hook.
40
+ > **The `models` map is required, and each key must be the model's full Command
41
+ > Code catalog ID.** opencode only fires a provider's `models` discovery hook for
42
+ > providers already in its [models.dev](https://models.dev) catalog, and
43
+ > `commandcode` is not in that catalog yet — so you must declare the models you
44
+ > want. The keys are passed straight to the Command Code API, so use the exact
45
+ > catalog IDs (some are prefixed, e.g. `deepseek/deepseek-v4-flash`,
46
+ > `google/gemini-3.5-flash`, `xai/grok-4.5`). List the current catalog from the
47
+ > terminal with `opencode run --model commandcode/... "hi"` after connecting, or
48
+ > hit `https://api.commandcode.ai/provider/v1/models`. An unprefixed or wrong ID
49
+ > fails with a `403 Model/provider not recognized` error. When `commandcode`
50
+ > lands in the models.dev catalog, this map becomes optional and discovery works
51
+ > via the plugin's `provider.models` hook.
42
52
 
43
53
  Start or reload opencode, then authenticate:
44
54
 
@@ -56,16 +56,30 @@ export function ccEventToStreamPart(event) {
56
56
  if (!isRecord(event))
57
57
  return [];
58
58
  switch (event.type) {
59
+ case "text-start": {
60
+ const id = toolCallIdOf(event) || "text";
61
+ return [{ type: "text-start", id }];
62
+ }
59
63
  case "text-delta": {
60
64
  const id = toolCallIdOf(event) || "text";
61
65
  return [{ type: "text-delta", id, delta: stringValue(event.text) ?? "" }];
62
66
  }
67
+ case "text-end": {
68
+ const id = toolCallIdOf(event) || "text";
69
+ return [{ type: "text-end", id }];
70
+ }
71
+ case "reasoning-start": {
72
+ const id = toolCallIdOf(event) || "reasoning";
73
+ return [{ type: "reasoning-start", id }];
74
+ }
63
75
  case "reasoning-delta": {
64
76
  const id = toolCallIdOf(event) || "reasoning";
65
77
  return [{ type: "reasoning-delta", id, delta: stringValue(event.text) ?? "" }];
66
78
  }
67
- case "reasoning-start":
68
- case "reasoning-end":
79
+ case "reasoning-end": {
80
+ const id = toolCallIdOf(event) || "reasoning";
81
+ return [{ type: "reasoning-end", id }];
82
+ }
69
83
  case "tool-result":
70
84
  return [];
71
85
  case "tool-call": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-cmd-provider",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Command Code provider + plugin for opencode",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",