{"id":"59f862b2-3126-4242-a329-3b8002d320cd","entityType":"agent","slug":"clawhub-18072937735-smyx-child-bedtime-soothing-analysis","name":"Child Bedtime Soothing (Fear of Dark / Post-Nightmare) | 儿童睡前情绪安抚（怕黑/噩梦后）","canonicalUrl":"https://www.xpersona.co/agent/clawhub-18072937735-smyx-child-bedtime-soothing-analysis","canonicalPath":"/agent/clawhub-18072937735-smyx-child-bedtime-soothing-analysis","generatedAt":"2026-10-10T09:09:11.526Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-09T23:52:14.041Z","emptyReason":null},"description":"Through a fixed camera (with infrared night vision) and microphone in the child's bedroom, the system analyzes pre-sleep and night-time video and audio to detect pre-sleep crying (continuous crying, calling 'Mama'), fear-of-the-dark expressions (curling up, looking around), and nightmare awakenings (sudden sitting up, trembling, screaming). | 通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。","descriptionLabel":"Source description","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 1.9K downloads reported by the source. Last updated 10/9/2026.","installCommand":"clawhub skill install s17f8q65zg3y98t86jdg1177g583whq8:smyx-child-bedtime-soothing-analysis","sourceUrl":"https://clawhub.ai/18072937735/smyx-child-bedtime-soothing-analysis","homepage":"https://clawhub.ai/18072937735/skills/smyx-child-bedtime-soothing-analysis","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/18072937735/smyx-child-bedtime-soothing-analysis","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/18072937735/skills/smyx-child-bedtime-soothing-analysis","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":65,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"Child Bedtime Soothing (Fear of Dark / Post-Nightmare) | 儿童睡前情绪安抚（怕黑/噩梦后） technical dossier on Xpersona with agent coverage, OPENCLEW support, and live trust me"},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-09T23:52:14.041Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-09T23:52:14.041Z","emptyReason":null},"stars":null,"forks":null,"downloads":1867,"packageName":null,"latestVersion":"1.0.13","tractionLabel":"1.9K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-09T23:52:14.041Z","emptyReason":null},"lastUpdatedAt":"2026-10-09T23:52:14.041Z","lastCrawledAt":"2026-10-09T23:52:14.041Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-10T23:52:14.041Z","lastVerifiedAt":null,"highlights":[{"version":"1.0.13","createdAt":"2026-09-28T17:09:31.725Z","changelog":"- Removed the file: skill-card.md - No other functional or content changes.","fileCount":31,"zipByteSize":44335},{"version":"1.0.12","createdAt":"2026-09-24T03:37:26.149Z","changelog":"- Updated version to 1.0.16 and revised SKILL.md content. - Improved and clarified documentation in SKILL.md, including workflow steps and capability details. - Removed the outdated skill-card.md file to streamline documentation. - Updated configuration in skills/smyx_common/scripts/config.yaml. - The skill's usage notes, capability lists, and resource indexing have been refined for clarity and completeness.","fileCount":31,"zipByteSize":44509},{"version":"1.0.11","createdAt":"2026-09-06T20:43:28.788Z","changelog":"- Version updated from 1.0.11 to 1.0.13. - Documentation refined in SKILL.md for improved clarity and detail. - Removed redundant skill-card.md file. - No functional changes to code or logic; update focuses on documentation maintenance.","fileCount":31,"zipByteSize":44638},{"version":"1.0.10","createdAt":"2026-08-24T16:38:34.635Z","changelog":"- Updated skill version to 1.0.11. - Removed the redundant skill-card.md documentation file. - SKILL.md updated only: no changes to logic or core functionality. - No changes to scripts, APIs, or user-facing features.","fileCount":31,"zipByteSize":44639},{"version":"1.0.9","createdAt":"2026-08-20T14:33:36.285Z","changelog":"- Removed sample documentation file: skill-card.md. - No changes to functionality or user-facing features. - Documentation cleanup only; all existing features remain unchanged.","fileCount":31,"zipByteSize":44481},{"version":"1.0.8","createdAt":"2026-08-15T02:57:44.699Z","changelog":"- Updated skill version to 1.0.10. - Improved configuration and documentation: SKILL.md updated with minor adjustments and version bump. - Removed redundant file: skill-card.md deleted. - No changes to core logic or features; update focused on documentation and file organization.","fileCount":31,"zipByteSize":44628},{"version":"1.0.7","createdAt":"2026-08-03T07:37:29.550Z","changelog":"Version 1.0.7 - Removed the file: skill-card.md. - No additional feature or code changes; maintenance update only. - All features and capabilities remain unchanged.","fileCount":31,"zipByteSize":44644},{"version":"1.0.6","createdAt":"2026-07-31T17:55:33.325Z","changelog":"- Updated version to 1.0.8 in SKILL.md. - Removed the redundant skill-card.md file. - No functional or behavioral logic changes to the skill were introduced.","fileCount":31,"zipByteSize":44753}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s17f8q65zg3y98t86jdg1177g583whq8:smyx-child-bedtime-soothing-analysis","setupComplexity":"low","setupSteps":["Install using `clawhub skill install s17f8q65zg3y98t86jdg1177g583whq8:smyx-child-bedtime-soothing-analysis` in an isolated environment before connecting it to live workloads.","No published capability contract is available yet, so validate auth and request/response behavior manually.","Review the upstream CLAWHUB listing at https://clawhub.ai/18072937735/smyx-child-bedtime-soothing-analysis before using production credentials."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-18072937735-smyx-child-bedtime-soothing-analysis/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-18072937735-smyx-child-bedtime-soothing-analysis/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-18072937735-smyx-child-bedtime-soothing-analysis/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-18072937735-smyx-child-bedtime-soothing-analysis/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-18072937735-smyx-child-bedtime-soothing-analysis/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-18072937735-smyx-child-bedtime-soothing-analysis/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-10T09:09:11.521Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-18072937735-smyx-child-bedtime-soothing-analysis/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-18072937735-smyx-child-bedtime-soothing-analysis/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-18072937735-smyx-child-bedtime-soothing-analysis/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-18072937735-smyx-child-bedtime-soothing-analysis/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-09T23:52:14.041Z","emptyReason":null},"readme":"Skill: Child Bedtime Soothing (Fear of Dark / Post-Nightmare) | 儿童睡前情绪安抚（怕黑/噩梦后）\n\nOwner: 18072937735\n\nSummary: Through a fixed camera (with infrared night vision) and microphone in the child's bedroom, the system analyzes pre-sleep and night-time video and audio to detect pre-sleep crying (continuous crying, calling 'Mama'), fear-of-the-dark expressions (curling up, looking around), and nightmare awakenings (sudden sitting up, trembling, screaming). | 通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。\n\nTags: latest:1.0.13\n\nVersion history:\n\nv1.0.13 | 2026-09-28T17:09:31.725Z | auto\n\n- Removed the file: skill-card.md\n- No other functional or content changes.\n\nv1.0.12 | 2026-09-24T03:37:26.149Z | auto\n\n- Updated version to 1.0.16 and revised SKILL.md content.\n- Improved and clarified documentation in SKILL.md, including workflow steps and capability details.\n- Removed the outdated skill-card.md file to streamline documentation.\n- Updated configuration in skills/smyx_common/scripts/config.yaml.\n- The skill's usage notes, capability lists, and resource indexing have been refined for clarity and completeness.\n\nv1.0.11 | 2026-09-06T20:43:28.788Z | auto\n\n- Version updated from 1.0.11 to 1.0.13.\n- Documentation refined in SKILL.md for improved clarity and detail.\n- Removed redundant skill-card.md file.\n- No functional changes to code or logic; update focuses on documentation maintenance.\n\nv1.0.10 | 2026-08-24T16:38:34.635Z | auto\n\n- Updated skill version to 1.0.11.\n- Removed the redundant skill-card.md documentation file.\n- SKILL.md updated only: no changes to logic or core functionality.\n- No changes to scripts, APIs, or user-facing features.\n\nv1.0.9 | 2026-08-20T14:33:36.285Z | auto\n\n- Removed sample documentation file: skill-card.md.\n- No changes to functionality or user-facing features.\n- Documentation cleanup only; all existing features remain unchanged.\n\nv1.0.8 | 2026-08-15T02:57:44.699Z | auto\n\n- Updated skill version to 1.0.10.\n- Improved configuration and documentation: SKILL.md updated with minor adjustments and version bump.\n- Removed redundant file: skill-card.md deleted.\n- No changes to core logic or features; update focused on documentation and file organization.\n\nv1.0.7 | 2026-08-03T07:37:29.550Z | auto\n\nVersion 1.0.7\n\n- Removed the file: skill-card.md.\n- No additional feature or code changes; maintenance update only.\n- All features and capabilities remain unchanged.\n\nv1.0.6 | 2026-07-31T17:55:33.325Z | auto\n\n- Updated version to 1.0.8 in SKILL.md.\n- Removed the redundant skill-card.md file.\n- No functional or behavioral logic changes to the skill were introduced.\n\nv1.0.5 | 2026-07-14T17:59:31.956Z | auto\n\nsmxy-child-bedtime-soothing-analysis v1.0.5\n\n- Updated SKILL.md to reflect minor version bump (1.0.5) and documentation adjustments.\n- Removed redundant documentation file skill-card.md.\n- General maintenance: no changes to user-facing APIs or application features.\n\nv1.0.4 | 2026-07-06T00:30:25.735Z | auto\n\nVersion 1.0.4 Changelog\n\n- No code or file changes detected in this version.\n- Documentation and usage instructions remain unchanged.\n\nv1.0.3 | 2026-07-03T20:30:28.228Z | auto\n\n**Version 1.0.3 – Major Upgrade: User privacy & workflow simplification; improved documentation and API constraints.**\n\n- Fully automated identity management: open-id now handled internally, never shown or required from users.\n- Major documentation overhaul: SKILL.md now more structured, concise, and user-oriented, with enhanced tables, usage notes, and standardized workflow.\n- Stricter historical report rules: All past analysis/history requests now exclusively query cloud API; local/manual memory fetch is strictly forbidden.\n- Removed references to user-visible ID prompts and clarified all prompts/workflows for compliance and simplicity.\n- File structure update: Cleaned up legacy documentation and scripts, reflecting new workflow and privacy principles.\n- Clarified behavior, safety, and regulatory constraints throughout user journey.\n\nv1.0.2 | 2026-06-21T18:12:27.914Z | auto\n\nsmyx-child-bedtime-soothing-analysis v1.0.2\n\n- Updated documentation and configuration in SKILL.md and config.yaml for improved clarity.\n- Removed the unused skill-card.md file.\n- Version bump to 1.0.2 for maintenance and minor structural clean-up.\n\nv1.0.1 | 2026-06-15T20:29:26.922Z | auto\n\n## smyx-child-bedtime-soothing-analysis 1.0.1 Changelog\n\n- Updated configuration file paths and documentation for open-id acquisition priority, placing the primary config at scripts/config.yaml.\n- Removed redundant or legacy documentation file (skill-card.md).\n- Minor adjustments to SKILL.md content, including a more concise description and the addition of license information.\n- Applied maintenance updates in multiple scripts and requirements to keep codebase organized.\n- No breaking changes to functionality; main operational flow and behavior are unchanged.\n\nv1.0.0 | 2026-05-27T16:41:02.695Z | auto\n\nInitial release: AI-powered child bedtime soothing analysis and automation system.\n\n- Analyzes night-time and pre-sleep video/audio from a fixed infrared camera and microphone to detect crying, fear of the dark, and nightmare awakenings.\n- Automatically triggers soothing actions (night light, mom’s recorded stories, gentle lullabies) based on detected unrest.\n- Provides multi-level, progressive soothing strategy with effect evaluation and action limit per night.\n- Supports infant/toddler/preschool/school child profiles; includes sensitive mode for infants.\n- Includes cloud-based historical report querying, strict open-id verification, and structured, privacy-conscious operation.\n\nArchive index:\n\nArchive v1.0.13: 31 files, 44335 bytes\n\nFiles: references/api_doc.md (7628b), scripts/__init__.py (73b), scripts/config.py (697b), scripts/config.yaml (3b), scripts/skill.py (595b), scripts/smyx_child_bedtime_soothing_analysis.py (3795b), skill-card.md (2199b), SKILL.md (15632b), skills/smyx_analysis/__init__.py (0b), skills/smyx_analysis/references/api_doc.md (427b), skills/smyx_analysis/requirements.txt (45b), skills/smyx_analysis/scripts/__init__.py (0b), skills/smyx_analysis/scripts/api_service.py (1509b), skills/smyx_analysis/scripts/config.py (1003b), skills/smyx_analysis/scripts/config.yaml (3b), skills/smyx_analysis/scripts/skill.py (6529b), skills/smyx_analysis/scripts/smyx_analysis.py (3833b), skills/smyx_common/__init__.py (0b), skills/smyx_common/requirements.txt (47b), skills/smyx_common/scripts/__init__.py (177b), skills/smyx_common/scripts/api_service.py (2645b), skills/smyx_common/scripts/base.py (469b), skills/smyx_common/scripts/config-dev.yaml (214b), skills/smyx_common/scripts/config-prod.yaml (0b), skills/smyx_common/scripts/config-test.yaml (256b), skills/smyx_common/scripts/config.py (24363b), skills/smyx_common/scripts/config.yaml (473b), skills/smyx_common/scripts/dao.py (18266b), skills/smyx_common/scripts/skill.py (2473b), skills/smyx_common/scripts/util.py (28776b), _meta.json (156b)\n\nFile v1.0.13:SKILL.md\n\n---\nname: \"smyx-child-bedtime-soothing-analysis\"\ndescription: \"Through a fixed camera (with infrared night vision) and microphone in the child's bedroom, the system analyzes pre-sleep and night-time video and audio to detect pre-sleep crying (continuous crying, calling 'Mama'), fear-of-the-dark expressions (curling up, looking around), and nightmare awakenings (sudden sitting up, trembling, screaming). | 通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。\"\nversion: \"1.0.16\"\nlicense: \"MIT-0\"\n---\n\n# 🌙 Child Bedtime Soothing (Fear of Dark / Post-Nightmare) | 儿童睡前情绪安抚（怕黑/噩梦后）\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **儿童睡前情绪安抚（怕黑/噩梦后）** |\n| 🎯 核心目标 | 通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_CHILD_BEDTIME_SOOTHING_ANALYSIS` |\n\nThrough a fixed camera (with infrared night vision) and microphone in the child's bedroom, the system analyzes pre-sleep and night-time video and audio to detect pre-sleep crying (continuous crying, calling 'Mama'), fear-of-the-dark expressions (curling up, looking around), and nightmare awakenings (sudden sitting up, trembling, screaming). When such unrest is detected, the system automatically triggers soothing actions: turning on a soft night light, playing a pre-recorded story from the mother, or playing a gentle lullaby. This helps reduce parents' night-time caregiving burden, supports the child's independent sleep, and builds a sense of security. Application scenarios: children's bedrooms, nurseries. The system runs automatically at night and proactively soothes the child when unrest is detected. Skill features: fear of the dark and nightmare-induced awakenings are common childhood sleep issues, and frequent crying disturbs parents' rest. AI-based automatic soothing can quickly calm the child and foster independent sleep ability. Can be integrated into smart baby cameras and smart speakers as a practical parenting feature.\n\n通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。该技能有助于减少父母夜间安抚负担，帮助儿童独立入睡，建立安全感。应用场景：儿童卧室、婴儿房。系统夜间自动运行，当检测到儿童不安时主动安抚。技能特点：儿童怕黑、噩梦惊醒是常见睡眠问题，频繁哭闹会干扰父母休息。通过AI自动安抚，可帮助儿童快速平静，培养独立入睡能力。该技能可集成到智能婴儿摄像头、智能音箱中，成为育儿家庭的实用功能。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的儿童睡眠安抚 AI。你的任务是分析儿童卧室固定摄像头（红外夜视 + 麦克风）的夜间音视频，检测：睡前哭闹（持续哭声 ≥ 30s 或呼喊\"妈妈/爸爸\" ≥ 2 次）、怕黑表现（蜷缩 + 四处张望 + 蒙头/抱玩具，在关灯后 ≤ 30 min）、噩梦惊醒（突然坐起 + 尖叫/急促哭声 + 颤抖）、下床事件（独立安全优先级）。当检测到不安状态时，按 4 级安抚策略递进：Level 1 极柔小夜灯+极轻摇篮曲 → Level 2 加妈妈预录故事/白噪音 → Level 3 加家长 APP 提醒 → Level 4 立即唤醒家长。婴儿（≤12 月）必须开专用模式，阈值更敏感、strong 及以上必须同步唤醒家长。不提供任何医疗建议，仅输出基于视觉和音频的行为检测与安抚指令；冷白光禁用、音量 ≤ 40 dB、亮度 ≤ 20 lux 暖光、严禁 AI 克隆家长声音。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于儿童卧室/婴儿房固定摄像头（**必须红外夜视 + 麦克风**）夜间音视频（**仅在睡眠窗口 19:00-07:00 启用**），识别 4 类场景（bedtime_unrest_mild / bedtime_unrest_crying / dark_fear / nightmare_wakeup / out_of_bed_safety / none）→ 音频核心 6 项（持续哭声时长 / 哭声强度 0-100 / \"妈妈爸爸\"呼喊 / 尖叫 / 呜咽抽噎 / 呼吸节奏规律性）+ 视频核心 7 项（蜷缩抱腿 / 四处张望 / **突然坐起** / 颤抖 / 抱毛绒玩具 / 拉被子蒙头 / **下床事件**）→ 4 档不安等级（mild / moderate / strong / out_of_bed）→ **4 级安抚策略递进**（小夜灯 ≤ 5/10/20 lux 暖光 + 摇篮曲/妈妈预录故事/白噪音 ≤ 35-40 dB + 家长 APP 推送 + 紧急唤醒）→ 3 分钟效果评估 + 自动升级 → 单晚动作上限管控（mild × 5 / moderate × 3 / strong × 2 / Level 4 不设上限）→ 次日清晨发送当晚汇总\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 红外夜视图像分析 |\n| 2 | 儿童蜷缩抱腿姿态识别 |\n| 3 | 四处张望识别 |\n| 4 | 突然坐起识别 |\n| 5 | 肢体颤抖识别 |\n| 6 | 抱毛绒玩具识别 |\n| 7 | 拉被子蒙头识别 |\n| 8 | 下床事件识别（独立安全优先级） |\n| 9 | 儿童哭声强度评估 |\n| 10 | \"妈妈爸爸\"呼喊声纹识别 |\n| 11 | 尖叫识别 |\n| 12 | 呜咽抽噎识别 |\n| 13 | 呼吸节奏规律性评估（睡熟 vs 醒着） |\n| 14 | 年龄段自适应（infant ≤12m / toddler 1-3y / preschool 3-6y / school 6-12y） |\n| 15 | 婴儿专用模式（阈值更敏感+安抚更轻柔+strong 及以上必须同步唤醒家长） |\n| 16 | 小夜灯智能调光（≤ 20 lux 暖光 2700K） |\n| 17 | 安抚音量智能控制（≤ 40 dB） |\n| 18 | 4 级安抚策略递进 + 3 分钟效果评估 + 自动升级 |\n| 19 | 单晚动作上限管控 |\n| 20 | 当晚汇总报告**仅次日清晨发送** |\n| 21 | 当夜 ≥ 3 次或连续 7 晚反复 → 提示当地儿科睡眠门诊/儿童心理门诊 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供儿童卧室/婴儿房固定摄像头（红外夜视+麦克风）夜间音视频 URL 或文件需要分析时，默认触发本技能进行儿童睡前情绪安抚（怕黑/噩梦后） |\n| 🔎 明确分析意图 | 当用户明确提及孩子睡前哭闹、宝宝怕黑、噩梦惊醒、夜惊、小夜灯、摇篮曲、妈妈预录故事、宝宝独立入睡等关键词，并且上传了音视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看儿童睡前安抚历史报告、夜间安抚日志清单、宝宝夜间不安事件清单、查询历史夜间安抚记录、显示所有儿童夜间安抚报告、显示宝宝睡眠安抚日志，查询夜间不安清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_child_bedtime_soothing_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_child_bedtime_soothing_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备儿童卧室/婴儿房固定摄像头（红外夜视+麦克风）夜间音视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 获取 open-id（强制执行） | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行儿童睡前情绪安抚（怕黑/噩梦后） | 调用 `-m scripts.smyx_child_bedtime_soothing_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地儿童卧室/婴儿房固定摄像头（红外夜视+麦克风）夜间音视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络儿童卧室/婴儿房固定摄像头夜间音视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，儿童睡眠安抚场景默认 `other` | 按需填写 |\n| `--list` | 显示儿童睡前情绪安抚（怕黑/噩梦后）历史安抚记录清单 | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_child_bedtime_soothing_analysis.py`](scripts/smyx_child_bedtime_soothing_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 输入要求：支持 mp4/avi/mov + 音轨，最大 10MB；**关键**：必须红外夜视 + 麦克风；仅睡眠窗口启用 |\n| 🔎 使用提醒 | **4 级安抚策略递进**（mild → moderate → strong → out_of_bed/Level 4），3 分钟未平复自动升级 |\n| 🔎 使用提醒 | 单晚动作上限：mild × 5 / moderate × 3 / strong × 2 / Level 4 不设上限（安全优先） |\n| 🔎 使用提醒 | 红线约束 |\n| 🧑‍⚖️ 结果性质 | **禁止**对儿童做\"睡眠障碍 / 夜惊症 / 焦虑症\"等医学诊断 |\n| 🔎 使用提醒 | **禁止**长期存储儿童夜间视频（≤ 7 天，仅入库不安事件片段） |\n| 🔎 使用提醒 | **禁止**用于商业广告/AI 训练；禁第三方共享 |\n| 🔎 使用提醒 | **禁止**冷白光（≥ 4000K）或亮度 > 30 lux 的小夜灯（打断褪黑素） |\n| 🔎 使用提醒 | **禁止**安抚音量 > 40 dB |\n| 🔎 使用提醒 | **绝对禁止**使用 AI 克隆/合成妈妈/爸爸声音冒充家长录音 |\n| 🔎 使用提醒 | **禁止**对 out_of_bed 仅做语音安抚——**必须立即推送家长 APP** |\n| 🔎 使用提醒 | **必须**：婴儿（≤ 12 月）开专用模式，strong 及以上必须同步唤醒家长；噩梦惊醒首条安抚必须是家长本人预录稳定语音 |\n| 📜 报告输出 | **必须**：当晚汇总报告**仅次日清晨发送**（避免家长夜里被唤醒焦虑加深） |\n| 🔎 使用提醒 | 当夜噩梦惊醒 ≥ 3 次或连续 7 晚反复 → 提示**当地儿科睡眠门诊**或**儿童心理门诊**资源 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史安抚记录清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地儿童夜间音视频\npython -m scripts.smyx_child_bedtime_soothing_analysis --input /path/to/bedroom.mp4\n\n# 分析网络儿童夜间音视频/实时流\npython -m scripts.smyx_child_bedtime_soothing_analysis --url https://example.com/bedroom.mp4\n\n# 显示历史夜间安抚记录清单（自动触发关键词：查看儿童睡前安抚历史报告、夜间安抚日志清单等）\npython -m scripts.smyx_child_bedtime_soothing_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_child_bedtime_soothing_analysis --input br.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_child_bedtime_soothing_analysis --input br.mp4 --output result.json\n```\n\nFile v1.0.13:_meta.json\n\n{\n  \"ownerId\": \"kn7e2caqj7pnsvr9r7t8zenghs83xw7n\",\n  \"slug\": \"smyx-child-bedtime-soothing-analysis\",\n  \"version\": \"1.0.13\",\n  \"publishedAt\": 1790615371725\n}\n\nFile v1.0.13:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放儿童睡前情绪安抚（怕黑/噩梦后） API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动儿童睡前情绪安抚检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取不安事件 + 安抚动作清单\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史安抚记录清单\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出夜间安抚日志报告\n5. （可选）`/web/companion/v2/trigger-soothing-action` - 触发联动安抚动作（小夜灯 / 智能音箱故事 / 摇篮曲 / 家长 APP 推送）\n\n## 场景代码\n\n- `SMYX_CHILD_BEDTIME_SOOTHING_ANALYSIS` - 儿童睡前情绪安抚（怕黑/噩梦后）\n\n## 输入约束\n\n- 摄像头：儿童卧室 / 婴儿房固定摄像头，**必须支持红外夜视**，能看到床上区域\n- 帧率 ≥ 10 FPS；分辨率 ≥ 720p；红外波段建议 850 nm（对睡眠干扰小）\n- 音频**必需**：采样率 ≥ 16kHz（用于哭声 / \"妈妈\" 呼喊 / 尖叫识别）\n- 时段：仅在配置的**睡眠窗口**内启用（默认 19:00 - 07:00），白天自动暂停\n- 多孩家庭按目标跟踪绑定到注册儿童 ID（每个孩子独立基线）\n- 婴儿（≤ 12 月）必须额外开启**婴儿专用模式**：阈值更敏感、安抚动作更轻柔、必要时同步唤醒家长\n- 家长必须授权部署，并明确告知家庭其他成员（如保姆、外祖父母）\n\n## 关键观测信号\n\n### 音频（核心）\n- `crying_continuous_sec` - 持续哭声时长\n- `crying_intensity` - 哭声强度（0-100，结合分贝 + 频谱情绪）\n- `call_mom_dad_count` - 呼喊\"妈妈/爸爸/妈咪\"次数\n- `scream_event_count` - 尖叫事件次数（突发高频高强度声）\n- `whimper_event_count` - 呜咽 / 抽噎事件（轻度不安信号）\n- `sleep_breathing_regular` - 呼吸节奏规律性（参考指标，区分睡熟 vs 醒着）\n\n### 视频（核心）\n- `body_curl_up_detected` - 蜷缩抱腿姿态（怕黑典型表现）\n- `looking_around_event_count` - 四处张望次数（黑暗中睁眼搜索）\n- `sudden_sit_up_event` - 突然坐起事件（噩梦惊醒典型）\n- `trembling_visual_detected` - 肢体颤抖（恐惧伴随）\n- `hugging_plush_toy` - 主动抱毛绒玩具（自我安抚行为，参考）\n- `pull_cover_over_head` - 拉被子蒙头（怕黑参考）\n- `out_of_bed_event` - 下床事件（独立优先级，避免摔伤）\n\n### 上下文\n- `is_within_sleep_window` - 是否在睡眠窗口内\n- `time_since_last_soothing_min` - 距离上次安抚动作的时间\n\n## 场景判定与不安等级\n\n- **bedtime_unrest_mild** - 睡前不安（轻度）：呜咽 / 抱毛绒玩具 / 蜷缩，无哭喊\n- **bedtime_unrest_crying** - 睡前哭闹：持续哭声 ≥ 30 秒 或 呼喊\"妈妈/爸爸\" ≥ 2 次\n- **dark_fear** - 怕黑：蜷缩 + 四处张望 + 蒙头/抱玩具 任两项 + 在卧室关灯后 ≤ 30 分钟内\n- **nightmare_wakeup** - 噩梦惊醒：突然坐起 + 尖叫/急促哭声 + 颤抖 任两项\n- **out_of_bed_safety** - 下床（独立优先级）：触发家长 APP 推送 + 调亮小夜灯，避免摔伤\n- **none** - 无不安信号 / 在睡熟状态\n\n## 安抚动作策略（轻 → 重逐级递进）\n\n- **Level 1（mild）**：极柔小夜灯（≤ 5 lux 暖光）+ 极轻摇篮曲（≤ 35 dB）\n- **Level 2（moderate）**：小夜灯（≤ 10 lux 暖光）+ **妈妈预录故事** / 白噪音\n- **Level 3（strong：noctmare/scream）**：小夜灯（≤ 20 lux）+ 妈妈预录\"宝贝，妈妈在这里，做了梦对吗？没事了哦~\"语音 + **同时推送家长 APP** \"noctmare 提醒，建议过去陪伴\"\n- **Level 4（out_of_bed/persist ≥ 5min）**：**立即推送家长 APP + 主屏震动**，建议家长亲自到场，AI 仅辅助\n\n- 升级条件：同一信号在 Level 1/2 安抚后 ≥ 3 分钟未平复 → 自动升级一级\n- 单晚同一儿童安抚动作触发**上限**：mild × 5、moderate × 3、strong × 2、Level 4 不设上限（安全优先）\n\n## 输出字段（参考）\n\n- `event_id` / `event_timestamp` / `child_id` / `child_age_band`（infant ≤12m / toddler 1-3y / preschool 3-6y / school 6-12y）\n- `scene_label` - 场景判定（bedtime_unrest_mild / bedtime_unrest_crying / dark_fear / nightmare_wakeup / out_of_bed_safety / none）\n- `audio_signals` / `video_signals` / `context`\n- `unrest_level` - 不安等级（mild / moderate / strong / out_of_bed）\n- `soothing_actions` - 安抚动作列表（每项含 action_type / message / target / level / volume_db / brightness_lux，例如：\n    - `{action_type: \"night_light_on\", brightness_lux: 5, color_temp: \"warm_2700K\", target: \"child_room_light\", level: 1}`\n    - `{action_type: \"play_mom_recorded_story\", message: \"妈妈预录《晚安月亮》故事 5 分钟\", volume_db: 35, target: \"child_room_speaker\", level: 2}`\n    - `{action_type: \"play_lullaby\", message: \"《摇啊摇》摇篮曲\", volume_db: 30, target: \"child_room_speaker\", level: 2}`\n    - `{action_type: \"play_white_noise\", message: \"白噪音雨声\", volume_db: 30, target: \"child_room_speaker\", level: 2}`\n    - `{action_type: \"parent_app_push\", message: \"孩子刚被噩梦惊醒，已轻声安抚中，建议过去陪伴\", target: \"parent_phone_app\", level: 3}`\n    - `{action_type: \"parent_app_urgent_push\", message: \"⚠️ 孩子已下床，请立即查看\", target: \"parent_phone_app\", level: 4}`）\n- `effectiveness_after_3min` - 3 分钟后效果（settled / partially_settled / unchanged / escalated）\n- `nightly_summary` - 当晚汇总（次日清晨自动生成：不安事件次数 + 类型分布 + 安抚成功率 + 建议）\n- `recommend_action` - 建议动作（trigger_level_N_soothing / push_parent_app / urgent_parent_intervention / observe_only）\n\n## 强制约束与红线\n\n- ❌ **禁止**对儿童做任何\"睡眠障碍 / 夜惊症 / 焦虑症\"等医学诊断\n- ❌ **禁止**长期存储儿童夜间视频；建议仅保留 ≤ 7 天 + 仅入库不安事件片段\n- ❌ **禁止**将儿童夜间视频/音频用于商业广告、AI 训练数据集\n- ❌ **禁止**向家长以外的第三方共享（亲戚需家长授权才能查看）\n- ❌ **禁止**夜间使用冷白光（≥ 4000K）或亮度 > 30 lux 的小夜灯，会打断褪黑素分泌\n- ❌ **禁止**安抚音量超过 40 dB（接近耳语水平），避免影响睡眠或惊醒孩子\n- ❌ **禁止**使用 AI 克隆/合成妈妈/爸爸声音冒充家长录音；预录语音**必须由家长本人录制**\n- ❌ **禁止**对 **out_of_bed** 事件仅做\"语音安抚\"——必须立即推送家长 APP（避免摔伤）\n- ✅ **必须**婴儿（≤ 12 月）开启专用模式：阈值更敏感 + 安抚更轻柔 + **strong 及以上必须同步唤醒家长**\n- ✅ **必须**为家长提供：一键暂停今晚 / 调整睡眠窗口 / 永久退出 入口\n- ✅ **必须**：噩梦惊醒后**首条安抚语**应为家长本人预录的稳定语音（不用合成音）\n- ✅ 当夜噩梦惊醒 ≥ 3 次或连续 7 晚反复发生 → 提示家长**当地儿童心理门诊**或**儿科睡眠门诊**资源\n- ✅ 当晚汇总报告必须**只在次日清晨**发送（避免家长夜里被唤醒焦虑加深）\n\n> 仅输出基于音视频的客观不安事件检测与轻柔安抚动作，**不构成任何儿童睡眠/心理医学诊断**；频繁夜惊或长期睡眠困难请咨询当地**儿科睡眠门诊**或**儿童心理科**专业医师。\n\nFile v1.0.13:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.13:scripts/config.yaml\n\n{}\n\nFile v1.0.13:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.13:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.13:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.13:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: prod\n\nFile v1.0.13:skill-card.md\n\n## Description:\n\nAnalyzes child bedroom audio and video for bedtime distress and nightmare awakenings, then provides soothing actions, parent alerts, and reports.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[18072937735](https://clawhub.ai/user/18072937735)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nGuardians and developers of child sleep-monitoring tools use this skill to identify nighttime distress, suggest or trigger staged soothing, notify parents when needed, and review incident reports.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Sensitive child bedroom audio and video or media URLs may be sent to Life Emergence cloud services.\n\nMitigation: Obtain explicit guardian consent; document access, retention and deletion rules, and provide pause and disable controls.\n\nRisk: The service may silently create or reuse identities, persist tokens locally, and retain cloud history reports.\n\nMitigation: Disclose identity and report handling; provide account revocation and restrict report and notification access to authorized guardians.\n\nRisk: Automated soothing or event detection may miss urgent distress or prompt inappropriate responses.\n\nMitigation: Require guardian oversight, promptly alert guardians for out-of-bed or high-severity events, and avoid using outputs as medical diagnoses.\n\n## Reference(s):\n\n- [Skill API documentation](references/api_doc.md)\n\n## Skill Output:\n\n**Output Type(s):** [Analysis, Guidance, Markdown, JSON]\n\n**Output Format:** [Text or JSON reports with event classifications, soothing actions, parent alerts, and report links]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Supports basic, standard, and JSON detail levels and optional file output or historical report listings.]\n\n## Skill Version(s):\n\n1.0.13 (source: server-resolved ClawHub release metadata; bundled frontmatter states 1.0.16)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.13:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.13:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.12: 31 files, 44509 bytes\n\nFiles: references/api_doc.md (7628b), scripts/__init__.py (73b), scripts/config.py (697b), scripts/config.yaml (3b), scripts/skill.py (595b), scripts/smyx_child_bedtime_soothing_analysis.py (3795b), skill-card.md (2544b), SKILL.md (15632b), skills/smyx_analysis/__init__.py (0b), skills/smyx_analysis/references/api_doc.md (427b), skills/smyx_analysis/requirements.txt (45b), skills/smyx_analysis/scripts/__init__.py (0b), skills/smyx_analysis/scripts/api_service.py (1509b), skills/smyx_analysis/scripts/config.py (1003b), skills/smyx_analysis/scripts/config.yaml (3b), skills/smyx_analysis/scripts/skill.py (6529b), skills/smyx_analysis/scripts/smyx_analysis.py (3833b), skills/smyx_common/__init__.py (0b), skills/smyx_common/requirements.txt (47b), skills/smyx_common/scripts/__init__.py (177b), skills/smyx_common/scripts/api_service.py (2645b), skills/smyx_common/scripts/base.py (469b), skills/smyx_common/scripts/config-dev.yaml (214b), skills/smyx_common/scripts/config-prod.yaml (0b), skills/smyx_common/scripts/config-test.yaml (256b), skills/smyx_common/scripts/config.py (24363b), skills/smyx_common/scripts/config.yaml (473b), skills/smyx_common/scripts/dao.py (18266b), skills/smyx_common/scripts/skill.py (2473b), skills/smyx_common/scripts/util.py (28776b), _meta.json (156b)\n\nFile v1.0.12:SKILL.md\n\n---\nname: \"smyx-child-bedtime-soothing-analysis\"\ndescription: \"Through a fixed camera (with infrared night vision) and microphone in the child's bedroom, the system analyzes pre-sleep and night-time video and audio to detect pre-sleep crying (continuous crying, calling 'Mama'), fear-of-the-dark expressions (curling up, looking around), and nightmare awakenings (sudden sitting up, trembling, screaming). | 通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。\"\nversion: \"1.0.16\"\nlicense: \"MIT-0\"\n---\n\n# 🌙 Child Bedtime Soothing (Fear of Dark / Post-Nightmare) | 儿童睡前情绪安抚（怕黑/噩梦后）\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **儿童睡前情绪安抚（怕黑/噩梦后）** |\n| 🎯 核心目标 | 通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_CHILD_BEDTIME_SOOTHING_ANALYSIS` |\n\nThrough a fixed camera (with infrared night vision) and microphone in the child's bedroom, the system analyzes pre-sleep and night-time video and audio to detect pre-sleep crying (continuous crying, calling 'Mama'), fear-of-the-dark expressions (curling up, looking around), and nightmare awakenings (sudden sitting up, trembling, screaming). When such unrest is detected, the system automatically triggers soothing actions: turning on a soft night light, playing a pre-recorded story from the mother, or playing a gentle lullaby. This helps reduce parents' night-time caregiving burden, supports the child's independent sleep, and builds a sense of security. Application scenarios: children's bedrooms, nurseries. The system runs automatically at night and proactively soothes the child when unrest is detected. Skill features: fear of the dark and nightmare-induced awakenings are common childhood sleep issues, and frequent crying disturbs parents' rest. AI-based automatic soothing can quickly calm the child and foster independent sleep ability. Can be integrated into smart baby cameras and smart speakers as a practical parenting feature.\n\n通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。该技能有助于减少父母夜间安抚负担，帮助儿童独立入睡，建立安全感。应用场景：儿童卧室、婴儿房。系统夜间自动运行，当检测到儿童不安时主动安抚。技能特点：儿童怕黑、噩梦惊醒是常见睡眠问题，频繁哭闹会干扰父母休息。通过AI自动安抚，可帮助儿童快速平静，培养独立入睡能力。该技能可集成到智能婴儿摄像头、智能音箱中，成为育儿家庭的实用功能。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的儿童睡眠安抚 AI。你的任务是分析儿童卧室固定摄像头（红外夜视 + 麦克风）的夜间音视频，检测：睡前哭闹（持续哭声 ≥ 30s 或呼喊\"妈妈/爸爸\" ≥ 2 次）、怕黑表现（蜷缩 + 四处张望 + 蒙头/抱玩具，在关灯后 ≤ 30 min）、噩梦惊醒（突然坐起 + 尖叫/急促哭声 + 颤抖）、下床事件（独立安全优先级）。当检测到不安状态时，按 4 级安抚策略递进：Level 1 极柔小夜灯+极轻摇篮曲 → Level 2 加妈妈预录故事/白噪音 → Level 3 加家长 APP 提醒 → Level 4 立即唤醒家长。婴儿（≤12 月）必须开专用模式，阈值更敏感、strong 及以上必须同步唤醒家长。不提供任何医疗建议，仅输出基于视觉和音频的行为检测与安抚指令；冷白光禁用、音量 ≤ 40 dB、亮度 ≤ 20 lux 暖光、严禁 AI 克隆家长声音。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于儿童卧室/婴儿房固定摄像头（**必须红外夜视 + 麦克风**）夜间音视频（**仅在睡眠窗口 19:00-07:00 启用**），识别 4 类场景（bedtime_unrest_mild / bedtime_unrest_crying / dark_fear / nightmare_wakeup / out_of_bed_safety / none）→ 音频核心 6 项（持续哭声时长 / 哭声强度 0-100 / \"妈妈爸爸\"呼喊 / 尖叫 / 呜咽抽噎 / 呼吸节奏规律性）+ 视频核心 7 项（蜷缩抱腿 / 四处张望 / **突然坐起** / 颤抖 / 抱毛绒玩具 / 拉被子蒙头 / **下床事件**）→ 4 档不安等级（mild / moderate / strong / out_of_bed）→ **4 级安抚策略递进**（小夜灯 ≤ 5/10/20 lux 暖光 + 摇篮曲/妈妈预录故事/白噪音 ≤ 35-40 dB + 家长 APP 推送 + 紧急唤醒）→ 3 分钟效果评估 + 自动升级 → 单晚动作上限管控（mild × 5 / moderate × 3 / strong × 2 / Level 4 不设上限）→ 次日清晨发送当晚汇总\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 红外夜视图像分析 |\n| 2 | 儿童蜷缩抱腿姿态识别 |\n| 3 | 四处张望识别 |\n| 4 | 突然坐起识别 |\n| 5 | 肢体颤抖识别 |\n| 6 | 抱毛绒玩具识别 |\n| 7 | 拉被子蒙头识别 |\n| 8 | 下床事件识别（独立安全优先级） |\n| 9 | 儿童哭声强度评估 |\n| 10 | \"妈妈爸爸\"呼喊声纹识别 |\n| 11 | 尖叫识别 |\n| 12 | 呜咽抽噎识别 |\n| 13 | 呼吸节奏规律性评估（睡熟 vs 醒着） |\n| 14 | 年龄段自适应（infant ≤12m / toddler 1-3y / preschool 3-6y / school 6-12y） |\n| 15 | 婴儿专用模式（阈值更敏感+安抚更轻柔+strong 及以上必须同步唤醒家长） |\n| 16 | 小夜灯智能调光（≤ 20 lux 暖光 2700K） |\n| 17 | 安抚音量智能控制（≤ 40 dB） |\n| 18 | 4 级安抚策略递进 + 3 分钟效果评估 + 自动升级 |\n| 19 | 单晚动作上限管控 |\n| 20 | 当晚汇总报告**仅次日清晨发送** |\n| 21 | 当夜 ≥ 3 次或连续 7 晚反复 → 提示当地儿科睡眠门诊/儿童心理门诊 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供儿童卧室/婴儿房固定摄像头（红外夜视+麦克风）夜间音视频 URL 或文件需要分析时，默认触发本技能进行儿童睡前情绪安抚（怕黑/噩梦后） |\n| 🔎 明确分析意图 | 当用户明确提及孩子睡前哭闹、宝宝怕黑、噩梦惊醒、夜惊、小夜灯、摇篮曲、妈妈预录故事、宝宝独立入睡等关键词，并且上传了音视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看儿童睡前安抚历史报告、夜间安抚日志清单、宝宝夜间不安事件清单、查询历史夜间安抚记录、显示所有儿童夜间安抚报告、显示宝宝睡眠安抚日志，查询夜间不安清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_child_bedtime_soothing_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_child_bedtime_soothing_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备儿童卧室/婴儿房固定摄像头（红外夜视+麦克风）夜间音视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 获取 open-id（强制执行） | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行儿童睡前情绪安抚（怕黑/噩梦后） | 调用 `-m scripts.smyx_child_bedtime_soothing_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地儿童卧室/婴儿房固定摄像头（红外夜视+麦克风）夜间音视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络儿童卧室/婴儿房固定摄像头夜间音视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，儿童睡眠安抚场景默认 `other` | 按需填写 |\n| `--list` | 显示儿童睡前情绪安抚（怕黑/噩梦后）历史安抚记录清单 | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_child_bedtime_soothing_analysis.py`](scripts/smyx_child_bedtime_soothing_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 输入要求：支持 mp4/avi/mov + 音轨，最大 10MB；**关键**：必须红外夜视 + 麦克风；仅睡眠窗口启用 |\n| 🔎 使用提醒 | **4 级安抚策略递进**（mild → moderate → strong → out_of_bed/Level 4），3 分钟未平复自动升级 |\n| 🔎 使用提醒 | 单晚动作上限：mild × 5 / moderate × 3 / strong × 2 / Level 4 不设上限（安全优先） |\n| 🔎 使用提醒 | 红线约束 |\n| 🧑‍⚖️ 结果性质 | **禁止**对儿童做\"睡眠障碍 / 夜惊症 / 焦虑症\"等医学诊断 |\n| 🔎 使用提醒 | **禁止**长期存储儿童夜间视频（≤ 7 天，仅入库不安事件片段） |\n| 🔎 使用提醒 | **禁止**用于商业广告/AI 训练；禁第三方共享 |\n| 🔎 使用提醒 | **禁止**冷白光（≥ 4000K）或亮度 > 30 lux 的小夜灯（打断褪黑素） |\n| 🔎 使用提醒 | **禁止**安抚音量 > 40 dB |\n| 🔎 使用提醒 | **绝对禁止**使用 AI 克隆/合成妈妈/爸爸声音冒充家长录音 |\n| 🔎 使用提醒 | **禁止**对 out_of_bed 仅做语音安抚——**必须立即推送家长 APP** |\n| 🔎 使用提醒 | **必须**：婴儿（≤ 12 月）开专用模式，strong 及以上必须同步唤醒家长；噩梦惊醒首条安抚必须是家长本人预录稳定语音 |\n| 📜 报告输出 | **必须**：当晚汇总报告**仅次日清晨发送**（避免家长夜里被唤醒焦虑加深） |\n| 🔎 使用提醒 | 当夜噩梦惊醒 ≥ 3 次或连续 7 晚反复 → 提示**当地儿科睡眠门诊**或**儿童心理门诊**资源 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史安抚记录清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地儿童夜间音视频\npython -m scripts.smyx_child_bedtime_soothing_analysis --input /path/to/bedroom.mp4\n\n# 分析网络儿童夜间音视频/实时流\npython -m scripts.smyx_child_bedtime_soothing_analysis --url https://example.com/bedroom.mp4\n\n# 显示历史夜间安抚记录清单（自动触发关键词：查看儿童睡前安抚历史报告、夜间安抚日志清单等）\npython -m scripts.smyx_child_bedtime_soothing_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_child_bedtime_soothing_analysis --input br.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_child_bedtime_soothing_analysis --input br.mp4 --output result.json\n```\n\nFile v1.0.12:_meta.json\n\n{\n  \"ownerId\": \"kn7e2caqj7pnsvr9r7t8zenghs83xw7n\",\n  \"slug\": \"smyx-child-bedtime-soothing-analysis\",\n  \"version\": \"1.0.12\",\n  \"publishedAt\": 1790221046149\n}\n\nFile v1.0.12:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放儿童睡前情绪安抚（怕黑/噩梦后） API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动儿童睡前情绪安抚检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取不安事件 + 安抚动作清单\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史安抚记录清单\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出夜间安抚日志报告\n5. （可选）`/web/companion/v2/trigger-soothing-action` - 触发联动安抚动作（小夜灯 / 智能音箱故事 / 摇篮曲 / 家长 APP 推送）\n\n## 场景代码\n\n- `SMYX_CHILD_BEDTIME_SOOTHING_ANALYSIS` - 儿童睡前情绪安抚（怕黑/噩梦后）\n\n## 输入约束\n\n- 摄像头：儿童卧室 / 婴儿房固定摄像头，**必须支持红外夜视**，能看到床上区域\n- 帧率 ≥ 10 FPS；分辨率 ≥ 720p；红外波段建议 850 nm（对睡眠干扰小）\n- 音频**必需**：采样率 ≥ 16kHz（用于哭声 / \"妈妈\" 呼喊 / 尖叫识别）\n- 时段：仅在配置的**睡眠窗口**内启用（默认 19:00 - 07:00），白天自动暂停\n- 多孩家庭按目标跟踪绑定到注册儿童 ID（每个孩子独立基线）\n- 婴儿（≤ 12 月）必须额外开启**婴儿专用模式**：阈值更敏感、安抚动作更轻柔、必要时同步唤醒家长\n- 家长必须授权部署，并明确告知家庭其他成员（如保姆、外祖父母）\n\n## 关键观测信号\n\n### 音频（核心）\n- `crying_continuous_sec` - 持续哭声时长\n- `crying_intensity` - 哭声强度（0-100，结合分贝 + 频谱情绪）\n- `call_mom_dad_count` - 呼喊\"妈妈/爸爸/妈咪\"次数\n- `scream_event_count` - 尖叫事件次数（突发高频高强度声）\n- `whimper_event_count` - 呜咽 / 抽噎事件（轻度不安信号）\n- `sleep_breathing_regular` - 呼吸节奏规律性（参考指标，区分睡熟 vs 醒着）\n\n### 视频（核心）\n- `body_curl_up_detected` - 蜷缩抱腿姿态（怕黑典型表现）\n- `looking_around_event_count` - 四处张望次数（黑暗中睁眼搜索）\n- `sudden_sit_up_event` - 突然坐起事件（噩梦惊醒典型）\n- `trembling_visual_detected` - 肢体颤抖（恐惧伴随）\n- `hugging_plush_toy` - 主动抱毛绒玩具（自我安抚行为，参考）\n- `pull_cover_over_head` - 拉被子蒙头（怕黑参考）\n- `out_of_bed_event` - 下床事件（独立优先级，避免摔伤）\n\n### 上下文\n- `is_within_sleep_window` - 是否在睡眠窗口内\n- `time_since_last_soothing_min` - 距离上次安抚动作的时间\n\n## 场景判定与不安等级\n\n- **bedtime_unrest_mild** - 睡前不安（轻度）：呜咽 / 抱毛绒玩具 / 蜷缩，无哭喊\n- **bedtime_unrest_crying** - 睡前哭闹：持续哭声 ≥ 30 秒 或 呼喊\"妈妈/爸爸\" ≥ 2 次\n- **dark_fear** - 怕黑：蜷缩 + 四处张望 + 蒙头/抱玩具 任两项 + 在卧室关灯后 ≤ 30 分钟内\n- **nightmare_wakeup** - 噩梦惊醒：突然坐起 + 尖叫/急促哭声 + 颤抖 任两项\n- **out_of_bed_safety** - 下床（独立优先级）：触发家长 APP 推送 + 调亮小夜灯，避免摔伤\n- **none** - 无不安信号 / 在睡熟状态\n\n## 安抚动作策略（轻 → 重逐级递进）\n\n- **Level 1（mild）**：极柔小夜灯（≤ 5 lux 暖光）+ 极轻摇篮曲（≤ 35 dB）\n- **Level 2（moderate）**：小夜灯（≤ 10 lux 暖光）+ **妈妈预录故事** / 白噪音\n- **Level 3（strong：noctmare/scream）**：小夜灯（≤ 20 lux）+ 妈妈预录\"宝贝，妈妈在这里，做了梦对吗？没事了哦~\"语音 + **同时推送家长 APP** \"noctmare 提醒，建议过去陪伴\"\n- **Level 4（out_of_bed/persist ≥ 5min）**：**立即推送家长 APP + 主屏震动**，建议家长亲自到场，AI 仅辅助\n\n- 升级条件：同一信号在 Level 1/2 安抚后 ≥ 3 分钟未平复 → 自动升级一级\n- 单晚同一儿童安抚动作触发**上限**：mild × 5、moderate × 3、strong × 2、Level 4 不设上限（安全优先）\n\n## 输出字段（参考）\n\n- `event_id` / `event_timestamp` / `child_id` / `child_age_band`（infant ≤12m / toddler 1-3y / preschool 3-6y / school 6-12y）\n- `scene_label` - 场景判定（bedtime_unrest_mild / bedtime_unrest_crying / dark_fear / nightmare_wakeup / out_of_bed_safety / none）\n- `audio_signals` / `video_signals` / `context`\n- `unrest_level` - 不安等级（mild / moderate / strong / out_of_bed）\n- `soothing_actions` - 安抚动作列表（每项含 action_type / message / target / level / volume_db / brightness_lux，例如：\n    - `{action_type: \"night_light_on\", brightness_lux: 5, color_temp: \"warm_2700K\", target: \"child_room_light\", level: 1}`\n    - `{action_type: \"play_mom_recorded_story\", message: \"妈妈预录《晚安月亮》故事 5 分钟\", volume_db: 35, target: \"child_room_speaker\", level: 2}`\n    - `{action_type: \"play_lullaby\", message: \"《摇啊摇》摇篮曲\", volume_db: 30, target: \"child_room_speaker\", level: 2}`\n    - `{action_type: \"play_white_noise\", message: \"白噪音雨声\", volume_db: 30, target: \"child_room_speaker\", level: 2}`\n    - `{action_type: \"parent_app_push\", message: \"孩子刚被噩梦惊醒，已轻声安抚中，建议过去陪伴\", target: \"parent_phone_app\", level: 3}`\n    - `{action_type: \"parent_app_urgent_push\", message: \"⚠️ 孩子已下床，请立即查看\", target: \"parent_phone_app\", level: 4}`）\n- `effectiveness_after_3min` - 3 分钟后效果（settled / partially_settled / unchanged / escalated）\n- `nightly_summary` - 当晚汇总（次日清晨自动生成：不安事件次数 + 类型分布 + 安抚成功率 + 建议）\n- `recommend_action` - 建议动作（trigger_level_N_soothing / push_parent_app / urgent_parent_intervention / observe_only）\n\n## 强制约束与红线\n\n- ❌ **禁止**对儿童做任何\"睡眠障碍 / 夜惊症 / 焦虑症\"等医学诊断\n- ❌ **禁止**长期存储儿童夜间视频；建议仅保留 ≤ 7 天 + 仅入库不安事件片段\n- ❌ **禁止**将儿童夜间视频/音频用于商业广告、AI 训练数据集\n- ❌ **禁止**向家长以外的第三方共享（亲戚需家长授权才能查看）\n- ❌ **禁止**夜间使用冷白光（≥ 4000K）或亮度 > 30 lux 的小夜灯，会打断褪黑素分泌\n- ❌ **禁止**安抚音量超过 40 dB（接近耳语水平），避免影响睡眠或惊醒孩子\n- ❌ **禁止**使用 AI 克隆/合成妈妈/爸爸声音冒充家长录音；预录语音**必须由家长本人录制**\n- ❌ **禁止**对 **out_of_bed** 事件仅做\"语音安抚\"——必须立即推送家长 APP（避免摔伤）\n- ✅ **必须**婴儿（≤ 12 月）开启专用模式：阈值更敏感 + 安抚更轻柔 + **strong 及以上必须同步唤醒家长**\n- ✅ **必须**为家长提供：一键暂停今晚 / 调整睡眠窗口 / 永久退出 入口\n- ✅ **必须**：噩梦惊醒后**首条安抚语**应为家长本人预录的稳定语音（不用合成音）\n- ✅ 当夜噩梦惊醒 ≥ 3 次或连续 7 晚反复发生 → 提示家长**当地儿童心理门诊**或**儿科睡眠门诊**资源\n- ✅ 当晚汇总报告必须**只在次日清晨**发送（避免家长夜里被唤醒焦虑加深）\n\n> 仅输出基于音视频的客观不安事件检测与轻柔安抚动作，**不构成任何儿童睡眠/心理医学诊断**；频繁夜惊或长期睡眠困难请咨询当地**儿科睡眠门诊**或**儿童心理科**专业医师。\n\nFile v1.0.12:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.12:scripts/config.yaml\n\n{}\n\nFile v1.0.12:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.12:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.12:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.12:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: prod\n\nFile v1.0.12:skill-card.md\n\n## Description:\n\nAnalyzes child bedroom night-time audio and video to identify bedtime crying, fear-of-dark behaviors, nightmare awakenings, and out-of-bed events, then returns structured findings and soothing-action guidance.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[18072937735](https://clawhub.ai/user/18072937735)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nExternal users and developers use this skill to analyze child bedroom night-time media, detect signs of distress or unsafe out-of-bed events, and generate structured soothing recommendations, reports, and history views. It is intended for household parenting workflows where parent or guardian consent, privacy controls, and cloud-retention review are in place.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Sensitive child-bedroom audio and video may be uploaded or passed to cloud services.\n\nMitigation: Confirm parent or guardian consent, household notice, and the provider's retention, deletion, and sharing policy before installation.\n\nRisk: The skill may create or reuse a hidden local identity and persist authentication tokens.\n\nMitigation: Review local storage and token-handling behavior, and install only in environments where this persistence is acceptable.\n\nRisk: Device-control claims for lights, speakers, and parent notifications may not match the deployed integration.\n\nMitigation: Validate integrations in a controlled environment before enabling automated soothing actions or urgent alerts.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/18072937735/skills/smyx-child-bedtime-soothing-analysis)\n- [API 接口文档](artifact/references/api_doc.md)\n- [Skill demo](https://lifeemergence.com/sample.html)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, shell commands, configuration, guidance]\n\n**Output Format:** [Markdown and JSON-backed text reports with command examples and optional saved output files]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Can include event classifications, soothing-action recommendations, history tables, report links, and local output files.]\n\n## Skill Version(s):\n\n1.0.12 (source: server release metadata; artifact frontmatter reports 1.0.16)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.12:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.12:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.11: 31 files, 44638 bytes\n\nFiles: references/api_doc.md (7628b), scripts/__init__.py (73b), scripts/config.py (697b), scripts/config.yaml (3b), scripts/skill.py (595b), scripts/smyx_child_bedtime_soothing_analysis.py (3795b), skill-card.md (3026b), SKILL.md (15632b), skills/smyx_analysis/__init__.py (0b), skills/smyx_analysis/references/api_doc.md (427b), skills/smyx_analysis/requirements.txt (45b), skills/smyx_analysis/scripts/__init__.py (0b), skills/smyx_analysis/scripts/api_service.py (1509b), skills/smyx_analysis/scripts/config.py (1003b), skills/smyx_analysis/scripts/config.yaml (3b), skills/smyx_analysis/scripts/skill.py (6529b), skills/smyx_analysis/scripts/smyx_analysis.py (3833b), skills/smyx_common/__init__.py (0b), skills/smyx_common/requirements.txt (47b), skills/smyx_common/scripts/__init__.py (177b), skills/smyx_common/scripts/api_service.py (2645b), skills/smyx_common/scripts/base.py (469b), skills/smyx_common/scripts/config-dev.yaml (214b), skills/smyx_common/scripts/config-prod.yaml (0b), skills/smyx_common/scripts/config-test.yaml (256b), skills/smyx_common/scripts/config.py (24363b), skills/smyx_common/scripts/config.yaml (472b), skills/smyx_common/scripts/dao.py (18266b), skills/smyx_common/scripts/skill.py (2473b), skills/smyx_common/scripts/util.py (28776b), _meta.json (156b)\n\nFile v1.0.11:SKILL.md\n\n---\nname: \"smyx-child-bedtime-soothing-analysis\"\ndescription: \"Through a fixed camera (with infrared night vision) and microphone in the child's bedroom, the system analyzes pre-sleep and night-time video and audio to detect pre-sleep crying (continuous crying, calling 'Mama'), fear-of-the-dark expressions (curling up, looking around), and nightmare awakenings (sudden sitting up, trembling, screaming). | 通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。\"\nversion: \"1.0.13\"\nlicense: \"MIT-0\"\n---\n\n# 🌙 Child Bedtime Soothing (Fear of Dark / Post-Nightmare) | 儿童睡前情绪安抚（怕黑/噩梦后）\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **儿童睡前情绪安抚（怕黑/噩梦后）** |\n| 🎯 核心目标 | 通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_CHILD_BEDTIME_SOOTHING_ANALYSIS` |\n\nThrough a fixed camera (with infrared night vision) and microphone in the child's bedroom, the system analyzes pre-sleep and night-time video and audio to detect pre-sleep crying (continuous crying, calling 'Mama'), fear-of-the-dark expressions (curling up, looking around), and nightmare awakenings (sudden sitting up, trembling, screaming). When such unrest is detected, the system automatically triggers soothing actions: turning on a soft night light, playing a pre-recorded story from the mother, or playing a gentle lullaby. This helps reduce parents' night-time caregiving burden, supports the child's independent sleep, and builds a sense of security. Application scenarios: children's bedrooms, nurseries. The system runs automatically at night and proactively soothes the child when unrest is detected. Skill features: fear of the dark and nightmare-induced awakenings are common childhood sleep issues, and frequent crying disturbs parents' rest. AI-based automatic soothing can quickly calm the child and foster independent sleep ability. Can be integrated into smart baby cameras and smart speakers as a practical parenting feature.\n\n通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。该技能有助于减少父母夜间安抚负担，帮助儿童独立入睡，建立安全感。应用场景：儿童卧室、婴儿房。系统夜间自动运行，当检测到儿童不安时主动安抚。技能特点：儿童怕黑、噩梦惊醒是常见睡眠问题，频繁哭闹会干扰父母休息。通过AI自动安抚，可帮助儿童快速平静，培养独立入睡能力。该技能可集成到智能婴儿摄像头、智能音箱中，成为育儿家庭的实用功能。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的儿童睡眠安抚 AI。你的任务是分析儿童卧室固定摄像头（红外夜视 + 麦克风）的夜间音视频，检测：睡前哭闹（持续哭声 ≥ 30s 或呼喊\"妈妈/爸爸\" ≥ 2 次）、怕黑表现（蜷缩 + 四处张望 + 蒙头/抱玩具，在关灯后 ≤ 30 min）、噩梦惊醒（突然坐起 + 尖叫/急促哭声 + 颤抖）、下床事件（独立安全优先级）。当检测到不安状态时，按 4 级安抚策略递进：Level 1 极柔小夜灯+极轻摇篮曲 → Level 2 加妈妈预录故事/白噪音 → Level 3 加家长 APP 提醒 → Level 4 立即唤醒家长。婴儿（≤12 月）必须开专用模式，阈值更敏感、strong 及以上必须同步唤醒家长。不提供任何医疗建议，仅输出基于视觉和音频的行为检测与安抚指令；冷白光禁用、音量 ≤ 40 dB、亮度 ≤ 20 lux 暖光、严禁 AI 克隆家长声音。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于儿童卧室/婴儿房固定摄像头（**必须红外夜视 + 麦克风**）夜间音视频（**仅在睡眠窗口 19:00-07:00 启用**），识别 4 类场景（bedtime_unrest_mild / bedtime_unrest_crying / dark_fear / nightmare_wakeup / out_of_bed_safety / none）→ 音频核心 6 项（持续哭声时长 / 哭声强度 0-100 / \"妈妈爸爸\"呼喊 / 尖叫 / 呜咽抽噎 / 呼吸节奏规律性）+ 视频核心 7 项（蜷缩抱腿 / 四处张望 / **突然坐起** / 颤抖 / 抱毛绒玩具 / 拉被子蒙头 / **下床事件**）→ 4 档不安等级（mild / moderate / strong / out_of_bed）→ **4 级安抚策略递进**（小夜灯 ≤ 5/10/20 lux 暖光 + 摇篮曲/妈妈预录故事/白噪音 ≤ 35-40 dB + 家长 APP 推送 + 紧急唤醒）→ 3 分钟效果评估 + 自动升级 → 单晚动作上限管控（mild × 5 / moderate × 3 / strong × 2 / Level 4 不设上限）→ 次日清晨发送当晚汇总\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 红外夜视图像分析 |\n| 2 | 儿童蜷缩抱腿姿态识别 |\n| 3 | 四处张望识别 |\n| 4 | 突然坐起识别 |\n| 5 | 肢体颤抖识别 |\n| 6 | 抱毛绒玩具识别 |\n| 7 | 拉被子蒙头识别 |\n| 8 | 下床事件识别（独立安全优先级） |\n| 9 | 儿童哭声强度评估 |\n| 10 | \"妈妈爸爸\"呼喊声纹识别 |\n| 11 | 尖叫识别 |\n| 12 | 呜咽抽噎识别 |\n| 13 | 呼吸节奏规律性评估（睡熟 vs 醒着） |\n| 14 | 年龄段自适应（infant ≤12m / toddler 1-3y / preschool 3-6y / school 6-12y） |\n| 15 | 婴儿专用模式（阈值更敏感+安抚更轻柔+strong 及以上必须同步唤醒家长） |\n| 16 | 小夜灯智能调光（≤ 20 lux 暖光 2700K） |\n| 17 | 安抚音量智能控制（≤ 40 dB） |\n| 18 | 4 级安抚策略递进 + 3 分钟效果评估 + 自动升级 |\n| 19 | 单晚动作上限管控 |\n| 20 | 当晚汇总报告**仅次日清晨发送** |\n| 21 | 当夜 ≥ 3 次或连续 7 晚反复 → 提示当地儿科睡眠门诊/儿童心理门诊 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供儿童卧室/婴儿房固定摄像头（红外夜视+麦克风）夜间音视频 URL 或文件需要分析时，默认触发本技能进行儿童睡前情绪安抚（怕黑/噩梦后） |\n| 🔎 明确分析意图 | 当用户明确提及孩子睡前哭闹、宝宝怕黑、噩梦惊醒、夜惊、小夜灯、摇篮曲、妈妈预录故事、宝宝独立入睡等关键词，并且上传了音视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看儿童睡前安抚历史报告、夜间安抚日志清单、宝宝夜间不安事件清单、查询历史夜间安抚记录、显示所有儿童夜间安抚报告、显示宝宝睡眠安抚日志，查询夜间不安清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_child_bedtime_soothing_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_child_bedtime_soothing_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备儿童卧室/婴儿房固定摄像头（红外夜视+麦克风）夜间音视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 获取 open-id（强制执行） | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行儿童睡前情绪安抚（怕黑/噩梦后） | 调用 `-m scripts.smyx_child_bedtime_soothing_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地儿童卧室/婴儿房固定摄像头（红外夜视+麦克风）夜间音视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络儿童卧室/婴儿房固定摄像头夜间音视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，儿童睡眠安抚场景默认 `other` | 按需填写 |\n| `--list` | 显示儿童睡前情绪安抚（怕黑/噩梦后）历史安抚记录清单 | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_child_bedtime_soothing_analysis.py`](scripts/smyx_child_bedtime_soothing_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 输入要求：支持 mp4/avi/mov + 音轨，最大 10MB；**关键**：必须红外夜视 + 麦克风；仅睡眠窗口启用 |\n| 🔎 使用提醒 | **4 级安抚策略递进**（mild → moderate → strong → out_of_bed/Level 4），3 分钟未平复自动升级 |\n| 🔎 使用提醒 | 单晚动作上限：mild × 5 / moderate × 3 / strong × 2 / Level 4 不设上限（安全优先） |\n| 🔎 使用提醒 | 红线约束 |\n| 🧑‍⚖️ 结果性质 | **禁止**对儿童做\"睡眠障碍 / 夜惊症 / 焦虑症\"等医学诊断 |\n| 🔎 使用提醒 | **禁止**长期存储儿童夜间视频（≤ 7 天，仅入库不安事件片段） |\n| 🔎 使用提醒 | **禁止**用于商业广告/AI 训练；禁第三方共享 |\n| 🔎 使用提醒 | **禁止**冷白光（≥ 4000K）或亮度 > 30 lux 的小夜灯（打断褪黑素） |\n| 🔎 使用提醒 | **禁止**安抚音量 > 40 dB |\n| 🔎 使用提醒 | **绝对禁止**使用 AI 克隆/合成妈妈/爸爸声音冒充家长录音 |\n| 🔎 使用提醒 | **禁止**对 out_of_bed 仅做语音安抚——**必须立即推送家长 APP** |\n| 🔎 使用提醒 | **必须**：婴儿（≤ 12 月）开专用模式，strong 及以上必须同步唤醒家长；噩梦惊醒首条安抚必须是家长本人预录稳定语音 |\n| 📜 报告输出 | **必须**：当晚汇总报告**仅次日清晨发送**（避免家长夜里被唤醒焦虑加深） |\n| 🔎 使用提醒 | 当夜噩梦惊醒 ≥ 3 次或连续 7 晚反复 → 提示**当地儿科睡眠门诊**或**儿童心理门诊**资源 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史安抚记录清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地儿童夜间音视频\npython -m scripts.smyx_child_bedtime_soothing_analysis --input /path/to/bedroom.mp4\n\n# 分析网络儿童夜间音视频/实时流\npython -m scripts.smyx_child_bedtime_soothing_analysis --url https://example.com/bedroom.mp4\n\n# 显示历史夜间安抚记录清单（自动触发关键词：查看儿童睡前安抚历史报告、夜间安抚日志清单等）\npython -m scripts.smyx_child_bedtime_soothing_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_child_bedtime_soothing_analysis --input br.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_child_bedtime_soothing_analysis --input br.mp4 --output result.json\n```\n\nFile v1.0.11:_meta.json\n\n{\n  \"ownerId\": \"kn7e2caqj7pnsvr9r7t8zenghs83xw7n\",\n  \"slug\": \"smyx-child-bedtime-soothing-analysis\",\n  \"version\": \"1.0.11\",\n  \"publishedAt\": 1788727408788\n}\n\nFile v1.0.11:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放儿童睡前情绪安抚（怕黑/噩梦后） API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动儿童睡前情绪安抚检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取不安事件 + 安抚动作清单\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史安抚记录清单\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出夜间安抚日志报告\n5. （可选）`/web/companion/v2/trigger-soothing-action` - 触发联动安抚动作（小夜灯 / 智能音箱故事 / 摇篮曲 / 家长 APP 推送）\n\n## 场景代码\n\n- `SMYX_CHILD_BEDTIME_SOOTHING_ANALYSIS` - 儿童睡前情绪安抚（怕黑/噩梦后）\n\n## 输入约束\n\n- 摄像头：儿童卧室 / 婴儿房固定摄像头，**必须支持红外夜视**，能看到床上区域\n- 帧率 ≥ 10 FPS；分辨率 ≥ 720p；红外波段建议 850 nm（对睡眠干扰小）\n- 音频**必需**：采样率 ≥ 16kHz（用于哭声 / \"妈妈\" 呼喊 / 尖叫识别）\n- 时段：仅在配置的**睡眠窗口**内启用（默认 19:00 - 07:00），白天自动暂停\n- 多孩家庭按目标跟踪绑定到注册儿童 ID（每个孩子独立基线）\n- 婴儿（≤ 12 月）必须额外开启**婴儿专用模式**：阈值更敏感、安抚动作更轻柔、必要时同步唤醒家长\n- 家长必须授权部署，并明确告知家庭其他成员（如保姆、外祖父母）\n\n## 关键观测信号\n\n### 音频（核心）\n- `crying_continuous_sec` - 持续哭声时长\n- `crying_intensity` - 哭声强度（0-100，结合分贝 + 频谱情绪）\n- `call_mom_dad_count` - 呼喊\"妈妈/爸爸/妈咪\"次数\n- `scream_event_count` - 尖叫事件次数（突发高频高强度声）\n- `whimper_event_count` - 呜咽 / 抽噎事件（轻度不安信号）\n- `sleep_breathing_regular` - 呼吸节奏规律性（参考指标，区分睡熟 vs 醒着）\n\n### 视频（核心）\n- `body_curl_up_detected` - 蜷缩抱腿姿态（怕黑典型表现）\n- `looking_around_event_count` - 四处张望次数（黑暗中睁眼搜索）\n- `sudden_sit_up_event` - 突然坐起事件（噩梦惊醒典型）\n- `trembling_visual_detected` - 肢体颤抖（恐惧伴随）\n- `hugging_plush_toy` - 主动抱毛绒玩具（自我安抚行为，参考）\n- `pull_cover_over_head` - 拉被子蒙头（怕黑参考）\n- `out_of_bed_event` - 下床事件（独立优先级，避免摔伤）\n\n### 上下文\n- `is_within_sleep_window` - 是否在睡眠窗口内\n- `time_since_last_soothing_min` - 距离上次安抚动作的时间\n\n## 场景判定与不安等级\n\n- **bedtime_unrest_mild** - 睡前不安（轻度）：呜咽 / 抱毛绒玩具 / 蜷缩，无哭喊\n- **bedtime_unrest_crying** - 睡前哭闹：持续哭声 ≥ 30 秒 或 呼喊\"妈妈/爸爸\" ≥ 2 次\n- **dark_fear** - 怕黑：蜷缩 + 四处张望 + 蒙头/抱玩具 任两项 + 在卧室关灯后 ≤ 30 分钟内\n- **nightmare_wakeup** - 噩梦惊醒：突然坐起 + 尖叫/急促哭声 + 颤抖 任两项\n- **out_of_bed_safety** - 下床（独立优先级）：触发家长 APP 推送 + 调亮小夜灯，避免摔伤\n- **none** - 无不安信号 / 在睡熟状态\n\n## 安抚动作策略（轻 → 重逐级递进）\n\n- **Level 1（mild）**：极柔小夜灯（≤ 5 lux 暖光）+ 极轻摇篮曲（≤ 35 dB）\n- **Level 2（moderate）**：小夜灯（≤ 10 lux 暖光）+ **妈妈预录故事** / 白噪音\n- **Level 3（strong：noctmare/scream）**：小夜灯（≤ 20 lux）+ 妈妈预录\"宝贝，妈妈在这里，做了梦对吗？没事了哦~\"语音 + **同时推送家长 APP** \"noctmare 提醒，建议过去陪伴\"\n- **Level 4（out_of_bed/persist ≥ 5min）**：**立即推送家长 APP + 主屏震动**，建议家长亲自到场，AI 仅辅助\n\n- 升级条件：同一信号在 Level 1/2 安抚后 ≥ 3 分钟未平复 → 自动升级一级\n- 单晚同一儿童安抚动作触发**上限**：mild × 5、moderate × 3、strong × 2、Level 4 不设上限（安全优先）\n\n## 输出字段（参考）\n\n- `event_id` / `event_timestamp` / `child_id` / `child_age_band`（infant ≤12m / toddler 1-3y / preschool 3-6y / school 6-12y）\n- `scene_label` - 场景判定（bedtime_unrest_mild / bedtime_unrest_crying / dark_fear / nightmare_wakeup / out_of_bed_safety / none）\n- `audio_signals` / `video_signals` / `context`\n- `unrest_level` - 不安等级（mild / moderate / strong / out_of_bed）\n- `soothing_actions` - 安抚动作列表（每项含 action_type / message / target / level / volume_db / brightness_lux，例如：\n    - `{action_type: \"night_light_on\", brightness_lux: 5, color_temp: \"warm_2700K\", target: \"child_room_light\", level: 1}`\n    - `{action_type: \"play_mom_recorded_story\", message: \"妈妈预录《晚安月亮》故事 5 分钟\", volume_db: 35, target: \"child_room_speaker\", level: 2}`\n    - `{action_type: \"play_lullaby\", message: \"《摇啊摇》摇篮曲\", volume_db: 30, target: \"child_room_speaker\", level: 2}`\n    - `{action_type: \"play_white_noise\", message: \"白噪音雨声\", volume_db: 30, target: \"child_room_speaker\", level: 2}`\n    - `{action_type: \"parent_app_push\", message: \"孩子刚被噩梦惊醒，已轻声安抚中，建议过去陪伴\", target: \"parent_phone_app\", level: 3}`\n    - `{action_type: \"parent_app_urgent_push\", message: \"⚠️ 孩子已下床，请立即查看\", target: \"parent_phone_app\", level: 4}`）\n- `effectiveness_after_3min` - 3 分钟后效果（settled / partially_settled / unchanged / escalated）\n- `nightly_summary` - 当晚汇总（次日清晨自动生成：不安事件次数 + 类型分布 + 安抚成功率 + 建议）\n- `recommend_action` - 建议动作（trigger_level_N_soothing / push_parent_app / urgent_parent_intervention / observe_only）\n\n## 强制约束与红线\n\n- ❌ **禁止**对儿童做任何\"睡眠障碍 / 夜惊症 / 焦虑症\"等医学诊断\n- ❌ **禁止**长期存储儿童夜间视频；建议仅保留 ≤ 7 天 + 仅入库不安事件片段\n- ❌ **禁止**将儿童夜间视频/音频用于商业广告、AI 训练数据集\n- ❌ **禁止**向家长以外的第三方共享（亲戚需家长授权才能查看）\n- ❌ **禁止**夜间使用冷白光（≥ 4000K）或亮度 > 30 lux 的小夜灯，会打断褪黑素分泌\n- ❌ **禁止**安抚音量超过 40 dB（接近耳语水平），避免影响睡眠或惊醒孩子\n- ❌ **禁止**使用 AI 克隆/合成妈妈/爸爸声音冒充家长录音；预录语音**必须由家长本人录制**\n- ❌ **禁止**对 **out_of_bed** 事件仅做\"语音安抚\"——必须立即推送家长 APP（避免摔伤）\n- ✅ **必须**婴儿（≤ 12 月）开启专用模式：阈值更敏感 + 安抚更轻柔 + **strong 及以上必须同步唤醒家长**\n- ✅ **必须**为家长提供：一键暂停今晚 / 调整睡眠窗口 / 永久退出 入口\n- ✅ **必须**：噩梦惊醒后**首条安抚语**应为家长本人预录的稳定语音（不用合成音）\n- ✅ 当夜噩梦惊醒 ≥ 3 次或连续 7 晚反复发生 → 提示家长**当地儿童心理门诊**或**儿科睡眠门诊**资源\n- ✅ 当晚汇总报告必须**只在次日清晨**发送（避免家长夜里被唤醒焦虑加深）\n\n> 仅输出基于音视频的客观不安事件检测与轻柔安抚动作，**不构成任何儿童睡眠/心理医学诊断**；频繁夜惊或长期睡眠困难请咨询当地**儿科睡眠门诊**或**儿童心理科**专业医师。\n\nFile v1.0.11:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.11:scripts/config.yaml\n\n{}\n\nFile v1.0.11:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.11:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.11:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.11:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: dev\n\nFile v1.0.11:skill-card.md\n\n## Description:\n\nAnalyzes child-bedroom night video and audio to identify bedtime distress, fear-of-dark behavior, nightmare awakenings, and related soothing recommendations.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[18072937735](https://clawhub.ai/user/18072937735)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nExternal users and developers use this skill to submit child-bedroom night media or media URLs for structured bedtime-unrest analysis, soothing-action guidance, report links, and history lookup. Reviewers should account for the sensitive child audio/video handled by this release.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The security summary says the skill handles very sensitive child-bedroom audio/video and is broader than the description suggests.\n\nMitigation: Review carefully before installation, obtain appropriate guardian consent, and limit use to authorized child safety and bedtime-soothing contexts.\n\nRisk: The security guidance says the skill may upload child-bedroom recordings or media URLs to a remote service and query cloud history.\n\nMitigation: Use only approved media, avoid unnecessary uploads, and verify the remote service, retention, access-control, and deletion practices before deployment.\n\nRisk: The security guidance says the skill may silently create or reuse an internal identity and store tokens locally.\n\nMitigation: Run in a controlled environment, review local credential storage, and remove stored tokens or generated identities when access is no longer needed.\n\nRisk: The security guidance flags default dev HTTP endpoints and a mismatch between advertised soothing automation and implemented upload/reporting behavior.\n\nMitigation: Confirm production HTTPS endpoint configuration and validate actual behavior against the claimed soothing workflow before relying on automated actions.\n\n## Reference(s):\n\n- [Child Bedtime Soothing API Documentation](artifact/references/api_doc.md)\n- [Shared Analysis API Documentation](artifact/skills/smyx_analysis/references/api_doc.md)\n- [ClawHub Skill Page](https://clawhub.ai/18072937735/skills/smyx-child-bedtime-soothing-analysis)\n- [Skill Demo](https://lifeemergence.com/sample.html)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, code, shell commands, configuration, guidance]\n\n**Output Format:** [Markdown or JSON-like structured text with report links and command examples]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May include child-nighttime media analysis results, event labels, soothing recommendations, historical report records, and export URLs.]\n\n## Skill Version(s):\n\n1.0.11 (source: server release metadata; artifact frontmatter says 1.0.13)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.11:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.11:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.10: 31 files, 44639 bytes\n\nFiles: references/api_doc.md (7628b), scripts/__init__.py (73b), scripts/config.py (697b), scripts/config.yaml (3b), scripts/skill.py (595b), scripts/smyx_child_bedtime_soothing_analysis.py (3795b), skill-card.md (2865b), SKILL.md (15632b), skills/smyx_analysis/__init__.py (0b), skills/smyx_analysis/references/api_doc.md (427b), skills/smyx_analysis/requirements.txt (45b), skills/smyx_analysis/scripts/__init__.py (0b), skills/smyx_analysis/scripts/api_service.py (1509b), skills/smyx_analysis/scripts/config.py (1003b), skills/smyx_analysis/scripts/config.yaml (3b), skills/smyx_analysis/scripts/skill.py (6529b), skills/smyx_analysis/scripts/smyx_analysis.py (3833b), skills/smyx_common/__init__.py (0b), skills/smyx_common/requirements.txt (47b), skills/smyx_common/scripts/__init__.py (177b), skills/smyx_common/scripts/api_service.py (2645b), skills/smyx_common/scripts/base.py (469b), skills/smyx_common/scripts/config-dev.yaml (214b), skills/smyx_common/scripts/config-prod.yaml (0b), skills/smyx_common/scripts/config-test.yaml (256b), skills/smyx_common/scripts/config.py (24363b), skills/smyx_common/scripts/config.yaml (472b), skills/smyx_common/scripts/dao.py (18266b), skills/smyx_common/scripts/skill.py (2473b), skills/smyx_common/scripts/util.py (28776b), _meta.json (156b)\n\nFile v1.0.10:SKILL.md\n\n---\nname: \"smyx-child-bedtime-soothing-analysis\"\ndescription: \"Through a fixed camera (with infrared night vision) and microphone in the child's bedroom, the system analyzes pre-sleep and night-time video and audio to detect pre-sleep crying (continuous crying, calling 'Mama'), fear-of-the-dark expressions (curling up, looking around), and nightmare awakenings (sudden sitting up, trembling, screaming). | 通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。\"\nversion: \"1.0.11\"\nlicense: \"MIT-0\"\n---\n\n# 🌙 Child Bedtime Soothing (Fear of Dark / Post-Nightmare) | 儿童睡前情绪安抚（怕黑/噩梦后）\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **儿童睡前情绪安抚（怕黑/噩梦后）** |\n| 🎯 核心目标 | 通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_CHILD_BEDTIME_SOOTHING_ANALYSIS` |\n\nThrough a fixed camera (with infrared night vision) and microphone in the child's bedroom, the system analyzes pre-sleep and night-time video and audio to detect pre-sleep crying (continuous crying, calling 'Mama'), fear-of-the-dark expressions (curling up, looking around), and nightmare awakenings (sudden sitting up, trembling, screaming). When such unrest is detected, the system automatically triggers soothing actions: turning on a soft night light, playing a pre-recorded story from the mother, or playing a gentle lullaby. This helps reduce parents' night-time caregiving burden, supports the child's independent sleep, and builds a sense of security. Application scenarios: children's bedrooms, nurseries. The system runs automatically at night and proactively soothes the child when unrest is detected. Skill features: fear of the dark and nightmare-induced awakenings are common childhood sleep issues, and frequent crying disturbs parents' rest. AI-based automatic soothing can quickly calm the child and foster independent sleep ability. Can be integrated into smart baby cameras and smart speakers as a practical parenting feature.\n\n通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。该技能有助于减少父母夜间安抚负担，帮助儿童独立入睡，建立安全感。应用场景：儿童卧室、婴儿房。系统夜间自动运行，当检测到儿童不安时主动安抚。技能特点：儿童怕黑、噩梦惊醒是常见睡眠问题，频繁哭闹会干扰父母休息。通过AI自动安抚，可帮助儿童快速平静，培养独立入睡能力。该技能可集成到智能婴儿摄像头、智能音箱中，成为育儿家庭的实用功能。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的儿童睡眠安抚 AI。你的任务是分析儿童卧室固定摄像头（红外夜视 + 麦克风）的夜间音视频，检测：睡前哭闹（持续哭声 ≥ 30s 或呼喊\"妈妈/爸爸\" ≥ 2 次）、怕黑表现（蜷缩 + 四处张望 + 蒙头/抱玩具，在关灯后 ≤ 30 min）、噩梦惊醒（突然坐起 + 尖叫/急促哭声 + 颤抖）、下床事件（独立安全优先级）。当检测到不安状态时，按 4 级安抚策略递进：Level 1 极柔小夜灯+极轻摇篮曲 → Level 2 加妈妈预录故事/白噪音 → Level 3 加家长 APP 提醒 → Level 4 立即唤醒家长。婴儿（≤12 月）必须开专用模式，阈值更敏感、strong 及以上必须同步唤醒家长。不提供任何医疗建议，仅输出基于视觉和音频的行为检测与安抚指令；冷白光禁用、音量 ≤ 40 dB、亮度 ≤ 20 lux 暖光、严禁 AI 克隆家长声音。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于儿童卧室/婴儿房固定摄像头（**必须红外夜视 + 麦克风**）夜间音视频（**仅在睡眠窗口 19:00-07:00 启用**），识别 4 类场景（bedtime_unrest_mild / bedtime_unrest_crying / dark_fear / nightmare_wakeup / out_of_bed_safety / none）→ 音频核心 6 项（持续哭声时长 / 哭声强度 0-100 / \"妈妈爸爸\"呼喊 / 尖叫 / 呜咽抽噎 / 呼吸节奏规律性）+ 视频核心 7 项（蜷缩抱腿 / 四处张望 / **突然坐起** / 颤抖 / 抱毛绒玩具 / 拉被子蒙头 / **下床事件**）→ 4 档不安等级（mild / moderate / strong / out_of_bed）→ **4 级安抚策略递进**（小夜灯 ≤ 5/10/20 lux 暖光 + 摇篮曲/妈妈预录故事/白噪音 ≤ 35-40 dB + 家长 APP 推送 + 紧急唤醒）→ 3 分钟效果评估 + 自动升级 → 单晚动作上限管控（mild × 5 / moderate × 3 / strong × 2 / Level 4 不设上限）→ 次日清晨发送当晚汇总\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 红外夜视图像分析 |\n| 2 | 儿童蜷缩抱腿姿态识别 |\n| 3 | 四处张望识别 |\n| 4 | 突然坐起识别 |\n| 5 | 肢体颤抖识别 |\n| 6 | 抱毛绒玩具识别 |\n| 7 | 拉被子蒙头识别 |\n| 8 | 下床事件识别（独立安全优先级） |\n| 9 | 儿童哭声强度评估 |\n| 10 | \"妈妈爸爸\"呼喊声纹识别 |\n| 11 | 尖叫识别 |\n| 12 | 呜咽抽噎识别 |\n| 13 | 呼吸节奏规律性评估（睡熟 vs 醒着） |\n| 14 | 年龄段自适应（infant ≤12m / toddler 1-3y / preschool 3-6y / school 6-12y） |\n| 15 | 婴儿专用模式（阈值更敏感+安抚更轻柔+strong 及以上必须同步唤醒家长） |\n| 16 | 小夜灯智能调光（≤ 20 lux 暖光 2700K） |\n| 17 | 安抚音量智能控制（≤ 40 dB） |\n| 18 | 4 级安抚策略递进 + 3 分钟效果评估 + 自动升级 |\n| 19 | 单晚动作上限管控 |\n| 20 | 当晚汇总报告**仅次日清晨发送** |\n| 21 | 当夜 ≥ 3 次或连续 7 晚反复 → 提示当地儿科睡眠门诊/儿童心理门诊 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供儿童卧室/婴儿房固定摄像头（红外夜视+麦克风）夜间音视频 URL 或文件需要分析时，默认触发本技能进行儿童睡前情绪安抚（怕黑/噩梦后） |\n| 🔎 明确分析意图 | 当用户明确提及孩子睡前哭闹、宝宝怕黑、噩梦惊醒、夜惊、小夜灯、摇篮曲、妈妈预录故事、宝宝独立入睡等关键词，并且上传了音视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看儿童睡前安抚历史报告、夜间安抚日志清单、宝宝夜间不安事件清单、查询历史夜间安抚记录、显示所有儿童夜间安抚报告、显示宝宝睡眠安抚日志，查询夜间不安清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_child_bedtime_soothing_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_child_bedtime_soothing_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备儿童卧室/婴儿房固定摄像头（红外夜视+麦克风）夜间音视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 获取 open-id（强制执行） | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行儿童睡前情绪安抚（怕黑/噩梦后） | 调用 `-m scripts.smyx_child_bedtime_soothing_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地儿童卧室/婴儿房固定摄像头（红外夜视+麦克风）夜间音视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络儿童卧室/婴儿房固定摄像头夜间音视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，儿童睡眠安抚场景默认 `other` | 按需填写 |\n| `--list` | 显示儿童睡前情绪安抚（怕黑/噩梦后）历史安抚记录清单 | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_child_bedtime_soothing_analysis.py`](scripts/smyx_child_bedtime_soothing_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 输入要求：支持 mp4/avi/mov + 音轨，最大 10MB；**关键**：必须红外夜视 + 麦克风；仅睡眠窗口启用 |\n| 🔎 使用提醒 | **4 级安抚策略递进**（mild → moderate → strong → out_of_bed/Level 4），3 分钟未平复自动升级 |\n| 🔎 使用提醒 | 单晚动作上限：mild × 5 / moderate × 3 / strong × 2 / Level 4 不设上限（安全优先） |\n| 🔎 使用提醒 | 红线约束 |\n| 🧑‍⚖️ 结果性质 | **禁止**对儿童做\"睡眠障碍 / 夜惊症 / 焦虑症\"等医学诊断 |\n| 🔎 使用提醒 | **禁止**长期存储儿童夜间视频（≤ 7 天，仅入库不安事件片段） |\n| 🔎 使用提醒 | **禁止**用于商业广告/AI 训练；禁第三方共享 |\n| 🔎 使用提醒 | **禁止**冷白光（≥ 4000K）或亮度 > 30 lux 的小夜灯（打断褪黑素） |\n| 🔎 使用提醒 | **禁止**安抚音量 > 40 dB |\n| 🔎 使用提醒 | **绝对禁止**使用 AI 克隆/合成妈妈/爸爸声音冒充家长录音 |\n| 🔎 使用提醒 | **禁止**对 out_of_bed 仅做语音安抚——**必须立即推送家长 APP** |\n| 🔎 使用提醒 | **必须**：婴儿（≤ 12 月）开专用模式，strong 及以上必须同步唤醒家长；噩梦惊醒首条安抚必须是家长本人预录稳定语音 |\n| 📜 报告输出 | **必须**：当晚汇总报告**仅次日清晨发送**（避免家长夜里被唤醒焦虑加深） |\n| 🔎 使用提醒 | 当夜噩梦惊醒 ≥ 3 次或连续 7 晚反复 → 提示**当地儿科睡眠门诊**或**儿童心理门诊**资源 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史安抚记录清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地儿童夜间音视频\npython -m scripts.smyx_child_bedtime_soothing_analysis --input /path/to/bedroom.mp4\n\n# 分析网络儿童夜间音视频/实时流\npython -m scripts.smyx_child_bedtime_soothing_analysis --url https://example.com/bedroom.mp4\n\n# 显示历史夜间安抚记录清单（自动触发关键词：查看儿童睡前安抚历史报告、夜间安抚日志清单等）\npython -m scripts.smyx_child_bedtime_soothing_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_child_bedtime_soothing_analysis --input br.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_child_bedtime_soothing_analysis --input br.mp4 --output result.json\n```\n\nFile v1.0.10:_meta.json\n\n{\n  \"ownerId\": \"kn7e2caqj7pnsvr9r7t8zenghs83xw7n\",\n  \"slug\": \"smyx-child-bedtime-soothing-analysis\",\n  \"version\": \"1.0.10\",\n  \"publishedAt\": 1787589514635\n}\n\nFile v1.0.10:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放儿童睡前情绪安抚（怕黑/噩梦后） API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动儿童睡前情绪安抚检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取不安事件 + 安抚动作清单\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史安抚记录清单\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出夜间安抚日志报告\n5. （可选）`/web/companion/v2/trigger-soothing-action` - 触发联动安抚动作（小夜灯 / 智能音箱故事 / 摇篮曲 / 家长 APP 推送）\n\n## 场景代码\n\n- `SMYX_CHILD_BEDTIME_SOOTHING_ANALYSIS` - 儿童睡前情绪安抚（怕黑/噩梦后）\n\n## 输入约束\n\n- 摄像头：儿童卧室 / 婴儿房固定摄像头，**必须支持红外夜视**，能看到床上区域\n- 帧率 ≥ 10 FPS；分辨率 ≥ 720p；红外波段建议 850 nm（对睡眠干扰小）\n- 音频**必需**：采样率 ≥ 16kHz（用于哭声 / \"妈妈\" 呼喊 / 尖叫识别）\n- 时段：仅在配置的**睡眠窗口**内启用（默认 19:00 - 07:00），白天自动暂停\n- 多孩家庭按目标跟踪绑定到注册儿童 ID（每个孩子独立基线）\n- 婴儿（≤ 12 月）必须额外开启**婴儿专用模式**：阈值更敏感、安抚动作更轻柔、必要时同步唤醒家长\n- 家长必须授权部署，并明确告知家庭其他成员（如保姆、外祖父母）\n\n## 关键观测信号\n\n### 音频（核心）\n- `crying_continuous_sec` - 持续哭声时长\n- `crying_intensity` - 哭声强度（0-100，结合分贝 + 频谱情绪）\n- `call_mom_dad_count` - 呼喊\"妈妈/爸爸/妈咪\"次数\n- `scream_event_count` - 尖叫事件次数（突发高频高强度声）\n- `whimper_event_count` - 呜咽 / 抽噎事件（轻度不安信号）\n- `sleep_breathing_regular` - 呼吸节奏规律性（参考指标，区分睡熟 vs 醒着）\n\n### 视频（核心）\n- `body_curl_up_detected` - 蜷缩抱腿姿态（怕黑典型表现）\n- `looking_around_event_count` - 四处张望次数（黑暗中睁眼搜索）\n- `sudden_sit_up_event` - 突然坐起事件（噩梦惊醒典型）\n- `trembling_visual_detected` - 肢体颤抖（恐惧伴随）\n- `hugging_plush_toy` - 主动抱毛绒玩具（自我安抚行为，参考）\n- `pull_cover_over_head` - 拉被子蒙头（怕黑参考）\n- `out_of_bed_event` - 下床事件（独立优先级，避免摔伤）\n\n### 上下文\n- `is_within_sleep_window` - 是否在睡眠窗口内\n- `time_since_last_soothing_min` - 距离上次安抚动作的时间\n\n## 场景判定与不安等级\n\n- **bedtime_unrest_mild** - 睡前不安（轻度）：呜咽 / 抱毛绒玩具 / 蜷缩，无哭喊\n- **bedtime_unrest_crying** - 睡前哭闹：持续哭声 ≥ 30 秒 或 呼喊\"妈妈/爸爸\" ≥ 2 次\n- **dark_fear** - 怕黑：蜷缩 + 四处张望 + 蒙头/抱玩具 任两项 + 在卧室关灯后 ≤ 30 分钟内\n- **nightmare_wakeup** - 噩梦惊醒：突然坐起 + 尖叫/急促哭声 + 颤抖 任两项\n- **out_of_bed_safety** - 下床（独立优先级）：触发家长 APP 推送 + 调亮小夜灯，避免摔伤\n- **none** - 无不安信号 / 在睡熟状态\n\n## 安抚动作策略（轻 → 重逐级递进）\n\n- **Level 1（mild）**：极柔小夜灯（≤ 5 lux 暖光）+ 极轻摇篮曲（≤ 35 dB）\n- **Level 2（moderate）**：小夜灯（≤ 10 lux 暖光）+ **妈妈预录故事** / 白噪音\n- **Level 3（strong：noctmare/scream）**：小夜灯（≤ 20 lux）+ 妈妈预录\"宝贝，妈妈在这里，做了梦对吗？没事了哦~\"语音 + **同时推送家长 APP** \"noctmare 提醒，建议过去陪伴\"\n- **Level 4（out_of_bed/persist ≥ 5min）**：**立即推送家长 APP + 主屏震动**，建议家长亲自到场，AI 仅辅助\n\n- 升级条件：同一信号在 Level 1/2 安抚后 ≥ 3 分钟未平复 → 自动升级一级\n- 单晚同一儿童安抚动作触发**上限**：mild × 5、moderate × 3、strong × 2、Level 4 不设上限（安全优先）\n\n## 输出字段（参考）\n\n- `event_id` / `event_timestamp` / `child_id` / `child_age_band`（infant ≤12m / toddler 1-3y / preschool 3-6y / school 6-12y）\n- `scene_label` - 场景判定（bedtime_unrest_mild / bedtime_unrest_crying / dark_fear / nightmare_wakeup / out_of_bed_safety / none）\n- `audio_signals` / `video_signals` / `context`\n- `unrest_level` - 不安等级（mild / moderate / strong / out_of_bed）\n- `soothing_actions` - 安抚动作列表（每项含 action_type / message / target / level / volume_db / brightness_lux，例如：\n    - `{action_type: \"night_light_on\", brightness_lux: 5, color_temp: \"warm_2700K\", target: \"child_room_light\", level: 1}`\n    - `{action_type: \"play_mom_recorded_story\", message: \"妈妈预录《晚安月亮》故事 5 分钟\", volume_db: 35, target: \"child_room_speaker\", level: 2}`\n    - `{action_type: \"play_lullaby\", message: \"《摇啊摇》摇篮曲\", volume_db: 30, target: \"child_room_speaker\", level: 2}`\n    - `{action_type: \"play_white_noise\", message: \"白噪音雨声\", volume_db: 30, target: \"child_room_speaker\", level: 2}`\n    - `{action_type: \"parent_app_push\", message: \"孩子刚被噩梦惊醒，已轻声安抚中，建议过去陪伴\", target: \"parent_phone_app\", level: 3}`\n    - `{action_type: \"parent_app_urgent_push\", message: \"⚠️ 孩子已下床，请立即查看\", target: \"parent_phone_app\", level: 4}`）\n- `effectiveness_after_3min` - 3 分钟后效果（settled / partially_settled / unchanged / escalated）\n- `nightly_summary` - 当晚汇总（次日清晨自动生成：不安事件次数 + 类型分布 + 安抚成功率 + 建议）\n- `recommend_action` - 建议动作（trigger_level_N_soothing / push_parent_app / urgent_parent_intervention / observe_only）\n\n## 强制约束与红线\n\n- ❌ **禁止**对儿童做任何\"睡眠障碍 / 夜惊症 / 焦虑症\"等医学诊断\n- ❌ **禁止**长期存储儿童夜间视频；建议仅保留 ≤ 7 天 + 仅入库不安事件片段\n- ❌ **禁止**将儿童夜间视频/音频用于商业广告、AI 训练数据集\n- ❌ **禁止**向家长以外的第三方共享（亲戚需家长授权才能查看）\n- ❌ **禁止**夜间使用冷白光（≥ 4000K）或亮度 > 30 lux 的小夜灯，会打断褪黑素分泌\n- ❌ **禁止**安抚音量超过 40 dB（接近耳语水平），避免影响睡眠或惊醒孩子\n- ❌ **禁止**使用 AI 克隆/合成妈妈/爸爸声音冒充家长录音；预录语音**必须由家长本人录制**\n- ❌ **禁止**对 **out_of_bed** 事件仅做\"语音安抚\"——必须立即推送家长 APP（避免摔伤）\n- ✅ **必须**婴儿（≤ 12 月）开启专用模式：阈值更敏感 + 安抚更轻柔 + **strong 及以上必须同步唤醒家长**\n- ✅ **必须**为家长提供：一键暂停今晚 / 调整睡眠窗口 / 永久退出 入口\n- ✅ **必须**：噩梦惊醒后**首条安抚语**应为家长本人预录的稳定语音（不用合成音）\n- ✅ 当夜噩梦惊醒 ≥ 3 次或连续 7 晚反复发生 → 提示家长**当地儿童心理门诊**或**儿科睡眠门诊**资源\n- ✅ 当晚汇总报告必须**只在次日清晨**发送（避免家长夜里被唤醒焦虑加深）\n\n> 仅输出基于音视频的客观不安事件检测与轻柔安抚动作，**不构成任何儿童睡眠/心理医学诊断**；频繁夜惊或长期睡眠困难请咨询当地**儿科睡眠门诊**或**儿童心理科**专业医师。\n\nFile v1.0.10:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.10:scripts/config.yaml\n\n{}\n\nFile v1.0.10:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.10:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.10:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.10:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: dev\n\nFile v1.0.10:skill-card.md\n\n## Description:\n\nAnalyzes child-bedroom night audio and video to detect bedtime crying, fear-of-dark behavior, and nightmare awakenings, then returns structured soothing actions such as soft night-light use, prerecorded parent audio, lullabies, or parent notification.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[18072937735](https://clawhub.ai/user/18072937735)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nExternal caregivers and smart-home developers use this skill to analyze authorized child bedroom or nursery night media, identify unrest events, and produce structured reports and gentle soothing recommendations. It is intended for behavior detection and caregiver support, not medical diagnosis.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Child bedroom audio, video, or media URLs may be sent to cloud analysis services.\n\nMitigation: Use only with explicit caregiver authorization, approved cloud endpoints, a documented retention policy, and a clear rule that child media is not reused for advertising or model training.\n\nRisk: The skill can silently create or reuse an identity and query cloud report history.\n\nMitigation: Review identity handling before installation, restrict report access to authorized caregivers, and confirm how tokens or service identifiers are stored and revoked.\n\nRisk: Default configuration evidence includes development, private-network, or non-HTTPS service endpoints.\n\nMitigation: Confirm production configuration uses approved HTTPS endpoints and remove private or development endpoints before deployment.\n\nRisk: Behavior detection could be mistaken for clinical assessment.\n\nMitigation: Present outputs as observational sleep-event analysis only, preserve the no-diagnosis boundary, and direct recurring severe events to pediatric sleep or child psychology professionals.\n\n## Reference(s):\n\n- [API documentation](references/api_doc.md)\n- [Skill demo](https://lifeemergence.com/sample.html)\n- [ClawHub skill page](https://clawhub.ai/18072937735/skills/smyx-child-bedtime-soothing-analysis)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, JSON, shell commands, guidance]\n\n**Output Format:** [Markdown and JSON text containing structured event analysis, soothing actions, recommendations, history-list results, and report links.]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May write analysis output to a local file when an output path is provided.]\n\n## Skill Version(s):\n\n1.0.10 (source: server release metadata; artifact frontmatter reports 1.0.11)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.10:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.10:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.9: 31 files, 44481 bytes\n\nFiles: references/api_doc.md (7628b), scripts/__init__.py (73b), scripts/config.py (697b), scripts/config.yaml (3b), scripts/skill.py (595b), scripts/smyx_child_bedtime_soothing_analysis.py (3795b), skill-card.md (2469b), SKILL.md (15632b), skills/smyx_analysis/__init__.py (0b), skills/smyx_analysis/references/api_doc.md (427b), skills/smyx_analysis/requirements.txt (45b), skills/smyx_analysis/scripts/__init__.py (0b), skills/smyx_analysis/scripts/api_service.py (1509b), skills/smyx_analysis/scripts/config.py (1003b), skills/smyx_analysis/scripts/config.yaml (3b), skills/smyx_analysis/scripts/skill.py (6529b), skills/smyx_analysis/scripts/smyx_analysis.py (3833b), skills/smyx_common/__init__.py (0b), skills/smyx_common/requirements.txt (47b), skills/smyx_common/scripts/__init__.py (177b), skills/smyx_common/scripts/api_service.py (2645b), skills/smyx_common/scripts/base.py (469b), skills/smyx_common/scripts/config-dev.yaml (214b), skills/smyx_common/scripts/config-prod.yaml (0b), skills/smyx_common/scripts/config-test.yaml (256b), skills/smyx_common/scripts/config.py (24363b), skills/smyx_common/scripts/config.yaml (472b), skills/smyx_common/scripts/dao.py (18266b), skills/smyx_common/scripts/skill.py (2473b), skills/smyx_common/scripts/util.py (28776b), _meta.json (155b)\n\nFile v1.0.9:SKILL.md\n\n---\nname: \"smyx-child-bedtime-soothing-analysis\"\ndescription: \"Through a fixed camera (with infrared night vision) and microphone in the child's bedroom, the system analyzes pre-sleep and night-time video and audio to detect pre-sleep crying (continuous crying, calling 'Mama'), fear-of-the-dark expressions (curling up, looking around), and nightmare awakenings (sudden sitting up, trembling, screaming). | 通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。\"\nversion: \"1.0.10\"\nlicense: \"MIT-0\"\n---\n\n# 🌙 Child Bedtime Soothing (Fear of Dark / Post-Nightmare) | 儿童睡前情绪安抚（怕黑/噩梦后）\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **儿童睡前情绪安抚（怕黑/噩梦后）** |\n| 🎯 核心目标 | 通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_CHILD_BEDTIME_SOOTHING_ANALYSIS` |\n\nThrough a fixed camera (with infrared night vision) and microphone in the child's bedroom, the system analyzes pre-sleep and night-time video and audio to detect pre-sleep crying (continuous crying, calling 'Mama'), fear-of-the-dark expressions (curling up, looking around), and nightmare awakenings (sudden sitting up, trembling, screaming). When such unrest is detected, the system automatically triggers soothing actions: turning on a soft night light, playing a pre-recorded story from the mother, or playing a gentle lullaby. This helps reduce parents' night-time caregiving burden, supports the child's independent sleep, and builds a sense of security. Application scenarios: children's bedrooms, nurseries. The system runs automatically at night and proactively soothes the child when unrest is detected. Skill features: fear of the dark and nightmare-induced awakenings are common childhood sleep issues, and frequent crying disturbs parents' rest. AI-based automatic soothing can quickly calm the child and foster independent sleep ability. Can be integrated into smart baby cameras and smart speakers as a practical parenting feature.\n\n通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。该技能有助于减少父母夜间安抚负担，帮助儿童独立入睡，建立安全感。应用场景：儿童卧室、婴儿房。系统夜间自动运行，当检测到儿童不安时主动安抚。技能特点：儿童怕黑、噩梦惊醒是常见睡眠问题，频繁哭闹会干扰父母休息。通过AI自动安抚，可帮助儿童快速平静，培养独立入睡能力。该技能可集成到智能婴儿摄像头、智能音箱中，成为育儿家庭的实用功能。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的儿童睡眠安抚 AI。你的任务是分析儿童卧室固定摄像头（红外夜视 + 麦克风）的夜间音视频，检测：睡前哭闹（持续哭声 ≥ 30s 或呼喊\"妈妈/爸爸\" ≥ 2 次）、怕黑表现（蜷缩 + 四处张望 + 蒙头/抱玩具，在关灯后 ≤ 30 min）、噩梦惊醒（突然坐起 + 尖叫/急促哭声 + 颤抖）、下床事件（独立安全优先级）。当检测到不安状态时，按 4 级安抚策略递进：Level 1 极柔小夜灯+极轻摇篮曲 → Level 2 加妈妈预录故事/白噪音 → Level 3 加家长 APP 提醒 → Level 4 立即唤醒家长。婴儿（≤12 月）必须开专用模式，阈值更敏感、strong 及以上必须同步唤醒家长。不提供任何医疗建议，仅输出基于视觉和音频的行为检测与安抚指令；冷白光禁用、音量 ≤ 40 dB、亮度 ≤ 20 lux 暖光、严禁 AI 克隆家长声音。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于儿童卧室/婴儿房固定摄像头（**必须红外夜视 + 麦克风**）夜间音视频（**仅在睡眠窗口 19:00-07:00 启用**），识别 4 类场景（bedtime_unrest_mild / bedtime_unrest_crying / dark_fear / nightmare_wakeup / out_of_bed_safety / none）→ 音频核心 6 项（持续哭声时长 / 哭声强度 0-100 / \"妈妈爸爸\"呼喊 / 尖叫 / 呜咽抽噎 / 呼吸节奏规律性）+ 视频核心 7 项（蜷缩抱腿 / 四处张望 / **突然坐起** / 颤抖 / 抱毛绒玩具 / 拉被子蒙头 / **下床事件**）→ 4 档不安等级（mild / moderate / strong / out_of_bed）→ **4 级安抚策略递进**（小夜灯 ≤ 5/10/20 lux 暖光 + 摇篮曲/妈妈预录故事/白噪音 ≤ 35-40 dB + 家长 APP 推送 + 紧急唤醒）→ 3 分钟效果评估 + 自动升级 → 单晚动作上限管控（mild × 5 / moderate × 3 / strong × 2 / Level 4 不设上限）→ 次日清晨发送当晚汇总\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 红外夜视图像分析 |\n| 2 | 儿童蜷缩抱腿姿态识别 |\n| 3 | 四处张望识别 |\n| 4 | 突然坐起识别 |\n| 5 | 肢体颤抖识别 |\n| 6 | 抱毛绒玩具识别 |\n| 7 | 拉被子蒙头识别 |\n| 8 | 下床事件识别（独立安全优先级） |\n| 9 | 儿童哭声强度评估 |\n| 10 | \"妈妈爸爸\"呼喊声纹识别 |\n| 11 | 尖叫识别 |\n| 12 | 呜咽抽噎识别 |\n| 13 | 呼吸节奏规律性评估（睡熟 vs 醒着） |\n| 14 | 年龄段自适应（infant ≤12m / toddler 1-3y / preschool 3-6y / school 6-12y） |\n| 15 | 婴儿专用模式（阈值更敏感+安抚更轻柔+strong 及以上必须同步唤醒家长） |\n| 16 | 小夜灯智能调光（≤ 20 lux 暖光 2700K） |\n| 17 | 安抚音量智能控制（≤ 40 dB） |\n| 18 | 4 级安抚策略递进 + 3 分钟效果评估 + 自动升级 |\n| 19 | 单晚动作上限管控 |\n| 20 | 当晚汇总报告**仅次日清晨发送** |\n| 21 | 当夜 ≥ 3 次或连续 7 晚反复 → 提示当地儿科睡眠门诊/儿童心理门诊 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供儿童卧室/婴儿房固定摄像头（红外夜视+麦克风）夜间音视频 URL 或文件需要分析时，默认触发本技能进行儿童睡前情绪安抚（怕黑/噩梦后） |\n| 🔎 明确分析意图 | 当用户明确提及孩子睡前哭闹、宝宝怕黑、噩梦惊醒、夜惊、小夜灯、摇篮曲、妈妈预录故事、宝宝独立入睡等关键词，并且上传了音视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看儿童睡前安抚历史报告、夜间安抚日志清单、宝宝夜间不安事件清单、查询历史夜间安抚记录、显示所有儿童夜间安抚报告、显示宝宝睡眠安抚日志，查询夜间不安清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_child_bedtime_soothing_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_child_bedtime_soothing_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备儿童卧室/婴儿房固定摄像头（红外夜视+麦克风）夜间音视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 获取 open-id（强制执行） | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行儿童睡前情绪安抚（怕黑/噩梦后） | 调用 `-m scripts.smyx_child_bedtime_soothing_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地儿童卧室/婴儿房固定摄像头（红外夜视+麦克风）夜间音视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络儿童卧室/婴儿房固定摄像头夜间音视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，儿童睡眠安抚场景默认 `other` | 按需填写 |\n| `--list` | 显示儿童睡前情绪安抚（怕黑/噩梦后）历史安抚记录清单 | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_child_bedtime_soothing_analysis.py`](scripts/smyx_child_bedtime_soothing_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 输入要求：支持 mp4/avi/mov + 音轨，最大 10MB；**关键**：必须红外夜视 + 麦克风；仅睡眠窗口启用 |\n| 🔎 使用提醒 | **4 级安抚策略递进**（mild → moderate → strong → out_of_bed/Level 4），3 分钟未平复自动升级 |\n| 🔎 使用提醒 | 单晚动作上限：mild × 5 / moderate × 3 / strong × 2 / Level 4 不设上限（安全优先） |\n| 🔎 使用提醒 | 红线约束 |\n| 🧑‍⚖️ 结果性质 | **禁止**对儿童做\"睡眠障碍 / 夜惊症 / 焦虑症\"等医学诊断 |\n| 🔎 使用提醒 | **禁止**长期存储儿童夜间视频（≤ 7 天，仅入库不安事件片段） |\n| 🔎 使用提醒 | **禁止**用于商业广告/AI 训练；禁第三方共享 |\n| 🔎 使用提醒 | **禁止**冷白光（≥ 4000K）或亮度 > 30 lux 的小夜灯（打断褪黑素） |\n| 🔎 使用提醒 | **禁止**安抚音量 > 40 dB |\n| 🔎 使用提醒 | **绝对禁止**使用 AI 克隆/合成妈妈/爸爸声音冒充家长录音 |\n| 🔎 使用提醒 | **禁止**对 out_of_bed 仅做语音安抚——**必须立即推送家长 APP** |\n| 🔎 使用提醒 | **必须**：婴儿（≤ 12 月）开专用模式，strong 及以上必须同步唤醒家长；噩梦惊醒首条安抚必须是家长本人预录稳定语音 |\n| 📜 报告输出 | **必须**：当晚汇总报告**仅次日清晨发送**（避免家长夜里被唤醒焦虑加深） |\n| 🔎 使用提醒 | 当夜噩梦惊醒 ≥ 3 次或连续 7 晚反复 → 提示**当地儿科睡眠门诊**或**儿童心理门诊**资源 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史安抚记录清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地儿童夜间音视频\npython -m scripts.smyx_child_bedtime_soothing_analysis --input /path/to/bedroom.mp4\n\n# 分析网络儿童夜间音视频/实时流\npython -m scripts.smyx_child_bedtime_soothing_analysis --url https://example.com/bedroom.mp4\n\n# 显示历史夜间安抚记录清单（自动触发关键词：查看儿童睡前安抚历史报告、夜间安抚日志清单等）\npython -m scripts.smyx_child_bedtime_soothing_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_child_bedtime_soothing_analysis --input br.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_child_bedtime_soothing_analysis --input br.mp4 --output result.json\n```\n\nFile v1.0.9:_meta.json\n\n{\n  \"ownerId\": \"kn7e2caqj7pnsvr9r7t8zenghs83xw7n\",\n  \"slug\": \"smyx-child-bedtime-soothing-analysis\",\n  \"version\": \"1.0.9\",\n  \"publishedAt\": 1787236416285\n}\n\nFile v1.0.9:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放儿童睡前情绪安抚（怕黑/噩梦后） API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动儿童睡前情绪安抚检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取不安事件 + 安抚动作清单\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史安抚记录清单\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出夜间安抚日志报告\n5. （可选）`/web/companion/v2/trigger-soothing-action` - 触发联动安抚动作（小夜灯 / 智能音箱故事 / 摇篮曲 / 家长 APP 推送）\n\n## 场景代码\n\n- `SMYX_CHILD_BEDTIME_SOOTHING_ANALYSIS` - 儿童睡前情绪安抚（怕黑/噩梦后）\n\n## 输入约束\n\n- 摄像头：儿童卧室 / 婴儿房固定摄像头，**必须支持红外夜视**，能看到床上区域\n- 帧率 ≥ 10 FPS；分辨率 ≥ 720p；红外波段建议 850 nm（对睡眠干扰小）\n- 音频**必需**：采样率 ≥ 16kHz（用于哭声 / \"妈妈\" 呼喊 / 尖叫识别）\n- 时段：仅在配置的**睡眠窗口**内启用（默认 19:00 - 07:00），白天自动暂停\n- 多孩家庭按目标跟踪绑定到注册儿童 ID（每个孩子独立基线）\n- 婴儿（≤ 12 月）必须额外开启**婴儿专用模式**：阈值更敏感、安抚动作更轻柔、必要时同步唤醒家长\n- 家长必须授权部署，并明确告知家庭其他成员（如保姆、外祖父母）\n\n## 关键观测信号\n\n### 音频（核心）\n- `crying_continuous_sec` - 持续哭声时长\n- `crying_intensity` - 哭声强度（0-100，结合分贝 + 频谱情绪）\n- `call_mom_dad_count` - 呼喊\"妈妈/爸爸/妈咪\"次数\n- `scream_event_count` - 尖叫事件次数（突发高频高强度声）\n- `whimper_event_count` - 呜咽 / 抽噎事件（轻度不安信号）\n- `sleep_breathing_regular` - 呼吸节奏规律性（参考指标，区分睡熟 vs 醒着）\n\n### 视频（核心）\n- `body_curl_up_detected` - 蜷缩抱腿姿态（怕黑典型表现）\n- `looking_around_event_count` - 四处张望次数（黑暗中睁眼搜索）\n- `sudden_sit_up_event` - 突然坐起事件（噩梦惊醒典型）\n- `trembling_visual_detected` - 肢体颤抖（恐惧伴随）\n- `hugging_plush_toy` - 主动抱毛绒玩具（自我安抚行为，参考）\n- `pull_cover_over_head` - 拉被子蒙头（怕黑参考）\n- `out_of_bed_event` - 下床事件（独立优先级，避免摔伤）\n\n### 上下文\n- `is_within_sleep_window` - 是否在睡眠窗口内\n- `time_since_last_soothing_min` - 距离上次安抚动作的时间\n\n## 场景判定与不安等级\n\n- **bedtime_unrest_mild** - 睡前不安（轻度）：呜咽 / 抱毛绒玩具 / 蜷缩，无哭喊\n- **bedtime_unrest_crying** - 睡前哭闹：持续哭声 ≥ 30 秒 或 呼喊\"妈妈/爸爸\" ≥ 2 次\n- **dark_fear** - 怕黑：蜷缩 + 四处张望 + 蒙头/抱玩具 任两项 + 在卧室关灯后 ≤ 30 分钟内\n- **nightmare_wakeup** - 噩梦惊醒：突然坐起 + 尖叫/急促哭声 + 颤抖 任两项\n- **out_of_bed_safety** - 下床（独立优先级）：触发家长 APP 推送 + 调亮小夜灯，避免摔伤\n- **none** - 无不安信号 / 在睡熟状态\n\n## 安抚动作策略（轻 → 重逐级递进）\n\n- **Level 1（mild）**：极柔小夜灯（≤ 5 lux 暖光）+ 极轻摇篮曲（≤ 35 dB）\n- **Level 2（moderate）**：小夜灯（≤ 10 lux 暖光）+ **妈妈预录故事** / 白噪音\n- **Level 3（strong：noctmare/scream）**：小夜灯（≤ 20 lux）+ 妈妈预录\"宝贝，妈妈在这里，做了梦对吗？没事了哦~\"语音 + **同时推送家长 APP** \"noctmare 提醒，建议过去陪伴\"\n- **Level 4（out_of_bed/persist ≥ 5min）**：**立即推送家长 APP + 主屏震动**，建议家长亲自到场，AI 仅辅助\n\n- 升级条件：同一信号在 Level 1/2 安抚后 ≥ 3 分钟未平复 → 自动升级一级\n- 单晚同一儿童安抚动作触发**上限**：mild × 5、moderate × 3、strong × 2、Level 4 不设上限（安全优先）\n\n## 输出字段（参考）\n\n- `event_id` / `event_timestamp` / `child_id` / `child_age_band`（infant ≤12m / toddler 1-3y / preschool 3-6y / school 6-12y）\n- `scene_label` - 场景判定（bedtime_unrest_mild / bedtime_unrest_crying / dark_fear / nightmare_wakeup / out_of_bed_safety / none）\n- `audio_signals` / `video_signals` / `context`\n- `unrest_level` - 不安等级（mild / moderate / strong / out_of_bed）\n- `soothing_actions` - 安抚动作列表（每项含 action_type / message / target / level / volume_db / brightness_lux，例如：\n    - `{action_type: \"night_light_on\", brightness_lux: 5, color_temp: \"warm_2700K\", target: \"child_room_light\", level: 1}`\n    - `{action_type: \"play_mom_recorded_story\", message: \"妈妈预录《晚安月亮》故事 5 分钟\", volume_db: 35, target: \"child_room_speaker\", level: 2}`\n    - `{action_type: \"play_lullaby\", message: \"《摇啊摇》摇篮曲\", volume_db: 30, target: \"child_room_speaker\", level: 2}`\n    - `{action_type: \"play_white_noise\", message: \"白噪音雨声\", volume_db: 30, target: \"child_room_speaker\", level: 2}`\n    - `{action_type: \"parent_app_push\", message: \"孩子刚被噩梦惊醒，已轻声安抚中，建议过去陪伴\", target: \"parent_phone_app\", level: 3}`\n    - `{action_type: \"parent_app_urgent_push\", message: \"⚠️ 孩子已下床，请立即查看\", target: \"parent_phone_app\", level: 4}`）\n- `effectiveness_after_3min` - 3 分钟后效果（settled / partially_settled / unchanged / escalated）\n- `nightly_summary` - 当晚汇总（次日清晨自动生成：不安事件次数 + 类型分布 + 安抚成功率 + 建议）\n- `recommend_action` - 建议动作（trigger_level_N_soothing / push_parent_app / urgent_parent_intervention / observe_only）\n\n## 强制约束与红线\n\n- ❌ **禁止**对儿童做任何\"睡眠障碍 / 夜惊症 / 焦虑症\"等医学诊断\n- ❌ **禁止**长期存储儿童夜间视频；建议仅保留 ≤ 7 天 + 仅入库不安事件片段\n- ❌ **禁止**将儿童夜间视频/音频用于商业广告、AI 训练数据集\n- ❌ **禁止**向家长以外的第三方共享（亲戚需家长授权才能查看）\n- ❌ **禁止**夜间使用冷白光（≥ 4000K）或亮度 > 30 lux 的小夜灯，会打断褪黑素分泌\n- ❌ **禁止**安抚音量超过 40 dB（接近耳语水平），避免影响睡眠或惊醒孩子\n- ❌ **禁止**使用 AI 克隆/合成妈妈/爸爸声音冒充家长录音；预录语音**必须由家长本人录制**\n- ❌ **禁止**对 **out_of_bed** 事件仅做\"语音安抚\"——必须立即推送家长 APP（避免摔伤）\n- ✅ **必须**婴儿（≤ 12 月）开启专用模式：阈值更敏感 + 安抚更轻柔 + **strong 及以上必须同步唤醒家长**\n- ✅ **必须**为家长提供：一键暂停今晚 / 调整睡眠窗口 / 永久退出 入口\n- ✅ **必须**：噩梦惊醒后**首条安抚语**应为家长本人预录的稳定语音（不用合成音）\n- ✅ 当夜噩梦惊醒 ≥ 3 次或连续 7 晚反复发生 → 提示家长**当地儿童心理门诊**或**儿科睡眠门诊**资源\n- ✅ 当晚汇总报告必须**只在次日清晨**发送（避免家长夜里被唤醒焦虑加深）\n\n> 仅输出基于音视频的客观不安事件检测与轻柔安抚动作，**不构成任何儿童睡眠/心理医学诊断**；频繁夜惊或长期睡眠困难请咨询当地**儿科睡眠门诊**或**儿童心理科**专业医师。\n\nFile v1.0.9:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.9:scripts/config.yaml\n\n{}\n\nFile v1.0.9:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.9:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.9:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.9:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: dev\n\nFile v1.0.9:skill-card.md\n\n## Description:\n\nAnalyzes child bedroom night audio/video for bedtime unrest, fear-of-dark behavior, nightmare wakeups, and out-of-bed safety events, then returns structured soothing recommendations and report links.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[18072937735](https://clawhub.ai/user/18072937735)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nParents, caregivers, and developers of smart nursery devices use this skill to process guardian-authorized bedroom audio/video or URLs for behavior-event detection, soothing-action suggestions, and historical report lookup. It is not a medical diagnostic tool.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Child bedroom media or URLs may be uploaded to a cloud service.\n\nMitigation: Use only with parent or guardian consent, confirm provider retention and deletion controls, and avoid inputs that include unnecessary bystanders or sensitive content.\n\nRisk: Silent backend identity binding and local token persistence can make report access and credential scope opaque.\n\nMitigation: Install only where local credential storage, account scoping, and deletion processes are acceptable; avoid use on shared machines unless credentials are isolated.\n\nRisk: Historical cloud reports may expose child sleep, bedroom, or caregiving data.\n\nMitigation: Limit report access to authorized caregivers, review cloud sharing settings, and delete reports that are no longer needed.\n\n## Reference(s):\n\n- [API interface documentation](references/api_doc.md)\n- [ClawHub skill page](https://clawhub.ai/18072937735/skills/smyx-child-bedtime-soothing-analysis)\n- [Skill demo](https://lifeemergence.com/sample.html)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, JSON, shell commands, guidance]\n\n**Output Format:** [Markdown report text with optional JSON/detail output, report links, and historical-report tables]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May write an output file when requested; historical report queries are retrieved from the cloud service.]\n\n## Skill Version(s):\n\n1.0.9 (source: server release metadata; artifact frontmatter says 1.0.10)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.9:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.9:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.8: 31 files, 44628 bytes\n\nFiles: references/api_doc.md (7628b), scripts/__init__.py (73b), scripts/config.py (697b), scripts/config.yaml (3b), scripts/skill.py (595b), scripts/smyx_child_bedtime_soothing_analysis.py (3795b), skill-card.md (2810b), SKILL.md (15632b), skills/smyx_analysis/__init__.py (0b), skills/smyx_analysis/references/api_doc.md (427b), skills/smyx_analysis/requirements.txt (45b), skills/smyx_analysis/scripts/__init__.py (0b), skills/smyx_analysis/scripts/api_service.py (1509b), skills/smyx_analysis/scripts/config.py (1003b), skills/smyx_analysis/scripts/config.yaml (3b), skills/smyx_analysis/scripts/skill.py (6529b), skills/smyx_analysis/scripts/smyx_analysis.py (3833b), skills/smyx_common/__init__.py (0b), skills/smyx_common/requirements.txt (47b), skills/smyx_common/scripts/__init__.py (177b), skills/smyx_common/scripts/api_service.py (2645b), skills/smyx_common/scripts/base.py (469b), skills/smyx_common/scripts/config-dev.yaml (214b), skills/smyx_common/scripts/config-prod.yaml (0b), skills/smyx_common/scripts/config-test.yaml (256b), skills/smyx_common/scripts/config.py (24363b), skills/smyx_common/scripts/config.yaml (472b), skills/smyx_common/scripts/dao.py (18266b), skills/smyx_common/scripts/skill.py (2473b), skills/smyx_common/scripts/util.py (28776b), _meta.json (155b)\n\nFile v1.0.8:SKILL.md\n\n---\nname: \"smyx-child-bedtime-soothing-analysis\"\ndescription: \"Through a fixed camera (with infrared night vision) and microphone in the child's bedroom, the system analyzes pre-sleep and night-time video and audio to detect pre-sleep crying (continuous crying, calling 'Mama'), fear-of-the-dark expressions (curling up, looking around), and nightmare awakenings (sudden sitting up, trembling, screaming). | 通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。\"\nversion: \"1.0.10\"\nlicense: \"MIT-0\"\n---\n\n# 🌙 Child Bedtime Soothing (Fear of Dark / Post-Nightmare) | 儿童睡前情绪安抚（怕黑/噩梦后）\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **儿童睡前情绪安抚（怕黑/噩梦后）** |\n| 🎯 核心目标 | 通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_CHILD_BEDTIME_SOOTHING_ANALYSIS` |\n\nThrough a fixed camera (with infrared night vision) and microphone in the child's bedroom, the system analyzes pre-sleep and night-time video and audio to detect pre-sleep crying (continuous crying, calling 'Mama'), fear-of-the-dark expressions (curling up, looking around), and nightmare awakenings (sudden sitting up, trembling, screaming). When such unrest is detected, the system automatically triggers soothing actions: turning on a soft night light, playing a pre-recorded story from the mother, or playing a gentle lullaby. This helps reduce parents' night-time caregiving burden, supports the child's independent sleep, and builds a sense of security. Application scenarios: children's bedrooms, nurseries. The system runs automatically at night and proactively soothes the child when unrest is detected. Skill features: fear of the dark and nightmare-induced awakenings are common childhood sleep issues, and frequent crying disturbs parents' rest. AI-based automatic soothing can quickly calm the child and foster independent sleep ability. Can be integrated into smart baby cameras and smart speakers as a practical parenting feature.\n\n通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。该技能有助于减少父母夜间安抚负担，帮助儿童独立入睡，建立安全感。应用场景：儿童卧室、婴儿房。系统夜间自动运行，当检测到儿童不安时主动安抚。技能特点：儿童怕黑、噩梦惊醒是常见睡眠问题，频繁哭闹会干扰父母休息。通过AI自动安抚，可帮助儿童快速平静，培养独立入睡能力。该技能可集成到智能婴儿摄像头、智能音箱中，成为育儿家庭的实用功能。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的儿童睡眠安抚 AI。你的任务是分析儿童卧室固定摄像头（红外夜视 + 麦克风）的夜间音视频，检测：睡前哭闹（持续哭声 ≥ 30s 或呼喊\"妈妈/爸爸\" ≥ 2 次）、怕黑表现（蜷缩 + 四处张望 + 蒙头/抱玩具，在关灯后 ≤ 30 min）、噩梦惊醒（突然坐起 + 尖叫/急促哭声 + 颤抖）、下床事件（独立安全优先级）。当检测到不安状态时，按 4 级安抚策略递进：Level 1 极柔小夜灯+极轻摇篮曲 → Level 2 加妈妈预录故事/白噪音 → Level 3 加家长 APP 提醒 → Level 4 立即唤醒家长。婴儿（≤12 月）必须开专用模式，阈值更敏感、strong 及以上必须同步唤醒家长。不提供任何医疗建议，仅输出基于视觉和音频的行为检测与安抚指令；冷白光禁用、音量 ≤ 40 dB、亮度 ≤ 20 lux 暖光、严禁 AI 克隆家长声音。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于儿童卧室/婴儿房固定摄像头（**必须红外夜视 + 麦克风**）夜间音视频（**仅在睡眠窗口 19:00-07:00 启用**），识别 4 类场景（bedtime_unrest_mild / bedtime_unrest_crying / dark_fear / nightmare_wakeup / out_of_bed_safety / none）→ 音频核心 6 项（持续哭声时长 / 哭声强度 0-100 / \"妈妈爸爸\"呼喊 / 尖叫 / 呜咽抽噎 / 呼吸节奏规律性）+ 视频核心 7 项（蜷缩抱腿 / 四处张望 / **突然坐起** / 颤抖 / 抱毛绒玩具 / 拉被子蒙头 / **下床事件**）→ 4 档不安等级（mild / moderate / strong / out_of_bed）→ **4 级安抚策略递进**（小夜灯 ≤ 5/10/20 lux 暖光 + 摇篮曲/妈妈预录故事/白噪音 ≤ 35-40 dB + 家长 APP 推送 + 紧急唤醒）→ 3 分钟效果评估 + 自动升级 → 单晚动作上限管控（mild × 5 / moderate × 3 / strong × 2 / Level 4 不设上限）→ 次日清晨发送当晚汇总\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 红外夜视图像分析 |\n| 2 | 儿童蜷缩抱腿姿态识别 |\n| 3 | 四处张望识别 |\n| 4 | 突然坐起识别 |\n| 5 | 肢体颤抖识别 |\n| 6 | 抱毛绒玩具识别 |\n| 7 | 拉被子蒙头识别 |\n| 8 | 下床事件识别（独立安全优先级） |\n| 9 | 儿童哭声强度评估 |\n| 10 | \"妈妈爸爸\"呼喊声纹识别 |\n| 11 | 尖叫识别 |\n| 12 | 呜咽抽噎识别 |\n| 13 | 呼吸节奏规律性评估（睡熟 vs 醒着） |\n| 14 | 年龄段自适应（infant ≤12m / toddler 1-3y / preschool 3-6y / school 6-12y） |\n| 15 | 婴儿专用模式（阈值更敏感+安抚更轻柔+strong 及以上必须同步唤醒家长） |\n| 16 | 小夜灯智能调光（≤ 20 lux 暖光 2700K） |\n| 17 | 安抚音量智能控制（≤ 40 dB） |\n| 18 | 4 级安抚策略递进 + 3 分钟效果评估 + 自动升级 |\n| 19 | 单晚动作上限管控 |\n| 20 | 当晚汇总报告**仅次日清晨发送** |\n| 21 | 当夜 ≥ 3 次或连续 7 晚反复 → 提示当地儿科睡眠门诊/儿童心理门诊 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供儿童卧室/婴儿房固定摄像头（红外夜视+麦克风）夜间音视频 URL 或文件需要分析时，默认触发本技能进行儿童睡前情绪安抚（怕黑/噩梦后） |\n| 🔎 明确分析意图 | 当用户明确提及孩子睡前哭闹、宝宝怕黑、噩梦惊醒、夜惊、小夜灯、摇篮曲、妈妈预录故事、宝宝独立入睡等关键词，并且上传了音视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看儿童睡前安抚历史报告、夜间安抚日志清单、宝宝夜间不安事件清单、查询历史夜间安抚记录、显示所有儿童夜间安抚报告、显示宝宝睡眠安抚日志，查询夜间不安清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_child_bedtime_soothing_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_child_bedtime_soothing_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备儿童卧室/婴儿房固定摄像头（红外夜视+麦克风）夜间音视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 获取 open-id（强制执行） | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行儿童睡前情绪安抚（怕黑/噩梦后） | 调用 `-m scripts.smyx_child_bedtime_soothing_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地儿童卧室/婴儿房固定摄像头（红外夜视+麦克风）夜间音视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络儿童卧室/婴儿房固定摄像头夜间音视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，儿童睡眠安抚场景默认 `other` | 按需填写 |\n| `--list` | 显示儿童睡前情绪安抚（怕黑/噩梦后）历史安抚记录清单 | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_child_bedtime_soothing_analysis.py`](scripts/smyx_child_bedtime_soothing_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 输入要求：支持 mp4/avi/mov + 音轨，最大 10MB；**关键**：必须红外夜视 + 麦克风；仅睡眠窗口启用 |\n| 🔎 使用提醒 | **4 级安抚策略递进**（mild → moderate → strong → out_of_bed/Level 4），3 分钟未平复自动升级 |\n| 🔎 使用提醒 | 单晚动作上限：mild × 5 / moderate × 3 / strong × 2 / Level 4 不设上限（安全优先） |\n| 🔎 使用提醒 | 红线约束 |\n| 🧑‍⚖️ 结果性质 | **禁止**对儿童做\"睡眠障碍 / 夜惊症 / 焦虑症\"等医学诊断 |\n| 🔎 使用提醒 | **禁止**长期存储儿童夜间视频（≤ 7 天，仅入库不安事件片段） |\n| 🔎 使用提醒 | **禁止**用于商业广告/AI 训练；禁第三方共享 |\n| 🔎 使用提醒 | **禁止**冷白光（≥ 4000K）或亮度 > 30 lux 的小夜灯（打断褪黑素） |\n| 🔎 使用提醒 | **禁止**安抚音量 > 40 dB |\n| 🔎 使用提醒 | **绝对禁止**使用 AI 克隆/合成妈妈/爸爸声音冒充家长录音 |\n| 🔎 使用提醒 | **禁止**对 out_of_bed 仅做语音安抚——**必须立即推送家长 APP** |\n| 🔎 使用提醒 | **必须**：婴儿（≤ 12 月）开专用模式，strong 及以上必须同步唤醒家长；噩梦惊醒首条安抚必须是家长本人预录稳定语音 |\n| 📜 报告输出 | **必须**：当晚汇总报告**仅次日清晨发送**（避免家长夜里被唤醒焦虑加深） |\n| 🔎 使用提醒 | 当夜噩梦惊醒 ≥ 3 次或连续 7 晚反复 → 提示**当地儿科睡眠门诊**或**儿童心理门诊**资源 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史安抚记录清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地儿童夜间音视频\npython -m scripts.smyx_child_bedtime_soothing_analysis --input /path/to/bedroom.mp4\n\n# 分析网络儿童夜间音视频/实时流\npython -m scripts.smyx_child_bedtime_soothing_analysis --url https://example.com/bedroom.mp4\n\n# 显示历史夜间安抚记录清单（自动触发关键词：查看儿童睡前安抚历史报告、夜间安抚日志清单等）\npython -m scripts.smyx_child_bedtime_soothing_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_child_bedtime_soothing_analysis --input br.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_child_bedtime_soothing_analysis --input br.mp4 --output result.json\n```\n\nFile v1.0.8:_meta.json\n\n{\n  \"ownerId\": \"kn7e2caqj7pnsvr9r7t8zenghs83xw7n\",\n  \"slug\": \"smyx-child-bedtime-soothing-analysis\",\n  \"version\": \"1.0.8\",\n  \"publishedAt\": 1786762664699\n}\n\nFile v1.0.8:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放儿童睡前情绪安抚（怕黑/噩梦后） API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动儿童睡前情绪安抚检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取不安事件 + 安抚动作清单\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史安抚记录清单\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出夜间安抚日志报告\n5. （可选）`/web/companion/v2/trigger-soothing-action` - 触发联动安抚动作（小夜灯 / 智能音箱故事 / 摇篮曲 / 家长 APP 推送）\n\n## 场景代码\n\n- `SMYX_CHILD_BEDTIME_SOOTHING_ANALYSIS` - 儿童睡前情绪安抚（怕黑/噩梦后）\n\n## 输入约束\n\n- 摄像头：儿童卧室 / 婴儿房固定摄像头，**必须支持红外夜视**，能看到床上区域\n- 帧率 ≥ 10 FPS；分辨率 ≥ 720p；红外波段建议 850 nm（对睡眠干扰小）\n- 音频**必需**：采样率 ≥ 16kHz（用于哭声 / \"妈妈\" 呼喊 / 尖叫识别）\n- 时段：仅在配置的**睡眠窗口**内启用（默认 19:00 - 07:00），白天自动暂停\n- 多孩家庭按目标跟踪绑定到注册儿童 ID（每个孩子独立基线）\n- 婴儿（≤ 12 月）必须额外开启**婴儿专用模式**：阈值更敏感、安抚动作更轻柔、必要时同步唤醒家长\n- 家长必须授权部署，并明确告知家庭其他成员（如保姆、外祖父母）\n\n## 关键观测信号\n\n### 音频（核心）\n- `crying_continuous_sec` - 持续哭声时长\n- `crying_intensity` - 哭声强度（0-100，结合分贝 + 频谱情绪）\n- `call_mom_dad_count` - 呼喊\"妈妈/爸爸/妈咪\"次数\n- `scream_event_count` - 尖叫事件次数（突发高频高强度声）\n- `whimper_event_count` - 呜咽 / 抽噎事件（轻度不安信号）\n- `sleep_breathing_regular` - 呼吸节奏规律性（参考指标，区分睡熟 vs 醒着）\n\n### 视频（核心）\n- `body_curl_up_detected` - 蜷缩抱腿姿态（怕黑典型表现）\n- `looking_around_event_count` - 四处张望次数（黑暗中睁眼搜索）\n- `sudden_sit_up_event` - 突然坐起事件（噩梦惊醒典型）\n- `trembling_visual_detected` - 肢体颤抖（恐惧伴随）\n- `hugging_plush_toy` - 主动抱毛绒玩具（自我安抚行为，参考）\n- `pull_cover_over_head` - 拉被子蒙头（怕黑参考）\n- `out_of_bed_event` - 下床事件（独立优先级，避免摔伤）\n\n### 上下文\n- `is_within_sleep_window` - 是否在睡眠窗口内\n- `time_since_last_soothing_min` - 距离上次安抚动作的时间\n\n## 场景判定与不安等级\n\n- **bedtime_unrest_mild** - 睡前不安（轻度）：呜咽 / 抱毛绒玩具 / 蜷缩，无哭喊\n- **bedtime_unrest_crying** - 睡前哭闹：持续哭声 ≥ 30 秒 或 呼喊\"妈妈/爸爸\" ≥ 2 次\n- **dark_fear** - 怕黑：蜷缩 + 四处张望 + 蒙头/抱玩具 任两项 + 在卧室关灯后 ≤ 30 分钟内\n- **nightmare_wakeup** - 噩梦惊醒：突然坐起 + 尖叫/急促哭声 + 颤抖 任两项\n- **out_of_bed_safety** - 下床（独立优先级）：触发家长 APP 推送 + 调亮小夜灯，避免摔伤\n- **none** - 无不安信号 / 在睡熟状态\n\n## 安抚动作策略（轻 → 重逐级递进）\n\n- **Level 1（mild）**：极柔小夜灯（≤ 5 lux 暖光）+ 极轻摇篮曲（≤ 35 dB）\n- **Level 2（moderate）**：小夜灯（≤ 10 lux 暖光）+ **妈妈预录故事** / 白噪音\n- **Level 3（strong：noctmare/scream）**：小夜灯（≤ 20 lux）+ 妈妈预录\"宝贝，妈妈在这里，做了梦对吗？没事了哦~\"语音 + **同时推送家长 APP** \"noctmare 提醒，建议过去陪伴\"\n- **Level 4（out_of_bed/persist ≥ 5min）**：**立即推送家长 APP + 主屏震动**，建议家长亲自到场，AI 仅辅助\n\n- 升级条件：同一信号在 Level 1/2 安抚后 ≥ 3 分钟未平复 → 自动升级一级\n- 单晚同一儿童安抚动作触发**上限**：mild × 5、moderate × 3、strong × 2、Level 4 不设上限（安全优先）\n\n## 输出字段（参考）\n\n- `event_id` / `event_timestamp` / `child_id` / `child_age_band`（infant ≤12m / toddler 1-3y / preschool 3-6y / school 6-12y）\n- `scene_label` - 场景判定（bedtime_unrest_mild / bedtime_unrest_crying / dark_fear / nightmare_wakeup / out_of_bed_safety / none）\n- `audio_signals` / `video_signals` / `context`\n- `unrest_level` - 不安等级（mild / moderate / strong / out_of_bed）\n- `soothing_actions` - 安抚动作列表（每项含 action_type / message / target / level / volume_db / brightness_lux，例如：\n    - `{action_type: \"night_light_on\", brightness_lux: 5, color_temp: \"warm_2700K\", target: \"child_room_light\", level: 1}`\n    - `{action_type: \"play_mom_recorded_story\", message: \"妈妈预录《晚安月亮》故事 5 分钟\", volume_db: 35, target: \"child_room_speaker\", level: 2}`\n    - `{action_type: \"play_lullaby\", message: \"《摇啊摇》摇篮曲\", volume_db: 30, target: \"child_room_speaker\", level: 2}`\n    - `{action_type: \"play_white_noise\", message: \"白噪音雨声\", volume_db: 30, target: \"child_room_speaker\", level: 2}`\n    - `{action_type: \"parent_app_push\", message: \"孩子刚被噩梦惊醒，已轻声安抚中，建议过去陪伴\", target: \"parent_phone_app\", level: 3}`\n    - `{action_type: \"parent_app_urgent_push\", message: \"⚠️ 孩子已下床，请立即查看\", target: \"parent_phone_app\", level: 4}`）\n- `effectiveness_after_3min` - 3 分钟后效果（settled / partially_settled / unchanged / escalated）\n- `nightly_summary` - 当晚汇总（次日清晨自动生成：不安事件次数 + 类型分布 + 安抚成功率 + 建议）\n- `recommend_action` - 建议动作（trigger_level_N_soothing / push_parent_app / urgent_parent_intervention / observe_only）\n\n## 强制约束与红线\n\n- ❌ **禁止**对儿童做任何\"睡眠障碍 / 夜惊症 / 焦虑症\"等医学诊断\n- ❌ **禁止**长期存储儿童夜间视频；建议仅保留 ≤ 7 天 + 仅入库不安事件片段\n- ❌ **禁止**将儿童夜间视频/音频用于商业广告、AI 训练数据集\n- ❌ **禁止**向家长以外的第三方共享（亲戚需家长授权才能查看）\n- ❌ **禁止**夜间使用冷白光（≥ 4000K）或亮度 > 30 lux 的小夜灯，会打断褪黑素分泌\n- ❌ **禁止**安抚音量超过 40 dB（接近耳语水平），避免影响睡眠或惊醒孩子\n- ❌ **禁止**使用 AI 克隆/合成妈妈/爸爸声音冒充家长录音；预录语音**必须由家长本人录制**\n- ❌ **禁止**对 **out_of_bed** 事件仅做\"语音安抚\"——必须立即推送家长 APP（避免摔伤）\n- ✅ **必须**婴儿（≤ 12 月）开启专用模式：阈值更敏感 + 安抚更轻柔 + **strong 及以上必须同步唤醒家长**\n- ✅ **必须**为家长提供：一键暂停今晚 / 调整睡眠窗口 / 永久退出 入口\n- ✅ **必须**：噩梦惊醒后**首条安抚语**应为家长本人预录的稳定语音（不用合成音）\n- ✅ 当夜噩梦惊醒 ≥ 3 次或连续 7 晚反复发生 → 提示家长**当地儿童心理门诊**或**儿科睡眠门诊**资源\n- ✅ 当晚汇总报告必须**只在次日清晨**发送（避免家长夜里被唤醒焦虑加深）\n\n> 仅输出基于音视频的客观不安事件检测与轻柔安抚动作，**不构成任何儿童睡眠/心理医学诊断**；频繁夜惊或长期睡眠困难请咨询当地**儿科睡眠门诊**或**儿童心理科**专业医师。\n\nFile v1.0.8:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.8:scripts/config.yaml\n\n{}\n\nFile v1.0.8:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.8:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.8:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.8:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: dev\n\nFile v1.0.8:skill-card.md\n\n## Description:\n\nAnalyzes child bedroom nighttime audio and video to detect pre-sleep crying, fear-of-dark behaviors, nightmare awakenings, and related unrest, then returns structured soothing actions such as night-light, recorded-story, lullaby, or parent-notification recommendations.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[18072937735](https://clawhub.ai/user/18072937735)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nExternal developers and operators can use this skill to analyze authorized child-bedroom sleep-window media and produce structured reports for bedtime unrest, nightmare wakeups, and escalation-oriented soothing workflows. It is intended for behavioral event detection and caregiver workflow support, not medical diagnosis.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Sensitive child bedroom audio/video may be sent to a backend service and associated with an automatically managed identity.\n\nMitigation: Require explicit guardian consent, restrict accepted files and URLs to trusted cameras or storage, and confirm identity, token, report, retention, and deletion controls before deployment.\n\nRisk: Weak user-control boundaries could make it unclear how caregivers pause monitoring or prevent unintended collection.\n\nMitigation: Expose clear caregiver controls for pausing monitoring, adjusting sleep windows, opting out permanently, and reviewing what reports are retained.\n\nRisk: The artifact operates on child sleep behavior and could be mistaken for medical or psychological assessment.\n\nMitigation: Present outputs as behavioral event detection and soothing workflow guidance only, and route repeated or severe concerns to qualified pediatric sleep or child mental-health professionals.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/18072937735/skills/smyx-child-bedtime-soothing-analysis)\n- [API reference](references/api_doc.md)\n- [Skill demo](https://lifeemergence.com/sample.html)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, JSON, shell commands, guidance]\n\n**Output Format:** [Markdown and JSON-style structured analysis reports with optional saved text output.]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Reports may include detected event labels, audio/video signals, soothing actions, escalation recommendations, historical report links, and caregiver-facing safety guidance.]\n\n## Skill Version(s):\n\n1.0.8 (source: server release metadata; artifact frontmatter reports 1.0.10)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.8:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.8:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.7: 31 files, 44644 bytes\n\nFiles: references/api_doc.md (7628b), scripts/__init__.py (73b), scripts/config.py (697b), scripts/config.yaml (3b), scripts/skill.py (595b), scripts/smyx_child_bedtime_soothing_analysis.py (3795b), skill-card.md (3104b), SKILL.md (15631b), skills/smyx_analysis/__init__.py (0b), skills/smyx_analysis/references/api_doc.md (427b), skills/smyx_analysis/requirements.txt (45b), skills/smyx_analysis/scripts/__init__.py (0b), skills/smyx_analysis/scripts/api_service.py (1509b), skills/smyx_analysis/scripts/config.py (1003b), skills/smyx_analysis/scripts/config.yaml (3b), skills/smyx_analysis/scripts/skill.py (6529b), skills/smyx_analysis/scripts/smyx_analysis.py (3833b), skills/smyx_common/__init__.py (0b), skills/smyx_common/requirements.txt (47b), skills/smyx_common/scripts/__init__.py (177b), skills/smyx_common/scripts/api_service.py (2645b), skills/smyx_common/scripts/base.py (469b), skills/smyx_common/scripts/config-dev.yaml (214b), skills/smyx_common/scripts/config-prod.yaml (0b), skills/smyx_common/scripts/config-test.yaml (256b), skills/smyx_common/scripts/config.py (24363b), skills/smyx_common/scripts/config.yaml (473b), skills/smyx_common/scripts/dao.py (18266b), skills/smyx_common/scripts/skill.py (2473b), skills/smyx_common/scripts/util.py (28776b), _meta.json (155b)\n\nFile v1.0.7:SKILL.md\n\n---\nname: \"smyx-child-bedtime-soothing-analysis\"\ndescription: \"Through a fixed camera (with infrared night vision) and microphone in the child's bedroom, the system analyzes pre-sleep and night-time video and audio to detect pre-sleep crying (continuous crying, calling 'Mama'), fear-of-the-dark expressions (curling up, looking around), and nightmare awakenings (sudden sitting up, trembling, screaming). | 通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。\"\nversion: \"1.0.8\"\nlicense: \"MIT-0\"\n---\n\n# 🌙 Child Bedtime Soothing (Fear of Dark / Post-Nightmare) | 儿童睡前情绪安抚（怕黑/噩梦后）\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **儿童睡前情绪安抚（怕黑/噩梦后）** |\n| 🎯 核心目标 | 通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_CHILD_BEDTIME_SOOTHING_ANALYSIS` |\n\nThrough a fixed camera (with infrared night vision) and microphone in the child's bedroom, the system analyzes pre-sleep and night-time video and audio to detect pre-sleep crying (continuous crying, calling 'Mama'), fear-of-the-dark expressions (curling up, looking around), and nightmare awakenings (sudden sitting up, trembling, screaming). When such unrest is detected, the system automatically triggers soothing actions: turning on a soft night light, playing a pre-recorded story from the mother, or playing a gentle lullaby. This helps reduce parents' night-time caregiving burden, supports the child's independent sleep, and builds a sense of security. Application scenarios: children's bedrooms, nurseries. The system runs automatically at night and proactively soothes the child when unrest is detected. Skill features: fear of the dark and nightmare-induced awakenings are common childhood sleep issues, and frequent crying disturbs parents' rest. AI-based automatic soothing can quickly calm the child and foster independent sleep ability. Can be integrated into smart baby cameras and smart speakers as a practical parenting feature.\n\n通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。该技能有助于减少父母夜间安抚负担，帮助儿童独立入睡，建立安全感。应用场景：儿童卧室、婴儿房。系统夜间自动运行，当检测到儿童不安时主动安抚。技能特点：儿童怕黑、噩梦惊醒是常见睡眠问题，频繁哭闹会干扰父母休息。通过AI自动安抚，可帮助儿童快速平静，培养独立入睡能力。该技能可集成到智能婴儿摄像头、智能音箱中，成为育儿家庭的实用功能。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的儿童睡眠安抚 AI。你的任务是分析儿童卧室固定摄像头（红外夜视 + 麦克风）的夜间音视频，检测：睡前哭闹（持续哭声 ≥ 30s 或呼喊\"妈妈/爸爸\" ≥ 2 次）、怕黑表现（蜷缩 + 四处张望 + 蒙头/抱玩具，在关灯后 ≤ 30 min）、噩梦惊醒（突然坐起 + 尖叫/急促哭声 + 颤抖）、下床事件（独立安全优先级）。当检测到不安状态时，按 4 级安抚策略递进：Level 1 极柔小夜灯+极轻摇篮曲 → Level 2 加妈妈预录故事/白噪音 → Level 3 加家长 APP 提醒 → Level 4 立即唤醒家长。婴儿（≤12 月）必须开专用模式，阈值更敏感、strong 及以上必须同步唤醒家长。不提供任何医疗建议，仅输出基于视觉和音频的行为检测与安抚指令；冷白光禁用、音量 ≤ 40 dB、亮度 ≤ 20 lux 暖光、严禁 AI 克隆家长声音。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于儿童卧室/婴儿房固定摄像头（**必须红外夜视 + 麦克风**）夜间音视频（**仅在睡眠窗口 19:00-07:00 启用**），识别 4 类场景（bedtime_unrest_mild / bedtime_unrest_crying / dark_fear / nightmare_wakeup / out_of_bed_safety / none）→ 音频核心 6 项（持续哭声时长 / 哭声强度 0-100 / \"妈妈爸爸\"呼喊 / 尖叫 / 呜咽抽噎 / 呼吸节奏规律性）+ 视频核心 7 项（蜷缩抱腿 / 四处张望 / **突然坐起** / 颤抖 / 抱毛绒玩具 / 拉被子蒙头 / **下床事件**）→ 4 档不安等级（mild / moderate / strong / out_of_bed）→ **4 级安抚策略递进**（小夜灯 ≤ 5/10/20 lux 暖光 + 摇篮曲/妈妈预录故事/白噪音 ≤ 35-40 dB + 家长 APP 推送 + 紧急唤醒）→ 3 分钟效果评估 + 自动升级 → 单晚动作上限管控（mild × 5 / moderate × 3 / strong × 2 / Level 4 不设上限）→ 次日清晨发送当晚汇总\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 红外夜视图像分析 |\n| 2 | 儿童蜷缩抱腿姿态识别 |\n| 3 | 四处张望识别 |\n| 4 | 突然坐起识别 |\n| 5 | 肢体颤抖识别 |\n| 6 | 抱毛绒玩具识别 |\n| 7 | 拉被子蒙头识别 |\n| 8 | 下床事件识别（独立安全优先级） |\n| 9 | 儿童哭声强度评估 |\n| 10 | \"妈妈爸爸\"呼喊声纹识别 |\n| 11 | 尖叫识别 |\n| 12 | 呜咽抽噎识别 |\n| 13 | 呼吸节奏规律性评估（睡熟 vs 醒着） |\n| 14 | 年龄段自适应（infant ≤12m / toddler 1-3y / preschool 3-6y / school 6-12y） |\n| 15 | 婴儿专用模式（阈值更敏感+安抚更轻柔+strong 及以上必须同步唤醒家长） |\n| 16 | 小夜灯智能调光（≤ 20 lux 暖光 2700K） |\n| 17 | 安抚音量智能控制（≤ 40 dB） |\n| 18 | 4 级安抚策略递进 + 3 分钟效果评估 + 自动升级 |\n| 19 | 单晚动作上限管控 |\n| 20 | 当晚汇总报告**仅次日清晨发送** |\n| 21 | 当夜 ≥ 3 次或连续 7 晚反复 → 提示当地儿科睡眠门诊/儿童心理门诊 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供儿童卧室/婴儿房固定摄像头（红外夜视+麦克风）夜间音视频 URL 或文件需要分析时，默认触发本技能进行儿童睡前情绪安抚（怕黑/噩梦后） |\n| 🔎 明确分析意图 | 当用户明确提及孩子睡前哭闹、宝宝怕黑、噩梦惊醒、夜惊、小夜灯、摇篮曲、妈妈预录故事、宝宝独立入睡等关键词，并且上传了音视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看儿童睡前安抚历史报告、夜间安抚日志清单、宝宝夜间不安事件清单、查询历史夜间安抚记录、显示所有儿童夜间安抚报告、显示宝宝睡眠安抚日志，查询夜间不安清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_child_bedtime_soothing_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_child_bedtime_soothing_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备儿童卧室/婴儿房固定摄像头（红外夜视+麦克风）夜间音视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 获取 open-id（强制执行） | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行儿童睡前情绪安抚（怕黑/噩梦后） | 调用 `-m scripts.smyx_child_bedtime_soothing_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地儿童卧室/婴儿房固定摄像头（红外夜视+麦克风）夜间音视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络儿童卧室/婴儿房固定摄像头夜间音视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，儿童睡眠安抚场景默认 `other` | 按需填写 |\n| `--list` | 显示儿童睡前情绪安抚（怕黑/噩梦后）历史安抚记录清单 | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_child_bedtime_soothing_analysis.py`](scripts/smyx_child_bedtime_soothing_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 输入要求：支持 mp4/avi/mov + 音轨，最大 10MB；**关键**：必须红外夜视 + 麦克风；仅睡眠窗口启用 |\n| 🔎 使用提醒 | **4 级安抚策略递进**（mild → moderate → strong → out_of_bed/Level 4），3 分钟未平复自动升级 |\n| 🔎 使用提醒 | 单晚动作上限：mild × 5 / moderate × 3 / strong × 2 / Level 4 不设上限（安全优先） |\n| 🔎 使用提醒 | 红线约束 |\n| 🧑‍⚖️ 结果性质 | **禁止**对儿童做\"睡眠障碍 / 夜惊症 / 焦虑症\"等医学诊断 |\n| 🔎 使用提醒 | **禁止**长期存储儿童夜间视频（≤ 7 天，仅入库不安事件片段） |\n| 🔎 使用提醒 | **禁止**用于商业广告/AI 训练；禁第三方共享 |\n| 🔎 使用提醒 | **禁止**冷白光（≥ 4000K）或亮度 > 30 lux 的小夜灯（打断褪黑素） |\n| 🔎 使用提醒 | **禁止**安抚音量 > 40 dB |\n| 🔎 使用提醒 | **绝对禁止**使用 AI 克隆/合成妈妈/爸爸声音冒充家长录音 |\n| 🔎 使用提醒 | **禁止**对 out_of_bed 仅做语音安抚——**必须立即推送家长 APP** |\n| 🔎 使用提醒 | **必须**：婴儿（≤ 12 月）开专用模式，strong 及以上必须同步唤醒家长；噩梦惊醒首条安抚必须是家长本人预录稳定语音 |\n| 📜 报告输出 | **必须**：当晚汇总报告**仅次日清晨发送**（避免家长夜里被唤醒焦虑加深） |\n| 🔎 使用提醒 | 当夜噩梦惊醒 ≥ 3 次或连续 7 晚反复 → 提示**当地儿科睡眠门诊**或**儿童心理门诊**资源 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史安抚记录清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地儿童夜间音视频\npython -m scripts.smyx_child_bedtime_soothing_analysis --input /path/to/bedroom.mp4\n\n# 分析网络儿童夜间音视频/实时流\npython -m scripts.smyx_child_bedtime_soothing_analysis --url https://example.com/bedroom.mp4\n\n# 显示历史夜间安抚记录清单（自动触发关键词：查看儿童睡前安抚历史报告、夜间安抚日志清单等）\npython -m scripts.smyx_child_bedtime_soothing_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_child_bedtime_soothing_analysis --input br.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_child_bedtime_soothing_analysis --input br.mp4 --output result.json\n```\n\nFile v1.0.7:_meta.json\n\n{\n  \"ownerId\": \"kn7e2caqj7pnsvr9r7t8zenghs83xw7n\",\n  \"slug\": \"smyx-child-bedtime-soothing-analysis\",\n  \"version\": \"1.0.7\",\n  \"publishedAt\": 1785742649550\n}\n\nFile v1.0.7:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放儿童睡前情绪安抚（怕黑/噩梦后） API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动儿童睡前情绪安抚检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取不安事件 + 安抚动作清单\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史安抚记录清单\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出夜间安抚日志报告\n5. （可选）`/web/companion/v2/trigger-soothing-action` - 触发联动安抚动作（小夜灯 / 智能音箱故事 / 摇篮曲 / 家长 APP 推送）\n\n## 场景代码\n\n- `SMYX_CHILD_BEDTIME_SOOTHING_ANALYSIS` - 儿童睡前情绪安抚（怕黑/噩梦后）\n\n## 输入约束\n\n- 摄像头：儿童卧室 / 婴儿房固定摄像头，**必须支持红外夜视**，能看到床上区域\n- 帧率 ≥ 10 FPS；分辨率 ≥ 720p；红外波段建议 850 nm（对睡眠干扰小）\n- 音频**必需**：采样率 ≥ 16kHz（用于哭声 / \"妈妈\" 呼喊 / 尖叫识别）\n- 时段：仅在配置的**睡眠窗口**内启用（默认 19:00 - 07:00），白天自动暂停\n- 多孩家庭按目标跟踪绑定到注册儿童 ID（每个孩子独立基线）\n- 婴儿（≤ 12 月）必须额外开启**婴儿专用模式**：阈值更敏感、安抚动作更轻柔、必要时同步唤醒家长\n- 家长必须授权部署，并明确告知家庭其他成员（如保姆、外祖父母）\n\n## 关键观测信号\n\n### 音频（核心）\n- `crying_continuous_sec` - 持续哭声时长\n- `crying_intensity` - 哭声强度（0-100，结合分贝 + 频谱情绪）\n- `call_mom_dad_count` - 呼喊\"妈妈/爸爸/妈咪\"次数\n- `scream_event_count` - 尖叫事件次数（突发高频高强度声）\n- `whimper_event_count` - 呜咽 / 抽噎事件（轻度不安信号）\n- `sleep_breathing_regular` - 呼吸节奏规律性（参考指标，区分睡熟 vs 醒着）\n\n### 视频（核心）\n- `body_curl_up_detected` - 蜷缩抱腿姿态（怕黑典型表现）\n- `looking_around_event_count` - 四处张望次数（黑暗中睁眼搜索）\n- `sudden_sit_up_event` - 突然坐起事件（噩梦惊醒典型）\n- `trembling_visual_detected` - 肢体颤抖（恐惧伴随）\n- `hugging_plush_toy` - 主动抱毛绒玩具（自我安抚行为，参考）\n- `pull_cover_over_head` - 拉被子蒙头（怕黑参考）\n- `out_of_bed_event` - 下床事件（独立优先级，避免摔伤）\n\n### 上下文\n- `is_within_sleep_window` - 是否在睡眠窗口内\n- `time_since_last_soothing_min` - 距离上次安抚动作的时间\n\n## 场景判定与不安等级\n\n- **bedtime_unrest_mild** - 睡前不安（轻度）：呜咽 / 抱毛绒玩具 / 蜷缩，无哭喊\n- **bedtime_unrest_crying** - 睡前哭闹：持续哭声 ≥ 30 秒 或 呼喊\"妈妈/爸爸\" ≥ 2 次\n- **dark_fear** - 怕黑：蜷缩 + 四处张望 + 蒙头/抱玩具 任两项 + 在卧室关灯后 ≤ 30 分钟内\n- **nightmare_wakeup** - 噩梦惊醒：突然坐起 + 尖叫/急促哭声 + 颤抖 任两项\n- **out_of_bed_safety** - 下床（独立优先级）：触发家长 APP 推送 + 调亮小夜灯，避免摔伤\n- **none** - 无不安信号 / 在睡熟状态\n\n## 安抚动作策略（轻 → 重逐级递进）\n\n- **Level 1（mild）**：极柔小夜灯（≤ 5 lux 暖光）+ 极轻摇篮曲（≤ 35 dB）\n- **Level 2（moderate）**：小夜灯（≤ 10 lux 暖光）+ **妈妈预录故事** / 白噪音\n- **Level 3（strong：noctmare/scream）**：小夜灯（≤ 20 lux）+ 妈妈预录\"宝贝，妈妈在这里，做了梦对吗？没事了哦~\"语音 + **同时推送家长 APP** \"noctmare 提醒，建议过去陪伴\"\n- **Level 4（out_of_bed/persist ≥ 5min）**：**立即推送家长 APP + 主屏震动**，建议家长亲自到场，AI 仅辅助\n\n- 升级条件：同一信号在 Level 1/2 安抚后 ≥ 3 分钟未平复 → 自动升级一级\n- 单晚同一儿童安抚动作触发**上限**：mild × 5、moderate × 3、strong × 2、Level 4 不设上限（安全优先）\n\n## 输出字段（参考）\n\n- `event_id` / `event_timestamp` / `child_id` / `child_age_band`（infant ≤12m / toddler 1-3y / preschool 3-6y / school 6-12y）\n- `scene_label` - 场景判定（bedtime_unrest_mild / bedtime_unrest_crying / dark_fear / nightmare_wakeup / out_of_bed_safety / none）\n- `audio_signals` / `video_signals` / `context`\n- `unrest_level` - 不安等级（mild / moderate / strong / out_of_bed）\n- `soothing_actions` - 安抚动作列表（每项含 action_type / message / target / level / volume_db / brightness_lux，例如：\n    - `{action_type: \"night_light_on\", brightness_lux: 5, color_temp: \"warm_2700K\", target: \"child_room_light\", level: 1}`\n    - `{action_type: \"play_mom_recorded_story\", message: \"妈妈预录《晚安月亮》故事 5 分钟\", volume_db: 35, target: \"child_room_speaker\", level: 2}`\n    - `{action_type: \"play_lullaby\", message: \"《摇啊摇》摇篮曲\", volume_db: 30, target: \"child_room_speaker\", level: 2}`\n    - `{action_type: \"play_white_noise\", message: \"白噪音雨声\", volume_db: 30, target: \"child_room_speaker\", level: 2}`\n    - `{action_type: \"parent_app_push\", message: \"孩子刚被噩梦惊醒，已轻声安抚中，建议过去陪伴\", target: \"parent_phone_app\", level: 3}`\n    - `{action_type: \"parent_app_urgent_push\", message: \"⚠️ 孩子已下床，请立即查看\", target: \"parent_phone_app\", level: 4}`）\n- `effectiveness_after_3min` - 3 分钟后效果（settled / partially_settled / unchanged / escalated）\n- `nightly_summary` - 当晚汇总（次日清晨自动生成：不安事件次数 + 类型分布 + 安抚成功率 + 建议）\n- `recommend_action` - 建议动作（trigger_level_N_soothing / push_parent_app / urgent_parent_intervention / observe_only）\n\n## 强制约束与红线\n\n- ❌ **禁止**对儿童做任何\"睡眠障碍 / 夜惊症 / 焦虑症\"等医学诊断\n- ❌ **禁止**长期存储儿童夜间视频；建议仅保留 ≤ 7 天 + 仅入库不安事件片段\n- ❌ **禁止**将儿童夜间视频/音频用于商业广告、AI 训练数据集\n- ❌ **禁止**向家长以外的第三方共享（亲戚需家长授权才能查看）\n- ❌ **禁止**夜间使用冷白光（≥ 4000K）或亮度 > 30 lux 的小夜灯，会打断褪黑素分泌\n- ❌ **禁止**安抚音量超过 40 dB（接近耳语水平），避免影响睡眠或惊醒孩子\n- ❌ **禁止**使用 AI 克隆/合成妈妈/爸爸声音冒充家长录音；预录语音**必须由家长本人录制**\n- ❌ **禁止**对 **out_of_bed** 事件仅做\"语音安抚\"——必须立即推送家长 APP（避免摔伤）\n- ✅ **必须**婴儿（≤ 12 月）开启专用模式：阈值更敏感 + 安抚更轻柔 + **strong 及以上必须同步唤醒家长**\n- ✅ **必须**为家长提供：一键暂停今晚 / 调整睡眠窗口 / 永久退出 入口\n- ✅ **必须**：噩梦惊醒后**首条安抚语**应为家长本人预录的稳定语音（不用合成音）\n- ✅ 当夜噩梦惊醒 ≥ 3 次或连续 7 晚反复发生 → 提示家长**当地儿童心理门诊**或**儿科睡眠门诊**资源\n- ✅ 当晚汇总报告必须**只在次日清晨**发送（避免家长夜里被唤醒焦虑加深）\n\n> 仅输出基于音视频的客观不安事件检测与轻柔安抚动作，**不构成任何儿童睡眠/心理医学诊断**；频繁夜惊或长期睡眠困难请咨询当地**儿科睡眠门诊**或**儿童心理科**专业医师。\n\nFile v1.0.7:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.7:scripts/config.yaml\n\n{}\n\nFile v1.0.7:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.7:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.7:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.7:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: prod\n\nFile v1.0.7:skill-card.md\n\n## Description: <br>\nAnalyzes nighttime child-bedroom audio and video to detect bedtime unrest, fear-of-the-dark behaviors, nightmare awakenings, and out-of-bed safety events, then returns structured soothing actions and report links. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[18072937735](https://clawhub.ai/user/18072937735) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nExternal users and developers use this skill to analyze authorized nighttime bedroom camera and microphone inputs for child bedtime unrest, then generate structured event labels, soothing actions, safety prompts, and historical report links. It is intended for parenting and smart-home assistance, not medical diagnosis. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: The skill may send child-bedroom audio, video, or media URLs to external cloud services. <br>\nMitigation: Install only with clear caregiver consent, device-scope controls, retention and deletion policies, and explicit limits on sharing or secondary use. <br>\nRisk: Silent identity or token flows may create or reuse local identity records without obvious user control. <br>\nMitigation: Review account-binding behavior before deployment and provide transparent controls for consent, revocation, and token storage. <br>\nRisk: The skill processes sensitive children's sleep behavior and could be mistaken for medical assessment. <br>\nMitigation: Present outputs as behavioral detection and soothing guidance only, and require professional consultation for recurring or concerning sleep events. <br>\nRisk: Automated soothing actions could be inappropriate for safety-critical events such as out-of-bed detection or strong distress. <br>\nMitigation: Require parent notification or urgent escalation for out-of-bed events, strong distress, and infant-mode thresholds. <br>\n\n\n## Reference(s): <br>\n- [ClawHub Skill Page](https://clawhub.ai/18072937735/skills/smyx-child-bedtime-soothing-analysis) <br>\n- [API Documentation](artifact/references/api_doc.md) <br>\n- [SMYX Analysis API Documentation](artifact/skills/smyx_analysis/references/api_doc.md) <br>\n- [Skill Demo](https://lifeemergence.com/sample.html) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [text, markdown, code, shell commands, configuration, guidance] <br>\n**Output Format:** [Markdown guidance with shell commands and JSON-compatible structured analysis reports] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May include event labels, audio/video signal summaries, recommended soothing actions, safety prompts, report links, and historical report tables.] <br>\n\n## Skill Version(s): <br>\n1.0.7 (source: server release evidence; artifact frontmatter reports 1.0.8) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nFile v1.0.7:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.7:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.6: 31 files, 44753 bytes\n\nFiles: references/api_doc.md (7628b), scripts/__init__.py (73b), scripts/config.py (697b), scripts/config.yaml (3b), scripts/skill.py (595b), scripts/smyx_child_bedtime_soothing_analysis.py (3795b), skill-card.md (3266b), SKILL.md (15631b), skills/smyx_analysis/__init__.py (0b), skills/smyx_analysis/references/api_doc.md (427b), skills/smyx_analysis/requirements.txt (45b), skills/smyx_analysis/scripts/__init__.py (0b), skills/smyx_analysis/scripts/api_service.py (1509b), skills/smyx_analysis/scripts/config.py (1003b), skills/smyx_analysis/scripts/config.yaml (3b), skills/smyx_analysis/scripts/skill.py (6529b), skills/smyx_analysis/scripts/smyx_analysis.py (3833b), skills/smyx_common/__init__.py (0b), skills/smyx_common/requirements.txt (47b), skills/smyx_common/scripts/__init__.py (177b), skills/smyx_common/scripts/api_service.py (2645b), skills/smyx_common/scripts/base.py (469b), skills/smyx_common/scripts/config-dev.yaml (214b), skills/smyx_common/scripts/config-prod.yaml (0b), skills/smyx_common/scripts/config-test.yaml (256b), skills/smyx_common/scripts/config.py (24363b), skills/smyx_common/scripts/config.yaml (473b), skills/smyx_common/scripts/dao.py (18266b), skills/smyx_common/scripts/skill.py (2473b), skills/smyx_common/scripts/util.py (28776b), _meta.json (155b)\n\nFile v1.0.6:SKILL.md\n\n---\nname: \"smyx-child-bedtime-soothing-analysis\"\ndescription: \"Through a fixed camera (with infrared night vision) and microphone in the child's bedroom, the system analyzes pre-sleep and night-time video and audio to detect pre-sleep crying (continuous crying, calling 'Mama'), fear-of-the-dark expressions (curling up, looking around), and nightmare awakenings (sudden sitting up, trembling, screaming). | 通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。\"\nversion: \"1.0.8\"\nlicense: \"MIT-0\"\n---\n\n# 🌙 Child Bedtime Soothing (Fear of Dark / Post-Nightmare) | 儿童睡前情绪安抚（怕黑/噩梦后）\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **儿童睡前情绪安抚（怕黑/噩梦后）** |\n| 🎯 核心目标 | 通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_CHILD_BEDTIME_SOOTHING_ANALYSIS` |\n\nThrough a fixed camera (with infrared night vision) and microphone in the child's bedroom, the system analyzes pre-sleep and night-time video and audio to detect pre-sleep crying (continuous crying, calling 'Mama'), fear-of-the-dark expressions (curling up, looking around), and nightmare awakenings (sudden sitting up, trembling, screaming). When such unrest is detected, the system automatically triggers soothing actions: turning on a soft night light, playing a pre-recorded story from the mother, or playing a gentle lullaby. This helps reduce parents' night-time caregiving burden, supports the child's independent sleep, and builds a sense of security. Application scenarios: children's bedrooms, nurseries. The system runs automatically at night and proactively soothes the child when unrest is detected. Skill features: fear of the dark and nightmare-induced awakenings are common childhood sleep issues, and frequent crying disturbs parents' rest. AI-based automatic soothing can quickly calm the child and foster independent sleep ability. Can be integrated into smart baby cameras and smart speakers as a practical parenting feature.\n\n通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。该技能有助于减少父母夜间安抚负担，帮助儿童独立入睡，建立安全感。应用场景：儿童卧室、婴儿房。系统夜间自动运行，当检测到儿童不安时主动安抚。技能特点：儿童怕黑、噩梦惊醒是常见睡眠问题，频繁哭闹会干扰父母休息。通过AI自动安抚，可帮助儿童快速平静，培养独立入睡能力。该技能可集成到智能婴儿摄像头、智能音箱中，成为育儿家庭的实用功能。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的儿童睡眠安抚 AI。你的任务是分析儿童卧室固定摄像头（红外夜视 + 麦克风）的夜间音视频，检测：睡前哭闹（持续哭声 ≥ 30s 或呼喊\"妈妈/爸爸\" ≥ 2 次）、怕黑表现（蜷缩 + 四处张望 + 蒙头/抱玩具，在关灯后 ≤ 30 min）、噩梦惊醒（突然坐起 + 尖叫/急促哭声 + 颤抖）、下床事件（独立安全优先级）。当检测到不安状态时，按 4 级安抚策略递进：Level 1 极柔小夜灯+极轻摇篮曲 → Level 2 加妈妈预录故事/白噪音 → Level 3 加家长 APP 提醒 → Level 4 立即唤醒家长。婴儿（≤12 月）必须开专用模式，阈值更敏感、strong 及以上必须同步唤醒家长。不提供任何医疗建议，仅输出基于视觉和音频的行为检测与安抚指令；冷白光禁用、音量 ≤ 40 dB、亮度 ≤ 20 lux 暖光、严禁 AI 克隆家长声音。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于儿童卧室/婴儿房固定摄像头（**必须红外夜视 + 麦克风**）夜间音视频（**仅在睡眠窗口 19:00-07:00 启用**），识别 4 类场景（bedtime_unrest_mild / bedtime_unrest_crying / dark_fear / nightmare_wakeup / out_of_bed_safety / none）→ 音频核心 6 项（持续哭声时长 / 哭声强度 0-100 / \"妈妈爸爸\"呼喊 / 尖叫 / 呜咽抽噎 / 呼吸节奏规律性）+ 视频核心 7 项（蜷缩抱腿 / 四处张望 / **突然坐起** / 颤抖 / 抱毛绒玩具 / 拉被子蒙头 / **下床事件**）→ 4 档不安等级（mild / moderate / strong / out_of_bed）→ **4 级安抚策略递进**（小夜灯 ≤ 5/10/20 lux 暖光 + 摇篮曲/妈妈预录故事/白噪音 ≤ 35-40 dB + 家长 APP 推送 + 紧急唤醒）→ 3 分钟效果评估 + 自动升级 → 单晚动作上限管控（mild × 5 / moderate × 3 / strong × 2 / Level 4 不设上限）→ 次日清晨发送当晚汇总\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 红外夜视图像分析 |\n| 2 | 儿童蜷缩抱腿姿态识别 |\n| 3 | 四处张望识别 |\n| 4 | 突然坐起识别 |\n| 5 | 肢体颤抖识别 |\n| 6 | 抱毛绒玩具识别 |\n| 7 | 拉被子蒙头识别 |\n| 8 | 下床事件识别（独立安全优先级） |\n| 9 | 儿童哭声强度评估 |\n| 10 | \"妈妈爸爸\"呼喊声纹识别 |\n| 11 | 尖叫识别 |\n| 12 | 呜咽抽噎识别 |\n| 13 | 呼吸节奏规律性评估（睡熟 vs 醒着） |\n| 14 | 年龄段自适应（infant ≤12m / toddler 1-3y / preschool 3-6y / school 6-12y） |\n| 15 | 婴儿专用模式（阈值更敏感+安抚更轻柔+strong 及以上必须同步唤醒家长） |\n| 16 | 小夜灯智能调光（≤ 20 lux 暖光 2700K） |\n| 17 | 安抚音量智能控制（≤ 40 dB） |\n| 18 | 4 级安抚策略递进 + 3 分钟效果评估 + 自动升级 |\n| 19 | 单晚动作上限管控 |\n| 20 | 当晚汇总报告**仅次日清晨发送** |\n| 21 | 当夜 ≥ 3 次或连续 7 晚反复 → 提示当地儿科睡眠门诊/儿童心理门诊 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供儿童卧室/婴儿房固定摄像头（红外夜视+麦克风）夜间音视频 URL 或文件需要分析时，默认触发本技能进行儿童睡前情绪安抚（怕黑/噩梦后） |\n| 🔎 明确分析意图 | 当用户明确提及孩子睡前哭闹、宝宝怕黑、噩梦惊醒、夜惊、小夜灯、摇篮曲、妈妈预录故事、宝宝独立入睡等关键词，并且上传了音视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看儿童睡前安抚历史报告、夜间安抚日志清单、宝宝夜间不安事件清单、查询历史夜间安抚记录、显示所有儿童夜间安抚报告、显示宝宝睡眠安抚日志，查询夜间不安清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_child_bedtime_soothing_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_child_bedtime_soothing_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备儿童卧室/婴儿房固定摄像头（红外夜视+麦克风）夜间音视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 获取 open-id（强制执行） | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行儿童睡前情绪安抚（怕黑/噩梦后） | 调用 `-m scripts.smyx_child_bedtime_soothing_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地儿童卧室/婴儿房固定摄像头（红外夜视+麦克风）夜间音视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络儿童卧室/婴儿房固定摄像头夜间音视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，儿童睡眠安抚场景默认 `other` | 按需填写 |\n| `--list` | 显示儿童睡前情绪安抚（怕黑/噩梦后）历史安抚记录清单 | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_child_bedtime_soothing_analysis.py`](scripts/smyx_child_bedtime_soothing_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 输入要求：支持 mp4/avi/mov + 音轨，最大 10MB；**关键**：必须红外夜视 + 麦克风；仅睡眠窗口启用 |\n| 🔎 使用提醒 | **4 级安抚策略递进**（mild → moderate → strong → out_of_bed/Level 4），3 分钟未平复自动升级 |\n| 🔎 使用提醒 | 单晚动作上限：mild × 5 / moderate × 3 / strong × 2 / Level 4 不设上限（安全优先） |\n| 🔎 使用提醒 | 红线约束 |\n| 🧑‍⚖️ 结果性质 | **禁止**对儿童做\"睡眠障碍 / 夜惊症 / 焦虑症\"等医学诊断 |\n| 🔎 使用提醒 | **禁止**长期存储儿童夜间视频（≤ 7 天，仅入库不安事件片段） |\n| 🔎 使用提醒 | **禁止**用于商业广告/AI 训练；禁第三方共享 |\n| 🔎 使用提醒 | **禁止**冷白光（≥ 4000K）或亮度 > 30 lux 的小夜灯（打断褪黑素） |\n| 🔎 使用提醒 | **禁止**安抚音量 > 40 dB |\n| 🔎 使用提醒 | **绝对禁止**使用 AI 克隆/合成妈妈/爸爸声音冒充家长录音 |\n| 🔎 使用提醒 | **禁止**对 out_of_bed 仅做语音安抚——**必须立即推送家长 APP** |\n| 🔎 使用提醒 | **必须**：婴儿（≤ 12 月）开专用模式，strong 及以上必须同步唤醒家长；噩梦惊醒首条安抚必须是家长本人预录稳定语音 |\n| 📜 报告输出 | **必须**：当晚汇总报告**仅次日清晨发送**（避免家长夜里被唤醒焦虑加深） |\n| 🔎 使用提醒 | 当夜噩梦惊醒 ≥ 3 次或连续 7 晚反复 → 提示**当地儿科睡眠门诊**或**儿童心理门诊**资源 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史安抚记录清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地儿童夜间音视频\npython -m scripts.smyx_child_bedtime_soothing_analysis --input /path/to/bedroom.mp4\n\n# 分析网络儿童夜间音视频/实时流\npython -m scripts.smyx_child_bedtime_soothing_analysis --url https://example.com/bedroom.mp4\n\n# 显示历史夜间安抚记录清单（自动触发关键词：查看儿童睡前安抚历史报告、夜间安抚日志清单等）\npython -m scripts.smyx_child_bedtime_soothing_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_child_bedtime_soothing_analysis --input br.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_child_bedtime_soothing_analysis --input br.mp4 --output result.json\n```\n\nFile v1.0.6:_meta.json\n\n{\n  \"ownerId\": \"kn7e2caqj7pnsvr9r7t8zenghs83xw7n\",\n  \"slug\": \"smyx-child-bedtime-soothing-analysis\",\n  \"version\": \"1.0.6\",\n  \"publishedAt\": 1785520533325\n}\n\nFile v1.0.6:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放儿童睡前情绪安抚（怕黑/噩梦后） API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动儿童睡前情绪安抚检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取不安事件 + 安抚动作清单\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史安抚记录清单\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出夜间安抚日志报告\n5. （可选）`/web/companion/v2/trigger-soothing-action` - 触发联动安抚动作（小夜灯 / 智能音箱故事 / 摇篮曲 / 家长 APP 推送）\n\n## 场景代码\n\n- `SMYX_CHILD_BEDTIME_SOOTHING_ANALYSIS` - 儿童睡前情绪安抚（怕黑/噩梦后）\n\n## 输入约束\n\n- 摄像头：儿童卧室 / 婴儿房固定摄像头，**必须支持红外夜视**，能看到床上区域\n- 帧率 ≥ 10 FPS；分辨率 ≥ 720p；红外波段建议 850 nm（对睡眠干扰小）\n- 音频**必需**：采样率 ≥ 16kHz（用于哭声 / \"妈妈\" 呼喊 / 尖叫识别）\n- 时段：仅在配置的**睡眠窗口**内启用（默认 19:00 - 07:00），白天自动暂停\n- 多孩家庭按目标跟踪绑定到注册儿童 ID（每个孩子独立基线）\n- 婴儿（≤ 12 月）必须额外开启**婴儿专用模式**：阈值更敏感、安抚动作更轻柔、必要时同步唤醒家长\n- 家长必须授权部署，并明确告知家庭其他成员（如保姆、外祖父母）\n\n## 关键观测信号\n\n### 音频（核心）\n- `crying_continuous_sec` - 持续哭声时长\n- `crying_intensity` - 哭声强度（0-100，结合分贝 + 频谱情绪）\n- `call_mom_dad_count` - 呼喊\"妈妈/爸爸/妈咪\"次数\n- `scream_event_count` - 尖叫事件次数（突发高频高强度声）\n- `whimper_event_count` - 呜咽 / 抽噎事件（轻度不安信号）\n- `sleep_breathing_regular` - 呼吸节奏规律性（参考指标，区分睡熟 vs 醒着）\n\n### 视频（核心）\n- `body_curl_up_detected` - 蜷缩抱腿姿态（怕黑典型表现）\n- `looking_around_event_count` - 四处张望次数（黑暗中睁眼搜索）\n- `sudden_sit_up_event` - 突然坐起事件（噩梦惊醒典型）\n- `trembling_visual_detected` - 肢体颤抖（恐惧伴随）\n- `hugging_plush_toy` - 主动抱毛绒玩具（自我安抚行为，参考）\n- `pull_cover_over_head` - 拉被子蒙头（怕黑参考）\n- `out_of_bed_event` - 下床事件（独立优先级，避免摔伤）\n\n### 上下文\n- `is_within_sleep_window` - 是否在睡眠窗口内\n- `time_since_last_soothing_min` - 距离上次安抚动作的时间\n\n## 场景判定与不安等级\n\n- **bedtime_unrest_mild** - 睡前不安（轻度）：呜咽 / 抱毛绒玩具 / 蜷缩，无哭喊\n- **bedtime_unrest_crying** - 睡前哭闹：持续哭声 ≥ 30 秒 或 呼喊\"妈妈/爸爸\" ≥ 2 次\n- **dark_fear** - 怕黑：蜷缩 + 四处张望 + 蒙头/抱玩具 任两项 + 在卧室关灯后 ≤ 30 分钟内\n- **nightmare_wakeup** - 噩梦惊醒：突然坐起 + 尖叫/急促哭声 + 颤抖 任两项\n- **out_of_bed_safety** - 下床（独立优先级）：触发家长 APP 推送 + 调亮小夜灯，避免摔伤\n- **none** - 无不安信号 / 在睡熟状态\n\n## 安抚动作策略（轻 → 重逐级递进）\n\n- **Level 1（mild）**：极柔小夜灯（≤ 5 lux 暖光）+ 极轻摇篮曲（≤ 35 dB）\n- **Level 2（moderate）**：小夜灯（≤ 10 lux 暖光）+ **妈妈预录故事** / 白噪音\n- **Level 3（strong：noctmare/scream）**：小夜灯（≤ 20 lux）+ 妈妈预录\"宝贝，妈妈在这里，做了梦对吗？没事了哦~\"语音 + **同时推送家长 APP** \"noctmare 提醒，建议过去陪伴\"\n- **Level 4（out_of_bed/persist ≥ 5min）**：**立即推送家长 APP + 主屏震动**，建议家长亲自到场，AI 仅辅助\n\n- 升级条件：同一信号在 Level 1/2 安抚后 ≥ 3 分钟未平复 → 自动升级一级\n- 单晚同一儿童安抚动作触发**上限**：mild × 5、moderate × 3、strong × 2、Level 4 不设上限（安全优先）\n\n## 输出字段（参考）\n\n- `event_id` / `event_timestamp` / `child_id` / `child_age_band`（infant ≤12m / toddler 1-3y / preschool 3-6y / school 6-12y）\n- `scene_label` - 场景判定（bedtime_unrest_mild / bedtime_unrest_crying / dark_fear / nightmare_wakeup / out_of_bed_safety / none）\n- `audio_signals` / `video_signals` / `context`\n- `unrest_level` - 不安等级（mild / moderate / strong / out_of_bed）\n- `soothing_actions` - 安抚动作列表（每项含 action_type / message / target / level / volume_db / brightness_lux，例如：\n    - `{action_type: \"night_light_on\", brightness_lux: 5, color_temp: \"warm_2700K\", target: \"child_room_light\", level: 1}`\n    - `{action_type: \"play_mom_recorded_story\", message: \"妈妈预录《晚安月亮》故事 5 分钟\", volume_db: 35, target: \"child_room_speaker\", level: 2}`\n    - `{action_type: \"play_lullaby\", message: \"《摇啊摇》摇篮曲\", volume_db: 30, target: \"child_room_speaker\", level: 2}`\n    - `{action_type: \"play_white_noise\", message: \"白噪音雨声\", volume_db: 30, target: \"child_room_speaker\", level: 2}`\n    - `{action_type: \"parent_app_push\", message: \"孩子刚被噩梦惊醒，已轻声安抚中，建议过去陪伴\", target: \"parent_phone_app\", level: 3}`\n    - `{action_type: \"parent_app_urgent_push\", message: \"⚠️ 孩子已下床，请立即查看\", target: \"parent_phone_app\", level: 4}`）\n- `effectiveness_after_3min` - 3 分钟后效果（settled / partially_settled / unchanged / escalated）\n- `nightly_summary` - 当晚汇总（次日清晨自动生成：不安事件次数 + 类型分布 + 安抚成功率 + 建议）\n- `recommend_action` - 建议动作（trigger_level_N_soothing / push_parent_app / urgent_parent_intervention / observe_only）\n\n## 强制约束与红线\n\n- ❌ **禁止**对儿童做任何\"睡眠障碍 / 夜惊症 / 焦虑症\"等医学诊断\n- ❌ **禁止**长期存储儿童夜间视频；建议仅保留 ≤ 7 天 + 仅入库不安事件片段\n- ❌ **禁止**将儿童夜间视频/音频用于商业广告、AI 训练数据集\n- ❌ **禁止**向家长以外的第三方共享（亲戚需家长授权才能查看）\n- ❌ **禁止**夜间使用冷白光（≥ 4000K）或亮度 > 30 lux 的小夜灯，会打断褪黑素分泌\n- ❌ **禁止**安抚音量超过 40 dB（接近耳语水平），避免影响睡眠或惊醒孩子\n- ❌ **禁止**使用 AI 克隆/合成妈妈/爸爸声音冒充家长录音；预录语音**必须由家长本人录制**\n- ❌ **禁止**对 **out_of_bed** 事件仅做\"语音安抚\"——必须立即推送家长 APP（避免摔伤）\n- ✅ **必须**婴儿（≤ 12 月）开启专用模式：阈值更敏感 + 安抚更轻柔 + **strong 及以上必须同步唤醒家长**\n- ✅ **必须**为家长提供：一键暂停今晚 / 调整睡眠窗口 / 永久退出 入口\n- ✅ **必须**：噩梦惊醒后**首条安抚语**应为家长本人预录的稳定语音（不用合成音）\n- ✅ 当夜噩梦惊醒 ≥ 3 次或连续 7 晚反复发生 → 提示家长**当地儿童心理门诊**或**儿科睡眠门诊**资源\n- ✅ 当晚汇总报告必须**只在次日清晨**发送（避免家长夜里被唤醒焦虑加深）\n\n> 仅输出基于音视频的客观不安事件检测与轻柔安抚动作，**不构成任何儿童睡眠/心理医学诊断**；频繁夜惊或长期睡眠困难请咨询当地**儿科睡眠门诊**或**儿童心理科**专业医师。\n\nFile v1.0.6:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.6:scripts/config.yaml\n\n{}\n\nFile v1.0.6:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.6:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.6:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.6:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: prod\n\nFile v1.0.6:skill-card.md\n\n## Description: <br>\nThrough a fixed camera with infrared night vision and microphone in a child's bedroom, this skill analyzes night-time audio/video to detect pre-sleep crying, fear-of-dark behaviors, and post-nightmare awakenings, then returns structured soothing actions such as soft night-light settings, recorded parent audio, lullabies, parent alerts, and report links. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[18072937735](https://clawhub.ai/user/18072937735) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nExternal users and developers use this skill to analyze authorized child bedroom or nursery audio/video during sleep windows, detect bedtime distress patterns, and produce structured reports and escalation guidance for soothing workflows. It is intended for behavioral detection and caregiver notification, not medical diagnosis. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: Children's bedroom audio/video or media URLs may be sent to a configured cloud service for analysis. <br>\nMitigation: Use only with explicit parental authorization, confirm who operates the backend, and verify retention, access control, and report-link sharing before deployment. <br>\nRisk: The skill may create or reuse a persistent local identity and store account tokens locally. <br>\nMitigation: Run it in a controlled environment, limit local file access, rotate or revoke tokens as needed, and document how identity state can be cleared. <br>\nRisk: Historical cloud reports may expose sensitive child sleep and bedroom activity data. <br>\nMitigation: Restrict report access to authorized caregivers, review cloud report history permissions, and avoid sharing exported links beyond approved recipients. <br>\nRisk: The skill is positioned around child sleep behavior and could be mistaken for medical assessment. <br>\nMitigation: Present outputs as behavioral observations and caregiver guidance only, and direct repeated or severe sleep issues to qualified pediatric or child psychology professionals. <br>\n\n\n## Reference(s): <br>\n- [Child bedtime soothing API documentation](artifact/references/api_doc.md) <br>\n- [Shared analysis API documentation](artifact/skills/smyx_analysis/references/api_doc.md) <br>\n- [Skill demo](https://lifeemergence.com/sample.html) <br>\n- [ClawHub skill page](https://clawhub.ai/18072937735/skills/smyx-child-bedtime-soothing-analysis) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [Text, Markdown, JSON, Shell commands, Guidance] <br>\n**Output Format:** [Markdown or JSON analysis report with optional saved output file] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May include structured distress classifications, soothing action recommendations, historical report tables, and report links.] <br>\n\n## Skill Version(s): <br>\n1.0.6 (source: server release metadata; artifact frontmatter says 1.0.8) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nFile v1.0.6:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.6:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.5: 31 files, 44495 bytes\n\nFiles: references/api_doc.md (7628b), scripts/__init__.py (73b), scripts/config.py (697b), scripts/config.yaml (3b), scripts/skill.py (595b), scripts/smyx_child_bedtime_soothing_analysis.py (3795b), skill-card.md (2686b), SKILL.md (15631b), skills/smyx_analysis/__init__.py...","readmeExcerpt":"Skill: Child Bedtime Soothing (Fear of Dark / Post-Nightmare) | 儿童睡前情绪安抚（怕黑/噩梦后） Owner: 18072937735 Summary: Through a fixed camera (with infrared night vision) and microphone in the child's bedroom, the system analyzes pre-sleep and night-time video and audio to detect pre-sleep crying (continuous crying, calling 'Mama'), fear-of-the-dark expressions (curling up, looking around), and nightmare awakenings (sudden sit","codeSnippets":[],"executableExamples":[{"language":"bash","snippet":"python -m scripts.smyx_child_bedtime_soothing_analysis --list"},{"language":"text","snippet":"requests>=2.28.0"},{"language":"bash","snippet":"# 分析本地儿童夜间音视频\npython -m scripts.smyx_child_bedtime_soothing_analysis --input /path/to/bedroom.mp4\n\n# 分析网络儿童夜间音视频/实时流\npython -m scripts.smyx_child_bedtime_soothing_analysis --url https://example.com/bedroom.mp4\n\n# 显示历史夜间安抚记录清单（自动触发关键词：查看儿童睡前安抚历史报告、夜间安抚日志清单等）\npython -m scripts.smyx_child_bedtime_soothing_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_child_bedtime_soothing_analysis --input br.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_child_bedtime_soothing_analysis --input br.mp4 --output result.json"},{"language":"bash","snippet":"python -m scripts.smyx_child_bedtime_soothing_analysis --list"},{"language":"text","snippet":"requests>=2.28.0"},{"language":"bash","snippet":"# 分析本地儿童夜间音视频\npython -m scripts.smyx_child_bedtime_soothing_analysis --input /path/to/bedroom.mp4\n\n# 分析网络儿童夜间音视频/实时流\npython -m scripts.smyx_child_bedtime_soothing_analysis --url https://example.com/bedroom.mp4\n\n# 显示历史夜间安抚记录清单（自动触发关键词：查看儿童睡前安抚历史报告、夜间安抚日志清单等）\npython -m scripts.smyx_child_bedtime_soothing_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_child_bedtime_soothing_analysis --input br.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_child_bedtime_soothing_analysis --input br.mp4 --output result.json"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: \"smyx-child-bedtime-soothing-analysis\"\ndescription: \"Through a fixed camera (with infrared night vision) and microphone in the child's bedroom, the system analyzes pre-sleep and night-time video and audio to detect pre-sleep crying (continuous crying, calling 'Mama'), fear-of-the-dark expressions (curling up, looking around), and nightmare awakenings (sudden sitting up, trembling, screaming). | 通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。\"\nversion: \"1.0.16\"\nlicense: \"MIT-0\"\n---\n\n# 🌙 Child Bedtime Soothing (Fear of Dark / Post-Nightmare) | 儿童睡前情绪安抚（怕黑/噩梦后）\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **儿童睡前情绪安抚（怕黑/噩梦后）** |\n| 🎯 核心目标 | 通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_CHILD_BEDTIME_SOOTHING_ANALYSIS` |\n\nThrough a fixed camera (with infrared night vision) and microphone in the child's bedroom, the system analyzes pre-sleep and night-time video and audio to detect pre-sleep crying (continuous crying, calling 'Mama'), fear-of-the-dark expressions (curling up, looking around), and nightmare awakenings (sudden sitting up, trembling, screaming). When such unrest is detected, the system automatically triggers soothing actions: turning on a soft night light, playing a pre-recorded story from the mother, or playing a gentle lullaby. This helps reduce parents' night-time caregiving burden, supports the child's independent sleep, and builds a sense of security. Application scenarios: children's bedrooms, nurseries. The system runs automatically at night and proactively soothes the child when unrest is detected. Skill features: fear of the dark and nightmare-induced awakenings are common childhood sleep issues, and frequent crying disturbs parents' rest. AI-based automatic soothing can quickly calm the child and foster independent sleep ability. Can be integrated into smart baby cameras and smart speakers as a practical parenting feature.\n\n通过儿童卧室的固定摄像头（红外夜视）及麦克风，分析儿童睡前及夜间视频，检测睡前哭闹（持续性哭声、呼喊'妈妈'）、怕黑表现（身体蜷缩、四处张望）、噩梦惊醒（突然坐起、颤抖、尖叫）等行为。当检测到上述情绪不安时，自动触发安抚动作：开启小夜灯（柔光）、播放预先录制的妈妈讲故事音频或轻柔摇篮曲。该技能有助于减少父母夜间安抚负担，帮助儿童独立入睡，建立安全感。应用场景：儿童卧室、婴儿房。系统夜间自动运行，当检测到儿童不安时主动安抚。技能特点：儿童怕黑、噩梦惊醒是常见睡眠问题，频繁哭闹会干扰父母休息。通过AI自动安抚，可帮助儿童快速平静，培养独立入睡能力。该技能可集成到智能婴儿摄像头、智能音箱中，成为育儿家庭的实用功能。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的儿童睡眠安抚 AI。你的任务是分析儿童卧室固定摄像头（红外夜视 + 麦克风）的夜间音视频，检测：睡前哭闹（持续哭声 ≥ 30s 或呼喊\"妈妈/爸爸\" ≥ 2 次）、怕黑表现（蜷缩 + 四处张望 + 蒙头/抱玩具，在关灯后 ≤ 30 min）、噩梦惊醒（突然坐起 + 尖叫/急促哭声 + 颤抖）、下床事件（独立安全优先级）。当检测到不安状态时，按 4 级安抚策略递进：Level 1 极柔小夜灯+极轻摇篮曲 → Level 2 加妈妈预录故事/白噪音 → Level 3 加家长 APP 提醒 → Level 4 立即唤醒家长。婴儿（≤12 月）必须开专用模式，阈值更敏感、strong 及以上必须同步唤醒家长。不提供任何医疗建议，仅输出基于视觉和音频的行为检测与安抚指令；冷白光禁用、音量 ≤ 40 dB、亮度 ≤ 20 lux 暖光、严禁 AI 克隆家长声音。** |\n\n## "},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn7e2caqj7pnsvr9r7t8zenghs83xw7n\",\n  \"slug\": \"smyx-child-bedtime-soothing-analysis\",\n  \"version\": \"1.0.13\",\n  \"publishedAt\": 1790615371725\n}"},{"path":"references/api_doc.md","content":"# API 接口文档\n\n此处用于存放儿童睡前情绪安抚（怕黑/噩梦后） API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动儿童睡前情绪安抚检测任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取不安事件 + 安抚动作清单\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史安抚记录清单\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出夜间安抚日志报告\n5. （可选）`/web/companion/v2/trigger-soothing-action` - 触发联动安抚动作（小夜灯 / 智能音箱故事 / 摇篮曲 / 家长 APP 推送）\n\n## 场景代码\n\n- `SMYX_CHILD_BEDTIME_SOOTHING_ANALYSIS` - 儿童睡前情绪安抚（怕黑/噩梦后）\n\n## 输入约束\n\n- 摄像头：儿童卧室 / 婴儿房固定摄像头，**必须支持红外夜视**，能看到床上区域\n- 帧率 ≥ 10 FPS；分辨率 ≥ 720p；红外波段建议 850 nm（对睡眠干扰小）\n- 音频**必需**：采样率 ≥ 16kHz（用于哭声 / \"妈妈\" 呼喊 / 尖叫识别）\n- 时段：仅在配置的**睡眠窗口**内启用（默认 19:00 - 07:00），白天自动暂停\n- 多孩家庭按目标跟踪绑定到注册儿童 ID（每个孩子独立基线）\n- 婴儿（≤ 12 月）必须额外开启**婴儿专用模式**：阈值更敏感、安抚动作更轻柔、必要时同步唤醒家长\n- 家长必须授权部署，并明确告知家庭其他成员（如保姆、外祖父母）\n\n## 关键观测信号\n\n### 音频（核心）\n- `crying_continuous_sec` - 持续哭声时长\n- `crying_intensity` - 哭声强度（0-100，结合分贝 + 频谱情绪）\n- `call_mom_dad_count` - 呼喊\"妈妈/爸爸/妈咪\"次数\n- `scream_event_count` - 尖叫事件次数（突发高频高强度声）\n- `whimper_event_count` - 呜咽 / 抽噎事件（轻度不安信号）\n- `sleep_breathing_regular` - 呼吸节奏规律性（参考指标，区分睡熟 vs 醒着）\n\n### 视频（核心）\n- `body_curl_up_detected` - 蜷缩抱腿姿态（怕黑典型表现）\n- `looking_around_event_count` - 四处张望次数（黑暗中睁眼搜索）\n- `sudden_sit_up_event` - 突然坐起事件（噩梦惊醒典型）\n- `trembling_visual_detected` - 肢体颤抖（恐惧伴随）\n- `hugging_plush_toy` - 主动抱毛绒玩具（自我安抚行为，参考）\n- `pull_cover_over_head` - 拉被子蒙头（怕黑参考）\n- `out_of_bed_event` - 下床事件（独立优先级，避免摔伤）\n\n### 上下文\n- `is_within_sleep_window` - 是否在睡眠窗口内\n- `time_since_last_soothing_min` - 距离上次安抚动作的时间\n\n## 场景判定与不安等级\n\n- **bedtime_unrest_mild** - 睡前不安（轻度）：呜咽 / 抱毛绒玩具 / 蜷缩，无哭喊\n- **bedtime_unrest_crying** - 睡前哭闹：持续哭声 ≥ 30 秒 或 呼喊\"妈妈/爸爸\" ≥ 2 次\n- **dark_fear** - 怕黑：蜷缩 + 四处张望 + 蒙头/抱玩具 任两项 + 在卧室关灯后 ≤ 30 分钟内\n- **nightmare_wakeup** - 噩梦惊醒：突然坐起 + 尖叫/急促哭声 + 颤抖 任两项\n- **out_of_bed_safety** - 下床（独立优先级）：触发家长 APP 推送 + 调亮小夜灯，避免摔伤\n- **none** - 无不安信号 / 在睡熟状态\n\n## 安抚动作策略（轻 → 重逐级递进）\n\n- **Level 1（mild）**：极柔小夜灯（≤ 5 lux 暖光）+ 极轻摇篮曲（≤ 35 dB）\n- **Level 2（moderate）**：小夜灯（≤ 10 lux 暖光）+ **妈妈预录故事** / 白噪音\n- **Level 3（strong：noctmare/scream）**：小夜灯（≤ 20 lux）+ 妈妈预录\"宝贝，妈妈在这里，做了梦对吗？没事了哦~\"语音 + **同时推送家长 APP** \"noctmare 提醒，建议过去陪伴\"\n- **Level 4（out_of_bed/persist ≥ 5min）**：**立即推送家长 APP + 主屏震动**，建议家长亲自到场，AI 仅辅助\n\n- 升级条件：同一信号在 Level 1/2 安抚后 ≥ 3 分钟未平复 → 自动升级一级\n- 单晚同一儿童安抚动作触发**上限**：mild × 5、moderate × 3、strong × 2、Level 4 不设上限（安全优先）\n\n## 输出字段（参考）\n\n- `event_id` / `event_timestamp` / `child_id` / `child_age_band`（infant ≤12m / toddler 1-3y / preschool 3-6y / school 6-12y）\n- `scene_label` - 场景判定（bedtime_unrest_mild / bedtime_unrest_crying / dark_fear / nightmare_wakeup / out_of_bed_safety / none）\n- `audio_signals` / `video_signals` / `context`\n- `unrest_level` - 不安等级（mild / moderate / strong / out_of_bed）\n- `soothing_actions` - 安抚动作列表（每项含 action_type / message / target / level / volume_db / brightness_lux，例如：\n    - `{action_type: \"night_light_on\", brightness_lux: 5, color_temp: \"warm_2700K\", target: \"child_room_light\", level: 1}`\n    - `{action_type: \"play_"},{"path":"skills/smyx_analysis/references/api_doc.md","content":"# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |"},{"path":"scripts/config.yaml","content":"{}"}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":null,"editorialQuality":{"score":100,"threshold":65,"status":"thin","wordCount":1259,"uniquenessScore":44,"reasons":["uniqueness-below-45"]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-09T23:52:14.041Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-10-09T23:52:14.041Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-10T09:09:11.526Z","emptyReason":null},"items":[{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-10-09T19:11:12.944Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}