@fased/fased 0.1.48 → 0.1.49
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.
- package/dist/acp/client.js +2 -2
- package/dist/acp/secret-file.js +2 -2
- package/dist/agents/agent-scope.js +2 -2
- package/dist/agents/apply-patch.js +8 -8
- package/dist/agents/auth-health.js +11 -5
- package/dist/agents/auth-profiles/paths.js +2 -2
- package/dist/agents/auth-profiles/store.js +2 -2
- package/dist/agents/bash-tools.shared.js +2 -2
- package/dist/agents/cli-credentials.js +4 -4
- package/dist/agents/docs-path.js +3 -3
- package/dist/agents/embedded-pi-mcp.js +4 -4
- package/dist/agents/identity-avatar.js +3 -3
- package/dist/agents/identity-file.js +2 -2
- package/dist/agents/pi-embedded-subscribe.raw-stream.js +3 -3
- package/dist/agents/pi-extensions/compaction-safeguard.js +3 -3
- package/dist/agents/pi-model-discovery.js +6 -6
- package/dist/agents/pi-project-settings.js +3 -3
- package/dist/agents/sandbox/fs-bridge.js +2 -2
- package/dist/agents/session-dirs.js +4 -4
- package/dist/agents/session-write-lock.js +13 -13
- package/dist/agents/shell-utils.js +5 -5
- package/dist/agents/skills/bundled-dir.js +4 -4
- package/dist/agents/skills/local-loader.js +6 -6
- package/dist/agents/skills/plugin-skills.js +2 -2
- package/dist/agents/skills/workspace.js +13 -13
- package/dist/agents/skills-install-download.js +7 -7
- package/dist/agents/skills-install-plan.js +2 -2
- package/dist/agents/skills-install.js +2 -2
- package/dist/agents/skills-status.js +2 -2
- package/dist/agents/subagent-depth.js +2 -2
- package/dist/agents/system-prompt-params.js +2 -2
- package/dist/agents/workspace.js +22 -22
- package/dist/auto-reply/reply/agent-runner-execution.js +2 -2
- package/dist/auto-reply/reply/agent-runner.js +2 -2
- package/dist/auto-reply/reply/commands-export-session.js +7 -7
- package/dist/auto-reply/reply/post-compaction-audit.js +3 -3
- package/dist/auto-reply/reply/post-compaction-context.js +3 -3
- package/dist/auto-reply/reply/session.js +3 -3
- package/dist/auto-reply/skill-commands.js +3 -3
- package/dist/auto-reply/status.js +6 -6
- package/dist/brand.js +1 -1
- package/dist/browser/chrome.executables.js +3 -3
- package/dist/browser/chrome.js +3 -3
- package/dist/browser/chrome.profile-decoration.js +6 -6
- package/dist/browser/profiles-service.js +2 -2
- package/dist/browser/server-context.js +2 -2
- package/dist/browser/trash.js +4 -4
- package/dist/build-info.json +3 -3
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/canvas-host/server.js +4 -4
- package/dist/capabilities/catalog.js +3 -3
- package/dist/channels/plugins/catalog.js +3 -3
- package/dist/cli/browser-cli-extension.js +6 -6
- package/dist/cli/command-format.js +2 -2
- package/dist/cli/cron-cli/register.cron-simple.js +2 -2
- package/dist/cli/dns-cli.js +9 -9
- package/dist/cli/gateway-cli/dev.js +5 -5
- package/dist/cli/gateway-cli/run.js +2 -2
- package/dist/cli/hooks-cli.js +5 -5
- package/dist/cli/memory-cli.js +7 -7
- package/dist/cli/nodes-media-utils.js +2 -2
- package/dist/cli/plugins-cli.js +2 -2
- package/dist/cli/secrets-cli.js +3 -3
- package/dist/cli/windows-argv.js +2 -2
- package/dist/commands/dashboard-link.js +3 -3
- package/dist/commands/doctor-install.js +5 -5
- package/dist/commands/doctor-memory-search.js +2 -2
- package/dist/commands/doctor-platform-notes.js +2 -2
- package/dist/commands/doctor-sandbox.js +2 -2
- package/dist/commands/doctor-state-integrity.js +48 -25
- package/dist/commands/doctor-workspace.js +3 -3
- package/dist/commands/doctor.js +3 -3
- package/dist/commands/managed-up.js +2 -2
- package/dist/commands/onboard-auth.credentials.js +3 -3
- package/dist/commands/onboarding/plugin-install.js +2 -2
- package/dist/commands/sessions-cleanup.js +2 -2
- package/dist/commands/signal-install.js +6 -6
- package/dist/commands/status-all/channels.js +2 -2
- package/dist/commands/wallet.js +47 -47
- package/dist/config/cache-utils.js +2 -2
- package/dist/config/includes.js +5 -5
- package/dist/config/io.js +2 -2
- package/dist/config/paths.js +3 -3
- package/dist/config/sat-runtime-ids.js +3 -3
- package/dist/config/sessions/disk-budget.js +6 -6
- package/dist/config/sessions/paths.js +2 -2
- package/dist/config/sessions/store.js +17 -17
- package/dist/config/sessions/transcript.js +32 -18
- package/dist/config/sessions.js +2 -2
- package/dist/config/talk.js +2 -2
- package/dist/control-ui/assets/{app-CHqTx3P_.js → app-6iCry787.js} +1274 -1259
- package/dist/control-ui/assets/{chat-model-ref-BbrdMKjQ.js → chat-model-ref-C6CFR-GR.js} +2 -2
- package/dist/control-ui/assets/{config-FFZLTSLS.js → config-CU5Zi8Dh.js} +2 -2
- package/dist/control-ui/assets/{index-CFHfNlLv.js → index-CNFgocD9.js} +3 -3
- package/dist/control-ui/assets/{mining-D_VAMFMY.js → mining-BdhMn18r.js} +3 -3
- package/dist/control-ui/assets/{providers-DqFL6WrJ.js → providers-WTJ1kMKy.js} +14 -3
- package/dist/control-ui/index.html +1 -1
- package/dist/cron/service/store.js +2 -2
- package/dist/cron/store.js +6 -6
- package/dist/daemon/systemd-system.js +5 -5
- package/dist/discord/monitor/thread-bindings.state.js +2 -2
- package/dist/extensions/sat-mining/src/sat-bond-layout.js +9 -9
- package/dist/gateway/control-ui-boot-check.js +6 -6
- package/dist/gateway/control-ui-login.js +7 -7
- package/dist/gateway/control-ui.js +9 -9
- package/dist/gateway/hooks-mapping.js +4 -4
- package/dist/gateway/protocol/schema/agents-models-skills.js +1 -0
- package/dist/gateway/protocol/schema/frames.js +5 -0
- package/dist/gateway/protocol/schema/snapshot.js +1 -0
- package/dist/gateway/server/ws-connection/message-handler.js +2 -1
- package/dist/gateway/server-discovery.js +2 -2
- package/dist/gateway/server-http.js +5 -4
- package/dist/gateway/server-methods/chat.js +7 -32
- package/dist/gateway/server-methods/sessions.js +6 -6
- package/dist/gateway/server-methods/usage.js +2 -2
- package/dist/gateway/server.impl.js +3 -3
- package/dist/gateway/session-compaction-checkpoints.js +4 -4
- package/dist/gateway/session-utils.fs.js +24 -24
- package/dist/gateway/session-utils.js +6 -6
- package/dist/hooks/bundled-dir.js +4 -4
- package/dist/hooks/gmail-setup-utils.js +6 -6
- package/dist/hooks/import-url.js +2 -2
- package/dist/hooks/loader.js +4 -4
- package/dist/hooks/workspace.js +7 -7
- package/dist/infra/archive.js +17 -17
- package/dist/infra/boundary-file-read.js +2 -2
- package/dist/infra/boundary-path.js +15 -15
- package/dist/infra/brew.js +2 -2
- package/dist/infra/control-ui-assets.js +14 -14
- package/dist/infra/device-auth-store.js +8 -8
- package/dist/infra/device-identity.js +8 -8
- package/dist/infra/dotenv.js +2 -2
- package/dist/infra/exec-approvals.js +8 -8
- package/dist/infra/exec-command-resolution.js +4 -4
- package/dist/infra/exec-safe-bin-trust.js +2 -2
- package/dist/infra/fased-root.js +5 -5
- package/dist/infra/fs-safe.js +14 -14
- package/dist/infra/gateway-lock.js +11 -11
- package/dist/infra/git-commit.js +5 -5
- package/dist/infra/git-root.js +4 -4
- package/dist/infra/hosted-runtime-artifact.js +3 -3
- package/dist/infra/is-main.js +2 -2
- package/dist/infra/json-file.js +7 -7
- package/dist/infra/outbound/delivery-queue.js +16 -16
- package/dist/infra/path-env.js +3 -3
- package/dist/infra/ports-lsof.js +4 -4
- package/dist/infra/provider-usage.auth.js +3 -3
- package/dist/infra/safe-open-sync.js +2 -2
- package/dist/infra/session-cost-usage.js +9 -9
- package/dist/infra/shell-env.js +2 -2
- package/dist/infra/state-migrations.fs.js +6 -6
- package/dist/infra/state-migrations.js +23 -23
- package/dist/infra/system-presence.js +4 -2
- package/dist/infra/tmp-fased-dir.js +6 -6
- package/dist/infra/widearea-dns.js +3 -3
- package/dist/infra/wsl.js +2 -2
- package/dist/light-update-status.js +1 -1
- package/dist/line/accounts.js +2 -2
- package/dist/line/download.js +2 -2
- package/dist/logging/config.js +3 -3
- package/dist/logging/logger.js +7 -7
- package/dist/managed/federation.js +3 -3
- package/dist/managed/tunnel.js +3 -3
- package/dist/media/store.js +13 -13
- package/dist/media-understanding/runner.js +3 -3
- package/dist/memory/embeddings.js +2 -2
- package/dist/memory/internal.js +10 -10
- package/dist/memory/inventory.js +19 -0
- package/dist/memory/manager-sync-ops.js +7 -7
- package/dist/memory/repair-executor.js +17 -17
- package/dist/node-host/invoke-system-run-plan.js +8 -8
- package/dist/node-host/invoke.js +2 -2
- package/dist/node-host/runner.js +3 -3
- package/dist/pairing/pairing-store.js +3 -3
- package/dist/plugin-sdk/{accounts-DI5226U8.js → accounts-B5fY9hZy.js} +1 -1
- package/dist/plugin-sdk/{actions-CEj4gOU2.js → actions-D-9SsSEy.js} +2 -2
- package/dist/plugin-sdk/{active-listener-Ss4UKXZb.js → active-listener-BH7rDR47.js} +1 -1
- package/dist/plugin-sdk/{audio-preflight-Cu4alGjb.js → audio-preflight-4faayz5S.js} +26 -26
- package/dist/plugin-sdk/{audit-BTskqjJ_.js → audit-BQfsboqd.js} +1 -1
- package/dist/plugin-sdk/{channel-access-B1KciKmw.js → channel-access-CDZ-cJPq.js} +1 -1
- package/dist/plugin-sdk/{channel-access-configure-Y91FLOJc.js → channel-access-configure-DlpuhlH6.js} +1 -1
- package/dist/plugin-sdk/channel-plugin-common.js +4 -4
- package/dist/plugin-sdk/{chunk-CSUjIQSx.js → chunk-CZuCyS7k.js} +1 -1
- package/dist/plugin-sdk/{chunk-items-Q8HhMuSe.js → chunk-items-Cyc4Kl6A.js} +1 -1
- package/dist/plugin-sdk/command-status.js +26 -26
- package/dist/plugin-sdk/{commands-registry-DJ0pfCcY.js → commands-registry-COIbIjGO.js} +2 -2
- package/dist/plugin-sdk/{common-Cjm8psuW.js → common-LMHJe8KW.js} +1 -1
- package/dist/plugin-sdk/{config-DutIeFge.js → config-ZMbTT0kM.js} +1 -1
- package/dist/plugin-sdk/{config-schema-Cg6PYSHR.js → config-schema-Cku0a8Tm.js} +75 -60
- package/dist/plugin-sdk/discord.d.ts +1 -1
- package/dist/plugin-sdk/discord.js +19 -19
- package/dist/plugin-sdk/{handle-action-Dp2741iu.js → handle-action-C8ZZfORB.js} +13 -13
- package/dist/plugin-sdk/{helpers-BCZ9d3fl.js → helpers-vfzH9tBn.js} +1 -1
- package/dist/plugin-sdk/{image-ops-B-QR_M9Z.js → image-ops-BnOmQA5d.js} +1 -1
- package/dist/plugin-sdk/index.d.ts +13 -13
- package/dist/plugin-sdk/index.js +28 -28
- package/dist/plugin-sdk/json-store.js +6 -6
- package/dist/plugin-sdk/{login-BFvQxf9o.js → login-C73Wpiw8.js} +3 -3
- package/dist/plugin-sdk/{login-qr-CERTe_nD.js → login-qr-CRKHA7i8.js} +3 -3
- package/dist/plugin-sdk/{manager-Dhq3SXpO.js → manager-CHYhpKHn.js} +2 -2
- package/dist/plugin-sdk/{markdown-tables-B1Tx7c77.js → markdown-tables-B84dPWNG.js} +1 -1
- package/dist/plugin-sdk/{media-BwsqooWC.js → media-4daDcNER.js} +2 -2
- package/dist/plugin-sdk/{monitor-CJiacqtR.js → monitor-CChc6bQV.js} +30 -30
- package/dist/plugin-sdk/{monitor-BYzN5Qr4.js → monitor-DJhU-J5u.js} +31 -31
- package/dist/plugin-sdk/{openresponses-http-VLSSqCZZ.js → openresponses-http-Dvyczr35.js} +26 -26
- package/dist/plugin-sdk/{optional-runtime-dependency-BEBP4VFJ.js → optional-runtime-dependency-BFpqaCzp.js} +1 -1
- package/dist/plugin-sdk/{outbound-BqWgaC5M.js → outbound-C1xBxfNb.js} +6 -6
- package/dist/plugin-sdk/{outbound-attachment-L1q40kiu.js → outbound-attachment-DvcxPP7b.js} +2 -2
- package/dist/plugin-sdk/{pairing-message-CZBahREg.js → pairing-message-DpYT614h.js} +1 -1
- package/dist/plugin-sdk/{pairing-store-D7I1Qmiw.js → pairing-store-CprpGco9.js} +2 -2
- package/dist/plugin-sdk/{pi-model-discovery-C5klknQZ.js → pi-model-discovery-BQ6fFRBA.js} +1 -1
- package/dist/plugin-sdk/{pi-model-discovery-runtime-DIEMhCZ5.js → pi-model-discovery-runtime-BF_89lVj.js} +2 -2
- package/dist/plugin-sdk/{pw-ai-Bv-q25gY.js → pw-ai-xgpIbHOr.js} +3 -3
- package/dist/plugin-sdk/{replies-Bd9ktEkq.js → replies-AzJ6U6Ut.js} +2 -2
- package/dist/plugin-sdk/{resolve-outbound-target-CCIyBb5H.js → resolve-outbound-target-COo_TR7B.js} +1 -1
- package/dist/plugin-sdk/{resolve-route-B7vZ3nKp.js → resolve-route-CZFzHOIe.js} +1 -1
- package/dist/plugin-sdk/{retry-policy-ChC3G4lv.js → retry-policy-BSdqqXsI.js} +1 -1
- package/dist/plugin-sdk/{runtime-BLknHFGz.js → runtime-CeoGffDi.js} +31 -18
- package/dist/plugin-sdk/{runtime-dependency-C5rJfC0u.js → runtime-dependency-Cvbs0GXf.js} +2 -2
- package/dist/plugin-sdk/sat-runtime.js +5 -5
- package/dist/plugin-sdk/{send-Bd3Z-jAd.js → send-B_-UtG9F.js} +6 -6
- package/dist/plugin-sdk/{send-Bmtz9ICm.js → send-C0Q1u7N1.js} +8 -8
- package/dist/plugin-sdk/{send-mkyZzhCO.js → send-CGE7OgsA.js} +5 -5
- package/dist/plugin-sdk/{send-CUGEhiUa.js → send-DCxAv7bV.js} +6 -6
- package/dist/plugin-sdk/{send-CMoWt-EX.js → send-DVpCBUuL.js} +7 -7
- package/dist/plugin-sdk/{session-D2zmelOL.js → session-ETYBbhLn.js} +2 -2
- package/dist/plugin-sdk/{skill-commands-BybEjJ1_.js → skill-commands-BQL6TBIv.js} +2 -2
- package/dist/plugin-sdk/{slack-DogXvGG3.js → slack-Bs_4uivd.js} +38 -38
- package/dist/plugin-sdk/{slack-actions-uXb55QWW.js → slack-actions-CBPZkfTS.js} +11 -11
- package/dist/plugin-sdk/slack.d.ts +1 -1
- package/dist/plugin-sdk/slack.js +9 -9
- package/dist/plugin-sdk/{sticker-cache-BuPw7fTf.js → sticker-cache-BBZMp-oQ.js} +3 -3
- package/dist/plugin-sdk/{tables-CVDOT5dX.js → tables-B-G7Bb0l.js} +1 -1
- package/dist/plugin-sdk/{targets-DskkhJAp.js → targets-D8UaoWHd.js} +1 -1
- package/dist/plugin-sdk/{telegram-actions-_KQPbjpI.js → telegram-actions-BARLx9zc.js} +29 -29
- package/dist/plugin-sdk/telegram.d.ts +1 -1
- package/dist/plugin-sdk/telegram.js +8 -8
- package/dist/plugin-sdk/{thread-bindings.lifecycle-CrhQXYEU.js → thread-bindings.lifecycle-DwYKCLLq.js} +3 -3
- package/dist/plugin-sdk/{thread-bindings.state-ssxdG7xV.js → thread-bindings.state-BNWfHA0f.js} +2 -2
- package/dist/plugin-sdk/{wallet-status-CQI89c_6.js → wallet-status-Coekn_SJ.js} +10 -3
- package/dist/plugin-sdk/{web-C8DwA0eO.js → web-BwolzGVF.js} +31 -31
- package/dist/plugin-sdk/{whatsapp-actions-DfvM-mlZ.js → whatsapp-actions-CSvf6eev.js} +13 -13
- package/dist/plugin-sdk/{whatsapp-heartbeat-DyJasLDB.js → whatsapp-heartbeat-Bw7OtTe6.js} +2 -2
- package/dist/plugin-sdk/whatsapp.d.ts +10 -10
- package/dist/plugin-sdk/whatsapp.js +12 -12
- package/dist/plugin-sdk/{wsl-JwmI6Zu8.js → wsl-By1Mc-oS.js} +3 -3
- package/dist/plugin-sdk/{zod-schema.providers-core-BE_5DNhj.d.ts → zod-schema.providers-core-TI6sL-6B.d.ts} +82 -82
- package/dist/plugins/bundled-dir.js +3 -3
- package/dist/plugins/discovery.js +11 -11
- package/dist/plugins/loader.js +13 -13
- package/dist/plugins/manifest-registry.js +2 -2
- package/dist/plugins/manifest.js +4 -4
- package/dist/plugins/path-safety.js +3 -3
- package/dist/plugins/status-cache.js +9 -9
- package/dist/plugins/update.js +3 -3
- package/dist/plugins/web-search-install-catalog.js +3 -3
- package/dist/providers/registry.js +1 -1
- package/dist/secrets/apply.js +16 -16
- package/dist/secrets/audit.js +11 -11
- package/dist/secrets/shared.js +9 -9
- package/dist/security/scan-paths.js +2 -2
- package/dist/shared/config-eval.js +2 -2
- package/dist/shared/pid-alive.js +2 -2
- package/dist/tasks/standing-orders.js +5 -5
- package/dist/tasks/task-flow-registry.js +5 -5
- package/dist/tasks/task-registry.js +5 -5
- package/dist/tasks/workflow-definitions.js +6 -6
- package/dist/telegram/token.js +5 -5
- package/dist/utils.js +5 -5
- package/dist/version.js +11 -1
- package/dist/wallet/local-socket-signer-broker.js +16 -16
- package/dist/wallet/providers/embedded-keystore-adapter.js +5 -5
- package/dist/wallet/providers/local-socket-signer-adapter.js +2 -2
- package/dist/wallet/wallet-approval-auth.js +5 -5
- package/dist/wallet/wallet-audit-log.js +5 -5
- package/dist/wallet/wallet-custody.js +21 -21
- package/dist/wallet/wallet-inbound-events.js +5 -5
- package/dist/wallet/wallet-observability.js +5 -5
- package/dist/wallet/wallet-policy.js +9 -9
- package/dist/wallet/wallet-provider-registry.js +7 -7
- package/dist/wallet/wallet-runtime-config.js +3 -3
- package/dist/wallet/wallet-secrets-store.js +22 -22
- package/dist/wallet/wallet-send-approvals.js +5 -5
- package/dist/wallet/wallet-settlement-links.js +5 -5
- package/dist/web/accounts.js +3 -3
- package/dist/web/auth-store.js +18 -18
- package/dist/web/session.js +4 -4
- package/dist/wizard/host-security-capability.js +2 -2
- package/dist/wizard/onboarding.host-security.js +7 -7
- package/dist/wizard/onboarding.js +7 -7
- package/dist/wizard/onboarding.wallet.js +44 -44
- package/extensions/acpx/package.json +1 -1
- package/extensions/bluebubbles/package.json +1 -1
- package/extensions/copilot-proxy/package.json +1 -1
- package/extensions/diagnostics-otel/package.json +1 -1
- package/extensions/fased-federation/package.json +1 -1
- package/extensions/google-gemini-cli-auth/package.json +1 -1
- package/extensions/imessage/package.json +1 -1
- package/extensions/irc/package.json +1 -1
- package/extensions/line/package.json +1 -1
- package/extensions/llm-task/package.json +1 -1
- package/extensions/lobster/package.json +1 -1
- package/extensions/matrix/CHANGELOG.md +6 -0
- package/extensions/matrix/package.json +1 -1
- package/extensions/mattermost/package.json +1 -1
- package/extensions/memory-core/package.json +2 -2
- package/extensions/memory-lancedb/package.json +1 -1
- package/extensions/minimax-portal-auth/package.json +1 -1
- package/extensions/msteams/CHANGELOG.md +6 -0
- package/extensions/msteams/package.json +1 -1
- package/extensions/nextcloud-talk/package.json +1 -1
- package/extensions/nostr/CHANGELOG.md +6 -0
- package/extensions/nostr/package.json +1 -1
- package/extensions/open-prose/package.json +1 -1
- package/extensions/sat-mining/index.ts +121 -12
- package/extensions/sat-mining/package.json +1 -1
- package/extensions/sat-mining/src/runtime.ts +9 -3
- package/extensions/signal/package.json +1 -1
- package/extensions/synology-chat/package.json +1 -1
- package/extensions/tlon/package.json +1 -1
- package/extensions/twitch/CHANGELOG.md +6 -0
- package/extensions/twitch/package.json +1 -1
- package/extensions/voice-call/CHANGELOG.md +6 -0
- package/extensions/voice-call/package.json +1 -1
- package/extensions/zalo/CHANGELOG.md +6 -0
- package/extensions/zalo/package.json +1 -1
- package/extensions/zalouser/CHANGELOG.md +6 -0
- package/extensions/zalouser/package.json +1 -1
- package/package.json +1 -1
- package/scripts/start-managed.sh +21 -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?`
|
|
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-
|
|
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-
|
|
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-C6CFR-GR.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)}>
|
|
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-
|
|
1153
|
+
//# sourceMappingURL=providers-WTJ1kMKy.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-
|
|
17
|
+
<script type="module" crossorigin src="./assets/index-CNFgocD9.js"></script>
|
|
18
18
|
<link rel="stylesheet" crossorigin href="./assets/index-RwVraC3c.css">
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
|
@@ -5,7 +5,7 @@ import { inferLegacyName, normalizeOptionalText } from "./normalize.js";
|
|
|
5
5
|
import { normalizeCronStaggerMs, resolveDefaultCronStaggerMs } from "../stagger.js";
|
|
6
6
|
import { loadCronStore, saveCronStore } from "../store.js";
|
|
7
7
|
import { recomputeNextRuns } from "./jobs.js";
|
|
8
|
-
import
|
|
8
|
+
import syncFs from "node:fs";
|
|
9
9
|
|
|
10
10
|
//#region src/cron/service/store.ts
|
|
11
11
|
function buildDeliveryPatchFromLegacyPayload(payload) {
|
|
@@ -179,7 +179,7 @@ function stripLegacyTopLevelFields(raw) {
|
|
|
179
179
|
}
|
|
180
180
|
async function getFileMtimeMs(path) {
|
|
181
181
|
try {
|
|
182
|
-
const stats = await
|
|
182
|
+
const stats = await syncFs.promises.stat(path);
|
|
183
183
|
return stats.mtimeMs;
|
|
184
184
|
} catch {
|
|
185
185
|
return null;
|
package/dist/cron/store.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { expandHomePrefix } from "../infra/home-dir.js";
|
|
2
2
|
import { CONFIG_DIR } from "../utils.js";
|
|
3
|
-
import
|
|
3
|
+
import syncFs from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import JSON5 from "json5";
|
|
6
6
|
|
|
@@ -19,7 +19,7 @@ function resolveCronStorePath(storePath) {
|
|
|
19
19
|
}
|
|
20
20
|
async function loadCronStore(storePath) {
|
|
21
21
|
try {
|
|
22
|
-
const raw = await
|
|
22
|
+
const raw = await syncFs.promises.readFile(storePath, "utf-8");
|
|
23
23
|
let parsed;
|
|
24
24
|
try {
|
|
25
25
|
parsed = JSON5.parse(raw);
|
|
@@ -45,14 +45,14 @@ async function loadCronStore(storePath) {
|
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
async function saveCronStore(storePath, store) {
|
|
48
|
-
await
|
|
48
|
+
await syncFs.promises.mkdir(path.dirname(storePath), { recursive: true });
|
|
49
49
|
const { randomBytes } = await import("node:crypto");
|
|
50
50
|
const tmp = `${storePath}.${process.pid}.${randomBytes(8).toString("hex")}.tmp`;
|
|
51
51
|
const json = JSON.stringify(store, null, 2);
|
|
52
|
-
await
|
|
53
|
-
await
|
|
52
|
+
await syncFs.promises.writeFile(tmp, json, "utf-8");
|
|
53
|
+
await syncFs.promises.rename(tmp, storePath);
|
|
54
54
|
try {
|
|
55
|
-
await
|
|
55
|
+
await syncFs.promises.copyFile(storePath, `${storePath}.bak`);
|
|
56
56
|
} catch {}
|
|
57
57
|
}
|
|
58
58
|
|
|
@@ -4,7 +4,7 @@ import { parseSystemdShow } from "./systemd.js";
|
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
5
5
|
import os from "node:os";
|
|
6
6
|
import path from "node:path";
|
|
7
|
-
import fs
|
|
7
|
+
import fs from "node:fs/promises";
|
|
8
8
|
import { spawn } from "node:child_process";
|
|
9
9
|
|
|
10
10
|
//#region src/daemon/systemd-system.ts
|
|
@@ -26,7 +26,7 @@ function buildHostedSystemctlControlArgs(action) {
|
|
|
26
26
|
}
|
|
27
27
|
async function readHostedSystemdCommand(unitPath) {
|
|
28
28
|
try {
|
|
29
|
-
const content = await fs
|
|
29
|
+
const content = await fs.readFile(unitPath, "utf8");
|
|
30
30
|
let workingDirectory = "";
|
|
31
31
|
let execStart = "";
|
|
32
32
|
const environment = {};
|
|
@@ -150,7 +150,7 @@ function buildHostedSystemdUnit(params) {
|
|
|
150
150
|
return lines.join("\n");
|
|
151
151
|
}
|
|
152
152
|
async function runHelper(unit, runAsUser) {
|
|
153
|
-
await fs
|
|
153
|
+
await fs.access(INSTALL_HELPER);
|
|
154
154
|
await new Promise((resolve, reject) => {
|
|
155
155
|
const child = spawn("sudo", [
|
|
156
156
|
"-n",
|
|
@@ -205,8 +205,8 @@ async function installHostedSystemdService(params) {
|
|
|
205
205
|
`${SERVICE_NAME}.service`
|
|
206
206
|
]).catch(() => undefined);
|
|
207
207
|
const userUnit = path.join(os.homedir(), ".config", "systemd", "user", `${SERVICE_NAME}.service`);
|
|
208
|
-
await fs
|
|
209
|
-
await fs
|
|
208
|
+
await fs.rm(userUnit, { force: true }).catch(() => undefined);
|
|
209
|
+
await fs.rm(`${userUnit}.d`, {
|
|
210
210
|
recursive: true,
|
|
211
211
|
force: true
|
|
212
212
|
}).catch(() => undefined);
|
|
@@ -3,7 +3,7 @@ import { normalizeAccountId } from "../../routing/account-id.js";
|
|
|
3
3
|
import { resolveAgentIdFromSessionKey } from "../../routing/session-key.js";
|
|
4
4
|
import { loadJsonFile, saveJsonFile } from "../../infra/json-file.js";
|
|
5
5
|
import { DEFAULT_THREAD_BINDING_IDLE_TIMEOUT_MS, DEFAULT_THREAD_BINDING_MAX_AGE_MS, RECENT_UNBOUND_WEBHOOK_ECHO_WINDOW_MS, THREAD_BINDINGS_VERSION } from "./thread-bindings.types.js";
|
|
6
|
-
import
|
|
6
|
+
import syncFs from "node:fs";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
|
|
9
9
|
//#region src/discord/monitor/thread-bindings.state.ts
|
|
@@ -320,7 +320,7 @@ function shouldPersistBindingMutations() {
|
|
|
320
320
|
if (shouldPersistAnyBindingState()) {
|
|
321
321
|
return true;
|
|
322
322
|
}
|
|
323
|
-
return
|
|
323
|
+
return syncFs.existsSync(resolveThreadBindingsPath());
|
|
324
324
|
}
|
|
325
325
|
function saveBindingsToDisk(params = {}) {
|
|
326
326
|
if (!params.force && !shouldPersistAnyBindingState()) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SAT_RUNTIME_DEFAULTS } from "../../../config/sat-runtime-ids.js";
|
|
2
2
|
import "../../../plugin-sdk/sat-runtime.js";
|
|
3
|
-
import
|
|
3
|
+
import syncFs from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
|
|
6
6
|
//#region extensions/sat-mining/src/sat-bond-layout.ts
|
|
@@ -162,7 +162,7 @@ function resolveLayoutPath(env = process.env) {
|
|
|
162
162
|
path.resolve(import.meta.dirname, "..", "..", "..", "..", "..", "token", "sat", "bond-api", "bond-position-layout.json")
|
|
163
163
|
];
|
|
164
164
|
for (const candidate of candidates) {
|
|
165
|
-
if (candidate &&
|
|
165
|
+
if (candidate && syncFs.existsSync(candidate)) {
|
|
166
166
|
return candidate;
|
|
167
167
|
}
|
|
168
168
|
}
|
|
@@ -178,7 +178,7 @@ function resolvePolicyLayoutPath(env = process.env) {
|
|
|
178
178
|
path.resolve(import.meta.dirname, "..", "..", "..", "..", "..", "token", "sat", "bond-api", "bond-tier-policy-layout.json")
|
|
179
179
|
];
|
|
180
180
|
for (const candidate of candidates) {
|
|
181
|
-
if (candidate &&
|
|
181
|
+
if (candidate && syncFs.existsSync(candidate)) {
|
|
182
182
|
return candidate;
|
|
183
183
|
}
|
|
184
184
|
}
|
|
@@ -194,7 +194,7 @@ function resolveStakingDistributorLayoutPath(env = process.env) {
|
|
|
194
194
|
path.resolve(import.meta.dirname, "..", "..", "..", "..", "..", "token", "sat", "bond-api", "bond-staking-distributor-layout.json")
|
|
195
195
|
];
|
|
196
196
|
for (const candidate of candidates) {
|
|
197
|
-
if (candidate &&
|
|
197
|
+
if (candidate && syncFs.existsSync(candidate)) {
|
|
198
198
|
return candidate;
|
|
199
199
|
}
|
|
200
200
|
}
|
|
@@ -210,7 +210,7 @@ function resolveStakingPositionLayoutPath(env = process.env) {
|
|
|
210
210
|
path.resolve(import.meta.dirname, "..", "..", "..", "..", "..", "token", "sat", "bond-api", "bond-staking-position-layout.json")
|
|
211
211
|
];
|
|
212
212
|
for (const candidate of candidates) {
|
|
213
|
-
if (candidate &&
|
|
213
|
+
if (candidate && syncFs.existsSync(candidate)) {
|
|
214
214
|
return candidate;
|
|
215
215
|
}
|
|
216
216
|
}
|
|
@@ -224,7 +224,7 @@ function loadSatBondLayout(env = process.env) {
|
|
|
224
224
|
}
|
|
225
225
|
const layoutPath = resolveLayoutPath(env);
|
|
226
226
|
if (layoutPath) {
|
|
227
|
-
const loaded = JSON.parse(
|
|
227
|
+
const loaded = JSON.parse(syncFs.readFileSync(layoutPath, "utf-8"));
|
|
228
228
|
cachedLayout = {
|
|
229
229
|
mode,
|
|
230
230
|
value: loaded
|
|
@@ -244,7 +244,7 @@ function loadSatBondPolicyLayout(env = process.env) {
|
|
|
244
244
|
}
|
|
245
245
|
const layoutPath = resolvePolicyLayoutPath(env);
|
|
246
246
|
if (layoutPath) {
|
|
247
|
-
cachedPolicyLayout = JSON.parse(
|
|
247
|
+
cachedPolicyLayout = JSON.parse(syncFs.readFileSync(layoutPath, "utf-8"));
|
|
248
248
|
return cachedPolicyLayout;
|
|
249
249
|
}
|
|
250
250
|
cachedPolicyLayout = DEDICATED_FALLBACK_POLICY_LAYOUT;
|
|
@@ -257,7 +257,7 @@ function loadSatBondStakingDistributorLayout(env = process.env) {
|
|
|
257
257
|
}
|
|
258
258
|
const layoutPath = resolveStakingDistributorLayoutPath(env);
|
|
259
259
|
if (layoutPath) {
|
|
260
|
-
cachedStakingDistributorLayout = JSON.parse(
|
|
260
|
+
cachedStakingDistributorLayout = JSON.parse(syncFs.readFileSync(layoutPath, "utf-8"));
|
|
261
261
|
return cachedStakingDistributorLayout;
|
|
262
262
|
}
|
|
263
263
|
cachedStakingDistributorLayout ??= DEDICATED_FALLBACK_STAKING_DISTRIBUTOR_LAYOUT;
|
|
@@ -270,7 +270,7 @@ function loadSatBondStakingPositionLayout(env = process.env) {
|
|
|
270
270
|
}
|
|
271
271
|
const layoutPath = resolveStakingPositionLayoutPath(env);
|
|
272
272
|
if (layoutPath) {
|
|
273
|
-
cachedStakingPositionLayout = JSON.parse(
|
|
273
|
+
cachedStakingPositionLayout = JSON.parse(syncFs.readFileSync(layoutPath, "utf-8"));
|
|
274
274
|
return cachedStakingPositionLayout;
|
|
275
275
|
}
|
|
276
276
|
cachedStakingPositionLayout ??= DEDICATED_FALLBACK_STAKING_POSITION_LAYOUT;
|
|
@@ -2,7 +2,7 @@ import { openBoundaryFileSync } from "../infra/boundary-file-read.js";
|
|
|
2
2
|
import { isWithinDir } from "../infra/path-safety.js";
|
|
3
3
|
import { normalizeControlUiBasePath } from "./control-ui-shared.js";
|
|
4
4
|
import { resolveControlUiRootSync } from "../infra/control-ui-assets.js";
|
|
5
|
-
import
|
|
5
|
+
import syncFs from "node:fs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
|
|
8
8
|
//#region src/gateway/control-ui-boot-check.ts
|
|
@@ -189,7 +189,7 @@ function readControlUiBootAsset(params) {
|
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
191
|
try {
|
|
192
|
-
const body =
|
|
192
|
+
const body = syncFs.readFileSync(safeFile.fd);
|
|
193
193
|
return {
|
|
194
194
|
check: {
|
|
195
195
|
url: params.url,
|
|
@@ -200,7 +200,7 @@ function readControlUiBootAsset(params) {
|
|
|
200
200
|
text: body.toString("utf8")
|
|
201
201
|
};
|
|
202
202
|
} finally {
|
|
203
|
-
|
|
203
|
+
syncFs.closeSync(safeFile.fd);
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
function resolveBootCheckRoot(rootState) {
|
|
@@ -231,7 +231,7 @@ function resolveBootCheckRoot(rootState) {
|
|
|
231
231
|
return {
|
|
232
232
|
ok: true,
|
|
233
233
|
root,
|
|
234
|
-
rootReal:
|
|
234
|
+
rootReal: syncFs.realpathSync(root)
|
|
235
235
|
};
|
|
236
236
|
} catch (error) {
|
|
237
237
|
if (isExpectedSafePathError(error)) {
|
|
@@ -268,9 +268,9 @@ function resolveControlUiBootCheck(params) {
|
|
|
268
268
|
}
|
|
269
269
|
let html = "";
|
|
270
270
|
try {
|
|
271
|
-
html =
|
|
271
|
+
html = syncFs.readFileSync(safeIndex.fd, "utf8");
|
|
272
272
|
} finally {
|
|
273
|
-
|
|
273
|
+
syncFs.closeSync(safeIndex.fd);
|
|
274
274
|
}
|
|
275
275
|
const entryJsUrl = extractHtmlScriptAssetUrls(html, indexUrl)[0] ?? null;
|
|
276
276
|
const entry = entryJsUrl == null ? {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { resolveStateDir } from "../config/paths.js";
|
|
2
2
|
import { safeEqualSecret } from "../security/secret-equal.js";
|
|
3
3
|
import { isTrustedProxyAddress } from "./net.js";
|
|
4
|
-
import
|
|
4
|
+
import syncFs from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { createHash, createHmac, randomBytes } from "node:crypto";
|
|
7
7
|
|
|
@@ -512,10 +512,10 @@ var ControlUiLoginService = class {
|
|
|
512
512
|
}
|
|
513
513
|
readState() {
|
|
514
514
|
try {
|
|
515
|
-
if (!
|
|
515
|
+
if (!syncFs.existsSync(this.statePath)) {
|
|
516
516
|
return buildEmptyState();
|
|
517
517
|
}
|
|
518
|
-
const raw =
|
|
518
|
+
const raw = syncFs.readFileSync(this.statePath, "utf8");
|
|
519
519
|
return normalizeState(safeJsonParse(raw));
|
|
520
520
|
} catch {
|
|
521
521
|
return buildEmptyState();
|
|
@@ -525,13 +525,13 @@ var ControlUiLoginService = class {
|
|
|
525
525
|
if (!this.state) {
|
|
526
526
|
return;
|
|
527
527
|
}
|
|
528
|
-
|
|
528
|
+
syncFs.mkdirSync(path.dirname(this.statePath), { recursive: true });
|
|
529
529
|
const tmpPath = `${this.statePath}.${process.pid}.${Date.now()}.tmp`;
|
|
530
530
|
const body = `${JSON.stringify(this.state, null, 2)}\n`;
|
|
531
|
-
|
|
532
|
-
|
|
531
|
+
syncFs.writeFileSync(tmpPath, body, { mode: 384 });
|
|
532
|
+
syncFs.renameSync(tmpPath, this.statePath);
|
|
533
533
|
try {
|
|
534
|
-
|
|
534
|
+
syncFs.chmodSync(this.statePath, 384);
|
|
535
535
|
} catch {}
|
|
536
536
|
}
|
|
537
537
|
};
|
|
@@ -7,7 +7,7 @@ import { resolveControlUiRootSync } from "../infra/control-ui-assets.js";
|
|
|
7
7
|
import { DEFAULT_ASSISTANT_IDENTITY, resolveAssistantIdentity } from "./assistant-identity.js";
|
|
8
8
|
import { CONTROL_UI_BOOTSTRAP_CONFIG_PATH } from "./control-ui-contract.js";
|
|
9
9
|
import { buildControlUiCspHeader } from "./control-ui-csp.js";
|
|
10
|
-
import
|
|
10
|
+
import syncFs from "node:fs";
|
|
11
11
|
import path from "node:path";
|
|
12
12
|
|
|
13
13
|
//#region src/gateway/control-ui.ts
|
|
@@ -151,10 +151,10 @@ function handleControlUiAvatarRequest(req, res, opts) {
|
|
|
151
151
|
res.end();
|
|
152
152
|
return true;
|
|
153
153
|
}
|
|
154
|
-
serveResolvedFile(res, safeAvatar.path,
|
|
154
|
+
serveResolvedFile(res, safeAvatar.path, syncFs.readFileSync(safeAvatar.fd));
|
|
155
155
|
return true;
|
|
156
156
|
} finally {
|
|
157
|
-
|
|
157
|
+
syncFs.closeSync(safeAvatar.fd);
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
function respondNotFound(res) {
|
|
@@ -316,7 +316,7 @@ function handleControlUiHttpRequest(req, res, opts) {
|
|
|
316
316
|
}
|
|
317
317
|
const rootReal = (() => {
|
|
318
318
|
try {
|
|
319
|
-
return
|
|
319
|
+
return syncFs.realpathSync(root);
|
|
320
320
|
} catch (error) {
|
|
321
321
|
if (isExpectedSafePathError(error)) {
|
|
322
322
|
return null;
|
|
@@ -362,13 +362,13 @@ function handleControlUiHttpRequest(req, res, opts) {
|
|
|
362
362
|
return true;
|
|
363
363
|
}
|
|
364
364
|
if (path.basename(safeFile.path) === "index.html") {
|
|
365
|
-
serveResolvedIndexHtml(res,
|
|
365
|
+
serveResolvedIndexHtml(res, syncFs.readFileSync(safeFile.fd, "utf8"));
|
|
366
366
|
return true;
|
|
367
367
|
}
|
|
368
|
-
serveResolvedFile(res, safeFile.path,
|
|
368
|
+
serveResolvedFile(res, safeFile.path, syncFs.readFileSync(safeFile.fd));
|
|
369
369
|
return true;
|
|
370
370
|
} finally {
|
|
371
|
-
|
|
371
|
+
syncFs.closeSync(safeFile.fd);
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
374
|
if (STATIC_ASSET_EXTENSIONS.has(path.extname(fileRel).toLowerCase())) {
|
|
@@ -385,10 +385,10 @@ function handleControlUiHttpRequest(req, res, opts) {
|
|
|
385
385
|
res.end();
|
|
386
386
|
return true;
|
|
387
387
|
}
|
|
388
|
-
serveResolvedIndexHtml(res,
|
|
388
|
+
serveResolvedIndexHtml(res, syncFs.readFileSync(safeIndex.fd, "utf8"));
|
|
389
389
|
return true;
|
|
390
390
|
} finally {
|
|
391
|
-
|
|
391
|
+
syncFs.closeSync(safeIndex.fd);
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
394
|
respondNotFound(res);
|