open-index/open-npm huggingface dataset:
npm package: @sandaoliu/byering_common_components
Description: 百聆组件库
Latest version: 1.0.6

# byering_common_components

## Usage

TODO

## Options

TODO

## Development

```bash
# 安装依赖
$ yarn install

# 项目启动
$ yarn start

# 项目打包
$ yarn run build

# 热更新
$ yarn run build:watch

# 检验后打包
$ yarn run docs:build

# check your project for potential problems
$ yarn run doctor
```

## 提示

npm/yarn link 安装本地联调, 如果有缓存问题 .umirc 添加

```bash
mfsu: true,
```

本地写文档联调可能会有问题样式找不到的问题，可在 less 引入

```bash
@import '../../global.less'
```
npm package: @sandbank.dev/agent
Description: Lightweight client for AI agents running inside Sandbank sandboxes
Latest version: 0.2.0

# @sandbank.dev/agent

> Lightweight client for AI agents running inside [Sandbank](../../README.md) sandboxes.

Connects to the relay server via WebSocket, enabling messaging, shared context, and task completion signaling.

## Install

```bash
pnpm add @sandbank.dev/agent
```

## Usage

Runs inside a sandbox. Connection parameters are read from `SANDBANK_*` environment variables injected by `createSession()`:

```typescript
import { connect } from '@sandbank.dev/agent'

const session = await connect()

// Listen for messages
session.on('message', async (msg) => {
  if (msg.type === 'task') {
    const result = await doWork(msg.payload)
    await session.send(msg.from, 'done', result)
  }
})

// Shared context
const spec = await session.context.get('spec')
await session.context.set('output', { files: ['index.ts'] })

// Signal completion
await session.complete({ status: 'success', summary: 'Built 5 endpoints' })
session.close()
```

## CLI

Also available as a CLI tool for shell scripts inside sandboxes:

```bash
sandbank-agent send <to> <type> [payload]
sandbank-agent recv [--wait 5000]
sandbank-agent context get <key>
sandbank-agent context set <key> <value>
sandbank-agent complete <status> <summary>
```

## Environment Variables

| Variable | Description |
|----------|-------------|
| `SANDBANK_WS_URL` | Relay WebSocket URL |
| `SANDBANK_SESSION_ID` | Session identifier |
| `SANDBANK_SANDBOX_NAME` | This agent's sandbox name |
| `SANDBANK_AUTH_TOKEN` | Authentication token |

## License

MIT
npm package: @sandbank.dev/cloud
Description: Sandbank Cloud adapter with x402 payment support
Latest version: 0.2.0

# @sandbank.dev/cloud

> Sandbank Cloud adapter for [Sandbank](../../README.md) with built-in x402 payment support.

