Changesets · Branches · Tags · Compare
| Changeset | d595b705ef5a08087d035cc412ef6a6869c2ada201dece71635282a5c81d93d8 |
|---|---|
| Author | Nate <sestinj@gmail.com> · 2025-08-28 17:59 -07:00 |
| Committer | Nate <sestinj@gmail.com> · 2025-08-28 17:59 -07:00 |
| Parents | 96e49bfda5ce |
10 files changed
modified extensions/cli/AGENTS.md +0 −5
| @@ -18,30 +18,25 @@ | ||
| 18 | 18 | ### Core Components |
| 19 | 19 | |
| 20 | 20 | 1. **Entry Point** (`src/index.ts`): Main CLI logic with two modes: |
| 21 | - | |
| 22 | 21 | - **Headless mode**: Non-interactive mode for automation/CI |
| 23 | 22 | - **TUI mode**: Terminal User Interface using Ink/React |
| 24 | 23 | - **Standard mode**: Traditional readline-based chat interface |
| 25 | 24 | |
| 26 | 25 | 2. **Authentication** (`src/auth/`): WorkOS-based authentication system |
| 27 | - | |
| 28 | 26 | - `ensureAuth.ts`: Handles authentication flow |
| 29 | 27 | - `workos.ts`: WorkOS configuration and token management |
| 30 | 28 | |
| 31 | 29 | 3. **Continue SDK Integration** (`src/continueSDK.ts`): Initializes the Continue SDK client with: |
| 32 | - | |
| 33 | 30 | - API key authentication |
| 34 | 31 | - Assistant configuration (slug-based) |
| 35 | 32 | - Organization support |
| 36 | 33 | |
| 37 | 34 | 4. **Terminal UI** (`src/ui/`): React/Ink-based TUI components |
| 38 | - | |
| 39 | 35 | - `TUIChat.tsx`: Main chat interface component |
| 40 | 36 | - `UserInput.tsx`: Input handling with multi-line support |
| 41 | 37 | - `TextBuffer.ts`: Text display utilities |
| 42 | 38 | |
| 43 | 39 | 5. **Tools System** (`src/tools/`): Built-in development tools including: |
| 44 | - | |
| 45 | 40 | - File operations (read, write, list) |
| 46 | 41 | - Code search functionality |
| 47 | 42 | - Terminal command execution |
modified extensions/cli/spec/config-loading.md +0 −2
| @@ -23,13 +23,11 @@ | ||
| 23 | 23 | **When CLI is invoked, config source is determined in this order:** |
| 24 | 24 | |
| 25 | 25 | 1. **CLI `--config` Flag** (highest priority) |
| 26 | - | |
| 27 | 26 | - File path (starts with `.`, `/`, `~`): Loads local YAML file |
| 28 | 27 | - Assistant slug (`owner/package`): Fetches from Continue platform |
| 29 | 28 | - Overrides any saved preferences |
| 30 | 29 | |
| 31 | 30 | 2. **Saved Config URI** (if no `--config` flag) |
| 32 | - | |
| 33 | 31 | - Retrieved from authentication config |
| 34 | 32 | - Converts `file://` URIs back to file paths |
| 35 | 33 | - Converts `slug://` URIs back to assistant slugs |
modified extensions/cli/spec/onboarding.md +0 −1
| @@ -8,7 +8,6 @@ | ||
| 8 | 8 | |
| 9 | 9 | 1. If the --config flag is provided, load this config |
| 10 | 10 | 2. Otherwise, we will present the user with two options: |
| 11 | - | |
| 12 | 11 | - Log in with Continue: log them in, which will automatically create their assistant and then we can load the first assistant from the first org |
| 13 | 12 | - Enter your Anthropic API key: let them enter the key, and then either create a ~/.continue/config.yaml with the following contents OR update the existing config.yaml to add the model |
| 14 | 13 |
modified extensions/cli/src/commands/serve.ts +1 −2
| @@ -3,7 +3,6 @@ | ||
| 3 | 3 | |
| 4 | 4 | import chalk from "chalk"; |
| 5 | 5 | import type { ChatHistoryItem } from "core/index.js"; |
| 6 | -import { convertFromUnifiedHistory } from "core/util/messageConversion.js"; | |
| 7 | 6 | import express, { Request, Response } from "express"; |
| 8 | 7 | |
| 9 | 8 | import { getAssistantSlug } from "../auth/workos.js"; |
| @@ -148,7 +147,7 @@ | ||
| 148 | 147 | app.get("/state", (_req: Request, res: Response) => { |
| 149 | 148 | state.lastActivity = Date.now(); |
| 150 | 149 | res.json({ |
| 151 | - chatHistory: convertFromUnifiedHistory(state.session.history), // Convert back to legacy format for API | |
| 150 | + session: state.session, // Return session directly instead of converting | |
| 152 | 151 | isProcessing: state.isProcessing, |
| 153 | 152 | messageQueueLength: state.messageQueue.length, |
| 154 | 153 | pendingPermission: state.pendingPermission, |
modified extensions/cli/src/e2e/auth.test.ts +7 −7
| @@ -30,7 +30,7 @@ | ||
| 30 | 30 | authPath, |
| 31 | 31 | JSON.stringify({ |
| 32 | 32 | userId: "test-user", |
| 33 | - userEmail: "test@example.com", | |
| 33 | + userEmail: "test@example.com", | |
| 34 | 34 | accessToken: "test-token", |
| 35 | 35 | refreshToken: "test-refresh-token", |
| 36 | 36 | expiresAt: Date.now() + 3600000, |
| @@ -39,12 +39,12 @@ | ||
| 39 | 39 | ); |
| 40 | 40 | |
| 41 | 41 | // Run logout |
| 42 | - const result = await runCLI(context, { | |
| 42 | + const result = await runCLI(context, { | |
| 43 | 43 | args: ["logout"], |
| 44 | 44 | env: { |
| 45 | 45 | HOME: context.testDir, |
| 46 | - CONTINUE_GLOBAL_DIR: path.join(context.testDir, ".continue") | |
| 47 | - } | |
| 46 | + CONTINUE_GLOBAL_DIR: path.join(context.testDir, ".continue"), | |
| 47 | + }, | |
| 48 | 48 | }); |
| 49 | 49 | |
| 50 | 50 | expect(result.exitCode).toBe(0); |
| @@ -59,12 +59,12 @@ | ||
| 59 | 59 | }); |
| 60 | 60 | |
| 61 | 61 | it("should handle logout when not logged in", async () => { |
| 62 | - const result = await runCLI(context, { | |
| 62 | + const result = await runCLI(context, { | |
| 63 | 63 | args: ["logout"], |
| 64 | 64 | env: { |
| 65 | 65 | HOME: context.testDir, |
| 66 | - CONTINUE_GLOBAL_DIR: path.join(context.testDir, ".continue") | |
| 67 | - } | |
| 66 | + CONTINUE_GLOBAL_DIR: path.join(context.testDir, ".continue"), | |
| 67 | + }, | |
| 68 | 68 | }); |
| 69 | 69 | |
| 70 | 70 | expect(result.exitCode).toBe(0); |
modified extensions/cli/src/e2e/resume-flag.test.ts +7 −7
| @@ -46,16 +46,16 @@ | ||
| 46 | 46 | |
| 47 | 47 | // Verify that a session file was created |
| 48 | 48 | const sessionDir = path.join(context.testDir, ".continue", "sessions"); |
| 49 | - | |
| 49 | + | |
| 50 | 50 | // Ensure session directory exists |
| 51 | 51 | try { |
| 52 | 52 | await fs.mkdir(sessionDir, { recursive: true }); |
| 53 | 53 | } catch (error) { |
| 54 | 54 | // Directory already exists, continue |
| 55 | 55 | } |
| 56 | - | |
| 56 | + | |
| 57 | 57 | const sessionFiles = (await fs.readdir(sessionDir)).filter( |
| 58 | - f => f.endsWith('.json') && f !== 'sessions.json' | |
| 58 | + (f) => f.endsWith(".json") && f !== "sessions.json", | |
| 59 | 59 | ); |
| 60 | 60 | expect(sessionFiles).toHaveLength(1); |
| 61 | 61 | |
| @@ -150,16 +150,16 @@ | ||
| 150 | 150 | |
| 151 | 151 | // Verify the first session was saved correctly |
| 152 | 152 | const sessionDir = path.join(context.testDir, ".continue", "sessions"); |
| 153 | - | |
| 153 | + | |
| 154 | 154 | // Ensure session directory exists |
| 155 | 155 | try { |
| 156 | 156 | await fs.mkdir(sessionDir, { recursive: true }); |
| 157 | 157 | } catch (error) { |
| 158 | 158 | // Directory already exists, continue |
| 159 | 159 | } |
| 160 | - | |
| 160 | + | |
| 161 | 161 | let sessionFiles = (await fs.readdir(sessionDir)).filter( |
| 162 | - f => f.endsWith('.json') && f !== 'sessions.json' | |
| 162 | + (f) => f.endsWith(".json") && f !== "sessions.json", | |
| 163 | 163 | ); |
| 164 | 164 | expect(sessionFiles).toHaveLength(1); |
| 165 | 165 | |
| @@ -193,7 +193,7 @@ | ||
| 193 | 193 | |
| 194 | 194 | // Check that the session file contains both messages |
| 195 | 195 | sessionFiles = (await fs.readdir(sessionDir)).filter( |
| 196 | - f => f.endsWith('.json') && f !== 'sessions.json' | |
| 196 | + (f) => f.endsWith(".json") && f !== "sessions.json", | |
| 197 | 197 | ); |
| 198 | 198 | sessionFile = sessionFiles[0]; |
| 199 | 199 | sessionPath = path.join(sessionDir, sessionFile); |
modified extensions/cli/src/ui/__tests__/mockRemoteServer.ts +9 −1
| @@ -29,9 +29,17 @@ | ||
| 29 | 29 | // GET /state - Return the current state |
| 30 | 30 | this.app.get("/state", (req, res) => { |
| 31 | 31 | res.json({ |
| 32 | - chatHistory: this.messages, | |
| 32 | + session: { | |
| 33 | + history: this.messages.map((msg) => ({ | |
| 34 | + message: msg, | |
| 35 | + contextItems: [], | |
| 36 | + })), | |
| 37 | + id: "mock-session", | |
| 38 | + workspaceDirectory: "/mock/workspace", | |
| 39 | + }, | |
| 33 | 40 | isProcessing: this.isProcessing, |
| 34 | 41 | messageQueueLength: 0, |
| 42 | + pendingPermission: null, | |
| 35 | 43 | }); |
| 36 | 44 | }); |
| 37 | 45 |
modified extensions/cli/src/ui/hooks/useChat.remote.helpers.ts +4 −5
| @@ -1,5 +1,4 @@ | ||
| 1 | 1 | import type { ChatHistoryItem } from "core/index.js"; |
| 2 | -import { convertToUnifiedHistory } from "core/util/messageConversion.js"; | |
| 3 | 2 | |
| 4 | 3 | import { posthogService } from "../../telemetry/posthogService.js"; |
| 5 | 4 | import { logger } from "../../util/logger.js"; |
| @@ -98,11 +97,11 @@ | ||
| 98 | 97 | responseStartTime, |
| 99 | 98 | setResponseStartTime, |
| 100 | 99 | }: UpdateStateFromRemoteOptions): void { |
| 101 | - // Update chat history from server | |
| 102 | - if (state.chatHistory) { | |
| 100 | + // Update chat history from server - now using session.history directly | |
| 101 | + if (state.session && state.session.history) { | |
| 103 | 102 | setChatHistory((prevHistory) => { |
| 104 | - // Convert server's legacy format to unified format | |
| 105 | - const newHistory = convertToUnifiedHistory(state.chatHistory); | |
| 103 | + // Use session history directly - no conversion needed | |
| 104 | + const newHistory = state.session.history as ChatHistoryItem[]; | |
| 106 | 105 | |
| 107 | 106 | // Quick length check first |
| 108 | 107 | if (prevHistory.length !== newHistory.length) { |
modified extensions/cli/src/ui/hooks/useChat.types.ts +15 −8
| @@ -1,6 +1,5 @@ | ||
| 1 | 1 | import { AssistantUnrolled, ModelConfig } from "@continuedev/config-yaml"; |
| 2 | 2 | import { BaseLlmApi } from "@continuedev/openai-adapters"; |
| 3 | -import { ChatCompletionMessageParam } from "openai/resources.mjs"; | |
| 4 | 3 | |
| 5 | 4 | import { ToolCallPreview } from "../../tools/types.js"; |
| 6 | 5 | |
| @@ -37,14 +36,22 @@ | ||
| 37 | 36 | } |
| 38 | 37 | |
| 39 | 38 | export interface RemoteServerState { |
| 40 | - messages: Array<{ | |
| 41 | - role: string; | |
| 42 | - content?: string; | |
| 43 | - tool_calls?: any[]; | |
| 44 | - }>; | |
| 45 | - chatHistory: ChatCompletionMessageParam[]; | |
| 39 | + session: { | |
| 40 | + history: Array<{ | |
| 41 | + message: { | |
| 42 | + role: string; | |
| 43 | + content?: string; | |
| 44 | + tool_calls?: any[]; | |
| 45 | + }; | |
| 46 | + contextItems: any[]; | |
| 47 | + toolCallStates?: any[]; | |
| 48 | + }>; | |
| 49 | + id: string; | |
| 50 | + workspaceDirectory: string; | |
| 51 | + }; | |
| 46 | 52 | isProcessing: boolean; |
| 47 | - activePermissionRequest?: { | |
| 53 | + messageQueueLength: number; | |
| 54 | + pendingPermission?: { | |
| 48 | 55 | toolName: string; |
| 49 | 56 | toolArgs: any; |
| 50 | 57 | requestId: string; |
modified extensions/cli/validate-aliases.mjs +2 −2
| @@ -8,14 +8,14 @@ | ||
| 8 | 8 | let logger; |
| 9 | 9 | try { |
| 10 | 10 | // Try to import the compiled logger |
| 11 | - const loggerModule = await import('./dist/util/logger.js'); | |
| 11 | + const loggerModule = await import("./dist/util/logger.js"); | |
| 12 | 12 | logger = loggerModule.logger; |
| 13 | 13 | } catch { |
| 14 | 14 | // Fallback to console if logger not available (e.g., not built yet) |
| 15 | 15 | logger = { |
| 16 | 16 | info: console.log, |
| 17 | 17 | warn: console.warn, |
| 18 | - error: console.error | |
| 18 | + error: console.error, | |
| 19 | 19 | }; |
| 20 | 20 | } |
| 21 | 21 |