跳到正文
Skillpedia
部署与云(DevOps)8.3k · #12472

yao-daemon

它能做什么

这项技能管理 Yao 平台上长期运行的后台服务,例如开发服务器。适合需要在工作时保持服务器运行的开发者。

适用场景

  • ✓当你希望在后台启动一个开发服务器的时候。
  • ✓当某个后台服务需要检查或重启时。
  • ✓当你想停止仍在运行的服务时。

技能链接

https://github.com/YaoApp/yao/blob/main/tools/skills/yao-daemon/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/YaoApp/yao/blob/main/tools/skills/yao-daemon/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请在后台启动开发服务器,准备好后告诉我它的地址。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会在后台启动服务,通过 ID 对其进行跟踪,并在端口就绪后报告端口。它可以检查状态、读取输出、重启或停止服务。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Daemon Management

Tools

  • yao_daemon_start — Start a long-running service. Always runs in background; returns daemon_id immediately.
  • yao_daemon_list — List daemons. Supports --status filter and --limit/--offset pagination.
  • yao_daemon_status — Get full details for a daemon (daemon_port, daemon_url, started_at, daemon_restarts).
  • yao_daemon_stop — Stop a running daemon.
  • yao_daemon_restart — Restart a daemon (preserves the same ID, increments daemon_restarts).
  • yao_job_output — Read daemon output (pass daemon_id as job_id).

Parameters

yao_daemon_start

Param Required Default Description
command yes — Shell command to execute
description yes — Concise 5–10 word summary
port no auto-detect Expected listen port; the system verifies the port is ready before reporting it
args no — Additional arguments
working_dir no workspace Working directory

yao_daemon_list

Param Default Description
status all Filter: running, stopping, completed, failed, cancelled, port_detecting, all
limit 20 Max items per page
offset 0 Skip first N items

yao_daemon_restart / yao_daemon_status / yao_daemon_stop

Param Required Description
daemon_id yes The daemon ID

Response Fields

All responses are JSON. Daemon objects contain:

id, kind, session_id, status, description,
command, command_argv, command_line, pid, pgid, user,
started_at, finished_at, duration_ms, exit_code, signal, detail,
daemon_port, daemon_url, daemon_restarts, seq
  • daemon_port — The verified listen port (0 if not yet detected or not specified).
  • daemon_url — http://localhost:<port> (empty until port is verified as listening by the daemon's own process tree).
  • daemon_restarts — Number of restarts via yao_daemon_restart.
  • started_at — Unix millisecond timestamp of the most recent start.

Port detection behavior:

Both modes start by returning port_detecting with daemon_port: 0 if the port is not confirmed within the initial ~2s settle window. If the port is confirmed within ~2s, start returns running with daemon_port/daemon_url directly.

  • --port N (explicit): Verifies port N is listening AND owned by this daemon's process tree. If not confirmed within 2s, returns status: "port_detecting". Poll yao_daemon_status until status changes to running — either with daemon_port: N and daemon_url (port confirmed), or with daemon_port: 0 and detail: "specified port N not detected within timeout" (60s).
  • No --port (auto-detect): Scans the daemon's process tree for any listening TCP port. If not found within 2s, returns status: "port_detecting". The scan continues in background (60s); if a port is found, status changes to running with daemon_port/daemon_url and a <BackgroundJobReceipt> is delivered. If no port is found after ~60s, status changes to running with daemon_port: 0.

List (paginated)

{ "daemons": [...], "total": 5, "offset": 0, "limit": 20, "has_more": false }

Stop (already terminal)

{ "job": { ... }, "detail": "already in terminal state (cancelled); no action taken" }

Errors

Structured JSON with code and message:

{ "error": { "code": "not_found", "message": "daemon \"dmn_xxx\" not found" } }

Codes: invalid_argument, not_found, internal.

Usage Rules

  1. Always provide a description.
  2. Specify port when starting a server — the system confirms the port is actually listening before reporting daemon_url.
  3. Daemons run indefinitely — use yao_daemon_stop to terminate.
  4. Use yao_daemon_restart to restart a crashed or misconfigured daemon without losing its ID.
  5. Monitor output with yao_job_output passing the daemon_id as job_id.

BackgroundJobReceipt

When a daemon's port becomes ready, the system delivers a <BackgroundJobReceipt> XML message containing the daemon_url. Use that URL for subsequent HTTP requests to the daemon.

常见问题

它会阻塞我的对话吗?

不会。服务始终在后台运行,智能体会立即获得一个 ID。

重启会改变 ID 吗?

不会。重启会保持相同的 ID,并统计重启次数。

我如何查看服务输出了什么?

智能体使用单独的输出工具读取它的输出。

详情

作者的原始描述

Daemon process management — start, monitor, restart, stop long-running services. ALWAYS invoke this skill when the user asks to start, check, restart, or stop background services, dev servers, or daemon processes.

repo: YaoApp/yao

热度

GitHub 星标
8.3k
排名
#12472
许可证
—
更新时间
2026/10/19

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能