mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-09-04 10:11:46 +03:00
fix(tui): preserve slash command semantics
This commit is contained in:
@@ -238,6 +238,7 @@ describe("gateway protocol", () => {
|
||||
title: "History",
|
||||
description: "Show recent messages",
|
||||
argHint: "[n]",
|
||||
lifecycle: "side_channel",
|
||||
acceptsArgs: true,
|
||||
}])
|
||||
expect(authorization).toBe("Bearer secret")
|
||||
@@ -246,6 +247,24 @@ describe("gateway protocol", () => {
|
||||
}
|
||||
})
|
||||
|
||||
test("drops slash commands with unknown lifecycle metadata", async () => {
|
||||
const original = globalThis.fetch
|
||||
globalThis.fetch = (() => Promise.resolve(new Response(JSON.stringify({
|
||||
commands: [{
|
||||
command: "/future",
|
||||
title: "Future",
|
||||
description: "Unknown lifecycle",
|
||||
lifecycle: "future_mode",
|
||||
}],
|
||||
})))) as unknown as typeof fetch
|
||||
|
||||
try {
|
||||
expect(await fetchSlashCommands("http://nanobot.test", "secret")).toEqual([])
|
||||
} finally {
|
||||
globalThis.fetch = original
|
||||
}
|
||||
})
|
||||
|
||||
test("loads and normalizes WebUI sessions", async () => {
|
||||
const original = globalThis.fetch
|
||||
globalThis.fetch = (() => Promise.resolve(new Response(JSON.stringify({
|
||||
|
||||
Reference in New Issue
Block a user