MCPcopy Index your code
hub / github.com/anus-dev/ANUS / CodeAssistServer

Class CodeAssistServer

packages/core/src/code_assist/server.ts:46–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44export const CODE_ASSIST_API_VERSION = 'v1internal';
45
46export class CodeAssistServer implements ContentGenerator {
47 constructor(
48 readonly client: OAuth2Client,
49 readonly projectId?: string,
50 readonly httpOptions: HttpOptions = {},
51 readonly sessionId?: string,
52 readonly userTier?: UserTierId,
53 ) {}
54
55 async generateContentStream(
56 req: GenerateContentParameters,
57 userPromptId: string,
58 ): Promise<AsyncGenerator<GenerateContentResponse>> {
59 const resps = await this.requestStreamingPost<CaGenerateContentResponse>(
60 'streamGenerateContent',
61 toGenerateContentRequest(
62 req,
63 userPromptId,
64 this.projectId,
65 this.sessionId,
66 ),
67 req.config?.abortSignal,
68 );
69 return (async function* (): AsyncGenerator<GenerateContentResponse> {
70 for await (const resp of resps) {
71 yield fromGenerateContentResponse(resp);
72 }
73 })();
74 }
75
76 async generateContent(
77 req: GenerateContentParameters,
78 userPromptId: string,
79 ): Promise<GenerateContentResponse> {
80 const resp = await this.requestPost<CaGenerateContentResponse>(
81 'generateContent',
82 toGenerateContentRequest(
83 req,
84 userPromptId,
85 this.projectId,
86 this.sessionId,
87 ),
88 req.config?.abortSignal,
89 );
90 return fromGenerateContentResponse(resp);
91 }
92
93 async onboardUser(
94 req: OnboardUserRequest,
95 ): Promise<LongRunningOperationResponse> {
96 return await this.requestPost<LongRunningOperationResponse>(
97 'onboardUser',
98 req,
99 );
100 }
101
102 async loadCodeAssist(
103 req: LoadCodeAssistRequest,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected