mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-09-04 10:11:46 +03:00
feat(tui): integrate with Herdr host
This commit is contained in:
@@ -243,19 +243,34 @@ describe("gateway protocol", () => {
|
||||
socket.emit("message", {
|
||||
data: JSON.stringify({ event: "attached", chat_id: "one", model_preset: 42 }),
|
||||
})
|
||||
socket.emit("message", {
|
||||
data: JSON.stringify({ event: "turn_end", chat_id: "one", goal_state: [] }),
|
||||
})
|
||||
socket.emit("message", {
|
||||
data: JSON.stringify({ event: "session_updated", chat_id: "one", scope: "metadata" }),
|
||||
})
|
||||
socket.emit("message", {
|
||||
data: JSON.stringify({
|
||||
event: "turn_end",
|
||||
chat_id: "one",
|
||||
goal_state: { active: false, status: "blocked", ui_summary: "Approval required" },
|
||||
}),
|
||||
})
|
||||
socket.emit("message", { data: JSON.stringify({ event: "future_gateway_event" }) })
|
||||
socket.emit("message", { data: JSON.stringify({ event: "error", detail: "global failure" }) })
|
||||
expect(statuses).toContain("error:gateway sent an invalid event")
|
||||
expect(statuses.filter((status) => status.includes("invalid event"))).toHaveLength(8)
|
||||
expect(statuses.filter((status) => status.includes("invalid event"))).toHaveLength(9)
|
||||
expect(events).toContainEqual({
|
||||
event: "session_updated",
|
||||
chat_id: "one",
|
||||
scope: "metadata",
|
||||
})
|
||||
expect(events).toContainEqual({ event: "error", detail: "global failure" })
|
||||
expect(events).toContainEqual({
|
||||
event: "turn_end",
|
||||
chat_id: "one",
|
||||
goal_state: { active: false, status: "blocked", ui_summary: "Approval required" },
|
||||
})
|
||||
} finally {
|
||||
Object.defineProperty(globalThis, "WebSocket", { configurable: true, value: original })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user