feat(ai): add PixelRAG marketplace adapter dry run
Some checks failed
CD Pipeline / deploy (push) Has been cancelled

This commit is contained in:
ogt
2026-07-10 11:32:30 +08:00
parent cb2ce63609
commit 3c92ea7df9
10 changed files with 1097 additions and 7 deletions

View File

@@ -2,7 +2,7 @@
> **最後更新**: 2026-07-10 (台北時間)
> **狀態**: 🟢 四 AI Agent 自動化閉環已落地LLM 路由紅線升級為 Ollama-first 三主機級聯PChome 後台業績匯入韌性已補強產品定位正名為「PChome 業績成長自動化作戰系統」外部市場來源正規化層、自動同步、作戰清單與價格參考表優先讀取、CSV 備援預檢、前台操作入口、高可見頁面繁中化守門、比價/作戰 UI 工作台化、AI 密集工作台文字密度守門、跨平台來源治理、商品身份 UI 契約、sitewide visual QA runtime readback、external MCP/RAG integration monitoring、PixelRAG RAG candidate replay monitoring、PixelRAG OCR/VLM replay contract monitoring、PixelRAG application portfolio、PChome auto-policy authorization guard monitoring、decision preflight machine evidence monitoring、decision closeout monitoring、authorization issuer gate monitoring、signing decision preflight monitoring、signing decision closeout monitoring、signing issuer guard monitoring、signing issuer closeout monitoring、signing execution preflight monitoring、signing execution closeout monitoring、signed receipt preflight monitoring、signed receipt closeout monitoring、signed receipt evidence intake monitoring、detached verification evidence validation monitoring、verifier receipt closeout monitoring、authorization evidence execution preflight monitoring、authorization evidence execution closeout monitoring、controlled apply final preflight monitoring、controlled dry-run package monitoring 與 controlled dry-run receipt closeout monitoring 已建立GCP embedding 熔斷延後處理、110 proxy rescue 與 direct host health skip 已建立
> **適用版本**: V10.765
> **適用版本**: V10.766
---
@@ -121,6 +121,7 @@
- 2026-07-10 起 PixelRAG platform probe 必須把 blocked / interstitial receipt 轉成機器可執行下一步:`/api/ai-automation/pixelrag-platform-probe``scripts/ops/report_pixelrag_platform_probe.py` 需讀取 capture receipts 與 VLM replay receipts辨識 Shopee language / region / generic marketplace slogan / traffic verification 與 Coupang 403 / access denied輸出 public browser context probe、structured source fallback、platform backoff、blocked page not product data 與 no-write 邊界;`/api/ai-automation/smoke` 需包含 `PixelRAG platform probe readiness``/api/ai-automation/scheduled-health-summary` 需輸出 `pixelrag_platform_probe` family。此 readback 不抓外站、不讀 secret/cookie/session、不寫 DB、不寫 `ai_insights`、不寫正式價格表capture worker 可消化 `public_browser_context` 的 locale/timezone/Accept-Language但必須濾掉 Cookie、Authorization、token/secret/key 類 header。
- 2026-07-10 起 PixelRAG platform probe 必須有 controlled worker`/api/ai-automation/pixelrag-platform-probe-worker``scripts/ops/run_pixelrag_platform_probe_worker.py` 預設 dry-run`execute=true&write_receipt=true` 才會對 Shopee language / traffic / generic landing 執行 public empty-context capture並對 Coupang 403 / access denied 自動產生 structured-source/backoff artifact receipt`/api/ai-automation/smoke` 需包含 `PixelRAG platform probe worker``/api/ai-automation/scheduled-health-summary` 需輸出 `pixelrag_platform_probe_worker` family。此 worker 不登入、不讀 cookie/session/secret、不寫 DB、不寫 `ai_insights`、不寫正式價格表capture 成功後下一步固定為 RAG candidate replaystructured fallback 只產生機器可讀 package不把 blocked page 當商品資料。
- 2026-07-10 起 PixelRAG platform probe worker 必須自動處理 capture runtime gap若 production app 容器缺 Playwright`execute=true&write_receipt=true` 不得退回人工審核或 critical dead-endworker 必須寫 `capture_runtime_unavailable_structured_fallback_package` artifact receipt標記 `network_call=false``writes_database=false``primary_human_gate_count=0`,並把下一步改為 `run_structured_source_or_install_pixelrag_capture_runtime`
- 2026-07-10 起 PixelRAG marketplace source-contract adapter dry-run 必須是正式 smoke/scheduled family`/api/ai-automation/pixelrag-marketplace-source-contract-adapter-dry-run``scripts/ops/run_pixelrag_marketplace_source_contract_adapter_dry_run.py` 預設只讀 adapter preflight receipts 並做 deterministic mapping readiness`execute=true&write_receipt=true` 只寫 `marketplace_adapter_dry_run_receipt.json` artifact輸出 field contracts、offer candidate contracts、identity matcher / PromotionGate / embedding signature gates 與 no-write 邊界。此 worker 不抓外站、不呼叫模型、不讀 secret/cookie/session、不寫 DB、不寫 `ai_insights`、不寫正式價格表dry-run receipt 只允許進 identity matcher replay不得直接進價格表或候選知識層。
- 2026-07-02 起 `/ai_intelligence` 商品明細與單品作戰詳情的四格價格證據必須可測PChome 價格、MOMO 參考價、差距、可信度需以 `data-evidence` 固定,並以 `aria-label="價格證據"` 對應可掃描區塊;候選待確認或缺資料只能顯示「候選待確認 / 待補」,不得捏造價格或讓使用者打開 raw payload 才知道判斷依據。
- 2026-07-02 起 `/ai_intelligence` 必須是密集 AI 工作台不得退回大段文字說明頁首屏與明細可見內容只保留短狀態、數字、四格證據與下一步按鈕KPI note、benchmark detail、alert 副句、策略說明、decision copy、來源長句與單品 reason list 不得佔用第一層視覺。`tests/test_ai_intelligence_text_density_guardrails.py` 必須鎖住 `data-density-guardrail="compact-ai-workbench"`、短任務文案、detail meta 與 hidden explanatory copy。
- 2026-07-02 起 `/observability/overview` 也必須採密集 AI 觀測工作台:首屏以 `data-density-guardrail="compact-observability-workbench"``AI 觀測 / 風險優先 / 下一步` 與 golden signals 先呈現狀態、數字與操作入口hero lede、signal note、route desc、host meta 與資料來源長句不得佔用第一層視覺。`tests/test_observability_text_density_guardrails.py` 必須鎖住 compact marker 與 hidden explanatory copy。
@@ -898,6 +899,7 @@ POSTGRES_HOST=momo-db
| 2026-07-10 | PixelRAG RAG replay 下一步不得隱藏並行主線 | V10.763 起若同一批 PixelRAG replay 同時存在 ready visual receipt 與 platform probe worker `source_contract_fallback` receipt`next_machine_action` 必須輸出 `run_ocr_vlm_replay_and_source_contract_replay`,避免只顯示 OCR/VLM 而把 marketplace source-contract 自動化 lane 藏在 summary 裡。 |
| 2026-07-10 | PixelRAG source-contract fallback 必須有 controlled replay worker | V10.764 起 `/api/ai-automation/pixelrag-source-contract-replay-worker``scripts/ops/run_pixelrag_source_contract_replay_worker.py``/api/ai-automation/smoke``/api/ai-automation/scheduled-health-summary` 必須輸出 PixelRAG source-contract replay worker / `pixelrag_source_contract_replay_worker` familyworker 只讀 platform probe worker `source_contract_fallback` receipts驗證 structured package、source count、no-DB、network-deferred、blocked-page-not-product-data、source receipt provenanceexecute 模式只寫 `source_contract_replay_receipt.json` artifact。此路徑不抓外站、不呼叫模型、不讀 secret/cookie/session、不寫 DB、不寫 `ai_insights`、不寫正式價格表,下一步只允許進 marketplace source-contract adapter replay preflight。 |
| 2026-07-10 | PixelRAG marketplace source-contract adapter 必須先有 no-write preflight | V10.765 起 `/api/ai-automation/pixelrag-marketplace-source-contract-adapter-preflight``scripts/ops/run_pixelrag_marketplace_source_contract_adapter_preflight.py``/api/ai-automation/smoke``/api/ai-automation/scheduled-health-summary` 必須輸出 PixelRAG marketplace adapter preflight / `pixelrag_marketplace_adapter_preflight` familypreflight 只讀 `source_contract_replay_receipt.json`,驗證 replay ready、source contract version、adapter code、source count、source checks all passed、blocked page not product data、no-DB、network-deferred、public source boundary、rate-limit contract、provenance contract、identity/promotion gates 與 canonical offer fields。execute 模式只寫 `marketplace_adapter_preflight_receipt.json` artifact不抓外站、不呼叫模型、不讀 secret/cookie/session、不寫 DB、不寫 `ai_insights`、不寫正式價格表,下一步只允許進 marketplace source-contract adapter dry-run。 |
| 2026-07-10 | PixelRAG marketplace adapter dry-run 必須先產生 no-write mapping receipt | V10.766 起 `/api/ai-automation/pixelrag-marketplace-source-contract-adapter-dry-run``scripts/ops/run_pixelrag_marketplace_source_contract_adapter_dry_run.py``/api/ai-automation/smoke``/api/ai-automation/scheduled-health-summary` 必須輸出 PixelRAG marketplace adapter dry-run / `pixelrag_marketplace_adapter_dry_run` familydry-run 只讀 `marketplace_adapter_preflight_receipt.json`,驗證 preflight ready、canonical offer fields、required gates、no-DB/no-network/no-model、blocked page not product data 與 price-write blocked。execute 模式只寫 `marketplace_adapter_dry_run_receipt.json` artifact產生 deterministic field contracts / offer candidate contracts不抓外站、不呼叫模型、不寫 DB、不寫 `ai_insights`、不寫正式價格表,下一步只允許進 identity matcher replay。 |
| 2026-06-29 | PChome DB apply 授權 lane 必須先通過 no-write guard / decision preflight / decision closeout / issuer gate / signing-decision preflight / signing-decision closeout / signing-issuer guard | V10.725 的 PChome mapping backlog auto-policy 已新增 `/api/ai/pchome-growth/mapping-backlog/auto-policy-db-apply-authorization-lane-guard``/api/ai/pchome-growth/mapping-backlog/auto-policy-db-apply-authorization-decision-preflight``/api/ai/pchome-growth/mapping-backlog/auto-policy-db-apply-authorization-decision-closeout``/api/ai/pchome-growth/mapping-backlog/auto-policy-db-apply-authorization-issuer-gate``/api/ai/pchome-growth/mapping-backlog/auto-policy-db-apply-authorization-signing-decision-preflight``/api/ai/pchome-growth/mapping-backlog/auto-policy-db-apply-authorization-signing-decision-closeout``/api/ai/pchome-growth/mapping-backlog/auto-policy-db-apply-authorization-signing-issuer-guard`;這些 endpoint 只驗證 final exact request package、same-run production truth requirement、secret rejection、rollback boundary、lane entry requirements、decision input requirements、rejection policy、post-apply verifier、future authorization decision package、final nonsecret authorization envelope、signing decision preflight inputs、unsigned signing decision package 與 signable request boundary不讀 secret、不執行 shell/SQL、不寫 DB也不簽發 database apply authorization。 |
| 2026-06-29 | PChome DB apply 授權簽署發行者 lane 必須先產出 final signable request package | V10.725 的 PChome mapping backlog auto-policy 新增 `/api/ai/pchome-growth/mapping-backlog/auto-policy-db-apply-authorization-signing-issuer-closeout`;此 endpoint 只把 signing-issuer guard 的 signable request boundary 收斂成 final signable request package 與 closeout contract確認 fresh production truth、post-apply verifier、migration hash、secret boundary 與 no-side-effect checks不讀 secret、不簽發 authorization、不執行 shell/SQL、不寫 DB也不代表正式 DB apply 已授權。 |
| 2026-06-29 | PChome DB apply 授權簽署執行 lane 必須先通過 operator-held secret boundary preflight | V10.725 的 PChome mapping backlog auto-policy 新增 `/api/ai/pchome-growth/mapping-backlog/auto-policy-db-apply-authorization-signing-execution-preflight`;此 endpoint 只把 final signable request package 轉成 future signing execution preflight package、operator-held secret boundary contract、nonsecret signing inputs、command-shape preview、rollback boundary 與 abort conditions不讀 secret、不接受 plaintext secret、不簽發 authorization、不執行 shell/SQL、不寫 DB也不代表正式 DB apply 已授權。 |

