@rotifer/playground 0.1.0-alpha.2 → 0.3.0-alpha.1
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/CHANGELOG.md +60 -1
- package/README.md +26 -15
- package/README.zh.md +26 -15
- package/dist/commands/agent-create.d.ts.map +1 -1
- package/dist/commands/agent-create.js +67 -4
- package/dist/commands/agent-create.js.map +1 -1
- package/dist/commands/agent-run.d.ts +3 -0
- package/dist/commands/agent-run.d.ts.map +1 -0
- package/dist/commands/agent-run.js +159 -0
- package/dist/commands/agent-run.js.map +1 -0
- package/dist/commands/arena-submit.d.ts.map +1 -1
- package/dist/commands/arena-submit.js +70 -12
- package/dist/commands/arena-submit.js.map +1 -1
- package/dist/commands/arena-watch.d.ts.map +1 -1
- package/dist/commands/arena-watch.js +165 -11
- package/dist/commands/arena-watch.js.map +1 -1
- package/dist/commands/compile.d.ts.map +1 -1
- package/dist/commands/compile.js +151 -20
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/test.d.ts.map +1 -1
- package/dist/commands/test.js +113 -10
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/wrap.d.ts.map +1 -1
- package/dist/commands/wrap.js +4 -1
- package/dist/commands/wrap.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/binding.d.ts +21 -0
- package/dist/utils/binding.d.ts.map +1 -0
- package/dist/utils/binding.js +46 -0
- package/dist/utils/binding.js.map +1 -0
- package/dist/utils/case.d.ts +6 -0
- package/dist/utils/case.d.ts.map +1 -0
- package/dist/utils/case.js +22 -0
- package/dist/utils/case.js.map +1 -0
- package/dist/utils/javy-compiler.d.ts +22 -0
- package/dist/utils/javy-compiler.d.ts.map +1 -0
- package/dist/utils/javy-compiler.js +118 -0
- package/dist/utils/javy-compiler.js.map +1 -0
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,65 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.3.0-alpha.1] - 2026-02-17
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **TS→WASM Auto-Compilation** (Javy / QuickJS)
|
|
13
|
+
- `rotifer compile` auto-detects `index.ts`/`index.js` and compiles to Native WASM
|
|
14
|
+
- Pipeline: TypeScript → esbuild (bundle) → WASI shim → Javy (QuickJS→WASM) → Rotifer IR
|
|
15
|
+
- New `--lang <ts|wasm>` option to force compilation mode
|
|
16
|
+
- `javy-compiler.ts` utility with `compileTypeScriptToWasm()`, `isJavyAvailable()`, `findGeneSource()`
|
|
17
|
+
|
|
18
|
+
- **WASI Sandbox Support** (`rotifer-core::sandbox`)
|
|
19
|
+
- `WasmtimeSandbox` now supports both Direct (`express`) and WASI (`_start`) execution modes
|
|
20
|
+
- Minimal WASI shim: 9 host functions (`fd_read`, `fd_write`, `clock_time_get`, etc.)
|
|
21
|
+
- Auto-detection of WASI vs Direct modules at runtime
|
|
22
|
+
|
|
23
|
+
- **IR Verifier Updates**
|
|
24
|
+
- SIMD instructions downgraded from error to warning (common in Javy/QuickJS output)
|
|
25
|
+
- `_start` entry point accepted alongside `express` for WASI modules
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- Test coverage: 180 → 275 tests (91 TypeScript + 184 Rust)
|
|
30
|
+
- Documentation updated across README (EN/ZH), Getting Started (EN/ZH), and website
|
|
31
|
+
|
|
32
|
+
[0.3.0-alpha.1]: https://github.com/rotifer-protocol/rotifer-playground/releases/tag/v0.3.0-alpha.1
|
|
33
|
+
|
|
34
|
+
## [0.2.0-alpha.1] - 2026-02-22
|
|
35
|
+
|
|
36
|
+
### Added
|
|
37
|
+
|
|
38
|
+
- **IR Compiler Pipeline** (`rotifer-core::compiler`)
|
|
39
|
+
- Custom section builders: `rotifer.version`, `rotifer.phenotype`, `rotifer.constraints`, `rotifer.metering`
|
|
40
|
+
- WASM injector with `irHash` computation (SHA-256 content-addressable)
|
|
41
|
+
- IR verifier: static validation of exports, prohibited instructions, memory limits
|
|
42
|
+
- 5 genesis WASM genes: `echo`, `wrap`, `search`, `summarize`, `translate`
|
|
43
|
+
- `compile_to_ir()` API and NAPI bindings
|
|
44
|
+
|
|
45
|
+
- **CLI Upgrades**
|
|
46
|
+
- `rotifer compile` — full IR compilation with `--wasm`, phenotype update, `compile-result.json`
|
|
47
|
+
- `rotifer arena watch` — real-time ranking diff monitoring with summaries
|
|
48
|
+
|
|
49
|
+
- **Algebra Parallelism**
|
|
50
|
+
- `Par` operator now uses true CPU parallelism via `std::thread::scope`
|
|
51
|
+
|
|
52
|
+
- **crates.io Publish**
|
|
53
|
+
- `rotifer-core` published as an independent Rust crate
|
|
54
|
+
- Full rustdoc coverage on all 150+ public API items
|
|
55
|
+
|
|
56
|
+
### Fixed
|
|
57
|
+
|
|
58
|
+
- `Try` operator: now correctly returns primary result on success (was re-executing)
|
|
59
|
+
|
|
60
|
+
### Changed
|
|
61
|
+
|
|
62
|
+
- Test coverage: 22 → 180 tests across 10 modules (including edge cases)
|
|
63
|
+
- Dependencies: added `rmp-serde`, `wasm-encoder`, `wasmparser`
|
|
64
|
+
|
|
65
|
+
[0.2.0-alpha.1]: https://github.com/rotifer-protocol/rotifer-playground/releases/tag/v0.2.0-alpha.1
|
|
66
|
+
|
|
8
67
|
## [0.1.0-alpha.1] - 2026-02-20
|
|
9
68
|
|
|
10
69
|
### Added
|
|
@@ -59,4 +118,4 @@ Implements Rotifer Protocol Specification v2.9 (Frozen):
|
|
|
59
118
|
- **Simplified**: Agent Lifecycle, Gene Lifecycle, RotiferBinding
|
|
60
119
|
- **Stub**: Formal Verification, Cross-Binding Consistency, ZK Proofs
|
|
61
120
|
|
|
62
|
-
[0.1.0-alpha.1]: https://github.com/rotifer-protocol/playground/releases/tag/v0.1.0-alpha.1
|
|
121
|
+
[0.1.0-alpha.1]: https://github.com/rotifer-protocol/rotifer-playground/releases/tag/v0.1.0-alpha.1
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
Local development environment for the **Rotifer Protocol** — build genes, run Arena competitions, and simulate agent evolution.
|
|
10
10
|
|
|
11
|
-
> **Status:** Alpha (v0.
|
|
11
|
+
> **Status:** Alpha (v0.3.0-alpha.1). Core gene lifecycle, IR compiler pipeline, parallel algebra, **TS→WASM auto-compilation (Javy)**, and live Arena watching are functional.
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
@@ -82,21 +82,31 @@ Your existing code becomes a gene and competes in the Arena.
|
|
|
82
82
|
|
|
83
83
|
### Act 3 — Hooked (30 minutes)
|
|
84
84
|
|
|
85
|
-
Write a
|
|
85
|
+
Write a TypeScript gene and compile it to Native WASM automatically:
|
|
86
86
|
|
|
87
87
|
```bash
|
|
88
|
-
# Write a
|
|
89
|
-
mkdir genes/my-search &&
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
# Write a gene in TypeScript — same language, zero learning curve
|
|
89
|
+
mkdir genes/my-search && cat > genes/my-search/index.ts << 'EOF'
|
|
90
|
+
export function express(input: { query: string }) {
|
|
91
|
+
return { results: [`Found: ${input.query}`], total: 1 };
|
|
92
|
+
}
|
|
93
|
+
EOF
|
|
94
|
+
|
|
95
|
+
rotifer wrap my-search --domain search
|
|
96
|
+
rotifer compile my-search # TS → JS → WASM (Javy) → Rotifer IR
|
|
92
97
|
rotifer arena submit my-search # Watch it climb the rankings
|
|
93
98
|
rotifer arena list --domain search # Compare against Genesis genes
|
|
94
99
|
|
|
95
100
|
# Create an Agent with a gene genome
|
|
96
101
|
rotifer agent create search-bot --genes genesis-web-search my-search
|
|
97
102
|
rotifer agent list
|
|
103
|
+
|
|
104
|
+
# Run the Agent — sequential gene pipeline
|
|
105
|
+
rotifer agent run search-bot --input '{"query":"rotifer protocol"}'
|
|
98
106
|
```
|
|
99
107
|
|
|
108
|
+
**v0.3 highlight:** `rotifer compile` auto-detects TypeScript genes and compiles them to Native WASM via [Javy](https://github.com/bytecodealliance/javy) (QuickJS→WASM). No separate toolchain required.
|
|
109
|
+
|
|
100
110
|
---
|
|
101
111
|
|
|
102
112
|
## Architecture
|
|
@@ -107,12 +117,12 @@ playground/
|
|
|
107
117
|
│ ├── rotifer-core/ Rust: types, sandbox, arena, algebra, fitness, storage
|
|
108
118
|
│ └── rotifer-napi/ napi-rs bridge: Rust ↔ Node.js FFI
|
|
109
119
|
├── src/ TypeScript CLI (commander.js)
|
|
110
|
-
│ ├── commands/
|
|
111
|
-
│ ├── utils/ Config, display
|
|
120
|
+
│ ├── commands/ 11 CLI commands
|
|
121
|
+
│ ├── utils/ Config, display, NAPI binding, Javy compiler
|
|
112
122
|
│ └── errors/ Rust-style error formatting
|
|
113
123
|
├── genes/ 5 Genesis genes (bundled)
|
|
114
124
|
├── templates/ Gene + composition scaffolds
|
|
115
|
-
└── tests/ Unit + E2E test suites (
|
|
125
|
+
└── tests/ Unit + E2E test suites (91 tests)
|
|
116
126
|
```
|
|
117
127
|
|
|
118
128
|
### Layers
|
|
@@ -121,7 +131,7 @@ playground/
|
|
|
121
131
|
|-------|-----------|----------------|
|
|
122
132
|
| **CLI** | TypeScript + commander.js | User interface, command routing, display |
|
|
123
133
|
| **Bridge** | napi-rs (cdylib) | Rust-to-Node.js FFI binding |
|
|
124
|
-
| **Core** | Rust + wasmtime | WASM sandbox, Arena engine, Algebra executor, Fitness computation, SQLite storage |
|
|
134
|
+
| **Core** | Rust + wasmtime | WASM sandbox (Direct + WASI), Arena engine, Algebra executor, Fitness computation, SQLite storage |
|
|
125
135
|
|
|
126
136
|
---
|
|
127
137
|
|
|
@@ -133,12 +143,13 @@ playground/
|
|
|
133
143
|
| `rotifer scan [path]` | Scan source files for candidate gene functions |
|
|
134
144
|
| `rotifer wrap <name>` | Wrap a function as a Rotifer gene |
|
|
135
145
|
| `rotifer test [name]` | Test a gene in L2 sandbox |
|
|
136
|
-
| `rotifer compile [name]` | Compile
|
|
146
|
+
| `rotifer compile [name]` | Compile gene to Rotifer IR (auto TS→WASM via Javy) |
|
|
137
147
|
| `rotifer arena submit <name>` | Submit a gene to the Arena |
|
|
138
148
|
| `rotifer arena list` | List Arena rankings |
|
|
139
149
|
| `rotifer arena watch <domain>` | Watch Arena rankings (MVP: placeholder) |
|
|
140
150
|
| `rotifer agent create <name>` | Create an Agent with a genome |
|
|
141
151
|
| `rotifer agent list` | List all agents |
|
|
152
|
+
| `rotifer agent run <name>` | Execute an agent's genome pipeline |
|
|
142
153
|
|
|
143
154
|
---
|
|
144
155
|
|
|
@@ -181,7 +192,7 @@ cd playground
|
|
|
181
192
|
# TypeScript CLI
|
|
182
193
|
npm install
|
|
183
194
|
npm run build # Build to dist/
|
|
184
|
-
npm test # Run
|
|
195
|
+
npm test # Run 91 TypeScript tests
|
|
185
196
|
npm run lint # Type check only
|
|
186
197
|
|
|
187
198
|
# Rust Core (requires Rust toolchain)
|
|
@@ -211,9 +222,9 @@ Changes driven by implementation feedback are proposed through the ADR process.
|
|
|
211
222
|
## Roadmap
|
|
212
223
|
|
|
213
224
|
- [x] **v0.1.0-alpha.1** — Core CLI + Genesis genes + Arena
|
|
214
|
-
- [
|
|
215
|
-
- [
|
|
216
|
-
- [ ] **v1.0.0** — Full protocol compliance, multi-binding support
|
|
225
|
+
- [x] **v0.2.0-alpha.1** — IR compiler pipeline, live Arena watching, NAPI bridge, end-to-end demo loop
|
|
226
|
+
- [x] **v0.3.0-alpha.1** — Frontend SDK: TS→WASM auto-compilation via Javy, WASI sandbox support
|
|
227
|
+
- [ ] **v1.0.0** — Full protocol compliance, multi-binding support, P2P HLT
|
|
217
228
|
|
|
218
229
|
---
|
|
219
230
|
|
package/README.zh.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
**Rotifer Protocol** 的本地开发环境——构建基因、运行 Arena 竞争、模拟代理进化。
|
|
10
10
|
|
|
11
|
-
> **状态:** Alpha (v0.
|
|
11
|
+
> **状态:** Alpha (v0.3.0-alpha.1)。核心基因生命周期、IR 编译器管线、并行代数、**TS→WASM 自动编译 (Javy)**、实时 Arena 观察已可用。
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
@@ -82,21 +82,31 @@ rotifer arena list # 查看你的基因排名
|
|
|
82
82
|
|
|
83
83
|
### 第三幕——Hooked(30 分钟)
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
用 TypeScript 编写基因,自动编译为原生 WASM:
|
|
86
86
|
|
|
87
87
|
```bash
|
|
88
|
-
#
|
|
89
|
-
mkdir genes/my-search &&
|
|
90
|
-
|
|
91
|
-
|
|
88
|
+
# 用 TypeScript 写基因——同一语言,零学习成本
|
|
89
|
+
mkdir genes/my-search && cat > genes/my-search/index.ts << 'EOF'
|
|
90
|
+
export function express(input: { query: string }) {
|
|
91
|
+
return { results: [`Found: ${input.query}`], total: 1 };
|
|
92
|
+
}
|
|
93
|
+
EOF
|
|
94
|
+
|
|
95
|
+
rotifer wrap my-search --domain search
|
|
96
|
+
rotifer compile my-search # TS → JS → WASM (Javy) → Rotifer IR
|
|
92
97
|
rotifer arena submit my-search # 观察它攀升排名
|
|
93
98
|
rotifer arena list --domain search # 与 Genesis 基因对比
|
|
94
99
|
|
|
95
100
|
# 创建一个拥有基因组的 Agent
|
|
96
101
|
rotifer agent create search-bot --genes genesis-web-search my-search
|
|
97
102
|
rotifer agent list
|
|
103
|
+
|
|
104
|
+
# 运行 Agent——顺序基因管道
|
|
105
|
+
rotifer agent run search-bot --input '{"query":"rotifer protocol"}'
|
|
98
106
|
```
|
|
99
107
|
|
|
108
|
+
**v0.3 亮点:** `rotifer compile` 自动检测 TypeScript 基因,通过 [Javy](https://github.com/bytecodealliance/javy)(QuickJS→WASM)编译为原生 WASM,无需额外工具链。
|
|
109
|
+
|
|
100
110
|
---
|
|
101
111
|
|
|
102
112
|
## 架构
|
|
@@ -107,12 +117,12 @@ playground/
|
|
|
107
117
|
│ ├── rotifer-core/ Rust: 类型、沙箱、Arena、代数、适应度、存储
|
|
108
118
|
│ └── rotifer-napi/ napi-rs 桥接: Rust ↔ Node.js FFI
|
|
109
119
|
├── src/ TypeScript CLI (commander.js)
|
|
110
|
-
│ ├── commands/
|
|
111
|
-
│ ├── utils/
|
|
120
|
+
│ ├── commands/ 11 个 CLI 命令
|
|
121
|
+
│ ├── utils/ 配置、显示、NAPI 绑定、Javy 编译器
|
|
112
122
|
│ └── errors/ Rust 风格的错误格式化
|
|
113
123
|
├── genes/ 5 个 Genesis 基因(内置)
|
|
114
124
|
├── templates/ 基因 + 组合脚手架模板
|
|
115
|
-
└── tests/ 单元测试 + E2E 测试(
|
|
125
|
+
└── tests/ 单元测试 + E2E 测试(91 个测试)
|
|
116
126
|
```
|
|
117
127
|
|
|
118
128
|
### 分层
|
|
@@ -121,7 +131,7 @@ playground/
|
|
|
121
131
|
|----|--------|------|
|
|
122
132
|
| **CLI** | TypeScript + commander.js | 用户界面、命令路由、显示 |
|
|
123
133
|
| **Bridge** | napi-rs (cdylib) | Rust 到 Node.js 的 FFI 绑定 |
|
|
124
|
-
| **Core** | Rust + wasmtime | WASM
|
|
134
|
+
| **Core** | Rust + wasmtime | WASM 沙箱(Direct + WASI)、Arena 引擎、Algebra 执行器、Fitness 计算、SQLite 存储 |
|
|
125
135
|
|
|
126
136
|
---
|
|
127
137
|
|
|
@@ -133,12 +143,13 @@ playground/
|
|
|
133
143
|
| `rotifer scan [path]` | 扫描源文件中的候选基因函数 |
|
|
134
144
|
| `rotifer wrap <name>` | 将函数包装为 Rotifer 基因 |
|
|
135
145
|
| `rotifer test [name]` | 在 L2 沙箱中测试基因 |
|
|
136
|
-
| `rotifer compile [name]` |
|
|
146
|
+
| `rotifer compile [name]` | 编译基因为 Rotifer IR(自动 TS→WASM via Javy) |
|
|
137
147
|
| `rotifer arena submit <name>` | 将基因提交到 Arena |
|
|
138
148
|
| `rotifer arena list` | 列出 Arena 排名 |
|
|
139
149
|
| `rotifer arena watch <domain>` | 观察 Arena 排名(MVP:占位符) |
|
|
140
150
|
| `rotifer agent create <name>` | 创建拥有基因组的 Agent |
|
|
141
151
|
| `rotifer agent list` | 列出所有 Agent |
|
|
152
|
+
| `rotifer agent run <name>` | 执行 Agent 的基因组管道 |
|
|
142
153
|
|
|
143
154
|
---
|
|
144
155
|
|
|
@@ -181,7 +192,7 @@ cd playground
|
|
|
181
192
|
# TypeScript CLI
|
|
182
193
|
npm install
|
|
183
194
|
npm run build # 构建到 dist/
|
|
184
|
-
npm test # 运行
|
|
195
|
+
npm test # 运行 91 个 TypeScript 测试
|
|
185
196
|
npm run lint # 仅类型检查
|
|
186
197
|
|
|
187
198
|
# Rust Core(需要 Rust 工具链)
|
|
@@ -211,9 +222,9 @@ bash demo.sh
|
|
|
211
222
|
## 路线图
|
|
212
223
|
|
|
213
224
|
- [x] **v0.1.0-alpha.1** — 核心 CLI + Genesis 基因 + Arena
|
|
214
|
-
- [
|
|
215
|
-
- [
|
|
216
|
-
- [ ] **v1.0.0** —
|
|
225
|
+
- [x] **v0.2.0-alpha.1** — IR 编译器管线、实时 Arena 观察、NAPI 桥接、端到端演示闭环
|
|
226
|
+
- [x] **v0.3.0-alpha.1** — 前端 SDK:TS→WASM 自动编译 via Javy、WASI 沙箱支持
|
|
227
|
+
- [ ] **v1.0.0** — 完整协议合规、多绑定支持、P2P HLT
|
|
217
228
|
|
|
218
229
|
---
|
|
219
230
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-create.d.ts","sourceRoot":"","sources":["../../src/commands/agent-create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"agent-create.d.ts","sourceRoot":"","sources":["../../src/commands/agent-create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC,eAAO,MAAM,kBAAkB,SAwG5B,CAAC"}
|
|
@@ -44,6 +44,9 @@ exports.agentCreateCommand = new commander_1.Command("create")
|
|
|
44
44
|
.description("Create a new Agent with a genome of genes")
|
|
45
45
|
.argument("<name>", "agent name")
|
|
46
46
|
.option("-g, --genes <genes...>", "gene names to include in genome")
|
|
47
|
+
.option("-d, --domain <domain>", "auto-select top genes from this domain")
|
|
48
|
+
.option("-n, --top <n>", "number of top genes to auto-select", "2")
|
|
49
|
+
.option("--strategy <strategy>", "gene selection strategy", "greedy")
|
|
47
50
|
.action(async (name, options) => {
|
|
48
51
|
const root = (0, config_js_1.getProjectRoot)();
|
|
49
52
|
const config = (0, config_js_1.loadConfig)(root);
|
|
@@ -51,8 +54,10 @@ exports.agentCreateCommand = new commander_1.Command("create")
|
|
|
51
54
|
const agentsDir = (0, node_path_1.join)(root, ".rotifer", "agents");
|
|
52
55
|
(0, node_fs_1.mkdirSync)(agentsDir, { recursive: true });
|
|
53
56
|
const agentId = (0, node_crypto_1.randomUUID)();
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
let genome = [];
|
|
58
|
+
let selectionMode = "manual";
|
|
59
|
+
if (options.genes && options.genes.length > 0) {
|
|
60
|
+
// Manual gene selection
|
|
56
61
|
for (const geneName of options.genes) {
|
|
57
62
|
const geneDir = (0, node_path_1.join)(root, config.genes_dir, geneName);
|
|
58
63
|
if (!(0, node_fs_1.existsSync)((0, node_path_1.join)(geneDir, "phenotype.json"))) {
|
|
@@ -67,20 +72,78 @@ exports.agentCreateCommand = new commander_1.Command("create")
|
|
|
67
72
|
genome.push(geneName);
|
|
68
73
|
}
|
|
69
74
|
}
|
|
75
|
+
else {
|
|
76
|
+
// Auto-select from Arena rankings
|
|
77
|
+
selectionMode = options.strategy;
|
|
78
|
+
const topN = parseInt(options.top, 10) || 2;
|
|
79
|
+
const ranked = getArenaRankings(root, config.genes_dir, options.domain);
|
|
80
|
+
if (ranked.length === 0) {
|
|
81
|
+
display.error("No genes found in Arena" +
|
|
82
|
+
(options.domain ? ` for domain '${options.domain}'` : "") +
|
|
83
|
+
". Submit genes first: rotifer arena submit <gene>");
|
|
84
|
+
process.exit(1);
|
|
85
|
+
}
|
|
86
|
+
genome = ranked.slice(0, topN).map((r) => r.name);
|
|
87
|
+
display.info(`Auto-selected top ${genome.length} gene(s) from Arena` +
|
|
88
|
+
(options.domain ? ` (domain: ${options.domain})` : "") +
|
|
89
|
+
` [strategy: ${selectionMode}]`);
|
|
90
|
+
}
|
|
91
|
+
const compositionType = genome.length >= 2 ? "Seq" : "Single";
|
|
70
92
|
const agent = {
|
|
71
93
|
id: agentId,
|
|
72
94
|
name,
|
|
73
95
|
state: "Active",
|
|
74
96
|
genome,
|
|
97
|
+
composition: compositionType,
|
|
98
|
+
strategy: selectionMode,
|
|
75
99
|
createdAt: new Date().toISOString(),
|
|
76
100
|
reputation: 0.0,
|
|
77
101
|
};
|
|
78
102
|
(0, node_fs_1.writeFileSync)((0, node_path_1.join)(agentsDir, agentId + ".json"), JSON.stringify(agent, null, 2) + "\n");
|
|
79
103
|
display.success(`Agent '${name}' created`);
|
|
80
|
-
display.keyValue("Agent ID", agentId);
|
|
104
|
+
display.keyValue("Agent ID", agentId.slice(0, 12) + "...");
|
|
81
105
|
display.keyValue("State", agent.state);
|
|
82
|
-
display.keyValue("
|
|
106
|
+
display.keyValue("Strategy", selectionMode);
|
|
107
|
+
display.keyValue("Genome", genome.length > 0
|
|
108
|
+
? genome.join(" → ") + ` (${compositionType})`
|
|
109
|
+
: "(empty)");
|
|
83
110
|
console.log();
|
|
111
|
+
if (genome.length >= 2) {
|
|
112
|
+
display.info(`Run: rotifer agent run ${name} — execute the ${compositionType} pipeline`);
|
|
113
|
+
}
|
|
84
114
|
display.info("View agents: rotifer agent list");
|
|
85
115
|
});
|
|
116
|
+
function getArenaRankings(root, genesDir, domainFilter) {
|
|
117
|
+
const dir = (0, node_path_1.join)(root, genesDir);
|
|
118
|
+
if (!(0, node_fs_1.existsSync)(dir))
|
|
119
|
+
return [];
|
|
120
|
+
const entries = [];
|
|
121
|
+
for (const name of (0, node_fs_1.readdirSync)(dir)) {
|
|
122
|
+
const phenotypePath = (0, node_path_1.join)(dir, name, "phenotype.json");
|
|
123
|
+
if (!(0, node_fs_1.existsSync)(phenotypePath))
|
|
124
|
+
continue;
|
|
125
|
+
try {
|
|
126
|
+
const phenotype = JSON.parse((0, node_fs_1.readFileSync)(phenotypePath, "utf-8"));
|
|
127
|
+
if (domainFilter && phenotype.domain !== domainFilter)
|
|
128
|
+
continue;
|
|
129
|
+
const phenoStr = JSON.stringify(phenotype);
|
|
130
|
+
const geneId = (0, node_crypto_1.createHash)("sha256").update(phenoStr).digest("hex");
|
|
131
|
+
const seed = parseInt(geneId.slice(0, 8), 16);
|
|
132
|
+
const isNative = phenotype.fidelity === "Native";
|
|
133
|
+
const baseFitness = isNative ? 0.7 : 0.45;
|
|
134
|
+
const variance = (seed % 250) / 1000;
|
|
135
|
+
entries.push({
|
|
136
|
+
name,
|
|
137
|
+
domain: phenotype.domain || "general",
|
|
138
|
+
fitness: Math.min(baseFitness + variance, 0.99),
|
|
139
|
+
fidelity: phenotype.fidelity || "Wrapped",
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
catch {
|
|
143
|
+
// skip malformed
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
entries.sort((a, b) => b.fitness - a.fitness);
|
|
147
|
+
return entries;
|
|
148
|
+
}
|
|
86
149
|
//# sourceMappingURL=agent-create.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-create.js","sourceRoot":"","sources":["../../src/commands/agent-create.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAoC;AACpC,
|
|
1
|
+
{"version":3,"file":"agent-create.js","sourceRoot":"","sources":["../../src/commands/agent-create.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;YAC1C,MAAM,QAAQ,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC;YAErC,OAAO,CAAC,IAAI,CAAC;gBACX,IAAI;gBACJ,MAAM,EAAE,SAAS,CAAC,MAAM,IAAI,SAAS;gBACrC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,WAAW,GAAG,QAAQ,EAAE,IAAI,CAAC;gBAC/C,QAAQ,EAAE,SAAS,CAAC,QAAQ,IAAI,SAAS;aAC1C,CAAC,CAAC;QACL,CAAC;QAAC,MAAM,CAAC;YACP,iBAAiB;QACnB,CAAC;IACH,CAAC;IAED,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC;IAC9C,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-run.d.ts","sourceRoot":"","sources":["../../src/commands/agent-run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC,eAAO,MAAM,eAAe,SA0GxB,CAAC"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.agentRunCommand = void 0;
|
|
37
|
+
const commander_1 = require("commander");
|
|
38
|
+
const node_fs_1 = require("node:fs");
|
|
39
|
+
const node_path_1 = require("node:path");
|
|
40
|
+
const node_url_1 = require("node:url");
|
|
41
|
+
const display = __importStar(require("../utils/display.js"));
|
|
42
|
+
const config_js_1 = require("../utils/config.js");
|
|
43
|
+
exports.agentRunCommand = new commander_1.Command("run")
|
|
44
|
+
.description("Execute an agent's genome pipeline (Seq composition)")
|
|
45
|
+
.argument("<name>", "agent name to run")
|
|
46
|
+
.option("--input <json>", "input JSON for the pipeline", '{"name":"world"}')
|
|
47
|
+
.option("--verbose", "show intermediate results", false)
|
|
48
|
+
.action(async (name, options) => {
|
|
49
|
+
const root = (0, config_js_1.getProjectRoot)();
|
|
50
|
+
const config = (0, config_js_1.loadConfig)(root);
|
|
51
|
+
display.header("Agent Execution");
|
|
52
|
+
const agent = findAgent(root, name);
|
|
53
|
+
if (!agent) {
|
|
54
|
+
display.rustStyleError({
|
|
55
|
+
code: "E0050",
|
|
56
|
+
message: `Agent '${name}' not found`,
|
|
57
|
+
suggestion: "Create one: rotifer agent create " + name + " --genes <g1> <g2>",
|
|
58
|
+
});
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
if (agent.genome.length === 0) {
|
|
62
|
+
display.error("Agent has an empty genome — nothing to execute");
|
|
63
|
+
display.info("Recreate with genes: rotifer agent create " + name + " --genes <g1> <g2>");
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
let input;
|
|
67
|
+
try {
|
|
68
|
+
input = JSON.parse(options.input);
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
display.error("Invalid --input JSON: " + options.input);
|
|
72
|
+
process.exit(1);
|
|
73
|
+
}
|
|
74
|
+
const compositionType = agent.composition || (agent.genome.length >= 2 ? "Seq" : "Single");
|
|
75
|
+
display.info(`Agent: ${agent.name} (${agent.id.slice(0, 12)}...)`);
|
|
76
|
+
display.info(`Composition: ${compositionType}`);
|
|
77
|
+
display.info(`Pipeline: ${agent.genome.join(" → ")}`);
|
|
78
|
+
console.log();
|
|
79
|
+
const genesDir = (0, node_path_1.join)(root, config.genes_dir);
|
|
80
|
+
const startTime = performance.now();
|
|
81
|
+
let current = input;
|
|
82
|
+
for (let i = 0; i < agent.genome.length; i++) {
|
|
83
|
+
const geneName = agent.genome[i];
|
|
84
|
+
const geneDir = (0, node_path_1.join)(genesDir, geneName);
|
|
85
|
+
const step = `[${i + 1}/${agent.genome.length}]`;
|
|
86
|
+
display.info(`${step} Executing gene: ${geneName}`);
|
|
87
|
+
const srcFile = findSourceFile(geneDir);
|
|
88
|
+
if (!srcFile) {
|
|
89
|
+
display.rustStyleError({
|
|
90
|
+
code: "E0051",
|
|
91
|
+
message: `Gene '${geneName}' has no source file`,
|
|
92
|
+
file: geneDir,
|
|
93
|
+
suggestion: "Ensure genes/" + geneName + "/index.ts exists",
|
|
94
|
+
});
|
|
95
|
+
process.exit(1);
|
|
96
|
+
}
|
|
97
|
+
try {
|
|
98
|
+
const absPath = (0, node_path_1.resolve)(geneDir, srcFile);
|
|
99
|
+
const mod = await import((0, node_url_1.pathToFileURL)(absPath).href);
|
|
100
|
+
if (typeof mod.express !== "function") {
|
|
101
|
+
display.error(`${step} Gene '${geneName}' does not export express()`);
|
|
102
|
+
process.exit(1);
|
|
103
|
+
}
|
|
104
|
+
const stepStart = performance.now();
|
|
105
|
+
const result = await mod.express(current);
|
|
106
|
+
const stepElapsed = performance.now() - stepStart;
|
|
107
|
+
display.success(`${step} ${geneName} completed (${stepElapsed.toFixed(1)}ms)`);
|
|
108
|
+
if (options.verbose) {
|
|
109
|
+
display.info(` Input: ${JSON.stringify(current).slice(0, 150)}`);
|
|
110
|
+
display.info(` Output: ${JSON.stringify(result).slice(0, 150)}`);
|
|
111
|
+
}
|
|
112
|
+
current = result;
|
|
113
|
+
}
|
|
114
|
+
catch (err) {
|
|
115
|
+
display.rustStyleError({
|
|
116
|
+
code: "E0052",
|
|
117
|
+
message: `Gene '${geneName}' execution failed: ${err.message}`,
|
|
118
|
+
suggestion: "Run 'rotifer test " + geneName + " --verbose' to debug",
|
|
119
|
+
});
|
|
120
|
+
process.exit(1);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const totalElapsed = performance.now() - startTime;
|
|
124
|
+
console.log();
|
|
125
|
+
display.success("Pipeline execution complete");
|
|
126
|
+
display.keyValue("Agent", agent.name);
|
|
127
|
+
display.keyValue("Genes Executed", String(agent.genome.length));
|
|
128
|
+
display.keyValue("Composition", compositionType);
|
|
129
|
+
display.keyValue("Duration", `${totalElapsed.toFixed(1)}ms`);
|
|
130
|
+
console.log();
|
|
131
|
+
display.info("Final output:");
|
|
132
|
+
console.log(JSON.stringify(current, null, 2));
|
|
133
|
+
});
|
|
134
|
+
function findAgent(root, name) {
|
|
135
|
+
const agentsDir = (0, node_path_1.join)(root, ".rotifer", "agents");
|
|
136
|
+
if (!(0, node_fs_1.existsSync)(agentsDir))
|
|
137
|
+
return null;
|
|
138
|
+
const files = (0, node_fs_1.readdirSync)(agentsDir).filter((f) => f.endsWith(".json"));
|
|
139
|
+
for (const file of files) {
|
|
140
|
+
try {
|
|
141
|
+
const agent = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(agentsDir, file), "utf-8"));
|
|
142
|
+
if (agent.name === name)
|
|
143
|
+
return agent;
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
// skip malformed
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
function findSourceFile(geneDir) {
|
|
152
|
+
const candidates = ["index.ts", "index.js", "index.mjs"];
|
|
153
|
+
for (const c of candidates) {
|
|
154
|
+
if ((0, node_fs_1.existsSync)((0, node_path_1.join)(geneDir, c)))
|
|
155
|
+
return c;
|
|
156
|
+
}
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=agent-run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-run.js","sourceRoot":"","sources":["../../src/commands/agent-run.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAoC;AACpC,qCAAgE;AAChE,yCAA0C;AAC1C,uCAAyC;AACzC,6DAA+C;AAC/C,kDAAgE;AAUnD,QAAA,eAAe,GAAG,IAAI,mBAAO,CAAC,KAAK,CAAC;KAC9C,WAAW,CAAC,sDAAsD,CAAC;KACnE,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;KACvC,MAAM,CAAC,gBAAgB,EAAE,6BAA6B,EAAE,kBAAkB,CAAC;KAC3E,MAAM,CAAC,WAAW,EAAE,2BAA2B,EAAE,KAAK,CAAC;KACvD,MAAM,CAAC,K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E,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC;YACH,MAAM,KAAK,GAAc,IAAI,CAAC,KAAK,CACjC,IAAA,sBAAY,EAAC,IAAA,gBAAI,EAAC,SAAS,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,CAC7C,CAAC;YACF,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI;gBAAE,OAAO,KAAK,CAAC;QACxC,CAAC;QAAC,MAAM,CAAC;YACP,iBAAiB;QACnB,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,cAAc,CAAC,OAAe;IACrC,MAAM,UAAU,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;IACzD,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;QAC3B,IAAI,IAAA,oBAAU,EAAC,IAAA,gBAAI,EAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YAAE,OAAO,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arena-submit.d.ts","sourceRoot":"","sources":["../../src/commands/arena-submit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"arena-submit.d.ts","sourceRoot":"","sources":["../../src/commands/arena-submit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,eAAO,MAAM,kBAAkB,SA4I3B,CAAC"}
|