wao 0.39.0 → 0.39.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.
Files changed (117) hide show
  1. package/cjs/ao.js +4 -2
  2. package/cjs/cli.js +206 -71
  3. package/cjs/create.js +155 -58
  4. package/cjs/workspace/.claude/agents/builder.md +57 -26
  5. package/cjs/workspace/.claude/agents/device-builder.md +86 -0
  6. package/cjs/workspace/.claude/agents/tester.md +64 -22
  7. package/cjs/workspace/.claude/rules/deploy.md +12 -21
  8. package/cjs/workspace/.claude/rules/frontend.md +69 -0
  9. package/cjs/workspace/.claude/rules/hyperbeam.md +104 -0
  10. package/cjs/workspace/.claude/rules/lua.md +74 -7
  11. package/cjs/workspace/.claude/rules/testing.md +126 -3
  12. package/cjs/workspace/.claude/settings.json +89 -11
  13. package/cjs/workspace/.claude/skills/build/SKILL.md +144 -0
  14. package/cjs/workspace/.claude/skills/build-aos/SKILL.md +92 -0
  15. package/cjs/workspace/.claude/skills/build-device/SKILL.md +154 -0
  16. package/cjs/workspace/.claude/skills/build-frontend/SKILL.md +109 -0
  17. package/cjs/workspace/.claude/skills/{create-handler → create-aos}/SKILL.md +12 -13
  18. package/cjs/workspace/.claude/skills/create-device/SKILL.md +87 -0
  19. package/cjs/workspace/.claude/skills/debug/SKILL.md +57 -0
  20. package/cjs/workspace/.claude/skills/deploy/SKILL.md +30 -16
  21. package/cjs/workspace/.claude/skills/dev/SKILL.md +32 -0
  22. package/cjs/workspace/.claude/skills/plan/SKILL.md +150 -0
  23. package/cjs/workspace/.claude/skills/readme/SKILL.md +80 -0
  24. package/cjs/workspace/.claude/skills/report/SKILL.md +48 -0
  25. package/cjs/workspace/.claude/skills/team/SKILL.md +79 -0
  26. package/cjs/workspace/.claude/skills/test/SKILL.md +12 -13
  27. package/cjs/workspace/.claude/skills/test-device/SKILL.md +114 -0
  28. package/cjs/workspace/.claude/skills/test-e2e/SKILL.md +96 -0
  29. package/cjs/workspace/.claude/skills/test-hb/SKILL.md +35 -20
  30. package/cjs/workspace/.claude/skills/validate/SKILL.md +80 -0
  31. package/cjs/workspace/CLAUDE.md +155 -13
  32. package/cjs/workspace/README.md +14 -4
  33. package/cjs/workspace/dashboard/index.html +12 -0
  34. package/cjs/workspace/dashboard/package.json +18 -0
  35. package/cjs/workspace/dashboard/src/App.jsx +53 -0
  36. package/cjs/workspace/dashboard/src/main.jsx +9 -0
  37. package/cjs/workspace/dashboard/vite.config.js +7 -0
  38. package/cjs/workspace/docs/aos-lua.md +428 -0
  39. package/cjs/workspace/docs/debug.md +225 -0
  40. package/cjs/workspace/docs/hyperbeam-dev.md +606 -0
  41. package/cjs/workspace/docs/hyperbeam-devices.md +569 -0
  42. package/cjs/workspace/docs/wao-sdk.md +807 -0
  43. package/cjs/workspace/frontend/e2e/.gitkeep +0 -0
  44. package/cjs/workspace/frontend/index.html +12 -0
  45. package/cjs/workspace/frontend/package.json +24 -0
  46. package/cjs/workspace/frontend/playwright.config.js +10 -0
  47. package/cjs/workspace/frontend/src/App.jsx +24 -0
  48. package/cjs/workspace/frontend/src/main.jsx +9 -0
  49. package/cjs/workspace/frontend/test/.gitkeep +0 -0
  50. package/cjs/workspace/frontend/vite.config.js +6 -0
  51. package/cjs/workspace/frontend/vitest.config.js +10 -0
  52. package/cjs/workspace/package.json +3 -2
  53. package/cjs/workspace/scripts/deploy.js +51 -24
  54. package/cjs/workspace/scripts/keygen.js +52 -0
  55. package/cjs/workspace/test/aos.test.js +98 -0
  56. package/cjs/workspace/test/hyperbeam.test.js +64 -13
  57. package/esm/ao.js +3 -1
  58. package/esm/cli.js +203 -54
  59. package/esm/create.js +96 -33
  60. package/esm/workspace/.claude/agents/builder.md +57 -26
  61. package/esm/workspace/.claude/agents/device-builder.md +86 -0
  62. package/esm/workspace/.claude/agents/tester.md +64 -22
  63. package/esm/workspace/.claude/rules/deploy.md +12 -21
  64. package/esm/workspace/.claude/rules/frontend.md +69 -0
  65. package/esm/workspace/.claude/rules/hyperbeam.md +104 -0
  66. package/esm/workspace/.claude/rules/lua.md +74 -7
  67. package/esm/workspace/.claude/rules/testing.md +126 -3
  68. package/esm/workspace/.claude/settings.json +89 -11
  69. package/esm/workspace/.claude/skills/build/SKILL.md +144 -0
  70. package/esm/workspace/.claude/skills/build-aos/SKILL.md +92 -0
  71. package/esm/workspace/.claude/skills/build-device/SKILL.md +154 -0
  72. package/esm/workspace/.claude/skills/build-frontend/SKILL.md +109 -0
  73. package/esm/workspace/.claude/skills/{create-handler → create-aos}/SKILL.md +12 -13
  74. package/esm/workspace/.claude/skills/create-device/SKILL.md +87 -0
  75. package/esm/workspace/.claude/skills/debug/SKILL.md +57 -0
  76. package/esm/workspace/.claude/skills/deploy/SKILL.md +30 -16
  77. package/esm/workspace/.claude/skills/dev/SKILL.md +32 -0
  78. package/esm/workspace/.claude/skills/plan/SKILL.md +150 -0
  79. package/esm/workspace/.claude/skills/readme/SKILL.md +80 -0
  80. package/esm/workspace/.claude/skills/report/SKILL.md +48 -0
  81. package/esm/workspace/.claude/skills/team/SKILL.md +79 -0
  82. package/esm/workspace/.claude/skills/test/SKILL.md +12 -13
  83. package/esm/workspace/.claude/skills/test-device/SKILL.md +114 -0
  84. package/esm/workspace/.claude/skills/test-e2e/SKILL.md +96 -0
  85. package/esm/workspace/.claude/skills/test-hb/SKILL.md +35 -20
  86. package/esm/workspace/.claude/skills/validate/SKILL.md +80 -0
  87. package/esm/workspace/CLAUDE.md +155 -13
  88. package/esm/workspace/README.md +14 -4
  89. package/esm/workspace/dashboard/index.html +12 -0
  90. package/esm/workspace/dashboard/package.json +18 -0
  91. package/esm/workspace/dashboard/src/App.jsx +53 -0
  92. package/esm/workspace/dashboard/src/main.jsx +9 -0
  93. package/esm/workspace/dashboard/vite.config.js +7 -0
  94. package/esm/workspace/docs/aos-lua.md +428 -0
  95. package/esm/workspace/docs/debug.md +225 -0
  96. package/esm/workspace/docs/hyperbeam-dev.md +606 -0
  97. package/esm/workspace/docs/hyperbeam-devices.md +569 -0
  98. package/esm/workspace/docs/wao-sdk.md +807 -0
  99. package/esm/workspace/frontend/e2e/.gitkeep +0 -0
  100. package/esm/workspace/frontend/index.html +12 -0
  101. package/esm/workspace/frontend/package.json +24 -0
  102. package/esm/workspace/frontend/playwright.config.js +10 -0
  103. package/esm/workspace/frontend/src/App.jsx +24 -0
  104. package/esm/workspace/frontend/src/main.jsx +9 -0
  105. package/esm/workspace/frontend/test/.gitkeep +0 -0
  106. package/esm/workspace/frontend/vite.config.js +6 -0
  107. package/esm/workspace/frontend/vitest.config.js +10 -0
  108. package/esm/workspace/package.json +3 -2
  109. package/esm/workspace/scripts/deploy.js +51 -24
  110. package/esm/workspace/scripts/keygen.js +52 -0
  111. package/esm/workspace/test/aos.test.js +98 -0
  112. package/esm/workspace/test/hyperbeam.test.js +64 -13
  113. package/package.json +1 -1
  114. package/cjs/workspace/test/legacynet.test.js +0 -23
  115. package/cjs/workspace/test/web.test.js +0 -33
  116. package/esm/workspace/test/legacynet.test.js +0 -23
  117. package/esm/workspace/test/web.test.js +0 -33
