@lobehub/market-sdk 0.31.5 → 0.31.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -350,7 +350,7 @@ interface AgentListQuery {
350
350
  /** Search query string */
351
351
  q?: string;
352
352
  /** Sort field */
353
- sort?: 'createdAt' | 'updatedAt' | 'name' | 'tokenUsage' | 'knowledgeCount' | 'pluginCount' | 'recommended' | 'relevance';
353
+ sort?: 'createdAt' | 'knowledgeCount' | 'mostUsage' | 'name' | 'pluginCount' | 'recommended' | 'relevance' | 'tokenUsage' | 'updatedAt';
354
354
  /** Publication status filter */
355
355
  status?: 'published' | 'unpublished' | 'archived' | 'deprecated' | 'all';
356
356
  /** Visibility filter */
@@ -892,7 +892,7 @@ interface OwnAgentListQuery {
892
892
  /** Search query string */
893
893
  q?: string;
894
894
  /** Sort field */
895
- sort?: 'createdAt' | 'updatedAt' | 'name' | 'tokenUsage' | 'knowledgeCount' | 'pluginCount';
895
+ sort?: 'createdAt' | 'knowledgeCount' | 'mostUsage' | 'name' | 'pluginCount' | 'tokenUsage' | 'updatedAt';
896
896
  /** Filter by specific status, if not provided returns all statuses */
897
897
  status?: AgentStatus;
898
898
  }
@@ -1768,7 +1768,7 @@ interface PluginQueryParams {
1768
1768
  /** Search query string */
1769
1769
  q?: string;
1770
1770
  /** Field to sort by */
1771
- sort?: 'installCount' | 'createdAt' | 'updatedAt' | 'ratingAverage' | 'ratingCount' | 'isFeatured' | 'isValidated' | 'recommended' | 'relevance' | 'stars';
1771
+ sort?: 'commentCount' | 'createdAt' | 'githubUpdateAt' | 'installCount' | 'isFeatured' | 'isValidated' | 'ratingAverage' | 'ratingCount' | 'recommended' | 'relevance' | 'stars' | 'updatedAt';
1772
1772
  /** Filter by tags (comma-separated) */
1773
1773
  tags?: string;
1774
1774
  }
@@ -2522,7 +2522,7 @@ interface MarketSkillListQuery {
2522
2522
  * Sort field
2523
2523
  * @default 'createdAt'
2524
2524
  */
2525
- sort?: 'commentCount' | 'createdAt' | 'forks' | 'installCount' | 'name' | 'ratingAverage' | 'relevance' | 'stars' | 'updatedAt' | 'watchers';
2525
+ sort?: 'commentCount' | 'createdAt' | 'forks' | 'installCount' | 'name' | 'ratingAverage' | 'recommended' | 'relevance' | 'stars' | 'updatedAt' | 'watchers';
2526
2526
  }
2527
2527
  /**
2528
2528
  * Query parameters for getting skill detail
@@ -3050,10 +3050,12 @@ interface MarketSkillVersionsResponse {
3050
3050
  * Author information for a skill comment
3051
3051
  */
3052
3052
  interface SkillCommentAuthor {
3053
- avatarUrl?: string | null;
3053
+ avatar?: string;
3054
+ background?: string | null;
3054
3055
  displayName?: string | null;
3055
- id: number;
3056
- namespace?: string;
3056
+ id?: number;
3057
+ identifier?: string;
3058
+ sourceType?: string | null;
3057
3059
  tags?: string[];
3058
3060
  type: 'agent' | 'user';
3059
3061
  }
@@ -3061,19 +3063,63 @@ interface SkillCommentAuthor {
3061
3063
  * A single skill comment item
3062
3064
  */
3063
3065
  interface SkillCommentItem {
3064
- agentId: number | null;
3065
3066
  author: SkillCommentAuthor | null;
3066
3067
  content: string;
3067
3068
  createdAt: string;
3068
3069
  downvotes: number;
3069
3070
  id: number;
3070
3071
  parentId: number | null;
3072
+ rating?: number;
3071
3073
  replyCount: number;
3074
+ updatedAt: string;
3075
+ upvotes: number;
3076
+ }
3077
+ /**
3078
+ * A single skill comment list item
3079
+ */
3080
+ type SkillCommentListItem = SkillCommentItem;
3081
+ /**
3082
+ * Created skill comment entity
3083
+ */
3084
+ interface SkillCommentCreateItem {
3085
+ agentId: number | null;
3086
+ content: string;
3087
+ createdAt: string;
3088
+ downvotes: number;
3089
+ id: number;
3090
+ parentId: number | null;
3072
3091
  skillId: number;
3073
3092
  updatedAt: string;
3074
3093
  upvotes: number;
3075
3094
  userId: number | null;
3076
3095
  }
3096
+ /**
3097
+ * Rating payload returned when creating a comment with a score
3098
+ */
3099
+ interface SkillCommentRating {
3100
+ score: number;
3101
+ }
3102
+ /**
3103
+ * Response returned by the create comment endpoint
3104
+ */
3105
+ interface SkillCommentCreateResponse extends SkillCommentCreateItem {
3106
+ rating?: SkillCommentRating;
3107
+ }
3108
+ /**
3109
+ * Latest comment for the authenticated user/agent on a skill
3110
+ */
3111
+ interface SkillLatestOwnComment {
3112
+ createdAt: string;
3113
+ id: number;
3114
+ parentId: number | null;
3115
+ replyCount: number;
3116
+ }
3117
+ /**
3118
+ * Response returned by the delete comment endpoint
3119
+ */
3120
+ interface SkillCommentDeleteResponse {
3121
+ success: boolean;
3122
+ }
3077
3123
  /**
3078
3124
  * Query parameters for listing skill comments
3079
3125
  */
@@ -6240,6 +6286,14 @@ declare class MarketSkillService extends BaseSDK {
6240
6286
  * @returns Promise resolving to the paginated comment list
6241
6287
  */
6242
6288
  getComments(identifier: string, params?: SkillCommentListQuery, options?: globalThis.RequestInit): Promise<SkillCommentListResponse>;
6289
+ /**
6290
+ * Gets the latest comment for the authenticated user or agent on a skill
6291
+ *
6292
+ * @param identifier - Unique skill identifier
6293
+ * @param options - Optional request options
6294
+ * @returns Promise resolving to the latest own comment or null when none exists
6295
+ */
6296
+ getLatestOwnComment(identifier: string, options?: globalThis.RequestInit): Promise<SkillLatestOwnComment | null>;
6243
6297
  /**
6244
6298
  * Creates a comment on a skill, optionally with a rating
6245
6299
  *
@@ -6251,11 +6305,16 @@ declare class MarketSkillService extends BaseSDK {
6251
6305
  createComment(identifier: string, data: {
6252
6306
  content: string;
6253
6307
  score?: number;
6254
- }, options?: globalThis.RequestInit): Promise<SkillCommentItem & {
6255
- rating?: {
6256
- score: number;
6257
- };
6258
- }>;
6308
+ }, options?: globalThis.RequestInit): Promise<SkillCommentCreateResponse>;
6309
+ /**
6310
+ * Deletes a comment from a skill
6311
+ *
6312
+ * @param identifier - Unique skill identifier
6313
+ * @param commentId - Comment ID to delete
6314
+ * @param options - Optional request options
6315
+ * @returns Promise resolving to success status
6316
+ */
6317
+ deleteComment(identifier: string, commentId: number, options?: globalThis.RequestInit): Promise<SkillCommentDeleteResponse>;
6259
6318
  /**
6260
6319
  * Adds or updates a reaction on a comment
6261
6320
  *
@@ -6718,11 +6777,6 @@ declare class MarketSDK extends BaseSDK {
6718
6777
  registerClient(request: ClientRegistrationRequest): Promise<ClientRegistrationResponse>;
6719
6778
  }
6720
6779
 
6721
- /**
6722
- * Market API Error
6723
- *
6724
- * Custom error class for Market API errors that preserves the structured error response.
6725
- */
6726
6780
  declare class MarketAPIError extends Error {
6727
6781
  /** HTTP status code */
6728
6782
  readonly status: number;
@@ -6830,4 +6884,4 @@ declare function buildTrustedClientPayload(params: {
6830
6884
  userId: string;
6831
6885
  }): TrustedClientPayload;
6832
6886
 
6833
- export { type AccountMeta, type AdminListQueryParams, type AdminListResponse, type AdminPluginParams, type AgentCreateRequest, type AgentCreateResponse, type AgentDetailQuery, type AgentExtension, type AgentForkItem, type AgentForkRequest, type AgentForkResponse, type AgentForkSourceResponse, type AgentForksResponse, type AgentGroupCreateRequest, type AgentGroupCreateResponse, type AgentGroupDetail, type AgentGroupDetailQuery, type AgentGroupForkItem, type AgentGroupForkRequest, type AgentGroupForkResponse, type AgentGroupForkSourceResponse, type AgentGroupForksResponse, type AgentGroupItem, type AgentGroupListQuery, type AgentGroupListResponse, type AgentGroupModifyRequest, type AgentGroupModifyResponse, type AgentGroupStatus, type AgentGroupStatusChangeResponse, type AgentGroupVersionCreateRequest, type AgentGroupVersionCreateResponse, type AgentInstallCountRequest, type AgentInstallCountResponse, type AgentInterface, type AgentItemDetail, type AgentListQuery, type AgentListResponse, type AgentModifyRequest, type AgentModifyResponse, type AgentProfileEntity, type AgentProfileResponse, type AgentSecurityRequirement, type AgentSecurityScheme, type AgentSkill, type AgentStatus, type AgentStatusChangeResponse, type AgentUploadRequest, type AgentUploadResponse, type AgentUploadVersion, type AgentVersionCreateRequest, type AgentVersionCreateResponse, type AgentVersionLocalization, type AgentVersionModifyRequest, type AgentVersionModifyResponse, type AuthorizationCodeTokenRequest, type AuthorizeParams, type AuthorizeResponse, type CallSkillToolResponse, type CheckFavoriteQuery, type CheckFavoriteResponse, type CheckFollowQuery, type CheckFollowResponse, type CheckLikeQuery, type CheckLikeResponse, type ClientRegistrationError, type ClientRegistrationRequest, type ClientRegistrationResponse, type CodeInterpreterToolName, type CodeInterpreterToolParams, type ConnectProvider, type ConnectProviderDetail, type ConnectProviderScopes, type ConnectionHealth, type ConnectionStats, type CreateMemberAgent, type DiscoveryDocument, type EditLocalFileParams, type ExecuteCodeParams, type ExportFileParams, type FavoriteListResponse, type FavoriteQuery, type FavoriteRequest, type FeedbackClientInfo, type FollowListItem, type FollowListResponse, type FollowRequest, type GetAllConnectionsHealthResponse, type GetAuthorizeUrlParams, type GetCommandOutputParams, type GetConnectProviderResponse, type GetConnectionHealthResponse, type GetConnectionStatsResponse, type GetConnectionStatusResponse, type GetSkillStatusResponse, type GetSkillToolResponse, type GlobLocalFilesParams, type GrepContentParams, type InteractionTargetType, type KillCommandParams, type LikeListResponse, type LikeQuery, type LikeRequest, type ListConnectProvidersResponse, type ListConnectionsResponse, type ListLocalFilesParams, type ListSkillProvidersResponse, type ListSkillToolsResponse, MarketAPIError, MarketAdmin, type MarketReportGitHubSkillParams, type MarketReportGitHubSkillResponse, type MarketReportSkillInstallParams, type MarketReportSkillInstallResponse, MarketSDK, type MarketSDKOptions, type MarketSkillAuthor, type MarketSkillCategory, type MarketSkillCategoryQuery, type MarketSkillDetail, type MarketSkillDetailQuery, type MarketSkillGitHubMeta, type MarketSkillListItem, type MarketSkillListQuery, type MarketSkillListResponse, type MarketSkillManifest, type MarketSkillResource, type MarketSkillVersionSummary, type MarketSkillVersionsResponse, type MemberAgent, type MoveLocalFilesParams, type MoveOperation, type OAuthConnection, type OAuthTokenResponse, type OwnAgentGroupListQuery, type OwnAgentListQuery, type PaginationQuery, type PluginI18nImportParams, type PluginI18nImportResponse, type PluginItem, type PluginListResponse, type PluginLocalization, type PluginQueryParams, type PluginUpdateParams, type PluginVersionCreateParams, type PluginVersionUpdateParams, type ProgrammingLanguage, type ReadLocalFileParams, type RefreshConnectionResponse, type RefreshTokenRequest, type RegisterUserRequest, type RegisterUserResponse, type RegisteredUserProfile, type RenameLocalFileParams, type ReviewStatus, ReviewStatusEnumSchema, type RevokeConnectionResponse, type RunBuildInToolsError, type RunBuildInToolsRequest, type RunBuildInToolsResponse, type RunBuildInToolsSuccessData, type RunCommandParams, SDK_USER_AGENT, SDK_VERSION, type SearchLocalFilesParams, type SharedTokenState, type SkillCallParams, type SkillCommentAuthor, type SkillCommentItem, type SkillCommentListQuery, type SkillCommentListResponse, type SkillErrorResponse, type SkillProviderInfo, type SkillProviderStatus, type SkillRatingDistribution, type SkillTool, StatusEnumSchema, type SubmitFeedbackRequest, type SubmitFeedbackResponse, type SuccessResponse, type ToggleLikeResponse, type TrustedClientPayload, type UnclaimedPluginItem, type UpdateAgentProfileRequest, type UpdateAgentProfileResponse, type UpdateMemberAgent, type UpdateUserInfoRequest, type UpdateUserInfoResponse, type UserAgentGroupItem, type UserAgentItem, type UserInfoQuery, type UserInfoResponse, type UserProfile, VisibilityEnumSchema, type WriteLocalFileParams, buildTrustedClientPayload, createTrustedClientToken, generateNonce };
6887
+ export { type AccountMeta, type AdminListQueryParams, type AdminListResponse, type AdminPluginParams, type AgentCreateRequest, type AgentCreateResponse, type AgentDetailQuery, type AgentExtension, type AgentForkItem, type AgentForkRequest, type AgentForkResponse, type AgentForkSourceResponse, type AgentForksResponse, type AgentGroupCreateRequest, type AgentGroupCreateResponse, type AgentGroupDetail, type AgentGroupDetailQuery, type AgentGroupForkItem, type AgentGroupForkRequest, type AgentGroupForkResponse, type AgentGroupForkSourceResponse, type AgentGroupForksResponse, type AgentGroupItem, type AgentGroupListQuery, type AgentGroupListResponse, type AgentGroupModifyRequest, type AgentGroupModifyResponse, type AgentGroupStatus, type AgentGroupStatusChangeResponse, type AgentGroupVersionCreateRequest, type AgentGroupVersionCreateResponse, type AgentInstallCountRequest, type AgentInstallCountResponse, type AgentInterface, type AgentItemDetail, type AgentListQuery, type AgentListResponse, type AgentModifyRequest, type AgentModifyResponse, type AgentProfileEntity, type AgentProfileResponse, type AgentSecurityRequirement, type AgentSecurityScheme, type AgentSkill, type AgentStatus, type AgentStatusChangeResponse, type AgentUploadRequest, type AgentUploadResponse, type AgentUploadVersion, type AgentVersionCreateRequest, type AgentVersionCreateResponse, type AgentVersionLocalization, type AgentVersionModifyRequest, type AgentVersionModifyResponse, type AuthorizationCodeTokenRequest, type AuthorizeParams, type AuthorizeResponse, type CallSkillToolResponse, type CheckFavoriteQuery, type CheckFavoriteResponse, type CheckFollowQuery, type CheckFollowResponse, type CheckLikeQuery, type CheckLikeResponse, type ClientRegistrationError, type ClientRegistrationRequest, type ClientRegistrationResponse, type CodeInterpreterToolName, type CodeInterpreterToolParams, type ConnectProvider, type ConnectProviderDetail, type ConnectProviderScopes, type ConnectionHealth, type ConnectionStats, type CreateMemberAgent, type DiscoveryDocument, type EditLocalFileParams, type ExecuteCodeParams, type ExportFileParams, type FavoriteListResponse, type FavoriteQuery, type FavoriteRequest, type FeedbackClientInfo, type FollowListItem, type FollowListResponse, type FollowRequest, type GetAllConnectionsHealthResponse, type GetAuthorizeUrlParams, type GetCommandOutputParams, type GetConnectProviderResponse, type GetConnectionHealthResponse, type GetConnectionStatsResponse, type GetConnectionStatusResponse, type GetSkillStatusResponse, type GetSkillToolResponse, type GlobLocalFilesParams, type GrepContentParams, type InteractionTargetType, type KillCommandParams, type LikeListResponse, type LikeQuery, type LikeRequest, type ListConnectProvidersResponse, type ListConnectionsResponse, type ListLocalFilesParams, type ListSkillProvidersResponse, type ListSkillToolsResponse, MarketAPIError, MarketAdmin, type MarketReportGitHubSkillParams, type MarketReportGitHubSkillResponse, type MarketReportSkillInstallParams, type MarketReportSkillInstallResponse, MarketSDK, type MarketSDKOptions, type MarketSkillAuthor, type MarketSkillCategory, type MarketSkillCategoryQuery, type MarketSkillDetail, type MarketSkillDetailQuery, type MarketSkillGitHubMeta, type MarketSkillListItem, type MarketSkillListQuery, type MarketSkillListResponse, type MarketSkillManifest, type MarketSkillResource, type MarketSkillVersionSummary, type MarketSkillVersionsResponse, type MemberAgent, type MoveLocalFilesParams, type MoveOperation, type OAuthConnection, type OAuthTokenResponse, type OwnAgentGroupListQuery, type OwnAgentListQuery, type PaginationQuery, type PluginI18nImportParams, type PluginI18nImportResponse, type PluginItem, type PluginListResponse, type PluginLocalization, type PluginQueryParams, type PluginUpdateParams, type PluginVersionCreateParams, type PluginVersionUpdateParams, type ProgrammingLanguage, type ReadLocalFileParams, type RefreshConnectionResponse, type RefreshTokenRequest, type RegisterUserRequest, type RegisterUserResponse, type RegisteredUserProfile, type RenameLocalFileParams, type ReviewStatus, ReviewStatusEnumSchema, type RevokeConnectionResponse, type RunBuildInToolsError, type RunBuildInToolsRequest, type RunBuildInToolsResponse, type RunBuildInToolsSuccessData, type RunCommandParams, SDK_USER_AGENT, SDK_VERSION, type SearchLocalFilesParams, type SharedTokenState, type SkillCallParams, type SkillCommentAuthor, type SkillCommentCreateItem, type SkillCommentCreateResponse, type SkillCommentDeleteResponse, type SkillCommentItem, type SkillCommentListItem, type SkillCommentListQuery, type SkillCommentListResponse, type SkillCommentRating, type SkillErrorResponse, type SkillLatestOwnComment, type SkillProviderInfo, type SkillProviderStatus, type SkillRatingDistribution, type SkillTool, StatusEnumSchema, type SubmitFeedbackRequest, type SubmitFeedbackResponse, type SuccessResponse, type ToggleLikeResponse, type TrustedClientPayload, type UnclaimedPluginItem, type UpdateAgentProfileRequest, type UpdateAgentProfileResponse, type UpdateMemberAgent, type UpdateUserInfoRequest, type UpdateUserInfoResponse, type UserAgentGroupItem, type UserAgentItem, type UserInfoQuery, type UserInfoResponse, type UserProfile, VisibilityEnumSchema, type WriteLocalFileParams, buildTrustedClientPayload, createTrustedClientToken, generateNonce };
package/dist/index.mjs CHANGED
@@ -7,11 +7,30 @@ import { SignJWT } from "jose";
7
7
  import urlJoin from "url-join";
8
8
 
9
9
  // src/core/MarketAPIError.ts
10
+ var normalizeErrorDetails = (errorBody) => {
11
+ if (!errorBody) return void 0;
12
+ if (typeof errorBody.error === "object" && errorBody.error !== null) {
13
+ return errorBody.error;
14
+ }
15
+ if (typeof errorBody.error === "string") {
16
+ return {
17
+ ...errorBody.code ? { code: errorBody.code } : {},
18
+ message: errorBody.error
19
+ };
20
+ }
21
+ if (typeof errorBody.message === "string") {
22
+ return {
23
+ ...errorBody.code ? { code: errorBody.code } : {},
24
+ message: errorBody.message
25
+ };
26
+ }
27
+ return void 0;
28
+ };
10
29
  var MarketAPIError = class _MarketAPIError extends Error {
11
30
  constructor(status, statusText, errorBody) {
12
- var _a, _b;
13
- const errorCode = (_a = errorBody == null ? void 0 : errorBody.error) == null ? void 0 : _a.code;
14
- const errorMessage = (_b = errorBody == null ? void 0 : errorBody.error) == null ? void 0 : _b.message;
31
+ const errorDetails = normalizeErrorDetails(errorBody);
32
+ const errorCode = errorDetails == null ? void 0 : errorDetails.code;
33
+ const errorMessage = errorDetails == null ? void 0 : errorDetails.message;
15
34
  const message = errorMessage || statusText;
16
35
  super(message);
17
36
  this.name = "MarketAPIError";
@@ -32,8 +51,7 @@ var MarketAPIError = class _MarketAPIError extends Error {
32
51
  * Get the full error details from the API response
33
52
  */
34
53
  getErrorDetails() {
35
- var _a;
36
- return (_a = this.errorBody) == null ? void 0 : _a.error;
54
+ return normalizeErrorDetails(this.errorBody);
37
55
  }
38
56
  /**
39
57
  * Convert to a plain object for logging or serialization
@@ -3942,6 +3960,26 @@ var MarketSkillService = class extends BaseSDK {
3942
3960
  );
3943
3961
  return result;
3944
3962
  }
3963
+ /**
3964
+ * Gets the latest comment for the authenticated user or agent on a skill
3965
+ *
3966
+ * @param identifier - Unique skill identifier
3967
+ * @param options - Optional request options
3968
+ * @returns Promise resolving to the latest own comment or null when none exists
3969
+ */
3970
+ async getLatestOwnComment(identifier, options) {
3971
+ log19("Getting latest own comment for skill %s", identifier);
3972
+ const result = await this.request(
3973
+ `/v1/skills/${encodeURIComponent(identifier)}/comments/latest`,
3974
+ options
3975
+ );
3976
+ if (result) {
3977
+ log19("Retrieved latest own comment for skill %s: id=%d", identifier, result.id);
3978
+ } else {
3979
+ log19("No own comments found for skill %s", identifier);
3980
+ }
3981
+ return result;
3982
+ }
3945
3983
  /**
3946
3984
  * Creates a comment on a skill, optionally with a rating
3947
3985
  *
@@ -3963,6 +4001,26 @@ var MarketSkillService = class extends BaseSDK {
3963
4001
  log19("Comment created on skill %s: id=%d", identifier, result.id);
3964
4002
  return result;
3965
4003
  }
4004
+ /**
4005
+ * Deletes a comment from a skill
4006
+ *
4007
+ * @param identifier - Unique skill identifier
4008
+ * @param commentId - Comment ID to delete
4009
+ * @param options - Optional request options
4010
+ * @returns Promise resolving to success status
4011
+ */
4012
+ async deleteComment(identifier, commentId, options) {
4013
+ log19("Deleting comment %d from skill %s", commentId, identifier);
4014
+ const result = await this.request(
4015
+ `/v1/skills/${encodeURIComponent(identifier)}/comments/${commentId}`,
4016
+ {
4017
+ ...options,
4018
+ method: "DELETE"
4019
+ }
4020
+ );
4021
+ log19("Comment %d deleted from skill %s", commentId, identifier);
4022
+ return result;
4023
+ }
3966
4024
  /**
3967
4025
  * Adds or updates a reaction on a comment
3968
4026
  *