MCPcopy Create free account
hub / github.com/anus-dev/ANUS / handler

Method handler

packages/cli/src/zed-integration/acp.ts:26–62  ·  view source on GitHub ↗
(
      method: string,
      params: unknown,
    )

Source from the content-addressed store, hash-verified

24 const agent = toAgent(this);
25
26 const handler = async (
27 method: string,
28 params: unknown,
29 ): Promise<unknown> => {
30 switch (method) {
31 case schema.AGENT_METHODS.initialize: {
32 const validatedParams = schema.initializeRequestSchema.parse(params);
33 return agent.initialize(validatedParams);
34 }
35 case schema.AGENT_METHODS.session_new: {
36 const validatedParams = schema.newSessionRequestSchema.parse(params);
37 return agent.newSession(validatedParams);
38 }
39 case schema.AGENT_METHODS.session_load: {
40 if (!agent.loadSession) {
41 throw RequestError.methodNotFound();
42 }
43 const validatedParams = schema.loadSessionRequestSchema.parse(params);
44 return agent.loadSession(validatedParams);
45 }
46 case schema.AGENT_METHODS.authenticate: {
47 const validatedParams =
48 schema.authenticateRequestSchema.parse(params);
49 return agent.authenticate(validatedParams);
50 }
51 case schema.AGENT_METHODS.session_prompt: {
52 const validatedParams = schema.promptRequestSchema.parse(params);
53 return agent.prompt(validatedParams);
54 }
55 case schema.AGENT_METHODS.session_cancel: {
56 const validatedParams = schema.cancelNotificationSchema.parse(params);
57 return agent.cancel(validatedParams);
58 }
59 default:
60 throw RequestError.methodNotFound(method);
61 }
62 };
63
64 this.#connection = new Connection(handler, input, output);
65 }

Callers

nothing calls this directly

Calls 7

methodNotFoundMethod · 0.80
loadSessionMethod · 0.80
initializeMethod · 0.65
newSessionMethod · 0.65
authenticateMethod · 0.65
promptMethod · 0.65
cancelMethod · 0.65

Tested by

no test coverage detected