@lobehub/market-sdk 0.26.1 → 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,5 +1,5 @@
1
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, CategoryListQuery, CategoryItem, PluginItemDetail, InstallReportRequest, InstallReportResponse, CallReportRequest, CallReportResponse, CloudGatewayRequest, CloudGatewayResponse } from '@lobehub/market-types';
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';
3
3
  export * from '@lobehub/market-types';
4
4
  export { CategoryItem, CategoryListQuery, CategoryListResponse } from '@lobehub/market-types';
5
5
 
@@ -2976,6 +2976,15 @@ declare class AgentService extends BaseSDK {
2976
2976
  * @returns Promise resolving to true if agent exists, false otherwise
2977
2977
  */
2978
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>;
2979
2988
  /**
2980
2989
  * Increases the install count for an agent
2981
2990
  *
@@ -3296,6 +3305,15 @@ declare class PluginsService extends BaseSDK {
3296
3305
  * @returns Promise resolving to the report submission response
3297
3306
  */
3298
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>;
3299
3317
  /**
3300
3318
  * Call a cloud-hosted plugin tool via the cloud gateway
3301
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,