wizelit-sdk 0.1.28__tar.gz → 0.1.30__tar.gz
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.
- {wizelit_sdk-0.1.28 → wizelit_sdk-0.1.30}/PKG-INFO +1 -1
- {wizelit_sdk-0.1.28 → wizelit_sdk-0.1.30}/pyproject.toml +1 -1
- {wizelit_sdk-0.1.28 → wizelit_sdk-0.1.30}/src/wizelit_sdk/agent_wrapper/agent_wrapper.py +13 -10
- {wizelit_sdk-0.1.28 → wizelit_sdk-0.1.30}/src/wizelit_sdk/agent_wrapper/job.py +4 -4
- {wizelit_sdk-0.1.28 → wizelit_sdk-0.1.30}/src/wizelit_sdk/agent_wrapper/streaming.py +2 -2
- {wizelit_sdk-0.1.28 → wizelit_sdk-0.1.30}/src/wizelit_sdk/database.py +1 -1
- {wizelit_sdk-0.1.28 → wizelit_sdk-0.1.30}/src/wizelit_sdk/models/base.py +3 -2
- {wizelit_sdk-0.1.28 → wizelit_sdk-0.1.30}/src/wizelit_sdk/models/job.py +2 -2
- {wizelit_sdk-0.1.28 → wizelit_sdk-0.1.30}/uv.lock +1 -1
- {wizelit_sdk-0.1.28 → wizelit_sdk-0.1.30}/.editorconfig +0 -0
- {wizelit_sdk-0.1.28 → wizelit_sdk-0.1.30}/.env.template +0 -0
- {wizelit_sdk-0.1.28 → wizelit_sdk-0.1.30}/.gitignore +0 -0
- {wizelit_sdk-0.1.28 → wizelit_sdk-0.1.30}/CHANGELOG.md +0 -0
- {wizelit_sdk-0.1.28 → wizelit_sdk-0.1.30}/INITIALIZATION_INSTRUCTION.MD +0 -0
- {wizelit_sdk-0.1.28 → wizelit_sdk-0.1.30}/Makefile +0 -0
- {wizelit_sdk-0.1.28 → wizelit_sdk-0.1.30}/README.md +0 -0
- {wizelit_sdk-0.1.28 → wizelit_sdk-0.1.30}/activate.sh +0 -0
- {wizelit_sdk-0.1.28 → wizelit_sdk-0.1.30}/pyrightconfig.json +0 -0
- {wizelit_sdk-0.1.28 → wizelit_sdk-0.1.30}/src/__init__.py +0 -0
- {wizelit_sdk-0.1.28 → wizelit_sdk-0.1.30}/src/wizelit_sdk/__init__.py +0 -0
- {wizelit_sdk-0.1.28 → wizelit_sdk-0.1.30}/src/wizelit_sdk/agent_wrapper/__init__.py +0 -0
- {wizelit_sdk-0.1.28 → wizelit_sdk-0.1.30}/src/wizelit_sdk/agent_wrapper/signature_validation.py +0 -0
- {wizelit_sdk-0.1.28 → wizelit_sdk-0.1.30}/src/wizelit_sdk/models/__init__.py +0 -0
- {wizelit_sdk-0.1.28 → wizelit_sdk-0.1.30}/tests/test_agent_wrapper_import.py +0 -0
- {wizelit_sdk-0.1.28 → wizelit_sdk-0.1.30}/tests/test_utils.py +0 -0
|
@@ -3,7 +3,7 @@ import asyncio
|
|
|
3
3
|
import inspect
|
|
4
4
|
import logging
|
|
5
5
|
import os
|
|
6
|
-
from typing import Callable, Any, Optional, Literal, Dict, TYPE_CHECKING, Union
|
|
6
|
+
from typing import Callable, Any, Optional, Literal, Dict, TYPE_CHECKING, Union, cast
|
|
7
7
|
from contextvars import ContextVar
|
|
8
8
|
from fastmcp import FastMCP, Context
|
|
9
9
|
from fastmcp.dependencies import CurrentContext
|
|
@@ -14,6 +14,9 @@ from wizelit_sdk.agent_wrapper.signature_validation import (
|
|
|
14
14
|
ensure_type_hints,
|
|
15
15
|
)
|
|
16
16
|
|
|
17
|
+
# Local Transport literal to avoid import issues when fastmcp.types is unavailable
|
|
18
|
+
Transport = Literal["stdio", "http", "sse", "streamable-http"]
|
|
19
|
+
|
|
17
20
|
if TYPE_CHECKING:
|
|
18
21
|
from wizelit_sdk.database import DatabaseManager
|
|
19
22
|
|
|
@@ -73,7 +76,7 @@ class WizelitAgent:
|
|
|
73
76
|
self._tools = {}
|
|
74
77
|
self._jobs: Dict[str, Job] = {} # Store jobs by job_id
|
|
75
78
|
self._host = host
|
|
76
|
-
self._transport = transport
|
|
79
|
+
self._transport: Transport = cast(Transport, transport)
|
|
77
80
|
self._port = port
|
|
78
81
|
self._db_manager = db_manager
|
|
79
82
|
self._log_streamer = None
|
|
@@ -257,9 +260,9 @@ class WizelitAgent:
|
|
|
257
260
|
)
|
|
258
261
|
|
|
259
262
|
# Set the signature with ctx as last parameter with CurrentContext() default
|
|
260
|
-
tool_wrapper.__signature__ = new_sig
|
|
261
|
-
tool_wrapper.__name__ = tool_name
|
|
262
|
-
tool_wrapper.__doc__ = tool_description
|
|
263
|
+
cast(Any, tool_wrapper).__signature__ = new_sig
|
|
264
|
+
cast(Any, tool_wrapper).__name__ = tool_name
|
|
265
|
+
cast(Any, tool_wrapper).__doc__ = tool_description
|
|
263
266
|
|
|
264
267
|
# Copy annotations and add Context
|
|
265
268
|
# Note: We don't add job annotation here since we use Any and exclude it from schema
|
|
@@ -271,7 +274,7 @@ class WizelitAgent:
|
|
|
271
274
|
new_annotations["job"] = (
|
|
272
275
|
Any # Use Any instead of Job to avoid Pydantic schema issues
|
|
273
276
|
)
|
|
274
|
-
tool_wrapper.__annotations__ = new_annotations
|
|
277
|
+
cast(Any, tool_wrapper).__annotations__ = new_annotations
|
|
275
278
|
|
|
276
279
|
# Register with fast-mcp
|
|
277
280
|
# Exclude ctx and job from schema generation since they're dependency-injected
|
|
@@ -392,7 +395,7 @@ class WizelitAgent:
|
|
|
392
395
|
|
|
393
396
|
def run(
|
|
394
397
|
self,
|
|
395
|
-
transport: Optional[
|
|
398
|
+
transport: Optional[Transport] = None,
|
|
396
399
|
host: Optional[str] = None,
|
|
397
400
|
port: Optional[int] = None,
|
|
398
401
|
**kwargs,
|
|
@@ -406,7 +409,7 @@ class WizelitAgent:
|
|
|
406
409
|
port: Port to bind to (for HTTP transports)
|
|
407
410
|
**kwargs: Additional arguments passed to fast-mcp
|
|
408
411
|
"""
|
|
409
|
-
transport = transport or self._transport
|
|
412
|
+
transport = cast(Transport, transport or self._transport)
|
|
410
413
|
host = host or self._host
|
|
411
414
|
port = port or self._port
|
|
412
415
|
print(f"🚀 Starting {self._name} MCP Server")
|
|
@@ -516,12 +519,12 @@ class WizelitAgent:
|
|
|
516
519
|
"error": job_model.error,
|
|
517
520
|
"created_at": (
|
|
518
521
|
job_model.created_at.isoformat()
|
|
519
|
-
if job_model.created_at
|
|
522
|
+
if job_model.created_at is not None
|
|
520
523
|
else None
|
|
521
524
|
),
|
|
522
525
|
"updated_at": (
|
|
523
526
|
job_model.updated_at.isoformat()
|
|
524
|
-
if job_model.updated_at
|
|
527
|
+
if job_model.updated_at is not None
|
|
525
528
|
else None
|
|
526
529
|
),
|
|
527
530
|
}
|
|
@@ -6,7 +6,7 @@ import asyncio
|
|
|
6
6
|
import uuid
|
|
7
7
|
import time
|
|
8
8
|
from datetime import datetime, UTC
|
|
9
|
-
from typing import
|
|
9
|
+
from typing import Optional, Awaitable, Any, TYPE_CHECKING
|
|
10
10
|
from fastmcp import Context
|
|
11
11
|
|
|
12
12
|
if TYPE_CHECKING:
|
|
@@ -19,7 +19,7 @@ class MemoryLogHandler(logging.Handler):
|
|
|
19
19
|
Custom logging handler that stores log messages in a list.
|
|
20
20
|
"""
|
|
21
21
|
|
|
22
|
-
def __init__(self, logs_list:
|
|
22
|
+
def __init__(self, logs_list: list[str]):
|
|
23
23
|
super().__init__()
|
|
24
24
|
self.logs_list = logs_list
|
|
25
25
|
self.setFormatter(logging.Formatter('%(message)s'))
|
|
@@ -156,7 +156,7 @@ class Job:
|
|
|
156
156
|
self._ctx = ctx
|
|
157
157
|
self._id = job_id or f"JOB-{str(uuid.uuid4())[:8]}"
|
|
158
158
|
self._status = "running"
|
|
159
|
-
self._logs:
|
|
159
|
+
self._logs: list[str] = []
|
|
160
160
|
self._result: Optional[str] = None
|
|
161
161
|
self._error: Optional[str] = None
|
|
162
162
|
self._db_manager = db_manager
|
|
@@ -176,7 +176,7 @@ class Job:
|
|
|
176
176
|
return self._logger
|
|
177
177
|
|
|
178
178
|
@property
|
|
179
|
-
def logs(self) ->
|
|
179
|
+
def logs(self) -> list[str]:
|
|
180
180
|
"""List of log messages (timestamped strings)."""
|
|
181
181
|
return self._logs
|
|
182
182
|
|
|
@@ -196,11 +196,11 @@ class LogStreamer:
|
|
|
196
196
|
self._redis = None
|
|
197
197
|
logger.info("Redis connection closed")
|
|
198
198
|
|
|
199
|
-
async def __aenter__(self):
|
|
199
|
+
async def __aenter__(self) -> 'LogStreamer':
|
|
200
200
|
"""Async context manager entry."""
|
|
201
201
|
await self._ensure_connected()
|
|
202
202
|
return self
|
|
203
203
|
|
|
204
|
-
async def __aexit__(self, exc_type, exc_val, exc_tb):
|
|
204
|
+
async def __aexit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
|
|
205
205
|
"""Async context manager exit."""
|
|
206
206
|
await self.close()
|
|
@@ -132,7 +132,7 @@ class DatabaseManager:
|
|
|
132
132
|
finally:
|
|
133
133
|
await session.close()
|
|
134
134
|
|
|
135
|
-
async def close(self):
|
|
135
|
+
async def close(self) -> None:
|
|
136
136
|
"""Dispose of the engine and close all connections."""
|
|
137
137
|
await self.engine.dispose()
|
|
138
138
|
logger.info("Database connections closed")
|
|
@@ -3,6 +3,7 @@ from sqlalchemy import Column
|
|
|
3
3
|
from sqlalchemy.dialects.postgresql import UUID
|
|
4
4
|
import uuid
|
|
5
5
|
from datetime import datetime
|
|
6
|
+
from typing import Dict, Any
|
|
6
7
|
|
|
7
8
|
Base = declarative_base()
|
|
8
9
|
|
|
@@ -10,7 +11,7 @@ class TimestampMixin:
|
|
|
10
11
|
"""Mixin for models that need timestamp functionality."""
|
|
11
12
|
|
|
12
13
|
@staticmethod
|
|
13
|
-
def get_timestamp():
|
|
14
|
+
def get_timestamp() -> str:
|
|
14
15
|
return datetime.utcnow().isoformat()
|
|
15
16
|
|
|
16
17
|
|
|
@@ -20,6 +21,6 @@ class BaseModel(Base):
|
|
|
20
21
|
|
|
21
22
|
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
|
22
23
|
|
|
23
|
-
def to_dict(self):
|
|
24
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
24
25
|
"""Convert model to dictionary."""
|
|
25
26
|
return {c.name: getattr(self, c.name) for c in self.__table__.columns}
|
|
@@ -41,7 +41,7 @@ class JobModel(BaseModel):
|
|
|
41
41
|
Index('idx_job_created_at', 'created_at'),
|
|
42
42
|
)
|
|
43
43
|
|
|
44
|
-
def __repr__(self):
|
|
44
|
+
def __repr__(self) -> str:
|
|
45
45
|
return f"<JobModel(id={self.id}, status={self.status})>"
|
|
46
46
|
|
|
47
47
|
|
|
@@ -68,5 +68,5 @@ class JobLogModel(BaseModel):
|
|
|
68
68
|
Index('idx_job_log_job_id_timestamp', 'job_id', 'timestamp'),
|
|
69
69
|
)
|
|
70
70
|
|
|
71
|
-
def __repr__(self):
|
|
71
|
+
def __repr__(self) -> str:
|
|
72
72
|
return f"<JobLogModel(id={self.id}, job_id={self.job_id}, level={self.level})>"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{wizelit_sdk-0.1.28 → wizelit_sdk-0.1.30}/src/wizelit_sdk/agent_wrapper/signature_validation.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|