Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 10 additions & 0 deletions src/webview/host/createVsCodeHostPorts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export function createVsCodeHostPorts(
"runtime.steerRun": nativeAvailability(hasNativeMethod("run/steer")),
"runtime.replayRun": nativeAvailability(hasNativeMethod("run/replay")),
"runtime.compactContext": nativeAvailability(hasNativeMethod("context/compact")),
"interactive.clarification": nativeAvailability(hasNativeMethod("clarification/respond")),
"runtime.events": "available",
"sessions.list": nativeAvailability(hasNativeMethod("sessions/list")),
"sessions.get": nativeAvailability(hasNativeMethod("sessions/get")),
Expand Down Expand Up @@ -129,6 +130,7 @@ export function createVsCodeHostPorts(
"settings.get": "deferred",
"settings.update": "deferred",
"interactive.permissionModes": "deferred",
"interactive.clarification": "deferred",
"workspace.info": "deferred",
"workspace.activeFile": "deferred",
"workspace.selection": "deferred",
Expand Down Expand Up @@ -190,6 +192,14 @@ export function createVsCodeHostPorts(
requireReady(isHostReady);
await transport.request("context/compact", { chat_id: input.chatId });
},
async respondToClarification(input) {
requireReady(isHostReady);
await transport.request("clarification/respond", {
chat_id: input.chatId,
action: input.action,
...(input.action === "reply" ? { text: input.text ?? "" } : {}),
});
Comment on lines +199 to +203

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛑 Logic Error: The ticketId parameter from the input is not being forwarded to the RPC call. The test at line 172 in the test file passes ticketId: "ticket_1", but this parameter is ignored in the implementation. If the backend expects this parameter, this will cause incorrect behavior or failures.

Suggested change
await transport.request("clarification/respond", {
chat_id: input.chatId,
action: input.action,
...(input.action === "reply" ? { text: input.text ?? "" } : {}),
});
await transport.request("clarification/respond", {
chat_id: input.chatId,
ticket_id: input.ticketId,
action: input.action,
...(input.action === "reply" ? { text: input.text ?? "" } : {}),
});

},
async shutdown() {
// Native host lifecycle is owned by the Extension Host.
},
Expand Down
13 changes: 13 additions & 0 deletions test/unit/createVsCodeHostPorts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ describe("createVsCodeHostPorts", () => {
if (method === "context/compact") {
return { accepted: true };
}
if (method === "clarification/respond") {
return { accepted: true };
}
throw new Error(`unexpected native method ${method}`);
});
transport.requestWorkspace.mockImplementation(async (method, _params) => {
Expand Down Expand Up @@ -133,6 +136,7 @@ describe("createVsCodeHostPorts", () => {
expect(byId["review.checkpoints"]).toBe("available");
expect(byId["settings.update"]).toBe("available");
expect(byId["runtime.compactContext"]).toBe("available");
expect(byId["interactive.clarification"]).toBe("available");
await expect(ports.workspace.getActiveFile()).resolves.toMatchObject({
path: "/workspace/a.ts",
});
Expand Down Expand Up @@ -163,6 +167,15 @@ describe("createVsCodeHostPorts", () => {
expect(transport.request).toHaveBeenCalledWith("context/compact", {
chat_id: "chat_1",
});
await ports.runtime.respondToClarification({
chatId: "chat_1",
ticketId: "ticket_1",
action: "dismiss",
});
expect(transport.request).toHaveBeenCalledWith("clarification/respond", {
chat_id: "chat_1",
action: "dismiss",
});
expect(transport.requestWorkspace).toHaveBeenCalledWith("searchFiles", {
query: "a.ts",
});
Expand Down
Loading