computer

package module
v0.0.0-...-f2a50a4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2026 License: Apache-2.0 Imports: 52 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

computer

A sandboxed computer for an AI agent, as a Go library and one binary. It needs no Node and no container at run time, and it is built without cgo.

You give it folders and MCP servers. The agent gets a shell, SQLite and Python over those folders, and every MCP tool appears as a shell command and as a Python function. Nothing inside reaches the network or a file outside the folders, except through those tools.

Status: experimental. Two independent reviews each found ways out of the sandbox, which are fixed and tested here. Expect more. Do not rely on this as your only boundary around untrusted code.

Why

An agent that can only call tools must pass every result through the model. That is slow, costs tokens, and fails once a result is too large to read. With a computer the agent writes a short script; the script handles the data and only the answer returns to the model. The agent also carries four tool definitions, however many tools the servers offer.

Use it

go build -o computer ./cmd/computer

# an interactive shell over a folder
./computer -mount ./work:/home/user

# one command
./computer -mount ./work:/home/user -c 'ls | wc -l'

# a public MCP server by URL: DeepWiki, which answers questions about GitHub repositories
./computer -mount ./work:/home/user -mcp wiki=https://mcp.deepwiki.com/mcp \
    -c 'wiki --help; wiki read-wiki-structure --repo-name wazero/wazero | head'

# an MCP server started as a program: the reference "everything" server
./computer -mount ./work:/home/user -mcp 'everything=npx -y @modelcontextprotocol/server-everything' \
    -c 'everything echo --message hello'

# several servers at once, each its own command
./computer -mount ./work:/home/user -mcp wiki=https://mcp.deepwiki.com/mcp -mcp docs=https://mcp.context7.com/mcp

# as an MCP server for an agent: its tools are bash, read, edit and write
./computer -mount ./work:/home/user -mcp wiki=https://mcp.deepwiki.com/mcp mcp

With more than a few of either, put them in a file. mcpServers is the format Claude Code and Claude Desktop read, so a .mcp.json you already have works as it is; mounts are as -mount takes them.

{
  "mounts": ["./work:/home/user", "./docs:/reference:ro"],
  "mcpServers": {
    "wiki": {"type": "http", "url": "https://mcp.deepwiki.com/mcp", "headers": {"Authorization": "Bearer ${WIKI_TOKEN}"}},
    "everything": {"command": "npx", "args": ["-y", "@modelcontextprotocol/server-everything"]}
  }
}
./computer -config computer.json

${NAME} in a header or an env value is read from the environment. Flags add to the file.

A server that needs a bearer token reads it from the environment: COMPUTER_MCP_TOKEN_WIKI for a server named wiki, COMPUTER_MCP_TOKEN_MY_WIKI for my-wiki. A server started as a program runs on the host, outside the sandbox, like any other program you start; it inherits the environment except the COMPUTER_MCP_TOKEN variables, which its env can pass on by name.

For Claude Code:

claude mcp add computer -- /path/to/computer -mount /path/to/work -mcp wiki=https://mcp.deepwiki.com/mcp mcp

A folder given alone is seen in the computer at the path it has on your machine. Claude Code tells the model where it is working, and the model will use that path inside the computer. -mount host:guest names another path.

From Go:

c, err := computer.New(computer.Config{
    Mounts: []computer.Mount{{Guest: "/home/user", Host: dir}},
    Tools:  []tools.Source{{Name: "wiki", Session: session}}, // an MCP client session
    Python: python,                                           // from computer.EmbeddedPython, shared by every computer
})
defer c.Close()
res, err := c.Exec(ctx, &gbash.ExecutionRequest{Script: "wiki read-wiki-structure --repo-name wazero/wazero | wc -l"})

A terminal in the browser

c.Prompt(ctx, term, workDir, interrupt, size) is the shell ./computer gives a person at a terminal: a line editor with history and Tab completion over any stream, with the working directory and exported variables carried from line to line, and Ctrl-C ending only the running command. Each prompt is a shell of its own: two on one computer keep their own directories and variables. computer.TerminalHandler(get) serves it over a WebSocket; get is yours, and returns the requester's computer and working directory, or an error (403 for fs.ErrPermission, else a 500 that logs your error and does not show it). You keep authentication and which computer is whose. A request that is not a WebSocket, or whose page is of another origin, is refused before get is called; computer.CheckOrigin(func(*http.Request) bool) is another rule, for pages on a development server or behind a proxy that changes the Host. A client that answers no ping for a minute, or stops reading, ends its prompt and command. The React component is @lakeshore-labs/computer-react (packages/react):

