cursor-switch 1.0.6 → 1.0.7
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/dist/cli.js +16 -0
- package/dist/core/dashboard-launcher.d.ts +4 -4
- package/dist/core/dashboard-launcher.js +9 -9
- package/dist/core/outlook-launcher.d.ts +4 -0
- package/dist/core/outlook-launcher.js +162 -134
- package/dist/core/pure-login-service.d.ts +22 -2
- package/dist/core/pure-login-service.js +165 -72
- package/dist/core/welcome-offer-service.d.ts +52 -0
- package/dist/core/welcome-offer-service.js +369 -0
- package/dist/menu.js +14 -4
- package/package.json +1 -1
|
@@ -181,9 +181,34 @@ export class PureLoginService {
|
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
/**
|
|
184
|
-
*
|
|
184
|
+
* 向云端申请重新发送验证码 (同会话重发,不扣减卡密额度)
|
|
185
185
|
*/
|
|
186
|
-
async
|
|
186
|
+
async resendCode(taskId, cardCode, email) {
|
|
187
|
+
const apiBase = this.configStore.getSeatApiBase();
|
|
188
|
+
try {
|
|
189
|
+
const res = await fetch(`${apiBase}/api/v1/token-service/resend-code`, {
|
|
190
|
+
method: 'POST',
|
|
191
|
+
headers: { 'Content-Type': 'application/json' },
|
|
192
|
+
body: JSON.stringify({
|
|
193
|
+
task_id: taskId,
|
|
194
|
+
card_code: cardCode.trim(),
|
|
195
|
+
email: email.trim(),
|
|
196
|
+
}),
|
|
197
|
+
});
|
|
198
|
+
const data = await res.json().catch(() => ({}));
|
|
199
|
+
if (res.ok && data.success) {
|
|
200
|
+
return { ok: true, message: data.message || '已重新向 Cursor 鉴权中心请求发送最新验证码!' };
|
|
201
|
+
}
|
|
202
|
+
return { ok: false, message: data.detail || data.error || '重新请求发信失败,请稍后重试' };
|
|
203
|
+
}
|
|
204
|
+
catch (err) {
|
|
205
|
+
return { ok: false, message: `网络连接异常: ${err.message}` };
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* 结构化查询云端邮箱验证码并精准解析是否可重试
|
|
210
|
+
*/
|
|
211
|
+
async fetchMailCodeResult(email, emailPassword, cursorPassword) {
|
|
187
212
|
const apiBase = this.configStore.getSeatApiBase();
|
|
188
213
|
try {
|
|
189
214
|
const res = await fetch(`${apiBase}/api/v1/mail/code`, {
|
|
@@ -195,28 +220,67 @@ export class PureLoginService {
|
|
|
195
220
|
cursorPassword: cursorPassword?.trim() || '',
|
|
196
221
|
}),
|
|
197
222
|
});
|
|
198
|
-
const data = await res.json();
|
|
223
|
+
const data = await res.json().catch(() => ({}));
|
|
199
224
|
if (res.ok) {
|
|
225
|
+
let code = '';
|
|
200
226
|
if (data.code && /^\d{6}$/.test(data.code)) {
|
|
201
|
-
|
|
227
|
+
code = data.code;
|
|
202
228
|
}
|
|
203
|
-
if (Array.isArray(data.mails)) {
|
|
229
|
+
else if (Array.isArray(data.mails)) {
|
|
204
230
|
for (const m of data.mails) {
|
|
205
231
|
const text = `${m.subject || ''} ${m.body || m.content || ''}`;
|
|
206
232
|
const match = text.match(/\b\d{6}\b/);
|
|
207
|
-
if (match)
|
|
208
|
-
|
|
233
|
+
if (match) {
|
|
234
|
+
code = match[0];
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
209
237
|
}
|
|
210
238
|
}
|
|
239
|
+
if (code) {
|
|
240
|
+
return { ok: true, code, retryable: false, message: '取码成功' };
|
|
241
|
+
}
|
|
242
|
+
// data.retryable 由后端严格判定:
|
|
243
|
+
// 若密码错误/令牌未匹配/账号不存在,后端返回 retryable: false
|
|
244
|
+
// 只有收件箱暂无新邮件时,后端返回 retryable: true
|
|
245
|
+
const retryable = Boolean(data.retryable !== false && (data.ok === true || data.ok === undefined));
|
|
246
|
+
return {
|
|
247
|
+
ok: Boolean(data.ok),
|
|
248
|
+
code: '',
|
|
249
|
+
retryable,
|
|
250
|
+
message: data.message || (retryable ? '收件箱暂无新邮件' : '邮箱不存在或密码不正确'),
|
|
251
|
+
};
|
|
211
252
|
}
|
|
253
|
+
else {
|
|
254
|
+
// HTTP 429 属于限流(稍后可重试),而 400/403/404/401 属于不可重试的致命错误
|
|
255
|
+
const retryable = res.status === 429;
|
|
256
|
+
return {
|
|
257
|
+
ok: false,
|
|
258
|
+
code: '',
|
|
259
|
+
retryable,
|
|
260
|
+
message: data.detail || data.message || `云端服务返回异常 (HTTP ${res.status})`,
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
catch (err) {
|
|
265
|
+
return {
|
|
266
|
+
ok: false,
|
|
267
|
+
code: '',
|
|
268
|
+
retryable: true,
|
|
269
|
+
message: `网络连接异常: ${err.message}`,
|
|
270
|
+
};
|
|
212
271
|
}
|
|
213
|
-
|
|
214
|
-
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* 自动从用户邮箱中提取最新 6 位数字验证码 (保留兼容性)
|
|
275
|
+
*/
|
|
276
|
+
async autoFetchMailCode(email, emailPassword, cursorPassword) {
|
|
277
|
+
const res = await this.fetchMailCodeResult(email, emailPassword, cursorPassword);
|
|
278
|
+
return res.code || null;
|
|
215
279
|
}
|
|
216
280
|
/**
|
|
217
281
|
* 交互式运行纯净代登全流程 (终端交互式 TUI)
|
|
218
282
|
*/
|
|
219
|
-
async runInteractiveFlow(store, storage, sqlite, executablePath) {
|
|
283
|
+
async runInteractiveFlow(store, storage, sqlite, executablePath, options = {}) {
|
|
220
284
|
console.log(chalk.bold.cyan('\n☁ 正在连接海外纯净代登云服务...\n'));
|
|
221
285
|
console.log(chalk.grey('说明: 100% 云端集群托管执行,本地无需安装代理,全自动过人机盾/收信取码提取 Token。\n'));
|
|
222
286
|
// 1. 获取并核验代登卡密 (自动读取记忆,支持一键复用或更换)
|
|
@@ -242,7 +306,7 @@ export class PureLoginService {
|
|
|
242
306
|
message: '请输入【纯净代登卡密】(按 Esc 或输入空返回):',
|
|
243
307
|
});
|
|
244
308
|
if (!inputKey)
|
|
245
|
-
return;
|
|
309
|
+
return null;
|
|
246
310
|
const check = await this.checkKey(inputKey);
|
|
247
311
|
if (check.valid) {
|
|
248
312
|
activeKey = inputKey.trim();
|
|
@@ -254,34 +318,32 @@ export class PureLoginService {
|
|
|
254
318
|
console.log(chalk.red(`\n✖ 卡密核验失败: ${check.detail || '无效卡密'}\n`));
|
|
255
319
|
const retry = await safeConfirm({ message: '是否重新输入卡密?', default: true });
|
|
256
320
|
if (!retry)
|
|
257
|
-
return;
|
|
321
|
+
return null;
|
|
258
322
|
}
|
|
259
323
|
}
|
|
260
324
|
}
|
|
261
|
-
// 2. 录入待登账号信息 (
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
chalk.grey('
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
});
|
|
325
|
+
// 2. 录入待登账号信息 (支持直接输入邮箱,或粘贴带分隔符的账号)
|
|
326
|
+
let rawInput = options.prefilledInput?.trim();
|
|
327
|
+
if (!rawInput) {
|
|
328
|
+
console.log(chalk.grey('提示: 请输入待登 Cursor 邮箱 (支持直接粘贴 user@outlook.com 或 user@outlook.com----xxx 格式):'));
|
|
329
|
+
rawInput = await safeInput({
|
|
330
|
+
message: '请输入 Cursor 账号信息:',
|
|
331
|
+
});
|
|
332
|
+
}
|
|
270
333
|
if (!rawInput)
|
|
271
|
-
return;
|
|
334
|
+
return null;
|
|
272
335
|
const parsed = this.parseAccountString(rawInput);
|
|
273
336
|
if (!parsed.email || !parsed.email.includes('@')) {
|
|
274
337
|
console.log(chalk.red('\n未识别到有效的邮箱地址,操作已取消。\n'));
|
|
275
338
|
await safePressAnyKey();
|
|
276
|
-
return;
|
|
339
|
+
return null;
|
|
277
340
|
}
|
|
278
|
-
const isAutoMail = Boolean(parsed.emailPassword);
|
|
279
341
|
console.log(boxen([
|
|
280
342
|
chalk.bold.white('📋 账号待登要素确认:'),
|
|
281
343
|
chalk.dim('────────────────────────────────────────────────'),
|
|
282
|
-
` 目标邮箱 : ${chalk.yellow(parsed.email)}`,
|
|
283
|
-
`
|
|
284
|
-
`
|
|
344
|
+
` 目标邮箱 : ${chalk.bold.yellow(parsed.email)}`,
|
|
345
|
+
` 代登模式 : ${chalk.cyan('⚡ 纯净海外住宅 IP 专线代登')}`,
|
|
346
|
+
` 取码方式 : ${chalk.green('💬 查收邮件并在终端输入 6 位验证码')}`,
|
|
285
347
|
...(parsed.cursorPassword ? [` 附加信息 : ${chalk.grey('● 已保留备用')}`] : []),
|
|
286
348
|
].join('\n'), { padding: { top: 0, bottom: 0, left: 1, right: 1 }, borderColor: 'blue', borderStyle: 'round' }));
|
|
287
349
|
// 3. 启动云端任务并建立 SSE 流式监听
|
|
@@ -296,7 +358,7 @@ export class PureLoginService {
|
|
|
296
358
|
if (!startRes.ok || !startRes.taskId) {
|
|
297
359
|
console.log(chalk.red(`\n✖ 任务启动失败: ${startRes.detail || '未知原因'}\n`));
|
|
298
360
|
await safePressAnyKey();
|
|
299
|
-
return;
|
|
361
|
+
return null;
|
|
300
362
|
}
|
|
301
363
|
const taskId = startRes.taskId;
|
|
302
364
|
console.log(chalk.green(`✔ 任务已受理 (TaskID: ${taskId.slice(0, 8)}),正在实时处理...\n`));
|
|
@@ -345,44 +407,42 @@ export class PureLoginService {
|
|
|
345
407
|
console.log(chalk.grey(`⏳ ${step}${data.msg || '正在推进登录鉴权...'}`));
|
|
346
408
|
}
|
|
347
409
|
else if (currentEvent === 'need_code') {
|
|
348
|
-
console.log(chalk.yellow(`\n📨 验证码已派发至您的邮箱 (${parsed.email})`));
|
|
349
|
-
|
|
350
|
-
// 1. 若附带了邮箱密码,优先尝试云端协议 4 轮自动收信
|
|
410
|
+
console.log(chalk.yellow(`\n📨 Cursor 验证码已派发至您的邮箱 (${parsed.email})`));
|
|
411
|
+
// 若提供了邮箱密码,调起本地独立隔离浏览器协助自动登录 Outlook
|
|
351
412
|
if (parsed.emailPassword) {
|
|
352
|
-
console.log(chalk.cyan('
|
|
353
|
-
for (let i = 1; i <= 4; i++) {
|
|
354
|
-
await new Promise((r) => setTimeout(r, 2000));
|
|
355
|
-
const foundCode = await this.autoFetchMailCode(parsed.email, parsed.emailPassword, parsed.cursorPassword);
|
|
356
|
-
if (foundCode) {
|
|
357
|
-
otpToSubmit = foundCode;
|
|
358
|
-
console.log(chalk.green(`🎉 云端协议自动提取验证码成功: ${chalk.bold.white(foundCode)}`));
|
|
359
|
-
break;
|
|
360
|
-
}
|
|
361
|
-
else {
|
|
362
|
-
console.log(chalk.grey(`云端收信重试中 (${i}/4)...`));
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
// 2. 若云端协议取码未成功且提供了邮箱密码,触发本地独立隔离浏览器登录 Outlook 收件箱取码
|
|
367
|
-
if (!otpToSubmit && parsed.emailPassword) {
|
|
368
|
-
console.log(chalk.yellow('\n☁ 云端协议收信未就绪 (微软限制或需网页授权)'));
|
|
369
|
-
console.log(chalk.cyan('🚀 正在启动本地独立隔离浏览器,自动登录 Outlook 邮箱提取验证码...'));
|
|
413
|
+
console.log(chalk.cyan('🚀 正在启动本地独立隔离浏览器,自动登录 Outlook 邮箱...'));
|
|
370
414
|
try {
|
|
371
415
|
const mailRes = await OutlookLauncher.openMailbox({
|
|
372
416
|
email: parsed.email,
|
|
373
417
|
emailPassword: parsed.emailPassword,
|
|
374
|
-
sniffOtp:
|
|
375
|
-
sniffTimeoutMs: 20000,
|
|
418
|
+
sniffOtp: false, // 零等待,秒登进入后直接置顶
|
|
376
419
|
});
|
|
377
|
-
if (mailRes.
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
420
|
+
if (mailRes.status === 'logged_in') {
|
|
421
|
+
console.log(boxen([
|
|
422
|
+
chalk.bold.green('✔ 独立浏览器已自动登入 Outlook 收件箱!'),
|
|
423
|
+
chalk.dim('────────────────────────────────────────────────────────────'),
|
|
424
|
+
chalk.bold.white('💡【取码指引】:'),
|
|
425
|
+
` 1. 浏览器窗口已置顶展示,请查看最新的 ${chalk.bold.cyan('Cursor')} 官方邮件`,
|
|
426
|
+
` 2. ${chalk.bold.yellow('特别注意: 若收件箱未看到邮件,请务必点击上方【其他 / Other】分类栏')}`,
|
|
427
|
+
` 3. 复制或记下邮件中的 6 位数字验证码,直接在下方粘贴/输入`,
|
|
428
|
+
].join('\n'), {
|
|
429
|
+
padding: { top: 0, bottom: 0, left: 1, right: 1 },
|
|
430
|
+
borderColor: 'green',
|
|
431
|
+
borderStyle: 'round',
|
|
432
|
+
}));
|
|
383
433
|
}
|
|
384
434
|
else if (mailRes.status === 'manual_required') {
|
|
385
|
-
console.log(
|
|
435
|
+
console.log(boxen([
|
|
436
|
+
chalk.bold.yellow('⚠️ 微软要求安全验证 (辅助邮箱 / 二次认证)'),
|
|
437
|
+
chalk.dim('────────────────────────────────────────────────────────────'),
|
|
438
|
+
` • 浏览器窗口已为您调起并置顶,请在浏览器中完成辅助邮箱验证`,
|
|
439
|
+
` • 验证成功进入收件箱后,查看最新的 ${chalk.bold.cyan('Cursor')} 验证码并在下方输入`,
|
|
440
|
+
` • ${chalk.dim('提示: 若收件箱未看到邮件,请查看【其他】分类栏')}`,
|
|
441
|
+
].join('\n'), {
|
|
442
|
+
padding: { top: 0, bottom: 0, left: 1, right: 1 },
|
|
443
|
+
borderColor: 'yellow',
|
|
444
|
+
borderStyle: 'round',
|
|
445
|
+
}));
|
|
386
446
|
}
|
|
387
447
|
else {
|
|
388
448
|
console.log(chalk.grey(` → 浏览器状态: ${mailRes.message}`));
|
|
@@ -392,22 +452,51 @@ export class PureLoginService {
|
|
|
392
452
|
console.log(chalk.yellow(`本地浏览器唤起异常 (${e.message}),转入终端手动输入`));
|
|
393
453
|
}
|
|
394
454
|
}
|
|
395
|
-
|
|
455
|
+
else {
|
|
456
|
+
console.log(boxen([
|
|
457
|
+
chalk.bold.green('📨 Cursor 官方 6 位验证码已派发至您的邮箱!'),
|
|
458
|
+
chalk.dim('────────────────────────────────────────────────────────────'),
|
|
459
|
+
` 接收邮箱 : ${chalk.bold.yellow(parsed.email)}`,
|
|
460
|
+
'',
|
|
461
|
+
chalk.bold.white('💡【取码指引】:'),
|
|
462
|
+
` 1. 请打开/登录您的常用邮箱,查收来自 ${chalk.bold.cyan('Cursor')} 官方的 6 位数字验证码`,
|
|
463
|
+
` 2. ${chalk.bold.yellow('特别注意: 若收件箱未看到邮件,请查看【其他 / Other】或【垃圾邮件】分类栏')}`,
|
|
464
|
+
` 3. 复制收到的 6 位数字验证码,直接在下方粘贴并回车即可完成登录`,
|
|
465
|
+
].join('\n'), {
|
|
466
|
+
padding: { top: 0, bottom: 0, left: 1, right: 1 },
|
|
467
|
+
borderColor: 'cyan',
|
|
468
|
+
borderStyle: 'round',
|
|
469
|
+
}));
|
|
470
|
+
}
|
|
471
|
+
let otpToSubmit = '';
|
|
396
472
|
let submitAttempts = 0;
|
|
397
473
|
const MAX_ATTEMPTS = 3;
|
|
398
474
|
while (submitAttempts < MAX_ATTEMPTS) {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
if (!otpToSubmit) {
|
|
475
|
+
const inputVal = (await safeInput({
|
|
476
|
+
message: submitAttempts === 0
|
|
477
|
+
? '请输入收到的 6 位邮箱验证码 (可直接 Ctrl+V 粘贴):'
|
|
478
|
+
: `请重新输入 6 位验证码 (剩余 ${MAX_ATTEMPTS - submitAttempts} 次重试机会):`,
|
|
479
|
+
cancelHint: '输入 r 重发验证码,输入 0 或 q 取消',
|
|
480
|
+
})) || '';
|
|
481
|
+
if (!inputVal) {
|
|
407
482
|
console.log(chalk.red('\n未输入验证码,代登已终止。\n'));
|
|
408
483
|
await safePressAnyKey();
|
|
409
|
-
return;
|
|
484
|
+
return null;
|
|
410
485
|
}
|
|
486
|
+
// 支持输入 r / resend 重发验证码 (同会话重发,不扣减卡密额度)
|
|
487
|
+
if (inputVal.toLowerCase() === 'r' || inputVal.toLowerCase() === 'resend') {
|
|
488
|
+
console.log(chalk.cyan('\n⏳ 正在向 Cursor 申请重新发送最新验证码 (同会话重发,不扣额度)...'));
|
|
489
|
+
const resendRes = await this.resendCode(taskId, activeKey, parsed.email);
|
|
490
|
+
if (resendRes.ok) {
|
|
491
|
+
console.log(chalk.green(`✔ ${resendRes.message}`));
|
|
492
|
+
console.log(chalk.grey('提示: 请稍候 3~5 秒,并在收件箱(特别注意点击【其他】分类栏)查收新邮件。\n'));
|
|
493
|
+
}
|
|
494
|
+
else {
|
|
495
|
+
console.log(chalk.yellow(`⚠️ ${resendRes.message}\n`));
|
|
496
|
+
}
|
|
497
|
+
continue;
|
|
498
|
+
}
|
|
499
|
+
otpToSubmit = inputVal;
|
|
411
500
|
submitAttempts++;
|
|
412
501
|
console.log(chalk.cyan('正在提交验证码并生成官方登录凭证...'));
|
|
413
502
|
const submitRes = await this.submitOtp(taskId, activeKey, otpToSubmit);
|
|
@@ -451,7 +540,7 @@ export class PureLoginService {
|
|
|
451
540
|
else {
|
|
452
541
|
console.log(chalk.grey('\n用户主动取消重试,代登已终止。\n'));
|
|
453
542
|
await safePressAnyKey();
|
|
454
|
-
return;
|
|
543
|
+
return null;
|
|
455
544
|
}
|
|
456
545
|
}
|
|
457
546
|
else {
|
|
@@ -462,7 +551,7 @@ export class PureLoginService {
|
|
|
462
551
|
console.log(chalk.red(`\n✖ 验证码提交未通过: ${submitRes.detail || '验证码错误或会话已过期'}\n`));
|
|
463
552
|
}
|
|
464
553
|
await safePressAnyKey();
|
|
465
|
-
return;
|
|
554
|
+
return null;
|
|
466
555
|
}
|
|
467
556
|
}
|
|
468
557
|
}
|
|
@@ -491,7 +580,7 @@ export class PureLoginService {
|
|
|
491
580
|
else if (currentEvent === 'failed' || (data.error && currentEvent !== 'status')) {
|
|
492
581
|
console.log(chalk.red(`\n✖ 代登未完成: ${data.error || data.detail || '官方服务响应超时或验证失败'}\n`));
|
|
493
582
|
await safePressAnyKey();
|
|
494
|
-
return;
|
|
583
|
+
return null;
|
|
495
584
|
}
|
|
496
585
|
}
|
|
497
586
|
catch { }
|
|
@@ -510,7 +599,7 @@ export class PureLoginService {
|
|
|
510
599
|
console.log(chalk.grey('可能原因: 验证码录入耗时过长导致云端会话超时、或网络连接波动。'));
|
|
511
600
|
console.log(chalk.grey('建议: 请检查邮箱验证码是否正确,在主菜单重新进入代登即可。\n'));
|
|
512
601
|
await safePressAnyKey();
|
|
513
|
-
return;
|
|
602
|
+
return null;
|
|
514
603
|
}
|
|
515
604
|
console.log(chalk.green.bold('\n🎉 纯净代登成功!官方凭据已安全捕获!'));
|
|
516
605
|
const parsedToken = TokenParser.parse(finishedToken);
|
|
@@ -542,6 +631,9 @@ export class PureLoginService {
|
|
|
542
631
|
].join('\n'), { padding: { top: 0, bottom: 0, left: 1, right: 1 }, borderColor: 'green', borderStyle: 'round' }));
|
|
543
632
|
console.log(chalk.bold.white('\n📋 官方完整 Token (点击或拖选即可复制):'));
|
|
544
633
|
console.log(chalk.cyan(finishedToken) + '\n');
|
|
634
|
+
if (options.skipSwitchPrompt) {
|
|
635
|
+
return newAccount;
|
|
636
|
+
}
|
|
545
637
|
// 询问是否立即切换
|
|
546
638
|
const doSwitch = await safeConfirm({
|
|
547
639
|
message: `是否立即切换到该账号 (${newAccount.email}) 并激活专属指纹?`,
|
|
@@ -577,5 +669,6 @@ export class PureLoginService {
|
|
|
577
669
|
}
|
|
578
670
|
}
|
|
579
671
|
await safePressAnyKey();
|
|
672
|
+
return newAccount;
|
|
580
673
|
}
|
|
581
674
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor 老用户回归特权 (Welcome-Back Offer) 检测与免密直通服务
|
|
3
|
+
* 支持:
|
|
4
|
+
* 1. 携带已有 Token / SessionCookie 进行毫秒级轻量嗅探
|
|
5
|
+
* 2. 只有邮箱与密码时,自动通过纯净住宅专线代登获取新 Token,展示并复制到剪贴板后紧接着检测
|
|
6
|
+
* 3. 命中资格后,调用独立 Chromium 原生 CDP 注入 Cookie,免串号直达激活与结账页
|
|
7
|
+
*/
|
|
8
|
+
import type { AccountStore } from './account-store.js';
|
|
9
|
+
import type { StorageBridge } from './storage-bridge.js';
|
|
10
|
+
import type { SqliteBridge } from './sqlite-bridge.js';
|
|
11
|
+
export interface WelcomeOfferResult {
|
|
12
|
+
status: 'ELIGIBLE' | 'NOT_ELIGIBLE' | 'EXPIRED_TOKEN' | 'ERROR';
|
|
13
|
+
canActivate?: boolean;
|
|
14
|
+
redemptionFlow?: string;
|
|
15
|
+
previousPlanTier?: string;
|
|
16
|
+
incentiveTreatment?: string;
|
|
17
|
+
headlineDiscount?: string;
|
|
18
|
+
discountedPrice?: string;
|
|
19
|
+
originalPrice?: string;
|
|
20
|
+
pricePeriodLabel?: string;
|
|
21
|
+
rolloverSentence?: string;
|
|
22
|
+
footnote?: string;
|
|
23
|
+
agentRuns?: number;
|
|
24
|
+
linesOfCodeWritten?: number;
|
|
25
|
+
message?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare class WelcomeOfferService {
|
|
28
|
+
/**
|
|
29
|
+
* 携带 SessionToken 静默嗅探 Cursor 官方回归资格接口
|
|
30
|
+
*/
|
|
31
|
+
static checkOffer(sessionToken: string): Promise<WelcomeOfferResult>;
|
|
32
|
+
/**
|
|
33
|
+
* 调起独立隔离浏览器免密直达激活结账页
|
|
34
|
+
*/
|
|
35
|
+
static openOfferPage(token: string, email?: string): Promise<boolean>;
|
|
36
|
+
/**
|
|
37
|
+
* 交互式运行回归资格检测主流程 (终端 TUI)
|
|
38
|
+
*/
|
|
39
|
+
static runInteractiveFlow(store: AccountStore, storage: StorageBridge, sqlite: SqliteBridge, executablePath?: string, initialIdentifier?: string): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* 执行纯净代登流程并衔接资格检测
|
|
42
|
+
*/
|
|
43
|
+
private static handlePureLoginFlow;
|
|
44
|
+
/**
|
|
45
|
+
* 统一处理资格判定结果与后续交互
|
|
46
|
+
*/
|
|
47
|
+
private static handleOfferResult;
|
|
48
|
+
/**
|
|
49
|
+
* 极速切换本机 Cursor IDE 为此账号
|
|
50
|
+
*/
|
|
51
|
+
private static switchCurrentIde;
|
|
52
|
+
}
|