@vetta-org/plugin-sdk 0.3.1 → 0.3.2

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.
@@ -250,6 +250,16 @@ export declare const PluginSkillPresentationSchema: import("@sinclair/typebox").
250
250
  displayDescription: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
251
251
  }>>>;
252
252
  }>;
253
+ /** 角色 slug。跨插件引用的唯一词汇表,格式与智能体 id 一致。 */
254
+ export declare const PluginAgentRoleSchema: import("@sinclair/typebox").TString;
255
+ /**
256
+ * 宿主认识的角色词表。
257
+ *
258
+ * **不是白名单**:写表外的角色照样能被解析,只是团队编辑器里没有现成的槽位选择器。列在这里
259
+ * 的角色由预置插件供货,因此任何一台装机上都解析得到,第三方插件可以放心引用。
260
+ */
261
+ export declare const BUILTIN_PLUGIN_AGENT_ROLES: readonly ["master", "developer", "researcher", "auditor", "business", "designer"];
262
+ export type BuiltinPluginAgentRole = (typeof BUILTIN_PLUGIN_AGENT_ROLES)[number];
253
263
  /** 插件贡献的智能体(blueprint)。人设、头像、职责都由插件提供,宿主只负责铺档案。 */
254
264
  export declare const PluginAgentProfileManifestSchema: import("@sinclair/typebox").TObject<{
255
265
  /** 插件内唯一;全局 id 由宿主拼成 `plugin:<pluginId>:<id>`。 */
@@ -277,17 +287,36 @@ export declare const PluginAgentProfileManifestSchema: import("@sinclair/typebox
277
287
  * 哪个老角色。
278
288
  */
279
289
  legacyIds: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
290
+ /**
291
+ * 本智能体能顶的角色 slug(≤ 8 个)。
292
+ *
293
+ * 声明了角色,别的插件就能用 `teams[].members[].role` 槽位引用到它,而不必知道它属于
294
+ * 哪个插件。这是提供方唯一要做的事——被谁引用、引用几次,提供方都不需要知道。
295
+ */
296
+ roles: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
280
297
  }>;
281
298
  /**
282
- * 插件贡献的团队成员。
299
+ * 插件贡献的团队成员。`agent` 与 `role` 二选一,必须恰好写一个。
283
300
  *
284
- * `agent` 只能写本插件 `agents[]` 里的智能体 id。刻意不支持引用别的插件——那会让一个插件的
285
- * 可用性取决于另一个插件是否安装;宿主也没有内置人设可引用,装机自带的那几位同样由预置
286
- * 插件提供。引用不到的成员会让这一支团队整体被跳过。
301
+ * - `agent`:**实体引用**。`<agentId>` 指本插件的智能体,`<pluginId>/<agentId>` 指别的插件的。
302
+ * - `role`:**角色槽位**。只声明「这里需要一个什么角色」,由宿主在全部已启用插件里解析。
303
+ *
304
+ * 推荐用角色槽位:消费方只耦合到一个角色名,提供方换人、换插件、被第三方取代都不影响它,
305
+ * 用户还能把槽位改绑到自己调教过的智能体。实体引用留给「就是要那个人」的场合。
306
+ *
307
+ * 跨插件引用不再被拒,但它带来的「提供方可能不在」由 `optional` 兜底,而不是让整支团队消失。
287
308
  */
288
309
  export declare const PluginAgentTeamMemberManifestSchema: import("@sinclair/typebox").TObject<{
289
- agent: import("@sinclair/typebox").TString;
310
+ agent: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
311
+ role: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
290
312
  responsibility: import("@sinclair/typebox").TString;
313
+ /**
314
+ * 解析不到这名成员时,是否照常发布这支团队。
315
+ *
316
+ * 缺省值按引用方式走:本插件的实体引用为 `false`(自己的东西缺了就是配置错误),跨插件
317
+ * 实体引用与角色槽位为 `true`(提供方本来就可能不在场)。
318
+ */
319
+ optional: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
291
320
  }>;
292
321
  /** 插件贡献的团队。第一个成员即队长,也是用户在会话里唯一的对话入口。 */
293
322
  export declare const PluginAgentTeamManifestSchema: import("@sinclair/typebox").TObject<{
@@ -295,8 +324,16 @@ export declare const PluginAgentTeamManifestSchema: import("@sinclair/typebox").
295
324
  name: import("@sinclair/typebox").TString;
296
325
  description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
297
326
  members: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
298
- agent: import("@sinclair/typebox").TString;
327
+ agent: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
328
+ role: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
299
329
  responsibility: import("@sinclair/typebox").TString;
330
+ /**
331
+ * 解析不到这名成员时,是否照常发布这支团队。
332
+ *
333
+ * 缺省值按引用方式走:本插件的实体引用为 `false`(自己的东西缺了就是配置错误),跨插件
334
+ * 实体引用与角色槽位为 `true`(提供方本来就可能不在场)。
335
+ */
336
+ optional: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
300
337
  }>>;
301
338
  /** 队长的团队任务书:把这支团队的固定流水线写死。与 `workflowPath` 二选一。 */
302
339
  workflow: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
@@ -357,14 +394,29 @@ export declare const PluginAgentManifestSchema: import("@sinclair/typebox").TObj
357
394
  * 哪个老角色。
358
395
  */
359
396
  legacyIds: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
397
+ /**
398
+ * 本智能体能顶的角色 slug(≤ 8 个)。
399
+ *
400
+ * 声明了角色,别的插件就能用 `teams[].members[].role` 槽位引用到它,而不必知道它属于
401
+ * 哪个插件。这是提供方唯一要做的事——被谁引用、引用几次,提供方都不需要知道。
402
+ */
403
+ roles: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
360
404
  }>>>;
361
405
  teams: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
362
406
  id: import("@sinclair/typebox").TString;
363
407
  name: import("@sinclair/typebox").TString;
364
408
  description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
365
409
  members: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
366
- agent: import("@sinclair/typebox").TString;
410
+ agent: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
411
+ role: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
367
412
  responsibility: import("@sinclair/typebox").TString;
413
+ /**
414
+ * 解析不到这名成员时,是否照常发布这支团队。
415
+ *
416
+ * 缺省值按引用方式走:本插件的实体引用为 `false`(自己的东西缺了就是配置错误),跨插件
417
+ * 实体引用与角色槽位为 `true`(提供方本来就可能不在场)。
418
+ */
419
+ optional: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
368
420
  }>>;
369
421
  /** 队长的团队任务书:把这支团队的固定流水线写死。与 `workflowPath` 二选一。 */
370
422
  workflow: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
@@ -483,14 +535,29 @@ export declare const PluginManifestSchema: import("@sinclair/typebox").TObject<{
483
535
  * 哪个老角色。
484
536
  */
485
537
  legacyIds: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
538
+ /**
539
+ * 本智能体能顶的角色 slug(≤ 8 个)。
540
+ *
541
+ * 声明了角色,别的插件就能用 `teams[].members[].role` 槽位引用到它,而不必知道它属于
542
+ * 哪个插件。这是提供方唯一要做的事——被谁引用、引用几次,提供方都不需要知道。
543
+ */
544
+ roles: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
486
545
  }>>>;
487
546
  teams: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
488
547
  id: import("@sinclair/typebox").TString;
489
548
  name: import("@sinclair/typebox").TString;
490
549
  description: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
491
550
  members: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
492
- agent: import("@sinclair/typebox").TString;
551
+ agent: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
552
+ role: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
493
553
  responsibility: import("@sinclair/typebox").TString;
554
+ /**
555
+ * 解析不到这名成员时,是否照常发布这支团队。
556
+ *
557
+ * 缺省值按引用方式走:本插件的实体引用为 `false`(自己的东西缺了就是配置错误),跨插件
558
+ * 实体引用与角色槽位为 `true`(提供方本来就可能不在场)。
559
+ */
560
+ optional: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
494
561
  }>>;
495
562
  /** 队长的团队任务书:把这支团队的固定流水线写死。与 `workflowPath` 二选一。 */
496
563
  workflow: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
