@kaitranntt/ccs 7.43.0-dev.1 → 7.43.0-dev.3

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.
Files changed (46) hide show
  1. package/dist/ccs.js +7 -0
  2. package/dist/ccs.js.map +1 -1
  3. package/dist/commands/cursor-command.d.ts +12 -0
  4. package/dist/commands/cursor-command.d.ts.map +1 -0
  5. package/dist/commands/cursor-command.js +225 -0
  6. package/dist/commands/cursor-command.js.map +1 -0
  7. package/dist/cursor/cursor-daemon.d.ts +47 -0
  8. package/dist/cursor/cursor-daemon.d.ts.map +1 -0
  9. package/dist/cursor/cursor-daemon.js +332 -0
  10. package/dist/cursor/cursor-daemon.js.map +1 -0
  11. package/dist/cursor/cursor-executor.d.ts +74 -0
  12. package/dist/cursor/cursor-executor.d.ts.map +1 -0
  13. package/dist/cursor/cursor-executor.js +621 -0
  14. package/dist/cursor/cursor-executor.js.map +1 -0
  15. package/dist/cursor/cursor-models.d.ts +43 -0
  16. package/dist/cursor/cursor-models.d.ts.map +1 -0
  17. package/dist/cursor/cursor-models.js +205 -0
  18. package/dist/cursor/cursor-models.js.map +1 -0
  19. package/dist/cursor/cursor-protobuf-decoder.d.ts +52 -0
  20. package/dist/cursor/cursor-protobuf-decoder.d.ts.map +1 -0
  21. package/dist/cursor/cursor-protobuf-decoder.js +311 -0
  22. package/dist/cursor/cursor-protobuf-decoder.js.map +1 -0
  23. package/dist/cursor/cursor-protobuf-encoder.d.ts +54 -0
  24. package/dist/cursor/cursor-protobuf-encoder.d.ts.map +1 -0
  25. package/dist/cursor/cursor-protobuf-encoder.js +173 -0
  26. package/dist/cursor/cursor-protobuf-encoder.js.map +1 -0
  27. package/dist/cursor/cursor-protobuf-schema.d.ts +168 -0
  28. package/dist/cursor/cursor-protobuf-schema.d.ts.map +1 -0
  29. package/dist/cursor/cursor-protobuf-schema.js +130 -0
  30. package/dist/cursor/cursor-protobuf-schema.js.map +1 -0
  31. package/dist/cursor/cursor-protobuf.d.ts +21 -0
  32. package/dist/cursor/cursor-protobuf.d.ts.map +1 -0
  33. package/dist/cursor/cursor-protobuf.js +116 -0
  34. package/dist/cursor/cursor-protobuf.js.map +1 -0
  35. package/dist/cursor/cursor-translator.d.ts +39 -0
  36. package/dist/cursor/cursor-translator.d.ts.map +1 -0
  37. package/dist/cursor/cursor-translator.js +118 -0
  38. package/dist/cursor/cursor-translator.js.map +1 -0
  39. package/dist/cursor/index.d.ts +11 -0
  40. package/dist/cursor/index.d.ts.map +1 -0
  41. package/dist/cursor/index.js +53 -0
  42. package/dist/cursor/index.js.map +1 -0
  43. package/dist/cursor/types.d.ts +33 -1
  44. package/dist/cursor/types.d.ts.map +1 -1
  45. package/dist/cursor/types.js +1 -1
  46. package/package.json +1 -1
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Cursor Protobuf Encoder
3
+ * Implements ConnectRPC protobuf wire format encoding
4
+ */
5
+ import { type WireType, type RoleType, type CursorTool, type CursorToolResult } from './cursor-protobuf-schema.js';
6
+ /**
7
+ * Encode a varint (variable-length integer)
8
+ */
9
+ export declare function encodeVarint(value: number): Uint8Array;
10
+ /**
11
+ * Encode a protobuf field (tag + value)
12
+ */
13
+ export declare function encodeField(fieldNum: number, wireType: WireType, value: number | string | Uint8Array): Uint8Array;
14
+ /**
15
+ * Concatenate multiple Uint8Arrays
16
+ */
17
+ export declare function concatArrays(...arrays: Uint8Array[]): Uint8Array;
18
+ /**
19
+ * Encode a tool result
20
+ */
21
+ export declare function encodeToolResult(toolResult: CursorToolResult): Uint8Array;
22
+ /**
23
+ * Encode a conversation message
24
+ */
25
+ export declare function encodeMessage(content: string, role: RoleType, messageId: string, isLast: boolean, hasTools: boolean, toolResults: CursorToolResult[]): Uint8Array;
26
+ /**
27
+ * Encode instruction text
28
+ */
29
+ export declare function encodeInstruction(text: string): Uint8Array;
30
+ /**
31
+ * Encode model information
32
+ */
33
+ export declare function encodeModel(modelName: string): Uint8Array;
34
+ /**
35
+ * Encode cursor settings
36
+ */
37
+ export declare function encodeCursorSetting(): Uint8Array;
38
+ /**
39
+ * Encode metadata
40
+ */
41
+ export declare function encodeMetadata(): Uint8Array;
42
+ /**
43
+ * Encode message ID
44
+ */
45
+ export declare function encodeMessageId(messageId: string, role: RoleType, summaryId?: string): Uint8Array;
46
+ /**
47
+ * Encode MCP tool
48
+ */
49
+ export declare function encodeMcpTool(tool: CursorTool): Uint8Array;
50
+ /**
51
+ * Wrap payload in ConnectRPC frame (5-byte header + payload)
52
+ */
53
+ export declare function wrapConnectRPCFrame(payload: Uint8Array, compress?: boolean): Uint8Array;
54
+ //# sourceMappingURL=cursor-protobuf-encoder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cursor-protobuf-encoder.d.ts","sourceRoot":"","sources":["../../src/cursor/cursor-protobuf-encoder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAKL,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,gBAAgB,EACtB,MAAM,6BAA6B,CAAC;AAErC;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAStD;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,GAClC,UAAU,CAsBZ;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAShE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,gBAAgB,GAAG,UAAU,CAYzE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,QAAQ,EACd,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE,OAAO,EACjB,WAAW,EAAE,gBAAgB,EAAE,GAC9B,UAAU,CAoBZ;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAE1D;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,CAKzD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,UAAU,CAahD;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,UAAU,CAQ3C;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,UAAU,CAMjG;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAa1D;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,UAAQ,GAAG,UAAU,CAkBrF"}
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ /**
3
+ * Cursor Protobuf Encoder
4
+ * Implements ConnectRPC protobuf wire format encoding
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.wrapConnectRPCFrame = exports.encodeMcpTool = exports.encodeMessageId = exports.encodeMetadata = exports.encodeCursorSetting = exports.encodeModel = exports.encodeInstruction = exports.encodeMessage = exports.encodeToolResult = exports.concatArrays = exports.encodeField = exports.encodeVarint = void 0;
31
+ const zlib = __importStar(require("zlib"));
32
+ const cursor_protobuf_schema_js_1 = require("./cursor-protobuf-schema.js");
33
+ /**
34
+ * Encode a varint (variable-length integer)
35
+ */
36
+ function encodeVarint(value) {
37
+ const bytes = [];
38
+ let val = value >>> 0; // Ensure unsigned
39
+ while (val >= 0x80) {
40
+ bytes.push((val & 0x7f) | 0x80);
41
+ val >>>= 7;
42
+ }
43
+ bytes.push(val & 0x7f);
44
+ return new Uint8Array(bytes);
45
+ }
46
+ exports.encodeVarint = encodeVarint;
47
+ /**
48
+ * Encode a protobuf field (tag + value)
49
+ */
50
+ function encodeField(fieldNum, wireType, value) {
51
+ const tag = (fieldNum << 3) | wireType;
52
+ const tagBytes = encodeVarint(tag);
53
+ if (wireType === cursor_protobuf_schema_js_1.WIRE_TYPE.VARINT) {
54
+ const valueBytes = encodeVarint(value);
55
+ return concatArrays(tagBytes, valueBytes);
56
+ }
57
+ if (wireType === cursor_protobuf_schema_js_1.WIRE_TYPE.LEN) {
58
+ const dataBytes = typeof value === 'string'
59
+ ? new TextEncoder().encode(value)
60
+ : value instanceof Uint8Array
61
+ ? value
62
+ : new Uint8Array(0);
63
+ const lengthBytes = encodeVarint(dataBytes.length);
64
+ return concatArrays(tagBytes, lengthBytes, dataBytes);
65
+ }
66
+ return new Uint8Array(0);
67
+ }
68
+ exports.encodeField = encodeField;
69
+ /**
70
+ * Concatenate multiple Uint8Arrays
71
+ */
72
+ function concatArrays(...arrays) {
73
+ const totalLength = arrays.reduce((sum, arr) => sum + arr.length, 0);
74
+ const result = new Uint8Array(totalLength);
75
+ let offset = 0;
76
+ for (const arr of arrays) {
77
+ result.set(arr, offset);
78
+ offset += arr.length;
79
+ }
80
+ return result;
81
+ }
82
+ exports.concatArrays = concatArrays;
83
+ /**
84
+ * Encode a tool result
85
+ */
86
+ function encodeToolResult(toolResult) {
87
+ const toolCallId = toolResult.tool_call_id || '';
88
+ const toolName = toolResult.name || '';
89
+ const toolIndex = toolResult.index || 0;
90
+ const rawArgs = toolResult.raw_args || '{}';
91
+ return concatArrays(encodeField(cursor_protobuf_schema_js_1.FIELD.TOOL_RESULT_CALL_ID, cursor_protobuf_schema_js_1.WIRE_TYPE.LEN, toolCallId), encodeField(cursor_protobuf_schema_js_1.FIELD.TOOL_RESULT_NAME, cursor_protobuf_schema_js_1.WIRE_TYPE.LEN, toolName), encodeField(cursor_protobuf_schema_js_1.FIELD.TOOL_RESULT_INDEX, cursor_protobuf_schema_js_1.WIRE_TYPE.VARINT, toolIndex), encodeField(cursor_protobuf_schema_js_1.FIELD.TOOL_RESULT_RAW_ARGS, cursor_protobuf_schema_js_1.WIRE_TYPE.LEN, rawArgs));
92
+ }
93
+ exports.encodeToolResult = encodeToolResult;
94
+ /**
95
+ * Encode a conversation message
96
+ */
97
+ function encodeMessage(content, role, messageId, isLast, hasTools, toolResults) {
98
+ return concatArrays(encodeField(cursor_protobuf_schema_js_1.FIELD.MSG_CONTENT, cursor_protobuf_schema_js_1.WIRE_TYPE.LEN, content), encodeField(cursor_protobuf_schema_js_1.FIELD.MSG_ROLE, cursor_protobuf_schema_js_1.WIRE_TYPE.VARINT, role), encodeField(cursor_protobuf_schema_js_1.FIELD.MSG_ID, cursor_protobuf_schema_js_1.WIRE_TYPE.LEN, messageId), ...(toolResults.length > 0
99
+ ? toolResults.map((tr) => encodeField(cursor_protobuf_schema_js_1.FIELD.MSG_TOOL_RESULTS, cursor_protobuf_schema_js_1.WIRE_TYPE.LEN, encodeToolResult(tr)))
100
+ : []), encodeField(cursor_protobuf_schema_js_1.FIELD.MSG_IS_AGENTIC, cursor_protobuf_schema_js_1.WIRE_TYPE.VARINT, hasTools ? 1 : 0), encodeField(cursor_protobuf_schema_js_1.FIELD.MSG_UNIFIED_MODE, cursor_protobuf_schema_js_1.WIRE_TYPE.VARINT, hasTools ? cursor_protobuf_schema_js_1.UNIFIED_MODE.AGENT : cursor_protobuf_schema_js_1.UNIFIED_MODE.CHAT), ...(isLast && hasTools
101
+ ? [encodeField(cursor_protobuf_schema_js_1.FIELD.MSG_SUPPORTED_TOOLS, cursor_protobuf_schema_js_1.WIRE_TYPE.LEN, encodeVarint(1))]
102
+ : []));
103
+ }
104
+ exports.encodeMessage = encodeMessage;
105
+ /**
106
+ * Encode instruction text
107
+ */
108
+ function encodeInstruction(text) {
109
+ return text ? encodeField(cursor_protobuf_schema_js_1.FIELD.INSTRUCTION_TEXT, cursor_protobuf_schema_js_1.WIRE_TYPE.LEN, text) : new Uint8Array(0);
110
+ }
111
+ exports.encodeInstruction = encodeInstruction;
112
+ /**
113
+ * Encode model information
114
+ */
115
+ function encodeModel(modelName) {
116
+ return concatArrays(encodeField(cursor_protobuf_schema_js_1.FIELD.MODEL_NAME, cursor_protobuf_schema_js_1.WIRE_TYPE.LEN, modelName), encodeField(cursor_protobuf_schema_js_1.FIELD.MODEL_EMPTY, cursor_protobuf_schema_js_1.WIRE_TYPE.LEN, new Uint8Array(0)));
117
+ }
118
+ exports.encodeModel = encodeModel;
119
+ /**
120
+ * Encode cursor settings
121
+ */
122
+ function encodeCursorSetting() {
123
+ const unknown6 = concatArrays(encodeField(cursor_protobuf_schema_js_1.FIELD.SETTING6_FIELD_1, cursor_protobuf_schema_js_1.WIRE_TYPE.LEN, new Uint8Array(0)), encodeField(cursor_protobuf_schema_js_1.FIELD.SETTING6_FIELD_2, cursor_protobuf_schema_js_1.WIRE_TYPE.LEN, new Uint8Array(0)));
124
+ return concatArrays(encodeField(cursor_protobuf_schema_js_1.FIELD.SETTING_PATH, cursor_protobuf_schema_js_1.WIRE_TYPE.LEN, 'cursor\\aisettings'), encodeField(cursor_protobuf_schema_js_1.FIELD.SETTING_UNKNOWN_3, cursor_protobuf_schema_js_1.WIRE_TYPE.LEN, new Uint8Array(0)), encodeField(cursor_protobuf_schema_js_1.FIELD.SETTING_UNKNOWN_6, cursor_protobuf_schema_js_1.WIRE_TYPE.LEN, unknown6), encodeField(cursor_protobuf_schema_js_1.FIELD.SETTING_UNKNOWN_8, cursor_protobuf_schema_js_1.WIRE_TYPE.VARINT, 1), encodeField(cursor_protobuf_schema_js_1.FIELD.SETTING_UNKNOWN_9, cursor_protobuf_schema_js_1.WIRE_TYPE.VARINT, 1));
125
+ }
126
+ exports.encodeCursorSetting = encodeCursorSetting;
127
+ /**
128
+ * Encode metadata
129
+ */
130
+ function encodeMetadata() {
131
+ return concatArrays(encodeField(cursor_protobuf_schema_js_1.FIELD.META_PLATFORM, cursor_protobuf_schema_js_1.WIRE_TYPE.LEN, process.platform || 'linux'), encodeField(cursor_protobuf_schema_js_1.FIELD.META_ARCH, cursor_protobuf_schema_js_1.WIRE_TYPE.LEN, process.arch || 'x64'), encodeField(cursor_protobuf_schema_js_1.FIELD.META_VERSION, cursor_protobuf_schema_js_1.WIRE_TYPE.LEN, process.version || 'v20.0.0'), encodeField(cursor_protobuf_schema_js_1.FIELD.META_CWD, cursor_protobuf_schema_js_1.WIRE_TYPE.LEN, process.cwd() || '/'), encodeField(cursor_protobuf_schema_js_1.FIELD.META_TIMESTAMP, cursor_protobuf_schema_js_1.WIRE_TYPE.LEN, new Date().toISOString()));
132
+ }
133
+ exports.encodeMetadata = encodeMetadata;
134
+ /**
135
+ * Encode message ID
136
+ */
137
+ function encodeMessageId(messageId, role, summaryId) {
138
+ return concatArrays(encodeField(cursor_protobuf_schema_js_1.FIELD.MSGID_ID, cursor_protobuf_schema_js_1.WIRE_TYPE.LEN, messageId), ...(summaryId ? [encodeField(cursor_protobuf_schema_js_1.FIELD.MSGID_SUMMARY, cursor_protobuf_schema_js_1.WIRE_TYPE.LEN, summaryId)] : []), encodeField(cursor_protobuf_schema_js_1.FIELD.MSGID_ROLE, cursor_protobuf_schema_js_1.WIRE_TYPE.VARINT, role));
139
+ }
140
+ exports.encodeMessageId = encodeMessageId;
141
+ /**
142
+ * Encode MCP tool
143
+ */
144
+ function encodeMcpTool(tool) {
145
+ const toolName = tool.function?.name || tool.name || '';
146
+ const toolDesc = tool.function?.description || tool.description || '';
147
+ const inputSchema = tool.function?.parameters || tool.input_schema || {};
148
+ return concatArrays(...(toolName ? [encodeField(cursor_protobuf_schema_js_1.FIELD.MCP_TOOL_NAME, cursor_protobuf_schema_js_1.WIRE_TYPE.LEN, toolName)] : []), ...(toolDesc ? [encodeField(cursor_protobuf_schema_js_1.FIELD.MCP_TOOL_DESC, cursor_protobuf_schema_js_1.WIRE_TYPE.LEN, toolDesc)] : []), ...(Object.keys(inputSchema).length > 0
149
+ ? [encodeField(cursor_protobuf_schema_js_1.FIELD.MCP_TOOL_PARAMS, cursor_protobuf_schema_js_1.WIRE_TYPE.LEN, JSON.stringify(inputSchema))]
150
+ : []), encodeField(cursor_protobuf_schema_js_1.FIELD.MCP_TOOL_SERVER, cursor_protobuf_schema_js_1.WIRE_TYPE.LEN, 'custom'));
151
+ }
152
+ exports.encodeMcpTool = encodeMcpTool;
153
+ /**
154
+ * Wrap payload in ConnectRPC frame (5-byte header + payload)
155
+ */
156
+ function wrapConnectRPCFrame(payload, compress = false) {
157
+ let finalPayload = payload;
158
+ let flags = cursor_protobuf_schema_js_1.COMPRESS_FLAG.NONE;
159
+ if (compress) {
160
+ finalPayload = new Uint8Array(zlib.gzipSync(Buffer.from(payload)));
161
+ flags = cursor_protobuf_schema_js_1.COMPRESS_FLAG.GZIP;
162
+ }
163
+ const frame = new Uint8Array(5 + finalPayload.length);
164
+ frame[0] = flags;
165
+ frame[1] = (finalPayload.length >> 24) & 0xff;
166
+ frame[2] = (finalPayload.length >> 16) & 0xff;
167
+ frame[3] = (finalPayload.length >> 8) & 0xff;
168
+ frame[4] = finalPayload.length & 0xff;
169
+ frame.set(finalPayload, 5);
170
+ return frame;
171
+ }
172
+ exports.wrapConnectRPCFrame = wrapConnectRPCFrame;
173
+ //# sourceMappingURL=cursor-protobuf-encoder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cursor-protobuf-encoder.js","sourceRoot":"","sources":["../../src/cursor/cursor-protobuf-encoder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2CAA6B;AAC7B,2EASqC;AAErC;;GAEG;AACH,SAAgB,YAAY,CAAC,KAAa;IACxC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,GAAG,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,kBAAkB;IACzC,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC;QACnB,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QAChC,GAAG,MAAM,CAAC,CAAC;IACb,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;IACvB,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC;AATD,oCASC;AAED;;GAEG;AACH,SAAgB,WAAW,CACzB,QAAgB,EAChB,QAAkB,EAClB,KAAmC;IAEnC,MAAM,GAAG,GAAG,CAAC,QAAQ,IAAI,CAAC,CAAC,GAAG,QAAQ,CAAC;IACvC,MAAM,QAAQ,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IAEnC,IAAI,QAAQ,KAAK,qCAAS,CAAC,MAAM,EAAE,CAAC;QAClC,MAAM,UAAU,GAAG,YAAY,CAAC,KAAe,CAAC,CAAC;QACjD,OAAO,YAAY,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC5C,CAAC;IAED,IAAI,QAAQ,KAAK,qCAAS,CAAC,GAAG,EAAE,CAAC;QAC/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CAAC;AACJ,CAAC;AAbD,sCAaC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CAAC,OAAmB,EAAE,QAAQ,GAAG,KAAK;IACvE,IAAI,YAAY,GAAG,OAAO,CAAC;IAC3B,IAAI,KAAK,GAAW,yCAAa,CAAC,IAAI,CAAC;IAEvC,IAAI,QAAQ,EAAE,CAAC;QACb,YAAY,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QACnE,KAAK,GAAG,yCAAa,CAAC,IAAI,CAAC;IAC7B,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,CAAC,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC;IACtD,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IACjB,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IAC9C,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IAC9C,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC;IAC7C,KAAK,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,MAAM,GAAG,IAAI,CAAC;IACtC,KAAK,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;IAE3B,OAAO,KAAK,CAAC;AACf,CAAC;AAlBD,kDAkBC"}
@@ -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;;;C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AED,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-protobuf-schema.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,uCAAuC;AAC1B,QAAA,SAAS,GAAG;IACvB,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,CAAC;IACV,GAAG,EAAE,CAAC;IACN,OAAO,EAAE,CAAC;CACF,CAAC;AAEX,6BAA6B;AAChB,QAAA,IAAI,GAAG;IAClB,IAAI,EAAE,CAAC;IACP,SAAS,EAAE,CAAC;CACJ,CAAC;AAEX,6BAA6B;AAChB,QAAA,YAAY,GAAG;IAC1B,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;CACA,CAAC;AAEX,+BAA+B;AAClB,QAAA,cAAc,GAAG;IAC5B,WAAW,EAAE,CAAC;IACd,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,CAAC;CACC,CAAC;AAEX,8CAA8C;AACjC,QAAA,KAAK,GAAG;IACnB,4DAA4D;IAC5D,OAAO,EAAE,CAAC;IAEV,uCAAuC;IACvC,QAAQ,EAAE,CAAC;IACX,SAAS,EAAE,CAAC;IACZ,WAAW,EAAE,CAAC;IACd,SAAS,EAAE,CAAC;IACZ,KAAK,EAAE,CAAC;IACR,QAAQ,EAAE,CAAC;IACX,UAAU,EAAE,EAAE;IACd,cAAc,EAAE,EAAE;IAClB,UAAU,EAAE,EAAE;IACd,eAAe,EAAE,EAAE;IACnB,QAAQ,EAAE,EAAE;IACZ,UAAU,EAAE,EAAE;IACd,eAAe,EAAE,EAAE;IACnB,WAAW,EAAE,EAAE;IACf,SAAS,EAAE,EAAE;IACb,aAA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SAAS,EAAE,CAAC;IACZ,QAAQ,EAAE,CAAC;IAEX,mCAAmC;IACnC,OAAO,EAAE,CAAC;IACV,SAAS,EAAE,CAAC;IACZ,aAAa,EAAE,EAAE;IACjB,YAAY,EAAE,EAAE;IAChB,eAAe,EAAE,EAAE;IAEnB,wBAAwB;IACxB,cAAc,EAAE,CAAC;IAEjB,sCAAsC;IACtC,eAAe,EAAE,CAAC;IAClB,iBAAiB,EAAE,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"}