{"id":"060b8b8c-247d-425e-ae13-f13a968dd0ba","entityType":"agent","slug":"clawhub-smyx-sunjinhui-smyx-sleep-quality-analysis","name":"Sleep Quality Analysis Skill | 睡眠质量分析技能","canonicalUrl":"https://www.xpersona.co/agent/clawhub-smyx-sunjinhui-smyx-sleep-quality-analysis","canonicalPath":"/agent/clawhub-smyx-sunjinhui-smyx-sleep-quality-analysis","generatedAt":"2026-10-10T00:45:14.886Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"editorial-content","verified":true,"confidence":"high","updatedAt":"2026-10-09T15:07:45.586Z","emptyReason":null},"description":"Identifies sleep stages including falling asleep, light sleep, deep sleep, and REM; monitors body movement, nighttime awakenings, and sleep apnea, suitable for sleep monitoring scenarios. | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景 Skill: Sleep Quality Analysis Skill | 睡眠质量分析技能 Owner: smyx-sunjinhui Summary: Identifies sleep stages including falling asleep, light sleep, deep sleep, and REM; monitors body movement, nighttime awakenings, and sleep apnea, suitable for sleep monitoring scenarios. | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景 Tags: latest:1.0.16 Version history: v1.0.16 | 2026-10-04T06:42:30.087Z | auto - Version bumped fr","descriptionLabel":"Technical summary","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 2.4K downloads reported by the source. Last updated 10/9/2026.","installCommand":"clawhub skill install s17cfv2h26b7hq5w47tgfy23xx83z9x6:smyx-sleep-quality-analysis","sourceUrl":"https://clawhub.ai/smyx-sunjinhui/smyx-sleep-quality-analysis","homepage":"https://clawhub.ai/smyx-sunjinhui/skills/smyx-sleep-quality-analysis","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/smyx-sunjinhui/smyx-sleep-quality-analysis","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/smyx-sunjinhui/skills/smyx-sleep-quality-analysis","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":68,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"Identifies sleep stages including falling asleep, light sleep, deep sleep, and REM; monitors body movement, nighttime awakenings, and sleep apnea, suitable for "},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-09T15:07:45.586Z","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-09T15:07:45.586Z","emptyReason":null},"stars":null,"forks":null,"downloads":2422,"packageName":null,"latestVersion":"1.0.16","tractionLabel":"2.4K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-09T15:07:45.585Z","emptyReason":null},"lastUpdatedAt":"2026-10-09T15:07:45.586Z","lastCrawledAt":"2026-10-09T15:07:45.585Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-10T15:07:45.585Z","lastVerifiedAt":null,"highlights":[{"version":"1.0.16","createdAt":"2026-10-04T06:42:30.087Z","changelog":"- Version bumped from 1.0.16 to 1.0.17. - Documentation updated: SKILL.md revised, including the version number. - skill-card.md file removed.","fileCount":30,"zipByteSize":39849},{"version":"1.0.15","createdAt":"2026-09-24T14:39:26.448Z","changelog":"Sleep Quality Analysis skill v1.0.15 changelog: - Updated version metadata and documentation in SKILL.md. - Removed the deprecated skill-card.md file. - Synchronized configuration in skills/smyx_common/scripts/config.yaml.","fileCount":30,"zipByteSize":39919},{"version":"1.0.14","createdAt":"2026-09-14T03:58:28.219Z","changelog":"Version 1.0.14 - Updated documentation in SKILL.md. - Removed the skill-card.md file for simplification. - No changes to underlying features or APIs; release is documentation-only.","fileCount":30,"zipByteSize":40021},{"version":"1.0.13","createdAt":"2026-08-27T21:02:33.975Z","changelog":"sleep-quality-analysis 1.0.13 - Updated SKILL.md with version and documentation changes. - Removed the file skill-card.md.","fileCount":30,"zipByteSize":39935},{"version":"1.0.12","createdAt":"2026-08-20T12:28:31.998Z","changelog":"Sleep Quality Analysis Skill 1.0.12 - Updated internal configuration files for improved maintainability. - Removed redundant file: skill-card.md. - No user-facing feature or documentation changes.","fileCount":30,"zipByteSize":39958},{"version":"1.0.11","createdAt":"2026-08-09T23:43:30.608Z","changelog":"- Removed the file: skill-card.md - No changes to functionality or main documentation - Version bump from 1.0.10 to 1.0.11 - This update only affects project files, not user experience","fileCount":30,"zipByteSize":40074},{"version":"1.0.10","createdAt":"2026-08-09T11:32:30.971Z","changelog":"- Updated version to 1.0.10 in SKILL.md. - Removed the file skill-card.md from the project. - No code or feature changes; this update is documentation-only.","fileCount":30,"zipByteSize":40164},{"version":"1.0.9","createdAt":"2026-08-02T12:29:31.486Z","changelog":"- Updated version to 1.0.9 in SKILL.md. - Removed the file skill-card.md. - No functional changes; this is primarily a documentation and housekeeping update.","fileCount":30,"zipByteSize":40201}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s17cfv2h26b7hq5w47tgfy23xx83z9x6:smyx-sleep-quality-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-smyx-sunjinhui-smyx-sleep-quality-analysis/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-sleep-quality-analysis/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-sleep-quality-analysis/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-sleep-quality-analysis/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-sleep-quality-analysis/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-sleep-quality-analysis/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-10T00:45:14.881Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-sleep-quality-analysis/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-sleep-quality-analysis/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-sleep-quality-analysis/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-smyx-sunjinhui-smyx-sleep-quality-analysis/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"high","updatedAt":"2026-10-09T15:07:45.586Z","emptyReason":null},"readme":"Skill: Sleep Quality Analysis Skill | 睡眠质量分析技能\n\nOwner: smyx-sunjinhui\n\nSummary: Identifies sleep stages including falling asleep, light sleep, deep sleep, and REM; monitors body movement, nighttime awakenings, and sleep apnea, suitable for sleep monitoring scenarios. | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景\n\nTags: latest:1.0.16\n\nVersion history:\n\nv1.0.16 | 2026-10-04T06:42:30.087Z | auto\n\n- Version bumped from 1.0.16 to 1.0.17.\n- Documentation updated: SKILL.md revised, including the version number.\n- skill-card.md file removed.\n\nv1.0.15 | 2026-09-24T14:39:26.448Z | auto\n\nSleep Quality Analysis skill v1.0.15 changelog:\n\n- Updated version metadata and documentation in SKILL.md.\n- Removed the deprecated skill-card.md file.\n- Synchronized configuration in skills/smyx_common/scripts/config.yaml.\n\nv1.0.14 | 2026-09-14T03:58:28.219Z | auto\n\nVersion 1.0.14\n\n- Updated documentation in SKILL.md.\n- Removed the skill-card.md file for simplification.\n- No changes to underlying features or APIs; release is documentation-only.\n\nv1.0.13 | 2026-08-27T21:02:33.975Z | auto\n\nsleep-quality-analysis 1.0.13\n\n- Updated SKILL.md with version and documentation changes.\n- Removed the file skill-card.md.\n\nv1.0.12 | 2026-08-20T12:28:31.998Z | auto\n\nSleep Quality Analysis Skill 1.0.12\n\n- Updated internal configuration files for improved maintainability.\n- Removed redundant file: skill-card.md.\n- No user-facing feature or documentation changes.\n\nv1.0.11 | 2026-08-09T23:43:30.608Z | auto\n\n- Removed the file: skill-card.md\n- No changes to functionality or main documentation\n- Version bump from 1.0.10 to 1.0.11\n- This update only affects project files, not user experience\n\nv1.0.10 | 2026-08-09T11:32:30.971Z | auto\n\n- Updated version to 1.0.10 in SKILL.md.\n- Removed the file skill-card.md from the project.\n- No code or feature changes; this update is documentation-only.\n\nv1.0.9 | 2026-08-02T12:29:31.486Z | auto\n\n- Updated version to 1.0.9 in SKILL.md.\n- Removed the file skill-card.md.\n- No functional changes; this is primarily a documentation and housekeeping update.\n\nv1.0.8 | 2026-07-16T00:25:27.866Z | auto\n\n- Updated version number in SKILL.md from 1.0.5 to 1.0.7.\n- Removed the file skill-card.md.\n- Made minor updates to documentation in SKILL.md.  \n- No functional changes to core logic indicated.\n\nv1.0.7 | 2026-07-09T05:39:27.599Z | auto\n\n- Updated documentation (SKILL.md), including version and various details.\n- Removed obsolete skill-card.md file.\n- Minor internal script adjustments in config.py, dao.py, and util.py.\n- No user-facing functionality changes.\n\nv1.0.6 | 2026-06-28T20:33:24.300Z | auto\n\n- No file or documentation changes detected in this version.\n- Version number remains at 1.0.4 in SKILL.md; version 1.0.6 submitted.\n- No new features, bug fixes, or updates are included in this release.\n\nv1.0.5 | 2026-06-27T01:59:43.068Z | auto\n\nsleep-quality-analysis 1.0.5\n\n- Updated skill documentation with clearer role separation: all user identity management is now handled internally, never exposed or requested from the user.\n- Simplified the API usage process and removed explicit open-id acquisition requirements from user-facing flows.\n- Enhanced clarity: historical analysis report querying strictly requires cloud API, never local memory or manual summary.\n- Added explicit MIT-0 license declaration to SKILL.md.\n- Removed no-longer-relevant files and refactored documentation for ease of use and compliance with stricter privacy rules.\n\nv1.0.4 | 2026-05-27T08:48:37.193Z | auto\n\n- Major refactor: skill structure reorganized with new core module `smyx_analysis`, cleaning up and replacing the old `face_analysis` module.\n- Added: New directory `skills/smyx_analysis` with scripts and config for modular analysis handling.\n- Changed: Updated skill scripts and configs to align with new analysis architecture.\n- Removed: Deprecated `skills/face_analysis` and related files for a streamlined codebase.\n- Updated: Documentation and usage instructions in SKILL.md and related files to match new organization and improvements.\n\nv1.0.3 | 2026-05-17T14:55:16.385Z | auto\n\n- Internal code maintenance in scripts: __init__.py, config.py, and util.py.\n- No changes to user-facing features or documentation.\n- Version remains at 1.0.0 in SKILL.md.\n\nv1.0.2 | 2026-05-08T07:34:08.696Z | auto\n\n- Internal code improvements in skills/face_analysis/scripts/skill.py and skills/smyx_common/scripts/skill.py.\n- No user-facing feature changes or updates to documentation.\n- Version and SKILL.md remain unchanged.\n\nv1.0.1 | 2026-05-02T21:29:37.339Z | auto\n\n- Updated configuration and script files in both face_analysis and smyx_common modules.\n- Internal improvements to configuration handling, including updates to config.py and YAML files.\n- Minor documentation or metadata changes (e.g., SKILL.md version/format clarification).\n- No changes to overall user-facing functionality or workflows.\n\nv1.0.0 | 2026-04-17T02:12:48.739Z | auto\n\nInitial release of Sleep Quality Analysis Skill.\n\n- Identifies sleep stages (falling asleep, light sleep, deep sleep, REM) using contactless video analysis.\n- Monitors body movement, nighttime awakenings, and screens for sleep apnea risk.\n- Generates structured analysis reports from sleep monitoring videos, no wearables required.\n- Enforces strict data access rules: all historical reports must be fetched from the cloud, never from local memory.\n- Implements mandatory open-id retrieval procedure before analysis for user identification and report management.\n- Supports automatic trigger based on user actions and keywords, with Markdown table output for report listings.\n\nArchive index:\n\nArchive v1.0.16: 30 files, 39849 bytes\n\nFiles: references/api_doc.md (666b), scripts/__init__.py (31b), scripts/config.py (623b), scripts/skill.py (567b), scripts/sleep_quality_analysis.py (7561b), skill-card.md (2229b), SKILL.md (9811b), 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 (147b)\n\nFile v1.0.16:SKILL.md\n\n---\nname: \"sleep-quality-analysis\"\ndescription: \"Identifies sleep stages including falling asleep, light sleep, deep sleep, and REM; monitors body movement, nighttime awakenings, and sleep apnea, suitable for sleep monitoring scenarios. | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景\"\nversion: \"1.0.17\"\nlicense: \"MIT-0\"\n---\n\n# 😴 Sleep Quality Analysis Skill | 睡眠质量分析技能\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **睡眠质量分析技能** |\n| 🎯 核心目标 | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SLEEP_QUALITY_ANALYSIS` |\n\nBased on advanced contactless vital sign monitoring technology and deep learning algorithms, this feature accurately\nidentifies and distinguishes four key sleep stages: sleep onset, light sleep (N1/N2), deep sleep (N3), and rapid eye\nmovement (REM). Utilizing high-sensitivity sensors or visual analysis techniques, the system captures subtle body\nmovements, nighttime awakenings, and respiratory rhythm changes in real-time, with a specific focus on intelligent\nscreening and early warning for high-risk abnormalities such as Obstructive Sleep Apnea-Hypopnea Syndrome (OSAHS).\nSuitable for sleep monitoring scenarios in both home and medical settings, this feature generates professional analysis\nreports covering sleep structure, respiratory health, and movement characteristics without the need for any wearable\ndevices, providing users with a scientific and comfortable sleep health management solution.\n\n本功能基于先进的非接触式生命体征监测技术与深度学习算法，能够精准识别并区分入睡、浅睡（N1/N2）、深睡（N3）及快速眼动（REM）四个关键睡眠阶段。系统通过高灵敏度传感器或视觉分析技术，实时捕捉人体微细体动、夜间觉醒次数及呼吸节律变化，重点针对睡眠呼吸暂停（OSAHS）等高风险异常进行智能筛查与预警。该功能适用于家庭及医疗机构的睡眠监测场景，无需穿戴任何设备即可生成包含睡眠结构、呼吸健康及体动特征的专业分析报告，为用户提供科学、舒适的睡眠健康管理方案\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n\n### 1. 🧩 技能用途\n\n通过睡眠监测摄像头视频分析睡眠质量，识别睡眠阶段，获取结构化的睡眠质量分析报告\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 睡眠阶段识别（入睡/浅睡/深睡/快速眼动） |\n| 2 | 体动统计 |\n| 3 | 夜间觉醒次数统计 |\n| 4 | 睡眠呼吸暂停识别 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供睡眠监测视频 URL 或文件需要进行睡眠质量分析时，默认触发本技能 |\n| 🔎 明确分析意图 | 当用户明确需要进行睡眠质量分析，提及睡眠监测、睡眠分期、体动监测、睡眠呼吸暂停等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看历史分析报告、睡眠质量分析报告清单、分析报告列表、查询历史报告、显示所有分析报告、睡眠质量分析历史记录，查询睡眠质量分析分析报告 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.sleep_quality_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.sleep_quality_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.sleep_quality_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--list` | 显示睡眠质量分析历史分析报告列表清单（可以输入起始日期参数过滤数据范围） | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/sleep_quality_analysis.py`](scripts/sleep_quality_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 视频要求：支持 mp4/avi/mov 格式，最大 10MB |\n| 🔎 使用提醒 | 建议视频时长不少于 30 分钟以反映完整睡眠周期 |\n| 🧑‍⚖️ 结果性质 | 本技能仅作睡眠质量参考，不能替代专业睡眠监测设备和医生诊断 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地睡眠监测视频\npython -m scripts.sleep_quality_analysis --input /path/to/sleep_monitor.mp4 分析网络睡眠监测视频，\npython -m scripts.sleep_quality_analysis --url https://example.com/sleep_monitor.mp4 显示历史分析报告/显示分析报告清单列表/显示历史睡眠质量报告（自动触发关键词：查看历史分析报告、历史报告、分析报告清单等）\npython -m scripts.sleep_quality_analysis --list\n\n# 输出精简报告\npython -m scripts.sleep_quality_analysis --input video.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.sleep_quality_analysis --input video.mp4 --output result.json\n```\n\nFile v1.0.16:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-sleep-quality-analysis\",\n  \"version\": \"1.0.16\",\n  \"publishedAt\": 1791096150087\n}\n\nFile v1.0.16:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放宠物健康分析 API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\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- `OPEN_PET_HEALTH_ANALYSIS` - 开放平台宠物健康分析\n\nFile v1.0.16: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.16:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.16: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.16: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.16: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.16:skill-card.md\n\n## Description:\n\nAnalyzes sleep-monitoring videos for sleep stages, body movement, awakenings, and possible apnea, and returns a structured sleep report.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[smyx-sunjinhui](https://clawhub.ai/user/smyx-sunjinhui)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nIndividuals and developers use this skill to analyze sleep-monitoring footage and review sleep-stage estimates, movement, awakenings, and possible breathing interruptions. They can also retrieve prior reports linked to their account.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Private bedroom or health footage is sent to a cloud service for analysis.\n\nMitigation: Obtain consent and review the provider's retention and access controls before submitting sensitive footage.\n\nRisk: The skill can silently create or reuse an account identity and keep service tokens locally.\n\nMitigation: Review account-linked history access and local token storage before installation, and limit device access to trusted users.\n\nRisk: Sleep-stage and apnea findings could be mistaken for a clinical diagnosis.\n\nMitigation: Treat results as informational and seek a clinician or validated sleep-monitoring device for diagnosis.\n\n## Reference(s):\n\n- [ClawHub skill listing](https://clawhub.ai/smyx-sunjinhui/skills/smyx-sleep-quality-analysis)\n- [Skill demonstration](https://lifeemergence.com/sample.html)\n- [Bundled API reference](references/api_doc.md)\n\n## Skill Output:\n\n**Output Type(s):** [Text, Markdown]\n\n**Output Format:** [Sleep analysis reports with structured results and Markdown tables for report history]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Reports may include links and recommendations; results are not a medical diagnosis. The documented video limit is 10 MB.]\n\n## Skill Version(s):\n\n1.0.16 (source: server-resolved release; artifact frontmatter says 1.0.17)\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.16:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.16:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.15: 30 files, 39919 bytes\n\nFiles: references/api_doc.md (666b), scripts/__init__.py (31b), scripts/config.py (623b), scripts/skill.py (567b), scripts/sleep_quality_analysis.py (7561b), skill-card.md (2397b), SKILL.md (9811b), 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 (147b)\n\nFile v1.0.15:SKILL.md\n\n---\nname: \"sleep-quality-analysis\"\ndescription: \"Identifies sleep stages including falling asleep, light sleep, deep sleep, and REM; monitors body movement, nighttime awakenings, and sleep apnea, suitable for sleep monitoring scenarios. | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景\"\nversion: \"1.0.16\"\nlicense: \"MIT-0\"\n---\n\n# 😴 Sleep Quality Analysis Skill | 睡眠质量分析技能\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **睡眠质量分析技能** |\n| 🎯 核心目标 | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SLEEP_QUALITY_ANALYSIS` |\n\nBased on advanced contactless vital sign monitoring technology and deep learning algorithms, this feature accurately\nidentifies and distinguishes four key sleep stages: sleep onset, light sleep (N1/N2), deep sleep (N3), and rapid eye\nmovement (REM). Utilizing high-sensitivity sensors or visual analysis techniques, the system captures subtle body\nmovements, nighttime awakenings, and respiratory rhythm changes in real-time, with a specific focus on intelligent\nscreening and early warning for high-risk abnormalities such as Obstructive Sleep Apnea-Hypopnea Syndrome (OSAHS).\nSuitable for sleep monitoring scenarios in both home and medical settings, this feature generates professional analysis\nreports covering sleep structure, respiratory health, and movement characteristics without the need for any wearable\ndevices, providing users with a scientific and comfortable sleep health management solution.\n\n本功能基于先进的非接触式生命体征监测技术与深度学习算法，能够精准识别并区分入睡、浅睡（N1/N2）、深睡（N3）及快速眼动（REM）四个关键睡眠阶段。系统通过高灵敏度传感器或视觉分析技术，实时捕捉人体微细体动、夜间觉醒次数及呼吸节律变化，重点针对睡眠呼吸暂停（OSAHS）等高风险异常进行智能筛查与预警。该功能适用于家庭及医疗机构的睡眠监测场景，无需穿戴任何设备即可生成包含睡眠结构、呼吸健康及体动特征的专业分析报告，为用户提供科学、舒适的睡眠健康管理方案\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n\n### 1. 🧩 技能用途\n\n通过睡眠监测摄像头视频分析睡眠质量，识别睡眠阶段，获取结构化的睡眠质量分析报告\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 睡眠阶段识别（入睡/浅睡/深睡/快速眼动） |\n| 2 | 体动统计 |\n| 3 | 夜间觉醒次数统计 |\n| 4 | 睡眠呼吸暂停识别 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供睡眠监测视频 URL 或文件需要进行睡眠质量分析时，默认触发本技能 |\n| 🔎 明确分析意图 | 当用户明确需要进行睡眠质量分析，提及睡眠监测、睡眠分期、体动监测、睡眠呼吸暂停等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看历史分析报告、睡眠质量分析报告清单、分析报告列表、查询历史报告、显示所有分析报告、睡眠质量分析历史记录，查询睡眠质量分析分析报告 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.sleep_quality_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.sleep_quality_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.sleep_quality_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--list` | 显示睡眠质量分析历史分析报告列表清单（可以输入起始日期参数过滤数据范围） | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/sleep_quality_analysis.py`](scripts/sleep_quality_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 视频要求：支持 mp4/avi/mov 格式，最大 10MB |\n| 🔎 使用提醒 | 建议视频时长不少于 30 分钟以反映完整睡眠周期 |\n| 🧑‍⚖️ 结果性质 | 本技能仅作睡眠质量参考，不能替代专业睡眠监测设备和医生诊断 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地睡眠监测视频\npython -m scripts.sleep_quality_analysis --input /path/to/sleep_monitor.mp4 分析网络睡眠监测视频，\npython -m scripts.sleep_quality_analysis --url https://example.com/sleep_monitor.mp4 显示历史分析报告/显示分析报告清单列表/显示历史睡眠质量报告（自动触发关键词：查看历史分析报告、历史报告、分析报告清单等）\npython -m scripts.sleep_quality_analysis --list\n\n# 输出精简报告\npython -m scripts.sleep_quality_analysis --input video.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.sleep_quality_analysis --input video.mp4 --output result.json\n```\n\nFile v1.0.15:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-sleep-quality-analysis\",\n  \"version\": \"1.0.15\",\n  \"publishedAt\": 1790260766448\n}\n\nFile v1.0.15:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放宠物健康分析 API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\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- `OPEN_PET_HEALTH_ANALYSIS` - 开放平台宠物健康分析\n\nFile v1.0.15: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.15:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.15: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.15: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.15: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.15:skill-card.md\n\n## Description:\n\nIdentifies sleep stages including falling asleep, light sleep, deep sleep, and REM; monitors body movement, nighttime awakenings, and sleep apnea for sleep monitoring scenarios.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[smyx-sunjinhui](https://clawhub.ai/user/smyx-sunjinhui)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nExternal users and developers use this skill to submit sleep-monitoring video files or URLs to a cloud analysis service, retrieve structured sleep-stage, movement, awakening, and apnea findings, and list prior reports associated with the internal account identity.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Sleep videos or URLs may be processed by the publisher's cloud service.\n\nMitigation: Use only media appropriate for vendor cloud processing and confirm privacy, retention, deletion, and account-control terms before using private in-home or medical footage.\n\nRisk: The skill can silently create or reuse an account identity and store service tokens locally.\n\nMitigation: Run it in a controlled workspace, avoid sharing the workspace across users, and review or clear locally stored account data and tokens according to deployment policy.\n\nRisk: Sleep analysis output is health-related and may be incomplete or inaccurate.\n\nMitigation: Treat results as sleep-quality reference information, not a replacement for professional sleep monitoring equipment or medical diagnosis.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/smyx-sunjinhui/skills/smyx-sleep-quality-analysis)\n- [API documentation](references/api_doc.md)\n- [Skill demo](https://lifeemergence.com/sample.html)\n\n## Skill Output:\n\n**Output Type(s):** [Text, Markdown, JSON]\n\n**Output Format:** [Markdown report or JSON analysis result, with optional saved output file]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Processes sleep-monitoring videos or URLs and can return historical report lists and report links.]\n\n## Skill Version(s):\n\n1.0.15 (source: server release metadata; artifact frontmatter says 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.15:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.15:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.14: 30 files, 40021 bytes\n\nFiles: references/api_doc.md (666b), scripts/__init__.py (31b), scripts/config.py (623b), scripts/skill.py (567b), scripts/sleep_quality_analysis.py (7561b), skill-card.md (2670b), SKILL.md (9811b), 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 (147b)\n\nFile v1.0.14:SKILL.md\n\n---\nname: \"sleep-quality-analysis\"\ndescription: \"Identifies sleep stages including falling asleep, light sleep, deep sleep, and REM; monitors body movement, nighttime awakenings, and sleep apnea, suitable for sleep monitoring scenarios. | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景\"\nversion: \"1.0.14\"\nlicense: \"MIT-0\"\n---\n\n# 😴 Sleep Quality Analysis Skill | 睡眠质量分析技能\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **睡眠质量分析技能** |\n| 🎯 核心目标 | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SLEEP_QUALITY_ANALYSIS` |\n\nBased on advanced contactless vital sign monitoring technology and deep learning algorithms, this feature accurately\nidentifies and distinguishes four key sleep stages: sleep onset, light sleep (N1/N2), deep sleep (N3), and rapid eye\nmovement (REM). Utilizing high-sensitivity sensors or visual analysis techniques, the system captures subtle body\nmovements, nighttime awakenings, and respiratory rhythm changes in real-time, with a specific focus on intelligent\nscreening and early warning for high-risk abnormalities such as Obstructive Sleep Apnea-Hypopnea Syndrome (OSAHS).\nSuitable for sleep monitoring scenarios in both home and medical settings, this feature generates professional analysis\nreports covering sleep structure, respiratory health, and movement characteristics without the need for any wearable\ndevices, providing users with a scientific and comfortable sleep health management solution.\n\n本功能基于先进的非接触式生命体征监测技术与深度学习算法，能够精准识别并区分入睡、浅睡（N1/N2）、深睡（N3）及快速眼动（REM）四个关键睡眠阶段。系统通过高灵敏度传感器或视觉分析技术，实时捕捉人体微细体动、夜间觉醒次数及呼吸节律变化，重点针对睡眠呼吸暂停（OSAHS）等高风险异常进行智能筛查与预警。该功能适用于家庭及医疗机构的睡眠监测场景，无需穿戴任何设备即可生成包含睡眠结构、呼吸健康及体动特征的专业分析报告，为用户提供科学、舒适的睡眠健康管理方案\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n\n### 1. 🧩 技能用途\n\n通过睡眠监测摄像头视频分析睡眠质量，识别睡眠阶段，获取结构化的睡眠质量分析报告\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 睡眠阶段识别（入睡/浅睡/深睡/快速眼动） |\n| 2 | 体动统计 |\n| 3 | 夜间觉醒次数统计 |\n| 4 | 睡眠呼吸暂停识别 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供睡眠监测视频 URL 或文件需要进行睡眠质量分析时，默认触发本技能 |\n| 🔎 明确分析意图 | 当用户明确需要进行睡眠质量分析，提及睡眠监测、睡眠分期、体动监测、睡眠呼吸暂停等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看历史分析报告、睡眠质量分析报告清单、分析报告列表、查询历史报告、显示所有分析报告、睡眠质量分析历史记录，查询睡眠质量分析分析报告 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.sleep_quality_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.sleep_quality_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.sleep_quality_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--list` | 显示睡眠质量分析历史分析报告列表清单（可以输入起始日期参数过滤数据范围） | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/sleep_quality_analysis.py`](scripts/sleep_quality_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 视频要求：支持 mp4/avi/mov 格式，最大 10MB |\n| 🔎 使用提醒 | 建议视频时长不少于 30 分钟以反映完整睡眠周期 |\n| 🧑‍⚖️ 结果性质 | 本技能仅作睡眠质量参考，不能替代专业睡眠监测设备和医生诊断 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地睡眠监测视频\npython -m scripts.sleep_quality_analysis --input /path/to/sleep_monitor.mp4 分析网络睡眠监测视频，\npython -m scripts.sleep_quality_analysis --url https://example.com/sleep_monitor.mp4 显示历史分析报告/显示分析报告清单列表/显示历史睡眠质量报告（自动触发关键词：查看历史分析报告、历史报告、分析报告清单等）\npython -m scripts.sleep_quality_analysis --list\n\n# 输出精简报告\npython -m scripts.sleep_quality_analysis --input video.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.sleep_quality_analysis --input video.mp4 --output result.json\n```\n\nFile v1.0.14:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-sleep-quality-analysis\",\n  \"version\": \"1.0.14\",\n  \"publishedAt\": 1789358308219\n}\n\nFile v1.0.14:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放宠物健康分析 API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\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- `OPEN_PET_HEALTH_ANALYSIS` - 开放平台宠物健康分析\n\nFile v1.0.14: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.14:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.14: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.14: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.14: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.14:skill-card.md\n\n## Description:\n\nIdentifies sleep stages including falling asleep, light sleep, deep sleep, and REM; monitors body movement, nighttime awakenings, and sleep apnea, suitable for sleep monitoring scenarios.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[smyx-sunjinhui](https://clawhub.ai/user/smyx-sunjinhui)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nDevelopers and external users use this skill to submit sleep-monitoring video files or URLs for cloud-backed sleep quality analysis, including sleep stages, body movement, nighttime awakenings, apnea indicators, structured report output, and history lookup.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The skill may upload bedroom or sleep-monitoring media and report data to cloud services.\n\nMitigation: Use only non-sensitive test media unless the publisher documents the backend data flow and obtains explicit user approval for cloud submission.\n\nRisk: The security evidence reports silent identity management and persistent reusable tokens in the workspace.\n\nMitigation: Review token storage and identity behavior before installation, and isolate or clear the workspace after testing.\n\nRisk: The security evidence reports default insecure or private HTTP development endpoints.\n\nMitigation: Require HTTPS endpoints and destination allowlists before using the skill with personal or health-sensitive data.\n\nRisk: Sleep quality and apnea indicators may be health-sensitive and are described as reference information rather than a medical diagnosis.\n\nMitigation: Present outputs as informational only and direct users to qualified medical professionals for diagnosis or treatment decisions.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/smyx-sunjinhui/skills/smyx-sleep-quality-analysis)\n- [API interface documentation](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]\n\n**Output Format:** [Markdown text containing structured JSON report data and optional report links]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Can save report output to a user-specified file; default detail level is json; supported video inputs are mp4, avi, and mov up to 10 MB.]\n\n## Skill Version(s):\n\n1.0.14 (source: server release metadata and SKILL.md frontmatter)\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.14:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.14:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.13: 30 files, 39935 bytes\n\nFiles: references/api_doc.md (666b), scripts/__init__.py (31b), scripts/config.py (623b), scripts/skill.py (567b), scripts/sleep_quality_analysis.py (7561b), skill-card.md (2355b), SKILL.md (9811b), 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 (147b)\n\nFile v1.0.13:SKILL.md\n\n---\nname: \"sleep-quality-analysis\"\ndescription: \"Identifies sleep stages including falling asleep, light sleep, deep sleep, and REM; monitors body movement, nighttime awakenings, and sleep apnea, suitable for sleep monitoring scenarios. | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景\"\nversion: \"1.0.13\"\nlicense: \"MIT-0\"\n---\n\n# 😴 Sleep Quality Analysis Skill | 睡眠质量分析技能\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **睡眠质量分析技能** |\n| 🎯 核心目标 | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SLEEP_QUALITY_ANALYSIS` |\n\nBased on advanced contactless vital sign monitoring technology and deep learning algorithms, this feature accurately\nidentifies and distinguishes four key sleep stages: sleep onset, light sleep (N1/N2), deep sleep (N3), and rapid eye\nmovement (REM). Utilizing high-sensitivity sensors or visual analysis techniques, the system captures subtle body\nmovements, nighttime awakenings, and respiratory rhythm changes in real-time, with a specific focus on intelligent\nscreening and early warning for high-risk abnormalities such as Obstructive Sleep Apnea-Hypopnea Syndrome (OSAHS).\nSuitable for sleep monitoring scenarios in both home and medical settings, this feature generates professional analysis\nreports covering sleep structure, respiratory health, and movement characteristics without the need for any wearable\ndevices, providing users with a scientific and comfortable sleep health management solution.\n\n本功能基于先进的非接触式生命体征监测技术与深度学习算法，能够精准识别并区分入睡、浅睡（N1/N2）、深睡（N3）及快速眼动（REM）四个关键睡眠阶段。系统通过高灵敏度传感器或视觉分析技术，实时捕捉人体微细体动、夜间觉醒次数及呼吸节律变化，重点针对睡眠呼吸暂停（OSAHS）等高风险异常进行智能筛查与预警。该功能适用于家庭及医疗机构的睡眠监测场景，无需穿戴任何设备即可生成包含睡眠结构、呼吸健康及体动特征的专业分析报告，为用户提供科学、舒适的睡眠健康管理方案\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n\n### 1. 🧩 技能用途\n\n通过睡眠监测摄像头视频分析睡眠质量，识别睡眠阶段，获取结构化的睡眠质量分析报告\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 睡眠阶段识别（入睡/浅睡/深睡/快速眼动） |\n| 2 | 体动统计 |\n| 3 | 夜间觉醒次数统计 |\n| 4 | 睡眠呼吸暂停识别 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供睡眠监测视频 URL 或文件需要进行睡眠质量分析时，默认触发本技能 |\n| 🔎 明确分析意图 | 当用户明确需要进行睡眠质量分析，提及睡眠监测、睡眠分期、体动监测、睡眠呼吸暂停等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看历史分析报告、睡眠质量分析报告清单、分析报告列表、查询历史报告、显示所有分析报告、睡眠质量分析历史记录，查询睡眠质量分析分析报告 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.sleep_quality_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.sleep_quality_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.sleep_quality_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--list` | 显示睡眠质量分析历史分析报告列表清单（可以输入起始日期参数过滤数据范围） | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/sleep_quality_analysis.py`](scripts/sleep_quality_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 视频要求：支持 mp4/avi/mov 格式，最大 10MB |\n| 🔎 使用提醒 | 建议视频时长不少于 30 分钟以反映完整睡眠周期 |\n| 🧑‍⚖️ 结果性质 | 本技能仅作睡眠质量参考，不能替代专业睡眠监测设备和医生诊断 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地睡眠监测视频\npython -m scripts.sleep_quality_analysis --input /path/to/sleep_monitor.mp4 分析网络睡眠监测视频，\npython -m scripts.sleep_quality_analysis --url https://example.com/sleep_monitor.mp4 显示历史分析报告/显示分析报告清单列表/显示历史睡眠质量报告（自动触发关键词：查看历史分析报告、历史报告、分析报告清单等）\npython -m scripts.sleep_quality_analysis --list\n\n# 输出精简报告\npython -m scripts.sleep_quality_analysis --input video.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.sleep_quality_analysis --input video.mp4 --output result.json\n```\n\nFile v1.0.13:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-sleep-quality-analysis\",\n  \"version\": \"1.0.13\",\n  \"publishedAt\": 1787864553975\n}\n\nFile v1.0.13:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放宠物健康分析 API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\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- `OPEN_PET_HEALTH_ANALYSIS` - 开放平台宠物健康分析\n\nFile v1.0.13:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.13:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.13:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.13:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.13:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: dev\n\nFile v1.0.13:skill-card.md\n\n## Description:\n\nIdentifies sleep stages including falling asleep, light sleep, deep sleep, and REM; monitors body movement, nighttime awakenings, and sleep apnea, suitable for sleep monitoring scenarios.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[smyx-sunjinhui](https://clawhub.ai/user/smyx-sunjinhui)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nExternal users and developers use this skill to analyze sleep-monitoring video files or public video URLs, identify sleep stages and movement or apnea indicators, and return structured sleep-quality reports or report-history tables.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Sleep videos, remote video URLs, and report history may be processed by lifeemergence.com cloud services.\n\nMitigation: Install and run only when the user accepts third-party cloud processing of sensitive sleep-monitoring media and account-linked history.\n\nRisk: The skill can create or reuse a local account identity and store tokens or profile data in a workspace SQLite database.\n\nMitigation: Use a dedicated workspace, restrict access to the workspace data directory, and clear stored identity or token data when it is no longer needed.\n\nRisk: Sleep-stage and apnea outputs are health-related and may be incomplete or inaccurate.\n\nMitigation: Treat results as informational sleep-quality references, not as a substitute for clinical sleep monitoring or medical diagnosis.\n\n## Reference(s):\n\n- [API 接口文档](references/api_doc.md)\n- [API接口文档](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, Shell commands, Configuration]\n\n**Output Format:** [Markdown reports, Markdown tables, or JSON text depending on the selected detail level and report-history mode]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Can save output to a user-selected file path.]\n\n## Skill Version(s):\n\n1.0.13 (source: SKILL.md frontmatter and server release evidence)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.13:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.13:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.12: 30 files, 39958 bytes\n\nFiles: references/api_doc.md (666b), scripts/__init__.py (31b), scripts/config.py (623b), scripts/skill.py (567b), scripts/sleep_quality_analysis.py (7561b), skill-card.md (2608b), SKILL.md (9811b), 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 (147b)\n\nFile v1.0.12:SKILL.md\n\n---\nname: \"sleep-quality-analysis\"\ndescription: \"Identifies sleep stages including falling asleep, light sleep, deep sleep, and REM; monitors body movement, nighttime awakenings, and sleep apnea, suitable for sleep monitoring scenarios. | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景\"\nversion: \"1.0.11\"\nlicense: \"MIT-0\"\n---\n\n# 😴 Sleep Quality Analysis Skill | 睡眠质量分析技能\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **睡眠质量分析技能** |\n| 🎯 核心目标 | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SLEEP_QUALITY_ANALYSIS` |\n\nBased on advanced contactless vital sign monitoring technology and deep learning algorithms, this feature accurately\nidentifies and distinguishes four key sleep stages: sleep onset, light sleep (N1/N2), deep sleep (N3), and rapid eye\nmovement (REM). Utilizing high-sensitivity sensors or visual analysis techniques, the system captures subtle body\nmovements, nighttime awakenings, and respiratory rhythm changes in real-time, with a specific focus on intelligent\nscreening and early warning for high-risk abnormalities such as Obstructive Sleep Apnea-Hypopnea Syndrome (OSAHS).\nSuitable for sleep monitoring scenarios in both home and medical settings, this feature generates professional analysis\nreports covering sleep structure, respiratory health, and movement characteristics without the need for any wearable\ndevices, providing users with a scientific and comfortable sleep health management solution.\n\n本功能基于先进的非接触式生命体征监测技术与深度学习算法，能够精准识别并区分入睡、浅睡（N1/N2）、深睡（N3）及快速眼动（REM）四个关键睡眠阶段。系统通过高灵敏度传感器或视觉分析技术，实时捕捉人体微细体动、夜间觉醒次数及呼吸节律变化，重点针对睡眠呼吸暂停（OSAHS）等高风险异常进行智能筛查与预警。该功能适用于家庭及医疗机构的睡眠监测场景，无需穿戴任何设备即可生成包含睡眠结构、呼吸健康及体动特征的专业分析报告，为用户提供科学、舒适的睡眠健康管理方案\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n\n### 1. 🧩 技能用途\n\n通过睡眠监测摄像头视频分析睡眠质量，识别睡眠阶段，获取结构化的睡眠质量分析报告\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 睡眠阶段识别（入睡/浅睡/深睡/快速眼动） |\n| 2 | 体动统计 |\n| 3 | 夜间觉醒次数统计 |\n| 4 | 睡眠呼吸暂停识别 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供睡眠监测视频 URL 或文件需要进行睡眠质量分析时，默认触发本技能 |\n| 🔎 明确分析意图 | 当用户明确需要进行睡眠质量分析，提及睡眠监测、睡眠分期、体动监测、睡眠呼吸暂停等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看历史分析报告、睡眠质量分析报告清单、分析报告列表、查询历史报告、显示所有分析报告、睡眠质量分析历史记录，查询睡眠质量分析分析报告 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.sleep_quality_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.sleep_quality_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.sleep_quality_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--list` | 显示睡眠质量分析历史分析报告列表清单（可以输入起始日期参数过滤数据范围） | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/sleep_quality_analysis.py`](scripts/sleep_quality_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 视频要求：支持 mp4/avi/mov 格式，最大 10MB |\n| 🔎 使用提醒 | 建议视频时长不少于 30 分钟以反映完整睡眠周期 |\n| 🧑‍⚖️ 结果性质 | 本技能仅作睡眠质量参考，不能替代专业睡眠监测设备和医生诊断 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地睡眠监测视频\npython -m scripts.sleep_quality_analysis --input /path/to/sleep_monitor.mp4 分析网络睡眠监测视频，\npython -m scripts.sleep_quality_analysis --url https://example.com/sleep_monitor.mp4 显示历史分析报告/显示分析报告清单列表/显示历史睡眠质量报告（自动触发关键词：查看历史分析报告、历史报告、分析报告清单等）\npython -m scripts.sleep_quality_analysis --list\n\n# 输出精简报告\npython -m scripts.sleep_quality_analysis --input video.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.sleep_quality_analysis --input video.mp4 --output result.json\n```\n\nFile v1.0.12:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-sleep-quality-analysis\",\n  \"version\": \"1.0.12\",\n  \"publishedAt\": 1787228911998\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- 请求格式：支持文件上传\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- `OPEN_PET_HEALTH_ANALYSIS` - 开放平台宠物健康分析\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: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: dev\n\nFile v1.0.12:skill-card.md\n\n## Description:\n\nIdentifies sleep stages including falling asleep, light sleep, deep sleep, and REM; monitors body movement, nighttime awakenings, and sleep apnea, suitable for sleep monitoring scenarios.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[smyx-sunjinhui](https://clawhub.ai/user/smyx-sunjinhui)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nExternal users and developers use this skill to analyze sleep-monitoring video or image inputs, identify sleep stages, body movement, awakenings, and possible sleep apnea, and generate structured sleep-quality reports. It can also retrieve historical sleep-analysis report lists from the publisher's cloud service.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Sleep-monitoring media and prior report metadata may be sent to the publisher's cloud service.\n\nMitigation: Use only with appropriate consent and review suitability before sending health-adjacent media or metadata, especially in shared, regulated, or multi-user environments.\n\nRisk: The skill may silently create or reuse a local/cloud-linked identity and persist authentication tokens locally.\n\nMitigation: Review local identity and token database handling before deployment, and disable or isolate the behavior when identity persistence is not acceptable.\n\nRisk: Historical report listing can automatically retrieve prior reports from the cloud service with weak user control.\n\nMitigation: Review or disable automatic history-listing behavior where users should explicitly approve retrieval of prior health-adjacent reports.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/smyx-sunjinhui/skills/smyx-sleep-quality-analysis)\n- [Skill demo](https://lifeemergence.com/sample.html)\n- [API documentation](references/api_doc.md)\n- [Analysis API documentation](skills/smyx_analysis/references/api_doc.md)\n\n## Skill Output:\n\n**Output Type(s):** [Analysis, Markdown, JSON, Files]\n\n**Output Format:** [Markdown and JSON-formatted text, with optional saved output files and report links]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Reports are sleep-quality references only and are not a substitute for professional diagnosis.]\n\n## Skill Version(s):\n\n1.0.12 (source: server release evidence; artifact frontmatter reports 1.0.11)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.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: 30 files, 40074 bytes\n\nFiles: references/api_doc.md (666b), scripts/__init__.py (31b), scripts/config.py (623b), scripts/skill.py (567b), scripts/sleep_quality_analysis.py (7561b), skill-card.md (2531b), SKILL.md (9811b), 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 (147b)\n\nFile v1.0.11:SKILL.md\n\n---\nname: \"sleep-quality-analysis\"\ndescription: \"Identifies sleep stages including falling asleep, light sleep, deep sleep, and REM; monitors body movement, nighttime awakenings, and sleep apnea, suitable for sleep monitoring scenarios. | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景\"\nversion: \"1.0.10\"\nlicense: \"MIT-0\"\n---\n\n# 😴 Sleep Quality Analysis Skill | 睡眠质量分析技能\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **睡眠质量分析技能** |\n| 🎯 核心目标 | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SLEEP_QUALITY_ANALYSIS` |\n\nBased on advanced contactless vital sign monitoring technology and deep learning algorithms, this feature accurately\nidentifies and distinguishes four key sleep stages: sleep onset, light sleep (N1/N2), deep sleep (N3), and rapid eye\nmovement (REM). Utilizing high-sensitivity sensors or visual analysis techniques, the system captures subtle body\nmovements, nighttime awakenings, and respiratory rhythm changes in real-time, with a specific focus on intelligent\nscreening and early warning for high-risk abnormalities such as Obstructive Sleep Apnea-Hypopnea Syndrome (OSAHS).\nSuitable for sleep monitoring scenarios in both home and medical settings, this feature generates professional analysis\nreports covering sleep structure, respiratory health, and movement characteristics without the need for any wearable\ndevices, providing users with a scientific and comfortable sleep health management solution.\n\n本功能基于先进的非接触式生命体征监测技术与深度学习算法，能够精准识别并区分入睡、浅睡（N1/N2）、深睡（N3）及快速眼动（REM）四个关键睡眠阶段。系统通过高灵敏度传感器或视觉分析技术，实时捕捉人体微细体动、夜间觉醒次数及呼吸节律变化，重点针对睡眠呼吸暂停（OSAHS）等高风险异常进行智能筛查与预警。该功能适用于家庭及医疗机构的睡眠监测场景，无需穿戴任何设备即可生成包含睡眠结构、呼吸健康及体动特征的专业分析报告，为用户提供科学、舒适的睡眠健康管理方案\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n\n### 1. 🧩 技能用途\n\n通过睡眠监测摄像头视频分析睡眠质量，识别睡眠阶段，获取结构化的睡眠质量分析报告\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 睡眠阶段识别（入睡/浅睡/深睡/快速眼动） |\n| 2 | 体动统计 |\n| 3 | 夜间觉醒次数统计 |\n| 4 | 睡眠呼吸暂停识别 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供睡眠监测视频 URL 或文件需要进行睡眠质量分析时，默认触发本技能 |\n| 🔎 明确分析意图 | 当用户明确需要进行睡眠质量分析，提及睡眠监测、睡眠分期、体动监测、睡眠呼吸暂停等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看历史分析报告、睡眠质量分析报告清单、分析报告列表、查询历史报告、显示所有分析报告、睡眠质量分析历史记录，查询睡眠质量分析分析报告 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.sleep_quality_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.sleep_quality_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.sleep_quality_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--list` | 显示睡眠质量分析历史分析报告列表清单（可以输入起始日期参数过滤数据范围） | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/sleep_quality_analysis.py`](scripts/sleep_quality_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 视频要求：支持 mp4/avi/mov 格式，最大 10MB |\n| 🔎 使用提醒 | 建议视频时长不少于 30 分钟以反映完整睡眠周期 |\n| 🧑‍⚖️ 结果性质 | 本技能仅作睡眠质量参考，不能替代专业睡眠监测设备和医生诊断 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地睡眠监测视频\npython -m scripts.sleep_quality_analysis --input /path/to/sleep_monitor.mp4 分析网络睡眠监测视频，\npython -m scripts.sleep_quality_analysis --url https://example.com/sleep_monitor.mp4 显示历史分析报告/显示分析报告清单列表/显示历史睡眠质量报告（自动触发关键词：查看历史分析报告、历史报告、分析报告清单等）\npython -m scripts.sleep_quality_analysis --list\n\n# 输出精简报告\npython -m scripts.sleep_quality_analysis --input video.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.sleep_quality_analysis --input video.mp4 --output result.json\n```\n\nFile v1.0.11:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-sleep-quality-analysis\",\n  \"version\": \"1.0.11\",\n  \"publishedAt\": 1786319010608\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- 请求格式：支持文件上传\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- `OPEN_PET_HEALTH_ANALYSIS` - 开放平台宠物健康分析\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: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\nIdentifies sleep stages including falling asleep, light sleep, deep sleep, and REM; monitors body movement, nighttime awakenings, and sleep apnea, suitable for sleep monitoring scenarios. | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[smyx-sunjinhui](https://clawhub.ai/user/smyx-sunjinhui)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nExternal users and developers use this skill to analyze sleep-monitoring video files or URLs for sleep stage, body movement, nighttime awakening, and sleep apnea indicators, and to retrieve cloud-hosted historical reports.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Sleep-monitoring videos, URLs, and report queries may be sent to the Life Emergence cloud service.\n\nMitigation: Use only with recordings and report queries that the user is comfortable processing through that cloud service.\n\nRisk: The skill can silently create or reuse identities and stores tokens locally.\n\nMitigation: Avoid shared workspaces unless identity separation is clear, and review how local tokens and database entries are deleted before use.\n\nRisk: Historical report queries can expose sensitive sleep or medical-adjacent history.\n\nMitigation: Confirm the intended account context before querying historical reports, especially for private bedroom or medical-adjacent recordings.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/smyx-sunjinhui/skills/smyx-sleep-quality-analysis)\n- [Skill demo](https://lifeemergence.com/sample.html)\n- [API documentation](references/api_doc.md)\n- [Shared analysis API documentation](skills/smyx_analysis/references/api_doc.md)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, json, shell commands]\n\n**Output Format:** [Markdown reports or JSON sleep-analysis results, with optional saved text output]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Analyzes mp4, avi, or mov inputs up to 10 MB; historical reports are queried from the cloud service.]\n\n## Skill Version(s):\n\n1.0.11 (source: server-resolved release metadata)\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: 30 files, 40164 bytes\n\nFiles: references/api_doc.md (666b), scripts/__init__.py (31b), scripts/config.py (623b), scripts/skill.py (567b), scripts/sleep_quality_analysis.py (7561b), skill-card.md (2714b), SKILL.md (9811b), 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 (147b)\n\nFile v1.0.10:SKILL.md\n\n---\nname: \"sleep-quality-analysis\"\ndescription: \"Identifies sleep stages including falling asleep, light sleep, deep sleep, and REM; monitors body movement, nighttime awakenings, and sleep apnea, suitable for sleep monitoring scenarios. | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景\"\nversion: \"1.0.10\"\nlicense: \"MIT-0\"\n---\n\n# 😴 Sleep Quality Analysis Skill | 睡眠质量分析技能\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **睡眠质量分析技能** |\n| 🎯 核心目标 | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SLEEP_QUALITY_ANALYSIS` |\n\nBased on advanced contactless vital sign monitoring technology and deep learning algorithms, this feature accurately\nidentifies and distinguishes four key sleep stages: sleep onset, light sleep (N1/N2), deep sleep (N3), and rapid eye\nmovement (REM). Utilizing high-sensitivity sensors or visual analysis techniques, the system captures subtle body\nmovements, nighttime awakenings, and respiratory rhythm changes in real-time, with a specific focus on intelligent\nscreening and early warning for high-risk abnormalities such as Obstructive Sleep Apnea-Hypopnea Syndrome (OSAHS).\nSuitable for sleep monitoring scenarios in both home and medical settings, this feature generates professional analysis\nreports covering sleep structure, respiratory health, and movement characteristics without the need for any wearable\ndevices, providing users with a scientific and comfortable sleep health management solution.\n\n本功能基于先进的非接触式生命体征监测技术与深度学习算法，能够精准识别并区分入睡、浅睡（N1/N2）、深睡（N3）及快速眼动（REM）四个关键睡眠阶段。系统通过高灵敏度传感器或视觉分析技术，实时捕捉人体微细体动、夜间觉醒次数及呼吸节律变化，重点针对睡眠呼吸暂停（OSAHS）等高风险异常进行智能筛查与预警。该功能适用于家庭及医疗机构的睡眠监测场景，无需穿戴任何设备即可生成包含睡眠结构、呼吸健康及体动特征的专业分析报告，为用户提供科学、舒适的睡眠健康管理方案\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n\n### 1. 🧩 技能用途\n\n通过睡眠监测摄像头视频分析睡眠质量，识别睡眠阶段，获取结构化的睡眠质量分析报告\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 睡眠阶段识别（入睡/浅睡/深睡/快速眼动） |\n| 2 | 体动统计 |\n| 3 | 夜间觉醒次数统计 |\n| 4 | 睡眠呼吸暂停识别 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供睡眠监测视频 URL 或文件需要进行睡眠质量分析时，默认触发本技能 |\n| 🔎 明确分析意图 | 当用户明确需要进行睡眠质量分析，提及睡眠监测、睡眠分期、体动监测、睡眠呼吸暂停等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看历史分析报告、睡眠质量分析报告清单、分析报告列表、查询历史报告、显示所有分析报告、睡眠质量分析历史记录，查询睡眠质量分析分析报告 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.sleep_quality_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.sleep_quality_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.sleep_quality_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--list` | 显示睡眠质量分析历史分析报告列表清单（可以输入起始日期参数过滤数据范围） | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/sleep_quality_analysis.py`](scripts/sleep_quality_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 视频要求：支持 mp4/avi/mov 格式，最大 10MB |\n| 🔎 使用提醒 | 建议视频时长不少于 30 分钟以反映完整睡眠周期 |\n| 🧑‍⚖️ 结果性质 | 本技能仅作睡眠质量参考，不能替代专业睡眠监测设备和医生诊断 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地睡眠监测视频\npython -m scripts.sleep_quality_analysis --input /path/to/sleep_monitor.mp4 分析网络睡眠监测视频，\npython -m scripts.sleep_quality_analysis --url https://example.com/sleep_monitor.mp4 显示历史分析报告/显示分析报告清单列表/显示历史睡眠质量报告（自动触发关键词：查看历史分析报告、历史报告、分析报告清单等）\npython -m scripts.sleep_quality_analysis --list\n\n# 输出精简报告\npython -m scripts.sleep_quality_analysis --input video.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.sleep_quality_analysis --input video.mp4 --output result.json\n```\n\nFile v1.0.10:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-sleep-quality-analysis\",\n  \"version\": \"1.0.10\",\n  \"publishedAt\": 1786275150971\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- 请求格式：支持文件上传\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- `OPEN_PET_HEALTH_ANALYSIS` - 开放平台宠物健康分析\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: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: prod\n\nFile v1.0.10:skill-card.md\n\n## Description:\n\nIdentifies sleep stages including falling asleep, light sleep, deep sleep, and REM; monitors body movement, nighttime awakenings, and sleep apnea, suitable for sleep monitoring scenarios. | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[smyx-sunjinhui](https://clawhub.ai/user/smyx-sunjinhui)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nExternal users and developers use this skill to analyze sleep-monitoring video files or URLs, identify sleep stages and apnea indicators, and retrieve structured sleep-quality reports or historical report lists.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Sleep-monitoring media or URLs may be sent to a remote lifeemergence.com API for analysis.\n\nMitigation: Use the skill only when the publisher and remote service are trusted for the media involved, and avoid sensitive or regulated recordings unless the deployment has appropriate approval.\n\nRisk: The skill may create or reuse a local identity and store access tokens in a workspace SQLite database.\n\nMitigation: Run it in a controlled workspace, restrict access to generated local data, and clear local state after use when account-linked report history should not persist.\n\nRisk: Sleep-quality findings are informational and may be mistaken for medical diagnosis.\n\nMitigation: Treat outputs as sleep-quality reference material and consult qualified medical professionals for diagnosis or care decisions.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/smyx-sunjinhui/skills/smyx-sleep-quality-analysis)\n- [Skill demo](https://lifeemergence.com/sample.html)\n- [API documentation](references/api_doc.md)\n- [Shared analysis API documentation](skills/smyx_analysis/references/api_doc.md)\n\n## Skill Output:\n\n**Output Type(s):** [Analysis, Markdown, JSON, Files, Shell commands, Guidance]\n\n**Output Format:** [Markdown reports, JSON analysis payloads, report links, and optional saved text output]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Supports local video files or public video URLs, history-list queries, basic/standard/json detail levels, and optional output-file writing.]\n\n## Skill Version(s):\n\n1.0.10 (source: SKILL.md frontmatter and server release metadata)\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: 30 files, 40201 bytes\n\nFiles: references/api_doc.md (666b), scripts/__init__.py (31b), scripts/config.py (623b), scripts/skill.py (567b), scripts/sleep_quality_analysis.py (7561b), skill-card.md (2919b), SKILL.md (9810b), 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 (146b)\n\nFile v1.0.9:SKILL.md\n\n---\nname: \"sleep-quality-analysis\"\ndescription: \"Identifies sleep stages including falling asleep, light sleep, deep sleep, and REM; monitors body movement, nighttime awakenings, and sleep apnea, suitable for sleep monitoring scenarios. | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景\"\nversion: \"1.0.9\"\nlicense: \"MIT-0\"\n---\n\n# 😴 Sleep Quality Analysis Skill | 睡眠质量分析技能\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **睡眠质量分析技能** |\n| 🎯 核心目标 | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SLEEP_QUALITY_ANALYSIS` |\n\nBased on advanced contactless vital sign monitoring technology and deep learning algorithms, this feature accurately\nidentifies and distinguishes four key sleep stages: sleep onset, light sleep (N1/N2), deep sleep (N3), and rapid eye\nmovement (REM). Utilizing high-sensitivity sensors or visual analysis techniques, the system captures subtle body\nmovements, nighttime awakenings, and respiratory rhythm changes in real-time, with a specific focus on intelligent\nscreening and early warning for high-risk abnormalities such as Obstructive Sleep Apnea-Hypopnea Syndrome (OSAHS).\nSuitable for sleep monitoring scenarios in both home and medical settings, this feature generates professional analysis\nreports covering sleep structure, respiratory health, and movement characteristics without the need for any wearable\ndevices, providing users with a scientific and comfortable sleep health management solution.\n\n本功能基于先进的非接触式生命体征监测技术与深度学习算法，能够精准识别并区分入睡、浅睡（N1/N2）、深睡（N3）及快速眼动（REM）四个关键睡眠阶段。系统通过高灵敏度传感器或视觉分析技术，实时捕捉人体微细体动、夜间觉醒次数及呼吸节律变化，重点针对睡眠呼吸暂停（OSAHS）等高风险异常进行智能筛查与预警。该功能适用于家庭及医疗机构的睡眠监测场景，无需穿戴任何设备即可生成包含睡眠结构、呼吸健康及体动特征的专业分析报告，为用户提供科学、舒适的睡眠健康管理方案\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n\n### 1. 🧩 技能用途\n\n通过睡眠监测摄像头视频分析睡眠质量，识别睡眠阶段，获取结构化的睡眠质量分析报告\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 睡眠阶段识别（入睡/浅睡/深睡/快速眼动） |\n| 2 | 体动统计 |\n| 3 | 夜间觉醒次数统计 |\n| 4 | 睡眠呼吸暂停识别 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供睡眠监测视频 URL 或文件需要进行睡眠质量分析时，默认触发本技能 |\n| 🔎 明确分析意图 | 当用户明确需要进行睡眠质量分析，提及睡眠监测、睡眠分期、体动监测、睡眠呼吸暂停等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看历史分析报告、睡眠质量分析报告清单、分析报告列表、查询历史报告、显示所有分析报告、睡眠质量分析历史记录，查询睡眠质量分析分析报告 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.sleep_quality_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.sleep_quality_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.sleep_quality_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--list` | 显示睡眠质量分析历史分析报告列表清单（可以输入起始日期参数过滤数据范围） | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/sleep_quality_analysis.py`](scripts/sleep_quality_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 视频要求：支持 mp4/avi/mov 格式，最大 10MB |\n| 🔎 使用提醒 | 建议视频时长不少于 30 分钟以反映完整睡眠周期 |\n| 🧑‍⚖️ 结果性质 | 本技能仅作睡眠质量参考，不能替代专业睡眠监测设备和医生诊断 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地睡眠监测视频\npython -m scripts.sleep_quality_analysis --input /path/to/sleep_monitor.mp4 分析网络睡眠监测视频，\npython -m scripts.sleep_quality_analysis --url https://example.com/sleep_monitor.mp4 显示历史分析报告/显示分析报告清单列表/显示历史睡眠质量报告（自动触发关键词：查看历史分析报告、历史报告、分析报告清单等）\npython -m scripts.sleep_quality_analysis --list\n\n# 输出精简报告\npython -m scripts.sleep_quality_analysis --input video.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.sleep_quality_analysis --input video.mp4 --output result.json\n```\n\nFile v1.0.9:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-sleep-quality-analysis\",\n  \"version\": \"1.0.9\",\n  \"publishedAt\": 1785673771486\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- 请求格式：支持文件上传\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- `OPEN_PET_HEALTH_ANALYSIS` - 开放平台宠物健康分析\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: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: prod\n\nFile v1.0.9:skill-card.md\n\n## Description: <br>\nIdentifies sleep stages including falling asleep, light sleep, deep sleep, and REM; monitors body movement, nighttime awakenings, and sleep apnea, suitable for sleep monitoring scenarios. | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景 <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[smyx-sunjinhui](https://clawhub.ai/user/smyx-sunjinhui) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nExternal users, developers, and operators use this skill to submit sleep-monitoring video files or public video URLs for cloud-based sleep quality analysis, including sleep-stage recognition, movement counts, awakenings, apnea indicators, structured reports, and report history queries. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: The skill sends sleep-monitoring videos or video URLs to the LifeEmergence cloud service. <br>\nMitigation: Use it only when the service's privacy, retention, and deletion practices are acceptable for the footage being analyzed, and avoid sensitive bedroom recordings unless those practices have been reviewed. <br>\nRisk: The skill may store internal account identity, authentication tokens, and report history data locally in the workspace. <br>\nMitigation: Run it in a controlled workspace, avoid sharing that workspace, and clear local data after use when account or report history should not persist. <br>\nRisk: The generated sleep report is health-related guidance and is not a substitute for clinical diagnosis. <br>\nMitigation: Treat outputs as sleep-quality reference information and route concerning apnea or sleep-health findings to qualified medical professionals. <br>\n\n\n## Reference(s): <br>\n- [Skill usage demo](https://lifeemergence.com/sample.html) <br>\n- [API interface documentation](references/api_doc.md) <br>\n- [Analysis API reference](skills/smyx_analysis/references/api_doc.md) <br>\n- [ClawHub skill page](https://clawhub.ai/smyx-sunjinhui/skills/smyx-sleep-quality-analysis) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [Text, Markdown, JSON, API Calls] <br>\n**Output Format:** [Markdown and JSON structured analysis reports] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [May include sleep-stage metrics, movement and awakening counts, apnea indicators, recommendations, report links, and cloud report-history records.] <br>\n\n## Skill Version(s): <br>\n1.0.9 (source: frontmatter and 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.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: 30 files, 39992 bytes\n\nFiles: references/api_doc.md (666b), scripts/__init__.py (31b), scripts/config.py (623b), scripts/skill.py (567b), scripts/sleep_quality_analysis.py (7561b), skill-card.md (2690b), SKILL.md (9810b), 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 (146b)\n\nFile v1.0.8:SKILL.md\n\n---\nname: \"sleep-quality-analysis\"\ndescription: \"Identifies sleep stages including falling asleep, light sleep, deep sleep, and REM; monitors body movement, nighttime awakenings, and sleep apnea, suitable for sleep monitoring scenarios. | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景\"\nversion: \"1.0.7\"\nlicense: \"MIT-0\"\n---\n\n# 😴 Sleep Quality Analysis Skill | 睡眠质量分析技能\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **睡眠质量分析技能** |\n| 🎯 核心目标 | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SLEEP_QUALITY_ANALYSIS` |\n\nBased on advanced contactless vital sign monitoring technology and deep learning algorithms, this feature accurately\nidentifies and distinguishes four key sleep stages: sleep onset, light sleep (N1/N2), deep sleep (N3), and rapid eye\nmovement (REM). Utilizing high-sensitivity sensors or visual analysis techniques, the system captures subtle body\nmovements, nighttime awakenings, and respiratory rhythm changes in real-time, with a specific focus on intelligent\nscreening and early warning for high-risk abnormalities such as Obstructive Sleep Apnea-Hypopnea Syndrome (OSAHS).\nSuitable for sleep monitoring scenarios in both home and medical settings, this feature generates professional analysis\nreports covering sleep structure, respiratory health, and movement characteristics without the need for any wearable\ndevices, providing users with a scientific and comfortable sleep health management solution.\n\n本功能基于先进的非接触式生命体征监测技术与深度学习算法，能够精准识别并区分入睡、浅睡（N1/N2）、深睡（N3）及快速眼动（REM）四个关键睡眠阶段。系统通过高灵敏度传感器或视觉分析技术，实时捕捉人体微细体动、夜间觉醒次数及呼吸节律变化，重点针对睡眠呼吸暂停（OSAHS）等高风险异常进行智能筛查与预警。该功能适用于家庭及医疗机构的睡眠监测场景，无需穿戴任何设备即可生成包含睡眠结构、呼吸健康及体动特征的专业分析报告，为用户提供科学、舒适的睡眠健康管理方案\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n\n### 1. 🧩 技能用途\n\n通过睡眠监测摄像头视频分析睡眠质量，识别睡眠阶段，获取结构化的睡眠质量分析报告\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 睡眠阶段识别（入睡/浅睡/深睡/快速眼动） |\n| 2 | 体动统计 |\n| 3 | 夜间觉醒次数统计 |\n| 4 | 睡眠呼吸暂停识别 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供睡眠监测视频 URL 或文件需要进行睡眠质量分析时，默认触发本技能 |\n| 🔎 明确分析意图 | 当用户明确需要进行睡眠质量分析，提及睡眠监测、睡眠分期、体动监测、睡眠呼吸暂停等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看历史分析报告、睡眠质量分析报告清单、分析报告列表、查询历史报告、显示所有分析报告、睡眠质量分析历史记录，查询睡眠质量分析分析报告 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.sleep_quality_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.sleep_quality_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.sleep_quality_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--list` | 显示睡眠质量分析历史分析报告列表清单（可以输入起始日期参数过滤数据范围） | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/sleep_quality_analysis.py`](scripts/sleep_quality_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 视频要求：支持 mp4/avi/mov 格式，最大 10MB |\n| 🔎 使用提醒 | 建议视频时长不少于 30 分钟以反映完整睡眠周期 |\n| 🧑‍⚖️ 结果性质 | 本技能仅作睡眠质量参考，不能替代专业睡眠监测设备和医生诊断 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地睡眠监测视频\npython -m scripts.sleep_quality_analysis --input /path/to/sleep_monitor.mp4 分析网络睡眠监测视频，\npython -m scripts.sleep_quality_analysis --url https://example.com/sleep_monitor.mp4 显示历史分析报告/显示分析报告清单列表/显示历史睡眠质量报告（自动触发关键词：查看历史分析报告、历史报告、分析报告清单等）\npython -m scripts.sleep_quality_analysis --list\n\n# 输出精简报告\npython -m scripts.sleep_quality_analysis --input video.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.sleep_quality_analysis --input video.mp4 --output result.json\n```\n\nFile v1.0.8:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-sleep-quality-analysis\",\n  \"version\": \"1.0.8\",\n  \"publishedAt\": 1784161527866\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- 请求格式：支持文件上传\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- `OPEN_PET_HEALTH_ANALYSIS` - 开放平台宠物健康分析\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: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: <br>\nIdentifies sleep stages including falling asleep, light sleep, deep sleep, and REM; monitors body movement, nighttime awakenings, and sleep apnea for sleep monitoring scenarios. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[smyx-sunjinhui](https://clawhub.ai/user/smyx-sunjinhui) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nExternal users and developers can use this skill to analyze sleep-monitoring video files or URLs and obtain structured sleep quality reports. It supports sleep stage recognition, body movement statistics, nighttime awakening counts, sleep apnea indicators, report links, and cloud-backed historical report queries. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: Sensitive sleep-monitoring videos and report queries are sent to the publisher's cloud service. <br>\nMitigation: Use only media that is appropriate to share with the publisher service, avoid unnecessary personal or clinical content, and review the service destination before deployment. <br>\nRisk: The skill can silently create or reuse a persistent local or backend identity and token records. <br>\nMitigation: Review or clear the workspace data directory and stored account records when persistent identity association is not desired. <br>\nRisk: Sleep analysis output is health-related and may be incomplete or misleading if treated as a diagnosis. <br>\nMitigation: Present results as sleep-quality reference information and route medical decisions to qualified professionals or validated clinical workflows. <br>\n\n\n## Reference(s): <br>\n- [ClawHub Skill Page](https://clawhub.ai/smyx-sunjinhui/skills/smyx-sleep-quality-analysis) <br>\n- [Skill Demo](https://lifeemergence.com/sample.html) <br>\n- [API Documentation](references/api_doc.md) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [text, markdown, json, shell commands, guidance] <br>\n**Output Format:** [Markdown or JSON sleep analysis reports with report links and optional saved text output] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [Outputs may include structured sleep metrics, sleep-stage summaries, apnea indicators, historical report records, and cloud report export links.] <br>\n\n## Skill Version(s): <br>\n1.0.8 (source: server release metadata; artifact frontmatter is 1.0.7) <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.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: 30 files, 39815 bytes\n\nFiles: references/api_doc.md (666b), scripts/__init__.py (31b), scripts/config.py (623b), scripts/skill.py (567b), scripts/sleep_quality_analysis.py (7561b), skill-card.md (2412b), SKILL.md (9810b), 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 (146b)\n\nFile v1.0.7:SKILL.md\n\n---\nname: \"sleep-quality-analysis\"\ndescription: \"Identifies sleep stages including falling asleep, light sleep, deep sleep, and REM; monitors body movement, nighttime awakenings, and sleep apnea, suitable for sleep monitoring scenarios. | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景\"\nversion: \"1.0.5\"\nlicense: \"MIT-0\"\n---\n\n# 😴 Sleep Quality Analysis Skill | 睡眠质量分析技能\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **睡眠质量分析技能** |\n| 🎯 核心目标 | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SLEEP_QUALITY_ANALYSIS` |\n\nBased on advanced contactless vital sign monitoring technology and deep learning algorithms, this feature accurately\nidentifies and distinguishes four key sleep stages: sleep onset, light sleep (N1/N2), deep sleep (N3), and rapid eye\nmovement (REM). Utilizing high-sensitivity sensors or visual analysis techniques, the system captures subtle body\nmovements, nighttime awakenings, and respiratory rhythm changes in real-time, with a specific focus on intelligent\nscreening and early warning for high-risk abnormalities such as Obstructive Sleep Apnea-Hypopnea Syndrome (OSAHS).\nSuitable for sleep monitoring scenarios in both home and medical settings, this feature generates professional analysis\nreports covering sleep structure, respiratory health, and movement characteristics without the need for any wearable\ndevices, providing users with a scientific and comfortable sleep health management solution.\n\n本功能基于先进的非接触式生命体征监测技术与深度学习算法，能够精准识别并区分入睡、浅睡（N1/N2）、深睡（N3）及快速眼动（REM）四个关键睡眠阶段。系统通过高灵敏度传感器或视觉分析技术，实时捕捉人体微细体动、夜间觉醒次数及呼吸节律变化，重点针对睡眠呼吸暂停（OSAHS）等高风险异常进行智能筛查与预警。该功能适用于家庭及医疗机构的睡眠监测场景，无需穿戴任何设备即可生成包含睡眠结构、呼吸健康及体动特征的专业分析报告，为用户提供科学、舒适的睡眠健康管理方案\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n\n### 1. 🧩 技能用途\n\n通过睡眠监测摄像头视频分析睡眠质量，识别睡眠阶段，获取结构化的睡眠质量分析报告\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 睡眠阶段识别（入睡/浅睡/深睡/快速眼动） |\n| 2 | 体动统计 |\n| 3 | 夜间觉醒次数统计 |\n| 4 | 睡眠呼吸暂停识别 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供睡眠监测视频 URL 或文件需要进行睡眠质量分析时，默认触发本技能 |\n| 🔎 明确分析意图 | 当用户明确需要进行睡眠质量分析，提及睡眠监测、睡眠分期、体动监测、睡眠呼吸暂停等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看历史分析报告、睡眠质量分析报告清单、分析报告列表、查询历史报告、显示所有分析报告、睡眠质量分析历史记录，查询睡眠质量分析分析报告 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.sleep_quality_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.sleep_quality_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.sleep_quality_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--list` | 显示睡眠质量分析历史分析报告列表清单（可以输入起始日期参数过滤数据范围） | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/sleep_quality_analysis.py`](scripts/sleep_quality_analysis.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 🐍 必要脚本 | [`scripts/config.py`](scripts/config.py) | 调用 API、执行分析或查询历史报告 | 执行分析或查询时使用 |\n| 📘 领域参考 | [`references/api_doc.md`](references/api_doc.md) | 了解 API 接口规范、字段说明和错误码 | 仅在需要了解接口规范或错误码时读取 |\n\n## ⚠️ 注意事项 | Notes\n| 分类 | 注意事项 |\n|---|---|\n| 📚 文档读取 | 仅在需要时读取参考文档，保持上下文简洁 |\n| 📁 格式支持 | 视频要求：支持 mp4/avi/mov 格式，最大 10MB |\n| 🔎 使用提醒 | 建议视频时长不少于 30 分钟以反映完整睡眠周期 |\n| 🧑‍⚖️ 结果性质 | 本技能仅作睡眠质量参考，不能替代专业睡眠监测设备和医生诊断 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史分析报告清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地睡眠监测视频\npython -m scripts.sleep_quality_analysis --input /path/to/sleep_monitor.mp4 分析网络睡眠监测视频，\npython -m scripts.sleep_quality_analysis --url https://example.com/sleep_monitor.mp4 显示历史分析报告/显示分析报告清单列表/显示历史睡眠质量报告（自动触发关键词：查看历史分析报告、历史报告、分析报告清单等）\npython -m scripts.sleep_quality_analysis --list\n\n# 输出精简报告\npython -m scripts.sleep_quality_analysis --input video.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.sleep_quality_analysis --input video.mp4 --output result.json\n```\n\nFile v1.0.7:_meta.json\n\n{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-sleep-quality-analysis\",\n  \"version\": \"1.0.7\",\n  \"publishedAt\": 1783575567599\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- 请求格式：支持文件上传\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- `OPEN_PET_HEALTH_ANALYSIS` - 开放平台宠物健康分析\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: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>\nIdentifies sleep stages, body movement, nighttime awakenings, and possible sleep apnea from sleep-monitoring video or URL inputs. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[smyx-sunjinhui](https://clawhub.ai/user/smyx-sunjinhui) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nExternal users and developers use this skill to analyze sleep-monitoring videos, retrieve structured sleep quality reports, and query prior cloud-generated analysis reports. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: Sleep-monitoring videos or video URLs are sent to the publisher's cloud service. <br>\nMitigation: Use only content approved for third-party processing and avoid submitting sensitive or non-consented recordings. <br>\nRisk: Report history is tied to a persistent internal identity and returned access tokens can be stored locally. <br>\nMitigation: Run the skill in an isolated workspace when appropriate and review or clear the local workspace data directory after use. <br>\nRisk: Sleep quality and apnea findings are health-related outputs and may be incomplete or misleading. <br>\nMitigation: Treat results as reference information and have qualified medical professionals review decisions about diagnosis or care. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill page](https://clawhub.ai/smyx-sunjinhui/skills/smyx-sleep-quality-analysis) <br>\n- [Skill demo](https://lifeemergence.com/sample.html) <br>\n- [API documentation](references/api_doc.md) <br>\n- [Analysis API documentation](skills/smyx_analysis/references/api_doc.md) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [text, markdown, JSON, shell commands, guidance] <br>\n**Output Format:** [Markdown and JSON reports with report links and optional saved output files] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [Outputs depend on cloud API responses and can include historical report tables.] <br>\n\n## Skill Version(s): <br>\n1.0.7 (source: server release metadata; artifact frontmatter reports 1.0.5) <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","readmeExcerpt":"Skill: Sleep Quality Analysis Skill | 睡眠质量分析技能 Owner: smyx-sunjinhui Summary: Identifies sleep stages including falling asleep, light sleep, deep sleep, and REM; monitors body movement, nighttime awakenings, and sleep apnea, suitable for sleep monitoring scenarios. | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景 Tags: latest:1.0.16 Version history: v1.0.16 | 2026-10-04T06:42:30.087Z | auto - Version bumped fr","codeSnippets":[],"executableExamples":[{"language":"bash","snippet":"python -m scripts.sleep_quality_analysis --list"},{"language":"text","snippet":"requests>=2.28.0"},{"language":"bash","snippet":"# 分析本地睡眠监测视频\npython -m scripts.sleep_quality_analysis --input /path/to/sleep_monitor.mp4 分析网络睡眠监测视频，\npython -m scripts.sleep_quality_analysis --url https://example.com/sleep_monitor.mp4 显示历史分析报告/显示分析报告清单列表/显示历史睡眠质量报告（自动触发关键词：查看历史分析报告、历史报告、分析报告清单等）\npython -m scripts.sleep_quality_analysis --list\n\n# 输出精简报告\npython -m scripts.sleep_quality_analysis --input video.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.sleep_quality_analysis --input video.mp4 --output result.json"},{"language":"bash","snippet":"python -m scripts.sleep_quality_analysis --list"},{"language":"text","snippet":"requests>=2.28.0"},{"language":"bash","snippet":"# 分析本地睡眠监测视频\npython -m scripts.sleep_quality_analysis --input /path/to/sleep_monitor.mp4 分析网络睡眠监测视频，\npython -m scripts.sleep_quality_analysis --url https://example.com/sleep_monitor.mp4 显示历史分析报告/显示分析报告清单列表/显示历史睡眠质量报告（自动触发关键词：查看历史分析报告、历史报告、分析报告清单等）\npython -m scripts.sleep_quality_analysis --list\n\n# 输出精简报告\npython -m scripts.sleep_quality_analysis --input video.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.sleep_quality_analysis --input video.mp4 --output result.json"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: \"sleep-quality-analysis\"\ndescription: \"Identifies sleep stages including falling asleep, light sleep, deep sleep, and REM; monitors body movement, nighttime awakenings, and sleep apnea, suitable for sleep monitoring scenarios. | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景\"\nversion: \"1.0.17\"\nlicense: \"MIT-0\"\n---\n\n# 😴 Sleep Quality Analysis Skill | 睡眠质量分析技能\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **睡眠质量分析技能** |\n| 🎯 核心目标 | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SLEEP_QUALITY_ANALYSIS` |\n\nBased on advanced contactless vital sign monitoring technology and deep learning algorithms, this feature accurately\nidentifies and distinguishes four key sleep stages: sleep onset, light sleep (N1/N2), deep sleep (N3), and rapid eye\nmovement (REM). Utilizing high-sensitivity sensors or visual analysis techniques, the system captures subtle body\nmovements, nighttime awakenings, and respiratory rhythm changes in real-time, with a specific focus on intelligent\nscreening and early warning for high-risk abnormalities such as Obstructive Sleep Apnea-Hypopnea Syndrome (OSAHS).\nSuitable for sleep monitoring scenarios in both home and medical settings, this feature generates professional analysis\nreports covering sleep structure, respiratory health, and movement characteristics without the need for any wearable\ndevices, providing users with a scientific and comfortable sleep health management solution.\n\n本功能基于先进的非接触式生命体征监测技术与深度学习算法，能够精准识别并区分入睡、浅睡（N1/N2）、深睡（N3）及快速眼动（REM）四个关键睡眠阶段。系统通过高灵敏度传感器或视觉分析技术，实时捕捉人体微细体动、夜间觉醒次数及呼吸节律变化，重点针对睡眠呼吸暂停（OSAHS）等高风险异常进行智能筛查与预警。该功能适用于家庭及医疗机构的睡眠监测场景，无需穿戴任何设备即可生成包含睡眠结构、呼吸健康及体动特征的专业分析报告，为用户提供科学、舒适的睡眠健康管理方案\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n\n### 1. 🧩 技能用途\n\n通过睡眠监测摄像头视频分析睡眠质量，识别睡眠阶段，获取结构化的睡眠质量分析报告\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 睡眠阶段识别（入睡/浅睡/深睡/快速眼动） |\n| 2 | 体动统计 |\n| 3 | 夜间觉醒次数统计 |\n| 4 | 睡眠呼吸暂停识别 |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供睡眠监测视频 URL 或文件需要进行睡眠质量分析时，默认触发本技能 |\n| 🔎 明确分析意图 | 当用户明确需要进行睡眠质量分析，提及睡眠监测、睡眠分期、体动监测、睡眠呼吸暂停等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看历史分析报告、睡眠质量分析报告清单、分析报告列表、查询历史报告、显示所有分析报告、睡眠质量分析历史记录，查询睡眠质量分析分析报告 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.sleep_quality_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.sleep_quality_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requ"},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn7cyxkr2ymf7zwsrybpedg8xx83ywrj\",\n  \"slug\": \"smyx-sleep-quality-analysis\",\n  \"version\": \"1.0.16\",\n  \"publishedAt\": 1791096150087\n}"},{"path":"references/api_doc.md","content":"# API 接口文档\n\n此处用于存放宠物健康分析 API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\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- `OPEN_PET_HEALTH_ANALYSIS` - 开放平台宠物健康分析"},{"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":"skills/smyx_analysis/scripts/config.yaml","content":"{}"}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":"Identifies sleep stages including falling asleep, light sleep, deep sleep, and REM; monitors body movement, nighttime awakenings, and sleep apnea, suitable for sleep monitoring scenarios. | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景 Skill: Sleep Quality Analysis Skill | 睡眠质量分析技能 Owner: smyx-sunjinhui Summary: Identifies sleep stages including falling asleep, light sleep, deep sleep, and REM; monitors body movement, nighttime awakenings, and sleep apnea, suitable for sleep monitoring scenarios. | 睡眠质量分析技能，识别入睡、浅睡、深睡、快速眼动阶段，监测体动、夜间觉醒、睡眠呼吸暂停，适用于睡眠监测场景 Tags: latest:1.0.16 Version history: v1.0.16 | 2026-10-04T06:42:30.087Z | auto - Version bumped fr","editorialQuality":{"score":100,"threshold":65,"status":"ready","wordCount":863,"uniquenessScore":51,"reasons":[]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-09T15:07:45.586Z","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-09T15:07:45.586Z","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-10T00:45:14.886Z","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"}]}}}