fix(protocol): expose MCP tool change events (#35373)
This commit is contained in:
parent
b8efb33cde
commit
bb3b6a2f65
4 changed files with 33 additions and 1 deletions
23
packages/protocol/test/event.test.ts
Normal file
23
packages/protocol/test/event.test.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { expect, test } from "bun:test"
|
||||
import { Event } from "@opencode-ai/schema/event"
|
||||
import { AbsolutePath } from "@opencode-ai/schema/schema"
|
||||
import { DateTime, Schema } from "effect"
|
||||
import { OpenCodeEvent } from "../src/groups/event.js"
|
||||
|
||||
test("encodes MCP tool changes emitted by the server", () => {
|
||||
expect(
|
||||
Schema.encodeSync(OpenCodeEvent)({
|
||||
id: Event.ID.make("evt_test"),
|
||||
created: DateTime.makeUnsafe(0),
|
||||
type: "mcp.tools.changed",
|
||||
location: { directory: AbsolutePath.make("/tmp") },
|
||||
data: { server: "example" },
|
||||
}),
|
||||
).toEqual({
|
||||
id: "evt_test",
|
||||
created: 0,
|
||||
type: "mcp.tools.changed",
|
||||
location: { directory: "/tmp" },
|
||||
data: { server: "example" },
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue