@fased/fased 0.1.48 → 0.1.51

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 (157) hide show
  1. package/dist/agents/auth-health.js +11 -5
  2. package/dist/agents/current-model-catalog.js +45 -0
  3. package/dist/agents/model-catalog-source.js +28 -3
  4. package/dist/agents/provider-id.js +1 -1
  5. package/dist/brand.js +1 -1
  6. package/dist/build-info.json +3 -3
  7. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  8. package/dist/cli/lightweight/gateway-runtime-probe.js +50 -0
  9. package/dist/cli/update-cli/update-command.js +120 -0
  10. package/dist/commands/doctor-state-integrity.js +25 -2
  11. package/dist/config/sessions/transcript.js +30 -16
  12. package/dist/config/sessions.js +2 -2
  13. package/dist/control-ui/assets/{app-CHqTx3P_.js → app-wJm5kuje.js} +1274 -1259
  14. package/dist/control-ui/assets/{chat-model-ref-BbrdMKjQ.js → chat-model-ref-Cs2TTOtF.js} +2 -2
  15. package/dist/control-ui/assets/{config-FFZLTSLS.js → config-CU5Zi8Dh.js} +2 -2
  16. package/dist/control-ui/assets/{index-CFHfNlLv.js → index-vTDTf5Zv.js} +3 -3
  17. package/dist/control-ui/assets/{mining-D_VAMFMY.js → mining-BdhMn18r.js} +3 -3
  18. package/dist/control-ui/assets/{providers-DqFL6WrJ.js → providers-C0DEXi8e.js} +14 -3
  19. package/dist/control-ui/index.html +1 -1
  20. package/dist/gateway/probe-payload.js +14 -0
  21. package/dist/gateway/probe.js +8 -4
  22. package/dist/gateway/protocol/schema/agents-models-skills.js +1 -0
  23. package/dist/gateway/protocol/schema/frames.js +5 -0
  24. package/dist/gateway/protocol/schema/snapshot.js +1 -0
  25. package/dist/gateway/server/ws-connection/message-handler.js +2 -1
  26. package/dist/gateway/server-http-lazy.js +2 -4
  27. package/dist/gateway/server-http.js +3 -4
  28. package/dist/gateway/server-methods/chat.js +4 -29
  29. package/dist/gateway/server-methods/models.js +3 -2
  30. package/dist/infra/system-presence.js +4 -2
  31. package/dist/light-update-precheck.js +1 -1
  32. package/dist/light-update-status.js +1 -1
  33. package/dist/memory/inventory.js +19 -0
  34. package/dist/plugin-sdk/{accounts-DI5226U8.js → accounts-BfdIB9Ud.js} +1 -1
  35. package/dist/plugin-sdk/{actions-CEj4gOU2.js → actions-DHN_x97P.js} +2 -2
  36. package/dist/plugin-sdk/{active-listener-Ss4UKXZb.js → active-listener-CIP_Ht8d.js} +1 -1
  37. package/dist/plugin-sdk/{audio-preflight-Cu4alGjb.js → audio-preflight-CKGhXtyV.js} +26 -26
  38. package/dist/plugin-sdk/{audit-BTskqjJ_.js → audit-Cmg38KPG.js} +1 -1
  39. package/dist/plugin-sdk/{channel-access-B1KciKmw.js → channel-access-JHDguu4T.js} +1 -1
  40. package/dist/plugin-sdk/{channel-access-configure-Y91FLOJc.js → channel-access-configure-B8mwKp-Z.js} +1 -1
  41. package/dist/plugin-sdk/channel-plugin-common.d.ts +2 -2
  42. package/dist/plugin-sdk/channel-plugin-common.js +4 -4
  43. package/dist/plugin-sdk/{chunk-items-Q8HhMuSe.js → chunk-items-iKdlZyWZ.js} +1 -1
  44. package/dist/plugin-sdk/{chunk-CSUjIQSx.js → chunk-oJRyTNTL.js} +1 -1
  45. package/dist/plugin-sdk/command-status.js +26 -26
  46. package/dist/plugin-sdk/{commands-registry-DJ0pfCcY.js → commands-registry-Cjo7OjIf.js} +2 -2
  47. package/dist/plugin-sdk/{common-Cjm8psuW.js → common-Dx4sUa9f.js} +1 -1
  48. package/dist/plugin-sdk/{config-DutIeFge.js → config-DdS0zHiU.js} +80 -4
  49. package/dist/plugin-sdk/{config-schema-Cg6PYSHR.js → config-schema-BJQEjMPz.js} +2090 -523
  50. package/dist/plugin-sdk/device-pair.d.ts +1 -1
  51. package/dist/plugin-sdk/discord.d.ts +4 -4
  52. package/dist/plugin-sdk/discord.js +19 -19
  53. package/dist/plugin-sdk/{handle-action-Dp2741iu.js → handle-action-wR0x9b0c.js} +13 -13
  54. package/dist/plugin-sdk/{helpers-BCZ9d3fl.js → helpers-DkauqZNP.js} +1 -1
  55. package/dist/plugin-sdk/{image-ops-B-QR_M9Z.js → image-ops-DmSjpAeh.js} +1 -1
  56. package/dist/plugin-sdk/index.d.ts +17 -17
  57. package/dist/plugin-sdk/index.js +28 -28
  58. package/dist/plugin-sdk/{login-BFvQxf9o.js → login-DB9LIbi8.js} +3 -3
  59. package/dist/plugin-sdk/{login-qr-CERTe_nD.js → login-qr-CDhMa-c7.js} +3 -3
  60. package/dist/plugin-sdk/{manager-Dhq3SXpO.js → manager-DGZsMQWR.js} +2 -2
  61. package/dist/plugin-sdk/{markdown-tables-B1Tx7c77.js → markdown-tables-BX7JXDUV.js} +1 -1
  62. package/dist/plugin-sdk/{media-BwsqooWC.js → media-DyzsScOp.js} +2 -2
  63. package/dist/plugin-sdk/{monitor-BYzN5Qr4.js → monitor-B91PZ2mD.js} +31 -31
  64. package/dist/plugin-sdk/{monitor-CJiacqtR.js → monitor-BH9rTJFq.js} +30 -30
  65. package/dist/plugin-sdk/{openresponses-http-VLSSqCZZ.js → openresponses-http-CmBLZ9bH.js} +26 -26
  66. package/dist/plugin-sdk/{optional-runtime-dependency-BEBP4VFJ.js → optional-runtime-dependency-DaMkPVe_.js} +1 -1
  67. package/dist/plugin-sdk/{outbound-BqWgaC5M.js → outbound-X-m2mBZn.js} +6 -6
  68. package/dist/plugin-sdk/{outbound-attachment-L1q40kiu.js → outbound-attachment-M0NCUSG-.js} +2 -2
  69. package/dist/plugin-sdk/{pairing-message-DWXHX-jt.d.ts → pairing-message-BaQiXKLE.d.ts} +1 -1
  70. package/dist/plugin-sdk/{pairing-message-CZBahREg.js → pairing-message-hnmpJlW2.js} +1 -1
  71. package/dist/plugin-sdk/{pairing-store-D7I1Qmiw.js → pairing-store-DyghUm9G.js} +2 -2
  72. package/dist/plugin-sdk/{pi-model-discovery-C5klknQZ.js → pi-model-discovery-ReorOh7W.js} +1 -1
  73. package/dist/plugin-sdk/{pi-model-discovery-runtime-DIEMhCZ5.js → pi-model-discovery-runtime-C-CHZo03.js} +2 -2
  74. package/dist/plugin-sdk/provider-web-search-config-contract.d.ts +1 -1
  75. package/dist/plugin-sdk/{pw-ai-Bv-q25gY.js → pw-ai-D_gli3_r.js} +3 -3
  76. package/dist/plugin-sdk/{replies-Bd9ktEkq.js → replies-Djyehmcu.js} +2 -2
  77. package/dist/plugin-sdk/{resolve-outbound-target-CCIyBb5H.js → resolve-outbound-target-Chznq8rS.js} +1 -1
  78. package/dist/plugin-sdk/{resolve-route-B7vZ3nKp.js → resolve-route-Ce08Fx-G.js} +1 -1
  79. package/dist/plugin-sdk/{retry-policy-ChC3G4lv.js → retry-policy-eS25atAo.js} +1 -1
  80. package/dist/plugin-sdk/{runtime-BLknHFGz.js → runtime-Cv3gX3Wc.js} +31 -18
  81. package/dist/plugin-sdk/{runtime-dependency-C5rJfC0u.js → runtime-dependency-p_iKbESf.js} +2 -2
  82. package/dist/plugin-sdk/sat-runtime.d.ts +2 -2
  83. package/dist/plugin-sdk/sat-runtime.js +5 -5
  84. package/dist/plugin-sdk/{send-Bd3Z-jAd.js → send-B3RAELvw.js} +6 -6
  85. package/dist/plugin-sdk/{send-Bmtz9ICm.js → send-BuPGxx3-.js} +8 -8
  86. package/dist/plugin-sdk/{send-mkyZzhCO.js → send-C-jaxZJG.js} +5 -5
  87. package/dist/plugin-sdk/{send-CUGEhiUa.js → send-CSob7dn9.js} +6 -6
  88. package/dist/plugin-sdk/{send-CMoWt-EX.js → send-CsLJsIvv.js} +7 -7
  89. package/dist/plugin-sdk/{session-D2zmelOL.js → session-DKJGakm1.js} +2 -2
  90. package/dist/plugin-sdk/{skill-commands-BybEjJ1_.js → skill-commands-BqpZG5nW.js} +2 -2
  91. package/dist/plugin-sdk/{slack-DogXvGG3.js → slack-CQqN9uBH.js} +38 -38
  92. package/dist/plugin-sdk/{slack-actions-uXb55QWW.js → slack-actions-DlbVH5SS.js} +11 -11
  93. package/dist/plugin-sdk/slack.d.ts +4 -4
  94. package/dist/plugin-sdk/slack.js +9 -9
  95. package/dist/plugin-sdk/{sticker-cache-BuPw7fTf.js → sticker-cache-CDyt2ZMh.js} +3 -3
  96. package/dist/plugin-sdk/{tables-CVDOT5dX.js → tables-Cij4iAXw.js} +1 -1
  97. package/dist/plugin-sdk/{targets-DskkhJAp.js → targets-VrYeAmeT.js} +1 -1
  98. package/dist/plugin-sdk/{telegram-actions-_KQPbjpI.js → telegram-actions-ZwUBOkwa.js} +29 -29
  99. package/dist/plugin-sdk/telegram.d.ts +4 -4
  100. package/dist/plugin-sdk/telegram.js +8 -8
  101. package/dist/plugin-sdk/{thread-bindings.lifecycle-CrhQXYEU.js → thread-bindings.lifecycle-BWIzwpPM.js} +3 -3
  102. package/dist/plugin-sdk/{thread-bindings.state-ssxdG7xV.js → thread-bindings.state-CpAQrGco.js} +2 -2
  103. package/dist/plugin-sdk/{tmp-fased-dir-Be1wBhVz.d.ts → tmp-fased-dir-DLba1ePP.d.ts} +1 -1
  104. package/dist/plugin-sdk/{types-CXLEOrJX.d.ts → types-CKR2Lvsa.d.ts} +1 -1
  105. package/dist/plugin-sdk/{types-CJGVZX6j.d.ts → types-NR-f-rw-.d.ts} +3 -3
  106. package/dist/plugin-sdk/{wallet-status-CQI89c_6.js → wallet-status-ClmXigGN.js} +10 -3
  107. package/dist/plugin-sdk/{web-C8DwA0eO.js → web-BK2j9z6c.js} +31 -31
  108. package/dist/plugin-sdk/{whatsapp-actions-DfvM-mlZ.js → whatsapp-actions-CaenMy79.js} +13 -13
  109. package/dist/plugin-sdk/{whatsapp-heartbeat-DyJasLDB.js → whatsapp-heartbeat-Cr9K5Sil.js} +2 -2
  110. package/dist/plugin-sdk/whatsapp.d.ts +11 -11
  111. package/dist/plugin-sdk/whatsapp.js +12 -12
  112. package/dist/plugin-sdk/{wsl-JwmI6Zu8.js → wsl-D_I-iL4U.js} +3 -3
  113. package/dist/plugin-sdk/{zod-schema.providers-core-BE_5DNhj.d.ts → zod-schema.providers-core-CIzCjXH9.d.ts} +71 -71
  114. package/dist/plugins/status-cache.js +1 -1
  115. package/dist/providers/refresh.js +1 -1
  116. package/dist/providers/refreshed-model-capabilities.js +1935 -406
  117. package/dist/providers/registry.js +14 -3
  118. package/dist/version.js +11 -1
  119. package/extensions/acpx/package.json +1 -1
  120. package/extensions/bluebubbles/package.json +1 -1
  121. package/extensions/copilot-proxy/package.json +1 -1
  122. package/extensions/diagnostics-otel/package.json +1 -1
  123. package/extensions/fased-federation/package.json +1 -1
  124. package/extensions/google-gemini-cli-auth/package.json +1 -1
  125. package/extensions/imessage/package.json +1 -1
  126. package/extensions/irc/package.json +1 -1
  127. package/extensions/line/package.json +1 -1
  128. package/extensions/llm-task/package.json +1 -1
  129. package/extensions/lobster/package.json +1 -1
  130. package/extensions/matrix/CHANGELOG.md +18 -0
  131. package/extensions/matrix/package.json +1 -1
  132. package/extensions/mattermost/package.json +1 -1
  133. package/extensions/memory-core/package.json +2 -2
  134. package/extensions/memory-lancedb/package.json +1 -1
  135. package/extensions/minimax-portal-auth/package.json +1 -1
  136. package/extensions/msteams/CHANGELOG.md +18 -0
  137. package/extensions/msteams/package.json +1 -1
  138. package/extensions/nextcloud-talk/package.json +1 -1
  139. package/extensions/nostr/CHANGELOG.md +18 -0
  140. package/extensions/nostr/package.json +1 -1
  141. package/extensions/open-prose/package.json +1 -1
  142. package/extensions/sat-mining/index.ts +121 -12
  143. package/extensions/sat-mining/package.json +1 -1
  144. package/extensions/sat-mining/src/runtime.ts +9 -3
  145. package/extensions/signal/package.json +1 -1
  146. package/extensions/synology-chat/package.json +1 -1
  147. package/extensions/tlon/package.json +1 -1
  148. package/extensions/twitch/CHANGELOG.md +18 -0
  149. package/extensions/twitch/package.json +1 -1
  150. package/extensions/voice-call/CHANGELOG.md +18 -0
  151. package/extensions/voice-call/package.json +1 -1
  152. package/extensions/zalo/CHANGELOG.md +18 -0
  153. package/extensions/zalo/package.json +1 -1
  154. package/extensions/zalouser/CHANGELOG.md +18 -0
  155. package/extensions/zalouser/package.json +1 -1
  156. package/package.json +1 -1
  157. package/scripts/start-managed.sh +35 -1