package/cjs/ao.js CHANGED
@@ -115,9 +115,11 @@ var AO = /*#__PURE__*/function () {
115
115
  port = _opt.port;
116
116
  if (_hb) {
117
117
  this.format = _hb === "ans104" ? _hb : "httpsig";
118
- this.hb = new _hb2["default"]({
118
+ var _hbOpt = {
119
119
  format: this.format
120
- });
120
+ };
121
+ if (typeof _hb === "string" && _hb !== "ans104") _hbOpt.url = _hb;
122
+ this.hb = new _hb2["default"](_hbOpt);
121
123
  }
122
124
  if (!_port && port) _port = port;
123
125
  if (!aoconnect && _port) aoconnect = (0, _utils.optAO)(_port);
package/cjs/cli.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
3
 
4
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
5
  var _pm = _interopRequireDefault(require("pm2"));
5
6
  var _utils = require("./utils.js");
6
7
  var _path = require("path");
@@ -11,6 +12,12 @@ var _readline = require("readline");
11
12
  var _arweave = _interopRequireDefault(require("arweave"));
12
13
  var _cmds$args$;
13
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
15
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
16
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
17
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
18
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
19
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
20
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t0 in e) "default" !== _t0 && {}.hasOwnProperty.call(e, _t0) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t0)) && (i.get || i.set) ? o(f, _t0, i) : f[_t0] = e[_t0]); return f; })(e, t); }
14
21
  function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
