MCPcopy
hub / github.com/CopilotKit/CopilotKit / runOnMessage

Function runOnMessage

packages/bot/src/thread-ephemeral.test.ts:5–14  ·  view source on GitHub ↗
(
  fake: FakeAdapter,
  fn: Parameters<ReturnType<typeof createBot>["onMessage"]>[0],
)

Source from the content-addressed store, hash-verified

3import { FakeAdapter } from "./testing/fake-adapter.js";
4
5async function runOnMessage(
6 fake: FakeAdapter,
7 fn: Parameters<ReturnType<typeof createBot>["onMessage"]>[0],
8) {
9 const bot = createBot({ adapters: [fake] });
10 bot.onMessage(fn);
11 await bot.start();
12 fake.emitTurn({ userText: "hi", user: { id: "U1" } });
13 await new Promise((r) => setTimeout(r, 0));
14}
15
16describe("Thread.postEphemeral", () => {
17 it("posts natively when the surface supports it (usedFallback=false)", async () => {

Callers 1

Calls 4

createBotFunction · 0.85
emitTurnMethod · 0.80
onMessageMethod · 0.65
startMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…