Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(cursor): show usage limits for browser sign-in #28449

ClosedYoussefRabeiii(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/28449/headopened View on GitHub

Showing 3 changed files with 62 additions and 10 deletions.

x
0 of 3 viewed, 3 left
41 additions and 2 deletionspackages/provider-cursor/src/server/driver.test.tsModified
View file
@@ -21,6 +21,7 @@
import * as Stream from "effect/Stream";
import { vi } from "vite-plus/test";
import * as HttpClient from "effect/http/HttpClient";
+import * as HttpClientResponse from "effect/http/HttpClientResponse";
​
import {
DEFAULT_HANDOFF_TOKEN_CAP,
@@ -71,6 +72,24 @@
"persists browser credentials, uses them for chat, and closes the SDK session on logout",
() =>
Effect.gen(function* () {
+ const fileSystem = yield* FileSystem.FileSystem;
+ const home = yield* fileSystem.makeTempDirectoryScoped({ prefix: "cursor-cli-home-" });
+ for (const directory of [".cursor", "Cursor", "cursor"]) {
+ yield* fileSystem.makeDirectory(`${home}/${directory}`, { recursive: true });
+ yield* fileSystem.writeFileString(
+ `${home}/${directory}/auth.json`,
+ '{"accessToken":"cli-login-token"}',
+ );
+ }
+ const usageClient = HttpClient.make((request) => {
+ expect(request.headers.authorization).toBe("Bearer cli-login-token");
+ return Effect.succeed(
+ HttpClientResponse.fromWeb(
+ request,
+ Response.json({ planUsage: { totalPercentUsed: 42 } }),
+ ),
+ );