@reasoning-router/opencode 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/README.md CHANGED
@@ -6,10 +6,8 @@ request without breaking the prompt cache. Every classifier in
6
6
  [`@reasoning-router/classifiers`](../classifiers) (Jev, Cloudflare Clef,
7
7
  and Laya) is available.
8
8
 
9
- > **Alpha.** This package is not published to npm yet, and OpenCode installs
10
- > plugins by package name from a registry. The configuration below works
11
- > after the first release. Until then, `npm run smoke:plugin:v2` installs the
12
- > packed plugin into OpenCode 2.0.18 from a local test registry.
9
+ > **Alpha.** OpenCode installs the plugin from npm by package name; list it
10
+ > under `plugins` as shown below.
13
11
 
14
12
  Ported from
15
13
  [`opencode-jev-router`](https://github.com/robertn702/opencode-jev-router).
package/dist/plugin-v2.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { randomUUID } from "node:crypto";
2
2
  import { MODELS, modelsFor, parseConfig, } from "@reasoning-router/core";
3
3
  import { z } from "zod";
4
- import { createPluginRuntime, PluginRequestError, SESSION, valid, } from "./plugin-runtime.js";
4
+ import { createPluginRuntime, PluginRequestError, SESSION, TURN, valid, } from "./plugin-runtime.js";
5
5
  /**
6
6
  * OpenCode's model and provider IDs are `Schema.String` brands with no other
7
7
  * checks, so this is the check `ID.make` performs, without importing the SDK
@@ -187,7 +187,12 @@ export async function setupV2(ctx) {
187
187
  throw new Error(`reasoning-router invalid_request (400): alias requires ${alias.group === "openai" ? "/responses" : "/messages"}`);
188
188
  let exchange;
189
189
  try {
190
- exchange = await runtime.start(incoming, { session: valid(event.sessionID, SESSION), turnId: randomUUID() }, alias.group);
190
+ exchange = await runtime.start(incoming, {
191
+ session: valid(event.sessionID, SESSION),
192
+ turnId: valid(incoming.headers.get("x-reasoning-router-turn-id"), TURN) ??
193
+ valid(incoming.headers.get("x-opencode-turn-id"), TURN) ??
194
+ randomUUID(),
195
+ }, alias.group);
191
196
  }
192
197
  catch (cause) {
193
198
  throw rejection(cause);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reasoning-router/opencode",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Adaptive per-step reasoning effort for OpenCode V2",
5
5
  "type": "module",
6
6
  "license": "MIT",