chore: sync

This commit is contained in:
知微
2026-07-20 21:43:03 +08:00
parent c01c6cd266
commit 3eb214f3a6
3 changed files with 696 additions and 648 deletions
File diff suppressed because it is too large Load Diff
@@ -50,6 +50,9 @@ REGISTRY = [
{"module": "gateway_llm", "function": "LLM调用链可用(gateway agent.log)",
"check": {"type": "agent_log", "max_age_min": 30, "when": "always"},
"repair": {"action": "llm_diagnose"}},
{"module": "sense_ocr", "function": "识图服务(SenseNova OCR配置+API可达)",
"check": {"type": "ocr_health", "when": "always"},
"repair": {"action": "llm_diagnose"}},
{"module": "xmpp_bot", "function": "XMPP消息收发(bot journal)",
"check": {"type": "bot_activity", "when": "always"},
"repair": {"action": "llm_diagnose"}},
@@ -127,6 +130,31 @@ def check_bot_activity(chk, now):
return "fail", f"检查失败: {e}"
def check_ocr_health(chk, now):
"""识图服务健康:OCR 配置存在 + SenseNova API 可达(TCP 443)。
不发真实 OCR 请求(省钱),真实端到端验证走 K 测试。"""
import json as _json, socket
# 1. OCR 配置存在且含 key
cfg_path = '/home/hmo/.config/mofin/ocr_config.json'
if not os.path.exists(cfg_path):
return "fail", "OCR 配置文件不存在: /home/hmo/.config/mofin/ocr_config.json"
try:
cfg = _json.load(open(cfg_path))
if not cfg.get('key') or not cfg.get('base_url'):
return "fail", "OCR 配置缺 key 或 base_url"
except Exception as e:
return "fail", f"OCR 配置解析失败: {str(e)[:60]}"
# 2. SenseNova API TCP 可达
try:
host = cfg['base_url'].split('//')[1].split('/')[0].split(':')[0]
port = int(cfg['base_url'].split('//')[1].split('/')[0].split(':')[1]) if ':' in cfg['base_url'].split('//')[1].split('/')[0] else 443
s = socket.create_connection((host, port), timeout=5)
s.close()
except Exception as e:
return "fail", f"SenseNova API 不可达 ({host}): {str(e)[:60]}"
return "ok", f"配置 OK + {host}:{port} 可达"
def check_cron_engine(chk, now):
"""cron 引擎:最近 max_age_min 内是否有任何 job 运行过"""
try:
@@ -180,6 +208,8 @@ def main():
status, reason = check_agent_log(chk, now)
elif t == "bot_activity":
status, reason = check_bot_activity(chk, now)
elif t == "ocr_health":
status, reason = check_ocr_health(chk, now)
elif t == "cron_engine":
status, reason = check_cron_engine(chk, now)
else:
+143 -143
View File
@@ -1,5 +1,5 @@
{
"generated_at": "2026-07-20 21:15:58",
"generated_at": "2026-07-20 21:30:05",
"feature_tree": {
"label": "MoFin 系统",
"status": "ok",
@@ -161,7 +161,7 @@
"script": "stale_detector.py",
"schedule": "0 21 * * 1-5",
"status": "ok",
"last_run": "2026-07-17T21:18",
"last_run": "2026-07-20T21:17",
"type": "LLM",
"profile": "position-analyst"
},
@@ -537,7 +537,7 @@
"script": "mofin_health.py",
"schedule": "*/15 9-16,20-22 * * 1-5",
"status": "ok",
"last_run": "2026-07-20T21:01",
"last_run": "2026-07-20T21:16",
"type": "no_agent",
"profile": "position-analyst"
}
@@ -624,7 +624,7 @@
"script": "self_todo_executor.py",
"schedule": "*/10 8-22 * * 1-5",
"status": "ok",
"last_run": "2026-07-20T21:10",
"last_run": "2026-07-20T21:20",
"type": "no_agent",
"profile": "position-analyst"
}
@@ -885,7 +885,7 @@
"script": "fix_gateway_port.py",
"schedule": "every 10m",
"status": "ok",
"last_run": "2026-07-20T21:13",
"last_run": "2026-07-20T21:24",
"type": "no_agent",
"profile": "position-analyst"
}
@@ -917,7 +917,7 @@
"script": "functional_health_check.py",
"schedule": "*/15 9-16,20-22 * * 1-5",
"status": "ok",
"last_run": "2026-07-20T21:00",
"last_run": "2026-07-20T21:15",
"type": "no_agent",
"profile": "position-analyst"
}
@@ -1081,14 +1081,14 @@
"rows": 185,
"readers": [
"promote_candidates",
"mofin_db",
"candidate_filter",
"mofin_db",
"accumulation_scanner"
],
"writers": [
"market_scanner",
"promote_candidates",
"candidate_filter",
"market_scanner",
"accumulation_scanner"
],
"has_input": true,
@@ -1113,9 +1113,9 @@
"rows": 1,
"readers": [
"per_stock_reassess",
"batch_reassess",
"mofin_db",
"merge_third_db",
"batch_reassess"
"merge_third_db"
],
"writers": [
"mofin_db",
@@ -1145,8 +1145,8 @@
"prepare_report_data"
],
"writers": [
"mofin_db",
"mo_data"
"mo_data",
"mofin_db"
],
"has_input": true,
"has_output": true,
@@ -1195,25 +1195,25 @@
"desc": "每只股票的完整策略参数",
"rows": 227,
"readers": [
"run_all_tests",
"system_audit",
"capital_flow_collector",
"verify_300308",
"strategy_lifecycle",
"watchlist_auto_exit",
"mofin_db",
"verify_reassess_pipeline",
"mofin_collect",
"promote_candidates",
"check_db_state",
"data_governance",
"promote_candidates"
"watchlist_auto_exit",
"mo_data",
"price_monitor",
"generate_report",
"system_health_check",
"sync_decisions_to_db"
],
"writers": [
"mofin_db",
"per_stock_reassess",
"data_governance",
"promote_candidates",
"data_governance",
"sync_decisions_to_db",
"batch_reassess",
"watchlist_auto_exit",
"sync_decisions_to_db"
"per_stock_reassess",
"mofin_db"
],
"has_input": true,
"has_output": true,
@@ -1241,21 +1241,21 @@
"desc": "当前持仓(权威源)",
"rows": 14,
"readers": [
"mofin_collect",
"prepare_recommendation",
"mo_data",
"price_monitor",
"system_health_check",
"run_all_tests",
"xiaoguo_signal_consumer",
"system_audit",
"capital_flow_collector",
"strategy_lifecycle",
"mofin_db",
"server",
"trend_detector",
"refresh_mtf_cache",
"prepare_report_data",
"mofin_collect"
"capital_flow_collector",
"per_stock_reassess"
],
"writers": [
"mofin_db",
"import_holding_xls",
"price_monitor"
"price_monitor",
"import_holding_xls"
],
"has_input": true,
"has_output": true,
@@ -1283,18 +1283,18 @@
"desc": "所有持仓+自选最新实时价",
"rows": 232,
"readers": [
"mofin_db",
"stale_push_wlin",
"generate_report",
"verify_reassess_pipeline",
"candidate_filter",
"system_audit",
"cron_health_monitor",
"mo_data",
"generate_report"
"mofin_db",
"system_audit"
],
"writers": [
"mofin_db",
"mo_data",
"mofin_db",
"price_monitor"
],
"has_input": true,
@@ -1321,15 +1321,15 @@
"desc": "宏观上下文(大盘偏向/指数)",
"rows": 81,
"readers": [
"divergence_detector",
"xiaoguo_signal_consumer",
"system_audit",
"stock_profile",
"strategy_tree",
"per_stock_reassess",
"stale_push_wlin",
"divergence_detector",
"batch_reassess",
"stock_profile",
"strategy_lifecycle",
"stale_push_wlin"
"per_stock_reassess",
"system_audit",
"xiaoguo_signal_consumer"
],
"writers": [
"refresh_macro_context"
@@ -1384,14 +1384,14 @@
"desc": "大盘指数快照(每10分)",
"rows": 989,
"readers": [
"mofin_db",
"merge_third_db",
"system_audit",
"trend_detector",
"prepare_report_data",
"mofin_query",
"market_screener",
"market_scanner"
"trend_detector",
"mofin_query",
"market_scanner",
"prepare_report_data",
"merge_third_db",
"mofin_db",
"system_audit"
],
"writers": [
"mofin_db",
@@ -1420,13 +1420,13 @@
"desc": "多周期均线缓存",
"rows": 64,
"readers": [
"multi_timeframe",
"mofin_db",
"technical_analysis"
"technical_analysis",
"multi_timeframe"
],
"writers": [
"multi_timeframe",
"mofin_db"
"mofin_db",
"multi_timeframe"
],
"has_input": true,
"has_output": true,
@@ -1451,18 +1451,18 @@
"desc": "总资产/现金/仓位汇总",
"rows": 1,
"readers": [
"mofin_db",
"mo_data",
"prepare_report_data",
"preflight_verify",
"price_monitor",
"check_db_state",
"import_holding_xls"
"prepare_report_data",
"price_monitor",
"import_holding_xls",
"mo_data",
"preflight_verify",
"mofin_db"
],
"writers": [
"mofin_db",
"import_holding_xls",
"price_monitor"
"price_monitor",
"import_holding_xls"
],
"has_input": true,
"has_output": true,
@@ -1489,21 +1489,21 @@
"desc": "价格区间突破事件日志",
"rows": 6353,
"readers": [
"backfill_price_events",
"mofin_db",
"test_db_only",
"test_dual_write",
"test_raw_insert",
"check_price_events",
"test_dual_write",
"mofin_db",
"test_db_write",
"check_price_events"
"test_db_only",
"backfill_price_events"
],
"writers": [
"backfill_price_events",
"mofin_db",
"test_dual_write",
"test_db_only",
"test_raw_insert",
"test_db_write"
"test_dual_write",
"mofin_db",
"test_db_write",
"test_db_only",
"backfill_price_events"
],
"has_input": true,
"has_output": true,
@@ -1525,15 +1525,15 @@
"desc": "行业信号(趋势检测产出)",
"rows": 653,
"readers": [
"trend_detector",
"xiaoguo_news_processor",
"server",
"mofin_news",
"server"
"trend_detector"
],
"writers": [
"trend_detector",
"xiaoguo_news_processor",
"mofin_news"
"mofin_news",
"trend_detector"
],
"has_input": true,
"has_output": true,
@@ -1560,13 +1560,13 @@
"desc": "行业板块数据",
"rows": 68408,
"readers": [
"mofin_db",
"inspect_third_db",
"merge_third_db",
"trend_detector",
"strategy_lifecycle",
"market_screener",
"market_scanner"
"trend_detector",
"market_scanner",
"merge_third_db",
"inspect_third_db",
"strategy_lifecycle",
"mofin_db"
],
"writers": [
"mofin_db",
@@ -1595,22 +1595,22 @@
"desc": "信号相关新闻",
"rows": 1287,
"readers": [
"macro_signal_consumer",
"intraday_health_check",
"xiaoguo_signal_consumer",
"server",
"system_audit",
"per_stock_reassess",
"batch_reassess",
"macro_signal_consumer"
"per_stock_reassess",
"system_audit",
"xiaoguo_signal_consumer"
],
"writers": [
"divergence_detector",
"xiaoguo_signal_consumer",
"xiaoguo_scanner",
"macro_signal_consumer",
"mofin_news",
"divergence_detector",
"xiaoguo_news_processor",
"macro_context_collector",
"macro_signal_consumer",
"xiaoguo_scanner"
"xiaoguo_signal_consumer"
],
"has_input": true,
"has_output": true,
@@ -1726,12 +1726,12 @@
"desc": "股票行业映射",
"rows": 64,
"readers": [
"mofin_db",
"trend_detector",
"per_stock_reassess",
"mofin_news",
"xiaoguo_news_processor",
"strategy_lifecycle"
"strategy_lifecycle",
"per_stock_reassess",
"mofin_db"
],
"writers": [
"mofin_db"
@@ -1776,19 +1776,19 @@
"desc": "全量股票代码",
"rows": 5575,
"readers": [
"mofin_db",
"trend_detector",
"import_full_stocks",
"mofin_news",
"accumulation_scanner",
"mofin_news",
"xiaoguo_news_processor",
"import_full_stocks",
"mofin_db",
"check_stocks_table"
],
"writers": [
"backfill_price_events",
"mofin_db",
"import_full_stocks",
"price_monitor"
"mofin_db",
"price_monitor",
"backfill_price_events"
],
"has_input": true,
"has_output": true,
@@ -1813,8 +1813,8 @@
"desc": "策略重评历史记录",
"rows": 217,
"readers": [
"mofin_db",
"verify_reassess_pipeline"
"verify_reassess_pipeline",
"mofin_db"
],
"writers": [
"mofin_collect"
@@ -1870,19 +1870,19 @@
"readers": [
"intraday_health_check",
"merge_third_db",
"strategy-staleness-check",
"morning_health_check",
"self_todo_executor"
],
"writers": [
"intraday_health_check",
"merge_third_db",
"strategy-staleness-check",
"preflight_verify",
"morning_health_check",
"self_todo_executor",
"strategy-staleness-check"
],
"writers": [
"mofin_collect",
"cron_health_monitor"
"intraday_health_check",
"merge_third_db",
"morning_health_check",
"self_todo_executor",
"strategy-staleness-check",
"cron_health_monitor",
"preflight_verify"
],
"has_input": true,
"has_output": true,
@@ -1929,20 +1929,20 @@
"desc": "自选股列表",
"rows": 69,
"readers": [
"mofin_db",
"run_all_tests",
"xiaoguo_scanner",
"xiaoguo_signal_consumer",
"trend_detector",
"per_stock_reassess",
"mo_alphasift_bridge",
"price_monitor",
"mofin_collect",
"refresh_mtf_cache"
"trend_detector",
"stale_push_wlin",
"xiaoguo_scanner",
"refresh_mtf_cache",
"mofin_db",
"stock_quote",
"per_stock_reassess",
"run_all_tests",
"mo_alphasift_bridge"
],
"writers": [
"mofin_db",
"per_stock_reassess"
"per_stock_reassess",
"mofin_db"
],
"has_input": true,
"has_output": true,
@@ -1968,8 +1968,8 @@
"desc": "小果扫描跟踪",
"rows": 527,
"readers": [
"xiaoguo_scanner",
"server"
"server",
"xiaoguo_scanner"
],
"writers": [
"xiaoguo_scanner"
@@ -2109,11 +2109,11 @@
"readers": [
"analyze_health",
"verify_self_check_section",
"verify_health_json",
"verify_deployment"
"verify_deployment",
"verify_health_json"
],
"writers": [],
"last_modified": "07-20 21:01",
"last_modified": "07-20 21:16",
"warn": false,
"migrated_to_db": null
},
@@ -2245,7 +2245,7 @@
"script": "fix_gateway_port.py",
"schedule": "every 10m",
"status": "ok",
"last_run": "2026-07-20T21:13:56",
"last_run": "2026-07-20T21:24:02",
"profile": "position-analyst"
},
{
@@ -2362,7 +2362,7 @@
"script": "mofin_health.py",
"schedule": "*/15 9-16,20-22 * * 1-5",
"status": "ok",
"last_run": "2026-07-20T21:01:01",
"last_run": "2026-07-20T21:16:11",
"profile": "position-analyst"
},
{
@@ -2416,7 +2416,7 @@
"script": "functional_health_check.py",
"schedule": "*/15 9-16,20-22 * * 1-5",
"status": "ok",
"last_run": "2026-07-20T21:00:56",
"last_run": "2026-07-20T21:15:59",
"profile": "position-analyst"
},
{
@@ -2434,7 +2434,7 @@
"script": "",
"schedule": "{'kind': 'cron', 'expr': '*/10 * * * *'}",
"status": "ok",
"last_run": "2026-07-20T21:11:48",
"last_run": "2026-07-20T21:21:29",
"profile": "default"
},
{
@@ -2704,7 +2704,7 @@
"script": "stale_detector.py",
"schedule": "0 21 * * 1-5",
"status": "ok",
"last_run": "2026-07-17T21:18:03",
"last_run": "2026-07-20T21:17:10",
"profile": "position-analyst"
},
{
@@ -2749,7 +2749,7 @@
"script": "self_todo_executor.py",
"schedule": "*/10 8-22 * * 1-5",
"status": "ok",
"last_run": "2026-07-20T21:10:55",
"last_run": "2026-07-20T21:20:59",
"profile": "position-analyst"
},
{
@@ -2866,41 +2866,41 @@
"table": "mtf_cache",
"label": "多周期均线缓存",
"last_record": "07-20 17:08",
"age_hours": 4.1,
"age_hours": 4.4,
"warn": false
},
{
"table": "macro_context_log",
"label": "宏观上下文",
"last_record": "07-20 15:31",
"age_hours": 5.7,
"age_hours": 6.0,
"warn": false
},
{
"table": "market_snapshots",
"label": "市场快照",
"last_record": "07-20 15:50",
"age_hours": 5.4,
"age_hours": 5.7,
"warn": false
},
{
"table": "live_prices",
"label": "实时价格",
"last_record": "07-20 18:12",
"age_hours": 3.1,
"age_hours": 3.3,
"warn": false
},
{
"table": "price_events",
"label": "价格事件",
"last_record": "07-20 17:06",
"age_hours": 4.2,
"age_hours": 4.4,
"warn": false
}
],
"self_check": {
"functional": {
"generated_at": "2026-07-20 21:15:58",
"generated_at": "2026-07-20 21:30:05",
"status": "ok",
"summary": {
"total": 9,
@@ -2944,7 +2944,7 @@
"module": "premarket",
"function": "盘前全量重评(premarket summary)",
"status": "ok",
"reason": "785min前",
"reason": "799min前",
"repair": {
"action": "rerun_script",
"script": "premarket_full_review.py"
@@ -2954,7 +2954,7 @@
"module": "gateway_llm",
"function": "LLM调用链可用(gateway agent.log)",
"status": "ok",
"reason": "latency=8.5s",
"reason": "latency=9.5s",
"repair": {
"action": "llm_diagnose"
}