MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / waitForEvent

Function waitForEvent

packages/agent-core/test/harness/skill-session.test.ts:706–717  ·  view source on GitHub ↗
(
  events: readonly Event[],
  predicate: (event: Event) => boolean,
)

Source from the content-addressed store, hash-verified

704});
705
706async function waitForEvent(
707 events: readonly Event[],
708 predicate: (event: Event) => boolean,
709): Promise<Event> {
710 const deadline = Date.now() + 1_000;
711 while (Date.now() < deadline) {
712 const event = events.find(predicate);
713 if (event !== undefined) return event;
714 await delay(10);
715 }
716 throw new Error('Timed out waiting for event');
717}
718
719async function readMainWire(sessionDir: string): Promise<Array<Record<string, unknown>>> {
720 const raw = await readFile(join(sessionDir, 'agents', 'main', 'wire.jsonl'), 'utf-8');

Callers 1

Calls 2

delayFunction · 0.85
nowMethod · 0.65

Tested by

no test coverage detected