@fased/fased 0.1.68 → 0.1.69

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 (103) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +20 -22
  3. package/config/sat-runtime.env +6 -2
  4. package/config/signer-protocol-v2.json +6 -0
  5. package/dist/agents/tools/wallet-action-tool.js +2 -0
  6. package/dist/agents/tools/wallet-tool.js +5 -3
  7. package/dist/brand.js +1 -1
  8. package/dist/build-info.json +3 -3
  9. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  10. package/dist/cli/program/register.wallet.js +88 -5
  11. package/dist/commands/wallet.js +842 -57
  12. package/dist/config/sat-runtime-ids.js +6 -1
  13. package/dist/control-ui/assets/{app-DyPTS0oM.js → app-BLFLoFPk.js} +8 -8
  14. package/dist/control-ui/assets/{federation-DgA9e-Pn.js → federation-SGMAnM_8.js} +2 -2
  15. package/dist/control-ui/assets/{index-Cu13yYHr.js → index-S88kp5ZQ.js} +3 -3
  16. package/dist/control-ui/assets/{mining-Dg-3ll0F.js → mining-ClI8RW4u.js} +2 -2
  17. package/dist/control-ui/assets/{wallet-ByKBcYhm.js → wallet-CRIhDQbW.js} +201 -116
  18. package/dist/control-ui/index.html +1 -1
  19. package/dist/control-ui/version.json +1 -1
  20. package/dist/gateway/server-http.js +46 -9
  21. package/dist/mining/mainnet-sync.js +67 -5
  22. package/dist/operator/operator-readiness.js +1 -1
  23. package/dist/plugin-sdk/{audio-preflight-_FVQjR1r.js → audio-preflight-CS7Q_7-R.js} +2 -2
  24. package/dist/plugin-sdk/channel-plugin-common.d.ts +2 -2
  25. package/dist/plugin-sdk/{chunk-items-LH4uKSnh.js → chunk-items-BLBZNORg.js} +1 -1
  26. package/dist/plugin-sdk/command-status.js +2 -2
  27. package/dist/plugin-sdk/{config-schema-DjU_uD-6.js → config-schema-BiBOUW89.js} +255 -47
  28. package/dist/plugin-sdk/device-pair.d.ts +1 -1
  29. package/dist/plugin-sdk/discord.d.ts +4 -4
  30. package/dist/plugin-sdk/index.d.ts +16 -16
  31. package/dist/plugin-sdk/index.js +2 -2
  32. package/dist/plugin-sdk/{monitor-DUMMbG4h.js → monitor-WXdn4mR-.js} +4 -4
  33. package/dist/plugin-sdk/{monitor-DXIM16Hj.js → monitor-xzVAPbg2.js} +6 -6
  34. package/dist/plugin-sdk/{openresponses-http-C8lKwta1.js → openresponses-http-DnI1LFgq.js} +2 -2
  35. package/dist/plugin-sdk/{pairing-message-mKO92L-M.d.ts → pairing-message-CiTcdD6m.d.ts} +1 -1
  36. package/dist/plugin-sdk/provider-web-search-config-contract.d.ts +1 -1
  37. package/dist/plugin-sdk/{pw-ai-DJ_gTc4M.js → pw-ai-DZYLDC-S.js} +1 -1
  38. package/dist/plugin-sdk/{runtime-dependency-nup8niQL.js → runtime-dependency-DczkvPxn.js} +9 -9
  39. package/dist/plugin-sdk/sat-runtime.d.ts +89 -10
  40. package/dist/plugin-sdk/sat-runtime.js +2 -2
  41. package/dist/plugin-sdk/{slack-B-nOOLM0.js → slack-CkIRVDUK.js} +4 -4
  42. package/dist/plugin-sdk/slack.d.ts +4 -4
  43. package/dist/plugin-sdk/{sticker-cache-BLiId8Em.js → sticker-cache-Dpap5ce_.js} +2 -2
  44. package/dist/plugin-sdk/{telegram-actions-1X9A32Dn.js → telegram-actions-Cewdga8H.js} +3 -3
  45. package/dist/plugin-sdk/telegram.d.ts +4 -4
  46. package/dist/plugin-sdk/{tmp-fased-dir-BkpWlGUe.d.ts → tmp-fased-dir-BSEHc8MQ.d.ts} +2 -2
  47. package/dist/plugin-sdk/{types-DtCOO_hW.d.ts → types-BakzIzGN.d.ts} +1 -1
  48. package/dist/plugin-sdk/{types-B-zL9gSv.d.ts → types-CzF0YQqK.d.ts} +2 -2
  49. package/dist/plugin-sdk/{web-BvjNyYBz.js → web-DGWi7i3B.js} +2 -2
  50. package/dist/plugin-sdk/whatsapp.d.ts +9 -9
  51. package/dist/plugin-sdk/{zod-schema.providers-core-BCDlgtls.d.ts → zod-schema.providers-core-CIzCjXH9.d.ts} +63 -63
  52. package/dist/wallet/local-socket-signer-lifecycle.js +79 -3
  53. package/dist/wallet/local-socket-signer-protocol.js +70 -10
  54. package/dist/wallet/mining-wallet-retirement.js +256 -0
  55. package/dist/wallet/providers/local-socket-signer-adapter.js +2 -0
  56. package/dist/wallet/signer-protocol-v2.generated.js +6 -0
  57. package/dist/wallet/wallet-agent-selection.js +6 -10
  58. package/dist/wallet/wallet-provider-registry.js +70 -29
  59. package/dist/wallet/wallet-send-approvals.js +6 -2
  60. package/dist/wallet/wallet-status.js +56 -1
  61. package/dist/wizard/onboarding.js +32 -30
  62. package/dist/wizard/onboarding.wallet.js +10 -1
  63. package/extensions/acpx/package.json +1 -1
  64. package/extensions/bluebubbles/package.json +1 -1
  65. package/extensions/copilot-proxy/package.json +1 -1
  66. package/extensions/diagnostics-otel/package.json +1 -1
  67. package/extensions/fased-federation/package.json +1 -1
  68. package/extensions/google-gemini-cli-auth/package.json +1 -1
  69. package/extensions/imessage/package.json +1 -1
  70. package/extensions/irc/package.json +1 -1
  71. package/extensions/line/package.json +1 -1
  72. package/extensions/llm-task/package.json +1 -1
  73. package/extensions/lobster/package.json +1 -1
  74. package/extensions/matrix/CHANGELOG.md +6 -0
  75. package/extensions/matrix/package.json +1 -1
  76. package/extensions/mattermost/package.json +1 -1
  77. package/extensions/memory-core/package.json +2 -2
  78. package/extensions/memory-lancedb/package.json +1 -1
  79. package/extensions/minimax-portal-auth/package.json +1 -1
  80. package/extensions/msteams/CHANGELOG.md +6 -0
  81. package/extensions/msteams/package.json +1 -1
  82. package/extensions/nextcloud-talk/package.json +1 -1
  83. package/extensions/nostr/CHANGELOG.md +6 -0
  84. package/extensions/nostr/package.json +1 -1
  85. package/extensions/open-prose/package.json +1 -1
  86. package/extensions/sat-mining/package.json +1 -1
  87. package/extensions/signal/package.json +1 -1
  88. package/extensions/synology-chat/package.json +1 -1
  89. package/extensions/tlon/package.json +1 -1
  90. package/extensions/twitch/CHANGELOG.md +6 -0
  91. package/extensions/twitch/package.json +1 -1
  92. package/extensions/voice-call/CHANGELOG.md +6 -0
  93. package/extensions/voice-call/package.json +1 -1
  94. package/extensions/zalo/CHANGELOG.md +6 -0
  95. package/extensions/zalo/package.json +1 -1
  96. package/extensions/zalouser/CHANGELOG.md +6 -0
  97. package/extensions/zalouser/package.json +1 -1
  98. package/install.sh +276 -103
  99. package/package.json +4 -3
  100. package/scripts/install-fased-signerd.sh +4 -8
  101. package/scripts/install-runtime-profile.sh +27 -0
  102. package/scripts/start-managed.sh +13 -1
  103. package/scripts/fased-signer-wallet-import-hosting.sh +0 -78
