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

Function makeBridge

packages/agent-core/test/services/task-service.test.ts:40–65  ·  view source on GitHub ↗
(state: FakeState)

Source from the content-addressed store, hash-verified

38}
39
40function makeBridge(state: FakeState): ICoreProcessService {
41 const rpc: Partial<CoreRPC> = {
42 listSessions: async () => state.sessions,
43 getBackground: async (p: { sessionId: string; agentId: string; activeOnly?: boolean }) =>
44 state.tasksBySession.get(p.sessionId) ?? [],
45 getBackgroundOutput: async (p: { sessionId: string; agentId: string; taskId: string; tail?: number }) => {
46 const output = state.outputByTaskId.get(p.taskId);
47 if (output === undefined) return '';
48 if (p.tail !== undefined && output.length > p.tail) {
49 return output.slice(-p.tail);
50 }
51 return output;
52 },
53 stopBackground: async (
54 p: StopBackgroundPayload & { sessionId: string; agentId: string },
55 ) => {
56 state.stopCalls.push(p);
57 },
58 };
59 return {
60 rpc: rpc as CoreRPC,
61 ready: async () => undefined,
62 dispose: () => undefined,
63 _serviceBrand: undefined,
64 };
65}
66
67function session(id: string): SessionSummary {
68 return {

Callers 1

Calls 2

getMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected