From 1eee02455ca8f96e26d43fbf13f28a90088c1112 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 31 Aug 2026 16:07:41 +0000 Subject: [PATCH] fix: bump COSY client identity to qodercli 1.1.38 Older Cosy-Version / cosyVersion values cause the model catalog and gateway to treat the client as a stale qodercli and return a reduced list. Align QoderIDEVersion with current CLI 1.1.38. Leave PAT exchange and userinfo Cosy-Version at 1.0.1: those openapi endpoints do not use a COSY signature, and I could not verify that official qodercli 1.1.38 changed them. Co-authored-by: Simon Shi --- src/__tests__/cosy.test.ts | 20 ++++++++++++++++++++ src/cosy.ts | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/__tests__/cosy.test.ts b/src/__tests__/cosy.test.ts index b1197c1..ddeaa7c 100644 --- a/src/__tests__/cosy.test.ts +++ b/src/__tests__/cosy.test.ts @@ -1,5 +1,6 @@ import { describe, expect, it } from "vitest"; import { + buildAuthHeaders, getQoderBaseUrl, getQoderCenterUrl, getQoderChatURL, @@ -178,3 +179,22 @@ describe("toQoderCNModelId", () => { expect(toQoderCNModelId("")).toBe("QoderCNModel"); }); }); + +describe("COSY client identity", () => { + it("sends Cosy-Version and cosyVersion as current qodercli 1.1.38", () => { + const headers = buildAuthHeaders(null, "https://api3.qoder.sh/algo/api/v2/model/list", { + userID: "user-1", + authToken: "token-1", + name: "Test", + email: "test@example.com", + machineID: "machine-1", + }); + expect(headers["Cosy-Version"]).toBe("1.1.38"); + + const auth = headers.Authorization; + expect(auth.startsWith("Bearer COSY.")).toBe(true); + const payloadB64 = auth.slice("Bearer COSY.".length).split(".")[0]; + const payload = JSON.parse(Buffer.from(payloadB64, "base64").toString("utf8")) as { cosyVersion: string }; + expect(payload.cosyVersion).toBe("1.1.38"); + }); +}); diff --git a/src/cosy.ts b/src/cosy.ts index 6bdd242..7f436ff 100644 --- a/src/cosy.ts +++ b/src/cosy.ts @@ -12,7 +12,7 @@ XcW+ML9FoCI6AOvOzwIDAQAB // Keep the COSY client identity aligned with the current Qoder CLI catalog // protocol. Older values cause the model endpoint to return a reduced list. -const QoderIDEVersion = "1.1.3"; +const QoderIDEVersion = "1.1.38"; const QoderClientType = "5"; const QoderDataPolicy = "disagree"; const QoderLoginVersion = "v2";