{"version":3,"sources":["../src/admin/MarketAdmin.ts","../src/core/BaseSDK.ts","../src/core/MarketAPIError.ts","../src/core/version.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/SkillCollectionService.ts","../src/admin/services/PluginEnvService.ts","../src/market/market-sdk.ts","../src/market/services/AgentProfileService.ts","../src/market/services/AgentService.ts","../src/market/services/AgentGroupService.ts","../src/market/services/AuthService.ts","../src/market/services/ConnectService.ts","../src/market/services/CredService.ts","../src/market/services/DiscoveryService.ts","../src/market/services/FeedbackService.ts","../src/market/services/PluginsService.ts","../src/market/services/SkillService.ts","../src/market/services/MarketSkillCollectionService.ts","../src/market/services/MarketSkillService.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  SkillCollectionService,\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   * Skill collection management service\n   * Provides methods for managing curated skill collection localizations\n   */\n  readonly skillCollections: SkillCollectionService;\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    this.skillCollections = new SkillCollectionService(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';\nimport { MarketAPIError } from './MarketAPIError';\nimport { SDK_USER_AGENT } from './version';\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    // Determine User-Agent: custom > default SDK UA\n    const userAgent = options.userAgent || SDK_USER_AGENT;\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        'User-Agent': userAgent,\n      };\n      log('Created new headers object with User-Agent: %s', userAgent);\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      let errorBody: any;\n      try {\n        errorBody = await response.json();\n        console.error('Request error: %s', JSON.stringify(errorBody));\n      } catch {\n        // Response body is not JSON or empty\n        errorBody = undefined;\n      }\n\n      throw new MarketAPIError(response.status, response.statusText, errorBody);\n    }\n\n    log('Request successful: %s', url);\n\n    // Some endpoints (e.g., plugin events) intentionally return 204 with no body.\n    if (response.status === 204) {\n      return undefined as T;\n    }\n\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","/**\n * Market API Error\n *\n * Custom error class for Market API errors that preserves the structured error response.\n */\nconst normalizeErrorDetails = (errorBody?: any) => {\n  if (!errorBody) return undefined;\n\n  if (typeof errorBody.error === 'object' && errorBody.error !== null) {\n    return errorBody.error;\n  }\n\n  if (typeof errorBody.error === 'string') {\n    return {\n      ...(errorBody.code ? { code: errorBody.code } : {}),\n      message: errorBody.error,\n    };\n  }\n\n  if (typeof errorBody.message === 'string') {\n    return {\n      ...(errorBody.code ? { code: errorBody.code } : {}),\n      message: errorBody.message,\n    };\n  }\n\n  return undefined;\n};\n\nexport class MarketAPIError extends Error {\n  /** HTTP status code */\n  public readonly status: number;\n\n  /** Error code from API response */\n  public readonly code?: string;\n\n  /** The full error response body */\n  public readonly errorBody?: any;\n\n  constructor(status: number, statusText: string, errorBody?: any) {\n    const errorDetails = normalizeErrorDetails(errorBody);\n    const errorCode = errorDetails?.code;\n    const errorMessage = errorDetails?.message;\n\n    // Use the API's error message if available, otherwise use status text\n    const message = errorMessage || statusText;\n\n    super(message);\n\n    this.name = 'MarketAPIError';\n    this.status = status;\n    this.code = errorCode;\n    this.errorBody = errorBody;\n\n    // Maintains proper stack trace for where our error was thrown (only available on V8)\n    if (Error.captureStackTrace) {\n      Error.captureStackTrace(this, MarketAPIError);\n    }\n  }\n\n  /**\n   * Check if this is a specific error code\n   */\n  isErrorCode(code: string): boolean {\n    return this.code === code;\n  }\n\n  /**\n   * Get the full error details from the API response\n   */\n  getErrorDetails(): any {\n    return normalizeErrorDetails(this.errorBody);\n  }\n\n  /**\n   * Convert to a plain object for logging or serialization\n   */\n  toJSON(): any {\n    return {\n      code: this.code,\n      errorBody: this.errorBody,\n      message: this.message,\n      name: this.name,\n      status: this.status,\n    };\n  }\n}\n","/**\n * SDK Version\n *\n * This version should be kept in sync with package.json version.\n * It is used for User-Agent header to identify SDK requests.\n */\nexport const SDK_VERSION = '0.31.3';\n\n/**\n * SDK User-Agent string\n */\nexport const SDK_USER_AGENT = `LobeHub-Market-SDK/${SDK_VERSION}`;\n","import 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 * 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 type {\n  AdminSkillCollectionDetail,\n  AdminSkillCollectionListQuery,\n  AdminSkillCollectionListResponse,\n  BatchUpsertSkillCollectionLocalizationsRequest,\n  CreateSkillCollectionRequest,\n  SkillCollectionLocalization,\n  SkillCollectionLocalizationBatchResponse,\n  UpdateSkillCollectionRequest,\n  UpsertSkillCollectionLocalizationRequest,\n} from '@lobehub/market-types';\nimport debug from 'debug';\n\nimport { BaseSDK } from '@/core/BaseSDK';\n\nconst log = debug('lobe-market-sdk:admin:skill-collections');\n\nexport class SkillCollectionService extends BaseSDK {\n  async createCollection(data: CreateSkillCollectionRequest): Promise<AdminSkillCollectionDetail> {\n    log('Creating skill collection: %O', data);\n\n    const result = await this.request<AdminSkillCollectionDetail>('/admin/skills/collections', {\n      body: JSON.stringify(data),\n      method: 'POST',\n    });\n\n    log('Created skill collection %d (%s)', result.id, result.slug);\n    return result;\n  }\n\n  async deleteCollection(id: number): Promise<void> {\n    log('Deleting skill collection: %d', id);\n\n    await this.request<void>(`/admin/skills/collections/${id}`, {\n      method: 'DELETE',\n    });\n\n    log('Deleted skill collection: %d', id);\n  }\n\n  async getCollection(id: number): Promise<AdminSkillCollectionDetail> {\n    log('Getting skill collection: %d', id);\n\n    const result = await this.request<AdminSkillCollectionDetail>(\n      `/admin/skills/collections/${id}`,\n    );\n\n    log('Retrieved skill collection %d (%s)', result.id, result.slug);\n    return result;\n  }\n\n  async getCollections(\n    params: AdminSkillCollectionListQuery = {},\n  ): Promise<AdminSkillCollectionListResponse> {\n    log('Getting skill collections: %O', params);\n\n    const queryString = this.buildQueryString(params);\n    const result = await this.request<AdminSkillCollectionListResponse>(\n      `/admin/skills/collections${queryString}`,\n    );\n\n    log('Retrieved %d skill collections', result.items.length);\n    return result;\n  }\n\n  async batchUpsertLocalizations(\n    collectionId: number,\n    data: BatchUpsertSkillCollectionLocalizationsRequest,\n  ): Promise<SkillCollectionLocalizationBatchResponse> {\n    log('Batch upserting localizations for collection %d: %O', collectionId, data);\n\n    const result = await this.request<SkillCollectionLocalizationBatchResponse>(\n      `/admin/skills/collections/${collectionId}/localizations/batch`,\n      {\n        body: JSON.stringify(data),\n        method: 'POST',\n      },\n    );\n\n    log('Processed %d localizations for collection %d', result.results.length, collectionId);\n    return result;\n  }\n\n  async deleteLocalization(\n    collectionId: number,\n    locale: string,\n  ): Promise<{ message: string; success: boolean }> {\n    log('Deleting localization for collection %d: %s', collectionId, locale);\n\n    const result = await this.request<{ message: string; success: boolean }>(\n      `/admin/skills/collections/${collectionId}/localizations/${encodeURIComponent(locale)}`,\n      {\n        method: 'DELETE',\n      },\n    );\n\n    log('Deleted localization for collection %d: %s', collectionId, locale);\n    return result;\n  }\n\n  async getLocalization(\n    collectionId: number,\n    locale: string,\n  ): Promise<SkillCollectionLocalization> {\n    log('Getting localization for collection %d: %s', collectionId, locale);\n\n    const result = await this.request<SkillCollectionLocalization>(\n      `/admin/skills/collections/${collectionId}/localizations/${encodeURIComponent(locale)}`,\n    );\n\n    log('Retrieved localization %s for collection %d', locale, collectionId);\n    return result;\n  }\n\n  async getLocalizations(collectionId: number): Promise<SkillCollectionLocalization[]> {\n    log('Getting localizations for collection %d', collectionId);\n\n    const result = await this.request<SkillCollectionLocalization[]>(\n      `/admin/skills/collections/${collectionId}/localizations`,\n    );\n\n    log('Retrieved %d localizations for collection %d', result.length, collectionId);\n    return result;\n  }\n\n  async updateCollection(\n    id: number,\n    data: UpdateSkillCollectionRequest,\n  ): Promise<AdminSkillCollectionDetail> {\n    log('Updating skill collection %d: %O', id, data);\n\n    const result = await this.request<AdminSkillCollectionDetail>(\n      `/admin/skills/collections/${id}`,\n      {\n        body: JSON.stringify(data),\n        method: 'PUT',\n      },\n    );\n\n    log('Updated skill collection %d (%s)', result.id, result.slug);\n    return result;\n  }\n\n  async upsertLocalization(\n    collectionId: number,\n    locale: string,\n    data: UpsertSkillCollectionLocalizationRequest,\n  ): Promise<SkillCollectionLocalization> {\n    log('Upserting localization for collection %d: %s %O', collectionId, locale, data);\n\n    const result = await this.request<SkillCollectionLocalization>(\n      `/admin/skills/collections/${collectionId}/localizations/${encodeURIComponent(locale)}`,\n      {\n        body: JSON.stringify(data),\n        method: 'PUT',\n      },\n    );\n\n    log('Upserted localization for collection %d: %s', collectionId, locale);\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  AgentGroupService,\n  AgentProfileService,\n  AgentService,\n  AuthService,\n  ConnectService,\n  CredService,\n  DiscoveryService,\n  FeedbackService,\n  MarketSkillCollectionService,\n  MarketSkillService,\n  PluginsService,\n  SkillService,\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   * Agent profile service for M2M agent identity management\n   * Provides methods to view and update the current agent's profile\n   */\n  readonly agentProfile: AgentProfileService;\n\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   * Agent Groups service for accessing agent group-related functionality\n   * Provides methods to list, create, version, and manage agent groups\n   */\n  readonly agentGroups: AgentGroupService;\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   * Connect service for OAuth connection management\n   * Provides methods to list providers, initiate OAuth flows, and manage connections\n   */\n  readonly connect: ConnectService;\n\n  /**\n   * Creds service for user credential management\n   * Provides methods to create, list, update, delete credentials, and inject into sandboxes\n   */\n  readonly creds: CredService;\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   * Skill service for skill providers and tool calling\n   * Provides methods to list providers, list tools, and call tools on connected OAuth providers\n   */\n  readonly skills: SkillService;\n\n  /**\n   * Market Skill Collection service for curated marketplace skill collections\n   * Provides methods to list and retrieve manually curated skill collections\n   */\n  readonly skillCollections: MarketSkillCollectionService;\n\n  /**\n   * Market Skill service for marketplace skill resources\n   * Provides methods to list, search, retrieve details, and download skills from the marketplace\n   */\n  readonly marketSkills: MarketSkillService;\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.agentProfile = new AgentProfileService(options, this.headers, sharedTokenState);\n    this.agents = new AgentService(options, this.headers, sharedTokenState);\n    this.agentGroups = new AgentGroupService(options, this.headers, sharedTokenState);\n    this.auth = new AuthService(options, this.headers, sharedTokenState);\n    this.connect = new ConnectService(options, this.headers, sharedTokenState);\n    this.creds = new CredService(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.skills = new SkillService(options, this.headers, sharedTokenState);\n    this.skillCollections = new MarketSkillCollectionService(\n      options,\n      this.headers,\n      sharedTokenState,\n    );\n    this.marketSkills = new MarketSkillService(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  AgentProfileResponse,\n  UpdateAgentProfileRequest,\n  UpdateAgentProfileResponse,\n} from '../../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:agent-profile');\n\n/**\n * Agent Profile Service\n *\n * Provides methods for M2M agents to view and update their own profile.\n * All methods require M2M authentication (Bearer token with client_credentials).\n */\nexport class AgentProfileService extends BaseSDK {\n  /**\n   * Retrieves the current agent's profile\n   *\n   * Returns the agent entity bound to the authenticated M2M client.\n   * If no agent exists yet, one is lazily provisioned on the server side.\n   *\n   * @param options - Optional request options\n   * @returns Promise resolving to the agent profile response\n   */\n  async getProfile(options?: globalThis.RequestInit): Promise<AgentProfileResponse> {\n    log('Getting agent profile');\n\n    const result = await this.request<AgentProfileResponse>('/v1/agent/profile', options);\n\n    log('Agent profile retrieved: id=%d, identifier=%s', result.agent.id, result.agent.identifier);\n    return result;\n  }\n\n  /**\n   * Updates the current agent's display information\n   *\n   * Allows updating the agent's name, avatar, and tags.\n   * Requires M2M authentication.\n   *\n   * @param data - The profile fields to update (name, avatar, tags)\n   * @param options - Optional request options\n   * @returns Promise resolving to the updated agent profile response\n   */\n  async updateProfile(\n    data: UpdateAgentProfileRequest,\n    options?: globalThis.RequestInit,\n  ): Promise<UpdateAgentProfileResponse> {\n    log('Updating agent profile: %O', data);\n\n    const result = await this.request<UpdateAgentProfileResponse>('/v1/agent/profile', {\n      body: JSON.stringify(data),\n      headers: {\n        'Content-Type': 'application/json',\n      },\n      method: 'PATCH',\n      ...options,\n    });\n\n    log('Agent profile updated: id=%d, name=%s', result.agent.id, result.agent.name);\n    return result;\n  }\n}\n","import { AgentEventRequest, type SitemapResponse } from '@lobehub/market-types';\nimport debug from 'debug';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type {\n  AgentCreateRequest,\n  AgentCreateResponse,\n  AgentDetailQuery,\n  AgentForkRequest,\n  AgentForkResponse,\n  AgentForkSourceResponse,\n  AgentForksResponse,\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   *\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   * @deprecated Use {@link AgentService.getSitemap} instead.\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 a paginated list of published agent identifiers for sitemaps\n   *\n   * @param params - Pagination (`page` defaults to 1, `pageSize` defaults to 200, max 500 server-side)\n   * @param options - Optional request options\n   */\n  async getSitemap(\n    params: { page?: number; pageSize?: number } = {},\n    options?: globalThis.RequestInit,\n  ): Promise<SitemapResponse> {\n    const queryString = this.buildQueryString(params);\n    log('Getting agent sitemap%s', queryString);\n\n    const result = await this.request<SitemapResponse>(`/v1/agents/sitemap${queryString}`, options);\n    log(\n      'Retrieved agent sitemap page %d/%d (%d items)',\n      result.currentPage,\n      result.totalPages,\n      result.items.length,\n    );\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   * Record an agent event for the authenticated user\n   *\n   * Records agent usage actions (add, chat, click) for analytics.\n   *\n   * @param eventData - The agent event payload\n   * @param options - Optional request init overrides\n   */\n  async createEvent(eventData: AgentEventRequest, options?: globalThis.RequestInit): Promise<void> {\n    log('Recording agent event: %s for %s', eventData.event, eventData.identifier);\n\n    await this.request<void>('/v1/agents/events', {\n      body: JSON.stringify(eventData),\n      headers: {\n        'Content-Type': 'application/json',\n      },\n      method: 'POST',\n      ...options,\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  /**\n   * Retrieves a list of agents that use a specific plugin\n   *\n   * Searches through agent configurations to find those with the specified\n   * plugin ID in their config.plugins array. Only returns published and\n   * publicly visible agents.\n   *\n   * @param params - Query parameters including pluginId, pagination, and locale\n   * @param options - Optional request options\n   * @returns Promise resolving to the agent list response\n   */\n  async getAgentsByPlugin(\n    params: { locale?: string; page?: number; pageSize?: number; pluginId: string },\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 agents by plugin: %s', params.pluginId);\n\n    const result = await this.request<AgentListResponse>(\n      `/v1/agents/by-plugin${queryString}`,\n      options,\n    );\n    log('Retrieved %d agents for plugin %s', result.items.length, params.pluginId);\n    return result;\n  }\n\n  /**\n   * Forks an existing agent to create a new agent owned by the current user\n   *\n   * Creates a complete copy of the agent including configuration, skills,\n   * and version data. Statistical data (ratings, likes, etc.) are reset to zero.\n   * Requires authentication.\n   *\n   * @param sourceIdentifier - Identifier of the agent to fork\n   * @param forkData - Fork request parameters (new identifier, name, etc.)\n   * @param options - Optional request options\n   * @returns Promise resolving to the fork response with new agent details\n   */\n  async forkAgent(\n    sourceIdentifier: string,\n    forkData: AgentForkRequest,\n    options?: globalThis.RequestInit,\n  ): Promise<AgentForkResponse> {\n    log('Forking agent: %s -> %s', sourceIdentifier, forkData.identifier);\n\n    const result = await this.request<AgentForkResponse>(`/v1/agents/${sourceIdentifier}/fork`, {\n      body: JSON.stringify(forkData),\n      headers: {\n        'Content-Type': 'application/json',\n      },\n      method: 'POST',\n      ...options,\n    });\n\n    log('Agent forked successfully: %s (id: %d)', result.agent.identifier, result.agent.id);\n    return result;\n  }\n\n  /**\n   * Retrieves all public forks of a specific agent\n   *\n   * Returns a list of agents that were forked from the specified agent.\n   * Only returns forks that are public and published.\n   *\n   * @param identifier - Identifier of the source agent\n   * @param options - Optional request options\n   * @returns Promise resolving to the forks list response\n   */\n  async getAgentForks(\n    identifier: string,\n    options?: globalThis.RequestInit,\n  ): Promise<AgentForksResponse> {\n    log('Getting forks for agent: %s', identifier);\n\n    const result = await this.request<AgentForksResponse>(\n      `/v1/agents/${identifier}/forks`,\n      options,\n    );\n\n    log('Retrieved %d forks for agent: %s', result.totalCount, identifier);\n    return result;\n  }\n\n  /**\n   * Retrieves the source agent that this agent was forked from\n   *\n   * Returns null if the agent is not a fork (original agent).\n   *\n   * @param identifier - Identifier of the agent to check\n   * @param options - Optional request options\n   * @returns Promise resolving to the fork source response\n   */\n  async getAgentForkSource(\n    identifier: string,\n    options?: globalThis.RequestInit,\n  ): Promise<AgentForkSourceResponse> {\n    log('Getting fork source for agent: %s', identifier);\n\n    const result = await this.request<AgentForkSourceResponse>(\n      `/v1/agents/${identifier}/fork-source`,\n      options,\n    );\n\n    if (result.source) {\n      log('Agent %s was forked from: %s', identifier, result.source.identifier);\n    } else {\n      log('Agent %s is not a fork (original agent)', identifier);\n    }\n\n    return result;\n  }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type {\n  AgentGroupCreateRequest,\n  AgentGroupCreateResponse,\n  AgentGroupDetail,\n  AgentGroupDetailQuery,\n  AgentGroupForkRequest,\n  AgentGroupForkResponse,\n  AgentGroupForkSourceResponse,\n  AgentGroupForksResponse,\n  AgentGroupListQuery,\n  AgentGroupListResponse,\n  AgentGroupModifyRequest,\n  AgentGroupModifyResponse,\n  AgentGroupStatus,\n  AgentGroupStatusChangeResponse,\n  AgentGroupVersionCreateRequest,\n  AgentGroupVersionCreateResponse,\n  OwnAgentGroupListQuery,\n} from '../../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:agent-groups');\n\n/**\n * Agent Groups Service\n *\n * Provides access to agent group-related functionality in the LobeHub Marketplace.\n * This service handles listing, creating, versioning, and managing agent groups.\n */\nexport class AgentGroupService extends BaseSDK {\n  /**\n   * Retrieves a list of agent groups 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 group list response containing items and pagination info\n   */\n  async getAgentGroupList(\n    params: AgentGroupListQuery = {},\n    options?: globalThis.RequestInit,\n  ): Promise<AgentGroupListResponse> {\n    const locale = params.locale || this.defaultLocale;\n    const queryParams = { ...params, locale };\n    const queryString = this.buildQueryString(queryParams);\n\n    log('Getting agent group list: %O', queryParams);\n\n    const result = await this.request<AgentGroupListResponse>(\n      `/v1/agent-groups${queryString}`,\n      options,\n    );\n    log('Retrieved %d agent groups', result.items.length);\n    return result;\n  }\n\n  /**\n   * Retrieves a list of agent groups owned by the authenticated user\n   *\n   * Returns all agent groups 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 group list response containing items with status field\n   */\n  async getOwnAgentGroups(\n    params: OwnAgentGroupListQuery = {},\n    options?: globalThis.RequestInit,\n  ): Promise<AgentGroupListResponse> {\n    const locale = params.locale || this.defaultLocale;\n    const queryParams = { ...params, locale };\n    const queryString = this.buildQueryString(queryParams);\n\n    log('Getting own agent group list: %O', queryParams);\n\n    const result = await this.request<AgentGroupListResponse>(\n      `/v1/agent-groups/own${queryString}`,\n      options,\n    );\n    log('Retrieved %d own agent groups', result.items.length);\n    return result;\n  }\n\n  /**\n   * Retrieves detailed information about a specific agent group\n   *\n   * Returns complete agent group information including group metadata,\n   * all member agents, and localized content.\n   *\n   * @param identifier - Unique identifier of the agent group\n   * @param params - Query parameters for locale and version\n   * @param options - Optional request options\n   * @returns Promise resolving to the agent group detail information\n   */\n  async getAgentGroupDetail(\n    identifier: string,\n    params: Omit<AgentGroupDetailQuery, 'identifier'> = {},\n    options?: globalThis.RequestInit,\n  ): Promise<AgentGroupDetail> {\n    const locale = params.locale || this.defaultLocale;\n    const queryParams: Record<string, string> = { identifier, locale };\n    if (params.version !== undefined) {\n      queryParams.version = params.version.toString();\n    }\n    const queryString = this.buildQueryString(queryParams);\n\n    log('Getting agent group detail: %O', { identifier, ...params });\n\n    const result = await this.request<AgentGroupDetail>(\n      `/v1/agent-groups/detail${queryString}`,\n      options,\n    );\n\n    log('Agent group detail successfully retrieved: %s', identifier);\n    return result;\n  }\n\n  /**\n   * Creates a new agent group in the marketplace\n   *\n   * Creates a new agent group with initial version (v1) and all member agents.\n   * Requires authentication and ownership.\n   *\n   * @param groupData - The agent group data to create\n   * @param options - Optional request options\n   * @returns Promise resolving to the created agent group response\n   */\n  async createAgentGroup(\n    groupData: AgentGroupCreateRequest,\n    options?: globalThis.RequestInit,\n  ): Promise<AgentGroupCreateResponse> {\n    log('Creating agent group: %s', groupData.identifier);\n\n    const result = await this.request<AgentGroupCreateResponse>('/v1/agent-groups/create', {\n      body: JSON.stringify(groupData),\n      headers: {\n        'Content-Type': 'application/json',\n      },\n      method: 'POST',\n      ...options,\n    });\n\n    log('Agent group created successfully: %O', result);\n    return result;\n  }\n\n  /**\n   * Creates a new version for an existing agent group\n   *\n   * Creates a new version with unified version number for the group and all member agents.\n   * Fields not provided will be inherited from the latest version.\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 createAgentGroupVersion(\n    versionData: AgentGroupVersionCreateRequest,\n    options?: globalThis.RequestInit,\n  ): Promise<AgentGroupVersionCreateResponse> {\n    log('Creating agent group version: %s', versionData.identifier);\n\n    const result = await this.request<AgentGroupVersionCreateResponse>(\n      '/v1/agent-groups/version-create',\n      {\n        body: JSON.stringify(versionData),\n        headers: {\n          'Content-Type': 'application/json',\n        },\n        method: 'POST',\n        ...options,\n      },\n    );\n\n    log('Agent group version created successfully: %O', result);\n    return result;\n  }\n\n  /**\n   * Modifies an existing agent group\n   *\n   * Updates the agent group's base information. Can be used to change status,\n   * metadata, or other group properties. Only the owner can modify the group.\n   *\n   * @param groupData - The agent group data to modify\n   * @param options - Optional request options\n   * @returns Promise resolving to the modified agent group response\n   */\n  async modifyAgentGroup(\n    groupData: AgentGroupModifyRequest,\n    options?: globalThis.RequestInit,\n  ): Promise<AgentGroupModifyResponse> {\n    log('Modifying agent group: %s', groupData.identifier);\n\n    const result = await this.request<AgentGroupModifyResponse>('/v1/agent-groups/modify', {\n      body: JSON.stringify(groupData),\n      headers: {\n        'Content-Type': 'application/json',\n      },\n      method: 'POST',\n      ...options,\n    });\n\n    log('Agent group modified successfully: %O', result);\n    return result;\n  }\n\n  /**\n   * Checks if an agent group exists in the marketplace\n   *\n   * @param identifier - Unique identifier of the agent group\n   * @param options - Optional request options\n   * @returns Promise resolving to true if agent group exists, false otherwise\n   */\n  async checkAgentGroupExists(\n    identifier: string,\n    options?: globalThis.RequestInit,\n  ): Promise<boolean> {\n    log('Checking if agent group exists: %s', identifier);\n\n    try {\n      await this.getAgentGroupDetail(identifier, {}, options);\n      log('Agent group exists: %s', identifier);\n      return true;\n    } catch {\n      log('Agent group does not exist: %s', identifier);\n      return false;\n    }\n  }\n\n  /**\n   * Changes the status of an agent group\n   *\n   * Internal helper method used by publish/unpublish/archive/deprecate methods.\n   * Requires authentication.\n   *\n   * @param identifier - Unique identifier of the agent group\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: AgentGroupStatus,\n    options?: globalThis.RequestInit,\n  ): Promise<AgentGroupStatusChangeResponse> {\n    log('Changing agent group status: %s -> %s', identifier, status);\n\n    const result = await this.modifyAgentGroup({ identifier, status }, options);\n\n    log('Agent group status changed: %s -> %s', identifier, result.status);\n    return {\n      identifier: result.identifier,\n      status: result.status as AgentGroupStatus,\n      success: true,\n    };\n  }\n\n  /**\n   * Publishes an agent group to the marketplace\n   *\n   * Makes the agent group publicly visible and available for use.\n   * Requires authentication and ownership of the agent group.\n   * Only groups with \"Safe\" safety check status can be published.\n   *\n   * @param identifier - Unique identifier of the agent group\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<AgentGroupStatusChangeResponse> {\n    log('Publishing agent group: %s', identifier);\n    return this.changeStatus(identifier, 'published', options);\n  }\n\n  /**\n   * Unpublishes an agent group from the marketplace\n   *\n   * Hides the agent group from public view. The agent group data is preserved\n   * and can be republished later.\n   * Requires authentication and ownership of the agent group.\n   *\n   * @param identifier - Unique identifier of the agent group\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<AgentGroupStatusChangeResponse> {\n    log('Unpublishing agent group: %s', identifier);\n    return this.changeStatus(identifier, 'unpublished', options);\n  }\n\n  /**\n   * Archives an agent group\n   *\n   * Marks the agent group as archived. Archived agent groups are typically\n   * no longer actively maintained but may still be accessible.\n   * Requires authentication and ownership of the agent group.\n   *\n   * @param identifier - Unique identifier of the agent group\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<AgentGroupStatusChangeResponse> {\n    log('Archiving agent group: %s', identifier);\n    return this.changeStatus(identifier, 'archived', options);\n  }\n\n  /**\n   * Deprecates an agent group\n   *\n   * Marks the agent group as deprecated. Deprecated agent groups are still\n   * accessible but users are encouraged to migrate to alternatives.\n   * Requires authentication and ownership of the agent group.\n   *\n   * @param identifier - Unique identifier of the agent group\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<AgentGroupStatusChangeResponse> {\n    log('Deprecating agent group: %s', identifier);\n    return this.changeStatus(identifier, 'deprecated', options);\n  }\n\n  /**\n   * Forks an existing agent group to create a new group owned by the current user\n   *\n   * Creates a complete copy of the agent group including all member agents,\n   * their configurations, and version data. Statistical data (ratings, likes, etc.)\n   * are reset to zero. Requires authentication.\n   *\n   * @param sourceIdentifier - Identifier of the agent group to fork\n   * @param forkData - Fork request parameters (new identifier, name, etc.)\n   * @param options - Optional request options\n   * @returns Promise resolving to the fork response with new group details\n   */\n  async forkAgentGroup(\n    sourceIdentifier: string,\n    forkData: AgentGroupForkRequest,\n    options?: globalThis.RequestInit,\n  ): Promise<AgentGroupForkResponse> {\n    log('Forking agent group: %s -> %s', sourceIdentifier, forkData.identifier);\n\n    const result = await this.request<AgentGroupForkResponse>(\n      `/v1/agent-groups/${sourceIdentifier}/fork`,\n      {\n        body: JSON.stringify(forkData),\n        headers: {\n          'Content-Type': 'application/json',\n        },\n        method: 'POST',\n        ...options,\n      },\n    );\n\n    log(\n      'Agent group forked successfully: %s (id: %d, members: %d)',\n      result.group.identifier,\n      result.group.id,\n      result.memberAgents.length,\n    );\n    return result;\n  }\n\n  /**\n   * Retrieves all public forks of a specific agent group\n   *\n   * Returns a list of agent groups that were forked from the specified group.\n   * Only returns forks that are public and published.\n   *\n   * @param identifier - Identifier of the source agent group\n   * @param options - Optional request options\n   * @returns Promise resolving to the forks list response\n   */\n  async getAgentGroupForks(\n    identifier: string,\n    options?: globalThis.RequestInit,\n  ): Promise<AgentGroupForksResponse> {\n    log('Getting forks for agent group: %s', identifier);\n\n    const result = await this.request<AgentGroupForksResponse>(\n      `/v1/agent-groups/${identifier}/forks`,\n      options,\n    );\n\n    log('Retrieved %d forks for agent group: %s', result.totalCount, identifier);\n    return result;\n  }\n\n  /**\n   * Retrieves the source agent group that this group was forked from\n   *\n   * Returns null if the agent group is not a fork (original group).\n   *\n   * @param identifier - Identifier of the agent group to check\n   * @param options - Optional request options\n   * @returns Promise resolving to the fork source response\n   */\n  async getAgentGroupForkSource(\n    identifier: string,\n    options?: globalThis.RequestInit,\n  ): Promise<AgentGroupForkSourceResponse> {\n    log('Getting fork source for agent group: %s', identifier);\n\n    const result = await this.request<AgentGroupForkSourceResponse>(\n      `/v1/agent-groups/${identifier}/fork-source`,\n      options,\n    );\n\n    if (result.source) {\n      log('Agent group %s was forked from: %s', identifier, result.source.identifier);\n    } else {\n      log('Agent group %s is not a fork (original group)', identifier);\n    }\n\n    return result;\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 {\n  AuthorizeParams,\n  AuthorizeResponse,\n  GetAllConnectionsHealthResponse,\n  GetAuthorizeUrlParams,\n  GetConnectProviderResponse,\n  GetConnectionHealthResponse,\n  GetConnectionStatusResponse,\n  ListConnectProvidersResponse,\n  ListConnectionsResponse,\n  RefreshConnectionResponse,\n  RevokeConnectionResponse,\n} from '../../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:connect');\n\n/**\n * Connect Service\n *\n * Provides OAuth connection management functionality.\n * This service allows:\n * - Listing available OAuth providers\n * - Getting authorize URL to initiate OAuth flow\n * - Checking connection status\n * - Managing existing connections (refresh, revoke)\n *\n * @example\n * ```typescript\n * const sdk = new MarketSDK({ accessToken: 'user-token' });\n *\n * // 1. List available providers\n * const { providers } = await sdk.connect.listProviders();\n *\n * // 2. Check if connected to Linear\n * const { connected } = await sdk.connect.getStatus('linear');\n *\n * // 3. If not connected, get authorize URL and redirect user\n * if (!connected) {\n *   const authorizeUrl = sdk.connect.getAuthorizeUrl('linear');\n *   window.location.href = authorizeUrl;\n * }\n *\n * // 4. After user completes OAuth, they can use skills\n * const result = await sdk.skills.callTool('linear', {\n *   tool: 'create_issue',\n *   args: { title: 'New issue', team: 'Engineering' }\n *   ...\n * }});\n * ```\n * @example\n * ```typescript\n * const result = await sdk.skills.callTool('github', {\n *   tool: 'create_issue',\n *   args: { title: 'New issue', team: 'Engineering' }\n *   ...\n * });\n * ```\n */\nexport class ConnectService extends BaseSDK {\n  /**\n   * Lists all available OAuth providers\n   *\n   * Returns providers that have credentials configured on the server.\n   * This is a public endpoint that doesn't require authentication.\n   *\n   * @param options - Optional request options\n   * @returns Promise resolving to the list of available providers\n   */\n  async listProviders(options?: globalThis.RequestInit): Promise<ListConnectProvidersResponse> {\n    log('Listing connect providers');\n\n    const result = await this.request<ListConnectProvidersResponse>('/connect/providers', options);\n\n    log('Found %d connect providers', result.providers?.length || 0);\n    return result;\n  }\n\n  /**\n   * Gets detailed information about a specific provider\n   *\n   * This is a public endpoint that doesn't require authentication.\n   *\n   * @param provider - The provider ID (e.g., 'linear', 'github')\n   * @param options - Optional request options\n   * @returns Promise resolving to the provider details\n   */\n  async getProvider(\n    provider: string,\n    options?: globalThis.RequestInit,\n  ): Promise<GetConnectProviderResponse> {\n    log('Getting provider details: %s', provider);\n\n    const result = await this.request<GetConnectProviderResponse>(\n      `/connect/providers/${encodeURIComponent(provider)}`,\n      options,\n    );\n\n    log('Retrieved provider: %s', result.provider?.name);\n    return result;\n  }\n\n  /**\n   * Requests an authorization code for initiating OAuth flow\n   *\n   * This method obtains a signed, short-lived authorization code that can be\n   * used to start the OAuth flow in a browser context where Bearer tokens\n   * cannot be sent (e.g., opening a popup or redirecting the page).\n   *\n   * The returned `authorize_url` can be directly opened in a browser.\n   *\n   * **This is the recommended way to initiate OAuth authorization.**\n   *\n   * @param provider - The provider ID (e.g., 'linear', 'github', 'microsoft')\n   * @param params - Optional parameters for scopes and redirect URI\n   * @param options - Optional request options (must include authentication)\n   * @returns Promise resolving to the authorization code and URL\n   *\n   * @example\n   * ```typescript\n   * // Get authorization code and URL\n   * const { authorize_url, code, expires_in } = await sdk.connect.authorize('linear');\n   *\n   * // Open the URL in a popup\n   * const popup = window.open(authorize_url, 'oauth', 'width=600,height=700,popup=yes');\n   *\n   * // With custom scopes\n   * const { authorize_url } = await sdk.connect.authorize('github', {\n   *   scopes: ['user', 'repo', 'read:org']\n   * });\n   *\n   * // With redirect URI\n   * const { authorize_url } = await sdk.connect.authorize('microsoft', {\n   *   scopes: ['Calendars.ReadWrite'],\n   *   redirect_uri: 'https://myapp.com/oauth/callback'\n   * });\n   * ```\n   */\n  async authorize(\n    provider: string,\n    params?: AuthorizeParams,\n    options?: globalThis.RequestInit,\n  ): Promise<AuthorizeResponse> {\n    log('Requesting authorization code for provider: %s', provider);\n\n    const result = await this.request<AuthorizeResponse>(\n      `/connect/${encodeURIComponent(provider)}/authorize`,\n      {\n        body: params ? JSON.stringify(params) : undefined,\n        headers: {\n          'Content-Type': 'application/json',\n        },\n        method: 'POST',\n        ...options,\n      },\n    );\n\n    log('Authorization code obtained, expires in %d seconds', result.expires_in);\n    return result;\n  }\n\n  /**\n   * Generates the OAuth authorization URL for a provider (deprecated)\n   *\n   * @deprecated Use `authorize()` instead. This method constructs a URL that\n   * requires Bearer token authentication, which doesn't work in browser redirects.\n   * The new `authorize()` method returns a URL with a signed code that works\n   * in browser contexts.\n   *\n   * @param provider - The provider ID (e.g., 'linear', 'github')\n   * @param params - Optional parameters for scopes and redirect URI\n   * @returns The authorization URL (requires Bearer token, won't work in browser)\n   *\n   * @example\n   * ```typescript\n   * // OLD way (deprecated) - won't work in browser\n   * const url = sdk.connect.getAuthorizeUrl('linear');\n   *\n   * // NEW way (recommended) - works in browser\n   * const { authorize_url } = await sdk.connect.authorize('linear');\n   * window.open(authorize_url, 'oauth', 'width=600,height=700');\n   * ```\n   */\n  getAuthorizeUrl(provider: string, params?: GetAuthorizeUrlParams): string {\n    log(\n      'Generating authorize URL for provider: %s (deprecated, use authorize() instead)',\n      provider,\n    );\n\n    const queryParams = new URLSearchParams();\n\n    if (params?.scopes && params.scopes.length > 0) {\n      queryParams.set('scope', params.scopes.join(','));\n    }\n\n    if (params?.redirectUri) {\n      queryParams.set('redirect_uri', params.redirectUri);\n    }\n\n    const queryString = queryParams.toString();\n    const path = `/connect/${encodeURIComponent(provider)}/start${queryString ? `?${queryString}` : ''}`;\n\n    const url = urlJoin(this.baseUrl, 'api', path);\n    log('Generated authorize URL: %s', url);\n\n    return url;\n  }\n\n  /**\n   * Gets the connection status for a specific provider\n   *\n   * Checks if the authenticated user has an active OAuth connection.\n   * Requires authentication.\n   *\n   * @param provider - The provider ID (e.g., 'linear', 'github')\n   * @param options - Optional request options (must include authentication)\n   * @returns Promise resolving to the connection status\n   */\n  async getStatus(\n    provider: string,\n    options?: globalThis.RequestInit,\n  ): Promise<GetConnectionStatusResponse> {\n    log('Getting connection status for provider: %s', provider);\n\n    const result = await this.request<GetConnectionStatusResponse>(\n      `/connect/${encodeURIComponent(provider)}/status`,\n      options,\n    );\n\n    log('Provider %s connection status: connected=%s', provider, result.connected);\n    return result;\n  }\n\n  /**\n   * Lists all OAuth connections for the authenticated user\n   *\n   * Requires authentication.\n   *\n   * @param options - Optional request options (must include authentication)\n   * @returns Promise resolving to the list of connections\n   */\n  async listConnections(options?: globalThis.RequestInit): Promise<ListConnectionsResponse> {\n    log('Listing user connections');\n\n    const result = await this.request<ListConnectionsResponse>('/connect/connections', options);\n\n    log('Found %d connections', result.connections?.length || 0);\n    return result;\n  }\n\n  /**\n   * Checks the health of a specific provider connection\n   *\n   * Verifies if the token is valid, expiring soon, or expired.\n   * Requires authentication.\n   *\n   * @param provider - The provider ID (e.g., 'linear', 'github')\n   * @param options - Optional request options (must include authentication)\n   * @returns Promise resolving to the connection health status\n   */\n  async getHealth(\n    provider: string,\n    options?: globalThis.RequestInit,\n  ): Promise<GetConnectionHealthResponse> {\n    log('Checking health for provider: %s', provider);\n\n    const result = await this.request<GetConnectionHealthResponse>(\n      `/connect/${encodeURIComponent(provider)}/health`,\n      options,\n    );\n\n    log('Provider %s health: healthy=%s, status=%s', provider, result.healthy, result.tokenStatus);\n    return result;\n  }\n\n  /**\n   * Checks the health of all provider connections\n   *\n   * Requires authentication.\n   *\n   * @param options - Optional request options (must include authentication)\n   * @returns Promise resolving to the health status of all connections\n   */\n  async getAllHealth(options?: globalThis.RequestInit): Promise<GetAllConnectionsHealthResponse> {\n    log('Checking health for all connections');\n\n    const result = await this.request<GetAllConnectionsHealthResponse>('/connect/health', options);\n\n    log(\n      'Health check complete: total=%d, healthy=%d, unhealthy=%d',\n      result.summary?.total || 0,\n      result.summary?.healthy || 0,\n      result.summary?.unhealthy || 0,\n    );\n    return result;\n  }\n\n  /**\n   * Manually refreshes the access token for a provider connection\n   *\n   * Only works for providers that support token refresh.\n   * Requires authentication.\n   *\n   * @param provider - The provider ID (e.g., 'linear', 'github')\n   * @param options - Optional request options (must include authentication)\n   * @returns Promise resolving to the refresh result\n   */\n  async refresh(\n    provider: string,\n    options?: globalThis.RequestInit,\n  ): Promise<RefreshConnectionResponse> {\n    log('Refreshing token for provider: %s', provider);\n\n    const result = await this.request<RefreshConnectionResponse>(\n      `/connect/${encodeURIComponent(provider)}/refresh`,\n      {\n        method: 'POST',\n        ...options,\n      },\n    );\n\n    log('Token refresh for %s: refreshed=%s', provider, result.refreshed);\n    return result;\n  }\n\n  /**\n   * Revokes/disconnects a provider connection\n   *\n   * Removes the OAuth connection and deletes stored tokens.\n   * Requires authentication.\n   *\n   * @param provider - The provider ID (e.g., 'linear', 'github')\n   * @param options - Optional request options (must include authentication)\n   * @returns Promise resolving to the revoke result\n   */\n  async revoke(\n    provider: string,\n    options?: globalThis.RequestInit,\n  ): Promise<RevokeConnectionResponse> {\n    log('Revoking connection for provider: %s', provider);\n\n    const result = await this.request<RevokeConnectionResponse>(\n      `/connect/${encodeURIComponent(provider)}`,\n      {\n        method: 'DELETE',\n        ...options,\n      },\n    );\n\n    log('Connection revoked for %s: success=%s', provider, result.success);\n    return result;\n  }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type {\n  CreateFileCredRequest,\n  CreateKVCredRequest,\n  CreateOAuthCredRequest,\n  CredWithPlaintext,\n  DeleteCredResponse,\n  GetCredOptions,\n  InjectCredsForSkillRequest,\n  InjectCredsForSkillResponse,\n  InjectCredsRequest,\n  InjectCredsResponse,\n  ListCredsResponse,\n  SkillCredStatus,\n  UpdateCredRequest,\n  UserCredSummary,\n} from '../../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:creds');\n\n/**\n * Cred Service\n *\n * Provides user credential management functionality.\n * This service allows:\n * - Creating KV, OAuth, and file credentials\n * - Listing and retrieving credentials\n * - Updating and deleting credentials\n * - Checking credential status for skills\n * - Injecting credentials into sandbox environments\n *\n * @example\n * ```typescript\n * const sdk = new MarketSDK({ accessToken: 'user-token' });\n *\n * // Create a KV credential\n * const cred = await sdk.creds.createKV({\n *   key: 'openai',\n *   name: 'OpenAI API Key',\n *   type: 'kv-env',\n *   values: { OPENAI_API_KEY: 'sk-xxx' }\n * });\n *\n * // List all credentials\n * const { data } = await sdk.creds.list();\n *\n * // Inject credentials for a skill\n * const result = await sdk.creds.inject({\n *   skillIdentifier: 'my-skill',\n *   sandbox: true\n * });\n * ```\n */\nexport class CredService extends BaseSDK {\n  // ===========================================================================\n  // List & Get Operations\n  // ===========================================================================\n\n  /**\n   * Lists all credentials for the authenticated user\n   *\n   * Returns credential summaries with masked values.\n   * Requires authentication.\n   *\n   * @param options - Optional request options\n   * @returns Promise resolving to the list of credentials\n   */\n  async list(options?: globalThis.RequestInit): Promise<ListCredsResponse> {\n    log('Listing user credentials');\n\n    const result = await this.request<ListCredsResponse>('/v1/user/creds', options);\n\n    log('Found %d credentials', result.data?.length || 0);\n    return result;\n  }\n\n  /**\n   * Gets a specific credential by ID\n   *\n   * Optionally returns decrypted plaintext values for KV types.\n   * Requires authentication.\n   *\n   * @param id - The credential ID\n   * @param getOptions - Options for getting the credential\n   * @param options - Optional request options\n   * @returns Promise resolving to the credential details\n   */\n  async get(\n    id: number,\n    getOptions?: GetCredOptions,\n    options?: globalThis.RequestInit,\n  ): Promise<CredWithPlaintext> {\n    log('Getting credential: %d (decrypt=%s)', id, getOptions?.decrypt);\n\n    const queryParams: Record<string, string> = {};\n    if (getOptions?.decrypt) {\n      queryParams.decrypt = 'true';\n    }\n    const queryString = this.buildQueryString(queryParams);\n\n    const result = await this.request<CredWithPlaintext>(\n      `/v1/user/creds/${id}${queryString}`,\n      options,\n    );\n\n    log('Retrieved credential: %s', result.key);\n    return result;\n  }\n\n  // ===========================================================================\n  // Create Operations\n  // ===========================================================================\n\n  /**\n   * Creates a new KV credential (kv-env or kv-header)\n   *\n   * Use `kv-env` for environment variables (supported in sandbox).\n   * Use `kv-header` for HTTP headers (not supported in sandbox).\n   *\n   * Requires authentication.\n   *\n   * @param data - The credential data to create\n   * @param options - Optional request options\n   * @returns Promise resolving to the created credential\n   */\n  async createKV(\n    data: CreateKVCredRequest,\n    options?: globalThis.RequestInit,\n  ): Promise<UserCredSummary> {\n    log('Creating KV credential: %s (type=%s)', data.key, data.type);\n\n    const result = await this.request<UserCredSummary>('/v1/user/creds/kv', {\n      body: JSON.stringify(data),\n      headers: {\n        'Content-Type': 'application/json',\n      },\n      method: 'POST',\n      ...options,\n    });\n\n    log('Created KV credential: %d', result.id);\n    return result;\n  }\n\n  /**\n   * Creates a new OAuth credential by linking to an existing OAuth connection\n   *\n   * The OAuth connection must already exist (use ConnectService to establish connections).\n   * Requires authentication.\n   *\n   * @param data - The credential data to create\n   * @param options - Optional request options\n   * @returns Promise resolving to the created credential\n   */\n  async createOAuth(\n    data: CreateOAuthCredRequest,\n    options?: globalThis.RequestInit,\n  ): Promise<UserCredSummary> {\n    log('Creating OAuth credential: %s (connectionId=%d)', data.key, data.oauthConnectionId);\n\n    const result = await this.request<UserCredSummary>('/v1/user/creds/oauth', {\n      body: JSON.stringify(data),\n      headers: {\n        'Content-Type': 'application/json',\n      },\n      method: 'POST',\n      ...options,\n    });\n\n    log('Created OAuth credential: %d', result.id);\n    return result;\n  }\n\n  /**\n   * Creates a new file credential\n   *\n   * The file must be uploaded first and the fileHashId obtained.\n   * Requires authentication.\n   *\n   * @param data - The credential data to create\n   * @param options - Optional request options\n   * @returns Promise resolving to the created credential\n   */\n  async createFile(\n    data: CreateFileCredRequest,\n    options?: globalThis.RequestInit,\n  ): Promise<UserCredSummary> {\n    log('Creating file credential: %s (fileName=%s)', data.key, data.fileName);\n\n    const result = await this.request<UserCredSummary>('/v1/user/creds/file', {\n      body: JSON.stringify(data),\n      headers: {\n        'Content-Type': 'application/json',\n      },\n      method: 'POST',\n      ...options,\n    });\n\n    log('Created file credential: %d', result.id);\n    return result;\n  }\n\n  // ===========================================================================\n  // Update Operations\n  // ===========================================================================\n\n  /**\n   * Updates an existing credential\n   *\n   * Can update name, description, and values (for KV types).\n   * Requires authentication.\n   *\n   * @param id - The credential ID to update\n   * @param data - The data to update\n   * @param options - Optional request options\n   * @returns Promise resolving to the updated credential\n   */\n  async update(\n    id: number,\n    data: UpdateCredRequest,\n    options?: globalThis.RequestInit,\n  ): Promise<UserCredSummary> {\n    log('Updating credential: %d', id);\n\n    const result = await this.request<UserCredSummary>(`/v1/user/creds/${id}`, {\n      body: JSON.stringify(data),\n      headers: {\n        'Content-Type': 'application/json',\n      },\n      method: 'PATCH',\n      ...options,\n    });\n\n    log('Updated credential: %d', result.id);\n    return result;\n  }\n\n  // ===========================================================================\n  // Delete Operations\n  // ===========================================================================\n\n  /**\n   * Deletes a credential by ID\n   *\n   * Requires authentication.\n   *\n   * @param id - The credential ID to delete\n   * @param options - Optional request options\n   * @returns Promise resolving to the delete result\n   */\n  async delete(id: number, options?: globalThis.RequestInit): Promise<DeleteCredResponse> {\n    log('Deleting credential by ID: %d', id);\n\n    const result = await this.request<DeleteCredResponse>(`/v1/user/creds/${id}`, {\n      method: 'DELETE',\n      ...options,\n    });\n\n    log('Deleted credential: %d, success=%s', id, result.success);\n    return result;\n  }\n\n  /**\n   * Deletes a credential by key\n   *\n   * Useful when you know the credential key but not the ID.\n   * Requires authentication.\n   *\n   * @param key - The credential key to delete\n   * @param options - Optional request options\n   * @returns Promise resolving to the delete result\n   */\n  async deleteByKey(key: string, options?: globalThis.RequestInit): Promise<DeleteCredResponse> {\n    log('Deleting credential by key: %s', key);\n\n    const result = await this.request<DeleteCredResponse>(\n      `/v1/user/creds/key/${encodeURIComponent(key)}`,\n      {\n        method: 'DELETE',\n        ...options,\n      },\n    );\n\n    log('Deleted credential by key: %s, success=%s', key, result.success);\n    return result;\n  }\n\n  // ===========================================================================\n  // Skill Cred Status\n  // ===========================================================================\n\n  /**\n   * Gets the credential status for a skill\n   *\n   * Returns which credentials are required by the skill and\n   * whether the user has provided them.\n   *\n   * Requires authentication.\n   *\n   * @param skillIdentifier - The skill identifier\n   * @param options - Optional request options\n   * @returns Promise resolving to the credential status list\n   */\n  async getSkillCredStatus(\n    skillIdentifier: string,\n    options?: globalThis.RequestInit,\n  ): Promise<SkillCredStatus[]> {\n    log('Getting skill cred status: %s', skillIdentifier);\n\n    const result = await this.request<SkillCredStatus[]>(\n      `/v1/skills/${encodeURIComponent(skillIdentifier)}/creds/status`,\n      options,\n    );\n\n    log('Skill %s has %d credential requirements', skillIdentifier, result.length);\n    return result;\n  }\n\n  // ===========================================================================\n  // Inject Operations\n  // ===========================================================================\n\n  /**\n   * Injects specific credentials by key list into a sandbox environment\n   *\n   * Use this when you want to inject specific credentials regardless of skill requirements.\n   * Returns decrypted credentials that can be used to set environment variables and write files.\n   *\n   * Note: `kv-header` type credentials are not supported in sandbox mode.\n   *\n   * Requires authentication.\n   *\n   * @param request - The injection request with keys array\n   * @param options - Optional request options\n   * @returns Promise resolving to the injection result\n   *\n   * @example\n   * ```typescript\n   * const result = await sdk.creds.inject({\n   *   keys: ['openai', 'github-pat'],\n   *   sandbox: true\n   * });\n   *\n   * if (result.success) {\n   *   // Set environment variables\n   *   for (const [key, value] of Object.entries(result.credentials.env)) {\n   *     process.env[key] = value;\n   *   }\n   * } else {\n   *   console.log('Not found credentials:', result.notFound);\n   * }\n   * ```\n   */\n  async inject(\n    request: InjectCredsRequest,\n    options?: globalThis.RequestInit,\n  ): Promise<InjectCredsResponse> {\n    log('Injecting credentials by keys: %O (sandbox=%s)', request.keys, request.sandbox);\n\n    const result = await this.request<InjectCredsResponse>(\n      '/v1/plugins/run-buildin-tools/inject-creds',\n      {\n        body: JSON.stringify(request),\n        headers: {\n          'Content-Type': 'application/json',\n        },\n        method: 'POST',\n        ...options,\n      },\n    );\n\n    log(\n      'Inject result: success=%s, env=%d, files=%d, notFound=%d',\n      result.success,\n      Object.keys(result.credentials?.env || {}).length,\n      result.credentials?.files?.length || 0,\n      result.notFound?.length || 0,\n    );\n\n    return result;\n  }\n\n  /**\n   * Injects credentials for a skill based on its creds declaration\n   *\n   * Use this when executing a skill - it will auto-inject based on skill's requirements.\n   * Returns decrypted credentials that can be used to set environment variables and write files.\n   *\n   * Note: `kv-header` type credentials are not supported in sandbox mode.\n   *\n   * Requires authentication.\n   *\n   * @param request - The injection request with skill identifier\n   * @param options - Optional request options\n   * @returns Promise resolving to the injection result\n   *\n   * @example\n   * ```typescript\n   * const result = await sdk.creds.injectForSkill({\n   *   skillIdentifier: 'github-mcp',\n   *   sandbox: true\n   * });\n   *\n   * if (result.success) {\n   *   // All required credentials are satisfied\n   *   for (const [key, value] of Object.entries(result.credentials.env)) {\n   *     process.env[key] = value;\n   *   }\n   * } else {\n   *   console.log('Missing required credentials:', result.missing);\n   * }\n   * ```\n   */\n  async injectForSkill(\n    request: InjectCredsForSkillRequest,\n    options?: globalThis.RequestInit,\n  ): Promise<InjectCredsForSkillResponse> {\n    log(\n      'Injecting credentials for skill: %s (sandbox=%s)',\n      request.skillIdentifier,\n      request.sandbox,\n    );\n\n    const result = await this.request<InjectCredsForSkillResponse>(\n      '/v1/plugins/run-buildin-tools/inject-creds-for-skill',\n      {\n        body: JSON.stringify(request),\n        headers: {\n          'Content-Type': 'application/json',\n        },\n        method: 'POST',\n        ...options,\n      },\n    );\n\n    log(\n      'Inject result: success=%s, env=%d, files=%d, missing=%d',\n      result.success,\n      Object.keys(result.credentials?.env || {}).length,\n      result.credentials?.files?.length || 0,\n      result.missing?.length || 0,\n    );\n\n    return result;\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  PluginEventRequest,\n  PluginItemDetail,\n  PluginManifest,\n  SitemapResponse,\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  PluginCommentCreateResponse,\n  PluginCommentDeleteResponse,\n  PluginCommentListQuery,\n  PluginCommentListResponse,\n  PluginCommentReactionResponse,\n  PluginLatestOwnComment,\n  PluginListResponse,\n  PluginQueryParams,\n  PluginRatingDistribution,\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   * @deprecated Use {@link PluginsService.getSitemap} instead.\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 a paginated list of published plugin (MCP) identifiers for sitemaps\n   *\n   * @param params - Pagination (`page` defaults to 1, `pageSize` defaults to 200, max 500 server-side)\n   * @param options - Optional request options\n   */\n  async getSitemap(\n    params: { page?: number; pageSize?: number } = {},\n    options?: globalThis.RequestInit,\n  ): Promise<SitemapResponse> {\n    const queryString = this.buildQueryString(params);\n    log('Getting plugin sitemap%s', queryString);\n\n    const result = await this.request<SitemapResponse>(\n      `/v1/plugins/sitemap${queryString}`,\n      options,\n    );\n    log(\n      'Retrieved plugin sitemap page %d/%d (%d items)',\n      result.currentPage,\n      result.totalPages,\n      result.items.length,\n    );\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   * Record a plugin event for the authenticated user\n   *\n   * Records plugin usage actions (install, activate, uninstall, click) for analytics.\n   *\n   * @param eventData - The plugin event payload\n   * @param options - Optional request init overrides\n   */\n  async createEvent(\n    eventData: PluginEventRequest,\n    options?: globalThis.RequestInit,\n  ): Promise<void> {\n    log('Recording plugin event: %s for %s', eventData.event, eventData.identifier);\n\n    await this.request<void>('/v1/plugins/events', {\n      body: JSON.stringify(eventData),\n      headers: {\n        'Content-Type': 'application/json',\n      },\n      method: 'POST',\n      ...options,\n    });\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(\n      'Running built-in tool: %s for user %s, topic %s',\n      toolName,\n      context.userId,\n      context.topicId,\n    );\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  // ============================================================================\n  // Rating Methods\n  // ============================================================================\n\n  /**\n   * Submits or updates a rating for a plugin\n   *\n   * @param identifier - Unique plugin identifier\n   * @param score - Rating score (1-5)\n   * @param options - Optional request options\n   * @returns Promise resolving to the submitted score\n   */\n  async submitRating(\n    identifier: string,\n    score: number,\n    options?: globalThis.RequestInit,\n  ): Promise<{ score: number }> {\n    log('Submitting rating for plugin %s: %d', identifier, score);\n\n    const result = await this.request<{ score: number }>(\n      `/v1/plugins/${encodeURIComponent(identifier)}/ratings`,\n      {\n        ...options,\n        body: JSON.stringify({ score }),\n        method: 'POST',\n      },\n    );\n\n    log('Rating submitted for plugin %s: %d', identifier, result.score);\n    return result;\n  }\n\n  /**\n   * Deletes the current user/agent's rating for a plugin\n   *\n   * @param identifier - Unique plugin identifier\n   * @param options - Optional request options\n   * @returns Promise resolving to success status\n   */\n  async deleteRating(\n    identifier: string,\n    options?: globalThis.RequestInit,\n  ): Promise<{ success: boolean }> {\n    log('Deleting rating for plugin %s', identifier);\n\n    const result = await this.request<{ success: boolean }>(\n      `/v1/plugins/${encodeURIComponent(identifier)}/ratings`,\n      {\n        ...options,\n        method: 'DELETE',\n      },\n    );\n\n    log('Rating deleted for plugin %s', identifier);\n    return result;\n  }\n\n  /**\n   * Gets the rating distribution for a plugin\n   *\n   * @param identifier - Unique plugin identifier\n   * @param options - Optional request options\n   * @returns Promise resolving to the rating distribution\n   */\n  async getRatingDistribution(\n    identifier: string,\n    options?: globalThis.RequestInit,\n  ): Promise<PluginRatingDistribution> {\n    log('Getting rating distribution for plugin: %s', identifier);\n\n    const result = await this.request<PluginRatingDistribution>(\n      `/v1/plugins/${encodeURIComponent(identifier)}/ratings/distribution`,\n      options,\n    );\n\n    log('Rating distribution retrieved for plugin %s: %d total', identifier, result.totalCount);\n    return result;\n  }\n\n  // ============================================================================\n  // Comment Methods\n  // ============================================================================\n\n  /**\n   * Gets paginated comments for a plugin\n   *\n   * @param identifier - Unique plugin identifier\n   * @param params - Query parameters for pagination and sorting\n   * @param options - Optional request options\n   * @returns Promise resolving to the paginated comment list\n   */\n  async getComments(\n    identifier: string,\n    params: PluginCommentListQuery = {},\n    options?: globalThis.RequestInit,\n  ): Promise<PluginCommentListResponse> {\n    const queryString = this.buildQueryString(params);\n\n    log('Getting comments for plugin %s: %O', identifier, params);\n\n    const result = await this.request<PluginCommentListResponse>(\n      `/v1/plugins/${encodeURIComponent(identifier)}/comments${queryString}`,\n      options,\n    );\n\n    log(\n      'Retrieved %d comments for plugin %s (page %d/%d)',\n      result.items.length,\n      identifier,\n      result.currentPage,\n      result.totalPages,\n    );\n    return result;\n  }\n\n  /**\n   * Gets the latest comment for the authenticated user or agent on a plugin\n   *\n   * @param identifier - Unique plugin identifier\n   * @param options - Optional request options\n   * @returns Promise resolving to the latest own comment or null when none exists\n   */\n  async getLatestOwnComment(\n    identifier: string,\n    options?: globalThis.RequestInit,\n  ): Promise<PluginLatestOwnComment | null> {\n    log('Getting latest own comment for plugin %s', identifier);\n\n    const result = await this.request<PluginLatestOwnComment | null>(\n      `/v1/plugins/${encodeURIComponent(identifier)}/comments/latest`,\n      options,\n    );\n\n    if (result) {\n      log('Retrieved latest own comment for plugin %s: id=%d', identifier, result.id);\n    } else {\n      log('No own comments found for plugin %s', identifier);\n    }\n\n    return result;\n  }\n\n  /**\n   * Creates a comment on a plugin, optionally with a rating\n   *\n   * @param identifier - Unique plugin identifier\n   * @param data - Comment data with content, optional score, and optional parentId\n   * @param options - Optional request options\n   * @returns Promise resolving to the created comment (with optional rating field)\n   */\n  async createComment(\n    identifier: string,\n    data: { content: string; parentId?: number; score?: number },\n    options?: globalThis.RequestInit,\n  ): Promise<PluginCommentCreateResponse> {\n    log('Creating comment on plugin %s', identifier);\n\n    const result = await this.request<PluginCommentCreateResponse>(\n      `/v1/plugins/${encodeURIComponent(identifier)}/comments`,\n      {\n        ...options,\n        body: JSON.stringify(data),\n        method: 'POST',\n      },\n    );\n\n    log('Comment created on plugin %s: id=%d', identifier, result.id);\n    return result;\n  }\n\n  /**\n   * Deletes a comment from a plugin\n   *\n   * @param identifier - Unique plugin identifier\n   * @param commentId - Comment ID to delete\n   * @param options - Optional request options\n   * @returns Promise resolving to success status\n   */\n  async deleteComment(\n    identifier: string,\n    commentId: number,\n    options?: globalThis.RequestInit,\n  ): Promise<PluginCommentDeleteResponse> {\n    log('Deleting comment %d from plugin %s', commentId, identifier);\n\n    const result = await this.request<PluginCommentDeleteResponse>(\n      `/v1/plugins/${encodeURIComponent(identifier)}/comments/${commentId}`,\n      {\n        ...options,\n        method: 'DELETE',\n      },\n    );\n\n    log('Comment %d deleted from plugin %s', commentId, identifier);\n    return result;\n  }\n\n  // ============================================================================\n  // Reaction Methods\n  // ============================================================================\n\n  /**\n   * Adds or updates a reaction on a comment\n   *\n   * @param commentId - Comment ID to react to\n   * @param type - Reaction type ('upvote' or 'downvote')\n   * @param options - Optional request options\n   * @returns Promise resolving to the created reaction\n   */\n  async addReaction(\n    commentId: number,\n    type: 'downvote' | 'upvote',\n    options?: globalThis.RequestInit,\n  ): Promise<PluginCommentReactionResponse> {\n    log('Adding %s reaction to comment %d', type, commentId);\n\n    const result = await this.request<PluginCommentReactionResponse>(\n      `/v1/plugins/comments/${commentId}/reactions`,\n      {\n        ...options,\n        body: JSON.stringify({ type }),\n        method: 'POST',\n      },\n    );\n\n    log('Reaction added to comment %d: %s (id=%d)', commentId, result.type, result.id);\n    return result;\n  }\n\n  /**\n   * Removes a reaction from a comment\n   *\n   * @param commentId - Comment ID to remove reaction from\n   * @param options - Optional request options\n   * @returns Promise resolving to success status\n   */\n  async removeReaction(\n    commentId: number,\n    options?: globalThis.RequestInit,\n  ): Promise<{ success: boolean }> {\n    log('Removing reaction from comment %d', commentId);\n\n    const result = await this.request<{ success: boolean }>(\n      `/v1/plugins/comments/${commentId}/reactions`,\n      {\n        ...options,\n        method: 'DELETE',\n      },\n    );\n\n    log('Reaction removed from comment %d', commentId);\n    return result;\n  }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type {\n  CallSkillToolResponse,\n  GetSkillStatusResponse,\n  GetSkillToolResponse,\n  ListSkillProvidersResponse,\n  ListSkillToolsResponse,\n  SkillCallParams,\n} from '../../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:skill');\n\n/**\n * Skill Service\n *\n * Provides access to skill providers and tool calling functionality.\n * This service allows:\n * - Listing available skill providers (OAuth-connected services like Linear, GitHub)\n * - Listing available tools for each provider\n * - Calling tools on connected providers\n * - Checking connection status\n */\nexport class SkillService extends BaseSDK {\n  /**\n   * Lists all available skill providers\n   *\n   * Returns a list of providers that can be connected via OAuth.\n   * This is a public endpoint that doesn't require authentication.\n   *\n   * @param options - Optional request options\n   * @returns Promise resolving to the list of available providers\n   */\n  async listProviders(options?: globalThis.RequestInit): Promise<ListSkillProvidersResponse> {\n    log('Listing skill providers');\n\n    const result = await this.request<ListSkillProvidersResponse>('/v1/skill/providers', options);\n\n    log('Found %d skill providers', result.providers?.length || 0);\n    return result;\n  }\n\n  /**\n   * Lists available tools for a specific provider\n   *\n   * Returns the tools/functions that can be called on the provider.\n   * This is a public endpoint that doesn't require authentication.\n   *\n   * @param provider - The provider ID (e.g., 'linear', 'github')\n   * @param options - Optional request options\n   * @returns Promise resolving to the list of available tools\n   */\n  async listTools(\n    provider: string,\n    options?: globalThis.RequestInit,\n  ): Promise<ListSkillToolsResponse> {\n    log('Listing tools for provider: %s', provider);\n\n    const result = await this.request<ListSkillToolsResponse>(\n      `/v1/skill/${encodeURIComponent(provider)}/tools`,\n      options,\n    );\n\n    log('Found %d tools for provider %s', result.tools?.length || 0, provider);\n    return result;\n  }\n\n  /**\n   * Gets details of a specific tool\n   *\n   * Returns detailed information about a tool including its input schema.\n   * This is a public endpoint that doesn't require authentication.\n   *\n   * @param provider - The provider ID (e.g., 'linear', 'github')\n   * @param toolName - The name of the tool\n   * @param options - Optional request options\n   * @returns Promise resolving to the tool details\n   */\n  async getTool(\n    provider: string,\n    toolName: string,\n    options?: globalThis.RequestInit,\n  ): Promise<GetSkillToolResponse> {\n    log('Getting tool %s from provider %s', toolName, provider);\n\n    const result = await this.request<GetSkillToolResponse>(\n      `/v1/skill/${encodeURIComponent(provider)}/tool/${encodeURIComponent(toolName)}`,\n      options,\n    );\n\n    log('Retrieved tool: %s', result.tool?.name);\n    return result;\n  }\n\n  /**\n   * Gets the connection status for a provider\n   *\n   * Checks if the authenticated user has an active OAuth connection to the provider.\n   * Requires authentication.\n   *\n   * @param provider - The provider ID (e.g., 'linear', 'github')\n   * @param options - Optional request options (must include authentication)\n   * @returns Promise resolving to the connection status\n   */\n  async getStatus(\n    provider: string,\n    options?: globalThis.RequestInit,\n  ): Promise<GetSkillStatusResponse> {\n    log('Getting status for provider: %s', provider);\n\n    const result = await this.request<GetSkillStatusResponse>(\n      `/v1/skill/${encodeURIComponent(provider)}/status`,\n      options,\n    );\n\n    log('Provider %s status: connected=%s', provider, result.connected);\n    return result;\n  }\n\n  /**\n   * Calls a tool on a connected provider\n   *\n   * Executes a tool/function on the provider using the user's OAuth connection.\n   * Requires authentication and an active OAuth connection to the provider.\n   *\n   * @param provider - The provider ID (e.g., 'linear', 'github')\n   * @param params - The tool call parameters (tool name and arguments)\n   * @param options - Optional request options (must include authentication)\n   * @returns Promise resolving to the tool call result\n   *\n   * @example\n   * ```typescript\n   * // Create a Linear issue\n   * const result = await sdk.skills.callTool('linear', {\n   *   tool: 'create_issue',\n   *   args: {\n   *     title: 'New feature request',\n   *     team: 'Engineering',\n   *     description: 'We need to implement...'\n   *   }\n   * });\n   * ```\n   */\n  async callTool<T = unknown>(\n    provider: string,\n    params: SkillCallParams,\n    options?: globalThis.RequestInit,\n  ): Promise<CallSkillToolResponse<T>> {\n    log('Calling tool %s on provider %s', params.tool, provider);\n    const { args, tool, ...rest } = params;\n\n    const result = await this.request<CallSkillToolResponse<T>>(\n      `/v1/skill/${encodeURIComponent(provider)}/call`,\n      {\n        body: JSON.stringify({\n          args: args || {},\n          tool: tool,\n          ...rest,\n        }),\n        headers: {\n          'Content-Type': 'application/json',\n        },\n        method: 'POST',\n        ...options,\n      },\n    );\n\n    log('Tool %s call completed: success=%s', params.tool, result.success);\n    return result;\n  }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type {\n  MarketSkillCollectionDetail,\n  MarketSkillCollectionDetailQuery,\n  MarketSkillCollectionListQuery,\n  MarketSkillCollectionListResponse,\n} from '../../types';\n\nconst log = debug('lobe-market-sdk:skill-collections');\n\nexport class MarketSkillCollectionService extends BaseSDK {\n  async getSkillCollectionDetail(\n    slug: string,\n    params: MarketSkillCollectionDetailQuery = {},\n    options?: globalThis.RequestInit,\n  ): Promise<MarketSkillCollectionDetail> {\n    const locale = params.locale || this.defaultLocale;\n    const queryParams = {\n      ...params,\n      locale,\n    };\n    const queryString = this.buildQueryString(queryParams);\n\n    log('Getting skill collection detail: %s %O', slug, queryParams);\n\n    const result = await this.request<MarketSkillCollectionDetail>(\n      `/v1/skills/collections/${encodeURIComponent(slug)}${queryString}`,\n      options,\n    );\n\n    log('Skill collection detail retrieved: %s (%d items)', slug, result.items.length);\n    return result;\n  }\n\n  async getSkillCollections(\n    params: MarketSkillCollectionListQuery = {},\n    options?: globalThis.RequestInit,\n  ): Promise<MarketSkillCollectionListResponse> {\n    const locale = params.locale || this.defaultLocale;\n    const queryParams = {\n      ...params,\n      locale,\n    };\n    const queryString = this.buildQueryString(queryParams);\n\n    log('Getting skill collections: %O', queryParams);\n\n    const result = await this.request<MarketSkillCollectionListResponse>(\n      `/v1/skills/collections${queryString}`,\n      options,\n    );\n\n    log('Retrieved %d skill collections', result.length);\n    return result;\n  }\n}\n","import type { SitemapResponse } from '@lobehub/market-types';\nimport debug from 'debug';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type {\n  MarketReportGitHubSkillParams,\n  MarketReportGitHubSkillResponse,\n  MarketReportSkillInstallParams,\n  MarketReportSkillInstallResponse,\n  MarketSkillCategory,\n  MarketSkillCategoryQuery,\n  MarketSkillDetail,\n  MarketSkillDetailQuery,\n  MarketSkillListQuery,\n  MarketSkillListResponse,\n  MarketSkillVersionSummary,\n  SkillCommentCreateResponse,\n  SkillCommentDeleteResponse,\n  SkillCommentListQuery,\n  SkillCommentListResponse,\n  SkillLatestOwnComment,\n  SkillRatingDistribution,\n} from '../../types';\n\n// Create debug instance for logging\nconst log = debug('lobe-market-sdk:market-skills');\n\n/**\n * Market Skill Service\n *\n * Provides access to marketplace skills (GitHub-imported skills).\n * This service handles:\n * - Listing and searching skills with various filters and sorting options\n * - Retrieving detailed skill information\n * - Getting skill download URLs\n * - Downloading skill ZIP packages\n * - Fetching skill categories\n *\n * These are different from OAuth skill providers (SkillService) - these are\n * standalone skill packages that can be browsed, downloaded, and used.\n */\nexport class MarketSkillService extends BaseSDK {\n  /**\n   * Retrieves a list of skills from the marketplace\n   *\n   * Supports filtering, pagination, search, and various sorting options\n   * including GitHub stats (stars, forks, watchers). Locale localizes\n   * descriptions and summaries, but the returned skill name stays canonical.\n   *\n   * @param params - Query parameters for filtering and pagination\n   * @param options - Optional request options\n   * @returns Promise resolving to the skill list response with pagination info\n   *\n   * @example\n   * ```typescript\n   * // Get skills sorted by stars\n   * const result = await sdk.marketSkills.getSkillList({\n   *   sort: 'stars',\n   *   order: 'desc',\n   *   pageSize: 20\n   * });\n   *\n   * // Search for skills\n   * const result = await sdk.marketSkills.getSkillList({\n   *   q: 'code review',\n   *   category: 'development'\n   * });\n   * ```\n   */\n  async getSkillList(\n    params: MarketSkillListQuery = {},\n    options?: globalThis.RequestInit,\n  ): Promise<MarketSkillListResponse> {\n    const locale = params.locale || this.defaultLocale;\n    const queryParams = { ...params, locale };\n    const queryString = this.buildQueryString(queryParams);\n\n    log('Getting skill list: %O', queryParams);\n\n    const result = await this.request<MarketSkillListResponse>(`/v1/skills${queryString}`, options);\n\n    log(\n      'Retrieved %d skills (page %d/%d)',\n      result.items.length,\n      result.currentPage,\n      result.totalPages,\n    );\n    return result;\n  }\n\n  /**\n   * Retrieves detailed information about a specific skill\n   *\n   * Returns complete skill information including manifest, content,\n   * resources, and version history. Locale localizes descriptions and\n   * summaries, but the returned skill name stays canonical.\n   *\n   * @param identifier - Unique skill identifier (e.g., 'github.owner.repo.path')\n   * @param params - Query parameters for locale and version\n   * @param options - Optional request options\n   * @returns Promise resolving to the skill detail\n   *\n   * @example\n   * ```typescript\n   * // Get latest version\n   * const skill = await sdk.marketSkills.getSkillDetail('github.owner.repo');\n   *\n   * // Get specific version with locale\n   * const skill = await sdk.marketSkills.getSkillDetail('github.owner.repo', {\n   *   version: '1.0.0',\n   *   locale: 'zh-CN'\n   * });\n   * ```\n   */\n  async getSkillDetail(\n    identifier: string,\n    params: MarketSkillDetailQuery = {},\n    options?: globalThis.RequestInit,\n  ): Promise<MarketSkillDetail> {\n    const locale = params.locale || this.defaultLocale;\n    const queryParams: Record<string, string> = { locale };\n    if (params.version) {\n      queryParams.version = params.version;\n    }\n    const queryString = this.buildQueryString(queryParams);\n\n    log('Getting skill detail: %s %O', identifier, params);\n\n    const result = await this.request<MarketSkillDetail>(\n      `/v1/skills/${encodeURIComponent(identifier)}${queryString}`,\n      options,\n    );\n\n    log('Skill detail retrieved: %s (v%s)', identifier, result.version);\n    return result;\n  }\n\n  /**\n   * Gets the download URL for a skill ZIP package\n   *\n   * Returns the direct URL to download the skill ZIP file.\n   * This URL can be used to download the skill package without\n   * making an additional API request.\n   *\n   * @param identifier - Unique skill identifier\n   * @param version - Optional specific version (defaults to latest)\n   * @returns Download URL string\n   *\n   * @example\n   * ```typescript\n   * // Get download URL for latest version\n   * const url = sdk.marketSkills.getDownloadUrl('github.owner.repo');\n   * // Returns: https://market.lobehub.com/api/v1/skills/github.owner.repo/download\n   *\n   * // Get download URL for specific version\n   * const url = sdk.marketSkills.getDownloadUrl('github.owner.repo', '1.0.0');\n   * // Returns: https://market.lobehub.com/api/v1/skills/github.owner.repo/download?version=1.0.0\n   * ```\n   */\n  getDownloadUrl(identifier: string, version?: string): string {\n    const baseUrl = this.baseUrl;\n    let url = `${baseUrl}/api/v1/skills/${encodeURIComponent(identifier)}/download`;\n\n    if (version) {\n      url += `?version=${encodeURIComponent(version)}`;\n    }\n\n    log('Generated download URL: %s', url);\n    return url;\n  }\n\n  /**\n   * Downloads a skill ZIP package\n   *\n   * Fetches the skill ZIP file directly. The response includes\n   * the raw buffer data that can be saved to a file.\n   *\n   * Note: This increments the skill's download count.\n   *\n   * @param identifier - Unique skill identifier\n   * @param version - Optional specific version (defaults to latest)\n   * @param options - Optional request options\n   * @returns Promise resolving to the ZIP buffer and filename\n   *\n   * @example\n   * ```typescript\n   * // Download and save skill\n   * const { buffer, filename } = await sdk.marketSkills.downloadSkill('github.owner.repo');\n   * fs.writeFileSync(filename, buffer);\n   * ```\n   */\n  async downloadSkill(\n    identifier: string,\n    version?: string,\n    options?: globalThis.RequestInit,\n  ): Promise<{ buffer: ArrayBuffer; filename: string }> {\n    log('Downloading skill: %s (version: %s)', identifier, version || 'latest');\n\n    const queryParams: Record<string, string> = {};\n    if (version) {\n      queryParams.version = version;\n    }\n    const queryString = this.buildQueryString(queryParams);\n\n    const url = `${this.baseUrl}/api/v1/skills/${encodeURIComponent(identifier)}/download${queryString}`;\n\n    const response = await fetch(url, {\n      ...options,\n      headers: {\n        ...this.headers,\n        ...options?.headers,\n      },\n    });\n\n    if (!response.ok) {\n      const errorText = await response.text();\n      log('Download failed: %s %s', response.status, errorText);\n      throw new Error(`Failed to download skill: ${response.statusText}`);\n    }\n\n    // Extract filename from Content-Disposition header if available\n    const contentDisposition = response.headers.get('content-disposition');\n    let filename = `${identifier}.zip`;\n    if (contentDisposition) {\n      const match = /filename[^\\n;=]*=([\"']?)([^\\n\"';]*)\\1/.exec(contentDisposition);\n      if (match?.[2]) {\n        filename = match[2];\n      }\n    }\n\n    const buffer = await response.arrayBuffer();\n\n    log('Downloaded skill: %s (%d bytes)', filename, buffer.byteLength);\n    return { buffer, filename };\n  }\n\n  /**\n   * Retrieves all skill categories with counts\n   *\n   * Returns a list of categories along with the number of skills\n   * in each category. Useful for building category filters.\n   * Supports optional search filtering 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 categories with counts\n   *\n   * @example\n   * ```typescript\n   * // Get all categories\n   * const categories = await sdk.marketSkills.getCategories();\n   * // [{ category: 'development', count: 25 }, { category: 'productivity', count: 18 }, ...]\n   *\n   * // Get categories with search filter\n   * const filtered = await sdk.marketSkills.getCategories({ q: 'code' });\n   * ```\n   */\n  async getCategories(\n    params: MarketSkillCategoryQuery = {},\n    options?: globalThis.RequestInit,\n  ): Promise<MarketSkillCategory[]> {\n    const locale = params.locale || this.defaultLocale;\n    const queryParams = { ...params, locale };\n    const queryString = this.buildQueryString(queryParams);\n\n    log('Getting skill categories: %O', queryParams);\n\n    const result = await this.request<MarketSkillCategory[]>(\n      `/v1/skills/categories${queryString}`,\n      options,\n    );\n\n    log('Retrieved %d categories', result.length);\n    return result;\n  }\n\n  /**\n   * Retrieves all published skill identifiers\n   *\n   * Returns a lightweight list of all published skill identifiers\n   * without full metadata. Useful for sitemap generation or\n   * knowing which skills are available.\n   *\n   * @deprecated Use {@link MarketSkillService.getSitemap} instead.\n   * @param options - Optional request options\n   * @returns Promise resolving to an array of identifiers with last modified times\n   */\n  async getPublishedIdentifiers(\n    options?: globalThis.RequestInit,\n  ): Promise<{ identifier: string; lastModified: string }[]> {\n    log('Getting published skill identifiers');\n\n    const result = await this.request<{ identifier: string; lastModified: string }[]>(\n      '/v1/skills/identifiers',\n      options,\n    );\n\n    log('Retrieved %d published skill identifiers', result.length);\n    return result;\n  }\n\n  /**\n   * Retrieves a paginated list of published skill identifiers for sitemaps\n   *\n   * @param params - Pagination (`page` defaults to 1, `pageSize` defaults to 200, max 500 server-side)\n   * @param options - Optional request options\n   */\n  async getSitemap(\n    params: { page?: number; pageSize?: number } = {},\n    options?: globalThis.RequestInit,\n  ): Promise<SitemapResponse> {\n    const queryString = this.buildQueryString(params);\n    log('Getting skill sitemap%s', queryString);\n\n    const result = await this.request<SitemapResponse>(`/v1/skills/sitemap${queryString}`, options);\n    log(\n      'Retrieved skill sitemap page %d/%d (%d items)',\n      result.currentPage,\n      result.totalPages,\n      result.items.length,\n    );\n    return result;\n  }\n\n  /**\n   * Checks if a skill exists in the marketplace\n   *\n   * @param identifier - Unique skill identifier\n   * @param options - Optional request options\n   * @returns Promise resolving to true if skill exists, false otherwise\n   */\n  async checkSkillExists(identifier: string, options?: globalThis.RequestInit): Promise<boolean> {\n    log('Checking if skill exists: %s', identifier);\n\n    try {\n      await this.getSkillDetail(identifier, {}, options);\n      log('Skill exists: %s', identifier);\n      return true;\n    } catch {\n      log('Skill does not exist: %s', identifier);\n      return false;\n    }\n  }\n\n  /**\n   * Retrieves all versions of a skill\n   *\n   * Returns a list of all versions for a specific skill,\n   * including version string, creation date, and whether it's the latest version.\n   *\n   * @param identifier - Unique skill identifier\n   * @param options - Optional request options\n   * @returns Promise resolving to an array of version summaries\n   *\n   * @example\n   * ```typescript\n   * const versions = await sdk.marketSkills.getSkillVersions('github.owner.repo');\n   * // [{ version: '1.0.0', createdAt: '...', isLatest: true }, ...]\n   * ```\n   */\n  async getSkillVersions(\n    identifier: string,\n    options?: globalThis.RequestInit,\n  ): Promise<MarketSkillVersionSummary[]> {\n    log('Getting skill versions: %s', identifier);\n\n    const result = await this.request<{ data: MarketSkillVersionSummary[] }>(\n      `/v1/skills/${encodeURIComponent(identifier)}/versions`,\n      options,\n    );\n\n    log('Retrieved %d versions for skill %s', result.data.length, identifier);\n    return result.data;\n  }\n\n  /**\n   * Retrieves detailed information about a specific skill version\n   *\n   * Returns complete skill information for a specific version,\n   * including manifest, content, resources, and version history.\n   *\n   * @param identifier - Unique skill identifier\n   * @param version - Version string (e.g., '1.0.0')\n   * @param params - Query parameters for locale\n   * @param options - Optional request options\n   * @returns Promise resolving to the skill detail for the specified version\n   *\n   * @example\n   * ```typescript\n   * const skill = await sdk.marketSkills.getSkillVersion('github.owner.repo', '1.0.0');\n   * ```\n   */\n  async getSkillVersion(\n    identifier: string,\n    version: string,\n    params: { locale?: string } = {},\n    options?: globalThis.RequestInit,\n  ): Promise<MarketSkillDetail> {\n    const locale = params.locale || this.defaultLocale;\n    const queryParams: Record<string, string> = { locale };\n    const queryString = this.buildQueryString(queryParams);\n\n    log('Getting skill version: %s@%s', identifier, version);\n\n    const result = await this.request<MarketSkillDetail>(\n      `/v1/skills/${encodeURIComponent(identifier)}/versions/${encodeURIComponent(version)}${queryString}`,\n      options,\n    );\n\n    log('Skill version detail retrieved: %s@%s', identifier, version);\n    return result;\n  }\n\n  /**\n   * Reports a GitHub repository for skill import\n   *\n   * Submits a GitHub repository URL for async skill import.\n   * The import will be processed in the background and the skill\n   * will be available once the import completes.\n   *\n   * @param params - Report parameters containing gitUrl and optional branch\n   * @param options - Optional request options\n   * @returns Promise resolving to the report response with status\n   *\n   * @example\n   * ```typescript\n   * // Report a skill for import\n   * const result = await sdk.marketSkills.reportGitHubSkill({\n   *   gitUrl: 'https://github.com/owner/repo'\n   * });\n   *\n   * if (result.status === 'queued') {\n   *   console.log('Import queued:', result.identifier);\n   * } else if (result.status === 'exists') {\n   *   console.log('Skill already exists:', result.identifier);\n   * }\n   * ```\n   */\n  async reportGitHubSkill(\n    params: MarketReportGitHubSkillParams,\n    options?: globalThis.RequestInit,\n  ): Promise<MarketReportGitHubSkillResponse> {\n    log('Reporting GitHub skill: %s', params.gitUrl);\n\n    const result = await this.request<MarketReportGitHubSkillResponse>('/v1/skills/report/github', {\n      ...options,\n      body: JSON.stringify(params),\n      method: 'POST',\n    });\n\n    log('GitHub skill reported: %s (status: %s)', result.identifier, result.status);\n    return result;\n  }\n\n  /**\n   * Reports a skill installation attempt\n   *\n   * Submits installation telemetry data including success/failure status,\n   * duration, and optional error information. Used by the CLI after\n   * downloading and extracting a skill package.\n   *\n   * @param params - Installation report parameters\n   * @param options - Optional request options\n   * @returns Promise resolving to the report response\n   *\n   * @example\n   * ```typescript\n   * await sdk.marketSkills.reportSkillInstall({\n   *   identifier: 'github.owner.repo',\n   *   success: true,\n   *   installDurationMs: 1234,\n   *   platform: 'darwin-arm64',\n   * });\n   * ```\n   */\n  async reportSkillInstall(\n    params: MarketReportSkillInstallParams,\n    options?: globalThis.RequestInit,\n  ): Promise<MarketReportSkillInstallResponse> {\n    log('Reporting skill install: %s (success: %s)', params.identifier, params.success);\n\n    const result = await this.request<MarketReportSkillInstallResponse>(\n      '/v1/skills/report/installation',\n      {\n        ...options,\n        body: JSON.stringify(params),\n        method: 'POST',\n      },\n    );\n\n    log('Skill install reported: %s', result.message);\n    return result;\n  }\n\n  /**\n   * Submits or updates a rating for a skill\n   *\n   * @param identifier - Unique skill identifier\n   * @param score - Rating score (1-5)\n   * @param options - Optional request options\n   * @returns Promise resolving to the submitted score\n   */\n  async submitRating(\n    identifier: string,\n    score: number,\n    options?: globalThis.RequestInit,\n  ): Promise<{ score: number }> {\n    log('Submitting rating for skill %s: %d', identifier, score);\n\n    const result = await this.request<{ score: number }>(\n      `/v1/skills/${encodeURIComponent(identifier)}/ratings`,\n      {\n        ...options,\n        body: JSON.stringify({ score }),\n        method: 'POST',\n      },\n    );\n\n    log('Rating submitted for skill %s: %d', identifier, result.score);\n    return result;\n  }\n\n  /**\n   * Gets the rating distribution for a skill\n   *\n   * @param identifier - Unique skill identifier\n   * @param options - Optional request options\n   * @returns Promise resolving to the rating distribution\n   */\n  async getRatingDistribution(\n    identifier: string,\n    options?: globalThis.RequestInit,\n  ): Promise<SkillRatingDistribution> {\n    log('Getting rating distribution for skill: %s', identifier);\n\n    const result = await this.request<SkillRatingDistribution>(\n      `/v1/skills/${encodeURIComponent(identifier)}/ratings/distribution`,\n      options,\n    );\n\n    log('Rating distribution retrieved for skill %s: %d total', identifier, result.totalCount);\n    return result;\n  }\n\n  /**\n   * Gets paginated comments for a skill\n   *\n   * @param identifier - Unique skill identifier\n   * @param params - Query parameters for pagination and sorting\n   * @param options - Optional request options\n   * @returns Promise resolving to the paginated comment list\n   */\n  async getComments(\n    identifier: string,\n    params: SkillCommentListQuery = {},\n    options?: globalThis.RequestInit,\n  ): Promise<SkillCommentListResponse> {\n    const queryString = this.buildQueryString(params);\n\n    log('Getting comments for skill %s: %O', identifier, params);\n\n    const result = await this.request<SkillCommentListResponse>(\n      `/v1/skills/${encodeURIComponent(identifier)}/comments${queryString}`,\n      options,\n    );\n\n    log(\n      'Retrieved %d comments for skill %s (page %d/%d)',\n      result.items.length,\n      identifier,\n      result.currentPage,\n      result.totalPages,\n    );\n    return result;\n  }\n\n  /**\n   * Gets the latest comment for the authenticated user or agent on a skill\n   *\n   * @param identifier - Unique skill identifier\n   * @param options - Optional request options\n   * @returns Promise resolving to the latest own comment or null when none exists\n   */\n  async getLatestOwnComment(\n    identifier: string,\n    options?: globalThis.RequestInit,\n  ): Promise<SkillLatestOwnComment | null> {\n    log('Getting latest own comment for skill %s', identifier);\n\n    const result = await this.request<SkillLatestOwnComment | null>(\n      `/v1/skills/${encodeURIComponent(identifier)}/comments/latest`,\n      options,\n    );\n\n    if (result) {\n      log('Retrieved latest own comment for skill %s: id=%d', identifier, result.id);\n    } else {\n      log('No own comments found for skill %s', identifier);\n    }\n\n    return result;\n  }\n\n  /**\n   * Creates a comment on a skill, optionally with a rating\n   *\n   * @param identifier - Unique skill identifier\n   * @param data - Comment data with content and optional score\n   * @param options - Optional request options\n   * @returns Promise resolving to the created comment (with optional rating field)\n   */\n  async createComment(\n    identifier: string,\n    data: { content: string; score?: number },\n    options?: globalThis.RequestInit,\n  ): Promise<SkillCommentCreateResponse> {\n    log('Creating comment on skill %s', identifier);\n\n    const result = await this.request<SkillCommentCreateResponse>(\n      `/v1/skills/${encodeURIComponent(identifier)}/comments`,\n      {\n        ...options,\n        body: JSON.stringify(data),\n        method: 'POST',\n      },\n    );\n\n    log('Comment created on skill %s: id=%d', identifier, result.id);\n    return result;\n  }\n\n  /**\n   * Deletes a comment from a skill\n   *\n   * @param identifier - Unique skill identifier\n   * @param commentId - Comment ID to delete\n   * @param options - Optional request options\n   * @returns Promise resolving to success status\n   */\n  async deleteComment(\n    identifier: string,\n    commentId: number,\n    options?: globalThis.RequestInit,\n  ): Promise<SkillCommentDeleteResponse> {\n    log('Deleting comment %d from skill %s', commentId, identifier);\n\n    const result = await this.request<SkillCommentDeleteResponse>(\n      `/v1/skills/${encodeURIComponent(identifier)}/comments/${commentId}`,\n      {\n        ...options,\n        method: 'DELETE',\n      },\n    );\n\n    log('Comment %d deleted from skill %s', commentId, identifier);\n    return result;\n  }\n\n  /**\n   * Adds or updates a reaction on a comment\n   *\n   * @param commentId - Comment ID to react to\n   * @param type - Reaction type ('upvote' or 'downvote')\n   * @param options - Optional request options\n   * @returns Promise resolving to the created reaction\n   */\n  async addReaction(\n    commentId: number,\n    type: 'downvote' | 'upvote',\n    options?: globalThis.RequestInit,\n  ): Promise<{ commentId: number; id: number; type: string }> {\n    log('Adding %s reaction to comment %d', type, commentId);\n\n    const result = await this.request<{ commentId: number; id: number; type: string }>(\n      `/v1/skills/comments/${commentId}/reactions`,\n      {\n        ...options,\n        body: JSON.stringify({ type }),\n        method: 'POST',\n      },\n    );\n\n    log('Reaction added to comment %d: %s (id=%d)', commentId, result.type, result.id);\n    return result;\n  }\n\n  /**\n   * Removes a reaction from a comment\n   *\n   * @param commentId - Comment ID to remove reaction from\n   * @param options - Optional request options\n   * @returns Promise resolving to success status\n   */\n  async removeReaction(\n    commentId: number,\n    options?: globalThis.RequestInit,\n  ): Promise<{ success: boolean }> {\n    log('Removing reaction from comment %d', commentId);\n\n    const result = await this.request<{ success: boolean }>(\n      `/v1/skills/comments/${commentId}/reactions`,\n      {\n        ...options,\n        method: 'DELETE',\n      },\n    );\n\n    log('Reaction removed from comment %d', commentId);\n    return result;\n  }\n}\n","import debug from 'debug';\n\nimport { BaseSDK } from '../../core/BaseSDK';\nimport type {\n  RegisterUserRequest,\n  RegisterUserResponse,\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  /**\n   * Registers a new user via trust token authentication\n   *\n   * This endpoint ONLY accepts x-lobe-trust-token header authentication (Bearer tokens are not supported).\n   * User information (email, username) is automatically fetched from app.lobehub.com.\n   * If the user already exists (by email or userId), returns the existing user info.\n   *\n   * @param data - Registration data including registerUserId (required) and optional followUserId\n   * @param options - Optional request options (must include x-lobe-trust-token header)\n   * @returns Promise resolving to the registration response with user profile\n   * @throws Error if user is banned, follow user is banned, or registration fails\n   *\n   * @example\n   * ```typescript\n   * const result = await userService.register({\n   *   registerUserId: 'user_abc123',\n   *   followUserId: 'user_xyz789', // Optional\n   *   displayName: 'John Doe',\n   *   userName: 'johndoe'\n   * }, {\n   *   headers: {\n   *     'x-lobe-trust-token': trustToken\n   *   }\n   * });\n   * ```\n   */\n  async register(\n    data: RegisterUserRequest,\n    options?: globalThis.RequestInit,\n  ): Promise<RegisterUserResponse> {\n    log('Registering user: %O', {\n      followUserId: data.followUserId,\n      registerUserId: data.registerUserId,\n    });\n\n    const result = await this.request<RegisterUserResponse>('/v1/user/register', {\n      body: JSON.stringify(data),\n      headers: {\n        'Content-Type': 'application/json',\n      },\n      method: 'POST',\n      ...options,\n    });\n\n    log('User registered successfully: created=%s, userId=%s', result.created, result.user.clerkId);\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 error classes\nexport { MarketAPIError } from './core/MarketAPIError';\n\n// Export version info\nexport { SDK_USER_AGENT, SDK_VERSION } from './core/version';\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,aAAW;;;ACAlB,OAAO,WAAW;AAClB,SAAS,eAAe;AACxB,OAAO,aAAa;;;ACGpB,IAAM,wBAAwB,CAAC,cAAoB;AACjD,MAAI,CAAC,UAAW,QAAO;AAEvB,MAAI,OAAO,UAAU,UAAU,YAAY,UAAU,UAAU,MAAM;AACnE,WAAO,UAAU;AAAA,EACnB;AAEA,MAAI,OAAO,UAAU,UAAU,UAAU;AACvC,WAAO;AA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;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;;;AC9FA,cAAc;","names":["debug","debug","log","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","debug","log","debug","AgentService","debug","log","debug","debug","urlJoin","log","debug","urlJoin","debug","urlJoin","log","debug","urlJoin","debug","log","debug","debug","urlJoin","log","debug","urlJoin","debug","log","debug","debug","log","debug","debug","log","debug","debug","log","debug","debug","log","debug","debug","log","debug","debug","log","debug","debug","log","debug","debug","log","debug","log","debug","AgentService"]}