@noxsoft/anima 2.0.4 → 2.0.6

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 (411) hide show
  1. package/dist/{accounts-D8CPKNkN.js → accounts-CP1IAWeM.js} +3 -3
  2. package/dist/{acp-cli-ByK6lS6c.js → acp-cli-0JY_DUDb.js} +14 -14
  3. package/dist/{acp-cli-CaQCjIw4.js → acp-cli-BUGHeckb.js} +1 -1
  4. package/dist/{agent-N5BDcge4.js → agent-84TJKGEv.js} +17 -17
  5. package/dist/{agent-BgIkqd3F.js → agent-QgxHhHQG.js} +5 -5
  6. package/dist/{agent-events-COH7NDW2.js → agent-events-BYdVDaVT.js} +2 -2
  7. package/dist/{agent-scope-cj2QCT6R.js → agent-scope-CcE0DhlL.js} +3 -3
  8. package/dist/{agent-scope-DZgptr9J.js → agent-scope-OZi7lb8S.js} +4 -4
  9. package/dist/{agents-NEudYMdg.js → agents-Cq8A6G4K.js} +16 -16
  10. package/dist/{agents.config-Bujs-NIy.js → agents.config-Dvo2ULxs.js} +2 -2
  11. package/dist/{audit-CeCO7SK5.js → audit-DXdRifi2.js} +21 -21
  12. package/dist/{audit-C-UJhfdv.js → audit-IyzjYMJU.js} +7 -7
  13. package/dist/{auth-choice-5VnaGMD-.js → auth-choice-BlGb1wlY.js} +4 -4
  14. package/dist/{auth-choice-DA2k4vs8.js → auth-choice-D8eoe09e.js} +9 -9
  15. package/dist/{auth-health-B7FqA26_.js → auth-health-CeDOBbt0.js} +1 -1
  16. package/dist/{auth-DMPZWzEa.js → auth-lZ26wsbN.js} +3 -3
  17. package/dist/{auth-profiles-BDrNYX_n.js → auth-profiles-BVZBTuls.js} +12 -12
  18. package/dist/{auth-profiles-CxSHydjn.js → auth-profiles-CC3TFfvS.js} +4 -4
  19. package/dist/{banner-BtDZPRzi.js → banner-CRxzEzP3.js} +1 -1
  20. package/dist/{browser-cli-8yQMpxb8.js → browser-cli-BZ38kv8Y.js} +3 -3
  21. package/dist/{browser-cli-Czg3JtDH.js → browser-cli-CYOmCXxE.js} +18 -18
  22. package/dist/build-info.json +3 -3
  23. package/dist/bundled/boot-md/handler.js +15 -15
  24. package/dist/bundled/bootstrap-extra-files/handler.js +4 -4
  25. package/dist/bundled/command-logger/handler.js +1 -1
  26. package/dist/bundled/session-memory/handler.js +5 -5
  27. package/dist/{call-BIzCaKZb.js → call-CTMQygkz.js} +6 -6
  28. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  29. package/dist/{catalog-DMfEg-oK.js → catalog-BAayBt1L.js} +2 -2
  30. package/dist/{channel-options-BrtCtyrT.js → channel-options-M44Z9-3q.js} +3 -3
  31. package/dist/{channel-selection-Bbm1lq3P.js → channel-selection-DfGpCyh2.js} +2 -2
  32. package/dist/{channel-web-DrsT6OAE.js → channel-web-BrIHecpS.js} +6 -6
  33. package/dist/{channels-cli-zNvi1m5c.js → channels-cli-C0P0ZlHx.js} +25 -25
  34. package/dist/{channels-cli-Juyh1S6n.js → channels-cli-KtsQYWVF.js} +74 -74
  35. package/dist/{channels-status-issues-CqzqshW4.js → channels-status-issues-DBc1pU_R.js} +1 -1
  36. package/dist/{chrome-C4dOMO8z.js → chrome-DlcCwfo_.js} +3 -3
  37. package/dist/{chrome-DdcDzAtH.js → chrome-mUDT-mA5.js} +11 -11
  38. package/dist/{chunk-D2nLsrEW.js → chunk-mxPVo000.js} +3 -3
  39. package/dist/{clack-prompter-BI3RDW5w.js → clack-prompter-B0kl7shw.js} +4 -4
  40. package/dist/{clack-prompter-Dwr1m_IZ.js → clack-prompter-Ct2BYIXW.js} +3 -3
  41. package/dist/cli/daemon-cli.js +1 -1
  42. package/dist/{cli-CjWUGdGC.js → cli-B4pn-1VI.js} +12 -12
  43. package/dist/cli-XwscHlSF.js +99 -0
  44. package/dist/{cli-session-gtuYN2Iq.js → cli-session-Ce28JlWH.js} +23 -23
  45. package/dist/{cli-session-BVjY_XrW.js → cli-session-hA8WocEt.js} +2 -2
  46. package/dist/{client-Dswwze5_.js → client-C1avc0vD.js} +4 -4
  47. package/dist/{clipboard-BZKS9O1u.js → clipboard-BbGnZskJ.js} +1 -1
  48. package/dist/{command-registry-BBvNvysr.js → command-registry-ClvgG8A4.js} +13 -13
  49. package/dist/{commands-BMnD_QRY.js → commands-D5PGoVW4.js} +6 -6
  50. package/dist/{commands-AZ3n8Y2c.js → commands-D7CbOdcS.js} +6 -6
  51. package/dist/{commands-registry-cFqZ6Ib4.js → commands-registry-sLFieXCB.js} +2 -2
  52. package/dist/{common-DJbnT8ws.js → common-D6bu0zHC.js} +2 -2
  53. package/dist/{completion-cli-BADRBcIl.js → completion-cli-OneShplj.js} +4 -4
  54. package/dist/{completion-cli-DMQgiObF.js → completion-cli-dY9UxYCv.js} +1 -1
  55. package/dist/{config-CU-Axg8P.js → config-BeuAT94o.js} +5 -5
  56. package/dist/{config-kVVm5EYV.js → config-C96685Kz.js} +34 -34
  57. package/dist/{config-cli-BPlbwiuA.js → config-cli-D4BM20Wb.js} +9 -9
  58. package/dist/{config-cli-DXgZJkPU.js → config-cli-s5wiaveP.js} +1 -1
  59. package/dist/{config-guard-Ba49JNds.js → config-guard-Cqozcug_.js} +4 -4
  60. package/dist/{config-guard-Cu0qMKZJ.js → config-guard-O61aodl9.js} +5 -5
  61. package/dist/{config-sync-CzLnLTXt.js → config-sync-CoIIbEOe.js} +2 -2
  62. package/dist/{config-sync-DuydxPWx.js → config-sync-DvAttep0.js} +2 -2
  63. package/dist/{configure-CHgacLyi.js → configure-CU6DuhJJ.js} +14 -14
  64. package/dist/{configure-DfHXDa1L.js → configure-Dq6HFJZ_.js} +21 -21
  65. package/dist/{context-DzgXOckU.js → context-ChaAWbwZ.js} +3 -3
  66. package/dist/{control-service-8_wKHwBa.js → control-service-DXYImShH.js} +4 -4
  67. package/dist/{control-service-BtL1Jto_.js → control-service-X_1FRl7x.js} +2 -2
  68. package/dist/{cron-cli-CCWNkykU.js → cron-cli-B6jMeNqC.js} +1 -1
  69. package/dist/{cron-cli-BCzSR2c0.js → cron-cli-ByPSA5ZE.js} +19 -19
  70. package/dist/{daemon-cli-CmlHcC1J.js → daemon-cli-Bf0Q00vC.js} +9 -9
  71. package/dist/{daemon-cli-Bjkbu9Vy.js → daemon-cli-CKOoYhs-.js} +21 -21
  72. package/dist/{daemon-runtime-rUTqCVwJ.js → daemon-runtime-cglglYsH.js} +4 -4
  73. package/dist/{deliver-BBggsviM.js → deliver--QyfTd7v.js} +1 -1
  74. package/dist/{deliver-DFnVaetP.js → deliver-BcW8mBAi.js} +8 -8
  75. package/dist/{deliver-CePITOl8.js → deliver-C45YyEys.js} +15 -15
  76. package/dist/{deps-CeEKhrp7.js → deps-C-cgNARI.js} +1 -1
  77. package/dist/{devices-cli-DQrDMrZH.js → devices-cli-BbUrME_U.js} +1 -1
  78. package/dist/{devices-cli-Oe-A1Dv0.js → devices-cli-qvEFBnyH.js} +12 -12
  79. package/dist/{diagnostics-m79ZlMmZ.js → diagnostics-BCxobJaf.js} +1 -1
  80. package/dist/{diagnostics-DxMFrBLO.js → diagnostics-DlIw6fqD.js} +1 -1
  81. package/dist/{directory-cli-Cjgmi_sj.js → directory-cli-BjnpktnO.js} +14 -14
  82. package/dist/{directory-cli-BL6h8cGF.js → directory-cli-VreWAdNS.js} +2 -2
  83. package/dist/{dispatcher-DNd40gUn.js → dispatcher-CoqsaA3f.js} +2 -2
  84. package/dist/{dispatcher-DAFbQM-c.js → dispatcher-DbDPyVIX.js} +1 -1
  85. package/dist/{dns-cli-CFtV3BXK.js → dns-cli-B-lWrEam.js} +2 -2
  86. package/dist/{dns-cli-NyIHvQ5S.js → dns-cli-CRKIrBD6.js} +10 -10
  87. package/dist/{dock-BdXLb5oY.js → dock-Dmxj3en_.js} +4 -4
  88. package/dist/{docs-cli-D_cmJDSr.js → docs-cli-Bn-mDvE1.js} +7 -7
  89. package/dist/{doctor-D12wNQPU.js → doctor-BGKXuPIi.js} +41 -41
  90. package/dist/{doctor-BpGxKrBl.js → doctor-LlbmPUOu.js} +25 -25
  91. package/dist/{doctor-completion-DwjqdEcK.js → doctor-completion-231u4vqH.js} +2 -2
  92. package/dist/{doctor-completion-DeOfofek.js → doctor-completion-CAtF5ON2.js} +4 -4
  93. package/dist/{doctor-config-flow-BI3mpkbd.js → doctor-config-flow-CemLoFO1.js} +9 -9
  94. package/dist/{doctor-config-flow-wMHheFkC.js → doctor-config-flow-DvpqXAnB.js} +3 -3
  95. package/dist/{engine-BCtL-AMw.js → engine-B9avUJL5.js} +5 -5
  96. package/dist/{engine-Bk_UT413.js → engine-BiUQ25D4.js} +5 -5
  97. package/dist/entry.js +1 -1
  98. package/dist/{exec-approvals-CroGJRUg.js → exec-approvals-CdLmKX2R.js} +2 -2
  99. package/dist/{exec-approvals-cli-BTxF_RsH.js → exec-approvals-cli-5-h9moQI.js} +6 -6
  100. package/dist/{exec-approvals-cli-n1gyGwH2.js → exec-approvals-cli-Cne9mMrK.js} +19 -19
  101. package/dist/{exec-B7sUS164.js → exec-tTxVr8zb.js} +17 -17
  102. package/dist/{frontmatter-BmHq0vRD.js → frontmatter-YijVi0FQ.js} +2 -2
  103. package/dist/{gateway-cli-DDBadlrS.js → gateway-cli-BTjUHLX7.js} +128 -128
  104. package/dist/{gateway-cli-IZNkOMBe.js → gateway-cli-hG12cY2D.js} +68 -68
  105. package/dist/{gateway-rpc-L2PVSqGj.js → gateway-rpc-C3eniXwh.js} +3 -3
  106. package/dist/{github-copilot-auth-DXpOMSd3.js → github-copilot-auth-BsXG6mVD.js} +3 -3
  107. package/dist/{github-copilot-auth-DKyqDaGU.js → github-copilot-auth-Pfnl_1i1.js} +2 -2
  108. package/dist/{gmail-setup-utils-BKNczIJ9.js → gmail-setup-utils-BPo_LkKI.js} +3 -3
  109. package/dist/{health-DUf1gt4E.js → health-B7ybadPd.js} +17 -17
  110. package/dist/{health-Bm8ZTvC3.js → health-BpWIriyw.js} +7 -7
  111. package/dist/{health-format-uzh1xYLD.js → health-format-CdP99j3Y.js} +2 -2
  112. package/dist/{heartbeat-visibility-1TJb1Zao.js → heartbeat-visibility-D25E1_q-.js} +1 -1
  113. package/dist/{heartbeat-visibility-CwodtdcX.js → heartbeat-visibility-DjUBgbLw.js} +1 -1
  114. package/dist/{helpers-N-uSFKOn.js → helpers-ZKNRexvX.js} +1 -1
  115. package/dist/{hooks-cli-BGjILbze.js → hooks-cli-B6sU7wl_.js} +58 -58
  116. package/dist/{hooks-cli-1POsXqOl.js → hooks-cli-CSckaOqF.js} +16 -16
  117. package/dist/{hooks-status-Du-d1jde.js → hooks-status-B-e96dZj.js} +4 -4
  118. package/dist/{hooks-status-DE07n5RC.js → hooks-status-LVJDILL8.js} +1 -1
  119. package/dist/{image-ops-Bp0C6Mvr.js → image-ops-Dlt3T7th.js} +1 -1
  120. package/dist/index.js +17 -17
  121. package/dist/{init-9A0s7bWG.js → init-Bm04RagW.js} +2 -2
  122. package/dist/{init-DoyCHJDC.js → init-CaJBf4p1.js} +3 -3
  123. package/dist/{installs-D1C9wHAq.js → installs-D-cPGdCw.js} +5 -5
  124. package/dist/{installs-Dh4dHayM.js → installs-DCTtAJP8.js} +2 -2
  125. package/dist/{ipv4-DSOUVx0i.js → ipv4-BxSO1qWh.js} +8 -8
  126. package/dist/{ipv4-DCItfaJo.js → ipv4-CH0OhdjF.js} +15 -15
  127. package/dist/{lifecycle-core-TQKyXO-6.js → lifecycle-core-BZo7U2jW.js} +8 -8
  128. package/dist/{lifecycle-core-BY4WIf9g.js → lifecycle-core-Cu_h9gos.js} +5 -5
  129. package/dist/{links-CNu_8RZl.js → links-BfjHVTB_.js} +1 -1
  130. package/dist/llm-slug-generator.js +4 -4
  131. package/dist/{logging-C7lb3Vjc.js → logging-DB6BQmhi.js} +1 -1
  132. package/dist/{login-DXWKewA2.js → login-CnNpZKOD.js} +3 -3
  133. package/dist/{login-pPs3UO38.js → login-D4n2DJtf.js} +5 -5
  134. package/dist/{login-qr-GF2JMIy-.js → login-qr-CaB_Oi7G.js} +9 -9
  135. package/dist/{login-qr-ZYYKD6Yt.js → login-qr-D3xv0VnI.js} +7 -7
  136. package/dist/{logs-cli-CzXbX8HZ.js → logs-cli-CFX-tr6f.js} +14 -14
  137. package/dist/{logs-cli-D9ngH9PF.js → logs-cli-NXQfed5q.js} +2 -2
  138. package/dist/{manager-BD5rA3w0.js → manager-D_engjHC.js} +9 -9
  139. package/dist/{manager-DRWMWM--.js → manager-iFc0bAWS.js} +7 -7
  140. package/dist/{manifest-registry-DbvPaBXY.js → manifest-registry-D4lM2RdV.js} +1 -1
  141. package/dist/{markdown-tables-CqwihY2m.js → markdown-tables-Bhes7rr4.js} +2 -2
  142. package/dist/{media-lUqN-0O9.js → media-Bu2L8c_7.js} +6 -6
  143. package/dist/{memory-cli-BLXSpgnN.js → memory-cli-CvrdGRvA.js} +13 -13
  144. package/dist/{memory-cli-BcGVkkRJ.js → memory-cli-D6v61Mts.js} +1 -1
  145. package/dist/{migrate-BpVOar4L.js → migrate-BR6iAIjO.js} +3 -3
  146. package/dist/{migrate-CkgGDkWy.js → migrate-D0EcMs0f.js} +2 -2
  147. package/dist/{models-CExsNQPH.js → models-VFpi6nI0.js} +22 -22
  148. package/dist/{models-cli-Ba3Jmwev.js → models-cli-BTVAOLev.js} +23 -23
  149. package/dist/{models-cli-iDAlsbL2.js → models-cli-CAo6PLtV.js} +64 -64
  150. package/dist/{net-0A_zcaQD.js → net-B5lXhYLV.js} +1 -1
  151. package/dist/{node-cli-DYFR_V25.js → node-cli-Cgn2mwSW.js} +12 -12
  152. package/dist/{node-cli-ATmwCXIk.js → node-cli-kxhgdSNi.js} +33 -33
  153. package/dist/{node-service-CN4LqR1A.js → node-service-BFxHJsno.js} +2 -2
  154. package/dist/{node-service-CWt3MdSC.js → node-service-BL8qVG1X.js} +1 -1
  155. package/dist/{nodes-cli-QeJIfa18.js → nodes-cli-De6Ta7GH.js} +2 -2
  156. package/dist/{nodes-cli-BeVmhTz3.js → nodes-cli-deMLu7ch.js} +18 -18
  157. package/dist/{nodes-screen-DHyWAlla.js → nodes-screen-BST4qOFR.js} +1 -1
  158. package/dist/{note-CSlg2BnB.js → note-BtE8fGoO.js} +1 -1
  159. package/dist/{note-Ctvglhp1.js → note-uiuPxhyX.js} +1 -1
  160. package/dist/{npm-registry-spec-PxisIMts.js → npm-registry-spec-za3itb5Y.js} +1 -1
  161. package/dist/{onboard-channels-C4iSfFXR.js → onboard-channels-ByrlUaWj.js} +4 -4
  162. package/dist/{onboard-channels-oVTVgoyg.js → onboard-channels-Dlf4Shqz.js} +10 -10
  163. package/dist/{onboard-helpers-B8roRwLP.js → onboard-helpers-CwcaOee8.js} +11 -11
  164. package/dist/{onboard-helpers-Dgh26hgP.js → onboard-helpers-Cz42ASwv.js} +2 -2
  165. package/dist/{onboard-DeruD10m.js → onboard-psBFgeiy.js} +13 -13
  166. package/dist/{onboard-SAcu5N6N.js → onboard-ylkSu01y.js} +18 -18
  167. package/dist/{onboarding-C2gjB2u8.js → onboarding-BKOdAnhC.js} +23 -23
  168. package/dist/{onboarding-Bi-ac8we.js → onboarding-jbj_VM34.js} +16 -16
  169. package/dist/{orchestrator-DlbAYMQP.js → orchestrator-BKzmyBWy.js} +4 -4
  170. package/dist/{orchestrator-DlwVRVDA.js → orchestrator-BN3QCz2s.js} +4 -4
  171. package/dist/{outbound-CkKgc6iR.js → outbound-Csw4yAYo.js} +5 -5
  172. package/dist/{outbound-Vfm5yDh3.js → outbound-L1IT5jN_.js} +4 -4
  173. package/dist/{outbound-send-deps-DDjiMfEL.js → outbound-send-deps-BccDjBEk.js} +6 -6
  174. package/dist/{pairing-cli-mqopHI8s.js → pairing-cli-BmPkji_u.js} +1 -1
  175. package/dist/{pairing-cli-CJYeuEik.js → pairing-cli-CSRakAu-.js} +13 -13
  176. package/dist/{pairing-store-DoNj00-X.js → pairing-store-uUh4DCdc.js} +3 -3
  177. package/dist/{path-env-C_xpiG8l.js → path-env-Bu6k0jDQ.js} +1 -1
  178. package/dist/{paths-B1vRVCad.js → paths-Ba-yiqjy.js} +2 -2
  179. package/dist/{paths-DA9WYabg.js → paths-C1R4gjRm.js} +5 -5
  180. package/dist/{paths-DfQGx0_k.js → paths-CxRf2rBG.js} +1 -1
  181. package/dist/{pi-auth-json-DOPW3e4X.js → pi-auth-json-C2miwJYp.js} +4 -4
  182. package/dist/{pi-auth-json-lae_wwwo.js → pi-auth-json-I3iYPRAb.js} +5 -5
  183. package/dist/{pi-model-discovery-7q0GxMrp.js → pi-model-discovery-BxOzNLFn.js} +1 -1
  184. package/dist/{pi-tools.policy-xYdDLEv9.js → pi-tools.policy-B6TsNKSH.js} +5 -5
  185. package/dist/{pi-tools.policy-Csmla32P.js → pi-tools.policy-TlaJQomF.js} +1 -1
  186. package/dist/{plugin-auto-enable-CViVVWgg.js → plugin-auto-enable-DVD5Kls3.js} +4 -4
  187. package/dist/{plugin-registry-B4Aw2hzq.js → plugin-registry-NbbyJq_D.js} +2 -2
  188. package/dist/plugin-sdk/index.js +1 -1
  189. package/dist/{plugins-DtghNRtM.js → plugins-DdzdfeTc.js} +1 -1
  190. package/dist/{plugins-cli-4vWTmOAb.js → plugins-cli-CTh4l0zM.js} +18 -18
  191. package/dist/{plugins-cli-CdTMbP0X.js → plugins-cli-CanJXhdI.js} +59 -59
  192. package/dist/{ports-vd93M_Pt.js → ports-B3Vuo92o.js} +3 -3
  193. package/dist/{ports-BtZx-JKD.js → ports-Co1kd5qX.js} +2 -2
  194. package/dist/{program-CX3aUVeb.js → program-BJCGki9n.js} +64 -64
  195. package/dist/{program-context-BPos0ivo.js → program-context-Ka3D9i7F.js} +38 -38
  196. package/dist/{pw-ai-C83HBue2.js → pw-ai-DM3CIGyg.js} +6 -6
  197. package/dist/{pw-ai-4QbK5YFe.js → pw-ai-MrkdzeIJ.js} +3 -3
  198. package/dist/{qmd-manager-CRrSkfia.js → qmd-manager-Cur_Ekn0.js} +7 -7
  199. package/dist/{qmd-manager-CPypGJ0P.js → qmd-manager-Dgo23O3Q.js} +6 -6
  200. package/dist/{register.agent-DDY8KJhn.js → register.agent-CKeGWucQ.js} +76 -76
  201. package/dist/{register.agent-DKawm-9d.js → register.agent-Dc776zkl.js} +31 -31
  202. package/dist/{register.anima-DBWz2rk_.js → register.anima-BETuBtyq.js} +17 -17
  203. package/dist/{register.anima-CEWUo29k.js → register.anima-C2coCJM_.js} +17 -17
  204. package/dist/{register.configure-BX67qV8k.js → register.configure-BFWy5Qpp.js} +35 -35
  205. package/dist/register.configure-CejGY_a2.js +101 -0
  206. package/dist/{register.maintenance-BIwx1fzX.js → register.maintenance-BPXhlnI_.js} +82 -82
  207. package/dist/{register.maintenance-0k-ZNhDg.js → register.maintenance-DrJxntZL.js} +36 -36
  208. package/dist/{register.message-CXPsoakA.js → register.message-DMyXtvTa.js} +59 -59
  209. package/dist/{register.message-DA3jvfgI.js → register.message-duCZ4yHd.js} +16 -16
  210. package/dist/{register.onboard-C4HG7Hqv.js → register.onboard-B5S0gxFx.js} +41 -41
  211. package/dist/{register.onboard-GOpdif-j.js → register.onboard-CDsAPsux.js} +86 -86
  212. package/dist/register.setup-B9ONmrmU.js +189 -0
  213. package/dist/{register.setup-GJyUDCqh.js → register.setup-sRcLHKHn.js} +56 -42
  214. package/dist/{register.status-health-sessions-D5876dGx.js → register.status-health-sessions-ByqdeTXE.js} +29 -29
  215. package/dist/{register.status-health-sessions-lOewVIZR.js → register.status-health-sessions-mWqUj6vQ.js} +73 -73
  216. package/dist/{register.subclis-Dwnujj5C.js → register.subclis-k2sMszH8.js} +29 -29
  217. package/dist/{reply-r089HuRA.js → reply-7WXXmeTT.js} +69 -69
  218. package/dist/{reply-CR5T_oQJ.js → reply-DEZHacZW.js} +16 -16
  219. package/dist/{reply-prefix-BcrS4Umd.js → reply-prefix-MDrZpOVC.js} +2 -2
  220. package/dist/{reply-prefix-Btb5o2NH.js → reply-prefix-sTGuc5Wt.js} +2 -2
  221. package/dist/{routes-ucJWAk5O.js → routes-C5ylAnNV.js} +8 -8
  222. package/dist/{routes-B4czFzIb.js → routes-CooYoUCb.js} +1 -1
  223. package/dist/{rpc-BnKxnQ0v.js → rpc-BoNfgecI.js} +4 -4
  224. package/dist/{run-main-B74kv84C.js → run-main-p1g06MwF.js} +79 -79
  225. package/dist/{sandbox-CJTS3er6.js → sandbox-C6QwCGAa.js} +6 -6
  226. package/dist/{sandbox-DBSiVHt_.js → sandbox-CWQkFcjP.js} +1 -1
  227. package/dist/{sandbox-cli-D1r5y6Sz.js → sandbox-cli-CQy20WHF.js} +29 -29
  228. package/dist/{sandbox-cli-CrkjyU5M.js → sandbox-cli-pEUW1KYv.js} +5 -5
  229. package/dist/{security-cli-DS09ebvA.js → security-cli-BXWrN8oG.js} +8 -8
  230. package/dist/{security-cli-BZUdnkhn.js → security-cli-CHBLTpOA.js} +34 -34
  231. package/dist/{server-context-DVh2z7om.js → server-context-Cu88BsgT.js} +9 -9
  232. package/dist/{server-context-C0xZbYhg.js → server-context-Du3Gdqy1.js} +3 -3
  233. package/dist/{server-node-events-bu9lpkMH.js → server-node-events-DIxd5i9O.js} +6 -6
  234. package/dist/{server-node-events-i1Rrww31.js → server-node-events-QoKjpjYR.js} +28 -28
  235. package/dist/{service-CJJwLEor.js → service-BNVpYcQe.js} +2 -2
  236. package/dist/{service-DxLxBhaU.js → service-CpG4hCVW.js} +1 -1
  237. package/dist/{service-audit-M8y4TXVb.js → service-audit-B3atdWsy.js} +3 -3
  238. package/dist/{service-audit-DB4Y3Ekp.js → service-audit-DP4USmzf.js} +4 -4
  239. package/dist/{session-CGxOLFs2.js → session-B6T_f3RF.js} +9 -9
  240. package/dist/{session-cost-usage-qdfsGU2a.js → session-cost-usage-BwiTZuKl.js} +3 -3
  241. package/dist/{session-yOhWcsD2.js → session-xQxk_AyT.js} +4 -4
  242. package/dist/{sessions-wRKla1Qh.js → sessions-BbzNgP9I.js} +26 -26
  243. package/dist/{sessions-B-Cu7JZq.js → sessions-DFMUAYeu.js} +1 -1
  244. package/dist/{sessions-BgLN4KFr.js → sessions-DVLbPsGH.js} +6 -6
  245. package/dist/{sessions-CnRjwdVr.js → sessions-Gf_kQenz.js} +9 -9
  246. package/dist/{shared-Qpt4hUDi.js → shared-BcqU-KU2.js} +3 -3
  247. package/dist/{shared-kzrojZ1B.js → shared-CkGP1Gie.js} +5 -5
  248. package/dist/{shared-DS3UaJSP.js → shared-uOwPcrN5.js} +1 -1
  249. package/dist/{skill-scanner-DLJji5Ye.js → skill-scanner-CkaVLABv.js} +1 -1
  250. package/dist/{skills-BWFIEp4j.js → skills-B5LQx4lT.js} +3 -3
  251. package/dist/{skills-cli-BY53ILm2.js → skills-cli-CBFbV14l.js} +5 -5
  252. package/dist/{skills-cli-CO3gxl8A.js → skills-cli-gGWq4bgb.js} +13 -13
  253. package/dist/{skills-status-DX5pcqY3.js → skills-status-DaLLXtp7.js} +1 -1
  254. package/dist/{skills-status-zhcKzGkp.js → skills-status-JQluhU-P.js} +3 -3
  255. package/dist/{sqlite-CuprTGR7.js → sqlite-BiXgPbCK.js} +4 -4
  256. package/dist/{sqlite-B6MojU1I.js → sqlite-BukcjdJa.js} +2 -2
  257. package/dist/{start-Cu3aLoSf.js → start-DaXwIgOn.js} +10 -10
  258. package/dist/{start-Dz7tMAl8.js → start-Fy8lVmlo.js} +10 -10
  259. package/dist/{status-CaSxhxfV.js → status-BExfBl5S.js} +17 -17
  260. package/dist/{status-D2C0JCX3.js → status-CrKjEsYI.js} +33 -33
  261. package/dist/{status-DlFMsQzh.js → status-DSok8H54.js} +3 -3
  262. package/dist/{status-G0CITnKR.js → status-DfDqDag6.js} +1 -1
  263. package/dist/{status.update-DVFelehi.js → status.update-DEtEANLh.js} +1 -1
  264. package/dist/{status.update-CHjhVxJY.js → status.update-ZVrSK04Z.js} +4 -4
  265. package/dist/{subagent-registry-3Xb4el-8.js → subagent-registry-BsYW1Q8_.js} +11 -11
  266. package/dist/{subagent-registry-DNDhbHWi.js → subagent-registry-CPlMIIq4.js} +12 -12
  267. package/dist/{subagent-registry-CdSjz14I.js → subagent-registry-ChY7RF5s.js} +2 -2
  268. package/dist/{system-cli-B5mt0FWa.js → system-cli-CYypNnD9.js} +1 -1
  269. package/dist/{system-cli-Dg3UQ3Zz.js → system-cli-VMfIEGoj.js} +12 -12
  270. package/dist/{systemd-RpPE0XGg.js → systemd-BSrHDyeU.js} +2 -2
  271. package/dist/{systemd-hints-vRInKcz9.js → systemd-hints-J3cHYZVZ.js} +1 -1
  272. package/dist/{systemd-linger-EujbmI5A.js → systemd-linger-B4wBMvpg.js} +2 -2
  273. package/dist/{systemd-linger-Dzyxqsod.js → systemd-linger-CmyqQkeC.js} +2 -2
  274. package/dist/{table-DhXHfRX2.js → table-DoiRPsn0.js} +1 -1
  275. package/dist/{timeout-Ddn-5kAO.js → timeout-CswI_K-U.js} +2 -2
  276. package/dist/{tokens-BaM53PEx.js → tokens-C-X7wDKj.js} +1 -1
  277. package/dist/{trash-Bmxs1Rnm.js → trash-BJLK1vMn.js} +1 -1
  278. package/dist/{tui-mUwDwqvd.js → tui-BfPtiXD1.js} +12 -12
  279. package/dist/{tui-cli-Dw7v4JoJ.js → tui-cli-BcsdagN8.js} +18 -18
  280. package/dist/{tui-cli-B9Sq5-cC.js → tui-cli-DN5WL85n.js} +1 -1
  281. package/dist/{update-DoZLVjva.js → update-DhOF8e0Q.js} +1 -1
  282. package/dist/{update-DF0GHG0j.js → update-TxptCqk7.js} +3 -3
  283. package/dist/{update-check-D5qAKes7.js → update-check-DmODY9MR.js} +3 -3
  284. package/dist/{update-cli-BNu2Oi7H.js → update-cli-BTZtUAt2.js} +44 -44
  285. package/dist/{update-cli-D36AmALA.js → update-cli-Beq0BOux.js} +91 -91
  286. package/dist/{update-runner-CvxZmbu-.js → update-runner-Bk-TDMXa.js} +3 -3
  287. package/dist/{update-runner-CNQQaTwA.js → update-runner-DDFr9N7A.js} +5 -5
  288. package/dist/{usage-BGCwNnjk.js → usage-YBM9aU79.js} +25 -25
  289. package/dist/{web-Cmnvk9v0.js → web-BbR6pf7u.js} +60 -60
  290. package/dist/{web-B5QG839O.js → web-D2hFbrio.js} +100 -100
  291. package/dist/{web-Cv2KnTnL.js → web-hweVb0G8.js} +14 -14
  292. package/dist/{webhooks-cli-B6y89Pj_.js → webhooks-cli-bEG0ADkY.js} +1 -1
  293. package/dist/{webhooks-cli-BDzHON4w.js → webhooks-cli-l0yqYtZW.js} +10 -10
  294. package/dist/{whatsapp-actions-C_5MwVxM.js → whatsapp-actions-BAvE8ZZc.js} +10 -10
  295. package/dist/{whatsapp-actions-zTiVOoOV.js → whatsapp-actions-CwSwIOO3.js} +16 -16
  296. package/dist/{widearea-dns-CF1gxpJ-.js → widearea-dns-NsEUNYwz.js} +1 -1
  297. package/dist/{workspace-DLna1IxR.js → workspace-BTjqqJY-.js} +5 -5
  298. package/dist/{ws-log-Q4wO1Ztb.js → ws-log-N8R5MvGE.js} +2 -2
  299. package/package.json +1 -1
  300. package/dist/cli-C3cpDaz8.js +0 -99
  301. package/dist/dist-CqDI82ei.js +0 -929
  302. package/dist/dist-DnHRxR5U.js +0 -929
  303. package/dist/register.configure-CWsySuiq.js +0 -101
  304. package/dist/register.setup-B17vZT7C.js +0 -175
  305. /package/dist/{agents.config-jp7OLssr.js → agents.config-DWZdxlQw.js} +0 -0
  306. /package/dist/{auth-health-VO_MPqVX.js → auth-health-CP4Id2rW.js} +0 -0
  307. /package/dist/{auto-update-CpF0fycd.js → auto-update-CUeF99gI.js} +0 -0
  308. /package/dist/{auto-update-DNWdO7uF.js → auto-update-cgkp9ZTJ.js} +0 -0
  309. /package/dist/{brew-nqf_MiE4.js → brew-CVZkr0GU.js} +0 -0
  310. /package/dist/{budget-CRpvqDRX.js → budget-BWBp8Res.js} +0 -0
  311. /package/dist/{budget-CPedI-qW.js → budget-DxYQSekw.js} +0 -0
  312. /package/dist/{channels-status-issues-DdJdO866.js → channels-status-issues-DwHRoeWL.js} +0 -0
  313. /package/dist/{cli-utils-C1YHVD4o.js → cli-utils-DtAxdCte.js} +0 -0
  314. /package/dist/{clipboard-DES8b1AM.js → clipboard-SCV-0V39.js} +0 -0
  315. /package/dist/{command-format-G6N2zghg.js → command-format-DAaqLG8J.js} +0 -0
  316. /package/dist/{command-options-BbponVnw.js → command-options-CSbuuqHr.js} +0 -0
  317. /package/dist/{command-options-s0gnvXnS.js → command-options-Cp1tf96a.js} +0 -0
  318. /package/dist/{constants-Dhb6zSIV.js → constants-O8yBqCBv.js} +0 -0
  319. /package/dist/{daemon-runtime-C0tz7VAC.js → daemon-runtime-C9KTe-Gn.js} +0 -0
  320. /package/dist/{dangerous-tools-DGTtJ_JR.js → dangerous-tools-5ObDWy1N.js} +0 -0
  321. /package/dist/{dangerous-tools-DxrfTOfT.js → dangerous-tools-Jwr7jqNw.js} +0 -0
  322. /package/dist/{delivery-queue-Bxm0nzw7.js → delivery-queue-B6IHz4Ry.js} +0 -0
  323. /package/dist/{display-Jy3UdGzA.js → display-BDOsXu8F.js} +0 -0
  324. /package/dist/{docs-cli-CrOaIK_H.js → docs-cli-B02Wm6DH.js} +0 -0
  325. /package/dist/{errors-CKaCqKga.js → errors-CHow2wtt.js} +0 -0
  326. /package/dist/{exec-DDmuVVNq.js → exec-BizYYQgP.js} +0 -0
  327. /package/dist/{format-ByEjgyTF.js → format-Mq6iU0_5.js} +0 -0
  328. /package/dist/{format-duration-Aaj5tjJd.js → format-duration-DhWzz_5b.js} +0 -0
  329. /package/dist/{format-relative-79_Y1n2Y.js → format-relative-C6kUHuOj.js} +0 -0
  330. /package/dist/{gateway-rpc-Dtx8HN-n.js → gateway-rpc-QOe014D_.js} +0 -0
  331. /package/dist/{gmail-setup-utils-co0ppccC.js → gmail-setup-utils-Bn8x7djJ.js} +0 -0
  332. /package/dist/{health-format-BksT6F68.js → health-format-DteBvzWP.js} +0 -0
  333. /package/dist/{help-format-C6cv_aZp.js → help-format-C4eJQd8a.js} +0 -0
  334. /package/dist/{help-format-BMKzarov.js → help-format-DUBI91Ti.js} +0 -0
  335. /package/dist/{helpers-FMld9sBT.js → helpers-DLgbkcEn.js} +0 -0
  336. /package/dist/{helpers-DpEB9Mh0.js → helpers-eJFa4K6r.js} +0 -0
  337. /package/dist/{input-provenance-Cy_KnBlP.js → input-provenance-DJBdpeKk.js} +0 -0
  338. /package/dist/{is-main-yjaVwMtJ.js → is-main-Dt9DTcH1.js} +0 -0
  339. /package/dist/{loader-CkmOrXcC.js → loader-BoYxRfcW.js} +0 -0
  340. /package/dist/{loader-Br7Vr0zn.js → loader-l2OBdJ8x.js} +0 -0
  341. /package/dist/{logging-CY-Q5cwf.js → logging-BdnOSVPD.js} +0 -0
  342. /package/dist/{logging-BIeRw0WR.js → logging-BuRtGUH1.js} +0 -0
  343. /package/dist/{login-qr-CevLD8cV.js → login-qr-Cc2QmLhD.js} +0 -0
  344. /package/dist/{message-channel-dua8OOGJ.js → message-channel-w4F2b2F6.js} +0 -0
  345. /package/dist/{mime-CBg4KybI.js → mime-B1ZoR53M.js} +0 -0
  346. /package/dist/{model-param-b-DW9f0NN8.js → model-param-b-DPwyNGn8.js} +0 -0
  347. /package/dist/{node-match-BV8bTBd4.js → node-match-8XZnaid6.js} +0 -0
  348. /package/dist/{normalize-_lmlBOW9.js → normalize-GDK8JTNW.js} +0 -0
  349. /package/dist/{npm-registry-spec-DQd4M22q.js → npm-registry-spec-DvJxezSJ.js} +0 -0
  350. /package/dist/{openclaw-root-JPvmPTf7.js → openclaw-root-C85WMnVV.js} +0 -0
  351. /package/dist/{outbound-send-deps-BfUvuWGa.js → outbound-send-deps-ANnAhImn.js} +0 -0
  352. /package/dist/{parse-CZRwKocn.js → parse-6-2MDhdT.js} +0 -0
  353. /package/dist/{parse-log-line-CvrZEK6A.js → parse-log-line-Bqh1SSzC.js} +0 -0
  354. /package/dist/{parse-log-line-mLdat0AH.js → parse-log-line-DUZCjXbl.js} +0 -0
  355. /package/dist/{parse-port-BSOOdo7I.js → parse-port-BKB9Exlg.js} +0 -0
  356. /package/dist/{parse-port-Y0NK62x1.js → parse-port-DrfvwwiL.js} +0 -0
  357. /package/dist/{parse-timeout-DVPQ3n9j.js → parse-timeout-Di_tcEmi.js} +0 -0
  358. /package/dist/{paths-DHjlJ6cn.js → paths-DcVEkYX5.js} +0 -0
  359. /package/dist/{pi-auth-json-MruLmI_X.js → pi-auth-json-B1M8W1pO.js} +0 -0
  360. /package/dist/{pi-model-discovery-DzEIEgHL.js → pi-model-discovery-DsRqYJLy.js} +0 -0
  361. /package/dist/{plugin-auto-enable-CjZ238UI.js → plugin-auto-enable-d9eDmGOX.js} +0 -0
  362. /package/dist/{plugins-D6PBOdkn.js → plugins-CDJw924T.js} +0 -0
  363. /package/dist/{program-context-Q1hkT73c.js → program-context-Bvn8046-.js} +0 -0
  364. /package/dist/{progress-C9Ha1NJh.js → progress-CbZ2D53A.js} +0 -0
  365. /package/dist/{prompt-style-Cm4wOtKm.js → prompt-style-D6u56SjJ.js} +0 -0
  366. /package/dist/{prompt-style-DQi8j03a.js → prompt-style-DKy6qQxR.js} +0 -0
  367. /package/dist/{prompts-BEHxUC3w.js → prompts-BI__va99.js} +0 -0
  368. /package/dist/{prompts-CSOhuiqe.js → prompts-_dDWkCAz.js} +0 -0
  369. /package/dist/{pw-ai-BWz3Cxt7.js → pw-ai-CbEgFH-G.js} +0 -0
  370. /package/dist/{qmd-manager-BcMeZiGD.js → qmd-manager-DPslO6i9.js} +0 -0
  371. /package/dist/{queue-BJGo7kAB.js → queue-D_u34pbL.js} +0 -0
  372. /package/dist/{queue-DYgUbdoq.js → queue-PG591iID.js} +0 -0
  373. /package/dist/{redact-CyKvdFrg.js → redact-ClVwO7Nn.js} +0 -0
  374. /package/dist/{registry-C5MAYD4V.js → registry-Bs_DJK9E.js} +0 -0
  375. /package/dist/{registry-CRrXXVs0.js → registry-D_zlP1U-.js} +0 -0
  376. /package/dist/{requirements-CGkxTCu4.js → requirements-BzZxj2Wu.js} +0 -0
  377. /package/dist/{requirements-CIDaOcbO.js → requirements-DIW1svgA.js} +0 -0
  378. /package/dist/{rpc-DgE-xnyx.js → rpc-aBUUQWC3.js} +0 -0
  379. /package/dist/{runtime-guard-nL3Lp8T-.js → runtime-guard-DeOXA_86.js} +0 -0
  380. /package/dist/{secret-equal-DJpmLXlG.js → secret-equal-Dghy3xsA.js} +0 -0
  381. /package/dist/{send-CTcxgDDU.js → send-BhAfdGII.js} +0 -0
  382. /package/dist/{send-DZQTaG7-.js → send-C2t9xpXI.js} +0 -0
  383. /package/dist/{send-VDff2gra.js → send-DigO-i9j.js} +0 -0
  384. /package/dist/{send-bgQNV8d1.js → send-Dz2BDHll.js} +0 -0
  385. /package/dist/{send-DPezUR3-.js → send-ga9udK1_.js} +0 -0
  386. /package/dist/{session-key-CQT-NR6w.js → session-key-BGiG_JcT.js} +0 -0
  387. /package/dist/{shared-DxNHzky3.js → shared-DwguvoZP.js} +0 -0
  388. /package/dist/{shell-argv-n9IueeJQ.js → shell-argv-CAq1mLa2.js} +0 -0
  389. /package/dist/{skill-scanner-o6NgVMD9.js → skill-scanner-Coo4QoCd.js} +0 -0
  390. /package/dist/{status-C53kTIXF.js → status-CMnlcBVc.js} +0 -0
  391. /package/dist/{status-CZDDA_Sy.js → status-tDZPwewW.js} +0 -0
  392. /package/dist/{system-run-command-CqAqKL9K.js → system-run-command-DGk7dwQP.js} +0 -0
  393. /package/dist/{system-run-command-BCjUffN9.js → system-run-command-X9lDJIy0.js} +0 -0
  394. /package/dist/{systemd-B43AvOGx.js → systemd-BVVNFIBH.js} +0 -0
  395. /package/dist/{systemd-hints-DMJT-Bbc.js → systemd-hints-Mpt5QteE.js} +0 -0
  396. /package/dist/{table-bWCLW-3P.js → table-B_wVcaLO.js} +0 -0
  397. /package/dist/{tailnet-Ciwjv243.js → tailnet-CuiNECdL.js} +0 -0
  398. /package/dist/{templates-37RKpACb.js → templates-CeYJjVzw.js} +0 -0
  399. /package/dist/{templates-DPalk30o.js → templates-I3Z0xplD.js} +0 -0
  400. /package/dist/{thinking-2hxwmvTl.js → thinking-BXEswx1X.js} +0 -0
  401. /package/dist/{transcript-events-Bp7fGnwv.js → transcript-events-C1hdue6u.js} +0 -0
  402. /package/dist/{transcript-tools-D4Lbxlka.js → transcript-tools-DuyYOkUq.js} +0 -0
  403. /package/dist/{tui-BHgBWhHE.js → tui-r0_5VL_h.js} +0 -0
  404. /package/dist/{update-check-Bt1dVPVN.js → update-check-DlDloai0.js} +0 -0
  405. /package/dist/{usage-format-6Uar63S0.js → usage-format-BAirWUSO.js} +0 -0
  406. /package/dist/{utils-DT8uXjFS.js → utils-C9sj30YY.js} +0 -0
  407. /package/dist/{whatsapp-actions-hgYA12To.js → whatsapp-actions-DsoA_Bad.js} +0 -0
  408. /package/dist/{widearea-dns-BeIdnISJ.js → widearea-dns-1txrPZ0I.js} +0 -0
  409. /package/dist/{ws-log-xF0kxDzp.js → ws-log-BffL5dN_.js} +0 -0
  410. /package/dist/{wsl-CrPvx2kZ.js → wsl-CqyuRvtM.js} +0 -0
  411. /package/dist/{wsl-UvJ5dHah.js → wsl-ymJYvc9Q.js} +0 -0
