← 返回 Skills 市场
closeli-open

Closeli Open Device Event Query

作者 CloseliOpenTeam · GitHub ↗ · v1.0.2 · MIT-0
cross-platform ✓ 安全检测通过
140
总下载
0
收藏
0
当前安装
3
版本数
在 OpenClaw 中安装
/install api-event-query
功能描述
Closeli Device Event Query API. Supports natural language queries for device events and returns an AI summary and event list, including event types, time ran...
使用说明 (SKILL.md)

Event Query API

POST /api/event/query is an AI-powered event query API that supports natural language queries and returns an AI summary and event list.

⚠️ Display Rules (MUST be strictly followed)

The script outputs structured data in JSON format, which is the expected behavior. The display rules below are formatting instructions for the agent: the agent MUST parse the JSON output from the script, convert it into a user-friendly format according to the following rules before displaying it, and MUST NOT display the raw JSON directly.

  1. When code == 0 and data.events is not empty:

📋 AI Summary: {summary}

Time Event Tags Scene Description
{time} {ai_events joined by commas} {ai_scene}

After the table, display the thumbnail link for each event one by one:

📷 {time} - {ai_events} View Screenshot

Key rules:

  • device_id MUST be displayed after removing the xxxxS_ prefix
  • pic_url MUST be output using Markdown link format [View Screenshot](url)
  • MUST NOT use image syntax ![](url) (some clients do not support inline image rendering)
  • MUST NOT output bare URL text
  • If there are more than 10 items, only display the first 10 and indicate the total count
  1. When events is an empty array, reply: "No matching events were found within the query time range."
  2. When code != 0, reply: "API call failed, error code {code}, reason: {message}"

Prerequisites

The script depends on httpx. If it is not installed, the script will prompt python3 -m pip install httpx.

Configuration Declaration

This skill depends on the following configuration items. The agent and user MUST confirm that they are correctly configured before running.

Required Configuration

Configuration Item Delivery Method Description
AI_GATEWAY_API_KEY Environment variable (recommended), ~/.openclaw/.env (fallback), command line --api-key API key used for API authentication. The script automatically retrieves it according to this priority order

Optional Configuration

Configuration Item Delivery Method Default Value Description
AI_GATEWAY_HOST Environment variable, ~/.openclaw/.env https://ai-open.icloseli.com Gateway address
AI_GATEWAY_VERIFY_SSL Environment variable true Set to false to disable TLS certificate verification (development environments only)
AI_GATEWAY_NO_ENV_FILE Environment variable false Set to true to disable fallback reading from ~/.openclaw/.env (recommended for production environments)

Fallback Configuration Path

By default, the script reads the ~/.openclaw/.env file as the fallback configuration source. This file is shared by all skills and uses the format KEY=VALUE (one per line). In production environments, you MUST set AI_GATEWAY_NO_ENV_FILE=true to disable this fallback and instead pass all configuration directly through environment variables.

Security Notes

  • The shared credential file ~/.openclaw/.env can be read by all skills under the same user. In production environments, you MUST pass API_KEY through environment variables and MUST NOT rely on the shared credential file
  • TLS certificate verification is enabled by default. You MUST NOT disable it in production environments (disabling it introduces man-in-the-middle attack risks, and attackers may intercept API_KEY and device data)
  • Before use, you MUST confirm that AI_GATEWAY_HOST points to a trusted domain
  • You MUST use a least-privilege API_KEY to avoid reusing high-privilege credentials. This skill only requires event query permission

Network Access Declaration

This skill only accesses the following endpoints (all under AI_GATEWAY_HOST):

Endpoint Method Purpose
/api/event/query POST Query device events in natural language

The script does not access any other network resources.

Quick Start

python3 query_events.py \
  --device-ids "xxxxS_aabbccddeeff" \
  --start-date "2026-03-16" \
  --end-date "2026-03-18" \
  --query "Was there anyone here today?"

Request Format

Request Body

Parameter Name Type Required Default Value Description
device_ids string[] Yes - Device ID list, cannot be empty. Format: xxxxS_\x3Cmac>
start_date string Yes - Query start date, format yyyy-MM-dd
end_date string Yes - Query end date, format yyyy-MM-dd
query string Yes - Natural language query content
locale string No "zh_CN" Locale, affects the language of the AI summary

Response Format

{
  "code": 0,
  "message": "success",
  "request_id": "\x3C32-character request trace ID>",
  "data": {
    "summary": "A total of 3 person-detected events were identified today.",
    "events": [...],
    "_total_count": 15
  }
}

data Field

Parameter Name Type Description
summary string AI-generated event summary text
events array Event list (the script has already trimmed it to the first 3 items)
_total_count integer Total number of events (additional field added by the script)

Elements of the events Array

Parameter Name Type Description
device_id string Device ID
event_id string Event ID
time string Formatted time string
ai_events string[] List of AI-recognized event tags
ai_scene string AI-described scene text
pic_url string Short link to the event thumbnail (may be empty)

Error Codes

