mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-01 14:12:51 +00:00
fix(acp): preserve slash command argument hints (#6920)
ACP command updates discarded input hints before the autocomplete command list reached consumers. Preserve the advertised hint, retaining the empty hint for commands without input metadata. Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com> Co-authored-by: bwestlund17 <brian.westlund@proton.me>
This commit is contained in:
co-authored by
bwestlund17
parent
d3efddb0b5
commit
4d5c3c13d4
@@ -3098,7 +3098,7 @@ export class ACPAgentSession implements AgentSession, ACPClient {
|
||||
this.cachedCommands = update.availableCommands.map((command) => ({
|
||||
name: command.name,
|
||||
description: command.description,
|
||||
argumentHint: "",
|
||||
argumentHint: command.input?.hint ?? "",
|
||||
kind: "command",
|
||||
}));
|
||||
this.settleCommandsReady();
|
||||
|
||||
@@ -8,7 +8,7 @@ import { createTestLogger } from "../../../test-utils/test-logger.js";
|
||||
import { GenericACPAgentClient } from "./generic-acp-agent.js";
|
||||
|
||||
describe("GenericACPAgentClient slash commands", () => {
|
||||
test("lists commands an agent advertises right after session/new", async () => {
|
||||
test("preserves argument hints in commands advertised right after session/new", async () => {
|
||||
await withFakeACPAgent("commands-after-session-new", async (command, cwd) => {
|
||||
const client = new GenericACPAgentClient({
|
||||
logger: createTestLogger(),
|
||||
@@ -17,9 +17,17 @@ describe("GenericACPAgentClient slash commands", () => {
|
||||
});
|
||||
const session = await client.createSession({ provider: "acp", cwd });
|
||||
try {
|
||||
await expect(session.listCommands?.()).resolves.toEqual([
|
||||
{ name: "review", description: "Review the diff", argumentHint: "", kind: "command" },
|
||||
]);
|
||||
const commands = [
|
||||
{
|
||||
name: "review",
|
||||
description: "Review the diff",
|
||||
argumentHint: "query",
|
||||
kind: "command",
|
||||
},
|
||||
{ name: "status", description: "Show status", argumentHint: "", kind: "command" },
|
||||
];
|
||||
await expect(session.listCommands?.()).resolves.toEqual(commands);
|
||||
await expect(session.listCommands?.()).resolves.toEqual(commands);
|
||||
} finally {
|
||||
await session.close();
|
||||
}
|
||||
@@ -91,7 +99,10 @@ rl.on("line", (line) => {
|
||||
sessionId: "session-1",
|
||||
update: {
|
||||
sessionUpdate: "available_commands_update",
|
||||
availableCommands: [{ name: "review", description: "Review the diff" }],
|
||||
availableCommands: [
|
||||
{ name: "review", description: "Review the diff", input: { hint: "query" } },
|
||||
{ name: "status", description: "Show status" },
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user