Reality Search Taiwan · Search-first MVP · Level 2 MVP 完成版
搜尋此刻真實狀態
輸入自然語言問題,直接取得結論、信心、依據與建議。現階段最穩定的 demo 是中央氣象署即時天氣 / 雨量 / 地震資料。
頁面本身公開,但不嵌入 server-side API key。瀏覽器會用你貼上的 key 呼叫 POST /v1/reality/check。
結論
等待查詢。建議先試:「阿里山現在有下雨嗎?」
信心:— 狀態:waiting_for_query 地點:— 意圖:—
判斷依據
- 送出查詢後顯示。
建議
目前沒有查詢結果。
原始 API 回應
Level 2 MVP 已完成:首頁提供 15 個固定 demo 問題、首頁一鍵分享、GET /result?query=... 可分享結果頁、非 allowlist 友善提示與 GET /verify 驗證頁;公開頁面不嵌入 server-side API key。
Level 3 Beta:進行中;Sprint 1:Beta Verification Foundation 已建立 GET /beta 狀態頁、source health / freshness / confidence factors contract、Persistence / Audit Contract 與 scripts/verify_level3_beta.py live verification script。
開啟純搜尋頁 /search · Level 2 驗證頁 · Level 3 Beta 狀態頁 · Swagger UI · ReDoc
Reality Intelligence API
台灣現實世界搜尋引擎 Taiwan World Model 的機器介面。這個 staging API 讓 TrueSight / Codex / internal tools 查詢目前可介接的現實資料能力,並測試 Reality Check 合約。
https://taiwanworldmodel.thesense.biz
所有受保護 API 需使用 header:X-API-Key。請不要把 API key 寫死在程式碼或公開 repo。
Reality Search:用自己的 API key 試查「台灣剛剛有地震嗎?」與「阿里山現在有下雨嗎?」。Answer card 會把 current_state=no_rain_detected 等 raw state 轉成人類決策語言,例如「目前未偵測到明顯降雨」、「近10分鐘無雨」與高/中/低信心標籤,避免使用者直接解讀 raw JSON。
目前狀態
status=catalog_only:資料源能力目錄已可查詢。status=insufficient_data:Reality Check endpoint 可呼叫,但尚未接入正式即時資料源。- 目前不是 production API;API clients、rate limit、audit log 仍是 in-memory。
Reality Search MVP Location fixes
Earthquake scope parser:地震查詢先使用災害範圍解析,不用一般 POI geocoder 猜地點。「台灣剛剛有地震嗎?」會被視為 national_scope,不會解析成台灣中油;「花蓮剛剛地震多大?」會被視為 county_scope / 花蓮縣,再交給 CWA 地震報告查詢。
Demo 地點擴充:「合歡山現在天氣好嗎?」現在會解析成 weather_suitability + hehuanshan,使用合歡山座標選最近中央氣象署觀測/雨量資料,不再回 intent=unknown。
Level 2 MVP 完成版:首頁免 API key demo mode 已擴充為 15 個固定 demo 問題,首頁提供一鍵分享連結;GET /result?query=... 提供可分享結果頁,公開頁面只呼叫 allowlisted POST /v1/reality/demo-check,不嵌入 server-side API key;非 allowlist query 顯示 demo_query_not_allowed;GET /verify 提供固定驗證頁,列出 Level 2 完成 checklist。
Level 3 Sprint 2:完成 — Sprint 2:Runtime Trust Foundation:Weather / Rain Reality answer 已加入 source_health_status、freshness_seconds、staleness、reliability_score 與 confidence_factors;stale / degraded source 會降低 confidence,且 stability 影響 confidence / stability affects confidence。Persistence contract 目前為 audit log JSONL persistence、usage event JSONL persistence、source health history JSONL persistence 的 Beta contract marker。
Level 3 Beta:完成:TrueSight E2E dry-run integration:完成;Weather / Rain beta-ready、Earthquake / Disaster beta-ready、Forecast Reality beta-ready;audit log JSONL persistence:完成、usage event JSONL persistence:完成、source health history JSONL persistence:完成;final Level 3 live verification:PASSED。外部 TrueSight repo merge 與 production HA 屬下一階段,不阻擋本 Beta gate。
Endpoints
| Endpoint | 用途 | 目前狀態 |
|---|---|---|
GET /healthz | 服務健康檢查 | Public |
GET /verify | Level 2 MVP verification page:列出 15 個 demo queries、首頁一鍵分享、可分享結果頁、非 allowlist 友善提示與 secret leak check checklist;不嵌入 server-side API key | Public |
GET /camera-test | Camera L3 Remote Test page:公開瀏覽器測試頁,讓 operator 貼上自己的 X-API-Key 後呼叫 /v1/reality/cameras/status-table?format=json&limit=500 與 /v1/reality/cameras/{camera_id}/live-query;頁面不嵌入 server-side key、不顯示影像 locator 或原圖 | Public page;API calls 仍需 API key |
GET /beta | Level 3 Beta:進行中 status page;Sprint 1:Beta Verification Foundation,列出 Level 3 Done checklist、source health / freshness / confidence factors contract、Persistence / Audit Contract 與 scripts/verify_level3_beta.py live verification script | Public |
GET /v1/reality/sources | 查詢可介接資料源能力目錄,可用 ?intent=... 過濾;回 metadata-only source_catalog_health public source catalog health summary,含 configured_durable、loaded_from_durable、redacted catalog_sha256、paths_hidden=true 與 restart_reload_check=source_catalog_restart_reload_check_v0(列出 restart 後只比較 checksum 的 public/admin health endpoints,requires_path_exposure=false),方便 restart 後驗證 durable catalog | API key required,回 status=catalog_only |
GET /v1/reality/auth/whoami | 驗證目前 API key 對應的 client identity、tier、endpoint permissions;不回傳 key value | API key required |
GET /v1/reality/billing/current | 回傳目前 client 本月 usage metering / shadow billing summary;用於未來評估合理費用,不是正式 invoice | API key required,回 shadow_only / internal_usage_only |
GET /v1/reality/production-readiness | Production Readiness Matrix V0:以 L0–L8 分級列出 Reality/API 能力目前成熟度、已完成項、缺口與下一個 milestone | API key required,回 production_readiness_matrix_v0 |
GET /v1/reality/source-health | Source Runtime Health V0:read-only 檢查 CWA / camera runtime 是否已設定與可進入下一階段;不執行 upstream fetch、不顯示 credential | API key required,回 source_runtime_health_v0 |
POST /v1/reality/source-health/probe | Source Health Recorder / Probe V0:寫入 metadata-only source health observations;不呼叫上游、不顯示 credential | API key required,回 source_health_probe_v0,write_scope=source_health_observations_only |
POST /v1/reality/source-health/probe/live-cwa | CWA Live Fetch Health Probe V0:受控 live upstream probe,呼叫 CWA weather/rainfall datasets 並記錄 latency / staleness / success 或 failure | API key required,回 cwa_live_fetch_health_probe_v0 |
GET /v1/reality/source-health/alerts | CWA Monitoring / Alerting V0:read-only metadata-only alert evaluator,不呼叫 CWA、不寄送外部通知、不顯示 secrets | API key required,回 cwa_monitoring_alerts_v0 |
GET /v1/reality/source-health/notification-channel-status | External Notification Channel Staging Config Contract V0:read-only metadata contract,只回 channel configured booleans;不顯示 channel address、provider token 或 credential value | API key required,回 cwa_notification_channel_status_v0 / notification_channel_status_ready |
GET /v1/reality/source-health/escalation-policy | Escalation Ownership Contract V0:read-only metadata contract,定義 owner approval、severity escalation 與 quiet-hours policy 缺口;不顯示個人聯絡值、不啟用 real send | API key required,回 cwa_escalation_policy_contract_v0 / escalation_policy_contract_ready |
GET /v1/reality/source-health/real-send-approval | Staging Real-send Approval Contract V0:read-only metadata contract,定義 dry-run 進到 one-time staging real-send 的必要 gates;real_send_enabled=false、不寄送通知、不允許 production enablement | API key required,回 cwa_real_send_approval_contract_v0 / real_send_approval_contract_ready |
GET /v1/reality/source-health/notification-delivery | Production Monitoring Notification Delivery Contract V0:read-only metadata contract,定義 channel readiness、severity mapping、retry/dedupe policy;不寄送通知、不顯示 channel address/provider secret | API key required,回 cwa_notification_delivery_contract_v0 |
POST /v1/reality/source-health/notification-drill | Staging Notification Drill V0:dry-run only,驗證 alert payload / severity / dedupe key / escalation placeholder;不寄送 Telegram/email/webhook | API key required,必須 dry_run=true,回 cwa_notification_drill_v0 / dry_run_available |
GET /v1/reality/weather/cross-validation | Forecast / Radar / Satellite Cross-validation V0:read-only metadata contract,定義 forecast/radar/satellite/observation 證據角色;不下載雷達/衛星圖 | API key required,回 cwa_forecast_radar_satellite_cross_validation_v0 |
GET /v1/reality/weather/radar-metadata | Radar Runtime Metadata V0:read-only metadata contract,定義 CWA radar evidence role、freshness bands、ground-truth limitation;不下載雷達圖、不做 image analysis | API key required,回 cwa_radar_runtime_metadata_v0 |
GET /v1/reality/weather/satellite-metadata | Satellite Runtime Metadata V0:read-only metadata contract,定義 CWA satellite evidence role、freshness bands、regional-context limitation;不下載衛星圖、不做 image analysis | API key required,回 cwa_satellite_runtime_metadata_v0 |
GET /v1/reality/weather/disagreement-scoring | Disagreement Scoring Contract V0:read-only metadata contract,定義 observation/forecast/radar/satellite 分歧評分維度、confidence modifiers 與官方觀測優先規則;不計算 live score | API key required,回 cwa_disagreement_scoring_contract_v0 |
GET /v1/reality/weather/production-thresholds | CWA Weather Production Thresholds V0:freshness/staleness/confidence/SLO metadata contract | API key required,回 cwa_weather_production_thresholds_v0 |
GET /v1/reality/cwa-runbook | CWA Operator Runbook Contract V0:read-only metadata contract,定義 key rotation、upstream outage、stale data degraded mode、rollback、probe pause 與 emergency wording;不執行危險操作;production gap runtime_status=cwa_runbook_contract_ready | API key required,回 cwa_operator_runbook_contract_v0 |
GET /v1/reality/cwa-production-gap | CWA Weather Reality Production Gap Checklist V0:明確列出 CWA Weather Reality 從 L6 → L7 production ready 的 pass / partial / blocker | API key required,回 cwa_production_gap_v0 |
GET /v1/reality/cameras | 查詢攝影機白名單/候選 registry,可用 ?location_id=... 過濾;不公開原始 CCTV URL | API key required,回 status=camera_registry_only |
GET /v1/reality/cameras/search | National Camera Coverage MVP:依 query、county、intent 搜尋全台縣市 coverage camera source candidates;schema=national_camera_coverage_v0,全台縣市 coverage 先回 registry/公開來源頁候選,不表示每筆已可 runtime fetch | API key required,回 camera_sources_found / no_camera_source_found |
GET /v1/reality/cameras/nearby | National Camera Coverage MVP:依 lat/lng/radius_km 查附近攝影機候選;回 distance_km,仍不公開技術取流網址 | API key required,回 nearby_camera_sources_found / no_nearby_camera_source_found |
GET /v1/reality/cameras/runtime-fetch-expansion | Camera Runtime Fetch Expansion:依 query/county/intent 批次回報全台 camera candidates 的 runtime fetch readiness;未帶 filter 時以 upgrade_mode=all_registry_sources_when_no_filter 處理整個 registry;schema=camera_runtime_fetch_expansion_v0,含 L1_public_source_page_only、L2_snapshot_metadata_available、L3_visual_evidence_available、blockers 與 completion_summary;completion 不等於全部升 L3,而是每支都有最高安全等級與下一步;預設 probe=false/visual_probe=false,明確 probe=true 才對白名單/已設定來源做 metadata probe,並以 bounded parallel metadata probes(目前 service default max 16 workers)加速大量 registry 檢查且維持輸出順序;明確 visual_probe=true 才做 AI visual evidence probe;metadata-only snapshot 仍算 L2,不算 L3 AI visual evidence;blocked_or_not_ready 只計仍低於 L2/L3 的 camera,已成功 snapshot probe 的 metadata-only L2 不會因尚未配置 AI vision runtime 被重新計為 blocked;discovery-only public page 仍列為 source_discovery_required_before_internal_use / blocked_pending_source_discovery;latest snapshot configuration_required / fetch_failed / invalid_snapshot 會分別落到 runtime_configuration_required_blocked、runtime_fetch_failed_blocked、runtime_invalid_snapshot_blocked,讓 Phase A completion 明確停在 L2 或可處理 blocker,而非 generic runtime_probe_failed | API key required,回 runtime_fetch_expansion_reported;不公開 raw URL / raw image bytes |
GET /v1/reality/cameras/status-table | Camera Status Table:API-key protected 狀態表,支援 format=json 或 format=markdown,預設以 limit=500 回 397 支 camera 的安全欄位:camera_id、county、location、L0/L1/L2/L3、completion_status、highest_safe_target_level、internal_callability_status、internal_use_allowed、public_access_tier、snapshot_status、locator-free snapshot_failure_reason、blockers、next_action、owner_track、public_source_url;JSON/markdown 都顯示內部可調用性與最後安全 snapshot probe 結果,並在 top-level 回 returned-row internal_callability_summary / public_access_tier_summary / snapshot_probe_status_summary / l2_remediation_summary / l2_remediation_source_groups,以及不受小 limit 分頁影響的 all_registry_summary / all_registry_completion_summary / all_registry_internal_callability_summary / all_registry_snapshot_probe_status_summary / all_registry_camera_rollout_readiness / all_registry_l2_remediation_summary / all_registry_l2_remediation_queue / all_registry_l2_remediation_source_groups / all_registry_l2_remediation_batch_plan,用來盤點全 397 支「內部是否可調用」以及 blocked work 是 configuration_required、fetch_failed 或其他 probe 狀態,而非直接公開影像權限;locator-free snapshot_failure_reason 可包含 missing_configured_locator_value、fetch_failed、unsupported_content_type、official_resource_html_response、official_resource_access_challenge 或 official_resource_record_not_found,其中 access challenge 代表官方端點回 HTML gateway/challenge;record not found 代表官方 JSON resource 可讀但沒有匹配 camera record / 安全 image locator,兩者都需改用授權/一手 image locator 或重新 source discovery 後再 probe;camera_rollout_readiness_v0 明確回全 registry callability conclusion completeness、L2/remediation/L3 counts 與 L3 必要 live gates,且 true_l3_rollout_allowed_from_status_table_only=false;camera_l2_failure_reason_repair_contract_v0 / camera_l2_source_specific_repair_playbook_v0 會在 summary/source groups/batch plan 內針對 locator-free failure reason 回 required artifacts/operator action/no-locator safety flags,避免把 HTML gateway/index 或 fixture/dry-run 誤算 L2/L3;camera_l2_remediation_summary_v0 只回 aggregate counts、public access tier split、safe public_auxiliary first buckets 與 operator order(fetch_failed → invalid_snapshot → configuration_required;先修已配置 server-side locator 的 runtime_probe_failed,再處理 source_discovery_required),camera_l2_source_group_discovery_contract_v0 會嵌在 source groups / batch plan,列出 official source page review、per-camera locator review、server-side secret configuration、re-probe before L2 與 must_not_expose policy;camera_l2_official_source_page_review_v0 只回 data.gov.tw public dataset id/title 與 HTTP 200/title-match review 結論,並嵌入 metadata-only camera_l2_official_resource_metadata_review_v0(public resource format summary、providing agency、update frequency、license、per-camera matching field names、locator field names only),不回 resource endpoint、raw locator/env、credential 或 raw image;camera_l2_remediation_queue_v0 只回最多 10 筆下一批可操作 metadata(camera_id/county/display/location/snapshot_status/access tier/next_action/public source),camera_l2_remediation_source_groups_v0 依 source_lineage/public_source_url 彙總需同批補 server-side locator 或修 probe 的候選數、snapshot/access-tier split 與最多 3 個 sample camera_id;camera_l2_remediation_batch_plan_v0 以預設 90 支為一批,產生 out-of-band server-side locator 設定/修復與 re-probe 的安全 bulk plan,並回 metadata-only missing_locator_configuration_candidates、configured_locator_repair_candidates、expected_live_l2_delta_if_all_candidates_probe_successfully 與 workstreams 以區分補缺 locator 與修已配置但 fetch/invalid 的 locator;四者都不回 locator/env/secret/raw image;unfiltered 小 limit request 只跑單次 all-registry probe,再由同一 probe result 切出 returned rows,避免 transient camera source 造成 returned-row summary 與全表 summary 不一致;若 blockers 或 source policy 為 discovery_only,即使有 public page,也回 source_discovery_required_before_internal_use / blocked_pending_source_discovery,因該頁仍是 discovery/index reference 而非已審查的逐 camera callable locator;batch21/batch28/batch29/batch30/batch31/batch32/batch33/batch34/batch35/batch36/batch37/batch38 延伸 data.gov.tw 36687 水利署水利防災用影像 117 支低隱私水情與防災影像 candidate;batch20 仍保留 data.gov.tw 41567 水利署河川分署遠端監控影像 10 支低隱私臺東卑南溪/高雄二仁溪河川疏濬工區觀測站 L2-candidate,實際 snapshot locator 必須留在 server-side config,未設定前不假稱 L3;data.gov.tw 142980 IoW淹水深度最新資料已列為 official_wra_iow_realtime_flood_depth_review_required 低隱私防災感測 context;data.gov.tw 5982 防災資訊淹水警戒已列為 official_wra_flood_warning_context_review_required 低隱私水利署防災警戒 context;data.gov.tw 22227 河川水位測站站況已列為 official_wra_river_water_level_station_status_metadata_review_required 低隱私水位站 metadata context;data.gov.tw 156083 水位計已列為 official_yunlin_water_level_gauge_metadata_review_required 雲林低隱私水情測站 context;data.gov.tw 145465 水位站已列為 official_yunlin_water_level_station_metadata_review_required 雲林低隱私水情測站 context;data.gov.tw 138749 臺北捷運萬大中和樹林線第一期工程交通即時影像位置資料集已列為 official_taipei_metro_construction_camera_metadata_high_privacy_review_required 交通/施工影像 metadata,高隱私與車牌風險未審查前不升 L2/L3;data.gov.tw 131753 申請介接臺北市閉路電視攝影機(CCTV)作業說明已列為 official_taipei_cctv_authorization_process_reference_only 授權流程參考;data.gov.tw 156053 CCTV設備座標已列為 official_taichung_cctv_device_coordinates_high_privacy_blocked;data.gov.tw 146054 土石流潛勢溪流參考雨量站雨量資料已列為 official_moa_debris_reference_rainfall_context_review_required 低隱私防災雨量 context;data.gov.tw 177644 桃園國際機場即時航班第二版已列為 official_taoyuan_airport_realtime_flight_context_non_camera;data.gov.tw 132888 臺北市室內空氣品質相關資訊已列為 official_taipei_indoor_air_quality_context_review_required;data.gov.tw 174854 觀光政策已列為 official_tourism_policy_reference_only;data.gov.tw 36687 水利署水利防災用影像已列為 official_wra_water_disaster_camera_l2_snapshot_metadata_candidate_review_required;95806 鯉魚潭水庫每日水情資訊、41568 水庫每日營運狀況與 32729 水利署所屬雨量站基本資料只作低隱私水情/雨量 cross-check context;data.gov.tw 37665 CCTV 靜態資訊(v2.0) 與 122133 嘉義縣即時路況攝影機CCTV 僅作交通/CCTV source discovery,高隱私與車牌風險未審查前 blocked;130237 克利金法逐時雷達估計降雨資料只作雨量/淹水 cross-check context;146055 土石流潛勢溪流縣市鄉鎮警戒值清單與 174270 大規模崩塌潛勢區警戒值只作低隱私防災 threshold context;163147 淹水感測器(白金)只作雲林縣政府低隱私防災感測 cross-check context;上述 discovery 需逐筆授權/freshness/probe,不當成 camera visual truth;不回 raw URL / 原圖 / secret | API key required,回 camera_status_table_ready |
scripts/run_camera_upgrade_batch.py | Camera Upgrade Batch Runner:operator-only report runner,schema=camera_upgrade_batch_runner_v0;以 --offset/--batch-size/--max-batches 分批處理全 registry,輸出 L0/L1/L2/L3、blockers 與 Recommended next batch;report-only,不寫 registry,不啟用新 feed | CLI / staging operator,支援 --format json / --format markdown;不公開 raw URL / raw image bytes |
GET /v1/reality/cameras/{camera_id}/live-query | Camera Live Visual Query:schema=camera_live_visual_query_v0;任一已登錄 camera_id 都可查安全狀態。已達 L3 回即時 visual evidence 摘要;未達 L3 回 9-step onboarding checklist、blockers 與 next steps;不回原圖、不回技術取流網址。Camera L3 Rollout / L2 snapshot metadata:目前 local/fixture-verified L2 snapshot metadata target 為 397 支,含 batch13 data.gov.tw 174655 官方觀測站、batch14 data.gov.tw 100218 臺南市管區域排水即時影像、batch15/batch16/batch17/batch18/batch19/batch20 data.gov.tw 41567 水利署河川分署遠端監控影像、batch21/batch28/batch29/batch30/batch31/batch32/batch33/batch34/batch35/batch36/batch37/batch38 data.gov.tw 36687 水利署水利防災用影像與 batch22/batch23/batch24/batch25/batch26/batch27 data.gov.tw 28196 環境部空氣品質監測即時影像資料 candidate;staging live 仍需 server-side snapshot config/probe 才確認實際 L2,第一手來源優先但不阻塞,proxy evidence 必須標註 lineage/tier/privacy、套 confidence cap 與 limitations,L3 仍需真實可信 vision runtime;已配置 server-side locator 若指向官方 JSON resource/index(含 CKAN-style nested wrappers / CCDList parent-child records),snapshot fetcher 只在 process 內以 split camera terms 匹配單一 camera image 並回 metadata,不公開 resource endpoint、per-camera locator、JSON payload、env var 或 raw image | API key required,回 live_visual_evidence_available / onboarding_required / camera_not_found |
GET /v1/reality/cameras/select | Multi-source Camera Selection v0:依 location / intent 排序候選鏡頭;不把 discovery_only 視為可抓取影像 | API key required,目前回 multi_source_camera_selection_v0 |
GET /v1/reality/cameras/{camera_id}/snapshot | server-side 抓取白名單攝影機 snapshot metadata;不回傳影像內容或 raw URL | API key required,目前可能回 configuration_required |
GET /v1/reality/cameras/{camera_id}/visual-evidence | 攝影機 visual observation usable V0;有 server-side snapshot 時回 metadata-only visual_evidence_available,不回 raw image bytes、不回 raw URL、不做人臉/車牌/個體追蹤 | API key required,目前可能回 metadata_only_snapshot_available / snapshot_not_available / analysis_not_enabled |
GET /v1/reality/cameras/vision-provider/status | Camera Vision Provider Status V0:只回 provider/model/credential 是否 configured 的 metadata;不呼叫外部 vision API、不回 key/env/raw prompt/raw image;內含 camera_vision_call_budget_guard_v0、max_calls_per_camera_per_hour、cache_ttl_seconds、max_image_bytes | API key required,回 camera_vision_provider_status_v0,可能是 not_configured / configured_disabled |
GET /v1/reality/cameras/{camera_id}/stability | Camera Stability Monitor v0:回報 fetch 成功率、延遲與內容一致性;不公開 raw URL | API key required,目前多為 limited_history |
GET /v1/reality/cameras/{camera_id}/cross-check | Camera × Official Data Cross-check v0:標準化攝影機 visual evidence 與 CWA / radar / satellite / traffic / water/disaster 官方來源的關係 | API key required,目前回 insufficient_data / visual_analysis_not_enabled |
POST /v1/reality/check | 送出自然語言 Reality Check 查詢 | API key required,目前氣象查詢可回 live_data;CWA Forecast Query V0 支援 rain_forecast / cwa_rain_forecast_answer_v0,用 CWA 短時預報回答「阿里山下午會下雨嗎?」並標示 forecast 不是 current observation;CWA Earthquake Reality V0 支援 earthquake_recent,使用 E-A0015-001 / E-A0016-001 回最近地震、震央、規模、深度、最大震度與受影響縣市 |
POST /v1/reality/demo-check | Public Demo Check:首頁免 API key demo mode;不需要 X-API-Key,且只允許首頁固定 demo queries(Level 2 為 15 個固定 demo 問題);非 allowlist 問題回 demo_query_not_allowed | Public but allowlisted;不回傳、不嵌入、不暴露 server-side API key;任意查詢仍需使用 POST /v1/reality/check + 自己的 API key |
Production Readiness Matrix V0
GET /v1/reality/production-readiness 回 production_readiness_matrix_v0 / readiness_matrix_returned,用 L0–L8 明確區分 planned、contract、staging verified、production candidate 與 production ready,避免把 foundation 誤稱為 production。
- L0 idea / planned:概念或待接入。
- L4 staging live data:staging 已有 live data,但尚未達 production。
- L7 production ready:需 live data、provenance、freshness、confidence、cross-validation、safety、persistence、monitoring、docs/tests/staging verification 與 production operations 皆完成。
- CWA Weather Reality = L6 production candidate:已有 live CWA observation/rainfall runtime 與 staging verification,但仍缺 durable observation storage、source health persistence、production monitoring 與 radar/satellite/forecast cross-validation。
- Camera Visual Validation = L3 client ready foundation:已有 registry/snapshot metadata/source lineage/stability/cross-check contracts,但仍缺 first-party/licensed camera source、live snapshot fetch 與 AI visual evidence production pipeline。
production_ready_count=0:目前沒有任何能力標記為 L7 production ready。
Source Runtime Health V0
GET /v1/reality/source-health 回 source_runtime_health_v0 / source_health_returned,用 read-only metadata 檢查 CWA official API client 與 camera visual validation foundation 的 runtime readiness。
fetch_performed=false:此 endpoint 不呼叫上游資料源,只檢查 runtime 設定與缺口。- CWA credential configured without printing key:只回
credential_configured=true/false,不顯示CWA_API_KEY或任何 key value。 - camera_visual_validation foundation_only:攝影機仍是 foundation/contract;缺 first-party 或 licensed source、live snapshot fetch 與 AI visual evidence production pipeline。
- source_catalog_runtime_status_v0:同一個 API-key guarded response 也回 metadata-only
source_catalogpersistence status;source catalog runtime-status required value tableSOURCE_CATALOG_RUNTIME_STATUS_REQUIRED_VALUES維護schema_version=source_catalog_runtime_status_v0、metadata_only=true與 redaction booleans;source catalog runtime restart-consistency required value tableSOURCE_CATALOG_RUNTIME_RESTART_CONSISTENCY_REQUIRED_VALUES維護source_catalog_runtime_restart_consistency_v0/compare_field=catalog_sha256/metadata_only=true/paths_hidden=true;source catalog runtime durable-load-proof required value tableSOURCE_CATALOG_RUNTIME_DURABLE_LOAD_PROOF_REQUIRED_VALUES維護source_catalog_runtime_durable_load_proof_v0/compare_field=catalog_sha256/public_sources_endpoint=/v1/reality/sources/metadata_only=true/paths_hidden=true/requires_path_exposure=false;source catalog health check required contract value tableSOURCE_CATALOG_HEALTH_CHECK_REQUIRED_CONTRACT_VALUES維護scripts/source_catalog_health_check.py的 require checks safe fixed values(storage_mode=durable_json_v1、loaded_from_durable=true、restart_consistency_schema_version=source_catalog_restart_consistency_v0、restart_consistency_compare_field=catalog_sha256、metadata_only=true、paths_hidden=true),source catalog health check schema/status allowlist sanitization 只輸出 allowlisted top-level schema_version / status,drift 值改成 unknown,避免 schema/status 欄位回顯 path/payload text;source catalog health check source count strict int sanitization 只輸出 exact int source_count,drift 值改成 0,避免 count 欄位回顯 path/payload text;source catalog health check storage durable strict bool sanitization 只把 exact bool true 視為 durable,避免 truthy string drift;source catalog health check storage mode allowlist sanitization 只輸出 allowlisted storage mode,未知值改成 unknown,避免 mode drift 回顯 path/locator/credential;operator output 仍不顯示 durable path、source payload、credential 或 raw feed locator;source catalog runtime restart-reload-check required value tableSOURCE_CATALOG_RUNTIME_RESTART_RELOAD_CHECK_REQUIRED_VALUES維護source_catalog_restart_reload_check_v0/helper_schema_version=source_catalog_restart_reload_v0/compare_field=catalog_sha256/public_sources_endpoint_after_restart=/v1/reality/sources/admin_health_endpoint_after_restart=/admin/sources/health/metadata_only=true/paths_hidden=true/requires_path_exposure=false;source catalog health restart-reload-check required value tableSOURCE_CATALOG_HEALTH_RESTART_RELOAD_CHECK_REQUIRED_VALUES讓/admin/sources/health使用同一組 metadata-only restart reload proof values;source catalog health restart-consistency required value tableSOURCE_CATALOG_HEALTH_RESTART_CONSISTENCY_REQUIRED_VALUES維護/admin/sources/health的source_catalog_restart_consistency_v0/compare_field=catalog_sha256/metadata_only=true/paths_hidden=truecompare guide;source catalog health redaction required value tableSOURCE_CATALOG_HEALTH_REDACTION_REQUIRED_VALUES;source catalog health metadata-safety required value tableSOURCE_CATALOG_HEALTH_METADATA_SAFETY_REQUIRED_VALUES維護/admin/sources/health的metadata_only=true/paths_hidden=true;source catalog health write-scope required value tableSOURCE_CATALOG_HEALTH_WRITE_SCOPE_REQUIRED_VALUES維護/admin/sources/health固定 write-scope safety values(write_scope=sources_only/cameras_written=0/clients_written=0/production_apply_locked=true);source catalog health check write-scope safe value tableSOURCE_CATALOG_HEALTH_CHECK_WRITE_SCOPE_SAFE_VALUES維護scripts/source_catalog_health_check.pysanitized operator output 的相同 write-scope values,且不輸出 camera/client payload、durable path、credential 或 raw feed locator;source catalog health redaction required values 維護/admin/sources/healthredaction booleanssecrets_removed=true/raw_feed_locators_removed=true/paths_hidden=true;source catalog runtime file-safety-proof required value tableSOURCE_CATALOG_RUNTIME_FILE_SAFETY_PROOF_REQUIRED_VALUES維護source_catalog_runtime_file_safety_proof_v0/owner_only_file_mode_required=true/metadata_only=true/paths_hidden=true/requires_path_exposure=false;並包含source_catalog_storage、loaded_from_durable、source_count、redactedcatalog_sha256、source_catalog_runtime_restart_consistency_v0compare guide(compare_field=catalog_sha256/paths_hidden=true)、source_catalog_runtime_durable_load_proof_v0(只回 durable load flag、/v1/reality/sourcesendpoint、source_catalog_restart_reload_check_v0、requires_path_exposure=false與source_catalog_runtime_file_safety_proof_v0/owner_only_file_mode_required=true,標示 load 已驗證 owner-only file mode 但不曝光 path)與 redaction flags;可用於 client-side restart checksum visibility;fresh startup durable catalog source-health metadata-only 已鎖定 fresh app import/startup 載入ADMIN_SOURCE_CATALOG_PATH後只回 storage/checksum/count,不顯示 durable path、source payload、credential、raw feed locator 或 secret;source_catalog_load_validation_v0也寫入storage_wrapper_keys_rechecked_after_read=true、storage_wrapper_values_rechecked_after_read=true、metadata_collection_types_rechecked_after_read=true、metadata_scalar_types_rechecked_after_read=true與redaction_wrapper_values_rechecked_after_read=true、redaction_removed_categories_order_rechecked_after_read=true,宣告 startup/load 在 JSON read 後會重新確認 storage wrapper 仍只含 metadata-only durable_json_v1/mode booleans,且mode=durable_json_v1/durable=true值也重新驗證;metadata collection 仍只由 object/list 組成、scalar value 仍維持 JSON-safe string/bool/null/int/finite-float 型別,且 redaction removed_categories 仍是 deterministic ordered allowlist。 - Source Health Persistence V0:若設定
SOURCE_HEALTH_LOG_PATH,/v1/reality/source-health會回source_health_persistence_v0metadata summary,包含 per-sourcelast_success_at、last_failure_at、success_rate、failure_count、avg_latency_ms與 latest status;也會回source_health_rolling_windows_v024h rolling windows,包含每個 source 的 sample_count、success_rate、failure_count、avg_latency_ms、last_success_at / last_failure_at;不顯示檔案路徑、API key、credential、raw feed URL 或 source payload。 - Source Health Recorder / Probe V0:
POST /v1/reality/source-health/probe回source_health_probe_v0,以write_scope=source_health_observations_only寫入 CWA official source configuration-only health observations;fetch_performed=false,不呼叫 CWA upstream、不顯示 credential。 - CWA Live Fetch Health Probe V0:
POST /v1/reality/source-health/probe/live-cwa回cwa_live_fetch_health_probe_v0,作為 live upstream probe 實際呼叫 CWA weather/rainfall datasets 一次,記錄latency_ms、staleness_seconds、success/failure 與error_code;只寫入source_health_observations_only,不顯示 credential、raw URL、JSONL path 或 source payload。 - CWA Source Health Scheduled Probe V0:
scripts/probe_cwa_source_health.py可由 operator、cron 或 systemd timer 呼叫既有/v1/reality/source-health/probe/live-cwa;script 從REALITY_API_BASE_URL/TRUESIGHT_REALITY_API_BASE_URL與REALITY_API_KEY/TRUESIGHT_REALITY_API_KEY讀設定,輸出cwa_scheduled_source_health_probe_v0metadata-only summary;notification_sent=false,不輸出 key、raw payload、raw URL 或 source payload。自動排程尚未啟用。 - CWA Source Health systemd Timer V0:
deploy/systemd/taiwan-world-model-cwa-probe.service與deploy/systemd/taiwan-world-model-cwa-probe.timer提供每 10 分鐘執行 probe helper 的 staging templates;unit 只用EnvironmentFile=/etc/taiwan-world-model.env讀取 server-side env,不寫 plaintext key;OnUnitActiveSec=10min、Persistent=true、StandardOutput=journal。template 不會因 rsync/deploy 自動 enable,需 operator 先手動systemctl start驗證,再systemctl enable --now。 - CWA Source Health Thresholds / Degraded Mode V0:
/v1/reality/source-health回cwa_degraded_mode_v0,將 source health history 轉成healthy / degraded / stale / upstream_error / configuration_required;包含production_usable、confidence_modifier、reasons 與 thresholds。/v1/reality/check也會回reality_health_status並套用cwa_degraded_response_policy_v0:degraded 時降 confidence/status,stale/upstream_error 時不再包裝成完整即時資料。 - CWA Monitoring / Alerting V0:
/v1/reality/source-health/alerts回cwa_monitoring_alerts_v0,把 source health history 轉成 metadata-only alerts;read_only=true、fetch_performed=false、notification_sent=false,不呼叫 CWA、不寄送外部通知、不顯示 credential、raw URL、JSONL path 或 source payload。 - Forecast / Radar / Satellite Cross-validation V0:
/v1/reality/weather/cross-validation回cwa_forecast_radar_satellite_cross_validation_v0,提供 forecast/radar/satellite/observation 的證據角色、交叉驗證政策與限制;目前是 metadata contract,read_only=true、fetch_performed=false、runtime_connected=false,不下載雷達/衛星圖、不把衛星雲圖當單點地面雨勢;目前runtime_status=radar_satellite_metadata_and_disagreement_contract_ready。Radar Runtime Metadata V0 另由/v1/reality/weather/radar-metadata回cwa_radar_runtime_metadata_v0,先定義 CWA radar evidence role、10/20/30 分鐘 freshness bands 與 station rainfall ground-truth limitation;仍不下載雷達圖、不做 image analysis。Satellite Runtime Metadata V0 另由/v1/reality/weather/satellite-metadata回cwa_satellite_runtime_metadata_v0,定義 CWA satellite broad cloud / typhoon context role、30/60/120 分鐘 freshness bands 與 regional-context limitation;仍不下載衛星圖、不做 image analysis。Disagreement Scoring Contract V0 另由/v1/reality/weather/disagreement-scoring回cwa_disagreement_scoring_contract_v0,先定義 observation/forecast/radar/satellite 分歧評分維度、confidence modifiers 與 official observation / official alerts first 的 authority policy;仍不計算 live score。
CWA Weather Reality Production Gap Checklist V0
GET /v1/reality/cwa-production-gap 回 cwa_production_gap_v0 / gap_checklist_returned,明確列出 CWA Weather Reality 從 L6 → L7 production ready 的 pass / partial / blocker。
read_only=true且fetch_performed=false:此 endpoint 不呼叫 CWA、不寫入資料,只回 checklist metadata。- pass:官方 CWA credential、live observation/rainfall runtime 等已完成項。
- partial:freshness/confidence contract、forecast/radar/satellite metadata contract、source-health monitoring alert evaluator、External Notification Channel Staging Config Contract V0(
notification_channel_status_ready)、Escalation Ownership Contract V0(escalation_policy_contract_ready)、Staging Real-send Approval Contract V0(real_send_approval_contract_ready)、Production Monitoring Notification Delivery Contract V0、Staging Notification Drill V0(dry_run_available)、CWA Operator Runbook Contract V0(cwa_runbook_contract_ready)與 staging runbook 已有基礎但仍缺 runtime fetch / external notification delivery / approved one-time real-send drill / rollback drill。 - blocker:目前 CWA Weather Reality L7 checklist 已無 metadata-layer blocker;production_ready 仍為 false,因多項必要 gate 仍是 partial。
- 不顯示
CWA_API_KEY、REALITY_API_KEY或任何 credential value。
Admin Console Security Foundation V0
Reality API 也提供給人類營運者看的後台入口:/admin/login。V0 使用 server-side admin username + password hash、session cookie、HttpOnly、Secure、SameSite=Lax,並有登入失敗 rate-limit 與 audit log foundation。
- Dashboard:顯示 API clients、usage summary 與人類可讀管理入口。
- Sources / Cameras:顯示資料源與攝影機 registry metadata,不顯示 plaintext API key、不顯示 raw CCTV URL、不顯示 key hash 或 server secrets。
- Export:
GET /admin/export/catalog.json回schema_version=admin_export_v0,採 metadata-only redacted export。 - Import Dry-run:
GET /admin/import與POST /admin/import/dry-run提供 Admin Import Dry-run V0;回schema_version=admin_import_dry_run_v0、apply_enabled=false,只做 schema validation、SSRF/security scan、dry-run diff,不會寫入 production registry。 - Visual Diff:表單預設
response_format=html,顯示 Admin Import Visual Diff V0,包含 summary table、diff table、Security findings、Validation errors、Apply disabled、No data has been written。 - Field Diff:Admin Import Field-level Diff V0 會在 JSON 回應加入
field_diffs,並在 HTML 顯示 Field-level before/after diff 與Field changes;不顯示 secrets、API key、tokens、cookies、password 或 raw feed 欄位。 - Confirmation:Admin Import Confirmation Token V0 會在 dry-run 回應加入
confirmation、payload_sha256、confirmation_token流程與/admin/import/applyendpoint;V0 永遠回apply_disabled_v0,並明確顯示 No data has been written。 - Rollback Snapshot:Admin Import Rollback Snapshot V0 提供
POST /admin/import/rollback-snapshot與GET /admin/import/rollback-snapshot/{snapshot_id};回admin_import_rollback_snapshot_v0、snapshot_id、snapshot_sha256、restore_enabled=false,V0 採in_memory_v0且只保存 redacted metadata snapshot。 - Audit:Durable Admin Audit Log V0 支援
ADMIN_AUDIT_LOG_PATH,例如/var/log/taiwan-world-model/admin-audit.jsonl;每筆 JSONL 使用admin_audit_log_v0,可記錄payload_sha256、snapshot_id、token_valid等安全 metadata;不寫入 secrets、API key/hash、tokens、cookies、passwords 或 raw CCTV URL。 - Audit Viewer:Admin Audit Log Viewer V0 提供
/admin/audit;回admin_audit_log_viewer_v0/audit_events_returned,read_only=true、delete_enabled=false,支援endpoint/decision/reasonfilters,只顯示 audit metadata,不顯示 request body、tokens、keys、cookies、passwords 或 raw feed locators。 - Role Permissions:Admin Role Permissions V0 使用
viewer/operator/admin三層角色;viewer可讀取 admin 頁面與 audit metadata(viewer 可讀取 admin 頁面),operator可執行 dry-run / restore dry-run / cleanup dry-run(operator 可執行 dry-run),admin才可進入 apply / cleanup apply / client status update 等安全流程(admin 才可進入 apply / cleanup apply);權限不足回admin_role_forbidden,並明確顯示 No data has been written。 - CSRF:Admin CSRF Protection V0 會在 session form 加入
csrf_token,並保護/admin/import/dry-run、/admin/import/apply、/admin/import/rollback-snapshot;缺 token 或錯 token 回admin_csrf_v0/csrf_validation_failed,並明確顯示 No data has been written。 - Apply Guard:Staging-only Apply Guard V0 使用
REALITY_DEPLOYMENT_ENV;deployment_env=production時即使 confirmation token 與 payload hash 都正確,也回production_apply_locked/ Production apply is locked;deployment_env=staging目前仍回apply_disabled_v0,兩者都明確顯示 No data has been written。 - Preview Lock:Apply Preview Lock V0 要求
/admin/import/apply在進入 apply preview 前必須提供rollback_snapshot_id與rollback_snapshot_sha256;缺少回rollback_snapshot_required,id/hash 不匹配回rollback_snapshot_mismatch,成功驗證才回rollback_snapshot_valid=true;V0 仍不寫入並顯示 No data has been written。 - Durable Snapshot:Durable Rollback Snapshot V1 支援
ADMIN_ROLLBACK_SNAPSHOT_DIR;設定後 rollback snapshot 會以admin_import_rollback_snapshot_v1JSON 檔落盤,responsestorage.mode=durable_json_v1、storage.durable=true,即使 server restart 後仍可透過 snapshot id 取回。 - Snapshot List:Rollback Snapshot List V0 提供
/admin/import/rollback-snapshots;回admin_rollback_snapshot_list_v0/snapshot_list_returned的 metadata list,只列 snapshot id、sha256、generated_at、contains、storage,不回 snapshot data,且apply_enabled=false、restore_enabled=false、No data has been written。 - Restore UI:Human Admin Restore UI V0 會在
/admin/import顯示 Rollback Snapshot List,每筆提供 Restore dry-run 與 Restore apply 表單;apply 仍由ADMIN_IMPORT_APPLY_ENABLED控制,且 V0 仍是 sources-only。 - Snapshot Cleanup:Snapshot Cleanup Dry-run V0 提供
/admin/import/rollback-snapshots/cleanup-dry-run;回admin_rollback_snapshot_cleanup_dry_run_v0/cleanup_dry_run_completed,支援max_files與max_age_daysretention preview,且cleanup_enabled=false、delete_enabled=false、No snapshot files have been deleted。 - Snapshot Cleanup Apply:Snapshot Cleanup Apply V0 提供
/admin/import/rollback-snapshots/cleanup-apply;需先有 dry-run 產生的cleanup_plan_id/cleanup_plan_sha256,缺少回cleanup_plan_required,drift/hash 錯誤回cleanup_plan_mismatch,production 回production_cleanup_locked,staging + flag true 才回admin_rollback_snapshot_cleanup_apply_v0/staging_snapshot_cleanup_applied_v0,且delete_scope=rollback_snapshots_only。 - Snapshot Cleanup UI:Snapshot Cleanup UI V0 會在
/admin/import顯示 Preview cleanup candidates 表單,支援max_files/max_age_days;HTML dry-run 結果顯示cleanup_plan_id/cleanup_plan_sha256與 Apply cleanup 表單,但仍受 staging-only 與 apply flag 保護。 - Durable Confirmation:Durable Confirmation Token Store V0 支援
ADMIN_CONFIRMATION_TOKEN_DIR;設定後 confirmation token metadata 會以admin_import_confirmation_v1JSON 檔落盤,只保存token_sha256,不保存 plaintext token;apply response 會回confirmation_storage,仍顯示 No data has been written。 - Restore Preview:Restore / Rollback Dry-run V0 提供
/admin/import/rollback-snapshot/{snapshot_id}/restore-dry-run;回admin_restore_dry_run_v0/restore_dry_run_completed,找不到 snapshot 回snapshot_not_found,且永遠restore_enabled=false、顯示 Restore dry-run only 與 No data has been written。 - Source Restore:Source Restore Apply V0 提供
/admin/import/rollback-snapshot/{snapshot_id}/restore-apply;僅在 staging 且ADMIN_IMPORT_APPLY_ENABLED=true時以admin_restore_apply_v0/staging_source_restore_applied_v0恢復restore_scope=sources_only,先建立pre_restore_backup_snapshot_id,寫入 durable source catalog,且cameras_restored=0、clients_restored=0。production 回production_restore_locked,flag false 回restore_disabled_v0。 - Apply Flag:Staging Real Apply Enable Flag V0 使用
ADMIN_IMPORT_APPLY_ENABLED;response 會回apply_enabled_flag。production 仍回production_apply_locked;staging 且 flag false 回apply_disabled_v0;staging 且 flag true 必須先通過 apply plan lock,且 V0 只允許sources_onlywrite scope。 - Apply Plan:Staging Registry Write Plan / Transaction V0 提供
/admin/import/apply-plan;回admin_import_apply_plan_v0/apply_plan_created、transaction_plan_id、pre_write_hash、post_write_expected_hash,但仍write_plan_enabled=false、Apply plan only、No data has been written。若設定ADMIN_APPLY_PLAN_DIR,apply plan 會以storage.mode=durable_json_v1落盤,server restart 後仍可驗證。 - Apply Plan Lock:Apply Plan Lock / Plan Confirmation V0 要求
/admin/import/apply在 staging real apply flag 開啟時綁定transaction_plan_id、pre_write_hash、post_write_expected_hash;缺 plan 回apply_plan_required,hash 或 payload/snapshot 不一致回apply_plan_mismatch,有效 plan 回transaction_plan_valid=true。 - Source Write:Source-only Staging Registry Write V0 / Durable Source Catalog Store V0 僅在
REALITY_DEPLOYMENT_ENV=staging且ADMIN_IMPORT_APPLY_ENABLED=true、confirmation/rollback/apply-plan 全部有效時寫入 sources;成功回staging_source_write_applied_v0、write_scope=sources_only、source_catalog_storage、source_catalog_health(metadata-onlysource_catalog_health_v0checksum/restart compare guide,含 top-levelsource_catalog_health.paths_hidden=true、planner_source_count與runtime_catalog_in_sync)、cameras_written=0、clients_written=0。若設定ADMIN_SOURCE_CATALOG_PATH,成功後會以admin_source_catalog_v1/durable_json_v1透過 same-directory temp file、existing catalog lstat-only metadata validation guard、temp catalog lstat-only metadata validation guard、post-replace catalog lstat-only metadata validation guard、write parent preflight lstat-only metadata validation guard、pre-write temp catalog chmod guard、temp file creation failure fail-closed guard / temp file creation TypeError fail-closed guard(temporary source catalog file must be creatable)、temp file open failure fail-closed guard / temp file context enter TypeError fail-closed guard(temporary source catalog file must be openable)、temp file lstat-before-chmod failure fail-closed guard / temp file lstat-before-chmod TypeError fail-closed guard(temporary source catalog file must be inspectable before chmod)、temp cleanup unlink TypeError primary-error preservation guard、temp file chmod failure fail-closed guard / temp file chmod TypeError fail-closed guard(temporary source catalog file must be chmodable)、post-chmod temp file fd mode recheck、temp file fd fileno failure fail-closed guard / temp file fd fileno before write TypeError fail-closed guard、temp file lstat before write TypeError fail-closed guard(temporary source catalog file fd must be inspectable before write)、temp file fd fstat failure fail-closed guard / temp file fd fstat before write TypeError fail-closed guard(temporary source catalog file fd must be inspectable before write)、temp file path lstat failure fail-closed guard(temporary source catalog file must be inspectable before write)、temp file fd/path identity recheck(temporary source catalog path changed before write)、pre-tempfile parent-dir no-follow guard(source catalog parent directory must not be group/world-writable before write)、write parent-dir open fail-closed guard / write parent-dir open TypeError fail-closed guard(source catalog parent directory must be openable before write)、write parent-dir fstat failure fail-closed guard / write parent-dir fstat TypeError fail-closed guard(source catalog parent directory must be inspectable before write)、write parent-dir lstat failure fail-closed guard(source catalog parent directory must be inspectable before write)、write parent-dir primary failure precedence guard、write parent-dir close failure fail-closed guard、write parent-dir close TypeError fail-closed guard(source catalog parent directory fd must be closable before write)、write parent-dir fd/path identity recheck(source catalog parent directory changed before write)、pre-replace parent-dir fd metadata recheck(source catalog parent directory must not be group/world-writable before replace)、pre-replace parent-dir open fail-closed guard / pre-replace parent-dir open TypeError fail-closed guard(source catalog parent directory must be openable before replace)、pre-replace parent-dir fstat failure fail-closed guard / pre-replace parent-dir fstat TypeError fail-closed guard(source catalog parent directory must be inspectable before replace)、pre-replace parent-dir lstat failure fail-closed guard / replace identity lstat TypeError fail-closed guard、pre-replace parent-dir primary failure precedence guard(source catalog parent directory must be inspectable before replace)、pre-replace parent-dir close failure fail-closed guard、pre-replace parent-dir close TypeError fail-closed guard(source catalog parent directory fd must be closable before replace)、parent mkdir failure fail-closed guard / parent mkdir TypeError fail-closed guard(source catalog parent directory must be creatable)、atomic replace failure fail-closed guard / atomic replace TypeError fail-closed guard(source catalog path must be replaceable atomically)、restart consistency paths_hidden=true、temporary source catalog parent symlink guard(temporary source catalog parent directory must not be a symlink)、flush/fsync、private file mode 0600、atomic replace、post-replace catalog path recheck、post-replace catalog fd no-follow recheck、post-replace catalog fd/path identity recheck、post-replace catalog open fail-closed guard(source catalog path must be openable after replace)、post-replace catalog fstat failure fail-closed guard / post-replace catalog fstat TypeError fail-closed guard、post-replace catalog lstat TypeError fail-closed guard(source catalog fd must be inspectable after replace)、post-replace catalog fd primary failure precedence guard、post-replace catalog lstat failure fail-closed guard(source catalog path must be inspectable after replace)、post-replace catalog close failure fail-closed guard(source catalog fd must be closable after replace)、post-replace parent-dir fd metadata recheck / post-replace parent-dir open TypeError fail-closed guard(source catalog parent directory must be openable after replace/source catalog parent directory must not be group/world-writable after replace)、post-replace parent-dir fstat failure fail-closed guard / post-replace parent-dir fstat TypeError fail-closed guard(source catalog parent directory must be inspectable after replace)、post-replace parent-dir lstat failure fail-closed guard(source catalog parent directory must be inspectable after replace)、post-replace parent-dir primary failure precedence guard、post-replace parent-dir close failure fail-closed guard、post-replace parent-dir close TypeError fail-closed guard / after-replace parent-dir close failure fail-closed guard(source catalog parent directory fd must be closable after replace)、parent-dir fsync no-follow guard、parent-dir fsync fstat failure fail-closed guard(source catalog parent directory must be inspectable during fsync)、parent-dir fsync lstat failure fail-closed guard(source catalog parent directory must be inspectable during fsync)、parent-dir fsync fstat owner/mode recheck、parent-dir fsync fd/path identity recheck(source catalog parent directory changed during fsync)、parent-dir fsync open fail-closed guard、parent-dir fsync open TypeError fail-closed guard、parent-dir fsync fstat TypeError fail-closed guard(source catalog parent directory must be openable during fsync)與 parent-dir fsync failure fail-closed guard(source catalog parent directory must be fsyncable)、parent-dir fsync primary failure precedence guard、parent-dir fsync close failure fail-closed guard、parent-dir fsync close TypeError fail-closed guard(source catalog parent directory fd must be closable during fsync)、temp file write failure fail-closed guard / temp file write TypeError fail-closed guard(temporary source catalog file must be writable)、temp file fsync failure fail-closed guard(temporary source catalog file must be fsyncable)、temp file fd fileno during fsync failure fail-closed guard / temp file fd fileno during fsync TypeError fail-closed guard(temporary source catalog file fd must be inspectable during fsync)、temp file fd fstat during fsync failure fail-closed guard / temp file fd fstat during fsync TypeError fail-closed guard(temporary source catalog file fd must be inspectable during fsync)、temp file close-after-write failure fail-closed guard / temp file close-after-write TypeError fail-closed guard(temporary source catalog file fd must be closable after write)、temp file write primary failure precedence guard(保留temporary source catalog file must be writable)落盤;若 replace 後 catalog path 變成 symlink 會 fail closed(source catalog path must not be a symlink),不回報成功、不寫入 operator-visible symlink target;startup/load 另有 load parent-dir open fail-closed guard(source catalog parent directory must be openable before read)與 load parent-dir close failure fail-closed guard(source catalog parent directory fd must be closable before read),並會拒絕 world-readable catalog file;save/write 也有 owner-only existing catalog write guard(source catalog path must be owner-only readable/writable);startup/load 也會拒絕 hardlinked catalog file(source catalog path must not have multiple hard links)、unowned catalog file(source catalog path must be owned by the service user)、unowned parent directory(source catalog parent directory must be owned by the service user)與 world-writable parent directory(source catalog parent directory must not be group/world-writable);load-time parent-dir no-follow guard 會以O_NOFOLLOW/O_DIRECTORY開啟 parent directory 並重新確認不是 group/world-writable(source catalog parent directory must not be group/world-writable before read),且執行 load-time parent-dir fd/path identity recheck(source catalog parent directory changed before read);relative storage path(source catalog path must be absolute)、symlink storage path(source catalog path must not be a symlink)、directory storage path / non-regular storage path(source catalog path must be a regular file)、parent path file(source catalog parent path must be a directory)或 symlink parent/ancestor directory;建立缺少 parent directory 後會做 post-mkdir parent symlink recheck(source catalog parent directory must not be a symlink)、too many sources(source catalog cannot contain more than 1000 sources)、duplicatesource_id、out-of-range priority(priority must be between 0 and 10000)、overlong source_id、overlong text fields(source identity / license_note / supports_intents / safety_notes 必須 256 characters or fewer)、source locator 欄位 redaction(hostname-only locator keys 也會移除)、source text list overflow(supports_intents cannot contain more than 100 items/safety_notes cannot contain more than 100 items)、overlong metadata string values(metadata key/value string 必須 256 characters or fewer)、non-finite metadata numbers(metadata numbers must be finite)、non-standard JSON constants(non-standard JSON constants are not allowed)、oversized source catalog file / write-before-temp-file size guard(source catalog file cannot exceed 1000000 bytes)、metadata total node count overflow(metadata total node count cannot exceed 1000)、metadata serialized size overflow(metadata serialized size cannot exceed 16384 bytes)、metadata depth overflow(metadata depth cannot exceed 8 levels)、metadata collection overflow(metadata collections cannot contain more than 100 items)、blank/paddedsupports_intents/ blank/padded safety_notes / blank/padded license_note / blank/padded identity fields(name/provider/source_type/integration_status,必須是 non-empty unpadded strings)/ blank/padded metadata keys 或含 unsupported characters(例如 slash/path-like)的 invalidsource_id會在開啟 temp file 前被拒絕並保留既有 catalog;replace 失敗時保留舊 catalog 並清理 temp file;apply 流程會先完成 durable save,再切換 runtime catalog / Evidence Planner,因此 durable save 失敗不會把 imported source 洩入 memory-only runtime。service startup 會載入 durable catalog,restart 後/v1/reality/sources仍可看到 imported source,且 sources endpoint 會回報source_catalog_storage(memory/durable mode,不含路徑或 secrets);同一個 runtime 也會在 sources-only apply 成功後重建 Evidence Planner,讓後續/v1/reality/check的 evidence planning 使用更新後 source catalog。durable catalog 與 apply 後同 process runtime catalog 都會移除 raw feed URL、一般http(s)URL value、streaming scheme URL-like value(rtsp:///rtmp:///ws:///wss:///ftp:///sftp://)、embedded URL-like string value、scheme-relative URL value、bare host/path URL-like value、bare IP host/path URL-like value、credentials、passwords、tokens、JWT-like compact token value、PEM private key value redaction、PGP private key block value redaction、PuTTY private key value redaction、bare cloud access key ID value redaction(bare cloud access key ID direct regex coverage)、AWS secret access key value redaction(AWS secret access key direct regex coverage)、AWS session token value redaction(AWS session token direct regex coverage)、AWS presigned URL query value redaction(AWS presigned URL query direct regex coverage)、Cloudinary URL value redaction(Cloudinary URL direct regex coverage)、1Password service account token value redaction(1Password service account token direct regex coverage)、Terraform Cloud token value redaction(Terraform Cloud token direct regex coverage)、Cloudflare API token value redaction、Fastly API token value redaction、Langfuse secret key value redaction、Helicone API key value redaction、Doppler service token value redaction(Doppler service token direct regex coverage)、PlanetScale service token value redaction(PlanetScale service token direct regex coverage)、PlanetScale password value redaction(PlanetScale password direct regex coverage)、MQTT broker locator value redaction、Kafka broker locator value redaction、AMQP broker locator value redaction、Redis cache locator value redaction、NATS broker locator value redaction、GitHub PAT value redaction、GitHub PAT direct regex coverage、Slack token value redaction、session/cookie credential value redaction、credentialed URI userinfo value redaction(including IPv4 URI userinfo value redaction, IPv6 URI userinfo value redaction, and localhost URI userinfo value redaction)、non-JSON-safe opaque metadata values、non-string metadata keys、authorization/bearer header hints,以及 metadata list / nested metadata list / metadata tuple 裡的Authorization: ...、Authorization = ...、Bearer ...、api_key=...、api key: ...、access_token=...、access token: ...、refresh-token: ...、refresh token=...、client_secret=...、private-key: ...、password_hash=...、token=...、token: ...、password=...、password: ...、secret=...、secret: ...類 secret-like string values;redaction 同時是 key-based 與 value-based URL-like redaction / secret-like redaction,即使敏感 locator 或 secret-like string 被放在非敏感命名欄位也會移除,避免/v1/reality/sources或 Evidence Planner 在 restart 前短暫暴露敏感 metadata;若 catalog 檔案 corrupt / unreadable / top-level non-object JSON / schema 不符、sources不是 list、含 non-object source entries,或單筆 source 欄位 malformed(malformed source item fail-closed,包含supports_intents/safety_notes不是 list,list 內含 non-string item 而非 list of strings,或metadata非 object/null),或偵測到 unredacted loaded catalog files(durable JSON 仍含會被 redaction 移除的 raw URL/credential/token metadata),load 會 fail closed / 忽略整份 unsafe durable file 並 fallback seed/valid catalog data,不會邊載入邊清理、不會 crash 或載入 unsafe data。Source Catalog Health V0 會在/admin/sources顯示 Metadata-only health panel,且/v1/reality/sources會回source_catalog_healthpublic source catalog health summary,包含source_catalog_health_v0、loaded_from_durable、redactedcatalog_sha256、metadata_only=true與paths_hidden=true;admin panel 另外包含source_count、storage_mode、loaded_from_durable與 redactedcatalog_sha256;不顯示 durable file path、source record payload、API key/hash、tokens、passwords 或 raw feed locators。payload 若包含 cameras/clients 回unsupported_write_scope_v0;production 仍回production_apply_locked。 - Durable redaction hardening:source catalog value-based URL-like redaction 也涵蓋 cloud storage URI locator values(例如
s3:///gs:///file://)、GitLab token value redaction(例如 GitLab PAT / OAuth token-shaped values;GitLab token direct regex coverage)、GitLab CI job token value redaction(例如 GitLab CI job / runner token-shaped values;GitLab CI job token direct regex coverage)、Linear API key value redaction(例如 Linear API key-shaped values;Linear API key direct regex coverage)、Mapbox access token value redaction(例如 Mapbox access token-shaped values;Mapbox access token direct regex coverage)、Opsgenie API key value redaction(例如 GenieKey-prefixed values)、IPv4 host:port locator value redaction(例如 metadata-only IPv4 host:port locator-shaped values)、bare host:port locator value redaction、percent-encoded bare host:port locator value redaction(例如 metadata-only domain host:port locator-shaped values)、percent-encoded IPv4 host:port locator value redaction(例如 metadata-only URL/query encoded IPv4 host:port locator-shaped values)、IPv6 host:port locator value redaction、percent-encoded IPv6 host:port locator value redaction(例如 metadata-only bracketed IPv6 host:port locator-shaped values)、localhost host:port locator value redaction、percent-encoded localhost host:port locator value redaction(例如 metadata-only localhost host:port locator-shaped values)、Oracle connection locator value redaction(例如 Oracle connection locator-shaped values;Oracle connection locator direct regex coverage)、Elasticsearch connection locator value redaction(例如 Elasticsearch connection locator-shaped values)、OpenSearch connection locator value redaction(例如 OpenSearch connection locator-shaped values)、ClickHouse connection locator value redaction(例如 ClickHouse connection locator-shaped values)、Memcached cache locator value redaction(例如 Memcached cache locator-shaped values)、Cassandra connection locator value redaction(例如 Cassandra connection locator-shaped values;Cassandra connection locator direct regex coverage)、MQTT broker locator value redaction(例如 MQTT broker locator-shaped values;MQTT broker locator direct regex coverage)、Kafka broker locator value redaction(例如 Kafka broker locator-shaped values;Kafka broker locator direct regex coverage)、Snowflake connection locator value redaction(例如 Snowflake connection locator-shaped values)、CockroachDB connection locator value redaction(例如 CockroachDB connection locator-shaped values)、SQL Server connection locator value redaction(例如 SQL Server / JDBC SQL Server connection locator-shaped values)、MariaDB connection locator value redaction(例如 MariaDB connection locator-shaped values)、SQLite connection locator value redaction(例如 SQLite connection locator-shaped values)、Redshift connection locator value redaction(例如 Redshift connection locator-shaped values)、DynamoDB connection locator value redaction(例如 DynamoDB connection locator-shaped values)、local filesystem path value redaction(例如 local runtime/symlink path-shaped values)、Windows filesystem path value redaction、parenthesized Windows filesystem path value redaction、Windows Program Files path value redaction(例如 Windows runtime/cache path-shaped values)、Windows UNC filesystem path value redaction、parenthesized Windows UNC filesystem path value redaction(例如 Windows UNC runtime/cache path-shaped values)、relative filesystem path value redaction、tilde filesystem path value redaction(例如 relative runtime/cache path-shaped values)、parenthesized tilde filesystem path value redaction(例如 metadata notes 中括號包住的 ~/runtime path-shaped values)、IPv6 bare locator value redaction(例如 bracketed / bare IPv6 host-path locator-shaped values)、localhost host/path locator value redaction(例如 localhost host/path locator-shaped values)、Docker Hub access token value redaction(例如 Docker Hub access token-shaped values;Docker Hub access token direct regex coverage)、Slack token value redaction(例如xoxb-.../xoxp-...;Slack token direct regex coverage)、Slack app-level token value redaction(例如 Slack app-level token-shaped values;Slack app-level token direct regex coverage)、Slack webhook URL value redaction(例如 Slack incoming webhook URL-shaped values)、Discord webhook URL value redaction(例如 Discord webhook URL-shaped values)、Microsoft Teams webhook URL value redaction(例如 Microsoft Teams incoming webhook URL-shaped values)、Deepgram API key value redaction(例如 Deepgram API-key-shaped values;Deepgram API key direct regex coverage)、DeepL API key value redaction(例如 DeepL API-key-shaped values;DeepL API key direct regex coverage)、Segment write key value redaction(例如 Segment write-key-shaped values;Segment write key direct regex coverage)、Discord bot token value redaction(例如 bot token / MFA token-shaped values;Discord bot token direct regex coverage)、Google API key value redaction / Gemini API key value redaction(例如AIza...)、Google OAuth access token value redaction、Google OAuth refresh token value redaction、Clerk secret key value redaction(例如 Google OAuth access token-shaped values)、Honeycomb API key value redaction(例如 Honeycomb API key-shaped values)、Brevo API key value redaction(例如 Brevo API key-shaped values)、Buildkite API token value redaction(例如 Buildkite user access token-shaped values)、CircleCI API token value redaction(例如 CircleCI API token-shaped values)、Figma PAT value redaction(例如 Figma personal access token-shaped values)、Expo access token value redaction(例如 Expo access token-shaped values)、Asana PAT value redaction(例如 Asana PAT-shaped values)、Doppler service token value redaction(例如 Doppler service token-shaped values)、PlanetScale service token value redaction(例如 PlanetScale service token-shaped values)、PlanetScale password value redaction(例如 PlanetScale password-shaped values)、Upstash QStash token value redaction(例如 Upstash QStash token-shaped values)、Prefect API key value redaction(例如 Prefect API key-shaped values)、Contentful PAT value redaction(例如 Contentful personal access token-shaped values)、Sourcegraph access token value redaction(例如 Sourcegraph access token-shaped values)、Databricks PAT value redaction(例如 Databricks personal access token-shaped values)、Airtable PAT value redaction(例如 Airtable personal access token-shaped values)、New Relic API key value redaction(例如 New Relic API / insert key-shaped values)、Replicate API token value redaction(例如 Replicate API token-shaped values)、Dropbox access token value redaction(例如 Dropbox short-lived access token-shaped values)、LangSmith API key value redaction(例如 LangSmith API key-shaped values)、Groq API key value redaction(例如 Groq API key-shaped values;Groq API key direct regex coverage)、Perplexity API key value redaction(例如 Perplexity API key-shaped values;Perplexity API key direct regex coverage)、Okta API token value redaction(例如 Okta API token-shaped values;Okta API token direct regex coverage)、Stripe secret key value redaction(例如sk_live_.../rk_test_...)、Stripe webhook secret value redaction(Stripe webhook secret direct regex coverage;例如 Stripe webhook secret-shaped values)、SendGrid API key value redaction(例如SG....)、OpenAI API key value redaction(例如sk-proj-.../sk-svcacct-...)與 OpenAI admin key value redaction(OpenAI admin key direct regex coverage;例如sk-admin-...)、Firecrawl API key value redaction(例如fc-...)、Jina AI API key value redaction(例如 Jina API key-shaped values)、OpenRouter API key value redaction(例如sk-or-v1-...)、Pinecone API key value redaction(例如pcsk_...)、Grafana service account token value redaction(例如glsa_...)、Grafana Cloud API token value redaction、Grafana Cloud API token direct regex coverage(例如glc_...)、xAI API key value redaction(例如 xAI API key-shaped values)、SonarQube token value redaction(例如 SonarQube token-shaped values)、Anthropic API key value redaction(例如 Anthropic API key-shaped values)、npm token value redaction、npm token direct regex coverage(例如npm_...)、Netlify personal access token value redaction、Netlify personal access token direct regex coverage(例如 Netlify personal access token-shaped values)、PyPI API token value redaction、PyPI API token direct regex coverage(例如 PyPI API token-shaped values)、DigitalOcean PAT value redaction、DigitalOcean PAT direct regex coverage(例如 DigitalOcean PAT-shaped values)、Postman API key value redaction、Postman API key direct regex coverage(例如 Postman API key-shaped values)、Sentry auth token value redaction(例如 Sentry auth token-shaped values)、Neon API key value redaction(例如 Neon API key-shaped values)、MongoDB URI value redaction、PostgreSQL connection locator value redaction、MySQL connection locator value redaction(例如 MySQL / MySQL X locator-shaped values)、ClickHouse connection locator value redaction(例如 ClickHouse locator-shaped values)、Vercel token value redaction(例如 Vercel token-shaped values;Vercel token direct regex coverage)、Vercel Blob read-write token value redaction / Vercel Blob read/write token value redaction(例如 Vercel Blob read/write token-shaped values;Vercel Blob read-write token direct regex coverage;Snyk token direct regex coverage;Pulumi access token direct regex coverage;Resend API key direct regex coverage)、Fly.io access token value redaction(例如 Fly.io access token-shaped values)、Railway API token value redaction(例如 Railway API token-shaped values;Railway API token direct regex coverage)、Heroku API key value redaction(例如 Heroku API key-shaped values;Heroku API key direct regex coverage)、Snyk token value redaction、Pulumi access token value redaction(例如 Pulumi access token-shaped values)、Resend API key value redaction(例如 Resend API key-shaped values)、NVIDIA NGC API key value redaction(例如 NVIDIA NGC API key-shaped values)、Datadog API key value redaction(例如 DD_API_KEY / DATADOG_API_KEY-shaped values)、Codecov upload token value redaction(例如 Codecov upload token-shaped values)、Postmark server token value redaction、Algolia API key value redaction(例如 Algolia API-key-shaped values)、Ably API key value redaction(例如 Ably API-key-shaped values)、Braze REST API key value redaction(例如 Braze REST API-key-shaped values)、Klaviyo API key value redaction(例如 Klaviyo API-key-shaped values)、Amplitude API key value redaction(例如 Amplitude API-key-shaped values)、Render API key value redaction(例如 Render API key-shaped values)、RubyGems API key value redaction(例如 RubyGems API key-shaped values)、LaunchDarkly SDK key value redaction(例如 LaunchDarkly SDK key-shaped values)、Cerebras API key value redaction(例如 Cerebras API key-shaped values)、WandB API key value redaction;WandB API key direct regex coverage / Weights & Biases API key value redaction(例如 WandB API key-shaped values)、Hugging Face token value redaction / HuggingFace token value redaction(例如hf_...)、Firebase Cloud Messaging server key value redaction(例如 FCM legacy server key-shaped values)、Shopify access token value redaction(例如 Shopify access token-shaped values)、Supabase access token value redaction(例如 Supabase access token-shaped values)、Mailchimp API key value redaction(例如 Mailchimp API key-shaped values)、Mailgun API key value redaction(例如 Mailgun API key-shaped values)、Atlassian API token value redaction(例如 Atlassian API token-shaped values)、Azure DevOps PAT value redaction;Azure DevOps PAT direct regex coverage(例如 Azure DevOps PAT-shaped values)、Tailscale auth key value redaction(例如 Tailscale auth/client key-shaped values)、Square access token value redaction;Square access token direct regex coverage(例如 Square access token-shaped values)、Plaid access token value redaction;Plaid access token direct regex coverage(例如 Plaid access token-shaped values)、PayPal access token value redaction;PayPal access token direct regex coverage(例如 PayPal access token-shaped values)、PagerDuty API token value redaction(PagerDuty API token direct regex coverage)(例如 PagerDuty API token-shaped values)、OpenWeather appid value redaction(OpenWeather appid direct regex coverage)(例如 OpenWeather appid-shaped query values)、Notion integration token value redaction(Notion integration token direct regex coverage)(例如 Notion integration token-shaped values)、Twilio API key value redaction(Twilio API key direct regex coverage)、Twilio auth token pair value redaction(Twilio auth token pair direct regex coverage)、Modal token pair value redaction(Modal token pair direct regex coverage)、Basic auth credential value redaction、Bitbucket app password value redaction(例如 Twilio API key-shaped values / Twilio AccountSid+AuthToken pair-shaped values / Modal token_id+token_secret pair-shaped values / HTTP Basic authorization credential-shaped values)、Telegram bot token value redaction(例如 Telegram bot token-shaped values)、HashiCorp Vault token value redaction, Tavily API key value redaction, Cohere API key value redaction, AssemblyAI API key value redaction, PostHog personal API key value redaction, Loops API key value redaction, Voyage API key value redaction, Mistral API key value redaction, Together AI API key value redaction(例如 HashiCorp Vault service/batch token-shaped values)、Azure Storage connection string value redaction(Azure Storage connection string direct regex coverage)、Azure SAS token value redaction(Azure SAS token direct regex coverage)、Azure Service Bus connection string value redaction(Azure Service Bus connection string direct regex coverage)、Azure Shared Access Signature value redaction(Azure Shared Access Signature direct regex coverage)(例如DefaultEndpointsProtocol=...;AccountKey=...)、database connection string value redaction(例如 database connection string-shaped values)、credential hash value redaction, Django PBKDF2 password hash value redaction, Werkzeug scrypt password hash value redaction, Unix SHA-512 crypt password hash value redaction, Unix MD5 crypt password hash value redaction, Apache apr1 MD5 crypt password hash value redaction(例如 credential hash-shaped values)、session/cookie credential value redaction、credentialed URI userinfo value redaction、IPv4 URI userinfo value redaction、IPv6 URI userinfo value redaction 與 localhost URI userinfo value redaction。 - Source Catalog Redaction Pattern Coverage:Durable Source Catalog Store V0 的 Oracle、Elasticsearch、OpenSearch、ClickHouse、Memcached、AMQP、Redis、NATS、MQTT、Kafka、Snowflake、CockroachDB、SQL Server、MySQL、MariaDB、SQLite、Redshift、DynamoDB、PostgreSQL、local filesystem path、usr/local filesystem path、parenthesized filesystem path、key-value filesystem path、semicolon-delimited filesystem path、pipe-delimited filesystem path、backtick-delimited filesystem path、at-delimited filesystem path、hash-delimited filesystem path、ampersand-delimited filesystem path、plus-delimited filesystem path、dollar-delimited filesystem path、percent-encoded filesystem path、percent-encoded URL locator value、percent-encoded scheme-relative locator value、percent-encoded scheme-relative query locator value、percent-encoded localhost scheme-relative locator value、percent-encoded localhost scheme-relative query locator value、percent-encoded IP scheme-relative locator value、percent-encoded IP scheme-relative query locator value、percent-encoded bracketed IPv6 scheme-relative locator value、percent-encoded bracketed IPv6 encoded-port scheme-relative locator value、percent-encoded bare host/path locator value、bare host:port locator value、percent-encoded bare host:port locator value、percent-encoded localhost path locator value、percent-encoded IPv4 path locator value、percent-encoded IPv4 host:port locator value、percent-encoded IPv6 path locator value、percent-encoded IPv6 host:port locator value、localhost host:port locator value、percent-encoded localhost host:port locator value、percent-encoded IPv6 zone-id path locator value、bare IPv6 zone-id path locator value、IPv4 host:port locator value、IPv6 host:port locator value、plus/dollar-delimited percent-encoded filesystem path、percent-encoded relative filesystem path、percent-encoded tilde filesystem path、double percent-encoded filesystem path、triple percent-encoded filesystem path、Windows filesystem path、parenthesized Windows filesystem path、pipe-delimited Windows filesystem path、at-delimited Windows filesystem path、hash-delimited Windows filesystem path、ampersand-delimited Windows filesystem path、plus-delimited Windows filesystem path、dollar-delimited Windows filesystem path、percent-encoded Windows filesystem path、plus/dollar-delimited percent-encoded Windows filesystem path、percent-encoded Windows Program Files path、percent-encoded Windows UNC filesystem path、double percent-encoded Windows filesystem path、triple percent-encoded Windows filesystem path、Windows UNC filesystem path、parenthesized Windows UNC filesystem path、pipe-delimited Windows UNC filesystem path、at-delimited Windows UNC filesystem path、hash-delimited Windows UNC filesystem path、ampersand-delimited Windows UNC filesystem path、plus-delimited Windows UNC filesystem path、dollar-delimited Windows UNC filesystem path、relative filesystem path、parenthesized relative filesystem path、pipe-delimited relative filesystem path、at-delimited relative filesystem path、hash-delimited relative filesystem path、ampersand-delimited relative filesystem path、plus-delimited relative filesystem path、dollar-delimited relative filesystem path、tilde filesystem path、parenthesized tilde filesystem path、pipe-delimited tilde filesystem path、at-delimited tilde filesystem path、hash-delimited tilde filesystem path、ampersand-delimited tilde filesystem path、plus-delimited tilde filesystem path、dollar-delimited tilde filesystem path、IPv6 bare locator、localhost host/path locator、Hugging Face、Firebase Cloud Messaging、Shopify、Supabase、Mailchimp、Mailgun、Atlassian、Tailscale、Vercel、Vercel Blob、Snyk、Pulumi、Resend、NVIDIA NGC、Datadog、Codecov、Postmark、Algolia、Braze、Klaviyo、Amplitude、Railway、Heroku、Linear、Mapbox、Docker Hub、Slack token、Slack app-level token、Opsgenie、Deepgram、DeepL、Segment、Discord bot、Fastly、Langfuse、Helicone、Cloudflare、Upstash QStash、Prefect、Contentful、Sourcegraph、Databricks、Airtable、New Relic、Replicate、Dropbox、LangSmith、Groq、Perplexity、Okta、GitHub、GitLab、Azure Storage、Azure SAS、Azure Service Bus 與 Azure Shared Access Signature connection/cache/broker/path/token value redaction 已有 direct regex coverage,包含 Opsgenie API key direct regex coverage、Deepgram API key direct regex coverage、DeepL API key direct regex coverage、Segment write key direct regex coverage、Discord bot token direct regex coverage、Oracle connection locator direct regex coverage、Elasticsearch connection locator direct regex coverage、OpenSearch connection locator direct regex coverage、ClickHouse connection locator direct regex coverage、Memcached cache locator direct regex coverage、AMQP broker locator direct regex coverage、Redis cache locator direct regex coverage、NATS broker locator direct regex coverage、Snowflake connection locator direct regex coverage、CockroachDB connection locator direct regex coverage、SQL Server connection locator direct regex coverage、MySQL connection locator direct regex coverage、MariaDB connection locator direct regex coverage、SQLite connection locator direct regex coverage、Redshift connection locator direct regex coverage、DynamoDB connection locator direct regex coverage、PostgreSQL connection locator direct regex coverage、local filesystem path direct regex coverage、Windows filesystem path direct regex coverage、Windows UNC filesystem path direct regex coverage、relative filesystem path direct regex coverage、tilde filesystem path direct regex coverage、IPv6 bare locator direct regex coverage、localhost host/path locator direct regex coverage、Hugging Face token direct regex coverage、Firebase Cloud Messaging server key direct regex coverage、Shopify access token direct regex coverage、Supabase access token direct regex coverage、Mailchimp API key direct regex coverage、Mailgun API key direct regex coverage、Atlassian API token direct regex coverage、Tailscale auth key direct regex coverage、Vercel token direct regex coverage、Vercel Blob read-write token direct regex coverage、Snyk token direct regex coverage、Pulumi access token direct regex coverage、Resend API key direct regex coverage、NVIDIA NGC API key direct regex coverage、Datadog API key direct regex coverage、Codecov upload token direct regex coverage、Postmark server token direct regex coverage、Algolia API key direct regex coverage、Ably API key direct regex coverage、Braze REST API key direct regex coverage、Klaviyo API key direct regex coverage、Amplitude API key direct regex coverage、Render API key direct regex coverage、RubyGems API key direct regex coverage、LaunchDarkly SDK key direct regex coverage、Cerebras API key direct regex coverage、Railway API token direct regex coverage、Heroku API key direct regex coverage、Fastly API token direct regex coverage、Langfuse secret key direct regex coverage、Helicone API key direct regex coverage、Cloudflare API token direct regex coverage、Upstash QStash token direct regex coverage、Prefect API key direct regex coverage、Contentful PAT direct regex coverage 與 Sourcegraph access token direct regex coverage、Databricks PAT direct regex coverage、Airtable PAT direct regex coverage、New Relic API key direct regex coverage、Replicate API token direct regex coverage、Dropbox access token direct regex coverage、LangSmith API key direct regex coverage、Groq API key direct regex coverage、Perplexity API key direct regex coverage、Okta API token direct regex coverage、GitHub PAT direct regex coverage、GitLab token direct regex coverage、GitLab CI job token direct regex coverage,避免 patterns 與 store redaction integration 脫鉤;coverage 使用 synthetic metadata-only fixtures,不擴大 write scope。
- Source Catalog Webhook Redaction Pattern Coverage:Durable Source Catalog Store V0 的 Slack webhook URL、Discord webhook URL 與 Microsoft Teams webhook URL value redaction 已有 direct regex coverage,包含 Slack webhook URL direct regex coverage、Discord webhook URL direct regex coverage 與 Microsoft Teams webhook URL direct regex coverage;coverage 使用 synthetic metadata-only fixtures,不擴大到 cameras、clients、secrets、raw feed URL 或 production apply。
- Source Catalog Identity/CI Token Direct Coverage:Google API key direct regex coverage、Gemini API key direct regex coverage、Google OAuth access token direct regex coverage、Google OAuth refresh token direct regex coverage、Clerk secret key direct regex coverage、Honeycomb API key direct regex coverage、Brevo API key direct regex coverage、Buildkite API token direct regex coverage、CircleCI API token direct regex coverage、Figma PAT direct regex coverage、Expo access token direct regex coverage 與 Asana PAT direct regex coverage 已補齊;coverage 使用 synthetic metadata-only fixtures,只驗證 Durable Source Catalog Store V0 value redaction,不擴大到 cameras、clients、secrets、raw feed URL 或 production apply。
- Source Catalog Search/LLM Token Direct Coverage:Firecrawl API key direct regex coverage、Jina AI API key direct regex coverage、OpenRouter API key direct regex coverage、Pinecone API key direct regex coverage、Grafana service account token direct regex coverage、xAI API key direct regex coverage、SonarQube token direct regex coverage 與 Anthropic API key direct regex coverage 已補齊;coverage 使用 synthetic token-shaped metadata-only fixtures,只驗證 Durable Source Catalog Store V0 value redaction,不擴大到 cameras、clients、secrets、raw feed URL 或 production apply。
- Source Catalog AI/Ops/Data Token Direct Coverage:Cohere API key direct regex coverage、AssemblyAI API key direct regex coverage、Voyage API key direct regex coverage、Mistral API key direct regex coverage、Together AI API key direct regex coverage、Sentry auth token direct regex coverage、Neon API key direct regex coverage 與 MongoDB URI direct regex coverage 已補齊;coverage 使用 synthetic metadata-only fixtures,只驗證 Durable Source Catalog Store V0 value redaction,不擴大到 cameras、clients、secrets、raw feed URL 或 production apply。
- Source Catalog Platform Token Coverage Lock:Hugging Face token direct regex coverage、Firebase Cloud Messaging server key direct regex coverage 與 Shopify access token direct regex coverage 已由 public guide / README regression tests 鎖定;coverage 仍只使用 synthetic metadata-only fixtures,不擴大到 cameras、clients、secrets、raw feed URL 或 production apply。
- Source Catalog Messaging/Growth Token Direct Coverage:Bitbucket app password direct regex coverage、Telegram bot token direct regex coverage、LINE channel access token direct regex coverage、HashiCorp Vault token direct regex coverage、Tavily API key direct regex coverage、PostHog personal API key direct regex coverage 與 Loops API key direct regex coverage 已補齊;coverage 使用 synthetic token-shaped metadata-only fixtures,只驗證 Durable Source Catalog Store V0 value redaction,不擴大到 cameras、clients、secrets、raw feed URL 或 production apply。
- Source Catalog Core API Token Direct Coverage:Stripe secret key direct regex coverage、SendGrid API key direct regex coverage 與 OpenAI API key direct regex coverage 已補齊;coverage 使用 synthetic token-shaped metadata-only fixtures,只驗證 Durable Source Catalog Store V0 value redaction,不擴大到 cameras、clients、secrets、raw feed URL 或 production apply。
- Source Catalog Generic Secret Direct Coverage:JWT-like compact token direct regex coverage、URI userinfo credential direct regex coverage、percent-encoded bare URI userinfo locator value redaction、percent-encoded host-only URI userinfo locator value redaction、raw host-only URI userinfo locator value redaction、raw bracketed IPv6 URI userinfo locator value redaction、raw username-only bracketed IPv6 zone URI userinfo locator value redaction、percent-encoded bracketed IPv6 zone URI userinfo locator value redaction、percent-encoded username-only bracketed IPv6 zone URI userinfo locator value redaction、triple percent-encoded URI userinfo locator value redaction、quadruple percent-encoded URI userinfo locator value redaction、quintuple percent-encoded URI userinfo locator value redaction、sextuple percent-encoded URI userinfo locator value redaction、septuple percent-encoded URI userinfo locator value redaction、octuple percent-encoded URI userinfo locator value redaction、nonuple percent-encoded URI userinfo locator value redaction、decuple percent-encoded URI userinfo locator value redaction、undecuple percent-encoded URI userinfo locator value redaction、duodecuple percent-encoded URI userinfo locator value redaction、tredecuple percent-encoded URI userinfo locator value redaction、tetradecuple percent-encoded URI userinfo locator value redaction、quindecuple percent-encoded URI userinfo locator value redaction、sexdecuple percent-encoded URI userinfo locator value redaction、septendecuple percent-encoded URI userinfo locator value redaction、octodecuple percent-encoded URI userinfo locator value redaction、nonodecuple percent-encoded URI userinfo locator value redaction、vigintuple percent-encoded URI userinfo locator value redaction、unvigintuple percent-encoded URI userinfo locator value redaction、duovigintuple percent-encoded URI userinfo locator value redaction、trivigintuple percent-encoded URI userinfo locator value redaction、quattuorvigintuple percent-encoded URI userinfo locator value redaction、quinvigintuple percent-encoded URI userinfo locator value、sexvigintuple percent-encoded URI userinfo locator value redaction、septemvigintuple percent-encoded URI userinfo locator value redaction、octovigintuple percent-encoded URI userinfo locator value redaction、novemvigintuple percent-encoded URI userinfo locator value redaction、trigintuple percent-encoded URI userinfo locator value redaction、untrigintuple percent-encoded URI userinfo locator value redaction、duotrigintuple percent-encoded URI userinfo locator value redaction、tritrigintuple percent-encoded URI userinfo locator value redaction、quattuortrigintuple percent-encoded URI userinfo locator value redaction、quintrigintuple percent-encoded URI userinfo locator value redaction、sextrigintuple percent-encoded URI userinfo locator value redaction、septentrigintuple percent-encoded URI userinfo locator value redaction、octotrigintuple percent-encoded URI userinfo locator value redaction、novemtrigintuple percent-encoded URI userinfo locator value redaction、quadragintuple percent-encoded URI userinfo locator value redaction、unquadragintuple percent-encoded URI userinfo locator value redaction、duoquadragintuple percent-encoded URI userinfo locator value redaction、trequadragintuple percent-encoded URI userinfo locator value redaction、quattuorquadragintuple percent-encoded URI userinfo locator value redaction、quinquadragintuple percent-encoded URI userinfo locator value redaction、sexquadragintuple percent-encoded URI userinfo locator value redaction、septenquadragintuple percent-encoded URI userinfo locator value、octoquadragintuple percent-encoded URI userinfo locator value、novemquadragintuple percent-encoded URI userinfo locator value redaction、quinquagintuple percent-encoded URI userinfo locator value redaction、unquinquagintuple percent-encoded URI userinfo locator value、duoquinquagintuple percent-encoded URI userinfo locator value redaction、trequinquagintuple percent-encoded URI userinfo locator value redaction、quattuorquinquagintuple percent-encoded URI userinfo locator value、quinquinquagintuple percent-encoded URI userinfo locator value、sexquinquagintuple percent-encoded URI userinfo locator value redaction、septenquinquagintuple percent-encoded URI userinfo locator value redaction、octoquinquagintuple percent-encoded URI userinfo locator value redaction、novemquinquagintuple percent-encoded URI userinfo locator value redaction、sexagintuple percent-encoded URI userinfo locator value redaction、unsexagintuple percent-encoded URI userinfo locator value redaction、duosexagintuple percent-encoded URI userinfo locator value redaction、tresexagintuple percent-encoded URI userinfo locator value redaction、quattuorsexagintuple percent-encoded URI userinfo locator value redaction、quinsexagintuple percent-encoded URI userinfo locator value redaction、sexsexagintuple percent-encoded URI userinfo locator value redaction、septensexagintuple percent-encoded URI userinfo locator value、octosexagintuple percent-encoded URI userinfo locator value redaction、novemsexagintuple percent-encoded URI userinfo locator value redaction、septuagintuple percent-encoded URI userinfo locator value redaction、unseptuagintuple percent-encoded URI userinfo locator value redaction、duoseptuagintuple percent-encoded URI userinfo locator value redaction、treseptuagintuple percent-encoded URI userinfo locator value redaction、quattuorseptuagintuple percent-encoded URI userinfo locator value redaction、quinseptuagintuple percent-encoded URI userinfo locator value redaction、sexseptuagintuple percent-encoded URI userinfo locator value redaction、septenseptuagintuple percent-encoded URI userinfo locator value redaction、octoseptuagintuple percent-encoded URI userinfo locator value redaction、novemseptuagintuple percent-encoded URI userinfo locator value redaction、octogintuple percent-encoded URI userinfo locator value redaction、unoctogintuple percent-encoded URI userinfo locator value redaction、duooctogintuple percent-encoded URI userinfo locator value redaction、tresoctogintuple percent-encoded URI userinfo locator value redaction、quattuoroctogintuple percent-encoded URI userinfo locator value redaction、quinoctogintuple percent-encoded URI userinfo locator value redaction、sexoctogintuple percent-encoded URI userinfo locator value redaction、septemoctogintuple percent-encoded URI userinfo locator value redaction、octooctogintuple percent-encoded URI userinfo locator value redaction、percent-encoded username-only URI userinfo locator value redaction、raw username-only URI userinfo locator value redaction、raw username-only URI userinfo delimiter locator value redaction、percent-encoded bracketed IPv6 bare URI userinfo locator value redaction、percent-encoded localhost URI userinfo locator value redaction、percent-encoded IPv4 URI userinfo locator value redaction、percent-encoded URI userinfo query locator value redaction、percent-encoded URI userinfo fragment locator value redaction、percent-encoded URI userinfo semicolon locator value redaction、percent-encoded URI userinfo port locator value redaction、percent-encoded URI userinfo password delimiter locator value redaction、PEM private key value redaction、PEM private key direct regex coverage、PGP private key block value redaction、PGP private key block direct regex coverage、PuTTY private key value redaction 與 PuTTY private key direct regex coverage 已補齊;coverage 使用 synthetic metadata-only fixtures,只驗證 Durable Source Catalog Store V0 value redaction,不擴大到 cameras、clients、secrets、raw feed URL 或 production apply。
- Source Catalog Restart Reload Helper V0:內部
reload_admin_source_catalog_state_for_restart()使用source_catalog_restart_reload_v0metadata-only contract,從既有ADMIN_SOURCE_CATALOG_PATHstore 重新載入 durable catalog、同步 runtime catalog 與 Evidence Planner,並回 redactedcatalog_sha256/compare_field=catalog_sha256/ redaction flags;source catalog health emitted key tableSOURCE_CATALOG_HEALTH_EMITTED_KEYS、source catalog health required value tableSOURCE_CATALOG_HEALTH_REQUIRED_VALUES、source catalog health runtime-sync key tableSOURCE_CATALOG_HEALTH_RUNTIME_SYNC_KEYS、source catalog health runtime-sync value contract tableSOURCE_CATALOG_HEALTH_RUNTIME_SYNC_VALUE_CONTRACT、source catalog health storage/load key tableSOURCE_CATALOG_HEALTH_STORAGE_LOAD_KEYS、source catalog health storage/load value contract tableSOURCE_CATALOG_HEALTH_STORAGE_LOAD_VALUE_CONTRACT、source catalog health checksum key tableSOURCE_CATALOG_HEALTH_CHECKSUM_KEYS、source catalog health checksum value contract tableSOURCE_CATALOG_HEALTH_CHECKSUM_VALUE_CONTRACT、source catalog health public summary key tableSOURCE_CATALOG_HEALTH_PUBLIC_SUMMARY_KEYS、source catalog health public summary value contract tableSOURCE_CATALOG_HEALTH_PUBLIC_SUMMARY_VALUE_CONTRACT、source catalog health public restart-reload value contract tableSOURCE_CATALOG_HEALTH_PUBLIC_RESTART_RELOAD_VALUE_CONTRACT、source catalog health public checksum value contract tableSOURCE_CATALOG_HEALTH_PUBLIC_CHECKSUM_VALUE_CONTRACT、source catalog health public storage/load value contract tableSOURCE_CATALOG_HEALTH_PUBLIC_STORAGE_LOAD_VALUE_CONTRACT、source catalog health allowed key tableSOURCE_CATALOG_HEALTH_ALLOWED_KEYS與 schema version constantSOURCE_CATALOG_HEALTH_SCHEMA_VERSION維護source_catalog_health_v0top-level metadata-only health contract(write_scope、durable/load flags、checksum、restart_reload_check、redaction、paths_hidden),避免 health payload drift;durableadmin_source_catalog_v1wrapper schema 由 source catalog wrapper schema version constantADMIN_SOURCE_CATALOG_SCHEMA_VERSION、top-level required key tableADMIN_SOURCE_CATALOG_TOP_LEVEL_REQUIRED_KEYS與 top-level allowed key tableADMIN_SOURCE_CATALOG_TOP_LEVEL_ALLOWED_KEYS維護,storage allowed key tableADMIN_SOURCE_CATALOG_STORAGE_ALLOWED_KEYS維護 durable storage wrapper allowlist(只允許mode/durable)與 unexpected-key fail-closed,restart-consistency schema version constantADMIN_SOURCE_CATALOG_RESTART_CONSISTENCY_SCHEMA_VERSION維護 metadata-onlysource_catalog_restart_consistency_v0save/load schema 與 tampered schema fail-closed,restart-consistency compare-field constantADMIN_SOURCE_CATALOG_RESTART_CONSISTENCY_COMPARE_FIELD維護compare_field=catalog_sha256save/load contract 與 tampered compare-field fail-closed,restart-consistency key tablesADMIN_SOURCE_CATALOG_RESTART_CONSISTENCY_REQUIRED_KEYS/ADMIN_SOURCE_CATALOG_RESTART_CONSISTENCY_ALLOWED_KEYS共同維持 required/allowed key allowlist 與 unexpected-key fail-closed 一致,另含由 atomic-write schema version constantADMIN_SOURCE_CATALOG_ATOMIC_WRITE_SCHEMA_VERSION維護的 metadata-onlysource_catalog_atomic_write_v0;atomic-write required value tableADMIN_SOURCE_CATALOG_ATOMIC_WRITE_REQUIRED_VALUES維護schema_version=source_catalog_atomic_write_v0、strategy=write_temp_fsync_replace_fsync_parent、replacement=atomic_os_replace、metadata_only=true、paths_hidden=truesave/load value contract 與 tampered value fail-closed;atomic-write optional value tableADMIN_SOURCE_CATALOG_ATOMIC_WRITE_OPTIONAL_VALUES維護 optional proof markers 均為true(temp filename hidden、owner-only file mode、final path identity、temp fsync/close、parent directory fsync)且 tampered optional proof marker fail-closed;atomic-write key tablesADMIN_SOURCE_CATALOG_ATOMIC_WRITE_REQUIRED_KEYS/ADMIN_SOURCE_CATALOG_ATOMIC_WRITE_OPTIONAL_KEYS與 atomic-write allowed key tableADMIN_SOURCE_CATALOG_ATOMIC_WRITE_ALLOWED_KEYS共同維持 required/optional key allowlist 與 unexpected-key fail-closed 一致(same-directory temp file、temp fsync、atomicos.replace、parent directory fsync、paths_hidden=true、temporary_filename_hidden=true、owner_only_file_mode=true、final_path_identity_checked=true、temporary_file_fsync_checked=true、temporary_file_close_checked=true、parent_directory_fsync_checked=true,且 load 仍接受舊版未含 temp filename / owner-only / final path identity / temporary file fsync markers 的 wrapper),並含 metadata-onlysource_catalog_load_validation_v0(fd_path_identity_checked=true、parent_dir_identity_checked=true、catalog_sha256_recomputed_on_load=true、file_size_limit_checked=true、json_constant_rejection_checked=true、catalog_file_close_checked=true、parent_directory_close_checked=true、catalog_open_no_follow_checked=true、catalog_fd_identity_rechecked_after_read=true、catalog_owner_mode_rechecked_after_read=true、parent_directory_owner_mode_rechecked_after_read=true、catalog_hardlink_rechecked_after_read=true、catalog_file_size_rechecked_after_read=true、catalog_sha256_format_rechecked_after_read=true、parent_directory_fd_identity_rechecked_after_read=true、parent_directory_open_no_follow_rechecked_after_read=true、integration_status_control_chars_rechecked_after_read=true、priority_integer_rechecked_after_read=true、priority_range_rechecked_after_read=true、load_validation_wrapper_keys_rechecked_after_read=true、source_item_wrapper_keys_rechecked_after_read=true、redacted_source_items_rechecked_after_read=true、contains_source_count_rechecked_after_read=true、contains_wrapper_keys_rechecked_after_read=true、contains_wrapper_values_rechecked_after_read=true、redaction_wrapper_keys_rechecked_after_read=true、redaction_removed_categories_rechecked_after_read=true、redaction_secrets_removed_rechecked_after_read=true、source_ids_unique_rechecked_after_read=true、source_id_strings_rechecked_after_read=true、source_id_control_chars_rechecked_after_read=true、source_id_length_rechecked_after_read=true、name_control_chars_rechecked_after_read=true、source_type_string_rechecked_after_read=true、source_type_unpadded_rechecked_after_read=true、source_type_length_rechecked_after_read=true、source_type_control_chars_rechecked_after_read=true、provider_string_rechecked_after_read=true、provider_unpadded_rechecked_after_read=true/provider_length_rechecked_after_read=true、provider_control_chars_rechecked_after_read=true、supports_intents_list_rechecked_after_read=true、supports_intents_strings_rechecked_after_read=true、supports_intents_count_rechecked_after_read=true、supports_intents_entries_rechecked_after_read=true、safety_notes_list_rechecked_after_read=true、safety_notes_strings_rechecked_after_read=true、safety_notes_count_rechecked_after_read=true、safety_notes_entries_rechecked_after_read=true、safety_notes_unpadded_rechecked_after_read=true、safety_notes_length_rechecked_after_read=true、safety_notes_control_chars_rechecked_after_read=true、license_note_string_rechecked_after_read=true、license_note_length_rechecked_after_read=true、license_note_unpadded_rechecked_after_read=true/license_note_control_chars_rechecked_after_read=true/metadata_keys_control_chars_rechecked_after_read=true、metadata_keys_length_rechecked_after_read=true/metadata_string_values_control_chars_rechecked_after_read=true、metadata_string_values_length_rechecked_after_read=true、metadata_numbers_finite_rechecked_after_read=true、metadata_object_rechecked_after_read=true、metadata_collection_sizes_rechecked_after_read=true、metadata_total_nodes_rechecked_after_read=true、metadata_serialized_size_rechecked_after_read=true、metadata_keys_unpadded_rechecked_after_read=true、metadata_boolean_values_rechecked_after_read=true、metadata_null_values_rechecked_after_read=true、metadata_integer_values_rechecked_after_read=true、metadata_float_values_rechecked_after_read=true、metadata_array_values_rechecked_after_read=true、metadata_object_values_rechecked_after_read=true、duplicate keys rejected、paths_hidden=true),標示落盤與 startup/load validation 策略但不曝光 path/source payload;fresh startup env path load 也會在 app import/startup 時讀取ADMIN_SOURCE_CATALOG_PATH的admin_source_catalog_v1,讓 service restart 後/v1/reality/sources仍可看見 source-only imported source;fresh startup relative env path fallback 會拒絕非絕對ADMIN_SOURCE_CATALOG_PATH(source catalog path must be absolute),fallback seed catalog /in_memory_v0;relative path storage metadata fallback 也會讓 store storage metadata 回in_memory_v0/durable=false,避免無效相對 path 被誤報為 durable;control character source catalog path fallback 會拒絕含換行/control character 或 padding 的ADMIN_SOURCE_CATALOG_PATH,metadata 也回in_memory_v0/durable=false,避免將可疑 path 誤報或寫入為 durable;DEL control character source catalog path fallback 也會把含 ASCII DEL (0x7f) 的 absolute-looking catalog path 視為 control-character path,fail closed 為in_memory_v0/durable=false且不寫入;padded absolute source catalog path load fallback 也會在 load/startup 階段拒絕尾端或前端 padding 的 absolute catalog path,即使該 padded filename 已存在也不載入為 durable;non-string source catalog path fallback 會把 non-string / bytes-like storage path 視為in_memory_v0,避免型別錯誤外拋或被誤報為 durable;fspath error source catalog path fallback 也會在 path-like__fspath__()轉換失敗時 fail closed 到in_memory_v0,不外拋、不寫檔、不誤報 durable;unexpected fspath error source catalog path fallback 會同樣 fail closed,即使 path-like conversion 丟出非 TypeError/ValueError 的一般例外也不外拋、不寫檔、不誤報 durable;truthiness-safe source catalog path handling 則避免對 path-like storage object 做 boolean coercion,改以os.fspath()後的 non-empty string 判斷,讓有效 absolute path-like 仍可 durable write/load。health 仍只回 metadata-only、paths_hidden=true,不回相對路徑值或 control-character / padded / non-string / fspath-error path 值。publicGET /v1/reality/source-health的source_catalog_runtime_status_v0也回source_catalog_runtime_restart_consistency_v0compare guide,讓 client/operator 以 redactedcatalog_sha256驗證 restart consistency。Admin-only/admin/sources/health另有source_catalog_health_write_scope_v0marker,回write_scope=sources_only、cameras_written=0、clients_written=0、production_apply_locked=true,明確避免把 source catalog health 誤解為 cameras/clients/secrets write surface。這些 health/reload surfaces 只回loaded_from_durable、source_catalog_storage、source_count、redactedcatalog_sha256、compare_field=catalog_sha256、redaction flags、metadata_only=true、paths_hidden=true等安全欄位;不回 durable file path、source payload、API key/hash、tokens、passwords、credentials 或 raw feed locators。 - source catalog health public runtime-sync value contract table:
SOURCE_CATALOG_HEALTH_PUBLIC_RUNTIME_SYNC_VALUE_CONTRACT鎖定 publicsource_catalog_health的planner_source_countint 與runtime_catalog_in_syncbool,且source_count維持 hidden;source catalog health public write-scope safety value contract tableSOURCE_CATALOG_HEALTH_PUBLIC_WRITE_SCOPE_SAFETY_VALUE_CONTRACT鎖定 hidden admin-only write-scope guard values(write_scope=sources_only、cameras_written=0、clients_written=0、production_apply_locked=true)且不要求 public exposure;source catalog health public hidden-payload field tableSOURCE_CATALOG_HEALTH_PUBLIC_HIDDEN_PAYLOAD_FIELDS集中鎖定 public summary 必須隱藏的 admin/storage payload fields(source_catalog_storage、source_count、write_scope、cameras_written、clients_written、production_apply_locked、redaction);source catalog health public required value tableSOURCE_CATALOG_HEALTH_PUBLIC_REQUIRED_VALUES集中鎖定 public summary 固定值(schema_version=source_catalog_health_v0、metadata_only=true、paths_hidden=true);source catalog health public field type contract tableSOURCE_CATALOG_HEALTH_PUBLIC_FIELD_TYPE_CONTRACT鎖定 public summary 每個欄位的 strict type;source catalog health public restart-reload field type contract tableSOURCE_CATALOG_HEALTH_PUBLIC_RESTART_RELOAD_FIELD_TYPE_CONTRACT鎖定 nestedrestart_reload_check每個 public 欄位的 strict type;source catalog health public restart-reload value fail-closed validation 會先驗證 admin health readback 的restart_reload_checkexact contract values,再回 public metadata-only summary,避免 silently overwrite restart reload drift;public checksum value fail-closed validation 會用SOURCE_CATALOG_HEALTH_PUBLIC_CHECKSUM_VALUE_CONTRACT拒絕非 64 字元 lowercase sha256 hex 的 publiccatalog_sha256;public storage/load value fail-closed validation 會用SOURCE_CATALOG_HEALTH_PUBLIC_STORAGE_LOAD_VALUE_CONTRACT拒絕 non-bool 的configured_durable/loaded_from_durablepublic durable/load markers;public runtime-sync value fail-closed validation 會用SOURCE_CATALOG_HEALTH_PUBLIC_RUNTIME_SYNC_VALUE_CONTRACT拒絕 non-int 的planner_source_count與 non-bool 的runtime_catalog_in_syncpublic runtime markers;public metadata-safety value fail-closed validation 會用SOURCE_CATALOG_HEALTH_PUBLIC_METADATA_SAFETY_VALUE_CONTRACT拒絕非 strict true bool 的metadata_only/paths_hiddenpublic safety markers 與 admin redactionpaths_hiddenreadback;public required value fail-closed validation 會先驗證 admin healthschema_versionreadback 仍等於source_catalog_health_v0,避免 public summary silently overwrite drift;public write-scope safety value fail-closed validation 會用SOURCE_CATALOG_HEALTH_PUBLIC_WRITE_SCOPE_SAFETY_VALUE_CONTRACT拒絕不等於sources_only/0/0/ stricttrue的 hidden write-scope guard values,之後才移除 hidden admin-only fields;仍不公開 durable path、source payload、credential、token 或 raw feed locator。 - source catalog health public storage hidden payload type/value guard:admin source catalog storage metadata fail-closed validation 要求
_configured_admin_source_catalog_storage()只接受 exact safemode/durablestorage metadata,拒絕 extra path/locator fields、non-dict payload 或 non-bool durable drift,避免 admin/public health surface 回顯 durable path、credential、source payload 或 raw feed locator;public storage/load hidden payload type fail-closed validation 要求 hidden adminsource_catalog_storagereadback 仍是 dict;public storage/load hidden payload value fail-closed validation 進一步要求 hidden storage readback 的mode/durablevalues 維持 internally consistent durable/in-memory storage contract,才產生 public metadata-onlysource_catalog_healthsummary;source catalog public admin-readback key fail-closed validation 會先驗證 admin health readback top-level keys 等於SOURCE_CATALOG_HEALTH_ALLOWED_KEYS,拒絕 unexpected raw/path/source-record drift 再投影 public summary;public response 仍不暴露 storage payload、durable path、source payload、credential、token 或 raw feed locator。 - source catalog health check storage/load strict bool sanitization:
scripts/source_catalog_health_check.pyoperator output 只把 top-levelconfigured_durable/loaded_from_durableexact bool true 視為 true,truthy string drift 會變成 false,避免 helper 回顯 path、locator、credential 或 source payload text。 - source catalog health check restart-consistency allowlist sanitization:
scripts/source_catalog_health_check.pyoperator output 只輸出 allowlisted nestedrestart_consistency.schema_version/compare_field,drift 值改成unknown,避免 nested restart check 欄位回顯 path、locator、credential 或 source payload text。 - source catalog health check write-scope strict value sanitization:
scripts/source_catalog_health_check.pyoperator output 只輸出 exact safe write-scope guard values(write_scope=sources_only、cameras_written=0、clients_written=0、production_apply_locked=true),drift 值改成unknown/0/false,避免 helper 回顯 path、locator、credential、camera/client payload 或 source payload text。 - source catalog health check redaction safe value table:
SOURCE_CATALOG_HEALTH_CHECK_REDACTION_SAFE_VALUES鎖定 helper redaction output 只回secrets_removed=true/paths_hidden=trueexact safe booleans,避免 redaction wrapper drift 回顯 durable path、locator、credential 或 source payload text。 - source catalog health check catalog-sha256 lowercase hex sanitization:
scripts/source_catalog_health_check.pyoperator output 只在catalog_sha256是 64 字元 lowercase hex digest 時輸出 checksum,drift 值改成unknown,避免 checksum 欄位回顯 path、locator、credential 或 source payload text。 - source catalog health check required output field table:
SOURCE_CATALOG_HEALTH_CHECK_REQUIRED_OUTPUT_FIELDS鎖定--require-*restart verification 只輸出固定 required/ok boolean 欄位名,避免 helper output 欄位 drift 成 path、locator、credential 或 source payload echo fields。 - source catalog health check output field order table:
SOURCE_CATALOG_HEALTH_CHECK_OUTPUT_FIELD_ORDER鎖定 helper sanitized metadata 與--require-*required/ok booleans 的 operator JSON output 順序,未知 future safe fields 只附加在已知表之後,避免 restart verification output ordering drift。 - source catalog health check required failure result shape table:
SOURCE_CATALOG_HEALTH_CHECK_REQUIRED_FAILURE_RESULT鎖定 helper--require-*失敗時只回 fixederror/ metadata-only / paths-hidden shape,避免 failure path 回顯 durable path、locator、credential、checksum drift 或 source payload。 - source catalog health check required failure JSON output contract:helper
--require-*失敗時會把SOURCE_CATALOG_HEALTH_CHECK_REQUIRED_FAILURE_RESULT以 safe JSON 印到 stdout,stderr 只保留同一個 generic error,讓 staging wrapper 可 machine-read failure 而不回顯 durable path、locator、credential、checksum drift 或 source payload。 - source catalog health check failure JSON error-first ordering:
SOURCE_CATALOG_HEALTH_CHECK_OUTPUT_FIELD_ORDER讓 helper--require-*failure JSON 固定先輸出 genericerror,再輸出metadata_only=true/paths_hidden=true,方便 staging operator parser fail-closed 讀取且不回顯 durable path、locator、credential、checksum drift 或 source payload。 - Source Catalog Integration Status Validation Marker:durable
source_catalog_load_validation_v0現在公開 metadata-onlyintegration_status_string_rechecked_after_read=true、integration_status_unpadded_rechecked_after_read=true與integration_status_length_rechecked_after_read=true、supports_intents_unpadded_rechecked_after_read=true、supports_intents_length_rechecked_after_read=true、supports_intents_control_chars_rechecked_after_read=true,表示 startup/load 會在 read-after-load 階段確認 integration_status string、unpadded 與長度 ≤ 256 contract,以及 supports_intents entry unpadded / length ≤ 256 / no control characters contract;load-validation schema version constantADMIN_SOURCE_CATALOG_LOAD_VALIDATION_SCHEMA_VERSION、required boolean marker tableADMIN_SOURCE_CATALOG_LOAD_VALIDATION_REQUIRED_BOOLEAN_MARKERS、optional boolean marker shared marker table、load-validation required key tableADMIN_SOURCE_CATALOG_LOAD_VALIDATION_REQUIRED_KEYS、allowed key tableADMIN_SOURCE_CATALOG_LOAD_VALIDATION_ALLOWED_KEYS、emitted boolean marker tableADMIN_SOURCE_CATALOG_LOAD_VALIDATION_EMITTED_BOOLEAN_MARKERS、load-validation emitted key tableADMIN_SOURCE_CATALOG_LOAD_VALIDATION_EMITTED_KEYS、load-validation required boolean value tableADMIN_SOURCE_CATALOG_LOAD_VALIDATION_REQUIRED_BOOLEAN_VALUES、load-validation optional value tableADMIN_SOURCE_CATALOG_LOAD_VALIDATION_OPTIONAL_VALUES與 load-validation required value tableADMIN_SOURCE_CATALOG_LOAD_VALIDATION_REQUIRED_VALUES共同維持 schema version、save/load required-key gate、allowlist、write coverage、required/optional marker value contract、required value contract 與 false-marker fail-closed 一致;舊 wrapper 缺 marker 仍可 reload,false marker fail closed;不回 source payload、credentials 或 locator values。 - Source Catalog Query Locator Redaction:Durable Source Catalog Store V0 已涵蓋 percent-encoded bare host query locator value、raw bare host query locator value、RTMPS streaming locator value、SRT streaming locator value、RTP/UDP streaming locator value、WebSocket streaming locator value、secure RTSP streaming locator value、RTMP streaming locator value(legacy RTMP streaming scheme locators)、percent-encoded MQTT broker locator value、percent-encoded AMQP broker locator value、percent-encoded NATS broker locator value、percent-encoded Redis cache locator value、raw Redis cache locator value、raw Memcached cache locator value、percent-encoded Kafka broker locator value、percent-encoded Snowflake connection locator value、raw Snowflake connection locator value、percent-encoded CockroachDB connection locator value、raw CockroachDB connection locator value、raw Oracle connection locator value、raw JDBC Oracle thin/OCI connection locator value、raw SQL Server connection locator value、raw MSSQL connection locator value、raw MySQL connection locator value、raw MariaDB connection locator value、raw SQLite connection locator value、raw JDBC connection locator value、raw JDBC DB2 connection locator value、raw JDBC H2 connection locator value、raw ODBC connection locator value、raw JDBC Teradata connection locator value、raw JDBC Snowflake connection locator value、raw JDBC Trino/Presto connection locator value、raw JDBC Hive/Impala connection locator value、raw JDBC Informix/Firebird connection locator value、raw JDBC Derby/JTDS connection locator value、percent-encoded raw JDBC connection locator value、raw JDBC memory connection locator value、percent-encoded raw JDBC memory connection locator value、percent-encoded raw JDBC Oracle thin connection locator value、percent-encoded raw JDBC Sybase TDS connection locator value、raw JDBC Sybase TDS connection locator value、raw LDAP directory locator value、raw FTP directory locator value、percent-encoded FTP directory locator value、percent-encoded Git SSH locator value、percent-encoded SCP-like Git repository locator value、raw SCP-like Git repository locator value、single-segment SCP-like Git repository locator value、IPv4 SCP-like Git repository locator value、IPv6 SCP-like Git repository locator value、raw bracketed IPv6 zone-id SCP-like Git repository locator value、localhost SCP-like Git repository locator value、percent-encoded bracketed IPv6 SCP-like Git repository locator value、percent-encoded bracketed IPv6 zone-id SCP-like Git repository locator value、percent-encoded Neo4j connection locator value、percent-encoded Bolt graph locator value、raw Neo4j/Bolt graph locator value、percent-encoded Solr search locator value、raw Solr search locator value、percent-encoded IMAP/SMTP mail transport locator value、raw IMAP/SMTP mail transport locator value、raw Kafka broker locator value、raw AMQP broker locator value、raw NATS broker locator value、percent-encoded HDFS storage locator value、raw HDFS storage locator value、percent-encoded NFS storage locator value、percent-encoded Rsync storage locator value、percent-encoded SMB/CIFS storage locator value、raw NFS/Rsync storage locator value、raw SMB/CIFS storage locator value、percent-encoded ZooKeeper/etcd coordination locator value、percent-encoded Consul coordination locator value、raw ZooKeeper/etcd/Consul coordination locator value、percent-encoded ZeroMQ transport locator value、raw ZeroMQ transport locator value、raw ZeroMQ zmq+tcp transport locator value、percent-encoded Cloudinary URL value、raw Cloudinary URL value、percent-encoded ABFS storage locator value、raw ABFS/WASBS storage locator value、percent-encoded WebDAV storage locator value、raw WebDAV storage locator value、percent-encoded Git repository locator value、percent-encoded SVN repository locator value、percent-encoded Mercurial repository locator value、percent-encoded MongoDB URI value、raw MongoDB +srv connection locator value、percent-encoded Cassandra connection locator value、raw Cassandra connection locator value、percent-encoded ClickHouse connection locator value、raw ClickHouse connection locator value、percent-encoded Elasticsearch/OpenSearch connection locator value、raw Elasticsearch/OpenSearch connection locator value、percent-encoded Redshift/DynamoDB connection locator value、raw Redshift connection locator value、raw DynamoDB connection locator value、percent-encoded Oracle/SQL Server connection locator value、percent-encoded LDAP directory locator value、percent-encoded Memcached cache locator value、percent-encoded PostgreSQL connection locator value、raw PostgreSQL connection locator value 與 percent-encoded MySQL/MariaDB connection locator value / percent-encoded SQLite connection locator value metadata-only redaction,例如 encoded/raw domain host + query-shaped locator values、secure streaming scheme locators、low-latency streaming scheme locators、transport streaming scheme locators、WebSocket scheme locators、secure RTSP scheme locators、encoded MQTT/MQTTS broker locator-shaped metadata values、encoded AMQP/AMQPS broker locator-shaped metadata values、encoded NATS/TLS+NATS broker locator-shaped metadata values、encoded Redis/Rediss cache locator-shaped metadata values、encoded Cloudinary URL-shaped metadata values、encoded ABFS/ABFSS/WASBS storage locator-shaped metadata values、encoded WebDAV/WebDAVS storage locator-shaped metadata values、encoded Git/Git+SSH repository locator-shaped metadata values、encoded SVN/SVN+SSH repository locator-shaped metadata values、encoded MongoDB/MongoDB+SRV URI-shaped metadata values、encoded Cassandra connection locator-shaped metadata values 與 encoded ClickHouse/ClickHouse+native connection locator-shaped metadata values;不會寫入 cameras/clients/secrets,也不公開 raw CCTV/feed URL。
- Source Catalog Startup Preflight Fail-closed:Durable source catalog
load()若在 startup preflight 遇到 catalog path inspection /lstatOSError,會安全回到 in-memory seed catalog;lstat inspection 也會在原生Path.lstat被 patchedPath.stat影響時 fallback 到 no-followos.lstat,避免誤用 follow-stat metadata;不外拋例外、不載入可疑 durable catalog;不回 durable path、source payload、API key/hash、tokens、passwords、credentials 或 raw feed locators。 - Source Health JSON:Source Catalog Health JSON V0 提供 admin-only
/admin/sources/healthmetadata-only JSON health endpoint;回source_catalog_health_v0、source_count、source_catalog_storage、loaded_from_durable、redactedcatalog_sha256與source_catalog_restart_consistency_v0compare guide(含health restart_consistency.paths_hidden=true),讓 operator restart 前後只比較 checksum;startup/load 會驗證admin_source_catalog_v1wrapper 的catalog_sha256、restart_consistency.schema_version=source_catalog_restart_consistency_v0、restart_consistency.compare_field=catalog_sha256、restart_consistency.metadata_only=true、restart_consistency.paths_hidden=true、restart_consistency.catalog_sha256、storage=durable_json_v1、contains.sources與redaction.secrets_removed/removed categories(必須是 list of strings,redaction wrapper 不可含 unexpected redaction wrapper fields,removed_categories不可含 unexpected redaction removed_categories,restart consistency wrapper 不可含 unexpected restart consistency fields,且 durable JSON object 不可含 duplicate JSON object keys),unexpected source item fields、incomplete source item wrapper、boolean contains.sources、numeric storage.durable、unowned catalog file(source catalog path must be owned by the service user)、relative storage path(source catalog path must be absolute)、symlink storage path(source catalog path must not be a symlink)、directory storage path / non-regular storage path(source catalog path must be a regular file)、parent path file(source catalog parent path must be a directory)或 symlink parent/ancestor directory;建立缺少 parent directory 後會做 post-mkdir parent symlink recheck(source catalog parent directory must not be a symlink)、too many sources(source catalog cannot contain more than 1000 sources)、out-of-range priority(priority must be between 0 and 10000)、checksum mismatch、non-string removed_categories、non-object source entries、空白/前後含空白/非字串、overlong source_id、overlong text fields(source identity / license_note / supports_intents / safety_notes 必須 256 characters or fewer)、source text list overflow(supports_intents cannot contain more than 100 items/safety_notes cannot contain more than 100 items)、overlong metadata string values(metadata key/value string 必須 256 characters or fewer)、non-finite metadata numbers(metadata numbers must be finite)、non-standard JSON constants(non-standard JSON constants are not allowed)、oversized source catalog file / write-before-temp-file size guard(source catalog file cannot exceed 1000000 bytes)、metadata total node count overflow(metadata total node count cannot exceed 1000)、metadata serialized size overflow(metadata serialized size cannot exceed 16384 bytes)、metadata depth overflow(metadata depth cannot exceed 8 levels)、metadata collection overflow(metadata collections cannot contain more than 100 items)、blank/paddedsupports_intents/ blank/padded safety_notes / blank/padded license_note / blank/padded identity fields(name/provider/source_type/integration_status,必須是 non-empty unpadded strings)、blank/padded metadata keys、unsupported characters(例如 slash/path-like)的source_id、supports_intents/safety_notes非 list of strings、metadata非 object/null、name/provider/source_type/integration_status/license_note非 string、priority非 int(含 bool 或 string coercion)、duplicate source_id、restart wrapper incomplete 或 top-level wrapper incomplete 時不載入 durable file;可用scripts/source_catalog_health_check.py搭配--admin-key-env執行 metadata-only restart consistency check,並可在重啟後傳入--expect-catalog-sha256,或加--require-durable/--require-loaded-from-durable/--require-restart-consistency/--require-catalog-sha256/--require-metadata-only/--require-paths-hidden做 fail-closed staging verify,只輸出 safe health metadata、expected_catalog_sha256_matches、durable_storage_ok、loaded_from_durable_ok、restart_consistency_ok、catalog_sha256_ok、metadata_only_ok與paths_hidden_ok,sanitized output 明確標示metadata_only=true/paths_hidden=true;helper 具有 base URL userinfo / non-http scheme guard,會拒絕含 userinfo credential 的 base URL 與非 http/https scheme;hash 不符、缺少/無效 requiredcatalog_sha256或 required health contract 不符時 exit non-zero;不回 durable file path、source record payload、API key/hash、tokens、passwords、credentials、URL credential 或 raw feed locators。 - Remote Smoke:Staging Remote Smoke Test Policy 規範 staging runtime venv 若缺少
pytest / httpx2,應執行python -m compileall -q app加 live endpoint verification,不要在緊急驗證時安裝 test-only dependencies;最後必須確認 service active、/healthzok、ADMIN_IMPORT_APPLY_ENABLED=false。 - Deploy Guard:Rsync runtime path guard 要求 staging deploy 保留 runtime-managed paths;使用 rsync 時至少排除
--exclude '.venv'、--exclude '.env'、--exclude '__pycache__',並 do not use --delete without explicit runtime exclusions,避免刪除 server runtime venv、env file、durable catalog 或 logs。建議使用scripts/safe_staging_rsync.py先以--print-command審查部署命令;此 helper defaults to --dry-run、does not include --delete,且必須明確傳入--execute才會移除 dry-run。Allowlist deploy mode 可加--allowlist,使用--relative並只同步 reviewed project paths:./app、./docs、./scripts、./tests、./README.md、./pyproject.toml。 - 匯入功能 V0 不會寫入 cameras、clients、API keys、raw feed URL 或 secrets;未來擴大 write scope 必須另做 schema validation、SSRF/security scan、dry-run diff、human confirmation、rollback/export snapshot 與 admin audit log。
查詢資料源能力
curl -s https://taiwanworldmodel.thesense.biz/v1/reality/sources -H "X-API-Key: $TRUESIGHT_REALITY_API_KEY"
依 intent 過濾:
curl -s "https://taiwanworldmodel.thesense.biz/v1/reality/sources?intent=traffic_congestion" -H "X-API-Key: $TRUESIGHT_REALITY_API_KEY"
送出 Reality Check
curl -s -X POST https://taiwanworldmodel.thesense.biz/v1/reality/check -H "Content-Type: application/json" -H "X-API-Key: $TRUESIGHT_REALITY_API_KEY" -d '{"query":"阿里山現在有雲海嗎?"}'
Weather Reality API Usage:TrueSight 氣象查詢
TrueSight 目前可以先用 Reality API 查氣象資訊,暫時不啟用攝影機驗證。支援的 weather runtime intents 包含 rain_now、weather_suitability、flooding_risk。
curl -s -X POST https://taiwanworldmodel.thesense.biz/v1/reality/check -H "Content-Type: application/json" -H "X-API-Key: $TRUESIGHT_REALITY_API_KEY" -d '{"query":"阿里山現在有下雨嗎?"}'
| Status | 意義 | TrueSight UI 建議 |
|---|---|---|
live_data | 已取得 CWA 觀測/雨量/短時預報 signals | 可顯示為氣象現況查證結果,但仍需顯示 limitations |
configuration_required | runtime 已接好,但服務尚未設定 CWA_API_KEY | 顯示為介接已就緒、等待金鑰設定,不可顯示成即時天氣 |
insufficient_data | 該地點或意圖沒有足夠資料 | 顯示無足夠資料,不做明確建議 |
{
"intent": "rain_now",
"status": "configuration_required",
"current_state": "unknown",
"data_sources": ["cwa_weather_observation", "cwa_rainfall_observation", "cwa_weather_forecast"],
"signals": [],
"limitations": ["需要在服務環境設定 CWA_API_KEY"]
}
Short-term Forecast Runtime V0
Weather Reality runtime 現在會嘗試讀取中央氣象署短時/鄉鎮區預報資料集 F-D0047-091,normalize 成 signal_type=short_term_forecast、source_id=cwa_weather_forecast,欄位包含 rain_probability_percent、forecast_uncertainty、weather_description、min_temperature_c、max_temperature_c、forecast_time、valid_time、valid_from、valid_to 與 evidence_role=forecast_not_observation。
POST /v1/reality/check 的 Weather Reality response 會加入 forecast_context / cwa_forecast_context_v0,用 disagreement_status 標示觀測與預報是否一致;例如 forecast_possible_rain_but_observation_no_rain 表示目前地面觀測無明顯降雨,但短時預報顯示後續降雨機率偏高。freshness_status 會標示 valid、expired、missing_valid_time 或 not_yet_valid;只有 decision_usable=true 的有效預報才可提高 confidence。政策是 forecast_is_future_context_not_current_observation,不可把預報包裝成現在已發生的現況。
當 short_term_forecast 成功接入時,evidence_plan 會把 short_term_forecast -> cwa_weather_forecast 標成 live_data,Evidence Fusion 可避免因缺短時預報而降級;若 forecast 尚不可用,仍會誠實標成 planned 或 configuration_required。
注意:短時預報不是現況觀測;它用來回答「接下來一段時間是否會受雨影響」,不可取代測站觀測或現場攝影機驗證。
攝影機驗證下一階段:氣象 live data 穩定後,下一個大項目是公共攝影機白名單與 visual evidence,用來驗證氣象局實時資訊是否符合現場畫面。
Location Resolution:地點解析與最近測站
Location Resolution Engine V1 會先把 query 中的地點解析成可解釋 contract,而不是只回單一座標。location_resolution 會包含 status、confidence、source_provenance、candidates 與 limitations;若短地名有多個接近候選,會回 ambiguous_location,避免過度自信。未解析到單一地點前,不會呼叫天氣、交通或攝影機 runtime,以避免錯用資料源;呼叫端應讓使用者選擇候選或補充縣市/行政區/地標。地名解析的核心不是相似字串,而是依照用戶關鍵字與背後目的/意圖找到正確目標;不確定時必須候選/追問或低信心。若 internal registry 找不到,V1.2 可用 OSM/Nominatim 作 external_geocoding_fallback,回 resolved_low_confidence 並標明 provenance/limitations。天氣 runtime 的最近測站選擇則放在 location_resolution.data_source_resolution,例如 data_source_resolution.method=coordinates_nearest_station。
地點解析不應把未知或非阿里山地點掉回阿里山。已支援將 林口光曜車業 類查詢解析為 新北市林口區附近;也支援 東湖現在的雨量,解析為 臺北市內湖區東湖附近 與 rain_now intent。
curl -s -X POST https://taiwanworldmodel.thesense.biz/v1/reality/check -H "Content-Type: application/json" -H "X-API-Key: $TRUESIGHT_REALITY_API_KEY" -d '{"query":"林口光曜車業現在有下雨嗎?"}'
curl -s -X POST https://taiwanworldmodel.thesense.biz/v1/reality/check -H "Content-Type: application/json" -H "X-API-Key: $TRUESIGHT_REALITY_API_KEY" -d '{"query":"東湖現在的雨量"}'
若 POI 尚無第一手精準座標,會先降級為行政區或區域附近,例如 新北市林口區附近、臺北市內湖區東湖附近;結果仍需顯示測站距離與 limitations,不可宣稱代表單一店門口或街角微氣候。
Query Understanding V0:理解問題背後目的
POST /v1/reality/check 會回傳 query_understanding,用來說明系統如何從字面問題推斷使用者真正想做的現實決策。欄位包含 surface_query、place_keywords、condition_keywords、time_scope、explicit_intent、inferred_underlying_task、answer_goal、evidence_requirements、clarification_required。
例如 南港展覽館現在雨量 不只是查 mm 數字;V0 會推斷 inferred_underlying_task=go_or_wait_decision,目標是判斷現在前往是否會受雨影響,並要求 evidence_requirements 至少包含最近雨量站、氣象觀測、短時預報與可選攝影機驗證。若使用者只問「台北車站現在怎樣」,會標示 clarification_required=true,先釐清想查天氣/人潮/交通/事件安全狀況。
Evidence Planner V0:證據需求到資料源計畫
query_understanding.evidence_requirements 會進一步轉成 evidence_plan,說明每個 evidence requirement 對應哪個資料源、目前是 live_data、planned、configuration_required、blocked_by_location_ambiguity 或 planned_or_gated,以及是否 blocking。欄位包含 status、summary、required_count、primary_ready_count 與 items。
例如 南港展覽館現在雨量 目前可得到 evidence_plan.status=partially_satisfied:最近雨量站與氣象觀測可由 CWA live data 支援;short_term_forecast 仍是 planned;optional_camera_visual_validation 會標成 planned_or_gated,不可假裝已用於判斷,也不可把第三方/攝影機 optional evidence 當成第一手官方資料。
Evidence Fusion V0:證據完整度與信心降級
evidence_fusion 會根據 evidence_plan 的 readiness 與 blocking 狀態,產生 status、completeness、base_confidence、adjusted_confidence、confidence_delta、applied_rules 與 fusion limitations。當必要 evidence 缺少時會套用 missing_required_evidence,回 partial_evidence 並降低 confidence;當地點仍歧義時會 blocked,不可進行 fusion。
例如 南港展覽館現在雨量 目前 CWA 觀測與雨量 live,但短時預報仍 planned,所以 base confidence 會被降級為 adjusted_confidence,並把缺少 short_term_forecast 的限制加到 response limitations。
Temperature Definitions:溫度定義
Weather Reality 會明確區分 室外實測氣溫 與 體感溫度,避免把測站溫度誤解為人體實際感受。
| 欄位 | 中文定義 | 資料意義 |
|---|---|---|
air_temperature_c | 室外實測氣溫 | 中央氣象署測站量到的空氣溫度,不等於人在太陽、濕度、風速下的感受。 |
apparent_temperature_c | 體感溫度 | 由氣溫、濕度、風速估算;炎熱潮濕時使用 heat index,寒冷有風時使用 wind chill。 |
Reality Graph 資料源原則
Taiwan World Model 不是 CCTV 聚合器。官方資料是現實證據的一等公民;攝影機是眼睛,不是整個世界模型。
| 資料類型 | 例子 | 角色 |
|---|---|---|
| 官方公告 | 封路、停班停課、災害警戒、施工公告 | 權威狀態來源 |
| 感測器 | 雨量、水位、AQI、VD 車流、溫度 | 量化現實狀態 |
| 交通資訊 | CMS、事故、路況、旅行時間 | 道路可用性與壅塞判斷 |
| 攝影機 | 景點 webcam、交通 CCTV、河川影像 | 視覺驗證與補充 |
Multi-dimensional Fusion:多維融合與單一維度檢視
多維度融合是預設:Taiwan World Model 會把官方觀測、雷達、衛星、攝影機、交通、水文、防災告警、新聞/社群等多個維度互相驗證,形成可解釋、有 confidence、有 limitations 的現實判斷。
單一維度檢視 也可提供,例如只看攝影機、只看衛星、只看雨量站或只看交通;這是 single_dimension_view,適合除錯、透明度、專業查核與使用者只想「看看」某一層。但單一維度只能回答局部狀況,不能包裝成完整 world model 答案。
| 模式 | 用途 | 限制 |
|---|---|---|
multi_dimensional_fusion | 預設 Reality Engine;回答是否適合出門、是否真的下雨/塞車/危險 | 成本較高,需要治理與來源分級 |
single_dimension_view | 只看某一資料層,例如 camera / satellite / rainfall / traffic | 太大材小用;只能代表局部 layer,不代表完整現實判斷 |
公共資源 catalog
| Source ID | 類型 | 狀態 | 備註 |
|---|---|---|---|
cwa_weather_observation | weather | client_ready_requires_cwa_api_key | 中央氣象署觀測資料;CWA client v0 已完成,需環境變數 API key 才能 live fetch |
cwa_rainfall_observation | rainfall | client_ready_requires_cwa_api_key | 中央氣象署雨量資料;CWA client v0 已完成,需記錄測站、觀測時間與 freshness |
cwa_weather_forecast | forecast | planned | 週末/假期預報、forecast_uncertainty、forecast_divergence |
cwa_radar_echo | radar | planned | 短時降雨 nowcast 與雨帶移動 |
cwa_satellite_cloud | satellite | planned | 雲帶、颱風外圍環流、能見度趨勢 |
cwa_typhoon_forecast | forecast_alert | planned | 颱風路徑、警報與不確定性 |
tdx_transport_traffic | traffic | planned | TDX 交通資料 |
freeway_vd_traffic | traffic_sensor | planned | 高速公路 VD 車流/車速/占有率 |
freeway_cms_messages | traffic_bulletin | planned | 高速公路 CMS 資訊可變標誌 |
official_road_closure_bulletins | official_bulletin | planned | 封路、施工、災害通報 |
scenic_camera_public_feeds | camera | candidate_review_required | 景點公開攝影機;需白名單審查 |
freeway_traffic_cctv | traffic_camera | candidate_review_required | 高速公路 CCTV;不公開原始 URL,不做車牌/車輛追蹤 |
river_water_level_observation | water_level | planned | 河川水位觀測 |
flood_alerts | disaster_alert | planned | 淹水警戒與防災告警 |
reservoir_status | reservoir | planned | 水庫水情與洩洪資料 |
aqi_observation | air_quality | planned | 環境部空氣品質 AQI |
public_parking_availability | parking | planned | 公共停車場即時剩餘車位 |
tourism_scenic_spots | tourism | planned | 觀光景點基本資料與公告 |
cwa_earthquake_reports | earthquake | planned | 中央氣象署地震報告與地震速報;地震資訊需以官方發布時間、震央、規模、深度為準 |
cwa_tsunami_messages | tsunami_alert | planned | 中央氣象署海嘯資訊與警報;海嘯警報不可由攝影機或社群訊號取代官方告警 |
nfa_disaster_alerts | disaster_alert | planned | 消防署 / 災防告警與防災資訊 |
soil_debris_flow_alerts | landslide_alert | planned | 土石流與大規模崩塌警戒資料 |
Decision Reality:現在進行式狀態 → 決策
Reality API 的核心不是展示資料,而是回答會影響行動的 現在進行式 狀態:現在是否真的在下雨?現在是否真的在塞車?資料是否夠新,能不能支援即時決策?
| 使用者決策 | 需要的 current_state | decision_impact / recommendation |
|---|---|---|
| 騎車要不要穿雨衣 | rain_now、drizzle_now、road_wetness、rain_trend | 穿雨衣 / 輕便雨衣即可 / 可暫不穿但 30 分鐘內注意 |
| 走路撐傘是否夠 | rain_intensity、wind_gust、sideways_rain、distance_duration | 撐傘可行 / 需雨衣 / 建議延後 |
| 開車或改搭火車 | traffic_congestion、road_availability、stuckness、incident_risk | 開車可接受 / 改搭火車較穩 / 延後出發 |
{
"current_state": "drizzle_now",
"decision_impact": "騎車會被淋濕,走路短程撐傘可接受",
"recommendation": "騎車穿雨衣;步行可撐傘",
"confidence": 0.78,
"limitations": ["最近雨量站距離 4.2 公里"]
}
Now Freshness Contract:現在資料必須夠新
若資料不夠新,Reality API 不可假裝是「現在」。每個可用於即時決策的 signal 都應回報 observed_at、fetched_at、freshness_seconds、staleness。資料過舊時應降級為 stale 或 unknown,並提示不要用於即時決策。
| 狀態 | 意義 | 決策處理 |
|---|---|---|
fresh | 資料足夠新,可支援現在判斷 | 可給 recommendation |
stale | 資料已過時,不代表現在 | 只能給保守建議或要求重查 |
unknown | 沒有足夠資料判斷現在 | 不可做明確決策建議 |
Weather Reality:天氣現狀如何掌握?
天氣不能只看預報。Reality API 會區分 預報 forecast、觀測 observation、現場視覺 visual evidence、nowcasting 臨近推估。當氣象說天晴但現場毛毛雨,常見原因是微氣候、地形雲霧、測站距離、雷達解析度或降雨胞偏移。
| 問題 | 主要訊號 | 判斷重點 |
|---|---|---|
| 預報晴但現場毛毛雨 | 雨量站、雷達回波、濕度/露點、攝影機地面濕潤、社群回報 | 標記為微尺度降雨或地形性毛毛雨;以資料新鮮度與近距離觀測提高 confidence。 |
| 預報雨但現場大太陽 | 雷達雨帶位置、衛星雲圖、日照/能見度、攝影機天空狀態、最近雨量 | 判斷雨帶是否偏移、已通過或只影響同預報區的其他地點。 |
| 山區雲海/霧/能見度 | 濕度、露點差、風速、地形高度、攝影機視覺、雷達/衛星 | 把雨、霧、雲海分開;不把看不清楚一律當成下雨。 |
Forecast Reality:Weekend / Holiday Planning
CWA Rain Forecast Answer V0:POST /v1/reality/check 可將「阿里山下午會下雨嗎?」這類 future rain query 分流成 rain_forecast,並回傳 forecast_answer / cwa_rain_forecast_answer_v0。回應會保留 current_observation_state 與 forecast_context,政策固定為 forecast_is_future_context_not_current_observation,避免把短時預報包裝成現在已下雨。
幾天後或週末假期的天氣預測有價值,但必須顯示 forecast_uncertainty 與 forecast_divergence。颱風生成、外圍環流、下沉氣流、雲雨帶位置與路徑偏移,都可能讓「預測大雨」與「當地實際很熱很晴」同時成立。
| 情境 | 需要比較的訊號 | 回答方式 |
|---|---|---|
| 颱風預測大雨但當地大太陽 | 颱風路徑、外圍環流、下沉氣流、雲雨帶位置、衛星雲圖 | 顯示預測分歧,標示短期可能熱但後續風險仍高 |
| 預報好天氣但烏雲籠罩並下雨 | 雷達回波、衛星雲圖、局部對流、地形雲、即時雨量 | 用 nowcast 修正 forecast,提醒現況已偏離預報 |
| 週末露營是否適合 | 多模型比較、預報變動趨勢、雨量機率、風速陣風、地形影響 | 回傳可行/觀望/不建議,並列出不確定性來源 |
Mountain / Camping Nowcast:山區與露營短時天氣
露營最怕天氣快速變化,因此不能只回答現在有沒有下雨,而要判斷 30–120 分鐘內是短時轉好還是短時轉壞。山區天氣會被地形、地勢、海拔高度、坡向、迎風/背風面、谷地/稜線差異強烈影響。
| 訊號 | 用途 | 露營判斷 |
|---|---|---|
| 雲的型態與移動 | 判斷雲底是否抬升、雲量是否減少、雨帶是否離開 | 雲層變薄、雲底抬升 → 可能短時轉好 |
| 濕度/露點差 | 判斷霧、低雲、毛毛雨與凝結風險 | 露點差很小 + 風弱 → 霧/毛毛雨可能持續 |
| 風速風向 | 判斷迎風坡降雨、背風面轉晴、雲霧移動速度 | 風向轉乾、風速增加且雨帶離開 → 可能轉好 |
| 雨量趨勢 | 比較近 10/30/60 分鐘雨量變化 | 雨量下降 + 雷達回波遠離 → 可能短時轉好 |
| 雷達回波移動 | 追蹤降雨胞是否接近或遠離營地 | 回波增強接近 + 高濕 → 短時轉壞 |
| 地形/海拔/坡向 | 修正模型預報與測站資料 | 同一行政區內,稜線、谷地、迎風坡可能完全不同 |
若當地沒有風速觀測,像 Windy 這類服務通常使用 ECMWF/GFS/ICON 等數值天氣模型推估網格風場,再依位置顯示;Reality API 需標示為 model_estimated_wind,不可假裝是現場實測。
Camera Visual Evidence:攝影機作為現場驗證
攝影機不是唯一資料源,但很適合作為 現場驗證 與 sanity check,用來確認預報、模型、感測器與官方公告是否符合實際畫面。
| 用途 | 可驗證內容 | 限制 |
|---|---|---|
| 天氣 | 是否真的下雨、地面是否濕、天空是否放晴、雲霧是否降低 | 鏡頭髒污、逆光、夜間畫面會降低可信度 |
| 交通 | 車流是否停滯、是否積水、事故/封路是否可視 | 不做車牌或個別車輛追蹤 |
| 景點 | 人潮、能見度、海況、現場可用性 | 不做人臉或個體追蹤 |
治理原則:不公開原始 CCTV URL、不做人臉、不做車牌、不長期保存原始影像;對外只輸出 summary / confidence / limitations。
Identity-Level Analysis Governance:身分層級分析治理
公開版 Reality Search 不追蹤個體。車牌辨識、人臉辨識與個體追蹤不是目前公開 API 的核心能力,也不應混入一般天氣、交通、景點與災害查詢。
| 模式 | 定位 | 治理要求 |
|---|---|---|
| Public Reality Search | 回答地方狀態:下雨、塞車、人潮、淹水、道路可用性 | 不做人臉、不做車牌、不追蹤個體,只回聚合狀態 |
| Law Enforcement Module | 未來可與警政單位合作的警政授權模組 | 必須獨立權限、合法授權、任務限定、資料最小化、完整審計、用途審查 |
原則:身分層級的分析只能存在於合法授權、可稽核、政府核准的受管制部署中;不能成為一般公開 Reality Search 的預設能力。
Satellite Evidence:衛星畫面
衛星畫面可以取得,並會作為 Reality Search 的大範圍天氣與災害環境 evidence。策略是:衛星負責大範圍雲系與趨勢,攝影機負責地面現場驗證;衛星影像不可單獨代表某個地點正在下雨或安全。
| source_id | 來源 | 狀態 | 用途 |
|---|---|---|---|
cwa_satellite_cloud | 中央氣象署衛星雲圖 | metadata_endpoint_found | 已確認 CWA dataset O-B0033-003:全解析紅外線衛星雲圖KMZ檔-東亞,10 分鐘更新,metadata 欄位含 Datetime / ProductURL。data.gov.tw 可作 discovery/provenance,runtime 優先接 CWA fileapi / 官方 bucket。 |
himawari_8_9_open_satellite | JMA / NOAA Open Data on AWS | candidate_open_data_raw_pipeline_required | Himawari-8/9 原始開放衛星資料;需裁切台灣區域、投影與處理後才能作 evidence。 |
Camera Source Discovery v0:攝影機多來源盤點
攝影機大項目目前進入來源盤點階段,原則是多來源,不單點依賴。第一批 registry seed 已涵蓋山區、海岸、景點、交通與水文防災候選來源;多數仍是 discovery_only 或 license_review_required,不代表已可抓取或可作 production evidence。
| location_id | 類型 | 用途 | 狀態 |
|---|---|---|---|
alishan | scenic_camera | 雲海、下雨、能見度 | 1 個 optional proxy source 可抓 metadata;另有候選來源待審查 |
hehuanshan | mountain_camera | 雲霧、積雪、能見度 | discovery_only |
wuling_farm | mountain_camera | 天氣、人潮、能見度 | discovery_only |
kenting | coastal_camera | 玩水條件、浪況視覺輔助、人潮 | discovery_only |
river_disaster_general | water_disaster_camera | 淹水、水位、河川現場驗證 | requires_authorization |
Camera Whitelist Workflow:攝影機白名單介接流程
公共公開攝影機不會直接全量接入。每個來源都必須完成候選來源盤點、授權審查、隱私風險審查、技術可用性檢查與白名單啟用。
- 候選來源盤點:記錄 provider、頁面來源、地點、用途、更新頻率與初步風險。
- 授權審查:確認是否允許抓取、AI 分析、展示截圖或僅可連回原頁。
- 隱私風險審查:排除住宅、學校、醫院、私人空間與容易識別個體的角度。
- 技術可用性檢查:確認格式、穩定性、更新頻率、延遲與是否需要只存 metadata。
- 白名單啟用:只允許通過審查的 camera source 進入 on-demand visual evidence pipeline。
API Key Application / Partner Client Onboarding
早期合作夥伴、政府 PoC 或 TrueSight client 應使用獨立 API key,以便累積 usage metering / shadow billing。建立 client 時使用 scripts/create_api_client.py,stdout 只顯示一次 api_key_once;registry file 只保存 api_key_sha256。不要把 plaintext API key commit 到 repo、docs、tests、logs 或 Codex prompt。
.venv311/bin/python scripts/create_api_client.py --client-id partner-demo --tier pilot --billing-mode shadow_billing --allow-endpoint v1.reality.auth_whoami --allow-endpoint v1.reality.billing_current --allow-endpoint v1.reality.sources --output /tmp/partner-demo-client.json
完整文件:docs/API_KEY_APPLICATION_AND_CLIENT_ONBOARDING.md。Codex 不應要求使用者把 API key 貼進 prompt;只應使用 runtime env / secret store 中的 key。
Usage Quota Guard:用量上限與成本防護
早期 partner / government PoC client 可設定 monthly_request_limit 與 monthly_ru_limit。受保護 API 在執行昂貴工作前會先做 quota pre-flight check;超過上限時回 429 usage_limit_exceeded,不再產生新的 billable usage event。
{
"error": {
"code": "usage_limit_exceeded",
"message": "API client monthly usage limit has been exceeded.",
"details": {
"reason": "monthly_request_limit_exceeded",
"monthly_request_limit": 100000,
"current_requests": 100000,
"current_reality_units": 8420.5,
"estimated_reality_units": 0.1
}
}
}
v0 enforcement 已涵蓋 metered endpoints:sources、cameras、camera selection、snapshot、visual evidence、stability、cross-check 與 reality check。monthly_spend_limit_twd 目前仍作為 profile / shadow-billing 欄位,正式金額停權需等 pricing model 校準後再啟用。
Partner Pilot Report:合作夥伴 / 政府 PoC 月報
scripts/generate_partner_report.py 可從 server-side JSONL usage log 產出 partner_pilot_monthly_report_v0,支援 JSON 與 Markdown。用途是對 partner / government PoC 說明本月使用量、Reality Units、endpoint 分布、quota 使用率、高成本功能與下一步建議;它不是正式 invoice。
/opt/taiwan-world-model/.venv/bin/python scripts/generate_partner_report.py --usage-log /var/lib/taiwan-world-model/usage-events.jsonl --client-id partner-demo --period 2026-06 --billing-mode shadow_billing --monthly-request-limit 100000 --monthly-ru-limit 250000 --monthly-spend-limit-twd 5000 --format markdown
報告只應分享 aggregate summary;不要公開 raw usage log,因為其中可能包含 client_id、endpoint、intent、location_id、status 等 operational metadata。
Admin Console V0:API client 管理平台
Durable Source Catalog Store V0 load-time hardening:load-time catalog fstat failure fail-closed guard、load-time catalog fd fstat before read TypeError fail-closed guard、load-time catalog lstat failure fail-closed guard、load-time catalog open TypeError fail-closed guard、load-time catalog fdopen TypeError fail-closed guard、load parent-dir open TypeError fail-closed guard、initial load-time catalog lstat failure fail-closed guard、initial load-time catalog lstat TypeError fail-closed guard、existing write-time catalog lstat TypeError fail-closed guard、pre-read catalog path lstat TypeError fail-closed guard、write parent-dir lstat TypeError fail-closed guard、write parent-dir helper lstat TypeError fail-closed guard、temp file fsync TypeError fail-closed guard、temp file lstat during fsync TypeError fail-closed guard、parent-dir fsync lstat TypeError fail-closed guard、parent-dir fsync TypeError fail-closed guard、initial load preflight lstat-only metadata validation guard、ancestor symlink lstat-only scanner guard / ancestor symlink lstat TypeError fail-closed guard、load-time catalog fd primary failure precedence guard、load-time catalog fd close-before-read TypeError fail-closed guard、missing restart_consistency.paths_hidden / restart consistency paths_hidden required load guard、redaction removed_categories deterministic order load guard、load parent-dir fstat failure fail-closed guard、load parent-dir fstat TypeError fail-closed guard、load parent-dir lstat TypeError fail-closed guard、load parent-dir lstat failure fail-closed guard、load parent-dir primary failure precedence guard、load parent-dir close TypeError fail-closed guard、load-time catalog parse primary failure precedence guard、post-read catalog fd fileno failure fail-closed guard、post-read catalog fd fileno TypeError fail-closed guard、post-read catalog fd fstat failure fail-closed guard、post-read catalog fd fstat TypeError fail-closed guard、post-read catalog path lstat failure fail-closed guard、post-read catalog lstat TypeError fail-closed guard、post-read parent-dir fstat failure fail-closed guard、post-read parent-dir fstat TypeError fail-closed guard、post-read parent-dir lstat TypeError fail-closed guard、post-read parent-dir lstat failure fail-closed guard、post-read parent-dir close TypeError fail-closed guard 與 post-read parent-dir primary failure precedence guard、post-replace parent-dir fstat TypeError fail-closed guard、post-replace catalog close TypeError fail-closed guard、post-read catalog close TypeError fail-closed guard 會在 load-time catalog fd/path、parent fd/path、catalog parse 與 wrapper validation/post-read fd/path/parent metadata recheck 前,把 catalog fd/path、parent-dir inspection/close failure、parser TypeError 或 reordered redaction.removed_categories wrapper 收斂為 fail-closed fallback,不載入非 canonical durable catalog;inspection/parse/close errors 仍使用 source catalog fd must be inspectable before read / source catalog path must be inspectable before read / source catalog parent directory must be inspectable before read / source catalog parent directory fd must be closable before read / source catalog JSON must be parseable / source catalog fd must be inspectable after read / source catalog path must be inspectable after read / source catalog parent directory must be inspectable after read / source catalog fd must be closable after read / source catalog parent directory fd must be closable after read 這類固定訊息,且不暴露 durable path/source payload/API key/hash/token/password/credential/raw feed locator。
內部管理平台已提供最小 V0:/admin、/admin/clients、/admin/clients/{client_id}、/admin/clients/{client_id}/report。Admin Console 需 server-side REALITY_ADMIN_KEY,呼叫時使用 header X-Admin-Key;不顯示 plaintext API key 或 key hash。
Admin Source Registry Persistence V0:staging sources-only apply 在設定 ADMIN_SOURCE_CATALOG_PATH 後,會以 admin_source_catalog_v1 / durable_json_v1 原子寫入 source metadata;redaction allowed key table ADMIN_SOURCE_CATALOG_REDACTION_ALLOWED_KEYS、redaction required value table ADMIN_SOURCE_CATALOG_REDACTION_REQUIRED_VALUES、redaction required list-value table ADMIN_SOURCE_CATALOG_REDACTION_REQUIRED_LIST_VALUES 與 redaction removed-categories table ADMIN_SOURCE_CATALOG_REDACTION_REMOVED_CATEGORIES 維護 deterministic redaction wrapper key allowlist、secrets_removed=true value contract、removed_categories save/load contract、missing/unexpected key fail-closed、tampered secrets_removed fail-closed 與 reordered-category fail-closed;storage allowed key table ADMIN_SOURCE_CATALOG_STORAGE_ALLOWED_KEYS 與 storage required value table ADMIN_SOURCE_CATALOG_STORAGE_REQUIRED_VALUES 共同維護 durable storage wrapper allowlist/value contract(只允許 mode / durable,且必須為 mode=durable_json_v1 / durable=true,tampered mode/durable fail-closed);contains allowed key table ADMIN_SOURCE_CATALOG_CONTAINS_ALLOWED_KEYS 與 contains required value table ADMIN_SOURCE_CATALOG_CONTAINS_REQUIRED_VALUES 維護 metadata-only contains wrapper allowlist/value contract(只允許 sources count placeholder;save 時以實際 count 覆寫)與 unexpected-key / invalid count / mismatched count fail-closed;source-item allowed key table ADMIN_SOURCE_CATALOG_SOURCE_ITEM_ALLOWED_KEYS 維護每筆 source item wrapper allowlist 與 unexpected-key fail-closed;restart-consistency required value table ADMIN_SOURCE_CATALOG_RESTART_CONSISTENCY_REQUIRED_VALUES 維護 schema_version=source_catalog_restart_consistency_v0 / compare_field=catalog_sha256 / metadata_only=true / paths_hidden=true value contract 與 tampered values fail-closed;並只在 durable save 成功後切換 runtime catalog / Evidence Planner;若 durable save I/O 失敗或 store validation error(例如 duplicate source_id)拒絕 catalog,會 fail closed 回 source_catalog_persist_failed_v0、sources_written=0、不切換 runtime state、audit 只記 metadata-only storage/plan 欄位,避免 save failure 時 imported source 只存在 memory;restore apply 也有 restore durable save failure fail-closed:若 snapshot restore 的 durable source catalog save 失敗,回 source_catalog_restore_persist_failed_v0、restored_sources=0,不切換 runtime catalog / Evidence Planner。service restart 後仍可由 /v1/reality/sources 看到 imported sources。source_catalog_storage 只在 catalog 實際從 durable file 載入或本次成功 durable save 後回 durable_json_v1;若 path 已設定但檔案不存在、schema 不符或無法讀取,會 fallback seed catalog 並回 in_memory_v0,避免誤標示 durable runtime。durable catalog 寫入與啟動載入都會移除 raw feed URL、一般 http(s) URL value、streaming scheme URL-like value(rtsp:// / rtmp:// / ws:// / wss:// / ftp:// / sftp://)、embedded URL-like string value、scheme-relative URL value、bare host/path URL-like value、bare IP host/path URL-like value、API credential、password、token 與 authorization/bearer header hints;initial write-time catalog lstat failure fail-closed guard、initial write-time catalog lstat TypeError fail-closed guard 與 existing write-time catalog lstat TypeError fail-closed guard 會在建立或覆寫既有 catalog 前把 lstat inspection failure 收斂為 source catalog path must be inspectable before write,且既有 durable catalog 覆寫前遇到 TypeError 會保留原 catalog;temporary source catalog symlink guard 會在 payload write 前拒絕 temporary source catalog file must be a regular file;load-time symlink no-follow guard 會在開啟 catalog 讀取前拒絕 source catalog path must not be a symlink before read;load-time parent symlink guard 會在開啟 catalog 讀取前拒絕 source catalog parent directory must not be a symlink before read;ancestor symlink lstat-only scanner guard / ancestor symlink lstat TypeError fail-closed guard 會以 parent lstat 檢查 ancestor symlink,不依賴 Path.is_symlink();load-time fstat owner/mode recheck 會在 os.open 後再次確認已開啟 fd 仍是 service-user owned、single hard link、owner-only regular file;load-time catalog open fail-closed guard 會在 durable catalog file 無法被 no-follow 開啟時回一致錯誤(source catalog path must be openable before read);load-time catalog fd close-before-read fail-closed guard 會在 fdopen/read 前 catalog fd 關閉失敗時回一致錯誤(source catalog fd must be closable before read);load-time catalog read failure fail-closed guard 會在 JSON parse 前 payload read 失敗時回一致錯誤(source catalog file must be readable before parse);load-time catalog JSON parse fail-closed guard 會將 malformed JSON 統一拒絕為 source catalog JSON must be parseable、load-time catalog UTF-8 decode fail-closed guard(`source catalog file must be valid UTF-8`);load-time catalog fd/path identity recheck 會在讀取 payload 前比對 path.lstat() 與已開啟 fd,若 catalog path 被換成另一個 inode 會 fail closed(source catalog path changed before read);post-read catalog fd/path identity recheck 會在 JSON parse 後再次比對已開啟 fd 與 catalog path,若讀取期間 path 被替換會 fail closed(source catalog path changed after read);post-read catalog fd metadata recheck 會在 JSON parse 後再次確認已開啟 fd 仍是 owner-only regular file,若讀取期間變成 world-readable 會 fail closed(source catalog path must be owner-only readable/writable after read);post-read parent-dir fd metadata recheck 會在 JSON parse 後再次確認 parent directory fd/path metadata,若讀取期間 parent 變成 group/world-writable 會 fail closed(source catalog parent directory must not be group/world-writable after read);post-read parent-dir open fail-closed guard / post-read parent-dir open TypeError fail-closed guard / post-read parent-dir close failure fail-closed guard 會在 JSON parse 後若無法重新開啟 parent directory 時 fail closed(source catalog parent directory must be openable after read / source catalog parent directory fd must be closable after read);post-read catalog fd primary failure precedence guard 會在 JSON parse 後 fd metadata recheck 已有主要錯誤且 close cleanup 也失敗時保留主要錯誤(source catalog fd must be inspectable after read);post-read catalog close failure fail-closed guard 會在 JSON parse / fd-path recheck / parent recheck 後若 catalog fd close 失敗時 fail closed(source catalog fd must be closable after read);invalid UTF-8/unreadable catalog text、corrupt JSON、wrong schema、unexpected top-level fields、top-level non-object JSON、non-list sources、non-object source metadata 與 malformed items 會安全忽略並 fallback seed catalog;不擴大到 cameras、clients 或 secrets。Production apply 仍 hard-locked。
| 能力 | V0 狀態 |
|---|---|
| Client list / detail | 可檢視 status、tier、billing profile、allowed endpoints、usage summary |
| Partner report | 可從 usage log 產生 client 月報 |
| Suspend / restore / revoke | 可更新 runtime client status;V0 為 in-memory,重啟後需由 registry/env/DB 持久化 |
| Security | 需 X-Admin-Key;不可公開 raw usage log、API key、raw CCTV URL |
Camera Integration Foundation:攝影機介接基礎
攝影機是大項目,會分階段接入。第一階段先建立安全 registry endpoint:GET /v1/reality/cameras,回傳攝影機候選/白名單狀態,不公開原始 CCTV URL。MVP 的使用者驗證連結 contract 是:提供 public_source_url / public_page_url 作為「查看官方來源頁」入口,並明確回 can_user_verify、verification_label、source_link_policy=public_source_page_only、technical_stream_url_exposed=false;使用者可開公開來源頁自行驗證,但公開來源頁,不是技術取流網址、m3u8、RTSP、thumbnail、signed URL 或任何帶 token 的網址。
curl -s "https://taiwanworldmodel.thesense.biz/v1/reality/cameras?location_id=alishan" -H "X-API-Key: $TRUESIGHT_REALITY_API_KEY"
第二階段新增第一個 server-side snapshot metadata endpoint:GET /v1/reality/cameras/{camera_id}/snapshot。此 endpoint 只回 snapshot metadata,不回傳影像內容、不公開 raw URL;若尚未在 server 設定來源,會回 configuration_required,但不公開 locator 或 env var 名稱/值。攝影機策略改為歡迎多來源:第一手優先但不阻塞 MVP;YouTube proxy / embed / thumbnail 可作為 source_usage_policy=optional_toggle 的輔助來源,但必須標註 source_lineage、quality profile、evidence tier 與 limitations。camera_l2_official_html_dataset_resolver_v0 會在已白名單官方 data.gov.tw HTML dataset page 中只 follow process-local allowlisted first-party resource link,再交給 JSON resolver 與 CCD identifier / parent-station matching guard;camera_l2_official_camera_html_showone_resolver_v0 只針對已 review 的官方 MOA/ARDSWC camera HTML page,在 process 內解析 same-site displayed frame,再回 L2 snapshot metadata;仍不公開 resource endpoint、raw locator、env/credential、HTML/JSON payload、frame id 或原圖。成功抓到 snapshot 時會回 evidence_scoring,其中 stability_score 會修正來源可信度成 effective_source_trust_score,最後產生 evidence_weight。
curl -s "https://taiwanworldmodel.thesense.biz/v1/reality/cameras/camera_whitelisted_alishan_weather_validation/snapshot" -H "X-API-Key: $TRUESIGHT_REALITY_API_KEY"
第三階段新增 visual observation usable V0 endpoint:GET /v1/reality/cameras/{camera_id}/visual-evidence。目前定義 camera_visual_observation_v0 schema,欄位包含 visible_rain、wet_ground、visibility、cloud_or_fog、crowd_level、traffic_density、water_level_visual_risk、scene_usable、observed_at、fetched_at、confidence、limitations。若 server-side snapshot 可用,runtime 會回 visual_evidence_available / metadata_only_snapshot_available,並附 snapshot_metadata 與 evidence_scoring;若接上安全的 analyzer runtime,會回 camera_ai_visual_analysis_v0 / ai_visual_analysis_available,但只允許 low-risk scene/weather fields only:雨、地面濕、能見度、雲霧等低風險欄位;dry-run analyzer 可由 server-side CAMERA_VISION_DRY_RUN_ENABLED=true 開啟,回 camera_vision_dry_run_v0 / vision_dry_run_available 與 external_call_performed=false、would_call_provider=false、budget_decision、deny_reason,只驗證 pipeline/budget/cache 決策,不呼叫外部 API、不產生成本;Provider fixture analyzer 可由 server-side CAMERA_VISION_PROVIDER_FIXTURE_ENABLED=true 開啟,回 camera_vision_provider_fixture_analyzer_v0、fixture_result_used=true、fixture_analysis_plumbing_verified 與 raw_provider_response_returned=false,只用本地 fixture provider result 測試 adapter parser flow,仍不呼叫外部 API、不產生成本,且不得算 L3 或當成即時畫面判讀;人潮、交通、水位仍可維持 unknown,且不做臉、車牌、個體追蹤。若 snapshot 未設定則誠實回 snapshot_not_available / configuration_required;不回 raw image bytes、不回 raw URL。第三方/proxy 來源只能作 auxiliary_proxy_evidence,不得包裝成第一手或等權重官方 evidence。
curl -s "https://taiwanworldmodel.thesense.biz/v1/reality/cameras/camera_whitelisted_alishan_weather_validation/visual-evidence" -H "X-API-Key: $TRUESIGHT_REALITY_API_KEY"
Camera Vision Provider Status V0:GET /v1/reality/cameras/vision-provider/status 回 camera_vision_provider_status_v0,只報告 provider/model/credential 是否 configured;若 provider/model/key 都有設定但安全 gates 未齊,回 configured_disabled。Camera AI Visual Runtime V0 已支援 OpenAI-compatible external analyzer,但預設 fail-closed;必須同時具備 provider/model/credential、CAMERA_VISION_BUDGET_GUARD_ENABLED=true 與 CAMERA_VISION_EXTERNAL_CALLS_ENABLED=true,且未啟用 fixture/dry-run analyzer,才會進入 runtime_enabled / ai_visual_analysis_available。此 endpoint 本身仍 external_call_performed=false、raw_prompt_hidden=true、raw_image_bytes_returned=false、raw_camera_url_returned=false、credential_value_exposed=false,不輸出 API key、env var name、raw prompt、raw image 或 raw URL。Camera Vision Call Budget Guard V0 以 camera_vision_call_budget_guard_v0 宣告接 vision API 前的成本護欄:enabled=false by default、external_calls_allowed=false by default、max_calls_per_camera_per_hour、cache_ttl_seconds、max_image_bytes、denied_requests_billable=false。Camera Vision Provider Adapter Contract V0 以 camera_vision_provider_adapter_contract_v0 / camera_vision_provider_adapter_request_v0 / camera_weather_scene_prompt_v0 固定 request/prompt/output parser contract,預設 parser_status=contract_ready_no_call、raw_provider_response_returned=false;parser 只接受低風險 weather/scene 欄位,會把人潮、交通、水位、臉、車牌、個體追蹤等欄位丟棄或 forced unknown。Camera Vision Provider Call Preflight Guard V0 以 camera_vision_provider_call_preflight_guard_v0 在任何真外部 call 前 fail-closed;預設 external_call_denied,只有 provider/model/credential configured、fixture_analyzer_verified、budget guard enabled 與 explicit_external_call_enabled 全部為 true 時才會進入 external_call_preflight_passed。
curl -s "https://taiwanworldmodel.thesense.biz/v1/reality/cameras/vision-provider/status" -H "X-API-Key: $TRUESIGHT_REALITY_API_KEY"
第四階段新增 Camera Stability Monitor v0 endpoint:GET /v1/reality/cameras/{camera_id}/stability。欄位包含 fetch_success_rate_24h、fetch_success_rate_7d、median_latency_ms、content_type_consistency、byte_size_consistency、last_success_at、last_failure_at、history_status 與 effective_stability_score。v0 使用 in-memory latest fetch history,所以若尚無長期資料會誠實標示 limited_history;runtime stability 可修正 effective_source_trust_score 與 evidence_weight,但不可作 production SLA。
curl -s "https://taiwanworldmodel.thesense.biz/v1/reality/cameras/camera_whitelisted_alishan_weather_validation/stability" -H "X-API-Key: $TRUESIGHT_REALITY_API_KEY"
第五階段新增 Camera × Official Data Cross-check v0 endpoint:GET /v1/reality/cameras/{camera_id}/cross-check,把原本規劃的氣象交叉驗證擴展為 CWA / radar / satellite / traffic / water/disaster 官方資料 cross-check。目前定義 camera_official_cross_check_v0 contract,狀態 enum 包含 supports_official_observation、contradicts_official_observation、inconclusive、insufficient_data、configuration_required。因尚未啟用真 AI visual observation,runtime 誠實回 insufficient_data / visual_analysis_not_enabled;攝影機只作 visual validation,不取代 CWA、雷達、衛星、交通、水文或防災官方來源。
curl -s "https://taiwanworldmodel.thesense.biz/v1/reality/cameras/camera_whitelisted_alishan_weather_validation/cross-check" -H "X-API-Key: $TRUESIGHT_REALITY_API_KEY"
第六階段新增 Multi-source Camera Selection v0 endpoint:GET /v1/reality/cameras/select。它依 location_id 與 intent 排序候選鏡頭,schema 為 multi_source_camera_selection_v0;排序因素包含 source trust、visual quality、stability、first-party score、review status、usage policy、evidence tier 與 privacy risk。此 endpoint 只做 candidate ranking,不表示 discovery-only 或 requires-authorization 來源可抓影像。
curl -s "https://taiwanworldmodel.thesense.biz/v1/reality/cameras/select?location_id=alishan&intent=cloud_sea_visual_evidence" -H "X-API-Key: $TRUESIGHT_REALITY_API_KEY"
| 階段 | 狀態 | 說明 |
|---|---|---|
| Quality Profile | quality_profile_v0_complete | 所有已 lineage-reviewed 的來源已補齊 source_trust_score、visual_quality_score、stability_score、first_party_score、latency_risk、stability_risk、resolution_quality、license_certainty、privacy_risk;仍不代表授權完成。 |
| Visual Observation Schema | camera_visual_observation_v0 | 已升級為 visual evidence usable V0;snapshot 可用時回 visual_evidence_available / metadata_only_snapshot_available,但內容判讀仍為 uncertain/unknown,第三方/proxy 僅作 auxiliary_proxy_evidence。 |
| Stability Monitor | limited_history | 已建立 runtime foundation,可回報成功率、延遲、content-type 與 byte-size 一致性,並以 effective_stability_score 修正 trust/weight;長期 24h/7d 仍需 DB。 |
| Cross-check | camera_official_cross_check_v0 | 已建立 camera visual evidence × official data contract;尚未啟用 AI 視覺分析時回 insufficient_data / visual_analysis_not_enabled。 |
| Multi-source Selection | multi_source_camera_selection_v0 | 已建立 location/intent 候選鏡頭排序;不把 discovery_only 或 requires_authorization 來源當成可抓取影像。 |
| Registry | camera_registry_only | 已可查候選/白名單 metadata,不含 raw URL。 |
| Next milestone | connect_more_reviewed_snapshot_fetchers | 下一步將更多已通過授權/隱私/技術審查的來源接到 server-side snapshot fetcher。 |
Traffic Reality:交通如何測量?
交通不能只用「車速低」判斷。Reality API 會把交通問題拆成 道路可用性、壅塞程度、真卡死/假塞車、資料盲區 四類。
| 問題 | 主要訊號 | 判斷重點 |
|---|---|---|
| 風災豪雨造成道路不可用 | 封路/事故通報、CMS、VD 車流、CCTV、雨量、水位、地方災情 | 不能把「沒速度資料」直接當成順暢;需判斷封路、資料中斷、或車輛已無法前行。 |
| 連假高速公路壅塞 | VD 車流/車速/占有率、ETag/旅行時間、CMS、交流道回堵、歷史連假 baseline | 區分短暫降速的假塞車與低速、低流量、排隊長度增加的真卡死。 |
| 沒顯示塞車但實際不能動 | 上游/下游偵測點落差、CCTV、事故通報、社群/新聞、資料新鮮度 | 標記為資料盲區或異常阻斷,不把官方未顯示塞車視為道路可用。 |
互動式文件
安全限制
- 不支援人臉辨識、車牌辨識、個人追蹤、私人空間監控。
- CCTV / webcam 類資料源必須白名單審查。
- 不公開原始攝影機 URL,不長期保存原始影像。