@@ -1,4 +1,4 @@
1
- import{a as e,r as t,t as n}from"./icons-D3-vEvih.js";import{c as r,d as i,i as a,l as o,n as s,o as c,r as l,s as u,t as d}from"./marketplace-order-evidence-DkR0ZRHa.js";import{n as f}from"./task-ledger-source-route-C-yTp0QU.js";function p(e,t){let n=String(t??``).trim();if(n)return(e??[]).find(e=>e.id===n)}function m(e){let t=(typeof e?.metadata?.purpose==`string`?e.metadata.purpose:typeof e?.metadata?.role==`string`?e.metadata.role:``).trim().toLowerCase();return t===`agent`||t===`vault`||t===`mining`?t:void 0}function h(e){let t=e.walletStatus?.approvalAuth?.passkeyCount??0,n=e.walletStatus?.approvalAuth?.mode??`none`,r=e.walletStatus?.approvalAuth?.ready??!1,i=String(e.defaultWalletId??``).trim()||null,a=p(e.walletNamedWallets,i),o=a&&m(a)!==`vault`?a:void 0,s=(e.walletNamedWallets??[]).find(e=>m(e)===`agent`),c=o??s,l=String(e.miningAttachedWalletId??``).trim()||null,u=p(e.walletNamedWallets,l),d=String(e.federationBondWalletId??``).trim()||null,f=p(e.walletNamedWallets,d)??(e.walletNamedWallets??[]).find(e=>m(e)===`vault`&&e.id!==l),h=e.joined===!0,g=e.trustState??`pending`,_=e.hostedState??`disabled`,ee=String(e.publicUrl??``).trim(),v=!!l&&!!c&&String(c?.id??``).trim()!==l,y=c&&u&&c.id===u.id?`Agent and Mining wallets must stay separate. They currently share one wallet, so switch the Agent wallet or reattach Mining to another wallet first.`:null;return[e.walletStatus?n===`webauthn`&&r?{title:`Wallet Control Passkey ready`,summary:t>0?`Passkey approval ready (${t})`:`Passkey approval ready`,detail:`Use this passkey for send approvals, policy changes, wallet security setup, unlock, recovery, and device changes.`,tone:`success`}:n===`webauthn`?{title:`Wallet Control Passkey ready`,summary:`Passkey setup incomplete`,detail:`Control operations are available, but finish passkey approval before trusting higher-risk wallet automation.`,tone:`warn`}:{title:`Wallet Control Passkey ready`,summary:`Session-based control path`,detail:`Control operations currently rely on the signed-in session. Add Wallet Control Passkey before enabling wallet security.`,tone:`warn`}:{title:`Wallet Control Passkey ready`,summary:`Wallet control state unavailable`,detail:`Refresh the wallet surface before changing operator roles.`,tone:`neutral`},c?{title:`Agent wallet set`,summary:o&&s&&o.id!==s.id?`${o.name} · ${s.name}`:c.name,detail:o?`This primary Agent wallet handles paid A2A sends, payment evidence publication, skill/plugin wallet actions, and routine transfers when no explicit @wallet handle is supplied.`:`This Agent wallet can be selected by explicit @wallet handle. Set it as primary if it should be the fallback when no handle is supplied.`,tone:`success`}:i?{title:`Agent wallet set`,summary:i,detail:`An Agent wallet is configured but not present in this wallet list right now. Refresh or repair the registry before paid Fased Network or skill wallet work.`,tone:`warn`}:{title:`Agent wallet set`,summary:`Not set`,detail:`Pick one Agent wallet before paid Fased Network tasks, receipts, skill wallet actions, or routine sends use a clear wallet.`,tone:`warn`},l?y?{title:`Mining wallet separate`,summary:`Conflict`,detail:y,tone:`warn`}:u?{title:`Mining wallet separate`,summary:v?u.name:`Attached`,detail:v?`Mining is attached to a dedicated wallet, separate from the Agent wallet.`:`Mining wallet is present but could not be compared against the Agent wallet yet.`,tone:v?`success`:`neutral`}:{title:`Mining wallet separate`,summary:l,detail:`SAT runtime points at a wallet id that is not visible in the current wallet list. Refresh mining and wallet state before changing roles.`,tone:`warn`}:{title:`Mining wallet separate`,summary:`Optional and not configured`,detail:`Mining is optional. If you enable it later, create or import the singleton @wallet:mining wallet.`,tone:`neutral`},f?{title:`Vault wallet present`,summary:f.name,detail:`Use this as the manual-first destination for longer-term SAT/SOL storage and mining sweeps.`,tone:`success`}:{title:`Vault wallet present`,summary:`Not set`,detail:`Create or reserve a wallet that is not Agent or SAT Mining if you want a manual-first vault destination.`,tone:`neutral`},h?g===`verified`?{title:`Fased Network joined / trusted`,summary:`Verified`,detail:`This node is joined and currently trusted for normal Fased Network routing.`,tone:`success`}:{title:`Fased Network joined / trusted`,summary:g,detail:g===`pending`?`This node is joined, but Fased Network currently holds it in a manual or policy pending state.`:`This node is joined, but its trust state limits or blocks Fased Network use.`,tone:`warn`}:{title:`Fased Network joined / trusted`,summary:`Not joined`,detail:`Register a handle and attest this node before expecting Fased Network trust or remote task routing.`,tone:`warn`},_===`ready`&&ee?{title:`Fased Network reachability state`,summary:`Ready`,detail:`Public URL is issued: ${ee}`,tone:`success`}:_===`pending`?{title:`Fased Network reachability state`,summary:`Pending`,detail:`Hosted token state is present, but the public URL or hosted issuance is still pending.`,tone:`warn`}:{title:`Fased Network reachability state`,summary:_===`missing`?`Missing`:`Disabled`,detail:_===`missing`?`Fased Network reachability expects credentials or issued state, but they are missing on this node.`:`Fased Network reachability is optional and currently not enabled on this node.`,tone:_===`missing`?`warn`:`neutral`}]}function g(e){let t=e.status?.token??null,n=e.managedMode?t:e.token,r=n?.trustState??`pending`,i=n?.hostedState??`disabled`,a=String(n?.publicUrl??``).trim(),o=e.managedMode?e.status?.joined===!0&&!!t:!!e.token,s=String(e.miningAttachedWalletId||e.miningProfile?.walletId||e.miningStatus?.walletId||e.miningReadiness?.selectedWalletId||``).trim()||null;return h({walletStatus:e.walletStatus?{approvalAuth:{mode:e.walletStatus.approvalAuth?.mode,ready:e.walletStatus.approvalAuth?.ready,passkeyCount:e.walletStatus.approvalAuth?.passkeyCount}}:null,walletNamedWallets:e.walletNamedWallets.map(e=>({id:e.id,name:e.name})),defaultWalletId:e.defaultWalletId,miningAttachedWalletId:s,joined:o,trustState:r,hostedState:i,publicUrl:a}).map(e=>({...e,actionLabel:e.title===`Wallet Control Passkey ready`?`Open Wallet Access`:e.title===`Agent wallet set`?`Set Agent`:e.title===`Mining wallet separate`?`Open Mining`:e.title===`Fased Network joined / trusted`?`Open Fased Network review`:void 0,actionKey:e.title===`Wallet Control Passkey ready`?`admin`:e.title===`Agent wallet set`?`payment`:e.title===`Mining wallet separate`?`mining`:e.title===`Fased Network joined / trusted`?`federation-review`:void 0}))}var _=[`USDC`,`SOL`,`SAT`,`FCOD`],ee=[{value:`per-job`,label:`Per job`,description:`One fixed task or deliverable.`},{value:`per-hour`,label:`Per hour`,description:`Time-based human or hybrid service.`},{value:`per-api-call`,label:`Per API call`,description:`Metered API or tool access.`},{value:`per-1k-rows`,label:`Per 1k rows`,description:`Dataset, labeling, or enrichment volume.`},{value:`per-day`,label:`Per day`,description:`Daily feed, monitor, or recurring task.`},{value:`per-month`,label:`Per month`,description:`Subscription, hosting, or operator service.`},{value:`custom`,label:`Custom`,description:`Terms are explained in the listing.`}],v=[{value:`agent-approval`,label:`Agent + approval`,description:`Agent prepares/runs work under operator approval.`},{value:`agent`,label:`Agent automated`,description:`Agent delivers inside explicit automation policy.`},{value:`api`,label:`API`,description:`Buyer receives an API response, token, webhook, or metered endpoint.`},{value:`dataset`,label:`Dataset`,description:`Buyer receives rows, files, exports, labels, or artifacts.`},{value:`human`,label:`Human`,description:`Manual human service with marketplace receipt tracking.`},{value:`hybrid`,label:`Hybrid`,description:`Agent assists and human reviews before final delivery.`}],y=[{value:`agent-wallet`,label:`Agent wallet`,description:`Buyer pays from Agent wallet; seller settles to Agent wallet.`},{value:`escrow`,label:`Escrow`,description:`Future held payment before release after delivery.`},{value:`invoice`,label:`Invoice`,description:`Seller issues invoice and buyer records receipt.`},{value:`subscription`,label:`Subscription`,description:`Recurring access or feed billing.`},{value:`api-metered`,label:`Metered API`,description:`Usage-counted API or data service.`}],te=1e3*60*60*24*7;function b(e){let t=e?.trim()??``;if(!t)return!1;try{let e=new URL(t);return e.hostname===`127.0.0.1`||e.hostname===`localhost`||e.hostname===`::1`||e.hostname===`0.0.0.0`}catch{return!1}}function ne(e){let t=String(e.status??``).trim().toLowerCase();if(t!==`pending`&&t!==`unverified`||e.reviewedAt||e.reviewReason||!b(e.endpoint))return!1;let n=Date.parse(e.lastSeenAt??``);return Number.isFinite(n)?Date.now()-n>te:!1}function re(e){let t=Date.parse(e.reviewedAt??``);if(Number.isFinite(t))return t;let n=Date.parse(e.lastSeenAt??``);return Number.isFinite(n)?n:0}function x(e){let t=e?.hostedProbe;return!t||t.state!==`broken`?null:`Hosted public URL is broken right now${t.reason?`: ${t.reason}`:`.`}`}function ie(e){let t=String(e??``).trim();return/HTTP 5\d{2}\b/i.test(t)&&/\bfrom\b/i.test(t)}function ae(n){let r=n.reviewSummary,i=n.disputeSummary,a=n.sellerLane,o=T(n.offer),s=fe(n),c=ue(n.offer);return!a&&!r&&!i&&o===`Manual`&&!s&&!c?t:e`
1
+ import{a as e,r as t,t as n}from"./icons-D3-vEvih.js";import{c as r,d as i,i as a,l as o,n as s,o as c,r as l,s as u,t as d}from"./marketplace-order-evidence-DkR0ZRHa.js";import{n as f}from"./task-ledger-source-route-C-yTp0QU.js";function p(e,t){let n=String(t??``).trim();if(n)return(e??[]).find(e=>e.id===n)}function m(e){let t=(typeof e?.metadata?.purpose==`string`?e.metadata.purpose:typeof e?.metadata?.role==`string`?e.metadata.role:``).trim().toLowerCase();return t===`agent`||t===`vault`||t===`mining`?t:void 0}function h(e){let t=e.walletStatus?.approvalAuth?.passkeyCount??0,n=e.walletStatus?.approvalAuth?.mode??`none`,r=e.walletStatus?.approvalAuth?.ready??!1,i=String(e.defaultWalletId??``).trim()||null,a=p(e.walletNamedWallets,i),o=a&&m(a)!==`vault`?a:void 0,s=(e.walletNamedWallets??[]).find(e=>m(e)===`agent`),c=o??s,l=String(e.miningAttachedWalletId??``).trim()||null,u=p(e.walletNamedWallets,l),d=String(e.federationBondWalletId??``).trim()||null,f=p(e.walletNamedWallets,d)??(e.walletNamedWallets??[]).find(e=>m(e)===`vault`&&e.id!==l),h=e.joined===!0,g=e.trustState??`pending`,_=e.hostedState??`disabled`,ee=String(e.publicUrl??``).trim(),v=!!l&&!!c&&String(c?.id??``).trim()!==l,y=c&&u&&c.id===u.id?`Agent and Mining wallets must stay separate. They currently share one wallet, so switch the Agent wallet or reattach Mining to another wallet first.`:null;return[e.walletStatus?n===`webauthn`&&r?{title:`Wallet Control Passkey ready`,summary:t>0?`Passkey approval ready (${t})`:`Passkey approval ready`,detail:`Use this passkey for send approvals, policy changes, wallet security setup, unlock, recovery, and device changes.`,tone:`success`}:n===`webauthn`?{title:`Wallet Control Passkey ready`,summary:`Passkey setup incomplete`,detail:`Control operations are available, but finish passkey approval before trusting higher-risk wallet automation.`,tone:`warn`}:{title:`Wallet Control Passkey ready`,summary:`Session-based control path`,detail:`Control operations currently rely on the signed-in session. Add Wallet Control Passkey before enabling wallet security.`,tone:`warn`}:{title:`Wallet Control Passkey ready`,summary:`Wallet control state unavailable`,detail:`Refresh the wallet surface before changing operator roles.`,tone:`neutral`},c?{title:`Agent wallet set`,summary:o&&s&&o.id!==s.id?`${o.name} · ${s.name}`:c.name,detail:o?`This Default Agent wallet is the final fallback for paid A2A sends, payment evidence publication, skill/plugin wallet actions, and routine transfers after explicit, skill, and Agent assignment routing.`:`This Agent wallet can be selected explicitly or assigned to an Agent or skill. Set it as the optional fallback only when global fallback behavior is wanted.`,tone:`success`}:i?{title:`Agent wallet set`,summary:i,detail:`An Agent wallet is configured but not present in this wallet list right now. Refresh or repair the registry before paid Fased Network or skill wallet work.`,tone:`warn`}:{title:`Agent wallet set`,summary:`Not set`,detail:`Pick one Agent wallet before paid Fased Network tasks, receipts, skill wallet actions, or routine sends use a clear wallet.`,tone:`warn`},l?y?{title:`Mining wallet separate`,summary:`Conflict`,detail:y,tone:`warn`}:u?{title:`Mining wallet separate`,summary:v?u.name:`Attached`,detail:v?`Mining is attached to a dedicated wallet, separate from the Agent wallet.`:`Mining wallet is present but could not be compared against the Agent wallet yet.`,tone:v?`success`:`neutral`}:{title:`Mining wallet separate`,summary:l,detail:`SAT runtime points at a wallet id that is not visible in the current wallet list. Refresh mining and wallet state before changing roles.`,tone:`warn`}:{title:`Mining wallet separate`,summary:`Optional and not configured`,detail:`Mining is optional. If you enable it later, create or import the singleton @wallet:mining wallet.`,tone:`neutral`},f?{title:`Vault wallet present`,summary:f.name,detail:`Use this as the manual-first destination for longer-term SAT/SOL storage and mining sweeps.`,tone:`success`}:{title:`Vault wallet present`,summary:`Not set`,detail:`Create or reserve a wallet that is not Agent or SAT Mining if you want a manual-first vault destination.`,tone:`neutral`},h?g===`verified`?{title:`Fased Network joined / trusted`,summary:`Verified`,detail:`This node is joined and currently trusted for normal Fased Network routing.`,tone:`success`}:{title:`Fased Network joined / trusted`,summary:g,detail:g===`pending`?`This node is joined, but Fased Network currently holds it in a manual or policy pending state.`:`This node is joined, but its trust state limits or blocks Fased Network use.`,tone:`warn`}:{title:`Fased Network joined / trusted`,summary:`Not joined`,detail:`Register a handle and attest this node before expecting Fased Network trust or remote task routing.`,tone:`warn`},_===`ready`&&ee?{title:`Fased Network reachability state`,summary:`Ready`,detail:`Public URL is issued: ${ee}`,tone:`success`}:_===`pending`?{title:`Fased Network reachability state`,summary:`Pending`,detail:`Hosted token state is present, but the public URL or hosted issuance is still pending.`,tone:`warn`}:{title:`Fased Network reachability state`,summary:_===`missing`?`Missing`:`Disabled`,detail:_===`missing`?`Fased Network reachability expects credentials or issued state, but they are missing on this node.`:`Fased Network reachability is optional and currently not enabled on this node.`,tone:_===`missing`?`warn`:`neutral`}]}function g(e){let t=e.status?.token??null,n=e.managedMode?t:e.token,r=n?.trustState??`pending`,i=n?.hostedState??`disabled`,a=String(n?.publicUrl??``).trim(),o=e.managedMode?e.status?.joined===!0&&!!t:!!e.token,s=String(e.miningAttachedWalletId||e.miningProfile?.walletId||e.miningStatus?.walletId||e.miningReadiness?.selectedWalletId||``).trim()||null;return h({walletStatus:e.walletStatus?{approvalAuth:{mode:e.walletStatus.approvalAuth?.mode,ready:e.walletStatus.approvalAuth?.ready,passkeyCount:e.walletStatus.approvalAuth?.passkeyCount}}:null,walletNamedWallets:e.walletNamedWallets.map(e=>({id:e.id,name:e.name})),defaultWalletId:e.defaultWalletId,miningAttachedWalletId:s,joined:o,trustState:r,hostedState:i,publicUrl:a}).map(e=>({...e,actionLabel:e.title===`Wallet Control Passkey ready`?`Open Wallet Access`:e.title===`Agent wallet set`?`Set Agent`:e.title===`Mining wallet separate`?`Open Mining`:e.title===`Fased Network joined / trusted`?`Open Fased Network review`:void 0,actionKey:e.title===`Wallet Control Passkey ready`?`admin`:e.title===`Agent wallet set`?`payment`:e.title===`Mining wallet separate`?`mining`:e.title===`Fased Network joined / trusted`?`federation-review`:void 0}))}var _=[`USDC`,`SOL`,`SAT`,`FCOD`],ee=[{value:`per-job`,label:`Per job`,description:`One fixed task or deliverable.`},{value:`per-hour`,label:`Per hour`,description:`Time-based human or hybrid service.`},{value:`per-api-call`,label:`Per API call`,description:`Metered API or tool access.`},{value:`per-1k-rows`,label:`Per 1k rows`,description:`Dataset, labeling, or enrichment volume.`},{value:`per-day`,label:`Per day`,description:`Daily feed, monitor, or recurring task.`},{value:`per-month`,label:`Per month`,description:`Subscription, hosting, or operator service.`},{value:`custom`,label:`Custom`,description:`Terms are explained in the listing.`}],v=[{value:`agent-approval`,label:`Agent + approval`,description:`Agent prepares/runs work under operator approval.`},{value:`agent`,label:`Agent automated`,description:`Agent delivers inside explicit automation policy.`},{value:`api`,label:`API`,description:`Buyer receives an API response, token, webhook, or metered endpoint.`},{value:`dataset`,label:`Dataset`,description:`Buyer receives rows, files, exports, labels, or artifacts.`},{value:`human`,label:`Human`,description:`Manual human service with marketplace receipt tracking.`},{value:`hybrid`,label:`Hybrid`,description:`Agent assists and human reviews before final delivery.`}],y=[{value:`agent-wallet`,label:`Agent wallet`,description:`Buyer pays from Agent wallet; seller settles to Agent wallet.`},{value:`escrow`,label:`Escrow`,description:`Future held payment before release after delivery.`},{value:`invoice`,label:`Invoice`,description:`Seller issues invoice and buyer records receipt.`},{value:`subscription`,label:`Subscription`,description:`Recurring access or feed billing.`},{value:`api-metered`,label:`Metered API`,description:`Usage-counted API or data service.`}],te=1e3*60*60*24*7;function b(e){let t=e?.trim()??``;if(!t)return!1;try{let e=new URL(t);return e.hostname===`127.0.0.1`||e.hostname===`localhost`||e.hostname===`::1`||e.hostname===`0.0.0.0`}catch{return!1}}function ne(e){let t=String(e.status??``).trim().toLowerCase();if(t!==`pending`&&t!==`unverified`||e.reviewedAt||e.reviewReason||!b(e.endpoint))return!1;let n=Date.parse(e.lastSeenAt??``);return Number.isFinite(n)?Date.now()-n>te:!1}function re(e){let t=Date.parse(e.reviewedAt??``);if(Number.isFinite(t))return t;let n=Date.parse(e.lastSeenAt??``);return Number.isFinite(n)?n:0}function x(e){let t=e?.hostedProbe;return!t||t.state!==`broken`?null:`Hosted public URL is broken right now${t.reason?`: ${t.reason}`:`.`}`}function ie(e){let t=String(e??``).trim();return/HTTP 5\d{2}\b/i.test(t)&&/\bfrom\b/i.test(t)}function ae(n){let r=n.reviewSummary,i=n.disputeSummary,a=n.sellerLane,o=T(n.offer),s=fe(n),c=ue(n.offer);return!a&&!r&&!i&&o===`Manual`&&!s&&!c?t:e`
2
2
  <div class="chip-row" style="margin-top: 8px;">
3
3
  ${o===`Manual`?t:e`<span class="chip">Asset · ${o}</span>`}
4
4
  ${s?e`<span class="chip" title=${s}>Settlement · ${s}</span>`:t}
@@ -4322,4 +4322,4 @@ ${j}</pre
4322
4322
  </div>
4323
4323
  </section>
4324
4324
  `}export{N as buildMarketplaceOrderStatusHistory,g as describeOperatorReadiness,zt as renderFederation,De as resolveMarketplaceIndexOrderReview,Ee as resolveMarketplaceOrderDisputeHistory};
4325
- //# sourceMappingURL=federation-DgA9e-Pn.js.map
4325
+ //# sourceMappingURL=federation-SGMAnM_8.js.map
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./app-DyPTS0oM.js","./icons-D3-vEvih.js","./open-external-url-ulF1B-sA.js","./marketplace-order-evidence-DkR0ZRHa.js","./mining-commit-DFpB_4JN.js","./chat-model-ref-Djkv93yn.js","./task-ledger-source-route-C-yTp0QU.js","./wallet-policy-C3ZS66Rl.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./app-BLFLoFPk.js","./icons-D3-vEvih.js","./open-external-url-ulF1B-sA.js","./marketplace-order-evidence-DkR0ZRHa.js","./mining-commit-DFpB_4JN.js","./chat-model-ref-Djkv93yn.js","./task-ledger-source-route-C-yTp0QU.js","./wallet-policy-C3ZS66Rl.js"])))=>i.map(i=>d[i]);
2
2
  (function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e={"entry-loaded":10,"app-import-start":20,"app-imported":30,"custom-element-defined":40,connected:50,"first-updated":60,rendered:70,"boot-failed":100};function t(t,n){if(typeof window>`u`)return;let r=window.__FASED_CONTROL_UI_BOOT=window.__FASED_CONTROL_UI_BOOT??{},i=e[r.stage]??0;e[t]<i&&r.stage!==`boot-failed`||(r.stage=t,r.detail=n??``,r.updatedAt=Date.now(),typeof r.mark==`function`&&r.mark(t,n),typeof window.dispatchEvent==`function`&&typeof CustomEvent==`function`&&window.dispatchEvent(new CustomEvent(`fased-control-ui-boot`,{detail:{stage:t,detail:n??``}})))}var n=`modulepreload`,r=function(e,t){return new URL(e,t).href},i={},a=function(e,t,a){let o=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),s=document.querySelector(`meta[property=csp-nonce]`),c=s?.nonce||s?.getAttribute(`nonce`);function l(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function u(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,new URL(`../../../src/node/plugins/importAnalysisBuild.ts`,import.meta.url)).href}o=l(t.map(t=>{if(t=r(t,a),t=u(t),t in i)return;i[t]=!0;let o=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let r=e[n];if(r.href===t&&(!o||r.rel===`stylesheet`))return}let s=document.createElement(`link`);if(s.rel=o?`stylesheet`:n,o||(s.as=`script`),s.crossOrigin=``,s.href=t,c&&s.setAttribute(`nonce`,c),document.head.appendChild(s),o)return new Promise((e,n)=>{s.addEventListener(`load`,e),s.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function s(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return o.then(t=>{for(let e of t||[])e.status===`rejected`&&s(e.reason);return e().catch(s)})};function o(e){let n=e instanceof Error?e.stack??e.message:String(e);t(`boot-failed`,n||`Unknown dashboard boot error.`);let r=document.querySelector(`fased-app`);if(!r)return;r.innerHTML=``;let i=document.createElement(`style`);i.textContent=`
3
3
  body {
4
4
  margin: 0;
@@ -57,5 +57,5 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./app-DyPTS0oM.js","./
57
57
  font-weight: 650;
58
58
  cursor: pointer;
59
59
  }
60
- `;let a=document.createElement(`div`);a.className=`boot-page`;let o=document.createElement(`section`);o.className=`boot-card`;let s=document.createElement(`h1`);s.className=`boot-title`,s.textContent=`Dashboard bundle could not load`;let c=document.createElement(`p`);c.className=`boot-desc`,c.textContent=`The gateway page loaded, but the browser could not start the dashboard bundle. Reload first. If it keeps happening after an update, clear this site's browser data and sign in again.`;let l=document.createElement(`div`);l.className=`boot-error`,l.textContent=n||`Unknown dashboard boot error.`;let u=document.createElement(`button`);u.className=`boot-button`,u.textContent=`Reload`,u.addEventListener(`click`,()=>window.location.reload()),o.append(s,c,l,u),a.append(o),r.append(i,a)}t(`entry-loaded`),t(`app-import-start`),a(()=>import(`./app-DyPTS0oM.js`).then(()=>t(`app-imported`)),__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url).catch(o);export{t as n,a as t};
61
- //# sourceMappingURL=index-Cu13yYHr.js.map
60
+ `;let a=document.createElement(`div`);a.className=`boot-page`;let o=document.createElement(`section`);o.className=`boot-card`;let s=document.createElement(`h1`);s.className=`boot-title`,s.textContent=`Dashboard bundle could not load`;let c=document.createElement(`p`);c.className=`boot-desc`,c.textContent=`The gateway page loaded, but the browser could not start the dashboard bundle. Reload first. If it keeps happening after an update, clear this site's browser data and sign in again.`;let l=document.createElement(`div`);l.className=`boot-error`,l.textContent=n||`Unknown dashboard boot error.`;let u=document.createElement(`button`);u.className=`boot-button`,u.textContent=`Reload`,u.addEventListener(`click`,()=>window.location.reload()),o.append(s,c,l,u),a.append(o),r.append(i,a)}t(`entry-loaded`),t(`app-import-start`),a(()=>import(`./app-BLFLoFPk.js`).then(()=>t(`app-imported`)),__vite__mapDeps([0,1,2,3,4,5,6,7]),import.meta.url).catch(o);export{t as n,a as t};
61
+ //# sourceMappingURL=index-S88kp5ZQ.js.map
@@ -6,7 +6,7 @@ import{a as e,r as t,t as n}from"./icons-D3-vEvih.js";import{D as r,E as i,t as
6
6
  <path d="M12 17h.01" />
7
7
  </svg>
8
8
  </span>
9
- `}function d(e){return e?e.signerCapability===`background-ready`?{title:`Background-ready wallet`,detail:`This wallet is suitable for unattended SAT mining.`}:{title:`Interactive wallet`,detail:e.signerCapabilityReason??`This wallet may need operator approval for mining actions.`}:{title:`No wallet selected`,detail:`Create or import the dedicated Mining wallet in onboarding or with fased wallet setup --chain solana, then refresh.`}}function f(e){let t=String(e.attachedWalletId??``).trim(),n=String(e.status?.walletId??``).trim(),r=String(e.profile?.walletId??``).trim(),i=String(e.readiness?.selectedWalletId??``).trim(),a=e.wallets.find(e=>e.walletId===t),o=e.wallets.find(e=>e.walletId===n),s=e.wallets.find(e=>e.walletId===r),c=e.wallets.find(e=>e.walletId===i),l=a??o??s??c,u=!!n&&(!!e.status?.enabledWanted||!!e.status?.running||R(e.status?.currentCapitalFundedLamports)||(e.status?.recentActions?.length??0)>0||String(e.status?.validatorAuthority??``).trim().length>0),d=t||(n&&(u||n===r&&o)?n:``);return d?n&&n!==d?{attachedWallet:a,runtimeWallet:o,profileWallet:s,displayWallet:l,title:`Mining wallet state still settling`,detail:`Wallet registry and runtime status disagree. Refresh after the next SAT tick to confirm the singleton @wallet:mining history is live.`}:r&&r!==d?{attachedWallet:a,runtimeWallet:o,profileWallet:s,displayWallet:l,title:`Mining form differs from singleton wallet`,detail:`The mining form is still showing settings from another wallet. Save or refresh the profile if you want the form to match @wallet:mining.`}:{attachedWallet:a,runtimeWallet:o,profileWallet:s,displayWallet:l,title:`Singleton mining wallet`,detail:`SAT history, capital, and restart recovery follow @wallet:mining.`}:{attachedWallet:a,runtimeWallet:o,profileWallet:s,displayWallet:l,title:`Configure`,detail:``}}function p(e){let t=String(e.defaultWalletId??``).trim(),n=String(e.attachedWalletId||e.profile?.walletId||e.status?.walletId||e.readiness?.selectedWalletId||``).trim();return!t||!n||t!==n?null:{title:`Agent and Mining wallets must stay separate`,detail:`This singleton mining wallet is also the primary Agent wallet. Use Wallet to clear the Agent default, then select a dedicated Agent wallet before wallet work.`}}function m(e){return(e?.strategyExecution&&i(e.strategyMode)===e.strategyExecution?e.strategyExecution:i(e?.strategyMode))===`auto`?{title:`Auto strategy`,detail:`Auto strategy uses the Fased model/runtime stack to propose the cycle allocation and falls back to deterministic execution if the strategy step fails.`}:{title:`Deterministic strategy`,detail:`Deterministic strategy uses locked 25-bucket allocation arrays for the selected risk profile and does not require model inference.`}}function h(e){if(!e.length)return null;let t=e.reduce((e,t)=>({committedLamports:e.committedLamports+BigInt(t.committedLamports??`0`),totalSatEarnedRaw:e.totalSatEarnedRaw+BigInt(t.totalSatEarnedRaw??`0`),totalRebateLamports:e.totalRebateLamports+BigInt(t.totalRebateLamports??`0`),txFeeLamports:e.txFeeLamports+BigInt(t.txFeeLamports??`0`),netLiveCostLamports:e.netLiveCostLamports+BigInt(t.netLiveCostLamports??`0`),validParticipationCount:e.validParticipationCount+ +!!t.validParticipation}),{committedLamports:0n,totalSatEarnedRaw:0n,totalRebateLamports:0n,txFeeLamports:0n,netLiveCostLamports:0n,validParticipationCount:0}),n=BigInt(e.length);return{sampleCount:e.length,averageCommitLamports:(t.committedLamports/n).toString(),averageSatRaw:(t.totalSatEarnedRaw/n).toString(),averageRebateLamports:(t.totalRebateLamports/n).toString(),averageFeeLamports:(t.txFeeLamports/n).toString(),averageNetLiveCostLamports:(t.netLiveCostLamports/n).toString(),validRatePct:`${Math.round(t.validParticipationCount/e.length*100)}%`}}function g(e){let t=e.status?.lastStrategyDecision??null;return e.strategyExecution===`auto`?t?t.source===`skill`?{title:t.fallbackUsed?`Auto path with deterministic fallback`:`Auto path with model route`,detail:t.fallbackUsed?`The runtime attempted the model-guided path but fell back to deterministic execution for this cycle.`:`The runtime used the model-guided strategy path for this cycle.`,pathLabel:t.modelId?`Model route · ${t.modelId}`:`Model route`,fallbackLabel:t.fallbackUsed?`Fallback used`:`No fallback`}:{title:`Auto planner with deterministic strategy`,detail:`Auto sizing/planning is active, but the strategy engine resolved to the deterministic path for the latest cycle.`,pathLabel:`Deterministic strategy path`,fallbackLabel:`Planner only`}:{title:`Auto path waiting`,detail:`Auto mode is enabled. A live planner/strategy decision will appear once a cycle is evaluated.`,pathLabel:`No strategy decision yet`,fallbackLabel:`Pending`}:{title:`Deterministic path`,detail:`This run is using the locked deterministic allocation generator. No model step is required for cycle placement.`,pathLabel:`Deterministic engine`,fallbackLabel:`Not applicable`}}function _(e){let t=o(e?.riskMode??`balanced`);switch(e?.strategyPreset&&r(e.strategyPreset)===(e?.riskMode??`balanced`)?e.strategyPreset:t){case`spread`:return{title:`Spread profile`,detail:`Wider center-weighted coverage for steadier participation and lower concentration risk.`};case`conviction`:return{title:`Conviction profile`,detail:`Tighter concentration around strongest buckets for more variance and more upside if the read is right.`};case`top_k`:return{title:`Top-K Sparse profile`,detail:`High-conviction compiler that puts most weight into a few ranked buckets. Higher variance, stronger upside when the read is right.`};case`ranked`:return{title:`Ranked profile`,detail:`Compiler ranks buckets and converts the ranking into weighted exposure with a tail for safety.`};case`adaptive`:return{title:`Adaptive profile`,detail:`Compiler blends stable coverage with cycle-ranked opportunity so auto can improve without abandoning fallback safety.`};case`crowd_aware`:return{title:`Crowd-aware profile`,detail:`Compiler avoids over-concentrating in obvious buckets and keeps broader tail exposure when the cycle is crowded.`};case`safe_fallback`:return{title:`Safe fallback profile`,detail:`Balanced deterministic allocation for recovery, low confidence, or unstable recent results.`};case`swarm`:return{title:`Swarm profile`,detail:`Coordination-friendly clustered coverage that keeps the miner flexible without fully flattening conviction.`};default:return{title:`Balanced profile`,detail:`Moderate concentration with practical skill upside and less volatility than aggressive mode.`}}}function v(e){let t=BigInt(String(e?.currentCapitalLockedLamports??`0`)),n=Number(e?.currentCapitalPendingCycleCount??0);if(e?.drainOnly&&(t>0n||n>0))return`Clearing`;if(!e?.running)return t>0n||n>0?`Clearing`:`Stopped`;switch(e.nextAction){case`participation`:return`Round open`;case`mining-crank`:return`Settling round`;case`finalize-epoch`:return`Finalizing epoch`;case`claim`:return`Claiming rewards`;case`recover`:return`Blocked`;default:return`Watching for round`}}function y(e){return e?.role===`admin`}function b(e,t){let n=String(t??``).trim();if(!n)return null;let r=e===`devnet`?`devnet`:e===`local`?`custom`:`mainnet-beta`;return r===`custom`?null:r===`mainnet-beta`?`https://solscan.io/tx/${encodeURIComponent(n)}`:`https://solscan.io/tx/${encodeURIComponent(n)}?cluster=${r}`}function x(e,t){let n=String(t??``).trim();if(!n)return null;let r=e===`devnet`?`devnet`:e===`local`?`custom`:`mainnet-beta`;return r===`custom`?null:r===`mainnet-beta`?`https://solscan.io/account/${encodeURIComponent(n)}`:`https://solscan.io/account/${encodeURIComponent(n)}?cluster=${r}`}function S(e,t){return b(e,t)}function C(e){let t=String(e??``).trim();if(!t)return null;let n=new Date(t);return Number.isNaN(n.getTime())?t:n.toLocaleString()}function w(e){let{status:t,readiness:n}=e;if(t?.blocked)return{title:`Blocked`,detail:t.blockedReason||`Mining is blocked right now.`};let r=n?.checks.find(e=>e.key===`fundingReady`),i=n?.checks.find(e=>e.key===`cycleEntryReady`),a=n?.checks.find(e=>e.key===`minerInitialized`),o=BigInt(String(n?.stake?.rewardOwed??`0`)),s=BigInt(String(n?.stake?.slashPenaltyOwed??`0`)),c=BigInt(String(t?.currentCapitalLockedLamports??`0`)),l=BigInt(String(t?.currentCapitalFreeLamports??`0`)),u=Number(t?.currentCapitalPendingCycleCount??0),d=Number(t?.currentCapitalFirstPendingCycleId??0),f=Number(t?.currentCapitalLastPendingCycleId??0),p=String(r?.detail??``).trim().toLowerCase();if(r&&!r.ok)return p.includes(`probe unavailable`)?{title:`Wallet balance unavailable`,detail:`RPC could not confirm miner-wallet SOL right now. Retry in a few seconds.`}:{title:`Need SOL`,detail:`Fund the miner wallet with SOL before mining.`};if(a&&!a.ok){let e=String(a.detail??``).trim().toLowerCase();return e.includes(`owner mismatch`)||e.includes(`invalid owner`)?{title:`Capital account invalid`,detail:`This wallet's SAT miner capital account has the wrong owner on this machine. Repair the wallet-scoped capital account before funding or changing commit.`}:{title:`Need capital`,detail:`Fund Mining capital to create the miner account and deposit SOL.`}}return i&&!i.ok?c>0n&&l<250000000n?{title:`Capital locked`,detail:`Most miner capital is still locked in pending cycles, so free capital is below the 0.25 SOL entry minimum.${u>0&&d>0&&f>=d?d===f?` Pending cycle: ${d}.`:` Pending cycles: ${d}-${f}.`:``}`}:{title:`Need free capital`,detail:`Deposit at least 0.25 SOL of free miner capital to enter the next cycle.`}:s>0n?{title:`Slash penalty owed`,detail:o>0n?`Outstanding slash penalties must be settled before rewards can be claimed.`:`Outstanding slash penalties must be settled before mining proceeds cleanly.`}:t?.claimableSatRaw?{title:`Claimable SAT`,detail:`Rewards are available to claim.`}:t?.lastClaimTxHash?{title:`Claim already settled`,detail:`The latest reward claim already executed. Current claimable SAT is 0 until a later cycle earns more.`}:{title:`Mining active`,detail:`No SAT claim is available yet.`}}function ee(e){switch(e?.recommendedAction){case`resolve-dispute`:return{title:`Dismissed dispute path`,detail:`Resolve the active dispute first. If the dispute is dismissed, claims should unblock without corrected-root republish.`};case`republish-roots`:return{title:`Upheld dispute path`,detail:`This epoch needs corrected-root republish after the dispute outcome. Claims stay blocked until the replacement roots are submitted.`};case`retry-claim`:return{title:`Retry claim path`,detail:`Recovery conditions are satisfied. Retry the claim using the selected epoch and payout settings.`};case`wait`:return{title:`Wait path`,detail:`No admin action is recommended right now. Monitor epoch state and worker/runtime status for the next change.`};default:return{title:`No epoch recovery action required`,detail:`No dispute or epoch-admin recovery workflow is active. Capital-lock backlog, if any, is surfaced in the main mining status.`}}}function te(e,t){let n=String(e??``).trim();if(!n)return`0 ${t}`;try{let e=t===`SOL`?c:l,r=BigInt(n),i=r/10n**e,a=(r%10n**e).toString().padStart(Number(e),`0`).replace(/0+$/,``);return a?`${i}.${a} ${t}`:`${i} ${t}`}catch{return`${n} ${t}`}}function T(e){return e.replace(/\.0+$/,``).replace(/(\.\d*?)0+$/,`$1`)}function E(e,t){let n=String(e??``).trim();if(!n)return`0`;try{let e=t===`SOL`?c:l,r=Number(n)/10**Number(e);if(!Number.isFinite(r))return`0`;let i=Math.abs(r);return T(t===`SAT`?i>=1e3?r.toFixed(1):i>=1?r.toFixed(2):r.toFixed(3):i>=1||i>=.01?r.toFixed(3):r.toFixed(5))}catch{return n}}function D(e,t){let n=String(e??``).trim();if(!n)return`0`;try{let e=BigInt(n);return`${e>0n?`+`:e<0n?`-`:``}${E((e<0n?-e:e).toString(),t)}`}catch{return n}}function ne(e,t){let n=String(e??``).trim();return n?D(n,t):`—`}function re(e,t){let n=String(e??``).trim();return n?E(n,t):`—`}function O(e){try{return BigInt(String(e??`0`))}catch{return 0n}}function ie(e){return O(e.readiness?.balances.solBalanceLamports??e.selectedWallet?.solBalanceLamports??e.status?.currentSolBalanceLamports??`0`)}function k(e){switch(String(e??``).trim()){case`settleCyclePage`:case`finalizeCycleSettlement`:case`scoreCyclePage`:case`distributeCyclePage`:return!0;default:return!1}}function A(e){switch(String(e??``).trim()){case`settleCyclePage`:case`finalizeCycleSettlement`:case`scoreCyclePage`:case`distributeCyclePage`:return!0;default:return!1}}function j(e,t){if(!A(e))return!1;let n=String(t??``).trim().toLowerCase();return n.includes(`invalid progress`)||n.includes(`already closed`)||n.includes(`cycle already closed on-chain`)||n.includes(`invalid account data`)&&(n.includes(`settle invalid progress`)||n.includes(`score invalid progress`)||n.includes(`distribute invalid progress`))}function ae(e,t){let n=String(e??``).trim();if(!n)return`0 ${t}`;try{let e=BigInt(n);return`${e>0n?`+`:e<0n?`-`:``}${te((e<0n?-e:e).toString(),t)}`}catch{return`${n} ${t}`}}function oe(e){return``}function M(e){let t=[{label:`Commit`,value:`${E(e.committedLamports,`SOL`)} SOL`},{label:`Earned`,value:`${E(e.totalSatEarnedRaw,`SAT`)} SAT`},{label:`Rebate`,value:`${E(e.totalRebateLamports,`SOL`)} SOL`}],n=se(e.strategyPreset);n&&t.push({label:`Strategy`,value:n});let r=ce(e.strategyExecution);r&&t.push({label:`Execution`,value:r});let i=typeof e.committedMinerCount==`number`&&Number.isFinite(e.committedMinerCount)?e.committedMinerCount:typeof e.participantCount==`number`&&Number.isFinite(e.participantCount)?e.participantCount:null;return typeof i==`number`&&i>0&&t.push({label:`Pool`,value:`${i} miner${i===1?``:`s`}`}),t}function N(e){let{outcome:t,actions:n}=e,r=n.filter(e=>e.status===`success`&&A(e.action)).length,i=n.filter(e=>e.status===`failure`&&j(e.action,e.message)).length,a=[];if((r>0||i>0)&&(a.push({label:`Keeper won`,value:String(r)}),i>0&&a.push({label:`Keeper lost`,value:String(i)})),!t)return a;let o=(O(t.netLiveCostLamports)-O(t.txFeeLamports)+O(t.totalRebateLamports)+O(t.keeperBountyLamports)).toString();return a.push({label:`Erosion`,value:`${E(t.erosionLamports??o,`SOL`)} SOL`}),a.push({label:`Miner rebate`,value:`${E(t.totalRebateLamports,`SOL`)} SOL`}),t.keeperBountyLamports!=null&&a.push({label:`Keeper bounty`,value:`${E(t.keeperBountyLamports,`SOL`)} SOL`}),t.submitFeeLamports!=null&&a.push({label:`Submit fee`,value:`${E(t.submitFeeLamports,`SOL`)} SOL`}),t.keeperFeeLamports!=null&&a.push({label:`Keeper fees`,value:`${E(t.keeperFeeLamports,`SOL`)} SOL`}),t.claimFeeLamports!=null&&a.push({label:`Claim fee`,value:`${E(t.claimFeeLamports,`SOL`)} SOL`}),O(t.otherFeeLamports)>0n&&a.push({label:`Other tx`,value:`${E(t.otherFeeLamports,`SOL`)} SOL`}),a.push({label:`Net SOL`,value:`${D(t.netLiveCostLamports,`SOL`)} SOL`}),a}function se(e){switch(e){case`spread`:return`Spread`;case`balanced`:return`Balanced`;case`conviction`:return`Conviction`;case`swarm`:return`Swarm`;case`top_k`:return`Top-K`;case`ranked`:return`Ranked`;case`adaptive`:return`Adaptive`;case`crowd_aware`:return`Crowd-aware`;case`safe_fallback`:return`Safe fallback`;default:return null}}function P(e){return se(e.strategyPreset)||(e.riskMode?se(o(e.riskMode))??`Unrecorded`:`Unrecorded`)}function ce(e){return e===`auto`?`Auto`:e===`deterministic`?`Deterministic`:null}function F(e,t=1000000n,n=1){let r=String(e??``).trim();if(!r)return`—`;try{let e=BigInt(r),i=Number(e)/Number(t)*100;return Number.isFinite(i)?`${T(i.toFixed(n))}%`:`—`}catch{return`—`}}function I(e){return String(e??``).trim().length>0}function le(e,t=1000000n,n=1){return`${e<0n?`-`:e>0n?`+`:``}${F((e<0n?-e:e).toString(),t,n)}`}function L(e){let t=Number.isInteger(e)?String(e):T(e.toFixed(1));return`${t} miner${t===`1`?``:`s`}`}function ue(e){let t=e?.liveCycleReport??null;return!t||typeof t.cycleId!=`number`?null:{cycleId:t.cycleId,committedLabel:te(t.committedLamports,`SOL`),unlockRatioLabel:F(t.unlockRatioFp),issuedMinerSatLabel:me({value:t.issuedMinerSatRaw,cycleStatus:t.cycleStatus,counterpartValue:t.unissuedMinerSatRaw,compact:!1}),earnedSatLabel:te(t.totalSatEarnedRaw,`SAT`),netSolCostLabel:ae(t.netLiveCostLamports,`SOL`)}}function de(e){if(e==null)return null;let t=typeof e==`number`?Math.floor(e):Number.parseInt(String(e),10);return Number.isFinite(t)&&t>=0?t:null}function R(e){if(!e)return!1;try{return BigInt(e)>0n}catch{return!1}}function z(e){let t=O(e.committedLamports);if(t<=0n)return null;let n=O(String(e.requestedCommitLamports??`0`)),r=O(String(e.activeCommitLamports??`0`)),i=n>0n?n:r,a=O(String(e.minimumCommitLamports??`0`)),o=a>0n?a/2n:125000000n,s=O(e.previousCommittedLamports),c=O(String(e.capitalLockedLamports??`0`)),l=typeof e.pendingCycleCount==`number`&&Number.isFinite(e.pendingCycleCount)?e.pendingCycleCount:0,u=O(String(e.walletReserveShortfallLamports??`0`));return s>0n&&t>s+o&&c<=0n&&l<=0?{label:`Commit restored: capital unlocked`,title:`The latest submitted commit increased after pending/locked miner capital cleared back into free capital.`,tone:`success`}:i>0n&&t+o<i?c>0n||l>0?{label:`Commit reduced: locked capital clearing`,title:`The runtime submitted a smaller safe commit because previous-cycle capital is still locked until settlement and claim complete.`,tone:`warning`}:u>0n?{label:`Commit reduced: fee reserve`,title:`The runtime submitted a smaller safe commit because signer fee reserve was below target.`,tone:`warning`}:{label:`Commit reduced: free capital`,title:`The runtime submitted a smaller safe commit because currently free miner capital was below the saved target.`,tone:`warning`}:null}function fe(e){return e?.statusFresh===!1||e?.degraded===!0}function B(e){return e.readinessValue!=null&&(e.degraded||e.statusValue==null||e.statusValue===`0`)&&R(e.readinessValue)?e.readinessValue:e.statusValue??e.readinessValue??e.fallback??`0`}function pe(e){return e.degraded&&e.readinessValue?e.readinessValue:e.statusValue??e.readinessValue??null}function me(e){if((e.cycleStatus??null)!==2){let t=R(e.value),n=R(e.counterpartValue);if(!t&&!n)return`—`}return e.value==null?`—`:e.compact?E(e.value,`SAT`):te(e.value,`SAT`)}function he(e,t){let n=e?.liveCycleReport??null,r=typeof e?.currentCycleId==`number`?e.currentCycleId:typeof n?.cycleId==`number`?n.cycleId:null,i=n?.committedLamports??`0`,a=R(i),o=de(n?.validMinerCount),s=n?.totalCommittedLamports??(a?i:null),c=[{label:`Current cycle`,value:typeof r==`number`?String(r):`—`},{label:`Miners now`,value:o==null?`—`:`${o}`},{label:`SOL in cycle`,value:s==null?`—`:E(s,`SOL`)},{label:`Your commit`,value:a?E(i,`SOL`):`—`},{label:`Last payout (SAT)`,value:re(t?.satRaw??null,`SAT`)},{label:`Last net cost (SOL)`,value:ne(t?.netLamports??null,`SOL`)}];return R(e?.currentKeeperBountyUnpaidLamports)&&c.push({label:`Keeper bounty owed`,value:E(e?.currentKeeperBountyUnpaidLamports??`0`,`SOL`)}),c}function ge(e){let t=[{label:`Cycle`,value:e.cycleId==null?`—`:String(e.cycleId)},{label:`Your commit`,value:e.ownCommitPresent?`${E(e.ownCommitLamports,`SOL`)} SOL`:`—`},{label:`SOL in cycle`,value:e.totalCommittedLamports==null?`—`:`${E(e.totalCommittedLamports,`SOL`)} SOL`},{label:`Miners now`,value:e.minerCount==null?`pending`:String(e.minerCount)}];return R(e.keeperBountyUnpaidLamports)&&t.push({label:`Keeper bounty owed`,value:`${E(e.keeperBountyUnpaidLamports??`0`,`SOL`)} SOL`,title:`Keeper work completed for this cycle but not yet paid from the protocol reserve.`}),t}function _e(e){let t=typeof e?.latestSettledCycleId==`number`?e.latestSettledCycleId:null,n=e?.settledHistory??[];if(t!=null){let e=n.find(e=>e.cycleId===t);if(e)return{cycleId:t,satRaw:e.totalSatEarnedRaw??null,netLamports:e.netLiveCostLamports??null}}let r=n[0]??null;return{cycleId:typeof r?.cycleId==`number`?r.cycleId:null,satRaw:r?.totalSatEarnedRaw??null,netLamports:r?.netLiveCostLamports??null}}function ve(e){if(!e.length)return`—`;let t=[...e].filter(Number.isFinite).toSorted((e,t)=>e-t),n=t[0],r=t[t.length-1];return n===r?String(n):`${n}-${r}`}function ye(e){let t=typeof e?.missingCycleStartId==`number`?e.missingCycleStartId:null,n=typeof e?.missingCycleEndId==`number`?e.missingCycleEndId:null,r=typeof e?.missingCycleCount==`number`&&Number.isFinite(e.missingCycleCount)?e.missingCycleCount:0;if(r<=0||t==null||n==null||n<t)return null;let i=[typeof e?.latestSettledCycleId==`number`?e.latestSettledCycleId:null,typeof e?.latestSubmittedCycleId==`number`?e.latestSubmittedCycleId:null,(e?.pendingCycleIds??[]).reduce((e,t)=>typeof t==`number`&&Number.isFinite(t)&&(e==null||t>e)?t:e,null)].filter(e=>typeof e==`number`&&Number.isFinite(e)).reduce((e,t)=>e==null||t>e?t:e,null);return i!=null&&i>n?null:{startCycleId:t,endCycleId:n,count:r}}function be(e){let t=typeof e?.currentCycleId==`number`?e.currentCycleId:typeof e?.liveCycleReport?.cycleId==`number`?e.liveCycleReport.cycleId:null,n=typeof e?.latestSettledCycleId==`number`?e.latestSettledCycleId:null,r=typeof e?.latestSubmittedCycleId==`number`?e.latestSubmittedCycleId:null,i=typeof e?.exactPendingCycleId==`number`?e.exactPendingCycleId:null,a=String(e?.exactPendingStage??``).trim(),o=(e?.pendingCycleIds??[]).filter(e=>typeof e==`number`&&Number.isFinite(e)),s=ye(e),c=[];if(n!=null&&n!==t&&c.push(`Settled ${n}`),r!=null&&r!==t&&r!==n&&c.push(`Submitted ${r}`),o.length>0&&(i==null?c.push(`Pending ${ve(o)}`):c.push(`Pending ${i}${a?` (${a})`:``}`)),s){let t=e?.enabledWanted&&e.running&&!e.drainOnly?`Missed`:`Skipped`;c.push(`${t} ${s.startCycleId===s.endCycleId?s.startCycleId:`${s.startCycleId}-${s.endCycleId}`}`)}return c.length>0?c.join(` · `):null}function xe(e){if(!e?.enabledWanted||!e.running||!e.workers)return null;let t=new Date(e.snapshotAt??e.updatedAt??``).getTime();if(!Number.isFinite(t))return null;let n=[],r={roundWatcher:2e4,epoch:3e4,claim:4e4,recovery:5e4};for(let i of[`roundWatcher`,`epoch`,`claim`,`recovery`]){let a=e.workers[i];if(!a?.enabled)continue;let o=new Date(String(a.nextScheduledAt??``)).getTime(),s=new Date(String(a.lastRunAt??``)).getTime(),c=Number.isFinite(o)?t-o:Number.isFinite(s)?t-s:0;if(a.running||c<=r[i])continue;let l=[String(a.lastDetail??a.waitingReason??``).trim(),typeof a.lastSelectedCycleId==`number`?`cycle ${a.lastSelectedCycleId}${a.lastSelectedStage?` ${a.lastSelectedStage}`:``}`:``,(a.rpcTimeoutCount??0)>0?`${a.rpcTimeoutCount??0} timeout${a.rpcTimeoutCount===1?``:`s`}`:``].filter(Boolean).join(` · `);n.push(l?`${i} (${l})`:i)}return n.length>0?`Worker stale: ${n.join(` · `)}`:null}function Se(e){if(!e?.enabledWanted||!e.running)return null;let t=e.chainTime;if(!t||t.freshness===`fresh`||t.freshness===`stale`&&t.source!==`local-display`&&!t.lastError&&t.consecutiveFailures===0)return null;let n=t.source===`local-display`?`using local display time only`:t.lastError?t.lastError:`${t.consecutiveFailures} consecutive chain-time read failures`;return`Chain time ${t.freshness}: ${n}`}function Ce(e){let t=we(e.plannerWindow),n=e.rangeStart&&e.rangeEnd?`${e.rangeStart} to ${e.rangeEnd}`:null;return e.latestPoint?{summary:`${e.sampled?`Showing ${e.visibleCycleCount} sampled points from ${e.matchingCycleCount} completed cycles`:`Showing ${e.visibleCycleCount} completed cycles`} mined by this wallet in the ${t}${n?` · data present ${n}`:``}. Latest visible cycle ${e.latestPoint.cycleId} earned ${e.latestPoint.satLabel} SAT with ${e.latestPoint.netLabel} SOL net.`,windowLabel:t,dataRangeLabel:n}:{summary:`No completed cycles mined by this wallet were recorded in the ${t} yet.${e.currentCycleSubmitted&&typeof e.currentCycleId==`number`?` Current cycle ${e.currentCycleId} is already submitted and waiting for settlement, so it will not show here yet.`:``}`,windowLabel:t,dataRangeLabel:n}}function we(e){return e===`1h`?`last hour`:e===`24h`?`last 24 hours`:e===`30d`?`last 30 days`:e===`1y`?`last year`:`all recorded time`}function Te(e){return e===`1h`?3600*1e3:e===`24h`?1440*60*1e3:e===`30d`?720*60*60*1e3:e===`1y`?365*24*60*60*1e3:null}function Ee(e,t){if(e.length<=t)return e;let n=[],r=new Set;for(let i=0;i<t;i+=1){let a=Math.round(i*(e.length-1)/Math.max(1,t-1));r.has(a)||(r.add(a),n.push(e[a]))}return n}function De(e,t,n){if(!Number.isFinite(e)||!Number.isFinite(t)||!Number.isFinite(n)||t===n)return 50;let r=(e-t)/(n-t);return 100-Math.max(0,Math.min(100,r*100))}function Oe(e,t){let n=Array.isArray(e)?e.filter(e=>typeof e.cycleId==`number`):[];if(!n.length)return[];let r=n.slice().toSorted((e,t)=>Date.parse(String(e.recordedAt??``))-Date.parse(String(t.recordedAt??``))),i=typeof t?.maxPoints==`number`&&Number.isFinite(t.maxPoints)?Math.max(2,t.maxPoints):null,a=i==null?r:Ee(r,i),o=a.map(e=>Number(e.totalSatEarnedRaw??`0`)/10**Number(l)),s=a.map(e=>Number(e.netLiveCostLamports??`0`)/10**Number(c)),u=Math.min(...o),d=Math.max(...o),f=Math.min(...s),p=Math.max(...s);return a.map((e,t)=>{let n=o[t]??0,r=s[t]??0,i=ce(e.strategyExecution),c=P(e),l=typeof e.committedMinerCount!=`number`||!Number.isFinite(e.committedMinerCount)?null:`Pool: ${e.committedMinerCount} miner${e.committedMinerCount===1?``:`s`}`,m=(O(e.netLiveCostLamports)-O(e.txFeeLamports)+O(e.totalRebateLamports)+O(e.keeperBountyLamports)).toString();return{cycleId:e.cycleId,cycleLabel:String(e.cycleId).slice(-4),timeLabel:Ie(e.recordedAt),commitLabel:E(e.committedLamports,`SOL`),satLabel:E(e.totalSatEarnedRaw,`SAT`),netLabel:D(e.netLiveCostLamports,`SOL`),erosionLabel:E(e.erosionLamports??m,`SOL`),rebateLabel:E(e.totalRebateLamports,`SOL`),keeperBountyLabel:e.keeperBountyLamports==null?null:E(e.keeperBountyLamports,`SOL`),submitFeeLabel:e.submitFeeLamports==null?null:E(e.submitFeeLamports,`SOL`),keeperFeeLabel:e.keeperFeeLamports==null?null:E(e.keeperFeeLamports,`SOL`),claimFeeLabel:e.claimFeeLamports==null?null:E(e.claimFeeLamports,`SOL`),otherFeeLabel:O(e.otherFeeLamports)>0n?E(e.otherFeeLamports,`SOL`):null,strategyLabel:c,satValue:n,netValue:r,satY:De(n,u,d),netY:De(r,f,p),x:a.length===1?50:t/(a.length-1)*100,executionLabel:i??`—`,poolLabel:l}})}function ke(e,t){let n=Array.isArray(e)?e.filter(e=>typeof e.cycleId==`number`):[];if(!n.length)return null;let r=new Map,i=0n,a=0n,o=0n,s=0n,u=0,d=0,f=0n,p=0,m=0,h=0,g=0;for(let e of n){let t=P(e),n=r.get(t)??{strategyLabel:t,cycleCount:0,satRaw:0n,rebateLamports:0n,detRebateLamports:0n,perfRebateLamports:0n,detRebateSamples:0,perfRebateSamples:0,netLamports:0n,scoreDeltaFp:0n,skillScoreFp:0n,scoreSamples:0,crowdingRatioFp:0n,crowdingSamples:0,poolCount:0,poolSamples:0,autoCount:0,deterministicCount:0,taskCount:0,fallbackCount:0};n.cycleCount+=1;let c=O(e.totalSatEarnedRaw),l=O(e.totalRebateLamports),_=I(e.deterministicRebateLamports)||I(e.claimableDetRebateLamports)||I(e.claimedDetRebateLamports),v=I(e.performanceRebateLamports)||I(e.claimablePerfRebateLamports)||I(e.claimedPerfRebateLamports),y=I(e.deterministicRebateLamports)?O(e.deterministicRebateLamports):O(e.claimableDetRebateLamports)+O(e.claimedDetRebateLamports),b=I(e.performanceRebateLamports)?O(e.performanceRebateLamports):O(e.claimablePerfRebateLamports)+O(e.claimedPerfRebateLamports),x=O(e.netLiveCostLamports);n.satRaw+=c,n.rebateLamports+=l,_&&(n.detRebateLamports+=y,n.detRebateSamples+=1,o+=y,u+=1),v&&(n.perfRebateLamports+=b,n.perfRebateSamples+=1,s+=b,d+=1),n.netLamports+=x,i+=c,a+=l,f+=x,I(e.placementReturnFp)&&I(e.benchmarkReturnFp)&&(n.scoreDeltaFp+=O(e.placementReturnFp)-O(e.benchmarkReturnFp),n.skillScoreFp+=O(e.skillScoreFp),n.scoreSamples+=1),I(e.crowdingRatioFp)&&(n.crowdingRatioFp+=O(e.crowdingRatioFp),n.crowdingSamples+=1);let S=typeof e.committedMinerCount==`number`&&Number.isFinite(e.committedMinerCount)?e.committedMinerCount:typeof e.participantCount==`number`&&Number.isFinite(e.participantCount)?e.participantCount:null;S!=null&&(n.poolCount+=S,n.poolSamples+=1),e.strategyExecution===`auto`?(n.autoCount+=1,p+=1):(n.deterministicCount+=1,m+=1),(e.strategySource===`skill`||e.modelId)&&(n.taskCount+=1,h+=1),e.strategyFallbackUsed&&(n.fallbackCount+=1,g+=1),r.set(t,n)}let _=n.length,v=Array.from(r.values()).toSorted((e,t)=>t.cycleCount===e.cycleCount?Number(t.satRaw-e.satRaw):t.cycleCount-e.cycleCount).slice(0,Math.max(1,t?.maxRows??6)).map(e=>{let t=e.satRaw/BigInt(Math.max(1,e.cycleCount)),n=e.rebateLamports/BigInt(Math.max(1,e.cycleCount)),r=e.detRebateSamples>0?e.detRebateLamports/BigInt(e.detRebateSamples):0n,i=e.perfRebateSamples>0?e.perfRebateLamports/BigInt(e.perfRebateSamples):0n,a=e.netLamports/BigInt(Math.max(1,e.cycleCount)),o=e.scoreSamples>0?e.scoreDeltaFp/BigInt(e.scoreSamples):0n,s=e.scoreSamples>0?e.skillScoreFp/BigInt(e.scoreSamples):0n,u=e.crowdingSamples>0?e.crowdingRatioFp/BigInt(e.crowdingSamples):0n,d=e.poolSamples>0?e.poolCount/e.poolSamples:null,f=e.detRebateSamples>0||e.perfRebateSamples>0||e.scoreSamples>0||e.crowdingSamples>0||e.poolSamples>0,p=[`${e.strategyLabel}: ${e.cycleCount} cycle${e.cycleCount===1?``:`s`}`,`Avg SAT: ${E(t.toString(),`SAT`)} SAT`,`Avg rebate: ${E(n.toString(),`SOL`)} SOL`,`Avg deterministic rebate: ${e.detRebateSamples>0?`${E(r.toString(),`SOL`)} SOL`:`not recorded`}`,`Avg performance rebate: ${e.perfRebateSamples>0?`${E(i.toString(),`SOL`)} SOL`:`not recorded`}`,`Avg net: ${D(a.toString(),`SOL`)} SOL`,`Score edge: ${e.scoreSamples>0?le(o):`not recorded`}`,`Skill score: ${e.scoreSamples>0?F(s.toString()):`not recorded`}`,`Crowding: ${e.crowdingSamples>0?F(u.toString()):`not recorded`}`,`Pool: ${d==null?`not recorded`:`${L(d)} avg`}`,`Auto: ${e.autoCount}`,`Deterministic: ${e.deterministicCount}`,`Task/skill: ${e.taskCount}`,`Fallback: ${e.fallbackCount}`],m=e.detRebateSamples>0?E(r.toString(),`SOL`):`—`,h=e.perfRebateSamples>0?E(i.toString(),`SOL`):`—`,g=e.scoreSamples>0?le(o):`—`,v=e.scoreSamples>0?F(s.toString()):`—`,y=e.crowdingSamples>0?F(u.toString()):`—`,b=d==null?`—`:L(d),x=[...e.detRebateSamples>0&&r>0n?[`Det ${m}`]:[],...e.perfRebateSamples>0&&i>0n?[`Perf ${h}`]:[],...e.scoreSamples>0&&o!==0n?[`Edge ${g}`]:[],...e.scoreSamples>0&&s>0n?[`Skill ${v}`]:[],...e.crowdingSamples>0&&u>0n?[`Crowd ${y}`]:[],...d==null?[]:[`Pool ${b}`]],S=[...e.autoCount>0?[`Auto ${e.autoCount}`]:[],...e.deterministicCount>0?[`Det ${e.deterministicCount}`]:[],...e.taskCount>0?[`Task ${e.taskCount}`]:[],...e.fallbackCount>0?[`Fallback ${e.fallbackCount}`]:[]];return{strategyLabel:e.strategyLabel,cycleCount:e.cycleCount,sharePct:Math.round(e.cycleCount/Math.max(1,_)*100),avgSatValue:Number(t)/10**Number(l),avgRebateValue:Number(n)/10**Number(c),avgNetValue:Number(a)/10**Number(c),avgSkillEdgeValue:e.scoreSamples>0?Number(o):-1/0,avgSatLabel:E(t.toString(),`SAT`),avgRebateLabel:E(n.toString(),`SOL`),avgDetRebateLabel:m,avgPerfRebateLabel:h,avgNetLabel:D(a.toString(),`SOL`),avgSkillEdgeLabel:g,avgSkillLabel:v,avgCrowdingLabel:y,avgPoolLabel:b,hasCompetitionMetrics:f,competitionMetrics:x,executionMetrics:S,autoCount:e.autoCount,deterministicCount:e.deterministicCount,taskCount:e.taskCount,fallbackCount:e.fallbackCount,title:p.join(`
9
+ `}function d(e){return e?e.signerCapability===`background-ready`?{title:`Background-ready wallet`,detail:`This wallet is suitable for unattended SAT mining.`}:{title:`Interactive wallet`,detail:e.signerCapabilityReason??`This wallet may need operator approval for mining actions.`}:{title:`No wallet selected`,detail:`Create or import the dedicated Mining wallet in onboarding or with fased wallet setup --chain solana, then refresh.`}}function f(e){let t=String(e.attachedWalletId??``).trim(),n=String(e.status?.walletId??``).trim(),r=String(e.profile?.walletId??``).trim(),i=String(e.readiness?.selectedWalletId??``).trim(),a=e.wallets.find(e=>e.walletId===t),o=e.wallets.find(e=>e.walletId===n),s=e.wallets.find(e=>e.walletId===r),c=e.wallets.find(e=>e.walletId===i),l=a??o??s??c,u=!!n&&(!!e.status?.enabledWanted||!!e.status?.running||R(e.status?.currentCapitalFundedLamports)||(e.status?.recentActions?.length??0)>0||String(e.status?.validatorAuthority??``).trim().length>0),d=t||(n&&(u||n===r&&o)?n:``);return d?n&&n!==d?{attachedWallet:a,runtimeWallet:o,profileWallet:s,displayWallet:l,title:`Mining wallet state still settling`,detail:`Wallet registry and runtime status disagree. Refresh after the next SAT tick to confirm the singleton @wallet:mining history is live.`}:r&&r!==d?{attachedWallet:a,runtimeWallet:o,profileWallet:s,displayWallet:l,title:`Mining form differs from singleton wallet`,detail:`The mining form is still showing settings from another wallet. Save or refresh the profile if you want the form to match @wallet:mining.`}:{attachedWallet:a,runtimeWallet:o,profileWallet:s,displayWallet:l,title:`Singleton mining wallet`,detail:`SAT history, capital, and restart recovery follow @wallet:mining.`}:{attachedWallet:a,runtimeWallet:o,profileWallet:s,displayWallet:l,title:`Configure`,detail:``}}function p(e){let t=String(e.defaultWalletId??``).trim(),n=String(e.attachedWalletId||e.profile?.walletId||e.status?.walletId||e.readiness?.selectedWalletId||``).trim();return!t||!n||t!==n?null:{title:`Agent and Mining wallets must stay separate`,detail:`This singleton mining wallet is also the Default Agent wallet fallback. Use Wallet to clear the fallback, then select a dedicated Agent wallet before wallet work.`}}function m(e){return(e?.strategyExecution&&i(e.strategyMode)===e.strategyExecution?e.strategyExecution:i(e?.strategyMode))===`auto`?{title:`Auto strategy`,detail:`Auto strategy uses the Fased model/runtime stack to propose the cycle allocation and falls back to deterministic execution if the strategy step fails.`}:{title:`Deterministic strategy`,detail:`Deterministic strategy uses locked 25-bucket allocation arrays for the selected risk profile and does not require model inference.`}}function h(e){if(!e.length)return null;let t=e.reduce((e,t)=>({committedLamports:e.committedLamports+BigInt(t.committedLamports??`0`),totalSatEarnedRaw:e.totalSatEarnedRaw+BigInt(t.totalSatEarnedRaw??`0`),totalRebateLamports:e.totalRebateLamports+BigInt(t.totalRebateLamports??`0`),txFeeLamports:e.txFeeLamports+BigInt(t.txFeeLamports??`0`),netLiveCostLamports:e.netLiveCostLamports+BigInt(t.netLiveCostLamports??`0`),validParticipationCount:e.validParticipationCount+ +!!t.validParticipation}),{committedLamports:0n,totalSatEarnedRaw:0n,totalRebateLamports:0n,txFeeLamports:0n,netLiveCostLamports:0n,validParticipationCount:0}),n=BigInt(e.length);return{sampleCount:e.length,averageCommitLamports:(t.committedLamports/n).toString(),averageSatRaw:(t.totalSatEarnedRaw/n).toString(),averageRebateLamports:(t.totalRebateLamports/n).toString(),averageFeeLamports:(t.txFeeLamports/n).toString(),averageNetLiveCostLamports:(t.netLiveCostLamports/n).toString(),validRatePct:`${Math.round(t.validParticipationCount/e.length*100)}%`}}function g(e){let t=e.status?.lastStrategyDecision??null;return e.strategyExecution===`auto`?t?t.source===`skill`?{title:t.fallbackUsed?`Auto path with deterministic fallback`:`Auto path with model route`,detail:t.fallbackUsed?`The runtime attempted the model-guided path but fell back to deterministic execution for this cycle.`:`The runtime used the model-guided strategy path for this cycle.`,pathLabel:t.modelId?`Model route · ${t.modelId}`:`Model route`,fallbackLabel:t.fallbackUsed?`Fallback used`:`No fallback`}:{title:`Auto planner with deterministic strategy`,detail:`Auto sizing/planning is active, but the strategy engine resolved to the deterministic path for the latest cycle.`,pathLabel:`Deterministic strategy path`,fallbackLabel:`Planner only`}:{title:`Auto path waiting`,detail:`Auto mode is enabled. A live planner/strategy decision will appear once a cycle is evaluated.`,pathLabel:`No strategy decision yet`,fallbackLabel:`Pending`}:{title:`Deterministic path`,detail:`This run is using the locked deterministic allocation generator. No model step is required for cycle placement.`,pathLabel:`Deterministic engine`,fallbackLabel:`Not applicable`}}function _(e){let t=o(e?.riskMode??`balanced`);switch(e?.strategyPreset&&r(e.strategyPreset)===(e?.riskMode??`balanced`)?e.strategyPreset:t){case`spread`:return{title:`Spread profile`,detail:`Wider center-weighted coverage for steadier participation and lower concentration risk.`};case`conviction`:return{title:`Conviction profile`,detail:`Tighter concentration around strongest buckets for more variance and more upside if the read is right.`};case`top_k`:return{title:`Top-K Sparse profile`,detail:`High-conviction compiler that puts most weight into a few ranked buckets. Higher variance, stronger upside when the read is right.`};case`ranked`:return{title:`Ranked profile`,detail:`Compiler ranks buckets and converts the ranking into weighted exposure with a tail for safety.`};case`adaptive`:return{title:`Adaptive profile`,detail:`Compiler blends stable coverage with cycle-ranked opportunity so auto can improve without abandoning fallback safety.`};case`crowd_aware`:return{title:`Crowd-aware profile`,detail:`Compiler avoids over-concentrating in obvious buckets and keeps broader tail exposure when the cycle is crowded.`};case`safe_fallback`:return{title:`Safe fallback profile`,detail:`Balanced deterministic allocation for recovery, low confidence, or unstable recent results.`};case`swarm`:return{title:`Swarm profile`,detail:`Coordination-friendly clustered coverage that keeps the miner flexible without fully flattening conviction.`};default:return{title:`Balanced profile`,detail:`Moderate concentration with practical skill upside and less volatility than aggressive mode.`}}}function v(e){let t=BigInt(String(e?.currentCapitalLockedLamports??`0`)),n=Number(e?.currentCapitalPendingCycleCount??0);if(e?.drainOnly&&(t>0n||n>0))return`Clearing`;if(!e?.running)return t>0n||n>0?`Clearing`:`Stopped`;switch(e.nextAction){case`participation`:return`Round open`;case`mining-crank`:return`Settling round`;case`finalize-epoch`:return`Finalizing epoch`;case`claim`:return`Claiming rewards`;case`recover`:return`Blocked`;default:return`Watching for round`}}function y(e){return e?.role===`admin`}function b(e,t){let n=String(t??``).trim();if(!n)return null;let r=e===`devnet`?`devnet`:e===`local`?`custom`:`mainnet-beta`;return r===`custom`?null:r===`mainnet-beta`?`https://solscan.io/tx/${encodeURIComponent(n)}`:`https://solscan.io/tx/${encodeURIComponent(n)}?cluster=${r}`}function x(e,t){let n=String(t??``).trim();if(!n)return null;let r=e===`devnet`?`devnet`:e===`local`?`custom`:`mainnet-beta`;return r===`custom`?null:r===`mainnet-beta`?`https://solscan.io/account/${encodeURIComponent(n)}`:`https://solscan.io/account/${encodeURIComponent(n)}?cluster=${r}`}function S(e,t){return b(e,t)}function C(e){let t=String(e??``).trim();if(!t)return null;let n=new Date(t);return Number.isNaN(n.getTime())?t:n.toLocaleString()}function w(e){let{status:t,readiness:n}=e;if(t?.blocked)return{title:`Blocked`,detail:t.blockedReason||`Mining is blocked right now.`};let r=n?.checks.find(e=>e.key===`fundingReady`),i=n?.checks.find(e=>e.key===`cycleEntryReady`),a=n?.checks.find(e=>e.key===`minerInitialized`),o=BigInt(String(n?.stake?.rewardOwed??`0`)),s=BigInt(String(n?.stake?.slashPenaltyOwed??`0`)),c=BigInt(String(t?.currentCapitalLockedLamports??`0`)),l=BigInt(String(t?.currentCapitalFreeLamports??`0`)),u=Number(t?.currentCapitalPendingCycleCount??0),d=Number(t?.currentCapitalFirstPendingCycleId??0),f=Number(t?.currentCapitalLastPendingCycleId??0),p=String(r?.detail??``).trim().toLowerCase();if(r&&!r.ok)return p.includes(`probe unavailable`)?{title:`Wallet balance unavailable`,detail:`RPC could not confirm miner-wallet SOL right now. Retry in a few seconds.`}:{title:`Need SOL`,detail:`Fund the miner wallet with SOL before mining.`};if(a&&!a.ok){let e=String(a.detail??``).trim().toLowerCase();return e.includes(`owner mismatch`)||e.includes(`invalid owner`)?{title:`Capital account invalid`,detail:`This wallet's SAT miner capital account has the wrong owner on this machine. Repair the wallet-scoped capital account before funding or changing commit.`}:{title:`Need capital`,detail:`Fund Mining capital to create the miner account and deposit SOL.`}}return i&&!i.ok?c>0n&&l<250000000n?{title:`Capital locked`,detail:`Most miner capital is still locked in pending cycles, so free capital is below the 0.25 SOL entry minimum.${u>0&&d>0&&f>=d?d===f?` Pending cycle: ${d}.`:` Pending cycles: ${d}-${f}.`:``}`}:{title:`Need free capital`,detail:`Deposit at least 0.25 SOL of free miner capital to enter the next cycle.`}:s>0n?{title:`Slash penalty owed`,detail:o>0n?`Outstanding slash penalties must be settled before rewards can be claimed.`:`Outstanding slash penalties must be settled before mining proceeds cleanly.`}:t?.claimableSatRaw?{title:`Claimable SAT`,detail:`Rewards are available to claim.`}:t?.lastClaimTxHash?{title:`Claim already settled`,detail:`The latest reward claim already executed. Current claimable SAT is 0 until a later cycle earns more.`}:{title:`Mining active`,detail:`No SAT claim is available yet.`}}function ee(e){switch(e?.recommendedAction){case`resolve-dispute`:return{title:`Dismissed dispute path`,detail:`Resolve the active dispute first. If the dispute is dismissed, claims should unblock without corrected-root republish.`};case`republish-roots`:return{title:`Upheld dispute path`,detail:`This epoch needs corrected-root republish after the dispute outcome. Claims stay blocked until the replacement roots are submitted.`};case`retry-claim`:return{title:`Retry claim path`,detail:`Recovery conditions are satisfied. Retry the claim using the selected epoch and payout settings.`};case`wait`:return{title:`Wait path`,detail:`No admin action is recommended right now. Monitor epoch state and worker/runtime status for the next change.`};default:return{title:`No epoch recovery action required`,detail:`No dispute or epoch-admin recovery workflow is active. Capital-lock backlog, if any, is surfaced in the main mining status.`}}}function te(e,t){let n=String(e??``).trim();if(!n)return`0 ${t}`;try{let e=t===`SOL`?c:l,r=BigInt(n),i=r/10n**e,a=(r%10n**e).toString().padStart(Number(e),`0`).replace(/0+$/,``);return a?`${i}.${a} ${t}`:`${i} ${t}`}catch{return`${n} ${t}`}}function T(e){return e.replace(/\.0+$/,``).replace(/(\.\d*?)0+$/,`$1`)}function E(e,t){let n=String(e??``).trim();if(!n)return`0`;try{let e=t===`SOL`?c:l,r=Number(n)/10**Number(e);if(!Number.isFinite(r))return`0`;let i=Math.abs(r);return T(t===`SAT`?i>=1e3?r.toFixed(1):i>=1?r.toFixed(2):r.toFixed(3):i>=1||i>=.01?r.toFixed(3):r.toFixed(5))}catch{return n}}function D(e,t){let n=String(e??``).trim();if(!n)return`0`;try{let e=BigInt(n);return`${e>0n?`+`:e<0n?`-`:``}${E((e<0n?-e:e).toString(),t)}`}catch{return n}}function ne(e,t){let n=String(e??``).trim();return n?D(n,t):`—`}function re(e,t){let n=String(e??``).trim();return n?E(n,t):`—`}function O(e){try{return BigInt(String(e??`0`))}catch{return 0n}}function ie(e){return O(e.readiness?.balances.solBalanceLamports??e.selectedWallet?.solBalanceLamports??e.status?.currentSolBalanceLamports??`0`)}function k(e){switch(String(e??``).trim()){case`settleCyclePage`:case`finalizeCycleSettlement`:case`scoreCyclePage`:case`distributeCyclePage`:return!0;default:return!1}}function A(e){switch(String(e??``).trim()){case`settleCyclePage`:case`finalizeCycleSettlement`:case`scoreCyclePage`:case`distributeCyclePage`:return!0;default:return!1}}function j(e,t){if(!A(e))return!1;let n=String(t??``).trim().toLowerCase();return n.includes(`invalid progress`)||n.includes(`already closed`)||n.includes(`cycle already closed on-chain`)||n.includes(`invalid account data`)&&(n.includes(`settle invalid progress`)||n.includes(`score invalid progress`)||n.includes(`distribute invalid progress`))}function ae(e,t){let n=String(e??``).trim();if(!n)return`0 ${t}`;try{let e=BigInt(n);return`${e>0n?`+`:e<0n?`-`:``}${te((e<0n?-e:e).toString(),t)}`}catch{return`${n} ${t}`}}function oe(e){return``}function M(e){let t=[{label:`Commit`,value:`${E(e.committedLamports,`SOL`)} SOL`},{label:`Earned`,value:`${E(e.totalSatEarnedRaw,`SAT`)} SAT`},{label:`Rebate`,value:`${E(e.totalRebateLamports,`SOL`)} SOL`}],n=se(e.strategyPreset);n&&t.push({label:`Strategy`,value:n});let r=ce(e.strategyExecution);r&&t.push({label:`Execution`,value:r});let i=typeof e.committedMinerCount==`number`&&Number.isFinite(e.committedMinerCount)?e.committedMinerCount:typeof e.participantCount==`number`&&Number.isFinite(e.participantCount)?e.participantCount:null;return typeof i==`number`&&i>0&&t.push({label:`Pool`,value:`${i} miner${i===1?``:`s`}`}),t}function N(e){let{outcome:t,actions:n}=e,r=n.filter(e=>e.status===`success`&&A(e.action)).length,i=n.filter(e=>e.status===`failure`&&j(e.action,e.message)).length,a=[];if((r>0||i>0)&&(a.push({label:`Keeper won`,value:String(r)}),i>0&&a.push({label:`Keeper lost`,value:String(i)})),!t)return a;let o=(O(t.netLiveCostLamports)-O(t.txFeeLamports)+O(t.totalRebateLamports)+O(t.keeperBountyLamports)).toString();return a.push({label:`Erosion`,value:`${E(t.erosionLamports??o,`SOL`)} SOL`}),a.push({label:`Miner rebate`,value:`${E(t.totalRebateLamports,`SOL`)} SOL`}),t.keeperBountyLamports!=null&&a.push({label:`Keeper bounty`,value:`${E(t.keeperBountyLamports,`SOL`)} SOL`}),t.submitFeeLamports!=null&&a.push({label:`Submit fee`,value:`${E(t.submitFeeLamports,`SOL`)} SOL`}),t.keeperFeeLamports!=null&&a.push({label:`Keeper fees`,value:`${E(t.keeperFeeLamports,`SOL`)} SOL`}),t.claimFeeLamports!=null&&a.push({label:`Claim fee`,value:`${E(t.claimFeeLamports,`SOL`)} SOL`}),O(t.otherFeeLamports)>0n&&a.push({label:`Other tx`,value:`${E(t.otherFeeLamports,`SOL`)} SOL`}),a.push({label:`Net SOL`,value:`${D(t.netLiveCostLamports,`SOL`)} SOL`}),a}function se(e){switch(e){case`spread`:return`Spread`;case`balanced`:return`Balanced`;case`conviction`:return`Conviction`;case`swarm`:return`Swarm`;case`top_k`:return`Top-K`;case`ranked`:return`Ranked`;case`adaptive`:return`Adaptive`;case`crowd_aware`:return`Crowd-aware`;case`safe_fallback`:return`Safe fallback`;default:return null}}function P(e){return se(e.strategyPreset)||(e.riskMode?se(o(e.riskMode))??`Unrecorded`:`Unrecorded`)}function ce(e){return e===`auto`?`Auto`:e===`deterministic`?`Deterministic`:null}function F(e,t=1000000n,n=1){let r=String(e??``).trim();if(!r)return`—`;try{let e=BigInt(r),i=Number(e)/Number(t)*100;return Number.isFinite(i)?`${T(i.toFixed(n))}%`:`—`}catch{return`—`}}function I(e){return String(e??``).trim().length>0}function le(e,t=1000000n,n=1){return`${e<0n?`-`:e>0n?`+`:``}${F((e<0n?-e:e).toString(),t,n)}`}function L(e){let t=Number.isInteger(e)?String(e):T(e.toFixed(1));return`${t} miner${t===`1`?``:`s`}`}function ue(e){let t=e?.liveCycleReport??null;return!t||typeof t.cycleId!=`number`?null:{cycleId:t.cycleId,committedLabel:te(t.committedLamports,`SOL`),unlockRatioLabel:F(t.unlockRatioFp),issuedMinerSatLabel:me({value:t.issuedMinerSatRaw,cycleStatus:t.cycleStatus,counterpartValue:t.unissuedMinerSatRaw,compact:!1}),earnedSatLabel:te(t.totalSatEarnedRaw,`SAT`),netSolCostLabel:ae(t.netLiveCostLamports,`SOL`)}}function de(e){if(e==null)return null;let t=typeof e==`number`?Math.floor(e):Number.parseInt(String(e),10);return Number.isFinite(t)&&t>=0?t:null}function R(e){if(!e)return!1;try{return BigInt(e)>0n}catch{return!1}}function z(e){let t=O(e.committedLamports);if(t<=0n)return null;let n=O(String(e.requestedCommitLamports??`0`)),r=O(String(e.activeCommitLamports??`0`)),i=n>0n?n:r,a=O(String(e.minimumCommitLamports??`0`)),o=a>0n?a/2n:125000000n,s=O(e.previousCommittedLamports),c=O(String(e.capitalLockedLamports??`0`)),l=typeof e.pendingCycleCount==`number`&&Number.isFinite(e.pendingCycleCount)?e.pendingCycleCount:0,u=O(String(e.walletReserveShortfallLamports??`0`));return s>0n&&t>s+o&&c<=0n&&l<=0?{label:`Commit restored: capital unlocked`,title:`The latest submitted commit increased after pending/locked miner capital cleared back into free capital.`,tone:`success`}:i>0n&&t+o<i?c>0n||l>0?{label:`Commit reduced: locked capital clearing`,title:`The runtime submitted a smaller safe commit because previous-cycle capital is still locked until settlement and claim complete.`,tone:`warning`}:u>0n?{label:`Commit reduced: fee reserve`,title:`The runtime submitted a smaller safe commit because signer fee reserve was below target.`,tone:`warning`}:{label:`Commit reduced: free capital`,title:`The runtime submitted a smaller safe commit because currently free miner capital was below the saved target.`,tone:`warning`}:null}function fe(e){return e?.statusFresh===!1||e?.degraded===!0}function B(e){return e.readinessValue!=null&&(e.degraded||e.statusValue==null||e.statusValue===`0`)&&R(e.readinessValue)?e.readinessValue:e.statusValue??e.readinessValue??e.fallback??`0`}function pe(e){return e.degraded&&e.readinessValue?e.readinessValue:e.statusValue??e.readinessValue??null}function me(e){if((e.cycleStatus??null)!==2){let t=R(e.value),n=R(e.counterpartValue);if(!t&&!n)return`—`}return e.value==null?`—`:e.compact?E(e.value,`SAT`):te(e.value,`SAT`)}function he(e,t){let n=e?.liveCycleReport??null,r=typeof e?.currentCycleId==`number`?e.currentCycleId:typeof n?.cycleId==`number`?n.cycleId:null,i=n?.committedLamports??`0`,a=R(i),o=de(n?.validMinerCount),s=n?.totalCommittedLamports??(a?i:null),c=[{label:`Current cycle`,value:typeof r==`number`?String(r):`—`},{label:`Miners now`,value:o==null?`—`:`${o}`},{label:`SOL in cycle`,value:s==null?`—`:E(s,`SOL`)},{label:`Your commit`,value:a?E(i,`SOL`):`—`},{label:`Last payout (SAT)`,value:re(t?.satRaw??null,`SAT`)},{label:`Last net cost (SOL)`,value:ne(t?.netLamports??null,`SOL`)}];return R(e?.currentKeeperBountyUnpaidLamports)&&c.push({label:`Keeper bounty owed`,value:E(e?.currentKeeperBountyUnpaidLamports??`0`,`SOL`)}),c}function ge(e){let t=[{label:`Cycle`,value:e.cycleId==null?`—`:String(e.cycleId)},{label:`Your commit`,value:e.ownCommitPresent?`${E(e.ownCommitLamports,`SOL`)} SOL`:`—`},{label:`SOL in cycle`,value:e.totalCommittedLamports==null?`—`:`${E(e.totalCommittedLamports,`SOL`)} SOL`},{label:`Miners now`,value:e.minerCount==null?`pending`:String(e.minerCount)}];return R(e.keeperBountyUnpaidLamports)&&t.push({label:`Keeper bounty owed`,value:`${E(e.keeperBountyUnpaidLamports??`0`,`SOL`)} SOL`,title:`Keeper work completed for this cycle but not yet paid from the protocol reserve.`}),t}function _e(e){let t=typeof e?.latestSettledCycleId==`number`?e.latestSettledCycleId:null,n=e?.settledHistory??[];if(t!=null){let e=n.find(e=>e.cycleId===t);if(e)return{cycleId:t,satRaw:e.totalSatEarnedRaw??null,netLamports:e.netLiveCostLamports??null}}let r=n[0]??null;return{cycleId:typeof r?.cycleId==`number`?r.cycleId:null,satRaw:r?.totalSatEarnedRaw??null,netLamports:r?.netLiveCostLamports??null}}function ve(e){if(!e.length)return`—`;let t=[...e].filter(Number.isFinite).toSorted((e,t)=>e-t),n=t[0],r=t[t.length-1];return n===r?String(n):`${n}-${r}`}function ye(e){let t=typeof e?.missingCycleStartId==`number`?e.missingCycleStartId:null,n=typeof e?.missingCycleEndId==`number`?e.missingCycleEndId:null,r=typeof e?.missingCycleCount==`number`&&Number.isFinite(e.missingCycleCount)?e.missingCycleCount:0;if(r<=0||t==null||n==null||n<t)return null;let i=[typeof e?.latestSettledCycleId==`number`?e.latestSettledCycleId:null,typeof e?.latestSubmittedCycleId==`number`?e.latestSubmittedCycleId:null,(e?.pendingCycleIds??[]).reduce((e,t)=>typeof t==`number`&&Number.isFinite(t)&&(e==null||t>e)?t:e,null)].filter(e=>typeof e==`number`&&Number.isFinite(e)).reduce((e,t)=>e==null||t>e?t:e,null);return i!=null&&i>n?null:{startCycleId:t,endCycleId:n,count:r}}function be(e){let t=typeof e?.currentCycleId==`number`?e.currentCycleId:typeof e?.liveCycleReport?.cycleId==`number`?e.liveCycleReport.cycleId:null,n=typeof e?.latestSettledCycleId==`number`?e.latestSettledCycleId:null,r=typeof e?.latestSubmittedCycleId==`number`?e.latestSubmittedCycleId:null,i=typeof e?.exactPendingCycleId==`number`?e.exactPendingCycleId:null,a=String(e?.exactPendingStage??``).trim(),o=(e?.pendingCycleIds??[]).filter(e=>typeof e==`number`&&Number.isFinite(e)),s=ye(e),c=[];if(n!=null&&n!==t&&c.push(`Settled ${n}`),r!=null&&r!==t&&r!==n&&c.push(`Submitted ${r}`),o.length>0&&(i==null?c.push(`Pending ${ve(o)}`):c.push(`Pending ${i}${a?` (${a})`:``}`)),s){let t=e?.enabledWanted&&e.running&&!e.drainOnly?`Missed`:`Skipped`;c.push(`${t} ${s.startCycleId===s.endCycleId?s.startCycleId:`${s.startCycleId}-${s.endCycleId}`}`)}return c.length>0?c.join(` · `):null}function xe(e){if(!e?.enabledWanted||!e.running||!e.workers)return null;let t=new Date(e.snapshotAt??e.updatedAt??``).getTime();if(!Number.isFinite(t))return null;let n=[],r={roundWatcher:2e4,epoch:3e4,claim:4e4,recovery:5e4};for(let i of[`roundWatcher`,`epoch`,`claim`,`recovery`]){let a=e.workers[i];if(!a?.enabled)continue;let o=new Date(String(a.nextScheduledAt??``)).getTime(),s=new Date(String(a.lastRunAt??``)).getTime(),c=Number.isFinite(o)?t-o:Number.isFinite(s)?t-s:0;if(a.running||c<=r[i])continue;let l=[String(a.lastDetail??a.waitingReason??``).trim(),typeof a.lastSelectedCycleId==`number`?`cycle ${a.lastSelectedCycleId}${a.lastSelectedStage?` ${a.lastSelectedStage}`:``}`:``,(a.rpcTimeoutCount??0)>0?`${a.rpcTimeoutCount??0} timeout${a.rpcTimeoutCount===1?``:`s`}`:``].filter(Boolean).join(` · `);n.push(l?`${i} (${l})`:i)}return n.length>0?`Worker stale: ${n.join(` · `)}`:null}function Se(e){if(!e?.enabledWanted||!e.running)return null;let t=e.chainTime;if(!t||t.freshness===`fresh`||t.freshness===`stale`&&t.source!==`local-display`&&!t.lastError&&t.consecutiveFailures===0)return null;let n=t.source===`local-display`?`using local display time only`:t.lastError?t.lastError:`${t.consecutiveFailures} consecutive chain-time read failures`;return`Chain time ${t.freshness}: ${n}`}function Ce(e){let t=we(e.plannerWindow),n=e.rangeStart&&e.rangeEnd?`${e.rangeStart} to ${e.rangeEnd}`:null;return e.latestPoint?{summary:`${e.sampled?`Showing ${e.visibleCycleCount} sampled points from ${e.matchingCycleCount} completed cycles`:`Showing ${e.visibleCycleCount} completed cycles`} mined by this wallet in the ${t}${n?` · data present ${n}`:``}. Latest visible cycle ${e.latestPoint.cycleId} earned ${e.latestPoint.satLabel} SAT with ${e.latestPoint.netLabel} SOL net.`,windowLabel:t,dataRangeLabel:n}:{summary:`No completed cycles mined by this wallet were recorded in the ${t} yet.${e.currentCycleSubmitted&&typeof e.currentCycleId==`number`?` Current cycle ${e.currentCycleId} is already submitted and waiting for settlement, so it will not show here yet.`:``}`,windowLabel:t,dataRangeLabel:n}}function we(e){return e===`1h`?`last hour`:e===`24h`?`last 24 hours`:e===`30d`?`last 30 days`:e===`1y`?`last year`:`all recorded time`}function Te(e){return e===`1h`?3600*1e3:e===`24h`?1440*60*1e3:e===`30d`?720*60*60*1e3:e===`1y`?365*24*60*60*1e3:null}function Ee(e,t){if(e.length<=t)return e;let n=[],r=new Set;for(let i=0;i<t;i+=1){let a=Math.round(i*(e.length-1)/Math.max(1,t-1));r.has(a)||(r.add(a),n.push(e[a]))}return n}function De(e,t,n){if(!Number.isFinite(e)||!Number.isFinite(t)||!Number.isFinite(n)||t===n)return 50;let r=(e-t)/(n-t);return 100-Math.max(0,Math.min(100,r*100))}function Oe(e,t){let n=Array.isArray(e)?e.filter(e=>typeof e.cycleId==`number`):[];if(!n.length)return[];let r=n.slice().toSorted((e,t)=>Date.parse(String(e.recordedAt??``))-Date.parse(String(t.recordedAt??``))),i=typeof t?.maxPoints==`number`&&Number.isFinite(t.maxPoints)?Math.max(2,t.maxPoints):null,a=i==null?r:Ee(r,i),o=a.map(e=>Number(e.totalSatEarnedRaw??`0`)/10**Number(l)),s=a.map(e=>Number(e.netLiveCostLamports??`0`)/10**Number(c)),u=Math.min(...o),d=Math.max(...o),f=Math.min(...s),p=Math.max(...s);return a.map((e,t)=>{let n=o[t]??0,r=s[t]??0,i=ce(e.strategyExecution),c=P(e),l=typeof e.committedMinerCount!=`number`||!Number.isFinite(e.committedMinerCount)?null:`Pool: ${e.committedMinerCount} miner${e.committedMinerCount===1?``:`s`}`,m=(O(e.netLiveCostLamports)-O(e.txFeeLamports)+O(e.totalRebateLamports)+O(e.keeperBountyLamports)).toString();return{cycleId:e.cycleId,cycleLabel:String(e.cycleId).slice(-4),timeLabel:Ie(e.recordedAt),commitLabel:E(e.committedLamports,`SOL`),satLabel:E(e.totalSatEarnedRaw,`SAT`),netLabel:D(e.netLiveCostLamports,`SOL`),erosionLabel:E(e.erosionLamports??m,`SOL`),rebateLabel:E(e.totalRebateLamports,`SOL`),keeperBountyLabel:e.keeperBountyLamports==null?null:E(e.keeperBountyLamports,`SOL`),submitFeeLabel:e.submitFeeLamports==null?null:E(e.submitFeeLamports,`SOL`),keeperFeeLabel:e.keeperFeeLamports==null?null:E(e.keeperFeeLamports,`SOL`),claimFeeLabel:e.claimFeeLamports==null?null:E(e.claimFeeLamports,`SOL`),otherFeeLabel:O(e.otherFeeLamports)>0n?E(e.otherFeeLamports,`SOL`):null,strategyLabel:c,satValue:n,netValue:r,satY:De(n,u,d),netY:De(r,f,p),x:a.length===1?50:t/(a.length-1)*100,executionLabel:i??`—`,poolLabel:l}})}function ke(e,t){let n=Array.isArray(e)?e.filter(e=>typeof e.cycleId==`number`):[];if(!n.length)return null;let r=new Map,i=0n,a=0n,o=0n,s=0n,u=0,d=0,f=0n,p=0,m=0,h=0,g=0;for(let e of n){let t=P(e),n=r.get(t)??{strategyLabel:t,cycleCount:0,satRaw:0n,rebateLamports:0n,detRebateLamports:0n,perfRebateLamports:0n,detRebateSamples:0,perfRebateSamples:0,netLamports:0n,scoreDeltaFp:0n,skillScoreFp:0n,scoreSamples:0,crowdingRatioFp:0n,crowdingSamples:0,poolCount:0,poolSamples:0,autoCount:0,deterministicCount:0,taskCount:0,fallbackCount:0};n.cycleCount+=1;let c=O(e.totalSatEarnedRaw),l=O(e.totalRebateLamports),_=I(e.deterministicRebateLamports)||I(e.claimableDetRebateLamports)||I(e.claimedDetRebateLamports),v=I(e.performanceRebateLamports)||I(e.claimablePerfRebateLamports)||I(e.claimedPerfRebateLamports),y=I(e.deterministicRebateLamports)?O(e.deterministicRebateLamports):O(e.claimableDetRebateLamports)+O(e.claimedDetRebateLamports),b=I(e.performanceRebateLamports)?O(e.performanceRebateLamports):O(e.claimablePerfRebateLamports)+O(e.claimedPerfRebateLamports),x=O(e.netLiveCostLamports);n.satRaw+=c,n.rebateLamports+=l,_&&(n.detRebateLamports+=y,n.detRebateSamples+=1,o+=y,u+=1),v&&(n.perfRebateLamports+=b,n.perfRebateSamples+=1,s+=b,d+=1),n.netLamports+=x,i+=c,a+=l,f+=x,I(e.placementReturnFp)&&I(e.benchmarkReturnFp)&&(n.scoreDeltaFp+=O(e.placementReturnFp)-O(e.benchmarkReturnFp),n.skillScoreFp+=O(e.skillScoreFp),n.scoreSamples+=1),I(e.crowdingRatioFp)&&(n.crowdingRatioFp+=O(e.crowdingRatioFp),n.crowdingSamples+=1);let S=typeof e.committedMinerCount==`number`&&Number.isFinite(e.committedMinerCount)?e.committedMinerCount:typeof e.participantCount==`number`&&Number.isFinite(e.participantCount)?e.participantCount:null;S!=null&&(n.poolCount+=S,n.poolSamples+=1),e.strategyExecution===`auto`?(n.autoCount+=1,p+=1):(n.deterministicCount+=1,m+=1),(e.strategySource===`skill`||e.modelId)&&(n.taskCount+=1,h+=1),e.strategyFallbackUsed&&(n.fallbackCount+=1,g+=1),r.set(t,n)}let _=n.length,v=Array.from(r.values()).toSorted((e,t)=>t.cycleCount===e.cycleCount?Number(t.satRaw-e.satRaw):t.cycleCount-e.cycleCount).slice(0,Math.max(1,t?.maxRows??6)).map(e=>{let t=e.satRaw/BigInt(Math.max(1,e.cycleCount)),n=e.rebateLamports/BigInt(Math.max(1,e.cycleCount)),r=e.detRebateSamples>0?e.detRebateLamports/BigInt(e.detRebateSamples):0n,i=e.perfRebateSamples>0?e.perfRebateLamports/BigInt(e.perfRebateSamples):0n,a=e.netLamports/BigInt(Math.max(1,e.cycleCount)),o=e.scoreSamples>0?e.scoreDeltaFp/BigInt(e.scoreSamples):0n,s=e.scoreSamples>0?e.skillScoreFp/BigInt(e.scoreSamples):0n,u=e.crowdingSamples>0?e.crowdingRatioFp/BigInt(e.crowdingSamples):0n,d=e.poolSamples>0?e.poolCount/e.poolSamples:null,f=e.detRebateSamples>0||e.perfRebateSamples>0||e.scoreSamples>0||e.crowdingSamples>0||e.poolSamples>0,p=[`${e.strategyLabel}: ${e.cycleCount} cycle${e.cycleCount===1?``:`s`}`,`Avg SAT: ${E(t.toString(),`SAT`)} SAT`,`Avg rebate: ${E(n.toString(),`SOL`)} SOL`,`Avg deterministic rebate: ${e.detRebateSamples>0?`${E(r.toString(),`SOL`)} SOL`:`not recorded`}`,`Avg performance rebate: ${e.perfRebateSamples>0?`${E(i.toString(),`SOL`)} SOL`:`not recorded`}`,`Avg net: ${D(a.toString(),`SOL`)} SOL`,`Score edge: ${e.scoreSamples>0?le(o):`not recorded`}`,`Skill score: ${e.scoreSamples>0?F(s.toString()):`not recorded`}`,`Crowding: ${e.crowdingSamples>0?F(u.toString()):`not recorded`}`,`Pool: ${d==null?`not recorded`:`${L(d)} avg`}`,`Auto: ${e.autoCount}`,`Deterministic: ${e.deterministicCount}`,`Task/skill: ${e.taskCount}`,`Fallback: ${e.fallbackCount}`],m=e.detRebateSamples>0?E(r.toString(),`SOL`):`—`,h=e.perfRebateSamples>0?E(i.toString(),`SOL`):`—`,g=e.scoreSamples>0?le(o):`—`,v=e.scoreSamples>0?F(s.toString()):`—`,y=e.crowdingSamples>0?F(u.toString()):`—`,b=d==null?`—`:L(d),x=[...e.detRebateSamples>0&&r>0n?[`Det ${m}`]:[],...e.perfRebateSamples>0&&i>0n?[`Perf ${h}`]:[],...e.scoreSamples>0&&o!==0n?[`Edge ${g}`]:[],...e.scoreSamples>0&&s>0n?[`Skill ${v}`]:[],...e.crowdingSamples>0&&u>0n?[`Crowd ${y}`]:[],...d==null?[]:[`Pool ${b}`]],S=[...e.autoCount>0?[`Auto ${e.autoCount}`]:[],...e.deterministicCount>0?[`Det ${e.deterministicCount}`]:[],...e.taskCount>0?[`Task ${e.taskCount}`]:[],...e.fallbackCount>0?[`Fallback ${e.fallbackCount}`]:[]];return{strategyLabel:e.strategyLabel,cycleCount:e.cycleCount,sharePct:Math.round(e.cycleCount/Math.max(1,_)*100),avgSatValue:Number(t)/10**Number(l),avgRebateValue:Number(n)/10**Number(c),avgNetValue:Number(a)/10**Number(c),avgSkillEdgeValue:e.scoreSamples>0?Number(o):-1/0,avgSatLabel:E(t.toString(),`SAT`),avgRebateLabel:E(n.toString(),`SOL`),avgDetRebateLabel:m,avgPerfRebateLabel:h,avgNetLabel:D(a.toString(),`SOL`),avgSkillEdgeLabel:g,avgSkillLabel:v,avgCrowdingLabel:y,avgPoolLabel:b,hasCompetitionMetrics:f,competitionMetrics:x,executionMetrics:S,autoCount:e.autoCount,deterministicCount:e.deterministicCount,taskCount:e.taskCount,fallbackCount:e.fallbackCount,title:p.join(`
10
10
  `)}}),y=e=>v.reduce((t,n)=>!t||e(n)>e(t)?n:t,null),b=v[0]??null,x=y(e=>e.avgSatValue),S=y(e=>e.avgRebateValue),C=y(e=>e.avgNetValue),w=v.filter(e=>Number.isFinite(e.avgSkillEdgeValue)).reduce((e,t)=>!e||t.avgSkillEdgeValue>e.avgSkillEdgeValue?t:e,null);return{summary:{totalCycles:_,totalSatLabel:E(i.toString(),`SAT`),totalRebateLabel:E(a.toString(),`SOL`),totalDetRebateLabel:u>0?E(o.toString(),`SOL`):`—`,totalPerfRebateLabel:d>0?E(s.toString(),`SOL`):`—`,rebateSplitRecorded:u>0||d>0,totalNetLabel:D(f.toString(),`SOL`),mostUsedLabel:b?.strategyLabel??`—`,mostUsedDetail:b?`${b.cycleCount} cycles · ${b.sharePct}%`:`No data`,bestSatLabel:x?.strategyLabel??`—`,bestSatDetail:x?`${x.avgSatLabel} SAT avg`:`No data`,bestRebateLabel:S?.strategyLabel??`—`,bestRebateDetail:S?`${S.avgRebateLabel} SOL avg`:`No data`,bestNetLabel:C?.strategyLabel??`—`,bestNetDetail:C?`${C.avgNetLabel} SOL avg`:`No data`,bestSkillLabel:w?.strategyLabel??`—`,bestSkillDetail:w&&w.hasCompetitionMetrics?`${w.avgSkillEdgeLabel} edge · ${w.avgSkillLabel} skill`:`No score data`,executionDetail:`Auto ${p} · Deterministic ${m}`,sourceDetail:`Task/skill ${h} · Fallback ${g}`},rows:v}}function Ae(e,t){let n=Array.isArray(e)?e.filter(e=>typeof e.cycleId==`number`):[];if(!n.length)return[];let r=Math.max(1,t?.maxPoints??8),i=n.slice(0,r).toReversed(),a=i.reduce((e,t)=>{try{let n=BigInt(t.committedLamports??`0`);return n>e?n:e}catch{return e}},0n),o=a>0n?a:1n;return i.map(e=>{let t=0n;try{t=BigInt(e.committedLamports??`0`)}catch{t=0n}let n=Number(t*100n/o),r=Math.max(18,Math.min(100,n||0)),i=e.strategyExecution===`auto`?e.strategyFallbackUsed?`fallback`:`auto`:`deterministic`;return{cycleId:e.cycleId,cycleLabel:String(e.cycleId).slice(-4),timeLabel:Ie(e.recordedAt),commitLabel:E(e.committedLamports,`SOL`),satLabel:E(e.totalSatEarnedRaw,`SAT`),netLabel:D(e.netLiveCostLamports,`SOL`),executionLabel:i===`auto`?`Auto`:i===`fallback`?`Auto -> deterministic`:`Deterministic`,rationaleLabel:e.plannerRationale?.trim()||e.strategyRationale?.trim()||`No rationale recorded`,barHeightPct:r,tone:i}})}function je(e,t,n){return e<t?t:e>n?n:e}function Me(...e){return e.reduce((e,t)=>t>e?t:e,e[0]??0n)}function Ne(e){let t=String(e??``).trim();if(!t)return`0.25`;try{let e=BigInt(t),n=e/1000000000n,r=(e%1000000000n).toString().padStart(9,`0`).replace(/0+$/,``).slice(0,4);return r?`${n}.${r}`:`${n}`}catch{return`0.25`}}function Pe(e){let t=String(e??``).trim();if(!t)return`0`;try{let e=BigInt(t),n=e/1000000000n,r=(e%1000000000n).toString().padStart(9,`0`).replace(/0+$/,``);return r?`${n}.${r}`:`${n}`}catch{return`0`}}function Fe(e){let t=String(e??``).trim();if(!t||!/^\d+(\.\d{0,9})?$/.test(t))return`250000000`;let[n,r=``]=t.split(`.`);return(BigInt(n||`0`)*1000000000n+BigInt((r+`000000000`).slice(0,9)||`0`)).toString()}function Ie(e){let t=String(e??``).trim();if(!t)return`—`;let n=new Date(t);return Number.isNaN(n.getTime())?t:n.toLocaleString([],{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function Le(e){let t=String(e??``).trim();if(!t)return`—`;let n=new Date(t);return Number.isNaN(n.getTime())?t:n.toLocaleString([],{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function V(e){switch(String(e??``).trim()){case`claim`:case`claimCycleRewards`:case`claimCycleRewardsBatch`:case`closeResolvedCycleAccounts`:case`closeResolvedMinerCycleState`:return!0;default:return!1}}function Re(e){switch(String(e??``).trim()){case`initMinerCapital`:case`depositMinerCapital`:case`withdrawMinerCapital`:case`setActiveCommit`:return!0;default:return!1}}function ze(e){let t=String(e??``).trim();return Re(t)||t===`bootstrapRegistryReserve`?`wallet`:t===`startMining`||t===`stopMining`?`runtime`:`cycle`}function Be(e){let t=String(e??``).trim().toLowerCase();return t&&(t.includes(`capital`)||t.includes(`commit`)||t.includes(`withdraw`)||t.includes(`fund`)||t.includes(`wallet`)||t.includes(`reserve`)||t.includes(`fee`)||t.includes(`need sol`))?`wallet`:`runtime`}function Ve(e){switch(e){case`wallet`:return`No recent wallet-side mining actions yet.`;case`cycle`:return`No recent cycle activity yet.`;default:return`No recent actions yet.`}}function He(e){return e.category===`wallet`?n.arrowUpDown:e.category===`cycle`?n.barChart:e.tone===`danger`?n.bug:e.tone===`success`?n.check:n.terminal}function H(r,i){let a=String(r??``).trim();return a?e`<a
11
11
  class="mining-inline-link mining-inline-link--card"
12
12
  href=${a}
@@ -2957,4 +2957,4 @@ import{a as e,r as t,t as n}from"./icons-D3-vEvih.js";import{D as r,E as i,t as
2957
2957
  </div>`:t}
2958
2958
  </section>
2959
2959
  `}export{ge as buildLiveCurrentCycleMetricRows,it as buildMiningActivityEntries,Oe as buildMiningLineSeries,Ze as buildMiningSetupChecklist,ke as buildMiningStrategyAnalytics,Ae as buildPlannerVisualSeries,Qe as buildVisibleRecentActions,Se as describeChainTimeHealth,w as describeClaimability,be as describeCurrentCycleDrift,Je as describeDashboardState,z as describeLiveCommitSizing,Ye as describeMiningHeaderActions,Ce as describeMiningHistoryWindow,p as describeMiningWalletRoleConflict,ee as describeRecoveryPath,_ as describeRiskMode,v as describeRuntimeStatus,d as describeSelectedWalletSuitability,m as describeStrategyMode,g as describeStrategyTransparency,tt as filterMiningActivityEntries,C as formatMiningDraftTimestamp,x as miningAddressExplorerUrl,b as miningExplorerUrl,S as miningRecentActionExplorerUrl,ft as renderMining,_e as resolveLatestSettledCycleMetrics,f as resolveMiningWalletContext,ie as resolveMiningWalletLamports,B as resolveStableMiningValue,y as shouldShowAdminRecovery,he as summarizeCurrentCycleSnapshot,ue as summarizeLatestCycleMath,h as summarizePlannerOutcomes};
2960
- //# sourceMappingURL=mining-Dg-3ll0F.js.map
2960
+ //# sourceMappingURL=mining-ClI8RW4u.js.map