feat(client): advertise reasoning merge capability

This commit is contained in:
Mohamed Boudra
2026-05-02 20:30:25 +07:00
parent ee1c7e6956
commit ca318f29cf
3 changed files with 73 additions and 4 deletions
@@ -60,10 +60,12 @@ function createMockTransport() {
return {
transport,
sent,
triggerOpen: () => {
triggerOpen: (options?: { preserveSent?: boolean }) => {
onOpen();
// Ignore HELLO handshake payloads in assertions.
sent.length = 0;
if (!options?.preserveSent) {
// Ignore HELLO handshake payloads in assertions.
sent.length = 0;
}
onMessage(
JSON.stringify({
type: "session",
@@ -214,6 +216,35 @@ test("passes password as HTTP bearer header and WebSocket subprotocol", async ()
});
});
test("advertises reasoning_merge_enum in hello", async () => {
const logger = createMockLogger();
const mock = createMockTransport();
const client = new DaemonClient({
url: "ws://test",
clientId: "clsk_unit_test",
logger,
reconnect: { enabled: false },
transportFactory: () => mock.transport,
});
clients.push(client);
const connectPromise = client.connect();
mock.triggerOpen({ preserveSent: true });
await connectPromise;
expect(mock.sent).toHaveLength(1);
expect(JSON.parse(mock.sent[0] as string)).toEqual({
type: "hello",
clientId: "clsk_unit_test",
clientType: "cli",
protocolVersion: 1,
capabilities: {
reasoning_merge_enum: true,
},
});
});
test("does not reconnect after close when ensureConnected is called", async () => {
const logger = createMockLogger();
const mock = createMockTransport();
@@ -1,4 +1,5 @@
import type { z } from "zod";
import { CLIENT_CAPS } from "../shared/client-capabilities.js";
import {
AgentCreateFailedStatusPayloadSchema,
AgentCreatedStatusPayloadSchema,
@@ -3877,6 +3878,9 @@ export class DaemonClient {
clientId: this.config.clientId,
clientType: this.config.clientType ?? "cli",
protocolVersion: 1,
capabilities: {
[CLIENT_CAPS.reasoningMergeEnum]: true,
},
...(this.config.appVersion ? { appVersion: this.config.appVersion } : {}),
}),
);