From 07ee41c8eb8d88bf32aed9485b942724290fc1dd Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 11 Aug 2025 09:57:09 -0400 Subject: [PATCH] Add debug directory to gitignore and support unauthenticated assistant loading --- .gitignore | 4 +++- package.json | 2 +- src/configLoader.ts | 46 +++++++++++++++++++++++++++++++++++++++------ 3 files changed, 44 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index fb06fcd82..0e8791ad2 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,6 @@ chat.log *notes.md # Local config files (users should not commit their personal configs) -config.yaml \ No newline at end of file +config.yaml + +.continue-debug/ \ No newline at end of file diff --git a/package.json b/package.json index 7699073f1..241801616 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "format": "prettier --write .", "format:check": "prettier --check .", "typecheck": "tsc --noEmit", - "watch:logs": "tail -f ~/.continue/logs/cn.log", + "watch:logs": "touch ~/.continue/logs/cn.log && tail -f ~/.continue/logs/cn.log", "prepare": "npm run build", "semantic-release": "semantic-release", "semantic-release:dry-run": "semantic-release --dry-run" diff --git a/src/configLoader.ts b/src/configLoader.ts index 29b9555f7..48692471e 100644 --- a/src/configLoader.ts +++ b/src/configLoader.ts @@ -4,6 +4,7 @@ import * as path from "path"; import { AssistantUnrolled, + PackageIdentifier, RegistryClient, unrollAssistant, } from "@continuedev/config-yaml"; @@ -276,20 +277,23 @@ async function loadDefaultAgent( } /** - * Loads a local YAML configuration file + * Common function to unroll an assistant with consistent configuration */ -async function loadConfigYaml( - filePath: string, +async function unrollAssistantWithConfig( + packageIdentifier: PackageIdentifier, accessToken: string | null, organizationId: string | null, apiClient: DefaultApiInterface, ): Promise { const unrollResult = await unrollAssistant( - { filePath, uriType: "file" }, + packageIdentifier, new RegistryClient({ accessToken: accessToken ?? undefined, apiBase: env.apiBase, - rootPath: dirname(filePath), + rootPath: + packageIdentifier.uriType === "file" + ? dirname(packageIdentifier.filePath) + : undefined, }), { currentUserSlug: "", @@ -303,7 +307,7 @@ async function loadConfigYaml( const errorDetails = unrollResult.errors; if (!unrollResult.config) { - throw new Error(`Failed to load config file:\n${errorDetails}`); + throw new Error(`Failed to load config:\n${errorDetails}`); } else if (errorDetails?.length) { const warnings = errorDetails?.length > 1 @@ -315,6 +319,23 @@ async function loadConfigYaml( return unrollResult.config; } +/** + * Loads a local YAML configuration file + */ +async function loadConfigYaml( + filePath: string, + accessToken: string | null, + organizationId: string | null, + apiClient: DefaultApiInterface, +): Promise { + return await unrollAssistantWithConfig( + { filePath, uriType: "file" }, + accessToken, + organizationId, + apiClient, + ); +} + /** * Loads an assistant by slug from the Continue platform */ @@ -330,6 +351,19 @@ async function loadAssistantSlug( ); } + // Unroll locally if not logged in + if (!(apiClient as any).configuration.apiKey) { + return await unrollAssistantWithConfig( + { + uriType: "slug", + fullSlug: { ownerSlug, packageSlug, versionSlug: "latest" }, + }, + null, + organizationId, + apiClient, + ); + } + const resp = await apiClient.getAssistant({ ownerSlug, packageSlug,