@kaitranntt/ccs 7.43.0-dev.1 → 7.43.0-dev.2
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/cursor/cursor-executor.d.ts +74 -0
- package/dist/cursor/cursor-executor.d.ts.map +1 -0
- package/dist/cursor/cursor-executor.js +621 -0
- package/dist/cursor/cursor-executor.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 +168 -0
- package/dist/cursor/cursor-protobuf-schema.d.ts.map +1 -0
- package/dist/cursor/cursor-protobuf-schema.js +130 -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-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/package.json +1 -1
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor Protobuf Schema Constants
|
|
3
|
+
* Field definitions and wire types for ConnectRPC protocol
|
|
4
|
+
*/
|
|
5
|
+
/** Wire types for protobuf encoding */
|
|
6
|
+
export declare const WIRE_TYPE: {
|
|
7
|
+
readonly VARINT: 0;
|
|
8
|
+
readonly FIXED64: 1;
|
|
9
|
+
readonly LEN: 2;
|
|
10
|
+
readonly FIXED32: 5;
|
|
11
|
+
};
|
|
12
|
+
/** Message role constants */
|
|
13
|
+
export declare const ROLE: {
|
|
14
|
+
readonly USER: 1;
|
|
15
|
+
readonly ASSISTANT: 2;
|
|
16
|
+
};
|
|
17
|
+
/** Unified mode constants */
|
|
18
|
+
export declare const UNIFIED_MODE: {
|
|
19
|
+
readonly CHAT: 1;
|
|
20
|
+
readonly AGENT: 2;
|
|
21
|
+
};
|
|
22
|
+
/** Thinking level constants */
|
|
23
|
+
export declare const THINKING_LEVEL: {
|
|
24
|
+
readonly UNSPECIFIED: 0;
|
|
25
|
+
readonly MEDIUM: 1;
|
|
26
|
+
readonly HIGH: 2;
|
|
27
|
+
};
|
|
28
|
+
/** Field numbers for all protobuf messages */
|
|
29
|
+
export declare const FIELD: {
|
|
30
|
+
readonly REQUEST: 1;
|
|
31
|
+
readonly MESSAGES: 1;
|
|
32
|
+
readonly UNKNOWN_2: 2;
|
|
33
|
+
readonly INSTRUCTION: 3;
|
|
34
|
+
readonly UNKNOWN_4: 4;
|
|
35
|
+
readonly MODEL: 5;
|
|
36
|
+
readonly WEB_TOOL: 8;
|
|
37
|
+
readonly UNKNOWN_13: 13;
|
|
38
|
+
readonly CURSOR_SETTING: 15;
|
|
39
|
+
readonly UNKNOWN_19: 19;
|
|
40
|
+
readonly CONVERSATION_ID: 23;
|
|
41
|
+
readonly METADATA: 26;
|
|
42
|
+
readonly IS_AGENTIC: 27;
|
|
43
|
+
readonly SUPPORTED_TOOLS: 29;
|
|
44
|
+
readonly MESSAGE_IDS: 30;
|
|
45
|
+
readonly MCP_TOOLS: 34;
|
|
46
|
+
readonly LARGE_CONTEXT: 35;
|
|
47
|
+
readonly UNKNOWN_38: 38;
|
|
48
|
+
readonly UNIFIED_MODE: 46;
|
|
49
|
+
readonly UNKNOWN_47: 47;
|
|
50
|
+
readonly SHOULD_DISABLE_TOOLS: 48;
|
|
51
|
+
readonly THINKING_LEVEL: 49;
|
|
52
|
+
readonly UNKNOWN_51: 51;
|
|
53
|
+
readonly UNKNOWN_53: 53;
|
|
54
|
+
readonly UNIFIED_MODE_NAME: 54;
|
|
55
|
+
readonly MSG_CONTENT: 1;
|
|
56
|
+
readonly MSG_ROLE: 2;
|
|
57
|
+
readonly MSG_ID: 13;
|
|
58
|
+
readonly MSG_TOOL_RESULTS: 18;
|
|
59
|
+
readonly MSG_IS_AGENTIC: 29;
|
|
60
|
+
readonly MSG_UNIFIED_MODE: 47;
|
|
61
|
+
readonly MSG_SUPPORTED_TOOLS: 51;
|
|
62
|
+
readonly TOOL_RESULT_CALL_ID: 1;
|
|
63
|
+
readonly TOOL_RESULT_NAME: 2;
|
|
64
|
+
readonly TOOL_RESULT_INDEX: 3;
|
|
65
|
+
readonly TOOL_RESULT_RAW_ARGS: 5;
|
|
66
|
+
readonly TOOL_RESULT_RESULT: 8;
|
|
67
|
+
readonly MODEL_NAME: 1;
|
|
68
|
+
readonly MODEL_EMPTY: 4;
|
|
69
|
+
readonly INSTRUCTION_TEXT: 1;
|
|
70
|
+
readonly SETTING_PATH: 1;
|
|
71
|
+
readonly SETTING_UNKNOWN_3: 3;
|
|
72
|
+
readonly SETTING_UNKNOWN_6: 6;
|
|
73
|
+
readonly SETTING_UNKNOWN_8: 8;
|
|
74
|
+
readonly SETTING_UNKNOWN_9: 9;
|
|
75
|
+
readonly SETTING6_FIELD_1: 1;
|
|
76
|
+
readonly SETTING6_FIELD_2: 2;
|
|
77
|
+
readonly META_PLATFORM: 1;
|
|
78
|
+
readonly META_ARCH: 2;
|
|
79
|
+
readonly META_VERSION: 3;
|
|
80
|
+
readonly META_CWD: 4;
|
|
81
|
+
readonly META_TIMESTAMP: 5;
|
|
82
|
+
readonly MSGID_ID: 1;
|
|
83
|
+
readonly MSGID_SUMMARY: 2;
|
|
84
|
+
readonly MSGID_ROLE: 3;
|
|
85
|
+
readonly MCP_TOOL_NAME: 1;
|
|
86
|
+
readonly MCP_TOOL_DESC: 2;
|
|
87
|
+
readonly MCP_TOOL_PARAMS: 3;
|
|
88
|
+
readonly MCP_TOOL_SERVER: 4;
|
|
89
|
+
readonly TOOL_CALL: 1;
|
|
90
|
+
readonly RESPONSE: 2;
|
|
91
|
+
readonly TOOL_ID: 3;
|
|
92
|
+
readonly TOOL_NAME: 9;
|
|
93
|
+
readonly TOOL_RAW_ARGS: 10;
|
|
94
|
+
readonly TOOL_IS_LAST: 11;
|
|
95
|
+
readonly TOOL_MCP_PARAMS: 27;
|
|
96
|
+
readonly MCP_TOOLS_LIST: 1;
|
|
97
|
+
readonly MCP_NESTED_NAME: 1;
|
|
98
|
+
readonly MCP_NESTED_PARAMS: 3;
|
|
99
|
+
readonly RESPONSE_TEXT: 1;
|
|
100
|
+
readonly THINKING: 25;
|
|
101
|
+
readonly THINKING_TEXT: 1;
|
|
102
|
+
};
|
|
103
|
+
/** Type definitions */
|
|
104
|
+
export type WireType = (typeof WIRE_TYPE)[keyof typeof WIRE_TYPE];
|
|
105
|
+
export type RoleType = (typeof ROLE)[keyof typeof ROLE];
|
|
106
|
+
export type UnifiedModeType = (typeof UNIFIED_MODE)[keyof typeof UNIFIED_MODE];
|
|
107
|
+
export type ThinkingLevelType = (typeof THINKING_LEVEL)[keyof typeof THINKING_LEVEL];
|
|
108
|
+
export type FieldNumber = (typeof FIELD)[keyof typeof FIELD];
|
|
109
|
+
/** Cursor credentials structure */
|
|
110
|
+
export interface CursorCredentials {
|
|
111
|
+
accessToken: string;
|
|
112
|
+
machineId: string;
|
|
113
|
+
ghostMode?: boolean;
|
|
114
|
+
}
|
|
115
|
+
/** Cursor tool definition */
|
|
116
|
+
export interface CursorTool {
|
|
117
|
+
function?: {
|
|
118
|
+
name?: string;
|
|
119
|
+
description?: string;
|
|
120
|
+
parameters?: Record<string, unknown>;
|
|
121
|
+
};
|
|
122
|
+
name?: string;
|
|
123
|
+
description?: string;
|
|
124
|
+
input_schema?: Record<string, unknown>;
|
|
125
|
+
}
|
|
126
|
+
/** Cursor tool result */
|
|
127
|
+
export interface CursorToolResult {
|
|
128
|
+
tool_call_id?: string;
|
|
129
|
+
name?: string;
|
|
130
|
+
index?: number;
|
|
131
|
+
raw_args?: string;
|
|
132
|
+
}
|
|
133
|
+
/** Cursor message format */
|
|
134
|
+
export interface CursorMessage {
|
|
135
|
+
role: string;
|
|
136
|
+
content: string;
|
|
137
|
+
tool_results?: CursorToolResult[];
|
|
138
|
+
tool_calls?: Array<{
|
|
139
|
+
id: string;
|
|
140
|
+
type: string;
|
|
141
|
+
function: {
|
|
142
|
+
name: string;
|
|
143
|
+
arguments: string;
|
|
144
|
+
};
|
|
145
|
+
}>;
|
|
146
|
+
}
|
|
147
|
+
/** Formatted message for encoding */
|
|
148
|
+
export interface FormattedMessage {
|
|
149
|
+
content: string;
|
|
150
|
+
role: RoleType;
|
|
151
|
+
messageId: string;
|
|
152
|
+
isLast: boolean;
|
|
153
|
+
hasTools: boolean;
|
|
154
|
+
toolResults: CursorToolResult[];
|
|
155
|
+
}
|
|
156
|
+
/** Message ID structure */
|
|
157
|
+
export interface MessageId {
|
|
158
|
+
messageId: string;
|
|
159
|
+
role: RoleType;
|
|
160
|
+
}
|
|
161
|
+
/** Compression flags for ConnectRPC frames */
|
|
162
|
+
export declare const COMPRESS_FLAG: {
|
|
163
|
+
readonly NONE: 0;
|
|
164
|
+
readonly GZIP: 1;
|
|
165
|
+
readonly GZIP_ALT: 2;
|
|
166
|
+
readonly GZIP_BOTH: 3;
|
|
167
|
+
};
|
|
168
|
+
//# sourceMappingURL=cursor-protobuf-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-protobuf-schema.d.ts","sourceRoot":"","sources":["../../src/cursor/cursor-protobuf-schema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,uCAAuC;AACvC,eAAO,MAAM,SAAS;;;;;CAKZ,CAAC;AAEX,6BAA6B;AAC7B,eAAO,MAAM,IAAI;;;CAGP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yBAAyB;AACzB,MAAM,WAAW,gBAAgB;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,4BAA4B;AAC5B,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAClC,UAAU,CAAC,EAAE,KAAK,CAAC;QACjB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE;YACR,IAAI,EAAE,MAAM,CAAC;YACb,SAAS,EAAE,MAAM,CAAC;SACnB,CAAC;KACH,CAAC,CAAC;CACJ;AAED,qCAAqC;AACrC,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,gBAAgB,EAAE,CAAC;CACjC;AAED,2BAA2B;AAC3B,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED,8CAA8C;AAC9C,eAAO,MAAM,aAAa;;;;;CAKhB,CAAC"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Cursor Protobuf Schema Constants
|
|
4
|
+
* Field definitions and wire types for ConnectRPC protocol
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.COMPRESS_FLAG = exports.FIELD = exports.THINKING_LEVEL = exports.UNIFIED_MODE = exports.ROLE = exports.WIRE_TYPE = void 0;
|
|
8
|
+
/** Wire types for protobuf encoding */
|
|
9
|
+
exports.WIRE_TYPE = {
|
|
10
|
+
VARINT: 0,
|
|
11
|
+
FIXED64: 1,
|
|
12
|
+
LEN: 2,
|
|
13
|
+
FIXED32: 5,
|
|
14
|
+
};
|
|
15
|
+
/** Message role constants */
|
|
16
|
+
exports.ROLE = {
|
|
17
|
+
USER: 1,
|
|
18
|
+
ASSISTANT: 2,
|
|
19
|
+
};
|
|
20
|
+
/** Unified mode constants */
|
|
21
|
+
exports.UNIFIED_MODE = {
|
|
22
|
+
CHAT: 1,
|
|
23
|
+
AGENT: 2,
|
|
24
|
+
};
|
|
25
|
+
/** Thinking level constants */
|
|
26
|
+
exports.THINKING_LEVEL = {
|
|
27
|
+
UNSPECIFIED: 0,
|
|
28
|
+
MEDIUM: 1,
|
|
29
|
+
HIGH: 2,
|
|
30
|
+
};
|
|
31
|
+
/** Field numbers for all protobuf messages */
|
|
32
|
+
exports.FIELD = {
|
|
33
|
+
// ===== StreamUnifiedChatRequestWithTools (top level) =====
|
|
34
|
+
REQUEST: 1,
|
|
35
|
+
// ===== StreamUnifiedChatRequest =====
|
|
36
|
+
MESSAGES: 1,
|
|
37
|
+
UNKNOWN_2: 2,
|
|
38
|
+
INSTRUCTION: 3,
|
|
39
|
+
UNKNOWN_4: 4,
|
|
40
|
+
MODEL: 5,
|
|
41
|
+
WEB_TOOL: 8,
|
|
42
|
+
UNKNOWN_13: 13,
|
|
43
|
+
CURSOR_SETTING: 15,
|
|
44
|
+
UNKNOWN_19: 19,
|
|
45
|
+
CONVERSATION_ID: 23,
|
|
46
|
+
METADATA: 26,
|
|
47
|
+
IS_AGENTIC: 27,
|
|
48
|
+
SUPPORTED_TOOLS: 29,
|
|
49
|
+
MESSAGE_IDS: 30,
|
|
50
|
+
MCP_TOOLS: 34,
|
|
51
|
+
LARGE_CONTEXT: 35,
|
|
52
|
+
UNKNOWN_38: 38,
|
|
53
|
+
UNIFIED_MODE: 46,
|
|
54
|
+
UNKNOWN_47: 47,
|
|
55
|
+
SHOULD_DISABLE_TOOLS: 48,
|
|
56
|
+
THINKING_LEVEL: 49,
|
|
57
|
+
UNKNOWN_51: 51,
|
|
58
|
+
UNKNOWN_53: 53,
|
|
59
|
+
UNIFIED_MODE_NAME: 54,
|
|
60
|
+
// ===== ConversationMessage =====
|
|
61
|
+
MSG_CONTENT: 1,
|
|
62
|
+
MSG_ROLE: 2,
|
|
63
|
+
MSG_ID: 13,
|
|
64
|
+
MSG_TOOL_RESULTS: 18,
|
|
65
|
+
MSG_IS_AGENTIC: 29,
|
|
66
|
+
MSG_UNIFIED_MODE: 47,
|
|
67
|
+
MSG_SUPPORTED_TOOLS: 51,
|
|
68
|
+
// ===== ConversationMessage.ToolResult =====
|
|
69
|
+
TOOL_RESULT_CALL_ID: 1,
|
|
70
|
+
TOOL_RESULT_NAME: 2,
|
|
71
|
+
TOOL_RESULT_INDEX: 3,
|
|
72
|
+
TOOL_RESULT_RAW_ARGS: 5,
|
|
73
|
+
TOOL_RESULT_RESULT: 8, // Reserved for future tool result parsing
|
|
74
|
+
// ===== Model =====
|
|
75
|
+
MODEL_NAME: 1,
|
|
76
|
+
MODEL_EMPTY: 4,
|
|
77
|
+
// ===== Instruction =====
|
|
78
|
+
INSTRUCTION_TEXT: 1,
|
|
79
|
+
// ===== CursorSetting =====
|
|
80
|
+
SETTING_PATH: 1,
|
|
81
|
+
SETTING_UNKNOWN_3: 3,
|
|
82
|
+
SETTING_UNKNOWN_6: 6,
|
|
83
|
+
SETTING_UNKNOWN_8: 8,
|
|
84
|
+
SETTING_UNKNOWN_9: 9,
|
|
85
|
+
// ===== CursorSetting.Unknown6 =====
|
|
86
|
+
SETTING6_FIELD_1: 1,
|
|
87
|
+
SETTING6_FIELD_2: 2,
|
|
88
|
+
// ===== Metadata =====
|
|
89
|
+
META_PLATFORM: 1,
|
|
90
|
+
META_ARCH: 2,
|
|
91
|
+
META_VERSION: 3,
|
|
92
|
+
META_CWD: 4,
|
|
93
|
+
META_TIMESTAMP: 5,
|
|
94
|
+
// ===== MessageId =====
|
|
95
|
+
MSGID_ID: 1,
|
|
96
|
+
MSGID_SUMMARY: 2,
|
|
97
|
+
MSGID_ROLE: 3,
|
|
98
|
+
// ===== MCPTool =====
|
|
99
|
+
MCP_TOOL_NAME: 1,
|
|
100
|
+
MCP_TOOL_DESC: 2,
|
|
101
|
+
MCP_TOOL_PARAMS: 3,
|
|
102
|
+
MCP_TOOL_SERVER: 4,
|
|
103
|
+
// ===== StreamUnifiedChatResponseWithTools (response) =====
|
|
104
|
+
TOOL_CALL: 1,
|
|
105
|
+
RESPONSE: 2,
|
|
106
|
+
// ===== ClientSideToolV2Call =====
|
|
107
|
+
TOOL_ID: 3,
|
|
108
|
+
TOOL_NAME: 9,
|
|
109
|
+
TOOL_RAW_ARGS: 10,
|
|
110
|
+
TOOL_IS_LAST: 11,
|
|
111
|
+
TOOL_MCP_PARAMS: 27,
|
|
112
|
+
// ===== MCPParams =====
|
|
113
|
+
MCP_TOOLS_LIST: 1,
|
|
114
|
+
// ===== MCPParams.Tool (nested) =====
|
|
115
|
+
MCP_NESTED_NAME: 1,
|
|
116
|
+
MCP_NESTED_PARAMS: 3,
|
|
117
|
+
// ===== StreamUnifiedChatResponse =====
|
|
118
|
+
RESPONSE_TEXT: 1,
|
|
119
|
+
THINKING: 25,
|
|
120
|
+
// ===== Thinking =====
|
|
121
|
+
THINKING_TEXT: 1,
|
|
122
|
+
};
|
|
123
|
+
/** Compression flags for ConnectRPC frames */
|
|
124
|
+
exports.COMPRESS_FLAG = {
|
|
125
|
+
NONE: 0x00,
|
|
126
|
+
GZIP: 0x01,
|
|
127
|
+
GZIP_ALT: 0x02,
|
|
128
|
+
GZIP_BOTH: 0x03,
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=cursor-protobuf-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-protobuf-schema.js","sourceRoot":"","sources":["../../src/cursor/cursor-prot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E,CAAC;IAEpB,wCAAwC;IACxC,aAAa,EAAE,CAAC;IAChB,QAAQ,EAAE,EAAE;IAEZ,uBAAuB;IACvB,aAAa,EAAE,CAAC;CACR,CAAC;AAmEX,8CAA8C;AACjC,QAAA,aAAa,GAAG;IAC3B,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;IACV,QAAQ,EAAE,IAAI;IACd,SAAS,EAAE,IAAI;CACP,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor Protobuf Main Module
|
|
3
|
+
* Exports encoder/decoder functions and builds complete requests
|
|
4
|
+
*/
|
|
5
|
+
import { type CursorMessage, type CursorTool } from './cursor-protobuf-schema.js';
|
|
6
|
+
import { encodeField, encodeVarint, encodeMessage, encodeInstruction, encodeModel, encodeCursorSetting, encodeMetadata, encodeMessageId, encodeMcpTool, wrapConnectRPCFrame } from './cursor-protobuf-encoder.js';
|
|
7
|
+
import { decodeVarint, decodeField, decodeMessage, parseConnectRPCFrame, extractTextFromResponse } from './cursor-protobuf-decoder.js';
|
|
8
|
+
/**
|
|
9
|
+
* Build complete chat request protobuf
|
|
10
|
+
*/
|
|
11
|
+
export declare function encodeRequest(messages: CursorMessage[], modelName: string, tools?: CursorTool[], reasoningEffort?: string | null): Uint8Array;
|
|
12
|
+
/**
|
|
13
|
+
* Build chat request wrapped in top-level message
|
|
14
|
+
*/
|
|
15
|
+
export declare function buildChatRequest(messages: CursorMessage[], modelName: string, tools?: CursorTool[], reasoningEffort?: string | null): Uint8Array;
|
|
16
|
+
/**
|
|
17
|
+
* Generate complete Cursor request body with ConnectRPC framing
|
|
18
|
+
*/
|
|
19
|
+
export declare function generateCursorBody(messages: CursorMessage[], modelName: string, tools?: CursorTool[], reasoningEffort?: string | null): Uint8Array;
|
|
20
|
+
export { encodeVarint, encodeField, encodeMessage, encodeInstruction, encodeModel, encodeCursorSetting, encodeMetadata, encodeMessageId, encodeMcpTool, wrapConnectRPCFrame, decodeVarint, decodeField, decodeMessage, parseConnectRPCFrame, extractTextFromResponse, };
|
|
21
|
+
//# sourceMappingURL=cursor-protobuf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-protobuf.d.ts","sourceRoot":"","sources":["../../src/cursor/cursor-protobuf.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAKL,KAAK,aAAa,EAClB,KAAK,UAAU,EAIhB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,WAAW,EACX,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,aAAa,EACb,mBAAmB,EAEpB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,YAAY,EACZ,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,uBAAuB,EACxB,MAAM,8BAA8B,CAAC;AAGtC;;GAEG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,aAAa,EAAE,EACzB,SAAS,EAAE,MAAM,EACjB,KAAK,GAAE,UAAU,EAAO,EACxB,eAAe,GAAE,MAAM,GAAG,IAAW,GACpC,UAAU,CAyFZ;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,aAAa,EAAE,EACzB,SAAS,EAAE,MAAM,EACjB,KAAK,GAAE,UAAU,EAAO,EACxB,eAAe,GAAE,MAAM,GAAG,IAAW,GACpC,UAAU,CAMZ;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,aAAa,EAAE,EACzB,SAAS,EAAE,MAAM,EACjB,KAAK,GAAE,UAAU,EAAO,EACxB,eAAe,GAAE,MAAM,GAAG,IAAW,GACpC,UAAU,CAIZ;AAGD,OAAO,EACL,YAAY,EACZ,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,uBAAuB,GACxB,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Cursor Protobuf Main Module
|
|
4
|
+
* Exports encoder/decoder functions and builds complete requests
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.extractTextFromResponse = exports.parseConnectRPCFrame = exports.decodeMessage = exports.decodeField = exports.decodeVarint = exports.wrapConnectRPCFrame = exports.encodeMcpTool = exports.encodeMessageId = exports.encodeMetadata = exports.encodeCursorSetting = exports.encodeModel = exports.encodeInstruction = exports.encodeMessage = exports.encodeField = exports.encodeVarint = exports.generateCursorBody = exports.buildChatRequest = exports.encodeRequest = void 0;
|
|
8
|
+
const crypto_1 = require("crypto");
|
|
9
|
+
const cursor_protobuf_schema_js_1 = require("./cursor-protobuf-schema.js");
|
|
10
|
+
const cursor_protobuf_encoder_js_1 = require("./cursor-protobuf-encoder.js");
|
|
11
|
+
Object.defineProperty(exports, "encodeField", { enumerable: true, get: function () { return cursor_protobuf_encoder_js_1.encodeField; } });
|
|
12
|
+
Object.defineProperty(exports, "encodeVarint", { enumerable: true, get: function () { return cursor_protobuf_encoder_js_1.encodeVarint; } });
|
|
13
|
+
Object.defineProperty(exports, "encodeMessage", { enumerable: true, get: function () { return cursor_protobuf_encoder_js_1.encodeMessage; } });
|
|
14
|
+
Object.defineProperty(exports, "encodeInstruction", { enumerable: true, get: function () { return cursor_protobuf_encoder_js_1.encodeInstruction; } });
|
|
15
|
+
Object.defineProperty(exports, "encodeModel", { enumerable: true, get: function () { return cursor_protobuf_encoder_js_1.encodeModel; } });
|
|
16
|
+
Object.defineProperty(exports, "encodeCursorSetting", { enumerable: true, get: function () { return cursor_protobuf_encoder_js_1.encodeCursorSetting; } });
|
|
17
|
+
Object.defineProperty(exports, "encodeMetadata", { enumerable: true, get: function () { return cursor_protobuf_encoder_js_1.encodeMetadata; } });
|
|
18
|
+
Object.defineProperty(exports, "encodeMessageId", { enumerable: true, get: function () { return cursor_protobuf_encoder_js_1.encodeMessageId; } });
|
|
19
|
+
Object.defineProperty(exports, "encodeMcpTool", { enumerable: true, get: function () { return cursor_protobuf_encoder_js_1.encodeMcpTool; } });
|
|
20
|
+
Object.defineProperty(exports, "wrapConnectRPCFrame", { enumerable: true, get: function () { return cursor_protobuf_encoder_js_1.wrapConnectRPCFrame; } });
|
|
21
|
+
const cursor_protobuf_decoder_js_1 = require("./cursor-protobuf-decoder.js");
|
|
22
|
+
Object.defineProperty(exports, "decodeVarint", { enumerable: true, get: function () { return cursor_protobuf_decoder_js_1.decodeVarint; } });
|
|
23
|
+
Object.defineProperty(exports, "decodeField", { enumerable: true, get: function () { return cursor_protobuf_decoder_js_1.decodeField; } });
|
|
24
|
+
Object.defineProperty(exports, "decodeMessage", { enumerable: true, get: function () { return cursor_protobuf_decoder_js_1.decodeMessage; } });
|
|
25
|
+
Object.defineProperty(exports, "parseConnectRPCFrame", { enumerable: true, get: function () { return cursor_protobuf_decoder_js_1.parseConnectRPCFrame; } });
|
|
26
|
+
Object.defineProperty(exports, "extractTextFromResponse", { enumerable: true, get: function () { return cursor_protobuf_decoder_js_1.extractTextFromResponse; } });
|
|
27
|
+
const cursor_protobuf_schema_js_2 = require("./cursor-protobuf-schema.js");
|
|
28
|
+
/**
|
|
29
|
+
* Build complete chat request protobuf
|
|
30
|
+
*/
|
|
31
|
+
function encodeRequest(messages, modelName, tools = [], reasoningEffort = null) {
|
|
32
|
+
if (messages.length === 0) {
|
|
33
|
+
throw new Error('Messages array must not be empty');
|
|
34
|
+
}
|
|
35
|
+
const hasTools = tools?.length > 0;
|
|
36
|
+
const isAgentic = hasTools;
|
|
37
|
+
const formattedMessages = [];
|
|
38
|
+
const messageIds = [];
|
|
39
|
+
// Prepare messages
|
|
40
|
+
for (let i = 0; i < messages.length; i++) {
|
|
41
|
+
const msg = messages[i];
|
|
42
|
+
const role = msg.role === 'user' ? cursor_protobuf_schema_js_1.ROLE.USER : cursor_protobuf_schema_js_1.ROLE.ASSISTANT;
|
|
43
|
+
const msgId = (0, crypto_1.randomUUID)();
|
|
44
|
+
const isLast = i === messages.length - 1;
|
|
45
|
+
formattedMessages.push({
|
|
46
|
+
content: msg.content,
|
|
47
|
+
role,
|
|
48
|
+
messageId: msgId,
|
|
49
|
+
isLast,
|
|
50
|
+
hasTools,
|
|
51
|
+
toolResults: msg.tool_results || [],
|
|
52
|
+
});
|
|
53
|
+
messageIds.push({ messageId: msgId, role });
|
|
54
|
+
}
|
|
55
|
+
// Map reasoning effort to thinking level
|
|
56
|
+
let thinkingLevel = cursor_protobuf_schema_js_1.THINKING_LEVEL.UNSPECIFIED;
|
|
57
|
+
if (reasoningEffort === 'medium')
|
|
58
|
+
thinkingLevel = cursor_protobuf_schema_js_1.THINKING_LEVEL.MEDIUM;
|
|
59
|
+
else if (reasoningEffort === 'high')
|
|
60
|
+
thinkingLevel = cursor_protobuf_schema_js_1.THINKING_LEVEL.HIGH;
|
|
61
|
+
// Build arrays for messages and tools
|
|
62
|
+
const messageFields = formattedMessages.map((fm) => (0, cursor_protobuf_encoder_js_1.encodeField)(cursor_protobuf_schema_js_1.FIELD.MESSAGES, cursor_protobuf_schema_js_2.WIRE_TYPE.LEN, (0, cursor_protobuf_encoder_js_1.encodeMessage)(fm.content, fm.role, fm.messageId, fm.isLast, fm.hasTools, fm.toolResults)));
|
|
63
|
+
const messageIdFields = messageIds.map((mid) => (0, cursor_protobuf_encoder_js_1.encodeField)(cursor_protobuf_schema_js_1.FIELD.MESSAGE_IDS, cursor_protobuf_schema_js_2.WIRE_TYPE.LEN, (0, cursor_protobuf_encoder_js_1.encodeMessageId)(mid.messageId, mid.role)));
|
|
64
|
+
const toolFields = tools?.length > 0
|
|
65
|
+
? tools.map((tool) => (0, cursor_protobuf_encoder_js_1.encodeField)(cursor_protobuf_schema_js_1.FIELD.MCP_TOOLS, cursor_protobuf_schema_js_2.WIRE_TYPE.LEN, (0, cursor_protobuf_encoder_js_1.encodeMcpTool)(tool)))
|
|
66
|
+
: [];
|
|
67
|
+
const supportedToolsField = isAgentic
|
|
68
|
+
? [(0, cursor_protobuf_encoder_js_1.encodeField)(cursor_protobuf_schema_js_1.FIELD.SUPPORTED_TOOLS, cursor_protobuf_schema_js_2.WIRE_TYPE.LEN, (0, cursor_protobuf_encoder_js_1.encodeVarint)(1))]
|
|
69
|
+
: [];
|
|
70
|
+
// Concatenate all parts
|
|
71
|
+
const parts = [
|
|
72
|
+
...messageFields,
|
|
73
|
+
(0, cursor_protobuf_encoder_js_1.encodeField)(cursor_protobuf_schema_js_1.FIELD.UNKNOWN_2, cursor_protobuf_schema_js_2.WIRE_TYPE.VARINT, 1),
|
|
74
|
+
(0, cursor_protobuf_encoder_js_1.encodeField)(cursor_protobuf_schema_js_1.FIELD.INSTRUCTION, cursor_protobuf_schema_js_2.WIRE_TYPE.LEN, (0, cursor_protobuf_encoder_js_1.encodeInstruction)('')),
|
|
75
|
+
(0, cursor_protobuf_encoder_js_1.encodeField)(cursor_protobuf_schema_js_1.FIELD.UNKNOWN_4, cursor_protobuf_schema_js_2.WIRE_TYPE.VARINT, 1),
|
|
76
|
+
(0, cursor_protobuf_encoder_js_1.encodeField)(cursor_protobuf_schema_js_1.FIELD.MODEL, cursor_protobuf_schema_js_2.WIRE_TYPE.LEN, (0, cursor_protobuf_encoder_js_1.encodeModel)(modelName)),
|
|
77
|
+
(0, cursor_protobuf_encoder_js_1.encodeField)(cursor_protobuf_schema_js_1.FIELD.WEB_TOOL, cursor_protobuf_schema_js_2.WIRE_TYPE.LEN, ''),
|
|
78
|
+
(0, cursor_protobuf_encoder_js_1.encodeField)(cursor_protobuf_schema_js_1.FIELD.UNKNOWN_13, cursor_protobuf_schema_js_2.WIRE_TYPE.VARINT, 1),
|
|
79
|
+
(0, cursor_protobuf_encoder_js_1.encodeField)(cursor_protobuf_schema_js_1.FIELD.CURSOR_SETTING, cursor_protobuf_schema_js_2.WIRE_TYPE.LEN, (0, cursor_protobuf_encoder_js_1.encodeCursorSetting)()),
|
|
80
|
+
(0, cursor_protobuf_encoder_js_1.encodeField)(cursor_protobuf_schema_js_1.FIELD.UNKNOWN_19, cursor_protobuf_schema_js_2.WIRE_TYPE.VARINT, 1),
|
|
81
|
+
(0, cursor_protobuf_encoder_js_1.encodeField)(cursor_protobuf_schema_js_1.FIELD.CONVERSATION_ID, cursor_protobuf_schema_js_2.WIRE_TYPE.LEN, (0, crypto_1.randomUUID)()),
|
|
82
|
+
(0, cursor_protobuf_encoder_js_1.encodeField)(cursor_protobuf_schema_js_1.FIELD.METADATA, cursor_protobuf_schema_js_2.WIRE_TYPE.LEN, (0, cursor_protobuf_encoder_js_1.encodeMetadata)()),
|
|
83
|
+
(0, cursor_protobuf_encoder_js_1.encodeField)(cursor_protobuf_schema_js_1.FIELD.IS_AGENTIC, cursor_protobuf_schema_js_2.WIRE_TYPE.VARINT, isAgentic ? 1 : 0),
|
|
84
|
+
...supportedToolsField,
|
|
85
|
+
...messageIdFields,
|
|
86
|
+
...toolFields,
|
|
87
|
+
(0, cursor_protobuf_encoder_js_1.encodeField)(cursor_protobuf_schema_js_1.FIELD.LARGE_CONTEXT, cursor_protobuf_schema_js_2.WIRE_TYPE.VARINT, 0),
|
|
88
|
+
(0, cursor_protobuf_encoder_js_1.encodeField)(cursor_protobuf_schema_js_1.FIELD.UNKNOWN_38, cursor_protobuf_schema_js_2.WIRE_TYPE.VARINT, 0),
|
|
89
|
+
(0, cursor_protobuf_encoder_js_1.encodeField)(cursor_protobuf_schema_js_1.FIELD.UNIFIED_MODE, cursor_protobuf_schema_js_2.WIRE_TYPE.VARINT, isAgentic ? cursor_protobuf_schema_js_1.UNIFIED_MODE.AGENT : cursor_protobuf_schema_js_1.UNIFIED_MODE.CHAT),
|
|
90
|
+
(0, cursor_protobuf_encoder_js_1.encodeField)(cursor_protobuf_schema_js_1.FIELD.UNKNOWN_47, cursor_protobuf_schema_js_2.WIRE_TYPE.LEN, ''),
|
|
91
|
+
(0, cursor_protobuf_encoder_js_1.encodeField)(cursor_protobuf_schema_js_1.FIELD.SHOULD_DISABLE_TOOLS, cursor_protobuf_schema_js_2.WIRE_TYPE.VARINT, isAgentic ? 0 : 1),
|
|
92
|
+
(0, cursor_protobuf_encoder_js_1.encodeField)(cursor_protobuf_schema_js_1.FIELD.THINKING_LEVEL, cursor_protobuf_schema_js_2.WIRE_TYPE.VARINT, thinkingLevel),
|
|
93
|
+
(0, cursor_protobuf_encoder_js_1.encodeField)(cursor_protobuf_schema_js_1.FIELD.UNKNOWN_51, cursor_protobuf_schema_js_2.WIRE_TYPE.VARINT, 0),
|
|
94
|
+
(0, cursor_protobuf_encoder_js_1.encodeField)(cursor_protobuf_schema_js_1.FIELD.UNKNOWN_53, cursor_protobuf_schema_js_2.WIRE_TYPE.VARINT, 1),
|
|
95
|
+
(0, cursor_protobuf_encoder_js_1.encodeField)(cursor_protobuf_schema_js_1.FIELD.UNIFIED_MODE_NAME, cursor_protobuf_schema_js_2.WIRE_TYPE.LEN, isAgentic ? 'Agent' : 'Ask'),
|
|
96
|
+
];
|
|
97
|
+
return (0, cursor_protobuf_encoder_js_1.concatArrays)(...parts);
|
|
98
|
+
}
|
|
99
|
+
exports.encodeRequest = encodeRequest;
|
|
100
|
+
/**
|
|
101
|
+
* Build chat request wrapped in top-level message
|
|
102
|
+
*/
|
|
103
|
+
function buildChatRequest(messages, modelName, tools = [], reasoningEffort = null) {
|
|
104
|
+
return (0, cursor_protobuf_encoder_js_1.encodeField)(cursor_protobuf_schema_js_1.FIELD.REQUEST, cursor_protobuf_schema_js_2.WIRE_TYPE.LEN, encodeRequest(messages, modelName, tools, reasoningEffort));
|
|
105
|
+
}
|
|
106
|
+
exports.buildChatRequest = buildChatRequest;
|
|
107
|
+
/**
|
|
108
|
+
* Generate complete Cursor request body with ConnectRPC framing
|
|
109
|
+
*/
|
|
110
|
+
function generateCursorBody(messages, modelName, tools = [], reasoningEffort = null) {
|
|
111
|
+
const protobuf = buildChatRequest(messages, modelName, tools, reasoningEffort);
|
|
112
|
+
const framed = (0, cursor_protobuf_encoder_js_1.wrapConnectRPCFrame)(protobuf, false); // Cursor doesn't support compressed requests
|
|
113
|
+
return framed;
|
|
114
|
+
}
|
|
115
|
+
exports.generateCursorBody = generateCursorBody;
|
|
116
|
+
//# sourceMappingURL=cursor-protobuf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-protobuf.js","sourceRoot":"","sources":["../../src/cursor/cursor-protobuf.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,mCAAoC;AACpC,2EAUqC;AACrC,6EAYsC;AA8IpC,4FAzJA,wCAAW,OAyJA;AADX,6FAvJA,yCAAY,OAuJA;AAEZ,8FAxJA,0CAAa,OAwJA;AACb,kGAxJA,8CAAiB,OAwJA;AACjB,4FAxJA,wCAAW,OAwJA;AACX,oGAxJA,gDAAmB,OAwJA;AACnB,+FAxJA,2CAAc,OAwJA;AACd,gGAxJA,4CAAe,OAwJA;AACf,8FAxJA,0CAAa,OAwJA;AACb,oGAxJA,gDAAmB,OAwJA;AArJrB,6EAMsC;AAgJpC,6FArJA,yCAAY,OAqJA;AACZ,4FArJA,wCAAW,OAqJA;AACX,8FArJA,0CAAa,OAqJA;AACb,qGArJA,iDAAoB,OAqJA;AACpB,wGArJA,oDAAuB,OAqJA;AAnJzB,2EAAwD;AAExD;;GAEG;AACH,SAAgB,aAAa,CAC3B,QAAyB,EACzB,SAAiB,EACjB,QAAsB,EAAE,EACxB,kBAAiC,IAAI;IAErC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACtD,CAAC;IAED,MAAM,QAAQ,GAAG,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC;IACnC,MAAM,SAAS,GAAG,QAAQ,CAAC;IAC3B,MAAM,i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B,CAAC;AATD,gDASC"}
|
|
@@ -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;IAEhD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACzC,MAAM,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QAExB,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC1B,IAAI,OAAO,GAAG,EAAE,CAAC;YACjB,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;gBACpC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;YACxB,CAAC;iBAAM,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;gBACtC,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;oBAC/B,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,IAAI;wBAAE,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC;gBAC9D,CAAC;YACH,CAAC;YACD,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,0BAA0B,OAAO,EAAE;aAC7C,CAAC,CAAC;YACH,SAAS;QACX,CAAC;QAED,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YACxB,IAAI,WAAW,GAAG,EAAE,CA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