@lobehub/market-sdk 0.26.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { AgentItem, MarketItemBase, PluginConnectionType, InstallFailureAnalysisQuery, InstallFailureAnalysis, RangeQuery, RangeStats, TopPluginsQuery, TopPlugin, PluginManifest, AdminPluginItem, AdminPluginItemDetail, PluginVersion, PluginVersionLocalization, AdminDeploymentOption, InstallationDetails, SystemDependency, IncompleteI18nPlugin, CategoryListQuery, CategoryItem, PluginItemDetail, InstallReportRequest, InstallReportResponse, CallReportRequest, CallReportResponse, CloudGatewayRequest, CloudGatewayResponse } from '@lobehub/market-types';
1
+ import { z } from 'zod';
2
+ import { AgentItem, MarketItemBase, PluginConnectionType, InstallFailureAnalysisQuery, InstallFailureAnalysis, RangeQuery, RangeStats, TopPluginsQuery, TopPlugin, PluginManifest, AdminPluginItem, AdminPluginItemDetail, PluginVersion, PluginVersionLocalization, AdminDeploymentOption, InstallationDetails, SystemDependency, IncompleteI18nPlugin, AgentEventRequest, CategoryListQuery, CategoryItem, PluginItemDetail, InstallReportRequest, InstallReportResponse, CallReportRequest, CallReportResponse, PluginEventRequest, CloudGatewayRequest, CloudGatewayResponse } from '@lobehub/market-types';
2
3
  export * from '@lobehub/market-types';
3
4
  export { CategoryItem, CategoryListQuery, CategoryListResponse } from '@lobehub/market-types';
4
- import { z } from 'zod';
5
5
 
6
6
  /**
7
7
  * Visibility levels for plugins in the marketplace
@@ -1700,21 +1700,69 @@ declare class BaseSDK {
1700
1700
 
1701
1701
  /**
1702
1702
  * Admin Agent Item
1703
- * Extended agent item with admin-specific fields
1703
+ * Agent item with admin-specific fields for management
1704
1704
  */
