Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 1 addition & 40 deletions extensions/ql-vscode/src/common/interface-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -560,16 +560,6 @@ interface SetModifiedMethodsMessage {
methodSignatures: string[];
}

interface SetInProgressMethodsMessage {
t: "setInProgressMethods";
methods: string[];
}

interface SetProcessedByAutoModelMethodsMessage {
t: "setProcessedByAutoModelMethods";
methods: string[];
}

interface SwitchModeMessage {
t: "switchMode";
mode: Mode;
Expand Down Expand Up @@ -601,17 +591,6 @@ interface GenerateMethodMessage {
t: "generateMethod";
}

interface GenerateMethodsFromLlmMessage {
t: "generateMethodsFromLlm";
packageName: string;
methodSignatures: string[];
}

interface StopGeneratingMethodsFromLlmMessage {
t: "stopGeneratingMethodsFromLlm";
packageName: string;
}

interface StartModelEvaluationMessage {
t: "startModelEvaluation";
}
Expand Down Expand Up @@ -649,16 +628,6 @@ interface SetInModelingModeMessage {
inModelingMode: boolean;
}

interface SetInProgressMessage {
t: "setInProgress";
inProgress: boolean;
}

interface SetProcessedByAutoModelMessage {
t: "setProcessedByAutoModel";
processedByAutoModel: boolean;
}

interface RevealMethodMessage {
t: "revealMethod";
methodSignature: string;
Expand All @@ -679,8 +648,6 @@ export type ToModelEditorMessage =
| SetMethodsMessage
| SetModeledAndModifiedMethodsMessage
| SetModifiedMethodsMessage
| SetInProgressMethodsMessage
| SetProcessedByAutoModelMethodsMessage
| RevealMethodMessage
| SetAccessPathSuggestionsMessage
| SetModelEvaluationRunMessage;
Expand All @@ -694,8 +661,6 @@ export type FromModelEditorMessage =
| JumpToMethodMessage
| SaveModeledMethods
| GenerateMethodMessage
| GenerateMethodsFromLlmMessage
| StopGeneratingMethodsFromLlmMessage
| ModelDependencyMessage
| HideModeledMethodsMessage
| SetMultipleModeledMethodsMessage
Expand Down Expand Up @@ -738,8 +703,6 @@ interface SetSelectedMethodMessage {
method: Method;
modeledMethods: ModeledMethod[];
isModified: boolean;
isInProgress: boolean;
processedByAutoModel: boolean;
}

export type ToMethodModelingMessage =
Expand All @@ -748,9 +711,7 @@ export type ToMethodModelingMessage =
| SetMethodModifiedMessage
| SetNoMethodSelectedMessage
| SetSelectedMethodMessage
| SetInModelingModeMessage
| SetInProgressMessage
| SetProcessedByAutoModelMessage;
| SetInModelingModeMessage;

interface SetModelAlertsViewStateMessage {
t: "setModelAlertsViewState";
Expand Down
26 changes: 1 addition & 25 deletions extensions/ql-vscode/src/common/mock-gh-api/gh-api-request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export enum RequestKind {
GetVariantAnalysisRepo = "getVariantAnalysisRepo",
GetVariantAnalysisRepoResult = "getVariantAnalysisRepoResult",
CodeSearch = "codeSearch",
AutoModel = "autoModel",
}

export interface BasicErrorResponse {
Expand Down Expand Up @@ -92,31 +91,13 @@ interface CodeSearchRequest {
};
}

export interface AutoModelResponse {
models: string;
}

interface AutoModelRequest {
request: {
kind: RequestKind.AutoModel;
body?: {
candidates: string;
};
};
response: {
status: number;
body?: AutoModelResponse | BasicErrorResponse;
};
}

export type GitHubApiRequest =
| GetRepoRequest
| SubmitVariantAnalysisRequest
| GetVariantAnalysisRequest
| GetVariantAnalysisRepoRequest
| GetVariantAnalysisRepoResultRequest
| CodeSearchRequest
| AutoModelRequest;
| CodeSearchRequest;

export const isGetRepoRequest = (
request: GitHubApiRequest,
Expand Down Expand Up @@ -146,8 +127,3 @@ export const isCodeSearchRequest = (
request: GitHubApiRequest,
): request is CodeSearchRequest =>
request.request.kind === RequestKind.CodeSearch;

export const isAutoModelRequest = (
request: GitHubApiRequest,
): request is AutoModelRequest =>
request.request.kind === RequestKind.AutoModel;
18 changes: 0 additions & 18 deletions extensions/ql-vscode/src/common/mock-gh-api/recorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { DisposableObject } from "../disposable-object";
import { gzipDecode } from "../zlib";

import type {
AutoModelResponse,
BasicErrorResponse,
CodeSearchResponse,
GetVariantAnalysisRepoResultRequest,
Expand Down Expand Up @@ -265,23 +264,6 @@ async function createGitHubApiRequest(
};
}

const autoModelMatch = url.match(
/\/repos\/github\/codeql\/code-scanning\/codeql\/auto-model/,
);
if (autoModelMatch) {
return {
request: {
kind: RequestKind.AutoModel,
},
response: {
status,
body: await jsonResponseBody<
BasicErrorResponse | AutoModelResponse | undefined
>(response),
},
};
}

return undefined;
}

Expand Down
28 changes: 0 additions & 28 deletions extensions/ql-vscode/src/common/mock-gh-api/request-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import type { RequestHandler } from "msw";
import { http } from "msw";
import type { GitHubApiRequest } from "./gh-api-request";
import {
isAutoModelRequest,
isCodeSearchRequest,
isGetRepoRequest,
isGetVariantAnalysisRepoRequest,
Expand Down Expand Up @@ -41,7 +40,6 @@ export async function createRequestHandlers(
createGetVariantAnalysisRepoRequestHandler(requests),
createGetVariantAnalysisRepoResultRequestHandler(requests),
createCodeSearchRequestHandler(requests),
createAutoModelRequestHandler(requests),
];

return handlers;
Expand Down Expand Up @@ -230,29 +228,3 @@ function createCodeSearchRequestHandler(
});
});
}

