@lobehub/market-sdk 0.27.0 → 0.27.1-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1561,7 +1561,7 @@ var MarketAdmin = class extends BaseSDK {
1561
1561
  };
1562
1562
 
1563
1563
  // src/market/market-sdk.ts
1564
- import debug19 from "debug";
1564
+ import debug21 from "debug";
1565
1565
 
1566
1566
  // src/market/services/AgentService.ts
1567
1567
  import debug10 from "debug";
@@ -2182,10 +2182,218 @@ _AuthService.HANDOFF_CONSUMED_STATUS = "consumed";
2182
2182
  _AuthService.HANDOFF_EXPIRED_STATUS = "expired";
2183
2183
  var AuthService = _AuthService;
2184
2184
 
2185
- // src/market/services/DiscoveryService.ts
2185
+ // src/market/services/ConnectService.ts
2186
2186
  import debug12 from "debug";
2187
2187
  import urlJoin3 from "url-join";
2188
- var log12 = debug12("lobe-market-sdk:discovery");
2188
+ var log12 = debug12("lobe-market-sdk:connect");
2189
+ var ConnectService = class extends BaseSDK {
2190
+ /**
2191
+ * Lists all available OAuth providers
2192
+ *
2193
+ * Returns providers that have credentials configured on the server.
2194
+ * This is a public endpoint that doesn't require authentication.
2195
+ *
2196
+ * @param options - Optional request options
2197
+ * @returns Promise resolving to the list of available providers
2198
+ */
2199
+ async listProviders(options) {
2200
+ var _a;
2201
+ log12("Listing connect providers");
2202
+ const result = await this.request(
2203
+ "/connect/providers",
2204
+ options
2205
+ );
2206
+ log12("Found %d connect providers", ((_a = result.providers) == null ? void 0 : _a.length) || 0);
2207
+ return result;
2208
+ }
2209
+ /**
2210
+ * Gets detailed information about a specific provider
2211
+ *
2212
+ * This is a public endpoint that doesn't require authentication.
2213
+ *
2214
+ * @param provider - The provider ID (e.g., 'linear', 'github')
2215
+ * @param options - Optional request options
2216
+ * @returns Promise resolving to the provider details
2217
+ */
2218
+ async getProvider(provider, options) {
2219
+ var _a;
2220
+ log12("Getting provider details: %s", provider);
2221
+ const result = await this.request(
2222
+ `/connect/providers/${encodeURIComponent(provider)}`,
2223
+ options
2224
+ );
2225
+ log12("Retrieved provider: %s", (_a = result.provider) == null ? void 0 : _a.name);
2226
+ return result;
2227
+ }
2228
+ /**
2229
+ * Generates the OAuth authorization URL for a provider
2230
+ *
2231
+ * This URL should be opened in a browser (popup or redirect) for the user
2232
+ * to authorize the connection. After authorization, the user will be
2233
+ * redirected back to the callback URL.
2234
+ *
2235
+ * Note: This method does NOT make an API request. It constructs the URL
2236
+ * that the user should visit to start the OAuth flow.
2237
+ *
2238
+ * @param provider - The provider ID (e.g., 'linear', 'github')
2239
+ * @param params - Optional parameters for scopes and redirect URI
2240
+ * @returns The authorization URL to redirect the user to
2241
+ *
2242
+ * @example
2243
+ * ```typescript
2244
+ * // Basic usage - opens in popup
2245
+ * const url = sdk.connect.getAuthorizeUrl('linear');
2246
+ * const popup = window.open(url, 'oauth', 'width=600,height=700');
2247
+ *
2248
+ * // With custom scopes
2249
+ * const url = sdk.connect.getAuthorizeUrl('github', {
2250
+ * scopes: ['user', 'repo', 'read:org']
2251
+ * });
2252
+ *
2253
+ * // With redirect URI
2254
+ * const url = sdk.connect.getAuthorizeUrl('linear', {
2255
+ * redirectUri: 'https://myapp.com/oauth/callback'
2256
+ * });
2257
+ * ```
2258
+ */
2259
+ getAuthorizeUrl(provider, params) {
2260
+ log12("Generating authorize URL for provider: %s", provider);
2261
+ const queryParams = new URLSearchParams();
2262
+ if ((params == null ? void 0 : params.scopes) && params.scopes.length > 0) {
2263
+ queryParams.set("scope", params.scopes.join(","));
2264
+ }
2265
+ if (params == null ? void 0 : params.redirectUri) {
2266
+ queryParams.set("redirect_uri", params.redirectUri);
2267
+ }
2268
+ const queryString = queryParams.toString();
2269
+ const path = `/connect/${encodeURIComponent(provider)}/start${queryString ? `?${queryString}` : ""}`;
2270
+ const url = urlJoin3(this.baseUrl, "api", path);
2271
+ log12("Generated authorize URL: %s", url);
2272
+ return url;
2273
+ }
2274
+ /**
2275
+ * Gets the connection status for a specific provider
2276
+ *
2277
+ * Checks if the authenticated user has an active OAuth connection.
2278
+ * Requires authentication.
2279
+ *
2280
+ * @param provider - The provider ID (e.g., 'linear', 'github')
2281
+ * @param options - Optional request options (must include authentication)
2282
+ * @returns Promise resolving to the connection status
2283
+ */
2284
+ async getStatus(provider, options) {
2285
+ log12("Getting connection status for provider: %s", provider);
2286
+ const result = await this.request(
2287
+ `/connect/${encodeURIComponent(provider)}/status`,
2288
+ options
2289
+ );
2290
+ log12("Provider %s connection status: connected=%s", provider, result.connected);
2291
+ return result;
2292
+ }
2293
+ /**
2294
+ * Lists all OAuth connections for the authenticated user
2295
+ *
2296
+ * Requires authentication.
2297
+ *
2298
+ * @param options - Optional request options (must include authentication)
2299
+ * @returns Promise resolving to the list of connections
2300
+ */
2301
+ async listConnections(options) {
2302
+ var _a;
2303
+ log12("Listing user connections");
2304
+ const result = await this.request("/connect/connections", options);
2305
+ log12("Found %d connections", ((_a = result.connections) == null ? void 0 : _a.length) || 0);
2306
+ return result;
2307
+ }
2308
+ /**
2309
+ * Checks the health of a specific provider connection
2310
+ *
2311
+ * Verifies if the token is valid, expiring soon, or expired.
2312
+ * Requires authentication.
2313
+ *
2314
+ * @param provider - The provider ID (e.g., 'linear', 'github')
2315
+ * @param options - Optional request options (must include authentication)
2316
+ * @returns Promise resolving to the connection health status
2317
+ */
2318
+ async getHealth(provider, options) {
2319
+ log12("Checking health for provider: %s", provider);
2320
+ const result = await this.request(
2321
+ `/connect/${encodeURIComponent(provider)}/health`,
2322
+ options
2323
+ );
2324
+ log12("Provider %s health: healthy=%s, status=%s", provider, result.healthy, result.tokenStatus);
2325
+ return result;
2326
+ }
2327
+ /**
2328
+ * Checks the health of all provider connections
2329
+ *
2330
+ * Requires authentication.
2331
+ *
2332
+ * @param options - Optional request options (must include authentication)
2333
+ * @returns Promise resolving to the health status of all connections
2334
+ */
2335
+ async getAllHealth(options) {
2336
+ var _a, _b, _c;
2337
+ log12("Checking health for all connections");
2338
+ const result = await this.request("/connect/health", options);
2339
+ log12(
2340
+ "Health check complete: total=%d, healthy=%d, unhealthy=%d",
2341
+ ((_a = result.summary) == null ? void 0 : _a.total) || 0,
2342
+ ((_b = result.summary) == null ? void 0 : _b.healthy) || 0,
2343
+ ((_c = result.summary) == null ? void 0 : _c.unhealthy) || 0
2344
+ );
2345
+ return result;
2346
+ }
2347
+ /**
2348
+ * Manually refreshes the access token for a provider connection
2349
+ *
2350
+ * Only works for providers that support token refresh.
2351
+ * Requires authentication.
2352
+ *
2353
+ * @param provider - The provider ID (e.g., 'linear', 'github')
2354
+ * @param options - Optional request options (must include authentication)
2355
+ * @returns Promise resolving to the refresh result
2356
+ */
2357
+ async refresh(provider, options) {
2358
+ log12("Refreshing token for provider: %s", provider);
2359
+ const result = await this.request(
2360
+ `/connect/${encodeURIComponent(provider)}/refresh`,
2361
+ {
2362
+ method: "POST",
2363
+ ...options
2364
+ }
2365
+ );
2366
+ log12("Token refresh for %s: refreshed=%s", provider, result.refreshed);
2367
+ return result;
2368
+ }
2369
+ /**
2370
+ * Revokes/disconnects a provider connection
2371
+ *
2372
+ * Removes the OAuth connection and deletes stored tokens.
2373
+ * Requires authentication.
2374
+ *
2375
+ * @param provider - The provider ID (e.g., 'linear', 'github')
2376
+ * @param options - Optional request options (must include authentication)
2377
+ * @returns Promise resolving to the revoke result
2378
+ */
2379
+ async revoke(provider, options) {
2380
+ log12("Revoking connection for provider: %s", provider);
2381
+ const result = await this.request(
2382
+ `/connect/${encodeURIComponent(provider)}`,
2383
+ {
2384
+ method: "DELETE",
2385
+ ...options
2386
+ }
2387
+ );
2388
+ log12("Connection revoked for %s: success=%s", provider, result.success);
2389
+ return result;
2390
+ }
2391
+ };
2392
+
2393
+ // src/market/services/DiscoveryService.ts
2394
+ import debug13 from "debug";
2395
+ import urlJoin4 from "url-join";
2396
+ var log13 = debug13("lobe-market-sdk:discovery");
2189
2397
  var DiscoveryService = class extends BaseSDK {
2190
2398
  /**
2191
2399
  * Retrieves the service discovery document
@@ -2197,24 +2405,24 @@ var DiscoveryService = class extends BaseSDK {
2197
2405
  * @returns Promise resolving to the service discovery document
2198
2406
  */
2199
2407
  async getDiscoveryDocument() {
2200
- log12("Fetching discovery document");
2408
+ log13("Fetching discovery document");
2201
2409
  if (this.discoveryDoc) {
2202
- log12("Returning cached discovery document");
2410
+ log13("Returning cached discovery document");
2203
2411
  return this.discoveryDoc;
2204
2412
  }
2205
- const res = await fetch(urlJoin3(this.baseUrl, "/.well-known/discovery"));
2413
+ const res = await fetch(urlJoin4(this.baseUrl, "/.well-known/discovery"));
2206
2414
  if (!res.ok) {
2207
2415
  throw new Error(await res.text());
2208
2416
  }
2209
2417
  this.discoveryDoc = await res.json();
2210
- log12("Discovery document successfully fetched");
2418
+ log13("Discovery document successfully fetched");
2211
2419
  return this.discoveryDoc;
2212
2420
  }
2213
2421
  };
