






















@@ -5,14 +5,14 @@ import {
55} from "./connection-bound-ids.js";
6677describe("github-copilot connection-bound response IDs", () => {
8-it("rewrites opaque response item IDs deterministically", () => {
9-const originalId = Buffer.from(`reasoning-${"x".repeat(24)}`).toString("base64");
10-const first = [{ id: originalId, type: "reasoning" }];
11-const second = [{ id: originalId, type: "reasoning" }];
8+it("rewrites opaque message response item IDs deterministically", () => {
9+const originalId = Buffer.from(`message-${"x".repeat(24)}`).toString("base64");
10+const first = [{ id: originalId, type: "message" }];
11+const second = [{ id: originalId, type: "message" }];
12121313expect(rewriteCopilotConnectionBoundResponseIds(first)).toBe(true);
1414expect(rewriteCopilotConnectionBoundResponseIds(second)).toBe(true);
15-expect(first[0]?.id).toMatch(/^rs_[a-f0-9]{16}$/);
15+expect(first[0]?.id).toMatch(/^msg_[a-f0-9]{16}$/);
1616expect(first[0]?.id).toBe(second[0]?.id);
1717});
1818@@ -35,26 +35,20 @@ describe("github-copilot connection-bound response IDs", () => {
3535expect(input[4]?.id).toMatch(/^msg_[a-f0-9]{16}$/);
3636});
373738-it("preserves reasoning IDs when encrypted_content is present", () => {
39-const originalId = Buffer.from(`reasoning-${"e".repeat(24)}`).toString("base64");
38+it("preserves reasoning IDs regardless of encrypted_content", () => {
39+const withEncrypted = Buffer.from(`reasoning-${"e".repeat(24)}`).toString("base64");
40+const withNull = Buffer.from(`reasoning-${"n".repeat(24)}`).toString("base64");
41+const withoutField = Buffer.from(`reasoning-${"a".repeat(24)}`).toString("base64");
4042const input = [
41-{
42-id: originalId,
43-type: "reasoning",
44-encrypted_content: "opaque-encrypted-payload",
45-},
43+{ id: withEncrypted, type: "reasoning", encrypted_content: "opaque-encrypted-payload" },
44+{ id: withNull, type: "reasoning", encrypted_content: null },
45+{ id: withoutField, type: "reasoning" },
4646];
47474848expect(rewriteCopilotConnectionBoundResponseIds(input)).toBe(false);
49-expect(input[0]?.id).toBe(originalId);
50-});
51-52-it("still rewrites reasoning IDs when encrypted_content is absent", () => {
53-const originalId = Buffer.from(`reasoning-${"n".repeat(24)}`).toString("base64");
54-const input = [{ id: originalId, type: "reasoning" }];
55-56-expect(rewriteCopilotConnectionBoundResponseIds(input)).toBe(true);
57-expect(input[0]?.id).toMatch(/^rs_[a-f0-9]{16}$/);
49+expect(input[0]?.id).toBe(withEncrypted);
50+expect(input[1]?.id).toBe(withNull);
51+expect(input[2]?.id).toBe(withoutField);
5852});
59536054it("patches response payload input arrays only", () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。