View File

@@ -19,11 +19,12 @@
| Completed | PixelRAG receipts to internal RAG candidate replay | `/api/ai-automation/pixelrag-rag-candidate-replay` and `scripts/ops/report_pixelrag_rag_candidate_replay.py` read visual capture receipts and platform probe worker receipts, split eligible / blocked / source-contract-fallback candidates, and expose combined OCR/VLM + source-contract next actions before identity matching and PromotionGate knowledge writes. |
| Completed | PixelRAG source-contract replay worker | `/api/ai-automation/pixelrag-source-contract-replay-worker` and `scripts/ops/run_pixelrag_source_contract_replay_worker.py` turn platform probe worker `source_contract_fallback` receipts into replayable source-contract artifact receipts with provenance, public-boundary, no-DB, and blocked-page-not-product-data guards. |
| Completed | PixelRAG marketplace source-contract adapter preflight | `/api/ai-automation/pixelrag-marketplace-source-contract-adapter-preflight` and `scripts/ops/run_pixelrag_marketplace_source_contract_adapter_preflight.py` validate source-contract replay receipts for adapter readiness, canonical offer fields, provenance/rate-limit/public-boundary requirements, and no-write promotion gates. |
| Completed | PixelRAG marketplace adapter dry-run | `/api/ai-automation/pixelrag-marketplace-source-contract-adapter-dry-run` and `scripts/ops/run_pixelrag_marketplace_source_contract_adapter_dry_run.py` turn adapter preflight receipts into deterministic no-write field contracts and offer candidate contracts, with price writes blocked until identity matcher replay and PromotionGate. |
| Completed | PixelRAG application portfolio and integration lanes | `/api/ai-automation/pixelrag-application-portfolio` and `scripts/ops/report_pixelrag_application_portfolio.py` expose commerce, RAG, UX, ops, marketing, and governance uses with priority, status, next machine action, and forbidden guardrails. |
| Completed | PixelRAG Ollama-first VLM replay worker | `/api/ai-automation/pixelrag-vlm-replay-worker` and `scripts/ops/run_pixelrag_vlm_replay_worker.py` dry-run or execute ready visual receipts against approved Ollama VLM routes, emit evidence-bound artifact receipts, and keep blocked pages out of product data. |
| Completed | PixelRAG VLM route readiness and auto model select | `/api/ai-automation/pixelrag-vlm-route-readiness` and `scripts/ops/report_pixelrag_vlm_route_readiness.py` read approved Ollama `/api/tags`, expose configured/candidate model readiness, and let execute mode avoid missing-model blind generate calls. |
| Completed | PixelRAG platform probe worker | `/api/ai-automation/pixelrag-platform-probe-worker` and `scripts/ops/run_pixelrag_platform_probe_worker.py` turn platform probe plans into dry-run/execute automation: Shopee interstitials go to public empty-context capture when runtime is available, missing Playwright auto-falls back to structured-source/backoff receipt, and Coupang 403/access denied goes to structured-source/backoff artifact receipts. |
| In progress | MCP/RAG runtime health in AI automation smoke | `/api/ai-automation/smoke` and `/api/ai-automation/scheduled-health-summary` include external MCP/RAG integration, PixelRAG RAG candidate replay, PixelRAG OCR/VLM replay contract, PixelRAG VLM route readiness, PixelRAG VLM replay worker, PixelRAG platform probe, and PixelRAG platform probe worker families. |
| In progress | MCP/RAG runtime health in AI automation smoke | `/api/ai-automation/smoke` and `/api/ai-automation/scheduled-health-summary` include external MCP/RAG integration, PixelRAG RAG candidate replay, PixelRAG OCR/VLM replay contract, PixelRAG VLM route readiness, PixelRAG VLM replay worker, PixelRAG platform probe, PixelRAG platform probe worker, source-contract replay, adapter preflight, and adapter dry-run families. |
| In progress | Formal production deploy/readback discipline | Every mainline change must update version, push Gitea main/dev, deploy to 188 without touching `momo-db`, and read back `/health` plus new endpoints. |
## P1