15
22
  function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
16
23
  function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
@@ -35,10 +42,14 @@ var cmds = {
35
42
  },
36
43
  create: {
37
44
  script: "create.js"
45
+ },
46
+ build: {
47
+ handler: "build"
38
48
  }
39
49
  };
40
50
  var cmd = (_cmds$args$ = cmds[args[0]]) !== null && _cmds$args$ !== void 0 ? _cmds$args$ : cmds["wao"];
41
51
  var isCreate = args[0] === "create";
52
+ var isBuild = args[0] === "build";
42
53
  if (cmds[args[0]]) args.shift();
43
54
  if (!cmd) {
44
55
  console.log("The wrong command");
@@ -327,7 +338,7 @@ var detectHBEnv = /*#__PURE__*/function () {
327
338
  break;
328
339
  }
329
340
  _context4.n = 2;
330
- return getVersion("erl", "-eval '{ok, V} = file:read_file(filename:join([code:root_dir(), \"releases\", erlang:system_info(otp_release), \"OTP_VERSION\"])), io:fwrite(V), halt().' -noshell");
341
+ return getVersion("erl", '-eval \'{ok, V} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), io:fwrite(V), halt().\' -noshell');
331
342
  case 2:
332
343
  ver = _context4.v;
333
344
  deps.erl = {
@@ -388,7 +399,7 @@ var detectHBEnv = /*#__PURE__*/function () {
388
399
  var create = /*#__PURE__*/function () {
389
400
  var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
390
401
  var _args$;
391
- var appname, appdir, app, col, pad, pad2, hbChoice, hbMode, hbPath, absPath, t, arweave, jwk, addr, _yield$exec3, error, hbWarnings, _yield$detectHBEnv, deps, missing, hbCwd, envLines, _iterator2, _step2, m, _t3, _t4;
402
+ var appname, appdir, app, col, pad, pad2, hbChoice, hbMode, hbPath, absPath, feChoice, withFrontend, t, arweave, jwk, addr, _yield$exec3, error, hbWarnings, _yield$detectHBEnv, deps, missing, hbCwd, envLines, _iterator2, _step2, m, envParts, envPrefix, hbWalletDir, hbArweave, hbJwk, hbAddr, _t3, _t4, _t5;
392
403
  return _regenerator().w(function (_context5) {
393
404
  while (1) switch (_context5.p = _context5.n) {
394
405
  case 0:
@@ -406,21 +417,21 @@ var create = /*#__PURE__*/function () {
406
417
  case 2:
407
418
  app = _t3(_context5.v, "workspace");
408
419
  console.log();
409
- console.log(" ".concat(bold("HyperBEAM setup:")));
420
+ console.log(" ".concat(bold("HyperBEAM:")));
410
421
  col = 6 + HB_TAG.length;
411
- pad = " ".repeat(col - "Link existing".length);
422
+ pad = " ".repeat(col - "Use existing".length);
412
423
  pad2 = " ".repeat(col - "Skip".length);
413
424
  console.log(" ".concat(dim("1."), " Clone ").concat(cyan(HB_TAG), " ").concat(dim("(from GitHub)")));
414
- console.log(" ".concat(dim("2."), " Link existing").concat(pad, " ").concat(dim("(symlink to local dir)")));
425
+ console.log(" ".concat(dim("2."), " Use existing").concat(pad, " ").concat(dim("(path to local dir)")));
415
426
  console.log(" ".concat(dim("3."), " Skip").concat(pad2, " ").concat(dim("(in-memory AOS only)")));
416
427
  console.log();
417
428
  _context5.n = 3;
418
429
  return ask(" Choose ".concat(dim("(1/2/3)"), " [1]: "));
419
430
  case 3:
420
431
  hbChoice = _context5.v;
421
- hbMode = hbChoice === "2" ? "link" : hbChoice === "3" ? "skip" : "clone";
432
+ hbMode = hbChoice === "2" ? "existing" : hbChoice === "3" ? "skip" : "clone";
422
433
  hbPath = null;
423
- if (!(hbMode === "link")) {
434
+ if (!(hbMode === "existing")) {
424
435
  _context5.n = 5;
425
436
  break;
426
437
  }
@@ -435,16 +446,31 @@ var create = /*#__PURE__*/function () {
435
446
  }
436
447
  hbPath = absPath;
437
448
  case 5:
449
+ console.log();
450
+ console.log(" ".concat(bold("Frontend:")));
451
+ console.log(" ".concat(dim("1."), " Skip ").concat(dim("(backend only)")));
452
+ console.log(" ".concat(dim("2."), " Vite + wao/web ").concat(dim("(React SPA with ArConnect)")));
453
+ console.log();
454
+ _context5.n = 6;
455
+ return ask(" Choose ".concat(dim("(1/2)"), " [1]: "));
456
+ case 6:
457
+ feChoice = _context5.v;
458
+ withFrontend = feChoice === "2";
438
459
  console.log();
439
460
  t = tree("Creating ".concat(cyan(appname)));
440
- _context5.p = 6;
461
+ _context5.p = 7;
441
462
  t.step("Scaffolding project files");
442
463
  (0, _fs.cpSync)(app, appdir, {
443
- recursive: true
464
+ recursive: true,
465
+ filter: function filter(src) {
466
+ if (!withFrontend && src.includes("/frontend")) return false;
467
+ return true;
468
+ }
444
469
  });
445
- t.sub("src/counter.lua");
446
- t.sub("test/ (3 test files)");
470
+ t.sub("src/counter.lua, token.lua, registry.lua");
471
+ t.sub("test/ (aos, token, registry, hyperbeam)");
447
472
  t.sub("scripts/deploy.js");
473
+ if (withFrontend) t.sub("frontend/ (Vite + React + wao/web)");
448
474
  t.done();
449
475
  t.step("Setting up Claude Code toolchain");
450
476
  t.sub("CLAUDE.md");
@@ -454,44 +480,51 @@ var create = /*#__PURE__*/function () {
454
480
  t.done();
455
481
  t.step("Generating admin wallet");
456
482
  arweave = _arweave["default"].init();
457
- _context5.n = 7;
483
+ _context5.n = 8;
458
484
  return arweave.wallets.generate();
459
- case 7:
485
+ case 8:
460
486
  jwk = _context5.v;
461
- _context5.n = 8;
487
+ _context5.n = 9;
462
488
  return arweave.wallets.jwkToAddress(jwk);
463
- case 8:
489
+ case 9:
464
490
  addr = _context5.v;
465
491
  (0, _fs.writeFileSync)((0, _path.resolve)(appdir, ".wallet.json"), JSON.stringify(jwk));
466
492
  t.sub("address: ".concat(addr));
467
493
  t.done();
468
494
  t.step("Installing dependencies");
469
- _context5.n = 9;
495
+ _context5.n = 10;
470
496
  return exec("cd ".concat(appdir, " && yarn --ignore-engines"));
471
- case 9:
497
+ case 10:
472
498
  _yield$exec3 = _context5.v;
473
499
  error = _yield$exec3.error;
474
500
  if (!error) {
475
- _context5.n = 10;
501
+ _context5.n = 11;
476
502
  break;
477
503
  }
478
504
  t.fail("Failed to install dependencies");
479
505
  return _context5.a(2);
480
- case 10:
506
+ case 11:
507
+ t.done();
508
+ t.step("Installing HyperADD dashboard");
509
+ _context5.n = 12;
510
+ return exec("cd \"".concat((0, _path.resolve)(appdir, "dashboard"), "\" && npm install --silent"));
511
+ case 12:
512
+ t.sub("dashboard/ (Vite + React)");
513
+ t.sub("MCP server (.claude/mcp/dashboard/)");
481
514
  t.done();
482
515
  hbWarnings = [];
483
516
  if (!(hbMode !== "skip")) {
484
- _context5.n = 14;
517
+ _context5.n = 23;
485
518
  break;
486
519
  }
487
520
  t.step("Detecting HyperBEAM environment");
488
- _context5.n = 11;
521
+ _context5.n = 13;
489
522
  return detectHBEnv();
490
- case 11:
523
+ case 13:
491
524
  _yield$detectHBEnv = _context5.v;
492
525
  deps = _yield$detectHBEnv.deps;
493
526
  missing = _yield$detectHBEnv.missing;
494
- hbCwd = hbMode === "link" ? hbPath : "./HyperBEAM";
527
+ hbCwd = hbMode === "existing" ? hbPath : "./HyperBEAM";
495
528
  envLines = ["CWD=".concat(hbCwd)];
496
529
  if (deps.erl) t.sub("".concat(green("✔"), " erlang ").concat(deps.erl.version || ""));
497
530
  if (deps.rebar3) t.sub("".concat(green("✔"), " rebar3"));
@@ -519,29 +552,81 @@ var create = /*#__PURE__*/function () {
519
552
  _iterator2.f();
520
553
  }
521
554
  (0, _fs.writeFileSync)((0, _path.resolve)(appdir, ".env.hyperbeam"), envLines.join("\n") + "\n");
522
- t.sub(".env.hyperbeam generated");
555
+ t.sub(".env.hyperbeam \u2192 CWD=".concat(hbCwd));
523
556
  t.done();
524
- if (!(hbMode === "link")) {
525
- _context5.n = 12;
557
+ if (!(hbMode === "clone")) {
558
+ _context5.n = 20;
526
559
  break;
527
560
  }
528
- t.step("Linking HyperBEAM");
529
- (0, _fs.symlinkSync)(hbPath, (0, _path.resolve)(appdir, "HyperBEAM"));
530
- t.sub("".concat(hbPath, " \u2192 HyperBEAM/"));
531
- t.done();
532
- _context5.n = 14;
533
- break;
534
- case 12:
535
561
  t.step("Cloning HyperBEAM");
536
562
  t.sub("tag: ".concat(HB_TAG));
537
- _context5.n = 13;
538
- return exec("cd ".concat(appdir, " && git clone --depth 1 --branch ").concat(HB_TAG, " ").concat(HB_REPO, " HyperBEAM"), {
563
+ _context5.n = 14;
564
+ return exec("cd \"".concat(appdir, "\" && git clone --depth 1 --branch ").concat(HB_TAG, " ").concat(HB_REPO, " HyperBEAM"), {
539
565
  maxBuffer: 50 * 1024 * 1024,
540
566
  timeout: 600000
541
567
  });
542
- case 13:
543
- t.done();
544
568
  case 14:
569
+ t.done();
570
+ if (!(deps.erl && deps.rebar3 && missing.length === 0)) {
571
+ _context5.n = 19;
572
+ break;
573
+ }
574
+ t.step("Compiling HyperBEAM (with genesis-wasm)");
575
+ _context5.p = 15;
576
+ envParts = [];
577
+ if (deps.gcc) {
578
+ envParts.push("CC=gcc-".concat(deps.gcc), "CXX=g++-".concat(deps.gcc));
579
+ }
580
+ if (deps.cmake) {
581
+ envParts.push("CMAKE_POLICY_VERSION_MINIMUM=3.5");
582
+ }
583
+ envPrefix = envParts.join(" ");
584
+ _context5.n = 16;
585
+ return exec("cd \"".concat(appdir, "/HyperBEAM\" && ").concat(envPrefix, " rebar3 as genesis_wasm compile"), {
586
+ maxBuffer: 50 * 1024 * 1024,
587
+ timeout: 600000
588
+ });
589
+ case 16:
590
+ t.sub("genesis-wasm device compiled");
591
+ t.done();
592
+ _context5.n = 18;
593
+ break;
594
+ case 17:
595
+ _context5.p = 17;
596
+ _t4 = _context5.v;
597
+ t.fail("Compile failed — check .env.hyperbeam and run manually");
598
+ case 18:
599
+ _context5.n = 20;
600
+ break;
601
+ case 19:
602
+ if (missing.length > 0) {
603
+ t.step("Skipping compilation (missing dependencies)");
604
+ t.sub("Run 'cd HyperBEAM && rebar3 compile' after installing dependencies");
605
+ t.done();
606
+ }
607
+ case 20:
608
+ // Generate wallet in HyperBEAM directory
609
+ hbWalletDir = (0, _path.resolve)(appdir, hbCwd);
610
+ t.step("Generating HyperBEAM wallet");
611
+ hbArweave = _arweave["default"].init();
612
+ _context5.n = 21;
613
+ return hbArweave.wallets.generate();
614
+ case 21:
615
+ hbJwk = _context5.v;
616
+ _context5.n = 22;
617
+ return hbArweave.wallets.jwkToAddress(hbJwk);
618
+ case 22:
619
+ hbAddr = _context5.v;
620
+ (0, _fs.writeFileSync)((0, _path.resolve)(hbWalletDir, ".wallet.json"), JSON.stringify(hbJwk));
621
+ t.sub("address: ".concat(hbAddr));
622
+ t.done();
623
+ case 23:
624
+ if (withFrontend) {
625
+ t.step("Setting up frontend");
626
+ t.sub("Vite + React + wao/web");
627
+ t.sub("vitest unit tests + Playwright E2E");
628
+ t.done();
629
+ }
545
630
  t.summary(function () {
546
631
  splash();
547
632
  console.log(" ".concat(green("🎉"), " ").concat(bold(appname), " is ready!"));
@@ -555,62 +640,112 @@ var create = /*#__PURE__*/function () {
555
640
  console.log(" ".concat(dim("Install these before running HyperBEAM tests")));
556
641
  }
557
642
  console.log();
558
- console.log(" ".concat(dim("$"), " ").concat(bold("cd ".concat(appname, " && claude"))));
643
+ console.log(" ".concat(bold("1. Build"), " ").concat(dim("claude")));
559
644
  console.log();
560
- console.log(" ".concat(bold("Then:")));
645
+ console.log(" ".concat(dim("$"), " cd ").concat(appname));
646
+ console.log(" ".concat(dim("$"), " ").concat(bold("claude")));
647
+ console.log(" ".concat(dim("Tell the agent what to build, or run"), " ").concat(cyan("/build"), " ").concat(dim("for the full workflow.")));
561
648
  console.log();
562
- console.log(" ".concat(dim("1."), " ").concat(dim("plan your app or device")));
563
- console.log(" ".concat(dim("2."), " ").concat(dim("build with /create-handler")));
564
- console.log(" ".concat(dim("3."), " ").concat(dim("/test for in-memory AOS")));
565
- console.log(" ".concat(dim("4."), " ").concat(dim("/test-hb for HyperBEAM integration")));
566
- console.log(" ".concat(dim("5."), " ").concat(dim("/deploy to mainnet")));
649
+ console.log(" ".concat(dim("Quality gates (enforced automatically):")));
650
+ console.log(" ".concat(dim(" Unit tests in-memory AOS (mainnet WASM device)")));
651
+ if (hbMode !== "skip") console.log(" ".concat(dim(" Integration test HyperBEAM (requires Erlang)")));
652
+ if (withFrontend) console.log(" ".concat(dim("".concat(hbMode !== "skip" ? "③" : "", " Frontend tests vitest + Playwright"))));
653
+ console.log(" ".concat(dim("Agent cannot complete tasks until all gates pass.")));
567
654
  console.log();
568
- console.log(" ".concat(bold("Dev cycle:")));
655
+ console.log(" ".concat(bold("2. Deploy to mainnet")));
569
656
  console.log();
570
- console.log(" ".concat(cyan("AOS"), " ").concat(dim("in-memory testing (fast)"), " yarn test test/legacynet.test.js"));
571
- console.log(" ".concat(cyan("HyperBEAM"), " ").concat(dim("local node testing"), " yarn test test/hyperbeam.test.js"));
572
- console.log(" ".concat(cyan("Mainnet"), " ").concat(dim("deploy when ready"), " yarn deploy src/counter.lua --wallet .wallet.json"));
657
+ console.log(" ".concat(dim("$"), " yarn deploy src/counter.lua --wallet .wallet.json"));
573
658
  console.log();
574
659
  });
575
- _context5.n = 16;
660
+ _context5.n = 25;
576
661
  break;
577
- case 15:
578
- _context5.p = 15;
579
- _t4 = _context5.v;
580
- t.fail(_t4.message);
581
- case 16:
662
+ case 24:
663
+ _context5.p = 24;
664
+ _t5 = _context5.v;
665
+ t.fail(_t5.message);
666
+ case 25:
582
667
  return _context5.a(2);
583
668
  }
584
- }, _callee5, null, [[6, 15]]);
669
+ }, _callee5, null, [[15, 17], [7, 24]]);
585
670
  }));
586
671
  return function create() {
587
672
  return _ref5.apply(this, arguments);
588
673
  };
589
674
  }();
590
- if (isCreate) create();else {
675
+ var build = /*#__PURE__*/function () {
676
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6() {
677
+ var _yield$import, spawn, feature, claudeArgs, child;
678
+ return _regenerator().w(function (_context6) {
679
+ while (1) switch (_context6.n) {
680
+ case 0:
681
+ _context6.n = 1;
682
+ return which("claude");
683
+ case 1:
684
+ if (_context6.v) {
685
+ _context6.n = 2;
686
+ break;
687
+ }
688
+ console.error("Claude Code not found. Install: npm i -g @anthropic-ai/claude-code");
689
+ process.exit(1);
690
+ case 2:
691
+ _context6.n = 3;
692
+ return Promise.resolve().then(function () {
693
+ return _interopRequireWildcard(require("child_process"));
694
+ });
695
+ case 3:
696
+ _yield$import = _context6.v;
697
+ spawn = _yield$import.spawn;
698
+ feature = args.join(" ");
699
+ claudeArgs = ["--dangerously-skip-permissions"];
700
+ if (feature) {
701
+ claudeArgs.push("/build ".concat(feature));
702
+ } else if ((0, _fs.existsSync)("tasks.json") && (0, _fs.existsSync)("plan.md")) {
703
+ claudeArgs.push("resume /build");
704
+ } else {
705
+ claudeArgs.push("/build");
706
+ }
707
+ child = spawn("claude", claudeArgs, {
708
+ stdio: "inherit",
709
+ env: _objectSpread(_objectSpread({}, process.env), {}, {
710
+ CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS: "1"
711
+ })
712
+ });
713
+ child.on("exit", function (code) {
714
+ return process.exit(code !== null && code !== void 0 ? code : 0);
715
+ });
716
+ case 4:
717
+ return _context6.a(2);
718
+ }
719
+ }, _callee6);
720
+ }));
721
+ return function build() {
722
+ return _ref6.apply(this, arguments);
723
+ };
724
+ }();
725
+ if (isBuild) build();else if (isCreate) create();else {
591
726
  _pm["default"].connect(false, /*#__PURE__*/function () {
592
- var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(err) {
593
- var _t5, _t6, _t7, _t8;
594
- return _regenerator().w(function (_context6) {
595
- while (1) switch (_context6.n) {
727
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(err) {
728
+ var _t6, _t7, _t8, _t9;
729
+ return _regenerator().w(function (_context7) {
730
+ while (1) switch (_context7.n) {
596
731
  case 0:
597
732
  if (err) {
598
733
  console.error("Error connecting to PM2:", err);
599
734
  process.exit(2);
600
735
  }
601
- _t5 = _pm["default"];
602
- _t6 = _path.resolve;
603
- _context6.n = 1;
736
+ _t6 = _pm["default"];
737
+ _t7 = _path.resolve;
738
+ _context7.n = 1;
604
739
  return (0, _utils.dirname)();
605
740
  case 1:
606
- _t7 = _t6(_context6.v, cmd.script);
607
- _t8 = args;
608
- _t5.start.call(_t5, {
609
- script: _t7,
741
+ _t8 = _t7(_context7.v, cmd.script);
742
+ _t9 = args;
743
+ _t6.start.call(_t6, {
744
+ script: _t8,
610
745
  nodeArgs: "--experimental-wasm-memory64",
611
746
  instances: 1,
612
747
  force: true,
613
- args: _t8,
748
+ args: _t9,
614
749
  daemon: false,
615
750
  name: "wao"
616
751
  }, function (err) {
@@ -622,12 +757,12 @@ if (isCreate) create();else {
622
757
  });
623
758
  _pm["default"].streamLogs("all", 0, false);
624
759
  case 2:
625
- return _context6.a(2);
760
+ return _context7.a(2);
626
761
  }
627
- }, _callee6);
762
+ }, _callee7);
628
763
  }));
629
764
  return function (_x3) {
630
- return _ref6.apply(this, arguments);
765
+ return _ref7.apply(this, arguments);
631
766
  };
632
767
  }());
633
768
  process.on("SIGINT", function () {