http.Handle("/computer/terminal", computer.TerminalHandler(func(r *http.Request) (*computer.Computer, string, error) {
    user, ok := signedIn(r) // yours
    if !ok {
        return nil, "", fs.ErrPermission
    }
    return computers.For(user), "/home/" + user, nil // yours, which you close
}))
// package.json, installed with pnpm, which installs a folder of a git repository (npm does not):
// "@lakeshore-labs/computer-react": "github:Lakeshore-Labs/computer#<commit>&path:/packages/react"
import { Terminal } from "@lakeshore-labs/computer-react"
import "@lakeshore-labs/computer-react/terminal.css" // xterm.js's styles; or @import it in your CSS

<Terminal url="/computer/terminal" onCommandEnd={(code) => refreshFiles()} />

The package is TypeScript source, which your bundler compiles and your tsc checks: React 19 and its types are yours. Importing the CSS from code needs your bundler's types for it, such as Vite's vite/client in compilerOptions.types (TypeScript 6 otherwise reports TS2882); an @import in your CSS needs none. The terminal fills its parent, follows a dark class on <html>, and offers to reconnect when the connection closes. A command's end reaches onCommandEnd as OSC 133's D mark, which the prompt writes after each command. Its tests run on Node 22.18 or later, which runs TypeScript.

Mounts

A mount is a directory of the computer. The shell and every program are given the same one, so a file one writes another reads. It is a host directory, or anything that implements afero's filesystem interface: memory, a database, an object store.

computer.Mount{Guest: "/home/user", Host: dir}                     // a host directory
computer.Mount{Guest: "/scratch", FS: afero.NewMemMapFs()}         // kept in memory
computer.Mount{Guest: "/reference", Host: docs, ReadOnly: true}

A mount may be inside another: /home/user/files in /home/user. Its folder must already be there in the outer mount, as a mount point is. A path belongs to the nearest mount around it, so a read-only mount inside a writable one stays read-only.

A host directory is opened with files.Dir, which goes through Go's os.Root and cannot be left by .. or by a symbolic link. A filesystem of your own decides for itself what a name may reach.

Tools as commands and as Python

A server named wiki with a tool read_wiki_structure that takes repoName is:

wiki --help                                          # the server's tools
wiki read-wiki-structure --help                      # one tool's arguments
wiki read-wiki-structure --repo-name wazero/wazero
wiki read-wiki-structure --json '{"repoName": "wazero/wazero"}'
from tools import wiki
help(wiki.read_wiki_structure)
wiki.read_wiki_structure(repo_name="wazero/wazero")

A command prints a text result as it is and anything else as JSON, ready for jq. The Python module is the name as Python spells it: a server named my-wiki is the command my-wiki and the module my_wiki.

A server given without a name, as a bare URL, has its tools grouped by the part of their name before the first underscore: a tool notes_addNote is notes add-note. This suits one server that fronts several applications.

More commands

The extra package holds commands for everyday data and document work. cmd/computer includes them; the library does not, so an embedder passes extra.Commands() in Config.Commands. Each command reads and writes files only inside the mounts, and NAME --help lists its options.

pdftotext -f 1 -l 3 report.pdf -           # a subset of poppler's: text of pages 1 to 3 on standard output
pdftoppm -png -r 100 report.pdf page       # writes page-1.png, page-2.png, ... (also -jpeg, -f, -l)

What it is made of

Part What it does
gbash, our fork of ewhauser/gbash The shell and its commands, in Go, with jq, yq, awk, sqlite3, html-to-markdown
wazero Runs CPython as WebAssembly
MCP Go SDK Talks to the MCP servers
wasm/ Runs a WASI program like a command: memory cap, deadline, and directories that are afero filesystems
files/ A host directory as an afero filesystem that cannot be left
extra/ pdftotext and pdftoppm, a subset of poppler's, PDFium as WebAssembly; images and charts are Python's (Pillow, matplotlib)
tools/ Turns MCP tools into commands and a Python package
computer.go Assembles the above
cmd/computer The command-line program and the MCP server mode

Python

python3 is wasi-python 0.1.6: CPython 3.15 for WASI with numpy, pandas, scipy, scikit-learn, statsmodels, matplotlib, Pillow, lxml, python-docx, python-pptx and about forty more packages. The module embeds it and unpacks it once into the user's cache directory:

python, err := computer.EmbeddedPython(ctx, wasm.Program{MaxRuns: 8, CacheDir: cacheDir})

