Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ echo "$jwt" | cut -d. -f2 | base64 -d 2>/dev/null | jq '{aud, iss, sub}'
The principled fix on the embedder side:

```ts
import { OAuth2ModelSyncPlugin } from "@vymalo/opencode-oauth2";
import { OAuth2ModelSyncPlugin } from "@vymalo/opencode-oauth2/lib";
const runtime = new OAuth2ModelSyncPlugin(cfg, { /* ... */ });
await runtime.initialize();
await runtime.start({ warmup: true, interactive: false });
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "opencode-oauth2-workspace",
"version": "0.2.0",
"version": "0.2.1",
"private": true,
"description": "Workspace for @vymalo/opencode-oauth2 — OAuth2/OIDC-secured OpenAI-compatible providers for OpenCode.",
"packageManager": "pnpm@11.3.0",
Expand Down
13 changes: 12 additions & 1 deletion packages/opencode-oauth2/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vymalo/opencode-oauth2",
"version": "0.2.0",
"version": "0.2.1",
"description": "OpenCode plugin for OAuth2/OIDC-secured, OpenAI-compatible model providers with periodic model sync.",
"license": "MIT",
"author": "vymalo contributors",
Expand All @@ -25,6 +25,17 @@
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
},
"./lib": {
"types": "./dist/lib.d.ts",
"import": "./dist/lib.js"
},
"./package.json": "./package.json"
},
"sideEffects": false,
"files": [
"dist"
Expand Down
40 changes: 5 additions & 35 deletions packages/opencode-oauth2/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,5 @@
export {
DEFAULT_HTTP_TIMEOUT_MS,
DEFAULT_SYNC_INTERVAL_MINUTES,
type OAuth2ModelSyncConfig,
type OAuth2ModelSyncConfigInput,
type OAuthServerConfig,
type OAuthServerConfigInput,
validateConfig
} from "./config.js";

export { createJsonConsoleLogger, type LogLevel, type Logger } from "./logging.js";

export { buildModelsUrl, fetchModels } from "./model-discovery.js";

export { diffModels, normalizeModelId, normalizeModelList } from "./model-normalization.js";

export { OAuth2ModelSyncPlugin, type PluginOptions } from "./plugin.js";

export { resolveCacheDir, FileCacheStore } from "./cache.js";

export {
createOpencodeOauth2Plugin,
OpencodeOauth2Plugin,
OpencodeOauth2Plugin as default
} from "./opencode.js";
export type { OpenCodePluginFactoryOptions } from "./opencode.js";

export type {
CachedServerState,
ModelDiff,
NormalizedModel,
RawModel,
ServerSnapshot,
TokenSet
} from "./types.js";
// OpenCode plugin entry. The host iterates every named export of this module
// and rejects any export that isn't a Plugin function (or { server: Plugin }).
// Only the plugin function lives here; the library API is in ./lib.ts and is
// exposed via the "./lib" subpath in package.json.
export { default } from "./opencode.js";
31 changes: 31 additions & 0 deletions packages/opencode-oauth2/src/lib.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
export {
DEFAULT_HTTP_TIMEOUT_MS,
DEFAULT_SYNC_INTERVAL_MINUTES,
type OAuth2ModelSyncConfig,
type OAuth2ModelSyncConfigInput,
type OAuthServerConfig,
type OAuthServerConfigInput,
validateConfig
} from "./config.js";

export { createJsonConsoleLogger, type LogLevel, type Logger } from "./logging.js";

export { buildModelsUrl, fetchModels } from "./model-discovery.js";

export { diffModels, normalizeModelId, normalizeModelList } from "./model-normalization.js";

export { OAuth2ModelSyncPlugin, type PluginOptions } from "./plugin.js";

export { resolveCacheDir, FileCacheStore } from "./cache.js";

export { createOpencodeOauth2Plugin } from "./opencode.js";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The pre-instantiated plugin instance OpencodeOauth2Plugin is not exported from lib.ts. Since it was previously exported from index.ts (and can no longer be exported there to prevent OpenCode from invoking it with incorrect arguments), it should be exported from lib.ts so that embedders who import named exports can still access it.

Suggested change
export { createOpencodeOauth2Plugin } from "./opencode.js";
export { createOpencodeOauth2Plugin, OpencodeOauth2Plugin } from "./opencode.js";

export type { OpenCodePluginFactoryOptions } from "./opencode.js";

export type {
CachedServerState,
ModelDiff,
NormalizedModel,
RawModel,
ServerSnapshot,
TokenSet
} from "./types.js";
2 changes: 1 addition & 1 deletion packages/plugin-bundle/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vymalo/opencode-oauth2-bundle",
"version": "0.2.0",
"version": "0.2.1",
"private": true,
"type": "module",
"scripts": {
Expand Down