manifest.schema.json 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. {
  2. "$schema": "https://json-schema.org/draft/2020-12/schema",
  3. "$id": "https://sub2api.local/schemas/plugin-manifest-v1.json",
  4. "title": "Sub2API Plugin Manifest v1",
  5. "type": "object",
  6. "additionalProperties": false,
  7. "required": ["schema_version", "id", "name", "version", "requires", "capabilities", "runtimes", "ui", "files"],
  8. "properties": {
  9. "schema_version": { "const": 1 },
  10. "id": { "type": "string", "maxLength": 160, "pattern": "^[a-z0-9]+([._-][a-z0-9]+)+$" },
  11. "name": { "type": "string", "minLength": 1, "maxLength": 160 },
  12. "version": { "type": "string", "pattern": "^v?(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(-[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?$" },
  13. "description": { "type": "string" },
  14. "author": { "type": "string", "maxLength": 160 },
  15. "requires": {
  16. "type": "object",
  17. "additionalProperties": false,
  18. "required": ["sub2api", "plugin_protocol", "transport_api", "ui_bridge"],
  19. "properties": {
  20. "sub2api": { "type": "string", "minLength": 1 },
  21. "recommended_sub2api_version": { "type": "string" },
  22. "tested_sub2api_versions": { "type": "array", "items": { "type": "string" }, "uniqueItems": true },
  23. "plugin_protocol": { "const": 1 },
  24. "transport_api": { "const": 1 },
  25. "ui_bridge": { "const": 1 }
  26. }
  27. },
  28. "capabilities": {
  29. "type": "array",
  30. "minItems": 1,
  31. "items": {
  32. "type": "object",
  33. "additionalProperties": false,
  34. "required": ["id", "platform", "account_type"],
  35. "properties": {
  36. "id": { "const": "openai.oauth.outbound_transport.v1" },
  37. "platform": { "const": "openai" },
  38. "account_type": { "const": "oauth" }
  39. }
  40. }
  41. },
  42. "runtimes": {
  43. "type": "object",
  44. "minProperties": 1,
  45. "patternProperties": {
  46. "^[a-z0-9]+-[a-z0-9]+$": {
  47. "type": "object",
  48. "additionalProperties": false,
  49. "required": ["path"],
  50. "properties": { "path": { "$ref": "#/$defs/safePath" } }
  51. }
  52. },
  53. "additionalProperties": false
  54. },
  55. "ui": {
  56. "type": "object",
  57. "additionalProperties": false,
  58. "required": ["entrypoint"],
  59. "properties": { "entrypoint": { "type": "string", "pattern": "^ui/.+" } }
  60. },
  61. "files": {
  62. "type": "object",
  63. "minProperties": 2,
  64. "propertyNames": { "$ref": "#/$defs/safePath" },
  65. "additionalProperties": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
  66. }
  67. },
  68. "$defs": {
  69. "safePath": {
  70. "type": "string",
  71. "minLength": 1,
  72. "pattern": "^(?!/)(?!.*(?:^|/)\\.\\.(?:/|$))(?!.*\\\\).+$"
  73. }
  74. }
  75. }