@lobehub/market-sdk 0.46.1 → 0.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -9,10 +9,14 @@ import urlJoin from "url-join";
9
9
 
10
10
  // src/core/MarketAPIError.ts
11
11
  var normalizeErrorDetails = (errorBody) => {
12
+ var _a;
12
13
  if (!errorBody) return void 0;
13
14
  if (typeof errorBody.error === "object" && errorBody.error !== null) {
14
15
  return errorBody.error;
15
16
  }
17
+ if (typeof errorBody.error === "string" && typeof errorBody.error_description === "string") {
18
+ return { code: (_a = errorBody.code) != null ? _a : errorBody.error, message: errorBody.error_description };
19
+ }
16
20
  if (typeof errorBody.error === "string") {
17
21
  return {
18
22
  ...errorBody.code ? { code: errorBody.code } : {},
@@ -1216,6 +1220,41 @@ var PluginService = class extends BaseSDK {
1216
1220
  log5("Version set as latest successfully");
1217
1221
  return result;
1218
1222
  }
1223
+ /**
1224
+ * Takes a plugin down for support.
1225
+ *
1226
+ * `unpublish` hides the plugin and keeps it (undo with `restorePlugin`);
1227
+ * `purge` (GDPR erasure) deletes everything about it except a suppression
1228
+ * record. Either way crawls, imports and owner publishes skip its source.
1229
+ *
1230
+ * @param idOrIdentifier - Plugin ID or identifier
1231
+ * @param data - Mode, reason and optional reference / operator / scope
1232
+ * @returns The takedown marker and, for `purge`, the rows removed per table
1233
+ */
1234
+ async takedownPlugin(idOrIdentifier, data) {
1235
+ log5("Taking down plugin: %s (%s)", idOrIdentifier, data.mode);
1236
+ const result = await this.request(
1237
+ `/admin/plugins/${encodeURIComponent(String(idOrIdentifier))}/takedown`,
1238
+ { body: JSON.stringify(data), method: "POST" }
1239
+ );
1240
+ log5("Plugin taken down: %s", result.identifier);
1241
+ return result;
1242
+ }
1243
+ /**
1244
+ * Restores a plugin taken down with `unpublish`. A purged plugin cannot be restored (409).
1245
+ *
1246
+ * @param idOrIdentifier - Plugin ID or identifier
1247
+ * @returns The restored status and visibility
1248
+ */
1249
+ async restorePlugin(idOrIdentifier) {
1250
+ log5("Restoring plugin: %s", idOrIdentifier);
1251
+ const result = await this.request(
1252
+ `/admin/plugins/${encodeURIComponent(String(idOrIdentifier))}/restore`,
1253
+ { method: "POST" }
1254
+ );
1255
+ log5("Plugin restored: %s", result.identifier);
1256
+ return result;
1257
+ }
1219
1258
  /**
1220
1259
  * Updates plugin visibility
1221
1260
  *
@@ -1789,6 +1828,40 @@ var SkillService = class extends BaseSDK {
1789
1828
  log10("Updated skill: %d", id);
1790
1829
  return result;
1791
1830
  }
1831
+ /**
1832
+ * Takes a skill down for support.
1833
+ *
1834
+ * `unpublish` hides the skill and keeps it (undo with `restoreSkill`);
1835
+ * `purge` (GDPR erasure) deletes everything about it except a suppression
1836
+ * record. Either way imports skip its source.
1837
+ *
1838
+ * @param id - Skill database ID
1839
+ * @param data - Mode, reason and optional reference / operator / scope
1840
+ * @returns The takedown marker and, for `purge`, the rows removed per table
1841
+ */
1842
+ async takedownSkill(id, data) {
1843
+ log10("Taking down skill: %d (%s)", id, data.mode);
1844
+ const result = await this.request(`/admin/skills/${id}/takedown`, {
1845
+ body: JSON.stringify(data),
1846
+ method: "POST"
1847
+ });
1848
+ log10("Skill taken down: %s", result.identifier);
1849
+ return result;
1850
+ }
1851
+ /**
1852
+ * Restores a skill taken down with `unpublish`. A purged skill cannot be restored (409).
1853
+ *
1854
+ * @param id - Skill database ID
1855
+ * @returns The restored status and visibility
1856
+ */
1857
+ async restoreSkill(id) {
1858
+ log10("Restoring skill: %d", id);
1859
+ const result = await this.request(`/admin/skills/${id}/restore`, {
1860
+ method: "POST"
1861
+ });
1862
+ log10("Skill restored: %s", result.identifier);
1863
+ return result;
1864
+ }
1792
1865
  /**
1793
1866
  * Retrieve Skills with Admin API status and visibility fields.
1794
1867
  *
@@ -2106,11 +2179,27 @@ var MarketAdmin = class extends BaseSDK {
2106
2179
 
2107
2180
  // src/market/market-sdk.ts
2108
2181
  import { getAssetImagePath, getAssetInitialPath } from "@lobehub/market-types";
2109
- import debug39 from "debug";
2182
+ import debug40 from "debug";
2110
2183
 
2111
- // src/market/services/AgentProfileService.ts
2184
+ // src/market/services/AccessService.ts
2112
2185
  import debug15 from "debug";
2113
- var log15 = debug15("lobe-market-sdk:agent-profile");
2186
+ var log15 = debug15("lobe-market-sdk:market:access");
2187
+ var AccessService = class extends BaseSDK {
2188
+ /** Returns the subset of `items` the member can use; requires a trusted-client token. */
2189
+ async check(items, options) {
2190
+ log15("Checking availability of %d assets", items.length);
2191
+ return this.request("/v1/access/check", {
2192
+ body: JSON.stringify({ items }),
2193
+ headers: { "Content-Type": "application/json" },
2194
+ method: "POST",
2195
+ ...options
2196
+ });
2197
+ }
2198
+ };
2199
+
2200
+ // src/market/services/AgentProfileService.ts
2201
+ import debug16 from "debug";
2202
+ var log16 = debug16("lobe-market-sdk:agent-profile");
2114
2203
  var AgentProfileService = class extends BaseSDK {
2115
2204
  /**
2116
2205
  * Retrieves the current agent's profile
@@ -2122,9 +2211,9 @@ var AgentProfileService = class extends BaseSDK {
2122
2211
  * @returns Promise resolving to the agent profile response
2123
2212
  */
2124
2213
  async getProfile(options) {
2125
- log15("Getting agent profile");
2214
+ log16("Getting agent profile");
2126
2215
  const result = await this.request("/v1/agent/profile", options);
2127
- log15("Agent profile retrieved: id=%d, identifier=%s", result.agent.id, result.agent.identifier);
2216
+ log16("Agent profile retrieved: id=%d, identifier=%s", result.agent.id, result.agent.identifier);
2128
2217
  return result;
2129
2218
  }
2130
2219
  /**
@@ -2138,7 +2227,7 @@ var AgentProfileService = class extends BaseSDK {
2138
2227
  * @returns Promise resolving to the updated agent profile response
2139
2228
  */
2140
2229
  async updateProfile(data, options) {
2141
- log15("Updating agent profile: %O", data);
2230
+ log16("Updating agent profile: %O", data);
2142
2231
  const result = await this.request("/v1/agent/profile", {
2143
2232
  body: JSON.stringify(data),
2144
2233
  headers: {
@@ -2147,14 +2236,14 @@ var AgentProfileService = class extends BaseSDK {
2147
2236
  method: "PATCH",
2148
2237
  ...options
2149
2238
  });
2150
- log15("Agent profile updated: id=%d, name=%s", result.agent.id, result.agent.name);
2239
+ log16("Agent profile updated: id=%d, name=%s", result.agent.id, result.agent.name);
2151
2240
  return result;
2152
2241
  }
2153
2242
  };
2154
2243
 
2155
2244
  // src/market/services/AgentService.ts
2156
- import debug16 from "debug";
2157
- var log16 = debug16("lobe-market-sdk:agents");
2245
+ import debug17 from "debug";
2246
+ var log17 = debug17("lobe-market-sdk:agents");
2158
2247
  var AgentService2 = class extends BaseSDK {
2159
2248
  /**
2160
2249
  * Retrieves a list of agents from the marketplace
@@ -2171,9 +2260,9 @@ var AgentService2 = class extends BaseSDK {
2171
2260
  const locale = params.locale || this.defaultLocale;
2172
2261
  const queryParams = { ...params, locale };
2173
2262
  const queryString = this.buildQueryString(queryParams);
2174
- log16("Getting agent list: %O", queryParams);
2263
+ log17("Getting agent list: %O", queryParams);
2175
2264
  const result = await this.request(`/v1/agents${queryString}`, options);
2176
- log16("Retrieved %d agents", result.items.length);
2265
+ log17("Retrieved %d agents", result.items.length);
2177
2266
  return result;
2178
2267
  }
2179
2268
  /**
@@ -2190,9 +2279,9 @@ var AgentService2 = class extends BaseSDK {
2190
2279
  const locale = params.locale || this.defaultLocale;
2191
2280
  const queryParams = { ...params, locale };
2192
2281
  const queryString = this.buildQueryString(queryParams);
2193
- log16("Getting own agent list: %O", queryParams);
2282
+ log17("Getting own agent list: %O", queryParams);
2194
2283
  const result = await this.request(`/v1/agents/own${queryString}`, options);
2195
- log16("Retrieved %d own agents", result.items.length);
2284
+ log17("Retrieved %d own agents", result.items.length);
2196
2285
  return result;
2197
2286
  }
2198
2287
  /**
@@ -2213,12 +2302,12 @@ var AgentService2 = class extends BaseSDK {
2213
2302
  queryParams.version = params.version.toString();
2214
2303
  }
2215
2304
  const queryString = this.buildQueryString(queryParams);
2216
- log16("Getting agent detail: %O", { id, ...params });
2305
+ log17("Getting agent detail: %O", { id, ...params });
2217
2306
  const result = await this.request(
2218
2307
  `/v1/agents/detail/${id}${queryString}`,
2219
2308
  options
2220
2309
  );
2221
- log16("Agent detail successfully retrieved: %s", id);
2310
+ log17("Agent detail successfully retrieved: %s", id);
2222
2311
  return result;
2223
2312
  }
2224
2313
  /**
@@ -2234,12 +2323,12 @@ var AgentService2 = class extends BaseSDK {
2234
2323
  * @returns Promise resolving to an array containing identifiers array and last modified time
2235
2324
  */
2236
2325
  async getPublishedIdentifiers(options) {
2237
- log16("Getting published agent identifiers");
2326
+ log17("Getting published agent identifiers");
2238
2327
  const result = await this.request(
2239
2328
  "/v1/agents/identifiers",
2240
2329
  options
2241
2330
  );
2242
- log16("Retrieved %d published agent identifiers", result.length);
2331
+ log17("Retrieved %d published agent identifiers", result.length);
2243
2332
  return result;
2244
2333
  }
2245
2334
  /**
@@ -2250,9 +2339,9 @@ var AgentService2 = class extends BaseSDK {
2250
2339
  */
2251
2340
  async getSitemap(params = {}, options) {
2252
2341
  const queryString = this.buildQueryString(params);
2253
- log16("Getting agent sitemap%s", queryString);
2342
+ log17("Getting agent sitemap%s", queryString);
2254
2343
  const result = await this.request(`/v1/agents/sitemap${queryString}`, options);
2255
- log16(
2344
+ log17(
2256
2345
  "Retrieved agent sitemap page %d/%d (%d items)",
2257
2346
  result.currentPage,
2258
2347
  result.totalPages,
@@ -2275,12 +2364,12 @@ var AgentService2 = class extends BaseSDK {
2275
2364
  const locale = params.locale || this.defaultLocale;
2276
2365
  const queryParams = { ...params, locale };
2277
2366
  const queryString = this.buildQueryString(queryParams);
2278
- log16("Getting agent categories: %O", queryParams);
2367
+ log17("Getting agent categories: %O", queryParams);
2279
2368
  const result = await this.request(
2280
2369
  `/v1/agents/categories${queryString}`,
2281
2370
  options
2282
2371
  );
2283
- log16("Retrieved %d categories", result.length);
2372
+ log17("Retrieved %d categories", result.length);
2284
2373
  return result;
2285
2374
  }
2286
2375
  /**
@@ -2294,7 +2383,7 @@ var AgentService2 = class extends BaseSDK {
2294
2383
  * @returns Promise resolving to the upload response
2295
2384
  */
2296
2385
  async uploadAgent(agentData, options) {
2297
- log16("Uploading agent: %s@%s", agentData.agentIdentifier, agentData.version.version);
2386
+ log17("Uploading agent: %s@%s", agentData.agentIdentifier, agentData.version.version);
2298
2387
  const result = await this.request("/v1/agents/upload", {
2299
2388
  body: JSON.stringify(agentData),
2300
2389
  headers: {
@@ -2303,7 +2392,7 @@ var AgentService2 = class extends BaseSDK {
2303
2392
  method: "POST",
2304
2393
  ...options
2305
2394
  });
2306
- log16("Agent uploaded successfully: %O", result);
2395
+ log17("Agent uploaded successfully: %O", result);
2307
2396
  return result;
2308
2397
  }
2309
2398
  /**
@@ -2314,7 +2403,7 @@ var AgentService2 = class extends BaseSDK {
2314
2403
  * @returns Promise resolving to the created agent response
2315
2404
  */
2316
2405
  async createAgent(agentData, options) {
2317
- log16("Creating agent: %s", agentData.identifier);
2406
+ log17("Creating agent: %s", agentData.identifier);
2318
2407
  const result = await this.request("/v1/agents/create", {
2319
2408
  body: JSON.stringify(agentData),
2320
2409
  headers: {
@@ -2323,7 +2412,7 @@ var AgentService2 = class extends BaseSDK {
2323
2412
  method: "POST",
2324
2413
  ...options
2325
2414
  });
2326
- log16("Agent created successfully: %O", result);
2415
+ log17("Agent created successfully: %O", result);
2327
2416
  return result;
2328
2417
  }
2329
2418
  /**
@@ -2334,7 +2423,7 @@ var AgentService2 = class extends BaseSDK {
2334
2423
  * @returns Promise resolving to the created version response
2335
2424
  */
2336
2425
  async createAgentVersion(versionData, options) {
2337
- log16("Creating agent version: %s", versionData.identifier);
2426
+ log17("Creating agent version: %s", versionData.identifier);
2338
2427
  const result = await this.request("/v1/agents/version/create", {
2339
2428
  body: JSON.stringify(versionData),
2340
2429
  headers: {
@@ -2343,7 +2432,7 @@ var AgentService2 = class extends BaseSDK {
2343
2432
  method: "POST",
2344
2433
  ...options
2345
2434
  });
2346
- log16("Agent version created successfully: %O", result);
2435
+ log17("Agent version created successfully: %O", result);
2347
2436
  return result;
2348
2437
  }
2349
2438
  /**
@@ -2354,7 +2443,7 @@ var AgentService2 = class extends BaseSDK {
2354
2443
  * @returns Promise resolving to the modified agent response
2355
2444
  */
2356
2445
  async modifyAgent(agentData, options) {
2357
- log16("Modifying agent: %s", agentData.identifier);
2446
+ log17("Modifying agent: %s", agentData.identifier);
2358
2447
  const result = await this.request("/v1/agents/modify", {
2359
2448
  body: JSON.stringify(agentData),
2360
2449
  headers: {
@@ -2363,7 +2452,7 @@ var AgentService2 = class extends BaseSDK {
2363
2452
  method: "POST",
2364
2453
  ...options
2365
2454
  });
2366
- log16("Agent modified successfully: %O", result);
2455
+ log17("Agent modified successfully: %O", result);
2367
2456
  return result;
2368
2457
  }
2369
2458
  /**
@@ -2374,7 +2463,7 @@ var AgentService2 = class extends BaseSDK {
2374
2463
  * @returns Promise resolving to the modified version response
2375
2464
  */
2376
2465
  async modifyAgentVersion(versionData, options) {
2377
- log16("Modifying agent version: %s@%s", versionData.identifier, versionData.version);
2466
+ log17("Modifying agent version: %s@%s", versionData.identifier, versionData.version);
2378
2467
  const result = await this.request("/v1/agents/version/modify", {
2379
2468
  body: JSON.stringify(versionData),
2380
2469
  headers: {
@@ -2383,7 +2472,7 @@ var AgentService2 = class extends BaseSDK {
2383
2472
  method: "POST",
2384
2473
  ...options
2385
2474
  });
2386
- log16("Agent version modified successfully: %O", result);
2475
+ log17("Agent version modified successfully: %O", result);
2387
2476
  return result;
2388
2477
  }
2389
2478
  /**
@@ -2394,13 +2483,13 @@ var AgentService2 = class extends BaseSDK {
2394
2483
  * @returns Promise resolving to true if agent exists, false otherwise
2395
2484
  */
2396
2485
  async checkAgentExists(identifier, options) {
2397
- log16("Checking if agent exists: %s", identifier);
2486
+ log17("Checking if agent exists: %s", identifier);
2398
2487
  try {
2399
2488
  await this.getAgentDetail(identifier, {}, options);
2400
- log16("Agent exists: %s", identifier);
2489
+ log17("Agent exists: %s", identifier);
2401
2490
  return true;
2402
2491
  } catch (e) {
2403
- log16("Agent does not exist: %s", identifier);
2492
+ log17("Agent does not exist: %s", identifier);
2404
2493
  return false;
2405
2494
  }
2406
2495
  }
@@ -2413,7 +2502,7 @@ var AgentService2 = class extends BaseSDK {
2413
2502
  * @param options - Optional request init overrides
2414
2503
  */
2415
2504
  async createEvent(eventData, options) {
2416
- log16("Recording agent event: %s for %s", eventData.event, eventData.identifier);
2505
+ log17("Recording agent event: %s for %s", eventData.event, eventData.identifier);
2417
2506
  await this.request("/v1/agents/events", {
2418
2507
  body: JSON.stringify(eventData),
2419
2508
  headers: {
@@ -2434,7 +2523,7 @@ var AgentService2 = class extends BaseSDK {
2434
2523
  * @returns Promise resolving to the updated install count response
2435
2524
  */
2436
2525
  async increaseInstallCount(identifier, options) {
2437
- log16("Increasing install count for agent: %s", identifier);
2526
+ log17("Increasing install count for agent: %s", identifier);
2438
2527
  const result = await this.request("/v1/agents/install-count", {
2439
2528
  body: JSON.stringify({ identifier }),
2440
2529
  headers: {
@@ -2443,7 +2532,7 @@ var AgentService2 = class extends BaseSDK {
2443
2532
  method: "POST",
2444
2533
  ...options
2445
2534
  });
2446
- log16("Install count increased for agent %s: %d", identifier, result.installCount);
2535
+ log17("Install count increased for agent %s: %d", identifier, result.installCount);
2447
2536
  return result;
2448
2537
  }
2449
2538
  /**
@@ -2458,9 +2547,9 @@ var AgentService2 = class extends BaseSDK {
2458
2547
  * @returns Promise resolving to the status change response
2459
2548
  */
2460
2549
  async changeStatus(identifier, status, options) {
2461
- log16("Changing agent status: %s -> %s", identifier, status);
2550
+ log17("Changing agent status: %s -> %s", identifier, status);
2462
2551
  const result = await this.modifyAgent({ identifier, status }, options);
2463
- log16("Agent status changed: %s -> %s", identifier, result.status);
2552
+ log17("Agent status changed: %s -> %s", identifier, result.status);
2464
2553
  return {
2465
2554
  identifier: result.identifier,
2466
2555
  status: result.status,
@@ -2478,7 +2567,7 @@ var AgentService2 = class extends BaseSDK {
2478
2567
  * @returns Promise resolving to the status change response
2479
2568
  */
2480
2569
  async publish(identifier, options) {
2481
- log16("Publishing agent: %s", identifier);
2570
+ log17("Publishing agent: %s", identifier);
2482
2571
  return this.changeStatus(identifier, "published", options);
2483
2572
  }
2484
2573
  /**
@@ -2493,7 +2582,7 @@ var AgentService2 = class extends BaseSDK {
2493
2582
  * @returns Promise resolving to the status change response
2494
2583
  */
2495
2584
  async unpublish(identifier, options) {
2496
- log16("Unpublishing agent: %s", identifier);
2585
+ log17("Unpublishing agent: %s", identifier);
2497
2586
  return this.changeStatus(identifier, "unpublished", options);
2498
2587
  }
2499
2588
  /**
@@ -2508,7 +2597,7 @@ var AgentService2 = class extends BaseSDK {
2508
2597
  * @returns Promise resolving to the status change response
2509
2598
  */
2510
2599
  async archive(identifier, options) {
2511
- log16("Archiving agent: %s", identifier);
2600
+ log17("Archiving agent: %s", identifier);
2512
2601
  return this.changeStatus(identifier, "archived", options);
2513
2602
  }
2514
2603
  /**
@@ -2523,7 +2612,7 @@ var AgentService2 = class extends BaseSDK {
2523
2612
  * @returns Promise resolving to the status change response
2524
2613
  */
2525
2614
  async deprecate(identifier, options) {
2526
- log16("Deprecating agent: %s", identifier);
2615
+ log17("Deprecating agent: %s", identifier);
2527
2616
  return this.changeStatus(identifier, "deprecated", options);
2528
2617
  }
2529
2618
  /**
@@ -2541,12 +2630,12 @@ var AgentService2 = class extends BaseSDK {
2541
2630
  const locale = params.locale || this.defaultLocale;
2542
2631
  const queryParams = { ...params, locale };
2543
2632
  const queryString = this.buildQueryString(queryParams);
2544
- log16("Getting agents by plugin: %s", params.pluginId);
2633
+ log17("Getting agents by plugin: %s", params.pluginId);
2545
2634
  const result = await this.request(
2546
2635
  `/v1/agents/by-plugin${queryString}`,
2547
2636
  options
2548
2637
  );
2549
- log16("Retrieved %d agents for plugin %s", result.items.length, params.pluginId);
2638
+ log17("Retrieved %d agents for plugin %s", result.items.length, params.pluginId);
2550
2639
  return result;
2551
2640
  }
2552
2641
  /**
@@ -2562,7 +2651,7 @@ var AgentService2 = class extends BaseSDK {
2562
2651
  * @returns Promise resolving to the fork response with new agent details
2563
2652
  */
2564
2653
  async forkAgent(sourceIdentifier, forkData, options) {
2565
- log16("Forking agent: %s -> %s", sourceIdentifier, forkData.identifier);
2654
+ log17("Forking agent: %s -> %s", sourceIdentifier, forkData.identifier);
2566
2655
  const result = await this.request(`/v1/agents/${sourceIdentifier}/fork`, {
2567
2656
  body: JSON.stringify(forkData),
2568
2657
  headers: {
@@ -2571,7 +2660,7 @@ var AgentService2 = class extends BaseSDK {
2571
2660
  method: "POST",
2572
2661
  ...options
2573
2662
  });
2574
- log16("Agent forked successfully: %s (id: %d)", result.agent.identifier, result.agent.id);
2663
+ log17("Agent forked successfully: %s (id: %d)", result.agent.identifier, result.agent.id);
2575
2664
  return result;
2576
2665
  }
2577
2666
  /**
@@ -2585,12 +2674,12 @@ var AgentService2 = class extends BaseSDK {
2585
2674
  * @returns Promise resolving to the forks list response
2586
2675
  */
2587
2676
  async getAgentForks(identifier, options) {
2588
- log16("Getting forks for agent: %s", identifier);
2677
+ log17("Getting forks for agent: %s", identifier);
2589
2678
  const result = await this.request(
2590
2679
  `/v1/agents/${identifier}/forks`,
2591
2680
  options
2592
2681
  );
2593
- log16("Retrieved %d forks for agent: %s", result.totalCount, identifier);
2682
+ log17("Retrieved %d forks for agent: %s", result.totalCount, identifier);
2594
2683
  return result;
2595
2684
  }
2596
2685
  /**
@@ -2603,23 +2692,23 @@ var AgentService2 = class extends BaseSDK {
2603
2692
  * @returns Promise resolving to the fork source response
2604
2693
  */
2605
2694
  async getAgentForkSource(identifier, options) {
2606
- log16("Getting fork source for agent: %s", identifier);
2695
+ log17("Getting fork source for agent: %s", identifier);
2607
2696
  const result = await this.request(
2608
2697
  `/v1/agents/${identifier}/fork-source`,
2609
2698
  options
2610
2699
  );
2611
2700
  if (result.source) {
2612
- log16("Agent %s was forked from: %s", identifier, result.source.identifier);
2701
+ log17("Agent %s was forked from: %s", identifier, result.source.identifier);
2613
2702
  } else {
2614
- log16("Agent %s is not a fork (original agent)", identifier);
2703
+ log17("Agent %s is not a fork (original agent)", identifier);
2615
2704
  }
2616
2705
  return result;
2617
2706
  }
2618
2707
  };
2619
2708
 
2620
2709
  // src/market/services/AgentGroupService.ts
2621
- import debug17 from "debug";
2622
- var log17 = debug17("lobe-market-sdk:agent-groups");
2710
+ import debug18 from "debug";
2711
+ var log18 = debug18("lobe-market-sdk:agent-groups");
2623
2712
  var AgentGroupService = class extends BaseSDK {
2624
2713
  /**
2625
2714
  * Retrieves a list of agent groups from the marketplace
@@ -2634,12 +2723,12 @@ var AgentGroupService = class extends BaseSDK {
2634
2723
  const locale = params.locale || this.defaultLocale;
2635
2724
  const queryParams = { ...params, locale };
2636
2725
  const queryString = this.buildQueryString(queryParams);
2637
- log17("Getting agent group list: %O", queryParams);
2726
+ log18("Getting agent group list: %O", queryParams);
2638
2727
  const result = await this.request(
2639
2728
  `/v1/agent-groups${queryString}`,
2640
2729
  options
2641
2730
  );
2642
- log17("Retrieved %d agent groups", result.items.length);
2731
+ log18("Retrieved %d agent groups", result.items.length);
2643
2732
  return result;
2644
2733
  }
2645
2734
  /**
@@ -2656,12 +2745,12 @@ var AgentGroupService = class extends BaseSDK {
2656
2745
  const locale = params.locale || this.defaultLocale;
2657
2746
  const queryParams = { ...params, locale };
2658
2747
  const queryString = this.buildQueryString(queryParams);
2659
- log17("Getting own agent group list: %O", queryParams);
2748
+ log18("Getting own agent group list: %O", queryParams);
2660
2749
  const result = await this.request(
2661
2750
  `/v1/agent-groups/own${queryString}`,
2662
2751
  options
2663
2752
  );
2664
- log17("Retrieved %d own agent groups", result.items.length);
2753
+ log18("Retrieved %d own agent groups", result.items.length);
2665
2754
  return result;
2666
2755
  }
2667
2756
  /**
@@ -2682,12 +2771,12 @@ var AgentGroupService = class extends BaseSDK {
2682
2771
  queryParams.version = params.version.toString();
2683
2772
  }
2684
2773
  const queryString = this.buildQueryString(queryParams);
2685
- log17("Getting agent group detail: %O", { identifier, ...params });
2774
+ log18("Getting agent group detail: %O", { identifier, ...params });
2686
2775
  const result = await this.request(
2687
2776
  `/v1/agent-groups/detail${queryString}`,
2688
2777
  options
2689
2778
  );
2690
- log17("Agent group detail successfully retrieved: %s", identifier);
2779
+ log18("Agent group detail successfully retrieved: %s", identifier);
2691
2780
  return result;
2692
2781
  }
2693
2782
  /**
@@ -2701,7 +2790,7 @@ var AgentGroupService = class extends BaseSDK {
2701
2790
  * @returns Promise resolving to the created agent group response
2702
2791
  */
2703
2792
  async createAgentGroup(groupData, options) {
2704
- log17("Creating agent group: %s", groupData.identifier);
2793
+ log18("Creating agent group: %s", groupData.identifier);
2705
2794
  const result = await this.request("/v1/agent-groups/create", {
2706
2795
  body: JSON.stringify(groupData),
2707
2796
  headers: {
@@ -2710,7 +2799,7 @@ var AgentGroupService = class extends BaseSDK {
2710
2799
  method: "POST",
2711
2800
  ...options
2712
2801
  });
2713
- log17("Agent group created successfully: %O", result);
2802
+ log18("Agent group created successfully: %O", result);
2714
2803
  return result;
2715
2804
  }
2716
2805
  /**
@@ -2724,7 +2813,7 @@ var AgentGroupService = class extends BaseSDK {
2724
2813
  * @returns Promise resolving to the created version response
2725
2814
  */
2726
2815
  async createAgentGroupVersion(versionData, options) {
2727
- log17("Creating agent group version: %s", versionData.identifier);
2816
+ log18("Creating agent group version: %s", versionData.identifier);
2728
2817
  const result = await this.request(
2729
2818
  "/v1/agent-groups/version-create",
2730
2819
  {
@@ -2736,7 +2825,7 @@ var AgentGroupService = class extends BaseSDK {
2736
2825
  ...options
2737
2826
  }
2738
2827
  );
2739
- log17("Agent group version created successfully: %O", result);
2828
+ log18("Agent group version created successfully: %O", result);
2740
2829
  return result;
2741
2830
  }
2742
2831
  /**
@@ -2750,7 +2839,7 @@ var AgentGroupService = class extends BaseSDK {
2750
2839
  * @returns Promise resolving to the modified agent group response
2751
2840
  */
2752
2841
  async modifyAgentGroup(groupData, options) {
2753
- log17("Modifying agent group: %s", groupData.identifier);
2842
+ log18("Modifying agent group: %s", groupData.identifier);
2754
2843
  const result = await this.request("/v1/agent-groups/modify", {
2755
2844
  body: JSON.stringify(groupData),
2756
2845
  headers: {
@@ -2759,7 +2848,7 @@ var AgentGroupService = class extends BaseSDK {
2759
2848
  method: "POST",
2760
2849
  ...options
2761
2850
  });
2762
- log17("Agent group modified successfully: %O", result);
2851
+ log18("Agent group modified successfully: %O", result);
2763
2852
  return result;
2764
2853
  }
2765
2854
  /**
@@ -2770,13 +2859,13 @@ var AgentGroupService = class extends BaseSDK {
2770
2859
  * @returns Promise resolving to true if agent group exists, false otherwise
2771
2860
  */
2772
2861
  async checkAgentGroupExists(identifier, options) {
2773
- log17("Checking if agent group exists: %s", identifier);
2862
+ log18("Checking if agent group exists: %s", identifier);
2774
2863
  try {
2775
2864
  await this.getAgentGroupDetail(identifier, {}, options);
2776
- log17("Agent group exists: %s", identifier);
2865
+ log18("Agent group exists: %s", identifier);
2777
2866
  return true;
2778
2867
  } catch (e) {
2779
- log17("Agent group does not exist: %s", identifier);
2868
+ log18("Agent group does not exist: %s", identifier);
2780
2869
  return false;
2781
2870
  }
2782
2871
  }
@@ -2792,9 +2881,9 @@ var AgentGroupService = class extends BaseSDK {
2792
2881
  * @returns Promise resolving to the status change response
2793
2882
  */
2794
2883
  async changeStatus(identifier, status, options) {
2795
- log17("Changing agent group status: %s -> %s", identifier, status);
2884
+ log18("Changing agent group status: %s -> %s", identifier, status);
2796
2885
  const result = await this.modifyAgentGroup({ identifier, status }, options);
2797
- log17("Agent group status changed: %s -> %s", identifier, result.status);
2886
+ log18("Agent group status changed: %s -> %s", identifier, result.status);
2798
2887
  return {
2799
2888
  identifier: result.identifier,
2800
2889
  status: result.status,
@@ -2813,7 +2902,7 @@ var AgentGroupService = class extends BaseSDK {
2813
2902
  * @returns Promise resolving to the status change response
2814
2903
  */
2815
2904
  async publish(identifier, options) {
2816
- log17("Publishing agent group: %s", identifier);
2905
+ log18("Publishing agent group: %s", identifier);
2817
2906
  return this.changeStatus(identifier, "published", options);
2818
2907
  }
2819
2908
  /**
@@ -2828,7 +2917,7 @@ var AgentGroupService = class extends BaseSDK {
2828
2917
  * @returns Promise resolving to the status change response
2829
2918
  */
2830
2919
  async unpublish(identifier, options) {
2831
- log17("Unpublishing agent group: %s", identifier);
2920
+ log18("Unpublishing agent group: %s", identifier);
2832
2921
  return this.changeStatus(identifier, "unpublished", options);
2833
2922
  }
2834
2923
  /**
@@ -2843,7 +2932,7 @@ var AgentGroupService = class extends BaseSDK {
2843
2932
  * @returns Promise resolving to the status change response
2844
2933
  */
2845
2934
  async archive(identifier, options) {
2846
- log17("Archiving agent group: %s", identifier);
2935
+ log18("Archiving agent group: %s", identifier);
2847
2936
  return this.changeStatus(identifier, "archived", options);
2848
2937
  }
2849
2938
  /**
@@ -2858,7 +2947,7 @@ var AgentGroupService = class extends BaseSDK {
2858
2947
  * @returns Promise resolving to the status change response
2859
2948
  */
2860
2949
  async deprecate(identifier, options) {
2861
- log17("Deprecating agent group: %s", identifier);
2950
+ log18("Deprecating agent group: %s", identifier);
2862
2951
  return this.changeStatus(identifier, "deprecated", options);
2863
2952
  }
2864
2953
  /**
@@ -2874,7 +2963,7 @@ var AgentGroupService = class extends BaseSDK {
2874
2963
  * @returns Promise resolving to the fork response with new group details
2875
2964
  */
2876
2965
  async forkAgentGroup(sourceIdentifier, forkData, options) {
2877
- log17("Forking agent group: %s -> %s", sourceIdentifier, forkData.identifier);
2966
+ log18("Forking agent group: %s -> %s", sourceIdentifier, forkData.identifier);
2878
2967
  const result = await this.request(
2879
2968
  `/v1/agent-groups/${sourceIdentifier}/fork`,
2880
2969
  {
@@ -2886,7 +2975,7 @@ var AgentGroupService = class extends BaseSDK {
2886
2975
  ...options
2887
2976
  }
2888
2977
  );
2889
- log17(
2978
+ log18(
2890
2979
  "Agent group forked successfully: %s (id: %d, members: %d)",
2891
2980
  result.group.identifier,
2892
2981
  result.group.id,
@@ -2905,12 +2994,12 @@ var AgentGroupService = class extends BaseSDK {
2905
2994
  * @returns Promise resolving to the forks list response
2906
2995
  */
2907
2996
  async getAgentGroupForks(identifier, options) {
2908
- log17("Getting forks for agent group: %s", identifier);
2997
+ log18("Getting forks for agent group: %s", identifier);
2909
2998
  const result = await this.request(
2910
2999
  `/v1/agent-groups/${identifier}/forks`,
2911
3000
  options
2912
3001
  );
2913
- log17("Retrieved %d forks for agent group: %s", result.totalCount, identifier);
3002
+ log18("Retrieved %d forks for agent group: %s", result.totalCount, identifier);
2914
3003
  return result;
2915
3004
  }
2916
3005
  /**
@@ -2923,24 +3012,24 @@ var AgentGroupService = class extends BaseSDK {
2923
3012
  * @returns Promise resolving to the fork source response
2924
3013
  */
2925
3014
  async getAgentGroupForkSource(identifier, options) {
2926
- log17("Getting fork source for agent group: %s", identifier);
3015
+ log18("Getting fork source for agent group: %s", identifier);
2927
3016
  const result = await this.request(
2928
3017
  `/v1/agent-groups/${identifier}/fork-source`,
2929
3018
  options
2930
3019
  );
2931
3020
  if (result.source) {
2932
- log17("Agent group %s was forked from: %s", identifier, result.source.identifier);
3021
+ log18("Agent group %s was forked from: %s", identifier, result.source.identifier);
2933
3022
  } else {
2934
- log17("Agent group %s is not a fork (original group)", identifier);
3023
+ log18("Agent group %s is not a fork (original group)", identifier);
2935
3024
  }
2936
3025
  return result;
2937
3026
  }
2938
3027
  };
2939
3028
 
2940
3029
  // src/market/services/AuthService.ts
2941
- import debug18 from "debug";
3030
+ import debug19 from "debug";
2942
3031
  import urlJoin2 from "url-join";
2943
- var log18 = debug18("lobe-market-sdk:auth");
3032
+ var log19 = debug19("lobe-market-sdk:auth");
2944
3033
  var _AuthService = class _AuthService extends BaseSDK {
2945
3034
  /** Normalize token response from snake_case to camelCase fields */
2946
3035
  static normalizeTokenResponse(data) {
@@ -2972,7 +3061,7 @@ var _AuthService = class _AuthService extends BaseSDK {
2972
3061
  if (grantType !== "authorization_code" && grantType !== "refresh_token") {
2973
3062
  throw new Error(`Unsupported grant type: ${grantType}`);
2974
3063
  }
2975
- log18("Exchanging OAuth token using grant_type=%s", grantType);
3064
+ log19("Exchanging OAuth token using grant_type=%s", grantType);
2976
3065
  const tokenUrl = urlJoin2(this.baseUrl, "lobehub-oidc/token");
2977
3066
  const params = new URLSearchParams();
2978
3067
  params.set("grant_type", grantType);
@@ -3014,16 +3103,16 @@ var _AuthService = class _AuthService extends BaseSDK {
3014
3103
  try {
3015
3104
  payload = await response.json();
3016
3105
  } catch (error) {
3017
- log18("Failed to parse token response: %O", error);
3106
+ log19("Failed to parse token response: %O", error);
3018
3107
  throw new Error(`Failed to parse token response: ${response.status} ${response.statusText}`);
3019
3108
  }
3020
3109
  if (!response.ok) {
3021
3110
  const errorDescription = (payload == null ? void 0 : payload.error_description) || (payload == null ? void 0 : payload.error) || response.statusText;
3022
3111
  const errorMsg = `Token exchange failed: ${response.status} ${errorDescription}`;
3023
- log18("Error: %s", errorMsg);
3112
+ log19("Error: %s", errorMsg);
3024
3113
  throw new Error(errorMsg);
3025
3114
  }
3026
- log18("Token exchange successful");
3115
+ log19("Token exchange successful");
3027
3116
  return _AuthService.normalizeTokenResponse(payload);
3028
3117
  }
3029
3118
  /**
@@ -3041,7 +3130,7 @@ var _AuthService = class _AuthService extends BaseSDK {
3041
3130
  if (!clientId || !token) {
3042
3131
  throw new Error("clientId and token are required for token revocation");
3043
3132
  }
3044
- log18("Revoking OAuth token (hint=%s)", tokenTypeHint != null ? tokenTypeHint : "none");
3133
+ log19("Revoking OAuth token (hint=%s)", tokenTypeHint != null ? tokenTypeHint : "none");
3045
3134
  const revocationUrl = urlJoin2(this.baseUrl, "lobehub-oidc/token/revocation");
3046
3135
  const params = new URLSearchParams();
3047
3136
  params.set("client_id", clientId);
@@ -3069,10 +3158,10 @@ var _AuthService = class _AuthService extends BaseSDK {
3069
3158
  } catch (e) {
3070
3159
  }
3071
3160
  const errorMsg = `Token revocation failed: ${response.status} ${errorDescription}`;
3072
- log18("Error: %s", errorMsg);
3161
+ log19("Error: %s", errorMsg);
3073
3162
  throw new Error(errorMsg);
3074
3163
  }
3075
- log18("Token revocation successful");
3164
+ log19("Token revocation successful");
3076
3165
  }
3077
3166
  /**
3078
3167
  * Retrieves user information from the OIDC userinfo endpoint
@@ -3084,7 +3173,7 @@ var _AuthService = class _AuthService extends BaseSDK {
3084
3173
  * @returns Promise resolving to the user information
3085
3174
  */
3086
3175
  async getUserInfo(accessToken, options) {
3087
- log18("Getting user info");
3176
+ log19("Getting user info");
3088
3177
  const userInfoUrl = urlJoin2(this.baseUrl, "lobehub-oidc/userinfo");
3089
3178
  const response = await fetch(userInfoUrl, {
3090
3179
  headers: {
@@ -3096,11 +3185,11 @@ var _AuthService = class _AuthService extends BaseSDK {
3096
3185
  });
3097
3186
  if (!response.ok) {
3098
3187
  const errorMsg = `Failed to fetch user info: ${response.status} ${response.statusText}`;
3099
- log18("Error: %s", errorMsg);
3188
+ log19("Error: %s", errorMsg);
3100
3189
  throw new Error(errorMsg);
3101
3190
  }
3102
3191
  const userInfo = await response.json();
3103
- log18("User info retrieved successfully");
3192
+ log19("User info retrieved successfully");
3104
3193
  return userInfo;
3105
3194
  }
3106
3195
  /**
@@ -3114,7 +3203,7 @@ var _AuthService = class _AuthService extends BaseSDK {
3114
3203
  * @returns Promise resolving to the client credentials
3115
3204
  */
3116
3205
  async registerClient(clientData, options) {
3117
- log18("Registering client: %s (%s)", clientData.clientName, clientData.clientType);
3206
+ log19("Registering client: %s (%s)", clientData.clientName, clientData.clientType);
3118
3207
  const result = await this.request("/v1/clients/register", {
3119
3208
  body: JSON.stringify(clientData),
3120
3209
  headers: {
@@ -3123,7 +3212,7 @@ var _AuthService = class _AuthService extends BaseSDK {
3123
3212
  method: "POST",
3124
3213
  ...options
3125
3214
  });
3126
- log18("Client registered successfully: %s", result.client_id);
3215
+ log19("Client registered successfully: %s", result.client_id);
3127
3216
  return result;
3128
3217
  }
3129
3218
  /**
@@ -3135,9 +3224,9 @@ var _AuthService = class _AuthService extends BaseSDK {
3135
3224
  * @returns Promise resolving to the access token and expiration time
3136
3225
  */
3137
3226
  async getM2MToken() {
3138
- log18("Fetching M2M token");
3227
+ log19("Fetching M2M token");
3139
3228
  const tokenInfo = await this.fetchM2MToken();
3140
- log18("M2M token fetched successfully");
3229
+ log19("M2M token fetched successfully");
3141
3230
  return tokenInfo;
3142
3231
  }
3143
3232
  /** OAuth handoff response shapes */
@@ -3163,7 +3252,7 @@ var _AuthService = class _AuthService extends BaseSDK {
3163
3252
  async getOAuthHandoff(id, options) {
3164
3253
  var _a, _b;
3165
3254
  if (!id) throw new Error("id is required");
3166
- log18("Getting OAuth handoff: %s", id);
3255
+ log19("Getting OAuth handoff: %s", id);
3167
3256
  const handoffUrl = `${urlJoin2(this.baseUrl, "lobehub-oidc/handoff")}?id=${encodeURIComponent(id)}`;
3168
3257
  const response = await fetch(handoffUrl, {
3169
3258
  headers: {
@@ -3179,19 +3268,19 @@ var _AuthService = class _AuthService extends BaseSDK {
3179
3268
  code: json.code,
3180
3269
  redirectUri: json.redirectUri
3181
3270
  });
3182
- log18("OAuth handoff success for id: %s", id);
3271
+ log19("OAuth handoff success for id: %s", id);
3183
3272
  return result;
3184
3273
  }
3185
3274
  if (response.status === 202) {
3186
- log18("OAuth handoff pending for id: %s", id);
3275
+ log19("OAuth handoff pending for id: %s", id);
3187
3276
  return { status: _AuthService.HANDOFF_PENDING_STATUS };
3188
3277
  }
3189
3278
  if (response.status === 404) {
3190
- log18("OAuth handoff consumed for id: %s", id);
3279
+ log19("OAuth handoff consumed for id: %s", id);
3191
3280
  return { status: _AuthService.HANDOFF_CONSUMED_STATUS };
3192
3281
  }
3193
3282
  if (response.status === 410) {
3194
- log18("OAuth handoff expired for id: %s", id);
3283
+ log19("OAuth handoff expired for id: %s", id);
3195
3284
  return { status: _AuthService.HANDOFF_EXPIRED_STATUS };
3196
3285
  }
3197
3286
  let errorMessage = `Failed to fetch OAuth handoff (status ${response.status} ${response.statusText})`;
@@ -3202,7 +3291,7 @@ var _AuthService = class _AuthService extends BaseSDK {
3202
3291
  }
3203
3292
  } catch (e) {
3204
3293
  }
3205
- log18("Error: %s", errorMessage);
3294
+ log19("Error: %s", errorMessage);
3206
3295
  throw new Error(errorMessage);
3207
3296
  }
3208
3297
  /**
@@ -3216,21 +3305,21 @@ var _AuthService = class _AuthService extends BaseSDK {
3216
3305
  const timeoutMs = (_b = params.timeoutMs) != null ? _b : 6e4;
3217
3306
  const startedAt = Date.now();
3218
3307
  const { signal, requestInit } = params;
3219
- log18("Start polling OAuth handoff: %s", id);
3308
+ log19("Start polling OAuth handoff: %s", id);
3220
3309
  while (true) {
3221
3310
  if (signal == null ? void 0 : signal.aborted) {
3222
3311
  const err = new Error("Polling aborted");
3223
- log18("Error: %s", err.message);
3312
+ log19("Error: %s", err.message);
3224
3313
  throw err;
3225
3314
  }
3226
3315
  if (Date.now() - startedAt > timeoutMs) {
3227
3316
  const err = new Error("Polling timeout");
3228
- log18("Error: %s", err.message);
3317
+ log19("Error: %s", err.message);
3229
3318
  throw err;
3230
3319
  }
3231
3320
  const result = await this.getOAuthHandoff(id, requestInit);
3232
3321
  if (result.status === "success" || result.status === "expired" || result.status === "consumed") {
3233
- log18("Stop polling OAuth handoff (terminal): %s -> %s", id, result.status);
3322
+ log19("Stop polling OAuth handoff (terminal): %s -> %s", id, result.status);
3234
3323
  return result;
3235
3324
  }
3236
3325
  await new Promise((resolve) => {
@@ -3251,9 +3340,9 @@ _AuthService.HANDOFF_EXPIRED_STATUS = "expired";
3251
3340
  var AuthService = _AuthService;
3252
3341
 
3253
3342
  // src/market/services/ConnectService.ts
3254
- import debug19 from "debug";
3343
+ import debug20 from "debug";
3255
3344
  import urlJoin3 from "url-join";
3256
- var log19 = debug19("lobe-market-sdk:connect");
3345
+ var log20 = debug20("lobe-market-sdk:connect");
3257
3346
  var CIMD_CLIENT_METADATA_VERSION = "v1";
3258
3347
  var CIMD_CLIENT_METADATA_VERSION_BY_PROVIDER = {
3259
3348
  posthog: "v2"
@@ -3277,9 +3366,9 @@ var ConnectService = class extends BaseSDK {
3277
3366
  */
3278
3367
  async listProviders(options) {
3279
3368
  var _a;
3280
- log19("Listing connect providers");
3369
+ log20("Listing connect providers");
3281
3370
  const result = await this.request("/connect/providers", options);
3282
- log19("Found %d connect providers", ((_a = result.providers) == null ? void 0 : _a.length) || 0);
3371
+ log20("Found %d connect providers", ((_a = result.providers) == null ? void 0 : _a.length) || 0);
3283
3372
  return result;
3284
3373
  }
3285
3374
  /**
@@ -3293,12 +3382,12 @@ var ConnectService = class extends BaseSDK {
3293
3382
  */
3294
3383
  async getProvider(provider, options) {
3295
3384
  var _a;
3296
- log19("Getting provider details: %s", provider);
3385
+ log20("Getting provider details: %s", provider);
3297
3386
  const result = await this.request(
3298
3387
  `/connect/providers/${encodeURIComponent(provider)}`,
3299
3388
  options
3300
3389
  );
3301
- log19("Retrieved provider: %s", (_a = result.provider) == null ? void 0 : _a.name);
3390
+ log20("Retrieved provider: %s", (_a = result.provider) == null ? void 0 : _a.name);
3302
3391
  return result;
3303
3392
  }
3304
3393
  /**
@@ -3317,12 +3406,12 @@ var ConnectService = class extends BaseSDK {
3317
3406
  const metadataParams = hasParams ? params : void 0;
3318
3407
  const requestOptions = hasParams ? options : params;
3319
3408
  const version = getCimdClientMetadataVersion(provider, metadataParams == null ? void 0 : metadataParams.version);
3320
- log19("Getting CIMD client metadata for provider: %s version: %s", provider, version);
3409
+ log20("Getting CIMD client metadata for provider: %s version: %s", provider, version);
3321
3410
  const result = await this.request(
3322
3411
  `/connect/${encodeURIComponent(provider)}/oauth/client-metadata/${encodeURIComponent(version)}.json`,
3323
3412
  requestOptions
3324
3413
  );
3325
- log19("Retrieved CIMD client metadata: %s", result.client_id);
3414
+ log20("Retrieved CIMD client metadata: %s", result.client_id);
3326
3415
  return result;
3327
3416
  }
3328
3417
  /**
@@ -3362,7 +3451,7 @@ var ConnectService = class extends BaseSDK {
3362
3451
  * ```
3363
3452
  */
3364
3453
  async authorize(provider, params, options) {
3365
- log19("Requesting authorization code for provider: %s", provider);
3454
+ log20("Requesting authorization code for provider: %s", provider);
3366
3455
  const result = await this.request(
3367
3456
  `/connect/${encodeURIComponent(provider)}/authorize`,
3368
3457
  {
@@ -3374,7 +3463,7 @@ var ConnectService = class extends BaseSDK {
3374
3463
  ...options
3375
3464
  }
3376
3465
  );
3377
- log19("Authorization code obtained, expires in %d seconds", result.expires_in);
3466
+ log20("Authorization code obtained, expires in %d seconds", result.expires_in);
3378
3467
  return result;
3379
3468
  }
3380
3469
  /**
@@ -3400,7 +3489,7 @@ var ConnectService = class extends BaseSDK {
3400
3489
  * ```
3401
3490
  */
3402
3491
  getAuthorizeUrl(provider, params) {
3403
- log19(
3492
+ log20(
3404
3493
  "Generating authorize URL for provider: %s (deprecated, use authorize() instead)",
3405
3494
  provider
3406
3495
  );
@@ -3414,7 +3503,7 @@ var ConnectService = class extends BaseSDK {
3414
3503
  const queryString = queryParams.toString();
3415
3504
  const path = `/connect/${encodeURIComponent(provider)}/start${queryString ? `?${queryString}` : ""}`;
3416
3505
  const url = urlJoin3(this.baseUrl, "api", path);
3417
- log19("Generated authorize URL: %s", url);
3506
+ log20("Generated authorize URL: %s", url);
3418
3507
  return url;
3419
3508
  }
3420
3509
  /**
@@ -3428,12 +3517,12 @@ var ConnectService = class extends BaseSDK {
3428
3517
  * @returns Promise resolving to the connection status
3429
3518
  */
3430
3519
  async getStatus(provider, options) {
3431
- log19("Getting connection status for provider: %s", provider);
3520
+ log20("Getting connection status for provider: %s", provider);
3432
3521
  const result = await this.request(
3433
3522
  `/connect/${encodeURIComponent(provider)}/status`,
3434
3523
  options
3435
3524
  );
3436
- log19("Provider %s connection status: connected=%s", provider, result.connected);
3525
+ log20("Provider %s connection status: connected=%s", provider, result.connected);
3437
3526
  return result;
3438
3527
  }
3439
3528
  /**
@@ -3446,9 +3535,9 @@ var ConnectService = class extends BaseSDK {
3446
3535
  */
3447
3536
  async listConnections(options) {
3448
3537
  var _a;
3449
- log19("Listing user connections");
3538
+ log20("Listing user connections");
3450
3539
  const result = await this.request("/connect/connections", options);
3451
- log19("Found %d connections", ((_a = result.connections) == null ? void 0 : _a.length) || 0);
3540
+ log20("Found %d connections", ((_a = result.connections) == null ? void 0 : _a.length) || 0);
3452
3541
  return result;
3453
3542
  }
3454
3543
  /**
@@ -3462,12 +3551,12 @@ var ConnectService = class extends BaseSDK {
3462
3551
  * @returns Promise resolving to the connection health status
3463
3552
  */
3464
3553
  async getHealth(provider, options) {
3465
- log19("Checking health for provider: %s", provider);
3554
+ log20("Checking health for provider: %s", provider);
3466
3555
  const result = await this.request(
3467
3556
  `/connect/${encodeURIComponent(provider)}/health`,
3468
3557
  options
3469
3558
  );
3470
- log19("Provider %s health: healthy=%s, status=%s", provider, result.healthy, result.tokenStatus);
3559
+ log20("Provider %s health: healthy=%s, status=%s", provider, result.healthy, result.tokenStatus);
3471
3560
  return result;
3472
3561
  }
3473
3562
  /**
@@ -3480,9 +3569,9 @@ var ConnectService = class extends BaseSDK {
3480
3569
  */
3481
3570
  async getAllHealth(options) {
3482
3571
  var _a, _b, _c;
3483
- log19("Checking health for all connections");
3572
+ log20("Checking health for all connections");
3484
3573
  const result = await this.request("/connect/health", options);
3485
- log19(
3574
+ log20(
3486
3575
  "Health check complete: total=%d, healthy=%d, unhealthy=%d",
3487
3576
  ((_a = result.summary) == null ? void 0 : _a.total) || 0,
3488
3577
  ((_b = result.summary) == null ? void 0 : _b.healthy) || 0,
@@ -3501,7 +3590,7 @@ var ConnectService = class extends BaseSDK {
3501
3590
  * @returns Promise resolving to the refresh result
3502
3591
  */
3503
3592
  async refresh(provider, options) {
3504
- log19("Refreshing token for provider: %s", provider);
3593
+ log20("Refreshing token for provider: %s", provider);
3505
3594
  const result = await this.request(
3506
3595
  `/connect/${encodeURIComponent(provider)}/refresh`,
3507
3596
  {
@@ -3509,7 +3598,7 @@ var ConnectService = class extends BaseSDK {
3509
3598
  ...options
3510
3599
  }
3511
3600
  );
3512
- log19("Token refresh for %s: refreshed=%s", provider, result.refreshed);
3601
+ log20("Token refresh for %s: refreshed=%s", provider, result.refreshed);
3513
3602
  return result;
3514
3603
  }
3515
3604
  /**
@@ -3523,7 +3612,7 @@ var ConnectService = class extends BaseSDK {
3523
3612
  * @returns Promise resolving to the revoke result
3524
3613
  */
3525
3614
  async revoke(provider, options) {
3526
- log19("Revoking connection for provider: %s", provider);
3615
+ log20("Revoking connection for provider: %s", provider);
3527
3616
  const result = await this.request(
3528
3617
  `/connect/${encodeURIComponent(provider)}`,
3529
3618
  {
@@ -3531,14 +3620,37 @@ var ConnectService = class extends BaseSDK {
3531
3620
  ...options
3532
3621
  }
3533
3622
  );
3534
- log19("Connection revoked for %s: success=%s", provider, result.success);
3623
+ log20("Connection revoked for %s: success=%s", provider, result.success);
3624
+ return result;
3625
+ }
3626
+ /**
3627
+ * Lets the current workspace use the caller's own personal connection
3628
+ *
3629
+ * Only inside a workspace (a trust token carrying `workspaceId`) and only for
3630
+ * workspace admins. The tokens are shared, not copied; authorizing the
3631
+ * workspace itself later replaces the reference. Idempotent.
3632
+ *
3633
+ * @param provider - The provider ID (e.g., 'linear', 'github')
3634
+ * @param options - Optional request options (must include authentication)
3635
+ * @returns Promise resolving to whether a reference now exists
3636
+ */
3637
+ async addReference(provider, options) {
3638
+ log20("Adding workspace reference for provider: %s", provider);
3639
+ const result = await this.request(
3640
+ `/connect/${encodeURIComponent(provider)}/reference`,
3641
+ {
3642
+ method: "POST",
3643
+ ...options
3644
+ }
3645
+ );
3646
+ log20("Workspace reference for %s: status=%s", provider, result.status);
3535
3647
  return result;
3536
3648
  }
3537
3649
  };
3538
3650
 
3539
3651
  // src/market/services/CredService.ts
3540
- import debug20 from "debug";
3541
- var log20 = debug20("lobe-market-sdk:creds");
3652
+ import debug21 from "debug";
3653
+ var log21 = debug21("lobe-market-sdk:creds");
3542
3654
  var CredService = class extends BaseSDK {
3543
3655
  // ===========================================================================
3544
3656
  // List & Get Operations
@@ -3554,9 +3666,9 @@ var CredService = class extends BaseSDK {
3554
3666
  */
3555
3667
  async list(options) {
3556
3668
  var _a;
3557
- log20("Listing user credentials");
3669
+ log21("Listing user credentials");
3558
3670
  const result = await this.request("/v1/user/creds", options);
3559
- log20("Found %d credentials", ((_a = result.data) == null ? void 0 : _a.length) || 0);
3671
+ log21("Found %d credentials", ((_a = result.data) == null ? void 0 : _a.length) || 0);
3560
3672
  return result;
3561
3673
  }
3562
3674
  /**
@@ -3571,7 +3683,7 @@ var CredService = class extends BaseSDK {
3571
3683
  * @returns Promise resolving to the credential details
3572
3684
  */
3573
3685
  async get(id, getOptions, options) {
3574
- log20("Getting credential: %d (decrypt=%s)", id, getOptions == null ? void 0 : getOptions.decrypt);
3686
+ log21("Getting credential: %d (decrypt=%s)", id, getOptions == null ? void 0 : getOptions.decrypt);
3575
3687
  const queryParams = {};
3576
3688
  if (getOptions == null ? void 0 : getOptions.decrypt) {
3577
3689
  queryParams.decrypt = "true";
@@ -3581,7 +3693,7 @@ var CredService = class extends BaseSDK {
3581
3693
  `/v1/user/creds/${id}${queryString}`,
3582
3694
  options
3583
3695
  );
3584
- log20("Retrieved credential: %s", result.key);
3696
+ log21("Retrieved credential: %s", result.key);
3585
3697
  return result;
3586
3698
  }
3587
3699
  // ===========================================================================
@@ -3600,7 +3712,7 @@ var CredService = class extends BaseSDK {
3600
3712
  * @returns Promise resolving to the created credential
3601
3713
  */
3602
3714
  async createKV(data, options) {
3603
- log20("Creating KV credential: %s (type=%s)", data.key, data.type);
3715
+ log21("Creating KV credential: %s (type=%s)", data.key, data.type);
3604
3716
  const result = await this.request("/v1/user/creds/kv", {
3605
3717
  body: JSON.stringify(data),
3606
3718
  headers: {
@@ -3609,7 +3721,7 @@ var CredService = class extends BaseSDK {
3609
3721
  method: "POST",
3610
3722
  ...options
3611
3723
  });
3612
- log20("Created KV credential: %d", result.id);
3724
+ log21("Created KV credential: %d", result.id);
3613
3725
  return result;
3614
3726
  }
3615
3727
  /**
@@ -3623,7 +3735,7 @@ var CredService = class extends BaseSDK {
3623
3735
  * @returns Promise resolving to the created credential
3624
3736
  */
3625
3737
  async createOAuth(data, options) {
3626
- log20("Creating OAuth credential: %s (connectionId=%d)", data.key, data.oauthConnectionId);
3738
+ log21("Creating OAuth credential: %s (connectionId=%d)", data.key, data.oauthConnectionId);
3627
3739
  const result = await this.request("/v1/user/creds/oauth", {
3628
3740
  body: JSON.stringify(data),
3629
3741
  headers: {
@@ -3632,7 +3744,7 @@ var CredService = class extends BaseSDK {
3632
3744
  method: "POST",
3633
3745
  ...options
3634
3746
  });
3635
- log20("Created OAuth credential: %d", result.id);
3747
+ log21("Created OAuth credential: %d", result.id);
3636
3748
  return result;
3637
3749
  }
3638
3750
  /**
@@ -3646,7 +3758,7 @@ var CredService = class extends BaseSDK {
3646
3758
  * @returns Promise resolving to the created credential
3647
3759
  */
3648
3760
  async createFile(data, options) {
3649
- log20("Creating file credential: %s (fileName=%s)", data.key, data.fileName);
3761
+ log21("Creating file credential: %s (fileName=%s)", data.key, data.fileName);
3650
3762
  const result = await this.request("/v1/user/creds/file", {
3651
3763
  body: JSON.stringify(data),
3652
3764
  headers: {
@@ -3655,7 +3767,7 @@ var CredService = class extends BaseSDK {
3655
3767
  method: "POST",
3656
3768
  ...options
3657
3769
  });
3658
- log20("Created file credential: %d", result.id);
3770
+ log21("Created file credential: %d", result.id);
3659
3771
  return result;
3660
3772
  }
3661
3773
  // ===========================================================================
@@ -3673,7 +3785,7 @@ var CredService = class extends BaseSDK {
3673
3785
  * @returns Promise resolving to the updated credential
3674
3786
  */
3675
3787
  async update(id, data, options) {
3676
- log20("Updating credential: %d", id);
3788
+ log21("Updating credential: %d", id);
3677
3789
  const result = await this.request(`/v1/user/creds/${id}`, {
3678
3790
  body: JSON.stringify(data),
3679
3791
  headers: {
@@ -3682,7 +3794,7 @@ var CredService = class extends BaseSDK {
3682
3794
  method: "PATCH",
3683
3795
  ...options
3684
3796
  });
3685
- log20("Updated credential: %d", result.id);
3797
+ log21("Updated credential: %d", result.id);
3686
3798
  return result;
3687
3799
  }
3688
3800
  // ===========================================================================
@@ -3705,7 +3817,7 @@ var CredService = class extends BaseSDK {
3705
3817
  * @returns Promise resolving to the updated credential
3706
3818
  */
3707
3819
  async share(id, data, options) {
3708
- log20("Sharing credential %d with org %s", id, data.orgId);
3820
+ log21("Sharing credential %d with org %s", id, data.orgId);
3709
3821
  const result = await this.request(`/v1/user/creds/${id}/share`, {
3710
3822
  body: JSON.stringify(data),
3711
3823
  headers: {
@@ -3714,7 +3826,7 @@ var CredService = class extends BaseSDK {
3714
3826
  method: "POST",
3715
3827
  ...options
3716
3828
  });
3717
- log20("Shared credential: %d", result.id);
3829
+ log21("Shared credential: %d", result.id);
3718
3830
  return result;
3719
3831
  }
3720
3832
  /**
@@ -3731,7 +3843,7 @@ var CredService = class extends BaseSDK {
3731
3843
  * @returns Promise resolving to the updated credential
3732
3844
  */
3733
3845
  async publish(id, options, target = {}) {
3734
- log20("Publishing credential %d (org=%s)", id, target.orgId);
3846
+ log21("Publishing credential %d (org=%s)", id, target.orgId);
3735
3847
  const result = await this.request(`/v1/user/creds/${id}/publish`, {
3736
3848
  body: JSON.stringify(target),
3737
3849
  headers: {
@@ -3740,7 +3852,7 @@ var CredService = class extends BaseSDK {
3740
3852
  method: "POST",
3741
3853
  ...options
3742
3854
  });
3743
- log20("Published credential: %d", result.id);
3855
+ log21("Published credential: %d", result.id);
3744
3856
  return result;
3745
3857
  }
3746
3858
  /**
@@ -3756,7 +3868,7 @@ var CredService = class extends BaseSDK {
3756
3868
  * @returns Promise resolving to the updated credential
3757
3869
  */
3758
3870
  async unshare(id, options, target = {}) {
3759
- log20("Unsharing credential %d (org=%s)", id, target.orgId);
3871
+ log21("Unsharing credential %d (org=%s)", id, target.orgId);
3760
3872
  const result = await this.request(`/v1/user/creds/${id}/unshare`, {
3761
3873
  body: JSON.stringify(target),
3762
3874
  headers: {
@@ -3765,7 +3877,7 @@ var CredService = class extends BaseSDK {
3765
3877
  method: "POST",
3766
3878
  ...options
3767
3879
  });
3768
- log20("Unshared credential: %d", result.id);
3880
+ log21("Unshared credential: %d", result.id);
3769
3881
  return result;
3770
3882
  }
3771
3883
  // ===========================================================================
@@ -3781,12 +3893,12 @@ var CredService = class extends BaseSDK {
3781
3893
  * @returns Promise resolving to the delete result
3782
3894
  */
3783
3895
  async delete(id, options) {
3784
- log20("Deleting credential by ID: %d", id);
3896
+ log21("Deleting credential by ID: %d", id);
3785
3897
  const result = await this.request(`/v1/user/creds/${id}`, {
3786
3898
  method: "DELETE",
3787
3899
  ...options
3788
3900
  });
3789
- log20("Deleted credential: %d, success=%s", id, result.success);
3901
+ log21("Deleted credential: %d, success=%s", id, result.success);
3790
3902
  return result;
3791
3903
  }
3792
3904
  /**
@@ -3800,7 +3912,7 @@ var CredService = class extends BaseSDK {
3800
3912
  * @returns Promise resolving to the delete result
3801
3913
  */
3802
3914
  async deleteByKey(key, options) {
3803
- log20("Deleting credential by key: %s", key);
3915
+ log21("Deleting credential by key: %s", key);
3804
3916
  const result = await this.request(
3805
3917
  `/v1/user/creds/key/${encodeURIComponent(key)}`,
3806
3918
  {
@@ -3808,7 +3920,7 @@ var CredService = class extends BaseSDK {
3808
3920
  ...options
3809
3921
  }
3810
3922
  );
3811
- log20("Deleted credential by key: %s, success=%s", key, result.success);
3923
+ log21("Deleted credential by key: %s, success=%s", key, result.success);
3812
3924
  return result;
3813
3925
  }
3814
3926
  // ===========================================================================
@@ -3827,12 +3939,12 @@ var CredService = class extends BaseSDK {
3827
3939
  * @returns Promise resolving to the credential status list
3828
3940
  */
3829
3941
  async getSkillCredStatus(skillIdentifier, options) {
3830
- log20("Getting skill cred status: %s", skillIdentifier);
3942
+ log21("Getting skill cred status: %s", skillIdentifier);
3831
3943
  const result = await this.request(
3832
3944
  `/v1/skills/${encodeURIComponent(skillIdentifier)}/creds/status`,
3833
3945
  options
3834
3946
  );
3835
- log20("Skill %s has %d credential requirements", skillIdentifier, result.length);
3947
+ log21("Skill %s has %d credential requirements", skillIdentifier, result.length);
3836
3948
  return result;
3837
3949
  }
3838
3950
  // ===========================================================================
@@ -3871,7 +3983,7 @@ var CredService = class extends BaseSDK {
3871
3983
  */
3872
3984
  async inject(request, options) {
3873
3985
  var _a, _b, _c, _d;
3874
- log20("Injecting credentials by keys: %O (sandbox=%s)", request.keys, request.sandbox);
3986
+ log21("Injecting credentials by keys: %O (sandbox=%s)", request.keys, request.sandbox);
3875
3987
  const result = await this.request(
3876
3988
  "/v1/plugins/run-buildin-tools/inject-creds",
3877
3989
  {
@@ -3883,7 +3995,7 @@ var CredService = class extends BaseSDK {
3883
3995
  ...options
3884
3996
  }
3885
3997
  );
3886
- log20(
3998
+ log21(
3887
3999
  "Inject result: success=%s, env=%d, files=%d, notFound=%d",
3888
4000
  result.success,
3889
4001
  Object.keys(((_a = result.credentials) == null ? void 0 : _a.env) || {}).length,
@@ -3925,7 +4037,7 @@ var CredService = class extends BaseSDK {
3925
4037
  */
3926
4038
  async injectForSkill(request, options) {
3927
4039
  var _a, _b, _c, _d;
3928
- log20(
4040
+ log21(
3929
4041
  "Injecting credentials for skill: %s (sandbox=%s)",
3930
4042
  request.skillIdentifier,
3931
4043
  request.sandbox
@@ -3941,7 +4053,7 @@ var CredService = class extends BaseSDK {
3941
4053
  ...options
3942
4054
  }
3943
4055
  );
3944
- log20(
4056
+ log21(
3945
4057
  "Inject result: success=%s, env=%d, files=%d, missing=%d",
3946
4058
  result.success,
3947
4059
  Object.keys(((_a = result.credentials) == null ? void 0 : _a.env) || {}).length,
@@ -3953,11 +4065,11 @@ var CredService = class extends BaseSDK {
3953
4065
  };
3954
4066
 
3955
4067
  // src/market/services/DeploymentService.ts
3956
- import debug21 from "debug";
3957
- var log21 = debug21("lobe-market-sdk:deployments");
4068
+ import debug22 from "debug";
4069
+ var log22 = debug22("lobe-market-sdk:deployments");
3958
4070
  var DeploymentService = class extends BaseSDK {
3959
4071
  async prepareUpload(data, options) {
3960
- log21("Preparing deployment upload with %d files", data.files.length);
4072
+ log22("Preparing deployment upload with %d files", data.files.length);
3961
4073
  const result = await this.request(
3962
4074
  "/v1/deployments/uploads/prepare",
3963
4075
  {
@@ -3969,7 +4081,7 @@ var DeploymentService = class extends BaseSDK {
3969
4081
  return result.data;
3970
4082
  }
3971
4083
  async ingestUpload(uploadId, options) {
3972
- log21("Ingesting deployment upload: %s", uploadId);
4084
+ log22("Ingesting deployment upload: %s", uploadId);
3973
4085
  const result = await this.request(
3974
4086
  `/v1/deployments/uploads/${encodeURIComponent(uploadId)}/ingest`,
3975
4087
  { ...options, method: "POST" }
@@ -3977,7 +4089,7 @@ var DeploymentService = class extends BaseSDK {
3977
4089
  return result.data;
3978
4090
  }
3979
4091
  async finalizeUpload(uploadId, options) {
3980
- log21("Finalizing deployment upload: %s", uploadId);
4092
+ log22("Finalizing deployment upload: %s", uploadId);
3981
4093
  const result = await this.request(
3982
4094
  `/v1/deployments/uploads/${encodeURIComponent(uploadId)}/finalize`,
3983
4095
  { ...options, method: "POST" }
@@ -3987,9 +4099,9 @@ var DeploymentService = class extends BaseSDK {
3987
4099
  };
3988
4100
 
3989
4101
  // src/market/services/DiscoveryService.ts
3990
- import debug22 from "debug";
4102
+ import debug23 from "debug";
3991
4103
  import urlJoin4 from "url-join";
3992
- var log22 = debug22("lobe-market-sdk:discovery");
4104
+ var log23 = debug23("lobe-market-sdk:discovery");
3993
4105
  var DiscoveryService = class extends BaseSDK {
3994
4106
  /**
3995
4107
  * Retrieves the service discovery document
@@ -4001,9 +4113,9 @@ var DiscoveryService = class extends BaseSDK {
4001
4113
  * @returns Promise resolving to the service discovery document
4002
4114
  */
4003
4115
  async getDiscoveryDocument() {
4004
- log22("Fetching discovery document");
4116
+ log23("Fetching discovery document");
4005
4117
  if (this.discoveryDoc) {
4006
- log22("Returning cached discovery document");
4118
+ log23("Returning cached discovery document");
4007
4119
  return this.discoveryDoc;
4008
4120
  }
4009
4121
  const res = await fetch(urlJoin4(this.baseUrl, "/.well-known/discovery"));
@@ -4011,14 +4123,14 @@ var DiscoveryService = class extends BaseSDK {
4011
4123
  throw new Error(await res.text());
4012
4124
  }
4013
4125
  this.discoveryDoc = await res.json();
4014
- log22("Discovery document successfully fetched");
4126
+ log23("Discovery document successfully fetched");
4015
4127
  return this.discoveryDoc;
4016
4128
  }
4017
4129
  };
4018
4130
 
4019
4131
  // src/market/services/FeedbackService.ts
4020
- import debug23 from "debug";
4021
- var log23 = debug23("lobe-market-sdk:feedback");
4132
+ import debug24 from "debug";
4133
+ var log24 = debug24("lobe-market-sdk:feedback");
4022
4134
  var FeedbackService = class extends BaseSDK {
4023
4135
  /**
4024
4136
  * Submits user feedback
@@ -4048,7 +4160,7 @@ var FeedbackService = class extends BaseSDK {
4048
4160
  * ```
4049
4161
  */
4050
4162
  async submitFeedback(data, options) {
4051
- log23("Submitting feedback: %s", data.title);
4163
+ log24("Submitting feedback: %s", data.title);
4052
4164
  const result = await this.request("/v1/user/feedback", {
4053
4165
  body: JSON.stringify(data),
4054
4166
  headers: {
@@ -4057,14 +4169,14 @@ var FeedbackService = class extends BaseSDK {
4057
4169
  method: "POST",
4058
4170
  ...options
4059
4171
  });
4060
- log23("Feedback submitted successfully: %s", result.issueId);
4172
+ log24("Feedback submitted successfully: %s", result.issueId);
4061
4173
  return result;
4062
4174
  }
4063
4175
  };
4064
4176
 
4065
4177
  // src/market/services/PluginsService.ts
4066
- import debug24 from "debug";
4067
- var log24 = debug24("lobe-market-sdk:plugins");
4178
+ import debug25 from "debug";
4179
+ var log25 = debug25("lobe-market-sdk:plugins");
4068
4180
  function encodeBase64(input) {
4069
4181
  if (typeof Buffer !== "undefined") {
4070
4182
  return Buffer.from(input, "utf8").toString("base64");
@@ -4090,9 +4202,9 @@ var PluginsService = class extends BaseSDK {
4090
4202
  const locale = params.locale || this.defaultLocale;
4091
4203
  const queryParams = { ...params, locale };
4092
4204
  const queryString = this.buildQueryString(queryParams);
4093
- log24("Getting plugin list: %O", queryParams);
4205
+ log25("Getting plugin list: %O", queryParams);
4094
4206
  const result = await this.request(`/v1/plugins${queryString}`, options);
4095
- log24("Retrieved %d plugins", result.items.length);
4207
+ log25("Retrieved %d plugins", result.items.length);
4096
4208
  return result;
4097
4209
  }
4098
4210
  /**
@@ -4110,12 +4222,12 @@ var PluginsService = class extends BaseSDK {
4110
4222
  const locale = params.locale || this.defaultLocale;
4111
4223
  const queryParams = { ...params, locale };
4112
4224
  const queryString = this.buildQueryString(queryParams);
4113
- log24("Getting plugin categories: %O", queryParams);
4225
+ log25("Getting plugin categories: %O", queryParams);
4114
4226
  const result = await this.request(
4115
4227
  `/v1/plugins/categories${queryString}`,
4116
4228
  options
4117
4229
  );
4118
- log24("Retrieved %d categories", result.length);
4230
+ log25("Retrieved %d categories", result.length);
4119
4231
  return result;
4120
4232
  }
4121
4233
  /**
@@ -4129,12 +4241,12 @@ var PluginsService = class extends BaseSDK {
4129
4241
  * @returns Promise resolving to an array containing identifiers array and last modified time
4130
4242
  */
4131
4243
  async getPublishedIdentifiers(options) {
4132
- log24("Getting published plugin identifiers");
4244
+ log25("Getting published plugin identifiers");
4133
4245
  const result = await this.request(
4134
4246
  "/v1/plugins/identifiers",
4135
4247
  options
4136
4248
  );
4137
- log24("Retrieved %d published plugin identifiers", result.length);
4249
+ log25("Retrieved %d published plugin identifiers", result.length);
4138
4250
  return result;
4139
4251
  }
4140
4252
  /**
@@ -4145,12 +4257,12 @@ var PluginsService = class extends BaseSDK {
4145
4257
  */
4146
4258
  async getSitemap(params = {}, options) {
4147
4259
  const queryString = this.buildQueryString(params);
4148
- log24("Getting plugin sitemap%s", queryString);
4260
+ log25("Getting plugin sitemap%s", queryString);
4149
4261
  const result = await this.request(
4150
4262
  `/v1/plugins/sitemap${queryString}`,
4151
4263
  options
4152
4264
  );
4153
- log24(
4265
+ log25(
4154
4266
  "Retrieved plugin sitemap page %d/%d (%d items)",
4155
4267
  result.currentPage,
4156
4268
  result.totalPages,
@@ -4175,7 +4287,7 @@ var PluginsService = class extends BaseSDK {
4175
4287
  version,
4176
4288
  identifier
4177
4289
  }, options) {
4178
- log24("Getting plugin manifest: %O", { identifier, locale, version });
4290
+ log25("Getting plugin manifest: %O", { identifier, locale, version });
4179
4291
  const localeParam = locale || this.defaultLocale;
4180
4292
  const params = { locale: localeParam };
4181
4293
  if (version) {
@@ -4186,7 +4298,7 @@ var PluginsService = class extends BaseSDK {
4186
4298
  `/v1/plugins/${identifier}/manifest${queryString}`,
4187
4299
  options
4188
4300
  );
4189
- log24("Plugin manifest successfully retrieved: %s", identifier);
4301
+ log25("Plugin manifest successfully retrieved: %s", identifier);
4190
4302
  return manifest;
4191
4303
  }
4192
4304
  /**
@@ -4203,7 +4315,7 @@ var PluginsService = class extends BaseSDK {
4203
4315
  version,
4204
4316
  identifier
4205
4317
  }, options) {
4206
- log24("Getting plugin detail: %O", { identifier, locale, version });
4318
+ log25("Getting plugin detail: %O", { identifier, locale, version });
4207
4319
  const localeParam = locale || this.defaultLocale;
4208
4320
  const params = { locale: localeParam };
4209
4321
  if (version) {
@@ -4214,7 +4326,7 @@ var PluginsService = class extends BaseSDK {
4214
4326
  `/v1/plugins/${identifier}${queryString}`,
4215
4327
  options
4216
4328
  );
4217
- log24("Plugin manifest successfully retrieved: %s", identifier);
4329
+ log25("Plugin manifest successfully retrieved: %s", identifier);
4218
4330
  return manifest;
4219
4331
  }
4220
4332
  /**
@@ -4229,7 +4341,7 @@ var PluginsService = class extends BaseSDK {
4229
4341
  *
4230
4342
  */
4231
4343
  async reportInstallation(reportData) {
4232
- log24("Reporting installation for %s@%s", reportData.identifier, reportData.version);
4344
+ log25("Reporting installation for %s@%s", reportData.identifier, reportData.version);
4233
4345
  const result = await this.request("/v1/plugins/report/installation", {
4234
4346
  body: JSON.stringify(reportData),
4235
4347
  headers: {
@@ -4237,7 +4349,7 @@ var PluginsService = class extends BaseSDK {
4237
4349
  },
4238
4350
  method: "POST"
4239
4351
  });
4240
- log24("Installation report submitted successfully: %O", result);
4352
+ log25("Installation report submitted successfully: %O", result);
4241
4353
  return result;
4242
4354
  }
4243
4355
  /**
@@ -4251,7 +4363,7 @@ var PluginsService = class extends BaseSDK {
4251
4363
  * @returns Promise resolving to the report submission response
4252
4364
  */
4253
4365
  async reportCall(reportData) {
4254
- log24(
4366
+ log25(
4255
4367
  "Reporting call for %s@%s - %s:%s",
4256
4368
  reportData.identifier,
4257
4369
  reportData.version,
@@ -4265,7 +4377,7 @@ var PluginsService = class extends BaseSDK {
4265
4377
  },
4266
4378
  method: "POST"
4267
4379
  });
4268
- log24("Call report submitted successfully: %O", result);
4380
+ log25("Call report submitted successfully: %O", result);
4269
4381
  return result;
4270
4382
  }
4271
4383
  /**
@@ -4277,7 +4389,7 @@ var PluginsService = class extends BaseSDK {
4277
4389
  * @param options - Optional request init overrides
4278
4390
  */
4279
4391
  async createEvent(eventData, options) {
4280
- log24("Recording plugin event: %s for %s", eventData.event, eventData.identifier);
4392
+ log25("Recording plugin event: %s for %s", eventData.event, eventData.identifier);
4281
4393
  await this.request("/v1/plugins/events", {
4282
4394
  body: JSON.stringify(eventData),
4283
4395
  headers: {
@@ -4307,7 +4419,7 @@ var PluginsService = class extends BaseSDK {
4307
4419
  * ```
4308
4420
  */
4309
4421
  async callCloudGateway(request, options) {
4310
- log24("Calling cloud gateway for plugin %s, tool %s", request.identifier, request.toolName);
4422
+ log25("Calling cloud gateway for plugin %s, tool %s", request.identifier, request.toolName);
4311
4423
  const result = await this.request("/v1/plugins/cloud-gateway", {
4312
4424
  body: JSON.stringify(request),
4313
4425
  headers: {
@@ -4316,7 +4428,7 @@ var PluginsService = class extends BaseSDK {
4316
4428
  method: "POST",
4317
4429
  ...options
4318
4430
  });
4319
- log24("Cloud gateway call completed: %O", {
4431
+ log25("Cloud gateway call completed: %O", {
4320
4432
  identifier: request.identifier,
4321
4433
  isError: result.isError,
4322
4434
  toolName: request.toolName
@@ -4357,7 +4469,7 @@ var PluginsService = class extends BaseSDK {
4357
4469
  * ```
4358
4470
  */
4359
4471
  async runBuildInTool(toolName, params, context2, options) {
4360
- log24(
4472
+ log25(
4361
4473
  "Running built-in tool: %s for user %s, topic %s",
4362
4474
  toolName,
4363
4475
  context2.userId,
@@ -4384,7 +4496,7 @@ var PluginsService = class extends BaseSDK {
4384
4496
  method: "POST",
4385
4497
  ...options
4386
4498
  });
4387
- log24("Built-in tool execution completed: %O", {
4499
+ log25("Built-in tool execution completed: %O", {
4388
4500
  success: result.success,
4389
4501
  toolName
4390
4502
  });
@@ -4497,7 +4609,7 @@ var PluginsService = class extends BaseSDK {
4497
4609
  * @returns Promise resolving to the submitted score
4498
4610
  */
4499
4611
  async submitRating(identifier, score, options) {
4500
- log24("Submitting rating for plugin %s: %d", identifier, score);
4612
+ log25("Submitting rating for plugin %s: %d", identifier, score);
4501
4613
  const result = await this.request(
4502
4614
  `/v1/plugins/${encodeURIComponent(identifier)}/ratings`,
4503
4615
  {
@@ -4506,7 +4618,7 @@ var PluginsService = class extends BaseSDK {
4506
4618
  method: "POST"
4507
4619
  }
4508
4620
  );
4509
- log24("Rating submitted for plugin %s: %d", identifier, result.score);
4621
+ log25("Rating submitted for plugin %s: %d", identifier, result.score);
4510
4622
  return result;
4511
4623
  }
4512
4624
  /**
@@ -4517,7 +4629,7 @@ var PluginsService = class extends BaseSDK {
4517
4629
  * @returns Promise resolving to success status
4518
4630
  */
4519
4631
  async deleteRating(identifier, options) {
4520
- log24("Deleting rating for plugin %s", identifier);
4632
+ log25("Deleting rating for plugin %s", identifier);
4521
4633
  const result = await this.request(
4522
4634
  `/v1/plugins/${encodeURIComponent(identifier)}/ratings`,
4523
4635
  {
@@ -4525,7 +4637,7 @@ var PluginsService = class extends BaseSDK {
4525
4637
  method: "DELETE"
4526
4638
  }
4527
4639
  );
4528
- log24("Rating deleted for plugin %s", identifier);
4640
+ log25("Rating deleted for plugin %s", identifier);
4529
4641
  return result;
4530
4642
  }
4531
4643
  /**
@@ -4536,12 +4648,12 @@ var PluginsService = class extends BaseSDK {
4536
4648
  * @returns Promise resolving to the rating distribution
4537
4649
  */
4538
4650
  async getRatingDistribution(identifier, options) {
4539
- log24("Getting rating distribution for plugin: %s", identifier);
4651
+ log25("Getting rating distribution for plugin: %s", identifier);
4540
4652
  const result = await this.request(
4541
4653
  `/v1/plugins/${encodeURIComponent(identifier)}/ratings/distribution`,
4542
4654
  options
4543
4655
  );
4544
- log24("Rating distribution retrieved for plugin %s: %d total", identifier, result.totalCount);
4656
+ log25("Rating distribution retrieved for plugin %s: %d total", identifier, result.totalCount);
4545
4657
  return result;
4546
4658
  }
4547
4659
  // ============================================================================
@@ -4557,12 +4669,12 @@ var PluginsService = class extends BaseSDK {
4557
4669
  */
4558
4670
  async getComments(identifier, params = {}, options) {
4559
4671
  const queryString = this.buildQueryString(params);
4560
- log24("Getting comments for plugin %s: %O", identifier, params);
4672
+ log25("Getting comments for plugin %s: %O", identifier, params);
4561
4673
  const result = await this.request(
4562
4674
  `/v1/plugins/${encodeURIComponent(identifier)}/comments${queryString}`,
4563
4675
  options
4564
4676
  );
4565
- log24(
4677
+ log25(
4566
4678
  "Retrieved %d comments for plugin %s (page %d/%d)",
4567
4679
  result.items.length,
4568
4680
  identifier,
@@ -4579,15 +4691,15 @@ var PluginsService = class extends BaseSDK {
4579
4691
  * @returns Promise resolving to the latest own comment or null when none exists
4580
4692
  */
4581
4693
  async getLatestOwnComment(identifier, options) {
4582
- log24("Getting latest own comment for plugin %s", identifier);
4694
+ log25("Getting latest own comment for plugin %s", identifier);
4583
4695
  const result = await this.request(
4584
4696
  `/v1/plugins/${encodeURIComponent(identifier)}/comments/latest`,
4585
4697
  options
4586
4698
  );
4587
4699
  if (result) {
4588
- log24("Retrieved latest own comment for plugin %s: id=%d", identifier, result.id);
4700
+ log25("Retrieved latest own comment for plugin %s: id=%d", identifier, result.id);
4589
4701
  } else {
4590
- log24("No own comments found for plugin %s", identifier);
4702
+ log25("No own comments found for plugin %s", identifier);
4591
4703
  }
4592
4704
  return result;
4593
4705
  }
@@ -4600,7 +4712,7 @@ var PluginsService = class extends BaseSDK {
4600
4712
  * @returns Promise resolving to the created comment (with optional rating field)
4601
4713
  */
4602
4714
  async createComment(identifier, data, options) {
4603
- log24("Creating comment on plugin %s", identifier);
4715
+ log25("Creating comment on plugin %s", identifier);
4604
4716
  const result = await this.request(
4605
4717
  `/v1/plugins/${encodeURIComponent(identifier)}/comments`,
4606
4718
  {
@@ -4609,7 +4721,7 @@ var PluginsService = class extends BaseSDK {
4609
4721
  method: "POST"
4610
4722
  }
4611
4723
  );
4612
- log24("Comment created on plugin %s: id=%d", identifier, result.id);
4724
+ log25("Comment created on plugin %s: id=%d", identifier, result.id);
4613
4725
  return result;
4614
4726
  }
4615
4727
  /**
@@ -4621,7 +4733,7 @@ var PluginsService = class extends BaseSDK {
4621
4733
  * @returns Promise resolving to success status
4622
4734
  */
4623
4735
  async deleteComment(identifier, commentId, options) {
4624
- log24("Deleting comment %d from plugin %s", commentId, identifier);
4736
+ log25("Deleting comment %d from plugin %s", commentId, identifier);
4625
4737
  const result = await this.request(
4626
4738
  `/v1/plugins/${encodeURIComponent(identifier)}/comments/${commentId}`,
4627
4739
  {
@@ -4629,7 +4741,7 @@ var PluginsService = class extends BaseSDK {
4629
4741
  method: "DELETE"
4630
4742
  }
4631
4743
  );
4632
- log24("Comment %d deleted from plugin %s", commentId, identifier);
4744
+ log25("Comment %d deleted from plugin %s", commentId, identifier);
4633
4745
  return result;
4634
4746
  }
4635
4747
  // ============================================================================
@@ -4644,7 +4756,7 @@ var PluginsService = class extends BaseSDK {
4644
4756
  * @returns Promise resolving to the created reaction
4645
4757
  */
4646
4758
  async addReaction(commentId, type, options) {
4647
- log24("Adding %s reaction to comment %d", type, commentId);
4759
+ log25("Adding %s reaction to comment %d", type, commentId);
4648
4760
  const result = await this.request(
4649
4761
  `/v1/plugins/comments/${commentId}/reactions`,
4650
4762
  {
@@ -4653,7 +4765,7 @@ var PluginsService = class extends BaseSDK {
4653
4765
  method: "POST"
4654
4766
  }
4655
4767
  );
4656
- log24("Reaction added to comment %d: %s (id=%d)", commentId, result.type, result.id);
4768
+ log25("Reaction added to comment %d: %s (id=%d)", commentId, result.type, result.id);
4657
4769
  return result;
4658
4770
  }
4659
4771
  /**
@@ -4664,7 +4776,7 @@ var PluginsService = class extends BaseSDK {
4664
4776
  * @returns Promise resolving to success status
4665
4777
  */
4666
4778
  async removeReaction(commentId, options) {
4667
- log24("Removing reaction from comment %d", commentId);
4779
+ log25("Removing reaction from comment %d", commentId);
4668
4780
  const result = await this.request(
4669
4781
  `/v1/plugins/comments/${commentId}/reactions`,
4670
4782
  {
@@ -4672,14 +4784,14 @@ var PluginsService = class extends BaseSDK {
4672
4784
  method: "DELETE"
4673
4785
  }
4674
4786
  );
4675
- log24("Reaction removed from comment %d", commentId);
4787
+ log25("Reaction removed from comment %d", commentId);
4676
4788
  return result;
4677
4789
  }
4678
4790
  };
4679
4791
 
4680
4792
  // src/market/services/SandboxService.ts
4681
- import debug25 from "debug";
4682
- var log25 = debug25("lobe-market-sdk:sandbox");
4793
+ import debug26 from "debug";
4794
+ var log26 = debug26("lobe-market-sdk:sandbox");
4683
4795
  function encodeBase642(input) {
4684
4796
  if (typeof Buffer !== "undefined") {
4685
4797
  return Buffer.from(input, "utf8").toString("base64");
@@ -4713,7 +4825,7 @@ var SandboxService = class extends BaseSDK {
4713
4825
  */
4714
4826
  async run(params, options) {
4715
4827
  const { script, ...rest } = params;
4716
- log25(
4828
+ log26(
4717
4829
  "Running %s sandbox script for %s %s",
4718
4830
  params.runtime,
4719
4831
  params.subject.kind,
@@ -4729,8 +4841,8 @@ var SandboxService = class extends BaseSDK {
4729
4841
  };
4730
4842
 
4731
4843
  // src/market/services/SandboxStorageService.ts
4732
- import debug26 from "debug";
4733
- var log26 = debug26("lobe-market-sdk:sandbox-storage");
4844
+ import debug27 from "debug";
4845
+ var log27 = debug27("lobe-market-sdk:sandbox-storage");
4734
4846
  var SandboxStorageService2 = class extends BaseSDK {
4735
4847
  /**
4736
4848
  * Storage directory, quota and the last measured usage.
@@ -4739,7 +4851,7 @@ var SandboxStorageService2 = class extends BaseSDK {
4739
4851
  * with its stored figure (`workspaceDrives`), in this one read.
4740
4852
  */
4741
4853
  async getStorage(key = "current", options, query) {
4742
- log26("Getting sandbox storage: %s", key);
4854
+ log27("Getting sandbox storage: %s", key);
4743
4855
  const suffix = (query == null ? void 0 : query.drives) ? "?drives=true" : "";
4744
4856
  const result = await this.request(
4745
4857
  `/v1/sandbox/storages/${encodeURIComponent(key)}${suffix}`,
@@ -4752,7 +4864,7 @@ var SandboxStorageService2 = class extends BaseSDK {
4752
4864
  * whole directory, so call it on demand rather than on every render.
4753
4865
  */
4754
4866
  async refreshUsage(key = "current", context2 = {}, options) {
4755
- log26("Refreshing sandbox storage usage: %s", key);
4867
+ log27("Refreshing sandbox storage usage: %s", key);
4756
4868
  const result = await this.request(
4757
4869
  `/v1/sandbox/storages/${encodeURIComponent(key)}/usage`,
4758
4870
  { ...options, body: JSON.stringify(context2), method: "POST" }
@@ -4761,7 +4873,7 @@ var SandboxStorageService2 = class extends BaseSDK {
4761
4873
  }
4762
4874
  async listFiles(params = {}, options) {
4763
4875
  const { key = "current", path, recursive, topicId } = params;
4764
- log26("Listing sandbox storage files: %s/%s", key, path != null ? path : "");
4876
+ log27("Listing sandbox storage files: %s/%s", key, path != null ? path : "");
4765
4877
  const query = new URLSearchParams();
4766
4878
  if (path) query.set("path", path);
4767
4879
  if (recursive) query.set("recursive", "true");
@@ -4774,7 +4886,7 @@ var SandboxStorageService2 = class extends BaseSDK {
4774
4886
  }
4775
4887
  async readFile(params, options) {
4776
4888
  const { key = "current", path, topicId } = params;
4777
- log26("Reading sandbox storage file: %s/%s", key, path);
4889
+ log27("Reading sandbox storage file: %s/%s", key, path);
4778
4890
  const query = new URLSearchParams({ path });
4779
4891
  if (topicId) query.set("topicId", topicId);
4780
4892
  const result = await this.request(
@@ -4785,7 +4897,7 @@ var SandboxStorageService2 = class extends BaseSDK {
4785
4897
  }
4786
4898
  async writeFile(params, options) {
4787
4899
  const { content, key = "current", path, topicId } = params;
4788
- log26("Writing sandbox storage file: %s/%s (%d bytes)", key, path, content.length);
4900
+ log27("Writing sandbox storage file: %s/%s (%d bytes)", key, path, content.length);
4789
4901
  const result = await this.request(
4790
4902
  `/v1/sandbox/storages/${encodeURIComponent(key)}/file`,
4791
4903
  {
@@ -4796,6 +4908,58 @@ var SandboxStorageService2 = class extends BaseSDK {
4796
4908
  );
4797
4909
  return result.data;
4798
4910
  }
4911
+ /**
4912
+ * Copy one file as it is, or one folder as a zip, to a presigned upload URL
4913
+ * — read off the volume without a sandbox session, which is what lets it
4914
+ * serve a shared storage at its root. Refusals carry `EXPORT_*` codes; a
4915
+ * deployment that cannot export answers 501 `EXPORT_UNAVAILABLE`.
4916
+ */
4917
+ async exportFile(params, options) {
4918
+ const { key = "current", ...body } = params;
4919
+ log27("Exporting sandbox storage path: %s/%s", key, body.path);
4920
+ const result = await this.request(
4921
+ `/v1/sandbox/storages/${encodeURIComponent(key)}/export`,
4922
+ {
4923
+ ...options,
4924
+ body: JSON.stringify(body),
4925
+ method: "POST"
4926
+ }
4927
+ );
4928
+ return result.data;
4929
+ }
4930
+ /**
4931
+ * What takes the space: bytes per category, the largest items of each, and
4932
+ * the largest files and directories. Each call advances the walk by at most
4933
+ * one step; call again while `status` is `scanning` or `running`. A finished
4934
+ * analysis is reused for 15 minutes unless `restart` is set. Served off the
4935
+ * volume and allowed over quota; a deployment that cannot analyse answers
4936
+ * 409 `storage_analysis_unavailable`.
4937
+ */
4938
+ async analyzeStorage(params = {}, options) {
4939
+ const { key = "current", ...body } = params;
4940
+ log27("Analysing sandbox storage: %s", key);
4941
+ const result = await this.request(
4942
+ `/v1/sandbox/storages/${encodeURIComponent(key)}/analysis`,
4943
+ { ...options, body: JSON.stringify(body), method: "POST" }
4944
+ );
4945
+ return result.data;
4946
+ }
4947
+ /**
4948
+ * Irreversibly delete up to 100 storage-relative paths. With
4949
+ * `regenerableOnly`, the whole call is refused (400
4950
+ * `storage_paths_not_regenerable`, offending paths in `details.paths`)
4951
+ * unless every path is dependencies, a cache or build output. `done: false`
4952
+ * means time ran out: call again with `pending`.
4953
+ */
4954
+ async deleteFiles(params, options) {
4955
+ const { key = "current", ...body } = params;
4956
+ log27("Deleting %d sandbox storage paths: %s", body.paths.length, key);
4957
+ const result = await this.request(
4958
+ `/v1/sandbox/storages/${encodeURIComponent(key)}/files/delete`,
4959
+ { ...options, body: JSON.stringify(body), method: "POST" }
4960
+ );
4961
+ return result.data;
4962
+ }
4799
4963
  /**
4800
4964
  * The storage's instances, newest first.
4801
4965
  *
@@ -4879,7 +5043,7 @@ var SandboxStorageService2 = class extends BaseSDK {
4879
5043
  */
4880
5044
  async createDirectory(params, options) {
4881
5045
  const { key = "current", path, topicId } = params;
4882
- log26("Creating sandbox storage directory: %s/%s", key, path);
5046
+ log27("Creating sandbox storage directory: %s/%s", key, path);
4883
5047
  const result = await this.request(
4884
5048
  `/v1/sandbox/storages/${encodeURIComponent(key)}/directory`,
4885
5049
  {
@@ -4892,7 +5056,7 @@ var SandboxStorageService2 = class extends BaseSDK {
4892
5056
  }
4893
5057
  async deleteFile(params, options) {
4894
5058
  const { key = "current", path, recursive, topicId } = params;
4895
- log26("Deleting sandbox storage path: %s/%s", key, path);
5059
+ log27("Deleting sandbox storage path: %s/%s", key, path);
4896
5060
  const query = new URLSearchParams({ path });
4897
5061
  if (recursive) query.set("recursive", "true");
4898
5062
  if (topicId) query.set("topicId", topicId);
@@ -4912,7 +5076,7 @@ var SandboxStorageService2 = class extends BaseSDK {
4912
5076
  */
4913
5077
  async renameFile(params, options) {
4914
5078
  const { key = "current", newPath, path, topicId } = params;
4915
- log26("Renaming sandbox storage path: %s/%s -> %s", key, path, newPath);
5079
+ log27("Renaming sandbox storage path: %s/%s -> %s", key, path, newPath);
4916
5080
  const result = await this.request(
4917
5081
  `/v1/sandbox/storages/${encodeURIComponent(key)}/rename`,
4918
5082
  {
@@ -4926,8 +5090,8 @@ var SandboxStorageService2 = class extends BaseSDK {
4926
5090
  };
4927
5091
 
4928
5092
  // src/market/services/SkillService.ts
4929
- import debug27 from "debug";
4930
- var log27 = debug27("lobe-market-sdk:skill");
5093
+ import debug28 from "debug";
5094
+ var log28 = debug28("lobe-market-sdk:skill");
4931
5095
  var SkillService2 = class extends BaseSDK {
4932
5096
  /**
4933
5097
  * Lists all available skill providers
@@ -4940,9 +5104,9 @@ var SkillService2 = class extends BaseSDK {
4940
5104
  */
4941
5105
  async listProviders(options) {
4942
5106
  var _a;
4943
- log27("Listing skill providers");
5107
+ log28("Listing skill providers");
4944
5108
  const result = await this.request("/v1/skill/providers", options);
4945
- log27("Found %d skill providers", ((_a = result.providers) == null ? void 0 : _a.length) || 0);
5109
+ log28("Found %d skill providers", ((_a = result.providers) == null ? void 0 : _a.length) || 0);
4946
5110
  return result;
4947
5111
  }
4948
5112
  /**
@@ -4957,12 +5121,12 @@ var SkillService2 = class extends BaseSDK {
4957
5121
  */
4958
5122
  async listTools(provider, options) {
4959
5123
  var _a;
4960
- log27("Listing tools for provider: %s", provider);
5124
+ log28("Listing tools for provider: %s", provider);
4961
5125
  const result = await this.request(
4962
5126
  `/v1/skill/${encodeURIComponent(provider)}/tools`,
4963
5127
  options
4964
5128
  );
4965
- log27("Found %d tools for provider %s", ((_a = result.tools) == null ? void 0 : _a.length) || 0, provider);
5129
+ log28("Found %d tools for provider %s", ((_a = result.tools) == null ? void 0 : _a.length) || 0, provider);
4966
5130
  return result;
4967
5131
  }
4968
5132
  /**
@@ -4979,12 +5143,12 @@ var SkillService2 = class extends BaseSDK {
4979
5143
  */
4980
5144
  async listLiveTools(provider, options) {
4981
5145
  var _a;
4982
- log27("Listing live tools for provider: %s", provider);
5146
+ log28("Listing live tools for provider: %s", provider);
4983
5147
  const result = await this.request(
4984
5148
  `/v1/skill/${encodeURIComponent(provider)}/tools/live`,
4985
5149
  options
4986
5150
  );
4987
- log27("Found %d live tools for provider %s", ((_a = result.tools) == null ? void 0 : _a.length) || 0, provider);
5151
+ log28("Found %d live tools for provider %s", ((_a = result.tools) == null ? void 0 : _a.length) || 0, provider);
4988
5152
  return result;
4989
5153
  }
4990
5154
  /**
@@ -5000,12 +5164,12 @@ var SkillService2 = class extends BaseSDK {
5000
5164
  */
5001
5165
  async getTool(provider, toolName, options) {
5002
5166
  var _a;
5003
- log27("Getting tool %s from provider %s", toolName, provider);
5167
+ log28("Getting tool %s from provider %s", toolName, provider);
5004
5168
  const result = await this.request(
5005
5169
  `/v1/skill/${encodeURIComponent(provider)}/tool/${encodeURIComponent(toolName)}`,
5006
5170
  options
5007
5171
  );
5008
- log27("Retrieved tool: %s", (_a = result.tool) == null ? void 0 : _a.name);
5172
+ log28("Retrieved tool: %s", (_a = result.tool) == null ? void 0 : _a.name);
5009
5173
  return result;
5010
5174
  }
5011
5175
  /**
@@ -5019,12 +5183,12 @@ var SkillService2 = class extends BaseSDK {
5019
5183
  * @returns Promise resolving to the connection status
5020
5184
  */
5021
5185
  async getStatus(provider, options) {
5022
- log27("Getting status for provider: %s", provider);
5186
+ log28("Getting status for provider: %s", provider);
5023
5187
  const result = await this.request(
5024
5188
  `/v1/skill/${encodeURIComponent(provider)}/status`,
5025
5189
  options
5026
5190
  );
5027
- log27("Provider %s status: connected=%s", provider, result.connected);
5191
+ log28("Provider %s status: connected=%s", provider, result.connected);
5028
5192
  return result;
5029
5193
  }
5030
5194
  /**
@@ -5052,7 +5216,7 @@ var SkillService2 = class extends BaseSDK {
5052
5216
  * ```
5053
5217
  */
5054
5218
  async callTool(provider, params, options) {
5055
- log27("Calling tool %s on provider %s", params.tool, provider);
5219
+ log28("Calling tool %s on provider %s", params.tool, provider);
5056
5220
  const { args, tool, ...rest } = params;
5057
5221
  const result = await this.request(
5058
5222
  `/v1/skill/${encodeURIComponent(provider)}/call`,
@@ -5069,14 +5233,14 @@ var SkillService2 = class extends BaseSDK {
5069
5233
  ...options
5070
5234
  }
5071
5235
  );
5072
- log27("Tool %s call completed: success=%s", params.tool, result.success);
5236
+ log28("Tool %s call completed: success=%s", params.tool, result.success);
5073
5237
  return result;
5074
5238
  }
5075
5239
  };
5076
5240
 
5077
5241
  // src/market/services/MarketTaskTemplateService.ts
5078
- import debug28 from "debug";
5079
- var log28 = debug28("lobe-market-sdk:task-templates");
5242
+ import debug29 from "debug";
5243
+ var log29 = debug29("lobe-market-sdk:task-templates");
5080
5244
  var MarketTaskTemplateService = class extends BaseSDK {
5081
5245
  /**
5082
5246
  * Retrieves personalized task template recommendations.
@@ -5099,7 +5263,7 @@ var MarketTaskTemplateService = class extends BaseSDK {
5099
5263
  refreshSeed: params.refreshSeed,
5100
5264
  seedKey: params.seedKey
5101
5265
  };
5102
- log28("Getting task template recommendations: %O", body);
5266
+ log29("Getting task template recommendations: %O", body);
5103
5267
  const result = await this.request(
5104
5268
  "/v1/task-templates/recommendations",
5105
5269
  {
@@ -5108,14 +5272,14 @@ var MarketTaskTemplateService = class extends BaseSDK {
5108
5272
  method: "POST"
5109
5273
  }
5110
5274
  );
5111
- log28("Retrieved %d task template recommendations", result.items.length);
5275
+ log29("Retrieved %d task template recommendations", result.items.length);
5112
5276
  return result;
5113
5277
  }
5114
5278
  };
5115
5279
 
5116
5280
  // src/market/services/MarketSkillCollectionService.ts
5117
- import debug29 from "debug";
5118
- var log29 = debug29("lobe-market-sdk:skill-collections");
5281
+ import debug30 from "debug";
5282
+ var log30 = debug30("lobe-market-sdk:skill-collections");
5119
5283
  var MarketSkillCollectionService = class extends BaseSDK {
5120
5284
  async getSkillCollectionDetail(slug, params = {}, options) {
5121
5285
  const locale = params.locale || this.defaultLocale;
@@ -5124,12 +5288,12 @@ var MarketSkillCollectionService = class extends BaseSDK {
5124
5288
  locale
5125
5289
  };
5126
5290
  const queryString = this.buildQueryString(queryParams);
5127
- log29("Getting skill collection detail: %s %O", slug, queryParams);
5291
+ log30("Getting skill collection detail: %s %O", slug, queryParams);
5128
5292
  const result = await this.request(
5129
5293
  `/v1/skills/collections/${encodeURIComponent(slug)}${queryString}`,
5130
5294
  options
5131
5295
  );
5132
- log29("Skill collection detail retrieved: %s (%d items)", slug, result.items.length);
5296
+ log30("Skill collection detail retrieved: %s (%d items)", slug, result.items.length);
5133
5297
  return result;
5134
5298
  }
5135
5299
  async getSkillCollections(params = {}, options) {
@@ -5139,19 +5303,19 @@ var MarketSkillCollectionService = class extends BaseSDK {
5139
5303
  locale
5140
5304
  };
5141
5305
  const queryString = this.buildQueryString(queryParams);
5142
- log29("Getting skill collections: %O", queryParams);
5306
+ log30("Getting skill collections: %O", queryParams);
5143
5307
  const result = await this.request(
5144
5308
  `/v1/skills/collections${queryString}`,
5145
5309
  options
5146
5310
  );
5147
- log29("Retrieved %d skill collections", result.length);
5311
+ log30("Retrieved %d skill collections", result.length);
5148
5312
  return result;
5149
5313
  }
5150
5314
  };
5151
5315
 
5152
5316
  // src/market/services/MarketSkillService.ts
5153
- import debug30 from "debug";
5154
- var log30 = debug30("lobe-market-sdk:market-skills");
5317
+ import debug31 from "debug";
5318
+ var log31 = debug31("lobe-market-sdk:market-skills");
5155
5319
  var MarketSkillService = class extends BaseSDK {
5156
5320
  /**
5157
5321
  * Retrieves a list of skills from the marketplace
@@ -5186,9 +5350,9 @@ var MarketSkillService = class extends BaseSDK {
5186
5350
  const locale = params.locale || this.defaultLocale;
5187
5351
  const queryParams = { ...params, locale };
5188
5352
  const queryString = this.buildQueryString(queryParams);
5189
- log30("Getting skill list: %O", queryParams);
5353
+ log31("Getting skill list: %O", queryParams);
5190
5354
  const result = await this.request(`/v1/skills${queryString}`, options);
5191
- log30(
5355
+ log31(
5192
5356
  "Retrieved %d skills (page %d/%d)",
5193
5357
  result.items.length,
5194
5358
  result.currentPage,
@@ -5227,12 +5391,12 @@ var MarketSkillService = class extends BaseSDK {
5227
5391
  queryParams.version = params.version;
5228
5392
  }
5229
5393
  const queryString = this.buildQueryString(queryParams);
5230
- log30("Getting skill detail: %s %O", identifier, params);
5394
+ log31("Getting skill detail: %s %O", identifier, params);
5231
5395
  const result = await this.request(
5232
5396
  `/v1/skills/${encodeURIComponent(identifier)}${queryString}`,
5233
5397
  options
5234
5398
  );
5235
- log30("Skill detail retrieved: %s (v%s)", identifier, result.version);
5399
+ log31("Skill detail retrieved: %s (v%s)", identifier, result.version);
5236
5400
  return result;
5237
5401
  }
5238
5402
  /**
@@ -5263,7 +5427,7 @@ var MarketSkillService = class extends BaseSDK {
5263
5427
  if (version) {
5264
5428
  url += `?version=${encodeURIComponent(version)}`;
5265
5429
  }
5266
- log30("Generated download URL: %s", url);
5430
+ log31("Generated download URL: %s", url);
5267
5431
  return url;
5268
5432
  }
5269
5433
  /**
@@ -5287,7 +5451,7 @@ var MarketSkillService = class extends BaseSDK {
5287
5451
  * ```
5288
5452
  */
5289
5453
  async downloadSkill(identifier, version, options) {
5290
- log30("Downloading skill: %s (version: %s)", identifier, version || "latest");
5454
+ log31("Downloading skill: %s (version: %s)", identifier, version || "latest");
5291
5455
  const queryParams = {};
5292
5456
  if (version) {
5293
5457
  queryParams.version = version;
@@ -5303,7 +5467,7 @@ var MarketSkillService = class extends BaseSDK {
5303
5467
  });
5304
5468
  if (!response.ok) {
5305
5469
  const errorText = await response.text();
5306
- log30("Download failed: %s %s", response.status, errorText);
5470
+ log31("Download failed: %s %s", response.status, errorText);
5307
5471
  throw new Error(`Failed to download skill: ${response.statusText}`);
5308
5472
  }
5309
5473
  const contentDisposition = response.headers.get("content-disposition");
@@ -5315,7 +5479,7 @@ var MarketSkillService = class extends BaseSDK {
5315
5479
  }
5316
5480
  }
5317
5481
  const buffer = await response.arrayBuffer();
5318
- log30("Downloaded skill: %s (%d bytes)", filename, buffer.byteLength);
5482
+ log31("Downloaded skill: %s (%d bytes)", filename, buffer.byteLength);
5319
5483
  return { buffer, filename };
5320
5484
  }
5321
5485
  /**
@@ -5343,12 +5507,12 @@ var MarketSkillService = class extends BaseSDK {
5343
5507
  const locale = params.locale || this.defaultLocale;
5344
5508
  const queryParams = { ...params, locale };
5345
5509
  const queryString = this.buildQueryString(queryParams);
5346
- log30("Getting skill categories: %O", queryParams);
5510
+ log31("Getting skill categories: %O", queryParams);
5347
5511
  const result = await this.request(
5348
5512
  `/v1/skills/categories${queryString}`,
5349
5513
  options
5350
5514
  );
5351
- log30("Retrieved %d categories", result.length);
5515
+ log31("Retrieved %d categories", result.length);
5352
5516
  return result;
5353
5517
  }
5354
5518
  /**
@@ -5363,12 +5527,12 @@ var MarketSkillService = class extends BaseSDK {
5363
5527
  * @returns Promise resolving to an array of identifiers with last modified times
5364
5528
  */
5365
5529
  async getPublishedIdentifiers(options) {
5366
- log30("Getting published skill identifiers");
5530
+ log31("Getting published skill identifiers");
5367
5531
  const result = await this.request(
5368
5532
  "/v1/skills/identifiers",
5369
5533
  options
5370
5534
  );
5371
- log30("Retrieved %d published skill identifiers", result.length);
5535
+ log31("Retrieved %d published skill identifiers", result.length);
5372
5536
  return result;
5373
5537
  }
5374
5538
  /**
@@ -5379,9 +5543,9 @@ var MarketSkillService = class extends BaseSDK {
5379
5543
  */
5380
5544
  async getSitemap(params = {}, options) {
5381
5545
  const queryString = this.buildQueryString(params);
5382
- log30("Getting skill sitemap%s", queryString);
5546
+ log31("Getting skill sitemap%s", queryString);
5383
5547
  const result = await this.request(`/v1/skills/sitemap${queryString}`, options);
5384
- log30(
5548
+ log31(
5385
5549
  "Retrieved skill sitemap page %d/%d (%d items)",
5386
5550
  result.currentPage,
5387
5551
  result.totalPages,
@@ -5397,13 +5561,13 @@ var MarketSkillService = class extends BaseSDK {
5397
5561
  * @returns Promise resolving to true if skill exists, false otherwise
5398
5562
  */
5399
5563
  async checkSkillExists(identifier, options) {
5400
- log30("Checking if skill exists: %s", identifier);
5564
+ log31("Checking if skill exists: %s", identifier);
5401
5565
  try {
5402
5566
  await this.getSkillDetail(identifier, {}, options);
5403
- log30("Skill exists: %s", identifier);
5567
+ log31("Skill exists: %s", identifier);
5404
5568
  return true;
5405
5569
  } catch (e) {
5406
- log30("Skill does not exist: %s", identifier);
5570
+ log31("Skill does not exist: %s", identifier);
5407
5571
  return false;
5408
5572
  }
5409
5573
  }
@@ -5424,12 +5588,12 @@ var MarketSkillService = class extends BaseSDK {
5424
5588
  * ```
5425
5589
  */
5426
5590
  async getSkillVersions(identifier, options) {
5427
- log30("Getting skill versions: %s", identifier);
5591
+ log31("Getting skill versions: %s", identifier);
5428
5592
  const result = await this.request(
5429
5593
  `/v1/skills/${encodeURIComponent(identifier)}/versions`,
5430
5594
  options
5431
5595
  );
5432
- log30("Retrieved %d versions for skill %s", result.data.length, identifier);
5596
+ log31("Retrieved %d versions for skill %s", result.data.length, identifier);
5433
5597
  return result.data;
5434
5598
  }
5435
5599
  /**
@@ -5453,12 +5617,12 @@ var MarketSkillService = class extends BaseSDK {
5453
5617
  const locale = params.locale || this.defaultLocale;
5454
5618
  const queryParams = { locale };
5455
5619
  const queryString = this.buildQueryString(queryParams);
5456
- log30("Getting skill version: %s@%s", identifier, version);
5620
+ log31("Getting skill version: %s@%s", identifier, version);
5457
5621
  const result = await this.request(
5458
5622
  `/v1/skills/${encodeURIComponent(identifier)}/versions/${encodeURIComponent(version)}${queryString}`,
5459
5623
  options
5460
5624
  );
5461
- log30("Skill version detail retrieved: %s@%s", identifier, version);
5625
+ log31("Skill version detail retrieved: %s@%s", identifier, version);
5462
5626
  return result;
5463
5627
  }
5464
5628
  /**
@@ -5487,13 +5651,13 @@ var MarketSkillService = class extends BaseSDK {
5487
5651
  * ```
5488
5652
  */
5489
5653
  async reportGitHubSkill(params, options) {
5490
- log30("Reporting GitHub skill: %s", params.gitUrl);
5654
+ log31("Reporting GitHub skill: %s", params.gitUrl);
5491
5655
  const result = await this.request("/v1/skills/report/github", {
5492
5656
  ...options,
5493
5657
  body: JSON.stringify(params),
5494
5658
  method: "POST"
5495
5659
  });
5496
- log30("GitHub skill reported: %s (status: %s)", result.identifier, result.status);
5660
+ log31("GitHub skill reported: %s (status: %s)", result.identifier, result.status);
5497
5661
  return result;
5498
5662
  }
5499
5663
  /**
@@ -5518,7 +5682,7 @@ var MarketSkillService = class extends BaseSDK {
5518
5682
  * ```
5519
5683
  */
5520
5684
  async reportSkillInstall(params, options) {
5521
- log30("Reporting skill install: %s (success: %s)", params.identifier, params.success);
5685
+ log31("Reporting skill install: %s (success: %s)", params.identifier, params.success);
5522
5686
  const result = await this.request(
5523
5687
  "/v1/skills/report/installation",
5524
5688
  {
@@ -5527,7 +5691,7 @@ var MarketSkillService = class extends BaseSDK {
5527
5691
  method: "POST"
5528
5692
  }
5529
5693
  );
5530
- log30("Skill install reported: %s", result.message);
5694
+ log31("Skill install reported: %s", result.message);
5531
5695
  return result;
5532
5696
  }
5533
5697
  /**
@@ -5539,7 +5703,7 @@ var MarketSkillService = class extends BaseSDK {
5539
5703
  * @returns Promise resolving to the submitted score
5540
5704
  */
5541
5705
  async submitRating(identifier, score, options) {
5542
- log30("Submitting rating for skill %s: %d", identifier, score);
5706
+ log31("Submitting rating for skill %s: %d", identifier, score);
5543
5707
  const result = await this.request(
5544
5708
  `/v1/skills/${encodeURIComponent(identifier)}/ratings`,
5545
5709
  {
@@ -5548,7 +5712,7 @@ var MarketSkillService = class extends BaseSDK {
5548
5712
  method: "POST"
5549
5713
  }
5550
5714
  );
5551
- log30("Rating submitted for skill %s: %d", identifier, result.score);
5715
+ log31("Rating submitted for skill %s: %d", identifier, result.score);
5552
5716
  return result;
5553
5717
  }
5554
5718
  /**
@@ -5559,12 +5723,12 @@ var MarketSkillService = class extends BaseSDK {
5559
5723
  * @returns Promise resolving to the rating distribution
5560
5724
  */
5561
5725
  async getRatingDistribution(identifier, options) {
5562
- log30("Getting rating distribution for skill: %s", identifier);
5726
+ log31("Getting rating distribution for skill: %s", identifier);
5563
5727
  const result = await this.request(
5564
5728
  `/v1/skills/${encodeURIComponent(identifier)}/ratings/distribution`,
5565
5729
  options
5566
5730
  );
5567
- log30("Rating distribution retrieved for skill %s: %d total", identifier, result.totalCount);
5731
+ log31("Rating distribution retrieved for skill %s: %d total", identifier, result.totalCount);
5568
5732
  return result;
5569
5733
  }
5570
5734
  /**
@@ -5577,12 +5741,12 @@ var MarketSkillService = class extends BaseSDK {
5577
5741
  */
5578
5742
  async getComments(identifier, params = {}, options) {
5579
5743
  const queryString = this.buildQueryString(params);
5580
- log30("Getting comments for skill %s: %O", identifier, params);
5744
+ log31("Getting comments for skill %s: %O", identifier, params);
5581
5745
  const result = await this.request(
5582
5746
  `/v1/skills/${encodeURIComponent(identifier)}/comments${queryString}`,
5583
5747
  options
5584
5748
  );
5585
- log30(
5749
+ log31(
5586
5750
  "Retrieved %d comments for skill %s (page %d/%d)",
5587
5751
  result.items.length,
5588
5752
  identifier,
@@ -5599,15 +5763,15 @@ var MarketSkillService = class extends BaseSDK {
5599
5763
  * @returns Promise resolving to the latest own comment or null when none exists
5600
5764
  */
5601
5765
  async getLatestOwnComment(identifier, options) {
5602
- log30("Getting latest own comment for skill %s", identifier);
5766
+ log31("Getting latest own comment for skill %s", identifier);
5603
5767
  const result = await this.request(
5604
5768
  `/v1/skills/${encodeURIComponent(identifier)}/comments/latest`,
5605
5769
  options
5606
5770
  );
5607
5771
  if (result) {
5608
- log30("Retrieved latest own comment for skill %s: id=%d", identifier, result.id);
5772
+ log31("Retrieved latest own comment for skill %s: id=%d", identifier, result.id);
5609
5773
  } else {
5610
- log30("No own comments found for skill %s", identifier);
5774
+ log31("No own comments found for skill %s", identifier);
5611
5775
  }
5612
5776
  return result;
5613
5777
  }
@@ -5620,7 +5784,7 @@ var MarketSkillService = class extends BaseSDK {
5620
5784
  * @returns Promise resolving to the created comment (with optional rating field)
5621
5785
  */
5622
5786
  async createComment(identifier, data, options) {
5623
- log30("Creating comment on skill %s", identifier);
5787
+ log31("Creating comment on skill %s", identifier);
5624
5788
  const result = await this.request(
5625
5789
  `/v1/skills/${encodeURIComponent(identifier)}/comments`,
5626
5790
  {
@@ -5629,7 +5793,7 @@ var MarketSkillService = class extends BaseSDK {
5629
5793
  method: "POST"
5630
5794
  }
5631
5795
  );
5632
- log30("Comment created on skill %s: id=%d", identifier, result.id);
5796
+ log31("Comment created on skill %s: id=%d", identifier, result.id);
5633
5797
  return result;
5634
5798
  }
5635
5799
  /**
@@ -5641,7 +5805,7 @@ var MarketSkillService = class extends BaseSDK {
5641
5805
  * @returns Promise resolving to success status
5642
5806
  */
5643
5807
  async deleteComment(identifier, commentId, options) {
5644
- log30("Deleting comment %d from skill %s", commentId, identifier);
5808
+ log31("Deleting comment %d from skill %s", commentId, identifier);
5645
5809
  const result = await this.request(
5646
5810
  `/v1/skills/${encodeURIComponent(identifier)}/comments/${commentId}`,
5647
5811
  {
@@ -5649,7 +5813,7 @@ var MarketSkillService = class extends BaseSDK {
5649
5813
  method: "DELETE"
5650
5814
  }
5651
5815
  );
5652
- log30("Comment %d deleted from skill %s", commentId, identifier);
5816
+ log31("Comment %d deleted from skill %s", commentId, identifier);
5653
5817
  return result;
5654
5818
  }
5655
5819
  /**
@@ -5661,7 +5825,7 @@ var MarketSkillService = class extends BaseSDK {
5661
5825
  * @returns Promise resolving to the created reaction
5662
5826
  */
5663
5827
  async addReaction(commentId, type, options) {
5664
- log30("Adding %s reaction to comment %d", type, commentId);
5828
+ log31("Adding %s reaction to comment %d", type, commentId);
5665
5829
  const result = await this.request(
5666
5830
  `/v1/skills/comments/${commentId}/reactions`,
5667
5831
  {
@@ -5670,7 +5834,7 @@ var MarketSkillService = class extends BaseSDK {
5670
5834
  method: "POST"
5671
5835
  }
5672
5836
  );
5673
- log30("Reaction added to comment %d: %s (id=%d)", commentId, result.type, result.id);
5837
+ log31("Reaction added to comment %d: %s (id=%d)", commentId, result.type, result.id);
5674
5838
  return result;
5675
5839
  }
5676
5840
  /**
@@ -5681,7 +5845,7 @@ var MarketSkillService = class extends BaseSDK {
5681
5845
  * @returns Promise resolving to success status
5682
5846
  */
5683
5847
  async removeReaction(commentId, options) {
5684
- log30("Removing reaction from comment %d", commentId);
5848
+ log31("Removing reaction from comment %d", commentId);
5685
5849
  const result = await this.request(
5686
5850
  `/v1/skills/comments/${commentId}/reactions`,
5687
5851
  {
@@ -5689,19 +5853,19 @@ var MarketSkillService = class extends BaseSDK {
5689
5853
  method: "DELETE"
5690
5854
  }
5691
5855
  );
5692
- log30("Reaction removed from comment %d", commentId);
5856
+ log31("Reaction removed from comment %d", commentId);
5693
5857
  return result;
5694
5858
  }
5695
5859
  };
5696
5860
 
5697
5861
  // src/market/services/OrganizationCredsService.ts
5698
- import debug31 from "debug";
5862
+ import debug32 from "debug";
5699
5863
 
5700
5864
  // src/utils/orgRef.ts
5701
5865
  var orgRefToPathSegment = (ref) => typeof ref === "number" ? String(ref) : `workspace:${encodeURIComponent(ref.workspaceId)}`;
5702
5866
 
5703
5867
  // src/market/services/OrganizationCredsService.ts
5704
- var log31 = debug31("lobe-market-sdk:org-creds");
5868
+ var log32 = debug32("lobe-market-sdk:org-creds");
5705
5869
  var OrganizationCredsService = class extends BaseSDK {
5706
5870
  constructor(orgId, options = {}, sharedHeaders, sharedTokenState) {
5707
5871
  super(options, sharedHeaders, sharedTokenState);
@@ -5734,9 +5898,9 @@ var OrganizationCredsService = class extends BaseSDK {
5734
5898
  */
5735
5899
  async list(options) {
5736
5900
  var _a;
5737
- log31("Listing org %s credentials", this.orgSegment);
5901
+ log32("Listing org %s credentials", this.orgSegment);
5738
5902
  const result = await this.request(this.base(), options);
5739
- log31("Found %d credentials for org %s", ((_a = result.data) == null ? void 0 : _a.length) || 0, this.orgSegment);
5903
+ log32("Found %d credentials for org %s", ((_a = result.data) == null ? void 0 : _a.length) || 0, this.orgSegment);
5740
5904
  return result;
5741
5905
  }
5742
5906
  /**
@@ -5745,20 +5909,20 @@ var OrganizationCredsService = class extends BaseSDK {
5745
5909
  * owner via `CredService.get(id, { decrypt: true })`.
5746
5910
  */
5747
5911
  async get(id, getOptions, options) {
5748
- log31("Getting org %s credential %d (decrypt=%s)", this.orgSegment, id, getOptions == null ? void 0 : getOptions.decrypt);
5912
+ log32("Getting org %s credential %d (decrypt=%s)", this.orgSegment, id, getOptions == null ? void 0 : getOptions.decrypt);
5749
5913
  const queryString = this.buildQueryString((getOptions == null ? void 0 : getOptions.decrypt) ? { decrypt: "true" } : {});
5750
5914
  const result = await this.request(
5751
5915
  `${this.base()}/${id}${queryString}`,
5752
5916
  options
5753
5917
  );
5754
- log31("Retrieved org credential: %s", result.key);
5918
+ log32("Retrieved org credential: %s", result.key);
5755
5919
  return result;
5756
5920
  }
5757
5921
  // ===========================================================================
5758
5922
  // Create
5759
5923
  // ===========================================================================
5760
5924
  async createKV(data, options) {
5761
- log31("Creating org %s KV credential: %s (type=%s)", this.orgSegment, data.key, data.type);
5925
+ log32("Creating org %s KV credential: %s (type=%s)", this.orgSegment, data.key, data.type);
5762
5926
  return this.request(`${this.base()}/kv`, {
5763
5927
  body: JSON.stringify(data),
5764
5928
  headers: { "Content-Type": "application/json" },
@@ -5767,7 +5931,7 @@ var OrganizationCredsService = class extends BaseSDK {
5767
5931
  });
5768
5932
  }
5769
5933
  async createOAuth(data, options) {
5770
- log31("Creating org %s OAuth credential: %s", this.orgSegment, data.key);
5934
+ log32("Creating org %s OAuth credential: %s", this.orgSegment, data.key);
5771
5935
  return this.request(`${this.base()}/oauth`, {
5772
5936
  body: JSON.stringify(data),
5773
5937
  headers: { "Content-Type": "application/json" },
@@ -5776,7 +5940,7 @@ var OrganizationCredsService = class extends BaseSDK {
5776
5940
  });
5777
5941
  }
5778
5942
  async createFile(data, options) {
5779
- log31("Creating org %s file credential: %s", this.orgSegment, data.key);
5943
+ log32("Creating org %s file credential: %s", this.orgSegment, data.key);
5780
5944
  return this.request(`${this.base()}/file`, {
5781
5945
  body: JSON.stringify(data),
5782
5946
  headers: { "Content-Type": "application/json" },
@@ -5788,7 +5952,7 @@ var OrganizationCredsService = class extends BaseSDK {
5788
5952
  // Update
5789
5953
  // ===========================================================================
5790
5954
  async update(id, data, options) {
5791
- log31("Updating org %s credential %d", this.orgSegment, id);
5955
+ log32("Updating org %s credential %d", this.orgSegment, id);
5792
5956
  return this.request(`${this.base()}/${id}`, {
5793
5957
  body: JSON.stringify(data),
5794
5958
  headers: { "Content-Type": "application/json" },
@@ -5803,7 +5967,7 @@ var OrganizationCredsService = class extends BaseSDK {
5803
5967
  * the same key (`public_cred_exists` / `private_cred_exists`).
5804
5968
  */
5805
5969
  async setVisibility(id, visibility, options) {
5806
- log31("Setting org %s credential %d visibility=%s", this.orgSegment, id, visibility);
5970
+ log32("Setting org %s credential %d visibility=%s", this.orgSegment, id, visibility);
5807
5971
  return this.request(`${this.base()}/${id}/visibility`, {
5808
5972
  body: JSON.stringify({ visibility }),
5809
5973
  headers: { "Content-Type": "application/json" },
@@ -5815,14 +5979,14 @@ var OrganizationCredsService = class extends BaseSDK {
5815
5979
  // Delete
5816
5980
  // ===========================================================================
5817
5981
  async delete(id, options) {
5818
- log31("Deleting org %s credential %d", this.orgSegment, id);
5982
+ log32("Deleting org %s credential %d", this.orgSegment, id);
5819
5983
  return this.request(`${this.base()}/${id}`, {
5820
5984
  method: "DELETE",
5821
5985
  ...options
5822
5986
  });
5823
5987
  }
5824
5988
  async deleteByKey(key, options) {
5825
- log31("Deleting org %s credential by key: %s", this.orgSegment, key);
5989
+ log32("Deleting org %s credential by key: %s", this.orgSegment, key);
5826
5990
  return this.request(`${this.base()}/key/${encodeURIComponent(key)}`, {
5827
5991
  method: "DELETE",
5828
5992
  ...options
@@ -5836,7 +6000,7 @@ var OrganizationCredsService = class extends BaseSDK {
5836
6000
  * the org has bound vs. is missing. Reads only; any org member may call.
5837
6001
  */
5838
6002
  async getSkillCredStatus(skillIdentifier, options) {
5839
- log31("Getting org %s skill cred status: %s", this.orgSegment, skillIdentifier);
6003
+ log32("Getting org %s skill cred status: %s", this.orgSegment, skillIdentifier);
5840
6004
  const path = `/v1/organizations/${this.orgSegment}/skills/${encodeURIComponent(skillIdentifier)}/creds/status`;
5841
6005
  const result = await this.request(
5842
6006
  path,
@@ -5847,8 +6011,8 @@ var OrganizationCredsService = class extends BaseSDK {
5847
6011
  };
5848
6012
 
5849
6013
  // src/market/services/OrganizationService.ts
5850
- import debug32 from "debug";
5851
- var log32 = debug32("lobe-market-sdk:organization");
6014
+ import debug33 from "debug";
6015
+ var log33 = debug33("lobe-market-sdk:organization");
5852
6016
  var OrganizationService2 = class extends BaseSDK {
5853
6017
  constructor(options = {}, sharedHeaders, sharedTokenState) {
5854
6018
  super(options, sharedHeaders, sharedTokenState);
@@ -5896,12 +6060,12 @@ var OrganizationService2 = class extends BaseSDK {
5896
6060
  async getOrganizationInfo(idOrNamespace, params = {}, options) {
5897
6061
  const locale = params.locale || this.defaultLocale;
5898
6062
  const queryString = this.buildQueryString({ locale });
5899
- log32("Getting organization info: %O", { idOrNamespace, ...params });
6063
+ log33("Getting organization info: %O", { idOrNamespace, ...params });
5900
6064
  const result = await this.request(
5901
6065
  `/v1/organizations/info/${idOrNamespace}${queryString}`,
5902
6066
  options
5903
6067
  );
5904
- log32("Organization info retrieved for: %s", idOrNamespace);
6068
+ log33("Organization info retrieved for: %s", idOrNamespace);
5905
6069
  return result;
5906
6070
  }
5907
6071
  /**
@@ -5911,7 +6075,7 @@ var OrganizationService2 = class extends BaseSDK {
5911
6075
  * @returns Promise resolving to the user's organizations
5912
6076
  */
5913
6077
  async listMyOrganizations(options) {
5914
- log32("Listing organizations for current user");
6078
+ log33("Listing organizations for current user");
5915
6079
  const result = await this.request(
5916
6080
  "/v1/organizations/me",
5917
6081
  options
@@ -5929,7 +6093,7 @@ var OrganizationService2 = class extends BaseSDK {
5929
6093
  * @returns The created/existing organization and whether it was newly created
5930
6094
  */
5931
6095
  async createOrganization(data, options) {
5932
- log32("Creating organization: %s", data.clerkId);
6096
+ log33("Creating organization: %s", data.clerkId);
5933
6097
  return this.request("/v1/organizations", {
5934
6098
  ...options,
5935
6099
  body: JSON.stringify(data),
@@ -5944,7 +6108,7 @@ var OrganizationService2 = class extends BaseSDK {
5944
6108
  * @returns The updated organization
5945
6109
  */
5946
6110
  async updateOrganization(orgId, data, options) {
5947
- log32("Updating organization %d: %O", orgId, data);
6111
+ log33("Updating organization %d: %O", orgId, data);
5948
6112
  const result = await this.request(
5949
6113
  `/v1/organizations/${orgRefToPathSegment(orgId)}`,
5950
6114
  {
@@ -5963,7 +6127,7 @@ var OrganizationService2 = class extends BaseSDK {
5963
6127
  * @returns The archived organization
5964
6128
  */
5965
6129
  async archiveOrganization(orgId, options) {
5966
- log32("Archiving organization %d", orgId);
6130
+ log33("Archiving organization %d", orgId);
5967
6131
  const result = await this.request(
5968
6132
  `/v1/organizations/${orgRefToPathSegment(orgId)}/archive`,
5969
6133
  { ...options, method: "POST" }
@@ -5977,7 +6141,7 @@ var OrganizationService2 = class extends BaseSDK {
5977
6141
  * @returns The reactivated organization
5978
6142
  */
5979
6143
  async unarchiveOrganization(orgId, options) {
5980
- log32("Unarchiving organization %d", orgId);
6144
+ log33("Unarchiving organization %d", orgId);
5981
6145
  const result = await this.request(
5982
6146
  `/v1/organizations/${orgRefToPathSegment(orgId)}/unarchive`,
5983
6147
  { ...options, method: "POST" }
@@ -5991,7 +6155,7 @@ var OrganizationService2 = class extends BaseSDK {
5991
6155
  * @returns Hydrated member rows
5992
6156
  */
5993
6157
  async listMembers(orgId, options) {
5994
- log32("Listing members of organization %d", orgId);
6158
+ log33("Listing members of organization %d", orgId);
5995
6159
  const result = await this.request(
5996
6160
  `/v1/organizations/${orgRefToPathSegment(orgId)}/members`,
5997
6161
  options
@@ -6008,7 +6172,7 @@ var OrganizationService2 = class extends BaseSDK {
6008
6172
  * @returns Whether the member was newly added and their effective role
6009
6173
  */
6010
6174
  async addMember(orgId, userAccountId, role, options) {
6011
- log32("Adding member %d to organization %d (role=%s)", userAccountId, orgId, role);
6175
+ log33("Adding member %d to organization %d (role=%s)", userAccountId, orgId, role);
6012
6176
  return this.request(
6013
6177
  `/v1/organizations/${orgRefToPathSegment(orgId)}/members`,
6014
6178
  {
@@ -6027,7 +6191,7 @@ var OrganizationService2 = class extends BaseSDK {
6027
6191
  * @returns Whether a membership row was removed
6028
6192
  */
6029
6193
  async removeMember(orgId, userAccountId, options) {
6030
- log32("Removing member %d from organization %d", userAccountId, orgId);
6194
+ log33("Removing member %d from organization %d", userAccountId, orgId);
6031
6195
  return this.request(
6032
6196
  `/v1/organizations/${orgRefToPathSegment(orgId)}/members/${userAccountId}`,
6033
6197
  { ...options, method: "DELETE" }
@@ -6043,7 +6207,7 @@ var OrganizationService2 = class extends BaseSDK {
6043
6207
  * @returns The effective role and whether it changed
6044
6208
  */
6045
6209
  async updateMemberRole(orgId, userAccountId, role, options) {
6046
- log32("Updating member %d role to %s in organization %d", userAccountId, role, orgId);
6210
+ log33("Updating member %d role to %s in organization %d", userAccountId, role, orgId);
6047
6211
  return this.request(
6048
6212
  `/v1/organizations/${orgRefToPathSegment(orgId)}/members/${userAccountId}`,
6049
6213
  { ...options, body: JSON.stringify({ role }), method: "PATCH" }
@@ -6061,7 +6225,7 @@ var OrganizationService2 = class extends BaseSDK {
6061
6225
  * @returns Counts of added / removed / updated members and skipped ids
6062
6226
  */
6063
6227
  async reconcileMembers(orgId, members, options) {
6064
- log32("Reconciling %d members for organization %d", members.length, orgId);
6228
+ log33("Reconciling %d members for organization %d", members.length, orgId);
6065
6229
  return this.request(
6066
6230
  `/v1/organizations/${orgRefToPathSegment(orgId)}/members`,
6067
6231
  {
@@ -6074,8 +6238,8 @@ var OrganizationService2 = class extends BaseSDK {
6074
6238
  };
6075
6239
 
6076
6240
  // src/market/services/UserService.ts
6077
- import debug33 from "debug";
6078
- var log33 = debug33("lobe-market-sdk:user");
6241
+ import debug34 from "debug";
6242
+ var log34 = debug34("lobe-market-sdk:user");
6079
6243
  var UserService = class extends BaseSDK {
6080
6244
  /**
6081
6245
  * Retrieves user information by account ID or userName
@@ -6092,12 +6256,12 @@ var UserService = class extends BaseSDK {
6092
6256
  const locale = params.locale || this.defaultLocale;
6093
6257
  const queryParams = { locale };
6094
6258
  const queryString = this.buildQueryString(queryParams);
6095
- log33("Getting user info: %O", { idOrUserName, ...params });
6259
+ log34("Getting user info: %O", { idOrUserName, ...params });
6096
6260
  const result = await this.request(
6097
6261
  `/v1/user/info/${idOrUserName}${queryString}`,
6098
6262
  options
6099
6263
  );
6100
- log33("User info successfully retrieved for: %s", idOrUserName);
6264
+ log34("User info successfully retrieved for: %s", idOrUserName);
6101
6265
  return result;
6102
6266
  }
6103
6267
  /**
@@ -6112,7 +6276,7 @@ var UserService = class extends BaseSDK {
6112
6276
  * @throws Error if userName is already taken or update fails
6113
6277
  */
6114
6278
  async updateUserInfo(data, options) {
6115
- log33("Updating user info: %O", data);
6279
+ log34("Updating user info: %O", data);
6116
6280
  const result = await this.request("/v1/user/update", {
6117
6281
  body: JSON.stringify(data),
6118
6282
  headers: {
@@ -6121,7 +6285,7 @@ var UserService = class extends BaseSDK {
6121
6285
  method: "POST",
6122
6286
  ...options
6123
6287
  });
6124
- log33("User info updated successfully");
6288
+ log34("User info updated successfully");
6125
6289
  return result;
6126
6290
  }
6127
6291
  /**
@@ -6151,7 +6315,7 @@ var UserService = class extends BaseSDK {
6151
6315
  * ```
6152
6316
  */
6153
6317
  async register(data, options) {
6154
- log33("Registering user: %O", {
6318
+ log34("Registering user: %O", {
6155
6319
  followUserId: data.followUserId,
6156
6320
  registerUserId: data.registerUserId
6157
6321
  });
@@ -6163,14 +6327,14 @@ var UserService = class extends BaseSDK {
6163
6327
  method: "POST",
6164
6328
  ...options
6165
6329
  });
6166
- log33("User registered successfully: created=%s, userId=%s", result.created, result.user.clerkId);
6330
+ log34("User registered successfully: created=%s, userId=%s", result.created, result.user.clerkId);
6167
6331
  return result;
6168
6332
  }
6169
6333
  };
6170
6334
 
6171
6335
  // src/market/services/UserFollowService.ts
6172
- import debug34 from "debug";
6173
- var log34 = debug34("lobe-market-sdk:user-follow");
6336
+ import debug35 from "debug";
6337
+ var log35 = debug35("lobe-market-sdk:user-follow");
6174
6338
  var UserFollowService = class extends BaseSDK {
6175
6339
  /**
6176
6340
  * Follow a user
@@ -6184,7 +6348,7 @@ var UserFollowService = class extends BaseSDK {
6184
6348
  * @throws Error if already following or cannot follow yourself
6185
6349
  */
6186
6350
  async follow(followingId, options) {
6187
- log34("Following user: %d", followingId);
6351
+ log35("Following user: %d", followingId);
6188
6352
  const body = { followingId };
6189
6353
  const result = await this.request("/v1/user/follows", {
6190
6354
  body: JSON.stringify(body),
@@ -6194,7 +6358,7 @@ var UserFollowService = class extends BaseSDK {
6194
6358
  method: "POST",
6195
6359
  ...options
6196
6360
  });
6197
- log34("Successfully followed user: %d", followingId);
6361
+ log35("Successfully followed user: %d", followingId);
6198
6362
  return result;
6199
6363
  }
6200
6364
  /**
@@ -6209,7 +6373,7 @@ var UserFollowService = class extends BaseSDK {
6209
6373
  * @throws Error if follow relationship not found
6210
6374
  */
6211
6375
  async unfollow(followingId, options) {
6212
- log34("Unfollowing user: %d", followingId);
6376
+ log35("Unfollowing user: %d", followingId);
6213
6377
  const body = { followingId };
6214
6378
  const result = await this.request("/v1/user/follows", {
6215
6379
  body: JSON.stringify(body),
@@ -6219,7 +6383,7 @@ var UserFollowService = class extends BaseSDK {
6219
6383
  method: "DELETE",
6220
6384
  ...options
6221
6385
  });
6222
- log34("Successfully unfollowed user: %d", followingId);
6386
+ log35("Successfully unfollowed user: %d", followingId);
6223
6387
  return result;
6224
6388
  }
6225
6389
  /**
@@ -6233,13 +6397,13 @@ var UserFollowService = class extends BaseSDK {
6233
6397
  * @returns Promise resolving to follow status (isFollowing, isMutual)
6234
6398
  */
6235
6399
  async checkFollowStatus(targetUserId, options) {
6236
- log34("Checking follow status for user: %d", targetUserId);
6400
+ log35("Checking follow status for user: %d", targetUserId);
6237
6401
  const queryString = this.buildQueryString({ targetUserId: String(targetUserId) });
6238
6402
  const result = await this.request(
6239
6403
  `/v1/user/follows/check${queryString}`,
6240
6404
  options
6241
6405
  );
6242
- log34("Follow status retrieved: %O", result);
6406
+ log35("Follow status retrieved: %O", result);
6243
6407
  return result;
6244
6408
  }
6245
6409
  /**
@@ -6254,7 +6418,7 @@ var UserFollowService = class extends BaseSDK {
6254
6418
  * @returns Promise resolving to list of following users
6255
6419
  */
6256
6420
  async getFollowing(userId, params = {}, options) {
6257
- log34("Getting following list for user: %d", userId);
6421
+ log35("Getting following list for user: %d", userId);
6258
6422
  const queryParams = {};
6259
6423
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
6260
6424
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -6263,7 +6427,7 @@ var UserFollowService = class extends BaseSDK {
6263
6427
  `/v1/user/follows/${userId}/following${queryString}`,
6264
6428
  options
6265
6429
  );
6266
- log34("Following list retrieved for user: %d", userId);
6430
+ log35("Following list retrieved for user: %d", userId);
6267
6431
  return result;
6268
6432
  }
6269
6433
  /**
@@ -6278,7 +6442,7 @@ var UserFollowService = class extends BaseSDK {
6278
6442
  * @returns Promise resolving to list of followers
6279
6443
  */
6280
6444
  async getFollowers(userId, params = {}, options) {
6281
- log34("Getting followers list for user: %d", userId);
6445
+ log35("Getting followers list for user: %d", userId);
6282
6446
  const queryParams = {};
6283
6447
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
6284
6448
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -6287,14 +6451,14 @@ var UserFollowService = class extends BaseSDK {
6287
6451
  `/v1/user/follows/${userId}/followers${queryString}`,
6288
6452
  options
6289
6453
  );
6290
- log34("Followers list retrieved for user: %d", userId);
6454
+ log35("Followers list retrieved for user: %d", userId);
6291
6455
  return result;
6292
6456
  }
6293
6457
  };
6294
6458
 
6295
6459
  // src/market/services/UserFavoriteService.ts
6296
- import debug35 from "debug";
6297
- var log35 = debug35("lobe-market-sdk:user-favorite");
6460
+ import debug36 from "debug";
6461
+ var log36 = debug36("lobe-market-sdk:user-favorite");
6298
6462
  var UserFavoriteService = class extends BaseSDK {
6299
6463
  /**
6300
6464
  * Add to favorites
@@ -6309,7 +6473,7 @@ var UserFavoriteService = class extends BaseSDK {
6309
6473
  * @throws Error if already in favorites
6310
6474
  */
6311
6475
  async addFavorite(targetType, targetId, options) {
6312
- log35("Adding favorite: %s %d", targetType, targetId);
6476
+ log36("Adding favorite: %s %d", targetType, targetId);
6313
6477
  const body = { targetId, targetType };
6314
6478
  const result = await this.request("/v1/user/favorites", {
6315
6479
  body: JSON.stringify(body),
@@ -6319,7 +6483,7 @@ var UserFavoriteService = class extends BaseSDK {
6319
6483
  method: "POST",
6320
6484
  ...options
6321
6485
  });
6322
- log35("Successfully added favorite: %s %d", targetType, targetId);
6486
+ log36("Successfully added favorite: %s %d", targetType, targetId);
6323
6487
  return result;
6324
6488
  }
6325
6489
  /**
@@ -6335,7 +6499,7 @@ var UserFavoriteService = class extends BaseSDK {
6335
6499
  * @throws Error if favorite not found
6336
6500
  */
6337
6501
  async removeFavorite(targetType, targetId, options) {
6338
- log35("Removing favorite: %s %d", targetType, targetId);
6502
+ log36("Removing favorite: %s %d", targetType, targetId);
6339
6503
  const body = { targetId, targetType };
6340
6504
  const result = await this.request("/v1/user/favorites", {
6341
6505
  body: JSON.stringify(body),
@@ -6345,7 +6509,7 @@ var UserFavoriteService = class extends BaseSDK {
6345
6509
  method: "DELETE",
6346
6510
  ...options
6347
6511
  });
6348
- log35("Successfully removed favorite: %s %d", targetType, targetId);
6512
+ log36("Successfully removed favorite: %s %d", targetType, targetId);
6349
6513
  return result;
6350
6514
  }
6351
6515
  /**
@@ -6360,7 +6524,7 @@ var UserFavoriteService = class extends BaseSDK {
6360
6524
  * @returns Promise resolving to favorite status
6361
6525
  */
6362
6526
  async checkFavorite(targetType, targetId, options) {
6363
- log35("Checking favorite status: %s %d", targetType, targetId);
6527
+ log36("Checking favorite status: %s %d", targetType, targetId);
6364
6528
  const queryString = this.buildQueryString({
6365
6529
  targetId: String(targetId),
6366
6530
  targetType
@@ -6369,7 +6533,7 @@ var UserFavoriteService = class extends BaseSDK {
6369
6533
  `/v1/user/favorites/check${queryString}`,
6370
6534
  options
6371
6535
  );
6372
- log35("Favorite status retrieved: %O", result);
6536
+ log36("Favorite status retrieved: %O", result);
6373
6537
  return result;
6374
6538
  }
6375
6539
  /**
@@ -6383,7 +6547,7 @@ var UserFavoriteService = class extends BaseSDK {
6383
6547
  * @returns Promise resolving to list of favorites
6384
6548
  */
6385
6549
  async getMyFavorites(params = {}, options) {
6386
- log35("Getting my favorites: %O", params);
6550
+ log36("Getting my favorites: %O", params);
6387
6551
  const queryParams = {};
6388
6552
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
6389
6553
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -6393,7 +6557,7 @@ var UserFavoriteService = class extends BaseSDK {
6393
6557
  `/v1/user/favorites/me${queryString}`,
6394
6558
  options
6395
6559
  );
6396
- log35("My favorites retrieved");
6560
+ log36("My favorites retrieved");
6397
6561
  return result;
6398
6562
  }
6399
6563
  /**
@@ -6408,7 +6572,7 @@ var UserFavoriteService = class extends BaseSDK {
6408
6572
  * @returns Promise resolving to list of favorites
6409
6573
  */
6410
6574
  async getUserFavorites(userId, params = {}, options) {
6411
- log35("Getting favorites for user: %d", userId);
6575
+ log36("Getting favorites for user: %d", userId);
6412
6576
  const queryParams = {};
6413
6577
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
6414
6578
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -6418,7 +6582,7 @@ var UserFavoriteService = class extends BaseSDK {
6418
6582
  `/v1/user/favorites/${userId}${queryString}`,
6419
6583
  options
6420
6584
  );
6421
- log35("Favorites retrieved for user: %d", userId);
6585
+ log36("Favorites retrieved for user: %d", userId);
6422
6586
  return result;
6423
6587
  }
6424
6588
  /**
@@ -6433,7 +6597,7 @@ var UserFavoriteService = class extends BaseSDK {
6433
6597
  * @returns Promise resolving to list of favorite agents
6434
6598
  */
6435
6599
  async getUserFavoriteAgents(userId, params = {}, options) {
6436
- log35("Getting favorite agents for user: %d", userId);
6600
+ log36("Getting favorite agents for user: %d", userId);
6437
6601
  const queryParams = {};
6438
6602
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
6439
6603
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -6442,7 +6606,7 @@ var UserFavoriteService = class extends BaseSDK {
6442
6606
  `/v1/user/favorites/${userId}/agents${queryString}`,
6443
6607
  options
6444
6608
  );
6445
- log35("Favorite agents retrieved for user: %d", userId);
6609
+ log36("Favorite agents retrieved for user: %d", userId);
6446
6610
  return result;
6447
6611
  }
6448
6612
  /**
@@ -6457,7 +6621,7 @@ var UserFavoriteService = class extends BaseSDK {
6457
6621
  * @returns Promise resolving to list of favorite plugins
6458
6622
  */
6459
6623
  async getUserFavoritePlugins(userId, params = {}, options) {
6460
- log35("Getting favorite plugins for user: %d", userId);
6624
+ log36("Getting favorite plugins for user: %d", userId);
6461
6625
  const queryParams = {};
6462
6626
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
6463
6627
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -6466,14 +6630,14 @@ var UserFavoriteService = class extends BaseSDK {
6466
6630
  `/v1/user/favorites/${userId}/plugins${queryString}`,
6467
6631
  options
6468
6632
  );
6469
- log35("Favorite plugins retrieved for user: %d", userId);
6633
+ log36("Favorite plugins retrieved for user: %d", userId);
6470
6634
  return result;
6471
6635
  }
6472
6636
  };
6473
6637
 
6474
6638
  // src/market/services/UserLikeService.ts
6475
- import debug36 from "debug";
6476
- var log36 = debug36("lobe-market-sdk:user-like");
6639
+ import debug37 from "debug";
6640
+ var log37 = debug37("lobe-market-sdk:user-like");
6477
6641
  var UserLikeService = class extends BaseSDK {
6478
6642
  /**
6479
6643
  * Like content
@@ -6488,7 +6652,7 @@ var UserLikeService = class extends BaseSDK {
6488
6652
  * @throws Error if already liked
6489
6653
  */
6490
6654
  async like(targetType, targetId, options) {
6491
- log36("Liking: %s %d", targetType, targetId);
6655
+ log37("Liking: %s %d", targetType, targetId);
6492
6656
  const body = { targetId, targetType };
6493
6657
  const result = await this.request("/v1/user/likes", {
6494
6658
  body: JSON.stringify(body),
@@ -6498,7 +6662,7 @@ var UserLikeService = class extends BaseSDK {
6498
6662
  method: "POST",
6499
6663
  ...options
6500
6664
  });
6501
- log36("Successfully liked: %s %d", targetType, targetId);
6665
+ log37("Successfully liked: %s %d", targetType, targetId);
6502
6666
  return result;
6503
6667
  }
6504
6668
  /**
@@ -6514,7 +6678,7 @@ var UserLikeService = class extends BaseSDK {
6514
6678
  * @throws Error if like not found
6515
6679
  */
6516
6680
  async unlike(targetType, targetId, options) {
6517
- log36("Unliking: %s %d", targetType, targetId);
6681
+ log37("Unliking: %s %d", targetType, targetId);
6518
6682
  const body = { targetId, targetType };
6519
6683
  const result = await this.request("/v1/user/likes", {
6520
6684
  body: JSON.stringify(body),
@@ -6524,7 +6688,7 @@ var UserLikeService = class extends BaseSDK {
6524
6688
  method: "DELETE",
6525
6689
  ...options
6526
6690
  });
6527
- log36("Successfully unliked: %s %d", targetType, targetId);
6691
+ log37("Successfully unliked: %s %d", targetType, targetId);
6528
6692
  return result;
6529
6693
  }
6530
6694
  /**
@@ -6539,7 +6703,7 @@ var UserLikeService = class extends BaseSDK {
6539
6703
  * @returns Promise resolving to toggle response with new like status
6540
6704
  */
6541
6705
  async toggleLike(targetType, targetId, options) {
6542
- log36("Toggling like: %s %d", targetType, targetId);
6706
+ log37("Toggling like: %s %d", targetType, targetId);
6543
6707
  const body = { targetId, targetType };
6544
6708
  const result = await this.request("/v1/user/likes/toggle", {
6545
6709
  body: JSON.stringify(body),
@@ -6549,7 +6713,7 @@ var UserLikeService = class extends BaseSDK {
6549
6713
  method: "POST",
6550
6714
  ...options
6551
6715
  });
6552
- log36("Like toggled, new status: %O", result);
6716
+ log37("Like toggled, new status: %O", result);
6553
6717
  return result;
6554
6718
  }
6555
6719
  /**
@@ -6564,7 +6728,7 @@ var UserLikeService = class extends BaseSDK {
6564
6728
  * @returns Promise resolving to like status
6565
6729
  */
6566
6730
  async checkLike(targetType, targetId, options) {
6567
- log36("Checking like status: %s %d", targetType, targetId);
6731
+ log37("Checking like status: %s %d", targetType, targetId);
6568
6732
  const queryString = this.buildQueryString({
6569
6733
  targetId: String(targetId),
6570
6734
  targetType
@@ -6573,7 +6737,7 @@ var UserLikeService = class extends BaseSDK {
6573
6737
  `/v1/user/likes/check${queryString}`,
6574
6738
  options
6575
6739
  );
6576
- log36("Like status retrieved: %O", result);
6740
+ log37("Like status retrieved: %O", result);
6577
6741
  return result;
6578
6742
  }
6579
6743
  /**
@@ -6587,7 +6751,7 @@ var UserLikeService = class extends BaseSDK {
6587
6751
  * @returns Promise resolving to list of likes
6588
6752
  */
6589
6753
  async getMyLikes(params = {}, options) {
6590
- log36("Getting my likes: %O", params);
6754
+ log37("Getting my likes: %O", params);
6591
6755
  const queryParams = {};
6592
6756
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
6593
6757
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -6597,7 +6761,7 @@ var UserLikeService = class extends BaseSDK {
6597
6761
  `/v1/user/likes/me${queryString}`,
6598
6762
  options
6599
6763
  );
6600
- log36("My likes retrieved");
6764
+ log37("My likes retrieved");
6601
6765
  return result;
6602
6766
  }
6603
6767
  /**
@@ -6612,7 +6776,7 @@ var UserLikeService = class extends BaseSDK {
6612
6776
  * @returns Promise resolving to list of likes
6613
6777
  */
6614
6778
  async getUserLikes(userId, params = {}, options) {
6615
- log36("Getting likes for user: %d", userId);
6779
+ log37("Getting likes for user: %d", userId);
6616
6780
  const queryParams = {};
6617
6781
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
6618
6782
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -6622,7 +6786,7 @@ var UserLikeService = class extends BaseSDK {
6622
6786
  `/v1/user/likes/${userId}${queryString}`,
6623
6787
  options
6624
6788
  );
6625
- log36("Likes retrieved for user: %d", userId);
6789
+ log37("Likes retrieved for user: %d", userId);
6626
6790
  return result;
6627
6791
  }
6628
6792
  /**
@@ -6637,7 +6801,7 @@ var UserLikeService = class extends BaseSDK {
6637
6801
  * @returns Promise resolving to list of liked agents
6638
6802
  */
6639
6803
  async getUserLikedAgents(userId, params = {}, options) {
6640
- log36("Getting liked agents for user: %d", userId);
6804
+ log37("Getting liked agents for user: %d", userId);
6641
6805
  const queryParams = {};
6642
6806
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
6643
6807
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -6646,7 +6810,7 @@ var UserLikeService = class extends BaseSDK {
6646
6810
  `/v1/user/likes/${userId}/agents${queryString}`,
6647
6811
  options
6648
6812
  );
6649
- log36("Liked agents retrieved for user: %d", userId);
6813
+ log37("Liked agents retrieved for user: %d", userId);
6650
6814
  return result;
6651
6815
  }
6652
6816
  /**
@@ -6661,7 +6825,7 @@ var UserLikeService = class extends BaseSDK {
6661
6825
  * @returns Promise resolving to list of liked plugins
6662
6826
  */
6663
6827
  async getUserLikedPlugins(userId, params = {}, options) {
6664
- log36("Getting liked plugins for user: %d", userId);
6828
+ log37("Getting liked plugins for user: %d", userId);
6665
6829
  const queryParams = {};
6666
6830
  if (params.limit !== void 0) queryParams.limit = String(params.limit);
6667
6831
  if (params.offset !== void 0) queryParams.offset = String(params.offset);
@@ -6670,14 +6834,14 @@ var UserLikeService = class extends BaseSDK {
6670
6834
  `/v1/user/likes/${userId}/plugins${queryString}`,
6671
6835
  options
6672
6836
  );
6673
- log36("Liked plugins retrieved for user: %d", userId);
6837
+ log37("Liked plugins retrieved for user: %d", userId);
6674
6838
  return result;
6675
6839
  }
6676
6840
  };
6677
6841
 
6678
6842
  // src/market/services/UserPublishService.ts
6679
- import debug37 from "debug";
6680
- var log37 = debug37("lobe-market-sdk:user-publish");
6843
+ import debug38 from "debug";
6844
+ var log38 = debug38("lobe-market-sdk:user-publish");
6681
6845
  var UserPublishService = class extends BaseSDK {
6682
6846
  /**
6683
6847
  * Lists all plugins owned by the authenticated user
@@ -6687,9 +6851,9 @@ var UserPublishService = class extends BaseSDK {
6687
6851
  */
6688
6852
  async listPlugins(options) {
6689
6853
  var _a;
6690
- log37("Listing user plugins");
6854
+ log38("Listing user plugins");
6691
6855
  const result = await this.request("/v1/user/plugins", options);
6692
- log37("Found %d user plugins", ((_a = result.data) == null ? void 0 : _a.length) || 0);
6856
+ log38("Found %d user plugins", ((_a = result.data) == null ? void 0 : _a.length) || 0);
6693
6857
  return result;
6694
6858
  }
6695
6859
  /**
@@ -6700,9 +6864,9 @@ var UserPublishService = class extends BaseSDK {
6700
6864
  */
6701
6865
  async listSkills(options) {
6702
6866
  var _a;
6703
- log37("Listing user skills");
6867
+ log38("Listing user skills");
6704
6868
  const result = await this.request("/v1/user/skills", options);
6705
- log37("Found %d user skills", ((_a = result.data) == null ? void 0 : _a.length) || 0);
6869
+ log38("Found %d user skills", ((_a = result.data) == null ? void 0 : _a.length) || 0);
6706
6870
  return result;
6707
6871
  }
6708
6872
  /**
@@ -6714,7 +6878,7 @@ var UserPublishService = class extends BaseSDK {
6714
6878
  * @returns Promise resolving to the publish result
6715
6879
  */
6716
6880
  async publishSkillVersion(identifier, zipBuffer, options) {
6717
- log37("Publishing skill version for: %s", identifier);
6881
+ log38("Publishing skill version for: %s", identifier);
6718
6882
  const formData = new FormData();
6719
6883
  const arrayBuffer = zipBuffer instanceof ArrayBuffer ? zipBuffer : zipBuffer.buffer.slice(
6720
6884
  zipBuffer.byteOffset,
@@ -6730,7 +6894,7 @@ var UserPublishService = class extends BaseSDK {
6730
6894
  ...options
6731
6895
  }
6732
6896
  );
6733
- log37("Published skill version: %s@%s", identifier, result.version);
6897
+ log38("Published skill version: %s@%s", identifier, result.version);
6734
6898
  return result;
6735
6899
  }
6736
6900
  /**
@@ -6741,11 +6905,11 @@ var UserPublishService = class extends BaseSDK {
6741
6905
  */
6742
6906
  async scanClaimableAssets(assetType) {
6743
6907
  var _a;
6744
- log37("Scanning claimable %s", assetType);
6908
+ log38("Scanning claimable %s", assetType);
6745
6909
  const result = await this.request(
6746
6910
  `/v1/user/claims/scan/${assetType}`
6747
6911
  );
6748
- log37("Found %d claimable %s", ((_a = result.data) == null ? void 0 : _a.length) || 0, assetType);
6912
+ log38("Found %d claimable %s", ((_a = result.data) == null ? void 0 : _a.length) || 0, assetType);
6749
6913
  return result;
6750
6914
  }
6751
6915
  /**
@@ -6756,13 +6920,13 @@ var UserPublishService = class extends BaseSDK {
6756
6920
  * @returns Promise resolving to the claim result
6757
6921
  */
6758
6922
  async claimAsset(assetId, assetType) {
6759
- log37("Claiming %s with id: %d", assetType, assetId);
6923
+ log38("Claiming %s with id: %d", assetType, assetId);
6760
6924
  const result = await this.request("/v1/user/claims", {
6761
6925
  body: JSON.stringify({ assetId, assetType }),
6762
6926
  headers: { "Content-Type": "application/json" },
6763
6927
  method: "POST"
6764
6928
  });
6765
- log37("Claim result for %s %d: %s", assetType, assetId, result.success);
6929
+ log38("Claim result for %s %d: %s", assetType, assetId, result.success);
6766
6930
  return result;
6767
6931
  }
6768
6932
  /**
@@ -6773,16 +6937,18 @@ var UserPublishService = class extends BaseSDK {
6773
6937
  *
6774
6938
  * @param identifier - The public asset identifier
6775
6939
  * @param assetType - 'plugin' or 'skill'
6940
+ * @param options - `repositoryUrl`: new repository of a plugin whose listed
6941
+ * repository was deleted; the claim repoints the listing to it
6776
6942
  * @returns Promise resolving to the claim result
6777
6943
  */
6778
- async claimAssetByIdentifier(identifier, assetType) {
6779
- log37("Claiming %s with identifier: %s", assetType, identifier);
6944
+ async claimAssetByIdentifier(identifier, assetType, options) {
6945
+ log38("Claiming %s with identifier: %s", assetType, identifier);
6780
6946
  const result = await this.request("/v1/user/claims", {
6781
- body: JSON.stringify({ assetType, identifier }),
6947
+ body: JSON.stringify({ assetType, identifier, repositoryUrl: options == null ? void 0 : options.repositoryUrl }),
6782
6948
  headers: { "Content-Type": "application/json" },
6783
6949
  method: "POST"
6784
6950
  });
6785
- log37("Claim result for %s %s: %s", assetType, identifier, result.success);
6951
+ log38("Claim result for %s %s: %s", assetType, identifier, result.success);
6786
6952
  return result;
6787
6953
  }
6788
6954
  /**
@@ -6797,14 +6963,14 @@ var UserPublishService = class extends BaseSDK {
6797
6963
  * @returns Promise resolving to the submission result
6798
6964
  */
6799
6965
  async submitRepo(params, options) {
6800
- log37("Submitting repository for import: %s (%s)", params.gitUrl, params.type);
6966
+ log38("Submitting repository for import: %s (%s)", params.gitUrl, params.type);
6801
6967
  const result = await this.request("/v1/user/claims/submit-repo", {
6802
6968
  body: JSON.stringify(params),
6803
6969
  headers: { "Content-Type": "application/json" },
6804
6970
  method: "POST",
6805
6971
  ...options
6806
6972
  });
6807
- log37("Submit result for %s: %s", params.gitUrl, result.success);
6973
+ log38("Submit result for %s: %s", params.gitUrl, result.success);
6808
6974
  return result;
6809
6975
  }
6810
6976
  /**
@@ -6815,14 +6981,14 @@ var UserPublishService = class extends BaseSDK {
6815
6981
  * @returns Promise resolving immediately with the plugin identifier and version
6816
6982
  */
6817
6983
  async publishPlugin(params, options) {
6818
- log37("Publishing plugin: %s@%s", params.identifier, params.version);
6984
+ log38("Publishing plugin: %s@%s", params.identifier, params.version);
6819
6985
  const result = await this.request("/v1/user/plugins", {
6820
6986
  body: JSON.stringify(params),
6821
6987
  headers: { "Content-Type": "application/json" },
6822
6988
  method: "POST",
6823
6989
  ...options
6824
6990
  });
6825
- log37("Published plugin: %s@%s (%s)", result.identifier, result.version, result.status);
6991
+ log38("Published plugin: %s@%s (%s)", result.identifier, result.version, result.status);
6826
6992
  return result;
6827
6993
  }
6828
6994
  /**
@@ -6833,12 +6999,12 @@ var UserPublishService = class extends BaseSDK {
6833
6999
  * @returns Promise resolving to the delete result
6834
7000
  */
6835
7001
  async deleteSkill(identifier, options) {
6836
- log37("Deleting skill: %s", identifier);
7002
+ log38("Deleting skill: %s", identifier);
6837
7003
  const result = await this.request(
6838
7004
  `/v1/user/skills/${encodeURIComponent(identifier)}`,
6839
7005
  { method: "DELETE", ...options }
6840
7006
  );
6841
- log37("Deleted skill: %s", identifier);
7007
+ log38("Deleted skill: %s", identifier);
6842
7008
  return result;
6843
7009
  }
6844
7010
  /**
@@ -6850,7 +7016,7 @@ var UserPublishService = class extends BaseSDK {
6850
7016
  * @returns Promise resolving to the updated status
6851
7017
  */
6852
7018
  async updateSkillStatus(identifier, status, options) {
6853
- log37("Updating skill status: %s \u2192 %s", identifier, status);
7019
+ log38("Updating skill status: %s \u2192 %s", identifier, status);
6854
7020
  const result = await this.request(
6855
7021
  `/v1/user/skills/${encodeURIComponent(identifier)}/status`,
6856
7022
  {
@@ -6860,7 +7026,7 @@ var UserPublishService = class extends BaseSDK {
6860
7026
  ...options
6861
7027
  }
6862
7028
  );
6863
- log37("Updated skill status: %s \u2192 %s", identifier, result.status);
7029
+ log38("Updated skill status: %s \u2192 %s", identifier, result.status);
6864
7030
  return result;
6865
7031
  }
6866
7032
  /**
@@ -6871,12 +7037,12 @@ var UserPublishService = class extends BaseSDK {
6871
7037
  * @returns Promise resolving to the delete result
6872
7038
  */
6873
7039
  async deletePlugin(identifier, options) {
6874
- log37("Deleting plugin: %s", identifier);
7040
+ log38("Deleting plugin: %s", identifier);
6875
7041
  const result = await this.request(
6876
7042
  `/v1/user/plugins/${encodeURIComponent(identifier)}`,
6877
7043
  { method: "DELETE", ...options }
6878
7044
  );
6879
- log37("Deleted plugin: %s", identifier);
7045
+ log38("Deleted plugin: %s", identifier);
6880
7046
  return result;
6881
7047
  }
6882
7048
  /**
@@ -6888,7 +7054,7 @@ var UserPublishService = class extends BaseSDK {
6888
7054
  * @returns Promise resolving to the updated status
6889
7055
  */
6890
7056
  async updatePluginStatus(identifier, status, options) {
6891
- log37("Updating plugin status: %s \u2192 %s", identifier, status);
7057
+ log38("Updating plugin status: %s \u2192 %s", identifier, status);
6892
7058
  const result = await this.request(
6893
7059
  `/v1/user/plugins/${encodeURIComponent(identifier)}/status`,
6894
7060
  {
@@ -6898,7 +7064,7 @@ var UserPublishService = class extends BaseSDK {
6898
7064
  ...options
6899
7065
  }
6900
7066
  );
6901
- log37("Updated plugin status: %s \u2192 %s", identifier, result.status);
7067
+ log38("Updated plugin status: %s \u2192 %s", identifier, result.status);
6902
7068
  return result;
6903
7069
  }
6904
7070
  /**
@@ -6910,7 +7076,7 @@ var UserPublishService = class extends BaseSDK {
6910
7076
  * @returns Promise resolving to the publish result
6911
7077
  */
6912
7078
  async publishPluginVersion(identifier, data, options) {
6913
- log37("Publishing plugin version for: %s", identifier);
7079
+ log38("Publishing plugin version for: %s", identifier);
6914
7080
  const result = await this.request(
6915
7081
  `/v1/user/plugins/${encodeURIComponent(identifier)}/versions`,
6916
7082
  {
@@ -6920,7 +7086,7 @@ var UserPublishService = class extends BaseSDK {
6920
7086
  ...options
6921
7087
  }
6922
7088
  );
6923
- log37("Published plugin version: %s@%s", identifier, result.version);
7089
+ log38("Published plugin version: %s@%s", identifier, result.version);
6924
7090
  return result;
6925
7091
  }
6926
7092
  /**
@@ -6933,13 +7099,13 @@ var UserPublishService = class extends BaseSDK {
6933
7099
  */
6934
7100
  async getPluginLocalizations(identifier, version, options) {
6935
7101
  var _a;
6936
- log37("Listing localizations for plugin: %s", identifier);
7102
+ log38("Listing localizations for plugin: %s", identifier);
6937
7103
  const query = version ? `?version=${encodeURIComponent(version)}` : "";
6938
7104
  const result = await this.request(
6939
7105
  `/v1/user/plugins/${encodeURIComponent(identifier)}/localizations${query}`,
6940
7106
  options
6941
7107
  );
6942
- log37("Found %d localizations for %s", ((_a = result.localizations) == null ? void 0 : _a.length) || 0, identifier);
7108
+ log38("Found %d localizations for %s", ((_a = result.localizations) == null ? void 0 : _a.length) || 0, identifier);
6943
7109
  return result;
6944
7110
  }
6945
7111
  /**
@@ -6956,7 +7122,7 @@ var UserPublishService = class extends BaseSDK {
6956
7122
  * @returns Promise resolving to the upsert result
6957
7123
  */
6958
7124
  async updatePluginLocalizations(identifier, localizations, version, options) {
6959
- log37("Upserting %d localization(s) for plugin: %s", localizations.length, identifier);
7125
+ log38("Upserting %d localization(s) for plugin: %s", localizations.length, identifier);
6960
7126
  const result = await this.request(
6961
7127
  `/v1/user/plugins/${encodeURIComponent(identifier)}/localizations`,
6962
7128
  {
@@ -6966,7 +7132,7 @@ var UserPublishService = class extends BaseSDK {
6966
7132
  ...options
6967
7133
  }
6968
7134
  );
6969
- log37("Upserted localizations for %s@%s", identifier, result.version);
7135
+ log38("Upserted localizations for %s@%s", identifier, result.version);
6970
7136
  return result;
6971
7137
  }
6972
7138
  /**
@@ -6980,31 +7146,31 @@ var UserPublishService = class extends BaseSDK {
6980
7146
  * @returns Promise resolving to the delete result
6981
7147
  */
6982
7148
  async deletePluginLocalization(identifier, locale, version, options) {
6983
- log37("Deleting localization %s for plugin: %s", locale, identifier);
7149
+ log38("Deleting localization %s for plugin: %s", locale, identifier);
6984
7150
  const query = version ? `?version=${encodeURIComponent(version)}` : "";
6985
7151
  const result = await this.request(
6986
7152
  `/v1/user/plugins/${encodeURIComponent(identifier)}/localizations/${encodeURIComponent(locale)}${query}`,
6987
7153
  { method: "DELETE", ...options }
6988
7154
  );
6989
- log37("Deleted localization %s for %s", locale, identifier);
7155
+ log38("Deleted localization %s for %s", locale, identifier);
6990
7156
  return result;
6991
7157
  }
6992
7158
  };
6993
7159
 
6994
7160
  // src/market/services/CategoryService.ts
6995
- import debug38 from "debug";
6996
- var log38 = debug38("lobe-market-sdk:market:categories");
7161
+ import debug39 from "debug";
7162
+ var log39 = debug39("lobe-market-sdk:market:categories");
6997
7163
  var CategoryService2 = class extends BaseSDK {
6998
7164
  /** Lists configured categories with nullable HTTP(S) image URLs or lucide:<name> icons and public asset counts, including empty categories. */
6999
7165
  async list(assetType, locale) {
7000
- log38("Listing categories for %s", assetType);
7166
+ log39("Listing categories for %s", assetType);
7001
7167
  const query = this.buildQueryString({ assetType, locale });
7002
7168
  return this.request(`/v1/categories${query}`);
7003
7169
  }
7004
7170
  };
7005
7171
 
7006
7172
  // src/market/market-sdk.ts
7007
- var log39 = debug39("lobe-market-sdk");
7173
+ var log40 = debug40("lobe-market-sdk");
7008
7174
  var MarketSDK = class extends BaseSDK {
7009
7175
  /** Anonymous WebP byte URL. No signed token or public bucket is required. */
7010
7176
  getAssetImageUrl(id) {
@@ -7025,8 +7191,9 @@ var MarketSDK = class extends BaseSDK {
7025
7191
  tokenExpiry: void 0
7026
7192
  };
7027
7193
  super(options, void 0, sharedTokenState);
7028
- log39("MarketSDK instance created");
7194
+ log40("MarketSDK instance created");
7029
7195
  this.agentProfile = new AgentProfileService(options, this.headers, sharedTokenState);
7196
+ this.access = new AccessService(options, this.headers, sharedTokenState);
7030
7197
  this.categories = new CategoryService2(options, this.headers, sharedTokenState);
7031
7198
  this.agents = new AgentService2(options, this.headers, sharedTokenState);
7032
7199
  this.agentGroups = new AgentGroupService(options, this.headers, sharedTokenState);
@@ -7078,11 +7245,51 @@ var MarketSDK = class extends BaseSDK {
7078
7245
  * @deprecated Use auth.registerClient() instead
7079
7246
  */
7080
7247
  async registerClient(request) {
7081
- log39("Registering client (deprecated method, use auth.registerClient): %s", request.clientName);
7248
+ log40("Registering client (deprecated method, use auth.registerClient): %s", request.clientName);
7082
7249
  return this.auth.registerClient(request);
7083
7250
  }
7084
7251
  };
7085
7252
 
7253
+ // src/core/errorKind.ts
7254
+ var STATUS_KINDS = {
7255
+ 400: "invalid_input",
7256
+ 401: "unauthenticated",
7257
+ 403: "forbidden",
7258
+ 404: "not_found",
7259
+ 409: "conflict",
7260
+ 422: "invalid_input",
7261
+ 429: "rate_limited"
7262
+ };
7263
+ var NETWORK_ERROR_CODES = /* @__PURE__ */ new Set([
7264
+ "EAI_AGAIN",
7265
+ "ECONNABORTED",
7266
+ "ECONNREFUSED",
7267
+ "ECONNRESET",
7268
+ "EHOSTUNREACH",
7269
+ "ENETUNREACH",
7270
+ "ENOTFOUND",
7271
+ "EPIPE",
7272
+ "ETIMEDOUT"
7273
+ ]);
7274
+ var FETCH_FAILURE_MESSAGE = /^(fetch failed|failed to fetch|load failed|networkerror\b)/i;
7275
+ var isNetworkError = (error) => {
7276
+ var _a;
7277
+ const code = (_a = error.cause) == null ? void 0 : _a.code;
7278
+ if (typeof code === "string" && (NETWORK_ERROR_CODES.has(code) || code.startsWith("UND_ERR_")))
7279
+ return true;
7280
+ return error instanceof TypeError && FETCH_FAILURE_MESSAGE.test(error.message);
7281
+ };
7282
+ var getMarketErrorKind = (error) => {
7283
+ var _a;
7284
+ if (error instanceof MarketAPIError) {
7285
+ if (error.status >= 500) return "unavailable";
7286
+ return (_a = STATUS_KINDS[error.status]) != null ? _a : "unknown";
7287
+ }
7288
+ if (!(error instanceof Error)) return "unknown";
7289
+ if (error.name === "AbortError" || error.name === "TimeoutError") return "unavailable";
7290
+ return isNetworkError(error) ? "unavailable" : "unknown";
7291
+ };
7292
+
7086
7293
  // src/types/admin.ts
7087
7294
  import { z } from "zod";
7088
7295
  var VisibilityEnumSchema = z.enum(["public", "private", "internal"]);
@@ -7145,6 +7352,7 @@ export {
7145
7352
  buildTrustedClientPayload,
7146
7353
  createTrustedClientToken,
7147
7354
  generateNonce,
7355
+ getMarketErrorKind,
7148
7356
  orgRefToPathSegment
7149
7357
  };
7150
7358
  //# sourceMappingURL=index.mjs.map