From 1fefb166ab4081a9f0381e6f9af0306d03b6a08b Mon Sep 17 00:00:00 2001 From: Nate Date: Sun, 13 Jul 2025 23:18:46 -0700 Subject: [PATCH 1/4] remove /models slash command --- package-lock.json | 4 ++-- src/intro.ts | 1 - src/slashCommands.ts | 8 -------- src/ui/SlashCommandUI.tsx | 5 ----- src/ui/UserInput.tsx | 1 - 5 files changed, 2 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3ea880e57..93e9eafa3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@continuedev/cli", - "version": "1.0.1", + "version": "1.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@continuedev/cli", - "version": "1.0.1", + "version": "1.1.0", "license": "Apache-2.0", "dependencies": { "@continuedev/openai-adapters": "^1.0.18", diff --git a/src/intro.ts b/src/intro.ts index 5a08117ab..dec4c2a12 100644 --- a/src/intro.ts +++ b/src/intro.ts @@ -39,7 +39,6 @@ export function introMessage(assistant: Assistant, mcpService: MCPService) { console.info(`- ${chalk.green("/exit")}: Exit the chat`); console.info(`- ${chalk.green("/clear")}: Clear the chat history`); console.info(`- ${chalk.green("/help")}: Show help message`); - console.info(`- ${chalk.green("/models")}: Show available models`); console.info(`- ${chalk.green("/login")}: Authenticate with your account`); console.info(`- ${chalk.green("/logout")}: Sign out of your current session`); console.info( diff --git a/src/slashCommands.ts b/src/slashCommands.ts index 5e2117a9a..1c03c52c4 100644 --- a/src/slashCommands.ts +++ b/src/slashCommands.ts @@ -26,19 +26,11 @@ export function handleSlashCommands( "/login - Authenticate with your account", "/logout - Sign out of your current session", "/whoami - Check who you're currently logged in as", - "/models - List available AI models", ...(assistant.prompts?.map( (prompt) => `/${prompt?.name} - ${prompt?.description}` ) ?? []), ].join("\n"); return { output: helpMessage }; - case "models": - return { - output: `Available models:\n• ${ - assistant.models?.map((model) => model?.name)?.join("\n• ") || - "None" - }`, - }; case "exit": return { exit: true, output: "Goodbye!" }; case "login": diff --git a/src/ui/SlashCommandUI.tsx b/src/ui/SlashCommandUI.tsx index 3f03bf8fb..cff5b5393 100644 --- a/src/ui/SlashCommandUI.tsx +++ b/src/ui/SlashCommandUI.tsx @@ -41,11 +41,6 @@ const SlashCommandUI: React.FC = ({ description: "Check who you're currently logged in as", category: "system", }, - { - name: "models", - description: "List available AI models", - category: "system", - }, ]; const assistantCommands: SlashCommand[] = diff --git a/src/ui/UserInput.tsx b/src/ui/UserInput.tsx index d05a4c54c..f4738e859 100644 --- a/src/ui/UserInput.tsx +++ b/src/ui/UserInput.tsx @@ -38,7 +38,6 @@ const UserInput: React.FC = ({ name: "whoami", description: "Check who you're currently logged in as", }, - { name: "models", description: "List available AI models" }, ]; const assistantCommands = From daae97242f1fca92f42f8c979df8d9c3f912f69d Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 14 Jul 2025 00:04:02 -0700 Subject: [PATCH 2/4] fix: remove part of the system message --- src/systemMessage.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/systemMessage.ts b/src/systemMessage.ts index ae13dda8a..bae4fa898 100644 --- a/src/systemMessage.ts +++ b/src/systemMessage.ts @@ -71,7 +71,7 @@ function getGitStatus(): string { const baseSystemMessage = `You are an agent in the Continue CLI. Given the user's prompt, you should use the tools available to you to answer the user's question. Notes: -1. IMPORTANT: You should be concise, direct, and to the point, since your responses will be displayed on a command line interface. Answer the user's question directly, without elaboration, explanation, or details. One word answers are best. Avoid introductions, conclusions, and explanations. You MUST avoid text before/after your response, such as "The answer is .", "Here is the content of the file..." or "Based on the information provided, the answer is..." or "Here is what I will do next...". +1. IMPORTANT: You should be concise, direct, and to the point, since your responses will be displayed on a command line interface. 2. When relevant, share file names and code snippets relevant to the query 3. Any file paths you return in your final response MUST be absolute. DO NOT use relative paths. Here is useful information about the environment you are running in: @@ -136,4 +136,4 @@ export function constructSystemMessage(rulesSystemMessage: string): string { } return systemMessage; -} \ No newline at end of file +} From d1372b3aa2f79221957468fd1decbae2258becc0 Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 14 Jul 2025 00:15:51 -0700 Subject: [PATCH 3/4] fix: improve streaming message handling and display buffering --- package-lock.json | 4 +-- src/ui/TUIChat.tsx | 62 +++++++++++++++++++--------------------------- 2 files changed, 28 insertions(+), 38 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3ea880e57..93e9eafa3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@continuedev/cli", - "version": "1.0.1", + "version": "1.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@continuedev/cli", - "version": "1.0.1", + "version": "1.1.0", "license": "Apache-2.0", "dependencies": { "@continuedev/openai-adapters": "^1.0.18", diff --git a/src/ui/TUIChat.tsx b/src/ui/TUIChat.tsx index 25db23d85..87ee1815f 100644 --- a/src/ui/TUIChat.tsx +++ b/src/ui/TUIChat.tsx @@ -105,36 +105,19 @@ const TUIChat: React.FC = ({ // Create callbacks to handle streaming updates const streamCallbacks: StreamCallbacks = { onContent: (content: string) => { - setMessages((prev) => { - const newMessages = [...prev]; - - // Find or create current streaming message - if (!currentStreamingMessage) { - currentStreamingMessage = { role: "assistant", content: "", isStreaming: true }; - newMessages.push(currentStreamingMessage); - } - - // Update the streaming message - const streamingIndex = newMessages.indexOf(currentStreamingMessage); - if (streamingIndex >= 0) { - newMessages[streamingIndex].content += content; - } - - return newMessages; - }); + // Buffer content but don't update UI until complete or tool call + if (!currentStreamingMessage) { + currentStreamingMessage = { role: "assistant", content: "", isStreaming: true }; + } + currentStreamingMessage.content += content; }, onContentComplete: (content: string) => { - // Finalize the current streaming message + // Display the complete message if (currentStreamingMessage) { - setMessages((prev) => { - const newMessages = [...prev]; - const streamingIndex = newMessages.indexOf(currentStreamingMessage!); - if (streamingIndex >= 0) { - newMessages[streamingIndex].isStreaming = false; - newMessages[streamingIndex].content = content; - } - return newMessages; - }); + setMessages((prev) => [ + ...prev, + { role: "assistant", content: content, isStreaming: false } + ]); currentStreamingMessage = null; } }, @@ -148,6 +131,16 @@ const TUIChat: React.FC = ({ return `${displayName}(${firstValue || ""})`; }; + // Display buffered content when tool starts + if (currentStreamingMessage && currentStreamingMessage.content) { + const messageContent = currentStreamingMessage.content; + setMessages((prev) => [ + ...prev, + { role: "assistant", content: messageContent, isStreaming: false } + ]); + currentStreamingMessage = null; + } + setMessages((prev) => [ ...prev, { @@ -200,15 +193,12 @@ const TUIChat: React.FC = ({ ); // Finalize any remaining streaming message - if (currentStreamingMessage) { - setMessages((prev) => { - const newMessages = [...prev]; - const streamingIndex = newMessages.indexOf(currentStreamingMessage!); - if (streamingIndex >= 0) { - newMessages[streamingIndex].isStreaming = false; - } - return newMessages; - }); + if (currentStreamingMessage && (currentStreamingMessage as any).content) { + const messageContent = (currentStreamingMessage as any).content; + setMessages((prev) => [ + ...prev, + { role: "assistant", content: messageContent, isStreaming: false } + ]); } } catch (error: any) { const errorMessage = `Error: ${error.message}`; From 2c722c485eea4c3c283fb643193a4b1ffe14bf7f Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 14 Jul 2025 00:25:35 -0700 Subject: [PATCH 4/4] feat: convert absolute paths to relative paths in tool display --- package-lock.json | 4 ++-- src/ui/TUIChat.tsx | 14 +++++++++++++- src/ui/ToolResultSummary.tsx | 13 ++++++++++++- test-relative-path.js | 20 ++++++++++++++++++++ 4 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 test-relative-path.js diff --git a/package-lock.json b/package-lock.json index 3ea880e57..93e9eafa3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@continuedev/cli", - "version": "1.0.1", + "version": "1.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@continuedev/cli", - "version": "1.0.1", + "version": "1.1.0", "license": "Apache-2.0", "dependencies": { "@continuedev/openai-adapters": "^1.0.18", diff --git a/src/ui/TUIChat.tsx b/src/ui/TUIChat.tsx index 25db23d85..2cf78a875 100644 --- a/src/ui/TUIChat.tsx +++ b/src/ui/TUIChat.tsx @@ -1,6 +1,7 @@ import { ContinueClient } from "@continuedev/sdk"; import { Box, Text, useApp } from "ink"; import { ChatCompletionMessageParam } from "openai/resources.mjs"; +import path from "path"; import React, { useEffect, useState } from "react"; import { handleSlashCommands } from "../slashCommands.js"; import { StreamCallbacks, streamChatResponse } from "../streamChatResponse.js"; @@ -145,7 +146,18 @@ const TUIChat: React.FC = ({ // Get the first parameter value for display const firstValue = Object.values(args)[0]; - return `${displayName}(${firstValue || ""})`; + + // Convert absolute paths to relative paths from workspace root + const formatPath = (value: any) => { + if (typeof value === "string" && path.isAbsolute(value)) { + const workspaceRoot = process.cwd(); + const relativePath = path.relative(workspaceRoot, value); + return relativePath || value; + } + return value; + }; + + return `${displayName}(${formatPath(firstValue) || ""})`; }; setMessages((prev) => [ diff --git a/src/ui/ToolResultSummary.tsx b/src/ui/ToolResultSummary.tsx index c360f9f0b..48fc5fd6a 100644 --- a/src/ui/ToolResultSummary.tsx +++ b/src/ui/ToolResultSummary.tsx @@ -1,4 +1,5 @@ import { Box, Text } from "ink"; +import path from "path"; import React from "react"; import { getToolDisplayName } from "../tools.js"; @@ -18,6 +19,16 @@ const ToolResultSummary: React.FC = ({ const chars = content.length; const displayName = toolName ? getToolDisplayName(toolName) : "Tool"; + // Convert absolute paths to relative paths from workspace root + const formatPath = (filePath: string) => { + if (path.isAbsolute(filePath)) { + const workspaceRoot = process.cwd(); + const relativePath = path.relative(workspaceRoot, filePath); + return relativePath || filePath; + } + return filePath; + }; + // Handle specific tool output formatting switch (toolName) { case "read_file": @@ -25,7 +36,7 @@ const ToolResultSummary: React.FC = ({ if (content.includes("→")) { const pathMatch = content.match(/^(.+?):/); const filePath = pathMatch ? pathMatch[1] : "file"; - return `${displayName} ${filePath} (${lines} lines)`; + return `${displayName} ${formatPath(filePath)} (${lines} lines)`; } return `${displayName} tool output (${lines} lines)`; diff --git a/test-relative-path.js b/test-relative-path.js new file mode 100644 index 000000000..89eb4975a --- /dev/null +++ b/test-relative-path.js @@ -0,0 +1,20 @@ +import path from "path"; + +// Test the relative path conversion logic +const formatPath = (value) => { + if (typeof value === "string" && path.isAbsolute(value)) { + const workspaceRoot = process.cwd(); + const relativePath = path.relative(workspaceRoot, value); + return relativePath || value; + } + return value; +}; + +// Test cases +console.log("Current working directory:", process.cwd()); +console.log("Test absolute path:", `/Users/nate/gh/continuedev/wt-no-abs/src/continueSDK.ts`); +console.log("Converted to relative:", formatPath(`/Users/nate/gh/continuedev/wt-no-abs/src/continueSDK.ts`)); +console.log("Test relative path:", `src/continueSDK.ts`); +console.log("Remains relative:", formatPath(`src/continueSDK.ts`)); +console.log("Test root file:", `/Users/nate/gh/continuedev/wt-no-abs/package.json`); +console.log("Converted to relative:", formatPath(`/Users/nate/gh/continuedev/wt-no-abs/package.json`)); \ No newline at end of file