The first compile takes about 30 seconds, then under a second from CacheDir; it runs in the background, and only the first python3 waits. Every python3 starts from one image of the interpreter with numpy, pandas and matplotlib already imported, made once (about 4 to 8 seconds) and kept in CacheDir; each run is still its own interpreter, with its own memory, arguments, environment and files, and random and numpy.random seeded afresh. Its string hashes are not randomized: every run has the image's hash seed. See python/README.md.

Serve the computer over HTTP

WebHandler serves files, directory indexes and listings from a folder of the computer. /hello/app.py serves the Python source. /hello/app:app/cart sends /cart to the WSGI callable app in that file. Symlinks follow the computer's mount rules.

web := computer.WebHandler(func(r *http.Request) (*computer.Computer, string, error) {
    return c, "/home/user", nil // return fs.ErrPermission to refuse the request
})
mux.Handle("/computer/", http.StripPrefix("/computer", web))

The host handles sign-in, limits and timeouts, and removes any header the app should not see, such as its own credential or cookie. Each app request runs in a fresh Python interpreter. The embedded release starts with Flask imported. Use files or SQLite for state shared between requests. Application stderr goes to the host's stderr by default. Pass computer.ErrorLog to choose a writer per request.

To try it locally, run serve [-b address] [-d folder] [port]. It defaults to the computer's working directory at 127.0.0.1:8000.

mkdir -p work/hello
cat > work/hello/app.py <<'PY'
from flask import Flask
app = Flask(__name__)

@app.get("/")
def index():
    return "hello from the computer"
PY
./computer -mount ./work:/home/user serve    # http://127.0.0.1:8000/ lists the folder, /hello/app:app/ is the app

The boundary

  • Files. The shell and programs see only the mounted folders. Programs reach them through Go's os.Root. Neither can create a symbolic link. The shell may write only inside writable mounts.
  • Network. None, unless the embedder passes gbash's network options, which allow curl to listed URL prefixes.
  • Python and SQLite run as WebAssembly with their own memory. Python has a memory cap for each run, and a limit on how many run at once (-python-runs, 8 by default), and stops at the request's deadline. The shell's sqlite3 also runs as WebAssembly, and we set no memory cap on it.
  • The shell and its Go commands run in the host process. gbash limits them, but it does not claim to be a hardened sandbox. Put the process in a container with CPU and memory limits if runaway scripts matter.
  • MCP tool names and descriptions are treated as untrusted text when commands and Python are generated.

Known limits

  • wazero is replaced with our fork of wazero main, which stops a run at its deadline at almost no cost (wazero#2533, not yet merged there) and does not copy the stack at every try_table. Go ignores a replace in a dependency, so a program that imports this module repeats the line in its own go.mod; without it Python is three to four times slower.
  • Python has no threads, processes, sockets, ctypes or mmap, and numpy's default integer is 32-bit.
  • wasi-python needs wazero's experimental exception handling: wazero is pinned to a main commit with the fix for wazero#2503, and wazero#2522, a use-after-free in that support, is open.
  • A shell command reads a file of at most 256 MiB, and a script runs at most 1,000,000 commands and as many loop iterations; a command's captured output is cut at gbash's default of 1 MiB. A larger file has to be handled in Python. An embedder changes these with gbash.WithLimitOverrides in Config.Options.
  • Developed on macOS; the tests run on Linux in CI.

Tests

go test .

The tests use the embedded Python, unless PYTHON_DIR names an unpacked release.

License

Apache License 2.0. See LICENSE.

Documentation

Overview

Package computer is a sandboxed computer for an agent: a shell (gbash) over mounted directories, with the tools of an MCP server as commands and as a Python package, jq and sqlite3, and python3 running as WebAssembly. Nothing in it reaches the network or the host, except through those tools and mounts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TerminalHandler

func TerminalHandler(get func(*http.Request) (*Computer, string, error), opts ...TerminalOption) http.Handler

TerminalHandler serves a computer's Prompt to a terminal in a browser, over a WebSocket. get is the host's: it returns the requester's computer and the working directory to start in, after the host's own checks of who is asking; an error that is fs.ErrPermission refuses the request with 403, and another with 500, which is logged and not told to the client. The computer stays the host's, to close. A request that is not a WebSocket upgrade, or whose page the origin rule refuses (the request's own origin alone, unless CheckOrigin says otherwise), is refused before get is called.

