
























@@ -925,13 +925,34 @@ describe("capability cli", () => {
925925});
926926927927const gatewayCall = firstGatewayCall();
928-const sessionId = String(gatewayCall?.params?.sessionId ?? "");
928+const sessionId = gatewayCall?.params?.sessionId;
929929expect(gatewayCall?.method).toBe("agent");
930+expect(typeof sessionId).toBe("string");
931+if (typeof sessionId !== "string") {
932+throw new Error("expected gateway model run session id");
933+}
930934expect(sessionId).toEqual(expect.stringMatching(/^model-run-[0-9a-f-]{36}$/));
931935expect(gatewayCall?.params?.sessionKey).toBe(`agent:main:explicit:${sessionId}`);
932936expect(gatewayCall?.params?.cleanupBundleMcpOnRunEnd).toBe(true);
933937expect(gatewayCall?.params?.modelRun).toBe(true);
934938expect(gatewayCall?.params?.promptMode).toBe("none");
939+940+await runRegisteredCli({
941+register: registerCapabilityCli as (program: Command) => void,
942+argv: ["capability", "model", "run", "--prompt", "again", "--gateway", "--json"],
943+});
944+945+const gatewayCalls = mocks.callGateway.mock.calls as unknown as Array<[GatewayCall]>;
946+const nextGatewayCall = gatewayCalls[1]?.[0];
947+const nextSessionId = nextGatewayCall?.params?.sessionId;
948+expect(nextGatewayCall?.method).toBe("agent");
949+expect(typeof nextSessionId).toBe("string");
950+if (typeof nextSessionId !== "string") {
951+throw new Error("expected second gateway model run session id");
952+}
953+expect(nextSessionId).toEqual(expect.stringMatching(/^model-run-[0-9a-f-]{36}$/));
954+expect(nextGatewayCall?.params?.sessionKey).toBe(`agent:main:explicit:${nextSessionId}`);
955+expect(nextSessionId).not.toBe(sessionId);
935956});
936957937958it("surfaces gateway model fallback attempts in model probe JSON", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。