merge main

This commit is contained in:
Dallin Romney 2024-12-03 18:24:50 -08:00
commit 84e4091cd8
37 changed files with 669 additions and 1114 deletions

View file

@ -149,10 +149,10 @@ export class Core {
// Index on initialization
void this.ide.getWorkspaceDirs().then(async (dirs) => {
// Respect pauseCodebaseIndexOnStart user settings
this.indexingPauseToken.paused = true;
if (ideSettings.pauseCodebaseIndexOnStart) {
this.indexingPauseToken.paused = true;
void this.messenger.request("indexProgress", {
progress: 1,
progress: 0,
desc: "Initial Indexing Skipped",
status: "paused",
});
@ -834,6 +834,8 @@ export class Core {
this.indexingCancellationController.signal,
)) {
let updateToSend = { ...update };
// TODO reconsider this status overwrite?
// original goal was to not concern users with edge noncritical errors
if (update.status === "failed") {
updateToSend.status = "done";
updateToSend.desc = "Indexing complete";

12
core/index.d.ts vendored
View file

@ -42,11 +42,18 @@ export interface IndexingProgressUpdate {
progress: number;
desc: string;
shouldClearIndexes?: boolean;
status: "loading" | "indexing" | "done" | "failed" | "paused" | "disabled";
status:
| "loading"
| "indexing"
| "done"
| "failed"
| "paused"
| "disabled"
| "cancelled";
debugInfo?: string;
}
// This is more or less a V2 of IndexingProgressUpdate
// This is more or less a V2 of IndexingProgressUpdate for docs etc.
export interface IndexingStatus {
id: string;
type: "docs";
@ -414,7 +421,6 @@ export interface ChatHistoryItem {
modifiers?: InputModifiers;
promptLogs?: PromptLog[];
toolCallState?: ToolCallState;
mode?: MessageModes;
isGatheringContext?: boolean;
checkpoint?: Checkpoint;
isBeforeCheckpoint?: boolean;

View file

@ -145,9 +145,7 @@ export class CodebaseIndexer {
}
}
async *refreshFiles(
files: string[],
): AsyncGenerator<IndexingProgressUpdate> {
async *refreshFiles(files: string[]): AsyncGenerator<IndexingProgressUpdate> {
let progress = 0;
if (files.length === 0) {
yield {
@ -192,9 +190,9 @@ export class CodebaseIndexer {
if (dirs.length === 0) {
yield {
progress,
progress: 1,
desc: "Nothing to index",
status: "disabled",
status: "done",
};
return;
}
@ -238,9 +236,9 @@ export class CodebaseIndexer {
directoryFiles.push(p);
if (abortSignal.aborted) {
yield {
progress: 1,
progress: 0,
desc: "Indexing cancelled",
status: "disabled",
status: "cancelled",
};
return;
}
@ -263,9 +261,9 @@ export class CodebaseIndexer {
// Handle pausing in this loop because it's the only one really taking time
if (abortSignal.aborted) {
yield {
progress: 1,
progress: 0,
desc: "Indexing cancelled",
status: "disabled",
status: "cancelled",
};
return;
}

View file

@ -56,7 +56,7 @@ export type ToIdeFromWebviewProtocol = ToIdeFromWebviewOrCoreProtocol & {
{ accept: boolean; onlyFirst: boolean; filepath: string },
void,
];
"edit/escape": [undefined, void];
"edit/exit": [{ shouldFocusEditor: boolean }, void];
};
export type ToWebviewFromIdeProtocol = ToWebviewFromIdeOrCoreProtocol & {

View file

@ -581,7 +581,8 @@ const getCommandsMap: (
},
"continue.exitEditMode": async () => {
captureCommandTelemetry("exitEditMode");
await sidebar.webviewProtocol?.request("exitEditMode", undefined);
editDecorationManager.clear();
void sidebar.webviewProtocol?.request("exitEditMode", undefined);
},
// "continue.quickEdit": async (args: QuickEditShowParams) => {
// let linesOfCode = undefined;

View file

@ -400,8 +400,16 @@ export class VsCodeMessenger {
vscode.commands.executeCommand("continue.rejectDiff", filepath);
}
});
this.onWebview("edit/escape", async (msg) => {
this.editDecorationManager.clear();
this.onWebview("edit/exit", async (msg) => {
if (msg.data.shouldFocusEditor) {
const activeEditor = vscode.window.activeTextEditor;
if (activeEditor) {
vscode.window.showTextDocument(activeEditor.document);
}
}
editDecorationManager.clear();
});
/** PASS THROUGH FROM WEBVIEW TO CORE AND BACK **/

694
gui/package-lock.json generated
View file

@ -83,7 +83,7 @@
"@vitest/coverage-v8": "^2.1.3",
"@vitest/ui": "^2.1.3",
"autoprefixer": "^10.4.13",
"eslint": "^9.15.0",
"eslint": "^8",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-strict-null-checks": "^0.1.3",
"jsdom": "^25.0.1",
@ -972,61 +972,16 @@
"node": "^12.0.0 || ^14.0.0 || >=16.0.0"
}
},
"node_modules/@eslint/config-array": {
"version": "0.19.0",
"resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.19.0.tgz",
"integrity": "sha512-zdHg2FPIFNKPdcHWtiNT+jEFCHYVplAXRDlQDyqy0zGx/q2parwh7brGJSiTxRk/TSMkbM//zt/f5CHgyTyaSQ==",
"dev": true,
"dependencies": {
"@eslint/object-schema": "^2.1.4",
"debug": "^4.3.1",
"minimatch": "^3.1.2"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
}
},
"node_modules/@eslint/config-array/node_modules/brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"dependencies": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"node_modules/@eslint/config-array/node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true,
"dependencies": {
"brace-expansion": "^1.1.7"
},
"engines": {
"node": "*"
}
},
"node_modules/@eslint/core": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.9.0.tgz",
"integrity": "sha512-7ATR9F0e4W85D/0w7cU0SNj7qkAexMG+bAHEZOjo9akvGuhHE2m7umzWzfnpa0XAg5Kxc1BWmtPMV67jJ+9VUg==",
"dev": true,
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
}
},
"node_modules/@eslint/eslintrc": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.2.0.tgz",
"integrity": "sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w==",
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz",
"integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==",
"dev": true,
"dependencies": {
"ajv": "^6.12.4",
"debug": "^4.3.2",
"espree": "^10.0.1",
"globals": "^14.0.0",
"espree": "^9.6.0",
"globals": "^13.19.0",
"ignore": "^5.2.0",
"import-fresh": "^3.2.1",
"js-yaml": "^4.1.0",
@ -1034,7 +989,7 @@
"strip-json-comments": "^3.1.1"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"url": "https://opencollective.com/eslint"
@ -1067,12 +1022,15 @@
}
},
"node_modules/@eslint/eslintrc/node_modules/globals": {
"version": "14.0.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",
"integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==",
"version": "13.24.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz",
"integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==",
"dev": true,
"dependencies": {
"type-fest": "^0.20.2"
},
"engines": {
"node": ">=18"
"node": ">=8"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
@ -1097,33 +1055,12 @@
}
},
"node_modules/@eslint/js": {
"version": "9.15.0",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.15.0.tgz",
"integrity": "sha512-tMTqrY+EzbXmKJR5ToI8lxu7jaN5EdmrBFJpQk5JmSlyLsx6o4t27r883K5xsLuCYCpfKBCGswMSWXsM+jB7lg==",
"version": "8.57.1",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz",
"integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==",
"dev": true,
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
}
},
"node_modules/@eslint/object-schema": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.4.tgz",
"integrity": "sha512-BsWiH1yFGjXXS2yvrf5LyuoSIIbPrGUWob917o+BTKuZ7qJdxX8aJLRxs1fS9n6r7vESrq1OUqb68dANcFXuQQ==",
"dev": true,
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
}
},
"node_modules/@eslint/plugin-kit": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.3.tgz",
"integrity": "sha512-2b/g5hRmpbb1o4GnTZax9N9m0FXzz9OV42ZzI4rDDMDuHUqigAiQCEWChBWCY4ztAGVRjoWT19v0yMmc5/L5kA==",
"dev": true,
"dependencies": {
"levn": "^0.4.1"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
}
},
"node_modules/@floating-ui/core": {
@ -1172,48 +1109,12 @@
"react": ">= 16"
}
},
"node_modules/@humanfs/core": {
"version": "0.19.1",
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz",
"integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==",
"dev": true,
"engines": {
"node": ">=18.18.0"
}
},
"node_modules/@humanfs/node": {
"version": "0.16.6",
"resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.6.tgz",
"integrity": "sha512-YuI2ZHQL78Q5HbhDiBA1X4LmYdXCKCMQIfw0pw7piHJwyREFebJUvrQN4cMssyES6x+vfUbx1CIpaQUKYdQZOw==",
"dev": true,
"dependencies": {
"@humanfs/core": "^0.19.1",
"@humanwhocodes/retry": "^0.3.0"
},
"engines": {
"node": ">=18.18.0"
}
},
"node_modules/@humanfs/node/node_modules/@humanwhocodes/retry": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.3.1.tgz",
"integrity": "sha512-JBxkERygn7Bv/GbN5Rv8Ul6LVknS+5Bp6RgDC/O8gEBU/yeH5Ui5C/OlWrTb6qct7LjjfT6Re2NxB0ln0yYybA==",
"dev": true,
"engines": {
"node": ">=18.18"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/nzakas"
}
},
"node_modules/@humanwhocodes/config-array": {
"version": "0.13.0",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz",
"integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==",
"deprecated": "Use @eslint/config-array instead",
"dev": true,
"peer": true,
"dependencies": {
"@humanwhocodes/object-schema": "^2.0.3",
"debug": "^4.3.1",
@ -1228,7 +1129,6 @@
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"peer": true,
"dependencies": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -1239,7 +1139,6 @@
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true,
"peer": true,
"dependencies": {
"brace-expansion": "^1.1.7"
},
@ -1265,21 +1164,7 @@
"resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz",
"integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==",
"deprecated": "Use @eslint/object-schema instead",
"dev": true,
"peer": true
},
"node_modules/@humanwhocodes/retry": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.1.tgz",
"integrity": "sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==",
"dev": true,
"engines": {
"node": ">=18.18"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/nzakas"
}
"dev": true
},
"node_modules/@isaacs/cliui": {
"version": "8.0.2",
@ -5143,62 +5028,59 @@
}
},
"node_modules/eslint": {
"version": "9.15.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-9.15.0.tgz",
"integrity": "sha512-7CrWySmIibCgT1Os28lUU6upBshZ+GxybLOrmRzi08kS8MBuO8QA7pXEgYgY5W8vK3e74xv0lpjo9DbaGU9Rkw==",
"version": "8.57.1",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz",
"integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==",
"deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.",
"dev": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.12.1",
"@eslint/config-array": "^0.19.0",
"@eslint/core": "^0.9.0",
"@eslint/eslintrc": "^3.2.0",
"@eslint/js": "9.15.0",
"@eslint/plugin-kit": "^0.2.3",
"@humanfs/node": "^0.16.6",
"@eslint-community/regexpp": "^4.6.1",
"@eslint/eslintrc": "^2.1.4",
"@eslint/js": "8.57.1",
"@humanwhocodes/config-array": "^0.13.0",
"@humanwhocodes/module-importer": "^1.0.1",
"@humanwhocodes/retry": "^0.4.1",
"@types/estree": "^1.0.6",
"@types/json-schema": "^7.0.15",
"@nodelib/fs.walk": "^1.2.8",
"@ungap/structured-clone": "^1.2.0",
"ajv": "^6.12.4",
"chalk": "^4.0.0",
"cross-spawn": "^7.0.5",
"cross-spawn": "^7.0.2",
"debug": "^4.3.2",
"doctrine": "^3.0.0",
"escape-string-regexp": "^4.0.0",
"eslint-scope": "^8.2.0",
"eslint-visitor-keys": "^4.2.0",
"espree": "^10.3.0",
"esquery": "^1.5.0",
"eslint-scope": "^7.2.2",
"eslint-visitor-keys": "^3.4.3",
"espree": "^9.6.1",
"esquery": "^1.4.2",
"esutils": "^2.0.2",
"fast-deep-equal": "^3.1.3",
"file-entry-cache": "^8.0.0",
"file-entry-cache": "^6.0.1",
"find-up": "^5.0.0",
"glob-parent": "^6.0.2",
"globals": "^13.19.0",
"graphemer": "^1.4.0",
"ignore": "^5.2.0",
"imurmurhash": "^0.1.4",
"is-glob": "^4.0.0",
"is-path-inside": "^3.0.3",
"js-yaml": "^4.1.0",
"json-stable-stringify-without-jsonify": "^1.0.1",
"levn": "^0.4.1",
"lodash.merge": "^4.6.2",
"minimatch": "^3.1.2",
"natural-compare": "^1.4.0",
"optionator": "^0.9.3"
"optionator": "^0.9.3",
"strip-ansi": "^6.0.1",
"text-table": "^0.2.0"
},
"bin": {
"eslint": "bin/eslint.js"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"url": "https://eslint.org/donate"
},
"peerDependencies": {
"jiti": "*"
},
"peerDependenciesMeta": {
"jiti": {
"optional": true
}
"url": "https://opencollective.com/eslint"
}
},
"node_modules/eslint-plugin-react": {
@ -5296,40 +5178,6 @@
"typescript": ">=3.9.4"
}
},
"node_modules/eslint-plugin-strict-null-checks/node_modules/@eslint/eslintrc": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz",
"integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==",
"dev": true,
"peer": true,
"dependencies": {
"ajv": "^6.12.4",
"debug": "^4.3.2",
"espree": "^9.6.0",
"globals": "^13.19.0",
"ignore": "^5.2.0",
"import-fresh": "^3.2.1",
"js-yaml": "^4.1.0",
"minimatch": "^3.1.2",
"strip-json-comments": "^3.1.1"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"url": "https://opencollective.com/eslint"
}
},
"node_modules/eslint-plugin-strict-null-checks/node_modules/@eslint/js": {
"version": "8.57.1",
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.1.tgz",
"integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==",
"dev": true,
"peer": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
}
},
"node_modules/eslint-plugin-strict-null-checks/node_modules/@typescript-eslint/eslint-plugin": {
"version": "5.62.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.62.0.tgz",
@ -5537,172 +5385,6 @@
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/eslint-plugin-strict-null-checks/node_modules/ajv": {
"version": "6.12.6",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",
"integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",
"dev": true,
"peer": true,
"dependencies": {
"fast-deep-equal": "^3.1.1",
"fast-json-stable-stringify": "^2.0.0",
"json-schema-traverse": "^0.4.1",
"uri-js": "^4.2.2"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/epoberezkin"
}
},
"node_modules/eslint-plugin-strict-null-checks/node_modules/ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"peer": true,
"dependencies": {
"color-convert": "^2.0.1"
},
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
"node_modules/eslint-plugin-strict-null-checks/node_modules/brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"peer": true,
"dependencies": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"node_modules/eslint-plugin-strict-null-checks/node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
"dev": true,
"peer": true,
"dependencies": {
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
"node_modules/eslint-plugin-strict-null-checks/node_modules/color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"peer": true,
"dependencies": {
"color-name": "~1.1.4"
},
"engines": {
"node": ">=7.0.0"
}
},
"node_modules/eslint-plugin-strict-null-checks/node_modules/color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true,
"peer": true
},
"node_modules/eslint-plugin-strict-null-checks/node_modules/cross-spawn": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
"dev": true,
"peer": true,
"dependencies": {
"path-key": "^3.1.0",
"shebang-command": "^2.0.0",
"which": "^2.0.1"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/eslint-plugin-strict-null-checks/node_modules/doctrine": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
"integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==",
"dev": true,
"peer": true,
"dependencies": {
"esutils": "^2.0.2"
},
"engines": {
"node": ">=6.0.0"
}
},
"node_modules/eslint-plugin-strict-null-checks/node_modules/eslint": {
"version": "8.57.1",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.1.tgz",
"integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==",
"deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.",
"dev": true,
"peer": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.6.1",
"@eslint/eslintrc": "^2.1.4",
"@eslint/js": "8.57.1",
"@humanwhocodes/config-array": "^0.13.0",
"@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8",
"@ungap/structured-clone": "^1.2.0",
"ajv": "^6.12.4",
"chalk": "^4.0.0",
"cross-spawn": "^7.0.2",
"debug": "^4.3.2",
"doctrine": "^3.0.0",
"escape-string-regexp": "^4.0.0",
"eslint-scope": "^7.2.2",
"eslint-visitor-keys": "^3.4.3",
"espree": "^9.6.1",
"esquery": "^1.4.2",
"esutils": "^2.0.2",
"fast-deep-equal": "^3.1.3",
"file-entry-cache": "^6.0.1",
"find-up": "^5.0.0",
"glob-parent": "^6.0.2",
"globals": "^13.19.0",
"graphemer": "^1.4.0",
"ignore": "^5.2.0",
"imurmurhash": "^0.1.4",
"is-glob": "^4.0.0",
"is-path-inside": "^3.0.3",
"js-yaml": "^4.1.0",
"json-stable-stringify-without-jsonify": "^1.0.1",
"levn": "^0.4.1",
"lodash.merge": "^4.6.2",
"minimatch": "^3.1.2",
"natural-compare": "^1.4.0",
"optionator": "^0.9.3",
"strip-ansi": "^6.0.1",
"text-table": "^0.2.0"
},
"bin": {
"eslint": "bin/eslint.js"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"url": "https://opencollective.com/eslint"
}
},
"node_modules/eslint-plugin-strict-null-checks/node_modules/eslint-scope": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
@ -5737,12 +5419,11 @@
"url": "https://opencollective.com/eslint"
}
},
"node_modules/eslint-plugin-strict-null-checks/node_modules/eslint/node_modules/eslint-scope": {
"node_modules/eslint-scope": {
"version": "7.2.2",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz",
"integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==",
"dev": true,
"peer": true,
"dependencies": {
"esrecurse": "^4.3.0",
"estraverse": "^5.2.0"
@ -5754,189 +5435,6 @@
"url": "https://opencollective.com/eslint"
}
},
"node_modules/eslint-plugin-strict-null-checks/node_modules/espree": {
"version": "9.6.1",
"resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz",
"integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==",
"dev": true,
"peer": true,
"dependencies": {
"acorn": "^8.9.0",
"acorn-jsx": "^5.3.2",
"eslint-visitor-keys": "^3.4.1"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"url": "https://opencollective.com/eslint"
}
},
"node_modules/eslint-plugin-strict-null-checks/node_modules/file-entry-cache": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
"integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==",
"dev": true,
"peer": true,
"dependencies": {
"flat-cache": "^3.0.4"
},
"engines": {
"node": "^10.12.0 || >=12.0.0"
}
},
"node_modules/eslint-plugin-strict-null-checks/node_modules/flat-cache": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz",
"integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==",
"dev": true,
"peer": true,
"dependencies": {
"flatted": "^3.2.9",
"keyv": "^4.5.3",
"rimraf": "^3.0.2"
},
"engines": {
"node": "^10.12.0 || >=12.0.0"
}
},
"node_modules/eslint-plugin-strict-null-checks/node_modules/glob-parent": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",
"integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==",
"dev": true,
"peer": true,
"dependencies": {
"is-glob": "^4.0.3"
},
"engines": {
"node": ">=10.13.0"
}
},
"node_modules/eslint-plugin-strict-null-checks/node_modules/globals": {
"version": "13.24.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz",
"integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==",
"dev": true,
"peer": true,
"dependencies": {
"type-fest": "^0.20.2"
},
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/eslint-plugin-strict-null-checks/node_modules/has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
"dev": true,
"peer": true,
"engines": {
"node": ">=8"
}
},
"node_modules/eslint-plugin-strict-null-checks/node_modules/json-schema-traverse": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
"dev": true,
"peer": true
},
"node_modules/eslint-plugin-strict-null-checks/node_modules/minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true,
"peer": true,
"dependencies": {
"brace-expansion": "^1.1.7"
},
"engines": {
"node": "*"
}
},
"node_modules/eslint-plugin-strict-null-checks/node_modules/path-key": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
"dev": true,
"peer": true,
"engines": {
"node": ">=8"
}
},
"node_modules/eslint-plugin-strict-null-checks/node_modules/shebang-command": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
"dev": true,
"peer": true,
"dependencies": {
"shebang-regex": "^3.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/eslint-plugin-strict-null-checks/node_modules/shebang-regex": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
"dev": true,
"peer": true,
"engines": {
"node": ">=8"
}
},
"node_modules/eslint-plugin-strict-null-checks/node_modules/supports-color": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"peer": true,
"dependencies": {
"has-flag": "^4.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/eslint-plugin-strict-null-checks/node_modules/which": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"dev": true,
"peer": true,
"dependencies": {
"isexe": "^2.0.0"
},
"bin": {
"node-which": "bin/node-which"
},
"engines": {
"node": ">= 8"
}
},
"node_modules/eslint-scope": {
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.2.0.tgz",
"integrity": "sha512-PHlWUfG6lvPc3yvP5A4PNyBL1W8fkDUccmI21JUu/+GKZBoH/W5u6usENXUrWFRsyoW5ACUjFGgAFQp5gUlb/A==",
"dev": true,
"dependencies": {
"esrecurse": "^4.3.0",
"estraverse": "^5.2.0"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"url": "https://opencollective.com/eslint"
}
},
"node_modules/eslint-visitor-keys": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz",
@ -6038,6 +5536,30 @@
"node": ">= 8"
}
},
"node_modules/eslint/node_modules/doctrine": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
"integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==",
"dev": true,
"dependencies": {
"esutils": "^2.0.2"
},
"engines": {
"node": ">=6.0.0"
}
},
"node_modules/eslint/node_modules/eslint-visitor-keys": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz",
"integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==",
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"url": "https://opencollective.com/eslint"
}
},
"node_modules/eslint/node_modules/glob-parent": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",
@ -6050,6 +5572,21 @@
"node": ">=10.13.0"
}
},
"node_modules/eslint/node_modules/globals": {
"version": "13.24.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz",
"integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==",
"dev": true,
"dependencies": {
"type-fest": "^0.20.2"
},
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/eslint/node_modules/has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
@ -6135,17 +5672,29 @@
}
},
"node_modules/espree": {
"version": "10.3.0",
"resolved": "https://registry.npmjs.org/espree/-/espree-10.3.0.tgz",
"integrity": "sha512-0QYC8b24HWY8zjRnDTL6RiHfDbAWn63qb4LMj1Z4b076A4une81+z03Kg7l7mn/48PUTqoLptSXez8oknU8Clg==",
"version": "9.6.1",
"resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz",
"integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==",
"dev": true,
"dependencies": {
"acorn": "^8.14.0",
"acorn": "^8.9.0",
"acorn-jsx": "^5.3.2",
"eslint-visitor-keys": "^4.2.0"
"eslint-visitor-keys": "^3.4.1"
},
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"url": "https://opencollective.com/eslint"
}
},
"node_modules/espree/node_modules/eslint-visitor-keys": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz",
"integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==",
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"funding": {
"url": "https://opencollective.com/eslint"
@ -6336,15 +5885,15 @@
"integrity": "sha512-FJqqoDBR00Mdj9ppamLa/Y7vxm+PRmNWA67N846RvsoYVMKB4q3y/de5PA7gUmRMYK/8CMz2GDZQmCRN1wBcWA=="
},
"node_modules/file-entry-cache": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz",
"integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==",
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz",
"integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==",
"dev": true,
"dependencies": {
"flat-cache": "^4.0.0"
"flat-cache": "^3.0.4"
},
"engines": {
"node": ">=16.0.0"
"node": "^10.12.0 || >=12.0.0"
}
},
"node_modules/file-type": {
@ -6437,16 +5986,17 @@
}
},
"node_modules/flat-cache": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz",
"integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==",
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.2.0.tgz",
"integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==",
"dev": true,
"dependencies": {
"flatted": "^3.2.9",
"keyv": "^4.5.4"
"keyv": "^4.5.3",
"rimraf": "^3.0.2"
},
"engines": {
"node": ">=16"
"node": "^10.12.0 || >=12.0.0"
}
},
"node_modules/flatted": {
@ -6603,8 +6153,7 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
"dev": true,
"peer": true
"dev": true
},
"node_modules/fsevents": {
"version": "2.3.3",
@ -7585,7 +7134,6 @@
"integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
"deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.",
"dev": true,
"peer": true,
"dependencies": {
"once": "^1.3.0",
"wrappy": "1"
@ -7918,7 +7466,6 @@
"resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz",
"integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==",
"dev": true,
"peer": true,
"engines": {
"node": ">=8"
}
@ -9761,7 +9308,6 @@
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
"integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",
"dev": true,
"peer": true,
"engines": {
"node": ">=0.10.0"
}
@ -11421,7 +10967,6 @@
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
"deprecated": "Rimraf versions prior to v4 are no longer supported",
"dev": true,
"peer": true,
"dependencies": {
"glob": "^7.1.3"
},
@ -11437,7 +10982,6 @@
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"dev": true,
"peer": true,
"dependencies": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
@ -11449,7 +10993,6 @@
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
"deprecated": "Glob versions prior to v9 are no longer supported",
"dev": true,
"peer": true,
"dependencies": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
@ -11470,7 +11013,6 @@
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true,
"peer": true,
"dependencies": {
"brace-expansion": "^1.1.7"
},
@ -12313,8 +11855,7 @@
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
"integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==",
"dev": true,
"peer": true
"dev": true
},
"node_modules/thenify": {
"version": "3.3.1",
@ -12614,7 +12155,6 @@
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz",
"integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==",
"dev": true,
"peer": true,
"engines": {
"node": ">=10"
},

View file

@ -91,7 +91,7 @@
"@vitest/coverage-v8": "^2.1.3",
"@vitest/ui": "^2.1.3",
"autoprefixer": "^10.4.13",
"eslint": "^9.15.0",
"eslint": "^8",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-strict-null-checks": "^0.1.3",
"jsdom": "^25.0.1",

View file

@ -5,7 +5,6 @@ import { VscThemeProvider } from "./context/VscTheme";
import useSetup from "./hooks/useSetup";
import { AddNewModel, ConfigureProvider } from "./pages/AddNewModel";
import ConfigErrorPage from "./pages/config-error";
import Edit from "./pages/edit";
import ErrorPage from "./pages/error";
import Chat from "./pages/gui";
import History from "./pages/history";
@ -38,10 +37,6 @@ const router = createMemoryRouter([
path: "/stats",
element: <Stats />,
},
{
path: "/edit",
element: <Edit />,
},
{
path: "/addModel",
element: <AddNewModel />,

View file

@ -4,7 +4,7 @@ import {
useSubmenuContextProviders,
} from "../../context/SubmenuContextProviders";
import { Combobox } from "@headlessui/react";
import FileIcon from "../../components/FileIcon";
import FileIcon from "../FileIcon";
import { useAppSelector } from "../../redux/hooks";
export interface AddFileComboboxProps {

View file

@ -2,7 +2,7 @@ import { useContext, useState } from "react";
import { useDispatch } from "react-redux";
import { IdeMessengerContext } from "../../context/IdeMessenger";
import CodeToEditListItem from "./CodeToEditListItem";
import { CodeToEdit, RangeInFileWithContents } from "core";
import type { CodeToEdit, RangeInFileWithContents } from "core";
import AddFileButton from "./AddFileButton";
import AddFileCombobox from "./AddFileCombobox";
import { XMarkIcon } from "@heroicons/react/24/outline";
@ -12,7 +12,7 @@ import {
removeCodeToEdit,
} from "../../redux/slices/sessionSlice";
export default function WorkingSet() {
export default function CodeToEditCard() {
const dispatch = useDispatch();
const ideMessenger = useContext(IdeMessengerContext);
const [showAddFileCombobox, setShowAddFileCombobox] = useState(false);
@ -55,7 +55,7 @@ export default function WorkingSet() {
}
return (
<div className="bg-vsc-editor-background mx-1 flex flex-col rounded-t-lg p-1">
<div className="bg-vsc-editor-background mx-3 flex flex-col rounded-t-lg p-1">
<div className="text-lightgray flex items-center justify-between gap-1.5 py-1.5 pl-3 pr-2 text-xs">
<span>{title}</span>
<AddFileButton onClick={() => setShowAddFileCombobox(true)} />

View file

@ -1,11 +1,11 @@
import FileIcon from "../../components/FileIcon";
import FileIcon from "../FileIcon";
import {
ChevronDownIcon,
ChevronRightIcon,
XMarkIcon,
} from "@heroicons/react/24/outline";
import { useState } from "react";
import StyledMarkdownPreview from "../../components/markdown/StyledMarkdownPreview";
import StyledMarkdownPreview from "../markdown/StyledMarkdownPreview";
import { getLastNPathParts, getMarkdownLanguageTagForFile } from "core/util";
import styled from "styled-components";
import { CodeToEdit } from "core";
@ -16,7 +16,6 @@ export interface CodeToEditListItemProps {
onClickFilename: (codeToEdit: CodeToEdit) => void;
}
// Easiest method to overwrite the top level styling of the markdown preview
const NoPaddingWrapper = styled.div`
> * {
margin: 0 !important;
@ -64,16 +63,20 @@ export default function CodeToEditListItem({
return (
<li
className="group flex cursor-pointer flex-col"
onClick={() => setShowCodeSnippet((showCodeSnippet) => !showCodeSnippet)}
onClick={() => {
if (!isInsertion) {
setShowCodeSnippet((showCodeSnippet) => !showCodeSnippet);
}
}}
>
<div
className={`hover:bg-lightgray hover:text-vsc-foreground flex justify-between rounded px-2 py-0.5 transition-colors hover:bg-opacity-20 ${showCodeSnippet && "text-vsc-foreground bg-lightgray bg-opacity-20"}`}
className={`hover:bg-lightgray hover:text-vsc-foreground flex items-center justify-between rounded px-2 py-0.5 transition-colors hover:bg-opacity-20 ${showCodeSnippet && "text-vsc-foreground bg-lightgray bg-opacity-20"}`}
>
<div className="flex items-center gap-0.5">
<div className="flex w-4/5 min-w-0 items-center gap-0.5">
<FileIcon filename={code.filepath} height={"18px"} width={"18px"} />
<div className="flex gap-1.5">
<div className="flex min-w-0 gap-1.5">
<span
className="text-xs hover:underline"
className="flex-shrink-0 text-xs hover:underline"
onClick={(e) => {
e.stopPropagation();
onClickFilename(code);
@ -81,20 +84,21 @@ export default function CodeToEditListItem({
>
{title}
</span>
<span className="text-lightgray invisible max-w-[50%] truncate text-xs group-hover:visible">
<span className="text-lightgray invisible flex-grow truncate text-xs group-hover:visible">
{fileSubpath}
</span>
</div>
</div>
<div className="invisible flex gap-1.5 group-hover:visible">
<div className={isInsertion && "hidden"}>
<div className="invisible flex items-center gap-1.5 group-hover:visible">
<div className={`flex items-center ${isInsertion ? "hidden" : ""}`}>
{showCodeSnippet ? (
<ChevronDownIcon
onClick={(e) => {
e.stopPropagation();
setShowCodeSnippet(false);
}}
className="text-lightgray hover:bg-lightgray hover:text-vsc-foreground h-3.5 w-3.5 cursor-pointer rounded-md rounded-sm p-0.5 hover:bg-opacity-20"
className="text-lightgray hover:bg-lightgray hover:text-vsc-foreground h-3.5 w-3.5 cursor-pointer rounded-sm p-0.5 hover:bg-opacity-20"
/>
) : (
<ChevronRightIcon
@ -102,17 +106,19 @@ export default function CodeToEditListItem({
e.stopPropagation();
setShowCodeSnippet(true);
}}
className="text-lightgray hover:bg-lightgray hover:text-vsc-foreground h-3.5 w-3.5 cursor-pointer rounded-md rounded-sm p-0.5 hover:bg-opacity-20"
className="text-lightgray hover:bg-lightgray hover:text-vsc-foreground h-3.5 w-3.5 cursor-pointer rounded-sm p-0.5 hover:bg-opacity-20"
/>
)}
</div>
<XMarkIcon
onClick={(e) => {
e.stopPropagation();
onDelete(code);
}}
className="text-lightgray hover:bg-lightgray hover:text-vsc-foreground h-3.5 w-3.5 cursor-pointer rounded-md rounded-sm p-0.5 hover:bg-opacity-20"
/>
<div className="flex items-center">
<XMarkIcon
onClick={(e) => {
e.stopPropagation();
onDelete(code);
}}
className="text-lightgray hover:bg-lightgray hover:text-vsc-foreground h-3.5 w-3.5 cursor-pointer rounded-sm p-0.5 hover:bg-opacity-20"
/>
</div>
</div>
</div>

View file

@ -0,0 +1 @@
export { default } from "./CodeToEditCard";

View file

@ -1,22 +1,17 @@
import { useEffect, useMemo } from "react";
import { useDispatch } from "react-redux";
import { Outlet, useLocation, useNavigate } from "react-router-dom";
import styled from "styled-components";
import { CustomScrollbarDiv, defaultBorderRadius } from ".";
import { LastSessionProvider } from "../context/LastSessionContext";
import { useWebviewListener } from "../hooks/useWebviewListener";
import { useAppSelector } from "../redux/hooks";
import {
setEditDone,
setEditStatus,
focusEdit,
} from "../redux/slices/editModeState";
import { useAppDispatch, useAppSelector } from "../redux/hooks";
import { setEditStatus, focusEdit } from "../redux/slices/editModeState";
import { setDialogMessage, setShowDialog } from "../redux/slices/uiSlice";
import {
addCodeToEdit,
clearCodeToEdit,
updateApplyState,
updateCurCheckpoint,
setMode,
newSession,
} from "../redux/slices/sessionSlice";
import { getFontSize, isMetaEquivalentKeyPressed } from "../util";
import { getLocalStorage, setLocalStorage } from "../util/localStorage";
@ -27,6 +22,8 @@ import { isNewUserOnboarding, useOnboardingCard } from "./OnboardingCard";
import PostHogPageView from "./PosthogPageView";
import AccountDialog from "./AccountDialog";
import { AuthProvider } from "../context/Auth";
import useHistory from "../hooks/useHistory";
import { exitEditMode } from "../redux/thunks";
const LayoutTopDiv = styled(CustomScrollbarDiv)`
height: 100%;
@ -55,9 +52,10 @@ const GridDiv = styled.div`
const Layout = () => {
const navigate = useNavigate();
const location = useLocation();
const dispatch = useDispatch();
const dispatch = useAppDispatch();
const onboardingCard = useOnboardingCard();
const { pathname } = useLocation();
const { saveSession, loadLastSession } = useHistory(dispatch);
const configError = useAppSelector((state) => state.config.configError);
@ -159,20 +157,23 @@ const Layout = () => {
useWebviewListener(
"focusEdit",
async () => {
await saveSession(false);
dispatch(newSession());
dispatch(focusEdit());
dispatch(clearCodeToEdit());
navigate("/edit");
dispatch(setMode("edit"));
},
[navigate],
[],
);
useWebviewListener(
"focusEditWithoutClear",
async () => {
await saveSession(false);
dispatch(newSession());
dispatch(focusEdit());
navigate("/edit");
dispatch(setMode("edit"));
},
[navigate],
[],
);
useWebviewListener(
@ -191,14 +192,13 @@ const Layout = () => {
[],
);
useWebviewListener(
"exitEditMode",
async () => {
dispatch(setEditDone());
navigate("/");
},
[navigate],
);
useWebviewListener("exitEditMode", async () => {
loadLastSession().catch((e) =>
console.error(`Failed to load last session: ${e}`),
);
dispatch(exitEditMode());
});
useEffect(() => {
const handleKeyDown = (event: any) => {

View file

@ -3,6 +3,8 @@ import { IdeMessengerContext } from "../../context/IdeMessenger";
import { CheckIcon, XMarkIcon } from "@heroicons/react/24/outline";
import { ApplyState } from "core";
import { getMetaKeyLabel } from "../../util";
import { useAppSelector } from "../../redux/hooks";
import { selectIsSingleRangeEditOrInsertion } from "../../redux/slices/sessionSlice";
export interface AcceptRejectAllButtonsProps {
pendingApplyStates: ApplyState[];
@ -14,9 +16,7 @@ export default function AcceptRejectAllButtons({
onAcceptOrReject,
}: AcceptRejectAllButtonsProps) {
const ideMessenger = useContext(IdeMessengerContext);
// To handle the case of a single-range edit
const hasSinglePendingApplyStates = pendingApplyStates.length === 1;
const isSingleRangeEdit = useAppSelector(selectIsSingleRangeEditOrInsertion);
async function handleAcceptOrReject(status: "acceptDiff" | "rejectDiff") {
for (const { filepath, streamId } of pendingApplyStates) {
@ -37,7 +37,7 @@ export default function AcceptRejectAllButtons({
onClick={() => handleAcceptOrReject("rejectDiff")}
>
<XMarkIcon className="mr-1 h-4 w-4 text-red-600" />
{hasSinglePendingApplyStates ? (
{isSingleRangeEdit ? (
<span>Reject ({getMetaKeyLabel()}⇧⌫)</span>
) : (
<>
@ -52,7 +52,7 @@ export default function AcceptRejectAllButtons({
onClick={() => handleAcceptOrReject("acceptDiff")}
>
<CheckIcon className="mr-1 h-4 w-4 text-green-600" />
{hasSinglePendingApplyStates ? (
{isSingleRangeEdit ? (
<span>Accept ({getMetaKeyLabel()}⇧⏎)</span>
) : (
<>

View file

@ -1,13 +1,12 @@
import { ChatHistoryItem } from "core";
import { useSelector } from "react-redux";
import { RootState } from "../../redux/store";
import AcceptRejectAllButtons from "./AcceptRejectAllButtons";
import FeedbackButtons from "./FeedbackButtons";
import UndoAndRedoButtons from "./UndoAndRedoButtons";
import { renderChatMessage } from "core/util/messageContent";
import { CopyIconButton } from "../gui/CopyIconButton";
import { useAppSelector } from "../../redux/hooks";
import { useAppDispatch, useAppSelector } from "../../redux/hooks";
import useHistory from "../../hooks/useHistory";
import { exitEditMode } from "../../redux/thunks/exitEditMode";
export interface EditActionsProps {
index: number;
@ -18,6 +17,8 @@ export default function EditActions({ index, item }: EditActionsProps) {
// const curCheckpointIndex = useSelector(
// (store: RootState) => store.state.curCheckpointIndex,
// );
const dispatch = useAppDispatch();
const { loadLastSession } = useHistory(dispatch);
const isStreaming = useAppSelector((state) => state.session.isStreaming);
@ -55,7 +56,16 @@ export default function EditActions({ index, item }: EditActionsProps) {
<div className="flex-2 flex justify-center">
{hasPendingApplies && (
<AcceptRejectAllButtons pendingApplyStates={pendingApplyStates} />
<AcceptRejectAllButtons
pendingApplyStates={pendingApplyStates}
onAcceptOrReject={() => {
loadLastSession().catch((e) =>
console.error(`Failed to load last session: ${e}`),
);
dispatch(exitEditMode());
}}
/>
)}
{/* {hasClosedAllStreams && <UndoAndRedoButtons />} */}
</div>

View file

@ -6,6 +6,7 @@ import HeaderButtonWithToolTip from "../gui/HeaderButtonWithToolTip";
import EditActions from "./EditActions";
import FeedbackButtons from "./FeedbackButtons";
import { useAppSelector } from "../../redux/hooks";
import { selectIsInEditMode } from "../../redux/slices/sessionSlice";
export interface ResponseActionsProps {
isTruncated: boolean;
@ -24,9 +25,7 @@ export default function ResponseActions({
onDelete,
shouldHideActions,
}: ResponseActionsProps) {
const isInEditMode = useAppSelector(
(store) => store.editModeState.isInEditMode,
);
const isInEditMode = useAppSelector(selectIsInEditMode);
if (isInEditMode) {
return <EditActions index={index} item={item} />;

View file

@ -0,0 +1,64 @@
import { usePostHog } from "posthog-js/react";
import { setDialogMessage } from "../../redux/slices/uiSlice";
import { useAppDispatch } from "../../redux/hooks";
export default function FeedbackDialog() {
const posthog = usePostHog();
const dispatch = useAppDispatch();
return (
<div className="p-4 text-center">
👋 Thanks for using Continue. We are always trying to improve and love
hearing from users. If you're interested in speaking, enter your name and
email. We won't use this information for anything other than reaching out.
<br />
<br />
<form
onSubmit={(e: any) => {
e.preventDefault();
posthog?.capture("user_interest_form", {
name: e.target.elements[0].value,
email: e.target.elements[1].value,
});
dispatch(
setDialogMessage(
<div className="p-4 text-center">
Thanks! We'll be in touch soon.
</div>,
),
);
}}
style={{
display: "flex",
flexDirection: "column",
gap: "10px",
}}
>
<input
style={{ padding: "10px", borderRadius: "5px" }}
type="text"
name="name"
placeholder="Name"
required
/>
<input
style={{ padding: "10px", borderRadius: "5px" }}
type="email"
name="email"
placeholder="Email"
required
/>
<button
style={{
padding: "10px",
borderRadius: "5px",
cursor: "pointer",
}}
type="submit"
>
Submit
</button>
</form>
</div>
);
}

View file

@ -9,8 +9,11 @@ import ContextItemsPeek from "./ContextItemsPeek";
import TipTapEditor from "./TipTapEditor";
import { useAppSelector } from "../../redux/hooks";
import { newSession, setMessageAtIndex } from "../../redux/slices/sessionSlice";
import { ToolbarOptions } from "./InputToolbar";
import { useMemo } from "react";
interface ContinueInputBoxProps {
isEditMode?: boolean;
isLastUserInput: boolean;
isMainInput?: boolean;
onEnter: (
@ -23,6 +26,18 @@ interface ContinueInputBoxProps {
hidden?: boolean;
}
const EDIT_DISALLOWED_CONTEXT_PROVIDERS = [
"codebase",
"tree",
"open",
"web",
"diff",
"folder",
"search",
"debugger",
"repo-map",
];
const gradient = keyframes`
0% {
background-position: 0px 0;
@ -63,7 +78,7 @@ const GradientBorder = styled.div<{
function ContinueInputBox(props: ContinueInputBoxProps) {
const dispatch = useDispatch();
const active = useAppSelector((state) => state.session.isStreaming);
const isStreaming = useAppSelector((state) => state.session.isStreaming);
const availableSlashCommands = useAppSelector(
selectSlashCommandComboBoxInputs,
);
@ -73,6 +88,42 @@ function ContinueInputBox(props: ContinueInputBoxProps) {
const useTools = useAppSelector(
(state) => state.config.config.experimental?.useTools !== false,
);
const editModeState = useAppSelector((state) => state.editModeState);
const filteredSlashCommands = props.isEditMode ? [] : availableSlashCommands;
const filteredContextProviders = useMemo(() => {
if (!props.isEditMode) {
availableContextProviders;
}
return (
availableContextProviders?.filter(
(provider) =>
!EDIT_DISALLOWED_CONTEXT_PROVIDERS.includes(provider.title),
) ?? []
);
}, [availableContextProviders]);
const isStreamingEdit =
editModeState.editStatus === "streaming" ||
editModeState.editStatus === "accepting";
const historyKey = props.isEditMode ? "edit" : "chat";
const placeholder = props.isEditMode
? "Describe how to modify the code - use '#' to add files"
: undefined;
const toolbarOptions: ToolbarOptions = props.isEditMode
? {
hideAddContext: false,
hideImageUpload: false,
hideUseCodebase: true,
hideSelectModel: false,
hideTools: true,
enterText: isStreamingEdit ? "Retry" : "Edit",
}
: {
hideTools: !useTools,
};
useWebviewListener(
"newSessionWithPrompt",
@ -92,29 +143,23 @@ function ContinueInputBox(props: ContinueInputBoxProps) {
return (
<div className={`${props.hidden ? "hidden" : ""}`}>
<div className={`relative flex px-2`}>
<div className={`relative flex flex-col px-2`}>
<GradientBorder
loading={active && props.isLastUserInput ? 1 : 0}
loading={isStreaming && props.isLastUserInput ? 1 : 0}
borderColor={
active && props.isLastUserInput ? undefined : vscBackground
isStreaming && props.isLastUserInput ? undefined : vscBackground
}
borderRadius={defaultBorderRadius}
>
<TipTapEditor
editorState={props.editorState}
onEnter={(...args) => {
props.onEnter(...args);
if (props.isMainInput) {
args[2].commands.clearContent(true);
}
}}
onEnter={props.onEnter}
placeholder={placeholder}
isMainInput={props.isMainInput ?? false}
availableContextProviders={availableContextProviders ?? []}
availableSlashCommands={availableSlashCommands}
historyKey="chat"
toolbarOptions={{
hideTools: !useTools,
}}
availableContextProviders={filteredContextProviders}
availableSlashCommands={filteredSlashCommands}
historyKey={historyKey}
toolbarOptions={toolbarOptions}
/>
</GradientBorder>
</div>

View file

@ -24,7 +24,6 @@ import {
useRef,
useState,
} from "react";
import { useDispatch } from "react-redux";
import styled from "styled-components";
import { v4 } from "uuid";
import {
@ -64,12 +63,14 @@ import {
handleVSCMetaKeyIssues,
} from "./handleMetaKeyIssues";
import { ComboBoxItem } from "./types";
import { useAppSelector } from "../../redux/hooks";
import { useAppDispatch, useAppSelector } from "../../redux/hooks";
import { selectDefaultModel } from "../../redux/slices/configSlice";
import {
addCodeToEdit,
clearCodeToEdit,
selectIsInEditMode,
} from "../../redux/slices/sessionSlice";
import { exitEditMode } from "../../redux/thunks";
const InputBoxDiv = styled.div<{ border?: string }>`
resize: none;
@ -175,7 +176,7 @@ interface TipTapEditorProps {
}
function TipTapEditor(props: TipTapEditorProps) {
const dispatch = useDispatch();
const dispatch = useAppDispatch();
const ideMessenger = useContext(IdeMessengerContext);
const { getSubmenuContextItems } = useSubmenuContextProviders();
@ -184,7 +185,7 @@ function TipTapEditor(props: TipTapEditorProps) {
const useActiveFile = useAppSelector(selectUseActiveFile);
const { saveSession, loadSession } = useHistory(dispatch);
const { saveSession, loadSession, loadLastSession } = useHistory(dispatch);
const posthog = usePostHog();
@ -193,10 +194,6 @@ function TipTapEditor(props: TipTapEditorProps) {
const isOSREnabled = useIsOSREnabled();
const isInEditMode = useAppSelector(
(state) => state.editModeState.isInEditMode,
);
const enterSubmenu = async (editor: Editor, providerId: string) => {
const contents = editor.getText();
const indexOfAt = contents.lastIndexOf("@");
@ -251,8 +248,11 @@ function TipTapEditor(props: TipTapEditorProps) {
props.availableSlashCommands,
);
const active = useAppSelector((state) => state.session.isStreaming);
const activeRef = useUpdatingRef(active);
const isStreaming = useAppSelector((state) => state.session.isStreaming);
const isStreamingRef = useUpdatingRef(isStreaming);
const isInEditMode = useAppSelector(selectIsInEditMode);
const isInEditModeRef = useUpdatingRef(isInEditMode);
async function handleImageFile(
file: File,
@ -347,11 +347,10 @@ function TipTapEditor(props: TipTapEditorProps) {
},
}),
Placeholder.configure({
placeholder:
props.placeholder ??
(historyLengthRef.current === 0
? "Ask anything, '@' to add context"
: "Ask a follow-up"),
placeholder: getPlaceholderText(
props.placeholder,
historyLengthRef.current,
),
}),
Paragraph.extend({
addKeyboardShortcuts() {
@ -389,7 +388,7 @@ function TipTapEditor(props: TipTapEditorProps) {
// If you press cmd+backspace wanting to cancel,
// but are inside of a text box, it shouldn't
// delete the text
if (activeRef.current) {
if (isStreamingRef.current) {
return true;
}
},
@ -418,6 +417,19 @@ function TipTapEditor(props: TipTapEditorProps) {
return true;
}
},
Escape: () => {
if (inDropdownRef.current || !isInEditModeRef.current) {
return false;
}
loadLastSession().catch((e) =>
console.error(`Failed to load last session: ${e}`),
);
dispatch(exitEditMode());
return true;
},
ArrowDown: () => {
if (
this.editor.state.selection.anchor <
@ -460,7 +472,7 @@ function TipTapEditor(props: TipTapEditorProps) {
return `@${props.node.attrs.label || props.node.attrs.id}`;
},
}),
isInEditMode
isInEditModeRef.current
? AddCodeToEdit.configure({
HTMLAttributes: {
class: "add-code-to-edit",
@ -528,7 +540,7 @@ function TipTapEditor(props: TipTapEditorProps) {
},
},
content: props.editorState || mainEditorContent || "",
editable: !active || props.isMainInput,
editable: !isStreaming || props.isMainInput,
});
const [shouldHideToolbar, setShouldHideToolbar] = useState(false);
@ -536,6 +548,38 @@ function TipTapEditor(props: TipTapEditorProps) {
setShouldHideToolbar(value);
}, 200);
function getPlaceholderText(
placeholder: TipTapEditorProps["placeholder"],
historyLength: number,
) {
if (placeholder) {
return placeholder;
}
return historyLength === 0
? "Ask anything, '@' to add context"
: "Ask a follow-up";
}
useEffect(() => {
const placeholder = getPlaceholderText(
props.placeholder,
historyLengthRef.current,
);
editor.extensionManager.extensions.filter(
(extension) => extension.name === "placeholder",
)[0].options["placeholder"] = placeholder;
editor.view.dispatch(editor.state.tr);
}, [editor, props.placeholder, historyLengthRef.current]);
useEffect(() => {
if (props.isMainInput) {
editor.commands.clearContent(true);
}
}, [isInEditMode, props.isMainInput]);
useEffect(() => {
if (editor) {
const handleFocus = () => {
@ -588,7 +632,7 @@ function TipTapEditor(props: TipTapEditorProps) {
const onEnterRef = useUpdatingRef(
(modifiers: InputModifiers) => {
if (active) {
if (isStreaming) {
return;
}
@ -611,10 +655,10 @@ function TipTapEditor(props: TipTapEditorProps) {
// Re-focus main input after done generating
useEffect(() => {
if (editor && !active && props.isMainInput && document.hasFocus()) {
if (editor && !isStreaming && props.isMainInput && document.hasFocus()) {
editor.commands.focus(undefined, { scrollIntoView: false });
}
}, [props.isMainInput, active, editor]);
}, [props.isMainInput, isStreaming, editor]);
// IDE event listeners
useWebviewListener(
@ -918,7 +962,7 @@ function TipTapEditor(props: TipTapEditorProps) {
});
});
}}
disabled={active}
disabled={isStreaming}
/>
</PaddingDiv>

View file

@ -15,7 +15,10 @@ import GeneratingCodeLoader from "./GeneratingCodeLoader";
import RunInTerminalButton from "./RunInTerminalButton";
import { useAppSelector } from "../../../redux/hooks";
import { selectDefaultModel } from "../../../redux/slices/configSlice";
import { selectApplyStateByStreamId } from "../../../redux/slices/sessionSlice";
import {
selectApplyStateByStreamId,
selectIsInEditMode,
} from "../../../redux/slices/sessionSlice";
const TopDiv = styled.div`
outline: 1px solid rgba(153, 153, 152);
@ -56,9 +59,7 @@ export default function StepContainerPreToolbar(
const ideMessenger = useContext(IdeMessengerContext);
const streamIdRef = useRef<string>(uuidv4());
const wasGeneratingRef = useRef(props.isGeneratingCodeBlock);
const isInEditMode = useAppSelector(
(state) => state.editModeState.isInEditMode,
);
const isInEditMode = useAppSelector(selectIsInEditMode);
const [isExpanded, setIsExpanded] = useState(
props.expanded ?? (isInEditMode ? false : true),
);
@ -126,6 +127,7 @@ export default function StepContainerPreToolbar(
useEffect(() => {
const hasCompletedGenerating =
wasGeneratingRef.current && !isGeneratingCodeBlock;
const shouldAutoApply = hasCompletedGenerating && isInEditMode;
if (shouldAutoApply) {

View file

@ -256,9 +256,12 @@ const StyledMarkdownPreview = memo(function StyledMarkdownPreview(
const content = getCodeChildrenContent(codeProps.children);
if (content && contextItemsRef.current) {
const ctxItem = contextItemsRef.current.find((ctxItem) =>
ctxItem.uri?.value.includes(content),
const ctxItem = contextItemsRef.current.find(
(ctxItem) =>
ctxItem.uri?.value.includes(content) &&
ctxItem.uri.type === "file",
);
if (ctxItem) {
const rif = ctxItemToRifWithContents(ctxItem);
return <FilenameLink rif={rif} />;

View file

@ -17,6 +17,7 @@ const STATUS_TO_ICON: Record<IndexingProgressUpdate["status"], any> = {
paused: PauseCircleIcon,
done: CheckCircleIcon,
failed: null, // Since we show an erorr message below
cancelled: null,
};
function IndexingProgressIndicator({ update }: IndexingProgressIndicatorProps) {

View file

@ -15,6 +15,7 @@ const STATUS_TO_SUBTITLE_TEXT: Record<
paused: "Click to resume",
failed: "Click to retry",
disabled: "Click to open config.json and enable indexing (requires reload)",
cancelled: "Click to restart",
};
function IndexingProgressSubtext({

View file

@ -12,6 +12,7 @@ const STATUS_TO_TEXT: Record<IndexingProgressUpdate["status"], string> = {
paused: "Indexing paused",
failed: "Indexing failed",
disabled: "Indexing disabled",
cancelled: "Indexing cancelled",
};
function IndexingProgressTitleText({ update }: IndexingProgressTitleTextProps) {

View file

@ -1,249 +0,0 @@
import { ArrowLeftIcon } from "@heroicons/react/24/outline";
import { Editor, JSONContent } from "@tiptap/core";
import { InputModifiers, RangeInFileWithContents } from "core";
import { stripImages } from "core/util/messageContent";
import { useCallback, useContext, useEffect, useMemo } from "react";
import { useNavigate } from "react-router-dom";
import ContinueInputBox from "../../components/mainInput/ContinueInputBox";
import { ToolbarOptions } from "../../components/mainInput/InputToolbar";
import { NewSessionButton } from "../../components/mainInput/NewSessionButton";
import resolveEditorContent from "../../components/mainInput/resolveInput";
import TipTapEditor from "../../components/mainInput/TipTapEditor";
import StepContainer from "../../components/StepContainer";
import AcceptRejectAllButtons from "../../components/StepContainer/AcceptRejectAllButtons";
import { IdeMessengerContext } from "../../context/IdeMessenger";
import { setEditDone, submitEdit } from "../../redux/slices/editModeState";
import { streamResponseThunk } from "../../redux/thunks/streamResponse";
import CodeToEdit from "./CodeToEdit";
import getMultifileEditPrompt from "./getMultifileEditPrompt";
import { useAppDispatch, useAppSelector } from "../../redux/hooks";
import {
clearCodeToEdit,
selectApplyStateByStreamId,
} from "../../redux/slices/sessionSlice";
const EDIT_DISALLOWED_CONTEXT_PROVIDERS = [
"codebase",
"tree",
"open",
"web",
"diff",
"folder",
"search",
"debugger",
"repo-map",
];
export default function Edit() {
const dispatch = useAppDispatch();
const navigate = useNavigate();
const ideMessenger = useContext(IdeMessengerContext);
const editModeState = useAppSelector((state) => state.editModeState);
const codeToEdit = useAppSelector((state) => state.session.codeToEdit);
const availableContextProviders = useAppSelector(
(state) => state.config.config.contextProviders,
);
const selectedModelTitle = useAppSelector(
(state) => state.config.defaultModelTitle,
);
const filteredContextProviders = useMemo(() => {
return (
availableContextProviders?.filter(
(provider) =>
!EDIT_DISALLOWED_CONTEXT_PROVIDERS.includes(provider.title),
) ?? []
);
}, [availableContextProviders]);
const history = useAppSelector((state) => state.session.history);
const applyStates = useAppSelector(
(state) => state.session.codeBlockApplyStates.states,
);
const applyState = useAppSelector(
(state) => selectApplyStateByStreamId(state, "edit")?.status ?? "closed",
);
const isSingleRangeEdit =
codeToEdit.length === 0 ||
(codeToEdit.length === 1 && "range" in codeToEdit[0]);
useEffect(() => {
if (editModeState.editStatus === "done") {
ideMessenger.post("edit/escape", undefined);
navigate("/");
}
}, [editModeState.editStatus]);
useEffect(() => {
if (applyState === "closed" && editModeState.editStatus === "accepting") {
dispatch(setEditDone());
}
}, [applyState, editModeState.editStatus]);
const pendingApplyStates = applyStates.filter(
(state) => state.status === "done",
);
const isStreaming =
editModeState.editStatus === "streaming" ||
editModeState.editStatus === "accepting";
const toolbarOptions: ToolbarOptions = {
hideAddContext: false,
hideImageUpload: false,
hideUseCodebase: true,
hideSelectModel: false,
hideTools: true,
enterText: isStreaming ? "Retry" : "Edit",
};
const hasPendingApplies = pendingApplyStates.length > 0;
async function handleSingleRangeEdit(
editorState: JSONContent,
modifiers: InputModifiers,
editor: Editor,
) {
if (!selectedModelTitle) {
console.error("Failed to handle single range edit: no model selected");
return;
}
const [contextItems, __, userInstructions] = await resolveEditorContent({
editorState,
selectedModelTitle,
modifiers: {
noContext: true,
useCodebase: false,
},
ideMessenger,
defaultContextProviders: [],
dispatch,
});
const prompt = [
...contextItems.map((item) => item.content),
stripImages(userInstructions),
].join("\n\n");
ideMessenger.post("edit/sendPrompt", {
prompt,
range: codeToEdit[0] as RangeInFileWithContents,
});
dispatch(submitEdit(prompt));
editor.commands.selectTextblockEnd();
}
async function handleEditorEnter(
editorState: JSONContent,
modifiers: InputModifiers,
editor: Editor,
) {
if (isSingleRangeEdit) {
handleSingleRangeEdit(editorState, modifiers, editor);
} else {
const promptPreamble = getMultifileEditPrompt(codeToEdit);
dispatch(
streamResponseThunk({
editorState,
modifiers,
promptPreamble,
}),
);
}
}
function handleBackClick() {
dispatch(setEditDone());
}
const isLastUserInput = useCallback(
(index: number): boolean => {
return !history
.slice(index + 1)
.some((entry) => entry.message.role === "user");
},
[history],
);
return (
<div className="h-full overflow-y-auto">
<div className="m-auto max-w-3xl">
<div className="relative mb-1 mt-3 flex flex-col px-2">
<CodeToEdit />
<TipTapEditor
isMainInput
toolbarOptions={toolbarOptions}
placeholder="Describe how to modify the code - use '#' to add files"
availableContextProviders={filteredContextProviders}
historyKey="edit"
availableSlashCommands={[]}
onEnter={handleEditorEnter}
/>
</div>
{!isSingleRangeEdit && history.length > 1 && (
<div>
{history.slice(1).map((item, index: number) => (
<div>
{item.message.role === "user" ? (
<ContinueInputBox
onEnter={async (editorState, modifiers) => {
dispatch(
streamResponseThunk({
editorState,
modifiers,
index,
}),
);
}}
isLastUserInput={isLastUserInput(index)}
isMainInput={false}
editorState={item.editorState}
contextItems={item.contextItems}
/>
) : (
<StepContainer
index={index}
isLast={index === history.length - 1}
item={item}
/>
)}
</div>
))}
{/* {!active && (
<ContinueInputBox
isMainInput
isLastUserInput={false}
onEnter={handleEditorEnter}
/>
)} */}
</div>
)}
<div className="mt-2">
{hasPendingApplies && isSingleRangeEdit && (
<AcceptRejectAllButtons
pendingApplyStates={pendingApplyStates}
onAcceptOrReject={() => dispatch(clearCodeToEdit())}
/>
)}
{!hasPendingApplies && isSingleRangeEdit && (
<NewSessionButton
onClick={handleBackClick}
className="mr-auto flex items-center gap-2"
>
<ArrowLeftIcon width="11px" height="11px" />
Back to Chat
</NewSessionButton>
)}
</div>
</div>
</div>
);
}

View file

@ -1 +0,0 @@
export { default } from "./Edit";

View file

@ -31,12 +31,12 @@ const ErrorPage: React.FC = () => {
}, 500);
}, []);
return (
<div className="bg- flex min-h-screen flex-col items-center justify-center px-8 py-4 text-center">
<div className="flex flex-col items-center justify-center px-2 py-4 text-center sm:px-8">
<h1 className="mb-4 text-3xl font-bold">Error in Continue UI</h1>
<pre className="pb-6">
<code className="px-3 py-2">{error.statusText || error.message}</code>
</pre>
<code className="whitespace-wrap mx-2 mb-4 max-w-full break-words py-2">
{error.statusText || error.message}
</code>
<Button
className="flex flex-row items-center gap-2"

View file

@ -4,8 +4,8 @@ import {
CodeBracketSquareIcon,
ExclamationTriangleIcon,
} from "@heroicons/react/24/outline";
import { JSONContent } from "@tiptap/react";
import { InputModifiers, ToolCallState } from "core";
import { Editor, JSONContent } from "@tiptap/react";
import { InputModifiers, RangeInFileWithContents, ToolCallState } from "core";
import { streamResponse } from "core/llm/stream";
import { usePostHog } from "posthog-js/react";
import { useCallback, useContext, useEffect, useRef, useState } from "react";
@ -38,6 +38,8 @@ import { selectCurrentToolCall } from "../../redux/selectors/selectCurrentToolCa
import {
clearLastEmptyResponse,
newSession,
selectIsInEditMode,
selectIsSingleRangeEditOrInsertion,
setInactive,
} from "../../redux/slices/sessionSlice";
import { streamResponseThunk } from "../../redux/thunks/streamResponse";
@ -60,6 +62,14 @@ import {
setShowDialog,
} from "../../redux/slices/uiSlice";
import { RootState } from "../../redux/store";
import FeedbackDialog from "../../components/dialogs/FeedbackDialog";
import getMultifileEditPrompt from "../../util/getMultifileEditPrompt";
import { submitEdit } from "../../redux/slices/editModeState";
import { stripImages } from "core/util/messageContent";
import resolveEditorContent from "../../components/mainInput/resolveInput";
import AcceptRejectAllButtons from "../../components/StepContainer/AcceptRejectAllButtons";
import CodeToEditCard from "../../components/CodeToEditCard";
import { exitEditMode } from "../../redux/thunks/exitEditMode";
const StopButton = styled.div`
background-color: ${vscBackground};
@ -130,16 +140,27 @@ export function Chat() {
const mainTextInputRef = useRef<HTMLInputElement>(null);
const stepsDivRef = useRef<HTMLDivElement>(null);
const [isAtBottom, setIsAtBottom] = useState<boolean>(false);
const messages = useAppSelector((state) => state.session.history);
const history = useAppSelector((state) => state.session.history);
const showChatScrollbar = useAppSelector(
(state) => state.config.config.ui?.showChatScrollbar,
);
const { saveSession, getLastSessionId, loadLastSession } =
useHistory(dispatch);
const codeToEdit = useAppSelector((state) => state.session.codeToEdit);
const toolCallState = useSelector<RootState, ToolCallState | undefined>(
selectCurrentToolCall,
);
const applyStates = useAppSelector(
(state) => state.session.codeBlockApplyStates.states,
);
const pendingApplyStates = applyStates.filter(
(state) => state.status === "done",
);
const hasPendingApplies = pendingApplyStates.length > 0;
const isInEditMode = useAppSelector(selectIsInEditMode);
const isSingleRangeEditOrInsertion = useAppSelector(
selectIsSingleRangeEditOrInsertion,
);
const snapToBottom = useCallback(() => {
if (!stepsDivRef.current) return;
@ -160,6 +181,10 @@ export function Chat() {
setIsAtBottom(true);
}, [stepsDivRef, setIsAtBottom]);
const returnToLastSessionButtonText = isInEditMode
? "Back to Chat"
: "Last Session";
useEffect(() => {
if (active) snapToBottom();
}, [active, snapToBottom]);
@ -203,7 +228,7 @@ export function Chat() {
const { widget, highlights } = useFindWidget(stepsDivRef);
const sendInput = useCallback(
(editorState: JSONContent, modifiers: InputModifiers) => {
(editorState: JSONContent, modifiers: InputModifiers, editor: Editor) => {
if (defaultModel?.provider === "free-trial") {
const u = getLocalStorage("ftc");
if (u) {
@ -223,71 +248,25 @@ export function Chat() {
}
}
dispatch(streamResponseThunk({ editorState, modifiers }));
if (isSingleRangeEditOrInsertion) {
handleSingleRangeEditOrInsertion(editorState);
return;
}
editor.commands.clearContent(true);
const promptPreamble = isInEditMode
? getMultifileEditPrompt(codeToEdit)
: undefined;
dispatch(streamResponseThunk({ editorState, modifiers, promptPreamble }));
// Increment localstorage counter for popup
const currentCount = getLocalStorage("mainTextEntryCounter");
if (currentCount) {
setLocalStorage("mainTextEntryCounter", currentCount + 1);
if (currentCount === 300) {
dispatch(
setDialogMessage(
<div className="p-4 text-center">
👋 Thanks for using Continue. We are always trying to improve
and love hearing from users. If you're interested in speaking,
enter your name and email. We won't use this information for
anything other than reaching out.
<br />
<br />
<form
onSubmit={(e: any) => {
e.preventDefault();
posthog?.capture("user_interest_form", {
name: e.target.elements[0].value,
email: e.target.elements[1].value,
});
dispatch(
setDialogMessage(
<div className="p-4 text-center">
Thanks! We'll be in touch soon.
</div>,
),
);
}}
style={{
display: "flex",
flexDirection: "column",
gap: "10px",
}}
>
<input
style={{ padding: "10px", borderRadius: "5px" }}
type="text"
name="name"
placeholder="Name"
required
/>
<input
style={{ padding: "10px", borderRadius: "5px" }}
type="email"
name="email"
placeholder="Email"
required
/>
<button
style={{
padding: "10px",
borderRadius: "5px",
cursor: "pointer",
}}
type="submit"
>
Submit
</button>
</form>
</div>,
),
);
dispatch(setDialogMessage(<FeedbackDialog />));
dispatch(setDialogEntryOn(false));
dispatch(setShowDialog(true));
}
@ -295,25 +274,57 @@ export function Chat() {
setLocalStorage("mainTextEntryCounter", 1);
}
},
[messages, defaultModel, streamResponse],
[
history,
defaultModel,
streamResponse,
isSingleRangeEditOrInsertion,
codeToEdit,
],
);
async function handleSingleRangeEditOrInsertion(editorState: JSONContent) {
const [contextItems, __, userInstructions] = await resolveEditorContent(
editorState,
{
noContext: true,
useCodebase: false,
},
ideMessenger,
[],
dispatch,
);
const prompt = [
...contextItems.map((item) => item.content),
stripImages(userInstructions),
].join("\n\n");
ideMessenger.post("edit/sendPrompt", {
prompt,
range: codeToEdit[0] as RangeInFileWithContents,
});
dispatch(submitEdit(prompt));
}
useWebviewListener(
"newSession",
async () => {
saveSession();
mainTextInputRef.current?.focus?.();
dispatch(exitEditMode());
},
[saveSession],
);
const isLastUserInput = useCallback(
(index: number): boolean => {
return !messages
return !history
.slice(index + 1)
.some((entry) => entry.message.role === "user");
},
[messages],
[history],
);
const showScrollbar = showChatScrollbar || window.innerHeight > 5000;
@ -323,15 +334,15 @@ export function Chat() {
{widget}
<StepsDiv
ref={stepsDivRef}
className={`overflow-y-scroll pt-[8px] ${showScrollbar ? "thin-scrollbar" : "no-scrollbar"} ${messages.length > 0 ? "flex-1" : ""}`}
className={`overflow-y-scroll pt-[8px] ${showScrollbar ? "thin-scrollbar" : "no-scrollbar"} ${history.length > 0 ? "flex-1" : ""}`}
onScroll={handleScroll}
>
{highlights}
{messages.map((item, index: number) => (
{history.map((item, index: number) => (
<div
key={item.message.id}
style={{
minHeight: index === messages.length - 1 ? "50vh" : 0,
minHeight: index === history.length - 1 ? "50vh" : 0,
}}
>
<ErrorBoundary
@ -341,17 +352,16 @@ export function Chat() {
}}
>
{item.message.role === "user" ? (
<ContinueInputBox
onEnter={async (editorState, modifiers) => {
dispatch(
streamResponseThunk({ editorState, modifiers, index }),
);
}}
isLastUserInput={isLastUserInput(index)}
isMainInput={false}
editorState={item.editorState}
contextItems={item.contextItems}
/>
<>
{isInEditMode && index === 0 && <CodeToEditCard />}
<ContinueInputBox
onEnter={sendInput}
isLastUserInput={isLastUserInput(index)}
isMainInput={false}
editorState={item.editorState}
contextItems={item.contextItems}
/>
</>
) : item.message.role === "tool" ? (
<ToolOutput
contextItems={item.contextItems}
@ -401,7 +411,7 @@ export function Chat() {
>
<StepContainer
index={index}
isLast={index === messages.length - 1}
isLast={index === history.length - 1}
item={item}
/>
</TimelineItem>
@ -442,13 +452,18 @@ export function Chat() {
</div>
{toolCallState?.status === "generated" && <ToolCallButtons />}
<ContinueInputBox
isMainInput
isLastUserInput={false}
onEnter={(editorContent, modifiers) => {
sendInput(editorContent, modifiers);
}}
/>
{isInEditMode && history.length === 0 && <CodeToEditCard />}
{isInEditMode && history.length > 0 ? null : (
<ContinueInputBox
isMainInput
isEditMode={isInEditMode}
isLastUserInput={false}
onEnter={sendInput}
/>
)}
<div
style={{
pointerEvents: active ? "none" : "auto",
@ -456,18 +471,24 @@ export function Chat() {
>
<div className="flex flex-row items-center justify-between pb-1 pl-0.5 pr-2">
<div className="xs:inline hidden">
{messages.length === 0 && getLastSessionId() ? (
{history.length === 0 &&
getLastSessionId() &&
!hasPendingApplies ? (
<div className="xs:inline hidden">
<NewSessionButton
onClick={async () => {
loadLastSession().catch((e) =>
console.error(`Failed to load last session: ${e}`),
);
if (isInEditMode) {
dispatch(exitEditMode());
}
}}
className="flex items-center gap-2"
>
<ArrowLeftIcon className="h-3 w-3" />
Last Session
{returnToLastSessionButtonText}
</NewSessionButton>
</div>
) : null}
@ -475,7 +496,20 @@ export function Chat() {
<ConfigErrorIndicator />
</div>
{messages.length === 0 && (
{hasPendingApplies && isSingleRangeEditOrInsertion && (
<AcceptRejectAllButtons
pendingApplyStates={pendingApplyStates}
onAcceptOrReject={() => {
loadLastSession().catch((e) =>
console.error(`Failed to load last session: ${e}`),
);
dispatch(exitEditMode());
}}
/>
)}
{history.length === 0 && (
<>
{onboardingCard.show && (
<div className="mx-2 mt-10">
@ -493,7 +527,7 @@ export function Chat() {
</div>
</div>
<div
className={`${messages.length === 0 ? "h-full" : ""} flex flex-col justify-end`}
className={`${history.length === 0 ? "h-full" : ""} flex flex-col justify-end`}
>
<ChatIndexingPeeks />
</div>

View file

@ -5,13 +5,11 @@ export interface EditModeState {
editStatus: EditStatus;
previousInputs: MessageContent[];
fileAfterEdit?: string;
isInEditMode: boolean;
}
const initialState: EditModeState = {
editStatus: "not-started",
previousInputs: [],
isInEditMode: false,
};
export const editModeStateSlice = createSlice({
@ -19,7 +17,6 @@ export const editModeStateSlice = createSlice({
initialState,
reducers: {
focusEdit: (state) => {
// state.isInEditMode = true;
state.editStatus = "not-started";
state.previousInputs = [];
state.fileAfterEdit = undefined;

View file

@ -17,6 +17,7 @@ import {
CodeToEdit,
ToolCall,
ContextItem,
MessageModes,
} from "core";
import { incrementalParseJson } from "core/util/incrementalParseJson";
import { renderChatMessage } from "core/util/messageContent";
@ -42,6 +43,7 @@ type SessionState = {
curCheckpointIndex: number;
mainEditorContent?: JSONContent;
symbols: FileSymbolMap;
mode: MessageModes;
codeBlockApplyStates: {
states: ApplyState[];
curIndex: number;
@ -49,10 +51,25 @@ type SessionState = {
};
function isCodeToEditEqual(a: CodeToEdit, b: CodeToEdit) {
return a.filepath === b.filepath && a.contents === b.contents;
if (a.filepath !== b.filepath || a.contents !== b.contents) {
return false;
}
if ("range" in a && "range" in b) {
const rangeA = a.range;
const rangeB = b.range;
return (
rangeA.start.line === rangeB.start.line &&
rangeA.end.line === rangeB.end.line
);
}
// If neither has a range, they are considered equal in this context
return !("range" in a) && !("range" in b);
}
function getDefaultMessage(): ChatHistoryItemWithMessageId {
function getBaseHistoryItem(): ChatHistoryItemWithMessageId {
return {
message: {
id: uuidv4(),
@ -60,7 +77,6 @@ function getDefaultMessage(): ChatHistoryItemWithMessageId {
content: "",
},
contextItems: [],
mode: "chat",
isGatheringContext: false,
checkpoint: {},
isBeforeCheckpoint: false,
@ -77,6 +93,7 @@ const initialState: SessionState = {
streamAborter: new AbortController(),
codeToEdit: [],
symbols: {},
mode: "chat",
codeBlockApplyStates: {
states: [],
curIndex: 0,
@ -150,6 +167,7 @@ export const sessionSlice = createSlice({
}>,
) => {
const historyItem = state.history[payload.index];
const lastHistoryItem = state.history[payload.index - 1];
if (!historyItem) {
return;
@ -161,7 +179,7 @@ export const sessionSlice = createSlice({
// Cut off history after the resubmitted message
state.history = state.history
.slice(0, payload.index + 1)
.concat(getDefaultMessage());
.concat(getBaseHistoryItem());
state.isStreaming = true;
},
@ -177,15 +195,21 @@ export const sessionSlice = createSlice({
editorState: JSONContent;
}>,
) => {
const baseHistoryItem = getBaseHistoryItem();
state.history.push({
...getDefaultMessage(),
message: { role: "user", ...getDefaultMessage().message },
...baseHistoryItem,
message: { ...baseHistoryItem.message, id: uuidv4(), role: "user" },
editorState: payload.editorState,
});
state.history.push({
...getDefaultMessage(),
message: { role: "assistant", ...getDefaultMessage().message },
...baseHistoryItem,
message: {
...baseHistoryItem.message,
id: uuidv4(),
role: "assistant",
},
editorState: payload.editorState,
});
@ -203,9 +227,11 @@ export const sessionSlice = createSlice({
}>,
) => {
if (payload.index >= state.history.length) {
const baseHistoryItem = getBaseHistoryItem();
state.history.push({
...getDefaultMessage(),
message: { ...getDefaultMessage().message, ...payload.message },
...baseHistoryItem,
message: { ...baseHistoryItem.message, ...payload.message },
editorState: {
type: "doc",
content: renderChatMessage(payload.message)
@ -270,10 +296,12 @@ export const sessionSlice = createSlice({
action.payload.role === "assistant" &&
action.payload.toolCalls?.length))
) {
const baseHistoryItem = getBaseHistoryItem();
// Create a new message
const historyItem: ChatHistoryItemWithMessageId = {
contextItems: [],
message: { id: uuidv4(), ...action.payload },
...baseHistoryItem,
message: { ...baseHistoryItem.message, ...action.payload },
};
if (action.payload.role === "assistant" && action.payload.toolCalls) {
@ -475,11 +503,28 @@ export const sessionSlice = createSlice({
toolCallState.status = "calling";
},
setMode: (state, action: PayloadAction<MessageModes>) => {
state.mode = action.payload;
},
},
selectors: {
selectIsGatheringContext: (state) => {
const curMessage = state.history.at(-1);
return curMessage?.isGatheringContext || false;
const curHistoryItem = state.history.at(-1);
return curHistoryItem?.isGatheringContext || false;
},
selectIsInEditMode: (state) => {
return state.mode === "edit";
},
selectIsSingleRangeEditOrInsertion: (state) => {
if (state.mode !== "edit") {
return false;
}
const isInsertion = state.codeToEdit.length === 0;
const selectIsSingleRangeEdit =
state.codeToEdit.length === 1 && "range" in state.codeToEdit[0];
return selectIsSingleRangeEdit || isInsertion;
},
},
extraReducers: (builder) => {
@ -547,8 +592,13 @@ export const {
acceptToolCall,
setToolGenerated,
setToolCallOutput,
setMode,
} = sessionSlice.actions;
export const { selectIsGatheringContext } = sessionSlice.selectors;
export const {
selectIsGatheringContext,
selectIsInEditMode,
selectIsSingleRangeEditOrInsertion,
} = sessionSlice.selectors;
export default sessionSlice.reducer;

View file

@ -1,15 +1,11 @@
import { createAsyncThunk } from "@reduxjs/toolkit";
import { selectCurrentToolCall } from "../selectors/selectCurrentToolCall";
import {
cancelToolCall,
setCalling,
setToolCallOutput,
} from "../slices/sessionSlice";
import { cancelToolCall } from "../slices/sessionSlice";
import { ThunkApiType } from "../store";
import { streamResponseAfterToolCall } from "./streamResponseAfterToolCall";
export const cancelTool = createAsyncThunk<void, undefined, ThunkApiType>(
"chat/callTool",
"chat/cancelTool",
async (_, { dispatch, extra, getState }) => {
const state = getState();
const toolCallState = selectCurrentToolCall(state);
@ -40,39 +36,3 @@ export const cancelTool = createAsyncThunk<void, undefined, ThunkApiType>(
);
},
);
export const callTool = createAsyncThunk<void, undefined, ThunkApiType>(
"chat/callTool",
async (_, { dispatch, extra, getState }) => {
const state = getState();
const toolCallState = selectCurrentToolCall(state);
console.log("calling tool", toolCallState.toolCall);
if (!toolCallState) {
return;
}
if (toolCallState.status !== "generated") {
return;
}
dispatch(setCalling());
const result = await extra.ideMessenger.request("tools/call", {
toolCall: toolCallState.toolCall,
});
if (result.status === "success") {
const contextItems = result.content.contextItems;
dispatch(setToolCallOutput(contextItems));
// Send to the LLM to continue the conversation
dispatch(
streamResponseAfterToolCall({
toolCallId: toolCallState.toolCall.id,
toolOutput: contextItems,
}),
);
}
},
);

View file

@ -0,0 +1,31 @@
import { createAsyncThunk } from "@reduxjs/toolkit";
import {
clearCodeToEdit,
selectIsInEditMode,
selectIsSingleRangeEditOrInsertion,
setMode,
} from "../slices/sessionSlice";
import { ThunkApiType } from "../store";
import { setEditDone } from "../slices/editModeState";
export const exitEditMode = createAsyncThunk<void, undefined, ThunkApiType>(
"edit/complete",
async (_, { dispatch, extra, getState }) => {
const state = getState();
const isInEditMode = selectIsInEditMode(state);
const isSingleRangeEditOrInsertion =
selectIsSingleRangeEditOrInsertion(state);
if (!isInEditMode) {
return;
}
dispatch(setMode("chat"));
dispatch(clearCodeToEdit());
dispatch(setEditDone());
extra.ideMessenger.post("edit/exit", {
shouldFocusEditor: isSingleRangeEditOrInsertion,
});
},
);

View file

@ -0,0 +1,8 @@
export { exitEditMode } from "./exitEditMode";
export { gatherContext } from "./gatherContext";
export { handleErrors } from "./handleErrors";
export { resetStateForNewMessage } from "./resetStateForNewMessage";
export { streamNormalInput } from "./streamNormalInput";
export { streamResponseThunk } from "./streamResponse";
export { streamResponseAfterToolCall } from "./streamResponseAfterToolCall";
export { streamSlashCommand } from "./streamSlashCommand";

View file

@ -1,5 +1,4 @@
import { JSONContent } from "@tiptap/react";
import { IndexingProgressUpdate } from "core";
import { OnboardingStatus } from "../components/OnboardingCard";
type LocalStorageTypes = {
@ -12,7 +11,6 @@ type LocalStorageTypes = {
lastSessionId: string | undefined;
[key: `inputHistory_${string}`]: JSONContent[];
extensionVersion: string;
indexingState: IndexingProgressUpdate;
showTutorialCard: boolean;
shownProfilesIntroduction: boolean;
disableIndexing: boolean;