@lobehub/market-types 1.0.4 → 1.0.6

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/README.md ADDED
@@ -0,0 +1,102 @@
1
+ # LobeHub Market Types
2
+
3
+ [![NPM version](https://img.shields.io/npm/v/@lobehub/market-sdk.svg?style=flat)](https://npmjs.org/package/@lobehub/market-types)
4
+ [![NPM downloads](https://img.shields.io/npm/dm/@lobehub/market-sdk.svg?style=flat)](https://npmjs.org/package/@lobehub/market-types)
5
+
6
+ This package contains TypeScript type definitions for the LobeHub Market ecosystem. It provides a comprehensive set of interfaces and type definitions that are shared between the API server and client applications.
7
+
8
+ ## Overview
9
+
10
+ The type definitions in this package are organized into the following categories:
11
+
12
+ - **Market Base Types**: Common type definitions used across all marketplace items
13
+ - **Plugin Types**: Types related to plugins, their capabilities, and deployment options
14
+ - **Agent Types**: Types related to AI agents and their features
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ npm install @lobehub/market-types
20
+ # or
21
+ yarn add @lobehub/market-types
22
+ # or
23
+ pnpm add @lobehub/market-types
24
+ ```
25
+
26
+ ## Usage
27
+
28
+ Import the types you need in your TypeScript files:
29
+
30
+ ```typescript
31
+ import { AgentItem, MarketItemBase, PluginManifest } from '@lobehub/market-types';
32
+
33
+ // Use the types in your code
34
+ const plugin: PluginManifest = {
35
+ id: 'my-plugin',
36
+ name: 'My Plugin',
37
+ description: 'A sample plugin',
38
+ version: '1.0.0',
39
+ // ...other properties
40
+ };
41
+ ```
42
+
43
+ ## Type Categories
44
+
45
+ ### Market Base Types
46
+
47
+ The `MarketItemBase` interface defines the common properties shared by all marketplace items:
48
+
49
+ ```typescript
50
+ interface MarketItemBase {
51
+ author?: string;
52
+ category?: string;
53
+ description: string;
54
+ identifier: string;
55
+ name: string;
56
+ // ...other properties
57
+ }
58
+ ```
59
+
60
+ ### Plugin Types
61
+
62
+ Plugin-related types include:
63
+
64
+ - `PluginManifest`: Complete specification of a plugin
65
+ - `PluginTool`: Definition of a tool provided by a plugin
66
+ - `PluginPrompt`: Definition of a prompt template
67
+ - `PluginResource`: Definition of a resource provided by a plugin
68
+ - `DeploymentOption`: Deployment configuration for a plugin
69
+
70
+ ### Agent Types
71
+
72
+ Agent-related types include:
73
+
74
+ - `AgentItem`: Definition of an agent in the marketplace
75
+
76
+ ## Structure
77
+
78
+ ```
79
+ src/
80
+ ├── market.ts - Base marketplace item types
81
+ ├── agent/ - Agent-related types
82
+ │ └── index.ts - Agent type definitions
83
+ ├── plugin/ - Plugin-related types
84
+ │ ├── admin.ts - Admin-specific plugin types
85
+ │ ├── capabilities.ts - Plugin capability types
86
+ │ ├── deploymentOption.ts - Deployment option types
87
+ │ ├── plugin.ts - Core plugin types
88
+ │ └── index.ts - Plugin exports
89
+ └── index.ts - Package exports
90
+ ```
91
+
92
+ ## Development
93
+
94
+ To build the package:
95
+
96
+ ```bash
97
+ pnpm build
98
+ ```
99
+
100
+ ## License
101
+
102
+ MIT
package/dist/index.d.mts CHANGED
@@ -1,384 +1,550 @@
1
1
  import { z } from 'zod';
2
2
 
3
3
  /**
4
- * 市场列表中单个资源项的基础结构
4
+ * Base structure for a single resource item in the marketplace.
5
+ * This interface defines the common properties shared by all marketplace items,
6
+ * including plugins, agents, and other resources.
5
7
  */
6
8
  interface MarketItemBase {
7
- /** 全局唯一标识符, 通常包含作者/命名空间和名称 */
8
- identifier: string;
9
- /** 在市场列表中显示的名称 (已本地化) */
10
- name: string;
11
- /** 在市场列表中显示的简短描述 (已本地化) */
12
- description: string;
13
- /** 指向该资源详细 Manifest 文件的 URL */
14
- manifestUrl: string;
15
- /** 作者或组织名称 */
9
+ /** Author or organization name */
16
10
  author?: string;
17
- /** 资源在市场中创建的日期 (ISO 8601) */
11
+ /** Category name used for classification */
12
+ category?: string;
13
+ /** Optional: Compatibility information for different platforms or versions */
14
+ compatibility?: Record<string, any>;
15
+ /** Resource creation date in the marketplace (ISO 8601 format) */
18
16
  createdAt: string;
19
- /** 资源在市场中最后更新的日期 (ISO 8601) */
20
- updatedAt: string;
21
- /** 资源的主页或文档链接 */
17
+ /** Localized short description displayed in the marketplace listing */
18
+ description: string;
19
+ /** URL to the resource's homepage or documentation */
22
20
  homepage?: string;
23
- /** 图标 URL Emoji */
21
+ /** Icon URL or Emoji character */
24
22
  icon?: string;
25
- /** 标签列表 (已本地化) */
23
+ /** Globally unique identifier, typically contains author/namespace and name */
24
+ identifier: string;
25
+ /** URL pointing to the detailed manifest file for this resource */
26
+ manifestUrl: string;
27
+ /** Localized display name shown in the marketplace listing */
28
+ name: string;
29
+ /** List of localized tags for filtering and categorization */
26
30
  tags?: string[];
27
- /** 分类名称 */
28
- category?: string;
29
- /** 可选:兼容性信息 */
30
- compatibility?: Record<string, any>;
31
+ /** Resource's last update date in the marketplace (ISO 8601 format) */
32
+ updatedAt: string;
31
33
  }
32
34
 
35
+ /**
36
+ * Connection types for plugin communication.
37
+ * - http: The plugin communicates via HTTP protocol
38
+ * - stdio: The plugin communicates via standard input/output
39
+ */
40
+ declare const ConnectionTypeEnum: z.ZodEnum<["http", "stdio"]>;
41
+ type ConnectionType = z.infer<typeof ConnectionTypeEnum>;
42
+ /**
43
+ * Plugin installation methods.
44
+ * Different ways to install and deploy a plugin.
45
+ */
46
+ declare const InstallationMethodEnum: z.ZodEnum<["npm", "go", "python", "docker", "git", "binaryUrl", "manual", "none"]>;
47
+ type InstallationMethod = z.infer<typeof InstallationMethodEnum>;
48
+ /**
49
+ * System dependency required by a plugin.
50
+ * Defines a software dependency that must be installed on the system.
51
+ */
52
+ interface SystemDependency {
53
+ /** Command to check if the dependency is installed */
54
+ checkCommand?: string;
55
+ /** Description of what this dependency is for */
56
+ description?: string;
57
+ /** Platform-specific installation instructions */
58
+ installInstructions?: Record<string, string>;
59
+ /** Name of the dependency */
60
+ name: string;
61
+ /** Minimum required version */
62
+ requiredVersion?: string;
63
+ /** Type of dependency (e.g., 'runtime', 'library') */
64
+ type?: string;
65
+ /** Whether version parsing is required to check compatibility */
66
+ versionParsingRequired?: boolean;
67
+ }
68
+ /**
69
+ * Connection configuration for a plugin.
70
+ * Defines how the application should communicate with the plugin.
71
+ */
72
+ interface ConnectionConfig {
73
+ /** Command-line arguments for the plugin process */
74
+ args?: string[];
75
+ /** Command to execute to start the plugin */
76
+ command?: string;
77
+ /** Type of connection (http or stdio) */
78
+ type: ConnectionType;
79
+ /** URL for HTTP-based plugins */
80
+ url?: string;
81
+ }
82
+ /**
83
+ * Details for installing a plugin.
84
+ * Provides specific information needed during the installation process.
85
+ */
86
+ interface InstallationDetails {
87
+ /** Package name for npm, pip, or other package managers */
88
+ packageName?: string;
89
+ /** Git repository URL to clone */
90
+ repositoryUrlToClone?: string;
91
+ /** Ordered list of setup steps to execute after installation */
92
+ setupSteps?: string[];
93
+ }
94
+ /**
95
+ * Deployment option for a plugin.
96
+ * A plugin can offer multiple deployment options, each with different requirements.
97
+ */
98
+ interface DeploymentOption {
99
+ /** Connection configuration for this deployment option */
100
+ connection: ConnectionConfig;
101
+ /** Human-readable description of this deployment option */
102
+ description?: string;
103
+ /** Detailed installation instructions */
104
+ installationDetails?: InstallationDetails;
105
+ /** Method used to install this plugin */
106
+ installationMethod: string;
107
+ /** Whether this is the recommended deployment option */
108
+ isRecommended?: boolean;
109
+ /** System dependencies required for this deployment option */
110
+ systemDependencies?: SystemDependency[];
111
+ }
112
+
113
+ /**
114
+ * Schema defining the capabilities a plugin can provide.
115
+ * Each capability is represented as a boolean flag.
116
+ */
33
117
  declare const PluginCapabilitiesSchema: z.ZodObject<{
34
- tools: z.ZodDefault<z.ZodBoolean>;
118
+ /** Whether the plugin provides custom prompts */
35
119
  prompts: z.ZodDefault<z.ZodBoolean>;
120
+ /** Whether the plugin provides resources (assets) */
36
121
  resources: z.ZodDefault<z.ZodBoolean>;
122
+ /** Whether the plugin provides tools (functions) */
123
+ tools: z.ZodDefault<z.ZodBoolean>;
37
124
  }, "strip", z.ZodTypeAny, {
38
- tools: boolean;
39
125
  prompts: boolean;
40
126
  resources: boolean;
127
+ tools: boolean;
41
128
  }, {
42
- tools?: boolean | undefined;
43
129
  prompts?: boolean | undefined;
44
130
  resources?: boolean | undefined;
131
+ tools?: boolean | undefined;
45
132
  }>;
46
133
  /**
47
- * 工具项定义
134
+ * Definition of a tool that a plugin can provide.
135
+ * Tools are functions that can be called by the chat application.
48
136
  */
49
137
  interface PluginTool {
50
- name: string;
138
+ /** Human-readable description of what the tool does */
51
139
  description?: string;
140
+ /** JSON schema defining the expected input parameters */
52
141
  inputSchema?: Record<string, any>;
142
+ /** Unique identifier for the tool within the plugin */
143
+ name: string;
53
144
  }
54
145
  /**
55
- * 资源项定义
146
+ * Definition of a resource (asset) that a plugin can provide.
147
+ * Resources can be images, data files, or other assets needed by the plugin.
56
148
  */
57
149
  interface PluginResource {
58
- uri: string;
59
- name?: string;
150
+ /** MIME type of the resource (e.g., 'image/png', 'application/json') */
60
151
  mimeType?: string;
152
+ /** Optional display name for the resource */
153
+ name?: string;
154
+ /** URI where the resource can be accessed */
155
+ uri: string;
61
156
  }
62
157
  /**
63
- * 提示词参数定义
158
+ * Definition of an argument for a prompt template.
159
+ * Arguments allow users to customize the prompt when using it.
64
160
  */
65
161
  interface PromptArgument {
162
+ /** Human-readable description of the argument's purpose */
163
+ description?: string;
164
+ /** Argument identifier */
66
165
  name: string;
166
+ /** Whether the argument must be provided (defaults to false if omitted) */
67
167
  required?: boolean;
68
- description?: string;
168
+ /** Data type of the argument (e.g., 'string', 'number') */
69
169
  type?: string;
70
170
  }
71
171
  /**
72
- * 提示词项定义
172
+ * Definition of a prompt template that a plugin can provide.
173
+ * Prompts are pre-defined templates that can be used in conversations.
73
174
  */
74
175
  interface PluginPrompt {
75
- name: string;
76
- description: string;
176
+ /** List of customizable arguments for this prompt */
77
177
  arguments?: PromptArgument[];
78
- }
79
-
80
- /**
81
- * 连接类型
82
- */
83
- declare const ConnectionTypeEnum: z.ZodEnum<["http", "stdio"]>;
84
- type ConnectionType = z.infer<typeof ConnectionTypeEnum>;
85
- /**
86
- * MCP安装方法
87
- */
88
- declare const InstallationMethodEnum: z.ZodEnum<["npm", "go", "python", "docker", "git", "binaryUrl", "manual", "none"]>;
89
- type InstallationMethod = z.infer<typeof InstallationMethodEnum>;
90
- /**
91
- * 系统依赖项
92
- */
93
- interface SystemDependency {
178
+ /** Human-readable description of what the prompt does */
179
+ description: string;
180
+ /** Unique identifier for the prompt within the plugin */
94
181
  name: string;
95
- type?: string;
96
- requiredVersion?: string;
97
- checkCommand?: string;
98
- installInstructions?: Record<string, string>;
99
- versionParsingRequired?: boolean;
100
- description?: string;
101
- }
102
- /**
103
- * MCP连接配置
104
- */
105
- interface ConnectionConfig {
106
- type: ConnectionType;
107
- command?: string;
108
- args?: string[];
109
- url?: string;
110
- }
111
- interface InstallationDetails {
112
- packageName?: string;
113
- repositoryUrlToClone?: string;
114
- setupSteps?: string[];
115
- }
116
- /**
117
- * MCP部署选项
118
- */
119
- interface DeploymentOption {
120
- installationMethod: string;
121
- installationDetails?: InstallationDetails;
122
- connection: ConnectionConfig;
123
- isRecommended?: boolean;
124
- description?: string;
125
- systemDependencies?: SystemDependency[];
126
182
  }
127
183
 
128
184
  /**
129
- * 兼容性信息
185
+ * Plugin compatibility information.
186
+ * Defines the compatibility requirements for a plugin with respect to app versions and platforms.
130
187
  */
131
188
  interface PluginCompatibility {
132
- platforms?: string[];
133
- minAppVersion?: string;
189
+ /** Maximum app version the plugin is compatible with */
134
190
  maxAppVersion?: string;
191
+ /** Minimum app version required to use the plugin */
192
+ minAppVersion?: string;
193
+ /** List of supported platforms (e.g., 'web', 'desktop', 'mobile') */
194
+ platforms?: string[];
135
195
  }
196
+ /**
197
+ * Base plugin item schema with Zod validation.
198
+ * Defines the structure and validation rules for plugin items in the marketplace.
199
+ */
136
200
  declare const BasePluginItemSchema: z.ZodObject<{
137
- identifier: z.ZodString;
138
- name: z.ZodString;
139
- description: z.ZodString;
140
- manifestUrl: z.ZodString;
141
201
  author: z.ZodOptional<z.ZodString>;
142
- createdAt: z.ZodString;
143
- updatedAt: z.ZodString;
144
- homepage: z.ZodOptional<z.ZodString>;
145
- icon: z.ZodOptional<z.ZodString>;
146
- tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
147
- category: z.ZodOptional<z.ZodString>;
148
202
  capabilities: z.ZodObject<{
149
- tools: z.ZodDefault<z.ZodBoolean>;
150
203
  prompts: z.ZodDefault<z.ZodBoolean>;
151
204
  resources: z.ZodDefault<z.ZodBoolean>;
205
+ tools: z.ZodDefault<z.ZodBoolean>;
152
206
  }, "strip", z.ZodTypeAny, {
153
- tools: boolean;
154
207
  prompts: boolean;
155
208
  resources: boolean;
209
+ tools: boolean;
156
210
  }, {
157
- tools?: boolean | undefined;
158
211
  prompts?: boolean | undefined;
159
212
  resources?: boolean | undefined;
213
+ tools?: boolean | undefined;
160
214
  }>;
161
- toolsCount: z.ZodOptional<z.ZodNumber>;
162
- promptsCount: z.ZodOptional<z.ZodNumber>;
163
- resourcesCount: z.ZodOptional<z.ZodNumber>;
164
- isValidated: z.ZodDefault<z.ZodBoolean>;
215
+ category: z.ZodOptional<z.ZodString>;
216
+ commentCount: z.ZodDefault<z.ZodNumber>;
217
+ createdAt: z.ZodString;
218
+ description: z.ZodString;
219
+ homepage: z.ZodOptional<z.ZodString>;
220
+ icon: z.ZodOptional<z.ZodString>;
221
+ identifier: z.ZodString;
165
222
  installCount: z.ZodDefault<z.ZodNumber>;
223
+ isFeatured: z.ZodDefault<z.ZodBoolean>;
224
+ isValidated: z.ZodDefault<z.ZodBoolean>;
225
+ manifestUrl: z.ZodString;
226
+ name: z.ZodString;
227
+ promptsCount: z.ZodOptional<z.ZodNumber>;
166
228
  ratingAverage: z.ZodOptional<z.ZodNumber>;
167
229
  ratingCount: z.ZodDefault<z.ZodNumber>;
168
- commentCount: z.ZodDefault<z.ZodNumber>;
169
- isFeatured: z.ZodDefault<z.ZodBoolean>;
230
+ resourcesCount: z.ZodOptional<z.ZodNumber>;
231
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
232
+ toolsCount: z.ZodOptional<z.ZodNumber>;
233
+ updatedAt: z.ZodString;
170
234
  }, "strip", z.ZodTypeAny, {
171
- identifier: string;
172
- name: string;
173
- description: string;
174
- manifestUrl: string;
175
- createdAt: string;
176
- updatedAt: string;
177
235
  capabilities: {
178
- tools: boolean;
179
236
  prompts: boolean;
180
237
  resources: boolean;
238
+ tools: boolean;
181
239
  };
182
- isValidated: boolean;
183
- installCount: number;
184
- ratingCount: number;
185
240
  commentCount: number;
241
+ createdAt: string;
242
+ description: string;
243
+ identifier: string;
244
+ installCount: number;
186
245
  isFeatured: boolean;
246
+ isValidated: boolean;
247
+ manifestUrl: string;
248
+ name: string;
249
+ ratingCount: number;
250
+ updatedAt: string;
187
251
  author?: string | undefined;
252
+ category?: string | undefined;
188
253
  homepage?: string | undefined;
189
254
  icon?: string | undefined;
190
- tags?: string[] | undefined;
191
- category?: string | undefined;
192
- toolsCount?: number | undefined;
193
255
  promptsCount?: number | undefined;
194
- resourcesCount?: number | undefined;
195
256
  ratingAverage?: number | undefined;
257
+ resourcesCount?: number | undefined;
258
+ tags?: string[] | undefined;
259
+ toolsCount?: number | undefined;
196
260
  }, {
197
- identifier: string;
198
- name: string;
199
- description: string;
200
- manifestUrl: string;
201
- createdAt: string;
202
- updatedAt: string;
203
261
  capabilities: {
204
- tools?: boolean | undefined;
205
262
  prompts?: boolean | undefined;
206
263
  resources?: boolean | undefined;
264
+ tools?: boolean | undefined;
207
265
  };
266
+ createdAt: string;
267
+ description: string;
268
+ identifier: string;
269
+ manifestUrl: string;
270
+ name: string;
271
+ updatedAt: string;
208
272
  author?: string | undefined;
273
+ category?: string | undefined;
274
+ commentCount?: number | undefined;
209
275
  homepage?: string | undefined;
210
276
  icon?: string | undefined;
211
- tags?: string[] | undefined;
212
- category?: string | undefined;
213
- toolsCount?: number | undefined;
214
- promptsCount?: number | undefined;
215
- resourcesCount?: number | undefined;
216
- isValidated?: boolean | undefined;
217
277
  installCount?: number | undefined;
278
+ isFeatured?: boolean | undefined;
279
+ isValidated?: boolean | undefined;
280
+ promptsCount?: number | undefined;
218
281
  ratingAverage?: number | undefined;
219
282
  ratingCount?: number | undefined;
220
- commentCount?: number | undefined;
221
- isFeatured?: boolean | undefined;
283
+ resourcesCount?: number | undefined;
284
+ tags?: string[] | undefined;
285
+ toolsCount?: number | undefined;
222
286
  }>;
223
287
  /**
224
- * Plugin (MCP Server) 类型资源项的定义 (继承基础结构)
225
- * 注: 这个定义会与现有的 PluginItem 结构进行整合
288
+ * Plugin marketplace item definition.
289
+ * Extends the base marketplace item with plugin-specific properties.
290
+ * This interface represents a plugin as it appears in the marketplace listing.
226
291
  */
227
292
  interface MarketPluginItem extends MarketItemBase {
293
+ /** Capabilities provided by this plugin */
228
294
  capabilities?: {
229
- tools: boolean;
295
+ /** Whether the plugin provides custom prompts */
230
296
  prompts: boolean;
297
+ /** Whether the plugin provides resources (assets) */
231
298
  resources: boolean;
299
+ /** Whether the plugin provides tools (functions) */
300
+ tools: boolean;
232
301
  };
233
- toolsCount?: number;
234
- promptsCount?: number;
235
- resourcesCount?: number;
236
- isValidated?: boolean;
302
+ /** Number of comments on this plugin */
303
+ commentCount?: number;
304
+ /** Number of times this plugin has been installed */
237
305
  installCount?: number;
306
+ /** Whether this plugin is featured in the marketplace */
307
+ isFeatured?: boolean;
308
+ /** Whether this plugin has been validated by the system */
309
+ isValidated?: boolean;
310
+ /** Number of prompts provided by this plugin */
311
+ promptsCount?: number;
312
+ /** Average rating (typically 1-5 scale) */
238
313
  ratingAverage?: number;
314
+ /** Number of ratings received */
239
315
  ratingCount?: number;
240
- commentCount?: number;
241
- isFeatured?: boolean;
316
+ /** Number of resources provided by this plugin */
317
+ resourcesCount?: number;
318
+ /** Number of tools provided by this plugin */
319
+ toolsCount?: number;
242
320
  }
321
+ /** Type alias for the base plugin item validated by Zod schema */
243
322
  type BasePluginItem = z.infer<typeof BasePluginItemSchema>;
323
+ /**
324
+ * Plugin manifest definition.
325
+ * This is the complete specification of a plugin, including all its capabilities,
326
+ * metadata, and deployment options.
327
+ */
244
328
  interface PluginManifest {
245
- id: string;
246
- name: string;
247
- version: string;
248
- description: string;
249
- category?: string;
250
- tags?: string[];
329
+ /** Author information */
251
330
  author?: {
331
+ /** Author or organization name */
252
332
  name: string;
333
+ /** URL to the author's website or profile */
253
334
  url?: string;
254
335
  };
255
- homepage?: string;
256
- icon?: string;
336
+ /** Capabilities provided by this plugin */
257
337
  capabilities?: {
258
- tools?: boolean;
338
+ /** Whether the plugin provides custom prompts */
259
339
  prompts?: boolean;
340
+ /** Whether the plugin provides resources */
260
341
  resources?: boolean;
342
+ /** Whether the plugin provides tools */
343
+ tools?: boolean;
261
344
  };
262
- deploymentOptions?: DeploymentOption[];
345
+ /** Category for classification */
346
+ category?: string;
347
+ /** Compatibility requirements */
263
348
  compatibility?: PluginCompatibility;
264
- tools?: PluginTool[];
265
- resources?: PluginResource[];
266
- prompts?: PluginPrompt[];
349
+ /** Available deployment options */
350
+ deploymentOptions?: DeploymentOption[];
351
+ /** Human-readable description */
352
+ description: string;
353
+ /** URL to the plugin's homepage or documentation */
354
+ homepage?: string;
355
+ /** Icon URL or emoji */
356
+ icon?: string;
357
+ /** Unique identifier for the plugin */
358
+ id: string;
359
+ /** Whether this plugin has been validated */
267
360
  isValidated?: boolean;
361
+ /** Display name of the plugin */
362
+ name: string;
363
+ /** List of prompt templates provided by this plugin */
364
+ prompts?: PluginPrompt[];
365
+ /** List of resources provided by this plugin */
366
+ resources?: PluginResource[];
367
+ /** List of tags for filtering and discovery */
368
+ tags?: string[];
369
+ /** List of tools provided by this plugin */
370
+ tools?: PluginTool[];
371
+ /** Timestamp when the plugin was validated (ISO 8601) */
268
372
  validatedAt?: string;
373
+ /** Semantic version string (e.g., "1.0.0") */
374
+ version: string;
269
375
  }
270
376
 
377
+ /**
378
+ * Schema for admin-managed plugin items with additional status and visibility fields.
379
+ * Extends the base plugin schema with administrative properties.
380
+ */
271
381
  declare const AdminPluginItemSchema: z.ZodObject<{
272
- identifier: z.ZodString;
273
- name: z.ZodString;
274
- description: z.ZodString;
275
- manifestUrl: z.ZodString;
276
382
  author: z.ZodOptional<z.ZodString>;
277
- createdAt: z.ZodString;
278
- updatedAt: z.ZodString;
279
- homepage: z.ZodOptional<z.ZodString>;
280
- icon: z.ZodOptional<z.ZodString>;
281
- tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
282
- category: z.ZodOptional<z.ZodString>;
283
383
  capabilities: z.ZodObject<{
284
- tools: z.ZodDefault<z.ZodBoolean>;
285
384
  prompts: z.ZodDefault<z.ZodBoolean>;
286
385
  resources: z.ZodDefault<z.ZodBoolean>;
386
+ tools: z.ZodDefault<z.ZodBoolean>;
287
387
  }, "strip", z.ZodTypeAny, {
288
- tools: boolean;
289
388
  prompts: boolean;
290
389
  resources: boolean;
390
+ tools: boolean;
291
391
  }, {
292
- tools?: boolean | undefined;
293
392
  prompts?: boolean | undefined;
294
393
  resources?: boolean | undefined;
394
+ tools?: boolean | undefined;
295
395
  }>;
296
- toolsCount: z.ZodOptional<z.ZodNumber>;
297
- promptsCount: z.ZodOptional<z.ZodNumber>;
298
- resourcesCount: z.ZodOptional<z.ZodNumber>;
299
- isValidated: z.ZodDefault<z.ZodBoolean>;
396
+ category: z.ZodOptional<z.ZodString>;
397
+ commentCount: z.ZodDefault<z.ZodNumber>;
398
+ createdAt: z.ZodString;
399
+ description: z.ZodString;
400
+ homepage: z.ZodOptional<z.ZodString>;
401
+ icon: z.ZodOptional<z.ZodString>;
402
+ identifier: z.ZodString;
300
403
  installCount: z.ZodDefault<z.ZodNumber>;
404
+ isFeatured: z.ZodDefault<z.ZodBoolean>;
405
+ isValidated: z.ZodDefault<z.ZodBoolean>;
406
+ manifestUrl: z.ZodString;
407
+ name: z.ZodString;
408
+ promptsCount: z.ZodOptional<z.ZodNumber>;
301
409
  ratingAverage: z.ZodOptional<z.ZodNumber>;
302
410
  ratingCount: z.ZodDefault<z.ZodNumber>;
303
- commentCount: z.ZodDefault<z.ZodNumber>;
304
- isFeatured: z.ZodDefault<z.ZodBoolean>;
411
+ resourcesCount: z.ZodOptional<z.ZodNumber>;
412
+ tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
413
+ toolsCount: z.ZodOptional<z.ZodNumber>;
414
+ updatedAt: z.ZodString;
305
415
  } & {
416
+ /** Publication status of the plugin */
306
417
  status: z.ZodEnum<["published", "unpublished", "archived", "deprecated"]>;
418
+ /** Visibility level of the plugin */
307
419
  visibility: z.ZodEnum<["public", "private", "internal"]>;
308
420
  }, "strip", z.ZodTypeAny, {
309
421
  status: "published" | "unpublished" | "archived" | "deprecated";
310
- identifier: string;
311
- name: string;
312
- description: string;
313
- manifestUrl: string;
314
- createdAt: string;
315
- updatedAt: string;
316
422
  capabilities: {
317
- tools: boolean;
318
423
  prompts: boolean;
319
424
  resources: boolean;
425
+ tools: boolean;
320
426
  };
321
- isValidated: boolean;
322
- installCount: number;
323
- ratingCount: number;
324
427
  commentCount: number;
428
+ createdAt: string;
429
+ description: string;
430
+ identifier: string;
431
+ installCount: number;
325
432
  isFeatured: boolean;
433
+ isValidated: boolean;
434
+ manifestUrl: string;
435
+ name: string;
436
+ ratingCount: number;
437
+ updatedAt: string;
326
438
  visibility: "public" | "private" | "internal";
327
439
  author?: string | undefined;
440
+ category?: string | undefined;
328
441
  homepage?: string | undefined;
329
442
  icon?: string | undefined;
330
- tags?: string[] | undefined;
331
- category?: string | undefined;
332
- toolsCount?: number | undefined;
333
443
  promptsCount?: number | undefined;
334
- resourcesCount?: number | undefined;
335
444
  ratingAverage?: number | undefined;
445
+ resourcesCount?: number | undefined;
446
+ tags?: string[] | undefined;
447
+ toolsCount?: number | undefined;
336
448
  }, {
337
449
  status: "published" | "unpublished" | "archived" | "deprecated";
338
- identifier: string;
339
- name: string;
340
- description: string;
341
- manifestUrl: string;
342
- createdAt: string;
343
- updatedAt: string;
344
450
  capabilities: {
345
- tools?: boolean | undefined;
346
451
  prompts?: boolean | undefined;
347
452
  resources?: boolean | undefined;
453
+ tools?: boolean | undefined;
348
454
  };
455
+ createdAt: string;
456
+ description: string;
457
+ identifier: string;
458
+ manifestUrl: string;
459
+ name: string;
460
+ updatedAt: string;
349
461
  visibility: "public" | "private" | "internal";
350
462
  author?: string | undefined;
463
+ category?: string | undefined;
464
+ commentCount?: number | undefined;
351
465
  homepage?: string | undefined;
352
466
  icon?: string | undefined;
353
- tags?: string[] | undefined;
354
- category?: string | undefined;
355
- toolsCount?: number | undefined;
356
- promptsCount?: number | undefined;
357
- resourcesCount?: number | undefined;
358
- isValidated?: boolean | undefined;
359
467
  installCount?: number | undefined;
468
+ isFeatured?: boolean | undefined;
469
+ isValidated?: boolean | undefined;
470
+ promptsCount?: number | undefined;
360
471
  ratingAverage?: number | undefined;
361
472
  ratingCount?: number | undefined;
362
- commentCount?: number | undefined;
363
- isFeatured?: boolean | undefined;
473
+ resourcesCount?: number | undefined;
474
+ tags?: string[] | undefined;
475
+ toolsCount?: number | undefined;
364
476
  }>;
477
+ /**
478
+ * Interface for admin-managed plugin items.
479
+ * Extends the market plugin item with administrative properties.
480
+ */
365
481
  interface AdminPluginItem extends MarketPluginItem {
482
+ /** Unique numeric identifier for the plugin in the database */
366
483
  id: number;
484
+ /** User ID of the plugin owner */
367
485
  ownerId: number;
486
+ /** Publication status of the plugin */
368
487
  status: 'published' | 'unpublished' | 'archived';
488
+ /** Visibility level controlling who can access the plugin */
369
489
  visibility: 'public' | 'private' | 'internal';
370
490
  }
491
+ /**
492
+ * Plugin version database model.
493
+ * Represents a specific version of a plugin in the database.
494
+ */
495
+ interface PluginVersion {
496
+ /** Creation timestamp (ISO 8601 format) */
497
+ createdAt: string;
498
+ /** Unique numeric identifier for the version */
499
+ id: number;
500
+ /** Whether this is the latest version of the plugin */
501
+ isLatest: boolean;
502
+ /** Whether this version has been validated by the system */
503
+ isValidated: boolean;
504
+ /** The full manifest data for this version */
505
+ manifest: PluginManifest;
506
+ /** URL to the manifest file, or null if stored directly */
507
+ manifestUrl: string | null;
508
+ /** Additional metadata for this version */
509
+ meta: Record<string, any> | null;
510
+ /** ID of the parent plugin */
511
+ pluginId: number;
512
+ /** Number of prompts provided by this version */
513
+ promptsCount: number;
514
+ /** Number of resources provided by this version */
515
+ resourcesCount: number;
516
+ /** Number of tools provided by this version */
517
+ toolsCount: number;
518
+ /** Last update timestamp (ISO 8601 format) */
519
+ updatedAt: string;
520
+ /** Semantic version string (e.g., "1.0.0") */
521
+ version: string;
522
+ }
523
+ /**
524
+ * Detailed admin plugin item with version history.
525
+ * Used for displaying complete plugin information in the admin interface.
526
+ */
371
527
  interface AdminPluginItemDetail extends Omit<AdminPluginItem, 'manifestUrl'> {
528
+ /** Full manifest data for the current version */
372
529
  manifest: PluginManifest;
530
+ /** List of all versions of this plugin */
531
+ versions: PluginVersion[];
373
532
  }
374
533
  /**
375
- * MCP部署选项
534
+ * Admin deployment option with database ID.
535
+ * Extends the basic deployment option with a database identifier.
376
536
  */
377
537
  interface AdminDeploymentOption extends DeploymentOption {
538
+ /** Unique numeric identifier for the deployment option */
378
539
  id: number;
379
540
  }
541
+ /**
542
+ * Admin system dependency with database ID.
543
+ * Extends the basic system dependency with a database identifier.
544
+ */
380
545
  interface AdminSystemDependency extends SystemDependency {
546
+ /** Unique numeric identifier for the system dependency */
381
547
  id: number;
382
548
  }
383
549
 
384
- export { type AdminDeploymentOption, type AdminPluginItem, type AdminPluginItemDetail, AdminPluginItemSchema, type AdminSystemDependency, type BasePluginItem, BasePluginItemSchema, type ConnectionConfig, type ConnectionType, ConnectionTypeEnum, type DeploymentOption, type InstallationDetails, type InstallationMethod, InstallationMethodEnum, type MarketItemBase, type MarketPluginItem, PluginCapabilitiesSchema, type PluginCompatibility, type PluginManifest, type PluginPrompt, type PluginResource, type PluginTool, type PromptArgument, type SystemDependency };
550
+ export { type AdminDeploymentOption, type AdminPluginItem, type AdminPluginItemDetail, AdminPluginItemSchema, type AdminSystemDependency, type BasePluginItem, BasePluginItemSchema, type ConnectionConfig, type ConnectionType, ConnectionTypeEnum, type DeploymentOption, type InstallationDetails, type InstallationMethod, InstallationMethodEnum, type MarketItemBase, type MarketPluginItem, PluginCapabilitiesSchema, type PluginCompatibility, type PluginManifest, type PluginPrompt, type PluginResource, type PluginTool, type PluginVersion, type PromptArgument, type SystemDependency };
package/dist/index.mjs CHANGED
@@ -1,43 +1,50 @@
1
+ // src/plugin/admin.ts
2
+ import { z as z3 } from "zod";
3
+
1
4
  // src/plugin/plugin.ts
2
5
  import { z as z2 } from "zod";
3
6
 
4
7
  // src/plugin/capabilities.ts
5
8
  import { z } from "zod";
6
9
  var PluginCapabilitiesSchema = z.object({
7
- tools: z.boolean().default(false),
10
+ /** Whether the plugin provides custom prompts */
8
11
  prompts: z.boolean().default(false),
9
- resources: z.boolean().default(false)
12
+ /** Whether the plugin provides resources (assets) */
13
+ resources: z.boolean().default(false),
14
+ /** Whether the plugin provides tools (functions) */
15
+ tools: z.boolean().default(false)
10
16
  });
11
17
 
12
18
  // src/plugin/plugin.ts
13
19
  var BasePluginItemSchema = z2.object({
14
- identifier: z2.string(),
15
- name: z2.string(),
16
- description: z2.string(),
17
- manifestUrl: z2.string(),
18
20
  author: z2.string().optional(),
21
+ capabilities: PluginCapabilitiesSchema,
22
+ category: z2.string().optional(),
23
+ commentCount: z2.number().default(0),
19
24
  createdAt: z2.string(),
20
- updatedAt: z2.string(),
25
+ description: z2.string(),
21
26
  homepage: z2.string().optional(),
22
27
  icon: z2.string().optional(),
23
- tags: z2.array(z2.string()).optional(),
24
- category: z2.string().optional(),
25
- capabilities: PluginCapabilitiesSchema,
26
- toolsCount: z2.number().optional(),
27
- promptsCount: z2.number().optional(),
28
- resourcesCount: z2.number().optional(),
29
- isValidated: z2.boolean().default(false),
28
+ identifier: z2.string(),
30
29
  installCount: z2.number().default(0),
30
+ isFeatured: z2.boolean().default(false),
31
+ isValidated: z2.boolean().default(false),
32
+ manifestUrl: z2.string(),
33
+ name: z2.string(),
34
+ promptsCount: z2.number().optional(),
31
35
  ratingAverage: z2.number().optional(),
32
36
  ratingCount: z2.number().default(0),
33
- commentCount: z2.number().default(0),
34
- isFeatured: z2.boolean().default(false)
37
+ resourcesCount: z2.number().optional(),
38
+ tags: z2.array(z2.string()).optional(),
39
+ toolsCount: z2.number().optional(),
40
+ updatedAt: z2.string()
35
41
  });
36
42
 
37
43
  // src/plugin/admin.ts
38
- import { z as z3 } from "zod";
39
44
  var AdminPluginItemSchema = BasePluginItemSchema.extend({
45
+ /** Publication status of the plugin */
40
46
  status: z3.enum(["published", "unpublished", "archived", "deprecated"]),
47
+ /** Visibility level of the plugin */
41
48
  visibility: z3.enum(["public", "private", "internal"])
42
49
  });
43
50
 
@@ -46,13 +53,21 @@ import { z as z4 } from "zod";
46
53
  var ConnectionTypeEnum = z4.enum(["http", "stdio"]);
47
54
  var InstallationMethodEnum = z4.enum([
48
55
  "npm",
56
+ // Node.js package manager
49
57
  "go",
58
+ // Go language
50
59
  "python",
60
+ // Python language
51
61
  "docker",
62
+ // Docker container
52
63
  "git",
64
+ // Git repository
53
65
  "binaryUrl",
66
+ // Direct binary download URL
54
67
  "manual",
68
+ // Manual installation with instructions
55
69
  "none"
70
+ // No installation required
56
71
  ]);
57
72
  export {
58
73
  AdminPluginItemSchema,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugin/plugin.ts","../src/plugin/capabilities.ts","../src/plugin/admin.ts","../src/plugin/deploymentOption.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { MarketItemBase } from '../market';\nimport {\n PluginCapabilitiesSchema,\n PluginPrompt,\n PluginResource,\n PluginTool,\n PromptArgument,\n} from './capabilities';\nimport { DeploymentOption } from './deploymentOption';\n\n/**\n * 兼容性信息\n */\nexport interface PluginCompatibility {\n platforms?: string[];\n minAppVersion?: string;\n maxAppVersion?: string;\n}\n\n// 基础插件项 Schema\nexport const BasePluginItemSchema = z.object({\n identifier: z.string(),\n name: z.string(),\n description: z.string(),\n manifestUrl: z.string(),\n author: z.string().optional(),\n createdAt: z.string(),\n updatedAt: z.string(),\n homepage: z.string().optional(),\n icon: z.string().optional(),\n tags: z.array(z.string()).optional(),\n category: z.string().optional(),\n capabilities: PluginCapabilitiesSchema,\n toolsCount: z.number().optional(),\n promptsCount: z.number().optional(),\n resourcesCount: z.number().optional(),\n isValidated: z.boolean().default(false),\n installCount: z.number().default(0),\n ratingAverage: z.number().optional(),\n ratingCount: z.number().default(0),\n commentCount: z.number().default(0),\n isFeatured: z.boolean().default(false),\n});\n\n/**\n * Plugin (MCP Server) 类型资源项的定义 (继承基础结构)\n * 注: 这个定义会与现有的 PluginItem 结构进行整合\n */\nexport interface MarketPluginItem extends MarketItemBase {\n // 能力信息\n capabilities?: {\n tools: boolean;\n prompts: boolean;\n resources: boolean;\n };\n // 数量统计\n toolsCount?: number;\n promptsCount?: number;\n resourcesCount?: number;\n // 验证状态\n isValidated?: boolean;\n // 统计信息\n installCount?: number;\n ratingAverage?: number;\n ratingCount?: number;\n commentCount?: number;\n isFeatured?: boolean;\n}\n\n// 导出类型\nexport type BasePluginItem = z.infer<typeof BasePluginItemSchema>;\n\n// 插件清单\nexport interface PluginManifest {\n id: string;\n name: string;\n version: string;\n description: string;\n category?: string;\n tags?: string[];\n author?: {\n name: string;\n url?: string;\n };\n homepage?: string;\n icon?: string;\n capabilities?: {\n tools?: boolean;\n prompts?: boolean;\n resources?: boolean;\n };\n deploymentOptions?: DeploymentOption[];\n compatibility?: PluginCompatibility;\n // 工具定义\n tools?: PluginTool[];\n // 资源定义\n resources?: PluginResource[];\n // 提示词定义\n prompts?: PluginPrompt[];\n // 验证信息\n isValidated?: boolean;\n validatedAt?: string;\n}\n","\n// 插件能力定义\nimport { z } from 'zod';\n\nexport const PluginCapabilitiesSchema = z.object({\n tools: z.boolean().default(false),\n prompts: z.boolean().default(false),\n resources: z.boolean().default(false),\n});\n\n/**\n * 工具项定义\n */\nexport interface PluginTool {\n name: string;\n description?: string;\n inputSchema?: Record<string, any>;\n}\n\n/**\n * 资源项定义\n */\nexport interface PluginResource {\n uri: string;\n name?: string;\n mimeType?: string;\n}\n\n/**\n * 提示词参数定义\n */\nexport interface PromptArgument {\n name: string;\n required?: boolean;\n description?: string;\n type?: string;\n}\n\n/**\n * 提示词项定义\n */\nexport interface PluginPrompt {\n name: string;\n description: string;\n arguments?: PromptArgument[];\n}\n","// 管理端插件项 Schema\nimport { z } from 'zod';\n\nimport { DeploymentOption, SystemDependency } from '@/plugin/deploymentOption';\n\nimport { BasePluginItemSchema, MarketPluginItem, PluginManifest } from './plugin';\n\nexport const AdminPluginItemSchema = BasePluginItemSchema.extend({\n status: z.enum(['published', 'unpublished', 'archived', 'deprecated'] as const),\n visibility: z.enum(['public', 'private', 'internal'] as const),\n});\n\nexport interface AdminPluginItem extends MarketPluginItem {\n id: number;\n ownerId: number;\n status: 'published' | 'unpublished' | 'archived';\n visibility: 'public' | 'private' | 'internal';\n}\n\nexport interface AdminPluginItemDetail extends Omit<AdminPluginItem, 'manifestUrl'> {\n manifest: PluginManifest;\n}\n\n/**\n * MCP部署选项\n */\nexport interface AdminDeploymentOption extends DeploymentOption {\n id: number;\n}\n\nexport interface AdminSystemDependency extends SystemDependency {\n id: number;\n}\n","import { z } from 'zod';\n\n/**\n * 连接类型\n */\nexport const ConnectionTypeEnum = z.enum(['http', 'stdio']);\nexport type ConnectionType = z.infer<typeof ConnectionTypeEnum>;\n\n/**\n * MCP安装方法\n */\nexport const InstallationMethodEnum = z.enum([\n 'npm',\n 'go',\n 'python',\n 'docker',\n 'git',\n 'binaryUrl',\n 'manual',\n 'none',\n]);\nexport type InstallationMethod = z.infer<typeof InstallationMethodEnum>;\n\n/**\n * 系统依赖项\n */\nexport interface SystemDependency {\n name: string;\n type?: string;\n requiredVersion?: string;\n checkCommand?: string;\n installInstructions?: Record<string, string>;\n versionParsingRequired?: boolean;\n description?: string;\n}\n\n/**\n * MCP连接配置\n */\nexport interface ConnectionConfig {\n type: ConnectionType;\n command?: string;\n args?: string[];\n url?: string;\n}\n\nexport interface InstallationDetails {\n packageName?: string;\n repositoryUrlToClone?: string;\n setupSteps?: string[];\n}\n\n/**\n * MCP部署选项\n */\nexport interface DeploymentOption {\n installationMethod: string;\n installationDetails?: InstallationDetails;\n connection: ConnectionConfig;\n isRecommended?: boolean;\n description?: string;\n systemDependencies?: SystemDependency[];\n}\n"],"mappings":";AAAA,SAAS,KAAAA,UAAS;;;ACElB,SAAS,SAAS;AAEX,IAAM,2BAA2B,EAAE,OAAO;AAAA,EAC/C,OAAO,EAAE,QAAQ,EAAE,QAAQ,KAAK;AAAA,EAChC,SAAS,EAAE,QAAQ,EAAE,QAAQ,KAAK;AAAA,EAClC,WAAW,EAAE,QAAQ,EAAE,QAAQ,KAAK;AACtC,CAAC;;;ADcM,IAAM,uBAAuBC,GAAE,OAAO;AAAA,EAC3C,YAAYA,GAAE,OAAO;AAAA,EACrB,MAAMA,GAAE,OAAO;AAAA,EACf,aAAaA,GAAE,OAAO;AAAA,EACtB,aAAaA,GAAE,OAAO;AAAA,EACtB,QAAQA,GAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,WAAWA,GAAE,OAAO;AAAA,EACpB,WAAWA,GAAE,OAAO;AAAA,EACpB,UAAUA,GAAE,OAAO,EAAE,SAAS;AAAA,EAC9B,MAAMA,GAAE,OAAO,EAAE,SAAS;AAAA,EAC1B,MAAMA,GAAE,MAAMA,GAAE,OAAO,CAAC,EAAE,SAAS;AAAA,EACnC,UAAUA,GAAE,OAAO,EAAE,SAAS;AAAA,EAC9B,cAAc;AAAA,EACd,YAAYA,GAAE,OAAO,EAAE,SAAS;AAAA,EAChC,cAAcA,GAAE,OAAO,EAAE,SAAS;AAAA,EAClC,gBAAgBA,GAAE,OAAO,EAAE,SAAS;AAAA,EACpC,aAAaA,GAAE,QAAQ,EAAE,QAAQ,KAAK;AAAA,EACtC,cAAcA,GAAE,OAAO,EAAE,QAAQ,CAAC;AAAA,EAClC,eAAeA,GAAE,OAAO,EAAE,SAAS;AAAA,EACnC,aAAaA,GAAE,OAAO,EAAE,QAAQ,CAAC;AAAA,EACjC,cAAcA,GAAE,OAAO,EAAE,QAAQ,CAAC;AAAA,EAClC,YAAYA,GAAE,QAAQ,EAAE,QAAQ,KAAK;AACvC,CAAC;;;AE3CD,SAAS,KAAAC,UAAS;AAMX,IAAM,wBAAwB,qBAAqB,OAAO;AAAA,EAC/D,QAAQC,GAAE,KAAK,CAAC,aAAa,eAAe,YAAY,YAAY,CAAU;AAAA,EAC9E,YAAYA,GAAE,KAAK,CAAC,UAAU,WAAW,UAAU,CAAU;AAC/D,CAAC;;;ACVD,SAAS,KAAAC,UAAS;AAKX,IAAM,qBAAqBA,GAAE,KAAK,CAAC,QAAQ,OAAO,CAAC;AAMnD,IAAM,yBAAyBA,GAAE,KAAK;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;","names":["z","z","z","z","z"]}
1
+ {"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","import { z } from 'zod';\n\nimport { MarketItemBase } from '../market';\nimport { PluginCapabilitiesSchema, PluginPrompt, PluginResource, PluginTool } from './capabilities';\nimport { DeploymentOption } 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 * 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 createdAt: z.string(),\n description: z.string(),\n homepage: z.string().optional(),\n icon: z.string().optional(),\n identifier: z.string(),\n installCount: z.number().default(0),\n isFeatured: 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 tags: z.array(z.string()).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 /** Number of times this plugin has been installed */\n installCount?: number;\n /** Whether this plugin is featured in the marketplace */\n isFeatured?: 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 /** 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 PluginManifest {\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 /** Capabilities provided by this plugin */\n capabilities?: {\n /** Whether the plugin provides custom prompts */\n prompts?: boolean;\n /** Whether the plugin provides resources */\n resources?: boolean;\n /** Whether the plugin provides tools */\n tools?: boolean;\n };\n /** Category for classification */\n category?: string;\n /** Compatibility requirements */\n compatibility?: PluginCompatibility;\n /** Available deployment options */\n deploymentOptions?: DeploymentOption[];\n /** Human-readable description */\n description: string;\n /** URL to the plugin's homepage or documentation */\n homepage?: string;\n /** Icon URL or emoji */\n icon?: string;\n /** Unique identifier for the plugin */\n id: string;\n /** Whether this plugin has been validated */\n isValidated?: boolean;\n /** Display name of the plugin */\n name: string;\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 tags for filtering and discovery */\n tags?: string[];\n /** List of tools provided by this plugin */\n tools?: PluginTool[];\n /** Timestamp when the plugin was validated (ISO 8601) */\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 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 /** 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;;;ADSM,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,WAAWA,GAAE,OAAO;AAAA,EACpB,aAAaA,GAAE,OAAO;AAAA,EACtB,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,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,MAAMA,GAAE,MAAMA,GAAE,OAAO,CAAC,EAAE,SAAS;AAAA,EACnC,YAAYA,GAAE,OAAO,EAAE,SAAS;AAAA,EAChC,WAAWA,GAAE,OAAO;AACtB,CAAC;;;ADnCM,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;AAOnD,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"]}
package/package.json CHANGED
@@ -1,7 +1,16 @@
1
1
  {
2
2
  "name": "@lobehub/market-types",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
+ "homepage": "https://github.com/lobehub/lobehub-market",
5
+ "bugs": {
6
+ "url": "https://github.com/lobehub/lobehub-market/issues/new/choose"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/lobehub/lobehub-market.git"
11
+ },
4
12
  "license": "MIT",
13
+ "author": "LobeHub <i@lobehub.com>",
5
14
  "sideEffects": false,
6
15
  "main": "./dist/index.mjs",
7
16
  "types": "./dist/index.d.mts",