V10.510 啟用 Webcrumbs live plugin 試點
All checks were successful
CD Pipeline / deploy (push) Successful in 1m6s

This commit is contained in:
OoO
2026-05-31 20:39:08 +08:00
parent 593e87b175
commit af0b49a819
8 changed files with 73 additions and 1 deletions

View File

@@ -4,6 +4,7 @@
================================================================================
【已完成】
- 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 boundaryAPI 不讀 token、不執行 CLI、不開 DB、不寫 preflight/approval/decision/match、不更新 review_state、不補 queue、不掛 scheduler只放行到後續 CLI review / run package 設計。
- V10.508 Webcrumbs 轉為 momo-pro 同源 asset proxy`WEBCRUMBS_RUNTIME_URL` 預設改為 `/webcrumbs-assets/loader/webcrumbs-compatible-loader.js`,新增 allowlist proxy 只代理 188 Shared UI Hub 的 `loader/`、`plugins/`、`demo/`,避免 `webcrumbs.wooo.work` 公網 TLS / Basic Auth 尚未收斂時影響正式頁面載入;`/webcrumbs` 診斷頁同步顯示 asset upstream。
- V10.507 接入 Webcrumbs 共用 UI Runtime新增 `WEBCRUMBS_*` 環境設定與 `/webcrumbs` 診斷入口,`ewoooc_base.html` 會在 runtime 啟用且 URL 有效時載入自架 Webcrumbs script側欄新增 Webcrumbs 入口,並補 `docs/guides/webcrumbs_shared_runtime.md` 作為跨專案接入手冊。生產仍需固定版本與自架 plugin URI不使用官方 `@latest`。

View File

@@ -402,7 +402,7 @@ YOUTUBE_API_KEY = os.getenv('YOUTUBE_API_KEY', '')
# ==========================================
# 系統版本與路徑
# ==========================================
SYSTEM_VERSION = "V10.509"
SYSTEM_VERSION = "V10.510"
LOG_FILE_PATH = os.path.join(BASE_DIR, 'logs/system.log')
public_url = PUBLIC_URL # 用於模板顯示

View File

@@ -63,6 +63,7 @@ style.css
## 驗收
- `/webcrumbs` 顯示 runtime URL、版本與 plugin base。
- `/webcrumbs` 會嵌入同源 `/webcrumbs-assets/plugins/...` 的 live plugin preview作為 shared runtime 的第一個專案內試點。
- `/webcrumbs-assets/loader/webcrumbs-compatible-loader.js` 回 200 且 content type 是 JavaScript。
- `ewoooc_base.html``WEBCRUMBS_ENABLED=true` 且 runtime URL 有效時輸出 `<script data-webcrumbs-runtime=...>`
- 任一試點頁嵌入 plugin 後,瀏覽器 console 不應有 `MISSING_URI``STYLE_LOAD_ERROR``SCRIPT_LOAD_ERROR`

View File

@@ -13,6 +13,7 @@
## 📅 詳細更新日誌 (考古存檔)
### 2026-05-31Webcrumbs 共用 UI Runtime 與市場情報 writer approval
- **V10.510 Webcrumbs live plugin 試點**: `/webcrumbs` 診斷頁不再只顯示 runtime 設定,新增 `StockPlatformSharedUI.allowedPluginUris` 與同源 `/webcrumbs-assets/plugins/finance.market-ticker-strip/0.1.0``finance.ai-candidate-card/0.1.0` live plugin embed讓 shared-ui loader、plugin asset proxy 與頁面初始化時序能在 momo-pro 內直接驗收。
- **V10.509 市場情報 MCP Fetch Candidate Queue Writer Review Decision Approval Writer Preflight gate**: 新增 `/api/market_intel/mcp_fetch_candidate_queue_writer_review_decision_approval_writer_preflight` 與 UI preview只審核 human approval 通過後的 operator writer preflight 摘要;要求 approval linkage、writer_preflight_id、target operation、row count、dedupe keys、approved decision 到 target review_state 的逐列映射、decision/approval/preflight evidence refs、artifact paths、matched row exact-identity/variant/overwrite guard 與 operator confirmation 對齊,且 API 不讀 token、不執行 CLI、不開 DB、不寫 preflight/approval/decision/match、不更新 review_state、不補 queue、不掛 scheduler只放行到後續 CLI review / run package 設計。
- **V10.508 Webcrumbs 同源 asset proxy 收斂**: 正式頁面 runtime 預設改走 `/webcrumbs-assets/loader/webcrumbs-compatible-loader.js`,由 momo-pro 代理 188 Shared UI Hub 的 allowlist asset path`loader/``plugins/``demo/`),避免 `webcrumbs.wooo.work` 公網 TLS、Basic Auth 或入口轉發尚未完成時造成頁面 script 載入失敗;`/webcrumbs` 診斷頁同步顯示 asset upstream`WEBCRUMBS_PLUGIN_BASE_URL` 預設改為同源 `/webcrumbs-assets/plugins`
- **V10.507 Webcrumbs 共用 UI Runtime 接入**: 新增 `WEBCRUMBS_*` 設定、`/webcrumbs` 診斷頁、全站 `ewoooc_base.html` runtime script 載入守門與側欄入口runtime 僅允許自架固定版本 URL禁止正式環境使用官方 `@latest`,並新增 `docs/guides/webcrumbs_shared_runtime.md` 與 ADR-037 記錄共用 microfrontend/plugin loader 邊界。

