Skip to content

Find code by asking what it does. A CLI for coding agents that uses Jev to discover relevant files and source context.

feat: support OpenCode Zen as a Jev provider (#2)

A-Langbdb4e584eab8
diff --git a/README.md b/README.md
index 6865c2b..33ccab3 100644
--- a/README.md
+++ b/README.md
@@ -22,7 +22,7 @@ jg skill
jg "How are telemetry events recorded and sent?" ./my-project
```
-Requires **Node.js 22+**, **macOS or Linux**, and a key for **Vercel AI Gateway, TypeSafe, or OpenRouter**.
+Requires **Node.js 22+**, **macOS or Linux**, and a key for **Vercel AI Gateway, TypeSafe, OpenRouter, or OpenCode Zen**.
No separate Python, Bun, or ripgrep installation is required to use `jg`.
Provider selection requires **0.3.0 or newer**. Upgrade an older installation with
diff --git a/apps/cli/README.md b/apps/cli/README.md
index ae5d0f6..5c8e57f 100644
--- a/apps/cli/README.md
+++ b/apps/cli/README.md
@@ -13,13 +13,13 @@ jg doctor
jg "How are telemetry events recorded and sent?" ./my-project
```
-`auth` asks for Vercel AI Gateway, TypeSafe, or OpenRouter, then saves its key in
-an owner-only config file. Searches use that provider until you run auth again.
+`auth` asks you to choose a provider, then saves its key in an owner-only config file.
+Run `jg --help` for the supported provider names. Searches use that provider until you run auth again.
`doctor` verifies access with synthetic input and names the selected provider.
For unattended setup, pipe the key from your secret manager to:
```sh
-jg auth --provider openrouter --stdin
+jg auth --provider opencode --stdin
```
Both options are required for piped setup. Credentials are saved under
diff --git a/apps/cli/src/args.ts b/apps/cli/src/args.ts
index f335288..a2a967f 100644
--- a/apps/cli/src/args.ts
+++ b/apps/cli/src/args.ts
@@ -1,6 +1,6 @@
import { parseArgs } from "node:util";
import type { SearchInput } from "@repo/core";
-import { isProviderId, type ProviderId } from "@repo/core/providers";
+import { providers, isProviderId, type ProviderId } from "@repo/core/providers";
import { CliError } from "./errors";
import { DEFAULT_MAX_SOURCE_BYTES } from "./render";
@@ -55,7 +55,9 @@ export function parseCommand(args: string[]): Command {
throw new CliError("Usage: jg auth OR jg auth --provider NAME --stdin");
if (!keys.length) return { kind: "auth" };
if (!values.stdin || !isProviderId(values.provider))
- throw new CliError("Use auth --provider vercel|typesafe|openrouter --stdin for a piped key.");
+ throw new CliError(
+ `Use auth --provider ${Object.keys(providers).join("|")} --stdin for a piped key.`,
+ );
return { kind: "auth", provider: values.provider };
}
if (first === "skill") {
@@ -121,7 +123,7 @@ Commands:
--version Show the installed version
Auth automation:
- auth --provider vercel|typesafe|openrouter --stdin
+ auth --provider ${Object.keys(providers).join("|")} --stdin
Save one provider/key from a pipe. Re-running auth replaces your setup.
Saved credentials only; provider key/URL environment variables are ignored.
diff --git a/apps/cli/src/auth.ts b/apps/cli/src/auth.ts
index a7d4aa4..fb86dc9 100644
--- a/apps/cli/src/auth.ts
+++ b/apps/cli/src/auth.ts
@@ -41,7 +41,7 @@ export async function authenticate(provider: ProviderId | undefined, signal: Abo
} else {
if (!process.stdin.isTTY)
throw new CliError(
- "Use auth --provider vercel|typesafe|openrouter --stdin to read a piped key.",
+ `Use auth --provider ${Object.keys(providers).join("|")} --stdin to read a piped key.`,
);
const selected = await select<ProviderId>({
message: "Choose your Jev provider",
diff --git a/apps/cli/test/args.test.ts b/apps/cli/test/args.test.ts
index 389a470..c9270bb 100644
--- a/apps/cli/test/args.test.ts
+++ b/apps/cli/test/args.test.ts
@@ -55,6 +55,10 @@ test("auth requires explicit provider for stdin and keeps provider selection out
kind: "auth",
provider: "openrouter",
});
+ expect(parseCommand(["auth", "--provider", "opencode", "--stdin"])).toEqual({
+ kind: "auth",
+ provider: "opencode",
+ });
for (const args of [
["auth", "--stdin"],
["auth", "--provider", "vercel"],
diff --git a/docs/architecture.md b/docs/architecture.md
index c5e9521..a4d7ffd 100644
--- a/docs/architecture.md
+++ b/docs/architecture.md
@@ -96,7 +96,7 @@ does not guarantee that the coding agent tests the right behavioral boundary.
## Integration and acceptance
Use TypeScript and the AI SDK evaluation interface through one TypeSafe-compatible
-adapter, with fixed Vercel, TypeSafe and OpenRouter presets. Pass native
+adapter, with fixed [provider presets](../packages/core/src/providers.ts). Pass native
`state` and `questions` objects; source is a string field within that data. The
SDK handles HTTP serialization. Keep provider authentication and model access at
the core boundary so future providers do not reshape traversal or stdout.
diff --git a/packages/core/src/providers.ts b/packages/core/src/providers.ts
index afd7a55..03d6c54 100644
--- a/packages/core/src/providers.ts
+++ b/packages/core/src/providers.ts
@@ -14,6 +14,11 @@ export const providers = {
baseURL: "https://openrouter.ai/api/v1",
model: "jev-1.13",
},
+ opencode: {
+ label: "OpenCode Zen",
+ baseURL: "https://opencode.ai/zen/v1",
+ model: "jev-1.13",
+ },
} as const;
export type ProviderId = keyof typeof providers;
diff --git a/specs/done/provider-support/README.md b/specs/done/provider-support/README.md
index 7e68bbd..e4bddcd 100644
--- a/specs/done/provider-support/README.md
+++ b/specs/done/provider-support/README.md
@@ -1,8 +1,8 @@
# Saved-provider support
-Jevgrep supports Vercel AI Gateway, native TypeSafe and OpenRouter through one
-TypeSafe-compatible AI SDK adapter. The implementation landed in `9496540` after
-the protocol checkpoint `06daef9`; it has not been published to npm.
+Jevgrep routes its [saved providers](../../../packages/core/src/providers.ts) through
+one TypeSafe-compatible AI SDK adapter. Provider selection changes transport while
+keeping retrieval behavior fixed.
## Why selection belongs in auth
diff --git a/specs/done/provider-support/research.md b/specs/done/provider-support/research.md
index c925449..7e12e44 100644
--- a/specs/done/provider-support/research.md
+++ b/specs/done/provider-support/research.md
@@ -1,21 +1,24 @@
# Provider contract evidence
-Inspected 2026-09-26. These are documentation/source observations, not live service
-results. Verification uses a small adapter reproduction, not another
-retrieval experiment.
-
-## Fixed presets
-
-| Provider ID | AI SDK adapter base URL | Model sent in body | Evidence |
-| ------------ | ------------------------------------------ | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------ |
-| `vercel` | `https://ai-gateway.vercel.sh/typesafe/v1` | `typesafe-ai/jev` | [Vercel TypeSafe API](https://vercel.com/docs/ai-gateway/sdks-and-apis/typesafe) explicitly shows this model and `/typesafe/v1/systemone`. |
-| `typesafe` | `https://api.typesafe.ai/v1` | `jev-1.13.0` | [TypeSafe models](https://docs.typesafe.ai/models) documents the versioned ID; pin it because retrieval thresholds are calibrated. |
-| `openrouter` | `https://openrouter.ai/api/v1` | `jev-1.13` | [OpenRouter's Jev guide](https://openrouter.ai/blog/insights/what-is-jev/) documents the TypeSafe-compatible route and this bare model ID. |
+Provider endpoints and model IDs live in the [preset registry](../../../packages/core/src/providers.ts).
+These sources explain the protocol choices behind those presets:
+
+- [Vercel TypeSafe API](https://vercel.com/docs/ai-gateway/sdks-and-apis/typesafe)
+ documents the TypeSafe-compatible route rather than chat completions.
+- [TypeSafe models](https://docs.typesafe.ai/models) documents versioned model IDs;
+ pin the native model because retrieval thresholds are calibrated.
+- [OpenRouter's Jev guide](https://openrouter.ai/blog/insights/what-is-jev/)
+ documents its TypeSafe-compatible route and bare model ID.
+- [OpenCode Zen models](https://opencode.ai/v2/docs/console/models/#jev)
+ documents the same TypeSafe-compatible protocol. The existing adapter can serve
+ it without changing request or answer handling.
The native TypeSafe client examples use a base URL without `/v1`; the AI SDK
adapter appends only `/systemone`, so its presets include `/v1`. Do not substitute
OpenRouter chat completions or its separate `/api/alpha/decisions` API.
+The OpenCode integration author reported live verification on 2026-09-27: `jg auth --provider opencode --stdin` saved the key and `jg doctor` reported `Jev connection verified through OpenCode Zen.`, confirming the Zen response matches the SDK's zod schema (noul answers). A real search returned relevant files.
+
Versioned native/OpenRouter names do not prove identical backends or answers to
Vercel's alias. Preserve existing thresholds; do not claim cross-provider solve
quality from transport fixtures. Record actual returned model identity in external
diff --git a/test/fixtures/provider-route.mjs b/test/fixtures/provider-route.mjs
index e8a3e8b..88f0641 100644
--- a/test/fixtures/provider-route.mjs
+++ b/test/fixtures/provider-route.mjs
@@ -3,6 +3,7 @@ const endpoints = new Set([
"https://ai-gateway.vercel.sh/typesafe/v1/systemone",
"https://api.typesafe.ai/v1/systemone",
"https://openrouter.ai/api/v1/systemone",
+ "https://opencode.ai/zen/v1/systemone",
]);
export function routeProviderFetch(originalFetch, origin) {
return async (input, init) => {
diff --git a/test/installed.test.mjs b/test/installed.test.mjs
index 77484f7..4ffa638 100644
--- a/test/installed.test.mjs
+++ b/test/installed.test.mjs
@@ -41,6 +41,11 @@ const providers = {
url: "https://openrouter.ai/api/v1/systemone",
model: "jev-1.13",
},
+ opencode: {
+ label: "OpenCode Zen",
+ url: "https://opencode.ai/zen/v1/systemone",
+ model: "jev-1.13",
+ },
};
const fixtureKey = "installed-http-fixture-key";
const forbidden = "INSTALLED_FIXTURE_IGNORED_CONTENT_MUST_NEVER_UPLOAD";
diff --git a/test/reference/transport.ts b/test/reference/transport.ts
index 44596a6..6be23ee 100644
--- a/test/reference/transport.ts
+++ b/test/reference/transport.ts
@@ -8,6 +8,7 @@ export const providers = {
vercel: { url: "https://ai-gateway.vercel.sh/typesafe/v1/systemone", model: "typesafe-ai/jev" },
typesafe: { url: "https://api.typesafe.ai/v1/systemone", model: "jev-1.13.0" },
openrouter: { url: "https://openrouter.ai/api/v1/systemone", model: "jev-1.13" },
+ opencode: { url: "https://opencode.ai/zen/v1/systemone", model: "jev-1.13" },
} as const;
export type Provider = keyof typeof providers;