wao 0.40.2 → 0.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/cjs/accounts-web.js +25 -0
  2. package/cjs/accounts.js +38 -0
  3. package/cjs/adaptor-base.js +504 -287
  4. package/cjs/adaptor-cf.js +42 -0
  5. package/cjs/ao-loader.js +1 -1
  6. package/cjs/ao.js +18 -6
  7. package/cjs/aoconnect-base.js +1010 -546
  8. package/cjs/aoconnect-cf.js +24 -0
  9. package/cjs/ar-remote.js +277 -0
  10. package/cjs/armem-base.js +822 -211
  11. package/cjs/armem-cf.js +128 -0
  12. package/cjs/armem.js +11 -5
  13. package/cjs/bar.js +511 -173
  14. package/cjs/car.js +37 -0
  15. package/cjs/cf-env.js +54 -0
  16. package/cjs/cf.js +76 -0
  17. package/cjs/cli.js +12 -6
  18. package/cjs/create.js +1 -1
  19. package/cjs/devs.js +53 -0
  20. package/cjs/dodb.js +116 -0
  21. package/cjs/hb.js +136 -53
  22. package/cjs/hyperbeam.js +85 -44
  23. package/cjs/keygen.js +94 -0
  24. package/cjs/run.js +4 -1
  25. package/cjs/server.js +40 -9
  26. package/cjs/storage-multi.js +525 -0
  27. package/cjs/tgql-d1.js +664 -0
  28. package/cjs/tgql.js +293 -172
  29. package/cjs/workspace/.claude/agents/tester.md +2 -2
  30. package/cjs/workspace/.claude/skills/build/SKILL.md +2 -2
  31. package/cjs/workspace/.claude/skills/test/SKILL.md +3 -2
  32. package/cjs/workspace/CLAUDE.md +2 -2
  33. package/cjs/workspace/README.md +1 -1
  34. package/cjs/workspace/docs/debug.md +9 -4
  35. package/cjs/workspace/docs/hyperbeam-devices.md +50 -1
  36. package/cjs/workspace/package.json +3 -3
  37. package/esm/accounts-web.js +14 -0
  38. package/esm/accounts.js +27 -0
  39. package/esm/adaptor-base.js +129 -31
  40. package/esm/adaptor-cf.js +11 -0
  41. package/esm/ao-loader.js +1 -1
  42. package/esm/ao.js +21 -2
  43. package/esm/aoconnect-base.js +248 -7
  44. package/esm/aoconnect-cf.js +9 -0
  45. package/esm/ar-remote.js +87 -0
  46. package/esm/armem-base.js +304 -53
  47. package/esm/armem-cf.js +67 -0
  48. package/esm/armem.js +7 -2
  49. package/esm/bar.js +126 -16
  50. package/esm/car.js +10 -0
  51. package/esm/cf-env.js +29 -0
  52. package/esm/cf.js +11 -0
  53. package/esm/cli.js +6 -2
  54. package/esm/create.js +1 -1
  55. package/esm/devs.js +15 -0
  56. package/esm/dodb.js +26 -0
  57. package/esm/hb.js +93 -16
  58. package/esm/hyperbeam.js +68 -30
  59. package/esm/keygen.js +47 -0
  60. package/esm/run.js +4 -1
  61. package/esm/server.js +29 -9
  62. package/esm/storage-multi.js +183 -0
  63. package/esm/tgql-d1.js +407 -0
  64. package/esm/tgql.js +29 -10
  65. package/esm/workspace/.claude/agents/tester.md +2 -2
  66. package/esm/workspace/.claude/skills/build/SKILL.md +2 -2
  67. package/esm/workspace/.claude/skills/test/SKILL.md +3 -2
  68. package/esm/workspace/CLAUDE.md +2 -2
  69. package/esm/workspace/README.md +1 -1
  70. package/esm/workspace/docs/debug.md +9 -4
  71. package/esm/workspace/docs/hyperbeam-devices.md +50 -1
  72. package/esm/workspace/package.json +3 -3
  73. package/package.json +10 -3
  74. package/postinstall.cjs +84 -0
package/cjs/hb.js CHANGED
@@ -24,28 +24,124 @@ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArra
24
24
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
25
25
  function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
26
26
  function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
27
- 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; }
28
- 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; }
29
- 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; }
30
- function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
31
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
32
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
33
- function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
34
27
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
35
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
36
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
37
- 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); }
38
28
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
39
29
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
40
30
  function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
41
31
  function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
42
32
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
43
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
44
- 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); }
45
33
  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 }; })(); }
46
34
  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); }
47
35
  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); }
48
36
  function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