@@ -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:`Attach a Solana wallet in onboarding first.`}}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:he({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 fe(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 pe(e){return e?.statusFresh===!1||e?.degraded===!0}function z(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 me(e){return e.degraded&&e.readinessValue?e.readinessValue:e.statusValue??e.readinessValue??null}function he(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 ge(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);return[{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`)}]}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 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:he({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 fe(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 pe(e){return e?.statusFresh===!1||e?.degraded===!0}function z(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 me(e){return e.degraded&&e.readinessValue?e.readinessValue:e.statusValue??e.readinessValue??null}function he(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 ge(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);return[{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`)}]}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 Re(e){switch(String(e??``).trim()){case`claim`:case`claimCycleRewards`:case`claimCycleRewardsBatch`:case`closeResolvedCycleAccounts`:case`closeResolvedMinerCycleState`:return!0;default:return!1}}function B(e){switch(String(e??``).trim()){case`initMinerCapital`:case`depositMinerCapital`:case`withdrawMinerCapital`:case`setActiveCommit`:return!0;default:return!1}}function V(e){let t=String(e??``).trim();return B(t)||t===`bootstrapRegistryReserve`?`wallet`:t===`startMining`||t===`stopMining`?`runtime`:`cycle`}function ze(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 Be(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 Ve(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 He(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}
@@ -92,7 +92,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
92
92
  <span>${r.cycles} cycles</span>
93
93
  </div>
94
94
  </div>
95
- `:t}function dt(e,t){if(!Array.isArray(e)||!e.length)return null;let n=Date.now(),r=0,i=0n,a=0n,o=0n,s=0n,c=new Map;for(let l of e){let e=new Date(l.recordedAt??``).getTime();if(!Number.isFinite(e)||n-e>t)continue;r+=1,i+=O(l.totalSatEarnedRaw),a+=O(l.committedLamports),o+=O(l.totalRebateLamports),s+=O(l.netLiveCostLamports);let u=P(l)??`Unknown`;c.set(u,(c.get(u)??0)+1)}if(!r)return null;let l=Array.from(c.entries()).toSorted((e,t)=>t[1]-e[1])[0]??null,u=a/BigInt(Math.max(1,r));return{cycles:r,satLabel:E(i.toString(),`SAT`),rebateLabel:E(o.toString(),`SOL`),netLabel:D(s.toString(),`SOL`),avgCapitalLabel:E(u.toString(),`SOL`),mostUsedStrategyLabel:l?`${l[0]} · ${l[1]} cycles`:`—`}}function ft(r){let s=r.profile,c=r.status,l=f({wallets:r.wallets,attachedWalletId:r.attachedWalletId,profile:s,readiness:r.readiness,status:c}),d=l.displayWallet,m=d?.address??String(c?.validatorAuthority??r.readiness?.selectedAddress??``).trim()??``,h=`mining-wallet-address`,g=c?.recentActions??[],_=c?.settledHistory??[],v=r.history?.outcomes??_,y=qe({status:c,readiness:r.readiness,actionBusy:r.actionBusy,pendingAction:r.pendingAction}),b=Ye(r.mainnetSync),S=pe(c),C=ie({status:c,readiness:r.readiness,selectedWallet:d}),te=z({statusValue:c?.currentSatBalanceRaw,readinessValue:r.readiness?.balances.satBalanceRaw,degraded:S}),T=me({statusValue:c?.currentCapitalAddress,readinessValue:r.readiness?.balances.minerCapitalAddress,degraded:S}),D=x(c?.network??s?.network,T),O=BigInt(z({statusValue:c?.currentCapitalFundedLamports,readinessValue:r.readiness?.balances.minerCapitalFundedLamports,degraded:S})),k=BigInt(z({statusValue:c?.currentCapitalLockedLamports,readinessValue:r.readiness?.balances.minerCapitalLockedLamports,degraded:S})),A=BigInt(z({statusValue:c?.currentCapitalFreeLamports,readinessValue:r.readiness?.balances.minerCapitalFreeLamports,degraded:S})),j=BigInt(z({statusValue:c?.activeCommitLamports,readinessValue:r.readiness?.balances.minerCapitalActiveCommitLamports,degraded:S,fallback:s?.funding.commitLamports??`250000000`})),ae=BigInt(c?.signerSpendableLamports??`0`),oe=BigInt(c?.nextSubmitCycleSignerLamports??`0`),M=a({walletLamports:C,capitalFundedLamports:O,capitalFreeLamports:A,capitalLockedLamports:k,pendingCycleCount:c?.currentCapitalPendingCycleCount,signerReserveLamports:c?.signerReserveLamports,signerFeeBufferLamports:c?.signerFeeBufferLamports}),N=M.minimumCommitLamports,P=BigInt(s?.funding.commitLamports??`250000000`),F=Me(N,O>0n?O:M.safeMaxCommitLamports,P),I=je(P,N,F),le=s?.strategyPreset??c?.strategyPreset??o(s?.riskMode??c?.riskMode??`balanced`),L=s?.strategyExecution??c?.strategyExecution??i(s?.strategyMode??c?.strategyMode),ue=L===`auto`,fe=ue?`Target max`:`Target`,he=O>0n,ge=ue?`Target max`:`Target`,ve=O>=N,ye=O>0n&&O<N&&k===0n&&Number(c?.currentCapitalPendingCycleCount??0)===0,be=P>=N&&M.safeMaxCommitLamports>=N,xe=P>=N&&P>M.safeMaxCommitLamports,Se=E(M.minimumCapitalForMinimumCommitLamports.toString(),`SOL`),we=M.safeMaxCommitLamports>=N?`${E(M.safeMaxCommitLamports.toString(),`SOL`)} SOL`:`<0.25 SOL`,Ee=P>=N&&M.safeMaxCommitLamports>=N&&P>M.safeMaxCommitLamports,De=Number(c?.currentCapitalPendingCycleCount??0),Ae=Number(c?.claimBacklog?.total??0),Ie=Number(c?.claimBacklog?.ready??0),Le=Number(c?.claimBacklog?.failed??0),Re=Number(c?.claimBatchCycles??5),B=Ae>0?`${Ae} pending claim ${Ae===1?`cycle`:`cycles`} · ${Ie} ready · ${Le} failed retry · batch ${Re}`:`No durable claim backlog. Auto-claim batch cap is ${Re}.`,V=`Your desired commit when capital is free.`,ze=M.safeMaxCommitLamports>=N?`Maximum commit usable now.`:`Need ${Se} SOL free.`,Ve=he?`Commit currently stored on-chain.`:`Saved commit preference. No miner capital is funded, so this is not stuck or withdrawable SOL.`,He=he?`${we} usable now · ${E(k.toString(),`SOL`)} SOL locked${Ee?` · target kept for later`:``}`:`No miner capital funded · ${E(j.toString(),`SOL`)} SOL stored preference`,H=p({defaultWalletId:r.defaultWalletId,attachedWalletId:r.attachedWalletId,profile:s,readiness:r.readiness,status:c}),We=r.readiness?.checks.find(e=>e.key===`walletSelected`)?.ok,Ge=r.readiness?.checks.find(e=>e.key===`rpcReady`)?.ok,Ke=r.readiness?.checks.find(e=>e.key===`fundingReady`)?.ok,U=ye?`Withdraw ${E(A.toString(),`SOL`)} SOL or deposit enough to reach the 0.25 SOL miner-capital minimum.`:`Deposit to Mining.`,W=r.actionBusy,Qe=oe>0n&&ae<oe,tt=W||A<=0n,nt=A>0n?`Withdraw free miner capital back to the mining wallet.`:`No free miner capital is available to withdraw. Wallet SOL is already in the wallet.`,rt=_e(c),ft=!!c?.drainOnly&&k===0n&&De===0,K=!!c?.enabledWanted&&!ft,pt=!!c?.drainOnly&&!ft,mt=String(c?.workers?.roundWatcher?.waitingReason??``).trim(),ht=Ze({minerEnabled:K,currentCycleId:c?.currentCycleId,waitingReason:mt,skipTimestamp:c?.workers?.roundWatcher?.lastRunAt??c?.updatedAt??new Date().toISOString(),recentActions:g}).slice(0,5),gt=[{value:`spread`,label:`Spread`,detail:`Smoother coverage and lower concentration risk.`},{value:`balanced`,label:`Balanced`,detail:`Moderate concentration with practical upside.`},{value:`conviction`,label:`Conviction`,detail:`Tighter concentration for higher variance.`},{value:`swarm`,label:`Swarm`,detail:`Flexible clustered coverage for active mining.`},{value:`top_k`,label:`Top-K`,detail:`Sparse high-conviction allocation into the strongest ranked buckets.`},{value:`ranked`,label:`Ranked`,detail:`Rank buckets, then convert rank into weighted exposure with a tail.`},{value:`adaptive`,label:`Adaptive`,detail:`Blend stable coverage with cycle-ranked opportunity and fallback safety.`},{value:`crowd_aware`,label:`Crowd-aware`,detail:`Reduce obvious crowding exposure with wider tail coverage.`},{value:`safe_fallback`,label:`Safe fallback`,detail:`Known-good balanced allocation for recovery or low-confidence operation.`}],_t=[{value:`deterministic`,label:`Deterministic`,detail:`Use the fixed allocator every cycle. Safer default until auto has enough live evidence.`},{value:`auto`,label:`Auto`,detail:`Let the planner size and choose the cycle path, with deterministic fallback when needed.`}],vt=s?.network===`mainnet-beta`&&r.mainnetSync?.state!==`synced`,yt=H!=null||vt||!r.readiness?.ok||!s?.walletId||!We||!Ge||!Ke||!ve||!be,bt=H?H.title:vt?b.detail:!s?.walletId||!We?`Configure`:Ge?Ke?r.readiness?.ok?ve?be?K?`Mining is already enabled`:`Start mining.`:xe?M.safeMaxCommitLamports>=N?`Target can be saved. Safe commit is ${E(M.safeMaxCommitLamports.toString(),`SOL`)} SOL.`:`Need ${Se} SOL free for the minimum 0.25 SOL commit.`:`Lower target.`:U:y.detail:`Deposit to Wallet.`:`Set RPC.`,xt=Xe({walletReady:!!(s?.walletId&&We&&!H),feeReady:!!(Ke&&!Qe),capitalReady:ve,activeCommitReady:j>=N&&j<=M.safeMaxCommitLamports,started:K,clearing:pt||y.label===`Clearing`}),q=Je({actionBusy:r.actionBusy,pendingAction:r.pendingAction,minerEnabled:K,drainOnly:pt,startPrerequisitesBlocked:yt,startBlockedReason:bt}),St=q.startBlocked,Ct=!K&&y.label===`Ready`&&St?{label:`Stopped`,tone:H?`danger`:`warn`,detail:bt}:!K&&ye?{label:`Stopped`,tone:`warn`,detail:U}:y,wt=!K&&y.label===`Ready`&&St&&bt!==`Start mining.`&&!H,Tt=ee(r.recovery),J=w({profile:s,status:c,readiness:r.readiness}),Et=J.title===`Blocked`||J.title===`Need SOL`||J.title===`Need capital`||J.title===`Capital locked`||J.title===`Need free capital`,Dt=Date.now(),Ot=Te(r.plannerWindow),kt=Te(r.activityWindow),At=r.history?v:_.filter(e=>{let t=new Date(e.recordedAt??``).getTime();return Number.isFinite(t)&&(Ot==null||Dt-t<=Ot)}),Y=Oe(At),X=ke(At),jt=!!c?.recentActions?.some(e=>e.status===`success`&&e.action===`submitCycle`&&typeof c.currentCycleId==`number`&&e.cycleId===c.currentCycleId),Mt=l.title!==`Singleton mining wallet`,Z=Y.length>0?Y[Y.length-1]:null,Nt=$e(ht),Pt=r.history?.actions??Nt,Ft=r.history?.activityOutcomes??v,It=et(it({error:r.error,message:r.message,notifications:r.notifications,status:c,profile:s,recentActions:Pt,settledHistory:Ft,recoveryBlocked:!!(c?.blocked||r.recovery?.blocked),recoveryTitle:Tt.title,recoveryDetail:r.recovery?.detail??Tt.detail,showBlockingNote:Et,claimabilityTitle:J.title,claimabilityDetail:J.detail,signerRentShortfall:Qe,signerRentShortfallMessage:Qe?`Leave at least ${E(oe.toString(),`SOL`)} SOL in Wallet for cycle creation and fees.`:null,recentOnly:!1}),`all`).filter(e=>{if(kt==null)return!0;let t=new Date(e.at??``).getTime();return Number.isFinite(t)&&Dt-t<=kt}),Lt=Math.max(1,Math.ceil(It.length/30)),Rt=Math.min(r.recentActionsPage,Lt),zt=(Rt-1)*30,Bt=It.slice(zt,zt+30),Vt=Y[0]?.timeLabel??null,Ht=Z?.timeLabel??null,Ut=c?.liveCycleReport??null,Wt=typeof c?.currentCycleId==`number`?c.currentCycleId:typeof Ut?.cycleId==`number`?Ut.cycleId:null,Gt=Ut?.committedLamports??`0`,Kt=R(Gt),qt=de(Ut?.validMinerCount),Jt=Ut?.totalCommittedLamports??(Kt?Gt:null),Yt=Z?.cycleId??Wt,Xt=Z?.commitLabel??(Kt?E(Gt,`SOL`):`—`),Zt=[Z?.strategyLabel??se(le),Z?.executionLabel??ce(L)].filter(Boolean).join(` · `),Qt=1440*60*1e3,$t=v.filter(e=>{let t=new Date(e.recordedAt??``).getTime();return Number.isFinite(t)&&Dt-t<=Qt}),Q=dt($t,Qt),en=Oe($t,{maxPoints:24}),$=Ce({plannerWindow:r.plannerWindow,visibleCycleCount:At.length,matchingCycleCount:r.history?.matchingOutcomeCount??At.length,sampled:r.history?.sampled??!1,rangeStart:Vt,rangeEnd:Ht,latestPoint:Z,currentCycleSubmitted:jt,currentCycleId:c?.currentCycleId??null}),tn=t=>e`<div class="mining-metric__rows">
95
+ `:t}function dt(e,t){if(!Array.isArray(e)||!e.length)return null;let n=Date.now(),r=0,i=0n,a=0n,o=0n,s=0n,c=new Map;for(let l of e){let e=new Date(l.recordedAt??``).getTime();if(!Number.isFinite(e)||n-e>t)continue;r+=1,i+=O(l.totalSatEarnedRaw),a+=O(l.committedLamports),o+=O(l.totalRebateLamports),s+=O(l.netLiveCostLamports);let u=P(l)??`Unknown`;c.set(u,(c.get(u)??0)+1)}if(!r)return null;let l=Array.from(c.entries()).toSorted((e,t)=>t[1]-e[1])[0]??null,u=a/BigInt(Math.max(1,r));return{cycles:r,satLabel:E(i.toString(),`SAT`),rebateLabel:E(o.toString(),`SOL`),netLabel:D(s.toString(),`SOL`),avgCapitalLabel:E(u.toString(),`SOL`),mostUsedStrategyLabel:l?`${l[0]} · ${l[1]} cycles`:`—`}}function ft(r){let s=r.profile,c=r.status,l=f({wallets:r.wallets,attachedWalletId:r.attachedWalletId,profile:s,readiness:r.readiness,status:c}),d=l.displayWallet,m=d?.address??String(c?.validatorAuthority??r.readiness?.selectedAddress??``).trim()??``,h=`mining-wallet-address`,g=c?.recentActions??[],_=c?.settledHistory??[],v=r.history?.outcomes??_,y=qe({status:c,readiness:r.readiness,actionBusy:r.actionBusy,pendingAction:r.pendingAction}),b=Ye(r.mainnetSync),S=pe(c),C=ie({status:c,readiness:r.readiness,selectedWallet:d}),te=z({statusValue:c?.currentSatBalanceRaw,readinessValue:r.readiness?.balances.satBalanceRaw,degraded:S}),T=me({statusValue:c?.currentCapitalAddress,readinessValue:r.readiness?.balances.minerCapitalAddress,degraded:S}),D=x(c?.network??s?.network,T),O=BigInt(z({statusValue:c?.currentCapitalFundedLamports,readinessValue:r.readiness?.balances.minerCapitalFundedLamports,degraded:S})),k=BigInt(z({statusValue:c?.currentCapitalLockedLamports,readinessValue:r.readiness?.balances.minerCapitalLockedLamports,degraded:S})),A=BigInt(z({statusValue:c?.currentCapitalFreeLamports,readinessValue:r.readiness?.balances.minerCapitalFreeLamports,degraded:S})),j=BigInt(z({statusValue:c?.activeCommitLamports,readinessValue:r.readiness?.balances.minerCapitalActiveCommitLamports,degraded:S,fallback:s?.funding.commitLamports??`250000000`})),ae=BigInt(c?.signerSpendableLamports??`0`),oe=BigInt(c?.nextSubmitCycleSignerLamports??`0`),M=a({walletLamports:C,capitalFundedLamports:O,capitalFreeLamports:A,capitalLockedLamports:k,pendingCycleCount:c?.currentCapitalPendingCycleCount,signerReserveLamports:c?.signerReserveLamports,signerFeeBufferLamports:c?.signerFeeBufferLamports}),N=M.minimumCommitLamports,P=BigInt(s?.funding.commitLamports??`250000000`),F=Me(N,O>0n?O:M.safeMaxCommitLamports,P),I=je(P,N,F),le=s?.strategyPreset??c?.strategyPreset??o(s?.riskMode??c?.riskMode??`balanced`),L=s?.strategyExecution??c?.strategyExecution??i(s?.strategyMode??c?.strategyMode),ue=L===`auto`,fe=ue?`Target max`:`Target`,he=O>0n,ge=ue?`Target max`:`Target`,ve=O>=N,ye=O>0n&&O<N&&k===0n&&Number(c?.currentCapitalPendingCycleCount??0)===0,be=P>=N&&M.safeMaxCommitLamports>=N,xe=P>=N&&P>M.safeMaxCommitLamports,Se=E(M.minimumCapitalForMinimumCommitLamports.toString(),`SOL`),we=M.safeMaxCommitLamports>=N?`${E(M.safeMaxCommitLamports.toString(),`SOL`)} SOL`:`<0.25 SOL`,Ee=P>=N&&M.safeMaxCommitLamports>=N&&P>M.safeMaxCommitLamports,De=Number(c?.currentCapitalPendingCycleCount??0),Ae=Number(c?.claimBacklog?.total??0),Ie=Number(c?.claimBacklog?.ready??0),Le=Number(c?.claimBacklog?.failed??0),Re=Number(c?.claimBatchCycles??5),B=Ae>0?`${Ae} pending claim ${Ae===1?`cycle`:`cycles`} · ${Ie} ready · ${Le} failed retry · batch ${Re}`:`No durable claim backlog. Auto-claim batch cap is ${Re}.`,V=`Your desired commit when capital is free.`,ze=M.safeMaxCommitLamports>=N?`Maximum commit usable now.`:`Need ${Se} SOL free.`,Ve=he?`Commit currently stored on-chain.`:`Saved commit preference. No miner capital is funded, so this is not stuck or withdrawable SOL.`,He=he?`${we} usable now · ${E(k.toString(),`SOL`)} SOL locked${Ee?` · target kept for later`:``}`:`No miner capital funded · ${E(j.toString(),`SOL`)} SOL stored preference`,H=p({defaultWalletId:r.defaultWalletId,attachedWalletId:r.attachedWalletId,profile:s,readiness:r.readiness,status:c}),We=r.readiness?.checks.find(e=>e.key===`walletSelected`)?.ok,Ge=r.readiness?.checks.find(e=>e.key===`rpcReady`)?.ok,Ke=r.readiness?.checks.find(e=>e.key===`fundingReady`)?.ok,U=ye?`Withdraw ${E(A.toString(),`SOL`)} SOL or deposit enough to reach the 0.25 SOL miner-capital minimum.`:`Deposit to Mining.`,W=r.actionBusy,Qe=oe>0n&&ae<oe,tt=W||A<=0n,nt=A>0n?`Withdraw free miner capital back to the mining wallet.`:`No free miner capital is available to withdraw. Wallet SOL is already in the wallet.`,rt=_e(c),ft=!!c?.drainOnly&&k===0n&&De===0,K=!!c?.enabledWanted&&!ft,pt=!!c?.drainOnly&&!ft,mt=String(c?.workers?.roundWatcher?.waitingReason??``).trim(),ht=Ze({minerEnabled:K,currentCycleId:c?.currentCycleId,waitingReason:mt,skipTimestamp:c?.workers?.roundWatcher?.lastRunAt??c?.updatedAt??new Date().toISOString(),recentActions:g}).slice(0,5),gt=[{value:`spread`,label:`Spread`,detail:`Smoother coverage and lower concentration risk.`},{value:`balanced`,label:`Balanced`,detail:`Moderate concentration with practical upside.`},{value:`conviction`,label:`Conviction`,detail:`Tighter concentration for higher variance.`},{value:`swarm`,label:`Swarm`,detail:`Flexible clustered coverage for active mining.`},{value:`top_k`,label:`Top-K`,detail:`Sparse high-conviction allocation into the strongest ranked buckets.`},{value:`ranked`,label:`Ranked`,detail:`Rank buckets, then convert rank into weighted exposure with a tail.`},{value:`adaptive`,label:`Adaptive`,detail:`Blend stable coverage with cycle-ranked opportunity and fallback safety.`},{value:`crowd_aware`,label:`Crowd-aware`,detail:`Reduce obvious crowding exposure with wider tail coverage.`},{value:`safe_fallback`,label:`Safe fallback`,detail:`Known-good balanced allocation for recovery or low-confidence operation.`}],_t=[{value:`deterministic`,label:`Deterministic`,detail:`Use the fixed allocator every cycle. Safer default until auto has enough live evidence.`},{value:`auto`,label:`Auto`,detail:`Let the planner size and choose the cycle path, with deterministic fallback when needed.`}],vt=s?.network===`mainnet-beta`&&r.mainnetSync?.state!==`synced`,yt=H!=null||vt||!r.readiness?.ok||!s?.walletId||!We||!Ge||!Ke||!ve||!be,bt=H?H.title:vt?b.detail:!s?.walletId||!We?`Create or select Mining wallet.`:Ge?Ke?r.readiness?.ok?ve?be?K?`Mining is already enabled`:`Start mining.`:xe?M.safeMaxCommitLamports>=N?`Target can be saved. Safe commit is ${E(M.safeMaxCommitLamports.toString(),`SOL`)} SOL.`:`Need ${Se} SOL free for the minimum 0.25 SOL commit.`:`Lower target.`:U:y.detail:`Deposit to Wallet.`:`Set RPC.`,xt=Xe({walletReady:!!(s?.walletId&&We&&!H),feeReady:!!(Ke&&!Qe),capitalReady:ve,activeCommitReady:j>=N&&j<=M.safeMaxCommitLamports,started:K,clearing:pt||y.label===`Clearing`}),q=Je({actionBusy:r.actionBusy,pendingAction:r.pendingAction,minerEnabled:K,drainOnly:pt,startPrerequisitesBlocked:yt,startBlockedReason:bt}),St=q.startBlocked,Ct=!K&&y.label===`Ready`&&St?{label:`Stopped`,tone:H?`danger`:`warn`,detail:bt}:!K&&ye?{label:`Stopped`,tone:`warn`,detail:U}:y,wt=!K&&y.label===`Ready`&&St&&bt!==`Start mining.`&&!H,Tt=ee(r.recovery),J=w({profile:s,status:c,readiness:r.readiness}),Et=J.title===`Blocked`||J.title===`Need SOL`||J.title===`Need capital`||J.title===`Capital locked`||J.title===`Need free capital`,Dt=Date.now(),Ot=Te(r.plannerWindow),kt=Te(r.activityWindow),At=r.history?v:_.filter(e=>{let t=new Date(e.recordedAt??``).getTime();return Number.isFinite(t)&&(Ot==null||Dt-t<=Ot)}),Y=Oe(At),X=ke(At),jt=!!c?.recentActions?.some(e=>e.status===`success`&&e.action===`submitCycle`&&typeof c.currentCycleId==`number`&&e.cycleId===c.currentCycleId),Mt=l.title!==`Singleton mining wallet`,Z=Y.length>0?Y[Y.length-1]:null,Nt=$e(ht),Pt=r.history?.actions??Nt,Ft=r.history?.activityOutcomes??v,It=et(it({error:r.error,message:r.message,notifications:r.notifications,status:c,profile:s,recentActions:Pt,settledHistory:Ft,recoveryBlocked:!!(c?.blocked||r.recovery?.blocked),recoveryTitle:Tt.title,recoveryDetail:r.recovery?.detail??Tt.detail,showBlockingNote:Et,claimabilityTitle:J.title,claimabilityDetail:J.detail,signerRentShortfall:Qe,signerRentShortfallMessage:Qe?`Leave at least ${E(oe.toString(),`SOL`)} SOL in Wallet for cycle creation and fees.`:null,recentOnly:!1}),`all`).filter(e=>{if(kt==null)return!0;let t=new Date(e.at??``).getTime();return Number.isFinite(t)&&Dt-t<=kt}),Lt=Math.max(1,Math.ceil(It.length/30)),Rt=Math.min(r.recentActionsPage,Lt),zt=(Rt-1)*30,Bt=It.slice(zt,zt+30),Vt=Y[0]?.timeLabel??null,Ht=Z?.timeLabel??null,Ut=c?.liveCycleReport??null,Wt=typeof c?.currentCycleId==`number`?c.currentCycleId:typeof Ut?.cycleId==`number`?Ut.cycleId:null,Gt=Ut?.committedLamports??`0`,Kt=R(Gt),qt=de(Ut?.validMinerCount),Jt=Ut?.totalCommittedLamports??(Kt?Gt:null),Yt=Z?.cycleId??Wt,Xt=Z?.commitLabel??(Kt?E(Gt,`SOL`):`—`),Zt=[Z?.strategyLabel??se(le),Z?.executionLabel??ce(L)].filter(Boolean).join(` · `),Qt=1440*60*1e3,$t=v.filter(e=>{let t=new Date(e.recordedAt??``).getTime();return Number.isFinite(t)&&Dt-t<=Qt}),Q=dt($t,Qt),en=Oe($t,{maxPoints:24}),$=Ce({plannerWindow:r.plannerWindow,visibleCycleCount:At.length,matchingCycleCount:r.history?.matchingOutcomeCount??At.length,sampled:r.history?.sampled??!1,rangeStart:Vt,rangeEnd:Ht,latestPoint:Z,currentCycleSubmitted:jt,currentCycleId:c?.currentCycleId??null}),tn=t=>e`<div class="mining-metric__rows">
96
96
  ${t.map(t=>e`<div
97
97
  class=${t.wide?`mining-metric__row mining-metric__row--wide`:`mining-metric__row`}
98
98
  title=${t.title??``}
@@ -2937,4 +2937,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
2937
2937
  </div>`:t}
2938
2938
  </section>
2939
2939
  `}export{it as buildMiningActivityEntries,Oe as buildMiningLineSeries,Xe as buildMiningSetupChecklist,ke as buildMiningStrategyAnalytics,Ae as buildPlannerVisualSeries,Ze as buildVisibleRecentActions,Se as describeChainTimeHealth,w as describeClaimability,be as describeCurrentCycleDrift,qe as describeDashboardState,fe as describeLiveCommitSizing,Je 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,et 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,z as resolveStableMiningValue,y as shouldShowAdminRecovery,ge as summarizeCurrentCycleSnapshot,ue as summarizeLatestCycleMath,h as summarizePlannerOutcomes};
2940
- //# sourceMappingURL=mining-D_VAMFMY.js.map
2940
+ //# sourceMappingURL=mining-BdhMn18r.js.map
@@ -1,4 +1,4 @@
1
- import{a as e,r as t,t as n}from"./icons-D3-vEvih.js";import{A as r,C as i,D as a,E as o,F as s,I as c,M as l,N as u,O as d,P as f,R as p,S as m,T as h,_ as g,b as _,c as v,d as y,f as b,g as x,h as S,j as ee,k as te,l as ne,m as re,p as ie,s as ae,t as oe,u as C,v as w,w as T,x as E,y as D}from"./chat-model-ref-BbrdMKjQ.js";import{buildOrderedProviderProfiles as se,buildProviderAuthSummary as O,calloutClassForProviderAuthActionTone as k}from"./config-FFZLTSLS.js";function A(e){return e===`api-key`?`api`:e===`token`?`token`:e===`manual`?`manual`:`interactive`}function j(e){return{id:e.id,label:e.label,routeIds:[...new Set([...e.methods.map(e=>e.route),...e.routeAliases??[]])],authMethods:e.methods.map(e=>({kind:A(e.kind),providerId:e.configProviderId??e.route,statusProviderId:e.statusRoute,methodId:e.id,label:e.label,buttonLabel:e.buttonLabel,reason:e.hint,setupRequirement:e.setupRequirement})),modelProviderIds:e.modelProviderIds,modelRefs:e.models.recommended}}var M=[j(E),j(ae),j(ne),j(_),j(x),j(r),j(g),j(D),j(ie),j(l),j(w),j(ee),j(v),j(i),j(h),j(f),j(T),j(y),j(te),j(m),j(u),j(o),j(a),j(re),j(d),j(S),j(C),j(b)],N={anthropic:`Anthropic API key`,byteplus:`BytePlus API key`,chutes:`Chutes API key`,gemini:`Google Gemini API key`,google:`Google Gemini API key`,huggingface:`Hugging Face token`,"kimi-code":`Kimi Code API key`,"kimi-coding":`Kimi Code API key`,litellm:`LiteLLM API key`,minimax:`MiniMax API key`,"minimax-cn":`MiniMax CN API key`,"minimax-lightning":`MiniMax Highspeed API key`,mistral:`Mistral API key`,moonshot:`Moonshot API key`,"moonshot-cn":`Moonshot CN API key`,opencode:`OpenCode Zen API key`,"opencode-zen":`OpenCode Zen API key`,openai:`OpenAI API key`,openrouter:`OpenRouter API key`,qianfan:`Qianfan API key`,qwen:`Qwen DashScope API key`,"qwen-coding-plan":`Qwen Coding Plan API key`,synthetic:`Synthetic API key`,together:`Together AI API key`,venice:`Venice API key`,"vercel-ai-gateway":`Vercel AI API key`,volcengine:`Volcano Engine API key`,xai:`xAI API key`,xiaomi:`Xiaomi API key`,zai:`Z.AI API key`,"zai-cn":`Z.AI CN API key`,"zai-coding-cn":`Z.AI Coding CN API key`,"zai-coding-global":`Z.AI Coding Global API key`},P={anthropic:`Sign in`,chutes:`Sign in`,"copilot-proxy":`Proxy sign in`,"github-copilot":`GitHub sign in`,"google-gemini-cli":`Sign in`,"minimax-portal":`Sign in`,"openai-codex":`Sign in`,xai:`xAI sign-in`},F={"cloudflare-ai-gateway":`Cloudflare AI uses the Configure form for Account ID, Gateway ID, and Anthropic API key.`,"copilot-proxy":`Copilot Proxy uses a local sign-in/proxy flow, not API-key setup.`,"github-copilot":`GitHub Copilot uses GitHub device login, not API-key setup.`,"google-gemini-cli":`Google Gemini CLI uses OAuth. Use the Google provider row for Gemini API keys.`,"minimax-portal":`MiniMax Portal uses OAuth. Use the MiniMax provider row for API keys.`,"openai-codex":`OpenAI sign-in uses ChatGPT OAuth. Use the OpenAI provider row for OpenAI API keys.`,ollama:`Ollama needs native endpoint/model fields, not generic API-key setup.`,lmstudio:`LM Studio needs endpoint/model fields, not generic API-key setup.`,vllm:`vLLM needs endpoint/model fields, not API-key setup.`},I={gemini:`Use the Google Gemini CLI row for OAuth, or save a Gemini API key here.`,google:`Use the Google Gemini CLI row for OAuth, or save a Gemini API key here.`,minimax:`Use the MiniMax Portal row for OAuth, or save a MiniMax API key here.`,openai:`Use OpenAI sign-in for ChatGPT OAuth, or save an OpenAI API key here.`};function L(e,t){return e?.providers.find(e=>e.provider===t)??null}function R(e,t){return e?.providers.find(e=>e.provider===t)??null}function z(e){return e===`ready`||e===`ok`||e===`configured`||e===`expiring`||e===`static`?`chip ok`:e===`missing`||e===`unauthenticated`||e===`unconfigured`?`chip warn`:e===`error`?`chip danger`:`chip`}function B(e){return e===`ready`||e===`ok`||e===`configured`||e===`expiring`||e===`static`}function V(e){return e?B(e.status)||e.profiles.some(e=>B(e.status)):!1}function H(e,t){return(t.modelProviderIds??t.routeIds).map(t=>L(e,t)).filter(e=>!!e)}function U(e){return e===`ok`?`chip ok`:e===`fail`?`chip danger`:`chip`}function W(e,t,n){return e===`ok`?t:e===`fail`?n:`unknown`}function G(n){let r=n.find(e=>e.health)?.health;return r?e`
1
+ import{a as e,r as t,t as n}from"./icons-D3-vEvih.js";import{A as r,C as i,D as a,E as o,F as s,I as c,M as l,N as u,O as d,P as f,R as p,S as m,T as h,_ as g,b as _,c as v,d as y,f as b,g as x,h as S,j as ee,k as te,l as ne,m as re,p as ie,s as ae,t as oe,u as C,v as w,w as T,x as E,y as D}from"./chat-model-ref-Cs2TTOtF.js";import{buildOrderedProviderProfiles as se,buildProviderAuthSummary as O,calloutClassForProviderAuthActionTone as k}from"./config-CU5Zi8Dh.js";function A(e){return e===`api-key`?`api`:e===`token`?`token`:e===`manual`?`manual`:`interactive`}function j(e){return{id:e.id,label:e.label,routeIds:[...new Set([...e.methods.map(e=>e.route),...e.routeAliases??[]])],authMethods:e.methods.map(e=>({kind:A(e.kind),providerId:e.configProviderId??e.route,statusProviderId:e.statusRoute,methodId:e.id,label:e.label,buttonLabel:e.buttonLabel,reason:e.hint,setupRequirement:e.setupRequirement})),modelProviderIds:e.modelProviderIds,modelRefs:e.models.recommended}}var M=[j(E),j(ae),j(ne),j(_),j(x),j(r),j(g),j(D),j(ie),j(l),j(w),j(ee),j(v),j(i),j(h),j(f),j(T),j(y),j(te),j(m),j(u),j(o),j(a),j(re),j(d),j(S),j(C),j(b)],N={anthropic:`Anthropic API key`,byteplus:`BytePlus API key`,chutes:`Chutes API key`,gemini:`Google Gemini API key`,google:`Google Gemini API key`,huggingface:`Hugging Face token`,"kimi-code":`Kimi Code API key`,"kimi-coding":`Kimi Code API key`,litellm:`LiteLLM API key`,minimax:`MiniMax API key`,"minimax-cn":`MiniMax CN API key`,"minimax-lightning":`MiniMax Highspeed API key`,mistral:`Mistral API key`,moonshot:`Moonshot API key`,"moonshot-cn":`Moonshot CN API key`,opencode:`OpenCode Zen API key`,"opencode-zen":`OpenCode Zen API key`,openai:`OpenAI API key`,openrouter:`OpenRouter API key`,qianfan:`Qianfan API key`,qwen:`Qwen DashScope API key`,"qwen-coding-plan":`Qwen Coding Plan API key`,synthetic:`Synthetic API key`,together:`Together AI API key`,venice:`Venice API key`,"vercel-ai-gateway":`Vercel AI API key`,volcengine:`Volcano Engine API key`,xai:`xAI API key`,xiaomi:`Xiaomi API key`,zai:`Z.AI API key`,"zai-cn":`Z.AI CN API key`,"zai-coding-cn":`Z.AI Coding CN API key`,"zai-coding-global":`Z.AI Coding Global API key`},P={anthropic:`Sign in`,chutes:`Sign in`,"copilot-proxy":`Proxy sign in`,"github-copilot":`GitHub sign in`,"google-gemini-cli":`Sign in`,"minimax-portal":`Sign in`,"openai-codex":`Sign in`,xai:`xAI sign-in`},F={"cloudflare-ai-gateway":`Cloudflare AI uses the Configure form for Account ID, Gateway ID, and Anthropic API key.`,"copilot-proxy":`Copilot Proxy uses a local sign-in/proxy flow, not API-key setup.`,"github-copilot":`GitHub Copilot uses GitHub device login, not API-key setup.`,"google-gemini-cli":`Google Gemini CLI uses OAuth. Use the Google provider row for Gemini API keys.`,"minimax-portal":`MiniMax Portal uses OAuth. Use the MiniMax provider row for API keys.`,"openai-codex":`OpenAI sign-in uses ChatGPT OAuth. Use the OpenAI provider row for OpenAI API keys.`,ollama:`Ollama needs native endpoint/model fields, not generic API-key setup.`,lmstudio:`LM Studio needs endpoint/model fields, not generic API-key setup.`,vllm:`vLLM needs endpoint/model fields, not API-key setup.`},I={gemini:`Use the Google Gemini CLI row for OAuth, or save a Gemini API key here.`,google:`Use the Google Gemini CLI row for OAuth, or save a Gemini API key here.`,minimax:`Use the MiniMax Portal row for OAuth, or save a MiniMax API key here.`,openai:`Use OpenAI sign-in for ChatGPT OAuth, or save an OpenAI API key here.`};function L(e,t){return e?.providers.find(e=>e.provider===t)??null}function R(e,t){return e?.providers.find(e=>e.provider===t)??null}function z(e){return e===`ready`||e===`ok`||e===`configured`||e===`expiring`||e===`static`?`chip ok`:e===`missing`||e===`unauthenticated`||e===`unconfigured`||e===`refresh-required`?`chip warn`:e===`error`?`chip danger`:`chip`}function B(e){return e===`ready`||e===`ok`||e===`configured`||e===`expiring`||e===`static`}function V(e){return e?B(e.status)||e.profiles.some(e=>B(e.status)):!1}function H(e,t){return(t.modelProviderIds??t.routeIds).map(t=>L(e,t)).filter(e=>!!e)}function U(e){return e===`ok`?`chip ok`:e===`fail`?`chip danger`:`chip`}function W(e,t,n){return e===`ok`?t:e===`fail`?n:`unknown`}function G(n){let r=n.find(e=>e.health)?.health;return r?e`
2
2
  <div class="providers-health" role="note">
3
3
  <span class=${U(r.reachable)}>
4
4
  reachable ${W(r.reachable,`ok`,`failed`)}
@@ -849,7 +849,9 @@ import{a as e,r as t,t as n}from"./icons-D3-vEvih.js";import{A as r,C as i,D as
849
849
  </div>
850
850
  <div class="providers-provider__status">
851
851
  <div class="providers-provider__chips">
852
- ${s?t:e`<span class=${z(c)}>Sign in</span>`}
852
+ ${s?t:e`<span class=${z(c)}>
853
+ ${c===`refresh-required`?`Refresh sign-in`:`Sign in`}
854
+ </span>`}
853
855
  ${t}
854
856
  ${u.some(e=>e.health)?e`<span class=${u.some(e=>e.probeStatus===`ok`)?`chip ok`:`chip warn`}>health</span>`:t}
855
857
  </div>
@@ -866,6 +868,15 @@ import{a as e,r as t,t as n}from"./icons-D3-vEvih.js";import{A as r,C as i,D as
866
868
  </div>
867
869
  </summary>
868
870
  <div class="providers-provider__body">
871
+ ${n.id===`openai`?e`
872
+ <div class="providers-catalog-gap is-info" role="note">
873
+ <div class="providers-catalog-gap__title">Two OpenAI routes</div>
874
+ <div class="providers-catalog-gap__detail">
875
+ ChatGPT sign-in unlocks <code>openai-codex</code> models. OpenAI API keys unlock the direct
876
+ <code>openai</code> catalog, including GPT-5.6.
877
+ </div>
878
+ </div>
879
+ `:t}
869
880
  ${G(u)}
870
881
  ${K({providerIds:n.modelProviderIds??n.routeIds,modelCatalog:r.modelCatalog})}
871
882
  ${t}
@@ -1139,4 +1150,4 @@ import{a as e,r as t,t as n}from"./icons-D3-vEvih.js";import{A as r,C as i,D as
1139
1150
  </section>
1140
1151
  </section>
1141
1152
  `}export{Ae as renderProviders};
1142
- //# sourceMappingURL=providers-DqFL6WrJ.js.map
1153
+ //# sourceMappingURL=providers-C0DEXi8e.js.map
@@ -14,7 +14,7 @@
14
14
  <link rel="icon" type="image/png" sizes="32x32" href="./favicon-32.png" />
15
15
  <link rel="apple-touch-icon" sizes="180x180" href="./apple-touch-icon.png" />
16
16
  <script data-fased-boot-watchdog src="./boot-watchdog.js" defer></script>
17
- <script type="module" crossorigin src="./assets/index-CFHfNlLv.js"></script>
17
+ <script type="module" crossorigin src="./assets/index-vTDTf5Zv.js"></script>
18
18
  <link rel="stylesheet" crossorigin href="./assets/index-RwVraC3c.css">
19
19
  </head>
20
20
  <body>
@@ -0,0 +1,14 @@
1
+ import { resolveRuntimeServiceVersion, resolveRuntimeSource } from "../version.js";
2
+
3
+ //#region src/gateway/probe-payload.ts
4
+ function buildGatewayProbePayload(status) {
5
+ return {
6
+ ok: true,
7
+ status,
8
+ version: resolveRuntimeServiceVersion(process.env, "dev"),
9
+ runtimeSource: resolveRuntimeSource(process.env)
10
+ };
11
+ }
12
+
13
+ //#endregion
14
+ export { buildGatewayProbePayload };
@@ -44,7 +44,8 @@ async function probeGateway(opts) {
44
44
  reason
45
45
  };
46
46
  },
47
- onHelloOk: async () => {
47
+ tlsFingerprint: opts.tlsFingerprint,
48
+ onHelloOk: async (hello) => {
48
49
  connectLatencyMs = Date.now() - startedAt;
49
50
  try {
50
51
  const [health, status, presence, configSnapshot] = await Promise.all([
@@ -61,7 +62,8 @@ async function probeGateway(opts) {
61
62
  health,
62
63
  status,
63
64
  presence: Array.isArray(presence) ? presence : null,
64
- configSnapshot
65
+ configSnapshot,
66
+ server: hello.server
65
67
  });
66
68
  } catch (err) {
67
69
  settle({
@@ -72,7 +74,8 @@ async function probeGateway(opts) {
72
74
  health: null,
73
75
  status: null,
74
76
  presence: null,
75
- configSnapshot: null
77
+ configSnapshot: null,
78
+ server: hello.server
76
79
  });
77
80
  }
78
81
  }
@@ -86,7 +89,8 @@ async function probeGateway(opts) {
86
89
  health: null,
87
90
  status: null,
88
91
  presence: null,
89
- configSnapshot: null
92
+ configSnapshot: null,
93
+ server: null
90
94
  });
91
95
  }, Math.max(250, opts.timeoutMs));
92
96
  client.start();
@@ -303,6 +303,7 @@ const ModelsAuthStatusParamsSchema = Type.Object({}, { additionalProperties: fal
303
303
  const ModelsAuthStatusKindSchema = Type.Union([
304
304
  Type.Literal("ok"),
305
305
  Type.Literal("expiring"),
306
+ Type.Literal("refresh-required"),
306
307
  Type.Literal("expired"),
307
308
  Type.Literal("missing"),
308
309
  Type.Literal("static")
@@ -47,6 +47,11 @@ const HelloOkSchema = Type.Object({
47
47
  protocol: Type.Integer({ minimum: 1 }),
48
48
  server: Type.Object({
49
49
  version: NonEmptyString,
50
+ runtimeSource: Type.Optional(Type.Union([
51
+ Type.Literal("source-checkout"),
52
+ Type.Literal("managed-package"),
53
+ Type.Literal("packaged-runtime")
54
+ ])),
50
55
  connId: NonEmptyString
51
56
  }, { additionalProperties: false }),
52
57
  features: Type.Object({
@@ -6,6 +6,7 @@ const PresenceEntrySchema = Type.Object({
6
6
  host: Type.Optional(NonEmptyString),
7
7
  ip: Type.Optional(NonEmptyString),
8
8
  version: Type.Optional(NonEmptyString),
9
+ runtimeSource: Type.Optional(NonEmptyString),
9
10
  platform: Type.Optional(NonEmptyString),
10
11
  deviceFamily: Type.Optional(NonEmptyString),
11
12
  modelIdentifier: Type.Optional(NonEmptyString),
@@ -1,4 +1,4 @@
1
- import { resolveRuntimeServiceVersion } from "../../../version.js";
1
+ import { resolveRuntimeServiceVersion, resolveRuntimeSource } from "../../../version.js";
2
2
  import { loadConfig } from "../../../config/io.js";
3
3
  import "../../../config/config.js";
4
4
  import { GATEWAY_CLIENT_IDS } from "../../protocol/client-info.js";
@@ -744,6 +744,7 @@ function attachGatewayWsMessageHandler(params) {
744
744
  protocol: PROTOCOL_VERSION,
745
745
  server: {
746
746
  version: resolveRuntimeServiceVersion(process.env, "dev"),
747
+ runtimeSource: resolveRuntimeSource(process.env),
747
748
  connId
748
749
  },
749
750
  features: {
@@ -1,3 +1,4 @@
1
+ import { buildGatewayProbePayload } from "./probe-payload.js";
1
2
  import { createServer } from "node:http";
2
3
  import { createServer as createServer$1 } from "node:https";
3
4
 
@@ -35,10 +36,7 @@ function handleGatewayProbeRequest(req, res, opts) {
35
36
  return true;
36
37
  }
37
38
  res.statusCode = 200;
38
- res.end(method === "HEAD" ? undefined : JSON.stringify({
39
- ok: true,
40
- status
41
- }));
39
+ res.end(method === "HEAD" ? undefined : JSON.stringify(buildGatewayProbePayload(status)));
42
40
  return true;
43
41
  }
44
42
  function createGatewayHttpServer(opts) {
@@ -47,6 +47,7 @@ import { extractHookToken, getHookAgentPolicyError, getHookChannelError, isHookA
47
47
  import { sendGatewayAuthFailure, setDefaultSecurityHeaders } from "./http-common.js";
48
48
  import { getBearerToken, getHeader } from "./http-utils.js";
49
49
  import { handleOpenAiHttpRequest } from "./openai-http.js";
50
+ import { buildGatewayProbePayload } from "./probe-payload.js";
50
51
  import { canonicalizePathVariant } from "./security-path.js";
51
52
  import { handleToolsInvokeHttpRequest } from "./tools-invoke-http.js";
52
53
  import { authorizeGatewayConnect, isLocalDirectRequest } from "./auth.js";
@@ -2649,10 +2650,7 @@ async function handleGatewayProbeRequest(params) {
2649
2650
  } : { ready: false });
2650
2651
  }
2651
2652
  } else {
2652
- body = JSON.stringify({
2653
- ok: true,
2654
- status
2655
- });
2653
+ body = JSON.stringify(buildGatewayProbePayload(status));
2656
2654
  }
2657
2655
  params.res.statusCode = statusCode;
2658
2656
  params.res.end(method === "HEAD" ? undefined : body);
@@ -5693,6 +5691,7 @@ function createGatewayHttpServer(opts) {
5693
5691
  "yes"
5694
5692
  ].includes(String(parsedUrl.searchParams.get("forceFresh") ?? "").trim().toLowerCase());
5695
5693
  const result = await callSatMiningGateway("sat.getMiningStatus", {
5694
+ statusMode: "ui",
5696
5695
  responsive: true,
5697
5696
  ...forceFresh ? { forceFresh: true } : {}
5698
5697
  }, { timeoutMs: 6e4 });
@@ -10,6 +10,7 @@ import { stripEnvelopeFromMessage, stripEnvelopeFromMessages } from "../chat-san
10
10
  import { capArrayByJsonBytes, readSessionMessages } from "../session-utils.fs.js";
11
11
  import { loadSessionStore } from "../../config/sessions/store.js";
12
12
  import { emitSessionTranscriptUpdate } from "../../sessions/transcript-events.js";
13
+ import { ensureSessionTranscriptHeader } from "../../config/sessions/transcript.js";
13
14
  import "../../config/sessions.js";
14
15
  import { loadSessionEntry, resolveGatewaySessionStoreTarget, resolveSessionModelRef } from "../session-utils.js";
15
16
  import { GATEWAY_CLIENT_CAPS, hasGatewayClientCap } from "../protocol/client-info.js";
@@ -31,7 +32,6 @@ import { normalizeRpcAttachmentsToChatAttachments } from "./attachment-normalize
31
32
  import { appendInjectedAssistantMessageToTranscript } from "./chat-transcript-inject.js";
32
33
  import fs from "node:fs";
33
34
  import path from "node:path";
34
- import { CURRENT_SESSION_VERSION } from "@mariozechner/pi-coding-agent";
35
35
 
36
36
  //#region src/gateway/server-methods/chat.ts
37
37
  const CHAT_HISTORY_TEXT_MAX_CHARS = 12e3;
@@ -319,31 +319,6 @@ function resolveTranscriptPath(params) {
319
319
  return null;
320
320
  }
321
321
  }
322
- function ensureTranscriptFile(params) {
323
- if (fs.existsSync(params.transcriptPath)) {
324
- return { ok: true };
325
- }
326
- try {
327
- fs.mkdirSync(path.dirname(params.transcriptPath), { recursive: true });
328
- const header = {
329
- type: "session",
330
- version: CURRENT_SESSION_VERSION,
331
- id: params.sessionId,
332
- timestamp: new Date().toISOString(),
333
- cwd: process.cwd()
334
- };
335
- fs.writeFileSync(params.transcriptPath, `${JSON.stringify(header)}\n`, {
336
- encoding: "utf-8",
337
- mode: 384
338
- });
339
- return { ok: true };
340
- } catch (err) {
341
- return {
342
- ok: false,
343
- error: err instanceof Error ? err.message : String(err)
344
- };
345
- }
346
- }
347
322
  function transcriptHasIdempotencyKey(transcriptPath, idempotencyKey) {
348
323
  try {
349
324
  const lines = fs.readFileSync(transcriptPath, "utf-8").split(/\r?\n/);
@@ -381,11 +356,11 @@ function appendAssistantTranscriptMessage(params) {
381
356
  error: "transcript file not found"
382
357
  };
383
358
  }
384
- const ensured = ensureTranscriptFile({
385
- transcriptPath,
359
+ const ensured = ensureSessionTranscriptHeader({
360
+ sessionFile: transcriptPath,
386
361
  sessionId: params.sessionId
387
362
  });
388
- if (!ensured.ok) {
363
+ if (ensured.error) {
389
364
  return {
390
365
  ok: false,
391
366
  error: ensured.error ?? "failed to create transcript file"
@@ -1,6 +1,6 @@
1
1
  import { defaultRuntime } from "../../runtime.js";
2
2
  import { resolveAgentDir, resolveDefaultAgentId, resolveSessionAgentId } from "../../agents/agent-scope.js";
3
- import { listProviderBrandManifests } from "../../providers/registry.js";
3
+ import { isStandardProviderCatalogEntry, listProviderBrandManifests } from "../../providers/registry.js";
4
4
  import { DEFAULT_PROVIDER } from "../../agents/defaults.js";
5
5
  import { normalizeSecretInput } from "../../utils/normalize-secret-input.js";
6
6
  import { normalizeProviderId } from "../../agents/provider-id.js";
@@ -862,7 +862,8 @@ const modelsHandlers = {
862
862
  });
863
863
  const providerFilter = typeof params.provider === "string" && params.provider.trim() ? normalizeProviderId(params.provider) : "";
864
864
  const modelSource = params.all === true ? usableCatalog : allowedCatalog.length > 0 ? allowedCatalog : usableCatalog;
865
- const models = providerFilter ? modelSource.filter((model) => normalizeProviderId(model.provider) === providerFilter) : modelSource;
865
+ const curatedModelSource = params.all === true ? modelSource : modelSource.filter((model) => model.catalogSource === "configured" || isStandardProviderCatalogEntry(model));
866
+ const models = providerFilter ? curatedModelSource.filter((model) => normalizeProviderId(model.provider) === providerFilter) : curatedModelSource;
866
867
  const payloadModels = params.includeMetadata === true ? models.map((model) => ({
867
868
  ...model,
868
869
  metadata: model.metadata ?? deriveModelMetadata({
@@ -1,4 +1,4 @@
1
- import { resolveRuntimeServiceVersion } from "../version.js";
1
+ import { resolveRuntimeServiceVersion, resolveRuntimeSource } from "../version.js";
2
2
  import { pickPrimaryLanIPv4 } from "../gateway/net.js";
3
3
  import os from "node:os";
4
4
  import { spawnSync } from "node:child_process";
@@ -24,6 +24,7 @@ function initSelfPresence() {
24
24
  const host = os.hostname();
25
25
  const ip = resolvePrimaryIPv4() ?? undefined;
26
26
  const version = resolveRuntimeServiceVersion(process.env, "unknown");
27
+ const runtimeSource = resolveRuntimeSource(process.env);
27
28
  const modelIdentifier = (() => {
28
29
  const p = os.platform();
29
30
  if (p === "darwin") {
@@ -62,11 +63,12 @@ function initSelfPresence() {
62
63
  }
63
64
  return p;
64
65
  })();
65
- const text = `Gateway: ${host}${ip ? ` (${ip})` : ""} · app ${version} · mode gateway · reason self`;
66
+ const text = `Gateway: ${host}${ip ? ` (${ip})` : ""} · app ${version} · ${runtimeSource} · mode gateway · reason self`;
66
67
  const selfEntry = {
67
68
  host,
68
69
  ip,
69
70
  version,
71
+ runtimeSource,
70
72
  platform,
71
73
  deviceFamily,
72
74
  modelIdentifier,
@@ -1 +1 @@
1
- import e from"node:fs";import t from"node:process";import n from"node:os";import r from"node:path";function i(e=process.env,t=n.homedir()){return e.FASED_CONFIG_PATH?.trim()||r.join(e.FASED_STATE_DIR?.trim()||r.join(t,`.fased`),`fased.json`)}function a(t){if(!t)return null;try{let n=e.realpathSync(t),i=r.join(r.dirname(n),`package.json`),a=JSON.parse(e.readFileSync(i,`utf8`));return typeof a.version==`string`?a.version:null}catch{return null}}function o(e){let t=/^(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/.exec(e.trim());return t?[Number.parseInt(t[1],10),Number.parseInt(t[2],10),Number.parseInt(t[3],10)]:null}function s(e,t){let n=o(e),r=o(t);if(!n||!r)return e===t;for(let e=0;e<n.length;e+=1)if(n[e]!==r[e])return n[e]>r[e];return!0}function c(t){try{let n=JSON.parse(e.readFileSync(t,`utf8`)).update?.channel;return n==null||n===`stable`}catch{return!0}}async function l(e){let n=e.currentVersion??a(e.argv1),r=e.stableChannel??c(i());if(!n||!r)return null;let o=(t.env.npm_config_registry?.trim()||`https://registry.npmjs.org`).replace(/\/$/,``);try{let t=await(e.fetchImpl??fetch)(`${o}/@fased%2ffased/latest`,{signal:AbortSignal.timeout(e.timeoutMs??1800),headers:{accept:`application/json`}});if(!t.ok)return null;let r=await t.json(),i=typeof r.version==`string`?r.version:null;return i&&s(n,i)?{current:n,target:i}:null}catch{return null}}async function u(e=t.argv){if(e[2]!==`update`||e.slice(3).some(e=>e!==`--json`)||e.filter(e=>e===`--json`).length>1)return!1;let n=await l({argv1:e[1]});return n?(e.includes(`--json`)?console.log(JSON.stringify({ok:!0,alreadyCurrent:!0,...n})):console.log(`Already current: ${n.current}`),!0):!1}export{l as resolveAlreadyCurrent,u as run};
1
+ import e from"node:fs";import t from"node:process";import n from"node:os";import r from"node:path";function i(e=process.env,t=n.homedir()){return e.FASED_CONFIG_PATH?.trim()||r.join(e.FASED_STATE_DIR?.trim()||r.join(t,`.fased`),`fased.json`)}function a(t){if(!t)return null;try{let n=e.realpathSync(t),i=r.join(r.dirname(n),`package.json`),a=JSON.parse(e.readFileSync(i,`utf8`));return typeof a.version==`string`?a.version:null}catch{return null}}function o(t){try{let n=JSON.parse(e.readFileSync(t,`utf8`)),r=n.gateway?.port;return{port:typeof r==`number`&&Number.isInteger(r)?r:18789,tls:n.gateway?.tls?.enabled===!0}}catch{return{port:18789,tls:!1}}}async function s(e={}){let t=o(e.configPath??i());try{let n=await(e.fetchImpl??fetch)(`${t.tls?`https`:`http`}://127.0.0.1:${t.port}/healthz`,{signal:AbortSignal.timeout(e.timeoutMs??600),headers:{accept:`application/json`}});if(!n.ok)return{reachable:!0,version:null,runtimeSource:null};let r=await n.json();return{reachable:!0,version:typeof r.version==`string`&&r.version.trim()||null,runtimeSource:typeof r.runtimeSource==`string`&&r.runtimeSource.trim()||null}}catch{return{reachable:t.tls,version:null,runtimeSource:null}}}function c(e){let t=/^(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/.exec(e.trim());return t?[Number.parseInt(t[1],10),Number.parseInt(t[2],10),Number.parseInt(t[3],10)]:null}function l(e,t){let n=c(e),r=c(t);if(!n||!r)return e===t;for(let e=0;e<n.length;e+=1)if(n[e]!==r[e])return n[e]>r[e];return!0}function u(t){try{let n=JSON.parse(e.readFileSync(t,`utf8`)).update?.channel;return n==null||n===`stable`}catch{return!0}}async function d(e){let n=e.currentVersion??a(e.argv1),r=e.stableChannel??u(i());if(!n||!r)return null;let o=(t.env.npm_config_registry?.trim()||`https://registry.npmjs.org`).replace(/\/$/,``);try{let t=await(e.fetchImpl??fetch)(`${o}/@fased%2ffased/latest`,{signal:AbortSignal.timeout(e.timeoutMs??1800),headers:{accept:`application/json`}});if(!t.ok)return null;let r=await t.json(),i=typeof r.version==`string`?r.version:null;if(!i||!l(n,i))return null;let a=await(e.runtimeProbe??(()=>s()))();return a.reachable&&a.version!==n?null:{current:n,target:i}}catch{return null}}async function f(e=t.argv){if(e[2]!==`update`||e.slice(3).some(e=>e!==`--json`)||e.filter(e=>e===`--json`).length>1)return!1;let n=await d({argv1:e[1]});return n?(e.includes(`--json`)?console.log(JSON.stringify({ok:!0,alreadyCurrent:!0,...n})):console.log(`Already current: ${n.current}`),!0):!1}export{d as resolveAlreadyCurrent,f as run};