Error Code HTTP Status Code Description
1001 401 api_key not provided
1002 401 api_key is invalid or disabled
2001 400 Missing required parameter
3001 502 Internal gateway service call failed
5000 500 Internal error

Notes

  • device_ids cannot be an empty array, otherwise error code 2001 is returned
  • IMPORTANT: device_id is case-sensitive. The prefix MUST be lowercase xxxxS_, NOT uppercase XXXXS_. The script will auto-correct the case, but the agent SHOULD always pass the correct lowercase format
  • start_date and end_date use the yyyy-MM-dd format
  • query supports natural language
  • Global request timeout is 120 seconds
安全使用建议
This skill appears coherent for querying device events, but review these before installing: 1) Provide a least-privilege AI_GATEWAY_API_KEY (event-query-only) and do not reuse high-privilege keys. 2) Avoid storing the key in the shared fallback file ~/.openclaw/.env in production; set AI_GATEWAY_NO_ENV_FILE=true and pass the key via environment. 3) Ensure AI_GATEWAY_HOST is a trusted domain (default is https://ai-open.icloseli.com). 4) Never set AI_GATEWAY_VERIFY_SSL=false in production (it disables TLS verification and can expose the API key and device data). 5) Be aware the agent will present clickable Markdown links to thumbnails (pic_url); those are external URLs and will be visited by users/clients. Finally, if you need higher assurance, verify the gateway host and API permissions on the server side or inspect network traffic (or run the script in an isolated environment) before granting access.
功能分析
Type: OpenClaw Skill Name: api-event-query Version: 1.0.2 The skill is a legitimate implementation for querying device events from the Closeli AI Gateway. It follows its stated purpose in SKILL.md and query_events.py, providing clear documentation on configuration and security risks associated with the shared credential file (~/.openclaw/.env). There is no evidence of data exfiltration, malicious execution, or deceptive prompt injection.
能力标签
requires-sensitive-credentials
能力评估
Purpose & Capability
Name/description, required binary (python3), and primaryEnv (AI_GATEWAY_API_KEY) align with a device event query skill. Minor inconsistency: the top-level manifest lists no required config paths while SKILL.md and the script explicitly reference the shared fallback ~/.openclaw/.env.
Instruction Scope
SKILL.md limits behavior to calling the /api/event/query endpoint and formatting results for presentation; the script likewise only posts to that endpoint and trims results. The SKILL.md requires the agent to parse JSON and render a specific table/thumbnail format — strict but within scope.
Install Mechanism
No install spec is present (instruction-only) and the script only depends on python3 and httpx (the script prompts to install httpx). No downloads or arbitrary installers are used.
Credentials
Only AI_GATEWAY_API_KEY is required as the primary credential (appropriate). However, the script falls back to reading ~/.openclaw/.env (a shared file for all skills) and exposes options to disable TLS verification via AI_GATEWAY_VERIFY_SSL — both are flagged in SKILL.md but present and increase risk if used improperly. SKILL.md recommends using least-privilege keys and disabling env-file fallback in production.
Persistence & Privilege
The skill does not request always: true, does not modify other skills or system settings, and does not persist credentials itself. It only reads configuration and performs a single API call.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install api-event-query
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /api-event-query 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.2
No functional changes; documentation update only. - SKILL.md fully translated from Chinese to English. - Updated AI_GATEWAY_HOST default value to https://ai-open.icloseli.com. - Added note that device_id prefix is case-sensitive and must use lowercase xxxxS_. - Clarified usage, error handling, and security instructions in English. - No code or logic changes.
v1.0.1
- Skill描述优化,更突出Closeli及自然语言事件查询能力。 - 简化说明内容,明确安全注意事项,强调AI_GATEWAY_API_KEY环境变量配置获取方式。 - 保留所有原请求/响应结构、使用、依赖说明不变。 - 删减冗余举例和背景说明,使文档更精炼易读。
v1.0.0
Version 1.0.0 - Initial release: device状态查询 skill 重构为事件查询 skill,接口从 /api/device/status 切换为 /api/event/query。 - 新增 query_events.py,支持自然语言查询设备事件并返回 AI 摘要和事件列表。 - 移除 check_status.py 以及所有设备状态相关逻辑与说明,全面切换为事件查询功能说明。 - 明确所有展示规则、依赖、环境变量与安全注意事项,适配新的 API 请求与响应结构。 - 新的文档和使用范例,覆盖自然语言事件检索的典型场景。
元数据
Slug api-event-query
版本 1.0.2
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 3
常见问题

Closeli Open Device Event Query 是什么?

Closeli Device Event Query API. Supports natural language queries for device events and returns an AI summary and event list, including event types, time ran... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 140 次。

如何安装 Closeli Open Device Event Query?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install api-event-query」即可一键安装,无需额外配置。

Closeli Open Device Event Query 是免费的吗?

是的,Closeli Open Device Event Query 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Closeli Open Device Event Query 支持哪些平台?

Closeli Open Device Event Query 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Closeli Open Device Event Query?

由 CloseliOpenTeam(@closeli-open)开发并维护,当前版本 v1.0.2。

💬 留言讨论