You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.3 KiB
Python
60 lines
1.3 KiB
Python
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
from enum import Enum
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class ServiceName(str, Enum):
|
|
PRODUCT = "product"
|
|
ADMIN = "admin"
|
|
|
|
|
|
class ToolLifecycleStatus(str, Enum):
|
|
DRAFT = "draft"
|
|
GENERATED = "generated"
|
|
VALIDATED = "validated"
|
|
APPROVED = "approved"
|
|
ACTIVE = "active"
|
|
FAILED = "failed"
|
|
ARCHIVED = "archived"
|
|
|
|
|
|
class ToolParameterType(str, Enum):
|
|
STRING = "string"
|
|
INTEGER = "integer"
|
|
NUMBER = "number"
|
|
BOOLEAN = "boolean"
|
|
OBJECT = "object"
|
|
ARRAY = "array"
|
|
|
|
|
|
class ToolParameterContract(BaseModel):
|
|
name: str
|
|
parameter_type: ToolParameterType
|
|
description: str
|
|
required: bool = True
|
|
|
|
|
|
class PublishedToolContract(BaseModel):
|
|
tool_name: str
|
|
display_name: str
|
|
description: str
|
|
version: int = Field(ge=1)
|
|
status: ToolLifecycleStatus
|
|
parameters: tuple[ToolParameterContract, ...] = ()
|
|
implementation_module: str
|
|
implementation_callable: str
|
|
checksum: str | None = None
|
|
published_at: datetime | None = None
|
|
published_by: str | None = None
|
|
|
|
|
|
class ToolPublicationEnvelope(BaseModel):
|
|
source_service: ServiceName = ServiceName.ADMIN
|
|
target_service: ServiceName = ServiceName.PRODUCT
|
|
publication_id: str
|
|
published_tool: PublishedToolContract
|
|
emitted_at: datetime
|