feat(simulation): add endpoint handshake protocol (#37157)
This commit is contained in:
parent
f92d84746b
commit
5e2e0d6965
8 changed files with 350 additions and 2 deletions
|
|
@ -19,6 +19,30 @@ test("scopes the frontend control server and reports malformed JSON", async () =
|
|||
Queue.offerUnsafe(messages, JSON.parse(String(event.data)))
|
||||
})
|
||||
|
||||
socket.send(
|
||||
JSON.stringify({
|
||||
jsonrpc: "2.0",
|
||||
id: 0,
|
||||
method: "simulation.handshake",
|
||||
params: {
|
||||
client: { name: "test", version: "test" },
|
||||
expectedRole: "ui",
|
||||
offeredVersions: [1],
|
||||
requiredCapabilities: ["ui.state"],
|
||||
optionalCapabilities: [],
|
||||
},
|
||||
}),
|
||||
)
|
||||
expect(yield* Queue.take(messages)).toMatchObject({
|
||||
id: 0,
|
||||
result: {
|
||||
protocolVersion: 1,
|
||||
role: "ui",
|
||||
server: { name: "opencode", version: expect.any(String) },
|
||||
capabilities: expect.arrayContaining(["ui.state", "ui.capture"]),
|
||||
},
|
||||
})
|
||||
|
||||
socket.send(JSON.stringify({ jsonrpc: "2.0", id: 1, method: "ui.state" }))
|
||||
expect(yield* Queue.take(messages)).toMatchObject({
|
||||
id: 1,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue