Skip to main content

Module Reference

Detailed documentation for AgentVault modules.

src/deployment/

ICP deployment and canister management.

icpClient.ts

Primary ICP client for canister operations.

import { ICPClient } from 'agentvault';

const client = new ICPClient({
network: 'local',
identity: myIdentity
});

await client.createCanister();
await client.installCode(wasm, canisterId);

Key Functions:

FunctionDescription
createCanister()Create new canister
installCode()Install WASM code
canisterStatus()Get canister status
startCanister()Start stopped canister
stopCanister()Stop running canister

deployer.ts

Deployment orchestration.

import { deployAgent } from 'agentvault';

const result = await deployAgent({
projectPath: './my-agent',
network: 'ic',
cycles: 1000000000000n
});

promotion.ts

Environment promotion.

import { promoteCanister } from 'agentvault';

await promoteCanister({
from: 'staging',
to: 'production',
canisterId: 'abcde-aaaab'
});

src/packaging/

WASM compilation and packaging.

compiler.ts

TypeScript to WASM compilation.

import { compileToWasm } from 'agentvault';

const wasm = await compileToWasm({
entryPoint: './src/index.ts',
outputPath: './dist/agent.wasm'
});

packager.ts

Package creation.

import { createPackage } from 'agentvault';

const pkg = await createPackage({
projectPath: './my-agent',
outputDir: './dist'
});

src/canister/

Canister bindings and state management.

actor.ts

Actor creation and management.

import { createActor, createAnonymousAgent } from 'agentvault';

const agent = createAnonymousAgent('http://localhost:4943');
const actor = createActor(canisterId, agent);

state.ts

State query and fetch.

import { fetchCanisterState, queryState } from 'agentvault';

const state = await fetchCanisterState(canisterId, actor);
const query = await queryState(canisterId, 'getValue');

encryption.ts

AES-256-GCM and ChaCha20-Poly1305 encryption.

import { encrypt, decrypt, deriveKey } from 'agentvault';

const key = deriveKey(password, salt);
const encrypted = encrypt(plaintext, key);
const decrypted = decrypt(encrypted, key);

src/wallet/

Multi-chain wallet management.

index.ts

Wallet manager entry point.

import { WalletManager } from 'agentvault';

const manager = new WalletManager();
const wallet = await manager.createWallet('ethereum');

providers/

Chain-specific providers:

ProviderChainFeatures
icp-provider.tsICPIdentity, cycles, tokens
ethereum-provider.tsEthereumEOA, transactions
cketh-provider.tsckETHckETH, Etherscan
solana-provider.tsSolanaSPL tokens
polkadot-provider.tsPolkadotDOT, staking

wallet-storage.ts

Persistent wallet storage.

import { saveWallet, loadWallet, listWallets } from 'agentvault';

await saveWallet(wallet);
const loaded = await loadWallet(walletId);
const all = await listWallets(agentId);

src/security/

Security primitives and VetKeys.

vetkeys.ts

Threshold key derivation.

import { VetKeysClient, deriveThresholdKey } from 'agentvault';

const client = new VetKeysClient(actor);
const key = await deriveThresholdKey(seedPhrase, 3, 2);

multisig.ts

Multi-signature approvals.

import { MultisigManager } from 'agentvault';

const multisig = new MultisigManager();
await multisig.createRequest('deploy', params);
await multisig.signRequest(requestId, signer);

src/monitoring/

Health checks and metrics.

health.ts

Health check implementation.

import { runHealthCheck } from 'agentvault';

const result = await runHealthCheck(canisterId, {
checks: ['status', 'cycles', 'memory']
});

metrics.ts

Metrics collection.

import { collectMetrics, getMetricsFilePath } from 'agentvault';

const metrics = await collectMetrics(canisterId);
// Returns: requests, errors, latency, memory, cycles

src/backup/

Backup and restore.

backup.ts

Backup creation.

import { createBackup, restoreBackup } from 'agentvault';

const backup = await createBackup(agentName, {
canisterId: 'abcde-aaaab',
includeState: true
});

await restoreBackup(backup.id, targetCanisterId);

src/archival/

Arweave archival storage.

arweave-client.ts

Arweave integration.

import { ArweaveClient } from 'agentvault';

const client = new ArweaveClient();
await client.upload(backup);
const tx = await client.getStatus(transactionId);

src/inference/

AI inference integration.

bittensor-client.ts

Bittensor network client.

import { BittensorClient } from 'agentvault';

const client = new BittensorClient();
const response = await client.query({ prompt: 'Hello' });

cli/commands/

CLI command implementations.

Structure

Each command file exports a Commander.js command:

// cli/commands/example.ts
import { Command } from 'commander';

export const exampleCommand = new Command('example')
.description('Example command')
.option('-v, --verbose', 'Verbose output')
.action((options) => {
// Command implementation
});

Available Commands

FileCommandDescription
init.tsinitInitialize project
package.tspackagePackage agent
deploy.tsdeployDeploy to canister
exec.tsexecExecute task
show.tsshowShow state
fetch.tsfetchDownload state
status.tsstatusProject status
list.tslistList agents
wallet.tswalletWallet operations
backup.tsbackupBackup operations
promote.tspromotePromote environment
rollback.tsrollbackRollback deployment
monitor.tsmonitorMonitor health
health.tshealthHealth checks
info.tsinfoCanister info
stats.tsstatsStatistics
logs.tslogsView logs
cycles.tscyclesCycles management
tokens.tstokensToken balances
identity.tsidentityICP identity
inference.tsinferenceAI inference
archive.tsarchiveArweave archival
approve.tsapproveMultisig approvals
profile.tsprofilePerformance profiling
trace.tstraceExecution traces
rebuild.tsrebuildRebuild from state