From 73d2d863e5360bd847e0fe97bfc72d4a5b928b53 Mon Sep 17 00:00:00 2001 From: OoO Date: Sun, 31 May 2026 20:49:46 +0800 Subject: [PATCH] =?UTF-8?q?V10.512=20=E6=8E=A5=E4=B8=8A=20Webcrumbs=20?= =?UTF-8?q?=E6=AF=94=E5=83=B9=20host=20data?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TODO_NEXT_STEPS.txt | 1 + config.py | 2 +- docs/guides/webcrumbs_shared_runtime.md | 2 +- docs/memory/history_logs.md | 1 + routes/system_public_routes.py | 37 ++--- services/webcrumbs_host_data_service.py | 159 ++++++++++++++++++++++ tests/test_external_tool_entrypoints.py | 5 +- tests/test_webcrumbs_host_data_service.py | 67 +++++++++ 8 files changed, 253 insertions(+), 21 deletions(-) create mode 100644 services/webcrumbs_host_data_service.py create mode 100644 tests/test_webcrumbs_host_data_service.py diff --git a/TODO_NEXT_STEPS.txt b/TODO_NEXT_STEPS.txt index 592e834..b42f220 100644 --- a/TODO_NEXT_STEPS.txt +++ b/TODO_NEXT_STEPS.txt @@ -4,6 +4,7 @@ ================================================================================ 【已完成】 + - V10.512 Webcrumbs live plugin 接上 MOMO/PChome 只讀 host data:新增 `services/webcrumbs_host_data_service.py`,復用 `competitor_intel_repository.fetch_top_competitor_risks()` / coverage,把 exact / total_price / price_alert_exact 價差摘要轉成 `StockPlatformSharedUI.marketSnapshot` / `aiCandidate`;不呼叫 LLM、不抓外站、不寫 DB,無風險或失敗時仍輸出安全空狀態。 - V10.511 Webcrumbs live plugin 補 host data 安全空狀態:`/webcrumbs` 會注入 `StockPlatformSharedUI.marketSnapshot` / `aiCandidate` 的診斷空資料,避免 plugin fallback demo 數字被誤認成真實市場或 AI 建議。 - V10.510 Webcrumbs 從 runtime 接線推進到專案內 live plugin 試點:`/webcrumbs` 會設定 `StockPlatformSharedUI.allowedPluginUris` 並嵌入同源 `/webcrumbs-assets/plugins/finance.market-ticker-strip/0.1.0`、`finance.ai-candidate-card/0.1.0`,用同一頁同時驗 runtime、plugin proxy 與共享 UI loader 初始化。 - V10.509 新增市場情報 MCP Fetch Candidate Queue Writer Review Decision Approval Writer Preflight 安全預覽 gate:只審核 human approval 通過後由操作員貼回的 writer preflight 摘要,確認 approval identity、writer_preflight_id、row count、dedupe keys、approved decision 到 target review_state 的逐列映射、decision/approval/preflight evidence refs、exact identity / variant / overwrite guard 與 operator boundary;API 不讀 token、不執行 CLI、不開 DB、不寫 preflight/approval/decision/match、不更新 review_state、不補 queue、不掛 scheduler,只放行到後續 CLI review / run package 設計。 diff --git a/config.py b/config.py index a97d5c6..9789a51 100644 --- a/config.py +++ b/config.py @@ -402,7 +402,7 @@ YOUTUBE_API_KEY = os.getenv('YOUTUBE_API_KEY', '') # ========================================== # 系統版本與路徑 # ========================================== -SYSTEM_VERSION = "V10.511" +SYSTEM_VERSION = "V10.512" LOG_FILE_PATH = os.path.join(BASE_DIR, 'logs/system.log') public_url = PUBLIC_URL # 用於模板顯示 diff --git a/docs/guides/webcrumbs_shared_runtime.md b/docs/guides/webcrumbs_shared_runtime.md index 687c3db..8be10a2 100644 --- a/docs/guides/webcrumbs_shared_runtime.md +++ b/docs/guides/webcrumbs_shared_runtime.md @@ -63,7 +63,7 @@ style.css ## 驗收 - `/webcrumbs` 顯示 runtime URL、版本與 plugin base。 -- `/webcrumbs` 會嵌入同源 `/webcrumbs-assets/plugins/...` 的 live plugin preview,並由 momo-pro 注入診斷空狀態資料,避免 plugin fallback demo 數字在正式頁面被誤認成真實市場或 AI 建議。 +- `/webcrumbs` 會嵌入同源 `/webcrumbs-assets/plugins/...` 的 live plugin preview,並由 momo-pro 注入只讀 MOMO/PChome exact 價差摘要;若資料源不可用或無風險候選,改注入診斷空狀態,避免 plugin fallback demo 數字在正式頁面被誤認成真實市場或 AI 建議。 - `/webcrumbs-assets/loader/webcrumbs-compatible-loader.js` 回 200 且 content type 是 JavaScript。 - `ewoooc_base.html` 在 `WEBCRUMBS_ENABLED=true` 且 runtime URL 有效時輸出 `