mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-10-09 15:58:34 +00:00
8b2a3d23d4
* feat(ai): support Cursor CLI login for subscription quota Allow the managed Cursor agent to authenticate via local `agent` CLI login as an alternative to CURSOR_API_KEY, so Catty can use subscription Auto quota. Keep API key and CLI login mutually exclusive, isolate resume sessions by auth mode, and expose selectable CLI models with auto as the default. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(ai): harden Cursor CLI login path after review Address multi-agent review findings: soft-cancel abort without late stream errors, prefer cursor-agent over ambiguous agent binaries, mode-aware availability without wiping API keys or sticky-disabling, and concurrent MCP merge refcount restore. Add unit coverage for the new contracts. --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: bincxz <16399091+binaricat@users.noreply.github.com>
32 lines
988 B
JavaScript
32 lines
988 B
JavaScript
/**
|
|
* Electron rejects certain Node CLI flags in NODE_OPTIONS (exit code 9), notably
|
|
* `--openssl-legacy-provider`. Shell profiles sometimes set that for older Node
|
|
* tooling; strip Electron-incompatible tokens so `npm run dev` can start.
|
|
*/
|
|
function sanitizeNodeOptionsForElectron(nodeOptions) {
|
|
if (nodeOptions == null || nodeOptions === "") return undefined;
|
|
const cleaned = String(nodeOptions)
|
|
.split(/\s+/)
|
|
.filter(Boolean)
|
|
.filter((token) => token !== "--openssl-legacy-provider")
|
|
.join(" ")
|
|
.trim();
|
|
return cleaned || undefined;
|
|
}
|
|
|
|
function applyElectronLaunchEnv(baseEnv = process.env) {
|
|
const env = { ...baseEnv };
|
|
delete env.ELECTRON_RUN_AS_NODE;
|
|
|
|
const sanitizedNodeOptions = sanitizeNodeOptionsForElectron(env.NODE_OPTIONS);
|
|
if (sanitizedNodeOptions === undefined) delete env.NODE_OPTIONS;
|
|
else env.NODE_OPTIONS = sanitizedNodeOptions;
|
|
|
|
return env;
|
|
}
|
|
|
|
module.exports = {
|
|
sanitizeNodeOptionsForElectron,
|
|
applyElectronLaunchEnv,
|
|
};
|