Changesets · Branches · Tags · Compare
| Changeset | 58c9397d0f2dcd3dfdb0feb6979eec41ba44499e9057c4007852fe6b3492baa8 |
|---|---|
| Author | Dallin Romney <dallinromney@gmail.com> · 2025-09-08 21:13 -07:00 |
| Committer | GitHub <noreply@github.com> · 2025-09-08 21:13 -07:00 |
| Parents | d84bb2249dcd, 424fb7319bf7 |
8 files changed
modified core/config/ConfigHandler.ts +13 −19
| @@ -59,27 +59,17 @@ | ||
| 59 | 59 | |
| 60 | 60 | constructor( |
| 61 | 61 | private readonly ide: IDE, |
| 62 | - private ideSettingsPromise: Promise<IdeSettings>, | |
| 63 | 62 | private llmLogger: ILLMLogger, |
| 64 | - sessionInfoPromise: Promise<ControlPlaneSessionInfo | undefined>, | |
| 63 | + initialSessionInfoPromise: Promise<ControlPlaneSessionInfo | undefined>, | |
| 65 | 64 | ) { |
| 66 | - this.ide = ide; | |
| 67 | - this.ideSettingsPromise = ideSettingsPromise; | |
| 68 | - | |
| 69 | 65 | this.controlPlaneClient = new ControlPlaneClient( |
| 70 | - sessionInfoPromise, | |
| 71 | - ideSettingsPromise, | |
| 72 | - this.ide.getIdeInfo(), | |
| 66 | + initialSessionInfoPromise, | |
| 67 | + this.ide, | |
| 73 | 68 | ); |
| 74 | 69 | |
| 75 | 70 | // This profile manager will always be available |
| 76 | 71 | this.globalLocalProfileManager = new ProfileLifecycleManager( |
| 77 | - new LocalProfileLoader( | |
| 78 | - ide, | |
| 79 | - ideSettingsPromise, | |
| 80 | - this.controlPlaneClient, | |
| 81 | - this.llmLogger, | |
| 82 | - ), | |
| 72 | + new LocalProfileLoader(ide, this.controlPlaneClient, this.llmLogger), | |
| 83 | 73 | this.ide, |
| 84 | 74 | ); |
| 85 | 75 | |
| @@ -97,6 +87,7 @@ | ||
| 97 | 87 | } |
| 98 | 88 | |
| 99 | 89 | private workspaceDirs: string[] | null = null; |
| 90 | + | |
| 100 | 91 | async getWorkspaceId() { |
| 101 | 92 | if (!this.workspaceDirs) { |
| 102 | 93 | this.workspaceDirs = await this.ide.getWorkspaceDirs(); |
| @@ -113,6 +104,13 @@ | ||
| 113 | 104 | const signal = this.cascadeAbortController.signal; |
| 114 | 105 | this.workspaceDirs = null; // forces workspace dirs reload |
| 115 | 106 | |
| 107 | + // Always update globalLocalProfileManager before recreating all the loaders | |
| 108 | + // during every cascadeInit so it holds the most recent controlPlaneClient. | |
| 109 | + this.globalLocalProfileManager = new ProfileLifecycleManager( | |
| 110 | + new LocalProfileLoader(this.ide, this.controlPlaneClient, this.llmLogger), | |
| 111 | + this.ide, | |
| 112 | + ); | |
| 113 | + | |
| 116 | 114 | try { |
| 117 | 115 | const { orgs, errors } = await this.getOrgs(); |
| 118 | 116 | |
| @@ -248,7 +246,6 @@ | ||
| 248 | 246 | versionSlug: assistant.configResult.config?.version ?? "latest", |
| 249 | 247 | controlPlaneClient: this.controlPlaneClient, |
| 250 | 248 | ide: this.ide, |
| 251 | - ideSettingsPromise: this.ideSettingsPromise, | |
| 252 | 249 | llmLogger: this.llmLogger, |
| 253 | 250 | rawYaml: assistant.rawYaml, |
| 254 | 251 | orgScopeId: orgScopeId, |
| @@ -369,7 +366,6 @@ | ||
| 369 | 366 | const profiles = [...assistantFiles, ...agentFiles].map((assistant) => { |
| 370 | 367 | return new LocalProfileLoader( |
| 371 | 368 | this.ide, |
| 372 | - this.ideSettingsPromise, | |
| 373 | 369 | this.controlPlaneClient, |
| 374 | 370 | this.llmLogger, |
| 375 | 371 | assistant, |
| @@ -394,7 +390,6 @@ | ||
| 394 | 390 | |
| 395 | 391 | // Ide settings change: refresh session and cascade refresh from the top |
| 396 | 392 | async updateIdeSettings(ideSettings: IdeSettings) { |
| 397 | - this.ideSettingsPromise = Promise.resolve(ideSettings); | |
| 398 | 393 | this.abortCascade(); |
| 399 | 394 | await this.cascadeInit("IDE settings update"); |
| 400 | 395 | } |
| @@ -432,8 +427,7 @@ | ||
| 432 | 427 | if (reload) { |
| 433 | 428 | this.controlPlaneClient = new ControlPlaneClient( |
| 434 | 429 | Promise.resolve(sessionInfo), |
| 435 | - this.ideSettingsPromise, | |
| 436 | - this.ide.getIdeInfo(), | |
| 430 | + this.ide, | |
| 437 | 431 | ); |
| 438 | 432 | this.abortCascade(); |
| 439 | 433 | await this.cascadeInit("Control plane session info update"); |
modified core/config/profile/LocalProfileLoader.ts +1 −3
| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | import { ConfigResult, parseConfigYaml } from "@continuedev/config-yaml"; |
| 2 | 2 | |
| 3 | 3 | import { ControlPlaneClient } from "../../control-plane/client.js"; |
| 4 | -import { ContinueConfig, IDE, IdeSettings, ILLMLogger } from "../../index.js"; | |
| 4 | +import { ContinueConfig, IDE, ILLMLogger } from "../../index.js"; | |
| 5 | 5 | import { ProfileDescription } from "../ProfileLifecycleManager.js"; |
| 6 | 6 | |
| 7 | 7 | import { getPrimaryConfigFilePath } from "../../util/paths.js"; |
| @@ -15,7 +15,6 @@ | ||
| 15 | 15 | |
| 16 | 16 | constructor( |
| 17 | 17 | private ide: IDE, |
| 18 | - private ideSettingsPromise: Promise<IdeSettings>, | |
| 19 | 18 | private controlPlaneClient: ControlPlaneClient, |
| 20 | 19 | private llmLogger: ILLMLogger, |
| 21 | 20 | private overrideAssistantFile?: |
| @@ -57,7 +56,6 @@ | ||
| 57 | 56 | async doLoadConfig(): Promise<ConfigResult<ContinueConfig>> { |
| 58 | 57 | const result = await doLoadConfig({ |
| 59 | 58 | ide: this.ide, |
| 60 | - ideSettingsPromise: this.ideSettingsPromise, | |
| 61 | 59 | controlPlaneClient: this.controlPlaneClient, |
| 62 | 60 | llmLogger: this.llmLogger, |
| 63 | 61 | profileId: this.description.id, |
modified core/config/profile/PlatformProfileLoader.ts +2 −10
| @@ -2,7 +2,7 @@ | ||
| 2 | 2 | |
| 3 | 3 | import { ControlPlaneClient } from "../../control-plane/client.js"; |
| 4 | 4 | import { getControlPlaneEnv } from "../../control-plane/env.js"; |
| 5 | -import { ContinueConfig, IDE, IdeSettings, ILLMLogger } from "../../index.js"; | |
| 5 | +import { ContinueConfig, IDE, ILLMLogger } from "../../index.js"; | |
| 6 | 6 | import { ProfileDescription } from "../ProfileLifecycleManager.js"; |
| 7 | 7 | |
| 8 | 8 | import doLoadConfig from "./doLoadConfig.js"; |
| @@ -28,7 +28,6 @@ | ||
| 28 | 28 | private readonly versionSlug: string; |
| 29 | 29 | private readonly controlPlaneClient: ControlPlaneClient; |
| 30 | 30 | private readonly ide: IDE; |
| 31 | - private ideSettingsPromise: Promise<IdeSettings>; | |
| 32 | 31 | private llmLogger: ILLMLogger; |
| 33 | 32 | readonly description: ProfileDescription; |
| 34 | 33 | private readonly orgScopeId: string | null; |
| @@ -41,7 +40,6 @@ | ||
| 41 | 40 | versionSlug, |
| 42 | 41 | controlPlaneClient, |
| 43 | 42 | ide, |
| 44 | - ideSettingsPromise, | |
| 45 | 43 | llmLogger, |
| 46 | 44 | description, |
| 47 | 45 | orgScopeId, |
| @@ -53,7 +51,6 @@ | ||
| 53 | 51 | versionSlug: string; |
| 54 | 52 | controlPlaneClient: ControlPlaneClient; |
| 55 | 53 | ide: IDE; |
| 56 | - ideSettingsPromise: Promise<IdeSettings>; | |
| 57 | 54 | llmLogger: ILLMLogger; |
| 58 | 55 | description: ProfileDescription; |
| 59 | 56 | orgScopeId: string | null; |
| @@ -65,7 +62,6 @@ | ||
| 65 | 62 | this.versionSlug = versionSlug; |
| 66 | 63 | this.controlPlaneClient = controlPlaneClient; |
| 67 | 64 | this.ide = ide; |
| 68 | - this.ideSettingsPromise = ideSettingsPromise; | |
| 69 | 65 | this.llmLogger = llmLogger; |
| 70 | 66 | this.description = description; |
| 71 | 67 | this.orgScopeId = orgScopeId; |
| @@ -79,7 +75,6 @@ | ||
| 79 | 75 | versionSlug, |
| 80 | 76 | controlPlaneClient, |
| 81 | 77 | ide, |
| 82 | - ideSettingsPromise, | |
| 83 | 78 | llmLogger, |
| 84 | 79 | rawYaml, |
| 85 | 80 | orgScopeId, |
| @@ -91,12 +86,11 @@ | ||
| 91 | 86 | versionSlug: string; |
| 92 | 87 | controlPlaneClient: ControlPlaneClient; |
| 93 | 88 | ide: IDE; |
| 94 | - ideSettingsPromise: Promise<IdeSettings>; | |
| 95 | 89 | llmLogger: ILLMLogger; |
| 96 | 90 | rawYaml: string; |
| 97 | 91 | orgScopeId: string | null; |
| 98 | 92 | }): Promise<PlatformProfileLoader> { |
| 99 | - const controlPlaneEnv = await getControlPlaneEnv(ideSettingsPromise); | |
| 93 | + const controlPlaneEnv = await getControlPlaneEnv(ide.getIdeSettings()); | |
| 100 | 94 | |
| 101 | 95 | const description: ProfileDescription = { |
| 102 | 96 | id: `${ownerSlug}/${packageSlug}`, |
| @@ -121,7 +115,6 @@ | ||
| 121 | 115 | versionSlug, |
| 122 | 116 | controlPlaneClient, |
| 123 | 117 | ide, |
| 124 | - ideSettingsPromise, | |
| 125 | 118 | llmLogger, |
| 126 | 119 | description, |
| 127 | 120 | orgScopeId, |
| @@ -139,7 +132,6 @@ | ||
| 139 | 132 | |
| 140 | 133 | const results = await doLoadConfig({ |
| 141 | 134 | ide: this.ide, |
| 142 | - ideSettingsPromise: this.ideSettingsPromise, | |
| 143 | 135 | controlPlaneClient: this.controlPlaneClient, |
| 144 | 136 | llmLogger: this.llmLogger, |
| 145 | 137 | overrideConfigYaml: this.configResult.config, |
modified core/config/profile/doLoadConfig.ts +2 −5
| @@ -11,7 +11,6 @@ | ||
| 11 | 11 | import { |
| 12 | 12 | ContinueConfig, |
| 13 | 13 | IDE, |
| 14 | - IdeSettings, | |
| 15 | 14 | ILLMLogger, |
| 16 | 15 | RuleWithSource, |
| 17 | 16 | SerializedContinueConfig, |
| @@ -70,7 +69,6 @@ | ||
| 70 | 69 | } |
| 71 | 70 | export default async function doLoadConfig(options: { |
| 72 | 71 | ide: IDE; |
| 73 | - ideSettingsPromise: Promise<IdeSettings>; | |
| 74 | 72 | controlPlaneClient: ControlPlaneClient; |
| 75 | 73 | llmLogger: ILLMLogger; |
| 76 | 74 | overrideConfigJson?: SerializedContinueConfig; |
| @@ -82,7 +80,6 @@ | ||
| 82 | 80 | }): Promise<ConfigResult<ContinueConfig>> { |
| 83 | 81 | const { |
| 84 | 82 | ide, |
| 85 | - ideSettingsPromise, | |
| 86 | 83 | controlPlaneClient, |
| 87 | 84 | llmLogger, |
| 88 | 85 | overrideConfigJson, |
| @@ -95,7 +92,7 @@ | ||
| 95 | 92 | |
| 96 | 93 | const ideInfo = await ide.getIdeInfo(); |
| 97 | 94 | const uniqueId = await ide.getUniqueId(); |
| 98 | - const ideSettings = await ideSettingsPromise; | |
| 95 | + const ideSettings = await ide.getIdeSettings(); | |
| 99 | 96 | const workOsAccessToken = await controlPlaneClient.getAccessToken(); |
| 100 | 97 | const isSignedIn = await controlPlaneClient.isSignedIn(); |
| 101 | 98 | |
| @@ -374,7 +371,7 @@ | ||
| 374 | 371 | const useOnPremProxy = |
| 375 | 372 | controlPlane?.useContinueForTeamsProxy === false && controlPlane?.proxyUrl; |
| 376 | 373 | |
| 377 | - const env = await getControlPlaneEnv(ideSettingsPromise); | |
| 374 | + const env = await getControlPlaneEnv(Promise.resolve(ideSettings)); | |
| 378 | 375 | let controlPlaneProxyUrl: string = useOnPremProxy |
| 379 | 376 | ? controlPlane?.proxyUrl |
| 380 | 377 | : env.DEFAULT_CONTROL_PLANE_PROXY_URL; |
modified core/context/providers/_context-providers.vitest.ts +0 −2
| @@ -28,11 +28,9 @@ | ||
| 28 | 28 | ): Promise<ContextProviderExtras> { |
| 29 | 29 | setUpTestDir(); |
| 30 | 30 | const ide = new FileSystemIde(TEST_DIR); |
| 31 | - const ideSettingsPromise = ide.getIdeSettings(); | |
| 32 | 31 | const llmLogger = new LLMLogger(); |
| 33 | 32 | const configHandler = new ConfigHandler( |
| 34 | 33 | ide, |
| 35 | - ideSettingsPromise, | |
| 36 | 34 | llmLogger, |
| 37 | 35 | Promise.resolve(undefined), |
| 38 | 36 | ); |
modified core/control-plane/client.ts +4 −5
| @@ -11,7 +11,7 @@ | ||
| 11 | 11 | import fetch, { RequestInit, Response } from "node-fetch"; |
| 12 | 12 | |
| 13 | 13 | import { OrganizationDescription } from "../config/ProfileLifecycleManager.js"; |
| 14 | -import { IdeInfo, IdeSettings, ModelDescription } from "../index.js"; | |
| 14 | +import { IDE, ModelDescription } from "../index.js"; | |
| 15 | 15 | import { Logger } from "../util/Logger.js"; |
| 16 | 16 | |
| 17 | 17 | import { ControlPlaneSessionInfo, isOnPremSession } from "./AuthTypes.js"; |
| @@ -44,8 +44,7 @@ | ||
| 44 | 44 | export class ControlPlaneClient { |
| 45 | 45 | constructor( |
| 46 | 46 | readonly sessionInfoPromise: Promise<ControlPlaneSessionInfo | undefined>, |
| 47 | - private readonly ideSettingsPromise: Promise<IdeSettings>, | |
| 48 | - private readonly ideInfoPromise: Promise<IdeInfo>, | |
| 47 | + private readonly ide: IDE, | |
| 49 | 48 | ) {} |
| 50 | 49 | |
| 51 | 50 | async resolveFQSNs( |
| @@ -90,9 +89,9 @@ | ||
| 90 | 89 | throw new Error("No access token"); |
| 91 | 90 | } |
| 92 | 91 | |
| 93 | - const env = await getControlPlaneEnv(this.ideSettingsPromise); | |
| 92 | + const env = await getControlPlaneEnv(this.ide.getIdeSettings()); | |
| 94 | 93 | const url = new URL(path, env.CONTROL_PLANE_URL).toString(); |
| 95 | - const ideInfo = await this.ideInfoPromise; | |
| 94 | + const ideInfo = await this.ide.getIdeInfo(); | |
| 96 | 95 | |
| 97 | 96 | const resp = await fetch(url, { |
| 98 | 97 | ...init, |
modified core/core.ts +2 −3
| @@ -138,7 +138,7 @@ | ||
| 138 | 138 | |
| 139 | 139 | const ideInfoPromise = messenger.request("getIdeInfo", undefined); |
| 140 | 140 | const ideSettingsPromise = messenger.request("getIdeSettings", undefined); |
| 141 | - const sessionInfoPromise = messenger.request( | |
| 141 | + const initialSessionInfoPromise = messenger.request( | |
| 142 | 142 | "getControlPlaneSessionInfo", |
| 143 | 143 | { |
| 144 | 144 | silent: true, |
| @@ -148,9 +148,8 @@ | ||
| 148 | 148 | |
| 149 | 149 | this.configHandler = new ConfigHandler( |
| 150 | 150 | this.ide, |
| 151 | - ideSettingsPromise, | |
| 152 | 151 | this.llmLogger, |
| 153 | - sessionInfoPromise, | |
| 152 | + initialSessionInfoPromise, | |
| 154 | 153 | ); |
| 155 | 154 | |
| 156 | 155 | this.docsService = DocsService.createSingleton( |
modified core/test/fixtures.ts +1 −3
| @@ -12,13 +12,11 @@ | ||
| 12 | 12 | |
| 13 | 13 | export const testControlPlaneClient = new ControlPlaneClient( |
| 14 | 14 | Promise.resolve(undefined), |
| 15 | - ideSettingsPromise, | |
| 16 | - testIde.getIdeInfo(), | |
| 15 | + testIde, | |
| 17 | 16 | ); |
| 18 | 17 | |
| 19 | 18 | export const testConfigHandler = new ConfigHandler( |
| 20 | 19 | testIde, |
| 21 | - ideSettingsPromise, | |
| 22 | 20 | new LLMLogger(), |
| 23 | 21 | Promise.resolve(undefined), |
| 24 | 22 | ); |