Instead of treating LLM logging as simply writing lines of text sequentially, emit a stream of typed data objects that include rich information about the interaction, such as timestamps, message types, tool calls, etc. These are then collected by a new custom webview in the vscode extension (the "Continue Console"), allowing a user or developer to browse through the different interactions and view them in detail. In progress interactions are now streamed live, instead of being held back to avoid concurrency issues. This webview could be also exposed for IntelliJ or file logging could be reimplemented on top of the new framework.
116 lines
3.3 KiB
TypeScript
116 lines
3.3 KiB
TypeScript
import { AssistantUnrolled, ConfigResult } from "@continuedev/config-yaml";
|
|
|
|
import { ControlPlaneClient } from "../../control-plane/client.js";
|
|
import { getControlPlaneEnv } from "../../control-plane/env.js";
|
|
import { ContinueConfig, IDE, IdeSettings, ILLMLogger } from "../../index.js";
|
|
import { ProfileDescription } from "../ProfileLifecycleManager.js";
|
|
|
|
import doLoadConfig from "./doLoadConfig.js";
|
|
import { IProfileLoader } from "./IProfileLoader.js";
|
|
|
|
/**
|
|
* Metadata about the package that is currently being loaded
|
|
* If this is `undefined`, it's not a config from the platform,
|
|
* could be local for example.
|
|
*/
|
|
export interface PlatformConfigMetadata {
|
|
ownerSlug: string;
|
|
packageSlug: string;
|
|
}
|
|
|
|
export default class PlatformProfileLoader implements IProfileLoader {
|
|
static RELOAD_INTERVAL = 1000 * 5; // 5 seconds
|
|
|
|
private constructor(
|
|
private configResult: ConfigResult<AssistantUnrolled>,
|
|
private readonly ownerSlug: string,
|
|
private readonly packageSlug: string,
|
|
private readonly iconUrl: string,
|
|
private readonly versionSlug: string,
|
|
private readonly controlPlaneClient: ControlPlaneClient,
|
|
private readonly ide: IDE,
|
|
private ideSettingsPromise: Promise<IdeSettings>,
|
|
private llmLogger: ILLMLogger,
|
|
readonly description: ProfileDescription,
|
|
private readonly orgScopeId: string | null,
|
|
) {}
|
|
|
|
static async create(
|
|
configResult: ConfigResult<AssistantUnrolled>,
|
|
ownerSlug: string,
|
|
packageSlug: string,
|
|
iconUrl: string,
|
|
versionSlug: string,
|
|
controlPlaneClient: ControlPlaneClient,
|
|
ide: IDE,
|
|
ideSettingsPromise: Promise<IdeSettings>,
|
|
llmLogger: ILLMLogger,
|
|
rawYaml: string,
|
|
orgScopeId: string | null,
|
|
): Promise<PlatformProfileLoader> {
|
|
const controlPlaneEnv = await getControlPlaneEnv(ideSettingsPromise);
|
|
|
|
const description: ProfileDescription = {
|
|
id: `${ownerSlug}/${packageSlug}`,
|
|
profileType: "platform",
|
|
fullSlug: {
|
|
ownerSlug,
|
|
packageSlug,
|
|
versionSlug,
|
|
},
|
|
title: configResult.config?.name ?? `${ownerSlug}/${packageSlug}`,
|
|
errors: configResult.errors,
|
|
iconUrl: iconUrl,
|
|
uri: `${controlPlaneEnv}${ownerSlug}/${packageSlug}`,
|
|
rawYaml,
|
|
};
|
|
|
|
return new PlatformProfileLoader(
|
|
configResult,
|
|
ownerSlug,
|
|
packageSlug,
|
|
iconUrl,
|
|
versionSlug,
|
|
controlPlaneClient,
|
|
ide,
|
|
ideSettingsPromise,
|
|
llmLogger,
|
|
description,
|
|
orgScopeId,
|
|
);
|
|
}
|
|
|
|
async doLoadConfig(): Promise<ConfigResult<ContinueConfig>> {
|
|
if (this.configResult.errors?.find((e) => e.fatal)) {
|
|
return {
|
|
config: undefined,
|
|
errors: this.configResult.errors,
|
|
configLoadInterrupted: false,
|
|
};
|
|
}
|
|
|
|
const results = await doLoadConfig(
|
|
this.ide,
|
|
this.ideSettingsPromise,
|
|
this.controlPlaneClient,
|
|
this.llmLogger,
|
|
undefined,
|
|
this.configResult.config,
|
|
{
|
|
ownerSlug: this.ownerSlug,
|
|
packageSlug: this.packageSlug,
|
|
},
|
|
this.description.id,
|
|
undefined,
|
|
this.orgScopeId,
|
|
);
|
|
|
|
return {
|
|
config: results.config,
|
|
errors: [...(this.configResult.errors ?? []), ...(results.errors ?? [])],
|
|
configLoadInterrupted: results.configLoadInterrupted,
|
|
};
|
|
}
|
|
|
|
setIsActive(isActive: boolean): void {}
|
|
}
|