1705
- interface AdminAgentItem extends AgentItem {
1706
- /** Number of knowledge bases attached to the agent */
1705
+ interface AdminAgentItem {
1706
+ /** Author information */
1707
+ author?: {
1708
+ avatar?: string;
1709
+ name?: string;
1710
+ userName?: string;
1711
+ };
1712
+ /** Avatar URL or emoji */
1713
+ avatar?: string;
1714
+ /** Category name */
1715
+ category?: string;
1716
+ /** Agent configuration */
1717
+ config?: any;
1718
+ /** Creation timestamp */
1719
+ createdAt: string;
1720
+ /** Description */
1721
+ description?: string;
1722
+ /** Agent ID */
1723
+ id: string;
1724
+ /** Agent identifier */
1725
+ identifier: string;
1726
+ /** Install count */
1727
+ installCount?: number;
1728
+ /** Whether featured */
1729
+ isFeatured?: boolean;
1730
+ /** Whether officially maintained */
1731
+ isOfficial: boolean;
1732
+ /** Number of knowledge bases attached */
1707
1733
  knowledgeCount?: number;
1708
- /** Owner ID of the agent */
1734
+ /** Display name */
1735
+ name: string;
1736
+ /** Owner ID */
1709
1737
  ownerId: number;
1710
- /** Number of plugins attached to the agent */
1738
+ /** Number of plugins attached */
1711
1739
  pluginCount?: number;
1740
+ /** Provider ID */
1741
+ providerId?: number;
1712
1742
  /** Safety check result */
1713
1743
  safetyCheck?: string | null;
1714
1744
  /** Publication status */
1715
1745
  status?: string;
1746
+ /** Tags */
1747
+ tags?: string[];
1716
1748
  /** Token usage */
1717
1749
  tokenUsage?: number;
1750
+ /** Update timestamp */
1751
+ updatedAt: string;
1752
+ /** URL */
1753
+ url?: string;
1754
+ /** Version name */
1755
+ versionName?: string;
1756
+ /** Version number */
1757
+ versionNumber?: number;
1758
+ /** Version list */
1759
+ versions?: Array<{
1760
+ isLatest: boolean;
1761
+ isValidated: boolean;
1762
+ updatedAt: string;
1763
+ version: string;
1764
+ versionNumber: number;
1765
+ }>;
1718
1766
  }
1719
1767
  /**
1720
1768
  * Admin Agent Item Detail
@@ -2928,6 +2976,15 @@ declare class AgentService extends BaseSDK {
2928
2976
  * @returns Promise resolving to true if agent exists, false otherwise
2929
2977
  */
2930
2978
  checkAgentExists(identifier: string, options?: globalThis.RequestInit): Promise<boolean>;
2979
+ /**
2980
+ * Record an agent event for the authenticated user
2981
+ *
2982
+ * Records agent usage actions (add, chat, click) for analytics.
2983
+ *
2984
+ * @param eventData - The agent event payload
2985
+ * @param options - Optional request init overrides
2986
+ */
2987
+ createEvent(eventData: AgentEventRequest, options?: globalThis.RequestInit): Promise<void>;
2931
2988
  /**
2932
2989
  * Increases the install count for an agent
2933
2990
  *
@@ -3248,6 +3305,15 @@ declare class PluginsService extends BaseSDK {
3248
3305
  * @returns Promise resolving to the report submission response
3249
3306
  */
3250
3307
  reportCall(reportData: CallReportRequest): Promise<CallReportResponse>;
3308
+ /**
3309
+ * Record a plugin event for the authenticated user
3310
+ *
3311
+ * Records plugin usage actions (install, activate, uninstall, click) for analytics.
3312
+ *
3313
+ * @param eventData - The plugin event payload
3314
+ * @param options - Optional request init overrides
3315
+ */
3316
+ createEvent(eventData: PluginEventRequest, options?: globalThis.RequestInit): Promise<void>;
3251
3317
  /**
3252
3318
  * Call a cloud-hosted plugin tool via the cloud gateway
3253
3319
  *
package/dist/index.mjs CHANGED
@@ -88,6 +88,9 @@ var BaseSDK = class {
88
88
  }
89
89
  }
90
90
  log("Request successful: %s", url);
91
+ if (response.status === 204) {
92
+ return void 0;
93
+ }
91
94
  return response.json();
92
95
  }
93
96
  /**
@@ -1790,6 +1793,25 @@ var AgentService2 = class extends BaseSDK {
1790
1793
  return false;
1791
1794
  }
1792
1795
  }
1796
+ /**
1797
+ * Record an agent event for the authenticated user
1798
+ *
1799
+ * Records agent usage actions (add, chat, click) for analytics.
1800
+ *
1801
+ * @param eventData - The agent event payload
1802
+ * @param options - Optional request init overrides
1803
+ */
1804
+ async createEvent(eventData, options) {
1805
+ log10("Recording agent event: %s for %s", eventData.event, eventData.identifier);
1806
+ await this.request("/v1/agents/events", {
1807
+ body: JSON.stringify(eventData),
1808
+ headers: {
1809
+ "Content-Type": "application/json"
1810
+ },
1811
+ method: "POST",
1812
+ ...options
1813
+ });
1814
+ }
1793
1815
  /**
1794
1816
  * Increases the install count for an agent
1795
1817
  *
@@ -2409,6 +2431,25 @@ var PluginsService = class extends BaseSDK {
2409
2431
  log14("Call report submitted successfully: %O", result);
2410
2432
  return result;
2411
2433
  }
2434
+ /**
2435
+ * Record a plugin event for the authenticated user
2436
+ *
2437
+ * Records plugin usage actions (install, activate, uninstall, click) for analytics.
2438
+ *
2439
+ * @param eventData - The plugin event payload
2440
+ * @param options - Optional request init overrides
2441
+ */
2442
+ async createEvent(eventData, options) {
2443
+ log14("Recording plugin event: %s for %s", eventData.event, eventData.identifier);
2444
+ await this.request("/v1/plugins/events", {
2445
+ body: JSON.stringify(eventData),
2446
+ headers: {
2447
+ "Content-Type": "application/json"
2448
+ },
2449
+ method: "POST",
2450
+ ...options
2451
+ });
2452
+ }
2412
2453
  /**
2413
2454
  * Call a cloud-hosted plugin tool via the cloud gateway
2414
2455
  *
@@ -2479,7 +2520,12 @@ var PluginsService = class extends BaseSDK {
2479
2520
  * ```
2480
2521
  */
2481
2522
  async runBuildInTool(toolName, params, context, options) {
2482
- log14("Running built-in tool: %s for user %s, topic %s", toolName, context.userId, context.topicId);
2523
+ log14(
2524
+ "Running built-in tool: %s for user %s, topic %s",
2525
+ toolName,
2526
+ context.userId,
2527
+ context.topicId
2528
+ );
2483
2529
  const result = await this.request("/v1/plugins/run-buildin-tools", {
2484
2530
  body: JSON.stringify({
2485
2531
  params,