@lobehub/market-sdk 0.26.0 → 0.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +54 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
1
2
|
import { AgentItem, MarketItemBase, PluginConnectionType, InstallFailureAnalysisQuery, InstallFailureAnalysis, RangeQuery, RangeStats, TopPluginsQuery, TopPlugin, PluginManifest, AdminPluginItem, AdminPluginItemDetail, PluginVersion, PluginVersionLocalization, AdminDeploymentOption, InstallationDetails, SystemDependency, IncompleteI18nPlugin, CategoryListQuery, CategoryItem, PluginItemDetail, InstallReportRequest, InstallReportResponse, CallReportRequest, CallReportResponse, CloudGatewayRequest, CloudGatewayResponse } from '@lobehub/market-types';
|
|
2
3
|
export * from '@lobehub/market-types';
|
|
3
4
|
export { CategoryItem, CategoryListQuery, CategoryListResponse } from '@lobehub/market-types';
|
|
4
|
-
import { z } from 'zod';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Visibility levels for plugins in the marketplace
|
|
@@ -1700,21 +1700,69 @@ declare class BaseSDK {
|
|
|
1700
1700
|
|
|
1701
1701
|
/**
|
|
1702
1702
|
* Admin Agent Item
|
|
1703
|
-
*
|
|
1703
|
+
* Agent item with admin-specific fields for management
|
|
1704
1704
|
*/
|
|
1705
|
-
interface AdminAgentItem
|
|
1706
|
-
/**
|
|
1705
|
+
interface AdminAgentItem {
|
|
1706
|
+
/** Author information */
|
|
1707
|
+
author?: {
|
|
1708
|
+
avatar?: string;
|
|
1709
|
+
name?: string;
|
|
1710
|
+
userName?: string;
|
|
1711
|
+
};
|
|
1712
|
+
/** Avatar URL or emoji */
|
|
1713
|
+
avatar?: string;
|
|
1714
|
+
/** Category name */
|
|
1715
|
+
category?: string;
|
|
1716
|
+
/** Agent configuration */
|
|
1717
|
+
config?: any;
|
|
1718
|
+
/** Creation timestamp */
|
|
1719
|
+
createdAt: string;
|
|
1720
|
+
/** Description */
|
|
1721
|
+
description?: string;
|
|
1722
|
+
/** Agent ID */
|
|
1723
|
+
id: string;
|
|
1724
|
+
/** Agent identifier */
|
|
1725
|
+
identifier: string;
|
|
1726
|
+
/** Install count */
|
|
1727
|
+
installCount?: number;
|
|
1728
|
+
/** Whether featured */
|
|
1729
|
+
isFeatured?: boolean;
|
|
1730
|
+
/** Whether officially maintained */
|
|
1731
|
+
isOfficial: boolean;
|
|
1732
|
+
/** Number of knowledge bases attached */
|
|
1707
1733
|
knowledgeCount?: number;
|
|
1708
|
-
/**
|
|
1734
|
+
/** Display name */
|
|
1735
|
+
name: string;
|
|
1736
|
+
/** Owner ID */
|
|
1709
1737
|
ownerId: number;
|
|
1710
|
-
/** Number of plugins attached
|
|
1738
|
+
/** Number of plugins attached */
|
|
1711
1739
|
pluginCount?: number;
|
|
1740
|
+
/** Provider ID */
|
|
1741
|
+
providerId?: number;
|
|
1712
1742
|
/** Safety check result */
|
|
1713
1743
|
safetyCheck?: string | null;
|
|
1714
1744
|
/** Publication status */
|
|
1715
1745
|
status?: string;
|
|
1746
|
+
/** Tags */
|
|
1747
|
+
tags?: string[];
|
|
1716
1748
|
/** Token usage */
|
|
1717
1749
|
tokenUsage?: number;
|
|
1750
|
+
/** Update timestamp */
|
|
1751
|
+
updatedAt: string;
|
|
1752
|
+
/** URL */
|
|
1753
|
+
url?: string;
|
|
1754
|
+
/** Version name */
|
|
1755
|
+
versionName?: string;
|
|
1756
|
+
/** Version number */
|
|
1757
|
+
versionNumber?: number;
|
|
1758
|
+
/** Version list */
|
|
1759
|
+
versions?: Array<{
|
|
1760
|
+
isLatest: boolean;
|
|
1761
|
+
isValidated: boolean;
|
|
1762
|
+
updatedAt: string;
|
|
1763
|
+
version: string;
|
|
1764
|
+
versionNumber: number;
|
|
1765
|
+
}>;
|
|
1718
1766
|
}
|
|
1719
1767
|
/**
|
|
1720
1768
|
* Admin Agent Item Detail
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/admin/MarketAdmin.ts","../src/core/BaseSDK.ts","../src/admin/services/AgentService.ts","../src/admin/services/AnalysisService.ts","../src/admin/services/PluginService.ts","../src/admin/services/SystemDependencyService.ts","../src/admin/services/SettingsService.ts","../src/admin/services/ReviewService.ts","../src/admin/services/PluginEnvService.ts","../src/market/market-sdk.ts","../src/market/services/AgentService.ts","../src/market/services/AuthService.ts","../src/market/services/DiscoveryService.ts","../src/market/services/FeedbackService.ts","../src/market/services/PluginsService.ts","../src/market/services/UserService.ts","../src/market/services/UserFollowService.ts","../src/market/services/UserFavoriteService.ts","../src/market/services/UserLikeService.ts","../src/types/admin.ts","../src/utils/trustedClient.ts","../src/index.ts"],"sourcesContent":["import debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\nimport { MarketSDKOptions } from '@/types';\n\nimport {\n AgentService,\n AnalysisService,\n PluginEnvService,\n PluginService,\n ReviewService,\n SettingsService,\n SystemDependencyService,\n} from './services';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:admin');\n\n/**\n * LobeHub Market Admin SDK Client\n *\n * Client for accessing administrative functionality of the LobeHub Marketplace.\n * This SDK provides privileged operations for managing agents, plugins, reviews,\n * system settings, and dependencies. It requires admin-level authentication.\n */\nexport class MarketAdmin extends BaseSDK {\n /**\n * Agent management service\n * Provides methods for creating, updating, and managing agents\n */\n readonly agents: AgentService;\n\n /**\n * Market analysis service\n * Provides methods for accessing market analytics and statistics\n */\n readonly analysis: AnalysisService;\n\n /**\n * Plugin environment service\n */\n readonly env: PluginEnvService;\n\n /**\n * Plugin management service\n * Provides methods for creating, updating, and managing plugins\n */\n readonly plugins: PluginService;\n\n /**\n * Review management service\n * Provides methods for moderating and managing user reviews\n */\n readonly reviews: ReviewService;\n\n /**\n * System settings management service\n * Provides methods for configuring marketplace settings\n */\n readonly settings: SettingsService;\n\n /**\n * System dependency management service\n * Provides methods for managing system dependencies required by plugins\n */\n readonly dependencies: SystemDependencyService;\n\n /**\n * Creates a new MarketAdmin instance\n *\n * @param options - Configuration options for the SDK\n */\n constructor(options: MarketSDKOptions = {}) {\n // Use admin-specific API key if available\n const apiKey = options.apiKey || process.env.MARKET_ADMIN_API_KEY;\n\n // Create shared token state object for all services\n const sharedTokenState = {\n accessToken: undefined,\n tokenExpiry: undefined,\n };\n\n super({ ...options, apiKey }, undefined, sharedTokenState);\n log('MarketAdmin instance created');\n\n // Initialize admin services with shared headers and token state for efficient reuse\n this.agents = new AgentService(options, this.headers, sharedTokenState);\n this.analysis = new AnalysisService(options, this.headers, sharedTokenState);\n this.dependencies = new SystemDependencyService(options, this.headers, sharedTokenState);\n this.env = new PluginEnvService(options, this.headers, sharedTokenState);\n this.plugins = new PluginService(options, this.headers, sharedTokenState);\n this.reviews = new ReviewService(options, this.headers, sharedTokenState);\n this.settings = new SettingsService(options, this.headers, sharedTokenState);\n }\n}\n","import debug from 'debug';\nimport { SignJWT } from 'jose';\nimport urlJoin from 'url-join';\n\nimport type { MarketSDKOptions, SharedTokenState } from '../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:core');\n\n/**\n * Base SDK class\n *\n * Provides shared request handling and authentication functionality that is used\n * by both the Market SDK and Admin SDK. This class handles the common concerns:\n * - API endpoint configuration\n * - Authentication header management\n * - HTTP request handling\n * - Error handling\n * - Query string building\n */\nexport class BaseSDK {\n /** Base API URL */\n protected apiBaseUrl: string;\n /** Base URL */\n protected baseUrl: string;\n /** OAuth URL */\n protected oauthBaseUrl: string;\n\n /** Default locale for requests that require localization */\n protected defaultLocale: string;\n\n /** HTTP headers to include with all requests */\n protected headers: Record<string, string>;\n\n private clientId?: string;\n private clientSecret?: string;\n private readonly initialAccessToken?: string;\n private accessToken?: string;\n private tokenExpiry?: number;\n\n // Shared token state for all instances\n private sharedTokenState?: SharedTokenState;\n\n /**\n * Creates a new BaseSDK instance\n *\n * @param options - Configuration options for the SDK\n * @param sharedHeaders - Optional shared headers object for reuse across services\n * @param sharedTokenState - Optional shared token state object for reuse across services\n */\n constructor(\n options: MarketSDKOptions = {},\n sharedHeaders?: Record<string, string>,\n sharedTokenState?: SharedTokenState,\n ) {\n // Set base URL from options, environment variable, or default to production URL\n this.baseUrl = options.baseURL || process.env.MARKET_BASE_URL || 'https://market.lobehub.com';\n this.apiBaseUrl = urlJoin(this.baseUrl, 'api');\n this.oauthBaseUrl = urlJoin(this.baseUrl, 'oauth');\n\n // Set default locale from options or use English as default\n this.defaultLocale = options.defaultLocale || 'en-US';\n\n this.initialAccessToken = options.accessToken;\n this.clientId = options.clientId;\n this.clientSecret = options.clientSecret;\n\n // Share token state across instances if provided\n this.sharedTokenState = sharedTokenState;\n\n // Get API key from options or environment variable\n const apiKey = options.apiKey || process.env.MARKET_API_KEY;\n\n // Either use shared headers or create new headers object\n if (sharedHeaders) {\n this.headers = sharedHeaders;\n log('Using shared headers object');\n } else {\n this.headers = {\n 'Content-Type': 'application/json',\n };\n log('Created new headers object');\n }\n\n // If an apiKey is provided, use it for authorization.\n // This will be overridden by M2M auth if credentials are also provided.\n if (apiKey) {\n this.headers.Authorization = `Bearer ${apiKey}`;\n }\n\n // If an accessToken is provided on init, it takes precedence.\n if (this.initialAccessToken) {\n this.headers.Authorization = `Bearer ${this.initialAccessToken}`;\n }\n\n // If a trusted client token is provided, set the x-lobe-trust-token header\n if (options.trustedClientToken) {\n this.headers['x-lobe-trust-token'] = options.trustedClientToken;\n log('Trusted client token configured');\n }\n\n log('BaseSDK instance created: %O', {\n baseUrl: this.baseUrl,\n defaultLocale: this.defaultLocale,\n hasApiKey: !!apiKey,\n hasInitialAccessToken: !!this.initialAccessToken,\n hasM2MCredentials: !!this.clientId,\n hasSharedTokenState: !!this.sharedTokenState,\n hasTrustedClientToken: !!options.trustedClientToken,\n });\n }\n\n /**\n * Sends an HTTP request to the API and handles the response\n *\n * @param url - Request URL path (will be appended to baseUrl)\n * @param options - Fetch API request options\n * @returns Promise resolving to the parsed JSON response\n * @throws Error if the request fails\n */\n // eslint-disable-next-line no-undef\n protected async request<T>(url: string, options: RequestInit = {}): Promise<T> {\n const requestUrl = urlJoin(this.apiBaseUrl, url);\n log('Sending request: %s', requestUrl);\n\n // If no access token was provided on init, and we have M2M creds, run the auth flow.\n if (!this.initialAccessToken && this.clientId && this.clientSecret) {\n await this.setM2MAuthToken();\n }\n\n const mergedHeaders = {\n ...this.headers,\n ...options.headers,\n };\n log('Request headers: %O', mergedHeaders);\n\n const response = await fetch(requestUrl, {\n ...options,\n headers: mergedHeaders,\n });\n\n if (!response.ok) {\n const errorMsg = `Request failed: ${response.status} ${response.statusText}`;\n try {\n const errorBody = await response.json();\n\n console.error('Request error: %s', JSON.stringify(errorBody));\n\n throw new Error(`${errorMsg} - ${JSON.stringify(errorBody)}`);\n } catch {\n throw new Error(errorMsg);\n }\n }\n\n log('Request successful: %s', url);\n return response.json() as Promise<T>;\n }\n\n /**\n * Builds a URL query string from a parameters object\n *\n * @param params - Object containing query parameters\n * @returns Formatted query string (including leading ? if params exist)\n */\n protected buildQueryString(params: Record<string, any>): string {\n const query = Object.entries(params)\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n .filter(([_, value]) => value !== undefined && value !== null)\n .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`)\n .join('&');\n\n return query ? `?${query}` : '';\n }\n\n /**\n * Sets an authentication token for API requests\n *\n * @param token - API authentication token\n */\n setAuthToken(token: string): void {\n log('Setting authentication token');\n this.accessToken = undefined;\n this.tokenExpiry = undefined;\n\n // Clear shared token state if it exists\n if (this.sharedTokenState) {\n this.sharedTokenState.accessToken = undefined;\n this.sharedTokenState.tokenExpiry = undefined;\n }\n\n this.headers.Authorization = `Bearer ${token}`;\n }\n\n /**\n * Clears the authentication token\n */\n clearAuthToken(): void {\n log('Clearing authentication token');\n this.accessToken = undefined;\n this.tokenExpiry = undefined;\n\n // Clear shared token state if it exists\n if (this.sharedTokenState) {\n this.sharedTokenState.accessToken = undefined;\n this.sharedTokenState.tokenExpiry = undefined;\n }\n\n delete this.headers.Authorization;\n }\n\n /**\n * Fetches an M2M access token.\n * This method is designed for server-side use cases where you need to manage the token lifecycle\n * (e.g., storing it in a cookie).\n *\n * @returns A promise that resolves to an object containing the access token and its expiry time.\n */\n public async fetchM2MToken(): Promise<{ accessToken: string; expiresIn: number }> {\n if (!this.clientId || !this.clientSecret) {\n throw new Error('clientId and clientSecret are required to fetch an M2M token.');\n }\n\n log('Fetching M2M token for server-side use');\n\n const assertion = await this.createClientAssertion();\n const tokenData = await this.exchangeTokenForServer(assertion);\n\n log('M2M token fetched successfully');\n\n return {\n accessToken: tokenData.access_token,\n expiresIn: tokenData.expires_in || 3600,\n };\n }\n\n private async createClientAssertion(): Promise<string> {\n if (!this.clientId || !this.clientSecret) {\n throw new Error('Missing clientId or clientSecret for M2M authentication.');\n }\n\n const secret = new TextEncoder().encode(this.clientSecret);\n\n const tokenEndpoint = `${this.oauthBaseUrl}/token`;\n\n return await new SignJWT({})\n .setProtectedHeader({ alg: 'HS256' })\n .setIssuer(this.clientId)\n .setSubject(this.clientId)\n .setAudience(tokenEndpoint)\n .setJti(crypto.randomUUID())\n .setIssuedAt()\n .setExpirationTime('5m')\n .sign(secret);\n }\n\n private async exchangeToken(clientAssertion: string): Promise<string> {\n const tokenData = await this.exchangeTokenForServer(clientAssertion);\n\n // Calculate token expiry time (current time + expires_in seconds - 60 seconds buffer)\n const expiresInSeconds = tokenData.expires_in || 3600; // Default to 1 hour if not provided\n this.tokenExpiry = Date.now() + (expiresInSeconds - 60) * 1000; // 60 seconds buffer\n\n return tokenData.access_token;\n }\n\n private async exchangeTokenForServer(clientAssertion: string): Promise<any> {\n const tokenEndpoint = urlJoin(this.oauthBaseUrl, 'token');\n log('Exchanging token at endpoint: %s', tokenEndpoint);\n\n const params = new URLSearchParams();\n params.append('grant_type', 'client_credentials');\n params.append(\n 'client_assertion_type',\n 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',\n );\n params.append('client_assertion', clientAssertion);\n\n const response = await fetch(tokenEndpoint, {\n body: params,\n headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n method: 'POST',\n });\n\n const tokenData = await response.json();\n\n if (!response.ok) {\n throw new Error(`Token exchange failed: ${JSON.stringify(tokenData)}`);\n }\n\n return tokenData;\n }\n\n private async setM2MAuthToken(): Promise<void> {\n // Use shared token state if available\n const currentAccessToken = this.sharedTokenState?.accessToken || this.accessToken;\n const currentTokenExpiry = this.sharedTokenState?.tokenExpiry || this.tokenExpiry;\n\n log(\n 'Token check: hasSharedState=%s, hasCurrentToken=%s, tokenExpiry=%d, currentTime=%d',\n !!this.sharedTokenState,\n !!currentAccessToken,\n currentTokenExpiry || 0,\n Date.now(),\n );\n\n // Check if we have a valid token that hasn't expired\n if (currentAccessToken && currentTokenExpiry && Date.now() < currentTokenExpiry) {\n log(\n 'Using existing M2M access token (expires in %d seconds)',\n Math.floor((currentTokenExpiry - Date.now()) / 1000),\n );\n this.headers.Authorization = `Bearer ${currentAccessToken}`;\n return;\n }\n\n // Check if there's already a token request in progress (for shared state)\n if (this.sharedTokenState?.tokenPromise) {\n log('Token request already in progress, waiting for completion...');\n const token = await this.sharedTokenState.tokenPromise;\n this.headers.Authorization = `Bearer ${token}`;\n log('Using token from concurrent request');\n return;\n }\n\n log('Fetching new M2M access token...');\n\n // Create token request promise and store it in shared state\n const tokenPromise = this.fetchNewToken();\n if (this.sharedTokenState) {\n this.sharedTokenState.tokenPromise = tokenPromise;\n }\n\n try {\n const newAccessToken = await tokenPromise;\n\n // Update both local and shared token state\n this.accessToken = newAccessToken;\n this.headers.Authorization = `Bearer ${newAccessToken}`;\n\n if (this.sharedTokenState) {\n this.sharedTokenState.accessToken = newAccessToken;\n this.sharedTokenState.tokenExpiry = this.tokenExpiry;\n // Clear the promise since we're done\n this.sharedTokenState.tokenPromise = undefined;\n log(\n 'Updated shared token state (expires in %d seconds)',\n Math.floor(((this.tokenExpiry || 0) - Date.now()) / 1000),\n );\n }\n\n log('Successfully set new M2M access token');\n } catch (error) {\n // Clear the promise on error\n if (this.sharedTokenState) {\n this.sharedTokenState.tokenPromise = undefined;\n }\n throw error;\n }\n }\n\n private async fetchNewToken(): Promise<string> {\n const assertion = await this.createClientAssertion();\n return await this.exchangeToken(assertion);\n }\n}\n","import type { AgentItem } from '@lobehub/market-types';\nimport debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\nimport type {\n AdminListQueryParams,\n AdminListResponse,\n AgentItemDetail,\n AgentStatus,\n} from '@/types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:admin:agents');\n\n/**\n * Admin Agent Item\n * Extended agent item with admin-specific fields\n */\nexport interface AdminAgentItem extends AgentItem {\n /** Number of knowledge bases attached to the agent */\n knowledgeCount?: number;\n /** Owner ID of the agent */\n ownerId: number;\n /** Number of plugins attached to the agent */\n pluginCount?: number;\n /** Safety check result */\n safetyCheck?: string | null;\n /** Publication status */\n status?: string;\n /** Token usage */\n tokenUsage?: number;\n}\n\n/**\n * Admin Agent Item Detail\n * Extended agent detail with admin-specific fields\n */\nexport interface AdminAgentItemDetail extends AgentItemDetail {\n /** Safety check result */\n safetyCheck?: string | null;\n}\n\n/**\n * Agent list query parameters for admin\n */\nexport interface AdminAgentListQueryParams extends AdminListQueryParams {\n /** Filter by category */\n category?: string;\n /** Filter by official status */\n isOfficial?: 'true' | 'false';\n /** Filter by namespace */\n namespace?: string;\n /** Filter by status */\n status?: 'published' | 'unpublished' | 'archived' | 'deprecated' | 'all';\n /** Filter by visibility */\n visibility?: 'public' | 'private' | 'internal' | 'all';\n}\n\n/**\n * Agent update parameters\n */\nexport interface AgentUpdateParams {\n /** Official homepage or repository URL for the agent */\n homepage?: string | null;\n /** Unique identifier for the agent */\n identifier?: string;\n /** Whether this agent is featured */\n isFeatured?: boolean;\n /** Whether this agent is officially maintained by LobeHub */\n isOfficial?: boolean;\n /** Default name of the agent */\n name?: string;\n /** Safety check result */\n safetyCheck?: string | null;\n /** Publication status */\n status?: 'published' | 'unpublished' | 'archived' | 'deprecated';\n /** Visibility level */\n visibility?: 'public' | 'private' | 'internal';\n}\n\n/**\n * Agent by status response item\n */\nexport interface AgentByStatusItem {\n id: number;\n identifier: string;\n name: string;\n status: AgentStatus;\n updatedAt: string | null;\n}\n\n/**\n * Agent version by status response item\n */\nexport interface AgentVersionByStatusItem {\n agentId: number;\n agentName: string;\n identifier: string;\n status: AgentStatus;\n updatedAt: string | null;\n version: string;\n versionId: number;\n}\n\n/**\n * Agent Management Service\n *\n * Provides administrative functionality for managing agents in the marketplace.\n * This service handles CRUD operations for agents, agent status, and visibility.\n */\nexport class AgentService extends BaseSDK {\n /**\n * Retrieves a list of agents with admin details\n *\n * Supports filtering, pagination, and sorting of results.\n *\n * @param params - Query parameters for filtering and pagination\n * @returns Promise resolving to the agent list response with admin details\n */\n async getAgents(\n params: AdminAgentListQueryParams = {},\n ): Promise<AdminListResponse<AdminAgentItem>> {\n log('Getting agents with params: %O', params);\n\n const queryString = this.buildQueryString(params);\n const url = `/admin/agents${queryString}`;\n\n const result = await this.request<AdminListResponse<AdminAgentItem>>(url);\n\n log('Retrieved %d agents', result.data.length);\n return result;\n }\n\n /**\n * Retrieves agents filtered by status\n *\n * @param status - The status to filter by\n * @returns Promise resolving to agents matching the status\n */\n async getAgentsByStatus(\n status: AgentStatus,\n ): Promise<{ data: AgentByStatusItem[]; total: number }> {\n log('Getting agents by status: %s', status);\n\n const result = await this.request<{ data: AgentByStatusItem[]; total: number }>(\n `/admin/agents/by-status/${status}`,\n );\n\n log('Retrieved %d agents with status %s', result.total, status);\n return result;\n }\n\n /**\n * Retrieves agent versions filtered by status\n *\n * @param status - The status to filter by\n * @returns Promise resolving to agent versions matching the status\n */\n async getAgentVersionsByStatus(\n status: AgentStatus,\n ): Promise<{ data: AgentVersionByStatusItem[]; total: number }> {\n log('Getting agent versions by status: %s', status);\n\n const result = await this.request<{ data: AgentVersionByStatusItem[]; total: number }>(\n `/admin/agents/versions/by-status/${status}`,\n );\n\n log('Retrieved %d agent versions with status %s', result.total, status);\n return result;\n }\n\n /**\n * Retrieves a single agent with full admin details\n *\n * @param id - Agent ID or identifier\n * @param options - Optional query parameters\n * @returns Promise resolving to the detailed agent information\n */\n async getAgent(\n id: number | string,\n options: { locale?: string; version?: string } = {},\n ): Promise<AdminAgentItemDetail> {\n log('Getting agent details (admin): %s', id);\n\n const queryString = this.buildQueryString(options);\n const result = await this.request<AdminAgentItemDetail>(`/admin/agents/${id}${queryString}`);\n\n log('Retrieved agent: %s', result.identifier);\n return result;\n }\n\n /**\n * Updates agent information\n *\n * @param id - Agent ID or identifier\n * @param data - Agent update data containing fields to update\n * @returns Promise resolving to the updated agent\n */\n async updateAgent(id: number | string, data: AgentUpdateParams): Promise<AdminAgentItem> {\n log('Updating agent: %s, data: %O', id, data);\n\n const result = await this.request<AdminAgentItem>(`/admin/agents/${id}`, {\n body: JSON.stringify(data),\n method: 'PUT',\n });\n\n log('Agent updated successfully');\n return result;\n }\n\n /**\n * Updates agent publication status\n *\n * @param id - Agent ID or identifier\n * @param status - New status to set\n * @returns Promise resolving to success response\n */\n async updateAgentStatus(\n id: number | string,\n status: 'published' | 'unpublished' | 'archived' | 'deprecated',\n ): Promise<{ message: string; success: boolean }> {\n log('Updating agent status: %s to %s', id, status);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/agents/${id}/status`,\n {\n body: JSON.stringify({ status }),\n method: 'PATCH',\n },\n );\n\n log('Agent status updated successfully');\n return result;\n }\n\n /**\n * Updates agent visibility\n *\n * @param id - Agent ID or identifier\n * @param visibility - New visibility setting\n * @returns Promise resolving to success response\n */\n async updateAgentVisibility(\n id: number | string,\n visibility: 'public' | 'private' | 'internal',\n ): Promise<{ message: string; success: boolean }> {\n log('Updating agent visibility: %s to %s', id, visibility);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/agents/${id}/visibility`,\n {\n body: JSON.stringify({ visibility }),\n method: 'PATCH',\n },\n );\n\n log('Agent visibility updated successfully');\n return result;\n }\n\n /**\n * Deletes an agent\n *\n * @param id - Agent ID or identifier\n * @returns Promise resolving to success response\n */\n async deleteAgent(id: number | string): Promise<{ message: string; success: boolean }> {\n log('Deleting agent: %s', id);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/agents/${id}`,\n { method: 'DELETE' },\n );\n\n log('Agent deleted successfully');\n return result;\n }\n\n /**\n * Updates status for multiple agents in a single operation\n *\n * @param ids - Array of agent IDs to update\n * @param status - New status to set for all specified agents\n * @returns Promise resolving to success response\n */\n async batchUpdateAgentStatus(\n ids: number[],\n status: 'published' | 'unpublished' | 'archived' | 'deprecated',\n ): Promise<{ message: string; success: boolean; updatedCount: number }> {\n log('Batch updating agent status: %O to %s', ids, status);\n\n const result = await this.request<{ message: string; success: boolean; updatedCount: number }>(\n '/admin/agents/batch/status',\n {\n body: JSON.stringify({ ids, status }),\n method: 'PATCH',\n },\n );\n\n log('Batch agent status update completed: %d updated', result.updatedCount);\n return result;\n }\n\n /**\n * Deletes multiple agents in a single operation\n *\n * @param ids - Array of agent IDs to delete\n * @returns Promise resolving to success response\n */\n async batchDeleteAgents(\n ids: number[],\n ): Promise<{ deletedCount: number; message: string; success: boolean }> {\n log('Batch deleting agents: %O', ids);\n\n const result = await this.request<{ deletedCount: number; message: string; success: boolean }>(\n '/admin/agents/batch/delete',\n {\n body: JSON.stringify({ ids }),\n method: 'DELETE',\n },\n );\n\n log('Batch agent deletion completed: %d deleted', result.deletedCount);\n return result;\n }\n}\n","import {\n InstallFailureAnalysis,\n InstallFailureAnalysisQuery,\n RangeQuery,\n RangeStats,\n TopPlugin,\n TopPluginsQuery,\n} from '@lobehub/market-types';\nimport debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:admin:analysis');\n\n/**\n * Market Overview Statistics Interface\n * Defines the structure for market overview data\n */\nexport interface MarketOverviewStats {\n devices: {\n count: number;\n prevCount: number;\n };\n installs: {\n count: number;\n prevCount: number;\n };\n period: string;\n pluginCalls: {\n count: number;\n prevCount: number;\n };\n plugins: {\n count: number;\n prevCount: number;\n };\n}\n\n/**\n * Period type for analysis queries\n */\nexport type AnalysisPeriod = '1d' | '7d' | '30d' | '1mo' | '3mo' | '1y';\n\n/**\n * Market overview query parameters\n */\nexport interface MarketOverviewQuery {\n /** Analysis period: 1d, 7d, 30d (rolling periods) or 1mo, 3mo, 1y (natural periods) */\n period?: AnalysisPeriod;\n}\n\n/**\n * Standard API response wrapper\n */\ninterface ApiResponse<T> {\n data: T;\n success: boolean;\n}\n\n/**\n * Analysis Management Service\n *\n * Provides administrative functionality for accessing market analysis and statistics.\n * This service handles retrieving various analytics reports including market overview,\n * plugin trends, and installation analytics for administrative dashboards.\n */\nexport class AnalysisService extends BaseSDK {\n /**\n * Retrieves market overview statistics\n *\n * Returns comprehensive market statistics including plugin counts,\n * installation metrics, new plugin trends, and rating averages\n * with comparison to previous periods.\n *\n * @param params - Query parameters for the analysis\n * @returns Promise resolving to market overview statistics\n */\n async getMarketOverview(params: MarketOverviewQuery = {}): Promise<MarketOverviewStats> {\n const { period = '30d' } = params;\n\n log('Getting market overview statistics for period: %s', period);\n\n const searchParams = new URLSearchParams();\n if (period) {\n searchParams.append('period', period);\n }\n\n const url = `/admin/analysis/plugin/overview${searchParams.toString() ? `?${searchParams.toString()}` : ''}`;\n\n const result = await this.request<ApiResponse<MarketOverviewStats>>(url);\n\n log('Market overview statistics retrieved successfully: %s', result.data);\n\n return result.data;\n }\n\n /**\n * Retrieves market overview statistics for 1 day period\n *\n * Convenience method for getting daily market statistics.\n *\n * @returns Promise resolving to market overview statistics for 1 day\n */\n async getDailyOverview(): Promise<MarketOverviewStats> {\n log('Getting daily market overview');\n return this.getMarketOverview({ period: '1d' });\n }\n\n /**\n * Retrieves market overview statistics for 7 days period\n *\n * Convenience method for getting weekly market statistics.\n *\n * @returns Promise resolving to market overview statistics for 7 days\n */\n async getWeeklyOverview(): Promise<MarketOverviewStats> {\n log('Getting weekly market overview');\n return this.getMarketOverview({ period: '7d' });\n }\n\n /**\n * Retrieves market overview statistics for 30 days period\n *\n * Convenience method for getting monthly market statistics.\n *\n * @returns Promise resolving to market overview statistics for 30 days\n */\n async getMonthlyOverview(): Promise<MarketOverviewStats> {\n log('Getting monthly market overview');\n return this.getMarketOverview({ period: '30d' });\n }\n\n /**\n * Retrieves market overview statistics for current natural month\n *\n * Convenience method for getting current month vs previous month statistics.\n *\n * @returns Promise resolving to market overview statistics for current month\n */\n async getThisMonthOverview(): Promise<MarketOverviewStats> {\n log('Getting this month market overview');\n return this.getMarketOverview({ period: '1mo' });\n }\n\n /**\n * Retrieves market overview statistics for current quarter\n *\n * Convenience method for getting current quarter vs previous quarter statistics.\n *\n * @returns Promise resolving to market overview statistics for current quarter\n */\n async getQuarterlyOverview(): Promise<MarketOverviewStats> {\n log('Getting quarterly market overview');\n return this.getMarketOverview({ period: '3mo' });\n }\n\n /**\n * Retrieves market overview statistics for current year\n *\n * Convenience method for getting current year vs previous year statistics.\n *\n * @returns Promise resolving to market overview statistics for current year\n */\n async getYearlyOverview(): Promise<MarketOverviewStats> {\n log('Getting yearly market overview');\n return this.getMarketOverview({ period: '1y' });\n }\n\n /**\n * Retrieves install failure analysis for plugins within a date range\n *\n * Returns detailed analysis of plugin installation failures including failure counts,\n * failure rates, and most common error messages for each plugin with failures.\n *\n * @param params - Query parameters for the failure analysis\n * @returns Promise resolving to install failure analysis data\n */\n async getInstallFailureAnalysis(\n params: InstallFailureAnalysisQuery,\n ): Promise<InstallFailureAnalysis[]> {\n const { range, limit = 15 } = params;\n\n log('Getting install failure analysis for range: %o, limit: %d', range, limit);\n\n const searchParams = new URLSearchParams();\n searchParams.append('range', JSON.stringify(range));\n if (limit !== 15) {\n searchParams.append('limit', limit.toString());\n }\n\n const url = `/admin/analysis/plugin/install-failure?${searchParams.toString()}`;\n\n const result = await this.request<ApiResponse<InstallFailureAnalysis[]>>(url);\n\n log('Install failure analysis retrieved successfully for %d plugins', result.data.length);\n\n return result.data;\n }\n\n /**\n * Calculates growth rate between current and previous values\n *\n * Utility method for calculating percentage growth rates from the statistics.\n *\n * @param current - Current period value\n * @param previous - Previous period value\n * @returns Growth rate as percentage (e.g., 15.5 for 15.5% growth)\n */\n static calculateGrowthRate(current: number, previous: number): number {\n if (previous === 0) return current > 0 ? 100 : 0;\n return Math.round(((current - previous) / previous) * 100 * 10) / 10;\n }\n\n /**\n * Formats market overview statistics with calculated growth rates\n *\n * Utility method that enhances the raw statistics with calculated growth rates\n * for easier consumption in dashboards and reports.\n *\n * @param stats - Raw market overview statistics\n * @returns Enhanced statistics with growth rate calculations\n */\n static formatMarketOverview(stats: MarketOverviewStats) {\n return {\n ...stats,\n growth: {\n devices: this.calculateGrowthRate(stats.devices.count, stats.devices.prevCount),\n installs: this.calculateGrowthRate(stats.installs.count, stats.installs.prevCount),\n pluginCalls: this.calculateGrowthRate(stats.pluginCalls.count, stats.pluginCalls.prevCount),\n plugins: this.calculateGrowthRate(stats.plugins.count, stats.plugins.prevCount),\n },\n };\n }\n\n /**\n * Retrieves installation trend statistics for a specified date range\n *\n * Returns daily installation counts and trends for the specified period\n * with optional comparison to a previous period.\n *\n * @param params - Query parameters including date range and display config\n * @returns Promise resolving to installation trend statistics\n */\n async getRangeInstalls(params: RangeQuery): Promise<RangeStats> {\n const { display, range, prevRange } = params;\n\n log('Getting installation trend statistics for range: %s to %s', range[0], range[1]);\n\n const searchParams = new URLSearchParams();\n searchParams.append('display', display);\n searchParams.append('range', range.join(','));\n if (prevRange) {\n searchParams.append('prevRange', prevRange.join(','));\n }\n\n const url = `/admin/analysis/plugin/range-installs?${searchParams.toString()}`;\n\n const result = await this.request<ApiResponse<RangeStats>>(url);\n\n log(\n 'Installation trend statistics retrieved successfully: %d data points',\n result.data.data.length,\n );\n\n return result.data;\n }\n\n /**\n * Retrieves plugin growth trend statistics for a specified date range\n *\n * Returns daily plugin creation counts and trends for the specified period\n * with optional comparison to a previous period.\n *\n * @param params - Query parameters including date range and display config\n * @returns Promise resolving to plugin growth trend statistics\n */\n async getRangePlugins(params: RangeQuery): Promise<RangeStats> {\n const { display, range, prevRange } = params;\n\n log('Getting plugin growth trend statistics for range: %s to %s', range[0], range[1]);\n\n const searchParams = new URLSearchParams();\n searchParams.append('display', display);\n searchParams.append('range', range.join(','));\n if (prevRange) {\n searchParams.append('prevRange', prevRange.join(','));\n }\n\n const url = `/admin/analysis/plugin/range-plugins?${searchParams.toString()}`;\n\n const result = await this.request<ApiResponse<RangeStats>>(url);\n\n log(\n 'Plugin growth trend statistics retrieved successfully: %d data points',\n result.data.data.length,\n );\n\n return result.data;\n }\n\n /**\n * Retrieves device growth trend statistics for a specified date range\n *\n * Note: This is a system-level statistic that tracks device registrations,\n * not plugin-specific metrics. It provides daily device registration counts\n * and trends for the specified period with optional comparison to a previous period.\n *\n * @param params - Query parameters including date range and display config\n * @returns Promise resolving to device growth trend statistics\n */\n async getRangeDevices(params: RangeQuery): Promise<RangeStats> {\n const { display, range, prevRange } = params;\n\n log('Getting device growth trend statistics for range: %s to %s', range[0], range[1]);\n\n const searchParams = new URLSearchParams();\n searchParams.append('display', display);\n searchParams.append('range', range.join(','));\n if (prevRange) {\n searchParams.append('prevRange', prevRange.join(','));\n }\n\n const url = `/admin/analysis/system/range-devices?${searchParams.toString()}`;\n\n const result = await this.request<ApiResponse<RangeStats>>(url);\n\n log(\n 'Device growth trend statistics retrieved successfully: %d data points',\n result.data.data.length,\n );\n\n return result.data;\n }\n\n /**\n * Retrieves plugin call trend statistics for a specified date range\n *\n * Returns daily plugin call counts and trends for the specified period\n * with optional comparison to a previous period.\n *\n * @param params - Query parameters including date range and display config\n * @returns Promise resolving to plugin call trend statistics\n */\n async getRangeCalls(params: RangeQuery): Promise<RangeStats> {\n const { display, range, prevRange } = params;\n\n log('Getting plugin call trend statistics for range: %s to %s', range[0], range[1]);\n\n const searchParams = new URLSearchParams();\n searchParams.append('display', display);\n searchParams.append('range', range.join(','));\n if (prevRange) {\n searchParams.append('prevRange', prevRange.join(','));\n }\n\n const url = `/admin/analysis/plugin/range-calls?${searchParams.toString()}`;\n\n const result = await this.request<ApiResponse<RangeStats>>(url);\n\n log(\n 'Plugin call trend statistics retrieved successfully: %d data points',\n result.data.data.length,\n );\n\n return result.data;\n }\n\n /**\n * Calculates trend growth rate between current and previous period totals\n *\n * Utility method for calculating percentage growth rates from range statistics.\n *\n * @param stats - Range statistics with sum and prevSum\n * @returns Growth rate as percentage (e.g., 15.5 for 15.5% growth)\n */\n static calculateTrendGrowthRate(stats: RangeStats): number {\n return this.calculateGrowthRate(stats.sum, stats.prevSum);\n }\n\n /**\n * Retrieves top plugins sorted by specified criteria within a date range\n *\n * Returns list of plugins sorted by the specified criteria (installs or calls)\n * in descending order for the specified date range.\n *\n * @param params - Query parameters including date range, sort criteria, and limit\n * @returns Promise resolving to list of top plugins\n */\n async getTopPlugins(params: TopPluginsQuery): Promise<TopPlugin[]> {\n const { range, sortBy = 'installs', limit = 10 } = params;\n\n const searchParams = new URLSearchParams();\n searchParams.append('range', range.join(','));\n searchParams.append('sortBy', sortBy);\n searchParams.append('limit', limit.toString());\n\n const url = `/admin/analysis/plugin/top-plugins?${searchParams.toString()}`;\n\n const result = await this.request<ApiResponse<TopPlugin[]>>(url);\n\n return result.data;\n }\n}\n","import type {\n AdminDeploymentOption,\n AdminPluginItem,\n AdminPluginItemDetail,\n IncompleteI18nPlugin,\n InstallationDetails,\n PluginManifest,\n PluginVersion,\n PluginVersionLocalization,\n SystemDependency,\n} from '@lobehub/market-types';\nimport debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\nimport {\n AdminListQueryParams,\n AdminListResponse,\n PluginI18nImportParams,\n PluginI18nImportResponse,\n PluginUpdateParams,\n PluginVersionCreateParams,\n PluginVersionUpdateParams,\n UnclaimedPluginItem,\n} from '@/types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:admin:plugins');\n\n/**\n * Plugin Management Service\n *\n * Provides administrative functionality for managing plugins in the marketplace.\n * This service handles CRUD operations for plugins, plugin versions, and deployment options.\n */\nexport class PluginService extends BaseSDK {\n /**\n * Batch imports plugin manifests using the dedicated import endpoint\n *\n * This method is intended for use with scripts and bulk import operations.\n *\n * @param manifests - Array of plugin manifests to import\n * @param ownerId - Optional owner ID to associate with the imported plugins\n * @returns Promise resolving to the import results with counts of success, skipped, failed, and a list of failed IDs\n */\n async importPlugins(\n manifests: PluginManifest[],\n ownerId?: number,\n ): Promise<{ failed: number; failedIds: string[]; skipped: number; success: number }> {\n log(`Starting batch plugin import of ${manifests.length} manifests`);\n if (ownerId) {\n log(`Using specified owner ID for import: ${ownerId}`);\n }\n\n const response = await this.request<{\n data: { failed: number; failedIds: string[]; skipped: number; success: number };\n }>('/admin/plugins/import', {\n body: JSON.stringify({\n manifests,\n ownerId,\n }),\n method: 'POST',\n });\n\n log(\n `Plugin import completed: ${response.data.success} succeeded, ${response.data.skipped} skipped, ${response.data.failed} failed`,\n );\n return response.data;\n }\n\n /**\n * Imports plugin internationalization (i18n) data\n *\n * Allows importing localized content for a specific plugin version.\n * This method creates or updates localizations for the specified plugin.\n *\n * @param params - Plugin i18n import parameters containing identifier, version, and localizations\n * @returns Promise resolving to the import results with counts of success and failure\n */\n async importPluginI18n(params: PluginI18nImportParams): Promise<PluginI18nImportResponse> {\n log(\n `Starting i18n import for plugin ${params.identifier} v${params.version} with ${params.localizations.length} localizations`,\n );\n\n const response = await this.request<{\n data: PluginI18nImportResponse;\n message: string;\n }>('/admin/plugins/import/i18n', {\n body: JSON.stringify(params),\n method: 'POST',\n });\n\n log(\n `Plugin i18n import completed: ${response.data.success} succeeded, ${response.data.failed} failed, ${response.data.totalLocalizations} total`,\n );\n return response.data;\n }\n\n /**\n * Retrieves a list of plugins with admin details\n *\n * Supports filtering, pagination, and sorting of results.\n *\n * @param params - Query parameters for filtering and pagination\n * @returns Promise resolving to the plugin list response with admin details\n */\n async getPlugins(params: AdminListQueryParams = {}): Promise<AdminListResponse<AdminPluginItem>> {\n log('Getting plugins with params: %O', params);\n\n const queryString = this.buildQueryString(params);\n const url = `/admin/plugins${queryString}`;\n\n const result = await this.request<AdminListResponse<AdminPluginItem>>(url);\n\n log('Retrieved %d plugins', result.data.length);\n return result;\n }\n\n /**\n * Retrieves all published plugin identifiers\n *\n * Returns a lightweight list of all published plugin identifiers without\n * full plugin metadata. This is useful for admin operations that need to know\n * which plugins are currently published and available to users.\n *\n * @returns Promise resolving to an array containing identifiers array and last modified time\n */\n async getPublishedIdentifiers(): Promise<{ identifier: string; lastModified: string }[]> {\n log('Getting published plugin identifiers (admin)');\n\n const result =\n await this.request<{ identifier: string; lastModified: string }[]>('/v1/plugins/identifiers');\n log('Retrieved %d published plugin identifiers (admin)', result.length);\n return result;\n }\n\n /**\n * Retrieves a single plugin with full admin details\n *\n * @param id - Plugin ID or identifier\n * @returns Promise resolving to the detailed plugin information with version history\n */\n async getPlugin(id: number | string): Promise<AdminPluginItemDetail> {\n log('Getting plugin details (admin): %d', id);\n\n const result = await this.request<AdminPluginItemDetail>(`/admin/plugins/${id}`);\n log('Retrieved plugin with %d versions', result.versions.length);\n return result;\n }\n\n /**\n * Retrieves a plugin by its GitHub repository URL\n *\n * @param githubUrl - The GitHub repository URL to search for\n * @returns Promise resolving to the detailed plugin information with version history\n */\n async getPluginByGithubUrl(githubUrl: string): Promise<AdminPluginItemDetail> {\n log('Getting plugin by GitHub URL: %s', githubUrl);\n\n const queryString = this.buildQueryString({ url: githubUrl });\n const result = await this.request<AdminPluginItemDetail>(\n `/admin/plugins/by-github-url${queryString}`,\n );\n log('Retrieved plugin with %d versions', result.versions.length);\n return result;\n }\n\n /**\n * Updates plugin information\n *\n * @param id - Plugin ID\n * @param data - Plugin update data containing fields to update\n * @returns Promise resolving to the updated plugin\n */\n async updatePlugin(id: number, data: PluginUpdateParams): Promise<AdminPluginItem> {\n log('Updating plugin: %d, data: %O', id, data);\n\n const result = await this.request<AdminPluginItem>(`/admin/plugins/${id}`, {\n body: JSON.stringify(data),\n method: 'PUT',\n });\n log('Plugin updated successfully');\n return result;\n }\n\n /**\n * Updates plugin publication status\n *\n * @param id - Plugin ID\n * @param status - New status to set\n * @returns Promise resolving to success response\n */\n async updatePluginStatus(\n id: number,\n status: 'published' | 'draft' | 'review' | 'rejected',\n ): Promise<{ message: string; success: boolean }> {\n log('Updating plugin status: %d to %s', id, status);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/plugins/${id}/status`,\n {\n body: JSON.stringify({ status }),\n method: 'PATCH',\n },\n );\n log('Plugin status updated successfully');\n return result;\n }\n\n /**\n * Deletes a plugin\n *\n * @param id - Plugin ID\n * @returns Promise resolving to success response\n */\n async deletePlugin(id: number): Promise<{ message: string; success: boolean }> {\n log('Deleting plugin: %d', id);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/plugins/${id}`,\n { method: 'DELETE' },\n );\n log('Plugin deleted successfully');\n return result;\n }\n\n /**\n * Retrieves the version history for a plugin\n *\n * @param pluginId - Plugin ID\n * @returns Promise resolving to an array of plugin versions\n */\n async getPluginVersions(pluginId: number): Promise<PluginVersion[]> {\n log('Getting plugin versions: pluginId=%d', pluginId);\n\n const result = await this.request<PluginVersion[]>(`/admin/plugins/${pluginId}/versions`);\n\n log('Retrieved %d versions', result.length);\n return result;\n }\n\n /**\n * Retrieves a specific plugin version\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @returns Promise resolving to the plugin version details\n */\n async getPluginVersion(pluginId: number, versionId: number): Promise<PluginVersion> {\n log('Getting version details: pluginId=%d, versionId=%d', pluginId, versionId);\n\n const result = await this.request<PluginVersion>(\n `/admin/plugins/${pluginId}/versions/${versionId}`,\n );\n log('Version details retrieved');\n return result;\n }\n\n /**\n * Retrieves all localizations for a specific plugin version\n *\n * @param pluginId - Plugin ID or identifier\n * @param versionId - Version ID\n * @returns Promise resolving to an array of plugin version localizations\n */\n async getPluginLocalizations(\n pluginId: number | string,\n versionId: number,\n ): Promise<PluginVersionLocalization[]> {\n log('Getting localizations: pluginId=%s, versionId=%d', pluginId, versionId);\n\n const result = await this.request<PluginVersionLocalization[]>(\n `/admin/plugins/${pluginId}/versions/${versionId}/localizations`,\n );\n log('Retrieved %d localizations for plugin %s, version %d', result.length, pluginId, versionId);\n return result;\n }\n\n /**\n * Creates a new plugin version with all version-specific data\n *\n * @param pluginId - Plugin ID\n * @param data - Version creation data including all version-specific fields\n * @returns Promise resolving to the created plugin version\n */\n async createPluginVersion(\n pluginId: number,\n data: PluginVersionCreateParams,\n ): Promise<PluginVersion> {\n log('Creating new plugin version: pluginId=%d, data: %O', pluginId, data);\n\n const result = await this.request<PluginVersion>(`/admin/plugins/${pluginId}/versions`, {\n body: JSON.stringify(data),\n method: 'POST',\n });\n log('Plugin version created successfully: version=%s', data.version);\n return result;\n }\n\n /**\n * Creates a new plugin version from a manifest\n * Extracts version data from the manifest for easier creation\n *\n * @param pluginId - Plugin ID\n * @param manifest - Plugin manifest containing all version data\n * @param options - Additional options for version creation\n * @returns Promise resolving to the created plugin version\n */\n async createPluginVersionFromManifest(\n pluginId: number,\n manifest: PluginManifest,\n options: {\n isLatest?: boolean;\n isValidated?: boolean;\n } = {},\n ): Promise<PluginVersion> {\n log(\n 'Creating plugin version from manifest: pluginId=%d, version=%s',\n pluginId,\n manifest.version,\n );\n\n const versionData: PluginVersionCreateParams = {\n author: manifest.author?.name,\n authorUrl: manifest.author?.url,\n capabilitiesPrompts: manifest.capabilities?.prompts,\n capabilitiesResources: manifest.capabilities?.resources,\n capabilitiesTools: manifest.capabilities?.tools,\n category: manifest.category,\n description: manifest.description,\n icon: manifest.icon,\n isLatest: options.isLatest,\n isValidated: options.isValidated,\n name: manifest.name,\n prompts: manifest.prompts,\n readme: manifest.overview?.readme,\n resources: manifest.resources,\n summary: manifest.overview?.summary,\n tags: manifest.tags,\n tools: manifest.tools,\n version: manifest.version,\n };\n\n return this.createPluginVersion(pluginId, versionData);\n }\n\n /**\n * Updates a plugin version with comprehensive version-specific data\n *\n * @param idOrIdentifier - Plugin ID\n * @param versionId - Version ID\n * @param data - Version update data including all version-specific fields\n * @returns Promise resolving to the updated plugin version\n */\n async updatePluginVersion(\n idOrIdentifier: number | string,\n versionId: number,\n data: PluginVersionUpdateParams,\n ): Promise<PluginVersion> {\n log(\n 'Updating plugin version: pluginId=%d, versionId=%d, data: %O',\n idOrIdentifier,\n versionId,\n data,\n );\n\n const result = await this.request<PluginVersion>(\n `/admin/plugins/${idOrIdentifier}/versions/${versionId}`,\n {\n body: JSON.stringify(data),\n method: 'PUT',\n },\n );\n\n log('Plugin version updated successfully');\n return result;\n }\n\n /**\n * Deletes a plugin version\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @returns Promise resolving to success response\n */\n async deletePluginVersion(\n pluginId: number,\n versionId: number,\n ): Promise<{ message: string; success: boolean }> {\n log('Deleting version: pluginId=%d, versionId=%d', pluginId, versionId);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/plugins/${pluginId}/versions/${versionId}`,\n { method: 'DELETE' },\n );\n log('Plugin version deleted successfully');\n return result;\n }\n\n /**\n * Sets a specific version as the latest version of a plugin\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID to set as latest\n * @returns Promise resolving to success response\n */\n async setPluginVersionAsLatest(\n pluginId: number,\n versionId: number,\n ): Promise<{ message: string; success: boolean }> {\n log('Setting version as latest: pluginId=%d, versionId=%d', pluginId, versionId);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/plugins/${pluginId}/versions/${versionId}/latest`,\n { method: 'POST' },\n );\n log('Version set as latest successfully');\n return result;\n }\n\n /**\n * Updates plugin visibility\n *\n * @param id - Plugin ID\n * @param visibility - New visibility setting\n * @returns Promise resolving to success response\n */\n async updatePluginVisibility(\n id: number,\n visibility: 'public' | 'private' | 'unlisted',\n ): Promise<{ message: string; success: boolean }> {\n log('Updating plugin visibility: %d to %s', id, visibility);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/plugins/${id}/visibility`,\n {\n body: JSON.stringify({ visibility }),\n method: 'PATCH',\n },\n );\n log('Plugin visibility updated successfully');\n return result;\n }\n\n /**\n * Updates status for multiple plugins in a single operation\n *\n * @param ids - Array of plugin IDs to update\n * @param status - New status to set for all specified plugins\n * @returns Promise resolving to success response\n */\n async batchUpdatePluginStatus(\n ids: number[],\n status: 'published' | 'draft' | 'review' | 'rejected',\n ): Promise<{ message: string; success: boolean }> {\n log('Batch updating plugin status: %O to %s', ids, status);\n\n const result = await this.request<{ message: string; success: boolean }>(\n '/admin/plugins/batch/status',\n {\n body: JSON.stringify({ ids, status }),\n method: 'PATCH',\n },\n );\n log('Batch plugin status update completed');\n return result;\n }\n\n /**\n * Deletes multiple plugins in a single operation\n *\n * @param ids - Array of plugin IDs to delete\n * @returns Promise resolving to success response\n */\n async batchDeletePlugins(ids: number[]): Promise<{ message: string; success: boolean }> {\n log('Batch deleting plugins: %O', ids);\n\n const result = await this.request<{ message: string; success: boolean }>(\n '/admin/plugins/batch/delete',\n {\n body: JSON.stringify({ ids }),\n method: 'DELETE',\n },\n );\n log('Batch plugin deletion completed');\n return result;\n }\n\n /**\n * Retrieves detailed information about a plugin version including deployment options\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @returns Promise resolving to version details with deployment options\n */\n async getPluginVersionDetails(\n pluginId: number,\n versionId: number,\n ): Promise<PluginVersion & { deploymentOptions: any }> {\n log(\n 'Getting version details with deployment options: pluginId=%d, versionId=%d',\n pluginId,\n versionId,\n );\n\n const result = await this.request<PluginVersion & { deploymentOptions: any }>(\n `/admin/plugins/${pluginId}/versions/${versionId}`,\n );\n log('Version details with deployment options retrieved');\n return result;\n }\n\n /**\n * Retrieves deployment options for a specific plugin version\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @returns Promise resolving to an array of deployment options\n */\n async getDeploymentOptions(\n pluginId: number,\n versionId: number,\n ): Promise<AdminDeploymentOption[]> {\n log('Getting deployment options: pluginId=%d, versionId=%d', pluginId, versionId);\n\n const result = await this.request<AdminDeploymentOption[]>(\n `/admin/plugins/${pluginId}/versions/${versionId}/deployment-options`,\n );\n log('Retrieved %d deployment options', result.length);\n return result;\n }\n\n /**\n * Creates a new deployment option for a plugin version\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @param data - Deployment option configuration data\n * @returns Promise resolving to the created deployment option\n */\n async createDeploymentOption(\n pluginId: number,\n versionId: number,\n data: {\n connectionArgs?: string[];\n connectionCommand?: string;\n connectionType: string;\n description?: string;\n installationDetails?: InstallationDetails;\n installationMethod: string;\n isRecommended?: boolean;\n },\n ): Promise<AdminDeploymentOption> {\n log('Creating deployment option: pluginId=%d, versionId=%d', pluginId, versionId);\n\n const result = await this.request<AdminDeploymentOption>(\n `/admin/plugins/${pluginId}/versions/${versionId}/deployment-options`,\n {\n body: JSON.stringify(data),\n method: 'POST',\n },\n );\n log('Deployment option created successfully');\n return result;\n }\n\n /**\n * Updates an existing deployment option\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @param optionId - Deployment option ID\n * @param data - Updated deployment option configuration\n * @returns Promise resolving to the updated deployment option\n */\n async updateDeploymentOption(\n pluginId: number,\n versionId: number,\n optionId: number,\n data: {\n configSchema?: Record<string, any>;\n connectionArgs?: string[];\n connectionCommand?: string;\n connectionType?: string;\n description?: string;\n installationDetails?: Record<string, any>;\n installationMethod?: string;\n isRecommended?: boolean;\n },\n ): Promise<AdminDeploymentOption> {\n log(\n 'Updating deployment option: pluginId=%d, versionId=%d, optionId=%d',\n pluginId,\n versionId,\n optionId,\n );\n\n const result = await this.request<AdminDeploymentOption>(\n `/admin/plugins/${pluginId}/versions/${versionId}/deployment-options/${optionId}`,\n {\n body: JSON.stringify(data),\n method: 'PUT',\n },\n );\n log('Deployment option updated successfully');\n return result;\n }\n\n /**\n * Deletes a deployment option\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @param optionId - Deployment option ID\n * @returns Promise resolving to success response\n */\n async deleteDeploymentOption(\n pluginId: number,\n versionId: number,\n optionId: number,\n ): Promise<{ message: string; success: boolean }> {\n log(\n 'Deleting deployment option: pluginId=%d, versionId=%d, optionId=%d',\n pluginId,\n versionId,\n optionId,\n );\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/plugins/${pluginId}/versions/${versionId}/deployment-options/${optionId}`,\n { method: 'DELETE' },\n );\n log('Deployment option deleted successfully');\n return result;\n }\n\n /**\n * Retrieves system dependencies for a deployment option\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @param optionId - Deployment option ID\n * @returns Promise resolving to an array of system dependencies\n */\n async getDeploymentOptionSystemDependencies(\n pluginId: number,\n versionId: number,\n optionId: number,\n ): Promise<SystemDependency[]> {\n log(\n 'Getting system dependencies: pluginId=%d, versionId=%d, optionId=%d',\n pluginId,\n versionId,\n optionId,\n );\n\n const result = await this.request<SystemDependency[]>(\n `/admin/plugins/${pluginId}/versions/${versionId}/deployment-options/${optionId}/system-dependencies`,\n );\n log('Retrieved %d system dependencies', result.length);\n return result;\n }\n\n /**\n * Retrieves verified plugins without summary information\n *\n * Returns plugins that are validated but missing summary data.\n *\n * @returns Promise resolving to array of plugins with incomplete summary data\n */\n async getVerifiedPluginsWithoutSummary(): Promise<\n { identifier: string; manifest: PluginManifest; versionId: number }[]\n > {\n log('Getting verified plugins without summary');\n\n const result = await this.request<\n { identifier: string; manifest: PluginManifest; versionId: number }[]\n >('/admin/plugins/verified-without-summary');\n\n log('Retrieved %d verified plugins without summary', result.length);\n return result;\n }\n\n /**\n * Retrieves plugins with incomplete internationalization\n *\n * Returns plugins where pluginVersionLocalizations has only 1 entry.\n *\n * @returns Promise resolving to an array of plugins with incomplete i18n\n */\n async getIncompleteI18nPlugins(): Promise<IncompleteI18nPlugin[]> {\n log('Getting plugins with incomplete i18n');\n\n const result = await this.request<IncompleteI18nPlugin[]>('/admin/plugins/incomplete-i18n');\n log('Retrieved %d plugins with incomplete i18n', result.length);\n return result;\n }\n\n /**\n * Retrieves unclaimed plugins\n *\n * Returns plugins where isClaimed is false, containing only ID and identifier.\n *\n * @returns Promise resolving to an array of unclaimed plugins with basic info\n */\n async getUnclaimedPlugins(): Promise<UnclaimedPluginItem[]> {\n log('Getting unclaimed plugins');\n\n const result = await this.request<UnclaimedPluginItem[]>('/admin/plugins/unclaimed');\n log('Retrieved %d unclaimed plugins', result.length);\n return result;\n }\n}\n","import type { SystemDependency } from '@lobehub/market-types';\nimport debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:admin:dependency');\n\n/**\n * System Dependency Management Service\n *\n * Provides administrative functionality for managing system dependencies\n * required by plugins. This service handles creating, updating, deleting,\n * and listing system dependencies that plugins may require.\n */\nexport class SystemDependencyService extends BaseSDK {\n /**\n * Retrieves all system dependencies\n *\n * Gets a list of all defined system dependencies that plugins may require.\n *\n * @returns Promise resolving to an array of system dependencies\n */\n async getSystemDependencies(): Promise<SystemDependency[]> {\n log('Getting all system dependencies');\n\n const result = await this.request<SystemDependency[]>(`/admin/plugins/dependencies`);\n log('Retrieved %d system dependencies', result.length);\n return result;\n }\n\n /**\n * Retrieves a specific system dependency by ID\n *\n * @param id - System dependency ID\n * @returns Promise resolving to the system dependency details\n */\n async getSystemDependency(id: number): Promise<SystemDependency> {\n log('Getting system dependency details: %d', id);\n\n const result = await this.request<SystemDependency>(`/admin/plugins/dependencies/${id}`);\n log('System dependency details retrieved');\n return result;\n }\n\n /**\n * Creates a new system dependency\n *\n * @param data - System dependency creation data\n * @returns Promise resolving to the created system dependency\n */\n async createSystemDependency(data: Omit<SystemDependency, 'id'>): Promise<SystemDependency> {\n log('Creating system dependency: %O', data);\n\n const result = await this.request<SystemDependency>(`/admin/plugins/dependencies`, {\n body: JSON.stringify(data),\n method: 'POST',\n });\n log('System dependency created successfully');\n return result;\n }\n\n /**\n * Updates an existing system dependency\n *\n * @param id - System dependency ID\n * @param data - System dependency update data\n * @returns Promise resolving to the updated system dependency\n */\n async updateSystemDependency(\n id: number,\n data: Partial<SystemDependency>,\n ): Promise<SystemDependency> {\n log('Updating system dependency: %d, data: %O', id, data);\n\n const result = await this.request<SystemDependency>(`/admin/plugins/dependencies/${id}`, {\n body: JSON.stringify(data),\n method: 'PUT',\n });\n log('System dependency updated successfully');\n return result;\n }\n\n /**\n * Deletes a system dependency\n *\n * @param id - System dependency ID\n * @returns Promise resolving to success response\n */\n async deleteSystemDependency(id: number): Promise<{ message: string; success: boolean }> {\n log('Deleting system dependency: %d', id);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/plugins/dependencies/${id}`,\n { method: 'DELETE' },\n );\n log('System dependency deleted successfully');\n return result;\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:admin:settings');\n\n/**\n * Settings entity representing a system setting\n */\nexport interface Settings {\n /** Creation timestamp (ISO 8601 format) */\n createdAt: string;\n /** Optional description of the setting's purpose */\n description?: string;\n /** Unique identifier for the setting */\n id: number;\n /** Setting key name used for retrieving the setting */\n key: string;\n /** Last update timestamp (ISO 8601 format) */\n updatedAt: string;\n /** Setting value (stored as string) */\n value: string;\n}\n\n/**\n * Configuration for enabled resource types\n */\nexport interface EnabledResources {\n /** Whether agent resources are enabled */\n agents: boolean;\n /** Whether plugin resources are enabled */\n plugins: boolean;\n}\n\n/**\n * Authentication configuration\n */\nexport interface AuthenticationConfig {\n /** Whether authentication is required */\n enabled: boolean;\n /** Supported authentication schemes */\n schemes: string[];\n}\n\n/**\n * Documentation URL configuration\n */\nexport interface DocumentationConfig {\n /** URL to API documentation */\n apiUrl?: string;\n /** URL to privacy policy */\n policyUrl?: string;\n /** URL to terms of service */\n termsOfServiceUrl?: string;\n}\n\n/**\n * Map of all system settings with typed properties\n */\nexport interface SettingsMap {\n /** Additional settings (dynamically added) */\n [key: string]: any;\n /** Authentication configuration */\n authentication: AuthenticationConfig;\n /** Base URL for the marketplace */\n baseURL: string;\n /** Documentation URL configuration */\n documentation: DocumentationConfig;\n /** Configuration for enabled resource types */\n enabledResources: EnabledResources;\n /** Supported locales */\n locales: string[];\n}\n\n/**\n * Parameters for creating a new setting\n */\nexport interface CreateSettingsParams {\n /** Optional description of the setting's purpose */\n description?: string;\n /** Setting key name */\n key: string;\n /** Setting value (will be stored as string) */\n value: string;\n}\n\n/**\n * Parameters for updating an existing setting\n */\nexport interface UpdateSettingsParams {\n /** Optional new description */\n description?: string;\n /** New setting value */\n value: string;\n}\n\n/**\n * Settings Management Service\n *\n * Provides administrative functionality for managing system settings.\n * This service handles getting, creating, updating, and deleting\n * configuration settings for the marketplace.\n */\nexport class SettingsService extends BaseSDK {\n /**\n * Retrieves all system settings\n *\n * Returns a consolidated map of all settings with typed values\n * for known setting keys.\n *\n * @returns Promise resolving to the settings map\n */\n async getSettings(): Promise<SettingsMap> {\n return await this.request<SettingsMap>('/admin/settings');\n }\n\n /**\n * Retrieves a specific setting by key\n *\n * @param key - Setting key name\n * @returns Promise resolving to the setting details\n */\n async getSettingByKey(key: string): Promise<{ data: Settings }> {\n log('Getting setting: %s', key);\n\n const result = await this.request<{ data: Settings }>(`/admin/settings/${key}`);\n log('Setting retrieved');\n return result;\n }\n\n /**\n * Creates a new system setting\n *\n * @param data - Setting creation parameters\n * @returns Promise resolving to the created setting\n */\n async createSetting(data: CreateSettingsParams): Promise<{ data: Settings }> {\n log('Creating setting: %O', data);\n\n const result = await this.request<{ data: Settings }>('/admin/settings', {\n body: JSON.stringify(data),\n method: 'POST',\n });\n log('Setting created successfully');\n return result;\n }\n\n /**\n * Updates an existing setting\n *\n * @param key - Setting key name\n * @param data - Setting update parameters\n * @returns Promise resolving to the updated setting\n */\n async updateSetting(key: string, data: UpdateSettingsParams): Promise<{ data: Settings }> {\n log('Updating setting: %s, data: %O', key, data);\n\n const result = await this.request<{ data: Settings }>(`/admin/settings/${key}`, {\n body: JSON.stringify(data),\n method: 'PUT',\n });\n log('Setting updated successfully');\n return result;\n }\n\n /**\n * Deletes a setting\n *\n * @param key - Setting key name\n * @returns Promise resolving to success message\n */\n async deleteSetting(key: string): Promise<{ message: string }> {\n log('Deleting setting: %s', key);\n\n const result = await this.request<{ message: string }>(`/admin/settings/${key}`, {\n method: 'DELETE',\n });\n log('Setting deleted successfully');\n return result;\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\nimport type { AdminListQueryParams, AdminListResponse, ReviewStatus } from '@/types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:admin:review');\n\n/**\n * Review entity representing a plugin review\n */\nexport interface Review {\n /** Optional comment providing feedback */\n comment?: string;\n /** Creation timestamp (ISO 8601 format) */\n createdAt: string;\n /** Unique identifier for the review */\n id: number;\n /** ID of the plugin being reviewed */\n pluginId: number;\n /** ID of the reviewer (if available) */\n reviewerId?: number;\n /** Current status of the review */\n status: ReviewStatus;\n /** Last update timestamp (ISO 8601 format) */\n updatedAt: string;\n}\n\n/**\n * Extended review information with related entities\n */\nexport interface PluginReviewWithRelations extends Review {\n /** Related plugin information */\n plugin?: any;\n /** Related version information */\n version?: any;\n}\n\n/**\n * Parameters for updating a review\n */\nexport interface UpdateReviewParams {\n /** Optional comment or feedback */\n comment?: string;\n /** New status to set for the review */\n status: ReviewStatus;\n}\n\n/**\n * Review Management Service\n *\n * Provides administrative functionality for managing plugin reviews.\n * This service handles listing, fetching, and updating review statuses\n * for plugins in the marketplace.\n */\nexport class ReviewService extends BaseSDK {\n /**\n * Retrieves a list of reviews with filtering options\n *\n * @param params - Query parameters for filtering and pagination\n * @returns Promise resolving to the review list response\n */\n async getReviews(\n params: AdminListQueryParams = {},\n ): Promise<AdminListResponse<PluginReviewWithRelations>> {\n log('Getting reviews with params: %O', params);\n\n const queryString = this.buildQueryString(params);\n const url = `/admin/reviews${queryString ? `?${queryString}` : ''}`;\n\n const result = await this.request<AdminListResponse<PluginReviewWithRelations>>(url);\n\n log('Retrieved %d reviews', result.data.length);\n return result;\n }\n\n /**\n * Retrieves a specific review by ID\n *\n * @param id - Review ID\n * @returns Promise resolving to the review details\n */\n async getReviewById(id: number): Promise<Review> {\n log('Getting review details: %d', id);\n\n const result = await this.request<Review>(`/admin/reviews/${id}`);\n log('Review details retrieved');\n return result;\n }\n\n /**\n * Updates a review's status and comment\n *\n * @param id - Review ID\n * @param data - Update parameters containing new status and optional comment\n * @returns Promise resolving to the updated review\n */\n async updateReview(id: number, data: UpdateReviewParams): Promise<Review> {\n log('Updating review: %d, data: %O', id, data);\n\n const result = await this.request<Review>(`/admin/reviews/${id}`, {\n body: JSON.stringify(data),\n method: 'PUT',\n });\n log('Review updated successfully');\n return result;\n }\n\n /**\n * Retrieves the review history for a specific plugin\n *\n * @param pluginId - Plugin ID\n * @returns Promise resolving to an array of reviews for the plugin\n */\n async getPluginReviews(pluginId: number): Promise<{ data: Review[] }> {\n log('Getting plugin reviews: pluginId=%d', pluginId);\n\n const result = await this.request<{ data: Review[] }>(`/admin/reviews/plugin/${pluginId}`);\n log('Retrieved %d reviews for plugin', result.data.length);\n return result;\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\nimport type { AdminListResponse } from '@/types/admin';\n\ntype AdminPluginEnvListQuery = any;\ntype PluginEnv = any;\n\nconst log = debug('lobe-market-sdk:admin:plugin-env');\n\nexport interface AdminPluginEnvCreateParams {\n description?: string;\n identifier: string;\n key: string;\n value: string;\n}\n\nexport interface AdminPluginEnvUpdateParams {\n description?: string;\n value?: string;\n}\n\n/**\n * Plugin Environment Variable Management Service\n *\n * Provides administrative functionality for managing plugin environment variables.\n */\nexport class PluginEnvService extends BaseSDK {\n /**\n * Retrieves a paginated list of plugin environment variables\n *\n * @param params - Query parameters for filtering and pagination\n * @returns Promise resolving to the env list response\n */\n async getPluginEnvs(params: AdminPluginEnvListQuery = {}): Promise<AdminListResponse<PluginEnv>> {\n log('Getting plugin envs with params: %O', params);\n const queryString = this.buildQueryString(params);\n const url = `/admin/plugins/env${queryString}`;\n const result = await this.request<AdminListResponse<PluginEnv>>(url);\n log('Retrieved %d plugin envs', result.data.length);\n return result;\n }\n\n /**\n * Retrieves a single plugin environment variable by ID\n *\n * @param id - Env ID\n * @returns Promise resolving to the env item\n */\n async getPluginEnv(id: number): Promise<PluginEnv> {\n log('Getting plugin env: %d', id);\n const result = await this.request<PluginEnv>(`/admin/plugins/env/${id}`);\n log('Retrieved plugin env: %d', id);\n return result;\n }\n\n /**\n * Creates a new plugin environment variable\n *\n * @param data - Env creation data\n * @returns Promise resolving to the created env item\n */\n async createPluginEnv(data: AdminPluginEnvCreateParams): Promise<PluginEnv> {\n log('Creating plugin env: %O', data);\n const result = await this.request<PluginEnv>(`/admin/plugins/env`, {\n body: JSON.stringify(data),\n method: 'POST',\n });\n log('Plugin env created successfully');\n return result;\n }\n\n /**\n * Updates a plugin environment variable\n *\n * @param id - Env ID\n * @param data - Env update data\n * @returns Promise resolving to the updated env item\n */\n async updatePluginEnv(id: number, data: AdminPluginEnvUpdateParams): Promise<PluginEnv> {\n log('Updating plugin env: %d, data: %O', id, data);\n const result = await this.request<PluginEnv>(`/admin/plugins/env/${id}`, {\n body: JSON.stringify(data),\n method: 'PUT',\n });\n log('Plugin env updated successfully');\n return result;\n }\n\n /**\n * Deletes a plugin environment variable\n *\n * @param id - Env ID\n * @returns Promise resolving to success response\n */\n async deletePluginEnv(id: number): Promise<{ success: boolean }> {\n log('Deleting plugin env: %d', id);\n const result = await this.request<{ success: boolean }>(`/admin/plugins/env/${id}`, {\n method: 'DELETE',\n });\n log('Plugin env deleted successfully');\n return result;\n }\n\n /**\n * Batch import plugin environment variables\n *\n * @param data - Batch import data, format: { [plugin: string]: { [envKey: string]: string } }\n * @returns Promise resolving to import result\n */\n async importPluginEnvs(\n data: Record<string, Record<string, string>>,\n ): Promise<{ success: number }> {\n log('Batch importing plugin envs: %O', data);\n const result = await this.request<{ success: number }>(`/admin/plugins/env/import`, {\n body: JSON.stringify(data),\n method: 'POST',\n });\n log('Batch import completed: %d envs imported', result.success);\n return result;\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '../core/BaseSDK';\nimport type {\n ClientRegistrationRequest,\n ClientRegistrationResponse,\n DiscoveryDocument,\n MarketSDKOptions,\n} from '../types';\nimport {\n AgentService,\n AuthService,\n DiscoveryService,\n FeedbackService,\n PluginsService,\n UserFavoriteService,\n UserFollowService,\n UserLikeService,\n UserService,\n} from './services';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk');\n\n/**\n * LobeHub Market SDK Client\n *\n * Main client for accessing the LobeHub Marketplace API.\n * This class provides access to marketplace resources like plugins, agents,\n * and service discovery information. It follows a composition pattern\n * by combining specialized domain services.\n */\nexport class MarketSDK extends BaseSDK {\n /**\n * Agents service for accessing agent-related functionality\n * Provides methods to list, search, retrieve agent information, and upload agents\n */\n readonly agents: AgentService;\n\n /**\n * Auth service for authentication and authorization\n * Provides methods for OIDC user authentication, client registration, and M2M token management\n */\n readonly auth: AuthService;\n\n /**\n * Plugins service for accessing plugin-related functionality\n * Provides methods to list, search, retrieve plugin information, and report installation attempts\n */\n readonly plugins: PluginsService;\n\n /**\n * User service for accessing user-related functionality\n * Provides methods to retrieve user profiles and their published agents\n */\n readonly user: UserService;\n\n /**\n * User follow service for follow operations\n * Provides methods to follow/unfollow users and retrieve follow relationships\n */\n readonly follows: UserFollowService;\n\n /**\n * User favorite service for favorite operations\n * Provides methods to add/remove favorites and retrieve favorite lists\n */\n readonly favorites: UserFavoriteService;\n\n /**\n * User like service for like operations\n * Provides methods to like/unlike content and retrieve like lists\n */\n readonly likes: UserLikeService;\n\n /**\n * Feedback service for submitting user feedback\n * Provides methods to submit feedback which is tracked in Linear\n */\n readonly feedback: FeedbackService;\n\n /**\n * Discovery service for retrieving API service information\n * Used to get information about available endpoints and services\n */\n private readonly discovery: DiscoveryService;\n\n /**\n * Creates a new MarketSDK instance\n *\n * @param options - Configuration options for the SDK\n */\n constructor(options: MarketSDKOptions = {}) {\n // Create shared token state object for all services\n const sharedTokenState = {\n accessToken: undefined,\n tokenExpiry: undefined,\n };\n\n super(options, undefined, sharedTokenState);\n log('MarketSDK instance created');\n\n // Initialize domain services with shared headers and token state for efficient reuse\n this.agents = new AgentService(options, this.headers, sharedTokenState);\n this.auth = new AuthService(options, this.headers, sharedTokenState);\n this.plugins = new PluginsService(options, this.headers, sharedTokenState);\n this.user = new UserService(options, this.headers, sharedTokenState);\n this.follows = new UserFollowService(options, this.headers, sharedTokenState);\n this.favorites = new UserFavoriteService(options, this.headers, sharedTokenState);\n this.likes = new UserLikeService(options, this.headers, sharedTokenState);\n this.feedback = new FeedbackService(options, this.headers, sharedTokenState);\n this.discovery = new DiscoveryService(options, this.headers, sharedTokenState);\n }\n\n /**\n * Retrieves the service discovery document\n *\n * The discovery document provides information about available API endpoints,\n * versions, and capabilities of the Market API.\n *\n * @returns Promise resolving to the service discovery document\n */\n async getDiscoveryDocument(): Promise<DiscoveryDocument> {\n return this.discovery.getDiscoveryDocument();\n }\n\n /**\n * Registers a new client for M2M authentication\n *\n * This method registers a client application with the Market API and returns\n * unique credentials (client_id and client_secret) that can be used for M2M authentication.\n * These credentials should be stored securely and used to initialize the SDK.\n *\n * @param request - Client registration request data\n * @returns Promise resolving to the client registration response with credentials\n * @throws Error if registration fails\n * @deprecated Use auth.registerClient() instead\n */\n async registerClient(request: ClientRegistrationRequest): Promise<ClientRegistrationResponse> {\n log('Registering client (deprecated method, use auth.registerClient): %s', request.clientName);\n return this.auth.registerClient(request);\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type {\n AgentCreateRequest,\n AgentCreateResponse,\n AgentDetailQuery,\n AgentInstallCountResponse,\n AgentItemDetail,\n AgentListQuery,\n AgentListResponse,\n AgentModifyRequest,\n AgentModifyResponse,\n AgentStatus,\n AgentStatusChangeResponse,\n AgentUploadRequest,\n AgentUploadResponse,\n AgentVersionCreateRequest,\n AgentVersionCreateResponse,\n AgentVersionModifyRequest,\n AgentVersionModifyResponse,\n OwnAgentListQuery,\n} from '../../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:agents');\n\n/**\n * Agents Service\n *\n * Provides access to agent-related functionality in the LobeHub Marketplace.\n * This service handles listing, searching, and retrieving detailed information\n * about agents available in the marketplace.\n */\nexport class AgentService extends BaseSDK {\n /**\n * Retrieves a list of agents from the marketplace\n *\n * Supports filtering, pagination, and localization of results.\n *\n * @param params - Query parameters for filtering and pagination\n * @param options - Optional request options\n * @returns Promise resolving to the agent list response containing items and pagination info\n */\n async getAgentList(\n params: AgentListQuery = {},\n options?: globalThis.RequestInit,\n ): Promise<AgentListResponse> {\n const locale = params.locale || this.defaultLocale;\n const queryParams = { ...params, locale };\n const queryString = this.buildQueryString(queryParams);\n\n log('Getting agent list: %O', queryParams);\n\n const result = await this.request<AgentListResponse>(`/v1/agents${queryString}`, options);\n log('Retrieved %d agents', result.items.length);\n return result;\n }\n\n /**\n * Retrieves a list of agents owned by the authenticated user\n *\n * Returns all agents regardless of their publish status (published, unpublished,\n * archived, deprecated). Requires authentication.\n *\n * @param params - Query parameters for filtering and pagination\n * @param options - Optional request options (must include authentication)\n * @returns Promise resolving to the agent list response containing items with status field\n */\n async getOwnAgents(\n params: OwnAgentListQuery = {},\n options?: globalThis.RequestInit,\n ): Promise<AgentListResponse> {\n const locale = params.locale || this.defaultLocale;\n const queryParams = { ...params, locale };\n const queryString = this.buildQueryString(queryParams);\n\n log('Getting own agent list: %O', queryParams);\n\n const result = await this.request<AgentListResponse>(`/v1/agents/own${queryString}`, options);\n log('Retrieved %d own agents', result.items.length);\n return result;\n }\n\n /**\n * Retrieves detailed information about a specific agent\n *\n * Returns complete agent information including A2A AgentCard data,\n * configuration, skills, and localized content.\n *\n * @param id - Unique identifier of the agent\n * @param params - Query parameters for locale and version\n * @param options - Optional request options\n * @returns Promise resolving to the agent detail information\n */\n async getAgentDetail(\n id: string,\n params: AgentDetailQuery = {},\n options?: globalThis.RequestInit,\n ): Promise<AgentItemDetail> {\n const locale = params.locale || this.defaultLocale;\n const queryParams: Record<string, string> = { locale };\n if (params.version !== undefined) {\n queryParams.version = params.version.toString();\n }\n const queryString = this.buildQueryString(queryParams);\n\n log('Getting agent detail: %O', { id, ...params });\n\n const result = await this.request<AgentItemDetail>(\n `/v1/agents/detail/${id}${queryString}`,\n options,\n );\n\n log('Agent detail successfully retrieved: %s', id);\n return result;\n }\n\n /**\n * Retrieves all published agent identifiers\n *\n * Returns a lightweight list of all published agent identifiers without\n * full agent metadata. This is useful for clients that need to know which\n * agents are available without fetching complete agent information.\n *\n * @param options - Optional request options\n * @returns Promise resolving to an array containing identifiers array and last modified time\n */\n async getPublishedIdentifiers(\n options?: globalThis.RequestInit,\n ): Promise<{ id: string; lastModified: string }[]> {\n log('Getting published agent identifiers');\n\n const result = await this.request<{ id: string; lastModified: string }[]>(\n '/v1/agents/identifiers',\n options,\n );\n log('Retrieved %d published agent identifiers', result.length);\n return result;\n }\n\n /**\n * Retrieves agent categories and their counts\n *\n * Returns a list of categories along with the number of agents in each category.\n * Useful for building category filters in a UI. Supports optional search filtering\n * via 'q' parameter and locale specification.\n *\n * @param params - Query parameters for filtering categories\n * @param options - Optional request options\n * @returns Promise resolving to an array of category items with counts\n */\n async getCategories(\n params: { locale?: string; q?: string } = {},\n options?: globalThis.RequestInit,\n ): Promise<{ category: string; count: number }[]> {\n const locale = params.locale || this.defaultLocale;\n const queryParams = { ...params, locale };\n const queryString = this.buildQueryString(queryParams);\n\n log('Getting agent categories: %O', queryParams);\n\n const result = await this.request<{ category: string; count: number }[]>(\n `/v1/agents/categories${queryString}`,\n options,\n );\n log('Retrieved %d categories', result.length);\n return result;\n }\n\n /**\n * Uploads an agent to the marketplace\n *\n * Allows users to upload new agents or update existing ones.\n * The agent data should conform to the A2A AgentCard specification.\n *\n * @param agentData - The agent data to upload\n * @param options - Optional request options\n * @returns Promise resolving to the upload response\n */\n async uploadAgent(\n agentData: AgentUploadRequest,\n options?: globalThis.RequestInit,\n ): Promise<AgentUploadResponse> {\n log('Uploading agent: %s@%s', agentData.agentIdentifier, agentData.version.version);\n\n const result = await this.request<AgentUploadResponse>('/v1/agents/upload', {\n body: JSON.stringify(agentData),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('Agent uploaded successfully: %O', result);\n return result;\n }\n\n /**\n * Creates a new agent in the marketplace\n *\n * @param agentData - The agent data to create\n * @param options - Optional request options\n * @returns Promise resolving to the created agent response\n */\n async createAgent(\n agentData: AgentCreateRequest,\n options?: globalThis.RequestInit,\n ): Promise<AgentCreateResponse> {\n log('Creating agent: %s', agentData.identifier);\n\n const result = await this.request<AgentCreateResponse>('/v1/agents/create', {\n body: JSON.stringify(agentData),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('Agent created successfully: %O', result);\n return result;\n }\n\n /**\n * Creates a new version for an existing agent\n *\n * @param versionData - The version data to create\n * @param options - Optional request options\n * @returns Promise resolving to the created version response\n */\n async createAgentVersion(\n versionData: AgentVersionCreateRequest,\n options?: globalThis.RequestInit,\n ): Promise<AgentVersionCreateResponse> {\n log('Creating agent version: %s', versionData.identifier);\n\n const result = await this.request<AgentVersionCreateResponse>('/v1/agents/version/create', {\n body: JSON.stringify(versionData),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('Agent version created successfully: %O', result);\n return result;\n }\n\n /**\n * Modifies an existing agent\n *\n * @param agentData - The agent data to modify\n * @param options - Optional request options\n * @returns Promise resolving to the modified agent response\n */\n async modifyAgent(\n agentData: AgentModifyRequest,\n options?: globalThis.RequestInit,\n ): Promise<AgentModifyResponse> {\n log('Modifying agent: %s', agentData.identifier);\n\n const result = await this.request<AgentModifyResponse>('/v1/agents/modify', {\n body: JSON.stringify(agentData),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('Agent modified successfully: %O', result);\n return result;\n }\n\n /**\n * Modifies a specific version of an existing agent\n *\n * @param versionData - The version data to modify\n * @param options - Optional request options\n * @returns Promise resolving to the modified version response\n */\n async modifyAgentVersion(\n versionData: AgentVersionModifyRequest,\n options?: globalThis.RequestInit,\n ): Promise<AgentVersionModifyResponse> {\n log('Modifying agent version: %s@%s', versionData.identifier, versionData.version);\n\n const result = await this.request<AgentVersionModifyResponse>('/v1/agents/version/modify', {\n body: JSON.stringify(versionData),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('Agent version modified successfully: %O', result);\n return result;\n }\n\n /**\n * Checks if an agent exists in the marketplace\n *\n * @param identifier - Unique identifier of the agent\n * @param options - Optional request options\n * @returns Promise resolving to true if agent exists, false otherwise\n */\n async checkAgentExists(identifier: string, options?: globalThis.RequestInit): Promise<boolean> {\n log('Checking if agent exists: %s', identifier);\n\n try {\n await this.getAgentDetail(identifier, {}, options);\n log('Agent exists: %s', identifier);\n return true;\n } catch {\n log('Agent does not exist: %s', identifier);\n return false;\n }\n }\n\n /**\n * Increases the install count for an agent\n *\n * This is a public endpoint that does not require authentication.\n * Call this method when a user installs or uses an agent.\n *\n * @param identifier - Unique identifier of the agent\n * @param options - Optional request options\n * @returns Promise resolving to the updated install count response\n */\n async increaseInstallCount(\n identifier: string,\n options?: globalThis.RequestInit,\n ): Promise<AgentInstallCountResponse> {\n log('Increasing install count for agent: %s', identifier);\n\n const result = await this.request<AgentInstallCountResponse>('/v1/agents/install-count', {\n body: JSON.stringify({ identifier }),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('Install count increased for agent %s: %d', identifier, result.installCount);\n return result;\n }\n\n /**\n * Changes the status of an agent\n *\n * Internal helper method used by publish/unpublish/archive/deprecate methods.\n * Requires authentication.\n *\n * @param identifier - Unique identifier of the agent\n * @param status - New status to set\n * @param options - Optional request options\n * @returns Promise resolving to the status change response\n */\n private async changeStatus(\n identifier: string,\n status: AgentStatus,\n options?: globalThis.RequestInit,\n ): Promise<AgentStatusChangeResponse> {\n log('Changing agent status: %s -> %s', identifier, status);\n\n const result = await this.modifyAgent({ identifier, status }, options);\n\n log('Agent status changed: %s -> %s', identifier, result.status);\n return {\n identifier: result.identifier,\n status: result.status as AgentStatus,\n success: true,\n };\n }\n\n /**\n * Publishes an agent to the marketplace\n *\n * Makes the agent publicly visible and available for installation.\n * Requires authentication and ownership of the agent.\n *\n * @param identifier - Unique identifier of the agent\n * @param options - Optional request options\n * @returns Promise resolving to the status change response\n */\n async publish(\n identifier: string,\n options?: globalThis.RequestInit,\n ): Promise<AgentStatusChangeResponse> {\n log('Publishing agent: %s', identifier);\n return this.changeStatus(identifier, 'published', options);\n }\n\n /**\n * Unpublishes an agent from the marketplace\n *\n * Hides the agent from public view. The agent data is preserved\n * and can be republished later.\n * Requires authentication and ownership of the agent.\n *\n * @param identifier - Unique identifier of the agent\n * @param options - Optional request options\n * @returns Promise resolving to the status change response\n */\n async unpublish(\n identifier: string,\n options?: globalThis.RequestInit,\n ): Promise<AgentStatusChangeResponse> {\n log('Unpublishing agent: %s', identifier);\n return this.changeStatus(identifier, 'unpublished', options);\n }\n\n /**\n * Archives an agent\n *\n * Marks the agent as archived. Archived agents are typically\n * no longer actively maintained but may still be accessible.\n * Requires authentication and ownership of the agent.\n *\n * @param identifier - Unique identifier of the agent\n * @param options - Optional request options\n * @returns Promise resolving to the status change response\n */\n async archive(\n identifier: string,\n options?: globalThis.RequestInit,\n ): Promise<AgentStatusChangeResponse> {\n log('Archiving agent: %s', identifier);\n return this.changeStatus(identifier, 'archived', options);\n }\n\n /**\n * Deprecates an agent\n *\n * Marks the agent as deprecated. Deprecated agents are still\n * accessible but users are encouraged to migrate to alternatives.\n * Requires authentication and ownership of the agent.\n *\n * @param identifier - Unique identifier of the agent\n * @param options - Optional request options\n * @returns Promise resolving to the status change response\n */\n async deprecate(\n identifier: string,\n options?: globalThis.RequestInit,\n ): Promise<AgentStatusChangeResponse> {\n log('Deprecating agent: %s', identifier);\n return this.changeStatus(identifier, 'deprecated', options);\n }\n}\n","import debug from 'debug';\nimport urlJoin from 'url-join';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type {\n AuthorizationCodeTokenRequest,\n ClientRegistrationRequest,\n ClientRegistrationResponse,\n OAuthTokenResponse,\n RefreshTokenRequest,\n} from '../../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:auth');\n\n/**\n * Auth Service\n *\n * Provides authentication and authorization functionality for the LobeHub Marketplace.\n * This service handles OIDC user authentication, client registration, and M2M token management.\n */\nexport class AuthService extends BaseSDK {\n // ===== OAuth Handoff Types =====\n /** Successful handoff payload */\n private static readonly HANDOFF_SUCCESS_STATUS = 'success' as const;\n /** Pending handoff status */\n private static readonly HANDOFF_PENDING_STATUS = 'pending' as const;\n /** Consumed handoff status */\n private static readonly HANDOFF_CONSUMED_STATUS = 'consumed' as const;\n /** Expired handoff status */\n private static readonly HANDOFF_EXPIRED_STATUS = 'expired' as const;\n\n /** Normalize token response from snake_case to camelCase fields */\n private static normalizeTokenResponse(data: any): OAuthTokenResponse {\n if (!data?.access_token || !data?.token_type) {\n throw new Error('Invalid token response payload');\n }\n\n return {\n accessToken: data.access_token,\n expiresIn: data.expires_in,\n idToken: data.id_token,\n refreshToken: data.refresh_token,\n scope: data.scope,\n tokenType: data.token_type,\n };\n }\n\n /**\n * Exchanges an authorization code or refresh token for access credentials\n *\n * Supports both the authorization_code and refresh_token grant types.\n * The method normalizes the response to camelCase field names.\n *\n * @param request - Token exchange parameters\n * @param options - Optional fetch options (e.g., custom headers)\n * @returns Promise resolving to the OAuth token payload\n */\n async exchangeOAuthToken(\n request: AuthorizationCodeTokenRequest | RefreshTokenRequest,\n options?: globalThis.RequestInit,\n ): Promise<OAuthTokenResponse> {\n const grantType = request.grantType ?? 'authorization_code';\n\n if (grantType !== 'authorization_code' && grantType !== 'refresh_token') {\n throw new Error(`Unsupported grant type: ${grantType}`);\n }\n\n log('Exchanging OAuth token using grant_type=%s', grantType);\n\n const tokenUrl = urlJoin(this.baseUrl, 'lobehub-oidc/token');\n const params = new URLSearchParams();\n params.set('grant_type', grantType);\n\n if (grantType === 'authorization_code') {\n const { clientId, code, codeVerifier, redirectUri } =\n request as AuthorizationCodeTokenRequest;\n\n if (!clientId || !code || !codeVerifier || !redirectUri) {\n throw new Error(\n 'clientId, code, codeVerifier, and redirectUri are required for authorization_code',\n );\n }\n\n params.set('client_id', clientId);\n params.set('code', code);\n params.set('code_verifier', codeVerifier);\n params.set('redirect_uri', redirectUri);\n } else {\n const { refreshToken, clientId } = request as RefreshTokenRequest;\n\n if (!refreshToken) {\n throw new Error('refreshToken is required for refresh_token grant');\n }\n\n params.set('refresh_token', refreshToken);\n if (clientId) params.set('client_id', clientId);\n }\n\n const headers = new Headers({\n 'Content-Type': 'application/x-www-form-urlencoded',\n });\n\n if (options?.headers) {\n new Headers(options.headers).forEach((value, key) => {\n headers.set(key, value);\n });\n }\n\n const requestInit: globalThis.RequestInit = {\n ...options,\n body: params,\n headers,\n method: 'POST',\n };\n\n const response = await fetch(tokenUrl, requestInit);\n\n let payload: any;\n try {\n payload = await response.json();\n } catch (error) {\n log('Failed to parse token response: %O', error);\n throw new Error(`Failed to parse token response: ${response.status} ${response.statusText}`);\n }\n\n if (!response.ok) {\n const errorDescription = payload?.error_description || payload?.error || response.statusText;\n const errorMsg = `Token exchange failed: ${response.status} ${errorDescription}`;\n log('Error: %s', errorMsg);\n throw new Error(errorMsg);\n }\n\n log('Token exchange successful');\n return AuthService.normalizeTokenResponse(payload);\n }\n\n /**\n * Retrieves user information from the OIDC userinfo endpoint\n *\n * Requires a valid access token in the Authorization header.\n *\n * @param accessToken - The access token to use for authentication\n * @param options - Optional request options\n * @returns Promise resolving to the user information\n */\n async getUserInfo(\n accessToken: string,\n options?: globalThis.RequestInit,\n ): Promise<{\n email?: string;\n email_verified?: boolean;\n name?: string;\n picture?: string;\n sub: string;\n }> {\n log('Getting user info');\n\n const userInfoUrl = urlJoin(this.baseUrl, 'lobehub-oidc/userinfo');\n\n const response = await fetch(userInfoUrl, {\n headers: {\n 'Authorization': `Bearer ${accessToken}`,\n 'Content-Type': 'application/json',\n },\n method: 'GET',\n ...options,\n });\n\n if (!response.ok) {\n const errorMsg = `Failed to fetch user info: ${response.status} ${response.statusText}`;\n log('Error: %s', errorMsg);\n throw new Error(errorMsg);\n }\n\n const userInfo = await response.json();\n log('User info retrieved successfully');\n return userInfo;\n }\n\n /**\n * Registers a new OAuth client with the marketplace\n *\n * This is typically used for device registration or application setup.\n * Returns client credentials that can be used for M2M authentication.\n *\n * @param clientData - The client registration data\n * @param options - Optional request options\n * @returns Promise resolving to the client credentials\n */\n async registerClient(\n clientData: ClientRegistrationRequest,\n options?: globalThis.RequestInit,\n ): Promise<ClientRegistrationResponse> {\n log('Registering client: %s (%s)', clientData.clientName, clientData.clientType);\n\n const result = await this.request<ClientRegistrationResponse>('/v1/clients/register', {\n body: JSON.stringify(clientData),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('Client registered successfully: %s', result.client_id);\n return result;\n }\n\n /**\n * Fetches an M2M (Machine-to-Machine) access token\n *\n * Uses client credentials to obtain an access token for server-to-server communication.\n * This method requires clientId and clientSecret to be set in the SDK options.\n *\n * @returns Promise resolving to the access token and expiration time\n */\n async getM2MToken(): Promise<{\n accessToken: string;\n expiresIn: number;\n }> {\n log('Fetching M2M token');\n\n const tokenInfo = await this.fetchM2MToken();\n\n log('M2M token fetched successfully');\n return tokenInfo;\n }\n\n /** OAuth handoff response shapes */\n // Using inline type aliases inside the class for better encapsulation\n // success: 200\n private static typeHandoffSuccess(data: { clientId: string; code: string; redirectUri: string }) {\n return {\n clientId: data.clientId,\n code: data.code,\n redirectUri: data.redirectUri,\n status: AuthService.HANDOFF_SUCCESS_STATUS,\n } as const;\n }\n\n /**\n * Get OAuth handoff status and data by id.\n * Maps server HTTP statuses to a typed status union:\n * - 200: success\n * - 202: pending\n * - 404: consumed\n * - 410: expired\n * - others: error (throws)\n */\n async getOAuthHandoff(\n id: string,\n options?: globalThis.RequestInit,\n ): Promise<\n | { clientId: string; code: string; redirectUri: string; status: 'success' }\n | { status: 'pending' }\n | { status: 'consumed' }\n | { status: 'expired' }\n > {\n if (!id) throw new Error('id is required');\n\n log('Getting OAuth handoff: %s', id);\n\n const handoffUrl = `${urlJoin(this.baseUrl, 'lobehub-oidc/handoff')}?id=${encodeURIComponent(id)}`;\n const response = await fetch(handoffUrl, {\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'GET',\n ...options,\n });\n\n // Map known statuses\n if (response.status === 200) {\n const json = await response.json();\n const result = AuthService.typeHandoffSuccess({\n clientId: json.clientId,\n code: json.code,\n redirectUri: json.redirectUri,\n });\n log('OAuth handoff success for id: %s', id);\n return result;\n }\n if (response.status === 202) {\n log('OAuth handoff pending for id: %s', id);\n return { status: AuthService.HANDOFF_PENDING_STATUS };\n }\n if (response.status === 404) {\n log('OAuth handoff consumed for id: %s', id);\n return { status: AuthService.HANDOFF_CONSUMED_STATUS };\n }\n if (response.status === 410) {\n log('OAuth handoff expired for id: %s', id);\n return { status: AuthService.HANDOFF_EXPIRED_STATUS };\n }\n\n // Attempt to parse error for diagnostics\n let errorMessage = `Failed to fetch OAuth handoff (status ${response.status} ${response.statusText})`;\n try {\n const errJson = await response.json();\n if (errJson && (errJson.message || errJson.error)) {\n errorMessage = `${errorMessage}: ${errJson.error ?? ''} ${errJson.message ?? ''}`.trim();\n }\n } catch {\n // ignore json parse error\n }\n log('Error: %s', errorMessage);\n throw new Error(errorMessage);\n }\n\n /**\n * Poll OAuth handoff result until it becomes terminal.\n * Terminal statuses: success, expired, consumed.\n * Non-terminal: pending → continue polling.\n */\n async pollOAuthHandoff(\n id: string,\n params: {\n intervalMs?: number;\n requestInit?: globalThis.RequestInit;\n signal?: AbortSignal;\n timeoutMs?: number;\n } = {},\n ): Promise<\n | { clientId: string; code: string; redirectUri: string; status: 'success' }\n | { status: 'expired' }\n | { status: 'consumed' }\n > {\n const intervalMs = params.intervalMs ?? 1500;\n const timeoutMs = params.timeoutMs ?? 60_000;\n const startedAt = Date.now();\n const { signal, requestInit } = params;\n\n log('Start polling OAuth handoff: %s', id);\n\n // eslint-disable-next-line no-constant-condition\n while (true) {\n if (signal?.aborted) {\n const err = new Error('Polling aborted');\n log('Error: %s', err.message);\n throw err;\n }\n if (Date.now() - startedAt > timeoutMs) {\n const err = new Error('Polling timeout');\n log('Error: %s', err.message);\n throw err;\n }\n\n const result = await this.getOAuthHandoff(id, requestInit);\n\n if (\n result.status === 'success' ||\n result.status === 'expired' ||\n result.status === 'consumed'\n ) {\n log('Stop polling OAuth handoff (terminal): %s -> %s', id, result.status);\n return result as\n | { clientId: string; code: string; redirectUri: string; status: 'success' }\n | { status: 'expired' }\n | { status: 'consumed' };\n }\n\n // pending → wait and retry\n await new Promise<void>((resolve) => {\n setTimeout(resolve, intervalMs);\n });\n }\n }\n}\n","import debug from 'debug';\nimport urlJoin from 'url-join';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type { DiscoveryDocument } from '../../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:discovery');\n\n/**\n * Discovery Service\n *\n * Provides functionality for retrieving service discovery information\n * from the LobeHub Marketplace API. The discovery document contains\n * metadata about available endpoints, authentication methods, and\n * other capabilities of the API.\n */\nexport class DiscoveryService extends BaseSDK {\n /** Cached discovery document to avoid repeated requests */\n private discoveryDoc?: DiscoveryDocument;\n\n /**\n * Retrieves the service discovery document\n *\n * This document contains information about available API endpoints,\n * authentication methods, and other capabilities of the Market API.\n * The result is cached after the first request to improve performance.\n *\n * @returns Promise resolving to the service discovery document\n */\n async getDiscoveryDocument(): Promise<DiscoveryDocument> {\n log('Fetching discovery document');\n if (this.discoveryDoc) {\n log('Returning cached discovery document');\n return this.discoveryDoc;\n }\n\n const res = await fetch(urlJoin(this.baseUrl, '/.well-known/discovery'));\n if (!res.ok) {\n throw new Error(await res.text());\n }\n\n this.discoveryDoc = (await res.json()) as DiscoveryDocument;\n log('Discovery document successfully fetched');\n return this.discoveryDoc;\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type { SubmitFeedbackRequest, SubmitFeedbackResponse } from '../../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:feedback');\n\n/**\n * Feedback Service\n *\n * Provides functionality for submitting user feedback to the LobeHub Marketplace.\n * Feedback is tracked in Linear for follow-up.\n *\n * Note: This endpoint is rate-limited to 3 requests per minute per IP.\n */\nexport class FeedbackService extends BaseSDK {\n /**\n * Submits user feedback\n *\n * Creates a feedback issue in Linear for tracking and follow-up.\n * Email is required for contact purposes.\n *\n * Rate limit: 3 requests per minute per IP\n *\n * @param data - The feedback data to submit\n * @param options - Optional request options\n * @returns Promise resolving to the feedback submission response\n * @throws Error if rate limit is exceeded (429) or submission fails\n *\n * @example\n * ```typescript\n * const response = await sdk.feedback.submitFeedback({\n * email: 'user@example.com',\n * title: 'Feature request',\n * message: 'It would be great if...',\n * clientInfo: {\n * url: window.location.href,\n * userAgent: navigator.userAgent,\n * },\n * });\n * console.log('Feedback submitted:', response.issueUrl);\n * ```\n */\n async submitFeedback(\n data: SubmitFeedbackRequest,\n options?: globalThis.RequestInit,\n ): Promise<SubmitFeedbackResponse> {\n log('Submitting feedback: %s', data.title);\n\n const result = await this.request<SubmitFeedbackResponse>('/v1/user/feedback', {\n body: JSON.stringify(data),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('Feedback submitted successfully: %s', result.issueId);\n return result;\n }\n}\n","import type {\n CallReportRequest,\n CallReportResponse,\n CloudGatewayRequest,\n CloudGatewayResponse,\n InstallReportRequest,\n InstallReportResponse,\n PluginItemDetail,\n PluginManifest,\n} from '@lobehub/market-types';\nimport debug from 'debug';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type {\n CategoryItem,\n CategoryListQuery,\n CodeInterpreterToolName,\n CodeInterpreterToolParams,\n PluginListResponse,\n PluginQueryParams,\n RunBuildInToolsResponse,\n} from '../../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:plugins');\n\n/**\n * Plugins Service\n *\n * Provides access to plugin-related functionality in the LobeHub Marketplace.\n * This service handles listing, searching, and retrieving detailed information\n * about plugins available in the marketplace.\n */\nexport class PluginsService extends BaseSDK {\n /**\n * Retrieves a list of plugins from the marketplace\n *\n * Supports filtering, pagination, and localization of results.\n *\n * @param params - Query parameters for filtering and pagination\n * @param options\n * @returns Promise resolving to the plugin list response containing items and pagination info\n */\n async getPluginList(\n params: PluginQueryParams = {},\n options?: globalThis.RequestInit,\n ): Promise<PluginListResponse> {\n const locale = params.locale || this.defaultLocale;\n const queryParams = { ...params, locale };\n const queryString = this.buildQueryString(queryParams);\n\n log('Getting plugin list: %O', queryParams);\n\n const result = await this.request<PluginListResponse>(`/v1/plugins${queryString}`, options);\n log('Retrieved %d plugins', result.items.length);\n return result;\n }\n\n /**\n * Retrieves all plugin categories and their counts\n *\n * Returns a list of categories along with the number of plugins in each category.\n * Useful for building category filters in a UI. Supports optional search filtering\n * via 'q' parameter and locale specification.\n *\n * @param params - Query parameters for filtering categories\n * @param options - Optional request options\n * @returns Promise resolving to an array of category items with counts\n */\n async getCategories(\n params: CategoryListQuery = {},\n options?: globalThis.RequestInit,\n ): Promise<CategoryItem[]> {\n const locale = params.locale || this.defaultLocale;\n const queryParams = { ...params, locale };\n const queryString = this.buildQueryString(queryParams);\n\n log('Getting plugin categories: %O', queryParams);\n\n const result = await this.request<CategoryItem[]>(\n `/v1/plugins/categories${queryString}`,\n options,\n );\n log('Retrieved %d categories', result.length);\n return result;\n }\n\n /**\n * Retrieves all published plugin identifiers\n *\n * Returns a lightweight list of all published plugin identifiers without\n * full plugin metadata. This is useful for clients that need to know which\n * plugins are available without fetching complete plugin information.\n *\n * @returns Promise resolving to an array containing identifiers array and last modified time\n */\n async getPublishedIdentifiers(\n options?: globalThis.RequestInit,\n ): Promise<{ identifier: string; lastModified: string }[]> {\n log('Getting published plugin identifiers');\n\n const result = await this.request<{ identifier: string; lastModified: string }[]>(\n '/v1/plugins/identifiers',\n options,\n );\n log('Retrieved %d published plugin identifiers', result.length);\n return result;\n }\n\n /**\n * Retrieves the manifest for a specific plugin\n *\n * The manifest contains detailed information about a plugin, including\n * its capabilities, tools, prompts, and resources.\n *\n * @param identifier - Unique identifier of the plugin\n * @param locale - Optional locale for localized content (defaults to SDK default locale)\n * @param version - Optional specific version to retrieve (defaults to latest)\n * @param options\n * @returns Promise resolving to the plugin manifest\n */\n async getPluginManifest(\n {\n locale,\n version,\n identifier,\n }: {\n identifier: string;\n locale?: string;\n version?: string;\n },\n options?: globalThis.RequestInit,\n ): Promise<PluginManifest> {\n log('Getting plugin manifest: %O', { identifier, locale, version });\n const localeParam = locale || this.defaultLocale;\n const params: Record<string, string> = { locale: localeParam };\n if (version) {\n params.version = version;\n }\n const queryString = this.buildQueryString(params);\n\n const manifest = await this.request<PluginManifest>(\n `/v1/plugins/${identifier}/manifest${queryString}`,\n options,\n );\n\n log('Plugin manifest successfully retrieved: %s', identifier);\n return manifest;\n }\n\n /**\n * Retrieves the plugin detailed information about a plugin, including\n * its capabilities, tools, prompts, and resources.\n *\n * @param identifier - Unique identifier of the plugin\n * @param locale - Optional locale for localized content (defaults to SDK default locale)\n * @param version - Optional specific version to retrieve (defaults to latest)\n * @returns Promise resolving to the plugin manifest\n */\n async getPluginDetail(\n {\n locale,\n version,\n identifier,\n }: {\n identifier: string;\n locale?: string;\n version?: string;\n },\n options?: globalThis.RequestInit,\n ): Promise<PluginItemDetail> {\n log('Getting plugin detail: %O', { identifier, locale, version });\n const localeParam = locale || this.defaultLocale;\n const params: Record<string, string> = { locale: localeParam };\n if (version) {\n params.version = version;\n }\n const queryString = this.buildQueryString(params);\n\n const manifest = await this.request<PluginItemDetail>(\n `/v1/plugins/${identifier}${queryString}`,\n options,\n );\n\n log('Plugin manifest successfully retrieved: %s', identifier);\n return manifest;\n }\n\n /**\n * Report a plugin installation attempt\n *\n * Reports the outcome of a plugin installation attempt, including timing,\n * success status, manifest information, and error details if applicable.\n * This helps improve plugin validation and provides analytics about installation success rates.\n *\n * @param reportData - The installation report data\n * @returns Promise resolving to the report submission response\n *\n */\n async reportInstallation(reportData: InstallReportRequest): Promise<InstallReportResponse> {\n log('Reporting installation for %s@%s', reportData.identifier, reportData.version);\n\n const result = await this.request<InstallReportResponse>('/v1/plugins/report/installation', {\n body: JSON.stringify(reportData),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n });\n\n log('Installation report submitted successfully: %O', result);\n return result;\n }\n\n /**\n * Report a plugin method call attempt\n *\n * Reports the outcome of a plugin method call, including timing,\n * success status, method information, and error details if applicable.\n * This helps improve plugin performance monitoring and provides usage analytics.\n *\n * @param reportData - The call report data\n * @returns Promise resolving to the report submission response\n */\n async reportCall(reportData: CallReportRequest): Promise<CallReportResponse> {\n log(\n 'Reporting call for %s@%s - %s:%s',\n reportData.identifier,\n reportData.version,\n reportData.methodType,\n reportData.methodName,\n );\n\n const result = await this.request<CallReportResponse>('/v1/plugins/report/call', {\n body: JSON.stringify(reportData),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n });\n\n log('Call report submitted successfully: %O', result);\n return result;\n }\n\n /**\n * Call a cloud-hosted plugin tool via the cloud gateway\n *\n * Proxies tool calls to official cloud-hosted plugins with authentication and validation.\n * This method requires authentication via bearer token (apiKey or M2M credentials).\n *\n * @param request - The cloud gateway request containing plugin identifier, tool name, and parameters\n * @param options - Optional request options\n * @returns Promise resolving to the tool call result\n *\n * @example\n * ```typescript\n * const result = await sdk.plugins.callCloudGateway({\n * identifier: 'my-plugin',\n * toolName: 'myTool',\n * apiParams: { param1: 'value1' }\n * });\n * ```\n */\n async callCloudGateway(\n request: CloudGatewayRequest,\n options?: globalThis.RequestInit,\n ): Promise<CloudGatewayResponse> {\n log('Calling cloud gateway for plugin %s, tool %s', request.identifier, request.toolName);\n\n const result = await this.request<CloudGatewayResponse>('/v1/plugins/cloud-gateway', {\n body: JSON.stringify(request),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('Cloud gateway call completed: %O', {\n identifier: request.identifier,\n isError: result.isError,\n toolName: request.toolName,\n });\n\n return result;\n }\n\n // ============================================================================\n // Code Interpreter / RunBuildInTools Methods\n // ============================================================================\n\n /**\n * Execute a built-in tool via AWS Bedrock AgentCore Code Interpreter\n *\n * This method provides access to file operations, command execution, and session management\n * tools running in an isolated sandbox environment. Sessions are automatically managed\n * per user/topic combination.\n *\n * @param toolName - Name of the tool to execute\n * @param params - Tool-specific parameters\n * @param context - User and topic context for session isolation\n * @param options - Optional request options\n * @returns Promise resolving to the tool execution result\n *\n * @example\n * ```typescript\n * // Run a shell command\n * const result = await sdk.plugins.runBuildInTool(\n * 'runCommand',\n * { command: 'ls -la' },\n * { userId: 'user-123', topicId: 'topic-456' }\n * );\n *\n * // Read a file\n * const fileResult = await sdk.plugins.runBuildInTool(\n * 'readLocalFile',\n * { path: '/tmp/example.txt' },\n * { userId: 'user-123', topicId: 'topic-456' }\n * );\n * ```\n */\n async runBuildInTool<T extends CodeInterpreterToolName>(\n toolName: T,\n params: CodeInterpreterToolParams[T],\n context: { topicId: string; userId: string },\n options?: globalThis.RequestInit,\n ): Promise<RunBuildInToolsResponse> {\n log('Running built-in tool: %s for user %s, topic %s', toolName, context.userId, context.topicId);\n\n const result = await this.request<RunBuildInToolsResponse>('/v1/plugins/run-buildin-tools', {\n body: JSON.stringify({\n params,\n toolName,\n topicId: context.topicId,\n userId: context.userId,\n }),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('Built-in tool execution completed: %O', {\n success: result.success,\n toolName,\n });\n\n return result;\n }\n\n /**\n * Execute a shell command in the Code Interpreter sandbox\n *\n * @param command - Shell command to execute\n * @param context - User and topic context\n * @param options - Additional options (background, timeout)\n * @returns Promise resolving to command execution result\n */\n async runCommand(\n command: string,\n context: { topicId: string; userId: string },\n options?: { background?: boolean; timeout?: number },\n ): Promise<RunBuildInToolsResponse> {\n return this.runBuildInTool('runCommand', { command, ...options }, context);\n }\n\n /**\n * Read a file from the Code Interpreter sandbox\n *\n * @param path - File path to read\n * @param context - User and topic context\n * @param options - Line range options (startLine, endLine)\n * @returns Promise resolving to file content\n */\n async readFile(\n path: string,\n context: { topicId: string; userId: string },\n options?: { endLine?: number; startLine?: number },\n ): Promise<RunBuildInToolsResponse> {\n return this.runBuildInTool('readLocalFile', { path, ...options }, context);\n }\n\n /**\n * Write content to a file in the Code Interpreter sandbox\n *\n * @param path - File path to write\n * @param content - Content to write\n * @param context - User and topic context\n * @param options - Additional options (createDirectories)\n * @returns Promise resolving to write result\n */\n async writeFile(\n path: string,\n content: string,\n context: { topicId: string; userId: string },\n options?: { createDirectories?: boolean },\n ): Promise<RunBuildInToolsResponse> {\n return this.runBuildInTool('writeLocalFile', { content, path, ...options }, context);\n }\n\n /**\n * List files in a directory in the Code Interpreter sandbox\n *\n * @param directoryPath - Directory path to list\n * @param context - User and topic context\n * @returns Promise resolving to directory listing\n */\n async listFiles(\n directoryPath: string,\n context: { topicId: string; userId: string },\n ): Promise<RunBuildInToolsResponse> {\n return this.runBuildInTool('listLocalFiles', { directoryPath }, context);\n }\n\n /**\n * Search for files matching a glob pattern\n *\n * @param pattern - Glob pattern (e.g., \"**\\/*.ts\")\n * @param context - User and topic context\n * @param directory - Base directory (optional)\n * @returns Promise resolving to matching files\n */\n async globFiles(\n pattern: string,\n context: { topicId: string; userId: string },\n directory?: string,\n ): Promise<RunBuildInToolsResponse> {\n return this.runBuildInTool('globLocalFiles', { directory, pattern }, context);\n }\n\n /**\n * Search file contents using regex pattern\n *\n * @param pattern - Regex pattern to search\n * @param directory - Directory to search\n * @param context - User and topic context\n * @param options - Additional options (filePattern, recursive)\n * @returns Promise resolving to grep results\n */\n async grepContent(\n pattern: string,\n directory: string,\n context: { topicId: string; userId: string },\n options?: { filePattern?: string; recursive?: boolean },\n ): Promise<RunBuildInToolsResponse> {\n return this.runBuildInTool('grepContent', { directory, pattern, ...options }, context);\n }\n\n /**\n * Export a file from the Code Interpreter sandbox to a pre-signed URL\n *\n * This method uploads a file from the sandbox to an external storage location\n * via a pre-signed URL (e.g., S3 pre-signed URL). The upload is performed\n * using Python code execution within the sandbox.\n *\n * @param path - File path in sandbox to export\n * @param uploadUrl - Pre-signed URL to upload the file to\n * @param context - User and topic context\n * @returns Promise resolving to export result with success status and file info\n *\n * @example\n * ```typescript\n * const result = await sdk.plugins.exportFile(\n * './output/result.csv',\n * 'https://s3.amazonaws.com/bucket/key?X-Amz-Signature=...',\n * { userId: 'user-123', topicId: 'topic-456' }\n * );\n *\n * if (result.success && result.data?.result.success) {\n * console.log('File exported:', result.data.result.size, 'bytes');\n * }\n * ```\n */\n async exportFile(\n path: string,\n uploadUrl: string,\n context: { topicId: string; userId: string },\n ): Promise<RunBuildInToolsResponse> {\n return this.runBuildInTool('exportFile', { path, uploadUrl }, context);\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type {\n UpdateUserInfoRequest,\n UpdateUserInfoResponse,\n UserInfoQuery,\n UserInfoResponse,\n} from '../../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:user');\n\n/**\n * User Service\n *\n * Provides access to user-related functionality in the LobeHub Marketplace.\n * This service handles retrieving and updating user profiles and their associated agents.\n */\nexport class UserService extends BaseSDK {\n /**\n * Retrieves user information by account ID or userName\n *\n * Returns user profile along with their published public agents.\n * This is a public endpoint that doesn't require authentication.\n *\n * @param idOrUserName - The account ID (number) or userName (string)\n * @param params - Query parameters for locale\n * @param options - Optional request options\n * @returns Promise resolving to the user info response\n */\n async getUserInfo(\n idOrUserName: number | string,\n params: UserInfoQuery = {},\n options?: globalThis.RequestInit,\n ): Promise<UserInfoResponse> {\n const locale = params.locale || this.defaultLocale;\n const queryParams = { locale };\n const queryString = this.buildQueryString(queryParams);\n\n log('Getting user info: %O', { idOrUserName, ...params });\n\n const result = await this.request<UserInfoResponse>(\n `/v1/user/info/${idOrUserName}${queryString}`,\n options,\n );\n\n log('User info successfully retrieved for: %s', idOrUserName);\n return result;\n }\n\n /**\n * Updates the authenticated user's profile information\n *\n * Allows updating userName, displayName, avatarUrl, and meta fields.\n * Requires authentication - the user must be authenticated to update their own profile.\n *\n * @param data - The data to update (userName, displayName, avatarUrl, meta)\n * @param options - Optional request options (must include authentication)\n * @returns Promise resolving to the update response with the updated user profile\n * @throws Error if userName is already taken or update fails\n */\n async updateUserInfo(\n data: UpdateUserInfoRequest,\n options?: globalThis.RequestInit,\n ): Promise<UpdateUserInfoResponse> {\n log('Updating user info: %O', data);\n\n const result = await this.request<UpdateUserInfoResponse>('/v1/user/update', {\n body: JSON.stringify(data),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('User info updated successfully');\n return result;\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type {\n CheckFollowResponse,\n FollowListResponse,\n FollowRequest,\n PaginationQuery,\n SuccessResponse,\n} from '../../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:user-follow');\n\n/**\n * User Follow Service\n *\n * Provides access to user follow functionality in the LobeHub Marketplace.\n * This service handles following/unfollowing users and retrieving follow relationships.\n */\nexport class UserFollowService extends BaseSDK {\n /**\n * Follow a user\n *\n * Creates a follow relationship where the authenticated user follows the target user.\n * Requires authentication.\n *\n * @param followingId - The ID of the user to follow\n * @param options - Optional request options\n * @returns Promise resolving to success response\n * @throws Error if already following or cannot follow yourself\n */\n async follow(followingId: number, options?: globalThis.RequestInit): Promise<SuccessResponse> {\n log('Following user: %d', followingId);\n\n const body: FollowRequest = { followingId };\n\n const result = await this.request<SuccessResponse>('/v1/user/follows', {\n body: JSON.stringify(body),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('Successfully followed user: %d', followingId);\n return result;\n }\n\n /**\n * Unfollow a user\n *\n * Removes the follow relationship where the authenticated user unfollows the target user.\n * Requires authentication.\n *\n * @param followingId - The ID of the user to unfollow\n * @param options - Optional request options\n * @returns Promise resolving to success response\n * @throws Error if follow relationship not found\n */\n async unfollow(followingId: number, options?: globalThis.RequestInit): Promise<SuccessResponse> {\n log('Unfollowing user: %d', followingId);\n\n const body: FollowRequest = { followingId };\n\n const result = await this.request<SuccessResponse>('/v1/user/follows', {\n body: JSON.stringify(body),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'DELETE',\n ...options,\n });\n\n log('Successfully unfollowed user: %d', followingId);\n return result;\n }\n\n /**\n * Check follow status\n *\n * Checks if the authenticated user is following the target user and if they follow each other.\n * Requires authentication.\n *\n * @param targetUserId - The ID of the user to check\n * @param options - Optional request options\n * @returns Promise resolving to follow status (isFollowing, isMutual)\n */\n async checkFollowStatus(\n targetUserId: number,\n options?: globalThis.RequestInit,\n ): Promise<CheckFollowResponse> {\n log('Checking follow status for user: %d', targetUserId);\n\n const queryString = this.buildQueryString({ targetUserId: String(targetUserId) });\n\n const result = await this.request<CheckFollowResponse>(\n `/v1/user/follows/check${queryString}`,\n options,\n );\n\n log('Follow status retrieved: %O', result);\n return result;\n }\n\n /**\n * Get following list\n *\n * Retrieves the list of users that a user is following.\n * This is a public endpoint - no authentication required.\n *\n * @param userId - The ID of the user whose following list to retrieve\n * @param params - Pagination parameters\n * @param options - Optional request options\n * @returns Promise resolving to list of following users\n */\n async getFollowing(\n userId: number,\n params: PaginationQuery = {},\n options?: globalThis.RequestInit,\n ): Promise<FollowListResponse> {\n log('Getting following list for user: %d', userId);\n\n const queryParams: Record<string, string> = {};\n if (params.limit !== undefined) queryParams.limit = String(params.limit);\n if (params.offset !== undefined) queryParams.offset = String(params.offset);\n\n const queryString = this.buildQueryString(queryParams);\n\n const result = await this.request<FollowListResponse>(\n `/v1/user/follows/${userId}/following${queryString}`,\n options,\n );\n\n log('Following list retrieved for user: %d', userId);\n return result;\n }\n\n /**\n * Get followers list\n *\n * Retrieves the list of users who follow a user.\n * This is a public endpoint - no authentication required.\n *\n * @param userId - The ID of the user whose followers list to retrieve\n * @param params - Pagination parameters\n * @param options - Optional request options\n * @returns Promise resolving to list of followers\n */\n async getFollowers(\n userId: number,\n params: PaginationQuery = {},\n options?: globalThis.RequestInit,\n ): Promise<FollowListResponse> {\n log('Getting followers list for user: %d', userId);\n\n const queryParams: Record<string, string> = {};\n if (params.limit !== undefined) queryParams.limit = String(params.limit);\n if (params.offset !== undefined) queryParams.offset = String(params.offset);\n\n const queryString = this.buildQueryString(queryParams);\n\n const result = await this.request<FollowListResponse>(\n `/v1/user/follows/${userId}/followers${queryString}`,\n options,\n );\n\n log('Followers list retrieved for user: %d', userId);\n return result;\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type {\n CheckFavoriteResponse,\n FavoriteListResponse,\n FavoriteQuery,\n FavoriteRequest,\n InteractionTargetType,\n SuccessResponse,\n} from '../../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:user-favorite');\n\n/**\n * User Favorite Service\n *\n * Provides access to user favorite functionality in the LobeHub Marketplace.\n * This service handles adding/removing favorites and retrieving favorite lists.\n */\nexport class UserFavoriteService extends BaseSDK {\n /**\n * Add to favorites\n *\n * Adds an agent or plugin to the authenticated user's favorites.\n * Requires authentication.\n *\n * @param targetType - The type of target ('agent' or 'plugin')\n * @param targetId - The ID of the target agent/plugin\n * @param options - Optional request options\n * @returns Promise resolving to success response\n * @throws Error if already in favorites\n */\n async addFavorite(\n targetType: InteractionTargetType,\n targetId: string,\n options?: globalThis.RequestInit,\n ): Promise<SuccessResponse> {\n log('Adding favorite: %s %d', targetType, targetId);\n\n const body: FavoriteRequest = { targetId, targetType };\n\n const result = await this.request<SuccessResponse>('/v1/user/favorites', {\n body: JSON.stringify(body),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('Successfully added favorite: %s %d', targetType, targetId);\n return result;\n }\n\n /**\n * Remove from favorites\n *\n * Removes an agent or plugin from the authenticated user's favorites.\n * Requires authentication.\n *\n * @param targetType - The type of target ('agent' or 'plugin')\n * @param targetId - The ID of the target agent/plugin\n * @param options - Optional request options\n * @returns Promise resolving to success response\n * @throws Error if favorite not found\n */\n async removeFavorite(\n targetType: InteractionTargetType,\n targetId: string,\n options?: globalThis.RequestInit,\n ): Promise<SuccessResponse> {\n log('Removing favorite: %s %d', targetType, targetId);\n\n const body: FavoriteRequest = { targetId, targetType };\n\n const result = await this.request<SuccessResponse>('/v1/user/favorites', {\n body: JSON.stringify(body),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'DELETE',\n ...options,\n });\n\n log('Successfully removed favorite: %s %d', targetType, targetId);\n return result;\n }\n\n /**\n * Check favorite status\n *\n * Checks if the authenticated user has favorited a specific agent or plugin.\n * Requires authentication.\n *\n * @param targetType - The type of target ('agent' or 'plugin')\n * @param targetId - The ID of the target agent/plugin\n * @param options - Optional request options\n * @returns Promise resolving to favorite status\n */\n async checkFavorite(\n targetType: InteractionTargetType,\n targetId: number,\n options?: globalThis.RequestInit,\n ): Promise<CheckFavoriteResponse> {\n log('Checking favorite status: %s %d', targetType, targetId);\n\n const queryString = this.buildQueryString({\n targetId: String(targetId),\n targetType,\n });\n\n const result = await this.request<CheckFavoriteResponse>(\n `/v1/user/favorites/check${queryString}`,\n options,\n );\n\n log('Favorite status retrieved: %O', result);\n return result;\n }\n\n /**\n * Get my favorites\n *\n * Retrieves the authenticated user's favorites.\n * Requires authentication.\n *\n * @param params - Query parameters for filtering and pagination\n * @param options - Optional request options\n * @returns Promise resolving to list of favorites\n */\n async getMyFavorites(\n params: FavoriteQuery = {},\n options?: globalThis.RequestInit,\n ): Promise<FavoriteListResponse> {\n log('Getting my favorites: %O', params);\n\n const queryParams: Record<string, string> = {};\n if (params.limit !== undefined) queryParams.limit = String(params.limit);\n if (params.offset !== undefined) queryParams.offset = String(params.offset);\n if (params.type !== undefined) queryParams.type = params.type;\n\n const queryString = this.buildQueryString(queryParams);\n\n const result = await this.request<FavoriteListResponse>(\n `/v1/user/favorites/me${queryString}`,\n options,\n );\n\n log('My favorites retrieved');\n return result;\n }\n\n /**\n * Get user's favorites\n *\n * Retrieves a user's favorites.\n * This is a public endpoint - no authentication required.\n *\n * @param userId - The ID of the user whose favorites to retrieve\n * @param params - Query parameters for filtering and pagination\n * @param options - Optional request options\n * @returns Promise resolving to list of favorites\n */\n async getUserFavorites(\n userId: number,\n params: FavoriteQuery = {},\n options?: globalThis.RequestInit,\n ): Promise<FavoriteListResponse> {\n log('Getting favorites for user: %d', userId);\n\n const queryParams: Record<string, string> = {};\n if (params.limit !== undefined) queryParams.limit = String(params.limit);\n if (params.offset !== undefined) queryParams.offset = String(params.offset);\n if (params.type !== undefined) queryParams.type = params.type;\n\n const queryString = this.buildQueryString(queryParams);\n\n const result = await this.request<FavoriteListResponse>(\n `/v1/user/favorites/${userId}${queryString}`,\n options,\n );\n\n log('Favorites retrieved for user: %d', userId);\n return result;\n }\n\n /**\n * Get user's favorite agents with details\n *\n * Retrieves a user's favorite agents with full details.\n * This is a public endpoint - no authentication required.\n *\n * @param userId - The ID of the user whose favorite agents to retrieve\n * @param params - Pagination parameters\n * @param options - Optional request options\n * @returns Promise resolving to list of favorite agents\n */\n async getUserFavoriteAgents(\n userId: number,\n params: Pick<FavoriteQuery, 'limit' | 'offset'> = {},\n options?: globalThis.RequestInit,\n ): Promise<FavoriteListResponse> {\n log('Getting favorite agents for user: %d', userId);\n\n const queryParams: Record<string, string> = {};\n if (params.limit !== undefined) queryParams.limit = String(params.limit);\n if (params.offset !== undefined) queryParams.offset = String(params.offset);\n\n const queryString = this.buildQueryString(queryParams);\n\n const result = await this.request<FavoriteListResponse>(\n `/v1/user/favorites/${userId}/agents${queryString}`,\n options,\n );\n\n log('Favorite agents retrieved for user: %d', userId);\n return result;\n }\n\n /**\n * Get user's favorite plugins with details\n *\n * Retrieves a user's favorite plugins with full details.\n * This is a public endpoint - no authentication required.\n *\n * @param userId - The ID of the user whose favorite plugins to retrieve\n * @param params - Pagination parameters\n * @param options - Optional request options\n * @returns Promise resolving to list of favorite plugins\n */\n async getUserFavoritePlugins(\n userId: number,\n params: Pick<FavoriteQuery, 'limit' | 'offset'> = {},\n options?: globalThis.RequestInit,\n ): Promise<FavoriteListResponse> {\n log('Getting favorite plugins for user: %d', userId);\n\n const queryParams: Record<string, string> = {};\n if (params.limit !== undefined) queryParams.limit = String(params.limit);\n if (params.offset !== undefined) queryParams.offset = String(params.offset);\n\n const queryString = this.buildQueryString(queryParams);\n\n const result = await this.request<FavoriteListResponse>(\n `/v1/user/favorites/${userId}/plugins${queryString}`,\n options,\n );\n\n log('Favorite plugins retrieved for user: %d', userId);\n return result;\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type {\n CheckLikeResponse,\n InteractionTargetType,\n LikeListResponse,\n LikeQuery,\n LikeRequest,\n SuccessResponse,\n ToggleLikeResponse,\n} from '../../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:user-like');\n\n/**\n * User Like Service\n *\n * Provides access to user like functionality in the LobeHub Marketplace.\n * This service handles liking/unliking content and retrieving like lists.\n */\nexport class UserLikeService extends BaseSDK {\n /**\n * Like content\n *\n * Likes an agent or plugin for the authenticated user.\n * Requires authentication.\n *\n * @param targetType - The type of target ('agent' or 'plugin')\n * @param targetId - The ID of the target agent/plugin\n * @param options - Optional request options\n * @returns Promise resolving to success response\n * @throws Error if already liked\n */\n async like(\n targetType: InteractionTargetType,\n targetId: string,\n options?: globalThis.RequestInit,\n ): Promise<SuccessResponse> {\n log('Liking: %s %d', targetType, targetId);\n\n const body: LikeRequest = { targetId, targetType };\n\n const result = await this.request<SuccessResponse>('/v1/user/likes', {\n body: JSON.stringify(body),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('Successfully liked: %s %d', targetType, targetId);\n return result;\n }\n\n /**\n * Unlike content\n *\n * Unlikes an agent or plugin for the authenticated user.\n * Requires authentication.\n *\n * @param targetType - The type of target ('agent' or 'plugin')\n * @param targetId - The ID of the target agent/plugin\n * @param options - Optional request options\n * @returns Promise resolving to success response\n * @throws Error if like not found\n */\n async unlike(\n targetType: InteractionTargetType,\n targetId: string,\n options?: globalThis.RequestInit,\n ): Promise<SuccessResponse> {\n log('Unliking: %s %d', targetType, targetId);\n\n const body: LikeRequest = { targetId, targetType };\n\n const result = await this.request<SuccessResponse>('/v1/user/likes', {\n body: JSON.stringify(body),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'DELETE',\n ...options,\n });\n\n log('Successfully unliked: %s %d', targetType, targetId);\n return result;\n }\n\n /**\n * Toggle like status\n *\n * Toggles the like status - likes if not liked, unlikes if already liked.\n * Requires authentication.\n *\n * @param targetType - The type of target ('agent' or 'plugin')\n * @param targetId - The ID of the target agent/plugin\n * @param options - Optional request options\n * @returns Promise resolving to toggle response with new like status\n */\n async toggleLike(\n targetType: InteractionTargetType,\n targetId: string,\n options?: globalThis.RequestInit,\n ): Promise<ToggleLikeResponse> {\n log('Toggling like: %s %d', targetType, targetId);\n\n const body: LikeRequest = { targetId, targetType };\n\n const result = await this.request<ToggleLikeResponse>('/v1/user/likes/toggle', {\n body: JSON.stringify(body),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('Like toggled, new status: %O', result);\n return result;\n }\n\n /**\n * Check like status\n *\n * Checks if the authenticated user has liked a specific agent or plugin.\n * Requires authentication.\n *\n * @param targetType - The type of target ('agent' or 'plugin')\n * @param targetId - The ID of the target agent/plugin\n * @param options - Optional request options\n * @returns Promise resolving to like status\n */\n async checkLike(\n targetType: InteractionTargetType,\n targetId: number,\n options?: globalThis.RequestInit,\n ): Promise<CheckLikeResponse> {\n log('Checking like status: %s %d', targetType, targetId);\n\n const queryString = this.buildQueryString({\n targetId: String(targetId),\n targetType,\n });\n\n const result = await this.request<CheckLikeResponse>(\n `/v1/user/likes/check${queryString}`,\n options,\n );\n\n log('Like status retrieved: %O', result);\n return result;\n }\n\n /**\n * Get my likes\n *\n * Retrieves the authenticated user's likes.\n * Requires authentication.\n *\n * @param params - Query parameters for filtering and pagination\n * @param options - Optional request options\n * @returns Promise resolving to list of likes\n */\n async getMyLikes(\n params: LikeQuery = {},\n options?: globalThis.RequestInit,\n ): Promise<LikeListResponse> {\n log('Getting my likes: %O', params);\n\n const queryParams: Record<string, string> = {};\n if (params.limit !== undefined) queryParams.limit = String(params.limit);\n if (params.offset !== undefined) queryParams.offset = String(params.offset);\n if (params.type !== undefined) queryParams.type = params.type;\n\n const queryString = this.buildQueryString(queryParams);\n\n const result = await this.request<LikeListResponse>(\n `/v1/user/likes/me${queryString}`,\n options,\n );\n\n log('My likes retrieved');\n return result;\n }\n\n /**\n * Get user's likes\n *\n * Retrieves a user's likes.\n * This is a public endpoint - no authentication required.\n *\n * @param userId - The ID of the user whose likes to retrieve\n * @param params - Query parameters for filtering and pagination\n * @param options - Optional request options\n * @returns Promise resolving to list of likes\n */\n async getUserLikes(\n userId: number,\n params: LikeQuery = {},\n options?: globalThis.RequestInit,\n ): Promise<LikeListResponse> {\n log('Getting likes for user: %d', userId);\n\n const queryParams: Record<string, string> = {};\n if (params.limit !== undefined) queryParams.limit = String(params.limit);\n if (params.offset !== undefined) queryParams.offset = String(params.offset);\n if (params.type !== undefined) queryParams.type = params.type;\n\n const queryString = this.buildQueryString(queryParams);\n\n const result = await this.request<LikeListResponse>(\n `/v1/user/likes/${userId}${queryString}`,\n options,\n );\n\n log('Likes retrieved for user: %d', userId);\n return result;\n }\n\n /**\n * Get user's liked agents with details\n *\n * Retrieves a user's liked agents with full details.\n * This is a public endpoint - no authentication required.\n *\n * @param userId - The ID of the user whose liked agents to retrieve\n * @param params - Pagination parameters\n * @param options - Optional request options\n * @returns Promise resolving to list of liked agents\n */\n async getUserLikedAgents(\n userId: number,\n params: Pick<LikeQuery, 'limit' | 'offset'> = {},\n options?: globalThis.RequestInit,\n ): Promise<LikeListResponse> {\n log('Getting liked agents for user: %d', userId);\n\n const queryParams: Record<string, string> = {};\n if (params.limit !== undefined) queryParams.limit = String(params.limit);\n if (params.offset !== undefined) queryParams.offset = String(params.offset);\n\n const queryString = this.buildQueryString(queryParams);\n\n const result = await this.request<LikeListResponse>(\n `/v1/user/likes/${userId}/agents${queryString}`,\n options,\n );\n\n log('Liked agents retrieved for user: %d', userId);\n return result;\n }\n\n /**\n * Get user's liked plugins with details\n *\n * Retrieves a user's liked plugins with full details.\n * This is a public endpoint - no authentication required.\n *\n * @param userId - The ID of the user whose liked plugins to retrieve\n * @param params - Pagination parameters\n * @param options - Optional request options\n * @returns Promise resolving to list of liked plugins\n */\n async getUserLikedPlugins(\n userId: number,\n params: Pick<LikeQuery, 'limit' | 'offset'> = {},\n options?: globalThis.RequestInit,\n ): Promise<LikeListResponse> {\n log('Getting liked plugins for user: %d', userId);\n\n const queryParams: Record<string, string> = {};\n if (params.limit !== undefined) queryParams.limit = String(params.limit);\n if (params.offset !== undefined) queryParams.offset = String(params.offset);\n\n const queryString = this.buildQueryString(queryParams);\n\n const result = await this.request<LikeListResponse>(\n `/v1/user/likes/${userId}/plugins${queryString}`,\n options,\n );\n\n log('Liked plugins retrieved for user: %d', userId);\n return result;\n }\n}\n","import { z } from 'zod';\n\n/**\n * Visibility levels for plugins in the marketplace\n * - public: Visible to all users\n * - private: Visible only to the owner and authorized users\n * - internal: Visible only within the organization\n */\nexport const VisibilityEnumSchema = z.enum(['public', 'private', 'internal']);\n\n/**\n * Publication status options for plugins\n * - published: Publicly available in the marketplace\n * - unpublished: Not publicly visible\n * - archived: Marked as no longer maintained\n * - deprecated: Marked as deprecated, but still available\n */\nexport const StatusEnumSchema = z.enum(['published', 'unpublished', 'archived', 'deprecated']);\n\n/**\n * Common query parameters for admin list endpoints\n * These parameters are used for pagination, filtering, and sorting.\n */\nexport interface AdminListQueryParams {\n /** Current page number (1-based) */\n current?: number;\n /** Search keyword for filtering results */\n keyword?: string;\n /** Number of items per page */\n pageSize?: number;\n /** Field to sort results by */\n sortField?: string;\n /** Sort direction */\n sortOrder?: 'ascend' | 'descend';\n}\n\n/**\n * Common response format for paginated admin list endpoints\n * This structure provides both the data and pagination information.\n */\nexport interface AdminListResponse<T> {\n /** Current page number (1-based) */\n current: number;\n /** Array of items for the current page */\n data: T[];\n /** Number of items per page */\n pageSize: number;\n /** Total number of items across all pages */\n total: number;\n /** Total number of pages */\n totalPages: number;\n}\n\n/**\n * Review status options\n * - pending: Awaiting review\n * - approved: Review approved\n * - rejected: Review rejected\n */\nexport type ReviewStatus = 'pending' | 'approved' | 'rejected';\n\n/**\n * Review status schema for validation\n */\nexport const ReviewStatusEnumSchema = z.enum(['published', 'draft', 'review', 'rejected']);\n\n/**\n * Parameters for admin plugin listing\n * Extends the common query parameters with plugin-specific filters.\n */\nexport interface AdminPluginParams {\n /** Filter for featured plugins */\n featured?: boolean;\n /** Maximum number of items to return */\n limit?: number;\n /** Number of items to skip */\n offset?: number;\n /** Sort direction */\n order?: 'asc' | 'desc';\n /** Field to sort by */\n orderBy?: 'createdAt' | 'updatedAt' | 'installCount' | 'ratingAverage' | 'githubUpdateAt';\n /** Filter by owner ID */\n ownerId?: number;\n /** Search query string */\n query?: string;\n /** Filter by plugin status */\n status?: 'published' | 'draft' | 'review' | 'rejected';\n /** Filter by visibility level */\n visibility?: 'public' | 'private' | 'unlisted';\n}\n\n/**\n * Parameters for creating a new plugin version\n */\nexport interface PluginVersionCreateParams {\n /** Author or organization name for this version */\n author?: string;\n /** URL to the author's website or profile */\n authorUrl?: string;\n /** Capability flag: whether this plugin provides prompts */\n capabilitiesPrompts?: boolean;\n /** Capability flag: whether this plugin manages resources (MCP) */\n capabilitiesResources?: boolean;\n /** Capability flag: whether this plugin provides tools */\n capabilitiesTools?: boolean;\n /** Category key for the plugin */\n category?: string;\n /** Description of the plugin version */\n description?: string;\n /** Icon URL or emoji for the plugin */\n icon?: string;\n /** Whether this is the latest version */\n isLatest?: boolean;\n /** Whether this version has been validated */\n isValidated?: boolean;\n /** Name of the plugin version */\n name?: string;\n /** Array of prompt definitions */\n prompts?: any[];\n /** README content */\n readme?: string;\n /** Array of resource definitions */\n resources?: any[];\n /** Summary of the plugin version */\n summary?: string;\n /** Array of tags for categorization */\n tags?: string[];\n /** Array of tool definitions */\n tools?: any[];\n /** Semantic version string (e.g., \"1.0.0\") */\n version: string;\n}\n\n/**\n * Parameters for updating an existing plugin version\n */\nexport interface PluginVersionUpdateParams {\n /** Author or organization name for this version */\n author?: string;\n /** URL to the author's website or profile */\n authorUrl?: string;\n /** Capability flag: whether this plugin provides prompts */\n capabilitiesPrompts?: boolean;\n /** Capability flag: whether this plugin manages resources (MCP) */\n capabilitiesResources?: boolean;\n /** Capability flag: whether this plugin provides tools */\n capabilitiesTools?: boolean;\n /** Category key for the plugin */\n category?: string;\n /** Description of the plugin version */\n description?: string;\n /** Icon URL or emoji for the plugin */\n icon?: string;\n /** Whether this version has been validated */\n isValidated?: boolean;\n /** Name of the plugin version */\n name?: string;\n /** Array of prompt definitions */\n prompts?: any[];\n /** README content */\n readme?: string;\n /** Array of resource definitions */\n resources?: any[];\n /** Summary of the plugin version */\n summary?: string;\n /** Array of tags for categorization */\n tags?: string[];\n /** Array of tool definitions */\n tools?: any[];\n}\n\n/**\n * Parameters for updating plugin basic metadata (non-version specific)\n */\nexport interface PluginUpdateParams {\n /** Cloud endpoint URL for official cloud-hosted deployment */\n cloudEndpoint?: string;\n /** GitHub last update timestamp */\n githubUpdateAt?: string;\n /** Unique identifier for the plugin */\n identifier?: string;\n /** Whether this plugin has been claimed by its original author */\n isClaimed?: boolean;\n /** Whether this plugin is featured */\n isFeatured?: boolean;\n /** Whether this plugin is officially maintained by LobeHub */\n isOfficial?: boolean;\n /** Publication status */\n status?: 'published' | 'draft' | 'review' | 'rejected';\n /** Visibility level */\n visibility?: 'public' | 'private' | 'unlisted';\n}\n\n/**\n * Plugin localization data\n */\nexport interface PluginLocalization {\n /** Plugin description in specific locale */\n description: string;\n /** Locale identifier (e.g., 'en-US', 'zh-CN') */\n locale: string;\n /** Plugin name in specific locale */\n name: string;\n /** Summary in specific locale */\n summary?: string;\n /** Plugin tags in specific locale */\n tags?: string[];\n}\n\n/**\n * Parameters for importing plugin i18n data\n */\nexport interface PluginI18nImportParams {\n /** Plugin identifier */\n identifier: string;\n /** Array of localizations for this plugin version */\n localizations: PluginLocalization[];\n /** Plugin version */\n version: string;\n}\n\n/**\n * Response from plugin i18n import operation\n */\nexport interface PluginI18nImportResponse {\n /** Number of failed localizations */\n failed: number;\n /** Number of successful localizations */\n success: number;\n /** Total number of processed localizations */\n totalLocalizations: number;\n}\n\n/**\n * Unclaimed plugin item data structure\n * Represents a plugin that has not been claimed by its author\n */\nexport interface UnclaimedPluginItem {\n /** Plugin ID */\n id: number;\n /** Plugin identifier */\n identifier: string;\n}\n","/**\n * Trusted Client Token Utilities\n *\n * Provides encryption utilities for creating trusted client tokens\n * that can be used with the Market SDK.\n *\n * @example\n * ```typescript\n * import { createTrustedClientToken, TrustedClientPayload } from '@lobehub/market-sdk';\n *\n * const payload: TrustedClientPayload = {\n * userId: 'user_xxx',\n * clientId: 'lobechat-com',\n * email: 'user@example.com',\n * timestamp: Date.now(),\n * nonce: generateNonce(),\n * name: 'John Doe',\n * };\n *\n * const token = createTrustedClientToken(payload, secret);\n *\n * // Use with MarketSDK\n * const sdk = new MarketSDK({ trustedClientToken: token });\n * ```\n */\n\nimport { createCipheriv, createHash, randomBytes } from 'node:crypto';\n\n/**\n * Trusted client payload structure\n */\nexport interface TrustedClientPayload {\n /** Client identifier (must be in the trusted clients whitelist) */\n clientId: string;\n /** User email address (required) */\n email: string;\n /** Whether the email is verified */\n emailVerified?: boolean;\n /** User display name */\n name?: string;\n /** Random nonce for uniqueness */\n nonce: string;\n /** Unix timestamp in milliseconds when token was created */\n timestamp: number;\n /** Clerk user ID (format: user_xxx) */\n userId: string;\n}\n\n// Crypto constants\nconst CRYPTO = {\n ALGORITHM: 'aes-256-gcm' as const,\n AUTH_TAG_LENGTH: 16,\n IV_LENGTH: 12,\n KEY_LENGTH: 32,\n};\n\nconst SECRET_PREFIX = 'lobehub-market_tcs_';\n\n/**\n * Derive a 32-byte encryption key from the secret\n */\nfunction deriveKey(secret: string): Buffer {\n if (secret.startsWith(SECRET_PREFIX)) {\n return createHash('sha256').update(secret).digest();\n }\n\n const key = Buffer.from(secret, 'hex');\n\n if (key.length !== CRYPTO.KEY_LENGTH) {\n throw new Error(\n `Invalid key length: expected ${CRYPTO.KEY_LENGTH} bytes, got ${key.length} bytes.`,\n );\n }\n\n return key;\n}\n\n/**\n * Encrypt a trusted client payload\n *\n * @param payload - The payload to encrypt\n * @param secret - The shared secret (prefixed format or 64-char hex)\n * @returns Base64-encoded encrypted token\n */\nexport function createTrustedClientToken(payload: TrustedClientPayload, secret: string): string {\n const plaintext = JSON.stringify(payload);\n const key = deriveKey(secret);\n const iv = randomBytes(CRYPTO.IV_LENGTH);\n\n const cipher = createCipheriv(CRYPTO.ALGORITHM, key, iv);\n const ciphertext = Buffer.concat([cipher.update(plaintext, 'utf8'), cipher.final()]);\n const authTag = cipher.getAuthTag();\n\n return Buffer.concat([iv, ciphertext, authTag]).toString('base64');\n}\n\n/**\n * Generate a random nonce for the payload\n *\n * @param length - Length of the nonce (default: 8)\n * @returns Random alphanumeric string\n */\nexport function generateNonce(length = 8): string {\n const bytes = randomBytes(Math.ceil(length / 2));\n return bytes.toString('hex').slice(0, length);\n}\n\n/**\n * Create a complete trusted client payload with auto-generated timestamp and nonce\n *\n * @param params - User and client info\n * @returns Complete payload ready for encryption\n */\nexport function buildTrustedClientPayload(params: {\n clientId: string;\n email: string;\n emailVerified?: boolean;\n name?: string;\n userId: string;\n}): TrustedClientPayload {\n return {\n ...params,\n nonce: generateNonce(),\n timestamp: Date.now(),\n };\n}\n","/**\n * LobeHub Market JavaScript SDK\n *\n * This is the main entry point for the LobeHub Market SDK.\n * It exports the primary client classes and all type definitions.\n */\n\n// Export admin-related functionality\nexport { MarketAdmin } from './admin';\n\n// Export market-related functionality\nexport { MarketSDK } from './market';\n\n// Export SDK-specific types\nexport * from './types';\n\n// Export trusted client utilities\nexport {\n buildTrustedClientPayload,\n createTrustedClientToken,\n generateNonce,\n type TrustedClientPayload,\n} from './utils/trustedClient';\n\n// Re-export all type definitions from the types package\nexport * from '@lobehub/market-types';\n"],"mappings":";AAAA,OAAOA,YAAW;;;ACAlB,OAAO,WAAW;AAClB,SAAS,eAAe;AACxB,OAAO,aAAa;AAKpB,IAAM,MAAM,MAAM,sBAAsB;AAajC,IAAM,UAAN,MAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA8BnB,YACE,UAA4B,CAAC,GAC7B,eACA,kBACA;AAEA,SAAK,UAAU,QAAQ,WAAW,QAAQ,IAAI,mBAAmB;AACjE,SAAK,aAAa,QAAQ,KAAK,SAAS,KAAK;AAC7C,SAAK,eAAe,QAAQ,KAAK,SAAS,OAAO;AAGjD,SAAK,gBAAgB,QAAQ,iBAAiB;AAE9C,SAAK,qBAAqB,QAAQ;AAClC,SAAK,WAAW,QAAQ;AACxB,SAAK,eAAe,QAAQ;AAG5B,SAAK,mBAAmB;AAGxB,UAAM,SAAS,QAAQ,UAAU,QAAQ,IAAI;AAG7C,QAAI,eAAe;AACjB,WAAK,UAAU;AACf,UAAI,6BAA6B;AAAA,IACnC,OAAO;AACL,WAAK,UAAU;AAAA,QACb,gBAAgB;AAAA,MAClB;AACA,UAAI,4BAA4B;AAAA,IAClC;AAIA,QAAI,QAAQ;AACV,WAAK,QAAQ,gBAAgB,UAAU,MAAM;AAAA,IAC/C;AAGA,QAAI,KAAK,oBAAoB;AAC3B,WAAK,QAAQ,gBAAgB,UAAU,KAAK,kB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AmB;AAuBxD,IAAM,SAAS;AAAA,EACb,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,YAAY;AACd;AAEA,IAAM,gBAAgB;AAKtB,SAAS,UAAU,QAAwB;AACzC,MAAI,OAAO,WAAW,aAAa,GAAG;AACpC,WAAO,WAAW,QAAQ,EAAE,OAAO,MAAM,EAAE,OAAO;AAAA,EACpD;AAEA,QAAM,MAAM,OAAO,KAAK,QAAQ,KAAK;AAErC,MAAI,IAAI,WAAW,OAAO,YAAY;AACpC,UAAM,IAAI;AAAA,MACR,gCAAgC,OAAO,UAAU,eAAe,IAAI,MAAM;AAAA,IAC5E;AAAA,EACF;AAEA,SAAO;AACT;AASO,SAAS,yBAAyB,SAA+B,QAAwB;AAC9F,QAAM,YAAY,KAAK,UAAU,OAAO;AACxC,QAAM,MAAM,UAAU,MAAM;AAC5B,QAAM,KAAK,YAAY,OAAO,SAAS;AAEvC,QAAM,SAAS,eAAe,OAAO,WAAW,KAAK,EAAE;AACvD,QAAM,aAAa,OAAO,OAAO,CAAC,OAAO,OAAO,WAAW,MAAM,GAAG,OAAO,MAAM,CAAC,CAAC;AACnF,QAAM,UAAU,OAAO,WAAW;AAElC,SAAO,OAAO,OAAO,CAAC,IAAI,YAAY,OAAO,CAAC,EAAE,SAAS,QAAQ;AACnE;AAQO,SAAS,cAAc,SAAS,GAAW;AAChD,QAAM,QAAQ,YAAY,KAAK,KAAK,SAAS,CAAC,CAAC;AAC/C,SAAO,MAAM,SAAS,KAAK,EAAE,MAAM,GAAG,MAAM;AAC9C;AAQO,SAAS,0BAA0B,QAMjB;AACvB,SAAO;AAAA,IACL,GAAG;AAAA,IACH,OAAO,cAAc;AAAA,IACrB,WAAW,KAAK,IAAI;AAAA,EACtB;AACF;;;ACpGA,cAAc;","names":["debug","debug","log","debug","debug","log","debug","debug","log","debug","debug","log","debug","debug","log","debug","debug","log","debug","debug","log","debug","log","debug","debug","debug","log","debug","AgentService","debug","urlJoin","log","debug","urlJoin","debug","urlJoin","log","debug","urlJoin","debug","log","debug","debug","log","debug","debug","log","debug","debug","log","debug","debug","log","debug","debug","log","debug","log","debug","AgentService"]}
|
|
1
|
+
{"version":3,"sources":["../src/admin/MarketAdmin.ts","../src/core/BaseSDK.ts","../src/admin/services/AgentService.ts","../src/admin/services/AnalysisService.ts","../src/admin/services/PluginService.ts","../src/admin/services/SystemDependencyService.ts","../src/admin/services/SettingsService.ts","../src/admin/services/ReviewService.ts","../src/admin/services/PluginEnvService.ts","../src/market/market-sdk.ts","../src/market/services/AgentService.ts","../src/market/services/AuthService.ts","../src/market/services/DiscoveryService.ts","../src/market/services/FeedbackService.ts","../src/market/services/PluginsService.ts","../src/market/services/UserService.ts","../src/market/services/UserFollowService.ts","../src/market/services/UserFavoriteService.ts","../src/market/services/UserLikeService.ts","../src/types/admin.ts","../src/utils/trustedClient.ts","../src/index.ts"],"sourcesContent":["import debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\nimport { MarketSDKOptions } from '@/types';\n\nimport {\n AgentService,\n AnalysisService,\n PluginEnvService,\n PluginService,\n ReviewService,\n SettingsService,\n SystemDependencyService,\n} from './services';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:admin');\n\n/**\n * LobeHub Market Admin SDK Client\n *\n * Client for accessing administrative functionality of the LobeHub Marketplace.\n * This SDK provides privileged operations for managing agents, plugins, reviews,\n * system settings, and dependencies. It requires admin-level authentication.\n */\nexport class MarketAdmin extends BaseSDK {\n /**\n * Agent management service\n * Provides methods for creating, updating, and managing agents\n */\n readonly agents: AgentService;\n\n /**\n * Market analysis service\n * Provides methods for accessing market analytics and statistics\n */\n readonly analysis: AnalysisService;\n\n /**\n * Plugin environment service\n */\n readonly env: PluginEnvService;\n\n /**\n * Plugin management service\n * Provides methods for creating, updating, and managing plugins\n */\n readonly plugins: PluginService;\n\n /**\n * Review management service\n * Provides methods for moderating and managing user reviews\n */\n readonly reviews: ReviewService;\n\n /**\n * System settings management service\n * Provides methods for configuring marketplace settings\n */\n readonly settings: SettingsService;\n\n /**\n * System dependency management service\n * Provides methods for managing system dependencies required by plugins\n */\n readonly dependencies: SystemDependencyService;\n\n /**\n * Creates a new MarketAdmin instance\n *\n * @param options - Configuration options for the SDK\n */\n constructor(options: MarketSDKOptions = {}) {\n // Use admin-specific API key if available\n const apiKey = options.apiKey || process.env.MARKET_ADMIN_API_KEY;\n\n // Create shared token state object for all services\n const sharedTokenState = {\n accessToken: undefined,\n tokenExpiry: undefined,\n };\n\n super({ ...options, apiKey }, undefined, sharedTokenState);\n log('MarketAdmin instance created');\n\n // Initialize admin services with shared headers and token state for efficient reuse\n this.agents = new AgentService(options, this.headers, sharedTokenState);\n this.analysis = new AnalysisService(options, this.headers, sharedTokenState);\n this.dependencies = new SystemDependencyService(options, this.headers, sharedTokenState);\n this.env = new PluginEnvService(options, this.headers, sharedTokenState);\n this.plugins = new PluginService(options, this.headers, sharedTokenState);\n this.reviews = new ReviewService(options, this.headers, sharedTokenState);\n this.settings = new SettingsService(options, this.headers, sharedTokenState);\n }\n}\n","import debug from 'debug';\nimport { SignJWT } from 'jose';\nimport urlJoin from 'url-join';\n\nimport type { MarketSDKOptions, SharedTokenState } from '../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:core');\n\n/**\n * Base SDK class\n *\n * Provides shared request handling and authentication functionality that is used\n * by both the Market SDK and Admin SDK. This class handles the common concerns:\n * - API endpoint configuration\n * - Authentication header management\n * - HTTP request handling\n * - Error handling\n * - Query string building\n */\nexport class BaseSDK {\n /** Base API URL */\n protected apiBaseUrl: string;\n /** Base URL */\n protected baseUrl: string;\n /** OAuth URL */\n protected oauthBaseUrl: string;\n\n /** Default locale for requests that require localization */\n protected defaultLocale: string;\n\n /** HTTP headers to include with all requests */\n protected headers: Record<string, string>;\n\n private clientId?: string;\n private clientSecret?: string;\n private readonly initialAccessToken?: string;\n private accessToken?: string;\n private tokenExpiry?: number;\n\n // Shared token state for all instances\n private sharedTokenState?: SharedTokenState;\n\n /**\n * Creates a new BaseSDK instance\n *\n * @param options - Configuration options for the SDK\n * @param sharedHeaders - Optional shared headers object for reuse across services\n * @param sharedTokenState - Optional shared token state object for reuse across services\n */\n constructor(\n options: MarketSDKOptions = {},\n sharedHeaders?: Record<string, string>,\n sharedTokenState?: SharedTokenState,\n ) {\n // Set base URL from options, environment variable, or default to production URL\n this.baseUrl = options.baseURL || process.env.MARKET_BASE_URL || 'https://market.lobehub.com';\n this.apiBaseUrl = urlJoin(this.baseUrl, 'api');\n this.oauthBaseUrl = urlJoin(this.baseUrl, 'oauth');\n\n // Set default locale from options or use English as default\n this.defaultLocale = options.defaultLocale || 'en-US';\n\n this.initialAccessToken = options.accessToken;\n this.clientId = options.clientId;\n this.clientSecret = options.clientSecret;\n\n // Share token state across instances if provided\n this.sharedTokenState = sharedTokenState;\n\n // Get API key from options or environment variable\n const apiKey = options.apiKey || process.env.MARKET_API_KEY;\n\n // Either use shared headers or create new headers object\n if (sharedHeaders) {\n this.headers = sharedHeaders;\n log('Using shared headers object');\n } else {\n this.headers = {\n 'Content-Type': 'application/json',\n };\n log('Created new headers object');\n }\n\n // If an apiKey is provided, use it for authorization.\n // This will be overridden by M2M auth if credentials are also provided.\n if (apiKey) {\n this.headers.Authorization = `Bearer ${apiKey}`;\n }\n\n // If an accessToken is provided on init, it takes precedence.\n if (this.initialAccessToken) {\n this.headers.Authorization = `Bearer ${this.initialAccessToken}`;\n }\n\n // If a trusted client token is provided, set the x-lobe-trust-token header\n if (options.trustedClientToken) {\n this.headers['x-lobe-trust-token'] = options.trustedClientToken;\n log('Trusted client token configured');\n }\n\n log('BaseSDK instance created: %O', {\n baseUrl: this.baseUrl,\n defaultLocale: this.defaultLocale,\n hasApiKey: !!apiKey,\n hasInitialAccessToken: !!this.initialAccessToken,\n hasM2MCredentials: !!this.clientId,\n hasSharedTokenState: !!this.sharedTokenState,\n hasTrustedClientToken: !!options.trustedClientToken,\n });\n }\n\n /**\n * Sends an HTTP request to the API and handles the response\n *\n * @param url - Request URL path (will be appended to baseUrl)\n * @param options - Fetch API request options\n * @returns Promise resolving to the parsed JSON response\n * @throws Error if the request fails\n */\n // eslint-disable-next-line no-undef\n protected async request<T>(url: string, options: RequestInit = {}): Promise<T> {\n const requestUrl = urlJoin(this.apiBaseUrl, url);\n log('Sending request: %s', requestUrl);\n\n // If no access token was provided on init, and we have M2M creds, run the auth flow.\n if (!this.initialAccessToken && this.clientId && this.clientSecret) {\n await this.setM2MAuthToken();\n }\n\n const mergedHeaders = {\n ...this.headers,\n ...options.headers,\n };\n log('Request headers: %O', mergedHeaders);\n\n const response = await fetch(requestUrl, {\n ...options,\n headers: mergedHeaders,\n });\n\n if (!response.ok) {\n const errorMsg = `Request failed: ${response.status} ${response.statusText}`;\n try {\n const errorBody = await response.json();\n\n console.error('Request error: %s', JSON.stringify(errorBody));\n\n throw new Error(`${errorMsg} - ${JSON.stringify(errorBody)}`);\n } catch {\n throw new Error(errorMsg);\n }\n }\n\n log('Request successful: %s', url);\n return response.json() as Promise<T>;\n }\n\n /**\n * Builds a URL query string from a parameters object\n *\n * @param params - Object containing query parameters\n * @returns Formatted query string (including leading ? if params exist)\n */\n protected buildQueryString(params: Record<string, any>): string {\n const query = Object.entries(params)\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n .filter(([_, value]) => value !== undefined && value !== null)\n .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`)\n .join('&');\n\n return query ? `?${query}` : '';\n }\n\n /**\n * Sets an authentication token for API requests\n *\n * @param token - API authentication token\n */\n setAuthToken(token: string): void {\n log('Setting authentication token');\n this.accessToken = undefined;\n this.tokenExpiry = undefined;\n\n // Clear shared token state if it exists\n if (this.sharedTokenState) {\n this.sharedTokenState.accessToken = undefined;\n this.sharedTokenState.tokenExpiry = undefined;\n }\n\n this.headers.Authorization = `Bearer ${token}`;\n }\n\n /**\n * Clears the authentication token\n */\n clearAuthToken(): void {\n log('Clearing authentication token');\n this.accessToken = undefined;\n this.tokenExpiry = undefined;\n\n // Clear shared token state if it exists\n if (this.sharedTokenState) {\n this.sharedTokenState.accessToken = undefined;\n this.sharedTokenState.tokenExpiry = undefined;\n }\n\n delete this.headers.Authorization;\n }\n\n /**\n * Fetches an M2M access token.\n * This method is designed for server-side use cases where you need to manage the token lifecycle\n * (e.g., storing it in a cookie).\n *\n * @returns A promise that resolves to an object containing the access token and its expiry time.\n */\n public async fetchM2MToken(): Promise<{ accessToken: string; expiresIn: number }> {\n if (!this.clientId || !this.clientSecret) {\n throw new Error('clientId and clientSecret are required to fetch an M2M token.');\n }\n\n log('Fetching M2M token for server-side use');\n\n const assertion = await this.createClientAssertion();\n const tokenData = await this.exchangeTokenForServer(assertion);\n\n log('M2M token fetched successfully');\n\n return {\n accessToken: tokenData.access_token,\n expiresIn: tokenData.expires_in || 3600,\n };\n }\n\n private async createClientAssertion(): Promise<string> {\n if (!this.clientId || !this.clientSecret) {\n throw new Error('Missing clientId or clientSecret for M2M authentication.');\n }\n\n const secret = new TextEncoder().encode(this.clientSecret);\n\n const tokenEndpoint = `${this.oauthBaseUrl}/token`;\n\n return await new SignJWT({})\n .setProtectedHeader({ alg: 'HS256' })\n .setIssuer(this.clientId)\n .setSubject(this.clientId)\n .setAudience(tokenEndpoint)\n .setJti(crypto.randomUUID())\n .setIssuedAt()\n .setExpirationTime('5m')\n .sign(secret);\n }\n\n private async exchangeToken(clientAssertion: string): Promise<string> {\n const tokenData = await this.exchangeTokenForServer(clientAssertion);\n\n // Calculate token expiry time (current time + expires_in seconds - 60 seconds buffer)\n const expiresInSeconds = tokenData.expires_in || 3600; // Default to 1 hour if not provided\n this.tokenExpiry = Date.now() + (expiresInSeconds - 60) * 1000; // 60 seconds buffer\n\n return tokenData.access_token;\n }\n\n private async exchangeTokenForServer(clientAssertion: string): Promise<any> {\n const tokenEndpoint = urlJoin(this.oauthBaseUrl, 'token');\n log('Exchanging token at endpoint: %s', tokenEndpoint);\n\n const params = new URLSearchParams();\n params.append('grant_type', 'client_credentials');\n params.append(\n 'client_assertion_type',\n 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',\n );\n params.append('client_assertion', clientAssertion);\n\n const response = await fetch(tokenEndpoint, {\n body: params,\n headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n method: 'POST',\n });\n\n const tokenData = await response.json();\n\n if (!response.ok) {\n throw new Error(`Token exchange failed: ${JSON.stringify(tokenData)}`);\n }\n\n return tokenData;\n }\n\n private async setM2MAuthToken(): Promise<void> {\n // Use shared token state if available\n const currentAccessToken = this.sharedTokenState?.accessToken || this.accessToken;\n const currentTokenExpiry = this.sharedTokenState?.tokenExpiry || this.tokenExpiry;\n\n log(\n 'Token check: hasSharedState=%s, hasCurrentToken=%s, tokenExpiry=%d, currentTime=%d',\n !!this.sharedTokenState,\n !!currentAccessToken,\n currentTokenExpiry || 0,\n Date.now(),\n );\n\n // Check if we have a valid token that hasn't expired\n if (currentAccessToken && currentTokenExpiry && Date.now() < currentTokenExpiry) {\n log(\n 'Using existing M2M access token (expires in %d seconds)',\n Math.floor((currentTokenExpiry - Date.now()) / 1000),\n );\n this.headers.Authorization = `Bearer ${currentAccessToken}`;\n return;\n }\n\n // Check if there's already a token request in progress (for shared state)\n if (this.sharedTokenState?.tokenPromise) {\n log('Token request already in progress, waiting for completion...');\n const token = await this.sharedTokenState.tokenPromise;\n this.headers.Authorization = `Bearer ${token}`;\n log('Using token from concurrent request');\n return;\n }\n\n log('Fetching new M2M access token...');\n\n // Create token request promise and store it in shared state\n const tokenPromise = this.fetchNewToken();\n if (this.sharedTokenState) {\n this.sharedTokenState.tokenPromise = tokenPromise;\n }\n\n try {\n const newAccessToken = await tokenPromise;\n\n // Update both local and shared token state\n this.accessToken = newAccessToken;\n this.headers.Authorization = `Bearer ${newAccessToken}`;\n\n if (this.sharedTokenState) {\n this.sharedTokenState.accessToken = newAccessToken;\n this.sharedTokenState.tokenExpiry = this.tokenExpiry;\n // Clear the promise since we're done\n this.sharedTokenState.tokenPromise = undefined;\n log(\n 'Updated shared token state (expires in %d seconds)',\n Math.floor(((this.tokenExpiry || 0) - Date.now()) / 1000),\n );\n }\n\n log('Successfully set new M2M access token');\n } catch (error) {\n // Clear the promise on error\n if (this.sharedTokenState) {\n this.sharedTokenState.tokenPromise = undefined;\n }\n throw error;\n }\n }\n\n private async fetchNewToken(): Promise<string> {\n const assertion = await this.createClientAssertion();\n return await this.exchangeToken(assertion);\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\nimport type { AdminListQueryParams, AdminListResponse, AgentItemDetail, AgentStatus } from '@/types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:admin:agents');\n\n/**\n * Admin Agent Item\n * Agent item with admin-specific fields for management\n */\nexport interface AdminAgentItem {\n /** Author information */\n author?: {\n avatar?: string;\n name?: string;\n userName?: string;\n };\n /** Avatar URL or emoji */\n avatar?: string;\n /** Category name */\n category?: string;\n /** Agent configuration */\n config?: any;\n /** Creation timestamp */\n createdAt: string;\n /** Description */\n description?: string;\n /** Agent ID */\n id: string;\n /** Agent identifier */\n identifier: string;\n /** Install count */\n installCount?: number;\n /** Whether featured */\n isFeatured?: boolean;\n /** Whether officially maintained */\n isOfficial: boolean;\n /** Number of knowledge bases attached */\n knowledgeCount?: number;\n /** Display name */\n name: string;\n /** Owner ID */\n ownerId: number;\n /** Number of plugins attached */\n pluginCount?: number;\n /** Provider ID */\n providerId?: number;\n /** Safety check result */\n safetyCheck?: string | null;\n /** Publication status */\n status?: string;\n /** Tags */\n tags?: string[];\n /** Token usage */\n tokenUsage?: number;\n /** Update timestamp */\n updatedAt: string;\n /** URL */\n url?: string;\n /** Version name */\n versionName?: string;\n /** Version number */\n versionNumber?: number;\n /** Version list */\n versions?: Array<{\n isLatest: boolean;\n isValidated: boolean;\n updatedAt: string;\n version: string;\n versionNumber: number;\n }>;\n}\n\n/**\n * Admin Agent Item Detail\n * Extended agent detail with admin-specific fields\n */\nexport interface AdminAgentItemDetail extends AgentItemDetail {\n /** Safety check result */\n safetyCheck?: string | null;\n}\n\n/**\n * Agent list query parameters for admin\n */\nexport interface AdminAgentListQueryParams extends AdminListQueryParams {\n /** Filter by category */\n category?: string;\n /** Filter by official status */\n isOfficial?: 'true' | 'false';\n /** Filter by namespace */\n namespace?: string;\n /** Filter by status */\n status?: 'published' | 'unpublished' | 'archived' | 'deprecated' | 'all';\n /** Filter by visibility */\n visibility?: 'public' | 'private' | 'internal' | 'all';\n}\n\n/**\n * Agent update parameters\n */\nexport interface AgentUpdateParams {\n /** Official homepage or repository URL for the agent */\n homepage?: string | null;\n /** Unique identifier for the agent */\n identifier?: string;\n /** Whether this agent is featured */\n isFeatured?: boolean;\n /** Whether this agent is officially maintained by LobeHub */\n isOfficial?: boolean;\n /** Default name of the agent */\n name?: string;\n /** Safety check result */\n safetyCheck?: string | null;\n /** Publication status */\n status?: 'published' | 'unpublished' | 'archived' | 'deprecated';\n /** Visibility level */\n visibility?: 'public' | 'private' | 'internal';\n}\n\n/**\n * Agent by status response item\n */\nexport interface AgentByStatusItem {\n id: number;\n identifier: string;\n name: string;\n status: AgentStatus;\n updatedAt: string | null;\n}\n\n/**\n * Agent version by status response item\n */\nexport interface AgentVersionByStatusItem {\n agentId: number;\n agentName: string;\n identifier: string;\n status: AgentStatus;\n updatedAt: string | null;\n version: string;\n versionId: number;\n}\n\n/**\n * Agent Management Service\n *\n * Provides administrative functionality for managing agents in the marketplace.\n * This service handles CRUD operations for agents, agent status, and visibility.\n */\nexport class AgentService extends BaseSDK {\n /**\n * Retrieves a list of agents with admin details\n *\n * Supports filtering, pagination, and sorting of results.\n *\n * @param params - Query parameters for filtering and pagination\n * @returns Promise resolving to the agent list response with admin details\n */\n async getAgents(\n params: AdminAgentListQueryParams = {},\n ): Promise<AdminListResponse<AdminAgentItem>> {\n log('Getting agents with params: %O', params);\n\n const queryString = this.buildQueryString(params);\n const url = `/admin/agents${queryString}`;\n\n const result = await this.request<AdminListResponse<AdminAgentItem>>(url);\n\n log('Retrieved %d agents', result.data.length);\n return result;\n }\n\n /**\n * Retrieves agents filtered by status\n *\n * @param status - The status to filter by\n * @returns Promise resolving to agents matching the status\n */\n async getAgentsByStatus(\n status: AgentStatus,\n ): Promise<{ data: AgentByStatusItem[]; total: number }> {\n log('Getting agents by status: %s', status);\n\n const result = await this.request<{ data: AgentByStatusItem[]; total: number }>(\n `/admin/agents/by-status/${status}`,\n );\n\n log('Retrieved %d agents with status %s', result.total, status);\n return result;\n }\n\n /**\n * Retrieves agent versions filtered by status\n *\n * @param status - The status to filter by\n * @returns Promise resolving to agent versions matching the status\n */\n async getAgentVersionsByStatus(\n status: AgentStatus,\n ): Promise<{ data: AgentVersionByStatusItem[]; total: number }> {\n log('Getting agent versions by status: %s', status);\n\n const result = await this.request<{ data: AgentVersionByStatusItem[]; total: number }>(\n `/admin/agents/versions/by-status/${status}`,\n );\n\n log('Retrieved %d agent versions with status %s', result.total, status);\n return result;\n }\n\n /**\n * Retrieves a single agent with full admin details\n *\n * @param id - Agent ID or identifier\n * @param options - Optional query parameters\n * @returns Promise resolving to the detailed agent information\n */\n async getAgent(\n id: number | string,\n options: { locale?: string; version?: string } = {},\n ): Promise<AdminAgentItemDetail> {\n log('Getting agent details (admin): %s', id);\n\n const queryString = this.buildQueryString(options);\n const result = await this.request<AdminAgentItemDetail>(`/admin/agents/${id}${queryString}`);\n\n log('Retrieved agent: %s', result.identifier);\n return result;\n }\n\n /**\n * Updates agent information\n *\n * @param id - Agent ID or identifier\n * @param data - Agent update data containing fields to update\n * @returns Promise resolving to the updated agent\n */\n async updateAgent(id: number | string, data: AgentUpdateParams): Promise<AdminAgentItem> {\n log('Updating agent: %s, data: %O', id, data);\n\n const result = await this.request<AdminAgentItem>(`/admin/agents/${id}`, {\n body: JSON.stringify(data),\n method: 'PUT',\n });\n\n log('Agent updated successfully');\n return result;\n }\n\n /**\n * Updates agent publication status\n *\n * @param id - Agent ID or identifier\n * @param status - New status to set\n * @returns Promise resolving to success response\n */\n async updateAgentStatus(\n id: number | string,\n status: 'published' | 'unpublished' | 'archived' | 'deprecated',\n ): Promise<{ message: string; success: boolean }> {\n log('Updating agent status: %s to %s', id, status);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/agents/${id}/status`,\n {\n body: JSON.stringify({ status }),\n method: 'PATCH',\n },\n );\n\n log('Agent status updated successfully');\n return result;\n }\n\n /**\n * Updates agent visibility\n *\n * @param id - Agent ID or identifier\n * @param visibility - New visibility setting\n * @returns Promise resolving to success response\n */\n async updateAgentVisibility(\n id: number | string,\n visibility: 'public' | 'private' | 'internal',\n ): Promise<{ message: string; success: boolean }> {\n log('Updating agent visibility: %s to %s', id, visibility);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/agents/${id}/visibility`,\n {\n body: JSON.stringify({ visibility }),\n method: 'PATCH',\n },\n );\n\n log('Agent visibility updated successfully');\n return result;\n }\n\n /**\n * Deletes an agent\n *\n * @param id - Agent ID or identifier\n * @returns Promise resolving to success response\n */\n async deleteAgent(id: number | string): Promise<{ message: string; success: boolean }> {\n log('Deleting agent: %s', id);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/agents/${id}`,\n { method: 'DELETE' },\n );\n\n log('Agent deleted successfully');\n return result;\n }\n\n /**\n * Updates status for multiple agents in a single operation\n *\n * @param ids - Array of agent IDs to update\n * @param status - New status to set for all specified agents\n * @returns Promise resolving to success response\n */\n async batchUpdateAgentStatus(\n ids: number[],\n status: 'published' | 'unpublished' | 'archived' | 'deprecated',\n ): Promise<{ message: string; success: boolean; updatedCount: number }> {\n log('Batch updating agent status: %O to %s', ids, status);\n\n const result = await this.request<{ message: string; success: boolean; updatedCount: number }>(\n '/admin/agents/batch/status',\n {\n body: JSON.stringify({ ids, status }),\n method: 'PATCH',\n },\n );\n\n log('Batch agent status update completed: %d updated', result.updatedCount);\n return result;\n }\n\n /**\n * Deletes multiple agents in a single operation\n *\n * @param ids - Array of agent IDs to delete\n * @returns Promise resolving to success response\n */\n async batchDeleteAgents(\n ids: number[],\n ): Promise<{ deletedCount: number; message: string; success: boolean }> {\n log('Batch deleting agents: %O', ids);\n\n const result = await this.request<{ deletedCount: number; message: string; success: boolean }>(\n '/admin/agents/batch/delete',\n {\n body: JSON.stringify({ ids }),\n method: 'DELETE',\n },\n );\n\n log('Batch agent deletion completed: %d deleted', result.deletedCount);\n return result;\n }\n}\n","import {\n InstallFailureAnalysis,\n InstallFailureAnalysisQuery,\n RangeQuery,\n RangeStats,\n TopPlugin,\n TopPluginsQuery,\n} from '@lobehub/market-types';\nimport debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:admin:analysis');\n\n/**\n * Market Overview Statistics Interface\n * Defines the structure for market overview data\n */\nexport interface MarketOverviewStats {\n devices: {\n count: number;\n prevCount: number;\n };\n installs: {\n count: number;\n prevCount: number;\n };\n period: string;\n pluginCalls: {\n count: number;\n prevCount: number;\n };\n plugins: {\n count: number;\n prevCount: number;\n };\n}\n\n/**\n * Period type for analysis queries\n */\nexport type AnalysisPeriod = '1d' | '7d' | '30d' | '1mo' | '3mo' | '1y';\n\n/**\n * Market overview query parameters\n */\nexport interface MarketOverviewQuery {\n /** Analysis period: 1d, 7d, 30d (rolling periods) or 1mo, 3mo, 1y (natural periods) */\n period?: AnalysisPeriod;\n}\n\n/**\n * Standard API response wrapper\n */\ninterface ApiResponse<T> {\n data: T;\n success: boolean;\n}\n\n/**\n * Analysis Management Service\n *\n * Provides administrative functionality for accessing market analysis and statistics.\n * This service handles retrieving various analytics reports including market overview,\n * plugin trends, and installation analytics for administrative dashboards.\n */\nexport class AnalysisService extends BaseSDK {\n /**\n * Retrieves market overview statistics\n *\n * Returns comprehensive market statistics including plugin counts,\n * installation metrics, new plugin trends, and rating averages\n * with comparison to previous periods.\n *\n * @param params - Query parameters for the analysis\n * @returns Promise resolving to market overview statistics\n */\n async getMarketOverview(params: MarketOverviewQuery = {}): Promise<MarketOverviewStats> {\n const { period = '30d' } = params;\n\n log('Getting market overview statistics for period: %s', period);\n\n const searchParams = new URLSearchParams();\n if (period) {\n searchParams.append('period', period);\n }\n\n const url = `/admin/analysis/plugin/overview${searchParams.toString() ? `?${searchParams.toString()}` : ''}`;\n\n const result = await this.request<ApiResponse<MarketOverviewStats>>(url);\n\n log('Market overview statistics retrieved successfully: %s', result.data);\n\n return result.data;\n }\n\n /**\n * Retrieves market overview statistics for 1 day period\n *\n * Convenience method for getting daily market statistics.\n *\n * @returns Promise resolving to market overview statistics for 1 day\n */\n async getDailyOverview(): Promise<MarketOverviewStats> {\n log('Getting daily market overview');\n return this.getMarketOverview({ period: '1d' });\n }\n\n /**\n * Retrieves market overview statistics for 7 days period\n *\n * Convenience method for getting weekly market statistics.\n *\n * @returns Promise resolving to market overview statistics for 7 days\n */\n async getWeeklyOverview(): Promise<MarketOverviewStats> {\n log('Getting weekly market overview');\n return this.getMarketOverview({ period: '7d' });\n }\n\n /**\n * Retrieves market overview statistics for 30 days period\n *\n * Convenience method for getting monthly market statistics.\n *\n * @returns Promise resolving to market overview statistics for 30 days\n */\n async getMonthlyOverview(): Promise<MarketOverviewStats> {\n log('Getting monthly market overview');\n return this.getMarketOverview({ period: '30d' });\n }\n\n /**\n * Retrieves market overview statistics for current natural month\n *\n * Convenience method for getting current month vs previous month statistics.\n *\n * @returns Promise resolving to market overview statistics for current month\n */\n async getThisMonthOverview(): Promise<MarketOverviewStats> {\n log('Getting this month market overview');\n return this.getMarketOverview({ period: '1mo' });\n }\n\n /**\n * Retrieves market overview statistics for current quarter\n *\n * Convenience method for getting current quarter vs previous quarter statistics.\n *\n * @returns Promise resolving to market overview statistics for current quarter\n */\n async getQuarterlyOverview(): Promise<MarketOverviewStats> {\n log('Getting quarterly market overview');\n return this.getMarketOverview({ period: '3mo' });\n }\n\n /**\n * Retrieves market overview statistics for current year\n *\n * Convenience method for getting current year vs previous year statistics.\n *\n * @returns Promise resolving to market overview statistics for current year\n */\n async getYearlyOverview(): Promise<MarketOverviewStats> {\n log('Getting yearly market overview');\n return this.getMarketOverview({ period: '1y' });\n }\n\n /**\n * Retrieves install failure analysis for plugins within a date range\n *\n * Returns detailed analysis of plugin installation failures including failure counts,\n * failure rates, and most common error messages for each plugin with failures.\n *\n * @param params - Query parameters for the failure analysis\n * @returns Promise resolving to install failure analysis data\n */\n async getInstallFailureAnalysis(\n params: InstallFailureAnalysisQuery,\n ): Promise<InstallFailureAnalysis[]> {\n const { range, limit = 15 } = params;\n\n log('Getting install failure analysis for range: %o, limit: %d', range, limit);\n\n const searchParams = new URLSearchParams();\n searchParams.append('range', JSON.stringify(range));\n if (limit !== 15) {\n searchParams.append('limit', limit.toString());\n }\n\n const url = `/admin/analysis/plugin/install-failure?${searchParams.toString()}`;\n\n const result = await this.request<ApiResponse<InstallFailureAnalysis[]>>(url);\n\n log('Install failure analysis retrieved successfully for %d plugins', result.data.length);\n\n return result.data;\n }\n\n /**\n * Calculates growth rate between current and previous values\n *\n * Utility method for calculating percentage growth rates from the statistics.\n *\n * @param current - Current period value\n * @param previous - Previous period value\n * @returns Growth rate as percentage (e.g., 15.5 for 15.5% growth)\n */\n static calculateGrowthRate(current: number, previous: number): number {\n if (previous === 0) return current > 0 ? 100 : 0;\n return Math.round(((current - previous) / previous) * 100 * 10) / 10;\n }\n\n /**\n * Formats market overview statistics with calculated growth rates\n *\n * Utility method that enhances the raw statistics with calculated growth rates\n * for easier consumption in dashboards and reports.\n *\n * @param stats - Raw market overview statistics\n * @returns Enhanced statistics with growth rate calculations\n */\n static formatMarketOverview(stats: MarketOverviewStats) {\n return {\n ...stats,\n growth: {\n devices: this.calculateGrowthRate(stats.devices.count, stats.devices.prevCount),\n installs: this.calculateGrowthRate(stats.installs.count, stats.installs.prevCount),\n pluginCalls: this.calculateGrowthRate(stats.pluginCalls.count, stats.pluginCalls.prevCount),\n plugins: this.calculateGrowthRate(stats.plugins.count, stats.plugins.prevCount),\n },\n };\n }\n\n /**\n * Retrieves installation trend statistics for a specified date range\n *\n * Returns daily installation counts and trends for the specified period\n * with optional comparison to a previous period.\n *\n * @param params - Query parameters including date range and display config\n * @returns Promise resolving to installation trend statistics\n */\n async getRangeInstalls(params: RangeQuery): Promise<RangeStats> {\n const { display, range, prevRange } = params;\n\n log('Getting installation trend statistics for range: %s to %s', range[0], range[1]);\n\n const searchParams = new URLSearchParams();\n searchParams.append('display', display);\n searchParams.append('range', range.join(','));\n if (prevRange) {\n searchParams.append('prevRange', prevRange.join(','));\n }\n\n const url = `/admin/analysis/plugin/range-installs?${searchParams.toString()}`;\n\n const result = await this.request<ApiResponse<RangeStats>>(url);\n\n log(\n 'Installation trend statistics retrieved successfully: %d data points',\n result.data.data.length,\n );\n\n return result.data;\n }\n\n /**\n * Retrieves plugin growth trend statistics for a specified date range\n *\n * Returns daily plugin creation counts and trends for the specified period\n * with optional comparison to a previous period.\n *\n * @param params - Query parameters including date range and display config\n * @returns Promise resolving to plugin growth trend statistics\n */\n async getRangePlugins(params: RangeQuery): Promise<RangeStats> {\n const { display, range, prevRange } = params;\n\n log('Getting plugin growth trend statistics for range: %s to %s', range[0], range[1]);\n\n const searchParams = new URLSearchParams();\n searchParams.append('display', display);\n searchParams.append('range', range.join(','));\n if (prevRange) {\n searchParams.append('prevRange', prevRange.join(','));\n }\n\n const url = `/admin/analysis/plugin/range-plugins?${searchParams.toString()}`;\n\n const result = await this.request<ApiResponse<RangeStats>>(url);\n\n log(\n 'Plugin growth trend statistics retrieved successfully: %d data points',\n result.data.data.length,\n );\n\n return result.data;\n }\n\n /**\n * Retrieves device growth trend statistics for a specified date range\n *\n * Note: This is a system-level statistic that tracks device registrations,\n * not plugin-specific metrics. It provides daily device registration counts\n * and trends for the specified period with optional comparison to a previous period.\n *\n * @param params - Query parameters including date range and display config\n * @returns Promise resolving to device growth trend statistics\n */\n async getRangeDevices(params: RangeQuery): Promise<RangeStats> {\n const { display, range, prevRange } = params;\n\n log('Getting device growth trend statistics for range: %s to %s', range[0], range[1]);\n\n const searchParams = new URLSearchParams();\n searchParams.append('display', display);\n searchParams.append('range', range.join(','));\n if (prevRange) {\n searchParams.append('prevRange', prevRange.join(','));\n }\n\n const url = `/admin/analysis/system/range-devices?${searchParams.toString()}`;\n\n const result = await this.request<ApiResponse<RangeStats>>(url);\n\n log(\n 'Device growth trend statistics retrieved successfully: %d data points',\n result.data.data.length,\n );\n\n return result.data;\n }\n\n /**\n * Retrieves plugin call trend statistics for a specified date range\n *\n * Returns daily plugin call counts and trends for the specified period\n * with optional comparison to a previous period.\n *\n * @param params - Query parameters including date range and display config\n * @returns Promise resolving to plugin call trend statistics\n */\n async getRangeCalls(params: RangeQuery): Promise<RangeStats> {\n const { display, range, prevRange } = params;\n\n log('Getting plugin call trend statistics for range: %s to %s', range[0], range[1]);\n\n const searchParams = new URLSearchParams();\n searchParams.append('display', display);\n searchParams.append('range', range.join(','));\n if (prevRange) {\n searchParams.append('prevRange', prevRange.join(','));\n }\n\n const url = `/admin/analysis/plugin/range-calls?${searchParams.toString()}`;\n\n const result = await this.request<ApiResponse<RangeStats>>(url);\n\n log(\n 'Plugin call trend statistics retrieved successfully: %d data points',\n result.data.data.length,\n );\n\n return result.data;\n }\n\n /**\n * Calculates trend growth rate between current and previous period totals\n *\n * Utility method for calculating percentage growth rates from range statistics.\n *\n * @param stats - Range statistics with sum and prevSum\n * @returns Growth rate as percentage (e.g., 15.5 for 15.5% growth)\n */\n static calculateTrendGrowthRate(stats: RangeStats): number {\n return this.calculateGrowthRate(stats.sum, stats.prevSum);\n }\n\n /**\n * Retrieves top plugins sorted by specified criteria within a date range\n *\n * Returns list of plugins sorted by the specified criteria (installs or calls)\n * in descending order for the specified date range.\n *\n * @param params - Query parameters including date range, sort criteria, and limit\n * @returns Promise resolving to list of top plugins\n */\n async getTopPlugins(params: TopPluginsQuery): Promise<TopPlugin[]> {\n const { range, sortBy = 'installs', limit = 10 } = params;\n\n const searchParams = new URLSearchParams();\n searchParams.append('range', range.join(','));\n searchParams.append('sortBy', sortBy);\n searchParams.append('limit', limit.toString());\n\n const url = `/admin/analysis/plugin/top-plugins?${searchParams.toString()}`;\n\n const result = await this.request<ApiResponse<TopPlugin[]>>(url);\n\n return result.data;\n }\n}\n","import type {\n AdminDeploymentOption,\n AdminPluginItem,\n AdminPluginItemDetail,\n IncompleteI18nPlugin,\n InstallationDetails,\n PluginManifest,\n PluginVersion,\n PluginVersionLocalization,\n SystemDependency,\n} from '@lobehub/market-types';\nimport debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\nimport {\n AdminListQueryParams,\n AdminListResponse,\n PluginI18nImportParams,\n PluginI18nImportResponse,\n PluginUpdateParams,\n PluginVersionCreateParams,\n PluginVersionUpdateParams,\n UnclaimedPluginItem,\n} from '@/types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:admin:plugins');\n\n/**\n * Plugin Management Service\n *\n * Provides administrative functionality for managing plugins in the marketplace.\n * This service handles CRUD operations for plugins, plugin versions, and deployment options.\n */\nexport class PluginService extends BaseSDK {\n /**\n * Batch imports plugin manifests using the dedicated import endpoint\n *\n * This method is intended for use with scripts and bulk import operations.\n *\n * @param manifests - Array of plugin manifests to import\n * @param ownerId - Optional owner ID to associate with the imported plugins\n * @returns Promise resolving to the import results with counts of success, skipped, failed, and a list of failed IDs\n */\n async importPlugins(\n manifests: PluginManifest[],\n ownerId?: number,\n ): Promise<{ failed: number; failedIds: string[]; skipped: number; success: number }> {\n log(`Starting batch plugin import of ${manifests.length} manifests`);\n if (ownerId) {\n log(`Using specified owner ID for import: ${ownerId}`);\n }\n\n const response = await this.request<{\n data: { failed: number; failedIds: string[]; skipped: number; success: number };\n }>('/admin/plugins/import', {\n body: JSON.stringify({\n manifests,\n ownerId,\n }),\n method: 'POST',\n });\n\n log(\n `Plugin import completed: ${response.data.success} succeeded, ${response.data.skipped} skipped, ${response.data.failed} failed`,\n );\n return response.data;\n }\n\n /**\n * Imports plugin internationalization (i18n) data\n *\n * Allows importing localized content for a specific plugin version.\n * This method creates or updates localizations for the specified plugin.\n *\n * @param params - Plugin i18n import parameters containing identifier, version, and localizations\n * @returns Promise resolving to the import results with counts of success and failure\n */\n async importPluginI18n(params: PluginI18nImportParams): Promise<PluginI18nImportResponse> {\n log(\n `Starting i18n import for plugin ${params.identifier} v${params.version} with ${params.localizations.length} localizations`,\n );\n\n const response = await this.request<{\n data: PluginI18nImportResponse;\n message: string;\n }>('/admin/plugins/import/i18n', {\n body: JSON.stringify(params),\n method: 'POST',\n });\n\n log(\n `Plugin i18n import completed: ${response.data.success} succeeded, ${response.data.failed} failed, ${response.data.totalLocalizations} total`,\n );\n return response.data;\n }\n\n /**\n * Retrieves a list of plugins with admin details\n *\n * Supports filtering, pagination, and sorting of results.\n *\n * @param params - Query parameters for filtering and pagination\n * @returns Promise resolving to the plugin list response with admin details\n */\n async getPlugins(params: AdminListQueryParams = {}): Promise<AdminListResponse<AdminPluginItem>> {\n log('Getting plugins with params: %O', params);\n\n const queryString = this.buildQueryString(params);\n const url = `/admin/plugins${queryString}`;\n\n const result = await this.request<AdminListResponse<AdminPluginItem>>(url);\n\n log('Retrieved %d plugins', result.data.length);\n return result;\n }\n\n /**\n * Retrieves all published plugin identifiers\n *\n * Returns a lightweight list of all published plugin identifiers without\n * full plugin metadata. This is useful for admin operations that need to know\n * which plugins are currently published and available to users.\n *\n * @returns Promise resolving to an array containing identifiers array and last modified time\n */\n async getPublishedIdentifiers(): Promise<{ identifier: string; lastModified: string }[]> {\n log('Getting published plugin identifiers (admin)');\n\n const result =\n await this.request<{ identifier: string; lastModified: string }[]>('/v1/plugins/identifiers');\n log('Retrieved %d published plugin identifiers (admin)', result.length);\n return result;\n }\n\n /**\n * Retrieves a single plugin with full admin details\n *\n * @param id - Plugin ID or identifier\n * @returns Promise resolving to the detailed plugin information with version history\n */\n async getPlugin(id: number | string): Promise<AdminPluginItemDetail> {\n log('Getting plugin details (admin): %d', id);\n\n const result = await this.request<AdminPluginItemDetail>(`/admin/plugins/${id}`);\n log('Retrieved plugin with %d versions', result.versions.length);\n return result;\n }\n\n /**\n * Retrieves a plugin by its GitHub repository URL\n *\n * @param githubUrl - The GitHub repository URL to search for\n * @returns Promise resolving to the detailed plugin information with version history\n */\n async getPluginByGithubUrl(githubUrl: string): Promise<AdminPluginItemDetail> {\n log('Getting plugin by GitHub URL: %s', githubUrl);\n\n const queryString = this.buildQueryString({ url: githubUrl });\n const result = await this.request<AdminPluginItemDetail>(\n `/admin/plugins/by-github-url${queryString}`,\n );\n log('Retrieved plugin with %d versions', result.versions.length);\n return result;\n }\n\n /**\n * Updates plugin information\n *\n * @param id - Plugin ID\n * @param data - Plugin update data containing fields to update\n * @returns Promise resolving to the updated plugin\n */\n async updatePlugin(id: number, data: PluginUpdateParams): Promise<AdminPluginItem> {\n log('Updating plugin: %d, data: %O', id, data);\n\n const result = await this.request<AdminPluginItem>(`/admin/plugins/${id}`, {\n body: JSON.stringify(data),\n method: 'PUT',\n });\n log('Plugin updated successfully');\n return result;\n }\n\n /**\n * Updates plugin publication status\n *\n * @param id - Plugin ID\n * @param status - New status to set\n * @returns Promise resolving to success response\n */\n async updatePluginStatus(\n id: number,\n status: 'published' | 'draft' | 'review' | 'rejected',\n ): Promise<{ message: string; success: boolean }> {\n log('Updating plugin status: %d to %s', id, status);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/plugins/${id}/status`,\n {\n body: JSON.stringify({ status }),\n method: 'PATCH',\n },\n );\n log('Plugin status updated successfully');\n return result;\n }\n\n /**\n * Deletes a plugin\n *\n * @param id - Plugin ID\n * @returns Promise resolving to success response\n */\n async deletePlugin(id: number): Promise<{ message: string; success: boolean }> {\n log('Deleting plugin: %d', id);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/plugins/${id}`,\n { method: 'DELETE' },\n );\n log('Plugin deleted successfully');\n return result;\n }\n\n /**\n * Retrieves the version history for a plugin\n *\n * @param pluginId - Plugin ID\n * @returns Promise resolving to an array of plugin versions\n */\n async getPluginVersions(pluginId: number): Promise<PluginVersion[]> {\n log('Getting plugin versions: pluginId=%d', pluginId);\n\n const result = await this.request<PluginVersion[]>(`/admin/plugins/${pluginId}/versions`);\n\n log('Retrieved %d versions', result.length);\n return result;\n }\n\n /**\n * Retrieves a specific plugin version\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @returns Promise resolving to the plugin version details\n */\n async getPluginVersion(pluginId: number, versionId: number): Promise<PluginVersion> {\n log('Getting version details: pluginId=%d, versionId=%d', pluginId, versionId);\n\n const result = await this.request<PluginVersion>(\n `/admin/plugins/${pluginId}/versions/${versionId}`,\n );\n log('Version details retrieved');\n return result;\n }\n\n /**\n * Retrieves all localizations for a specific plugin version\n *\n * @param pluginId - Plugin ID or identifier\n * @param versionId - Version ID\n * @returns Promise resolving to an array of plugin version localizations\n */\n async getPluginLocalizations(\n pluginId: number | string,\n versionId: number,\n ): Promise<PluginVersionLocalization[]> {\n log('Getting localizations: pluginId=%s, versionId=%d', pluginId, versionId);\n\n const result = await this.request<PluginVersionLocalization[]>(\n `/admin/plugins/${pluginId}/versions/${versionId}/localizations`,\n );\n log('Retrieved %d localizations for plugin %s, version %d', result.length, pluginId, versionId);\n return result;\n }\n\n /**\n * Creates a new plugin version with all version-specific data\n *\n * @param pluginId - Plugin ID\n * @param data - Version creation data including all version-specific fields\n * @returns Promise resolving to the created plugin version\n */\n async createPluginVersion(\n pluginId: number,\n data: PluginVersionCreateParams,\n ): Promise<PluginVersion> {\n log('Creating new plugin version: pluginId=%d, data: %O', pluginId, data);\n\n const result = await this.request<PluginVersion>(`/admin/plugins/${pluginId}/versions`, {\n body: JSON.stringify(data),\n method: 'POST',\n });\n log('Plugin version created successfully: version=%s', data.version);\n return result;\n }\n\n /**\n * Creates a new plugin version from a manifest\n * Extracts version data from the manifest for easier creation\n *\n * @param pluginId - Plugin ID\n * @param manifest - Plugin manifest containing all version data\n * @param options - Additional options for version creation\n * @returns Promise resolving to the created plugin version\n */\n async createPluginVersionFromManifest(\n pluginId: number,\n manifest: PluginManifest,\n options: {\n isLatest?: boolean;\n isValidated?: boolean;\n } = {},\n ): Promise<PluginVersion> {\n log(\n 'Creating plugin version from manifest: pluginId=%d, version=%s',\n pluginId,\n manifest.version,\n );\n\n const versionData: PluginVersionCreateParams = {\n author: manifest.author?.name,\n authorUrl: manifest.author?.url,\n capabilitiesPrompts: manifest.capabilities?.prompts,\n capabilitiesResources: manifest.capabilities?.resources,\n capabilitiesTools: manifest.capabilities?.tools,\n category: manifest.category,\n description: manifest.description,\n icon: manifest.icon,\n isLatest: options.isLatest,\n isValidated: options.isValidated,\n name: manifest.name,\n prompts: manifest.prompts,\n readme: manifest.overview?.readme,\n resources: manifest.resources,\n summary: manifest.overview?.summary,\n tags: manifest.tags,\n tools: manifest.tools,\n version: manifest.version,\n };\n\n return this.createPluginVersion(pluginId, versionData);\n }\n\n /**\n * Updates a plugin version with comprehensive version-specific data\n *\n * @param idOrIdentifier - Plugin ID\n * @param versionId - Version ID\n * @param data - Version update data including all version-specific fields\n * @returns Promise resolving to the updated plugin version\n */\n async updatePluginVersion(\n idOrIdentifier: number | string,\n versionId: number,\n data: PluginVersionUpdateParams,\n ): Promise<PluginVersion> {\n log(\n 'Updating plugin version: pluginId=%d, versionId=%d, data: %O',\n idOrIdentifier,\n versionId,\n data,\n );\n\n const result = await this.request<PluginVersion>(\n `/admin/plugins/${idOrIdentifier}/versions/${versionId}`,\n {\n body: JSON.stringify(data),\n method: 'PUT',\n },\n );\n\n log('Plugin version updated successfully');\n return result;\n }\n\n /**\n * Deletes a plugin version\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @returns Promise resolving to success response\n */\n async deletePluginVersion(\n pluginId: number,\n versionId: number,\n ): Promise<{ message: string; success: boolean }> {\n log('Deleting version: pluginId=%d, versionId=%d', pluginId, versionId);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/plugins/${pluginId}/versions/${versionId}`,\n { method: 'DELETE' },\n );\n log('Plugin version deleted successfully');\n return result;\n }\n\n /**\n * Sets a specific version as the latest version of a plugin\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID to set as latest\n * @returns Promise resolving to success response\n */\n async setPluginVersionAsLatest(\n pluginId: number,\n versionId: number,\n ): Promise<{ message: string; success: boolean }> {\n log('Setting version as latest: pluginId=%d, versionId=%d', pluginId, versionId);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/plugins/${pluginId}/versions/${versionId}/latest`,\n { method: 'POST' },\n );\n log('Version set as latest successfully');\n return result;\n }\n\n /**\n * Updates plugin visibility\n *\n * @param id - Plugin ID\n * @param visibility - New visibility setting\n * @returns Promise resolving to success response\n */\n async updatePluginVisibility(\n id: number,\n visibility: 'public' | 'private' | 'unlisted',\n ): Promise<{ message: string; success: boolean }> {\n log('Updating plugin visibility: %d to %s', id, visibility);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/plugins/${id}/visibility`,\n {\n body: JSON.stringify({ visibility }),\n method: 'PATCH',\n },\n );\n log('Plugin visibility updated successfully');\n return result;\n }\n\n /**\n * Updates status for multiple plugins in a single operation\n *\n * @param ids - Array of plugin IDs to update\n * @param status - New status to set for all specified plugins\n * @returns Promise resolving to success response\n */\n async batchUpdatePluginStatus(\n ids: number[],\n status: 'published' | 'draft' | 'review' | 'rejected',\n ): Promise<{ message: string; success: boolean }> {\n log('Batch updating plugin status: %O to %s', ids, status);\n\n const result = await this.request<{ message: string; success: boolean }>(\n '/admin/plugins/batch/status',\n {\n body: JSON.stringify({ ids, status }),\n method: 'PATCH',\n },\n );\n log('Batch plugin status update completed');\n return result;\n }\n\n /**\n * Deletes multiple plugins in a single operation\n *\n * @param ids - Array of plugin IDs to delete\n * @returns Promise resolving to success response\n */\n async batchDeletePlugins(ids: number[]): Promise<{ message: string; success: boolean }> {\n log('Batch deleting plugins: %O', ids);\n\n const result = await this.request<{ message: string; success: boolean }>(\n '/admin/plugins/batch/delete',\n {\n body: JSON.stringify({ ids }),\n method: 'DELETE',\n },\n );\n log('Batch plugin deletion completed');\n return result;\n }\n\n /**\n * Retrieves detailed information about a plugin version including deployment options\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @returns Promise resolving to version details with deployment options\n */\n async getPluginVersionDetails(\n pluginId: number,\n versionId: number,\n ): Promise<PluginVersion & { deploymentOptions: any }> {\n log(\n 'Getting version details with deployment options: pluginId=%d, versionId=%d',\n pluginId,\n versionId,\n );\n\n const result = await this.request<PluginVersion & { deploymentOptions: any }>(\n `/admin/plugins/${pluginId}/versions/${versionId}`,\n );\n log('Version details with deployment options retrieved');\n return result;\n }\n\n /**\n * Retrieves deployment options for a specific plugin version\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @returns Promise resolving to an array of deployment options\n */\n async getDeploymentOptions(\n pluginId: number,\n versionId: number,\n ): Promise<AdminDeploymentOption[]> {\n log('Getting deployment options: pluginId=%d, versionId=%d', pluginId, versionId);\n\n const result = await this.request<AdminDeploymentOption[]>(\n `/admin/plugins/${pluginId}/versions/${versionId}/deployment-options`,\n );\n log('Retrieved %d deployment options', result.length);\n return result;\n }\n\n /**\n * Creates a new deployment option for a plugin version\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @param data - Deployment option configuration data\n * @returns Promise resolving to the created deployment option\n */\n async createDeploymentOption(\n pluginId: number,\n versionId: number,\n data: {\n connectionArgs?: string[];\n connectionCommand?: string;\n connectionType: string;\n description?: string;\n installationDetails?: InstallationDetails;\n installationMethod: string;\n isRecommended?: boolean;\n },\n ): Promise<AdminDeploymentOption> {\n log('Creating deployment option: pluginId=%d, versionId=%d', pluginId, versionId);\n\n const result = await this.request<AdminDeploymentOption>(\n `/admin/plugins/${pluginId}/versions/${versionId}/deployment-options`,\n {\n body: JSON.stringify(data),\n method: 'POST',\n },\n );\n log('Deployment option created successfully');\n return result;\n }\n\n /**\n * Updates an existing deployment option\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @param optionId - Deployment option ID\n * @param data - Updated deployment option configuration\n * @returns Promise resolving to the updated deployment option\n */\n async updateDeploymentOption(\n pluginId: number,\n versionId: number,\n optionId: number,\n data: {\n configSchema?: Record<string, any>;\n connectionArgs?: string[];\n connectionCommand?: string;\n connectionType?: string;\n description?: string;\n installationDetails?: Record<string, any>;\n installationMethod?: string;\n isRecommended?: boolean;\n },\n ): Promise<AdminDeploymentOption> {\n log(\n 'Updating deployment option: pluginId=%d, versionId=%d, optionId=%d',\n pluginId,\n versionId,\n optionId,\n );\n\n const result = await this.request<AdminDeploymentOption>(\n `/admin/plugins/${pluginId}/versions/${versionId}/deployment-options/${optionId}`,\n {\n body: JSON.stringify(data),\n method: 'PUT',\n },\n );\n log('Deployment option updated successfully');\n return result;\n }\n\n /**\n * Deletes a deployment option\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @param optionId - Deployment option ID\n * @returns Promise resolving to success response\n */\n async deleteDeploymentOption(\n pluginId: number,\n versionId: number,\n optionId: number,\n ): Promise<{ message: string; success: boolean }> {\n log(\n 'Deleting deployment option: pluginId=%d, versionId=%d, optionId=%d',\n pluginId,\n versionId,\n optionId,\n );\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/plugins/${pluginId}/versions/${versionId}/deployment-options/${optionId}`,\n { method: 'DELETE' },\n );\n log('Deployment option deleted successfully');\n return result;\n }\n\n /**\n * Retrieves system dependencies for a deployment option\n *\n * @param pluginId - Plugin ID\n * @param versionId - Version ID\n * @param optionId - Deployment option ID\n * @returns Promise resolving to an array of system dependencies\n */\n async getDeploymentOptionSystemDependencies(\n pluginId: number,\n versionId: number,\n optionId: number,\n ): Promise<SystemDependency[]> {\n log(\n 'Getting system dependencies: pluginId=%d, versionId=%d, optionId=%d',\n pluginId,\n versionId,\n optionId,\n );\n\n const result = await this.request<SystemDependency[]>(\n `/admin/plugins/${pluginId}/versions/${versionId}/deployment-options/${optionId}/system-dependencies`,\n );\n log('Retrieved %d system dependencies', result.length);\n return result;\n }\n\n /**\n * Retrieves verified plugins without summary information\n *\n * Returns plugins that are validated but missing summary data.\n *\n * @returns Promise resolving to array of plugins with incomplete summary data\n */\n async getVerifiedPluginsWithoutSummary(): Promise<\n { identifier: string; manifest: PluginManifest; versionId: number }[]\n > {\n log('Getting verified plugins without summary');\n\n const result = await this.request<\n { identifier: string; manifest: PluginManifest; versionId: number }[]\n >('/admin/plugins/verified-without-summary');\n\n log('Retrieved %d verified plugins without summary', result.length);\n return result;\n }\n\n /**\n * Retrieves plugins with incomplete internationalization\n *\n * Returns plugins where pluginVersionLocalizations has only 1 entry.\n *\n * @returns Promise resolving to an array of plugins with incomplete i18n\n */\n async getIncompleteI18nPlugins(): Promise<IncompleteI18nPlugin[]> {\n log('Getting plugins with incomplete i18n');\n\n const result = await this.request<IncompleteI18nPlugin[]>('/admin/plugins/incomplete-i18n');\n log('Retrieved %d plugins with incomplete i18n', result.length);\n return result;\n }\n\n /**\n * Retrieves unclaimed plugins\n *\n * Returns plugins where isClaimed is false, containing only ID and identifier.\n *\n * @returns Promise resolving to an array of unclaimed plugins with basic info\n */\n async getUnclaimedPlugins(): Promise<UnclaimedPluginItem[]> {\n log('Getting unclaimed plugins');\n\n const result = await this.request<UnclaimedPluginItem[]>('/admin/plugins/unclaimed');\n log('Retrieved %d unclaimed plugins', result.length);\n return result;\n }\n}\n","import type { SystemDependency } from '@lobehub/market-types';\nimport debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:admin:dependency');\n\n/**\n * System Dependency Management Service\n *\n * Provides administrative functionality for managing system dependencies\n * required by plugins. This service handles creating, updating, deleting,\n * and listing system dependencies that plugins may require.\n */\nexport class SystemDependencyService extends BaseSDK {\n /**\n * Retrieves all system dependencies\n *\n * Gets a list of all defined system dependencies that plugins may require.\n *\n * @returns Promise resolving to an array of system dependencies\n */\n async getSystemDependencies(): Promise<SystemDependency[]> {\n log('Getting all system dependencies');\n\n const result = await this.request<SystemDependency[]>(`/admin/plugins/dependencies`);\n log('Retrieved %d system dependencies', result.length);\n return result;\n }\n\n /**\n * Retrieves a specific system dependency by ID\n *\n * @param id - System dependency ID\n * @returns Promise resolving to the system dependency details\n */\n async getSystemDependency(id: number): Promise<SystemDependency> {\n log('Getting system dependency details: %d', id);\n\n const result = await this.request<SystemDependency>(`/admin/plugins/dependencies/${id}`);\n log('System dependency details retrieved');\n return result;\n }\n\n /**\n * Creates a new system dependency\n *\n * @param data - System dependency creation data\n * @returns Promise resolving to the created system dependency\n */\n async createSystemDependency(data: Omit<SystemDependency, 'id'>): Promise<SystemDependency> {\n log('Creating system dependency: %O', data);\n\n const result = await this.request<SystemDependency>(`/admin/plugins/dependencies`, {\n body: JSON.stringify(data),\n method: 'POST',\n });\n log('System dependency created successfully');\n return result;\n }\n\n /**\n * Updates an existing system dependency\n *\n * @param id - System dependency ID\n * @param data - System dependency update data\n * @returns Promise resolving to the updated system dependency\n */\n async updateSystemDependency(\n id: number,\n data: Partial<SystemDependency>,\n ): Promise<SystemDependency> {\n log('Updating system dependency: %d, data: %O', id, data);\n\n const result = await this.request<SystemDependency>(`/admin/plugins/dependencies/${id}`, {\n body: JSON.stringify(data),\n method: 'PUT',\n });\n log('System dependency updated successfully');\n return result;\n }\n\n /**\n * Deletes a system dependency\n *\n * @param id - System dependency ID\n * @returns Promise resolving to success response\n */\n async deleteSystemDependency(id: number): Promise<{ message: string; success: boolean }> {\n log('Deleting system dependency: %d', id);\n\n const result = await this.request<{ message: string; success: boolean }>(\n `/admin/plugins/dependencies/${id}`,\n { method: 'DELETE' },\n );\n log('System dependency deleted successfully');\n return result;\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:admin:settings');\n\n/**\n * Settings entity representing a system setting\n */\nexport interface Settings {\n /** Creation timestamp (ISO 8601 format) */\n createdAt: string;\n /** Optional description of the setting's purpose */\n description?: string;\n /** Unique identifier for the setting */\n id: number;\n /** Setting key name used for retrieving the setting */\n key: string;\n /** Last update timestamp (ISO 8601 format) */\n updatedAt: string;\n /** Setting value (stored as string) */\n value: string;\n}\n\n/**\n * Configuration for enabled resource types\n */\nexport interface EnabledResources {\n /** Whether agent resources are enabled */\n agents: boolean;\n /** Whether plugin resources are enabled */\n plugins: boolean;\n}\n\n/**\n * Authentication configuration\n */\nexport interface AuthenticationConfig {\n /** Whether authentication is required */\n enabled: boolean;\n /** Supported authentication schemes */\n schemes: string[];\n}\n\n/**\n * Documentation URL configuration\n */\nexport interface DocumentationConfig {\n /** URL to API documentation */\n apiUrl?: string;\n /** URL to privacy policy */\n policyUrl?: string;\n /** URL to terms of service */\n termsOfServiceUrl?: string;\n}\n\n/**\n * Map of all system settings with typed properties\n */\nexport interface SettingsMap {\n /** Additional settings (dynamically added) */\n [key: string]: any;\n /** Authentication configuration */\n authentication: AuthenticationConfig;\n /** Base URL for the marketplace */\n baseURL: string;\n /** Documentation URL configuration */\n documentation: DocumentationConfig;\n /** Configuration for enabled resource types */\n enabledResources: EnabledResources;\n /** Supported locales */\n locales: string[];\n}\n\n/**\n * Parameters for creating a new setting\n */\nexport interface CreateSettingsParams {\n /** Optional description of the setting's purpose */\n description?: string;\n /** Setting key name */\n key: string;\n /** Setting value (will be stored as string) */\n value: string;\n}\n\n/**\n * Parameters for updating an existing setting\n */\nexport interface UpdateSettingsParams {\n /** Optional new description */\n description?: string;\n /** New setting value */\n value: string;\n}\n\n/**\n * Settings Management Service\n *\n * Provides administrative functionality for managing system settings.\n * This service handles getting, creating, updating, and deleting\n * configuration settings for the marketplace.\n */\nexport class SettingsService extends BaseSDK {\n /**\n * Retrieves all system settings\n *\n * Returns a consolidated map of all settings with typed values\n * for known setting keys.\n *\n * @returns Promise resolving to the settings map\n */\n async getSettings(): Promise<SettingsMap> {\n return await this.request<SettingsMap>('/admin/settings');\n }\n\n /**\n * Retrieves a specific setting by key\n *\n * @param key - Setting key name\n * @returns Promise resolving to the setting details\n */\n async getSettingByKey(key: string): Promise<{ data: Settings }> {\n log('Getting setting: %s', key);\n\n const result = await this.request<{ data: Settings }>(`/admin/settings/${key}`);\n log('Setting retrieved');\n return result;\n }\n\n /**\n * Creates a new system setting\n *\n * @param data - Setting creation parameters\n * @returns Promise resolving to the created setting\n */\n async createSetting(data: CreateSettingsParams): Promise<{ data: Settings }> {\n log('Creating setting: %O', data);\n\n const result = await this.request<{ data: Settings }>('/admin/settings', {\n body: JSON.stringify(data),\n method: 'POST',\n });\n log('Setting created successfully');\n return result;\n }\n\n /**\n * Updates an existing setting\n *\n * @param key - Setting key name\n * @param data - Setting update parameters\n * @returns Promise resolving to the updated setting\n */\n async updateSetting(key: string, data: UpdateSettingsParams): Promise<{ data: Settings }> {\n log('Updating setting: %s, data: %O', key, data);\n\n const result = await this.request<{ data: Settings }>(`/admin/settings/${key}`, {\n body: JSON.stringify(data),\n method: 'PUT',\n });\n log('Setting updated successfully');\n return result;\n }\n\n /**\n * Deletes a setting\n *\n * @param key - Setting key name\n * @returns Promise resolving to success message\n */\n async deleteSetting(key: string): Promise<{ message: string }> {\n log('Deleting setting: %s', key);\n\n const result = await this.request<{ message: string }>(`/admin/settings/${key}`, {\n method: 'DELETE',\n });\n log('Setting deleted successfully');\n return result;\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\nimport type { AdminListQueryParams, AdminListResponse, ReviewStatus } from '@/types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:admin:review');\n\n/**\n * Review entity representing a plugin review\n */\nexport interface Review {\n /** Optional comment providing feedback */\n comment?: string;\n /** Creation timestamp (ISO 8601 format) */\n createdAt: string;\n /** Unique identifier for the review */\n id: number;\n /** ID of the plugin being reviewed */\n pluginId: number;\n /** ID of the reviewer (if available) */\n reviewerId?: number;\n /** Current status of the review */\n status: ReviewStatus;\n /** Last update timestamp (ISO 8601 format) */\n updatedAt: string;\n}\n\n/**\n * Extended review information with related entities\n */\nexport interface PluginReviewWithRelations extends Review {\n /** Related plugin information */\n plugin?: any;\n /** Related version information */\n version?: any;\n}\n\n/**\n * Parameters for updating a review\n */\nexport interface UpdateReviewParams {\n /** Optional comment or feedback */\n comment?: string;\n /** New status to set for the review */\n status: ReviewStatus;\n}\n\n/**\n * Review Management Service\n *\n * Provides administrative functionality for managing plugin reviews.\n * This service handles listing, fetching, and updating review statuses\n * for plugins in the marketplace.\n */\nexport class ReviewService extends BaseSDK {\n /**\n * Retrieves a list of reviews with filtering options\n *\n * @param params - Query parameters for filtering and pagination\n * @returns Promise resolving to the review list response\n */\n async getReviews(\n params: AdminListQueryParams = {},\n ): Promise<AdminListResponse<PluginReviewWithRelations>> {\n log('Getting reviews with params: %O', params);\n\n const queryString = this.buildQueryString(params);\n const url = `/admin/reviews${queryString ? `?${queryString}` : ''}`;\n\n const result = await this.request<AdminListResponse<PluginReviewWithRelations>>(url);\n\n log('Retrieved %d reviews', result.data.length);\n return result;\n }\n\n /**\n * Retrieves a specific review by ID\n *\n * @param id - Review ID\n * @returns Promise resolving to the review details\n */\n async getReviewById(id: number): Promise<Review> {\n log('Getting review details: %d', id);\n\n const result = await this.request<Review>(`/admin/reviews/${id}`);\n log('Review details retrieved');\n return result;\n }\n\n /**\n * Updates a review's status and comment\n *\n * @param id - Review ID\n * @param data - Update parameters containing new status and optional comment\n * @returns Promise resolving to the updated review\n */\n async updateReview(id: number, data: UpdateReviewParams): Promise<Review> {\n log('Updating review: %d, data: %O', id, data);\n\n const result = await this.request<Review>(`/admin/reviews/${id}`, {\n body: JSON.stringify(data),\n method: 'PUT',\n });\n log('Review updated successfully');\n return result;\n }\n\n /**\n * Retrieves the review history for a specific plugin\n *\n * @param pluginId - Plugin ID\n * @returns Promise resolving to an array of reviews for the plugin\n */\n async getPluginReviews(pluginId: number): Promise<{ data: Review[] }> {\n log('Getting plugin reviews: pluginId=%d', pluginId);\n\n const result = await this.request<{ data: Review[] }>(`/admin/reviews/plugin/${pluginId}`);\n log('Retrieved %d reviews for plugin', result.data.length);\n return result;\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\nimport type { AdminListResponse } from '@/types/admin';\n\ntype AdminPluginEnvListQuery = any;\ntype PluginEnv = any;\n\nconst log = debug('lobe-market-sdk:admin:plugin-env');\n\nexport interface AdminPluginEnvCreateParams {\n description?: string;\n identifier: string;\n key: string;\n value: string;\n}\n\nexport interface AdminPluginEnvUpdateParams {\n description?: string;\n value?: string;\n}\n\n/**\n * Plugin Environment Variable Management Service\n *\n * Provides administrative functionality for managing plugin environment variables.\n */\nexport class PluginEnvService extends BaseSDK {\n /**\n * Retrieves a paginated list of plugin environment variables\n *\n * @param params - Query parameters for filtering and pagination\n * @returns Promise resolving to the env list response\n */\n async getPluginEnvs(params: AdminPluginEnvListQuery = {}): Promise<AdminListResponse<PluginEnv>> {\n log('Getting plugin envs with params: %O', params);\n const queryString = this.buildQueryString(params);\n const url = `/admin/plugins/env${queryString}`;\n const result = await this.request<AdminListResponse<PluginEnv>>(url);\n log('Retrieved %d plugin envs', result.data.length);\n return result;\n }\n\n /**\n * Retrieves a single plugin environment variable by ID\n *\n * @param id - Env ID\n * @returns Promise resolving to the env item\n */\n async getPluginEnv(id: number): Promise<PluginEnv> {\n log('Getting plugin env: %d', id);\n const result = await this.request<PluginEnv>(`/admin/plugins/env/${id}`);\n log('Retrieved plugin env: %d', id);\n return result;\n }\n\n /**\n * Creates a new plugin environment variable\n *\n * @param data - Env creation data\n * @returns Promise resolving to the created env item\n */\n async createPluginEnv(data: AdminPluginEnvCreateParams): Promise<PluginEnv> {\n log('Creating plugin env: %O', data);\n const result = await this.request<PluginEnv>(`/admin/plugins/env`, {\n body: JSON.stringify(data),\n method: 'POST',\n });\n log('Plugin env created successfully');\n return result;\n }\n\n /**\n * Updates a plugin environment variable\n *\n * @param id - Env ID\n * @param data - Env update data\n * @returns Promise resolving to the updated env item\n */\n async updatePluginEnv(id: number, data: AdminPluginEnvUpdateParams): Promise<PluginEnv> {\n log('Updating plugin env: %d, data: %O', id, data);\n const result = await this.request<PluginEnv>(`/admin/plugins/env/${id}`, {\n body: JSON.stringify(data),\n method: 'PUT',\n });\n log('Plugin env updated successfully');\n return result;\n }\n\n /**\n * Deletes a plugin environment variable\n *\n * @param id - Env ID\n * @returns Promise resolving to success response\n */\n async deletePluginEnv(id: number): Promise<{ success: boolean }> {\n log('Deleting plugin env: %d', id);\n const result = await this.request<{ success: boolean }>(`/admin/plugins/env/${id}`, {\n method: 'DELETE',\n });\n log('Plugin env deleted successfully');\n return result;\n }\n\n /**\n * Batch import plugin environment variables\n *\n * @param data - Batch import data, format: { [plugin: string]: { [envKey: string]: string } }\n * @returns Promise resolving to import result\n */\n async importPluginEnvs(\n data: Record<string, Record<string, string>>,\n ): Promise<{ success: number }> {\n log('Batch importing plugin envs: %O', data);\n const result = await this.request<{ success: number }>(`/admin/plugins/env/import`, {\n body: JSON.stringify(data),\n method: 'POST',\n });\n log('Batch import completed: %d envs imported', result.success);\n return result;\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '../core/BaseSDK';\nimport type {\n ClientRegistrationRequest,\n ClientRegistrationResponse,\n DiscoveryDocument,\n MarketSDKOptions,\n} from '../types';\nimport {\n AgentService,\n AuthService,\n DiscoveryService,\n FeedbackService,\n PluginsService,\n UserFavoriteService,\n UserFollowService,\n UserLikeService,\n UserService,\n} from './services';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk');\n\n/**\n * LobeHub Market SDK Client\n *\n * Main client for accessing the LobeHub Marketplace API.\n * This class provides access to marketplace resources like plugins, agents,\n * and service discovery information. It follows a composition pattern\n * by combining specialized domain services.\n */\nexport class MarketSDK extends BaseSDK {\n /**\n * Agents service for accessing agent-related functionality\n * Provides methods to list, search, retrieve agent information, and upload agents\n */\n readonly agents: AgentService;\n\n /**\n * Auth service for authentication and authorization\n * Provides methods for OIDC user authentication, client registration, and M2M token management\n */\n readonly auth: AuthService;\n\n /**\n * Plugins service for accessing plugin-related functionality\n * Provides methods to list, search, retrieve plugin information, and report installation attempts\n */\n readonly plugins: PluginsService;\n\n /**\n * User service for accessing user-related functionality\n * Provides methods to retrieve user profiles and their published agents\n */\n readonly user: UserService;\n\n /**\n * User follow service for follow operations\n * Provides methods to follow/unfollow users and retrieve follow relationships\n */\n readonly follows: UserFollowService;\n\n /**\n * User favorite service for favorite operations\n * Provides methods to add/remove favorites and retrieve favorite lists\n */\n readonly favorites: UserFavoriteService;\n\n /**\n * User like service for like operations\n * Provides methods to like/unlike content and retrieve like lists\n */\n readonly likes: UserLikeService;\n\n /**\n * Feedback service for submitting user feedback\n * Provides methods to submit feedback which is tracked in Linear\n */\n readonly feedback: FeedbackService;\n\n /**\n * Discovery service for retrieving API service information\n * Used to get information about available endpoints and services\n */\n private readonly discovery: DiscoveryService;\n\n /**\n * Creates a new MarketSDK instance\n *\n * @param options - Configuration options for the SDK\n */\n constructor(options: MarketSDKOptions = {}) {\n // Create shared token state object for all services\n const sharedTokenState = {\n accessToken: undefined,\n tokenExpiry: undefined,\n };\n\n super(options, undefined, sharedTokenState);\n log('MarketSDK instance created');\n\n // Initialize domain services with shared headers and token state for efficient reuse\n this.agents = new AgentService(options, this.headers, sharedTokenState);\n this.auth = new AuthService(options, this.headers, sharedTokenState);\n this.plugins = new PluginsService(options, this.headers, sharedTokenState);\n this.user = new UserService(options, this.headers, sharedTokenState);\n this.follows = new UserFollowService(options, this.headers, sharedTokenState);\n this.favorites = new UserFavoriteService(options, this.headers, sharedTokenState);\n this.likes = new UserLikeService(options, this.headers, sharedTokenState);\n this.feedback = new FeedbackService(options, this.headers, sharedTokenState);\n this.discovery = new DiscoveryService(options, this.headers, sharedTokenState);\n }\n\n /**\n * Retrieves the service discovery document\n *\n * The discovery document provides information about available API endpoints,\n * versions, and capabilities of the Market API.\n *\n * @returns Promise resolving to the service discovery document\n */\n async getDiscoveryDocument(): Promise<DiscoveryDocument> {\n return this.discovery.getDiscoveryDocument();\n }\n\n /**\n * Registers a new client for M2M authentication\n *\n * This method registers a client application with the Market API and returns\n * unique credentials (client_id and client_secret) that can be used for M2M authentication.\n * These credentials should be stored securely and used to initialize the SDK.\n *\n * @param request - Client registration request data\n * @returns Promise resolving to the client registration response with credentials\n * @throws Error if registration fails\n * @deprecated Use auth.registerClient() instead\n */\n async registerClient(request: ClientRegistrationRequest): Promise<ClientRegistrationResponse> {\n log('Registering client (deprecated method, use auth.registerClient): %s', request.clientName);\n return this.auth.registerClient(request);\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type {\n AgentCreateRequest,\n AgentCreateResponse,\n AgentDetailQuery,\n AgentInstallCountResponse,\n AgentItemDetail,\n AgentListQuery,\n AgentListResponse,\n AgentModifyRequest,\n AgentModifyResponse,\n AgentStatus,\n AgentStatusChangeResponse,\n AgentUploadRequest,\n AgentUploadResponse,\n AgentVersionCreateRequest,\n AgentVersionCreateResponse,\n AgentVersionModifyRequest,\n AgentVersionModifyResponse,\n OwnAgentListQuery,\n} from '../../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:agents');\n\n/**\n * Agents Service\n *\n * Provides access to agent-related functionality in the LobeHub Marketplace.\n * This service handles listing, searching, and retrieving detailed information\n * about agents available in the marketplace.\n */\nexport class AgentService extends BaseSDK {\n /**\n * Retrieves a list of agents from the marketplace\n *\n * Supports filtering, pagination, and localization of results.\n *\n * @param params - Query parameters for filtering and pagination\n * @param options - Optional request options\n * @returns Promise resolving to the agent list response containing items and pagination info\n */\n async getAgentList(\n params: AgentListQuery = {},\n options?: globalThis.RequestInit,\n ): Promise<AgentListResponse> {\n const locale = params.locale || this.defaultLocale;\n const queryParams = { ...params, locale };\n const queryString = this.buildQueryString(queryParams);\n\n log('Getting agent list: %O', queryParams);\n\n const result = await this.request<AgentListResponse>(`/v1/agents${queryString}`, options);\n log('Retrieved %d agents', result.items.length);\n return result;\n }\n\n /**\n * Retrieves a list of agents owned by the authenticated user\n *\n * Returns all agents regardless of their publish status (published, unpublished,\n * archived, deprecated). Requires authentication.\n *\n * @param params - Query parameters for filtering and pagination\n * @param options - Optional request options (must include authentication)\n * @returns Promise resolving to the agent list response containing items with status field\n */\n async getOwnAgents(\n params: OwnAgentListQuery = {},\n options?: globalThis.RequestInit,\n ): Promise<AgentListResponse> {\n const locale = params.locale || this.defaultLocale;\n const queryParams = { ...params, locale };\n const queryString = this.buildQueryString(queryParams);\n\n log('Getting own agent list: %O', queryParams);\n\n const result = await this.request<AgentListResponse>(`/v1/agents/own${queryString}`, options);\n log('Retrieved %d own agents', result.items.length);\n return result;\n }\n\n /**\n * Retrieves detailed information about a specific agent\n *\n * Returns complete agent information including A2A AgentCard data,\n * configuration, skills, and localized content.\n *\n * @param id - Unique identifier of the agent\n * @param params - Query parameters for locale and version\n * @param options - Optional request options\n * @returns Promise resolving to the agent detail information\n */\n async getAgentDetail(\n id: string,\n params: AgentDetailQuery = {},\n options?: globalThis.RequestInit,\n ): Promise<AgentItemDetail> {\n const locale = params.locale || this.defaultLocale;\n const queryParams: Record<string, string> = { locale };\n if (params.version !== undefined) {\n queryParams.version = params.version.toString();\n }\n const queryString = this.buildQueryString(queryParams);\n\n log('Getting agent detail: %O', { id, ...params });\n\n const result = await this.request<AgentItemDetail>(\n `/v1/agents/detail/${id}${queryString}`,\n options,\n );\n\n log('Agent detail successfully retrieved: %s', id);\n return result;\n }\n\n /**\n * Retrieves all published agent identifiers\n *\n * Returns a lightweight list of all published agent identifiers without\n * full agent metadata. This is useful for clients that need to know which\n * agents are available without fetching complete agent information.\n *\n * @param options - Optional request options\n * @returns Promise resolving to an array containing identifiers array and last modified time\n */\n async getPublishedIdentifiers(\n options?: globalThis.RequestInit,\n ): Promise<{ id: string; lastModified: string }[]> {\n log('Getting published agent identifiers');\n\n const result = await this.request<{ id: string; lastModified: string }[]>(\n '/v1/agents/identifiers',\n options,\n );\n log('Retrieved %d published agent identifiers', result.length);\n return result;\n }\n\n /**\n * Retrieves agent categories and their counts\n *\n * Returns a list of categories along with the number of agents in each category.\n * Useful for building category filters in a UI. Supports optional search filtering\n * via 'q' parameter and locale specification.\n *\n * @param params - Query parameters for filtering categories\n * @param options - Optional request options\n * @returns Promise resolving to an array of category items with counts\n */\n async getCategories(\n params: { locale?: string; q?: string } = {},\n options?: globalThis.RequestInit,\n ): Promise<{ category: string; count: number }[]> {\n const locale = params.locale || this.defaultLocale;\n const queryParams = { ...params, locale };\n const queryString = this.buildQueryString(queryParams);\n\n log('Getting agent categories: %O', queryParams);\n\n const result = await this.request<{ category: string; count: number }[]>(\n `/v1/agents/categories${queryString}`,\n options,\n );\n log('Retrieved %d categories', result.length);\n return result;\n }\n\n /**\n * Uploads an agent to the marketplace\n *\n * Allows users to upload new agents or update existing ones.\n * The agent data should conform to the A2A AgentCard specification.\n *\n * @param agentData - The agent data to upload\n * @param options - Optional request options\n * @returns Promise resolving to the upload response\n */\n async uploadAgent(\n agentData: AgentUploadRequest,\n options?: globalThis.RequestInit,\n ): Promise<AgentUploadResponse> {\n log('Uploading agent: %s@%s', agentData.agentIdentifier, agentData.version.version);\n\n const result = await this.request<AgentUploadResponse>('/v1/agents/upload', {\n body: JSON.stringify(agentData),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('Agent uploaded successfully: %O', result);\n return result;\n }\n\n /**\n * Creates a new agent in the marketplace\n *\n * @param agentData - The agent data to create\n * @param options - Optional request options\n * @returns Promise resolving to the created agent response\n */\n async createAgent(\n agentData: AgentCreateRequest,\n options?: globalThis.RequestInit,\n ): Promise<AgentCreateResponse> {\n log('Creating agent: %s', agentData.identifier);\n\n const result = await this.request<AgentCreateResponse>('/v1/agents/create', {\n body: JSON.stringify(agentData),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('Agent created successfully: %O', result);\n return result;\n }\n\n /**\n * Creates a new version for an existing agent\n *\n * @param versionData - The version data to create\n * @param options - Optional request options\n * @returns Promise resolving to the created version response\n */\n async createAgentVersion(\n versionData: AgentVersionCreateRequest,\n options?: globalThis.RequestInit,\n ): Promise<AgentVersionCreateResponse> {\n log('Creating agent version: %s', versionData.identifier);\n\n const result = await this.request<AgentVersionCreateResponse>('/v1/agents/version/create', {\n body: JSON.stringify(versionData),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('Agent version created successfully: %O', result);\n return result;\n }\n\n /**\n * Modifies an existing agent\n *\n * @param agentData - The agent data to modify\n * @param options - Optional request options\n * @returns Promise resolving to the modified agent response\n */\n async modifyAgent(\n agentData: AgentModifyRequest,\n options?: globalThis.RequestInit,\n ): Promise<AgentModifyResponse> {\n log('Modifying agent: %s', agentData.identifier);\n\n const result = await this.request<AgentModifyResponse>('/v1/agents/modify', {\n body: JSON.stringify(agentData),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('Agent modified successfully: %O', result);\n return result;\n }\n\n /**\n * Modifies a specific version of an existing agent\n *\n * @param versionData - The version data to modify\n * @param options - Optional request options\n * @returns Promise resolving to the modified version response\n */\n async modifyAgentVersion(\n versionData: AgentVersionModifyRequest,\n options?: globalThis.RequestInit,\n ): Promise<AgentVersionModifyResponse> {\n log('Modifying agent version: %s@%s', versionData.identifier, versionData.version);\n\n const result = await this.request<AgentVersionModifyResponse>('/v1/agents/version/modify', {\n body: JSON.stringify(versionData),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('Agent version modified successfully: %O', result);\n return result;\n }\n\n /**\n * Checks if an agent exists in the marketplace\n *\n * @param identifier - Unique identifier of the agent\n * @param options - Optional request options\n * @returns Promise resolving to true if agent exists, false otherwise\n */\n async checkAgentExists(identifier: string, options?: globalThis.RequestInit): Promise<boolean> {\n log('Checking if agent exists: %s', identifier);\n\n try {\n await this.getAgentDetail(identifier, {}, options);\n log('Agent exists: %s', identifier);\n return true;\n } catch {\n log('Agent does not exist: %s', identifier);\n return false;\n }\n }\n\n /**\n * Increases the install count for an agent\n *\n * This is a public endpoint that does not require authentication.\n * Call this method when a user installs or uses an agent.\n *\n * @param identifier - Unique identifier of the agent\n * @param options - Optional request options\n * @returns Promise resolving to the updated install count response\n */\n async increaseInstallCount(\n identifier: string,\n options?: globalThis.RequestInit,\n ): Promise<AgentInstallCountResponse> {\n log('Increasing install count for agent: %s', identifier);\n\n const result = await this.request<AgentInstallCountResponse>('/v1/agents/install-count', {\n body: JSON.stringify({ identifier }),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('Install count increased for agent %s: %d', identifier, result.installCount);\n return result;\n }\n\n /**\n * Changes the status of an agent\n *\n * Internal helper method used by publish/unpublish/archive/deprecate methods.\n * Requires authentication.\n *\n * @param identifier - Unique identifier of the agent\n * @param status - New status to set\n * @param options - Optional request options\n * @returns Promise resolving to the status change response\n */\n private async changeStatus(\n identifier: string,\n status: AgentStatus,\n options?: globalThis.RequestInit,\n ): Promise<AgentStatusChangeResponse> {\n log('Changing agent status: %s -> %s', identifier, status);\n\n const result = await this.modifyAgent({ identifier, status }, options);\n\n log('Agent status changed: %s -> %s', identifier, result.status);\n return {\n identifier: result.identifier,\n status: result.status as AgentStatus,\n success: true,\n };\n }\n\n /**\n * Publishes an agent to the marketplace\n *\n * Makes the agent publicly visible and available for installation.\n * Requires authentication and ownership of the agent.\n *\n * @param identifier - Unique identifier of the agent\n * @param options - Optional request options\n * @returns Promise resolving to the status change response\n */\n async publish(\n identifier: string,\n options?: globalThis.RequestInit,\n ): Promise<AgentStatusChangeResponse> {\n log('Publishing agent: %s', identifier);\n return this.changeStatus(identifier, 'published', options);\n }\n\n /**\n * Unpublishes an agent from the marketplace\n *\n * Hides the agent from public view. The agent data is preserved\n * and can be republished later.\n * Requires authentication and ownership of the agent.\n *\n * @param identifier - Unique identifier of the agent\n * @param options - Optional request options\n * @returns Promise resolving to the status change response\n */\n async unpublish(\n identifier: string,\n options?: globalThis.RequestInit,\n ): Promise<AgentStatusChangeResponse> {\n log('Unpublishing agent: %s', identifier);\n return this.changeStatus(identifier, 'unpublished', options);\n }\n\n /**\n * Archives an agent\n *\n * Marks the agent as archived. Archived agents are typically\n * no longer actively maintained but may still be accessible.\n * Requires authentication and ownership of the agent.\n *\n * @param identifier - Unique identifier of the agent\n * @param options - Optional request options\n * @returns Promise resolving to the status change response\n */\n async archive(\n identifier: string,\n options?: globalThis.RequestInit,\n ): Promise<AgentStatusChangeResponse> {\n log('Archiving agent: %s', identifier);\n return this.changeStatus(identifier, 'archived', options);\n }\n\n /**\n * Deprecates an agent\n *\n * Marks the agent as deprecated. Deprecated agents are still\n * accessible but users are encouraged to migrate to alternatives.\n * Requires authentication and ownership of the agent.\n *\n * @param identifier - Unique identifier of the agent\n * @param options - Optional request options\n * @returns Promise resolving to the status change response\n */\n async deprecate(\n identifier: string,\n options?: globalThis.RequestInit,\n ): Promise<AgentStatusChangeResponse> {\n log('Deprecating agent: %s', identifier);\n return this.changeStatus(identifier, 'deprecated', options);\n }\n}\n","import debug from 'debug';\nimport urlJoin from 'url-join';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type {\n AuthorizationCodeTokenRequest,\n ClientRegistrationRequest,\n ClientRegistrationResponse,\n OAuthTokenResponse,\n RefreshTokenRequest,\n} from '../../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:auth');\n\n/**\n * Auth Service\n *\n * Provides authentication and authorization functionality for the LobeHub Marketplace.\n * This service handles OIDC user authentication, client registration, and M2M token management.\n */\nexport class AuthService extends BaseSDK {\n // ===== OAuth Handoff Types =====\n /** Successful handoff payload */\n private static readonly HANDOFF_SUCCESS_STATUS = 'success' as const;\n /** Pending handoff status */\n private static readonly HANDOFF_PENDING_STATUS = 'pending' as const;\n /** Consumed handoff status */\n private static readonly HANDOFF_CONSUMED_STATUS = 'consumed' as const;\n /** Expired handoff status */\n private static readonly HANDOFF_EXPIRED_STATUS = 'expired' as const;\n\n /** Normalize token response from snake_case to camelCase fields */\n private static normalizeTokenResponse(data: any): OAuthTokenResponse {\n if (!data?.access_token || !data?.token_type) {\n throw new Error('Invalid token response payload');\n }\n\n return {\n accessToken: data.access_token,\n expiresIn: data.expires_in,\n idToken: data.id_token,\n refreshToken: data.refresh_token,\n scope: data.scope,\n tokenType: data.token_type,\n };\n }\n\n /**\n * Exchanges an authorization code or refresh token for access credentials\n *\n * Supports both the authorization_code and refresh_token grant types.\n * The method normalizes the response to camelCase field names.\n *\n * @param request - Token exchange parameters\n * @param options - Optional fetch options (e.g., custom headers)\n * @returns Promise resolving to the OAuth token payload\n */\n async exchangeOAuthToken(\n request: AuthorizationCodeTokenRequest | RefreshTokenRequest,\n options?: globalThis.RequestInit,\n ): Promise<OAuthTokenResponse> {\n const grantType = request.grantType ?? 'authorization_code';\n\n if (grantType !== 'authorization_code' && grantType !== 'refresh_token') {\n throw new Error(`Unsupported grant type: ${grantType}`);\n }\n\n log('Exchanging OAuth token using grant_type=%s', grantType);\n\n const tokenUrl = urlJoin(this.baseUrl, 'lobehub-oidc/token');\n const params = new URLSearchParams();\n params.set('grant_type', grantType);\n\n if (grantType === 'authorization_code') {\n const { clientId, code, codeVerifier, redirectUri } =\n request as AuthorizationCodeTokenRequest;\n\n if (!clientId || !code || !codeVerifier || !redirectUri) {\n throw new Error(\n 'clientId, code, codeVerifier, and redirectUri are required for authorization_code',\n );\n }\n\n params.set('client_id', clientId);\n params.set('code', code);\n params.set('code_verifier', codeVerifier);\n params.set('redirect_uri', redirectUri);\n } else {\n const { refreshToken, clientId } = request as RefreshTokenRequest;\n\n if (!refreshToken) {\n throw new Error('refreshToken is required for refresh_token grant');\n }\n\n params.set('refresh_token', refreshToken);\n if (clientId) params.set('client_id', clientId);\n }\n\n const headers = new Headers({\n 'Content-Type': 'application/x-www-form-urlencoded',\n });\n\n if (options?.headers) {\n new Headers(options.headers).forEach((value, key) => {\n headers.set(key, value);\n });\n }\n\n const requestInit: globalThis.RequestInit = {\n ...options,\n body: params,\n headers,\n method: 'POST',\n };\n\n const response = await fetch(tokenUrl, requestInit);\n\n let payload: any;\n try {\n payload = await response.json();\n } catch (error) {\n log('Failed to parse token response: %O', error);\n throw new Error(`Failed to parse token response: ${response.status} ${response.statusText}`);\n }\n\n if (!response.ok) {\n const errorDescription = payload?.error_description || payload?.error || response.statusText;\n const errorMsg = `Token exchange failed: ${response.status} ${errorDescription}`;\n log('Error: %s', errorMsg);\n throw new Error(errorMsg);\n }\n\n log('Token exchange successful');\n return AuthService.normalizeTokenResponse(payload);\n }\n\n /**\n * Retrieves user information from the OIDC userinfo endpoint\n *\n * Requires a valid access token in the Authorization header.\n *\n * @param accessToken - The access token to use for authentication\n * @param options - Optional request options\n * @returns Promise resolving to the user information\n */\n async getUserInfo(\n accessToken: string,\n options?: globalThis.RequestInit,\n ): Promise<{\n email?: string;\n email_verified?: boolean;\n name?: string;\n picture?: string;\n sub: string;\n }> {\n log('Getting user info');\n\n const userInfoUrl = urlJoin(this.baseUrl, 'lobehub-oidc/userinfo');\n\n const response = await fetch(userInfoUrl, {\n headers: {\n 'Authorization': `Bearer ${accessToken}`,\n 'Content-Type': 'application/json',\n },\n method: 'GET',\n ...options,\n });\n\n if (!response.ok) {\n const errorMsg = `Failed to fetch user info: ${response.status} ${response.statusText}`;\n log('Error: %s', errorMsg);\n throw new Error(errorMsg);\n }\n\n const userInfo = await response.json();\n log('User info retrieved successfully');\n return userInfo;\n }\n\n /**\n * Registers a new OAuth client with the marketplace\n *\n * This is typically used for device registration or application setup.\n * Returns client credentials that can be used for M2M authentication.\n *\n * @param clientData - The client registration data\n * @param options - Optional request options\n * @returns Promise resolving to the client credentials\n */\n async registerClient(\n clientData: ClientRegistrationRequest,\n options?: globalThis.RequestInit,\n ): Promise<ClientRegistrationResponse> {\n log('Registering client: %s (%s)', clientData.clientName, clientData.clientType);\n\n const result = await this.request<ClientRegistrationResponse>('/v1/clients/register', {\n body: JSON.stringify(clientData),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('Client registered successfully: %s', result.client_id);\n return result;\n }\n\n /**\n * Fetches an M2M (Machine-to-Machine) access token\n *\n * Uses client credentials to obtain an access token for server-to-server communication.\n * This method requires clientId and clientSecret to be set in the SDK options.\n *\n * @returns Promise resolving to the access token and expiration time\n */\n async getM2MToken(): Promise<{\n accessToken: string;\n expiresIn: number;\n }> {\n log('Fetching M2M token');\n\n const tokenInfo = await this.fetchM2MToken();\n\n log('M2M token fetched successfully');\n return tokenInfo;\n }\n\n /** OAuth handoff response shapes */\n // Using inline type aliases inside the class for better encapsulation\n // success: 200\n private static typeHandoffSuccess(data: { clientId: string; code: string; redirectUri: string }) {\n return {\n clientId: data.clientId,\n code: data.code,\n redirectUri: data.redirectUri,\n status: AuthService.HANDOFF_SUCCESS_STATUS,\n } as const;\n }\n\n /**\n * Get OAuth handoff status and data by id.\n * Maps server HTTP statuses to a typed status union:\n * - 200: success\n * - 202: pending\n * - 404: consumed\n * - 410: expired\n * - others: error (throws)\n */\n async getOAuthHandoff(\n id: string,\n options?: globalThis.RequestInit,\n ): Promise<\n | { clientId: string; code: string; redirectUri: string; status: 'success' }\n | { status: 'pending' }\n | { status: 'consumed' }\n | { status: 'expired' }\n > {\n if (!id) throw new Error('id is required');\n\n log('Getting OAuth handoff: %s', id);\n\n const handoffUrl = `${urlJoin(this.baseUrl, 'lobehub-oidc/handoff')}?id=${encodeURIComponent(id)}`;\n const response = await fetch(handoffUrl, {\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'GET',\n ...options,\n });\n\n // Map known statuses\n if (response.status === 200) {\n const json = await response.json();\n const result = AuthService.typeHandoffSuccess({\n clientId: json.clientId,\n code: json.code,\n redirectUri: json.redirectUri,\n });\n log('OAuth handoff success for id: %s', id);\n return result;\n }\n if (response.status === 202) {\n log('OAuth handoff pending for id: %s', id);\n return { status: AuthService.HANDOFF_PENDING_STATUS };\n }\n if (response.status === 404) {\n log('OAuth handoff consumed for id: %s', id);\n return { status: AuthService.HANDOFF_CONSUMED_STATUS };\n }\n if (response.status === 410) {\n log('OAuth handoff expired for id: %s', id);\n return { status: AuthService.HANDOFF_EXPIRED_STATUS };\n }\n\n // Attempt to parse error for diagnostics\n let errorMessage = `Failed to fetch OAuth handoff (status ${response.status} ${response.statusText})`;\n try {\n const errJson = await response.json();\n if (errJson && (errJson.message || errJson.error)) {\n errorMessage = `${errorMessage}: ${errJson.error ?? ''} ${errJson.message ?? ''}`.trim();\n }\n } catch {\n // ignore json parse error\n }\n log('Error: %s', errorMessage);\n throw new Error(errorMessage);\n }\n\n /**\n * Poll OAuth handoff result until it becomes terminal.\n * Terminal statuses: success, expired, consumed.\n * Non-terminal: pending → continue polling.\n */\n async pollOAuthHandoff(\n id: string,\n params: {\n intervalMs?: number;\n requestInit?: globalThis.RequestInit;\n signal?: AbortSignal;\n timeoutMs?: number;\n } = {},\n ): Promise<\n | { clientId: string; code: string; redirectUri: string; status: 'success' }\n | { status: 'expired' }\n | { status: 'consumed' }\n > {\n const intervalMs = params.intervalMs ?? 1500;\n const timeoutMs = params.timeoutMs ?? 60_000;\n const startedAt = Date.now();\n const { signal, requestInit } = params;\n\n log('Start polling OAuth handoff: %s', id);\n\n // eslint-disable-next-line no-constant-condition\n while (true) {\n if (signal?.aborted) {\n const err = new Error('Polling aborted');\n log('Error: %s', err.message);\n throw err;\n }\n if (Date.now() - startedAt > timeoutMs) {\n const err = new Error('Polling timeout');\n log('Error: %s', err.message);\n throw err;\n }\n\n const result = await this.getOAuthHandoff(id, requestInit);\n\n if (\n result.status === 'success' ||\n result.status === 'expired' ||\n result.status === 'consumed'\n ) {\n log('Stop polling OAuth handoff (terminal): %s -> %s', id, result.status);\n return result as\n | { clientId: string; code: string; redirectUri: string; status: 'success' }\n | { status: 'expired' }\n | { status: 'consumed' };\n }\n\n // pending → wait and retry\n await new Promise<void>((resolve) => {\n setTimeout(resolve, intervalMs);\n });\n }\n }\n}\n","import debug from 'debug';\nimport urlJoin from 'url-join';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type { DiscoveryDocument } from '../../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:discovery');\n\n/**\n * Discovery Service\n *\n * Provides functionality for retrieving service discovery information\n * from the LobeHub Marketplace API. The discovery document contains\n * metadata about available endpoints, authentication methods, and\n * other capabilities of the API.\n */\nexport class DiscoveryService extends BaseSDK {\n /** Cached discovery document to avoid repeated requests */\n private discoveryDoc?: DiscoveryDocument;\n\n /**\n * Retrieves the service discovery document\n *\n * This document contains information about available API endpoints,\n * authentication methods, and other capabilities of the Market API.\n * The result is cached after the first request to improve performance.\n *\n * @returns Promise resolving to the service discovery document\n */\n async getDiscoveryDocument(): Promise<DiscoveryDocument> {\n log('Fetching discovery document');\n if (this.discoveryDoc) {\n log('Returning cached discovery document');\n return this.discoveryDoc;\n }\n\n const res = await fetch(urlJoin(this.baseUrl, '/.well-known/discovery'));\n if (!res.ok) {\n throw new Error(await res.text());\n }\n\n this.discoveryDoc = (await res.json()) as DiscoveryDocument;\n log('Discovery document successfully fetched');\n return this.discoveryDoc;\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type { SubmitFeedbackRequest, SubmitFeedbackResponse } from '../../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:feedback');\n\n/**\n * Feedback Service\n *\n * Provides functionality for submitting user feedback to the LobeHub Marketplace.\n * Feedback is tracked in Linear for follow-up.\n *\n * Note: This endpoint is rate-limited to 3 requests per minute per IP.\n */\nexport class FeedbackService extends BaseSDK {\n /**\n * Submits user feedback\n *\n * Creates a feedback issue in Linear for tracking and follow-up.\n * Email is required for contact purposes.\n *\n * Rate limit: 3 requests per minute per IP\n *\n * @param data - The feedback data to submit\n * @param options - Optional request options\n * @returns Promise resolving to the feedback submission response\n * @throws Error if rate limit is exceeded (429) or submission fails\n *\n * @example\n * ```typescript\n * const response = await sdk.feedback.submitFeedback({\n * email: 'user@example.com',\n * title: 'Feature request',\n * message: 'It would be great if...',\n * clientInfo: {\n * url: window.location.href,\n * userAgent: navigator.userAgent,\n * },\n * });\n * console.log('Feedback submitted:', response.issueUrl);\n * ```\n */\n async submitFeedback(\n data: SubmitFeedbackRequest,\n options?: globalThis.RequestInit,\n ): Promise<SubmitFeedbackResponse> {\n log('Submitting feedback: %s', data.title);\n\n const result = await this.request<SubmitFeedbackResponse>('/v1/user/feedback', {\n body: JSON.stringify(data),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('Feedback submitted successfully: %s', result.issueId);\n return result;\n }\n}\n","import type {\n CallReportRequest,\n CallReportResponse,\n CloudGatewayRequest,\n CloudGatewayResponse,\n InstallReportRequest,\n InstallReportResponse,\n PluginItemDetail,\n PluginManifest,\n} from '@lobehub/market-types';\nimport debug from 'debug';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type {\n CategoryItem,\n CategoryListQuery,\n CodeInterpreterToolName,\n CodeInterpreterToolParams,\n PluginListResponse,\n PluginQueryParams,\n RunBuildInToolsResponse,\n} from '../../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:plugins');\n\n/**\n * Plugins Service\n *\n * Provides access to plugin-related functionality in the LobeHub Marketplace.\n * This service handles listing, searching, and retrieving detailed information\n * about plugins available in the marketplace.\n */\nexport class PluginsService extends BaseSDK {\n /**\n * Retrieves a list of plugins from the marketplace\n *\n * Supports filtering, pagination, and localization of results.\n *\n * @param params - Query parameters for filtering and pagination\n * @param options\n * @returns Promise resolving to the plugin list response containing items and pagination info\n */\n async getPluginList(\n params: PluginQueryParams = {},\n options?: globalThis.RequestInit,\n ): Promise<PluginListResponse> {\n const locale = params.locale || this.defaultLocale;\n const queryParams = { ...params, locale };\n const queryString = this.buildQueryString(queryParams);\n\n log('Getting plugin list: %O', queryParams);\n\n const result = await this.request<PluginListResponse>(`/v1/plugins${queryString}`, options);\n log('Retrieved %d plugins', result.items.length);\n return result;\n }\n\n /**\n * Retrieves all plugin categories and their counts\n *\n * Returns a list of categories along with the number of plugins in each category.\n * Useful for building category filters in a UI. Supports optional search filtering\n * via 'q' parameter and locale specification.\n *\n * @param params - Query parameters for filtering categories\n * @param options - Optional request options\n * @returns Promise resolving to an array of category items with counts\n */\n async getCategories(\n params: CategoryListQuery = {},\n options?: globalThis.RequestInit,\n ): Promise<CategoryItem[]> {\n const locale = params.locale || this.defaultLocale;\n const queryParams = { ...params, locale };\n const queryString = this.buildQueryString(queryParams);\n\n log('Getting plugin categories: %O', queryParams);\n\n const result = await this.request<CategoryItem[]>(\n `/v1/plugins/categories${queryString}`,\n options,\n );\n log('Retrieved %d categories', result.length);\n return result;\n }\n\n /**\n * Retrieves all published plugin identifiers\n *\n * Returns a lightweight list of all published plugin identifiers without\n * full plugin metadata. This is useful for clients that need to know which\n * plugins are available without fetching complete plugin information.\n *\n * @returns Promise resolving to an array containing identifiers array and last modified time\n */\n async getPublishedIdentifiers(\n options?: globalThis.RequestInit,\n ): Promise<{ identifier: string; lastModified: string }[]> {\n log('Getting published plugin identifiers');\n\n const result = await this.request<{ identifier: string; lastModified: string }[]>(\n '/v1/plugins/identifiers',\n options,\n );\n log('Retrieved %d published plugin identifiers', result.length);\n return result;\n }\n\n /**\n * Retrieves the manifest for a specific plugin\n *\n * The manifest contains detailed information about a plugin, including\n * its capabilities, tools, prompts, and resources.\n *\n * @param identifier - Unique identifier of the plugin\n * @param locale - Optional locale for localized content (defaults to SDK default locale)\n * @param version - Optional specific version to retrieve (defaults to latest)\n * @param options\n * @returns Promise resolving to the plugin manifest\n */\n async getPluginManifest(\n {\n locale,\n version,\n identifier,\n }: {\n identifier: string;\n locale?: string;\n version?: string;\n },\n options?: globalThis.RequestInit,\n ): Promise<PluginManifest> {\n log('Getting plugin manifest: %O', { identifier, locale, version });\n const localeParam = locale || this.defaultLocale;\n const params: Record<string, string> = { locale: localeParam };\n if (version) {\n params.version = version;\n }\n const queryString = this.buildQueryString(params);\n\n const manifest = await this.request<PluginManifest>(\n `/v1/plugins/${identifier}/manifest${queryString}`,\n options,\n );\n\n log('Plugin manifest successfully retrieved: %s', identifier);\n return manifest;\n }\n\n /**\n * Retrieves the plugin detailed information about a plugin, including\n * its capabilities, tools, prompts, and resources.\n *\n * @param identifier - Unique identifier of the plugin\n * @param locale - Optional locale for localized content (defaults to SDK default locale)\n * @param version - Optional specific version to retrieve (defaults to latest)\n * @returns Promise resolving to the plugin manifest\n */\n async getPluginDetail(\n {\n locale,\n version,\n identifier,\n }: {\n identifier: string;\n locale?: string;\n version?: string;\n },\n options?: globalThis.RequestInit,\n ): Promise<PluginItemDetail> {\n log('Getting plugin detail: %O', { identifier, locale, version });\n const localeParam = locale || this.defaultLocale;\n const params: Record<string, string> = { locale: localeParam };\n if (version) {\n params.version = version;\n }\n const queryString = this.buildQueryString(params);\n\n const manifest = await this.request<PluginItemDetail>(\n `/v1/plugins/${identifier}${queryString}`,\n options,\n );\n\n log('Plugin manifest successfully retrieved: %s', identifier);\n return manifest;\n }\n\n /**\n * Report a plugin installation attempt\n *\n * Reports the outcome of a plugin installation attempt, including timing,\n * success status, manifest information, and error details if applicable.\n * This helps improve plugin validation and provides analytics about installation success rates.\n *\n * @param reportData - The installation report data\n * @returns Promise resolving to the report submission response\n *\n */\n async reportInstallation(reportData: InstallReportRequest): Promise<InstallReportResponse> {\n log('Reporting installation for %s@%s', reportData.identifier, reportData.version);\n\n const result = await this.request<InstallReportResponse>('/v1/plugins/report/installation', {\n body: JSON.stringify(reportData),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n });\n\n log('Installation report submitted successfully: %O', result);\n return result;\n }\n\n /**\n * Report a plugin method call attempt\n *\n * Reports the outcome of a plugin method call, including timing,\n * success status, method information, and error details if applicable.\n * This helps improve plugin performance monitoring and provides usage analytics.\n *\n * @param reportData - The call report data\n * @returns Promise resolving to the report submission response\n */\n async reportCall(reportData: CallReportRequest): Promise<CallReportResponse> {\n log(\n 'Reporting call for %s@%s - %s:%s',\n reportData.identifier,\n reportData.version,\n reportData.methodType,\n reportData.methodName,\n );\n\n const result = await this.request<CallReportResponse>('/v1/plugins/report/call', {\n body: JSON.stringify(reportData),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n });\n\n log('Call report submitted successfully: %O', result);\n return result;\n }\n\n /**\n * Call a cloud-hosted plugin tool via the cloud gateway\n *\n * Proxies tool calls to official cloud-hosted plugins with authentication and validation.\n * This method requires authentication via bearer token (apiKey or M2M credentials).\n *\n * @param request - The cloud gateway request containing plugin identifier, tool name, and parameters\n * @param options - Optional request options\n * @returns Promise resolving to the tool call result\n *\n * @example\n * ```typescript\n * const result = await sdk.plugins.callCloudGateway({\n * identifier: 'my-plugin',\n * toolName: 'myTool',\n * apiParams: { param1: 'value1' }\n * });\n * ```\n */\n async callCloudGateway(\n request: CloudGatewayRequest,\n options?: globalThis.RequestInit,\n ): Promise<CloudGatewayResponse> {\n log('Calling cloud gateway for plugin %s, tool %s', request.identifier, request.toolName);\n\n const result = await this.request<CloudGatewayResponse>('/v1/plugins/cloud-gateway', {\n body: JSON.stringify(request),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('Cloud gateway call completed: %O', {\n identifier: request.identifier,\n isError: result.isError,\n toolName: request.toolName,\n });\n\n return result;\n }\n\n // ============================================================================\n // Code Interpreter / RunBuildInTools Methods\n // ============================================================================\n\n /**\n * Execute a built-in tool via AWS Bedrock AgentCore Code Interpreter\n *\n * This method provides access to file operations, command execution, and session management\n * tools running in an isolated sandbox environment. Sessions are automatically managed\n * per user/topic combination.\n *\n * @param toolName - Name of the tool to execute\n * @param params - Tool-specific parameters\n * @param context - User and topic context for session isolation\n * @param options - Optional request options\n * @returns Promise resolving to the tool execution result\n *\n * @example\n * ```typescript\n * // Run a shell command\n * const result = await sdk.plugins.runBuildInTool(\n * 'runCommand',\n * { command: 'ls -la' },\n * { userId: 'user-123', topicId: 'topic-456' }\n * );\n *\n * // Read a file\n * const fileResult = await sdk.plugins.runBuildInTool(\n * 'readLocalFile',\n * { path: '/tmp/example.txt' },\n * { userId: 'user-123', topicId: 'topic-456' }\n * );\n * ```\n */\n async runBuildInTool<T extends CodeInterpreterToolName>(\n toolName: T,\n params: CodeInterpreterToolParams[T],\n context: { topicId: string; userId: string },\n options?: globalThis.RequestInit,\n ): Promise<RunBuildInToolsResponse> {\n log('Running built-in tool: %s for user %s, topic %s', toolName, context.userId, context.topicId);\n\n const result = await this.request<RunBuildInToolsResponse>('/v1/plugins/run-buildin-tools', {\n body: JSON.stringify({\n params,\n toolName,\n topicId: context.topicId,\n userId: context.userId,\n }),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('Built-in tool execution completed: %O', {\n success: result.success,\n toolName,\n });\n\n return result;\n }\n\n /**\n * Execute a shell command in the Code Interpreter sandbox\n *\n * @param command - Shell command to execute\n * @param context - User and topic context\n * @param options - Additional options (background, timeout)\n * @returns Promise resolving to command execution result\n */\n async runCommand(\n command: string,\n context: { topicId: string; userId: string },\n options?: { background?: boolean; timeout?: number },\n ): Promise<RunBuildInToolsResponse> {\n return this.runBuildInTool('runCommand', { command, ...options }, context);\n }\n\n /**\n * Read a file from the Code Interpreter sandbox\n *\n * @param path - File path to read\n * @param context - User and topic context\n * @param options - Line range options (startLine, endLine)\n * @returns Promise resolving to file content\n */\n async readFile(\n path: string,\n context: { topicId: string; userId: string },\n options?: { endLine?: number; startLine?: number },\n ): Promise<RunBuildInToolsResponse> {\n return this.runBuildInTool('readLocalFile', { path, ...options }, context);\n }\n\n /**\n * Write content to a file in the Code Interpreter sandbox\n *\n * @param path - File path to write\n * @param content - Content to write\n * @param context - User and topic context\n * @param options - Additional options (createDirectories)\n * @returns Promise resolving to write result\n */\n async writeFile(\n path: string,\n content: string,\n context: { topicId: string; userId: string },\n options?: { createDirectories?: boolean },\n ): Promise<RunBuildInToolsResponse> {\n return this.runBuildInTool('writeLocalFile', { content, path, ...options }, context);\n }\n\n /**\n * List files in a directory in the Code Interpreter sandbox\n *\n * @param directoryPath - Directory path to list\n * @param context - User and topic context\n * @returns Promise resolving to directory listing\n */\n async listFiles(\n directoryPath: string,\n context: { topicId: string; userId: string },\n ): Promise<RunBuildInToolsResponse> {\n return this.runBuildInTool('listLocalFiles', { directoryPath }, context);\n }\n\n /**\n * Search for files matching a glob pattern\n *\n * @param pattern - Glob pattern (e.g., \"**\\/*.ts\")\n * @param context - User and topic context\n * @param directory - Base directory (optional)\n * @returns Promise resolving to matching files\n */\n async globFiles(\n pattern: string,\n context: { topicId: string; userId: string },\n directory?: string,\n ): Promise<RunBuildInToolsResponse> {\n return this.runBuildInTool('globLocalFiles', { directory, pattern }, context);\n }\n\n /**\n * Search file contents using regex pattern\n *\n * @param pattern - Regex pattern to search\n * @param directory - Directory to search\n * @param context - User and topic context\n * @param options - Additional options (filePattern, recursive)\n * @returns Promise resolving to grep results\n */\n async grepContent(\n pattern: string,\n directory: string,\n context: { topicId: string; userId: string },\n options?: { filePattern?: string; recursive?: boolean },\n ): Promise<RunBuildInToolsResponse> {\n return this.runBuildInTool('grepContent', { directory, pattern, ...options }, context);\n }\n\n /**\n * Export a file from the Code Interpreter sandbox to a pre-signed URL\n *\n * This method uploads a file from the sandbox to an external storage location\n * via a pre-signed URL (e.g., S3 pre-signed URL). The upload is performed\n * using Python code execution within the sandbox.\n *\n * @param path - File path in sandbox to export\n * @param uploadUrl - Pre-signed URL to upload the file to\n * @param context - User and topic context\n * @returns Promise resolving to export result with success status and file info\n *\n * @example\n * ```typescript\n * const result = await sdk.plugins.exportFile(\n * './output/result.csv',\n * 'https://s3.amazonaws.com/bucket/key?X-Amz-Signature=...',\n * { userId: 'user-123', topicId: 'topic-456' }\n * );\n *\n * if (result.success && result.data?.result.success) {\n * console.log('File exported:', result.data.result.size, 'bytes');\n * }\n * ```\n */\n async exportFile(\n path: string,\n uploadUrl: string,\n context: { topicId: string; userId: string },\n ): Promise<RunBuildInToolsResponse> {\n return this.runBuildInTool('exportFile', { path, uploadUrl }, context);\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type {\n UpdateUserInfoRequest,\n UpdateUserInfoResponse,\n UserInfoQuery,\n UserInfoResponse,\n} from '../../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:user');\n\n/**\n * User Service\n *\n * Provides access to user-related functionality in the LobeHub Marketplace.\n * This service handles retrieving and updating user profiles and their associated agents.\n */\nexport class UserService extends BaseSDK {\n /**\n * Retrieves user information by account ID or userName\n *\n * Returns user profile along with their published public agents.\n * This is a public endpoint that doesn't require authentication.\n *\n * @param idOrUserName - The account ID (number) or userName (string)\n * @param params - Query parameters for locale\n * @param options - Optional request options\n * @returns Promise resolving to the user info response\n */\n async getUserInfo(\n idOrUserName: number | string,\n params: UserInfoQuery = {},\n options?: globalThis.RequestInit,\n ): Promise<UserInfoResponse> {\n const locale = params.locale || this.defaultLocale;\n const queryParams = { locale };\n const queryString = this.buildQueryString(queryParams);\n\n log('Getting user info: %O', { idOrUserName, ...params });\n\n const result = await this.request<UserInfoResponse>(\n `/v1/user/info/${idOrUserName}${queryString}`,\n options,\n );\n\n log('User info successfully retrieved for: %s', idOrUserName);\n return result;\n }\n\n /**\n * Updates the authenticated user's profile information\n *\n * Allows updating userName, displayName, avatarUrl, and meta fields.\n * Requires authentication - the user must be authenticated to update their own profile.\n *\n * @param data - The data to update (userName, displayName, avatarUrl, meta)\n * @param options - Optional request options (must include authentication)\n * @returns Promise resolving to the update response with the updated user profile\n * @throws Error if userName is already taken or update fails\n */\n async updateUserInfo(\n data: UpdateUserInfoRequest,\n options?: globalThis.RequestInit,\n ): Promise<UpdateUserInfoResponse> {\n log('Updating user info: %O', data);\n\n const result = await this.request<UpdateUserInfoResponse>('/v1/user/update', {\n body: JSON.stringify(data),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('User info updated successfully');\n return result;\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type {\n CheckFollowResponse,\n FollowListResponse,\n FollowRequest,\n PaginationQuery,\n SuccessResponse,\n} from '../../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:user-follow');\n\n/**\n * User Follow Service\n *\n * Provides access to user follow functionality in the LobeHub Marketplace.\n * This service handles following/unfollowing users and retrieving follow relationships.\n */\nexport class UserFollowService extends BaseSDK {\n /**\n * Follow a user\n *\n * Creates a follow relationship where the authenticated user follows the target user.\n * Requires authentication.\n *\n * @param followingId - The ID of the user to follow\n * @param options - Optional request options\n * @returns Promise resolving to success response\n * @throws Error if already following or cannot follow yourself\n */\n async follow(followingId: number, options?: globalThis.RequestInit): Promise<SuccessResponse> {\n log('Following user: %d', followingId);\n\n const body: FollowRequest = { followingId };\n\n const result = await this.request<SuccessResponse>('/v1/user/follows', {\n body: JSON.stringify(body),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('Successfully followed user: %d', followingId);\n return result;\n }\n\n /**\n * Unfollow a user\n *\n * Removes the follow relationship where the authenticated user unfollows the target user.\n * Requires authentication.\n *\n * @param followingId - The ID of the user to unfollow\n * @param options - Optional request options\n * @returns Promise resolving to success response\n * @throws Error if follow relationship not found\n */\n async unfollow(followingId: number, options?: globalThis.RequestInit): Promise<SuccessResponse> {\n log('Unfollowing user: %d', followingId);\n\n const body: FollowRequest = { followingId };\n\n const result = await this.request<SuccessResponse>('/v1/user/follows', {\n body: JSON.stringify(body),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'DELETE',\n ...options,\n });\n\n log('Successfully unfollowed user: %d', followingId);\n return result;\n }\n\n /**\n * Check follow status\n *\n * Checks if the authenticated user is following the target user and if they follow each other.\n * Requires authentication.\n *\n * @param targetUserId - The ID of the user to check\n * @param options - Optional request options\n * @returns Promise resolving to follow status (isFollowing, isMutual)\n */\n async checkFollowStatus(\n targetUserId: number,\n options?: globalThis.RequestInit,\n ): Promise<CheckFollowResponse> {\n log('Checking follow status for user: %d', targetUserId);\n\n const queryString = this.buildQueryString({ targetUserId: String(targetUserId) });\n\n const result = await this.request<CheckFollowResponse>(\n `/v1/user/follows/check${queryString}`,\n options,\n );\n\n log('Follow status retrieved: %O', result);\n return result;\n }\n\n /**\n * Get following list\n *\n * Retrieves the list of users that a user is following.\n * This is a public endpoint - no authentication required.\n *\n * @param userId - The ID of the user whose following list to retrieve\n * @param params - Pagination parameters\n * @param options - Optional request options\n * @returns Promise resolving to list of following users\n */\n async getFollowing(\n userId: number,\n params: PaginationQuery = {},\n options?: globalThis.RequestInit,\n ): Promise<FollowListResponse> {\n log('Getting following list for user: %d', userId);\n\n const queryParams: Record<string, string> = {};\n if (params.limit !== undefined) queryParams.limit = String(params.limit);\n if (params.offset !== undefined) queryParams.offset = String(params.offset);\n\n const queryString = this.buildQueryString(queryParams);\n\n const result = await this.request<FollowListResponse>(\n `/v1/user/follows/${userId}/following${queryString}`,\n options,\n );\n\n log('Following list retrieved for user: %d', userId);\n return result;\n }\n\n /**\n * Get followers list\n *\n * Retrieves the list of users who follow a user.\n * This is a public endpoint - no authentication required.\n *\n * @param userId - The ID of the user whose followers list to retrieve\n * @param params - Pagination parameters\n * @param options - Optional request options\n * @returns Promise resolving to list of followers\n */\n async getFollowers(\n userId: number,\n params: PaginationQuery = {},\n options?: globalThis.RequestInit,\n ): Promise<FollowListResponse> {\n log('Getting followers list for user: %d', userId);\n\n const queryParams: Record<string, string> = {};\n if (params.limit !== undefined) queryParams.limit = String(params.limit);\n if (params.offset !== undefined) queryParams.offset = String(params.offset);\n\n const queryString = this.buildQueryString(queryParams);\n\n const result = await this.request<FollowListResponse>(\n `/v1/user/follows/${userId}/followers${queryString}`,\n options,\n );\n\n log('Followers list retrieved for user: %d', userId);\n return result;\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type {\n CheckFavoriteResponse,\n FavoriteListResponse,\n FavoriteQuery,\n FavoriteRequest,\n InteractionTargetType,\n SuccessResponse,\n} from '../../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:user-favorite');\n\n/**\n * User Favorite Service\n *\n * Provides access to user favorite functionality in the LobeHub Marketplace.\n * This service handles adding/removing favorites and retrieving favorite lists.\n */\nexport class UserFavoriteService extends BaseSDK {\n /**\n * Add to favorites\n *\n * Adds an agent or plugin to the authenticated user's favorites.\n * Requires authentication.\n *\n * @param targetType - The type of target ('agent' or 'plugin')\n * @param targetId - The ID of the target agent/plugin\n * @param options - Optional request options\n * @returns Promise resolving to success response\n * @throws Error if already in favorites\n */\n async addFavorite(\n targetType: InteractionTargetType,\n targetId: string,\n options?: globalThis.RequestInit,\n ): Promise<SuccessResponse> {\n log('Adding favorite: %s %d', targetType, targetId);\n\n const body: FavoriteRequest = { targetId, targetType };\n\n const result = await this.request<SuccessResponse>('/v1/user/favorites', {\n body: JSON.stringify(body),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('Successfully added favorite: %s %d', targetType, targetId);\n return result;\n }\n\n /**\n * Remove from favorites\n *\n * Removes an agent or plugin from the authenticated user's favorites.\n * Requires authentication.\n *\n * @param targetType - The type of target ('agent' or 'plugin')\n * @param targetId - The ID of the target agent/plugin\n * @param options - Optional request options\n * @returns Promise resolving to success response\n * @throws Error if favorite not found\n */\n async removeFavorite(\n targetType: InteractionTargetType,\n targetId: string,\n options?: globalThis.RequestInit,\n ): Promise<SuccessResponse> {\n log('Removing favorite: %s %d', targetType, targetId);\n\n const body: FavoriteRequest = { targetId, targetType };\n\n const result = await this.request<SuccessResponse>('/v1/user/favorites', {\n body: JSON.stringify(body),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'DELETE',\n ...options,\n });\n\n log('Successfully removed favorite: %s %d', targetType, targetId);\n return result;\n }\n\n /**\n * Check favorite status\n *\n * Checks if the authenticated user has favorited a specific agent or plugin.\n * Requires authentication.\n *\n * @param targetType - The type of target ('agent' or 'plugin')\n * @param targetId - The ID of the target agent/plugin\n * @param options - Optional request options\n * @returns Promise resolving to favorite status\n */\n async checkFavorite(\n targetType: InteractionTargetType,\n targetId: number,\n options?: globalThis.RequestInit,\n ): Promise<CheckFavoriteResponse> {\n log('Checking favorite status: %s %d', targetType, targetId);\n\n const queryString = this.buildQueryString({\n targetId: String(targetId),\n targetType,\n });\n\n const result = await this.request<CheckFavoriteResponse>(\n `/v1/user/favorites/check${queryString}`,\n options,\n );\n\n log('Favorite status retrieved: %O', result);\n return result;\n }\n\n /**\n * Get my favorites\n *\n * Retrieves the authenticated user's favorites.\n * Requires authentication.\n *\n * @param params - Query parameters for filtering and pagination\n * @param options - Optional request options\n * @returns Promise resolving to list of favorites\n */\n async getMyFavorites(\n params: FavoriteQuery = {},\n options?: globalThis.RequestInit,\n ): Promise<FavoriteListResponse> {\n log('Getting my favorites: %O', params);\n\n const queryParams: Record<string, string> = {};\n if (params.limit !== undefined) queryParams.limit = String(params.limit);\n if (params.offset !== undefined) queryParams.offset = String(params.offset);\n if (params.type !== undefined) queryParams.type = params.type;\n\n const queryString = this.buildQueryString(queryParams);\n\n const result = await this.request<FavoriteListResponse>(\n `/v1/user/favorites/me${queryString}`,\n options,\n );\n\n log('My favorites retrieved');\n return result;\n }\n\n /**\n * Get user's favorites\n *\n * Retrieves a user's favorites.\n * This is a public endpoint - no authentication required.\n *\n * @param userId - The ID of the user whose favorites to retrieve\n * @param params - Query parameters for filtering and pagination\n * @param options - Optional request options\n * @returns Promise resolving to list of favorites\n */\n async getUserFavorites(\n userId: number,\n params: FavoriteQuery = {},\n options?: globalThis.RequestInit,\n ): Promise<FavoriteListResponse> {\n log('Getting favorites for user: %d', userId);\n\n const queryParams: Record<string, string> = {};\n if (params.limit !== undefined) queryParams.limit = String(params.limit);\n if (params.offset !== undefined) queryParams.offset = String(params.offset);\n if (params.type !== undefined) queryParams.type = params.type;\n\n const queryString = this.buildQueryString(queryParams);\n\n const result = await this.request<FavoriteListResponse>(\n `/v1/user/favorites/${userId}${queryString}`,\n options,\n );\n\n log('Favorites retrieved for user: %d', userId);\n return result;\n }\n\n /**\n * Get user's favorite agents with details\n *\n * Retrieves a user's favorite agents with full details.\n * This is a public endpoint - no authentication required.\n *\n * @param userId - The ID of the user whose favorite agents to retrieve\n * @param params - Pagination parameters\n * @param options - Optional request options\n * @returns Promise resolving to list of favorite agents\n */\n async getUserFavoriteAgents(\n userId: number,\n params: Pick<FavoriteQuery, 'limit' | 'offset'> = {},\n options?: globalThis.RequestInit,\n ): Promise<FavoriteListResponse> {\n log('Getting favorite agents for user: %d', userId);\n\n const queryParams: Record<string, string> = {};\n if (params.limit !== undefined) queryParams.limit = String(params.limit);\n if (params.offset !== undefined) queryParams.offset = String(params.offset);\n\n const queryString = this.buildQueryString(queryParams);\n\n const result = await this.request<FavoriteListResponse>(\n `/v1/user/favorites/${userId}/agents${queryString}`,\n options,\n );\n\n log('Favorite agents retrieved for user: %d', userId);\n return result;\n }\n\n /**\n * Get user's favorite plugins with details\n *\n * Retrieves a user's favorite plugins with full details.\n * This is a public endpoint - no authentication required.\n *\n * @param userId - The ID of the user whose favorite plugins to retrieve\n * @param params - Pagination parameters\n * @param options - Optional request options\n * @returns Promise resolving to list of favorite plugins\n */\n async getUserFavoritePlugins(\n userId: number,\n params: Pick<FavoriteQuery, 'limit' | 'offset'> = {},\n options?: globalThis.RequestInit,\n ): Promise<FavoriteListResponse> {\n log('Getting favorite plugins for user: %d', userId);\n\n const queryParams: Record<string, string> = {};\n if (params.limit !== undefined) queryParams.limit = String(params.limit);\n if (params.offset !== undefined) queryParams.offset = String(params.offset);\n\n const queryString = this.buildQueryString(queryParams);\n\n const result = await this.request<FavoriteListResponse>(\n `/v1/user/favorites/${userId}/plugins${queryString}`,\n options,\n );\n\n log('Favorite plugins retrieved for user: %d', userId);\n return result;\n }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type {\n CheckLikeResponse,\n InteractionTargetType,\n LikeListResponse,\n LikeQuery,\n LikeRequest,\n SuccessResponse,\n ToggleLikeResponse,\n} from '../../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:user-like');\n\n/**\n * User Like Service\n *\n * Provides access to user like functionality in the LobeHub Marketplace.\n * This service handles liking/unliking content and retrieving like lists.\n */\nexport class UserLikeService extends BaseSDK {\n /**\n * Like content\n *\n * Likes an agent or plugin for the authenticated user.\n * Requires authentication.\n *\n * @param targetType - The type of target ('agent' or 'plugin')\n * @param targetId - The ID of the target agent/plugin\n * @param options - Optional request options\n * @returns Promise resolving to success response\n * @throws Error if already liked\n */\n async like(\n targetType: InteractionTargetType,\n targetId: string,\n options?: globalThis.RequestInit,\n ): Promise<SuccessResponse> {\n log('Liking: %s %d', targetType, targetId);\n\n const body: LikeRequest = { targetId, targetType };\n\n const result = await this.request<SuccessResponse>('/v1/user/likes', {\n body: JSON.stringify(body),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('Successfully liked: %s %d', targetType, targetId);\n return result;\n }\n\n /**\n * Unlike content\n *\n * Unlikes an agent or plugin for the authenticated user.\n * Requires authentication.\n *\n * @param targetType - The type of target ('agent' or 'plugin')\n * @param targetId - The ID of the target agent/plugin\n * @param options - Optional request options\n * @returns Promise resolving to success response\n * @throws Error if like not found\n */\n async unlike(\n targetType: InteractionTargetType,\n targetId: string,\n options?: globalThis.RequestInit,\n ): Promise<SuccessResponse> {\n log('Unliking: %s %d', targetType, targetId);\n\n const body: LikeRequest = { targetId, targetType };\n\n const result = await this.request<SuccessResponse>('/v1/user/likes', {\n body: JSON.stringify(body),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'DELETE',\n ...options,\n });\n\n log('Successfully unliked: %s %d', targetType, targetId);\n return result;\n }\n\n /**\n * Toggle like status\n *\n * Toggles the like status - likes if not liked, unlikes if already liked.\n * Requires authentication.\n *\n * @param targetType - The type of target ('agent' or 'plugin')\n * @param targetId - The ID of the target agent/plugin\n * @param options - Optional request options\n * @returns Promise resolving to toggle response with new like status\n */\n async toggleLike(\n targetType: InteractionTargetType,\n targetId: string,\n options?: globalThis.RequestInit,\n ): Promise<ToggleLikeResponse> {\n log('Toggling like: %s %d', targetType, targetId);\n\n const body: LikeRequest = { targetId, targetType };\n\n const result = await this.request<ToggleLikeResponse>('/v1/user/likes/toggle', {\n body: JSON.stringify(body),\n headers: {\n 'Content-Type': 'application/json',\n },\n method: 'POST',\n ...options,\n });\n\n log('Like toggled, new status: %O', result);\n return result;\n }\n\n /**\n * Check like status\n *\n * Checks if the authenticated user has liked a specific agent or plugin.\n * Requires authentication.\n *\n * @param targetType - The type of target ('agent' or 'plugin')\n * @param targetId - The ID of the target agent/plugin\n * @param options - Optional request options\n * @returns Promise resolving to like status\n */\n async checkLike(\n targetType: InteractionTargetType,\n targetId: number,\n options?: globalThis.RequestInit,\n ): Promise<CheckLikeResponse> {\n log('Checking like status: %s %d', targetType, targetId);\n\n const queryString = this.buildQueryString({\n targetId: String(targetId),\n targetType,\n });\n\n const result = await this.request<CheckLikeResponse>(\n `/v1/user/likes/check${queryString}`,\n options,\n );\n\n log('Like status retrieved: %O', result);\n return result;\n }\n\n /**\n * Get my likes\n *\n * Retrieves the authenticated user's likes.\n * Requires authentication.\n *\n * @param params - Query parameters for filtering and pagination\n * @param options - Optional request options\n * @returns Promise resolving to list of likes\n */\n async getMyLikes(\n params: LikeQuery = {},\n options?: globalThis.RequestInit,\n ): Promise<LikeListResponse> {\n log('Getting my likes: %O', params);\n\n const queryParams: Record<string, string> = {};\n if (params.limit !== undefined) queryParams.limit = String(params.limit);\n if (params.offset !== undefined) queryParams.offset = String(params.offset);\n if (params.type !== undefined) queryParams.type = params.type;\n\n const queryString = this.buildQueryString(queryParams);\n\n const result = await this.request<LikeListResponse>(\n `/v1/user/likes/me${queryString}`,\n options,\n );\n\n log('My likes retrieved');\n return result;\n }\n\n /**\n * Get user's likes\n *\n * Retrieves a user's likes.\n * This is a public endpoint - no authentication required.\n *\n * @param userId - The ID of the user whose likes to retrieve\n * @param params - Query parameters for filtering and pagination\n * @param options - Optional request options\n * @returns Promise resolving to list of likes\n */\n async getUserLikes(\n userId: number,\n params: LikeQuery = {},\n options?: globalThis.RequestInit,\n ): Promise<LikeListResponse> {\n log('Getting likes for user: %d', userId);\n\n const queryParams: Record<string, string> = {};\n if (params.limit !== undefined) queryParams.limit = String(params.limit);\n if (params.offset !== undefined) queryParams.offset = String(params.offset);\n if (params.type !== undefined) queryParams.type = params.type;\n\n const queryString = this.buildQueryString(queryParams);\n\n const result = await this.request<LikeListResponse>(\n `/v1/user/likes/${userId}${queryString}`,\n options,\n );\n\n log('Likes retrieved for user: %d', userId);\n return result;\n }\n\n /**\n * Get user's liked agents with details\n *\n * Retrieves a user's liked agents with full details.\n * This is a public endpoint - no authentication required.\n *\n * @param userId - The ID of the user whose liked agents to retrieve\n * @param params - Pagination parameters\n * @param options - Optional request options\n * @returns Promise resolving to list of liked agents\n */\n async getUserLikedAgents(\n userId: number,\n params: Pick<LikeQuery, 'limit' | 'offset'> = {},\n options?: globalThis.RequestInit,\n ): Promise<LikeListResponse> {\n log('Getting liked agents for user: %d', userId);\n\n const queryParams: Record<string, string> = {};\n if (params.limit !== undefined) queryParams.limit = String(params.limit);\n if (params.offset !== undefined) queryParams.offset = String(params.offset);\n\n const queryString = this.buildQueryString(queryParams);\n\n const result = await this.request<LikeListResponse>(\n `/v1/user/likes/${userId}/agents${queryString}`,\n options,\n );\n\n log('Liked agents retrieved for user: %d', userId);\n return result;\n }\n\n /**\n * Get user's liked plugins with details\n *\n * Retrieves a user's liked plugins with full details.\n * This is a public endpoint - no authentication required.\n *\n * @param userId - The ID of the user whose liked plugins to retrieve\n * @param params - Pagination parameters\n * @param options - Optional request options\n * @returns Promise resolving to list of liked plugins\n */\n async getUserLikedPlugins(\n userId: number,\n params: Pick<LikeQuery, 'limit' | 'offset'> = {},\n options?: globalThis.RequestInit,\n ): Promise<LikeListResponse> {\n log('Getting liked plugins for user: %d', userId);\n\n const queryParams: Record<string, string> = {};\n if (params.limit !== undefined) queryParams.limit = String(params.limit);\n if (params.offset !== undefined) queryParams.offset = String(params.offset);\n\n const queryString = this.buildQueryString(queryParams);\n\n const result = await this.request<LikeListResponse>(\n `/v1/user/likes/${userId}/plugins${queryString}`,\n options,\n );\n\n log('Liked plugins retrieved for user: %d', userId);\n return result;\n }\n}\n","import { z } from 'zod';\n\n/**\n * Visibility levels for plugins in the marketplace\n * - public: Visible to all users\n * - private: Visible only to the owner and authorized users\n * - internal: Visible only within the organization\n */\nexport const VisibilityEnumSchema = z.enum(['public', 'private', 'internal']);\n\n/**\n * Publication status options for plugins\n * - published: Publicly available in the marketplace\n * - unpublished: Not publicly visible\n * - archived: Marked as no longer maintained\n * - deprecated: Marked as deprecated, but still available\n */\nexport const StatusEnumSchema = z.enum(['published', 'unpublished', 'archived', 'deprecated']);\n\n/**\n * Common query parameters for admin list endpoints\n * These parameters are used for pagination, filtering, and sorting.\n */\nexport interface AdminListQueryParams {\n /** Current page number (1-based) */\n current?: number;\n /** Search keyword for filtering results */\n keyword?: string;\n /** Number of items per page */\n pageSize?: number;\n /** Field to sort results by */\n sortField?: string;\n /** Sort direction */\n sortOrder?: 'ascend' | 'descend';\n}\n\n/**\n * Common response format for paginated admin list endpoints\n * This structure provides both the data and pagination information.\n */\nexport interface AdminListResponse<T> {\n /** Current page number (1-based) */\n current: number;\n /** Array of items for the current page */\n data: T[];\n /** Number of items per page */\n pageSize: number;\n /** Total number of items across all pages */\n total: number;\n /** Total number of pages */\n totalPages: number;\n}\n\n/**\n * Review status options\n * - pending: Awaiting review\n * - approved: Review approved\n * - rejected: Review rejected\n */\nexport type ReviewStatus = 'pending' | 'approved' | 'rejected';\n\n/**\n * Review status schema for validation\n */\nexport const ReviewStatusEnumSchema = z.enum(['published', 'draft', 'review', 'rejected']);\n\n/**\n * Parameters for admin plugin listing\n * Extends the common query parameters with plugin-specific filters.\n */\nexport interface AdminPluginParams {\n /** Filter for featured plugins */\n featured?: boolean;\n /** Maximum number of items to return */\n limit?: number;\n /** Number of items to skip */\n offset?: number;\n /** Sort direction */\n order?: 'asc' | 'desc';\n /** Field to sort by */\n orderBy?: 'createdAt' | 'updatedAt' | 'installCount' | 'ratingAverage' | 'githubUpdateAt';\n /** Filter by owner ID */\n ownerId?: number;\n /** Search query string */\n query?: string;\n /** Filter by plugin status */\n status?: 'published' | 'draft' | 'review' | 'rejected';\n /** Filter by visibility level */\n visibility?: 'public' | 'private' | 'unlisted';\n}\n\n/**\n * Parameters for creating a new plugin version\n */\nexport interface PluginVersionCreateParams {\n /** Author or organization name for this version */\n author?: string;\n /** URL to the author's website or profile */\n authorUrl?: string;\n /** Capability flag: whether this plugin provides prompts */\n capabilitiesPrompts?: boolean;\n /** Capability flag: whether this plugin manages resources (MCP) */\n capabilitiesResources?: boolean;\n /** Capability flag: whether this plugin provides tools */\n capabilitiesTools?: boolean;\n /** Category key for the plugin */\n category?: string;\n /** Description of the plugin version */\n description?: string;\n /** Icon URL or emoji for the plugin */\n icon?: string;\n /** Whether this is the latest version */\n isLatest?: boolean;\n /** Whether this version has been validated */\n isValidated?: boolean;\n /** Name of the plugin version */\n name?: string;\n /** Array of prompt definitions */\n prompts?: any[];\n /** README content */\n readme?: string;\n /** Array of resource definitions */\n resources?: any[];\n /** Summary of the plugin version */\n summary?: string;\n /** Array of tags for categorization */\n tags?: string[];\n /** Array of tool definitions */\n tools?: any[];\n /** Semantic version string (e.g., \"1.0.0\") */\n version: string;\n}\n\n/**\n * Parameters for updating an existing plugin version\n */\nexport interface PluginVersionUpdateParams {\n /** Author or organization name for this version */\n author?: string;\n /** URL to the author's website or profile */\n authorUrl?: string;\n /** Capability flag: whether this plugin provides prompts */\n capabilitiesPrompts?: boolean;\n /** Capability flag: whether this plugin manages resources (MCP) */\n capabilitiesResources?: boolean;\n /** Capability flag: whether this plugin provides tools */\n capabilitiesTools?: boolean;\n /** Category key for the plugin */\n category?: string;\n /** Description of the plugin version */\n description?: string;\n /** Icon URL or emoji for the plugin */\n icon?: string;\n /** Whether this version has been validated */\n isValidated?: boolean;\n /** Name of the plugin version */\n name?: string;\n /** Array of prompt definitions */\n prompts?: any[];\n /** README content */\n readme?: string;\n /** Array of resource definitions */\n resources?: any[];\n /** Summary of the plugin version */\n summary?: string;\n /** Array of tags for categorization */\n tags?: string[];\n /** Array of tool definitions */\n tools?: any[];\n}\n\n/**\n * Parameters for updating plugin basic metadata (non-version specific)\n */\nexport interface PluginUpdateParams {\n /** Cloud endpoint URL for official cloud-hosted deployment */\n cloudEndpoint?: string;\n /** GitHub last update timestamp */\n githubUpdateAt?: string;\n /** Unique identifier for the plugin */\n identifier?: string;\n /** Whether this plugin has been claimed by its original author */\n isClaimed?: boolean;\n /** Whether this plugin is featured */\n isFeatured?: boolean;\n /** Whether this plugin is officially maintained by LobeHub */\n isOfficial?: boolean;\n /** Publication status */\n status?: 'published' | 'draft' | 'review' | 'rejected';\n /** Visibility level */\n visibility?: 'public' | 'private' | 'unlisted';\n}\n\n/**\n * Plugin localization data\n */\nexport interface PluginLocalization {\n /** Plugin description in specific locale */\n description: string;\n /** Locale identifier (e.g., 'en-US', 'zh-CN') */\n locale: string;\n /** Plugin name in specific locale */\n name: string;\n /** Summary in specific locale */\n summary?: string;\n /** Plugin tags in specific locale */\n tags?: string[];\n}\n\n/**\n * Parameters for importing plugin i18n data\n */\nexport interface PluginI18nImportParams {\n /** Plugin identifier */\n identifier: string;\n /** Array of localizations for this plugin version */\n localizations: PluginLocalization[];\n /** Plugin version */\n version: string;\n}\n\n/**\n * Response from plugin i18n import operation\n */\nexport interface PluginI18nImportResponse {\n /** Number of failed localizations */\n failed: number;\n /** Number of successful localizations */\n success: number;\n /** Total number of processed localizations */\n totalLocalizations: number;\n}\n\n/**\n * Unclaimed plugin item data structure\n * Represents a plugin that has not been claimed by its author\n */\nexport interface UnclaimedPluginItem {\n /** Plugin ID */\n id: number;\n /** Plugin identifier */\n identifier: string;\n}\n","/**\n * Trusted Client Token Utilities\n *\n * Provides encryption utilities for creating trusted client tokens\n * that can be used with the Market SDK.\n *\n * @example\n * ```typescript\n * import { createTrustedClientToken, TrustedClientPayload } from '@lobehub/market-sdk';\n *\n * const payload: TrustedClientPayload = {\n * userId: 'user_xxx',\n * clientId: 'lobechat-com',\n * email: 'user@example.com',\n * timestamp: Date.now(),\n * nonce: generateNonce(),\n * name: 'John Doe',\n * };\n *\n * const token = createTrustedClientToken(payload, secret);\n *\n * // Use with MarketSDK\n * const sdk = new MarketSDK({ trustedClientToken: token });\n * ```\n */\n\nimport { createCipheriv, createHash, randomBytes } from 'node:crypto';\n\n/**\n * Trusted client payload structure\n */\nexport interface TrustedClientPayload {\n /** Client identifier (must be in the trusted clients whitelist) */\n clientId: string;\n /** User email address (required) */\n email: string;\n /** Whether the email is verified */\n emailVerified?: boolean;\n /** User display name */\n name?: string;\n /** Random nonce for uniqueness */\n nonce: string;\n /** Unix timestamp in milliseconds when token was created */\n timestamp: number;\n /** Clerk user ID (format: user_xxx) */\n userId: string;\n}\n\n// Crypto constants\nconst CRYPTO = {\n ALGORITHM: 'aes-256-gcm' as const,\n AUTH_TAG_LENGTH: 16,\n IV_LENGTH: 12,\n KEY_LENGTH: 32,\n};\n\nconst SECRET_PREFIX = 'lobehub-market_tcs_';\n\n/**\n * Derive a 32-byte encryption key from the secret\n */\nfunction deriveKey(secret: string): Buffer {\n if (secret.startsWith(SECRET_PREFIX)) {\n return createHash('sha256').update(secret).digest();\n }\n\n const key = Buffer.from(secret, 'hex');\n\n if (key.length !== CRYPTO.KEY_LENGTH) {\n throw new Error(\n `Invalid key length: expected ${CRYPTO.KEY_LENGTH} bytes, got ${key.length} bytes.`,\n );\n }\n\n return key;\n}\n\n/**\n * Encrypt a trusted client payload\n *\n * @param payload - The payload to encrypt\n * @param secret - The shared secret (prefixed format or 64-char hex)\n * @returns Base64-encoded encrypted token\n */\nexport function createTrustedClientToken(payload: TrustedClientPayload, secret: string): string {\n const plaintext = JSON.stringify(payload);\n const key = deriveKey(secret);\n const iv = randomBytes(CRYPTO.IV_LENGTH);\n\n const cipher = createCipheriv(CRYPTO.ALGORITHM, key, iv);\n const ciphertext = Buffer.concat([cipher.update(plaintext, 'utf8'), cipher.final()]);\n const authTag = cipher.getAuthTag();\n\n return Buffer.concat([iv, ciphertext, authTag]).toString('base64');\n}\n\n/**\n * Generate a random nonce for the payload\n *\n * @param length - Length of the nonce (default: 8)\n * @returns Random alphanumeric string\n */\nexport function generateNonce(length = 8): string {\n const bytes = randomBytes(Math.ceil(length / 2));\n return bytes.toString('hex').slice(0, length);\n}\n\n/**\n * Create a complete trusted client payload with auto-generated timestamp and nonce\n *\n * @param params - User and client info\n * @returns Complete payload ready for encryption\n */\nexport function buildTrustedClientPayload(params: {\n clientId: string;\n email: string;\n emailVerified?: boolean;\n name?: string;\n userId: string;\n}): TrustedClientPayload {\n return {\n ...params,\n nonce: generateNonce(),\n timestamp: Date.now(),\n };\n}\n","/**\n * LobeHub Market JavaScript SDK\n *\n * This is the main entry point for the LobeHub Market SDK.\n * It exports the primary client classes and all type definitions.\n */\n\n// Export admin-related functionality\nexport { MarketAdmin } from './admin';\n\n// Export market-related functionality\nexport { MarketSDK } from './market';\n\n// Export SDK-specific types\nexport * from './types';\n\n// Export trusted client utilities\nexport {\n buildTrustedClientPayload,\n createTrustedClientToken,\n generateNonce,\n type TrustedClientPayload,\n} from './utils/trustedClient';\n\n// Re-export all type definitions from the types package\nexport * from '@lobehub/market-types';\n"],"mappings":";AAAA,OAAOA,YAAW;;;ACAlB,OAAO,WAAW;AAClB,SAAS,eAAe;AACxB,OAAO,aAAa;AAKpB,IAAM,MAAM,MAAM,sBAAsB;AAajC,IAAM,UAAN,MAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA8BnB,YACE,UAA4B,CAAC,GAC7B,eACA,kBACA;AAEA,SAAK,UAAU,QAAQ,WAAW,QAAQ,IAAI,mBAAmB;AACjE,SAAK,aAAa,QAAQ,KAAK,SAAS,KAAK;AAC7C,SAAK,eAAe,QAAQ,KAAK,SAAS,OAAO;AAG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O,OAAO,OAAO,CAAC,IAAI,YAAY,OAAO,CAAC,EAAE,SAAS,QAAQ;AACnE;AAQO,SAAS,cAAc,SAAS,GAAW;AAChD,QAAM,QAAQ,YAAY,KAAK,KAAK,SAAS,CAAC,CAAC;AAC/C,SAAO,MAAM,SAAS,KAAK,EAAE,MAAM,GAAG,MAAM;AAC9C;AAQO,SAAS,0BAA0B,QAMjB;AACvB,SAAO;AAAA,IACL,GAAG;AAAA,IACH,OAAO,cAAc;AAAA,IACrB,WAAW,KAAK,IAAI;AAAA,EACtB;AACF;;;ACpGA,cAAc;","names":["debug","debug","log","debug","debug","log","debug","debug","log","debug","debug","log","debug","debug","log","debug","debug","log","debug","debug","log","debug","log","debug","debug","debug","log","debug","AgentService","debug","urlJoin","log","debug","urlJoin","debug","urlJoin","log","debug","urlJoin","debug","log","debug","debug","log","debug","debug","log","debug","debug","log","debug","debug","log","debug","debug","log","debug","log","debug","AgentService"]}
|