@@ -1 +1 @@
1
- {"version":3,"file":"manifest-schema.d.ts","sourceRoot":"","sources":["../src/manifest-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAMtD,eAAO,MAAM,cAAc,qCAKzB,CAAC;AAEH,eAAO,MAAM,mBAAmB,qCAK9B,CAAC;AAEH,eAAO,MAAM,uBAAuB,qCAKlC,CAAC;AAEH,eAAO,MAAM,wBAAwB,yEAAsC,CAAC;AAW5E,eAAO,MAAM,+BAA+B;;;;;;;;;;;;EAgB3C,CAAC;AAQF,eAAO,MAAM,2BAA2B;;;IAItC,qGAAqG;;EAItG,CAAC;AAEF,eAAO,MAAM,2BAA2B;;;;;QANtC,qGAAqG;;;EAYtG,CAAC;AAEF,eAAO,MAAM,mCAAmC;;;QAK5C,4DAA4D;;;QAG5D,+EAA+E;;;;;;;gBAtBjF,qGAAqG;;;;;;;;;;;;QAiDjG,oFAAoF;;;;;;;;;;;;;;;EA4BzF,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;YA5DtC,4DAA4D;;;YAG5D,+EAA+E;;;;;;;oBAtBjF,qGAAqG;;;;;;;;;;;;YAiDjG,oFAAoF;;;;;;;;;;;;;;;;EAoCzF,CAAC;AAEF,eAAO,MAAM,2BAA2B;;EAQvC,CAAC;AAEF,eAAO,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AC,OAAO,6BAA6B,CAAC,CAAC;AACnF,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAC/E,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAC/E,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACtE,MAAM,MAAM,cAAc,GAAG,mBAAmB,CAAC","sourcesContent":["import { Type, type Static } from \"@sinclair/typebox\";\nimport { SkillSurfaceVisibilitySchema, SkillVisibilitySchema } from \"@vetta-org/capability-sdk\";\nimport { PLUGIN_PERMISSIONS } from \"./permissions.js\";\n\nconst NON_WHITESPACE_PATTERN = \"\\\\S\";\n\nexport const PluginIdSchema = Type.String({\n\tminLength: 1,\n\tmaxLength: 64,\n\tpattern: \"^[a-z0-9][a-z0-9._-]{0,63}$\",\n\tdescription: \"Stable lowercase plugin identifier.\",\n});\n\nexport const PluginVersionSchema = Type.String({\n\tminLength: 1,\n\tmaxLength: 64,\n\tpattern: \"^[a-zA-Z0-9][a-zA-Z0-9._+-]{0,63}$\",\n\tdescription: \"Plugin version without path separators.\",\n});\n\nexport const PluginCommandNameSchema = Type.String({\n\tminLength: 1,\n\tmaxLength: 64,\n\tpattern: \"^[a-zA-Z0-9][a-zA-Z0-9._+-]{0,63}$\",\n\tdescription: \"Bare executable name declared by the plugin.\",\n});\n\nexport const PluginCommandNamesSchema = Type.Array(PluginCommandNameSchema);\n\nconst PluginCliCommandSchema = Type.Object(\n\t{\n\t\tcommand: PluginCommandNameSchema,\n\t\targs: Type.Optional(Type.Array(Type.String(), { maxItems: 64 })),\n\t\ttimeoutMs: Type.Optional(Type.Number({ minimum: 1_000, maximum: 30 * 60_000 })),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport const PluginCliProviderManifestSchema = Type.Object(\n\t{\n\t\tid: PluginIdSchema,\n\t\tcommand: PluginCommandNameSchema,\n\t\tprobe: Type.Optional(\n\t\t\tType.Object(\n\t\t\t\t{\n\t\t\t\t\targs: Type.Optional(Type.Array(Type.String(), { maxItems: 64 })),\n\t\t\t\t\ttimeoutMs: Type.Optional(Type.Number({ minimum: 1_000, maximum: 120_000 })),\n\t\t\t\t},\n\t\t\t\t{ additionalProperties: false },\n\t\t\t),\n\t\t),\n\t\tinstall: PluginCliCommandSchema,\n\t},\n\t{ additionalProperties: false },\n);\n\nconst PluginServiceArchiveSchema = Type.Union([\n\tType.Literal(\"file\"),\n\tType.Literal(\"zip\"),\n\tType.Literal(\"tar.gz\"),\n]);\n\nexport const PluginServiceArtifactSchema = Type.Object(\n\t{\n\t\tsha256: Type.String({ pattern: \"^[a-f0-9]{64}$\" }),\n\t\tarchive: PluginServiceArchiveSchema,\n\t\t/** Relative file (archive=file) or directory (archive=zip/tar.gz) below the managed runtime root. */\n\t\tdestination: Type.String({ minLength: 1, maxLength: 512 }),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport const PluginServicePlatformSchema = Type.Object(\n\t{\n\t\texecutable: Type.String({ minLength: 1, maxLength: 512 }),\n\t\tartifacts: Type.Array(PluginServiceArtifactSchema, { minItems: 1, maxItems: 8 }),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport const PluginServiceProviderManifestSchema = Type.Object(\n\t{\n\t\tid: PluginIdSchema,\n\t\truntime: Type.Object(\n\t\t\t{\n\t\t\t\t/** `managed-binary` is the backwards-compatible default. */\n\t\t\t\tkind: Type.Optional(Type.Union([Type.Literal(\"managed-binary\"), Type.Literal(\"host-node\")])),\n\t\t\t\tversion: PluginVersionSchema,\n\t\t\t\t/** Entry script relative to the installed runtime (required for host-node). */\n\t\t\t\tentry: Type.Optional(Type.String({ minLength: 1, maxLength: 512 })),\n\t\t\t\tplatforms: Type.Record(\n\t\t\t\t\tType.String({ pattern: \"^(win32|darwin|linux)-(x64|arm64)$\" }),\n\t\t\t\t\tPluginServicePlatformSchema,\n\t\t\t\t),\n\t\t\t},\n\t\t\t{ additionalProperties: false },\n\t\t),\n\t\tcredentials: Type.Optional(\n\t\t\tType.Array(\n\t\t\t\tType.Object(\n\t\t\t\t\t{\n\t\t\t\t\t\tid: PluginIdSchema,\n\t\t\t\t\t\tbytes: Type.Optional(Type.Integer({ minimum: 16, maximum: 64 })),\n\t\t\t\t\t},\n\t\t\t\t\t{ additionalProperties: false },\n\t\t\t\t),\n\t\t\t\t{ minItems: 1, maxItems: 8 },\n\t\t\t),\n\t\t),\n\t\ttemplates: Type.Optional(\n\t\t\tType.Array(\n\t\t\t\tType.Object(\n\t\t\t\t\t{\n\t\t\t\t\t\tsource: Type.String({ minLength: 1, maxLength: 512 }),\n\t\t\t\t\t\tdestination: Type.String({ minLength: 1, maxLength: 512 }),\n\t\t\t\t\t\t/** create preserves a data file; render regenerates a cache file on every start. */\n\t\t\t\t\t\tmode: Type.Union([Type.Literal(\"create\"), Type.Literal(\"render\")]),\n\t\t\t\t\t},\n\t\t\t\t\t{ additionalProperties: false },\n\t\t\t\t),\n\t\t\t\t{ minItems: 1, maxItems: 16 },\n\t\t\t),\n\t\t),\n\t\tprocess: Type.Object(\n\t\t\t{\n\t\t\t\targs: Type.Optional(Type.Array(Type.String(), { maxItems: 64 })),\n\t\t\t\tenv: Type.Optional(Type.Record(Type.String({ minLength: 1 }), Type.String())),\n\t\t\t},\n\t\t\t{ additionalProperties: false },\n\t\t),\n\t\thealth: Type.Object(\n\t\t\t{\n\t\t\t\tpath: Type.String({ minLength: 1, maxLength: 1_024, pattern: \"^/[^/]*\" }),\n\t\t\t\tcredentialId: Type.Optional(PluginIdSchema),\n\t\t\t\ttimeoutMs: Type.Optional(Type.Integer({ minimum: 1_000, maximum: 120_000 })),\n\t\t\t\treadiness: Type.Optional(\n\t\t\t\t\tType.Object({ mode: Type.Literal(\"plugin\") }, { additionalProperties: false }),\n\t\t\t\t),\n\t\t\t},\n\t\t\t{ additionalProperties: false },\n\t\t),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport const PluginProvidersManifestSchema = Type.Object(\n\t{\n\t\tcli: Type.Optional(Type.Array(PluginCliProviderManifestSchema, { minItems: 1, maxItems: 16 })),\n\t\tservices: Type.Optional(Type.Array(PluginServiceProviderManifestSchema, { minItems: 1, maxItems: 8 })),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport const PluginNetworkManifestSchema = Type.Object(\n\t{\n\t\tallowedHosts: Type.Array(Type.String({ minLength: 1, maxLength: 253, pattern: NON_WHITESPACE_PATTERN }), {\n\t\t\tminItems: 1,\n\t\t\tmaxItems: 128,\n\t\t}),\n\t},\n\t{ additionalProperties: true },\n);\n\nexport const PluginBrowserManifestSchema = Type.Object(\n\t{\n\t\tallowedHosts: Type.Array(Type.String({ minLength: 1, maxLength: 253, pattern: NON_WHITESPACE_PATTERN }), {\n\t\t\tminItems: 1,\n\t\t\tmaxItems: 128,\n\t\t}),\n\t},\n\t{ additionalProperties: true },\n);\n\nexport const PluginPermissionSchema = Type.Union(\n\tPLUGIN_PERMISSIONS.map((permission) => Type.Literal(permission)),\n\t{ description: \"Host capability requested by the plugin.\" },\n);\n\nconst NonWhitespaceStringSchema = Type.String({ pattern: NON_WHITESPACE_PATTERN });\nconst OptionalAgentModesSchema = Type.Optional(\n\tType.Union([NonWhitespaceStringSchema, Type.Array(NonWhitespaceStringSchema)]),\n);\nconst StringRecordSchema = Type.Record(Type.String(), Type.String());\n\nconst PluginMcpCommonProperties = {\n\tdisabled: Type.Optional(Type.Boolean()),\n\tautoApprove: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\tstartupTimeout: Type.Optional(Type.Number()),\n\tdebug: Type.Optional(Type.Boolean()),\n\tdisplayName: Type.Optional(Type.String()),\n\tdescription: Type.Optional(Type.String()),\n\tagent_mode: OptionalAgentModesSchema,\n};\n\nexport const PluginMcpStdioServerConfigSchema = Type.Object(\n\t{\n\t\t...PluginMcpCommonProperties,\n\t\ttype: Type.Optional(Type.Literal(\"stdio\")),\n\t\tcommand: NonWhitespaceStringSchema,\n\t\targs: Type.Optional(Type.Array(Type.String())),\n\t\tenv: Type.Optional(StringRecordSchema),\n\t\tcwd: Type.Optional(Type.String()),\n\t},\n\t{ additionalProperties: true },\n);\n\nexport const PluginMcpHttpServerConfigSchema = Type.Object(\n\t{\n\t\t...PluginMcpCommonProperties,\n\t\ttype: Type.Literal(\"http\"),\n\t\turl: NonWhitespaceStringSchema,\n\t\theaders: Type.Optional(StringRecordSchema),\n\t\toauthClientId: Type.Optional(Type.String()),\n\t\toauthDeviceFlow: Type.Optional(Type.Boolean()),\n\t\toauthScopes: Type.Optional(Type.String()),\n\t},\n\t{ additionalProperties: true },\n);\n\n/** HTTP MCP served by one of this plugin's managed local services. */\nexport const PluginMcpServiceServerConfigSchema = Type.Object(\n\t{\n\t\t...PluginMcpCommonProperties,\n\t\ttype: Type.Literal(\"service\"),\n\t\tserviceId: PluginIdSchema,\n\t\tpath: Type.String({ pattern: \"^/[^/]*\" }),\n\t},\n\t{ additionalProperties: true },\n);\n\nexport const PluginMcpServerConfigSchema = Type.Union([\n\tPluginMcpStdioServerConfigSchema,\n\tPluginMcpHttpServerConfigSchema,\n\tPluginMcpServiceServerConfigSchema,\n]);\n\nconst PluginMcpServerMapSchema = Type.Record(\n\tType.String({ pattern: NON_WHITESPACE_PATTERN }),\n\tPluginMcpServerConfigSchema,\n\t{ additionalProperties: false },\n);\n\nexport const PluginSkillPresentationRuleSchema = Type.Object(\n\t{\n\t\tdefaultVisibility: Type.Optional(SkillVisibilitySchema),\n\t\tsurfaces: Type.Optional(SkillSurfaceVisibilitySchema),\n\t\tdisplayName: Type.Optional(NonWhitespaceStringSchema),\n\t\tdisplayDescription: Type.Optional(NonWhitespaceStringSchema),\n\t},\n\t{ additionalProperties: false },\n);\nexport const PluginSkillPresentationSchema = Type.Object(\n\t{\n\t\tdefaultVisibility: Type.Optional(SkillVisibilitySchema),\n\t\tsurfaces: Type.Optional(SkillSurfaceVisibilitySchema),\n\t\tskills: Type.Optional(Type.Record(NonWhitespaceStringSchema, PluginSkillPresentationRuleSchema)),\n\t},\n\t{ additionalProperties: false },\n);\n\n/** 插件贡献的智能体(blueprint)。人设、头像、职责都由插件提供,宿主只负责铺档案。 */\nexport const PluginAgentProfileManifestSchema = Type.Object(\n\t{\n\t\t/** 插件内唯一;全局 id 由宿主拼成 `plugin:<pluginId>:<id>`。 */\n\t\tid: Type.String({ pattern: \"^[a-z0-9][a-z0-9-]{0,63}$\" }),\n\t\t/** 支持 `%key%` 占位,按插件 locales 解析。 */\n\t\tname: NonWhitespaceStringSchema,\n\t\tdescription: Type.Optional(Type.String({ maxLength: 2_000 })),\n\t\t/** @ 提及用的短名;缺省用 `id`。 */\n\t\tmentionHandle: Type.Optional(Type.String({ pattern: \"^[a-z0-9][a-z0-9-]{0,63}$\" })),\n\t\t/** 插件包内的相对路径,指向头像图片。 */\n\t\tavatar: Type.Optional(NonWhitespaceStringSchema),\n\t\t/** 插件包内的相对路径,指向系统提示词 Markdown。与 `systemPrompt` 二选一。 */\n\t\tsystemPromptPath: Type.Optional(NonWhitespaceStringSchema),\n\t\tsystemPrompt: Type.Optional(Type.String({ maxLength: 64_000 })),\n\t\t/**\n\t\t * `all`(默认)继承宿主全部已启用能力;`own` 只用本插件的能力。\n\t\t * 两种模式下本插件的能力都强制激活,用户关不掉。\n\t\t */\n\t\tabilities: Type.Optional(Type.Union([Type.Literal(\"all\"), Type.Literal(\"own\")])),\n\t\t/**\n\t\t * 本智能体接管的历史 blueprint id。\n\t\t *\n\t\t * 用于「人设从别处迁进插件」:宿主解析不到这些 id 时折算到本智能体,回填时也据此\n\t\t * 认领用户已有的同角色档案,而不是再铺一份新的。宿主因此不必知道是哪个插件接管了\n\t\t * 哪个老角色。\n\t\t */\n\t\tlegacyIds: Type.Optional(Type.Array(NonWhitespaceStringSchema, { maxItems: 16 })),\n\t},\n\t{ additionalProperties: false },\n);\n\n/**\n * 插件贡献的团队成员。\n *\n * `agent` 只能写本插件 `agents[]` 里的智能体 id。刻意不支持引用别的插件——那会让一个插件的\n * 可用性取决于另一个插件是否安装;宿主也没有内置人设可引用,装机自带的那几位同样由预置\n * 插件提供。引用不到的成员会让这一支团队整体被跳过。\n */\nexport const PluginAgentTeamMemberManifestSchema = Type.Object(\n\t{\n\t\tagent: NonWhitespaceStringSchema,\n\t\tresponsibility: Type.String({ maxLength: 2_000 }),\n\t},\n\t{ additionalProperties: false },\n);\n\n/** 插件贡献的团队。第一个成员即队长,也是用户在会话里唯一的对话入口。 */\nexport const PluginAgentTeamManifestSchema = Type.Object(\n\t{\n\t\tid: Type.String({ pattern: \"^[a-z0-9][a-z0-9-]{0,63}$\" }),\n\t\tname: NonWhitespaceStringSchema,\n\t\tdescription: Type.Optional(Type.String({ maxLength: 2_000 })),\n\t\tmembers: Type.Array(PluginAgentTeamMemberManifestSchema, { minItems: 1, maxItems: 32 }),\n\t\t/** 队长的团队任务书:把这支团队的固定流水线写死。与 `workflowPath` 二选一。 */\n\t\tworkflow: Type.Optional(Type.String({ maxLength: 64_000 })),\n\t\tworkflowPath: Type.Optional(NonWhitespaceStringSchema),\n\t\t/** 本团队接管的历史团队 id,语义同 `agents[].legacyIds`。 */\n\t\tlegacyIds: Type.Optional(Type.Array(NonWhitespaceStringSchema, { maxItems: 16 })),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport const PluginAgentManifestSchema = Type.Object(\n\t{\n\t\tsystemPrompt: Type.Optional(\n\t\t\tType.Object(\n\t\t\t\t{\n\t\t\t\t\tpromptPaths: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\t\t\t\t},\n\t\t\t\t{ additionalProperties: true },\n\t\t\t),\n\t\t),\n\t\tskillPaths: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\t\tskillPresentation: Type.Optional(PluginSkillPresentationSchema),\n\t\tagents: Type.Optional(Type.Array(PluginAgentProfileManifestSchema, { maxItems: 32 })),\n\t\tteams: Type.Optional(Type.Array(PluginAgentTeamManifestSchema, { maxItems: 32 })),\n\t\tmcpServers: Type.Optional(Type.Union([NonWhitespaceStringSchema, PluginMcpServerMapSchema])),\n\t\ttoolPolicy: Type.Optional(\n\t\t\tType.Object(\n\t\t\t\t{\n\t\t\t\t\tallow: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\t\t\t\t\tdeny: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\t\t\t\t},\n\t\t\t\t{ additionalProperties: true },\n\t\t\t),\n\t\t),\n\t},\n\t{ additionalProperties: true },\n);\n\nexport const PluginModuleFederationManifestSchema = Type.Object(\n\t{\n\t\tremoteName: Type.String({ pattern: \"^[A-Za-z_$][A-Za-z0-9_$-]{0,63}$\" }),\n\t\texpose: Type.String({ pattern: \"^\\\\./(?!.*\\\\.\\\\.)(?!.*\\\\\\\\).+$\" }),\n\t},\n\t{ additionalProperties: true },\n);\n\nexport const PluginManifestSchema = Type.Object(\n\t{\n\t\tid: PluginIdSchema,\n\t\tname: NonWhitespaceStringSchema,\n\t\tversion: PluginVersionSchema,\n\t\tpluginApiVersion: NonWhitespaceStringSchema,\n\t\tentry: NonWhitespaceStringSchema,\n\t\tmoduleFederation: PluginModuleFederationManifestSchema,\n\t\tagent: Type.Optional(PluginAgentManifestSchema),\n\t\tproviders: Type.Optional(PluginProvidersManifestSchema),\n\t\tstyles: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\t\tpermissions: Type.Optional(Type.Array(PluginPermissionSchema)),\n\t\tnetwork: Type.Optional(PluginNetworkManifestSchema),\n\t\tbrowser: Type.Optional(PluginBrowserManifestSchema),\n\t\tcommands: Type.Optional(PluginCommandNamesSchema),\n\t\tdescription: Type.Optional(Type.String()),\n\t\tauthor: Type.Optional(Type.String()),\n\t\ticon: Type.Optional(NonWhitespaceStringSchema),\n\t\tguidingWords: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\t\tdefaultLocale: Type.Optional(\n\t\t\tType.String({ minLength: 2, maxLength: 16, pattern: \"^[a-zA-Z][a-zA-Z0-9-]{1,15}$\" }),\n\t\t),\n\t\tcontributionMode: Type.Optional(\n\t\t\tType.Object(\n\t\t\t\t{\n\t\t\t\t\thardIsolation: Type.Optional(Type.Boolean()),\n\t\t\t\t},\n\t\t\t\t{ additionalProperties: true },\n\t\t\t),\n\t\t),\n\t\tagent_mode: OptionalAgentModesSchema,\n\t},\n\t{\n\t\t$id: \"PluginManifest\",\n\t\tadditionalProperties: true,\n\t\tdescription: \"Vetta desktop plugin manifest (plugin.json).\",\n\t},\n);\n\nexport type PluginMcpServerConfig = Static<typeof PluginMcpServerConfigSchema>;\nexport type PluginAgentManifest = Static<typeof PluginAgentManifestSchema>;\nexport type PluginAgentProfileManifest = Static<typeof PluginAgentProfileManifestSchema>;\nexport type PluginAgentTeamManifest = Static<typeof PluginAgentTeamManifestSchema>;\nexport type PluginAgentTeamMemberManifest = Static<typeof PluginAgentTeamMemberManifestSchema>;\nexport type PluginSkillPresentation = Static<typeof PluginSkillPresentationSchema>;\nexport type PluginSkillPresentationRule = Static<typeof PluginSkillPresentationRuleSchema>;\nexport type PluginCliProviderManifest = Static<typeof PluginCliProviderManifestSchema>;\nexport type PluginServiceArtifact = Static<typeof PluginServiceArtifactSchema>;\nexport type PluginServicePlatform = Static<typeof PluginServicePlatformSchema>;\nexport type PluginServiceProviderManifest = Static<typeof PluginServiceProviderManifestSchema>;\nexport type PluginServiceRuntimeKind = \"managed-binary\" | \"host-node\";\nexport type PluginProvidersManifest = Static<typeof PluginProvidersManifestSchema>;\nexport type PluginNetworkManifest = Static<typeof PluginNetworkManifestSchema>;\nexport type PluginBrowserManifest = Static<typeof PluginBrowserManifestSchema>;\nexport type PluginManifestInput = Static<typeof PluginManifestSchema>;\nexport type PluginManifest = PluginManifestInput;\n"]}
1
+ {"version":3,"file":"manifest-schema.d.ts","sourceRoot":"","sources":["../src/manifest-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAMtD,eAAO,MAAM,cAAc,qCAKzB,CAAC;AAEH,eAA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C,CAAC;AACtE,MAAM,MAAM,cAAc,GAAG,mBAAmB,CAAC","sourcesContent":["import { Type, type Static } from \"@sinclair/typebox\";\nimport { SkillSurfaceVisibilitySchema, SkillVisibilitySchema } from \"@vetta-org/capability-sdk\";\nimport { PLUGIN_PERMISSIONS } from \"./permissions.js\";\n\nconst NON_WHITESPACE_PATTERN = \"\\\\S\";\n\nexport const PluginIdSchema = Type.String({\n\tminLength: 1,\n\tmaxLength: 64,\n\tpattern: \"^[a-z0-9][a-z0-9._-]{0,63}$\",\n\tdescription: \"Stable lowercase plugin identifier.\",\n});\n\nexport const PluginVersionSchema = Type.String({\n\tminLength: 1,\n\tmaxLength: 64,\n\tpattern: \"^[a-zA-Z0-9][a-zA-Z0-9._+-]{0,63}$\",\n\tdescription: \"Plugin version without path separators.\",\n});\n\nexport const PluginCommandNameSchema = Type.String({\n\tminLength: 1,\n\tmaxLength: 64,\n\tpattern: \"^[a-zA-Z0-9][a-zA-Z0-9._+-]{0,63}$\",\n\tdescription: \"Bare executable name declared by the plugin.\",\n});\n\nexport const PluginCommandNamesSchema = Type.Array(PluginCommandNameSchema);\n\nconst PluginCliCommandSchema = Type.Object(\n\t{\n\t\tcommand: PluginCommandNameSchema,\n\t\targs: Type.Optional(Type.Array(Type.String(), { maxItems: 64 })),\n\t\ttimeoutMs: Type.Optional(Type.Number({ minimum: 1_000, maximum: 30 * 60_000 })),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport const PluginCliProviderManifestSchema = Type.Object(\n\t{\n\t\tid: PluginIdSchema,\n\t\tcommand: PluginCommandNameSchema,\n\t\tprobe: Type.Optional(\n\t\t\tType.Object(\n\t\t\t\t{\n\t\t\t\t\targs: Type.Optional(Type.Array(Type.String(), { maxItems: 64 })),\n\t\t\t\t\ttimeoutMs: Type.Optional(Type.Number({ minimum: 1_000, maximum: 120_000 })),\n\t\t\t\t},\n\t\t\t\t{ additionalProperties: false },\n\t\t\t),\n\t\t),\n\t\tinstall: PluginCliCommandSchema,\n\t},\n\t{ additionalProperties: false },\n);\n\nconst PluginServiceArchiveSchema = Type.Union([\n\tType.Literal(\"file\"),\n\tType.Literal(\"zip\"),\n\tType.Literal(\"tar.gz\"),\n]);\n\nexport const PluginServiceArtifactSchema = Type.Object(\n\t{\n\t\tsha256: Type.String({ pattern: \"^[a-f0-9]{64}$\" }),\n\t\tarchive: PluginServiceArchiveSchema,\n\t\t/** Relative file (archive=file) or directory (archive=zip/tar.gz) below the managed runtime root. */\n\t\tdestination: Type.String({ minLength: 1, maxLength: 512 }),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport const PluginServicePlatformSchema = Type.Object(\n\t{\n\t\texecutable: Type.String({ minLength: 1, maxLength: 512 }),\n\t\tartifacts: Type.Array(PluginServiceArtifactSchema, { minItems: 1, maxItems: 8 }),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport const PluginServiceProviderManifestSchema = Type.Object(\n\t{\n\t\tid: PluginIdSchema,\n\t\truntime: Type.Object(\n\t\t\t{\n\t\t\t\t/** `managed-binary` is the backwards-compatible default. */\n\t\t\t\tkind: Type.Optional(Type.Union([Type.Literal(\"managed-binary\"), Type.Literal(\"host-node\")])),\n\t\t\t\tversion: PluginVersionSchema,\n\t\t\t\t/** Entry script relative to the installed runtime (required for host-node). */\n\t\t\t\tentry: Type.Optional(Type.String({ minLength: 1, maxLength: 512 })),\n\t\t\t\tplatforms: Type.Record(\n\t\t\t\t\tType.String({ pattern: \"^(win32|darwin|linux)-(x64|arm64)$\" }),\n\t\t\t\t\tPluginServicePlatformSchema,\n\t\t\t\t),\n\t\t\t},\n\t\t\t{ additionalProperties: false },\n\t\t),\n\t\tcredentials: Type.Optional(\n\t\t\tType.Array(\n\t\t\t\tType.Object(\n\t\t\t\t\t{\n\t\t\t\t\t\tid: PluginIdSchema,\n\t\t\t\t\t\tbytes: Type.Optional(Type.Integer({ minimum: 16, maximum: 64 })),\n\t\t\t\t\t},\n\t\t\t\t\t{ additionalProperties: false },\n\t\t\t\t),\n\t\t\t\t{ minItems: 1, maxItems: 8 },\n\t\t\t),\n\t\t),\n\t\ttemplates: Type.Optional(\n\t\t\tType.Array(\n\t\t\t\tType.Object(\n\t\t\t\t\t{\n\t\t\t\t\t\tsource: Type.String({ minLength: 1, maxLength: 512 }),\n\t\t\t\t\t\tdestination: Type.String({ minLength: 1, maxLength: 512 }),\n\t\t\t\t\t\t/** create preserves a data file; render regenerates a cache file on every start. */\n\t\t\t\t\t\tmode: Type.Union([Type.Literal(\"create\"), Type.Literal(\"render\")]),\n\t\t\t\t\t},\n\t\t\t\t\t{ additionalProperties: false },\n\t\t\t\t),\n\t\t\t\t{ minItems: 1, maxItems: 16 },\n\t\t\t),\n\t\t),\n\t\tprocess: Type.Object(\n\t\t\t{\n\t\t\t\targs: Type.Optional(Type.Array(Type.String(), { maxItems: 64 })),\n\t\t\t\tenv: Type.Optional(Type.Record(Type.String({ minLength: 1 }), Type.String())),\n\t\t\t},\n\t\t\t{ additionalProperties: false },\n\t\t),\n\t\thealth: Type.Object(\n\t\t\t{\n\t\t\t\tpath: Type.String({ minLength: 1, maxLength: 1_024, pattern: \"^/[^/]*\" }),\n\t\t\t\tcredentialId: Type.Optional(PluginIdSchema),\n\t\t\t\ttimeoutMs: Type.Optional(Type.Integer({ minimum: 1_000, maximum: 120_000 })),\n\t\t\t\treadiness: Type.Optional(\n\t\t\t\t\tType.Object({ mode: Type.Literal(\"plugin\") }, { additionalProperties: false }),\n\t\t\t\t),\n\t\t\t},\n\t\t\t{ additionalProperties: false },\n\t\t),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport const PluginProvidersManifestSchema = Type.Object(\n\t{\n\t\tcli: Type.Optional(Type.Array(PluginCliProviderManifestSchema, { minItems: 1, maxItems: 16 })),\n\t\tservices: Type.Optional(Type.Array(PluginServiceProviderManifestSchema, { minItems: 1, maxItems: 8 })),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport const PluginNetworkManifestSchema = Type.Object(\n\t{\n\t\tallowedHosts: Type.Array(Type.String({ minLength: 1, maxLength: 253, pattern: NON_WHITESPACE_PATTERN }), {\n\t\t\tminItems: 1,\n\t\t\tmaxItems: 128,\n\t\t}),\n\t},\n\t{ additionalProperties: true },\n);\n\nexport const PluginBrowserManifestSchema = Type.Object(\n\t{\n\t\tallowedHosts: Type.Array(Type.String({ minLength: 1, maxLength: 253, pattern: NON_WHITESPACE_PATTERN }), {\n\t\t\tminItems: 1,\n\t\t\tmaxItems: 128,\n\t\t}),\n\t},\n\t{ additionalProperties: true },\n);\n\nexport const PluginPermissionSchema = Type.Union(\n\tPLUGIN_PERMISSIONS.map((permission) => Type.Literal(permission)),\n\t{ description: \"Host capability requested by the plugin.\" },\n);\n\nconst NonWhitespaceStringSchema = Type.String({ pattern: NON_WHITESPACE_PATTERN });\nconst OptionalAgentModesSchema = Type.Optional(\n\tType.Union([NonWhitespaceStringSchema, Type.Array(NonWhitespaceStringSchema)]),\n);\nconst StringRecordSchema = Type.Record(Type.String(), Type.String());\n\nconst PluginMcpCommonProperties = {\n\tdisabled: Type.Optional(Type.Boolean()),\n\tautoApprove: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\tstartupTimeout: Type.Optional(Type.Number()),\n\tdebug: Type.Optional(Type.Boolean()),\n\tdisplayName: Type.Optional(Type.String()),\n\tdescription: Type.Optional(Type.String()),\n\tagent_mode: OptionalAgentModesSchema,\n};\n\nexport const PluginMcpStdioServerConfigSchema = Type.Object(\n\t{\n\t\t...PluginMcpCommonProperties,\n\t\ttype: Type.Optional(Type.Literal(\"stdio\")),\n\t\tcommand: NonWhitespaceStringSchema,\n\t\targs: Type.Optional(Type.Array(Type.String())),\n\t\tenv: Type.Optional(StringRecordSchema),\n\t\tcwd: Type.Optional(Type.String()),\n\t},\n\t{ additionalProperties: true },\n);\n\nexport const PluginMcpHttpServerConfigSchema = Type.Object(\n\t{\n\t\t...PluginMcpCommonProperties,\n\t\ttype: Type.Literal(\"http\"),\n\t\turl: NonWhitespaceStringSchema,\n\t\theaders: Type.Optional(StringRecordSchema),\n\t\toauthClientId: Type.Optional(Type.String()),\n\t\toauthDeviceFlow: Type.Optional(Type.Boolean()),\n\t\toauthScopes: Type.Optional(Type.String()),\n\t},\n\t{ additionalProperties: true },\n);\n\n/** HTTP MCP served by one of this plugin's managed local services. */\nexport const PluginMcpServiceServerConfigSchema = Type.Object(\n\t{\n\t\t...PluginMcpCommonProperties,\n\t\ttype: Type.Literal(\"service\"),\n\t\tserviceId: PluginIdSchema,\n\t\tpath: Type.String({ pattern: \"^/[^/]*\" }),\n\t},\n\t{ additionalProperties: true },\n);\n\nexport const PluginMcpServerConfigSchema = Type.Union([\n\tPluginMcpStdioServerConfigSchema,\n\tPluginMcpHttpServerConfigSchema,\n\tPluginMcpServiceServerConfigSchema,\n]);\n\nconst PluginMcpServerMapSchema = Type.Record(\n\tType.String({ pattern: NON_WHITESPACE_PATTERN }),\n\tPluginMcpServerConfigSchema,\n\t{ additionalProperties: false },\n);\n\nexport const PluginSkillPresentationRuleSchema = Type.Object(\n\t{\n\t\tdefaultVisibility: Type.Optional(SkillVisibilitySchema),\n\t\tsurfaces: Type.Optional(SkillSurfaceVisibilitySchema),\n\t\tdisplayName: Type.Optional(NonWhitespaceStringSchema),\n\t\tdisplayDescription: Type.Optional(NonWhitespaceStringSchema),\n\t},\n\t{ additionalProperties: false },\n);\nexport const PluginSkillPresentationSchema = Type.Object(\n\t{\n\t\tdefaultVisibility: Type.Optional(SkillVisibilitySchema),\n\t\tsurfaces: Type.Optional(SkillSurfaceVisibilitySchema),\n\t\tskills: Type.Optional(Type.Record(NonWhitespaceStringSchema, PluginSkillPresentationRuleSchema)),\n\t},\n\t{ additionalProperties: false },\n);\n\n/** 角色 slug。跨插件引用的唯一词汇表,格式与智能体 id 一致。 */\nexport const PluginAgentRoleSchema = Type.String({ pattern: \"^[a-z0-9][a-z0-9-]{0,63}$\" });\n\n/**\n * 宿主认识的角色词表。\n *\n * **不是白名单**:写表外的角色照样能被解析,只是团队编辑器里没有现成的槽位选择器。列在这里\n * 的角色由预置插件供货,因此任何一台装机上都解析得到,第三方插件可以放心引用。\n */\nexport const BUILTIN_PLUGIN_AGENT_ROLES = [\n\t\"master\",\n\t\"developer\",\n\t\"researcher\",\n\t\"auditor\",\n\t\"business\",\n\t\"designer\",\n] as const;\n\nexport type BuiltinPluginAgentRole = (typeof BUILTIN_PLUGIN_AGENT_ROLES)[number];\n\n/** 插件贡献的智能体(blueprint)。人设、头像、职责都由插件提供,宿主只负责铺档案。 */\nexport const PluginAgentProfileManifestSchema = Type.Object(\n\t{\n\t\t/** 插件内唯一;全局 id 由宿主拼成 `plugin:<pluginId>:<id>`。 */\n\t\tid: Type.String({ pattern: \"^[a-z0-9][a-z0-9-]{0,63}$\" }),\n\t\t/** 支持 `%key%` 占位,按插件 locales 解析。 */\n\t\tname: NonWhitespaceStringSchema,\n\t\tdescription: Type.Optional(Type.String({ maxLength: 2_000 })),\n\t\t/** @ 提及用的短名;缺省用 `id`。 */\n\t\tmentionHandle: Type.Optional(Type.String({ pattern: \"^[a-z0-9][a-z0-9-]{0,63}$\" })),\n\t\t/** 插件包内的相对路径,指向头像图片。 */\n\t\tavatar: Type.Optional(NonWhitespaceStringSchema),\n\t\t/** 插件包内的相对路径,指向系统提示词 Markdown。与 `systemPrompt` 二选一。 */\n\t\tsystemPromptPath: Type.Optional(NonWhitespaceStringSchema),\n\t\tsystemPrompt: Type.Optional(Type.String({ maxLength: 64_000 })),\n\t\t/**\n\t\t * `all`(默认)继承宿主全部已启用能力;`own` 只用本插件的能力。\n\t\t * 两种模式下本插件的能力都强制激活,用户关不掉。\n\t\t */\n\t\tabilities: Type.Optional(Type.Union([Type.Literal(\"all\"), Type.Literal(\"own\")])),\n\t\t/**\n\t\t * 本智能体接管的历史 blueprint id。\n\t\t *\n\t\t * 用于「人设从别处迁进插件」:宿主解析不到这些 id 时折算到本智能体,回填时也据此\n\t\t * 认领用户已有的同角色档案,而不是再铺一份新的。宿主因此不必知道是哪个插件接管了\n\t\t * 哪个老角色。\n\t\t */\n\t\tlegacyIds: Type.Optional(Type.Array(NonWhitespaceStringSchema, { maxItems: 16 })),\n\t\t/**\n\t\t * 本智能体能顶的角色 slug(≤ 8 个)。\n\t\t *\n\t\t * 声明了角色,别的插件就能用 `teams[].members[].role` 槽位引用到它,而不必知道它属于\n\t\t * 哪个插件。这是提供方唯一要做的事——被谁引用、引用几次,提供方都不需要知道。\n\t\t */\n\t\troles: Type.Optional(Type.Array(PluginAgentRoleSchema, { maxItems: 8 })),\n\t},\n\t{ additionalProperties: false },\n);\n\n/**\n * 插件贡献的团队成员。`agent` 与 `role` 二选一,必须恰好写一个。\n *\n * - `agent`:**实体引用**。`<agentId>` 指本插件的智能体,`<pluginId>/<agentId>` 指别的插件的。\n * - `role`:**角色槽位**。只声明「这里需要一个什么角色」,由宿主在全部已启用插件里解析。\n *\n * 推荐用角色槽位:消费方只耦合到一个角色名,提供方换人、换插件、被第三方取代都不影响它,\n * 用户还能把槽位改绑到自己调教过的智能体。实体引用留给「就是要那个人」的场合。\n *\n * 跨插件引用不再被拒,但它带来的「提供方可能不在」由 `optional` 兜底,而不是让整支团队消失。\n */\nexport const PluginAgentTeamMemberManifestSchema = Type.Object(\n\t{\n\t\tagent: Type.Optional(NonWhitespaceStringSchema),\n\t\trole: Type.Optional(PluginAgentRoleSchema),\n\t\tresponsibility: Type.String({ maxLength: 2_000 }),\n\t\t/**\n\t\t * 解析不到这名成员时,是否照常发布这支团队。\n\t\t *\n\t\t * 缺省值按引用方式走:本插件的实体引用为 `false`(自己的东西缺了就是配置错误),跨插件\n\t\t * 实体引用与角色槽位为 `true`(提供方本来就可能不在场)。\n\t\t */\n\t\toptional: Type.Optional(Type.Boolean()),\n\t},\n\t{ additionalProperties: false },\n);\n\n/** 插件贡献的团队。第一个成员即队长,也是用户在会话里唯一的对话入口。 */\nexport const PluginAgentTeamManifestSchema = Type.Object(\n\t{\n\t\tid: Type.String({ pattern: \"^[a-z0-9][a-z0-9-]{0,63}$\" }),\n\t\tname: NonWhitespaceStringSchema,\n\t\tdescription: Type.Optional(Type.String({ maxLength: 2_000 })),\n\t\tmembers: Type.Array(PluginAgentTeamMemberManifestSchema, { minItems: 1, maxItems: 32 }),\n\t\t/** 队长的团队任务书:把这支团队的固定流水线写死。与 `workflowPath` 二选一。 */\n\t\tworkflow: Type.Optional(Type.String({ maxLength: 64_000 })),\n\t\tworkflowPath: Type.Optional(NonWhitespaceStringSchema),\n\t\t/** 本团队接管的历史团队 id,语义同 `agents[].legacyIds`。 */\n\t\tlegacyIds: Type.Optional(Type.Array(NonWhitespaceStringSchema, { maxItems: 16 })),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport const PluginAgentManifestSchema = Type.Object(\n\t{\n\t\tsystemPrompt: Type.Optional(\n\t\t\tType.Object(\n\t\t\t\t{\n\t\t\t\t\tpromptPaths: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\t\t\t\t},\n\t\t\t\t{ additionalProperties: true },\n\t\t\t),\n\t\t),\n\t\tskillPaths: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\t\tskillPresentation: Type.Optional(PluginSkillPresentationSchema),\n\t\tagents: Type.Optional(Type.Array(PluginAgentProfileManifestSchema, { maxItems: 32 })),\n\t\tteams: Type.Optional(Type.Array(PluginAgentTeamManifestSchema, { maxItems: 32 })),\n\t\tmcpServers: Type.Optional(Type.Union([NonWhitespaceStringSchema, PluginMcpServerMapSchema])),\n\t\ttoolPolicy: Type.Optional(\n\t\t\tType.Object(\n\t\t\t\t{\n\t\t\t\t\tallow: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\t\t\t\t\tdeny: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\t\t\t\t},\n\t\t\t\t{ additionalProperties: true },\n\t\t\t),\n\t\t),\n\t},\n\t{ additionalProperties: true },\n);\n\nexport const PluginModuleFederationManifestSchema = Type.Object(\n\t{\n\t\tremoteName: Type.String({ pattern: \"^[A-Za-z_$][A-Za-z0-9_$-]{0,63}$\" }),\n\t\texpose: Type.String({ pattern: \"^\\\\./(?!.*\\\\.\\\\.)(?!.*\\\\\\\\).+$\" }),\n\t},\n\t{ additionalProperties: true },\n);\n\nexport const PluginManifestSchema = Type.Object(\n\t{\n\t\tid: PluginIdSchema,\n\t\tname: NonWhitespaceStringSchema,\n\t\tversion: PluginVersionSchema,\n\t\tpluginApiVersion: NonWhitespaceStringSchema,\n\t\tentry: NonWhitespaceStringSchema,\n\t\tmoduleFederation: PluginModuleFederationManifestSchema,\n\t\tagent: Type.Optional(PluginAgentManifestSchema),\n\t\tproviders: Type.Optional(PluginProvidersManifestSchema),\n\t\tstyles: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\t\tpermissions: Type.Optional(Type.Array(PluginPermissionSchema)),\n\t\tnetwork: Type.Optional(PluginNetworkManifestSchema),\n\t\tbrowser: Type.Optional(PluginBrowserManifestSchema),\n\t\tcommands: Type.Optional(PluginCommandNamesSchema),\n\t\tdescription: Type.Optional(Type.String()),\n\t\tauthor: Type.Optional(Type.String()),\n\t\ticon: Type.Optional(NonWhitespaceStringSchema),\n\t\tguidingWords: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\t\tdefaultLocale: Type.Optional(\n\t\t\tType.String({ minLength: 2, maxLength: 16, pattern: \"^[a-zA-Z][a-zA-Z0-9-]{1,15}$\" }),\n\t\t),\n\t\tcontributionMode: Type.Optional(\n\t\t\tType.Object(\n\t\t\t\t{\n\t\t\t\t\thardIsolation: Type.Optional(Type.Boolean()),\n\t\t\t\t},\n\t\t\t\t{ additionalProperties: true },\n\t\t\t),\n\t\t),\n\t\tagent_mode: OptionalAgentModesSchema,\n\t},\n\t{\n\t\t$id: \"PluginManifest\",\n\t\tadditionalProperties: true,\n\t\tdescription: \"Vetta desktop plugin manifest (plugin.json).\",\n\t},\n);\n\nexport type PluginMcpServerConfig = Static<typeof PluginMcpServerConfigSchema>;\nexport type PluginAgentManifest = Static<typeof PluginAgentManifestSchema>;\nexport type PluginAgentProfileManifest = Static<typeof PluginAgentProfileManifestSchema>;\nexport type PluginAgentTeamManifest = Static<typeof PluginAgentTeamManifestSchema>;\nexport type PluginAgentTeamMemberManifest = Static<typeof PluginAgentTeamMemberManifestSchema>;\nexport type PluginSkillPresentation = Static<typeof PluginSkillPresentationSchema>;\nexport type PluginSkillPresentationRule = Static<typeof PluginSkillPresentationRuleSchema>;\nexport type PluginCliProviderManifest = Static<typeof PluginCliProviderManifestSchema>;\nexport type PluginServiceArtifact = Static<typeof PluginServiceArtifactSchema>;\nexport type PluginServicePlatform = Static<typeof PluginServicePlatformSchema>;\nexport type PluginServiceProviderManifest = Static<typeof PluginServiceProviderManifestSchema>;\nexport type PluginServiceRuntimeKind = \"managed-binary\" | \"host-node\";\nexport type PluginProvidersManifest = Static<typeof PluginProvidersManifestSchema>;\nexport type PluginNetworkManifest = Static<typeof PluginNetworkManifestSchema>;\nexport type PluginBrowserManifest = Static<typeof PluginBrowserManifestSchema>;\nexport type PluginManifestInput = Static<typeof PluginManifestSchema>;\nexport type PluginManifest = PluginManifestInput;\n"]}
@@ -151,6 +151,22 @@ export const PluginSkillPresentationSchema = Type.Object({
151
151
  surfaces: Type.Optional(SkillSurfaceVisibilitySchema),
152
152
  skills: Type.Optional(Type.Record(NonWhitespaceStringSchema, PluginSkillPresentationRuleSchema)),
153
153
  }, { additionalProperties: false });
154
+ /** 角色 slug。跨插件引用的唯一词汇表,格式与智能体 id 一致。 */
155
+ export const PluginAgentRoleSchema = Type.String({ pattern: "^[a-z0-9][a-z0-9-]{0,63}$" });
156
+ /**
157
+ * 宿主认识的角色词表。
158
+ *
159
+ * **不是白名单**:写表外的角色照样能被解析,只是团队编辑器里没有现成的槽位选择器。列在这里
160
+ * 的角色由预置插件供货,因此任何一台装机上都解析得到,第三方插件可以放心引用。
161
+ */
162
+ export const BUILTIN_PLUGIN_AGENT_ROLES = [
163
+ "master",
164
+ "developer",
165
+ "researcher",
166
+ "auditor",
167
+ "business",
168
+ "designer",
169
+ ];
154
170
  /** 插件贡献的智能体(blueprint)。人设、头像、职责都由插件提供,宿主只负责铺档案。 */
155
171
  export const PluginAgentProfileManifestSchema = Type.Object({
156
172
  /** 插件内唯一;全局 id 由宿主拼成 `plugin:<pluginId>:<id>`。 */
@@ -178,17 +194,36 @@ export const PluginAgentProfileManifestSchema = Type.Object({
178
194
  * 哪个老角色。
179
195
  */
180
196
  legacyIds: Type.Optional(Type.Array(NonWhitespaceStringSchema, { maxItems: 16 })),
197
+ /**
198
+ * 本智能体能顶的角色 slug(≤ 8 个)。
199
+ *
200
+ * 声明了角色,别的插件就能用 `teams[].members[].role` 槽位引用到它,而不必知道它属于
201
+ * 哪个插件。这是提供方唯一要做的事——被谁引用、引用几次,提供方都不需要知道。
202
+ */
203
+ roles: Type.Optional(Type.Array(PluginAgentRoleSchema, { maxItems: 8 })),
181
204
  }, { additionalProperties: false });
182
205
  /**
183
- * 插件贡献的团队成员。
206
+ * 插件贡献的团队成员。`agent` 与 `role` 二选一,必须恰好写一个。
184
207
  *
185
- * `agent` 只能写本插件 `agents[]` 里的智能体 id。刻意不支持引用别的插件——那会让一个插件的
186
- * 可用性取决于另一个插件是否安装;宿主也没有内置人设可引用,装机自带的那几位同样由预置
187
- * 插件提供。引用不到的成员会让这一支团队整体被跳过。
208
+ * - `agent`:**实体引用**。`<agentId>` 指本插件的智能体,`<pluginId>/<agentId>` 指别的插件的。
209
+ * - `role`:**角色槽位**。只声明「这里需要一个什么角色」,由宿主在全部已启用插件里解析。
210
+ *
211
+ * 推荐用角色槽位:消费方只耦合到一个角色名,提供方换人、换插件、被第三方取代都不影响它,
212
+ * 用户还能把槽位改绑到自己调教过的智能体。实体引用留给「就是要那个人」的场合。
213
+ *
214
+ * 跨插件引用不再被拒,但它带来的「提供方可能不在」由 `optional` 兜底,而不是让整支团队消失。
188
215
  */
189
216
  export const PluginAgentTeamMemberManifestSchema = Type.Object({
190
- agent: NonWhitespaceStringSchema,
217
+ agent: Type.Optional(NonWhitespaceStringSchema),
218
+ role: Type.Optional(PluginAgentRoleSchema),
191
219
  responsibility: Type.String({ maxLength: 2_000 }),
220
+ /**
221
+ * 解析不到这名成员时,是否照常发布这支团队。
222
+ *
223
+ * 缺省值按引用方式走:本插件的实体引用为 `false`(自己的东西缺了就是配置错误),跨插件
224
+ * 实体引用与角色槽位为 `true`(提供方本来就可能不在场)。
225
+ */
226
+ optional: Type.Optional(Type.Boolean()),
192
227
  }, { additionalProperties: false });
193
228
  /** 插件贡献的团队。第一个成员即队长,也是用户在会话里唯一的对话入口。 */
194
229
  export const PluginAgentTeamManifestSchema = Type.Object({
@@ -1 +1 @@
1
- {"version":3,"file":"manifest-schema.js","sourceRoot":"","sources":["../src/manifest-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAe,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAChG,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,sBAAsB,GAAG,KAAK,CAAC;AAErC,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC;IACzC,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,EAAE;IACb,OAAO,EAAE,6BAA6B;IACtC,WAAW,EAAE,qCAAqC;CAClD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC9C,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,EAAE;IACb,OAAO,EAAE,oCAAoC;IAC7C,WAAW,EAAE,yCAAyC;CACtD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC,MAAM,CAAC;IAClD,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,EAAE;IACb,OAAO,EAAE,oCAAoC;IAC7C,WAAW,EAAE,8CAA8C;CAC3D,CAAC,CAAC;AAEH,MAA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,CAAC,yBAAyB,CAAC;IAC9C,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAClE,aAAa,EAAE,IAAI,CAAC,QAAQ,CAC3B,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,8BAA8B,EAAE,CAAC,CACrF;IACD,gBAAgB,EAAE,IAAI,CAAC,QAAQ,CAC9B,IAAI,CAAC,MAAM,CACV;QACC,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;KAC5C,EACD,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAC9B,CACD;IACD,UAAU,EAAE,wBAAwB;CACpC,EACD;IACC,GAAG,EAAE,gBAAgB;IACrB,oBAAoB,EAAE,IAAI;IAC1B,WAAW,EAAE,8CAA8C;CAC3D,CACD,CAAC","sourcesContent":["import { Type, type Static } from \"@sinclair/typebox\";\nimport { SkillSurfaceVisibilitySchema, SkillVisibilitySchema } from \"@vetta-org/capability-sdk\";\nimport { PLUGIN_PERMISSIONS } from \"./permissions.js\";\n\nconst NON_WHITESPACE_PATTERN = \"\\\\S\";\n\nexport const PluginIdSchema = Type.String({\n\tminLength: 1,\n\tmaxLength: 64,\n\tpattern: \"^[a-z0-9][a-z0-9._-]{0,63}$\",\n\tdescription: \"Stable lowercase plugin identifier.\",\n});\n\nexport const PluginVersionSchema = Type.String({\n\tminLength: 1,\n\tmaxLength: 64,\n\tpattern: \"^[a-zA-Z0-9][a-zA-Z0-9._+-]{0,63}$\",\n\tdescription: \"Plugin version without path separators.\",\n});\n\nexport const PluginCommandNameSchema = Type.String({\n\tminLength: 1,\n\tmaxLength: 64,\n\tpattern: \"^[a-zA-Z0-9][a-zA-Z0-9._+-]{0,63}$\",\n\tdescription: \"Bare executable name declared by the plugin.\",\n});\n\nexport const PluginCommandNamesSchema = Type.Array(PluginCommandNameSchema);\n\nconst PluginCliCommandSchema = Type.Object(\n\t{\n\t\tcommand: PluginCommandNameSchema,\n\t\targs: Type.Optional(Type.Array(Type.String(), { maxItems: 64 })),\n\t\ttimeoutMs: Type.Optional(Type.Number({ minimum: 1_000, maximum: 30 * 60_000 })),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport const PluginCliProviderManifestSchema = Type.Object(\n\t{\n\t\tid: PluginIdSchema,\n\t\tcommand: PluginCommandNameSchema,\n\t\tprobe: Type.Optional(\n\t\t\tType.Object(\n\t\t\t\t{\n\t\t\t\t\targs: Type.Optional(Type.Array(Type.String(), { maxItems: 64 })),\n\t\t\t\t\ttimeoutMs: Type.Optional(Type.Number({ minimum: 1_000, maximum: 120_000 })),\n\t\t\t\t},\n\t\t\t\t{ additionalProperties: false },\n\t\t\t),\n\t\t),\n\t\tinstall: PluginCliCommandSchema,\n\t},\n\t{ additionalProperties: false },\n);\n\nconst PluginServiceArchiveSchema = Type.Union([\n\tType.Literal(\"file\"),\n\tType.Literal(\"zip\"),\n\tType.Literal(\"tar.gz\"),\n]);\n\nexport const PluginServiceArtifactSchema = Type.Object(\n\t{\n\t\tsha256: Type.String({ pattern: \"^[a-f0-9]{64}$\" }),\n\t\tarchive: PluginServiceArchiveSchema,\n\t\t/** Relative file (archive=file) or directory (archive=zip/tar.gz) below the managed runtime root. */\n\t\tdestination: Type.String({ minLength: 1, maxLength: 512 }),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport const PluginServicePlatformSchema = Type.Object(\n\t{\n\t\texecutable: Type.String({ minLength: 1, maxLength: 512 }),\n\t\tartifacts: Type.Array(PluginServiceArtifactSchema, { minItems: 1, maxItems: 8 }),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport const PluginServiceProviderManifestSchema = Type.Object(\n\t{\n\t\tid: PluginIdSchema,\n\t\truntime: Type.Object(\n\t\t\t{\n\t\t\t\t/** `managed-binary` is the backwards-compatible default. */\n\t\t\t\tkind: Type.Optional(Type.Union([Type.Literal(\"managed-binary\"), Type.Literal(\"host-node\")])),\n\t\t\t\tversion: PluginVersionSchema,\n\t\t\t\t/** Entry script relative to the installed runtime (required for host-node). */\n\t\t\t\tentry: Type.Optional(Type.String({ minLength: 1, maxLength: 512 })),\n\t\t\t\tplatforms: Type.Record(\n\t\t\t\t\tType.String({ pattern: \"^(win32|darwin|linux)-(x64|arm64)$\" }),\n\t\t\t\t\tPluginServicePlatformSchema,\n\t\t\t\t),\n\t\t\t},\n\t\t\t{ additionalProperties: false },\n\t\t),\n\t\tcredentials: Type.Optional(\n\t\t\tType.Array(\n\t\t\t\tType.Object(\n\t\t\t\t\t{\n\t\t\t\t\t\tid: PluginIdSchema,\n\t\t\t\t\t\tbytes: Type.Optional(Type.Integer({ minimum: 16, maximum: 64 })),\n\t\t\t\t\t},\n\t\t\t\t\t{ additionalProperties: false },\n\t\t\t\t),\n\t\t\t\t{ minItems: 1, maxItems: 8 },\n\t\t\t),\n\t\t),\n\t\ttemplates: Type.Optional(\n\t\t\tType.Array(\n\t\t\t\tType.Object(\n\t\t\t\t\t{\n\t\t\t\t\t\tsource: Type.String({ minLength: 1, maxLength: 512 }),\n\t\t\t\t\t\tdestination: Type.String({ minLength: 1, maxLength: 512 }),\n\t\t\t\t\t\t/** create preserves a data file; render regenerates a cache file on every start. */\n\t\t\t\t\t\tmode: Type.Union([Type.Literal(\"create\"), Type.Literal(\"render\")]),\n\t\t\t\t\t},\n\t\t\t\t\t{ additionalProperties: false },\n\t\t\t\t),\n\t\t\t\t{ minItems: 1, maxItems: 16 },\n\t\t\t),\n\t\t),\n\t\tprocess: Type.Object(\n\t\t\t{\n\t\t\t\targs: Type.Optional(Type.Array(Type.String(), { maxItems: 64 })),\n\t\t\t\tenv: Type.Optional(Type.Record(Type.String({ minLength: 1 }), Type.String())),\n\t\t\t},\n\t\t\t{ additionalProperties: false },\n\t\t),\n\t\thealth: Type.Object(\n\t\t\t{\n\t\t\t\tpath: Type.String({ minLength: 1, maxLength: 1_024, pattern: \"^/[^/]*\" }),\n\t\t\t\tcredentialId: Type.Optional(PluginIdSchema),\n\t\t\t\ttimeoutMs: Type.Optional(Type.Integer({ minimum: 1_000, maximum: 120_000 })),\n\t\t\t\treadiness: Type.Optional(\n\t\t\t\t\tType.Object({ mode: Type.Literal(\"plugin\") }, { additionalProperties: false }),\n\t\t\t\t),\n\t\t\t},\n\t\t\t{ additionalProperties: false },\n\t\t),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport const PluginProvidersManifestSchema = Type.Object(\n\t{\n\t\tcli: Type.Optional(Type.Array(PluginCliProviderManifestSchema, { minItems: 1, maxItems: 16 })),\n\t\tservices: Type.Optional(Type.Array(PluginServiceProviderManifestSchema, { minItems: 1, maxItems: 8 })),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport const PluginNetworkManifestSchema = Type.Object(\n\t{\n\t\tallowedHosts: Type.Array(Type.String({ minLength: 1, maxLength: 253, pattern: NON_WHITESPACE_PATTERN }), {\n\t\t\tminItems: 1,\n\t\t\tmaxItems: 128,\n\t\t}),\n\t},\n\t{ additionalProperties: true },\n);\n\nexport const PluginBrowserManifestSchema = Type.Object(\n\t{\n\t\tallowedHosts: Type.Array(Type.String({ minLength: 1, maxLength: 253, pattern: NON_WHITESPACE_PATTERN }), {\n\t\t\tminItems: 1,\n\t\t\tmaxItems: 128,\n\t\t}),\n\t},\n\t{ additionalProperties: true },\n);\n\nexport const PluginPermissionSchema = Type.Union(\n\tPLUGIN_PERMISSIONS.map((permission) => Type.Literal(permission)),\n\t{ description: \"Host capability requested by the plugin.\" },\n);\n\nconst NonWhitespaceStringSchema = Type.String({ pattern: NON_WHITESPACE_PATTERN });\nconst OptionalAgentModesSchema = Type.Optional(\n\tType.Union([NonWhitespaceStringSchema, Type.Array(NonWhitespaceStringSchema)]),\n);\nconst StringRecordSchema = Type.Record(Type.String(), Type.String());\n\nconst PluginMcpCommonProperties = {\n\tdisabled: Type.Optional(Type.Boolean()),\n\tautoApprove: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\tstartupTimeout: Type.Optional(Type.Number()),\n\tdebug: Type.Optional(Type.Boolean()),\n\tdisplayName: Type.Optional(Type.String()),\n\tdescription: Type.Optional(Type.String()),\n\tagent_mode: OptionalAgentModesSchema,\n};\n\nexport const PluginMcpStdioServerConfigSchema = Type.Object(\n\t{\n\t\t...PluginMcpCommonProperties,\n\t\ttype: Type.Optional(Type.Literal(\"stdio\")),\n\t\tcommand: NonWhitespaceStringSchema,\n\t\targs: Type.Optional(Type.Array(Type.String())),\n\t\tenv: Type.Optional(StringRecordSchema),\n\t\tcwd: Type.Optional(Type.String()),\n\t},\n\t{ additionalProperties: true },\n);\n\nexport const PluginMcpHttpServerConfigSchema = Type.Object(\n\t{\n\t\t...PluginMcpCommonProperties,\n\t\ttype: Type.Literal(\"http\"),\n\t\turl: NonWhitespaceStringSchema,\n\t\theaders: Type.Optional(StringRecordSchema),\n\t\toauthClientId: Type.Optional(Type.String()),\n\t\toauthDeviceFlow: Type.Optional(Type.Boolean()),\n\t\toauthScopes: Type.Optional(Type.String()),\n\t},\n\t{ additionalProperties: true },\n);\n\n/** HTTP MCP served by one of this plugin's managed local services. */\nexport const PluginMcpServiceServerConfigSchema = Type.Object(\n\t{\n\t\t...PluginMcpCommonProperties,\n\t\ttype: Type.Literal(\"service\"),\n\t\tserviceId: PluginIdSchema,\n\t\tpath: Type.String({ pattern: \"^/[^/]*\" }),\n\t},\n\t{ additionalProperties: true },\n);\n\nexport const PluginMcpServerConfigSchema = Type.Union([\n\tPluginMcpStdioServerConfigSchema,\n\tPluginMcpHttpServerConfigSchema,\n\tPluginMcpServiceServerConfigSchema,\n]);\n\nconst PluginMcpServerMapSchema = Type.Record(\n\tType.String({ pattern: NON_WHITESPACE_PATTERN }),\n\tPluginMcpServerConfigSchema,\n\t{ additionalProperties: false },\n);\n\nexport const PluginSkillPresentationRuleSchema = Type.Object(\n\t{\n\t\tdefaultVisibility: Type.Optional(SkillVisibilitySchema),\n\t\tsurfaces: Type.Optional(SkillSurfaceVisibilitySchema),\n\t\tdisplayName: Type.Optional(NonWhitespaceStringSchema),\n\t\tdisplayDescription: Type.Optional(NonWhitespaceStringSchema),\n\t},\n\t{ additionalProperties: false },\n);\nexport const PluginSkillPresentationSchema = Type.Object(\n\t{\n\t\tdefaultVisibility: Type.Optional(SkillVisibilitySchema),\n\t\tsurfaces: Type.Optional(SkillSurfaceVisibilitySchema),\n\t\tskills: Type.Optional(Type.Record(NonWhitespaceStringSchema, PluginSkillPresentationRuleSchema)),\n\t},\n\t{ additionalProperties: false },\n);\n\n/** 插件贡献的智能体(blueprint)。人设、头像、职责都由插件提供,宿主只负责铺档案。 */\nexport const PluginAgentProfileManifestSchema = Type.Object(\n\t{\n\t\t/** 插件内唯一;全局 id 由宿主拼成 `plugin:<pluginId>:<id>`。 */\n\t\tid: Type.String({ pattern: \"^[a-z0-9][a-z0-9-]{0,63}$\" }),\n\t\t/** 支持 `%key%` 占位,按插件 locales 解析。 */\n\t\tname: NonWhitespaceStringSchema,\n\t\tdescription: Type.Optional(Type.String({ maxLength: 2_000 })),\n\t\t/** @ 提及用的短名;缺省用 `id`。 */\n\t\tmentionHandle: Type.Optional(Type.String({ pattern: \"^[a-z0-9][a-z0-9-]{0,63}$\" })),\n\t\t/** 插件包内的相对路径,指向头像图片。 */\n\t\tavatar: Type.Optional(NonWhitespaceStringSchema),\n\t\t/** 插件包内的相对路径,指向系统提示词 Markdown。与 `systemPrompt` 二选一。 */\n\t\tsystemPromptPath: Type.Optional(NonWhitespaceStringSchema),\n\t\tsystemPrompt: Type.Optional(Type.String({ maxLength: 64_000 })),\n\t\t/**\n\t\t * `all`(默认)继承宿主全部已启用能力;`own` 只用本插件的能力。\n\t\t * 两种模式下本插件的能力都强制激活,用户关不掉。\n\t\t */\n\t\tabilities: Type.Optional(Type.Union([Type.Literal(\"all\"), Type.Literal(\"own\")])),\n\t\t/**\n\t\t * 本智能体接管的历史 blueprint id。\n\t\t *\n\t\t * 用于「人设从别处迁进插件」:宿主解析不到这些 id 时折算到本智能体,回填时也据此\n\t\t * 认领用户已有的同角色档案,而不是再铺一份新的。宿主因此不必知道是哪个插件接管了\n\t\t * 哪个老角色。\n\t\t */\n\t\tlegacyIds: Type.Optional(Type.Array(NonWhitespaceStringSchema, { maxItems: 16 })),\n\t},\n\t{ additionalProperties: false },\n);\n\n/**\n * 插件贡献的团队成员。\n *\n * `agent` 只能写本插件 `agents[]` 里的智能体 id。刻意不支持引用别的插件——那会让一个插件的\n * 可用性取决于另一个插件是否安装;宿主也没有内置人设可引用,装机自带的那几位同样由预置\n * 插件提供。引用不到的成员会让这一支团队整体被跳过。\n */\nexport const PluginAgentTeamMemberManifestSchema = Type.Object(\n\t{\n\t\tagent: NonWhitespaceStringSchema,\n\t\tresponsibility: Type.String({ maxLength: 2_000 }),\n\t},\n\t{ additionalProperties: false },\n);\n\n/** 插件贡献的团队。第一个成员即队长,也是用户在会话里唯一的对话入口。 */\nexport const PluginAgentTeamManifestSchema = Type.Object(\n\t{\n\t\tid: Type.String({ pattern: \"^[a-z0-9][a-z0-9-]{0,63}$\" }),\n\t\tname: NonWhitespaceStringSchema,\n\t\tdescription: Type.Optional(Type.String({ maxLength: 2_000 })),\n\t\tmembers: Type.Array(PluginAgentTeamMemberManifestSchema, { minItems: 1, maxItems: 32 }),\n\t\t/** 队长的团队任务书:把这支团队的固定流水线写死。与 `workflowPath` 二选一。 */\n\t\tworkflow: Type.Optional(Type.String({ maxLength: 64_000 })),\n\t\tworkflowPath: Type.Optional(NonWhitespaceStringSchema),\n\t\t/** 本团队接管的历史团队 id,语义同 `agents[].legacyIds`。 */\n\t\tlegacyIds: Type.Optional(Type.Array(NonWhitespaceStringSchema, { maxItems: 16 })),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport const PluginAgentManifestSchema = Type.Object(\n\t{\n\t\tsystemPrompt: Type.Optional(\n\t\t\tType.Object(\n\t\t\t\t{\n\t\t\t\t\tpromptPaths: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\t\t\t\t},\n\t\t\t\t{ additionalProperties: true },\n\t\t\t),\n\t\t),\n\t\tskillPaths: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\t\tskillPresentation: Type.Optional(PluginSkillPresentationSchema),\n\t\tagents: Type.Optional(Type.Array(PluginAgentProfileManifestSchema, { maxItems: 32 })),\n\t\tteams: Type.Optional(Type.Array(PluginAgentTeamManifestSchema, { maxItems: 32 })),\n\t\tmcpServers: Type.Optional(Type.Union([NonWhitespaceStringSchema, PluginMcpServerMapSchema])),\n\t\ttoolPolicy: Type.Optional(\n\t\t\tType.Object(\n\t\t\t\t{\n\t\t\t\t\tallow: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\t\t\t\t\tdeny: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\t\t\t\t},\n\t\t\t\t{ additionalProperties: true },\n\t\t\t),\n\t\t),\n\t},\n\t{ additionalProperties: true },\n);\n\nexport const PluginModuleFederationManifestSchema = Type.Object(\n\t{\n\t\tremoteName: Type.String({ pattern: \"^[A-Za-z_$][A-Za-z0-9_$-]{0,63}$\" }),\n\t\texpose: Type.String({ pattern: \"^\\\\./(?!.*\\\\.\\\\.)(?!.*\\\\\\\\).+$\" }),\n\t},\n\t{ additionalProperties: true },\n);\n\nexport const PluginManifestSchema = Type.Object(\n\t{\n\t\tid: PluginIdSchema,\n\t\tname: NonWhitespaceStringSchema,\n\t\tversion: PluginVersionSchema,\n\t\tpluginApiVersion: NonWhitespaceStringSchema,\n\t\tentry: NonWhitespaceStringSchema,\n\t\tmoduleFederation: PluginModuleFederationManifestSchema,\n\t\tagent: Type.Optional(PluginAgentManifestSchema),\n\t\tproviders: Type.Optional(PluginProvidersManifestSchema),\n\t\tstyles: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\t\tpermissions: Type.Optional(Type.Array(PluginPermissionSchema)),\n\t\tnetwork: Type.Optional(PluginNetworkManifestSchema),\n\t\tbrowser: Type.Optional(PluginBrowserManifestSchema),\n\t\tcommands: Type.Optional(PluginCommandNamesSchema),\n\t\tdescription: Type.Optional(Type.String()),\n\t\tauthor: Type.Optional(Type.String()),\n\t\ticon: Type.Optional(NonWhitespaceStringSchema),\n\t\tguidingWords: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\t\tdefaultLocale: Type.Optional(\n\t\t\tType.String({ minLength: 2, maxLength: 16, pattern: \"^[a-zA-Z][a-zA-Z0-9-]{1,15}$\" }),\n\t\t),\n\t\tcontributionMode: Type.Optional(\n\t\t\tType.Object(\n\t\t\t\t{\n\t\t\t\t\thardIsolation: Type.Optional(Type.Boolean()),\n\t\t\t\t},\n\t\t\t\t{ additionalProperties: true },\n\t\t\t),\n\t\t),\n\t\tagent_mode: OptionalAgentModesSchema,\n\t},\n\t{\n\t\t$id: \"PluginManifest\",\n\t\tadditionalProperties: true,\n\t\tdescription: \"Vetta desktop plugin manifest (plugin.json).\",\n\t},\n);\n\nexport type PluginMcpServerConfig = Static<typeof PluginMcpServerConfigSchema>;\nexport type PluginAgentManifest = Static<typeof PluginAgentManifestSchema>;\nexport type PluginAgentProfileManifest = Static<typeof PluginAgentProfileManifestSchema>;\nexport type PluginAgentTeamManifest = Static<typeof PluginAgentTeamManifestSchema>;\nexport type PluginAgentTeamMemberManifest = Static<typeof PluginAgentTeamMemberManifestSchema>;\nexport type PluginSkillPresentation = Static<typeof PluginSkillPresentationSchema>;\nexport type PluginSkillPresentationRule = Static<typeof PluginSkillPresentationRuleSchema>;\nexport type PluginCliProviderManifest = Static<typeof PluginCliProviderManifestSchema>;\nexport type PluginServiceArtifact = Static<typeof PluginServiceArtifactSchema>;\nexport type PluginServicePlatform = Static<typeof PluginServicePlatformSchema>;\nexport type PluginServiceProviderManifest = Static<typeof PluginServiceProviderManifestSchema>;\nexport type PluginServiceRuntimeKind = \"managed-binary\" | \"host-node\";\nexport type PluginProvidersManifest = Static<typeof PluginProvidersManifestSchema>;\nexport type PluginNetworkManifest = Static<typeof PluginNetworkManifestSchema>;\nexport type PluginBrowserManifest = Static<typeof PluginBrowserManifestSchema>;\nexport type PluginManifestInput = Static<typeof PluginManifestSchema>;\nexport type PluginManifest = PluginManifestInput;\n"]}
1
+ {"version":3,"file":"manifest-schema.js","sourceRoot":"","sources":["../src/manifest-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAe,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,4BAA4B,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAChG,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,sBAAsB,GAAG,KAAK,CAAC;AAErC,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC;IACzC,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,EAAE;IACb,OAAO,EAAE,6BAA6B;IACtC,WAAW,EAAE,qCAAqC;CAClD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,MAAM,CAAC;IAC9C,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,EAAE;IACb,OAAO,EAAE,oCAAoC;IAC7C,WAAW,EAAE,yCAAyC;CACtD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC,MAAM,CAAC;IAClD,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,EAAE;IACb,OAAO,EAAE,oCAAoC;IAC7C,WAAW,EAAE,8CAA8C;CAC3D,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;AAE5E,MAAM,sBAAsB,GAAG,IAAI,CAAC,MAAM,CACzC;IACC,OAAO,EAAE,uBAAuB;IAChC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,QAAQ,EAA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CAAC,2BAA2B,CAAC;IACnD,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,2BAA2B,CAAC;IACnD,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,wBAAwB,CAAC;IACjD,WAAW,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IACzC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IACpC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,yBAAyB,CAAC;IAC9C,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAClE,aAAa,EAAE,IAAI,CAAC,QAAQ,CAC3B,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,8BAA8B,EAAE,CAAC,CACrF;IACD,gBAAgB,EAAE,IAAI,CAAC,QAAQ,CAC9B,IAAI,CAAC,MAAM,CACV;QACC,aAAa,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;KAC5C,EACD,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAC9B,CACD;IACD,UAAU,EAAE,wBAAwB;CACpC,EACD;IACC,GAAG,EAAE,gBAAgB;IACrB,oBAAoB,EAAE,IAAI;IAC1B,WAAW,EAAE,8CAA8C;CAC3D,CACD,CAAC","sourcesContent":["import { Type, type Static } from \"@sinclair/typebox\";\nimport { SkillSurfaceVisibilitySchema, SkillVisibilitySchema } from \"@vetta-org/capability-sdk\";\nimport { PLUGIN_PERMISSIONS } from \"./permissions.js\";\n\nconst NON_WHITESPACE_PATTERN = \"\\\\S\";\n\nexport const PluginIdSchema = Type.String({\n\tminLength: 1,\n\tmaxLength: 64,\n\tpattern: \"^[a-z0-9][a-z0-9._-]{0,63}$\",\n\tdescription: \"Stable lowercase plugin identifier.\",\n});\n\nexport const PluginVersionSchema = Type.String({\n\tminLength: 1,\n\tmaxLength: 64,\n\tpattern: \"^[a-zA-Z0-9][a-zA-Z0-9._+-]{0,63}$\",\n\tdescription: \"Plugin version without path separators.\",\n});\n\nexport const PluginCommandNameSchema = Type.String({\n\tminLength: 1,\n\tmaxLength: 64,\n\tpattern: \"^[a-zA-Z0-9][a-zA-Z0-9._+-]{0,63}$\",\n\tdescription: \"Bare executable name declared by the plugin.\",\n});\n\nexport const PluginCommandNamesSchema = Type.Array(PluginCommandNameSchema);\n\nconst PluginCliCommandSchema = Type.Object(\n\t{\n\t\tcommand: PluginCommandNameSchema,\n\t\targs: Type.Optional(Type.Array(Type.String(), { maxItems: 64 })),\n\t\ttimeoutMs: Type.Optional(Type.Number({ minimum: 1_000, maximum: 30 * 60_000 })),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport const PluginCliProviderManifestSchema = Type.Object(\n\t{\n\t\tid: PluginIdSchema,\n\t\tcommand: PluginCommandNameSchema,\n\t\tprobe: Type.Optional(\n\t\t\tType.Object(\n\t\t\t\t{\n\t\t\t\t\targs: Type.Optional(Type.Array(Type.String(), { maxItems: 64 })),\n\t\t\t\t\ttimeoutMs: Type.Optional(Type.Number({ minimum: 1_000, maximum: 120_000 })),\n\t\t\t\t},\n\t\t\t\t{ additionalProperties: false },\n\t\t\t),\n\t\t),\n\t\tinstall: PluginCliCommandSchema,\n\t},\n\t{ additionalProperties: false },\n);\n\nconst PluginServiceArchiveSchema = Type.Union([\n\tType.Literal(\"file\"),\n\tType.Literal(\"zip\"),\n\tType.Literal(\"tar.gz\"),\n]);\n\nexport const PluginServiceArtifactSchema = Type.Object(\n\t{\n\t\tsha256: Type.String({ pattern: \"^[a-f0-9]{64}$\" }),\n\t\tarchive: PluginServiceArchiveSchema,\n\t\t/** Relative file (archive=file) or directory (archive=zip/tar.gz) below the managed runtime root. */\n\t\tdestination: Type.String({ minLength: 1, maxLength: 512 }),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport const PluginServicePlatformSchema = Type.Object(\n\t{\n\t\texecutable: Type.String({ minLength: 1, maxLength: 512 }),\n\t\tartifacts: Type.Array(PluginServiceArtifactSchema, { minItems: 1, maxItems: 8 }),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport const PluginServiceProviderManifestSchema = Type.Object(\n\t{\n\t\tid: PluginIdSchema,\n\t\truntime: Type.Object(\n\t\t\t{\n\t\t\t\t/** `managed-binary` is the backwards-compatible default. */\n\t\t\t\tkind: Type.Optional(Type.Union([Type.Literal(\"managed-binary\"), Type.Literal(\"host-node\")])),\n\t\t\t\tversion: PluginVersionSchema,\n\t\t\t\t/** Entry script relative to the installed runtime (required for host-node). */\n\t\t\t\tentry: Type.Optional(Type.String({ minLength: 1, maxLength: 512 })),\n\t\t\t\tplatforms: Type.Record(\n\t\t\t\t\tType.String({ pattern: \"^(win32|darwin|linux)-(x64|arm64)$\" }),\n\t\t\t\t\tPluginServicePlatformSchema,\n\t\t\t\t),\n\t\t\t},\n\t\t\t{ additionalProperties: false },\n\t\t),\n\t\tcredentials: Type.Optional(\n\t\t\tType.Array(\n\t\t\t\tType.Object(\n\t\t\t\t\t{\n\t\t\t\t\t\tid: PluginIdSchema,\n\t\t\t\t\t\tbytes: Type.Optional(Type.Integer({ minimum: 16, maximum: 64 })),\n\t\t\t\t\t},\n\t\t\t\t\t{ additionalProperties: false },\n\t\t\t\t),\n\t\t\t\t{ minItems: 1, maxItems: 8 },\n\t\t\t),\n\t\t),\n\t\ttemplates: Type.Optional(\n\t\t\tType.Array(\n\t\t\t\tType.Object(\n\t\t\t\t\t{\n\t\t\t\t\t\tsource: Type.String({ minLength: 1, maxLength: 512 }),\n\t\t\t\t\t\tdestination: Type.String({ minLength: 1, maxLength: 512 }),\n\t\t\t\t\t\t/** create preserves a data file; render regenerates a cache file on every start. */\n\t\t\t\t\t\tmode: Type.Union([Type.Literal(\"create\"), Type.Literal(\"render\")]),\n\t\t\t\t\t},\n\t\t\t\t\t{ additionalProperties: false },\n\t\t\t\t),\n\t\t\t\t{ minItems: 1, maxItems: 16 },\n\t\t\t),\n\t\t),\n\t\tprocess: Type.Object(\n\t\t\t{\n\t\t\t\targs: Type.Optional(Type.Array(Type.String(), { maxItems: 64 })),\n\t\t\t\tenv: Type.Optional(Type.Record(Type.String({ minLength: 1 }), Type.String())),\n\t\t\t},\n\t\t\t{ additionalProperties: false },\n\t\t),\n\t\thealth: Type.Object(\n\t\t\t{\n\t\t\t\tpath: Type.String({ minLength: 1, maxLength: 1_024, pattern: \"^/[^/]*\" }),\n\t\t\t\tcredentialId: Type.Optional(PluginIdSchema),\n\t\t\t\ttimeoutMs: Type.Optional(Type.Integer({ minimum: 1_000, maximum: 120_000 })),\n\t\t\t\treadiness: Type.Optional(\n\t\t\t\t\tType.Object({ mode: Type.Literal(\"plugin\") }, { additionalProperties: false }),\n\t\t\t\t),\n\t\t\t},\n\t\t\t{ additionalProperties: false },\n\t\t),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport const PluginProvidersManifestSchema = Type.Object(\n\t{\n\t\tcli: Type.Optional(Type.Array(PluginCliProviderManifestSchema, { minItems: 1, maxItems: 16 })),\n\t\tservices: Type.Optional(Type.Array(PluginServiceProviderManifestSchema, { minItems: 1, maxItems: 8 })),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport const PluginNetworkManifestSchema = Type.Object(\n\t{\n\t\tallowedHosts: Type.Array(Type.String({ minLength: 1, maxLength: 253, pattern: NON_WHITESPACE_PATTERN }), {\n\t\t\tminItems: 1,\n\t\t\tmaxItems: 128,\n\t\t}),\n\t},\n\t{ additionalProperties: true },\n);\n\nexport const PluginBrowserManifestSchema = Type.Object(\n\t{\n\t\tallowedHosts: Type.Array(Type.String({ minLength: 1, maxLength: 253, pattern: NON_WHITESPACE_PATTERN }), {\n\t\t\tminItems: 1,\n\t\t\tmaxItems: 128,\n\t\t}),\n\t},\n\t{ additionalProperties: true },\n);\n\nexport const PluginPermissionSchema = Type.Union(\n\tPLUGIN_PERMISSIONS.map((permission) => Type.Literal(permission)),\n\t{ description: \"Host capability requested by the plugin.\" },\n);\n\nconst NonWhitespaceStringSchema = Type.String({ pattern: NON_WHITESPACE_PATTERN });\nconst OptionalAgentModesSchema = Type.Optional(\n\tType.Union([NonWhitespaceStringSchema, Type.Array(NonWhitespaceStringSchema)]),\n);\nconst StringRecordSchema = Type.Record(Type.String(), Type.String());\n\nconst PluginMcpCommonProperties = {\n\tdisabled: Type.Optional(Type.Boolean()),\n\tautoApprove: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\tstartupTimeout: Type.Optional(Type.Number()),\n\tdebug: Type.Optional(Type.Boolean()),\n\tdisplayName: Type.Optional(Type.String()),\n\tdescription: Type.Optional(Type.String()),\n\tagent_mode: OptionalAgentModesSchema,\n};\n\nexport const PluginMcpStdioServerConfigSchema = Type.Object(\n\t{\n\t\t...PluginMcpCommonProperties,\n\t\ttype: Type.Optional(Type.Literal(\"stdio\")),\n\t\tcommand: NonWhitespaceStringSchema,\n\t\targs: Type.Optional(Type.Array(Type.String())),\n\t\tenv: Type.Optional(StringRecordSchema),\n\t\tcwd: Type.Optional(Type.String()),\n\t},\n\t{ additionalProperties: true },\n);\n\nexport const PluginMcpHttpServerConfigSchema = Type.Object(\n\t{\n\t\t...PluginMcpCommonProperties,\n\t\ttype: Type.Literal(\"http\"),\n\t\turl: NonWhitespaceStringSchema,\n\t\theaders: Type.Optional(StringRecordSchema),\n\t\toauthClientId: Type.Optional(Type.String()),\n\t\toauthDeviceFlow: Type.Optional(Type.Boolean()),\n\t\toauthScopes: Type.Optional(Type.String()),\n\t},\n\t{ additionalProperties: true },\n);\n\n/** HTTP MCP served by one of this plugin's managed local services. */\nexport const PluginMcpServiceServerConfigSchema = Type.Object(\n\t{\n\t\t...PluginMcpCommonProperties,\n\t\ttype: Type.Literal(\"service\"),\n\t\tserviceId: PluginIdSchema,\n\t\tpath: Type.String({ pattern: \"^/[^/]*\" }),\n\t},\n\t{ additionalProperties: true },\n);\n\nexport const PluginMcpServerConfigSchema = Type.Union([\n\tPluginMcpStdioServerConfigSchema,\n\tPluginMcpHttpServerConfigSchema,\n\tPluginMcpServiceServerConfigSchema,\n]);\n\nconst PluginMcpServerMapSchema = Type.Record(\n\tType.String({ pattern: NON_WHITESPACE_PATTERN }),\n\tPluginMcpServerConfigSchema,\n\t{ additionalProperties: false },\n);\n\nexport const PluginSkillPresentationRuleSchema = Type.Object(\n\t{\n\t\tdefaultVisibility: Type.Optional(SkillVisibilitySchema),\n\t\tsurfaces: Type.Optional(SkillSurfaceVisibilitySchema),\n\t\tdisplayName: Type.Optional(NonWhitespaceStringSchema),\n\t\tdisplayDescription: Type.Optional(NonWhitespaceStringSchema),\n\t},\n\t{ additionalProperties: false },\n);\nexport const PluginSkillPresentationSchema = Type.Object(\n\t{\n\t\tdefaultVisibility: Type.Optional(SkillVisibilitySchema),\n\t\tsurfaces: Type.Optional(SkillSurfaceVisibilitySchema),\n\t\tskills: Type.Optional(Type.Record(NonWhitespaceStringSchema, PluginSkillPresentationRuleSchema)),\n\t},\n\t{ additionalProperties: false },\n);\n\n/** 角色 slug。跨插件引用的唯一词汇表,格式与智能体 id 一致。 */\nexport const PluginAgentRoleSchema = Type.String({ pattern: \"^[a-z0-9][a-z0-9-]{0,63}$\" });\n\n/**\n * 宿主认识的角色词表。\n *\n * **不是白名单**:写表外的角色照样能被解析,只是团队编辑器里没有现成的槽位选择器。列在这里\n * 的角色由预置插件供货,因此任何一台装机上都解析得到,第三方插件可以放心引用。\n */\nexport const BUILTIN_PLUGIN_AGENT_ROLES = [\n\t\"master\",\n\t\"developer\",\n\t\"researcher\",\n\t\"auditor\",\n\t\"business\",\n\t\"designer\",\n] as const;\n\nexport type BuiltinPluginAgentRole = (typeof BUILTIN_PLUGIN_AGENT_ROLES)[number];\n\n/** 插件贡献的智能体(blueprint)。人设、头像、职责都由插件提供,宿主只负责铺档案。 */\nexport const PluginAgentProfileManifestSchema = Type.Object(\n\t{\n\t\t/** 插件内唯一;全局 id 由宿主拼成 `plugin:<pluginId>:<id>`。 */\n\t\tid: Type.String({ pattern: \"^[a-z0-9][a-z0-9-]{0,63}$\" }),\n\t\t/** 支持 `%key%` 占位,按插件 locales 解析。 */\n\t\tname: NonWhitespaceStringSchema,\n\t\tdescription: Type.Optional(Type.String({ maxLength: 2_000 })),\n\t\t/** @ 提及用的短名;缺省用 `id`。 */\n\t\tmentionHandle: Type.Optional(Type.String({ pattern: \"^[a-z0-9][a-z0-9-]{0,63}$\" })),\n\t\t/** 插件包内的相对路径,指向头像图片。 */\n\t\tavatar: Type.Optional(NonWhitespaceStringSchema),\n\t\t/** 插件包内的相对路径,指向系统提示词 Markdown。与 `systemPrompt` 二选一。 */\n\t\tsystemPromptPath: Type.Optional(NonWhitespaceStringSchema),\n\t\tsystemPrompt: Type.Optional(Type.String({ maxLength: 64_000 })),\n\t\t/**\n\t\t * `all`(默认)继承宿主全部已启用能力;`own` 只用本插件的能力。\n\t\t * 两种模式下本插件的能力都强制激活,用户关不掉。\n\t\t */\n\t\tabilities: Type.Optional(Type.Union([Type.Literal(\"all\"), Type.Literal(\"own\")])),\n\t\t/**\n\t\t * 本智能体接管的历史 blueprint id。\n\t\t *\n\t\t * 用于「人设从别处迁进插件」:宿主解析不到这些 id 时折算到本智能体,回填时也据此\n\t\t * 认领用户已有的同角色档案,而不是再铺一份新的。宿主因此不必知道是哪个插件接管了\n\t\t * 哪个老角色。\n\t\t */\n\t\tlegacyIds: Type.Optional(Type.Array(NonWhitespaceStringSchema, { maxItems: 16 })),\n\t\t/**\n\t\t * 本智能体能顶的角色 slug(≤ 8 个)。\n\t\t *\n\t\t * 声明了角色,别的插件就能用 `teams[].members[].role` 槽位引用到它,而不必知道它属于\n\t\t * 哪个插件。这是提供方唯一要做的事——被谁引用、引用几次,提供方都不需要知道。\n\t\t */\n\t\troles: Type.Optional(Type.Array(PluginAgentRoleSchema, { maxItems: 8 })),\n\t},\n\t{ additionalProperties: false },\n);\n\n/**\n * 插件贡献的团队成员。`agent` 与 `role` 二选一,必须恰好写一个。\n *\n * - `agent`:**实体引用**。`<agentId>` 指本插件的智能体,`<pluginId>/<agentId>` 指别的插件的。\n * - `role`:**角色槽位**。只声明「这里需要一个什么角色」,由宿主在全部已启用插件里解析。\n *\n * 推荐用角色槽位:消费方只耦合到一个角色名,提供方换人、换插件、被第三方取代都不影响它,\n * 用户还能把槽位改绑到自己调教过的智能体。实体引用留给「就是要那个人」的场合。\n *\n * 跨插件引用不再被拒,但它带来的「提供方可能不在」由 `optional` 兜底,而不是让整支团队消失。\n */\nexport const PluginAgentTeamMemberManifestSchema = Type.Object(\n\t{\n\t\tagent: Type.Optional(NonWhitespaceStringSchema),\n\t\trole: Type.Optional(PluginAgentRoleSchema),\n\t\tresponsibility: Type.String({ maxLength: 2_000 }),\n\t\t/**\n\t\t * 解析不到这名成员时,是否照常发布这支团队。\n\t\t *\n\t\t * 缺省值按引用方式走:本插件的实体引用为 `false`(自己的东西缺了就是配置错误),跨插件\n\t\t * 实体引用与角色槽位为 `true`(提供方本来就可能不在场)。\n\t\t */\n\t\toptional: Type.Optional(Type.Boolean()),\n\t},\n\t{ additionalProperties: false },\n);\n\n/** 插件贡献的团队。第一个成员即队长,也是用户在会话里唯一的对话入口。 */\nexport const PluginAgentTeamManifestSchema = Type.Object(\n\t{\n\t\tid: Type.String({ pattern: \"^[a-z0-9][a-z0-9-]{0,63}$\" }),\n\t\tname: NonWhitespaceStringSchema,\n\t\tdescription: Type.Optional(Type.String({ maxLength: 2_000 })),\n\t\tmembers: Type.Array(PluginAgentTeamMemberManifestSchema, { minItems: 1, maxItems: 32 }),\n\t\t/** 队长的团队任务书:把这支团队的固定流水线写死。与 `workflowPath` 二选一。 */\n\t\tworkflow: Type.Optional(Type.String({ maxLength: 64_000 })),\n\t\tworkflowPath: Type.Optional(NonWhitespaceStringSchema),\n\t\t/** 本团队接管的历史团队 id,语义同 `agents[].legacyIds`。 */\n\t\tlegacyIds: Type.Optional(Type.Array(NonWhitespaceStringSchema, { maxItems: 16 })),\n\t},\n\t{ additionalProperties: false },\n);\n\nexport const PluginAgentManifestSchema = Type.Object(\n\t{\n\t\tsystemPrompt: Type.Optional(\n\t\t\tType.Object(\n\t\t\t\t{\n\t\t\t\t\tpromptPaths: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\t\t\t\t},\n\t\t\t\t{ additionalProperties: true },\n\t\t\t),\n\t\t),\n\t\tskillPaths: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\t\tskillPresentation: Type.Optional(PluginSkillPresentationSchema),\n\t\tagents: Type.Optional(Type.Array(PluginAgentProfileManifestSchema, { maxItems: 32 })),\n\t\tteams: Type.Optional(Type.Array(PluginAgentTeamManifestSchema, { maxItems: 32 })),\n\t\tmcpServers: Type.Optional(Type.Union([NonWhitespaceStringSchema, PluginMcpServerMapSchema])),\n\t\ttoolPolicy: Type.Optional(\n\t\t\tType.Object(\n\t\t\t\t{\n\t\t\t\t\tallow: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\t\t\t\t\tdeny: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\t\t\t\t},\n\t\t\t\t{ additionalProperties: true },\n\t\t\t),\n\t\t),\n\t},\n\t{ additionalProperties: true },\n);\n\nexport const PluginModuleFederationManifestSchema = Type.Object(\n\t{\n\t\tremoteName: Type.String({ pattern: \"^[A-Za-z_$][A-Za-z0-9_$-]{0,63}$\" }),\n\t\texpose: Type.String({ pattern: \"^\\\\./(?!.*\\\\.\\\\.)(?!.*\\\\\\\\).+$\" }),\n\t},\n\t{ additionalProperties: true },\n);\n\nexport const PluginManifestSchema = Type.Object(\n\t{\n\t\tid: PluginIdSchema,\n\t\tname: NonWhitespaceStringSchema,\n\t\tversion: PluginVersionSchema,\n\t\tpluginApiVersion: NonWhitespaceStringSchema,\n\t\tentry: NonWhitespaceStringSchema,\n\t\tmoduleFederation: PluginModuleFederationManifestSchema,\n\t\tagent: Type.Optional(PluginAgentManifestSchema),\n\t\tproviders: Type.Optional(PluginProvidersManifestSchema),\n\t\tstyles: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\t\tpermissions: Type.Optional(Type.Array(PluginPermissionSchema)),\n\t\tnetwork: Type.Optional(PluginNetworkManifestSchema),\n\t\tbrowser: Type.Optional(PluginBrowserManifestSchema),\n\t\tcommands: Type.Optional(PluginCommandNamesSchema),\n\t\tdescription: Type.Optional(Type.String()),\n\t\tauthor: Type.Optional(Type.String()),\n\t\ticon: Type.Optional(NonWhitespaceStringSchema),\n\t\tguidingWords: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\t\tdefaultLocale: Type.Optional(\n\t\t\tType.String({ minLength: 2, maxLength: 16, pattern: \"^[a-zA-Z][a-zA-Z0-9-]{1,15}$\" }),\n\t\t),\n\t\tcontributionMode: Type.Optional(\n\t\t\tType.Object(\n\t\t\t\t{\n\t\t\t\t\thardIsolation: Type.Optional(Type.Boolean()),\n\t\t\t\t},\n\t\t\t\t{ additionalProperties: true },\n\t\t\t),\n\t\t),\n\t\tagent_mode: OptionalAgentModesSchema,\n\t},\n\t{\n\t\t$id: \"PluginManifest\",\n\t\tadditionalProperties: true,\n\t\tdescription: \"Vetta desktop plugin manifest (plugin.json).\",\n\t},\n);\n\nexport type PluginMcpServerConfig = Static<typeof PluginMcpServerConfigSchema>;\nexport type PluginAgentManifest = Static<typeof PluginAgentManifestSchema>;\nexport type PluginAgentProfileManifest = Static<typeof PluginAgentProfileManifestSchema>;\nexport type PluginAgentTeamManifest = Static<typeof PluginAgentTeamManifestSchema>;\nexport type PluginAgentTeamMemberManifest = Static<typeof PluginAgentTeamMemberManifestSchema>;\nexport type PluginSkillPresentation = Static<typeof PluginSkillPresentationSchema>;\nexport type PluginSkillPresentationRule = Static<typeof PluginSkillPresentationRuleSchema>;\nexport type PluginCliProviderManifest = Static<typeof PluginCliProviderManifestSchema>;\nexport type PluginServiceArtifact = Static<typeof PluginServiceArtifactSchema>;\nexport type PluginServicePlatform = Static<typeof PluginServicePlatformSchema>;\nexport type PluginServiceProviderManifest = Static<typeof PluginServiceProviderManifestSchema>;\nexport type PluginServiceRuntimeKind = \"managed-binary\" | \"host-node\";\nexport type PluginProvidersManifest = Static<typeof PluginProvidersManifestSchema>;\nexport type PluginNetworkManifest = Static<typeof PluginNetworkManifestSchema>;\nexport type PluginBrowserManifest = Static<typeof PluginBrowserManifestSchema>;\nexport type PluginManifestInput = Static<typeof PluginManifestSchema>;\nexport type PluginManifest = PluginManifestInput;\n"]}
@@ -1,6 +1,6 @@
1
1
  import { type PluginManifest, type PluginMcpServerConfig } from "./manifest-schema.js";
2
- export { PluginAgentManifestSchema, PluginAgentProfileManifestSchema, PluginAgentTeamManifestSchema, PluginAgentTeamMemberManifestSchema, PluginBrowserManifestSchema, PluginCommandNameSchema, PluginCommandNamesSchema, PluginCliProviderManifestSchema, PluginServiceArtifactSchema, PluginServicePlatformSchema, PluginServiceProviderManifestSchema, PluginIdSchema, PluginManifestSchema, PluginMcpHttpServerConfigSchema, PluginMcpServerConfigSchema, PluginMcpStdioServerConfigSchema, PluginMcpServiceServerConfigSchema, PluginSkillPresentationRuleSchema, PluginSkillPresentationSchema, PluginModuleFederationManifestSchema, PluginNetworkManifestSchema, PluginProvidersManifestSchema, PluginPermissionSchema, PluginVersionSchema, } from "./manifest-schema.js";
3
- export type { PluginAgentManifest, PluginAgentProfileManifest, PluginAgentTeamManifest, PluginAgentTeamMemberManifest, PluginBrowserManifest, PluginCliProviderManifest, PluginServiceArtifact, PluginServicePlatform, PluginServiceProviderManifest, PluginServiceRuntimeKind, PluginManifest, PluginManifestInput, PluginMcpServerConfig, PluginSkillPresentation, PluginSkillPresentationRule, PluginNetworkManifest, } from "./manifest-schema.js";
2
+ export { PluginAgentManifestSchema, PluginAgentProfileManifestSchema, PluginAgentTeamManifestSchema, PluginAgentTeamMemberManifestSchema, PluginAgentRoleSchema, BUILTIN_PLUGIN_AGENT_ROLES, PluginBrowserManifestSchema, PluginCommandNameSchema, PluginCommandNamesSchema, PluginCliProviderManifestSchema, PluginServiceArtifactSchema, PluginServicePlatformSchema, PluginServiceProviderManifestSchema, PluginIdSchema, PluginManifestSchema, PluginMcpHttpServerConfigSchema, PluginMcpServerConfigSchema, PluginMcpStdioServerConfigSchema, PluginMcpServiceServerConfigSchema, PluginSkillPresentationRuleSchema, PluginSkillPresentationSchema, PluginModuleFederationManifestSchema, PluginNetworkManifestSchema, PluginProvidersManifestSchema, PluginPermissionSchema, PluginVersionSchema, } from "./manifest-schema.js";
3
+ export type { PluginAgentManifest, PluginAgentProfileManifest, PluginAgentTeamManifest, PluginAgentTeamMemberManifest, BuiltinPluginAgentRole, PluginBrowserManifest, PluginCliProviderManifest, PluginServiceArtifact, PluginServicePlatform, PluginServiceProviderManifest, PluginServiceRuntimeKind, PluginManifest, PluginManifestInput, PluginMcpServerConfig, PluginSkillPresentation, PluginSkillPresentationRule, PluginNetworkManifest, } from "./manifest-schema.js";
4
4
  export { PLUGIN_PERMISSIONS } from "./permissions.js";
5
5
  export type { PluginPermission } from "./permissions.js";
6
6
  export interface PluginManifestResourceReference {
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAGA,OAAO,EAoBN,KAAK,cAAc,EAEnB,KAAK,qBAAqB,EAI1B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACN,yBAAyB,EACzB,gCAAgC,EAChC,6BAA6B,EAC7B,mCAAmC,EACnC,2BAA2B,EAC3B,uBAAuB,EACvB,wBAAwB,EACxB,+BAA+B,EAC/B,2BAA2B,EAC3B,2BAA2B,EAC3B,mCAAmC,EACnC,cAAc,EACd,oBAAoB,EACpB,+BAA+B,EAC/B,2BAA2B,EAC3B,gCAAgC,EAChC,kCAAkC,EAClC,iCAAiC,EACjC,6BAA6B,EAC7B,oCAAoC,EACpC,2BAA2B,EAC3B,6BAA6B,EAC7B,sBAAsB,EACtB,mBAAmB,GACnB,MAAM,sBAAsB,CA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,EAAE,cAAc,GACtB,+BAA+B,EAAE,CAsCnC;AAkBD,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAWjF","sourcesContent":["import { type Static, type TSchema } from \"@sinclair/typebox\";\nimport type { ValueError } from \"@sinclair/typebox/errors\";\nimport { Value } from \"@sinclair/typebox/value\";\nimport {\n\tPluginCommandNameSchema,\n\tPluginCommandNamesSchema,\n\tPluginCliProviderManifestSchema,\n\tPluginServiceProviderManifestSchema,\n\tPluginIdSchema,\n\tPluginManifestSchema,\n\tPluginMcpServerConfigSchema,\n\tPluginMcpServiceServerConfigSchema,\n\tPluginSkillPresentationRuleSchema,\n\tPluginSkillPresentationSchema,\n\tPluginVersionSchema,\n\ttype PluginAgentManifest,\n\ttype PluginAgentProfileManifest,\n\ttype PluginAgentTeamManifest,\n\ttype PluginAgentTeamMemberManifest,\n\ttype PluginBrowserManifest,\n\ttype PluginCliProviderManifest,\n\ttype PluginServiceProviderManifest,\n\ttype PluginServiceRuntimeKind,\n\ttype PluginManifest,\n\ttype PluginManifestInput,\n\ttype PluginMcpServerConfig,\n\ttype PluginSkillPresentation,\n\ttype PluginSkillPresentationRule,\n\ttype PluginNetworkManifest,\n} from \"./manifest-schema.js\";\nimport { PLUGIN_PERMISSIONS, type PluginPermission } from \"./permissions.js\";\n\nexport {\n\tPluginAgentManifestSchema,\n\tPluginAgentProfileManifestSchema,\n\tPluginAgentTeamManifestSchema,\n\tPluginAgentTeamMemberManifestSchema,\n\tPluginBrowserManifestSchema,\n\tPluginCommandNameSchema,\n\tPluginCommandNamesSchema,\n\tPluginCliProviderManifestSchema,\n\tPluginServiceArtifactSchema,\n\tPluginServicePlatformSchema,\n\tPluginServiceProviderManifestSchema,\n\tPluginIdSchema,\n\tPluginManifestSchema,\n\tPluginMcpHttpServerConfigSchema,\n\tPluginMcpServerConfigSchema,\n\tPluginMcpStdioServerConfigSchema,\n\tPluginMcpServiceServerConfigSchema,\n\tPluginSkillPresentationRuleSchema,\n\tPluginSkillPresentationSchema,\n\tPluginModuleFederationManifestSchema,\n\tPluginNetworkManifestSchema,\n\tPluginProvidersManifestSchema,\n\tPluginPermissionSchema,\n\tPluginVersionSchema,\n} from \"./manifest-schema.js\";\nexport type {\n\tPluginAgentManifest,\n\tPluginAgentProfileManifest,\n\tPluginAgentTeamManifest,\n\tPluginAgentTeamMemberManifest,\n\tPluginBrowserManifest,\n\tPluginCliProviderManifest,\n\tPluginServiceArtifact,\n\tPluginServicePlatform,\n\tPluginServiceProviderManifest,\n\tPluginServiceRuntimeKind,\n\tPluginManifest,\n\tPluginManifestInput,\n\tPluginMcpServerConfig,\n\tPluginSkillPresentation,\n\tPluginSkillPresentationRule,\n\tPluginNetworkManifest,\n} from \"./manifest-schema.js\";\nexport { PLUGIN_PERMISSIONS } from \"./permissions.js\";\nexport type { PluginPermission } from \"./permissions.js\";\n\nexport interface PluginManifestResourceReference {\n\tfield: string;\n\tpath: string;\n\tkind: \"file\" | \"file-or-directory\";\n}\n\nfunction schemaErrorPath(path: string): string {\n\tif (!path) return \"\";\n\treturn path\n\t\t.split(\"/\")\n\t\t.slice(1)\n\t\t.map((segment) => segment.replace(/~1/g, \"/\").replace(/~0/g, \"~\"))\n\t\t.map((segment) => {\n\t\t\tif (segment === \"\") return '[\"\"]';\n\t\t\treturn /^\\d+$/.test(segment) ? `[${segment}]` : `.${segment}`;\n\t\t})\n\t\t.join(\"\");\n}\n\nfunction mostSpecificSchemaError(issue: ValueError): ValueError {\n\tconst nested = issue.errors.flatMap((iterator) =>\n\t\t[...iterator].map((child) => mostSpecificSchemaError(child)),\n\t);\n\tconst deeper = nested.filter((child) => child.path.length > issue.path.length);\n\tif (deeper.length === 0) return issue;\n\treturn deeper.reduce((best, child) => (child.path.length > best.path.length ? child : best));\n}\n\nfunction assertSchema<Schema extends TSchema>(\n\tschema: Schema,\n\tvalue: unknown,\n\tfieldName: string,\n): asserts value is Static<Schema> {\n\tif (Value.Check(schema, value)) return;\n\tconst firstIssue = Value.Errors(schema, value).First();\n\tconst issue = firstIssue ? mostSpecificSchemaError(firstIssue) : undefined;\n\tconst location = `${fieldName}${schemaErrorPath(issue?.path ?? \"\")}`;\n\tthrow new Error(`Invalid plugin ${location}: ${issue?.message ?? \"schema validation failed\"}`);\n}\n\nfunction trimString(value: string): string {\n\treturn value.trim();\n}\n\nfunction normalizeStringArray(values: string[] | undefined): string[] {\n\treturn (values ?? []).map(trimString);\n}\n\nfunction normalizeOptionalAgentModes(value: string | string[] | undefined): string | string[] | undefined {\n\tif (value === undefined) return undefined;\n\treturn Array.isArray(value) ? normalizeStringArray(value) : trimString(value);\n}\n\nfunction normalizePermissions(permissions: PluginPermission[] | undefined): PluginPermission[] {\n\treturn Array.from(new Set(permissions ?? []));\n}\n\nfunction normalizeAllowedHost(value: string, fieldName: \"network\" | \"browser\"): string {\n\tconst raw = trimString(value).toLowerCase();\n\tif (raw === \"*\") return raw;\n\tconst wildcard = raw.startsWith(\"*.\");\n\tconst candidate = wildcard ? raw.slice(2) : raw;\n\tif (!candidate || candidate.includes(\"*\") || /[\\\\/?#@]/.test(candidate)) {\n\t\tthrow new Error(`Invalid plugin ${fieldName}.allowedHosts entry: ${value}`);\n\t}\n\tconst unwrapped = candidate.startsWith(\"[\") && candidate.endsWith(\"]\") ? candidate.slice(1, -1) : candidate;\n\tif (wildcard && unwrapped.includes(\":\")) {\n\t\tthrow new Error(`Invalid plugin ${fieldName}.allowedHosts entry: ${value}`);\n\t}\n\ttry {\n\t\tconst parsed = new URL(`http://${unwrapped.includes(\":\") ? `[${unwrapped}]` : unwrapped}`);\n\t\tconst hostname = parsed.hostname.replace(/^\\[|\\]$/g, \"\").replace(/\\.$/, \"\").toLowerCase();\n\t\tif (!hostname || parsed.port || parsed.username || parsed.password) throw new Error(\"invalid host\");\n\t\treturn wildcard ? `*.${hostname}` : hostname;\n\t} catch {\n\t\tthrow new Error(`Invalid plugin ${fieldName}.allowedHosts entry: ${value}`);\n\t}\n}\n\nfunction normalizeNetworkManifest(network: PluginNetworkManifest | undefined): PluginNetworkManifest | undefined {\n\tif (!network) return undefined;\n\treturn { allowedHosts: Array.from(new Set(network.allowedHosts.map((host) => normalizeAllowedHost(host, \"network\")))) };\n}\n\nfunction normalizeBrowserManifest(browser: PluginBrowserManifest | undefined): PluginBrowserManifest | undefined {\n\tif (!browser) return undefined;\n\treturn { allowedHosts: Array.from(new Set(browser.allowedHosts.map((host) => normalizeAllowedHost(host, \"browser\")))) };\n}\n\nfunction normalizeModuleFederation(\n\tmoduleFederation: PluginManifestInput[\"moduleFederation\"],\n): PluginManifest[\"moduleFederation\"] {\n\treturn {\n\t\tremoteName: trimString(moduleFederation.remoteName),\n\t\texpose: trimString(moduleFederation.expose),\n\t};\n}\n\nfunction normalizeToolPolicy(\n\ttoolPolicy: PluginAgentManifest[\"toolPolicy\"],\n): PluginAgentManifest[\"toolPolicy\"] {\n\tif (!toolPolicy) return undefined;\n\treturn {\n\t\tallow: normalizeStringArray(toolPolicy.allow),\n\t\tdeny: normalizeStringArray(toolPolicy.deny),\n\t};\n}\n\nfunction normalizeMcpServers(\n\tmcpServers: PluginAgentManifest[\"mcpServers\"],\n): PluginAgentManifest[\"mcpServers\"] {\n\tif (mcpServers === undefined) return undefined;\n\tif (typeof mcpServers === \"string\") {\n\t\treturn validatePluginRelativePath(trimString(mcpServers), \"agent.mcpServers\");\n\t}\n\tconst result: Record<string, PluginMcpServerConfig> = {};\n\tfor (const [name, config] of Object.entries(mcpServers)) {\n\t\tresult[trimString(name)] = normalizePluginMcpServerConfig(config);\n\t}\n\treturn result;\n}\n\nfunction normalizeAgentManifest(agent: PluginAgentManifest | undefined): PluginAgentManifest | undefined {\n\tif (!agent) return undefined;\n\treturn {\n\t\tsystemPrompt: agent.systemPrompt\n\t\t\t? {\n\t\t\t\t\tpromptPaths: normalizeStringArray(agent.systemPrompt.promptPaths).map((path) =>\n\t\t\t\t\t\tvalidatePluginRelativePath(path, \"agent.systemPrompt.promptPaths\"),\n\t\t\t\t\t),\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tskillPaths: normalizeStringArray(agent.skillPaths).map((path) =>\n\t\t\tvalidatePluginRelativePath(path, \"agent.skillPaths\"),\n\t\t),\n\t\tskillPresentation: normalizeSkillPresentation(agent.skillPresentation),\n\t\tmcpServers: normalizeMcpServers(agent.mcpServers),\n\t\ttoolPolicy: normalizeToolPolicy(agent.toolPolicy),\n\t\tagents: agent.agents?.map((profile) => ({\n\t\t\t...profile,\n\t\t\t// 路径都要过越界校验:manifest 里写 `../` 不该能读到插件目录之外。\n\t\t\tavatar: profile.avatar ? validatePluginRelativePath(profile.avatar, \"agent.agents.avatar\") : undefined,\n\t\t\tsystemPromptPath: profile.systemPromptPath\n\t\t\t\t? validatePluginRelativePath(profile.systemPromptPath, \"agent.agents.systemPromptPath\")\n\t\t\t\t: undefined,\n\t\t})),\n\t\tteams: agent.teams?.map((team) => ({\n\t\t\t...team,\n\t\t\tworkflowPath: team.workflowPath\n\t\t\t\t? validatePluginRelativePath(team.workflowPath, \"agent.teams.workflowPath\")\n\t\t\t\t: undefined,\n\t\t})),\n\t};\n}\n\nfunction normalizeSkillPresentation(\n\tpresentation: PluginSkillPresentation | undefined,\n): PluginSkillPresentation | undefined {\n\tif (!presentation) return undefined;\n\tconst normalizeRule = (rule: PluginSkillPresentationRule): PluginSkillPresentationRule => ({\n\t\tdefaultVisibility: rule.defaultVisibility,\n\t\tsurfaces: rule.surfaces ? { ...rule.surfaces } : undefined,\n\t\tdisplayName: rule.displayName?.trim(),\n\t\tdisplayDescription: rule.displayDescription?.trim(),\n\t});\n\treturn {\n\t\tdefaultVisibility: presentation.defaultVisibility,\n\t\tsurfaces: presentation.surfaces ? { ...presentation.surfaces } : undefined,\n\t\tskills: presentation.skills\n\t\t\t? Object.fromEntries(\n\t\t\t\t\tObject.entries(presentation.skills).map(([name, rule]) => [name.trim(), normalizeRule(rule)]),\n\t\t\t\t)\n\t\t\t: undefined,\n\t};\n}\n\nfunction normalizeCliProviders(providers: PluginCliProviderManifest[] | undefined): PluginCliProviderManifest[] | undefined {\n\tif (!providers || providers.length === 0) return undefined;\n\tconst ids = new Set<string>();\n\treturn providers.map((provider) => {\n\t\tif (ids.has(provider.id)) throw new Error(`Duplicate CLI provider id: ${provider.id}`);\n\t\tids.add(provider.id);\n\t\treturn {\n\t\t\tid: provider.id,\n\t\t\tcommand: provider.command,\n\t\t\tprobe: provider.probe\n\t\t\t\t? { args: provider.probe.args ? [...provider.probe.args] : undefined, timeoutMs: provider.probe.timeoutMs }\n\t\t\t\t: undefined,\n\t\t\tinstall: {\n\t\t\t\tcommand: provider.install.command,\n\t\t\t\targs: provider.install.args ? [...provider.install.args] : undefined,\n\t\t\t\ttimeoutMs: provider.install.timeoutMs,\n\t\t\t},\n\t\t};\n\t});\n}\n\nfunction normalizeServiceProviders(\n\tproviders: PluginServiceProviderManifest[] | undefined,\n): PluginServiceProviderManifest[] | undefined {\n\tif (!providers || providers.length === 0) return undefined;\n\tconst ids = new Set<string>();\n\treturn providers.map((provider) => {\n\t\tif (ids.has(provider.id)) throw new Error(`Duplicate service provider id: ${provider.id}`);\n\t\tids.add(provider.id);\n\t\tconst runtimeKind: PluginServiceRuntimeKind = provider.runtime.kind ?? \"managed-binary\";\n\t\tconst entry = provider.runtime.entry\n\t\t\t? validatePluginRelativePath(provider.runtime.entry, `providers.services.${provider.id}.runtime.entry`)\n\t\t\t: undefined;\n\t\tif (runtimeKind === \"host-node\" && !entry) {\n\t\t\tthrow new Error(`Host-node service must declare runtime.entry: ${provider.id}`);\n\t\t}\n\t\tconst platforms: PluginServiceProviderManifest[\"runtime\"][\"platforms\"] = {};\n\t\tfor (const [platformTag, platform] of Object.entries(provider.runtime.platforms)) {\n\t\t\tconst destinations = new Set<string>();\n\t\t\tplatforms[platformTag] = {\n\t\t\t\texecutable: validatePluginRelativePath(platform.executable, `providers.services.${provider.id}.executable`),\n\t\t\t\tartifacts: platform.artifacts.map((artifact) => {\n\t\t\t\t\tconst destination = validatePluginRelativePath(\n\t\t\t\t\t\tartifact.destination,\n\t\t\t\t\t\t`providers.services.${provider.id}.artifacts.destination`,\n\t\t\t\t\t);\n\t\t\t\t\tif (destinations.has(destination)) {\n\t\t\t\t\t\tthrow new Error(`Duplicate service artifact destination: ${provider.id}/${platformTag}/${destination}`);\n\t\t\t\t\t}\n\t\t\t\t\tdestinations.add(destination);\n\t\t\t\t\treturn { ...artifact, destination };\n\t\t\t\t}),\n\t\t\t};\n\t\t}\n\t\tif (Object.keys(platforms).length === 0) {\n\t\t\tthrow new Error(`Service provider must declare at least one platform: ${provider.id}`);\n\t\t}\n\t\tconst credentialIds = new Set<string>();\n\t\tconst credentials = provider.credentials?.map((credential) => {\n\t\t\tif (credentialIds.has(credential.id)) throw new Error(`Duplicate service credential id: ${provider.id}/${credential.id}`);\n\t\t\tcredentialIds.add(credential.id);\n\t\t\treturn { id: credential.id, bytes: credential.bytes };\n\t\t});\n\t\tif (provider.health.credentialId && !credentialIds.has(provider.health.credentialId)) {\n\t\t\tthrow new Error(`Unknown service health credential: ${provider.id}/${provider.health.credentialId}`);\n\t\t}\n\t\tconst templateDestinations = new Set<string>();\n\t\tconst templates = provider.templates?.map((template) => {\n\t\t\tconst source = validatePluginRelativePath(template.source, `providers.services.${provider.id}.templates.source`);\n\t\t\tconst destination = validatePluginRelativePath(\n\t\t\t\ttemplate.destination,\n\t\t\t\t`providers.services.${provider.id}.templates.destination`,\n\t\t\t);\n\t\t\tif (templateDestinations.has(destination)) throw new Error(`Duplicate service template destination: ${provider.id}/${destination}`);\n\t\t\ttemplateDestinations.add(destination);\n\t\t\treturn { source, destination, mode: template.mode };\n\t\t});\n\t\tconst normalizedRuntime: PluginServiceProviderManifest[\"runtime\"] = {\n\t\t\tversion: provider.runtime.version,\n\t\t\tplatforms,\n\t\t\t...(runtimeKind === \"host-node\" ? { kind: runtimeKind, entry } : provider.runtime.kind ? { kind: runtimeKind } : {}),\n\t\t};\n\t\treturn {\n\t\t\tid: provider.id,\n\t\t\truntime: normalizedRuntime,\n\t\t\tcredentials,\n\t\t\ttemplates,\n\t\t\tprocess: {\n\t\t\t\targs: provider.process.args ? [...provider.process.args] : undefined,\n\t\t\t\tenv: provider.process.env ? { ...provider.process.env } : undefined,\n\t\t\t},\n\t\t\thealth: { ...provider.health },\n\t\t};\n\t});\n}\n\nfunction normalizePluginMcpServerConfig(config: PluginMcpServerConfig): PluginMcpServerConfig {\n\tconst common = {\n\t\tdisabled: config.disabled,\n\t\tautoApprove: config.autoApprove?.map(trimString),\n\t\tstartupTimeout: config.startupTimeout,\n\t\tdebug: config.debug,\n\t\tdisplayName: config.displayName,\n\t\tdescription: config.description,\n\t\tagent_mode: normalizeOptionalAgentModes(config.agent_mode),\n\t};\n\tif (config.type === \"service\") {\n\t\treturn {\n\t\t\ttype: \"service\",\n\t\t\tserviceId: trimString(config.serviceId),\n\t\t\tpath: trimString(config.path),\n\t\t\t...common,\n\t\t};\n\t}\n\tif (config.type === \"http\") {\n\t\treturn {\n\t\t\ttype: \"http\",\n\t\t\turl: trimString(config.url),\n\t\t\theaders: config.headers ? { ...config.headers } : undefined,\n\t\t\toauthClientId: config.oauthClientId,\n\t\t\toauthDeviceFlow: config.oauthDeviceFlow,\n\t\t\toauthScopes: config.oauthScopes,\n\t\t\t...common,\n\t\t};\n\t}\n\treturn {\n\t\ttype: config.type,\n\t\tcommand: trimString(config.command),\n\t\targs: config.args ? [...config.args] : undefined,\n\t\tenv: config.env ? { ...config.env } : undefined,\n\t\tcwd: config.cwd,\n\t\t...common,\n\t};\n}\n\nexport function validatePluginId(id: string): void {\n\tif (!Value.Check(PluginIdSchema, id)) {\n\t\tthrow new Error(\"Plugin id must be 1-64 chars: lowercase letters, numbers, dot, underscore, or dash\");\n\t}\n}\n\nexport function validatePluginVersion(version: string): void {\n\tif (!Value.Check(PluginVersionSchema, version)) {\n\t\tthrow new Error(\"Plugin version must be 1-64 chars and cannot contain path separators\");\n\t}\n}\n\nexport function validatePluginRelativePath(value: string, fieldName: string): string {\n\tif (value.startsWith(\"/\") || /^[a-zA-Z]:/.test(value)) {\n\t\tthrow new Error(`Invalid plugin ${fieldName}`);\n\t}\n\tconst parts: string[] = [];\n\tfor (const part of value.replace(/\\\\/g, \"/\").split(\"/\")) {\n\t\tif (part === \"\" || part === \".\") continue;\n\t\tif (part === \"..\") {\n\t\t\tif (parts.length === 0) throw new Error(`Invalid plugin ${fieldName}`);\n\t\t\tparts.pop();\n\t\t\tcontinue;\n\t\t}\n\t\tparts.push(part);\n\t}\n\tconst normalized = parts.join(\"/\");\n\tif (!normalized) throw new Error(`Invalid plugin ${fieldName}`);\n\treturn normalized;\n}\n\nexport function parsePluginCommandNames(value: unknown): string[] {\n\tif (value === undefined) return [];\n\tassertSchema(PluginCommandNamesSchema, value, \"commands\");\n\treturn Array.from(new Set(value));\n}\n\n/** @deprecated agent_mode 已无任何运行时语义(ADR-0071),保留仅为容忍既有 manifest。 */\nexport function normalizePluginAgentModes(value: unknown): string[] | undefined {\n\tif (value === undefined || value === null) return undefined;\n\tconst values = Array.isArray(value) ? value : [value];\n\tconst modes = values.map((item) => String(item).trim()).filter(Boolean);\n\treturn modes.length > 0 ? modes : undefined;\n}\n\nexport function parsePluginMcpServerConfig(name: string, raw: unknown): PluginMcpServerConfig {\n\tassertSchema(PluginMcpServerConfigSchema, raw, `MCP server '${name}'`);\n\treturn normalizePluginMcpServerConfig(raw);\n}\n\nexport function isPluginPassthroughIconRef(icon: string): boolean {\n\treturn (\n\t\ticon.startsWith(\"http://\") ||\n\t\ticon.startsWith(\"https://\") ||\n\t\t/^[a-z0-9]+(?:-[a-z0-9]+)*:[a-z0-9]+(?:-[a-z0-9]+)*$/.test(icon)\n\t);\n}\n\nexport function isPluginPackagedIconPath(icon: string): boolean {\n\treturn !isPluginPassthroughIconRef(icon);\n}\n\nexport function parsePluginManifest(raw: unknown): PluginManifest {\n\tif (typeof raw === \"object\" && raw !== null && \"runtime\" in raw) {\n\t\tthrow new Error(\n\t\t\t'Invalid plugin manifest.runtime: runtime selection is unsupported; plugins use Module Federation.',\n\t\t);\n\t}\n\tassertSchema(PluginManifestSchema, raw, \"manifest\");\n\tconst commands = parsePluginCommandNames(raw.commands);\n\tconst icon = raw.icon === undefined ? undefined : trimString(raw.icon);\n\tconst permissions = normalizePermissions(raw.permissions);\n\tconst network = normalizeNetworkManifest(raw.network);\n\tconst browser = normalizeBrowserManifest(raw.browser);\n\tif (permissions.includes(\"network.fetch\") && !network) {\n\t\tthrow new Error(\"Plugin network.allowedHosts is required with network.fetch\");\n\t}\n\tconst browserPermissions = permissions.filter((permission) => permission.startsWith(\"browser.\"));\n\tif (browserPermissions.length > 0 && !browser) {\n\t\tthrow new Error(\"Plugin browser.allowedHosts is required with browser permissions\");\n\t}\n\tif (permissions.includes(\"browser.interact\") && !permissions.includes(\"browser.read\")) {\n\t\tthrow new Error(\"Plugin browser.interact requires browser.read\");\n\t}\n\tconst normalizedServices = raw.providers ? normalizeServiceProviders(raw.providers.services) : undefined;\n\tfor (const [name, server] of Object.entries(raw.agent?.mcpServers && typeof raw.agent.mcpServers !== \"string\" ? raw.agent.mcpServers : {})) {\n\t\tif (server.type === \"service\" && !normalizedServices?.some((service) => service.id === server.serviceId)) {\n\t\t\tthrow new Error(`Plugin MCP server '${name}' references unknown service '${server.serviceId}'`);\n\t\t}\n\t}\n\treturn {\n\t\tid: raw.id,\n\t\tname: trimString(raw.name),\n\t\tversion: raw.version,\n\t\tpluginApiVersion: trimString(raw.pluginApiVersion),\n\t\tentry: validatePluginRelativePath(trimString(raw.entry), \"entry\"),\n\t\tmoduleFederation: normalizeModuleFederation(raw.moduleFederation),\n\t\tagent: normalizeAgentManifest(raw.agent),\n\t\tproviders: raw.providers\n\t\t\t? {\n\t\t\t\t\tcli: normalizeCliProviders(raw.providers.cli),\n\t\t\t\t\tservices: normalizedServices,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tstyles: normalizeStringArray(raw.styles).map((style) => validatePluginRelativePath(style, \"styles\")),\n\t\tpermissions,\n\t\tnetwork,\n\t\tbrowser,\n\t\tcommands: commands.length > 0 ? commands : undefined,\n\t\tdescription: raw.description,\n\t\tauthor: raw.author,\n\t\ticon:\n\t\t\ticon === undefined || isPluginPassthroughIconRef(icon)\n\t\t\t\t? icon\n\t\t\t\t: validatePluginRelativePath(icon, \"icon\"),\n\t\tguidingWords: raw.guidingWords?.map(trimString),\n\t\tdefaultLocale: raw.defaultLocale ?? \"zh\",\n\t\tcontributionMode: raw.contributionMode\n\t\t\t? { hardIsolation: raw.contributionMode.hardIsolation === true }\n\t\t\t: undefined,\n\t\tagent_mode: normalizePluginAgentModes(raw.agent_mode),\n\t};\n}\n\nexport function listPluginManifestResources(\n\tmanifest: PluginManifest,\n): PluginManifestResourceReference[] {\n\tconst resources: PluginManifestResourceReference[] = [\n\t\t{ field: \"entry\", path: manifest.entry, kind: \"file\" },\n\t];\n\tfor (const stylePath of manifest.styles ?? []) {\n\t\tresources.push({ field: \"styles\", path: stylePath, kind: \"file\" });\n\t}\n\tif (manifest.icon && isPluginPackagedIconPath(manifest.icon)) {\n\t\tresources.push({ field: \"icon\", path: manifest.icon, kind: \"file\" });\n\t}\n\tfor (const promptPath of manifest.agent?.systemPrompt?.promptPaths ?? []) {\n\t\tresources.push({ field: \"agent.systemPrompt.promptPaths\", path: promptPath, kind: \"file-or-directory\" });\n\t}\n\tfor (const skillPath of manifest.agent?.skillPaths ?? []) {\n\t\tresources.push({ field: \"agent.skillPaths\", path: skillPath, kind: \"file-or-directory\" });\n\t}\n\tfor (const agent of manifest.agent?.agents ?? []) {\n\t\t// 人设与头像是插件包里的真实文件:不登记就不会被打进包,装到用户机器上时这个\n\t\t// 智能体会因为「提示词读不出来」被整个跳过。\n\t\tif (agent.avatar) resources.push({ field: \"agent.agents.avatar\", path: agent.avatar, kind: \"file\" });\n\t\tif (agent.systemPromptPath) {\n\t\t\tresources.push({ field: \"agent.agents.systemPromptPath\", path: agent.systemPromptPath, kind: \"file\" });\n\t\t}\n\t}\n\tfor (const team of manifest.agent?.teams ?? []) {\n\t\tif (team.workflowPath) {\n\t\t\tresources.push({ field: \"agent.teams.workflowPath\", path: team.workflowPath, kind: \"file\" });\n\t\t}\n\t}\n\tif (typeof manifest.agent?.mcpServers === \"string\") {\n\t\tresources.push({ field: \"agent.mcpServers\", path: manifest.agent.mcpServers, kind: \"file\" });\n\t}\n\tfor (const service of manifest.providers?.services ?? []) {\n\t\tfor (const template of service.templates ?? []) {\n\t\t\tresources.push({ field: `providers.services.${service.id}.templates.source`, path: template.source, kind: \"file\" });\n\t\t}\n\t}\n\treturn resources;\n}\n\nfunction parseApiVersion(value: string): readonly [number, number, number] | undefined {\n\tconst match = /^(\\d+)\\.(\\d+)\\.(\\d+)$/.exec(value);\n\tif (!match) return undefined;\n\treturn [Number(match[1]), Number(match[2]), Number(match[3])];\n}\n\nfunction compareApiVersions(\n\tleft: readonly [number, number, number],\n\tright: readonly [number, number, number],\n): number {\n\tfor (let index = 0; index < left.length; index += 1) {\n\t\tif (left[index] !== right[index]) return left[index] - right[index];\n\t}\n\treturn 0;\n}\n\nexport function isPluginApiCompatible(hostVersion: string, range: string): boolean {\n\tconst host = parseApiVersion(hostVersion);\n\tif (!host) return false;\n\tconst normalized = range.trim();\n\tconst exact = parseApiVersion(normalized);\n\tif (exact) return exact[0] === host[0] && compareApiVersions(host, exact) >= 0;\n\tconst caret = normalized.startsWith(\"^\") ? parseApiVersion(normalized.slice(1)) : undefined;\n\tif (caret) return caret[0] === host[0] && compareApiVersions(host, caret) >= 0;\n\tif (normalized === `^${host[0]}` || normalized === `${host[0]}.x`) return true;\n\tconst minimum = normalized.startsWith(\">=\") ? parseApiVersion(normalized.slice(2)) : undefined;\n\treturn minimum !== undefined && compareApiVersions(host, minimum) >= 0;\n}\n"]}
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAGA,OAAO,EAoBN,KAAK,cAA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wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAIhE;AAED,8GAAoE;AACpE,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG,SAAS,CAK9E;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,qBAAqB,CAG5F;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMhE;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,cAAc,CA4DhE;AAED,wBAAgB,2BAA2B,CAC1C,QAAQ,EAAE,cAAc,GACtB,+BAA+B,EAAE,CAsCnC;AAkBD,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAWjF","sourcesContent":["import { type Static, type TSchema } from \"@sinclair/typebox\";\nimport type { ValueError } from \"@sinclair/typebox/errors\";\nimport { Value } from \"@sinclair/typebox/value\";\nimport {\n\tPluginCommandNameSchema,\n\tPluginCommandNamesSchema,\n\tPluginCliProviderManifestSchema,\n\tPluginServiceProviderManifestSchema,\n\tPluginIdSchema,\n\tPluginManifestSchema,\n\tPluginMcpServerConfigSchema,\n\tPluginMcpServiceServerConfigSchema,\n\tPluginSkillPresentationRuleSchema,\n\tPluginSkillPresentationSchema,\n\tPluginVersionSchema,\n\ttype PluginAgentManifest,\n\ttype PluginAgentProfileManifest,\n\ttype PluginAgentTeamManifest,\n\ttype PluginAgentTeamMemberManifest,\n\ttype PluginBrowserManifest,\n\ttype PluginCliProviderManifest,\n\ttype PluginServiceProviderManifest,\n\ttype PluginServiceRuntimeKind,\n\ttype PluginManifest,\n\ttype PluginManifestInput,\n\ttype PluginMcpServerConfig,\n\ttype PluginSkillPresentation,\n\ttype PluginSkillPresentationRule,\n\ttype PluginNetworkManifest,\n} from \"./manifest-schema.js\";\nimport { PLUGIN_PERMISSIONS, type PluginPermission } from \"./permissions.js\";\n\nexport {\n\tPluginAgentManifestSchema,\n\tPluginAgentProfileManifestSchema,\n\tPluginAgentTeamManifestSchema,\n\tPluginAgentTeamMemberManifestSchema,\n\tPluginAgentRoleSchema,\n\tBUILTIN_PLUGIN_AGENT_ROLES,\n\tPluginBrowserManifestSchema,\n\tPluginCommandNameSchema,\n\tPluginCommandNamesSchema,\n\tPluginCliProviderManifestSchema,\n\tPluginServiceArtifactSchema,\n\tPluginServicePlatformSchema,\n\tPluginServiceProviderManifestSchema,\n\tPluginIdSchema,\n\tPluginManifestSchema,\n\tPluginMcpHttpServerConfigSchema,\n\tPluginMcpServerConfigSchema,\n\tPluginMcpStdioServerConfigSchema,\n\tPluginMcpServiceServerConfigSchema,\n\tPluginSkillPresentationRuleSchema,\n\tPluginSkillPresentationSchema,\n\tPluginModuleFederationManifestSchema,\n\tPluginNetworkManifestSchema,\n\tPluginProvidersManifestSchema,\n\tPluginPermissionSchema,\n\tPluginVersionSchema,\n} from \"./manifest-schema.js\";\nexport type {\n\tPluginAgentManifest,\n\tPluginAgentProfileManifest,\n\tPluginAgentTeamManifest,\n\tPluginAgentTeamMemberManifest,\n\tBuiltinPluginAgentRole,\n\tPluginBrowserManifest,\n\tPluginCliProviderManifest,\n\tPluginServiceArtifact,\n\tPluginServicePlatform,\n\tPluginServiceProviderManifest,\n\tPluginServiceRuntimeKind,\n\tPluginManifest,\n\tPluginManifestInput,\n\tPluginMcpServerConfig,\n\tPluginSkillPresentation,\n\tPluginSkillPresentationRule,\n\tPluginNetworkManifest,\n} from \"./manifest-schema.js\";\nexport { PLUGIN_PERMISSIONS } from \"./permissions.js\";\nexport type { PluginPermission } from \"./permissions.js\";\n\nexport interface PluginManifestResourceReference {\n\tfield: string;\n\tpath: string;\n\tkind: \"file\" | \"file-or-directory\";\n}\n\nfunction schemaErrorPath(path: string): string {\n\tif (!path) return \"\";\n\treturn path\n\t\t.split(\"/\")\n\t\t.slice(1)\n\t\t.map((segment) => segment.replace(/~1/g, \"/\").replace(/~0/g, \"~\"))\n\t\t.map((segment) => {\n\t\t\tif (segment === \"\") return '[\"\"]';\n\t\t\treturn /^\\d+$/.test(segment) ? `[${segment}]` : `.${segment}`;\n\t\t})\n\t\t.join(\"\");\n}\n\nfunction mostSpecificSchemaError(issue: ValueError): ValueError {\n\tconst nested = issue.errors.flatMap((iterator) =>\n\t\t[...iterator].map((child) => mostSpecificSchemaError(child)),\n\t);\n\tconst deeper = nested.filter((child) => child.path.length > issue.path.length);\n\tif (deeper.length === 0) return issue;\n\treturn deeper.reduce((best, child) => (child.path.length > best.path.length ? child : best));\n}\n\nfunction assertSchema<Schema extends TSchema>(\n\tschema: Schema,\n\tvalue: unknown,\n\tfieldName: string,\n): asserts value is Static<Schema> {\n\tif (Value.Check(schema, value)) return;\n\tconst firstIssue = Value.Errors(schema, value).First();\n\tconst issue = firstIssue ? mostSpecificSchemaError(firstIssue) : undefined;\n\tconst location = `${fieldName}${schemaErrorPath(issue?.path ?? \"\")}`;\n\tthrow new Error(`Invalid plugin ${location}: ${issue?.message ?? \"schema validation failed\"}`);\n}\n\nfunction trimString(value: string): string {\n\treturn value.trim();\n}\n\nfunction normalizeStringArray(values: string[] | undefined): string[] {\n\treturn (values ?? []).map(trimString);\n}\n\nfunction normalizeOptionalAgentModes(value: string | string[] | undefined): string | string[] | undefined {\n\tif (value === undefined) return undefined;\n\treturn Array.isArray(value) ? normalizeStringArray(value) : trimString(value);\n}\n\nfunction normalizePermissions(permissions: PluginPermission[] | undefined): PluginPermission[] {\n\treturn Array.from(new Set(permissions ?? []));\n}\n\nfunction normalizeAllowedHost(value: string, fieldName: \"network\" | \"browser\"): string {\n\tconst raw = trimString(value).toLowerCase();\n\tif (raw === \"*\") return raw;\n\tconst wildcard = raw.startsWith(\"*.\");\n\tconst candidate = wildcard ? raw.slice(2) : raw;\n\tif (!candidate || candidate.includes(\"*\") || /[\\\\/?#@]/.test(candidate)) {\n\t\tthrow new Error(`Invalid plugin ${fieldName}.allowedHosts entry: ${value}`);\n\t}\n\tconst unwrapped = candidate.startsWith(\"[\") && candidate.endsWith(\"]\") ? candidate.slice(1, -1) : candidate;\n\tif (wildcard && unwrapped.includes(\":\")) {\n\t\tthrow new Error(`Invalid plugin ${fieldName}.allowedHosts entry: ${value}`);\n\t}\n\ttry {\n\t\tconst parsed = new URL(`http://${unwrapped.includes(\":\") ? `[${unwrapped}]` : unwrapped}`);\n\t\tconst hostname = parsed.hostname.replace(/^\\[|\\]$/g, \"\").replace(/\\.$/, \"\").toLowerCase();\n\t\tif (!hostname || parsed.port || parsed.username || parsed.password) throw new Error(\"invalid host\");\n\t\treturn wildcard ? `*.${hostname}` : hostname;\n\t} catch {\n\t\tthrow new Error(`Invalid plugin ${fieldName}.allowedHosts entry: ${value}`);\n\t}\n}\n\nfunction normalizeNetworkManifest(network: PluginNetworkManifest | undefined): PluginNetworkManifest | undefined {\n\tif (!network) return undefined;\n\treturn { allowedHosts: Array.from(new Set(network.allowedHosts.map((host) => normalizeAllowedHost(host, \"network\")))) };\n}\n\nfunction normalizeBrowserManifest(browser: PluginBrowserManifest | undefined): PluginBrowserManifest | undefined {\n\tif (!browser) return undefined;\n\treturn { allowedHosts: Array.from(new Set(browser.allowedHosts.map((host) => normalizeAllowedHost(host, \"browser\")))) };\n}\n\nfunction normalizeModuleFederation(\n\tmoduleFederation: PluginManifestInput[\"moduleFederation\"],\n): PluginManifest[\"moduleFederation\"] {\n\treturn {\n\t\tremoteName: trimString(moduleFederation.remoteName),\n\t\texpose: trimString(moduleFederation.expose),\n\t};\n}\n\nfunction normalizeToolPolicy(\n\ttoolPolicy: PluginAgentManifest[\"toolPolicy\"],\n): PluginAgentManifest[\"toolPolicy\"] {\n\tif (!toolPolicy) return undefined;\n\treturn {\n\t\tallow: normalizeStringArray(toolPolicy.allow),\n\t\tdeny: normalizeStringArray(toolPolicy.deny),\n\t};\n}\n\nfunction normalizeMcpServers(\n\tmcpServers: PluginAgentManifest[\"mcpServers\"],\n): PluginAgentManifest[\"mcpServers\"] {\n\tif (mcpServers === undefined) return undefined;\n\tif (typeof mcpServers === \"string\") {\n\t\treturn validatePluginRelativePath(trimString(mcpServers), \"agent.mcpServers\");\n\t}\n\tconst result: Record<string, PluginMcpServerConfig> = {};\n\tfor (const [name, config] of Object.entries(mcpServers)) {\n\t\tresult[trimString(name)] = normalizePluginMcpServerConfig(config);\n\t}\n\treturn result;\n}\n\nfunction normalizeAgentManifest(agent: PluginAgentManifest | undefined): PluginAgentManifest | undefined {\n\tif (!agent) return undefined;\n\treturn {\n\t\tsystemPrompt: agent.systemPrompt\n\t\t\t? {\n\t\t\t\t\tpromptPaths: normalizeStringArray(agent.systemPrompt.promptPaths).map((path) =>\n\t\t\t\t\t\tvalidatePluginRelativePath(path, \"agent.systemPrompt.promptPaths\"),\n\t\t\t\t\t),\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tskillPaths: normalizeStringArray(agent.skillPaths).map((path) =>\n\t\t\tvalidatePluginRelativePath(path, \"agent.skillPaths\"),\n\t\t),\n\t\tskillPresentation: normalizeSkillPresentation(agent.skillPresentation),\n\t\tmcpServers: normalizeMcpServers(agent.mcpServers),\n\t\ttoolPolicy: normalizeToolPolicy(agent.toolPolicy),\n\t\tagents: agent.agents?.map((profile) => ({\n\t\t\t...profile,\n\t\t\t// 路径都要过越界校验:manifest 里写 `../` 不该能读到插件目录之外。\n\t\t\tavatar: profile.avatar ? validatePluginRelativePath(profile.avatar, \"agent.agents.avatar\") : undefined,\n\t\t\tsystemPromptPath: profile.systemPromptPath\n\t\t\t\t? validatePluginRelativePath(profile.systemPromptPath, \"agent.agents.systemPromptPath\")\n\t\t\t\t: undefined,\n\t\t\troles: normalizeAgentRoles(profile.roles),\n\t\t})),\n\t\tteams: agent.teams?.map((team) => ({\n\t\t\t...team,\n\t\t\tworkflowPath: team.workflowPath\n\t\t\t\t? validatePluginRelativePath(team.workflowPath, \"agent.teams.workflowPath\")\n\t\t\t\t: undefined,\n\t\t\tmembers: team.members.map((member, index) => normalizeTeamMember(member, index, team.id)),\n\t\t})),\n\t};\n}\n\nfunction normalizeAgentRoles(roles: readonly string[] | undefined): string[] | undefined {\n\tif (!roles || roles.length === 0) return undefined;\n\treturn [...new Set(roles.map((role) => role.trim()))];\n}\n\n/** `<pluginId>/<agentId>` 的跨插件实体引用;本插件的引用不带斜杠。 */\nconst CROSS_PLUGIN_AGENT_REF = /^([a-z0-9][a-z0-9-]{0,63})\\/([a-z0-9][a-z0-9-]{0,63})$/;\nconst OWN_PLUGIN_AGENT_REF = /^[a-z0-9][a-z0-9-]{0,63}$/;\n\nfunction normalizeTeamMember(\n\tmember: PluginAgentTeamMemberManifest,\n\tindex: number,\n\tteamId: string,\n): PluginAgentTeamMemberManifest {\n\tconst where = `agent.teams[${teamId}].members[${index}]`;\n\tconst agent = member.agent?.trim();\n\tconst role = member.role?.trim();\n\tif ((agent ? 1 : 0) + (role ? 1 : 0) !== 1) {\n\t\tthrow new Error(`Invalid ${where}: write exactly one of \"agent\" or \"role\"`);\n\t}\n\tif (agent && !CROSS_PLUGIN_AGENT_REF.test(agent) && !OWN_PLUGIN_AGENT_REF.test(agent)) {\n\t\tthrow new Error(`Invalid ${where}.agent: expected \"<agentId>\" or \"<pluginId>/<agentId>\", got \"${agent}\"`);\n\t}\n\tif (index === 0 && (!agent || !OWN_PLUGIN_AGENT_REF.test(agent))) {\n\t\t// 队长是用户在团队会话里唯一的对话入口。允许它落在别的插件上,那个插件一卸载,这支\n\t\t// 团队就成了打不开的壳——比少一名队员严重得多,所以队长只能是本插件自己的智能体。\n\t\tthrow new Error(`Invalid ${where}: the team leader must be one of this plugin's own agents`);\n\t}\n\treturn {\n\t\t...member,\n\t\t...(agent ? { agent } : {}),\n\t\t...(role ? { role } : {}),\n\t};\n}\n\nfunction normalizeSkillPresentation(\n\tpresentation: PluginSkillPresentation | undefined,\n): PluginSkillPresentation | undefined {\n\tif (!presentation) return undefined;\n\tconst normalizeRule = (rule: PluginSkillPresentationRule): PluginSkillPresentationRule => ({\n\t\tdefaultVisibility: rule.defaultVisibility,\n\t\tsurfaces: rule.surfaces ? { ...rule.surfaces } : undefined,\n\t\tdisplayName: rule.displayName?.trim(),\n\t\tdisplayDescription: rule.displayDescription?.trim(),\n\t});\n\treturn {\n\t\tdefaultVisibility: presentation.defaultVisibility,\n\t\tsurfaces: presentation.surfaces ? { ...presentation.surfaces } : undefined,\n\t\tskills: presentation.skills\n\t\t\t? Object.fromEntries(\n\t\t\t\t\tObject.entries(presentation.skills).map(([name, rule]) => [name.trim(), normalizeRule(rule)]),\n\t\t\t\t)\n\t\t\t: undefined,\n\t};\n}\n\nfunction normalizeCliProviders(providers: PluginCliProviderManifest[] | undefined): PluginCliProviderManifest[] | undefined {\n\tif (!providers || providers.length === 0) return undefined;\n\tconst ids = new Set<string>();\n\treturn providers.map((provider) => {\n\t\tif (ids.has(provider.id)) throw new Error(`Duplicate CLI provider id: ${provider.id}`);\n\t\tids.add(provider.id);\n\t\treturn {\n\t\t\tid: provider.id,\n\t\t\tcommand: provider.command,\n\t\t\tprobe: provider.probe\n\t\t\t\t? { args: provider.probe.args ? [...provider.probe.args] : undefined, timeoutMs: provider.probe.timeoutMs }\n\t\t\t\t: undefined,\n\t\t\tinstall: {\n\t\t\t\tcommand: provider.install.command,\n\t\t\t\targs: provider.install.args ? [...provider.install.args] : undefined,\n\t\t\t\ttimeoutMs: provider.install.timeoutMs,\n\t\t\t},\n\t\t};\n\t});\n}\n\nfunction normalizeServiceProviders(\n\tproviders: PluginServiceProviderManifest[] | undefined,\n): PluginServiceProviderManifest[] | undefined {\n\tif (!providers || providers.length === 0) return undefined;\n\tconst ids = new Set<string>();\n\treturn providers.map((provider) => {\n\t\tif (ids.has(provider.id)) throw new Error(`Duplicate service provider id: ${provider.id}`);\n\t\tids.add(provider.id);\n\t\tconst runtimeKind: PluginServiceRuntimeKind = provider.runtime.kind ?? \"managed-binary\";\n\t\tconst entry = provider.runtime.entry\n\t\t\t? validatePluginRelativePath(provider.runtime.entry, `providers.services.${provider.id}.runtime.entry`)\n\t\t\t: undefined;\n\t\tif (runtimeKind === \"host-node\" && !entry) {\n\t\t\tthrow new Error(`Host-node service must declare runtime.entry: ${provider.id}`);\n\t\t}\n\t\tconst platforms: PluginServiceProviderManifest[\"runtime\"][\"platforms\"] = {};\n\t\tfor (const [platformTag, platform] of Object.entries(provider.runtime.platforms)) {\n\t\t\tconst destinations = new Set<string>();\n\t\t\tplatforms[platformTag] = {\n\t\t\t\texecutable: validatePluginRelativePath(platform.executable, `providers.services.${provider.id}.executable`),\n\t\t\t\tartifacts: platform.artifacts.map((artifact) => {\n\t\t\t\t\tconst destination = validatePluginRelativePath(\n\t\t\t\t\t\tartifact.destination,\n\t\t\t\t\t\t`providers.services.${provider.id}.artifacts.destination`,\n\t\t\t\t\t);\n\t\t\t\t\tif (destinations.has(destination)) {\n\t\t\t\t\t\tthrow new Error(`Duplicate service artifact destination: ${provider.id}/${platformTag}/${destination}`);\n\t\t\t\t\t}\n\t\t\t\t\tdestinations.add(destination);\n\t\t\t\t\treturn { ...artifact, destination };\n\t\t\t\t}),\n\t\t\t};\n\t\t}\n\t\tif (Object.keys(platforms).length === 0) {\n\t\t\tthrow new Error(`Service provider must declare at least one platform: ${provider.id}`);\n\t\t}\n\t\tconst credentialIds = new Set<string>();\n\t\tconst credentials = provider.credentials?.map((credential) => {\n\t\t\tif (credentialIds.has(credential.id)) throw new Error(`Duplicate service credential id: ${provider.id}/${credential.id}`);\n\t\t\tcredentialIds.add(credential.id);\n\t\t\treturn { id: credential.id, bytes: credential.bytes };\n\t\t});\n\t\tif (provider.health.credentialId && !credentialIds.has(provider.health.credentialId)) {\n\t\t\tthrow new Error(`Unknown service health credential: ${provider.id}/${provider.health.credentialId}`);\n\t\t}\n\t\tconst templateDestinations = new Set<string>();\n\t\tconst templates = provider.templates?.map((template) => {\n\t\t\tconst source = validatePluginRelativePath(template.source, `providers.services.${provider.id}.templates.source`);\n\t\t\tconst destination = validatePluginRelativePath(\n\t\t\t\ttemplate.destination,\n\t\t\t\t`providers.services.${provider.id}.templates.destination`,\n\t\t\t);\n\t\t\tif (templateDestinations.has(destination)) throw new Error(`Duplicate service template destination: ${provider.id}/${destination}`);\n\t\t\ttemplateDestinations.add(destination);\n\t\t\treturn { source, destination, mode: template.mode };\n\t\t});\n\t\tconst normalizedRuntime: PluginServiceProviderManifest[\"runtime\"] = {\n\t\t\tversion: provider.runtime.version,\n\t\t\tplatforms,\n\t\t\t...(runtimeKind === \"host-node\" ? { kind: runtimeKind, entry } : provider.runtime.kind ? { kind: runtimeKind } : {}),\n\t\t};\n\t\treturn {\n\t\t\tid: provider.id,\n\t\t\truntime: normalizedRuntime,\n\t\t\tcredentials,\n\t\t\ttemplates,\n\t\t\tprocess: {\n\t\t\t\targs: provider.process.args ? [...provider.process.args] : undefined,\n\t\t\t\tenv: provider.process.env ? { ...provider.process.env } : undefined,\n\t\t\t},\n\t\t\thealth: { ...provider.health },\n\t\t};\n\t});\n}\n\nfunction normalizePluginMcpServerConfig(config: PluginMcpServerConfig): PluginMcpServerConfig {\n\tconst common = {\n\t\tdisabled: config.disabled,\n\t\tautoApprove: config.autoApprove?.map(trimString),\n\t\tstartupTimeout: config.startupTimeout,\n\t\tdebug: config.debug,\n\t\tdisplayName: config.displayName,\n\t\tdescription: config.description,\n\t\tagent_mode: normalizeOptionalAgentModes(config.agent_mode),\n\t};\n\tif (config.type === \"service\") {\n\t\treturn {\n\t\t\ttype: \"service\",\n\t\t\tserviceId: trimString(config.serviceId),\n\t\t\tpath: trimString(config.path),\n\t\t\t...common,\n\t\t};\n\t}\n\tif (config.type === \"http\") {\n\t\treturn {\n\t\t\ttype: \"http\",\n\t\t\turl: trimString(config.url),\n\t\t\theaders: config.headers ? { ...config.headers } : undefined,\n\t\t\toauthClientId: config.oauthClientId,\n\t\t\toauthDeviceFlow: config.oauthDeviceFlow,\n\t\t\toauthScopes: config.oauthScopes,\n\t\t\t...common,\n\t\t};\n\t}\n\treturn {\n\t\ttype: config.type,\n\t\tcommand: trimString(config.command),\n\t\targs: config.args ? [...config.args] : undefined,\n\t\tenv: config.env ? { ...config.env } : undefined,\n\t\tcwd: config.cwd,\n\t\t...common,\n\t};\n}\n\nexport function validatePluginId(id: string): void {\n\tif (!Value.Check(PluginIdSchema, id)) {\n\t\tthrow new Error(\"Plugin id must be 1-64 chars: lowercase letters, numbers, dot, underscore, or dash\");\n\t}\n}\n\nexport function validatePluginVersion(version: string): void {\n\tif (!Value.Check(PluginVersionSchema, version)) {\n\t\tthrow new Error(\"Plugin version must be 1-64 chars and cannot contain path separators\");\n\t}\n}\n\nexport function validatePluginRelativePath(value: string, fieldName: string): string {\n\tif (value.startsWith(\"/\") || /^[a-zA-Z]:/.test(value)) {\n\t\tthrow new Error(`Invalid plugin ${fieldName}`);\n\t}\n\tconst parts: string[] = [];\n\tfor (const part of value.replace(/\\\\/g, \"/\").split(\"/\")) {\n\t\tif (part === \"\" || part === \".\") continue;\n\t\tif (part === \"..\") {\n\t\t\tif (parts.length === 0) throw new Error(`Invalid plugin ${fieldName}`);\n\t\t\tparts.pop();\n\t\t\tcontinue;\n\t\t}\n\t\tparts.push(part);\n\t}\n\tconst normalized = parts.join(\"/\");\n\tif (!normalized) throw new Error(`Invalid plugin ${fieldName}`);\n\treturn normalized;\n}\n\nexport function parsePluginCommandNames(value: unknown): string[] {\n\tif (value === undefined) return [];\n\tassertSchema(PluginCommandNamesSchema, value, \"commands\");\n\treturn Array.from(new Set(value));\n}\n\n/** @deprecated agent_mode 已无任何运行时语义(ADR-0071),保留仅为容忍既有 manifest。 */\nexport function normalizePluginAgentModes(value: unknown): string[] | undefined {\n\tif (value === undefined || value === null) return undefined;\n\tconst values = Array.isArray(value) ? value : [value];\n\tconst modes = values.map((item) => String(item).trim()).filter(Boolean);\n\treturn modes.length > 0 ? modes : undefined;\n}\n\nexport function parsePluginMcpServerConfig(name: string, raw: unknown): PluginMcpServerConfig {\n\tassertSchema(PluginMcpServerConfigSchema, raw, `MCP server '${name}'`);\n\treturn normalizePluginMcpServerConfig(raw);\n}\n\nexport function isPluginPassthroughIconRef(icon: string): boolean {\n\treturn (\n\t\ticon.startsWith(\"http://\") ||\n\t\ticon.startsWith(\"https://\") ||\n\t\t/^[a-z0-9]+(?:-[a-z0-9]+)*:[a-z0-9]+(?:-[a-z0-9]+)*$/.test(icon)\n\t);\n}\n\nexport function isPluginPackagedIconPath(icon: string): boolean {\n\treturn !isPluginPassthroughIconRef(icon);\n}\n\nexport function parsePluginManifest(raw: unknown): PluginManifest {\n\tif (typeof raw === \"object\" && raw !== null && \"runtime\" in raw) {\n\t\tthrow new Error(\n\t\t\t'Invalid plugin manifest.runtime: runtime selection is unsupported; plugins use Module Federation.',\n\t\t);\n\t}\n\tassertSchema(PluginManifestSchema, raw, \"manifest\");\n\tconst commands = parsePluginCommandNames(raw.commands);\n\tconst icon = raw.icon === undefined ? undefined : trimString(raw.icon);\n\tconst permissions = normalizePermissions(raw.permissions);\n\tconst network = normalizeNetworkManifest(raw.network);\n\tconst browser = normalizeBrowserManifest(raw.browser);\n\tif (permissions.includes(\"network.fetch\") && !network) {\n\t\tthrow new Error(\"Plugin network.allowedHosts is required with network.fetch\");\n\t}\n\tconst browserPermissions = permissions.filter((permission) => permission.startsWith(\"browser.\"));\n\tif (browserPermissions.length > 0 && !browser) {\n\t\tthrow new Error(\"Plugin browser.allowedHosts is required with browser permissions\");\n\t}\n\tif (permissions.includes(\"browser.interact\") && !permissions.includes(\"browser.read\")) {\n\t\tthrow new Error(\"Plugin browser.interact requires browser.read\");\n\t}\n\tconst normalizedServices = raw.providers ? normalizeServiceProviders(raw.providers.services) : undefined;\n\tfor (const [name, server] of Object.entries(raw.agent?.mcpServers && typeof raw.agent.mcpServers !== \"string\" ? raw.agent.mcpServers : {})) {\n\t\tif (server.type === \"service\" && !normalizedServices?.some((service) => service.id === server.serviceId)) {\n\t\t\tthrow new Error(`Plugin MCP server '${name}' references unknown service '${server.serviceId}'`);\n\t\t}\n\t}\n\treturn {\n\t\tid: raw.id,\n\t\tname: trimString(raw.name),\n\t\tversion: raw.version,\n\t\tpluginApiVersion: trimString(raw.pluginApiVersion),\n\t\tentry: validatePluginRelativePath(trimString(raw.entry), \"entry\"),\n\t\tmoduleFederation: normalizeModuleFederation(raw.moduleFederation),\n\t\tagent: normalizeAgentManifest(raw.agent),\n\t\tproviders: raw.providers\n\t\t\t? {\n\t\t\t\t\tcli: normalizeCliProviders(raw.providers.cli),\n\t\t\t\t\tservices: normalizedServices,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tstyles: normalizeStringArray(raw.styles).map((style) => validatePluginRelativePath(style, \"styles\")),\n\t\tpermissions,\n\t\tnetwork,\n\t\tbrowser,\n\t\tcommands: commands.length > 0 ? commands : undefined,\n\t\tdescription: raw.description,\n\t\tauthor: raw.author,\n\t\ticon:\n\t\t\ticon === undefined || isPluginPassthroughIconRef(icon)\n\t\t\t\t? icon\n\t\t\t\t: validatePluginRelativePath(icon, \"icon\"),\n\t\tguidingWords: raw.guidingWords?.map(trimString),\n\t\tdefaultLocale: raw.defaultLocale ?? \"zh\",\n\t\tcontributionMode: raw.contributionMode\n\t\t\t? { hardIsolation: raw.contributionMode.hardIsolation === true }\n\t\t\t: undefined,\n\t\tagent_mode: normalizePluginAgentModes(raw.agent_mode),\n\t};\n}\n\nexport function listPluginManifestResources(\n\tmanifest: PluginManifest,\n): PluginManifestResourceReference[] {\n\tconst resources: PluginManifestResourceReference[] = [\n\t\t{ field: \"entry\", path: manifest.entry, kind: \"file\" },\n\t];\n\tfor (const stylePath of manifest.styles ?? []) {\n\t\tresources.push({ field: \"styles\", path: stylePath, kind: \"file\" });\n\t}\n\tif (manifest.icon && isPluginPackagedIconPath(manifest.icon)) {\n\t\tresources.push({ field: \"icon\", path: manifest.icon, kind: \"file\" });\n\t}\n\tfor (const promptPath of manifest.agent?.systemPrompt?.promptPaths ?? []) {\n\t\tresources.push({ field: \"agent.systemPrompt.promptPaths\", path: promptPath, kind: \"file-or-directory\" });\n\t}\n\tfor (const skillPath of manifest.agent?.skillPaths ?? []) {\n\t\tresources.push({ field: \"agent.skillPaths\", path: skillPath, kind: \"file-or-directory\" });\n\t}\n\tfor (const agent of manifest.agent?.agents ?? []) {\n\t\t// 人设与头像是插件包里的真实文件:不登记就不会被打进包,装到用户机器上时这个\n\t\t// 智能体会因为「提示词读不出来」被整个跳过。\n\t\tif (agent.avatar) resources.push({ field: \"agent.agents.avatar\", path: agent.avatar, kind: \"file\" });\n\t\tif (agent.systemPromptPath) {\n\t\t\tresources.push({ field: \"agent.agents.systemPromptPath\", path: agent.systemPromptPath, kind: \"file\" });\n\t\t}\n\t}\n\tfor (const team of manifest.agent?.teams ?? []) {\n\t\tif (team.workflowPath) {\n\t\t\tresources.push({ field: \"agent.teams.workflowPath\", path: team.workflowPath, kind: \"file\" });\n\t\t}\n\t}\n\tif (typeof manifest.agent?.mcpServers === \"string\") {\n\t\tresources.push({ field: \"agent.mcpServers\", path: manifest.agent.mcpServers, kind: \"file\" });\n\t}\n\tfor (const service of manifest.providers?.services ?? []) {\n\t\tfor (const template of service.templates ?? []) {\n\t\t\tresources.push({ field: `providers.services.${service.id}.templates.source`, path: template.source, kind: \"file\" });\n\t\t}\n\t}\n\treturn resources;\n}\n\nfunction parseApiVersion(value: string): readonly [number, number, number] | undefined {\n\tconst match = /^(\\d+)\\.(\\d+)\\.(\\d+)$/.exec(value);\n\tif (!match) return undefined;\n\treturn [Number(match[1]), Number(match[2]), Number(match[3])];\n}\n\nfunction compareApiVersions(\n\tleft: readonly [number, number, number],\n\tright: readonly [number, number, number],\n): number {\n\tfor (let index = 0; index < left.length; index += 1) {\n\t\tif (left[index] !== right[index]) return left[index] - right[index];\n\t}\n\treturn 0;\n}\n\nexport function isPluginApiCompatible(hostVersion: string, range: string): boolean {\n\tconst host = parseApiVersion(hostVersion);\n\tif (!host) return false;\n\tconst normalized = range.trim();\n\tconst exact = parseApiVersion(normalized);\n\tif (exact) return exact[0] === host[0] && compareApiVersions(host, exact) >= 0;\n\tconst caret = normalized.startsWith(\"^\") ? parseApiVersion(normalized.slice(1)) : undefined;\n\tif (caret) return caret[0] === host[0] && compareApiVersions(host, caret) >= 0;\n\tif (normalized === `^${host[0]}` || normalized === `${host[0]}.x`) return true;\n\tconst minimum = normalized.startsWith(\">=\") ? parseApiVersion(normalized.slice(2)) : undefined;\n\treturn minimum !== undefined && compareApiVersions(host, minimum) >= 0;\n}\n"]}
package/dist/manifest.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Value } from "@sinclair/typebox/value";
2
2
  import { PluginCommandNamesSchema, PluginIdSchema, PluginManifestSchema, PluginMcpServerConfigSchema, PluginVersionSchema, } from "./manifest-schema.js";
3
3
  import "./permissions.js";
4
- export { PluginAgentManifestSchema, PluginAgentProfileManifestSchema, PluginAgentTeamManifestSchema, PluginAgentTeamMemberManifestSchema, PluginBrowserManifestSchema, PluginCommandNameSchema, PluginCommandNamesSchema, PluginCliProviderManifestSchema, PluginServiceArtifactSchema, PluginServicePlatformSchema, PluginServiceProviderManifestSchema, PluginIdSchema, PluginManifestSchema, PluginMcpHttpServerConfigSchema, PluginMcpServerConfigSchema, PluginMcpStdioServerConfigSchema, PluginMcpServiceServerConfigSchema, PluginSkillPresentationRuleSchema, PluginSkillPresentationSchema, PluginModuleFederationManifestSchema, PluginNetworkManifestSchema, PluginProvidersManifestSchema, PluginPermissionSchema, PluginVersionSchema, } from "./manifest-schema.js";
4
+ export { PluginAgentManifestSchema, PluginAgentProfileManifestSchema, PluginAgentTeamManifestSchema, PluginAgentTeamMemberManifestSchema, PluginAgentRoleSchema, BUILTIN_PLUGIN_AGENT_ROLES, PluginBrowserManifestSchema, PluginCommandNameSchema, PluginCommandNamesSchema, PluginCliProviderManifestSchema, PluginServiceArtifactSchema, PluginServicePlatformSchema, PluginServiceProviderManifestSchema, PluginIdSchema, PluginManifestSchema, PluginMcpHttpServerConfigSchema, PluginMcpServerConfigSchema, PluginMcpStdioServerConfigSchema, PluginMcpServiceServerConfigSchema, PluginSkillPresentationRuleSchema, PluginSkillPresentationSchema, PluginModuleFederationManifestSchema, PluginNetworkManifestSchema, PluginProvidersManifestSchema, PluginPermissionSchema, PluginVersionSchema, } from "./manifest-schema.js";
5
5
  export { PLUGIN_PERMISSIONS } from "./permissions.js";
6
6
  function schemaErrorPath(path) {
7
7
  if (!path)
@@ -126,15 +126,46 @@ function normalizeAgentManifest(agent) {
126
126
  systemPromptPath: profile.systemPromptPath
127
127
  ? validatePluginRelativePath(profile.systemPromptPath, "agent.agents.systemPromptPath")
128
128
  : undefined,
129
+ roles: normalizeAgentRoles(profile.roles),
129
130
  })),
130
131
  teams: agent.teams?.map((team) => ({
131
132
  ...team,
132
133
  workflowPath: team.workflowPath
133
134
  ? validatePluginRelativePath(team.workflowPath, "agent.teams.workflowPath")
134
135
  : undefined,
136
+ members: team.members.map((member, index) => normalizeTeamMember(member, index, team.id)),
135
137
  })),
136
138
  };
137
139
  }
140
+ function normalizeAgentRoles(roles) {
141
+ if (!roles || roles.length === 0)
142
+ return undefined;
143
+ return [...new Set(roles.map((role) => role.trim()))];
144
+ }
145
+ /** `<pluginId>/<agentId>` 的跨插件实体引用;本插件的引用不带斜杠。 */
146
+ const CROSS_PLUGIN_AGENT_REF = /^([a-z0-9][a-z0-9-]{0,63})\/([a-z0-9][a-z0-9-]{0,63})$/;
147
+ const OWN_PLUGIN_AGENT_REF = /^[a-z0-9][a-z0-9-]{0,63}$/;
148
+ function normalizeTeamMember(member, index, teamId) {
149
+ const where = `agent.teams[${teamId}].members[${index}]`;
150
+ const agent = member.agent?.trim();
151
+ const role = member.role?.trim();
152
+ if ((agent ? 1 : 0) + (role ? 1 : 0) !== 1) {
153
+ throw new Error(`Invalid ${where}: write exactly one of "agent" or "role"`);
154
+ }
155
+ if (agent && !CROSS_PLUGIN_AGENT_REF.test(agent) && !OWN_PLUGIN_AGENT_REF.test(agent)) {
156
+ throw new Error(`Invalid ${where}.agent: expected "<agentId>" or "<pluginId>/<agentId>", got "${agent}"`);
157
+ }
158
+ if (index === 0 && (!agent || !OWN_PLUGIN_AGENT_REF.test(agent))) {
159
+ // 队长是用户在团队会话里唯一的对话入口。允许它落在别的插件上,那个插件一卸载,这支
160
+ // 团队就成了打不开的壳——比少一名队员严重得多,所以队长只能是本插件自己的智能体。
161
+ throw new Error(`Invalid ${where}: the team leader must be one of this plugin's own agents`);
162
+ }
163
+ return {
164
+ ...member,
165
+ ...(agent ? { agent } : {}),
166
+ ...(role ? { role } : {}),
167
+ };
168
+ }
138
169
  function normalizeSkillPresentation(presentation) {
139
170
  if (!presentation)
140
171
  return undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAEN,wBAAwB,EAGxB,cAAc,EACd,oBAAoB,EACpB,2BAA2B,EAI3B,mBAAmB,GAenB,MAAM,sBAAsB,CAAC;AAC9B,OAA0D,kBAAkB,CAAC;AAE7E,OAAO,EACN,yBAAyB,EACzB,gCAAgC,EAChC,6BAA6B,EAC7B,mCAAmC,EACnC,2BAA2B,EAC3B,uBAAuB,EACvB,wBAAwB,EACxB,+BAA+B,EAC/B,2BAA2B,EAC3B,2BAA2B,EAC3B,mCAAmC,EACnC,cAAc,EACd,oBAAoB,EACpB,+BAA+B,EAC/B,2BAA2B,EAC3B,gCAAgC,EAChC,kCAAkC,EAClC,iCAAiC,EACjC,6BAA6B,EAC7B,oCAAoC,EACpC,2BAA2B,EAC3B,6BAA6B,EAC7B,sBAAsB,EACtB,mBAAmB,GACnB,MAAM,sBAAsB,CAAC;AAmB9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAStD,SAAS,eAAe,CAAC,IAAY,EAAU;IAC9C,IA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AAI,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/F,OAAO,OAAO,KAAK,SAAS,IAAI,kBAAkB,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;AAAA,CACvE","sourcesContent":["import { type Static, type TSchema } from \"@sinclair/typebox\";\nimport type { ValueError } from \"@sinclair/typebox/errors\";\nimport { Value } from \"@sinclair/typebox/value\";\nimport {\n\tPluginCommandNameSchema,\n\tPluginCommandNamesSchema,\n\tPluginCliProviderManifestSchema,\n\tPluginServiceProviderManifestSchema,\n\tPluginIdSchema,\n\tPluginManifestSchema,\n\tPluginMcpServerConfigSchema,\n\tPluginMcpServiceServerConfigSchema,\n\tPluginSkillPresentationRuleSchema,\n\tPluginSkillPresentationSchema,\n\tPluginVersionSchema,\n\ttype PluginAgentManifest,\n\ttype PluginAgentProfileManifest,\n\ttype PluginAgentTeamManifest,\n\ttype PluginAgentTeamMemberManifest,\n\ttype PluginBrowserManifest,\n\ttype PluginCliProviderManifest,\n\ttype PluginServiceProviderManifest,\n\ttype PluginServiceRuntimeKind,\n\ttype PluginManifest,\n\ttype PluginManifestInput,\n\ttype PluginMcpServerConfig,\n\ttype PluginSkillPresentation,\n\ttype PluginSkillPresentationRule,\n\ttype PluginNetworkManifest,\n} from \"./manifest-schema.js\";\nimport { PLUGIN_PERMISSIONS, type PluginPermission } from \"./permissions.js\";\n\nexport {\n\tPluginAgentManifestSchema,\n\tPluginAgentProfileManifestSchema,\n\tPluginAgentTeamManifestSchema,\n\tPluginAgentTeamMemberManifestSchema,\n\tPluginBrowserManifestSchema,\n\tPluginCommandNameSchema,\n\tPluginCommandNamesSchema,\n\tPluginCliProviderManifestSchema,\n\tPluginServiceArtifactSchema,\n\tPluginServicePlatformSchema,\n\tPluginServiceProviderManifestSchema,\n\tPluginIdSchema,\n\tPluginManifestSchema,\n\tPluginMcpHttpServerConfigSchema,\n\tPluginMcpServerConfigSchema,\n\tPluginMcpStdioServerConfigSchema,\n\tPluginMcpServiceServerConfigSchema,\n\tPluginSkillPresentationRuleSchema,\n\tPluginSkillPresentationSchema,\n\tPluginModuleFederationManifestSchema,\n\tPluginNetworkManifestSchema,\n\tPluginProvidersManifestSchema,\n\tPluginPermissionSchema,\n\tPluginVersionSchema,\n} from \"./manifest-schema.js\";\nexport type {\n\tPluginAgentManifest,\n\tPluginAgentProfileManifest,\n\tPluginAgentTeamManifest,\n\tPluginAgentTeamMemberManifest,\n\tPluginBrowserManifest,\n\tPluginCliProviderManifest,\n\tPluginServiceArtifact,\n\tPluginServicePlatform,\n\tPluginServiceProviderManifest,\n\tPluginServiceRuntimeKind,\n\tPluginManifest,\n\tPluginManifestInput,\n\tPluginMcpServerConfig,\n\tPluginSkillPresentation,\n\tPluginSkillPresentationRule,\n\tPluginNetworkManifest,\n} from \"./manifest-schema.js\";\nexport { PLUGIN_PERMISSIONS } from \"./permissions.js\";\nexport type { PluginPermission } from \"./permissions.js\";\n\nexport interface PluginManifestResourceReference {\n\tfield: string;\n\tpath: string;\n\tkind: \"file\" | \"file-or-directory\";\n}\n\nfunction schemaErrorPath(path: string): string {\n\tif (!path) return \"\";\n\treturn path\n\t\t.split(\"/\")\n\t\t.slice(1)\n\t\t.map((segment) => segment.replace(/~1/g, \"/\").replace(/~0/g, \"~\"))\n\t\t.map((segment) => {\n\t\t\tif (segment === \"\") return '[\"\"]';\n\t\t\treturn /^\\d+$/.test(segment) ? `[${segment}]` : `.${segment}`;\n\t\t})\n\t\t.join(\"\");\n}\n\nfunction mostSpecificSchemaError(issue: ValueError): ValueError {\n\tconst nested = issue.errors.flatMap((iterator) =>\n\t\t[...iterator].map((child) => mostSpecificSchemaError(child)),\n\t);\n\tconst deeper = nested.filter((child) => child.path.length > issue.path.length);\n\tif (deeper.length === 0) return issue;\n\treturn deeper.reduce((best, child) => (child.path.length > best.path.length ? child : best));\n}\n\nfunction assertSchema<Schema extends TSchema>(\n\tschema: Schema,\n\tvalue: unknown,\n\tfieldName: string,\n): asserts value is Static<Schema> {\n\tif (Value.Check(schema, value)) return;\n\tconst firstIssue = Value.Errors(schema, value).First();\n\tconst issue = firstIssue ? mostSpecificSchemaError(firstIssue) : undefined;\n\tconst location = `${fieldName}${schemaErrorPath(issue?.path ?? \"\")}`;\n\tthrow new Error(`Invalid plugin ${location}: ${issue?.message ?? \"schema validation failed\"}`);\n}\n\nfunction trimString(value: string): string {\n\treturn value.trim();\n}\n\nfunction normalizeStringArray(values: string[] | undefined): string[] {\n\treturn (values ?? []).map(trimString);\n}\n\nfunction normalizeOptionalAgentModes(value: string | string[] | undefined): string | string[] | undefined {\n\tif (value === undefined) return undefined;\n\treturn Array.isArray(value) ? normalizeStringArray(value) : trimString(value);\n}\n\nfunction normalizePermissions(permissions: PluginPermission[] | undefined): PluginPermission[] {\n\treturn Array.from(new Set(permissions ?? []));\n}\n\nfunction normalizeAllowedHost(value: string, fieldName: \"network\" | \"browser\"): string {\n\tconst raw = trimString(value).toLowerCase();\n\tif (raw === \"*\") return raw;\n\tconst wildcard = raw.startsWith(\"*.\");\n\tconst candidate = wildcard ? raw.slice(2) : raw;\n\tif (!candidate || candidate.includes(\"*\") || /[\\\\/?#@]/.test(candidate)) {\n\t\tthrow new Error(`Invalid plugin ${fieldName}.allowedHosts entry: ${value}`);\n\t}\n\tconst unwrapped = candidate.startsWith(\"[\") && candidate.endsWith(\"]\") ? candidate.slice(1, -1) : candidate;\n\tif (wildcard && unwrapped.includes(\":\")) {\n\t\tthrow new Error(`Invalid plugin ${fieldName}.allowedHosts entry: ${value}`);\n\t}\n\ttry {\n\t\tconst parsed = new URL(`http://${unwrapped.includes(\":\") ? `[${unwrapped}]` : unwrapped}`);\n\t\tconst hostname = parsed.hostname.replace(/^\\[|\\]$/g, \"\").replace(/\\.$/, \"\").toLowerCase();\n\t\tif (!hostname || parsed.port || parsed.username || parsed.password) throw new Error(\"invalid host\");\n\t\treturn wildcard ? `*.${hostname}` : hostname;\n\t} catch {\n\t\tthrow new Error(`Invalid plugin ${fieldName}.allowedHosts entry: ${value}`);\n\t}\n}\n\nfunction normalizeNetworkManifest(network: PluginNetworkManifest | undefined): PluginNetworkManifest | undefined {\n\tif (!network) return undefined;\n\treturn { allowedHosts: Array.from(new Set(network.allowedHosts.map((host) => normalizeAllowedHost(host, \"network\")))) };\n}\n\nfunction normalizeBrowserManifest(browser: PluginBrowserManifest | undefined): PluginBrowserManifest | undefined {\n\tif (!browser) return undefined;\n\treturn { allowedHosts: Array.from(new Set(browser.allowedHosts.map((host) => normalizeAllowedHost(host, \"browser\")))) };\n}\n\nfunction normalizeModuleFederation(\n\tmoduleFederation: PluginManifestInput[\"moduleFederation\"],\n): PluginManifest[\"moduleFederation\"] {\n\treturn {\n\t\tremoteName: trimString(moduleFederation.remoteName),\n\t\texpose: trimString(moduleFederation.expose),\n\t};\n}\n\nfunction normalizeToolPolicy(\n\ttoolPolicy: PluginAgentManifest[\"toolPolicy\"],\n): PluginAgentManifest[\"toolPolicy\"] {\n\tif (!toolPolicy) return undefined;\n\treturn {\n\t\tallow: normalizeStringArray(toolPolicy.allow),\n\t\tdeny: normalizeStringArray(toolPolicy.deny),\n\t};\n}\n\nfunction normalizeMcpServers(\n\tmcpServers: PluginAgentManifest[\"mcpServers\"],\n): PluginAgentManifest[\"mcpServers\"] {\n\tif (mcpServers === undefined) return undefined;\n\tif (typeof mcpServers === \"string\") {\n\t\treturn validatePluginRelativePath(trimString(mcpServers), \"agent.mcpServers\");\n\t}\n\tconst result: Record<string, PluginMcpServerConfig> = {};\n\tfor (const [name, config] of Object.entries(mcpServers)) {\n\t\tresult[trimString(name)] = normalizePluginMcpServerConfig(config);\n\t}\n\treturn result;\n}\n\nfunction normalizeAgentManifest(agent: PluginAgentManifest | undefined): PluginAgentManifest | undefined {\n\tif (!agent) return undefined;\n\treturn {\n\t\tsystemPrompt: agent.systemPrompt\n\t\t\t? {\n\t\t\t\t\tpromptPaths: normalizeStringArray(agent.systemPrompt.promptPaths).map((path) =>\n\t\t\t\t\t\tvalidatePluginRelativePath(path, \"agent.systemPrompt.promptPaths\"),\n\t\t\t\t\t),\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tskillPaths: normalizeStringArray(agent.skillPaths).map((path) =>\n\t\t\tvalidatePluginRelativePath(path, \"agent.skillPaths\"),\n\t\t),\n\t\tskillPresentation: normalizeSkillPresentation(agent.skillPresentation),\n\t\tmcpServers: normalizeMcpServers(agent.mcpServers),\n\t\ttoolPolicy: normalizeToolPolicy(agent.toolPolicy),\n\t\tagents: agent.agents?.map((profile) => ({\n\t\t\t...profile,\n\t\t\t// 路径都要过越界校验:manifest 里写 `../` 不该能读到插件目录之外。\n\t\t\tavatar: profile.avatar ? validatePluginRelativePath(profile.avatar, \"agent.agents.avatar\") : undefined,\n\t\t\tsystemPromptPath: profile.systemPromptPath\n\t\t\t\t? validatePluginRelativePath(profile.systemPromptPath, \"agent.agents.systemPromptPath\")\n\t\t\t\t: undefined,\n\t\t})),\n\t\tteams: agent.teams?.map((team) => ({\n\t\t\t...team,\n\t\t\tworkflowPath: team.workflowPath\n\t\t\t\t? validatePluginRelativePath(team.workflowPath, \"agent.teams.workflowPath\")\n\t\t\t\t: undefined,\n\t\t})),\n\t};\n}\n\nfunction normalizeSkillPresentation(\n\tpresentation: PluginSkillPresentation | undefined,\n): PluginSkillPresentation | undefined {\n\tif (!presentation) return undefined;\n\tconst normalizeRule = (rule: PluginSkillPresentationRule): PluginSkillPresentationRule => ({\n\t\tdefaultVisibility: rule.defaultVisibility,\n\t\tsurfaces: rule.surfaces ? { ...rule.surfaces } : undefined,\n\t\tdisplayName: rule.displayName?.trim(),\n\t\tdisplayDescription: rule.displayDescription?.trim(),\n\t});\n\treturn {\n\t\tdefaultVisibility: presentation.defaultVisibility,\n\t\tsurfaces: presentation.surfaces ? { ...presentation.surfaces } : undefined,\n\t\tskills: presentation.skills\n\t\t\t? Object.fromEntries(\n\t\t\t\t\tObject.entries(presentation.skills).map(([name, rule]) => [name.trim(), normalizeRule(rule)]),\n\t\t\t\t)\n\t\t\t: undefined,\n\t};\n}\n\nfunction normalizeCliProviders(providers: PluginCliProviderManifest[] | undefined): PluginCliProviderManifest[] | undefined {\n\tif (!providers || providers.length === 0) return undefined;\n\tconst ids = new Set<string>();\n\treturn providers.map((provider) => {\n\t\tif (ids.has(provider.id)) throw new Error(`Duplicate CLI provider id: ${provider.id}`);\n\t\tids.add(provider.id);\n\t\treturn {\n\t\t\tid: provider.id,\n\t\t\tcommand: provider.command,\n\t\t\tprobe: provider.probe\n\t\t\t\t? { args: provider.probe.args ? [...provider.probe.args] : undefined, timeoutMs: provider.probe.timeoutMs }\n\t\t\t\t: undefined,\n\t\t\tinstall: {\n\t\t\t\tcommand: provider.install.command,\n\t\t\t\targs: provider.install.args ? [...provider.install.args] : undefined,\n\t\t\t\ttimeoutMs: provider.install.timeoutMs,\n\t\t\t},\n\t\t};\n\t});\n}\n\nfunction normalizeServiceProviders(\n\tproviders: PluginServiceProviderManifest[] | undefined,\n): PluginServiceProviderManifest[] | undefined {\n\tif (!providers || providers.length === 0) return undefined;\n\tconst ids = new Set<string>();\n\treturn providers.map((provider) => {\n\t\tif (ids.has(provider.id)) throw new Error(`Duplicate service provider id: ${provider.id}`);\n\t\tids.add(provider.id);\n\t\tconst runtimeKind: PluginServiceRuntimeKind = provider.runtime.kind ?? \"managed-binary\";\n\t\tconst entry = provider.runtime.entry\n\t\t\t? validatePluginRelativePath(provider.runtime.entry, `providers.services.${provider.id}.runtime.entry`)\n\t\t\t: undefined;\n\t\tif (runtimeKind === \"host-node\" && !entry) {\n\t\t\tthrow new Error(`Host-node service must declare runtime.entry: ${provider.id}`);\n\t\t}\n\t\tconst platforms: PluginServiceProviderManifest[\"runtime\"][\"platforms\"] = {};\n\t\tfor (const [platformTag, platform] of Object.entries(provider.runtime.platforms)) {\n\t\t\tconst destinations = new Set<string>();\n\t\t\tplatforms[platformTag] = {\n\t\t\t\texecutable: validatePluginRelativePath(platform.executable, `providers.services.${provider.id}.executable`),\n\t\t\t\tartifacts: platform.artifacts.map((artifact) => {\n\t\t\t\t\tconst destination = validatePluginRelativePath(\n\t\t\t\t\t\tartifact.destination,\n\t\t\t\t\t\t`providers.services.${provider.id}.artifacts.destination`,\n\t\t\t\t\t);\n\t\t\t\t\tif (destinations.has(destination)) {\n\t\t\t\t\t\tthrow new Error(`Duplicate service artifact destination: ${provider.id}/${platformTag}/${destination}`);\n\t\t\t\t\t}\n\t\t\t\t\tdestinations.add(destination);\n\t\t\t\t\treturn { ...artifact, destination };\n\t\t\t\t}),\n\t\t\t};\n\t\t}\n\t\tif (Object.keys(platforms).length === 0) {\n\t\t\tthrow new Error(`Service provider must declare at least one platform: ${provider.id}`);\n\t\t}\n\t\tconst credentialIds = new Set<string>();\n\t\tconst credentials = provider.credentials?.map((credential) => {\n\t\t\tif (credentialIds.has(credential.id)) throw new Error(`Duplicate service credential id: ${provider.id}/${credential.id}`);\n\t\t\tcredentialIds.add(credential.id);\n\t\t\treturn { id: credential.id, bytes: credential.bytes };\n\t\t});\n\t\tif (provider.health.credentialId && !credentialIds.has(provider.health.credentialId)) {\n\t\t\tthrow new Error(`Unknown service health credential: ${provider.id}/${provider.health.credentialId}`);\n\t\t}\n\t\tconst templateDestinations = new Set<string>();\n\t\tconst templates = provider.templates?.map((template) => {\n\t\t\tconst source = validatePluginRelativePath(template.source, `providers.services.${provider.id}.templates.source`);\n\t\t\tconst destination = validatePluginRelativePath(\n\t\t\t\ttemplate.destination,\n\t\t\t\t`providers.services.${provider.id}.templates.destination`,\n\t\t\t);\n\t\t\tif (templateDestinations.has(destination)) throw new Error(`Duplicate service template destination: ${provider.id}/${destination}`);\n\t\t\ttemplateDestinations.add(destination);\n\t\t\treturn { source, destination, mode: template.mode };\n\t\t});\n\t\tconst normalizedRuntime: PluginServiceProviderManifest[\"runtime\"] = {\n\t\t\tversion: provider.runtime.version,\n\t\t\tplatforms,\n\t\t\t...(runtimeKind === \"host-node\" ? { kind: runtimeKind, entry } : provider.runtime.kind ? { kind: runtimeKind } : {}),\n\t\t};\n\t\treturn {\n\t\t\tid: provider.id,\n\t\t\truntime: normalizedRuntime,\n\t\t\tcredentials,\n\t\t\ttemplates,\n\t\t\tprocess: {\n\t\t\t\targs: provider.process.args ? [...provider.process.args] : undefined,\n\t\t\t\tenv: provider.process.env ? { ...provider.process.env } : undefined,\n\t\t\t},\n\t\t\thealth: { ...provider.health },\n\t\t};\n\t});\n}\n\nfunction normalizePluginMcpServerConfig(config: PluginMcpServerConfig): PluginMcpServerConfig {\n\tconst common = {\n\t\tdisabled: config.disabled,\n\t\tautoApprove: config.autoApprove?.map(trimString),\n\t\tstartupTimeout: config.startupTimeout,\n\t\tdebug: config.debug,\n\t\tdisplayName: config.displayName,\n\t\tdescription: config.description,\n\t\tagent_mode: normalizeOptionalAgentModes(config.agent_mode),\n\t};\n\tif (config.type === \"service\") {\n\t\treturn {\n\t\t\ttype: \"service\",\n\t\t\tserviceId: trimString(config.serviceId),\n\t\t\tpath: trimString(config.path),\n\t\t\t...common,\n\t\t};\n\t}\n\tif (config.type === \"http\") {\n\t\treturn {\n\t\t\ttype: \"http\",\n\t\t\turl: trimString(config.url),\n\t\t\theaders: config.headers ? { ...config.headers } : undefined,\n\t\t\toauthClientId: config.oauthClientId,\n\t\t\toauthDeviceFlow: config.oauthDeviceFlow,\n\t\t\toauthScopes: config.oauthScopes,\n\t\t\t...common,\n\t\t};\n\t}\n\treturn {\n\t\ttype: config.type,\n\t\tcommand: trimString(config.command),\n\t\targs: config.args ? [...config.args] : undefined,\n\t\tenv: config.env ? { ...config.env } : undefined,\n\t\tcwd: config.cwd,\n\t\t...common,\n\t};\n}\n\nexport function validatePluginId(id: string): void {\n\tif (!Value.Check(PluginIdSchema, id)) {\n\t\tthrow new Error(\"Plugin id must be 1-64 chars: lowercase letters, numbers, dot, underscore, or dash\");\n\t}\n}\n\nexport function validatePluginVersion(version: string): void {\n\tif (!Value.Check(PluginVersionSchema, version)) {\n\t\tthrow new Error(\"Plugin version must be 1-64 chars and cannot contain path separators\");\n\t}\n}\n\nexport function validatePluginRelativePath(value: string, fieldName: string): string {\n\tif (value.startsWith(\"/\") || /^[a-zA-Z]:/.test(value)) {\n\t\tthrow new Error(`Invalid plugin ${fieldName}`);\n\t}\n\tconst parts: string[] = [];\n\tfor (const part of value.replace(/\\\\/g, \"/\").split(\"/\")) {\n\t\tif (part === \"\" || part === \".\") continue;\n\t\tif (part === \"..\") {\n\t\t\tif (parts.length === 0) throw new Error(`Invalid plugin ${fieldName}`);\n\t\t\tparts.pop();\n\t\t\tcontinue;\n\t\t}\n\t\tparts.push(part);\n\t}\n\tconst normalized = parts.join(\"/\");\n\tif (!normalized) throw new Error(`Invalid plugin ${fieldName}`);\n\treturn normalized;\n}\n\nexport function parsePluginCommandNames(value: unknown): string[] {\n\tif (value === undefined) return [];\n\tassertSchema(PluginCommandNamesSchema, value, \"commands\");\n\treturn Array.from(new Set(value));\n}\n\n/** @deprecated agent_mode 已无任何运行时语义(ADR-0071),保留仅为容忍既有 manifest。 */\nexport function normalizePluginAgentModes(value: unknown): string[] | undefined {\n\tif (value === undefined || value === null) return undefined;\n\tconst values = Array.isArray(value) ? value : [value];\n\tconst modes = values.map((item) => String(item).trim()).filter(Boolean);\n\treturn modes.length > 0 ? modes : undefined;\n}\n\nexport function parsePluginMcpServerConfig(name: string, raw: unknown): PluginMcpServerConfig {\n\tassertSchema(PluginMcpServerConfigSchema, raw, `MCP server '${name}'`);\n\treturn normalizePluginMcpServerConfig(raw);\n}\n\nexport function isPluginPassthroughIconRef(icon: string): boolean {\n\treturn (\n\t\ticon.startsWith(\"http://\") ||\n\t\ticon.startsWith(\"https://\") ||\n\t\t/^[a-z0-9]+(?:-[a-z0-9]+)*:[a-z0-9]+(?:-[a-z0-9]+)*$/.test(icon)\n\t);\n}\n\nexport function isPluginPackagedIconPath(icon: string): boolean {\n\treturn !isPluginPassthroughIconRef(icon);\n}\n\nexport function parsePluginManifest(raw: unknown): PluginManifest {\n\tif (typeof raw === \"object\" && raw !== null && \"runtime\" in raw) {\n\t\tthrow new Error(\n\t\t\t'Invalid plugin manifest.runtime: runtime selection is unsupported; plugins use Module Federation.',\n\t\t);\n\t}\n\tassertSchema(PluginManifestSchema, raw, \"manifest\");\n\tconst commands = parsePluginCommandNames(raw.commands);\n\tconst icon = raw.icon === undefined ? undefined : trimString(raw.icon);\n\tconst permissions = normalizePermissions(raw.permissions);\n\tconst network = normalizeNetworkManifest(raw.network);\n\tconst browser = normalizeBrowserManifest(raw.browser);\n\tif (permissions.includes(\"network.fetch\") && !network) {\n\t\tthrow new Error(\"Plugin network.allowedHosts is required with network.fetch\");\n\t}\n\tconst browserPermissions = permissions.filter((permission) => permission.startsWith(\"browser.\"));\n\tif (browserPermissions.length > 0 && !browser) {\n\t\tthrow new Error(\"Plugin browser.allowedHosts is required with browser permissions\");\n\t}\n\tif (permissions.includes(\"browser.interact\") && !permissions.includes(\"browser.read\")) {\n\t\tthrow new Error(\"Plugin browser.interact requires browser.read\");\n\t}\n\tconst normalizedServices = raw.providers ? normalizeServiceProviders(raw.providers.services) : undefined;\n\tfor (const [name, server] of Object.entries(raw.agent?.mcpServers && typeof raw.agent.mcpServers !== \"string\" ? raw.agent.mcpServers : {})) {\n\t\tif (server.type === \"service\" && !normalizedServices?.some((service) => service.id === server.serviceId)) {\n\t\t\tthrow new Error(`Plugin MCP server '${name}' references unknown service '${server.serviceId}'`);\n\t\t}\n\t}\n\treturn {\n\t\tid: raw.id,\n\t\tname: trimString(raw.name),\n\t\tversion: raw.version,\n\t\tpluginApiVersion: trimString(raw.pluginApiVersion),\n\t\tentry: validatePluginRelativePath(trimString(raw.entry), \"entry\"),\n\t\tmoduleFederation: normalizeModuleFederation(raw.moduleFederation),\n\t\tagent: normalizeAgentManifest(raw.agent),\n\t\tproviders: raw.providers\n\t\t\t? {\n\t\t\t\t\tcli: normalizeCliProviders(raw.providers.cli),\n\t\t\t\t\tservices: normalizedServices,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tstyles: normalizeStringArray(raw.styles).map((style) => validatePluginRelativePath(style, \"styles\")),\n\t\tpermissions,\n\t\tnetwork,\n\t\tbrowser,\n\t\tcommands: commands.length > 0 ? commands : undefined,\n\t\tdescription: raw.description,\n\t\tauthor: raw.author,\n\t\ticon:\n\t\t\ticon === undefined || isPluginPassthroughIconRef(icon)\n\t\t\t\t? icon\n\t\t\t\t: validatePluginRelativePath(icon, \"icon\"),\n\t\tguidingWords: raw.guidingWords?.map(trimString),\n\t\tdefaultLocale: raw.defaultLocale ?? \"zh\",\n\t\tcontributionMode: raw.contributionMode\n\t\t\t? { hardIsolation: raw.contributionMode.hardIsolation === true }\n\t\t\t: undefined,\n\t\tagent_mode: normalizePluginAgentModes(raw.agent_mode),\n\t};\n}\n\nexport function listPluginManifestResources(\n\tmanifest: PluginManifest,\n): PluginManifestResourceReference[] {\n\tconst resources: PluginManifestResourceReference[] = [\n\t\t{ field: \"entry\", path: manifest.entry, kind: \"file\" },\n\t];\n\tfor (const stylePath of manifest.styles ?? []) {\n\t\tresources.push({ field: \"styles\", path: stylePath, kind: \"file\" });\n\t}\n\tif (manifest.icon && isPluginPackagedIconPath(manifest.icon)) {\n\t\tresources.push({ field: \"icon\", path: manifest.icon, kind: \"file\" });\n\t}\n\tfor (const promptPath of manifest.agent?.systemPrompt?.promptPaths ?? []) {\n\t\tresources.push({ field: \"agent.systemPrompt.promptPaths\", path: promptPath, kind: \"file-or-directory\" });\n\t}\n\tfor (const skillPath of manifest.agent?.skillPaths ?? []) {\n\t\tresources.push({ field: \"agent.skillPaths\", path: skillPath, kind: \"file-or-directory\" });\n\t}\n\tfor (const agent of manifest.agent?.agents ?? []) {\n\t\t// 人设与头像是插件包里的真实文件:不登记就不会被打进包,装到用户机器上时这个\n\t\t// 智能体会因为「提示词读不出来」被整个跳过。\n\t\tif (agent.avatar) resources.push({ field: \"agent.agents.avatar\", path: agent.avatar, kind: \"file\" });\n\t\tif (agent.systemPromptPath) {\n\t\t\tresources.push({ field: \"agent.agents.systemPromptPath\", path: agent.systemPromptPath, kind: \"file\" });\n\t\t}\n\t}\n\tfor (const team of manifest.agent?.teams ?? []) {\n\t\tif (team.workflowPath) {\n\t\t\tresources.push({ field: \"agent.teams.workflowPath\", path: team.workflowPath, kind: \"file\" });\n\t\t}\n\t}\n\tif (typeof manifest.agent?.mcpServers === \"string\") {\n\t\tresources.push({ field: \"agent.mcpServers\", path: manifest.agent.mcpServers, kind: \"file\" });\n\t}\n\tfor (const service of manifest.providers?.services ?? []) {\n\t\tfor (const template of service.templates ?? []) {\n\t\t\tresources.push({ field: `providers.services.${service.id}.templates.source`, path: template.source, kind: \"file\" });\n\t\t}\n\t}\n\treturn resources;\n}\n\nfunction parseApiVersion(value: string): readonly [number, number, number] | undefined {\n\tconst match = /^(\\d+)\\.(\\d+)\\.(\\d+)$/.exec(value);\n\tif (!match) return undefined;\n\treturn [Number(match[1]), Number(match[2]), Number(match[3])];\n}\n\nfunction compareApiVersions(\n\tleft: readonly [number, number, number],\n\tright: readonly [number, number, number],\n): number {\n\tfor (let index = 0; index < left.length; index += 1) {\n\t\tif (left[index] !== right[index]) return left[index] - right[index];\n\t}\n\treturn 0;\n}\n\nexport function isPluginApiCompatible(hostVersion: string, range: string): boolean {\n\tconst host = parseApiVersion(hostVersion);\n\tif (!host) return false;\n\tconst normalized = range.trim();\n\tconst exact = parseApiVersion(normalized);\n\tif (exact) return exact[0] === host[0] && compareApiVersions(host, exact) >= 0;\n\tconst caret = normalized.startsWith(\"^\") ? parseApiVersion(normalized.slice(1)) : undefined;\n\tif (caret) return caret[0] === host[0] && compareApiVersions(host, caret) >= 0;\n\tif (normalized === `^${host[0]}` || normalized === `${host[0]}.x`) return true;\n\tconst minimum = normalized.startsWith(\">=\") ? parseApiVersion(normalized.slice(2)) : undefined;\n\treturn minimum !== undefined && compareApiVersions(host, minimum) >= 0;\n}\n"]}