@@ -1,929 +0,0 @@
1
- import { EventEmitter } from "events";
2
- import { execFile, spawn } from "child_process";
3
- import * as fs from "fs";
4
- import * as path from "path";
5
- import { fileURLToPath } from "url";
6
- import * as os from "os";
7
- import * as crypto from "crypto";
8
-
9
- //#region node_modules/.pnpm/file+..+svrn-node_typescript@5.9.3_zod@4.3.6/node_modules/@noxsoft/svrn-node/dist/index.js
10
- var ALL_TASK_TYPES = [
11
- "ping",
12
- "relay",
13
- "compute",
14
- "store",
15
- "validate"
16
- ];
17
- var DEFAULT_CONFIG = {
18
- enabled: true,
19
- dataDir: getDefaultDataDir(),
20
- coordinatorUrl: "https://svrn.noxsoft.net",
21
- resources: {
22
- maxCpuPercent: 50,
23
- maxRamMB: 512,
24
- maxBandwidthMbps: 10,
25
- maxDiskGB: 5
26
- },
27
- taskTypes: [...ALL_TASK_TYPES],
28
- autoUpdate: {
29
- enabled: true,
30
- checkIntervalHours: 6,
31
- autoRestart: true,
32
- channel: "stable"
33
- },
34
- heartbeatIntervalSec: 30,
35
- showEarnings: true
36
- };
37
- function getDefaultDataDir() {
38
- return `${process.env["HOME"] || process.env["USERPROFILE"] || "/tmp"}/.svrn-node`;
39
- }
40
- function resolveConfig(partial) {
41
- if (!partial) return { ...DEFAULT_CONFIG };
42
- return {
43
- ...DEFAULT_CONFIG,
44
- ...partial,
45
- resources: {
46
- ...DEFAULT_CONFIG.resources,
47
- ...partial.resources ?? {}
48
- },
49
- autoUpdate: {
50
- ...DEFAULT_CONFIG.autoUpdate,
51
- ...partial.autoUpdate ?? {}
52
- },
53
- taskTypes: partial.taskTypes ?? [...ALL_TASK_TYPES]
54
- };
55
- }
56
- var PACKAGE_NAME = "@noxsoft/svrn-node";
57
- var REGISTRY_BASE = "https://registry.npmjs.org";
58
- var AutoUpdater = class extends EventEmitter {
59
- config;
60
- currentVersion;
61
- checkTimer = null;
62
- logFile;
63
- checking = false;
64
- constructor(config, dataDir) {
65
- super();
66
- this.config = config;
67
- this.currentVersion = this.readCurrentVersion();
68
- this.logFile = path.join(dataDir, "updates.log");
69
- fs.mkdirSync(dataDir, { recursive: true });
70
- }
71
- /** Start the periodic update check loop. */
72
- start() {
73
- if (!this.config.enabled) return;
74
- this.check();
75
- const intervalMs = this.config.checkIntervalHours * 60 * 60 * 1e3;
76
- this.checkTimer = setInterval(() => void this.check(), intervalMs);
77
- }
78
- /** Stop the update check loop. */
79
- stop() {
80
- if (this.checkTimer) {
81
- clearInterval(this.checkTimer);
82
- this.checkTimer = null;
83
- }
84
- }
85
- /** Get the current installed version. */
86
- getVersion() {
87
- return this.currentVersion;
88
- }
89
- /** Manually trigger an update check. Returns info if update found, null otherwise. */
90
- async check() {
91
- if (this.checking) return null;
92
- this.checking = true;
93
- try {
94
- const tag = this.config.channel === "beta" ? "beta" : "latest";
95
- const latestVersion = await this.fetchLatestVersion(tag);
96
- if (!latestVersion) return null;
97
- if (this.isNewer(latestVersion, this.currentVersion)) {
98
- const info = {
99
- currentVersion: this.currentVersion,
100
- latestVersion,
101
- channel: this.config.channel,
102
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
103
- };
104
- this.emit("update-available", info);
105
- this.log(`Update available: ${this.currentVersion} -> ${latestVersion}`);
106
- if (this.config.autoRestart) {
107
- await this.installUpdate(latestVersion);
108
- this.log(`Update installed: ${latestVersion}`);
109
- this.emit("update-installed", info);
110
- this.restartProcess();
111
- }
112
- return info;
113
- }
114
- return null;
115
- } catch (error) {
116
- const msg = error instanceof Error ? error.message : String(error);
117
- this.log(`Update check failed: ${msg}`);
118
- this.emit("update-error", error);
119
- return null;
120
- } finally {
121
- this.checking = false;
122
- }
123
- }
124
- /**
125
- * Install a specific version and restart (for manual `svrn-node update`).
126
- * Returns the UpdateInfo if an update was installed, null if already current.
127
- */
128
- async installAndRestart() {
129
- const tag = this.config.channel === "beta" ? "beta" : "latest";
130
- const latestVersion = await this.fetchLatestVersion(tag);
131
- if (!latestVersion) {
132
- this.log("No version found on npm — package may not be published yet.");
133
- return null;
134
- }
135
- if (!this.isNewer(latestVersion, this.currentVersion)) return null;
136
- const info = {
137
- currentVersion: this.currentVersion,
138
- latestVersion,
139
- channel: this.config.channel,
140
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
141
- };
142
- await this.installUpdate(latestVersion);
143
- this.log(`Update installed: ${latestVersion}`);
144
- this.emit("update-installed", info);
145
- return info;
146
- }
147
- /**
148
- * Fetch the latest version from the npm registry HTTP API.
149
- * Uses simple fetch — no npm CLI needed for checking.
150
- *
151
- * For the 'stable' channel, fetches the 'latest' dist-tag.
152
- * For the 'beta' channel, fetches the 'beta' dist-tag.
153
- */
154
- async fetchLatestVersion(tag) {
155
- try {
156
- const url = `${REGISTRY_BASE}/${encodeURIComponent(PACKAGE_NAME)}/${tag}`;
157
- const response = await fetch(url, {
158
- headers: { Accept: "application/json" },
159
- signal: AbortSignal.timeout(15e3)
160
- });
161
- if (!response.ok) {
162
- if (response.status === 404) return null;
163
- return null;
164
- }
165
- return (await response.json()).version ?? null;
166
- } catch {
167
- return null;
168
- }
169
- }
170
- /** Install the specified version via npm. */
171
- installUpdate(version) {
172
- return new Promise((resolve, reject) => {
173
- const thisDir = path.dirname(fileURLToPath(import.meta.url));
174
- const isGlobal = thisDir.includes("/lib/node_modules/") || thisDir.includes("\\node_modules\\");
175
- execFile("npm", isGlobal ? [
176
- "install",
177
- "-g",
178
- `${PACKAGE_NAME}@${version}`
179
- ] : ["install", `${PACKAGE_NAME}@${version}`], {
180
- timeout: 12e4,
181
- cwd: isGlobal ? void 0 : this.findProjectRoot(thisDir) ?? void 0
182
- }, (error) => {
183
- if (error) {
184
- reject(/* @__PURE__ */ new Error(`Failed to install update: ${error.message}`));
185
- return;
186
- }
187
- resolve();
188
- });
189
- });
190
- }
191
- /**
192
- * Restart the process by exec-ing the svrn-node binary.
193
- * This replaces the current process entirely with the new version.
194
- */
195
- restartProcess() {
196
- this.log("Restarting with updated binary...");
197
- if (!process.argv[1]) {
198
- this.log("Cannot determine binary path for restart — manual restart required.");
199
- return;
200
- }
201
- const args = process.argv.slice(1);
202
- try {
203
- spawn(process.execPath, args, {
204
- detached: true,
205
- stdio: "inherit"
206
- }).unref();
207
- process.exit(0);
208
- } catch (error) {
209
- const msg = error instanceof Error ? error.message : String(error);
210
- this.log(`Restart failed: ${msg} \u2014 manual restart required.`);
211
- }
212
- }
213
- /** Read the current package version from package.json. */
214
- readCurrentVersion() {
215
- try {
216
- let dir = path.dirname(fileURLToPath(import.meta.url));
217
- for (let i = 0; i < 5; i++) {
218
- const pkgPath = path.join(dir, "package.json");
219
- if (fs.existsSync(pkgPath)) {
220
- const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
221
- if (pkg.name === PACKAGE_NAME) return pkg.version ?? "0.0.0";
222
- }
223
- dir = path.dirname(dir);
224
- }
225
- } catch {}
226
- return "0.0.0";
227
- }
228
- /** Compare semver strings. Returns true if `a` is newer than `b`. */
229
- isNewer(a, b) {
230
- const parse = (v) => v.replace(/[^0-9.]/g, "").split(".").map(Number);
231
- const [aMajor = 0, aMinor = 0, aPatch = 0] = parse(a);
232
- const [bMajor = 0, bMinor = 0, bPatch = 0] = parse(b);
233
- if (aMajor !== bMajor) return aMajor > bMajor;
234
- if (aMinor !== bMinor) return aMinor > bMinor;
235
- return aPatch > bPatch;
236
- }
237
- /** Find the nearest ancestor directory containing package.json. */
238
- findProjectRoot(startDir) {
239
- let dir = startDir;
240
- for (let i = 0; i < 10; i++) {
241
- const pkgPath = path.join(dir, "package.json");
242
- if (fs.existsSync(pkgPath)) {
243
- if (JSON.parse(fs.readFileSync(pkgPath, "utf-8")).name !== PACKAGE_NAME) return dir;
244
- }
245
- const parent = path.dirname(dir);
246
- if (parent === dir) break;
247
- dir = parent;
248
- }
249
- return null;
250
- }
251
- /** Append a log entry to the updates log file. */
252
- log(message) {
253
- const line = `[${(/* @__PURE__ */ new Date()).toISOString()}] ${message}
254
- `;
255
- try {
256
- fs.appendFileSync(this.logFile, line);
257
- } catch {}
258
- }
259
- };
260
- var UCU_TO_USD = .001;
261
- var EarningsTracker = class {
262
- ledgerFile;
263
- sessionStart;
264
- sessionEarnings = 0;
265
- sessionTasks = 0;
266
- allTimeEarnings = 0;
267
- allTimeTasks = 0;
268
- todayEarnings = 0;
269
- todayTasks = 0;
270
- todayDate;
271
- constructor(dataDir) {
272
- this.ledgerFile = path.join(dataDir, "earnings-ledger.jsonl");
273
- this.sessionStart = (/* @__PURE__ */ new Date()).toISOString();
274
- this.todayDate = this.utcDateString();
275
- fs.mkdirSync(dataDir, { recursive: true });
276
- this.loadHistorical();
277
- }
278
- /** Record earnings for a completed task. */
279
- record(taskType, taskId, amount, durationMs) {
280
- const entry = {
281
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
282
- taskType,
283
- taskId,
284
- amount,
285
- duration: durationMs
286
- };
287
- this.sessionEarnings += amount;
288
- this.sessionTasks += 1;
289
- this.allTimeEarnings += amount;
290
- this.allTimeTasks += 1;
291
- const today = this.utcDateString();
292
- if (today !== this.todayDate) {
293
- this.todayEarnings = 0;
294
- this.todayTasks = 0;
295
- this.todayDate = today;
296
- }
297
- this.todayEarnings += amount;
298
- this.todayTasks += 1;
299
- try {
300
- fs.appendFileSync(this.ledgerFile, JSON.stringify(entry) + "\n");
301
- } catch {}
302
- }
303
- /** Get a summary of earnings. */
304
- getSummary() {
305
- const today = this.utcDateString();
306
- if (today !== this.todayDate) {
307
- this.todayEarnings = 0;
308
- this.todayTasks = 0;
309
- this.todayDate = today;
310
- }
311
- const hoursToday = this.hoursSinceSessionStart();
312
- const hourlyRate = hoursToday > 0 ? this.sessionEarnings / hoursToday : 0;
313
- const estimatedMonthlyUCU = hourlyRate * 24 * 30;
314
- const estimatedAnnualUCU = hourlyRate * 24 * 365;
315
- return {
316
- session: round(this.sessionEarnings),
317
- today: round(this.todayEarnings),
318
- allTime: round(this.allTimeEarnings),
319
- tasksThisSession: this.sessionTasks,
320
- tasksToday: this.todayTasks,
321
- tasksAllTime: this.allTimeTasks,
322
- estimatedMonthlySavingsUSD: round(estimatedMonthlyUCU * UCU_TO_USD),
323
- estimatedAnnualSavingsUSD: round(estimatedAnnualUCU * UCU_TO_USD)
324
- };
325
- }
326
- /** Get raw ledger entries for a date range. */
327
- getLedger(fromDate, toDate) {
328
- if (!fs.existsSync(this.ledgerFile)) return [];
329
- const lines = fs.readFileSync(this.ledgerFile, "utf-8").trim().split("\n");
330
- const entries = [];
331
- for (const line of lines) {
332
- if (!line.trim()) continue;
333
- try {
334
- const entry = JSON.parse(line);
335
- if (fromDate && entry.timestamp < fromDate) continue;
336
- if (toDate && entry.timestamp > toDate) continue;
337
- entries.push(entry);
338
- } catch {}
339
- }
340
- return entries;
341
- }
342
- loadHistorical() {
343
- if (!fs.existsSync(this.ledgerFile)) return;
344
- const today = this.utcDateString();
345
- const lines = fs.readFileSync(this.ledgerFile, "utf-8").trim().split("\n");
346
- for (const line of lines) {
347
- if (!line.trim()) continue;
348
- try {
349
- const entry = JSON.parse(line);
350
- this.allTimeEarnings += entry.amount;
351
- this.allTimeTasks += 1;
352
- if (entry.timestamp.startsWith(today)) {
353
- this.todayEarnings += entry.amount;
354
- this.todayTasks += 1;
355
- }
356
- } catch {}
357
- }
358
- }
359
- utcDateString() {
360
- return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
361
- }
362
- hoursSinceSessionStart() {
363
- return (Date.now() - new Date(this.sessionStart).getTime()) / (1e3 * 60 * 60);
364
- }
365
- };
366
- function round(n, decimals = 4) {
367
- const factor = 10 ** decimals;
368
- return Math.round(n * factor) / factor;
369
- }
370
- var ResourceMonitor = class {
371
- limits;
372
- lastCpuInfo = null;
373
- lastCpuTime = 0;
374
- pollTimer = null;
375
- currentSnapshot;
376
- bytesTransferred = 0;
377
- lastBandwidthCheck = Date.now();
378
- constructor(limits) {
379
- this.limits = limits;
380
- this.currentSnapshot = {
381
- cpuPercent: 0,
382
- ramMB: 0,
383
- bandwidthMbps: 0,
384
- timestamp: Date.now()
385
- };
386
- }
387
- /** Start polling resource usage. */
388
- start(intervalMs = 2e3) {
389
- this.lastCpuInfo = os.cpus();
390
- this.lastCpuTime = Date.now();
391
- this.poll();
392
- this.pollTimer = setInterval(() => this.poll(), intervalMs);
393
- }
394
- /** Stop polling. */
395
- stop() {
396
- if (this.pollTimer) {
397
- clearInterval(this.pollTimer);
398
- this.pollTimer = null;
399
- }
400
- }
401
- /** Record bytes transferred for bandwidth estimation. */
402
- recordBytes(bytes) {
403
- this.bytesTransferred += bytes;
404
- }
405
- /** Get the latest resource snapshot. */
406
- getSnapshot() {
407
- return { ...this.currentSnapshot };
408
- }
409
- /** Check whether we have capacity to accept a new task. */
410
- hasCapacity() {
411
- const snap = this.currentSnapshot;
412
- return snap.cpuPercent < this.limits.maxCpuPercent && snap.ramMB < this.limits.maxRamMB && snap.bandwidthMbps < this.limits.maxBandwidthMbps;
413
- }
414
- /** Get the current resource limits. */
415
- getLimits() {
416
- return { ...this.limits };
417
- }
418
- /** Update limits at runtime (e.g. user changes config). */
419
- updateLimits(limits) {
420
- this.limits = {
421
- ...this.limits,
422
- ...limits
423
- };
424
- }
425
- poll() {
426
- const now = Date.now();
427
- const cpus2 = os.cpus();
428
- let cpuPercent = 0;
429
- if (this.lastCpuInfo && cpus2.length > 0) {
430
- let totalDiff = 0;
431
- let idleDiff = 0;
432
- for (let i = 0; i < cpus2.length; i++) {
433
- const prev = this.lastCpuInfo[i];
434
- const curr = cpus2[i];
435
- if (!prev || !curr) continue;
436
- const prevTotal = prev.times.user + prev.times.nice + prev.times.sys + prev.times.idle + prev.times.irq;
437
- const currTotal = curr.times.user + curr.times.nice + curr.times.sys + curr.times.idle + curr.times.irq;
438
- totalDiff += currTotal - prevTotal;
439
- idleDiff += curr.times.idle - prev.times.idle;
440
- }
441
- if (totalDiff > 0) cpuPercent = Math.round((totalDiff - idleDiff) / totalDiff * 100);
442
- }
443
- this.lastCpuInfo = cpus2;
444
- this.lastCpuTime = now;
445
- const ramMB = Math.round(process.memoryUsage.rss() / (1024 * 1024));
446
- const bwElapsed = (now - this.lastBandwidthCheck) / 1e3;
447
- let bandwidthMbps = 0;
448
- if (bwElapsed > 0) {
449
- bandwidthMbps = Math.round(this.bytesTransferred * 8 / (bwElapsed * 1e6) * 100) / 100;
450
- this.bytesTransferred = 0;
451
- this.lastBandwidthCheck = now;
452
- }
453
- this.currentSnapshot = {
454
- cpuPercent,
455
- ramMB,
456
- bandwidthMbps,
457
- timestamp: now
458
- };
459
- }
460
- };
461
- var TaskProcessor = class {
462
- monitor;
463
- activeTasks = /* @__PURE__ */ new Map();
464
- signFn;
465
- constructor(monitor, signFn) {
466
- this.monitor = monitor;
467
- this.signFn = signFn;
468
- }
469
- /** Check whether the node can accept a task right now. */
470
- canAccept(task) {
471
- if (!this.monitor.hasCapacity()) return false;
472
- if (Date.now() > task.deadline) return false;
473
- if (this.activeTasks.size >= 5) return false;
474
- return true;
475
- }
476
- /** Process a task and return the result. */
477
- async process(task) {
478
- this.activeTasks.set(task.id, task);
479
- const start = Date.now();
480
- try {
481
- let output;
482
- switch (task.payload.kind) {
483
- case "ping":
484
- output = await this.processPing(task.payload);
485
- break;
486
- case "relay":
487
- output = await this.processRelay(task.payload);
488
- break;
489
- case "compute":
490
- output = await this.processCompute(task.payload);
491
- break;
492
- case "store":
493
- output = await this.processStore(task.payload);
494
- break;
495
- case "validate":
496
- output = this.processValidate(task.payload);
497
- break;
498
- default: throw new Error(`Unknown task type: ${task.payload.kind}`);
499
- }
500
- const durationMs = Date.now() - start;
501
- const proof = this.generateProof(task.id, output, durationMs);
502
- return {
503
- taskId: task.id,
504
- success: true,
505
- output,
506
- durationMs,
507
- proof
508
- };
509
- } catch (error) {
510
- const durationMs = Date.now() - start;
511
- return {
512
- taskId: task.id,
513
- success: false,
514
- output: error instanceof Error ? error.message : "Unknown error",
515
- durationMs,
516
- proof: ""
517
- };
518
- } finally {
519
- this.activeTasks.delete(task.id);
520
- }
521
- }
522
- /** Get number of currently active tasks. */
523
- getActiveCount() {
524
- return this.activeTasks.size;
525
- }
526
- async processPing(payload) {
527
- const start = Date.now();
528
- try {
529
- const response = await fetch(payload.target, {
530
- method: "HEAD",
531
- signal: AbortSignal.timeout(1e4)
532
- });
533
- const latencyMs = Date.now() - start;
534
- const success = response.status === payload.expectedStatusCode;
535
- return JSON.stringify({
536
- status: response.status,
537
- latencyMs,
538
- success
539
- });
540
- } catch (error) {
541
- const latencyMs = Date.now() - start;
542
- return JSON.stringify({
543
- status: 0,
544
- latencyMs,
545
- success: false,
546
- error: error instanceof Error ? error.message : "timeout"
547
- });
548
- }
549
- }
550
- async processRelay(payload) {
551
- const sourceResp = await fetch(payload.sourceUrl, { signal: AbortSignal.timeout(3e4) });
552
- if (!sourceResp.ok) throw new Error(`Source fetch failed: ${sourceResp.status}`);
553
- const body = await sourceResp.arrayBuffer();
554
- this.monitor.recordBytes(body.byteLength);
555
- const destResp = await fetch(payload.destinationUrl, {
556
- method: "POST",
557
- body,
558
- signal: AbortSignal.timeout(3e4)
559
- });
560
- this.monitor.recordBytes(body.byteLength);
561
- return JSON.stringify({
562
- bytesRelayed: body.byteLength,
563
- destinationStatus: destResp.status,
564
- success: destResp.ok
565
- });
566
- }
567
- async processCompute(payload) {
568
- const timeoutMs = Math.min(payload.timeoutMs, 3e4);
569
- return new Promise((resolve, reject) => {
570
- const timer = setTimeout(() => {
571
- reject(/* @__PURE__ */ new Error("Compute task timed out"));
572
- }, timeoutMs);
573
- try {
574
- const hash = crypto.createHash("sha256").update(payload.workload).update(payload.input).digest("hex");
575
- clearTimeout(timer);
576
- resolve(JSON.stringify({
577
- resultHash: hash,
578
- inputLength: payload.input.length
579
- }));
580
- } catch (error) {
581
- clearTimeout(timer);
582
- reject(error);
583
- }
584
- });
585
- }
586
- async processStore(payload) {
587
- const data = Buffer.from(payload.data, "base64");
588
- const hash = crypto.createHash("sha256").update(data).digest("hex");
589
- this.monitor.recordBytes(data.byteLength);
590
- return JSON.stringify({
591
- chunkId: payload.chunkId,
592
- sizeBytes: data.byteLength,
593
- hash,
594
- ttlSec: payload.ttlSec,
595
- stored: true
596
- });
597
- }
598
- processValidate(payload) {
599
- const actualHash = crypto.createHash("sha256").update(payload.resultData).digest("hex");
600
- const valid = actualHash === payload.expectedHash;
601
- return JSON.stringify({
602
- resultId: payload.resultId,
603
- expectedHash: payload.expectedHash,
604
- actualHash,
605
- valid
606
- });
607
- }
608
- /** Generate a signed proof-of-work for the completed task. */
609
- generateProof(taskId, output, durationMs) {
610
- const proofData = `${taskId}:${crypto.createHash("sha256").update(output).digest("hex")}:${durationMs}`;
611
- return `${proofData}:${this.signFn(proofData).toString("base64")}`;
612
- }
613
- };
614
- var UCUWallet = class _UCUWallet {
615
- publicKey;
616
- privateKey;
617
- balance = 0;
618
- pendingBalance = 0;
619
- totalEarned = 0;
620
- lastPayout = null;
621
- stateFile;
622
- constructor(publicKey, privateKey, stateFile) {
623
- this.publicKey = publicKey;
624
- this.privateKey = privateKey;
625
- this.stateFile = stateFile;
626
- }
627
- /**
628
- * Load or create a wallet from the given data directory.
629
- * If a keypair exists on disk, it is loaded. Otherwise a new
630
- * Ed25519 keypair is generated and saved.
631
- */
632
- static async init(dataDir) {
633
- const keyFile = path.join(dataDir, "wallet.key");
634
- const stateFile = path.join(dataDir, "wallet.json");
635
- fs.mkdirSync(dataDir, { recursive: true });
636
- let publicKey;
637
- let privateKey;
638
- if (fs.existsSync(keyFile)) {
639
- const raw = fs.readFileSync(keyFile, "utf-8");
640
- const parsed = JSON.parse(raw);
641
- publicKey = parsed.publicKey;
642
- privateKey = crypto.createPrivateKey({
643
- key: Buffer.from(parsed.privateKey, "base64"),
644
- format: "der",
645
- type: "pkcs8"
646
- });
647
- } else {
648
- const pair = crypto.generateKeyPairSync("ed25519");
649
- const pubDer = pair.publicKey.export({
650
- type: "spki",
651
- format: "der"
652
- }).toString("base64");
653
- const privDer = pair.privateKey.export({
654
- type: "pkcs8",
655
- format: "der"
656
- }).toString("base64");
657
- publicKey = pubDer;
658
- privateKey = pair.privateKey;
659
- fs.writeFileSync(keyFile, JSON.stringify({
660
- publicKey: pubDer,
661
- privateKey: privDer
662
- }), { mode: 384 });
663
- }
664
- const wallet = new _UCUWallet(publicKey, privateKey, stateFile);
665
- if (fs.existsSync(stateFile)) try {
666
- const saved = JSON.parse(fs.readFileSync(stateFile, "utf-8"));
667
- wallet.balance = saved.balance ?? 0;
668
- wallet.pendingBalance = saved.pendingBalance ?? 0;
669
- wallet.totalEarned = saved.totalEarned ?? 0;
670
- wallet.lastPayout = saved.lastPayout ?? null;
671
- } catch {}
672
- return wallet;
673
- }
674
- /** Get the node's public key (base64 DER). */
675
- getPublicKey() {
676
- return this.publicKey;
677
- }
678
- /** Get a short node ID derived from the public key. */
679
- getNodeId() {
680
- return `svrn-${crypto.createHash("sha256").update(this.publicKey).digest("hex").slice(0, 12)}`;
681
- }
682
- /** Sign arbitrary data with the node's private key. */
683
- sign(data) {
684
- return crypto.sign(null, Buffer.from(data), this.privateKey);
685
- }
686
- /** Credit UCU for a completed task. */
687
- credit(amount) {
688
- this.balance += amount;
689
- this.totalEarned += amount;
690
- this.lastPayout = (/* @__PURE__ */ new Date()).toISOString();
691
- this.persist();
692
- }
693
- /** Move amount from balance to pending (e.g. withdrawal request). */
694
- reserve(amount) {
695
- if (amount > this.balance) return false;
696
- this.balance -= amount;
697
- this.pendingBalance += amount;
698
- this.persist();
699
- return true;
700
- }
701
- /** Confirm a pending withdrawal. */
702
- confirmWithdrawal(amount) {
703
- this.pendingBalance = Math.max(0, this.pendingBalance - amount);
704
- this.persist();
705
- }
706
- /** Get the current wallet state. */
707
- getState() {
708
- return {
709
- publicKey: this.publicKey,
710
- balance: this.balance,
711
- pendingBalance: this.pendingBalance,
712
- totalEarned: this.totalEarned,
713
- lastPayout: this.lastPayout
714
- };
715
- }
716
- /** Persist wallet state to disk. */
717
- persist() {
718
- try {
719
- fs.writeFileSync(this.stateFile, JSON.stringify({
720
- publicKey: this.publicKey,
721
- balance: this.balance,
722
- pendingBalance: this.pendingBalance,
723
- totalEarned: this.totalEarned,
724
- lastPayout: this.lastPayout
725
- }, null, 2));
726
- } catch {}
727
- }
728
- };
729
- var SVRNNode = class extends EventEmitter {
730
- config;
731
- state = "stopped";
732
- startTime = 0;
733
- wallet;
734
- monitor;
735
- processor;
736
- earnings;
737
- updater;
738
- heartbeatTimer = null;
739
- coordinatorConnected = false;
740
- constructor(config) {
741
- super();
742
- this.config = resolveConfig(config);
743
- }
744
- /** Start the SVRN node. */
745
- async start() {
746
- if (this.state !== "stopped") throw new Error(`Cannot start: node is ${this.state}`);
747
- this.state = "starting";
748
- this.emit("state-change", this.state);
749
- this.wallet = await UCUWallet.init(this.config.dataDir);
750
- this.monitor = new ResourceMonitor(this.config.resources);
751
- this.processor = new TaskProcessor(this.monitor, (data) => this.wallet.sign(data));
752
- this.earnings = new EarningsTracker(this.config.dataDir);
753
- this.updater = new AutoUpdater(this.config.autoUpdate, this.config.dataDir);
754
- this.updater.on("update-available", (info) => {
755
- this.emit("update-available", info);
756
- });
757
- this.updater.on("update-installed", (info) => {
758
- this.emit("update-installed", info);
759
- });
760
- this.monitor.start();
761
- this.updater.start();
762
- this.startHeartbeat();
763
- this.startTime = Date.now();
764
- this.state = "running";
765
- this.emit("state-change", this.state);
766
- this.emit("started", this.getNodeId());
767
- }
768
- /** Stop the SVRN node gracefully. */
769
- async stop() {
770
- if (this.state !== "running") return;
771
- this.state = "stopping";
772
- this.emit("state-change", this.state);
773
- if (this.heartbeatTimer) {
774
- clearInterval(this.heartbeatTimer);
775
- this.heartbeatTimer = null;
776
- }
777
- this.monitor.stop();
778
- this.updater.stop();
779
- await this.deregisterFromCoordinator().catch(() => {});
780
- this.state = "stopped";
781
- this.emit("state-change", this.state);
782
- this.emit("stopped");
783
- }
784
- /** Get the node's unique ID. */
785
- getNodeId() {
786
- return this.config.nodeId ?? this.wallet?.getNodeId() ?? "unknown";
787
- }
788
- /** Get the current node status. */
789
- getStatus() {
790
- const uptime = this.state === "running" ? Math.floor((Date.now() - this.startTime) / 1e3) : 0;
791
- return {
792
- state: this.state,
793
- nodeId: this.getNodeId(),
794
- uptime,
795
- resources: this.monitor?.getSnapshot() ?? {
796
- cpuPercent: 0,
797
- ramMB: 0,
798
- bandwidthMbps: 0,
799
- timestamp: Date.now()
800
- },
801
- earnings: this.earnings?.getSummary() ?? {
802
- session: 0,
803
- today: 0,
804
- allTime: 0,
805
- tasksThisSession: 0,
806
- tasksToday: 0,
807
- tasksAllTime: 0,
808
- estimatedMonthlySavingsUSD: 0,
809
- estimatedAnnualSavingsUSD: 0
810
- },
811
- wallet: this.wallet?.getState() ?? {
812
- publicKey: "",
813
- balance: 0,
814
- pendingBalance: 0,
815
- totalEarned: 0,
816
- lastPayout: null
817
- },
818
- activeTasks: this.processor?.getActiveCount() ?? 0,
819
- version: this.updater?.getVersion() ?? "0.0.0",
820
- connectedToCoordinator: this.coordinatorConnected
821
- };
822
- }
823
- /** Get earnings summary. */
824
- getEarnings() {
825
- return this.earnings.getSummary();
826
- }
827
- /** Get wallet state. */
828
- getWallet() {
829
- return this.wallet.getState();
830
- }
831
- /** Get resource snapshot. */
832
- getResources() {
833
- return this.monitor.getSnapshot();
834
- }
835
- /** Get the list of accepted task types. */
836
- getTaskTypes() {
837
- return [...this.config.taskTypes];
838
- }
839
- /** Manually trigger an update check. */
840
- async checkForUpdates() {
841
- return this.updater.check();
842
- }
843
- /** Submit a task to this node for processing. */
844
- async submitTask(task) {
845
- if (this.state !== "running") throw new Error("Node is not running");
846
- if (!this.processor.canAccept(task)) throw new Error("Node cannot accept task: at capacity or deadline passed");
847
- this.emit("task-received", task);
848
- const result = await this.processor.process(task);
849
- if (result.success) {
850
- this.wallet.credit(task.rewardUCU);
851
- this.earnings.record(task.type, task.id, task.rewardUCU, result.durationMs);
852
- this.emit("task-completed", result);
853
- } else this.emit("task-failed", result);
854
- return result;
855
- }
856
- startHeartbeat() {
857
- this.registerWithCoordinator();
858
- this.heartbeatTimer = setInterval(() => void this.sendHeartbeat(), this.config.heartbeatIntervalSec * 1e3);
859
- }
860
- async registerWithCoordinator() {
861
- try {
862
- const response = await fetch(`${this.config.coordinatorUrl}/api/nodes/register`, {
863
- method: "POST",
864
- headers: { "Content-Type": "application/json" },
865
- body: JSON.stringify({
866
- nodeId: this.getNodeId(),
867
- publicKey: this.wallet.getPublicKey(),
868
- capabilities: this.config.taskTypes,
869
- resources: this.monitor.getSnapshot(),
870
- version: this.updater.getVersion()
871
- }),
872
- signal: AbortSignal.timeout(1e4)
873
- });
874
- this.coordinatorConnected = response.ok;
875
- if (response.ok) this.emit("coordinator-connected");
876
- } catch {
877
- this.coordinatorConnected = false;
878
- }
879
- }
880
- async sendHeartbeat() {
881
- try {
882
- const response = await fetch(`${this.config.coordinatorUrl}/api/nodes/heartbeat`, {
883
- method: "POST",
884
- headers: { "Content-Type": "application/json" },
885
- body: JSON.stringify({
886
- nodeId: this.getNodeId(),
887
- resources: this.monitor.getSnapshot(),
888
- activeTasks: this.processor.getActiveCount(),
889
- earnings: this.earnings.getSummary()
890
- }),
891
- signal: AbortSignal.timeout(1e4)
892
- });
893
- const wasConnected = this.coordinatorConnected;
894
- this.coordinatorConnected = response.ok;
895
- if (!wasConnected && response.ok) this.emit("coordinator-connected");
896
- else if (wasConnected && !response.ok) this.emit("coordinator-disconnected");
897
- if (response.ok) {
898
- const data = await response.json();
899
- if (data.tasks && Array.isArray(data.tasks)) for (const task of data.tasks) this.submitTask(task);
900
- }
901
- } catch {
902
- if (this.coordinatorConnected) {
903
- this.coordinatorConnected = false;
904
- this.emit("coordinator-disconnected");
905
- }
906
- }
907
- }
908
- async deregisterFromCoordinator() {
909
- try {
910
- await fetch(`${this.config.coordinatorUrl}/api/nodes/deregister`, {
911
- method: "POST",
912
- headers: { "Content-Type": "application/json" },
913
- body: JSON.stringify({ nodeId: this.getNodeId() }),
914
- signal: AbortSignal.timeout(5e3)
915
- });
916
- } catch {}
917
- }
918
- };
919
- function createNode(config) {
920
- return new SVRNNode(config);
921
- }
922
- async function startNode(config) {
923
- const node = createNode(config);
924
- await node.start();
925
- return node;
926
- }
927
-
928
- //#endregion
929
- export { ALL_TASK_TYPES, AutoUpdater, DEFAULT_CONFIG, EarningsTracker, ResourceMonitor, SVRNNode, TaskProcessor, UCUWallet, createNode, resolveConfig, startNode };