/news spawns claude-code as a local subprocess (single pod, no cross-container exec on K3s); Claude delivers the digest itself via the send_to_telegram MCP tool. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
41 lines
1.4 KiB
Dart
41 lines
1.4 KiB
Dart
import 'dart:io';
|
||
|
||
class Config {
|
||
final String telegramToken;
|
||
final Set<int> allowedChatIds;
|
||
final String newsPrompt;
|
||
final int claudeTimeoutSeconds;
|
||
final String mcpConfigPath;
|
||
|
||
Config({
|
||
required this.telegramToken,
|
||
required this.allowedChatIds,
|
||
required this.newsPrompt,
|
||
required this.claudeTimeoutSeconds,
|
||
required this.mcpConfigPath,
|
||
});
|
||
|
||
factory Config.fromEnv() {
|
||
final e = Platform.environment;
|
||
final allowed = (e['ALLOWED_CHAT_IDS'] ?? '')
|
||
.split(',')
|
||
.map((s) => s.trim())
|
||
.where((s) => s.isNotEmpty)
|
||
.map(int.parse)
|
||
.toSet();
|
||
|
||
return Config(
|
||
telegramToken: e['TELEGRAM_BOT_TOKEN'] ?? '',
|
||
allowedChatIds: allowed,
|
||
newsPrompt: e['NEWS_PROMPT'] ??
|
||
'Проведи ресёрч последних новостей и трендов в области искусственного '
|
||
'интеллекта за последние 7 дней. Используй поиск в интернете. '
|
||
'Составь краткую выжимку: 5-8 пунктов, у каждого — суть в 1-2 '
|
||
'предложениях и ссылка на источник.',
|
||
claudeTimeoutSeconds:
|
||
int.tryParse(e['CLAUDE_TIMEOUT_SECONDS'] ?? '360') ?? 360,
|
||
mcpConfigPath: e['MCP_CONFIG_PATH'] ?? '/home/agent/claude-config/mcp.json',
|
||
);
|
||
}
|
||
}
|