Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@permaweb/loco

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@permaweb/loco

Develop and troubleshoot AO processes locally by loading a wasm module and interacting with it via a simple JS API.

latest
Source
npmnpm
Version
0.0.21
Version published
Maintainers
1
Created
Source

AOS Local

Develop and troubleshoot AO processes locally by loading a wasm module and interacting with it via a simple JS API.

Requirements

  • Node 20+ (ESM only)
  • Always run with --experimental-wasm-memory64 (or set NODE_OPTIONS)

Install

npm i @permaweb/loco
# or
yarn add @permaweb/loco

Quick Start

import { aoslocal, SQLITE } from '@permaweb/loco'

async function main() {
  const aos = await aoslocal(SQLITE) // or omit for latest default
  await aos.src('./test/example.lua') // bundles local Lua requires automatically

  const evalRes = await aos.eval('Count = 1 + 1')
  const { Output } = await aos.send({ Action: 'Eval', Data: 'Count' })
  console.log(Output.data)
}

main()

Run with the memory flag (or export once):

NODE_OPTIONS="--experimental-wasm-memory64" node index.js

API

  • aoslocal(aosmodule = LATEST, env?) → Promise
    • aosmodule: use SQLITE, LLAMA, LATEST or an Arweave TX id
    • env: { Process, Module } defaults are provided for local dev
  • aos.src(srcFile, env?) → loads Lua source; packs require() graph into one
  • aos.eval(expr, env?) → AOS_Result for an Eval action
  • aos.send(message, env?) → AOS_Result; any extra fields become Tags
  • aos.load(processId) → loads latest checkpoint for a process
  • aos.fromCheckpoint(txId) → loads a specific checkpoint
  • aos.fromState(txId) → downloads VM memory from https://cu.ao-testnet.xyz/state/${txId} and loads it
  • aos.asOwner(processId) → derives default env from a live process
  • aos.fromOwner(txOrPid) → resolves Process from a state TX (if given), sets env

Types

// AOS_Message
Record<string, string>

// AOS_Result
{
  Output: { data: string },
  Messages: Record<string, any>[],
  Spawns: Record<string, any>[],
  Assignments: Record<string, any>[]
}

Checkpoints & Caching

  • Checkpoints are fetched from Arweave and cached as <txId>.bin in CWD
  • fromState fetches from the AO testnet state endpoint and also caches as <txId>.bin
  • Large files are streamed to disk; subsequent runs reuse the cache
  • Network is required for first load of module binary and checkpoints/state

Testing

  • All tests: npm test
  • Single file: npm test -- test/index.test.js
  • Name pattern: npm test -- --test-name-pattern="basic"

License: MIT

FAQs

Package last updated on 21 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts