@lobehub/market-sdk
Version:
LobeHub Market JavaScript SDK
1,689 lines (1,682 loc) • 244 kB
text/typescript
import { z } from 'zod';
import { AgentItem, UserCredSummary, MarketItemBase, PluginConnectionType, InstallFailureAnalysisQuery, InstallFailureAnalysis, RangeQuery, RangeStats, TopPluginsQuery, TopPlugin, PluginManifest, AdminPluginItem, AdminPluginItemDetail, PluginVersion, PluginVersionLocalization, AdminDeploymentOption, InstallationDetails, SystemDependency, IncompleteI18nPlugin, CreateSkillCollectionRequest, AdminSkillCollectionDetail, AdminSkillCollectionListQuery, AdminSkillCollectionListResponse, BatchUpsertSkillCollectionLocalizationsRequest, SkillCollectionLocalizationBatchResponse, SkillCollectionLocalization, UpdateSkillCollectionRequest, UpsertSkillCollectionLocalizationRequest, SitemapResponse, AgentEventRequest, SkillCredStatus, InjectCredsRequest, InjectCredsResponse, InjectCredsForSkillRequest, InjectCredsForSkillResponse, CategoryListQuery, CategoryItem, PluginItemDetail, InstallReportRequest, InstallReportResponse, CallReportRequest, CallReportResponse, PluginEventRequest, CloudGatewayRequest, CloudGatewayResponse } from '@lobehub/market-types';
export * from '@lobehub/market-types';
export { CategoryItem, CategoryListQuery, CategoryListResponse, CredType, InjectCredsForSkillRequest, InjectCredsForSkillResponse, InjectCredsRequest, InjectCredsResponse, InjectedFileInfo, SkillCredStatus, UserCredSummary } from '@lobehub/market-types';
import { JSONSchema7 } from 'json-schema';
/**
* Visibility levels for plugins in the marketplace
* - public: Visible to all users
* - private: Visible only to the owner and authorized users
* - internal: Visible only within the organization
*/
declare const VisibilityEnumSchema: z.ZodEnum<["public", "private", "internal"]>;
/**
* Publication status options for plugins
* - published: Publicly available in the marketplace
* - unpublished: Not publicly visible
* - archived: Marked as no longer maintained
* - deprecated: Marked as deprecated, but still available
*/
declare const StatusEnumSchema: z.ZodEnum<["published", "unpublished", "archived", "deprecated"]>;
/**
* Common query parameters for admin list endpoints
* These parameters are used for pagination, filtering, and sorting.
*/
interface AdminListQueryParams {
/** Current page number (1-based) */
current?: number;
/** Search keyword for filtering results */
keyword?: string;
/** Number of items per page */
pageSize?: number;
/** Field to sort results by */
sortField?: string;
/** Sort direction */
sortOrder?: 'ascend' | 'descend';
}
/**
* Common response format for paginated admin list endpoints
* This structure provides both the data and pagination information.
*/
interface AdminListResponse<T> {
/** Current page number (1-based) */
current: number;
/** Array of items for the current page */
data: T[];
/** Number of items per page */
pageSize: number;
/** Total number of items across all pages */
total: number;
/** Total number of pages */
totalPages: number;
}
/**
* Review status options
* - pending: Awaiting review
* - approved: Review approved
* - rejected: Review rejected
*/
type ReviewStatus = 'pending' | 'approved' | 'rejected';
/**
* Review status schema for validation
*/
declare const ReviewStatusEnumSchema: z.ZodEnum<["published", "draft", "review", "rejected"]>;
/**
* Parameters for admin plugin listing
* Extends the common query parameters with plugin-specific filters.
*/
interface AdminPluginParams {
/** Filter for featured plugins */
featured?: boolean;
/** Maximum number of items to return */
limit?: number;
/** Number of items to skip */
offset?: number;
/** Sort direction */
order?: 'asc' | 'desc';
/** Field to sort by */
orderBy?: 'createdAt' | 'updatedAt' | 'installCount' | 'ratingAverage' | 'githubUpdateAt';
/** Filter by owner ID */
ownerId?: number;
/** Search query string */
query?: string;
/** Filter by plugin status */
status?: 'published' | 'draft' | 'review' | 'rejected';
/** Filter by visibility level */
visibility?: 'public' | 'private' | 'unlisted';
}
/**
* Parameters for creating a new plugin version
*/
interface PluginVersionCreateParams {
/** Author or organization name for this version */
author?: string;
/** URL to the author's website or profile */
authorUrl?: string;
/** Capability flag: whether this plugin provides prompts */
capabilitiesPrompts?: boolean;
/** Capability flag: whether this plugin manages resources (MCP) */
capabilitiesResources?: boolean;
/** Capability flag: whether this plugin provides tools */
capabilitiesTools?: boolean;
/** Category key for the plugin */
category?: string;
/** Description of the plugin version */
description?: string;
/** Icon URL or emoji for the plugin */
icon?: string;
/** Whether this is the latest version */
isLatest?: boolean;
/** Whether this version has been validated */
isValidated?: boolean;
/** Name of the plugin version */
name?: string;
/** Array of prompt definitions */
prompts?: any[];
/** README content */
readme?: string;
/** Array of resource definitions */
resources?: any[];
/** Summary of the plugin version */
summary?: string;
/** Array of tags for categorization */
tags?: string[];
/** Array of tool definitions */
tools?: any[];
/** Semantic version string (e.g., "1.0.0") */
version: string;
}
/**
* Parameters for updating an existing plugin version
*/
interface PluginVersionUpdateParams {
/** Author or organization name for this version */
author?: string;
/** URL to the author's website or profile */
authorUrl?: string;
/** Capability flag: whether this plugin provides prompts */
capabilitiesPrompts?: boolean;
/** Capability flag: whether this plugin manages resources (MCP) */
capabilitiesResources?: boolean;
/** Capability flag: whether this plugin provides tools */
capabilitiesTools?: boolean;
/** Category key for the plugin */
category?: string;
/** Description of the plugin version */
description?: string;
/** Icon URL or emoji for the plugin */
icon?: string;
/** Whether this version has been validated */
isValidated?: boolean;
/** Name of the plugin version */
name?: string;
/** Array of prompt definitions */
prompts?: any[];
/** README content */
readme?: string;
/** Array of resource definitions */
resources?: any[];
/** Summary of the plugin version */
summary?: string;
/** Array of tags for categorization */
tags?: string[];
/** Array of tool definitions */
tools?: any[];
}
/**
* Parameters for updating plugin basic metadata (non-version specific)
*/
interface PluginUpdateParams {
/** Cloud endpoint URL for official cloud-hosted deployment */
cloudEndpoint?: string;
/** GitHub last update timestamp */
githubUpdateAt?: string;
/** Unique identifier for the plugin */
identifier?: string;
/** Whether this plugin has been claimed by its original author */
isClaimed?: boolean;
/** Whether this plugin is featured */
isFeatured?: boolean;
/** Whether this plugin is officially maintained by LobeHub */
isOfficial?: boolean;
/** Publication status */
status?: 'published' | 'draft' | 'review' | 'rejected';
/** Visibility level */
visibility?: 'public' | 'private' | 'unlisted';
}
/**
* Plugin localization data
*/
interface PluginLocalization {
/** Plugin description in specific locale */
description: string;
/** Locale identifier (e.g., 'en-US', 'zh-CN') */
locale: string;
/** Plugin name in specific locale */
name: string;
/** Summary in specific locale */
summary?: string;
/** Plugin tags in specific locale */
tags?: string[];
}
/**
* Parameters for importing plugin i18n data
*/
interface PluginI18nImportParams {
/** Plugin identifier */
identifier: string;
/** Array of localizations for this plugin version */
localizations: PluginLocalization[];
/** Plugin version */
version: string;
}
/**
* Response from plugin i18n import operation
*/
interface PluginI18nImportResponse {
/** Number of failed localizations */
failed: number;
/** Number of successful localizations */
success: number;
/** Total number of processed localizations */
totalLocalizations: number;
}
/**
* Unclaimed plugin item data structure
* Represents a plugin that has not been claimed by its author
*/
interface UnclaimedPluginItem {
/** Plugin ID */
id: number;
/** Plugin identifier */
identifier: string;
}
/**
* Agent Profile type definitions for LobeHub Market SDK
*
* Types for the M2M agent profile API endpoints.
* These are used by agents (M2M clients) to view and update their own profile.
*/
/**
* Agent Profile Entity
*
* Represents the full agent profile as returned by the API
*/
interface AgentProfileEntity {
/** Agent avatar (emoji or URL) */
avatar: string;
/** M2M client ID */
clientId: string | null;
/** Number of comments on the agent */
commentCount: number;
/** Creation timestamp */
createdAt: string;
/** Current active version ID */
currentVersionId: number | null;
/** Number of favorites */
favoriteCount: number;
/** Number of forks */
forkCount: number;
/** ID of the agent this was forked from */
forkedFromAgentId: number | null;
/** Agent homepage URL */
homepage: string | null;
/** Agent database ID */
id: number;
/** Human-readable agent identifier */
identifier: string;
/** Total install count */
installCount: number;
/** Whether the agent is featured */
isFeatured: boolean;
/** Whether the agent is officially maintained */
isOfficial: boolean;
/** Number of likes */
likeCount: number;
/** Number of messages */
messageCount: number;
/** Agent display name */
name: string;
/** Owner account ID */
ownerId: number;
/** Average rating */
ratingAverage: number | null;
/** Number of ratings */
ratingCount: number;
/** Safety check result */
safetyCheck: string | null;
/** Publication status */
status: string;
/** Self-descriptive tags assigned by the agent */
tags: string[];
/** Last update timestamp */
updatedAt: string;
/** Visibility level */
visibility: string;
}
/**
* Get Agent Profile Response
*
* Response structure for GET /api/v1/agent/profile
*/
interface AgentProfileResponse {
/** The agent profile entity */
agent: AgentProfileEntity;
}
/**
* Update Agent Profile Request
*
* Request body for PATCH /api/v1/agent/profile
*/
interface UpdateAgentProfileRequest {
/** Agent avatar (emoji or URL) */
avatar?: string;
/** Agent display name (max 255 chars) */
name?: string;
/** Self-descriptive tags assigned by the agent */
tags?: string[];
}
/**
* Update Agent Profile Response
*
* Response structure for PATCH /api/v1/agent/profile
*/
interface UpdateAgentProfileResponse {
/** The updated agent profile entity */
agent: AgentProfileEntity;
}
/**
* Agent list query parameters
* Defines the query parameters for filtering and paginating agent results
*/
interface AgentListQuery {
/** Filter by category */
category?: string;
/** Filter by official status */
isOfficial?: 'true' | 'false';
/** Locale for localized content */
locale?: string;
/** Sort order */
order?: 'asc' | 'desc';
/** Filter by owner ID */
ownerId?: number | string;
/** Current page number (1-based) */
page?: number;
/** Number of items per page */
pageSize?: number;
/** Search query string */
q?: string;
/** Sort field */
sort?: 'createdAt' | 'knowledgeCount' | 'mostUsage' | 'name' | 'pluginCount' | 'recommended' | 'relevance' | 'tokenUsage' | 'updatedAt';
/** Publication status filter */
status?: 'published' | 'unpublished' | 'archived' | 'deprecated' | 'all';
/** Visibility filter */
visibility?: 'public' | 'private' | 'internal' | 'all';
}
/**
* Agent list response structure
* Defines the structure of the agent list API response
*/
interface AgentListResponse {
currentPage: number;
items: AgentItem[];
pageSize: number;
totalCount: number;
totalPages: number;
}
/**
* Agent detail query parameters
* Defines the query parameters for retrieving agent details
*/
interface AgentDetailQuery {
/** Locale for localized content */
locale?: string;
/** Specific version number to retrieve */
version?: string;
}
/**
* Agent detail response structure
* Represents the complete agent information including A2A AgentCard data
*/
interface AgentItemDetail extends AgentItem {
/** A2A protocol version */
a2aProtocolVersion?: string;
/** Author or organization name */
author?: string;
/** Avatar URL for the agent, can be a emoji */
avatar: string;
/** Category name used for classification */
category?: string;
/** Total comment count */
commentCount?: number;
/** Optional: Compatibility information for different platforms or versions */
compatibility?: Record<string, any>;
/** Agent configuration JSON */
config: any;
/** Resource creation date in the marketplace (ISO 8601 format) */
createdAt: string;
/** Current version id */
currentVersionId?: number;
/** Localized short description displayed in the marketplace listing */
description: string;
/** URL to human-readable documentation */
documentationUrl?: string;
/** Editor data for saving prompt content in editor mode */
editorData?: Record<string, any>;
/** Examples for usage */
examples?: string[];
/** Supported protocol extensions */
extensions?: any[];
/** Whether push notifications are supported */
hasPushNotifications?: boolean;
/** Whether state transition history is supported */
hasStateTransitionHistory?: boolean;
/** Whether streaming is supported */
hasStreaming?: boolean;
/** URL to the resource's homepage or documentation */
homepage?: string;
/** Icon URL or Emoji character */
icon?: string;
/** Agent database id */
id?: number;
/** Globally unique identifier, typically contains author/namespace and name */
identifier: string;
/** Total install count */
installCount?: number;
/** Additional interfaces supported */
interfaces?: any[];
/** Whether featured */
isFeatured?: boolean;
/** Whether officially maintained */
isOfficial?: boolean;
/** Locale */
locale?: string;
/** URL pointing to the detailed manifest file for this resource */
manifestUrl: string;
/** Localized display name shown in the marketplace listing */
name: string;
/** Owner ID */
ownerId?: number;
/** The transport of the preferred endpoint */
preferredTransport?: string;
/** Average rating */
ratingAverage?: number | null;
/** Rating count */
ratingCount?: number;
/** Security requirements */
securityRequirements?: any[];
/** Security schemes */
securitySchemes?: any;
/** Agent skills */
skills?: AgentSkill[];
/** Publication status */
status?: 'published' | 'unpublished' | 'archived' | 'deprecated' | 'all' | string | null;
/** A summary that helps find the correct agent */
summary?: string;
/** Whether the agent supports authenticated extended card */
supportsAuthenticatedExtendedCard?: boolean;
/** List of localized tags for filtering and categorization */
tags?: string[];
/** Token usage */
tokenUsage?: number;
/** Resource's last update date in the marketplace (ISO 8601 format) */
updatedAt: string;
/** Agent or A2A implementation version string */
version: string;
/** Version display name */
versionName?: string;
/** Incremental version number */
versionNumber: number;
/** Version list summary */
versions?: Array<{
isLatest: boolean;
isValidated: boolean;
status: string | null;
updatedAt: string;
version: string;
versionNumber: number;
}>;
/** Visibility */
visibility?: 'public' | 'private' | 'internal' | 'all' | string;
}
/**
* Agent skill structure
* Represents a skill that an agent can perform
*/
interface AgentSkill {
/** Skill description */
description: string;
/** Example prompts or use cases */
examples?: string[];
/** Input Media Types for this skill */
inputModes?: string[];
/** Localized skill information */
localizations?: Array<{
description: string;
examples?: string[];
locale: string;
name: string;
tags: string[];
}>;
/** Human-readable skill name */
name: string;
/** Output Media Types for this skill */
outputModes?: string[];
/** Unique skill identifier within the agent */
skillId: string;
/** Keywords/categories for discoverability */
tags: string[];
}
/**
* Agent Create Request
* Parameters for creating a new agent
*/
interface AgentCreateRequest {
/** Official homepage or repository URL for the agent */
homepage?: string;
/** Human readable agent identifier */
identifier: string;
/** Whether the agent is featured */
isFeatured?: boolean;
/** Default name of the agent */
name: string;
/** Status of the agent */
status?: 'published' | 'unpublished' | 'archived' | 'deprecated';
/** Visibility of the agent */
visibility?: 'public' | 'private' | 'internal';
}
/**
* Agent Create Response
* Response from creating a new agent
*/
interface AgentCreateResponse {
createdAt: string;
id: number;
identifier: string;
name: string;
ownerId: number;
updatedAt: string;
}
/**
* Agent Modify Request
* Parameters for modifying an existing agent
*/
interface AgentModifyRequest {
/** Official homepage or repository URL for the agent */
homepage?: string;
/** Human readable agent identifier (required) */
identifier: string;
/** Whether the agent is featured */
isFeatured?: boolean;
/** Whether this agent is officially maintained by LobeHub */
isOfficial?: boolean;
/** Default name of the agent */
name?: string;
/** Status of the agent */
status?: 'published' | 'unpublished' | 'archived' | 'deprecated';
/** Visibility of the agent */
visibility?: 'public' | 'private' | 'internal';
}
/**
* Agent Modify Response
* Response from modifying an agent
*/
interface AgentModifyResponse {
createdAt: string;
homepage: string | null;
id: number;
identifier: string;
isFeatured: boolean;
isOfficial: boolean;
name: string;
ownerId: number;
/** Safety check result (Safe, Risky, Dangerous) */
safetyCheck?: string | null;
status: string;
updatedAt: string;
visibility: string;
}
/**
* Agent Version Create Request
* Parameters for creating a new version of an existing agent
*/
interface AgentVersionCreateRequest {
/** A2A protocol version */
a2aProtocolVersion?: string;
/** Avatar URL for the agent, can be a emoji */
avatar?: string;
/** Category key for the agent */
category?: string;
/** Changelog for this version describing what changed */
changelog?: string;
/** Configuration JSON containing model definitions, tools, hyperparameters, etc. */
config?: Record<string, any>;
/** Array of default input Media Types */
defaultInputModes?: string[];
/** Array of default output Media Types */
defaultOutputModes?: string[];
/** Description of the agent */
description?: string;
/** URL to human-readable documentation */
documentationUrl?: string;
/** Editor data for saving prompt content in editor mode */
editorData?: Record<string, any>;
/** Supported protocol extensions */
extensions?: Array<Record<string, any>>;
/** Whether push notifications are supported */
hasPushNotifications?: boolean;
/** Whether state transition history is supported */
hasStateTransitionHistory?: boolean;
/** Whether streaming is supported */
hasStreaming?: boolean;
/** Agent identifier (required) */
identifier: string;
/** Additional interfaces supported */
interfaces?: Array<Record<string, any>>;
/** Name of the agent */
name?: string;
/** The transport of the preferred endpoint */
preferredTransport?: string;
/** Foreign key to the account that provides this agent */
providerId?: number;
/** Security requirements */
securityRequirements?: Array<Record<string, any>>;
/** Security schemes */
securitySchemes?: Record<string, any>;
/** Whether this version should become the current version */
setAsCurrent?: boolean;
/** A summary that help agent find correct agent */
summary?: string;
/** Whether the agent supports authenticated extended card */
supportsAuthenticatedExtendedCard?: boolean;
/** Tags for categorization */
tags?: string[];
/** Token usage for the agent */
tokenUsage?: number;
/** Base URL for the agent's A2A service */
url?: string;
/** Agent or A2A implementation version string */
version?: string;
/** Incremental version number for this agent (will auto-increment if not provided) */
versionNumber?: number;
}
/**
* Agent Version Create Response
* Response from creating a new agent version
*/
interface AgentVersionCreateResponse {
agentId: number;
createdAt: string;
description: string;
id: number;
isLatest: boolean;
name: string;
updatedAt: string;
version: string;
versionNumber: number;
}
/**
* Agent Version Modify Request
* Parameters for modifying a specific version of an existing agent
*/
interface AgentVersionModifyRequest {
/** A2A protocol version */
a2aProtocolVersion?: string;
/** Avatar URL for the agent, can be a emoji */
avatar?: string;
/** Category key for the agent */
category?: string;
/** Changelog for this version describing what changed */
changelog?: string;
/** Configuration JSON containing model definitions, tools, hyperparameters, etc. */
config?: Record<string, any>;
/** Array of default input Media Types */
defaultInputModes?: string[];
/** Array of default output Media Types */
defaultOutputModes?: string[];
/** Description of the agent */
description?: string;
/** URL to human-readable documentation */
documentationUrl?: string;
/** Editor data for saving prompt content in editor mode */
editorData?: Record<string, any>;
/** Supported protocol extensions */
extensions?: Array<Record<string, any>>;
/** Whether push notifications are supported */
hasPushNotifications?: boolean;
/** Whether state transition history is supported */
hasStateTransitionHistory?: boolean;
/** Whether streaming is supported */
hasStreaming?: boolean;
/** Agent identifier (required) */
identifier: string;
/** Additional interfaces supported */
interfaces?: Array<Record<string, any>>;
/** Name of the agent */
name?: string;
/** The transport of the preferred endpoint */
preferredTransport?: string;
/** Foreign key to the account that provides this agent */
providerId?: number;
/** Security requirements */
securityRequirements?: Array<Record<string, any>>;
/** Security schemes */
securitySchemes?: Record<string, any>;
/** Whether this version should become the current version */
setAsCurrent?: boolean;
/** A summary that help agent find correct agent */
summary?: string;
/** Whether the agent supports authenticated extended card */
supportsAuthenticatedExtendedCard?: boolean;
/** Token usage for the agent */
tokenUsage?: number;
/** Base URL for the agent's A2A service */
url?: string;
/** Version string to modify (required) */
version: string;
/** Agent or A2A implementation version string */
versionString?: string;
}
/**
* Agent Version Modify Response
* Response from modifying an agent version
*/
interface AgentVersionModifyResponse {
agentId: number;
createdAt: string;
description: string;
id: number;
isLatest: boolean;
name: string;
updatedAt: string;
version: string;
versionNumber: number;
}
/**
* Agent Interface
* Represents an interface endpoint for an agent
*/
interface AgentInterface {
transport: string;
url: string;
}
/**
* Agent Security Scheme
* Represents a security scheme for an agent
*/
interface AgentSecurityScheme {
schemeConfig: any;
schemeName: string;
}
/**
* Agent Security Requirement
* Represents a security requirement for an agent
*/
interface AgentSecurityRequirement {
requirement: any;
}
/**
* Agent Extension
* Represents a protocol extension for an agent
*/
interface AgentExtension {
description?: string;
params?: any;
required?: boolean;
uri: string;
}
/**
* Agent Version Localization
* Represents localized content for an agent version
*/
interface AgentVersionLocalization {
changelog?: string;
config: any;
description?: string;
locale: string;
name?: string;
shortDescription?: string;
}
/**
* Agent Upload Version Data
* Version data for agent upload
*/
interface AgentUploadVersion {
a2aProtocolVersion: string;
changelog?: string;
config: any;
defaultInputModes: string[];
defaultOutputModes: string[];
description: string;
documentationUrl?: string;
extensions?: AgentExtension[];
hasPushNotifications?: boolean;
hasStateTransitionHistory?: boolean;
hasStreaming?: boolean;
interfaces?: AgentInterface[];
localizations?: AgentVersionLocalization[];
name: string;
preferredTransport?: string;
providerId?: number;
securityRequirements?: AgentSecurityRequirement[];
securitySchemes?: AgentSecurityScheme[];
skills?: AgentSkill[];
supportsAuthenticatedExtendedCard?: boolean;
url: string;
version: string;
versionNumber: number;
}
/**
* Agent Upload Request
* Parameters for uploading a complete agent with version
*/
interface AgentUploadRequest {
agentIdentifier: string;
avatar?: string;
isOfficial?: boolean;
name: string;
ownerId: number;
version: AgentUploadVersion;
}
/**
* Agent Upload Response
* Response from uploading an agent
*/
interface AgentUploadResponse {
agentId: string;
agentIdentifier: string;
config: any;
createdAt: string;
description: string;
documentationUrl?: string;
hasPushNotifications: boolean;
hasStateTransitionHistory: boolean;
name: string;
updatedAt: string;
}
/**
* Agent Install Count Request
* Parameters for increasing agent install count
*/
interface AgentInstallCountRequest {
/** Agent identifier */
identifier: string;
}
/**
* Agent Install Count Response
* Response from increasing agent install count
*/
interface AgentInstallCountResponse {
/** Agent identifier */
identifier: string;
/** Updated install count */
installCount: number;
/** Whether the operation was successful */
success: boolean;
}
/**
* Agent Status
* Possible status values for an agent
*/
type AgentStatus = 'published' | 'unpublished' | 'archived' | 'deprecated';
/**
* Agent Status Change Response
* Response from changing agent status (publish/unpublish/archive/deprecate)
*/
interface AgentStatusChangeResponse {
/** Agent identifier */
identifier: string;
/** New status of the agent */
status: AgentStatus;
/** Whether the operation was successful */
success: boolean;
}
/**
* Own Agent List Query
* Query parameters for getting user's own agents
*/
interface OwnAgentListQuery {
/** Filter by category */
category?: string;
/** Locale for localized content */
locale?: string;
/** Sort order */
order?: 'asc' | 'desc';
/** Current page number (1-based) */
page?: number;
/** Number of items per page */
pageSize?: number;
/** Search query string */
q?: string;
/** Sort field */
sort?: 'createdAt' | 'knowledgeCount' | 'mostUsage' | 'name' | 'pluginCount' | 'tokenUsage' | 'updatedAt';
/** Filter by specific status, if not provided returns all statuses */
status?: AgentStatus;
}
/**
* Agent fork request parameters
* Defines the request body for forking an agent
*/
interface AgentForkRequest {
/** New agent identifier (required, must be globally unique) */
identifier: string;
/** New agent name (optional, defaults to "{original name} (Fork)") */
name?: string;
/** Status of the forked agent (optional, defaults to published) */
status?: 'published' | 'unpublished' | 'archived' | 'deprecated';
/** Version number to fork (optional, defaults to current version) */
versionNumber?: number;
/** Visibility of the forked agent (optional, defaults to public) */
visibility?: 'public' | 'private' | 'internal';
}
/**
* Agent fork response structure
* Defines the structure of the agent fork API response
*/
interface AgentForkResponse {
/** The newly created agent */
agent: {
createdAt: string;
forkedFromAgentId: number;
id: number;
identifier: string;
name: string;
ownerId: number;
updatedAt: string;
};
/** Information about the source agent */
source: {
agentId: number;
identifier: string;
versionNumber: number;
};
/** The initial version created for the forked agent */
version: {
agentId: number;
createdAt: string;
id: number;
versionNumber: number;
};
}
/**
* Agent fork item structure
* Represents a single forked agent in the forks list
*/
interface AgentForkItem {
createdAt: string;
forkCount: number;
id: number;
identifier: string;
name: string;
ownerId: number;
}
/**
* Agent forks list response
* Response structure for listing all forks of an agent
*/
interface AgentForksResponse {
forks: AgentForkItem[];
totalCount: number;
}
/**
* Agent fork source response
* Response structure for getting the source agent that this agent was forked from
*/
interface AgentForkSourceResponse {
source: AgentForkItem | null;
}
/**
* Agent Group Types
*
* Type definitions for agent group-related API requests and responses
*/
/**
* Agent group list query parameters
*/
interface AgentGroupListQuery {
/** Filter by category */
category?: string;
/** Filter by official status */
isOfficial?: 'true' | 'false';
/** Locale for localized content */
locale?: string;
/** Sort order */
order?: 'asc' | 'desc';
/** Filter by owner ID */
ownerId?: number | string;
/** Current page number (1-based) */
page?: number;
/** Number of items per page */
pageSize?: number;
/** Search query string */
q?: string;
/** Sort field */
sort?: 'createdAt' | 'updatedAt' | 'name' | 'recommended';
/** Publication status filter */
status?: 'published' | 'unpublished' | 'archived' | 'deprecated' | 'all';
/** Visibility filter */
visibility?: 'public' | 'private' | 'internal' | 'all';
}
/**
* Own agent groups list query parameters (authenticated)
*/
interface OwnAgentGroupListQuery {
/** Locale for localized content */
locale?: string;
/** Sort order */
order?: 'asc' | 'desc';
/** Current page number (1-based) */
page?: number;
/** Number of items per page */
pageSize?: number;
/** Search query string */
q?: string;
/** Sort field */
sort?: 'createdAt' | 'updatedAt' | 'name';
}
/**
* Agent group item in list
* Aligned with AgentItem structure for consistency
*/
interface AgentGroupItem {
/** Avatar URL (from current version) */
avatar?: string;
/** Background color (from current version) */
backgroundColor?: string;
/** Category (from current version) */
category?: string;
/** Comment count */
commentCount?: number;
/** Creation timestamp */
createdAt: string;
/** Current version ID */
currentVersionId?: number;
/** Description (from current version) */
description?: string;
/** Favorite count */
favoriteCount?: number;
/** Homepage URL */
homepage?: string;
/** Unique identifier (used as id for consistency) */
id: string;
/** Unique identifier */
identifier: string;
/** Install count */
installCount?: number;
/** Whether this is a featured group */
isFeatured?: boolean;
/** Whether this is official */
isOfficial?: boolean;
/** Like count */
likeCount?: number;
/** Group name */
name: string;
/** Owner account ID */
ownerId: number;
/** Average rating */
ratingAverage?: number;
/** Rating count */
ratingCount?: number;
/** Safety check status */
safetyCheck?: string;
/** Publication status */
status?: 'published' | 'unpublished' | 'archived' | 'deprecated';
/** Last update timestamp */
updatedAt: string;
/** Version number (from current version) */
versionNumber?: number;
/** Visibility */
visibility?: 'public' | 'private' | 'internal';
}
/**
* Agent group list response
* Aligned with AgentListResponse structure for consistency
*/
interface AgentGroupListResponse {
currentPage: number;
items: AgentGroupItem[];
pageSize: number;
totalCount: number;
totalPages: number;
}
/**
* Agent group detail query parameters
*/
interface AgentGroupDetailQuery {
/** Group identifier */
identifier: string;
/** Locale for localized content */
locale?: string;
/** Specific version number to retrieve */
version?: number;
}
/**
* Member agent in group
*/
interface MemberAgent {
/** A2A protocol version */
a2aProtocolVersion?: string;
/** Avatar */
avatar?: string;
/** Category */
category?: string;
/** Configuration */
config: any;
/** Default input modes */
defaultInputModes?: string[];
/** Default output modes */
defaultOutputModes?: string[];
/** Description */
description: string;
/** Display order */
displayOrder: number;
/** Documentation URL */
documentationUrl?: string;
/** Whether enabled */
enabled: boolean;
/** Extensions */
extensions?: any[];
/** Whether push notifications are supported */
hasPushNotifications?: boolean;
/** Whether state transition history is supported */
hasStateTransitionHistory?: boolean;
/** Whether streaming is supported */
hasStreaming?: boolean;
/** Unique identifier */
identifier: string;
/** Interfaces */
interfaces?: any[];
/** Name */
name: string;
/** Preferred transport */
preferredTransport?: string;
/** Role */
role: 'supervisor' | 'participant';
/** Security requirements */
securityRequirements?: any[];
/** Security schemes */
securitySchemes?: any;
/** Summary */
summary?: string;
/** Whether authenticated extended card is supported */
supportsAuthenticatedExtendedCard?: boolean;
/** Tags */
tags?: any;
/** URL */
url: string;
/** Version */
version: string;
}
/**
* Agent group detail response
*/
interface AgentGroupDetail {
/** Author/owner information */
author?: {
avatar?: string;
name?: string;
userName?: string;
};
group: {
avatar?: string;
backgroundColor?: string;
category?: string;
commentCount?: number;
config?: any;
createdAt: string;
currentVersionId?: number;
description: string;
favoriteCount?: number;
homepage?: string;
identifier: string;
installCount?: number;
isFeatured?: boolean;
isOfficial?: boolean;
likeCount?: number;
name: string;
ownerId: number;
ratingAverage?: number;
ratingCount?: number;
safetyCheck?: string;
status: string;
tags?: any;
updatedAt: string;
version: string;
versionNumber: number;
visibility: string;
};
/** Locale for localized content */
locale?: string;
memberAgents: MemberAgent[];
/** Summary extracted from description (auto-filled, max 200 chars) */
summary?: string;
/** All versions of this group */
versions?: Array<{
isLatest: boolean;
status: string;
updatedAt: string;
version: string;
versionNumber: number;
}>;
}
/**
* Member agent for creation
*/
interface CreateMemberAgent {
a2aProtocolVersion?: string;
avatar?: string;
category?: string;
config: any;
defaultInputModes?: string[];
defaultOutputModes?: string[];
description: string;
displayOrder?: number;
documentationUrl?: string;
extensions?: any[];
hasPushNotifications?: boolean;
hasStateTransitionHistory?: boolean;
hasStreaming?: boolean;
identifier: string;
interfaces?: any[];
name: string;
preferredTransport?: string;
role: 'supervisor' | 'participant';
securityRequirements?: any[];
securitySchemes?: any;
summary?: string;
supportsAuthenticatedExtendedCard?: boolean;
tags?: any;
url: string;
}
/**
* Create agent group request
*/
interface AgentGroupCreateRequest {
avatar?: string;
backgroundColor?: string;
category?: string;
config?: any;
description: string;
homepage?: string;
identifier: string;
memberAgents: CreateMemberAgent[];
name: string;
versionName?: string;
visibility?: 'public' | 'private' | 'internal';
}
/**
* Create agent group response
*/
interface AgentGroupCreateResponse {
group: {
avatar?: string;
backgroundColor?: string;
category?: string;
createdAt: string;
currentVersionId?: number;
description: string;
homepage?: string;
id: number;
identifier: string;
isFeatured: boolean;
isOfficial: boolean;
name: string;
ownerId: number;
status: string;
updatedAt: string;
visibility: string;
};
groupVersion: {
agentGroupId: number;
createdAt: string;
description: string;
id: number;
isLatest: boolean;
name: string;
status: string;
version: string;
versionNumber: number;
};
memberAgents: Array<{
agentGroupId: number;
createdAt: string;
displayOrder: number;
enabled: boolean;
id: number;
identifier: string;
name: string;
role: string;
updatedAt: string;
}>;
}
/**
* Member agent update for version create
*/
interface UpdateMemberAgent {
avatar?: string;
category?: string;
config?: any;
description?: string;
identifier: string;
name?: string;
url?: string;
}
/**
* Create agent group version request
*/
interface AgentGroupVersionCreateRequest {
avatar?: string;
backgroundColor?: string;
category?: string;
changelog?: string;
config?: any;
description?: string;
identifier: string;
memberAgents?: UpdateMemberAgent[];
name?: string;
tags?: any;
}
/**
* Create agent group version response
*/
interface AgentGroupVersionCreateResponse {
groupVersion: {
agentGroupId: number;
changelog?: string;
createdAt: string;
description: string;
id: number;
isLatest: boolean;
name: string;
status: string;
version: string;
versionNumber: number;
};
memberVersions: Array<{
agentForGroupId: number;
createdAt: string;
description: string;
id: number;
name: string;
url: string;
version: string;
versionNumber: number;
}>;
}
/**
* Modify agent group request
*/
interface AgentGroupModifyRequest {
avatar?: string;
backgroundColor?: string;
category?: string;
homepage?: string;
identifier: string;
isFeatured?: boolean;
isOfficial?: boolean;
name?: string;
status?: 'published' | 'unpublished' | 'archived' | 'deprecated';
visibility?: 'public' | 'private' | 'internal';
}
/**
* Modify agent group response
*/
interface AgentGroupModifyResponse {
avatar?: string;
backgroundColor?: string;
category?: string;
createdAt: string;
currentVersionId?: number;
description: string;
homepage?: string;
id: number;
identifier: string;
isFeatured: boolean;
isOfficial: boolean;
name: string;
ownerId: number;
status: string;
updatedAt: string;
visibility: string;
}
/**
* Agent group status
*/
type AgentGroupStatus = 'published' | 'unpublished' | 'archived' | 'deprecated';
/**
* Agent group status change response
*/
interface AgentGroupStatusChangeResponse {
identifier: string;
status: AgentGroupStatus;
success: boolean;
}
/**
* Agent group fork request parameters
* Defines the request body for forking an agent group
*/
interface AgentGroupForkRequest {
/** New group identifier (required, must be globally unique) */
identifier: string;
/** New group name (optional, defaults to "{original name} (Fork)") */
name?: string;
/** Status of the forked group (optional, defaults to published) */
status?: 'published' | 'unpublished' | 'archived' | 'deprecated';
/** Version number to fork (optional, defaults to current version) */
versionNumber?: number;
/** Visibility of the forked group (optional, defaults to public) */
visibility?: 'public' | 'private' | 'internal';
}
/**
* Agent group fork response structure
* Defines the structure of the agent group fork API response
*/
interface AgentGroupForkResponse {
/** The newly created agent group */
group: {
createdAt: string;
forkedFromGroupId: number;
id: number;
identifier: string;
name: string;
ownerId: number;
updatedAt: string;
};
/** The initial version created for the forked group */
groupVersion: {
agentGroupId: number;
createdAt: string;
id: number;
versionNumber: number;
};
/** All member agents created in the forked group */
memberAgents: Array<{
id: number;
identifier: string;
name: string;
role: string;
}>;
/** All member agent versions created in the forked group */
memberVersions: Array<{
agentForGroupId: number;
id: number;
versionNumber: number;
}>;
/** Information about the source group */
source: {
groupId: number;
identifier: string;
versionNumber: number;
};
}
/**
* Agent group fork item structure
* Represents a single forked agent group in the forks list
*/
interface AgentGroupForkItem {
createdAt: string;
forkCount: number;
id: number;
identifier: string;
name: string;
ownerId: number;
}
/**
* Agent group forks list response
* Response structure for listing all forks of an agent group
*/
interface AgentGroupForksResponse {
forks: AgentGroupForkItem[];
totalCount: number;
}
/**
* Agent group fork source response
* Response structure for getting the source group that this group was forked from
*/
interface AgentGroupForkSourceResponse {
source: AgentGroupForkItem | null;
}
/**
* Market Service Discovery Document
*
* Defines the structure of the discovery document returned by the API.
* This document provides information about available endpoints, authentication
* methods, and other capabilities of the Market API.
*/
interface DiscoveryDocument {
/** URL to the API documentation */
api_documentation_url?: string;
/** Authentication schemes supported by the API */
authentication?: {
/** List of supported authentication methods */
schemes_supported: Array<'none' | 'apiKey' | 'oauth2'>;
};
/** API issuer identifier (typically the base domain) */
issuer: string;
/** Template for constructing manifest endpoint URLs */
manifest_endpoint_template: string | Record<string, string>;
/** Version of the market index schema */
market_index_schema_version: number;
/** URL to the privacy policy */
policy_url?: string;
/** Mapping of resource types to their endpoint paths */
resource_endpoints: Record<string, string>;
/** List of resource types available in the marketplace */
resource_types_supported: string[];
/** List of response types supported by the API */
response_types_supported: string[];
/** List of locales supported for content localization */
support_locales: string[];
/** URL to the terms of service */
terms_of_service_url?: string;
}
/**
* SDK Configuration Options
*
* Options for configuring the behavior of the Market SDK.
*/
interface MarketSDKOptions {
/**
* Access Token for server-side authentication.
* If provided, the SDK will use this token directly instead of fetching one.
*/
accessToken?: string;
/**
* API Key for authentication
*/
apiKey?: string;
/**
* The base URL for the LobeHub Market API
*/
baseURL?: string;
/**
* The client ID for M2M authentication
*/
clientId?: string;
/**
* The client secret for M2M authentication
*/
clientSecret?: string;
/**
* The default locale for the market
* @default 'en-US'
*/
defaultLocale?: string;
/**
* Base URL for root path
*/
rootBaseURL?: string;
/**
* Trusted client token (encrypted payload) for trusted client authentication.
*
* If provided, the SDK will use the x-lobe-trust-token header for authentication,
* bypassing the standard OIDC flow. This token should be generated server-side
* using the shared secret and contain encrypted user identity information.
*
* @example
* ```typescript
* const sdk = new MarketSDK({
* trustedClientToken: encryptedToken,
* });
* ```
*/
trustedClientToken?: string;
/**
* Custom User-Agent string for identifying the client.
*
* If provided, this will be used instead of the default SDK User-Agent.
* Useful for CLI tools or other clients that want to identify themselves.
*
* @example
* ```typescript
* const sdk = new MarketSDK({
* userAgent: 'LobeHub-Market-CLI/1.0.0',
* });
* ```
*/
userAgent?: string;
}
/**
* Shared token state for SDK instances
*
* Used to share authentication tokens between multiple service instances
* to avoid duplicate token requests and improve performance.
*/
interface SharedTokenState {
/**
* The current access token
*/
accessToken?: string;
/**
* Token expiry timestamp (milliseconds since epoch)
*/
tokenExpiry?: number;
/**
* Promise for ongoing token request to prevent concurrent requests
*/
tokenPromise?: Promise<string>;
}
/**
* Creds SDK Types
*
* Type definitions for user credential management operations.
*/
/**
* Request for creating a KV credential (kv-env or kv-header)
*/
interface CreateKVCredRequest {
/** Optional description of the credential */
description?: string;
/** Unique key identifying this credential */
key: string;
/** Display name for the credential */
name: string;
/** Credential type: 'kv-env' or 'kv-header' */
type: 'kv-env' | 'kv-header';
/** Key-value pairs to store */
values: Record<string, string>;
}
/**
* Request for creating an OAuth credential
*/
interface CreateOAuthCredRequest {
/** Optional description of the credential */
description?: string;
/** Unique key identifying this credential */
key: string;
/** Display name for the credential */
name: string;
/** ID of the existing OAuth connection to link */
oauthConnectionId: number;
}
/**
* Request for creating a file credential
*/
interface CreateFileCredRequest {
/** Optional description of the credential */
description?: string;
/** Hash ID of the uploaded file */
fileHashId: string;
/** Original file name */
fileName: string;
/** Unique key identifying this credential */
key: string;
/** Display name for the credential */
name: string;
}
/**
* Request for updating a credential
*/
interface UpdateCredRequest {
/** Updated description */
description?: string;
/** Updated display name */
name?: string;
/** Updated key-value pairs (KV types only) */
values?: Record<string, string>;
}
/**
* Options for getting a credential
*/
interface GetCredOptions {
/** Set to true to include decrypted plaintext values (KV types only) */
decrypt?: boolean;
}
/**
* Response containing a list of credentials
*/
interface ListCredsResponse {
data: UserCredSummary[];
}
/**
* Response for successful deletion
*/
interface DeleteCredResponse {
success: boolean;
}
/**
* Extended credential summary with optional plaintext values
*/
interface CredWithPlaintext extends UserCredSummary {
/** Decrypted plaintext values (KV types only, when decrypt=true) */
plaintext?: Record<string,