wayang-ai 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/LICENSE +21 -0
- package/README.md +160 -0
- package/dist/cli.js +4407 -0
- package/package.json +73 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 pgYou
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="assets/wayang-logo.png" alt="Wayang" width="500">
|
|
4
|
+
|
|
5
|
+
### Welcome to play with Wayang
|
|
6
|
+
|
|
7
|
+
Orchestrate multiple AI agents with natural language — plan, dispatch, and coordinate in parallel.
|
|
8
|
+
|
|
9
|
+
[中文文档](docs/README.zh-CN.md)
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Why Wayang
|
|
16
|
+
|
|
17
|
+
Complex AI workflows need more than a single chat. Wayang acts as an intelligent **Controller** that understands your intent, decomposes tasks, dispatches them to parallel **Workers**, and synthesizes the results — all through natural conversation.
|
|
18
|
+
|
|
19
|
+
| | Capability |
|
|
20
|
+
| -------------- | ----------------------------------------------------------- |
|
|
21
|
+
| **Plan** | Decompose complex requests into parallelizable sub-tasks |
|
|
22
|
+
| **Dispatch** | Automatically assign Workers, control concurrency |
|
|
23
|
+
| **Coordinate** | Aggregate results, maintain coherent context |
|
|
24
|
+
| **Respond** | Continue chatting with the Controller while Workers execute |
|
|
25
|
+
|
|
26
|
+
## Features
|
|
27
|
+
|
|
28
|
+
- **Intelligent Scheduling** — Controller uses LLM to decompose tasks and dispatch Workers in parallel
|
|
29
|
+
- **Non-blocking Interaction** — Keep talking to the Controller while tasks run; never wait idle
|
|
30
|
+
- **Task Lifecycle** — Full tracking: create → execute → progress → complete / fail
|
|
31
|
+
- **Multi-Worker Parallelism** — Multiple Workers run simultaneously with configurable concurrency limits
|
|
32
|
+
- **Rich TUI** — Ink-powered (React for CLI) interface with streaming output, slash commands, and keyboard shortcuts
|
|
33
|
+
- **Session Recovery** — `wayang --resume` restores interrupted sessions with automatic crash cleanup
|
|
34
|
+
- **Extensible Workers** — Built-in Puppet Worker and Claude Code Worker; plug in custom third-party Workers
|
|
35
|
+
- **Context Compression** — Automatic compact to prevent token overflow
|
|
36
|
+
|
|
37
|
+
## Architecture
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
┌────────────────────────────────────────────────────────┐
|
|
41
|
+
│ CLI (Ink / React) │
|
|
42
|
+
├──────────────────────┬─────────────────────────────────┤
|
|
43
|
+
│ Controller │ Worker Pool │
|
|
44
|
+
│ (Orchestrator) │ (Parallel Execution) │
|
|
45
|
+
│ - Understand intent │ - bash / read / write │
|
|
46
|
+
│ - Plan & decompose │ - call_agent │
|
|
47
|
+
│ - Synthesize result │ - done / fail termination │
|
|
48
|
+
├──────────────────────┴─────────────────────────────────┤
|
|
49
|
+
│ Supervisor (Orchestration + Lifecycle) │
|
|
50
|
+
├────────────────────────────────────────────────────────┤
|
|
51
|
+
│ Signal Queue · Task Pool · Task Scheduler │
|
|
52
|
+
│ Event Bus · State Persistence · Crash Recovery │
|
|
53
|
+
└────────────────────────────────────────────────────────┘
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Core principle:** _LLM handles intelligence (understanding, judgment, response); code handles mechanics (scheduling, queuing, state management)._
|
|
57
|
+
|
|
58
|
+
## Quick Start
|
|
59
|
+
|
|
60
|
+
### Prerequisites
|
|
61
|
+
|
|
62
|
+
- Node.js >= 20
|
|
63
|
+
|
|
64
|
+
### Install
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
git clone https://github.com/pgYou/wayang.git && cd wayang
|
|
68
|
+
npm install
|
|
69
|
+
npm run build
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Configure
|
|
73
|
+
|
|
74
|
+
On first run, Wayang launches an interactive setup wizard. Just fill in your LLM provider details.
|
|
75
|
+
|
|
76
|
+
Or create `~/.wayang.config.json` manually:
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{
|
|
80
|
+
"providers": {
|
|
81
|
+
"my-model": {
|
|
82
|
+
"endpoint": "https://api.anthropic.com",
|
|
83
|
+
"modelName": "claude-sonnet-4-20250514"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"controller": { "provider": "my-model" },
|
|
87
|
+
"worker": { "provider": "my-model", "maxConcurrency": 3 }
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
API key can be set via config or the `WAYANG_LLM_API_KEY` environment variable.
|
|
92
|
+
|
|
93
|
+
### Run
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
wayang # new session
|
|
97
|
+
waya # alias
|
|
98
|
+
wayang --resume # resume last session
|
|
99
|
+
wayang --resume 20260403-143052 # resume specific session
|
|
100
|
+
wayang --resume --all # list all sessions to pick
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### CLI Options
|
|
104
|
+
|
|
105
|
+
| Flag | Description | Default |
|
|
106
|
+
| --------------------- | ----------------------- | ----------------------- |
|
|
107
|
+
| `--home-dir` | Data storage directory | `~/.wayang` |
|
|
108
|
+
| `-w, --workspace-dir` | Agent working directory | cwd |
|
|
109
|
+
| `-c, --config` | Config file path | `~/.wayang.config.json` |
|
|
110
|
+
| `--resume [id]` | Resume a session | — |
|
|
111
|
+
| `--verbose` | Enable verbose logging | — |
|
|
112
|
+
|
|
113
|
+
## Project Structure
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
src/
|
|
117
|
+
├── cli.ts CLI entry point
|
|
118
|
+
├── bootstrap.ts Startup orchestration
|
|
119
|
+
├── onboard.ts First-run setup
|
|
120
|
+
├── session-select.ts Session picker
|
|
121
|
+
├── ui/ UI layer (Ink components + hooks + pages)
|
|
122
|
+
├── services/
|
|
123
|
+
│ ├── supervisor.ts DI container + lifecycle
|
|
124
|
+
│ ├── controller-loop.ts Main control loop
|
|
125
|
+
│ ├── agents/ Agent layer (Controller + Worker + Prompts + State)
|
|
126
|
+
│ ├── task/ Task domain (pool + scheduler + state)
|
|
127
|
+
│ ├── signal/ Signal domain (queue + event sourcing state)
|
|
128
|
+
│ ├── session/ Session domain (manager + state)
|
|
129
|
+
│ └── tools/ Tool implementations (13 tools)
|
|
130
|
+
├── infra/ Infrastructure (event-bus, logger, state framework, persistence)
|
|
131
|
+
├── types/ Shared types
|
|
132
|
+
└── utils/ Utility functions
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Tech Stack
|
|
136
|
+
|
|
137
|
+
| Layer | Choice |
|
|
138
|
+
| ----------------- | ------------------- |
|
|
139
|
+
| Language | TypeScript |
|
|
140
|
+
| LLM SDK | Vercel AI SDK |
|
|
141
|
+
| CLI Framework | Ink (React for CLI) |
|
|
142
|
+
| CLI Parser | meow |
|
|
143
|
+
| Pre-start Prompts | prompts |
|
|
144
|
+
| Agent Invocation | Claude Agent SDK |
|
|
145
|
+
| Persistence | JSONL + JSON files |
|
|
146
|
+
| Logging | pino |
|
|
147
|
+
| Build | tsup |
|
|
148
|
+
| Testing | vitest |
|
|
149
|
+
|
|
150
|
+
## Testing
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
npm test # 27 test files, 277 tests
|
|
154
|
+
npm run test:watch # watch mode
|
|
155
|
+
npm run lint # type check + lint
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## License
|
|
159
|
+
|
|
160
|
+
MIT
|