🚧 Start of Typescript IPC
This commit is contained in:
parent
f825509ca6
commit
c3d4b69a21
7 changed files with 157 additions and 8 deletions
101
core/ipc/IpcIde.ts
Normal file
101
core/ipc/IpcIde.ts
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
import { Chunk, DiffLine, IDE, Problem } from "..";
|
||||
import { BrowserSerializedContinueConfig } from "../config/load";
|
||||
|
||||
export class IpcIde implements IDE {
|
||||
getSerializedConfig(): Promise<BrowserSerializedContinueConfig> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
getDiff(): Promise<string> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
getTerminalContents(): Promise<string> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
listWorkspaceContents(directory?: string | undefined): Promise<string[]> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
listFolders(): Promise<string[]> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
getWorkspaceDirs(): Promise<string[]> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
writeFile(path: string, contents: string): Promise<void> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
showVirtualFile(title: string, contents: string): Promise<void> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
getContinueDir(): Promise<string> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
openFile(path: string): Promise<void> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
runCommand(command: string): Promise<void> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
saveFile(filepath: string): Promise<void> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
readFile(filepath: string): Promise<string> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
showLines(
|
||||
filepath: string,
|
||||
startLine: number,
|
||||
endLine: number
|
||||
): Promise<void> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
showDiff(
|
||||
filepath: string,
|
||||
newContents: string,
|
||||
stepIndex: number
|
||||
): Promise<void> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
verticalDiffUpdate(
|
||||
filepath: string,
|
||||
startLine: number,
|
||||
endLine: number,
|
||||
diffLine: DiffLine
|
||||
): Promise<void> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
getOpenFiles(): Promise<string[]> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
getPinnedFiles(): Promise<string[]> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
getSearchResults(query: string): Promise<string> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
subprocess(command: string): Promise<[string, string]> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
getProblems(filepath?: string | undefined): Promise<Problem[]> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
getBranch(dir: string): Promise<string> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
getFilesToEmbed(providerId: string): Promise<[string, string, string][]> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
sendEmbeddingForChunk(
|
||||
chunk: Chunk,
|
||||
embedding: number[],
|
||||
tags: string[]
|
||||
): void {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
retrieveChunks(
|
||||
text: string,
|
||||
n: number,
|
||||
directory: string | undefined
|
||||
): Promise<Chunk[]> {
|
||||
throw new Error("Method not implemented.");
|
||||
}
|
||||
}
|
||||
9
core/ipc/cli.ts
Normal file
9
core/ipc/cli.ts
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import { Command } from "commander";
|
||||
|
||||
const program = new Command();
|
||||
|
||||
program.argument("<name>", "input name").action((name) => {
|
||||
console.log(`Hello, ${name}`);
|
||||
});
|
||||
|
||||
program.parse(process.argv);
|
||||
8
core/ipc/interface.ts
Normal file
8
core/ipc/interface.ts
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
import { Messenger } from "./messenger";
|
||||
|
||||
export class IpcInterface {
|
||||
private messenger: Messenger;
|
||||
constructor(messenger: Messenger) {
|
||||
this.messenger = messenger;
|
||||
}
|
||||
}
|
||||
16
core/ipc/messenger.ts
Normal file
16
core/ipc/messenger.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
export abstract class Messenger {
|
||||
abstract send(messageType: string, message: any): void;
|
||||
abstract onMessage(
|
||||
messageType: string,
|
||||
handler: (message: any) => void
|
||||
): void;
|
||||
}
|
||||
|
||||
export class IpcMessenger extends Messenger {
|
||||
send(messageType: string, message: any): void {
|
||||
console.log(`Sending message: ${messageType}`);
|
||||
}
|
||||
onMessage(messageType: string, handler: (message: any) => void): void {
|
||||
console.log(`Registering handler for message: ${messageType}`);
|
||||
}
|
||||
}
|
||||
17
core/package-lock.json
generated
17
core/package-lock.json
generated
|
|
@ -13,11 +13,12 @@
|
|||
"@types/node-fetch": "^2.6.11",
|
||||
"@xenova/transformers": "^2.14.0",
|
||||
"cheerio": "^1.0.0-rc.12",
|
||||
"commander": "^12.0.0",
|
||||
"dotenv": "^16.3.1",
|
||||
"fastest-levenshtein": "^1.0.16",
|
||||
"handlebars": "^4.7.8",
|
||||
"js-tiktoken": "^1.0.8",
|
||||
"llm-code-highlighter": "^0.0.1",
|
||||
"llm-code-highlighter": "^0.0.3",
|
||||
"node-fetch": "^3.3.2",
|
||||
"node-html-markdown": "^1.3.0",
|
||||
"openai": "^4.20.1",
|
||||
|
|
@ -2805,6 +2806,14 @@
|
|||
"node": ">=12.17"
|
||||
}
|
||||
},
|
||||
"node_modules/commander": {
|
||||
"version": "12.0.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-12.0.0.tgz",
|
||||
"integrity": "sha512-MwVNWlYjDTtOjX5PiD7o5pK0UrFU/OYgcJfjjK4RaHZETNtjJqrZa9Y9ds88+A+f+d5lv+561eZ+yCKoS3gbAA==",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/concat-map": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
|
||||
|
|
@ -4770,9 +4779,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"node_modules/llm-code-highlighter": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/llm-code-highlighter/-/llm-code-highlighter-0.0.1.tgz",
|
||||
"integrity": "sha512-26PExkQxeh5EiBNroldpV82pZDrjC6C5v4PLcm5ZpGIKExrHs9Hqw36B+1Fg+dxXGZMnwlCZ+6EbC2FEVocmcw==",
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/llm-code-highlighter/-/llm-code-highlighter-0.0.3.tgz",
|
||||
"integrity": "sha512-l/R+m6ngXRTYxzoCzqpBk5TiSVpS4Ek9fKx/PIy25HV6XDbCC6iOfVITPPSTGkh7NlI+tN5vWjdqUfN3YW+HwQ==",
|
||||
"dependencies": {
|
||||
"graphology": "^0.25.4",
|
||||
"graphology-metrics": "^2.2.0",
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
"@types/node-fetch": "^2.6.11",
|
||||
"@xenova/transformers": "^2.14.0",
|
||||
"cheerio": "^1.0.0-rc.12",
|
||||
"commander": "^12.0.0",
|
||||
"dotenv": "^16.3.1",
|
||||
"fastest-levenshtein": "^1.0.16",
|
||||
"handlebars": "^4.7.8",
|
||||
|
|
|
|||
|
|
@ -1465,6 +1465,11 @@ command-line-usage@^7.0.0, command-line-usage@7.0.1:
|
|||
table-layout "^3.0.0"
|
||||
typical "^7.1.1"
|
||||
|
||||
commander@^12.0.0:
|
||||
version "12.0.0"
|
||||
resolved "https://registry.npmjs.org/commander/-/commander-12.0.0.tgz"
|
||||
integrity sha512-MwVNWlYjDTtOjX5PiD7o5pK0UrFU/OYgcJfjjK4RaHZETNtjJqrZa9Y9ds88+A+f+d5lv+561eZ+yCKoS3gbAA==
|
||||
|
||||
concat-map@0.0.1:
|
||||
version "0.0.1"
|
||||
resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz"
|
||||
|
|
@ -2695,10 +2700,10 @@ lines-and-columns@^1.1.6:
|
|||
resolved "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz"
|
||||
integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==
|
||||
|
||||
llm-code-highlighter@^0.0.1:
|
||||
version "0.0.1"
|
||||
resolved "https://registry.npmjs.org/llm-code-highlighter/-/llm-code-highlighter-0.0.1.tgz"
|
||||
integrity sha512-26PExkQxeh5EiBNroldpV82pZDrjC6C5v4PLcm5ZpGIKExrHs9Hqw36B+1Fg+dxXGZMnwlCZ+6EbC2FEVocmcw==
|
||||
llm-code-highlighter@^0.0.3:
|
||||
version "0.0.3"
|
||||
resolved "https://registry.npmjs.org/llm-code-highlighter/-/llm-code-highlighter-0.0.3.tgz"
|
||||
integrity sha512-l/R+m6ngXRTYxzoCzqpBk5TiSVpS4Ek9fKx/PIy25HV6XDbCC6iOfVITPPSTGkh7NlI+tN5vWjdqUfN3YW+HwQ==
|
||||
dependencies:
|
||||
graphology "^0.25.4"
|
||||
graphology-metrics "^2.2.0"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue