opencode-cursor-proxy 1.0.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.
Files changed (121) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +139 -0
  3. package/README.zh-CN.md +136 -0
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.js +2 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/lib/api/agent-service.d.ts +136 -0
  8. package/dist/lib/api/agent-service.js +938 -0
  9. package/dist/lib/api/agent-service.js.map +1 -0
  10. package/dist/lib/api/ai-service.d.ts +26 -0
  11. package/dist/lib/api/ai-service.js +38 -0
  12. package/dist/lib/api/ai-service.js.map +1 -0
  13. package/dist/lib/api/cursor-client.d.ts +119 -0
  14. package/dist/lib/api/cursor-client.js +511 -0
  15. package/dist/lib/api/cursor-client.js.map +1 -0
  16. package/dist/lib/api/cursor-models.d.ts +13 -0
  17. package/dist/lib/api/cursor-models.js +34 -0
  18. package/dist/lib/api/cursor-models.js.map +1 -0
  19. package/dist/lib/api/openai-compat.d.ts +10 -0
  20. package/dist/lib/api/openai-compat.js +262 -0
  21. package/dist/lib/api/openai-compat.js.map +1 -0
  22. package/dist/lib/api/proto/agent-messages.d.ts +25 -0
  23. package/dist/lib/api/proto/agent-messages.js +132 -0
  24. package/dist/lib/api/proto/agent-messages.js.map +1 -0
  25. package/dist/lib/api/proto/bidi.d.ts +17 -0
  26. package/dist/lib/api/proto/bidi.js +24 -0
  27. package/dist/lib/api/proto/bidi.js.map +1 -0
  28. package/dist/lib/api/proto/decoding.d.ts +19 -0
  29. package/dist/lib/api/proto/decoding.js +118 -0
  30. package/dist/lib/api/proto/decoding.js.map +1 -0
  31. package/dist/lib/api/proto/encoding.d.ts +64 -0
  32. package/dist/lib/api/proto/encoding.js +180 -0
  33. package/dist/lib/api/proto/encoding.js.map +1 -0
  34. package/dist/lib/api/proto/exec.d.ts +12 -0
  35. package/dist/lib/api/proto/exec.js +383 -0
  36. package/dist/lib/api/proto/exec.js.map +1 -0
  37. package/dist/lib/api/proto/index.d.ts +13 -0
  38. package/dist/lib/api/proto/index.js +10 -0
  39. package/dist/lib/api/proto/index.js.map +1 -0
  40. package/dist/lib/api/proto/interaction.d.ts +15 -0
  41. package/dist/lib/api/proto/interaction.js +99 -0
  42. package/dist/lib/api/proto/interaction.js.map +1 -0
  43. package/dist/lib/api/proto/kv.d.ts +52 -0
  44. package/dist/lib/api/proto/kv.js +156 -0
  45. package/dist/lib/api/proto/kv.js.map +1 -0
  46. package/dist/lib/api/proto/tool-calls.d.ts +9 -0
  47. package/dist/lib/api/proto/tool-calls.js +144 -0
  48. package/dist/lib/api/proto/tool-calls.js.map +1 -0
  49. package/dist/lib/api/proto/types.d.ts +201 -0
  50. package/dist/lib/api/proto/types.js +10 -0
  51. package/dist/lib/api/proto/types.js.map +1 -0
  52. package/dist/lib/auth/helpers.d.ts +40 -0
  53. package/dist/lib/auth/helpers.js +103 -0
  54. package/dist/lib/auth/helpers.js.map +1 -0
  55. package/dist/lib/auth/index.d.ts +7 -0
  56. package/dist/lib/auth/index.js +10 -0
  57. package/dist/lib/auth/index.js.map +1 -0
  58. package/dist/lib/auth/login.d.ts +55 -0
  59. package/dist/lib/auth/login.js +184 -0
  60. package/dist/lib/auth/login.js.map +1 -0
  61. package/dist/lib/config.d.ts +153 -0
  62. package/dist/lib/config.js +182 -0
  63. package/dist/lib/config.js.map +1 -0
  64. package/dist/lib/openai-compat/handler.d.ts +40 -0
  65. package/dist/lib/openai-compat/handler.js +808 -0
  66. package/dist/lib/openai-compat/handler.js.map +1 -0
  67. package/dist/lib/openai-compat/index.d.ts +9 -0
  68. package/dist/lib/openai-compat/index.js +13 -0
  69. package/dist/lib/openai-compat/index.js.map +1 -0
  70. package/dist/lib/openai-compat/types.d.ts +127 -0
  71. package/dist/lib/openai-compat/types.js +6 -0
  72. package/dist/lib/openai-compat/types.js.map +1 -0
  73. package/dist/lib/openai-compat/utils.d.ts +143 -0
  74. package/dist/lib/openai-compat/utils.js +348 -0
  75. package/dist/lib/openai-compat/utils.js.map +1 -0
  76. package/dist/lib/session-reuse.d.ts +88 -0
  77. package/dist/lib/session-reuse.js +198 -0
  78. package/dist/lib/session-reuse.js.map +1 -0
  79. package/dist/lib/storage.d.ts +55 -0
  80. package/dist/lib/storage.js +159 -0
  81. package/dist/lib/storage.js.map +1 -0
  82. package/dist/lib/utils/cache.d.ts +131 -0
  83. package/dist/lib/utils/cache.js +297 -0
  84. package/dist/lib/utils/cache.js.map +1 -0
  85. package/dist/lib/utils/fetch.d.ts +84 -0
  86. package/dist/lib/utils/fetch.js +261 -0
  87. package/dist/lib/utils/fetch.js.map +1 -0
  88. package/dist/lib/utils/index.d.ts +13 -0
  89. package/dist/lib/utils/index.js +22 -0
  90. package/dist/lib/utils/index.js.map +1 -0
  91. package/dist/lib/utils/jwt.d.ts +40 -0
  92. package/dist/lib/utils/jwt.js +102 -0
  93. package/dist/lib/utils/jwt.js.map +1 -0
  94. package/dist/lib/utils/logger.d.ts +107 -0
  95. package/dist/lib/utils/logger.js +227 -0
  96. package/dist/lib/utils/logger.js.map +1 -0
  97. package/dist/lib/utils/model-resolver.d.ts +49 -0
  98. package/dist/lib/utils/model-resolver.js +503 -0
  99. package/dist/lib/utils/model-resolver.js.map +1 -0
  100. package/dist/lib/utils/request-pool.d.ts +38 -0
  101. package/dist/lib/utils/request-pool.js +105 -0
  102. package/dist/lib/utils/request-pool.js.map +1 -0
  103. package/dist/lib/utils/request-transformer.d.ts +87 -0
  104. package/dist/lib/utils/request-transformer.js +154 -0
  105. package/dist/lib/utils/request-transformer.js.map +1 -0
  106. package/dist/lib/utils/tokenizer.d.ts +14 -0
  107. package/dist/lib/utils/tokenizer.js +76 -0
  108. package/dist/lib/utils/tokenizer.js.map +1 -0
  109. package/dist/plugin/index.d.ts +8 -0
  110. package/dist/plugin/index.js +9 -0
  111. package/dist/plugin/index.js.map +1 -0
  112. package/dist/plugin/plugin.d.ts +21 -0
  113. package/dist/plugin/plugin.js +309 -0
  114. package/dist/plugin/plugin.js.map +1 -0
  115. package/dist/plugin/types.d.ts +120 -0
  116. package/dist/plugin/types.js +7 -0
  117. package/dist/plugin/types.js.map +1 -0
  118. package/dist/server.d.ts +15 -0
  119. package/dist/server.js +95 -0
  120. package/dist/server.js.map +1 -0
  121. package/package.json +79 -0
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Protobuf Encoding Helpers
3
+ *
4
+ * Low-level utilities for encoding protobuf wire format:
5
+ * - Varint encoding (wire type 0)
6
+ * - Length-delimited encoding (wire type 2)
7
+ * - Fixed-width encoding (wire types 1, 5)
8
+ * - google.protobuf.Value encoding for dynamic JSON-like data
9
+ */
10
+ /**
11
+ * Encode a varint (variable-length integer) for protobuf
12
+ * Supports both number and bigint for large values
13
+ */
14
+ export declare function encodeVarint(value: number | bigint): Uint8Array;
15
+ /**
16
+ * Encode a string field in protobuf format
17
+ * Field format: (field_number << 3) | wire_type
18
+ * String wire type = 2 (length-delimited)
19
+ */
20
+ export declare function encodeStringField(fieldNumber: number, value: string): Uint8Array;
21
+ /**
22
+ * Encode a uint32 field (varint, wire type 0)
23
+ */
24
+ export declare function encodeUint32Field(fieldNumber: number, value: number): Uint8Array;
25
+ /**
26
+ * Encode an int32 field (varint, wire type 0)
27
+ */
28
+ export declare function encodeInt32Field(fieldNumber: number, value: number): Uint8Array;
29
+ /**
30
+ * Encode an int64 field (varint, wire type 0)
31
+ */
32
+ export declare function encodeInt64Field(fieldNumber: number, value: bigint): Uint8Array;
33
+ /**
34
+ * Encode a nested message field (length-delimited, wire type 2)
35
+ */
36
+ export declare function encodeMessageField(fieldNumber: number, data: Uint8Array): Uint8Array;
37
+ /**
38
+ * Encode a bool field (varint, wire type 0)
39
+ */
40
+ export declare function encodeBoolField(fieldNumber: number, value: boolean): Uint8Array;
41
+ /**
42
+ * Encode a double field (64-bit, wire type 1)
43
+ */
44
+ export declare function encodeDoubleField(fieldNumber: number, value: number): Uint8Array;
45
+ /**
46
+ * Concatenate multiple Uint8Arrays into one
47
+ */
48
+ export declare function concatBytes(...arrays: Uint8Array[]): Uint8Array;
49
+ /**
50
+ * Encode a JavaScript value as google.protobuf.Value
51
+ *
52
+ * google.protobuf.Value oneof:
53
+ * field 1: null_value (enum NullValue)
54
+ * field 2: number_value (double)
55
+ * field 3: string_value (string)
56
+ * field 4: bool_value (bool)
57
+ * field 5: struct_value (Struct)
58
+ * field 6: list_value (ListValue)
59
+ */
60
+ export declare function encodeProtobufValue(value: unknown): Uint8Array;
61
+ /**
62
+ * Debug helper: dump protobuf bytes as hex string
63
+ */
64
+ export declare function hexDump(data: Uint8Array): string;
@@ -0,0 +1,180 @@
1
+ /**
2
+ * Protobuf Encoding Helpers
3
+ *
4
+ * Low-level utilities for encoding protobuf wire format:
5
+ * - Varint encoding (wire type 0)
6
+ * - Length-delimited encoding (wire type 2)
7
+ * - Fixed-width encoding (wire types 1, 5)
8
+ * - google.protobuf.Value encoding for dynamic JSON-like data
9
+ */
10
+ // --- Basic Varint and Field Encoding ---
11
+ /**
12
+ * Encode a varint (variable-length integer) for protobuf
13
+ * Supports both number and bigint for large values
14
+ */
15
+ export function encodeVarint(value) {
16
+ const bytes = [];
17
+ let v = BigInt(value);
18
+ while (v > 127n) {
19
+ bytes.push(Number(v & 0x7fn) | 0x80);
20
+ v >>= 7n;
21
+ }
22
+ bytes.push(Number(v));
23
+ return new Uint8Array(bytes);
24
+ }
25
+ /**
26
+ * Encode a string field in protobuf format
27
+ * Field format: (field_number << 3) | wire_type
28
+ * String wire type = 2 (length-delimited)
29
+ */
30
+ export function encodeStringField(fieldNumber, value) {
31
+ if (!value)
32
+ return new Uint8Array(0);
33
+ const fieldTag = (fieldNumber << 3) | 2; // wire type 2 = length-delimited
34
+ const encoded = new TextEncoder().encode(value);
35
+ const length = encodeVarint(encoded.length);
36
+ const result = new Uint8Array(1 + length.length + encoded.length);
37
+ result[0] = fieldTag;
38
+ result.set(length, 1);
39
+ result.set(encoded, 1 + length.length);
40
+ return result;
41
+ }
42
+ /**
43
+ * Encode a uint32 field (varint, wire type 0)
44
+ */
45
+ export function encodeUint32Field(fieldNumber, value) {
46
+ if (value === 0)
47
+ return new Uint8Array(0);
48
+ const fieldTag = (fieldNumber << 3) | 0; // wire type 0 = varint
49
+ const encoded = encodeVarint(value);
50
+ const result = new Uint8Array(1 + encoded.length);
51
+ result[0] = fieldTag;
52
+ result.set(encoded, 1);
53
+ return result;
54
+ }
55
+ /**
56
+ * Encode an int32 field (varint, wire type 0)
57
+ */
58
+ export function encodeInt32Field(fieldNumber, value) {
59
+ if (value === 0)
60
+ return new Uint8Array(0);
61
+ const fieldTag = (fieldNumber << 3) | 0; // wire type 0 = varint
62
+ const encoded = encodeVarint(value);
63
+ const result = new Uint8Array(1 + encoded.length);
64
+ result[0] = fieldTag;
65
+ result.set(encoded, 1);
66
+ return result;
67
+ }
68
+ /**
69
+ * Encode an int64 field (varint, wire type 0)
70
+ */
71
+ export function encodeInt64Field(fieldNumber, value) {
72
+ const fieldTag = (fieldNumber << 3) | 0; // wire type 0 = varint
73
+ const encoded = encodeVarint(value);
74
+ const result = new Uint8Array(1 + encoded.length);
75
+ result[0] = fieldTag;
76
+ result.set(encoded, 1);
77
+ return result;
78
+ }
79
+ /**
80
+ * Encode a nested message field (length-delimited, wire type 2)
81
+ */
82
+ export function encodeMessageField(fieldNumber, data) {
83
+ const fieldTag = (fieldNumber << 3) | 2; // wire type 2 = length-delimited
84
+ const length = encodeVarint(data.length);
85
+ const result = new Uint8Array(1 + length.length + data.length);
86
+ result[0] = fieldTag;
87
+ result.set(length, 1);
88
+ result.set(data, 1 + length.length);
89
+ return result;
90
+ }
91
+ /**
92
+ * Encode a bool field (varint, wire type 0)
93
+ */
94
+ export function encodeBoolField(fieldNumber, value) {
95
+ const fieldTag = (fieldNumber << 3) | 0; // wire type 0 = varint
96
+ return new Uint8Array([fieldTag, value ? 1 : 0]);
97
+ }
98
+ /**
99
+ * Encode a double field (64-bit, wire type 1)
100
+ */
101
+ export function encodeDoubleField(fieldNumber, value) {
102
+ const fieldTag = (fieldNumber << 3) | 1; // wire type 1 = 64-bit
103
+ const buffer = new ArrayBuffer(9);
104
+ const view = new DataView(buffer);
105
+ view.setUint8(0, fieldTag);
106
+ view.setFloat64(1, value, true); // little-endian
107
+ return new Uint8Array(buffer);
108
+ }
109
+ /**
110
+ * Concatenate multiple Uint8Arrays into one
111
+ */
112
+ export function concatBytes(...arrays) {
113
+ const totalLength = arrays.reduce((sum, arr) => sum + arr.length, 0);
114
+ const result = new Uint8Array(totalLength);
115
+ let offset = 0;
116
+ for (const arr of arrays) {
117
+ result.set(arr, offset);
118
+ offset += arr.length;
119
+ }
120
+ return result;
121
+ }
122
+ // --- google.protobuf.Value Encoding ---
123
+ /**
124
+ * Encode a JavaScript value as google.protobuf.Value
125
+ *
126
+ * google.protobuf.Value oneof:
127
+ * field 1: null_value (enum NullValue)
128
+ * field 2: number_value (double)
129
+ * field 3: string_value (string)
130
+ * field 4: bool_value (bool)
131
+ * field 5: struct_value (Struct)
132
+ * field 6: list_value (ListValue)
133
+ */
134
+ export function encodeProtobufValue(value) {
135
+ if (value === null || value === undefined) {
136
+ // NullValue enum = 0
137
+ return encodeUint32Field(1, 0);
138
+ }
139
+ if (typeof value === "number") {
140
+ return encodeDoubleField(2, value);
141
+ }
142
+ if (typeof value === "string") {
143
+ return encodeStringField(3, value);
144
+ }
145
+ if (typeof value === "boolean") {
146
+ return encodeBoolField(4, value);
147
+ }
148
+ if (Array.isArray(value)) {
149
+ // ListValue: field 1 = repeated Value
150
+ const listBytes = [];
151
+ for (const item of value) {
152
+ const itemValue = encodeProtobufValue(item);
153
+ listBytes.push(encodeMessageField(1, itemValue));
154
+ }
155
+ const listValue = concatBytes(...listBytes);
156
+ return encodeMessageField(6, listValue);
157
+ }
158
+ if (typeof value === "object") {
159
+ // Struct: field 1 = map<string, Value> (encoded as repeated MapEntry)
160
+ // MapEntry: field 1 = key (string), field 2 = value (Value)
161
+ const structBytes = [];
162
+ for (const [key, val] of Object.entries(value)) {
163
+ const keyBytes = encodeStringField(1, key);
164
+ const valBytes = encodeMessageField(2, encodeProtobufValue(val));
165
+ const mapEntry = concatBytes(keyBytes, valBytes);
166
+ structBytes.push(encodeMessageField(1, mapEntry));
167
+ }
168
+ const structValue = concatBytes(...structBytes);
169
+ return encodeMessageField(5, structValue);
170
+ }
171
+ // Fallback: encode as string
172
+ return encodeStringField(3, String(value));
173
+ }
174
+ /**
175
+ * Debug helper: dump protobuf bytes as hex string
176
+ */
177
+ export function hexDump(data) {
178
+ return Buffer.from(data).toString("hex");
179
+ }
180
+ //# sourceMappingURL=encoding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encoding.js","sourceRoot":"","sources":["../../../../src/lib/api/proto/encoding.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,0CAA0C;AAE1C;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,KAAsB;IACjD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACtB,OAAO,CAAC,GAAG,IAAI,EAAE,CAAC;QAChB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;QACrC,CAAC,KAAK,EAAE,CAAC;IACX,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IACtB,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,WAAmB,EAAE,KAAa;IAClE,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;IAErC,MAAM,QAAQ,GAAG,CAAC,WAAW,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,iCAAiC;IAC1E,MAAM,OAAO,GAAG,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AI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/C,MAAM,QAAQ,GAAG,iBAAiB,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;YAC3C,MAAM,QAAQ,GAAG,kBAAkB,CAAC,CAAC,EAAE,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC;YACjE,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YACjD,WAAW,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC;QACpD,CAAC;QACD,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,WAAW,CAAC,CAAC;QAChD,OAAO,kBAAkB,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;IAC5C,CAAC;IAED,6BAA6B;IAC7B,OAAO,iBAAiB,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,OAAO,CAAC,IAAgB;IACtC,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { ExecRequest, McpResult, WriteResult } from "./types";
2
+ export declare function parseExecServerMessage(data: Uint8Array): ExecRequest | null;
3
+ export declare function buildExecClientMessageWithMcpResult(id: number, execId: string | undefined, result: McpResult): Uint8Array;
4
+ export declare function buildExecClientMessageWithShellResult(id: number, execId: string | undefined, command: string, cwd: string, stdout: string, stderr: string, exitCode: number, executionTimeMs?: number): Uint8Array;
5
+ export declare function buildExecClientMessageWithLsResult(id: number, execId: string | undefined, filesString: string): Uint8Array;
6
+ export declare function buildExecClientMessageWithRequestContextResult(id: number, execId: string | undefined): Uint8Array;
7
+ export declare function buildExecClientMessageWithReadResult(id: number, execId: string | undefined, content: string, path: string, totalLines?: number, fileSize?: bigint, truncated?: boolean): Uint8Array;
8
+ export declare function buildExecClientMessageWithGrepResult(id: number, execId: string | undefined, pattern: string, path: string, files: string[]): Uint8Array;
9
+ export declare function buildExecClientMessageWithWriteResult(id: number, execId: string | undefined, result: WriteResult): Uint8Array;
10
+ export declare function buildAgentClientMessageWithExec(execClientMessage: Uint8Array): Uint8Array;
11
+ export declare function buildExecClientControlMessage(id: number): Uint8Array;
12
+ export declare function buildAgentClientMessageWithExecControl(execClientControlMessage: Uint8Array): Uint8Array;
@@ -0,0 +1,383 @@
1
+ import * as os from "node:os";
2
+ import { encodeStringField, encodeUint32Field, encodeInt32Field, encodeInt64Field, encodeMessageField, encodeBoolField, concatBytes, } from "./encoding";
3
+ import { parseProtoFields, parseProtobufValue } from "./decoding";
4
+ function parseShellArgs(data) {
5
+ const fields = parseProtoFields(data);
6
+ let command = "";
7
+ let cwd;
8
+ for (const field of fields) {
9
+ if (field.fieldNumber === 1 && field.wireType === 2 && field.value instanceof Uint8Array) {
10
+ command = new TextDecoder().decode(field.value);
11
+ }
12
+ else if (field.fieldNumber === 2 && field.wireType === 2 && field.value instanceof Uint8Array) {
13
+ cwd = new TextDecoder().decode(field.value);
14
+ }
15
+ }
16
+ return { command, cwd };
17
+ }
18
+ function parseLsArgs(data) {
19
+ const fields = parseProtoFields(data);
20
+ let path = process.cwd();
21
+ for (const field of fields) {
22
+ if (field.fieldNumber === 1 && field.wireType === 2 && field.value instanceof Uint8Array) {
23
+ path = new TextDecoder().decode(field.value);
24
+ }
25
+ }
26
+ return { path };
27
+ }
28
+ function parseReadArgs(data) {
29
+ const fields = parseProtoFields(data);
30
+ let path = "";
31
+ for (const field of fields) {
32
+ if (field.fieldNumber === 1 && field.wireType === 2 && field.value instanceof Uint8Array) {
33
+ path = new TextDecoder().decode(field.value);
34
+ }
35
+ }
36
+ return { path };
37
+ }
38
+ function parseGrepArgs(data) {
39
+ const fields = parseProtoFields(data);
40
+ let pattern = "";
41
+ let path;
42
+ let glob;
43
+ for (const field of fields) {
44
+ if (field.fieldNumber === 1 && field.wireType === 2 && field.value instanceof Uint8Array) {
45
+ pattern = new TextDecoder().decode(field.value);
46
+ }
47
+ else if (field.fieldNumber === 2 && field.wireType === 2 && field.value instanceof Uint8Array) {
48
+ path = new TextDecoder().decode(field.value);
49
+ }
50
+ else if (field.fieldNumber === 3 && field.wireType === 2 && field.value instanceof Uint8Array) {
51
+ glob = new TextDecoder().decode(field.value);
52
+ }
53
+ }
54
+ return { pattern, path, glob };
55
+ }
56
+ function parseWriteArgs(data) {
57
+ const fields = parseProtoFields(data);
58
+ let path = "";
59
+ let fileText = "";
60
+ let toolCallId;
61
+ let returnFileContentAfterWrite;
62
+ let fileBytes;
63
+ for (const field of fields) {
64
+ if (field.fieldNumber === 1 && field.wireType === 2 && field.value instanceof Uint8Array) {
65
+ path = new TextDecoder().decode(field.value);
66
+ }
67
+ else if (field.fieldNumber === 2 && field.wireType === 2 && field.value instanceof Uint8Array) {
68
+ fileText = new TextDecoder().decode(field.value);
69
+ }
70
+ else if (field.fieldNumber === 3 && field.wireType === 2 && field.value instanceof Uint8Array) {
71
+ toolCallId = new TextDecoder().decode(field.value);
72
+ }
73
+ else if (field.fieldNumber === 4 && field.wireType === 0) {
74
+ returnFileContentAfterWrite = field.value === 1;
75
+ }
76
+ else if (field.fieldNumber === 5 && field.wireType === 2 && field.value instanceof Uint8Array) {
77
+ fileBytes = field.value;
78
+ }
79
+ }
80
+ return { path, fileText, toolCallId, returnFileContentAfterWrite, fileBytes };
81
+ }
82
+ function parseMcpArgs(data) {
83
+ const fields = parseProtoFields(data);
84
+ let name = "";
85
+ const args = {};
86
+ let toolCallId = "";
87
+ let providerIdentifier = "";
88
+ let toolName = "";
89
+ for (const field of fields) {
90
+ if (field.fieldNumber === 1 && field.wireType === 2 && field.value instanceof Uint8Array) {
91
+ name = new TextDecoder().decode(field.value);
92
+ }
93
+ else if (field.fieldNumber === 2 && field.wireType === 2 && field.value instanceof Uint8Array) {
94
+ const entryFields = parseProtoFields(field.value);
95
+ let key = "";
96
+ let value = undefined;
97
+ for (const ef of entryFields) {
98
+ if (ef.fieldNumber === 1 && ef.wireType === 2 && ef.value instanceof Uint8Array) {
99
+ key = new TextDecoder().decode(ef.value);
100
+ }
101
+ if (ef.fieldNumber === 2 && ef.wireType === 2 && ef.value instanceof Uint8Array) {
102
+ value = parseProtobufValue(ef.value);
103
+ }
104
+ }
105
+ if (key) {
106
+ args[key] = value;
107
+ }
108
+ }
109
+ else if (field.fieldNumber === 3 && field.wireType === 2 && field.value instanceof Uint8Array) {
110
+ toolCallId = new TextDecoder().decode(field.value);
111
+ }
112
+ else if (field.fieldNumber === 4 && field.wireType === 2 && field.value instanceof Uint8Array) {
113
+ providerIdentifier = new TextDecoder().decode(field.value);
114
+ }
115
+ else if (field.fieldNumber === 5 && field.wireType === 2 && field.value instanceof Uint8Array) {
116
+ toolName = new TextDecoder().decode(field.value);
117
+ }
118
+ }
119
+ return { name, args, toolCallId, providerIdentifier, toolName };
120
+ }
121
+ export function parseExecServerMessage(data) {
122
+ const fields = parseProtoFields(data);
123
+ let id = 0;
124
+ let execId = undefined;
125
+ let result = null;
126
+ for (const field of fields) {
127
+ if (field.fieldNumber === 1 && field.wireType === 0) {
128
+ id = field.value;
129
+ }
130
+ else if (field.fieldNumber === 15 && field.wireType === 2 && field.value instanceof Uint8Array) {
131
+ execId = new TextDecoder().decode(field.value);
132
+ }
133
+ }
134
+ for (const field of fields) {
135
+ if (field.wireType !== 2 || !(field.value instanceof Uint8Array))
136
+ continue;
137
+ switch (field.fieldNumber) {
138
+ case 2:
139
+ case 14: {
140
+ const shellArgs = parseShellArgs(field.value);
141
+ result = { type: "shell", id, execId, command: shellArgs.command, cwd: shellArgs.cwd };
142
+ break;
143
+ }
144
+ case 3: {
145
+ const writeArgs = parseWriteArgs(field.value);
146
+ result = {
147
+ type: "write",
148
+ id,
149
+ execId,
150
+ path: writeArgs.path,
151
+ fileText: writeArgs.fileText,
152
+ toolCallId: writeArgs.toolCallId,
153
+ returnFileContentAfterWrite: writeArgs.returnFileContentAfterWrite,
154
+ fileBytes: writeArgs.fileBytes,
155
+ };
156
+ break;
157
+ }
158
+ case 5: {
159
+ const grepArgs = parseGrepArgs(field.value);
160
+ result = { type: "grep", id, execId, pattern: grepArgs.pattern, path: grepArgs.path, glob: grepArgs.glob };
161
+ break;
162
+ }
163
+ case 7: {
164
+ const readArgs = parseReadArgs(field.value);
165
+ result = { type: "read", id, execId, path: readArgs.path };
166
+ break;
167
+ }
168
+ case 8: {
169
+ const lsArgs = parseLsArgs(field.value);
170
+ result = { type: "ls", id, execId, path: lsArgs.path };
171
+ break;
172
+ }
173
+ case 10: {
174
+ result = { type: "request_context", id, execId };
175
+ break;
176
+ }
177
+ case 11: {
178
+ const mcpArgs = parseMcpArgs(field.value);
179
+ result = { type: "mcp", id, execId, ...mcpArgs };
180
+ break;
181
+ }
182
+ }
183
+ if (result)
184
+ break;
185
+ }
186
+ return result;
187
+ }
188
+ function encodeMcpTextContent(text) {
189
+ return encodeStringField(1, text);
190
+ }
191
+ function encodeMcpToolResultContentItem(text) {
192
+ const textContent = encodeMcpTextContent(text);
193
+ return encodeMessageField(1, textContent);
194
+ }
195
+ function encodeMcpSuccess(content, isError = false) {
196
+ const parts = [];
197
+ const contentItem = encodeMcpToolResultContentItem(content);
198
+ parts.push(encodeMessageField(1, contentItem));
199
+ if (isError) {
200
+ parts.push(encodeBoolField(2, true));
201
+ }
202
+ return concatBytes(...parts);
203
+ }
204
+ function encodeMcpError(error) {
205
+ return encodeStringField(1, error);
206
+ }
207
+ function encodeMcpResult(result) {
208
+ if (result.success) {
209
+ const success = encodeMcpSuccess(result.success.content, result.success.isError);
210
+ return encodeMessageField(1, success);
211
+ }
212
+ if (result.error) {
213
+ const error = encodeMcpError(result.error);
214
+ return encodeMessageField(2, error);
215
+ }
216
+ return encodeMessageField(1, encodeMcpSuccess(""));
217
+ }
218
+ export function buildExecClientMessageWithMcpResult(id, execId, result) {
219
+ const parts = [];
220
+ parts.push(encodeUint32Field(1, id));
221
+ if (execId) {
222
+ parts.push(encodeStringField(15, execId));
223
+ }
224
+ const mcpResult = encodeMcpResult(result);
225
+ parts.push(encodeMessageField(11, mcpResult));
226
+ return concatBytes(...parts);
227
+ }
228
+ function encodeShellResult(command, cwd, stdout, stderr, exitCode, executionTimeMs) {
229
+ const shellOutcome = concatBytes(encodeStringField(1, command), encodeStringField(2, cwd), encodeInt32Field(3, exitCode), encodeStringField(4, ""), encodeStringField(5, stdout), encodeStringField(6, stderr), executionTimeMs ? encodeInt32Field(7, executionTimeMs) : new Uint8Array(0));
230
+ const resultField = exitCode === 0 ? 1 : 2;
231
+ return encodeMessageField(resultField, shellOutcome);
232
+ }
233
+ export function buildExecClientMessageWithShellResult(id, execId, command, cwd, stdout, stderr, exitCode, executionTimeMs) {
234
+ const parts = [];
235
+ parts.push(encodeUint32Field(1, id));
236
+ if (execId) {
237
+ parts.push(encodeStringField(15, execId));
238
+ }
239
+ parts.push(encodeMessageField(2, encodeShellResult(command, cwd, stdout, stderr, exitCode, executionTimeMs)));
240
+ return concatBytes(...parts);
241
+ }
242
+ function encodeLsResult(filesString) {
243
+ const lsSuccess = encodeStringField(1, filesString);
244
+ return encodeMessageField(1, lsSuccess);
245
+ }
246
+ export function buildExecClientMessageWithLsResult(id, execId, filesString) {
247
+ const parts = [];
248
+ parts.push(encodeUint32Field(1, id));
249
+ if (execId) {
250
+ parts.push(encodeStringField(15, execId));
251
+ }
252
+ parts.push(encodeMessageField(8, encodeLsResult(filesString)));
253
+ return concatBytes(...parts);
254
+ }
255
+ function encodeRequestContextResult() {
256
+ const cwd = process.cwd();
257
+ const osVersion = `darwin ${os.release()}`;
258
+ const timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
259
+ const shell = process.env.SHELL || "/bin/zsh";
260
+ const env = concatBytes(encodeStringField(1, osVersion), encodeStringField(2, cwd), encodeStringField(3, shell), encodeStringField(10, timeZone), encodeStringField(11, cwd));
261
+ const requestContext = encodeMessageField(4, env);
262
+ const success = encodeMessageField(1, requestContext);
263
+ return encodeMessageField(1, success);
264
+ }
265
+ export function buildExecClientMessageWithRequestContextResult(id, execId) {
266
+ const parts = [];
267
+ parts.push(encodeUint32Field(1, id));
268
+ if (execId) {
269
+ parts.push(encodeStringField(15, execId));
270
+ }
271
+ parts.push(encodeMessageField(10, encodeRequestContextResult()));
272
+ return concatBytes(...parts);
273
+ }
274
+ function encodeReadResult(content, path, totalLines, fileSize, truncated) {
275
+ const parts = [];
276
+ parts.push(encodeStringField(1, path));
277
+ parts.push(encodeStringField(2, content));
278
+ if (totalLines !== undefined && totalLines > 0) {
279
+ parts.push(encodeInt32Field(3, totalLines));
280
+ }
281
+ if (fileSize !== undefined) {
282
+ parts.push(encodeInt64Field(4, fileSize));
283
+ }
284
+ if (truncated) {
285
+ parts.push(encodeBoolField(6, true));
286
+ }
287
+ const readSuccess = concatBytes(...parts);
288
+ return encodeMessageField(1, readSuccess);
289
+ }
290
+ export function buildExecClientMessageWithReadResult(id, execId, content, path, totalLines, fileSize, truncated) {
291
+ const parts = [];
292
+ parts.push(encodeUint32Field(1, id));
293
+ if (execId) {
294
+ parts.push(encodeStringField(15, execId));
295
+ }
296
+ parts.push(encodeMessageField(7, encodeReadResult(content, path, totalLines, fileSize, truncated)));
297
+ return concatBytes(...parts);
298
+ }
299
+ function encodeGrepFilesResult(files, totalFiles, truncated = false) {
300
+ const parts = [];
301
+ for (const file of files) {
302
+ parts.push(encodeStringField(1, file));
303
+ }
304
+ parts.push(encodeInt32Field(2, totalFiles));
305
+ if (truncated) {
306
+ parts.push(encodeBoolField(3, true));
307
+ }
308
+ return concatBytes(...parts);
309
+ }
310
+ function encodeGrepUnionResult(files, totalFiles, truncated = false) {
311
+ const filesResult = encodeGrepFilesResult(files, totalFiles, truncated);
312
+ return encodeMessageField(2, filesResult);
313
+ }
314
+ function encodeGrepSuccess(pattern, path, files) {
315
+ const parts = [];
316
+ parts.push(encodeStringField(1, pattern));
317
+ parts.push(encodeStringField(2, path));
318
+ parts.push(encodeStringField(3, "files_with_matches"));
319
+ const unionResult = encodeGrepUnionResult(files, files.length);
320
+ const mapEntry = concatBytes(encodeStringField(1, path), encodeMessageField(2, unionResult));
321
+ parts.push(encodeMessageField(4, mapEntry));
322
+ return concatBytes(...parts);
323
+ }
324
+ function encodeGrepResult(pattern, path, files) {
325
+ const success = encodeGrepSuccess(pattern, path, files);
326
+ return encodeMessageField(1, success);
327
+ }
328
+ export function buildExecClientMessageWithGrepResult(id, execId, pattern, path, files) {
329
+ const parts = [];
330
+ parts.push(encodeUint32Field(1, id));
331
+ if (execId) {
332
+ parts.push(encodeStringField(15, execId));
333
+ }
334
+ parts.push(encodeMessageField(5, encodeGrepResult(pattern, path, files)));
335
+ return concatBytes(...parts);
336
+ }
337
+ function encodeWriteSuccess(path, linesCreated, fileSize, fileContentAfterWrite) {
338
+ const parts = [];
339
+ parts.push(encodeStringField(1, path));
340
+ parts.push(encodeInt32Field(2, linesCreated));
341
+ parts.push(encodeInt32Field(3, fileSize));
342
+ if (fileContentAfterWrite) {
343
+ parts.push(encodeStringField(4, fileContentAfterWrite));
344
+ }
345
+ return concatBytes(...parts);
346
+ }
347
+ function encodeWriteError(path, error) {
348
+ return concatBytes(encodeStringField(1, path), encodeStringField(2, error));
349
+ }
350
+ function encodeWriteResult(result) {
351
+ if (result.success) {
352
+ const success = encodeWriteSuccess(result.success.path, result.success.linesCreated, result.success.fileSize, result.success.fileContentAfterWrite);
353
+ return encodeMessageField(1, success);
354
+ }
355
+ if (result.error) {
356
+ const error = encodeWriteError(result.error.path, result.error.error);
357
+ return encodeMessageField(5, error);
358
+ }
359
+ return encodeMessageField(1, encodeWriteSuccess("", 0, 0));
360
+ }
361
+ export function buildExecClientMessageWithWriteResult(id, execId, result) {
362
+ const parts = [];
363
+ parts.push(encodeUint32Field(1, id));
364
+ if (execId) {
365
+ parts.push(encodeStringField(15, execId));
366
+ }
367
+ parts.push(encodeMessageField(3, encodeWriteResult(result)));
368
+ return concatBytes(...parts);
369
+ }
370
+ export function buildAgentClientMessageWithExec(execClientMessage) {
371
+ return encodeMessageField(2, execClientMessage);
372
+ }
373
+ function encodeExecClientStreamClose(id) {
374
+ return encodeUint32Field(1, id);
375
+ }
376
+ export function buildExecClientControlMessage(id) {
377
+ const streamClose = encodeExecClientStreamClose(id);
378
+ return encodeMessageField(1, streamClose);
379
+ }
380
+ export function buildAgentClientMessageWithExecControl(execClientControlMessage) {
381
+ return encodeMessageField(5, execClientControlMessage);
382
+ }
383
+ //# sourceMappingURL=exec.js.map