@agents-uni/zhenhuan 0.1.5 → 0.1.6
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.en.md +61 -42
- package/README.md +63 -44
- package/package.json +1 -1
package/README.en.md
CHANGED
|
@@ -75,36 +75,35 @@ Built on [@agents-uni/core](https://github.com/agents-uni/core), it models a com
|
|
|
75
75
|
|
|
76
76
|
## Quick Start
|
|
77
77
|
|
|
78
|
-
###
|
|
78
|
+
### Zero-config Experience
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
# Use as a dependency
|
|
82
|
-
npm install @agents-uni/zhenhuan
|
|
83
|
-
|
|
84
|
-
# Or clone the repo for local development
|
|
85
|
-
git clone https://github.com/agents-uni/zhenhuan.git
|
|
86
|
-
cd zhenhuan
|
|
87
|
-
npm install
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### Start the server
|
|
80
|
+
Install and launch immediately — the package ships with a complete palace configuration (7 concubine agents):
|
|
91
81
|
|
|
92
82
|
```bash
|
|
93
|
-
# Global install, then use from any directory
|
|
94
83
|
npm install -g @agents-uni/zhenhuan
|
|
95
84
|
zhenhuan serve
|
|
96
85
|
|
|
97
|
-
# Or in the project directory
|
|
98
|
-
npm start
|
|
99
|
-
|
|
100
86
|
# Or with npx (no global install needed)
|
|
101
87
|
npx @agents-uni/zhenhuan serve
|
|
102
|
-
|
|
103
|
-
# Use a custom spec file
|
|
104
|
-
zhenhuan serve --spec /path/to/my-universe.yaml
|
|
105
88
|
```
|
|
106
89
|
|
|
107
|
-
> 💡
|
|
90
|
+
> 💡 `zhenhuan` CLI path resolution: first checks for `universe.yaml` in the current directory; if not found, falls back to the built-in palace configuration. You can also specify a custom path with `--spec`.
|
|
91
|
+
|
|
92
|
+
### Custom Project
|
|
93
|
+
|
|
94
|
+
If you want to modify concubine configurations, add new agents, or use group chat with `@agents-uni/chat`, create a local project:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Initialize a project (generates universe.yaml in current directory)
|
|
98
|
+
mkdir my-palace && cd my-palace
|
|
99
|
+
npx uni init my-palace --uni zhenhuan
|
|
100
|
+
|
|
101
|
+
# Edit universe.yaml to customize concubines...
|
|
102
|
+
|
|
103
|
+
# Deploy to OpenClaw and start
|
|
104
|
+
npx uni deploy
|
|
105
|
+
zhenhuan serve
|
|
106
|
+
```
|
|
108
107
|
|
|
109
108
|
On startup, it prints the access URLs:
|
|
110
109
|
|
|
@@ -417,15 +416,19 @@ universe.yaml
|
|
|
417
416
|
|
|
418
417
|
### Deploy Agents to OpenClaw
|
|
419
418
|
|
|
419
|
+
> 💡 `zhenhuan serve` auto-registers agents on startup — manual deployment is only needed when using OpenClaw workspaces without the server.
|
|
420
|
+
|
|
421
|
+
If you have a local project directory (created via `uni init` or cloned from the repo), run in that directory:
|
|
422
|
+
|
|
420
423
|
```bash
|
|
421
|
-
#
|
|
422
|
-
npx uni deploy
|
|
424
|
+
# Auto-detects universe.yaml in current directory
|
|
425
|
+
npx uni deploy
|
|
423
426
|
|
|
424
|
-
# Custom directory
|
|
425
|
-
npx uni deploy
|
|
427
|
+
# Custom OpenClaw directory
|
|
428
|
+
npx uni deploy --dir ~/.openclaw
|
|
426
429
|
|
|
427
430
|
# Dry run (preview only)
|
|
428
|
-
npx uni deploy
|
|
431
|
+
npx uni deploy --dry-run
|
|
429
432
|
```
|
|
430
433
|
|
|
431
434
|
Or use pre-built SOUL.md files (hand-tuned with richer personality descriptions):
|
|
@@ -463,34 +466,48 @@ const { dispatch, race } = await orchestrator.dispatchAndRace(
|
|
|
463
466
|
|
|
464
467
|
## Group Chat (with @agents-uni/chat)
|
|
465
468
|
|
|
466
|
-
Horse racing is the "arena"; group chat is "daily life".
|
|
469
|
+
Horse racing is the "arena"; group chat is "daily life". [@agents-uni/chat](https://github.com/agents-uni/chat) lets your concubines talk freely in a shared chat room — forming alliances, arguing, scheming — and their relationships evolve in real time based on the conversation.
|
|
467
470
|
|
|
468
471
|
### Quick Start
|
|
469
472
|
|
|
473
|
+
`agents-chat` needs to read `universe.yaml` to know which concubines exist and their relationships. You need a local project directory:
|
|
474
|
+
|
|
470
475
|
```bash
|
|
471
|
-
#
|
|
472
|
-
|
|
476
|
+
# 1. Initialize a palace project (generates universe.yaml)
|
|
477
|
+
mkdir my-palace && cd my-palace
|
|
478
|
+
npx uni init my-palace --uni zhenhuan
|
|
473
479
|
|
|
474
|
-
# Deploy agents
|
|
475
|
-
uni deploy
|
|
480
|
+
# 2. Deploy agents to OpenClaw workspaces (generates SOUL.md etc.)
|
|
481
|
+
npx uni deploy
|
|
476
482
|
|
|
477
|
-
# Start group chat in
|
|
478
|
-
agents-chat serve
|
|
479
|
-
# Or specify the config file
|
|
480
|
-
agents-chat serve --spec /path/to/universe.yaml
|
|
483
|
+
# 3. Start group chat (auto-detects universe.yaml in current directory)
|
|
484
|
+
npx agents-chat serve
|
|
481
485
|
```
|
|
482
486
|
|
|
483
487
|
Open `http://localhost:3000` in your browser. You are the Emperor — concubines respond automatically based on the topic.
|
|
484
488
|
|
|
489
|
+
> 💡 If you don't want to initialize a project, you can point directly to the bundled config:
|
|
490
|
+
> ```bash
|
|
491
|
+
> agents-chat serve --spec node_modules/@agents-uni/zhenhuan/universe.yaml
|
|
492
|
+
> ```
|
|
493
|
+
|
|
485
494
|
### Racing + Chat Combined
|
|
486
495
|
|
|
487
|
-
Both share the same `universe.yaml` and OpenClaw workspaces
|
|
496
|
+
Both share the same `universe.yaml` and OpenClaw workspaces. Run them side by side from the same project directory:
|
|
497
|
+
|
|
498
|
+
```bash
|
|
499
|
+
# Terminal 1: Horse racing (port 8089)
|
|
500
|
+
zhenhuan serve
|
|
488
501
|
|
|
489
|
-
|
|
490
|
-
|
|
502
|
+
# Terminal 2: Group chat (port 3000)
|
|
503
|
+
agents-chat serve
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
| Scenario | Which to use | Notes |
|
|
507
|
+
|----------|-------------|-------|
|
|
491
508
|
| Concubines compete on the same task, ELO ranking | `zhenhuan serve` | Horse race |
|
|
492
509
|
| Concubines chat freely, observe interactions | `agents-chat serve` | Group chat |
|
|
493
|
-
| Discuss approaches first, then compete on execution | Both
|
|
510
|
+
| Discuss approaches first, then compete on execution | Both together | Chat then race |
|
|
494
511
|
|
|
495
512
|
### Relationship Evolution in Chat
|
|
496
513
|
|
|
@@ -509,12 +526,14 @@ These changes are reflected in real time on the chat UI's relationship graph. Co
|
|
|
509
526
|
import { PalaceOrchestrator } from '@agents-uni/zhenhuan';
|
|
510
527
|
import { ChatEngine } from '@agents-uni/chat';
|
|
511
528
|
|
|
512
|
-
//
|
|
513
|
-
|
|
529
|
+
const specPath = 'universe.yaml'; // same config file
|
|
530
|
+
|
|
531
|
+
// Horse racing engine
|
|
532
|
+
const orchestrator = await PalaceOrchestrator.fromSpec(specPath);
|
|
514
533
|
|
|
515
|
-
//
|
|
534
|
+
// Group chat engine
|
|
516
535
|
const chat = new ChatEngine({
|
|
517
|
-
specPath
|
|
536
|
+
specPath,
|
|
518
537
|
maxRespondents: 3,
|
|
519
538
|
contextWindow: 20,
|
|
520
539
|
});
|
package/README.md
CHANGED
|
@@ -75,36 +75,35 @@
|
|
|
75
75
|
|
|
76
76
|
## 快速开始
|
|
77
77
|
|
|
78
|
-
###
|
|
78
|
+
### 零配置体验
|
|
79
79
|
|
|
80
|
-
|
|
81
|
-
# 作为依赖使用
|
|
82
|
-
npm install @agents-uni/zhenhuan
|
|
83
|
-
|
|
84
|
-
# 或克隆仓库本地开发
|
|
85
|
-
git clone https://github.com/agents-uni/zhenhuan.git
|
|
86
|
-
cd zhenhuan
|
|
87
|
-
npm install
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### 启动服务器
|
|
80
|
+
安装后直接启动,包自带完整的甄嬛后宫配置(7 个嫔妃 Agent):
|
|
91
81
|
|
|
92
82
|
```bash
|
|
93
|
-
# 全局安装后,在任意目录直接使用
|
|
94
83
|
npm install -g @agents-uni/zhenhuan
|
|
95
84
|
zhenhuan serve
|
|
96
85
|
|
|
97
|
-
# 或在项目目录中
|
|
98
|
-
npm start
|
|
99
|
-
|
|
100
86
|
# 或用 npx(无需全局安装)
|
|
101
87
|
npx @agents-uni/zhenhuan serve
|
|
102
|
-
|
|
103
|
-
# 使用自定义规范文件
|
|
104
|
-
zhenhuan serve --spec /path/to/my-universe.yaml
|
|
105
88
|
```
|
|
106
89
|
|
|
107
|
-
> 💡
|
|
90
|
+
> 💡 `zhenhuan` CLI 的路径解析逻辑:优先使用当前目录的 `universe.yaml`,找不到时自动回退到包自带的默认后宫配置。你也可以通过 `--spec` 显式指定。
|
|
91
|
+
|
|
92
|
+
### 自定义项目
|
|
93
|
+
|
|
94
|
+
如果你想修改嫔妃配置、添加新 Agent,或配合 `@agents-uni/chat` 群聊使用,需要在本地建一个项目:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# 初始化项目(生成 universe.yaml 到当前目录)
|
|
98
|
+
mkdir my-palace && cd my-palace
|
|
99
|
+
npx uni init my-palace --uni zhenhuan
|
|
100
|
+
|
|
101
|
+
# 编辑 universe.yaml 自定义嫔妃...
|
|
102
|
+
|
|
103
|
+
# 部署到 OpenClaw 并启动
|
|
104
|
+
npx uni deploy
|
|
105
|
+
zhenhuan serve
|
|
106
|
+
```
|
|
108
107
|
|
|
109
108
|
启动后会打印访问链接:
|
|
110
109
|
|
|
@@ -417,15 +416,19 @@ universe.yaml
|
|
|
417
416
|
|
|
418
417
|
### 部署 Agent 到 OpenClaw
|
|
419
418
|
|
|
419
|
+
> 💡 `zhenhuan serve` 会自动注册 Agent,无需手动部署。只有在你想单独使用 OpenClaw 工作区(不启动服务器)时才需要手动部署。
|
|
420
|
+
|
|
421
|
+
如果你有本地项目目录(通过 `uni init` 创建,或克隆仓库),在该目录下运行:
|
|
422
|
+
|
|
420
423
|
```bash
|
|
421
|
-
#
|
|
422
|
-
npx uni deploy
|
|
424
|
+
# 自动读取当前目录的 universe.yaml
|
|
425
|
+
npx uni deploy
|
|
423
426
|
|
|
424
|
-
#
|
|
425
|
-
npx uni deploy
|
|
427
|
+
# 指定 OpenClaw 目录
|
|
428
|
+
npx uni deploy --dir ~/.openclaw
|
|
426
429
|
|
|
427
430
|
# 预览(不实际写入)
|
|
428
|
-
npx uni deploy
|
|
431
|
+
npx uni deploy --dry-run
|
|
429
432
|
```
|
|
430
433
|
|
|
431
434
|
或使用预置 SOUL.md(手工调优版,包含更丰富的性格描写):
|
|
@@ -463,45 +466,59 @@ const { dispatch, race } = await orchestrator.dispatchAndRace(
|
|
|
463
466
|
|
|
464
467
|
## 群聊模式(配合 @agents-uni/chat)
|
|
465
468
|
|
|
466
|
-
赛马竞技是"比武",群聊是"日常"
|
|
469
|
+
赛马竞技是"比武",群聊是"日常"。[@agents-uni/chat](https://github.com/agents-uni/chat) 让后宫嫔妃们在同一个聊天室自由对话——结盟、争吵、密谋都会自然发生,关系随对话内容实时演化。
|
|
467
470
|
|
|
468
471
|
### 快速启动
|
|
469
472
|
|
|
473
|
+
`agents-chat` 需要读取 `universe.yaml` 来了解有哪些嫔妃以及她们之间的关系。你需要先在本地建一个项目目录:
|
|
474
|
+
|
|
470
475
|
```bash
|
|
471
|
-
#
|
|
472
|
-
|
|
476
|
+
# 1. 初始化后宫项目(会生成 universe.yaml 到当前目录)
|
|
477
|
+
mkdir my-palace && cd my-palace
|
|
478
|
+
npx uni init my-palace --uni zhenhuan
|
|
473
479
|
|
|
474
|
-
#
|
|
475
|
-
uni deploy
|
|
480
|
+
# 2. 部署 Agent 到 OpenClaw 工作区(生成 SOUL.md 等文件)
|
|
481
|
+
npx uni deploy
|
|
476
482
|
|
|
477
|
-
#
|
|
478
|
-
agents-chat serve
|
|
479
|
-
# 或指定配置文件
|
|
480
|
-
agents-chat serve --spec /path/to/universe.yaml
|
|
483
|
+
# 3. 启动群聊(自动读取当前目录的 universe.yaml)
|
|
484
|
+
npx agents-chat serve
|
|
481
485
|
```
|
|
482
486
|
|
|
483
|
-
浏览器打开 `http://localhost:3000
|
|
487
|
+
浏览器打开 `http://localhost:3000`,你就是皇帝,嫔妃们根据话题自动应答。
|
|
488
|
+
|
|
489
|
+
> 💡 如果不想初始化项目,也可以用 `--spec` 直接指向包自带的配置:
|
|
490
|
+
> ```bash
|
|
491
|
+
> agents-chat serve --spec node_modules/@agents-uni/zhenhuan/universe.yaml
|
|
492
|
+
> ```
|
|
484
493
|
|
|
485
494
|
### 赛马 + 群聊 配合使用
|
|
486
495
|
|
|
487
|
-
两者共享同一个 `universe.yaml` 和 OpenClaw
|
|
496
|
+
两者共享同一个 `universe.yaml` 和 OpenClaw 工作区,在同一个项目目录下交替使用:
|
|
497
|
+
|
|
498
|
+
```bash
|
|
499
|
+
# 终端 1:赛马竞技(端口 8089)
|
|
500
|
+
zhenhuan serve
|
|
488
501
|
|
|
489
|
-
|
|
502
|
+
# 终端 2:群聊模式(端口 3000)
|
|
503
|
+
agents-chat serve
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
| 场景 | 用哪个 | 说明 |
|
|
490
507
|
|------|--------|------|
|
|
491
508
|
| 让嫔妃们竞争同一任务、ELO 排名 | `zhenhuan serve` | 赛马竞技 |
|
|
492
509
|
| 让嫔妃们自由对话、观察互动 | `agents-chat serve` | 群聊模式 |
|
|
493
|
-
| 先群聊讨论方案,再赛马比拼执行 |
|
|
510
|
+
| 先群聊讨论方案,再赛马比拼执行 | 两者同时 | 先聊后赛 |
|
|
494
511
|
|
|
495
512
|
### 群聊中的关系演化
|
|
496
513
|
|
|
497
|
-
`@agents-uni/chat`
|
|
514
|
+
`@agents-uni/chat` 内置关系推理引擎,从对话中自动检测:
|
|
498
515
|
|
|
499
516
|
- **赞同** — 信任度 +0.05,亲密度 +0.03
|
|
500
517
|
- **反对** — 竞争度 +0.03
|
|
501
518
|
- **协作** — 协同度 +0.05
|
|
502
519
|
- **共识** — 信任度 +0.02,协同度 +0.02
|
|
503
520
|
|
|
504
|
-
|
|
521
|
+
这些变化实时反映在聊天界面的关系图谱中。配合赛马的 ELO 排名,你可以全方位观察嫔妃们的能力和社交动态。
|
|
505
522
|
|
|
506
523
|
### 编程式集成
|
|
507
524
|
|
|
@@ -509,12 +526,14 @@ agents-chat serve --spec /path/to/universe.yaml
|
|
|
509
526
|
import { PalaceOrchestrator } from '@agents-uni/zhenhuan';
|
|
510
527
|
import { ChatEngine } from '@agents-uni/chat';
|
|
511
528
|
|
|
512
|
-
//
|
|
513
|
-
|
|
529
|
+
const specPath = 'universe.yaml'; // 同一份配置文件
|
|
530
|
+
|
|
531
|
+
// 赛马引擎
|
|
532
|
+
const orchestrator = await PalaceOrchestrator.fromSpec(specPath);
|
|
514
533
|
|
|
515
|
-
//
|
|
534
|
+
// 群聊引擎
|
|
516
535
|
const chat = new ChatEngine({
|
|
517
|
-
specPath
|
|
536
|
+
specPath,
|
|
518
537
|
maxRespondents: 3,
|
|
519
538
|
contextWindow: 20,
|
|
520
539
|
});
|