@kiki_agent/daemon 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -0
- package/dist/cli.cjs +71968 -0
- package/package.json +47 -0
package/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# @kiki_agent/daemon
|
|
2
|
+
|
|
3
|
+
Kiki 本地执行节点。把你的电脑注册成 Kiki 云端的执行机:云端编排器通过反向隧道把任务派发到本机,由本机的 Claude CLI 实际执行。
|
|
4
|
+
|
|
5
|
+
## 依赖
|
|
6
|
+
|
|
7
|
+
- **Node.js >= 20**(这是一段 Node 程序,必须有 JS 运行时;`npx` 本身也来自 Node)。
|
|
8
|
+
- 本机已配置可用的 **Claude CLI**。
|
|
9
|
+
|
|
10
|
+
> 没装 Node?macOS 用 `brew install node`,或访问 https://nodejs.org 下载安装包。
|
|
11
|
+
|
|
12
|
+
## 快速连接(前台运行)
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npx @kiki_agent/daemon@latest run \
|
|
16
|
+
--server-url https://<your-kiki-domain> \
|
|
17
|
+
--api-key sk_machine_xxx
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
终端保持打开即在运行,关闭终端进程结束。适合首次联调。
|
|
21
|
+
|
|
22
|
+
## 后台常驻 + 开机自启(推荐)
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# 建议先全局安装,获得稳定的可执行路径
|
|
26
|
+
npm i -g @kiki_agent/daemon
|
|
27
|
+
|
|
28
|
+
kiki-daemon install \
|
|
29
|
+
--server-url https://<your-kiki-domain> \
|
|
30
|
+
--api-key sk_machine_xxx
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`install` 会在当前系统注册后台服务:
|
|
34
|
+
|
|
35
|
+
| 平台 | 机制 | 行为 |
|
|
36
|
+
|------|------|------|
|
|
37
|
+
| macOS | LaunchAgent (`~/Library/LaunchAgents/com.kiki.daemon.plist`) | 后台运行、崩溃自动拉起、登录自启 |
|
|
38
|
+
| Linux | systemd user unit (`~/.config/systemd/user/kiki-daemon.service`) | 后台运行、崩溃自动重启、`enable-linger` 后开机自启 |
|
|
39
|
+
| Windows | 暂未自动支持 | 请用任务计划程序 / NSSM 注册 `run` 命令 |
|
|
40
|
+
|
|
41
|
+
安装后可关闭终端,daemon 在后台常驻。
|
|
42
|
+
|
|
43
|
+
### 管理
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
kiki-daemon status # 查看是否已安装 / 运行中
|
|
47
|
+
kiki-daemon uninstall # 停止并移除后台服务
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
数据目录固定为 `~/.kiki/data`,日志在 `~/.kiki/runtime/logs/`。
|
|
51
|
+
|
|
52
|
+
> 安全提示:`install` 会把 `--api-key` 写入服务配置文件(仅当前用户可读)。轮换密钥后请重新 `install`。
|
|
53
|
+
|
|
54
|
+
## 本地开发构建
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm install
|
|
58
|
+
npm run build # esbuild 打包 src/cli.ts -> dist/cli.cjs(除 better-sqlite3 外全部内联)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## 发布到 npm
|
|
62
|
+
|
|
63
|
+
**前置条件**
|
|
64
|
+
|
|
65
|
+
1. [npm 账号](https://www.npmjs.com/signup) 已登录:`npm login`
|
|
66
|
+
2. 属于 `@kiki_agent` 组织(https://www.npmjs.com/settings/kiki_agent)
|
|
67
|
+
|
|
68
|
+
**本地发布**
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
./scripts/publish-daemon.sh
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**GitHub Actions 发布**
|
|
75
|
+
|
|
76
|
+
1. 在 GitHub 仓库 Settings → Secrets 添加 `NPM_TOKEN`(npm Access Token,类型 Automation)
|
|
77
|
+
2. Actions →「Publish @kiki_agent/daemon」→ Run workflow
|
|
78
|
+
|
|
79
|
+
或打 tag 触发:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
git tag daemon-v0.1.0
|
|
83
|
+
git push origin daemon-v0.1.0
|
|
84
|
+
```
|