Elffuss BraidHub

kikocis/continue public

Merge branch 'main' into pe/search-and-replace-experiment
Changeset7ffc422e1ed7d65381d19243048dfd793f3a7fd4498908de3b325dc886176508
AuthorPatrick Erichsen <patrick.a.erichsen@gmail.com> · 2025-06-26 17:52 -07:00
CommitterPatrick Erichsen <patrick.a.erichsen@gmail.com> · 2025-06-26 17:52 -07:00
Parents21cf25b4ed37, 6ae8fdd230bd

Browse the files at this changeset

71 files changed

added .continue/rules/new-protocol-message.md +35 −0
@@ -0,0 +1,35 @@
1+---
2+name: New protocol message
3+description: Create a new protocol message from core/gui/ide to core/gui/ide
4+---
5+
6+Create a new protocol message by taking the following steps:
7+
8+## 1. Define the message type
9+
10+Add your new message type definition to the appropriate file in the `protocol/` directory with correct TypeScript typing.
11+
12+## 2. Check for duplicates
13+
14+Verify that no existing message type already provides the same functionality.
15+
16+## 3. Add to passThrough (if webview ↔ core)
17+
18+If your message is between webview and core, add it to `core/protocol/passThrough.ts`.
19+
20+## 4. Add to IntelliJ constants (if webview ↔ core)
21+
22+If your message is between webview and core, add it to `extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt`.
23+
24+## 5. Implement the message handler
25+
26+Implement the message in the appropriate location:
27+
28+- **Messages to core**: `core/core.ts`
29+- **Messages to GUI**: `useWebviewListener` hook
30+- **Messages to VS Code IDE**: `VsCodeMessenger.ts`
31+- **Messages to JetBrains IDE**: `IdeProtocolClient.kt`
32+
33+## 6. Test the implementation
34+
35+Verify that your message works correctly in both VS Code and JetBrains IDEs if applicable.
added .continue/rules/overeager.md +5 −0
@@ -0,0 +1,5 @@
1+---
2+name: Don't be overeager
3+---
4+
5+Avoid over-eagerly adding new features. You should solve the problem at hand and then can propose further work.
modified .github/workflows/main.yaml +8 −0
@@ -104,6 +104,14 @@
104104 path: gui/node_modules
105105 key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }}
106106
107+ - name: Build packages (Windows)
108+ run: ./scripts/build-packages.ps1
109+ if: matrix.os == 'windows-latest'
110+
111+ - name: Build packages (Unix)
112+ run: ./scripts/build-packages.sh
113+ if: matrix.os != 'windows-latest'
114+
107115 - name: Install extension Dependencies
108116 run: |
109117 cd extensions/vscode
modified .github/workflows/preview.yaml +8 −0
@@ -99,6 +99,14 @@
9999 path: gui/node_modules
100100 key: ${{ runner.os }}-node-${{ hashFiles('gui/package-lock.json') }}
101101
102+ - name: Build packages (Windows)
103+ run: ./scripts/build-packages.ps1
104+ if: matrix.os == 'windows-latest'
105+
106+ - name: Build packages (Unix)
107+ run: ./scripts/build-packages.sh
108+ if: matrix.os != 'windows-latest'
109+
102110 - name: Install extension Dependencies
103111 run: |
104112 cd extensions/vscode
modified .github/workflows/release-config-yaml.yml +7 −35
@@ -9,38 +9,10 @@
99
1010 jobs:
1111 release:
12- name: Release
13- runs-on: ubuntu-latest
14- steps:
15- - name: Checkout
16- uses: actions/checkout@v4
17- with:
18- fetch-depth: 0
19-
20- - name: Use Node.js from .nvmrc
21- uses: actions/setup-node@v4
22- with:
23- node-version-file: ".nvmrc"
24-
25- - name: Install dependencies
26- run: |
27- cd packages/config-yaml
28- npm ci
29-
30- - name: Build
31- run: |
32- cd packages/config-yaml
33- npm run build
34-
35- - name: Run tests
36- run: |
37- cd packages/config-yaml
38- npm test
39-
40- - name: Release
41- env:
42- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
44- run: |
45- cd packages/config-yaml
46- npx semantic-release
12+ uses: ./.github/workflows/reusable-release.yml
13+ with:
14+ package-name: "config-yaml"
15+ package-path: "packages/config-yaml"
16+ secrets:
17+ SEMANTIC_RELEASE_GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }}
18+ SEMANTIC_RELEASE_NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }}
added .github/workflows/release-fetch.yml +18 −0
@@ -0,0 +1,18 @@
1+name: Release @continuedev/fetch
2+
3+on:
4+ push:
5+ branches:
6+ - main
7+ paths:
8+ - "packages/fetch/**"
9+
10+jobs:
11+ release:
12+ uses: ./.github/workflows/reusable-release.yml
13+ with:
14+ package-name: "fetch"
15+ package-path: "packages/fetch"
16+ secrets:
17+ SEMANTIC_RELEASE_GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }}
18+ SEMANTIC_RELEASE_NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }}
added .github/workflows/release-llm-info.yml +18 −0
@@ -0,0 +1,18 @@
1+name: Release @continuedev/llm-info
2+
3+on:
4+ push:
5+ branches:
6+ - main
7+ paths:
8+ - "packages/llm-info/**"
9+
10+jobs:
11+ release:
12+ uses: ./.github/workflows/reusable-release.yml
13+ with:
14+ package-name: "llm-info"
15+ package-path: "packages/llm-info"
16+ secrets:
17+ SEMANTIC_RELEASE_GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }}
18+ SEMANTIC_RELEASE_NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }}
added .github/workflows/release-openai-adapters.yml +18 −0
@@ -0,0 +1,18 @@
1+name: Release @continuedev/openai-adapters
2+
3+on:
4+ push:
5+ branches:
6+ - main
7+ paths:
8+ - "packages/openai-adapters/**"
9+
10+jobs:
11+ release:
12+ uses: ./.github/workflows/reusable-release.yml
13+ with:
14+ package-name: "openai-adapters"
15+ package-path: "packages/openai-adapters"
16+ secrets:
17+ SEMANTIC_RELEASE_GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }}
18+ SEMANTIC_RELEASE_NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }}
added .github/workflows/reusable-release.yml +55 −0
@@ -0,0 +1,55 @@
1+name: Reusable Release Workflow
2+
3+on:
4+ workflow_call:
5+ inputs:
6+ package-name:
7+ required: true
8+ type: string
9+ package-path:
10+ required: true
11+ type: string
12+ secrets:
13+ SEMANTIC_RELEASE_GITHUB_TOKEN:
14+ required: true
15+ SEMANTIC_RELEASE_NPM_TOKEN:
16+ required: true
17+
18+permissions:
19+ contents: write
20+ issues: write
21+ pull-requests: write
22+
23+jobs:
24+ release:
25+ name: Release ${{ inputs.package-name }}
26+ runs-on: ubuntu-latest
27+ defaults:
28+ run:
29+ working-directory: ${{ inputs.package-path }}
30+ steps:
31+ - name: Checkout
32+ uses: actions/checkout@v4
33+ with:
34+ fetch-depth: 0
35+
36+ - name: Use Node.js from .nvmrc
37+ uses: actions/setup-node@v4
38+ with:
39+ node-version-file: ".nvmrc"
40+
41+ - name: Install dependencies
42+ run: npm ci
43+
44+ - name: Build
45+ run: npm run build
46+
47+ - name: Run tests
48+ run: npm test
49+
50+ - name: Release
51+ env:
52+ GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }}
53+ NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }}
54+ NODE_AUTH_TOKEN: ${{ secrets.SEMANTIC_RELEASE_NPM_TOKEN }}
55+ run: npx semantic-release
No newline at the end of the file
modified binary/package-lock.json +2 −4
@@ -53,9 +53,9 @@
5353 "@aws-sdk/credential-providers": "^3.778.0",
5454 "@continuedev/config-types": "^1.0.13",
5555 "@continuedev/config-yaml": "file:../packages/config-yaml",
56- "@continuedev/fetch": "^1.0.13",
56+ "@continuedev/fetch": "^1.0.14",
5757 "@continuedev/llm-info": "^1.0.8",
58- "@continuedev/openai-adapters": "^1.0.32",
58+ "@continuedev/openai-adapters": "file:../packages/openai-adapters",
5959 "@modelcontextprotocol/sdk": "^1.12.0",
6060 "@mozilla/readability": "^0.5.0",
6161 "@octokit/rest": "^20.1.1",
@@ -106,7 +106,6 @@
106106 "sqlite3": "^5.1.7",
107107 "system-ca": "^1.0.3",
108108 "tar": "^7.4.3",
109- "tree-sitter-structured-text": "^0.0.1",
110109 "tree-sitter-wasms": "^0.1.11",
111110 "uuid": "^9.0.1",
112111 "vectordb": "^0.4.20",
@@ -145,7 +144,6 @@
145144 "myers-diff": "^2.1.0",
146145 "onnxruntime-common": "1.14.0",
147146 "onnxruntime-web": "1.14.0",
148- "tree-sitter-cli": "^0.22.5",
149147 "ts-jest": "^29.1.1",
150148 "typescript": "^5.6.3",
151149 "vitest": "^3.1.4"
modified core/config/yaml/loadYaml.ts +2 −2
@@ -39,7 +39,7 @@
3939 import { modifyAnyConfigWithSharedConfig } from "../sharedConfig";
4040
4141 import { getControlPlaneEnvSync } from "../../control-plane/env";
42-import { baseToolDefinitions } from "../../tools";
42+import { getToolsForIde } from "../../tools";
4343 import { getCleanUriPath } from "../../util/uri";
4444 import { getAllDotContinueDefinitionFiles } from "../loadLocalAssistants";
4545 import { LocalPlatformClient } from "./LocalPlatformClient";
@@ -187,7 +187,7 @@
187187
188188 const continueConfig: ContinueConfig = {
189189 slashCommands: [],
190- tools: [...baseToolDefinitions],
190+ tools: await getToolsForIde(ide),
191191 mcpServerStatuses: [],
192192 contextProviders: [],
193193 modelsByRole: {
modified core/index.d.ts +2 −0
@@ -731,6 +731,8 @@
731731
732732 isTelemetryEnabled(): Promise<boolean>;
733733
734+ isWorkspaceRemote(): Promise<boolean>;
735+
734736 getUniqueId(): Promise<string>;
735737
736738 getTerminalContents(): Promise<string>;
modified core/indexing/CodebaseIndexer.test.ts +1 −9
@@ -124,14 +124,6 @@
124124 return updates;
125125 }
126126
127- async function refreshIndexFiles(files: string[]) {
128- const updates = [];
129- for await (const update of codebaseIndexer.refreshFiles(files)) {
130- updates.push(update);
131- }
132- return updates;
133- }
134-
135127 async function getAllIndexedFiles() {
136128 const files = await testIndex.getIndexedFilesForTags(
137129 await testIde.getTags(testIndex.artifactId),
@@ -197,7 +189,7 @@
197189 test("should successfuly re-index specific files", async () => {
198190 // Could add more specific tests for this but uses similar logic
199191 const before = await getAllIndexedFiles();
200- await refreshIndexFiles(before);
192+ await codebaseIndexer.refreshCodebaseIndexFiles(before);
201193
202194 const after = await getAllIndexedFiles();
203195 expect(after.length).toBe(before.length);
modified core/indexing/CodebaseIndexer.ts +5 −9
@@ -43,7 +43,7 @@
4343 * - To limit memory usage for indexes that perform computations locally, e.g. FTS
4444 * - To make as few requests as possible to the embeddings providers
4545 */
46- filesPerBatch = 500;
46+ filesPerBatch = 200;
4747 private indexingCancellationController: AbortController | undefined;
4848 private codebaseIndexingState: IndexingProgressUpdate;
4949 private readonly pauseToken: PauseToken;
@@ -75,16 +75,10 @@
7575 this.pauseToken = new PauseToken(initialPaused);
7676 }
7777
78- /**
79- * Set the paused state of the indexer
80- */
8178 set paused(value: boolean) {
8279 this.pauseToken.paused = value;
8380 }
8481
85- /**
86- * Get the current paused state of the indexer
87- */
8882 get paused(): boolean {
8983 return this.pauseToken.paused;
9084 }
@@ -235,7 +229,9 @@
235229 }
236230 }
237231
238- async *refreshFiles(files: string[]): AsyncGenerator<IndexingProgressUpdate> {
232+ private async *refreshFiles(
233+ files: string[],
234+ ): AsyncGenerator<IndexingProgressUpdate> {
239235 let progress = 0;
240236 if (files.length === 0) {
241237 yield {
@@ -525,7 +521,7 @@
525521 repoName,
526522 )) {
527523 yield {
528- progress: progress,
524+ progress,
529525 desc,
530526 status: "indexing",
531527 };
modified core/llm/llms/Bedrock.ts +1 −1
@@ -546,7 +546,7 @@
546546 }
547547
548548 // EMBED //
549- async embed(chunks: string[]): Promise<number[][]> {
549+ async _embed(chunks: string[]): Promise<number[][]> {
550550 const credentials = await this._getCredentials();
551551 const client = new BedrockRuntimeClient({
552552 region: this.region,
modified core/llm/llms/HuggingFaceTEI.ts +1 −10
@@ -25,16 +25,7 @@
2525 });
2626 }
2727
28- async embed(chunks: string[]) {
29- const batchedChunks = this.getBatchedChunks(chunks);
30-
31- const results = await Promise.all(
32- batchedChunks.map((batch) => this.doEmbedRequest(batch)),
33- );
34- return results.flat();
35- }
36-
37- async doEmbedRequest(batch: string[]): Promise<number[][]> {
28+ async _embed(batch: string[]): Promise<number[][]> {
3829 const headers: Record<string, string> = {
3930 "Content-Type": "application/json",
4031 };
modified core/llm/llms/SageMaker.ts +1 −1
@@ -141,7 +141,7 @@
141141 }
142142 }
143143
144- async embed(chunks: string[]) {
144+ async _embed(chunks: string[]) {
145145 const credentials = await this._getCredentials();
146146 const client = new SageMakerRuntimeClient({
147147 region: this.region,
modified core/package-lock.json +0 −0

Not shown: the file is larger than the hub shows, or this page holds as much as it shows. View the file.

modified core/protocol/ide.ts +1 −0
@@ -60,6 +60,7 @@
6060 ];
6161 getAvailableThreads: [undefined, Thread[]];
6262 isTelemetryEnabled: [undefined, boolean];
63+ isWorkspaceRemote: [undefined, boolean];
6364 getUniqueId: [undefined, string];
6465 getTags: [string, IndexTag[]];
6566 readSecrets: [{ keys: string[] }, Record<string, string>];
modified core/protocol/messenger/messageIde.ts +4 −0
@@ -106,6 +106,10 @@
106106 return this.request("isTelemetryEnabled", undefined);
107107 }
108108
109+ isWorkspaceRemote(): Promise<boolean> {
110+ return this.request("isWorkspaceRemote", undefined);
111+ }
112+
109113 getUniqueId(): Promise<string> {
110114 return this.request("getUniqueId", undefined);
111115 }
added core/rules.md +10 −0
@@ -0,0 +1,10 @@
1+# `core` rules
2+
3+Whenever a new protocol message is added to the `protocol/` directory, check the following:
4+
5+- It's type is defined correctly
6+- If it is a message from webview to core or vice versa:
7+ - It has been added to `core/protocol/passThrough.ts`
8+ - It has been added to `extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/constants/MessageTypes.kt`
9+- It is implemented in either `core/core.ts` (for messages to the core), in a `useWebviewListener` (for messages to the gui), or in `VsCodeMessenger.ts` for VS Code or `IdeProtocolClient.kt` for JetBriains (for messages to the IDE).
10+- It does not duplicate functionality from another message type that already exists.
modified core/tools/index.ts +9 −2
@@ -1,4 +1,4 @@
1-import { ConfigDependentToolParams, Tool } from "..";
1+import { ConfigDependentToolParams, IDE, Tool } from "..";
22 import { createNewFileTool } from "./definitions/createNewFile";
33 import { createRuleBlock } from "./definitions/createRuleBlock";
44 import { editFileTool } from "./definitions/editFile";
@@ -16,11 +16,13 @@
1616 import { viewRepoMapTool } from "./definitions/viewRepoMap";
1717 import { viewSubdirectoryTool } from "./definitions/viewSubdirectory";
1818
19+// missing support for remote os calls: https://github.com/microsoft/vscode/issues/252269
20+export const localOnlyToolDefinitions = [grepSearchTool];
21+
1922 export const baseToolDefinitions = [
2023 readFileTool,
2124 createNewFileTool,
2225 runTerminalCommandTool,
23- grepSearchTool,
2426 globSearchTool,
2527 searchWebTool,
2628 viewDiffTool,
@@ -38,3 +40,8 @@
3840 ? [searchAndReplaceInFileTool, viewRepoMapTool, viewSubdirectoryTool]
3941 : [editFileTool]),
4042 ];
43+
44+export const getToolsForIde = async (ide: IDE) =>
45+ (await ide.isWorkspaceRemote())
46+ ? baseToolDefinitions
47+ : [...baseToolDefinitions, ...localOnlyToolDefinitions];
modified core/util/filesystem.ts +4 −0
@@ -48,6 +48,10 @@
4848 return;
4949 }
5050
51+ isWorkspaceRemote(): Promise<boolean> {
52+ return Promise.resolve(false);
53+ }
54+
5155 async getIdeSettings(): Promise<IdeSettings> {
5256 return {
5357 remoteConfigServerUrl: undefined,
modified docs/docs/customize/deep-dives/prompts.md +33 −72
@@ -5,93 +5,54 @@
55 Prompts are reusable instructions that can be referenced at any time during chat. They are especially useful as context for repetitive and/or complex tasks.
66
77 :::info
8-Visit the Hub to [explore prompts](https://hub.continue.dev/explore/prompts) or [create your own](https://hub.continue.dev/new?type=block&blockType=prompts)
8+Prompts were previously defined in a `.prompt` file format, but for consistency we now recommend using the same Markdown format as [rules](./rules.mdx) and adding `alwaysApply: false` to the frontmatter so that they are manually triggered.
99 :::
1010
11-## Examples
12-
13-Below are some examples to get you started.
14-
15-### Security review
16-
17-```text title="Security best practices review"
18-@open - Review these files for the following security best practices:
19-- Does the architecture follow security-by-design principles?
20-- Are there potential security vulnerabilities in the system design?
21-- Is sensitive data handled appropriately throughout the lifecycle?
22-```
23-
24-### Reference best practice guides
25-
26-```text title="Redux best practices review"
27-@https://redux.js.org/style-guide/
28-@currentFile
11+### Quick Start
2912
30-Review this code for adherence to Redux best practices.
31-```
13+Below is a quick example of setting up a prompt file:
3214
33-### Pull in commonly used files for tasks
15+1. Create a folder called `.continue/rules` at the top level of your workspace
16+2. Add a file called `review-prompt.md` to this folder.
17+3. Write the following contents to `review-prompt.md` and save.
3418
35-```text title="Generate a new TypeORM entity"
36-@src/db/dataSource.ts @src/db/entity/SampleEntity.ts
19+```md title="review-prompt.md"
20+---
21+name: Redux best practices review
22+alwaysApply: false
23+---
3724
38-Use these files to generate a new TypeORM entity based on the following requirements:
25+Review the currently open file for adherence to Redux best practices, as explained in their style guide at https://redux.js.org/style-guide/.
3926 ```
4027
41-## Including Context Providers in your prompts
42-
43-Many [context providers](../context-providers.mdx) can be referenced by typing "@" followed by the name of the context provider. The currently supported list is:
44-
45-- `@terminal` - The contents of the terminal
46-- `@currentFile` - The currently active file
47-- `@open` - All open files
48-- `@os` - Information about the operating system
49-- `@problems` - Problems reported by the language server in the active file
50-- `@repo-map` - A map of files in the repository
51-- `@tree` - A tree view of the repository structure
52-
53-Or you can directly type URLs and file paths:
54-
55-- `@https://github.com/continuedev/continue` - The contents of a URL
56-- `@src/index.ts` - The contents of a file (VS Code only)
28+Now to use this prompt, you can open Chat, type <kbd>/</kbd>, select the prompt, and type out any additional instructions you'd like to add.
5729
58-All references will be attached as context items, rather than injected directly inline.
30+## Further Examples
5931
60-## Local `.prompt` files
32+Below are more examples to get you started. You can also visit the Hub to [explore prompts](https://hub.continue.dev/explore/prompts) or [create your own](https://hub.continue.dev/new?type=block&blockType=prompts).
6133
62-In addition to Prompt blocks on the Hub, you can also define prompts in local `.prompt` files, located in the `.continue/prompts` folder at the top level of your workspace. This is useful for quick iteration on prompts to test them out before pushing up to the Hub.
63-
64-### Quick Start
65-
66-Below is a quick example of setting up a prompt file:
67-
68-1. Create a folder called `.continue/prompts` at the top level of your workspace
69-2. Add a file called `test.prompt` to this folder.
70-3. Write the following contents to `test.prompt` and save.
34+### Security review
7135
72-```.prompt
73-name: Current file prompt
74-description: A test prompt using the current file context provider
36+```md title="security-review.md"
37+---
38+name: Security best practices review
39+alwaysApply: false
7540 ---
76-@currentFile
77-```
78-
79-Now to use this prompt, you can open Chat, type <kbd>/</kbd>, select the prompt, and add type out some additional text such as "Review the code for any issues".
80-
81-### Format
82-
83-The format is inspired by [HumanLoops's .prompt file](https://docs.humanloop.com/docs/prompt-file-format), with additional templating to reference files, URLs, and context providers.
8441
85-:::info
86-The current state of this format is experimental and subject to change
87-:::
42+Review the changes in the current git diff for these security best practices:
8843
89-### Preamble
44+- Does the architecture follow security-by-design principles?
45+- Are there potential security vulnerabilities in the system design?
46+- Is sensitive data handled appropriately throughout the lifecycle?
47+```
9048
91-The "preamble" is everything above the `---` separator, and lets you specify model parameters. It uses YAML syntax and currently supports the following parameters:
49+### Pull in commonly used files for tasks
9250
93-- `name` - The display title
94-- `description` - The description you will see in the dropdown
95-- `version` - Can be either "1" (for legacy prompt files) or "2" (this is the default and does not need to be set)
51+```md title="typeorm-entity-generator.md"
52+---
53+name: Generate a new TypeORM entity
54+alwaysApply: false
55+---
9656
97-If you don't need any of these parameters, you can leave out the preamble and do not need to include the `---` separator.
57+Referencing `src/db/dataSource.ts` and `src/db/entity/SampleEntity.ts`, generate a new TypeORM entity based on the following requirements:
58+```
modified docs/docs/customize/deep-dives/rules.mdx +18 −8
@@ -55,19 +55,26 @@
5555
5656 Rules can also be added to an Assistant on the Continue Hub.
5757
58-Explore available rules [here](https://hub.continue.dev/explore/rules), or [create your own](https://hub.continue.dev/new?type=block&blockType=rules) in the Hub. These blocks are defined using the [`config.yaml` syntax](../../reference.md#rules) and can also be created locally.
58+Explore available rules [here](https://hub.continue.dev), or [create your own](https://hub.continue.dev/new?type=block&blockType=rules) in the Hub.
5959
6060 ### Syntax
6161
62+:::info
63+
64+Rules were originally defined in YAML format (demonstrated below), but we introduced Markdown for easier editing. While both are still supported, we recommend Markdown.
65+
66+:::
67+
6268 Rules blocks can be simple text, written in YAML configuration files, or as Markdown (`.md`) files. They can have the following properties:
6369
6470 - `name` (**required** for YAML): A display name/title for the rule
6571 - `globs` (optional): When files are provided as context that match this glob pattern, the rule will be included. This can be either a single pattern (e.g., `"**/*.{ts,tsx}"`) or an array of patterns (e.g., `["src/**/*.ts", "tests/**/*.ts"]`).
6672 - `regex` (optional): When files are provided as context and their content matches this regex pattern, the rule will be included. This can be either a single pattern (e.g., `"^import .* from '.*';$"`) or an array of patterns (e.g., `["^import .* from '.*';$", "^export .* from '.*';$"]`).
6773 - `description` (optional): A description for the rule. Agents may read this description when `alwaysApply` is false to determine whether the rule should be pulled into context.
68-- `alwaysApply`: true - Always include the rule, regardless of file context
69-- `alwaysApply`: false - Included if globs exist AND match file context, or the agent decides to pull the rule into context based on it's description
70-- `alwaysApply`: undefined - Default behavior: include if no globs exist OR globs exist and match
74+- `alwaysApply`: Determines whether the rule is always included. Behavior is described below:
75+ - `true`: Always included, regardless of file context
76+ - `false`: Included if globs exist AND match file context, or the agent decides to pull the rule into context based on it's description
77+ - `undefined` (default behavior): Included if no globs exist OR globs exist and match
7178
7279 <Tabs groupId="rules-example">
7380 <TabItem value="md" label="Markdown">
@@ -97,10 +104,13 @@
97104
98105 ```yaml title="doc-standards.yaml"
99106 name: Documentation Standards
100- globs: docs/**/*.{md,mdx}
101- alwaysApply: false
107+ version: 1.0.0
108+ schema: v1
109+
102110 rules:
103111 - name: Documentation Standards
112+ globs: docs/**/*.{md,mdx}
113+ alwaysApply: false
104114 rule: >
105115 - Follow Docusaurus documentation standards
106116 - Include YAML frontmatter with title, description, and keywords
@@ -164,7 +174,7 @@
164174
165175 Continue includes a simple default system message for [Chat](../../chat/how-to-use-it.md) and [Agent](../../agent/how-to-use-it.md) requests, to help the model provide reliable codeblock formats in its output.
166176
167-This can be viewed in the rules section of the toolbar (see above), or visit the source code [here](https://github.com/continuedev/continue/blob/main/core/llm/constructMessages.ts#L4)
177+This can be viewed in the rules section of the toolbar (see above), or in the source code [here](https://github.com/continuedev/continue/blob/main/core/llm/constructMessages.ts#L4).
168178
169179 Advanced users can override this system message for a specific model if needed by using `chatOptions.baseSystemMessage`. See the [`config.yaml` reference](../../reference.md#models).
170180
@@ -172,7 +182,7 @@
172182
173183 :::warning
174184
175-`.contninuerules` will be deprecated in a future release. Please use the `.continue/rules` folder instead.
185+`.continuerules` will be deprecated in a future release. Please use the `.continue/rules` folder instead.
176186
177187 :::
178188
modified extensions/intellij/gradle.properties +1 −1
@@ -3,7 +3,7 @@
33 pluginName=continue-intellij-extension
44 pluginRepositoryUrl=https://github.com/continuedev/continue
55 # SemVer format -> https://semver.org
6-pluginVersion=1.0.25
6+pluginVersion=1.0.26
77 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
88 pluginSinceBuild=223
99 # IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
modified extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthService.kt +2 −2
@@ -2,9 +2,9 @@
22
33 import com.github.continuedev.continueintellijextension.services.ContinueExtensionSettings
44 import com.github.continuedev.continueintellijextension.services.ContinuePluginService
5-import com.github.continuedev.continueintellijextension.utils.Desktop
65 import com.google.gson.Gson
76 import com.intellij.credentialStore.Credentials
7+import com.intellij.ide.BrowserUtil
88 import com.intellij.ide.passwordSafe.PasswordSafe
99 import com.intellij.ide.util.PropertiesComponent
1010 import com.intellij.openapi.application.ApplicationManager
@@ -165,7 +165,7 @@
165165
166166 // Still open the URL in the browser (keeping existing behavior)
167167 if (authUrl != null) {
168- Desktop.browse(java.net.URI(authUrl))
168+ BrowserUtil.open(authUrl!!)
169169 }
170170
171171 return authUrl
modified extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt +6 −1
@@ -10,6 +10,7 @@
1010 import com.intellij.codeInsight.daemon.impl.HighlightInfo
1111 import com.intellij.execution.configurations.GeneralCommandLine
1212 import com.intellij.execution.util.ExecUtil
13+import com.intellij.ide.BrowserUtil
1314 import com.intellij.ide.plugins.PluginManager
1415 import com.intellij.ide.plugins.PluginManagerCore
1516 import com.intellij.lang.annotation.HighlightSeverity
@@ -125,6 +126,10 @@
125126 return true
126127 }
127128
129+ override suspend fun isWorkspaceRemote(): Boolean {
130+ return this.getIdeInfo().remoteName != "local"
131+ }
132+
128133 override suspend fun getUniqueId(): String {
129134 return getMachineUniqueID()
130135 }
@@ -211,7 +216,7 @@
211216
212217 override suspend fun openUrl(url: String) {
213218 withContext(Dispatchers.IO) {
214- Desktop.browse(URI(url))
219+ BrowserUtil.browse(url)
215220 }
216221 }
217222
modified extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/types.kt +2 −0
@@ -102,6 +102,8 @@
102102
103103 suspend fun isTelemetryEnabled(): Boolean
104104
105+ suspend fun isWorkspaceRemote(): Boolean
106+
105107 suspend fun getUniqueId(): String
106108
107109 suspend fun getTerminalContents(): String
deleted extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/utils/Desktop.kt +0 −214
@@ -1,214 +0,0 @@
1-/*
2- * Copyright © 2017 jjYBdx4IL (https://github.com/jjYBdx4IL)
3- *
4- * Licensed under the Apache License, Version 2.0 (the "License");
5- * you may not use this file except in compliance with the License.
6- * You may obtain a copy of the License at
7- *
8- * http://www.apache.org/licenses/LICENSE-2.0
9- *
10- * Unless required by applicable law or agreed to in writing, software
11- * distributed under the License is distributed on an "AS IS" BASIS,
12- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13- * See the License for the specific language governing permissions and
14- * limitations under the License.
15- */
16-package com.github.continuedev.continueintellijextension.utils
17-
18-import org.apache.commons.lang3.SystemUtils
19-import org.slf4j.LoggerFactory
20-import java.io.File
21-import java.io.IOException
22-import java.net.URI
23-
24-object Desktop {
25- private val LOG = LoggerFactory.getLogger(Desktop::class.java)
26-
27- fun browse(uri: URI): Boolean {
28- if (browseDESKTOP(uri)) {
29- return true
30- }
31-
32- if (openSystemSpecific(uri.toString())) {
33- return true
34- }
35-
36- LOG.warn("failed to browse {}", uri)
37- return false
38- }
39-
40- fun open(file: File): Boolean {
41- if (openDESKTOP(file)) {
42- return true
43- }
44-
45- if (openSystemSpecific(file.path)) {
46- return true
47- }
48-
49- LOG.warn("failed to open {}", file.absolutePath)
50- return false
51- }
52-
53- fun edit(file: File): Boolean {
54- if (editDESKTOP(file)) {
55- return true
56- }
57-
58- if (openSystemSpecific(file.path)) {
59- return true
60- }
61-
62- LOG.warn("failed to edit {}", file.absolutePath)
63- return false
64- }
65-
66- private fun openSystemSpecific(what: String): Boolean {
67- if (SystemUtils.IS_OS_LINUX) {
68- if (isXDG() && runCommand("xdg-open", "%s", what)) {
69- return true
70- }
71- if (isKDE() && runCommand("kde-open", "%s", what)) {
72- return true
73- }
74- if (isGNOME() && runCommand("gnome-open", "%s", what)) {
75- return true
76- }
77- if (runCommand("kde-open", "%s", what)) {
78- return true
79- }
80- if (runCommand("gnome-open", "%s", what)) {
81- return true
82- }
83- }
84-
85- if (SystemUtils.IS_OS_MAC && runCommand("open", "%s", what)) {
86- return true
87- }
88-
89- if (SystemUtils.IS_OS_WINDOWS && runCommand("explorer", "%s", what)) {
90- return true
91- }
92-
93- return false
94- }
95-
96- private fun browseDESKTOP(uri: URI): Boolean {
97- return try {
98- if (!java.awt.Desktop.isDesktopSupported()) {
99- LOG.debug("Platform is not supported.")
100- return false
101- }
102-
103- if (!java.awt.Desktop.getDesktop().isSupported(java.awt.Desktop.Action.BROWSE)) {
104- LOG.debug("BROWSE is not supported.")
105- return false
106- }
107-
108- LOG.info("Trying to use Desktop.getDesktop().browse() with {}", uri.toString())
109- java.awt.Desktop.getDesktop().browse(uri)
110- true
111- } catch (t: Throwable) {
112- LOG.error("Error using desktop browse.", t)
113- false
114- }
115- }
116-
117- private fun openDESKTOP(file: File): Boolean {
118- return try {
119- if (!java.awt.Desktop.isDesktopSupported()) {
120- LOG.debug("Platform is not supported.")
121- return false
122- }
123-
124- if (!java.awt.Desktop.getDesktop().isSupported(java.awt.Desktop.Action.OPEN)) {
125- LOG.debug("OPEN is not supported.")
126- return false
127- }
128-
129- LOG.info("Trying to use Desktop.getDesktop().open() with {}", file.toString())
130- java.awt.Desktop.getDesktop().open(file)
131- true
132- } catch (t: Throwable) {
133- LOG.error("Error using desktop open.", t)
134- false
135- }
136- }
137-
138- private fun editDESKTOP(file: File): Boolean {
139- return try {
140- if (!java.awt.Desktop.isDesktopSupported()) {
141- LOG.debug("Platform is not supported.")
142- return false
143- }
144-
145- if (!java.awt.Desktop.getDesktop().isSupported(java.awt.Desktop.Action.EDIT)) {
146- LOG.debug("EDIT is not supported.")
147- return false
148- }
149-
150- LOG.info("Trying to use Desktop.getDesktop().edit() with {}", file)
151- java.awt.Desktop.getDesktop().edit(file)
152- true
153- } catch (t: Throwable) {
154- LOG.error("Error using desktop edit.", t)
155- false
156- }
157- }
158-
159- private fun runCommand(command: String, args: String, file: String): Boolean {
160- LOG.info("Trying to exec:\n cmd = {}\n args = {}\n %s = {}", command, args, file)
161-
162- val parts = prepareCommand(command, args, file)
163-
164- return try {
165- val p = Runtime.getRuntime().exec(parts)
166- if (p == null) {
167- false
168- } else {
169- try {
170- val retval = p.exitValue()
171- if (retval == 0) {
172- LOG.error("Process ended immediately.")
173- false
174- } else {
175- LOG.error("Process crashed.")
176- false
177- }
178- } catch (itse: IllegalThreadStateException) {
179- LOG.error("Process is running.")
180- true
181- }
182- }
183- } catch (e: IOException) {
184- LOG.error("Error running command.", e)
185- false
186- }
187- }
188-
189- private fun prepareCommand(command: String, args: String?, file: String): Array<String> {
190- val parts = mutableListOf<String>()
191- parts.add(command)
192-
193- args?.split(" ")?.forEach { s ->
194- parts.add(String.format(s, file).trim())
195- }
196-
197- return parts.toTypedArray()
198- }
199-
200- private fun isXDG(): Boolean {
201- val xdgSessionId = System.getenv("XDG_SESSION_ID")
202- return !xdgSessionId.isNullOrEmpty()
203- }
204-
205- private fun isGNOME(): Boolean {
206- val gdmSession = System.getenv("GDMSESSION")
207- return gdmSession?.lowercase()?.contains("gnome") == true
208- }
209-
210- private fun isKDE(): Boolean {
211- val gdmSession = System.getenv("GDMSESSION")
212- return gdmSession?.lowercase()?.contains("kde") == true
213- }
214-}
No newline at the end of the file
modified extensions/vscode/package-lock.json +0 −0

Not shown: the file is larger than the hub shows, or this page holds as much as it shows. View the file.

modified extensions/vscode/package.json +1 −1
@@ -2,7 +2,7 @@
22 "name": "continue",
33 "icon": "media/icon.png",
44 "author": "Continue Dev, Inc",
5- "version": "1.1.50",
5+ "version": "1.1.52",
66 "repository": {
77 "type": "git",
88 "url": "https://github.com/continuedev/continue"
modified extensions/vscode/src/VsCodeIde.ts +4 −0
@@ -200,6 +200,10 @@
200200 return globalEnabled && continueEnabled;
201201 }
202202
203+ isWorkspaceRemote(): Promise<boolean> {
204+ return Promise.resolve(vscode.env.remoteName !== undefined);
205+ }
206+
203207 getUniqueId(): Promise<string> {
204208 return Promise.resolve(vscode.env.machineId);
205209 }
modified gui/package-lock.json +0 −0

Not shown: the file is larger than the hub shows, or this page holds as much as it shows. View the file.

modified gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/index.tsx +15 −13
@@ -11,8 +11,10 @@
1111 import { useIdeMessengerRequest } from "../../../hooks/useIdeMessengerRequest";
1212 import { useWebviewListener } from "../../../hooks/useWebviewListener";
1313 import { useAppSelector } from "../../../redux/hooks";
14-import { selectCurrentToolCallApplyState } from "../../../redux/selectors/selectCurrentToolCall";
15-import { selectApplyStateByStreamId } from "../../../redux/slices/sessionSlice";
14+import {
15+ selectApplyStateByStreamId,
16+ selectApplyStateByToolCallId,
17+} from "../../../redux/slices/sessionSlice";
1618 import { getFontSize } from "../../../util";
1719 import Spinner from "../../gui/Spinner";
1820 import { isTerminalCodeBlock } from "../utils";
@@ -54,6 +56,7 @@
5456 codeBlockIndex: number; // To track which codeblock we are applying
5557 isLastCodeblock: boolean;
5658 codeBlockStreamId: string;
59+ forceToolCallId?: string; // If this is defined, we will use this streamId instead of the one from the codeBlock
5760 range?: string;
5861 children: any;
5962 expanded?: boolean;
@@ -68,6 +71,7 @@
6871 codeBlockIndex,
6972 isLastCodeblock,
7073 codeBlockStreamId,
74+ forceToolCallId,
7175 range,
7276 children,
7377 expanded,
@@ -99,8 +103,8 @@
99103 const applyState = useAppSelector((state) =>
100104 selectApplyStateByStreamId(state, codeBlockStreamId),
101105 );
102- const currentToolCallApplyState = useAppSelector(
103- selectCurrentToolCallApplyState,
106+ const toolCallApplyState = useAppSelector((state) =>
107+ selectApplyStateByToolCallId(state, forceToolCallId),
104108 );
105109
106110 /**
@@ -147,7 +151,7 @@
147151 setRelativeFilepathUri(resolvedUri);
148152 }
149153 };
150- getRelativeFilepathUri();
154+ void getRelativeFilepathUri();
151155 }, [relativeFilepath, ideMessenger.ide]);
152156
153157 async function getFileUriToApplyTo() {
@@ -173,7 +177,7 @@
173177 async function onClickApply() {
174178 const fileUri = await getFileUriToApplyTo();
175179 if (!fileUri) {
176- ideMessenger.ide.showToast(
180+ void ideMessenger.ide.showToast(
177181 "error",
178182 "Could not resolve filepath to apply changes",
179183 );
@@ -188,7 +192,7 @@
188192 });
189193
190194 setAppliedFileUri(fileUri);
191- refreshFileExists();
195+ void refreshFileExists();
192196 }
193197
194198 function onClickInsertAtCursor() {
@@ -198,7 +202,7 @@
198202 async function handleDiffAction(action: "accept" | "reject") {
199203 const filepath = await getFileUriToApplyTo();
200204 if (!filepath) {
201- ideMessenger.ide.showToast(
205+ void ideMessenger.ide.showToast(
202206 "error",
203207 `Could not resolve filepath to ${action} changes`,
204208 );
@@ -233,10 +237,7 @@
233237 }
234238
235239 const renderActionButtons = () => {
236- const isPendingToolCall =
237- currentToolCallApplyState &&
238- currentToolCallApplyState.streamId === applyState?.streamId &&
239- currentToolCallApplyState.status === "not-started";
240+ const isPendingToolCall = toolCallApplyState?.status === "not-started";
240241
241242 if (isGeneratingCodeBlock || isPendingToolCall) {
242243 const numLines = codeBlockContent.split("\n").length;
@@ -271,7 +272,7 @@
271272 return (
272273 <ApplyActions
273274 disableManualApply={disableManualApply}
274- applyState={applyState}
275+ applyState={toolCallApplyState ?? applyState}
275276 onClickApply={onClickApply}
276277 onClickAccept={() => handleDiffAction("accept")}
277278 onClickReject={() => handleDiffAction("reject")}
@@ -293,6 +294,7 @@
293294 <ToolbarDiv isExpanded={isExpanded} className="find-widget-skip gap-3">
294295 <div className="max-w-[50% flex flex-row items-center">
295296 <ChevronDownIcon
297+ data-testid="toggle-codeblock"
296298 onClick={() => setIsExpanded(!isExpanded)}
297299 className={`text-lightgray h-3.5 w-3.5 flex-shrink-0 cursor-pointer hover:brightness-125 ${
298300 isExpanded ? "rotate-0" : "-rotate-90"
modified gui/src/components/StyledMarkdownPreview/index.tsx +4 −9
@@ -126,7 +126,7 @@
126126 itemIndex?: number;
127127 useParentBackgroundColor?: boolean;
128128 disableManualApply?: boolean;
129- forceStreamId?: string;
129+ toolCallId?: string;
130130 expandCodeblocks?: boolean;
131131 }
132132
@@ -196,11 +196,6 @@
196196 const itemIndexRef = useUpdatingRef(props.itemIndex);
197197
198198 const codeblockStreamIds = useRef<string[]>([]);
199- useEffect(() => {
200- if (props.forceStreamId) {
201- codeblockStreamIds.current = [props.forceStreamId];
202- }
203- }, [props.forceStreamId, codeblockStreamIds]);
204199
205200 const [reactContent, setMarkdownSource] = useRemark({
206201 remarkPlugins: [
@@ -295,8 +290,7 @@
295290 const isLastCodeblock = preChildProps["data-islastcodeblock"];
296291
297292 if (codeblockStreamIds.current[codeBlockIndex] === undefined) {
298- codeblockStreamIds.current[codeBlockIndex] =
299- props.forceStreamId ?? uuidv4();
293+ codeblockStreamIds.current[codeBlockIndex] = uuidv4();
300294 }
301295
302296 return (
@@ -308,7 +302,8 @@
308302 relativeFilepath={relativeFilePath}
309303 isLastCodeblock={isLastCodeblock}
310304 range={range}
311- codeBlockStreamId={codeblockStreamIds.current[codeBlockIndex]}
305+ codeBlockStreamId={codeblockStreamIds.current[codeBlockIndex]} // ignored if toolCallId stream state is found
306+ forceToolCallId={props.toolCallId}
312307 expanded={props.expandCodeblocks}
313308 disableManualApply={props.disableManualApply}
314309 >
modified gui/src/components/mainInput/TipTapEditor/utils/editorConfig.ts +4 −1
@@ -330,7 +330,10 @@
330330 ],
331331 editorProps: {
332332 attributes: {
333- class: "outline-none overflow-hidden",
333+ "data-testid": props.isMainInput
334+ ? "editor-input-main"
335+ : `editor-input-${props.inputId}`,
336+ class: "ProseMirror outline-none overflow-hidden",
334337 style: `font-size: ${getFontSize()}px;`,
335338 },
336339 },
modified gui/src/context/MockIdeMessenger.ts +111 −70
@@ -1,7 +1,6 @@
1-import { IDE, PromptLog } from "core";
1+import { ChatMessage, IDE, PromptLog } from "core";
22 import { AuthType } from "core/control-plane/AuthTypes";
33 import {
4- FromIdeProtocol,
54 FromWebviewProtocol,
65 ToCoreProtocol,
76 ToWebviewProtocol,
@@ -13,73 +12,83 @@
1312 GeneratorYieldType,
1413 WebviewSingleProtocolMessage,
1514 } from "core/protocol/util";
16-import { ChatMessage } from "../redux/store";
1715 import { IIdeMessenger } from "./IdeMessenger";
1816
19-async function defaultMockHandleMessage<T extends keyof FromWebviewProtocol>(
20- messageType: T,
21- data: FromWebviewProtocol[T][0],
22-): Promise<FromWebviewProtocol[T][1]> {
23- function returnFor<K extends keyof FromWebviewProtocol>(
24- _: K,
25- value: FromWebviewProtocol[K][1],
26- ): FromWebviewProtocol[T][1] {
27- return value as unknown as FromWebviewProtocol[T][1];
28- }
17+type MockResponses = Partial<{
18+ [K in keyof FromWebviewProtocol]: FromWebviewProtocol[K][1];
19+}>;
2920
30- switch (messageType) {
31- case "history/list":
32- return returnFor("history/list", [
33- {
34- title: "Session 1",
35- sessionId: "session-1",
36- dateCreated: new Date().toString(),
37- workspaceDirectory: "/tmp",
38- },
39- ]);
40- case "getControlPlaneSessionInfo":
41- return returnFor("getControlPlaneSessionInfo", {
42- AUTH_TYPE: AuthType.WorkOsStaging,
43- accessToken: "",
44- account: {
45- label: "",
46- id: "",
47- },
48- });
49- case "config/getSerializedProfileInfo":
50- return returnFor("config/getSerializedProfileInfo", {
51- organizations: [],
52- profileId: "test-profile",
53- result: {
54- config: undefined,
55- errors: [],
56- configLoadInterrupted: false,
57- },
58- selectedOrgId: "local",
59- });
60- default:
61- throw new Error(`Unknown message type ${messageType}`);
62- }
63-}
21+const DEFAULT_MOCK_CORE_RESPONSES: MockResponses = {
22+ fileExists: true,
23+ getCurrentFile: {
24+ isUntitled: false,
25+ contents: "Current file contents",
26+ path: "file:///Users/user/workspace1/current_file.py",
27+ },
28+ "controlPlane/getFreeTrialStatus": {
29+ autocompleteLimit: 1000,
30+ optedInToFreeTrial: false,
31+ chatLimit: 1000,
32+ autocompleteCount: 0,
33+ chatCount: 0,
34+ },
35+ getWorkspaceDirs: [
36+ "file:///Users/user/workspace1",
37+ "file:///Users/user/workspace2",
38+ ],
39+ "history/list": [
40+ {
41+ title: "Session 1",
42+ sessionId: "session-1",
43+ dateCreated: new Date().toString(),
44+ workspaceDirectory: "/tmp",
45+ },
46+ ],
47+ "history/save": undefined,
48+ getControlPlaneSessionInfo: {
49+ AUTH_TYPE: AuthType.WorkOsStaging,
50+ accessToken: "",
51+ account: {
52+ label: "",
53+ id: "",
54+ },
55+ },
56+ "config/getSerializedProfileInfo": {
57+ organizations: [],
58+ profileId: "test-profile",
59+ result: {
60+ config: undefined,
61+ errors: [],
62+ configLoadInterrupted: false,
63+ },
64+ selectedOrgId: "local",
65+ },
66+ "chatDescriber/describe": "Session summary",
67+ applyToFile: undefined,
68+ acceptDiff: undefined,
69+};
6470
71+const DEFAULT_CHAT_RESPONSE: ChatMessage[] = [
72+ {
73+ role: "assistant",
74+ content: "This is a test",
75+ },
76+];
6577 export class MockIdeMessenger implements IIdeMessenger {
6678 ide: IDE;
67- private messageHandlers: Map<
68- keyof FromIdeProtocol,
69- Array<(data: any) => void>
70- > = new Map();
7179
7280 constructor() {
7381 this.ide = new MessageIde(
74- (messageType, data) => {
75- throw new Error("Not implemented");
82+ async (messageType, data) => {
83+ const response = await this.request.bind(this)(messageType, data);
84+ if (response.status === "error") {
85+ throw new Error(response.error);
86+ } else {
87+ return response.content;
88+ }
7689 },
7790 (messageType, callback) => {
78- // Store the callback in our handlers map
79- if (!this.messageHandlers.has(messageType)) {
80- this.messageHandlers.set(messageType, []);
81- }
82- this.messageHandlers.get(messageType)?.push(callback);
91+ return;
8392 },
8493 );
8594 }
@@ -109,16 +118,38 @@
109118 );
110119 }
111120
112- async *llmStreamChat(
113- msg: ToCoreProtocol["llm/streamChat"][0],
114- cancelToken: AbortSignal,
115- ): AsyncGenerator<ChatMessage[], PromptLog | undefined> {
116- yield [
121+ responses: MockResponses = { ...DEFAULT_MOCK_CORE_RESPONSES };
122+ chatResponse: ChatMessage[] = DEFAULT_CHAT_RESPONSE;
123+ chatStreamDelay: number = 0;
124+ setChatResponseText(text: string): void {
125+ this.chatResponse = [
117126 {
118127 role: "assistant",
119- content: "This is a test",
128+ content: text,
120129 },
121130 ];
131+ }
132+
133+ async *llmStreamChat(
134+ msg: ToCoreProtocol["llm/streamChat"][0],
135+ cancelToken: AbortSignal,
136+ ): AsyncGenerator<ChatMessage[], PromptLog | undefined> {
137+ for (const response of this.chatResponse) {
138+ if (cancelToken.aborted) {
139+ console.log("MockIdeMessenger: Stream aborted");
140+ return undefined;
141+ }
142+ console.log(
143+ "MockIdeMessenger: Yielding chunk",
144+ JSON.stringify(response, null, 2),
145+ );
146+ yield [response];
147+ if (this.chatStreamDelay > 0) {
148+ await new Promise((resolve) =>
149+ setTimeout(resolve, this.chatStreamDelay),
150+ );
151+ }
152+ }
122153 return undefined;
123154 }
124155
@@ -133,12 +164,16 @@
133164 messageType: T,
134165 data: FromWebviewProtocol[T][0],
135166 ): Promise<WebviewSingleProtocolMessage<T>> {
136- const content = await defaultMockHandleMessage(messageType, data);
137- return {
138- status: "success",
139- content,
140- done: true,
141- };
167+ if (messageType in this.responses) {
168+ const content = this.responses[messageType];
169+ return {
170+ status: "success",
171+ content,
172+ done: true,
173+ };
174+ }
175+ console.error(messageType);
176+ throw new Error("MockIdeMessenger: No response defined for " + messageType);
142177 }
143178
144179 respond<T extends keyof ToWebviewProtocol>(
@@ -157,4 +192,10 @@
157192 > {
158193 return undefined;
159194 }
195+
196+ resetMocks(): void {
197+ this.responses = { ...DEFAULT_MOCK_CORE_RESPONSES };
198+ this.chatResponse = DEFAULT_CHAT_RESPONSE;
199+ this.chatStreamDelay = 0;
200+ }
160201 }
modified gui/src/hooks/ParallelListeners.tsx +38 −18
@@ -20,6 +20,7 @@
2020 import {
2121 acceptToolCall,
2222 addContextItemsAtIndex,
23+ selectCurrentToolCall,
2324 setHasReasoningEnabled,
2425 updateApplyState,
2526 } from "../redux/slices/sessionSlice";
@@ -244,6 +245,10 @@
244245 dispatch(updateIndexingStatus(data));
245246 });
246247
248+ const autoAcceptEditToolDiffs = useAppSelector(
249+ (store) => store.config.config.ui?.autoAcceptEditToolDiffs,
250+ );
251+ const currentToolCall = useAppSelector(selectCurrentToolCall);
247252 useWebviewListener(
248253 "updateApplyState",
249254 async (state) => {
@@ -259,30 +264,45 @@
259264
260265 // Handle apply status updates that are associated with current tool call
261266 if (
262- state.status === "closed" &&
263267 currentToolCallApplyState &&
264268 currentToolCallApplyState.streamId === state.streamId
265269 ) {
266- // const output: ContextItem = {
267- // name: "Edit tool output",
268- // content: "Completed edit",
269- // description: "",
270- // };
271- dispatch(
272- acceptToolCall({
273- toolCallId: currentToolCallApplyState.toolCallId!,
274- }),
275- );
276- // dispatch(setToolCallOutput([]));
277- void dispatch(
278- streamResponseAfterToolCall({
279- toolCallId: currentToolCallApplyState.toolCallId!,
280- }),
281- );
270+ if (state.status === "done" && autoAcceptEditToolDiffs) {
271+ console.log("AUTO ACCEPTED");
272+ ideMessenger.post("acceptDiff", {
273+ streamId: state.streamId,
274+ filepath: state.filepath,
275+ });
276+ }
277+ if (state.status === "closed") {
278+ if (currentToolCall?.status !== "canceled") {
279+ dispatch(
280+ acceptToolCall({
281+ toolCallId: currentToolCallApplyState.toolCallId!,
282+ }),
283+ );
284+ }
285+ // const output: ContextItem = {
286+ // name: "Edit tool output",
287+ // content: "Completed edit",
288+ // description: "",
289+ // };
290+ // dispatch(setToolCallOutput([]));
291+ void dispatch(
292+ streamResponseAfterToolCall({
293+ toolCallId: currentToolCallApplyState.toolCallId!,
294+ }),
295+ );
296+ }
282297 }
283298 }
284299 },
285- [currentToolCallApplyState, history],
300+ [
301+ currentToolCall,
302+ currentToolCallApplyState,
303+ autoAcceptEditToolDiffs,
304+ ideMessenger,
305+ ],
286306 );
287307
288308 useEffect(() => {
deleted gui/src/pages/gui/Chat.test.tsx +0 −161
@@ -1,161 +0,0 @@
1-import { screen, waitFor } from "@testing-library/dom";
2-import { act } from "@testing-library/react";
3-import { renderWithProviders } from "../../util/test/render";
4-import { Chat } from "./Chat";
5-
6-describe("Chat page test", () => {
7- it("should render input box", async () => {
8- await renderWithProviders(<Chat />);
9- expect(await screen.findByTestId("continue-input-box")).toBeInTheDocument();
10- });
11-
12- it("should be able to toggle modes", async () => {
13- await renderWithProviders(<Chat />);
14- expect(screen.getByText("Chat")).toBeInTheDocument();
15-
16- // Simulate cmd+. keyboard shortcut to toggle modes
17- act(() => {
18- document.dispatchEvent(
19- new KeyboardEvent("keydown", {
20- key: ".",
21- metaKey: true, // cmd key on Mac
22- }),
23- );
24- });
25-
26- // Check that it switched to Agent mode
27- expect(await screen.findByText("Agent")).toBeInTheDocument();
28-
29- act(() => {
30- document.dispatchEvent(
31- new KeyboardEvent("keydown", {
32- key: ".",
33- metaKey: true, // cmd key on Mac
34- }),
35- );
36- });
37-
38- // Check that it switched back to Chat mode
39- expect(await screen.findByText("Chat")).toBeInTheDocument();
40- });
41-
42- it.skip("should send a message and receive a response", async () => {
43- const { user, container } = await renderWithProviders(<Chat />);
44- const inputBox = await waitFor(() =>
45- container.querySelector(".ProseMirror")!.querySelector("p"),
46- );
47- expect(inputBox).toBeDefined();
48-
49- const sendButton = await screen.findByTestId("submit-input-button");
50-
51- await act(async () => {
52- // Focus input box
53- inputBox!.focus();
54-
55- // Type message
56- await user.type(inputBox!, "Hello, world!");
57-
58- sendButton.click();
59- });
60- expect(await screen.findByText("Hello, world!")).toBeInTheDocument();
61- });
62-
63- it("should handle apply updates and display the accept / reject all buttons", async () => {
64- const { ideMessenger } = await renderWithProviders(<Chat />);
65-
66- // Use queryByText which returns null when element isn't found
67- const acceptAllButton = screen.queryByText("Accept All");
68- const rejectAllButton = screen.queryByText("Reject All");
69-
70- // Assert that the buttons don't exist
71- expect(acceptAllButton).not.toBeInTheDocument();
72- expect(rejectAllButton).not.toBeInTheDocument();
73-
74- for (let i = 0; i < 5; i++) {
75- ideMessenger.mockMessageToWebview("updateApplyState", {
76- status: "streaming",
77- streamId: `12345`,
78- });
79- }
80-
81- ideMessenger.mockMessageToWebview("updateApplyState", {
82- status: "done",
83- streamId: "12345",
84- });
85-
86- // Wait for the buttons to appear
87- await waitFor(() => {
88- expect(
89- screen.getByTestId("accept-reject-all-buttons"),
90- ).toBeInTheDocument();
91- });
92-
93- // IDE sends back message that it is done
94- ideMessenger.mockMessageToWebview("updateApplyState", {
95- status: "closed",
96- streamId: "12345",
97- });
98-
99- // Wait for the buttons to disappear
100- await waitFor(() => {
101- expect(
102- screen.queryByTestId("edit-accept-button"),
103- ).not.toBeInTheDocument();
104- expect(
105- screen.queryByTestId("edit-reject-button"),
106- ).not.toBeInTheDocument();
107- });
108- });
109-
110- it("should show apply cancellation", async () => {
111- const { ideMessenger } = await renderWithProviders(<Chat />);
112-
113- // Spy on the request method of ideMessenger
114- const messengerPostSpy = vi.spyOn(ideMessenger, "post");
115-
116- for (let i = 0; i < 5; i++) {
117- ideMessenger.mockMessageToWebview("updateApplyState", {
118- status: "streaming",
119- streamId: `12345`,
120- });
121- }
122-
123- // Wait for applying toolbar to appear
124- await waitFor(() => {
125- const cancelApplyButton = screen.getByTestId(
126- "notch-applying-cancel-button",
127- );
128- const applyingText = screen.getByTestId("notch-applying-text");
129-
130- expect(cancelApplyButton).toBeInTheDocument();
131- expect(applyingText).toBeInTheDocument();
132- });
133-
134- const cancelApplyButton = screen.getByTestId(
135- "notch-applying-cancel-button",
136- );
137- cancelApplyButton.click();
138-
139- // Verify that rejectDiff message has been posted to ideMessenger
140- expect(messengerPostSpy).toHaveBeenCalledWith("rejectDiff", {});
141-
142- // Now simulate the IDE sending back a message that the apply state is closed
143- ideMessenger.mockMessageToWebview("updateApplyState", {
144- status: "closed",
145- streamId: "12345",
146- });
147-
148- await waitFor(() => {
149- const cancelApplyButton = screen.queryByTestId(
150- "notch-applying-cancel-button",
151- );
152- const applyingText = screen.queryByTestId("notch-applying-text");
153-
154- expect(cancelApplyButton).not.toBeInTheDocument();
155- expect(applyingText).not.toBeInTheDocument();
156- });
157-
158- // Cleanup spy
159- messengerPostSpy.mockRestore();
160- });
161-});
modified gui/src/pages/gui/ToolCallDiv/EditFile.tsx +1 −26
@@ -1,12 +1,5 @@
11 import { getMarkdownLanguageTagForFile } from "core/util";
2-import { useEffect } from "react";
3-import { v4 as uuidv4 } from "uuid";
42 import StyledMarkdownPreview from "../../../components/StyledMarkdownPreview";
5-import { useAppDispatch, useAppSelector } from "../../../redux/hooks";
6-import {
7- selectApplyStateByToolCallId,
8- updateApplyState,
9-} from "../../../redux/slices/sessionSlice";
103
114 type EditToolCallProps = {
125 relativeFilePath: string;
@@ -17,24 +10,6 @@
1710 };
1811
1912 export function EditFile(props: EditToolCallProps) {
20- const dispatch = useAppDispatch();
21-
22- const applyState = useAppSelector((state) =>
23- selectApplyStateByToolCallId(state, props.toolCallId),
24- );
25-
26- useEffect(() => {
27- if (!applyState) {
28- dispatch(
29- updateApplyState({
30- streamId: uuidv4(),
31- toolCallId: props.toolCallId,
32- status: "not-started",
33- }),
34- );
35- }
36- }, [applyState, props.toolCallId]);
37-
3813 if (!props.relativeFilePath || !props.changes) {
3914 return null;
4015 }
@@ -47,7 +22,7 @@
4722 isRenderingInStepContainer
4823 disableManualApply
4924 source={src}
50- forceStreamId={applyState?.streamId}
25+ toolCallId={props.toolCallId}
5126 itemIndex={props.historyIndex}
5227 />
5328 );
added gui/src/pages/gui/chat-tests/ApplyScenarios.test.tsx +80 −0
@@ -0,0 +1,80 @@
1+import { act } from "@testing-library/react";
2+import { renderWithProviders } from "../../../util/test/render";
3+import {
4+ getElementByTestId,
5+ verifyNotPresentByTestId,
6+ verifyNotPresentByText,
7+} from "../../../util/test/utils";
8+import { Chat } from "../Chat";
9+
10+test("Chat apply scenarios: handle apply updates and display the accept / reject all buttons", async () => {
11+ const { ideMessenger } = await renderWithProviders(<Chat />);
12+
13+ // Use queryByText which returns null when element isn't found
14+ await verifyNotPresentByText("Accept All");
15+ await verifyNotPresentByText("Reject All");
16+
17+ for (let i = 0; i < 5; i++) {
18+ ideMessenger.mockMessageToWebview("updateApplyState", {
19+ status: "streaming",
20+ streamId: `12345`,
21+ });
22+ }
23+
24+ ideMessenger.mockMessageToWebview("updateApplyState", {
25+ status: "done",
26+ streamId: "12345",
27+ });
28+
29+ // Wait for the buttons to appear
30+ await getElementByTestId("accept-reject-all-buttons");
31+
32+ // IDE sends back message that it is done
33+ ideMessenger.mockMessageToWebview("updateApplyState", {
34+ status: "closed",
35+ streamId: "12345",
36+ });
37+
38+ // Wait for the buttons to disappear
39+ await verifyNotPresentByTestId("edit-accept-button");
40+ await verifyNotPresentByTestId("edit-reject-button");
41+});
42+
43+test("Chat apply scenarios: show apply cancellation", async () => {
44+ const { ideMessenger } = await renderWithProviders(<Chat />);
45+
46+ // Spy on the request method of ideMessenger
47+ const messengerPostSpy = vi.spyOn(ideMessenger, "post");
48+
49+ for (let i = 0; i < 5; i++) {
50+ ideMessenger.mockMessageToWebview("updateApplyState", {
51+ status: "streaming",
52+ streamId: `12345`,
53+ });
54+ }
55+
56+ // Wait for applying toolbar to appear
57+ await getElementByTestId("notch-applying-text");
58+
59+ await act(async () => {
60+ const cancelApplyButton = await getElementByTestId(
61+ "notch-applying-cancel-button",
62+ );
63+ cancelApplyButton.click();
64+ });
65+
66+ // Verify that rejectDiff message has been posted to ideMessenger
67+ expect(messengerPostSpy).toHaveBeenCalledWith("rejectDiff", {});
68+
69+ // Now simulate the IDE sending back a message that the apply state is closed
70+ ideMessenger.mockMessageToWebview("updateApplyState", {
71+ status: "closed",
72+ streamId: "12345",
73+ });
74+
75+ await verifyNotPresentByTestId("notch-applying-text");
76+ await verifyNotPresentByTestId("notch-applying-cancel-button");
77+
78+ // Cleanup spy
79+ messengerPostSpy.mockRestore();
80+});
added gui/src/pages/gui/chat-tests/Chat.test.tsx +61 −0
@@ -0,0 +1,61 @@
1+import { act } from "@testing-library/react";
2+import { addAndSelectMockLlm } from "../../../util/test/config";
3+import { renderWithProviders } from "../../../util/test/render";
4+import {
5+ getElementByTestId,
6+ getElementByText,
7+ sendInputWithMockedResponse,
8+} from "../../../util/test/utils";
9+import { Chat } from "../Chat";
10+
11+test("should render input box", async () => {
12+ await renderWithProviders(<Chat />);
13+ await getElementByTestId("continue-input-box");
14+});
15+
16+test("should be able to toggle modes", async () => {
17+ await renderWithProviders(<Chat />);
18+ await getElementByText("Chat");
19+
20+ // Simulate cmd+. keyboard shortcut to toggle modes
21+ act(() => {
22+ document.dispatchEvent(
23+ new KeyboardEvent("keydown", {
24+ key: ".",
25+ metaKey: true, // cmd key on Mac
26+ }),
27+ );
28+ });
29+
30+ // Check that it switched to Agent mode
31+ await getElementByText("Agent");
32+
33+ act(() => {
34+ document.dispatchEvent(
35+ new KeyboardEvent("keydown", {
36+ key: ".",
37+ metaKey: true, // cmd key on Mac
38+ }),
39+ );
40+ });
41+
42+ await getElementByText("Chat");
43+});
44+
45+test("should send a message and receive a response", async () => {
46+ const { ideMessenger, store } = await renderWithProviders(<Chat />);
47+
48+ // First add and select the mock LLM
49+ await act(async () => {
50+ addAndSelectMockLlm(store, ideMessenger);
51+ });
52+
53+ const CONTENT = "Expected response";
54+ const INPUT = "User input";
55+
56+ await sendInputWithMockedResponse(ideMessenger, INPUT, [
57+ { role: "assistant", content: CONTENT },
58+ ]);
59+
60+ await getElementByText(CONTENT);
61+});
added gui/src/pages/gui/chat-tests/EditToolScenarios.test.tsx +231 −0
@@ -0,0 +1,231 @@
1+import { BuiltInToolNames } from "core/tools/builtIn";
2+import {
3+ addAndSelectMockLlm,
4+ triggerConfigUpdate,
5+} from "../../../util/test/config";
6+import { renderWithProviders } from "../../../util/test/render";
7+import { Chat } from "../Chat";
8+
9+import { waitFor } from "@testing-library/dom";
10+import { ChatMessage } from "core";
11+import { toggleToolSetting } from "../../../redux/slices/uiSlice";
12+import {
13+ getElementByTestId,
14+ getElementByText,
15+ sendInputWithMockedResponse,
16+ verifyNotPresentByTestId,
17+} from "../../../util/test/utils";
18+
19+const EDIT_WORKSPACE_DIR = "file:///workspace";
20+const EDIT_FILEPATH = "test.txt";
21+const EDIT_FILE_URI = `${EDIT_WORKSPACE_DIR}/${EDIT_FILEPATH}`;
22+const EDIT_CHANGES = "New content";
23+const EDIT_TOOL_CALL_ID = "known-id";
24+const EDIT_MESSAGES: ChatMessage[] = [
25+ {
26+ role: "assistant",
27+ content: "",
28+ toolCalls: [
29+ {
30+ id: EDIT_TOOL_CALL_ID,
31+ function: {
32+ name: BuiltInToolNames.EditExistingFile,
33+ arguments: JSON.stringify({
34+ filepath: EDIT_FILEPATH,
35+ changes: EDIT_CHANGES,
36+ }),
37+ },
38+ },
39+ ],
40+ },
41+];
42+
43+const POST_EDIT_RESPONSE = "Edit applied successfully";
44+beforeEach(() => {
45+ vi.clearAllMocks();
46+});
47+
48+test("Edit run with ask first policy and no auto apply", async () => {
49+ // Setup
50+ const { ideMessenger, store, user } = await renderWithProviders(<Chat />);
51+
52+ ideMessenger.responses["getWorkspaceDirs"] = [EDIT_WORKSPACE_DIR];
53+ const messengerPostSpy = vi.spyOn(ideMessenger, "post");
54+
55+ addAndSelectMockLlm(store, ideMessenger);
56+
57+ // Send the input that will respond with an edit tool call
58+ await sendInputWithMockedResponse(
59+ ideMessenger,
60+ "Edit this file",
61+ EDIT_MESSAGES,
62+ );
63+
64+ // Toggle the codeblock and make sure the changes show
65+ const toggleCodeblockChevron = await getElementByTestId("toggle-codeblock");
66+
67+ await user.click(toggleCodeblockChevron);
68+ await getElementByText(EDIT_CHANGES);
69+
70+ // Pending tool call - find and click the accept button
71+ const acceptToolCallButton = await getElementByTestId(
72+ "accept-tool-call-button",
73+ );
74+ await user.click(acceptToolCallButton);
75+
76+ // Tool call, check that applyToFile was called for edit
77+ await waitFor(() => {
78+ expect(messengerPostSpy).toHaveBeenCalledWith("applyToFile", {
79+ streamId: expect.any(String),
80+ filepath: EDIT_FILE_URI,
81+ text: EDIT_CHANGES,
82+ toolCallId: EDIT_TOOL_CALL_ID,
83+ });
84+ });
85+
86+ // Extract stream ID and initiate mock streaming
87+ const streamId = messengerPostSpy.mock.calls.find(
88+ (call) => call[0] === "applyToFile",
89+ )?.[1]?.streamId;
90+ expect(streamId).toBeDefined();
91+
92+ ideMessenger.mockMessageToWebview("updateApplyState", {
93+ status: "streaming",
94+ streamId,
95+ toolCallId: EDIT_TOOL_CALL_ID,
96+ filepath: EDIT_FILE_URI,
97+ });
98+
99+ // Mid stream, should show applying in notch
100+ await getElementByTestId("notch-applying-text");
101+ await getElementByTestId("notch-applying-cancel-button");
102+
103+ // Close the stream
104+ ideMessenger.mockMessageToWebview("updateApplyState", {
105+ status: "done",
106+ streamId,
107+ toolCallId: EDIT_TOOL_CALL_ID,
108+ filepath: EDIT_FILE_URI,
109+ });
110+
111+ // Verify accept/reject buttons are present
112+ const acceptButton = await getElementByTestId("edit-accept-button");
113+ await getElementByTestId("edit-reject-button");
114+
115+ // Accept the changes, which should trigger a response after the tool call
116+ await user.click(acceptButton);
117+
118+ expect(messengerPostSpy).toHaveBeenCalledWith("acceptDiff", {
119+ streamId,
120+ filepath: EDIT_FILE_URI,
121+ });
122+
123+ ideMessenger.setChatResponseText(POST_EDIT_RESPONSE);
124+ ideMessenger.mockMessageToWebview("updateApplyState", {
125+ status: "closed",
126+ streamId,
127+ toolCallId: EDIT_TOOL_CALL_ID,
128+ filepath: EDIT_FILE_URI,
129+ });
130+
131+ await verifyNotPresentByTestId("edit-accept-button");
132+ await verifyNotPresentByTestId("edit-reject-button");
133+
134+ await getElementByText(POST_EDIT_RESPONSE);
135+});
136+
137+test("Edit run with no policy and yolo mode", async () => {
138+ // Setup
139+ const { ideMessenger, store, user } = await renderWithProviders(<Chat />);
140+
141+ ideMessenger.responses["getWorkspaceDirs"] = [EDIT_WORKSPACE_DIR];
142+ const messengerPostSpy = vi.spyOn(ideMessenger, "post");
143+
144+ addAndSelectMockLlm(store, ideMessenger);
145+
146+ // Enable automatic edit and yolo mode
147+ store.dispatch(toggleToolSetting(BuiltInToolNames.EditExistingFile));
148+ triggerConfigUpdate({
149+ store,
150+ ideMessenger,
151+ editConfig: (current) => {
152+ current.ui = {
153+ ...current.ui,
154+ autoAcceptEditToolDiffs: true, // Enable auto-accept for edit tool diffs
155+ };
156+ return current;
157+ },
158+ });
159+ expect(store.getState().config.config.ui?.autoAcceptEditToolDiffs).toBe(true);
160+
161+ // Send the input that will respond with an edit tool call
162+ await sendInputWithMockedResponse(
163+ ideMessenger,
164+ "Edit this file",
165+ EDIT_MESSAGES,
166+ );
167+
168+ // Toggle the codeblock and make sure the changes show
169+ const toggleCodeblockChevron = await getElementByTestId("toggle-codeblock");
170+
171+ await user.click(toggleCodeblockChevron);
172+ await getElementByText(EDIT_CHANGES);
173+
174+ // Make sure there's no pending tool call
175+ verifyNotPresentByTestId("accept-tool-call-button");
176+ // Tool call, check that applyToFile was called for edit
177+ await waitFor(() => {
178+ expect(messengerPostSpy).toHaveBeenCalledWith("applyToFile", {
179+ streamId: expect.any(String),
180+ filepath: EDIT_FILE_URI,
181+ text: EDIT_CHANGES,
182+ toolCallId: EDIT_TOOL_CALL_ID,
183+ });
184+ });
185+
186+ // Extract stream ID and initiate mock streaming
187+ const streamId = messengerPostSpy.mock.calls.find(
188+ (call) => call[0] === "applyToFile",
189+ )?.[1]?.streamId;
190+ expect(streamId).toBeDefined();
191+
192+ ideMessenger.mockMessageToWebview("updateApplyState", {
193+ status: "streaming",
194+ streamId,
195+ toolCallId: EDIT_TOOL_CALL_ID,
196+ filepath: EDIT_FILE_URI,
197+ });
198+
199+ // Mid stream, should show applying in notch
200+ await getElementByTestId("notch-applying-text");
201+ await getElementByTestId("notch-applying-cancel-button");
202+
203+ // Close the stream
204+ ideMessenger.mockMessageToWebview("updateApplyState", {
205+ status: "done",
206+ streamId,
207+ toolCallId: EDIT_TOOL_CALL_ID,
208+ filepath: EDIT_FILE_URI,
209+ });
210+
211+ await waitFor(() => {
212+ expect(messengerPostSpy).toHaveBeenCalledWith("acceptDiff", {
213+ streamId,
214+ filepath: EDIT_FILE_URI,
215+ });
216+ });
217+
218+ // Close the stream, ensure response is shown and diff buttons are not present
219+ ideMessenger.setChatResponseText(POST_EDIT_RESPONSE);
220+ ideMessenger.mockMessageToWebview("updateApplyState", {
221+ status: "closed",
222+ streamId,
223+ toolCallId: EDIT_TOOL_CALL_ID,
224+ filepath: EDIT_FILE_URI,
225+ });
226+
227+ await verifyNotPresentByTestId("edit-accept-button");
228+ await verifyNotPresentByTestId("edit-reject-button");
229+
230+ await getElementByText(POST_EDIT_RESPONSE);
231+});
modified gui/src/redux/slices/sessionSlice.ts +3 −1
@@ -657,7 +657,9 @@
657657 (state: RootState, toolCallId?: string) => toolCallId,
658658 ],
659659 (states, toolCallId) => {
660- return states.find((state) => state.toolCallId === toolCallId);
660+ if (toolCallId) {
661+ return states.find((state) => state.toolCallId === toolCallId);
662+ }
661663 },
662664 );
663665
modified gui/src/redux/store.ts +0 −5
@@ -23,11 +23,6 @@
2323 import tabsReducer from "./slices/tabsSlice";
2424 import uiReducer from "./slices/uiSlice";
2525
26-export interface ChatMessage {
27- role: "system" | "user" | "assistant";
28- content: string;
29-}
30-
3126 const rootReducer = combineReducers({
3227 session: sessionReducer,
3328 ui: uiReducer,
modified gui/src/redux/thunks/callCurrentTool.ts +2 −7
@@ -19,7 +19,6 @@
1919 async (_, { dispatch, extra, getState }) => {
2020 const state = getState();
2121 const toolCallState = selectCurrentToolCall(state);
22-
2322 if (!toolCallState) {
2423 return;
2524 }
@@ -61,19 +60,15 @@
6160 ) {
6261 // Tool is called on client side
6362 const {
64- output: clientToolOuput,
63+ output: clientToolOutput,
6564 respondImmediately,
6665 errorMessage: clientToolError,
6766 } = await callClientTool(toolCallState, {
6867 dispatch,
6968 ideMessenger: extra.ideMessenger,
70- streamId: state.session.codeBlockApplyStates.states.find(
71- (state) =>
72- state.toolCallId && state.toolCallId === toolCallState.toolCallId,
73- )?.streamId,
7469 getState,
7570 });
76- output = clientToolOuput;
71+ output = clientToolOutput;
7772 errorMessage = clientToolError;
7873 streamResponse = respondImmediately;
7974 } else {
modified gui/src/redux/thunks/edit.ts +3 −0
@@ -17,6 +17,7 @@
1717 import {
1818 newSession,
1919 setActive,
20+ setInactive,
2021 setIsInEdit,
2122 setMainEditorContentTrigger,
2223 setMode,
@@ -61,6 +62,8 @@
6162 range: codeToEdit[0] as RangeInFileWithContents,
6263 });
6364
65+ dispatch(setInactive());
66+
6467 if (response.status === "error") {
6568 throw new Error(response.error);
6669 }
modified gui/src/redux/thunks/streamNormalInput.ts +6 −0
@@ -8,6 +8,8 @@
88 import {
99 abortStream,
1010 addPromptCompletionPair,
11+ setActive,
12+ setInactive,
1113 setToolGenerated,
1214 streamUpdate,
1315 } from "../slices/sessionSlice";
@@ -53,6 +55,8 @@
5355 };
5456 }
5557
58+ dispatch(setActive());
59+
5660 // Send request
5761 const gen = extra.ideMessenger.llmStreamChat(
5862 {
@@ -76,6 +80,8 @@
7680 next = await gen.next();
7781 }
7882
83+ dispatch(setInactive());
84+
7985 // Attach prompt log and end thinking for reasoning models
8086 if (next.done && next.value) {
8187 dispatch(addPromptCompletionPair([next.value]));
modified gui/src/redux/thunks/streamResponseAfterToolCall.ts +1 −7
@@ -4,11 +4,7 @@
44 import { renderContextItems } from "core/util/messageContent";
55 import { getBaseSystemMessage } from "../../util";
66 import { selectSelectedChatModel } from "../slices/configSlice";
7-import {
8- addContextItemsAtIndex,
9- setActive,
10- streamUpdate,
11-} from "../slices/sessionSlice";
7+import { addContextItemsAtIndex, streamUpdate } from "../slices/sessionSlice";
128 import { ThunkApiType } from "../store";
139 import { findToolCall } from "../util";
1410 import { resetStateForNewMessage } from "./resetStateForNewMessage";
@@ -63,8 +59,6 @@
6359 }),
6460 );
6561
66- dispatch(setActive());
67-
6862 const updatedHistory = getState().session.history;
6963 const messageMode = getState().session.mode;
7064
modified gui/src/redux/thunks/streamThunkWrapper.tsx +0 −2
@@ -1,6 +1,5 @@
11 import { createAsyncThunk } from "@reduxjs/toolkit";
22 import StreamErrorDialog from "../../pages/gui/StreamError";
3-import { setInactive } from "../slices/sessionSlice";
43 import { setDialogMessage, setShowDialog } from "../slices/uiSlice";
54 import { ThunkApiType } from "../store";
65 import { cancelStream } from "./cancelStream";
@@ -22,7 +21,6 @@
2221 }),
2322 );
2423 }
25- dispatch(setInactive());
2624 } catch (e) {
2725 dispatch(cancelStream());
2826 dispatch(setDialogMessage(<StreamErrorDialog error={e} />));
modified gui/src/util/clientTools/callClientTool.ts +0 −1
@@ -9,7 +9,6 @@
99 getState: () => RootState;
1010 dispatch: AppThunkDispatch;
1111 ideMessenger: IIdeMessenger;
12- streamId?: string;
1312 }
1413
1514 export interface ClientToolOutput {
modified gui/src/util/clientTools/editImpl.ts +5 −24
@@ -1,14 +1,11 @@
11 import { resolveRelativePathInDir } from "core/util/ideUtils";
2+import { v4 as uuid } from "uuid";
23 import { ClientToolImpl } from "./callClientTool";
3-
44 export const editToolImpl: ClientToolImpl = async (
55 args,
66 toolCallId,
77 extras,
88 ) => {
9- if (!extras.streamId) {
10- throw new Error("Invalid apply state");
11- }
129 const firstUriMatch = await resolveRelativePathInDir(
1310 args.filepath,
1411 extras.ideMessenger.ide,
@@ -16,30 +13,14 @@
1613 if (!firstUriMatch) {
1714 throw new Error(`${args.filepath} does not exist`);
1815 }
19- const apply = await extras.ideMessenger.request("applyToFile", {
20- streamId: extras.streamId,
16+ const streamId = uuid();
17+ extras.ideMessenger.post("applyToFile", {
18+ streamId,
2119 text: args.changes,
2220 toolCallId,
2321 filepath: firstUriMatch,
2422 });
25- if (apply.status === "error") {
26- throw new Error(apply.error);
27- }
28- const state = extras.getState();
29- const autoAccept = !!state.config.config.ui?.autoAcceptEditToolDiffs;
30- if (autoAccept) {
31- const out = await extras.ideMessenger.request("acceptDiff", {
32- streamId: extras.streamId,
33- filepath: firstUriMatch,
34- });
35- if (out.status === "error") {
36- throw new Error(out.error);
37- }
38- return {
39- respondImmediately: true,
40- output: undefined, // TODO - feed edit results back to model (also in parallel listeners)
41- };
42- }
23+
4324 return {
4425 respondImmediately: false,
4526 output: undefined, // No immediate output.
added gui/src/util/test/config.ts +67 −0
@@ -0,0 +1,67 @@
1+import { EnhancedStore } from "@reduxjs/toolkit";
2+import { BrowserSerializedContinueConfig, ModelDescription } from "core";
3+import { SerializedOrgWithProfiles } from "core/config/ProfileLifecycleManager";
4+import { copyOf } from "core/util";
5+import { MockIdeMessenger } from "../../context/MockIdeMessenger";
6+
7+interface TestConfigUpdateParams {
8+ store: EnhancedStore;
9+ ideMessenger: MockIdeMessenger;
10+ newProfileId?: string;
11+ newOrgId?: string;
12+ newOrgs?: SerializedOrgWithProfiles[];
13+ editConfig?: (
14+ current: BrowserSerializedContinueConfig,
15+ ) => BrowserSerializedContinueConfig;
16+}
17+
18+export function triggerConfigUpdate({
19+ store,
20+ ideMessenger,
21+ editConfig,
22+ newOrgs,
23+ newOrgId,
24+ newProfileId,
25+}: TestConfigUpdateParams) {
26+ const state = store.getState();
27+ ideMessenger.mockMessageToWebview("configUpdate", {
28+ organizations: newOrgs ?? state.profiles.organizations,
29+ selectedOrgId: newOrgId ?? state.profiles.selectedOrganizationId,
30+ profileId: newProfileId ?? state.profiles.selectedProfileId,
31+ result: {
32+ config: editConfig
33+ ? editConfig(copyOf(state.config.config))
34+ : state.config.config,
35+ configLoadInterrupted: false,
36+ errors: [],
37+ },
38+ });
39+}
40+
41+export function addAndSelectChatModel(
42+ store: EnhancedStore,
43+ ideMessenger: MockIdeMessenger,
44+ llmDesc: ModelDescription,
45+) {
46+ triggerConfigUpdate({
47+ store,
48+ ideMessenger,
49+ editConfig(current) {
50+ current.modelsByRole.chat.push(llmDesc);
51+ current.selectedModelByRole.chat = llmDesc;
52+ return current;
53+ },
54+ });
55+}
56+
57+export function addAndSelectMockLlm(
58+ store: EnhancedStore,
59+ ideMessenger: MockIdeMessenger,
60+) {
61+ addAndSelectChatModel(store, ideMessenger, {
62+ model: "mock",
63+ provider: "mock",
64+ title: "Mock LLM",
65+ underlyingProviderName: "mock",
66+ });
67+}
added gui/src/util/test/utils.ts +102 −0
@@ -0,0 +1,102 @@
1+import { screen, waitFor } from "@testing-library/dom";
2+import { act } from "@testing-library/react";
3+import { Editor } from "@tiptap/core";
4+import { ChatMessage } from "core";
5+import { MockIdeMessenger } from "../../context/MockIdeMessenger";
6+
7+function logDomText() {
8+ const bodyText = document.body.innerHTML;
9+ const parser = new DOMParser();
10+ const doc = parser.parseFromString(bodyText, "text/html");
11+ let cleaned = doc.body.textContent ?? "";
12+ cleaned = cleaned?.replace(
13+ "No resultsAaModelsRulesDocsPromptsToolsMCPCreate your first assistant",
14+ "",
15+ );
16+ cleaned = cleaned?.replace(
17+ "Alt⏎ Active file⏎ Enter⏎Log in to access a free trial of theModels Add-OnLog in to Continue HubOr, configure your own models",
18+ "",
19+ );
20+ cleaned = cleaned.replaceAll("Select model", "");
21+ cleaned = cleaned.replaceAll("Mock LLM", "");
22+ cleaned = cleaned.replaceAll(/^Chat|Chat$/g, "");
23+ console.log(cleaned || "No body content");
24+}
25+
26+export function logAllTestIds() {
27+ const elements = document.querySelectorAll("*");
28+
29+ const testIds = Array.from(elements)
30+ .map((el) => Array.from(el.attributes))
31+ .flat()
32+ .filter((a) => a.name === "data-testid")
33+ .map((a) => a.value);
34+ console.log("Available test ids", testIds);
35+}
36+export async function getElementByTestId(testId: string): Promise<HTMLElement> {
37+ try {
38+ const testIdElement = await waitFor(() => screen.findByTestId(testId));
39+ expect(testIdElement).toBeInTheDocument();
40+ return testIdElement;
41+ } catch (e) {
42+ logAllTestIds();
43+ throw new Error(`Element with testId "${testId}" not found`);
44+ }
45+}
46+
47+export async function verifyNotPresentByTestId(testId: string): Promise<void> {
48+ const element = await waitFor(() => screen.queryByTestId(testId));
49+ expect(element).not.toBeInTheDocument();
50+}
51+
52+export async function verifyNotPresentByText(text: string): Promise<void> {
53+ const element = screen.queryByText(text);
54+ expect(element).not.toBeInTheDocument();
55+}
56+
57+export async function getElementByText(text: string): Promise<HTMLElement> {
58+ try {
59+ const textElement = await waitFor(() => screen.findByText(text));
60+ expect(textElement).toBeInTheDocument();
61+ return textElement;
62+ } catch (e) {
63+ logDomText();
64+ throw new Error(`Element with text "${text}" not found.`);
65+ }
66+}
67+
68+export async function getMainEditor(): Promise<Editor> {
69+ const editorElement = await getElementByTestId("editor-input-main");
70+ if ("editor" in editorElement) {
71+ return editorElement.editor as Editor;
72+ } else {
73+ throw new Error("Main editor not found within editor container");
74+ }
75+}
76+
77+export async function sendInputWithMockedResponse(
78+ ideMessenger: MockIdeMessenger,
79+ input: string,
80+ response: ChatMessage[],
81+): Promise<void> {
82+ // Setup the mock response before any actions
83+ ideMessenger.chatResponse = response;
84+
85+ // Wait for the editor to be in the document
86+ const editor = await getMainEditor();
87+
88+ // Find the submit button
89+ const sendButton = await getElementByTestId("submit-input-button");
90+
91+ // Insert content into the editor
92+ await act(async () => {
93+ editor.commands.insertContent(input);
94+ });
95+
96+ await getElementByText(input);
97+
98+ // Click the send button
99+ await act(async () => {
100+ sendButton.click();
101+ });
102+}
modified gui/vite.config.ts +13 −0
@@ -32,5 +32,18 @@
3232 globals: true,
3333 environment: "jsdom",
3434 setupFiles: "./src/util/test/setupTests.ts",
35+ onConsoleLog(log, type) {
36+ if (type === "stderr") {
37+ if (
38+ [
39+ "contentEditable",
40+ "An update to Chat inside a test was not wrapped in act",
41+ ].some((text) => log.includes(text))
42+ ) {
43+ return false;
44+ }
45+ }
46+ return true;
47+ },
3548 },
3649 });
added packages/config-yaml/CHANGELOG.md +0 −0

Not shown: the file is larger than the hub shows, or this page holds as much as it shows. View the file.

modified packages/config-yaml/package-lock.json +0 −0

Not shown: the file is larger than the hub shows, or this page holds as much as it shows. View the file.

modified packages/config-yaml/package.json +8 −3
@@ -1,6 +1,6 @@
11 {
22 "name": "@continuedev/config-yaml",
3- "version": "1.0.94",
3+ "version": "1.0.95",
44 "description": "",
55 "main": "dist/index.js",
66 "types": "dist/index.d.ts",
@@ -13,7 +13,7 @@
1313 }
1414 },
1515 "bin": {
16- "@continuedev/config-yaml": "./dist/cli.js"
16+ "config-yaml": "./dist/cli.js"
1717 },
1818 "scripts": {
1919 "test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
@@ -34,6 +34,11 @@
3434 "jest": "^29.7.0",
3535 "ts-jest": "^29.2.3",
3636 "ts-node": "^10.9.2",
37- "zod-to-json-schema": "^3.24.5"
37+ "zod-to-json-schema": "^3.24.5",
38+ "@semantic-release/changelog": "^6.0.3",
39+ "@semantic-release/git": "^10.0.1",
40+ "@semantic-release/github": "^9.2.6",
41+ "@semantic-release/npm": "^10.0.6",
42+ "semantic-release": "^21.1.2"
3843 }
3944 }
modified packages/config-yaml/release.config.js +3 −9
@@ -1,9 +1,3 @@
1-export default {
2- branches: ["main"],
3- plugins: [
4- "@semantic-release/commit-analyzer",
5- "@semantic-release/release-notes-generator",
6- "@semantic-release/npm",
7- "@semantic-release/github",
8- ],
9-};
1+import createReleaseConfig from "../shared-release.config.js";
2+
3+export default createReleaseConfig("config-yaml");
added packages/fetch/release.config.js +3 −0
@@ -0,0 +1,3 @@
1+import createReleaseConfig from "../shared-release.config.js";
2+
3+export default createReleaseConfig("fetch");
added packages/llm-info/release.config.js +3 −0
@@ -0,0 +1,3 @@
1+import createReleaseConfig from "../shared-release.config.js";
2+
3+export default createReleaseConfig("llm-info");
modified packages/openai-adapters/package-lock.json +2 −2
@@ -1,12 +1,12 @@
11 {
22 "name": "@continuedev/openai-adapters",
3- "version": "1.0.40",
3+ "version": "1.0.42",
44 "lockfileVersion": 3,
55 "requires": true,
66 "packages": {
77 "": {
88 "name": "@continuedev/openai-adapters",
9- "version": "1.0.40",
9+ "version": "1.0.42",
1010 "license": "Apache-2.0",
1111 "dependencies": {
1212 "@continuedev/config-types": "^1.0.5",
modified packages/openai-adapters/package.json +1 −1
@@ -1,6 +1,6 @@
11 {
22 "name": "@continuedev/openai-adapters",
3- "version": "1.0.40",
3+ "version": "1.0.42",
44 "description": "",
55 "main": "dist/index.js",
66 "types": "dist/index.d.ts",
added packages/openai-adapters/release.config.js +3 −0
@@ -0,0 +1,3 @@
1+import createReleaseConfig from "../shared-release.config.js";
2+
3+export default createReleaseConfig("openai-adapters");
modified packages/openai-adapters/src/apis/Azure.ts +5 −1
@@ -63,7 +63,11 @@
6363 "`env.apiVersion` is a required configuration property for Azure OpenAI",
6464 );
6565 }
66- url.pathname = `${url.pathname}/openai/deployments/${config.env.deployment}`;
66+
67+ const basePathname = `openai/deployments/${config.env.deployment}`;
68+
69+ url.pathname =
70+ url.pathname === "/" ? basePathname : `${url.pathname}/${basePathname}`;
6771
6872 queryParams["api-version"] = config.env.apiVersion;
6973 }
modified packages/openai-adapters/src/test/main.test.ts +76 −0
@@ -173,4 +173,80 @@
173173 "https://api.example.com",
174174 );
175175 });
176+
177+ it("should configure Azure OpenAI client with root URL and trailing slash", () => {
178+ const azure = constructLlmApi({
179+ provider: "azure",
180+ apiKey: "sk-xxx",
181+ apiBase: "https://test-azure-openai.azure.com/",
182+ env: {
183+ deployment: "gpt-4.1",
184+ apiType: "azure-openai",
185+ apiVersion: "2023-05-15",
186+ },
187+ });
188+
189+ // The Azure client modifies the baseURL to include the deployment
190+ expect((azure as OpenAIApi).openai.baseURL).toBe(
191+ "https://test-azure-openai.azure.com/openai/deployments/gpt-4.1",
192+ );
193+ expect((azure as OpenAIApi).openai.apiKey).toBe("sk-xxx");
194+ });
195+
196+ it("should configure Azure OpenAI client with path and trailing slash", () => {
197+ const azure = constructLlmApi({
198+ provider: "azure",
199+ apiKey: "sk-xxx",
200+ apiBase: "https://test-azure-openai.azure.com/v1/",
201+ env: {
202+ deployment: "gpt-4.1",
203+ apiType: "azure-openai",
204+ apiVersion: "2023-05-15",
205+ },
206+ });
207+
208+ // The Azure client modifies the baseURL to include the deployment
209+ expect((azure as OpenAIApi).openai.baseURL).toBe(
210+ "https://test-azure-openai.azure.com/v1/openai/deployments/gpt-4.1",
211+ );
212+ expect((azure as OpenAIApi).openai.apiKey).toBe("sk-xxx");
213+ });
214+
215+ it("should configure Azure OpenAI client with root URL and no trailing slash", () => {
216+ const azure = constructLlmApi({
217+ provider: "azure",
218+ apiKey: "sk-xxx",
219+ apiBase: "https://test-azure-openai.azure.com",
220+ env: {
221+ deployment: "gpt-4.1",
222+ apiType: "azure-openai",
223+ apiVersion: "2023-05-15",
224+ },
225+ });
226+
227+ // The Azure client modifies the baseURL to include the deployment
228+ expect((azure as OpenAIApi).openai.baseURL).toBe(
229+ "https://test-azure-openai.azure.com/openai/deployments/gpt-4.1",
230+ );
231+ expect((azure as OpenAIApi).openai.apiKey).toBe("sk-xxx");
232+ });
233+
234+ it("should configure Azure OpenAI client with path and no trailing slash", () => {
235+ const azure = constructLlmApi({
236+ provider: "azure",
237+ apiKey: "sk-xxx",
238+ apiBase: "https://test-azure-openai.azure.com/v1",
239+ env: {
240+ deployment: "gpt-4.1",
241+ apiType: "azure-openai",
242+ apiVersion: "2023-05-15",
243+ },
244+ });
245+
246+ // The Azure client modifies the baseURL to include the deployment
247+ expect((azure as OpenAIApi).openai.baseURL).toBe(
248+ "https://test-azure-openai.azure.com/v1/openai/deployments/gpt-4.1",
249+ );
250+ expect((azure as OpenAIApi).openai.apiKey).toBe("sk-xxx");
251+ });
176252 });
added packages/shared-release.config.js +34 −0
@@ -0,0 +1,34 @@
1+export default function createReleaseConfig(packageName) {
2+ return {
3+ branches: ["main"],
4+ tagFormat: `@continuedev/${packageName}@\${version}`,
5+ plugins: [
6+ [
7+ "@semantic-release/commit-analyzer",
8+ {
9+ releaseRules: [
10+ { scope: `packages/${packageName}`, release: "patch" },
11+ { scope: `packages/${packageName}`, type: "fix", release: "patch" },
12+ { scope: "packages/config-yaml", type: "feat", release: "minor" },
13+ {
14+ scope: `packages/${packageName}`,
15+ breaking: true,
16+ release: "major",
17+ },
18+ ],
19+ },
20+ ],
21+ "@semantic-release/release-notes-generator",
22+ "@semantic-release/changelog",
23+ "@semantic-release/npm",
24+ [
25+ "@semantic-release/git",
26+ {
27+ assets: ["CHANGELOG.md", "package.json"],
28+ message: `chore(release): @continuedev/${packageName}@\${nextRelease.version} [skip ci]`,
29+ },
30+ ],
31+ "@semantic-release/github",
32+ ],
33+ };
34+}
added scripts/build-packages.ps1 +13 −0
@@ -0,0 +1,13 @@
1+Push-Location packages
2+
3+Push-Location "openai-adapters"
4+npm ci
5+npm run build
6+Pop-Location
7+
8+Push-Location "config-yaml"
9+npm ci
10+npm run build
11+Pop-Location
12+
13+Pop-Location
No newline at the end of the file
added scripts/build-packages.sh +13 −0
@@ -0,0 +1,13 @@
1+# Build @continuedev packages for monorepo style linking
2+
3+cd packages
4+cd openai-adapters
5+
6+npm ci
7+npm run build
8+
9+cd ..
10+cd config-yaml
11+
12+npm ci
13+npm run build
added scripts/create-docker-ssh-container.sh +35 −0
@@ -0,0 +1,35 @@
1+# create the docker file
2+
3+cat > Dockerfile << 'EOF'
4+FROM ubuntu:latest
5+ENV DEBIAN_FRONTEND=noninteractive
6+# Install SSH server
7+RUN apt-get update && apt-get install -y openssh-server
8+# Configure SSH
9+RUN mkdir /var/run/sshd
10+RUN echo 'root:my_password' | chpasswd
11+# Allow root login
12+RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
13+# SSH login fix
14+RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
15+EXPOSE 22
16+CMD ["/usr/sbin/sshd", "-D"]
17+EOF
18+
19+docker build -t continue-ubuntu-ssh . # build the image
20+
21+rm Dockerfile # remove the created Dockerfile
22+
23+container_name="continue-ssh-container"
24+
25+docker run -d -p 2222:22 --name $container_name continue-ubuntu-ssh # run the container
26+
27+echo "docker container ${container_name} running on port 2222"
28+
29+# add the instructions
30+bold=$(tput bold)
31+normal=$(tput sgr0)
32+
33+echo "\n--------------------------------------"
34+echo "now ssh into vscode (using remote explorer) with the following command: ${bold}ssh root@localhost -p 2222${normal}"
35+echo "use the following password - \"${bold}my_password${normal}\""