wao 0.40.0 → 0.40.2
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/cjs/ao.js +4 -4
- package/cjs/create.js +32 -27
- package/cjs/workspace/.claude/agents/builder.md +4 -2
- package/cjs/workspace/.claude/skills/build/SKILL.md +34 -12
- package/cjs/workspace/.claude/skills/build-aos/SKILL.md +10 -1
- package/cjs/workspace/.claude/skills/build-device/SKILL.md +37 -23
- package/cjs/workspace/.claude/skills/build-frontend/SKILL.md +17 -14
- package/cjs/workspace/.claude/skills/build-module/SKILL.md +10 -1
- package/cjs/workspace/.claude/skills/plan/SKILL.md +12 -4
- package/cjs/workspace/.claude/skills/readme/SKILL.md +151 -45
- package/cjs/workspace/.claude/skills/report/SKILL.md +2 -1
- package/cjs/workspace/dashboard/index.html +154 -3
- package/cjs/workspace/dashboard/public/favicon.ico +0 -0
- package/cjs/workspace/dashboard/public/favicon.png +0 -0
- package/cjs/workspace/dashboard/server.js +93 -12
- package/cjs/workspace/dashboard/src/App.jsx +2297 -372
- package/cjs/workspace/docs/wao-sdk.md +1 -1
- package/cjs/workspace/package.json +1 -1
- package/esm/ao.js +3 -3
- package/esm/create.js +3 -0
- package/esm/workspace/.claude/agents/builder.md +4 -2
- package/esm/workspace/.claude/skills/build/SKILL.md +34 -12
- package/esm/workspace/.claude/skills/build-aos/SKILL.md +10 -1
- package/esm/workspace/.claude/skills/build-device/SKILL.md +37 -23
- package/esm/workspace/.claude/skills/build-frontend/SKILL.md +17 -14
- package/esm/workspace/.claude/skills/build-module/SKILL.md +10 -1
- package/esm/workspace/.claude/skills/plan/SKILL.md +12 -4
- package/esm/workspace/.claude/skills/readme/SKILL.md +151 -45
- package/esm/workspace/.claude/skills/report/SKILL.md +2 -1
- package/esm/workspace/dashboard/index.html +154 -3
- package/esm/workspace/dashboard/public/favicon.ico +0 -0
- package/esm/workspace/dashboard/public/favicon.png +0 -0
- package/esm/workspace/dashboard/server.js +93 -12
- package/esm/workspace/dashboard/src/App.jsx +2297 -372
- package/esm/workspace/docs/wao-sdk.md +1 -1
- package/esm/workspace/package.json +1 -1
- package/package.json +1 -1
|
@@ -100,7 +100,7 @@ const { mid, res, err, out } = await ao.res({
|
|
|
100
100
|
Paginated results for a process.
|
|
101
101
|
|
|
102
102
|
```js
|
|
103
|
-
const { err, out, res, next } = await ao.ress({ pid, limit: 10, asc: true,
|
|
103
|
+
const { err, out, res, next } = await ao.ress({ pid, limit: 10, asc: true, from: null })
|
|
104
104
|
const page2 = next ? await next() : null
|
|
105
105
|
```
|
|
106
106
|
|
package/esm/ao.js
CHANGED
|
@@ -793,7 +793,7 @@ class AO {
|
|
|
793
793
|
return { res, err, out }
|
|
794
794
|
}
|
|
795
795
|
|
|
796
|
-
async ress({ pid, limit, asc,
|
|
796
|
+
async ress({ pid, limit, asc, from }) {
|
|
797
797
|
let err = null
|
|
798
798
|
let msgs = null
|
|
799
799
|
let next = null
|
|
@@ -801,9 +801,9 @@ class AO {
|
|
|
801
801
|
try {
|
|
802
802
|
let sort = asc ? "ASC" : "DESC"
|
|
803
803
|
if (this.hb) {
|
|
804
|
-
res = await this.hb.results({ process: pid, limit, sort, from
|
|
804
|
+
res = await this.hb.results({ process: pid, limit, sort, from })
|
|
805
805
|
} else {
|
|
806
|
-
res = await this.results({ process: pid, limit, sort, from
|
|
806
|
+
res = await this.results({ process: pid, limit, sort, from })
|
|
807
807
|
}
|
|
808
808
|
if (!res.edges) return null
|
|
809
809
|
msgs = map(v => ({ cursor: v.cursor, ...v.node }))(res.edges)
|
package/esm/create.js
CHANGED
|
@@ -286,6 +286,9 @@ const main = async () => {
|
|
|
286
286
|
t.fail("Failed to install dependencies")
|
|
287
287
|
return
|
|
288
288
|
}
|
|
289
|
+
t.sub("root dependencies installed")
|
|
290
|
+
await exec(`cd "${appdir}/dashboard" && npm install`)
|
|
291
|
+
t.sub("dashboard dependencies installed")
|
|
289
292
|
t.done()
|
|
290
293
|
|
|
291
294
|
let hbWarnings = []
|
|
@@ -35,8 +35,10 @@ Read these before building:
|
|
|
35
35
|
- **aos**: Write AOS scripts in `src/` with input validation
|
|
36
36
|
- **aos-test**: Write in-memory tests in `test/`, iterate until `yarn test` passes
|
|
37
37
|
- **aos-integration**: Write HyperBEAM tests, iterate until they pass
|
|
38
|
-
- **
|
|
39
|
-
- **
|
|
38
|
+
- **module-lua**: Write standalone Lua module in `custom-lua/`, no AOS framework
|
|
39
|
+
- **module-wasm**: Write Rust WASM64 module in `custom-wasm/`, `#![no_std]`
|
|
40
|
+
- **module-test**: Write HyperBEAM integration tests for custom modules
|
|
41
|
+
- **device**: Write Erlang device + inline eunit tests in same `.erl` file, compile with `rebar3 as genesis_wasm compile`, iterate until `rebar3 eunit` passes
|
|
40
42
|
- **device-integration**: Write WAO SDK integration tests against running HyperBEAM
|
|
41
43
|
- **frontend**: Write React components with `wao/web`
|
|
42
44
|
- **frontend-test**: Write vitest tests, iterate until they pass
|
|
@@ -31,7 +31,20 @@ Full build orchestrator. Sequences through plan → build → test → validate
|
|
|
31
31
|
|
|
32
32
|
### 1. Check for existing plan (resume support)
|
|
33
33
|
|
|
34
|
-
Read `plan.md` and `tasks.json` at the project root. If both exist and tasks.json has `"current_step"`, resume
|
|
34
|
+
Read `plan.md` and `tasks.json` at the project root. If both exist and tasks.json has `"current_step"`, resume:
|
|
35
|
+
|
|
36
|
+
1. Find the first task with `"status": "in_progress"` — resume debugging that task immediately.
|
|
37
|
+
2. If no `in_progress` task, find the first task with `"status": "pending"` — start it.
|
|
38
|
+
3. If ALL tasks are `"done"`, **re-verify every test task** by running its tests:
|
|
39
|
+
- `aos-test` → `yarn test <files>`
|
|
40
|
+
- `aos-integration` → `yarn test <files>`
|
|
41
|
+
- `device` → `cd $HB_DIR && rebar3 eunit --module=<module>`
|
|
42
|
+
- `device-integration` → `yarn test <files>`
|
|
43
|
+
- `frontend-test` → `cd frontend && npm run test:unit`
|
|
44
|
+
- `frontend-integration` → `cd frontend && npm run test:e2e`
|
|
45
|
+
- `validate` → run all validation gates
|
|
46
|
+
|
|
47
|
+
If any test task fails, set that task back to `"in_progress"` in tasks.json and resume debugging it. Do NOT skip over failing tests just because the task was previously marked done.
|
|
35
48
|
|
|
36
49
|
If no plan exists, proceed to step 2.
|
|
37
50
|
|
|
@@ -75,7 +88,7 @@ Before starting the build loop, check which tracks are selected and verify their
|
|
|
75
88
|
grep '^CWD=' .env.hyperbeam 2>/dev/null | cut -d= -f2-
|
|
76
89
|
```
|
|
77
90
|
|
|
78
|
-
If the plan includes `device`, `device-
|
|
91
|
+
If the plan includes `device`, `device-integration`, `aos-integration`, `module-lua`, `module-wasm`, or `module-test` tasks, verify:
|
|
79
92
|
|
|
80
93
|
1. `.env.hyperbeam` exists and has a `CWD` value
|
|
81
94
|
2. The `CWD` path points to a valid HyperBEAM directory (`$CWD/src` exists)
|
|
@@ -108,8 +121,7 @@ b. Read the skill file for this task's type and follow its instructions. The map
|
|
|
108
121
|
| `module-lua` | `.claude/skills/build-module/SKILL.md` |
|
|
109
122
|
| `module-wasm` | `.claude/skills/build-module/SKILL.md` |
|
|
110
123
|
| `module-test` | `.claude/skills/build-module/SKILL.md` |
|
|
111
|
-
| `device` | `.claude/skills/build-device/SKILL.md` |
|
|
112
|
-
| `device-test` | `.claude/skills/build-device/SKILL.md` |
|
|
124
|
+
| `device` | `.claude/skills/build-device/SKILL.md` (eunit tests are inline — same file) |
|
|
113
125
|
| `device-integration` | `.claude/skills/test-device/SKILL.md` |
|
|
114
126
|
| `frontend` | `.claude/skills/build-frontend/SKILL.md` |
|
|
115
127
|
| `frontend-test` | `.claude/skills/build-frontend/SKILL.md` |
|
|
@@ -125,12 +137,21 @@ d. After completing, verify the task's `done_when` criteria are met:
|
|
|
125
137
|
|
|
126
138
|
e. If the criteria are met, update the task status to `"done"` in `tasks.json`.
|
|
127
139
|
|
|
128
|
-
f. If
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
140
|
+
f. **If tests fail, keep debugging.** Do not stop. On each iteration:
|
|
141
|
+
1. Read the full error output — stack traces, assertion messages, log lines
|
|
142
|
+
2. Identify the root cause (wrong logic, missing handler, bad import, timing issue, etc.)
|
|
143
|
+
3. Fix the code — not the test, unless the test itself has a bug
|
|
144
|
+
4. Re-run the failing test file specifically (faster feedback than full suite)
|
|
145
|
+
5. If the same error persists after 3 different fix attempts, step back:
|
|
146
|
+
- Re-read the relevant docs (AOS patterns, HyperBEAM device protocol, etc.)
|
|
147
|
+
- Check if the plan itself has a wrong assumption
|
|
148
|
+
- Try a completely different approach
|
|
149
|
+
6. Continue iterating until all tests pass — there is no retry limit
|
|
150
|
+
|
|
151
|
+
g. Only escalate to the user if:
|
|
152
|
+
- The failure is environmental (port conflict, missing binary, permissions)
|
|
153
|
+
- The test requires user input (wallet, external service URL)
|
|
154
|
+
- You've tried 10+ iterations with no progress on the same error
|
|
134
155
|
|
|
135
156
|
h. Move to the next task.
|
|
136
157
|
|
|
@@ -161,7 +182,8 @@ Overall: PASS / FAIL
|
|
|
161
182
|
|
|
162
183
|
## Failure handling
|
|
163
184
|
|
|
164
|
-
-
|
|
185
|
+
- **Test failures are expected.** The build loop is: write code → run tests → read failures → fix → re-run. This is the core loop — never skip it, never give up early.
|
|
186
|
+
- If a skill exits with test failures, read the full output, diagnose the root cause, fix the code (not the test), and re-run. Keep iterating until 100% pass.
|
|
165
187
|
- If a skill cannot be dispatched (unknown type), skip and warn.
|
|
166
188
|
- If the user interrupts, save current state to tasks.json so the next session can resume.
|
|
167
189
|
|
|
@@ -180,7 +202,7 @@ Never force a task to `done` status with failing tests. The TaskCompleted hook w
|
|
|
180
202
|
|
|
181
203
|
### Build stalls on a single task
|
|
182
204
|
- Check if it's a test failure loop — read the last test output
|
|
183
|
-
- If the same error
|
|
205
|
+
- If the same error persists after 3 different fix attempts, step back and reconsider — the plan may have a wrong assumption
|
|
184
206
|
- Run `/debug` to diagnose port/process/WASM issues
|
|
185
207
|
|
|
186
208
|
### Resume doesn't pick up the right task
|
|
@@ -117,4 +117,13 @@ For each test-fix cycle:
|
|
|
117
117
|
3. Classify: is the bug in source code or test code?
|
|
118
118
|
4. Fix ONE issue per iteration (don't change multiple things at once)
|
|
119
119
|
5. Re-run only the failing test first, then full suite
|
|
120
|
-
6. If the same
|
|
120
|
+
6. If the same error persists after 3 different fix attempts, step back:
|
|
121
|
+
- Re-read the relevant docs (AOS patterns, Lua conventions, etc.)
|
|
122
|
+
- Check if the plan itself has a wrong assumption
|
|
123
|
+
- Try a completely different approach
|
|
124
|
+
7. Continue iterating until all tests pass — there is no retry limit
|
|
125
|
+
|
|
126
|
+
Only escalate to the user if:
|
|
127
|
+
- The failure is environmental (missing binary, permissions, port conflict)
|
|
128
|
+
- The test requires user input (wallet, external service URL)
|
|
129
|
+
- You've tried 10+ iterations with no progress on the same error
|
|
@@ -59,7 +59,7 @@ Do NOT mark the task as done if any prerequisite fails. Set the task status to `
|
|
|
59
59
|
|
|
60
60
|
3. Read `docs/hyperbeam-dev.md` for the device protocol (arity/3 functions, state management, auth patterns).
|
|
61
61
|
|
|
62
|
-
4.
|
|
62
|
+
4. Write the Erlang device with **inline eunit tests** (HyperBEAM convention — device and tests live in the same file):
|
|
63
63
|
|
|
64
64
|
Write `$HB_DIR/src/dev_{name}.erl`:
|
|
65
65
|
|
|
@@ -67,6 +67,9 @@ Do NOT mark the task as done if any prerequisite fails. Set the task status to `
|
|
|
67
67
|
-module(dev_{name}).
|
|
68
68
|
-export([info/3, init/3, compute/3]).
|
|
69
69
|
-include("include/hb.hrl").
|
|
70
|
+
-ifdef(TEST).
|
|
71
|
+
-include_lib("eunit/include/eunit.hrl").
|
|
72
|
+
-endif.
|
|
70
73
|
|
|
71
74
|
%% Exports: list available keys
|
|
72
75
|
info(_Msg1, _Msg2, Opts) ->
|
|
@@ -88,35 +91,37 @@ Do NOT mark the task as done if any prerequisite fails. Set the task status to `
|
|
|
88
91
|
{ok, Msg1};
|
|
89
92
|
handle_action(_, Msg1, _Msg2, _Opts) ->
|
|
90
93
|
{ok, hb_maps:put(<<"Error">>, <<"Unknown action">>, Msg1)}.
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
Key patterns:
|
|
94
|
-
- Use `hb_maps` for state (not plain maps)
|
|
95
|
-
- Use `hb_private` for secrets
|
|
96
|
-
- Use `ar_wallet` for auth/signing
|
|
97
|
-
- Route actions via `hb_ao:get(<<"Action">>, Msg2, Opts)`
|
|
98
|
-
- Return `{ok, UpdatedMsg}` or `{error, Reason}`
|
|
99
|
-
|
|
100
|
-
5. **If the task type is `device-test`** — write eunit tests:
|
|
101
|
-
|
|
102
|
-
Write `$HB_DIR/test/dev_{name}_tests.erl`:
|
|
103
94
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
95
|
+
%%%===================================================================
|
|
96
|
+
%%% EUnit Tests (inline — HyperBEAM convention)
|
|
97
|
+
%%%===================================================================
|
|
98
|
+
-ifdef(TEST).
|
|
107
99
|
|
|
108
100
|
info_test() ->
|
|
109
|
-
{ok, Info} =
|
|
101
|
+
{ok, Info} = info(#{}, #{}, #{}),
|
|
110
102
|
?assertMatch(#{<<"exports">> := _}, Info).
|
|
111
103
|
|
|
112
104
|
compute_test() ->
|
|
113
|
-
{ok, State} =
|
|
105
|
+
{ok, State} = init(#{}, #{}, #{}),
|
|
114
106
|
Msg = #{<<"Action">> => <<"MyAction">>},
|
|
115
|
-
{ok, Result} =
|
|
107
|
+
{ok, Result} = compute(State, Msg, #{}),
|
|
116
108
|
?assertMatch(#{}, Result).
|
|
109
|
+
|
|
110
|
+
-endif.
|
|
117
111
|
```
|
|
118
112
|
|
|
119
|
-
|
|
113
|
+
Key patterns:
|
|
114
|
+
- **Device + tests in same file** — use `-ifdef(TEST).` / `-endif.` guards
|
|
115
|
+
- Tests call local functions directly (no `module:function` prefix needed)
|
|
116
|
+
- Use `hb_maps` for state (not plain maps)
|
|
117
|
+
- Use `hb_private` for secrets
|
|
118
|
+
- Use `ar_wallet` for auth/signing
|
|
119
|
+
- Route actions via `hb_ao:get(<<"Action">>, Msg2, Opts)`
|
|
120
|
+
- Return `{ok, UpdatedMsg}` or `{error, Reason}`
|
|
121
|
+
|
|
122
|
+
**Do NOT create separate test files** in `$HB_DIR/test/`. All eunit tests go inline in the device source file.
|
|
123
|
+
|
|
124
|
+
5. Compile (use the `$HB_DIR` path):
|
|
120
125
|
|
|
121
126
|
```bash
|
|
122
127
|
cd $HB_DIR && rebar3 as genesis_wasm compile
|
|
@@ -130,10 +135,10 @@ Do NOT mark the task as done if any prerequisite fails. Set the task status to `
|
|
|
130
135
|
|
|
131
136
|
If the beam file is missing, compilation failed silently. Read the full output and fix.
|
|
132
137
|
|
|
133
|
-
|
|
138
|
+
6. Run eunit tests (note: test the device module directly, not a separate test module):
|
|
134
139
|
|
|
135
140
|
```bash
|
|
136
|
-
cd $HB_DIR && rebar3 eunit --module=dev_{name}
|
|
141
|
+
cd $HB_DIR && rebar3 eunit --module=dev_{name}
|
|
137
142
|
```
|
|
138
143
|
|
|
139
144
|
8. If compilation errors or test failures:
|
|
@@ -175,4 +180,13 @@ For each test-fix cycle:
|
|
|
175
180
|
3. Classify: is the bug in source code or test code?
|
|
176
181
|
4. Fix ONE issue per iteration (don't change multiple things at once)
|
|
177
182
|
5. Re-run only the failing test first, then full suite
|
|
178
|
-
6. If the same
|
|
183
|
+
6. If the same error persists after 3 different fix attempts, step back:
|
|
184
|
+
- Re-read the relevant docs (HyperBEAM device protocol, Erlang patterns, etc.)
|
|
185
|
+
- Check if the plan itself has a wrong assumption
|
|
186
|
+
- Try a completely different approach
|
|
187
|
+
7. Continue iterating until all tests pass — there is no retry limit
|
|
188
|
+
|
|
189
|
+
Only escalate to the user if:
|
|
190
|
+
- The failure is environmental (rebar3 missing, Erlang version, port conflict)
|
|
191
|
+
- The test requires user input (wallet, external service URL)
|
|
192
|
+
- You've tried 10+ iterations with no progress on the same error
|
|
@@ -112,20 +112,23 @@ cd frontend && npx playwright --version 2>/dev/null || echo "Playwright not inst
|
|
|
112
112
|
cd frontend && npm run test:unit
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
-
7. If
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
115
|
+
7. **If tests fail, keep debugging.** Do not stop. On each iteration:
|
|
116
|
+
1. Read the full error output — stack traces, assertion messages, log lines
|
|
117
|
+
2. Identify the FIRST failing test (fix failures in order)
|
|
118
|
+
3. Classify: is the bug in component code or test code?
|
|
119
|
+
4. Fix ONE issue per iteration (don't change multiple things at once)
|
|
120
|
+
5. Re-run the failing test file specifically (faster feedback than full suite)
|
|
121
|
+
6. If the same error persists after 3 different fix attempts, step back:
|
|
122
|
+
- Re-read the relevant docs (`wao/web` patterns, React testing library, vitest mocking)
|
|
123
|
+
- Check if the plan itself has a wrong assumption
|
|
124
|
+
- Try a completely different approach
|
|
125
|
+
7. Continue iterating until all tests pass — there is no retry limit
|
|
126
|
+
|
|
127
|
+
Only escalate to the user if:
|
|
128
|
+
- The failure is environmental (missing dependency, port conflict, permissions)
|
|
129
|
+
- The test requires user input (wallet, external service URL)
|
|
130
|
+
- You've tried 10+ iterations with no progress on the same error
|
|
120
131
|
|
|
121
132
|
8. Update the task status to `"done"` in `tasks.json`.
|
|
122
133
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
For each test-fix cycle:
|
|
126
|
-
1. Run tests and capture FULL output
|
|
127
|
-
2. Identify the FIRST failing test (fix failures in order)
|
|
128
|
-
3. Classify: is the bug in source code or test code?
|
|
129
|
-
4. Fix ONE issue per iteration (don't change multiple things at once)
|
|
130
|
-
5. Re-run only the failing test first, then full suite
|
|
131
|
-
6. If the same test fails 3 times with the same error, stop and reconsider the approach — the plan may need updating
|
|
134
|
+
**IMPORTANT**: Only mark done if all tests pass 100%.
|
|
@@ -244,7 +244,16 @@ For each test-fix cycle:
|
|
|
244
244
|
3. Classify: is the bug in module code or test code?
|
|
245
245
|
4. Fix ONE issue per iteration (don't change multiple things at once)
|
|
246
246
|
5. Re-run only the failing test first, then full suite
|
|
247
|
-
6. If the same
|
|
247
|
+
6. If the same error persists after 3 different fix attempts, step back:
|
|
248
|
+
- Re-read the relevant docs (custom module patterns, WASM64/Lua conventions, etc.)
|
|
249
|
+
- Check if the plan itself has a wrong assumption
|
|
250
|
+
- Try a completely different approach
|
|
251
|
+
7. Continue iterating until all tests pass — there is no retry limit
|
|
252
|
+
|
|
253
|
+
Only escalate to the user if:
|
|
254
|
+
- The failure is environmental (cargo missing, WASM build tools, port conflict)
|
|
255
|
+
- The test requires user input (wallet, external service URL)
|
|
256
|
+
- You've tried 10+ iterations with no progress on the same error
|
|
248
257
|
|
|
249
258
|
## Troubleshooting
|
|
250
259
|
|
|
@@ -119,8 +119,7 @@ Plan a feature before building it. The plan and tasks are written to files so an
|
|
|
119
119
|
| `module-lua` | `/build-module` |
|
|
120
120
|
| `module-wasm` | `/build-module` |
|
|
121
121
|
| `module-test` | `/build-module` |
|
|
122
|
-
| `device` | `/build-device` |
|
|
123
|
-
| `device-test` | `/build-device` |
|
|
122
|
+
| `device` | `/build-device` (eunit tests inline — same file) |
|
|
124
123
|
| `device-integration` | `/test-device` |
|
|
125
124
|
| `frontend` | `/build-frontend` |
|
|
126
125
|
| `frontend-test` | `/build-frontend` |
|
|
@@ -134,8 +133,8 @@ Plan a feature before building it. The plan and tasks are written to files so an
|
|
|
134
133
|
- Tests: `{ "type": "module-test", "skill": "/build-module", "files": ["test/{name}-module.test.js"], "done_when": "yarn test test/{name}-module.test.js — all pass" }`
|
|
135
134
|
|
|
136
135
|
**Device tasks** (if building Erlang devices) — add `"device"` to `tracks` array and add these to `tasks`:
|
|
137
|
-
- `{ "type": "device", "skill": "/build-device", "files": ["HyperBEAM/src/dev_{name}.erl"], "done_when": "rebar3
|
|
138
|
-
-
|
|
136
|
+
- `{ "type": "device", "skill": "/build-device", "files": ["HyperBEAM/src/dev_{name}.erl"], "done_when": "rebar3 compile + eunit — all pass" }`
|
|
137
|
+
- **HyperBEAM convention**: device source and eunit tests live in the same `.erl` file using `-ifdef(TEST).` guards. Do NOT create separate test files in `HyperBEAM/test/`.
|
|
139
138
|
- `{ "type": "device-integration", "skill": "/test-device", "files": ["test/{name}-device.test.js"], "done_when": "yarn test test/{name}-device.test.js — all pass" }`
|
|
140
139
|
|
|
141
140
|
**Frontend tasks** (if building frontend) — add `"frontend"` to `tracks` array and add these to `tasks`:
|
|
@@ -149,6 +148,15 @@ Plan a feature before building it. The plan and tasks are written to files so an
|
|
|
149
148
|
**Final validation** — always the last task:
|
|
150
149
|
- `{ "type": "validate", "skill": "/validate", "done_when": "overall PASS" }`
|
|
151
150
|
|
|
151
|
+
### IMPORTANT: Replace all placeholders with actual names
|
|
152
|
+
|
|
153
|
+
The templates above use `{name}` as a placeholder. When writing `tasks.json`, replace ALL placeholders with the actual file names from the plan. For example:
|
|
154
|
+
- `"files": ["src/{name}.lua"]` → `"files": ["src/token.lua", "src/registry.lua"]`
|
|
155
|
+
- `"files": ["test/{name}.test.js"]` → `"files": ["test/token.test.js", "test/registry.test.js"]`
|
|
156
|
+
- `"done_when": "yarn test test/{name}.test.js — all pass"` → `"done_when": "yarn test test/token.test.js test/registry.test.js — all pass"`
|
|
157
|
+
|
|
158
|
+
The `files` array must list every actual file the task will create. The `done_when` must reference the actual test commands. Never leave `{name}` as a literal string in the output.
|
|
159
|
+
|
|
152
160
|
### Task ordering rules
|
|
153
161
|
|
|
154
162
|
The build order matters. Within each component:
|
|
@@ -5,76 +5,182 @@ disable-model-invocation: true
|
|
|
5
5
|
allowed-tools: Read, Write, Glob, Grep
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
Generate a comprehensive README.md
|
|
8
|
+
Generate a comprehensive README.md that explains the project thoroughly — what it does, why it exists, how it works, and complete API references for every script, device, and module.
|
|
9
|
+
|
|
10
|
+
## Performance Notes
|
|
11
|
+
- Read every source file before writing — the README must be accurate, not guessed
|
|
12
|
+
- Include real code examples extracted from test files
|
|
13
|
+
- Document every handler/action, not just the main ones
|
|
9
14
|
|
|
10
15
|
## Steps
|
|
11
16
|
|
|
12
|
-
1. Read `plan.md` for the feature overview,
|
|
17
|
+
1. Read `plan.md` for the feature overview, architecture decisions, and edge cases.
|
|
18
|
+
|
|
19
|
+
2. Read **every** AOS script in `src/*.lua`. For each script, extract:
|
|
20
|
+
- Purpose and what problem it solves
|
|
21
|
+
- Every `Handlers.add()` — action name, expected tags, return data, error cases
|
|
22
|
+
- State shape (what globals/tables the script maintains)
|
|
23
|
+
- Interactions with other scripts (cross-process messages)
|
|
24
|
+
|
|
25
|
+
3. Read **every** test file in `test/*.test.js`. Extract:
|
|
26
|
+
- Real usage examples (deploy, message, dry-run patterns)
|
|
27
|
+
- Edge cases being tested (what fails, what's validated)
|
|
28
|
+
- Multi-user scenarios
|
|
29
|
+
|
|
30
|
+
4. If `custom-lua/` or `custom-wasm/` exist, read the module source:
|
|
31
|
+
- What the module does (compute function, state handling)
|
|
32
|
+
- Input/output format
|
|
33
|
+
- How it differs from standard AOS
|
|
34
|
+
|
|
35
|
+
5. If `HyperBEAM/src/dev_*.erl` files exist, read each device:
|
|
36
|
+
- Device purpose and when to use it
|
|
37
|
+
- Exported functions and their signatures
|
|
38
|
+
- State structure and lifecycle
|
|
39
|
+
- HTTP endpoints it exposes
|
|
40
|
+
|
|
41
|
+
6. If `frontend/src/` exists, read key components and hooks:
|
|
42
|
+
- What the app does from a user perspective
|
|
43
|
+
- How it connects to AOS (which hooks, which actions)
|
|
44
|
+
- Wallet integration (ArConnect)
|
|
45
|
+
|
|
46
|
+
7. Read `package.json` for available scripts and dependencies.
|
|
47
|
+
|
|
48
|
+
8. Read `scripts/deploy.js` for deployment details.
|
|
49
|
+
|
|
50
|
+
9. **Write `README.md`** at the project root with ALL of these sections:
|
|
51
|
+
|
|
52
|
+
```markdown
|
|
53
|
+
# {Project Name}
|
|
54
|
+
|
|
55
|
+
{2-3 sentence description: what it does, what platform it runs on, who it's for}
|
|
56
|
+
|
|
57
|
+
## Overview
|
|
58
|
+
|
|
59
|
+
{Expanded explanation — what problem does this solve? What are the key features?
|
|
60
|
+
List each major capability as a bullet point with a brief explanation.}
|
|
61
|
+
|
|
62
|
+
## How It Works
|
|
63
|
+
|
|
64
|
+
{Explain the architecture in plain language:
|
|
65
|
+
- What happens when a user interacts with the app
|
|
66
|
+
- How AOS scripts process messages
|
|
67
|
+
- How state is maintained
|
|
68
|
+
- If HyperBEAM: how devices fit in the pipeline
|
|
69
|
+
- If frontend: how the browser connects to AOS}
|
|
70
|
+
|
|
71
|
+
## Project Structure
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
{file tree with inline comments for every important file}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Prerequisites
|
|
78
|
+
|
|
79
|
+
- Node.js 20+
|
|
80
|
+
- Arweave wallet (`yarn keygen` to generate)
|
|
81
|
+
- {Erlang/OTP 27+ if devices}
|
|
82
|
+
- {ArConnect browser extension if frontend}
|
|
83
|
+
|
|
84
|
+
## Setup
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
yarn install
|
|
88
|
+
yarn keygen
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## AOS Script Reference
|
|
92
|
+
|
|
93
|
+
### {script_name}.lua
|
|
94
|
+
|
|
95
|
+
{What this script does and why it exists}
|
|
96
|
+
|
|
97
|
+
**State**: {describe the tables/globals maintained}
|
|
98
|
+
|
|
99
|
+
| Action | Tags | Returns | Description |
|
|
100
|
+
|--------|------|---------|-------------|
|
|
101
|
+
| {action} | {required tags} | {return data} | {what it does} |
|
|
102
|
+
|
|
103
|
+
**Example** (from tests):
|
|
104
|
+
```js
|
|
105
|
+
{real code example extracted from test file}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Edge Cases**:
|
|
109
|
+
- {what happens on invalid input}
|
|
110
|
+
- {what happens on insufficient balance, etc.}
|
|
13
111
|
|
|
14
|
-
|
|
112
|
+
{repeat for every script}
|
|
15
113
|
|
|
16
|
-
|
|
114
|
+
## Device Reference (if applicable)
|
|
17
115
|
|
|
18
|
-
|
|
116
|
+
### dev_{name}.erl
|
|
19
117
|
|
|
20
|
-
|
|
118
|
+
{What this device does}
|
|
21
119
|
|
|
22
|
-
|
|
120
|
+
| Function | Input | Output | Description |
|
|
121
|
+
|----------|-------|--------|-------------|
|
|
122
|
+
| {function} | {params} | {return} | {what it does} |
|
|
23
123
|
|
|
24
|
-
|
|
124
|
+
{repeat for every device}
|
|
25
125
|
|
|
26
|
-
|
|
27
|
-
# {Project Name}
|
|
126
|
+
## Custom Module Reference (if applicable)
|
|
28
127
|
|
|
29
|
-
|
|
128
|
+
### {module_name}
|
|
30
129
|
|
|
31
|
-
|
|
130
|
+
{What this module does, how it differs from standard AOS}
|
|
32
131
|
|
|
33
|
-
|
|
34
|
-
{How they connect: AOS scripts ↔ HyperBEAM devices ↔ Frontend}
|
|
132
|
+
## Frontend (if applicable)
|
|
35
133
|
|
|
36
|
-
|
|
134
|
+
{What the app looks like, what users can do}
|
|
37
135
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
- Erlang/OTP 27+ (if using HyperBEAM devices)
|
|
136
|
+
### Components
|
|
137
|
+
- {component} — {what it renders}
|
|
41
138
|
|
|
42
|
-
|
|
139
|
+
### Hooks
|
|
140
|
+
- {hook} — {what state it manages}
|
|
43
141
|
|
|
44
|
-
|
|
45
|
-
yarn install
|
|
46
|
-
```
|
|
142
|
+
## Testing
|
|
47
143
|
|
|
48
|
-
|
|
144
|
+
```bash
|
|
145
|
+
yarn test test/aos.test.js # in-memory AOS (fast)
|
|
146
|
+
yarn test test/{script}.test.js # specific script tests
|
|
147
|
+
yarn test test/hyperbeam.test.js # HyperBEAM integration
|
|
148
|
+
cd frontend && npm run test:unit # frontend vitest
|
|
149
|
+
cd frontend && npm run test:e2e # Playwright E2E
|
|
150
|
+
```
|
|
49
151
|
|
|
50
|
-
|
|
51
|
-
|---------|--------|------------|--------|
|
|
52
|
-
{table from Lua source}
|
|
152
|
+
## Deploy
|
|
53
153
|
|
|
54
|
-
|
|
154
|
+
```bash
|
|
155
|
+
yarn keygen # generate wallet (first time only)
|
|
156
|
+
yarn deploy # all scripts to AO testnet
|
|
157
|
+
yarn deploy src/{script}.lua # single script
|
|
158
|
+
yarn deploy --local-hb # local HyperBEAM
|
|
159
|
+
yarn deploy --mainnet # remote HyperBEAM (production)
|
|
160
|
+
```
|
|
55
161
|
|
|
56
|
-
|
|
57
|
-
|--------|--------|---------|-------------|
|
|
58
|
-
{table from Erlang source}
|
|
162
|
+
### How Deploy Works
|
|
59
163
|
|
|
60
|
-
|
|
164
|
+
{Explain: reads src/*.lua, spawns a process per file.
|
|
165
|
+
On testnet: Eval message. On HyperBEAM: ao.deploy().
|
|
166
|
+
Each script gets its own process ID printed to console.}
|
|
61
167
|
|
|
62
|
-
|
|
168
|
+
### Verify
|
|
63
169
|
|
|
64
|
-
|
|
170
|
+
- [aolink](https://aolink.ar.io/#/entity/{PROCESS_ID}) — inspect AOS process
|
|
171
|
+
- [lunar](https://lunar.ar.io/#/process/{PROCESS_ID}) — inspect HyperBEAM process
|
|
65
172
|
|
|
66
|
-
|
|
67
|
-
yarn test # in-memory AOS tests
|
|
68
|
-
yarn test test/hyperbeam.test.js # HyperBEAM integration
|
|
69
|
-
cd frontend && npm run test:unit # frontend vitest
|
|
70
|
-
cd frontend && npm run test:e2e # Playwright E2E
|
|
71
|
-
```
|
|
173
|
+
## Built With
|
|
72
174
|
|
|
73
|
-
|
|
175
|
+
- [WAO](https://docs.wao.eco) — SDK for AO and HyperBEAM
|
|
176
|
+
- [AOS](https://ao.arweave.dev) — Lua processes on the AO computer
|
|
177
|
+
{add others as relevant}
|
|
178
|
+
```
|
|
74
179
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
180
|
+
10. After writing, re-read the README and verify:
|
|
181
|
+
- Every AOS action from every script is documented
|
|
182
|
+
- Every device function is documented
|
|
183
|
+
- Code examples are real (from test files), not made up
|
|
184
|
+
- Edge cases are mentioned
|
|
79
185
|
|
|
80
|
-
|
|
186
|
+
11. Update the task status to `"done"` in `tasks.json`.
|
|
@@ -41,7 +41,8 @@ Components:
|
|
|
41
41
|
|
|
42
42
|
5. If any task is `in_progress`, run a quick check on its "done when" condition:
|
|
43
43
|
- aos-test: run `yarn test` and report pass/fail count
|
|
44
|
-
- device
|
|
44
|
+
- device: run `rebar3 eunit --module=dev_{name}` and report (eunit tests are inline)
|
|
45
|
+
- module-test: run `yarn test test/{name}-module.test.js` and report
|
|
45
46
|
- frontend-test: run `cd frontend && npm run test:unit` and report
|
|
46
47
|
- For other types, just report the status
|
|
47
48
|
|