@agents-uni/zhenhuan 0.1.4 → 0.1.5
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 +67 -0
- package/README.md +67 -0
- package/package.json +2 -1
package/README.en.md
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
<a href="#quick-start">Quick Start</a> •
|
|
22
22
|
<a href="#competition-mechanics">Competition</a> •
|
|
23
23
|
<a href="#palace-system">Palace System</a> •
|
|
24
|
+
<a href="#group-chat-with-agents-unichat">Group Chat</a> •
|
|
24
25
|
<a href="#rest-api">API</a> •
|
|
25
26
|
<a href="./DESIGN.md">Design Doc</a>
|
|
26
27
|
</p>
|
|
@@ -460,6 +461,71 @@ const { dispatch, race } = await orchestrator.dispatchAndRace(
|
|
|
460
461
|
|
|
461
462
|
> 📖 Full integration tutorial: [OPENCLAW_INTEGRATION_GUIDE.md](https://github.com/agents-uni/zhenhuan/blob/main/OPENCLAW_INTEGRATION_GUIDE.md)
|
|
462
463
|
|
|
464
|
+
## Group Chat (with @agents-uni/chat)
|
|
465
|
+
|
|
466
|
+
Horse racing is the "arena"; group chat is "daily life". With [@agents-uni/chat](https://github.com/agents-uni/chat), your concubines can talk freely in a shared chat room — forming alliances, arguing, scheming — and their relationships evolve in real time based on the conversation.
|
|
467
|
+
|
|
468
|
+
### Quick Start
|
|
469
|
+
|
|
470
|
+
```bash
|
|
471
|
+
# Install the chat package
|
|
472
|
+
npm install -g @agents-uni/chat
|
|
473
|
+
|
|
474
|
+
# Deploy agents first (if not already deployed)
|
|
475
|
+
uni deploy
|
|
476
|
+
|
|
477
|
+
# Start group chat in the directory containing universe.yaml
|
|
478
|
+
agents-chat serve
|
|
479
|
+
# Or specify the config file
|
|
480
|
+
agents-chat serve --spec /path/to/universe.yaml
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
Open `http://localhost:3000` in your browser. You are the Emperor — concubines respond automatically based on the topic.
|
|
484
|
+
|
|
485
|
+
### Racing + Chat Combined
|
|
486
|
+
|
|
487
|
+
Both share the same `universe.yaml` and OpenClaw workspaces, and can be used simultaneously or alternately:
|
|
488
|
+
|
|
489
|
+
| Scenario | Which to use | Command |
|
|
490
|
+
|----------|-------------|---------|
|
|
491
|
+
| Concubines compete on the same task, ELO ranking | `zhenhuan serve` | Horse race |
|
|
492
|
+
| Concubines chat freely, observe interactions | `agents-chat serve` | Group chat |
|
|
493
|
+
| Discuss approaches first, then compete on execution | Both alternately | Chat then race |
|
|
494
|
+
|
|
495
|
+
### Relationship Evolution in Chat
|
|
496
|
+
|
|
497
|
+
`@agents-uni/chat` includes a built-in relationship inference engine that detects signals from conversations:
|
|
498
|
+
|
|
499
|
+
- **Agreement** — trust +0.05, affinity +0.03
|
|
500
|
+
- **Disagreement** — rivalry +0.03
|
|
501
|
+
- **Collaboration** — synergy +0.05
|
|
502
|
+
- **Consensus** — trust +0.02, synergy +0.02
|
|
503
|
+
|
|
504
|
+
These changes are reflected in real time on the chat UI's relationship graph. Combined with ELO rankings from horse racing, you get a full picture of each concubine's ability and social dynamics.
|
|
505
|
+
|
|
506
|
+
### Programmatic Integration
|
|
507
|
+
|
|
508
|
+
```typescript
|
|
509
|
+
import { PalaceOrchestrator } from '@agents-uni/zhenhuan';
|
|
510
|
+
import { ChatEngine } from '@agents-uni/chat';
|
|
511
|
+
|
|
512
|
+
// Initialize the palace
|
|
513
|
+
const orchestrator = await PalaceOrchestrator.fromSpec('universe.yaml');
|
|
514
|
+
|
|
515
|
+
// Start chat engine with the same config
|
|
516
|
+
const chat = new ChatEngine({
|
|
517
|
+
specPath: 'universe.yaml',
|
|
518
|
+
maxRespondents: 3,
|
|
519
|
+
contextWindow: 20,
|
|
520
|
+
});
|
|
521
|
+
|
|
522
|
+
// Chat: let concubines discuss
|
|
523
|
+
const responses = await chat.processMessage('How should we improve palace cuisine?');
|
|
524
|
+
|
|
525
|
+
// Race: let them compete formally
|
|
526
|
+
const { race } = await orchestrator.dispatchAndRace(task, judge);
|
|
527
|
+
```
|
|
528
|
+
|
|
463
529
|
## Dashboard Integration
|
|
464
530
|
|
|
465
531
|
zhenhuan-uni integrates deeply with the agents-uni-core Dashboard, providing a unified web UI for managing the palace system.
|
|
@@ -568,6 +634,7 @@ npm run build
|
|
|
568
634
|
## Related Projects
|
|
569
635
|
|
|
570
636
|
- [**@agents-uni/core**](https://github.com/agents-uni/core) — The universal protocol layer this project is built on ([npm](https://www.npmjs.com/package/@agents-uni/core))
|
|
637
|
+
- [**@agents-uni/chat**](https://github.com/agents-uni/chat) — Group chat service for agent universes with real-time relationship evolution ([npm](https://www.npmjs.com/package/@agents-uni/chat))
|
|
571
638
|
|
|
572
639
|
## License
|
|
573
640
|
|
package/README.md
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
<a href="#快速开始">快速开始</a> •
|
|
22
22
|
<a href="#竞争机制">竞争机制</a> •
|
|
23
23
|
<a href="#后宫体系">后宫体系</a> •
|
|
24
|
+
<a href="#群聊模式配合-agents-unichat">群聊模式</a> •
|
|
24
25
|
<a href="#rest-api">API</a> •
|
|
25
26
|
<a href="./DESIGN.md">设计文档</a>
|
|
26
27
|
</p>
|
|
@@ -460,6 +461,71 @@ const { dispatch, race } = await orchestrator.dispatchAndRace(
|
|
|
460
461
|
|
|
461
462
|
> 📖 详细整合教程见 [OPENCLAW_INTEGRATION_GUIDE.md](https://github.com/agents-uni/zhenhuan/blob/main/OPENCLAW_INTEGRATION_GUIDE.md)
|
|
462
463
|
|
|
464
|
+
## 群聊模式(配合 @agents-uni/chat)
|
|
465
|
+
|
|
466
|
+
赛马竞技是"比武",群聊是"日常"。通过 [@agents-uni/chat](https://github.com/agents-uni/chat) 可以让后宫嫔妃们在同一个聊天室里自由对话——结盟、争吵、密谋都会自然发生,关系也会随对话内容实时演化。
|
|
467
|
+
|
|
468
|
+
### 快速启动
|
|
469
|
+
|
|
470
|
+
```bash
|
|
471
|
+
# 安装 chat 包
|
|
472
|
+
npm install -g @agents-uni/chat
|
|
473
|
+
|
|
474
|
+
# 先部署 Agent(如果还没部署过)
|
|
475
|
+
uni deploy
|
|
476
|
+
|
|
477
|
+
# 在甄嬛后宫的 universe.yaml 目录下启动群聊
|
|
478
|
+
agents-chat serve
|
|
479
|
+
# 或指定配置文件
|
|
480
|
+
agents-chat serve --spec /path/to/universe.yaml
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
浏览器打开 `http://localhost:3000`,你就是皇帝,嫔妃们会根据话题自动应答。
|
|
484
|
+
|
|
485
|
+
### 赛马 + 群聊 配合使用
|
|
486
|
+
|
|
487
|
+
两者共享同一个 `universe.yaml` 和 OpenClaw 工作区,可以同时或交替使用:
|
|
488
|
+
|
|
489
|
+
| 场景 | 用哪个 | 命令 |
|
|
490
|
+
|------|--------|------|
|
|
491
|
+
| 让嫔妃们竞争同一任务、ELO 排名 | `zhenhuan serve` | 赛马竞技 |
|
|
492
|
+
| 让嫔妃们自由对话、观察互动 | `agents-chat serve` | 群聊模式 |
|
|
493
|
+
| 先群聊讨论方案,再赛马比拼执行 | 两者交替 | 先聊后赛 |
|
|
494
|
+
|
|
495
|
+
### 群聊中的关系演化
|
|
496
|
+
|
|
497
|
+
`@agents-uni/chat` 内置了关系推理引擎,会从对话中自动检测:
|
|
498
|
+
|
|
499
|
+
- **赞同** — 信任度 +0.05,亲密度 +0.03
|
|
500
|
+
- **反对** — 竞争度 +0.03
|
|
501
|
+
- **协作** — 协同度 +0.05
|
|
502
|
+
- **共识** — 信任度 +0.02,协同度 +0.02
|
|
503
|
+
|
|
504
|
+
这些关系变化会实时反映在聊天界面的关系图谱中。配合赛马的 ELO 排名,你可以全方位观察嫔妃们的能力和社交动态。
|
|
505
|
+
|
|
506
|
+
### 编程式集成
|
|
507
|
+
|
|
508
|
+
```typescript
|
|
509
|
+
import { PalaceOrchestrator } from '@agents-uni/zhenhuan';
|
|
510
|
+
import { ChatEngine } from '@agents-uni/chat';
|
|
511
|
+
|
|
512
|
+
// 先初始化后宫
|
|
513
|
+
const orchestrator = await PalaceOrchestrator.fromSpec('universe.yaml');
|
|
514
|
+
|
|
515
|
+
// 用同一份配置启动群聊引擎
|
|
516
|
+
const chat = new ChatEngine({
|
|
517
|
+
specPath: 'universe.yaml',
|
|
518
|
+
maxRespondents: 3,
|
|
519
|
+
contextWindow: 20,
|
|
520
|
+
});
|
|
521
|
+
|
|
522
|
+
// 群聊:让嫔妃们讨论
|
|
523
|
+
const responses = await chat.processMessage('各位觉得如何提升后宫膳食质量?');
|
|
524
|
+
|
|
525
|
+
// 赛马:让她们正式比拼
|
|
526
|
+
const { race } = await orchestrator.dispatchAndRace(task, judge);
|
|
527
|
+
```
|
|
528
|
+
|
|
463
529
|
## Dashboard 集成
|
|
464
530
|
|
|
465
531
|
zhenhuan-uni 内置了 agents-uni-core 的 Dashboard,启动服务后直接访问首页即可。
|
|
@@ -570,6 +636,7 @@ npm run build
|
|
|
570
636
|
## 相关项目
|
|
571
637
|
|
|
572
638
|
- [**@agents-uni/core**](https://github.com/agents-uni/core) — 本项目底层的通用 Agent 组织协议层 ([npm](https://www.npmjs.com/package/@agents-uni/core))
|
|
639
|
+
- [**@agents-uni/chat**](https://github.com/agents-uni/chat) — 群聊服务,让 Agent 们在浏览器中自由对话,关系实时演化 ([npm](https://www.npmjs.com/package/@agents-uni/chat))
|
|
573
640
|
|
|
574
641
|
## License
|
|
575
642
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agents-uni/zhenhuan",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Zhen Huan palace drama themed agent competition system built on @agents-uni/core",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build": "tsc",
|
|
28
28
|
"test": "vitest run",
|
|
29
|
+
"lint": "tsc --noEmit",
|
|
29
30
|
"dev": "tsx --watch src/cli/index.ts serve",
|
|
30
31
|
"start": "tsx src/cli/index.ts serve",
|
|
31
32
|
"serve": "tsx src/cli/index.ts serve",
|