feat(providers): Cursor PKCE login with Bearer quota, auto router, and empty-turn errors (#9909)

5 — Cursor PKCE login com Bearer quota, auto router e empty-turn errors. Feature completa e testada (11 arquivos de teste, 133 testes focados, todos verdes).

**Validação (worktree combinado `.claude/worktrees/fix-9909`, board sobre `origin/release/v3.8.50`):**
- 3 conflitos reais resolvidos: `config/quality/eslint-suppressions.json` (aditivo), `open-sse/config/providers/registry/cursor/index.ts` (dedup de 208 entradas de catálogo, 0 IDs duplicados verificado), `open-sse/executors/cursor.ts` (imports aditivos).
- `npm run typecheck:core`: limpo.
- `check-changelog-integrity`, `check-file-size`, `check-complexity` (2615/2774), `check-cognitive-complexity` (1175/1223), `check-dead-code` (410/416): todos OK.
- `check-public-creds`: 1 entrada obsoleta pré-existente na allowlist (`copilot-m365-web.ts:330`), já presente no tip da release — não é desta PR.
- `npm run lint`: 0 errors (5 warnings pré-existentes).
- Testes focados (`cursor-agent-cli-version`, `cursor-available-models`, `cursor-catalog-combo-compat`, `cursor-errors-classify`, `cursor-login-pkce`, `cursor-model-effort-suffix-7289`, `cursor-streaming`, `cursor-token-extractor`, `cursor-token-refresh-wiring`, `cursor-usage-fetcher`, `empty-stream-no-content-8649`): 133/133 verdes.
- Corrigido durante a validação: 1 teste novo da própria PR (`cursor-model-effort-suffix-7289.test.ts`, "splits effort off legacy grok- ids") colidia com `CURSOR_MODEL_ALIASES` já mesclado na release (mapeia `grok-4.5-high` → `cursor-grok-4.5-high` antes do fallback legado rodar); ajustado para usar um id não-aliasado (`grok-3-high`) que de fato exercita o fallback — commit `68b58ed`.

Obrigado pela contribuição, @yansigit — feature robusta com boa cobertura de testes.
This commit is contained in:
SB Yoon
2026-08-21 07:28:01 -06:00
committed by GitHub
parent 089a5e7cab
commit c130f2aa1c
82 changed files with 4144 additions and 568 deletions

View File

@@ -1,12 +1,11 @@
#!/usr/bin/env node
// Sync the cursor models list in open-sse/config/providerRegistry.ts from
// cursor-agent's runtime model list. Triggers an intentional invalid --model
// invocation so cursor-agent prints "Available models: ..." on stderr.
// Sync the cursor models list in open-sse/config/providers/registry/cursor/index.ts
// from cursor-agent's runtime model list (`--list-models`).
//
// Usage:
// node scripts/ad-hoc/sync-cursor-models.mjs # spawn cursor-agent and apply
// node scripts/ad-hoc/sync-cursor-models.mjs --dry-run # print proposed block, don't write
// node scripts/ad-hoc/sync-cursor-models.mjs --from-stdin # read the error message from stdin
// node scripts/ad-hoc/sync-cursor-models.mjs --from-stdin # read --list-models output from stdin
import { spawnSync } from "node:child_process";
import { readFileSync, writeFileSync } from "node:fs";
@@ -14,7 +13,17 @@ import { fileURLToPath } from "node:url";
import { dirname, resolve } from "node:path";
const __dirname = dirname(fileURLToPath(import.meta.url));
const REGISTRY_PATH = resolve(__dirname, "..", "open-sse", "config", "providerRegistry.ts");
const REGISTRY_PATH = resolve(
__dirname,
"..",
"..",
"open-sse",
"config",
"providers",
"registry",
"cursor",
"index.ts"
);
const args = new Set(process.argv.slice(2));
const DRY_RUN = args.has("--dry-run");