{"version":3,"sources":["../src/plugin/admin.ts","../src/plugin/plugin.ts","../src/plugin/capabilities.ts","../src/plugin/deploymentOption.ts"],"sourcesContent":["// Admin plugin item schema definitions\nimport { z } from 'zod';\n\nimport { DeploymentOption, SystemDependency } from './deploymentOption';\nimport { BasePluginItemSchema, MarketPluginItem, PluginManifest } from './plugin';\n\n/**\n * Schema for admin-managed plugin items with additional status and visibility fields.\n * Extends the base plugin schema with administrative properties.\n */\nexport const AdminPluginItemSchema = BasePluginItemSchema.extend({\n  /** Publication status of the plugin */\n  status: z.enum(['published', 'unpublished', 'archived', 'deprecated'] as const),\n  /** Visibility level of the plugin */\n  visibility: z.enum(['public', 'private', 'internal'] as const),\n});\n\n/**\n * Interface for admin-managed plugin items.\n * Extends the market plugin item with administrative properties.\n */\nexport interface AdminPluginItem extends MarketPluginItem {\n  /** Unique numeric identifier for the plugin in the database */\n  id: number;\n  /** User ID of the plugin owner */\n  ownerId: number;\n  /** Publication status of the plugin */\n  status: 'published' | 'unpublished' | 'archived';\n  /** Visibility level controlling who can access the plugin */\n  visibility: 'public' | 'private' | 'internal';\n}\n\n/**\n * Plugin version database model.\n * Represents a specific version of a plugin in the database.\n */\nexport interface PluginVersion {\n  /** Creation timestamp (ISO 8601 format) */\n  createdAt: string;\n  /** Unique numeric identifier for the version */\n  id: number;\n  /** Whether this is the latest version of the plugin */\n  isLatest: boolean;\n  /** Whether this version has been validated by the system */\n  isValidated: boolean;\n  /** The full manifest data for this version */\n  manifest: PluginManifest;\n  /** URL to the manifest file, or null if stored directly */\n  manifestUrl: string | null;\n  /** Additional metadata for this version */\n  meta: Record<string, any> | null;\n  /** ID of the parent plugin */\n  pluginId: number;\n  /** Number of prompts provided by this version */\n  promptsCount: number;\n  /** Number of resources provided by this version */\n  resourcesCount: number;\n  /** Number of tools provided by this version */\n  toolsCount: number;\n  /** Last update timestamp (ISO 8601 format) */\n  updatedAt: string;\n  /** Semantic version string (e.g., \"1.0.0\") */\n  version: string;\n}\n\n/**\n * Detailed admin plugin item with version history.\n * Used for displaying complete plugin information in the admin interface.\n */\nexport interface AdminPluginItemDetail extends Omit<AdminPluginItem, 'manifestUrl'> {\n  /** Full manifest data for the current version */\n  manifest: PluginManifest;\n  /** List of all versions of this plugin */\n  versions: PluginVersion[];\n}\n\n/**\n * Admin deployment option with database ID.\n * Extends the basic deployment option with a database identifier.\n */\nexport interface AdminDeploymentOption extends DeploymentOption {\n  /** Unique numeric identifier for the deployment option */\n  id: number;\n}\n\n/**\n * Admin system dependency with database ID.\n * Extends the basic system dependency with a database identifier.\n */\nexport interface AdminSystemDependency extends SystemDependency {\n  /** Unique numeric identifier for the system dependency */\n  id: number;\n}\n\n/**\n * Plugin version localization data.\n * Represents localized content for a specific plugin version in a particular language.\n */\nexport interface PluginVersionLocalization {\n  /** Creation timestamp (ISO 8601 format) */\n  createdAt: string;\n  /** Localized description of the plugin */\n  description: string;\n  /** Unique numeric identifier for the localization */\n  id: number;\n  /** Language/locale code (e.g., 'en-US', 'zh-CN') */\n  locale: string;\n  /** Localized display name of the plugin */\n  name: string;\n  /** ID of the parent plugin version */\n  pluginVersionId: number;\n  /** Localized summary of the plugin */\n  summary?: string;\n  /** Array of localized tags for categorization and search */\n  tags?: string[];\n}\n\n/**\n * 不完整i18n插件项\n * 表示pluginVersionLocalizations只有1个条目的插件\n */\nexport interface IncompleteI18nPlugin {\n  /** 插件标识符 */\n  identifier: string;\n  /** 本地化条目数量 */\n  localizationCount: number;\n  /** 插件ID */\n  pluginId: number;\n  /** 插件版本 */\n  version: string;\n}\n\n/**\n * Range Data Point Interface\n * Defines the structure for daily trend data points in analysis\n */\nexport interface RangeDataPoint {\n  /** Current period count */\n  count: number;\n  /** Date in YYYY-MM-DD format */\n  date: string;\n  /** Previous period count for comparison */\n  prevCount: number;\n}\n\n/**\n * Range Statistics Interface\n * Defines the structure for range-based statistics\n */\nexport interface RangeStats {\n  /** Array of daily data points */\n  data: RangeDataPoint[];\n  /** Display configuration */\n  display: string;\n  /** Total sum for previous period */\n  prevSum: number;\n  /** Total sum for current period */\n  sum: number;\n}\n\n/**\n * Range query parameters for trend analysis\n */\nexport interface RangeQuery {\n  /** Display configuration */\n  display: string;\n  /** Optional previous period range for comparison */\n  prevRange?: [string, string];\n  /** Date range as [startDate, endDate] */\n  range: [string, string];\n}\n","import { z } from 'zod';\n\nimport { MarketItemBase } from '../market';\nimport { PluginCapabilitiesSchema, PluginPrompt, PluginResource, PluginTool } from './capabilities';\nimport { DeploymentOption, PluginConnectionType } from './deploymentOption';\n\n/**\n * Plugin compatibility information.\n * Defines the compatibility requirements for a plugin with respect to app versions and platforms.\n */\nexport interface PluginCompatibility {\n  /** Maximum app version the plugin is compatible with */\n  maxAppVersion?: string;\n  /** Minimum app version required to use the plugin */\n  minAppVersion?: string;\n  /** List of supported platforms (e.g., 'web', 'desktop', 'mobile') */\n  platforms?: string[];\n}\n\n/**\n * Simplified plugin version information.\n * Contains minimal version data for plugin version lists.\n */\nexport interface PluginVersionSummary {\n  /** Creation timestamp (ISO 8601 format) */\n  createdAt: string;\n  /** Whether this is the latest version of the plugin */\n  isLatest: boolean;\n  /** Whether this version has been validated by the system */\n  isValidated: boolean;\n  /** Semantic version string (e.g., \"1.0.0\") */\n  version: string;\n}\n\n/**\n * Base plugin item schema with Zod validation.\n * Defines the structure and validation rules for plugin items in the marketplace.\n */\nexport const BasePluginItemSchema = z.object({\n  author: z.string().optional(),\n  capabilities: PluginCapabilitiesSchema,\n  category: z.string().optional(),\n  commentCount: z.number().default(0),\n  connectionType: z.enum(['local', 'remote', 'hybrid']).optional(),\n  createdAt: z.string(),\n  description: z.string(),\n  github: z\n    .object({\n      language: z.string().optional(),\n      license: z.string().optional(),\n      stars: z.number().optional(),\n      url: z.string(),\n    })\n    .optional(),\n  homepage: z.string().optional(),\n  icon: z.string().optional(),\n  identifier: z.string(),\n  installCount: z.number().default(0),\n  isClaimed: z.boolean().default(false),\n  isFeatured: z.boolean().default(false),\n  isOfficial: z.boolean().default(false),\n  isValidated: z.boolean().default(false),\n  manifestUrl: z.string(),\n  name: z.string(),\n  promptsCount: z.number().optional(),\n  ratingAverage: z.number().optional(),\n  ratingCount: z.number().default(0),\n  resourcesCount: z.number().optional(),\n  toolsCount: z.number().optional(),\n  updatedAt: z.string(),\n});\n\n/**\n * Plugin marketplace item definition.\n * Extends the base marketplace item with plugin-specific properties.\n * This interface represents a plugin as it appears in the marketplace listing.\n */\nexport interface MarketPluginItem extends MarketItemBase {\n  /** Capabilities provided by this plugin */\n  capabilities?: {\n    /** Whether the plugin provides custom prompts */\n    prompts: boolean;\n    /** Whether the plugin provides resources (assets) */\n    resources: boolean;\n    /** Whether the plugin provides tools (functions) */\n    tools: boolean;\n  };\n  /** Number of comments on this plugin */\n  commentCount?: number;\n  /** Connection type strategy for communicating with the plugin */\n  connectionType?: PluginConnectionType;\n  /** GitHub repository information */\n  github?: {\n    language?: string;\n    license?: string;\n    stars?: number;\n    url: string;\n  };\n  /** Number of times this plugin has been installed */\n  installCount?: number;\n  /** Whether this plugin has been claimed by its original author */\n  isClaimed?: boolean;\n  /** Whether this plugin is featured in the marketplace */\n  isFeatured?: boolean;\n  /** Whether this plugin is officially maintained by LobeHub */\n  isOfficial?: boolean;\n  /** Whether this plugin has been validated by the system */\n  isValidated?: boolean;\n  /** Number of prompts provided by this plugin */\n  promptsCount?: number;\n  /** Average rating (typically 1-5 scale) */\n  ratingAverage?: number;\n  /** Number of ratings received */\n  ratingCount?: number;\n  /** Number of resources provided by this plugin */\n  resourcesCount?: number;\n  summary?: string;\n  /** Number of tools provided by this plugin */\n  toolsCount?: number;\n}\n\n/** Type alias for the base plugin item validated by Zod schema */\nexport type BasePluginItem = z.infer<typeof BasePluginItemSchema>;\n\n/**\n * Plugin manifest definition.\n * This is the complete specification of a plugin, including all its capabilities,\n * metadata, and deployment options.\n */\nexport interface PluginItemDetail extends Omit<MarketPluginItem, 'author' | 'manifestUrl'> {\n  // 构建产物信息\n  artifacts?: {\n    docker?: {\n      imageName?: string;\n      tag?: string;\n    };\n    npm?: {\n      packageName?: string;\n      version?: string;\n    };\n    pypi?: {\n      packageName?: string;\n      version?: string;\n    };\n  };\n  /** Author information */\n  author?: {\n    /** Author or organization name */\n    name: string;\n    /** URL to the author's website or profile */\n    url?: string;\n  };\n  /** Connection type strategy for communicating with the plugin */\n  connectionType?: PluginConnectionType;\n  /** Available deployment options */\n  deploymentOptions?: DeploymentOption[];\n  /**\n   * GitHub\n   */\n  github?: {\n    language?: string;\n    license?: string;\n    stars?: number;\n    url: string;\n  };\n  overview: {\n    readme: string;\n    summary?: string;\n  };\n  /** List of prompt templates provided by this plugin */\n  prompts?: PluginPrompt[];\n  /** List of resources provided by this plugin */\n  resources?: PluginResource[];\n  /** List of tools provided by this plugin */\n  tools?: PluginTool[];\n\n  /** Date when the plugin was created in the marketplace (ISO 8601 format) */\n  validatedAt?: string;\n  /** Semantic version string (e.g., \"1.0.0\") */\n  version: string;\n  /** List of all versions of this plugin with simplified information */\n  versions: PluginVersionSummary[];\n}\n\n/**\n * Plugin manifest definition.\n * This is the complete specification of a plugin, including all its capabilities,\n * metadata, and deployment options.\n */\nexport interface PluginManifest extends Omit<MarketPluginItem, 'author' | 'manifestUrl'> {\n  /** Author information */\n  author?: {\n    /** Author or organization name */\n    name: string;\n    /** URL to the author's website or profile */\n    url?: string;\n  };\n  /** Available deployment options */\n  deploymentOptions?: DeploymentOption[];\n  overview?: {\n    readme?: string;\n    summary?: string;\n  };\n  /** List of prompt templates provided by this plugin */\n  prompts?: PluginPrompt[];\n  /** List of resources provided by this plugin */\n  resources?: PluginResource[];\n  /** List of tools provided by this plugin */\n  tools?: PluginTool[];\n  /** Date when the plugin was created in the marketplace (ISO 8601 format) */\n  validatedAt?: string;\n  /** Semantic version string (e.g., \"1.0.0\") */\n  version: string;\n}\n","// Plugin capability definitions\nimport { z } from 'zod';\n\n/**\n * Schema defining the capabilities a plugin can provide.\n * Each capability is represented as a boolean flag.\n */\nexport const PluginCapabilitiesSchema = z.object({\n  /** Whether the plugin provides custom prompts */\n  prompts: z.boolean().default(false),\n  /** Whether the plugin provides resources (assets) */\n  resources: z.boolean().default(false),\n  /** Whether the plugin provides tools (functions) */\n  tools: z.boolean().default(false),\n});\n\n/**\n * Definition of a tool that a plugin can provide.\n * Tools are functions that can be called by the chat application.\n */\nexport interface PluginTool {\n  /** Human-readable description of what the tool does */\n  description?: string;\n  /** JSON schema defining the expected input parameters */\n  inputSchema?: Record<string, any>;\n  /** Unique identifier for the tool within the plugin */\n  name: string;\n}\n\n/**\n * Definition of a resource (asset) that a plugin can provide.\n * Resources can be images, data files, or other assets needed by the plugin.\n */\nexport interface PluginResource {\n  /** MIME type of the resource (e.g., 'image/png', 'application/json') */\n  mimeType?: string;\n  /** Optional display name for the resource */\n  name?: string;\n  /** URI where the resource can be accessed */\n  uri: string;\n}\n\n/**\n * Definition of an argument for a prompt template.\n * Arguments allow users to customize the prompt when using it.\n */\nexport interface PromptArgument {\n  /** Human-readable description of the argument's purpose */\n  description?: string;\n  /** Argument identifier */\n  name: string;\n  /** Whether the argument must be provided (defaults to false if omitted) */\n  required?: boolean;\n  /** Data type of the argument (e.g., 'string', 'number') */\n  type?: string;\n}\n\n/**\n * Definition of a prompt template that a plugin can provide.\n * Prompts are pre-defined templates that can be used in conversations.\n */\nexport interface PluginPrompt {\n  /** List of customizable arguments for this prompt */\n  arguments?: PromptArgument[];\n  /** Human-readable description of what the prompt does */\n  description: string;\n  /** Unique identifier for the prompt within the plugin */\n  name: string;\n}\n","import { z } from 'zod';\n\n/**\n * Connection types for plugin communication.\n * - http: The plugin communicates via HTTP protocol\n * - stdio: The plugin communicates via standard input/output\n */\nexport const ConnectionTypeEnum = z.enum(['http', 'stdio']);\nexport type ConnectionType = z.infer<typeof ConnectionTypeEnum>;\n\n/**\n * Plugin connection types for overall plugin communication strategy.\n * - local: Plugin only supports local communication (stdio)\n * - remote: Plugin only supports remote communication (http)\n * - hybrid: Plugin supports both local and remote communication\n */\nexport const PluginConnectionTypeEnum = z.enum(['local', 'remote', 'hybrid']);\nexport type PluginConnectionType = z.infer<typeof PluginConnectionTypeEnum>;\n\n/**\n * Plugin installation methods.\n * Different ways to install and deploy a plugin.\n */\nexport const InstallationMethodEnum = z.enum([\n  'npm', // Node.js package manager\n  'go', // Go language\n  'python', // Python language\n  'docker', // Docker container\n  'git', // Git repository\n  'binaryUrl', // Direct binary download URL\n  'manual', // Manual installation with instructions\n  'none', // No installation required\n]);\nexport type InstallationMethod = z.infer<typeof InstallationMethodEnum>;\n\n/**\n * System dependency required by a plugin.\n * Defines a software dependency that must be installed on the system.\n */\nexport interface SystemDependency {\n  /** Command to check if the dependency is installed */\n  checkCommand?: string;\n  /** Description of what this dependency is for */\n  description?: string;\n  /** Platform-specific installation instructions */\n  installInstructions?: Record<string, string>;\n  /** Name of the dependency */\n  name: string;\n  /** Minimum required version */\n  requiredVersion?: string;\n  /** Type of dependency (e.g., 'runtime', 'library') */\n  type?: string;\n  /** Whether version parsing is required to check compatibility */\n  versionParsingRequired?: boolean;\n}\n\n/**\n * Connection configuration for a plugin.\n * Defines how the application should communicate with the plugin.\n */\nexport interface ConnectionConfig {\n  /** Command-line arguments for the plugin process */\n  args?: string[];\n  /** Command to execute to start the plugin */\n  command?: string;\n  /**\n   * JSON Schema 配置\n   * 插件运行时需要的 configSchema\n   */\n  configSchema?: any;\n  /** Type of connection (http or stdio) */\n  type: ConnectionType;\n  /** URL for HTTP-based plugins */\n  url?: string;\n}\n\n/**\n * Details for installing a plugin.\n * Provides specific information needed during the installation process.\n */\nexport interface InstallationDetails {\n  /** Package name for npm, pip, or other package managers */\n  packageName?: string;\n  /** Git repository URL to clone */\n  repositoryUrlToClone?: string;\n  /** Ordered list of setup steps to execute after installation */\n  setupSteps?: string[];\n}\n\n/**\n * Deployment option for a plugin.\n * A plugin can offer multiple deployment options, each with different requirements.\n */\nexport interface DeploymentOption {\n  /** Connection configuration for this deployment option */\n  connection: ConnectionConfig;\n  /** Human-readable description of this deployment option */\n  description?: string;\n  /** Detailed installation instructions */\n  installationDetails?: InstallationDetails;\n  /** Method used to install this plugin */\n  installationMethod: string;\n  /** Whether this is the recommended deployment option */\n  isRecommended?: boolean;\n  /** System dependencies required for this deployment option */\n  systemDependencies?: SystemDependency[];\n}\n"],"mappings":";AACA,SAAS,KAAAA,UAAS;;;ACDlB,SAAS,KAAAC,UAAS;;;ACClB,SAAS,SAAS;AAMX,IAAM,2BAA2B,EAAE,OAAO;AAAA;AAAA,EAE/C,SAAS,EAAE,QAAQ,EAAE,QAAQ,KAAK;AAAA;AAAA,EAElC,WAAW,EAAE,QAAQ,EAAE,QAAQ,KAAK;AAAA;AAAA,EAEpC,OAAO,EAAE,QAAQ,EAAE,QAAQ,KAAK;AAClC,CAAC;;;ADwBM,IAAM,uBAAuBC,GAAE,OAAO;AAAA,EAC3C,QAAQA,GAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,cAAc;AAAA,EACd,UAAUA,GAAE,OAAO,EAAE,SAAS;AAAA,EAC9B,cAAcA,GAAE,OAAO,EAAE,QAAQ,CAAC;AAAA,EAClC,gBAAgBA,GAAE,KAAK,CAAC,SAAS,UAAU,QAAQ,CAAC,EAAE,SAAS;AAAA,EAC/D,WAAWA,GAAE,OAAO;AAAA,EACpB,aAAaA,GAAE,OAAO;AAAA,EACtB,QAAQA,GACL,OAAO;AAAA,IACN,UAAUA,GAAE,OAAO,EAAE,SAAS;AAAA,IAC9B,SAASA,GAAE,OAAO,EAAE,SAAS;AAAA,IAC7B,OAAOA,GAAE,OAAO,EAAE,SAAS;AAAA,IAC3B,KAAKA,GAAE,OAAO;AAAA,EAChB,CAAC,EACA,SAAS;AAAA,EACZ,UAAUA,GAAE,OAAO,EAAE,SAAS;AAAA,EAC9B,MAAMA,GAAE,OAAO,EAAE,SAAS;AAAA,EAC1B,YAAYA,GAAE,OAAO;AAAA,EACrB,cAAcA,GAAE,OAAO,EAAE,QAAQ,CAAC;AAAA,EAClC,WAAWA,GAAE,QAAQ,EAAE,QAAQ,KAAK;AAAA,EACpC,YAAYA,GAAE,QAAQ,EAAE,QAAQ,KAAK;AAAA,EACrC,YAAYA,GAAE,QAAQ,EAAE,QAAQ,KAAK;AAAA,EACrC,aAAaA,GAAE,QAAQ,EAAE,QAAQ,KAAK;AAAA,EACtC,aAAaA,GAAE,OAAO;AAAA,EACtB,MAAMA,GAAE,OAAO;AAAA,EACf,cAAcA,GAAE,OAAO,EAAE,SAAS;AAAA,EAClC,eAAeA,GAAE,OAAO,EAAE,SAAS;AAAA,EACnC,aAAaA,GAAE,OAAO,EAAE,QAAQ,CAAC;AAAA,EACjC,gBAAgBA,GAAE,OAAO,EAAE,SAAS;AAAA,EACpC,YAAYA,GAAE,OAAO,EAAE,SAAS;AAAA,EAChC,WAAWA,GAAE,OAAO;AACtB,CAAC;;;AD5DM,IAAM,wBAAwB,qBAAqB,OAAO;AAAA;AAAA,EAE/D,QAAQC,GAAE,KAAK,CAAC,aAAa,eAAe,YAAY,YAAY,CAAU;AAAA;AAAA,EAE9E,YAAYA,GAAE,KAAK,CAAC,UAAU,WAAW,UAAU,CAAU;AAC/D,CAAC;;;AGfD,SAAS,KAAAC,UAAS;AAOX,IAAM,qBAAqBA,GAAE,KAAK,CAAC,QAAQ,OAAO,CAAC;AASnD,IAAM,2BAA2BA,GAAE,KAAK,CAAC,SAAS,UAAU,QAAQ,CAAC;AAOrE,IAAM,yBAAyBA,GAAE,KAAK;AAAA,EAC3C;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AACF,CAAC;","names":["z","z","z","z","z"]}