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 <simonsmh@users.noreply.github.com>
This commit is contained in:
Cursor Agent
2026-08-31 16:07:41 +00:00
co-authored by Simon Shi
parent e7b5990e5c
commit 1eee02455c
2 changed files with 21 additions and 1 deletions
+20
View File
@@ -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");
});
});