fix(cursor): address remaining LOW review items in protobuf module

This commit is contained in:
Tam Nhu Tran
2026-02-12 01:06:33 +07:00
parent 31f574118d
commit f3d532afd9
2 changed files with 3 additions and 0 deletions
+2
View File
@@ -83,6 +83,7 @@ async function getHttp2() {
/**
* Decompress payload if needed
* NOTE: Uses synchronous gzip for single-request CLI tool. Async not warranted for small payloads.
*/
function decompressPayload(payload: Buffer, flags: number): Buffer {
// Check if payload is JSON error
@@ -556,6 +557,7 @@ export class CursorExecutor {
transformProtobufToSSE(buffer: Buffer, model: string, _body: ExecutorParams['body']): Response {
// TODO: Implement true streaming — currently buffers entire response before transforming.
// This should pipe HTTP/2 data events through a TransformStream for incremental SSE output.
// NOTE: Chunk boundary splits may emit duplicate SSE messages if a frame spans multiple chunks.
const responseId = `chatcmpl-cursor-${Date.now()}`;
const created = Math.floor(Date.now() / 1000);
+1
View File
@@ -83,6 +83,7 @@ export function decodeMessage(
const fields = new Map<number, Array<{ wireType: WireType; value: Uint8Array | number }>>();
let pos = 0;
// NOTE: If two fields share the same field number but different wire types, later values overwrite earlier ones.
while (pos < data.length) {
const [fieldNum, wireType, value, newPos] = decodeField(data, pos);
if (fieldNum === null || wireType === null || value === null) break;