@lobehub/market-sdk 0.28.1 → 0.28.2-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
@@ -5,6 +5,51 @@ import debug9 from "debug";
5
5
  import debug from "debug";
6
6
  import { SignJWT } from "jose";
7
7
  import urlJoin from "url-join";
8
+
9
+ // src/core/MarketAPIError.ts
10
+ var MarketAPIError = class _MarketAPIError extends Error {
11
+ constructor(status, statusText, errorBody) {
12
+ var _a, _b;
13
+ const errorCode = (_a = errorBody == null ? void 0 : errorBody.error) == null ? void 0 : _a.code;
14
+ const errorMessage = (_b = errorBody == null ? void 0 : errorBody.error) == null ? void 0 : _b.message;
15
+ const message = errorMessage || statusText;
16
+ super(message);
17
+ this.name = "MarketAPIError";
18
+ this.status = status;
19
+ this.code = errorCode;
20
+ this.errorBody = errorBody;
21
+ if (Error.captureStackTrace) {
22
+ Error.captureStackTrace(this, _MarketAPIError);
23
+ }
24
+ }
25
+ /**
26
+ * Check if this is a specific error code
27
+ */
28
+ isErrorCode(code) {
29
+ return this.code === code;
30
+ }
31
+ /**
32
+ * Get the full error details from the API response
33
+ */
34
+ getErrorDetails() {
35
+ var _a;
36
+ return (_a = this.errorBody) == null ? void 0 : _a.error;
37
+ }
38
+ /**
39
+ * Convert to a plain object for logging or serialization
40
+ */
41
+ toJSON() {
42
+ return {
43
+ code: this.code,
44
+ errorBody: this.errorBody,
45
+ message: this.message,
46
+ name: this.name,
47
+ status: this.status
48
+ };
49
+ }
50
+ };
51
+
52
+ // src/core/BaseSDK.ts
8
53
  var log = debug("lobe-market-sdk:core");
9
54
  var BaseSDK = class {
10
55
  /**
@@ -78,14 +123,14 @@ var BaseSDK = class {
78
123
  headers: mergedHeaders
79
124
  });
80
125
  if (!response.ok) {
81
- const errorMsg = `Request failed: ${response.status} ${response.statusText}`;
126
+ let errorBody;
82
127
  try {
83
- const errorBody = await response.json();
128
+ errorBody = await response.json();
84
129
  console.error("Request error: %s", JSON.stringify(errorBody));
85
- throw new Error(`${errorMsg} - ${JSON.stringify(errorBody)}`);
86
130
  } catch (e) {
87
- throw new Error(errorMsg);
131
+ errorBody = void 0;
88
132
  }
133
+ throw new MarketAPIError(response.status, response.statusText, errorBody);
89
134
  }
90
135
  log("Request successful: %s", url);
91
136
  if (response.status === 204) {
@@ -1561,7 +1606,7 @@ var MarketAdmin = class extends BaseSDK {
1561
1606
  };
1562
1607
 
1563
1608
  // src/market/market-sdk.ts
1564
- import debug21 from "debug";
1609
+ import debug22 from "debug";
1565
1610
 
1566
1611
  // src/market/services/AgentService.ts
1567
1612
  import debug10 from "debug";
@@ -1917,10 +1962,256 @@ var AgentService2 = class extends BaseSDK {
1917
1962
  }
1918
1963
  };
1919
1964
 
1920
- // src/market/services/AuthService.ts
1965
+ // src/market/services/AgentGroupService.ts
1921
1966
  import debug11 from "debug";
1967
+ var log11 = debug11("lobe-market-sdk:agent-groups");
1968
+ var AgentGroupService = class extends BaseSDK {
1969
+ /**
1970
+ * Retrieves a list of agent groups from the marketplace
1971
+ *
1972
+ * Supports filtering, pagination, and localization of results.
1973
+ *
1974
+ * @param params - Query parameters for filtering and pagination
1975
+ * @param options - Optional request options
1976
+ * @returns Promise resolving to the agent group list response containing items and pagination info
1977
+ */
1978
+ async getAgentGroupList(params = {}, options) {
1979
+ const locale = params.locale || this.defaultLocale;
1980
+ const queryParams = { ...params, locale };
1981
+ const queryString = this.buildQueryString(queryParams);
1982
+ log11("Getting agent group list: %O", queryParams);
1983
+ const result = await this.request(
1984
+ `/v1/agent-groups${queryString}`,
1985
+ options
1986
+ );
1987
+ log11("Retrieved %d agent groups", result.items.length);
1988
+ return result;
1989
+ }
1990
+ /**
1991
+ * Retrieves a list of agent groups owned by the authenticated user
1992
+ *
1993
+ * Returns all agent groups regardless of their publish status (published, unpublished,
1994
+ * archived, deprecated). Requires authentication.
1995
+ *
1996
+ * @param params - Query parameters for filtering and pagination
1997
+ * @param options - Optional request options (must include authentication)
1998
+ * @returns Promise resolving to the agent group list response containing items with status field
1999
+ */
2000
+ async getOwnAgentGroups(params = {}, options) {
2001
+ const locale = params.locale || this.defaultLocale;
2002
+ const queryParams = { ...params, locale };
2003
+ const queryString = this.buildQueryString(queryParams);
2004
+ log11("Getting own agent group list: %O", queryParams);
2005
+ const result = await this.request(
2006
+ `/v1/agent-groups/own${queryString}`,
2007
+ options
2008
+ );
2009
+ log11("Retrieved %d own agent groups", result.items.length);
2010
+ return result;
2011
+ }
2012
+ /**
2013
+ * Retrieves detailed information about a specific agent group
2014
+ *
2015
+ * Returns complete agent group information including group metadata,
2016
+ * all member agents, and localized content.
2017
+ *
2018
+ * @param identifier - Unique identifier of the agent group
2019
+ * @param params - Query parameters for locale and version
2020
+ * @param options - Optional request options
2021
+ * @returns Promise resolving to the agent group detail information
2022
+ */
2023
+ async getAgentGroupDetail(identifier, params = {}, options) {
2024
+ const locale = params.locale || this.defaultLocale;
2025
+ const queryParams = { identifier, locale };
2026
+ if (params.version !== void 0) {
2027
+ queryParams.version = params.version.toString();
2028
+ }
2029
+ const queryString = this.buildQueryString(queryParams);
2030
+ log11("Getting agent group detail: %O", { identifier, ...params });
2031
+ const result = await this.request(
2032
+ `/v1/agent-groups/detail${queryString}`,
2033
+ options
2034
+ );
2035
+ log11("Agent group detail successfully retrieved: %s", identifier);
2036
+ return result;
2037
+ }
2038
+ /**
2039
+ * Creates a new agent group in the marketplace
2040
+ *
2041
+ * Creates a new agent group with initial version (v1) and all member agents.
2042
+ * Requires authentication and ownership.
2043
+ *
2044
+ * @param groupData - The agent group data to create
2045
+ * @param options - Optional request options
2046
+ * @returns Promise resolving to the created agent group response
2047
+ */
2048
+ async createAgentGroup(groupData, options) {
2049
+ log11("Creating agent group: %s", groupData.identifier);
2050
+ const result = await this.request("/v1/agent-groups/create", {
2051
+ body: JSON.stringify(groupData),
2052
+ headers: {
2053
+ "Content-Type": "application/json"
2054
+ },
2055
+ method: "POST",
2056
+ ...options
2057
+ });
2058
+ log11("Agent group created successfully: %O", result);
2059
+ return result;
2060
+ }
2061
+ /**
2062
+ * Creates a new version for an existing agent group
2063
+ *
2064
+ * Creates a new version with unified version number for the group and all member agents.
2065
+ * Fields not provided will be inherited from the latest version.
2066
+ *
2067
+ * @param versionData - The version data to create
2068
+ * @param options - Optional request options
2069
+ * @returns Promise resolving to the created version response
2070
+ */
2071
+ async createAgentGroupVersion(versionData, options) {
2072
+ log11("Creating agent group version: %s", versionData.identifier);
2073
+ const result = await this.request(
2074
+ "/v1/agent-groups/version-create",
2075
+ {
2076
+ body: JSON.stringify(versionData),
2077
+ headers: {
2078
+ "Content-Type": "application/json"
2079
+ },
2080
+ method: "POST",
2081
+ ...options
2082
+ }
2083
+ );
2084
+ log11("Agent group version created successfully: %O", result);
2085
+ return result;
2086
+ }
2087
+ /**
2088
+ * Modifies an existing agent group
2089
+ *
2090
+ * Updates the agent group's base information. Can be used to change status,
2091
+ * metadata, or other group properties. Only the owner can modify the group.
2092
+ *
2093
+ * @param groupData - The agent group data to modify
2094
+ * @param options - Optional request options
2095
+ * @returns Promise resolving to the modified agent group response
2096
+ */
2097
+ async modifyAgentGroup(groupData, options) {
2098
+ log11("Modifying agent group: %s", groupData.identifier);
2099
+ const result = await this.request("/v1/agent-groups/modify", {
2100
+ body: JSON.stringify(groupData),
2101
+ headers: {
2102
+ "Content-Type": "application/json"
2103
+ },
2104
+ method: "POST",
2105
+ ...options
2106
+ });
2107
+ log11("Agent group modified successfully: %O", result);
2108
+ return result;
2109
+ }
2110
+ /**
2111
+ * Checks if an agent group exists in the marketplace
2112
+ *
2113
+ * @param identifier - Unique identifier of the agent group
2114
+ * @param options - Optional request options
2115
+ * @returns Promise resolving to true if agent group exists, false otherwise
2116
+ */
2117
+ async checkAgentGroupExists(identifier, options) {
2118
+ log11("Checking if agent group exists: %s", identifier);
2119
+ try {
2120
+ await this.getAgentGroupDetail(identifier, {}, options);
2121
+ log11("Agent group exists: %s", identifier);
2122
+ return true;
2123
+ } catch (e) {
2124
+ log11("Agent group does not exist: %s", identifier);
2125
+ return false;
2126
+ }
2127
+ }
2128
+ /**
2129
+ * Changes the status of an agent group
2130
+ *
2131
+ * Internal helper method used by publish/unpublish/archive/deprecate methods.
2132
+ * Requires authentication.
2133
+ *
2134
+ * @param identifier - Unique identifier of the agent group
2135
+ * @param status - New status to set
2136
+ * @param options - Optional request options
2137
+ * @returns Promise resolving to the status change response
2138
+ */
2139
+ async changeStatus(identifier, status, options) {
2140
+ log11("Changing agent group status: %s -> %s", identifier, status);
2141
+ const result = await this.modifyAgentGroup({ identifier, status }, options);
2142
+ log11("Agent group status changed: %s -> %s", identifier, result.status);
2143
+ return {
2144
+ identifier: result.identifier,
2145
+ status: result.status,
2146
+ success: true
2147
+ };
2148
+ }
2149
+ /**
2150
+ * Publishes an agent group to the marketplace
2151
+ *
2152
+ * Makes the agent group publicly visible and available for use.
2153
+ * Requires authentication and ownership of the agent group.
2154
+ * Only groups with "Safe" safety check status can be published.
2155
+ *
2156
+ * @param identifier - Unique identifier of the agent group
2157
+ * @param options - Optional request options
2158
+ * @returns Promise resolving to the status change response
2159
+ */
2160
+ async publish(identifier, options) {
2161
+ log11("Publishing agent group: %s", identifier);
2162
+ return this.changeStatus(identifier, "published", options);
2163
+ }
2164
+ /**
2165
+ * Unpublishes an agent group from the marketplace
2166
+ *
2167
+ * Hides the agent group from public view. The agent group data is preserved
2168
+ * and can be republished later.
2169
+ * Requires authentication and ownership of the agent group.
2170
+ *
2171
+ * @param identifier - Unique identifier of the agent group
2172
+ * @param options - Optional request options
2173
+ * @returns Promise resolving to the status change response
2174
+ */
2175
+ async unpublish(identifier, options) {
2176
+ log11("Unpublishing agent group: %s", identifier);
2177
+ return this.changeStatus(identifier, "unpublished", options);
2178
+ }
2179
+ /**
2180
+ * Archives an agent group
2181
+ *
2182
+ * Marks the agent group as archived. Archived agent groups are typically
2183
+ * no longer actively maintained but may still be accessible.
2184
+ * Requires authentication and ownership of the agent group.
2185
+ *
2186
+ * @param identifier - Unique identifier of the agent group
2187
+ * @param options - Optional request options
2188
+ * @returns Promise resolving to the status change response
2189
+ */
2190
+ async archive(identifier, options) {
2191
+ log11("Archiving agent group: %s", identifier);
2192
+ return this.changeStatus(identifier, "archived", options);
2193
+ }
2194
+ /**
2195
+ * Deprecates an agent group
2196
+ *
2197
+ * Marks the agent group as deprecated. Deprecated agent groups are still
2198
+ * accessible but users are encouraged to migrate to alternatives.
2199
+ * Requires authentication and ownership of the agent group.
2200
+ *
2201
+ * @param identifier - Unique identifier of the agent group
2202
+ * @param options - Optional request options
2203
+ * @returns Promise resolving to the status change response
2204
+ */
2205
+ async deprecate(identifier, options) {
2206
+ log11("Deprecating agent group: %s", identifier);
2207
+ return this.changeStatus(identifier, "deprecated", options);
2208
+ }
2209
+ };
2210
+
2211
+ // src/market/services/AuthService.ts
2212
+ import debug12 from "debug";
1922
2213
  import urlJoin2 from "url-join";
