npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@jinn-network/mech-client-ts

v0.0.6

Published

TypeScript client for Autonolas AI Mechs - Full feature parity with mech-client-python using async delivery monitoring

Readme

mech-client-ts

npm version License

TypeScript client for Autonolas AI Mechs with full feature parity with mech-client-python.

Part of the Jinn Network ecosystem.

⚠️ AI-Generated Code Notice

This project was primarily generated using AI assistance. While functional, users should be aware:

  • Code Review Recommended: Thoroughly review and test all functionality before using in production
  • Active Development: The codebase may contain patterns or implementations that need refinement
  • Community Contributions Welcome: We encourage experienced developers to review, improve, and contribute to the codebase
  • Use at Your Own Risk: Test extensively in your specific use case before deployment

We welcome issues, pull requests, and feedback to improve code quality and reliability.

Features

  • Full Python Parity - v0.0.1+ matches mech-client-python functionality
  • Async Delivery Monitoring - RPC polling for reliable delivery detection (no WebSockets required for marketplace)
  • CLI Tool & Library - Use as mechx command or import as TypeScript library
  • Marketplace & Legacy Mechs - Support for both marketplace and legacy mech interactions
  • TypeScript Types - Full type definitions included
  • Modern Architecture - Clean separation of concerns, well-documented

Installation

npm install @jinn-network/mech-client-ts
# or
yarn add @jinn-network/mech-client-ts

Quick Start

As a CLI Tool

After installation, use the mechx command:

# Send a request to a mech via marketplace
mechx interact \
  --prompts "your prompt" \
  --priority-mech <mech-address> \
  --tools <tool-name> \
  --chain-config base \
  --post-only \
  --key <private-key-file>

# Deliver a result (for mech workers)
mechx deliver \
  --request-id <request-id> \
  --result-file <result-file> \
  --target-mech <mech-address> \
  --multisig <safe-address> \
  --key <private-key-file> \
  --chain-config base

As a Library

import { marketplaceInteract } from '@jinn-network/mech-client-ts';

// Send a request to a mech via marketplace
const result = await marketplaceInteract({
  prompts: ['Your AI prompt here'],
  priorityMech: '0x...', // Mech address
  chainConfig: 'base',
  postOnly: true, // Just post, don't wait for delivery
  // ... other options
});

console.log('Request ID:', result.requestIds[0]);

See MIGRATION.md for detailed usage examples and migration guide.

Private Key Management

  • Security Warning: Never persist private keys inside your workspace or repository. Use one of the secure KeyConfig options below.
  • No Auto-Writes: The client no longer writes MECH_PRIVATE_KEY values to ethereum_private_key.txt.
  • Operate Integration: Keys stored in OLAS .operate directories are supported out of the box.

KeyConfig Interface

interface KeyConfig {
  source: 'value' | 'file' | 'env' | 'operate';
  value?: string;
  filePath?: string;
  envVar?: string;
  operateDir?: string;
}

Usage Examples

import { deliverViaSafe, marketplaceInteract, KeyConfig } from '@jinn-network/mech-client-ts';

// Recommended: resolve keys from the OLAS Operate home
const operateKey: KeyConfig = { source: 'operate' };

await deliverViaSafe({
  chainConfig: 'base',
  requestId: '0x123',
  resultContent: {},
  targetMechAddress: '0xabc',
  safeAddress: '0xdef',
  keyConfig: operateKey,
});

// Environment variable
const envKey: KeyConfig = { source: 'env', envVar: 'MECH_PRIVATE_KEY' };

await marketplaceInteract({
  prompts: ['tell me a joke'],
  priorityMech: '0xabc',
  chainConfig: 'base',
  keyConfig: envKey,
});

// Explicit file (store outside the workspace)
const fileKey: KeyConfig = { source: 'file', filePath: '/secure/keys/mech.txt' };

Backward Compatibility

  • privateKey and privateKeyPath options still work.
  • MECH_PRIVATE_KEY continues to be detected automatically.
  • Legacy helpers (getPrivateKey, getPrivateKeyPath, checkPrivateKeyFile) remain but are deprecated.

.operate Directory Layout

~/.operate/services/
└── sc-<service-id>/
    ├── keys.json   # [{"ledger":"ethereum","address":"0x...","private_key":"0x..."}]
    └── config.json

Set OPERATE_HOME to override the default ~/.operate location.

What's Different from mech-client-python?

This TypeScript client achieves full feature parity with the Python client:

  • Same delivery monitoring approach - Uses async RPC polling instead of WebSockets
  • Same configuration structure - Chain configs, mech ABIs, etc.
  • Same CLI interface - Similar command structure and options
  • Better for TypeScript projects - Native TypeScript types and modern async/await patterns

Documentation

Development

Building from Source

# Clone the repository
git clone https://github.com/Jinn-Network/mech-client-ts.git
cd mech-client-ts

# Install dependencies
yarn install

# Build
yarn build

# Run tests
yarn test

Available Scripts

  • yarn build - Compile TypeScript to JavaScript
  • yarn dev - Run in development mode with ts-node
  • yarn start - Run the compiled JavaScript
  • yarn test - Run tests

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for development workflow and guidelines.

For bug reports and feature requests, please use GitHub Issues.

License

Apache-2.0 - See LICENSE for details.

Credits

Links