open-index/open-npm huggingface dataset:
npm package: @lit-protocol/fss-cli
Description: A command-line interface for interacting with Lit Protocol agents.
Latest version: 0.1.1-10

# @lit-protocol/fss-cli

A command-line interface for interacting with Lit Protocol agents.

## Installation

```bash
npm install -g @lit-protocol/fss-cli
```

## Usage

Once installed, you can start the CLI by running:

```bash
lit-agent
```

The CLI will guide you through:
1. Setting up your agent wallet
2. Configuring your OpenAI API key
3. Interacting with your agent using natural language

### First Time Setup

On first run, you'll need to:
1. Either generate a new wallet or provide an existing private key
2. Fund your wallet with Lit test tokens from the faucet
3. Provide your OpenAI API key

### Example Commands

You can interact with your agent using natural language. For example:

```bash
> What would you like to do?
send 10 USDC to 0x1234...

> What would you like to do?
transfer 5 ETH from my wallet to 0x5678...
```

### Policy Configuration

When executing sensitive operations, you can configure policies to restrict:
- Maximum transaction amounts
- Allowed tokens
- Allowed recipients

## License

MIT
npm package: @lit-protocol/fss-signer
Description: Secure transaction signing implementation for Lit AI Agents using Lit Protocol's Programmable Key Pairs (PKPs).
Latest version: 0.1.0-13

# @lit-protocol/fss-signer

Secure transaction signing implementation for Lit AI Agents using Lit Protocol's Programmable Key Pairs (PKPs).

## Features

- Secure key management through Lit Protocol's PKP system
- Transaction signing for multiple chains
- Automatic capacity credit management
- Local storage for PKP and capacity credit persistence

## Installation

```bash
pnpm add @lit-protocol/fss-signer
```

## Usage

```typescript
import { AgentSigner } from '@lit-protocol/fss-signer';

// Create a new signer instance
const signer = await AgentSigner.create(
  'your-auth-private-key',
  {
    litNetwork: 'datilTest',
    debug: false
  }
);

// Sign a transaction
const signedTx = await signer.signTransaction({
  to: '0x...',
  value: '1000000000000000000',
  data: '0x...'
});
```

## Architecture

The signer works by:
1. Connecting to Lit Protocol network
2. Managing PKP minting and storage
3. Handling capacity credits for rate limiting
4. Providing secure transaction signing

## Security Features

- Secure key storage through Lit Protocol's PKP system
- Automatic balance checks for auth wallet
- Persistent storage of PKP and capacity credits
- Network-specific configurations

## API Reference

### `AgentSigner`

Main class for handling secure transaction signing.

#### Static Methods

##### `create()`
```typescript
static async create(
  authPrivateKey: string,
  options?: {
    litNetwork?: LIT_NETWORKS_KEYS;
    debug?: boolean;
  }
): Promise<AgentSigner>
```

Creates a new AgentSigner instance with the specified configuration.

#### Instance Methods

##### `signTransaction()`
```typescript
async signTransaction(
  transaction: ethers.providers.TransactionRequest
): Promise<string>
```

Signs an Ethereum transaction using the agent's PKP.

##### `signMessage()`
```typescript
async signMessage(message: string): Promise<string>
```

Signs a message using the agent's PKP.

## License

MIT
npm package: @lit-protocol/fss-tool-policy-base
Description: A collection of shared utilities and interfaces for building Lit AI Agent tools. This toolkit provides the foundation for creating secure and policy-controlled agent tools.
Latest version: 0.1.1-10

# @lit-protocol/fss-tool-policy-base

A collection of shared utilities and interfaces for building Lit AI Agent tools. This toolkit provides the foundation for creating secure and policy-controlled agent tools.

## Features

- Base interfaces for tool development
- Policy management system
- Common utilities for blockchain interactions
- Type definitions for the Lit Protocol ecosystem

## Installation

```bash
pnpm add @lit-protocol/fss-tool-policy-base
```

## Usage

### Creating a New Tool

```typescript
import { 
  BaseLitActionPolicy,
  BaseLitActionPolicySchema,
  registerPolicy
} from '@lit-protocol/fss-tool-policy-base';

// 1. Define your policy interface
interface MyToolPolicy extends BaseLitActionPolicy {
  type: 'MyTool';
  maxAmount: string;
  allowedTokens: string[];
}

// 2. Create the policy schema
const MyToolPolicySchema = BaseLitActionPolicySchema.extend({
  type: z.literal('MyTool'),
  maxAmount: z.string(),
  allowedTokens: z.array(z.string())
});

// 3. Register your policy
registerPolicy<MyToolPolicy>('MyTool', {
  schema: MyToolPolicySchema,
  encode: (policy) => encodeMyToolPolicy(policy),
  decode: (bytes, version) => decodeMyToolPolicy(bytes, version)
});

// 4. Use the policy in your tool
const policy = validatePolicy<MyToolPolicy>('MyTool', userInput);
const encoded = encodePolicy('MyTool', policy);
```