1923
- var log11 = debug11("lobe-market-sdk:auth");
2214
+ var log12 = debug12("lobe-market-sdk:auth");
1924
2215
  var _AuthService = class _AuthService extends BaseSDK {
1925
2216
  /** Normalize token response from snake_case to camelCase fields */
1926
2217
  static normalizeTokenResponse(data) {
@@ -1952,7 +2243,7 @@ var _AuthService = class _AuthService extends BaseSDK {
1952
2243
  if (grantType !== "authorization_code" && grantType !== "refresh_token") {
1953
2244
  throw new Error(`Unsupported grant type: ${grantType}`);
1954
2245
  }
1955
- log11("Exchanging OAuth token using grant_type=%s", grantType);
2246
+ log12("Exchanging OAuth token using grant_type=%s", grantType);
1956
2247
  const tokenUrl = urlJoin2(this.baseUrl, "lobehub-oidc/token");
1957
2248
  const params = new URLSearchParams();
1958
2249
  params.set("grant_type", grantType);
@@ -1994,16 +2285,16 @@ var _AuthService = class _AuthService extends BaseSDK {
1994
2285
  try {
1995
2286
  payload = await response.json();
1996
2287
  } catch (error) {
1997
- log11("Failed to parse token response: %O", error);
2288
+ log12("Failed to parse token response: %O", error);
1998
2289
  throw new Error(`Failed to parse token response: ${response.status} ${response.statusText}`);
1999
2290
  }
2000
2291
  if (!response.ok) {
2001
2292
  const errorDescription = (payload == null ? void 0 : payload.error_description) || (payload == null ? void 0 : payload.error) || response.statusText;
2002
2293
  const errorMsg = `Token exchange failed: ${response.status} ${errorDescription}`;
2003
- log11("Error: %s", errorMsg);
2294
+ log12("Error: %s", errorMsg);
2004
2295
  throw new Error(errorMsg);
2005
2296
  }
2006
- log11("Token exchange successful");
2297
+ log12("Token exchange successful");
2007
2298
  return _AuthService.normalizeTokenResponse(payload);
2008
2299
  }
2009
2300
  /**
@@ -2016,7 +2307,7 @@ var _AuthService = class _AuthService extends BaseSDK {
2016
2307
  * @returns Promise resolving to the user information
2017
2308
  */
2018
2309
  async getUserInfo(accessToken, options) {
2019
- log11("Getting user info");
2310
+ log12("Getting user info");
2020
2311
  const userInfoUrl = urlJoin2(this.baseUrl, "lobehub-oidc/userinfo");
2021
2312
  const response = await fetch(userInfoUrl, {
2022
2313
  headers: {
@@ -2028,11 +2319,11 @@ var _AuthService = class _AuthService extends BaseSDK {
2028
2319
  });
2029
2320
  if (!response.ok) {
2030
2321
  const errorMsg = `Failed to fetch user info: ${response.status} ${response.statusText}`;
2031
- log11("Error: %s", errorMsg);
2322
+ log12("Error: %s", errorMsg);
2032
2323
  throw new Error(errorMsg);
2033
2324
  }
2034
2325
  const userInfo = await response.json();
2035
- log11("User info retrieved successfully");
2326
+ log12("User info retrieved successfully");
2036
2327
  return userInfo;
2037
2328
  }
2038
2329
  /**
@@ -2046,7 +2337,7 @@ var _AuthService = class _AuthService extends BaseSDK {
2046
2337
  * @returns Promise resolving to the client credentials
2047
2338
  */
2048
2339
  async registerClient(clientData, options) {
2049
- log11("Registering client: %s (%s)", clientData.clientName, clientData.clientType);
2340
+ log12("Registering client: %s (%s)", clientData.clientName, clientData.clientType);
2050
2341
  const result = await this.request("/v1/clients/register", {
2051
2342
  body: JSON.stringify(clientData),
2052
2343
  headers: {
@@ -2055,7 +2346,7 @@ var _AuthService = class _AuthService extends BaseSDK {
2055
2346
  method: "POST",
2056
2347
  ...options
2057
2348
  });
2058
- log11("Client registered successfully: %s", result.client_id);
2349
+ log12("Client registered successfully: %s", result.client_id);
2059
2350
  return result;
2060
2351
  }
2061
2352
  /**
@@ -2067,9 +2358,9 @@ var _AuthService = class _AuthService extends BaseSDK {
2067
2358
  * @returns Promise resolving to the access token and expiration time
2068
2359
  */
2069
2360
  async getM2MToken() {
2070
- log11("Fetching M2M token");
2361
+ log12("Fetching M2M token");
2071
2362
  const tokenInfo = await this.fetchM2MToken();
2072
- log11("M2M token fetched successfully");
2363
+ log12("M2M token fetched successfully");
2073
2364
  return tokenInfo;
2074
2365
  }
2075
2366
  /** OAuth handoff response shapes */
@@ -2095,7 +2386,7 @@ var _AuthService = class _AuthService extends BaseSDK {
2095
2386
  async getOAuthHandoff(id, options) {
2096
2387
  var _a, _b;
2097
2388
  if (!id) throw new Error("id is required");
2098
- log11("Getting OAuth handoff: %s", id);
2389
+ log12("Getting OAuth handoff: %s", id);
2099
2390
  const handoffUrl = `${urlJoin2(this.baseUrl, "lobehub-oidc/handoff")}?id=${encodeURIComponent(id)}`;
2100
2391
  const response = await fetch(handoffUrl, {
2101
2392
  headers: {
@@ -2111,19 +2402,19 @@ var _AuthService = class _AuthService extends BaseSDK {
2111
2402
  code: json.code,
2112
2403
  redirectUri: json.redirectUri
2113
2404
  });
2114
- log11("OAuth handoff success for id: %s", id);
2405
+ log12("OAuth handoff success for id: %s", id);
2115
2406
  return result;
2116
2407
  }
2117
2408
  if (response.status === 202) {
2118
- log11("OAuth handoff pending for id: %s", id);
2409
+ log12("OAuth handoff pending for id: %s", id);
2119
2410
  return { status: _AuthService.HANDOFF_PENDING_STATUS };
2120
2411
  }
2121
2412
  if (response.status === 404) {
2122
- log11("OAuth handoff consumed for id: %s", id);
2413
+ log12("OAuth handoff consumed for id: %s", id);
2123
2414
  return { status: _AuthService.HANDOFF_CONSUMED_STATUS };
2124
2415
  }
2125
2416
  if (response.status === 410) {
2126
- log11("OAuth handoff expired for id: %s", id);
2417
+ log12("OAuth handoff expired for id: %s", id);
2127
2418
  return { status: _AuthService.HANDOFF_EXPIRED_STATUS };
2128
2419
  }
2129
2420
  let errorMessage = `Failed to fetch OAuth handoff (status ${response.status} ${response.statusText})`;
@@ -2134,7 +2425,7 @@ var _AuthService = class _AuthService extends BaseSDK {
2134
2425
  }
2135
2426
  } catch (e) {
2136
2427
  }
2137
- log11("Error: %s", errorMessage);
2428
+ log12("Error: %s", errorMessage);
2138
2429
  throw new Error(errorMessage);
2139
2430
  }
2140
2431
  /**
@@ -2148,21 +2439,21 @@ var _AuthService = class _AuthService extends BaseSDK {
2148
2439
  const timeoutMs = (_b = params.timeoutMs) != null ? _b : 6e4;
2149
2440
  const startedAt = Date.now();
2150
2441
  const { signal, requestInit } = params;
2151
- log11("Start polling OAuth handoff: %s", id);
2442
+ log12("Start polling OAuth handoff: %s", id);
2152
2443
  while (true) {
2153
2444
  if (signal == null ? void 0 : signal.aborted) {
2154
2445
  const err = new Error("Polling aborted");
2155
- log11("Error: %s", err.message);
2446
+ log12("Error: %s", err.message);
2156
2447
  throw err;
2157
2448
  }
2158
2449
  if (Date.now() - startedAt > timeoutMs) {
2159
2450
  const err = new Error("Polling timeout");
2160
- log11("Error: %s", err.message);
2451
+ log12("Error: %s", err.message);
2161
2452
  throw err;
2162
2453
  }
2163
2454
  const result = await this.getOAuthHandoff(id, requestInit);
2164
2455
  if (result.status === "success" || result.status === "expired" || result.status === "consumed") {
2165
- log11("Stop polling OAuth handoff (terminal): %s -> %s", id, result.status);
2456
+ log12("Stop polling OAuth handoff (terminal): %s -> %s", id, result.status);
2166
2457
  return result;
2167
2458
  }
2168
2459
  await new Promise((resolve) => {
@@ -2183,9 +2474,9 @@ _AuthService.HANDOFF_EXPIRED_STATUS = "expired";
2183
2474
  var AuthService = _AuthService;
2184
2475
 
2185
2476
  // src/market/services/ConnectService.ts
2186
- import debug12 from "debug";
2477
+ import debug13 from "debug";
2187
2478
  import urlJoin3 from "url-join";
2188
- var log12 = debug12("lobe-market-sdk:connect");
2479
+ var log13 = debug13("lobe-market-sdk:connect");
2189
2480
  var ConnectService = class extends BaseSDK {
2190
2481
  /**
2191
2482
  * Lists all available OAuth providers
@@ -2198,9 +2489,9 @@ var ConnectService = class extends BaseSDK {
2198
2489
  */
2199
2490
  async listProviders(options) {
2200
2491
  var _a;
2201
- log12("Listing connect providers");
2492
+ log13("Listing connect providers");
2202
2493
  const result = await this.request("/connect/providers", options);
2203
- log12("Found %d connect providers", ((_a = result.providers) == null ? void 0 : _a.length) || 0);
2494
+ log13("Found %d connect providers", ((_a = result.providers) == null ? void 0 : _a.length) || 0);
2204
2495
  return result;
2205
2496
  }
2206
2497
  /**
@@ -2214,12 +2505,12 @@ var ConnectService = class extends BaseSDK {
2214
2505
  */
2215
2506
  async getProvider(provider, options) {
2216
2507
  var _a;
2217
- log12("Getting provider details: %s", provider);
2508
+ log13("Getting provider details: %s", provider);
2218
2509
  const result = await this.request(
2219
2510
  `/connect/providers/${encodeURIComponent(provider)}`,
2220
2511
  options
2221
2512
  );
2222
- log12("Retrieved provider: %s", (_a = result.provider) == null ? void 0 : _a.name);
2513
+ log13("Retrieved provider: %s", (_a = result.provider) == null ? void 0 : _a.name);
2223
2514
  return result;
2224
2515
  }
2225
2516
  /**
@@ -2259,7 +2550,7 @@ var ConnectService = class extends BaseSDK {
2259
2550
  * ```
2260
2551
  */
2261
2552
  async authorize(provider, params, options) {
2262
- log12("Requesting authorization code for provider: %s", provider);
2553
+ log13("Requesting authorization code for provider: %s", provider);
2263
2554
  const result = await this.request(
2264
2555
  `/connect/${encodeURIComponent(provider)}/authorize`,
2265
2556
  {
@@ -2271,7 +2562,7 @@ var ConnectService = class extends BaseSDK {
2271
2562
  ...options
2272
2563
  }
2273
2564
  );
2274
- log12("Authorization code obtained, expires in %d seconds", result.expires_in);
2565
+ log13("Authorization code obtained, expires in %d seconds", result.expires_in);
2275
2566
  return result;
2276
2567
  }
2277
2568
  /**
@@ -2297,7 +2588,7 @@ var ConnectService = class extends BaseSDK {
2297
2588
  * ```
2298
2589
  */
2299
2590
  getAuthorizeUrl(provider, params) {
2300
- log12(
2591
+ log13(
2301
2592
  "Generating authorize URL for provider: %s (deprecated, use authorize() instead)",
2302
2593
  provider
2303
2594
  );
@@ -2311,7 +2602,7 @@ var ConnectService = class extends BaseSDK {
2311
2602
  const queryString = queryParams.toString();
2312
2603
  const path = `/connect/${encodeURIComponent(provider)}/start${queryString ? `?${queryString}` : ""}`;
2313
2604
  const url = urlJoin3(this.baseUrl, "api", path);
2314
- log12("Generated authorize URL: %s", url);
2605
+ log13("Generated authorize URL: %s", url);
2315
2606
  return url;
2316
2607
  }
2317
2608
  /**
@@ -2325,12 +2616,12 @@ var ConnectService = class extends BaseSDK {
2325
2616
  * @returns Promise resolving to the connection status
2326
2617
  */
2327
2618
  async getStatus(provider, options) {
2328
- log12("Getting connection status for provider: %s", provider);
2619
+ log13("Getting connection status for provider: %s", provider);
2329
2620
  const result = await this.request(
2330
2621
  `/connect/${encodeURIComponent(provider)}/status`,
2331
2622
  options
2332
2623
  );
2333
- log12("Provider %s connection status: connected=%s", provider, result.connected);
2624
+ log13("Provider %s connection status: connected=%s", provider, result.connected);
2334
2625
  return result;
2335
2626
  }
2336
2627
  /**
@@ -2343,9 +2634,9 @@ var ConnectService = class extends BaseSDK {
2343
2634
  */
2344
2635
  async listConnections(options) {
2345
2636
  var _a;
2346
- log12("Listing user connections");
2637
+ log13("Listing user connections");
2347
2638
  const result = await this.request("/connect/connections", options);
2348
- log12("Found %d connections", ((_a = result.connections) == null ? void 0 : _a.length) || 0);
2639
+ log13("Found %d connections", ((_a = result.connections) == null ? void 0 : _a.length) || 0);
2349
2640
  return result;
2350
2641
  }
2351
2642
  /**
@@ -2359,12 +2650,12 @@ var ConnectService = class extends BaseSDK {
2359
2650
  * @returns Promise resolving to the connection health status
2360
2651
  */
2361
2652
  async getHealth(provider, options) {
2362
- log12("Checking health for provider: %s", provider);
2653
+ log13("Checking health for provider: %s", provider);
2363
2654
  const result = await this.request(
2364
2655
  `/connect/${encodeURIComponent(provider)}/health`,
2365
2656
  options
2366
2657
  );
2367
- log12("Provider %s health: healthy=%s, status=%s", provider, result.healthy, result.tokenStatus);
2658
+ log13("Provider %s health: healthy=%s, status=%s", provider, result.healthy, result.tokenStatus);
2368
2659
  return result;
2369
2660
  }
2370
2661
  /**
@@ -2377,9 +2668,9 @@ var ConnectService = class extends BaseSDK {
2377
2668
  */
2378
2669
  async getAllHealth(options) {
2379
2670
  var _a, _b, _c;
2380
- log12("Checking health for all connections");
2671
+ log13("Checking health for all connections");
2381
2672
  const result = await this.request("/connect/health", options);
2382
- log12(
2673
+ log13(
2383
2674
  "Health check complete: total=%d, healthy=%d, unhealthy=%d",
2384
2675
  ((_a = result.summary) == null ? void 0 : _a.total) || 0,
2385
2676
  ((_b = result.summary) == null ? void 0 : _b.healthy) || 0,
@@ -2398,7 +2689,7 @@ var ConnectService = class extends BaseSDK {
2398
2689
  * @returns Promise resolving to the refresh result
2399
2690
  */
2400
2691
  async refresh(provider, options) {
2401
- log12("Refreshing token for provider: %s", provider);
2692
+ log13("Refreshing token for provider: %s", provider);
2402
2693
  const result = await this.request(
2403
2694
  `/connect/${encodeURIComponent(provider)}/refresh`,
2404
2695
  {
@@ -2406,7 +2697,7 @@ var ConnectService = class extends BaseSDK {
2406
2697
  ...options
2407
2698
  }
2408
2699
  );
2409
- log12("Token refresh for %s: refreshed=%s", provider, result.refreshed);
2700
+ log13("Token refresh for %s: refreshed=%s", provider, result.refreshed);
2410
2701
  return result;
2411
2702
  }
2412
2703
  /**
@@ -2420,7 +2711,7 @@ var ConnectService = class extends BaseSDK {
2420
2711
  * @returns Promise resolving to the revoke result
2421
2712
  */
2422
2713
  async revoke(provider, options) {
2423
- log12("Revoking connection for provider: %s", provider);
2714
+ log13("Revoking connection for provider: %s", provider);
2424
2715
  const result = await this.request(
2425
2716
  `/connect/${encodeURIComponent(provider)}`,
2426
2717
  {
@@ -2428,15 +2719,15 @@ var ConnectService = class extends BaseSDK {
2428
2719
  ...options
2429
2720
  }
2430
2721
  );
2431
- log12("Connection revoked for %s: success=%s", provider, result.success);
2722
+ log13("Connection revoked for %s: success=%s", provider, result.success);
2432
2723
  return result;
2433
2724
  }
2434
2725
  };
2435
2726
 
2436
2727
  // src/market/services/DiscoveryService.ts
2437
- import debug13 from "debug";
2728
+ import debug14 from "debug";
2438
2729
  import urlJoin4 from "url-join";
2439
- var log13 = debug13("lobe-market-sdk:discovery");
2730
+ var log14 = debug14("lobe-market-sdk:discovery");
2440
2731
  var DiscoveryService = class extends BaseSDK {
2441
2732
  /**
2442
2733
  * Retrieves the service discovery document
@@ -2448,9 +2739,9 @@ var DiscoveryService = class extends BaseSDK {
2448
2739
  * @returns Promise resolving to the service discovery document
2449
2740
  */
2450
2741
  async getDiscoveryDocument() {
2451
- log13("Fetching discovery document");
2742
+ log14("Fetching discovery document");
2452
2743
  if (this.discoveryDoc) {
2453
- log13("Returning cached discovery document");
2744
+ log14("Returning cached discovery document");
2454
2745
  return this.discoveryDoc;
2455
2746
  }
2456
2747
  const res = await fetch(urlJoin4(this.baseUrl, "/.well-known/discovery"));
@@ -2458,14 +2749,14 @@ var DiscoveryService = class extends BaseSDK {
2458
2749
  throw new Error(await res.text());
2459
2750
  }
2460
2751
  this.discoveryDoc = await res.json();
2461
- log13("Discovery document successfully fetched");
2752
+ log14("Discovery document successfully fetched");
2462
2753
  return this.discoveryDoc;
2463
2754
  }
2464
2755
  };
2465
2756
 
2466
2757
  // src/market/services/FeedbackService.ts
2467
- import debug14 from "debug";
2468
- var log14 = debug14("lobe-market-sdk:feedback");
2758
+ import debug15 from "debug";
2759
+ var log15 = debug15("lobe-market-sdk:feedback");
2469
2760
  var FeedbackService = class extends BaseSDK {
2470
2761
  /**
2471
2762
  * Submits user feedback
@@ -2495,7 +2786,7 @@ var FeedbackService = class extends BaseSDK {
2495
2786
  * ```
2496
2787
  */
2497
2788
  async submitFeedback(data, options) {
2498
- log14("Submitting feedback: %s", data.title);
2789
+ log15("Submitting feedback: %s", data.title);
2499
2790
  const result = await this.request("/v1/user/feedback", {
2500
2791
  body: JSON.stringify(data),
2501
2792
  headers: {
@@ -2504,14 +2795,14 @@ var FeedbackService = class extends BaseSDK {
2504
2795
  method: "POST",
2505
2796
  ...options
2506
2797
  });
2507
- log14("Feedback submitted successfully: %s", result.issueId);
2798
+ log15("Feedback submitted successfully: %s", result.issueId);
2508
2799
  return result;
2509
2800
  }
2510
2801
  };
2511
2802
 
2512
2803
  // src/market/services/PluginsService.ts
2513
- import debug15 from "debug";
2514
- var log15 = debug15("lobe-market-sdk:plugins");
2804
+ import debug16 from "debug";
2805
+ var log16 = debug16("lobe-market-sdk:plugins");
2515
2806
  var PluginsService = class extends BaseSDK {
2516
2807
  /**
2517
2808
  * Retrieves a list of plugins from the marketplace
@@ -2526,9 +2817,9 @@ var PluginsService = class extends BaseSDK {
2526
2817
  const locale = params.locale || this.defaultLocale;
2527
2818
  const queryParams = { ...params, locale };
2528
2819
  const queryString = this.buildQueryString(queryParams);
2529
- log15("Getting plugin list: %O", queryParams);
2820
+ log16("Getting plugin list: %O", queryParams);
2530
2821
  const result = await this.request(`/v1/plugins${queryString}`, options);
2531
- log15("Retrieved %d plugins", result.items.length);
2822
+ log16("Retrieved %d plugins", result.items.length);
2532
2823
  return result;
2533
2824
  }
2534
2825
  /**
@@ -2546,12 +2837,12 @@ var PluginsService = class extends BaseSDK {
2546
2837
  const locale = params.locale || this.defaultLocale;
2547
2838
  const queryParams = { ...params, locale };
2548
2839
  const queryString = this.buildQueryString(queryParams);
2549
- log15("Getting plugin categories: %O", queryParams);
2840
+ log16("Getting plugin categories: %O", queryParams);
2550
2841
  const result = await this.request(
2551
2842
  `/v1/plugins/categories${queryString}`,
2552
2843
  options
2553
2844
  );
2554
- log15("Retrieved %d categories", result.length);
2845
+ log16("Retrieved %d categories", result.length);
2555
2846
  return result;
2556
2847
  }
2557
2848
  /**
@@ -2564,12 +2855,12 @@ var PluginsService = class extends BaseSDK {
2564
2855
  * @returns Promise resolving to an array containing identifiers array and last modified time
2565
2856
  */
2566
2857
  async getPublishedIdentifiers(options) {
2567
- log15("Getting published plugin identifiers");
2858
+ log16("Getting published plugin identifiers");
2568
2859
  const result = await this.request(
2569
2860
  "/v1/plugins/identifiers",
2570
2861
  options
2571
2862
  );
2572
- log15("Retrieved %d published plugin identifiers", result.length);
2863
+ log16("Retrieved %d published plugin identifiers", result.length);
2573
2864
  return result;
2574
2865
  }
2575
2866
  /**
@@ -2589,7 +2880,7 @@ var PluginsService = class extends BaseSDK {
2589
2880
  version,
2590
2881
  identifier
2591
2882
  }, options) {
2592
- log15("Getting plugin manifest: %O", { identifier, locale, version });
2883
+ log16("Getting plugin manifest: %O", { identifier, locale, version });
2593
2884
  const localeParam = locale || this.defaultLocale;
2594
2885
  const params = { locale: localeParam };
2595
2886
  if (version) {
@@ -2600,7 +2891,7 @@ var PluginsService = class extends BaseSDK {
2600
2891
  `/v1/plugins/${identifier}/manifest${queryString}`,
2601
2892
  options
2602
2893
  );
2603
- log15("Plugin manifest successfully retrieved: %s", identifier);
2894
+ log16("Plugin manifest successfully retrieved: %s", identifier);
2604
2895
  return manifest;
2605
2896
  }
2606
2897
  /**
@@ -2617,7 +2908,7 @@ var PluginsService = class extends BaseSDK {
2617
2908
  version,
2618
2909
  identifier
2619
2910
  }, options) {
2620
- log15("Getting plugin detail: %O", { identifier, locale, version });
2911
+ log16("Getting plugin detail: %O", { identifier, locale, version });
2621
2912
  const localeParam = locale || this.defaultLocale;
2622
2913
  const params = { locale: localeParam };
2623
2914
  if (version) {
@@ -2628,7 +2919,7 @@ var PluginsService = class extends BaseSDK {
2628
2919
  `/v1/plugins/${identifier}${queryString}`,
2629
2920
  options
2630
2921
  );
2631
- log15("Plugin manifest successfully retrieved: %s", identifier);
2922
+ log16("Plugin manifest successfully retrieved: %s", identifier);
2632
2923
  return manifest;
2633
2924
  }
2634
2925
  /**
@@ -2643,7 +2934,7 @@ var PluginsService = class extends BaseSDK {
2643
2934
  *
2644
2935
  */
2645
2936
  async reportInstallation(reportData) {
2646
- log15("Reporting installation for %s@%s", reportData.identifier, reportData.version);
2937
+ log16("Reporting installation for %s@%s", reportData.identifier, reportData.version);
2647
2938
  const result = await this.request("/v1/plugins/report/installation", {
2648
2939
  body: JSON.stringify(reportData),
2649
2940
  headers: {
@@ -2651,7 +2942,7 @@ var PluginsService = class extends BaseSDK {
2651
2942
  },
2652
2943
  method: "POST"
2653
2944
  });
2654
- log15("Installation report submitted successfully: %O", result);
2945
+ log16("Installation report submitted successfully: %O", result);
2655
2946
  return result;
2656
2947
  }
2657
2948
  /**
@@ -2665,7 +2956,7 @@ var PluginsService = class extends BaseSDK {
2665
2956
  * @returns Promise resolving to the report submission response
2666
2957
  */
2667
2958
  async reportCall(reportData) {
2668
- log15(
2959
+ log16(
2669
2960
  "Reporting call for %s@%s - %s:%s",
2670
2961
  reportData.identifier,
2671
2962
  reportData.version,
@@ -2679,7 +2970,7 @@ var PluginsService = class extends BaseSDK {
2679
2970
  },
2680
2971
  method: "POST"
2681
2972
  });
2682
- log15("Call report submitted successfully: %O", result);
2973
+ log16("Call report submitted successfully: %O", result);
2683
2974
  return result;
2684
2975
  }
2685
2976
  /**
@@ -2691,7 +2982,7 @@ var PluginsService = class extends BaseSDK {
2691
2982
  * @param options - Optional request init overrides
2692
2983
  */
2693
2984
  async createEvent(eventData, options) {
2694
- log15("Recording plugin event: %s for %s", eventData.event, eventData.identifier);
2985
+ log16("Recording plugin event: %s for %s", eventData.event, eventData.identifier);
2695
2986
  await this.request("/v1/plugins/events", {
2696
2987
  body: JSON.stringify(eventData),
2697
2988
  headers: {
@@ -2721,7 +3012,7 @@ var PluginsService = class extends BaseSDK {
2721
3012
  * ```
2722
3013
  */
2723
3014
  async callCloudGateway(request, options) {
2724
- log15("Calling cloud gateway for plugin %s, tool %s", request.identifier, request.toolName);
3015
+ log16("Calling cloud gateway for plugin %s, tool %s", request.identifier, request.toolName);
2725
3016
  const result = await this.request("/v1/plugins/cloud-gateway", {
2726
3017
  body: JSON.stringify(request),
2727
3018
  headers: {
@@ -2730,7 +3021,7 @@ var PluginsService = class extends BaseSDK {
2730
3021
  method: "POST",
2731
3022
  ...options
2732
3023
  });
2733
- log15("Cloud gateway call completed: %O", {
3024
+ log16("Cloud gateway call completed: %O", {
2734
3025
  identifier: request.identifier,
2735
3026
  isError: result.isError,
2736
3027
  toolName: request.toolName
@@ -2771,7 +3062,7 @@ var PluginsService = class extends BaseSDK {
2771
3062
  * ```
2772
3063
  */
2773
3064
  async runBuildInTool(toolName, params, context, options) {
2774
- log15(
3065
+ log16(
2775
3066
  "Running built-in tool: %s for user %s, topic %s",
2776
3067
  toolName,
2777
3068
  context.userId,
@@ -2790,7 +3081,7 @@ var PluginsService = class extends BaseSDK {
2790
3081
  method: "POST",
2791
3082
  ...options
2792
3083
  });
2793
- log15("Built-in tool execution completed: %O", {
3084
+ log16("Built-in tool execution completed: %O", {
2794
3085
  success: result.success,
2795
3086
  toolName
2796
3087
  });
@@ -2894,8 +3185,8 @@ var PluginsService = class extends BaseSDK {
2894
3185
  };
2895
3186
 
2896
3187
  // src/market/services/SkillService.ts
2897
- import debug16 from "debug";
2898
- var log16 = debug16("lobe-market-sdk:skill");
3188
+ import debug17 from "debug";
3189
+ var log17 = debug17("lobe-market-sdk:skill");
2899
3190
  var SkillService = class extends BaseSDK {
2900
3191
  /**
2901
3192
  * Lists all available skill providers
@@ -2908,9 +3199,9 @@ var SkillService = class extends BaseSDK {
2908
3199
  */
2909
3200
  async listProviders(options) {
2910
3201
  var _a;
2911
- log16("Listing skill providers");
3202
+ log17("Listing skill providers");
2912
3203
  const result = await this.request("/v1/skill/providers", options);
2913
- log16("Found %d skill providers", ((_a = result.providers) == null ? void 0 : _a.length) || 0);
3204
+ log17("Found %d skill providers", ((_a = result.providers) == null ? void 0 : _a.length) || 0);
2914
3205
  return result;
2915
3206
  }
2916
3207
  /**
@@ -2925,12 +3216,12 @@ var SkillService = class extends BaseSDK {
2925
3216
  */
2926
3217
  async listTools(provider, options) {
2927
3218
  var _a;
2928
- log16("Listing tools for provider: %s", provider);
3219
+ log17("Listing tools for provider: %s", provider);
2929
3220
  const result = await this.request(
2930
3221
  `/v1/skill/${encodeURIComponent(provider)}/tools`,
2931
3222
  options
2932
3223
  );
2933
- log16("Found %d tools for provider %s", ((_a = result.tools) == null ? void 0 : _a.length) || 0, provider);
3224
+ log17("Found %d tools for provider %s", ((_a = result.tools) == null ? void 0 : _a.length) || 0, provider);
2934
3225
  return result;
2935
3226
  }
2936
3227
  /**
@@ -2946,12 +3237,12 @@ var SkillService = class extends BaseSDK {
2946
3237
  */
2947
3238
  async getTool(provider, toolName, options) {
2948
3239
  var _a;
2949
- log16("Getting tool %s from provider %s", toolName, provider);
3240
+ log17("Getting tool %s from provider %s", toolName, provider);
2950
3241
  const result = await this.request(
2951
3242
  `/v1/skill/${encodeURIComponent(provider)}/tool/${encodeURIComponent(toolName)}`,
2952
3243
  options
2953
3244
  );
2954
- log16("Retrieved tool: %s", (_a = result.tool) == null ? void 0 : _a.name);
3245
+ log17("Retrieved tool: %s", (_a = result.tool) == null ? void 0 : _a.name);
2955
3246
  return result;
2956
3247
  }
2957
3248
  /**
@@ -2965,12 +3256,12 @@ var SkillService = class extends BaseSDK {
2965
3256
  * @returns Promise resolving to the connection status
2966
3257
  */
2967
3258
  async getStatus(provider, options) {
2968
- log16("Getting status for provider: %s", provider);
3259
+ log17("Getting status for provider: %s", provider);
2969
3260
  const result = await this.request(
2970
3261
  `/v1/skill/${encodeURIComponent(provider)}/status`,
2971
3262
  options
2972
3263
  );
2973
- log16("Provider %s status: connected=%s", provider, result.connected);
3264
+ log17("Provider %s status: connected=%s", provider, result.connected);
2974
3265
  return result;
2975
3266
  }
2976
3267
  /**
@@ -2998,7 +3289,7 @@ var SkillService = class extends BaseSDK {
2998
3289
  * ```
2999
3290
  */
3000
3291
  async callTool(provider, params, options) {
3001
- log16("Calling tool %s on provider %s", params.tool, provider);
3292
+ log17("Calling tool %s on provider %s", params.tool, provider);
3002
3293
  const result = await this.request(
3003
3294
  `/v1/skill/${encodeURIComponent(provider)}/call`,
3004
3295
  {
@@ -3013,14 +3304,14 @@ var SkillService = class extends BaseSDK {
3013
3304
  ...options
3014
3305
  }
3015
3306
  );
3016
- log16("Tool %s call completed: success=%s", params.tool, result.success);
3307
+ log17("Tool %s call completed: success=%s", params.tool, result.success);
3017
3308
  return result;
3018
3309
  }
3019
3310
  };
3020
3311
 
3021
3312
  // src/market/services/UserService.ts
3022
- import debug17 from "debug";
3023
- var log17 = debug17("lobe-market-sdk:user");
3313
+ import debug18 from "debug";
3314
+ var log18 = debug18("lobe-market-sdk:user");
3024
3315
  var UserService = class extends BaseSDK {
3025
3316
  /**
3026
3317
  * Retrieves user information by account ID or userName
@@ -3037,12 +3328,12 @@ var UserService = class extends BaseSDK {
3037
3328
  const locale = params.locale || this.defaultLocale;
3038
3329
  const queryParams = { locale };
3039
3330
  const queryString = this.buildQueryString(queryParams);
3040
- log17("Getting user info: %O", { idOrUserName, ...params });
3331
+ log18("Getting user info: %O", { idOrUserName, ...params });
3041
3332
  const result = await this.request(
3042
3333
  `/v1/user/info/${idOrUserName}${queryString}`,
3043
3334
  options
3044
3335
  );
3045
- log17("User info successfully retrieved for: %s", idOrUserName);
3336
+ log18("User info successfully retrieved for: %s", idOrUserName);
3046
3337
  return result;
3047
3338
  }
3048
3339
  /**
@@ -3057,7 +3348,7 @@ var UserService = class extends BaseSDK {
3057
3348
  * @throws Error if userName is already taken or update fails
3058
3349
  */
3059
3350
  async updateUserInfo(data, options) {
3060
- log17("Updating user info: %O", data);
3351
+ log18("Updating user info: %O", data);
3061
3352
  const result = await this.request("/v1/user/update", {
3062
3353
  body: JSON.stringify(data),
3063
3354
  headers: {
@@ -3066,14 +3357,14 @@ var UserService = class extends BaseSDK {
3066
3357
  method: "POST",
3067
3358
  ...options
3068
3359
  });
3069
- log17("User info updated successfully");
3360
+ log18("User info updated successfully");
3070
3361
  return result;
3071
3362
  }
3072
3363
  };
3073
3364
 
3074
3365
  // src/market/services/UserFollowService.ts
3075
- import debug18 from "debug";
3076
- var log18 = debug18("lobe-market-sdk:user-follow");
3366
+ import debug19 from "debug";
3367
+ var log19 = debug19("lobe-market-sdk:user-follow");
3077
3368
  var UserFollowService = class extends BaseSDK {
3078
3369
  /**
3079
3370
  * Follow a user
@@ -3087,7 +3378,7 @@ var UserFollowService = class extends BaseSDK {
3087
3378
  * @throws Error if already following or cannot follow yourself
3088
3379
  */
3089
3380
  async follow(followingId, options) {
3090
- log18("Following user: %d", followingId);
3381
+ log19("Following user: %d", followingId);
3091
3382
  const body = { followingId };
3092
3383
  const result = await this.request("/v1/user/follows", {
3093
3384
  body: JSON.stringify(body),
@@ -3097,7 +3388,7 @@ var UserFollowService = class extends BaseSDK {
3097
3388
  method: "POST",
3098
3389
  ...options
3099
3390
  });
3100
- log18("Successfully followed user: %d", followingId);
3391
+ log19("Successfully followed user: %d", followingId);
3101
3392
  return result;
3102
3393
  }
3103
3394
  /**
@@ -3112,7 +3403,7 @@ var UserFollowService = class extends BaseSDK {
3112
3403
  * @throws Error if follow relationship not found
3113
3404
  */
3114
3405
  async unfollow(followingId, options) {
3115
- log18("Unfollowing user: %d", followingId);
3406
+ log19("Unfollowing user: %d", followingId);
3116
3407
  const body = { followingId };
3117
3408
  const result = await this.request("/v1/user/follows", {
3118
3409
  body: JSON.stringify(body),
@@ -3122,7 +3413,7 @@ var UserFollowService = class extends BaseSDK {
3122
3413
  method: "DELETE",
3123
3414
  ...options
3124
3415
  });
3125
- log18("Successfully unfollowed user: %d", followingId);
3416
+ log19("Successfully unfollowed user: %d", followingId);
3126
3417
  return result;
3127
3418
  }
3128
3419
  /**
@@ -3136,13 +3427,13 @@ var UserFollowService = class extends BaseSDK {
3136
3427
  * @returns Promise resolving to follow status (isFollowing, isMutual)
3137
3428
  */
3138
3429
  async checkFollowStatus(targetUserId, options) {
3139
- log18("Checking follow status for user: %d", targetUserId);
3430
+ log19("Checking follow status for user: %d", targetUserId);
3140
3431
  const queryString = this.buildQueryString({ targetUserId: String(targetUserId) });
3141
3432
  const result = await this.request(
3142
3433
  `/v1/user/follows/check${queryString}`,
3143
3434
  options
3144
3435
  );
3145
- log18("Follow status retrieved: %O", result);
3436
+ log19("Follow status retrieved: %O", result);
3146
3437
  return result;
3147
3438
  }
3148
3439
  /**
@@ -3157,7 +3448,7 @@ var UserFollowService = class extends BaseSDK {
3157
3448
  * @returns Promise resolving to list of following users
3158
3449
  */
3159
3450
  async getFollowing(userId, params = {}, options) {
3160
- log18("Getting following list for user: %d", userId);
3451
+ log19("Getting following list for user: %d", userId);
3161
3452
  const queryParams = {};
3162
3453
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
3163
3454
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -3166,7 +3457,7 @@ var UserFollowService = class extends BaseSDK {
3166
3457
  `/v1/user/follows/${userId}/following${queryString}`,
3167
3458
  options
3168
3459
  );
3169
- log18("Following list retrieved for user: %d", userId);
3460
+ log19("Following list retrieved for user: %d", userId);
3170
3461
  return result;
3171
3462
  }
3172
3463
  /**
@@ -3181,7 +3472,7 @@ var UserFollowService = class extends BaseSDK {
3181
3472
  * @returns Promise resolving to list of followers
3182
3473
  */
3183
3474
  async getFollowers(userId, params = {}, options) {
3184
- log18("Getting followers list for user: %d", userId);
3475
+ log19("Getting followers list for user: %d", userId);
3185
3476
  const queryParams = {};
3186
3477
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
3187
3478
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -3190,14 +3481,14 @@ var UserFollowService = class extends BaseSDK {
3190
3481
  `/v1/user/follows/${userId}/followers${queryString}`,
3191
3482
  options
3192
3483
  );
3193
- log18("Followers list retrieved for user: %d", userId);
3484
+ log19("Followers list retrieved for user: %d", userId);
3194
3485
  return result;
3195
3486
  }
3196
3487
  };
3197
3488
 
3198
3489
  // src/market/services/UserFavoriteService.ts
3199
- import debug19 from "debug";
3200
- var log19 = debug19("lobe-market-sdk:user-favorite");
3490
+ import debug20 from "debug";
3491
+ var log20 = debug20("lobe-market-sdk:user-favorite");
3201
3492
  var UserFavoriteService = class extends BaseSDK {
3202
3493
  /**
3203
3494
  * Add to favorites
@@ -3212,7 +3503,7 @@ var UserFavoriteService = class extends BaseSDK {
3212
3503
  * @throws Error if already in favorites
3213
3504
  */
3214
3505
  async addFavorite(targetType, targetId, options) {
3215
- log19("Adding favorite: %s %d", targetType, targetId);
3506
+ log20("Adding favorite: %s %d", targetType, targetId);
3216
3507
  const body = { targetId, targetType };
3217
3508
  const result = await this.request("/v1/user/favorites", {
3218
3509
  body: JSON.stringify(body),
@@ -3222,7 +3513,7 @@ var UserFavoriteService = class extends BaseSDK {
3222
3513
  method: "POST",
3223
3514
  ...options
3224
3515
  });
3225
- log19("Successfully added favorite: %s %d", targetType, targetId);
3516
+ log20("Successfully added favorite: %s %d", targetType, targetId);
3226
3517
  return result;
3227
3518
  }
3228
3519
  /**
@@ -3238,7 +3529,7 @@ var UserFavoriteService = class extends BaseSDK {
3238
3529
  * @throws Error if favorite not found
3239
3530
  */
3240
3531
  async removeFavorite(targetType, targetId, options) {
3241
- log19("Removing favorite: %s %d", targetType, targetId);
3532
+ log20("Removing favorite: %s %d", targetType, targetId);
3242
3533
  const body = { targetId, targetType };
3243
3534
  const result = await this.request("/v1/user/favorites", {
3244
3535
  body: JSON.stringify(body),
@@ -3248,7 +3539,7 @@ var UserFavoriteService = class extends BaseSDK {
3248
3539
  method: "DELETE",
3249
3540
  ...options
3250
3541
  });
3251
- log19("Successfully removed favorite: %s %d", targetType, targetId);
3542
+ log20("Successfully removed favorite: %s %d", targetType, targetId);
3252
3543
  return result;
3253
3544
  }
3254
3545
  /**
@@ -3263,7 +3554,7 @@ var UserFavoriteService = class extends BaseSDK {
3263
3554
  * @returns Promise resolving to favorite status
3264
3555
  */
3265
3556
  async checkFavorite(targetType, targetId, options) {
3266
- log19("Checking favorite status: %s %d", targetType, targetId);
3557
+ log20("Checking favorite status: %s %d", targetType, targetId);
3267
3558
  const queryString = this.buildQueryString({
3268
3559
  targetId: String(targetId),
3269
3560
  targetType
@@ -3272,7 +3563,7 @@ var UserFavoriteService = class extends BaseSDK {
3272
3563
  `/v1/user/favorites/check${queryString}`,
3273
3564
  options
3274
3565
  );
3275
- log19("Favorite status retrieved: %O", result);
3566
+ log20("Favorite status retrieved: %O", result);
3276
3567
  return result;
3277
3568
  }
3278
3569
  /**
@@ -3286,7 +3577,7 @@ var UserFavoriteService = class extends BaseSDK {
3286
3577
  * @returns Promise resolving to list of favorites
3287
3578
  */
3288
3579
  async getMyFavorites(params = {}, options) {
3289
- log19("Getting my favorites: %O", params);
3580
+ log20("Getting my favorites: %O", params);
3290
3581
  const queryParams = {};
3291
3582
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
3292
3583
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -3296,7 +3587,7 @@ var UserFavoriteService = class extends BaseSDK {
3296
3587
  `/v1/user/favorites/me${queryString}`,
3297
3588
  options
3298
3589
  );
3299
- log19("My favorites retrieved");
3590
+ log20("My favorites retrieved");
3300
3591
  return result;
3301
3592
  }
3302
3593
  /**
@@ -3311,7 +3602,7 @@ var UserFavoriteService = class extends BaseSDK {
3311
3602
  * @returns Promise resolving to list of favorites
3312
3603
  */
3313
3604
  async getUserFavorites(userId, params = {}, options) {
3314
- log19("Getting favorites for user: %d", userId);
3605
+ log20("Getting favorites for user: %d", userId);
3315
3606
  const queryParams = {};
3316
3607
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
3317
3608
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -3321,7 +3612,7 @@ var UserFavoriteService = class extends BaseSDK {
3321
3612
  `/v1/user/favorites/${userId}${queryString}`,
3322
3613
  options
3323
3614
  );
3324
- log19("Favorites retrieved for user: %d", userId);
3615
+ log20("Favorites retrieved for user: %d", userId);
3325
3616
  return result;
3326
3617
  }
3327
3618
  /**
@@ -3336,7 +3627,7 @@ var UserFavoriteService = class extends BaseSDK {
3336
3627
  * @returns Promise resolving to list of favorite agents
3337
3628
  */
3338
3629
  async getUserFavoriteAgents(userId, params = {}, options) {
3339
- log19("Getting favorite agents for user: %d", userId);
3630
+ log20("Getting favorite agents for user: %d", userId);
3340
3631
  const queryParams = {};
3341
3632
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
3342
3633
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -3345,7 +3636,7 @@ var UserFavoriteService = class extends BaseSDK {
3345
3636
  `/v1/user/favorites/${userId}/agents${queryString}`,
3346
3637
  options
3347
3638
  );
3348
- log19("Favorite agents retrieved for user: %d", userId);
3639
+ log20("Favorite agents retrieved for user: %d", userId);
3349
3640
  return result;
3350
3641
  }
3351
3642
  /**
@@ -3360,7 +3651,7 @@ var UserFavoriteService = class extends BaseSDK {
3360
3651
  * @returns Promise resolving to list of favorite plugins
3361
3652
  */
3362
3653
  async getUserFavoritePlugins(userId, params = {}, options) {
3363
- log19("Getting favorite plugins for user: %d", userId);
3654
+ log20("Getting favorite plugins for user: %d", userId);
3364
3655
  const queryParams = {};
3365
3656
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
3366
3657
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -3369,14 +3660,14 @@ var UserFavoriteService = class extends BaseSDK {
3369
3660
  `/v1/user/favorites/${userId}/plugins${queryString}`,
3370
3661
  options
3371
3662
  );
3372
- log19("Favorite plugins retrieved for user: %d", userId);
3663
+ log20("Favorite plugins retrieved for user: %d", userId);
3373
3664
  return result;
3374
3665
  }
3375
3666
  };
3376
3667
 
3377
3668
  // src/market/services/UserLikeService.ts
3378
- import debug20 from "debug";
3379
- var log20 = debug20("lobe-market-sdk:user-like");
3669
+ import debug21 from "debug";
3670
+ var log21 = debug21("lobe-market-sdk:user-like");
3380
3671
  var UserLikeService = class extends BaseSDK {
3381
3672
  /**
3382
3673
  * Like content
@@ -3391,7 +3682,7 @@ var UserLikeService = class extends BaseSDK {
3391
3682
  * @throws Error if already liked
3392
3683
  */
3393
3684
  async like(targetType, targetId, options) {
3394
- log20("Liking: %s %d", targetType, targetId);
3685
+ log21("Liking: %s %d", targetType, targetId);
3395
3686
  const body = { targetId, targetType };
3396
3687
  const result = await this.request("/v1/user/likes", {
3397
3688
  body: JSON.stringify(body),
@@ -3401,7 +3692,7 @@ var UserLikeService = class extends BaseSDK {
3401
3692
  method: "POST",
3402
3693
  ...options
3403
3694
  });
3404
- log20("Successfully liked: %s %d", targetType, targetId);
3695
+ log21("Successfully liked: %s %d", targetType, targetId);
3405
3696
  return result;
3406
3697
  }
3407
3698
  /**
@@ -3417,7 +3708,7 @@ var UserLikeService = class extends BaseSDK {
3417
3708
  * @throws Error if like not found
3418
3709
  */
3419
3710
  async unlike(targetType, targetId, options) {
3420
- log20("Unliking: %s %d", targetType, targetId);
3711
+ log21("Unliking: %s %d", targetType, targetId);
3421
3712
  const body = { targetId, targetType };
3422
3713
  const result = await this.request("/v1/user/likes", {
3423
3714
  body: JSON.stringify(body),
@@ -3427,7 +3718,7 @@ var UserLikeService = class extends BaseSDK {
3427
3718
  method: "DELETE",
3428
3719
  ...options
3429
3720
  });
3430
- log20("Successfully unliked: %s %d", targetType, targetId);
3721
+ log21("Successfully unliked: %s %d", targetType, targetId);
3431
3722
  return result;
3432
3723
  }
3433
3724
  /**
@@ -3442,7 +3733,7 @@ var UserLikeService = class extends BaseSDK {
3442
3733
  * @returns Promise resolving to toggle response with new like status
3443
3734
  */
3444
3735
  async toggleLike(targetType, targetId, options) {
3445
- log20("Toggling like: %s %d", targetType, targetId);
3736
+ log21("Toggling like: %s %d", targetType, targetId);
3446
3737
  const body = { targetId, targetType };
3447
3738
  const result = await this.request("/v1/user/likes/toggle", {
3448
3739
  body: JSON.stringify(body),
@@ -3452,7 +3743,7 @@ var UserLikeService = class extends BaseSDK {
3452
3743
  method: "POST",
3453
3744
  ...options
3454
3745
  });
3455
- log20("Like toggled, new status: %O", result);
3746
+ log21("Like toggled, new status: %O", result);
3456
3747
  return result;
3457
3748
  }
3458
3749
  /**
@@ -3467,7 +3758,7 @@ var UserLikeService = class extends BaseSDK {
3467
3758
  * @returns Promise resolving to like status
3468
3759
  */
3469
3760
  async checkLike(targetType, targetId, options) {
3470
- log20("Checking like status: %s %d", targetType, targetId);
3761
+ log21("Checking like status: %s %d", targetType, targetId);
3471
3762
  const queryString = this.buildQueryString({
3472
3763
  targetId: String(targetId),
3473
3764
  targetType
@@ -3476,7 +3767,7 @@ var UserLikeService = class extends BaseSDK {
3476
3767
  `/v1/user/likes/check${queryString}`,
3477
3768
  options
3478
3769
  );
3479
- log20("Like status retrieved: %O", result);
3770
+ log21("Like status retrieved: %O", result);
3480
3771
  return result;
3481
3772
  }
3482
3773
  /**
@@ -3490,7 +3781,7 @@ var UserLikeService = class extends BaseSDK {
3490
3781
  * @returns Promise resolving to list of likes
3491
3782
  */
3492
3783
  async getMyLikes(params = {}, options) {
3493
- log20("Getting my likes: %O", params);
3784
+ log21("Getting my likes: %O", params);
3494
3785
  const queryParams = {};
3495
3786
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
3496
3787
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -3500,7 +3791,7 @@ var UserLikeService = class extends BaseSDK {
3500
3791
  `/v1/user/likes/me${queryString}`,
3501
3792
  options
3502
3793
  );
3503
- log20("My likes retrieved");
3794
+ log21("My likes retrieved");
3504
3795
  return result;
3505
3796
  }
3506
3797
  /**
@@ -3515,7 +3806,7 @@ var UserLikeService = class extends BaseSDK {
3515
3806
  * @returns Promise resolving to list of likes
3516
3807
  */
3517
3808
  async getUserLikes(userId, params = {}, options) {
3518
- log20("Getting likes for user: %d", userId);
3809
+ log21("Getting likes for user: %d", userId);
3519
3810
  const queryParams = {};
3520
3811
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
3521
3812
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -3525,7 +3816,7 @@ var UserLikeService = class extends BaseSDK {
3525
3816
  `/v1/user/likes/${userId}${queryString}`,
3526
3817
  options
3527
3818
  );
3528
- log20("Likes retrieved for user: %d", userId);
3819
+ log21("Likes retrieved for user: %d", userId);
3529
3820
  return result;
3530
3821
  }
3531
3822
  /**
@@ -3540,7 +3831,7 @@ var UserLikeService = class extends BaseSDK {
3540
3831
  * @returns Promise resolving to list of liked agents
3541
3832
  */
3542
3833
  async getUserLikedAgents(userId, params = {}, options) {
3543
- log20("Getting liked agents for user: %d", userId);
3834
+ log21("Getting liked agents for user: %d", userId);
3544
3835
  const queryParams = {};
3545
3836
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
3546
3837
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -3549,7 +3840,7 @@ var UserLikeService = class extends BaseSDK {
3549
3840
  `/v1/user/likes/${userId}/agents${queryString}`,
3550
3841
  options
3551
3842
  );
3552
- log20("Liked agents retrieved for user: %d", userId);
3843
+ log21("Liked agents retrieved for user: %d", userId);
3553
3844
  return result;
3554
3845
  }
3555
3846
  /**
@@ -3564,7 +3855,7 @@ var UserLikeService = class extends BaseSDK {
3564
3855
  * @returns Promise resolving to list of liked plugins
3565
3856
  */
3566
3857
  async getUserLikedPlugins(userId, params = {}, options) {
3567
- log20("Getting liked plugins for user: %d", userId);
3858
+ log21("Getting liked plugins for user: %d", userId);
3568
3859
  const queryParams = {};
3569
3860
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
3570
3861
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -3573,13 +3864,13 @@ var UserLikeService = class extends BaseSDK {
3573
3864
  `/v1/user/likes/${userId}/plugins${queryString}`,
3574
3865
  options
3575
3866
  );
3576
- log20("Liked plugins retrieved for user: %d", userId);
3867
+ log21("Liked plugins retrieved for user: %d", userId);
3577
3868
  return result;
3578
3869
  }
3579
3870
  };
3580
3871
 
3581
3872
  // src/market/market-sdk.ts
3582
- var log21 = debug21("lobe-market-sdk");
3873
+ var log22 = debug22("lobe-market-sdk");
3583
3874
  var MarketSDK = class extends BaseSDK {
3584
3875
  /**
3585
3876
  * Creates a new MarketSDK instance
@@ -3592,8 +3883,9 @@ var MarketSDK = class extends BaseSDK {
3592
3883
  tokenExpiry: void 0
3593
3884
  };
3594
3885
  super(options, void 0, sharedTokenState);
3595
- log21("MarketSDK instance created");
3886
+ log22("MarketSDK instance created");
3596
3887
  this.agents = new AgentService2(options, this.headers, sharedTokenState);
3888
+ this.agentGroups = new AgentGroupService(options, this.headers, sharedTokenState);
3597
3889
  this.auth = new AuthService(options, this.headers, sharedTokenState);
3598
3890
  this.connect = new ConnectService(options, this.headers, sharedTokenState);
3599
3891
  this.plugins = new PluginsService(options, this.headers, sharedTokenState);
@@ -3629,7 +3921,7 @@ var MarketSDK = class extends BaseSDK {
3629
3921
  * @deprecated Use auth.registerClient() instead
3630
3922
  */
3631
3923
  async registerClient(request) {
3632
- log21("Registering client (deprecated method, use auth.registerClient): %s", request.clientName);
3924
+ log22("Registering client (deprecated method, use auth.registerClient): %s", request.clientName);
3633
3925
  return this.auth.registerClient(request);
3634
3926
  }
3635
3927
  };
@@ -3685,6 +3977,7 @@ function buildTrustedClientPayload(params) {
3685
3977
  // src/index.ts
3686
3978
  export * from "@lobehub/market-types";
3687
3979
  export {
3980
+ MarketAPIError,
3688
3981
  MarketAdmin,
3689
3982
  MarketSDK,
3690
3983
  ReviewStatusEnumSchema,