@onecraft/wallet 0.0.0-stage → 0.1.145
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/.claude-plugin/marketplace.json +20 -0
- package/.openclaw/AGENTS.md +100 -0
- package/.openclaw/extensions/agent-wallet/README.md +195 -0
- package/.openclaw/extensions/agent-wallet/dist/index.js +2198 -0
- package/.openclaw/extensions/agent-wallet/index.ts +2198 -0
- package/.openclaw/extensions/agent-wallet/openclaw.plugin.json +251 -0
- package/.openclaw/extensions/agent-wallet/package.json +49 -0
- package/.openclaw/extensions/agent-wallet/skills/cards/SKILL.md +211 -0
- package/.openclaw/extensions/agent-wallet/skills/wallet-operator/SKILL.md +30 -0
- package/CHANGELOG.md +1232 -0
- package/LICENSE +104 -0
- package/README.md +193 -2
- package/VERSION +1 -0
- package/agent-wallet/.env.example +63 -0
- package/agent-wallet/AGENTS.md +130 -0
- package/agent-wallet/CARD_VAULT.md +640 -0
- package/agent-wallet/README.md +615 -0
- package/agent-wallet/UPGRADE_COMPATIBILITY.md +66 -0
- package/agent-wallet/agent_wallet/__init__.py +16 -0
- package/agent-wallet/agent_wallet/approval.py +165 -0
- package/agent-wallet/agent_wallet/autonomous_permissions.py +281 -0
- package/agent-wallet/agent_wallet/autonomous_policy.py +305 -0
- package/agent-wallet/agent_wallet/autonomous_session.py +236 -0
- package/agent-wallet/agent_wallet/boot_key_migration.py +155 -0
- package/agent-wallet/agent_wallet/boot_key_recovery.py +57 -0
- package/agent-wallet/agent_wallet/bootstrap.py +194 -0
- package/agent-wallet/agent_wallet/card_catalog.py +243 -0
- package/agent-wallet/agent_wallet/card_runtime_secrets.py +108 -0
- package/agent-wallet/agent_wallet/card_vault.py +331 -0
- package/agent-wallet/agent_wallet/card_vault_cli.py +174 -0
- package/agent-wallet/agent_wallet/card_vault_import.py +65 -0
- package/agent-wallet/agent_wallet/card_vault_keychain.py +239 -0
- package/agent-wallet/agent_wallet/config.py +719 -0
- package/agent-wallet/agent_wallet/connector_cli.py +198 -0
- package/agent-wallet/agent_wallet/connectors/__init__.py +28 -0
- package/agent-wallet/agent_wallet/connectors/catalog.py +68 -0
- package/agent-wallet/agent_wallet/connectors/client.py +308 -0
- package/agent-wallet/agent_wallet/connectors/intent_policy.py +243 -0
- package/agent-wallet/agent_wallet/connectors/manifest.py +192 -0
- package/agent-wallet/agent_wallet/connectors/registry.py +341 -0
- package/agent-wallet/agent_wallet/encrypted_storage.py +314 -0
- package/agent-wallet/agent_wallet/evm_user_wallets.py +910 -0
- package/agent-wallet/agent_wallet/exceptions.py +10 -0
- package/agent-wallet/agent_wallet/file_ops.py +34 -0
- package/agent-wallet/agent_wallet/http_client.py +25 -0
- package/agent-wallet/agent_wallet/kernel_browser.py +479 -0
- package/agent-wallet/agent_wallet/kernel_cli.py +57 -0
- package/agent-wallet/agent_wallet/kernel_gateway.py +95 -0
- package/agent-wallet/agent_wallet/keystore.py +503 -0
- package/agent-wallet/agent_wallet/laso_card_vault.py +246 -0
- package/agent-wallet/agent_wallet/models.py +66 -0
- package/agent-wallet/agent_wallet/morpho_monitor.py +298 -0
- package/agent-wallet/agent_wallet/nonce_registry.py +59 -0
- package/agent-wallet/agent_wallet/openclaw_adapter.py +9129 -0
- package/agent-wallet/agent_wallet/openclaw_cli.py +658 -0
- package/agent-wallet/agent_wallet/openclaw_runtime.py +194 -0
- package/agent-wallet/agent_wallet/plugin_bundle.py +44 -0
- package/agent-wallet/agent_wallet/providers/__init__.py +1 -0
- package/agent-wallet/agent_wallet/providers/bags.py +202 -0
- package/agent-wallet/agent_wallet/providers/dexscreener.py +147 -0
- package/agent-wallet/agent_wallet/providers/evm_activity.py +257 -0
- package/agent-wallet/agent_wallet/providers/evm_portfolio.py +459 -0
- package/agent-wallet/agent_wallet/providers/imd.py +720 -0
- package/agent-wallet/agent_wallet/providers/jupiter.py +519 -0
- package/agent-wallet/agent_wallet/providers/kamino.py +404 -0
- package/agent-wallet/agent_wallet/providers/lifi.py +302 -0
- package/agent-wallet/agent_wallet/providers/solana_rpc.py +447 -0
- package/agent-wallet/agent_wallet/providers/tokenized_stocks.py +189 -0
- package/agent-wallet/agent_wallet/providers/wdk_evm_local.py +346 -0
- package/agent-wallet/agent_wallet/providers/x402.py +1972 -0
- package/agent-wallet/agent_wallet/sealed_keys.py +118 -0
- package/agent-wallet/agent_wallet/solana_stake.py +103 -0
- package/agent-wallet/agent_wallet/solana_tx.py +93 -0
- package/agent-wallet/agent_wallet/spending_limits.py +119 -0
- package/agent-wallet/agent_wallet/telemetry.py +481 -0
- package/agent-wallet/agent_wallet/transaction_policy.py +573 -0
- package/agent-wallet/agent_wallet/update_check.py +190 -0
- package/agent-wallet/agent_wallet/user_wallets.py +573 -0
- package/agent-wallet/agent_wallet/validation.py +31 -0
- package/agent-wallet/agent_wallet/vault_executor.py +456 -0
- package/agent-wallet/agent_wallet/wallet_layer/__init__.py +1 -0
- package/agent-wallet/agent_wallet/wallet_layer/base.py +1204 -0
- package/agent-wallet/agent_wallet/wallet_layer/base58.py +44 -0
- package/agent-wallet/agent_wallet/wallet_layer/factory.py +117 -0
- package/agent-wallet/agent_wallet/wallet_layer/solana.py +5246 -0
- package/agent-wallet/agent_wallet/wallet_layer/wdk_evm.py +2705 -0
- package/agent-wallet/examples/bootstrap_wallet.py +21 -0
- package/agent-wallet/examples/openclaw_runtime_onboarding.py +28 -0
- package/agent-wallet/examples/openclaw_user_wallet_example.py +31 -0
- package/agent-wallet/examples/openclaw_wallet_adapter_example.py +33 -0
- package/agent-wallet/openclaw.plugin.json +118 -0
- package/agent-wallet/pyproject.toml +36 -0
- package/agent-wallet/scripts/bootstrap_openclaw_evm.py +312 -0
- package/agent-wallet/scripts/build_release_bundle.py +210 -0
- package/agent-wallet/scripts/finalize_openclaw_local_wallet_config.py +121 -0
- package/agent-wallet/scripts/install_agent_wallet.py +1357 -0
- package/agent-wallet/scripts/install_openclaw_local_config.py +421 -0
- package/agent-wallet/scripts/install_openclaw_sealed_keys.py +117 -0
- package/agent-wallet/scripts/manage_openclaw_evm_wallet.py +333 -0
- package/agent-wallet/scripts/security_utils.py +37 -0
- package/agent-wallet/scripts/setup_evm_wallet.sh +140 -0
- package/agent-wallet/scripts/switch_openclaw_wallet_network.py +109 -0
- package/agent-wallet/skills/wallet-operator/SKILL.md +157 -0
- package/bin/lib/boot-key.mjs +184 -0
- package/bin/lib/evm-daemon.mjs +389 -0
- package/bin/lib/host-detection.mjs +259 -0
- package/bin/lib/integrations.mjs +578 -0
- package/bin/lib/release-python.mjs +9 -0
- package/bin/lib/update-transaction.mjs +235 -0
- package/bin/openclaw-agent-wallet.mjs +3354 -0
- package/claude-code/plugins/agent-wallet/.claude-plugin/plugin.json +19 -0
- package/claude-code/plugins/agent-wallet/.mcp.json +14 -0
- package/claude-code/plugins/agent-wallet/AGENTLAYER_AGENT_GUIDE.md +282 -0
- package/claude-code/plugins/agent-wallet/README.md +134 -0
- package/claude-code/plugins/agent-wallet/commands/agentlayer-autonomous-approve.md +39 -0
- package/claude-code/plugins/agent-wallet/commands/agentlayer-autonomous-revoke.md +17 -0
- package/claude-code/plugins/agent-wallet/commands/cards.md +129 -0
- package/claude-code/plugins/agent-wallet/commands/guide.md +40 -0
- package/claude-code/plugins/agent-wallet/commands/imd.md +125 -0
- package/claude-code/plugins/agent-wallet/commands/wallet-base.md +60 -0
- package/claude-code/plugins/agent-wallet/commands/wallet-ethereum.md +37 -0
- package/claude-code/plugins/agent-wallet/commands/wallet-evm.md +39 -0
- package/claude-code/plugins/agent-wallet/commands/wallet-setup.md +25 -0
- package/claude-code/plugins/agent-wallet/commands/wallet-sol.md +51 -0
- package/claude-code/plugins/agent-wallet/commands/wallet-statusline.md +34 -0
- package/claude-code/plugins/agent-wallet/commands/x402.md +121 -0
- package/claude-code/plugins/agent-wallet/commands/yield.md +62 -0
- package/claude-code/plugins/agent-wallet/hooks/hooks.json +16 -0
- package/claude-code/plugins/agent-wallet/scripts/bootstrap_backend.sh +136 -0
- package/claude-code/plugins/agent-wallet/scripts/enable_statusline.py +52 -0
- package/claude-code/plugins/agent-wallet/scripts/resolve_wallet_addresses.py +69 -0
- package/claude-code/plugins/agent-wallet/scripts/run_mcp.sh +66 -0
- package/claude-code/plugins/agent-wallet/scripts/wallet_statusline.py +130 -0
- package/claude-code/plugins/agent-wallet/scripts/wallet_statusline_setup.sh +40 -0
- package/claude-code/plugins/agent-wallet/skills/wallet-operator/SKILL.md +21 -0
- package/codex/plugins/agent-wallet/.codex-plugin/plugin.json +37 -0
- package/codex/plugins/agent-wallet/.mcp.json +15 -0
- package/codex/plugins/agent-wallet/README.md +158 -0
- package/codex/plugins/agent-wallet/scripts/run_mcp.sh +47 -0
- package/codex/plugins/agent-wallet/server.py +1797 -0
- package/codex/plugins/agent-wallet/skills/cards/SKILL.md +225 -0
- package/codex/plugins/agent-wallet/skills/imd/SKILL.md +145 -0
- package/codex/plugins/agent-wallet/skills/wallet-base/SKILL.md +56 -0
- package/codex/plugins/agent-wallet/skills/wallet-operator/SKILL.md +85 -0
- package/codex/plugins/agent-wallet/skills/wallet-sol/SKILL.md +29 -0
- package/codex/plugins/agent-wallet/skills/x402/SKILL.md +159 -0
- package/codex/plugins/agent-wallet/skills/yield/SKILL.md +65 -0
- package/connectors/AGENTS.md +37 -0
- package/connectors/DEVELOPER_GUIDE.md +131 -0
- package/connectors/README.md +139 -0
- package/connectors/READ_ONLY_BETA.md +54 -0
- package/connectors/RELEASING.md +48 -0
- package/connectors/conformance/README.md +31 -0
- package/connectors/conformance/package.json +54 -0
- package/connectors/conformance/scripts/sync-license.mjs +3 -0
- package/connectors/conformance/scripts/sync-spec.mjs +16 -0
- package/connectors/conformance/src/cli.ts +43 -0
- package/connectors/conformance/src/index.ts +7 -0
- package/connectors/conformance/src/runner.ts +314 -0
- package/connectors/conformance/src/types.ts +27 -0
- package/connectors/conformance/test/fixtures/invalid-response-identity.json +14 -0
- package/connectors/conformance/test/fixtures/missing-tool-fixture.json +4 -0
- package/connectors/conformance/test/runner.test.mjs +151 -0
- package/connectors/conformance/tsconfig.json +17 -0
- package/connectors/examples/reference-crypto-data/Dockerfile +21 -0
- package/connectors/examples/reference-crypto-data/README.md +51 -0
- package/connectors/examples/reference-crypto-data/conformance.json +11 -0
- package/connectors/examples/reference-crypto-data/connector.json +95 -0
- package/connectors/examples/reference-crypto-data/package.json +21 -0
- package/connectors/examples/reference-crypto-data/railway.toml +9 -0
- package/connectors/examples/reference-crypto-data/src/connector.ts +137 -0
- package/connectors/examples/reference-crypto-data/src/server.ts +13 -0
- package/connectors/examples/reference-crypto-data/test/connector.test.mjs +97 -0
- package/connectors/examples/reference-crypto-data/tsconfig.json +17 -0
- package/connectors/package-lock.json +561 -0
- package/connectors/package.json +19 -0
- package/connectors/scripts/smoke-packed-packages.mjs +121 -0
- package/connectors/sdk-typescript/README.md +47 -0
- package/connectors/sdk-typescript/package.json +49 -0
- package/connectors/sdk-typescript/scripts/sync-license.mjs +3 -0
- package/connectors/sdk-typescript/src/connector.ts +204 -0
- package/connectors/sdk-typescript/src/errors.ts +11 -0
- package/connectors/sdk-typescript/src/http.ts +116 -0
- package/connectors/sdk-typescript/src/index.ts +26 -0
- package/connectors/sdk-typescript/src/types.ts +101 -0
- package/connectors/sdk-typescript/test/sdk.test.mjs +181 -0
- package/connectors/sdk-typescript/tsconfig.json +21 -0
- package/connectors/spec/connector-manifest.schema.json +340 -0
- package/connectors/spec/connector-protocol.md +159 -0
- package/connectors/spec/transaction-intent.schema.json +281 -0
- package/connectors/templates/read-only/.env.example +1 -0
- package/connectors/templates/read-only/Dockerfile +11 -0
- package/connectors/templates/read-only/README.md +33 -0
- package/connectors/templates/read-only/conformance.json +11 -0
- package/connectors/templates/read-only/connector.json +64 -0
- package/connectors/templates/read-only/package.json +21 -0
- package/connectors/templates/read-only/railway.toml +9 -0
- package/connectors/templates/read-only/src/connector.ts +61 -0
- package/connectors/templates/read-only/src/server.ts +14 -0
- package/connectors/templates/read-only/test/connector.test.mjs +62 -0
- package/connectors/templates/read-only/tsconfig.json +17 -0
- package/cursor/plugins/agent-wallet/.cursor-plugin/plugin.json +14 -0
- package/cursor/plugins/agent-wallet/README.md +62 -0
- package/cursor/plugins/agent-wallet/mcp.json +16 -0
- package/cursor/plugins/agent-wallet/scripts/run_mcp.sh +33 -0
- package/cursor/plugins/agent-wallet/server.py +33 -0
- package/cursor/plugins/agent-wallet/skills/cards/SKILL.md +210 -0
- package/cursor/plugins/agent-wallet/skills/wallet-base/SKILL.md +56 -0
- package/cursor/plugins/agent-wallet/skills/wallet-operator/SKILL.md +23 -0
- package/cursor/plugins/agent-wallet/skills/wallet-sol/SKILL.md +29 -0
- package/cursor/plugins/agent-wallet/skills/x402/SKILL.md +130 -0
- package/hermes/plugins/agent_wallet/README.md +54 -0
- package/hermes/plugins/agent_wallet/__init__.py +55 -0
- package/hermes/plugins/agent_wallet/plugin.yaml +9 -0
- package/hermes/plugins/agent_wallet/schemas.py +211 -0
- package/hermes/plugins/agent_wallet/tools.py +622 -0
- package/install-from-github.sh +139 -0
- package/integrations/hedera/treasury-guard/README.md +92 -0
- package/integrations/hedera/treasury-guard/examples/treasury-policy.example.json +9 -0
- package/integrations/hedera/treasury-guard/package-lock.json +880 -0
- package/integrations/hedera/treasury-guard/package.json +8 -0
- package/integrations/hedera/treasury-guard/skills/onecraft-hedera-treasury/SKILL.md +22 -0
- package/integrations/hedera/treasury-guard/src/hedera-mirror-client.mjs +106 -0
- package/integrations/hedera/treasury-guard/src/hedera-signer.mjs +120 -0
- package/integrations/hedera/treasury-guard/src/treasury-cli.mjs +177 -0
- package/integrations/hedera/treasury-guard/src/treasury-policy.mjs +155 -0
- package/mcp/README.md +39 -0
- package/mcp/scripts/run_mcp.sh +37 -0
- package/mcp/server.py +33 -0
- package/package.json +106 -4
- package/scripts/check_release_version.mjs +72 -0
- package/scripts/version_targets.mjs +60 -0
- package/setup.sh +87 -0
- package/wdk-evm-wallet/.env.example +38 -0
- package/wdk-evm-wallet/README.md +254 -0
- package/wdk-evm-wallet/bootstrap.sh +8 -0
- package/wdk-evm-wallet/package-lock.json +2359 -0
- package/wdk-evm-wallet/package.json +43 -0
- package/wdk-evm-wallet/run-local.sh +12 -0
- package/wdk-evm-wallet/src/config.js +461 -0
- package/wdk-evm-wallet/src/imd.js +231 -0
- package/wdk-evm-wallet/src/json.js +35 -0
- package/wdk-evm-wallet/src/local_vault.js +407 -0
- package/wdk-evm-wallet/src/network_state.js +96 -0
- package/wdk-evm-wallet/src/pending_transactions.js +148 -0
- package/wdk-evm-wallet/src/server.js +849 -0
- package/wdk-evm-wallet/src/shutdown.js +63 -0
- package/wdk-evm-wallet/src/wdk_evm_wallet.js +10036 -0
|
@@ -0,0 +1,578 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
4
|
+
|
|
5
|
+
function readJson(pathname) {
|
|
6
|
+
try {
|
|
7
|
+
return JSON.parse(fs.readFileSync(pathname, "utf8"));
|
|
8
|
+
} catch (error) {
|
|
9
|
+
if (error?.code === "ENOENT") return null;
|
|
10
|
+
throw error;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function writeJsonAtomic(pathname, value) {
|
|
15
|
+
fs.mkdirSync(path.dirname(pathname), { recursive: true });
|
|
16
|
+
const temporary = `${pathname}.tmp-${process.pid}-${Date.now()}`;
|
|
17
|
+
try {
|
|
18
|
+
fs.writeFileSync(temporary, `${JSON.stringify(value, null, 2)}\n`, { mode: 0o600 });
|
|
19
|
+
fs.renameSync(temporary, pathname);
|
|
20
|
+
fs.chmodSync(pathname, 0o600);
|
|
21
|
+
} finally {
|
|
22
|
+
fs.rmSync(temporary, { force: true });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const CURSOR_MANAGED_MARKER = ".agentlayer-managed.json";
|
|
27
|
+
|
|
28
|
+
export function syncCursorPluginBundle({
|
|
29
|
+
source,
|
|
30
|
+
target,
|
|
31
|
+
packageVersion,
|
|
32
|
+
force = false,
|
|
33
|
+
runtimePackageRoot = null,
|
|
34
|
+
openclawHome = null,
|
|
35
|
+
defaultOpenclawHome = null,
|
|
36
|
+
}) {
|
|
37
|
+
if (readJson(path.join(source, ".cursor-plugin", "plugin.json"))?.name !== "agent-wallet") {
|
|
38
|
+
throw new Error(`Missing OneCraft Cursor plugin bundle at ${source}`);
|
|
39
|
+
}
|
|
40
|
+
const parent = path.dirname(target);
|
|
41
|
+
fs.mkdirSync(parent, { recursive: true });
|
|
42
|
+
const staged = path.join(parent, `.agent-wallet-staging-${process.pid}-${Date.now()}`);
|
|
43
|
+
const backup = path.join(parent, `.agent-wallet-backup-${process.pid}-${Date.now()}`);
|
|
44
|
+
let oldMoved = false;
|
|
45
|
+
try {
|
|
46
|
+
fs.cpSync(source, staged, { recursive: true });
|
|
47
|
+
const mcpPath = path.join(staged, "mcp.json");
|
|
48
|
+
const mcp = readJson(mcpPath);
|
|
49
|
+
const server = mcp?.mcpServers?.["agent-wallet"];
|
|
50
|
+
if (!server || typeof server !== "object") throw new Error(`Missing Cursor MCP config at ${mcpPath}`);
|
|
51
|
+
// Cursor plugin-root interpolation is not documented, so pin the launcher
|
|
52
|
+
// to its absolute installed path and run it through sh (no exec bit needed).
|
|
53
|
+
server.command = "sh";
|
|
54
|
+
server.args = [path.join(path.resolve(target), "scripts", "run_mcp.sh")];
|
|
55
|
+
server.env = { ...(server.env || {}) };
|
|
56
|
+
if (runtimePackageRoot) server.env.AGENT_WALLET_PACKAGE_ROOT = runtimePackageRoot;
|
|
57
|
+
if (openclawHome && openclawHome !== defaultOpenclawHome) server.env.OPENCLAW_HOME = openclawHome;
|
|
58
|
+
fs.writeFileSync(mcpPath, `${JSON.stringify(mcp, null, 2)}\n`);
|
|
59
|
+
fs.writeFileSync(
|
|
60
|
+
path.join(staged, CURSOR_MANAGED_MARKER),
|
|
61
|
+
`${JSON.stringify({ manager: "agentlayer", plugin: "agent-wallet", version: packageVersion })}\n`,
|
|
62
|
+
);
|
|
63
|
+
let existing = false;
|
|
64
|
+
try {
|
|
65
|
+
fs.lstatSync(target);
|
|
66
|
+
existing = true;
|
|
67
|
+
} catch (error) {
|
|
68
|
+
if (error?.code !== "ENOENT") throw error;
|
|
69
|
+
}
|
|
70
|
+
if (existing) {
|
|
71
|
+
const marker = readJson(path.join(target, CURSOR_MANAGED_MARKER));
|
|
72
|
+
if (!force && (marker?.manager !== "agentlayer" || marker?.plugin !== "agent-wallet")) {
|
|
73
|
+
throw new Error(`${target} exists and is not managed by OneCraft. Pass --force to replace it.`);
|
|
74
|
+
}
|
|
75
|
+
fs.renameSync(target, backup);
|
|
76
|
+
oldMoved = true;
|
|
77
|
+
}
|
|
78
|
+
fs.renameSync(staged, target);
|
|
79
|
+
if (oldMoved) fs.rmSync(backup, { recursive: true, force: true });
|
|
80
|
+
return { target, repaired: oldMoved, restart_required: true };
|
|
81
|
+
} catch (error) {
|
|
82
|
+
if (oldMoved && !fs.existsSync(target)) fs.renameSync(backup, target);
|
|
83
|
+
throw error;
|
|
84
|
+
} finally {
|
|
85
|
+
fs.rmSync(staged, { recursive: true, force: true });
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function createIntegrationManager({ runtimeBase, packageVersion, activeVersion }) {
|
|
90
|
+
const registryPath = path.join(runtimeBase, "integrations.json");
|
|
91
|
+
|
|
92
|
+
function emptyRegistry(error = "") {
|
|
93
|
+
return {
|
|
94
|
+
schema_version: 1,
|
|
95
|
+
integrations: {},
|
|
96
|
+
...(error ? { registry_error: error } : {}),
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function readRegistry() {
|
|
101
|
+
let payload;
|
|
102
|
+
try {
|
|
103
|
+
payload = readJson(registryPath);
|
|
104
|
+
} catch (error) {
|
|
105
|
+
return emptyRegistry(`integration registry is unreadable: ${error.message}`);
|
|
106
|
+
}
|
|
107
|
+
if (!payload) return emptyRegistry();
|
|
108
|
+
if (
|
|
109
|
+
payload.schema_version !== 1 ||
|
|
110
|
+
!payload.integrations ||
|
|
111
|
+
typeof payload.integrations !== "object" ||
|
|
112
|
+
Array.isArray(payload.integrations)
|
|
113
|
+
) {
|
|
114
|
+
return emptyRegistry("integration registry schema is invalid");
|
|
115
|
+
}
|
|
116
|
+
return payload;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function quarantineCorruptRegistry(registry) {
|
|
120
|
+
if (!registry.registry_error || !fs.existsSync(registryPath)) return null;
|
|
121
|
+
let backup = `${registryPath}.corrupt-${Date.now()}`;
|
|
122
|
+
let suffix = 2;
|
|
123
|
+
while (fs.existsSync(backup)) {
|
|
124
|
+
backup = `${registryPath}.corrupt-${Date.now()}-${suffix}`;
|
|
125
|
+
suffix += 1;
|
|
126
|
+
}
|
|
127
|
+
fs.renameSync(registryPath, backup);
|
|
128
|
+
return backup;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function record(name, details = {}) {
|
|
132
|
+
let registry = readRegistry();
|
|
133
|
+
const corruptBackup = quarantineCorruptRegistry(registry);
|
|
134
|
+
if (registry.registry_error) registry = emptyRegistry();
|
|
135
|
+
if (corruptBackup) registry.recovered_corrupt_registry = path.basename(corruptBackup);
|
|
136
|
+
registry.integrations[name] = {
|
|
137
|
+
...details,
|
|
138
|
+
managed: true,
|
|
139
|
+
installed_version: packageVersion,
|
|
140
|
+
updated_at: new Date().toISOString(),
|
|
141
|
+
};
|
|
142
|
+
registry.updated_at = new Date().toISOString();
|
|
143
|
+
writeJsonAtomic(registryPath, registry);
|
|
144
|
+
return registry.integrations[name];
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function recoverCorruptRegistry() {
|
|
148
|
+
const registry = readRegistry();
|
|
149
|
+
if (!registry.registry_error) {
|
|
150
|
+
return { recovered: false, backup: null };
|
|
151
|
+
}
|
|
152
|
+
const corruptBackup = quarantineCorruptRegistry(registry);
|
|
153
|
+
const recovered = emptyRegistry();
|
|
154
|
+
if (corruptBackup) {
|
|
155
|
+
recovered.recovered_corrupt_registry = path.basename(corruptBackup);
|
|
156
|
+
}
|
|
157
|
+
recovered.updated_at = new Date().toISOString();
|
|
158
|
+
writeJsonAtomic(registryPath, recovered);
|
|
159
|
+
return {
|
|
160
|
+
recovered: true,
|
|
161
|
+
backup: corruptBackup,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function managed(name) {
|
|
166
|
+
const entry = readRegistry().integrations[name];
|
|
167
|
+
return entry?.managed === true ? entry : null;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function status() {
|
|
171
|
+
const active = activeVersion();
|
|
172
|
+
const registry = readRegistry();
|
|
173
|
+
const managedIntegrations = Object.entries(registry.integrations)
|
|
174
|
+
.filter(([, entry]) => entry?.managed === true)
|
|
175
|
+
.sort(([left], [right]) => left.localeCompare(right))
|
|
176
|
+
.map(([name, entry]) => {
|
|
177
|
+
const versionInSync = active === null || entry.installed_version === active;
|
|
178
|
+
const registrationOk = entry.registration_ok !== false;
|
|
179
|
+
return {
|
|
180
|
+
name,
|
|
181
|
+
installed_version: entry.installed_version || null,
|
|
182
|
+
active_version: active,
|
|
183
|
+
in_sync: versionInSync && registrationOk,
|
|
184
|
+
registration_ok: registrationOk,
|
|
185
|
+
restart_required: Boolean(entry.restart_required),
|
|
186
|
+
};
|
|
187
|
+
});
|
|
188
|
+
return {
|
|
189
|
+
in_sync: !registry.registry_error && managedIntegrations.every((entry) => entry.in_sync),
|
|
190
|
+
registry_ok: !registry.registry_error,
|
|
191
|
+
registry_error: registry.registry_error || "",
|
|
192
|
+
recovered_corrupt_registry: registry.recovered_corrupt_registry || null,
|
|
193
|
+
integrations: managedIntegrations,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function safelyRefresh(name, callback) {
|
|
198
|
+
try {
|
|
199
|
+
return callback();
|
|
200
|
+
} catch (error) {
|
|
201
|
+
const fix = name === "global-cli"
|
|
202
|
+
? "Re-run: wallet update --yes"
|
|
203
|
+
: name === "openclaw"
|
|
204
|
+
? "Re-run: wallet install --yes"
|
|
205
|
+
: `Re-run: wallet ${name} install --yes`;
|
|
206
|
+
return {
|
|
207
|
+
name,
|
|
208
|
+
attempted: true,
|
|
209
|
+
ok: false,
|
|
210
|
+
repaired: false,
|
|
211
|
+
error: error?.message || String(error),
|
|
212
|
+
restart_required: false,
|
|
213
|
+
fix,
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function refreshAll(refreshers) {
|
|
219
|
+
return Object.entries(refreshers)
|
|
220
|
+
.map(([name, callback]) => safelyRefresh(name, callback))
|
|
221
|
+
.filter(Boolean);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
return {
|
|
225
|
+
registryPath,
|
|
226
|
+
readRegistry,
|
|
227
|
+
record,
|
|
228
|
+
recoverCorruptRegistry,
|
|
229
|
+
managed,
|
|
230
|
+
status,
|
|
231
|
+
safelyRefresh,
|
|
232
|
+
refreshAll,
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export function createHostIntegrationManager({
|
|
237
|
+
packageVersion,
|
|
238
|
+
env,
|
|
239
|
+
packageRoot,
|
|
240
|
+
registry,
|
|
241
|
+
currentRuntimePath,
|
|
242
|
+
openclawHome,
|
|
243
|
+
hermesHome,
|
|
244
|
+
codexHome,
|
|
245
|
+
cursorPluginRoot,
|
|
246
|
+
codexPluginRoot,
|
|
247
|
+
codexMarketplacePath,
|
|
248
|
+
claudeMarketplaceDir,
|
|
249
|
+
claudeMarketplaceName,
|
|
250
|
+
expandHome,
|
|
251
|
+
resolveVenvPython,
|
|
252
|
+
commandPath,
|
|
253
|
+
repairRuntimeSymlink,
|
|
254
|
+
repairHermesEnv,
|
|
255
|
+
ensureCodexMarketplaceEntry,
|
|
256
|
+
ensureClaudeCodeMarketplace,
|
|
257
|
+
pinClaudeCacheCopies,
|
|
258
|
+
}) {
|
|
259
|
+
const runtimeBase = path.dirname(currentRuntimePath);
|
|
260
|
+
|
|
261
|
+
function runtimeOwnedTarget(target) {
|
|
262
|
+
const relative = path.relative(runtimeBase, path.resolve(target));
|
|
263
|
+
return relative === "" || (!relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative));
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function symlinkTarget(linkPath) {
|
|
267
|
+
try {
|
|
268
|
+
if (!fs.lstatSync(linkPath).isSymbolicLink()) return null;
|
|
269
|
+
return path.resolve(path.dirname(linkPath), fs.readlinkSync(linkPath));
|
|
270
|
+
} catch {
|
|
271
|
+
return null;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
function symlinkManifestMatches(linkPath, manifestRelativePath, expectedName) {
|
|
276
|
+
try {
|
|
277
|
+
const target = symlinkTarget(linkPath);
|
|
278
|
+
if (!target || !runtimeOwnedTarget(target)) return false;
|
|
279
|
+
return readJson(path.join(target, manifestRelativePath))?.name === expectedName;
|
|
280
|
+
} catch {
|
|
281
|
+
return false;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
function adoptOpenclaw() {
|
|
286
|
+
const configPath = path.join(openclawHome, "openclaw.json");
|
|
287
|
+
let config;
|
|
288
|
+
try {
|
|
289
|
+
config = readJson(configPath);
|
|
290
|
+
} catch {
|
|
291
|
+
return null;
|
|
292
|
+
}
|
|
293
|
+
const walletEntry = config?.plugins?.entries?.["agent-wallet"];
|
|
294
|
+
const packageRoot = walletEntry?.config?.packageRoot;
|
|
295
|
+
const loadPaths = Array.isArray(config?.plugins?.load?.paths)
|
|
296
|
+
? config.plugins.load.paths
|
|
297
|
+
: [];
|
|
298
|
+
const ownedPackage =
|
|
299
|
+
typeof packageRoot === "string" &&
|
|
300
|
+
packageRoot.trim() &&
|
|
301
|
+
runtimeOwnedTarget(packageRoot);
|
|
302
|
+
const ownedExtension = loadPaths.some(
|
|
303
|
+
(item) =>
|
|
304
|
+
String(item || "").replaceAll("\\", "/").endsWith("/.openclaw/extensions/agent-wallet") &&
|
|
305
|
+
runtimeOwnedTarget(String(item)),
|
|
306
|
+
);
|
|
307
|
+
if (!walletEntry || (!ownedPackage && !ownedExtension)) return null;
|
|
308
|
+
return registry.record("openclaw", {
|
|
309
|
+
config_path: configPath,
|
|
310
|
+
extension_path: path.join(currentRuntimePath, ".openclaw", "extensions", "agent-wallet"),
|
|
311
|
+
package_root: path.join(currentRuntimePath, "agent-wallet"),
|
|
312
|
+
adopted_legacy_install: true,
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
function adoptHermes() {
|
|
317
|
+
const pluginTarget = path.join(hermesHome, "plugins", "agent_wallet");
|
|
318
|
+
const target = symlinkTarget(pluginTarget);
|
|
319
|
+
if (!target || !runtimeOwnedTarget(target)) return null;
|
|
320
|
+
let manifest = "";
|
|
321
|
+
try {
|
|
322
|
+
manifest = fs.readFileSync(path.join(target, "plugin.yaml"), "utf8");
|
|
323
|
+
} catch {
|
|
324
|
+
return null;
|
|
325
|
+
}
|
|
326
|
+
if (!/^name:\s*agent[-_]wallet\s*$/m.test(manifest)) return null;
|
|
327
|
+
return registry.record("hermes", {
|
|
328
|
+
hermes_home: hermesHome,
|
|
329
|
+
plugin_target: pluginTarget,
|
|
330
|
+
env_path: path.join(hermesHome, ".env"),
|
|
331
|
+
adopted_legacy_install: true,
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function adoptCodex() {
|
|
336
|
+
let marketplace;
|
|
337
|
+
try {
|
|
338
|
+
marketplace = readJson(codexMarketplacePath);
|
|
339
|
+
} catch {
|
|
340
|
+
return null;
|
|
341
|
+
}
|
|
342
|
+
const pluginTarget = path.join(codexPluginRoot, "agent-wallet");
|
|
343
|
+
const registered = Array.isArray(marketplace?.plugins) && marketplace.plugins.some(
|
|
344
|
+
(item) => item?.name === "agent-wallet" && item?.source?.source === "local",
|
|
345
|
+
);
|
|
346
|
+
if (!registered || !symlinkManifestMatches(pluginTarget, ".codex-plugin/plugin.json", "agent-wallet")) {
|
|
347
|
+
return null;
|
|
348
|
+
}
|
|
349
|
+
return registry.record("codex", {
|
|
350
|
+
codex_home: codexHome,
|
|
351
|
+
plugin_target: pluginTarget,
|
|
352
|
+
marketplace_path: codexMarketplacePath,
|
|
353
|
+
marketplace_name: String(marketplace.name || "local"),
|
|
354
|
+
adopted_legacy_install: true,
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
function adoptClaudeCode() {
|
|
359
|
+
let manifest;
|
|
360
|
+
try {
|
|
361
|
+
manifest = readJson(path.join(claudeMarketplaceDir, ".claude-plugin", "marketplace.json"));
|
|
362
|
+
} catch {
|
|
363
|
+
return null;
|
|
364
|
+
}
|
|
365
|
+
const pluginTarget = path.join(claudeMarketplaceDir, "plugins", "agent-wallet");
|
|
366
|
+
const registered = manifest?.name === claudeMarketplaceName &&
|
|
367
|
+
Array.isArray(manifest.plugins) && manifest.plugins.some((item) => item?.name === "agent-wallet");
|
|
368
|
+
if (!registered || !symlinkManifestMatches(pluginTarget, ".claude-plugin/plugin.json", "agent-wallet")) {
|
|
369
|
+
return null;
|
|
370
|
+
}
|
|
371
|
+
return registry.record("claude-code", {
|
|
372
|
+
marketplace_dir: claudeMarketplaceDir,
|
|
373
|
+
plugin_target: pluginTarget,
|
|
374
|
+
cache_root: path.resolve(expandHome(env.AGENT_WALLET_CLAUDE_CODE_CACHE_ROOT || "~/.claude/plugins/cache")),
|
|
375
|
+
adopted_legacy_install: true,
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
function adoptCursor() {
|
|
380
|
+
const pluginTarget = path.join(cursorPluginRoot, "agent-wallet");
|
|
381
|
+
const marker = readJson(path.join(pluginTarget, CURSOR_MANAGED_MARKER));
|
|
382
|
+
if (marker?.manager !== "agentlayer" || marker?.plugin !== "agent-wallet") return null;
|
|
383
|
+
return registry.record("cursor", { plugin_target: pluginTarget, adopted_legacy_install: true });
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
function runHostRefresh(command, args, commandEnv = env) {
|
|
387
|
+
const binary = commandPath(command);
|
|
388
|
+
if (!binary) {
|
|
389
|
+
return { attempted: false, ok: false, error: `${command} CLI not found`, fix: args.join(" ") };
|
|
390
|
+
}
|
|
391
|
+
const result = spawnSync(binary, args, { cwd: packageRoot, encoding: "utf8", env: commandEnv });
|
|
392
|
+
return {
|
|
393
|
+
attempted: true,
|
|
394
|
+
ok: result.status === 0,
|
|
395
|
+
error: result.status === 0 ? "" : (result.stderr || result.stdout || "").trim(),
|
|
396
|
+
fix: result.status === 0 ? "" : `${command} ${args.join(" ")}`,
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
function refreshOpenclaw() {
|
|
401
|
+
const entry = registry.managed("openclaw") || adoptOpenclaw();
|
|
402
|
+
if (!entry) {
|
|
403
|
+
return { name: "openclaw", attempted: false, ok: true, repaired: false, reason: "not managed" };
|
|
404
|
+
}
|
|
405
|
+
const configPath = path.resolve(expandHome(entry.config_path || path.join(openclawHome, "openclaw.json")));
|
|
406
|
+
let config;
|
|
407
|
+
try {
|
|
408
|
+
config = readJson(configPath);
|
|
409
|
+
} catch (error) {
|
|
410
|
+
return { name: "openclaw", attempted: true, ok: false, repaired: false, error: error.message };
|
|
411
|
+
}
|
|
412
|
+
if (!config || typeof config !== "object") {
|
|
413
|
+
return { name: "openclaw", attempted: true, ok: false, repaired: false, error: `missing ${configPath}` };
|
|
414
|
+
}
|
|
415
|
+
const extensionPath = path.join(currentRuntimePath, ".openclaw", "extensions", "agent-wallet");
|
|
416
|
+
const walletPackageRoot = path.join(currentRuntimePath, "agent-wallet");
|
|
417
|
+
const pythonBin = resolveVenvPython(currentRuntimePath);
|
|
418
|
+
const plugins = config.plugins && typeof config.plugins === "object" ? config.plugins : (config.plugins = {});
|
|
419
|
+
const load = plugins.load && typeof plugins.load === "object" ? plugins.load : (plugins.load = {});
|
|
420
|
+
const paths = Array.isArray(load.paths) ? load.paths : [];
|
|
421
|
+
load.paths = [
|
|
422
|
+
...paths.filter((item) => !String(item || "").replaceAll("\\", "/").endsWith("/.openclaw/extensions/agent-wallet")),
|
|
423
|
+
extensionPath,
|
|
424
|
+
];
|
|
425
|
+
const entries = plugins.entries && typeof plugins.entries === "object" ? plugins.entries : (plugins.entries = {});
|
|
426
|
+
const walletEntry = entries["agent-wallet"];
|
|
427
|
+
if (!walletEntry || typeof walletEntry !== "object") {
|
|
428
|
+
return { name: "openclaw", attempted: false, ok: true, repaired: false, reason: "plugin entry not configured" };
|
|
429
|
+
}
|
|
430
|
+
walletEntry.enabled = true;
|
|
431
|
+
walletEntry.config = walletEntry.config && typeof walletEntry.config === "object" ? walletEntry.config : {};
|
|
432
|
+
walletEntry.config.packageRoot = walletPackageRoot;
|
|
433
|
+
if (pythonBin) walletEntry.config.pythonBin = pythonBin;
|
|
434
|
+
writeJsonAtomic(configPath, config);
|
|
435
|
+
registry.record("openclaw", {
|
|
436
|
+
config_path: configPath,
|
|
437
|
+
extension_path: extensionPath,
|
|
438
|
+
package_root: walletPackageRoot,
|
|
439
|
+
restart_required: true,
|
|
440
|
+
});
|
|
441
|
+
return { name: "openclaw", attempted: true, ok: true, repaired: true, config_path: configPath, restart_required: true };
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
function refreshHermes() {
|
|
445
|
+
const entry = registry.managed("hermes") || adoptHermes();
|
|
446
|
+
if (!entry) return null;
|
|
447
|
+
const target = path.resolve(expandHome(entry.plugin_target));
|
|
448
|
+
const envPath = path.resolve(expandHome(entry.env_path));
|
|
449
|
+
const result = repairRuntimeSymlink(
|
|
450
|
+
"hermes",
|
|
451
|
+
target,
|
|
452
|
+
path.join(currentRuntimePath, "hermes", "plugins", "agent_wallet"),
|
|
453
|
+
env,
|
|
454
|
+
{ allowExternal: true },
|
|
455
|
+
);
|
|
456
|
+
result.env_repaired = repairHermesEnv(envPath, env);
|
|
457
|
+
result.restart_required = true;
|
|
458
|
+
if (result.ok) {
|
|
459
|
+
registry.record("hermes", { ...entry, plugin_target: target, env_path: envPath, restart_required: true });
|
|
460
|
+
}
|
|
461
|
+
return result;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
function refreshCodex() {
|
|
465
|
+
const entry = registry.managed("codex") || adoptCodex();
|
|
466
|
+
if (!entry) return null;
|
|
467
|
+
const pluginTarget = path.resolve(expandHome(entry.plugin_target || path.join(codexPluginRoot, "agent-wallet")));
|
|
468
|
+
const marketplacePath = path.resolve(expandHome(entry.marketplace_path || codexMarketplacePath));
|
|
469
|
+
const link = repairRuntimeSymlink(
|
|
470
|
+
"codex",
|
|
471
|
+
pluginTarget,
|
|
472
|
+
path.join(currentRuntimePath, "codex", "plugins", "agent-wallet"),
|
|
473
|
+
env,
|
|
474
|
+
{ allowExternal: true },
|
|
475
|
+
);
|
|
476
|
+
if (!link.ok) return link;
|
|
477
|
+
const marketplace = ensureCodexMarketplaceEntry({ marketplacePath, pluginName: "agent-wallet" });
|
|
478
|
+
const registration = runHostRefresh(
|
|
479
|
+
"codex",
|
|
480
|
+
["plugin", "add", `agent-wallet@${marketplace.marketplace_name}`],
|
|
481
|
+
{ ...env, CODEX_HOME: entry.codex_home || codexHome },
|
|
482
|
+
);
|
|
483
|
+
registry.record("codex", {
|
|
484
|
+
...entry,
|
|
485
|
+
plugin_target: pluginTarget,
|
|
486
|
+
marketplace_path: marketplacePath,
|
|
487
|
+
marketplace_name: marketplace.marketplace_name,
|
|
488
|
+
registration_ok: registration.ok,
|
|
489
|
+
restart_required: true,
|
|
490
|
+
});
|
|
491
|
+
return { ...link, ok: link.ok && registration.ok, registration, restart_required: true };
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
function refreshClaudeCode() {
|
|
495
|
+
const entry = registry.managed("claude-code") || adoptClaudeCode();
|
|
496
|
+
if (!entry) return null;
|
|
497
|
+
const marketplaceDir = path.resolve(expandHome(entry.marketplace_dir || claudeMarketplaceDir));
|
|
498
|
+
const cacheRoot = path.resolve(
|
|
499
|
+
expandHome(entry.cache_root || env.AGENT_WALLET_CLAUDE_CODE_CACHE_ROOT || "~/.claude/plugins/cache"),
|
|
500
|
+
);
|
|
501
|
+
const pluginTarget = path.resolve(expandHome(entry.plugin_target || path.join(marketplaceDir, "plugins", "agent-wallet")));
|
|
502
|
+
const link = repairRuntimeSymlink(
|
|
503
|
+
"claude-code",
|
|
504
|
+
pluginTarget,
|
|
505
|
+
path.join(currentRuntimePath, "claude-code", "plugins", "agent-wallet"),
|
|
506
|
+
env,
|
|
507
|
+
{ allowExternal: true },
|
|
508
|
+
);
|
|
509
|
+
if (!link.ok) return link;
|
|
510
|
+
ensureClaudeCodeMarketplace(
|
|
511
|
+
marketplaceDir,
|
|
512
|
+
path.join(currentRuntimePath, "claude-code", "plugins", "agent-wallet"),
|
|
513
|
+
true,
|
|
514
|
+
);
|
|
515
|
+
const marketplaceAdd = runHostRefresh(
|
|
516
|
+
"claude",
|
|
517
|
+
["plugin", "marketplace", "add", marketplaceDir, "--scope", "user"],
|
|
518
|
+
);
|
|
519
|
+
const registration = marketplaceAdd.ok
|
|
520
|
+
? runHostRefresh(
|
|
521
|
+
"claude",
|
|
522
|
+
["plugin", "install", `agent-wallet@${claudeMarketplaceName}`, "--scope", "user"],
|
|
523
|
+
)
|
|
524
|
+
: { attempted: false, ok: false, error: "marketplace refresh failed", fix: marketplaceAdd.fix };
|
|
525
|
+
const cachePins = pinClaudeCacheCopies({ ...env, AGENT_WALLET_CLAUDE_CODE_CACHE_ROOT: cacheRoot });
|
|
526
|
+
registry.record("claude-code", {
|
|
527
|
+
...entry,
|
|
528
|
+
marketplace_dir: marketplaceDir,
|
|
529
|
+
plugin_target: pluginTarget,
|
|
530
|
+
cache_root: cacheRoot,
|
|
531
|
+
registration_ok: registration.ok,
|
|
532
|
+
restart_required: true,
|
|
533
|
+
});
|
|
534
|
+
return {
|
|
535
|
+
...link,
|
|
536
|
+
ok: link.ok && marketplaceAdd.ok && registration.ok,
|
|
537
|
+
marketplace_add: marketplaceAdd,
|
|
538
|
+
registration,
|
|
539
|
+
cache_pins: cachePins,
|
|
540
|
+
restart_required: true,
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
function refreshCursor() {
|
|
545
|
+
const entry = registry.managed("cursor") || adoptCursor();
|
|
546
|
+
if (!entry) return null;
|
|
547
|
+
const pluginTarget = path.resolve(expandHome(entry.plugin_target || path.join(cursorPluginRoot, "agent-wallet")));
|
|
548
|
+
const source = path.join(currentRuntimePath, "cursor", "plugins", "agent-wallet");
|
|
549
|
+
const synced = syncCursorPluginBundle({
|
|
550
|
+
source,
|
|
551
|
+
target: pluginTarget,
|
|
552
|
+
packageVersion,
|
|
553
|
+
runtimePackageRoot: path.join(currentRuntimePath, "agent-wallet"),
|
|
554
|
+
openclawHome,
|
|
555
|
+
defaultOpenclawHome: path.resolve(expandHome("~/.openclaw")),
|
|
556
|
+
});
|
|
557
|
+
registry.record("cursor", { ...entry, plugin_target: pluginTarget, restart_required: true });
|
|
558
|
+
return { name: "cursor", attempted: true, ok: true, ...synced };
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
function refreshAll(names = null) {
|
|
562
|
+
const selected = names ? new Set(names) : null;
|
|
563
|
+
const refreshers = {
|
|
564
|
+
openclaw: refreshOpenclaw,
|
|
565
|
+
hermes: refreshHermes,
|
|
566
|
+
codex: refreshCodex,
|
|
567
|
+
cursor: refreshCursor,
|
|
568
|
+
"claude-code": refreshClaudeCode,
|
|
569
|
+
};
|
|
570
|
+
return registry.refreshAll(
|
|
571
|
+
Object.fromEntries(
|
|
572
|
+
Object.entries(refreshers).filter(([name]) => !selected || selected.has(name)),
|
|
573
|
+
),
|
|
574
|
+
);
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
return { refreshAll };
|
|
578
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Which interpreter checks a staged release (MCP handshake, boot-key unseal).
|
|
2
|
+
//
|
|
3
|
+
// The release's own venv comes first: it is what users will run. The env variables
|
|
4
|
+
// are fallbacks only. OPENCLAW_AGENT_WALLET_PYTHON names the interpreter a venv is
|
|
5
|
+
// built from (no wallet packages installed), and AGENT_WALLET_PYTHON points at the
|
|
6
|
+
// previous runtime, so neither can vouch for the new release when its venv exists.
|
|
7
|
+
export function releaseCheckPython(venvPython, env = process.env) {
|
|
8
|
+
return venvPython || env.AGENT_WALLET_PYTHON || env.OPENCLAW_AGENT_WALLET_PYTHON || null;
|
|
9
|
+
}
|