function createAutoModelRequestHandler(
requests: GitHubApiRequest[],
): RequestHandler {
const autoModelRequests = requests.filter(isAutoModelRequest);
let requestIndex = 0;

// During automodeling there can be multiple API requests for each batch
// of candidates we want to model. We need to return different responses for each request,
// so keep an index of the request and return the appropriate response.
return http.post(
`${baseUrl}/repos/github/codeql/code-scanning/codeql/auto-model`,
() => {
const request = autoModelRequests[requestIndex];

if (requestIndex < autoModelRequests.length - 1) {
// If there are more requests to come, increment the index.
requestIndex++;
}

return jsonResponse(request.response.body, {
status: request.response.status,
});
},
);
}

This file was deleted.

This file was deleted.

This file was deleted.

7 changes: 1 addition & 6 deletions extensions/ql-vscode/src/common/zlib.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { promisify } from "util";
import { gzip, gunzip } from "zlib";

/**
* Promisified version of zlib.gzip
*/
export const gzipEncode = promisify(gzip);
import { gunzip } from "zlib";

/**
* Promisified version of zlib.gunzip
Expand Down
30 changes: 0 additions & 30 deletions extensions/ql-vscode/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -828,15 +828,6 @@ export async function setAutogenerateQlPacks(choice: AutogenerateQLPacks) {

const MODEL_SETTING = new Setting("model", ROOT_SETTING);
const FLOW_GENERATION = new Setting("flowGeneration", MODEL_SETTING);
const LLM_GENERATION = new Setting("llmGeneration", MODEL_SETTING);
const LLM_GENERATION_BATCH_SIZE = new Setting(
"llmGenerationBatchSize",
MODEL_SETTING,
);
const LLM_GENERATION_DEV_ENDPOINT = new Setting(
"llmGenerationDevEndpoint",
MODEL_SETTING,
);
const MODEL_EVALUATION = new Setting("evaluation", MODEL_SETTING);
const MODEL_PACK_LOCATION = new Setting("packLocation", MODEL_SETTING);
const MODEL_PACK_NAME = new Setting("packName", MODEL_SETTING);
Expand All @@ -850,7 +841,6 @@ export type ModelConfigPackVariables = {

export interface ModelConfig {
flowGeneration: boolean;
llmGeneration: boolean;
getPackLocation(
languageId: string,
variables: ModelConfigPackVariables,
Expand All @@ -870,26 +860,6 @@ export class ModelConfigListener extends ConfigListener implements ModelConfig {
return !!FLOW_GENERATION.getValue<boolean>();
}

public get llmGeneration(): boolean {
return !!LLM_GENERATION.getValue<boolean>() && !hasEnterpriseUri();
}

/**
* Limits the number of candidates we send to the model in each request to avoid long requests.
* Note that the model may return fewer than this number of candidates.
*/
public get llmGenerationBatchSize(): number {
return LLM_GENERATION_BATCH_SIZE.getValue<number | null>() || 5;
}

/**
* The URL of the endpoint to use for LLM generation. This should only be set
* if you want to test against a dev server.
*/
public get llmGenerationDevEndpoint(): string | undefined {
return LLM_GENERATION_DEV_ENDPOINT.getValue<string | undefined>();
}

public get modelEvaluation(): boolean {
return !!MODEL_EVALUATION.getValue<boolean>();
}
Expand Down
65 changes: 0 additions & 65 deletions extensions/ql-vscode/src/model-editor/auto-model-api.ts

This file was deleted.

Loading