{"id":"8c729bef-543c-43ce-8353-776bf8d3712b","entityType":"agent","slug":"clawhub-18072937735-smyx-elderly-nightmare-startle-detect-analy","name":"Elderly Sleep Nightmare / Startle Detection | 老年人睡眠中间惊醒/梦魇行为识别","canonicalUrl":"https://www.xpersona.co/agent/clawhub-18072937735-smyx-elderly-nightmare-startle-detect-analy","canonicalPath":"/agent/clawhub-18072937735-smyx-elderly-nightmare-startle-detect-analy","generatedAt":"2026-10-10T05:40:28.799Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"editorial-content","verified":true,"confidence":"high","updatedAt":"2026-10-10T00:59:36.730Z","emptyReason":null},"description":"Using a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden sitting-up (quick lying-to-sitting transition), screams (high-pitched short cries), and arm-thrashing (purposeless rapid arm movements), and records the occurrence time, frequency and duration of each event. | 通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。 Skill: Elderly Sleep Nightmare / Startle Detection | 老年人睡眠中间惊醒/梦魇行为识别 Owner: 18072937735 Summary: Using a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden sitting-up (quick lying-to-sitting transition), screams (high-pitched short cries), and arm-thrashing (purposeless rapid arm movements), and records the occurrenc","descriptionLabel":"Technical summary","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 1.8K downloads reported by the source. Last updated 10/10/2026.","installCommand":"clawhub skill install s17f8q65zg3y98t86jdg1177g583whq8:smyx-elderly-nightmare-startle-detect-analysis","sourceUrl":"https://clawhub.ai/18072937735/smyx-elderly-nightmare-startle-detect-analysis","homepage":"https://clawhub.ai/18072937735/skills/smyx-elderly-nightmare-startle-detect-analysis","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/18072937735/smyx-elderly-nightmare-startle-detect-analysis","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/18072937735/skills/smyx-elderly-nightmare-startle-detect-analysis","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":65,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"Using a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden "},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-10T00:59:36.730Z","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-10T00:59:36.730Z","emptyReason":null},"stars":null,"forks":null,"downloads":1821,"packageName":null,"latestVersion":"1.0.12","tractionLabel":"1.8K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-10T00:59:36.705Z","emptyReason":null},"lastUpdatedAt":"2026-10-10T00:59:36.730Z","lastCrawledAt":"2026-10-10T00:59:36.705Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-11T00:59:36.705Z","lastVerifiedAt":null,"highlights":[{"version":"1.0.12","createdAt":"2026-09-28T14:40:36.453Z","changelog":"- Removed the file: skill-card.md - No changes to features or user-facing functionality. - Documentation now no longer includes the previously present skill-card markdown file.","fileCount":31,"zipByteSize":42577},{"version":"1.0.11","createdAt":"2026-09-23T20:49:33.705Z","changelog":"- Updated skill version to 1.0.16. - Revised SKILL.md for clarifications and improvements. - Modified configuration in skills/smyx_common/scripts/config.yaml. - Removed redundant skill-card.md file.","fileCount":31,"zipByteSize":42820},{"version":"1.0.10","createdAt":"2026-08-29T01:15:29.338Z","changelog":"Version 1.0.11 - Removed the file: skill-card.md. - Updated the documentation (SKILL.md) to reflect the file structure change. - No changes to skill logic or functionality.","fileCount":31,"zipByteSize":42953},{"version":"1.0.9","createdAt":"2026-08-17T06:09:30.947Z","changelog":"- Updated version to 1.0.10. - Removed redundant skill-card.md documentation file. - SKILL.md: Adjusted/updated documentation for improved clarity and accuracy. - Minor config or documentation adjustments in config.yaml. - No breaking changes to core functionality.","fileCount":31,"zipByteSize":43156},{"version":"1.0.8","createdAt":"2026-08-09T19:12:31.137Z","changelog":"smyx-elderly-nightmare-startle-detect-analysis 1.0.9 - Updated documentation in SKILL.md for clarity and accuracy. - Removed obsolete skill-card.md file. - No changes to detection logic or user workflow. - Documentation now better reflects current behavior and usage.","fileCount":31,"zipByteSize":42940},{"version":"1.0.7","createdAt":"2026-08-04T12:28:33.868Z","changelog":"- Removed the redundant skill-card.md file for simplification. - No changes to functionality or workflow. - Documentation and usage remain the same.","fileCount":31,"zipByteSize":42909},{"version":"1.0.6","createdAt":"2026-07-28T14:40:28.522Z","changelog":"- Updated SKILL.md to version 1.0.8 with refined documentation and instructions. - Removed the `skill-card.md` file from the project. - No logic or API changes; this version focuses on documentation clarity and maintenance. - Workflow, parameter, and usage examples remain unchanged.","fileCount":31,"zipByteSize":42693},{"version":"1.0.5","createdAt":"2026-07-16T23:12:28.477Z","changelog":"smyx-elderly-nightmare-startle-detect-analysis 1.0.5 changelog - Updated documentation: SKILL.md revised with version bump and small improvements. - Removed unnecessary file: skill-card.md. - Minor script improvement in skills/smyx_common/scripts/util.py (details not shown). - No changes to user-facing features; this is primarily a documentation and cleanup update.","fileCount":31,"zipByteSize":42978}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s17f8q65zg3y98t86jdg1177g583whq8:smyx-elderly-nightmare-startle-detect-analysis","setupComplexity":"low","setupSteps":["Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.","Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data."],"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-elderly-nightmare-startle-detect-analy/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-18072937735-smyx-elderly-nightmare-startle-detect-analy/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-18072937735-smyx-elderly-nightmare-startle-detect-analy/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-18072937735-smyx-elderly-nightmare-startle-detect-analy/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-18072937735-smyx-elderly-nightmare-startle-detect-analy/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-18072937735-smyx-elderly-nightmare-startle-detect-analy/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-10T05:40:28.795Z"}},"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-elderly-nightmare-startle-detect-analy/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-18072937735-smyx-elderly-nightmare-startle-detect-analy/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-18072937735-smyx-elderly-nightmare-startle-detect-analy/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-18072937735-smyx-elderly-nightmare-startle-detect-analy/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":"high","updatedAt":"2026-10-10T00:59:36.730Z","emptyReason":null},"readme":"Skill: Elderly Sleep Nightmare / Startle Detection | 老年人睡眠中间惊醒/梦魇行为识别\n\nOwner: 18072937735\n\nSummary: Using a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden sitting-up (quick lying-to-sitting transition), screams (high-pitched short cries), and arm-thrashing (purposeless rapid arm movements), and records the occurrence time, frequency and duration of each event. | 通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。\n\nTags: latest:1.0.12\n\nVersion history:\n\nv1.0.12 | 2026-09-28T14:40:36.453Z | auto\n\n- Removed the file: skill-card.md\n- No changes to features or user-facing functionality.\n- Documentation now no longer includes the previously present skill-card markdown file.\n\nv1.0.11 | 2026-09-23T20:49:33.705Z | auto\n\n- Updated skill version to 1.0.16.\n- Revised SKILL.md for clarifications and improvements.\n- Modified configuration in skills/smyx_common/scripts/config.yaml.\n- Removed redundant skill-card.md file.\n\nv1.0.10 | 2026-08-29T01:15:29.338Z | auto\n\nVersion 1.0.11\n\n- Removed the file: skill-card.md.\n- Updated the documentation (SKILL.md) to reflect the file structure change.\n- No changes to skill logic or functionality.\n\nv1.0.9 | 2026-08-17T06:09:30.947Z | auto\n\n- Updated version to 1.0.10.\n- Removed redundant skill-card.md documentation file.\n- SKILL.md: Adjusted/updated documentation for improved clarity and accuracy.\n- Minor config or documentation adjustments in config.yaml.\n- No breaking changes to core functionality.\n\nv1.0.8 | 2026-08-09T19:12:31.137Z | auto\n\nsmyx-elderly-nightmare-startle-detect-analysis 1.0.9\n\n- Updated documentation in SKILL.md for clarity and accuracy.\n- Removed obsolete skill-card.md file.\n- No changes to detection logic or user workflow.  \n- Documentation now better reflects current behavior and usage.\n\nv1.0.7 | 2026-08-04T12:28:33.868Z | auto\n\n- Removed the redundant skill-card.md file for simplification.\n- No changes to functionality or workflow.\n- Documentation and usage remain the same.\n\nv1.0.6 | 2026-07-28T14:40:28.522Z | auto\n\n- Updated SKILL.md to version 1.0.8 with refined documentation and instructions.\n- Removed the `skill-card.md` file from the project.\n- No logic or API changes; this version focuses on documentation clarity and maintenance.\n- Workflow, parameter, and usage examples remain unchanged.\n\nv1.0.5 | 2026-07-16T23:12:28.477Z | auto\n\nsmyx-elderly-nightmare-startle-detect-analysis 1.0.5 changelog\n\n- Updated documentation: SKILL.md revised with version bump and small improvements.\n- Removed unnecessary file: skill-card.md.\n- Minor script improvement in skills/smyx_common/scripts/util.py (details not shown).\n- No changes to user-facing features; this is primarily a documentation and cleanup update.\n\nv1.0.4 | 2026-07-06T07:40:26.905Z | auto\n\n## Changelog for smyx-elderly-nightmare-startle-detect-analysis v1.0.4\n\n- Updated `scripts/config.py`.\n- Minor configuration or internal logic updates. No user-facing feature or workflow changes.\n\nv1.0.3 | 2026-07-02T07:32:29.649Z | auto\n\n- Major documentation overhaul: user identity parameter handling is now fully automatic and hidden from users.\n- Added clear privacy and security guidelines, explicitly forbidding identity prompts or exposure.\n- Refined operational steps and usage workflow, emphasizing internal association of user/session for report queries.\n- Updated and expanded capability lists, usage scenarios, API parameter tables, and example commands.\n- Improved Markdown structure for better readability and conciseness.\n- Deprecated manual identity parameter logic; user-facing prompts for open-id/username/phone are removed.\n\nv1.0.2 | 2026-06-22T03:32:29.178Z | auto\n\n- Removed the file: skill-card.md.\n- No changes to skill logic or capability; only documentation cleanup.\n\nv1.0.1 | 2026-06-18T14:33:48.329Z | auto\n\n- Improved configuration file lookup order for open-id acquisition, updating file paths and priority rules.\n- Updated documentation to reflect the new config file structure and acquisition flow.\n- Added license information to the SKILL.md file.\n- Removed outdated or redundant documentation files (such as skill-card.md).\n\nv1.0.0 | 2026-05-27T08:09:58.428Z | auto\n\nInitial release of the elderly nighttime sleep abnormal event detection skill.\n\n- Monitors and analyzes elderly nighttime sleep via infrared night vision camera and microphone.\n- Detects key abnormal sleep events: sudden sitting-up, screams, and arm-thrashing.\n- Records event time, frequency, duration, and generates structured sleep-abnormality event reports.\n- Provides risk assessment, behavior mode classification, and family/caregiver-friendly summaries.\n- Enables integration with smart-home cameras or elderly-care monitoring platforms.\n- Strict open-id workflow for user identity and secure access to historical reports.\n\nArchive index:\n\nArchive v1.0.12: 31 files, 42577 bytes\n\nFiles: references/api_doc.md (5015b), scripts/__init__.py (62b), scripts/config.py (707b), scripts/config.yaml (3b), scripts/skill.py (595b), scripts/smyx_elderly_nightmare_startle_detect_analysis.py (3803b), skill-card.md (1983b), SKILL.md (14357b), 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 (166b)\n\nFile v1.0.12:SKILL.md\n\n---\nname: \"smyx-elderly-nightmare-startle-detect-analysis\"\ndescription: \"Using a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden sitting-up (quick lying-to-sitting transition), screams (high-pitched short cries), and arm-thrashing (purposeless rapid arm movements), and records the occurrence time, frequency and duration of each event. | 通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。\"\nversion: \"1.0.16\"\nlicense: \"MIT-0\"\n---\n\n# 🌙 Elderly Sleep Nightmare / Startle Detection | 老年人睡眠中间惊醒/梦魇行为识别\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **老年人睡眠中间惊醒/梦魇行为识别** |\n| 🎯 核心目标 | 通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_ELDERLY_NIGHTMARE_STARTLE_DETECT_ANALYSIS` |\n\nUsing a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden sitting-up (quick lying-to-sitting transition), screams (high-pitched short cries), and arm-thrashing (purposeless rapid arm movements), and records the occurrence time, frequency and duration of each event. This skill helps family members or caregivers understand the elderly person's nighttime sleep quality and identify possible nightmares or REM-sleep Behavior Disorder (RBD), providing reference data for medical evaluation. Application scenarios: home elderly care, nursing homes, neurology sleep monitoring. The system relays monitoring through the night and generates a sleep-abnormality event report. Skill features: frequent nighttime awakenings or nightmares in the elderly may be early manifestations of neurological diseases such as RBD. AI auto-recording of abnormal events provides objective data for physicians, supporting early diagnosis of Parkinson's disease and other neurodegenerative conditions. Can be integrated into smart-home cameras or elderly-care monitoring platforms as an important health-warning tool.\n\n通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。应用场景：居家养老、养老院、神经内科睡眠监测。系统夜间接力监测，生成睡眠异常事件报告。技能特点：老年人夜间频繁惊醒、梦魇可能是快速眼动期睡眠行为障碍（RBD）等神经系统疾病的早期表现。通过AI自动记录异常行为，可为医生提供客观数据，帮助早期诊断帕金森病等神经退行性疾病。该技能可集成到智能家居摄像头或养老监护平台中，成为健康预警的重要工具。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的老年人睡眠行为监测 AI。你的任务是分析卧室固定摄像头的夜间视频（含音频），检测老年人睡眠中的异常行为，包括突然坐起、惊叫声音、无目的挥舞手臂、踢腿等。记录每次事件的起止时间、持续时长，统计夜间总频次与高发时段。不要提供医疗诊断，仅输出基于视觉和音频的行为事件统计，并在频繁或疑似 RBD 模式时附神经内科/睡眠门诊就诊建议。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于卧室固定摄像头（红外夜视 + 麦克风）夜间睡眠音视频（建议 ≥ 6 小时），识别异常事件（突然坐起 / 无目的挥臂 / 踢腿 / 离床 / 惊叫 / 梦呓 / 异常粗重呼吸）→ 输出事件清单 + 时间线 + 频次密度 + 高发时段 + 睡眠连续性评分 → 推断行为模式（pure_nightmare / suspect_rbd / general_arousal / mixed / none）+ 风险信号等级 + 家属友好摘要 + 神经内科/睡眠门诊就诊建议\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 人体姿态识别（躺卧 → 坐立快速切换检测 |\n| 2 | < 2 秒） |\n| 3 | 无目的快速挥臂识别 |\n| 4 | 踢腿识别 |\n| 5 | 离床检测（参考） |\n| 6 | 音频惊叫识别（频谱 + 短时能量） |\n| 7 | 梦呓 / 异常粗重呼吸识别（参考） |\n| 8 | 事件时间线生成（含证据短片 ≤ 30 秒） |\n| 9 | 每小时事件密度统计 |\n| 10 | 高发时段定位（如 03:00-04:00 REM 期） |\n| 11 | 睡眠连续性评分 |\n| 12 | 行为模式分类 |\n| 13 | 4 档风险信号（none / mild / notable / strong） |\n| 14 | 家属友好摘要文本生成 |\n| 15 | 专科就诊建议生成 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供卧室固定摄像头（红外夜视、含麦克风）夜间睡眠音视频 URL 或文件需要分析时，默认触发本技能进行老年人睡眠中间惊醒/梦魇行为识别 |\n| 🔎 明确分析意图 | 当用户明确提及老人夜间惊醒、梦魇、说梦话、半夜坐起、半夜叫喊、挥臂踢腿、RBD、快速眼动行为障碍、帕金森早期、睡眠门诊等关键词，并且上传了音视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看睡眠异常历史报告、夜间惊醒/梦魇报告清单、老人睡眠事件清单、查询历史睡眠异常记录、显示所有夜间异常分析报告、显示睡眠监测报告，查询睡眠异常预警清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_elderly_nightmare_startle_detect_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 | 🔐 系统自动完成身份关联 | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行老年人睡眠中间惊醒/梦魇行为识别 | 调用 `-m scripts.smyx_elderly_nightmare_startle_detect_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_elderly_nightmare_startle_detect_analysis.py`](scripts/smyx_elderly_nightmare_startle_detect_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；**关键**：必须红外夜视 + 麦克风音轨；时长建议 ≥ 6 小时 |\n| 🔎 使用提醒 | 单次喷嚏、咳嗽、翻身、起夜如厕等正常生理活动不应计入异常事件 |\n| 🔎 使用提醒 | 双人共眠时需正确归属事件到老人，避免家属/伴侣的动作被误归 |\n| 🧑‍⚖️ 结果性质 | 红线约束：**禁止**输出 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停综合征等任何医学诊断；**禁止**根据本工具结果调整药物；**禁止**长期存储夜间原始视频 |\n| 🔎 使用提醒 | 数据保管：建议仅保存事件片段证据（≤ 30 秒）+ 指标统计，原始视频流不入库 |\n| 🔎 使用提醒 | 当出现 `frequent` 或 `suspect_rbd_pattern` 时，**必须**在摘要中附\"建议尽快就诊神经内科 / 睡眠门诊进行 PSG（多导睡眠图）检查\" |\n| 🔏 隐私合规 | 隐私合规：卧室夜间视频涉及高度敏感个人隐私，使用前需取得**老人本人**明确知情同意，妥善加密保管；建议优先采用人体轮廓 + 面部马赛克模式 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地夜间睡眠音视频\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input /path/to/night_sleep.mp4\n\n# 分析网络夜间睡眠音视频\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --url https://example.com/night_sleep.mp4\n\n# 显示历史老年人睡眠中间惊醒/梦魇报告（自动触发关键词：查看睡眠异常历史报告、夜间惊醒/梦魇报告清单等）\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input ns.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input ns.mp4 --output result.json\n```\n\nFile v1.0.12:_meta.json\n\n{\n  \"ownerId\": \"kn7e2caqj7pnsvr9r7t8zenghs83xw7n\",\n  \"slug\": \"smyx-elderly-nightmare-startle-detect-analysis\",\n  \"version\": \"1.0.12\",\n  \"publishedAt\": 1790606436453\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}` - 导出完整报告\n\n## 场景代码\n\n- `SMYX_ELDERLY_NIGHTMARE_STARTLE_DETECT_ANALYSIS` - 老年人睡眠中间惊醒/梦魇行为识别\n\n## 输入约束\n\n- 摄像头：卧室固定摄像头，**必须支持红外夜视**（IR），**必须含麦克风**（惊叫识别依赖音频）；能完整拍到老人在床的上半身\n- 帧率 ≥ 5 FPS（夜间统计无需高帧率）；分辨率 ≥ 480p；音频采样率 ≥ 16kHz\n- 视频时长：建议覆盖完整睡眠时段（22:00 → 次日 07:00 左右），**单次分析建议 ≥ 6 小时**\n- ROI 标定：床位 ROI（bed_region）\n- 多人共眠场景（如老两口）需按目标跟踪，避免事件归属错误\n- 隐私敏感场景必须启用人体轮廓 + 面部马赛克模式\n\n## 关键观测信号\n\n### 视觉\n- `sudden_sit_up_event_count` - 突然坐起事件次数（快速从躺卧→坐立，<2 秒完成）\n- `arm_thrashing_event_count` - 无目的快速挥舞手臂事件次数（疑似 RBD 表现）\n- `kick_leg_event_count` - 踢腿事件次数（参考指标）\n- `out_of_bed_event_count` - 离床事件次数（参考指标，与 wandering 技能配合）\n- `total_event_duration_sec` - 全部异常事件累计时长\n\n### 音频\n- `scream_event_count` - 高频短促叫声次数（基于频谱+短时能量）\n- `mumble_or_talking_in_sleep_count` - 梦呓/说梦话次数（参考指标）\n- `loud_breathing_event_count` - 异常粗重呼吸事件（参考指标，可能与睡眠呼吸暂停相关）\n\n### 综合\n- `sleep_window` - 监测时间窗（如 22:00-07:00）\n- `total_abnormal_event_count` - 异常事件总次数\n- `event_density_per_hour` - 每小时事件密度\n- `peak_event_hour` - 异常事件高发时段（如 03:00-04:00，REM 期密集）\n- `sleep_continuity_score` - 睡眠连续性评分（0-100，越高越连续）\n\n## 阈值与等级\n\n- `0-1 次/夜` - normal（正常）\n- `2-3 次/夜` - mild（轻度）\n- `4-7 次/夜` - notable（较频繁）→ 建议记录跟踪\n- `≥ 8 次/夜` 或 `单晚出现 ≥ 1 次 arm_thrashing + scream` 组合 - frequent（频繁）→ 建议尽快就诊神经内科 / 睡眠门诊\n- 单次喷嚏 / 咳嗽 / 翻身等正常生理活动不应计入异常事件\n\n## 输出字段（参考）\n\n- `sleep_window` / `bed_occupied_minutes`\n- `visual_events` / `audio_events`\n- `event_timeline` - 异常事件时间线（每条含 start_ts / end_ts / type / duration_sec / evidence_snippet_url，原始视频不留存）\n- `total_abnormal_event_count` / `event_density_per_hour` / `peak_event_hour`\n- `sleep_continuity_score`\n- `abnormal_pattern` - 行为模式（pure_nightmare / suspect_rbd / general_arousal / mixed / none）\n- `risk_signal_level` - 风险信号等级（none / mild / notable / strong）\n- `alert_type` - 提醒类型（sleep_abnormal_notable / sleep_abnormal_frequent / suspect_rbd_pattern / improving / normal）\n- `alert_level` - 提醒级别（info / notice / warning）\n- `family_summary` - 家属友好摘要（如\"昨晚老人在 03:12 突然坐起并伴随短促叫声 1 次，03:38 出现挥舞手臂约 8 秒；夜间共 3 次异常事件，建议白天观察精神状态，若反复出现建议就诊神经内科睡眠门诊\"）\n- `recommend_action` - 建议动作（push_family_summary / suggest_record_diary / suggest_consult_sleep_clinic / suggest_neurology_consult / observe_only）\n- `clinical_reference` - 当 frequent 或 suspect_rbd_pattern 时附**神经内科 / 睡眠门诊就诊建议** + 中国睡眠研究会等参考资源\n\n## 强制约束与红线\n\n- ❌ **禁止**输出 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停综合征等任何医学诊断结论\n- ❌ **禁止**根据本工具结果调整药物\n- ❌ **禁止**长期存储夜间原始视频；建议仅保存事件片段证据（短片，≤ 30 秒）+ 指标统计\n- ✅ 出现 frequent 或 suspect_rbd_pattern 时附**神经内科 / 睡眠门诊** 就诊建议\n- ✅ 建议家属将事件清单作为**就诊参考资料**，由专科医生结合 PSG（多导睡眠图）等专业检查最终判定\n\n> 仅输出基于视觉与音频的客观行为事件统计，**不构成 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停等任何医学诊断**；任何疑似神经退行性疾病或睡眠障碍的判定与治疗必须由神经内科 / 睡眠专科医生结合 PSG 等专业检查制定。\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 nighttime bedroom audio and video for sudden sitting up, screams, and arm movements, and reports when and how often these events occur.\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\nFamily caregivers and care staff use this skill to review an older person's nighttime sleep events and share observations with a clinician, not to make a medical diagnosis.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Sensitive bedroom audio/video and historical sleep reports are sent to configured cloud services.\n\nMitigation: Obtain the older person's clear consent before use and review the cloud services' data handling before sharing recordings or reports.\n\nRisk: The skill silently creates and reuses identities and tokens, including a local token database, without a clear deletion or opt-out path.\n\nMitigation: Audit identity creation, token storage and retention before installation or deployment; do not use until the deletion and opt-out expectations are acceptable.\n\n## Reference(s):\n\n- [Skill API documentation](references/api_doc.md)\n- [ClawHub skill listing](https://clawhub.ai/18072937735/skills/smyx-elderly-nightmare-startle-detect-analysis)\n\n## Skill Output:\n\n**Output Type(s):** [Text, Markdown, JSON, Guidance]\n\n**Output Format:** [Structured JSON or text/Markdown report]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Event times, counts, durations, summaries, recommendations and report links; optional saved JSON output.]\n\n## Skill Version(s):\n\n1.0.12 (source: server-resolved ClawHub release)\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, 42820 bytes\n\nFiles: references/api_doc.md (5015b), scripts/__init__.py (62b), scripts/config.py (707b), scripts/config.yaml (3b), scripts/skill.py (595b), scripts/smyx_elderly_nightmare_startle_detect_analysis.py (3803b), skill-card.md (2569b), SKILL.md (14357b), 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 (166b)\n\nFile v1.0.11:SKILL.md\n\n---\nname: \"smyx-elderly-nightmare-startle-detect-analysis\"\ndescription: \"Using a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden sitting-up (quick lying-to-sitting transition), screams (high-pitched short cries), and arm-thrashing (purposeless rapid arm movements), and records the occurrence time, frequency and duration of each event. | 通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。\"\nversion: \"1.0.16\"\nlicense: \"MIT-0\"\n---\n\n# 🌙 Elderly Sleep Nightmare / Startle Detection | 老年人睡眠中间惊醒/梦魇行为识别\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **老年人睡眠中间惊醒/梦魇行为识别** |\n| 🎯 核心目标 | 通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_ELDERLY_NIGHTMARE_STARTLE_DETECT_ANALYSIS` |\n\nUsing a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden sitting-up (quick lying-to-sitting transition), screams (high-pitched short cries), and arm-thrashing (purposeless rapid arm movements), and records the occurrence time, frequency and duration of each event. This skill helps family members or caregivers understand the elderly person's nighttime sleep quality and identify possible nightmares or REM-sleep Behavior Disorder (RBD), providing reference data for medical evaluation. Application scenarios: home elderly care, nursing homes, neurology sleep monitoring. The system relays monitoring through the night and generates a sleep-abnormality event report. Skill features: frequent nighttime awakenings or nightmares in the elderly may be early manifestations of neurological diseases such as RBD. AI auto-recording of abnormal events provides objective data for physicians, supporting early diagnosis of Parkinson's disease and other neurodegenerative conditions. Can be integrated into smart-home cameras or elderly-care monitoring platforms as an important health-warning tool.\n\n通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。应用场景：居家养老、养老院、神经内科睡眠监测。系统夜间接力监测，生成睡眠异常事件报告。技能特点：老年人夜间频繁惊醒、梦魇可能是快速眼动期睡眠行为障碍（RBD）等神经系统疾病的早期表现。通过AI自动记录异常行为，可为医生提供客观数据，帮助早期诊断帕金森病等神经退行性疾病。该技能可集成到智能家居摄像头或养老监护平台中，成为健康预警的重要工具。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的老年人睡眠行为监测 AI。你的任务是分析卧室固定摄像头的夜间视频（含音频），检测老年人睡眠中的异常行为，包括突然坐起、惊叫声音、无目的挥舞手臂、踢腿等。记录每次事件的起止时间、持续时长，统计夜间总频次与高发时段。不要提供医疗诊断，仅输出基于视觉和音频的行为事件统计，并在频繁或疑似 RBD 模式时附神经内科/睡眠门诊就诊建议。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于卧室固定摄像头（红外夜视 + 麦克风）夜间睡眠音视频（建议 ≥ 6 小时），识别异常事件（突然坐起 / 无目的挥臂 / 踢腿 / 离床 / 惊叫 / 梦呓 / 异常粗重呼吸）→ 输出事件清单 + 时间线 + 频次密度 + 高发时段 + 睡眠连续性评分 → 推断行为模式（pure_nightmare / suspect_rbd / general_arousal / mixed / none）+ 风险信号等级 + 家属友好摘要 + 神经内科/睡眠门诊就诊建议\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 人体姿态识别（躺卧 → 坐立快速切换检测 |\n| 2 | < 2 秒） |\n| 3 | 无目的快速挥臂识别 |\n| 4 | 踢腿识别 |\n| 5 | 离床检测（参考） |\n| 6 | 音频惊叫识别（频谱 + 短时能量） |\n| 7 | 梦呓 / 异常粗重呼吸识别（参考） |\n| 8 | 事件时间线生成（含证据短片 ≤ 30 秒） |\n| 9 | 每小时事件密度统计 |\n| 10 | 高发时段定位（如 03:00-04:00 REM 期） |\n| 11 | 睡眠连续性评分 |\n| 12 | 行为模式分类 |\n| 13 | 4 档风险信号（none / mild / notable / strong） |\n| 14 | 家属友好摘要文本生成 |\n| 15 | 专科就诊建议生成 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供卧室固定摄像头（红外夜视、含麦克风）夜间睡眠音视频 URL 或文件需要分析时，默认触发本技能进行老年人睡眠中间惊醒/梦魇行为识别 |\n| 🔎 明确分析意图 | 当用户明确提及老人夜间惊醒、梦魇、说梦话、半夜坐起、半夜叫喊、挥臂踢腿、RBD、快速眼动行为障碍、帕金森早期、睡眠门诊等关键词，并且上传了音视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看睡眠异常历史报告、夜间惊醒/梦魇报告清单、老人睡眠事件清单、查询历史睡眠异常记录、显示所有夜间异常分析报告、显示睡眠监测报告，查询睡眠异常预警清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_elderly_nightmare_startle_detect_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 | 🔐 系统自动完成身份关联 | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行老年人睡眠中间惊醒/梦魇行为识别 | 调用 `-m scripts.smyx_elderly_nightmare_startle_detect_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_elderly_nightmare_startle_detect_analysis.py`](scripts/smyx_elderly_nightmare_startle_detect_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；**关键**：必须红外夜视 + 麦克风音轨；时长建议 ≥ 6 小时 |\n| 🔎 使用提醒 | 单次喷嚏、咳嗽、翻身、起夜如厕等正常生理活动不应计入异常事件 |\n| 🔎 使用提醒 | 双人共眠时需正确归属事件到老人，避免家属/伴侣的动作被误归 |\n| 🧑‍⚖️ 结果性质 | 红线约束：**禁止**输出 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停综合征等任何医学诊断；**禁止**根据本工具结果调整药物；**禁止**长期存储夜间原始视频 |\n| 🔎 使用提醒 | 数据保管：建议仅保存事件片段证据（≤ 30 秒）+ 指标统计，原始视频流不入库 |\n| 🔎 使用提醒 | 当出现 `frequent` 或 `suspect_rbd_pattern` 时，**必须**在摘要中附\"建议尽快就诊神经内科 / 睡眠门诊进行 PSG（多导睡眠图）检查\" |\n| 🔏 隐私合规 | 隐私合规：卧室夜间视频涉及高度敏感个人隐私，使用前需取得**老人本人**明确知情同意，妥善加密保管；建议优先采用人体轮廓 + 面部马赛克模式 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地夜间睡眠音视频\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input /path/to/night_sleep.mp4\n\n# 分析网络夜间睡眠音视频\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --url https://example.com/night_sleep.mp4\n\n# 显示历史老年人睡眠中间惊醒/梦魇报告（自动触发关键词：查看睡眠异常历史报告、夜间惊醒/梦魇报告清单等）\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input ns.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input ns.mp4 --output result.json\n```\n\nFile v1.0.11:_meta.json\n\n{\n  \"ownerId\": \"kn7e2caqj7pnsvr9r7t8zenghs83xw7n\",\n  \"slug\": \"smyx-elderly-nightmare-startle-detect-analysis\",\n  \"version\": \"1.0.11\",\n  \"publishedAt\": 1790196573705\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}` - 导出完整报告\n\n## 场景代码\n\n- `SMYX_ELDERLY_NIGHTMARE_STARTLE_DETECT_ANALYSIS` - 老年人睡眠中间惊醒/梦魇行为识别\n\n## 输入约束\n\n- 摄像头：卧室固定摄像头，**必须支持红外夜视**（IR），**必须含麦克风**（惊叫识别依赖音频）；能完整拍到老人在床的上半身\n- 帧率 ≥ 5 FPS（夜间统计无需高帧率）；分辨率 ≥ 480p；音频采样率 ≥ 16kHz\n- 视频时长：建议覆盖完整睡眠时段（22:00 → 次日 07:00 左右），**单次分析建议 ≥ 6 小时**\n- ROI 标定：床位 ROI（bed_region）\n- 多人共眠场景（如老两口）需按目标跟踪，避免事件归属错误\n- 隐私敏感场景必须启用人体轮廓 + 面部马赛克模式\n\n## 关键观测信号\n\n### 视觉\n- `sudden_sit_up_event_count` - 突然坐起事件次数（快速从躺卧→坐立，<2 秒完成）\n- `arm_thrashing_event_count` - 无目的快速挥舞手臂事件次数（疑似 RBD 表现）\n- `kick_leg_event_count` - 踢腿事件次数（参考指标）\n- `out_of_bed_event_count` - 离床事件次数（参考指标，与 wandering 技能配合）\n- `total_event_duration_sec` - 全部异常事件累计时长\n\n### 音频\n- `scream_event_count` - 高频短促叫声次数（基于频谱+短时能量）\n- `mumble_or_talking_in_sleep_count` - 梦呓/说梦话次数（参考指标）\n- `loud_breathing_event_count` - 异常粗重呼吸事件（参考指标，可能与睡眠呼吸暂停相关）\n\n### 综合\n- `sleep_window` - 监测时间窗（如 22:00-07:00）\n- `total_abnormal_event_count` - 异常事件总次数\n- `event_density_per_hour` - 每小时事件密度\n- `peak_event_hour` - 异常事件高发时段（如 03:00-04:00，REM 期密集）\n- `sleep_continuity_score` - 睡眠连续性评分（0-100，越高越连续）\n\n## 阈值与等级\n\n- `0-1 次/夜` - normal（正常）\n- `2-3 次/夜` - mild（轻度）\n- `4-7 次/夜` - notable（较频繁）→ 建议记录跟踪\n- `≥ 8 次/夜` 或 `单晚出现 ≥ 1 次 arm_thrashing + scream` 组合 - frequent（频繁）→ 建议尽快就诊神经内科 / 睡眠门诊\n- 单次喷嚏 / 咳嗽 / 翻身等正常生理活动不应计入异常事件\n\n## 输出字段（参考）\n\n- `sleep_window` / `bed_occupied_minutes`\n- `visual_events` / `audio_events`\n- `event_timeline` - 异常事件时间线（每条含 start_ts / end_ts / type / duration_sec / evidence_snippet_url，原始视频不留存）\n- `total_abnormal_event_count` / `event_density_per_hour` / `peak_event_hour`\n- `sleep_continuity_score`\n- `abnormal_pattern` - 行为模式（pure_nightmare / suspect_rbd / general_arousal / mixed / none）\n- `risk_signal_level` - 风险信号等级（none / mild / notable / strong）\n- `alert_type` - 提醒类型（sleep_abnormal_notable / sleep_abnormal_frequent / suspect_rbd_pattern / improving / normal）\n- `alert_level` - 提醒级别（info / notice / warning）\n- `family_summary` - 家属友好摘要（如\"昨晚老人在 03:12 突然坐起并伴随短促叫声 1 次，03:38 出现挥舞手臂约 8 秒；夜间共 3 次异常事件，建议白天观察精神状态，若反复出现建议就诊神经内科睡眠门诊\"）\n- `recommend_action` - 建议动作（push_family_summary / suggest_record_diary / suggest_consult_sleep_clinic / suggest_neurology_consult / observe_only）\n- `clinical_reference` - 当 frequent 或 suspect_rbd_pattern 时附**神经内科 / 睡眠门诊就诊建议** + 中国睡眠研究会等参考资源\n\n## 强制约束与红线\n\n- ❌ **禁止**输出 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停综合征等任何医学诊断结论\n- ❌ **禁止**根据本工具结果调整药物\n- ❌ **禁止**长期存储夜间原始视频；建议仅保存事件片段证据（短片，≤ 30 秒）+ 指标统计\n- ✅ 出现 frequent 或 suspect_rbd_pattern 时附**神经内科 / 睡眠门诊** 就诊建议\n- ✅ 建议家属将事件清单作为**就诊参考资料**，由专科医生结合 PSG（多导睡眠图）等专业检查最终判定\n\n> 仅输出基于视觉与音频的客观行为事件统计，**不构成 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停等任何医学诊断**；任何疑似神经退行性疾病或睡眠障碍的判定与治疗必须由神经内科 / 睡眠专科医生结合 PSG 等专业检查制定。\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: prod\n\nFile v1.0.11:skill-card.md\n\n## Description:\n\nUsing a fixed bedroom camera with infrared night vision and microphone audio, this skill analyzes elderly nighttime sleep video to detect sudden sitting-up, screams, arm-thrashing, and related abnormal sleep events, then records event timing, frequency, duration, and caregiver-facing 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, caregivers, and developers use this skill to submit fixed-camera nighttime sleep video or a report-query request and receive structured sleep-event analysis, history lookup results, and non-diagnostic recommendations for follow-up with appropriate clinicians.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The skill uploads highly sensitive bedroom video and audio to cloud APIs and generates sleep-health reports.\n\nMitigation: Use only with explicit consent from the monitored person, confirm the cloud provider, retention and deletion terms, and access controls before installation or use.\n\nRisk: The skill silently creates or reuses local identity tokens for report association.\n\nMitigation: Use a dedicated workspace and review local token storage and access controls before handling real personal data.\n\nRisk: Outputs can be mistaken for medical diagnosis or treatment guidance.\n\nMitigation: Treat results as behavioral observations only; do not use them for diagnosis, medication changes, or replacing clinician review.\n\n## Reference(s):\n\n- [Skill API Documentation](references/api_doc.md)\n- [Shared Analysis API Documentation](skills/smyx_analysis/references/api_doc.md)\n- [ClawHub Skill Page](https://clawhub.ai/18072937735/skills/smyx-elderly-nightmare-startle-detect-analysis)\n\n## Skill Output:\n\n**Output Type(s):** [Analysis, Markdown, JSON, Shell commands, Guidance]\n\n**Output Format:** [Markdown or JSON sleep-event report with event counts, timelines, risk signal level, recommendations, and optional report links]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May save the generated report to a user-specified output file.]\n\n## Skill Version(s):\n\n1.0.11 (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.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, 42953 bytes\n\nFiles: references/api_doc.md (5015b), scripts/__init__.py (62b), scripts/config.py (707b), scripts/config.yaml (3b), scripts/skill.py (595b), scripts/smyx_elderly_nightmare_startle_detect_analysis.py (3803b), skill-card.md (2805b), SKILL.md (14357b), 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 (166b)\n\nFile v1.0.10:SKILL.md\n\n---\nname: \"smyx-elderly-nightmare-startle-detect-analysis\"\ndescription: \"Using a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden sitting-up (quick lying-to-sitting transition), screams (high-pitched short cries), and arm-thrashing (purposeless rapid arm movements), and records the occurrence time, frequency and duration of each event. | 通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。\"\nversion: \"1.0.11\"\nlicense: \"MIT-0\"\n---\n\n# 🌙 Elderly Sleep Nightmare / Startle Detection | 老年人睡眠中间惊醒/梦魇行为识别\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **老年人睡眠中间惊醒/梦魇行为识别** |\n| 🎯 核心目标 | 通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_ELDERLY_NIGHTMARE_STARTLE_DETECT_ANALYSIS` |\n\nUsing a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden sitting-up (quick lying-to-sitting transition), screams (high-pitched short cries), and arm-thrashing (purposeless rapid arm movements), and records the occurrence time, frequency and duration of each event. This skill helps family members or caregivers understand the elderly person's nighttime sleep quality and identify possible nightmares or REM-sleep Behavior Disorder (RBD), providing reference data for medical evaluation. Application scenarios: home elderly care, nursing homes, neurology sleep monitoring. The system relays monitoring through the night and generates a sleep-abnormality event report. Skill features: frequent nighttime awakenings or nightmares in the elderly may be early manifestations of neurological diseases such as RBD. AI auto-recording of abnormal events provides objective data for physicians, supporting early diagnosis of Parkinson's disease and other neurodegenerative conditions. Can be integrated into smart-home cameras or elderly-care monitoring platforms as an important health-warning tool.\n\n通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。应用场景：居家养老、养老院、神经内科睡眠监测。系统夜间接力监测，生成睡眠异常事件报告。技能特点：老年人夜间频繁惊醒、梦魇可能是快速眼动期睡眠行为障碍（RBD）等神经系统疾病的早期表现。通过AI自动记录异常行为，可为医生提供客观数据，帮助早期诊断帕金森病等神经退行性疾病。该技能可集成到智能家居摄像头或养老监护平台中，成为健康预警的重要工具。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的老年人睡眠行为监测 AI。你的任务是分析卧室固定摄像头的夜间视频（含音频），检测老年人睡眠中的异常行为，包括突然坐起、惊叫声音、无目的挥舞手臂、踢腿等。记录每次事件的起止时间、持续时长，统计夜间总频次与高发时段。不要提供医疗诊断，仅输出基于视觉和音频的行为事件统计，并在频繁或疑似 RBD 模式时附神经内科/睡眠门诊就诊建议。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于卧室固定摄像头（红外夜视 + 麦克风）夜间睡眠音视频（建议 ≥ 6 小时），识别异常事件（突然坐起 / 无目的挥臂 / 踢腿 / 离床 / 惊叫 / 梦呓 / 异常粗重呼吸）→ 输出事件清单 + 时间线 + 频次密度 + 高发时段 + 睡眠连续性评分 → 推断行为模式（pure_nightmare / suspect_rbd / general_arousal / mixed / none）+ 风险信号等级 + 家属友好摘要 + 神经内科/睡眠门诊就诊建议\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 人体姿态识别（躺卧 → 坐立快速切换检测 |\n| 2 | < 2 秒） |\n| 3 | 无目的快速挥臂识别 |\n| 4 | 踢腿识别 |\n| 5 | 离床检测（参考） |\n| 6 | 音频惊叫识别（频谱 + 短时能量） |\n| 7 | 梦呓 / 异常粗重呼吸识别（参考） |\n| 8 | 事件时间线生成（含证据短片 ≤ 30 秒） |\n| 9 | 每小时事件密度统计 |\n| 10 | 高发时段定位（如 03:00-04:00 REM 期） |\n| 11 | 睡眠连续性评分 |\n| 12 | 行为模式分类 |\n| 13 | 4 档风险信号（none / mild / notable / strong） |\n| 14 | 家属友好摘要文本生成 |\n| 15 | 专科就诊建议生成 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供卧室固定摄像头（红外夜视、含麦克风）夜间睡眠音视频 URL 或文件需要分析时，默认触发本技能进行老年人睡眠中间惊醒/梦魇行为识别 |\n| 🔎 明确分析意图 | 当用户明确提及老人夜间惊醒、梦魇、说梦话、半夜坐起、半夜叫喊、挥臂踢腿、RBD、快速眼动行为障碍、帕金森早期、睡眠门诊等关键词，并且上传了音视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看睡眠异常历史报告、夜间惊醒/梦魇报告清单、老人睡眠事件清单、查询历史睡眠异常记录、显示所有夜间异常分析报告、显示睡眠监测报告，查询睡眠异常预警清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_elderly_nightmare_startle_detect_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 | 🔐 系统自动完成身份关联 | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行老年人睡眠中间惊醒/梦魇行为识别 | 调用 `-m scripts.smyx_elderly_nightmare_startle_detect_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_elderly_nightmare_startle_detect_analysis.py`](scripts/smyx_elderly_nightmare_startle_detect_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；**关键**：必须红外夜视 + 麦克风音轨；时长建议 ≥ 6 小时 |\n| 🔎 使用提醒 | 单次喷嚏、咳嗽、翻身、起夜如厕等正常生理活动不应计入异常事件 |\n| 🔎 使用提醒 | 双人共眠时需正确归属事件到老人，避免家属/伴侣的动作被误归 |\n| 🧑‍⚖️ 结果性质 | 红线约束：**禁止**输出 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停综合征等任何医学诊断；**禁止**根据本工具结果调整药物；**禁止**长期存储夜间原始视频 |\n| 🔎 使用提醒 | 数据保管：建议仅保存事件片段证据（≤ 30 秒）+ 指标统计，原始视频流不入库 |\n| 🔎 使用提醒 | 当出现 `frequent` 或 `suspect_rbd_pattern` 时，**必须**在摘要中附\"建议尽快就诊神经内科 / 睡眠门诊进行 PSG（多导睡眠图）检查\" |\n| 🔏 隐私合规 | 隐私合规：卧室夜间视频涉及高度敏感个人隐私，使用前需取得**老人本人**明确知情同意，妥善加密保管；建议优先采用人体轮廓 + 面部马赛克模式 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地夜间睡眠音视频\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input /path/to/night_sleep.mp4\n\n# 分析网络夜间睡眠音视频\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --url https://example.com/night_sleep.mp4\n\n# 显示历史老年人睡眠中间惊醒/梦魇报告（自动触发关键词：查看睡眠异常历史报告、夜间惊醒/梦魇报告清单等）\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input ns.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input ns.mp4 --output result.json\n```\n\nFile v1.0.10:_meta.json\n\n{\n  \"ownerId\": \"kn7e2caqj7pnsvr9r7t8zenghs83xw7n\",\n  \"slug\": \"smyx-elderly-nightmare-startle-detect-analysis\",\n  \"version\": \"1.0.10\",\n  \"publishedAt\": 1787966129338\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}` - 导出完整报告\n\n## 场景代码\n\n- `SMYX_ELDERLY_NIGHTMARE_STARTLE_DETECT_ANALYSIS` - 老年人睡眠中间惊醒/梦魇行为识别\n\n## 输入约束\n\n- 摄像头：卧室固定摄像头，**必须支持红外夜视**（IR），**必须含麦克风**（惊叫识别依赖音频）；能完整拍到老人在床的上半身\n- 帧率 ≥ 5 FPS（夜间统计无需高帧率）；分辨率 ≥ 480p；音频采样率 ≥ 16kHz\n- 视频时长：建议覆盖完整睡眠时段（22:00 → 次日 07:00 左右），**单次分析建议 ≥ 6 小时**\n- ROI 标定：床位 ROI（bed_region）\n- 多人共眠场景（如老两口）需按目标跟踪，避免事件归属错误\n- 隐私敏感场景必须启用人体轮廓 + 面部马赛克模式\n\n## 关键观测信号\n\n### 视觉\n- `sudden_sit_up_event_count` - 突然坐起事件次数（快速从躺卧→坐立，<2 秒完成）\n- `arm_thrashing_event_count` - 无目的快速挥舞手臂事件次数（疑似 RBD 表现）\n- `kick_leg_event_count` - 踢腿事件次数（参考指标）\n- `out_of_bed_event_count` - 离床事件次数（参考指标，与 wandering 技能配合）\n- `total_event_duration_sec` - 全部异常事件累计时长\n\n### 音频\n- `scream_event_count` - 高频短促叫声次数（基于频谱+短时能量）\n- `mumble_or_talking_in_sleep_count` - 梦呓/说梦话次数（参考指标）\n- `loud_breathing_event_count` - 异常粗重呼吸事件（参考指标，可能与睡眠呼吸暂停相关）\n\n### 综合\n- `sleep_window` - 监测时间窗（如 22:00-07:00）\n- `total_abnormal_event_count` - 异常事件总次数\n- `event_density_per_hour` - 每小时事件密度\n- `peak_event_hour` - 异常事件高发时段（如 03:00-04:00，REM 期密集）\n- `sleep_continuity_score` - 睡眠连续性评分（0-100，越高越连续）\n\n## 阈值与等级\n\n- `0-1 次/夜` - normal（正常）\n- `2-3 次/夜` - mild（轻度）\n- `4-7 次/夜` - notable（较频繁）→ 建议记录跟踪\n- `≥ 8 次/夜` 或 `单晚出现 ≥ 1 次 arm_thrashing + scream` 组合 - frequent（频繁）→ 建议尽快就诊神经内科 / 睡眠门诊\n- 单次喷嚏 / 咳嗽 / 翻身等正常生理活动不应计入异常事件\n\n## 输出字段（参考）\n\n- `sleep_window` / `bed_occupied_minutes`\n- `visual_events` / `audio_events`\n- `event_timeline` - 异常事件时间线（每条含 start_ts / end_ts / type / duration_sec / evidence_snippet_url，原始视频不留存）\n- `total_abnormal_event_count` / `event_density_per_hour` / `peak_event_hour`\n- `sleep_continuity_score`\n- `abnormal_pattern` - 行为模式（pure_nightmare / suspect_rbd / general_arousal / mixed / none）\n- `risk_signal_level` - 风险信号等级（none / mild / notable / strong）\n- `alert_type` - 提醒类型（sleep_abnormal_notable / sleep_abnormal_frequent / suspect_rbd_pattern / improving / normal）\n- `alert_level` - 提醒级别（info / notice / warning）\n- `family_summary` - 家属友好摘要（如\"昨晚老人在 03:12 突然坐起并伴随短促叫声 1 次，03:38 出现挥舞手臂约 8 秒；夜间共 3 次异常事件，建议白天观察精神状态，若反复出现建议就诊神经内科睡眠门诊\"）\n- `recommend_action` - 建议动作（push_family_summary / suggest_record_diary / suggest_consult_sleep_clinic / suggest_neurology_consult / observe_only）\n- `clinical_reference` - 当 frequent 或 suspect_rbd_pattern 时附**神经内科 / 睡眠门诊就诊建议** + 中国睡眠研究会等参考资源\n\n## 强制约束与红线\n\n- ❌ **禁止**输出 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停综合征等任何医学诊断结论\n- ❌ **禁止**根据本工具结果调整药物\n- ❌ **禁止**长期存储夜间原始视频；建议仅保存事件片段证据（短片，≤ 30 秒）+ 指标统计\n- ✅ 出现 frequent 或 suspect_rbd_pattern 时附**神经内科 / 睡眠门诊** 就诊建议\n- ✅ 建议家属将事件清单作为**就诊参考资料**，由专科医生结合 PSG（多导睡眠图）等专业检查最终判定\n\n> 仅输出基于视觉与音频的客观行为事件统计，**不构成 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停等任何医学诊断**；任何疑似神经退行性疾病或睡眠障碍的判定与治疗必须由神经内科 / 睡眠专科医生结合 PSG 等专业检查制定。\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 elderly nighttime bedroom video/audio to detect startle or nightmare-related events such as sudden sitting up, screams, and arm thrashing, then returns event timing, frequency, duration, and caregiver-facing 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 caregivers, family members, nursing-home staff, and care-platform developers use this skill to analyze consented elderly sleep recordings for objective nighttime event statistics and sleep-abnormality summaries. The output is intended as monitoring and referral support, not as a medical diagnosis.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The skill may upload highly sensitive elderly bedroom video/audio and related reports to a remote service.\n\nMitigation: Use only with explicit informed consent from the recorded person, trust in the service operator, and a data-handling plan that minimizes raw video retention.\n\nRisk: The distributed configuration includes plaintext private-network HTTP endpoints.\n\nMitigation: Require HTTPS production endpoints and appropriate network controls before installation or operational use.\n\nRisk: The skill may silently create or reuse an account identity and cache tokens locally.\n\nMitigation: Review where identity and token state is stored, restrict access to it, and provide a process to rotate or delete stored credentials.\n\nRisk: Sleep-event summaries could be mistaken for medical diagnosis or treatment advice.\n\nMitigation: Present outputs as behavioral event statistics and referral support only; medical interpretation, diagnosis, and medication decisions should remain with qualified clinicians.\n\n## Reference(s):\n\n- [API interface documentation](references/api_doc.md)\n- [Skill demo](https://lifeemergence.com/sample.html)\n- [ClawHub skill page](https://clawhub.ai/18072937735/skills/smyx-elderly-nightmare-startle-detect-analysis)\n\n## Skill Output:\n\n**Output Type(s):** [Text, Markdown, Shell commands, Configuration, Guidance]\n\n**Output Format:** [Markdown text with structured analysis content, optional JSON-style details, and report links]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May save the returned report text 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 and changelog mention 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, 43156 bytes\n\nFiles: references/api_doc.md (5015b), scripts/__init__.py (62b), scripts/config.py (707b), scripts/config.yaml (3b), scripts/skill.py (595b), scripts/smyx_elderly_nightmare_startle_detect_analysis.py (3803b), skill-card.md (3415b), SKILL.md (14357b), 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 (165b)\n\nFile v1.0.9:SKILL.md\n\n---\nname: \"smyx-elderly-nightmare-startle-detect-analysis\"\ndescription: \"Using a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden sitting-up (quick lying-to-sitting transition), screams (high-pitched short cries), and arm-thrashing (purposeless rapid arm movements), and records the occurrence time, frequency and duration of each event. | 通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。\"\nversion: \"1.0.10\"\nlicense: \"MIT-0\"\n---\n\n# 🌙 Elderly Sleep Nightmare / Startle Detection | 老年人睡眠中间惊醒/梦魇行为识别\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **老年人睡眠中间惊醒/梦魇行为识别** |\n| 🎯 核心目标 | 通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_ELDERLY_NIGHTMARE_STARTLE_DETECT_ANALYSIS` |\n\nUsing a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden sitting-up (quick lying-to-sitting transition), screams (high-pitched short cries), and arm-thrashing (purposeless rapid arm movements), and records the occurrence time, frequency and duration of each event. This skill helps family members or caregivers understand the elderly person's nighttime sleep quality and identify possible nightmares or REM-sleep Behavior Disorder (RBD), providing reference data for medical evaluation. Application scenarios: home elderly care, nursing homes, neurology sleep monitoring. The system relays monitoring through the night and generates a sleep-abnormality event report. Skill features: frequent nighttime awakenings or nightmares in the elderly may be early manifestations of neurological diseases such as RBD. AI auto-recording of abnormal events provides objective data for physicians, supporting early diagnosis of Parkinson's disease and other neurodegenerative conditions. Can be integrated into smart-home cameras or elderly-care monitoring platforms as an important health-warning tool.\n\n通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。应用场景：居家养老、养老院、神经内科睡眠监测。系统夜间接力监测，生成睡眠异常事件报告。技能特点：老年人夜间频繁惊醒、梦魇可能是快速眼动期睡眠行为障碍（RBD）等神经系统疾病的早期表现。通过AI自动记录异常行为，可为医生提供客观数据，帮助早期诊断帕金森病等神经退行性疾病。该技能可集成到智能家居摄像头或养老监护平台中，成为健康预警的重要工具。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的老年人睡眠行为监测 AI。你的任务是分析卧室固定摄像头的夜间视频（含音频），检测老年人睡眠中的异常行为，包括突然坐起、惊叫声音、无目的挥舞手臂、踢腿等。记录每次事件的起止时间、持续时长，统计夜间总频次与高发时段。不要提供医疗诊断，仅输出基于视觉和音频的行为事件统计，并在频繁或疑似 RBD 模式时附神经内科/睡眠门诊就诊建议。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于卧室固定摄像头（红外夜视 + 麦克风）夜间睡眠音视频（建议 ≥ 6 小时），识别异常事件（突然坐起 / 无目的挥臂 / 踢腿 / 离床 / 惊叫 / 梦呓 / 异常粗重呼吸）→ 输出事件清单 + 时间线 + 频次密度 + 高发时段 + 睡眠连续性评分 → 推断行为模式（pure_nightmare / suspect_rbd / general_arousal / mixed / none）+ 风险信号等级 + 家属友好摘要 + 神经内科/睡眠门诊就诊建议\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 人体姿态识别（躺卧 → 坐立快速切换检测 |\n| 2 | < 2 秒） |\n| 3 | 无目的快速挥臂识别 |\n| 4 | 踢腿识别 |\n| 5 | 离床检测（参考） |\n| 6 | 音频惊叫识别（频谱 + 短时能量） |\n| 7 | 梦呓 / 异常粗重呼吸识别（参考） |\n| 8 | 事件时间线生成（含证据短片 ≤ 30 秒） |\n| 9 | 每小时事件密度统计 |\n| 10 | 高发时段定位（如 03:00-04:00 REM 期） |\n| 11 | 睡眠连续性评分 |\n| 12 | 行为模式分类 |\n| 13 | 4 档风险信号（none / mild / notable / strong） |\n| 14 | 家属友好摘要文本生成 |\n| 15 | 专科就诊建议生成 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供卧室固定摄像头（红外夜视、含麦克风）夜间睡眠音视频 URL 或文件需要分析时，默认触发本技能进行老年人睡眠中间惊醒/梦魇行为识别 |\n| 🔎 明确分析意图 | 当用户明确提及老人夜间惊醒、梦魇、说梦话、半夜坐起、半夜叫喊、挥臂踢腿、RBD、快速眼动行为障碍、帕金森早期、睡眠门诊等关键词，并且上传了音视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看睡眠异常历史报告、夜间惊醒/梦魇报告清单、老人睡眠事件清单、查询历史睡眠异常记录、显示所有夜间异常分析报告、显示睡眠监测报告，查询睡眠异常预警清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_elderly_nightmare_startle_detect_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 | 🔐 系统自动完成身份关联 | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行老年人睡眠中间惊醒/梦魇行为识别 | 调用 `-m scripts.smyx_elderly_nightmare_startle_detect_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_elderly_nightmare_startle_detect_analysis.py`](scripts/smyx_elderly_nightmare_startle_detect_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；**关键**：必须红外夜视 + 麦克风音轨；时长建议 ≥ 6 小时 |\n| 🔎 使用提醒 | 单次喷嚏、咳嗽、翻身、起夜如厕等正常生理活动不应计入异常事件 |\n| 🔎 使用提醒 | 双人共眠时需正确归属事件到老人，避免家属/伴侣的动作被误归 |\n| 🧑‍⚖️ 结果性质 | 红线约束：**禁止**输出 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停综合征等任何医学诊断；**禁止**根据本工具结果调整药物；**禁止**长期存储夜间原始视频 |\n| 🔎 使用提醒 | 数据保管：建议仅保存事件片段证据（≤ 30 秒）+ 指标统计，原始视频流不入库 |\n| 🔎 使用提醒 | 当出现 `frequent` 或 `suspect_rbd_pattern` 时，**必须**在摘要中附\"建议尽快就诊神经内科 / 睡眠门诊进行 PSG（多导睡眠图）检查\" |\n| 🔏 隐私合规 | 隐私合规：卧室夜间视频涉及高度敏感个人隐私，使用前需取得**老人本人**明确知情同意，妥善加密保管；建议优先采用人体轮廓 + 面部马赛克模式 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地夜间睡眠音视频\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input /path/to/night_sleep.mp4\n\n# 分析网络夜间睡眠音视频\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --url https://example.com/night_sleep.mp4\n\n# 显示历史老年人睡眠中间惊醒/梦魇报告（自动触发关键词：查看睡眠异常历史报告、夜间惊醒/梦魇报告清单等）\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input ns.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input ns.mp4 --output result.json\n```\n\nFile v1.0.9:_meta.json\n\n{\n  \"ownerId\": \"kn7e2caqj7pnsvr9r7t8zenghs83xw7n\",\n  \"slug\": \"smyx-elderly-nightmare-startle-detect-analysis\",\n  \"version\": \"1.0.9\",\n  \"publishedAt\": 1786946970947\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}` - 导出完整报告\n\n## 场景代码\n\n- `SMYX_ELDERLY_NIGHTMARE_STARTLE_DETECT_ANALYSIS` - 老年人睡眠中间惊醒/梦魇行为识别\n\n## 输入约束\n\n- 摄像头：卧室固定摄像头，**必须支持红外夜视**（IR），**必须含麦克风**（惊叫识别依赖音频）；能完整拍到老人在床的上半身\n- 帧率 ≥ 5 FPS（夜间统计无需高帧率）；分辨率 ≥ 480p；音频采样率 ≥ 16kHz\n- 视频时长：建议覆盖完整睡眠时段（22:00 → 次日 07:00 左右），**单次分析建议 ≥ 6 小时**\n- ROI 标定：床位 ROI（bed_region）\n- 多人共眠场景（如老两口）需按目标跟踪，避免事件归属错误\n- 隐私敏感场景必须启用人体轮廓 + 面部马赛克模式\n\n## 关键观测信号\n\n### 视觉\n- `sudden_sit_up_event_count` - 突然坐起事件次数（快速从躺卧→坐立，<2 秒完成）\n- `arm_thrashing_event_count` - 无目的快速挥舞手臂事件次数（疑似 RBD 表现）\n- `kick_leg_event_count` - 踢腿事件次数（参考指标）\n- `out_of_bed_event_count` - 离床事件次数（参考指标，与 wandering 技能配合）\n- `total_event_duration_sec` - 全部异常事件累计时长\n\n### 音频\n- `scream_event_count` - 高频短促叫声次数（基于频谱+短时能量）\n- `mumble_or_talking_in_sleep_count` - 梦呓/说梦话次数（参考指标）\n- `loud_breathing_event_count` - 异常粗重呼吸事件（参考指标，可能与睡眠呼吸暂停相关）\n\n### 综合\n- `sleep_window` - 监测时间窗（如 22:00-07:00）\n- `total_abnormal_event_count` - 异常事件总次数\n- `event_density_per_hour` - 每小时事件密度\n- `peak_event_hour` - 异常事件高发时段（如 03:00-04:00，REM 期密集）\n- `sleep_continuity_score` - 睡眠连续性评分（0-100，越高越连续）\n\n## 阈值与等级\n\n- `0-1 次/夜` - normal（正常）\n- `2-3 次/夜` - mild（轻度）\n- `4-7 次/夜` - notable（较频繁）→ 建议记录跟踪\n- `≥ 8 次/夜` 或 `单晚出现 ≥ 1 次 arm_thrashing + scream` 组合 - frequent（频繁）→ 建议尽快就诊神经内科 / 睡眠门诊\n- 单次喷嚏 / 咳嗽 / 翻身等正常生理活动不应计入异常事件\n\n## 输出字段（参考）\n\n- `sleep_window` / `bed_occupied_minutes`\n- `visual_events` / `audio_events`\n- `event_timeline` - 异常事件时间线（每条含 start_ts / end_ts / type / duration_sec / evidence_snippet_url，原始视频不留存）\n- `total_abnormal_event_count` / `event_density_per_hour` / `peak_event_hour`\n- `sleep_continuity_score`\n- `abnormal_pattern` - 行为模式（pure_nightmare / suspect_rbd / general_arousal / mixed / none）\n- `risk_signal_level` - 风险信号等级（none / mild / notable / strong）\n- `alert_type` - 提醒类型（sleep_abnormal_notable / sleep_abnormal_frequent / suspect_rbd_pattern / improving / normal）\n- `alert_level` - 提醒级别（info / notice / warning）\n- `family_summary` - 家属友好摘要（如\"昨晚老人在 03:12 突然坐起并伴随短促叫声 1 次，03:38 出现挥舞手臂约 8 秒；夜间共 3 次异常事件，建议白天观察精神状态，若反复出现建议就诊神经内科睡眠门诊\"）\n- `recommend_action` - 建议动作（push_family_summary / suggest_record_diary / suggest_consult_sleep_clinic / suggest_neurology_consult / observe_only）\n- `clinical_reference` - 当 frequent 或 suspect_rbd_pattern 时附**神经内科 / 睡眠门诊就诊建议** + 中国睡眠研究会等参考资源\n\n## 强制约束与红线\n\n- ❌ **禁止**输出 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停综合征等任何医学诊断结论\n- ❌ **禁止**根据本工具结果调整药物\n- ❌ **禁止**长期存储夜间原始视频；建议仅保存事件片段证据（短片，≤ 30 秒）+ 指标统计\n- ✅ 出现 frequent 或 suspect_rbd_pattern 时附**神经内科 / 睡眠门诊** 就诊建议\n- ✅ 建议家属将事件清单作为**就诊参考资料**，由专科医生结合 PSG（多导睡眠图）等专业检查最终判定\n\n> 仅输出基于视觉与音频的客观行为事件统计，**不构成 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停等任何医学诊断**；任何疑似神经退行性疾病或睡眠障碍的判定与治疗必须由神经内科 / 睡眠专科医生结合 PSG 等专业检查制定。\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 fixed bedroom camera sleep video with audio to identify sudden sitting-up, screams, arm-thrashing, and related nighttime events, producing event timing, frequency, duration, risk signals, and caregiver-facing 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\nFamily caregivers, elder-care providers, and developers of care-monitoring workflows use this skill to analyze consented nighttime bedroom audio/video for sleep-startle and nightmare-like behavior events. The skill prepares non-diagnostic reports that can support care review or a medical consultation.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The skill processes highly sensitive bedroom audio/video through cloud services.\n\nMitigation: Use only with the monitored person's explicit informed consent, confirm the cloud service is approved for the deployment, and prefer privacy-preserving modes such as body outlines and face masking when available.\n\nRisk: The release scanner reports silent account identity handling, local token storage, and account-linked report history.\n\nMitigation: Restrict access to the workspace data directory, review generated local identity records and stored service tokens before and after use, and rotate or remove credentials when the skill is no longer needed.\n\nRisk: The release scanner reports default private-network development API configuration.\n\nMitigation: Audit the bundled API configuration before installation and replace any private or development endpoints with the intended production service endpoints.\n\nRisk: Sleep-startle and nightmare-like behavior analysis could be mistaken for a medical diagnosis.\n\nMitigation: Present outputs as behavioral observations only, avoid medication or diagnosis recommendations, and direct frequent or suspicious patterns to qualified neurology or sleep-clinic review.\n\nRisk: Long-term retention of raw nighttime video would increase privacy exposure.\n\nMitigation: Avoid retaining raw overnight footage; keep only the minimum event snippets and metrics needed for review, with encryption and access controls.\n\n## Reference(s):\n\n- [ClawHub skill release page](https://clawhub.ai/18072937735/skills/smyx-elderly-nightmare-startle-detect-analysis)\n- [Publisher profile](https://clawhub.ai/user/18072937735)\n- [API interface documentation](references/api_doc.md)\n- [Shared analysis API documentation](skills/smyx_analysis/references/api_doc.md)\n- [Skill demo](https://lifeemergence.com/sample.html)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, JSON, files, guidance]\n\n**Output Format:** [Markdown or JSON-formatted structured report text with report URLs; optional saved output file.]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May include cloud report export links, historical report listings, event timelines, frequency summaries, and non-diagnostic care guidance.]\n\n## Skill Version(s):\n\n1.0.9 (source: server release evidence; 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.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, 42940 bytes\n\nFiles: references/api_doc.md (5015b), scripts/__init__.py (62b), scripts/config.py (707b), scripts/config.yaml (3b), scripts/skill.py (595b), scripts/smyx_elderly_nightmare_startle_detect_analysis.py (3803b), skill-card.md (2784b), SKILL.md (14356b), 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 (165b)\n\nFile v1.0.8:SKILL.md\n\n---\nname: \"smyx-elderly-nightmare-startle-detect-analysis\"\ndescription: \"Using a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden sitting-up (quick lying-to-sitting transition), screams (high-pitched short cries), and arm-thrashing (purposeless rapid arm movements), and records the occurrence time, frequency and duration of each event. | 通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。\"\nversion: \"1.0.9\"\nlicense: \"MIT-0\"\n---\n\n# 🌙 Elderly Sleep Nightmare / Startle Detection | 老年人睡眠中间惊醒/梦魇行为识别\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **老年人睡眠中间惊醒/梦魇行为识别** |\n| 🎯 核心目标 | 通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_ELDERLY_NIGHTMARE_STARTLE_DETECT_ANALYSIS` |\n\nUsing a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden sitting-up (quick lying-to-sitting transition), screams (high-pitched short cries), and arm-thrashing (purposeless rapid arm movements), and records the occurrence time, frequency and duration of each event. This skill helps family members or caregivers understand the elderly person's nighttime sleep quality and identify possible nightmares or REM-sleep Behavior Disorder (RBD), providing reference data for medical evaluation. Application scenarios: home elderly care, nursing homes, neurology sleep monitoring. The system relays monitoring through the night and generates a sleep-abnormality event report. Skill features: frequent nighttime awakenings or nightmares in the elderly may be early manifestations of neurological diseases such as RBD. AI auto-recording of abnormal events provides objective data for physicians, supporting early diagnosis of Parkinson's disease and other neurodegenerative conditions. Can be integrated into smart-home cameras or elderly-care monitoring platforms as an important health-warning tool.\n\n通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。应用场景：居家养老、养老院、神经内科睡眠监测。系统夜间接力监测，生成睡眠异常事件报告。技能特点：老年人夜间频繁惊醒、梦魇可能是快速眼动期睡眠行为障碍（RBD）等神经系统疾病的早期表现。通过AI自动记录异常行为，可为医生提供客观数据，帮助早期诊断帕金森病等神经退行性疾病。该技能可集成到智能家居摄像头或养老监护平台中，成为健康预警的重要工具。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的老年人睡眠行为监测 AI。你的任务是分析卧室固定摄像头的夜间视频（含音频），检测老年人睡眠中的异常行为，包括突然坐起、惊叫声音、无目的挥舞手臂、踢腿等。记录每次事件的起止时间、持续时长，统计夜间总频次与高发时段。不要提供医疗诊断，仅输出基于视觉和音频的行为事件统计，并在频繁或疑似 RBD 模式时附神经内科/睡眠门诊就诊建议。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于卧室固定摄像头（红外夜视 + 麦克风）夜间睡眠音视频（建议 ≥ 6 小时），识别异常事件（突然坐起 / 无目的挥臂 / 踢腿 / 离床 / 惊叫 / 梦呓 / 异常粗重呼吸）→ 输出事件清单 + 时间线 + 频次密度 + 高发时段 + 睡眠连续性评分 → 推断行为模式（pure_nightmare / suspect_rbd / general_arousal / mixed / none）+ 风险信号等级 + 家属友好摘要 + 神经内科/睡眠门诊就诊建议\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 人体姿态识别（躺卧 → 坐立快速切换检测 |\n| 2 | < 2 秒） |\n| 3 | 无目的快速挥臂识别 |\n| 4 | 踢腿识别 |\n| 5 | 离床检测（参考） |\n| 6 | 音频惊叫识别（频谱 + 短时能量） |\n| 7 | 梦呓 / 异常粗重呼吸识别（参考） |\n| 8 | 事件时间线生成（含证据短片 ≤ 30 秒） |\n| 9 | 每小时事件密度统计 |\n| 10 | 高发时段定位（如 03:00-04:00 REM 期） |\n| 11 | 睡眠连续性评分 |\n| 12 | 行为模式分类 |\n| 13 | 4 档风险信号（none / mild / notable / strong） |\n| 14 | 家属友好摘要文本生成 |\n| 15 | 专科就诊建议生成 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供卧室固定摄像头（红外夜视、含麦克风）夜间睡眠音视频 URL 或文件需要分析时，默认触发本技能进行老年人睡眠中间惊醒/梦魇行为识别 |\n| 🔎 明确分析意图 | 当用户明确提及老人夜间惊醒、梦魇、说梦话、半夜坐起、半夜叫喊、挥臂踢腿、RBD、快速眼动行为障碍、帕金森早期、睡眠门诊等关键词，并且上传了音视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看睡眠异常历史报告、夜间惊醒/梦魇报告清单、老人睡眠事件清单、查询历史睡眠异常记录、显示所有夜间异常分析报告、显示睡眠监测报告，查询睡眠异常预警清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_elderly_nightmare_startle_detect_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 | 🔐 系统自动完成身份关联 | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行老年人睡眠中间惊醒/梦魇行为识别 | 调用 `-m scripts.smyx_elderly_nightmare_startle_detect_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_elderly_nightmare_startle_detect_analysis.py`](scripts/smyx_elderly_nightmare_startle_detect_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；**关键**：必须红外夜视 + 麦克风音轨；时长建议 ≥ 6 小时 |\n| 🔎 使用提醒 | 单次喷嚏、咳嗽、翻身、起夜如厕等正常生理活动不应计入异常事件 |\n| 🔎 使用提醒 | 双人共眠时需正确归属事件到老人，避免家属/伴侣的动作被误归 |\n| 🧑‍⚖️ 结果性质 | 红线约束：**禁止**输出 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停综合征等任何医学诊断；**禁止**根据本工具结果调整药物；**禁止**长期存储夜间原始视频 |\n| 🔎 使用提醒 | 数据保管：建议仅保存事件片段证据（≤ 30 秒）+ 指标统计，原始视频流不入库 |\n| 🔎 使用提醒 | 当出现 `frequent` 或 `suspect_rbd_pattern` 时，**必须**在摘要中附\"建议尽快就诊神经内科 / 睡眠门诊进行 PSG（多导睡眠图）检查\" |\n| 🔏 隐私合规 | 隐私合规：卧室夜间视频涉及高度敏感个人隐私，使用前需取得**老人本人**明确知情同意，妥善加密保管；建议优先采用人体轮廓 + 面部马赛克模式 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地夜间睡眠音视频\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input /path/to/night_sleep.mp4\n\n# 分析网络夜间睡眠音视频\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --url https://example.com/night_sleep.mp4\n\n# 显示历史老年人睡眠中间惊醒/梦魇报告（自动触发关键词：查看睡眠异常历史报告、夜间惊醒/梦魇报告清单等）\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input ns.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input ns.mp4 --output result.json\n```\n\nFile v1.0.8:_meta.json\n\n{\n  \"ownerId\": \"kn7e2caqj7pnsvr9r7t8zenghs83xw7n\",\n  \"slug\": \"smyx-elderly-nightmare-startle-detect-analysis\",\n  \"version\": \"1.0.8\",\n  \"publishedAt\": 1786302751137\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}` - 导出完整报告\n\n## 场景代码\n\n- `SMYX_ELDERLY_NIGHTMARE_STARTLE_DETECT_ANALYSIS` - 老年人睡眠中间惊醒/梦魇行为识别\n\n## 输入约束\n\n- 摄像头：卧室固定摄像头，**必须支持红外夜视**（IR），**必须含麦克风**（惊叫识别依赖音频）；能完整拍到老人在床的上半身\n- 帧率 ≥ 5 FPS（夜间统计无需高帧率）；分辨率 ≥ 480p；音频采样率 ≥ 16kHz\n- 视频时长：建议覆盖完整睡眠时段（22:00 → 次日 07:00 左右），**单次分析建议 ≥ 6 小时**\n- ROI 标定：床位 ROI（bed_region）\n- 多人共眠场景（如老两口）需按目标跟踪，避免事件归属错误\n- 隐私敏感场景必须启用人体轮廓 + 面部马赛克模式\n\n## 关键观测信号\n\n### 视觉\n- `sudden_sit_up_event_count` - 突然坐起事件次数（快速从躺卧→坐立，<2 秒完成）\n- `arm_thrashing_event_count` - 无目的快速挥舞手臂事件次数（疑似 RBD 表现）\n- `kick_leg_event_count` - 踢腿事件次数（参考指标）\n- `out_of_bed_event_count` - 离床事件次数（参考指标，与 wandering 技能配合）\n- `total_event_duration_sec` - 全部异常事件累计时长\n\n### 音频\n- `scream_event_count` - 高频短促叫声次数（基于频谱+短时能量）\n- `mumble_or_talking_in_sleep_count` - 梦呓/说梦话次数（参考指标）\n- `loud_breathing_event_count` - 异常粗重呼吸事件（参考指标，可能与睡眠呼吸暂停相关）\n\n### 综合\n- `sleep_window` - 监测时间窗（如 22:00-07:00）\n- `total_abnormal_event_count` - 异常事件总次数\n- `event_density_per_hour` - 每小时事件密度\n- `peak_event_hour` - 异常事件高发时段（如 03:00-04:00，REM 期密集）\n- `sleep_continuity_score` - 睡眠连续性评分（0-100，越高越连续）\n\n## 阈值与等级\n\n- `0-1 次/夜` - normal（正常）\n- `2-3 次/夜` - mild（轻度）\n- `4-7 次/夜` - notable（较频繁）→ 建议记录跟踪\n- `≥ 8 次/夜` 或 `单晚出现 ≥ 1 次 arm_thrashing + scream` 组合 - frequent（频繁）→ 建议尽快就诊神经内科 / 睡眠门诊\n- 单次喷嚏 / 咳嗽 / 翻身等正常生理活动不应计入异常事件\n\n## 输出字段（参考）\n\n- `sleep_window` / `bed_occupied_minutes`\n- `visual_events` / `audio_events`\n- `event_timeline` - 异常事件时间线（每条含 start_ts / end_ts / type / duration_sec / evidence_snippet_url，原始视频不留存）\n- `total_abnormal_event_count` / `event_density_per_hour` / `peak_event_hour`\n- `sleep_continuity_score`\n- `abnormal_pattern` - 行为模式（pure_nightmare / suspect_rbd / general_arousal / mixed / none）\n- `risk_signal_level` - 风险信号等级（none / mild / notable / strong）\n- `alert_type` - 提醒类型（sleep_abnormal_notable / sleep_abnormal_frequent / suspect_rbd_pattern / improving / normal）\n- `alert_level` - 提醒级别（info / notice / warning）\n- `family_summary` - 家属友好摘要（如\"昨晚老人在 03:12 突然坐起并伴随短促叫声 1 次，03:38 出现挥舞手臂约 8 秒；夜间共 3 次异常事件，建议白天观察精神状态，若反复出现建议就诊神经内科睡眠门诊\"）\n- `recommend_action` - 建议动作（push_family_summary / suggest_record_diary / suggest_consult_sleep_clinic / suggest_neurology_consult / observe_only）\n- `clinical_reference` - 当 frequent 或 suspect_rbd_pattern 时附**神经内科 / 睡眠门诊就诊建议** + 中国睡眠研究会等参考资源\n\n## 强制约束与红线\n\n- ❌ **禁止**输出 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停综合征等任何医学诊断结论\n- ❌ **禁止**根据本工具结果调整药物\n- ❌ **禁止**长期存储夜间原始视频；建议仅保存事件片段证据（短片，≤ 30 秒）+ 指标统计\n- ✅ 出现 frequent 或 suspect_rbd_pattern 时附**神经内科 / 睡眠门诊** 就诊建议\n- ✅ 建议家属将事件清单作为**就诊参考资料**，由专科医生结合 PSG（多导睡眠图）等专业检查最终判定\n\n> 仅输出基于视觉与音频的客观行为事件统计，**不构成 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停等任何医学诊断**；任何疑似神经退行性疾病或睡眠障碍的判定与治疗必须由神经内科 / 睡眠专科医生结合 PSG 等专业检查制定。\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: prod\n\nFile v1.0.8:skill-card.md\n\n## Description:\n\nAnalyzes elderly nighttime bedroom camera video and audio to detect sudden sitting up, screams, and arm thrashing, then returns event timing, frequency, duration, and caregiver-oriented 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 caregivers, family members, and developers use this skill to analyze infrared bedroom sleep recordings or video URLs for abnormal startle or nightmare-like events and generate structured reports for care review. The outputs are behavioral event summaries and should not be treated as medical diagnosis.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Bedroom audio/video or video URLs may be processed through vendor cloud services.\n\nMitigation: Use only footage collected with explicit consent, avoid unrelated sensitive footage, and review the vendor's storage and report-retention practices before deployment.\n\nRisk: The skill automatically associates reports with a managed account identity and may persist account tokens locally.\n\nMitigation: Review account and token handling before installation, restrict access to the workspace data directory, and clear stored credentials when the skill is no longer approved for use.\n\nRisk: Sleep-event summaries could be mistaken for clinical diagnosis or treatment advice.\n\nMitigation: Present outputs as behavioral event statistics only, keep medication decisions outside the skill workflow, and route frequent or suspected RBD patterns to a qualified sleep or neurology clinician for PSG-based evaluation.\n\n## Reference(s):\n\n- [ClawHub Skill Page](https://clawhub.ai/18072937735/skills/smyx-elderly-nightmare-startle-detect-analysis)\n- [Skill Demo](https://lifeemergence.com/sample.html)\n- [Elderly Nightmare Startle API Documentation](references/api_doc.md)\n- [Common Analysis API Documentation](skills/smyx_analysis/references/api_doc.md)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, shell commands, configuration, guidance]\n\n**Output Format:** [Markdown text with JSON report content, event summaries, and optional report export links]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May include structured sleep-event fields, history-query results, and links to generated reports.]\n\n## Skill Version(s):\n\n1.0.8 (source: server release metadata; artifact frontmatter and release changelog mention 1.0.9)\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, 42909 bytes\n\nFiles: references/api_doc.md (5015b), scripts/__init__.py (62b), scripts/config.py (707b), scripts/config.yaml (3b), scripts/skill.py (595b), scripts/smyx_elderly_nightmare_startle_detect_analysis.py (3803b), skill-card.md (2801b), SKILL.md (14356b), 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 (165b)\n\nFile v1.0.7:SKILL.md\n\n---\nname: \"smyx-elderly-nightmare-startle-detect-analysis\"\ndescription: \"Using a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden sitting-up (quick lying-to-sitting transition), screams (high-pitched short cries), and arm-thrashing (purposeless rapid arm movements), and records the occurrence time, frequency and duration of each event. | 通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。\"\nversion: \"1.0.8\"\nlicense: \"MIT-0\"\n---\n\n# 🌙 Elderly Sleep Nightmare / Startle Detection | 老年人睡眠中间惊醒/梦魇行为识别\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **老年人睡眠中间惊醒/梦魇行为识别** |\n| 🎯 核心目标 | 通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_ELDERLY_NIGHTMARE_STARTLE_DETECT_ANALYSIS` |\n\nUsing a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden sitting-up (quick lying-to-sitting transition), screams (high-pitched short cries), and arm-thrashing (purposeless rapid arm movements), and records the occurrence time, frequency and duration of each event. This skill helps family members or caregivers understand the elderly person's nighttime sleep quality and identify possible nightmares or REM-sleep Behavior Disorder (RBD), providing reference data for medical evaluation. Application scenarios: home elderly care, nursing homes, neurology sleep monitoring. The system relays monitoring through the night and generates a sleep-abnormality event report. Skill features: frequent nighttime awakenings or nightmares in the elderly may be early manifestations of neurological diseases such as RBD. AI auto-recording of abnormal events provides objective data for physicians, supporting early diagnosis of Parkinson's disease and other neurodegenerative conditions. Can be integrated into smart-home cameras or elderly-care monitoring platforms as an important health-warning tool.\n\n通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。应用场景：居家养老、养老院、神经内科睡眠监测。系统夜间接力监测，生成睡眠异常事件报告。技能特点：老年人夜间频繁惊醒、梦魇可能是快速眼动期睡眠行为障碍（RBD）等神经系统疾病的早期表现。通过AI自动记录异常行为，可为医生提供客观数据，帮助早期诊断帕金森病等神经退行性疾病。该技能可集成到智能家居摄像头或养老监护平台中，成为健康预警的重要工具。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的老年人睡眠行为监测 AI。你的任务是分析卧室固定摄像头的夜间视频（含音频），检测老年人睡眠中的异常行为，包括突然坐起、惊叫声音、无目的挥舞手臂、踢腿等。记录每次事件的起止时间、持续时长，统计夜间总频次与高发时段。不要提供医疗诊断，仅输出基于视觉和音频的行为事件统计，并在频繁或疑似 RBD 模式时附神经内科/睡眠门诊就诊建议。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于卧室固定摄像头（红外夜视 + 麦克风）夜间睡眠音视频（建议 ≥ 6 小时），识别异常事件（突然坐起 / 无目的挥臂 / 踢腿 / 离床 / 惊叫 / 梦呓 / 异常粗重呼吸）→ 输出事件清单 + 时间线 + 频次密度 + 高发时段 + 睡眠连续性评分 → 推断行为模式（pure_nightmare / suspect_rbd / general_arousal / mixed / none）+ 风险信号等级 + 家属友好摘要 + 神经内科/睡眠门诊就诊建议\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 人体姿态识别（躺卧 → 坐立快速切换检测 |\n| 2 | < 2 秒） |\n| 3 | 无目的快速挥臂识别 |\n| 4 | 踢腿识别 |\n| 5 | 离床检测（参考） |\n| 6 | 音频惊叫识别（频谱 + 短时能量） |\n| 7 | 梦呓 / 异常粗重呼吸识别（参考） |\n| 8 | 事件时间线生成（含证据短片 ≤ 30 秒） |\n| 9 | 每小时事件密度统计 |\n| 10 | 高发时段定位（如 03:00-04:00 REM 期） |\n| 11 | 睡眠连续性评分 |\n| 12 | 行为模式分类 |\n| 13 | 4 档风险信号（none / mild / notable / strong） |\n| 14 | 家属友好摘要文本生成 |\n| 15 | 专科就诊建议生成 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供卧室固定摄像头（红外夜视、含麦克风）夜间睡眠音视频 URL 或文件需要分析时，默认触发本技能进行老年人睡眠中间惊醒/梦魇行为识别 |\n| 🔎 明确分析意图 | 当用户明确提及老人夜间惊醒、梦魇、说梦话、半夜坐起、半夜叫喊、挥臂踢腿、RBD、快速眼动行为障碍、帕金森早期、睡眠门诊等关键词，并且上传了音视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看睡眠异常历史报告、夜间惊醒/梦魇报告清单、老人睡眠事件清单、查询历史睡眠异常记录、显示所有夜间异常分析报告、显示睡眠监测报告，查询睡眠异常预警清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_elderly_nightmare_startle_detect_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 | 🔐 系统自动完成身份关联 | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行老年人睡眠中间惊醒/梦魇行为识别 | 调用 `-m scripts.smyx_elderly_nightmare_startle_detect_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_elderly_nightmare_startle_detect_analysis.py`](scripts/smyx_elderly_nightmare_startle_detect_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；**关键**：必须红外夜视 + 麦克风音轨；时长建议 ≥ 6 小时 |\n| 🔎 使用提醒 | 单次喷嚏、咳嗽、翻身、起夜如厕等正常生理活动不应计入异常事件 |\n| 🔎 使用提醒 | 双人共眠时需正确归属事件到老人，避免家属/伴侣的动作被误归 |\n| 🧑‍⚖️ 结果性质 | 红线约束：**禁止**输出 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停综合征等任何医学诊断；**禁止**根据本工具结果调整药物；**禁止**长期存储夜间原始视频 |\n| 🔎 使用提醒 | 数据保管：建议仅保存事件片段证据（≤ 30 秒）+ 指标统计，原始视频流不入库 |\n| 🔎 使用提醒 | 当出现 `frequent` 或 `suspect_rbd_pattern` 时，**必须**在摘要中附\"建议尽快就诊神经内科 / 睡眠门诊进行 PSG（多导睡眠图）检查\" |\n| 🔏 隐私合规 | 隐私合规：卧室夜间视频涉及高度敏感个人隐私，使用前需取得**老人本人**明确知情同意，妥善加密保管；建议优先采用人体轮廓 + 面部马赛克模式 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地夜间睡眠音视频\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input /path/to/night_sleep.mp4\n\n# 分析网络夜间睡眠音视频\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --url https://example.com/night_sleep.mp4\n\n# 显示历史老年人睡眠中间惊醒/梦魇报告（自动触发关键词：查看睡眠异常历史报告、夜间惊醒/梦魇报告清单等）\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input ns.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input ns.mp4 --output result.json\n```\n\nFile v1.0.7:_meta.json\n\n{\n  \"ownerId\": \"kn7e2caqj7pnsvr9r7t8zenghs83xw7n\",\n  \"slug\": \"smyx-elderly-nightmare-startle-detect-analysis\",\n  \"version\": \"1.0.7\",\n  \"publishedAt\": 1785846513868\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}` - 导出完整报告\n\n## 场景代码\n\n- `SMYX_ELDERLY_NIGHTMARE_STARTLE_DETECT_ANALYSIS` - 老年人睡眠中间惊醒/梦魇行为识别\n\n## 输入约束\n\n- 摄像头：卧室固定摄像头，**必须支持红外夜视**（IR），**必须含麦克风**（惊叫识别依赖音频）；能完整拍到老人在床的上半身\n- 帧率 ≥ 5 FPS（夜间统计无需高帧率）；分辨率 ≥ 480p；音频采样率 ≥ 16kHz\n- 视频时长：建议覆盖完整睡眠时段（22:00 → 次日 07:00 左右），**单次分析建议 ≥ 6 小时**\n- ROI 标定：床位 ROI（bed_region）\n- 多人共眠场景（如老两口）需按目标跟踪，避免事件归属错误\n- 隐私敏感场景必须启用人体轮廓 + 面部马赛克模式\n\n## 关键观测信号\n\n### 视觉\n- `sudden_sit_up_event_count` - 突然坐起事件次数（快速从躺卧→坐立，<2 秒完成）\n- `arm_thrashing_event_count` - 无目的快速挥舞手臂事件次数（疑似 RBD 表现）\n- `kick_leg_event_count` - 踢腿事件次数（参考指标）\n- `out_of_bed_event_count` - 离床事件次数（参考指标，与 wandering 技能配合）\n- `total_event_duration_sec` - 全部异常事件累计时长\n\n### 音频\n- `scream_event_count` - 高频短促叫声次数（基于频谱+短时能量）\n- `mumble_or_talking_in_sleep_count` - 梦呓/说梦话次数（参考指标）\n- `loud_breathing_event_count` - 异常粗重呼吸事件（参考指标，可能与睡眠呼吸暂停相关）\n\n### 综合\n- `sleep_window` - 监测时间窗（如 22:00-07:00）\n- `total_abnormal_event_count` - 异常事件总次数\n- `event_density_per_hour` - 每小时事件密度\n- `peak_event_hour` - 异常事件高发时段（如 03:00-04:00，REM 期密集）\n- `sleep_continuity_score` - 睡眠连续性评分（0-100，越高越连续）\n\n## 阈值与等级\n\n- `0-1 次/夜` - normal（正常）\n- `2-3 次/夜` - mild（轻度）\n- `4-7 次/夜` - notable（较频繁）→ 建议记录跟踪\n- `≥ 8 次/夜` 或 `单晚出现 ≥ 1 次 arm_thrashing + scream` 组合 - frequent（频繁）→ 建议尽快就诊神经内科 / 睡眠门诊\n- 单次喷嚏 / 咳嗽 / 翻身等正常生理活动不应计入异常事件\n\n## 输出字段（参考）\n\n- `sleep_window` / `bed_occupied_minutes`\n- `visual_events` / `audio_events`\n- `event_timeline` - 异常事件时间线（每条含 start_ts / end_ts / type / duration_sec / evidence_snippet_url，原始视频不留存）\n- `total_abnormal_event_count` / `event_density_per_hour` / `peak_event_hour`\n- `sleep_continuity_score`\n- `abnormal_pattern` - 行为模式（pure_nightmare / suspect_rbd / general_arousal / mixed / none）\n- `risk_signal_level` - 风险信号等级（none / mild / notable / strong）\n- `alert_type` - 提醒类型（sleep_abnormal_notable / sleep_abnormal_frequent / suspect_rbd_pattern / improving / normal）\n- `alert_level` - 提醒级别（info / notice / warning）\n- `family_summary` - 家属友好摘要（如\"昨晚老人在 03:12 突然坐起并伴随短促叫声 1 次，03:38 出现挥舞手臂约 8 秒；夜间共 3 次异常事件，建议白天观察精神状态，若反复出现建议就诊神经内科睡眠门诊\"）\n- `recommend_action` - 建议动作（push_family_summary / suggest_record_diary / suggest_consult_sleep_clinic / suggest_neurology_consult / observe_only）\n- `clinical_reference` - 当 frequent 或 suspect_rbd_pattern 时附**神经内科 / 睡眠门诊就诊建议** + 中国睡眠研究会等参考资源\n\n## 强制约束与红线\n\n- ❌ **禁止**输出 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停综合征等任何医学诊断结论\n- ❌ **禁止**根据本工具结果调整药物\n- ❌ **禁止**长期存储夜间原始视频；建议仅保存事件片段证据（短片，≤ 30 秒）+ 指标统计\n- ✅ 出现 frequent 或 suspect_rbd_pattern 时附**神经内科 / 睡眠门诊** 就诊建议\n- ✅ 建议家属将事件清单作为**就诊参考资料**，由专科医生结合 PSG（多导睡眠图）等专业检查最终判定\n\n> 仅输出基于视觉与音频的客观行为事件统计，**不构成 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停等任何医学诊断**；任何疑似神经退行性疾病或睡眠障碍的判定与治疗必须由神经内科 / 睡眠专科医生结合 PSG 等专业检查制定。\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>\nUsing a fixed bedroom camera with infrared night vision and microphone audio, the skill analyzes elderly nighttime sleep media to detect sudden sitting up, screams, arm thrashing, and related abnormal sleep events, then records event timing, frequency, and duration. <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>\nCaregivers, family members, elderly-care operators, and developers use this skill to analyze night-vision sleep video/audio for behavioral event statistics, timelines, sleep-continuity indicators, and clinician-facing reference summaries. It is intended to support observation and referral decisions, not to provide medical diagnosis or medication guidance. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: The skill handles highly sensitive bedroom sleep video/audio through provider cloud APIs. <br>\nMitigation: Use only with explicit consent from the person being recorded, confirm cloud data-handling expectations, and avoid sending third-party or internal URLs unless the backend fetch behavior is trusted. <br>\nRisk: The skill may retrieve cloud report history and manage a local identity database with stored tokens. <br>\nMitigation: Review local storage, retention, and access controls before deployment, and limit use to environments where stored identity data is acceptable. <br>\nRisk: Sleep-event outputs may be mistaken for medical diagnosis. <br>\nMitigation: Present outputs as behavioral observations and referral support only, and keep diagnosis or medication decisions with qualified clinical professionals. <br>\n\n\n## Reference(s): <br>\n- [API Documentation](references/api_doc.md) <br>\n- [ClawHub Skill Page](https://clawhub.ai/18072937735/skills/smyx-elderly-nightmare-startle-detect-analysis) <br>\n- [Skill Demo](https://lifeemergence.com/sample.html) <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 event timeline, event counts, risk signal level, recommendations, and report links] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May write results to a file when an output path is supplied; history queries return cloud report listings.] <br>\n\n## Skill Version(s): <br>\n1.0.7 (source: server release metadata) <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, 42693 bytes\n\nFiles: references/api_doc.md (5015b), scripts/__init__.py (62b), scripts/config.py (707b), scripts/config.yaml (3b), scripts/skill.py (595b), scripts/smyx_elderly_nightmare_startle_detect_analysis.py (3803b), skill-card.md (2329b), SKILL.md (14356b), 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 (165b)\n\nFile v1.0.6:SKILL.md\n\n---\nname: \"smyx-elderly-nightmare-startle-detect-analysis\"\ndescription: \"Using a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden sitting-up (quick lying-to-sitting transition), screams (high-pitched short cries), and arm-thrashing (purposeless rapid arm movements), and records the occurrence time, frequency and duration of each event. | 通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。\"\nversion: \"1.0.8\"\nlicense: \"MIT-0\"\n---\n\n# 🌙 Elderly Sleep Nightmare / Startle Detection | 老年人睡眠中间惊醒/梦魇行为识别\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **老年人睡眠中间惊醒/梦魇行为识别** |\n| 🎯 核心目标 | 通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_ELDERLY_NIGHTMARE_STARTLE_DETECT_ANALYSIS` |\n\nUsing a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden sitting-up (quick lying-to-sitting transition), screams (high-pitched short cries), and arm-thrashing (purposeless rapid arm movements), and records the occurrence time, frequency and duration of each event. This skill helps family members or caregivers understand the elderly person's nighttime sleep quality and identify possible nightmares or REM-sleep Behavior Disorder (RBD), providing reference data for medical evaluation. Application scenarios: home elderly care, nursing homes, neurology sleep monitoring. The system relays monitoring through the night and generates a sleep-abnormality event report. Skill features: frequent nighttime awakenings or nightmares in the elderly may be early manifestations of neurological diseases such as RBD. AI auto-recording of abnormal events provides objective data for physicians, supporting early diagnosis of Parkinson's disease and other neurodegenerative conditions. Can be integrated into smart-home cameras or elderly-care monitoring platforms as an important health-warning tool.\n\n通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。应用场景：居家养老、养老院、神经内科睡眠监测。系统夜间接力监测，生成睡眠异常事件报告。技能特点：老年人夜间频繁惊醒、梦魇可能是快速眼动期睡眠行为障碍（RBD）等神经系统疾病的早期表现。通过AI自动记录异常行为，可为医生提供客观数据，帮助早期诊断帕金森病等神经退行性疾病。该技能可集成到智能家居摄像头或养老监护平台中，成为健康预警的重要工具。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的老年人睡眠行为监测 AI。你的任务是分析卧室固定摄像头的夜间视频（含音频），检测老年人睡眠中的异常行为，包括突然坐起、惊叫声音、无目的挥舞手臂、踢腿等。记录每次事件的起止时间、持续时长，统计夜间总频次与高发时段。不要提供医疗诊断，仅输出基于视觉和音频的行为事件统计，并在频繁或疑似 RBD 模式时附神经内科/睡眠门诊就诊建议。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于卧室固定摄像头（红外夜视 + 麦克风）夜间睡眠音视频（建议 ≥ 6 小时），识别异常事件（突然坐起 / 无目的挥臂 / 踢腿 / 离床 / 惊叫 / 梦呓 / 异常粗重呼吸）→ 输出事件清单 + 时间线 + 频次密度 + 高发时段 + 睡眠连续性评分 → 推断行为模式（pure_nightmare / suspect_rbd / general_arousal / mixed / none）+ 风险信号等级 + 家属友好摘要 + 神经内科/睡眠门诊就诊建议\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 人体姿态识别（躺卧 → 坐立快速切换检测 |\n| 2 | < 2 秒） |\n| 3 | 无目的快速挥臂识别 |\n| 4 | 踢腿识别 |\n| 5 | 离床检测（参考） |\n| 6 | 音频惊叫识别（频谱 + 短时能量） |\n| 7 | 梦呓 / 异常粗重呼吸识别（参考） |\n| 8 | 事件时间线生成（含证据短片 ≤ 30 秒） |\n| 9 | 每小时事件密度统计 |\n| 10 | 高发时段定位（如 03:00-04:00 REM 期） |\n| 11 | 睡眠连续性评分 |\n| 12 | 行为模式分类 |\n| 13 | 4 档风险信号（none / mild / notable / strong） |\n| 14 | 家属友好摘要文本生成 |\n| 15 | 专科就诊建议生成 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供卧室固定摄像头（红外夜视、含麦克风）夜间睡眠音视频 URL 或文件需要分析时，默认触发本技能进行老年人睡眠中间惊醒/梦魇行为识别 |\n| 🔎 明确分析意图 | 当用户明确提及老人夜间惊醒、梦魇、说梦话、半夜坐起、半夜叫喊、挥臂踢腿、RBD、快速眼动行为障碍、帕金森早期、睡眠门诊等关键词，并且上传了音视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看睡眠异常历史报告、夜间惊醒/梦魇报告清单、老人睡眠事件清单、查询历史睡眠异常记录、显示所有夜间异常分析报告、显示睡眠监测报告，查询睡眠异常预警清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_elderly_nightmare_startle_detect_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 | 🔐 系统自动完成身份关联 | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行老年人睡眠中间惊醒/梦魇行为识别 | 调用 `-m scripts.smyx_elderly_nightmare_startle_detect_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_elderly_nightmare_startle_detect_analysis.py`](scripts/smyx_elderly_nightmare_startle_detect_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；**关键**：必须红外夜视 + 麦克风音轨；时长建议 ≥ 6 小时 |\n| 🔎 使用提醒 | 单次喷嚏、咳嗽、翻身、起夜如厕等正常生理活动不应计入异常事件 |\n| 🔎 使用提醒 | 双人共眠时需正确归属事件到老人，避免家属/伴侣的动作被误归 |\n| 🧑‍⚖️ 结果性质 | 红线约束：**禁止**输出 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停综合征等任何医学诊断；**禁止**根据本工具结果调整药物；**禁止**长期存储夜间原始视频 |\n| 🔎 使用提醒 | 数据保管：建议仅保存事件片段证据（≤ 30 秒）+ 指标统计，原始视频流不入库 |\n| 🔎 使用提醒 | 当出现 `frequent` 或 `suspect_rbd_pattern` 时，**必须**在摘要中附\"建议尽快就诊神经内科 / 睡眠门诊进行 PSG（多导睡眠图）检查\" |\n| 🔏 隐私合规 | 隐私合规：卧室夜间视频涉及高度敏感个人隐私，使用前需取得**老人本人**明确知情同意，妥善加密保管；建议优先采用人体轮廓 + 面部马赛克模式 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地夜间睡眠音视频\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input /path/to/night_sleep.mp4\n\n# 分析网络夜间睡眠音视频\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --url https://example.com/night_sleep.mp4\n\n# 显示历史老年人睡眠中间惊醒/梦魇报告（自动触发关键词：查看睡眠异常历史报告、夜间惊醒/梦魇报告清单等）\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input ns.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input ns.mp4 --output result.json\n```\n\nFile v1.0.6:_meta.json\n\n{\n  \"ownerId\": \"kn7e2caqj7pnsvr9r7t8zenghs83xw7n\",\n  \"slug\": \"smyx-elderly-nightmare-startle-detect-analysis\",\n  \"version\": \"1.0.6\",\n  \"publishedAt\": 1785249628522\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}` - 导出完整报告\n\n## 场景代码\n\n- `SMYX_ELDERLY_NIGHTMARE_STARTLE_DETECT_ANALYSIS` - 老年人睡眠中间惊醒/梦魇行为识别\n\n## 输入约束\n\n- 摄像头：卧室固定摄像头，**必须支持红外夜视**（IR），**必须含麦克风**（惊叫识别依赖音频）；能完整拍到老人在床的上半身\n- 帧率 ≥ 5 FPS（夜间统计无需高帧率）；分辨率 ≥ 480p；音频采样率 ≥ 16kHz\n- 视频时长：建议覆盖完整睡眠时段（22:00 → 次日 07:00 左右），**单次分析建议 ≥ 6 小时**\n- ROI 标定：床位 ROI（bed_region）\n- 多人共眠场景（如老两口）需按目标跟踪，避免事件归属错误\n- 隐私敏感场景必须启用人体轮廓 + 面部马赛克模式\n\n## 关键观测信号\n\n### 视觉\n- `sudden_sit_up_event_count` - 突然坐起事件次数（快速从躺卧→坐立，<2 秒完成）\n- `arm_thrashing_event_count` - 无目的快速挥舞手臂事件次数（疑似 RBD 表现）\n- `kick_leg_event_count` - 踢腿事件次数（参考指标）\n- `out_of_bed_event_count` - 离床事件次数（参考指标，与 wandering 技能配合）\n- `total_event_duration_sec` - 全部异常事件累计时长\n\n### 音频\n- `scream_event_count` - 高频短促叫声次数（基于频谱+短时能量）\n- `mumble_or_talking_in_sleep_count` - 梦呓/说梦话次数（参考指标）\n- `loud_breathing_event_count` - 异常粗重呼吸事件（参考指标，可能与睡眠呼吸暂停相关）\n\n### 综合\n- `sleep_window` - 监测时间窗（如 22:00-07:00）\n- `total_abnormal_event_count` - 异常事件总次数\n- `event_density_per_hour` - 每小时事件密度\n- `peak_event_hour` - 异常事件高发时段（如 03:00-04:00，REM 期密集）\n- `sleep_continuity_score` - 睡眠连续性评分（0-100，越高越连续）\n\n## 阈值与等级\n\n- `0-1 次/夜` - normal（正常）\n- `2-3 次/夜` - mild（轻度）\n- `4-7 次/夜` - notable（较频繁）→ 建议记录跟踪\n- `≥ 8 次/夜` 或 `单晚出现 ≥ 1 次 arm_thrashing + scream` 组合 - frequent（频繁）→ 建议尽快就诊神经内科 / 睡眠门诊\n- 单次喷嚏 / 咳嗽 / 翻身等正常生理活动不应计入异常事件\n\n## 输出字段（参考）\n\n- `sleep_window` / `bed_occupied_minutes`\n- `visual_events` / `audio_events`\n- `event_timeline` - 异常事件时间线（每条含 start_ts / end_ts / type / duration_sec / evidence_snippet_url，原始视频不留存）\n- `total_abnormal_event_count` / `event_density_per_hour` / `peak_event_hour`\n- `sleep_continuity_score`\n- `abnormal_pattern` - 行为模式（pure_nightmare / suspect_rbd / general_arousal / mixed / none）\n- `risk_signal_level` - 风险信号等级（none / mild / notable / strong）\n- `alert_type` - 提醒类型（sleep_abnormal_notable / sleep_abnormal_frequent / suspect_rbd_pattern / improving / normal）\n- `alert_level` - 提醒级别（info / notice / warning）\n- `family_summary` - 家属友好摘要（如\"昨晚老人在 03:12 突然坐起并伴随短促叫声 1 次，03:38 出现挥舞手臂约 8 秒；夜间共 3 次异常事件，建议白天观察精神状态，若反复出现建议就诊神经内科睡眠门诊\"）\n- `recommend_action` - 建议动作（push_family_summary / suggest_record_diary / suggest_consult_sleep_clinic / suggest_neurology_consult / observe_only）\n- `clinical_reference` - 当 frequent 或 suspect_rbd_pattern 时附**神经内科 / 睡眠门诊就诊建议** + 中国睡眠研究会等参考资源\n\n## 强制约束与红线\n\n- ❌ **禁止**输出 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停综合征等任何医学诊断结论\n- ❌ **禁止**根据本工具结果调整药物\n- ❌ **禁止**长期存储夜间原始视频；建议仅保存事件片段证据（短片，≤ 30 秒）+ 指标统计\n- ✅ 出现 frequent 或 suspect_rbd_pattern 时附**神经内科 / 睡眠门诊** 就诊建议\n- ✅ 建议家属将事件清单作为**就诊参考资料**，由专科医生结合 PSG（多导睡眠图）等专业检查最终判定\n\n> 仅输出基于视觉与音频的客观行为事件统计，**不构成 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停等任何医学诊断**；任何疑似神经退行性疾病或睡眠障碍的判定与治疗必须由神经内科 / 睡眠专科医生结合 PSG 等专业检查制定。\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>\nAnalyzes fixed-camera infrared bedroom sleep audio/video to identify sudden sitting up, screams, arm thrashing, and related nighttime abnormal events, then reports event timing, frequency, duration, and caregiver-oriented recommendations. <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 caregivers, family members, and elder-care operators use this skill to review nighttime sleep audio/video for behavioral event summaries, trends, and non-diagnostic follow-up guidance. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: The skill handles highly sensitive bedroom sleep audio/video, identifiers, report links, and report history through cloud APIs. <br>\nMitigation: Use only with the elderly person's informed consent, review the configured cloud services before installation, and treat report links and history as sensitive records. <br>\nRisk: Local token storage and cloud retention implications may be unclear to deployers. <br>\nMitigation: Review local token handling and cloud retention practices before using private footage. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill release page](https://clawhub.ai/18072937735/skills/smyx-elderly-nightmare-startle-detect-analysis) <br>\n- [API documentation](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, shell commands, configuration, guidance] <br>\n**Output Format:** [Markdown and JSON analysis reports with event timelines, risk signals, recommendations, and report links] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May include cloud report links and historical report tables; does not provide medical diagnosis.] <br>\n\n## Skill Version(s): <br>\n1.0.6 (source: server release metadata; artifact frontmatter states 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, 42978 bytes\n\nFiles: references/api_doc.md (5015b), scripts/__init__.py (62b), scripts/config.py (707b), scripts/config.yaml (3b), scripts/skill.py (595b), scripts/smyx_elderly_nightmare_startle_detect_analysis.py (3803b), skill-card.md (2928b), SKILL.md (14356b), 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 (165b)\n\nFile v1.0.5:SKILL.md\n\n---\nname: \"smyx-elderly-nightmare-startle-detect-analysis\"\ndescription: \"Using a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden sitting-up (quick lying-to-sitting transition), screams (high-pitched short cries), and arm-thrashing (purposeless rapid arm movements), and records the occurrence time, frequency and duration of each event. | 通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。\"\nversion: \"1.0.6\"\nlicense: \"MIT-0\"\n---\n\n# 🌙 Elderly Sleep Nightmare / Startle Detection | 老年人睡眠中间惊醒/梦魇行为识别\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **老年人睡眠中间惊醒/梦魇行为识别** |\n| 🎯 核心目标 | 通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_ELDERLY_NIGHTMARE_STARTLE_DETECT_ANALYSIS` |\n\nUsing a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden sitting-up (quick lying-to-sitting transition), screams (high-pitched short cries), and arm-thrashing (purposeless rapid arm movements), and records the occurrence time, frequency and duration of each event. This skill helps family members or caregivers understand the elderly person's nighttime sleep quality and identify possible nightmares or REM-sleep Behavior Disorder (RBD), providing reference data for medical evaluation. Application scenarios: home elderly care, nursing homes, neurology sleep monitoring. The system relays monitoring through the night and generates a sleep-abnormality event report. Skill features: frequent nighttime awakenings or nightmares in the elderly may be early manifestations of neurological diseases such as RBD. AI auto-recording of abnormal events provides objective data for physicians, supporting early diagnosis of Parkinson's disease and other neurodegenerative conditions. Can be integrated into smart-home cameras or elderly-care monitoring platforms as an important health-warning tool.\n\n通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。应用场景：居家养老、养老院、神经内科睡眠监测。系统夜间接力监测，生成睡眠异常事件报告。技能特点：老年人夜间频繁惊醒、梦魇可能是快速眼动期睡眠行为障碍（RBD）等神经系统疾病的早期表现。通过AI自动记录异常行为，可为医生提供客观数据，帮助早期诊断帕金森病等神经退行性疾病。该技能可集成到智能家居摄像头或养老监护平台中，成为健康预警的重要工具。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的老年人睡眠行为监测 AI。你的任务是分析卧室固定摄像头的夜间视频（含音频），检测老年人睡眠中的异常行为，包括突然坐起、惊叫声音、无目的挥舞手臂、踢腿等。记录每次事件的起止时间、持续时长，统计夜间总频次与高发时段。不要提供医疗诊断，仅输出基于视觉和音频的行为事件统计，并在频繁或疑似 RBD 模式时附神经内科/睡眠门诊就诊建议。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于卧室固定摄像头（红外夜视 + 麦克风）夜间睡眠音视频（建议 ≥ 6 小时），识别异常事件（突然坐起 / 无目的挥臂 / 踢腿 / 离床 / 惊叫 / 梦呓 / 异常粗重呼吸）→ 输出事件清单 + 时间线 + 频次密度 + 高发时段 + 睡眠连续性评分 → 推断行为模式（pure_nightmare / suspect_rbd / general_arousal / mixed / none）+ 风险信号等级 + 家属友好摘要 + 神经内科/睡眠门诊就诊建议\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 人体姿态识别（躺卧 → 坐立快速切换检测 |\n| 2 | < 2 秒） |\n| 3 | 无目的快速挥臂识别 |\n| 4 | 踢腿识别 |\n| 5 | 离床检测（参考） |\n| 6 | 音频惊叫识别（频谱 + 短时能量） |\n| 7 | 梦呓 / 异常粗重呼吸识别（参考） |\n| 8 | 事件时间线生成（含证据短片 ≤ 30 秒） |\n| 9 | 每小时事件密度统计 |\n| 10 | 高发时段定位（如 03:00-04:00 REM 期） |\n| 11 | 睡眠连续性评分 |\n| 12 | 行为模式分类 |\n| 13 | 4 档风险信号（none / mild / notable / strong） |\n| 14 | 家属友好摘要文本生成 |\n| 15 | 专科就诊建议生成 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供卧室固定摄像头（红外夜视、含麦克风）夜间睡眠音视频 URL 或文件需要分析时，默认触发本技能进行老年人睡眠中间惊醒/梦魇行为识别 |\n| 🔎 明确分析意图 | 当用户明确提及老人夜间惊醒、梦魇、说梦话、半夜坐起、半夜叫喊、挥臂踢腿、RBD、快速眼动行为障碍、帕金森早期、睡眠门诊等关键词，并且上传了音视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看睡眠异常历史报告、夜间惊醒/梦魇报告清单、老人睡眠事件清单、查询历史睡眠异常记录、显示所有夜间异常分析报告、显示睡眠监测报告，查询睡眠异常预警清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_elderly_nightmare_startle_detect_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 | 🔐 系统自动完成身份关联 | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行老年人睡眠中间惊醒/梦魇行为识别 | 调用 `-m scripts.smyx_elderly_nightmare_startle_detect_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_elderly_nightmare_startle_detect_analysis.py`](scripts/smyx_elderly_nightmare_startle_detect_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；**关键**：必须红外夜视 + 麦克风音轨；时长建议 ≥ 6 小时 |\n| 🔎 使用提醒 | 单次喷嚏、咳嗽、翻身、起夜如厕等正常生理活动不应计入异常事件 |\n| 🔎 使用提醒 | 双人共眠时需正确归属事件到老人，避免家属/伴侣的动作被误归 |\n| 🧑‍⚖️ 结果性质 | 红线约束：**禁止**输出 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停综合征等任何医学诊断；**禁止**根据本工具结果调整药物；**禁止**长期存储夜间原始视频 |\n| 🔎 使用提醒 | 数据保管：建议仅保存事件片段证据（≤ 30 秒）+ 指标统计，原始视频流不入库 |\n| 🔎 使用提醒 | 当出现 `frequent` 或 `suspect_rbd_pattern` 时，**必须**在摘要中附\"建议尽快就诊神经内科 / 睡眠门诊进行 PSG（多导睡眠图）检查\" |\n| 🔏 隐私合规 | 隐私合规：卧室夜间视频涉及高度敏感个人隐私，使用前需取得**老人本人**明确知情同意，妥善加密保管；建议优先采用人体轮廓 + 面部马赛克模式 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地夜间睡眠音视频\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input /path/to/night_sleep.mp4\n\n# 分析网络夜间睡眠音视频\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --url https://example.com/night_sleep.mp4\n\n# 显示历史老年人睡眠中间惊醒/梦魇报告（自动触发关键词：查看睡眠异常历史报告、夜间惊醒/梦魇报告清单等）\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input ns.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input ns.mp4 --output result.json\n```\n\nFile v1.0.5:_meta.json\n\n{\n  \"ownerId\": \"kn7e2caqj7pnsvr9r7t8zenghs83xw7n\",\n  \"slug\": \"smyx-elderly-nightmare-startle-detect-analysis\",\n  \"version\": \"1.0.5\",\n  \"publishedAt\": 1784243548477\n}\n\nFile v1.0.5: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}` - 导出完整报告\n\n## 场景代码\n\n- `SMYX_ELDERLY_NIGHTMARE_STARTLE_DETECT_ANALYSIS` - 老年人睡眠中间惊醒/梦魇行为识别\n\n## 输入约束\n\n- 摄像头：卧室固定摄像头，**必须支持红外夜视**（IR），**必须含麦克风**（惊叫识别依赖音频）；能完整拍到老人在床的上半身\n- 帧率 ≥ 5 FPS（夜间统计无需高帧率）；分辨率 ≥ 480p；音频采样率 ≥ 16kHz\n- 视频时长：建议覆盖完整睡眠时段（22:00 → 次日 07:00 左右），**单次分析建议 ≥ 6 小时**\n- ROI 标定：床位 ROI（bed_region）\n- 多人共眠场景（如老两口）需按目标跟踪，避免事件归属错误\n- 隐私敏感场景必须启用人体轮廓 + 面部马赛克模式\n\n## 关键观测信号\n\n### 视觉\n- `sudden_sit_up_event_count` - 突然坐起事件次数（快速从躺卧→坐立，<2 秒完成）\n- `arm_thrashing_event_count` - 无目的快速挥舞手臂事件次数（疑似 RBD 表现）\n- `kick_leg_event_count` - 踢腿事件次数（参考指标）\n- `out_of_bed_event_count` - 离床事件次数（参考指标，与 wandering 技能配合）\n- `total_event_duration_sec` - 全部异常事件累计时长\n\n### 音频\n- `scream_event_count` - 高频短促叫声次数（基于频谱+短时能量）\n- `mumble_or_talking_in_sleep_count` - 梦呓/说梦话次数（参考指标）\n- `loud_breathing_event_count` - 异常粗重呼吸事件（参考指标，可能与睡眠呼吸暂停相关）\n\n### 综合\n- `sleep_window` - 监测时间窗（如 22:00-07:00）\n- `total_abnormal_event_count` - 异常事件总次数\n- `event_density_per_hour` - 每小时事件密度\n- `peak_event_hour` - 异常事件高发时段（如 03:00-04:00，REM 期密集）\n- `sleep_continuity_score` - 睡眠连续性评分（0-100，越高越连续）\n\n## 阈值与等级\n\n- `0-1 次/夜` - normal（正常）\n- `2-3 次/夜` - mild（轻度）\n- `4-7 次/夜` - notable（较频繁）→ 建议记录跟踪\n- `≥ 8 次/夜` 或 `单晚出现 ≥ 1 次 arm_thrashing + scream` 组合 - frequent（频繁）→ 建议尽快就诊神经内科 / 睡眠门诊\n- 单次喷嚏 / 咳嗽 / 翻身等正常生理活动不应计入异常事件\n\n## 输出字段（参考）\n\n- `sleep_window` / `bed_occupied_minutes`\n- `visual_events` / `audio_events`\n- `event_timeline` - 异常事件时间线（每条含 start_ts / end_ts / type / duration_sec / evidence_snippet_url，原始视频不留存）\n- `total_abnormal_event_count` / `event_density_per_hour` / `peak_event_hour`\n- `sleep_continuity_score`\n- `abnormal_pattern` - 行为模式（pure_nightmare / suspect_rbd / general_arousal / mixed / none）\n- `risk_signal_level` - 风险信号等级（none / mild / notable / strong）\n- `alert_type` - 提醒类型（sleep_abnormal_notable / sleep_abnormal_frequent / suspect_rbd_pattern / improving / normal）\n- `alert_level` - 提醒级别（info / notice / warning）\n- `family_summary` - 家属友好摘要（如\"昨晚老人在 03:12 突然坐起并伴随短促叫声 1 次，03:38 出现挥舞手臂约 8 秒；夜间共 3 次异常事件，建议白天观察精神状态，若反复出现建议就诊神经内科睡眠门诊\"）\n- `recommend_action` - 建议动作（push_family_summary / suggest_record_diary / suggest_consult_sleep_clinic / suggest_neurology_consult / observe_only）\n- `clinical_reference` - 当 frequent 或 suspect_rbd_pattern 时附**神经内科 / 睡眠门诊就诊建议** + 中国睡眠研究会等参考资源\n\n## 强制约束与红线\n\n- ❌ **禁止**输出 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停综合征等任何医学诊断结论\n- ❌ **禁止**根据本工具结果调整药物\n- ❌ **禁止**长期存储夜间原始视频；建议仅保存事件片段证据（短片，≤ 30 秒）+ 指标统计\n- ✅ 出现 frequent 或 suspect_rbd_pattern 时附**神经内科 / 睡眠门诊** 就诊建议\n- ✅ 建议家属将事件清单作为**就诊参考资料**，由专科医生结合 PSG（多导睡眠图）等专业检查最终判定\n\n> 仅输出基于视觉与音频的客观行为事件统计，**不构成 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停等任何医学诊断**；任何疑似神经退行性疾病或睡眠障碍的判定与治疗必须由神经内科 / 睡眠专科医生结合 PSG 等专业检查制定。\n\nFile v1.0.5: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.5:scripts/config.yaml\n\n{}\n\nFile v1.0.5:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.5: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.5: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.5: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.5:skill-card.md\n\n## Description: <br>\nUsing a fixed bedroom camera with infrared night vision and microphone input, this skill analyzes elderly nighttime sleep media to detect sudden sitting-up, short screams, arm-thrashing, and related abnormal sleep events, then records event timing, frequency, and duration. <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, caregivers, and care-platform developers use this skill to turn bedroom sleep video or video URLs into structured abnormal-event reports for elderly nighttime monitoring. The output is intended as behavioral reference material for care review and medical consultation, not as a medical diagnosis. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: Sensitive bedroom video, audio, or media URLs may be sent to external Life Emergence/Open API services. <br>\nMitigation: Use only with explicit consent from the recorded person and confirm the provider's data handling, retention, and deletion practices before deployment. <br>\nRisk: The skill may silently create or reuse an internal user identity, associate reports with that identity, and store access tokens in a local SQLite database. <br>\nMitigation: Review identity handling and local credential storage before installation; restrict filesystem access and rotate or remove tokens when access is no longer needed. <br>\nRisk: Sleep event labels and risk signals could be mistaken for medical diagnosis or treatment guidance. <br>\nMitigation: Present outputs as behavioral observations only and route frequent or concerning patterns to qualified neurology or sleep-medicine professionals for clinical evaluation. <br>\n\n\n## Reference(s): <br>\n- [ClawHub Skill Page](https://clawhub.ai/18072937735/skills/smyx-elderly-nightmare-startle-detect-analysis) <br>\n- [API Documentation](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 and JSON-formatted analysis reports, with optional saved output files.] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [Reports may include event timelines, frequency summaries, sleep-continuity scores, risk signal labels, family-facing summaries, recommendations, and report links.] <br>\n\n## Skill Version(s): <br>\n1.0.5 (source: server release metadata; artifact frontmatter reports 1.0.6) <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.5:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.5:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.4: 31 files, 42876 bytes\n\nFiles: references/api_doc.md (5015b), scripts/__init__.py (62b), scripts/config.py (707b), scripts/config.yaml (3b), scripts/skill.py (595b), scripts/smyx_elderly_nightmare_startle_detect_analysis.py (3803b), skill-card.md (2884b), SKILL.md (14356b), 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 (28605b), _meta.json (165b)\n\nFile v1.0.4:SKILL.md\n\n---\nname: \"smyx-elderly-nightmare-startle-detect-analysis\"\ndescription: \"Using a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden sitting-up (quick lying-to-sitting transition), screams (high-pitched short cries), and arm-thrashing (purposeless rapid arm movements), and records the occurrence time, frequency and duration of each event. | 通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。\"\nversion: \"1.0.4\"\nlicense: \"MIT-0\"\n---\n\n# 🌙 Elderly Sleep Nightmare / Startle Detection | 老年人睡眠中间惊醒/梦魇行为识别\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **老年人睡眠中间惊醒/梦魇行为识别** |\n| 🎯 核心目标 | 通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_ELDERLY_NIGHTMARE_STARTLE_DETECT_ANALYSIS` |\n\nUsing a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden sitting-up (quick lying-to-sitting transition), screams (high-pitched short cries), and arm-thrashing (purposeless rapid arm movements), and records the occurrence time, frequency and duration of each event. This skill helps family members or caregivers understand the elderly person's nighttime sleep quality and identify possible nightmares or REM-sleep Behavior Disorder (RBD), providing reference data for medical evaluation. Application scenarios: home elderly care, nursing homes, neurology sleep monitoring. The system relays monitoring through the night and generates a sleep-abnormality event report. Skill features: frequent nighttime awakenings or nightmares in the elderly may be early manifestations of neurological diseases such as RBD. AI auto-recording of abnormal events provides objective data for physicians, supporting early diagnosis of Parkinson's disease and other neurodegenerative conditions. Can be integrated into smart-home cameras or elderly-care monitoring platforms as an important health-warning tool.\n\n通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。应用场景：居家养老、养老院、神经内科睡眠监测。系统夜间接力监测，生成睡眠异常事件报告。技能特点：老年人夜间频繁惊醒、梦魇可能是快速眼动期睡眠行为障碍（RBD）等神经系统疾病的早期表现。通过AI自动记录异常行为，可为医生提供客观数据，帮助早期诊断帕金森病等神经退行性疾病。该技能可集成到智能家居摄像头或养老监护平台中，成为健康预警的重要工具。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的老年人睡眠行为监测 AI。你的任务是分析卧室固定摄像头的夜间视频（含音频），检测老年人睡眠中的异常行为，包括突然坐起、惊叫声音、无目的挥舞手臂、踢腿等。记录每次事件的起止时间、持续时长，统计夜间总频次与高发时段。不要提供医疗诊断，仅输出基于视觉和音频的行为事件统计，并在频繁或疑似 RBD 模式时附神经内科/睡眠门诊就诊建议。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于卧室固定摄像头（红外夜视 + 麦克风）夜间睡眠音视频（建议 ≥ 6 小时），识别异常事件（突然坐起 / 无目的挥臂 / 踢腿 / 离床 / 惊叫 / 梦呓 / 异常粗重呼吸）→ 输出事件清单 + 时间线 + 频次密度 + 高发时段 + 睡眠连续性评分 → 推断行为模式（pure_nightmare / suspect_rbd / general_arousal / mixed / none）+ 风险信号等级 + 家属友好摘要 + 神经内科/睡眠门诊就诊建议\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 人体姿态识别（躺卧 → 坐立快速切换检测 |\n| 2 | < 2 秒） |\n| 3 | 无目的快速挥臂识别 |\n| 4 | 踢腿识别 |\n| 5 | 离床检测（参考） |\n| 6 | 音频惊叫识别（频谱 + 短时能量） |\n| 7 | 梦呓 / 异常粗重呼吸识别（参考） |\n| 8 | 事件时间线生成（含证据短片 ≤ 30 秒） |\n| 9 | 每小时事件密度统计 |\n| 10 | 高发时段定位（如 03:00-04:00 REM 期） |\n| 11 | 睡眠连续性评分 |\n| 12 | 行为模式分类 |\n| 13 | 4 档风险信号（none / mild / notable / strong） |\n| 14 | 家属友好摘要文本生成 |\n| 15 | 专科就诊建议生成 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供卧室固定摄像头（红外夜视、含麦克风）夜间睡眠音视频 URL 或文件需要分析时，默认触发本技能进行老年人睡眠中间惊醒/梦魇行为识别 |\n| 🔎 明确分析意图 | 当用户明确提及老人夜间惊醒、梦魇、说梦话、半夜坐起、半夜叫喊、挥臂踢腿、RBD、快速眼动行为障碍、帕金森早期、睡眠门诊等关键词，并且上传了音视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看睡眠异常历史报告、夜间惊醒/梦魇报告清单、老人睡眠事件清单、查询历史睡眠异常记录、显示所有夜间异常分析报告、显示睡眠监测报告，查询睡眠异常预警清单 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_elderly_nightmare_startle_detect_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 | 🔐 系统自动完成身份关联 | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行老年人睡眠中间惊醒/梦魇行为识别 | 调用 `-m scripts.smyx_elderly_nightmare_startle_detect_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_elderly_nightmare_startle_detect_analysis.py`](scripts/smyx_elderly_nightmare_startle_detect_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；**关键**：必须红外夜视 + 麦克风音轨；时长建议 ≥ 6 小时 |\n| 🔎 使用提醒 | 单次喷嚏、咳嗽、翻身、起夜如厕等正常生理活动不应计入异常事件 |\n| 🔎 使用提醒 | 双人共眠时需正确归属事件到老人，避免家属/伴侣的动作被误归 |\n| 🧑‍⚖️ 结果性质 | 红线约束：**禁止**输出 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停综合征等任何医学诊断；**禁止**根据本工具结果调整药物；**禁止**长期存储夜间原始视频 |\n| 🔎 使用提醒 | 数据保管：建议仅保存事件片段证据（≤ 30 秒）+ 指标统计，原始视频流不入库 |\n| 🔎 使用提醒 | 当出现 `frequent` 或 `suspect_rbd_pattern` 时，**必须**在摘要中附\"建议尽快就诊神经内科 / 睡眠门诊进行 PSG（多导睡眠图）检查\" |\n| 🔏 隐私合规 | 隐私合规：卧室夜间视频涉及高度敏感个人隐私，使用前需取得**老人本人**明确知情同意，妥善加密保管；建议优先采用人体轮廓 + 面部马赛克模式 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地夜间睡眠音视频\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input /path/to/night_sleep.mp4\n\n# 分析网络夜间睡眠音视频\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --url https://example.com/night_sleep.mp4\n\n# 显示历史老年人睡眠中间惊醒/梦魇报告（自动触发关键词：查看睡眠异常历史报告、夜间惊醒/梦魇报告清单等）\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input ns.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input ns.mp4 --output result.json\n```\n\nFile v1.0.4:_meta.json\n\n{\n  \"ownerId\": \"kn7e2caqj7pnsvr9r7t8zenghs83xw7n\",\n  \"slug\": \"smyx-elderly-nightmare-startle-detect-analysis\",\n  \"version\": \"1.0.4\",\n  \"publishedAt\": 1783323626905\n}\n\nFile v1.0.4: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}` - 导出完整报告\n\n## 场景代码\n\n- `SMYX_ELDERLY_NIGHTMARE_STARTLE_DETECT_ANALYSIS` - 老年人睡眠中间惊醒/梦魇行为识别\n\n## 输入约束\n\n- 摄像头：卧室固定摄像头，**必须支持红外夜视**（IR），**必须含麦克风**（惊叫识别依赖音频）；能完整拍到老人在床的上半身\n- 帧率 ≥ 5 FPS（夜间统计无需高帧率）；分辨率 ≥ 480p；音频采样率 ≥ 16kHz\n- 视频时长：建议覆盖完整睡眠时段（22:00 → 次日 07:00 左右），**单次分析建议 ≥ 6 小时**\n- ROI 标定：床位 ROI（bed_region）\n- 多人共眠场景（如老两口）需按目标跟踪，避免事件归属错误\n- 隐私敏感场景必须启用人体轮廓 + 面部马赛克模式\n\n## 关键观测信号\n\n### 视觉\n- `sudden_sit_up_event_count` - 突然坐起事件次数（快速从躺卧→坐立，<2 秒完成）\n- `arm_thrashing_event_count` - 无目的快速挥舞手臂事件次数（疑似 RBD 表现）\n- `kick_leg_event_count` - 踢腿事件次数（参考指标）\n- `out_of_bed_event_count` - 离床事件次数（参考指标，与 wandering 技能配合）\n- `total_event_duration_sec` - 全部异常事件累计时长\n\n### 音频\n- `scream_event_count` - 高频短促叫声次数（基于频谱+短时能量）\n- `mumble_or_talking_in_sleep_count` - 梦呓/说梦话次数（参考指标）\n- `loud_breathing_event_count` - 异常粗重呼吸事件（参考指标，可能与睡眠呼吸暂停相关）\n\n### 综合\n- `sleep_window` - 监测时间窗（如 22:00-07:00）\n- `total_abnormal_event_count` - 异常事件总次数\n- `event_density_per_hour` - 每小时事件密度\n- `peak_event_hour` - 异常事件高发时段（如 03:00-04:00，REM 期密集）\n- `sleep_continuity_score` - 睡眠连续性评分（0-100，越高越连续）\n\n## 阈值与等级\n\n- `0-1 次/夜` - normal（正常）\n- `2-3 次/夜` - mild（轻度）\n- `4-7 次/夜` - notable（较频繁）→ 建议记录跟踪\n- `≥ 8 次/夜` 或 `单晚出现 ≥ 1 次 arm_thrashing + scream` 组合 - frequent（频繁）→ 建议尽快就诊神经内科 / 睡眠门诊\n- 单次喷嚏 / 咳嗽 / 翻身等正常生理活动不应计入异常事件\n\n## 输出字段（参考）\n\n- `sleep_window` / `bed_occupied_minutes`\n- `visual_events` / `audio_events`\n- `event_timeline` - 异常事件时间线（每条含 start_ts / end_ts / type / duration_sec / evidence_snippet_url，原始视频不留存）\n- `total_abnormal_event_count` / `event_density_per_hour` / `peak_event_hour`\n- `sleep_continuity_score`\n- `abnormal_pattern` - 行为模式（pure_nightmare / suspect_rbd / general_arousal / mixed / none）\n- `risk_signal_level` - 风险信号等级（none / mild / notable / strong）\n- `alert_type` - 提醒类型（sleep_abnormal_notable / sleep_abnormal_frequent / suspect_rbd_pattern / improving / normal）\n- `alert_level` - 提醒级别（info / notice / warning）\n- `family_summary` - 家属友好摘要（如\"昨晚老人在 03:12 突然坐起并伴随短促叫声 1 次，03:38 出现挥舞手臂约 8 秒；夜间共 3 次异常事件，建议白天观察精神状态，若反复出现建议就诊神经内科睡眠门诊\"）\n- `recommend_action` - 建议动作（push_family_summary / suggest_record_diary / suggest_consult_sleep_clinic / suggest_neurology_consult / observe_only）\n- `clinical_reference` - 当 frequent 或 suspect_rbd_pattern 时附**神经内科 / 睡眠门诊就诊建议** + 中国睡眠研究会等参考资源\n\n## 强制约束与红线\n\n- ❌ **禁止**输出 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停综合征等任何医学诊断结论\n- ❌ **禁止**根据本工具结果调整药物\n- ❌ **禁止**长期存储夜间原始视频；建议仅保存事件片段证据（短片，≤ 30 秒）+ 指标统计\n- ✅ 出现 frequent 或 suspect_rbd_pattern 时附**神经内科 / 睡眠门诊** 就诊建议\n- ✅ 建议家属将事件清单作为**就诊参考资料**，由专科医生结合 PSG（多导睡眠图）等专业检查最终判定\n\n> 仅输出基于视觉与音频的客观行为事件统计，**不构成 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停等任何医学诊断**；任何疑似神经退行性疾病或睡眠障碍的判定与治疗必须由神经内科 / 睡眠专科医生结合 PSG 等专业检查制定。\n\nFile v1.0.4: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.4:scripts/config.yaml\n\n{}\n\nFile v1.0.4:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.4: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.4: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.4: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.4:skill-card.md\n\n## Description: <br>\nAnalyzes elderly nighttime bedroom audio/video to identify sudden sitting-up, screams, arm-thrashing, and related sleep-abnormality events, then produces structured event statistics and caregiver-facing report output. <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>\nFamilies, caregivers, nursing-home operators, and health-monitoring developers use this skill to analyze fixed-camera nighttime sleep media for abnormal behavior timelines, frequency metrics, risk signals, and clinic-follow-up suggestions. The output is behavioral monitoring support and must not be treated as a medical diagnosis. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: Highly sensitive elderly bedroom audio/video or video URLs may be sent to the publisher's cloud service. <br>\nMitigation: Obtain explicit consent from the monitored person, avoid unnecessary raw-video retention, and confirm deletion, retention, and local-only controls before use. <br>\nRisk: Reports may be linked to an internal account identity, with user and token data stored in a local SQLite database. <br>\nMitigation: Use dedicated accounts where possible, restrict local workspace and database access, and remove or rotate stored tokens when the skill is no longer needed. <br>\nRisk: Health-related behavior summaries may be mistaken for diagnosis or treatment advice. <br>\nMitigation: Treat results as visual and audio behavior statistics only; do not adjust medication or diagnose conditions from the skill output, and seek clinician review for concerning patterns. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill page](https://clawhub.ai/18072937735/skills/smyx-elderly-nightmare-startle-detect-analysis) <br>\n- [Skill demo](https://lifeemergence.com/sample.html) <br>\n- [API interface documentation](artifact/references/api_doc.md) <br>\n- [Shared analysis API documentation](artifact/skills/smyx_analysis/references/api_doc.md) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [Text, Markdown, JSON, Files, Guidance] <br>\n**Output Format:** [Markdown with structured JSON report content and optional output file] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May include report export links and cloud report-list results; local video inputs are limited to supported formats up to 10MB.] <br>\n\n## Skill Version(s): <br>\n1.0.4 (source: SKILL.md frontmatter and server release evidence) <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.4:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.4:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.3: 31 files, 42531 bytes\n\nFiles: references/api_doc.md (5015b), scripts/__init__.py (62b), scripts/config.py (707b), scripts/config.yaml (3b), scripts/skill.py (595b), scripts/smyx_elderly_nightmare_startle_detect_analysis.py (3803b), skill-card.md (2657b), SKILL.md (14356b), 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 (22801b), 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 (28605b), _meta.json (165b)\n\nFile v1.0.3:SKILL.md\n\n---\nname: \"smyx-elderly-nightmare-startle-detect-analysis\"\ndescription: \"Using a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden sitting-up (quick lying-to-sitting transition), screams (high-pitched short cries), and arm-thrashing (purposeless rapid arm movements), and records the occurrence time, frequency and duration of each event. | 通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。\"\nversion: \"1.0.4\"\nlicense: \"MIT-0\"\n---\n\n# 🌙 Elderly Sleep Nightmare / Startle Detection | 老年人睡眠中间惊醒/梦魇行为识别\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **老年人睡眠中间惊醒/梦魇行为识别** |\n| 🎯 核心目标 | 通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_ELDERLY_NIGHTMARE_STARTLE_DETECT_ANALYSIS` |\n\nUsing a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden sitting-up (quick lying-to-sitting transition), screams (high-pitched short cries), and arm-thrashing (purposeless rapid arm movements), and records the occurrence tim...","readmeExcerpt":"Skill: Elderly Sleep Nightmare / Startle Detection | 老年人睡眠中间惊醒/梦魇行为识别 Owner: 18072937735 Summary: Using a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden sitting-up (quick lying-to-sitting transition), screams (high-pitched short cries), and arm-thrashing (purposeless rapid arm movements), and records the occurrenc","codeSnippets":[],"executableExamples":[{"language":"bash","snippet":"python -m scripts.smyx_elderly_nightmare_startle_detect_analysis --list"},{"language":"text","snippet":"requests>=2.28.0"},{"language":"bash","snippet":"# 分析本地夜间睡眠音视频\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input /path/to/night_sleep.mp4\n\n# 分析网络夜间睡眠音视频\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --url https://example.com/night_sleep.mp4\n\n# 显示历史老年人睡眠中间惊醒/梦魇报告（自动触发关键词：查看睡眠异常历史报告、夜间惊醒/梦魇报告清单等）\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input ns.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input ns.mp4 --output result.json"},{"language":"bash","snippet":"python -m scripts.smyx_elderly_nightmare_startle_detect_analysis --list"},{"language":"text","snippet":"requests>=2.28.0"},{"language":"bash","snippet":"# 分析本地夜间睡眠音视频\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input /path/to/night_sleep.mp4\n\n# 分析网络夜间睡眠音视频\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --url https://example.com/night_sleep.mp4\n\n# 显示历史老年人睡眠中间惊醒/梦魇报告（自动触发关键词：查看睡眠异常历史报告、夜间惊醒/梦魇报告清单等）\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input ns.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_elderly_nightmare_startle_detect_analysis --input ns.mp4 --output result.json"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: \"smyx-elderly-nightmare-startle-detect-analysis\"\ndescription: \"Using a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden sitting-up (quick lying-to-sitting transition), screams (high-pitched short cries), and arm-thrashing (purposeless rapid arm movements), and records the occurrence time, frequency and duration of each event. | 通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。\"\nversion: \"1.0.16\"\nlicense: \"MIT-0\"\n---\n\n# 🌙 Elderly Sleep Nightmare / Startle Detection | 老年人睡眠中间惊醒/梦魇行为识别\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **老年人睡眠中间惊醒/梦魇行为识别** |\n| 🎯 核心目标 | 通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_ELDERLY_NIGHTMARE_STARTLE_DETECT_ANALYSIS` |\n\nUsing a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden sitting-up (quick lying-to-sitting transition), screams (high-pitched short cries), and arm-thrashing (purposeless rapid arm movements), and records the occurrence time, frequency and duration of each event. This skill helps family members or caregivers understand the elderly person's nighttime sleep quality and identify possible nightmares or REM-sleep Behavior Disorder (RBD), providing reference data for medical evaluation. Application scenarios: home elderly care, nursing homes, neurology sleep monitoring. The system relays monitoring through the night and generates a sleep-abnormality event report. Skill features: frequent nighttime awakenings or nightmares in the elderly may be early manifestations of neurological diseases such as RBD. AI auto-recording of abnormal events provides objective data for physicians, supporting early diagnosis of Parkinson's disease and other neurodegenerative conditions. Can be integrated into smart-home cameras or elderly-care monitoring platforms as an important health-warning tool.\n\n通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。应用场景：居家养老、养老院、神经内科睡眠监测。系统夜间接力监测，生成睡眠异常事件报告。技能特点：老年人夜间频繁惊醒、梦魇可能是快速眼动期睡眠行为障碍（RBD）等神经系统疾病的早期表现。通过AI自动记录异常行为，可为医生提供客观数据，帮助早期诊断帕金森病等神经退行性疾病。该技能可集成到智能家居摄像头或养老监护平台中，成为健康预警的重要工具。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的老年人睡眠行为监测 AI。你的任务是分析卧室固定摄像头的夜间视频（含音频），检测老年人睡眠中的异常行为，包括突然坐起、惊叫声音、无目的挥舞手臂、踢腿等。记录每次事件的起止时间、持续时长，统计夜间总频次与高发时段。不要提供医疗诊断，仅输出基于视觉和音频的行为事件统计，并在频繁或疑似 RBD 模式时附神经内科/睡眠门诊就诊建议。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | G"},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn7e2caqj7pnsvr9r7t8zenghs83xw7n\",\n  \"slug\": \"smyx-elderly-nightmare-startle-detect-analysis\",\n  \"version\": \"1.0.12\",\n  \"publishedAt\": 1790606436453\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}` - 导出完整报告\n\n## 场景代码\n\n- `SMYX_ELDERLY_NIGHTMARE_STARTLE_DETECT_ANALYSIS` - 老年人睡眠中间惊醒/梦魇行为识别\n\n## 输入约束\n\n- 摄像头：卧室固定摄像头，**必须支持红外夜视**（IR），**必须含麦克风**（惊叫识别依赖音频）；能完整拍到老人在床的上半身\n- 帧率 ≥ 5 FPS（夜间统计无需高帧率）；分辨率 ≥ 480p；音频采样率 ≥ 16kHz\n- 视频时长：建议覆盖完整睡眠时段（22:00 → 次日 07:00 左右），**单次分析建议 ≥ 6 小时**\n- ROI 标定：床位 ROI（bed_region）\n- 多人共眠场景（如老两口）需按目标跟踪，避免事件归属错误\n- 隐私敏感场景必须启用人体轮廓 + 面部马赛克模式\n\n## 关键观测信号\n\n### 视觉\n- `sudden_sit_up_event_count` - 突然坐起事件次数（快速从躺卧→坐立，<2 秒完成）\n- `arm_thrashing_event_count` - 无目的快速挥舞手臂事件次数（疑似 RBD 表现）\n- `kick_leg_event_count` - 踢腿事件次数（参考指标）\n- `out_of_bed_event_count` - 离床事件次数（参考指标，与 wandering 技能配合）\n- `total_event_duration_sec` - 全部异常事件累计时长\n\n### 音频\n- `scream_event_count` - 高频短促叫声次数（基于频谱+短时能量）\n- `mumble_or_talking_in_sleep_count` - 梦呓/说梦话次数（参考指标）\n- `loud_breathing_event_count` - 异常粗重呼吸事件（参考指标，可能与睡眠呼吸暂停相关）\n\n### 综合\n- `sleep_window` - 监测时间窗（如 22:00-07:00）\n- `total_abnormal_event_count` - 异常事件总次数\n- `event_density_per_hour` - 每小时事件密度\n- `peak_event_hour` - 异常事件高发时段（如 03:00-04:00，REM 期密集）\n- `sleep_continuity_score` - 睡眠连续性评分（0-100，越高越连续）\n\n## 阈值与等级\n\n- `0-1 次/夜` - normal（正常）\n- `2-3 次/夜` - mild（轻度）\n- `4-7 次/夜` - notable（较频繁）→ 建议记录跟踪\n- `≥ 8 次/夜` 或 `单晚出现 ≥ 1 次 arm_thrashing + scream` 组合 - frequent（频繁）→ 建议尽快就诊神经内科 / 睡眠门诊\n- 单次喷嚏 / 咳嗽 / 翻身等正常生理活动不应计入异常事件\n\n## 输出字段（参考）\n\n- `sleep_window` / `bed_occupied_minutes`\n- `visual_events` / `audio_events`\n- `event_timeline` - 异常事件时间线（每条含 start_ts / end_ts / type / duration_sec / evidence_snippet_url，原始视频不留存）\n- `total_abnormal_event_count` / `event_density_per_hour` / `peak_event_hour`\n- `sleep_continuity_score`\n- `abnormal_pattern` - 行为模式（pure_nightmare / suspect_rbd / general_arousal / mixed / none）\n- `risk_signal_level` - 风险信号等级（none / mild / notable / strong）\n- `alert_type` - 提醒类型（sleep_abnormal_notable / sleep_abnormal_frequent / suspect_rbd_pattern / improving / normal）\n- `alert_level` - 提醒级别（info / notice / warning）\n- `family_summary` - 家属友好摘要（如\"昨晚老人在 03:12 突然坐起并伴随短促叫声 1 次，03:38 出现挥舞手臂约 8 秒；夜间共 3 次异常事件，建议白天观察精神状态，若反复出现建议就诊神经内科睡眠门诊\"）\n- `recommend_action` - 建议动作（push_family_summary / suggest_record_diary / suggest_consult_sleep_clinic / suggest_neurology_consult / observe_only）\n- `clinical_reference` - 当 frequent 或 suspect_rbd_pattern 时附**神经内科 / 睡眠门诊就诊建议** + 中国睡眠研究会等参考资源\n\n## 强制约束与红线\n\n- ❌ **禁止**输出 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停综合征等任何医学诊断结论\n- ❌ **禁止**根据本工具结果调整药物\n- ❌ **禁止**长期存储夜间原始视频；建议仅保存事件片段证据（短片，≤ 30 秒）+ 指标统计\n- ✅ 出现 frequent 或 suspect_rbd_pattern 时附**神经内科 / 睡眠门诊** 就诊建议\n- ✅ 建议家属将事件清单作为**就诊参考资料**，由专科医生结合 PSG（多导睡眠图）等专业检查最终判定\n\n> 仅输出基于视觉与音频的客观行为事件统计，**不构成 RBD / 帕金森病 / 阿尔茨海默病 / 睡眠呼吸暂停等任何医学诊断**；任何疑似神经退行性疾病或睡眠障碍的判定与治疗必须由神经内科 / 睡眠专科医生结合 PSG 等专业检"},{"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":"Using a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden sitting-up (quick lying-to-sitting transition), screams (high-pitched short cries), and arm-thrashing (purposeless rapid arm movements), and records the occurrence time, frequency and duration of each event. | 通过卧室固定摄像头（红外夜视），分析老年人夜间睡眠视频，检测突然坐起（快速从躺卧变为坐立）、惊叫声音（高频短促叫声）以及挥舞手臂（无目的性的快速手臂动作）等行为，记录发生时间、频次及持续时间。该技能可帮助家属或护理人员了解老人夜间睡眠质量，识别可能的梦魇、快速眼动期睡眠行为障碍等异常现象，为医疗评估提供参考。 Skill: Elderly Sleep Nightmare / Startle Detection | 老年人睡眠中间惊醒/梦魇行为识别 Owner: 18072937735 Summary: Using a fixed bedroom camera (infrared night vision + microphone), the system analyzes elderly nighttime sleep video and detects abnormal events such as sudden sitting-up (quick lying-to-sitting transition), screams (high-pitched short cries), and arm-thrashing (purposeless rapid arm movements), and records the occurrenc","editorialQuality":{"score":100,"threshold":65,"status":"ready","wordCount":1222,"uniquenessScore":45,"reasons":[]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-10T00:59:36.730Z","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-10T00:59:36.730Z","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-10T05:40:28.799Z","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"}]}}}