Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openrouter/spawn",
"version": "0.28.1",
"version": "0.28.2",
"type": "module",
"bin": {
"spawn": "cli.js"
Expand Down
18 changes: 9 additions & 9 deletions packages/cli/src/__tests__/cursor-proxy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,29 +228,29 @@ describe("AgentServerMessage encoding", () => {

describe("ModelDetails encoding", () => {
it("encodes model with all required fields", () => {
const model = bmd("claude-4-sonnet", "Claude Sonnet 4");
const model = bmd("anthropic/claude-sonnet-4-6", "Claude Sonnet 4.6");
const strings: string[] = [];
xstr(model, strings);
expect(strings).toContain("claude-4-sonnet");
expect(strings).toContain("Claude Sonnet 4");
expect(strings).toContain("anthropic/claude-sonnet-4-6");
expect(strings).toContain("Claude Sonnet 4.6");
});

it("encodes model list response", () => {
const models = [
[
"claude-4-sonnet",
"Claude 4",
"anthropic/claude-sonnet-4-6",
"Claude Sonnet 4.6",
],
[
"gpt-4o",
"GPT-4o",
"openai/gpt-5.4",
"GPT-5.4",
],
];
const response = Buffer.concat(models.map(([id, name]) => em(1, bmd(id, name))));
const strings: string[] = [];
xstr(response, strings);
expect(strings).toContain("claude-4-sonnet");
expect(strings).toContain("gpt-4o");
expect(strings).toContain("anthropic/claude-sonnet-4-6");
expect(strings).toContain("openai/gpt-5.4");
});
});

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/shared/cursor-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ function ct(){const j=Buffer.from("{}");const t=Buffer.alloc(5+j.length);t[0]=2;
function tdf(t){return cf(em(1,em(1,es(1,t))));}
function tef(){return cf(em(1,em(14,Buffer.from([8,10,16,5]))));}
function bmd(id,n){return Buffer.concat([es(1,id),es(3,id),es(4,n),es(5,n)]);}
function bmr(){return Buffer.concat([["anthropic/claude-sonnet-4","Claude Sonnet 4"],["openai/gpt-4o","GPT-4o"],["google/gemini-2.5-flash","Gemini 2.5 Flash"]].map(([i,n])=>em(1,bmd(i,n))));}
function bdr(){return em(1,bmd("anthropic/claude-sonnet-4","Claude Sonnet 4"));}
function bmr(){return Buffer.concat([["anthropic/claude-sonnet-4-6","Claude Sonnet 4.6"],["anthropic/claude-haiku-4-5","Claude Haiku 4.5"],["openai/gpt-5.4","GPT-5.4"],["google/gemini-3.5-pro","Gemini 3.5 Pro"],["google/gemini-3.5-flash","Gemini 3.5 Flash"]].map(([i,n])=>em(1,bmd(i,n))));}
function bdr(){return em(1,bmd("anthropic/claude-sonnet-4-6","Claude Sonnet 4.6"));}
function xstr(buf,out){let o=0;while(o<buf.length){let t=0,s=0;while(o<buf.length){const b=buf[o++];t|=(b&0x7f)<<s;s+=7;if(!(b&0x80))break;}const wt=t&7;if(wt===0){while(o<buf.length&&buf[o++]&0x80);}else if(wt===2){let l=0,s=0;while(o<buf.length){const b=buf[o++];l|=(b&0x7f)<<s;s+=7;if(!(b&0x80))break;}const d=buf.slice(o,o+l);o+=l;const st=d.toString("utf8");if(/^[\\x20-\\x7e]+$/.test(st))out.push(st);else try{xstr(d,out);}catch(e){}}else break;}}
`.trim();

Expand Down
Loading