1
+ {"version":3,"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AAC,IAAI;QAAE,OAAO,IAAI,CAAC;IAC/E,MAAM,OAAO,GAAG,UAAU,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/F,OAAO,OAAO,KAAK,SAAS,IAAI,kBAAkB,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;AAAA,CACvE","sourcesContent":["import { type Static, type TSchema } from \"@sinclair/typebox\";\nimport type { ValueError } from \"@sinclair/typebox/errors\";\nimport { Value } from \"@sinclair/typebox/value\";\nimport {\n\tPluginCommandNameSchema,\n\tPluginCommandNamesSchema,\n\tPluginCliProviderManifestSchema,\n\tPluginServiceProviderManifestSchema,\n\tPluginIdSchema,\n\tPluginManifestSchema,\n\tPluginMcpServerConfigSchema,\n\tPluginMcpServiceServerConfigSchema,\n\tPluginSkillPresentationRuleSchema,\n\tPluginSkillPresentationSchema,\n\tPluginVersionSchema,\n\ttype PluginAgentManifest,\n\ttype PluginAgentProfileManifest,\n\ttype PluginAgentTeamManifest,\n\ttype PluginAgentTeamMemberManifest,\n\ttype PluginBrowserManifest,\n\ttype PluginCliProviderManifest,\n\ttype PluginServiceProviderManifest,\n\ttype PluginServiceRuntimeKind,\n\ttype PluginManifest,\n\ttype PluginManifestInput,\n\ttype PluginMcpServerConfig,\n\ttype PluginSkillPresentation,\n\ttype PluginSkillPresentationRule,\n\ttype PluginNetworkManifest,\n} from \"./manifest-schema.js\";\nimport { PLUGIN_PERMISSIONS, type PluginPermission } from \"./permissions.js\";\n\nexport {\n\tPluginAgentManifestSchema,\n\tPluginAgentProfileManifestSchema,\n\tPluginAgentTeamManifestSchema,\n\tPluginAgentTeamMemberManifestSchema,\n\tPluginAgentRoleSchema,\n\tBUILTIN_PLUGIN_AGENT_ROLES,\n\tPluginBrowserManifestSchema,\n\tPluginCommandNameSchema,\n\tPluginCommandNamesSchema,\n\tPluginCliProviderManifestSchema,\n\tPluginServiceArtifactSchema,\n\tPluginServicePlatformSchema,\n\tPluginServiceProviderManifestSchema,\n\tPluginIdSchema,\n\tPluginManifestSchema,\n\tPluginMcpHttpServerConfigSchema,\n\tPluginMcpServerConfigSchema,\n\tPluginMcpStdioServerConfigSchema,\n\tPluginMcpServiceServerConfigSchema,\n\tPluginSkillPresentationRuleSchema,\n\tPluginSkillPresentationSchema,\n\tPluginModuleFederationManifestSchema,\n\tPluginNetworkManifestSchema,\n\tPluginProvidersManifestSchema,\n\tPluginPermissionSchema,\n\tPluginVersionSchema,\n} from \"./manifest-schema.js\";\nexport type {\n\tPluginAgentManifest,\n\tPluginAgentProfileManifest,\n\tPluginAgentTeamManifest,\n\tPluginAgentTeamMemberManifest,\n\tBuiltinPluginAgentRole,\n\tPluginBrowserManifest,\n\tPluginCliProviderManifest,\n\tPluginServiceArtifact,\n\tPluginServicePlatform,\n\tPluginServiceProviderManifest,\n\tPluginServiceRuntimeKind,\n\tPluginManifest,\n\tPluginManifestInput,\n\tPluginMcpServerConfig,\n\tPluginSkillPresentation,\n\tPluginSkillPresentationRule,\n\tPluginNetworkManifest,\n} from \"./manifest-schema.js\";\nexport { PLUGIN_PERMISSIONS } from \"./permissions.js\";\nexport type { PluginPermission } from \"./permissions.js\";\n\nexport interface PluginManifestResourceReference {\n\tfield: string;\n\tpath: string;\n\tkind: \"file\" | \"file-or-directory\";\n}\n\nfunction schemaErrorPath(path: string): string {\n\tif (!path) return \"\";\n\treturn path\n\t\t.split(\"/\")\n\t\t.slice(1)\n\t\t.map((segment) => segment.replace(/~1/g, \"/\").replace(/~0/g, \"~\"))\n\t\t.map((segment) => {\n\t\t\tif (segment === \"\") return '[\"\"]';\n\t\t\treturn /^\\d+$/.test(segment) ? `[${segment}]` : `.${segment}`;\n\t\t})\n\t\t.join(\"\");\n}\n\nfunction mostSpecificSchemaError(issue: ValueError): ValueError {\n\tconst nested = issue.errors.flatMap((iterator) =>\n\t\t[...iterator].map((child) => mostSpecificSchemaError(child)),\n\t);\n\tconst deeper = nested.filter((child) => child.path.length > issue.path.length);\n\tif (deeper.length === 0) return issue;\n\treturn deeper.reduce((best, child) => (child.path.length > best.path.length ? child : best));\n}\n\nfunction assertSchema<Schema extends TSchema>(\n\tschema: Schema,\n\tvalue: unknown,\n\tfieldName: string,\n): asserts value is Static<Schema> {\n\tif (Value.Check(schema, value)) return;\n\tconst firstIssue = Value.Errors(schema, value).First();\n\tconst issue = firstIssue ? mostSpecificSchemaError(firstIssue) : undefined;\n\tconst location = `${fieldName}${schemaErrorPath(issue?.path ?? \"\")}`;\n\tthrow new Error(`Invalid plugin ${location}: ${issue?.message ?? \"schema validation failed\"}`);\n}\n\nfunction trimString(value: string): string {\n\treturn value.trim();\n}\n\nfunction normalizeStringArray(values: string[] | undefined): string[] {\n\treturn (values ?? []).map(trimString);\n}\n\nfunction normalizeOptionalAgentModes(value: string | string[] | undefined): string | string[] | undefined {\n\tif (value === undefined) return undefined;\n\treturn Array.isArray(value) ? normalizeStringArray(value) : trimString(value);\n}\n\nfunction normalizePermissions(permissions: PluginPermission[] | undefined): PluginPermission[] {\n\treturn Array.from(new Set(permissions ?? []));\n}\n\nfunction normalizeAllowedHost(value: string, fieldName: \"network\" | \"browser\"): string {\n\tconst raw = trimString(value).toLowerCase();\n\tif (raw === \"*\") return raw;\n\tconst wildcard = raw.startsWith(\"*.\");\n\tconst candidate = wildcard ? raw.slice(2) : raw;\n\tif (!candidate || candidate.includes(\"*\") || /[\\\\/?#@]/.test(candidate)) {\n\t\tthrow new Error(`Invalid plugin ${fieldName}.allowedHosts entry: ${value}`);\n\t}\n\tconst unwrapped = candidate.startsWith(\"[\") && candidate.endsWith(\"]\") ? candidate.slice(1, -1) : candidate;\n\tif (wildcard && unwrapped.includes(\":\")) {\n\t\tthrow new Error(`Invalid plugin ${fieldName}.allowedHosts entry: ${value}`);\n\t}\n\ttry {\n\t\tconst parsed = new URL(`http://${unwrapped.includes(\":\") ? `[${unwrapped}]` : unwrapped}`);\n\t\tconst hostname = parsed.hostname.replace(/^\\[|\\]$/g, \"\").replace(/\\.$/, \"\").toLowerCase();\n\t\tif (!hostname || parsed.port || parsed.username || parsed.password) throw new Error(\"invalid host\");\n\t\treturn wildcard ? `*.${hostname}` : hostname;\n\t} catch {\n\t\tthrow new Error(`Invalid plugin ${fieldName}.allowedHosts entry: ${value}`);\n\t}\n}\n\nfunction normalizeNetworkManifest(network: PluginNetworkManifest | undefined): PluginNetworkManifest | undefined {\n\tif (!network) return undefined;\n\treturn { allowedHosts: Array.from(new Set(network.allowedHosts.map((host) => normalizeAllowedHost(host, \"network\")))) };\n}\n\nfunction normalizeBrowserManifest(browser: PluginBrowserManifest | undefined): PluginBrowserManifest | undefined {\n\tif (!browser) return undefined;\n\treturn { allowedHosts: Array.from(new Set(browser.allowedHosts.map((host) => normalizeAllowedHost(host, \"browser\")))) };\n}\n\nfunction normalizeModuleFederation(\n\tmoduleFederation: PluginManifestInput[\"moduleFederation\"],\n): PluginManifest[\"moduleFederation\"] {\n\treturn {\n\t\tremoteName: trimString(moduleFederation.remoteName),\n\t\texpose: trimString(moduleFederation.expose),\n\t};\n}\n\nfunction normalizeToolPolicy(\n\ttoolPolicy: PluginAgentManifest[\"toolPolicy\"],\n): PluginAgentManifest[\"toolPolicy\"] {\n\tif (!toolPolicy) return undefined;\n\treturn {\n\t\tallow: normalizeStringArray(toolPolicy.allow),\n\t\tdeny: normalizeStringArray(toolPolicy.deny),\n\t};\n}\n\nfunction normalizeMcpServers(\n\tmcpServers: PluginAgentManifest[\"mcpServers\"],\n): PluginAgentManifest[\"mcpServers\"] {\n\tif (mcpServers === undefined) return undefined;\n\tif (typeof mcpServers === \"string\") {\n\t\treturn validatePluginRelativePath(trimString(mcpServers), \"agent.mcpServers\");\n\t}\n\tconst result: Record<string, PluginMcpServerConfig> = {};\n\tfor (const [name, config] of Object.entries(mcpServers)) {\n\t\tresult[trimString(name)] = normalizePluginMcpServerConfig(config);\n\t}\n\treturn result;\n}\n\nfunction normalizeAgentManifest(agent: PluginAgentManifest | undefined): PluginAgentManifest | undefined {\n\tif (!agent) return undefined;\n\treturn {\n\t\tsystemPrompt: agent.systemPrompt\n\t\t\t? {\n\t\t\t\t\tpromptPaths: normalizeStringArray(agent.systemPrompt.promptPaths).map((path) =>\n\t\t\t\t\t\tvalidatePluginRelativePath(path, \"agent.systemPrompt.promptPaths\"),\n\t\t\t\t\t),\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tskillPaths: normalizeStringArray(agent.skillPaths).map((path) =>\n\t\t\tvalidatePluginRelativePath(path, \"agent.skillPaths\"),\n\t\t),\n\t\tskillPresentation: normalizeSkillPresentation(agent.skillPresentation),\n\t\tmcpServers: normalizeMcpServers(agent.mcpServers),\n\t\ttoolPolicy: normalizeToolPolicy(agent.toolPolicy),\n\t\tagents: agent.agents?.map((profile) => ({\n\t\t\t...profile,\n\t\t\t// 路径都要过越界校验:manifest 里写 `../` 不该能读到插件目录之外。\n\t\t\tavatar: profile.avatar ? validatePluginRelativePath(profile.avatar, \"agent.agents.avatar\") : undefined,\n\t\t\tsystemPromptPath: profile.systemPromptPath\n\t\t\t\t? validatePluginRelativePath(profile.systemPromptPath, \"agent.agents.systemPromptPath\")\n\t\t\t\t: undefined,\n\t\t\troles: normalizeAgentRoles(profile.roles),\n\t\t})),\n\t\tteams: agent.teams?.map((team) => ({\n\t\t\t...team,\n\t\t\tworkflowPath: team.workflowPath\n\t\t\t\t? validatePluginRelativePath(team.workflowPath, \"agent.teams.workflowPath\")\n\t\t\t\t: undefined,\n\t\t\tmembers: team.members.map((member, index) => normalizeTeamMember(member, index, team.id)),\n\t\t})),\n\t};\n}\n\nfunction normalizeAgentRoles(roles: readonly string[] | undefined): string[] | undefined {\n\tif (!roles || roles.length === 0) return undefined;\n\treturn [...new Set(roles.map((role) => role.trim()))];\n}\n\n/** `<pluginId>/<agentId>` 的跨插件实体引用;本插件的引用不带斜杠。 */\nconst CROSS_PLUGIN_AGENT_REF = /^([a-z0-9][a-z0-9-]{0,63})\\/([a-z0-9][a-z0-9-]{0,63})$/;\nconst OWN_PLUGIN_AGENT_REF = /^[a-z0-9][a-z0-9-]{0,63}$/;\n\nfunction normalizeTeamMember(\n\tmember: PluginAgentTeamMemberManifest,\n\tindex: number,\n\tteamId: string,\n): PluginAgentTeamMemberManifest {\n\tconst where = `agent.teams[${teamId}].members[${index}]`;\n\tconst agent = member.agent?.trim();\n\tconst role = member.role?.trim();\n\tif ((agent ? 1 : 0) + (role ? 1 : 0) !== 1) {\n\t\tthrow new Error(`Invalid ${where}: write exactly one of \"agent\" or \"role\"`);\n\t}\n\tif (agent && !CROSS_PLUGIN_AGENT_REF.test(agent) && !OWN_PLUGIN_AGENT_REF.test(agent)) {\n\t\tthrow new Error(`Invalid ${where}.agent: expected \"<agentId>\" or \"<pluginId>/<agentId>\", got \"${agent}\"`);\n\t}\n\tif (index === 0 && (!agent || !OWN_PLUGIN_AGENT_REF.test(agent))) {\n\t\t// 队长是用户在团队会话里唯一的对话入口。允许它落在别的插件上,那个插件一卸载,这支\n\t\t// 团队就成了打不开的壳——比少一名队员严重得多,所以队长只能是本插件自己的智能体。\n\t\tthrow new Error(`Invalid ${where}: the team leader must be one of this plugin's own agents`);\n\t}\n\treturn {\n\t\t...member,\n\t\t...(agent ? { agent } : {}),\n\t\t...(role ? { role } : {}),\n\t};\n}\n\nfunction normalizeSkillPresentation(\n\tpresentation: PluginSkillPresentation | undefined,\n): PluginSkillPresentation | undefined {\n\tif (!presentation) return undefined;\n\tconst normalizeRule = (rule: PluginSkillPresentationRule): PluginSkillPresentationRule => ({\n\t\tdefaultVisibility: rule.defaultVisibility,\n\t\tsurfaces: rule.surfaces ? { ...rule.surfaces } : undefined,\n\t\tdisplayName: rule.displayName?.trim(),\n\t\tdisplayDescription: rule.displayDescription?.trim(),\n\t});\n\treturn {\n\t\tdefaultVisibility: presentation.defaultVisibility,\n\t\tsurfaces: presentation.surfaces ? { ...presentation.surfaces } : undefined,\n\t\tskills: presentation.skills\n\t\t\t? Object.fromEntries(\n\t\t\t\t\tObject.entries(presentation.skills).map(([name, rule]) => [name.trim(), normalizeRule(rule)]),\n\t\t\t\t)\n\t\t\t: undefined,\n\t};\n}\n\nfunction normalizeCliProviders(providers: PluginCliProviderManifest[] | undefined): PluginCliProviderManifest[] | undefined {\n\tif (!providers || providers.length === 0) return undefined;\n\tconst ids = new Set<string>();\n\treturn providers.map((provider) => {\n\t\tif (ids.has(provider.id)) throw new Error(`Duplicate CLI provider id: ${provider.id}`);\n\t\tids.add(provider.id);\n\t\treturn {\n\t\t\tid: provider.id,\n\t\t\tcommand: provider.command,\n\t\t\tprobe: provider.probe\n\t\t\t\t? { args: provider.probe.args ? [...provider.probe.args] : undefined, timeoutMs: provider.probe.timeoutMs }\n\t\t\t\t: undefined,\n\t\t\tinstall: {\n\t\t\t\tcommand: provider.install.command,\n\t\t\t\targs: provider.install.args ? [...provider.install.args] : undefined,\n\t\t\t\ttimeoutMs: provider.install.timeoutMs,\n\t\t\t},\n\t\t};\n\t});\n}\n\nfunction normalizeServiceProviders(\n\tproviders: PluginServiceProviderManifest[] | undefined,\n): PluginServiceProviderManifest[] | undefined {\n\tif (!providers || providers.length === 0) return undefined;\n\tconst ids = new Set<string>();\n\treturn providers.map((provider) => {\n\t\tif (ids.has(provider.id)) throw new Error(`Duplicate service provider id: ${provider.id}`);\n\t\tids.add(provider.id);\n\t\tconst runtimeKind: PluginServiceRuntimeKind = provider.runtime.kind ?? \"managed-binary\";\n\t\tconst entry = provider.runtime.entry\n\t\t\t? validatePluginRelativePath(provider.runtime.entry, `providers.services.${provider.id}.runtime.entry`)\n\t\t\t: undefined;\n\t\tif (runtimeKind === \"host-node\" && !entry) {\n\t\t\tthrow new Error(`Host-node service must declare runtime.entry: ${provider.id}`);\n\t\t}\n\t\tconst platforms: PluginServiceProviderManifest[\"runtime\"][\"platforms\"] = {};\n\t\tfor (const [platformTag, platform] of Object.entries(provider.runtime.platforms)) {\n\t\t\tconst destinations = new Set<string>();\n\t\t\tplatforms[platformTag] = {\n\t\t\t\texecutable: validatePluginRelativePath(platform.executable, `providers.services.${provider.id}.executable`),\n\t\t\t\tartifacts: platform.artifacts.map((artifact) => {\n\t\t\t\t\tconst destination = validatePluginRelativePath(\n\t\t\t\t\t\tartifact.destination,\n\t\t\t\t\t\t`providers.services.${provider.id}.artifacts.destination`,\n\t\t\t\t\t);\n\t\t\t\t\tif (destinations.has(destination)) {\n\t\t\t\t\t\tthrow new Error(`Duplicate service artifact destination: ${provider.id}/${platformTag}/${destination}`);\n\t\t\t\t\t}\n\t\t\t\t\tdestinations.add(destination);\n\t\t\t\t\treturn { ...artifact, destination };\n\t\t\t\t}),\n\t\t\t};\n\t\t}\n\t\tif (Object.keys(platforms).length === 0) {\n\t\t\tthrow new Error(`Service provider must declare at least one platform: ${provider.id}`);\n\t\t}\n\t\tconst credentialIds = new Set<string>();\n\t\tconst credentials = provider.credentials?.map((credential) => {\n\t\t\tif (credentialIds.has(credential.id)) throw new Error(`Duplicate service credential id: ${provider.id}/${credential.id}`);\n\t\t\tcredentialIds.add(credential.id);\n\t\t\treturn { id: credential.id, bytes: credential.bytes };\n\t\t});\n\t\tif (provider.health.credentialId && !credentialIds.has(provider.health.credentialId)) {\n\t\t\tthrow new Error(`Unknown service health credential: ${provider.id}/${provider.health.credentialId}`);\n\t\t}\n\t\tconst templateDestinations = new Set<string>();\n\t\tconst templates = provider.templates?.map((template) => {\n\t\t\tconst source = validatePluginRelativePath(template.source, `providers.services.${provider.id}.templates.source`);\n\t\t\tconst destination = validatePluginRelativePath(\n\t\t\t\ttemplate.destination,\n\t\t\t\t`providers.services.${provider.id}.templates.destination`,\n\t\t\t);\n\t\t\tif (templateDestinations.has(destination)) throw new Error(`Duplicate service template destination: ${provider.id}/${destination}`);\n\t\t\ttemplateDestinations.add(destination);\n\t\t\treturn { source, destination, mode: template.mode };\n\t\t});\n\t\tconst normalizedRuntime: PluginServiceProviderManifest[\"runtime\"] = {\n\t\t\tversion: provider.runtime.version,\n\t\t\tplatforms,\n\t\t\t...(runtimeKind === \"host-node\" ? { kind: runtimeKind, entry } : provider.runtime.kind ? { kind: runtimeKind } : {}),\n\t\t};\n\t\treturn {\n\t\t\tid: provider.id,\n\t\t\truntime: normalizedRuntime,\n\t\t\tcredentials,\n\t\t\ttemplates,\n\t\t\tprocess: {\n\t\t\t\targs: provider.process.args ? [...provider.process.args] : undefined,\n\t\t\t\tenv: provider.process.env ? { ...provider.process.env } : undefined,\n\t\t\t},\n\t\t\thealth: { ...provider.health },\n\t\t};\n\t});\n}\n\nfunction normalizePluginMcpServerConfig(config: PluginMcpServerConfig): PluginMcpServerConfig {\n\tconst common = {\n\t\tdisabled: config.disabled,\n\t\tautoApprove: config.autoApprove?.map(trimString),\n\t\tstartupTimeout: config.startupTimeout,\n\t\tdebug: config.debug,\n\t\tdisplayName: config.displayName,\n\t\tdescription: config.description,\n\t\tagent_mode: normalizeOptionalAgentModes(config.agent_mode),\n\t};\n\tif (config.type === \"service\") {\n\t\treturn {\n\t\t\ttype: \"service\",\n\t\t\tserviceId: trimString(config.serviceId),\n\t\t\tpath: trimString(config.path),\n\t\t\t...common,\n\t\t};\n\t}\n\tif (config.type === \"http\") {\n\t\treturn {\n\t\t\ttype: \"http\",\n\t\t\turl: trimString(config.url),\n\t\t\theaders: config.headers ? { ...config.headers } : undefined,\n\t\t\toauthClientId: config.oauthClientId,\n\t\t\toauthDeviceFlow: config.oauthDeviceFlow,\n\t\t\toauthScopes: config.oauthScopes,\n\t\t\t...common,\n\t\t};\n\t}\n\treturn {\n\t\ttype: config.type,\n\t\tcommand: trimString(config.command),\n\t\targs: config.args ? [...config.args] : undefined,\n\t\tenv: config.env ? { ...config.env } : undefined,\n\t\tcwd: config.cwd,\n\t\t...common,\n\t};\n}\n\nexport function validatePluginId(id: string): void {\n\tif (!Value.Check(PluginIdSchema, id)) {\n\t\tthrow new Error(\"Plugin id must be 1-64 chars: lowercase letters, numbers, dot, underscore, or dash\");\n\t}\n}\n\nexport function validatePluginVersion(version: string): void {\n\tif (!Value.Check(PluginVersionSchema, version)) {\n\t\tthrow new Error(\"Plugin version must be 1-64 chars and cannot contain path separators\");\n\t}\n}\n\nexport function validatePluginRelativePath(value: string, fieldName: string): string {\n\tif (value.startsWith(\"/\") || /^[a-zA-Z]:/.test(value)) {\n\t\tthrow new Error(`Invalid plugin ${fieldName}`);\n\t}\n\tconst parts: string[] = [];\n\tfor (const part of value.replace(/\\\\/g, \"/\").split(\"/\")) {\n\t\tif (part === \"\" || part === \".\") continue;\n\t\tif (part === \"..\") {\n\t\t\tif (parts.length === 0) throw new Error(`Invalid plugin ${fieldName}`);\n\t\t\tparts.pop();\n\t\t\tcontinue;\n\t\t}\n\t\tparts.push(part);\n\t}\n\tconst normalized = parts.join(\"/\");\n\tif (!normalized) throw new Error(`Invalid plugin ${fieldName}`);\n\treturn normalized;\n}\n\nexport function parsePluginCommandNames(value: unknown): string[] {\n\tif (value === undefined) return [];\n\tassertSchema(PluginCommandNamesSchema, value, \"commands\");\n\treturn Array.from(new Set(value));\n}\n\n/** @deprecated agent_mode 已无任何运行时语义(ADR-0071),保留仅为容忍既有 manifest。 */\nexport function normalizePluginAgentModes(value: unknown): string[] | undefined {\n\tif (value === undefined || value === null) return undefined;\n\tconst values = Array.isArray(value) ? value : [value];\n\tconst modes = values.map((item) => String(item).trim()).filter(Boolean);\n\treturn modes.length > 0 ? modes : undefined;\n}\n\nexport function parsePluginMcpServerConfig(name: string, raw: unknown): PluginMcpServerConfig {\n\tassertSchema(PluginMcpServerConfigSchema, raw, `MCP server '${name}'`);\n\treturn normalizePluginMcpServerConfig(raw);\n}\n\nexport function isPluginPassthroughIconRef(icon: string): boolean {\n\treturn (\n\t\ticon.startsWith(\"http://\") ||\n\t\ticon.startsWith(\"https://\") ||\n\t\t/^[a-z0-9]+(?:-[a-z0-9]+)*:[a-z0-9]+(?:-[a-z0-9]+)*$/.test(icon)\n\t);\n}\n\nexport function isPluginPackagedIconPath(icon: string): boolean {\n\treturn !isPluginPassthroughIconRef(icon);\n}\n\nexport function parsePluginManifest(raw: unknown): PluginManifest {\n\tif (typeof raw === \"object\" && raw !== null && \"runtime\" in raw) {\n\t\tthrow new Error(\n\t\t\t'Invalid plugin manifest.runtime: runtime selection is unsupported; plugins use Module Federation.',\n\t\t);\n\t}\n\tassertSchema(PluginManifestSchema, raw, \"manifest\");\n\tconst commands = parsePluginCommandNames(raw.commands);\n\tconst icon = raw.icon === undefined ? undefined : trimString(raw.icon);\n\tconst permissions = normalizePermissions(raw.permissions);\n\tconst network = normalizeNetworkManifest(raw.network);\n\tconst browser = normalizeBrowserManifest(raw.browser);\n\tif (permissions.includes(\"network.fetch\") && !network) {\n\t\tthrow new Error(\"Plugin network.allowedHosts is required with network.fetch\");\n\t}\n\tconst browserPermissions = permissions.filter((permission) => permission.startsWith(\"browser.\"));\n\tif (browserPermissions.length > 0 && !browser) {\n\t\tthrow new Error(\"Plugin browser.allowedHosts is required with browser permissions\");\n\t}\n\tif (permissions.includes(\"browser.interact\") && !permissions.includes(\"browser.read\")) {\n\t\tthrow new Error(\"Plugin browser.interact requires browser.read\");\n\t}\n\tconst normalizedServices = raw.providers ? normalizeServiceProviders(raw.providers.services) : undefined;\n\tfor (const [name, server] of Object.entries(raw.agent?.mcpServers && typeof raw.agent.mcpServers !== \"string\" ? raw.agent.mcpServers : {})) {\n\t\tif (server.type === \"service\" && !normalizedServices?.some((service) => service.id === server.serviceId)) {\n\t\t\tthrow new Error(`Plugin MCP server '${name}' references unknown service '${server.serviceId}'`);\n\t\t}\n\t}\n\treturn {\n\t\tid: raw.id,\n\t\tname: trimString(raw.name),\n\t\tversion: raw.version,\n\t\tpluginApiVersion: trimString(raw.pluginApiVersion),\n\t\tentry: validatePluginRelativePath(trimString(raw.entry), \"entry\"),\n\t\tmoduleFederation: normalizeModuleFederation(raw.moduleFederation),\n\t\tagent: normalizeAgentManifest(raw.agent),\n\t\tproviders: raw.providers\n\t\t\t? {\n\t\t\t\t\tcli: normalizeCliProviders(raw.providers.cli),\n\t\t\t\t\tservices: normalizedServices,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tstyles: normalizeStringArray(raw.styles).map((style) => validatePluginRelativePath(style, \"styles\")),\n\t\tpermissions,\n\t\tnetwork,\n\t\tbrowser,\n\t\tcommands: commands.length > 0 ? commands : undefined,\n\t\tdescription: raw.description,\n\t\tauthor: raw.author,\n\t\ticon:\n\t\t\ticon === undefined || isPluginPassthroughIconRef(icon)\n\t\t\t\t? icon\n\t\t\t\t: validatePluginRelativePath(icon, \"icon\"),\n\t\tguidingWords: raw.guidingWords?.map(trimString),\n\t\tdefaultLocale: raw.defaultLocale ?? \"zh\",\n\t\tcontributionMode: raw.contributionMode\n\t\t\t? { hardIsolation: raw.contributionMode.hardIsolation === true }\n\t\t\t: undefined,\n\t\tagent_mode: normalizePluginAgentModes(raw.agent_mode),\n\t};\n}\n\nexport function listPluginManifestResources(\n\tmanifest: PluginManifest,\n): PluginManifestResourceReference[] {\n\tconst resources: PluginManifestResourceReference[] = [\n\t\t{ field: \"entry\", path: manifest.entry, kind: \"file\" },\n\t];\n\tfor (const stylePath of manifest.styles ?? []) {\n\t\tresources.push({ field: \"styles\", path: stylePath, kind: \"file\" });\n\t}\n\tif (manifest.icon && isPluginPackagedIconPath(manifest.icon)) {\n\t\tresources.push({ field: \"icon\", path: manifest.icon, kind: \"file\" });\n\t}\n\tfor (const promptPath of manifest.agent?.systemPrompt?.promptPaths ?? []) {\n\t\tresources.push({ field: \"agent.systemPrompt.promptPaths\", path: promptPath, kind: \"file-or-directory\" });\n\t}\n\tfor (const skillPath of manifest.agent?.skillPaths ?? []) {\n\t\tresources.push({ field: \"agent.skillPaths\", path: skillPath, kind: \"file-or-directory\" });\n\t}\n\tfor (const agent of manifest.agent?.agents ?? []) {\n\t\t// 人设与头像是插件包里的真实文件:不登记就不会被打进包,装到用户机器上时这个\n\t\t// 智能体会因为「提示词读不出来」被整个跳过。\n\t\tif (agent.avatar) resources.push({ field: \"agent.agents.avatar\", path: agent.avatar, kind: \"file\" });\n\t\tif (agent.systemPromptPath) {\n\t\t\tresources.push({ field: \"agent.agents.systemPromptPath\", path: agent.systemPromptPath, kind: \"file\" });\n\t\t}\n\t}\n\tfor (const team of manifest.agent?.teams ?? []) {\n\t\tif (team.workflowPath) {\n\t\t\tresources.push({ field: \"agent.teams.workflowPath\", path: team.workflowPath, kind: \"file\" });\n\t\t}\n\t}\n\tif (typeof manifest.agent?.mcpServers === \"string\") {\n\t\tresources.push({ field: \"agent.mcpServers\", path: manifest.agent.mcpServers, kind: \"file\" });\n\t}\n\tfor (const service of manifest.providers?.services ?? []) {\n\t\tfor (const template of service.templates ?? []) {\n\t\t\tresources.push({ field: `providers.services.${service.id}.templates.source`, path: template.source, kind: \"file\" });\n\t\t}\n\t}\n\treturn resources;\n}\n\nfunction parseApiVersion(value: string): readonly [number, number, number] | undefined {\n\tconst match = /^(\\d+)\\.(\\d+)\\.(\\d+)$/.exec(value);\n\tif (!match) return undefined;\n\treturn [Number(match[1]), Number(match[2]), Number(match[3])];\n}\n\nfunction compareApiVersions(\n\tleft: readonly [number, number, number],\n\tright: readonly [number, number, number],\n): number {\n\tfor (let index = 0; index < left.length; index += 1) {\n\t\tif (left[index] !== right[index]) return left[index] - right[index];\n\t}\n\treturn 0;\n}\n\nexport function isPluginApiCompatible(hostVersion: string, range: string): boolean {\n\tconst host = parseApiVersion(hostVersion);\n\tif (!host) return false;\n\tconst normalized = range.trim();\n\tconst exact = parseApiVersion(normalized);\n\tif (exact) return exact[0] === host[0] && compareApiVersions(host, exact) >= 0;\n\tconst caret = normalized.startsWith(\"^\") ? parseApiVersion(normalized.slice(1)) : undefined;\n\tif (caret) return caret[0] === host[0] && compareApiVersions(host, caret) >= 0;\n\tif (normalized === `^${host[0]}` || normalized === `${host[0]}.x`) return true;\n\tconst minimum = normalized.startsWith(\">=\") ? parseApiVersion(normalized.slice(2)) : undefined;\n\treturn minimum !== undefined && compareApiVersions(host, minimum) >= 0;\n}\n"]}
package/docs/README.md CHANGED
@@ -4,6 +4,14 @@
4
4
 