View File

@@ -200,6 +200,8 @@ python scripts/ops/run_pixelrag_source_contract_replay_worker.py --platform shop
python scripts/ops/run_pixelrag_source_contract_replay_worker.py --platform coupang_tw --execute --write-receipt --limit 1
python scripts/ops/run_pixelrag_marketplace_source_contract_adapter_preflight.py --platform shopee_tw --platform coupang_tw
python scripts/ops/run_pixelrag_marketplace_source_contract_adapter_preflight.py --platform coupang_tw --execute --write-receipt --limit 1
python scripts/ops/run_pixelrag_marketplace_source_contract_adapter_dry_run.py --platform shopee_tw --platform coupang_tw
python scripts/ops/run_pixelrag_marketplace_source_contract_adapter_dry_run.py --platform coupang_tw --execute --write-receipt --limit 1
```
API readback: `/api/ai-automation/pixelrag-vlm-route-readiness``/api/ai-automation/pixelrag-vlm-replay-worker?platform=shopee_tw`。worker 預設為 dry-run不呼叫模型、不寫 artifact`execute=true&write_receipt=true` 才呼叫 Ollama VLM 並寫 artifact receipt。execute 前會自動讀 approved Ollama `/api/tags` 選擇已安裝候選模型;若完全沒有候選,會寫 `model_route_not_ready` artifact receipt不盲打 generate。即使 execute結果仍只是 candidate evidence不得直接寫 `ai_insights`、正式價格表或競品價格歷史,且 missing confidence/evidence 會留在 replay / probe lane。
@@ -210,6 +212,8 @@ Source-contract replay worker API readback: `/api/ai-automation/pixelrag-source-
Marketplace adapter preflight API readback: `/api/ai-automation/pixelrag-marketplace-source-contract-adapter-preflight?platform=coupang_tw`。preflight 預設為 dry-run不抓外站、不呼叫模型、不寫 artifact`execute=true&write_receipt=true` 才把 source-contract replay receipt 轉成 adapter preflight artifact。artifact 只證明 adapter dry-run 條件齊備,不得直接寫 `ai_insights`、正式價格表或競品價格歷史。
Marketplace adapter dry-run API readback: `/api/ai-automation/pixelrag-marketplace-source-contract-adapter-dry-run?platform=coupang_tw`。dry-run 預設只讀 adapter preflight receipts 並建立 deterministic field contracts`execute=true&write_receipt=true` 只寫 adapter dry-run artifact receipt不抓外站、不呼叫模型、不寫 DB、不寫 `ai_insights`、不寫正式價格表。dry-run artifact 下一步只能進 identity matcher replay 與 PromotionGate不得直接變成價格資料。
Application portfolio
```bash