352 lines
10 KiB
TypeScript
352 lines
10 KiB
TypeScript
import {
|
|
BlockType,
|
|
ConfigResult,
|
|
DevDataLogEvent,
|
|
ModelRole,
|
|
} from "@continuedev/config-yaml";
|
|
import { ToolPolicy } from "@continuedev/terminal-security";
|
|
|
|
import {
|
|
AutocompleteInput,
|
|
RecentlyEditedRange,
|
|
} from "../autocomplete/util/types";
|
|
import { SharedConfigSchema } from "../config/sharedConfig";
|
|
import { GlobalContextModelSelections } from "../util/GlobalContext";
|
|
|
|
import {
|
|
BaseSessionMetadata,
|
|
BrowserSerializedContinueConfig,
|
|
ChatMessage,
|
|
CompiledMessagesResult,
|
|
CompleteOnboardingPayload,
|
|
ContextItem,
|
|
ContextItemWithId,
|
|
ContextSubmenuItem,
|
|
DiffLine,
|
|
DocsIndexingDetails,
|
|
ExperimentalModelRoles,
|
|
FileSymbolMap,
|
|
IdeSettings,
|
|
LLMFullCompletionOptions,
|
|
MessageOption,
|
|
ModelDescription,
|
|
PromptLog,
|
|
RangeInFile,
|
|
RangeInFileWithNextEditInfo,
|
|
SerializedContinueConfig,
|
|
Session,
|
|
SiteIndexingConfig,
|
|
SlashCommandDescWithSource,
|
|
StreamDiffLinesPayload,
|
|
ToolCall,
|
|
} from "../";
|
|
import { AutocompleteCodeSnippet } from "../autocomplete/snippets/types";
|
|
import { GetLspDefinitionsFunction } from "../autocomplete/types";
|
|
import { ConfigHandler } from "../config/ConfigHandler";
|
|
import { SerializedOrgWithProfiles } from "../config/ProfileLifecycleManager";
|
|
import {
|
|
ControlPlaneEnv,
|
|
ControlPlaneSessionInfo,
|
|
} from "../control-plane/AuthTypes";
|
|
import { CreditStatus, RemoteSessionMetadata } from "../control-plane/client";
|
|
import { ProcessedItem } from "../nextEdit/NextEditPrefetchQueue";
|
|
import { NextEditOutcome } from "../nextEdit/types";
|
|
import { ContinueErrorReason } from "../util/errors";
|
|
|
|
export enum OnboardingModes {
|
|
API_KEY = "API Key",
|
|
LOCAL = "Local",
|
|
MODELS_ADD_ON = "Models Add-On",
|
|
}
|
|
|
|
export interface ListHistoryOptions {
|
|
offset?: number;
|
|
limit?: number;
|
|
}
|
|
|
|
export type ToCoreFromIdeOrWebviewProtocol = {
|
|
// Special
|
|
ping: [string, string];
|
|
abort: [undefined, void];
|
|
cancelApply: [undefined, void];
|
|
|
|
// History
|
|
"history/list": [
|
|
ListHistoryOptions,
|
|
(BaseSessionMetadata | RemoteSessionMetadata)[],
|
|
];
|
|
"history/delete": [{ id: string }, void];
|
|
"history/load": [{ id: string }, Session];
|
|
"history/loadRemote": [{ remoteId: string }, Session];
|
|
"history/save": [Session, void];
|
|
"history/share": [{ id: string; outputDir?: string }, void];
|
|
"history/clear": [undefined, void];
|
|
"devdata/log": [DevDataLogEvent, void];
|
|
"config/addOpenAiKey": [string, void];
|
|
"config/addModel": [
|
|
{
|
|
model: SerializedContinueConfig["models"][number];
|
|
role?: keyof ExperimentalModelRoles;
|
|
},
|
|
void,
|
|
];
|
|
"config/addLocalWorkspaceBlock": [
|
|
{ blockType: BlockType; baseFilename?: string },
|
|
void,
|
|
];
|
|
"config/addGlobalRule": [undefined | { baseFilename?: string }, void];
|
|
"config/deleteRule": [{ filepath: string }, void];
|
|
"config/newPromptFile": [undefined, void];
|
|
"config/newAssistantFile": [undefined, void];
|
|
"config/ideSettingsUpdate": [IdeSettings, void];
|
|
"config/getSerializedProfileInfo": [
|
|
undefined,
|
|
{
|
|
result: ConfigResult<BrowserSerializedContinueConfig>;
|
|
profileId: string | null;
|
|
organizations: SerializedOrgWithProfiles[];
|
|
selectedOrgId: string | null;
|
|
},
|
|
];
|
|
"config/deleteModel": [{ title: string }, void];
|
|
"config/refreshProfiles": [
|
|
(
|
|
| undefined
|
|
| {
|
|
reason?: string;
|
|
selectOrgId?: string;
|
|
selectProfileId?: string;
|
|
}
|
|
),
|
|
void,
|
|
];
|
|
"config/openProfile": [{ profileId: string | undefined }, void];
|
|
"config/updateSharedConfig": [SharedConfigSchema, SharedConfigSchema];
|
|
"config/updateSelectedModel": [
|
|
{
|
|
profileId: string;
|
|
role: ModelRole;
|
|
title: string | null;
|
|
},
|
|
GlobalContextModelSelections,
|
|
];
|
|
"context/getContextItems": [
|
|
{
|
|
name: string;
|
|
query: string;
|
|
fullInput: string;
|
|
selectedCode: RangeInFile[];
|
|
isInAgentMode: boolean;
|
|
},
|
|
ContextItemWithId[],
|
|
];
|
|
|
|
"mcp/reloadServer": [
|
|
{
|
|
id: string;
|
|
},
|
|
void,
|
|
];
|
|
"mcp/setServerEnabled": [{ id: string; enabled: boolean }, void];
|
|
"mcp/getPrompt": [
|
|
{
|
|
serverName: string;
|
|
promptName: string;
|
|
args?: Record<string, string>;
|
|
},
|
|
{
|
|
prompt: string;
|
|
description: string | undefined;
|
|
},
|
|
];
|
|
"mcp/startAuthentication": [
|
|
{
|
|
serverId: string;
|
|
serverUrl: string;
|
|
},
|
|
void,
|
|
];
|
|
"mcp/removeAuthentication": [
|
|
{
|
|
serverId: string;
|
|
serverUrl: string;
|
|
},
|
|
void,
|
|
];
|
|
"context/getSymbolsForFiles": [{ uris: string[] }, FileSymbolMap];
|
|
"context/loadSubmenuItems": [{ title: string }, ContextSubmenuItem[]];
|
|
"autocomplete/complete": [AutocompleteInput, string[]];
|
|
"context/addDocs": [SiteIndexingConfig, void];
|
|
"context/removeDocs": [Pick<SiteIndexingConfig, "startUrl">, void];
|
|
"context/indexDocs": [{ reIndex: boolean }, void];
|
|
"autocomplete/cancel": [undefined, void];
|
|
"autocomplete/accept": [{ completionId: string }, void];
|
|
"nextEdit/predict": [
|
|
{
|
|
input: AutocompleteInput;
|
|
options?: {
|
|
withChain?: boolean;
|
|
usingFullFileDiff?: boolean;
|
|
};
|
|
},
|
|
NextEditOutcome | undefined,
|
|
];
|
|
"nextEdit/reject": [{ completionId: string }, void];
|
|
"nextEdit/accept": [{ completionId: string }, void];
|
|
"nextEdit/startChain": [undefined, void];
|
|
"nextEdit/deleteChain": [undefined, void];
|
|
"nextEdit/isChainAlive": [undefined, boolean];
|
|
"nextEdit/queue/getProcessedCount": [undefined, number];
|
|
"nextEdit/queue/dequeueProcessed": [undefined, ProcessedItem | null];
|
|
"nextEdit/queue/processOne": [
|
|
{
|
|
ctx: {
|
|
completionId: string;
|
|
manuallyPassFileContents?: string;
|
|
manuallyPassPrefix?: string;
|
|
selectedCompletionInfo?: {
|
|
text: string;
|
|
range: Range;
|
|
};
|
|
isUntitledFile: boolean;
|
|
recentlyVisitedRanges: AutocompleteCodeSnippet[];
|
|
recentlyEditedRanges: RecentlyEditedRange[];
|
|
};
|
|
recentlyVisitedRanges: AutocompleteCodeSnippet[];
|
|
recentlyEditedRanges: RecentlyEditedRange[];
|
|
},
|
|
void,
|
|
];
|
|
"nextEdit/queue/clear": [undefined, void];
|
|
"nextEdit/queue/abort": [undefined, void];
|
|
"llm/complete": [
|
|
{
|
|
prompt: string;
|
|
completionOptions: LLMFullCompletionOptions;
|
|
title: string;
|
|
},
|
|
string,
|
|
];
|
|
"llm/listModels": [{ title: string }, string[] | undefined];
|
|
"llm/streamChat": [
|
|
{
|
|
messages: ChatMessage[];
|
|
completionOptions: LLMFullCompletionOptions;
|
|
title: string;
|
|
messageOptions?: MessageOption;
|
|
legacySlashCommandData?: {
|
|
command: SlashCommandDescWithSource;
|
|
input: string;
|
|
contextItems: ContextItemWithId[];
|
|
historyIndex: number;
|
|
selectedCode: RangeInFile[];
|
|
};
|
|
},
|
|
AsyncGenerator<ChatMessage, PromptLog>,
|
|
];
|
|
streamDiffLines: [StreamDiffLinesPayload, AsyncGenerator<DiffLine>];
|
|
getDiffLines: [{ oldContent: string; newContent: string }, DiffLine[]];
|
|
"llm/compileChat": [
|
|
{ messages: ChatMessage[]; options: LLMFullCompletionOptions },
|
|
CompiledMessagesResult,
|
|
];
|
|
"chatDescriber/describe": [
|
|
{
|
|
text: string;
|
|
},
|
|
string | undefined,
|
|
];
|
|
"conversation/compact": [
|
|
{
|
|
index: number;
|
|
sessionId: string;
|
|
},
|
|
string | undefined,
|
|
];
|
|
"stats/getTokensPerDay": [
|
|
undefined,
|
|
{ day: string; promptTokens: number; generatedTokens: number }[],
|
|
];
|
|
"stats/getTokensPerModel": [
|
|
undefined,
|
|
{ model: string; promptTokens: number; generatedTokens: number }[],
|
|
];
|
|
"tts/kill": [undefined, void];
|
|
|
|
// Codebase indexing
|
|
"index/setPaused": [boolean, void];
|
|
"index/forceReIndex": [
|
|
undefined | { dirs?: string[]; shouldClearIndexes?: boolean },
|
|
void,
|
|
];
|
|
"index/indexingProgressBarInitialized": [undefined, void];
|
|
"onboarding/complete": [CompleteOnboardingPayload, void];
|
|
|
|
// File changes
|
|
"files/changed": [{ uris?: string[] }, void];
|
|
"files/opened": [{ uris?: string[] }, void];
|
|
"files/created": [{ uris?: string[] }, void];
|
|
"files/deleted": [{ uris?: string[] }, void];
|
|
"files/closed": [{ uris?: string[] }, void];
|
|
"files/smallEdit": [
|
|
{
|
|
actions: RangeInFileWithNextEditInfo[];
|
|
configHandler: ConfigHandler;
|
|
getDefsFromLspFunction: GetLspDefinitionsFunction;
|
|
recentlyEditedRanges: RecentlyEditedRange[];
|
|
recentlyVisitedRanges: AutocompleteCodeSnippet[];
|
|
},
|
|
void,
|
|
];
|
|
|
|
// Docs etc. Indexing. TODO move codebase to this
|
|
"indexing/reindex": [{ type: string; id: string }, void];
|
|
"indexing/abort": [{ type: string; id: string }, void];
|
|
"indexing/setPaused": [{ type: string; id: string; paused: boolean }, void];
|
|
"docs/getSuggestedDocs": [undefined, void];
|
|
"docs/initStatuses": [undefined, void];
|
|
"docs/getDetails": [{ startUrl: string }, DocsIndexingDetails];
|
|
"docs/getIndexedPages": [{ startUrl: string }, string[]];
|
|
addAutocompleteModel: [{ model: ModelDescription }, void];
|
|
|
|
"auth/getAuthUrl": [{ useOnboarding: boolean }, { url: string }];
|
|
"tools/call": [
|
|
{ toolCall: ToolCall },
|
|
{
|
|
contextItems: ContextItem[];
|
|
errorMessage?: string;
|
|
errorReason?: ContinueErrorReason;
|
|
},
|
|
];
|
|
"tools/evaluatePolicy": [
|
|
{
|
|
toolName: string;
|
|
basePolicy: ToolPolicy;
|
|
parsedArgs: Record<string, unknown>;
|
|
processedArgs?: Record<string, unknown>;
|
|
},
|
|
{ policy: ToolPolicy; displayValue?: string },
|
|
];
|
|
"tools/preprocessArgs": [
|
|
{ toolName: string; args: Record<string, unknown> },
|
|
{
|
|
preprocessedArgs?: Record<string, unknown>;
|
|
errorReason?: ContinueErrorReason;
|
|
errorMessage?: string;
|
|
},
|
|
];
|
|
"clipboardCache/add": [{ content: string }, void];
|
|
"controlPlane/openUrl": [{ path: string; orgSlug?: string }, void];
|
|
"controlPlane/getEnvironment": [undefined, ControlPlaneEnv];
|
|
"controlPlane/getCreditStatus": [undefined, CreditStatus | null];
|
|
isItemTooBig: [{ item: ContextItemWithId }, boolean];
|
|
didChangeControlPlaneSessionInfo: [
|
|
{ sessionInfo: ControlPlaneSessionInfo | undefined },
|
|
void,
|
|
];
|
|
"process/markAsBackgrounded": [{ toolCallId: string }, void];
|
|
"process/isBackgrounded": [{ toolCallId: string }, boolean];
|
|
"process/killTerminalProcess": [{ toolCallId: string }, void];
|
|
"mdm/setLicenseKey": [{ licenseKey: string }, boolean];
|
|
};
|