5
5
  > 插件运行在 Vetta 桌面 App(Electron)的 renderer 进程内,与宿主共享 JavaScript realm——**没有安全沙箱**。只安装并启用你信任的插件。`@vetta-org/plugin-sdk` 权限用于声明与门控宿主 API,不承诺隔离恶意代码(见 [信任模型](#信任模型))。
6
6
 
7
+ > **这份手册是随 `@vetta-org/plugin-sdk` 装进 `node_modules` 的快照**,版本与本工程实际编译的 SDK 一致——这正是它的价值:它不会教你写宿主还不支持的东西。代价是工程不升级 SDK,它就永远停在初始化那天。开工前确认一次:
8
+ >
9
+ > ```bash
10
+ > npx vetta-plugin-cli docs --check-latest
11
+ > ```
12
+ >
13
+ > 落后就按它打印的命令升级 SDK 并重读。`docs` 的输出永远比手册和 `AGENTS.md` 新(`npx` 默认取最新的 CLI),冲突时以它为准。
14
+
7
15
  ## 文档导航
8
16
 
9
17
  | 文档 | 内容 |
@@ -69,7 +77,7 @@
69
77
  ## 信任模型
70
78
 
71
79
  - 插件按用户明确选择的**可信代码**处理,可以来自官方、市场或本地安装;宿主不把未知第三方代码自动提升为可信。
72
- - 插件跑在 renderer 进程内,经 Module Federation 与宿主**共享同一份 React / React DOM / `@vetta-org/plugin-sdk` 单例**;可选再共享 **`@vetta/ui`** 设计系统 primitives(见 [styling-and-pitfalls](./styling-and-pitfalls.md#可选vettaui-宿主-primitives))。
80
+ - 插件跑在 renderer 进程内,经 Module Federation 与宿主**共享同一份 React / React DOM / `@vetta-org/plugin-sdk` 单例**;可选再共享 **`@vetta-org/ui`** 设计系统 primitives(见 [styling-and-pitfalls](./styling-and-pitfalls.md#可选vettaui-宿主-primitives))。
73
81
  - SDK 提供宿主能力出口与权限门控,可同步传递 React 组件并读取宿主公开状态,**刻意不做** iframe/worker 沙箱与异步消息桥。
74
82
  - 每项公开能力由 `plugin.json` 声明权限、宿主单独授权、运行时校验;缺权限会抛 `Plugin permission denied: <permission>` 或 warn+noop(见 [permissions.md](./permissions.md))。这套机制服务于知情同意、治理和误用防护,不阻止同 realm 插件绕过 SDK 使用浏览器原生能力。
75
83
 
@@ -16,7 +16,7 @@ cd my-plugin && npm install
16
16
  **手册就在工程里**——它随 `@vetta-org/plugin-sdk` 一起装进 `node_modules`:
17
17
 
18
18
  ```bash
19
- npx vetta-plugin-cli docs # 打印手册目录绝对路径 + 它对应的 SDK 版本
19
+ npx vetta-plugin-cli docs # 装完依赖后可用;未装时用 npx @vetta-org/plugin-cli docs + 它对应的 SDK 版本
20
20
  ```
21
21
 
22
22
  **不要硬编码那个路径**:工作区可能把依赖提升到仓库根,一仓多插件时各插件还可能钉不同的
@@ -104,7 +104,7 @@ dist/
104
104
  }
105
105
  ```
106
106
 
107
- > `react` / `react-dom` 仅用于类型与本地构建——运行时由**宿主作为共享单例提供**,不会打进你的 bundle(见 [styling-and-pitfalls.md](./styling-and-pitfalls.md))。`@vetta-org/plugin-sdk` 同理:构建时被 external 化,运行时由宿主提供。可选 UI primitives `@vetta/ui`(`Button` / `Dialog` / `Switch`…)同样由宿主单例提供,需要时在 `devDependencies` 加类型依赖即可。仓库内插件用 `workspace:*` 直链源码;仓库外插件改用发布版本号。
107
+ > `react` / `react-dom` 仅用于类型与本地构建——运行时由**宿主作为共享单例提供**,不会打进你的 bundle(见 [styling-and-pitfalls.md](./styling-and-pitfalls.md))。`@vetta-org/plugin-sdk` 同理:构建时被 external 化,运行时由宿主提供。可选 UI primitives `@vetta-org/ui`(`Button` / `Dialog` / `Switch`…)同样由宿主单例提供,需要时在 `devDependencies` 加类型依赖即可。仓库内插件用 `workspace:*` 直链源码;仓库外插件改用发布版本号。
108
108
 
109
109
  ## 3. vite.config.ts
110
110
 
@@ -129,7 +129,7 @@ export default defineConfig({
129
129
  });
130
130
  ```
131
131
 
132
- `vettaPluginFederation` 自动:把 `react` / `react-dom` / `@vetta-org/plugin-sdk` / `@vetta/ui` 设为 `singleton`、`import:false`(用宿主的),生产构建时把 SDK 与 UI external 化,产出 `mf-manifest.json` + `remoteEntry.js`,CSS 落 `dist/style.css`。
132
+ `vettaPluginFederation` 自动:把 `react` / `react-dom` / `@vetta-org/plugin-sdk` / `@vetta-org/ui` 设为 `singleton`、`import:false`(用宿主的),生产构建时把 SDK 与 UI external 化,产出 `mf-manifest.json` + `remoteEntry.js`,CSS 落 `dist/style.css`。
133
133
 
134
134
  它还会在插件 Tailwind 编译前自动接入 plugin-sdk 的宿主主题 Token 契约,因此
135
135
  `text-foreground`、`text-muted-foreground/50`、`bg-card` 等语义类可以直接使用;
package/docs/manifest.md CHANGED
@@ -182,7 +182,7 @@ revision 读取;不要依次调用多次 `writeFile()` 冒充多文件事务
182
182
  | `agent.mcpServers` | **插件内聚 MCP**(三源聚合之插件源):相对路径 `.mcp.json` 或内联 map。需 `agent.mcp.control`。内联 map 里的 `agent_mode` 已废弃(ADR-0071),容忍存在但被忽略。 |
183
183
  | `agent.toolPolicy.allow` / `.deny` | 声明式工具可见性策略(注册后的工具 id)。需 `agent.tools.control`。 |
184
184
  | `agent.agents` | **插件贡献的智能体**:人设、头像、系统提示词由插件提供,宿主把它们铺进用户的智能体库。**不需要权限**,见[贡献智能体与团队](#贡献智能体与团队)。 |
185
- | `agent.teams` | **插件贡献的团队**:成员只能是本插件 `agent.agents` 里的智能体。同上。 |
185
+ | `agent.teams` | **插件贡献的团队**:成员可以是本插件的智能体、别的插件的智能体,或一个**角色槽位**。同上。 |
186
186
 
187
187
  > 在 JS 里**动态**注册 agent 工具走 `ctx.agent.registerTool`(见 [conversation-and-agent.md](./conversation-and-agent.md#注册-agent-工具)),与此处的**声明式**清单字段是两条不同路径。
188
188
  >
@@ -265,6 +265,7 @@ revision 读取;不要依次调用多次 `writeFile()` 冒充多文件事务
265
265
  | `systemPromptPath` / `systemPrompt` | ✅(二选一) | 人设提示词。推荐用 `systemPromptPath` 指向 Markdown:提示词值得单独 diff。内联上限 64 000 字符。 |
266
266
  | `abilities` | ❌ | `all`(默认)继承宿主全部已启用能力;`own` 只用本插件的能力。两种模式下**本插件的能力都强制激活,用户在能力面板里关不掉**——这个智能体存在的意义就是操作它自己的插件。 |
267
267
  | `legacyIds` | ❌ | 本智能体**接管**的历史 blueprint id(≤ 16 个)。见下方「接管与升级」。 |
268
+ | `roles` | ❌ | 本智能体能顶的**角色 slug**(≤ 8 个)。声明了就能被别的插件按角色引用,见下方「被别人引用」。 |
268
269
 
269
270
  ### teams[] 字段
270
271
 
@@ -272,17 +273,91 @@ revision 读取;不要依次调用多次 `writeFile()` 冒充多文件事务
272
273
  | --- | --- | --- |
273
274
  | `id` | ✅ | 规则同 agents。 |
274
275
  | `name` / `description` | `name` ✅ | 同样支持 `%key%` 占位。 |
275
- | `members` | ✅ | 1–32 `{ agent, responsibility }`。**`agent` 只能写本插件 `agent.agents` 里的 id**:跨插件引用会让一个插件能否用取决于另一个插件装没装,宿主直接拒掉这一支团队并打 warn。 |
276
+ | `members` | ✅ | 1–32 个成员,每个写 `{ agent \| role, responsibility, optional? }`。见下方「members[] 的两种引用」。 |
276
277
  | `workflow` / `workflowPath` | ❌ | 队长的团队任务书,把这支团队的固定流水线写死。 |
277
278
  | `legacyIds` | ❌ | 本团队接管的历史团队 id。 |
278
279
 
279
- **第一个成员即队长**,也是用户在团队会话里唯一的对话入口。
280
+ **第一个成员即队长**,也是用户在团队会话里唯一的对话入口。因此**队长只能是本插件自己的智能体**(写不带斜杠的 `agent`):让它落在别的插件上,那个插件一卸载这支团队就成了打不开的壳。
281
+
282
+ ### members[] 的两种引用
283
+
284
+ | 字段 | 说明 |
285
+ | --- | --- |
286
+ | `agent` | **实体引用**。`<agentId>` 指本插件的智能体;`<pluginId>/<agentId>` 指别的插件的。就是要那个人时用它。 |
287
+ | `role` | **角色槽位**。只声明「这里需要一个什么角色」,宿主在全部已启用插件里解析。 |
288
+ | `optional` | 解析不到这名成员时是否照常发布团队。缺省按引用方式走:本插件的实体引用 `false`,跨插件引用与角色槽位 `true`。 |
289
+
290
+ `agent` 与 `role` **必须恰好写一个**,写零个或两个都会在构建期失败。
291
+
292
+ **优先用角色槽位。** 实体引用把消费方钉死在一个具体的插件 id 上;角色槽位只耦合到一个角色名,提供方换人、换插件、被第三方取代都不影响你,用户还能把槽位改绑到自己调教过的智能体。
293
+
294
+ > **用到 `role` / `roles` / `optional` 的插件要把 `pluginApiVersion` 写成 `^2.2.0`。** 清单校验对未知字段 fail-closed,旧宿主会整个拒掉这份清单(不是少一项贡献);声明版本后,旧宿主给出的是「版本不支持」这种指向明确的错误。
295
+
296
+ ```json
297
+ {
298
+ "agent": {
299
+ "teams": [
300
+ {
301
+ "id": "design-team",
302
+ "name": "%team.design.name%",
303
+ "members": [
304
+ { "agent": "designer", "responsibility": "Owns the visual result end to end." },
305
+ { "role": "developer", "responsibility": "Implements the design." }
306
+ ]
307
+ }
308
+ ]
309
+ }
310
+ }
311
+ ```
312
+
313
+ ### 被别人引用(roles)
314
+
315
+ 供货方要做的只有一件事:给智能体写上 `roles`。
316
+
317
+ ```json
318
+ { "id": "developer", "name": "%agent.developer.name%", "roles": ["developer"] }
319
+ ```
320
+
321
+ 之后谁引用、引用几次,供货方都不需要知道。
322
+
323
+ #### 装机自带的智能体
324
+
325
+ 下面这些由预置插件供货,**任何一台机器上都解析得到**,可以放心引用。`role` 一列就是写进 `members[].role` 的值;想钉死某一个人,用 `agent` 列的全名。
326
+
327
+ 来自 `preset-agent`(装机自带的五位):
328
+
329
+ | role | agent | 名称 | 擅长什么 |
330
+ | --- | --- | --- | --- |
331
+ | `master` | `preset-agent/master` | 主控 | 端到端负责目标:规划流程、分派每一步、验收或打回结果 |
332
+ | `developer` | `preset-agent/developer` | 开发员 | 产出核心交付物:代码、成稿或一份做实的分析 |
333
+ | `researcher` | `preset-agent/researcher` | 检索员 | 收集事实、文档、既有方案与市场信号,并逐条核实 |
334
+ | `auditor` | `preset-agent/auditor` | 审计员 | 红队挑刺:正确性、安全、边界、回归与无依据的结论 |
335
+ | `business` | `preset-agent/business` | 业务员 | 把目标落成需求、范围与商业模式,并说清假设与风险 |
336
+
337
+ 来自 `vetta-ui-design`:
338
+
339
+ | role | agent | 名称 | 擅长什么 |
340
+ | --- | --- | --- | --- |
341
+ | `designer` | `vetta-ui-design/designer` | 设计师 | 在 Vetta 设计画布上产出界面:App 页面、落地页、幻灯片与海报 |
342
+
343
+ 这两个插件是**预置插件**,用户可以禁用但不会卸载。禁用时槽位按 `optional` 规则降级——用 `role` 引用它们的团队会少一名队员,重新启用后原样回来。
344
+
345
+ 角色词表**不是白名单**:写表外的角色照样能解析,只是团队编辑器里没有现成的槽位选择器。反过来,你的插件也可以给自己的智能体写上这几个 role,用户装了之后同一个槽位就多一个候选(本插件优先,其次按 `pluginId` 字典序)。
346
+
347
+ **解析规则**(`BUILTIN_PLUGIN_AGENT_ROLES` 在 SDK 里导出):
348
+
349
+ - 多个插件供同一个角色时,**本插件的人优先**,其次按 `pluginId` 字典序取第一个。刻意不看安装顺序——否则同一份配置在两台机器上会铺出不同的团队。
350
+ - 解析不到且 `optional`(跨插件引用与角色槽位的缺省值):**少一名队员,不是少一支团队**。
351
+ - 解析不到且必填:整支团队跳过并打 warn。
352
+ - 成员 id 由**槽位**推导,不由占槽的人推导。角色换了提供方、阵容中间插了一个人,已有成员的 id 都不会漂——它们身上挂着用户的 `@handle` 与运行时状态。
280
353
 
281
354
  ### 生命周期
282
355
 
283
356
  - **启用插件**:宿主把缺失的档案补齐——判据是「用户文档里现在有没有」,不是「历史上铺过没有」。因此用户误删、旧版本数据缺失都会被补回来。
284
357
  - **升级插件**:没被用户手改过的档案跟着提供方走(铺档案时**不落 `systemPrompt`**,人设升级才能自动生效);用户改过的字段保留。
285
358
  - **禁用插件**:档案**灰着留在原地**,既不隐藏也不从团队里摘掉,并标出「插件已禁用」。重新启用后一切原样回来——中途不动用户的档案。
359
+ - **供货方后到**:铺团队时解析不到的槽位,会在提供方装上之后**自动补进阵容**。前提是阵容还是提供方铺的那一份——用户自己加过人就整支不动,宁可少补一个也不往用户编辑过的阵容里插队。
360
+ - **跨插件引用的能力面**:别的插件的智能体自带 `pinnedPlugins`,进了你的团队就等于隐式拉起那个插件的能力,用户在能力面板里关不掉。引用之前想清楚这一点。
286
361
  - **贡献出错**:单个智能体/团队解析失败(提示词读不到、头像超限、成员引用非法)只跳过它自己并打 warn,不影响同插件的其它贡献。
287
362
 
288
363
  ### 接管与升级(legacyIds)
@@ -144,12 +144,12 @@ function Icon() {
144
144
  - `package.json` 里的 `react` 只用于类型与本地构建,别试图 bundle 一份自己的 React。
145
145
  - `@vetta-org/plugin-sdk` 同样 external,运行时由宿主提供。
146
146
 
147
- ## 可选:`@vetta/ui` 宿主 primitives
147
+ ## 可选:`@vetta-org/ui` 宿主 primitives
148
148
 
149
149
  插件**可以**直接使用宿主的设计系统 primitives,与 App chrome 对齐:
150
150
 
151
151
  ```tsx
152
- import { Button, Switch, Slider, Dialog, DialogContent, cn } from "@vetta/ui";
152
+ import { Button, Switch, Slider, Dialog, DialogContent, cn } from "@vetta-org/ui";
153
153
  ```
154
154
 
155
155
  约定:
@@ -157,20 +157,20 @@ import { Button, Switch, Slider, Dialog, DialogContent, cn } from "@vetta/ui";
157
157
  | 项 | 说明 |
158
158
  | --- | --- |
159
159
  | 运行时 | 由宿主单例提供(MF share + `vetta-host://ui`),**不要**打进插件 bundle |
160
- | 构建 | `vettaPluginFederation` 已把 `@vetta/ui` 设为 `shared.singleton + import:false`,并 rollup external |
161
- | `package.json` | 仅作类型 / 本地 tsc:`devDependencies` 里 `@vetta/ui`(仓库内 `workspace:*`,仓库外按发布版本) |
160
+ | 构建 | `vettaPluginFederation` 已把 `@vetta-org/ui` 设为 `shared.singleton + import:false`,并 rollup external |
161
+ | `package.json` | 仅作类型 / 本地 tsc:`devDependencies` 里 `@vetta-org/ui`(仓库内 `workspace:*`,仓库外按发布版本) |
162
162
  | 样式 | 组件 class 走宿主全局 token / Tailwind;插件 scoped CSS **管不到** Dialog 等 portal 到 `document.body` 的浮层(浮层依赖宿主已加载的全局样式,这是预期行为) |
163
- | 宿主版本 | 需要宿主提供 `vetta-host://ui` shim:desktop **>= 0.5.31**,且 `@vetta-org/plugin-vite` **>= 0.0.5**。旧宿主上 import `@vetta/ui` 会在加载插件时解析失败(模块找不到,整个插件不激活)——若你的插件要兼容更早的 App,就别用这条通道,自写 JSX + 语义 class |
163
+ | 宿主版本 | 需要宿主提供 `vetta-host://ui` shim:desktop **>= 0.5.31**,且 `@vetta-org/plugin-vite` **>= 0.0.5**。旧宿主上 import `@vetta-org/ui` 会在加载插件时解析失败(模块找不到,整个插件不激活)——若你的插件要兼容更早的 App,就别用这条通道,自写 JSX + 语义 class |
164
164
  | 稳定性 | **半稳定、可选**。宿主会尽量不无故破坏,但不对跨 App 大版本做 semver 承诺;props / 导出变更时官方插件随 monorepo 同改 |
165
- | 不在此列 | `@vetta/theme-ui/plugin-ui` 是独立的按需共享合同,见下节;不要从其它 `@vetta/theme-ui/*` 入口导入宿主业务 View |
165
+ | 不在此列 | `@vetta-org/theme-ui/plugin-ui` 是独立的按需共享合同,见下节;不要从其它 `@vetta-org/theme-ui/*` 入口导入宿主业务 View |
166
166
 
167
- 默认路径仍是:自写 JSX + 语义 class(`bg-background` / `text-foreground`…)。`@vetta/ui` 适合按钮、开关、对话框等控件统一,不是强制。
167
+ 默认路径仍是:自写 JSX + 语义 class(`bg-background` / `text-foreground`…)。`@vetta-org/ui` 适合按钮、开关、对话框等控件统一,不是强制。
168
168
 
169
- 顶层不要对 `@vetta/ui` 做立即求值(与 React 相同,见上文「MF 顶层 JSX 陷阱」)——在组件函数内使用即可。
169
+ 顶层不要对 `@vetta-org/ui` 做立即求值(与 React 相同,见上文「MF 顶层 JSX 陷阱」)——在组件函数内使用即可。
170
170
 
171
- ## 按需:`@vetta/theme-ui/plugin-ui` 宿主成品 UI
171
+ ## 按需:`@vetta-org/theme-ui/plugin-ui` 宿主成品 UI
172
172
 
173
- 少量经过明确审核的宿主成品组件会从窄入口 `@vetta/theme-ui/plugin-ui` 开放。
173
+ 少量经过明确审核的宿主成品组件会从窄入口 `@vetta-org/theme-ui/plugin-ui` 开放。
174
174
  它不是默认共享依赖;只有实际使用这些组件的插件才应开启:
175
175
 
176
176
  ```ts
@@ -180,10 +180,10 @@ vettaPluginFederation({
180
180
  });
181
181
  ```
182
182
 
183
- 同时在 `devDependencies` 声明基础包 `@vetta/theme-ui`(仓库内使用
183
+ 同时在 `devDependencies` 声明基础包 `@vetta-org/theme-ui`(仓库内使用
184
184
  `workspace:*`)。`hostThemeUi` 只让运行时从宿主共享域取组件,不会把 Theme UI
185
185
  打进插件 bundle。不要为了消除构建警告给未使用该入口的插件增加依赖;也不要把
186
- `@vetta/theme-ui` 的其它业务入口当作插件公共 API。
186
+ `@vetta-org/theme-ui` 的其它业务入口当作插件公共 API。
187
187
 
188
188
  ## 缓存刷新
189
189
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vetta-org/plugin-sdk",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",