### Working with Policies

```typescript
// Validate a policy against its schema
const policy = validatePolicy<SendERC20Policy>('SendERC20', {
  type: 'SendERC20',
  maxAmount: '1000000000000000000',
  allowedTokens: ['0x...', '0x...']
});

// Encode a policy for on-chain storage
const encoded = encodePolicy('SendERC20', policy);

// Decode a policy from on-chain data
const decoded = decodePolicy<SendERC20Policy>('SendERC20', encoded, '1.0.0');
```

## Policy System

The toolkit provides a flexible policy system that allows tools to:
1. Define their security requirements
2. Validate user inputs against policies
3. Encode/decode policies for on-chain storage
4. Share common policy types across tools

### Built-in Policy Types

- `BaseLitActionPolicy`: The foundation for all policies
- `SendERC20Policy`: For ERC20 token transfers
- `SwapPolicy`: For token swap operations
- `NFTPolicy`: For NFT operations

## API Reference

### Policy Management

#### `registerPolicy<T>()`
Register a new policy type with its schema and encoding functions.

#### `validatePolicy<T>()`
Validate policy data against its registered schema.

#### `encodePolicy()`
Encode a policy for on-chain storage.

#### `decodePolicy<T>()`
Decode a policy from on-chain data.

### Utilities

#### `formatUnits()`
Format token amounts with proper decimals.

#### `parseUnits()`
Parse token amounts into on-chain format.

#### `validateAddress()`
Validate Ethereum addresses.

## License

MIT
npm package: @lit-protocol/fss-tool-registry
Description: Central registry for Lit AI Agent tools. This package manages the registration, discovery, and validation of tools that can be executed by Lit agents.
Latest version: 0.1.1-10

# @lit-protocol/fss-tool-registry

Central registry for Lit AI Agent tools. This package manages the registration, discovery, and validation of tools that can be executed by Lit agents.

## Features

- Tool registration and management
- Policy validation
- Tool discovery and metadata
- Parameter validation
- IPFS integration for tool distribution

## Installation

```bash
pnpm add @lit-protocol/fss-tool-registry
```

## Usage

### Registering a Tool

```typescript
import { 
  registerTool,
  ToolInfo,
  validateParamsAgainstPolicy 
} from '@lit-protocol/fss-tool-registry';

// Define your tool
const myTool: ToolInfo = {
  name: 'MyTool',
  description: 'Performs a specific action',
  ipfsCid: 'Qm...',
  parameters: {
    param1: {
      type: 'string',
      description: 'First parameter',
      required: true
    },
    param2: {
      type: 'number',
      description: 'Second parameter',
      required: false
    }
  }
};

// Register the tool
registerTool(myTool);
```

### Using the Registry

```typescript
// List available tools
const tools = listAvailableTools();

// Get a specific tool
const tool = getToolFromRegistry('MyTool');

// Validate parameters against policy
validateParamsAgainstPolicy(
  tool,
  { param1: 'value1', param2: 42 },
  policyValues
);
```

## Tool Structure

Each tool in the registry must define:

1. Basic Information
   - Name
   - Description
   - IPFS CID of the implementation

2. Parameters
   - Name and type
   - Description
   - Required/optional status
   - Validation rules

3. Policy Requirements (optional)
   - Security constraints
   - Parameter restrictions
   - Network limitations

## API Reference

### Tool Management

#### `registerTool()`
```typescript
function registerTool(tool: ToolInfo): void
```
Register a new tool in the registry.

#### `listAvailableTools()`
```typescript
function listAvailableTools(): ToolInfo[]
```
Get a list of all registered tools.

#### `getToolFromRegistry()`
```typescript
function getToolFromRegistry(name: string): ToolInfo
```
Get a specific tool by name.

### Validation

#### `validateParamsAgainstPolicy()`
```typescript
function validateParamsAgainstPolicy(
  tool: ToolInfo,
  params: Record<string, any>,
  policy: any
): void
```
Validate tool parameters against its policy.

## License

MIT
npm package: @lit-protocol/law-cli
Description: This library was generated with [Nx](https://nx.dev).
Latest version: 0.1.0-23

# law-cli

This library was generated with [Nx](https://nx.dev).

## Building

Run `nx build law-cli` to build the library.

## Running unit tests

Run `nx test law-cli` to execute the unit tests via [Jest](https://jestjs.io).