@fased/fased 0.1.49 → 0.1.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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-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/current-model-catalog.js +45 -0
- 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/model-catalog-source.js +28 -3
- 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/provider-id.js +1 -1
- 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/lightweight/gateway-runtime-probe.js +50 -0
- 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/update-cli/update-command.js +120 -0
- 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 +23 -23
- 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 +4 -4
- package/dist/config/talk.js +2 -2
- package/dist/control-ui/assets/{app-6iCry787.js → app-wJm5kuje.js} +4 -4
- package/dist/control-ui/assets/{chat-model-ref-C6CFR-GR.js → chat-model-ref-Cs2TTOtF.js} +2 -2
- package/dist/control-ui/assets/{index-CNFgocD9.js → index-vTDTf5Zv.js} +3 -3
- package/dist/control-ui/assets/{providers-WTJ1kMKy.js → providers-C0DEXi8e.js} +2 -2
- 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/probe-payload.js +14 -0
- package/dist/gateway/probe.js +8 -4
- package/dist/gateway/server-discovery.js +2 -2
- package/dist/gateway/server-http-lazy.js +2 -4
- package/dist/gateway/server-http.js +6 -8
- package/dist/gateway/server-methods/chat.js +3 -3
- package/dist/gateway/server-methods/models.js +3 -2
- 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/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-precheck.js +1 -1
- 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/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-B5fY9hZy.js → accounts-BfdIB9Ud.js} +1 -1
- package/dist/plugin-sdk/{actions-D-9SsSEy.js → actions-DHN_x97P.js} +2 -2
- package/dist/plugin-sdk/{active-listener-BH7rDR47.js → active-listener-CIP_Ht8d.js} +1 -1
- package/dist/plugin-sdk/{audio-preflight-4faayz5S.js → audio-preflight-CKGhXtyV.js} +26 -26
- package/dist/plugin-sdk/{audit-BQfsboqd.js → audit-Cmg38KPG.js} +1 -1
- package/dist/plugin-sdk/{channel-access-CDZ-cJPq.js → channel-access-JHDguu4T.js} +1 -1
- package/dist/plugin-sdk/{channel-access-configure-DlpuhlH6.js → channel-access-configure-B8mwKp-Z.js} +1 -1
- package/dist/plugin-sdk/channel-plugin-common.d.ts +2 -2
- package/dist/plugin-sdk/channel-plugin-common.js +4 -4
- package/dist/plugin-sdk/{chunk-items-Cyc4Kl6A.js → chunk-items-iKdlZyWZ.js} +1 -1
- package/dist/plugin-sdk/{chunk-CZuCyS7k.js → chunk-oJRyTNTL.js} +1 -1
- package/dist/plugin-sdk/command-status.js +26 -26
- package/dist/plugin-sdk/{commands-registry-COIbIjGO.js → commands-registry-Cjo7OjIf.js} +2 -2
- package/dist/plugin-sdk/{common-LMHJe8KW.js → common-Dx4sUa9f.js} +1 -1
- package/dist/plugin-sdk/{config-ZMbTT0kM.js → config-DdS0zHiU.js} +79 -3
- package/dist/plugin-sdk/{config-schema-Cku0a8Tm.js → config-schema-BJQEjMPz.js} +2001 -449
- package/dist/plugin-sdk/device-pair.d.ts +1 -1
- package/dist/plugin-sdk/discord.d.ts +4 -4
- package/dist/plugin-sdk/discord.js +19 -19
- package/dist/plugin-sdk/{handle-action-C8ZZfORB.js → handle-action-wR0x9b0c.js} +13 -13
- package/dist/plugin-sdk/{helpers-vfzH9tBn.js → helpers-DkauqZNP.js} +1 -1
- package/dist/plugin-sdk/{image-ops-BnOmQA5d.js → image-ops-DmSjpAeh.js} +1 -1
- package/dist/plugin-sdk/index.d.ts +18 -18
- package/dist/plugin-sdk/index.js +28 -28
- package/dist/plugin-sdk/json-store.js +6 -6
- package/dist/plugin-sdk/{login-C73Wpiw8.js → login-DB9LIbi8.js} +3 -3
- package/dist/plugin-sdk/{login-qr-CRKHA7i8.js → login-qr-CDhMa-c7.js} +3 -3
- package/dist/plugin-sdk/{manager-CHYhpKHn.js → manager-DGZsMQWR.js} +2 -2
- package/dist/plugin-sdk/{markdown-tables-B84dPWNG.js → markdown-tables-BX7JXDUV.js} +1 -1
- package/dist/plugin-sdk/{media-4daDcNER.js → media-DyzsScOp.js} +2 -2
- package/dist/plugin-sdk/{monitor-DJhU-J5u.js → monitor-B91PZ2mD.js} +31 -31
- package/dist/plugin-sdk/{monitor-CChc6bQV.js → monitor-BH9rTJFq.js} +30 -30
- package/dist/plugin-sdk/{openresponses-http-Dvyczr35.js → openresponses-http-CmBLZ9bH.js} +26 -26
- package/dist/plugin-sdk/{optional-runtime-dependency-BFpqaCzp.js → optional-runtime-dependency-DaMkPVe_.js} +1 -1
- package/dist/plugin-sdk/{outbound-C1xBxfNb.js → outbound-X-m2mBZn.js} +6 -6
- package/dist/plugin-sdk/{outbound-attachment-DvcxPP7b.js → outbound-attachment-M0NCUSG-.js} +2 -2
- package/dist/plugin-sdk/{pairing-message-DWXHX-jt.d.ts → pairing-message-BaQiXKLE.d.ts} +1 -1
- package/dist/plugin-sdk/{pairing-message-DpYT614h.js → pairing-message-hnmpJlW2.js} +1 -1
- package/dist/plugin-sdk/{pairing-store-CprpGco9.js → pairing-store-DyghUm9G.js} +2 -2
- package/dist/plugin-sdk/{pi-model-discovery-BQ6fFRBA.js → pi-model-discovery-ReorOh7W.js} +1 -1
- package/dist/plugin-sdk/{pi-model-discovery-runtime-BF_89lVj.js → pi-model-discovery-runtime-C-CHZo03.js} +2 -2
- package/dist/plugin-sdk/provider-web-search-config-contract.d.ts +1 -1
- package/dist/plugin-sdk/{pw-ai-xgpIbHOr.js → pw-ai-D_gli3_r.js} +3 -3
- package/dist/plugin-sdk/{replies-AzJ6U6Ut.js → replies-Djyehmcu.js} +2 -2
- package/dist/plugin-sdk/{resolve-outbound-target-COo_TR7B.js → resolve-outbound-target-Chznq8rS.js} +1 -1
- package/dist/plugin-sdk/{resolve-route-CZFzHOIe.js → resolve-route-Ce08Fx-G.js} +1 -1
- package/dist/plugin-sdk/{retry-policy-BSdqqXsI.js → retry-policy-eS25atAo.js} +1 -1
- package/dist/plugin-sdk/{runtime-CeoGffDi.js → runtime-Cv3gX3Wc.js} +3 -3
- package/dist/plugin-sdk/{runtime-dependency-Cvbs0GXf.js → runtime-dependency-p_iKbESf.js} +2 -2
- package/dist/plugin-sdk/sat-runtime.d.ts +2 -2
- package/dist/plugin-sdk/sat-runtime.js +5 -5
- package/dist/plugin-sdk/{send-B_-UtG9F.js → send-B3RAELvw.js} +6 -6
- package/dist/plugin-sdk/{send-C0Q1u7N1.js → send-BuPGxx3-.js} +8 -8
- package/dist/plugin-sdk/{send-CGE7OgsA.js → send-C-jaxZJG.js} +5 -5
- package/dist/plugin-sdk/{send-DCxAv7bV.js → send-CSob7dn9.js} +6 -6
- package/dist/plugin-sdk/{send-DVpCBUuL.js → send-CsLJsIvv.js} +7 -7
- package/dist/plugin-sdk/{session-ETYBbhLn.js → session-DKJGakm1.js} +2 -2
- package/dist/plugin-sdk/{skill-commands-BQL6TBIv.js → skill-commands-BqpZG5nW.js} +2 -2
- package/dist/plugin-sdk/{slack-Bs_4uivd.js → slack-CQqN9uBH.js} +38 -38
- package/dist/plugin-sdk/{slack-actions-CBPZkfTS.js → slack-actions-DlbVH5SS.js} +11 -11
- package/dist/plugin-sdk/slack.d.ts +4 -4
- package/dist/plugin-sdk/slack.js +9 -9
- package/dist/plugin-sdk/{sticker-cache-BBZMp-oQ.js → sticker-cache-CDyt2ZMh.js} +3 -3
- package/dist/plugin-sdk/{tables-B-G7Bb0l.js → tables-Cij4iAXw.js} +1 -1
- package/dist/plugin-sdk/{targets-D8UaoWHd.js → targets-VrYeAmeT.js} +1 -1
- package/dist/plugin-sdk/{telegram-actions-BARLx9zc.js → telegram-actions-ZwUBOkwa.js} +29 -29
- package/dist/plugin-sdk/telegram.d.ts +4 -4
- package/dist/plugin-sdk/telegram.js +8 -8
- package/dist/plugin-sdk/{thread-bindings.lifecycle-DwYKCLLq.js → thread-bindings.lifecycle-BWIzwpPM.js} +3 -3
- package/dist/plugin-sdk/{thread-bindings.state-BNWfHA0f.js → thread-bindings.state-CpAQrGco.js} +2 -2
- package/dist/plugin-sdk/{tmp-fased-dir-Be1wBhVz.d.ts → tmp-fased-dir-DLba1ePP.d.ts} +1 -1
- package/dist/plugin-sdk/{types-CXLEOrJX.d.ts → types-CKR2Lvsa.d.ts} +1 -1
- package/dist/plugin-sdk/{types-CJGVZX6j.d.ts → types-NR-f-rw-.d.ts} +3 -3
- package/dist/plugin-sdk/{wallet-status-Coekn_SJ.js → wallet-status-ClmXigGN.js} +3 -3
- package/dist/plugin-sdk/{web-BwolzGVF.js → web-BK2j9z6c.js} +31 -31
- package/dist/plugin-sdk/{whatsapp-actions-CSvf6eev.js → whatsapp-actions-CaenMy79.js} +13 -13
- package/dist/plugin-sdk/{whatsapp-heartbeat-Bw7OtTe6.js → whatsapp-heartbeat-Cr9K5Sil.js} +2 -2
- package/dist/plugin-sdk/whatsapp.d.ts +9 -9
- package/dist/plugin-sdk/whatsapp.js +12 -12
- package/dist/plugin-sdk/{wsl-By1Mc-oS.js → wsl-D_I-iL4U.js} +3 -3
- package/dist/plugin-sdk/{zod-schema.providers-core-TI6sL-6B.d.ts → zod-schema.providers-core-CIzCjXH9.d.ts} +75 -75
- 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 +10 -10
- package/dist/plugins/update.js +3 -3
- package/dist/plugins/web-search-install-catalog.js +3 -3
- package/dist/providers/refresh.js +1 -1
- package/dist/providers/refreshed-model-capabilities.js +1935 -406
- package/dist/providers/registry.js +13 -2
- 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/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 +12 -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 +12 -0
- package/extensions/msteams/package.json +1 -1
- package/extensions/nextcloud-talk/package.json +1 -1
- package/extensions/nostr/CHANGELOG.md +12 -0
- package/extensions/nostr/package.json +1 -1
- package/extensions/open-prose/package.json +1 -1
- package/extensions/sat-mining/package.json +1 -1
- 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 +12 -0
- package/extensions/twitch/package.json +1 -1
- package/extensions/voice-call/CHANGELOG.md +12 -0
- package/extensions/voice-call/package.json +1 -1
- package/extensions/zalo/CHANGELOG.md +12 -0
- package/extensions/zalo/package.json +1 -1
- package/extensions/zalouser/CHANGELOG.md +12 -0
- package/extensions/zalouser/package.json +1 -1
- package/package.json +1 -1
- package/scripts/start-managed.sh +14 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ensureWalletStateDir } from "./wallet-runtime-config.js";
|
|
2
|
-
import
|
|
2
|
+
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
|
|
5
5
|
//#region src/wallet/wallet-settlement-links.ts
|
|
@@ -8,14 +8,14 @@ function linksFilePath(env = process.env) {
|
|
|
8
8
|
}
|
|
9
9
|
function loadFile(env = process.env) {
|
|
10
10
|
const filePath = linksFilePath(env);
|
|
11
|
-
if (!
|
|
11
|
+
if (!fs.existsSync(filePath)) {
|
|
12
12
|
return {
|
|
13
13
|
version: 1,
|
|
14
14
|
links: []
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
try {
|
|
18
|
-
const parsed = JSON.parse(
|
|
18
|
+
const parsed = JSON.parse(fs.readFileSync(filePath, "utf8"));
|
|
19
19
|
if (parsed?.version === 1 && Array.isArray(parsed.links)) {
|
|
20
20
|
return {
|
|
21
21
|
version: 1,
|
|
@@ -30,12 +30,12 @@ function loadFile(env = process.env) {
|
|
|
30
30
|
}
|
|
31
31
|
function saveFile(file, env = process.env) {
|
|
32
32
|
const filePath = linksFilePath(env);
|
|
33
|
-
|
|
33
|
+
fs.writeFileSync(filePath, `${JSON.stringify(file, null, 2)}\n`, {
|
|
34
34
|
encoding: "utf8",
|
|
35
35
|
mode: 384
|
|
36
36
|
});
|
|
37
37
|
try {
|
|
38
|
-
|
|
38
|
+
fs.chmodSync(filePath, 384);
|
|
39
39
|
} catch {}
|
|
40
40
|
}
|
|
41
41
|
function upsertWalletSettlementLink(params) {
|
package/dist/web/accounts.js
CHANGED
|
@@ -5,7 +5,7 @@ import "../routing/session-key.js";
|
|
|
5
5
|
import { resolveAccountEntry } from "../routing/account-lookup.js";
|
|
6
6
|
import { createAccountListHelpers } from "../channels/plugins/account-helpers.js";
|
|
7
7
|
import { hasWebCredsSync } from "./auth-store.js";
|
|
8
|
-
import
|
|
8
|
+
import fs from "node:fs";
|
|
9
9
|
import path from "node:path";
|
|
10
10
|
|
|
11
11
|
//#region src/web/accounts.ts
|
|
@@ -24,7 +24,7 @@ function listWhatsAppAuthDirs(cfg) {
|
|
|
24
24
|
}).authDir);
|
|
25
25
|
}
|
|
26
26
|
try {
|
|
27
|
-
const entries =
|
|
27
|
+
const entries = fs.readdirSync(whatsappDir, { withFileTypes: true });
|
|
28
28
|
for (const entry of entries) {
|
|
29
29
|
if (!entry.isDirectory()) {
|
|
30
30
|
continue;
|
|
@@ -48,7 +48,7 @@ function resolveLegacyAuthDir() {
|
|
|
48
48
|
}
|
|
49
49
|
function legacyAuthExists(authDir) {
|
|
50
50
|
try {
|
|
51
|
-
return
|
|
51
|
+
return fs.existsSync(path.join(authDir, "creds.json"));
|
|
52
52
|
} catch {
|
|
53
53
|
return false;
|
|
54
54
|
}
|
package/dist/web/auth-store.js
CHANGED
|
@@ -4,10 +4,10 @@ import { info, success } from "../globals.js";
|
|
|
4
4
|
import { defaultRuntime } from "../runtime.js";
|
|
5
5
|
import { formatCliCommand } from "../cli/command-format.js";
|
|
6
6
|
import "../logging.js";
|
|
7
|
-
import
|
|
7
|
+
import fs from "node:fs";
|
|
8
8
|
import os from "node:os";
|
|
9
9
|
import path from "node:path";
|
|
10
|
-
import fs from "node:fs/promises";
|
|
10
|
+
import fs$1 from "node:fs/promises";
|
|
11
11
|
|
|
12
12
|
//#region src/web/auth-store.ts
|
|
13
13
|
const DEFAULT_WEB_AUTH_ACCOUNT_ID = "default";
|
|
@@ -65,7 +65,7 @@ function readAuthStoreLidReverseMapping(lid, opts) {
|
|
|
65
65
|
for (const dir of dirs) {
|
|
66
66
|
const mappingPath = path.join(dir, mappingFilename);
|
|
67
67
|
try {
|
|
68
|
-
const data =
|
|
68
|
+
const data = fs.readFileSync(mappingPath, "utf8");
|
|
69
69
|
const phone = JSON.parse(data);
|
|
70
70
|
if (phone !== null && phone !== undefined) {
|
|
71
71
|
return normalizeAuthStoreE164(String(phone));
|
|
@@ -97,7 +97,7 @@ function resolveWebCredsBackupPath(authDir) {
|
|
|
97
97
|
}
|
|
98
98
|
function hasWebCredsSync(authDir) {
|
|
99
99
|
try {
|
|
100
|
-
const stats =
|
|
100
|
+
const stats = fs.statSync(resolveWebCredsPath(authDir));
|
|
101
101
|
return stats.isFile() && stats.size > 1;
|
|
102
102
|
} catch {
|
|
103
103
|
return false;
|
|
@@ -105,14 +105,14 @@ function hasWebCredsSync(authDir) {
|
|
|
105
105
|
}
|
|
106
106
|
function readCredsJsonRaw(filePath) {
|
|
107
107
|
try {
|
|
108
|
-
if (!
|
|
108
|
+
if (!fs.existsSync(filePath)) {
|
|
109
109
|
return null;
|
|
110
110
|
}
|
|
111
|
-
const stats =
|
|
111
|
+
const stats = fs.statSync(filePath);
|
|
112
112
|
if (!stats.isFile() || stats.size <= 1) {
|
|
113
113
|
return null;
|
|
114
114
|
}
|
|
115
|
-
return
|
|
115
|
+
return fs.readFileSync(filePath, "utf-8");
|
|
116
116
|
} catch {
|
|
117
117
|
return null;
|
|
118
118
|
}
|
|
@@ -132,9 +132,9 @@ function maybeRestoreCredsFromBackup(authDir) {
|
|
|
132
132
|
return;
|
|
133
133
|
}
|
|
134
134
|
JSON.parse(backupRaw);
|
|
135
|
-
|
|
135
|
+
fs.copyFileSync(backupPath, credsPath);
|
|
136
136
|
try {
|
|
137
|
-
|
|
137
|
+
fs.chmodSync(credsPath, 384);
|
|
138
138
|
} catch {}
|
|
139
139
|
logger.warn({ credsPath }, "restored corrupted WhatsApp creds.json from backup");
|
|
140
140
|
} catch {}
|
|
@@ -144,16 +144,16 @@ async function webAuthExists(authDir = resolveDefaultWebAuthDir()) {
|
|
|
144
144
|
maybeRestoreCredsFromBackup(resolvedAuthDir);
|
|
145
145
|
const credsPath = resolveWebCredsPath(resolvedAuthDir);
|
|
146
146
|
try {
|
|
147
|
-
await fs.access(resolvedAuthDir);
|
|
147
|
+
await fs$1.access(resolvedAuthDir);
|
|
148
148
|
} catch {
|
|
149
149
|
return false;
|
|
150
150
|
}
|
|
151
151
|
try {
|
|
152
|
-
const stats = await fs.stat(credsPath);
|
|
152
|
+
const stats = await fs$1.stat(credsPath);
|
|
153
153
|
if (!stats.isFile() || stats.size <= 1) {
|
|
154
154
|
return false;
|
|
155
155
|
}
|
|
156
|
-
const raw = await fs.readFile(credsPath, "utf-8");
|
|
156
|
+
const raw = await fs$1.readFile(credsPath, "utf-8");
|
|
157
157
|
JSON.parse(raw);
|
|
158
158
|
return true;
|
|
159
159
|
} catch {
|
|
@@ -161,7 +161,7 @@ async function webAuthExists(authDir = resolveDefaultWebAuthDir()) {
|
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
async function clearLegacyBaileysAuthState(authDir) {
|
|
164
|
-
const entries = await fs.readdir(authDir, { withFileTypes: true });
|
|
164
|
+
const entries = await fs$1.readdir(authDir, { withFileTypes: true });
|
|
165
165
|
const shouldDelete = (name) => {
|
|
166
166
|
if (name === "oauth.json") {
|
|
167
167
|
return false;
|
|
@@ -181,7 +181,7 @@ async function clearLegacyBaileysAuthState(authDir) {
|
|
|
181
181
|
if (!shouldDelete(entry.name)) {
|
|
182
182
|
return;
|
|
183
183
|
}
|
|
184
|
-
await fs.rm(path.join(authDir, entry.name), { force: true });
|
|
184
|
+
await fs$1.rm(path.join(authDir, entry.name), { force: true });
|
|
185
185
|
}));
|
|
186
186
|
}
|
|
187
187
|
async function logoutWeb(params) {
|
|
@@ -195,7 +195,7 @@ async function logoutWeb(params) {
|
|
|
195
195
|
if (params.isLegacyAuthDir) {
|
|
196
196
|
await clearLegacyBaileysAuthState(resolvedAuthDir);
|
|
197
197
|
} else {
|
|
198
|
-
await fs.rm(resolvedAuthDir, {
|
|
198
|
+
await fs$1.rm(resolvedAuthDir, {
|
|
199
199
|
recursive: true,
|
|
200
200
|
force: true
|
|
201
201
|
});
|
|
@@ -206,13 +206,13 @@ async function logoutWeb(params) {
|
|
|
206
206
|
function readWebSelfId(authDir = resolveDefaultWebAuthDir()) {
|
|
207
207
|
try {
|
|
208
208
|
const credsPath = resolveWebCredsPath(resolveAuthStoreUserPath(authDir));
|
|
209
|
-
if (!
|
|
209
|
+
if (!fs.existsSync(credsPath)) {
|
|
210
210
|
return {
|
|
211
211
|
e164: null,
|
|
212
212
|
jid: null
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
|
-
const raw =
|
|
215
|
+
const raw = fs.readFileSync(credsPath, "utf-8");
|
|
216
216
|
const parsed = JSON.parse(raw);
|
|
217
217
|
const jid = parsed?.me?.id ?? null;
|
|
218
218
|
const e164 = jid ? jidToE164ForAuthStore(jid, { authDir }) : null;
|
|
@@ -233,7 +233,7 @@ function readWebSelfId(authDir = resolveDefaultWebAuthDir()) {
|
|
|
233
233
|
*/
|
|
234
234
|
function getWebAuthAgeMs(authDir = resolveDefaultWebAuthDir()) {
|
|
235
235
|
try {
|
|
236
|
-
const stats =
|
|
236
|
+
const stats = fs.statSync(resolveWebCredsPath(resolveAuthStoreUserPath(authDir)));
|
|
237
237
|
return Date.now() - stats.mtimeMs;
|
|
238
238
|
} catch {
|
|
239
239
|
return null;
|
package/dist/web/session.js
CHANGED
|
@@ -7,7 +7,7 @@ import { redactSensitiveText } from "../logging/redact.js";
|
|
|
7
7
|
import "../logging.js";
|
|
8
8
|
import { WA_WEB_AUTH_DIR, getWebAuthAgeMs, logWebSelfId, logoutWeb, maybeRestoreCredsFromBackup, pickWebChannel, readCredsJsonRaw, readWebSelfId, resolveDefaultWebAuthDir, resolveWebCredsBackupPath, resolveWebCredsPath, webAuthExists } from "./auth-store.js";
|
|
9
9
|
import { redactSensitiveUrlLikeString } from "../shared/net/redact-sensitive-url.js";
|
|
10
|
-
import
|
|
10
|
+
import fs from "node:fs";
|
|
11
11
|
import { randomUUID } from "node:crypto";
|
|
12
12
|
import { DisconnectReason, fetchLatestBaileysVersion, makeCacheableSignalKeyStore, makeWASocket, useMultiFileAuthState } from "@whiskeysockets/baileys";
|
|
13
13
|
import qrcode from "qrcode-terminal";
|
|
@@ -27,9 +27,9 @@ async function safeSaveCreds(authDir, saveCreds, logger) {
|
|
|
27
27
|
if (raw) {
|
|
28
28
|
try {
|
|
29
29
|
JSON.parse(raw);
|
|
30
|
-
|
|
30
|
+
fs.copyFileSync(credsPath, backupPath);
|
|
31
31
|
try {
|
|
32
|
-
|
|
32
|
+
fs.chmodSync(backupPath, 384);
|
|
33
33
|
} catch {}
|
|
34
34
|
} catch {}
|
|
35
35
|
}
|
|
@@ -37,7 +37,7 @@ async function safeSaveCreds(authDir, saveCreds, logger) {
|
|
|
37
37
|
try {
|
|
38
38
|
await Promise.resolve(saveCreds());
|
|
39
39
|
try {
|
|
40
|
-
|
|
40
|
+
fs.chmodSync(resolveWebCredsPath(authDir), 384);
|
|
41
41
|
} catch {}
|
|
42
42
|
} catch (err) {
|
|
43
43
|
logger.warn({ error: formatError(err) }, "failed saving WhatsApp creds");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import fs from "node:fs";
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { spawnSync } from "node:child_process";
|
|
@@ -24,7 +24,7 @@ function isHostedSecurityCapableSession(explicitFlag = false) {
|
|
|
24
24
|
const currentUser = currentUserName();
|
|
25
25
|
if (currentUser) {
|
|
26
26
|
const sudoersPath = path.join("/etc/sudoers.d", `fased-host-maintenance-${currentUser}`);
|
|
27
|
-
if (
|
|
27
|
+
if (fs.existsSync(sudoersPath)) {
|
|
28
28
|
return true;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -2,7 +2,7 @@ import { redactSensitiveText } from "../logging/redact.js";
|
|
|
2
2
|
import { redactSensitiveUrlLikeString } from "../shared/net/redact-sensitive-url.js";
|
|
3
3
|
import { noteCommands, noteHeading, noteStep, noteWarn } from "./onboarding-note-format.js";
|
|
4
4
|
import { isHostingProfile } from "./onboarding.types.js";
|
|
5
|
-
import
|
|
5
|
+
import fs from "node:fs";
|
|
6
6
|
import os from "node:os";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import { spawn, spawnSync } from "node:child_process";
|
|
@@ -12,7 +12,7 @@ import { Buffer } from "node:buffer";
|
|
|
12
12
|
function resolveHostSecurityLogPath() {
|
|
13
13
|
const home = process.env.HOME?.trim() || os.homedir();
|
|
14
14
|
const logDir = path.join(home, ".fased", "logs");
|
|
15
|
-
|
|
15
|
+
fs.mkdirSync(logDir, {
|
|
16
16
|
recursive: true,
|
|
17
17
|
mode: 448
|
|
18
18
|
});
|
|
@@ -26,7 +26,7 @@ function appendHostSecurityLog(logPath, title, detail) {
|
|
|
26
26
|
sanitizedDetail?.trim() || "(no output)",
|
|
27
27
|
""
|
|
28
28
|
].join("\n");
|
|
29
|
-
|
|
29
|
+
fs.appendFileSync(logPath, body, "utf8");
|
|
30
30
|
}
|
|
31
31
|
function resolveTailnetSshConfirmationPath() {
|
|
32
32
|
const stateDir = process.env.FASED_STATE_DIR?.trim() || process.env.FASED_CONFIG_DIR?.trim() || path.join(process.env.HOME?.trim() || os.homedir(), ".fased");
|
|
@@ -34,7 +34,7 @@ function resolveTailnetSshConfirmationPath() {
|
|
|
34
34
|
}
|
|
35
35
|
function hasStoredTailnetSshConfirmation(target) {
|
|
36
36
|
try {
|
|
37
|
-
const raw =
|
|
37
|
+
const raw = fs.readFileSync(resolveTailnetSshConfirmationPath(), "utf8");
|
|
38
38
|
const parsed = JSON.parse(raw);
|
|
39
39
|
return parsed.user === target.user && parsed.repoDir === target.repoDir;
|
|
40
40
|
} catch {
|
|
@@ -43,11 +43,11 @@ function hasStoredTailnetSshConfirmation(target) {
|
|
|
43
43
|
}
|
|
44
44
|
function writeTailnetSshConfirmation(target) {
|
|
45
45
|
const markerPath = resolveTailnetSshConfirmationPath();
|
|
46
|
-
|
|
46
|
+
fs.mkdirSync(path.dirname(markerPath), {
|
|
47
47
|
recursive: true,
|
|
48
48
|
mode: 448
|
|
49
49
|
});
|
|
50
|
-
|
|
50
|
+
fs.writeFileSync(markerPath, `${JSON.stringify({
|
|
51
51
|
confirmedAt: new Date().toISOString(),
|
|
52
52
|
user: target.user,
|
|
53
53
|
host: target.host,
|
|
@@ -75,7 +75,7 @@ const HOST_MAINTENANCE_HELPER = "/usr/local/sbin/fased-host-maintenance";
|
|
|
75
75
|
function detectTotalMemoryMb() {
|
|
76
76
|
if (process.platform === "linux") {
|
|
77
77
|
try {
|
|
78
|
-
const meminfo =
|
|
78
|
+
const meminfo = fs.readFileSync("/proc/meminfo", "utf8");
|
|
79
79
|
const match = meminfo.match(/^MemTotal:\s+(\d+)\s+kB/m);
|
|
80
80
|
if (match?.[1]) {
|
|
81
81
|
return Math.floor(Number.parseInt(match[1], 10) / 1024);
|
|
@@ -29,7 +29,7 @@ import { finalizeOnboardingWizard } from "./onboarding.finalize.js";
|
|
|
29
29
|
import { configureGatewayForOnboarding } from "./onboarding.gateway-config.js";
|
|
30
30
|
import { applyHostingSecurity } from "./onboarding.host-security.js";
|
|
31
31
|
import { normalizeHostedWalletPaths } from "./wallet-path-migration.js";
|
|
32
|
-
import
|
|
32
|
+
import fs from "node:fs";
|
|
33
33
|
import path from "node:path";
|
|
34
34
|
import { spawn, spawnSync } from "node:child_process";
|
|
35
35
|
|
|
@@ -472,7 +472,7 @@ async function runOnboardingWizard(opts, runtime = defaultRuntime, prompter) {
|
|
|
472
472
|
const stateRoot = String(process.env.FASED_STATE_DIR ?? "").trim() || path.join(String(process.env.HOME ?? "").trim() || process.cwd(), ".fased");
|
|
473
473
|
const installRoot = path.join(stateRoot, "toolchains", `go${goVersion}`);
|
|
474
474
|
const goBin = path.join(installRoot, "bin", "go");
|
|
475
|
-
if (
|
|
475
|
+
if (fs.existsSync(goBin)) {
|
|
476
476
|
process.env.FASED_GO_BIN = goBin;
|
|
477
477
|
return goModernEnough() ? "installed" : "unavailable";
|
|
478
478
|
}
|
|
@@ -505,7 +505,7 @@ async function runOnboardingWizard(opts, runtime = defaultRuntime, prompter) {
|
|
|
505
505
|
if (String(process.env.FASED_FORCE_NATIVE_SIGNER_BUILD ?? "").trim() === "1") {
|
|
506
506
|
return false;
|
|
507
507
|
}
|
|
508
|
-
return
|
|
508
|
+
return fs.existsSync(resolveSignerdBinaryPath(process.env));
|
|
509
509
|
};
|
|
510
510
|
const maybeInstallGoForOnboarding = async () => {
|
|
511
511
|
if (goModernEnough()) {
|
|
@@ -539,7 +539,7 @@ async function runOnboardingWizard(opts, runtime = defaultRuntime, prompter) {
|
|
|
539
539
|
return goModernEnough();
|
|
540
540
|
};
|
|
541
541
|
const prepareLocalSignerForOnboarding = async (params) => {
|
|
542
|
-
if (
|
|
542
|
+
if (fs.existsSync(params.binPath) || String(process.env.FASED_SKIP_NATIVE_SIGNER_BUILD ?? "").trim() === "1" || hasExplicitSignerAssetSource()) {
|
|
543
543
|
return;
|
|
544
544
|
}
|
|
545
545
|
if (goModernEnough()) {
|
|
@@ -1092,8 +1092,8 @@ async function runOnboardingWizard(opts, runtime = defaultRuntime, prompter) {
|
|
|
1092
1092
|
const configuredPaths = keystoreKeys.map((key) => (nextConfig.env?.vars?.[key] ?? "").trim() || String(process.env[key] ?? "").trim()).filter(Boolean);
|
|
1093
1093
|
for (const file of new Set([...configuredPaths, ...defaultKeystorePaths])) {
|
|
1094
1094
|
try {
|
|
1095
|
-
if (file &&
|
|
1096
|
-
|
|
1095
|
+
if (file && fs.existsSync(file)) {
|
|
1096
|
+
fs.rmSync(file, { force: true });
|
|
1097
1097
|
}
|
|
1098
1098
|
} catch {}
|
|
1099
1099
|
}
|
|
@@ -1215,7 +1215,7 @@ async function runOnboardingWizard(opts, runtime = defaultRuntime, prompter) {
|
|
|
1215
1215
|
process.env[rpcKey] = effectiveRpcUrl;
|
|
1216
1216
|
try {
|
|
1217
1217
|
let moveToSignerDir = false;
|
|
1218
|
-
if (isolatedTargetKeystorePath &&
|
|
1218
|
+
if (isolatedTargetKeystorePath && fs.existsSync(isolatedTargetKeystorePath)) {
|
|
1219
1219
|
moveToSignerDir = await prompter.confirm({
|
|
1220
1220
|
message: "Signer keystore already exists. Overwrite it?",
|
|
1221
1221
|
initialValue: false
|
|
@@ -6,7 +6,7 @@ import { applyWalletPolicyConfig, resolveWalletRoleForId } from "../wallet/walle
|
|
|
6
6
|
import { callLocalSocketSigner } from "../wallet/providers/local-socket-signer-adapter.js";
|
|
7
7
|
import { resolveWalletProviderId } from "../wallet/wallet-provider-resolver.js";
|
|
8
8
|
import { fileURLToPath } from "node:url";
|
|
9
|
-
import
|
|
9
|
+
import fs from "node:fs";
|
|
10
10
|
import path from "node:path";
|
|
11
11
|
import { execSync, spawn, spawnSync } from "node:child_process";
|
|
12
12
|
import { randomBytes } from "node:crypto";
|
|
@@ -48,7 +48,7 @@ function runCommand(params) {
|
|
|
48
48
|
}
|
|
49
49
|
function isSignerdRunning(socketPath) {
|
|
50
50
|
try {
|
|
51
|
-
|
|
51
|
+
fs.statSync(socketPath);
|
|
52
52
|
return true;
|
|
53
53
|
} catch {
|
|
54
54
|
return false;
|
|
@@ -77,7 +77,7 @@ async function sleep(ms) {
|
|
|
77
77
|
}
|
|
78
78
|
function readFileTail(filePath, maxLines = 20) {
|
|
79
79
|
try {
|
|
80
|
-
const text =
|
|
80
|
+
const text = fs.readFileSync(filePath, "utf8").trim();
|
|
81
81
|
if (!text) {
|
|
82
82
|
return undefined;
|
|
83
83
|
}
|
|
@@ -159,7 +159,7 @@ async function readSignerdHealth(socketPath) {
|
|
|
159
159
|
function resolveInstallScript() {
|
|
160
160
|
for (const rel of INSTALL_SCRIPT_RELPATHS) {
|
|
161
161
|
const abs = path.resolve(rel);
|
|
162
|
-
if (
|
|
162
|
+
if (fs.existsSync(abs)) {
|
|
163
163
|
return abs;
|
|
164
164
|
}
|
|
165
165
|
}
|
|
@@ -168,7 +168,7 @@ function resolveInstallScript() {
|
|
|
168
168
|
function resolveBuildScript() {
|
|
169
169
|
for (const rel of BUILD_SCRIPT_RELPATHS) {
|
|
170
170
|
const abs = path.resolve(rel);
|
|
171
|
-
if (
|
|
171
|
+
if (fs.existsSync(abs)) {
|
|
172
172
|
return abs;
|
|
173
173
|
}
|
|
174
174
|
}
|
|
@@ -177,7 +177,7 @@ function resolveBuildScript() {
|
|
|
177
177
|
function resolveBrokerCliPath() {
|
|
178
178
|
for (const rel of BROKER_CLI_RELPATHS) {
|
|
179
179
|
const candidate = fileURLToPath(new URL(rel, import.meta.url));
|
|
180
|
-
if (
|
|
180
|
+
if (fs.existsSync(candidate)) {
|
|
181
181
|
return candidate;
|
|
182
182
|
}
|
|
183
183
|
}
|
|
@@ -190,17 +190,17 @@ function resolveLocalSignerdReleaseBaseUrl(installScriptPath) {
|
|
|
190
190
|
const arch = process.arch === "arm64" ? "arm64" : "amd64";
|
|
191
191
|
const assetPath = path.join(releaseDir, `fased-signerd-${platform}-${arch}`);
|
|
192
192
|
const checksumsPath = path.join(releaseDir, "fased-signerd-checksums.txt");
|
|
193
|
-
if (!
|
|
193
|
+
if (!fs.existsSync(assetPath) || !fs.existsSync(checksumsPath)) {
|
|
194
194
|
return null;
|
|
195
195
|
}
|
|
196
196
|
return `file://${releaseDir}`;
|
|
197
197
|
}
|
|
198
198
|
function resolveGoBinary(env = process.env) {
|
|
199
199
|
const explicit = String(env.FASED_GO_BIN ?? "").trim();
|
|
200
|
-
if (explicit &&
|
|
200
|
+
if (explicit && fs.existsSync(explicit)) {
|
|
201
201
|
return explicit;
|
|
202
202
|
}
|
|
203
|
-
if (
|
|
203
|
+
if (fs.existsSync("/usr/local/go/bin/go")) {
|
|
204
204
|
return "/usr/local/go/bin/go";
|
|
205
205
|
}
|
|
206
206
|
const child = spawnSync("bash", ["-lc", "command -v go || true"], {
|
|
@@ -271,7 +271,7 @@ function runScriptOrThrow(params) {
|
|
|
271
271
|
function copySignerdBinaryToTarget(params) {
|
|
272
272
|
const sourcePath = path.resolve(params.sourcePath);
|
|
273
273
|
const targetPath = path.resolve(params.targetPath);
|
|
274
|
-
if (!
|
|
274
|
+
if (!fs.existsSync(sourcePath)) {
|
|
275
275
|
throw new Error(`fased-signerd build completed but binary was not found at ${sourcePath}.`);
|
|
276
276
|
}
|
|
277
277
|
if (params.runAsUser) {
|
|
@@ -295,9 +295,9 @@ function copySignerdBinaryToTarget(params) {
|
|
|
295
295
|
}
|
|
296
296
|
return;
|
|
297
297
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
298
|
+
fs.mkdirSync(path.dirname(targetPath), { recursive: true });
|
|
299
|
+
fs.copyFileSync(sourcePath, targetPath);
|
|
300
|
+
fs.chmodSync(targetPath, 493);
|
|
301
301
|
}
|
|
302
302
|
function buildSignerdBinaryFromSource(binPath) {
|
|
303
303
|
if (String(process.env.FASED_SKIP_NATIVE_SIGNER_BUILD ?? "").trim() === "1") {
|
|
@@ -353,7 +353,7 @@ function installSignerdBinaryFromExplicitAsset(binPath) {
|
|
|
353
353
|
throw new Error(detail || "fased-signerd install failed", { cause: err });
|
|
354
354
|
}
|
|
355
355
|
const installedPath = runAsUser ? stagingPath : binPath;
|
|
356
|
-
if (!
|
|
356
|
+
if (!fs.existsSync(installedPath)) {
|
|
357
357
|
throw new Error(`fased-signerd install script ran but binary not found at ${binPath}.\n` + `Check install script output above for errors.`);
|
|
358
358
|
}
|
|
359
359
|
if (runAsUser && installedPath !== binPath) {
|
|
@@ -376,7 +376,7 @@ function installSignerdBinaryFromExplicitAsset(binPath) {
|
|
|
376
376
|
});
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
-
if (!
|
|
379
|
+
if (!fs.existsSync(binPath)) {
|
|
380
380
|
throw new Error(`fased-signerd install script completed but target binary not found at ${binPath}.\n` + `Check install script output above for errors.`);
|
|
381
381
|
}
|
|
382
382
|
return true;
|
|
@@ -434,7 +434,7 @@ function inferScopedSignerKeystoreEnv(materialDir, env) {
|
|
|
434
434
|
const solanaKey = `FASED_WALLET_SOLANA_KEYSTORE_PATH__${envSuffix}`;
|
|
435
435
|
if (!String(env[solanaKey] ?? "").trim()) {
|
|
436
436
|
const candidate = path.join(materialDir, `keystore-solana-${fileSuffix}.v1.enc`);
|
|
437
|
-
if (
|
|
437
|
+
if (fs.existsSync(candidate)) {
|
|
438
438
|
inferred[solanaKey] = candidate;
|
|
439
439
|
}
|
|
440
440
|
}
|
|
@@ -469,7 +469,7 @@ function resolveLocalSignerPassphraseSource(materialDir, env) {
|
|
|
469
469
|
const candidates = [configuredFile ? path.resolve(configuredFile) : "", path.join(materialDir, "passphrase")].filter(Boolean);
|
|
470
470
|
for (const candidate of candidates) {
|
|
471
471
|
try {
|
|
472
|
-
const value =
|
|
472
|
+
const value = fs.readFileSync(candidate, "utf8").trim();
|
|
473
473
|
if (value) {
|
|
474
474
|
return {
|
|
475
475
|
kind: "file",
|
|
@@ -636,11 +636,11 @@ function writeLocalSignerEnvFile(params) {
|
|
|
636
636
|
...cfg.env?.vars
|
|
637
637
|
};
|
|
638
638
|
const signerEnvPath = path.resolve(ensureWalletStateDir(mergedEnv).rootDir, "signer.env");
|
|
639
|
-
|
|
639
|
+
fs.mkdirSync(path.dirname(signerEnvPath), {
|
|
640
640
|
recursive: true,
|
|
641
641
|
mode: 448
|
|
642
642
|
});
|
|
643
|
-
|
|
643
|
+
fs.writeFileSync(signerEnvPath, renderLocalSignerEnvFile({
|
|
644
644
|
config: cfg,
|
|
645
645
|
env: mergedEnv
|
|
646
646
|
}), {
|
|
@@ -648,7 +648,7 @@ function writeLocalSignerEnvFile(params) {
|
|
|
648
648
|
mode: 384
|
|
649
649
|
});
|
|
650
650
|
try {
|
|
651
|
-
|
|
651
|
+
fs.chmodSync(signerEnvPath, 384);
|
|
652
652
|
} catch {}
|
|
653
653
|
return signerEnvPath;
|
|
654
654
|
}
|
|
@@ -690,7 +690,7 @@ function startSignerIsolationHelperBackground(runAsUser, args, logPath, env = pr
|
|
|
690
690
|
if (!helperArgs) {
|
|
691
691
|
return false;
|
|
692
692
|
}
|
|
693
|
-
const out =
|
|
693
|
+
const out = fs.openSync(logPath, "a", 384);
|
|
694
694
|
const child = spawn("sudo", [
|
|
695
695
|
"-n",
|
|
696
696
|
"-E",
|
|
@@ -711,10 +711,10 @@ function startSignerIsolationHelperBackground(runAsUser, args, logPath, env = pr
|
|
|
711
711
|
return true;
|
|
712
712
|
}
|
|
713
713
|
function signerMaintenanceHelperArgs(runAsUser, args) {
|
|
714
|
-
if (
|
|
714
|
+
if (fs.existsSync(SIGNER_MAINTENANCE_HELPER)) {
|
|
715
715
|
return [SIGNER_MAINTENANCE_HELPER, ...args];
|
|
716
716
|
}
|
|
717
|
-
if (
|
|
717
|
+
if (fs.existsSync(SIGNER_ISOLATION_HELPER)) {
|
|
718
718
|
return [
|
|
719
719
|
SIGNER_ISOLATION_HELPER,
|
|
720
720
|
resolveCurrentUnixUser(),
|
|
@@ -769,16 +769,16 @@ function ensureLocalSignerPassphrase() {
|
|
|
769
769
|
const generated = existing.kind === "value" ? existing.value : randomBytes(24).toString("base64url");
|
|
770
770
|
const stagingDir = ensureWalletStateDir(process.env).rootDir;
|
|
771
771
|
const stagingPath = path.join(stagingDir, `.local-signer-passphrase-${process.pid}-${Date.now()}`);
|
|
772
|
-
|
|
772
|
+
fs.mkdirSync(path.dirname(stagingPath), {
|
|
773
773
|
recursive: true,
|
|
774
774
|
mode: 448
|
|
775
775
|
});
|
|
776
|
-
|
|
776
|
+
fs.writeFileSync(stagingPath, `${generated}\n`, {
|
|
777
777
|
encoding: "utf8",
|
|
778
778
|
mode: 384
|
|
779
779
|
});
|
|
780
780
|
try {
|
|
781
|
-
|
|
781
|
+
fs.chmodSync(stagingPath, 384);
|
|
782
782
|
} catch {}
|
|
783
783
|
let passphrasePath = path.join(materialDir, "passphrase");
|
|
784
784
|
try {
|
|
@@ -808,7 +808,7 @@ function ensureLocalSignerPassphrase() {
|
|
|
808
808
|
process.env.FASED_WALLET_PASSPHRASE = generated;
|
|
809
809
|
} catch (err) {
|
|
810
810
|
try {
|
|
811
|
-
|
|
811
|
+
fs.rmSync(stagingPath, { force: true });
|
|
812
812
|
} catch {}
|
|
813
813
|
const detail = err instanceof Error ? err.message : String(err);
|
|
814
814
|
if (!detail.includes("passphrase already exists")) {
|
|
@@ -826,16 +826,16 @@ function ensureLocalSignerPassphrase() {
|
|
|
826
826
|
}
|
|
827
827
|
const generated = randomBytes(24).toString("base64url");
|
|
828
828
|
const passphraseFile = path.join(materialDir, "passphrase");
|
|
829
|
-
|
|
829
|
+
fs.mkdirSync(path.dirname(passphraseFile), {
|
|
830
830
|
recursive: true,
|
|
831
831
|
mode: 448
|
|
832
832
|
});
|
|
833
|
-
|
|
833
|
+
fs.writeFileSync(passphraseFile, `${generated}\n`, {
|
|
834
834
|
encoding: "utf8",
|
|
835
835
|
mode: 384
|
|
836
836
|
});
|
|
837
837
|
try {
|
|
838
|
-
|
|
838
|
+
fs.chmodSync(passphraseFile, 384);
|
|
839
839
|
} catch {}
|
|
840
840
|
process.env.FASED_WALLET_PASSPHRASE_FILE = passphraseFile;
|
|
841
841
|
delete process.env.FASED_WALLET_PASSPHRASE;
|
|
@@ -887,8 +887,8 @@ function startSignerdBackground(binPath, socketPath, materialDir, env = process.
|
|
|
887
887
|
throw new Error(`failed to launch isolated signer as ${runAsUser}: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
|
|
888
888
|
}
|
|
889
889
|
}
|
|
890
|
-
const out =
|
|
891
|
-
const err =
|
|
890
|
+
const out = fs.openSync(logPath, "a", 384);
|
|
891
|
+
const err = fs.openSync(logPath, "a", 384);
|
|
892
892
|
const child = spawn(binPath, [
|
|
893
893
|
"-socket",
|
|
894
894
|
socketPath,
|
|
@@ -964,7 +964,7 @@ function stopProcessBySocket(socketPath, runAsUser) {
|
|
|
964
964
|
}
|
|
965
965
|
for (const candidatePidPath of pidPaths) {
|
|
966
966
|
try {
|
|
967
|
-
const pid = Number.parseInt(
|
|
967
|
+
const pid = Number.parseInt(fs.readFileSync(candidatePidPath, "utf8").trim(), 10);
|
|
968
968
|
if (Number.isFinite(pid) && pid > 0) {
|
|
969
969
|
try {
|
|
970
970
|
const command = readProcessCommand(pid);
|
|
@@ -975,16 +975,16 @@ function stopProcessBySocket(socketPath, runAsUser) {
|
|
|
975
975
|
}
|
|
976
976
|
} catch {}
|
|
977
977
|
try {
|
|
978
|
-
|
|
978
|
+
fs.unlinkSync(candidatePidPath);
|
|
979
979
|
} catch {}
|
|
980
980
|
}
|
|
981
981
|
try {
|
|
982
|
-
|
|
982
|
+
fs.unlinkSync(socketPath);
|
|
983
983
|
} catch {}
|
|
984
984
|
}
|
|
985
985
|
function readProcessCommand(pid) {
|
|
986
986
|
try {
|
|
987
|
-
const cmdline =
|
|
987
|
+
const cmdline = fs.readFileSync(`/proc/${pid}/cmdline`, "utf8").replaceAll("\0", " ").trim();
|
|
988
988
|
if (cmdline) {
|
|
989
989
|
return cmdline;
|
|
990
990
|
}
|
|
@@ -1050,8 +1050,8 @@ function startSignerBrokerBackground(appSocketPath, backendSocketPath, materialD
|
|
|
1050
1050
|
throw new Error(`failed to launch isolated signer broker as ${runAsUser}: ${err instanceof Error ? err.message : String(err)}`, { cause: err });
|
|
1051
1051
|
}
|
|
1052
1052
|
}
|
|
1053
|
-
const out =
|
|
1054
|
-
const err =
|
|
1053
|
+
const out = fs.openSync(logPath, "a", 384);
|
|
1054
|
+
const err = fs.openSync(logPath, "a", 384);
|
|
1055
1055
|
const child = spawn(process.execPath, [
|
|
1056
1056
|
brokerCli,
|
|
1057
1057
|
"wallet",
|
|
@@ -1087,7 +1087,7 @@ async function restartLocalSocketSigner(walletDir, env = process.env) {
|
|
|
1087
1087
|
const binPath = resolveSignerdBinaryPath(env);
|
|
1088
1088
|
const materialDir = resolveLocalSignerMaterialRootDir(env);
|
|
1089
1089
|
const runAsUser = resolveLocalSignerRunAsUser(env);
|
|
1090
|
-
if (!
|
|
1090
|
+
if (!fs.existsSync(binPath)) {
|
|
1091
1091
|
return;
|
|
1092
1092
|
}
|
|
1093
1093
|
stopProcessBySocket(socketPath, runAsUser);
|
|
@@ -1130,7 +1130,7 @@ async function syncLocalSocketSignerFromConfig(params) {
|
|
|
1130
1130
|
env: mergedEnv
|
|
1131
1131
|
});
|
|
1132
1132
|
const binPath = resolveSignerdBinaryPath(mergedEnv);
|
|
1133
|
-
if (!
|
|
1133
|
+
if (!fs.existsSync(binPath)) {
|
|
1134
1134
|
installSignerdBinary(binPath);
|
|
1135
1135
|
}
|
|
1136
1136
|
if (params?.restart === false) {
|
|
@@ -1159,7 +1159,7 @@ function migrateLocalSignerKeystoreToMaterialDir(params) {
|
|
|
1159
1159
|
return targetPath;
|
|
1160
1160
|
}
|
|
1161
1161
|
ensureIsolatedSignerPaths(materialDir, resolveLocalSignerBackendSocketPath(process.env), resolveLocalSignerSocketPath(process.env), runAsUser);
|
|
1162
|
-
if (
|
|
1162
|
+
if (fs.existsSync(targetPath) && !params.force) {
|
|
1163
1163
|
throw new Error(`Keystore already exists: ${targetPath}`);
|
|
1164
1164
|
}
|
|
1165
1165
|
if (runSignerIsolationHelper(runAsUser, [
|
|
@@ -1257,7 +1257,7 @@ function hasConfiguredWalletMaterial(params) {
|
|
|
1257
1257
|
}
|
|
1258
1258
|
try {
|
|
1259
1259
|
const walletDir = ensureWalletStateDir(mergedEnv).rootDir;
|
|
1260
|
-
return
|
|
1260
|
+
return fs.readdirSync(walletDir).some((entry) => /^keystore-solana(?:-[A-Za-z0-9_-]+)?\.v1\.enc$/.test(entry) || /^keystore-evm(?:-[A-Za-z0-9_-]+)?\.v1\.enc$/.test(entry));
|
|
1261
1261
|
} catch {
|
|
1262
1262
|
return false;
|
|
1263
1263
|
}
|
|
@@ -1356,12 +1356,12 @@ async function configureWalletForOnboarding(params) {
|
|
|
1356
1356
|
const binPath = resolveSignerdBinaryPath(process.env);
|
|
1357
1357
|
const runAsUser = resolveLocalSignerRunAsUser(process.env);
|
|
1358
1358
|
ensureLocalSignerPassphrase();
|
|
1359
|
-
if (!
|
|
1359
|
+
if (!fs.existsSync(binPath)) {
|
|
1360
1360
|
if (!quietSignerNotes) {
|
|
1361
1361
|
await prompter.note([`fased-signerd not found at: ${binPath}`, "Building fased-signerd locally when Go is available, or using an explicitly configured signer asset."].join("\n"), "Local socket signer");
|
|
1362
1362
|
}
|
|
1363
1363
|
await params.prepareLocalSigner?.({ binPath });
|
|
1364
|
-
if (!
|
|
1364
|
+
if (!fs.existsSync(binPath)) {
|
|
1365
1365
|
installSignerdBinary(binPath);
|
|
1366
1366
|
}
|
|
1367
1367
|
if (!quietSignerNotes) {
|