diff --git a/CHANGELOG.md b/CHANGELOG.md index 13e5004..21ab3e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- **CJS type declarations (FalseESM)** - Split the `exports["."]` conditions so `require` resolves the CommonJS declarations (`./dist/index.d.cts`) that the build already emitted, instead of the ESM `./dist/index.d.ts`. Previously, TypeScript consumers using `require()` under `node16`/`nodenext` module resolution got a "Masquerading as ESM" error from `@arethetypeswrong/cli`; both `publint` and `attw --pack` are now clean across all resolution modes. - **Empty response data errors** - Prompt calls that succeed but return no response data (the behavior of opencode CLI 1.17.x for invalid or unavailable `provider/model` IDs, e.g. the `github-copilot/gpt-5` repro from [#21](https://github.com/ben-vargas/ai-sdk-provider-opencode-sdk/issues/21)) now throw an actionable `APICallError` that names the requested model ID, suggests checking `opencode models`, includes the server error payload when available, and carries `errorType: "EmptyResponseData"` — replacing the generic `No response data from OpenCode`. The streaming path surfaces the same error as an `error` stream part and terminates the stream instead of hanging on the event subscription. - **`wrapError` double-wrapping** - `wrapError` now returns already-wrapped AI SDK errors (`APICallError`, `LoadAPIKeyError`) unchanged instead of re-wrapping them and losing their metadata. - **Singleton client manager recovery after dispose** - `OpencodeClientManager.dispose()` now releases the singleton slot when the disposed manager is the singleton, so a later `createOpencode()` builds a fresh client manager. Previously the singleton kept pointing at the disposed instance, and every subsequent provider in the same process failed with `Client manager has been disposed`. diff --git a/package.json b/package.json index abc3994..f0dfcc1 100644 --- a/package.json +++ b/package.json @@ -27,9 +27,14 @@ "exports": { "./package.json": "./package.json", ".": { - "types": "./dist/index.d.ts", - "import": "./dist/index.js", - "require": "./dist/index.cjs" + "import": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "require": { + "types": "./dist/index.d.cts", + "default": "./dist/index.cjs" + } } }, "files": [