Connect to [Sandbank Cloud](https://sandbank.dev/cloud) — managed bare-metal KVM sandboxes with sub-second start times. Pay per sandbox with USDC via the x402 payment protocol, or use an API token for authenticated access.

## Install

```bash
pnpm add @sandbank.dev/core @sandbank.dev/cloud
```

## Usage

### x402 Payment (pay-per-use)

```typescript
import { createProvider } from '@sandbank.dev/core'
import { SandbankCloudAdapter } from '@sandbank.dev/cloud'

const provider = createProvider(
  new SandbankCloudAdapter({
    walletPrivateKey: process.env.WALLET_PRIVATE_KEY,
  })
)

const sandbox = await provider.create({
  image: 'codebox',
  resources: { cpu: 2, memory: 1024 },
  ports: [[0, 7681], [0, 8080]],
})

const { stdout } = await sandbox.exec('node -e "console.log(42)"')
console.log(stdout) // 42

await provider.destroy(sandbox.id)
```

### API Token (authenticated access)

```typescript
const provider = createProvider(
  new SandbankCloudAdapter({
    apiToken: process.env.SANDBANK_API_TOKEN,
  })
)
```

## Configuration

| Option | Description |
|--------|-------------|
| `url` | Sandbank Cloud API URL (default: `https://cloud.sandbank.dev`) |
| `walletPrivateKey` | EVM wallet private key (hex, `0x` prefix) for x402 USDC payments |
| `apiToken` | Bearer token for authenticated (internal) access — bypasses x402 |

## Capabilities

| Capability | Supported |
|------------|:---------:|
| `exec.stream` | ✅ |
| `port.expose` | ✅ |

## How x402 Payment Works

1. `POST /v1/boxes` returns HTTP 402 with payment requirements
2. The adapter signs a USDC payment on Base (eip155:8453) using your wallet
3. The request is retried with the payment signature header
4. The sandbox is created — $0.02 per sandbox (includes 10 min)

## License

MIT
npm package: @sandbank.dev/cloudflare
Description: Cloudflare Workers sandbox adapter for Sandbank
Latest version: 0.2.0

# @sandbank.dev/cloudflare

> Cloudflare Workers sandbox adapter for [Sandbank](../../README.md).

## Install

```bash
pnpm add @sandbank.dev/core @sandbank.dev/cloudflare
```

## Usage

```typescript
import { createProvider } from '@sandbank.dev/core'
import { CloudflareAdapter } from '@sandbank.dev/cloudflare'

const adapter = new CloudflareAdapter({
  namespace: env.SANDBOX,       // DurableObject binding
  hostname: 'myapp.dev',
  sleepAfter: '30m',
  storage: {                    // enables volumes capability
    endpoint: 'https://xxx.r2.cloudflarestorage.com',
    provider: 'r2',
  },
})

const provider = createProvider(adapter)
const sandbox = await provider.create({ image: 'node:22' })
const { stdout } = await sandbox.exec('echo hello')
await provider.destroy(sandbox.id)
```

## Capabilities

| Capability | Supported |
|------------|:---------:|
| `exec.stream` | ✅ |
| `terminal` | ✅ |
| `port.expose` | ✅ |
| `snapshot` | ✅ |
| `volumes` | ✅ (with `storage` config) |

## Characteristics

- **Runtime:** V8 isolate + container
- **Cold start:** ~1s
- **File I/O:** Native SDK
- **Region:** Global edge
- **Dependency:** `@cloudflare/sandbox`

## License

MIT
npm package: @sandbank.dev/core
Description: Unified sandbox SDK for AI agents — provider abstraction, capability system, and error types
Latest version: 0.3.6

# @sandbank.dev/core

> Unified sandbox SDK for AI agents — provider abstraction, capability system, and error types.

## Install

```bash
pnpm add @sandbank.dev/core
```

## Usage

```typescript
import { createProvider, withTerminal, connectTerminal } from '@sandbank.dev/core'
import { DaytonaAdapter } from '@sandbank.dev/daytona'

const provider = createProvider(
  new DaytonaAdapter({ apiKey: process.env.DAYTONA_API_KEY! })
)

// Create a sandbox with a non-root user
const sandbox = await provider.create({
  image: 'node:22',
  user: 'sandbank',            // creates non-root user with sudo
})
const { stdout } = await sandbox.exec('node --version')
await sandbox.writeFile('/app/index.js', 'console.log("hi")')

// Run privileged commands with asRoot
await sandbox.exec('apt-get update', { asRoot: true })

// Capability detection
const terminal = withTerminal(sandbox)
if (terminal) {
  const info = await terminal.startTerminal()
  const session = connectTerminal(info)
  await session.ready
  session.onData((data) => process.stdout.write(data))
  session.write('ls\n')
}

await provider.destroy(sandbox.id)
```

## Capabilities

Use `hasCapability(provider, name)` to check provider support, and `withTerminal(sandbox)` / `withStreaming(sandbox)` / etc. for type-safe downcasting.

| Capability | Description |
|------------|-------------|
| `exec.stream` | Real-time stdout/stderr streaming |
| `terminal` | Interactive web terminal (ttyd) |
| `sleep` | Hibernate and wake sandboxes |
| `volumes` | Persistent volume management |
| `snapshot` | Snapshot and restore sandbox state |
| `port.expose` | Expose sandbox ports to the internet |

## Multi-Agent Sessions

```typescript
import { createSession } from '@sandbank.dev/core'

const session = await createSession({ provider, relay: { type: 'memory' } })
const agent = await session.spawn('worker', { image: 'node:22' })
await session.waitForAll()
await session.close()
```

## License

MIT
npm package: @sandbank.dev/daytona
Description: Daytona cloud sandbox adapter for Sandbank
Latest version: 0.3.4

# @sandbank.dev/daytona

> Daytona cloud sandbox adapter for [Sandbank](../../README.md).

## Install

```bash
pnpm add @sandbank.dev/core @sandbank.dev/daytona
```

## Usage

```typescript
import { createProvider } from '@sandbank.dev/core'
import { DaytonaAdapter } from '@sandbank.dev/daytona'

const provider = createProvider(
  new DaytonaAdapter({
    apiKey: process.env.DAYTONA_API_KEY!,
    apiUrl: 'https://app.daytona.io/api', // optional
  })
)

const sandbox = await provider.create({
  image: 'node:22',
  resources: { cpu: 2, memory: 4096 },
  autoDestroyMinutes: 60,
})

const { stdout } = await sandbox.exec('node --version')
await sandbox.writeFile('/app/index.js', 'console.log("hello")')
await provider.destroy(sandbox.id)
```

## Capabilities

| Capability | Supported |
|------------|:---------:|
| `terminal` | ✅ |
| `volumes` | ✅ |
| `port.expose` | ✅ |

## Characteristics

- **Runtime:** Full VM
- **Cold start:** ~10s
- **File I/O:** Native SDK
- **Region:** Multi
- **Dependency:** `@daytonaio/sdk`

## License

MIT
npm package: @sandbank.dev/flyio
Description: Fly.io Machines sandbox adapter for Sandbank
Latest version: 0.2.0

# @sandbank.dev/flyio

> Fly.io Machines sandbox adapter for [Sandbank](../../README.md).

Zero external SDK dependencies — uses the Fly.io Machines REST API directly via `fetch`.

## Install

```bash
pnpm add @sandbank.dev/core @sandbank.dev/flyio
```

## Usage

```typescript
import { createProvider } from '@sandbank.dev/core'
import { FlyioAdapter } from '@sandbank.dev/flyio'

const provider = createProvider(
  new FlyioAdapter({
    apiToken: process.env.FLY_API_TOKEN!,
    appName: 'my-sandbox-pool',
    region: 'nrt', // optional
  })
)

const sandbox = await provider.create({
  image: 'node:22-slim',
  resources: { cpu: 1, memory: 512 },
})

const { stdout } = await sandbox.exec('node --version')
await provider.destroy(sandbox.id)
```

## Capabilities

| Capability | Supported |
|------------|:---------:|
| `terminal` | ✅ |
| `volumes` | ✅ |
| `port.expose` | ✅ |

## Characteristics

- **Runtime:** Firecracker microVM
- **Cold start:** ~3-5s
- **File I/O:** Via exec (base64)
- **Region:** Multi
- **External deps:** None (pure fetch)

## License

MIT
npm package: @sandbank.dev/relay
Description: WebSocket relay server for multi-agent communication in Sandbank
Latest version: 0.2.1

# @sandbank.dev/relay

> WebSocket relay server for multi-agent communication in [Sandbank](../../README.md).

Provides HTTP (long-polling) and WebSocket transport with JSON-RPC 2.0 protocol for real-time messaging and shared context between sandboxes.

## Install

```bash
pnpm add @sandbank.dev/relay
```

## Usage

Usually used internally by `createSession()` from `@sandbank.dev/core`, but can be started standalone:

```typescript
import { startRelay } from '@sandbank.dev/relay'

const relay = await startRelay({ port: 4000 })
console.log(relay.wsUrl) // ws://127.0.0.1:4000

// Later...
await relay.close()
```

## Protocol

- **Transport:** HTTP `POST /rpc` + WebSocket, dual-channel
- **Format:** JSON-RPC 2.0
- **Auth:** `X-Session-Id` + `X-Auth-Token` headers

### RPC Methods

| Method | Description |
|--------|-------------|
| `session.auth` | WebSocket authentication |
| `message.send` | Point-to-point messaging |
| `message.broadcast` | Broadcast to all agents |
| `message.recv` | Pull messages (supports long-polling) |
| `context.get/set/delete/keys` | Shared context CRUD |
| `sandbox.complete` | Mark agent as completed |

## License

MIT