@playwo/opencode-cursor-oauth 0.0.0-dev.17eadae36ea6 → 0.0.0-dev.a9d6c62f0dd9

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
@@ -44,7 +44,7 @@ OpenAI-compatible proxy on demand and routes requests through Cursor's gRPC API.
44
44
  ## How it works
45
45
 
46
46
  1. OAuth — browser-based login to Cursor via PKCE.
47
- 2. Model discovery — queries Cursor's gRPC API for all available models; if discovery fails, the plugin disables the Cursor provider for that load and shows a visible error toast instead of crashing OpenCode.
47
+ 2. Model discovery — queries Cursor's gRPC API for all available models and fails plugin loading visibly if discovery does not succeed.
48
48
  3. Local proxy — translates `POST /v1/chat/completions` into Cursor's
49
49
  protobuf/Connect protocol.
50
50
  4. Native tool routing — rejects Cursor's built-in filesystem/shell tools and
package/dist/index.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import { generateCursorAuthParams, getTokenExpiry, pollCursorAuth, refreshCursorToken, } from "./auth";
2
2
  import { getCursorModels } from "./models";
3
- import { startProxy, stopProxy } from "./proxy";
3
+ import { startProxy } from "./proxy";
4
4
  const CURSOR_PROVIDER_ID = "cursor";
5
- let lastModelDiscoveryError = null;
6
5
  /**
7
6
  * OpenCode plugin that provides Cursor authentication and model access.
8
7
  * Register in opencode.json: { "plugin": ["opencode-cursor-oauth"] }
@@ -30,25 +29,7 @@ export const CursorAuthPlugin = async (input) => {
30
29
  });
31
30
  accessToken = refreshed.access;
32
31
  }
33
- let models;
34
- try {
35
- models = await getCursorModels(accessToken);
36
- lastModelDiscoveryError = null;
37
- }
38
- catch (error) {
39
- const message = error instanceof Error
40
- ? error.message
41
- : "Cursor model discovery failed.";
42
- stopProxy();
43
- if (provider) {
44
- provider.models = {};
45
- }
46
- if (message !== lastModelDiscoveryError) {
47
- lastModelDiscoveryError = message;
48
- await showDiscoveryFailureToast(input, message);
49
- }
50
- return buildDisabledProviderConfig(message);
51
- }
32
+ const models = await getCursorModels(accessToken);
52
33
  const port = await startProxy(async () => {
53
34
  const currentAuth = await getAuth();
54
35
  if (currentAuth.type !== "oauth") {
@@ -164,37 +145,6 @@ function buildCursorProviderModels(models, port) {
164
145
  },
165
146
  ]));
166
147
  }
167
- async function showDiscoveryFailureToast(input, message) {
168
- try {
169
- await input.client.tui.showToast({
170
- body: {
171
- title: "Cursor plugin disabled",
172
- message,
173
- variant: "error",
174
- duration: 8_000,
175
- },
176
- });
177
- }
178
- catch { }
179
- }
180
- function buildDisabledProviderConfig(message) {
181
- return {
182
- baseURL: "http://127.0.0.1/cursor-disabled/v1",
183
- apiKey: "cursor-disabled",
184
- async fetch() {
185
- return new Response(JSON.stringify({
186
- error: {
187
- message,
188
- type: "server_error",
189
- code: "cursor_model_discovery_failed",
190
- },
191
- }), {
192
- status: 503,
193
- headers: { "Content-Type": "application/json" },
194
- });
195
- },
196
- };
197
- }
198
148
  // $/M token rates from cursor.com/docs/models-and-pricing
199
149
  const MODEL_COST_TABLE = {
200
150
  // Anthropic
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playwo/opencode-cursor-oauth",
3
- "version": "0.0.0-dev.17eadae36ea6",
3
+ "version": "0.0.0-dev.a9d6c62f0dd9",
4
4
  "description": "OpenCode plugin that connects Cursor's API to OpenCode via OAuth, model discovery, and a local OpenAI-compatible proxy.",
5
5
  "license": "MIT",
6
6
  "type": "module",