agy-pilot 0.1.0__py3-none-any.whl
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.
- agy_pilot/__init__.py +3 -0
- agy_pilot/adapters/__init__.py +6 -0
- agy_pilot/adapters/base.py +33 -0
- agy_pilot/adapters/registry.py +45 -0
- agy_pilot/adapters/telegram/__init__.py +30 -0
- agy_pilot/adapters/telegram/adapter.py +934 -0
- agy_pilot/adapters/telegram/heartbeat.py +87 -0
- agy_pilot/adapters/telegram/keyboards.py +300 -0
- agy_pilot/adapters/telegram/middleware.py +48 -0
- agy_pilot/bot.py +38 -0
- agy_pilot/cli.py +339 -0
- agy_pilot/config.py +118 -0
- agy_pilot/controller.py +585 -0
- agy_pilot/discovery.py +152 -0
- agy_pilot/heartbeat.py +85 -0
- agy_pilot/service.py +310 -0
- agy_pilot/skills.py +216 -0
- agy_pilot/storage.py +115 -0
- agy_pilot/transcript.py +434 -0
- agy_pilot-0.1.0.dist-info/METADATA +299 -0
- agy_pilot-0.1.0.dist-info/RECORD +24 -0
- agy_pilot-0.1.0.dist-info/WHEEL +4 -0
- agy_pilot-0.1.0.dist-info/entry_points.txt +3 -0
- agy_pilot-0.1.0.dist-info/licenses/LICENSE +21 -0
agy_pilot/__init__.py
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from abc import ABC, abstractmethod
|
|
4
|
+
from typing import TYPE_CHECKING
|
|
5
|
+
|
|
6
|
+
if TYPE_CHECKING:
|
|
7
|
+
from agy_pilot.config import Config
|
|
8
|
+
from agy_pilot.controller import Antigravity2Controller
|
|
9
|
+
from agy_pilot.storage import SessionStore
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class BaseIMAdapter(ABC):
|
|
13
|
+
"""Abstract Base Class for Instant Messaging adapters/plugins (Telegram, Discord, Slack, etc.)."""
|
|
14
|
+
|
|
15
|
+
def __init__(
|
|
16
|
+
self,
|
|
17
|
+
config: Config,
|
|
18
|
+
controller: Antigravity2Controller,
|
|
19
|
+
store: SessionStore,
|
|
20
|
+
) -> None:
|
|
21
|
+
self.config = config
|
|
22
|
+
self.controller = controller
|
|
23
|
+
self.store = store
|
|
24
|
+
|
|
25
|
+
@abstractmethod
|
|
26
|
+
async def start(self) -> None:
|
|
27
|
+
"""Start listening for incoming messages or polling events."""
|
|
28
|
+
...
|
|
29
|
+
|
|
30
|
+
@abstractmethod
|
|
31
|
+
async def stop(self) -> None:
|
|
32
|
+
"""Gracefully shut down the adapter."""
|
|
33
|
+
...
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import TYPE_CHECKING, Callable, Type
|
|
4
|
+
|
|
5
|
+
from .base import BaseIMAdapter
|
|
6
|
+
|
|
7
|
+
if TYPE_CHECKING:
|
|
8
|
+
from agy_pilot.config import Config
|
|
9
|
+
from agy_pilot.controller import Antigravity2Controller
|
|
10
|
+
from agy_pilot.storage import SessionStore
|
|
11
|
+
|
|
12
|
+
AdapterFactory = Callable[
|
|
13
|
+
["Config", "Antigravity2Controller", "SessionStore"],
|
|
14
|
+
BaseIMAdapter,
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
_ADAPTER_REGISTRY: dict[str, AdapterFactory] = {}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def register_adapter(name: str, factory_or_cls: Type[BaseIMAdapter] | AdapterFactory) -> None:
|
|
21
|
+
"""Register an IM adapter factory or class by name."""
|
|
22
|
+
_ADAPTER_REGISTRY[name.lower()] = factory_or_cls
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def get_adapter(
|
|
26
|
+
name: str,
|
|
27
|
+
config: Config,
|
|
28
|
+
controller: Antigravity2Controller,
|
|
29
|
+
store: SessionStore,
|
|
30
|
+
) -> BaseIMAdapter:
|
|
31
|
+
"""Retrieve and instantiate an IM adapter by name."""
|
|
32
|
+
normalized_name = name.lower()
|
|
33
|
+
|
|
34
|
+
# Lazy-register default built-in adapters if not already present
|
|
35
|
+
if normalized_name == "telegram" and "telegram" not in _ADAPTER_REGISTRY:
|
|
36
|
+
from .telegram import TelegramAdapter
|
|
37
|
+
register_adapter("telegram", TelegramAdapter)
|
|
38
|
+
|
|
39
|
+
factory = _ADAPTER_REGISTRY.get(normalized_name)
|
|
40
|
+
if not factory:
|
|
41
|
+
available = ", ".join(_ADAPTER_REGISTRY.keys()) or "telegram"
|
|
42
|
+
raise ValueError(
|
|
43
|
+
f"Unsupported IM adapter '{name}'. Available adapters: {available}"
|
|
44
|
+
)
|
|
45
|
+
return factory(config, controller, store)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from .adapter import QueueItem, TelegramAdapter, TelegramBridge, split_message_chunks
|
|
4
|
+
from .heartbeat import StatusHeartbeat
|
|
5
|
+
from .keyboards import (
|
|
6
|
+
build_conversations_keyboard,
|
|
7
|
+
build_interaction_keyboard,
|
|
8
|
+
build_project_actions_keyboard,
|
|
9
|
+
build_projects_keyboard,
|
|
10
|
+
build_skill_detail_keyboard,
|
|
11
|
+
build_skills_keyboard,
|
|
12
|
+
format_switch_message_and_keyboard,
|
|
13
|
+
)
|
|
14
|
+
from .middleware import AuthMiddleware
|
|
15
|
+
|
|
16
|
+
__all__ = [
|
|
17
|
+
"TelegramAdapter",
|
|
18
|
+
"TelegramBridge",
|
|
19
|
+
"QueueItem",
|
|
20
|
+
"split_message_chunks",
|
|
21
|
+
"StatusHeartbeat",
|
|
22
|
+
"AuthMiddleware",
|
|
23
|
+
"build_projects_keyboard",
|
|
24
|
+
"build_project_actions_keyboard",
|
|
25
|
+
"build_conversations_keyboard",
|
|
26
|
+
"build_skills_keyboard",
|
|
27
|
+
"build_skill_detail_keyboard",
|
|
28
|
+
"format_switch_message_and_keyboard",
|
|
29
|
+
"build_interaction_keyboard",
|
|
30
|
+
]
|