惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Y
Y Combinator Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
V2EX
博客园 - 三生石上(FineUI控件)
Hugging Face - Blog
Hugging Face - Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
罗磊的独立博客
博客园_首页
量子位
雷峰网
雷峰网
GbyAI
GbyAI
小众软件
小众软件
酷 壳 – CoolShell
酷 壳 – CoolShell
D
DataBreaches.Net
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The Cloudflare Blog
IT之家
IT之家
WordPress大学
WordPress大学
人人都是产品经理
人人都是产品经理
Apple Machine Learning Research
Apple Machine Learning Research
P
Proofpoint News Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 聂微东

Hacker News: Show HN

PurrrrrFocus: Pomodoro Timer App - App Store Workflow Engine — Multi-Step Orchestration for Bun RapidPhoto: Pro Photo Editor App - App Store GitHub - DheerG/swarms: Achieve extraordinary results with claude code across a variety of tasks SPICE simulation → oscilloscope → verification with Claude Code — Lucas Gerads Show HN: VCoding – A 5 MB native Windows IDE with no dynamic dependencies Show HN: LLMs don't hallucinate because they're bad at math, it's the format GitHub - Agent-FM/agentfm-core: AgentFM is a peer-to-peer network that turns everyday computers into a decentralized AI supercomputer. AgentFM lets you run massive AI workloads directly across a global mesh of idle CPUs and GPUs. Show HN: Tracking Top US Science Olympiad Alumni over Last 25 Years GitHub - Potarix/agent-hub: One place to talk to all your agents Show HN: Runtime security for AI agents(injection,tool abuse, data exfiltration) GitHub - dubeyKartikay/lazyspotify: Terminal Spotify client for macOS and Linux GitHub - the-banana-tool/king-louie: Easy to use GUI Personal AI Assistant. Win/Linux/Mac. Show HN I made my vacation rental bookable by AI agents–no Airbnb, 0% commission GitHub - basteez/jsf-autoreload: maven plugin to enable hot reload on jsf projects uvm32/hosts/host-gdbstub at main · ringtailsoftware/uvm32 GitHub - labsai/EDDI: Config-driven engine that turns JSON into production-grade AI agents. Multi-agent orchestration, 12+ LLM providers, MCP/A2A protocols, RAG, persistent memory, and enterprise compliance (EU AI Act, GDPR, HIPAA). Built on Quarkus. GitHub - glitchnsec/fortyone-oss: AI Executive Assistant Platform Quickstart | Alien GitHub - muxshed/shed: One stream in, or many. Every destination, simultaneously. No cloud middleman, no per-channel fees, no limits. GitHub - ocrbase-hq/ocrbase: 📄 PDF/IMG ->.MD/JSON Document OCR API for PaddleOCR and GLMOCR. Self-hostable. GitHub - impactjo/home-memory: MCP server that lets your AI assistant remember everything about your home. GitHub - Sets88/dbcls: DbCls is a powerful terminal database client that supports various databases GitHub - neptun2000/heor-agent-mcp GitHub - SeanFDZ/macmind: Single-layer transformer in HyperTalk for the classic Macintosh RollQuation: Math Puzzles - Apps on Google Play GitHub - dropbox/witchcraft Show HN: Agent-cache – Multi-tier LLM/tool/session caching for Valkey and Redis GitHub - opentalon/opentalon: OpenTalon is an open-source platform built from the ground up in Go as a robust alternative to OpenClaw LinkedIn™ 职位抓取工具 - Chrome 应用商店
GitHub - capsulerun/bash: Sandboxed bash for agents. Full...
mavdol04 · 2026-05-04 · via Hacker News: Show HN

Overview

Capsule Bash is a command interpreter built for executing untrusted commands. It provides a bash-like interface to interact with the filesystem and run commands in a sandboxed environment.

  • Commands and sandboxes: Bash commands are reimplemented in TypeScript and run code inside isolated sandboxes. The sandbox layer is modular, so we can plug in any runtime that implements the interface. The default WasmRuntime uses Capsule runtime to run commands inside WebAssembly sandboxes.

  • Instant feedback: Traditional bash treats silence as success. In agentic workflows for example, that forces a second call just to confirm the first one worked. Capsule Bash returns structured output for every command. Exit code, stdout, stderr, and a diff of filesystem changes.

  • Workspace isolation: Commands operates in a mounted workspace directory. The host filesystem is not accessible from inside the sandbox. You get full visibility into what is executed without exposing your system. The workspace is persistent and stays alive until you reset it manually.