2214
2422
 
2215
2423
  // src/market/services/FeedbackService.ts
2216
- import debug13 from "debug";
2217
- var log13 = debug13("lobe-market-sdk:feedback");
2424
+ import debug14 from "debug";
2425
+ var log14 = debug14("lobe-market-sdk:feedback");
2218
2426
  var FeedbackService = class extends BaseSDK {
2219
2427
  /**
2220
2428
  * Submits user feedback
@@ -2244,7 +2452,7 @@ var FeedbackService = class extends BaseSDK {
2244
2452
  * ```
2245
2453
  */
2246
2454
  async submitFeedback(data, options) {
2247
- log13("Submitting feedback: %s", data.title);
2455
+ log14("Submitting feedback: %s", data.title);
2248
2456
  const result = await this.request("/v1/user/feedback", {
2249
2457
  body: JSON.stringify(data),
2250
2458
  headers: {
@@ -2253,14 +2461,14 @@ var FeedbackService = class extends BaseSDK {
2253
2461
  method: "POST",
2254
2462
  ...options
2255
2463
  });
2256
- log13("Feedback submitted successfully: %s", result.issueId);
2464
+ log14("Feedback submitted successfully: %s", result.issueId);
2257
2465
  return result;
2258
2466
  }
2259
2467
  };
2260
2468
 
2261
2469
  // src/market/services/PluginsService.ts
2262
- import debug14 from "debug";
2263
- var log14 = debug14("lobe-market-sdk:plugins");
2470
+ import debug15 from "debug";
2471
+ var log15 = debug15("lobe-market-sdk:plugins");
2264
2472
  var PluginsService = class extends BaseSDK {
2265
2473
  /**
2266
2474
  * Retrieves a list of plugins from the marketplace
@@ -2275,9 +2483,9 @@ var PluginsService = class extends BaseSDK {
2275
2483
  const locale = params.locale || this.defaultLocale;
2276
2484
  const queryParams = { ...params, locale };
2277
2485
  const queryString = this.buildQueryString(queryParams);
2278
- log14("Getting plugin list: %O", queryParams);
2486
+ log15("Getting plugin list: %O", queryParams);
2279
2487
  const result = await this.request(`/v1/plugins${queryString}`, options);
2280
- log14("Retrieved %d plugins", result.items.length);
2488
+ log15("Retrieved %d plugins", result.items.length);
2281
2489
  return result;
2282
2490
  }
2283
2491
  /**
@@ -2295,12 +2503,12 @@ var PluginsService = class extends BaseSDK {
2295
2503
  const locale = params.locale || this.defaultLocale;
2296
2504
  const queryParams = { ...params, locale };
2297
2505
  const queryString = this.buildQueryString(queryParams);
2298
- log14("Getting plugin categories: %O", queryParams);
2506
+ log15("Getting plugin categories: %O", queryParams);
2299
2507
  const result = await this.request(
2300
2508
  `/v1/plugins/categories${queryString}`,
2301
2509
  options
2302
2510
  );
2303
- log14("Retrieved %d categories", result.length);
2511
+ log15("Retrieved %d categories", result.length);
2304
2512
  return result;
2305
2513
  }
2306
2514
  /**
@@ -2313,12 +2521,12 @@ var PluginsService = class extends BaseSDK {
2313
2521
  * @returns Promise resolving to an array containing identifiers array and last modified time
2314
2522
  */
2315
2523
  async getPublishedIdentifiers(options) {
2316
- log14("Getting published plugin identifiers");
2524
+ log15("Getting published plugin identifiers");
2317
2525
  const result = await this.request(
2318
2526
  "/v1/plugins/identifiers",
2319
2527
  options
2320
2528
  );
2321
- log14("Retrieved %d published plugin identifiers", result.length);
2529
+ log15("Retrieved %d published plugin identifiers", result.length);
2322
2530
  return result;
2323
2531
  }
2324
2532
  /**
@@ -2338,7 +2546,7 @@ var PluginsService = class extends BaseSDK {
2338
2546
  version,
2339
2547
  identifier
2340
2548
  }, options) {
2341
- log14("Getting plugin manifest: %O", { identifier, locale, version });
2549
+ log15("Getting plugin manifest: %O", { identifier, locale, version });
2342
2550
  const localeParam = locale || this.defaultLocale;
2343
2551
  const params = { locale: localeParam };
2344
2552
  if (version) {
@@ -2349,7 +2557,7 @@ var PluginsService = class extends BaseSDK {
2349
2557
  `/v1/plugins/${identifier}/manifest${queryString}`,
2350
2558
  options
2351
2559
  );
2352
- log14("Plugin manifest successfully retrieved: %s", identifier);
2560
+ log15("Plugin manifest successfully retrieved: %s", identifier);
2353
2561
  return manifest;
2354
2562
  }
2355
2563
  /**
@@ -2366,7 +2574,7 @@ var PluginsService = class extends BaseSDK {
2366
2574
  version,
2367
2575
  identifier
2368
2576
  }, options) {
2369
- log14("Getting plugin detail: %O", { identifier, locale, version });
2577
+ log15("Getting plugin detail: %O", { identifier, locale, version });
2370
2578
  const localeParam = locale || this.defaultLocale;
2371
2579
  const params = { locale: localeParam };
2372
2580
  if (version) {
@@ -2377,7 +2585,7 @@ var PluginsService = class extends BaseSDK {
2377
2585
  `/v1/plugins/${identifier}${queryString}`,
2378
2586
  options
2379
2587
  );
2380
- log14("Plugin manifest successfully retrieved: %s", identifier);
2588
+ log15("Plugin manifest successfully retrieved: %s", identifier);
2381
2589
  return manifest;
2382
2590
  }
2383
2591
  /**
@@ -2392,7 +2600,7 @@ var PluginsService = class extends BaseSDK {
2392
2600
  *
2393
2601
  */
2394
2602
  async reportInstallation(reportData) {
2395
- log14("Reporting installation for %s@%s", reportData.identifier, reportData.version);
2603
+ log15("Reporting installation for %s@%s", reportData.identifier, reportData.version);
2396
2604
  const result = await this.request("/v1/plugins/report/installation", {
2397
2605
  body: JSON.stringify(reportData),
2398
2606
  headers: {
@@ -2400,7 +2608,7 @@ var PluginsService = class extends BaseSDK {
2400
2608
  },
2401
2609
  method: "POST"
2402
2610
  });
2403
- log14("Installation report submitted successfully: %O", result);
2611
+ log15("Installation report submitted successfully: %O", result);
2404
2612
  return result;
2405
2613
  }
2406
2614
  /**
@@ -2414,7 +2622,7 @@ var PluginsService = class extends BaseSDK {
2414
2622
  * @returns Promise resolving to the report submission response
2415
2623
  */
2416
2624
  async reportCall(reportData) {
2417
- log14(
2625
+ log15(
2418
2626
  "Reporting call for %s@%s - %s:%s",
2419
2627
  reportData.identifier,
2420
2628
  reportData.version,
@@ -2428,7 +2636,7 @@ var PluginsService = class extends BaseSDK {
2428
2636
  },
2429
2637
  method: "POST"
2430
2638
  });
2431
- log14("Call report submitted successfully: %O", result);
2639
+ log15("Call report submitted successfully: %O", result);
2432
2640
  return result;
2433
2641
  }
2434
2642
  /**
@@ -2440,7 +2648,7 @@ var PluginsService = class extends BaseSDK {
2440
2648
  * @param options - Optional request init overrides
2441
2649
  */
2442
2650
  async createEvent(eventData, options) {
2443
- log14("Recording plugin event: %s for %s", eventData.event, eventData.identifier);
2651
+ log15("Recording plugin event: %s for %s", eventData.event, eventData.identifier);
2444
2652
  await this.request("/v1/plugins/events", {
2445
2653
  body: JSON.stringify(eventData),
2446
2654
  headers: {
@@ -2470,7 +2678,7 @@ var PluginsService = class extends BaseSDK {
2470
2678
  * ```
2471
2679
  */
2472
2680
  async callCloudGateway(request, options) {
2473
- log14("Calling cloud gateway for plugin %s, tool %s", request.identifier, request.toolName);
2681
+ log15("Calling cloud gateway for plugin %s, tool %s", request.identifier, request.toolName);
2474
2682
  const result = await this.request("/v1/plugins/cloud-gateway", {
2475
2683
  body: JSON.stringify(request),
2476
2684
  headers: {
@@ -2479,7 +2687,7 @@ var PluginsService = class extends BaseSDK {
2479
2687
  method: "POST",
2480
2688
  ...options
2481
2689
  });
2482
- log14("Cloud gateway call completed: %O", {
2690
+ log15("Cloud gateway call completed: %O", {
2483
2691
  identifier: request.identifier,
2484
2692
  isError: result.isError,
2485
2693
  toolName: request.toolName
@@ -2520,7 +2728,7 @@ var PluginsService = class extends BaseSDK {
2520
2728
  * ```
2521
2729
  */
2522
2730
  async runBuildInTool(toolName, params, context, options) {
2523
- log14(
2731
+ log15(
2524
2732
  "Running built-in tool: %s for user %s, topic %s",
2525
2733
  toolName,
2526
2734
  context.userId,
@@ -2539,7 +2747,7 @@ var PluginsService = class extends BaseSDK {
2539
2747
  method: "POST",
2540
2748
  ...options
2541
2749
  });
2542
- log14("Built-in tool execution completed: %O", {
2750
+ log15("Built-in tool execution completed: %O", {
2543
2751
  success: result.success,
2544
2752
  toolName
2545
2753
  });
@@ -2642,9 +2850,134 @@ var PluginsService = class extends BaseSDK {
2642
2850
  }
2643
2851
  };
2644
2852
 
2853
+ // src/market/services/SkillService.ts
2854
+ import debug16 from "debug";
2855
+ var log16 = debug16("lobe-market-sdk:skill");
2856
+ var SkillService = class extends BaseSDK {
2857
+ /**
2858
+ * Lists all available skill providers
2859
+ *
2860
+ * Returns a list of providers that can be connected via OAuth.
2861
+ * This is a public endpoint that doesn't require authentication.
2862
+ *
2863
+ * @param options - Optional request options
2864
+ * @returns Promise resolving to the list of available providers
2865
+ */
2866
+ async listProviders(options) {
2867
+ var _a;
2868
+ log16("Listing skill providers");
2869
+ const result = await this.request("/v1/skill/providers", options);
2870
+ log16("Found %d skill providers", ((_a = result.providers) == null ? void 0 : _a.length) || 0);
2871
+ return result;
2872
+ }
2873
+ /**
2874
+ * Lists available tools for a specific provider
2875
+ *
2876
+ * Returns the tools/functions that can be called on the provider.
2877
+ * This is a public endpoint that doesn't require authentication.
2878
+ *
2879
+ * @param provider - The provider ID (e.g., 'linear', 'github')
2880
+ * @param options - Optional request options
2881
+ * @returns Promise resolving to the list of available tools
2882
+ */
2883
+ async listTools(provider, options) {
2884
+ var _a;
2885
+ log16("Listing tools for provider: %s", provider);
2886
+ const result = await this.request(
2887
+ `/v1/skill/${encodeURIComponent(provider)}/tools`,
2888
+ options
2889
+ );
2890
+ log16("Found %d tools for provider %s", ((_a = result.tools) == null ? void 0 : _a.length) || 0, provider);
2891
+ return result;
2892
+ }
2893
+ /**
2894
+ * Gets details of a specific tool
2895
+ *
2896
+ * Returns detailed information about a tool including its input schema.
2897
+ * This is a public endpoint that doesn't require authentication.
2898
+ *
2899
+ * @param provider - The provider ID (e.g., 'linear', 'github')
2900
+ * @param toolName - The name of the tool
2901
+ * @param options - Optional request options
2902
+ * @returns Promise resolving to the tool details
2903
+ */
2904
+ async getTool(provider, toolName, options) {
2905
+ var _a;
2906
+ log16("Getting tool %s from provider %s", toolName, provider);
2907
+ const result = await this.request(
2908
+ `/v1/skill/${encodeURIComponent(provider)}/tool/${encodeURIComponent(toolName)}`,
2909
+ options
2910
+ );
2911
+ log16("Retrieved tool: %s", (_a = result.tool) == null ? void 0 : _a.name);
2912
+ return result;
2913
+ }
2914
+ /**
2915
+ * Gets the connection status for a provider
2916
+ *
2917
+ * Checks if the authenticated user has an active OAuth connection to the provider.
2918
+ * Requires authentication.
2919
+ *
2920
+ * @param provider - The provider ID (e.g., 'linear', 'github')
2921
+ * @param options - Optional request options (must include authentication)
2922
+ * @returns Promise resolving to the connection status
2923
+ */
2924
+ async getStatus(provider, options) {
2925
+ log16("Getting status for provider: %s", provider);
2926
+ const result = await this.request(
2927
+ `/v1/skill/${encodeURIComponent(provider)}/status`,
2928
+ options
2929
+ );
2930
+ log16("Provider %s status: connected=%s", provider, result.connected);
2931
+ return result;
2932
+ }
2933
+ /**
2934
+ * Calls a tool on a connected provider
2935
+ *
2936
+ * Executes a tool/function on the provider using the user's OAuth connection.
2937
+ * Requires authentication and an active OAuth connection to the provider.
2938
+ *
2939
+ * @param provider - The provider ID (e.g., 'linear', 'github')
2940
+ * @param params - The tool call parameters (tool name and arguments)
2941
+ * @param options - Optional request options (must include authentication)
2942
+ * @returns Promise resolving to the tool call result
2943
+ *
2944
+ * @example
2945
+ * ```typescript
2946
+ * // Create a Linear issue
2947
+ * const result = await sdk.skills.callTool('linear', {
2948
+ * tool: 'create_issue',
2949
+ * args: {
2950
+ * title: 'New feature request',
2951
+ * team: 'Engineering',
2952
+ * description: 'We need to implement...'
2953
+ * }
2954
+ * });
2955
+ * ```
2956
+ */
2957
+ async callTool(provider, params, options) {
2958
+ log16("Calling tool %s on provider %s", params.tool, provider);
2959
+ const result = await this.request(
2960
+ `/v1/skill/${encodeURIComponent(provider)}/call`,
2961
+ {
2962
+ body: JSON.stringify({
2963
+ args: params.args || {},
2964
+ tool: params.tool
2965
+ }),
2966
+ headers: {
2967
+ "Content-Type": "application/json"
2968
+ },
2969
+ method: "POST",
2970
+ ...options
2971
+ }
2972
+ );
2973
+ log16("Tool %s call completed: success=%s", params.tool, result.success);
2974
+ return result;
2975
+ }
2976
+ };
2977
+
2645
2978
  // src/market/services/UserService.ts
2646
- import debug15 from "debug";
2647
- var log15 = debug15("lobe-market-sdk:user");
2979
+ import debug17 from "debug";
2980
+ var log17 = debug17("lobe-market-sdk:user");
2648
2981
  var UserService = class extends BaseSDK {
2649
2982
  /**
2650
2983
  * Retrieves user information by account ID or userName
@@ -2661,12 +2994,12 @@ var UserService = class extends BaseSDK {
2661
2994
  const locale = params.locale || this.defaultLocale;
2662
2995
  const queryParams = { locale };
2663
2996
  const queryString = this.buildQueryString(queryParams);
2664
- log15("Getting user info: %O", { idOrUserName, ...params });
2997
+ log17("Getting user info: %O", { idOrUserName, ...params });
2665
2998
  const result = await this.request(
2666
2999
  `/v1/user/info/${idOrUserName}${queryString}`,
2667
3000
  options
2668
3001
  );
2669
- log15("User info successfully retrieved for: %s", idOrUserName);
3002
+ log17("User info successfully retrieved for: %s", idOrUserName);
2670
3003
  return result;
2671
3004
  }
2672
3005
  /**
@@ -2681,7 +3014,7 @@ var UserService = class extends BaseSDK {
2681
3014
  * @throws Error if userName is already taken or update fails
2682
3015
  */
2683
3016
  async updateUserInfo(data, options) {
2684
- log15("Updating user info: %O", data);
3017
+ log17("Updating user info: %O", data);
2685
3018
  const result = await this.request("/v1/user/update", {
2686
3019
  body: JSON.stringify(data),
2687
3020
  headers: {
@@ -2690,14 +3023,14 @@ var UserService = class extends BaseSDK {
2690
3023
  method: "POST",
2691
3024
  ...options
2692
3025
  });
2693
- log15("User info updated successfully");
3026
+ log17("User info updated successfully");
2694
3027
  return result;
2695
3028
  }
2696
3029
  };
2697
3030
 
2698
3031
  // src/market/services/UserFollowService.ts
2699
- import debug16 from "debug";
2700
- var log16 = debug16("lobe-market-sdk:user-follow");
3032
+ import debug18 from "debug";
3033
+ var log18 = debug18("lobe-market-sdk:user-follow");
2701
3034
  var UserFollowService = class extends BaseSDK {
2702
3035
  /**
2703
3036
  * Follow a user
@@ -2711,7 +3044,7 @@ var UserFollowService = class extends BaseSDK {
2711
3044
  * @throws Error if already following or cannot follow yourself
2712
3045
  */
2713
3046
  async follow(followingId, options) {
2714
- log16("Following user: %d", followingId);
3047
+ log18("Following user: %d", followingId);
2715
3048
  const body = { followingId };
2716
3049
  const result = await this.request("/v1/user/follows", {
2717
3050
  body: JSON.stringify(body),
@@ -2721,7 +3054,7 @@ var UserFollowService = class extends BaseSDK {
2721
3054
  method: "POST",
2722
3055
  ...options
2723
3056
  });
2724
- log16("Successfully followed user: %d", followingId);
3057
+ log18("Successfully followed user: %d", followingId);
2725
3058
  return result;
2726
3059
  }
2727
3060
  /**
@@ -2736,7 +3069,7 @@ var UserFollowService = class extends BaseSDK {
2736
3069
  * @throws Error if follow relationship not found
2737
3070
  */
2738
3071
  async unfollow(followingId, options) {
2739
- log16("Unfollowing user: %d", followingId);
3072
+ log18("Unfollowing user: %d", followingId);
2740
3073
  const body = { followingId };
2741
3074
  const result = await this.request("/v1/user/follows", {
2742
3075
  body: JSON.stringify(body),
@@ -2746,7 +3079,7 @@ var UserFollowService = class extends BaseSDK {
2746
3079
  method: "DELETE",
2747
3080
  ...options
2748
3081
  });
2749
- log16("Successfully unfollowed user: %d", followingId);
3082
+ log18("Successfully unfollowed user: %d", followingId);
2750
3083
  return result;
2751
3084
  }
2752
3085
  /**
@@ -2760,13 +3093,13 @@ var UserFollowService = class extends BaseSDK {
2760
3093
  * @returns Promise resolving to follow status (isFollowing, isMutual)
2761
3094
  */
2762
3095
  async checkFollowStatus(targetUserId, options) {
2763
- log16("Checking follow status for user: %d", targetUserId);
3096
+ log18("Checking follow status for user: %d", targetUserId);
2764
3097
  const queryString = this.buildQueryString({ targetUserId: String(targetUserId) });
2765
3098
  const result = await this.request(
2766
3099
  `/v1/user/follows/check${queryString}`,
2767
3100
  options
2768
3101
  );
2769
- log16("Follow status retrieved: %O", result);
3102
+ log18("Follow status retrieved: %O", result);
2770
3103
  return result;
2771
3104
  }
2772
3105
  /**
@@ -2781,7 +3114,7 @@ var UserFollowService = class extends BaseSDK {
2781
3114
  * @returns Promise resolving to list of following users
2782
3115
  */
2783
3116
  async getFollowing(userId, params = {}, options) {
2784
- log16("Getting following list for user: %d", userId);
3117
+ log18("Getting following list for user: %d", userId);
2785
3118
  const queryParams = {};
2786
3119
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
2787
3120
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -2790,7 +3123,7 @@ var UserFollowService = class extends BaseSDK {
2790
3123
  `/v1/user/follows/${userId}/following${queryString}`,
2791
3124
  options
2792
3125
  );
2793
- log16("Following list retrieved for user: %d", userId);
3126
+ log18("Following list retrieved for user: %d", userId);
2794
3127
  return result;
2795
3128
  }
2796
3129
  /**
@@ -2805,7 +3138,7 @@ var UserFollowService = class extends BaseSDK {
2805
3138
  * @returns Promise resolving to list of followers
2806
3139
  */
2807
3140
  async getFollowers(userId, params = {}, options) {
2808
- log16("Getting followers list for user: %d", userId);
3141
+ log18("Getting followers list for user: %d", userId);
2809
3142
  const queryParams = {};
2810
3143
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
2811
3144
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -2814,14 +3147,14 @@ var UserFollowService = class extends BaseSDK {
2814
3147
  `/v1/user/follows/${userId}/followers${queryString}`,
2815
3148
  options
2816
3149
  );
2817
- log16("Followers list retrieved for user: %d", userId);
3150
+ log18("Followers list retrieved for user: %d", userId);
2818
3151
  return result;
2819
3152
  }
2820
3153
  };
2821
3154
 
2822
3155
  // src/market/services/UserFavoriteService.ts
2823
- import debug17 from "debug";
2824
- var log17 = debug17("lobe-market-sdk:user-favorite");
3156
+ import debug19 from "debug";
3157
+ var log19 = debug19("lobe-market-sdk:user-favorite");
2825
3158
  var UserFavoriteService = class extends BaseSDK {
2826
3159
  /**
2827
3160
  * Add to favorites
@@ -2836,7 +3169,7 @@ var UserFavoriteService = class extends BaseSDK {
2836
3169
  * @throws Error if already in favorites
2837
3170
  */
2838
3171
  async addFavorite(targetType, targetId, options) {
2839
- log17("Adding favorite: %s %d", targetType, targetId);
3172
+ log19("Adding favorite: %s %d", targetType, targetId);
2840
3173
  const body = { targetId, targetType };
2841
3174
  const result = await this.request("/v1/user/favorites", {
2842
3175
  body: JSON.stringify(body),
@@ -2846,7 +3179,7 @@ var UserFavoriteService = class extends BaseSDK {
2846
3179
  method: "POST",
2847
3180
  ...options
2848
3181
  });
2849
- log17("Successfully added favorite: %s %d", targetType, targetId);
3182
+ log19("Successfully added favorite: %s %d", targetType, targetId);
2850
3183
  return result;
2851
3184
  }
2852
3185
  /**
@@ -2862,7 +3195,7 @@ var UserFavoriteService = class extends BaseSDK {
2862
3195
  * @throws Error if favorite not found
2863
3196
  */
2864
3197
  async removeFavorite(targetType, targetId, options) {
2865
- log17("Removing favorite: %s %d", targetType, targetId);
3198
+ log19("Removing favorite: %s %d", targetType, targetId);
2866
3199
  const body = { targetId, targetType };
2867
3200
  const result = await this.request("/v1/user/favorites", {
2868
3201
  body: JSON.stringify(body),
@@ -2872,7 +3205,7 @@ var UserFavoriteService = class extends BaseSDK {
2872
3205
  method: "DELETE",
2873
3206
  ...options
2874
3207
  });
2875
- log17("Successfully removed favorite: %s %d", targetType, targetId);
3208
+ log19("Successfully removed favorite: %s %d", targetType, targetId);
2876
3209
  return result;
2877
3210
  }
2878
3211
  /**
@@ -2887,7 +3220,7 @@ var UserFavoriteService = class extends BaseSDK {
2887
3220
  * @returns Promise resolving to favorite status
2888
3221
  */
2889
3222
  async checkFavorite(targetType, targetId, options) {
2890
- log17("Checking favorite status: %s %d", targetType, targetId);
3223
+ log19("Checking favorite status: %s %d", targetType, targetId);
2891
3224
  const queryString = this.buildQueryString({
2892
3225
  targetId: String(targetId),
2893
3226
  targetType
@@ -2896,7 +3229,7 @@ var UserFavoriteService = class extends BaseSDK {
2896
3229
  `/v1/user/favorites/check${queryString}`,
2897
3230
  options
2898
3231
  );
2899
- log17("Favorite status retrieved: %O", result);
3232
+ log19("Favorite status retrieved: %O", result);
2900
3233
  return result;
2901
3234
  }
2902
3235
  /**
@@ -2910,7 +3243,7 @@ var UserFavoriteService = class extends BaseSDK {
2910
3243
  * @returns Promise resolving to list of favorites
2911
3244
  */
2912
3245
  async getMyFavorites(params = {}, options) {
2913
- log17("Getting my favorites: %O", params);
3246
+ log19("Getting my favorites: %O", params);
2914
3247
  const queryParams = {};
2915
3248
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
2916
3249
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -2920,7 +3253,7 @@ var UserFavoriteService = class extends BaseSDK {
2920
3253
  `/v1/user/favorites/me${queryString}`,
2921
3254
  options
2922
3255
  );
2923
- log17("My favorites retrieved");
3256
+ log19("My favorites retrieved");
2924
3257
  return result;
2925
3258
  }
2926
3259
  /**
@@ -2935,7 +3268,7 @@ var UserFavoriteService = class extends BaseSDK {
2935
3268
  * @returns Promise resolving to list of favorites
2936
3269
  */
2937
3270
  async getUserFavorites(userId, params = {}, options) {
2938
- log17("Getting favorites for user: %d", userId);
3271
+ log19("Getting favorites for user: %d", userId);
2939
3272
  const queryParams = {};
2940
3273
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
2941
3274
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -2945,7 +3278,7 @@ var UserFavoriteService = class extends BaseSDK {
2945
3278
  `/v1/user/favorites/${userId}${queryString}`,
2946
3279
  options
2947
3280
  );
2948
- log17("Favorites retrieved for user: %d", userId);
3281
+ log19("Favorites retrieved for user: %d", userId);
2949
3282
  return result;
2950
3283
  }
2951
3284
  /**
@@ -2960,7 +3293,7 @@ var UserFavoriteService = class extends BaseSDK {
2960
3293
  * @returns Promise resolving to list of favorite agents
2961
3294
  */
2962
3295
  async getUserFavoriteAgents(userId, params = {}, options) {
2963
- log17("Getting favorite agents for user: %d", userId);
3296
+ log19("Getting favorite agents for user: %d", userId);
2964
3297
  const queryParams = {};
2965
3298
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
2966
3299
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -2969,7 +3302,7 @@ var UserFavoriteService = class extends BaseSDK {
2969
3302
  `/v1/user/favorites/${userId}/agents${queryString}`,
2970
3303
  options
2971
3304
  );
2972
- log17("Favorite agents retrieved for user: %d", userId);
3305
+ log19("Favorite agents retrieved for user: %d", userId);
2973
3306
  return result;
2974
3307
  }
2975
3308
  /**
@@ -2984,7 +3317,7 @@ var UserFavoriteService = class extends BaseSDK {
2984
3317
  * @returns Promise resolving to list of favorite plugins
2985
3318
  */
2986
3319
  async getUserFavoritePlugins(userId, params = {}, options) {
2987
- log17("Getting favorite plugins for user: %d", userId);
3320
+ log19("Getting favorite plugins for user: %d", userId);
2988
3321
  const queryParams = {};
2989
3322
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
2990
3323
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -2993,14 +3326,14 @@ var UserFavoriteService = class extends BaseSDK {
2993
3326
  `/v1/user/favorites/${userId}/plugins${queryString}`,
2994
3327
  options
2995
3328
  );
2996
- log17("Favorite plugins retrieved for user: %d", userId);
3329
+ log19("Favorite plugins retrieved for user: %d", userId);
2997
3330
  return result;
2998
3331
  }
2999
3332
  };
3000
3333
 
3001
3334
  // src/market/services/UserLikeService.ts
3002
- import debug18 from "debug";
3003
- var log18 = debug18("lobe-market-sdk:user-like");
3335
+ import debug20 from "debug";
3336
+ var log20 = debug20("lobe-market-sdk:user-like");
3004
3337
  var UserLikeService = class extends BaseSDK {
3005
3338
  /**
3006
3339
  * Like content
@@ -3015,7 +3348,7 @@ var UserLikeService = class extends BaseSDK {
3015
3348
  * @throws Error if already liked
3016
3349
  */
3017
3350
  async like(targetType, targetId, options) {
3018
- log18("Liking: %s %d", targetType, targetId);
3351
+ log20("Liking: %s %d", targetType, targetId);
3019
3352
  const body = { targetId, targetType };
3020
3353
  const result = await this.request("/v1/user/likes", {
3021
3354
  body: JSON.stringify(body),
@@ -3025,7 +3358,7 @@ var UserLikeService = class extends BaseSDK {
3025
3358
  method: "POST",
3026
3359
  ...options
3027
3360
  });
3028
- log18("Successfully liked: %s %d", targetType, targetId);
3361
+ log20("Successfully liked: %s %d", targetType, targetId);
3029
3362
  return result;
3030
3363
  }
3031
3364
  /**
@@ -3041,7 +3374,7 @@ var UserLikeService = class extends BaseSDK {
3041
3374
  * @throws Error if like not found
3042
3375
  */
3043
3376
  async unlike(targetType, targetId, options) {
3044
- log18("Unliking: %s %d", targetType, targetId);
3377
+ log20("Unliking: %s %d", targetType, targetId);
3045
3378
  const body = { targetId, targetType };
3046
3379
  const result = await this.request("/v1/user/likes", {
3047
3380
  body: JSON.stringify(body),
@@ -3051,7 +3384,7 @@ var UserLikeService = class extends BaseSDK {
3051
3384
  method: "DELETE",
3052
3385
  ...options
3053
3386
  });
3054
- log18("Successfully unliked: %s %d", targetType, targetId);
3387
+ log20("Successfully unliked: %s %d", targetType, targetId);
3055
3388
  return result;
3056
3389
  }
3057
3390
  /**
@@ -3066,7 +3399,7 @@ var UserLikeService = class extends BaseSDK {
3066
3399
  * @returns Promise resolving to toggle response with new like status
3067
3400
  */
3068
3401
  async toggleLike(targetType, targetId, options) {
3069
- log18("Toggling like: %s %d", targetType, targetId);
3402
+ log20("Toggling like: %s %d", targetType, targetId);
3070
3403
  const body = { targetId, targetType };
3071
3404
  const result = await this.request("/v1/user/likes/toggle", {
3072
3405
  body: JSON.stringify(body),
@@ -3076,7 +3409,7 @@ var UserLikeService = class extends BaseSDK {
3076
3409
  method: "POST",
3077
3410
  ...options
3078
3411
  });
3079
- log18("Like toggled, new status: %O", result);
3412
+ log20("Like toggled, new status: %O", result);
3080
3413
  return result;
3081
3414
  }
3082
3415
  /**
@@ -3091,7 +3424,7 @@ var UserLikeService = class extends BaseSDK {
3091
3424
  * @returns Promise resolving to like status
3092
3425
  */
3093
3426
  async checkLike(targetType, targetId, options) {
3094
- log18("Checking like status: %s %d", targetType, targetId);
3427
+ log20("Checking like status: %s %d", targetType, targetId);
3095
3428
  const queryString = this.buildQueryString({
3096
3429
  targetId: String(targetId),
3097
3430
  targetType
@@ -3100,7 +3433,7 @@ var UserLikeService = class extends BaseSDK {
3100
3433
  `/v1/user/likes/check${queryString}`,
3101
3434
  options
3102
3435
  );
3103
- log18("Like status retrieved: %O", result);
3436
+ log20("Like status retrieved: %O", result);
3104
3437
  return result;
3105
3438
  }
3106
3439
  /**
@@ -3114,7 +3447,7 @@ var UserLikeService = class extends BaseSDK {
3114
3447
  * @returns Promise resolving to list of likes
3115
3448
  */
3116
3449
  async getMyLikes(params = {}, options) {
3117
- log18("Getting my likes: %O", params);
3450
+ log20("Getting my likes: %O", params);
3118
3451
  const queryParams = {};
3119
3452
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
3120
3453
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -3124,7 +3457,7 @@ var UserLikeService = class extends BaseSDK {
3124
3457
  `/v1/user/likes/me${queryString}`,
3125
3458
  options
3126
3459
  );
3127
- log18("My likes retrieved");
3460
+ log20("My likes retrieved");
3128
3461
  return result;
3129
3462
  }
3130
3463
  /**
@@ -3139,7 +3472,7 @@ var UserLikeService = class extends BaseSDK {
3139
3472
  * @returns Promise resolving to list of likes
3140
3473
  */
3141
3474
  async getUserLikes(userId, params = {}, options) {
3142
- log18("Getting likes for user: %d", userId);
3475
+ log20("Getting likes for user: %d", userId);
3143
3476
  const queryParams = {};
3144
3477
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
3145
3478
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -3149,7 +3482,7 @@ var UserLikeService = class extends BaseSDK {
3149
3482
  `/v1/user/likes/${userId}${queryString}`,
3150
3483
  options
3151
3484
  );
3152
- log18("Likes retrieved for user: %d", userId);
3485
+ log20("Likes retrieved for user: %d", userId);
3153
3486
  return result;
3154
3487
  }
3155
3488
  /**
@@ -3164,7 +3497,7 @@ var UserLikeService = class extends BaseSDK {
3164
3497
  * @returns Promise resolving to list of liked agents
3165
3498
  */
3166
3499
  async getUserLikedAgents(userId, params = {}, options) {
3167
- log18("Getting liked agents for user: %d", userId);
3500
+ log20("Getting liked agents for user: %d", userId);
3168
3501
  const queryParams = {};
3169
3502
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
3170
3503
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -3173,7 +3506,7 @@ var UserLikeService = class extends BaseSDK {
3173
3506
  `/v1/user/likes/${userId}/agents${queryString}`,
3174
3507
  options
3175
3508
  );
3176
- log18("Liked agents retrieved for user: %d", userId);
3509
+ log20("Liked agents retrieved for user: %d", userId);
3177
3510
  return result;
3178
3511
  }
3179
3512
  /**
@@ -3188,7 +3521,7 @@ var UserLikeService = class extends BaseSDK {
3188
3521
  * @returns Promise resolving to list of liked plugins
3189
3522
  */
3190
3523
  async getUserLikedPlugins(userId, params = {}, options) {
3191
- log18("Getting liked plugins for user: %d", userId);
3524
+ log20("Getting liked plugins for user: %d", userId);
3192
3525
  const queryParams = {};
3193
3526
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
3194
3527
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -3197,13 +3530,13 @@ var UserLikeService = class extends BaseSDK {
3197
3530
  `/v1/user/likes/${userId}/plugins${queryString}`,
3198
3531
  options
3199
3532
  );
3200
- log18("Liked plugins retrieved for user: %d", userId);
3533
+ log20("Liked plugins retrieved for user: %d", userId);
3201
3534
  return result;
3202
3535
  }
3203
3536
  };
3204
3537
 
3205
3538
  // src/market/market-sdk.ts
3206
- var log19 = debug19("lobe-market-sdk");
3539
+ var log21 = debug21("lobe-market-sdk");
3207
3540
  var MarketSDK = class extends BaseSDK {
3208
3541
  /**
3209
3542
  * Creates a new MarketSDK instance
@@ -3216,15 +3549,17 @@ var MarketSDK = class extends BaseSDK {
3216
3549
  tokenExpiry: void 0
3217
3550
  };
3218
3551
  super(options, void 0, sharedTokenState);
3219
- log19("MarketSDK instance created");
3552
+ log21("MarketSDK instance created");
3220
3553
  this.agents = new AgentService2(options, this.headers, sharedTokenState);
3221
3554
  this.auth = new AuthService(options, this.headers, sharedTokenState);
3555
+ this.connect = new ConnectService(options, this.headers, sharedTokenState);
3222
3556
  this.plugins = new PluginsService(options, this.headers, sharedTokenState);
3223
3557
  this.user = new UserService(options, this.headers, sharedTokenState);
3224
3558
  this.follows = new UserFollowService(options, this.headers, sharedTokenState);
3225
3559
  this.favorites = new UserFavoriteService(options, this.headers, sharedTokenState);
3226
3560
  this.likes = new UserLikeService(options, this.headers, sharedTokenState);
3227
3561
  this.feedback = new FeedbackService(options, this.headers, sharedTokenState);
3562
+ this.skills = new SkillService(options, this.headers, sharedTokenState);
3228
3563
  this.discovery = new DiscoveryService(options, this.headers, sharedTokenState);
3229
3564
  }
3230
3565
  /**
@@ -3251,7 +3586,7 @@ var MarketSDK = class extends BaseSDK {
3251
3586
  * @deprecated Use auth.registerClient() instead
3252
3587
  */
3253
3588
  async registerClient(request) {
3254
- log19("Registering client (deprecated method, use auth.registerClient): %s", request.clientName);
3589
+ log21("Registering client (deprecated method, use auth.registerClient): %s", request.clientName);
3255
3590
  return this.auth.registerClient(request);
3256
3591
  }
3257
3592
  };