Binary messages carry what is typed in, and the terminal's output out. A text message {"cols": 80, "rows": 24} is the terminal's size. Closing the socket ends the prompt and the command that is running, as does a client that answers no ping for a minute or takes more than ten seconds to take a message; the prompt's end, at exit or Ctrl-D, closes the socket.

func WebHandler

func WebHandler(get func(*http.Request) (*Computer, string, error), errorLog ...ErrorLog) http.Handler

WebHandler serves a folder of a computer as python3 -m http.server serves one: the request's path is a path under the folder, a file is sent as it is, a Python file's source too, and a folder as its index.html or as a list of what it holds (http.FileServer).

A Python web application is asked for by its name in the path, written as gunicorn and uvicorn write one, module:callable, where the module's file is: /shop/app:app/cart is the object app of shop/app.py, asked for /cart, and /shop/app.py is that file. So nothing is declared: a file is reached by its name, and an application by its own. The application is a WSGI one (PEP 3333), served as a CGI script is (RFC 3875): each request is a python3 of its own, in the module's folder, so requests run side by side and nothing is kept in memory between them. A request that ends stops its python3, and an application that fails once its answer has begun ends the answer short.

get is the host's, as TerminalHandler's is: it returns the requester's computer and the folder, after the host's own checks of who is asking; a folder that is not absolute is under the computer's WorkDir. An error that is fs.ErrPermission refuses the request with 403, and another with 500, which is logged and not told to the client. The computer stays the host's, to close. The handler may be mounted under http.StripPrefix.

Policy is the host's too: how large a request may be (http.MaxBytesHandler; a request to an application is read whole before the application runs), how long it may take (a deadline on the request's context), and which of the request's headers an application sees: every one reaches it, a credential or a cookie too, unless the host removes it first. An application's error output is the host's own, unless an ErrorLog says where.

Types

type Computer

type Computer struct {
	// contains filtered or unexported fields
}

A Computer is one agent's computer. Its methods are safe for concurrent use.

func New

func New(cfg Config) (_ *Computer, err error)

New makes a computer. Close it to free what it holds on the host.

func (*Computer) About

func (c *Computer) About(toolCommands, toolModules []string) string

About is what an agent is told about this computer, given the commands that call tools and their modules in Python, as ToolCommands and ToolModules name them.

func (*Computer) Close

func (c *Computer) Close() error

Close removes what the computer keeps on the host. The caller's mounts are the caller's and stay.

func (*Computer) Complete

func (c *Computer) Complete(ctx context.Context, cwd, before string) []string

Complete is what could complete the last word of before, a line typed in the shell at cwd: a command when it is the first word, a tool or one of its arguments after a command that calls tools, and otherwise a file. Only such a command is run, to list its tools; completing a line runs nothing else of it.

func (*Computer) Describe

func (c *Computer) Describe(ctx context.Context) (string, error)

Describe is what a model is told about this computer, with the commands that call tools as they are now.

func (*Computer) Environment

func (c *Computer) Environment() *Environment

Environment is the computer as an Environment. Every method may be called from any goroutine.

func (*Computer) Exec

Exec runs a script or a command in the computer's shell, with the tools as they are now. A request with no Env starts where the last one ended: gbash keeps files between requests, and Exec carries the working directory and the exported variables.

func (*Computer) MCPServer

func (c *Computer) MCPServer(ctx context.Context, limit time.Duration) (*mcp.Server, error)

MCPServer is the computer as an MCP server for an agent, with the tools bash, read, edit and write. The caller connects it: server.Run(ctx, &mcp.StdioTransport{}) for an agent that starts the computer as a program, or server.Connect with one end of mcp.NewInMemoryTransports for an agent in this process. limit is how long a bash call may run when the agent sets no shorter time. The file tools and their wording are gbash's codingtools' read, edit and write.

A computer is one agent's: every server made from it shares the one shell, with its working directory and variables. The file tools take a relative path from the computer's WorkDir, wherever the shell has since moved. The bash tool describes the commands that call tools as they are when MCPServer is called.

func (*Computer) Mounts

func (c *Computer) Mounts() []Mount

Mounts is every directory the computer mounts, the caller's and its own.

func (*Computer) Options

func (c *Computer) Options(ctx context.Context) ([]gbash.Option, error)

Options is the computer as gbash options, with the tools as they are now, for gbash's own front ends: its command-line program, its server and its tool for a model.

func (*Computer) Prompt

func (c *Computer) Prompt(ctx context.Context, term io.ReadWriter, workDir string, interrupt <-chan struct{}, size <-chan [2]int) error

