@fased/fased 0.1.61 → 0.1.64
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/CHANGELOG.md +43 -0
- package/README.md +38 -30
- package/config/dependency-ownership.json +1 -1
- package/config/signer-policies/README.md +49 -0
- package/config/signer-policies/agent.json.template +32 -0
- package/config/signer-policies/mining.json.template +69 -0
- package/config/signer-policies/network.json.template +5 -0
- package/config/signer-policies/vault.json.template +70 -0
- package/config/signer-protocol-v2.json +76 -0
- package/config/typescript-noemit-baseline.json +680 -0
- 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 +269 -33
- package/dist/agents/bash-tools.exec.js +10 -4
- package/dist/agents/bash-tools.shared.js +2 -2
- package/dist/agents/cli-credentials.js +4 -4
- package/dist/agents/current-model-catalog.js +3 -3
- 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/memory-search.js +7 -1
- package/dist/agents/model-catalog-access.js +1 -2
- package/dist/agents/model-catalog-snapshot.js +1 -1
- package/dist/agents/model-catalog-source.js +1 -1
- package/dist/agents/model-metadata.js +1 -1
- package/dist/agents/model-selection.js +2 -28
- package/dist/agents/models-config.providers.js +6 -6
- package/dist/agents/openai-codex-app-server.js +5 -5
- package/dist/agents/pi-embedded-runner/compact.js +15 -7
- package/dist/agents/pi-embedded-runner/model.js +1 -1
- package/dist/agents/pi-embedded-runner/run/attempt.js +24 -13
- package/dist/agents/pi-embedded-runner/run.js +2 -0
- package/dist/agents/pi-embedded-runner/tool-split.js +40 -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/pi-tool-definition-adapter.js +16 -1
- package/dist/agents/pi-tools.js +2 -1
- package/dist/agents/sandbox/config.js +1 -1
- package/dist/agents/sandbox/context.js +27 -2
- 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/env-overrides.js +38 -28
- package/dist/agents/skills/local-loader.js +6 -6
- package/dist/agents/skills/plugin-skills.js +2 -2
- package/dist/agents/skills/trust.js +93 -0
- package/dist/agents/skills/workspace.js +141 -13
- package/dist/agents/skills-clawhub.js +36 -11
- 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-marketplace-scan.js +49 -0
- 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/tools/marketplace-offer-draft-tool.js +1 -1
- package/dist/agents/tools/mining-tool.js +1 -1
- package/dist/agents/tools/session-status-tool.js +1 -1
- package/dist/agents/tools/wallet-action-tool.js +172 -36
- package/dist/agents/tools/wallet-skill-policy.js +65 -23
- package/dist/agents/tools/wallet-tool.js +7 -11
- 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/directive-handling.fast-lane.js +2 -1
- package/dist/auto-reply/reply/directive-handling.impl.js +2 -1
- package/dist/auto-reply/reply/directive-handling.model.js +2 -1
- package/dist/auto-reply/reply/directive-handling.persist.js +2 -2
- package/dist/auto-reply/reply/get-reply-directives-apply.js +2 -0
- package/dist/auto-reply/reply/get-reply-inline-actions.js +25 -1
- package/dist/auto-reply/reply/model-selection.js +7 -4
- 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-reset-model.js +4 -4
- 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/channel-web.js +2 -2
- 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 +10 -2
- package/dist/cli/hooks-cli.js +5 -5
- package/dist/cli/lightweight/gateway-runtime-probe.js +2 -2
- 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/program/command-registry.js +1 -1
- package/dist/cli/program/register.onboard.js +2 -3
- package/dist/cli/program/register.wallet.js +16 -123
- package/dist/cli/providers-cli.js +1 -1
- package/dist/cli/sat-cli.js +129 -2
- package/dist/cli/secrets-cli.js +3 -3
- package/dist/cli/update-cli/update-command.js +260 -11
- package/dist/cli/windows-argv.js +2 -2
- package/dist/commands/auth-choice.apply.api-providers.js +3 -3
- package/dist/commands/dashboard-link.js +3 -3
- package/dist/commands/doctor-config-flow.js +1 -1
- package/dist/commands/doctor-install.js +5 -5
- package/dist/commands/doctor-legacy-config.js +2 -13
- 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/model-picker.js +6 -6
- package/dist/commands/models/auth.js +1 -1
- package/dist/commands/onboard-auth.config-gateways.js +1 -1
- package/dist/commands/onboard-auth.credentials.js +35 -11
- package/dist/commands/onboard-non-interactive/local/wallet-config.js +28 -27
- package/dist/commands/onboard-non-interactive/local.js +5 -1
- 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 +570 -1913
- package/dist/config/cache-utils.js +2 -2
- package/dist/config/config.js +2 -2
- package/dist/config/includes.js +5 -5
- package/dist/config/io.js +66 -4
- package/dist/config/paths.js +3 -3
- package/dist/config/sat-runtime-ids.js +3 -3
- package/dist/config/schema.help.js +8 -7
- package/dist/config/schema.labels.js +5 -4
- 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/config/zod-schema.agent-runtime.js +1 -0
- package/dist/config/zod-schema.js +5 -0
- package/dist/control-ui/assets/{app-BXA4gPvN.js → app-bR-fO5ty.js} +1511 -1555
- package/dist/control-ui/assets/{config-CU5Zi8Dh.js → config-LeImukCW.js} +10 -10
- package/dist/control-ui/assets/{federation-D10Q4eP_.js → federation-DgA9e-Pn.js} +364 -422
- package/dist/control-ui/assets/{index-D2QbJhVg.js → index-ckCxHwjy.js} +3 -3
- package/dist/control-ui/assets/{mining-BdhMn18r.js → mining-BgHFh0ei.js} +134 -114
- package/dist/control-ui/assets/mining-commit-DFpB_4JN.js +2 -0
- package/dist/control-ui/assets/{open-external-url-DwSiwMPl.js → open-external-url-ulF1B-sA.js} +3 -3
- package/dist/control-ui/assets/{providers-QMn4w2_f.js → providers-CIx9fxc6.js} +2 -2
- package/dist/control-ui/assets/{wallet-C2g294QT.js → wallet-DvStR_AT.js} +259 -377
- package/dist/control-ui/index.html +1 -1
- package/dist/control-ui/version.json +1 -1
- package/dist/cron/service/store.js +2 -2
- package/dist/cron/store.js +6 -6
- package/dist/daemon/systemd-system.js +60 -54
- package/dist/discord/monitor/thread-bindings.state.js +2 -2
- package/dist/extensions/sat-mining/src/protocol-contract.js +43 -3
- package/dist/extensions/sat-mining/src/rpc-read.js +235 -67
- package/dist/extensions/sat-mining/src/sat-bond-layout.js +14 -11
- package/dist/extensions/sat-mining/src/signer-codec-manifest.js +406 -0
- package/dist/extensions/sat-mining/src/solana-submit.js +1038 -397
- package/dist/extensions/sat-mining/src/submission-ledger.js +349 -0
- package/dist/federation/auto-connect.js +98 -8
- package/dist/federation/marketplace-capability-adapter.js +33 -7
- package/dist/federation/marketplace-delivery-outbox.js +196 -0
- package/dist/federation/marketplace-delivery.js +351 -215
- package/dist/federation/marketplace-direct-payment.js +272 -141
- package/dist/federation/marketplace-escrow.js +607 -249
- package/dist/federation/marketplace-settlement-ledger.js +352 -0
- package/dist/federation/offers.js +9 -7
- package/dist/federation/peer-auth-v2.js +529 -0
- package/dist/gateway/a2a-http.js +425 -96
- package/dist/gateway/a2a-settlement.js +259 -153
- package/dist/gateway/a2a-task-store.js +524 -0
- package/dist/gateway/auth.js +38 -2
- package/dist/gateway/config-reload.js +46 -33
- 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/durable-capacity.js +31 -0
- package/dist/gateway/federation-http.js +540 -135
- package/dist/gateway/federation-marketplace-run-store.js +397 -0
- package/dist/gateway/federation-marketplace.js +535 -230
- package/dist/gateway/hooks-mapping.js +4 -4
- package/dist/gateway/mutating-admin-rpc-rate-limit.js +5 -0
- package/dist/gateway/security-path.js +1 -1
- package/dist/gateway/server-discovery.js +2 -2
- package/dist/gateway/server-http.js +1088 -1209
- package/dist/gateway/server-methods/chat.js +3 -3
- package/dist/gateway/server-methods/models.js +1 -1
- package/dist/gateway/server-methods/secrets.js +40 -0
- package/dist/gateway/server-methods/sessions.js +6 -6
- package/dist/gateway/server-methods/usage.js +2 -2
- package/dist/gateway/server-methods.js +1 -2
- package/dist/gateway/server-reload-handlers.js +196 -66
- package/dist/gateway/server-runtime-config.js +1 -1
- package/dist/gateway/server-secrets-runtime.js +288 -0
- package/dist/gateway/server.impl.js +73 -42
- 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/gateway/sessions-patch.js +3 -5
- 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/index.js +4 -2
- 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/fasedhub.js +64 -1
- 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/local-source-paired-update.js +538 -0
- package/dist/infra/managed-runtime-bootstrap.js +6 -6
- 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/restart.js +41 -10
- 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/update-runner.js +96 -0
- package/dist/infra/widearea-dns.js +3 -3
- package/dist/infra/wsl.js +2 -2
- package/dist/light-update-status.js +11 -11
- 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/backend-config.js +2 -1
- 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/memory/session-files.js +16 -2
- 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-DxblobYM.js → accounts-Brn3-uWN.js} +1 -1
- package/dist/plugin-sdk/{actions-D4UNimWa.js → actions-DRu135h0.js} +2 -2
- package/dist/plugin-sdk/{active-listener-CFuy106s.js → active-listener-B_NMtgPL.js} +1 -1
- package/dist/plugin-sdk/{audio-preflight-Bv0hUOWL.js → audio-preflight-BYxAt775.js} +27 -27
- package/dist/plugin-sdk/{audit-Cs0K7LBp.js → audit-C5d2z5U1.js} +1 -1
- package/dist/plugin-sdk/{channel-access-D5aHoTY8.js → channel-access-CcFRdRPO.js} +1 -1
- package/dist/plugin-sdk/{channel-access-configure-Dvch9mMQ.js → channel-access-configure-DaI5wevh.js} +1 -1
- package/dist/plugin-sdk/channel-plugin-common.d.ts +3 -3
- package/dist/plugin-sdk/channel-plugin-common.js +4 -4
- package/dist/plugin-sdk/{chunk-B0FUGc5A.js → chunk-CyoyqpbG.js} +1 -1
- package/dist/plugin-sdk/{chunk-items-Bk--NU3E.js → chunk-items-DIRHG2gJ.js} +1 -1
- package/dist/plugin-sdk/command-status.d.ts +2 -2
- package/dist/plugin-sdk/command-status.js +27 -27
- package/dist/plugin-sdk/{commands-registry-DmDRhRAU.js → commands-registry-BfqdEWdF.js} +2 -2
- package/dist/plugin-sdk/{common-CfUOowOp.js → common-HCcXU-NR.js} +1 -1
- package/dist/plugin-sdk/{config-mxULv0fQ.js → config-DlWVeLFB.js} +7113 -6877
- package/dist/plugin-sdk/{config-schema-CGW6J3Pv.js → config-schema-BOT7kHb6.js} +6779 -3696
- package/dist/plugin-sdk/device-pair.d.ts +1 -1
- package/dist/plugin-sdk/discord.d.ts +5 -5
- package/dist/plugin-sdk/discord.js +19 -19
- package/dist/plugin-sdk/file-lock.js +35 -4
- package/dist/plugin-sdk/{filesystem-manager-ZoHU8oA7.js → filesystem-manager-DoI8IBNF.js} +1 -1
- package/dist/plugin-sdk/{group-mentions-BHRff6j8.d.ts → group-mentions-q3hUTCt7.d.ts} +1 -1
- package/dist/plugin-sdk/{handle-action-DbVCF9HZ.js → handle-action-hvwapMKg.js} +13 -13
- package/dist/plugin-sdk/{helpers-BXbdgs5H.js → helpers-DMBU4oTo.js} +1 -1
- package/dist/plugin-sdk/{image-ops-D7jPxaph.js → image-ops-DQi0n_Tt.js} +1 -1
- package/dist/plugin-sdk/index.d.ts +9 -27
- package/dist/plugin-sdk/index.js +29 -29
- package/dist/plugin-sdk/json-store.js +6 -6
- package/dist/plugin-sdk/{login-BRxww6nv.js → login-Ca583Okc.js} +3 -3
- package/dist/plugin-sdk/{login-qr-DJXsk9XH.js → login-qr-CGciBSNP.js} +3 -3
- package/dist/plugin-sdk/{manager-Y2S_5IlI.js → manager-BegWxNYX.js} +4 -4
- package/dist/plugin-sdk/{markdown-tables-DHLFQqaF.js → markdown-tables-DCOXEUfZ.js} +1 -1
- package/dist/plugin-sdk/{media-Czo4carg.js → media-CAdQF5TG.js} +47 -47
- package/dist/plugin-sdk/{memory-search-DTjIMw8J.js → memory-search-CrFPOeTH.js} +4 -1
- package/dist/plugin-sdk/{monitor-B9Cmt_Je.js → monitor-BCFDaqJ-.js} +31 -31
- package/dist/plugin-sdk/{monitor-B71iwAgC.js → monitor-BgbjRiPM.js} +32 -32
- package/dist/plugin-sdk/{openresponses-http-Du4GMmwo.js → openresponses-http-DFf87SMM.js} +27 -27
- package/dist/plugin-sdk/{optional-runtime-dependency-DdMbxS24.js → optional-runtime-dependency-0dznm3ZO.js} +1 -1
- package/dist/plugin-sdk/{outbound-Db8mRN6P.js → outbound-BgVDdHxx.js} +6 -6
- package/dist/plugin-sdk/{outbound-attachment-BqFjcypb.js → outbound-attachment-QqTnIhZL.js} +2 -2
- package/dist/plugin-sdk/{pairing-message-BMkkS038.d.ts → pairing-message-CS-9BHug.d.ts} +2 -2
- package/dist/plugin-sdk/{pairing-message-B3GC_7CD.js → pairing-message-D0CoLHRJ.js} +1 -1
- package/dist/plugin-sdk/{pairing-store-CQikgIbw.js → pairing-store-BChahgI2.js} +2 -2
- package/dist/plugin-sdk/{pi-model-discovery-CY3m5zJP.js → pi-model-discovery-BX_JLcEJ.js} +1 -1
- package/dist/plugin-sdk/{pi-model-discovery-runtime-DSh1T2pn.js → pi-model-discovery-runtime-DxTMz_XF.js} +2 -2
- package/dist/plugin-sdk/provider-web-search-config-contract.d.ts +2 -2
- package/dist/plugin-sdk/{pw-ai-AFUqn-tQ.js → pw-ai-natjh3rm.js} +3 -3
- package/dist/plugin-sdk/{qmd-manager-DSyx77KY.js → qmd-manager-CgRaTxUq.js} +1 -1
- package/dist/plugin-sdk/{query-expansion-CAI2kKLQ.js → query-expansion-BG3FgzF7.js} +14 -3
- package/dist/plugin-sdk/{replies-Fzh9PhXl.js → replies-ChYo5ZQM.js} +2 -2
- package/dist/plugin-sdk/{resolve-outbound-target-KpF3co6T.js → resolve-outbound-target-D-KGgHJZ.js} +1 -1
- package/dist/plugin-sdk/{resolve-route-CDl74O19.js → resolve-route-C8tvQm8Z.js} +1 -1
- package/dist/plugin-sdk/{retry-policy-D4uiqUOG.js → retry-policy-C6SjKjQA.js} +1 -1
- package/dist/plugin-sdk/{runtime-Bb6KRnCC.js → runtime-2B9_WKoI.js} +8 -3
- package/dist/plugin-sdk/{runtime-dependency-DLDmB94f.js → runtime-dependency-DczkvPxn.js} +2 -2
- package/dist/plugin-sdk/sat-runtime.d.ts +549 -309
- package/dist/plugin-sdk/sat-runtime.js +29 -29
- package/dist/plugin-sdk/{send-C4k4JuJN.js → send-B6KkGKZD.js} +6 -6
- package/dist/plugin-sdk/{send-D-uDKGIq.js → send-CFzGKJXo.js} +6 -6
- package/dist/plugin-sdk/{send-Du8ykP1k.js → send-DCO441U7.js} +8 -8
- package/dist/plugin-sdk/{send-5nFktR1n.js → send-gDoGA-7e.js} +5 -5
- package/dist/plugin-sdk/{send-Bfzf11VY.js → send-q9HXrSwK.js} +7 -7
- package/dist/plugin-sdk/{session-CS-Td9EM.js → session-DHD4ZKyG.js} +2 -2
- package/dist/plugin-sdk/{skill-commands-CFAlXWHk.js → skill-commands-FKEPLS7T.js} +201 -26
- package/dist/plugin-sdk/{slack-D_bbE6Yd.js → slack-BUTt8cxK.js} +39 -39
- package/dist/plugin-sdk/{slack-actions-BcMkNv1Z.js → slack-actions-DhbMcp8M.js} +11 -11
- package/dist/plugin-sdk/slack.d.ts +5 -5
- package/dist/plugin-sdk/slack.js +9 -9
- package/dist/plugin-sdk/{sticker-cache-Dqo9nRhi.js → sticker-cache-D0wHVqjt.js} +3 -3
- package/dist/plugin-sdk/{tables-bFXyRpkx.js → tables-B3jr0Pvq.js} +1 -1
- package/dist/plugin-sdk/{targets-DH7a9lKB.js → targets-CtSbTxYX.js} +1 -1
- package/dist/plugin-sdk/{telegram-actions-Cnag7JTH.js → telegram-actions-CC_qN4v0.js} +30 -30
- package/dist/plugin-sdk/telegram.d.ts +5 -5
- package/dist/plugin-sdk/telegram.js +8 -8
- package/dist/plugin-sdk/{thread-bindings.lifecycle-CgOvvdw8.js → thread-bindings.lifecycle-QbkNl-m6.js} +3 -3
- package/dist/plugin-sdk/{thread-bindings.state-CQpk44Hq.js → thread-bindings.state-D9hg_M1c.js} +2 -2
- package/dist/plugin-sdk/tmp-fased-dir-xOTGlzBE.d.ts +486 -0
- package/dist/plugin-sdk/{types-CLIvQaVg.d.ts → types-C3avNytw.d.ts} +3 -4
- package/dist/plugin-sdk/{types-DyhXnYUr.d.ts → types-D0kDG8l0.d.ts} +3 -2
- package/dist/plugin-sdk/{types-BYDL6dQj.d.ts → types-DWfbSAaM.d.ts} +2 -2
- package/dist/plugin-sdk/{types.plugin-_fbu40Re.d.ts → types.plugin-BcSBq42x.d.ts} +8 -3
- package/dist/plugin-sdk/{web-BInKQkc4.js → web-BXsJ1vqe.js} +32 -32
- package/dist/plugin-sdk/{whatsapp-actions-BtSc2CBv.js → whatsapp-actions-Bj_rOncr.js} +13 -13
- package/dist/plugin-sdk/{whatsapp-heartbeat-Bg9TuYzl.js → whatsapp-heartbeat-B1WHkJIg.js} +2 -2
- package/dist/plugin-sdk/whatsapp.d.ts +5 -5
- package/dist/plugin-sdk/whatsapp.js +12 -12
- package/dist/plugin-sdk/{wsl-C4DGFkOd.js → wsl-J-HscWxS.js} +3 -3
- 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/refresh.js +1 -1
- package/dist/providers/registry.js +1 -1
- package/dist/secrets/apply.js +17 -17
- package/dist/secrets/audit.js +11 -11
- package/dist/secrets/runtime.js +1 -1
- 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/external-submission-ledger.js +376 -0
- package/dist/wallet/legacy-embedded-keystore.js +40 -0
- package/dist/wallet/local-socket-signer-archive.js +30 -0
- package/dist/wallet/local-socket-signer-lifecycle.js +97 -0
- package/dist/wallet/local-socket-signer-policy.js +166 -0
- package/dist/wallet/local-socket-signer-protocol.js +561 -118
- package/dist/wallet/native-signer-wallet-id.js +25 -0
- package/dist/wallet/providers/alchemy-adapter.js +3 -0
- package/dist/wallet/providers/local-socket-signer-adapter.js +382 -107
- package/dist/wallet/providers/turnkey-adapter.js +292 -34
- package/dist/wallet/providers/wallet-standard-adapter.js +100 -0
- package/dist/wallet/signer-network-admin.js +184 -0
- package/dist/wallet/signer-protocol-v2.generated.js +90 -0
- package/dist/wallet/solana-bond-signing.js +157 -69
- package/dist/wallet/solana-reviewed-transaction.js +375 -0
- package/dist/wallet/solana-swap.js +520 -64
- package/dist/wallet/solana-transaction-inspection.js +106 -4
- package/dist/wallet/solana-trigger.js +658 -320
- package/dist/wallet/turnkey-reviewed-state.js +370 -0
- package/dist/wallet/wallet-approval-auth.js +20 -31
- package/dist/wallet/wallet-atomic-state.js +53 -0
- package/dist/wallet/wallet-audit-log.js +5 -5
- package/dist/wallet/wallet-canary.js +0 -1
- package/dist/wallet/wallet-inbound-events.js +19 -14
- package/dist/wallet/wallet-observability.js +5 -5
- package/dist/wallet/wallet-policy-simulation.js +1 -1
- package/dist/wallet/wallet-policy.js +95 -41
- package/dist/wallet/wallet-provider-capabilities.js +28 -4
- package/dist/wallet/wallet-provider-registry.js +64 -51
- package/dist/wallet/wallet-provider-resolver.js +62 -63
- package/dist/wallet/wallet-runtime-config.js +31 -44
- package/dist/wallet/wallet-secrets-store.js +44 -22
- package/dist/wallet/wallet-send-approvals.js +1894 -592
- package/dist/wallet/wallet-send-execution-ledger.js +292 -0
- package/dist/wallet/wallet-settlement-links.js +17 -16
- package/dist/wallet/wallet-standard-review.js +353 -0
- package/dist/wallet/wallet-status.js +0 -9
- package/dist/wallet/wallet-task-ledger.js +16 -2
- package/dist/web/accounts.js +3 -3
- package/dist/web/auth-store.js +18 -18
- package/dist/web/auto-reply/heartbeat-runner.js +1 -1
- package/dist/web/auto-reply/monitor.js +2 -2
- package/dist/web/session.js +4 -4
- package/dist/wizard/host-security-capability.js +15 -24
- package/dist/wizard/onboarding.finalize.js +63 -184
- package/dist/wizard/onboarding.host-security.js +118 -1368
- package/dist/wizard/onboarding.js +180 -242
- package/dist/wizard/onboarding.wallet.js +323 -829
- 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 +18 -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 +18 -0
- package/extensions/msteams/package.json +1 -1
- package/extensions/nextcloud-talk/package.json +1 -1
- package/extensions/nostr/CHANGELOG.md +18 -0
- package/extensions/nostr/package.json +1 -1
- package/extensions/open-prose/package.json +1 -1
- package/extensions/sat-mining/index.ts +498 -153
- package/extensions/sat-mining/package.json +1 -1
- package/extensions/sat-mining/signer-codec-schema.v1.json +374 -0
- package/extensions/sat-mining/src/audit-store.ts +50 -5
- package/extensions/sat-mining/src/claim-service.ts +85 -14
- package/extensions/sat-mining/src/config.ts +9 -0
- package/extensions/sat-mining/src/cycle-progress.ts +16 -8
- package/extensions/sat-mining/src/epoch-service.ts +9 -5
- package/extensions/sat-mining/src/gateway-runner.ts +21 -1
- package/extensions/sat-mining/src/protocol-contract.ts +45 -1
- package/extensions/sat-mining/src/recovery-service.ts +312 -0
- package/extensions/sat-mining/src/round-watcher.ts +391 -81
- package/extensions/sat-mining/src/rpc-read.ts +330 -89
- package/extensions/sat-mining/src/runtime.ts +14 -0
- package/extensions/sat-mining/src/sat-bond-layout.ts +6 -0
- package/extensions/sat-mining/src/signer-codec-manifest.ts +429 -0
- package/extensions/sat-mining/src/solana-submit.ts +1199 -428
- package/extensions/sat-mining/src/submission-ledger.ts +433 -0
- 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 +18 -0
- package/extensions/twitch/package.json +1 -1
- package/extensions/voice-call/CHANGELOG.md +18 -0
- package/extensions/voice-call/package.json +1 -1
- package/extensions/zalo/CHANGELOG.md +18 -0
- package/extensions/zalo/package.json +1 -1
- package/extensions/zalouser/CHANGELOG.md +18 -0
- package/extensions/zalouser/package.json +1 -1
- package/install.sh +4955 -0
- package/package.json +24 -5
- package/scripts/fased-host-updater.mjs +1421 -0
- package/scripts/fased-host-updaterctl.mjs +186 -0
- package/scripts/fased-managed-service.sh +36 -0
- package/scripts/fased-managed-updater.mjs +3065 -156
- package/scripts/fased-signer-enroll-hosting.sh +275 -0
- package/scripts/fased-signer-network-hosting.sh +143 -0
- package/scripts/fased-signer-owner-policy.mjs +1430 -0
- package/scripts/fased-signer-policy-hosting.sh +50 -0
- package/scripts/fased-signer-policy-local.sh +26 -0
- package/scripts/hosted-release-manifest.mjs +185 -0
- package/scripts/install-fased-signerd.sh +217 -0
- package/scripts/install-managed-runtime.mjs +212 -10
- package/scripts/managed-runtime-layout.mjs +75 -3
- package/scripts/migrate-hosted-signer-v2.mjs +58 -0
- package/scripts/start-managed.sh +169 -360
- package/dist/control-ui/assets/mining-commit-R-6nu87p.js +0 -2
- package/dist/plugin-sdk/tmp-fased-dir-BdFQvrvw.d.ts +0 -77
- package/dist/wallet/local-socket-signer-broker.js +0 -224
- package/dist/wallet/local-socket-signer-custody.js +0 -42
- package/dist/wallet/providers/embedded-keystore-adapter.js +0 -402
- package/dist/wallet/providers/privy-adapter.js +0 -80
- package/dist/wallet/wallet-custody.js +0 -1836
|
@@ -1,10 +1,76 @@
|
|
|
1
|
-
import { fetchSolanaNativeBalanceViaRpc, fetchSolanaWalletAssetsViaRpc } from "./solana-assets.js";
|
|
2
|
-
import { applyWalletPolicyConfig,
|
|
1
|
+
import { SOLANA_ASSET_CONSTANTS, fetchSolanaMintInfoViaRpc, fetchSolanaNativeBalanceViaRpc, fetchSolanaWalletAssetsViaRpc } from "./solana-assets.js";
|
|
2
|
+
import { applyWalletPolicyConfig, validateWalletTxPolicy } from "./wallet-policy.js";
|
|
3
|
+
import { deriveAssociatedTokenAddress } from "./solana-spl-transfer.js";
|
|
3
4
|
import { createWalletProviderAdapter, resolveScopedRpcUrlForWallet } from "./wallet-provider-resolver.js";
|
|
5
|
+
import { beginExternalSubmission, claimExternalSubmissionExecution, createExternalSubmissionKey, updateExternalSubmission } from "./external-submission-ledger.js";
|
|
4
6
|
import { inspectSerializedSolanaSwapTransaction } from "./solana-transaction-inspection.js";
|
|
7
|
+
import { createHash } from "node:crypto";
|
|
5
8
|
|
|
6
9
|
//#region src/wallet/solana-swap.ts
|
|
7
10
|
const SOLANA_NATIVE_MINT = "So11111111111111111111111111111111111111112";
|
|
11
|
+
const DEFAULT_JUPITER_MAX_FEE_LAMPORTS = "5000000";
|
|
12
|
+
function storedSwapOrder(entry) {
|
|
13
|
+
const value = entry.details?.order;
|
|
14
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
const order = value;
|
|
18
|
+
if (order.ok !== true || typeof order.inputMint !== "string" || typeof order.outputMint !== "string" || typeof order.inAmount !== "string" || !order.raw || typeof order.raw !== "object" || Array.isArray(order.raw)) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
return order;
|
|
22
|
+
}
|
|
23
|
+
function storedSignerOperation(entry) {
|
|
24
|
+
const value = entry.result?.operation;
|
|
25
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
const operation = value;
|
|
29
|
+
if (typeof operation.requestId !== "string" || typeof operation.walletId !== "string" || typeof operation.intentType !== "string" || typeof operation.intentDigest !== "string" || typeof operation.policyHash !== "string" || typeof operation.asset !== "string" || typeof operation.amount !== "string" || ![
|
|
30
|
+
"reserved",
|
|
31
|
+
"broadcast",
|
|
32
|
+
"confirmed",
|
|
33
|
+
"failed",
|
|
34
|
+
"unknown"
|
|
35
|
+
].includes(operation.state ?? "")) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
return operation;
|
|
39
|
+
}
|
|
40
|
+
function signerReviewMatchesAutonomousSwap(params) {
|
|
41
|
+
const { review } = params;
|
|
42
|
+
return review.requestId === params.requestId && review.walletId === params.walletId && review.mode === "autonomous" && review.intentType === "solana.jupiter.swap" && review.semanticIntent.type === "solana.jupiter.swap" && review.semanticIntent.jupiter.owner === params.owner && review.semanticIntent.jupiter.inputMint === params.inputMint && review.semanticIntent.jupiter.outputMint === params.outputMint && review.semanticIntent.jupiter.inputAmount === params.amount && review.semanticIntent.jupiter.maxInputAmount === params.amount && review.transaction?.submission === "rpc" && Boolean(review.transaction.serializedTxBase64);
|
|
43
|
+
}
|
|
44
|
+
function swapExecutionResult(params) {
|
|
45
|
+
const { operation } = params;
|
|
46
|
+
if (operation.state !== "confirmed" || !operation.signature) {
|
|
47
|
+
const ambiguous = operation.state === "reserved" || operation.state === "broadcast" || operation.state === "unknown";
|
|
48
|
+
return {
|
|
49
|
+
ok: false,
|
|
50
|
+
code: ambiguous ? "wallet_provider_ambiguous" : "wallet_swap_failed",
|
|
51
|
+
message: ambiguous ? `signer operation ${operation.requestId} is ${operation.state}; reconcile its existing signature before any new Jupiter order` : operation.error ?? `typed Jupiter swap ended in state=${operation.state}`
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const tx = {
|
|
55
|
+
ok: true,
|
|
56
|
+
chain: "solana",
|
|
57
|
+
txHash: operation.signature,
|
|
58
|
+
signer: params.signer,
|
|
59
|
+
metadata: {
|
|
60
|
+
provider: "local-socket-signer",
|
|
61
|
+
signerProtocol: 2,
|
|
62
|
+
signerOperationState: operation.state,
|
|
63
|
+
signerIntentDigest: operation.intentDigest,
|
|
64
|
+
signerTransactionDigest: operation.transactionDigest,
|
|
65
|
+
...params.inspection ? { swapInspection: params.inspection } : {}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
return {
|
|
69
|
+
ok: true,
|
|
70
|
+
tx,
|
|
71
|
+
order: params.order
|
|
72
|
+
};
|
|
73
|
+
}
|
|
8
74
|
function stringValue(value) {
|
|
9
75
|
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
10
76
|
}
|
|
@@ -12,12 +78,13 @@ function numberValue(value) {
|
|
|
12
78
|
return typeof value === "number" && Number.isFinite(value) ? value : undefined;
|
|
13
79
|
}
|
|
14
80
|
function parsePositiveBaseUnits(value) {
|
|
15
|
-
|
|
81
|
+
const normalized = value?.trim();
|
|
82
|
+
if (!normalized || normalized.length > 32 || !/^\d+$/.test(normalized)) {
|
|
16
83
|
throw new Error("amount is required");
|
|
17
84
|
}
|
|
18
|
-
const parsed = BigInt(
|
|
19
|
-
if (parsed <= 0n) {
|
|
20
|
-
throw new Error("amount must be positive base units");
|
|
85
|
+
const parsed = BigInt(normalized);
|
|
86
|
+
if (parsed <= 0n || parsed > 18446744073709551615n) {
|
|
87
|
+
throw new Error("amount must be positive uint64 base units");
|
|
21
88
|
}
|
|
22
89
|
return parsed;
|
|
23
90
|
}
|
|
@@ -31,6 +98,93 @@ function normalizeSlippageBps(value) {
|
|
|
31
98
|
}
|
|
32
99
|
return rounded;
|
|
33
100
|
}
|
|
101
|
+
function resolveSolanaSwapMinimumOutput(order) {
|
|
102
|
+
if (order.otherAmountThreshold?.trim()) {
|
|
103
|
+
return parsePositiveBaseUnits(order.otherAmountThreshold).toString();
|
|
104
|
+
}
|
|
105
|
+
const quoted = parsePositiveBaseUnits(order.outAmount);
|
|
106
|
+
const slippageBps = BigInt(normalizeSlippageBps(order.slippageBps));
|
|
107
|
+
return ((quoted * (10000n - slippageBps) + 9999n) / 10000n).toString();
|
|
108
|
+
}
|
|
109
|
+
function resolveJupiterMaxFeeLamports(env) {
|
|
110
|
+
const value = env.FASED_WALLET_JUPITER_MAX_FEE_LAMPORTS?.trim() || DEFAULT_JUPITER_MAX_FEE_LAMPORTS;
|
|
111
|
+
const parsed = BigInt(value);
|
|
112
|
+
if (parsed <= 0n || parsed > 100000000n) {
|
|
113
|
+
throw new Error("FASED_WALLET_JUPITER_MAX_FEE_LAMPORTS must be between 1 and 100000000");
|
|
114
|
+
}
|
|
115
|
+
return parsed.toString();
|
|
116
|
+
}
|
|
117
|
+
function createSignerReviewId(prefix, seed) {
|
|
118
|
+
return `${prefix}:${createHash("sha256").update(seed).digest("hex")}`;
|
|
119
|
+
}
|
|
120
|
+
async function exactJupiterTokenAccount(params) {
|
|
121
|
+
const tokenProgramId = params.mint === SOLANA_NATIVE_MINT ? SOLANA_ASSET_CONSTANTS.tokenProgramId : (await fetchSolanaMintInfoViaRpc({
|
|
122
|
+
rpcUrl: params.rpcUrl,
|
|
123
|
+
mint: params.mint
|
|
124
|
+
}))?.tokenProgramId;
|
|
125
|
+
if (!tokenProgramId) {
|
|
126
|
+
throw new Error(`unable to resolve token program for mint ${params.mint}`);
|
|
127
|
+
}
|
|
128
|
+
return await deriveAssociatedTokenAddress({
|
|
129
|
+
owner: params.owner,
|
|
130
|
+
mint: params.mint,
|
|
131
|
+
tokenProgramId
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
async function buildSolanaSwapSignerIntent(params) {
|
|
135
|
+
const inAmount = parsePositiveBaseUnits(params.order.inAmount).toString();
|
|
136
|
+
const minimumOutputAmount = resolveSolanaSwapMinimumOutput(params.order);
|
|
137
|
+
const sourceTokenAccount = await exactJupiterTokenAccount({
|
|
138
|
+
rpcUrl: params.rpcUrl,
|
|
139
|
+
owner: params.owner,
|
|
140
|
+
mint: params.order.inputMint
|
|
141
|
+
});
|
|
142
|
+
const destinationTokenAccount = await exactJupiterTokenAccount({
|
|
143
|
+
rpcUrl: params.rpcUrl,
|
|
144
|
+
owner: params.owner,
|
|
145
|
+
mint: params.order.outputMint
|
|
146
|
+
});
|
|
147
|
+
return {
|
|
148
|
+
type: "solana.jupiter.swap",
|
|
149
|
+
jupiter: {
|
|
150
|
+
owner: params.owner,
|
|
151
|
+
inputMint: params.order.inputMint,
|
|
152
|
+
outputMint: params.order.outputMint,
|
|
153
|
+
inputAmount: inAmount,
|
|
154
|
+
maxInputAmount: inAmount,
|
|
155
|
+
minimumOutputAmount,
|
|
156
|
+
maxFeeLamports: resolveJupiterMaxFeeLamports(params.env ?? process.env),
|
|
157
|
+
sourceTokenAccount,
|
|
158
|
+
destinationTokenAccount,
|
|
159
|
+
programs: [...params.inspection.programIds].toSorted()
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
async function prepareSolanaSwapSignerReview(params) {
|
|
164
|
+
if (!params.provider.prepareJupiterReview) {
|
|
165
|
+
throw new Error("Jupiter execution requires protocol-v2 local-socket-signer review.prepare support");
|
|
166
|
+
}
|
|
167
|
+
const intent = await buildSolanaSwapSignerIntent(params);
|
|
168
|
+
if (!params.order.transaction) {
|
|
169
|
+
throw new Error("Jupiter signer review requires the exact serialized transaction");
|
|
170
|
+
}
|
|
171
|
+
const review = await params.provider.prepareJupiterReview({
|
|
172
|
+
walletId: params.walletId,
|
|
173
|
+
requestId: params.requestId ?? createSignerReviewId("jupiter-swap", params.order.requestId ?? params.order.transaction ?? JSON.stringify(params.order.raw)),
|
|
174
|
+
mode: params.mode,
|
|
175
|
+
intent,
|
|
176
|
+
transaction: {
|
|
177
|
+
serializedTxBase64: params.order.transaction,
|
|
178
|
+
programs: params.inspection.programIds,
|
|
179
|
+
writableAccounts: params.inspection.writableAccounts,
|
|
180
|
+
submission: "rpc"
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
return {
|
|
184
|
+
review,
|
|
185
|
+
intent
|
|
186
|
+
};
|
|
187
|
+
}
|
|
34
188
|
function resolveSwapApiBaseUrl(env = process.env) {
|
|
35
189
|
const raw = env.FASED_JUPITER_SWAP_API_BASE_URL?.trim() || env.JUPITER_SWAP_API_BASE_URL?.trim() || "https://api.jup.ag/swap/v2";
|
|
36
190
|
return raw.replace(/\/+$/, "");
|
|
@@ -59,6 +213,26 @@ function extractRouteLabel(raw) {
|
|
|
59
213
|
function isSolanaSwapApprovalPayload(payload) {
|
|
60
214
|
return payload.actionKind === "solana_swap" && payload.chain === "solana" && Boolean(payload.inputMint?.trim()) && Boolean(payload.outputMint?.trim()) && Boolean(payload.amount?.trim()) && Boolean(payload.walletId?.trim());
|
|
61
215
|
}
|
|
216
|
+
function reviewedSolanaSwapOrderFromPayload(payload) {
|
|
217
|
+
const transaction = payload.serializedTxBase64?.trim();
|
|
218
|
+
if (!transaction || !isSolanaSwapApprovalPayload(payload)) {
|
|
219
|
+
return undefined;
|
|
220
|
+
}
|
|
221
|
+
return {
|
|
222
|
+
ok: true,
|
|
223
|
+
requestId: payload.jupiterRequestId,
|
|
224
|
+
transaction,
|
|
225
|
+
inputMint: payload.inputMint,
|
|
226
|
+
outputMint: payload.outputMint,
|
|
227
|
+
inAmount: payload.amount,
|
|
228
|
+
outAmount: payload.outAmount,
|
|
229
|
+
otherAmountThreshold: payload.otherAmountThreshold,
|
|
230
|
+
slippageBps: payload.slippageBps,
|
|
231
|
+
priceImpactPct: payload.priceImpactPct,
|
|
232
|
+
routeLabel: payload.routeLabel,
|
|
233
|
+
raw: {}
|
|
234
|
+
};
|
|
235
|
+
}
|
|
62
236
|
async function fetchJupiterSwapOrder(params) {
|
|
63
237
|
const env = params.env ?? process.env;
|
|
64
238
|
parsePositiveBaseUnits(params.amount);
|
|
@@ -84,13 +258,17 @@ async function fetchJupiterSwapOrder(params) {
|
|
|
84
258
|
if (errorMessage && !stringValue(body.transaction)) {
|
|
85
259
|
throw new Error(`jupiter order failed: ${errorMessage}`);
|
|
86
260
|
}
|
|
261
|
+
const inAmount = stringValue(body.inAmount) ?? params.amount.trim();
|
|
262
|
+
if (parsePositiveBaseUnits(inAmount) !== parsePositiveBaseUnits(params.amount)) {
|
|
263
|
+
throw new Error("jupiter order changed the requested exact input amount");
|
|
264
|
+
}
|
|
87
265
|
return {
|
|
88
266
|
ok: true,
|
|
89
267
|
requestId: stringValue(body.requestId),
|
|
90
268
|
transaction: stringValue(body.transaction) ?? stringValue(body.tx),
|
|
91
269
|
inputMint,
|
|
92
270
|
outputMint,
|
|
93
|
-
inAmount
|
|
271
|
+
inAmount,
|
|
94
272
|
outAmount: stringValue(body.outAmount),
|
|
95
273
|
otherAmountThreshold: stringValue(body.otherAmountThreshold),
|
|
96
274
|
slippageBps: numberValue(body.slippageBps) ?? normalizeSlippageBps(params.slippageBps),
|
|
@@ -159,7 +337,11 @@ function validateSolanaSwapIntentPolicy(params) {
|
|
|
159
337
|
function validateSolanaSwapRoutePolicy(params) {
|
|
160
338
|
const allowlist = new Set(params.config.policy.solana.allowPrograms.map((program) => program.trim()).filter(Boolean));
|
|
161
339
|
if (allowlist.size === 0) {
|
|
162
|
-
return {
|
|
340
|
+
return {
|
|
341
|
+
ok: false,
|
|
342
|
+
code: "wallet_swap_program_allowlist_required",
|
|
343
|
+
message: "swap execution requires an explicit non-empty Solana program allowlist"
|
|
344
|
+
};
|
|
163
345
|
}
|
|
164
346
|
const denied = params.routeProgramIds.filter((programId) => !allowlist.has(programId));
|
|
165
347
|
if (denied.length === 0) {
|
|
@@ -256,21 +438,6 @@ async function executeSolanaSwapApprovalPayload(params) {
|
|
|
256
438
|
message: policy.message ?? "wallet policy rejected"
|
|
257
439
|
};
|
|
258
440
|
}
|
|
259
|
-
const daily = enforceWalletDailyCap({
|
|
260
|
-
config: effectiveConfig,
|
|
261
|
-
chain: "solana",
|
|
262
|
-
amount: params.payload.amount,
|
|
263
|
-
tokenMint: params.payload.inputMint === SOLANA_NATIVE_MINT ? undefined : params.payload.inputMint,
|
|
264
|
-
walletId: params.payload.walletId,
|
|
265
|
-
env
|
|
266
|
-
});
|
|
267
|
-
if (!daily.ok) {
|
|
268
|
-
return {
|
|
269
|
-
ok: false,
|
|
270
|
-
code: daily.code ?? "wallet_cap_daily_exceeded",
|
|
271
|
-
message: daily.message ?? "wallet daily cap exceeded"
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
441
|
const provider = createWalletProviderAdapter({
|
|
275
442
|
cfg: params.runtimeConfig,
|
|
276
443
|
wallet: params.config,
|
|
@@ -292,51 +459,340 @@ async function executeSolanaSwapApprovalPayload(params) {
|
|
|
292
459
|
message: "wallet has no Solana address"
|
|
293
460
|
};
|
|
294
461
|
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
if (!balance.ok) {
|
|
302
|
-
return balance;
|
|
462
|
+
if (!rpcUrl?.trim()) {
|
|
463
|
+
return {
|
|
464
|
+
ok: false,
|
|
465
|
+
code: "wallet_swap_rpc_required",
|
|
466
|
+
message: "Solana RPC is required for signer-owned Jupiter validation"
|
|
467
|
+
};
|
|
303
468
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
env
|
|
311
|
-
});
|
|
312
|
-
const inspection = await inspectAndValidateSolanaSwapOrder({
|
|
313
|
-
order,
|
|
314
|
-
expectedSigner: taker,
|
|
315
|
-
rpcUrl,
|
|
316
|
-
config: effectiveConfig
|
|
317
|
-
});
|
|
318
|
-
if (!inspection.ok) {
|
|
319
|
-
return inspection;
|
|
469
|
+
if (!provider.executeJupiterReview) {
|
|
470
|
+
return {
|
|
471
|
+
ok: false,
|
|
472
|
+
code: "wallet_signer_v2_required",
|
|
473
|
+
message: "Jupiter execution requires protocol-v2 local-socket-signer review.execute support"
|
|
474
|
+
};
|
|
320
475
|
}
|
|
321
|
-
const
|
|
322
|
-
|
|
476
|
+
const autonomousIdentity = params.autonomous ? createExternalSubmissionKey({
|
|
477
|
+
kind: "jupiter-swap",
|
|
323
478
|
walletId: params.payload.walletId,
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
479
|
+
explicitIntentId: params.payload.executionIntentId,
|
|
480
|
+
intent: {
|
|
481
|
+
owner: taker,
|
|
482
|
+
inputMint: params.payload.inputMint,
|
|
483
|
+
outputMint: params.payload.outputMint,
|
|
484
|
+
amount: params.payload.amount,
|
|
485
|
+
slippageBps: normalizeSlippageBps(params.payload.slippageBps),
|
|
486
|
+
apiBaseUrl: resolveSwapApiBaseUrl(env),
|
|
487
|
+
rpcUrlDigest: `sha256:${createHash("sha256").update(rpcUrl).digest("hex")}`
|
|
488
|
+
}
|
|
489
|
+
}) : undefined;
|
|
490
|
+
let entry = autonomousIdentity ? (await beginExternalSubmission({
|
|
491
|
+
...autonomousIdentity,
|
|
492
|
+
kind: "jupiter-swap",
|
|
493
|
+
walletId: params.payload.walletId,
|
|
494
|
+
details: { semanticIntent: {
|
|
495
|
+
owner: taker,
|
|
496
|
+
inputMint: params.payload.inputMint,
|
|
497
|
+
outputMint: params.payload.outputMint,
|
|
498
|
+
amount: params.payload.amount,
|
|
499
|
+
slippageBps: normalizeSlippageBps(params.payload.slippageBps)
|
|
500
|
+
} },
|
|
501
|
+
env
|
|
502
|
+
})).entry : undefined;
|
|
503
|
+
const releaseExecution = autonomousIdentity ? await claimExternalSubmissionExecution(autonomousIdentity.key, env) : undefined;
|
|
504
|
+
try {
|
|
505
|
+
let order = entry ? storedSwapOrder(entry) : undefined;
|
|
506
|
+
if (entry?.state === "confirmed") {
|
|
507
|
+
const operation = storedSignerOperation(entry);
|
|
508
|
+
if (!operation || !order) {
|
|
509
|
+
return {
|
|
510
|
+
ok: false,
|
|
511
|
+
code: "wallet_provider_ambiguous",
|
|
512
|
+
message: "confirmed swap ledger entry is incomplete; refusing to create another order"
|
|
513
|
+
};
|
|
335
514
|
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
515
|
+
return swapExecutionResult({
|
|
516
|
+
operation,
|
|
517
|
+
signer: typeof entry.result?.signer === "string" ? entry.result.signer : taker,
|
|
518
|
+
order
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
if (entry?.signerRequestId && (entry.state === "unknown" || entry.state === "submitting" || entry.state === "signed")) {
|
|
522
|
+
let operation;
|
|
523
|
+
try {
|
|
524
|
+
operation = provider.reconcileSignerOperation ? await provider.reconcileSignerOperation({
|
|
525
|
+
walletId: params.payload.walletId,
|
|
526
|
+
requestId: entry.signerRequestId
|
|
527
|
+
}) : provider.getSignerOperation ? await provider.getSignerOperation({
|
|
528
|
+
walletId: params.payload.walletId,
|
|
529
|
+
requestId: entry.signerRequestId
|
|
530
|
+
}) : undefined;
|
|
531
|
+
} catch {
|
|
532
|
+
operation = undefined;
|
|
533
|
+
}
|
|
534
|
+
if (!operation || !order) {
|
|
535
|
+
return {
|
|
536
|
+
ok: false,
|
|
537
|
+
code: "wallet_provider_ambiguous",
|
|
538
|
+
message: `swap intent ${entry.key} has an unresolved signer submission; no new Jupiter order was created`
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
if (operation.state === "confirmed" && operation.signature) {
|
|
542
|
+
entry = await updateExternalSubmission({
|
|
543
|
+
key: entry.key,
|
|
544
|
+
expectedStates: [
|
|
545
|
+
"unknown",
|
|
546
|
+
"submitting",
|
|
547
|
+
"signed"
|
|
548
|
+
],
|
|
549
|
+
state: "confirmed",
|
|
550
|
+
patch: {
|
|
551
|
+
result: {
|
|
552
|
+
operation,
|
|
553
|
+
signer: taker
|
|
554
|
+
},
|
|
555
|
+
reason: undefined
|
|
556
|
+
},
|
|
557
|
+
env
|
|
558
|
+
});
|
|
559
|
+
} else if (operation.state === "failed") {
|
|
560
|
+
entry = await updateExternalSubmission({
|
|
561
|
+
key: entry.key,
|
|
562
|
+
expectedStates: [
|
|
563
|
+
"unknown",
|
|
564
|
+
"submitting",
|
|
565
|
+
"signed"
|
|
566
|
+
],
|
|
567
|
+
state: "failed",
|
|
568
|
+
patch: {
|
|
569
|
+
result: {
|
|
570
|
+
operation,
|
|
571
|
+
signer: taker
|
|
572
|
+
},
|
|
573
|
+
reason: operation.error
|
|
574
|
+
},
|
|
575
|
+
env
|
|
576
|
+
});
|
|
577
|
+
} else {
|
|
578
|
+
await updateExternalSubmission({
|
|
579
|
+
key: entry.key,
|
|
580
|
+
expectedStates: [
|
|
581
|
+
"unknown",
|
|
582
|
+
"submitting",
|
|
583
|
+
"signed"
|
|
584
|
+
],
|
|
585
|
+
state: "unknown",
|
|
586
|
+
patch: {
|
|
587
|
+
result: {
|
|
588
|
+
operation,
|
|
589
|
+
signer: taker
|
|
590
|
+
},
|
|
591
|
+
reason: `signer operation remains ${operation.state}`
|
|
592
|
+
},
|
|
593
|
+
env
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
return swapExecutionResult({
|
|
597
|
+
operation,
|
|
598
|
+
signer: taker,
|
|
599
|
+
order
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
if (entry?.state === "failed") {
|
|
603
|
+
const operation = storedSignerOperation(entry);
|
|
604
|
+
return {
|
|
605
|
+
ok: false,
|
|
606
|
+
code: "wallet_swap_failed",
|
|
607
|
+
message: operation?.error ?? entry.reason ?? "this swap intent failed; use a distinct explicit intentId for a new order"
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
if (entry?.state === "reserved" && provider.getSignerReview && autonomousIdentity) {
|
|
611
|
+
try {
|
|
612
|
+
const recovered = await provider.getSignerReview({
|
|
613
|
+
walletId: params.payload.walletId,
|
|
614
|
+
requestId: autonomousIdentity.key
|
|
615
|
+
});
|
|
616
|
+
if (!signerReviewMatchesAutonomousSwap({
|
|
617
|
+
review: recovered,
|
|
618
|
+
requestId: autonomousIdentity.key,
|
|
619
|
+
walletId: params.payload.walletId,
|
|
620
|
+
owner: taker,
|
|
621
|
+
inputMint: params.payload.inputMint,
|
|
622
|
+
outputMint: params.payload.outputMint,
|
|
623
|
+
amount: params.payload.amount
|
|
624
|
+
})) {
|
|
625
|
+
throw new Error("stored signer review does not match the durable autonomous swap intent");
|
|
626
|
+
}
|
|
627
|
+
if (recovered.semanticIntent.type !== "solana.jupiter.swap") {
|
|
628
|
+
throw new Error("stored signer review has an unexpected semantic intent type");
|
|
629
|
+
}
|
|
630
|
+
order = {
|
|
631
|
+
ok: true,
|
|
632
|
+
transaction: recovered.transaction.serializedTxBase64,
|
|
633
|
+
inputMint: params.payload.inputMint,
|
|
634
|
+
outputMint: params.payload.outputMint,
|
|
635
|
+
inAmount: params.payload.amount,
|
|
636
|
+
otherAmountThreshold: recovered.semanticIntent.jupiter.minimumOutputAmount,
|
|
637
|
+
slippageBps: params.payload.slippageBps,
|
|
638
|
+
raw: {}
|
|
639
|
+
};
|
|
640
|
+
entry = await updateExternalSubmission({
|
|
641
|
+
key: entry.key,
|
|
642
|
+
expectedStates: ["reserved"],
|
|
643
|
+
state: "prepared",
|
|
644
|
+
patch: {
|
|
645
|
+
signerRequestId: recovered.requestId,
|
|
646
|
+
signerIntentDigest: recovered.intentDigest,
|
|
647
|
+
transactionDigest: recovered.transactionDigest,
|
|
648
|
+
details: {
|
|
649
|
+
...entry.details,
|
|
650
|
+
order
|
|
651
|
+
}
|
|
652
|
+
},
|
|
653
|
+
env
|
|
654
|
+
});
|
|
655
|
+
} catch {}
|
|
656
|
+
}
|
|
657
|
+
const balance = await validateSolanaSwapInputBalance({
|
|
658
|
+
rpcUrl,
|
|
659
|
+
ownerAddress: taker,
|
|
660
|
+
inputMint: params.payload.inputMint,
|
|
661
|
+
amount: params.payload.amount
|
|
662
|
+
});
|
|
663
|
+
if (!balance.ok) {
|
|
664
|
+
return balance;
|
|
665
|
+
}
|
|
666
|
+
const reviewedOrder = params.autonomous ? undefined : reviewedSolanaSwapOrderFromPayload(params.payload);
|
|
667
|
+
order = order ?? reviewedOrder ?? await fetchJupiterSwapOrder({
|
|
668
|
+
inputMint: params.payload.inputMint,
|
|
669
|
+
outputMint: params.payload.outputMint,
|
|
670
|
+
amount: params.payload.amount,
|
|
671
|
+
slippageBps: params.payload.slippageBps,
|
|
672
|
+
taker,
|
|
673
|
+
env
|
|
674
|
+
});
|
|
675
|
+
const inspection = await inspectAndValidateSolanaSwapOrder({
|
|
676
|
+
order,
|
|
677
|
+
expectedSigner: taker,
|
|
678
|
+
rpcUrl,
|
|
679
|
+
config: effectiveConfig
|
|
680
|
+
});
|
|
681
|
+
if (!inspection.ok) {
|
|
682
|
+
return inspection;
|
|
683
|
+
}
|
|
684
|
+
if (!order.transaction) {
|
|
685
|
+
return {
|
|
686
|
+
ok: false,
|
|
687
|
+
code: "wallet_signer_v2_required",
|
|
688
|
+
message: "Jupiter signer review requires the exact serialized transaction"
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
let signerReviewRequestId;
|
|
692
|
+
if (params.autonomous && autonomousIdentity && entry) {
|
|
693
|
+
if (entry.state === "reserved") {
|
|
694
|
+
const prepared = await prepareSolanaSwapSignerReview({
|
|
695
|
+
provider,
|
|
696
|
+
walletId: params.payload.walletId,
|
|
697
|
+
owner: taker,
|
|
698
|
+
order,
|
|
699
|
+
inspection,
|
|
700
|
+
rpcUrl,
|
|
701
|
+
mode: "autonomous",
|
|
702
|
+
requestId: autonomousIdentity.key,
|
|
703
|
+
env
|
|
704
|
+
});
|
|
705
|
+
signerReviewRequestId = prepared.review.requestId;
|
|
706
|
+
entry = await updateExternalSubmission({
|
|
707
|
+
key: entry.key,
|
|
708
|
+
expectedStates: ["reserved"],
|
|
709
|
+
state: "prepared",
|
|
710
|
+
patch: {
|
|
711
|
+
signerRequestId: prepared.review.requestId,
|
|
712
|
+
signerIntentDigest: prepared.review.intentDigest,
|
|
713
|
+
transactionDigest: prepared.review.transactionDigest,
|
|
714
|
+
details: {
|
|
715
|
+
...entry.details,
|
|
716
|
+
order
|
|
717
|
+
}
|
|
718
|
+
},
|
|
719
|
+
env
|
|
720
|
+
});
|
|
721
|
+
} else {
|
|
722
|
+
signerReviewRequestId = entry.signerRequestId ?? "";
|
|
723
|
+
}
|
|
724
|
+
if (!signerReviewRequestId || signerReviewRequestId !== autonomousIdentity.key) {
|
|
725
|
+
return {
|
|
726
|
+
ok: false,
|
|
727
|
+
code: "wallet_provider_ambiguous",
|
|
728
|
+
message: "durable autonomous swap is not bound to its stable signer request"
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
} else {
|
|
732
|
+
const requestId = params.payload.signerReviewId?.trim();
|
|
733
|
+
if (!requestId) {
|
|
734
|
+
return {
|
|
735
|
+
ok: false,
|
|
736
|
+
code: "wallet_signer_review_missing",
|
|
737
|
+
message: "reviewed Jupiter swap is not bound to signer review.prepare"
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
signerReviewRequestId = requestId;
|
|
741
|
+
}
|
|
742
|
+
let executed;
|
|
743
|
+
try {
|
|
744
|
+
executed = await provider.executeJupiterReview({
|
|
745
|
+
walletId: params.payload.walletId,
|
|
746
|
+
requestId: signerReviewRequestId,
|
|
747
|
+
...params.reviewAuthorization ? { authorization: params.reviewAuthorization } : {}
|
|
748
|
+
});
|
|
749
|
+
} catch (error) {
|
|
750
|
+
if (entry) {
|
|
751
|
+
await updateExternalSubmission({
|
|
752
|
+
key: entry.key,
|
|
753
|
+
expectedStates: ["prepared"],
|
|
754
|
+
state: "unknown",
|
|
755
|
+
patch: { reason: `signer response was lost after exact review preparation: ${String(error)}` },
|
|
756
|
+
env
|
|
757
|
+
});
|
|
758
|
+
return {
|
|
759
|
+
ok: false,
|
|
760
|
+
code: "wallet_provider_ambiguous",
|
|
761
|
+
message: `signer response for ${signerReviewRequestId} is ambiguous; reconcile it before any new Jupiter order`
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
throw error;
|
|
765
|
+
}
|
|
766
|
+
const result = swapExecutionResult({
|
|
767
|
+
operation: executed.operation,
|
|
768
|
+
signer: executed.signer,
|
|
769
|
+
order,
|
|
770
|
+
inspection
|
|
771
|
+
});
|
|
772
|
+
if (entry) {
|
|
773
|
+
const confirmed = executed.operation.state === "confirmed" && Boolean(executed.operation.signature);
|
|
774
|
+
const failed = executed.operation.state === "failed";
|
|
775
|
+
await updateExternalSubmission({
|
|
776
|
+
key: entry.key,
|
|
777
|
+
expectedStates: ["prepared"],
|
|
778
|
+
state: confirmed ? "confirmed" : failed ? "failed" : "unknown",
|
|
779
|
+
patch: {
|
|
780
|
+
signerSignature: executed.operation.signature,
|
|
781
|
+
transactionDigest: executed.operation.transactionDigest,
|
|
782
|
+
result: {
|
|
783
|
+
operation: executed.operation,
|
|
784
|
+
signer: executed.signer
|
|
785
|
+
},
|
|
786
|
+
reason: result.ok ? undefined : result.message
|
|
787
|
+
},
|
|
788
|
+
env
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
return result;
|
|
792
|
+
} finally {
|
|
793
|
+
await releaseExecution?.();
|
|
794
|
+
}
|
|
339
795
|
}
|
|
340
796
|
|
|
341
797
|
//#endregion
|
|
342
|
-
export { SOLANA_NATIVE_MINT, executeSolanaSwapApprovalPayload, fetchJupiterSwapOrder, inspectAndValidateSolanaSwapOrder, isSolanaSwapApprovalPayload, validateSolanaSwapInputBalance, validateSolanaSwapIntentPolicy };
|
|
798
|
+
export { SOLANA_NATIVE_MINT, executeSolanaSwapApprovalPayload, fetchJupiterSwapOrder, inspectAndValidateSolanaSwapOrder, isSolanaSwapApprovalPayload, prepareSolanaSwapSignerReview, resolveJupiterMaxFeeLamports, validateSolanaSwapInputBalance, validateSolanaSwapIntentPolicy };
|