feat(oauth): use asExternalUrl to get the correct callback
This commit is contained in:
parent
b3f4b82600
commit
ada6cdd386
15 changed files with 412 additions and 130 deletions
|
|
@ -60,7 +60,6 @@ Continue is quickly adding features, and we'd love to hear which are the most im
|
|||
an enhancement are:
|
||||
|
||||
- Create an issue
|
||||
|
||||
- First, check whether a similar proposal has already been made
|
||||
- If not, [create an issue](https://github.com/continuedev/continue/issues)
|
||||
- Please describe the enhancement in as much detail as you can, and why it would be useful
|
||||
|
|
@ -146,7 +145,6 @@ npm i -g vite
|
|||
`install-all-dependencies`
|
||||
|
||||
2. Start debugging:
|
||||
|
||||
1. Switch to Run and Debug view
|
||||
2. Select `Launch extension` from drop down
|
||||
3. Hit play button
|
||||
|
|
|
|||
1
binary/package-lock.json
generated
1
binary/package-lock.json
generated
|
|
@ -56,6 +56,7 @@
|
|||
"@continuedev/fetch": "file:../packages/fetch",
|
||||
"@continuedev/llm-info": "file:../packages/llm-info",
|
||||
"@continuedev/openai-adapters": "file:../packages/openai-adapters",
|
||||
"@continuedev/terminal-security": "file:../packages/terminal-security",
|
||||
"@modelcontextprotocol/sdk": "^1.12.0",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.1.1",
|
||||
|
|
|
|||
|
|
@ -692,6 +692,8 @@ declare global {
|
|||
|
||||
openUrl(url: string): Promise<void>;
|
||||
|
||||
getExternalUri?(uri: string): Promise<string>;
|
||||
|
||||
runCommand(command: string): Promise<void>;
|
||||
|
||||
saveFile(filepath: string): Promise<void>;
|
||||
|
|
|
|||
|
|
@ -12,65 +12,121 @@ import { IDE, MCPServerStatus, SSEOptions } from "../..";
|
|||
|
||||
import http from "http";
|
||||
import url from "url";
|
||||
import crypto from "crypto";
|
||||
import { GlobalContext, GlobalContextType } from "../../util/GlobalContext";
|
||||
|
||||
let authenticatingMCPContext = null as {
|
||||
authenticatingServer: MCPServerStatus;
|
||||
ide: IDE;
|
||||
} | null;
|
||||
// Use a Map to support concurrent authentications for different servers
|
||||
const authenticatingContexts = new Map<
|
||||
string,
|
||||
{
|
||||
authenticatingServer: MCPServerStatus;
|
||||
ide: IDE;
|
||||
state?: string;
|
||||
}
|
||||
>();
|
||||
|
||||
// Map state parameters to server URLs for OAuth callback matching
|
||||
const stateToServerUrl = new Map<string, string>();
|
||||
|
||||
const PORT = 3000;
|
||||
|
||||
const server = http.createServer((req, res) => {
|
||||
try {
|
||||
if (!req.url) {
|
||||
throw new Error("no url found");
|
||||
}
|
||||
let serverInstance: http.Server | null = null;
|
||||
|
||||
const parsedUrl = url.parse(req.url, true);
|
||||
if (!parsedUrl.query["code"]) {
|
||||
throw new Error("no query params found");
|
||||
}
|
||||
const createServerForOAuth = () =>
|
||||
http.createServer((req, res) => {
|
||||
try {
|
||||
if (!req.url) {
|
||||
throw new Error("no url found");
|
||||
}
|
||||
|
||||
void handleMCPOauthCode(parsedUrl.query["code"] as string);
|
||||
const parsedUrl = url.parse(req.url, true);
|
||||
if (!parsedUrl.query["code"]) {
|
||||
throw new Error("no query params found");
|
||||
}
|
||||
|
||||
const html = `
|
||||
const code = parsedUrl.query["code"] as string;
|
||||
const state = parsedUrl.query["state"] as string | undefined;
|
||||
|
||||
void handleMCPOauthCode(code, state);
|
||||
|
||||
const html = `
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head><title>Authentication Complete</title></head>
|
||||
<body>Authentication Complete. You can close this page now.</body>
|
||||
</html>`;
|
||||
|
||||
res.writeHead(200, {
|
||||
"Content-Type": "text/html",
|
||||
});
|
||||
res.end(html);
|
||||
} catch (error) {
|
||||
res.writeHead(400, { "Content-Type": "text/plain" });
|
||||
res.end(`Unexpected redirect error: ${(error as Error).message}`);
|
||||
}
|
||||
});
|
||||
res.writeHead(200, {
|
||||
"Content-Type": "text/html",
|
||||
});
|
||||
res.end(html);
|
||||
} catch (error) {
|
||||
res.writeHead(400, { "Content-Type": "text/plain" });
|
||||
res.end(`Unexpected redirect error: ${(error as Error).message}`);
|
||||
}
|
||||
});
|
||||
|
||||
type MCPOauthStorage = GlobalContextType["mcpOauthStorage"][string];
|
||||
type MCPOauthStorageKey = keyof MCPOauthStorage;
|
||||
|
||||
class MCPConnectionOauthProvider implements OAuthClientProvider {
|
||||
private globalContext: GlobalContext;
|
||||
private _redirectUrl: string;
|
||||
private _redirectUrlInitialized: Promise<void>;
|
||||
|
||||
constructor(
|
||||
public oauthServerUrl: string,
|
||||
private ide: IDE,
|
||||
) {
|
||||
this.globalContext = new GlobalContext();
|
||||
// Set default redirect URL immediately for synchronous access
|
||||
this._redirectUrl = `http://localhost:${PORT}`;
|
||||
// Initialize actual redirect URL asynchronously
|
||||
this._redirectUrlInitialized = this._initializeRedirectUrl();
|
||||
}
|
||||
|
||||
private async _initializeRedirectUrl(): Promise<void> {
|
||||
try {
|
||||
// If IDE supports getExternalUri (VS Code extension), use it for dynamic redirect URI
|
||||
if (this.ide.getExternalUri) {
|
||||
const localUri = `http://localhost:${PORT}`;
|
||||
const externalUri = await this.ide.getExternalUri(localUri);
|
||||
this._redirectUrl = externalUri;
|
||||
}
|
||||
// Otherwise keep the default localhost URL
|
||||
} catch (error) {
|
||||
console.error("Failed to initialize redirect URL:", error);
|
||||
// Keep default URL on error
|
||||
}
|
||||
}
|
||||
|
||||
get redirectUrl() {
|
||||
return `http://localhost:${PORT}`; // TODO: this has to be a hub url or should we spin up a server?
|
||||
// Always return a valid URL, even if initialization is pending
|
||||
return this._redirectUrl;
|
||||
}
|
||||
|
||||
getRedirectUrlWithState(state: string): string {
|
||||
// Add state parameter to redirect URL
|
||||
const urlObj = new URL(this._redirectUrl);
|
||||
urlObj.searchParams.set("state", state);
|
||||
return urlObj.toString();
|
||||
}
|
||||
|
||||
async ensureRedirectUrl(): Promise<string> {
|
||||
// Wait for initialization to complete before returning
|
||||
await this._redirectUrlInitialized;
|
||||
return this._redirectUrl;
|
||||
}
|
||||
|
||||
get clientMetadata() {
|
||||
// Generate state parameter if needed
|
||||
const state = authenticatingContexts.get(this.oauthServerUrl)?.state;
|
||||
const redirectUri = state
|
||||
? this.getRedirectUrlWithState(state)
|
||||
: this.redirectUrl;
|
||||
|
||||
return {
|
||||
redirect_uris: [this.redirectUrl],
|
||||
redirect_uris: [redirectUri],
|
||||
token_endpoint_auth_method: "none",
|
||||
grant_types: ["authorization_code", "refresh_token"],
|
||||
response_types: ["code"],
|
||||
|
|
@ -151,14 +207,28 @@ class MCPConnectionOauthProvider implements OAuthClientProvider {
|
|||
}
|
||||
|
||||
async redirectToAuthorization(authorizationUrl: URL) {
|
||||
if (!server.listening) {
|
||||
server.listen(PORT, () => {
|
||||
console.debug(
|
||||
`Server started for MCP Oauth process at http://localhost:${PORT}/`,
|
||||
);
|
||||
});
|
||||
// Ensure redirect URL is initialized before proceeding
|
||||
await this.ensureRedirectUrl();
|
||||
|
||||
// Only create and start local server if using localhost redirect
|
||||
// For web-based VS Code, the redirect will be handled by VS Code's built-in mechanism
|
||||
if (!this.ide.getExternalUri || this._redirectUrl.includes("localhost")) {
|
||||
if (!serverInstance) {
|
||||
serverInstance = createServerForOAuth();
|
||||
}
|
||||
if (!serverInstance.listening) {
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
serverInstance!.listen(PORT, () => {
|
||||
console.debug(
|
||||
`Server started for MCP Oauth process at http://localhost:${PORT}/`,
|
||||
);
|
||||
resolve();
|
||||
});
|
||||
serverInstance!.on("error", reject);
|
||||
});
|
||||
}
|
||||
}
|
||||
void this.ide.openUrl(authorizationUrl.toString());
|
||||
await this.ide.openUrl(authorizationUrl.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -175,49 +245,109 @@ export async function getOauthToken(mcpServerUrl: string, ide: IDE) {
|
|||
export async function performAuth(mcpServer: MCPServerStatus, ide: IDE) {
|
||||
const mcpServerUrl = (mcpServer.transport as SSEOptions).url;
|
||||
const authProvider = new MCPConnectionOauthProvider(mcpServerUrl, ide);
|
||||
authenticatingMCPContext = {
|
||||
// Ensure redirect URL is ready before starting auth
|
||||
await authProvider.ensureRedirectUrl();
|
||||
|
||||
// Generate a unique state parameter for this auth flow
|
||||
const state = crypto.randomUUID();
|
||||
|
||||
// Store context for this specific server with state
|
||||
authenticatingContexts.set(mcpServerUrl, {
|
||||
authenticatingServer: mcpServer,
|
||||
ide,
|
||||
};
|
||||
return await auth(authProvider, {
|
||||
serverUrl: mcpServerUrl,
|
||||
state,
|
||||
});
|
||||
|
||||
// Map state to server URL for callback matching
|
||||
stateToServerUrl.set(state, mcpServerUrl);
|
||||
|
||||
try {
|
||||
return await auth(authProvider, {
|
||||
serverUrl: mcpServerUrl,
|
||||
});
|
||||
} catch (error) {
|
||||
// Clean up on error
|
||||
authenticatingContexts.delete(mcpServerUrl);
|
||||
stateToServerUrl.delete(state);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* handle the authentication code received from the oauth redirect
|
||||
*/
|
||||
async function handleMCPOauthCode(authorizationCode: string) {
|
||||
if (!authenticatingMCPContext) {
|
||||
return;
|
||||
}
|
||||
const { ide, authenticatingServer } = authenticatingMCPContext;
|
||||
const serverUrl = (authenticatingServer.transport as SSEOptions).url;
|
||||
async function handleMCPOauthCode(authorizationCode: string, state?: string) {
|
||||
let serverUrl: string | undefined;
|
||||
let context:
|
||||
| { authenticatingServer: MCPServerStatus; ide: IDE; state?: string }
|
||||
| undefined;
|
||||
|
||||
if (!serverUrl) {
|
||||
void ide.showToast("error", "No MCP server url found for authentication");
|
||||
if (state) {
|
||||
// Use state parameter to find the correct server
|
||||
serverUrl = stateToServerUrl.get(state);
|
||||
if (serverUrl) {
|
||||
context = authenticatingContexts.get(serverUrl);
|
||||
}
|
||||
} else {
|
||||
// Fallback: if no state or single context, use the first one
|
||||
const contexts = Array.from(authenticatingContexts.entries());
|
||||
if (contexts.length === 1) {
|
||||
[serverUrl, context] = contexts[0];
|
||||
}
|
||||
}
|
||||
|
||||
if (!context || !serverUrl) {
|
||||
console.error("No matching authenticating context found for state:", state);
|
||||
return;
|
||||
}
|
||||
if (!authorizationCode) {
|
||||
void ide.showToast(
|
||||
"error",
|
||||
`No MCP authorization code found for ${serverUrl}`,
|
||||
);
|
||||
return;
|
||||
|
||||
const { ide, authenticatingServer } = context;
|
||||
|
||||
try {
|
||||
if (!serverUrl) {
|
||||
throw new Error("No MCP server url found for authentication");
|
||||
}
|
||||
if (!authorizationCode) {
|
||||
throw new Error(`No MCP authorization code found for ${serverUrl}`);
|
||||
}
|
||||
|
||||
// Close the server before processing auth
|
||||
if (serverInstance) {
|
||||
await new Promise<void>((resolve) => {
|
||||
serverInstance!.close(() => {
|
||||
console.debug("Server for MCP Oauth process was closed");
|
||||
serverInstance = null;
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
const authProvider = new MCPConnectionOauthProvider(serverUrl, ide);
|
||||
await authProvider.ensureRedirectUrl();
|
||||
const authStatus = await auth(authProvider, {
|
||||
serverUrl,
|
||||
authorizationCode,
|
||||
});
|
||||
|
||||
if (authStatus === "AUTHORIZED") {
|
||||
const { MCPManagerSingleton } = await import("./MCPManagerSingleton"); // put dynamic import to avoid cyclic imports
|
||||
await MCPManagerSingleton.getInstance().refreshConnection(
|
||||
authenticatingServer.id,
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
const errorMessage = error instanceof Error ? error.message : String(error);
|
||||
console.error("OAuth authorization failed:", errorMessage);
|
||||
if (context?.ide) {
|
||||
await context.ide.showToast("error", `OAuth failed: ${errorMessage}`);
|
||||
}
|
||||
} finally {
|
||||
// Always clean up the context and state mapping
|
||||
authenticatingContexts.delete(serverUrl);
|
||||
if (state) {
|
||||
stateToServerUrl.delete(state);
|
||||
}
|
||||
}
|
||||
server.close(() => console.debug("Server for MCP Oauth process was closed"));
|
||||
const authProvider = new MCPConnectionOauthProvider(serverUrl, ide);
|
||||
const authStatus = await auth(authProvider, {
|
||||
serverUrl,
|
||||
authorizationCode,
|
||||
});
|
||||
if (authStatus === "AUTHORIZED") {
|
||||
const { MCPManagerSingleton } = await import("./MCPManagerSingleton"); // put dynamic import to avoid cyclic imports
|
||||
await MCPManagerSingleton.getInstance().refreshConnection(
|
||||
authenticatingServer.id,
|
||||
);
|
||||
}
|
||||
authenticatingMCPContext = null;
|
||||
}
|
||||
|
||||
export function removeMCPAuth(mcpServer: MCPServerStatus, ide: IDE) {
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ describe("MCPOauth", () => {
|
|||
mockIde = {
|
||||
openUrl: vi.fn(),
|
||||
showToast: vi.fn(),
|
||||
getExternalUri: vi.fn((uri) => Promise.resolve(uri)),
|
||||
};
|
||||
|
||||
mockMcpServer = {
|
||||
|
|
@ -178,4 +179,152 @@ describe("MCPOauth", () => {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("redirect URL handling", () => {
|
||||
test("should use getExternalUri when available for VS Code", async () => {
|
||||
const vscodeIde = {
|
||||
...mockIde,
|
||||
getExternalUri: vi.fn((uri) =>
|
||||
Promise.resolve("https://vscode.dev/redirect"),
|
||||
),
|
||||
};
|
||||
|
||||
const { auth } = await import("@modelcontextprotocol/sdk/client/auth.js");
|
||||
const mockAuth = vi.mocked(auth);
|
||||
mockAuth.mockResolvedValue("AUTHORIZED");
|
||||
|
||||
await performAuth(mockMcpServer, vscodeIde);
|
||||
|
||||
expect(vscodeIde.getExternalUri).toHaveBeenCalledWith(
|
||||
"http://localhost:3000",
|
||||
);
|
||||
});
|
||||
|
||||
test("should fallback to localhost when getExternalUri is not available", async () => {
|
||||
const ideWithoutExternalUri = {
|
||||
openUrl: vi.fn(() => Promise.resolve()),
|
||||
showToast: vi.fn(() => Promise.resolve()),
|
||||
};
|
||||
|
||||
const { auth } = await import("@modelcontextprotocol/sdk/client/auth.js");
|
||||
const mockAuth = vi.mocked(auth);
|
||||
mockAuth.mockResolvedValue("AUTHORIZED");
|
||||
|
||||
await performAuth(mockMcpServer, ideWithoutExternalUri as any);
|
||||
|
||||
// Should still work without getExternalUri
|
||||
expect(mockAuth).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test("should handle getExternalUri errors gracefully", async () => {
|
||||
const errorIde = {
|
||||
...mockIde,
|
||||
getExternalUri: vi.fn(() => Promise.reject(new Error("Network error"))),
|
||||
};
|
||||
|
||||
const { auth } = await import("@modelcontextprotocol/sdk/client/auth.js");
|
||||
const mockAuth = vi.mocked(auth);
|
||||
mockAuth.mockResolvedValue("AUTHORIZED");
|
||||
|
||||
// Should not throw, should fallback to localhost
|
||||
await performAuth(mockMcpServer, errorIde);
|
||||
|
||||
expect(mockAuth).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe("concurrent authentication", () => {
|
||||
test("should handle multiple concurrent auth flows", async () => {
|
||||
const server1 = {
|
||||
id: "server-1",
|
||||
transport: { type: "sse" as const, url: "https://server1.com" },
|
||||
status: "connected" as const,
|
||||
errors: [],
|
||||
isProtectedResource: false,
|
||||
prompts: [],
|
||||
tools: [],
|
||||
resources: [],
|
||||
resourceTemplates: [],
|
||||
name: "server-1",
|
||||
};
|
||||
const server2 = {
|
||||
id: "server-2",
|
||||
transport: { type: "sse" as const, url: "https://server2.com" },
|
||||
status: "connected" as const,
|
||||
errors: [],
|
||||
isProtectedResource: false,
|
||||
prompts: [],
|
||||
tools: [],
|
||||
resources: [],
|
||||
resourceTemplates: [],
|
||||
name: "server-2",
|
||||
};
|
||||
|
||||
const { auth } = await import("@modelcontextprotocol/sdk/client/auth.js");
|
||||
const mockAuth = vi.mocked(auth);
|
||||
mockAuth.mockResolvedValue("AUTHORIZED");
|
||||
|
||||
// Start two auth flows concurrently
|
||||
const [result1, result2] = await Promise.all([
|
||||
performAuth(server1, mockIde),
|
||||
performAuth(server2, mockIde),
|
||||
]);
|
||||
|
||||
expect(result1).toBe("AUTHORIZED");
|
||||
expect(result2).toBe("AUTHORIZED");
|
||||
expect(mockAuth).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
});
|
||||
|
||||
describe("error handling", () => {
|
||||
test("should clean up context on auth failure", async () => {
|
||||
const { auth } = await import("@modelcontextprotocol/sdk/client/auth.js");
|
||||
const mockAuth = vi.mocked(auth);
|
||||
|
||||
// First successful call to set up the context
|
||||
mockAuth.mockResolvedValueOnce("AUTHORIZED");
|
||||
await performAuth(mockMcpServer, mockIde);
|
||||
|
||||
// Reset mock for the failure test
|
||||
mockAuth.mockRejectedValueOnce(new Error("Auth failed"));
|
||||
|
||||
// Second call that should fail and clean up
|
||||
await expect(performAuth(mockMcpServer, mockIde)).rejects.toThrow(
|
||||
"Auth failed",
|
||||
);
|
||||
|
||||
// Verify auth was called twice
|
||||
expect(mockAuth).toHaveBeenCalledTimes(2);
|
||||
|
||||
// The context cleanup happens internally in performAuth's catch block
|
||||
// We can verify it indirectly by checking that a subsequent auth call works
|
||||
mockAuth.mockResolvedValueOnce("AUTHORIZED");
|
||||
const result = await performAuth(mockMcpServer, mockIde);
|
||||
expect(result).toBe("AUTHORIZED");
|
||||
});
|
||||
|
||||
test("should handle missing server URL", async () => {
|
||||
const invalidServer = {
|
||||
id: "invalid",
|
||||
transport: { type: "sse" as const, url: "" },
|
||||
status: "connected" as const,
|
||||
errors: [],
|
||||
isProtectedResource: false,
|
||||
prompts: [],
|
||||
tools: [],
|
||||
resources: [],
|
||||
resourceTemplates: [],
|
||||
name: "invalid",
|
||||
};
|
||||
|
||||
const { auth } = await import("@modelcontextprotocol/sdk/client/auth.js");
|
||||
const mockAuth = vi.mocked(auth);
|
||||
mockAuth.mockResolvedValue("AUTHORIZED");
|
||||
|
||||
await performAuth(invalidServer, mockIde);
|
||||
|
||||
// Should still attempt auth with empty URL
|
||||
expect(mockAuth).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
2
core/index.d.ts
vendored
2
core/index.d.ts
vendored
|
|
@ -819,6 +819,8 @@ export interface IDE {
|
|||
|
||||
openUrl(url: string): Promise<void>;
|
||||
|
||||
getExternalUri?(uri: string): Promise<string>;
|
||||
|
||||
runCommand(command: string, options?: TerminalOptions): Promise<void>;
|
||||
|
||||
saveFile(fileUri: string): Promise<void>;
|
||||
|
|
|
|||
2
core/package-lock.json
generated
2
core/package-lock.json
generated
|
|
@ -250,7 +250,7 @@
|
|||
"@types/node": "^20.11.19",
|
||||
"@types/shell-quote": "^1.7.5",
|
||||
"typescript": "^5.5.2",
|
||||
"vitest": "^1.6.0"
|
||||
"vitest": "^3.2.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@75lb/deep-merge": {
|
||||
|
|
|
|||
|
|
@ -18,30 +18,25 @@ This is a CLI tool for Continue Dev that provides an interactive AI-assisted dev
|
|||
### Core Components
|
||||
|
||||
1. **Entry Point** (`src/index.ts`): Main CLI logic with two modes:
|
||||
|
||||
- **Headless mode**: Non-interactive mode for automation/CI
|
||||
- **TUI mode**: Terminal User Interface using Ink/React
|
||||
- **Standard mode**: Traditional readline-based chat interface
|
||||
|
||||
2. **Authentication** (`src/auth/`): WorkOS-based authentication system
|
||||
|
||||
- `ensureAuth.ts`: Handles authentication flow
|
||||
- `workos.ts`: WorkOS configuration and token management
|
||||
|
||||
3. **Continue SDK Integration** (`src/continueSDK.ts`): Initializes the Continue SDK client with:
|
||||
|
||||
- API key authentication
|
||||
- Assistant configuration (slug-based)
|
||||
- Organization support
|
||||
|
||||
4. **Terminal UI** (`src/ui/`): React/Ink-based TUI components
|
||||
|
||||
- `TUIChat.tsx`: Main chat interface component
|
||||
- `UserInput.tsx`: Input handling with multi-line support
|
||||
- `TextBuffer.ts`: Text display utilities
|
||||
|
||||
5. **Tools System** (`src/tools/`): Built-in development tools including:
|
||||
|
||||
- File operations (read, write, list)
|
||||
- Code search functionality
|
||||
- Terminal command execution
|
||||
|
|
|
|||
|
|
@ -23,13 +23,11 @@ This document specifies the behavior of the CLI's configuration loading system,
|
|||
**When CLI is invoked, config source is determined in this order:**
|
||||
|
||||
1. **CLI `--config` Flag** (highest priority)
|
||||
|
||||
- File path (starts with `.`, `/`, `~`): Loads local YAML file
|
||||
- Assistant slug (`owner/package`): Fetches from Continue platform
|
||||
- Overrides any saved preferences
|
||||
|
||||
2. **Saved Config URI** (if no `--config` flag)
|
||||
|
||||
- Retrieved from authentication config
|
||||
- Converts `file://` URIs back to file paths
|
||||
- Converts `slug://` URIs back to assistant slugs
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ When a user first runs `cn` in interactive mode, they will be taken through "onb
|
|||
|
||||
1. If the --config flag is provided, load this config
|
||||
2. Otherwise, we will present the user with two options:
|
||||
|
||||
- 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
|
||||
- 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
|
||||
|
||||
|
|
|
|||
18
extensions/vscode/package-lock.json
generated
18
extensions/vscode/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"version": "1.3.3",
|
||||
"version": "1.3.5",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "continue",
|
||||
"version": "1.3.3",
|
||||
"version": "1.3.5",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@continuedev/config-types": "file:../../packages/config-types",
|
||||
|
|
@ -14456,14 +14456,14 @@
|
|||
}
|
||||
},
|
||||
"node_modules/vite-node/node_modules/@types/node": {
|
||||
"version": "24.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.0.1.tgz",
|
||||
"integrity": "sha512-MX4Zioh39chHlDJbKmEgydJDS3tspMP/lnQC67G3SWsTnb9NeYVWOjkxpOSy4oMfPs4StcWHwBrvUb4ybfnuaw==",
|
||||
"version": "24.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.3.1.tgz",
|
||||
"integrity": "sha512-3vXmQDXy+woz+gnrTvuvNrPzekOi+Ds0ReMxw0LzBiK3a+1k0kQn9f2NWk+lgD4rJehFUmYy2gMhJ2ZI+7YP9g==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"undici-types": "~7.8.0"
|
||||
"undici-types": "~7.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/vite-node/node_modules/debug": {
|
||||
|
|
@ -14589,9 +14589,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/vite-node/node_modules/undici-types": {
|
||||
"version": "7.8.0",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz",
|
||||
"integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==",
|
||||
"version": "7.10.0",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.10.0.tgz",
|
||||
"integrity": "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true
|
||||
|
|
|
|||
|
|
@ -407,6 +407,12 @@ class VsCodeIde implements IDE {
|
|||
await vscode.env.openExternal(vscode.Uri.parse(url));
|
||||
}
|
||||
|
||||
async getExternalUri(uri: string): Promise<string> {
|
||||
const vsCodeUri = vscode.Uri.parse(uri);
|
||||
const externalUri = await vscode.env.asExternalUri(vsCodeUri);
|
||||
return externalUri.toString(true);
|
||||
}
|
||||
|
||||
async getOpenFiles(): Promise<string[]> {
|
||||
return this.ideUtils.getOpenFiles().map((uri) => uri.toString());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -343,8 +343,8 @@ export class VerticalDiffHandler implements vscode.Disposable {
|
|||
|
||||
// Then, we insert our diff lines
|
||||
await this.editor.edit((editBuilder) => {
|
||||
editBuilder.replace(this.range, replaceContent),
|
||||
{ undoStopAfter: false, undoStopBefore: false };
|
||||
(editBuilder.replace(this.range, replaceContent),
|
||||
{ undoStopAfter: false, undoStopBefore: false });
|
||||
});
|
||||
|
||||
// Lastly, we apply decorations
|
||||
|
|
|
|||
|
|
@ -147,7 +147,9 @@ function ModelCard(props: ModelCardProps) {
|
|||
<h3>{props.title}</h3>
|
||||
</div>
|
||||
|
||||
{props.tags?.map((tag, i) => <ModelProviderTag key={i} tag={tag} />)}
|
||||
{props.tags?.map((tag, i) => (
|
||||
<ModelProviderTag key={i} tag={tag} />
|
||||
))}
|
||||
|
||||
<p>{props.description}</p>
|
||||
|
||||
|
|
|
|||
86
package-lock.json
generated
86
package-lock.json
generated
|
|
@ -15,9 +15,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@eslint-community/eslint-utils": {
|
||||
"version": "4.7.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz",
|
||||
"integrity": "sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw==",
|
||||
"version": "4.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.0.tgz",
|
||||
"integrity": "sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
|
|
@ -741,19 +741,18 @@
|
|||
"license": "MIT"
|
||||
},
|
||||
"node_modules/concurrently": {
|
||||
"version": "9.1.2",
|
||||
"resolved": "https://registry.npmjs.org/concurrently/-/concurrently-9.1.2.tgz",
|
||||
"integrity": "sha512-H9MWcoPsYddwbOGM6difjVwVZHl63nwMEwDJG/L7VGtuaJhb12h2caPG2tVPWs7emuYix252iGfqOyrz1GczTQ==",
|
||||
"version": "9.2.1",
|
||||
"resolved": "https://registry.npmjs.org/concurrently/-/concurrently-9.2.1.tgz",
|
||||
"integrity": "sha512-fsfrO0MxV64Znoy8/l1vVIjjHa29SZyyqPgQBwhiDcaW8wJc2W3XWVOGx4M3oJBnv/zdUZIIp1gDeS98GzP8Ng==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"chalk": "^4.1.2",
|
||||
"lodash": "^4.17.21",
|
||||
"rxjs": "^7.8.1",
|
||||
"shell-quote": "^1.8.1",
|
||||
"supports-color": "^8.1.1",
|
||||
"tree-kill": "^1.2.2",
|
||||
"yargs": "^17.7.2"
|
||||
"chalk": "4.1.2",
|
||||
"rxjs": "7.8.2",
|
||||
"shell-quote": "1.8.3",
|
||||
"supports-color": "8.1.1",
|
||||
"tree-kill": "1.2.2",
|
||||
"yargs": "17.7.2"
|
||||
},
|
||||
"bin": {
|
||||
"conc": "dist/bin/concurrently.js",
|
||||
|
|
@ -1201,9 +1200,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/eslint-module-utils": {
|
||||
"version": "2.12.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.12.0.tgz",
|
||||
"integrity": "sha512-wALZ0HFoytlyh/1+4wuZ9FJCD/leWHQzzrxJ8+rebyReSLk7LApMyd3WJaLVoN+D5+WIdJyDK1c6JnE65V4Zyg==",
|
||||
"version": "2.12.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.12.1.tgz",
|
||||
"integrity": "sha512-L8jSWTze7K2mTg0vos/RuLRS5soomksDPoJLXIslC7c8Wmut3bx7CPpJijDcBZtxQ5lrbUdM+s0OlNbz0DCDNw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
|
@ -1229,30 +1228,30 @@
|
|||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-import": {
|
||||
"version": "2.31.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.31.0.tgz",
|
||||
"integrity": "sha512-ixmkI62Rbc2/w8Vfxyh1jQRTdRTF52VxwRVHl/ykPAmqG+Nb7/kNn+byLP0LxPgI7zWA16Jt82SybJInmMia3A==",
|
||||
"version": "2.32.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.32.0.tgz",
|
||||
"integrity": "sha512-whOE1HFo/qJDyX4SnXzP4N6zOWn79WhnCUY/iDR0mPfQZO8wcYE4JClzI2oZrhBnnMUCBCHZhO6VQyoBU95mZA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@rtsao/scc": "^1.1.0",
|
||||
"array-includes": "^3.1.8",
|
||||
"array.prototype.findlastindex": "^1.2.5",
|
||||
"array.prototype.flat": "^1.3.2",
|
||||
"array.prototype.flatmap": "^1.3.2",
|
||||
"array-includes": "^3.1.9",
|
||||
"array.prototype.findlastindex": "^1.2.6",
|
||||
"array.prototype.flat": "^1.3.3",
|
||||
"array.prototype.flatmap": "^1.3.3",
|
||||
"debug": "^3.2.7",
|
||||
"doctrine": "^2.1.0",
|
||||
"eslint-import-resolver-node": "^0.3.9",
|
||||
"eslint-module-utils": "^2.12.0",
|
||||
"eslint-module-utils": "^2.12.1",
|
||||
"hasown": "^2.0.2",
|
||||
"is-core-module": "^2.15.1",
|
||||
"is-core-module": "^2.16.1",
|
||||
"is-glob": "^4.0.3",
|
||||
"minimatch": "^3.1.2",
|
||||
"object.fromentries": "^2.0.8",
|
||||
"object.groupby": "^1.0.3",
|
||||
"object.values": "^1.2.0",
|
||||
"object.values": "^1.2.1",
|
||||
"semver": "^6.3.1",
|
||||
"string.prototype.trimend": "^1.0.8",
|
||||
"string.prototype.trimend": "^1.0.9",
|
||||
"tsconfig-paths": "^3.15.0"
|
||||
},
|
||||
"engines": {
|
||||
|
|
@ -2538,13 +2537,6 @@
|
|||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/lodash": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
|
||||
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.merge": {
|
||||
"version": "4.6.2",
|
||||
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
|
||||
|
|
@ -2906,9 +2898,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/prettier": {
|
||||
"version": "3.5.3",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.3.tgz",
|
||||
"integrity": "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==",
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.6.2.tgz",
|
||||
"integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
|
|
@ -2922,9 +2914,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/prettier-plugin-tailwindcss": {
|
||||
"version": "0.6.12",
|
||||
"resolved": "https://registry.npmjs.org/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.6.12.tgz",
|
||||
"integrity": "sha512-OuTQKoqNwV7RnxTPwXWzOFXy6Jc4z8oeRZYGuMpRyG3WbuR3jjXdQFK8qFBMBx8UHWdHrddARz2fgUenild6aw==",
|
||||
"version": "0.6.14",
|
||||
"resolved": "https://registry.npmjs.org/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.6.14.tgz",
|
||||
"integrity": "sha512-pi2e/+ZygeIqntN+vC573BcW5Cve8zUB0SSAGxqpB4f96boZF4M3phPVoOFCeypwkpRYdi7+jQ5YJJUwrkGUAg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
|
|
@ -2932,6 +2924,8 @@
|
|||
},
|
||||
"peerDependencies": {
|
||||
"@ianvs/prettier-plugin-sort-imports": "*",
|
||||
"@prettier/plugin-hermes": "*",
|
||||
"@prettier/plugin-oxc": "*",
|
||||
"@prettier/plugin-pug": "*",
|
||||
"@shopify/prettier-plugin-liquid": "*",
|
||||
"@trivago/prettier-plugin-sort-imports": "*",
|
||||
|
|
@ -2953,6 +2947,12 @@
|
|||
"@ianvs/prettier-plugin-sort-imports": {
|
||||
"optional": true
|
||||
},
|
||||
"@prettier/plugin-hermes": {
|
||||
"optional": true
|
||||
},
|
||||
"@prettier/plugin-oxc": {
|
||||
"optional": true
|
||||
},
|
||||
"@prettier/plugin-pug": {
|
||||
"optional": true
|
||||
},
|
||||
|
|
@ -3747,9 +3747,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.8.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz",
|
||||
"integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==",
|
||||
"version": "5.9.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.2.tgz",
|
||||
"integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue