{
  "product": "AI跑步助手",
  "version": "1.10",
  "viewport": { "width": 390, "height": 844 },
  "tabs": [
    { "id": "home", "label": "首页", "route": "HOME-01" },
    { "id": "training", "label": "训练", "route": "TRAIN-HUB" },
    { "id": "nutrition", "label": "营养", "route": "NUT-01" },
    { "id": "profile", "label": "我的", "route": "PROFILE-01" }
  ],
  "globalRoutes": ["AI-01", "AI-02", "AI-03", "AI-04", "DEV-02", "PLAN-06"],
  "aiEntryPolicy": {
    "primaryEntry": { "route": "HOME-01", "type": "conversational_home" },
    "contextualEntry": { "route": "AI-02", "component": "AiSummaryPreview", "ctaComponent": "GoSeeButton", "previewMaxLines": 2, "inlineSummary": false },
    "analysisContextFields": ["sourceRoute", "analysisType", "entityId", "timeRange", "metricSnapshot", "dataSources", "freshness", "contextThreadId"],
    "returnBehavior": "restore_origin_route_scroll_and_selection"
  },
  "homeConversationContract": {
    "route": "HOME-01",
    "layout": "single_column_conversation_timeline",
    "dashboardModulesAllowed": false,
    "businessCardDelivery": "agent_message_attachment_only",
    "messageComponents": ["ConversationTimeline", "AgentMessage", "UserMessage", "AgentCardMessage", "MessageSkeleton", "QuickReplyChips", "AgentComposer"],
    "agentCardTypes": ["recovery", "training", "nutrition", "reminder", "proposal", "safety"],
    "requiredMessageFields": ["messageId", "conversationId", "role", "contentType", "createdAt", "status"],
    "requiredCardFields": ["cardType", "entityId", "payload", "actions"],
    "initialSequence": ["agent_greeting", "agent_context_summary", "agent_recovery_card", "agent_training_card", "agent_nutrition_card", "agent_reminder_card", "quick_replies"],
    "streamStates": ["queued", "generating", "partial_text", "card_ready", "delivered", "failed"],
    "restoreKey": ["conversationId", "messageId"],
    "restoreState": ["messageOrder", "scrollPosition", "composerDraft", "cardActionState"],
    "followUpBehavior": "append_user_and_agent_messages_in_same_timeline"
  },
  "releasePlan": {
    "launchPlatform": "wechat_mini_program",
    "phase1": {
      "label": "一期·小程序首发",
      "fullDemos": ["D1", "D2", "D3", "D6", "D8"],
      "conditionalDemos": ["D4", "D5"],
      "conditionalRule": "foreground_direct_background_message_fallback"
    },
    "phase2": {
      "label": "二期",
      "demos": ["D7", "D9"],
      "features": ["period_capability_comparison", "biomarker_insight"]
    }
  },
  "routes": {
    "AUTH-01": ["ONB-01"],
    "ONB-01": ["ONB-02"],
    "ONB-02": ["ONB-03"],
    "ONB-03": ["DEV-01", "HOME-01"],
    "HOME-01": ["RECOVERY-01", "TRAIN-READY", "PLAN-05", "NUT-02", "AI-02", "AI-03", "AI-04", "REMIND-01"],
    "TRAIN-HUB": ["PLAN-01", "PLAN-02", "PLAN-04", "PLAN-05", "RECORD-01", "RECORD-02", "RECORD-04", "RECORD-06"],
    "PLAN-01": ["TRAIN-HUB", "PLAN-02", "PLAN-04", "PLAN-05"],
    "PLAN-02": ["PLAN-03"],
    "PLAN-03": ["TRAIN-HUB"],
    "PLAN-04": ["PLAN-05", "NUT-02", "TRAIN-READY", "AI-02"],
    "PLAN-05": ["PLAN-01", "RECORD-01"],
    "TRAIN-READY": ["DEV-01", "DEV-02", "TRAIN-LIVE", "REMIND-01"],
    "TRAIN-LIVE": ["TRAIN-SUMMARY", "NUT-03"],
    "TRAIN-SUMMARY": ["TRAIN-FEEDBACK", "TRAIN-ANALYSIS", "AI-02"],
    "TRAIN-FEEDBACK": ["TRAIN-ANALYSIS"],
    "NUT-01": ["NUT-02", "NUT-04", "NUT-05", "AI-02"],
    "NUT-02": ["NUT-03", "NUT-08", "REMIND-01", "AI-02"],
    "NUT-05": ["NUT-06", "NUT-07"],
    "NUT-06": ["NUT-05"],
    "NUT-07": ["NUT-05"],
    "RECORD-01": ["TRAIN-HUB", "RECORD-02", "RECORD-04"],
    "RECORD-02": ["RECORD-03", "RECORD-05", "AI-02"],
    "RECORD-03": ["AI-02"],
    "RECORD-04": ["RECORD-06", "AI-02"],
    "RECORD-06": ["AI-02"],
    "PROFILE-01": ["ONB-01", "ONB-02", "ONB-03", "DEV-01", "DEV-02", "REPORT-01"],
    "REPORT-01": ["PROFILE-01", "HOME-01"],
    "AI-01": ["HOME-01"],
    "AI-02": ["HOME-01", "PLAN-01", "NUT-02", "TRAIN-ANALYSIS", "originRoute"]
  },
  "planStates": ["draft", "proposed", "confirmed", "in_progress", "completed", "adjusted", "skipped", "cancelled"],
  "deviceStates": ["disconnected", "authorizing", "connected", "syncing", "synced", "stale", "failed", "permission_denied"],
  "agentStates": ["idle", "collecting_context", "generating", "ready", "failed", "offline_cache", "safety_blocked"],
  "trainingHub": {
    "route": "TRAIN-HUB",
    "views": ["plan", "record"],
    "sharedState": ["selectedDate", "calendarRange", "filters", "scrollPosition"],
    "dateOpenRules": {
      "future": "plan",
      "past_with_activity": "record",
      "today_plan_and_activity": "comparison"
    },
    "entityRule": "PlanItem and ActivityRecord remain separate and link by planItemId"
  },
  "liveTraining": {
    "route": "TRAIN-LIVE",
    "requiredPermission": "location_gps",
    "liveFields": ["elapsed", "distance", "pace", "heartRate", "energy", "gpsQuality"],
    "wearableMirror": { "optional": true, "releaseAvailability": "future_native_app_or_verified_vendor_sdk", "phase1MiniProgramAcceptance": false, "fields": ["elapsed", "distance", "pace", "heartRate", "fuelReminder"] },
    "fuelReminder": {
      "source": "agent_nutrition_plan",
      "trigger": "elapsed_time",
      "requiredFields": ["reminderId", "triggerAt", "type", "amount", "unit", "productId", "productName"],
      "defaultBrand": "康比特",
      "delivery": {
        "phone": ["vibration", "prompt"],
        "watch": ["vibration", "prompt"],
        "requiresUserAuthorization": true,
        "vibrationCount": 1,
        "repeatVibration": false,
        "presentationState": "visible_waiting_action",
        "dismissAfterAction": true,
        "dismissOnDevices": ["phone", "watch"],
        "timeoutBehavior": "minimized_pending"
      },
      "actions": ["acknowledged", "delayed", "skipped"],
      "crossDeviceIdempotencyKey": "reminderId",
      "lifecycle": ["scheduled", "armed", "vibrating_once", "visible_waiting_action", "action_processing", "acknowledged_or_delayed_or_skipped", "dismissed"],
      "events": ["FUEL_REMINDER_TRIGGERED", "HAPTIC_ONCE_COMPLETED", "PROMPT_OPENED", "ACTION_SUBMITTED", "REMINDER_DISMISSED", "REMINDER_MINIMIZED"]
    },
    "miniProgramChannelStrategy": {
      "foreground": {
        "channel": "miniProgramForeground",
        "capabilities": ["single_phone_vibration", "in_page_prompt", "user_action"]
      },
      "backgroundOrLocked": {
        "reliableRealtimeBle": false,
        "reliableRealtimeWearablePrompt": false,
        "primaryFallback": "miniProgramSubscribeMessage",
        "projectFallback": "officialAccountMessage",
        "fallbackRequirements": ["userConsent", "officialAccountFollowed", "accountBinding", "approvedMessageTemplate"],
        "deliverySla": "best_effort_not_second_level",
        "cannotControl": ["phoneVibration", "watchVibration", "watchPopup"]
      },
      "returnAction": "deep_link_to_TRAIN-LIVE_or_NUT-03_and_reconcile_by_reminderId"
    },
    "fuelReminderActions": ["acknowledged", "delayed", "skipped"],
    "offlineBehavior": "cache_telemetry_and_resume_upload"
  },
  "agentSourcePolicy": {
    "agentGeneratedDomains": ["trainingPlan", "trainingFeedbackAnalysis", "nutritionPlan", "fuelReminderTimeline", "periodComparison"],
    "requiredResponseMetadata": ["agentVersion", "sourceData", "basis", "confidence"],
    "frontendMayHardcodeBusinessAdvice": false
  },
  "productRecommendationPolicy": {
    "defaultBrand": "康比特",
    "catalogService": "productCatalogService",
    "requiredChecks": ["allergens", "contraindications", "giTolerance", "availability", "servingLimit"],
    "fallback": "agent_explains_and_rematches"
  },
  "biomarkerAnalysisPolicy": {
    "featureName": "生理生化指标洞察",
    "releasePhase": 2,
    "phase1Behavior": "interfaces_and_data_contract_only_no_user_entry",
    "entryRoute": "REPORT-01",
    "entryPlacement": "PROFILE-01.device_and_data",
    "triggerGate": {
      "allRequired": ["userUploadedReport", "consentGranted", "parseStatus=confirmed"],
      "analyzeWithoutUploadedReport": false,
      "showInsightCardWithoutAnalysis": false
    },
    "reportLifecycle": ["not_uploaded", "uploading", "parsing", "awaiting_confirmation", "confirmed", "analyzing", "insight_ready", "delivered"],
    "exceptionStates": ["parse_failed", "consent_revoked", "deleted", "medical_referral_only"],
    "allowedScope": ["sports_training_impact", "exercise_performance_impact", "physiological_state_impact", "recovery_impact", "sports_nutrition_product_suggestion"],
    "forbiddenScope": ["medical_advice", "disease_diagnosis", "etiology_inference", "medication_advice", "medical_procedure", "treatment_plan"],
    "symptomPolicy": {
      "onPhysicalDiscomfort": "medical_referral_only",
      "stopOutputs": ["biomarker_interpretation", "training_adjustment", "sports_nutrition_product_suggestion"],
      "onlyAllowedMessage": "建议暂停训练并寻求医疗建议"
    },
    "card": {
      "component": "BiomarkerInsightCard",
      "delivery": "AgentCardMessage",
      "requiredFields": ["reportId", "reportDate", "sourceName", "relevantObservations", "trainingImpact", "physiologicalStateImpact", "sportsNutritionProductSuggestions", "scope", "safetyLevel", "basis", "confidence"],
      "maxPreviewObservations": 3,
      "cta": { "label": "去看看", "route": "AI-02" }
    },
    "sportsNutritionProductChecks": ["productCatalog", "allergens", "contraindications", "giTolerance", "servingLimit"],
    "deleteBehavior": "revoke_analysis_context_and_stop_future_analysis"
  },
  "interactionContracts": {
    "onboardingSweatAssessment": {
      "route": "ONB-03",
      "component": "SweatSelfRating",
      "levels": ["low", "light", "moderate", "heavy", "soaked"],
      "presentation": "illustrated_icons_with_examples"
    },
    "planAiSummary": {
      "sourceRoute": "PLAN-04",
      "component": "AiSummaryButton",
      "destination": "AI-02",
      "reuseHomeConversation": true,
      "inlineSummary": false
    },
    "trainingFeedback": {
      "route": "TRAIN-FEEDBACK",
      "rpe": { "component": "Score20Slider", "min": 1, "max": 20, "showLiveValue": true, "ruleHint": "1–6很轻松；7–12适中；13–16较难；17–20极难" },
      "fatigue": { "component": "Score20Slider", "min": 1, "max": 20, "showLiveValue": true, "ruleHint": "1–5几乎不疲劳；6–10轻度疲劳；11–15明显疲劳；16–20非常疲劳" },
      "soreness": { "field": "sorenessLevel", "component": "SorenessSelector", "ruleHint": "无；轻微；中等；明显；严重" },
      "giComfort": { "field": "giComfort", "component": "GiComfortSelector", "ruleHint": "舒适；轻微不适；中等不适；明显不适" }
    },
    "recoveryFatigue": {
      "route": "RECOVERY-01",
      "field": "fatigueScore20",
      "component": "Score20Slider",
      "min": 1,
      "max": 20,
      "ruleHint": "1–5几乎不疲劳；6–10轻度疲劳；11–15明显疲劳；16–20非常疲劳",
      "scaleVersion": "20-point-v1"
    },
    "aiSummary": {
      "component": "AiSummaryPreview",
      "previewMaxLines": 2,
      "cta": { "label": "去看看", "component": "GoSeeButton", "route": "AI-02" },
      "detailBehavior": "open_contextual_ai_thread_with_follow_up",
      "inlineFullSummary": false
    },
    "periodComparison": {
      "route": "RECORD-06",
      "releasePhase": 2,
      "phase1Behavior": "collect_data_and_keep_api_contract_only",
      "compare": ["trainingCapabilities", "fuelingCapabilities"],
      "requiredFields": ["previousValue", "currentValue", "direction", "evidence", "confidence", "recommendation"],
      "aiSummaryRoute": "AI-02"
    }
  },
  "demoFlows": [
    ["AUTH-01", "ONB-01", "ONB-02", "ONB-03", "DEV-01", "PLAN-02", "PLAN-03", "TRAIN-HUB"],
    ["HOME-01", "RECOVERY-01", "HOME-01", "NUT-02", "TRAIN-READY"],
    ["TRAIN-HUB", "PLAN-05", "TRAIN-HUB"],
    ["PROFILE-01", "DEV-01", "TRAIN-HUB", "RECORD-02"],
    ["TRAIN-READY", "TRAIN-LIVE", "TRAIN-SUMMARY", "TRAIN-FEEDBACK", "TRAIN-ANALYSIS"],
    ["NUT-01", "NUT-05", "NUT-06", "AI-02", "NUT-07"],
    ["HOME-01", "HOME-01", "AI-03", "RECORD-03", "AI-02", "RECORD-03"],
    ["offline", "agent_failed", "permission_denied", "stale_data", "sync_conflict", "safety_blocked"],
    ["TRAIN-HUB", "RECORD-04", "RECORD-06", "AI-02", "RECORD-06"]
  ]
}
