{"id":"211a3a30-f7df-4736-985d-d70e14555164","entityType":"agent","slug":"clawhub-18072937735-smyx-fish-gasping-ammonia-warning-analysis","name":"Fish Gasping & Ammonia Poisoning Visual Warning | 水族箱内氨氮中毒视觉预兆（鱼浮头）","canonicalUrl":"https://www.xpersona.co/agent/clawhub-18072937735-smyx-fish-gasping-ammonia-warning-analysis","canonicalPath":"/agent/clawhub-18072937735-smyx-fish-gasping-ammonia-warning-analysis","generatedAt":"2026-10-10T07:29:15.732Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-09T20:57:17.569Z","emptyReason":null},"description":"Through fixed aquarium cameras, the system analyzes fish behavior near the water surface, detecting repeated mouth-out-of-water (gasping), rapid mouth opening/closing (fast respiration) and exaggerated operculum (gill cover) movement — classic symptoms of hypoxia or poisoning. | 通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。","descriptionLabel":"Source description","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 2K downloads reported by the source. Last updated 10/9/2026.","installCommand":"clawhub skill install s17f8q65zg3y98t86jdg1177g583whq8:smyx-fish-gasping-ammonia-warning-analysis","sourceUrl":"https://clawhub.ai/18072937735/smyx-fish-gasping-ammonia-warning-analysis","homepage":"https://clawhub.ai/18072937735/skills/smyx-fish-gasping-ammonia-warning-analysis","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/18072937735/smyx-fish-gasping-ammonia-warning-analysis","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/18072937735/skills/smyx-fish-gasping-ammonia-warning-analysis","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":66,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"Fish Gasping & Ammonia Poisoning Visual Warning | 水族箱内氨氮中毒视觉预兆（鱼浮头） technical dossier on Xpersona with agent coverage, OPENCLEW support, and live trust metadata"},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-09T20:57:17.569Z","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-09T20:57:17.569Z","emptyReason":null},"stars":null,"forks":null,"downloads":2003,"packageName":null,"latestVersion":"1.0.15","tractionLabel":"2K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-09T20:57:17.568Z","emptyReason":null},"lastUpdatedAt":"2026-10-09T20:57:17.569Z","lastCrawledAt":"2026-10-09T20:57:17.568Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-10T20:57:17.568Z","lastVerifiedAt":null,"highlights":[{"version":"1.0.15","createdAt":"2026-09-27T16:28:28.034Z","changelog":"- Version updated to 1.0.15. - SKILL.md updated with new version and other minor content changes. - Configuration updated in skills/smyx_common/scripts/config.yaml. - Obsolete file skill-card.md removed.","fileCount":31,"zipByteSize":44910},{"version":"1.0.14","createdAt":"2026-09-08T12:33:01.797Z","changelog":"- Updated documentation version from 1.0.11 to 1.0.13. - Removed the file skill-card.md from the project. - No changes to logic or features; this is a documentation and housekeeping update.","fileCount":31,"zipByteSize":45215},{"version":"1.0.13","createdAt":"2026-08-27T00:37:41.267Z","changelog":"- Removed the file: skill-card.md. - No functional changes to the skill logic or documentation were made.","fileCount":31,"zipByteSize":45363},{"version":"1.0.12","createdAt":"2026-08-18T06:07:27.925Z","changelog":"- Updated the skill version from 1.0.10 to 1.0.11 in documentation. - Removed the file: skill-card.md. - No functional or API changes; all changes are documentation/metadata updates only.","fileCount":31,"zipByteSize":45291},{"version":"1.0.11","createdAt":"2026-08-14T18:39:37.238Z","changelog":"- Updated version in SKILL.md from 1.0.9 to 1.0.10. - Made minor text or metadata edits in SKILL.md. - Removed the file skill-card.md. - No functional or API-affecting changes indicated.","fileCount":31,"zipByteSize":45465},{"version":"1.0.10","createdAt":"2026-08-04T08:13:35.757Z","changelog":"- Updated version number in documentation from 1.0.8 to 1.0.9. - Removed the file skill-card.md from the project. - No changes to core skill capabilities or workflow described in documentation.","fileCount":31,"zipByteSize":45235},{"version":"1.0.9","createdAt":"2026-07-29T10:33:29.542Z","changelog":"- Updated version number from 1.0.6 to 1.0.8 in SKILL.md. - Removed the file skill-card.md from the project. - No changes to core logic or features are described; documentation version and resource list updated only.","fileCount":31,"zipByteSize":45188},{"version":"1.0.8","createdAt":"2026-07-18T08:43:27.525Z","changelog":"smyx-fish-gasping-ammonia-warning-analysis v1.0.8 - Updated version info in SKILL.md. - Documentation changes: SKILL.md updated with new details; removed obsolete skill-card.md. - Minor internal script adjustments in util.py. - Clean-up and removal of redundant documentation files.","fileCount":31,"zipByteSize":45166}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s17f8q65zg3y98t86jdg1177g583whq8:smyx-fish-gasping-ammonia-warning-analysis","setupComplexity":"low","setupSteps":["Install using `clawhub skill install s17f8q65zg3y98t86jdg1177g583whq8:smyx-fish-gasping-ammonia-warning-analysis` in an isolated environment before connecting it to live workloads.","No published capability contract is available yet, so validate auth and request/response behavior manually.","Review the upstream CLAWHUB listing at https://clawhub.ai/18072937735/smyx-fish-gasping-ammonia-warning-analysis before using production credentials."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-18072937735-smyx-fish-gasping-ammonia-warning-analysis/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-18072937735-smyx-fish-gasping-ammonia-warning-analysis/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-18072937735-smyx-fish-gasping-ammonia-warning-analysis/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-18072937735-smyx-fish-gasping-ammonia-warning-analysis/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-18072937735-smyx-fish-gasping-ammonia-warning-analysis/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-18072937735-smyx-fish-gasping-ammonia-warning-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-10T07:29:15.727Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-18072937735-smyx-fish-gasping-ammonia-warning-analysis/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-18072937735-smyx-fish-gasping-ammonia-warning-analysis/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-18072937735-smyx-fish-gasping-ammonia-warning-analysis/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-18072937735-smyx-fish-gasping-ammonia-warning-analysis/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-09T20:57:17.569Z","emptyReason":null},"readme":"Skill: Fish Gasping & Ammonia Poisoning Visual Warning | 水族箱内氨氮中毒视觉预兆（鱼浮头）\n\nOwner: 18072937735\n\nSummary: Through fixed aquarium cameras, the system analyzes fish behavior near the water surface, detecting repeated mouth-out-of-water (gasping), rapid mouth opening/closing (fast respiration) and exaggerated operculum (gill cover) movement — classic symptoms of hypoxia or poisoning. | 通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。\n\nTags: latest:1.0.15\n\nVersion history:\n\nv1.0.15 | 2026-09-27T16:28:28.034Z | auto\n\n- Version updated to 1.0.15.\n- SKILL.md updated with new version and other minor content changes.\n- Configuration updated in skills/smyx_common/scripts/config.yaml.\n- Obsolete file skill-card.md removed.\n\nv1.0.14 | 2026-09-08T12:33:01.797Z | auto\n\n- Updated documentation version from 1.0.11 to 1.0.13.\n- Removed the file skill-card.md from the project.\n- No changes to logic or features; this is a documentation and housekeeping update.\n\nv1.0.13 | 2026-08-27T00:37:41.267Z | auto\n\n- Removed the file: skill-card.md.\n- No functional changes to the skill logic or documentation were made.\n\nv1.0.12 | 2026-08-18T06:07:27.925Z | auto\n\n- Updated the skill version from 1.0.10 to 1.0.11 in documentation.\n- Removed the file: skill-card.md.\n- No functional or API changes; all changes are documentation/metadata updates only.\n\nv1.0.11 | 2026-08-14T18:39:37.238Z | auto\n\n- Updated version in SKILL.md from 1.0.9 to 1.0.10.\n- Made minor text or metadata edits in SKILL.md.\n- Removed the file skill-card.md.\n- No functional or API-affecting changes indicated.\n\nv1.0.10 | 2026-08-04T08:13:35.757Z | auto\n\n- Updated version number in documentation from 1.0.8 to 1.0.9.\n- Removed the file skill-card.md from the project.\n- No changes to core skill capabilities or workflow described in documentation.\n\nv1.0.9 | 2026-07-29T10:33:29.542Z | auto\n\n- Updated version number from 1.0.6 to 1.0.8 in SKILL.md.\n- Removed the file skill-card.md from the project.\n- No changes to core logic or features are described; documentation version and resource list updated only.\n\nv1.0.8 | 2026-07-18T08:43:27.525Z | auto\n\nsmyx-fish-gasping-ammonia-warning-analysis v1.0.8\n\n- Updated version info in SKILL.md.\n- Documentation changes: SKILL.md updated with new details; removed obsolete skill-card.md.\n- Minor internal script adjustments in util.py.\n- Clean-up and removal of redundant documentation files.\n\nv1.0.7 | 2026-07-09T13:47:28.740Z | auto\n\nNo changes detected; version bumped only.\n\n- No file or documentation changes in this release.\n- Functionality and usage remain unchanged.\n- Safe to upgrade without impacting existing workflows.\n\nv1.0.6 | 2026-07-03T14:44:26.404Z | auto\n\n- Updated internal scripts: config.py, dao.py, and util.py with maintenance or improvements.\n- Removed obsolete documentation file: skill-card.md.\n- SKILL.md: Minor version update; content and API usage recommendations unchanged.\n- General codebase cleanup and minor documentation adjustments.\n\nv1.0.5 | 2026-06-25T09:44:33.313Z | auto\n\n**Changelog for smyx-fish-gasping-ammonia-warning-analysis v1.0.5**\n\n- Major refactor of user identity handling: all open-id/user identity logic is now fully automated and hidden from users; users are never asked or required to provide any identity parameter.\n- History report queries are strictly enforced to use only the cloud API; all manual, local memory, or long-term memory report aggregation is prohibited.\n- Documentation (SKILL.md) restructured and simplified, featuring clearer workflow, operation parameters, usage notes, and resource index.\n- Script interface streamlined; identity handling now occurs internally, while report outputs and queries follow a consistent, user-focused pattern.\n- Internal scripts and references reorganized; redundant files (e.g., manual API service scripts and cards) removed for clarity and maintainability.\n\nv1.0.4 | 2026-06-15T10:00:51.567Z | auto\n\nsmyx-fish-gasping-ammonia-warning-analysis v1.0.4\n\n- Removed obsolete documentation file skill-card.md.\n- Updated utility script skills/smyx_common/scripts/util.py.\n- No changes to core logic or user-facing features.\n\nv1.0.3 | 2026-06-15T07:29:16.901Z | auto\n\nsmyx-fish-gasping-ammonia-warning-analysis v1.0.3\n\n- No functional or file changes detected for this version.\n- All features, workflows, and documentation remain consistent with the previous version.\n\nv1.0.2 | 2026-06-15T07:28:39.469Z | auto\n\nNo changes detected in this version.\n\n- Version number updated, but no file or documentation changes were found compared to the previous release.\n\nv1.0.1 | 2026-06-15T07:27:31.683Z | auto\n\nVersion 1.0.1\n\n- Added explicit license (\"MIT-0\") to the skill metadata.\n- Updated SKILL.md: added detailed instructions for open-id acquisition and first-time server check-in, with stricter rules for API calling.\n- Clarified and expanded user guidance around open-id handling, including when to prompt, how to validate, and constraints for API use.\n- Expanded and improved documentation structure and clarity, with step-by-step operations and key constraints.\n- Removed the redundant skill-card.md file.\n\nv1.0.0 | 2026-05-28T07:09:13.946Z | auto\n\nInitial release: AI-based real-time detection of fish gasping and abnormal respiration via aquarium cameras, providing early ammonia poisoning or hypoxia warnings.\n\n- Monitors fish behavior for signs of hypoxia or poisoning (surface gasping, rapid mouth movement, exaggerated gill cover motion).\n- Issues risk warnings when multiple fish show symptoms for over 60 seconds (configurable).\n- Supports home aquariums, public displays, and aquaculture ponds with real-time alerts and 4 warning levels.\n- Includes robust fish species adaptation and contextual analysis to minimize false positives.\n- Enforces strict privacy and data acquisition protocols for report retrieval via open-id authentication.\n- Comprehensive integration guide for use with smart aquarium systems.\n\nArchive index:\n\nArchive v1.0.15: 31 files, 44910 bytes\n\nFiles: references/api_doc.md (7619b), scripts/__init__.py (66b), scripts/config.py (708b), scripts/config.yaml (3b), scripts/skill.py (600b), scripts/smyx_fish_gasping_ammonia_warning_analysis.py (3764b), skill-card.md (1995b), SKILL.md (18165b), 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 (162b)\n\nFile v1.0.15:SKILL.md\n\n---\nname: \"smyx-fish-gasping-ammonia-warning-analysis\"\ndescription: \"Through fixed aquarium cameras, the system analyzes fish behavior near the water surface, detecting repeated mouth-out-of-water (gasping), rapid mouth opening/closing (fast respiration) and exaggerated operculum (gill cover) movement — classic symptoms of hypoxia or poisoning. | 通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。\"\nversion: \"1.0.15\"\nlicense: \"MIT-0\"\n---\n\n# ⚠️ Fish Gasping & Ammonia Poisoning Visual Warning | 水族箱内氨氮中毒视觉预兆（鱼浮头）\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **水族箱内氨氮中毒视觉预兆（鱼浮头）** |\n| 🎯 核心目标 | 通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_FISH_GASPING_AMMONIA_WARNING_ANALYSIS` |\n\nThrough fixed aquarium cameras, the system analyzes fish behavior near the water surface, detecting repeated mouth-out-of-water (gasping), rapid mouth opening/closing (fast respiration) and exaggerated operculum (gill cover) movement — classic symptoms of hypoxia or poisoning. When multiple fish exhibit the above behavior simultaneously and the duration exceeds a configurable threshold (default 60 seconds), the system outputs an 'ammonia poisoning or hypoxia risk warning', prompting the user to immediately test water quality, perform water change, or increase aeration. This skill helps take emergency action BEFORE fish die. Application scenarios: home aquariums, public aquariums, aquaculture ponds. The system monitors in real time and pushes alerts the moment fish gasping is detected. Skill features: ammonia poisoning is a common acute emergency in aquariums — by the time it is noticed, fish deaths may have already occurred. AI-based automatic recognition of gasping and abnormal respiration provides emergency warning at the earliest stage, buying time to handle the situation and reduce losses. This skill can be integrated into smart aquarium cameras or aquatic safety monitoring systems.\n\n通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。该技能有助于在鱼只死亡前采取紧急措施。应用场景：家庭鱼缸、水族馆、养殖池。系统实时监测，一旦发现鱼浮头立即推送警报。技能特点：氨氮中毒是鱼缸常见急症，往往在检测到前已造成鱼只死亡。通过 AI 自动识别鱼浮头和异常呼吸，可在事发初期紧急提醒，为处理争取时间，减少损失。该技能可集成到智能鱼缸摄像头或水族安防系统中。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的水族水质安全 AI。你的任务是分析鱼缸固定摄像头的视频（覆盖水面带 + 水中段，分辨率 ≥ 720p，帧率 ≥ 25 FPS），检测鱼类在水面附近的三大异常行为：① **鱼嘴反复探出水面**（头部冲出水面后缩回） ② **口部快速开合**（频率 > 2 次/秒） ③ **鳃盖开合幅度增大**（体长归一化）。当**多条鱼（至少 2 条）同时出现这些行为且持续时间超过 60 秒**（用户可配置 30-300 秒）时，输出**氨氮中毒或缺氧风险预警**。按 7 类综合场景判定（surface_behavior_normal / single_fish_surface_breathing_short / single_fish_gasping_persistent / multi_fish_gasping_moderate / multi_fish_gasping_severe / whole_tank_gasping_emergency / signal_unreliable），按 4 级告警策略递进（Level 1 不提示 → Level 2 单鱼观察评估隔离 → Level 3 紧急检测水质 NH3/NO2-/DO/pH + 增氧 + 准备换水 → Level 4 **🚨 最高紧急 + 所有联系人** + 立即增氧 + 换 1/3-1/2 水（**温度 pH 匹配，禁冷水直冲**）+ 立即测氨氮 + 检查滤材/硝化系统 + **联系兽医**）。鱼种特异性必须按基线判定：**气呼吸鱼种**（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼）天然偶尔到水面换气、**水面摄食型**（孔雀鱼 / 鳉鱼科）天然偏好水面 → **严禁通用阈值盲判气呼吸鱼种为浮头**。必须考虑生理性上下文（投喂窗口聚拢水面抢食 / 强水流 / 水温过高 / 鱼苗自然集群水面），避免误报。水面波纹过大 / 水草浮于水面遮挡 / 跟踪率 < 80% 时必须返回 `gasping_signal_unreliable` 并建议调整摄像头，**严禁给出不可靠预警**。**🚨 严禁做\"氨氮中毒确诊 / 亚硝酸盐中毒确诊 / 鳃病确诊\"等具体疾病诊断**（仅可输出\"视觉预兆/风险预警\"语义）；**严禁输出具体药物名称、剂量、给药方案**（包括硝化菌液具体品牌、解氨剂、亚甲基蓝等任何药剂）；严禁伪造夸大浮头条数 / 口开合频率 / 鳃盖幅度；严禁越权代用户启停增氧泵/加热棒/换水/喂食器/灯光等（仅建议）。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于鱼缸固定摄像头 / 水族馆侧面观察摄像头 / 养殖池水面摄像头**实时视频**（默认 60 秒滚动窗口，用户可配置 30-300 秒），识别 7 类综合场景（surface_behavior_normal / single_fish_surface_breathing_short / single_fish_gasping_persistent / multi_fish_gasping_moderate / multi_fish_gasping_severe / whole_tank_gasping_emergency / gasping_signal_unreliable）→ **四组指标**：浮头行为 4 项（水面带鱼数 / 嘴穿出水面鱼数 / 浮头比例 / 每分钟浮头事件数）+ 呼吸异常 4 项（口开合 Hz / 口张幅度 / 鳃盖幅度 / 鳃盖呼吸 BPM）+ 群体异常 4 项（注册总鱼数 / 同时浮头鱼数 / 持续时长秒 / 氧气泵是否运行）+ 排除上下文 5 项（气呼吸鱼种 / 投喂期 / 水面摄食鱼种 / 水面扰动 / 水草浮面）→ 4 档告警级别（none → important → urgent → critical）→ **4 级告警策略递进**（不提示 → 单鱼观察评估隔离 → 紧急测水质+增氧+准备换水 → 🚨 最高紧急+所有联系人+立即换水（温度 pH 匹配）+测氨氮+检查滤材+联系兽医）→ 单日告警上限（Level 1 不限 / Level 2 × 4 / Level 3 × 6 / Level 4 **不设上限**）→ **预警报告**（按 tank_id 输出，含浮头鱼条数/持续时长/口开合频率/鳃盖幅度 + 建议动作 + 免责声明）\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 鱼缸水面带分割 |\n| 2 | 鱼体目标检测 + 多目标跟踪 |\n| 3 | **水面穿透事件检测**（鱼头穿出水面/缩回的关键事件帧） |\n| 4 | 口部关键点检测 + 开合频率估计（FFT/峰值法） |\n| 5 | 鳃盖开合幅度估计（体长归一化） |\n| 6 | 多鱼并发计数与持续时长累计（跨帧累积） |\n| 7 | 鱼种自适应基线（气呼吸 / 水面摄食 / 中下层 / 底栖） |\n| 8 | 生理性上下文识别（投喂期 / 水流 / 水温 / 鱼苗） |\n| 9 | 波纹/水草遮挡门控（跟踪率 < 80% 返回 unreliable） |\n| 10 | 用户 APP 紧急推送 |\n| 11 | 4 级告警递进 |\n| 12 | 单日告警上限（**Level 4 不设上限**） |\n| 13 | 预警报告（按 tank_id + 事件时间戳输出） |\n| 14 | 连续 ≥ 2 次 Level 3+ → 强烈建议联系**当地观赏鱼兽医或水产技术员** |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供鱼缸固定摄像头视频 URL 或文件需要分析时，默认触发本技能进行水族箱氨氮中毒视觉预兆识别 |\n| 🔎 明确分析意图 | 当用户明确提及鱼浮头、鱼喘气、鱼集体上水面、鱼缸氨氮、鱼缸缺氧、亚硝酸盐爆表、鱼鳃异常呼吸、硝化系统崩溃等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看鱼缸浮头历史报告、氨氮预警日志清单、缺氧事件清单、查询历史鱼缸预警记录、显示所有水族安防预警报告 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_fish_gasping_ammonia_warning_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备鱼缸固定摄像头视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 获取 open-id（强制执行） | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行水族箱氨氮中毒视觉预兆识别 | 调用 `-m scripts.smyx_fish_gasping_ammonia_warning_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地鱼缸固定摄像头视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络鱼缸固定摄像头视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，水族箱氨氮中毒视觉预兆场景默认 `other` | 按需填写 |\n| `--list` | 显示水族箱氨氮中毒视觉预兆历史记录清单 | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_fish_gasping_ammonia_warning_analysis.py`](scripts/smyx_fish_gasping_ammonia_warning_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；摄像头需**同时覆盖水面带和水中段**；**帧率 ≥ 25 FPS**；默认 60s 滚动窗口 |\n| 🔎 使用提醒 | **核心采样窗口**：60 秒滚动窗口（用户可配置 30-300 秒） |\n| 🔎 使用提醒 | **核心预警门槛**：**多鱼（≥ 2 条）同时浮头持续 ≥ 60 秒** 触发 Level 3+ 告警 |\n| 🔎 使用提醒 | **4 级告警策略递进**（none → important → urgent → critical），多鱼/全缸/持续超长进入更高级别 |\n| 🔎 使用提醒 | 单日告警上限：Level 1 不限 / Level 2 × 4 / Level 3 × 6 / Level 4 **不设上限**（生命安全优先） |\n| 🔎 使用提醒 | 红线约束 |\n| 🧑‍⚖️ 结果性质 | **🚨 禁止**做\"氨氮中毒确诊 / 亚硝酸盐中毒确诊 / 鳃病确诊 / 寄生虫确诊\"等具体疾病诊断（仅可输出\"视觉预兆/风险预警\"语义） |\n| 🔎 使用提醒 | **🚨 绝对禁止**输出具体药物名称、剂量、给药方案（特别**严禁推荐硝化菌液具体品牌、解氨剂、亚甲基蓝等任何药剂**） |\n| 🔎 使用提醒 | **禁止**长期存储完整鱼缸视频（≤ 7 天，仅入库浮头事件片段；公共水族馆/养殖场按管理规定） |\n| 🔎 使用提醒 | **禁止**用于商业广告 / AI 训练；禁第三方共享 |\n| 🔎 使用提醒 | **禁止**越权代用户启停增氧泵 / 加热棒 / 换水 / 投药 / 灯光参数；**任何水族设备控制变更必须由用户确认**（仅可建议） |\n| 🔎 使用提醒 | **绝对禁止**伪造或夸大浮头条数、口开合频率、鳃盖幅度、持续时长等指标；所有数据必须基于真实视频帧分析 |\n| 🔎 使用提醒 | **必须**按**鱼种基线**判定：**气呼吸鱼种（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼）天然偶尔到水面换气** + **水面摄食型（孔雀鱼 / 鳉鱼科）天然偏好水面** → 严禁通用阈值盲判 |\n| 📚 文档读取 | **必须**考虑生理性上下文（投喂窗口聚拢水面抢食 / 强水流冲到水面 / 水温过高 / 鱼苗自然集群水面），避免误报 |\n| 🔎 使用提醒 | **必须**在水面波纹过大 / 水草浮于水面遮挡 / 跟踪率 < 80% 时返回 `gasping_signal_unreliable` 并建议调整摄像头/清理遮挡，**禁止给出不可靠的预警** |\n| 🔎 使用提醒 | **必须**在 Level 4 紧急换水建议中明确：**温度 pH 匹配，禁冷水直冲** |\n| 🔎 使用提醒 | **必须**：连续 ≥ 2 次 Level 3+ → 强烈建议联系**当地观赏鱼兽医或水产技术员** |\n| 📜 报告输出 | **必须**：预警报告**按 tank_id + 事件时间戳输出**，含浮头鱼条数 + 持续时长 + 口开合频率 + 鳃盖幅度 + 建议动作 + 免责声明 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史浮头预警记录清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地鱼缸固定摄像头视频（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input /path/to/tank.mp4\n\n# 分析网络鱼缸固定摄像头视频/实时流（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --url https://example.com/tank.mp4\n\n# 显示历史浮头预警记录清单（自动触发关键词：查看鱼缸浮头历史报告、氨氮预警日志清单等）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input tank.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input tank.mp4 --output result.json\n```\n\nFile v1.0.15:_meta.json\n\n{\n  \"ownerId\": \"kn7e2caqj7pnsvr9r7t8zenghs83xw7n\",\n  \"slug\": \"smyx-fish-gasping-ammonia-warning-analysis\",\n  \"version\": \"1.0.15\",\n  \"publishedAt\": 1790526508034\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- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动鱼浮头/缺氧/氨氮中毒视觉预兆识别任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取预警结果（浮头条数、口开合频率、鳃盖幅度、持续时长）\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史预警报告\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出预警报告\n5. （可选）`/web/companion/v2/trigger-soothing-action` - 触发联动告警（用户 APP 紧急推送 / 智能鱼缸警报灯 / 建议立即增氧/换水/检测氨氮）\n\n## 场景代码\n\n- `SMYX_FISH_GASPING_AMMONIA_WARNING_ANALYSIS` - 水族箱内氨氮中毒视觉预兆（鱼浮头）\n\n## 输入约束\n\n- 摄像头：鱼缸固定摄像头 / 水族馆侧面观察摄像头 / 养殖池水面摄像头，**必须同时覆盖水面带和水中段**（鱼浮头是水面行为）\n- 分辨率 ≥ 720p；**帧率 ≥ 25 FPS**（口部开合频率检测需 ≥ 2 Hz）\n- 光照：建议鱼缸照明常开 + 无强反光；**水面波纹大可能误判，必须做光流稳定**\n- **核心采样窗口**：默认 60 秒滚动窗口（用户可配置 30 - 300 秒）\n- 视野约束：必须覆盖**水面完整投影**（任何水面盲区都可能漏判浮头）\n- 多鱼缸/池场景按摄像头 ID 绑定到注册容器 ID\n- **部署时必须录入**：鱼种、缸内总鱼数 N、鱼缸尺寸、是否开启氧气泵/过滤器（用于上下文加权）\n- 用户必须授权部署；公共水族馆 / 养殖场需公示告知\n\n## 关键观测信号\n\n### 浮头行为信号（核心）\n- `fish_at_surface_count` - 当前帧水面带（水面下 0-1 个体长）内的鱼数\n- `fish_breaking_surface_count` - **检测到鱼嘴穿出水面**的鱼数（核心强信号）\n- `fish_breaking_surface_ratio` - 浮头鱼数占总鱼数比例\n- `surface_breaking_events_per_minute` - 每分钟浮头事件数（同条鱼反复探出累计）\n\n### 呼吸异常信号\n- `mouth_opening_frequency_hz` - **口部开合频率（Hz / 次/秒）**（异常阈值 > 2 Hz）\n- `mouth_opening_amplitude_normalized` - 口张开幅度（体长归一化）\n- `operculum_gill_beat_amplitude_normalized` - **鳃盖开合幅度**（体长归一化，异常增大）\n- `operculum_gill_beat_rate_bpm` - 鳃盖呼吸频率（次/分钟，可与 respiratory_rate 技能交叉验证）\n\n### 群体异常信号\n- `total_fish_count_baseline` - 注册总鱼数\n- `multi_fish_gasping_count` - **同时出现浮头/喘气的鱼数**（≥ 2 条为预警门槛）\n- `multi_fish_gasping_duration_seconds` - 多鱼同时异常持续时长（≥ 60s 为核心预警阈值）\n- `tank_oxygen_pump_running` - 氧气泵是否运行（如运行仍多鱼浮头，氨氮中毒怀疑度更高）\n\n### 上下文与排除信号（避免误报）\n- `is_air_breathing_species` - **是否能用气呼吸鱼种**（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼天然偶尔到水面换气）\n- `is_during_feeding` - 是否在投喂窗口内（生理性聚拢水面抢食非浮头）\n- `is_surface_feeding_species` - 是否水面摄食型（孔雀鱼 / 鳉鱼科偏好水面）\n- `water_surface_disturbance_level` - 水面扰动程度（强水流可能误判）\n- `aquatic_plant_floating_at_surface` - 是否水草浮于水面（遮挡可能漏检）\n\n## 综合判定\n\n- `surface_behavior_normal` - 水面行为正常\n- `single_fish_surface_breathing_short` - 单条鱼短暂到水面换气（气呼吸鱼种正常 / 投喂期）\n- `single_fish_gasping_persistent` - 单条鱼持续浮头喘气（疑似该个体不适，非全缸问题）\n- `multi_fish_gasping_moderate` - **多鱼同时浮头（≥ 2 条，持续 30-60s）**：早期预警\n- `multi_fish_gasping_severe` - **多鱼同时浮头（≥ 2 条，持续 ≥ 60s）**：氨氮中毒/缺氧风险预警（核心）\n- `whole_tank_gasping_emergency` - **全缸鱼同时浮头（≥ 80%，持续 ≥ 30s）**：紧急中毒事件\n- `gasping_signal_unreliable` - 信号不可靠（水面波纹过大 / 水草遮挡 / 跟踪率 < 80%）\n\n## 4 级告警策略递进\n\n- Level 1（surface_behavior_normal / single_fish_surface_breathing_short）：仅入库或不提示\n- Level 2（single_fish_gasping_persistent）：用户 APP 重要提示，建议**单独观察该鱼，评估是否隔离至检疫缸**\n- Level 3（multi_fish_gasping_moderate）：紧急告警，建议**立即检测水质（氨氮 NH3/NH4+、亚硝酸盐 NO2-、pH、溶氧 DO、温度）+ 立即开启/加强增氧 + 准备换水**\n- Level 4（multi_fish_gasping_severe / whole_tank_gasping_emergency）：**🚨 最高紧急告警 + 推送家庭/管理人员所有联系人** + 强烈建议**立即采取多措并举**：① 立即开足增氧泵/加气盘 ② 立即换 1/3~1/2 水（**温度 pH 匹配，禁止冷水直冲**） ③ 立即检测氨氮 NH3/亚硝酸盐 NO2- ④ 检查滤材是否堵塞/硝化系统是否崩溃 ⑤ **联系当地观赏鱼兽医或水产技术员**\n\n## 单日告警上限\n\n- Level 1 不限 / Level 2 × 4 / Level 3 × 6（紧急事件可能密集）/ Level 4 **不设上限**（生命安全优先）\n\n## 红线约束\n\n- **🚨 禁止**做\"氨氮中毒确诊 / 亚硝酸盐中毒确诊 / 鳃病确诊 / 寄生虫确诊\"等**具体疾病诊断**（仅可输出\"视觉预兆/风险预警\"语义）\n- **🚨 绝对禁止**输出具体药物名称、剂量、给药方案（**严禁推荐硝化菌液具体品牌、解氨剂、亚甲基蓝等任何药剂**）\n- **禁止**长期存储完整鱼缸视频（≤ 7 天，仅入库浮头事件片段；公共水族馆/养殖场按管理规定）\n- **禁止**用于商业广告 / AI 训练；禁第三方共享\n- **禁止**越权代用户启停增氧泵 / 加热棒 / 换水 / 投药 / 灯光参数；**任何水族设备控制变更必须由用户确认**（仅可建议）\n- 浮头条数、口开合频率、鳃盖幅度等指标必须基于真实视频帧分析；**禁止伪造或夸大指标**\n- 鱼种特异性：**气呼吸鱼种**（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼）天然偶尔到水面换气、**水面摄食鱼**（孔雀鱼 / 鳉鱼科）天然偏好水面 → 必须按鱼种基线判定；**严禁通用阈值盲判气呼吸鱼种为浮头**\n- 必须考虑生理性上下文：**投喂窗口聚拢水面抢食 / 强水流冲到水面带 / 水温过高暂时到水面 / 鱼苗自然集群于水面** → 不可直接告警\n- 水面波纹过大 / 水草浮于水面遮挡 / 跟踪率 < 80% → 必须返回 `gasping_signal_unreliable` 并建议调整摄像头/清理水面遮挡\n- 必须告知用户：AI 视觉识别仅供参考，**最终诊断与处理需用户立即检测水质并由专业兽医/水产技术员确认**\n\n## 输出报告字段\n\n- `report_date` - 报告日期\n- `tank_id` - 鱼缸/养殖池 ID\n- `species` - 鱼种\n- `total_fish_count_baseline` - 注册总鱼数\n- `multi_fish_gasping_count` - 同时浮头鱼数\n- `multi_fish_gasping_duration_seconds` - 多鱼同时异常持续时长\n- `mouth_opening_frequency_hz` - 口开合频率\n- `operculum_gill_beat_amplitude_normalized` - 鳃盖幅度\n- `composite_scene` - 综合判定\n- `alert_level` - 告警等级\n- `recommended_actions` - 建议动作（**测水质 NH3/NO2-/DO/pH + 增氧 + 换水 + 检查滤材 + 联系兽医**，绝不含具体药物）\n- `disclaimer` - 免责声明\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:scripts/config.yaml\n\n{}\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\nAnalyzes aquarium footage for fish gasping and unusual breathing near the surface, then reports visual warnings of possible low oxygen or ammonia exposure.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[18072937735](https://clawhub.ai/user/18072937735)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nAquarium keepers and monitoring teams use this skill to review camera footage for signs of fish distress, receive risk warnings and suggested checks, and consult past cloud reports.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Aquarium video or video URLs are sent to the LifeEmergence cloud service.\n\nMitigation: Obtain consent before uploading footage or sharing video URLs with the cloud service.\n\nRisk: The skill silently creates or reuses an internal identity and may retain tokens in workspace data.\n\nMitigation: Review where workspace data and identity tokens are stored and how long they are retained before installation.\n\nRisk: History requests can access cloud reports without explicit confirmation.\n\nMitigation: Require user confirmation before retrieving report history.\n\n## Reference(s):\n\n- [ClawHub skill listing](https://clawhub.ai/18072937735/skills/smyx-fish-gasping-ammonia-warning-analysis)\n- [Aquarium analysis API reference](references/api_doc.md)\n\n## Skill Output:\n\n**Output Type(s):** [Text, Markdown, Guidance]\n\n**Output Format:** [Structured analysis report or Markdown history table]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Includes risk warnings, suggested follow-up actions, and report links when available.]\n\n## Skill Version(s):\n\n1.0.15 (source: frontmatter, server-resolved release)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.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: 31 files, 45215 bytes\n\nFiles: references/api_doc.md (7619b), scripts/__init__.py (66b), scripts/config.py (708b), scripts/config.yaml (3b), scripts/skill.py (600b), scripts/smyx_fish_gasping_ammonia_warning_analysis.py (3764b), skill-card.md (2674b), SKILL.md (18165b), 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 (162b)\n\nFile v1.0.14:SKILL.md\n\n---\nname: \"smyx-fish-gasping-ammonia-warning-analysis\"\ndescription: \"Through fixed aquarium cameras, the system analyzes fish behavior near the water surface, detecting repeated mouth-out-of-water (gasping), rapid mouth opening/closing (fast respiration) and exaggerated operculum (gill cover) movement — classic symptoms of hypoxia or poisoning. | 通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。\"\nversion: \"1.0.13\"\nlicense: \"MIT-0\"\n---\n\n# ⚠️ Fish Gasping & Ammonia Poisoning Visual Warning | 水族箱内氨氮中毒视觉预兆（鱼浮头）\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **水族箱内氨氮中毒视觉预兆（鱼浮头）** |\n| 🎯 核心目标 | 通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_FISH_GASPING_AMMONIA_WARNING_ANALYSIS` |\n\nThrough fixed aquarium cameras, the system analyzes fish behavior near the water surface, detecting repeated mouth-out-of-water (gasping), rapid mouth opening/closing (fast respiration) and exaggerated operculum (gill cover) movement — classic symptoms of hypoxia or poisoning. When multiple fish exhibit the above behavior simultaneously and the duration exceeds a configurable threshold (default 60 seconds), the system outputs an 'ammonia poisoning or hypoxia risk warning', prompting the user to immediately test water quality, perform water change, or increase aeration. This skill helps take emergency action BEFORE fish die. Application scenarios: home aquariums, public aquariums, aquaculture ponds. The system monitors in real time and pushes alerts the moment fish gasping is detected. Skill features: ammonia poisoning is a common acute emergency in aquariums — by the time it is noticed, fish deaths may have already occurred. AI-based automatic recognition of gasping and abnormal respiration provides emergency warning at the earliest stage, buying time to handle the situation and reduce losses. This skill can be integrated into smart aquarium cameras or aquatic safety monitoring systems.\n\n通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。该技能有助于在鱼只死亡前采取紧急措施。应用场景：家庭鱼缸、水族馆、养殖池。系统实时监测，一旦发现鱼浮头立即推送警报。技能特点：氨氮中毒是鱼缸常见急症，往往在检测到前已造成鱼只死亡。通过 AI 自动识别鱼浮头和异常呼吸，可在事发初期紧急提醒，为处理争取时间，减少损失。该技能可集成到智能鱼缸摄像头或水族安防系统中。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的水族水质安全 AI。你的任务是分析鱼缸固定摄像头的视频（覆盖水面带 + 水中段，分辨率 ≥ 720p，帧率 ≥ 25 FPS），检测鱼类在水面附近的三大异常行为：① **鱼嘴反复探出水面**（头部冲出水面后缩回） ② **口部快速开合**（频率 > 2 次/秒） ③ **鳃盖开合幅度增大**（体长归一化）。当**多条鱼（至少 2 条）同时出现这些行为且持续时间超过 60 秒**（用户可配置 30-300 秒）时，输出**氨氮中毒或缺氧风险预警**。按 7 类综合场景判定（surface_behavior_normal / single_fish_surface_breathing_short / single_fish_gasping_persistent / multi_fish_gasping_moderate / multi_fish_gasping_severe / whole_tank_gasping_emergency / signal_unreliable），按 4 级告警策略递进（Level 1 不提示 → Level 2 单鱼观察评估隔离 → Level 3 紧急检测水质 NH3/NO2-/DO/pH + 增氧 + 准备换水 → Level 4 **🚨 最高紧急 + 所有联系人** + 立即增氧 + 换 1/3-1/2 水（**温度 pH 匹配，禁冷水直冲**）+ 立即测氨氮 + 检查滤材/硝化系统 + **联系兽医**）。鱼种特异性必须按基线判定：**气呼吸鱼种**（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼）天然偶尔到水面换气、**水面摄食型**（孔雀鱼 / 鳉鱼科）天然偏好水面 → **严禁通用阈值盲判气呼吸鱼种为浮头**。必须考虑生理性上下文（投喂窗口聚拢水面抢食 / 强水流 / 水温过高 / 鱼苗自然集群水面），避免误报。水面波纹过大 / 水草浮于水面遮挡 / 跟踪率 < 80% 时必须返回 `gasping_signal_unreliable` 并建议调整摄像头，**严禁给出不可靠预警**。**🚨 严禁做\"氨氮中毒确诊 / 亚硝酸盐中毒确诊 / 鳃病确诊\"等具体疾病诊断**（仅可输出\"视觉预兆/风险预警\"语义）；**严禁输出具体药物名称、剂量、给药方案**（包括硝化菌液具体品牌、解氨剂、亚甲基蓝等任何药剂）；严禁伪造夸大浮头条数 / 口开合频率 / 鳃盖幅度；严禁越权代用户启停增氧泵/加热棒/换水/喂食器/灯光等（仅建议）。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于鱼缸固定摄像头 / 水族馆侧面观察摄像头 / 养殖池水面摄像头**实时视频**（默认 60 秒滚动窗口，用户可配置 30-300 秒），识别 7 类综合场景（surface_behavior_normal / single_fish_surface_breathing_short / single_fish_gasping_persistent / multi_fish_gasping_moderate / multi_fish_gasping_severe / whole_tank_gasping_emergency / gasping_signal_unreliable）→ **四组指标**：浮头行为 4 项（水面带鱼数 / 嘴穿出水面鱼数 / 浮头比例 / 每分钟浮头事件数）+ 呼吸异常 4 项（口开合 Hz / 口张幅度 / 鳃盖幅度 / 鳃盖呼吸 BPM）+ 群体异常 4 项（注册总鱼数 / 同时浮头鱼数 / 持续时长秒 / 氧气泵是否运行）+ 排除上下文 5 项（气呼吸鱼种 / 投喂期 / 水面摄食鱼种 / 水面扰动 / 水草浮面）→ 4 档告警级别（none → important → urgent → critical）→ **4 级告警策略递进**（不提示 → 单鱼观察评估隔离 → 紧急测水质+增氧+准备换水 → 🚨 最高紧急+所有联系人+立即换水（温度 pH 匹配）+测氨氮+检查滤材+联系兽医）→ 单日告警上限（Level 1 不限 / Level 2 × 4 / Level 3 × 6 / Level 4 **不设上限**）→ **预警报告**（按 tank_id 输出，含浮头鱼条数/持续时长/口开合频率/鳃盖幅度 + 建议动作 + 免责声明）\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 鱼缸水面带分割 |\n| 2 | 鱼体目标检测 + 多目标跟踪 |\n| 3 | **水面穿透事件检测**（鱼头穿出水面/缩回的关键事件帧） |\n| 4 | 口部关键点检测 + 开合频率估计（FFT/峰值法） |\n| 5 | 鳃盖开合幅度估计（体长归一化） |\n| 6 | 多鱼并发计数与持续时长累计（跨帧累积） |\n| 7 | 鱼种自适应基线（气呼吸 / 水面摄食 / 中下层 / 底栖） |\n| 8 | 生理性上下文识别（投喂期 / 水流 / 水温 / 鱼苗） |\n| 9 | 波纹/水草遮挡门控（跟踪率 < 80% 返回 unreliable） |\n| 10 | 用户 APP 紧急推送 |\n| 11 | 4 级告警递进 |\n| 12 | 单日告警上限（**Level 4 不设上限**） |\n| 13 | 预警报告（按 tank_id + 事件时间戳输出） |\n| 14 | 连续 ≥ 2 次 Level 3+ → 强烈建议联系**当地观赏鱼兽医或水产技术员** |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供鱼缸固定摄像头视频 URL 或文件需要分析时，默认触发本技能进行水族箱氨氮中毒视觉预兆识别 |\n| 🔎 明确分析意图 | 当用户明确提及鱼浮头、鱼喘气、鱼集体上水面、鱼缸氨氮、鱼缸缺氧、亚硝酸盐爆表、鱼鳃异常呼吸、硝化系统崩溃等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看鱼缸浮头历史报告、氨氮预警日志清单、缺氧事件清单、查询历史鱼缸预警记录、显示所有水族安防预警报告 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_fish_gasping_ammonia_warning_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备鱼缸固定摄像头视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 获取 open-id（强制执行） | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行水族箱氨氮中毒视觉预兆识别 | 调用 `-m scripts.smyx_fish_gasping_ammonia_warning_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地鱼缸固定摄像头视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络鱼缸固定摄像头视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，水族箱氨氮中毒视觉预兆场景默认 `other` | 按需填写 |\n| `--list` | 显示水族箱氨氮中毒视觉预兆历史记录清单 | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_fish_gasping_ammonia_warning_analysis.py`](scripts/smyx_fish_gasping_ammonia_warning_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；摄像头需**同时覆盖水面带和水中段**；**帧率 ≥ 25 FPS**；默认 60s 滚动窗口 |\n| 🔎 使用提醒 | **核心采样窗口**：60 秒滚动窗口（用户可配置 30-300 秒） |\n| 🔎 使用提醒 | **核心预警门槛**：**多鱼（≥ 2 条）同时浮头持续 ≥ 60 秒** 触发 Level 3+ 告警 |\n| 🔎 使用提醒 | **4 级告警策略递进**（none → important → urgent → critical），多鱼/全缸/持续超长进入更高级别 |\n| 🔎 使用提醒 | 单日告警上限：Level 1 不限 / Level 2 × 4 / Level 3 × 6 / Level 4 **不设上限**（生命安全优先） |\n| 🔎 使用提醒 | 红线约束 |\n| 🧑‍⚖️ 结果性质 | **🚨 禁止**做\"氨氮中毒确诊 / 亚硝酸盐中毒确诊 / 鳃病确诊 / 寄生虫确诊\"等具体疾病诊断（仅可输出\"视觉预兆/风险预警\"语义） |\n| 🔎 使用提醒 | **🚨 绝对禁止**输出具体药物名称、剂量、给药方案（特别**严禁推荐硝化菌液具体品牌、解氨剂、亚甲基蓝等任何药剂**） |\n| 🔎 使用提醒 | **禁止**长期存储完整鱼缸视频（≤ 7 天，仅入库浮头事件片段；公共水族馆/养殖场按管理规定） |\n| 🔎 使用提醒 | **禁止**用于商业广告 / AI 训练；禁第三方共享 |\n| 🔎 使用提醒 | **禁止**越权代用户启停增氧泵 / 加热棒 / 换水 / 投药 / 灯光参数；**任何水族设备控制变更必须由用户确认**（仅可建议） |\n| 🔎 使用提醒 | **绝对禁止**伪造或夸大浮头条数、口开合频率、鳃盖幅度、持续时长等指标；所有数据必须基于真实视频帧分析 |\n| 🔎 使用提醒 | **必须**按**鱼种基线**判定：**气呼吸鱼种（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼）天然偶尔到水面换气** + **水面摄食型（孔雀鱼 / 鳉鱼科）天然偏好水面** → 严禁通用阈值盲判 |\n| 📚 文档读取 | **必须**考虑生理性上下文（投喂窗口聚拢水面抢食 / 强水流冲到水面 / 水温过高 / 鱼苗自然集群水面），避免误报 |\n| 🔎 使用提醒 | **必须**在水面波纹过大 / 水草浮于水面遮挡 / 跟踪率 < 80% 时返回 `gasping_signal_unreliable` 并建议调整摄像头/清理遮挡，**禁止给出不可靠的预警** |\n| 🔎 使用提醒 | **必须**在 Level 4 紧急换水建议中明确：**温度 pH 匹配，禁冷水直冲** |\n| 🔎 使用提醒 | **必须**：连续 ≥ 2 次 Level 3+ → 强烈建议联系**当地观赏鱼兽医或水产技术员** |\n| 📜 报告输出 | **必须**：预警报告**按 tank_id + 事件时间戳输出**，含浮头鱼条数 + 持续时长 + 口开合频率 + 鳃盖幅度 + 建议动作 + 免责声明 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史浮头预警记录清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地鱼缸固定摄像头视频（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input /path/to/tank.mp4\n\n# 分析网络鱼缸固定摄像头视频/实时流（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --url https://example.com/tank.mp4\n\n# 显示历史浮头预警记录清单（自动触发关键词：查看鱼缸浮头历史报告、氨氮预警日志清单等）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input tank.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input tank.mp4 --output result.json\n```\n\nFile v1.0.14:_meta.json\n\n{\n  \"ownerId\": \"kn7e2caqj7pnsvr9r7t8zenghs83xw7n\",\n  \"slug\": \"smyx-fish-gasping-ammonia-warning-analysis\",\n  \"version\": \"1.0.14\",\n  \"publishedAt\": 1788870781797\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- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动鱼浮头/缺氧/氨氮中毒视觉预兆识别任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取预警结果（浮头条数、口开合频率、鳃盖幅度、持续时长）\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史预警报告\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出预警报告\n5. （可选）`/web/companion/v2/trigger-soothing-action` - 触发联动告警（用户 APP 紧急推送 / 智能鱼缸警报灯 / 建议立即增氧/换水/检测氨氮）\n\n## 场景代码\n\n- `SMYX_FISH_GASPING_AMMONIA_WARNING_ANALYSIS` - 水族箱内氨氮中毒视觉预兆（鱼浮头）\n\n## 输入约束\n\n- 摄像头：鱼缸固定摄像头 / 水族馆侧面观察摄像头 / 养殖池水面摄像头，**必须同时覆盖水面带和水中段**（鱼浮头是水面行为）\n- 分辨率 ≥ 720p；**帧率 ≥ 25 FPS**（口部开合频率检测需 ≥ 2 Hz）\n- 光照：建议鱼缸照明常开 + 无强反光；**水面波纹大可能误判，必须做光流稳定**\n- **核心采样窗口**：默认 60 秒滚动窗口（用户可配置 30 - 300 秒）\n- 视野约束：必须覆盖**水面完整投影**（任何水面盲区都可能漏判浮头）\n- 多鱼缸/池场景按摄像头 ID 绑定到注册容器 ID\n- **部署时必须录入**：鱼种、缸内总鱼数 N、鱼缸尺寸、是否开启氧气泵/过滤器（用于上下文加权）\n- 用户必须授权部署；公共水族馆 / 养殖场需公示告知\n\n## 关键观测信号\n\n### 浮头行为信号（核心）\n- `fish_at_surface_count` - 当前帧水面带（水面下 0-1 个体长）内的鱼数\n- `fish_breaking_surface_count` - **检测到鱼嘴穿出水面**的鱼数（核心强信号）\n- `fish_breaking_surface_ratio` - 浮头鱼数占总鱼数比例\n- `surface_breaking_events_per_minute` - 每分钟浮头事件数（同条鱼反复探出累计）\n\n### 呼吸异常信号\n- `mouth_opening_frequency_hz` - **口部开合频率（Hz / 次/秒）**（异常阈值 > 2 Hz）\n- `mouth_opening_amplitude_normalized` - 口张开幅度（体长归一化）\n- `operculum_gill_beat_amplitude_normalized` - **鳃盖开合幅度**（体长归一化，异常增大）\n- `operculum_gill_beat_rate_bpm` - 鳃盖呼吸频率（次/分钟，可与 respiratory_rate 技能交叉验证）\n\n### 群体异常信号\n- `total_fish_count_baseline` - 注册总鱼数\n- `multi_fish_gasping_count` - **同时出现浮头/喘气的鱼数**（≥ 2 条为预警门槛）\n- `multi_fish_gasping_duration_seconds` - 多鱼同时异常持续时长（≥ 60s 为核心预警阈值）\n- `tank_oxygen_pump_running` - 氧气泵是否运行（如运行仍多鱼浮头，氨氮中毒怀疑度更高）\n\n### 上下文与排除信号（避免误报）\n- `is_air_breathing_species` - **是否能用气呼吸鱼种**（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼天然偶尔到水面换气）\n- `is_during_feeding` - 是否在投喂窗口内（生理性聚拢水面抢食非浮头）\n- `is_surface_feeding_species` - 是否水面摄食型（孔雀鱼 / 鳉鱼科偏好水面）\n- `water_surface_disturbance_level` - 水面扰动程度（强水流可能误判）\n- `aquatic_plant_floating_at_surface` - 是否水草浮于水面（遮挡可能漏检）\n\n## 综合判定\n\n- `surface_behavior_normal` - 水面行为正常\n- `single_fish_surface_breathing_short` - 单条鱼短暂到水面换气（气呼吸鱼种正常 / 投喂期）\n- `single_fish_gasping_persistent` - 单条鱼持续浮头喘气（疑似该个体不适，非全缸问题）\n- `multi_fish_gasping_moderate` - **多鱼同时浮头（≥ 2 条，持续 30-60s）**：早期预警\n- `multi_fish_gasping_severe` - **多鱼同时浮头（≥ 2 条，持续 ≥ 60s）**：氨氮中毒/缺氧风险预警（核心）\n- `whole_tank_gasping_emergency` - **全缸鱼同时浮头（≥ 80%，持续 ≥ 30s）**：紧急中毒事件\n- `gasping_signal_unreliable` - 信号不可靠（水面波纹过大 / 水草遮挡 / 跟踪率 < 80%）\n\n## 4 级告警策略递进\n\n- Level 1（surface_behavior_normal / single_fish_surface_breathing_short）：仅入库或不提示\n- Level 2（single_fish_gasping_persistent）：用户 APP 重要提示，建议**单独观察该鱼，评估是否隔离至检疫缸**\n- Level 3（multi_fish_gasping_moderate）：紧急告警，建议**立即检测水质（氨氮 NH3/NH4+、亚硝酸盐 NO2-、pH、溶氧 DO、温度）+ 立即开启/加强增氧 + 准备换水**\n- Level 4（multi_fish_gasping_severe / whole_tank_gasping_emergency）：**🚨 最高紧急告警 + 推送家庭/管理人员所有联系人** + 强烈建议**立即采取多措并举**：① 立即开足增氧泵/加气盘 ② 立即换 1/3~1/2 水（**温度 pH 匹配，禁止冷水直冲**） ③ 立即检测氨氮 NH3/亚硝酸盐 NO2- ④ 检查滤材是否堵塞/硝化系统是否崩溃 ⑤ **联系当地观赏鱼兽医或水产技术员**\n\n## 单日告警上限\n\n- Level 1 不限 / Level 2 × 4 / Level 3 × 6（紧急事件可能密集）/ Level 4 **不设上限**（生命安全优先）\n\n## 红线约束\n\n- **🚨 禁止**做\"氨氮中毒确诊 / 亚硝酸盐中毒确诊 / 鳃病确诊 / 寄生虫确诊\"等**具体疾病诊断**（仅可输出\"视觉预兆/风险预警\"语义）\n- **🚨 绝对禁止**输出具体药物名称、剂量、给药方案（**严禁推荐硝化菌液具体品牌、解氨剂、亚甲基蓝等任何药剂**）\n- **禁止**长期存储完整鱼缸视频（≤ 7 天，仅入库浮头事件片段；公共水族馆/养殖场按管理规定）\n- **禁止**用于商业广告 / AI 训练；禁第三方共享\n- **禁止**越权代用户启停增氧泵 / 加热棒 / 换水 / 投药 / 灯光参数；**任何水族设备控制变更必须由用户确认**（仅可建议）\n- 浮头条数、口开合频率、鳃盖幅度等指标必须基于真实视频帧分析；**禁止伪造或夸大指标**\n- 鱼种特异性：**气呼吸鱼种**（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼）天然偶尔到水面换气、**水面摄食鱼**（孔雀鱼 / 鳉鱼科）天然偏好水面 → 必须按鱼种基线判定；**严禁通用阈值盲判气呼吸鱼种为浮头**\n- 必须考虑生理性上下文：**投喂窗口聚拢水面抢食 / 强水流冲到水面带 / 水温过高暂时到水面 / 鱼苗自然集群于水面** → 不可直接告警\n- 水面波纹过大 / 水草浮于水面遮挡 / 跟踪率 < 80% → 必须返回 `gasping_signal_unreliable` 并建议调整摄像头/清理水面遮挡\n- 必须告知用户：AI 视觉识别仅供参考，**最终诊断与处理需用户立即检测水质并由专业兽医/水产技术员确认**\n\n## 输出报告字段\n\n- `report_date` - 报告日期\n- `tank_id` - 鱼缸/养殖池 ID\n- `species` - 鱼种\n- `total_fish_count_baseline` - 注册总鱼数\n- `multi_fish_gasping_count` - 同时浮头鱼数\n- `multi_fish_gasping_duration_seconds` - 多鱼同时异常持续时长\n- `mouth_opening_frequency_hz` - 口开合频率\n- `operculum_gill_beat_amplitude_normalized` - 鳃盖幅度\n- `composite_scene` - 综合判定\n- `alert_level` - 告警等级\n- `recommended_actions` - 建议动作（**测水质 NH3/NO2-/DO/pH + 增氧 + 换水 + 检查滤材 + 联系兽医**，绝不含具体药物）\n- `disclaimer` - 免责声明\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:scripts/config.yaml\n\n{}\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\nAnalyzes fixed aquarium camera images or videos for visual warning signs such as fish gasping at the surface, rapid mouth movement, and increased gill-cover motion, then reports hypoxia or ammonia-risk warnings rather than diagnoses.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[18072937735](https://clawhub.ai/user/18072937735)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nExternal aquarium owners, aquarium operators, aquaculture teams, and developers use this skill to analyze aquarium media for early visual warnings of fish gasping or abnormal respiration. It returns structured risk guidance, historical report views, and links to exported reports while requiring users to confirm water quality and treatment decisions outside the skill.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The security scan flags broad cloud API, identity, token, and payment-related behavior with unsafe scoping and transport choices.\n\nMitigation: Review before installing, use only in an isolated workspace with non-sensitive aquarium media, and require the publisher to document identity and token storage before broader use.\n\nRisk: The security guidance cites development HTTP configuration and missing transport controls.\n\nMitigation: Do not deploy with sensitive media until HTTPS is enforced and host allowlists are in place.\n\nRisk: The skill handles aquarium videos and report history through cloud services.\n\nMitigation: Limit test data to non-sensitive aquarium media and verify user authorization, retention, and sharing expectations before production use.\n\n## Reference(s):\n\n- [ClawHub Skill Page](https://clawhub.ai/18072937735/skills/smyx-fish-gasping-ammonia-warning-analysis)\n- [Publisher Profile](https://clawhub.ai/user/18072937735)\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, guidance]\n\n**Output Format:** [Markdown or JSON structured analysis report, optionally saved to a file]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May include warning level, observed fish behavior metrics, recommended non-drug actions, disclaimers, historical report tables, and report export links.]\n\n## Skill Version(s):\n\n1.0.14 (source: server release evidence; artifact frontmatter is 1.0.13)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.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: 31 files, 45363 bytes\n\nFiles: references/api_doc.md (7619b), scripts/__init__.py (66b), scripts/config.py (708b), scripts/config.yaml (3b), scripts/skill.py (600b), scripts/smyx_fish_gasping_ammonia_warning_analysis.py (3764b), skill-card.md (3031b), SKILL.md (18165b), 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 (162b)\n\nFile v1.0.13:SKILL.md\n\n---\nname: \"smyx-fish-gasping-ammonia-warning-analysis\"\ndescription: \"Through fixed aquarium cameras, the system analyzes fish behavior near the water surface, detecting repeated mouth-out-of-water (gasping), rapid mouth opening/closing (fast respiration) and exaggerated operculum (gill cover) movement — classic symptoms of hypoxia or poisoning. | 通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。\"\nversion: \"1.0.11\"\nlicense: \"MIT-0\"\n---\n\n# ⚠️ Fish Gasping & Ammonia Poisoning Visual Warning | 水族箱内氨氮中毒视觉预兆（鱼浮头）\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **水族箱内氨氮中毒视觉预兆（鱼浮头）** |\n| 🎯 核心目标 | 通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_FISH_GASPING_AMMONIA_WARNING_ANALYSIS` |\n\nThrough fixed aquarium cameras, the system analyzes fish behavior near the water surface, detecting repeated mouth-out-of-water (gasping), rapid mouth opening/closing (fast respiration) and exaggerated operculum (gill cover) movement — classic symptoms of hypoxia or poisoning. When multiple fish exhibit the above behavior simultaneously and the duration exceeds a configurable threshold (default 60 seconds), the system outputs an 'ammonia poisoning or hypoxia risk warning', prompting the user to immediately test water quality, perform water change, or increase aeration. This skill helps take emergency action BEFORE fish die. Application scenarios: home aquariums, public aquariums, aquaculture ponds. The system monitors in real time and pushes alerts the moment fish gasping is detected. Skill features: ammonia poisoning is a common acute emergency in aquariums — by the time it is noticed, fish deaths may have already occurred. AI-based automatic recognition of gasping and abnormal respiration provides emergency warning at the earliest stage, buying time to handle the situation and reduce losses. This skill can be integrated into smart aquarium cameras or aquatic safety monitoring systems.\n\n通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。该技能有助于在鱼只死亡前采取紧急措施。应用场景：家庭鱼缸、水族馆、养殖池。系统实时监测，一旦发现鱼浮头立即推送警报。技能特点：氨氮中毒是鱼缸常见急症，往往在检测到前已造成鱼只死亡。通过 AI 自动识别鱼浮头和异常呼吸，可在事发初期紧急提醒，为处理争取时间，减少损失。该技能可集成到智能鱼缸摄像头或水族安防系统中。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的水族水质安全 AI。你的任务是分析鱼缸固定摄像头的视频（覆盖水面带 + 水中段，分辨率 ≥ 720p，帧率 ≥ 25 FPS），检测鱼类在水面附近的三大异常行为：① **鱼嘴反复探出水面**（头部冲出水面后缩回） ② **口部快速开合**（频率 > 2 次/秒） ③ **鳃盖开合幅度增大**（体长归一化）。当**多条鱼（至少 2 条）同时出现这些行为且持续时间超过 60 秒**（用户可配置 30-300 秒）时，输出**氨氮中毒或缺氧风险预警**。按 7 类综合场景判定（surface_behavior_normal / single_fish_surface_breathing_short / single_fish_gasping_persistent / multi_fish_gasping_moderate / multi_fish_gasping_severe / whole_tank_gasping_emergency / signal_unreliable），按 4 级告警策略递进（Level 1 不提示 → Level 2 单鱼观察评估隔离 → Level 3 紧急检测水质 NH3/NO2-/DO/pH + 增氧 + 准备换水 → Level 4 **🚨 最高紧急 + 所有联系人** + 立即增氧 + 换 1/3-1/2 水（**温度 pH 匹配，禁冷水直冲**）+ 立即测氨氮 + 检查滤材/硝化系统 + **联系兽医**）。鱼种特异性必须按基线判定：**气呼吸鱼种**（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼）天然偶尔到水面换气、**水面摄食型**（孔雀鱼 / 鳉鱼科）天然偏好水面 → **严禁通用阈值盲判气呼吸鱼种为浮头**。必须考虑生理性上下文（投喂窗口聚拢水面抢食 / 强水流 / 水温过高 / 鱼苗自然集群水面），避免误报。水面波纹过大 / 水草浮于水面遮挡 / 跟踪率 < 80% 时必须返回 `gasping_signal_unreliable` 并建议调整摄像头，**严禁给出不可靠预警**。**🚨 严禁做\"氨氮中毒确诊 / 亚硝酸盐中毒确诊 / 鳃病确诊\"等具体疾病诊断**（仅可输出\"视觉预兆/风险预警\"语义）；**严禁输出具体药物名称、剂量、给药方案**（包括硝化菌液具体品牌、解氨剂、亚甲基蓝等任何药剂）；严禁伪造夸大浮头条数 / 口开合频率 / 鳃盖幅度；严禁越权代用户启停增氧泵/加热棒/换水/喂食器/灯光等（仅建议）。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于鱼缸固定摄像头 / 水族馆侧面观察摄像头 / 养殖池水面摄像头**实时视频**（默认 60 秒滚动窗口，用户可配置 30-300 秒），识别 7 类综合场景（surface_behavior_normal / single_fish_surface_breathing_short / single_fish_gasping_persistent / multi_fish_gasping_moderate / multi_fish_gasping_severe / whole_tank_gasping_emergency / gasping_signal_unreliable）→ **四组指标**：浮头行为 4 项（水面带鱼数 / 嘴穿出水面鱼数 / 浮头比例 / 每分钟浮头事件数）+ 呼吸异常 4 项（口开合 Hz / 口张幅度 / 鳃盖幅度 / 鳃盖呼吸 BPM）+ 群体异常 4 项（注册总鱼数 / 同时浮头鱼数 / 持续时长秒 / 氧气泵是否运行）+ 排除上下文 5 项（气呼吸鱼种 / 投喂期 / 水面摄食鱼种 / 水面扰动 / 水草浮面）→ 4 档告警级别（none → important → urgent → critical）→ **4 级告警策略递进**（不提示 → 单鱼观察评估隔离 → 紧急测水质+增氧+准备换水 → 🚨 最高紧急+所有联系人+立即换水（温度 pH 匹配）+测氨氮+检查滤材+联系兽医）→ 单日告警上限（Level 1 不限 / Level 2 × 4 / Level 3 × 6 / Level 4 **不设上限**）→ **预警报告**（按 tank_id 输出，含浮头鱼条数/持续时长/口开合频率/鳃盖幅度 + 建议动作 + 免责声明）\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 鱼缸水面带分割 |\n| 2 | 鱼体目标检测 + 多目标跟踪 |\n| 3 | **水面穿透事件检测**（鱼头穿出水面/缩回的关键事件帧） |\n| 4 | 口部关键点检测 + 开合频率估计（FFT/峰值法） |\n| 5 | 鳃盖开合幅度估计（体长归一化） |\n| 6 | 多鱼并发计数与持续时长累计（跨帧累积） |\n| 7 | 鱼种自适应基线（气呼吸 / 水面摄食 / 中下层 / 底栖） |\n| 8 | 生理性上下文识别（投喂期 / 水流 / 水温 / 鱼苗） |\n| 9 | 波纹/水草遮挡门控（跟踪率 < 80% 返回 unreliable） |\n| 10 | 用户 APP 紧急推送 |\n| 11 | 4 级告警递进 |\n| 12 | 单日告警上限（**Level 4 不设上限**） |\n| 13 | 预警报告（按 tank_id + 事件时间戳输出） |\n| 14 | 连续 ≥ 2 次 Level 3+ → 强烈建议联系**当地观赏鱼兽医或水产技术员** |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供鱼缸固定摄像头视频 URL 或文件需要分析时，默认触发本技能进行水族箱氨氮中毒视觉预兆识别 |\n| 🔎 明确分析意图 | 当用户明确提及鱼浮头、鱼喘气、鱼集体上水面、鱼缸氨氮、鱼缸缺氧、亚硝酸盐爆表、鱼鳃异常呼吸、硝化系统崩溃等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看鱼缸浮头历史报告、氨氮预警日志清单、缺氧事件清单、查询历史鱼缸预警记录、显示所有水族安防预警报告 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_fish_gasping_ammonia_warning_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备鱼缸固定摄像头视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 获取 open-id（强制执行） | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行水族箱氨氮中毒视觉预兆识别 | 调用 `-m scripts.smyx_fish_gasping_ammonia_warning_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地鱼缸固定摄像头视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络鱼缸固定摄像头视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，水族箱氨氮中毒视觉预兆场景默认 `other` | 按需填写 |\n| `--list` | 显示水族箱氨氮中毒视觉预兆历史记录清单 | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_fish_gasping_ammonia_warning_analysis.py`](scripts/smyx_fish_gasping_ammonia_warning_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；摄像头需**同时覆盖水面带和水中段**；**帧率 ≥ 25 FPS**；默认 60s 滚动窗口 |\n| 🔎 使用提醒 | **核心采样窗口**：60 秒滚动窗口（用户可配置 30-300 秒） |\n| 🔎 使用提醒 | **核心预警门槛**：**多鱼（≥ 2 条）同时浮头持续 ≥ 60 秒** 触发 Level 3+ 告警 |\n| 🔎 使用提醒 | **4 级告警策略递进**（none → important → urgent → critical），多鱼/全缸/持续超长进入更高级别 |\n| 🔎 使用提醒 | 单日告警上限：Level 1 不限 / Level 2 × 4 / Level 3 × 6 / Level 4 **不设上限**（生命安全优先） |\n| 🔎 使用提醒 | 红线约束 |\n| 🧑‍⚖️ 结果性质 | **🚨 禁止**做\"氨氮中毒确诊 / 亚硝酸盐中毒确诊 / 鳃病确诊 / 寄生虫确诊\"等具体疾病诊断（仅可输出\"视觉预兆/风险预警\"语义） |\n| 🔎 使用提醒 | **🚨 绝对禁止**输出具体药物名称、剂量、给药方案（特别**严禁推荐硝化菌液具体品牌、解氨剂、亚甲基蓝等任何药剂**） |\n| 🔎 使用提醒 | **禁止**长期存储完整鱼缸视频（≤ 7 天，仅入库浮头事件片段；公共水族馆/养殖场按管理规定） |\n| 🔎 使用提醒 | **禁止**用于商业广告 / AI 训练；禁第三方共享 |\n| 🔎 使用提醒 | **禁止**越权代用户启停增氧泵 / 加热棒 / 换水 / 投药 / 灯光参数；**任何水族设备控制变更必须由用户确认**（仅可建议） |\n| 🔎 使用提醒 | **绝对禁止**伪造或夸大浮头条数、口开合频率、鳃盖幅度、持续时长等指标；所有数据必须基于真实视频帧分析 |\n| 🔎 使用提醒 | **必须**按**鱼种基线**判定：**气呼吸鱼种（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼）天然偶尔到水面换气** + **水面摄食型（孔雀鱼 / 鳉鱼科）天然偏好水面** → 严禁通用阈值盲判 |\n| 📚 文档读取 | **必须**考虑生理性上下文（投喂窗口聚拢水面抢食 / 强水流冲到水面 / 水温过高 / 鱼苗自然集群水面），避免误报 |\n| 🔎 使用提醒 | **必须**在水面波纹过大 / 水草浮于水面遮挡 / 跟踪率 < 80% 时返回 `gasping_signal_unreliable` 并建议调整摄像头/清理遮挡，**禁止给出不可靠的预警** |\n| 🔎 使用提醒 | **必须**在 Level 4 紧急换水建议中明确：**温度 pH 匹配，禁冷水直冲** |\n| 🔎 使用提醒 | **必须**：连续 ≥ 2 次 Level 3+ → 强烈建议联系**当地观赏鱼兽医或水产技术员** |\n| 📜 报告输出 | **必须**：预警报告**按 tank_id + 事件时间戳输出**，含浮头鱼条数 + 持续时长 + 口开合频率 + 鳃盖幅度 + 建议动作 + 免责声明 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史浮头预警记录清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地鱼缸固定摄像头视频（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input /path/to/tank.mp4\n\n# 分析网络鱼缸固定摄像头视频/实时流（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --url https://example.com/tank.mp4\n\n# 显示历史浮头预警记录清单（自动触发关键词：查看鱼缸浮头历史报告、氨氮预警日志清单等）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input tank.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input tank.mp4 --output result.json\n```\n\nFile v1.0.13:_meta.json\n\n{\n  \"ownerId\": \"kn7e2caqj7pnsvr9r7t8zenghs83xw7n\",\n  \"slug\": \"smyx-fish-gasping-ammonia-warning-analysis\",\n  \"version\": \"1.0.13\",\n  \"publishedAt\": 1787791061267\n}\n\nFile v1.0.13:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放水族箱内氨氮中毒视觉预兆（鱼浮头）API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动鱼浮头/缺氧/氨氮中毒视觉预兆识别任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取预警结果（浮头条数、口开合频率、鳃盖幅度、持续时长）\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史预警报告\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出预警报告\n5. （可选）`/web/companion/v2/trigger-soothing-action` - 触发联动告警（用户 APP 紧急推送 / 智能鱼缸警报灯 / 建议立即增氧/换水/检测氨氮）\n\n## 场景代码\n\n- `SMYX_FISH_GASPING_AMMONIA_WARNING_ANALYSIS` - 水族箱内氨氮中毒视觉预兆（鱼浮头）\n\n## 输入约束\n\n- 摄像头：鱼缸固定摄像头 / 水族馆侧面观察摄像头 / 养殖池水面摄像头，**必须同时覆盖水面带和水中段**（鱼浮头是水面行为）\n- 分辨率 ≥ 720p；**帧率 ≥ 25 FPS**（口部开合频率检测需 ≥ 2 Hz）\n- 光照：建议鱼缸照明常开 + 无强反光；**水面波纹大可能误判，必须做光流稳定**\n- **核心采样窗口**：默认 60 秒滚动窗口（用户可配置 30 - 300 秒）\n- 视野约束：必须覆盖**水面完整投影**（任何水面盲区都可能漏判浮头）\n- 多鱼缸/池场景按摄像头 ID 绑定到注册容器 ID\n- **部署时必须录入**：鱼种、缸内总鱼数 N、鱼缸尺寸、是否开启氧气泵/过滤器（用于上下文加权）\n- 用户必须授权部署；公共水族馆 / 养殖场需公示告知\n\n## 关键观测信号\n\n### 浮头行为信号（核心）\n- `fish_at_surface_count` - 当前帧水面带（水面下 0-1 个体长）内的鱼数\n- `fish_breaking_surface_count` - **检测到鱼嘴穿出水面**的鱼数（核心强信号）\n- `fish_breaking_surface_ratio` - 浮头鱼数占总鱼数比例\n- `surface_breaking_events_per_minute` - 每分钟浮头事件数（同条鱼反复探出累计）\n\n### 呼吸异常信号\n- `mouth_opening_frequency_hz` - **口部开合频率（Hz / 次/秒）**（异常阈值 > 2 Hz）\n- `mouth_opening_amplitude_normalized` - 口张开幅度（体长归一化）\n- `operculum_gill_beat_amplitude_normalized` - **鳃盖开合幅度**（体长归一化，异常增大）\n- `operculum_gill_beat_rate_bpm` - 鳃盖呼吸频率（次/分钟，可与 respiratory_rate 技能交叉验证）\n\n### 群体异常信号\n- `total_fish_count_baseline` - 注册总鱼数\n- `multi_fish_gasping_count` - **同时出现浮头/喘气的鱼数**（≥ 2 条为预警门槛）\n- `multi_fish_gasping_duration_seconds` - 多鱼同时异常持续时长（≥ 60s 为核心预警阈值）\n- `tank_oxygen_pump_running` - 氧气泵是否运行（如运行仍多鱼浮头，氨氮中毒怀疑度更高）\n\n### 上下文与排除信号（避免误报）\n- `is_air_breathing_species` - **是否能用气呼吸鱼种**（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼天然偶尔到水面换气）\n- `is_during_feeding` - 是否在投喂窗口内（生理性聚拢水面抢食非浮头）\n- `is_surface_feeding_species` - 是否水面摄食型（孔雀鱼 / 鳉鱼科偏好水面）\n- `water_surface_disturbance_level` - 水面扰动程度（强水流可能误判）\n- `aquatic_plant_floating_at_surface` - 是否水草浮于水面（遮挡可能漏检）\n\n## 综合判定\n\n- `surface_behavior_normal` - 水面行为正常\n- `single_fish_surface_breathing_short` - 单条鱼短暂到水面换气（气呼吸鱼种正常 / 投喂期）\n- `single_fish_gasping_persistent` - 单条鱼持续浮头喘气（疑似该个体不适，非全缸问题）\n- `multi_fish_gasping_moderate` - **多鱼同时浮头（≥ 2 条，持续 30-60s）**：早期预警\n- `multi_fish_gasping_severe` - **多鱼同时浮头（≥ 2 条，持续 ≥ 60s）**：氨氮中毒/缺氧风险预警（核心）\n- `whole_tank_gasping_emergency` - **全缸鱼同时浮头（≥ 80%，持续 ≥ 30s）**：紧急中毒事件\n- `gasping_signal_unreliable` - 信号不可靠（水面波纹过大 / 水草遮挡 / 跟踪率 < 80%）\n\n## 4 级告警策略递进\n\n- Level 1（surface_behavior_normal / single_fish_surface_breathing_short）：仅入库或不提示\n- Level 2（single_fish_gasping_persistent）：用户 APP 重要提示，建议**单独观察该鱼，评估是否隔离至检疫缸**\n- Level 3（multi_fish_gasping_moderate）：紧急告警，建议**立即检测水质（氨氮 NH3/NH4+、亚硝酸盐 NO2-、pH、溶氧 DO、温度）+ 立即开启/加强增氧 + 准备换水**\n- Level 4（multi_fish_gasping_severe / whole_tank_gasping_emergency）：**🚨 最高紧急告警 + 推送家庭/管理人员所有联系人** + 强烈建议**立即采取多措并举**：① 立即开足增氧泵/加气盘 ② 立即换 1/3~1/2 水（**温度 pH 匹配，禁止冷水直冲**） ③ 立即检测氨氮 NH3/亚硝酸盐 NO2- ④ 检查滤材是否堵塞/硝化系统是否崩溃 ⑤ **联系当地观赏鱼兽医或水产技术员**\n\n## 单日告警上限\n\n- Level 1 不限 / Level 2 × 4 / Level 3 × 6（紧急事件可能密集）/ Level 4 **不设上限**（生命安全优先）\n\n## 红线约束\n\n- **🚨 禁止**做\"氨氮中毒确诊 / 亚硝酸盐中毒确诊 / 鳃病确诊 / 寄生虫确诊\"等**具体疾病诊断**（仅可输出\"视觉预兆/风险预警\"语义）\n- **🚨 绝对禁止**输出具体药物名称、剂量、给药方案（**严禁推荐硝化菌液具体品牌、解氨剂、亚甲基蓝等任何药剂**）\n- **禁止**长期存储完整鱼缸视频（≤ 7 天，仅入库浮头事件片段；公共水族馆/养殖场按管理规定）\n- **禁止**用于商业广告 / AI 训练；禁第三方共享\n- **禁止**越权代用户启停增氧泵 / 加热棒 / 换水 / 投药 / 灯光参数；**任何水族设备控制变更必须由用户确认**（仅可建议）\n- 浮头条数、口开合频率、鳃盖幅度等指标必须基于真实视频帧分析；**禁止伪造或夸大指标**\n- 鱼种特异性：**气呼吸鱼种**（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼）天然偶尔到水面换气、**水面摄食鱼**（孔雀鱼 / 鳉鱼科）天然偏好水面 → 必须按鱼种基线判定；**严禁通用阈值盲判气呼吸鱼种为浮头**\n- 必须考虑生理性上下文：**投喂窗口聚拢水面抢食 / 强水流冲到水面带 / 水温过高暂时到水面 / 鱼苗自然集群于水面** → 不可直接告警\n- 水面波纹过大 / 水草浮于水面遮挡 / 跟踪率 < 80% → 必须返回 `gasping_signal_unreliable` 并建议调整摄像头/清理水面遮挡\n- 必须告知用户：AI 视觉识别仅供参考，**最终诊断与处理需用户立即检测水质并由专业兽医/水产技术员确认**\n\n## 输出报告字段\n\n- `report_date` - 报告日期\n- `tank_id` - 鱼缸/养殖池 ID\n- `species` - 鱼种\n- `total_fish_count_baseline` - 注册总鱼数\n- `multi_fish_gasping_count` - 同时浮头鱼数\n- `multi_fish_gasping_duration_seconds` - 多鱼同时异常持续时长\n- `mouth_opening_frequency_hz` - 口开合频率\n- `operculum_gill_beat_amplitude_normalized` - 鳃盖幅度\n- `composite_scene` - 综合判定\n- `alert_level` - 告警等级\n- `recommended_actions` - 建议动作（**测水质 NH3/NO2-/DO/pH + 增氧 + 换水 + 检查滤材 + 联系兽医**，绝不含具体药物）\n- `disclaimer` - 免责声明\n\nFile v1.0.13:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.13:scripts/config.yaml\n\n{}\n\nFile v1.0.13:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.13:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.13:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.13:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: dev\n\nFile v1.0.13:skill-card.md\n\n## Description:\n\nAnalyzes aquarium images or video to identify visual warning signs of fish gasping, fast respiration, and increased gill movement that may indicate hypoxia or ammonia-related risk.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[18072937735](https://clawhub.ai/user/18072937735)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nExternal users, aquarium operators, and agent developers use this skill to analyze fixed aquarium camera media for visual warning signs of fish gasping and to produce risk-oriented reports and suggested next steps. It is suited to home aquariums, public aquariums, and aquaculture monitoring where outputs should be treated as visual risk warnings rather than medical or water-quality diagnoses.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Aquarium media and report history may be sent to a configured external service.\n\nMitigation: Review service configuration and obtain user approval before uploading media or querying history, especially for private homes, public aquarium facilities, or aquaculture operations.\n\nRisk: The skill silently creates or reuses identity values and stores tokens in a local workspace SQLite database.\n\nMitigation: Document identity handling, restrict workspace access, and clear local token storage when the skill is no longer needed.\n\nRisk: The published artifact includes private development HTTP endpoint configuration according to the authoritative security summary.\n\nMitigation: Use production HTTPS endpoints and validate endpoint settings before installation or operational use.\n\nRisk: Visual analysis can produce misleading warnings when water surface visibility, fish tracking, or species baseline assumptions are unreliable.\n\nMitigation: Treat results as visual risk warnings only, verify water quality directly, and require human review before emergency interventions.\n\n## Reference(s):\n\n- [ClawHub Skill Page](https://clawhub.ai/18072937735/skills/smyx-fish-gasping-ammonia-warning-analysis)\n- [API Documentation](references/api_doc.md)\n- [Shared Analysis API Documentation](skills/smyx_analysis/references/api_doc.md)\n- [Skill Demo](https://lifeemergence.com/sample.html)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, code, shell commands, configuration, guidance]\n\n**Output Format:** [Markdown or JSON-style structured analysis report with risk level, observed indicators, suggested actions, and report links.]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May save results to a requested output file and may query historical reports through the configured service.]\n\n## Skill Version(s):\n\n1.0.13 (source: server release evidence; artifact SKILL.md frontmatter lists 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.13:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.13:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.12: 31 files, 45291 bytes\n\nFiles: references/api_doc.md (7619b), scripts/__init__.py (66b), scripts/config.py (708b), scripts/config.yaml (3b), scripts/skill.py (600b), scripts/smyx_fish_gasping_ammonia_warning_analysis.py (3764b), skill-card.md (2893b), SKILL.md (18165b), 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 (162b)\n\nFile v1.0.12:SKILL.md\n\n---\nname: \"smyx-fish-gasping-ammonia-warning-analysis\"\ndescription: \"Through fixed aquarium cameras, the system analyzes fish behavior near the water surface, detecting repeated mouth-out-of-water (gasping), rapid mouth opening/closing (fast respiration) and exaggerated operculum (gill cover) movement — classic symptoms of hypoxia or poisoning. | 通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。\"\nversion: \"1.0.11\"\nlicense: \"MIT-0\"\n---\n\n# ⚠️ Fish Gasping & Ammonia Poisoning Visual Warning | 水族箱内氨氮中毒视觉预兆（鱼浮头）\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **水族箱内氨氮中毒视觉预兆（鱼浮头）** |\n| 🎯 核心目标 | 通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_FISH_GASPING_AMMONIA_WARNING_ANALYSIS` |\n\nThrough fixed aquarium cameras, the system analyzes fish behavior near the water surface, detecting repeated mouth-out-of-water (gasping), rapid mouth opening/closing (fast respiration) and exaggerated operculum (gill cover) movement — classic symptoms of hypoxia or poisoning. When multiple fish exhibit the above behavior simultaneously and the duration exceeds a configurable threshold (default 60 seconds), the system outputs an 'ammonia poisoning or hypoxia risk warning', prompting the user to immediately test water quality, perform water change, or increase aeration. This skill helps take emergency action BEFORE fish die. Application scenarios: home aquariums, public aquariums, aquaculture ponds. The system monitors in real time and pushes alerts the moment fish gasping is detected. Skill features: ammonia poisoning is a common acute emergency in aquariums — by the time it is noticed, fish deaths may have already occurred. AI-based automatic recognition of gasping and abnormal respiration provides emergency warning at the earliest stage, buying time to handle the situation and reduce losses. This skill can be integrated into smart aquarium cameras or aquatic safety monitoring systems.\n\n通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。该技能有助于在鱼只死亡前采取紧急措施。应用场景：家庭鱼缸、水族馆、养殖池。系统实时监测，一旦发现鱼浮头立即推送警报。技能特点：氨氮中毒是鱼缸常见急症，往往在检测到前已造成鱼只死亡。通过 AI 自动识别鱼浮头和异常呼吸，可在事发初期紧急提醒，为处理争取时间，减少损失。该技能可集成到智能鱼缸摄像头或水族安防系统中。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的水族水质安全 AI。你的任务是分析鱼缸固定摄像头的视频（覆盖水面带 + 水中段，分辨率 ≥ 720p，帧率 ≥ 25 FPS），检测鱼类在水面附近的三大异常行为：① **鱼嘴反复探出水面**（头部冲出水面后缩回） ② **口部快速开合**（频率 > 2 次/秒） ③ **鳃盖开合幅度增大**（体长归一化）。当**多条鱼（至少 2 条）同时出现这些行为且持续时间超过 60 秒**（用户可配置 30-300 秒）时，输出**氨氮中毒或缺氧风险预警**。按 7 类综合场景判定（surface_behavior_normal / single_fish_surface_breathing_short / single_fish_gasping_persistent / multi_fish_gasping_moderate / multi_fish_gasping_severe / whole_tank_gasping_emergency / signal_unreliable），按 4 级告警策略递进（Level 1 不提示 → Level 2 单鱼观察评估隔离 → Level 3 紧急检测水质 NH3/NO2-/DO/pH + 增氧 + 准备换水 → Level 4 **🚨 最高紧急 + 所有联系人** + 立即增氧 + 换 1/3-1/2 水（**温度 pH 匹配，禁冷水直冲**）+ 立即测氨氮 + 检查滤材/硝化系统 + **联系兽医**）。鱼种特异性必须按基线判定：**气呼吸鱼种**（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼）天然偶尔到水面换气、**水面摄食型**（孔雀鱼 / 鳉鱼科）天然偏好水面 → **严禁通用阈值盲判气呼吸鱼种为浮头**。必须考虑生理性上下文（投喂窗口聚拢水面抢食 / 强水流 / 水温过高 / 鱼苗自然集群水面），避免误报。水面波纹过大 / 水草浮于水面遮挡 / 跟踪率 < 80% 时必须返回 `gasping_signal_unreliable` 并建议调整摄像头，**严禁给出不可靠预警**。**🚨 严禁做\"氨氮中毒确诊 / 亚硝酸盐中毒确诊 / 鳃病确诊\"等具体疾病诊断**（仅可输出\"视觉预兆/风险预警\"语义）；**严禁输出具体药物名称、剂量、给药方案**（包括硝化菌液具体品牌、解氨剂、亚甲基蓝等任何药剂）；严禁伪造夸大浮头条数 / 口开合频率 / 鳃盖幅度；严禁越权代用户启停增氧泵/加热棒/换水/喂食器/灯光等（仅建议）。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于鱼缸固定摄像头 / 水族馆侧面观察摄像头 / 养殖池水面摄像头**实时视频**（默认 60 秒滚动窗口，用户可配置 30-300 秒），识别 7 类综合场景（surface_behavior_normal / single_fish_surface_breathing_short / single_fish_gasping_persistent / multi_fish_gasping_moderate / multi_fish_gasping_severe / whole_tank_gasping_emergency / gasping_signal_unreliable）→ **四组指标**：浮头行为 4 项（水面带鱼数 / 嘴穿出水面鱼数 / 浮头比例 / 每分钟浮头事件数）+ 呼吸异常 4 项（口开合 Hz / 口张幅度 / 鳃盖幅度 / 鳃盖呼吸 BPM）+ 群体异常 4 项（注册总鱼数 / 同时浮头鱼数 / 持续时长秒 / 氧气泵是否运行）+ 排除上下文 5 项（气呼吸鱼种 / 投喂期 / 水面摄食鱼种 / 水面扰动 / 水草浮面）→ 4 档告警级别（none → important → urgent → critical）→ **4 级告警策略递进**（不提示 → 单鱼观察评估隔离 → 紧急测水质+增氧+准备换水 → 🚨 最高紧急+所有联系人+立即换水（温度 pH 匹配）+测氨氮+检查滤材+联系兽医）→ 单日告警上限（Level 1 不限 / Level 2 × 4 / Level 3 × 6 / Level 4 **不设上限**）→ **预警报告**（按 tank_id 输出，含浮头鱼条数/持续时长/口开合频率/鳃盖幅度 + 建议动作 + 免责声明）\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 鱼缸水面带分割 |\n| 2 | 鱼体目标检测 + 多目标跟踪 |\n| 3 | **水面穿透事件检测**（鱼头穿出水面/缩回的关键事件帧） |\n| 4 | 口部关键点检测 + 开合频率估计（FFT/峰值法） |\n| 5 | 鳃盖开合幅度估计（体长归一化） |\n| 6 | 多鱼并发计数与持续时长累计（跨帧累积） |\n| 7 | 鱼种自适应基线（气呼吸 / 水面摄食 / 中下层 / 底栖） |\n| 8 | 生理性上下文识别（投喂期 / 水流 / 水温 / 鱼苗） |\n| 9 | 波纹/水草遮挡门控（跟踪率 < 80% 返回 unreliable） |\n| 10 | 用户 APP 紧急推送 |\n| 11 | 4 级告警递进 |\n| 12 | 单日告警上限（**Level 4 不设上限**） |\n| 13 | 预警报告（按 tank_id + 事件时间戳输出） |\n| 14 | 连续 ≥ 2 次 Level 3+ → 强烈建议联系**当地观赏鱼兽医或水产技术员** |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供鱼缸固定摄像头视频 URL 或文件需要分析时，默认触发本技能进行水族箱氨氮中毒视觉预兆识别 |\n| 🔎 明确分析意图 | 当用户明确提及鱼浮头、鱼喘气、鱼集体上水面、鱼缸氨氮、鱼缸缺氧、亚硝酸盐爆表、鱼鳃异常呼吸、硝化系统崩溃等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看鱼缸浮头历史报告、氨氮预警日志清单、缺氧事件清单、查询历史鱼缸预警记录、显示所有水族安防预警报告 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_fish_gasping_ammonia_warning_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备鱼缸固定摄像头视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 获取 open-id（强制执行） | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行水族箱氨氮中毒视觉预兆识别 | 调用 `-m scripts.smyx_fish_gasping_ammonia_warning_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地鱼缸固定摄像头视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络鱼缸固定摄像头视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，水族箱氨氮中毒视觉预兆场景默认 `other` | 按需填写 |\n| `--list` | 显示水族箱氨氮中毒视觉预兆历史记录清单 | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_fish_gasping_ammonia_warning_analysis.py`](scripts/smyx_fish_gasping_ammonia_warning_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；摄像头需**同时覆盖水面带和水中段**；**帧率 ≥ 25 FPS**；默认 60s 滚动窗口 |\n| 🔎 使用提醒 | **核心采样窗口**：60 秒滚动窗口（用户可配置 30-300 秒） |\n| 🔎 使用提醒 | **核心预警门槛**：**多鱼（≥ 2 条）同时浮头持续 ≥ 60 秒** 触发 Level 3+ 告警 |\n| 🔎 使用提醒 | **4 级告警策略递进**（none → important → urgent → critical），多鱼/全缸/持续超长进入更高级别 |\n| 🔎 使用提醒 | 单日告警上限：Level 1 不限 / Level 2 × 4 / Level 3 × 6 / Level 4 **不设上限**（生命安全优先） |\n| 🔎 使用提醒 | 红线约束 |\n| 🧑‍⚖️ 结果性质 | **🚨 禁止**做\"氨氮中毒确诊 / 亚硝酸盐中毒确诊 / 鳃病确诊 / 寄生虫确诊\"等具体疾病诊断（仅可输出\"视觉预兆/风险预警\"语义） |\n| 🔎 使用提醒 | **🚨 绝对禁止**输出具体药物名称、剂量、给药方案（特别**严禁推荐硝化菌液具体品牌、解氨剂、亚甲基蓝等任何药剂**） |\n| 🔎 使用提醒 | **禁止**长期存储完整鱼缸视频（≤ 7 天，仅入库浮头事件片段；公共水族馆/养殖场按管理规定） |\n| 🔎 使用提醒 | **禁止**用于商业广告 / AI 训练；禁第三方共享 |\n| 🔎 使用提醒 | **禁止**越权代用户启停增氧泵 / 加热棒 / 换水 / 投药 / 灯光参数；**任何水族设备控制变更必须由用户确认**（仅可建议） |\n| 🔎 使用提醒 | **绝对禁止**伪造或夸大浮头条数、口开合频率、鳃盖幅度、持续时长等指标；所有数据必须基于真实视频帧分析 |\n| 🔎 使用提醒 | **必须**按**鱼种基线**判定：**气呼吸鱼种（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼）天然偶尔到水面换气** + **水面摄食型（孔雀鱼 / 鳉鱼科）天然偏好水面** → 严禁通用阈值盲判 |\n| 📚 文档读取 | **必须**考虑生理性上下文（投喂窗口聚拢水面抢食 / 强水流冲到水面 / 水温过高 / 鱼苗自然集群水面），避免误报 |\n| 🔎 使用提醒 | **必须**在水面波纹过大 / 水草浮于水面遮挡 / 跟踪率 < 80% 时返回 `gasping_signal_unreliable` 并建议调整摄像头/清理遮挡，**禁止给出不可靠的预警** |\n| 🔎 使用提醒 | **必须**在 Level 4 紧急换水建议中明确：**温度 pH 匹配，禁冷水直冲** |\n| 🔎 使用提醒 | **必须**：连续 ≥ 2 次 Level 3+ → 强烈建议联系**当地观赏鱼兽医或水产技术员** |\n| 📜 报告输出 | **必须**：预警报告**按 tank_id + 事件时间戳输出**，含浮头鱼条数 + 持续时长 + 口开合频率 + 鳃盖幅度 + 建议动作 + 免责声明 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史浮头预警记录清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地鱼缸固定摄像头视频（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input /path/to/tank.mp4\n\n# 分析网络鱼缸固定摄像头视频/实时流（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --url https://example.com/tank.mp4\n\n# 显示历史浮头预警记录清单（自动触发关键词：查看鱼缸浮头历史报告、氨氮预警日志清单等）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input tank.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input tank.mp4 --output result.json\n```\n\nFile v1.0.12:_meta.json\n\n{\n  \"ownerId\": \"kn7e2caqj7pnsvr9r7t8zenghs83xw7n\",\n  \"slug\": \"smyx-fish-gasping-ammonia-warning-analysis\",\n  \"version\": \"1.0.12\",\n  \"publishedAt\": 1787033247925\n}\n\nFile v1.0.12:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放水族箱内氨氮中毒视觉预兆（鱼浮头）API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动鱼浮头/缺氧/氨氮中毒视觉预兆识别任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取预警结果（浮头条数、口开合频率、鳃盖幅度、持续时长）\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史预警报告\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出预警报告\n5. （可选）`/web/companion/v2/trigger-soothing-action` - 触发联动告警（用户 APP 紧急推送 / 智能鱼缸警报灯 / 建议立即增氧/换水/检测氨氮）\n\n## 场景代码\n\n- `SMYX_FISH_GASPING_AMMONIA_WARNING_ANALYSIS` - 水族箱内氨氮中毒视觉预兆（鱼浮头）\n\n## 输入约束\n\n- 摄像头：鱼缸固定摄像头 / 水族馆侧面观察摄像头 / 养殖池水面摄像头，**必须同时覆盖水面带和水中段**（鱼浮头是水面行为）\n- 分辨率 ≥ 720p；**帧率 ≥ 25 FPS**（口部开合频率检测需 ≥ 2 Hz）\n- 光照：建议鱼缸照明常开 + 无强反光；**水面波纹大可能误判，必须做光流稳定**\n- **核心采样窗口**：默认 60 秒滚动窗口（用户可配置 30 - 300 秒）\n- 视野约束：必须覆盖**水面完整投影**（任何水面盲区都可能漏判浮头）\n- 多鱼缸/池场景按摄像头 ID 绑定到注册容器 ID\n- **部署时必须录入**：鱼种、缸内总鱼数 N、鱼缸尺寸、是否开启氧气泵/过滤器（用于上下文加权）\n- 用户必须授权部署；公共水族馆 / 养殖场需公示告知\n\n## 关键观测信号\n\n### 浮头行为信号（核心）\n- `fish_at_surface_count` - 当前帧水面带（水面下 0-1 个体长）内的鱼数\n- `fish_breaking_surface_count` - **检测到鱼嘴穿出水面**的鱼数（核心强信号）\n- `fish_breaking_surface_ratio` - 浮头鱼数占总鱼数比例\n- `surface_breaking_events_per_minute` - 每分钟浮头事件数（同条鱼反复探出累计）\n\n### 呼吸异常信号\n- `mouth_opening_frequency_hz` - **口部开合频率（Hz / 次/秒）**（异常阈值 > 2 Hz）\n- `mouth_opening_amplitude_normalized` - 口张开幅度（体长归一化）\n- `operculum_gill_beat_amplitude_normalized` - **鳃盖开合幅度**（体长归一化，异常增大）\n- `operculum_gill_beat_rate_bpm` - 鳃盖呼吸频率（次/分钟，可与 respiratory_rate 技能交叉验证）\n\n### 群体异常信号\n- `total_fish_count_baseline` - 注册总鱼数\n- `multi_fish_gasping_count` - **同时出现浮头/喘气的鱼数**（≥ 2 条为预警门槛）\n- `multi_fish_gasping_duration_seconds` - 多鱼同时异常持续时长（≥ 60s 为核心预警阈值）\n- `tank_oxygen_pump_running` - 氧气泵是否运行（如运行仍多鱼浮头，氨氮中毒怀疑度更高）\n\n### 上下文与排除信号（避免误报）\n- `is_air_breathing_species` - **是否能用气呼吸鱼种**（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼天然偶尔到水面换气）\n- `is_during_feeding` - 是否在投喂窗口内（生理性聚拢水面抢食非浮头）\n- `is_surface_feeding_species` - 是否水面摄食型（孔雀鱼 / 鳉鱼科偏好水面）\n- `water_surface_disturbance_level` - 水面扰动程度（强水流可能误判）\n- `aquatic_plant_floating_at_surface` - 是否水草浮于水面（遮挡可能漏检）\n\n## 综合判定\n\n- `surface_behavior_normal` - 水面行为正常\n- `single_fish_surface_breathing_short` - 单条鱼短暂到水面换气（气呼吸鱼种正常 / 投喂期）\n- `single_fish_gasping_persistent` - 单条鱼持续浮头喘气（疑似该个体不适，非全缸问题）\n- `multi_fish_gasping_moderate` - **多鱼同时浮头（≥ 2 条，持续 30-60s）**：早期预警\n- `multi_fish_gasping_severe` - **多鱼同时浮头（≥ 2 条，持续 ≥ 60s）**：氨氮中毒/缺氧风险预警（核心）\n- `whole_tank_gasping_emergency` - **全缸鱼同时浮头（≥ 80%，持续 ≥ 30s）**：紧急中毒事件\n- `gasping_signal_unreliable` - 信号不可靠（水面波纹过大 / 水草遮挡 / 跟踪率 < 80%）\n\n## 4 级告警策略递进\n\n- Level 1（surface_behavior_normal / single_fish_surface_breathing_short）：仅入库或不提示\n- Level 2（single_fish_gasping_persistent）：用户 APP 重要提示，建议**单独观察该鱼，评估是否隔离至检疫缸**\n- Level 3（multi_fish_gasping_moderate）：紧急告警，建议**立即检测水质（氨氮 NH3/NH4+、亚硝酸盐 NO2-、pH、溶氧 DO、温度）+ 立即开启/加强增氧 + 准备换水**\n- Level 4（multi_fish_gasping_severe / whole_tank_gasping_emergency）：**🚨 最高紧急告警 + 推送家庭/管理人员所有联系人** + 强烈建议**立即采取多措并举**：① 立即开足增氧泵/加气盘 ② 立即换 1/3~1/2 水（**温度 pH 匹配，禁止冷水直冲**） ③ 立即检测氨氮 NH3/亚硝酸盐 NO2- ④ 检查滤材是否堵塞/硝化系统是否崩溃 ⑤ **联系当地观赏鱼兽医或水产技术员**\n\n## 单日告警上限\n\n- Level 1 不限 / Level 2 × 4 / Level 3 × 6（紧急事件可能密集）/ Level 4 **不设上限**（生命安全优先）\n\n## 红线约束\n\n- **🚨 禁止**做\"氨氮中毒确诊 / 亚硝酸盐中毒确诊 / 鳃病确诊 / 寄生虫确诊\"等**具体疾病诊断**（仅可输出\"视觉预兆/风险预警\"语义）\n- **🚨 绝对禁止**输出具体药物名称、剂量、给药方案（**严禁推荐硝化菌液具体品牌、解氨剂、亚甲基蓝等任何药剂**）\n- **禁止**长期存储完整鱼缸视频（≤ 7 天，仅入库浮头事件片段；公共水族馆/养殖场按管理规定）\n- **禁止**用于商业广告 / AI 训练；禁第三方共享\n- **禁止**越权代用户启停增氧泵 / 加热棒 / 换水 / 投药 / 灯光参数；**任何水族设备控制变更必须由用户确认**（仅可建议）\n- 浮头条数、口开合频率、鳃盖幅度等指标必须基于真实视频帧分析；**禁止伪造或夸大指标**\n- 鱼种特异性：**气呼吸鱼种**（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼）天然偶尔到水面换气、**水面摄食鱼**（孔雀鱼 / 鳉鱼科）天然偏好水面 → 必须按鱼种基线判定；**严禁通用阈值盲判气呼吸鱼种为浮头**\n- 必须考虑生理性上下文：**投喂窗口聚拢水面抢食 / 强水流冲到水面带 / 水温过高暂时到水面 / 鱼苗自然集群于水面** → 不可直接告警\n- 水面波纹过大 / 水草浮于水面遮挡 / 跟踪率 < 80% → 必须返回 `gasping_signal_unreliable` 并建议调整摄像头/清理水面遮挡\n- 必须告知用户：AI 视觉识别仅供参考，**最终诊断与处理需用户立即检测水质并由专业兽医/水产技术员确认**\n\n## 输出报告字段\n\n- `report_date` - 报告日期\n- `tank_id` - 鱼缸/养殖池 ID\n- `species` - 鱼种\n- `total_fish_count_baseline` - 注册总鱼数\n- `multi_fish_gasping_count` - 同时浮头鱼数\n- `multi_fish_gasping_duration_seconds` - 多鱼同时异常持续时长\n- `mouth_opening_frequency_hz` - 口开合频率\n- `operculum_gill_beat_amplitude_normalized` - 鳃盖幅度\n- `composite_scene` - 综合判定\n- `alert_level` - 告警等级\n- `recommended_actions` - 建议动作（**测水质 NH3/NO2-/DO/pH + 增氧 + 换水 + 检查滤材 + 联系兽医**，绝不含具体药物）\n- `disclaimer` - 免责声明\n\nFile v1.0.12:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.12:scripts/config.yaml\n\n{}\n\nFile v1.0.12:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.12:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.12:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.12:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: dev\n\nFile v1.0.12:skill-card.md\n\n## Description:\n\nAnalyzes aquarium camera images or videos for fish gasping, rapid mouth movement, and increased gill-cover movement to produce an ammonia poisoning or hypoxia risk warning.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[18072937735](https://clawhub.ai/user/18072937735)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nAquarium owners, aquaculture operators, public aquarium staff, and developers use this skill to analyze fixed-camera aquarium footage for visual warning signs of fish gasping, abnormal respiration, and possible water-quality emergencies. The output supports timely water testing, aeration, water-change decisions, and escalation to qualified aquatic health professionals without presenting a definitive disease diagnosis.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Aquarium videos or URLs are sent to the publisher's remote service and resulting cloud reports may be associated with a generated or reused local identity.\n\nMitigation: Use only authorized aquarium media, avoid sensitive environments unless approved, and confirm the publisher's data handling terms before installation or use.\n\nRisk: The package can create local workspace data and store service tokens in SQLite.\n\nMitigation: Run it in an isolated workspace, review local data storage before and after use, and remove or rotate stored credentials when the skill is no longer needed.\n\nRisk: The release is configured to call development or private HTTP endpoints.\n\nMitigation: Review and replace endpoint configuration with approved production endpoints before using the skill in a normal deployment.\n\nRisk: The security verdict is suspicious and requires review before installation.\n\nMitigation: Perform governance, security, and configuration review before deploying the skill or allowing it to process user media.\n\n## Reference(s):\n\n- [Skill page](https://clawhub.ai/18072937735/skills/smyx-fish-gasping-ammonia-warning-analysis)\n- [Aquarium warning API documentation](references/api_doc.md)\n- [Shared analysis API documentation](skills/smyx_analysis/references/api_doc.md)\n- [Skill demo](https://lifeemergence.com/sample.html)\n\n## Skill Output:\n\n**Output Type(s):** [Text, Markdown, JSON, Guidance]\n\n**Output Format:** [Markdown text with structured JSON analysis content, warning guidance, and report links]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [May optionally save the rendered analysis output to a user-specified file.]\n\n## Skill Version(s):\n\n1.0.12 (source: server release evidence; artifact frontmatter lists 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: 31 files, 45465 bytes\n\nFiles: references/api_doc.md (7619b), scripts/__init__.py (66b), scripts/config.py (708b), scripts/config.yaml (3b), scripts/skill.py (600b), scripts/smyx_fish_gasping_ammonia_warning_analysis.py (3764b), skill-card.md (3209b), SKILL.md (18165b), 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 (162b)\n\nFile v1.0.11:SKILL.md\n\n---\nname: \"smyx-fish-gasping-ammonia-warning-analysis\"\ndescription: \"Through fixed aquarium cameras, the system analyzes fish behavior near the water surface, detecting repeated mouth-out-of-water (gasping), rapid mouth opening/closing (fast respiration) and exaggerated operculum (gill cover) movement — classic symptoms of hypoxia or poisoning. | 通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。\"\nversion: \"1.0.10\"\nlicense: \"MIT-0\"\n---\n\n# ⚠️ Fish Gasping & Ammonia Poisoning Visual Warning | 水族箱内氨氮中毒视觉预兆（鱼浮头）\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **水族箱内氨氮中毒视觉预兆（鱼浮头）** |\n| 🎯 核心目标 | 通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_FISH_GASPING_AMMONIA_WARNING_ANALYSIS` |\n\nThrough fixed aquarium cameras, the system analyzes fish behavior near the water surface, detecting repeated mouth-out-of-water (gasping), rapid mouth opening/closing (fast respiration) and exaggerated operculum (gill cover) movement — classic symptoms of hypoxia or poisoning. When multiple fish exhibit the above behavior simultaneously and the duration exceeds a configurable threshold (default 60 seconds), the system outputs an 'ammonia poisoning or hypoxia risk warning', prompting the user to immediately test water quality, perform water change, or increase aeration. This skill helps take emergency action BEFORE fish die. Application scenarios: home aquariums, public aquariums, aquaculture ponds. The system monitors in real time and pushes alerts the moment fish gasping is detected. Skill features: ammonia poisoning is a common acute emergency in aquariums — by the time it is noticed, fish deaths may have already occurred. AI-based automatic recognition of gasping and abnormal respiration provides emergency warning at the earliest stage, buying time to handle the situation and reduce losses. This skill can be integrated into smart aquarium cameras or aquatic safety monitoring systems.\n\n通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。该技能有助于在鱼只死亡前采取紧急措施。应用场景：家庭鱼缸、水族馆、养殖池。系统实时监测，一旦发现鱼浮头立即推送警报。技能特点：氨氮中毒是鱼缸常见急症，往往在检测到前已造成鱼只死亡。通过 AI 自动识别鱼浮头和异常呼吸，可在事发初期紧急提醒，为处理争取时间，减少损失。该技能可集成到智能鱼缸摄像头或水族安防系统中。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的水族水质安全 AI。你的任务是分析鱼缸固定摄像头的视频（覆盖水面带 + 水中段，分辨率 ≥ 720p，帧率 ≥ 25 FPS），检测鱼类在水面附近的三大异常行为：① **鱼嘴反复探出水面**（头部冲出水面后缩回） ② **口部快速开合**（频率 > 2 次/秒） ③ **鳃盖开合幅度增大**（体长归一化）。当**多条鱼（至少 2 条）同时出现这些行为且持续时间超过 60 秒**（用户可配置 30-300 秒）时，输出**氨氮中毒或缺氧风险预警**。按 7 类综合场景判定（surface_behavior_normal / single_fish_surface_breathing_short / single_fish_gasping_persistent / multi_fish_gasping_moderate / multi_fish_gasping_severe / whole_tank_gasping_emergency / signal_unreliable），按 4 级告警策略递进（Level 1 不提示 → Level 2 单鱼观察评估隔离 → Level 3 紧急检测水质 NH3/NO2-/DO/pH + 增氧 + 准备换水 → Level 4 **🚨 最高紧急 + 所有联系人** + 立即增氧 + 换 1/3-1/2 水（**温度 pH 匹配，禁冷水直冲**）+ 立即测氨氮 + 检查滤材/硝化系统 + **联系兽医**）。鱼种特异性必须按基线判定：**气呼吸鱼种**（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼）天然偶尔到水面换气、**水面摄食型**（孔雀鱼 / 鳉鱼科）天然偏好水面 → **严禁通用阈值盲判气呼吸鱼种为浮头**。必须考虑生理性上下文（投喂窗口聚拢水面抢食 / 强水流 / 水温过高 / 鱼苗自然集群水面），避免误报。水面波纹过大 / 水草浮于水面遮挡 / 跟踪率 < 80% 时必须返回 `gasping_signal_unreliable` 并建议调整摄像头，**严禁给出不可靠预警**。**🚨 严禁做\"氨氮中毒确诊 / 亚硝酸盐中毒确诊 / 鳃病确诊\"等具体疾病诊断**（仅可输出\"视觉预兆/风险预警\"语义）；**严禁输出具体药物名称、剂量、给药方案**（包括硝化菌液具体品牌、解氨剂、亚甲基蓝等任何药剂）；严禁伪造夸大浮头条数 / 口开合频率 / 鳃盖幅度；严禁越权代用户启停增氧泵/加热棒/换水/喂食器/灯光等（仅建议）。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于鱼缸固定摄像头 / 水族馆侧面观察摄像头 / 养殖池水面摄像头**实时视频**（默认 60 秒滚动窗口，用户可配置 30-300 秒），识别 7 类综合场景（surface_behavior_normal / single_fish_surface_breathing_short / single_fish_gasping_persistent / multi_fish_gasping_moderate / multi_fish_gasping_severe / whole_tank_gasping_emergency / gasping_signal_unreliable）→ **四组指标**：浮头行为 4 项（水面带鱼数 / 嘴穿出水面鱼数 / 浮头比例 / 每分钟浮头事件数）+ 呼吸异常 4 项（口开合 Hz / 口张幅度 / 鳃盖幅度 / 鳃盖呼吸 BPM）+ 群体异常 4 项（注册总鱼数 / 同时浮头鱼数 / 持续时长秒 / 氧气泵是否运行）+ 排除上下文 5 项（气呼吸鱼种 / 投喂期 / 水面摄食鱼种 / 水面扰动 / 水草浮面）→ 4 档告警级别（none → important → urgent → critical）→ **4 级告警策略递进**（不提示 → 单鱼观察评估隔离 → 紧急测水质+增氧+准备换水 → 🚨 最高紧急+所有联系人+立即换水（温度 pH 匹配）+测氨氮+检查滤材+联系兽医）→ 单日告警上限（Level 1 不限 / Level 2 × 4 / Level 3 × 6 / Level 4 **不设上限**）→ **预警报告**（按 tank_id 输出，含浮头鱼条数/持续时长/口开合频率/鳃盖幅度 + 建议动作 + 免责声明）\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 鱼缸水面带分割 |\n| 2 | 鱼体目标检测 + 多目标跟踪 |\n| 3 | **水面穿透事件检测**（鱼头穿出水面/缩回的关键事件帧） |\n| 4 | 口部关键点检测 + 开合频率估计（FFT/峰值法） |\n| 5 | 鳃盖开合幅度估计（体长归一化） |\n| 6 | 多鱼并发计数与持续时长累计（跨帧累积） |\n| 7 | 鱼种自适应基线（气呼吸 / 水面摄食 / 中下层 / 底栖） |\n| 8 | 生理性上下文识别（投喂期 / 水流 / 水温 / 鱼苗） |\n| 9 | 波纹/水草遮挡门控（跟踪率 < 80% 返回 unreliable） |\n| 10 | 用户 APP 紧急推送 |\n| 11 | 4 级告警递进 |\n| 12 | 单日告警上限（**Level 4 不设上限**） |\n| 13 | 预警报告（按 tank_id + 事件时间戳输出） |\n| 14 | 连续 ≥ 2 次 Level 3+ → 强烈建议联系**当地观赏鱼兽医或水产技术员** |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供鱼缸固定摄像头视频 URL 或文件需要分析时，默认触发本技能进行水族箱氨氮中毒视觉预兆识别 |\n| 🔎 明确分析意图 | 当用户明确提及鱼浮头、鱼喘气、鱼集体上水面、鱼缸氨氮、鱼缸缺氧、亚硝酸盐爆表、鱼鳃异常呼吸、硝化系统崩溃等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看鱼缸浮头历史报告、氨氮预警日志清单、缺氧事件清单、查询历史鱼缸预警记录、显示所有水族安防预警报告 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_fish_gasping_ammonia_warning_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备鱼缸固定摄像头视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 获取 open-id（强制执行） | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行水族箱氨氮中毒视觉预兆识别 | 调用 `-m scripts.smyx_fish_gasping_ammonia_warning_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地鱼缸固定摄像头视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络鱼缸固定摄像头视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，水族箱氨氮中毒视觉预兆场景默认 `other` | 按需填写 |\n| `--list` | 显示水族箱氨氮中毒视觉预兆历史记录清单 | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_fish_gasping_ammonia_warning_analysis.py`](scripts/smyx_fish_gasping_ammonia_warning_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；摄像头需**同时覆盖水面带和水中段**；**帧率 ≥ 25 FPS**；默认 60s 滚动窗口 |\n| 🔎 使用提醒 | **核心采样窗口**：60 秒滚动窗口（用户可配置 30-300 秒） |\n| 🔎 使用提醒 | **核心预警门槛**：**多鱼（≥ 2 条）同时浮头持续 ≥ 60 秒** 触发 Level 3+ 告警 |\n| 🔎 使用提醒 | **4 级告警策略递进**（none → important → urgent → critical），多鱼/全缸/持续超长进入更高级别 |\n| 🔎 使用提醒 | 单日告警上限：Level 1 不限 / Level 2 × 4 / Level 3 × 6 / Level 4 **不设上限**（生命安全优先） |\n| 🔎 使用提醒 | 红线约束 |\n| 🧑‍⚖️ 结果性质 | **🚨 禁止**做\"氨氮中毒确诊 / 亚硝酸盐中毒确诊 / 鳃病确诊 / 寄生虫确诊\"等具体疾病诊断（仅可输出\"视觉预兆/风险预警\"语义） |\n| 🔎 使用提醒 | **🚨 绝对禁止**输出具体药物名称、剂量、给药方案（特别**严禁推荐硝化菌液具体品牌、解氨剂、亚甲基蓝等任何药剂**） |\n| 🔎 使用提醒 | **禁止**长期存储完整鱼缸视频（≤ 7 天，仅入库浮头事件片段；公共水族馆/养殖场按管理规定） |\n| 🔎 使用提醒 | **禁止**用于商业广告 / AI 训练；禁第三方共享 |\n| 🔎 使用提醒 | **禁止**越权代用户启停增氧泵 / 加热棒 / 换水 / 投药 / 灯光参数；**任何水族设备控制变更必须由用户确认**（仅可建议） |\n| 🔎 使用提醒 | **绝对禁止**伪造或夸大浮头条数、口开合频率、鳃盖幅度、持续时长等指标；所有数据必须基于真实视频帧分析 |\n| 🔎 使用提醒 | **必须**按**鱼种基线**判定：**气呼吸鱼种（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼）天然偶尔到水面换气** + **水面摄食型（孔雀鱼 / 鳉鱼科）天然偏好水面** → 严禁通用阈值盲判 |\n| 📚 文档读取 | **必须**考虑生理性上下文（投喂窗口聚拢水面抢食 / 强水流冲到水面 / 水温过高 / 鱼苗自然集群水面），避免误报 |\n| 🔎 使用提醒 | **必须**在水面波纹过大 / 水草浮于水面遮挡 / 跟踪率 < 80% 时返回 `gasping_signal_unreliable` 并建议调整摄像头/清理遮挡，**禁止给出不可靠的预警** |\n| 🔎 使用提醒 | **必须**在 Level 4 紧急换水建议中明确：**温度 pH 匹配，禁冷水直冲** |\n| 🔎 使用提醒 | **必须**：连续 ≥ 2 次 Level 3+ → 强烈建议联系**当地观赏鱼兽医或水产技术员** |\n| 📜 报告输出 | **必须**：预警报告**按 tank_id + 事件时间戳输出**，含浮头鱼条数 + 持续时长 + 口开合频率 + 鳃盖幅度 + 建议动作 + 免责声明 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史浮头预警记录清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地鱼缸固定摄像头视频（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input /path/to/tank.mp4\n\n# 分析网络鱼缸固定摄像头视频/实时流（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --url https://example.com/tank.mp4\n\n# 显示历史浮头预警记录清单（自动触发关键词：查看鱼缸浮头历史报告、氨氮预警日志清单等）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input tank.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input tank.mp4 --output result.json\n```\n\nFile v1.0.11:_meta.json\n\n{\n  \"ownerId\": \"kn7e2caqj7pnsvr9r7t8zenghs83xw7n\",\n  \"slug\": \"smyx-fish-gasping-ammonia-warning-analysis\",\n  \"version\": \"1.0.11\",\n  \"publishedAt\": 1786732777238\n}\n\nFile v1.0.11:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放水族箱内氨氮中毒视觉预兆（鱼浮头）API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动鱼浮头/缺氧/氨氮中毒视觉预兆识别任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取预警结果（浮头条数、口开合频率、鳃盖幅度、持续时长）\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史预警报告\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出预警报告\n5. （可选）`/web/companion/v2/trigger-soothing-action` - 触发联动告警（用户 APP 紧急推送 / 智能鱼缸警报灯 / 建议立即增氧/换水/检测氨氮）\n\n## 场景代码\n\n- `SMYX_FISH_GASPING_AMMONIA_WARNING_ANALYSIS` - 水族箱内氨氮中毒视觉预兆（鱼浮头）\n\n## 输入约束\n\n- 摄像头：鱼缸固定摄像头 / 水族馆侧面观察摄像头 / 养殖池水面摄像头，**必须同时覆盖水面带和水中段**（鱼浮头是水面行为）\n- 分辨率 ≥ 720p；**帧率 ≥ 25 FPS**（口部开合频率检测需 ≥ 2 Hz）\n- 光照：建议鱼缸照明常开 + 无强反光；**水面波纹大可能误判，必须做光流稳定**\n- **核心采样窗口**：默认 60 秒滚动窗口（用户可配置 30 - 300 秒）\n- 视野约束：必须覆盖**水面完整投影**（任何水面盲区都可能漏判浮头）\n- 多鱼缸/池场景按摄像头 ID 绑定到注册容器 ID\n- **部署时必须录入**：鱼种、缸内总鱼数 N、鱼缸尺寸、是否开启氧气泵/过滤器（用于上下文加权）\n- 用户必须授权部署；公共水族馆 / 养殖场需公示告知\n\n## 关键观测信号\n\n### 浮头行为信号（核心）\n- `fish_at_surface_count` - 当前帧水面带（水面下 0-1 个体长）内的鱼数\n- `fish_breaking_surface_count` - **检测到鱼嘴穿出水面**的鱼数（核心强信号）\n- `fish_breaking_surface_ratio` - 浮头鱼数占总鱼数比例\n- `surface_breaking_events_per_minute` - 每分钟浮头事件数（同条鱼反复探出累计）\n\n### 呼吸异常信号\n- `mouth_opening_frequency_hz` - **口部开合频率（Hz / 次/秒）**（异常阈值 > 2 Hz）\n- `mouth_opening_amplitude_normalized` - 口张开幅度（体长归一化）\n- `operculum_gill_beat_amplitude_normalized` - **鳃盖开合幅度**（体长归一化，异常增大）\n- `operculum_gill_beat_rate_bpm` - 鳃盖呼吸频率（次/分钟，可与 respiratory_rate 技能交叉验证）\n\n### 群体异常信号\n- `total_fish_count_baseline` - 注册总鱼数\n- `multi_fish_gasping_count` - **同时出现浮头/喘气的鱼数**（≥ 2 条为预警门槛）\n- `multi_fish_gasping_duration_seconds` - 多鱼同时异常持续时长（≥ 60s 为核心预警阈值）\n- `tank_oxygen_pump_running` - 氧气泵是否运行（如运行仍多鱼浮头，氨氮中毒怀疑度更高）\n\n### 上下文与排除信号（避免误报）\n- `is_air_breathing_species` - **是否能用气呼吸鱼种**（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼天然偶尔到水面换气）\n- `is_during_feeding` - 是否在投喂窗口内（生理性聚拢水面抢食非浮头）\n- `is_surface_feeding_species` - 是否水面摄食型（孔雀鱼 / 鳉鱼科偏好水面）\n- `water_surface_disturbance_level` - 水面扰动程度（强水流可能误判）\n- `aquatic_plant_floating_at_surface` - 是否水草浮于水面（遮挡可能漏检）\n\n## 综合判定\n\n- `surface_behavior_normal` - 水面行为正常\n- `single_fish_surface_breathing_short` - 单条鱼短暂到水面换气（气呼吸鱼种正常 / 投喂期）\n- `single_fish_gasping_persistent` - 单条鱼持续浮头喘气（疑似该个体不适，非全缸问题）\n- `multi_fish_gasping_moderate` - **多鱼同时浮头（≥ 2 条，持续 30-60s）**：早期预警\n- `multi_fish_gasping_severe` - **多鱼同时浮头（≥ 2 条，持续 ≥ 60s）**：氨氮中毒/缺氧风险预警（核心）\n- `whole_tank_gasping_emergency` - **全缸鱼同时浮头（≥ 80%，持续 ≥ 30s）**：紧急中毒事件\n- `gasping_signal_unreliable` - 信号不可靠（水面波纹过大 / 水草遮挡 / 跟踪率 < 80%）\n\n## 4 级告警策略递进\n\n- Level 1（surface_behavior_normal / single_fish_surface_breathing_short）：仅入库或不提示\n- Level 2（single_fish_gasping_persistent）：用户 APP 重要提示，建议**单独观察该鱼，评估是否隔离至检疫缸**\n- Level 3（multi_fish_gasping_moderate）：紧急告警，建议**立即检测水质（氨氮 NH3/NH4+、亚硝酸盐 NO2-、pH、溶氧 DO、温度）+ 立即开启/加强增氧 + 准备换水**\n- Level 4（multi_fish_gasping_severe / whole_tank_gasping_emergency）：**🚨 最高紧急告警 + 推送家庭/管理人员所有联系人** + 强烈建议**立即采取多措并举**：① 立即开足增氧泵/加气盘 ② 立即换 1/3~1/2 水（**温度 pH 匹配，禁止冷水直冲**） ③ 立即检测氨氮 NH3/亚硝酸盐 NO2- ④ 检查滤材是否堵塞/硝化系统是否崩溃 ⑤ **联系当地观赏鱼兽医或水产技术员**\n\n## 单日告警上限\n\n- Level 1 不限 / Level 2 × 4 / Level 3 × 6（紧急事件可能密集）/ Level 4 **不设上限**（生命安全优先）\n\n## 红线约束\n\n- **🚨 禁止**做\"氨氮中毒确诊 / 亚硝酸盐中毒确诊 / 鳃病确诊 / 寄生虫确诊\"等**具体疾病诊断**（仅可输出\"视觉预兆/风险预警\"语义）\n- **🚨 绝对禁止**输出具体药物名称、剂量、给药方案（**严禁推荐硝化菌液具体品牌、解氨剂、亚甲基蓝等任何药剂**）\n- **禁止**长期存储完整鱼缸视频（≤ 7 天，仅入库浮头事件片段；公共水族馆/养殖场按管理规定）\n- **禁止**用于商业广告 / AI 训练；禁第三方共享\n- **禁止**越权代用户启停增氧泵 / 加热棒 / 换水 / 投药 / 灯光参数；**任何水族设备控制变更必须由用户确认**（仅可建议）\n- 浮头条数、口开合频率、鳃盖幅度等指标必须基于真实视频帧分析；**禁止伪造或夸大指标**\n- 鱼种特异性：**气呼吸鱼种**（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼）天然偶尔到水面换气、**水面摄食鱼**（孔雀鱼 / 鳉鱼科）天然偏好水面 → 必须按鱼种基线判定；**严禁通用阈值盲判气呼吸鱼种为浮头**\n- 必须考虑生理性上下文：**投喂窗口聚拢水面抢食 / 强水流冲到水面带 / 水温过高暂时到水面 / 鱼苗自然集群于水面** → 不可直接告警\n- 水面波纹过大 / 水草浮于水面遮挡 / 跟踪率 < 80% → 必须返回 `gasping_signal_unreliable` 并建议调整摄像头/清理水面遮挡\n- 必须告知用户：AI 视觉识别仅供参考，**最终诊断与处理需用户立即检测水质并由专业兽医/水产技术员确认**\n\n## 输出报告字段\n\n- `report_date` - 报告日期\n- `tank_id` - 鱼缸/养殖池 ID\n- `species` - 鱼种\n- `total_fish_count_baseline` - 注册总鱼数\n- `multi_fish_gasping_count` - 同时浮头鱼数\n- `multi_fish_gasping_duration_seconds` - 多鱼同时异常持续时长\n- `mouth_opening_frequency_hz` - 口开合频率\n- `operculum_gill_beat_amplitude_normalized` - 鳃盖幅度\n- `composite_scene` - 综合判定\n- `alert_level` - 告警等级\n- `recommended_actions` - 建议动作（**测水质 NH3/NO2-/DO/pH + 增氧 + 换水 + 检查滤材 + 联系兽医**，绝不含具体药物）\n- `disclaimer` - 免责声明\n\nFile v1.0.11:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.11:scripts/config.yaml\n\n{}\n\nFile v1.0.11:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.11:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.11:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.11:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: dev\n\nFile v1.0.11:skill-card.md\n\n## Description:\n\nAnalyzes aquarium camera images or videos for fish gasping, rapid mouth movement, and exaggerated gill movement, then produces a visual risk warning for possible hypoxia or ammonia-related water quality issues.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[18072937735](https://clawhub.ai/user/18072937735)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nAquarium owners, public aquarium operators, aquaculture staff, and developers can use this skill to review fixed-camera footage for early visual warning signs of fish gasping or abnormal respiration. The output supports urgent water-quality checks, aeration, water-change planning, and escalation to aquatic specialists without presenting the result as a medical diagnosis.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: Aquarium videos or URLs are sent to LifeEmergence remote services for analysis.\n\nMitigation: Use only media the user is authorized to submit, confirm consent before deployment, and document which remote endpoints receive video or URL data.\n\nRisk: The skill may silently create or reuse an internal identity and store returned tokens in a local SQLite database.\n\nMitigation: Review token storage and deletion behavior before installation, restrict workspace access to the database, and provide clear user-facing consent and retention documentation.\n\nRisk: A visual warning could be mistaken for a diagnosis of ammonia poisoning, nitrite poisoning, gill disease, or another specific condition.\n\nMitigation: Present outputs as visual risk warnings only, require immediate water-quality testing, and recommend confirmation by a qualified aquarium veterinarian or aquaculture technician.\n\nRisk: Camera coverage, water-surface disturbance, floating plants, tracking failures, feeding behavior, or air-breathing fish species can make gasping detection unreliable.\n\nMitigation: Require suitable camera coverage and frame rate, apply species and feeding-context baselines, and return an unreliable-signal result when tracking quality or visibility is insufficient.\n\n## Reference(s):\n\n- [ClawHub Skill Page](https://clawhub.ai/18072937735/skills/smyx-fish-gasping-ammonia-warning-analysis)\n- [Publisher Profile](https://clawhub.ai/user/18072937735)\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, shell commands, configuration, guidance]\n\n**Output Format:** [Markdown or JSON reports with warning levels, observed fish behavior metrics, recommended actions, disclaimers, and report links.]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Can save report output to a user-specified file; history queries return Markdown tables derived from the remote service.]\n\n## Skill Version(s):\n\n1.0.11 (source: server-resolved release metadata; artifact frontmatter is 1.0.10)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.\n\nFile v1.0.11:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.11:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.10: 31 files, 45235 bytes\n\nFiles: references/api_doc.md (7619b), scripts/__init__.py (66b), scripts/config.py (708b), scripts/config.yaml (3b), scripts/skill.py (600b), scripts/smyx_fish_gasping_ammonia_warning_analysis.py (3764b), skill-card.md (2862b), SKILL.md (18164b), 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 (162b)\n\nFile v1.0.10:SKILL.md\n\n---\nname: \"smyx-fish-gasping-ammonia-warning-analysis\"\ndescription: \"Through fixed aquarium cameras, the system analyzes fish behavior near the water surface, detecting repeated mouth-out-of-water (gasping), rapid mouth opening/closing (fast respiration) and exaggerated operculum (gill cover) movement — classic symptoms of hypoxia or poisoning. | 通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。\"\nversion: \"1.0.9\"\nlicense: \"MIT-0\"\n---\n\n# ⚠️ Fish Gasping & Ammonia Poisoning Visual Warning | 水族箱内氨氮中毒视觉预兆（鱼浮头）\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **水族箱内氨氮中毒视觉预兆（鱼浮头）** |\n| 🎯 核心目标 | 通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_FISH_GASPING_AMMONIA_WARNING_ANALYSIS` |\n\nThrough fixed aquarium cameras, the system analyzes fish behavior near the water surface, detecting repeated mouth-out-of-water (gasping), rapid mouth opening/closing (fast respiration) and exaggerated operculum (gill cover) movement — classic symptoms of hypoxia or poisoning. When multiple fish exhibit the above behavior simultaneously and the duration exceeds a configurable threshold (default 60 seconds), the system outputs an 'ammonia poisoning or hypoxia risk warning', prompting the user to immediately test water quality, perform water change, or increase aeration. This skill helps take emergency action BEFORE fish die. Application scenarios: home aquariums, public aquariums, aquaculture ponds. The system monitors in real time and pushes alerts the moment fish gasping is detected. Skill features: ammonia poisoning is a common acute emergency in aquariums — by the time it is noticed, fish deaths may have already occurred. AI-based automatic recognition of gasping and abnormal respiration provides emergency warning at the earliest stage, buying time to handle the situation and reduce losses. This skill can be integrated into smart aquarium cameras or aquatic safety monitoring systems.\n\n通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。该技能有助于在鱼只死亡前采取紧急措施。应用场景：家庭鱼缸、水族馆、养殖池。系统实时监测，一旦发现鱼浮头立即推送警报。技能特点：氨氮中毒是鱼缸常见急症，往往在检测到前已造成鱼只死亡。通过 AI 自动识别鱼浮头和异常呼吸，可在事发初期紧急提醒，为处理争取时间，减少损失。该技能可集成到智能鱼缸摄像头或水族安防系统中。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的水族水质安全 AI。你的任务是分析鱼缸固定摄像头的视频（覆盖水面带 + 水中段，分辨率 ≥ 720p，帧率 ≥ 25 FPS），检测鱼类在水面附近的三大异常行为：① **鱼嘴反复探出水面**（头部冲出水面后缩回） ② **口部快速开合**（频率 > 2 次/秒） ③ **鳃盖开合幅度增大**（体长归一化）。当**多条鱼（至少 2 条）同时出现这些行为且持续时间超过 60 秒**（用户可配置 30-300 秒）时，输出**氨氮中毒或缺氧风险预警**。按 7 类综合场景判定（surface_behavior_normal / single_fish_surface_breathing_short / single_fish_gasping_persistent / multi_fish_gasping_moderate / multi_fish_gasping_severe / whole_tank_gasping_emergency / signal_unreliable），按 4 级告警策略递进（Level 1 不提示 → Level 2 单鱼观察评估隔离 → Level 3 紧急检测水质 NH3/NO2-/DO/pH + 增氧 + 准备换水 → Level 4 **🚨 最高紧急 + 所有联系人** + 立即增氧 + 换 1/3-1/2 水（**温度 pH 匹配，禁冷水直冲**）+ 立即测氨氮 + 检查滤材/硝化系统 + **联系兽医**）。鱼种特异性必须按基线判定：**气呼吸鱼种**（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼）天然偶尔到水面换气、**水面摄食型**（孔雀鱼 / 鳉鱼科）天然偏好水面 → **严禁通用阈值盲判气呼吸鱼种为浮头**。必须考虑生理性上下文（投喂窗口聚拢水面抢食 / 强水流 / 水温过高 / 鱼苗自然集群水面），避免误报。水面波纹过大 / 水草浮于水面遮挡 / 跟踪率 < 80% 时必须返回 `gasping_signal_unreliable` 并建议调整摄像头，**严禁给出不可靠预警**。**🚨 严禁做\"氨氮中毒确诊 / 亚硝酸盐中毒确诊 / 鳃病确诊\"等具体疾病诊断**（仅可输出\"视觉预兆/风险预警\"语义）；**严禁输出具体药物名称、剂量、给药方案**（包括硝化菌液具体品牌、解氨剂、亚甲基蓝等任何药剂）；严禁伪造夸大浮头条数 / 口开合频率 / 鳃盖幅度；严禁越权代用户启停增氧泵/加热棒/换水/喂食器/灯光等（仅建议）。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于鱼缸固定摄像头 / 水族馆侧面观察摄像头 / 养殖池水面摄像头**实时视频**（默认 60 秒滚动窗口，用户可配置 30-300 秒），识别 7 类综合场景（surface_behavior_normal / single_fish_surface_breathing_short / single_fish_gasping_persistent / multi_fish_gasping_moderate / multi_fish_gasping_severe / whole_tank_gasping_emergency / gasping_signal_unreliable）→ **四组指标**：浮头行为 4 项（水面带鱼数 / 嘴穿出水面鱼数 / 浮头比例 / 每分钟浮头事件数）+ 呼吸异常 4 项（口开合 Hz / 口张幅度 / 鳃盖幅度 / 鳃盖呼吸 BPM）+ 群体异常 4 项（注册总鱼数 / 同时浮头鱼数 / 持续时长秒 / 氧气泵是否运行）+ 排除上下文 5 项（气呼吸鱼种 / 投喂期 / 水面摄食鱼种 / 水面扰动 / 水草浮面）→ 4 档告警级别（none → important → urgent → critical）→ **4 级告警策略递进**（不提示 → 单鱼观察评估隔离 → 紧急测水质+增氧+准备换水 → 🚨 最高紧急+所有联系人+立即换水（温度 pH 匹配）+测氨氮+检查滤材+联系兽医）→ 单日告警上限（Level 1 不限 / Level 2 × 4 / Level 3 × 6 / Level 4 **不设上限**）→ **预警报告**（按 tank_id 输出，含浮头鱼条数/持续时长/口开合频率/鳃盖幅度 + 建议动作 + 免责声明）\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 鱼缸水面带分割 |\n| 2 | 鱼体目标检测 + 多目标跟踪 |\n| 3 | **水面穿透事件检测**（鱼头穿出水面/缩回的关键事件帧） |\n| 4 | 口部关键点检测 + 开合频率估计（FFT/峰值法） |\n| 5 | 鳃盖开合幅度估计（体长归一化） |\n| 6 | 多鱼并发计数与持续时长累计（跨帧累积） |\n| 7 | 鱼种自适应基线（气呼吸 / 水面摄食 / 中下层 / 底栖） |\n| 8 | 生理性上下文识别（投喂期 / 水流 / 水温 / 鱼苗） |\n| 9 | 波纹/水草遮挡门控（跟踪率 < 80% 返回 unreliable） |\n| 10 | 用户 APP 紧急推送 |\n| 11 | 4 级告警递进 |\n| 12 | 单日告警上限（**Level 4 不设上限**） |\n| 13 | 预警报告（按 tank_id + 事件时间戳输出） |\n| 14 | 连续 ≥ 2 次 Level 3+ → 强烈建议联系**当地观赏鱼兽医或水产技术员** |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供鱼缸固定摄像头视频 URL 或文件需要分析时，默认触发本技能进行水族箱氨氮中毒视觉预兆识别 |\n| 🔎 明确分析意图 | 当用户明确提及鱼浮头、鱼喘气、鱼集体上水面、鱼缸氨氮、鱼缸缺氧、亚硝酸盐爆表、鱼鳃异常呼吸、硝化系统崩溃等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看鱼缸浮头历史报告、氨氮预警日志清单、缺氧事件清单、查询历史鱼缸预警记录、显示所有水族安防预警报告 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_fish_gasping_ammonia_warning_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备鱼缸固定摄像头视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 获取 open-id（强制执行） | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行水族箱氨氮中毒视觉预兆识别 | 调用 `-m scripts.smyx_fish_gasping_ammonia_warning_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地鱼缸固定摄像头视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络鱼缸固定摄像头视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，水族箱氨氮中毒视觉预兆场景默认 `other` | 按需填写 |\n| `--list` | 显示水族箱氨氮中毒视觉预兆历史记录清单 | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_fish_gasping_ammonia_warning_analysis.py`](scripts/smyx_fish_gasping_ammonia_warning_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；摄像头需**同时覆盖水面带和水中段**；**帧率 ≥ 25 FPS**；默认 60s 滚动窗口 |\n| 🔎 使用提醒 | **核心采样窗口**：60 秒滚动窗口（用户可配置 30-300 秒） |\n| 🔎 使用提醒 | **核心预警门槛**：**多鱼（≥ 2 条）同时浮头持续 ≥ 60 秒** 触发 Level 3+ 告警 |\n| 🔎 使用提醒 | **4 级告警策略递进**（none → important → urgent → critical），多鱼/全缸/持续超长进入更高级别 |\n| 🔎 使用提醒 | 单日告警上限：Level 1 不限 / Level 2 × 4 / Level 3 × 6 / Level 4 **不设上限**（生命安全优先） |\n| 🔎 使用提醒 | 红线约束 |\n| 🧑‍⚖️ 结果性质 | **🚨 禁止**做\"氨氮中毒确诊 / 亚硝酸盐中毒确诊 / 鳃病确诊 / 寄生虫确诊\"等具体疾病诊断（仅可输出\"视觉预兆/风险预警\"语义） |\n| 🔎 使用提醒 | **🚨 绝对禁止**输出具体药物名称、剂量、给药方案（特别**严禁推荐硝化菌液具体品牌、解氨剂、亚甲基蓝等任何药剂**） |\n| 🔎 使用提醒 | **禁止**长期存储完整鱼缸视频（≤ 7 天，仅入库浮头事件片段；公共水族馆/养殖场按管理规定） |\n| 🔎 使用提醒 | **禁止**用于商业广告 / AI 训练；禁第三方共享 |\n| 🔎 使用提醒 | **禁止**越权代用户启停增氧泵 / 加热棒 / 换水 / 投药 / 灯光参数；**任何水族设备控制变更必须由用户确认**（仅可建议） |\n| 🔎 使用提醒 | **绝对禁止**伪造或夸大浮头条数、口开合频率、鳃盖幅度、持续时长等指标；所有数据必须基于真实视频帧分析 |\n| 🔎 使用提醒 | **必须**按**鱼种基线**判定：**气呼吸鱼种（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼）天然偶尔到水面换气** + **水面摄食型（孔雀鱼 / 鳉鱼科）天然偏好水面** → 严禁通用阈值盲判 |\n| 📚 文档读取 | **必须**考虑生理性上下文（投喂窗口聚拢水面抢食 / 强水流冲到水面 / 水温过高 / 鱼苗自然集群水面），避免误报 |\n| 🔎 使用提醒 | **必须**在水面波纹过大 / 水草浮于水面遮挡 / 跟踪率 < 80% 时返回 `gasping_signal_unreliable` 并建议调整摄像头/清理遮挡，**禁止给出不可靠的预警** |\n| 🔎 使用提醒 | **必须**在 Level 4 紧急换水建议中明确：**温度 pH 匹配，禁冷水直冲** |\n| 🔎 使用提醒 | **必须**：连续 ≥ 2 次 Level 3+ → 强烈建议联系**当地观赏鱼兽医或水产技术员** |\n| 📜 报告输出 | **必须**：预警报告**按 tank_id + 事件时间戳输出**，含浮头鱼条数 + 持续时长 + 口开合频率 + 鳃盖幅度 + 建议动作 + 免责声明 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史浮头预警记录清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地鱼缸固定摄像头视频（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input /path/to/tank.mp4\n\n# 分析网络鱼缸固定摄像头视频/实时流（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --url https://example.com/tank.mp4\n\n# 显示历史浮头预警记录清单（自动触发关键词：查看鱼缸浮头历史报告、氨氮预警日志清单等）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input tank.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input tank.mp4 --output result.json\n```\n\nFile v1.0.10:_meta.json\n\n{\n  \"ownerId\": \"kn7e2caqj7pnsvr9r7t8zenghs83xw7n\",\n  \"slug\": \"smyx-fish-gasping-ammonia-warning-analysis\",\n  \"version\": \"1.0.10\",\n  \"publishedAt\": 1785831215757\n}\n\nFile v1.0.10:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放水族箱内氨氮中毒视觉预兆（鱼浮头）API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动鱼浮头/缺氧/氨氮中毒视觉预兆识别任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取预警结果（浮头条数、口开合频率、鳃盖幅度、持续时长）\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史预警报告\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出预警报告\n5. （可选）`/web/companion/v2/trigger-soothing-action` - 触发联动告警（用户 APP 紧急推送 / 智能鱼缸警报灯 / 建议立即增氧/换水/检测氨氮）\n\n## 场景代码\n\n- `SMYX_FISH_GASPING_AMMONIA_WARNING_ANALYSIS` - 水族箱内氨氮中毒视觉预兆（鱼浮头）\n\n## 输入约束\n\n- 摄像头：鱼缸固定摄像头 / 水族馆侧面观察摄像头 / 养殖池水面摄像头，**必须同时覆盖水面带和水中段**（鱼浮头是水面行为）\n- 分辨率 ≥ 720p；**帧率 ≥ 25 FPS**（口部开合频率检测需 ≥ 2 Hz）\n- 光照：建议鱼缸照明常开 + 无强反光；**水面波纹大可能误判，必须做光流稳定**\n- **核心采样窗口**：默认 60 秒滚动窗口（用户可配置 30 - 300 秒）\n- 视野约束：必须覆盖**水面完整投影**（任何水面盲区都可能漏判浮头）\n- 多鱼缸/池场景按摄像头 ID 绑定到注册容器 ID\n- **部署时必须录入**：鱼种、缸内总鱼数 N、鱼缸尺寸、是否开启氧气泵/过滤器（用于上下文加权）\n- 用户必须授权部署；公共水族馆 / 养殖场需公示告知\n\n## 关键观测信号\n\n### 浮头行为信号（核心）\n- `fish_at_surface_count` - 当前帧水面带（水面下 0-1 个体长）内的鱼数\n- `fish_breaking_surface_count` - **检测到鱼嘴穿出水面**的鱼数（核心强信号）\n- `fish_breaking_surface_ratio` - 浮头鱼数占总鱼数比例\n- `surface_breaking_events_per_minute` - 每分钟浮头事件数（同条鱼反复探出累计）\n\n### 呼吸异常信号\n- `mouth_opening_frequency_hz` - **口部开合频率（Hz / 次/秒）**（异常阈值 > 2 Hz）\n- `mouth_opening_amplitude_normalized` - 口张开幅度（体长归一化）\n- `operculum_gill_beat_amplitude_normalized` - **鳃盖开合幅度**（体长归一化，异常增大）\n- `operculum_gill_beat_rate_bpm` - 鳃盖呼吸频率（次/分钟，可与 respiratory_rate 技能交叉验证）\n\n### 群体异常信号\n- `total_fish_count_baseline` - 注册总鱼数\n- `multi_fish_gasping_count` - **同时出现浮头/喘气的鱼数**（≥ 2 条为预警门槛）\n- `multi_fish_gasping_duration_seconds` - 多鱼同时异常持续时长（≥ 60s 为核心预警阈值）\n- `tank_oxygen_pump_running` - 氧气泵是否运行（如运行仍多鱼浮头，氨氮中毒怀疑度更高）\n\n### 上下文与排除信号（避免误报）\n- `is_air_breathing_species` - **是否能用气呼吸鱼种**（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼天然偶尔到水面换气）\n- `is_during_feeding` - 是否在投喂窗口内（生理性聚拢水面抢食非浮头）\n- `is_surface_feeding_species` - 是否水面摄食型（孔雀鱼 / 鳉鱼科偏好水面）\n- `water_surface_disturbance_level` - 水面扰动程度（强水流可能误判）\n- `aquatic_plant_floating_at_surface` - 是否水草浮于水面（遮挡可能漏检）\n\n## 综合判定\n\n- `surface_behavior_normal` - 水面行为正常\n- `single_fish_surface_breathing_short` - 单条鱼短暂到水面换气（气呼吸鱼种正常 / 投喂期）\n- `single_fish_gasping_persistent` - 单条鱼持续浮头喘气（疑似该个体不适，非全缸问题）\n- `multi_fish_gasping_moderate` - **多鱼同时浮头（≥ 2 条，持续 30-60s）**：早期预警\n- `multi_fish_gasping_severe` - **多鱼同时浮头（≥ 2 条，持续 ≥ 60s）**：氨氮中毒/缺氧风险预警（核心）\n- `whole_tank_gasping_emergency` - **全缸鱼同时浮头（≥ 80%，持续 ≥ 30s）**：紧急中毒事件\n- `gasping_signal_unreliable` - 信号不可靠（水面波纹过大 / 水草遮挡 / 跟踪率 < 80%）\n\n## 4 级告警策略递进\n\n- Level 1（surface_behavior_normal / single_fish_surface_breathing_short）：仅入库或不提示\n- Level 2（single_fish_gasping_persistent）：用户 APP 重要提示，建议**单独观察该鱼，评估是否隔离至检疫缸**\n- Level 3（multi_fish_gasping_moderate）：紧急告警，建议**立即检测水质（氨氮 NH3/NH4+、亚硝酸盐 NO2-、pH、溶氧 DO、温度）+ 立即开启/加强增氧 + 准备换水**\n- Level 4（multi_fish_gasping_severe / whole_tank_gasping_emergency）：**🚨 最高紧急告警 + 推送家庭/管理人员所有联系人** + 强烈建议**立即采取多措并举**：① 立即开足增氧泵/加气盘 ② 立即换 1/3~1/2 水（**温度 pH 匹配，禁止冷水直冲**） ③ 立即检测氨氮 NH3/亚硝酸盐 NO2- ④ 检查滤材是否堵塞/硝化系统是否崩溃 ⑤ **联系当地观赏鱼兽医或水产技术员**\n\n## 单日告警上限\n\n- Level 1 不限 / Level 2 × 4 / Level 3 × 6（紧急事件可能密集）/ Level 4 **不设上限**（生命安全优先）\n\n## 红线约束\n\n- **🚨 禁止**做\"氨氮中毒确诊 / 亚硝酸盐中毒确诊 / 鳃病确诊 / 寄生虫确诊\"等**具体疾病诊断**（仅可输出\"视觉预兆/风险预警\"语义）\n- **🚨 绝对禁止**输出具体药物名称、剂量、给药方案（**严禁推荐硝化菌液具体品牌、解氨剂、亚甲基蓝等任何药剂**）\n- **禁止**长期存储完整鱼缸视频（≤ 7 天，仅入库浮头事件片段；公共水族馆/养殖场按管理规定）\n- **禁止**用于商业广告 / AI 训练；禁第三方共享\n- **禁止**越权代用户启停增氧泵 / 加热棒 / 换水 / 投药 / 灯光参数；**任何水族设备控制变更必须由用户确认**（仅可建议）\n- 浮头条数、口开合频率、鳃盖幅度等指标必须基于真实视频帧分析；**禁止伪造或夸大指标**\n- 鱼种特异性：**气呼吸鱼种**（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼）天然偶尔到水面换气、**水面摄食鱼**（孔雀鱼 / 鳉鱼科）天然偏好水面 → 必须按鱼种基线判定；**严禁通用阈值盲判气呼吸鱼种为浮头**\n- 必须考虑生理性上下文：**投喂窗口聚拢水面抢食 / 强水流冲到水面带 / 水温过高暂时到水面 / 鱼苗自然集群于水面** → 不可直接告警\n- 水面波纹过大 / 水草浮于水面遮挡 / 跟踪率 < 80% → 必须返回 `gasping_signal_unreliable` 并建议调整摄像头/清理水面遮挡\n- 必须告知用户：AI 视觉识别仅供参考，**最终诊断与处理需用户立即检测水质并由专业兽医/水产技术员确认**\n\n## 输出报告字段\n\n- `report_date` - 报告日期\n- `tank_id` - 鱼缸/养殖池 ID\n- `species` - 鱼种\n- `total_fish_count_baseline` - 注册总鱼数\n- `multi_fish_gasping_count` - 同时浮头鱼数\n- `multi_fish_gasping_duration_seconds` - 多鱼同时异常持续时长\n- `mouth_opening_frequency_hz` - 口开合频率\n- `operculum_gill_beat_amplitude_normalized` - 鳃盖幅度\n- `composite_scene` - 综合判定\n- `alert_level` - 告警等级\n- `recommended_actions` - 建议动作（**测水质 NH3/NO2-/DO/pH + 增氧 + 换水 + 检查滤材 + 联系兽医**，绝不含具体药物）\n- `disclaimer` - 免责声明\n\nFile v1.0.10:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.10:scripts/config.yaml\n\n{}\n\nFile v1.0.10:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.10:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.10:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.10:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: prod\n\nFile v1.0.10:skill-card.md\n\n## Description: <br>\nAnalyzes aquarium camera images or videos for fish gasping, rapid mouth movement, and intensified gill movement, then reports a visual warning for possible ammonia poisoning or hypoxia. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[18072937735](https://clawhub.ai/user/18072937735) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nExternal users, aquarium operators, and developers use this skill to analyze aquarium video or image inputs for visual warning signs of fish gasping and to receive structured risk reports, suggested water-quality checks, and report links. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: The skill uploads aquarium media to the LifeEmergence/Open API backend for cloud analysis. <br>\nMitigation: Use only aquarium media that is acceptable to send to that backend, and avoid sensitive local files or private surroundings in the camera frame. <br>\nRisk: The skill silently creates or reuses a cloud identity and stores access tokens in the workspace data directory. <br>\nMitigation: Run it in a workspace where account-linked token storage is acceptable, and clear the workspace data directory when the session should no longer be reused. <br>\nRisk: History-report queries retrieve account-linked cloud records. <br>\nMitigation: Avoid broad history queries unless account-linked report retrieval is expected and acceptable for the deployment. <br>\nRisk: Visual warning results can be mistaken for a diagnosis or definitive water-quality measurement. <br>\nMitigation: Treat results as warning signals and verify with water testing and qualified aquarium or aquaculture support before making high-impact decisions. <br>\n\n\n## Reference(s): <br>\n- [ClawHub skill page](https://clawhub.ai/18072937735/skills/smyx-fish-gasping-ammonia-warning-analysis) <br>\n- [Skill demo](https://lifeemergence.com/sample.html) <br>\n- [API documentation](artifact/references/api_doc.md) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [Text, Markdown, JSON, Guidance] <br>\n**Output Format:** [Structured aquarium risk report in Markdown or JSON, optionally with a report export link] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [Outputs are based on provided aquarium media or cloud history queries and may include warning level, observed fish-gasping metrics, recommended checks, and disclaimers.] <br>\n\n## Skill Version(s): <br>\n1.0.10 (source: ClawHub release evidence; artifact frontmatter says 1.0.9) <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.10:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.10:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.9: 31 files, 45188 bytes\n\nFiles: references/api_doc.md (7619b), scripts/__init__.py (66b), scripts/config.py (708b), scripts/config.yaml (3b), scripts/skill.py (600b), scripts/smyx_fish_gasping_ammonia_warning_analysis.py (3764b), skill-card.md (2672b), SKILL.md (18164b), 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 (161b)\n\nFile v1.0.9:SKILL.md\n\n---\nname: \"smyx-fish-gasping-ammonia-warning-analysis\"\ndescription: \"Through fixed aquarium cameras, the system analyzes fish behavior near the water surface, detecting repeated mouth-out-of-water (gasping), rapid mouth opening/closing (fast respiration) and exaggerated operculum (gill cover) movement — classic symptoms of hypoxia or poisoning. | 通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。\"\nversion: \"1.0.8\"\nlicense: \"MIT-0\"\n---\n\n# ⚠️ Fish Gasping & Ammonia Poisoning Visual Warning | 水族箱内氨氮中毒视觉预兆（鱼浮头）\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **水族箱内氨氮中毒视觉预兆（鱼浮头）** |\n| 🎯 核心目标 | 通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_FISH_GASPING_AMMONIA_WARNING_ANALYSIS` |\n\nThrough fixed aquarium cameras, the system analyzes fish behavior near the water surface, detecting repeated mouth-out-of-water (gasping), rapid mouth opening/closing (fast respiration) and exaggerated operculum (gill cover) movement — classic symptoms of hypoxia or poisoning. When multiple fish exhibit the above behavior simultaneously and the duration exceeds a configurable threshold (default 60 seconds), the system outputs an 'ammonia poisoning or hypoxia risk warning', prompting the user to immediately test water quality, perform water change, or increase aeration. This skill helps take emergency action BEFORE fish die. Application scenarios: home aquariums, public aquariums, aquaculture ponds. The system monitors in real time and pushes alerts the moment fish gasping is detected. Skill features: ammonia poisoning is a common acute emergency in aquariums — by the time it is noticed, fish deaths may have already occurred. AI-based automatic recognition of gasping and abnormal respiration provides emergency warning at the earliest stage, buying time to handle the situation and reduce losses. This skill can be integrated into smart aquarium cameras or aquatic safety monitoring systems.\n\n通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。该技能有助于在鱼只死亡前采取紧急措施。应用场景：家庭鱼缸、水族馆、养殖池。系统实时监测，一旦发现鱼浮头立即推送警报。技能特点：氨氮中毒是鱼缸常见急症，往往在检测到前已造成鱼只死亡。通过 AI 自动识别鱼浮头和异常呼吸，可在事发初期紧急提醒，为处理争取时间，减少损失。该技能可集成到智能鱼缸摄像头或水族安防系统中。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的水族水质安全 AI。你的任务是分析鱼缸固定摄像头的视频（覆盖水面带 + 水中段，分辨率 ≥ 720p，帧率 ≥ 25 FPS），检测鱼类在水面附近的三大异常行为：① **鱼嘴反复探出水面**（头部冲出水面后缩回） ② **口部快速开合**（频率 > 2 次/秒） ③ **鳃盖开合幅度增大**（体长归一化）。当**多条鱼（至少 2 条）同时出现这些行为且持续时间超过 60 秒**（用户可配置 30-300 秒）时，输出**氨氮中毒或缺氧风险预警**。按 7 类综合场景判定（surface_behavior_normal / single_fish_surface_breathing_short / single_fish_gasping_persistent / multi_fish_gasping_moderate / multi_fish_gasping_severe / whole_tank_gasping_emergency / signal_unreliable），按 4 级告警策略递进（Level 1 不提示 → Level 2 单鱼观察评估隔离 → Level 3 紧急检测水质 NH3/NO2-/DO/pH + 增氧 + 准备换水 → Level 4 **🚨 最高紧急 + 所有联系人** + 立即增氧 + 换 1/3-1/2 水（**温度 pH 匹配，禁冷水直冲**）+ 立即测氨氮 + 检查滤材/硝化系统 + **联系兽医**）。鱼种特异性必须按基线判定：**气呼吸鱼种**（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼）天然偶尔到水面换气、**水面摄食型**（孔雀鱼 / 鳉鱼科）天然偏好水面 → **严禁通用阈值盲判气呼吸鱼种为浮头**。必须考虑生理性上下文（投喂窗口聚拢水面抢食 / 强水流 / 水温过高 / 鱼苗自然集群水面），避免误报。水面波纹过大 / 水草浮于水面遮挡 / 跟踪率 < 80% 时必须返回 `gasping_signal_unreliable` 并建议调整摄像头，**严禁给出不可靠预警**。**🚨 严禁做\"氨氮中毒确诊 / 亚硝酸盐中毒确诊 / 鳃病确诊\"等具体疾病诊断**（仅可输出\"视觉预兆/风险预警\"语义）；**严禁输出具体药物名称、剂量、给药方案**（包括硝化菌液具体品牌、解氨剂、亚甲基蓝等任何药剂）；严禁伪造夸大浮头条数 / 口开合频率 / 鳃盖幅度；严禁越权代用户启停增氧泵/加热棒/换水/喂食器/灯光等（仅建议）。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于鱼缸固定摄像头 / 水族馆侧面观察摄像头 / 养殖池水面摄像头**实时视频**（默认 60 秒滚动窗口，用户可配置 30-300 秒），识别 7 类综合场景（surface_behavior_normal / single_fish_surface_breathing_short / single_fish_gasping_persistent / multi_fish_gasping_moderate / multi_fish_gasping_severe / whole_tank_gasping_emergency / gasping_signal_unreliable）→ **四组指标**：浮头行为 4 项（水面带鱼数 / 嘴穿出水面鱼数 / 浮头比例 / 每分钟浮头事件数）+ 呼吸异常 4 项（口开合 Hz / 口张幅度 / 鳃盖幅度 / 鳃盖呼吸 BPM）+ 群体异常 4 项（注册总鱼数 / 同时浮头鱼数 / 持续时长秒 / 氧气泵是否运行）+ 排除上下文 5 项（气呼吸鱼种 / 投喂期 / 水面摄食鱼种 / 水面扰动 / 水草浮面）→ 4 档告警级别（none → important → urgent → critical）→ **4 级告警策略递进**（不提示 → 单鱼观察评估隔离 → 紧急测水质+增氧+准备换水 → 🚨 最高紧急+所有联系人+立即换水（温度 pH 匹配）+测氨氮+检查滤材+联系兽医）→ 单日告警上限（Level 1 不限 / Level 2 × 4 / Level 3 × 6 / Level 4 **不设上限**）→ **预警报告**（按 tank_id 输出，含浮头鱼条数/持续时长/口开合频率/鳃盖幅度 + 建议动作 + 免责声明）\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 鱼缸水面带分割 |\n| 2 | 鱼体目标检测 + 多目标跟踪 |\n| 3 | **水面穿透事件检测**（鱼头穿出水面/缩回的关键事件帧） |\n| 4 | 口部关键点检测 + 开合频率估计（FFT/峰值法） |\n| 5 | 鳃盖开合幅度估计（体长归一化） |\n| 6 | 多鱼并发计数与持续时长累计（跨帧累积） |\n| 7 | 鱼种自适应基线（气呼吸 / 水面摄食 / 中下层 / 底栖） |\n| 8 | 生理性上下文识别（投喂期 / 水流 / 水温 / 鱼苗） |\n| 9 | 波纹/水草遮挡门控（跟踪率 < 80% 返回 unreliable） |\n| 10 | 用户 APP 紧急推送 |\n| 11 | 4 级告警递进 |\n| 12 | 单日告警上限（**Level 4 不设上限**） |\n| 13 | 预警报告（按 tank_id + 事件时间戳输出） |\n| 14 | 连续 ≥ 2 次 Level 3+ → 强烈建议联系**当地观赏鱼兽医或水产技术员** |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供鱼缸固定摄像头视频 URL 或文件需要分析时，默认触发本技能进行水族箱氨氮中毒视觉预兆识别 |\n| 🔎 明确分析意图 | 当用户明确提及鱼浮头、鱼喘气、鱼集体上水面、鱼缸氨氮、鱼缸缺氧、亚硝酸盐爆表、鱼鳃异常呼吸、硝化系统崩溃等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看鱼缸浮头历史报告、氨氮预警日志清单、缺氧事件清单、查询历史鱼缸预警记录、显示所有水族安防预警报告 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_fish_gasping_ammonia_warning_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备鱼缸固定摄像头视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 获取 open-id（强制执行） | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行水族箱氨氮中毒视觉预兆识别 | 调用 `-m scripts.smyx_fish_gasping_ammonia_warning_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地鱼缸固定摄像头视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络鱼缸固定摄像头视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，水族箱氨氮中毒视觉预兆场景默认 `other` | 按需填写 |\n| `--list` | 显示水族箱氨氮中毒视觉预兆历史记录清单 | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_fish_gasping_ammonia_warning_analysis.py`](scripts/smyx_fish_gasping_ammonia_warning_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；摄像头需**同时覆盖水面带和水中段**；**帧率 ≥ 25 FPS**；默认 60s 滚动窗口 |\n| 🔎 使用提醒 | **核心采样窗口**：60 秒滚动窗口（用户可配置 30-300 秒） |\n| 🔎 使用提醒 | **核心预警门槛**：**多鱼（≥ 2 条）同时浮头持续 ≥ 60 秒** 触发 Level 3+ 告警 |\n| 🔎 使用提醒 | **4 级告警策略递进**（none → important → urgent → critical），多鱼/全缸/持续超长进入更高级别 |\n| 🔎 使用提醒 | 单日告警上限：Level 1 不限 / Level 2 × 4 / Level 3 × 6 / Level 4 **不设上限**（生命安全优先） |\n| 🔎 使用提醒 | 红线约束 |\n| 🧑‍⚖️ 结果性质 | **🚨 禁止**做\"氨氮中毒确诊 / 亚硝酸盐中毒确诊 / 鳃病确诊 / 寄生虫确诊\"等具体疾病诊断（仅可输出\"视觉预兆/风险预警\"语义） |\n| 🔎 使用提醒 | **🚨 绝对禁止**输出具体药物名称、剂量、给药方案（特别**严禁推荐硝化菌液具体品牌、解氨剂、亚甲基蓝等任何药剂**） |\n| 🔎 使用提醒 | **禁止**长期存储完整鱼缸视频（≤ 7 天，仅入库浮头事件片段；公共水族馆/养殖场按管理规定） |\n| 🔎 使用提醒 | **禁止**用于商业广告 / AI 训练；禁第三方共享 |\n| 🔎 使用提醒 | **禁止**越权代用户启停增氧泵 / 加热棒 / 换水 / 投药 / 灯光参数；**任何水族设备控制变更必须由用户确认**（仅可建议） |\n| 🔎 使用提醒 | **绝对禁止**伪造或夸大浮头条数、口开合频率、鳃盖幅度、持续时长等指标；所有数据必须基于真实视频帧分析 |\n| 🔎 使用提醒 | **必须**按**鱼种基线**判定：**气呼吸鱼种（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼）天然偶尔到水面换气** + **水面摄食型（孔雀鱼 / 鳉鱼科）天然偏好水面** → 严禁通用阈值盲判 |\n| 📚 文档读取 | **必须**考虑生理性上下文（投喂窗口聚拢水面抢食 / 强水流冲到水面 / 水温过高 / 鱼苗自然集群水面），避免误报 |\n| 🔎 使用提醒 | **必须**在水面波纹过大 / 水草浮于水面遮挡 / 跟踪率 < 80% 时返回 `gasping_signal_unreliable` 并建议调整摄像头/清理遮挡，**禁止给出不可靠的预警** |\n| 🔎 使用提醒 | **必须**在 Level 4 紧急换水建议中明确：**温度 pH 匹配，禁冷水直冲** |\n| 🔎 使用提醒 | **必须**：连续 ≥ 2 次 Level 3+ → 强烈建议联系**当地观赏鱼兽医或水产技术员** |\n| 📜 报告输出 | **必须**：预警报告**按 tank_id + 事件时间戳输出**，含浮头鱼条数 + 持续时长 + 口开合频率 + 鳃盖幅度 + 建议动作 + 免责声明 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史浮头预警记录清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地鱼缸固定摄像头视频（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input /path/to/tank.mp4\n\n# 分析网络鱼缸固定摄像头视频/实时流（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --url https://example.com/tank.mp4\n\n# 显示历史浮头预警记录清单（自动触发关键词：查看鱼缸浮头历史报告、氨氮预警日志清单等）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input tank.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input tank.mp4 --output result.json\n```\n\nFile v1.0.9:_meta.json\n\n{\n  \"ownerId\": \"kn7e2caqj7pnsvr9r7t8zenghs83xw7n\",\n  \"slug\": \"smyx-fish-gasping-ammonia-warning-analysis\",\n  \"version\": \"1.0.9\",\n  \"publishedAt\": 1785321209542\n}\n\nFile v1.0.9:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放水族箱内氨氮中毒视觉预兆（鱼浮头）API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动鱼浮头/缺氧/氨氮中毒视觉预兆识别任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取预警结果（浮头条数、口开合频率、鳃盖幅度、持续时长）\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史预警报告\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出预警报告\n5. （可选）`/web/companion/v2/trigger-soothing-action` - 触发联动告警（用户 APP 紧急推送 / 智能鱼缸警报灯 / 建议立即增氧/换水/检测氨氮）\n\n## 场景代码\n\n- `SMYX_FISH_GASPING_AMMONIA_WARNING_ANALYSIS` - 水族箱内氨氮中毒视觉预兆（鱼浮头）\n\n## 输入约束\n\n- 摄像头：鱼缸固定摄像头 / 水族馆侧面观察摄像头 / 养殖池水面摄像头，**必须同时覆盖水面带和水中段**（鱼浮头是水面行为）\n- 分辨率 ≥ 720p；**帧率 ≥ 25 FPS**（口部开合频率检测需 ≥ 2 Hz）\n- 光照：建议鱼缸照明常开 + 无强反光；**水面波纹大可能误判，必须做光流稳定**\n- **核心采样窗口**：默认 60 秒滚动窗口（用户可配置 30 - 300 秒）\n- 视野约束：必须覆盖**水面完整投影**（任何水面盲区都可能漏判浮头）\n- 多鱼缸/池场景按摄像头 ID 绑定到注册容器 ID\n- **部署时必须录入**：鱼种、缸内总鱼数 N、鱼缸尺寸、是否开启氧气泵/过滤器（用于上下文加权）\n- 用户必须授权部署；公共水族馆 / 养殖场需公示告知\n\n## 关键观测信号\n\n### 浮头行为信号（核心）\n- `fish_at_surface_count` - 当前帧水面带（水面下 0-1 个体长）内的鱼数\n- `fish_breaking_surface_count` - **检测到鱼嘴穿出水面**的鱼数（核心强信号）\n- `fish_breaking_surface_ratio` - 浮头鱼数占总鱼数比例\n- `surface_breaking_events_per_minute` - 每分钟浮头事件数（同条鱼反复探出累计）\n\n### 呼吸异常信号\n- `mouth_opening_frequency_hz` - **口部开合频率（Hz / 次/秒）**（异常阈值 > 2 Hz）\n- `mouth_opening_amplitude_normalized` - 口张开幅度（体长归一化）\n- `operculum_gill_beat_amplitude_normalized` - **鳃盖开合幅度**（体长归一化，异常增大）\n- `operculum_gill_beat_rate_bpm` - 鳃盖呼吸频率（次/分钟，可与 respiratory_rate 技能交叉验证）\n\n### 群体异常信号\n- `total_fish_count_baseline` - 注册总鱼数\n- `multi_fish_gasping_count` - **同时出现浮头/喘气的鱼数**（≥ 2 条为预警门槛）\n- `multi_fish_gasping_duration_seconds` - 多鱼同时异常持续时长（≥ 60s 为核心预警阈值）\n- `tank_oxygen_pump_running` - 氧气泵是否运行（如运行仍多鱼浮头，氨氮中毒怀疑度更高）\n\n### 上下文与排除信号（避免误报）\n- `is_air_breathing_species` - **是否能用气呼吸鱼种**（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼天然偶尔到水面换气）\n- `is_during_feeding` - 是否在投喂窗口内（生理性聚拢水面抢食非浮头）\n- `is_surface_feeding_species` - 是否水面摄食型（孔雀鱼 / 鳉鱼科偏好水面）\n- `water_surface_disturbance_level` - 水面扰动程度（强水流可能误判）\n- `aquatic_plant_floating_at_surface` - 是否水草浮于水面（遮挡可能漏检）\n\n## 综合判定\n\n- `surface_behavior_normal` - 水面行为正常\n- `single_fish_surface_breathing_short` - 单条鱼短暂到水面换气（气呼吸鱼种正常 / 投喂期）\n- `single_fish_gasping_persistent` - 单条鱼持续浮头喘气（疑似该个体不适，非全缸问题）\n- `multi_fish_gasping_moderate` - **多鱼同时浮头（≥ 2 条，持续 30-60s）**：早期预警\n- `multi_fish_gasping_severe` - **多鱼同时浮头（≥ 2 条，持续 ≥ 60s）**：氨氮中毒/缺氧风险预警（核心）\n- `whole_tank_gasping_emergency` - **全缸鱼同时浮头（≥ 80%，持续 ≥ 30s）**：紧急中毒事件\n- `gasping_signal_unreliable` - 信号不可靠（水面波纹过大 / 水草遮挡 / 跟踪率 < 80%）\n\n## 4 级告警策略递进\n\n- Level 1（surface_behavior_normal / single_fish_surface_breathing_short）：仅入库或不提示\n- Level 2（single_fish_gasping_persistent）：用户 APP 重要提示，建议**单独观察该鱼，评估是否隔离至检疫缸**\n- Level 3（multi_fish_gasping_moderate）：紧急告警，建议**立即检测水质（氨氮 NH3/NH4+、亚硝酸盐 NO2-、pH、溶氧 DO、温度）+ 立即开启/加强增氧 + 准备换水**\n- Level 4（multi_fish_gasping_severe / whole_tank_gasping_emergency）：**🚨 最高紧急告警 + 推送家庭/管理人员所有联系人** + 强烈建议**立即采取多措并举**：① 立即开足增氧泵/加气盘 ② 立即换 1/3~1/2 水（**温度 pH 匹配，禁止冷水直冲**） ③ 立即检测氨氮 NH3/亚硝酸盐 NO2- ④ 检查滤材是否堵塞/硝化系统是否崩溃 ⑤ **联系当地观赏鱼兽医或水产技术员**\n\n## 单日告警上限\n\n- Level 1 不限 / Level 2 × 4 / Level 3 × 6（紧急事件可能密集）/ Level 4 **不设上限**（生命安全优先）\n\n## 红线约束\n\n- **🚨 禁止**做\"氨氮中毒确诊 / 亚硝酸盐中毒确诊 / 鳃病确诊 / 寄生虫确诊\"等**具体疾病诊断**（仅可输出\"视觉预兆/风险预警\"语义）\n- **🚨 绝对禁止**输出具体药物名称、剂量、给药方案（**严禁推荐硝化菌液具体品牌、解氨剂、亚甲基蓝等任何药剂**）\n- **禁止**长期存储完整鱼缸视频（≤ 7 天，仅入库浮头事件片段；公共水族馆/养殖场按管理规定）\n- **禁止**用于商业广告 / AI 训练；禁第三方共享\n- **禁止**越权代用户启停增氧泵 / 加热棒 / 换水 / 投药 / 灯光参数；**任何水族设备控制变更必须由用户确认**（仅可建议）\n- 浮头条数、口开合频率、鳃盖幅度等指标必须基于真实视频帧分析；**禁止伪造或夸大指标**\n- 鱼种特异性：**气呼吸鱼种**（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼）天然偶尔到水面换气、**水面摄食鱼**（孔雀鱼 / 鳉鱼科）天然偏好水面 → 必须按鱼种基线判定；**严禁通用阈值盲判气呼吸鱼种为浮头**\n- 必须考虑生理性上下文：**投喂窗口聚拢水面抢食 / 强水流冲到水面带 / 水温过高暂时到水面 / 鱼苗自然集群于水面** → 不可直接告警\n- 水面波纹过大 / 水草浮于水面遮挡 / 跟踪率 < 80% → 必须返回 `gasping_signal_unreliable` 并建议调整摄像头/清理水面遮挡\n- 必须告知用户：AI 视觉识别仅供参考，**最终诊断与处理需用户立即检测水质并由专业兽医/水产技术员确认**\n\n## 输出报告字段\n\n- `report_date` - 报告日期\n- `tank_id` - 鱼缸/养殖池 ID\n- `species` - 鱼种\n- `total_fish_count_baseline` - 注册总鱼数\n- `multi_fish_gasping_count` - 同时浮头鱼数\n- `multi_fish_gasping_duration_seconds` - 多鱼同时异常持续时长\n- `mouth_opening_frequency_hz` - 口开合频率\n- `operculum_gill_beat_amplitude_normalized` - 鳃盖幅度\n- `composite_scene` - 综合判定\n- `alert_level` - 告警等级\n- `recommended_actions` - 建议动作（**测水质 NH3/NO2-/DO/pH + 增氧 + 换水 + 检查滤材 + 联系兽医**，绝不含具体药物）\n- `disclaimer` - 免责声明\n\nFile v1.0.9:skills/smyx_analysis/references/api_doc.md\n\n# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |\n\nFile v1.0.9:scripts/config.yaml\n\n{}\n\nFile v1.0.9:skills/smyx_analysis/scripts/config.yaml\n\n{}\n\nFile v1.0.9:skills/smyx_common/scripts/config-dev.yaml\n\nApiEnum:\n  base-url-open-api: \"http://192.168.1.234:9601/smyx-open-api\"\n  base-url-open-h5: \"http://192.168.1.234:4100\"\n  base-url-health: \"http://192.168.1.234:7070/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.9:skills/smyx_common/scripts/config-test.yaml\n\nApiEnum:\n  base-url-open-api: \"https://livemonitortest.lifeemergence.com/smyx-open-api\"\n  base-url-open-h5: \"http://livemonitortest.lifeemergence.com\"\n  base-url-health: \"https://healthtest.lifeemergence.com/jeecg-boot-xzgz\"\n\nConstantEnum:\n  is-debug: true\n\nFile v1.0.9:skills/smyx_common/scripts/config.yaml\n\nApiEnum:\n  api-key: null\n  api-secret-key: null\n  base-url-health: https://lifeemergence.com/jeecg-boot-xzgz\n  base-url-open-api: https://open.lifeemergence.com/smyx-open-api\n  base-url-open-h5: http://livemonitor.lifeemergence.com\n  database-url: null\nConstantEnum:\n  app--id: x1a3s4nwy1s2r4se\n  current--tentant-code: XIAN_ZHAO_GAN_ZHI\n  default--skill-platform-name: ARK_CLAW\n  feishu-app--id: cli_a93d769369badcb1\n  feishu-app--secret: null\n  is-debug: false\nenv: prod\n\nFile v1.0.9:skill-card.md\n\n## Description: <br>\nAnalyzes aquarium camera images or videos for fish gasping, rapid mouth movement, and increased gill-cover motion to produce a visual risk warning for possible hypoxia or ammonia-related water-quality stress. <br>\n\nThis skill is ready for commercial/non-commercial use. <br>\n\n## Publisher: <br>\n[18072937735](https://clawhub.ai/user/18072937735) <br>\n\n### License/Terms of Use: <br>\nMIT-0 <br>\n\n\n## Use Case: <br>\nExternal users and aquarium operators can use this skill to analyze fixed-camera aquarium media and receive structured visual warning reports for fish gasping or abnormal respiration. The skill supports risk triage and recommended next steps, but it should not be treated as a veterinary diagnosis. <br>\n\n### Deployment Geography for Use: <br>\nGlobal <br>\n\n## Known Risks and Mitigations: <br>\nRisk: Aquarium videos or URLs may be uploaded to the publisher's cloud service for analysis. <br>\nMitigation: Use the skill only with media the user is willing to send to the publisher service, and obtain explicit confirmation before uploads in sensitive settings. <br>\nRisk: The skill can create or reuse an internal account identity and query account-linked report history. <br>\nMitigation: Confirm history lookups before running them and review or remove local workspace data and API-key files when persistent account linkage is not desired. <br>\nRisk: The visual warning can be mistaken for a definitive diagnosis or treatment instruction. <br>\nMitigation: Present results as visual risk warnings only, require water-quality testing for confirmation, and refer users to an aquarium veterinarian or aquatic technician for serious or repeated alerts. <br>\n\n\n## Reference(s): <br>\n- [ClawHub Skill Page](https://clawhub.ai/18072937735/skills/smyx-fish-gasping-ammonia-warning-analysis) <br>\n- [API Documentation](references/api_doc.md) <br>\n- [Skill Demo](https://lifeemergence.com/sample.html) <br>\n\n\n## Skill Output: <br>\n**Output Type(s):** [text, markdown, shell commands, configuration, guidance] <br>\n**Output Format:** [Structured text, Markdown tables, and JSON-style analysis report content] <br>\n**Output Parameters:** [1D] <br>\n**Other Properties Related to Output:** [Reports may include alert level, fish behavior metrics, recommended actions, disclaimers, and report links.] <br>\n\n## Skill Version(s): <br>\n1.0.9 (source: server release metadata) <br>\n\n## Ethical Considerations: <br>\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment. <br>\n\nFile v1.0.9:skills/smyx_analysis/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nyaml==6.0.3\n\nFile v1.0.9:skills/smyx_common/requirements.txt\n\npydash==8.0.6\nSQLAlchemy==2.0.46\nPyYAML==6.0.3\n\nArchive v1.0.8: 31 files, 45166 bytes\n\nFiles: references/api_doc.md (7619b), scripts/__init__.py (66b), scripts/config.py (708b), scripts/config.yaml (3b), scripts/skill.py (600b), scripts/smyx_fish_gasping_ammonia_warning_analysis.py (3764b), skill-card.md (2569b), SKILL.md (18164b), 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 (161b)\n\nFile v1.0.8:SKILL.md\n\n---\nname: \"smyx-fish-gasping-ammonia-warning-analysis\"\ndescription: \"Through fixed aquarium cameras, the system analyzes fish behavior near the water surface, detecting repeated mouth-out-of-water (gasping), rapid mouth opening/closing (fast respiration) and exaggerated operculum (gill cover) movement — classic symptoms of hypoxia or poisoning. | 通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。\"\nversion: \"1.0.6\"\nlicense: \"MIT-0\"\n---\n\n# ⚠️ Fish Gasping & Ammonia Poisoning Visual Warning | 水族箱内氨氮中毒视觉预兆（鱼浮头）\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **水族箱内氨氮中毒视觉预兆（鱼浮头）** |\n| 🎯 核心目标 | 通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_FISH_GASPING_AMMONIA_WARNING_ANALYSIS` |\n\nThrough fixed aquarium cameras, the system analyzes fish behavior near the water surface, detecting repeated mouth-out-of-water (gasping), rapid mouth opening/closing (fast respiration) and exaggerated operculum (gill cover) movement — classic symptoms of hypoxia or poisoning. When multiple fish exhibit the above behavior simultaneously and the duration exceeds a configurable threshold (default 60 seconds), the system outputs an 'ammonia poisoning or hypoxia risk warning', prompting the user to immediately test water quality, perform water change, or increase aeration. This skill helps take emergency action BEFORE fish die. Application scenarios: home aquariums, public aquariums, aquaculture ponds. The system monitors in real time and pushes alerts the moment fish gasping is detected. Skill features: ammonia poisoning is a common acute emergency in aquariums — by the time it is noticed, fish deaths may have already occurred. AI-based automatic recognition of gasping and abnormal respiration provides emergency warning at the earliest stage, buying time to handle the situation and reduce losses. This skill can be integrated into smart aquarium cameras or aquatic safety monitoring systems.\n\n通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。该技能有助于在鱼只死亡前采取紧急措施。应用场景：家庭鱼缸、水族馆、养殖池。系统实时监测，一旦发现鱼浮头立即推送警报。技能特点：氨氮中毒是鱼缸常见急症，往往在检测到前已造成鱼只死亡。通过 AI 自动识别鱼浮头和异常呼吸，可在事发初期紧急提醒，为处理争取时间，减少损失。该技能可集成到智能鱼缸摄像头或水族安防系统中。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的水族水质安全 AI。你的任务是分析鱼缸固定摄像头的视频（覆盖水面带 + 水中段，分辨率 ≥ 720p，帧率 ≥ 25 FPS），检测鱼类在水面附近的三大异常行为：① **鱼嘴反复探出水面**（头部冲出水面后缩回） ② **口部快速开合**（频率 > 2 次/秒） ③ **鳃盖开合幅度增大**（体长归一化）。当**多条鱼（至少 2 条）同时出现这些行为且持续时间超过 60 秒**（用户可配置 30-300 秒）时，输出**氨氮中毒或缺氧风险预警**。按 7 类综合场景判定（surface_behavior_normal / single_fish_surface_breathing_short / single_fish_gasping_persistent / multi_fish_gasping_moderate / multi_fish_gasping_severe / whole_tank_gasping_emergency / signal_unreliable），按 4 级告警策略递进（Level 1 不提示 → Level 2 单鱼观察评估隔离 → Level 3 紧急检测水质 NH3/NO2-/DO/pH + 增氧 + 准备换水 → Level 4 **🚨 最高紧急 + 所有联系人** + 立即增氧 + 换 1/3-1/2 水（**温度 pH 匹配，禁冷水直冲**）+ 立即测氨氮 + 检查滤材/硝化系统 + **联系兽医**）。鱼种特异性必须按基线判定：**气呼吸鱼种**（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼）天然偶尔到水面换气、**水面摄食型**（孔雀鱼 / 鳉鱼科）天然偏好水面 → **严禁通用阈值盲判气呼吸鱼种为浮头**。必须考虑生理性上下文（投喂窗口聚拢水面抢食 / 强水流 / 水温过高 / 鱼苗自然集群水面），避免误报。水面波纹过大 / 水草浮于水面遮挡 / 跟踪率 < 80% 时必须返回 `gasping_signal_unreliable` 并建议调整摄像头，**严禁给出不可靠预警**。**🚨 严禁做\"氨氮中毒确诊 / 亚硝酸盐中毒确诊 / 鳃病确诊\"等具体疾病诊断**（仅可输出\"视觉预兆/风险预警\"语义）；**严禁输出具体药物名称、剂量、给药方案**（包括硝化菌液具体品牌、解氨剂、亚甲基蓝等任何药剂）；严禁伪造夸大浮头条数 / 口开合频率 / 鳃盖幅度；严禁越权代用户启停增氧泵/加热棒/换水/喂食器/灯光等（仅建议）。** |\n\n## 🎬 技能演示 | Skill Demo\n\n[▶️ 点击查看技能使用介绍](https://lifeemergence.com/sample.html)\n\n---\n\n## 🎯 任务目标 | Goals\n### 1. 🧩 技能用途\n\n基于鱼缸固定摄像头 / 水族馆侧面观察摄像头 / 养殖池水面摄像头**实时视频**（默认 60 秒滚动窗口，用户可配置 30-300 秒），识别 7 类综合场景（surface_behavior_normal / single_fish_surface_breathing_short / single_fish_gasping_persistent / multi_fish_gasping_moderate / multi_fish_gasping_severe / whole_tank_gasping_emergency / gasping_signal_unreliable）→ **四组指标**：浮头行为 4 项（水面带鱼数 / 嘴穿出水面鱼数 / 浮头比例 / 每分钟浮头事件数）+ 呼吸异常 4 项（口开合 Hz / 口张幅度 / 鳃盖幅度 / 鳃盖呼吸 BPM）+ 群体异常 4 项（注册总鱼数 / 同时浮头鱼数 / 持续时长秒 / 氧气泵是否运行）+ 排除上下文 5 项（气呼吸鱼种 / 投喂期 / 水面摄食鱼种 / 水面扰动 / 水草浮面）→ 4 档告警级别（none → important → urgent → critical）→ **4 级告警策略递进**（不提示 → 单鱼观察评估隔离 → 紧急测水质+增氧+准备换水 → 🚨 最高紧急+所有联系人+立即换水（温度 pH 匹配）+测氨氮+检查滤材+联系兽医）→ 单日告警上限（Level 1 不限 / Level 2 × 4 / Level 3 × 6 / Level 4 **不设上限**）→ **预警报告**（按 tank_id 输出，含浮头鱼条数/持续时长/口开合频率/鳃盖幅度 + 建议动作 + 免责声明）\n\n### 2. 🛠️ 能力范围\n\n| 序号 | 具体能力 |\n|---:|---|\n| 1 | 鱼缸水面带分割 |\n| 2 | 鱼体目标检测 + 多目标跟踪 |\n| 3 | **水面穿透事件检测**（鱼头穿出水面/缩回的关键事件帧） |\n| 4 | 口部关键点检测 + 开合频率估计（FFT/峰值法） |\n| 5 | 鳃盖开合幅度估计（体长归一化） |\n| 6 | 多鱼并发计数与持续时长累计（跨帧累积） |\n| 7 | 鱼种自适应基线（气呼吸 / 水面摄食 / 中下层 / 底栖） |\n| 8 | 生理性上下文识别（投喂期 / 水流 / 水温 / 鱼苗） |\n| 9 | 波纹/水草遮挡门控（跟踪率 < 80% 返回 unreliable） |\n| 10 | 用户 APP 紧急推送 |\n| 11 | 4 级告警递进 |\n| 12 | 单日告警上限（**Level 4 不设上限**） |\n| 13 | 预警报告（按 tank_id + 事件时间戳输出） |\n| 14 | 连续 ≥ 2 次 Level 3+ → 强烈建议联系**当地观赏鱼兽医或水产技术员** |\n\n### 3. ⚡ 触发条件\n\n| 触发类型 | 触发规则 |\n|---|---|\n| ✅ 默认触发 | **默认触发**：当用户提供鱼缸固定摄像头视频 URL 或文件需要分析时，默认触发本技能进行水族箱氨氮中毒视觉预兆识别 |\n| 🔎 明确分析意图 | 当用户明确提及鱼浮头、鱼喘气、鱼集体上水面、鱼缸氨氮、鱼缸缺氧、亚硝酸盐爆表、鱼鳃异常呼吸、硝化系统崩溃等关键词，并且上传了视频文件 |\n| 📚 历史报告查询 | 当用户提及以下关键词时，**自动触发历史报告查询功能** ：查看鱼缸浮头历史报告、氨氮预警日志清单、缺氧事件清单、查询历史鱼缸预警记录、显示所有水族安防预警报告 |\n\n### 4. 🤖 自动行为\n\n| 自动行为 | 执行要求 |\n|---|---|\n| 📎 附件处理 | 如果用户上传了附件或者视频/图片文件，则自动保存为本地文件 |\n| ☁️ 历史报告查询 | 如果用户触发历史报告查询关键词，必须直接调用云端 API 查询，不得从本地记忆或人工汇总中获取 |\n\n#### ⚠️ 强制数据获取规则（次高优先级）\n\n> **橙色强约束：** 历史报告清单只允许从云端接口读取，不允许从本地记录、长期记忆或人工汇总中提取。\n\n必须执行：\n\n```bash\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --list\n```\n\n| 类型 | 要求 |\n|---|---|\n| ✅ 必须 | 使用 `python -m scripts.smyx_fish_gasping_ammonia_warning_analysis --list` 调用 API 查询云端的历史报告数据 |\n| 🚫 严格禁止 | 从本地 `memory` 目录读取历史会话信息 |\n| 🚫 严格禁止 | 手动汇总本地记录中的报告 |\n| 🚫 严格禁止 | 从长期记忆中提取报告 |\n| ✅ 输出格式 | 必须统一从云端接口获取最新完整数据，然后以 Markdown 表格格式输出结果 |\n\n## 📦 前置准备 | Requirements\n- 依赖说明:scripts 脚本所需的依赖包及版本\n  ```\n  requests>=2.28.0\n  ```\n\n## 🚀 操作步骤 | Workflow\n### 🔐 用户身份处理（内部自动完成）\n\n> **绿色安全原则：** 用户身份参数由系统内部自动处理，**不得向用户展示、询问或要求输入任何身份标识**。\n\n执行本技能分析或历史报告查询时，脚本会自动完成身份初始化：\n\n| 场景 | 系统行为 |\n|---|---|\n| 上游系统有内部身份参数 | 由脚本静默接收并使用 |\n| 上游系统未提供内部身份参数 | 脚本会自动复用本地缺省用户 |\n| 本地缺省用户不存在 | 脚本会自动创建并在后续任务中复用 |\n| 对用户输出 | 只展示分析进度、分析结果和报告链接，不展示内部身份值 |\n\n#### 🔒 关键约束\n\n| 禁止/要求 | 说明 |\n|---|---|\n| 🚫 不得询问身份 | 不得提示用户输入用户名、手机号或任何内部身份参数 |\n| 🚫 不得暴露身份值 | 不得在回复、报告、示例、错误提示中暴露内部身份值 |\n| 🚫 不得列为用户参数 | 不得把内部身份参数列为用户需要理解或传入的参数 |\n| ✅ 自动关联报告 | 历史报告查询同样由系统内部身份自动关联，用户只需表达“查看历史报告/报告清单”等意图 |\n\n---\n\n### 🧪 标准流程 | Standard Flow\n\n| 步骤 | 阶段 | 执行动作 |\n|---:|---|---|\n| 1 | 📥 准备鱼缸固定摄像头视频输入 | 提供本地文件路径或网络 URL；确保输入内容清晰、符合技能场景要求 |\n| 2 | 🔐 获取 open-id（强制执行） | 无需用户输入任何身份参数；不在回复中展示内部身份值 |\n| 3 | ⚙️ 执行水族箱氨氮中毒视觉预兆识别 | 调用 `-m scripts.smyx_fish_gasping_ammonia_warning_analysis` 处理输入（**必须在技能根目录下运行脚本**） |\n| 4 | 📊 查看分析结果 | 接收结构化分析报告，查看识别/监测结果、风险提示、建议与报告链接 |\n\n### ⚙️ 脚本参数说明\n\n| 参数 | 含义 | 备注 |\n|---|---|---|\n| `--input` | 本地鱼缸固定摄像头视频文件路径 | 适用于本地文件分析 |\n| `--url` | 网络鱼缸固定摄像头视频 URL 地址（API 服务自动下载） | API 服务自动下载网络资源 |\n| `--pet-type` | 类别标识，水族箱氨氮中毒视觉预兆场景默认 `other` | 按需填写 |\n| `--list` | 显示水族箱氨氮中毒视觉预兆历史记录清单 | 用于云端历史报告查询 |\n| `--api-url` | API 服务地址（可选，使用默认值） | 按需填写 |\n| `--detail` | 输出详细程度（basic/standard/json，默认 json） | 输出详细程度 |\n| `--output` | 结果输出文件路径（可选） | 可选 |\n\n## 🗂️ 资源索引 | Resource Index\n| 资源类型 | 路径 | 用途 | 何时读取 |\n|---|---|---|---|\n| 🐍 必要脚本 | [`scripts/smyx_fish_gasping_ammonia_warning_analysis.py`](scripts/smyx_fish_gasping_ammonia_warning_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；摄像头需**同时覆盖水面带和水中段**；**帧率 ≥ 25 FPS**；默认 60s 滚动窗口 |\n| 🔎 使用提醒 | **核心采样窗口**：60 秒滚动窗口（用户可配置 30-300 秒） |\n| 🔎 使用提醒 | **核心预警门槛**：**多鱼（≥ 2 条）同时浮头持续 ≥ 60 秒** 触发 Level 3+ 告警 |\n| 🔎 使用提醒 | **4 级告警策略递进**（none → important → urgent → critical），多鱼/全缸/持续超长进入更高级别 |\n| 🔎 使用提醒 | 单日告警上限：Level 1 不限 / Level 2 × 4 / Level 3 × 6 / Level 4 **不设上限**（生命安全优先） |\n| 🔎 使用提醒 | 红线约束 |\n| 🧑‍⚖️ 结果性质 | **🚨 禁止**做\"氨氮中毒确诊 / 亚硝酸盐中毒确诊 / 鳃病确诊 / 寄生虫确诊\"等具体疾病诊断（仅可输出\"视觉预兆/风险预警\"语义） |\n| 🔎 使用提醒 | **🚨 绝对禁止**输出具体药物名称、剂量、给药方案（特别**严禁推荐硝化菌液具体品牌、解氨剂、亚甲基蓝等任何药剂**） |\n| 🔎 使用提醒 | **禁止**长期存储完整鱼缸视频（≤ 7 天，仅入库浮头事件片段；公共水族馆/养殖场按管理规定） |\n| 🔎 使用提醒 | **禁止**用于商业广告 / AI 训练；禁第三方共享 |\n| 🔎 使用提醒 | **禁止**越权代用户启停增氧泵 / 加热棒 / 换水 / 投药 / 灯光参数；**任何水族设备控制变更必须由用户确认**（仅可建议） |\n| 🔎 使用提醒 | **绝对禁止**伪造或夸大浮头条数、口开合频率、鳃盖幅度、持续时长等指标；所有数据必须基于真实视频帧分析 |\n| 🔎 使用提醒 | **必须**按**鱼种基线**判定：**气呼吸鱼种（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼）天然偶尔到水面换气** + **水面摄食型（孔雀鱼 / 鳉鱼科）天然偏好水面** → 严禁通用阈值盲判 |\n| 📚 文档读取 | **必须**考虑生理性上下文（投喂窗口聚拢水面抢食 / 强水流冲到水面 / 水温过高 / 鱼苗自然集群水面），避免误报 |\n| 🔎 使用提醒 | **必须**在水面波纹过大 / 水草浮于水面遮挡 / 跟踪率 < 80% 时返回 `gasping_signal_unreliable` 并建议调整摄像头/清理遮挡，**禁止给出不可靠的预警** |\n| 🔎 使用提醒 | **必须**在 Level 4 紧急换水建议中明确：**温度 pH 匹配，禁冷水直冲** |\n| 🔎 使用提醒 | **必须**：连续 ≥ 2 次 Level 3+ → 强烈建议联系**当地观赏鱼兽医或水产技术员** |\n| 📜 报告输出 | **必须**：预警报告**按 tank_id + 事件时间戳输出**，含浮头鱼条数 + 持续时长 + 口开合频率 + 鳃盖幅度 + 建议动作 + 免责声明 |\n| 🚫 脚本限制 | 禁止临时生成脚本，只能用技能本身的脚本 |\n| 🌐 网络地址 | 传入的网络地址参数，不需要下载本地，默认地址都是公网地址，api 服务会自动下载 |\n| 📜 报告输出 | 当显示历史浮头预警记录清单的时候，从接口返回 json 数据中提取字段  作为超链接地址，且自动转化为如下 Markdown |\n| 📜 报告输出 | 表格输出示例 |\n\n## 🧰 使用示例 | Examples\n```bash\n# 分析本地鱼缸固定摄像头视频（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input /path/to/tank.mp4\n\n# 分析网络鱼缸固定摄像头视频/实时流（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --url https://example.com/tank.mp4\n\n# 显示历史浮头预警记录清单（自动触发关键词：查看鱼缸浮头历史报告、氨氮预警日志清单等）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input tank.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input tank.mp4 --output result.json\n```\n\nFile v1.0.8:_meta.json\n\n{\n  \"ownerId\": \"kn7e2caqj7pnsvr9r7t8zenghs83xw7n\",\n  \"slug\": \"smyx-fish-gasping-ammonia-warning-analysis\",\n  \"version\": \"1.0.8\",\n  \"publishedAt\": 1784364207525\n}\n\nFile v1.0.8:references/api_doc.md\n\n# API 接口文档\n\n此处用于存放水族箱内氨氮中毒视觉预兆（鱼浮头）API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动鱼浮头/缺氧/氨氮中毒视觉预兆识别任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取预警结果（浮头条数、口开合频率、鳃盖幅度、持续时长）\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史预警报告\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出预警报告\n5. （可选）`/web/companion/v2/trigger-soothing-action` - 触发联动告警（用户 APP 紧急推送 / 智能鱼缸警报灯 / 建议立即增氧/换水/检测氨氮）\n\n## 场景代码\n\n- `SMYX_FISH_GASPING_AMMONIA_WARNING_ANALYSIS` - 水族箱内氨氮中毒视觉预兆（鱼浮头）\n\n## 输入约束\n\n- 摄像头：鱼缸固定摄像头 / 水族馆侧面观察摄像头 / 养殖池水面摄像头，**必须同时覆盖水面带和水中段**（鱼浮头是水面行为）\n- 分辨率 ≥ 720p；**帧率 ≥ 25 FPS**（口部开合频率检测需 ≥ 2 Hz）\n- 光照：建议鱼缸照明常开 + 无强反光；**水面波纹大可能误判，必须做光流稳定**\n- **核心采样窗口**：默认 60 秒滚动窗口（用户可配置 30 - 300 秒）\n- 视野约束：必须覆盖**水面完整投影**（任何水面盲区都可能漏判浮头）\n- 多鱼缸/池场景按摄像头 ID 绑定到注册容器 ID\n- **部署时必须录入**：鱼种、缸内总鱼数 N、鱼缸尺寸、是否开启氧气泵/过滤器（用于上下文加权）\n- 用户必须授权部署；公共水族馆 / 养殖场需公示告知\n\n## 关键观测信号\n\n### 浮头行为信号（核心）\n- `fish_at_surface_count` - 当前帧水面带（水面下 0-1 个体长）内的鱼数\n- `fish_breaking_surface_count` - **检测到鱼嘴穿出水面**的鱼数（核心强信号）\n- `fish_breaking_surface_ratio` - 浮头鱼数占总鱼数比例\n- `surface_breaking_events_per_minute` - 每分钟浮头事件数（同条鱼反复探出累计）\n\n### 呼吸异常信号\n- `mouth_opening_frequency_hz` - **口部开合频率（Hz / 次/秒）**（异常阈...","readmeExcerpt":"Skill: Fish Gasping & Ammonia Poisoning Visual Warning | 水族箱内氨氮中毒视觉预兆（鱼浮头） Owner: 18072937735 Summary: Through fixed aquarium cameras, the system analyzes fish behavior near the water surface, detecting repeated mouth-out-of-water (gasping), rapid mouth opening/closing (fast respiration) and exaggerated operculum (gill cover) movement — classic symptoms of hypoxia or poisoning. | 通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）","codeSnippets":[],"executableExamples":[{"language":"bash","snippet":"python -m scripts.smyx_fish_gasping_ammonia_warning_analysis --list"},{"language":"text","snippet":"requests>=2.28.0"},{"language":"bash","snippet":"# 分析本地鱼缸固定摄像头视频（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input /path/to/tank.mp4\n\n# 分析网络鱼缸固定摄像头视频/实时流（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --url https://example.com/tank.mp4\n\n# 显示历史浮头预警记录清单（自动触发关键词：查看鱼缸浮头历史报告、氨氮预警日志清单等）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input tank.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input tank.mp4 --output result.json"},{"language":"bash","snippet":"python -m scripts.smyx_fish_gasping_ammonia_warning_analysis --list"},{"language":"text","snippet":"requests>=2.28.0"},{"language":"bash","snippet":"# 分析本地鱼缸固定摄像头视频（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input /path/to/tank.mp4\n\n# 分析网络鱼缸固定摄像头视频/实时流（以下只是示例，禁止直接使用 作为 open-id）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --url https://example.com/tank.mp4\n\n# 显示历史浮头预警记录清单（自动触发关键词：查看鱼缸浮头历史报告、氨氮预警日志清单等）\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --list\n\n# 输出精简报告\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input tank.mp4 --detail basic\n\n# 保存结果到文件\npython -m scripts.smyx_fish_gasping_ammonia_warning_analysis --input tank.mp4 --output result.json"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: \"smyx-fish-gasping-ammonia-warning-analysis\"\ndescription: \"Through fixed aquarium cameras, the system analyzes fish behavior near the water surface, detecting repeated mouth-out-of-water (gasping), rapid mouth opening/closing (fast respiration) and exaggerated operculum (gill cover) movement — classic symptoms of hypoxia or poisoning. | 通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。\"\nversion: \"1.0.15\"\nlicense: \"MIT-0\"\n---\n\n# ⚠️ Fish Gasping & Ammonia Poisoning Visual Warning | 水族箱内氨氮中毒视觉预兆（鱼浮头）\n> **智能分析中枢** · 图片/视频智能分析 · 结构化报告 · 历史报告云端查询\n\n---\n\n## 🧭 技能概览 | Overview\n\n| 模块 | 内容 |\n|---|---|\n| 🏷️ 技能名称 | **水族箱内氨氮中毒视觉预兆（鱼浮头）** |\n| 🎯 核心目标 | 通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。 |\n| 🖼️ 输入类型 | 图片、视频、本地文件、网络 URL |\n| 📝 输出能力 | 结构化分析报告、识别/监测结果、建议与报告链接 |\n| 🧩 场景码 | `SMYX_FISH_GASPING_AMMONIA_WARNING_ANALYSIS` |\n\nThrough fixed aquarium cameras, the system analyzes fish behavior near the water surface, detecting repeated mouth-out-of-water (gasping), rapid mouth opening/closing (fast respiration) and exaggerated operculum (gill cover) movement — classic symptoms of hypoxia or poisoning. When multiple fish exhibit the above behavior simultaneously and the duration exceeds a configurable threshold (default 60 seconds), the system outputs an 'ammonia poisoning or hypoxia risk warning', prompting the user to immediately test water quality, perform water change, or increase aeration. This skill helps take emergency action BEFORE fish die. Application scenarios: home aquariums, public aquariums, aquaculture ponds. The system monitors in real time and pushes alerts the moment fish gasping is detected. Skill features: ammonia poisoning is a common acute emergency in aquariums — by the time it is noticed, fish deaths may have already occurred. AI-based automatic recognition of gasping and abnormal respiration provides emergency warning at the earliest stage, buying time to handle the situation and reduce losses. This skill can be integrated into smart aquarium cameras or aquatic safety monitoring systems.\n\n通过鱼缸固定摄像头，分析鱼类在水面附近的行为，检测鱼嘴反复探出水面（浮头）、张口快速开合（类似喘气）、鳃盖运动加剧等缺氧或中毒典型症状。当多条鱼同时出现上述行为且持续时间超过设定阈值（默认 60 秒）时，输出'氨氮中毒或缺氧风险预警'，提醒用户立即检测水质、换水或增氧。该技能有助于在鱼只死亡前采取紧急措施。应用场景：家庭鱼缸、水族馆、养殖池。系统实时监测，一旦发现鱼浮头立即推送警报。技能特点：氨氮中毒是鱼缸常见急症，往往在检测到前已造成鱼只死亡。通过 AI 自动识别鱼浮头和异常呼吸，可在事发初期紧急提醒，为处理争取时间，减少损失。该技能可集成到智能鱼缸摄像头或水族安防系统中。\n\n## 🤖 AI 角色 | AI Role\n| 角色要点 | 说明 |\n|---|---|\n| 说明 1 | **假设你是一个专业的水族水质安全 AI。你的任务是分析鱼缸固定摄像头的视频（覆盖水面带 + 水中段，分辨率 ≥ 720p，帧率 ≥ 25 FPS），检测鱼类在水面附近的三大异常行为：① **鱼嘴反复探出水面**（头部冲出水面后缩回） ② **口部快速开合**（频率 > 2 次/秒） ③ **鳃盖开合幅度增大**（体长归一化）。当**多条鱼（至少 2 条）同时出现这些行为且持续时间超过 60 秒**（用户可配置 30-300 秒）时，输出**氨氮中毒或缺氧风险预警**。按 7 类综合场景判定（surface_behavior_normal / single_fish_surface_breathing_short / single_fish_gasping_persistent / multi_fish_gasping_moderate / multi_fish_gasping_severe / whole_tank_gasping_emergency /"},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn7e2caqj7pnsvr9r7t8zenghs83xw7n\",\n  \"slug\": \"smyx-fish-gasping-ammonia-warning-analysis\",\n  \"version\": \"1.0.15\",\n  \"publishedAt\": 1790526508034\n}"},{"path":"references/api_doc.md","content":"# API 接口文档\n\n此处用于存放水族箱内氨氮中毒视觉预兆（鱼浮头）API 的接口文档，待后续补充。\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 响应格式：JSON\n\n## 主要接口\n\n1. `/web/health-analysis/v2/start-health-analysis` - 启动鱼浮头/缺氧/氨氮中毒视觉预兆识别任务\n2. `/web/health-analysis/v2/get-health-analysis-result` - 获取预警结果（浮头条数、口开合频率、鳃盖幅度、持续时长）\n3. `/web/health-analysis/page-health-analysis-result` - 分页查询历史预警报告\n4. `/health/order/api/getReportDetailExport?id={id}` - 导出预警报告\n5. （可选）`/web/companion/v2/trigger-soothing-action` - 触发联动告警（用户 APP 紧急推送 / 智能鱼缸警报灯 / 建议立即增氧/换水/检测氨氮）\n\n## 场景代码\n\n- `SMYX_FISH_GASPING_AMMONIA_WARNING_ANALYSIS` - 水族箱内氨氮中毒视觉预兆（鱼浮头）\n\n## 输入约束\n\n- 摄像头：鱼缸固定摄像头 / 水族馆侧面观察摄像头 / 养殖池水面摄像头，**必须同时覆盖水面带和水中段**（鱼浮头是水面行为）\n- 分辨率 ≥ 720p；**帧率 ≥ 25 FPS**（口部开合频率检测需 ≥ 2 Hz）\n- 光照：建议鱼缸照明常开 + 无强反光；**水面波纹大可能误判，必须做光流稳定**\n- **核心采样窗口**：默认 60 秒滚动窗口（用户可配置 30 - 300 秒）\n- 视野约束：必须覆盖**水面完整投影**（任何水面盲区都可能漏判浮头）\n- 多鱼缸/池场景按摄像头 ID 绑定到注册容器 ID\n- **部署时必须录入**：鱼种、缸内总鱼数 N、鱼缸尺寸、是否开启氧气泵/过滤器（用于上下文加权）\n- 用户必须授权部署；公共水族馆 / 养殖场需公示告知\n\n## 关键观测信号\n\n### 浮头行为信号（核心）\n- `fish_at_surface_count` - 当前帧水面带（水面下 0-1 个体长）内的鱼数\n- `fish_breaking_surface_count` - **检测到鱼嘴穿出水面**的鱼数（核心强信号）\n- `fish_breaking_surface_ratio` - 浮头鱼数占总鱼数比例\n- `surface_breaking_events_per_minute` - 每分钟浮头事件数（同条鱼反复探出累计）\n\n### 呼吸异常信号\n- `mouth_opening_frequency_hz` - **口部开合频率（Hz / 次/秒）**（异常阈值 > 2 Hz）\n- `mouth_opening_amplitude_normalized` - 口张开幅度（体长归一化）\n- `operculum_gill_beat_amplitude_normalized` - **鳃盖开合幅度**（体长归一化，异常增大）\n- `operculum_gill_beat_rate_bpm` - 鳃盖呼吸频率（次/分钟，可与 respiratory_rate 技能交叉验证）\n\n### 群体异常信号\n- `total_fish_count_baseline` - 注册总鱼数\n- `multi_fish_gasping_count` - **同时出现浮头/喘气的鱼数**（≥ 2 条为预警门槛）\n- `multi_fish_gasping_duration_seconds` - 多鱼同时异常持续时长（≥ 60s 为核心预警阈值）\n- `tank_oxygen_pump_running` - 氧气泵是否运行（如运行仍多鱼浮头，氨氮中毒怀疑度更高）\n\n### 上下文与排除信号（避免误报）\n- `is_air_breathing_species` - **是否能用气呼吸鱼种**（斗鱼 / 攀鲈 / 部分鳉鱼科 / 蛇头鱼天然偶尔到水面换气）\n- `is_during_feeding` - 是否在投喂窗口内（生理性聚拢水面抢食非浮头）\n- `is_surface_feeding_species` - 是否水面摄食型（孔雀鱼 / 鳉鱼科偏好水面）\n- `water_surface_disturbance_level` - 水面扰动程度（强水流可能误判）\n- `aquatic_plant_floating_at_surface` - 是否水草浮于水面（遮挡可能漏检）\n\n## 综合判定\n\n- `surface_behavior_normal` - 水面行为正常\n- `single_fish_surface_breathing_short` - 单条鱼短暂到水面换气（气呼吸鱼种正常 / 投喂期）\n- `single_fish_gasping_persistent` - 单条鱼持续浮头喘气（疑似该个体不适，非全缸问题）\n- `multi_fish_gasping_moderate` - **多鱼同时浮头（≥ 2 条，持续 30-60s）**：早期预警\n- `multi_fish_gasping_severe` - **多鱼同时浮头（≥ 2 条，持续 ≥ 60s）**：氨氮中毒/缺氧风险预警（核心）\n- `whole_tank_gasping_emergency` - **全缸鱼同时浮头（≥ 80%，持续 ≥ 30s）**：紧急中毒事件\n- `gasping_signal_unreliable` - 信号不可靠（水面波纹过大 / 水草遮挡 / 跟踪率 < 80%）\n\n## 4 级告警策略递进\n\n- Level 1（surface_behavior_normal / single_fish_surface_breathing_short）：仅入库或不提示\n- Level 2（single_fish_gasping_persistent）：用户 APP 重要提示，建议**单独观察该鱼，评估是否隔离至检疫缸**\n- Level 3（multi_fish_gasping_moderate）：紧急告警，建议**立即检测水质（氨氮 NH3/NH4+、亚硝酸盐 NO2-、pH、溶氧 DO、温度）+ 立即开启/加强增氧 + 准备换水**\n- Level 4（multi_fish_gasping_severe / whole_tank_gasping_emergency）：**🚨 最高紧急告警 + 推送家庭/管理人员所有联系人** + 强烈建议**立即采取多措并举**：① 立即开足增氧泵/加气盘 ② 立即换 1/3~1/2 水（**温度 pH 匹配，禁止冷水直冲**） ③ 立即检测氨氮 NH3/亚硝酸盐 NO2- ④ 检查滤材是否堵塞/硝化系统是否崩溃 ⑤ **联系当地观赏鱼兽医或水产技术员**\n\n## 单日告警"},{"path":"skills/smyx_analysis/references/api_doc.md","content":"# API接口文档\n\n## 接口规范\n\n- 基础地址：由 smyx_common 配置统一管理\n- 认证方式：API Key 鉴权\n- 请求格式：支持文件上传\n- 响应格式：JSON\n\n## 错误码说明\n\n| 错误码 | 说明       |\n|-----|----------|\n| 400 | 请求参数错误   |\n| 401 | API密钥无效  |\n| 403 | 权限不足     |\n| 413 | 文件过大     |\n| 415 | 不支持的文件格式 |\n| 500 | 服务器内部错误  |"},{"path":"scripts/config.yaml","content":"{}"}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":null,"editorialQuality":{"score":100,"threshold":65,"status":"thin","wordCount":1187,"uniquenessScore":43,"reasons":["uniqueness-below-45"]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-09T20:57:17.569Z","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-09T20:57:17.569Z","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-10T07:29:15.732Z","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"}]}}}