mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
Show skill autocomplete anywhere in prompts
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, test } from "vitest";
|
||||
import { SessionInboundMessageSchema } from "./messages.js";
|
||||
import { SessionInboundMessageSchema, SessionOutboundMessageSchema } from "./messages.js";
|
||||
|
||||
describe("list_commands_request schema", () => {
|
||||
test("accepts legacy agent-only payload", () => {
|
||||
@@ -49,4 +49,61 @@ describe("list_commands_request schema", () => {
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test("preserves command kind metadata in responses", () => {
|
||||
const parsed = SessionOutboundMessageSchema.parse({
|
||||
type: "list_commands_response",
|
||||
payload: {
|
||||
agentId: "agent-123",
|
||||
requestId: "req-123",
|
||||
error: null,
|
||||
commands: [
|
||||
{
|
||||
name: "taste",
|
||||
description: "Apply code taste",
|
||||
argumentHint: "",
|
||||
kind: "skill",
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
expect(parsed.type).toBe("list_commands_response");
|
||||
if (parsed.type !== "list_commands_response") {
|
||||
throw new Error("Expected list_commands_response message");
|
||||
}
|
||||
expect(parsed.payload.commands).toEqual([
|
||||
{
|
||||
name: "taste",
|
||||
description: "Apply code taste",
|
||||
argumentHint: "",
|
||||
kind: "skill",
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
test("falls back to command for unknown future command kinds", () => {
|
||||
const parsed = SessionOutboundMessageSchema.parse({
|
||||
type: "list_commands_response",
|
||||
payload: {
|
||||
agentId: "agent-123",
|
||||
requestId: "req-123",
|
||||
error: null,
|
||||
commands: [
|
||||
{
|
||||
name: "future-command",
|
||||
description: "Future command kind",
|
||||
argumentHint: "",
|
||||
kind: "future-kind",
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
expect(parsed.type).toBe("list_commands_response");
|
||||
if (parsed.type !== "list_commands_response") {
|
||||
throw new Error("Expected list_commands_response message");
|
||||
}
|
||||
expect(parsed.payload.commands[0]?.kind).toBe("command");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3557,6 +3557,7 @@ const AgentSlashCommandSchema = z.object({
|
||||
name: z.string(),
|
||||
description: z.string(),
|
||||
argumentHint: z.string(),
|
||||
kind: z.enum(["command", "skill"]).optional().catch("command"),
|
||||
});
|
||||
|
||||
export const ListCommandsResponseSchema = z.object({
|
||||
|
||||
Reference in New Issue
Block a user