Prompt is the computer's shell for a person at a terminal: a line editor with history and Tab completion, which gbash's own interactive mode does not have. Each line is run in the computer; the working directory and exported variables carry from one to the next, and are this prompt's own, as a shell's are: two prompts on one computer do not see each other's, and Exec does not see theirs. It returns at the end of term's input, at Ctrl-D on an empty line, at exit, or when ctx ends, and ends the command that is running.

term is a terminal in raw mode, or what stands for one, such as a WebSocket to a terminal in a browser: Prompt reads keystrokes from it and writes output for a terminal to it, a newline as "\r\n". While a command runs, what is typed is echoed and given to the command a line at a time, as a terminal's line discipline does, and Ctrl-C ends the command and its read of the terminal. Ctrl-C at the prompt drops the line. A value on interrupt ends the running command as Ctrl-C does, and a value on size, columns and rows, is the terminal's new size; either may be nil. Prompt reads term from one goroutine until it returns, and that read may outlast it: the caller closes term, or stops giving it input, to end the read.

After a command ends, Prompt writes "\x1b]133;D;code\x07", the mark of shell integration in terminals (OSC 133) that a command has ended with its exit code: 130 for one interrupted.

func (*Computer) Session

func (c *Computer) Session(ctx context.Context) (*gbash.Session, error)

Session is the computer's shell session, for its filesystem and for interactive use. The tools are listed on every call: when they have changed, the commands and the Python package are made again and the session is a new one over the same files.

func (*Computer) ToolCommands

func (c *Computer) ToolCommands() []string

ToolCommands are the commands that call tools, as the shell last built names them.

func (*Computer) ToolModules

func (c *Computer) ToolModules() []string

ToolModules are the modules of the Python package tools, one per command of ToolCommands, in its order.

type Config

type Config struct {
	Mounts   []Mount
	WorkDir  string             // where a command starts; a mount, or a directory in one
	User     string             // whose computer it is: $USER, $LOGNAME, $HOME as /home/<user>, and what whoami, id and logname name; gbash's own default, and $HOME WorkDir, when empty
	Hostname string             // the computer's name: what hostname and uname -n print, and $HOSTNAME; gbash's own default when empty
	Group    string             // the user's group: $GROUP, and what id and a file's listing name; gbash's own default when empty
	Commands []commands.Command // commands beyond the shell's own
	Tools    []tools.Source     // the MCP servers whose tools become commands and the Python package `tools`
	Python   *Python            // python3; nil for none
	// Options are further gbash options, applied last: gbash.WithHTTPAccess or WithNetwork for curl, which the
	// computer otherwise lacks, WithLimitOverrides, WithTracing, WithPolicy.
	Options []gbash.Option
}

Config is what one computer is made of. Only Mounts is needed for a working shell.

type Environment

type Environment struct {
	// contains filtered or unexported fields
}

An Environment is the computer as the place an agent harness's own tools act: shell commands, and files, under the rules the shell's commands are held to. Its methods use only the standard library's types, so a harness can declare the interface it needs and be given this without either importing the other.

A name is an absolute path in the computer. An error is a *fs.PathError naming that path and never the host's, and errors.Is tells fs.ErrNotExist, fs.ErrPermission (also a write the rules refuse), fs.ErrExist, fs.ErrInvalid (also a file past the size limit), syscall.ENOTDIR, syscall.EISDIR and syscall.ENOTEMPTY apart. Which of them a misuse gets is the mount's to say: a host directory answers as a file system does, and a mount that is another afero.Fs as that one does: afero's memory filesystem allows a file made under a file, which turns that file into a directory and loses what it held.

func (*Environment) List

func (e *Environment) List(ctx context.Context, name string) ([]fs.FileInfo, error)

List is a directory's entries in the order of their names.

func (*Environment) Mkdir

func (e *Environment) Mkdir(ctx context.Context, name string, parents bool) error

Mkdir makes a directory, and with parents every directory above it that is missing; with parents, one that is there already is no error.

func (*Environment) Read

func (e *Environment) Read(ctx context.Context, name string, offset, length int64) ([]byte, error)

Read reads length bytes of a file from offset, or as many as it has; the rest of it when length is negative.

func (*Environment) Remove

func (e *Environment) Remove(ctx context.Context, name string, recursive bool) error

Remove removes a file or an empty directory, or with recursive a directory and everything in it. Nothing there to remove is fs.ErrNotExist.

func (*Environment) Rename

func (e *Environment) Rename(ctx context.Context, from, to string) error

Rename moves a file or a directory.