37
+ 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; }
38
+ 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; }
39
+ 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; }
40
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
41
+ 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); }
42
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
43
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
44
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
45
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
46
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
47
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
48
+ 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); }
49
+ // Convert objects whose keys are sequential numeric strings (e.g.
50
+ // `{1: "a", 2: "b"}`) into arrays. v0.9-FINAL's multipart re-encoder treats
51
+ // numbered TABMs as lists; JS hbsig only emits `.="list"` in ao-types when
52
+ // the value is an Array, so without this conversion the content-digest of
53
+ // the request body diverges from HB's recomputation and rsa-pss verification
54
+ // fails with `process_not_verified`.
55
+ var _normalizeNumberedObjects = function normalizeNumberedObjects(v) {
56
+ if (v === null || v === undefined) return v;
57
+ if (Array.isArray(v)) return v.map(_normalizeNumberedObjects);
58
+ if (Buffer.isBuffer(v) || v instanceof Blob) return v;
59
+ if (_typeof(v) !== "object") return v;
60
+ var keys = Object.keys(v);
61
+ if (keys.length > 0 && keys.every(function (k) {
62
+ return /^[1-9][0-9]*$/.test(k);
63
+ }) && keys.map(function (k) {
64
+ return parseInt(k, 10);
65
+ }).sort(function (a, b) {
66
+ return a - b;
67
+ }).every(function (n, i) {
68
+ return n === i + 1;
69
+ })) {
70
+ return keys.map(function (k) {
71
+ return parseInt(k, 10);
72
+ }).sort(function (a, b) {
73
+ return a - b;
74
+ }).map(function (i) {
75
+ return _normalizeNumberedObjects(v[String(i)]);
76
+ });
77
+ }
78
+ var out = {};
79
+ for (var _i = 0, _Object$entries = Object.entries(v); _i < _Object$entries.length; _i++) {
80
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
81
+ k = _Object$entries$_i[0],
82
+ val = _Object$entries$_i[1];
83
+ out[k] = _normalizeNumberedObjects(val);
84
+ }
85
+ return out;
86
+ };
87
+
88
+ // v0.9-FINAL returns Messages with lowercase fields (data, target, anchor, from)
89
+ // where legacy AOS-format consumers expect capitalised (Data, Target, Anchor,
90
+ // From). Also lower-cases tag {name, value} pairs and may emit them as a
91
+ // numbered-key map under "tags" rather than an array under "Tags". Normalise
92
+ // so existing callers that read `Messages[0].Data` keep working.
93
+ var _normalizeLegacyResult = function _normalizeLegacyResult(res) {
94
+ var _res$Messages;
95
+ if (!res || _typeof(res) !== "object") return res;
96
+ var _msgs = (_res$Messages = res.Messages) !== null && _res$Messages !== void 0 ? _res$Messages : res.messages;
97
+ if (!Array.isArray(_msgs)) return res;
98
+ var _tagsArray = function _tagsArray(t) {
99
+ if (!t) return [];
100
+ if (Array.isArray(t)) {
101
+ return t.map(function (x) {
102
+ var _x$name, _x$value;
103
+ return {
104
+ name: (_x$name = x === null || x === void 0 ? void 0 : x.name) !== null && _x$name !== void 0 ? _x$name : x === null || x === void 0 ? void 0 : x.Name,
105
+ value: (_x$value = x === null || x === void 0 ? void 0 : x.value) !== null && _x$value !== void 0 ? _x$value : x === null || x === void 0 ? void 0 : x.Value
106
+ };
107
+ }).filter(function (x) {
108
+ return x.name != null;
109
+ });
110
+ }
111
+ if (_typeof(t) === "object") {
112
+ return Object.keys(t).filter(function (k) {
113
+ return /^\d+$/.test(k);
114
+ }).sort(function (a, b) {
115
+ return Number(a) - Number(b);
116
+ }).map(function (k) {
117
+ var _x$name2, _x$value2;
118
+ var x = t[k];
119
+ return {
120
+ name: (_x$name2 = x === null || x === void 0 ? void 0 : x.name) !== null && _x$name2 !== void 0 ? _x$name2 : x === null || x === void 0 ? void 0 : x.Name,
121
+ value: (_x$value2 = x === null || x === void 0 ? void 0 : x.value) !== null && _x$value2 !== void 0 ? _x$value2 : x === null || x === void 0 ? void 0 : x.Value
122
+ };
123
+ }).filter(function (x) {
124
+ return x.name != null;
125
+ });
126
+ }
127
+ return [];
128
+ };
129
+ var Messages = _msgs.map(function (m) {
130
+ var _m$Tags, _m$Data, _m$Target, _m$Anchor, _m$From;
131
+ if (!m || _typeof(m) !== "object") return m;
132
+ var tags = _tagsArray((_m$Tags = m.Tags) !== null && _m$Tags !== void 0 ? _m$Tags : m.tags);
133
+ return _objectSpread(_objectSpread({}, m), {}, {
134
+ Data: (_m$Data = m.Data) !== null && _m$Data !== void 0 ? _m$Data : m.data,
135
+ Target: (_m$Target = m.Target) !== null && _m$Target !== void 0 ? _m$Target : m.target,
136
+ Anchor: (_m$Anchor = m.Anchor) !== null && _m$Anchor !== void 0 ? _m$Anchor : m.anchor,
137
+ From: (_m$From = m.From) !== null && _m$From !== void 0 ? _m$From : m.from,
138
+ Tags: tags
139
+ });
140
+ });
141
+ return _objectSpread(_objectSpread({}, res), {}, {
142
+ Messages: Messages
143
+ });
144
+ };
49
145
  var toMsg = /*#__PURE__*/function () {
50
146
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(req) {
51
147
  var _req$headers;
@@ -299,7 +395,7 @@ var HB = /*#__PURE__*/function () {
299
395
  key: "pushAOS",
300
396
  value: function () {
301
397
  var _pushAOS = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9(_ref3) {
302
- var pid, slot, initialOutbox, _ref3$maxDepth, maxDepth, currentSlot, lastOutbox, depth, outbox, msgs, hasSelfMsg, nextSlot, _iterator, _step, _msg$target, _ref4, _msg$data, _ref5, _tags$Action, msg, target, tags, _i, _Object$entries, _Object$entries$_i, key, val, lk, data, action, _yield$this$scheduleA2, newSlot, targetOutbox, replies, _iterator2, _step2, _reply$target, _ref6, _reply$data, _ref7, _rTags$Action, reply, replyTarget, rTags, _i2, _Object$entries2, _Object$entries2$_i, rk, rv, rl, rData, rAction, _yield$this$scheduleA3, replySlot, _t4, _t5, _t6, _t7, _t8, _t9;
398
+ var pid, slot, initialOutbox, _ref3$maxDepth, maxDepth, currentSlot, lastOutbox, depth, outbox, msgs, hasSelfMsg, nextSlot, _iterator, _step, _msg$target, _ref4, _msg$data, _ref5, _tags$Action, msg, target, tags, _i2, _Object$entries2, _Object$entries2$_i, key, val, lk, data, action, _yield$this$scheduleA2, newSlot, targetOutbox, replies, _iterator2, _step2, _reply$target, _ref6, _reply$data, _ref7, _rTags$Action, reply, replyTarget, rTags, _i3, _Object$entries3, _Object$entries3$_i, rk, rv, rl, rData, rAction, _yield$this$scheduleA3, replySlot, _t4, _t5, _t6, _t7, _t8, _t9;
303
399
  return _regenerator().w(function (_context9) {
304
400
  while (1) switch (_context9.p = _context9.n) {
305
401
  case 0:
@@ -369,13 +465,13 @@ var HB = /*#__PURE__*/function () {
369
465
  return _context9.a(3, 37);
370
466
  case 10:
371
467
  tags = {};
372
- _i = 0, _Object$entries = Object.entries(msg);
468
+ _i2 = 0, _Object$entries2 = Object.entries(msg);
373
469
  case 11:
374
- if (!(_i < _Object$entries.length)) {
470
+ if (!(_i2 < _Object$entries2.length)) {
375
471
  _context9.n = 14;
376
472
  break;
377
473
  }
378
- _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2), key = _Object$entries$_i[0], val = _Object$entries$_i[1];
474
+ _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2), key = _Object$entries2$_i[0], val = _Object$entries2$_i[1];
379
475
  lk = key.toLowerCase();
380
476
  if (!(lk === "data" || lk === "target" || lk === "anchor")) {
381
477
  _context9.n = 12;
@@ -387,7 +483,7 @@ var HB = /*#__PURE__*/function () {
387
483
  tags[key] = String(val);
388
484
  }
389
485
  case 13:
390
- _i++;
486
+ _i2++;
391
487
  _context9.n = 11;
392
488
  break;
393
489
  case 14:
@@ -446,13 +542,13 @@ var HB = /*#__PURE__*/function () {
446
542
  return _context9.a(3, 29);
447
543
  case 21:
448
544
  rTags = {};
449
- _i2 = 0, _Object$entries2 = Object.entries(reply);
545
+ _i3 = 0, _Object$entries3 = Object.entries(reply);
450
546
  case 22:
451
- if (!(_i2 < _Object$entries2.length)) {
547
+ if (!(_i3 < _Object$entries3.length)) {
452
548
  _context9.n = 25;
453
549
  break;
454
550
  }
455
- _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2), rk = _Object$entries2$_i[0], rv = _Object$entries2$_i[1];
551
+ _Object$entries3$_i = _slicedToArray(_Object$entries3[_i3], 2), rk = _Object$entries3$_i[0], rv = _Object$entries3$_i[1];
456
552
  rl = rk.toLowerCase();
457
553
  if (!(rl === "data" || rl === "target" || rl === "anchor")) {
458
554
  _context9.n = 23;
@@ -464,7 +560,7 @@ var HB = /*#__PURE__*/function () {
464
560
  rTags[rk] = String(rv);
465
561
  }
466
562
  case 24:
467
- _i2++;
563
+ _i3++;
468
564
  _context9.n = 22;
469
565
  break;
470
566
  case 25:
@@ -698,7 +794,7 @@ var HB = /*#__PURE__*/function () {
698
794
  value: function () {
699
795
  var _computeLegacy = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12(_ref1) {
700
796
  var _json$results, _json$computeResults, _json$results2;
701
- var pid, slot, json, raw;
797
+ var pid, slot, json, parsed, raw;
702
798
  return _regenerator().w(function (_context12) {
703
799
  while (1) switch (_context12.n) {
704
800
  case 0:
@@ -710,36 +806,16 @@ var HB = /*#__PURE__*/function () {
710
806
  });
711
807
  case 1:
712
808
  json = _context12.v;
713
- if (!(json !== null && json !== void 0 && (_json$results = json.results) !== null && _json$results !== void 0 && (_json$results = _json$results.json) !== null && _json$results !== void 0 && _json$results.body)) {
714
- _context12.n = 2;
715
- break;
716
- }
717
- return _context12.a(2, JSON.parse(json.results.json.body));
718
- case 2:
719
- if (!(json !== null && json !== void 0 && (_json$computeResults = json["compute/results/json"]) !== null && _json$computeResults !== void 0 && _json$computeResults.body)) {
720
- _context12.n = 3;
721
- break;
722
- }
723
- return _context12.a(2, JSON.parse(json["compute/results/json"].body));
724
- case 3:
725
- if (!(json !== null && json !== void 0 && (_json$results2 = json.results) !== null && _json$results2 !== void 0 && _json$results2.raw)) {
726
- _context12.n = 4;
727
- break;
809
+ parsed = json;
810
+ if (json !== null && json !== void 0 && (_json$results = json.results) !== null && _json$results !== void 0 && (_json$results = _json$results.json) !== null && _json$results !== void 0 && _json$results.body) {
811
+ parsed = JSON.parse(json.results.json.body);
812
+ } else if (json !== null && json !== void 0 && (_json$computeResults = json["compute/results/json"]) !== null && _json$computeResults !== void 0 && _json$computeResults.body) {
813
+ parsed = JSON.parse(json["compute/results/json"].body);
814
+ } else if (json !== null && json !== void 0 && (_json$results2 = json.results) !== null && _json$results2 !== void 0 && _json$results2.raw) {
815
+ raw = typeof json.results.raw === "string" ? JSON.parse(json.results.raw) : json.results.raw;
816
+ if (raw !== null && raw !== void 0 && raw.Messages || raw !== null && raw !== void 0 && raw.Output) parsed = raw;
728
817
  }
729
- raw = typeof json.results.raw === "string" ? JSON.parse(json.results.raw) : json.results.raw;
730
- if (!(raw !== null && raw !== void 0 && raw.Messages || raw !== null && raw !== void 0 && raw.Output)) {
731
- _context12.n = 4;
732
- break;
733
- }
734
- return _context12.a(2, raw);
735
- case 4:
736
- if (!(json !== null && json !== void 0 && json.Messages || json !== null && json !== void 0 && json.Output)) {
737
- _context12.n = 5;
738
- break;
739
- }
740
- return _context12.a(2, json);
741
- case 5:
742
- return _context12.a(2, json);
818
+ return _context12.a(2, _normalizeLegacyResult(parsed));
743
819
  }
744
820
  }, _callee12, this);
745
821
  }));
@@ -1326,6 +1402,13 @@ var HB = /*#__PURE__*/function () {
1326
1402
  _context27.n = 1;
1327
1403
  return this.setInfo();
1328
1404
  case 1:
1405
+ // v0.9-FINAL multipart re-encoding sees a numbered-key object as a list
1406
+ // (TABM with .="list" in ao-types). JS hbsig's structured codec encodes
1407
+ // a plain numeric-keyed object without that marker, so HB's recomputed
1408
+ // content-digest doesn't match what JS signed and verify fails. Pre-
1409
+ // normalize any numbered-key object value into an array so the array
1410
+ // path (which already emits .="list") is used.
1411
+ tags = _normalizeNumberedObjects(tags);
1329
1412
  res = null;
1330
1413
  if (!(this.format === "ans104")) {
1331
1414
  _context27.n = 3;
@@ -1349,7 +1432,7 @@ var HB = /*#__PURE__*/function () {
1349
1432
  pid: res.out.process
1350
1433
  });
1351
1434
  case 3:
1352
- // Use httpsig-signed multipart POST (beta3-compatible approach)
1435
+ // Use httpsig-signed multipart POST
1353
1436
  spawnTags = (0, _ramda.mergeLeft)(tags, {
1354
1437
  "random-seed": (0, _utils.seed)(16),
1355
1438
  type: "Process",
@@ -2055,7 +2138,7 @@ var HB = /*#__PURE__*/function () {
2055
2138
  i++;
2056
2139
  }
2057
2140
  }
2058
- // Add accept-bundle header to get inline data instead of links (beta3 compatibility)
2141
+ // Add accept-bundle header to get inline data instead of links
2059
2142
  url = "".concat(this.url).concat(path).concat(_json).concat(_params);
2060
2143
  _loop3 = /*#__PURE__*/_regenerator().m(function _loop3(attempt) {
2061
2144
  var _t25;
package/cjs/hyperbeam.js CHANGED
@@ -79,6 +79,7 @@ var HyperBEAM = exports["default"] = /*#__PURE__*/function () {
79
79
  arweave_gateway = _ref.arweave_gateway,
80
80
  _ref$force_signed = _ref.force_signed,
81
81
  force_signed = _ref$force_signed === void 0 ? false : _ref$force_signed,
82
+ linkify_mode = _ref.linkify_mode,
82
83
  rebar3 = _ref.rebar3;
83
84
  _classCallCheck(this, HyperBEAM);
84
85
  // Determine rebar3 mode: option > env var > default (true)
@@ -92,6 +93,7 @@ var HyperBEAM = exports["default"] = /*#__PURE__*/function () {
92
93
  }
93
94
  this.genesis_wasm = genesis_wasm;
94
95
  this.force_signed = force_signed;
96
+ this.linkify_mode = linkify_mode;
95
97
  this.cu_port = cu_port;
96
98
  this.arweave_gateway = arweave_gateway || process.env.ARWEAVE_GATEWAY;
97
99
  this.devices = devices;
@@ -137,7 +139,7 @@ var HyperBEAM = exports["default"] = /*#__PURE__*/function () {
137
139
  this.c = c;
138
140
  this.cmake = cmake;
139
141
  this.port = port;
140
- this.url = "http://localhost:".concat(this.port);
142
+ this.url = "http://127.0.0.1:".concat(this.port);
141
143
  if (bundler) this.bundler = "http://localhost::".concat(bundler);
142
144
  this.bundler_ans104 = bundler_ans104;
143
145
  if (bundler_httpsig) this.bundler = bundler_httpsig;
@@ -167,6 +169,18 @@ var HyperBEAM = exports["default"] = /*#__PURE__*/function () {
167
169
  key: "shell",
168
170
  value: function shell() {
169
171
  var _this = this;
172
+ // Kill any stale beam.smp / process listening on our HB port before
173
+ // spawning a new shell. Without this, sequential test runs can hit a
174
+ // lingering Erlang VM from the previous test (kill() returned but the
175
+ // OS hadn't released the port yet) and end up either failing to bind
176
+ // 10001 or talking to the stale node with stale process registry —
177
+ // surface symptom is 400 "No scheduler information provided." on the
178
+ // first schedule of an otherwise-known process.
179
+ try {
180
+ (0, _child_process.spawnSync)("bash", ["-c", "lsof -ti:".concat(this.port, " | xargs -r kill -9 2>/dev/null")], {
181
+ stdio: "ignore"
182
+ });
183
+ } catch (_e) {}
170
184
  var evalCmd = this.genEval({
171
185
  gateway: this.gateway,
172
186
  wallet: this.wallet
@@ -420,7 +434,7 @@ var HyperBEAM = exports["default"] = /*#__PURE__*/function () {
420
434
  key: "startCU",
421
435
  value: function () {
422
436
  var _startCU = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
423
- var cuDir, dbDir, gatewayUrl, graphqlUrl, noProxy, env, start, res, _t3;
437
+ var cuDir, dbDir, gatewayUrl, graphqlUrl, noProxy, env, nodeMajor, memory64Flag, start, res, _t3;
424
438
  return _regenerator().w(function (_context3) {
425
439
  while (1) switch (_context3.p = _context3.n) {
426
440
  case 0:
@@ -428,6 +442,23 @@ var HyperBEAM = exports["default"] = /*#__PURE__*/function () {
428
442
  dbDir = (0, _path.resolve)(this.dirname, "cache-mainnet/genesis-wasm"); // Ensure DB directory exists
429
443
  (0, _child_process.spawnSync)("mkdir", ["-p", dbDir]);
430
444
 
445
+ // Kill any stale CU process listening on cu_port before spawning a new
446
+ // one. Sequential test runs in the same OS share port 6363; if a prior
447
+ // run's CU lingered (e.g. detached but its parent died before SIGKILL
448
+ // could propagate), the new CU's bind silently fails and HB ends up
449
+ // talking to the stale CU, which has a different process registry and
450
+ // throws confusing 500/400s on the next spawn/schedule.
451
+ try {
452
+ (0, _child_process.spawnSync)("bash", ["-c", "lsof -ti:".concat(this.cu_port, " | xargs -r kill -9 2>/dev/null")], {
453
+ stdio: "ignore"
454
+ });
455
+ } catch (_e) {}
456
+ // Brief settle so the OS can release the port.
457
+ _context3.n = 1;
458
+ return new Promise(function (r) {
459
+ return setTimeout(r, 200);
460
+ });
461
+ case 1:
431
462
  // Use arweave_gateway option or ARWEAVE_GATEWAY env var for proxy environments
432
463
  gatewayUrl = this.arweave_gateway || process.env.GATEWAY_URL || "https://arweave.net";
433
464
  graphqlUrl = process.env.GRAPHQL_URL || "".concat(gatewayUrl, "/graphql"); // CU needs proxy for external services (arweave.net) but not for localhost
@@ -451,8 +482,11 @@ var HyperBEAM = exports["default"] = /*#__PURE__*/function () {
451
482
  GRAPHQL_URL: graphqlUrl,
452
483
  GRAPHQL_URLS: graphqlUrl,
453
484
  CHECKPOINT_GRAPHQL_URL: graphqlUrl
454
- });
455
- this.cuProc = (0, _child_process.spawn)("node", ["--experimental-wasm-memory64", "-r", "dotenv/config", "src/app.js"], {
485
+ }); // Node 26 enables wasm-memory64 by default and rejects the experimental
486
+ // flag; older Node versions still need it. Detect from process.versions.
487
+ nodeMajor = parseInt((process.versions.node || "0").split(".")[0], 10);
488
+ memory64Flag = nodeMajor >= 24 ? [] : ["--experimental-wasm-memory64"];
489
+ this.cuProc = (0, _child_process.spawn)("node", [].concat(memory64Flag, ["-r", "dotenv/config", "src/app.js"]), {
456
490
  cwd: cuDir,
457
491
  env: env,
458
492
  detached: true,
@@ -475,42 +509,42 @@ var HyperBEAM = exports["default"] = /*#__PURE__*/function () {
475
509
 
476
510
  // Wait for CU to be ready - check / endpoint instead of /status
477
511
  start = Date.now();
478
- case 1:
512
+ case 2:
479
513
  if (!(Date.now() - start < 30000)) {
480
- _context3.n = 8;
514
+ _context3.n = 9;
481
515
  break;
482
516
  }
483
- _context3.p = 2;
484
- _context3.n = 3;
517
+ _context3.p = 3;
518
+ _context3.n = 4;
485
519
  return fetch("http://localhost:".concat(this.cu_port, "/"));
486
- case 3:
520
+ case 4:
487
521
  res = _context3.v;
488
522
  if (!(res.ok || res.status === 404)) {
489
- _context3.n = 4;
523
+ _context3.n = 5;
490
524
  break;
491
525
  }
492
526
  // Any response (including 404) means server is up
493
527
  if (this.logs) console.log("CU server ready");
494
528
  return _context3.a(2, true);
495
- case 4:
496
- _context3.n = 6;
497
- break;
498
529
  case 5:
499
- _context3.p = 5;
500
- _t3 = _context3.v;
501
- case 6:
502
530
  _context3.n = 7;
531
+ break;
532
+ case 6:
533
+ _context3.p = 6;
534
+ _t3 = _context3.v;
535
+ case 7:
536
+ _context3.n = 8;
503
537
  return new Promise(function (r) {
504
538
  return setTimeout(r, 500);
505
539
  });
506
- case 7:
507
- _context3.n = 1;
508
- break;
509
540
  case 8:
541
+ _context3.n = 2;
542
+ break;
543
+ case 9:
510
544
  if (this.logs) console.log("CU server startup timeout, continuing anyway...");
511
545
  return _context3.a(2, true);
512
546
  }
513
- }, _callee3, this, [[2, 5]]);
547
+ }, _callee3, this, [[3, 6]]);
514
548
  }));
515
549
  function startCU() {
516
550
  return _startCU.apply(this, arguments);
@@ -539,6 +573,12 @@ var HyperBEAM = exports["default"] = /*#__PURE__*/function () {
539
573
  // See hb_beamr.erl: "configure BEAM to have enough async worker threads (see erl +A N)"
540
574
  var asyncThreads = "+A 4";
541
575
  if (!_env.ERL_ZFLAGS) _env.ERL_ZFLAGS = asyncThreads;else if (!_env.ERL_ZFLAGS.includes("+A")) _env.ERL_ZFLAGS += " ".concat(asyncThreads);
576
+ // Skip the hb application's default-port HTTP server start (8734). We call
577
+ // hb_http_server:start_node/1 explicitly with the actual port via genEval,
578
+ // so the default binding is redundant; skipping it avoids eaddrinuse and
579
+ // the downstream case_clause crashes when multiple HyperBEAM instances
580
+ // run side-by-side (p4.test.js, p4-lua.test.js).
581
+ _env.WAO_NO_DEFAULT_HTTP_SERVER = "1";
542
582
  return _env;
543
583
  }
544
584
  }, {
@@ -566,31 +606,31 @@ var HyperBEAM = exports["default"] = /*#__PURE__*/function () {
566
606
  }
567
607
  }
568
608
  if (_devs.length > 0) {
569
- _devices = ", preloaded_devices => [".concat(_devs.join(", "), "]");
609
+ _devices = ", <<\"preloaded-devices\">> => [".concat(_devs.join(", "), "]");
570
610
  }
571
- var _wallet = ", priv_key_location => <<\"".concat(wallet, "\">>");
611
+ var _wallet = ", <<\"priv-key-location\">> => <<\"".concat(wallet, "\">>");
572
612
  // Use arweave_gateway (Cloudflare proxy) if set, otherwise local gateway port, otherwise default
573
- var _gateway = this.arweave_gateway ? ", gateway => <<\"".concat(this.arweave_gateway, "\">>") : gateway ? ", gateway => <<\"http://localhost:".concat(gateway, "\">>") : "";
613
+ var _gateway = this.arweave_gateway ? ", <<\"gateway\">> => <<\"".concat(this.arweave_gateway, "\">>") : gateway ? ", <<\"gateway\">> => <<\"http://localhost:".concat(gateway, "\">>") : "";
574
614
 
575
615
  // Store config: use single hb_store_fs matching HyperBEAM eunit test pattern.
576
616
  // Multi-store with hb_store_gateway wrappers caused snapshot discovery failures
577
617
  // because list_numbered/resolve interactions across stores break symlink following.
578
618
  // The wao@1.0 device handles Arweave TX resolution independently via HTTP.
579
- var _store = this.store_prefix ? ", store => #{ <<\"store-module\">> => hb_store_fs, <<\"name\">> => <<\"".concat(this.store_prefix, "\">> }") : "";
580
- var _bundler = this.bundler ? ", bundler_httpsig => <<\"".concat(this.bundler, "\">>") : "";
619
+ var _store = this.store_prefix ? ", <<\"store\">> => #{ <<\"store-module\">> => hb_store_fs, <<\"name\">> => <<\"".concat(this.store_prefix, "\">> }") : "";
620
+ var _bundler = this.bundler ? ", <<\"bundler-httpsig\">> => <<\"".concat(this.bundler, "\">>") : "";
581
621
  // Only include bundler_ans104 if it's a truthy value (port number or URL)
582
622
  // When false or omitted, don't include it - Erlang code expects either no option or a valid URL
583
- var _bundler_ans104 = this.bundler_ans104 && this.bundler_ans104 !== false ? ", bundler_ans104 => <<\"http://localhost:".concat(this.bundler_ans104, "\">>") : "";
623
+ var _bundler_ans104 = this.bundler_ans104 && this.bundler_ans104 !== false ? ", <<\"bundler-ans104\">> => <<\"http://localhost:".concat(this.bundler_ans104, "\">>") : "";
584
624
  /*
585
625
  const _routes = `, routes => [#{ <<"template">> => <<"/result/.*">>, <<"node">> => #{ <<"prefix">> => <<"http://localhost:${this.cu}">> } }, #{ <<\"template\">> => <<\"/dry-run\">>, <<\"node\">> => #{ <<\"prefix\">> => <<\"http://localhost:${this.cu}\">> } }, #{ <<"template">> => <<"/graphql">>, <<"nodes">> => [#{ <<"prefix">> => <<"http://localhost:${gateway}">>, <<"opts">> => #{ http_client => httpc, protocol => http2 } }, #{ <<"prefix">> => <<"http://localhost:${gateway}">>, <<"opts">> => #{ http_client => gun, protocol => http2 } }] }, #{ <<"template">> => <<"/raw">>, <<"node">> => #{ <<"prefix">> => <<"http://localhost:${gateway}">>, <<"opts">> => #{ http_client => gun, protocol => http2 } } }]`
586
626
  */
587
- var _p4_non_chargable = this.p4_non_chargable ? ", p4_non_chargable_routes => [".concat(this.p4_non_chargable_routes.map(function () {
627
+ var _p4_non_chargable = this.p4_non_chargable ? ", <<\"p4-non-chargable-routes\">> => [".concat(this.p4_non_chargable_routes.map(function () {
588
628
  return "#{ <<\"template\">> => <<\"/*~node-process@1.0/*\">> }";
589
- }).join(", "), "]") : this.p4_lua ? ", p4_non_chargable_routes => [#{ <<\"template\">> => <<\"/*~node-process@1.0/*\">> }, #{ <<\"template\">> => <<\"/~wao@1.0/*\">> }, #{ <<\"template\">> => <<\"/~p4@1.0/balance\">> }, #{ <<\"template\">> => <<\"/~meta@1.0/*\">> }]" : !this.simple_pay ? "" : ", p4_non_chargable_routes => [#{ <<\"template\">> => <<\"/~simple-pay@1.0/topup\">> }, #{ <<\"template\">> => <<\"/~meta@1.0/*\">> }, #{ <<\"template\">> => <<\"/~simple-pay@1.0/balance\">> }]";
590
- var _operator = this.operator ? ", operator => <<\"".concat(this.operator, "\">>") : "";
591
- var _spp = this.spp ? ", simple_pay_price => ".concat(this.spp) : "";
592
- var _genesis_wasm_port = this.genesis_wasm ? ", genesis_wasm_port => ".concat(this.cu_port) : "";
593
- var _force_signed = this.force_signed ? ", force_signed_requests => true, force_signed => true" : "";
629
+ }).join(", "), "]") : this.p4_lua ? ", <<\"p4-non-chargable-routes\">> => [#{ <<\"template\">> => <<\"/*~node-process@1.0/*\">> }, #{ <<\"template\">> => <<\"/~wao@1.0/*\">> }, #{ <<\"template\">> => <<\"/~p4@1.0/balance\">> }, #{ <<\"template\">> => <<\"/~meta@1.0/*\">> }]" : !this.simple_pay ? "" : ", <<\"p4-non-chargable-routes\">> => [#{ <<\"template\">> => <<\"/~simple-pay@1.0/topup\">> }, #{ <<\"template\">> => <<\"/~meta@1.0/*\">> }, #{ <<\"template\">> => <<\"/~simple-pay@1.0/balance\">> }]";
630
+ var _operator = this.operator ? ", <<\"operator\">> => <<\"".concat(this.operator, "\">>") : "";
631
+ var _spp = this.spp ? ", <<\"simple-pay-price\">> => ".concat(this.spp) : "";
632
+ var _genesis_wasm_port = this.genesis_wasm ? ", <<\"genesis-wasm-port\">> => ".concat(this.cu_port) : "";
633
+ var _force_signed = this.force_signed ? ", <<\"force-signed-requests\">> => true, <<\"force-signed\">> => true" : "";
594
634
 
595
635
  // Helper to format module(s) for Erlang - supports ID string, inline object, or array
596
636
  var formatModule = function formatModule(mod) {
@@ -614,30 +654,30 @@ var HyperBEAM = exports["default"] = /*#__PURE__*/function () {
614
654
  if (!str) return str;
615
655
  return str.replace(/\\/g, "\\\\").replace(/"/g, '\\"').replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t");
616
656
  };
617
- var _node_processes = this.p4_lua ? ", node_processes => #{ <<\"ledger\">> => #{ <<\"device\">> => <<\"process@1.0\">>, <<\"execution-device\">> => <<\"lua@5.3a\">>, <<\"scheduler-device\">> => <<\"scheduler@1.0\">>, <<\"module\">> => ".concat(formatModule(this.p4_lua.processor), ", <<\"operator\">> => <<\"").concat(this.operator, "\">>").concat(this.p4_lua.admin ? ", <<\"admin\">> => <<\"".concat(this.p4_lua.admin, "\">>") : "").concat(this.p4_lua.balance ? ", <<\"balance\">> => #{ ".concat(Object.entries(this.p4_lua.balance).map(function (_ref5) {
657
+ var _node_processes = this.p4_lua ? ", <<\"node-processes\">> => #{ <<\"ledger\">> => #{ <<\"device\">> => <<\"process@1.0\">>, <<\"execution-device\">> => <<\"lua@5.3a\">>, <<\"scheduler-device\">> => <<\"scheduler@1.0\">>, <<\"module\">> => ".concat(formatModule(this.p4_lua.processor), ", <<\"operator\">> => <<\"").concat(this.operator, "\">>").concat(this.p4_lua.admin ? ", <<\"admin\">> => <<\"".concat(this.p4_lua.admin, "\">>") : "").concat(this.p4_lua.balance ? ", <<\"balance\">> => #{ ".concat(Object.entries(this.p4_lua.balance).map(function (_ref5) {
618
658
  var _ref6 = _slicedToArray(_ref5, 2),
619
659
  k = _ref6[0],
620
660
  v = _ref6[1];
621
661
  return "<<\"".concat(k, "\">> => ").concat(v);
622
662
  }).join(", "), " }") : "", " } }") : "";
623
663
  var processor = this.p4_lua ? "#{ <<\"device\">> => <<\"p4@1.0\">>, <<\"pricing-device\">> => <<\"simple-pay@1.0\">>, <<\"ledger-device\">> => <<\"lua@5.3a\">>, <<\"module\">> => ".concat(formatModule(this.p4_lua.client), ", <<\"ledger-path\">> => <<\"/ledger~node-process@1.0\">> }") : "";
624
- var _port = "port => ".concat(this.port);
625
- var _faff = (0, _ramda.isNil)(this.faff) ? "" : ", faff_allow_list => [ ".concat((0, _ramda.map)(function (addr) {
664
+ var _port = "<<\"port\">> => ".concat(this.port);
665
+ var _faff = (0, _ramda.isNil)(this.faff) ? "" : ", <<\"faff-allow-list\">> => [ ".concat((0, _ramda.map)(function (addr) {
626
666
  return "<<\"".concat(addr, "\">>");
627
667
  })(this.faff).join(", "), " ]");
628
- var _on = this.p4_lua ? ", on => #{ <<\"request\">> => ".concat(processor, ", <<\"response\">> => ").concat(processor, " }") : this.simple_pay ? ", on => #{ <<\"request\">> => #{ <<\"device\">> => <<\"p4@1.0\">>, <<\"pricing-device\">> => <<\"simple-pay@1.0\">>, <<\"ledger-device\">> => <<\"simple-pay@1.0\">> }, <<\"response\">> => #{ <<\"device\">> => <<\"p4@1.0\">>, <<\"pricing-device\">> => <<\"simple-pay@1.0\">>, <<\"ledger-device\">> => <<\"simple-pay@1.0\">> } }" : !(0, _ramda.isNil)(this.faff) ? ", on => #{ <<\"request\">> => #{ <<\"device\">> => <<\"p4@1.0\">>, <<\"pricing-device\">> => <<\"faff@1.0\">>, <<\"ledger-device\">> => <<\"faff@1.0\">> }, <<\"response\">> => #{ <<\"device\">> => <<\"p4@1.0\">>, <<\"pricing-device\">> => <<\"faff@1.0\">>, <<\"ledger-device\">> => <<\"faff@1.0\">> } }" : "";
668
+ var _on = this.p4_lua ? ", <<\"on\">> => #{ <<\"request\">> => ".concat(processor, ", <<\"response\">> => ").concat(processor, " }") : this.simple_pay ? ", <<\"on\">> => #{ <<\"request\">> => #{ <<\"device\">> => <<\"p4@1.0\">>, <<\"pricing-device\">> => <<\"simple-pay@1.0\">>, <<\"ledger-device\">> => <<\"simple-pay@1.0\">> }, <<\"response\">> => #{ <<\"device\">> => <<\"p4@1.0\">>, <<\"pricing-device\">> => <<\"simple-pay@1.0\">>, <<\"ledger-device\">> => <<\"simple-pay@1.0\">> } }" : !(0, _ramda.isNil)(this.faff) ? ", <<\"on\">> => #{ <<\"request\">> => #{ <<\"device\">> => <<\"p4@1.0\">>, <<\"pricing-device\">> => <<\"faff@1.0\">>, <<\"ledger-device\">> => <<\"faff@1.0\">> }, <<\"response\">> => #{ <<\"device\">> => <<\"p4@1.0\">>, <<\"pricing-device\">> => <<\"faff@1.0\">>, <<\"ledger-device\">> => <<\"faff@1.0\">> } }" : "";
629
669
  // Add cache_writers to allow the wallet to write to cache (needed for WASM module uploads)
630
670
  // Use the wallet address (this.addr) which is always available from the wallet file
631
- var _cache_writers = ", cache_writers => [<<\"".concat(this.addr, "\">>]");
671
+ var _cache_writers = ", <<\"cache-writers\">> => [<<\"".concat(this.addr, "\">>]");
632
672
 
633
673
  // Use gun HTTP client for relay calls instead of httpc
634
674
  // gun doesn't use system proxy settings, avoiding the proxy issue with localhost CU
635
- var _relay_http_client = ", relay_http_client => gun, http_client => gun";
675
+ var _relay_http_client = ", <<\"relay-http-client\">> => gun, <<\"http-client\">> => gun";
636
676
 
637
677
  // Custom routes using Cloudflare proxy instead of arweave.net
638
678
  // Also add CU routes for genesis_wasm when enabled
639
679
  var cuRoutes = this.genesis_wasm ? "#{ <<\"template\">> => <<\"/result/*\">>, <<\"node\">> => #{ <<\"prefix\">> => <<\"http://localhost:".concat(this.cu_port, "\">> } },\n #{ <<\"template\">> => <<\"/snapshot/*\">>, <<\"node\">> => #{ <<\"prefix\">> => <<\"http://localhost:").concat(this.cu_port, "\">> } },\n #{ <<\"template\">> => <<\"/dry-run\">>, <<\"node\">> => #{ <<\"prefix\">> => <<\"http://localhost:").concat(this.cu_port, "\">> } },") : "";
640
- var _routes = this.arweave_gateway || this.genesis_wasm ? ", routes => [\n ".concat(cuRoutes, "\n #{ <<\"template\">> => <<\"/graphql\">>, <<\"nodes\">> => [\n #{ <<\"prefix\">> => <<\"").concat(this.arweave_gateway || 'https://arweave.net', "\">>, <<\"opts\">> => #{ http_client => gun, protocol => http2 } }\n ]},\n #{ <<\"template\">> => <<\"/arweave\">>, <<\"node\">> => #{\n <<\"match\">> => <<\"^/arweave\">>,\n <<\"with\">> => <<\"").concat(this.arweave_gateway || 'https://arweave.net', "\">>,\n <<\"opts\">> => #{ http_client => gun, protocol => http2 }\n }},\n #{ <<\"template\">> => <<\"/raw\">>, <<\"node\">> => #{\n <<\"prefix\">> => <<\"").concat(this.arweave_gateway || 'https://arweave.net', "\">>,\n <<\"opts\">> => #{ http_client => gun, protocol => http2 }\n }}\n ]") : "";
680
+ var _routes = this.arweave_gateway || this.genesis_wasm ? ", <<\"routes\">> => [\n ".concat(cuRoutes, "\n #{ <<\"template\">> => <<\"/graphql\">>, <<\"nodes\">> => [\n #{ <<\"prefix\">> => <<\"").concat(this.arweave_gateway || 'https://arweave.net', "\">>, <<\"opts\">> => #{ http_client => gun, protocol => http2 } }\n ]},\n #{ <<\"template\">> => <<\"/arweave\">>, <<\"node\">> => #{\n <<\"match\">> => <<\"^/arweave\">>,\n <<\"with\">> => <<\"").concat(this.arweave_gateway || 'https://arweave.net', "\">>,\n <<\"opts\">> => #{ http_client => gun, protocol => http2 }\n }},\n #{ <<\"template\">> => <<\"/raw\">>, <<\"node\">> => #{\n <<\"prefix\">> => <<\"").concat(this.arweave_gateway || 'https://arweave.net', "\">>,\n <<\"opts\">> => #{ http_client => gun, protocol => http2 }\n }}\n ]") : "";
641
681
 
642
682
  // Explicitly clear httpc proxy settings at Erlang level before starting HyperBEAM
643
683
  // This ensures no proxy is used regardless of any OS-level or cached settings
@@ -649,7 +689,7 @@ var HyperBEAM = exports["default"] = /*#__PURE__*/function () {
649
689
 
650
690
  // Pre-register device name atoms so hb_util:atom/1 (which uses list_to_existing_atom)
651
691
  // doesn't crash with badarg when resolving device names from HTTP headers/binaries
652
- var preRegisterAtoms = "lists:foreach(fun list_to_atom/1, [\"wao@1.0\", \"hbsig@1.0\", \"stack@1.0\", \"patch@1.0\", \"inc@1.0\", \"double@1.0\", \"add@1.0\", \"mul@1.0\", \"inc2@1.0\", \"square@1.0\", \"mydev@1.0\", \"lua@5.3a\", \"process@1.0\", \"scheduler@1.0\", \"message@1.0\", \"meta@1.0\", \"cache@1.0\", \"json@1.0\", \"structured@1.0\", \"httpsig@1.0\", \"flat@1.0\", \"genesis-wasm@1.0\", \"compute@1.0\", \"delegated-compute@1.0\", \"relay@1.0\", \"router@1.0\", \"cron@1.0\", \"node-process@1.0\", \"p4@1.0\", \"simple-pay@1.0\", \"faff@1.0\", \"ans104@1.0\", \"test-device@1.0\", \"lookup@1.0\", \"local-name@1.0\", \"upload@1.0\", \"hook@1.0\", \"auth-hook@1.0\", \"http-auth@1.0\", \"greenzone@1.0\", \"apply@1.0\", \"dedup@1.0\", \"cookie@1.0\", \"push@1.0\", \"query@1.0\", \"manifest@1.0\", \"name@1.0\", \"profile@1.0\", \"monitor@1.0\", \"multipass@1.0\", \"poda@1.0\", \"snp@1.0\", \"trie@1.0\", \"volume@1.0\", \"secret@1.0\", \"wasi@1.0\", \"wasm-64@1.0\", \"whois@1.0\", \"cacheviz@1.0\", \"hyperbuddy@1.0\", \"copycat@1.0\", \"json-iface@1.0\", \"arweave@2.9-pre\"]), ";
692
+ var preRegisterAtoms = "lists:foreach(fun list_to_atom/1, [\"wao@1.0\", \"hbsig@1.0\", \"stack@1.0\", \"patch@1.0\", \"inc@1.0\", \"double@1.0\", \"add@1.0\", \"mul@1.0\", \"inc2@1.0\", \"square@1.0\", \"mydev@1.0\", \"lua@5.3a\", \"process@1.0\", \"scheduler@1.0\", \"message@1.0\", \"meta@1.0\", \"cache@1.0\", \"json@1.0\", \"structured@1.0\", \"httpsig@1.0\", \"flat@1.0\", \"genesis-wasm@1.0\", \"compute@1.0\", \"delegated-compute@1.0\", \"relay@1.0\", \"router@1.0\", \"cron@1.0\", \"node-process@1.0\", \"p4@1.0\", \"simple-pay@1.0\", \"faff@1.0\", \"ans104@1.0\", \"test-device@1.0\", \"lookup@1.0\", \"local-name@1.0\", \"upload@1.0\", \"hook@1.0\", \"auth-hook@1.0\", \"http-auth@1.0\", \"greenzone@1.0\", \"apply@1.0\", \"dedup@1.0\", \"cookie@1.0\", \"push@1.0\", \"query@1.0\", \"manifest@1.0\", \"name@1.0\", \"profile@1.0\", \"monitor@1.0\", \"multipass@1.0\", \"poda@1.0\", \"snp@1.0\", \"trie@1.0\", \"volume@1.0\", \"secret@1.0\", \"wasi@1.0\", \"wasm-64@1.0\", \"whois@1.0\", \"cacheviz@1.0\", \"hyperbuddy@1.0\", \"copycat@1.0\", \"json-iface@1.0\", \"arweave@2.9\", \"b32-name@1.0\", \"blacklist@1.0\", \"bundler@1.0\", \"gzip@1.0\", \"location@1.0\", \"metering@1.0\", \"rate-limit@1.0\", \"tx@1.0\"]), ";
653
693
 
654
694
  // Pre-create prometheus ETS tables owned by the shell process.
655
695
  // dev_hbsig on_load also does this, but the module loads lazily so this
@@ -668,13 +708,13 @@ var HyperBEAM = exports["default"] = /*#__PURE__*/function () {
668
708
  // This affects both node_processes definitions (which include 'authority' via
669
709
  // augment_definition) and push device re-scheduling (which signs outbox messages
670
710
  // with httpsig). Disable verification until upstream fixes the codec.
671
- var _verify_assignments = this.p4_lua || this.genesis_wasm ? ", verify_assignments => false" : "";
711
+ var _verify_assignments = this.p4_lua || this.genesis_wasm ? ", <<\"verify-assignments\">> => false" : "";
672
712
 
673
713
  // Use hb_http_server:start_node directly instead of hb:start_mainnet.
674
714
  // start_mainnet always overwrites the store config with a single hb_store_fs,
675
715
  // which prevents hb_store_gateway from resolving Arweave TX IDs.
676
716
  // start_node preserves user-provided store via set_default_opts.
677
- var _priv_wallet = ", priv_wallet => hb:wallet(<<\"".concat(wallet, "\">>)");
717
+ var _priv_wallet = ", <<\"priv-wallet\">> => hb:wallet(<<\"".concat(wallet, "\">>)");
678
718
  // cache_control => <<"always">> ensures compute results/snapshots are cached.
679
719
  // process_snapshot_slots => 1 takes a snapshot every slot (not just every 60s).
680
720
  // process_async_cache => false writes snapshots synchronously before returning
@@ -683,8 +723,9 @@ var HyperBEAM = exports["default"] = /*#__PURE__*/function () {
683
723
  // Without these, hb_cache:write strips uncommitted keys (like device-stack)
684
724
  // from the cached process state, and subsequent computes fail with
685
725
  // {error, no_valid_device_stack} when loading from the corrupted cache.
686
- var _cache_control = ", cache_control => <<\"always\">>, process_snapshot_slots => 1, process_async_cache => false";
687
- var start = "".concat(clearProxy).concat(initPrometheus).concat(preRegisterAtoms).concat(loadHbsig).concat(ensureInit, "hb_http_server:start_node(#{ ").concat(_port).concat(_gateway).concat(_priv_wallet).concat(_faff).concat(_bundler).concat(_bundler_ans104).concat(_on).concat(_p4_non_chargable).concat(_operator).concat(_spp).concat(_genesis_wasm_port).concat(_force_signed).concat(_devices).concat(_node_processes).concat(_cache_writers).concat(_relay_http_client).concat(_routes).concat(_store).concat(_verify_assignments).concat(_cache_control, ", prometheus => false, linkify_mode => false}).");
726
+ var _cache_control = ", <<\"cache-control\">> => <<\"always\">>, <<\"process-snapshot-slots\">> => 1, <<\"process-async-cache\">> => false";
727
+ var _linkify = this.linkify_mode === undefined ? "" : ", <<\"linkify-mode\">> => ".concat(this.linkify_mode === false ? "false" : this.linkify_mode === true ? "true" : this.linkify_mode);
728
+ var start = "".concat(clearProxy).concat(initPrometheus).concat(preRegisterAtoms).concat(loadHbsig).concat(ensureInit, "hb_http_server:start_node(#{ ").concat(_port).concat(_gateway).concat(_priv_wallet).concat(_faff).concat(_bundler).concat(_bundler_ans104).concat(_on).concat(_p4_non_chargable).concat(_operator).concat(_spp).concat(_genesis_wasm_port).concat(_force_signed).concat(_devices).concat(_node_processes).concat(_cache_writers).concat(_relay_http_client).concat(_routes).concat(_store).concat(_verify_assignments).concat(_cache_control, ", <<\"prometheus\">> => false").concat(_linkify, "}).");
688
729
  return start;
689
730
  }
690
731
  }, {