@vetta-org/plugin-sdk 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.d.ts +0 -12
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js.map +1 -1
- package/dist/ai.d.ts +13 -0
- package/dist/ai.d.ts.map +1 -1
- package/dist/ai.js.map +1 -1
- package/dist/app-actions.d.ts +0 -1
- package/dist/app-actions.d.ts.map +1 -1
- package/dist/app-actions.js.map +1 -1
- package/dist/cli-provider.d.ts +18 -0
- package/dist/cli-provider.d.ts.map +1 -0
- package/dist/cli-provider.js +2 -0
- package/dist/cli-provider.js.map +1 -0
- package/dist/context.d.ts +13 -2
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js.map +1 -1
- package/dist/index.d.ts +10 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/manifest-schema.d.ts +454 -51
- package/dist/manifest-schema.d.ts.map +1 -1
- package/dist/manifest-schema.js +139 -33
- package/dist/manifest-schema.js.map +1 -1
- package/dist/manifest.d.ts +2 -2
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +164 -38
- package/dist/manifest.js.map +1 -1
- package/dist/models.d.ts +35 -0
- package/dist/models.d.ts.map +1 -0
- package/dist/models.js +2 -0
- package/dist/models.js.map +1 -0
- package/dist/ocr.d.ts +78 -0
- package/dist/ocr.d.ts.map +1 -0
- package/dist/ocr.js +2 -0
- package/dist/ocr.js.map +1 -0
- package/dist/official.d.ts +1 -0
- package/dist/official.d.ts.map +1 -1
- package/dist/official.js.map +1 -1
- package/dist/permissions.d.ts +1 -1
- package/dist/permissions.d.ts.map +1 -1
- package/dist/permissions.js +8 -0
- package/dist/permissions.js.map +1 -1
- package/dist/secrets.d.ts +27 -0
- package/dist/secrets.d.ts.map +1 -0
- package/dist/secrets.js +2 -0
- package/dist/secrets.js.map +1 -0
- package/dist/service-provider.d.ts +62 -0
- package/dist/service-provider.d.ts.map +1 -0
- package/dist/service-provider.js +2 -0
- package/dist/service-provider.js.map +1 -0
- package/dist/storage.d.ts +39 -6
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +8 -1
- package/dist/storage.js.map +1 -1
- package/dist/ui.d.ts +118 -7
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js.map +1 -1
- package/package.json +2 -1
- package/dist/settings.d.ts +0 -13
- package/dist/settings.d.ts.map +0 -1
- package/dist/settings.js +0 -2
- package/dist/settings.js.map +0 -1
|
@@ -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;AAKtD,eAAO,MAAM,cAAc,qCAKzB,CAAC;AAEH,eAAO,MAAM,mBAAmB,qCAK9B,CAAC;AAEH,eAAO,MAAM,uBAAuB,qCAKlC,CAAC;AAEH,eAAO,MAAM,wBAAwB,yEAAsC,CAAC;AAE5E,eAAO,MAAM,2BAA2B;;EAQvC,CAAC;AAEF,eAAO,MAAM,2BAA2B;;EAQvC,CAAC;AAEF,eAAO,MAAM,sBAAsB,gxCAGlC,CAAC;AAgDF,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;IAGxC,CAAC;AAYH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;EAU5C,CAAC;AAEF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;EAW3C,CAAC;AAEF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGtC,CAAC;AAQH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuBrC,CAAC;AAEF,eAAO,MAAM,oCAAoC;;;EAMhD,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4ChC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAC/E,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAC/E,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC3E,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 { 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\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 PluginSettingBaseProperties = {\n\tkey: NonWhitespaceStringSchema,\n\tdescription: Type.Optional(Type.String()),\n\tdefault: Type.Optional(Type.Union([Type.String(), Type.Number(), Type.Boolean()])),\n\tenum: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\tvisibleWhen: Type.Optional(\n\t\tType.Object(\n\t\t\t{\n\t\t\t\tkey: NonWhitespaceStringSchema,\n\t\t\t\tin: Type.Array(NonWhitespaceStringSchema),\n\t\t\t},\n\t\t\t{ additionalProperties: true },\n\t\t),\n\t),\n};\n\nconst PluginInputSettingSchema = Type.Object(\n\t{\n\t\t...PluginSettingBaseProperties,\n\t\ttype: Type.Union([\n\t\t\tType.Literal(\"string\"),\n\t\t\tType.Literal(\"number\"),\n\t\t\tType.Literal(\"boolean\"),\n\t\t\tType.Literal(\"enum\"),\n\t\t\tType.Literal(\"secret\"),\n\t\t]),\n\t\ttitle: NonWhitespaceStringSchema,\n\t},\n\t{ additionalProperties: true },\n);\n\nconst PluginDescriptionSettingSchema = Type.Object(\n\t{\n\t\t...PluginSettingBaseProperties,\n\t\ttype: Type.Literal(\"desc\"),\n\t\ttitle: Type.Optional(Type.String()),\n\t},\n\t{ additionalProperties: true },\n);\n\nexport const PluginSettingDefinitionSchema = Type.Union([\n\tPluginInputSettingSchema,\n\tPluginDescriptionSettingSchema,\n]);\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\nexport const PluginMcpServerConfigSchema = Type.Union([\n\tPluginMcpStdioServerConfigSchema,\n\tPluginMcpHttpServerConfigSchema,\n]);\n\nconst PluginMcpServerMapSchema = Type.Record(\n\tType.String({ pattern: NON_WHITESPACE_PATTERN }),\n\tPluginMcpServerConfigSchema,\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\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\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\tcontributes: Type.Optional(\n\t\t\tType.Object(\n\t\t\t\t{\n\t\t\t\t\tsettings: Type.Optional(Type.Array(PluginSettingDefinitionSchema)),\n\t\t\t\t},\n\t\t\t\t{ additionalProperties: true },\n\t\t\t),\n\t\t),\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 PluginSettingSchema = Static<typeof PluginSettingDefinitionSchema>;\nexport type PluginMcpServerConfig = Static<typeof PluginMcpServerConfigSchema>;\nexport type PluginAgentManifest = Static<typeof PluginAgentManifestSchema>;\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,eAAO,MAAM,mBAAmB,qCAK9B,CAAC;AAEH,eAAO,MAAM,uBAAuB,qCAKlC,CAAC;AAEH,eAAO,MAAM,wBAAwB,yEAAsC,CAAC;AAW5E,eAAO,MAAM,+B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AM,MAAM,uBAAuB,GAAG,MAAM,CAAC,OAAO,6BAA6B,CAAC,CAAC;AACnF,MAAM,MAAM,2BAA2B,GAAG,MAAM,CAAC,OAAO,iCAAiC,CAAC,CAAC;AAC3F,MAAM,MAAM,yBAAyB,GAAG,MAAM,CAAC,OAAO,+BAA+B,CAAC,CAAC;AACvF,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,6BAA6B,GAAG,MAAM,CAAC,OAAO,mCAAmC,CAAC,CAAC;AAC/F,MAAM,MAAM,wBAAwB,GAAG,gBAAgB,GAAG,WAAW,CAAC;AACtE,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,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"]}
|
package/dist/manifest-schema.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import { SkillSurfaceVisibilitySchema, SkillVisibilitySchema } from "@vetta-org/capability-sdk";
|
|
2
3
|
import { PLUGIN_PERMISSIONS } from "./permissions.js";
|
|
3
4
|
const NON_WHITESPACE_PATTERN = "\\S";
|
|
4
5
|
export const PluginIdSchema = Type.String({
|
|
@@ -20,6 +21,70 @@ export const PluginCommandNameSchema = Type.String({
|
|
|
20
21
|
description: "Bare executable name declared by the plugin.",
|
|
21
22
|
});
|
|
22
23
|
export const PluginCommandNamesSchema = Type.Array(PluginCommandNameSchema);
|
|
24
|
+
const PluginCliCommandSchema = Type.Object({
|
|
25
|
+
command: PluginCommandNameSchema,
|
|
26
|
+
args: Type.Optional(Type.Array(Type.String(), { maxItems: 64 })),
|
|
27
|
+
timeoutMs: Type.Optional(Type.Number({ minimum: 1_000, maximum: 30 * 60_000 })),
|
|
28
|
+
}, { additionalProperties: false });
|
|
29
|
+
export const PluginCliProviderManifestSchema = Type.Object({
|
|
30
|
+
id: PluginIdSchema,
|
|
31
|
+
command: PluginCommandNameSchema,
|
|
32
|
+
probe: Type.Optional(Type.Object({
|
|
33
|
+
args: Type.Optional(Type.Array(Type.String(), { maxItems: 64 })),
|
|
34
|
+
timeoutMs: Type.Optional(Type.Number({ minimum: 1_000, maximum: 120_000 })),
|
|
35
|
+
}, { additionalProperties: false })),
|
|
36
|
+
install: PluginCliCommandSchema,
|
|
37
|
+
}, { additionalProperties: false });
|
|
38
|
+
const PluginServiceArchiveSchema = Type.Union([
|
|
39
|
+
Type.Literal("file"),
|
|
40
|
+
Type.Literal("zip"),
|
|
41
|
+
Type.Literal("tar.gz"),
|
|
42
|
+
]);
|
|
43
|
+
export const PluginServiceArtifactSchema = Type.Object({
|
|
44
|
+
sha256: Type.String({ pattern: "^[a-f0-9]{64}$" }),
|
|
45
|
+
archive: PluginServiceArchiveSchema,
|
|
46
|
+
/** Relative file (archive=file) or directory (archive=zip/tar.gz) below the managed runtime root. */
|
|
47
|
+
destination: Type.String({ minLength: 1, maxLength: 512 }),
|
|
48
|
+
}, { additionalProperties: false });
|
|
49
|
+
export const PluginServicePlatformSchema = Type.Object({
|
|
50
|
+
executable: Type.String({ minLength: 1, maxLength: 512 }),
|
|
51
|
+
artifacts: Type.Array(PluginServiceArtifactSchema, { minItems: 1, maxItems: 8 }),
|
|
52
|
+
}, { additionalProperties: false });
|
|
53
|
+
export const PluginServiceProviderManifestSchema = Type.Object({
|
|
54
|
+
id: PluginIdSchema,
|
|
55
|
+
runtime: Type.Object({
|
|
56
|
+
/** `managed-binary` is the backwards-compatible default. */
|
|
57
|
+
kind: Type.Optional(Type.Union([Type.Literal("managed-binary"), Type.Literal("host-node")])),
|
|
58
|
+
version: PluginVersionSchema,
|
|
59
|
+
/** Entry script relative to the installed runtime (required for host-node). */
|
|
60
|
+
entry: Type.Optional(Type.String({ minLength: 1, maxLength: 512 })),
|
|
61
|
+
platforms: Type.Record(Type.String({ pattern: "^(win32|darwin|linux)-(x64|arm64)$" }), PluginServicePlatformSchema),
|
|
62
|
+
}, { additionalProperties: false }),
|
|
63
|
+
credentials: Type.Optional(Type.Array(Type.Object({
|
|
64
|
+
id: PluginIdSchema,
|
|
65
|
+
bytes: Type.Optional(Type.Integer({ minimum: 16, maximum: 64 })),
|
|
66
|
+
}, { additionalProperties: false }), { minItems: 1, maxItems: 8 })),
|
|
67
|
+
templates: Type.Optional(Type.Array(Type.Object({
|
|
68
|
+
source: Type.String({ minLength: 1, maxLength: 512 }),
|
|
69
|
+
destination: Type.String({ minLength: 1, maxLength: 512 }),
|
|
70
|
+
/** create preserves a data file; render regenerates a cache file on every start. */
|
|
71
|
+
mode: Type.Union([Type.Literal("create"), Type.Literal("render")]),
|
|
72
|
+
}, { additionalProperties: false }), { minItems: 1, maxItems: 16 })),
|
|
73
|
+
process: Type.Object({
|
|
74
|
+
args: Type.Optional(Type.Array(Type.String(), { maxItems: 64 })),
|
|
75
|
+
env: Type.Optional(Type.Record(Type.String({ minLength: 1 }), Type.String())),
|
|
76
|
+
}, { additionalProperties: false }),
|
|
77
|
+
health: Type.Object({
|
|
78
|
+
path: Type.String({ minLength: 1, maxLength: 1_024, pattern: "^/[^/]*" }),
|
|
79
|
+
credentialId: Type.Optional(PluginIdSchema),
|
|
80
|
+
timeoutMs: Type.Optional(Type.Integer({ minimum: 1_000, maximum: 120_000 })),
|
|
81
|
+
readiness: Type.Optional(Type.Object({ mode: Type.Literal("plugin") }, { additionalProperties: false })),
|
|
82
|
+
}, { additionalProperties: false }),
|
|
83
|
+
}, { additionalProperties: false });
|
|
84
|
+
export const PluginProvidersManifestSchema = Type.Object({
|
|
85
|
+
cli: Type.Optional(Type.Array(PluginCliProviderManifestSchema, { minItems: 1, maxItems: 16 })),
|
|
86
|
+
services: Type.Optional(Type.Array(PluginServiceProviderManifestSchema, { minItems: 1, maxItems: 8 })),
|
|
87
|
+
}, { additionalProperties: false });
|
|
23
88
|
export const PluginNetworkManifestSchema = Type.Object({
|
|
24
89
|
allowedHosts: Type.Array(Type.String({ minLength: 1, maxLength: 253, pattern: NON_WHITESPACE_PATTERN }), {
|
|
25
90
|
minItems: 1,
|
|
@@ -36,36 +101,6 @@ export const PluginPermissionSchema = Type.Union(PLUGIN_PERMISSIONS.map((permiss
|
|
|
36
101
|
const NonWhitespaceStringSchema = Type.String({ pattern: NON_WHITESPACE_PATTERN });
|
|
37
102
|
const OptionalAgentModesSchema = Type.Optional(Type.Union([NonWhitespaceStringSchema, Type.Array(NonWhitespaceStringSchema)]));
|
|
38
103
|
const StringRecordSchema = Type.Record(Type.String(), Type.String());
|
|
39
|
-
const PluginSettingBaseProperties = {
|
|
40
|
-
key: NonWhitespaceStringSchema,
|
|
41
|
-
description: Type.Optional(Type.String()),
|
|
42
|
-
default: Type.Optional(Type.Union([Type.String(), Type.Number(), Type.Boolean()])),
|
|
43
|
-
enum: Type.Optional(Type.Array(NonWhitespaceStringSchema)),
|
|
44
|
-
visibleWhen: Type.Optional(Type.Object({
|
|
45
|
-
key: NonWhitespaceStringSchema,
|
|
46
|
-
in: Type.Array(NonWhitespaceStringSchema),
|
|
47
|
-
}, { additionalProperties: true })),
|
|
48
|
-
};
|
|
49
|
-
const PluginInputSettingSchema = Type.Object({
|
|
50
|
-
...PluginSettingBaseProperties,
|
|
51
|
-
type: Type.Union([
|
|
52
|
-
Type.Literal("string"),
|
|
53
|
-
Type.Literal("number"),
|
|
54
|
-
Type.Literal("boolean"),
|
|
55
|
-
Type.Literal("enum"),
|
|
56
|
-
Type.Literal("secret"),
|
|
57
|
-
]),
|
|
58
|
-
title: NonWhitespaceStringSchema,
|
|
59
|
-
}, { additionalProperties: true });
|
|
60
|
-
const PluginDescriptionSettingSchema = Type.Object({
|
|
61
|
-
...PluginSettingBaseProperties,
|
|
62
|
-
type: Type.Literal("desc"),
|
|
63
|
-
title: Type.Optional(Type.String()),
|
|
64
|
-
}, { additionalProperties: true });
|
|
65
|
-
export const PluginSettingDefinitionSchema = Type.Union([
|
|
66
|
-
PluginInputSettingSchema,
|
|
67
|
-
PluginDescriptionSettingSchema,
|
|
68
|
-
]);
|
|
69
104
|
const PluginMcpCommonProperties = {
|
|
70
105
|
disabled: Type.Optional(Type.Boolean()),
|
|
71
106
|
autoApprove: Type.Optional(Type.Array(NonWhitespaceStringSchema)),
|
|
@@ -92,16 +127,89 @@ export const PluginMcpHttpServerConfigSchema = Type.Object({
|
|
|
92
127
|
oauthDeviceFlow: Type.Optional(Type.Boolean()),
|
|
93
128
|
oauthScopes: Type.Optional(Type.String()),
|
|
94
129
|
}, { additionalProperties: true });
|
|
130
|
+
/** HTTP MCP served by one of this plugin's managed local services. */
|
|
131
|
+
export const PluginMcpServiceServerConfigSchema = Type.Object({
|
|
132
|
+
...PluginMcpCommonProperties,
|
|
133
|
+
type: Type.Literal("service"),
|
|
134
|
+
serviceId: PluginIdSchema,
|
|
135
|
+
path: Type.String({ pattern: "^/[^/]*" }),
|
|
136
|
+
}, { additionalProperties: true });
|
|
95
137
|
export const PluginMcpServerConfigSchema = Type.Union([
|
|
96
138
|
PluginMcpStdioServerConfigSchema,
|
|
97
139
|
PluginMcpHttpServerConfigSchema,
|
|
140
|
+
PluginMcpServiceServerConfigSchema,
|
|
98
141
|
]);
|
|
99
142
|
const PluginMcpServerMapSchema = Type.Record(Type.String({ pattern: NON_WHITESPACE_PATTERN }), PluginMcpServerConfigSchema, { additionalProperties: false });
|
|
143
|
+
export const PluginSkillPresentationRuleSchema = Type.Object({
|
|
144
|
+
defaultVisibility: Type.Optional(SkillVisibilitySchema),
|
|
145
|
+
surfaces: Type.Optional(SkillSurfaceVisibilitySchema),
|
|
146
|
+
displayName: Type.Optional(NonWhitespaceStringSchema),
|
|
147
|
+
displayDescription: Type.Optional(NonWhitespaceStringSchema),
|
|
148
|
+
}, { additionalProperties: false });
|
|
149
|
+
export const PluginSkillPresentationSchema = Type.Object({
|
|
150
|
+
defaultVisibility: Type.Optional(SkillVisibilitySchema),
|
|
151
|
+
surfaces: Type.Optional(SkillSurfaceVisibilitySchema),
|
|
152
|
+
skills: Type.Optional(Type.Record(NonWhitespaceStringSchema, PluginSkillPresentationRuleSchema)),
|
|
153
|
+
}, { additionalProperties: false });
|
|
154
|
+
/** 插件贡献的智能体(blueprint)。人设、头像、职责都由插件提供,宿主只负责铺档案。 */
|
|
155
|
+
export const PluginAgentProfileManifestSchema = Type.Object({
|
|
156
|
+
/** 插件内唯一;全局 id 由宿主拼成 `plugin:<pluginId>:<id>`。 */
|
|
157
|
+
id: Type.String({ pattern: "^[a-z0-9][a-z0-9-]{0,63}$" }),
|
|
158
|
+
/** 支持 `%key%` 占位,按插件 locales 解析。 */
|
|
159
|
+
name: NonWhitespaceStringSchema,
|
|
160
|
+
description: Type.Optional(Type.String({ maxLength: 2_000 })),
|
|
161
|
+
/** @ 提及用的短名;缺省用 `id`。 */
|
|
162
|
+
mentionHandle: Type.Optional(Type.String({ pattern: "^[a-z0-9][a-z0-9-]{0,63}$" })),
|
|
163
|
+
/** 插件包内的相对路径,指向头像图片。 */
|
|
164
|
+
avatar: Type.Optional(NonWhitespaceStringSchema),
|
|
165
|
+
/** 插件包内的相对路径,指向系统提示词 Markdown。与 `systemPrompt` 二选一。 */
|
|
166
|
+
systemPromptPath: Type.Optional(NonWhitespaceStringSchema),
|
|
167
|
+
systemPrompt: Type.Optional(Type.String({ maxLength: 64_000 })),
|
|
168
|
+
/**
|
|
169
|
+
* `all`(默认)继承宿主全部已启用能力;`own` 只用本插件的能力。
|
|
170
|
+
* 两种模式下本插件的能力都强制激活,用户关不掉。
|
|
171
|
+
*/
|
|
172
|
+
abilities: Type.Optional(Type.Union([Type.Literal("all"), Type.Literal("own")])),
|
|
173
|
+
/**
|
|
174
|
+
* 本智能体接管的历史 blueprint id。
|
|
175
|
+
*
|
|
176
|
+
* 用于「人设从别处迁进插件」:宿主解析不到这些 id 时折算到本智能体,回填时也据此
|
|
177
|
+
* 认领用户已有的同角色档案,而不是再铺一份新的。宿主因此不必知道是哪个插件接管了
|
|
178
|
+
* 哪个老角色。
|
|
179
|
+
*/
|
|
180
|
+
legacyIds: Type.Optional(Type.Array(NonWhitespaceStringSchema, { maxItems: 16 })),
|
|
181
|
+
}, { additionalProperties: false });
|
|
182
|
+
/**
|
|
183
|
+
* 插件贡献的团队成员。
|
|
184
|
+
*
|
|
185
|
+
* `agent` 只能写本插件 `agents[]` 里的智能体 id。刻意不支持引用别的插件——那会让一个插件的
|
|
186
|
+
* 可用性取决于另一个插件是否安装;宿主也没有内置人设可引用,装机自带的那几位同样由预置
|
|
187
|
+
* 插件提供。引用不到的成员会让这一支团队整体被跳过。
|
|
188
|
+
*/
|
|
189
|
+
export const PluginAgentTeamMemberManifestSchema = Type.Object({
|
|
190
|
+
agent: NonWhitespaceStringSchema,
|
|
191
|
+
responsibility: Type.String({ maxLength: 2_000 }),
|
|
192
|
+
}, { additionalProperties: false });
|
|
193
|
+
/** 插件贡献的团队。第一个成员即队长,也是用户在会话里唯一的对话入口。 */
|
|
194
|
+
export const PluginAgentTeamManifestSchema = Type.Object({
|
|
195
|
+
id: Type.String({ pattern: "^[a-z0-9][a-z0-9-]{0,63}$" }),
|
|
196
|
+
name: NonWhitespaceStringSchema,
|
|
197
|
+
description: Type.Optional(Type.String({ maxLength: 2_000 })),
|
|
198
|
+
members: Type.Array(PluginAgentTeamMemberManifestSchema, { minItems: 1, maxItems: 32 }),
|
|
199
|
+
/** 队长的团队任务书:把这支团队的固定流水线写死。与 `workflowPath` 二选一。 */
|
|
200
|
+
workflow: Type.Optional(Type.String({ maxLength: 64_000 })),
|
|
201
|
+
workflowPath: Type.Optional(NonWhitespaceStringSchema),
|
|
202
|
+
/** 本团队接管的历史团队 id,语义同 `agents[].legacyIds`。 */
|
|
203
|
+
legacyIds: Type.Optional(Type.Array(NonWhitespaceStringSchema, { maxItems: 16 })),
|
|
204
|
+
}, { additionalProperties: false });
|
|
100
205
|
export const PluginAgentManifestSchema = Type.Object({
|
|
101
206
|
systemPrompt: Type.Optional(Type.Object({
|
|
102
207
|
promptPaths: Type.Optional(Type.Array(NonWhitespaceStringSchema)),
|
|
103
208
|
}, { additionalProperties: true })),
|
|
104
209
|
skillPaths: Type.Optional(Type.Array(NonWhitespaceStringSchema)),
|
|
210
|
+
skillPresentation: Type.Optional(PluginSkillPresentationSchema),
|
|
211
|
+
agents: Type.Optional(Type.Array(PluginAgentProfileManifestSchema, { maxItems: 32 })),
|
|
212
|
+
teams: Type.Optional(Type.Array(PluginAgentTeamManifestSchema, { maxItems: 32 })),
|
|
105
213
|
mcpServers: Type.Optional(Type.Union([NonWhitespaceStringSchema, PluginMcpServerMapSchema])),
|
|
106
214
|
toolPolicy: Type.Optional(Type.Object({
|
|
107
215
|
allow: Type.Optional(Type.Array(NonWhitespaceStringSchema)),
|
|
@@ -120,14 +228,12 @@ export const PluginManifestSchema = Type.Object({
|
|
|
120
228
|
entry: NonWhitespaceStringSchema,
|
|
121
229
|
moduleFederation: PluginModuleFederationManifestSchema,
|
|
122
230
|
agent: Type.Optional(PluginAgentManifestSchema),
|
|
231
|
+
providers: Type.Optional(PluginProvidersManifestSchema),
|
|
123
232
|
styles: Type.Optional(Type.Array(NonWhitespaceStringSchema)),
|
|
124
233
|
permissions: Type.Optional(Type.Array(PluginPermissionSchema)),
|
|
125
234
|
network: Type.Optional(PluginNetworkManifestSchema),
|
|
126
235
|
browser: Type.Optional(PluginBrowserManifestSchema),
|
|
127
236
|
commands: Type.Optional(PluginCommandNamesSchema),
|
|
128
|
-
contributes: Type.Optional(Type.Object({
|
|
129
|
-
settings: Type.Optional(Type.Array(PluginSettingDefinitionSchema)),
|
|
130
|
-
}, { additionalProperties: true })),
|
|
131
237
|
description: Type.Optional(Type.String()),
|
|
132
238
|
author: Type.Optional(Type.String()),
|
|
133
239
|
icon: Type.Optional(NonWhitespaceStringSchema),
|
|
@@ -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,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;IAC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B,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 { 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\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 PluginSettingBaseProperties = {\n\tkey: NonWhitespaceStringSchema,\n\tdescription: Type.Optional(Type.String()),\n\tdefault: Type.Optional(Type.Union([Type.String(), Type.Number(), Type.Boolean()])),\n\tenum: Type.Optional(Type.Array(NonWhitespaceStringSchema)),\n\tvisibleWhen: Type.Optional(\n\t\tType.Object(\n\t\t\t{\n\t\t\t\tkey: NonWhitespaceStringSchema,\n\t\t\t\tin: Type.Array(NonWhitespaceStringSchema),\n\t\t\t},\n\t\t\t{ additionalProperties: true },\n\t\t),\n\t),\n};\n\nconst PluginInputSettingSchema = Type.Object(\n\t{\n\t\t...PluginSettingBaseProperties,\n\t\ttype: Type.Union([\n\t\t\tType.Literal(\"string\"),\n\t\t\tType.Literal(\"number\"),\n\t\t\tType.Literal(\"boolean\"),\n\t\t\tType.Literal(\"enum\"),\n\t\t\tType.Literal(\"secret\"),\n\t\t]),\n\t\ttitle: NonWhitespaceStringSchema,\n\t},\n\t{ additionalProperties: true },\n);\n\nconst PluginDescriptionSettingSchema = Type.Object(\n\t{\n\t\t...PluginSettingBaseProperties,\n\t\ttype: Type.Literal(\"desc\"),\n\t\ttitle: Type.Optional(Type.String()),\n\t},\n\t{ additionalProperties: true },\n);\n\nexport const PluginSettingDefinitionSchema = Type.Union([\n\tPluginInputSettingSchema,\n\tPluginDescriptionSettingSchema,\n]);\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\nexport const PluginMcpServerConfigSchema = Type.Union([\n\tPluginMcpStdioServerConfigSchema,\n\tPluginMcpHttpServerConfigSchema,\n]);\n\nconst PluginMcpServerMapSchema = Type.Record(\n\tType.String({ pattern: NON_WHITESPACE_PATTERN }),\n\tPluginMcpServerConfigSchema,\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\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\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\tcontributes: Type.Optional(\n\t\t\tType.Object(\n\t\t\t\t{\n\t\t\t\t\tsettings: Type.Optional(Type.Array(PluginSettingDefinitionSchema)),\n\t\t\t\t},\n\t\t\t\t{ additionalProperties: true },\n\t\t\t),\n\t\t),\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 PluginSettingSchema = Static<typeof PluginSettingDefinitionSchema>;\nexport type PluginMcpServerConfig = Static<typeof PluginMcpServerConfigSchema>;\nexport type PluginAgentManifest = Static<typeof PluginAgentManifestSchema>;\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,SA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AAC;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/** 插件贡献的智能体(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"]}
|
package/dist/manifest.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type PluginManifest, type PluginMcpServerConfig } from "./manifest-schema.js";
|
|
2
|
-
export { PluginAgentManifestSchema, PluginBrowserManifestSchema, PluginCommandNameSchema, PluginCommandNamesSchema, PluginIdSchema, PluginManifestSchema, PluginMcpHttpServerConfigSchema, PluginMcpServerConfigSchema, PluginMcpStdioServerConfigSchema, PluginModuleFederationManifestSchema, PluginNetworkManifestSchema,
|
|
3
|
-
export type { PluginAgentManifest, PluginBrowserManifest, PluginManifest, PluginManifestInput, PluginMcpServerConfig,
|
|
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";
|
|
4
4
|
export { PLUGIN_PERMISSIONS } from "./permissions.js";
|
|
5
5
|
export type { PluginPermission } from "./permissions.js";
|
|
6
6
|
export interface PluginManifestResourceReference {
|
package/dist/manifest.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAGA,OAAO,EASN,KAAK,cAAc,EAEnB,KAAK,qBAAqB,EAG1B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACN,yBAAyB,EACzB,2BAA2B,EAC3B,uBAAuB,EACvB,wBAAwB,EACxB,cAAc,EACd,oBAAoB,EACpB,+BAA+B,EAC/B,2BAA2B,EAC3B,gCAAgC,EAChC,oCAAoC,EACpC,2BAA2B,EAC3B,sBAAsB,EACtB,6BAA6B,EAC7B,mBAAmB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACX,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,MAAM,WAAW,+BAA+B;IAC/C,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,mBAAmB,CAAC;CACnC;AAuMD,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAIjD;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAI3D;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAiBnF;AAED,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,CAsDhE;AAED,wBAAgB,2BAA2B,CAC1C,QAAQ,EAAE,cAAc,GACtB,+BAA+B,EAAE,CAoBnC;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\tPluginIdSchema,\n\tPluginManifestSchema,\n\tPluginMcpServerConfigSchema,\n\tPluginVersionSchema,\n\ttype PluginAgentManifest,\n\ttype PluginBrowserManifest,\n\ttype PluginManifest,\n\ttype PluginManifestInput,\n\ttype PluginMcpServerConfig,\n\ttype PluginNetworkManifest,\n\ttype PluginSettingSchema,\n} from \"./manifest-schema.js\";\nimport { PLUGIN_PERMISSIONS, type PluginPermission } from \"./permissions.js\";\n\nexport {\n\tPluginAgentManifestSchema,\n\tPluginBrowserManifestSchema,\n\tPluginCommandNameSchema,\n\tPluginCommandNamesSchema,\n\tPluginIdSchema,\n\tPluginManifestSchema,\n\tPluginMcpHttpServerConfigSchema,\n\tPluginMcpServerConfigSchema,\n\tPluginMcpStdioServerConfigSchema,\n\tPluginModuleFederationManifestSchema,\n\tPluginNetworkManifestSchema,\n\tPluginPermissionSchema,\n\tPluginSettingDefinitionSchema,\n\tPluginVersionSchema,\n} from \"./manifest-schema.js\";\nexport type {\n\tPluginAgentManifest,\n\tPluginBrowserManifest,\n\tPluginManifest,\n\tPluginManifestInput,\n\tPluginMcpServerConfig,\n\tPluginNetworkManifest,\n\tPluginSettingSchema,\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 normalizeSetting(setting: PluginSettingSchema): PluginSettingSchema {\n\tconst common = {\n\t\tkey: trimString(setting.key),\n\t\tdescription: setting.description,\n\t\tdefault: setting.default,\n\t\tenum: setting.enum?.map(trimString),\n\t\tvisibleWhen: setting.visibleWhen\n\t\t\t? {\n\t\t\t\t\tkey: trimString(setting.visibleWhen.key),\n\t\t\t\t\tin: setting.visibleWhen.in.map(trimString),\n\t\t\t\t}\n\t\t\t: undefined,\n\t};\n\tif (setting.type === \"desc\") {\n\t\treturn {\n\t\t\t...common,\n\t\t\ttype: \"desc\",\n\t\t\ttitle: setting.title === undefined ? undefined : trimString(setting.title),\n\t\t};\n\t}\n\treturn {\n\t\t...common,\n\t\ttype: setting.type,\n\t\ttitle: trimString(setting.title),\n\t};\n}\n\nfunction normalizeSettings(settings: PluginSettingSchema[] | undefined): PluginSettingSchema[] | undefined {\n\tif (!settings || settings.length === 0) return undefined;\n\treturn settings.map(normalizeSetting);\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\tmcpServers: normalizeMcpServers(agent.mcpServers),\n\t\ttoolPolicy: normalizeToolPolicy(agent.toolPolicy),\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 === \"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\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\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\tcontributes: raw.contributes\n\t\t\t? (() => {\n\t\t\t\t\tconst settings = normalizeSettings(raw.contributes.settings);\n\t\t\t\t\treturn settings ? { settings } : undefined;\n\t\t\t\t})()\n\t\t\t: 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\tif (typeof manifest.agent?.mcpServers === \"string\") {\n\t\tresources.push({ field: \"agent.mcpServers\", path: manifest.agent.mcpServers, kind: \"file\" });\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,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,kC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,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\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"]}
|