From ffe0b8314707445768622b8b34bb3b832d49c423 Mon Sep 17 00:00:00 2001 From: alashchev17 Date: Fri, 6 Jun 2025 19:18:50 +0200 Subject: [PATCH 01/32] 6.5.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3cbd2ef2..9ff351f7 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "url": "https://github.com/smallcloudai/refact-vscode/issues", "email": "support@smallcloud.tech" }, - "version": "6.5.0", + "version": "6.5.1", "dependencies": { "@types/marked": "^4.0.8", "@types/vscode": "^1.69.0", From 47af30a4348180c076b06a186b9f71b6056c3086 Mon Sep 17 00:00:00 2001 From: Marc McIntosh Date: Tue, 17 Jun 2025 10:15:45 +0200 Subject: [PATCH 02/32] 6.5.2 --- package.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9ff351f7..198b25f7 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "url": "https://github.com/smallcloudai/refact-vscode/issues", "email": "support@smallcloud.tech" }, - "version": "6.5.1", + "version": "6.5.2", "dependencies": { "@types/marked": "^4.0.8", "@types/vscode": "^1.69.0", @@ -229,7 +229,10 @@ "order": 14 }, "refactai.activeGroup": { - "type": ["object", "null"], + "type": [ + "object", + "null" + ], "default": null, "description": "Active selected group in your Team Workspace. Modify via settings.json in your workspace", "scope": "machine-overridable", From 4cbab5ef7d3cae56f0fd136f0969cdff9f7785cf Mon Sep 17 00:00:00 2001 From: alashchev17 Date: Tue, 17 Jun 2025 15:37:41 +0200 Subject: [PATCH 03/32] 6.5.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 198b25f7..e0121b50 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "url": "https://github.com/smallcloudai/refact-vscode/issues", "email": "support@smallcloud.tech" }, - "version": "6.5.2", + "version": "6.5.3", "dependencies": { "@types/marked": "^4.0.8", "@types/vscode": "^1.69.0", From 9d69b71dfb5e3087d0aa2e584351584d1749aabf Mon Sep 17 00:00:00 2001 From: Marc McIntosh Date: Thu, 19 Jun 2025 10:19:19 +0200 Subject: [PATCH 04/32] 6.5.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e0121b50..1f819a54 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "url": "https://github.com/smallcloudai/refact-vscode/issues", "email": "support@smallcloud.tech" }, - "version": "6.5.3", + "version": "6.5.4", "dependencies": { "@types/marked": "^4.0.8", "@types/vscode": "^1.69.0", From 3544f3ce690ec1559b9bda261dd3a8f2728c29d4 Mon Sep 17 00:00:00 2001 From: Oleg Klimov Date: Thu, 19 Jun 2025 11:34:45 +0200 Subject: [PATCH 05/32] 6.5.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1f819a54..4499e49a 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "url": "https://github.com/smallcloudai/refact-vscode/issues", "email": "support@smallcloud.tech" }, - "version": "6.5.4", + "version": "6.5.5", "dependencies": { "@types/marked": "^4.0.8", "@types/vscode": "^1.69.0", From bfcd2247116a485b6e7d9111debe2547a05c7d3a Mon Sep 17 00:00:00 2001 From: Oleg Klimov Date: Thu, 19 Jun 2025 12:01:30 +0200 Subject: [PATCH 06/32] 6.5.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4499e49a..d10735e6 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "url": "https://github.com/smallcloudai/refact-vscode/issues", "email": "support@smallcloud.tech" }, - "version": "6.5.5", + "version": "6.5.6", "dependencies": { "@types/marked": "^4.0.8", "@types/vscode": "^1.69.0", From ac7b147a2321f45327be38062c59c84734bf2334 Mon Sep 17 00:00:00 2001 From: Oleg Klimov Date: Thu, 19 Jun 2025 12:34:55 +0200 Subject: [PATCH 07/32] 6.5.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d10735e6..9cebe8b4 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "url": "https://github.com/smallcloudai/refact-vscode/issues", "email": "support@smallcloud.tech" }, - "version": "6.5.6", + "version": "6.5.7", "dependencies": { "@types/marked": "^4.0.8", "@types/vscode": "^1.69.0", From 2344c79a17ca1d512f695634de53a1e814925d94 Mon Sep 17 00:00:00 2001 From: alashchev17 Date: Thu, 19 Jun 2025 14:56:27 +0200 Subject: [PATCH 08/32] 6.5.8 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9cebe8b4..0b5df411 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "url": "https://github.com/smallcloudai/refact-vscode/issues", "email": "support@smallcloud.tech" }, - "version": "6.5.7", + "version": "6.5.8", "dependencies": { "@types/marked": "^4.0.8", "@types/vscode": "^1.69.0", From c4c157264d6383df030dcd6127946b7f9fc0c811 Mon Sep 17 00:00:00 2001 From: alashchev17 Date: Thu, 19 Jun 2025 21:11:22 +0200 Subject: [PATCH 09/32] 6.5.9 --- package.json | 2 +- src/sidebar.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 0b5df411..198e861c 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "url": "https://github.com/smallcloudai/refact-vscode/issues", "email": "support@smallcloud.tech" }, - "version": "6.5.8", + "version": "6.5.9", "dependencies": { "@types/marked": "^4.0.8", "@types/vscode": "^1.69.0", diff --git a/src/sidebar.ts b/src/sidebar.ts index d6021bb3..b6e71ffe 100644 --- a/src/sidebar.ts +++ b/src/sidebar.ts @@ -1018,7 +1018,9 @@ export class PanelWebview implements vscode.WebviewViewProvider { const state: Partial = { teams: { + workspace: null, group: activeTeamsGroup, + skipped: false, }, current_project: {name: vscode.workspace.name ?? ""}, config, From f9845c69e85aa8d8d62f4eae7339fc22bd93236c Mon Sep 17 00:00:00 2001 From: Oleg Klimov Date: Fri, 20 Jun 2025 11:52:33 +0200 Subject: [PATCH 10/32] 6.5.10 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 198e861c..5b84062a 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "url": "https://github.com/smallcloudai/refact-vscode/issues", "email": "support@smallcloud.tech" }, - "version": "6.5.9", + "version": "6.5.10", "dependencies": { "@types/marked": "^4.0.8", "@types/vscode": "^1.69.0", From da89cde9eb4d3f110a7a9846d33494a5de348003 Mon Sep 17 00:00:00 2001 From: Oleg Klimov Date: Fri, 20 Jun 2025 12:42:45 +0200 Subject: [PATCH 11/32] 6.5.11 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5b84062a..8f5544b2 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "url": "https://github.com/smallcloudai/refact-vscode/issues", "email": "support@smallcloud.tech" }, - "version": "6.5.10", + "version": "6.5.11", "dependencies": { "@types/marked": "^4.0.8", "@types/vscode": "^1.69.0", From f8b7282a22d9f39dd4c7554fd284de8c1dd7673c Mon Sep 17 00:00:00 2001 From: alashchev17 Date: Fri, 20 Jun 2025 21:05:25 +0200 Subject: [PATCH 12/32] feat: storing active workspace selected in GUI --- src/sidebar.ts | 41 ++++++++++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/src/sidebar.ts b/src/sidebar.ts index b6e71ffe..679c90e3 100644 --- a/src/sidebar.ts +++ b/src/sidebar.ts @@ -40,8 +40,11 @@ import { ideSetLoginMessage, ideSetActiveTeamsGroup, ideClearActiveTeamsGroup, + ideSetActiveTeamsWorkspace, + ideClearActiveTeamsWorkspace, OpenFilePayload, - TeamsGroup + type TeamsGroup, + type TeamsWorkspace } from "refact-chat-js/dist/events"; import { basename, join } from "path"; import { diff_paste_back } from "./chatTab"; @@ -644,6 +647,14 @@ export class PanelWebview implements vscode.WebviewViewProvider { return this.handleClearActiveGroup(); } + if (ideSetActiveTeamsWorkspace.match(e)) { + return this.handleSetActiveWorkspace(e.payload); + } + + if (ideClearActiveTeamsWorkspace.match(e)) { + return this.handleClearActiveWorkspace(); + } + if(ideEscapeKeyPressed.match(e)) { return this.handleEscapePressed(e.payload); } @@ -815,16 +826,15 @@ export class PanelWebview implements vscode.WebviewViewProvider { usabilityHints.show_message_from_server('InferenceServer', message); } - async handleSetActiveGroup (group:TeamsGroup) { + async handleSetActiveGroup(group: TeamsGroup) { await this.context.workspaceState.update( 'refactai.activeGroup', group, ); - console.log(`[DEBUG]: updated locally active group in ./.vscode/settings.json: `, group); this.handleSettingsChange(); } - async handleClearActiveGroup () { + async handleClearActiveGroup() { await this.context.workspaceState.update( 'refactai.activeGroup', undefined, @@ -832,6 +842,22 @@ export class PanelWebview implements vscode.WebviewViewProvider { this.handleSettingsChange(); } + async handleSetActiveWorkspace(workspace: TeamsWorkspace) { + await global.global_context.globalState.update( + 'activeTeamsWorkspace', + workspace, + ); + this.handleSettingsChange(); + } + + async handleClearActiveWorkspace() { + await global.global_context.globalState.update( + 'activeTeamsWorkspace', + undefined, + ); + this.handleSettingsChange(); + } + async handleEscapePressed(mode: string) { const editor = vscode.window.activeTextEditor; if (!editor) { return; } @@ -984,11 +1010,12 @@ export class PanelWebview implements vscode.WebviewViewProvider { const ast = vscode.workspace.getConfiguration()?.get("refactai.ast") ?? false; const apiKey = vscode.workspace.getConfiguration()?.get("refactai.apiKey") ?? ""; const addressURL = vscode.workspace.getConfiguration()?.get("refactai.addressURL") ?? ""; - const activeTeamsGroup = this.context.workspaceState.get('refactai.activeGroup') ?? null; const port = global.rust_binary_blob?.get_port() ?? 8001; const completeManual = await getKeyBindingForChat("refactaicmd.completionManual"); const shiftEnterToSubmit = vscode.workspace.getConfiguration()?.get("refactai.shiftEnterToSubmit")?? false; - + + const activeTeamsWorkspace = global.global_context.globalState.get('activeTeamsWorkspace') ?? null; + const activeTeamsGroup = this.context.workspaceState.get('refactai.activeGroup') ?? null; const currentActiveWorkspaceName = this.getActiveWorkspace(); const config: InitialState["config"] = { @@ -1018,7 +1045,7 @@ export class PanelWebview implements vscode.WebviewViewProvider { const state: Partial = { teams: { - workspace: null, + workspace: activeTeamsWorkspace, group: activeTeamsGroup, skipped: false, }, From 51cb3184e48277bd6680bab047eea257d2f80fbf Mon Sep 17 00:00:00 2001 From: Oleg Klimov Date: Sat, 21 Jun 2025 02:40:43 +0200 Subject: [PATCH 13/32] 6.5.12 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8f5544b2..cdbfef71 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "url": "https://github.com/smallcloudai/refact-vscode/issues", "email": "support@smallcloud.tech" }, - "version": "6.5.11", + "version": "6.5.12", "dependencies": { "@types/marked": "^4.0.8", "@types/vscode": "^1.69.0", From e12bdc99cc6e9fcf2ec13a3bccc290c288b4e968 Mon Sep 17 00:00:00 2001 From: Oleg Klimov Date: Sat, 21 Jun 2025 02:47:50 +0200 Subject: [PATCH 14/32] 6.5.13 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cdbfef71..ea396488 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "url": "https://github.com/smallcloudai/refact-vscode/issues", "email": "support@smallcloud.tech" }, - "version": "6.5.12", + "version": "6.5.13", "dependencies": { "@types/marked": "^4.0.8", "@types/vscode": "^1.69.0", From 00b7e4f39c29112b5fabf1e0d5a840c76e607e42 Mon Sep 17 00:00:00 2001 From: alashchev17 Date: Mon, 23 Jun 2025 14:29:36 +0200 Subject: [PATCH 15/32] chore: 6.5.14 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ea396488..989a45a8 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "url": "https://github.com/smallcloudai/refact-vscode/issues", "email": "support@smallcloud.tech" }, - "version": "6.5.13", + "version": "6.5.14", "dependencies": { "@types/marked": "^4.0.8", "@types/vscode": "^1.69.0", From d0d53f188b6ad66744f4ced61651665543d47347 Mon Sep 17 00:00:00 2001 From: Oleg Klimov Date: Thu, 26 Jun 2025 09:40:01 +0200 Subject: [PATCH 16/32] 6.5.15 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 989a45a8..09a733e6 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "url": "https://github.com/smallcloudai/refact-vscode/issues", "email": "support@smallcloud.tech" }, - "version": "6.5.14", + "version": "6.5.15", "dependencies": { "@types/marked": "^4.0.8", "@types/vscode": "^1.69.0", From c156bcc6bb1beb3409ec2569e625f9b4beac8d71 Mon Sep 17 00:00:00 2001 From: alashchev17 Date: Mon, 30 Jun 2025 19:44:12 +0200 Subject: [PATCH 17/32] 6.5.16 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 09a733e6..e53e283e 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "url": "https://github.com/smallcloudai/refact-vscode/issues", "email": "support@smallcloud.tech" }, - "version": "6.5.15", + "version": "6.5.16", "dependencies": { "@types/marked": "^4.0.8", "@types/vscode": "^1.69.0", From e22a795289746ea215a4b86bfac50143b2314759 Mon Sep 17 00:00:00 2001 From: Marc McIntosh Date: Thu, 3 Jul 2025 14:53:46 +0200 Subject: [PATCH 18/32] 6.5.17 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e53e283e..dce20909 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "url": "https://github.com/smallcloudai/refact-vscode/issues", "email": "support@smallcloud.tech" }, - "version": "6.5.16", + "version": "6.5.17", "dependencies": { "@types/marked": "^4.0.8", "@types/vscode": "^1.69.0", From 2a52bea0e68e07aa530da3372e01429f4ada8fba Mon Sep 17 00:00:00 2001 From: Marc McIntosh Date: Mon, 30 Jun 2025 16:16:46 +0200 Subject: [PATCH 19/32] wip: allow vscode to compile with the flexus changes to chat --- .vscode/launch.json | 3 ++- src/codeLens.ts | 12 ++++------ src/fetchAPI.ts | 58 ++++++++++++++++++++++++++------------------- src/sidebar.ts | 7 ++++-- 4 files changed, 46 insertions(+), 34 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 670d6e66..39b5eb0b 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,7 +10,8 @@ "type": "extensionHost", "request": "launch", "args": [ - "--extensionDevelopmentPath=${workspaceFolder}" + "--extensionDevelopmentPath=${workspaceFolder}", + "--allow-insecure-localhost" ], "outFiles": [ "${workspaceFolder}/out/**/*.js" diff --git a/src/codeLens.ts b/src/codeLens.ts index e9725597..c85174e8 100644 --- a/src/codeLens.ts +++ b/src/codeLens.ts @@ -5,9 +5,7 @@ import * as estate from "./estate"; import * as fetchH2 from 'fetch-h2'; import * as fetchAPI from "./fetchAPI"; import { - type ChatMessages, type ChatMessage, - type ToolUse, setInputValue, isUserMessage, UserMessage, @@ -169,10 +167,10 @@ const createMessageBlock = ( cursor: number | null, text: string ) => { - if (typeof message.content === 'string') { - return replaceVariablesInText(message.content, relative_path, cursor, text); + if (typeof message.ftm_content === 'string') { + return replaceVariablesInText(message.ftm_content, relative_path, cursor, text); } else { - return message.content.map(content => { + return message.ftm_content.map(content => { if (('type' in content) && content.type === 'text') { return replaceVariablesInText(content.text, relative_path, cursor, text); } @@ -188,10 +186,10 @@ const formatMultipleMessagesForCodeLens = ( ) => { return messages.map(message => { if (isUserMessage(message)) { - if (typeof message.content === 'string') { + if (typeof message.ftm_content === 'string') { return { ...message, - content: replaceVariablesInText(message.content, relative_path, cursor, text) + content: replaceVariablesInText(message.ftm_content, relative_path, cursor, text) }; } } diff --git a/src/fetchAPI.ts b/src/fetchAPI.ts index fbfe2c5d..4fd32c41 100644 --- a/src/fetchAPI.ts +++ b/src/fetchAPI.ts @@ -5,8 +5,6 @@ import * as usabilityHints from "./usabilityHints"; import * as estate from "./estate"; import * as statusBar from "./statusBar"; import { - type CapsResponse, - type CustomPromptsResponse, ChatMessages, } from "refact-chat-js/dist/events"; @@ -458,28 +456,40 @@ export function look_for_common_errors(json: any, scope: string, url: string): b return false; } -export async function get_caps(): Promise { - let url = rust_url("/v1/caps"); - if (!url) { - return Promise.reject("read_caps no rust binary working, very strange"); - } - - let req = new fetchH2.Request(url, { - method: "GET", - redirect: "follow", - cache: "no-cache", - referrer: "no-referrer", - }); - - let resp = await fetchH2.fetch(req); - if (resp.status !== 200) { - console.log(["read_caps http status", resp.status]); - return Promise.reject("read_caps bad status"); - } - let json = await resp.json(); - console.log(["successful read_caps", json]); - return json as CapsResponse; -} +// TODO: this has moved (also not used) +// export async function get_caps(): Promise { +// let url = rust_url("/v1/caps"); +// if (!url) { +// return Promise.reject("read_caps no rust binary working, very strange"); +// } + +// let req = new fetchH2.Request(url, { +// method: "GET", +// redirect: "follow", +// cache: "no-cache", +// referrer: "no-referrer", +// }); + +// let resp = await fetchH2.fetch(req); +// if (resp.status !== 200) { +// console.log(["read_caps http status", resp.status]); +// return Promise.reject("read_caps bad status"); +// } +// let json = await resp.json(); +// console.log(["successful read_caps", json]); +// return json as CapsResponse; +// } + +type SystemPrompt = { + text: string; + description: string; +}; + +type SystemPrompts = Record; +type CustomPromptsResponse = { + system_prompts: SystemPrompts; + toolbox_commands: Record; +}; export async function get_prompt_customization(): Promise { const url = rust_url("/v1/customization"); diff --git a/src/sidebar.ts b/src/sidebar.ts index 679c90e3..d696fbae 100644 --- a/src/sidebar.ts +++ b/src/sidebar.ts @@ -73,11 +73,12 @@ export async function open_chat_tab( } if (global.side_panel && global.side_panel._view) { + // TODO: ChatThread is no longer used const chat: ChatThread = { id: uuidv4(), messages: question ? [ ...messages, - {role: "user", content: question}, + {ftm_role: "user", ftm_content: question}, ] : [], model: model, new_chat_suggested: { @@ -1002,6 +1003,7 @@ export class PanelWebview implements vscode.WebviewViewProvider { } + // TODO: chat thread has changed async createInitialState(thread?: ChatThread, tabbed = false): Promise> { const fontSize = vscode.workspace.getConfiguration().get("editor.fontSize") ?? 12; const scaling = fontSize < 14 ? "90%" : "100%"; @@ -1062,6 +1064,7 @@ export class PanelWebview implements vscode.WebviewViewProvider { } if(thread) { + // TODO: update this the messageThread const chat: InitialState["chat"] = { streaming: false, error: null, @@ -1069,7 +1072,7 @@ export class PanelWebview implements vscode.WebviewViewProvider { waiting_for_response: false, tool_use: thread.tool_use ? thread.tool_use : "explore", cache: {}, - system_prompt: {}, + // system_prompt: {}, send_immediately: thread.messages.length > 0, thread, }; From f70179bce6f037f3676fc3453cef2471884a3f3a Mon Sep 17 00:00:00 2001 From: Marc McIntosh Date: Mon, 30 Jun 2025 18:35:40 +0200 Subject: [PATCH 20/32] chore: update code lens code to use "ftm_role" and "ftm_content". --- src/codeLens.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/codeLens.ts b/src/codeLens.ts index c85174e8..2ad8dfbc 100644 --- a/src/codeLens.ts +++ b/src/codeLens.ts @@ -145,6 +145,7 @@ const postMessageToWebview = ({messages, value, send_immediately}: {messages?: C value, send_immediately }); + console.log({eventMessage}) global.side_panel._view.webview.postMessage(eventMessage); }; @@ -183,13 +184,13 @@ const formatMultipleMessagesForCodeLens = ( relative_path: string, cursor: number | null, text: string -) => { +): ChatMessage[] => { return messages.map(message => { if (isUserMessage(message)) { if (typeof message.ftm_content === 'string') { return { ...message, - content: replaceVariablesInText(message.ftm_content, relative_path, cursor, text) + ftm_content: replaceVariablesInText(message.ftm_content, relative_path, cursor, text) }; } } @@ -204,7 +205,12 @@ export async function code_lens_execute(code_lens: string, range: any) { if (custom_code_lens) { const auto_submit = custom_code_lens[code_lens]["auto_submit"]; const new_tab = custom_code_lens[code_lens]["new_tab"]; - let messages: ChatMessage[] = custom_code_lens[code_lens]["messages"]; + let messages: ChatMessage[] = custom_code_lens[code_lens]["messages"].map((message: {role: string, content: unknown}) => { + return { + ftm_role: message.role, + ftm_content: message.content, + }; + }); const start_of_line = new vscode.Position(range.start.line, 0); const end_of_line = new vscode.Position(range.end.line + 1, 0); From 5c3ad2497ef5be33d34ce4d23a60536547a8560d Mon Sep 17 00:00:00 2001 From: Marc McIntosh Date: Thu, 3 Jul 2025 15:00:37 +0200 Subject: [PATCH 21/32] chore: remove console.log --- src/codeLens.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/codeLens.ts b/src/codeLens.ts index 2ad8dfbc..2d349200 100644 --- a/src/codeLens.ts +++ b/src/codeLens.ts @@ -145,7 +145,6 @@ const postMessageToWebview = ({messages, value, send_immediately}: {messages?: C value, send_immediately }); - console.log({eventMessage}) global.side_panel._view.webview.postMessage(eventMessage); }; From fa7fb016c06556038f6dd93d3384273a881996bc Mon Sep 17 00:00:00 2001 From: Marc McIntosh Date: Fri, 4 Jul 2025 16:00:52 +0200 Subject: [PATCH 22/32] 6.5.18 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dce20909..20e44f4e 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "url": "https://github.com/smallcloudai/refact-vscode/issues", "email": "support@smallcloud.tech" }, - "version": "6.5.17", + "version": "6.5.18", "dependencies": { "@types/marked": "^4.0.8", "@types/vscode": "^1.69.0", From 7bda9f2af713390ffa8bfa2b36b4196bb9274aec Mon Sep 17 00:00:00 2001 From: Marc McIntosh Date: Mon, 7 Jul 2025 14:32:00 +0200 Subject: [PATCH 23/32] 6.5.19 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 20e44f4e..1a9c9432 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "url": "https://github.com/smallcloudai/refact-vscode/issues", "email": "support@smallcloud.tech" }, - "version": "6.5.18", + "version": "6.5.19", "dependencies": { "@types/marked": "^4.0.8", "@types/vscode": "^1.69.0", From 3c4e4f81774a9329ccda8625921477a118023ede Mon Sep 17 00:00:00 2001 From: Marc McIntosh Date: Fri, 11 Jul 2025 14:36:41 +0200 Subject: [PATCH 24/32] feat: add connections when in xpermental mode --- src/sidebar.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/sidebar.ts b/src/sidebar.ts index d696fbae..67ae9697 100644 --- a/src/sidebar.ts +++ b/src/sidebar.ts @@ -284,6 +284,8 @@ export class PanelWebview implements vscode.WebviewViewProvider { .getConfiguration() ?.get("refactai.ast") ?? false; + const connections = vscode.workspace.getConfiguration()?.get("refactai.xperimental") ?? false; + const apiKey = vscode.workspace.getConfiguration()?.get("refactai.apiKey") ?? ""; const addressURL = vscode.workspace.getConfiguration()?.get("refactai.addressURL") ?? ""; @@ -297,7 +299,7 @@ export class PanelWebview implements vscode.WebviewViewProvider { addressURL, lspPort: port, shiftEnterToSubmit: submitChatWithShiftEnter, - features: {vecdb, ast}, + features: {vecdb, ast, connections}, currentWorkspaceName: currentActiveWorkspaceName }); @@ -1020,6 +1022,8 @@ export class PanelWebview implements vscode.WebviewViewProvider { const activeTeamsGroup = this.context.workspaceState.get('refactai.activeGroup') ?? null; const currentActiveWorkspaceName = this.getActiveWorkspace(); + const connections = vscode.workspace.getConfiguration()?.get("refactai.xperimental") ?? false; + const config: InitialState["config"] = { host: "vscode", tabbed, @@ -1035,6 +1039,7 @@ export class PanelWebview implements vscode.WebviewViewProvider { ast, images: true, statistics: true, + connections, }, keyBindings: { completeManual, From 5e09164c5e6547c0749c278e67d5e218a025ac68 Mon Sep 17 00:00:00 2001 From: Marc McIntosh Date: Fri, 11 Jul 2025 14:49:24 +0200 Subject: [PATCH 25/32] 6.5.20 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1a9c9432..f5815794 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "url": "https://github.com/smallcloudai/refact-vscode/issues", "email": "support@smallcloud.tech" }, - "version": "6.5.19", + "version": "6.5.20", "dependencies": { "@types/marked": "^4.0.8", "@types/vscode": "^1.69.0", From 789e4feecf432bcfb5cbcd484f85b6cafbdf862d Mon Sep 17 00:00:00 2001 From: Marc McIntosh Date: Tue, 22 Jul 2025 18:51:15 +0200 Subject: [PATCH 26/32] chore: remove ChatThread --- src/sidebar.ts | 70 ++++++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/src/sidebar.ts b/src/sidebar.ts index 67ae9697..0083b53a 100644 --- a/src/sidebar.ts +++ b/src/sidebar.ts @@ -24,7 +24,7 @@ import { ideNewFileAction, ideOpenSettingsAction, ideDiffPasteBackAction, - type ChatThread, + // type ChatThread, ideAnimateFileStart, ideAnimateFileStop, ideChatPageChange, @@ -59,6 +59,7 @@ function composeHandlers(...eventHandlers: Handler[]) { return (data: any) => eventHandlers.forEach(fn => fn && fn(data)); } +// here export async function open_chat_tab( question: string, editor: vscode.TextEditor | undefined, @@ -74,18 +75,19 @@ export async function open_chat_tab( if (global.side_panel && global.side_panel._view) { // TODO: ChatThread is no longer used - const chat: ChatThread = { - id: uuidv4(), - messages: question ? [ - ...messages, - {ftm_role: "user", ftm_content: question}, - ] : [], - model: model, - new_chat_suggested: { - wasSuggested: false, - } - }; - global.side_panel.goto_chat(chat); // changes html + // const chat: ChatThread = { + // id: uuidv4(), + // messages: question ? [ + // ...messages, + // {ftm_role: "user", ftm_content: question}, + // ] : [], + // model: model, + // new_chat_suggested: { + // wasSuggested: false, + // } + // }; + // global.side_panel.goto_chat(chat); + global.side_panel.goto_chat(); // changes html } return; @@ -405,7 +407,7 @@ export class PanelWebview implements vscode.WebviewViewProvider { } // can change this to - public async goto_chat(chat_thread?: ChatThread) + public async goto_chat() { // this.html_main_screen(this._view.webview); // this.address = chat.chat_id; @@ -418,7 +420,7 @@ export class PanelWebview implements vscode.WebviewViewProvider { // ); // Could throw? - const html = await this.html_main_screen(this._view.webview, chat_thread); + const html = await this.html_main_screen(this._view.webview); this._view.webview.html = html; // this.update_webview(); } @@ -1006,7 +1008,7 @@ export class PanelWebview implements vscode.WebviewViewProvider { // TODO: chat thread has changed - async createInitialState(thread?: ChatThread, tabbed = false): Promise> { + async createInitialState(tabbed = false): Promise> { const fontSize = vscode.workspace.getConfiguration().get("editor.fontSize") ?? 12; const scaling = fontSize < 14 ? "90%" : "100%"; const activeColorTheme = this.getColorTheme(); @@ -1068,27 +1070,27 @@ export class PanelWebview implements vscode.WebviewViewProvider { state.selected_snippet = snippet; } - if(thread) { - // TODO: update this the messageThread - const chat: InitialState["chat"] = { - streaming: false, - error: null, - prevent_send: true, - waiting_for_response: false, - tool_use: thread.tool_use ? thread.tool_use : "explore", - cache: {}, - // system_prompt: {}, - send_immediately: thread.messages.length > 0, - thread, - }; - state.chat = chat; - state.pages = [{name: "login page"}, {name: "history"}, {name: "chat"}]; - } + // if(thread) { + // // TODO: update this the messageThread + // const chat: InitialState["chat"] = { + // streaming: false, + // error: null, + // prevent_send: true, + // waiting_for_response: false, + // tool_use: thread.tool_use ? thread.tool_use : "explore", + // cache: {}, + // // system_prompt: {}, + // send_immediately: thread.messages.length > 0, + // thread, + // }; + // state.chat = chat; + // state.pages = [{name: "login page"}, {name: "history"}, {name: "chat"}]; + // } return state; } - private async html_main_screen(webview: vscode.Webview, chat_thread?: ChatThread, tabbed?: boolean) + private async html_main_screen(webview: vscode.Webview, tabbed?: boolean) { // TODO: add send immediately flag for context menu and toolbar const extensionUri = this.context.extensionUri; @@ -1110,7 +1112,7 @@ export class PanelWebview implements vscode.WebviewViewProvider { existing_address = ""; } - const initialState = await this.createInitialState(chat_thread, tabbed); + const initialState = await this.createInitialState(tabbed); let stringifiedInitialState = JSON.stringify(initialState); stringifiedInitialState = stringifiedInitialState.replace(/\<\/script>/gi, ""); From db69f16ba5c4dc21bbf8c4bb677996fd94130245 Mon Sep 17 00:00:00 2001 From: Marc McIntosh Date: Wed, 23 Jul 2025 17:07:32 +0200 Subject: [PATCH 27/32] 6.5.21 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f5815794..d294b738 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "url": "https://github.com/smallcloudai/refact-vscode/issues", "email": "support@smallcloud.tech" }, - "version": "6.5.20", + "version": "6.5.21", "dependencies": { "@types/marked": "^4.0.8", "@types/vscode": "^1.69.0", From a9341fc2cdc88aa611dfc4cb5dfd5070e07cd9d8 Mon Sep 17 00:00:00 2001 From: Marc McIntosh Date: Thu, 24 Jul 2025 17:04:36 +0200 Subject: [PATCH 28/32] wip: changing lsp workspace --- src/launchRust.ts | 15 ++++++++------- src/sidebar.ts | 13 ++++++++++--- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/launchRust.ts b/src/launchRust.ts index 5c02152e..5502aacb 100644 --- a/src/launchRust.ts +++ b/src/launchRust.ts @@ -8,7 +8,7 @@ import * as lspClient from 'vscode-languageclient/node'; import * as net from 'net'; import { register_commands } from './rconsoleCommands'; import { QuickActionProvider } from './quickProvider'; -import { TeamsGroup } from 'refact-chat-js/dist/events'; +import { TeamsWorkspace } from 'refact-chat-js/dist/events'; const DEBUG_HTTP_PORT = 8001; @@ -83,8 +83,8 @@ export class RustBinaryBlob { let port: number; let ping_response: string; - // const maybe_active_workspace = global.global_context.globalState.get('active_workspace') as Workspace | undefined; - // const active_workspace_id = maybe_active_workspace ? maybe_active_workspace.workspace_id : null; + const maybe_active_workspace = global.global_context.globalState.get('activeTeamsWorkspace') as TeamsWorkspace | undefined; + const active_workspace_id = maybe_active_workspace ? maybe_active_workspace.ws_id : null; if (xdebug === 0) { if (this.lsp_client) { // running port = this.port; // keep the same port @@ -128,10 +128,10 @@ export class RustBinaryBlob { "--basic-telemetry", ]; - // if (active_workspace_id !== null && active_workspace_id !== undefined) { - // new_cmdline.push("--active-workspace-id"); - // new_cmdline.push(active_workspace_id.toString()); - // } + if (active_workspace_id !== null && active_workspace_id !== undefined) { + new_cmdline.push("--active-workspace-id"); + new_cmdline.push(active_workspace_id.toString()); + } if (vscode.workspace.getConfiguration().get("refactai.vecdb")) { new_cmdline.push("--vecdb"); @@ -166,6 +166,7 @@ export class RustBinaryBlob { break; } } + // posable loop global.side_panel?.handleSettingsChange(); } diff --git a/src/sidebar.ts b/src/sidebar.ts index 0083b53a..9c1fd868 100644 --- a/src/sidebar.ts +++ b/src/sidebar.ts @@ -275,7 +275,7 @@ export class PanelWebview implements vscode.WebviewViewProvider { } } - handleSettingsChange() { + handleSettingsChange(restart_lsp = false) { const vecdb = vscode.workspace .getConfiguration() @@ -294,6 +294,8 @@ export class PanelWebview implements vscode.WebviewViewProvider { const port = global.rust_binary_blob?.get_port() ?? 8001; const submitChatWithShiftEnter = vscode.workspace.getConfiguration()?.get("refactai.submitChatWithShiftEnter")?? false; + // binary should be restarted? + const currentActiveWorkspaceName = this.getActiveWorkspace(); const message = updateConfig({ @@ -306,6 +308,10 @@ export class PanelWebview implements vscode.WebviewViewProvider { }); this._view?.webview.postMessage(message); + + if(restart_lsp) { + global.rust_binary_blob?.settings_changed(); + } } public attachFile(path: string) { @@ -644,6 +650,7 @@ export class PanelWebview implements vscode.WebviewViewProvider { return this.handleSetLoginMessage(e.payload); } + // here if (ideSetActiveTeamsGroup.match(e)) { return this.handleSetActiveGroup(e.payload); } @@ -852,7 +859,7 @@ export class PanelWebview implements vscode.WebviewViewProvider { 'activeTeamsWorkspace', workspace, ); - this.handleSettingsChange(); + this.handleSettingsChange(true); } async handleClearActiveWorkspace() { @@ -860,7 +867,7 @@ export class PanelWebview implements vscode.WebviewViewProvider { 'activeTeamsWorkspace', undefined, ); - this.handleSettingsChange(); + this.handleSettingsChange(true); } async handleEscapePressed(mode: string) { From c30a8209a42168f34d09fc68eb88fb0454081d6a Mon Sep 17 00:00:00 2001 From: Marc McIntosh Date: Thu, 24 Jul 2025 17:15:21 +0200 Subject: [PATCH 29/32] refactor: split setting changed and updating the ui --- src/extension.ts | 2 +- src/launchRust.ts | 6 +++++- src/sidebar.ts | 14 ++++++-------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index 8729f055..a04e0dc1 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -370,7 +370,7 @@ export function activate(context: vscode.ExtensionContext) } config_debounce = setTimeout(() => { if (global.rust_binary_blob) { - global.rust_binary_blob.settings_changed(); + global.rust_binary_blob.settings_changed_and_update_ui(); } }, 1000); } diff --git a/src/launchRust.ts b/src/launchRust.ts index 5502aacb..238b4a77 100644 --- a/src/launchRust.ts +++ b/src/launchRust.ts @@ -166,7 +166,11 @@ export class RustBinaryBlob { break; } } - // posable loop + + } + + public async settings_changed_and_update_ui() { + await this.settings_changed(); global.side_panel?.handleSettingsChange(); } diff --git a/src/sidebar.ts b/src/sidebar.ts index 9c1fd868..0e1fab65 100644 --- a/src/sidebar.ts +++ b/src/sidebar.ts @@ -275,7 +275,7 @@ export class PanelWebview implements vscode.WebviewViewProvider { } } - handleSettingsChange(restart_lsp = false) { + handleSettingsChange() { const vecdb = vscode.workspace .getConfiguration() @@ -294,8 +294,6 @@ export class PanelWebview implements vscode.WebviewViewProvider { const port = global.rust_binary_blob?.get_port() ?? 8001; const submitChatWithShiftEnter = vscode.workspace.getConfiguration()?.get("refactai.submitChatWithShiftEnter")?? false; - // binary should be restarted? - const currentActiveWorkspaceName = this.getActiveWorkspace(); const message = updateConfig({ @@ -309,9 +307,9 @@ export class PanelWebview implements vscode.WebviewViewProvider { this._view?.webview.postMessage(message); - if(restart_lsp) { - global.rust_binary_blob?.settings_changed(); - } + + global.rust_binary_blob?.settings_changed(); + } public attachFile(path: string) { @@ -859,7 +857,7 @@ export class PanelWebview implements vscode.WebviewViewProvider { 'activeTeamsWorkspace', workspace, ); - this.handleSettingsChange(true); + this.handleSettingsChange(); } async handleClearActiveWorkspace() { @@ -867,7 +865,7 @@ export class PanelWebview implements vscode.WebviewViewProvider { 'activeTeamsWorkspace', undefined, ); - this.handleSettingsChange(true); + this.handleSettingsChange(); } async handleEscapePressed(mode: string) { From d8d6bbe33ce1e2621a54173c92904ec885238c61 Mon Sep 17 00:00:00 2001 From: Marc McIntosh Date: Thu, 24 Jul 2025 17:41:28 +0200 Subject: [PATCH 30/32] fix: rename lsp arg to `--active-group-id` --- src/launchRust.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/launchRust.ts b/src/launchRust.ts index 238b4a77..4542fc4c 100644 --- a/src/launchRust.ts +++ b/src/launchRust.ts @@ -129,7 +129,7 @@ export class RustBinaryBlob { ]; if (active_workspace_id !== null && active_workspace_id !== undefined) { - new_cmdline.push("--active-workspace-id"); + new_cmdline.push("--active-group-id"); new_cmdline.push(active_workspace_id.toString()); } From b20e2a90a084bfd5993b997416159569a89b21d9 Mon Sep 17 00:00:00 2001 From: Marc McIntosh Date: Thu, 24 Jul 2025 18:41:32 +0200 Subject: [PATCH 31/32] refactor: don't restart the lsp when chaning group. --- src/extension.ts | 2 +- src/launchRust.ts | 16 +++++++--------- src/sidebar.ts | 3 --- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/extension.ts b/src/extension.ts index a04e0dc1..8729f055 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -370,7 +370,7 @@ export function activate(context: vscode.ExtensionContext) } config_debounce = setTimeout(() => { if (global.rust_binary_blob) { - global.rust_binary_blob.settings_changed_and_update_ui(); + global.rust_binary_blob.settings_changed(); } }, 1000); } diff --git a/src/launchRust.ts b/src/launchRust.ts index 4542fc4c..49818621 100644 --- a/src/launchRust.ts +++ b/src/launchRust.ts @@ -8,7 +8,7 @@ import * as lspClient from 'vscode-languageclient/node'; import * as net from 'net'; import { register_commands } from './rconsoleCommands'; import { QuickActionProvider } from './quickProvider'; -import { TeamsWorkspace } from 'refact-chat-js/dist/events'; +import { TeamsGroup } from 'refact-chat-js/dist/events'; const DEBUG_HTTP_PORT = 8001; @@ -83,8 +83,9 @@ export class RustBinaryBlob { let port: number; let ping_response: string; - const maybe_active_workspace = global.global_context.globalState.get('activeTeamsWorkspace') as TeamsWorkspace | undefined; - const active_workspace_id = maybe_active_workspace ? maybe_active_workspace.ws_id : null; + + const team = global.side_panel?.context.workspaceState.get('refactai.activeGroup'); + if (xdebug === 0) { if (this.lsp_client) { // running port = this.port; // keep the same port @@ -128,9 +129,9 @@ export class RustBinaryBlob { "--basic-telemetry", ]; - if (active_workspace_id !== null && active_workspace_id !== undefined) { + if (team && team.id) { new_cmdline.push("--active-group-id"); - new_cmdline.push(active_workspace_id.toString()); + new_cmdline.push(team.id.toString()); } if (vscode.workspace.getConfiguration().get("refactai.vecdb")) { @@ -167,11 +168,8 @@ export class RustBinaryBlob { } } - } - - public async settings_changed_and_update_ui() { - await this.settings_changed(); global.side_panel?.handleSettingsChange(); + } public async launch() { diff --git a/src/sidebar.ts b/src/sidebar.ts index 0e1fab65..a53c7121 100644 --- a/src/sidebar.ts +++ b/src/sidebar.ts @@ -306,9 +306,6 @@ export class PanelWebview implements vscode.WebviewViewProvider { }); this._view?.webview.postMessage(message); - - - global.rust_binary_blob?.settings_changed(); } From c96033808f40a74ca5274f92f82f0fe2068b58ef Mon Sep 17 00:00:00 2001 From: Marc McIntosh Date: Wed, 30 Jul 2025 10:45:06 +0200 Subject: [PATCH 32/32] 6.5.22 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d294b738..3ac48eff 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "url": "https://github.com/smallcloudai/refact-vscode/issues", "email": "support@smallcloud.tech" }, - "version": "6.5.21", + "version": "6.5.22", "dependencies": { "@types/marked": "^4.0.8", "@types/vscode": "^1.69.0",