


























@@ -20,6 +20,7 @@ describe("cli-session helpers", () => {
2020sessionId: "cli-session-1",
2121authProfileId: "anthropic:work",
2222authEpoch: "auth-epoch",
23+authEpochVersion: 2,
2324extraSystemPromptHash: "prompt-hash",
2425mcpConfigHash: "mcp-hash",
2526mcpResumeHash: "mcp-resume-hash",
@@ -31,6 +32,7 @@ describe("cli-session helpers", () => {
3132sessionId: "cli-session-1",
3233authProfileId: "anthropic:work",
3334authEpoch: "auth-epoch",
35+authEpochVersion: 2,
3436extraSystemPromptHash: "prompt-hash",
3537mcpConfigHash: "mcp-hash",
3638mcpResumeHash: "mcp-resume-hash",
@@ -84,6 +86,7 @@ describe("cli-session helpers", () => {
8486sessionId: "cli-session-1",
8587authProfileId: "anthropic:work",
8688authEpoch: "auth-epoch-a",
89+authEpochVersion: 2,
8790extraSystemPromptHash: "prompt-a",
8891mcpConfigHash: "mcp-a",
8992};
@@ -93,6 +96,7 @@ describe("cli-session helpers", () => {
9396 binding,
9497authProfileId: "anthropic:personal",
9598authEpoch: "auth-epoch-a",
99+authEpochVersion: 2,
96100extraSystemPromptHash: "prompt-a",
97101mcpConfigHash: "mcp-a",
98102}),
@@ -102,6 +106,7 @@ describe("cli-session helpers", () => {
102106 binding,
103107authProfileId: "anthropic:work",
104108authEpoch: "auth-epoch-b",
109+authEpochVersion: 2,
105110extraSystemPromptHash: "prompt-a",
106111mcpConfigHash: "mcp-a",
107112}),
@@ -111,6 +116,7 @@ describe("cli-session helpers", () => {
111116 binding,
112117authProfileId: "anthropic:work",
113118authEpoch: "auth-epoch-a",
119+authEpochVersion: 2,
114120extraSystemPromptHash: "prompt-b",
115121mcpConfigHash: "mcp-a",
116122}),
@@ -120,17 +126,40 @@ describe("cli-session helpers", () => {
120126 binding,
121127authProfileId: "anthropic:work",
122128authEpoch: "auth-epoch-a",
129+authEpochVersion: 2,
123130extraSystemPromptHash: "prompt-a",
124131mcpConfigHash: "mcp-b",
125132}),
126133).toEqual({ invalidatedReason: "mcp" });
127134});
128135136+it("accepts unversioned auth epochs for binding upgrades", () => {
137+const binding = {
138+sessionId: "cli-session-1",
139+authProfileId: "anthropic:work",
140+authEpoch: "previous-auth-epoch",
141+extraSystemPromptHash: "prompt-a",
142+mcpConfigHash: "mcp-a",
143+};
144+145+expect(
146+resolveCliSessionReuse({
147+ binding,
148+authProfileId: "anthropic:work",
149+authEpoch: "auth-epoch-a",
150+authEpochVersion: 2,
151+extraSystemPromptHash: "prompt-a",
152+mcpConfigHash: "mcp-a",
153+}),
154+).toEqual({ sessionId: "cli-session-1" });
155+});
156+129157it("does not treat model changes as a session mismatch", () => {
130158const binding = {
131159sessionId: "cli-session-1",
132160authProfileId: "anthropic:work",
133161authEpoch: "auth-epoch-a",
162+authEpochVersion: 2,
134163extraSystemPromptHash: "prompt-a",
135164mcpConfigHash: "mcp-a",
136165};
@@ -140,6 +169,7 @@ describe("cli-session helpers", () => {
140169 binding,
141170authProfileId: "anthropic:work",
142171authEpoch: "auth-epoch-a",
172+authEpochVersion: 2,
143173extraSystemPromptHash: "prompt-a",
144174mcpConfigHash: "mcp-a",
145175}),
@@ -151,6 +181,7 @@ describe("cli-session helpers", () => {
151181sessionId: "cli-session-1",
152182authProfileId: "anthropic:work",
153183authEpoch: "auth-epoch-a",
184+authEpochVersion: 2,
154185extraSystemPromptHash: "prompt-a",
155186mcpConfigHash: "mcp-config-a",
156187mcpResumeHash: "mcp-resume-a",
@@ -161,6 +192,7 @@ describe("cli-session helpers", () => {
161192 binding,
162193authProfileId: "anthropic:work",
163194authEpoch: "auth-epoch-a",
195+authEpochVersion: 2,
164196extraSystemPromptHash: "prompt-a",
165197mcpConfigHash: "mcp-config-b",
166198mcpResumeHash: "mcp-resume-a",
@@ -171,6 +203,7 @@ describe("cli-session helpers", () => {
171203 binding,
172204authProfileId: "anthropic:work",
173205authEpoch: "auth-epoch-a",
206+authEpochVersion: 2,
174207extraSystemPromptHash: "prompt-a",
175208mcpConfigHash: "mcp-config-a",
176209mcpResumeHash: "mcp-resume-b",
@@ -183,6 +216,7 @@ describe("cli-session helpers", () => {
183216sessionId: "cli-session-1",
184217authProfileId: "anthropic:work",
185218authEpoch: "auth-epoch-a",
219+authEpochVersion: 2,
186220extraSystemPromptHash: "prompt-a",
187221mcpConfigHash: "mcp-config-a",
188222};
@@ -192,6 +226,7 @@ describe("cli-session helpers", () => {
192226 binding,
193227authProfileId: "anthropic:work",
194228authEpoch: "auth-epoch-a",
229+authEpochVersion: 2,
195230extraSystemPromptHash: "prompt-a",
196231mcpConfigHash: "mcp-config-a",
197232mcpResumeHash: "mcp-resume-a",
@@ -202,6 +237,7 @@ describe("cli-session helpers", () => {
202237 binding,
203238authProfileId: "anthropic:work",
204239authEpoch: "auth-epoch-a",
240+authEpochVersion: 2,
205241extraSystemPromptHash: "prompt-a",
206242mcpConfigHash: "mcp-config-b",
207243mcpResumeHash: "mcp-resume-a",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。