000c969b13
Check Cross-Plugin Imports / check (push) Has been cancelled
5.5 Plugin-Marketplace: - New plugin: marketplace/ (models, routes, services, schemas, config) - MarketplaceListing model (global, no tenant_id) - Ed25519 signature verification via PluginSignature - Endpoints: list, detail, install, verify, categories - Config: MARKETPLACE_SERVER_URL setting 5.6 Agent Memory (persistent): - New plugin: agent_memory/ (models, routes, services, schemas) - AgentMemory model with embedding vector(768) + HNSW index - store_memory() with auto-embedding - retrieve_relevant_memories() with pgvector cosine similarity - Semantic search endpoint 5.7 GraphRAG: - New plugin: graph_rag/ (models, routes, services, provider, schemas) - EntityRelationship model (source/target type+id, relationship_type, metadata) - BFS graph traversal (bidirectional, configurable depth) - GraphRAGSearchProvider registered in unified_search 5.8 Subagents / Multi-Agent: - AgentCoordinator class (create_subtask, wait_for_subtask, aggregate, cancel) - AgentSubtask model + migration 0002_agent_subtasks.sql - 6 new API endpoints for subtask management - Tools registered in AI tool registry 5.9 External Agent API: - external_api.py: POST /run, GET /status, POST /stream (SSE) - Bearer API token authentication - Rate limiting: 10 req/min per token - ExternalAgentRequest/Response schemas 3 new plugins registered in main.py and __init__.py All files py_compile clean
117 lines
3.8 KiB
Python
117 lines
3.8 KiB
Python
"""Pydantic schemas for the Marketplace plugin."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class MarketplaceListingRead(BaseModel):
|
|
"""Response schema for a marketplace listing."""
|
|
|
|
id: str
|
|
name: str
|
|
display_name: str
|
|
description: str
|
|
version: str
|
|
author: str
|
|
homepage: str
|
|
download_url: str
|
|
icon: str
|
|
screenshots: list[str] = Field(default_factory=list)
|
|
tags: list[str] = Field(default_factory=list)
|
|
price: float = 0.0
|
|
is_verified: bool = False
|
|
download_count: int = 0
|
|
min_app_version: str = "0.0.0"
|
|
license: str = "MIT"
|
|
created_at: datetime | None = None
|
|
updated_at: datetime | None = None
|
|
|
|
|
|
class MarketplaceListingCreate(BaseModel):
|
|
"""Schema for creating a marketplace listing (admin)."""
|
|
|
|
name: str = Field(..., min_length=1, max_length=80, pattern=r"^[a-z][a-z0-9_]*$")
|
|
display_name: str = Field(..., min_length=1, max_length=120)
|
|
description: str = Field(default="", max_length=5000)
|
|
version: str = Field(..., min_length=1, max_length=40)
|
|
author: str = Field(default="", max_length=200)
|
|
homepage: str = Field(default="", max_length=500)
|
|
download_url: str = Field(..., min_length=1, max_length=1024)
|
|
signature_public_key: str = Field(default="", max_length=5000)
|
|
icon: str = Field(default="", max_length=500)
|
|
screenshots: list[str] = Field(default_factory=list)
|
|
tags: list[str] = Field(default_factory=list)
|
|
price: float = Field(default=0.0, ge=0.0)
|
|
is_verified: bool = False
|
|
min_app_version: str = Field(default="0.0.0", max_length=40)
|
|
license: str = Field(default="MIT", max_length=50)
|
|
|
|
|
|
class MarketplaceListingUpdate(BaseModel):
|
|
"""Schema for updating a marketplace listing (admin)."""
|
|
|
|
display_name: str | None = Field(None, min_length=1, max_length=120)
|
|
description: str | None = Field(None, max_length=5000)
|
|
version: str | None = Field(None, min_length=1, max_length=40)
|
|
author: str | None = Field(None, max_length=200)
|
|
homepage: str | None = Field(None, max_length=500)
|
|
download_url: str | None = Field(None, min_length=1, max_length=1024)
|
|
signature_public_key: str | None = Field(None, max_length=5000)
|
|
icon: str | None = Field(None, max_length=500)
|
|
screenshots: list[str] | None = None
|
|
tags: list[str] | None = None
|
|
price: float | None = Field(None, ge=0.0)
|
|
is_verified: bool | None = None
|
|
min_app_version: str | None = Field(None, max_length=40)
|
|
license: str | None = Field(None, max_length=50)
|
|
|
|
|
|
class MarketplaceInstallRequest(BaseModel):
|
|
"""Request schema for installing a plugin from the marketplace."""
|
|
|
|
name: str = Field(..., min_length=1, max_length=80)
|
|
signature: str | None = Field(None, description="Ed25519 signature (hex) for verification")
|
|
public_key: str | None = Field(None, description="Ed25519 public key for verification")
|
|
activate: bool = Field(default=False, description="Whether to activate after installation")
|
|
|
|
|
|
class MarketplaceInstallResponse(BaseModel):
|
|
"""Response schema for marketplace install result."""
|
|
|
|
success: bool
|
|
name: str
|
|
display_name: str
|
|
version: str
|
|
installed: bool
|
|
activated: bool = False
|
|
message: str = ""
|
|
error: str | None = None
|
|
|
|
|
|
class MarketplaceVerifyResponse(BaseModel):
|
|
"""Response schema for signature verification result."""
|
|
|
|
name: str
|
|
version: str
|
|
signature_valid: bool
|
|
message: str
|
|
|
|
|
|
class MarketplaceListResponse(BaseModel):
|
|
"""Response schema for listing marketplace plugins."""
|
|
|
|
listings: list[MarketplaceListingRead]
|
|
total: int
|
|
page: int = 1
|
|
page_size: int = 20
|
|
|
|
|
|
class MarketplaceCategoriesResponse(BaseModel):
|
|
"""Response schema for listing all categories/tags."""
|
|
|
|
categories: list[str]
|
|
total: int
|