View File

@@ -109,6 +109,19 @@ def _external_tool_payload(kind):
if kind == 'webcrumbs':
runtime_ready = bool(WEBCRUMBS_ENABLED and WEBCRUMBS_RUNTIME_URL)
launch_url = WEBCRUMBS_BASE_URL if WEBCRUMBS_BASE_URL else ''
plugin_base = (WEBCRUMBS_PLUGIN_BASE_URL or '').rstrip('/')
plugin_previews = []
if plugin_base:
plugin_previews = [
{
'label': 'Market ticker strip',
'uri': f'{plugin_base}/finance.market-ticker-strip/0.1.0',
},
{
'label': 'AI candidate card',
'uri': f'{plugin_base}/finance.ai-candidate-card/0.1.0',
},
]
return {
'key': 'webcrumbs',
'eyebrow': 'Shared UI Runtime',
@@ -131,6 +144,8 @@ def _external_tool_payload(kind):
{'label': '比價覆核', 'href': '/?filter=pchome_review', 'icon': 'fas fa-scale-balanced'},
{'label': 'AI 觀測台', 'href': '/observability/overview', 'icon': 'fas fa-satellite-dish'},
],
'plugin_previews': plugin_previews,
'plugin_preview_uris': [preview['uri'] for preview in plugin_previews],
}
launch_url = _safe_launch_url(GRIST_URL, '/grist')

View File

@@ -60,6 +60,26 @@
</div>
</section>
{% if tool.key == 'webcrumbs' and tool.plugin_previews %}
<script>
window.StockPlatformSharedUI = window.StockPlatformSharedUI || {};
window.StockPlatformSharedUI.allowedPluginUris = {{ tool.plugin_preview_uris | tojson }};
</script>
<section class="external-tool-webcrumbs-preview" aria-label="Webcrumbs live preview">
<div class="external-tool-section-title">
<span class="external-tool-kicker">Live Plugin</span>
<h2>Shared UI Hub</h2>
</div>
<div class="external-tool-webcrumbs-grid">
{% for preview in tool.plugin_previews %}
<div class="external-tool-webcrumbs-plugin" data-plugin-uri="{{ preview.uri }}">
<stock-platform-plugin uri="{{ preview.uri }}"></stock-platform-plugin>
</div>
{% endfor %}
</div>
</section>
{% endif %}
<section class="external-tool-actions" aria-label="可用替代入口">
<div class="external-tool-section-title">
<span class="external-tool-kicker">可用入口</span>

View File

@@ -40,6 +40,12 @@ def test_external_tool_bridge_pages_are_diagnostic_not_blank():
assert "def webcrumbs_asset_proxy(asset_path)" in route_source
assert "WEBCRUMBS_ASSET_ALLOWED_PREFIXES" in route_source
assert "Webcrumbs 共用 UI Runtime" in route_source
assert "plugin_previews" in route_source
assert "finance.market-ticker-strip/0.1.0" in route_source
assert "finance.ai-candidate-card/0.1.0" in route_source
assert "StockPlatformSharedUI.allowedPluginUris" in template
assert "stock-platform-plugin" in template
assert "external-tool-webcrumbs-grid" in css
assert "尚未接入 proxy" in route_source
assert "已由入口攔截" in route_source
assert "AwoooI" not in route_source

View File

@@ -6,6 +6,7 @@
.external-tool-hero,
.external-tool-panel,
.external-tool-webcrumbs-preview,
.external-tool-actions {
background:
radial-gradient(circle, rgba(45, 40, 32, 0.12) 1px, transparent 1.2px),
@@ -159,6 +160,32 @@
padding: var(--momo-space-5, 24px);
}
.external-tool-webcrumbs-preview {
padding: var(--momo-space-5, 24px);
}
.external-tool-webcrumbs-grid {
display: grid;
grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
gap: var(--momo-space-4, 16px);
align-items: stretch;
margin-top: var(--momo-space-4, 16px);
}
.external-tool-webcrumbs-plugin {
min-height: 176px;
padding: var(--momo-space-3, 12px);
background: var(--momo-bg-paper);
border: 1px solid var(--momo-border-subtle);
border-radius: var(--momo-radius-md, 6px);
overflow: hidden;
}
.external-tool-webcrumbs-plugin stock-platform-plugin {
display: block;
min-height: 152px;
}
.external-tool-section-title h2 {
margin: var(--momo-space-2, 8px) 0 0;
color: var(--momo-text-primary);
@@ -210,6 +237,7 @@
.external-tool-checks,
.external-tool-diagnostics,
.external-tool-webcrumbs-grid,
.external-tool-action-grid {
grid-template-columns: 1fr;
}