func (*Environment) Run

func (e *Environment) Run(ctx context.Context, script, dir string, env map[string]string, replaceEnv bool, stdout, stderr io.Writer) (int, error)

Run runs script in the computer's shell with dir as its working directory, and returns its exit code. env is added to the shell's environment, or is the whole of it when replaceEnv is set. Each Run has a shell of its own over the computer's files: nothing is carried from one to the next, and one neither waits for another nor for the computer's own Exec. Output is written to stdout and stderr while the command runs, and a pipeline's commands may write at the same time. When ctx ends the command is stopped and ctx's error returned. A command that ran and failed, or that the shell does not have (127), is an exit code and no error.

func (*Environment) Stat

func (e *Environment) Stat(ctx context.Context, name string, follow bool) (fs.FileInfo, error)

Stat describes a file; a symbolic link itself when follow is false.

func (*Environment) Truncate

func (e *Environment) Truncate(ctx context.Context, name string, size int64) error

Truncate makes the file size bytes long, cutting its end off or adding zero bytes to it.

func (*Environment) Write

func (e *Environment) Write(ctx context.Context, name string, content []byte, appending bool) error

Write writes the file anew, creating it, or adds to its end when appending.

type ErrorLog

type ErrorLog func(*http.Request) io.Writer

An ErrorLog is where the error output of the application a request asks goes, a failure's traceback among it, such as a file of the computer its author reads; os.Stderr for a request it returns nil for. The writer is the host's: it is written to while the request runs, by requests side by side, and is not closed.

type Mount

type Mount = wasm.Dir

A Mount is a directory the shell and every program see at the path Guest: the filesystem FS, which can be anything that implements afero.Fs, or, when FS is nil, the host directory Host (see files.Dir).

type Python

type Python struct {
	// contains filtered or unexported fields
}

Python is a wasi-python, compiled once and shared by every computer of the process.

func EmbeddedPython

func EmbeddedPython(ctx context.Context, p wasm.Program) (*Python, error)

EmbeddedPython compiles the wasi-python release this module carries: CPython with numpy, pandas, scipy, scikit-learn, statsmodels, matplotlib, Pillow, lxml, python-docx, python-pptx and more, and Flask. On first use it unpacks the release, about 270 MB, into computer/python-<checksum> in the user's cache directory (os.UserCacheDir), and later processes reuse it; a host must not mount that directory. Each call compiles the program again, so a host calls it once and shares the Python, as with LoadPython.

func LoadPython

func LoadPython(ctx context.Context, dir string, p wasm.Program) (*Python, error)

LoadPython reads the wasi-python release unpacked in dir, laid out as EmbeddedPython unpacks it: python.wasm, lib/python315.zip, mpl-data/, matplotlib's data, and, when it has more packages than the zip's, lib/site-packages/, and starts compiling it; the first python3 waits for the compile, and fails with its error. p's Binary is read from the file, its host call is answered by the computer's tools, and a zero MemoryPages is 8192 (512 MiB); its other fields are the caller's.

type TerminalOption

type TerminalOption func(*terminalOptions)

A TerminalOption changes how TerminalHandler serves.

func CheckOrigin

func CheckOrigin(check func(*http.Request) bool) TerminalOption

CheckOrigin is the rule for which pages may open the terminal, for a host whose pages are on another origin than its own, such as a development server's, or behind a proxy that changes the Host header. The rule is the host's: the terminal is the person a cookie names, which a page of any site may send. Without this option a page of the request's own origin alone may, as with CheckOrigin(nil).

Directories

Path Synopsis
cmd
computer command
Command computer runs a sandboxed computer from the command line.
Command computer runs a sandboxed computer from the command line.
Package extra holds the PDF commands the shell lacks, pdftotext and pdftoppm.
Package extra holds the PDF commands the shell lacks, pdftotext and pdftoppm.
Package files has the filesystems a computer can be given.
Package files has the filesystems a computer can be given.
Package tools turns the tools of an MCP server into what a shell and a script can use: a command per group of tools, with a subcommand per tool, and a Python package with a module per group and a function per tool.
Package tools turns the tools of an MCP server into what a shell and a script can use: a command per group of tools, with a subcommand per tool, and a Python package with a module per group and a function per tool.
Package wasm runs a WebAssembly program built for WASI the way a command runs: with arguments, an environment, standard streams and directories, to an exit code.
Package wasm runs a WebAssembly program built for WASI the way a command runs: with arguments, an environment, standard streams and directories, to an exit code.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL