mindroom 0.0.0__py3-none-any.whl → 0.1.1__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.
- mindroom/__init__.py +3 -0
- mindroom/agent_prompts.py +963 -0
- mindroom/agents.py +248 -0
- mindroom/ai.py +421 -0
- mindroom/api/__init__.py +1 -0
- mindroom/api/credentials.py +137 -0
- mindroom/api/google_integration.py +355 -0
- mindroom/api/google_tools_helper.py +40 -0
- mindroom/api/homeassistant_integration.py +421 -0
- mindroom/api/integrations.py +189 -0
- mindroom/api/main.py +506 -0
- mindroom/api/matrix_operations.py +219 -0
- mindroom/api/tools.py +94 -0
- mindroom/background_tasks.py +87 -0
- mindroom/bot.py +2470 -0
- mindroom/cli.py +86 -0
- mindroom/commands.py +377 -0
- mindroom/config.py +343 -0
- mindroom/config_commands.py +324 -0
- mindroom/config_confirmation.py +411 -0
- mindroom/constants.py +52 -0
- mindroom/credentials.py +146 -0
- mindroom/credentials_sync.py +134 -0
- mindroom/custom_tools/__init__.py +8 -0
- mindroom/custom_tools/config_manager.py +765 -0
- mindroom/custom_tools/gmail.py +92 -0
- mindroom/custom_tools/google_calendar.py +92 -0
- mindroom/custom_tools/google_sheets.py +92 -0
- mindroom/custom_tools/homeassistant.py +341 -0
- mindroom/error_handling.py +35 -0
- mindroom/file_watcher.py +49 -0
- mindroom/interactive.py +313 -0
- mindroom/logging_config.py +207 -0
- mindroom/matrix/__init__.py +1 -0
- mindroom/matrix/client.py +782 -0
- mindroom/matrix/event_info.py +173 -0
- mindroom/matrix/identity.py +149 -0
- mindroom/matrix/large_messages.py +267 -0
- mindroom/matrix/mentions.py +141 -0
- mindroom/matrix/message_builder.py +94 -0
- mindroom/matrix/message_content.py +209 -0
- mindroom/matrix/presence.py +178 -0
- mindroom/matrix/rooms.py +311 -0
- mindroom/matrix/state.py +77 -0
- mindroom/matrix/typing.py +91 -0
- mindroom/matrix/users.py +217 -0
- mindroom/memory/__init__.py +21 -0
- mindroom/memory/config.py +137 -0
- mindroom/memory/functions.py +396 -0
- mindroom/py.typed +0 -0
- mindroom/response_tracker.py +128 -0
- mindroom/room_cleanup.py +139 -0
- mindroom/routing.py +107 -0
- mindroom/scheduling.py +758 -0
- mindroom/stop.py +207 -0
- mindroom/streaming.py +203 -0
- mindroom/teams.py +749 -0
- mindroom/thread_utils.py +318 -0
- mindroom/tools/__init__.py +520 -0
- mindroom/tools/agentql.py +64 -0
- mindroom/tools/airflow.py +57 -0
- mindroom/tools/apify.py +49 -0
- mindroom/tools/arxiv.py +64 -0
- mindroom/tools/aws_lambda.py +41 -0
- mindroom/tools/aws_ses.py +57 -0
- mindroom/tools/baidusearch.py +87 -0
- mindroom/tools/brightdata.py +116 -0
- mindroom/tools/browserbase.py +62 -0
- mindroom/tools/cal_com.py +98 -0
- mindroom/tools/calculator.py +112 -0
- mindroom/tools/cartesia.py +84 -0
- mindroom/tools/composio.py +166 -0
- mindroom/tools/config_manager.py +44 -0
- mindroom/tools/confluence.py +73 -0
- mindroom/tools/crawl4ai.py +101 -0
- mindroom/tools/csv.py +104 -0
- mindroom/tools/custom_api.py +106 -0
- mindroom/tools/dalle.py +85 -0
- mindroom/tools/daytona.py +180 -0
- mindroom/tools/discord.py +81 -0
- mindroom/tools/docker.py +73 -0
- mindroom/tools/duckdb.py +124 -0
- mindroom/tools/duckduckgo.py +99 -0
- mindroom/tools/e2b.py +121 -0
- mindroom/tools/eleven_labs.py +77 -0
- mindroom/tools/email.py +74 -0
- mindroom/tools/exa.py +246 -0
- mindroom/tools/fal.py +50 -0
- mindroom/tools/file.py +80 -0
- mindroom/tools/financial_datasets_api.py +112 -0
- mindroom/tools/firecrawl.py +124 -0
- mindroom/tools/gemini.py +85 -0
- mindroom/tools/giphy.py +49 -0
- mindroom/tools/github.py +376 -0
- mindroom/tools/gmail.py +102 -0
- mindroom/tools/google_calendar.py +55 -0
- mindroom/tools/google_maps.py +112 -0
- mindroom/tools/google_sheets.py +86 -0
- mindroom/tools/googlesearch.py +83 -0
- mindroom/tools/groq.py +77 -0
- mindroom/tools/hackernews.py +54 -0
- mindroom/tools/jina.py +108 -0
- mindroom/tools/jira.py +70 -0
- mindroom/tools/linear.py +103 -0
- mindroom/tools/linkup.py +65 -0
- mindroom/tools/lumalabs.py +71 -0
- mindroom/tools/mem0.py +82 -0
- mindroom/tools/modelslabs.py +85 -0
- mindroom/tools/moviepy_video_tools.py +62 -0
- mindroom/tools/newspaper4k.py +63 -0
- mindroom/tools/openai.py +143 -0
- mindroom/tools/openweather.py +89 -0
- mindroom/tools/oxylabs.py +54 -0
- mindroom/tools/pandas.py +35 -0
- mindroom/tools/pubmed.py +64 -0
- mindroom/tools/python.py +120 -0
- mindroom/tools/reddit.py +155 -0
- mindroom/tools/replicate.py +56 -0
- mindroom/tools/resend.py +55 -0
- mindroom/tools/scrapegraph.py +87 -0
- mindroom/tools/searxng.py +120 -0
- mindroom/tools/serpapi.py +55 -0
- mindroom/tools/serper.py +81 -0
- mindroom/tools/shell.py +46 -0
- mindroom/tools/slack.py +80 -0
- mindroom/tools/sleep.py +38 -0
- mindroom/tools/spider.py +62 -0
- mindroom/tools/sql.py +138 -0
- mindroom/tools/tavily.py +104 -0
- mindroom/tools/telegram.py +54 -0
- mindroom/tools/todoist.py +103 -0
- mindroom/tools/trello.py +121 -0
- mindroom/tools/twilio.py +97 -0
- mindroom/tools/web_browser_tools.py +37 -0
- mindroom/tools/webex.py +63 -0
- mindroom/tools/website.py +45 -0
- mindroom/tools/whatsapp.py +81 -0
- mindroom/tools/wikipedia.py +45 -0
- mindroom/tools/x.py +97 -0
- mindroom/tools/yfinance.py +121 -0
- mindroom/tools/youtube.py +81 -0
- mindroom/tools/zendesk.py +62 -0
- mindroom/tools/zep.py +107 -0
- mindroom/tools/zoom.py +62 -0
- mindroom/tools_metadata.json +7643 -0
- mindroom/tools_metadata.py +220 -0
- mindroom/topic_generator.py +153 -0
- mindroom/voice_handler.py +266 -0
- mindroom-0.1.1.dist-info/METADATA +425 -0
- mindroom-0.1.1.dist-info/RECORD +152 -0
- {mindroom-0.0.0.dist-info → mindroom-0.1.1.dist-info}/WHEEL +1 -2
- mindroom-0.1.1.dist-info/entry_points.txt +2 -0
- mindroom-0.0.0.dist-info/METADATA +0 -24
- mindroom-0.0.0.dist-info/RECORD +0 -4
- mindroom-0.0.0.dist-info/top_level.txt +0 -1
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"""Sync API keys from environment variables to CredentialsManager.
|
|
2
|
+
|
|
3
|
+
This module ensures that API keys defined in .env are automatically
|
|
4
|
+
synchronized to the CredentialsManager, making .env the source of truth
|
|
5
|
+
while allowing the frontend to read the current state.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import os
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
from .credentials import get_credentials_manager
|
|
12
|
+
from .logging_config import get_logger
|
|
13
|
+
|
|
14
|
+
logger = get_logger(__name__)
|
|
15
|
+
|
|
16
|
+
# Mapping of environment variables to service names
|
|
17
|
+
ENV_TO_SERVICE_MAP = {
|
|
18
|
+
"OPENAI_API_KEY": "openai",
|
|
19
|
+
"ANTHROPIC_API_KEY": "anthropic",
|
|
20
|
+
"GOOGLE_API_KEY": "google", # Also used for Gemini
|
|
21
|
+
"OPENROUTER_API_KEY": "openrouter",
|
|
22
|
+
"DEEPSEEK_API_KEY": "deepseek",
|
|
23
|
+
"CEREBRAS_API_KEY": "cerebras",
|
|
24
|
+
"GROQ_API_KEY": "groq",
|
|
25
|
+
"OLLAMA_HOST": "ollama", # Special case: host instead of API key
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _get_secret(name: str) -> str | None:
|
|
30
|
+
"""Read a secret from NAME or NAME_FILE.
|
|
31
|
+
|
|
32
|
+
If env var `NAME` is set, return it. Otherwise, if `NAME_FILE` points to
|
|
33
|
+
a readable file, return its stripped contents. Else return None.
|
|
34
|
+
"""
|
|
35
|
+
val = os.getenv(name)
|
|
36
|
+
if val:
|
|
37
|
+
return val
|
|
38
|
+
file_var = f"{name}_FILE"
|
|
39
|
+
file_path = os.getenv(file_var)
|
|
40
|
+
if file_path and Path(file_path).exists():
|
|
41
|
+
try:
|
|
42
|
+
return Path(file_path).read_text(encoding="utf-8").strip()
|
|
43
|
+
except Exception:
|
|
44
|
+
# Avoid noisy logs here; callers can handle None gracefully
|
|
45
|
+
return None
|
|
46
|
+
return None
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def sync_env_to_credentials() -> None:
|
|
50
|
+
"""Sync API keys from environment variables to CredentialsManager.
|
|
51
|
+
|
|
52
|
+
This function reads API keys from environment variables and updates
|
|
53
|
+
the CredentialsManager with any new or changed values. This ensures
|
|
54
|
+
that .env remains the source of truth while making keys available
|
|
55
|
+
to the frontend.
|
|
56
|
+
"""
|
|
57
|
+
creds_manager = get_credentials_manager()
|
|
58
|
+
updated_count = 0
|
|
59
|
+
|
|
60
|
+
for env_var, service in ENV_TO_SERVICE_MAP.items():
|
|
61
|
+
# Prefer file-based secrets if provided (NAME_FILE), fallback to NAME
|
|
62
|
+
env_value = _get_secret(env_var)
|
|
63
|
+
|
|
64
|
+
if not env_value:
|
|
65
|
+
logger.debug(f"No value found for {env_var} or {env_var}_FILE")
|
|
66
|
+
continue
|
|
67
|
+
|
|
68
|
+
logger.debug(f"Found value for {env_var}: length={len(env_value)}")
|
|
69
|
+
|
|
70
|
+
# Special handling for Ollama (it's a host, not an API key)
|
|
71
|
+
if service == "ollama":
|
|
72
|
+
current_creds = creds_manager.load_credentials(service) or {}
|
|
73
|
+
if current_creds.get("host") != env_value:
|
|
74
|
+
current_creds["host"] = env_value
|
|
75
|
+
creds_manager.save_credentials(service, current_creds)
|
|
76
|
+
logger.info(f"Updated {service} host from environment")
|
|
77
|
+
updated_count += 1
|
|
78
|
+
else:
|
|
79
|
+
# Regular API key handling
|
|
80
|
+
current_key = creds_manager.get_api_key(service)
|
|
81
|
+
if env_value and current_key != env_value:
|
|
82
|
+
creds_manager.set_api_key(service, env_value)
|
|
83
|
+
logger.info(f"Updated {service} API key from environment")
|
|
84
|
+
updated_count += 1
|
|
85
|
+
|
|
86
|
+
# Also set the environment variable directly for libraries that need it
|
|
87
|
+
# This ensures mem0 and other libraries can access the keys
|
|
88
|
+
if env_value:
|
|
89
|
+
os.environ[env_var] = env_value
|
|
90
|
+
|
|
91
|
+
if updated_count > 0:
|
|
92
|
+
logger.info(f"Synchronized {updated_count} credentials from environment")
|
|
93
|
+
else:
|
|
94
|
+
logger.debug("All credentials already in sync with environment")
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def get_api_key_for_provider(provider: str) -> str | None:
|
|
98
|
+
"""Get API key for a provider, checking CredentialsManager first.
|
|
99
|
+
|
|
100
|
+
Since we sync from .env to CredentialsManager on startup,
|
|
101
|
+
CredentialsManager will always have the latest keys from .env.
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
provider: The provider name (e.g., 'openai', 'anthropic')
|
|
105
|
+
|
|
106
|
+
Returns:
|
|
107
|
+
The API key if found, None otherwise
|
|
108
|
+
|
|
109
|
+
"""
|
|
110
|
+
creds_manager = get_credentials_manager()
|
|
111
|
+
|
|
112
|
+
# Special case for Ollama - return None as it doesn't use API keys
|
|
113
|
+
if provider == "ollama":
|
|
114
|
+
return None
|
|
115
|
+
|
|
116
|
+
# For Google/Gemini, both use the same key
|
|
117
|
+
if provider == "gemini":
|
|
118
|
+
provider = "google"
|
|
119
|
+
|
|
120
|
+
return creds_manager.get_api_key(provider)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def get_ollama_host() -> str | None:
|
|
124
|
+
"""Get Ollama host configuration.
|
|
125
|
+
|
|
126
|
+
Returns:
|
|
127
|
+
The Ollama host URL if configured, None otherwise
|
|
128
|
+
|
|
129
|
+
"""
|
|
130
|
+
creds_manager = get_credentials_manager()
|
|
131
|
+
ollama_creds = creds_manager.load_credentials("ollama")
|
|
132
|
+
if ollama_creds:
|
|
133
|
+
return ollama_creds.get("host")
|
|
134
|
+
return None
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""MindRoom custom tools package."""
|
|
2
|
+
|
|
3
|
+
from .gmail import GmailTools
|
|
4
|
+
from .google_calendar import GoogleCalendarTools
|
|
5
|
+
from .google_sheets import GoogleSheetsTools
|
|
6
|
+
from .homeassistant import HomeAssistantTools
|
|
7
|
+
|
|
8
|
+
__all__ = ["GmailTools", "GoogleCalendarTools", "GoogleSheetsTools", "HomeAssistantTools"]
|