Skip to content

LeoYeAI/agent-master-skills / skills/aawp

AAWP (AI Agent Wallet Protocol) — the only crypto wallet protocol built exclusively for AI Agents on EVM-compatible blockchains. Not for humans. The signer is the AI Agent itself, cryptographically bound at wallet creation. Supports wallet lifecycle management, token transfers, DEX swaps, cross-chain bridging, arbitrary contract interactions, DCA automation, and price alerts.

FileKindSize
README.mdmarkdown10.9 KB
SKILL.mdskill md20.1 KB
WALLET_SETUP.mdmarkdown4.6 KB
_meta.jsonconfig436 B
bin/install.jsscript7.0 KB
config/chains.jsonconfig4.2 KB
core/index.d.tsscript2.8 KB
core/loader.jsscript1.0 KB
daemon/client.jsscript1.1 KB
daemon/daemon.jsscript606 B
lib/address-book.jsscript1.6 KB
lib/gas-estimator.jsscript1.7 KB
lib/multicall.jsscript2.6 KB
lib/nonce-manager.jsscript1.9 KB
lib/tx-history.jsscript1.3 KB
scripts/bootstrap.shscript1.7 KB
scripts/dca.jsscript9.4 KB
scripts/deploy-clanker.jsscript13.6 KB
scripts/doctor.shscript1.6 KB
scripts/ensure-daemon.shscript2.2 KB
scripts/limit-order.jsscript28.3 KB
scripts/nft.jsscript25.2 KB
scripts/portfolio.jsscript18.0 KB
scripts/price-alert.jsscript12.1 KB
scripts/provision.shscript9.4 KB
scripts/restart-daemon.shscript1.5 KB
scripts/restore-impl.jsscript3.9 KB
scripts/sign-worker.jsscript2.9 KB
scripts/start-daemon.jsscript3.9 KB
scripts/swap.jsscript31.8 KB
scripts/wallet-manager.jsscript70.6 KB
scripts/yield.jsscript34.1 KB

scripts/restore-impl.js

View on GitHub
'use strict';
// Standalone restore — no native addon, safe to run when shards are missing
const path = require('path');
const fs   = require('fs');
const { execSync } = require('child_process');

const C = process.env.AAWP_CONFIG || path.join(__dirname, '..', '.agent-config');
const S = process.env.AAWP_SKILL  || path.resolve(__dirname, '..');

const backupPath = process.argv[3];
if (!backupPath) { console.log('Usage: wallet-manager restore <backup.tar.gz>'); process.exit(1); }
if (!fs.existsSync(backupPath)) { console.log('❌ Not found:', backupPath); process.exit(1); }

const tmpDir = `/tmp/aawp-restore-${Date.now()}`;
fs.mkdirSync(tmpDir, { recursive: true });
console.log('Extracting...');
execSync(`tar xzf "${backupPath}" -C "${tmpDir}"`, { stdio: 'inherit' });

// Detect backup format: v2 (portable) has manifest.json, v1 (legacy) has absolute paths
const manifestPath = path.join(tmpDir, 'manifest.json');
const isV2 = fs.existsSync(manifestPath);

const copyIfExists = (src, dst) => {
  if (fs.existsSync(src)) {
    fs.mkdirSync(path.dirname(dst), { recursive: true });
    fs.copyFileSync(src, dst);
    console.log('  ✅', path.basename(dst));
    return true;
  }
  return false;
};

if (isV2) {
  // ── V2 portable format ──
  const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
  console.log(`Backup format: v${manifest.version} (${manifest.createdAt})`);

  copyIfExists(path.join(tmpDir, 'agent-config/seed.enc'),   path.join(C, 'seed.enc'));
  copyIfExists(path.join(tmpDir, 'core/aawp-core.node'),     path.join(S, 'core/aawp-core.node'));
  copyIfExists(path.join(tmpDir, 'system/fonts.idx'),         '/var/lib/aawp/.cache/fonts.idx');
  copyIfExists(path.join(tmpDir, 'system/machine-id'),        '/etc/machine-id');
  copyIfExists(path.join(tmpDir, 'system/host.salt'),         '/var/lib/aawp/host.salt');
  copyIfExists(path.join(tmpDir, 'config/guardian.json'),     path.join(S, 'config/guardian.json'));

  // Restore any additional agent-config files
  const acDir = path.join(tmpDir, 'agent-config');
  if (fs.existsSync(acDir)) {
    const walk = (dir, rel) => {
      for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
        const full = path.join(dir, e.name);
        const r = path.join(rel, e.name);
        if (e.isDirectory()) walk(full, r);
        else copyIfExists(full, path.join(C, r));
      }
    };
    walk(acDir, '');
  }
} else {
  // ── V1 legacy format (absolute paths in tar) ──
  console.log('Backup format: v1 (legacy absolute paths)');

  const stripRoot = (abs) => path.join(tmpDir, abs);
  copyIfExists(stripRoot(C + '/seed.enc'),                        path.join(C, 'seed.enc'));
  copyIfExists(stripRoot(S + '/core/aawp-core.node'),             path.join(S, 'core/aawp-core.node'));
  copyIfExists(stripRoot('/var/lib/aawp/.cache/fonts.idx'),       '/var/lib/aawp/.cache/fonts.idx');
  copyIfExists(stripRoot('/etc/machine-id'),                      '/etc/machine-id');
  copyIfExists(stripRoot('/var/lib/aawp/host.salt'),              '/var/lib/aawp/host.salt');
  copyIfExists(stripRoot(S + '/config/guardian.json'),            path.join(S, 'config/guardian.json'));

  // Try legacy .agent-config path from backup manifest
  const backupCfg = stripRoot(C);
  if (fs.existsSync(backupCfg)) {
    execSync(`cp -r "${backupCfg}/." "${C}/"`, { stdio: 'inherit' });
    console.log('  ✅ .agent-config dir restored');
  }
}

// Regenerate binary hash
const corePath = path.join(S, 'core/aawp-core.node');
if (fs.existsSync(corePath)) {
  const hash = execSync(`sha256sum "${corePath}" | cut -d' ' -f1`).toString().trim();
  fs.writeFileSync(corePath + '.hash', hash);
  console.log(`  ✅ Hash regenerated: ${hash}`);
}

execSync(`rm -rf "${tmpDir}"`);
console.log('\n✅ Restore complete.');
console.log('\nNext steps:');
console.log('  1. Restart daemon:  bash scripts/restart-daemon.sh');
console.log('  2. Verify status:   node scripts/wallet-manager.js status\n');
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall