|
|
@@ -23,6 +23,7 @@ import {
|
|
|
type TerminalActionPromptType,
|
|
|
type HistoryItem,
|
|
|
type CloudUserInfo,
|
|
|
+ type MarketplaceItem,
|
|
|
requestyDefaultModelId,
|
|
|
openRouterDefaultModelId,
|
|
|
glamaDefaultModelId,
|
|
|
@@ -37,7 +38,7 @@ import { Package } from "../../shared/package"
|
|
|
import { findLast } from "../../shared/array"
|
|
|
import { supportPrompt } from "../../shared/support-prompt"
|
|
|
import { GlobalFileNames } from "../../shared/globalFileNames"
|
|
|
-import { ExtensionMessage } from "../../shared/ExtensionMessage"
|
|
|
+import { ExtensionMessage, MarketplaceInstalledMetadata } from "../../shared/ExtensionMessage"
|
|
|
import { Mode, defaultModeSlug } from "../../shared/modes"
|
|
|
import { experimentDefault, experiments, EXPERIMENT_IDS } from "../../shared/experiments"
|
|
|
import { formatLanguage } from "../../shared/language"
|
|
|
@@ -1254,6 +1255,46 @@ export class ClineProvider
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Fetches marketplace data on demand to avoid blocking main state updates
|
|
|
+ */
|
|
|
+ async fetchMarketplaceData() {
|
|
|
+ try {
|
|
|
+ const [marketplaceItems, marketplaceInstalledMetadata] = await Promise.all([
|
|
|
+ this.marketplaceManager.getCurrentItems().catch((error) => {
|
|
|
+ console.error("Failed to fetch marketplace items:", error)
|
|
|
+ return [] as MarketplaceItem[]
|
|
|
+ }),
|
|
|
+ this.marketplaceManager.getInstallationMetadata().catch((error) => {
|
|
|
+ console.error("Failed to fetch installation metadata:", error)
|
|
|
+ return { project: {}, global: {} } as MarketplaceInstalledMetadata
|
|
|
+ }),
|
|
|
+ ])
|
|
|
+
|
|
|
+ // Send marketplace data separately
|
|
|
+ this.postMessageToWebview({
|
|
|
+ type: "marketplaceData",
|
|
|
+ marketplaceItems: marketplaceItems || [],
|
|
|
+ marketplaceInstalledMetadata: marketplaceInstalledMetadata || { project: {}, global: {} },
|
|
|
+ })
|
|
|
+ } catch (error) {
|
|
|
+ console.error("Failed to fetch marketplace data:", error)
|
|
|
+ // Send empty data on error to prevent UI from hanging
|
|
|
+ this.postMessageToWebview({
|
|
|
+ type: "marketplaceData",
|
|
|
+ marketplaceItems: [],
|
|
|
+ marketplaceInstalledMetadata: { project: {}, global: {} },
|
|
|
+ })
|
|
|
+
|
|
|
+ // Show user-friendly error notification for network issues
|
|
|
+ if (error instanceof Error && error.message.includes("timeout")) {
|
|
|
+ vscode.window.showWarningMessage(
|
|
|
+ "Marketplace data could not be loaded due to network restrictions. Core functionality remains available.",
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Checks if there is a file-based system prompt override for the given mode
|
|
|
*/
|
|
|
@@ -1342,21 +1383,12 @@ export class ClineProvider
|
|
|
const allowedCommands = vscode.workspace.getConfiguration(Package.name).get<string[]>("allowedCommands") || []
|
|
|
const cwd = this.cwd
|
|
|
|
|
|
- // Fetch marketplace data
|
|
|
- let marketplaceItems: any[] = []
|
|
|
- let marketplaceInstalledMetadata: any = { project: {}, global: {} }
|
|
|
-
|
|
|
- marketplaceItems = (await this.marketplaceManager.getCurrentItems()) || []
|
|
|
- marketplaceInstalledMetadata = await this.marketplaceManager.getInstallationMetadata()
|
|
|
-
|
|
|
// Check if there's a system prompt override for the current mode
|
|
|
const currentMode = mode ?? defaultModeSlug
|
|
|
const hasSystemPromptOverride = await this.hasFileBasedSystemPromptOverride(currentMode)
|
|
|
|
|
|
return {
|
|
|
version: this.context.extension?.packageJSON?.version ?? "",
|
|
|
- marketplaceItems,
|
|
|
- marketplaceInstalledMetadata,
|
|
|
apiConfiguration,
|
|
|
customInstructions,
|
|
|
alwaysAllowReadOnly: alwaysAllowReadOnly ?? false,
|