Getting Started

TypeScript SDK

npm install @capsule-run/bash @capsule-run/bash-wasm

Run it:

import { Bash } from '@capsule-run/bash';
import { WasmRuntime } from '@capsule-run/bash-wasm';

const bash = new Bash({ runtime: new WasmRuntime() });

const result = await bash.run('mkdir src && touch src/index.ts');

console.log(result);

/**
Result {
  stdout: "Folder created ✔\nFile created ✔",
  stderr: "",
  diff: { created: ['src/index.ts'], modified: [], deleted: [] },
  duration: 10,
  exitCode: 0,
}
**/

Interactive shell

Clone the repository, then run from the project root:

pnpm -s bash-wasm-shell

Important

Python and pip are required to compile the Python sandbox. Both sandboxes (JS and Python) are needed to run the shell.

MCP server

{
  "mcpServers": {
    "capsule": {
      "command": "npx",
      "args": ["-y", "@capsule-run/bash-mcp"]
    }
  }
}

See the MCP Readme for configuration details.

Documentation

Bash Options

Parameter Description Type Default
runtime Runtime to use for the sandbox Runtime class None
customCommands Custom commands to add to the bash instance CustomCommand[] []
hostWorkspace Host workspace directory string ".capsule/session/workspace"
initialCwd Initial working directory string "/workspace"

Runtime

The runtime is the engine that runs the bash commands. WasmRuntime is available by default to run the commands in a WebAssembly sandbox.

import { Bash } from '@capsule-run/bash';
import { WasmRuntime } from '@capsule-run/bash-wasm';

const bash = new Bash({ runtime: new WasmRuntime() });

Custom Commands

import { Bash, createCommand } from '@capsule-run/bash';
import { WasmRuntime } from '@capsule-run/bash-wasm';

const firstCustomCommand = createCommand('hello', async (opts, state) => {
  return { stdout: 'Hello', stderr: '', exitCode: 0 };
});

const bash = new Bash({
  runtime: new WasmRuntime(),
  customCommands: [firstCustomCommand],
});

Host Workspace

The host workspace is the directory on the host system that is mounted to the sandbox. It can be any folder in the project directory. By default, it is set to .capsule/session/workspace.

const bash = new Bash({ runtime: new WasmRuntime(), hostWorkspace: 'customFolder' });

Initial Working Directory

The initial working directory is where bash commands are executed. By default it is set to /workspace. You can set it to any directory inside the sandbox filesystem.

const bash = new Bash({ runtime: new WasmRuntime(), initialCwd: '/' });

Run

Use the run method to execute a command in the sandbox.

const bash = new Bash({ runtime: new WasmRuntime() });

const result = await bash.run('mkdir src && touch src/index.ts');

console.log(result);

Response Format

{
  stdout: string,
  stderr: string,
  diff: { created: string[], modified: string[], deleted: string[] }, // Files and directories changes
  duration: number, // Duration in milliseconds
  exitCode: number
}

Preload

Use the preload method to warm up a sandbox before running commands. By default it preloads the JS sandbox.

const bash = new Bash({ runtime: new WasmRuntime() });

await bash.preload(); // js by default
await bash.preload('python'); // python

Reset

Use the reset method to clear the bash instance and restore the sandbox filesystem to its initial state.

const bash = new Bash({ runtime: new WasmRuntime() });

await bash.reset();

Limitations

  • WasmRuntime runs in Node.js only, browser environments are not supported with the existing runtime yet
  • Not all bash commands are implemented yet. See packages/bash/src/commands/ for the current list. Feel free to open an issue to request a new one.

Contributing

Contributions are welcome, whether it's documentation, new commands, or bug reports.

Adding or improving commands

Commands live in packages/bash/src/commands/. To contribute:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-command
  3. Add or update your command in packages/bash/src/commands/
  4. Add unit tests
  5. Open a pull request

License

Apache License 2.0. See LICENSE for details.