@kaitranntt/ccs 7.43.0 → 7.44.0-dev.1
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 +49 -2
- package/config/base-codex.settings.json +4 -4
- package/dist/api/services/profile-reader.d.ts.map +1 -1
- package/dist/api/services/profile-reader.js +4 -1
- package/dist/api/services/profile-reader.js.map +1 -1
- package/dist/auth/profile-detector.d.ts +14 -3
- package/dist/auth/profile-detector.d.ts.map +1 -1
- package/dist/auth/profile-detector.js +35 -15
- package/dist/auth/profile-detector.js.map +1 -1
- package/dist/ccs.js +34 -4
- package/dist/ccs.js.map +1 -1
- package/dist/cliproxy/auth/auth-types.d.ts +28 -1
- package/dist/cliproxy/auth/auth-types.d.ts.map +1 -1
- package/dist/cliproxy/auth/auth-types.js +70 -4
- package/dist/cliproxy/auth/auth-types.js.map +1 -1
- package/dist/cliproxy/auth/oauth-handler.d.ts.map +1 -1
- package/dist/cliproxy/auth/oauth-handler.js +19 -4
- package/dist/cliproxy/auth/oauth-handler.js.map +1 -1
- package/dist/cliproxy/composite-validator.d.ts +20 -0
- package/dist/cliproxy/composite-validator.d.ts.map +1 -0
- package/dist/cliproxy/composite-validator.js +85 -0
- package/dist/cliproxy/composite-validator.js.map +1 -0
- package/dist/cliproxy/config/env-builder.d.ts +24 -0
- package/dist/cliproxy/config/env-builder.d.ts.map +1 -1
- package/dist/cliproxy/config/env-builder.js +72 -1
- package/dist/cliproxy/config/env-builder.js.map +1 -1
- package/dist/cliproxy/config/thinking-config.d.ts +19 -2
- package/dist/cliproxy/config/thinking-config.d.ts.map +1 -1
- package/dist/cliproxy/config/thinking-config.js +127 -27
- package/dist/cliproxy/config/thinking-config.js.map +1 -1
- package/dist/cliproxy/executor/env-resolver.d.ts +16 -0
- package/dist/cliproxy/executor/env-resolver.d.ts.map +1 -1
- package/dist/cliproxy/executor/env-resolver.js +82 -26
- package/dist/cliproxy/executor/env-resolver.js.map +1 -1
- package/dist/cliproxy/executor/index.d.ts.map +1 -1
- package/dist/cliproxy/executor/index.js +202 -67
- package/dist/cliproxy/executor/index.js.map +1 -1
- package/dist/cliproxy/executor/retry-handler.d.ts +11 -0
- package/dist/cliproxy/executor/retry-handler.d.ts.map +1 -1
- package/dist/cliproxy/executor/retry-handler.js +30 -1
- package/dist/cliproxy/executor/retry-handler.js.map +1 -1
- package/dist/cliproxy/executor/thinking-arg-parser.d.ts +27 -0
- package/dist/cliproxy/executor/thinking-arg-parser.d.ts.map +1 -0
- package/dist/cliproxy/executor/thinking-arg-parser.js +80 -0
- package/dist/cliproxy/executor/thinking-arg-parser.js.map +1 -0
- package/dist/cliproxy/model-catalog.d.ts.map +1 -1
- package/dist/cliproxy/model-catalog.js +14 -3
- package/dist/cliproxy/model-catalog.js.map +1 -1
- package/dist/cliproxy/model-config.d.ts.map +1 -1
- package/dist/cliproxy/model-config.js +27 -7
- package/dist/cliproxy/model-config.js.map +1 -1
- package/dist/cliproxy/provider-capabilities.d.ts +22 -0
- package/dist/cliproxy/provider-capabilities.d.ts.map +1 -0
- package/dist/cliproxy/provider-capabilities.js +95 -0
- package/dist/cliproxy/provider-capabilities.js.map +1 -0
- package/dist/cliproxy/quota-fetcher-codex.d.ts.map +1 -1
- package/dist/cliproxy/quota-fetcher-codex.js +106 -87
- package/dist/cliproxy/quota-fetcher-codex.js.map +1 -1
- package/dist/cliproxy/remote-auth-fetcher.d.ts.map +1 -1
- package/dist/cliproxy/remote-auth-fetcher.js +3 -26
- package/dist/cliproxy/remote-auth-fetcher.js.map +1 -1
- package/dist/cliproxy/service-manager.d.ts.map +1 -1
- package/dist/cliproxy/service-manager.js +3 -6
- package/dist/cliproxy/service-manager.js.map +1 -1
- package/dist/cliproxy/services/index.d.ts +2 -2
- package/dist/cliproxy/services/index.d.ts.map +1 -1
- package/dist/cliproxy/services/index.js +4 -1
- package/dist/cliproxy/services/index.js.map +1 -1
- package/dist/cliproxy/services/proxy-lifecycle-service.d.ts +15 -3
- package/dist/cliproxy/services/proxy-lifecycle-service.d.ts.map +1 -1
- package/dist/cliproxy/services/proxy-lifecycle-service.js +15 -6
- package/dist/cliproxy/services/proxy-lifecycle-service.js.map +1 -1
- package/dist/cliproxy/services/variant-config-adapter.d.ts +15 -0
- package/dist/cliproxy/services/variant-config-adapter.d.ts.map +1 -1
- package/dist/cliproxy/services/variant-config-adapter.js +84 -11
- package/dist/cliproxy/services/variant-config-adapter.js.map +1 -1
- package/dist/cliproxy/services/variant-service.d.ts +26 -0
- package/dist/cliproxy/services/variant-service.d.ts.map +1 -1
- package/dist/cliproxy/services/variant-service.js +164 -9
- package/dist/cliproxy/services/variant-service.js.map +1 -1
- package/dist/cliproxy/services/variant-settings.d.ts +19 -1
- package/dist/cliproxy/services/variant-settings.d.ts.map +1 -1
- package/dist/cliproxy/services/variant-settings.js +150 -12
- package/dist/cliproxy/services/variant-settings.js.map +1 -1
- package/dist/cliproxy/types.d.ts +13 -0
- package/dist/cliproxy/types.d.ts.map +1 -1
- package/dist/cliproxy/types.js.map +1 -1
- package/dist/commands/cliproxy/auth-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/auth-subcommand.js +2 -1
- package/dist/commands/cliproxy/auth-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/help-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/help-subcommand.js +4 -0
- package/dist/commands/cliproxy/help-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/index.d.ts.map +1 -1
- package/dist/commands/cliproxy/index.js +12 -0
- package/dist/commands/cliproxy/index.js.map +1 -1
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.d.ts +9 -0
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.js +92 -6
- package/dist/commands/cliproxy/proxy-lifecycle-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/quota-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/quota-subcommand.js +106 -4
- package/dist/commands/cliproxy/quota-subcommand.js.map +1 -1
- package/dist/commands/cliproxy/variant-subcommand.d.ts +1 -0
- package/dist/commands/cliproxy/variant-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/variant-subcommand.js +307 -3
- package/dist/commands/cliproxy/variant-subcommand.js.map +1 -1
- package/dist/commands/command-execution-contract.d.ts +23 -0
- package/dist/commands/command-execution-contract.d.ts.map +1 -0
- package/dist/commands/command-execution-contract.js +21 -0
- package/dist/commands/command-execution-contract.js.map +1 -0
- package/dist/commands/cursor-command-display.d.ts +6 -0
- package/dist/commands/cursor-command-display.d.ts.map +1 -0
- package/dist/commands/cursor-command-display.js +100 -0
- package/dist/commands/cursor-command-display.js.map +1 -0
- package/dist/commands/cursor-command.d.ts +12 -0
- package/dist/commands/cursor-command.d.ts.map +1 -0
- package/dist/commands/cursor-command.js +222 -0
- package/dist/commands/cursor-command.js.map +1 -0
- package/dist/commands/help-command.d.ts.map +1 -1
- package/dist/commands/help-command.js +30 -3
- package/dist/commands/help-command.js.map +1 -1
- package/dist/commands/shell-completion-command.d.ts +20 -0
- package/dist/commands/shell-completion-command.d.ts.map +1 -1
- package/dist/commands/shell-completion-command.js +45 -30
- package/dist/commands/shell-completion-command.js.map +1 -1
- package/dist/config/reserved-names.d.ts +1 -1
- package/dist/config/reserved-names.d.ts.map +1 -1
- package/dist/config/reserved-names.js +2 -0
- package/dist/config/reserved-names.js.map +1 -1
- package/dist/config/unified-config-loader.d.ts +6 -1
- package/dist/config/unified-config-loader.d.ts.map +1 -1
- package/dist/config/unified-config-loader.js +63 -3
- package/dist/config/unified-config-loader.js.map +1 -1
- package/dist/config/unified-config-types.d.ts +79 -2
- package/dist/config/unified-config-types.d.ts.map +1 -1
- package/dist/config/unified-config-types.js +28 -2
- package/dist/config/unified-config-types.js.map +1 -1
- package/dist/cursor/cursor-auth.d.ts +58 -0
- package/dist/cursor/cursor-auth.d.ts.map +1 -0
- package/dist/cursor/cursor-auth.js +295 -0
- package/dist/cursor/cursor-auth.js.map +1 -0
- package/dist/cursor/cursor-daemon-entry.d.ts +14 -0
- package/dist/cursor/cursor-daemon-entry.d.ts.map +1 -0
- package/dist/cursor/cursor-daemon-entry.js +236 -0
- package/dist/cursor/cursor-daemon-entry.js.map +1 -0
- package/dist/cursor/cursor-daemon-pid.d.ts +4 -0
- package/dist/cursor/cursor-daemon-pid.d.ts.map +1 -0
- package/dist/cursor/cursor-daemon-pid.js +77 -0
- package/dist/cursor/cursor-daemon-pid.js.map +1 -0
- package/dist/cursor/cursor-daemon.d.ts +36 -0
- package/dist/cursor/cursor-daemon.d.ts.map +1 -0
- package/dist/cursor/cursor-daemon.js +315 -0
- package/dist/cursor/cursor-daemon.js.map +1 -0
- package/dist/cursor/cursor-executor.d.ts +81 -0
- package/dist/cursor/cursor-executor.d.ts.map +1 -0
- package/dist/cursor/cursor-executor.js +821 -0
- package/dist/cursor/cursor-executor.js.map +1 -0
- package/dist/cursor/cursor-models.d.ts +43 -0
- package/dist/cursor/cursor-models.d.ts.map +1 -0
- package/dist/cursor/cursor-models.js +288 -0
- package/dist/cursor/cursor-models.js.map +1 -0
- package/dist/cursor/cursor-protobuf-decoder.d.ts +52 -0
- package/dist/cursor/cursor-protobuf-decoder.d.ts.map +1 -0
- package/dist/cursor/cursor-protobuf-decoder.js +311 -0
- package/dist/cursor/cursor-protobuf-decoder.js.map +1 -0
- package/dist/cursor/cursor-protobuf-encoder.d.ts +54 -0
- package/dist/cursor/cursor-protobuf-encoder.d.ts.map +1 -0
- package/dist/cursor/cursor-protobuf-encoder.js +173 -0
- package/dist/cursor/cursor-protobuf-encoder.js.map +1 -0
- package/dist/cursor/cursor-protobuf-schema.d.ts +215 -0
- package/dist/cursor/cursor-protobuf-schema.d.ts.map +1 -0
- package/dist/cursor/cursor-protobuf-schema.js +120 -0
- package/dist/cursor/cursor-protobuf-schema.js.map +1 -0
- package/dist/cursor/cursor-protobuf.d.ts +21 -0
- package/dist/cursor/cursor-protobuf.d.ts.map +1 -0
- package/dist/cursor/cursor-protobuf.js +116 -0
- package/dist/cursor/cursor-protobuf.js.map +1 -0
- package/dist/cursor/cursor-stream-parser.d.ts +52 -0
- package/dist/cursor/cursor-stream-parser.d.ts.map +1 -0
- package/dist/cursor/cursor-stream-parser.js +142 -0
- package/dist/cursor/cursor-stream-parser.js.map +1 -0
- package/dist/cursor/cursor-translator.d.ts +39 -0
- package/dist/cursor/cursor-translator.d.ts.map +1 -0
- package/dist/cursor/cursor-translator.js +118 -0
- package/dist/cursor/cursor-translator.js.map +1 -0
- package/dist/cursor/daemon-process-ownership.d.ts +3 -0
- package/dist/cursor/daemon-process-ownership.d.ts.map +1 -0
- package/dist/cursor/daemon-process-ownership.js +96 -0
- package/dist/cursor/daemon-process-ownership.js.map +1 -0
- package/dist/cursor/index.d.ts +11 -0
- package/dist/cursor/index.d.ts.map +1 -0
- package/dist/cursor/index.js +55 -0
- package/dist/cursor/index.js.map +1 -0
- package/dist/cursor/types.d.ts +80 -0
- package/dist/cursor/types.d.ts.map +1 -0
- package/dist/cursor/types.js +8 -0
- package/dist/cursor/types.js.map +1 -0
- package/dist/management/oauth-port-diagnostics.d.ts +4 -7
- package/dist/management/oauth-port-diagnostics.d.ts.map +1 -1
- package/dist/management/oauth-port-diagnostics.js +12 -23
- package/dist/management/oauth-port-diagnostics.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/ui/assets/{accounts-CkN_roEn.js → accounts-Cr5UiSqw.js} +1 -1
- package/dist/ui/assets/{alert-dialog-Dy-8Z_Ud.js → alert-dialog-RKd6P34V.js} +1 -1
- package/dist/ui/assets/api-BjsYBaDO.js +1 -0
- package/dist/ui/assets/auth-section-DJjkM3Pc.js +1 -0
- package/dist/ui/assets/{backups-section-CDuqhiZo.js → backups-section-C3OoH74L.js} +1 -1
- package/dist/ui/assets/cliproxy-bUQ9JQSI.js +3 -0
- package/dist/ui/assets/{cliproxy-control-panel-DJd_zNR3.js → cliproxy-control-panel-bWG4j7j-.js} +1 -1
- package/dist/ui/assets/confirm-dialog-39RkxEsp.js +1 -0
- package/dist/ui/assets/copilot-CT5QKd7M.js +3 -0
- package/dist/ui/assets/cursor-CgHXk53L.js +1 -0
- package/dist/ui/assets/{globalenv-section-Cn5ufgRh.js → globalenv-section-JUD29aAr.js} +1 -1
- package/dist/ui/assets/{health-BsMhSeFz.js → health-P6WZCBRj.js} +1 -1
- package/dist/ui/assets/{icons-D5eAI-GR.js → icons-DGASzt3M.js} +1 -1
- package/dist/ui/assets/{index-CEF_VhSR.js → index-B-T25xBs.js} +1 -1
- package/dist/ui/assets/index-BZe6NG3v.js +1 -0
- package/dist/ui/assets/{index-B2GQ_Joi.js → index-Bikvb5yX.js} +1 -1
- package/dist/ui/assets/index-BteqkOAf.js +47 -0
- package/dist/ui/assets/index-ByiEOnlQ.css +1 -0
- package/dist/ui/assets/index-CIB-ESXC.js +1 -0
- package/dist/ui/assets/{proxy-status-widget-Cb7KfEqq.js → proxy-status-widget-BgJE3cHN.js} +1 -1
- package/dist/ui/assets/separator-yty7hz16.js +1 -0
- package/dist/ui/assets/{shared-BsWeldW8.js → shared-BxLyXLjd.js} +1 -1
- package/dist/ui/assets/sidebar/cursor.svg +1 -0
- package/dist/ui/assets/{switch-D6XSRTo_.js → switch-Dq8eo1UY.js} +1 -1
- package/dist/ui/index.html +3 -3
- package/dist/utils/config-manager.d.ts.map +1 -1
- package/dist/utils/config-manager.js +17 -6
- package/dist/utils/config-manager.js.map +1 -1
- package/dist/web-server/jsonl-parser.js +1 -1
- package/dist/web-server/jsonl-parser.js.map +1 -1
- package/dist/web-server/routes/account-routes.d.ts.map +1 -1
- package/dist/web-server/routes/account-routes.js +5 -11
- package/dist/web-server/routes/account-routes.js.map +1 -1
- package/dist/web-server/routes/cliproxy-auth-routes.d.ts +5 -0
- package/dist/web-server/routes/cliproxy-auth-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-auth-routes.js +73 -6
- package/dist/web-server/routes/cliproxy-auth-routes.js.map +1 -1
- package/dist/web-server/routes/cliproxy-stats-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-stats-routes.js +43 -4
- package/dist/web-server/routes/cliproxy-stats-routes.js.map +1 -1
- package/dist/web-server/routes/cursor-routes.d.ts +16 -0
- package/dist/web-server/routes/cursor-routes.d.ts.map +1 -0
- package/dist/web-server/routes/cursor-routes.js +171 -0
- package/dist/web-server/routes/cursor-routes.js.map +1 -0
- package/dist/web-server/routes/cursor-settings-routes.d.ts +6 -0
- package/dist/web-server/routes/cursor-settings-routes.d.ts.map +1 -0
- package/dist/web-server/routes/cursor-settings-routes.js +305 -0
- package/dist/web-server/routes/cursor-settings-routes.js.map +1 -0
- package/dist/web-server/routes/index.d.ts.map +1 -1
- package/dist/web-server/routes/index.js +3 -0
- package/dist/web-server/routes/index.js.map +1 -1
- package/dist/web-server/routes/variant-routes.d.ts.map +1 -1
- package/dist/web-server/routes/variant-routes.js +107 -6
- package/dist/web-server/routes/variant-routes.js.map +1 -1
- package/package.json +5 -2
- package/scripts/hardening-inventory.js +526 -0
- package/scripts/maintainability-baseline.js +309 -0
- package/dist/ui/assets/api-2TN7yVwm.js +0 -1
- package/dist/ui/assets/auth-section-CeKCNzzC.js +0 -1
- package/dist/ui/assets/cliproxy-626zUpA_.js +0 -3
- package/dist/ui/assets/confirm-dialog-DtYrWaa7.js +0 -1
- package/dist/ui/assets/copilot-DHdywZ9L.js +0 -4
- package/dist/ui/assets/index-Bmgylhgn.js +0 -1
- package/dist/ui/assets/index-Cr6iEc8x.js +0 -47
- package/dist/ui/assets/index-DkMR3J96.js +0 -1
- package/dist/ui/assets/index-QvMpU4Lc.css +0 -1
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Cursor Streaming Frame Parser
|
|
4
|
+
* Incrementally parses ConnectRPC frames from arbitrary chunk boundaries
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
23
|
+
if (mod && mod.__esModule) return mod;
|
|
24
|
+
var result = {};
|
|
25
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
26
|
+
__setModuleDefault(result, mod);
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.StreamingFrameParser = exports.decompressPayload = void 0;
|
|
31
|
+
const zlib = __importStar(require("zlib"));
|
|
32
|
+
const cursor_protobuf_schema_js_1 = require("./cursor-protobuf-schema.js");
|
|
33
|
+
const cursor_protobuf_decoder_js_1 = require("./cursor-protobuf-decoder.js");
|
|
34
|
+
/**
|
|
35
|
+
* Decompress payload if gzip-compressed.
|
|
36
|
+
* Skips decompression for JSON error payloads.
|
|
37
|
+
* NOTE: Uses synchronous gzip for single-request CLI tool. Async not warranted for small payloads.
|
|
38
|
+
*/
|
|
39
|
+
function decompressPayload(payload, flags) {
|
|
40
|
+
if (payload.length > 10 && payload[0] === 0x7b && payload[1] === 0x22) {
|
|
41
|
+
try {
|
|
42
|
+
const text = payload.toString('utf-8');
|
|
43
|
+
if (text.startsWith('{"error"'))
|
|
44
|
+
return payload;
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
// Not JSON, continue
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (flags === cursor_protobuf_schema_js_1.COMPRESS_FLAG.GZIP ||
|
|
51
|
+
flags === cursor_protobuf_schema_js_1.COMPRESS_FLAG.GZIP_ALT ||
|
|
52
|
+
flags === cursor_protobuf_schema_js_1.COMPRESS_FLAG.GZIP_BOTH) {
|
|
53
|
+
try {
|
|
54
|
+
return zlib.gunzipSync(payload);
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
if (process.env.CCS_DEBUG) {
|
|
58
|
+
console.error('[cursor] gzip decompression failed:', err);
|
|
59
|
+
}
|
|
60
|
+
return Buffer.alloc(0);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return payload;
|
|
64
|
+
}
|
|
65
|
+
exports.decompressPayload = decompressPayload;
|
|
66
|
+
/**
|
|
67
|
+
* Incrementally parses ConnectRPC frames from arbitrary chunk boundaries.
|
|
68
|
+
*
|
|
69
|
+
* Usage:
|
|
70
|
+
* const parser = new StreamingFrameParser();
|
|
71
|
+
* req.on('data', (chunk) => {
|
|
72
|
+
* for (const frame of parser.push(chunk)) { handle(frame); }
|
|
73
|
+
* });
|
|
74
|
+
*/
|
|
75
|
+
class StreamingFrameParser {
|
|
76
|
+
constructor() {
|
|
77
|
+
this.buffer = Buffer.alloc(0);
|
|
78
|
+
}
|
|
79
|
+
/** Feed a new chunk. Returns zero or more parsed frames. */
|
|
80
|
+
push(chunk) {
|
|
81
|
+
this.buffer = Buffer.concat([this.buffer, chunk]);
|
|
82
|
+
const results = [];
|
|
83
|
+
while (this.buffer.length >= 5) {
|
|
84
|
+
const length = this.buffer.readUInt32BE(1);
|
|
85
|
+
const frameSize = 5 + length;
|
|
86
|
+
if (this.buffer.length < frameSize)
|
|
87
|
+
break;
|
|
88
|
+
const flags = this.buffer[0];
|
|
89
|
+
let payload = this.buffer.slice(5, frameSize);
|
|
90
|
+
this.buffer = this.buffer.slice(frameSize);
|
|
91
|
+
payload = decompressPayload(payload, flags);
|
|
92
|
+
// Check for JSON error
|
|
93
|
+
try {
|
|
94
|
+
const text = payload.toString('utf-8');
|
|
95
|
+
if (text.startsWith('{') && text.includes('"error"')) {
|
|
96
|
+
const json = JSON.parse(text);
|
|
97
|
+
const msg = json?.error?.details?.[0]?.debug?.details?.title ||
|
|
98
|
+
json?.error?.details?.[0]?.debug?.details?.detail ||
|
|
99
|
+
json?.error?.message ||
|
|
100
|
+
'API Error';
|
|
101
|
+
const isRateLimit = json?.error?.code === 'resource_exhausted';
|
|
102
|
+
results.push({
|
|
103
|
+
type: 'error',
|
|
104
|
+
message: msg,
|
|
105
|
+
status: isRateLimit ? 429 : 400,
|
|
106
|
+
errorType: isRateLimit ? 'rate_limit_error' : 'api_error',
|
|
107
|
+
});
|
|
108
|
+
return results;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
// Not JSON, continue to protobuf parsing
|
|
113
|
+
}
|
|
114
|
+
const result = (0, cursor_protobuf_decoder_js_1.extractTextFromResponse)(new Uint8Array(payload));
|
|
115
|
+
if (result.error) {
|
|
116
|
+
const errorLower = result.error.toLowerCase();
|
|
117
|
+
const isRateLimit = errorLower.includes('rate limit') ||
|
|
118
|
+
errorLower.includes('resource_exhausted') ||
|
|
119
|
+
errorLower.includes('too many requests');
|
|
120
|
+
results.push({
|
|
121
|
+
type: 'error',
|
|
122
|
+
message: result.error,
|
|
123
|
+
status: isRateLimit ? 429 : 400,
|
|
124
|
+
errorType: isRateLimit ? 'rate_limit_error' : 'server_error',
|
|
125
|
+
});
|
|
126
|
+
return results;
|
|
127
|
+
}
|
|
128
|
+
if (result.toolCall)
|
|
129
|
+
results.push({ type: 'toolCall', toolCall: result.toolCall });
|
|
130
|
+
if (result.text)
|
|
131
|
+
results.push({ type: 'text', text: result.text });
|
|
132
|
+
if (result.thinking)
|
|
133
|
+
results.push({ type: 'thinking', text: result.thinking });
|
|
134
|
+
}
|
|
135
|
+
return results;
|
|
136
|
+
}
|
|
137
|
+
hasPartial() {
|
|
138
|
+
return this.buffer.length > 0;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
exports.StreamingFrameParser = StreamingFrameParser;
|
|
142
|
+
//# sourceMappingURL=cursor-stream-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-stream-parser.js","sourceRoot":"","sources":["../../src/cursor/cursor-stream-parser.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2CAA6B;AAC7B,2EAA4D;AAC5D,6EAAuE;AAiBvE;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,OAAe,EAAE,KAAa;IAC9D,IAAI,OAAO,CAAC,MAAM,GAAG,EAAE,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,OAAO,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACtE,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YACvC,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC;gBAAE,OAAO,OAAO,CAAC;QAClD,CAAC;QAAC,MAAM,CAAC;YACP,qBAAqB;QACvB,CAAC;IACH,CAAC;IAED,IACE,KAAK,KAAK,yCAAa,CAAC,IAAI;QAC5B,KAAK,KAAK,yCAAa,CAAC,QAAQ;QAChC,KAAK,KAAK,yCAAa,CAAC,SAAS,EACjC,CAAC;QACD,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAClC,CAAC;QAAC,OAAO,GAAG,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AC;gBAC3C,OAAO,CAAC,IAAI,CAAC;oBACX,IAAI,EAAE,OAAO;oBACb,OAAO,EAAE,MAAM,CAAC,KAAK;oBACrB,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG;oBAC/B,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,cAAc;iBAC7D,CAAC,CAAC;gBACH,OAAO,OAAO,CAAC;YACjB,CAAC;YAED,IAAI,MAAM,CAAC,QAAQ;gBAAE,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;YACnF,IAAI,MAAM,CAAC,IAAI;gBAAE,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;YACnE,IAAI,MAAM,CAAC,QAAQ;gBAAE,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QACjF,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IAChC,CAAC;CACF;AAtED,oDAsEC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAI to Cursor Request Translator
|
|
3
|
+
* Converts OpenAI messages to Cursor format
|
|
4
|
+
*/
|
|
5
|
+
import type { CursorMessage, CursorTool } from './cursor-protobuf-schema.js';
|
|
6
|
+
/** OpenAI message format */
|
|
7
|
+
interface OpenAIMessage {
|
|
8
|
+
role: string;
|
|
9
|
+
content: string | Array<{
|
|
10
|
+
type: string;
|
|
11
|
+
text?: string;
|
|
12
|
+
}>;
|
|
13
|
+
name?: string;
|
|
14
|
+
tool_call_id?: string;
|
|
15
|
+
tool_calls?: Array<{
|
|
16
|
+
id: string;
|
|
17
|
+
type: string;
|
|
18
|
+
function: {
|
|
19
|
+
name: string;
|
|
20
|
+
arguments: string;
|
|
21
|
+
};
|
|
22
|
+
}>;
|
|
23
|
+
}
|
|
24
|
+
/** OpenAI request body */
|
|
25
|
+
interface OpenAIRequestBody {
|
|
26
|
+
messages: OpenAIMessage[];
|
|
27
|
+
tools?: CursorTool[];
|
|
28
|
+
reasoning_effort?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Transform OpenAI request to Cursor format
|
|
32
|
+
* Returns modified body with converted messages
|
|
33
|
+
*/
|
|
34
|
+
export declare function buildCursorRequest(_model: string, body: OpenAIRequestBody, _stream: boolean, _credentials: unknown): {
|
|
35
|
+
messages: CursorMessage[];
|
|
36
|
+
tools?: CursorTool[];
|
|
37
|
+
};
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=cursor-translator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-translator.d.ts","sourceRoot":"","sources":["../../src/cursor/cursor-translator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAoB,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAE/F,4BAA4B;AAC5B,UAAU,aAAa;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACzD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,KAAK,CAAC;QACjB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,SAAS,EAAE,MAAM,CAAA;SAAE,CAAC;KAC/C,CAAC,CAAC;CACJ;AAED,0BAA0B;AAC1B,UAAU,iBAAiB;IACzB,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AA8GD;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,iBAAiB,EACvB,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,OAAO,GACpB;IACD,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;CACtB,CAOA"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* OpenAI to Cursor Request Translator
|
|
4
|
+
* Converts OpenAI messages to Cursor format
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.buildCursorRequest = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* Convert OpenAI messages to Cursor format with native tool_results support
|
|
10
|
+
* - system → user with [System Instructions] prefix
|
|
11
|
+
* - tool → accumulate into tool_results array for next user/assistant message
|
|
12
|
+
* - assistant with tool_calls → keep tool_calls structure (Cursor supports it natively)
|
|
13
|
+
*/
|
|
14
|
+
function convertMessages(messages) {
|
|
15
|
+
const result = [];
|
|
16
|
+
let pendingToolResults = [];
|
|
17
|
+
for (let i = 0; i < messages.length; i++) {
|
|
18
|
+
const msg = messages[i];
|
|
19
|
+
if (msg.role === 'system') {
|
|
20
|
+
let content = '';
|
|
21
|
+
if (typeof msg.content === 'string') {
|
|
22
|
+
content = msg.content;
|
|
23
|
+
}
|
|
24
|
+
else if (Array.isArray(msg.content)) {
|
|
25
|
+
for (const part of msg.content) {
|
|
26
|
+
if (part.type === 'text' && part.text)
|
|
27
|
+
content += part.text;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
result.push({
|
|
31
|
+
role: 'user',
|
|
32
|
+
content: `[System Instructions]\n${content}`,
|
|
33
|
+
});
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
if (msg.role === 'tool') {
|
|
37
|
+
let toolContent = '';
|
|
38
|
+
if (typeof msg.content === 'string') {
|
|
39
|
+
toolContent = msg.content;
|
|
40
|
+
}
|
|
41
|
+
else if (Array.isArray(msg.content)) {
|
|
42
|
+
for (const part of msg.content) {
|
|
43
|
+
if (part.type === 'text' && part.text) {
|
|
44
|
+
toolContent += part.text;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const toolName = msg.name || 'tool';
|
|
49
|
+
const toolCallId = msg.tool_call_id || '';
|
|
50
|
+
// Accumulate tool result
|
|
51
|
+
pendingToolResults.push({
|
|
52
|
+
tool_call_id: toolCallId,
|
|
53
|
+
name: toolName,
|
|
54
|
+
index: pendingToolResults.length,
|
|
55
|
+
raw_args: toolContent,
|
|
56
|
+
});
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if (msg.role === 'user' || msg.role === 'assistant') {
|
|
60
|
+
let content = '';
|
|
61
|
+
if (typeof msg.content === 'string') {
|
|
62
|
+
content = msg.content;
|
|
63
|
+
}
|
|
64
|
+
else if (Array.isArray(msg.content)) {
|
|
65
|
+
for (const part of msg.content) {
|
|
66
|
+
if (part.type === 'text' && part.text) {
|
|
67
|
+
content += part.text;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// Keep tool_calls structure for assistant messages
|
|
72
|
+
if (msg.role === 'assistant' && msg.tool_calls && msg.tool_calls.length > 0) {
|
|
73
|
+
const assistantMsg = { role: 'assistant', content: '' };
|
|
74
|
+
if (content) {
|
|
75
|
+
assistantMsg.content = content;
|
|
76
|
+
}
|
|
77
|
+
assistantMsg.tool_calls = msg.tool_calls;
|
|
78
|
+
// Attach pending tool results to assistant message with tool_calls
|
|
79
|
+
if (pendingToolResults.length > 0) {
|
|
80
|
+
assistantMsg.tool_results = pendingToolResults;
|
|
81
|
+
pendingToolResults = [];
|
|
82
|
+
}
|
|
83
|
+
result.push(assistantMsg);
|
|
84
|
+
}
|
|
85
|
+
else if (content || pendingToolResults.length > 0) {
|
|
86
|
+
const msgObj = {
|
|
87
|
+
role: msg.role,
|
|
88
|
+
content: content || '',
|
|
89
|
+
};
|
|
90
|
+
// Attach pending tool results to this message
|
|
91
|
+
if (pendingToolResults.length > 0) {
|
|
92
|
+
msgObj.tool_results = pendingToolResults;
|
|
93
|
+
pendingToolResults = [];
|
|
94
|
+
}
|
|
95
|
+
result.push(msgObj);
|
|
96
|
+
}
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
// Unknown role - skip with debug warning
|
|
100
|
+
if (process.env.CCS_DEBUG) {
|
|
101
|
+
console.error(`[cursor] Unknown message role: ${msg.role}, skipping`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return result;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Transform OpenAI request to Cursor format
|
|
108
|
+
* Returns modified body with converted messages
|
|
109
|
+
*/
|
|
110
|
+
function buildCursorRequest(_model, body, _stream, _credentials) {
|
|
111
|
+
const messages = convertMessages(body.messages || []);
|
|
112
|
+
return {
|
|
113
|
+
...body,
|
|
114
|
+
messages,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
exports.buildCursorRequest = buildCursorRequest;
|
|
118
|
+
//# sourceMappingURL=cursor-translator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-translator.js","sourceRoot":"","sources":["../../src/cursor/cursor-translator.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAwBH;;;;;GAKG;AACH,SAAS,eAAe,CAAC,QAAyB;IAChD,MAAM,MAAM,GAAoB,EAAE,CAAC;IACnC,IAAI,kBAAkB,GAAuB,EAAE,CAAC;IAEh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ources":["../../src/cursor/daemon-process-ownership.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,WAAW,GAAG,aAAa,GAAG,SAAS,CAAC;AAmDtF,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,qBAAqB,CAoBxE"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.verifyDaemonOwnership = void 0;
|
|
27
|
+
const child_process_1 = require("child_process");
|
|
28
|
+
const fs = __importStar(require("fs"));
|
|
29
|
+
function getProcessCommandLine(pid) {
|
|
30
|
+
if (process.platform === 'linux') {
|
|
31
|
+
try {
|
|
32
|
+
// /proc cmdline uses null separators between arguments.
|
|
33
|
+
return fs.readFileSync(`/proc/${pid}/cmdline`, 'utf8').replace(/\0/g, ' ').trim();
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (process.platform === 'darwin') {
|
|
40
|
+
try {
|
|
41
|
+
const result = (0, child_process_1.spawnSync)('ps', ['-p', String(pid), '-o', 'command='], {
|
|
42
|
+
encoding: 'utf8',
|
|
43
|
+
});
|
|
44
|
+
if (result.error || result.status !== 0) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
return result.stdout.trim();
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (process.platform === 'win32') {
|
|
54
|
+
const command = `(Get-CimInstance Win32_Process -Filter "ProcessId = ${pid}" | Select-Object -ExpandProperty CommandLine)`;
|
|
55
|
+
const shells = ['powershell.exe', 'powershell', 'pwsh.exe', 'pwsh'];
|
|
56
|
+
for (const shell of shells) {
|
|
57
|
+
try {
|
|
58
|
+
const result = (0, child_process_1.spawnSync)(shell, ['-NoProfile', '-Command', command], {
|
|
59
|
+
encoding: 'utf8',
|
|
60
|
+
});
|
|
61
|
+
if (result.error) {
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
if (result.status !== 0) {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
return result.stdout.trim();
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
// Try next shell candidate
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
function verifyDaemonOwnership(pid) {
|
|
78
|
+
try {
|
|
79
|
+
process.kill(pid, 0);
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
const error = err;
|
|
83
|
+
if (error.code === 'ESRCH') {
|
|
84
|
+
return 'not-running';
|
|
85
|
+
}
|
|
86
|
+
return 'unknown';
|
|
87
|
+
}
|
|
88
|
+
const commandLine = getProcessCommandLine(pid);
|
|
89
|
+
if (!commandLine) {
|
|
90
|
+
return 'unknown';
|
|
91
|
+
}
|
|
92
|
+
const looksLikeCursorDaemon = commandLine.includes('--ccs-daemon') && commandLine.includes('cursor-daemon-entry');
|
|
93
|
+
return looksLikeCursorDaemon ? 'owned' : 'not-owned';
|
|
94
|
+
}
|
|
95
|
+
exports.verifyDaemonOwnership = verifyDaemonOwnership;
|
|
96
|
+
//# sourceMappingURL=daemon-process-ownership.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daemon-process-ownership.js","sourceRoot":"","sources":["../../src/cursor/daemon-process-ownership.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAA0C;AAC1C,uCAAyB;AAIzB,SAAS,qBAAqB,CAAC,GAAW;IACxC,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,IAAI,CAAC;YACH,wDAAwD;YACxD,OAAO,EAAE,CAAC,YAAY,CAAC,SAAS,GAAG,UAAU,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;QACpF,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAClC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAA,yBAAS,EAAC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,UAAU,CAAC,EAAE;gBACpE,QAAQ,EAAE,MAAM;aACjB,CAAC,CAAC;YACH,IAAI,MAAM,CAAC,KAAK,IA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Aa,CAAC;QACvB,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,WAAW,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAC/C,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,qBAAqB,GACzB,WAAW,CAAC,QAAQ,CAAC,cAAc,CAAC,IAAI,WAAW,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC;IAEtF,OAAO,qBAAqB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC;AACvD,CAAC;AApBD,sDAoBC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor Module Index
|
|
3
|
+
*
|
|
4
|
+
* Central exports for Cursor IDE integration.
|
|
5
|
+
*/
|
|
6
|
+
export * from './types';
|
|
7
|
+
export { autoDetectTokens, validateToken, saveCredentials, loadCredentials, deleteCredentials, checkAuthStatus, } from './cursor-auth';
|
|
8
|
+
export { isDaemonRunning, getDaemonStatus, startDaemon, stopDaemon, getPidFromFile, writePidToFile, removePidFile, } from './cursor-daemon';
|
|
9
|
+
export { DEFAULT_CURSOR_MODELS, DEFAULT_CURSOR_PORT, DEFAULT_CURSOR_MODEL, fetchModelsFromDaemon, getAvailableModels, getDefaultModel, detectProvider, formatModelName, } from './cursor-models';
|
|
10
|
+
export { CursorExecutor } from './cursor-executor';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cursor/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,cAAc,SAAS,CAAC;AAGxB,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,eAAe,GAChB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,eAAe,EACf,eAAe,EACf,WAAW,EACX,UAAU,EACV,cAAc,EACd,cAAc,EACd,aAAa,GACd,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,eAAe,GAChB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Cursor Module Index
|
|
4
|
+
*
|
|
5
|
+
* Central exports for Cursor IDE integration.
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.CursorExecutor = exports.formatModelName = exports.detectProvider = exports.getDefaultModel = exports.getAvailableModels = exports.fetchModelsFromDaemon = exports.DEFAULT_CURSOR_MODEL = exports.DEFAULT_CURSOR_PORT = exports.DEFAULT_CURSOR_MODELS = exports.removePidFile = exports.writePidToFile = exports.getPidFromFile = exports.stopDaemon = exports.startDaemon = exports.getDaemonStatus = exports.isDaemonRunning = exports.checkAuthStatus = exports.deleteCredentials = exports.loadCredentials = exports.saveCredentials = exports.validateToken = exports.autoDetectTokens = void 0;
|
|
23
|
+
// Types
|
|
24
|
+
__exportStar(require("./types"), exports);
|
|
25
|
+
// Auth
|
|
26
|
+
var cursor_auth_1 = require("./cursor-auth");
|
|
27
|
+
Object.defineProperty(exports, "autoDetectTokens", { enumerable: true, get: function () { return cursor_auth_1.autoDetectTokens; } });
|
|
28
|
+
Object.defineProperty(exports, "validateToken", { enumerable: true, get: function () { return cursor_auth_1.validateToken; } });
|
|
29
|
+
Object.defineProperty(exports, "saveCredentials", { enumerable: true, get: function () { return cursor_auth_1.saveCredentials; } });
|
|
30
|
+
Object.defineProperty(exports, "loadCredentials", { enumerable: true, get: function () { return cursor_auth_1.loadCredentials; } });
|
|
31
|
+
Object.defineProperty(exports, "deleteCredentials", { enumerable: true, get: function () { return cursor_auth_1.deleteCredentials; } });
|
|
32
|
+
Object.defineProperty(exports, "checkAuthStatus", { enumerable: true, get: function () { return cursor_auth_1.checkAuthStatus; } });
|
|
33
|
+
// Daemon
|
|
34
|
+
var cursor_daemon_1 = require("./cursor-daemon");
|
|
35
|
+
Object.defineProperty(exports, "isDaemonRunning", { enumerable: true, get: function () { return cursor_daemon_1.isDaemonRunning; } });
|
|
36
|
+
Object.defineProperty(exports, "getDaemonStatus", { enumerable: true, get: function () { return cursor_daemon_1.getDaemonStatus; } });
|
|
37
|
+
Object.defineProperty(exports, "startDaemon", { enumerable: true, get: function () { return cursor_daemon_1.startDaemon; } });
|
|
38
|
+
Object.defineProperty(exports, "stopDaemon", { enumerable: true, get: function () { return cursor_daemon_1.stopDaemon; } });
|
|
39
|
+
Object.defineProperty(exports, "getPidFromFile", { enumerable: true, get: function () { return cursor_daemon_1.getPidFromFile; } });
|
|
40
|
+
Object.defineProperty(exports, "writePidToFile", { enumerable: true, get: function () { return cursor_daemon_1.writePidToFile; } });
|
|
41
|
+
Object.defineProperty(exports, "removePidFile", { enumerable: true, get: function () { return cursor_daemon_1.removePidFile; } });
|
|
42
|
+
// Models
|
|
43
|
+
var cursor_models_1 = require("./cursor-models");
|
|
44
|
+
Object.defineProperty(exports, "DEFAULT_CURSOR_MODELS", { enumerable: true, get: function () { return cursor_models_1.DEFAULT_CURSOR_MODELS; } });
|
|
45
|
+
Object.defineProperty(exports, "DEFAULT_CURSOR_PORT", { enumerable: true, get: function () { return cursor_models_1.DEFAULT_CURSOR_PORT; } });
|
|
46
|
+
Object.defineProperty(exports, "DEFAULT_CURSOR_MODEL", { enumerable: true, get: function () { return cursor_models_1.DEFAULT_CURSOR_MODEL; } });
|
|
47
|
+
Object.defineProperty(exports, "fetchModelsFromDaemon", { enumerable: true, get: function () { return cursor_models_1.fetchModelsFromDaemon; } });
|
|
48
|
+
Object.defineProperty(exports, "getAvailableModels", { enumerable: true, get: function () { return cursor_models_1.getAvailableModels; } });
|
|
49
|
+
Object.defineProperty(exports, "getDefaultModel", { enumerable: true, get: function () { return cursor_models_1.getDefaultModel; } });
|
|
50
|
+
Object.defineProperty(exports, "detectProvider", { enumerable: true, get: function () { return cursor_models_1.detectProvider; } });
|
|
51
|
+
Object.defineProperty(exports, "formatModelName", { enumerable: true, get: function () { return cursor_models_1.formatModelName; } });
|
|
52
|
+
// Executor
|
|
53
|
+
var cursor_executor_1 = require("./cursor-executor");
|
|
54
|
+
Object.defineProperty(exports, "CursorExecutor", { enumerable: true, get: function () { return cursor_executor_1.CursorExecutor; } });
|
|
55
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cursor/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;AAEH,QAAQ;AACR,0CAAwB;AAExB,OAAO;AACP,6CAOuB;AANrB,+GAAA,gBAAgB,OAAA;AAChB,4GAAA,aAAa,OAAA;AACb,8GAAA,eAAe,OAAA;AACf,8GAAA,eAAe,OAAA;AACf,gHAAA,iBAAiB,OAAA;AACjB,8GAAA,eAAe,OAAA;AAGjB,SAAS;AACT,iDAQyB;AAPvB,gHAAA,eAAe,OAAA;AACf,gHAAA,eAAe,OAAA;AACf,4GAAA,WAAW,OAAA;AACX,2GAAA,UAAU,OAAA;AACV,+GAAA,cAAc,OAAA;AACd,+GAAA,cAAc,OAAA;AACd,8GAAA,aAAa,OAAA;AAGf,SAAS;AACT,iDASyB;AARvB,sHAAA,qBAAqB,OAAA;AACrB,oHAAA,mBAAmB,OAAA;AACnB,qHAAA,oBAAoB,OAAA;AACpB,sHAAA,qBAAqB,OAAA;AACrB,mHAAA,kBAAkB,OAAA;AAClB,gHAAA,eAAe,OAAA;AACf,+GAAA,cAAc,OAAA;AACd,gHAAA,eAAe,OAAA;AAGjB,WAAW;AACX,qDAAmD;AAA1C,iHAAA,cAAc,OAAA"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor IDE Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* TypeScript interfaces for the Cursor module.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Cursor daemon runtime configuration.
|
|
8
|
+
*/
|
|
9
|
+
export interface CursorDaemonConfig {
|
|
10
|
+
port: number;
|
|
11
|
+
ghost_mode?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Cursor authentication credentials
|
|
15
|
+
*/
|
|
16
|
+
export interface CursorCredentials {
|
|
17
|
+
/** Access token from Cursor IDE */
|
|
18
|
+
accessToken: string;
|
|
19
|
+
/** Machine ID for checksum generation */
|
|
20
|
+
machineId: string;
|
|
21
|
+
/** User email (if available from token) */
|
|
22
|
+
email?: string;
|
|
23
|
+
/** User ID (if available from token) */
|
|
24
|
+
userId?: string;
|
|
25
|
+
/** How credentials were obtained */
|
|
26
|
+
authMethod: 'auto-detect' | 'manual';
|
|
27
|
+
/** ISO datetime when credentials were imported */
|
|
28
|
+
importedAt: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Cursor authentication status
|
|
32
|
+
*/
|
|
33
|
+
export interface CursorAuthStatus {
|
|
34
|
+
/** Whether user is authenticated */
|
|
35
|
+
authenticated: boolean;
|
|
36
|
+
/** Current credentials (if authenticated) */
|
|
37
|
+
credentials?: CursorCredentials;
|
|
38
|
+
/** Hours since credentials were imported (if available) */
|
|
39
|
+
tokenAge?: number;
|
|
40
|
+
/** Whether token has expired (>24 hours old) */
|
|
41
|
+
expired?: boolean;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Auto-detection result
|
|
45
|
+
*/
|
|
46
|
+
export interface AutoDetectResult {
|
|
47
|
+
/** Whether tokens were found */
|
|
48
|
+
found: boolean;
|
|
49
|
+
/** Access token (if found) */
|
|
50
|
+
accessToken?: string;
|
|
51
|
+
/** Machine ID (if found) */
|
|
52
|
+
machineId?: string;
|
|
53
|
+
/** Error message (if detection failed) */
|
|
54
|
+
error?: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Cursor daemon/process status
|
|
58
|
+
*/
|
|
59
|
+
export interface CursorDaemonStatus {
|
|
60
|
+
/** Whether daemon is running */
|
|
61
|
+
running: boolean;
|
|
62
|
+
/** Port number daemon is listening on */
|
|
63
|
+
port: number;
|
|
64
|
+
/** Process ID (if available) */
|
|
65
|
+
pid?: number;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Cursor AI model
|
|
69
|
+
*/
|
|
70
|
+
export interface CursorModel {
|
|
71
|
+
/** Model ID */
|
|
72
|
+
id: string;
|
|
73
|
+
/** Display name */
|
|
74
|
+
name: string;
|
|
75
|
+
/** Provider (e.g., 'openai', 'anthropic') */
|
|
76
|
+
provider: string;
|
|
77
|
+
/** Whether this is the default model */
|
|
78
|
+
isDefault?: boolean;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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;IACf,EAAE,EAAE,MAAM,CAAC;IACX,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,wCAAwC;IACxC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/cursor/types.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
|
|
@@ -9,22 +9,19 @@
|
|
|
9
9
|
* - Codex: 1455
|
|
10
10
|
* - Agy: 51121
|
|
11
11
|
* - iFlow: 11451
|
|
12
|
-
* - Kiro:
|
|
12
|
+
* - Kiro: Device Code Flow (no port needed)
|
|
13
13
|
* - Claude: 54545
|
|
14
14
|
* - Qwen: Device Code Flow (no port needed)
|
|
15
15
|
* - GHCP: Device Code Flow (no port needed)
|
|
16
16
|
*/
|
|
17
17
|
import { PortProcess } from '../utils/port-utils';
|
|
18
18
|
import { CLIProxyProvider } from '../cliproxy/types';
|
|
19
|
-
|
|
20
|
-
* OAuth callback ports for each provider
|
|
21
|
-
* Extracted from CLIProxyAPI source
|
|
22
|
-
*/
|
|
19
|
+
import { type OAuthFlowType as ProviderOAuthFlowType } from '../cliproxy/provider-capabilities';
|
|
23
20
|
export declare const OAUTH_CALLBACK_PORTS: Record<CLIProxyProvider, number | null>;
|
|
24
21
|
/**
|
|
25
22
|
* OAuth flow types
|
|
26
23
|
*/
|
|
27
|
-
export type OAuthFlowType =
|
|
24
|
+
export type OAuthFlowType = ProviderOAuthFlowType;
|
|
28
25
|
/**
|
|
29
26
|
* OAuth flow type per provider
|
|
30
27
|
*/
|
|
@@ -102,7 +99,7 @@ export declare function preflightOAuthCheck(provider: CLIProxyProvider): Promise
|
|
|
102
99
|
export declare function enhancedPreflightOAuthCheck(provider: CLIProxyProvider): Promise<EnhancedPreflightResult>;
|
|
103
100
|
declare const _default: {
|
|
104
101
|
OAUTH_CALLBACK_PORTS: Record<CLIProxyProvider, number | null>;
|
|
105
|
-
OAUTH_FLOW_TYPES: Record<CLIProxyProvider,
|
|
102
|
+
OAUTH_FLOW_TYPES: Record<CLIProxyProvider, ProviderOAuthFlowType>;
|
|
106
103
|
checkOAuthPort: typeof checkOAuthPort;
|
|
107
104
|
checkAllOAuthPorts: typeof checkAllOAuthPorts;
|
|
108
105
|
checkAuthCodePorts: typeof checkAuthCodePorts;
|