sandbox

package
v0.0.155 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EventsDir added in v0.0.146

func EventsDir(sandboxRoot string) string

EventsDir returns the directory holding Topology B session sockets for a sandbox root parent (KOOL_SANDBOX_ROOT / --root).

Mapping:

  1. Prefer <root>/events when a worst-case sock path fits AF_UNIX limits.
  2. Otherwise map to a short stable dir: /tmp/kse/<16-hex-sha256-of-abs-root>/ so publisher (NotifyEvent) and runner (startEventListener) agree without a broker. Long WorkingDir / TempDir trees on macOS often exceed sun_path.

func Handle

func Handle(args []string) error

Handle is the production entry for kool sandbox.

func NotifyEvent added in v0.0.146

func NotifyEvent(root, eventType, path string, dryRun bool) error

NotifyEvent publishes a JSON event to every *.sock under EventsDir(root). dryRun lists targets without dialing. No socks / all dials fail → warning, exit-style nil error (caller prints warning; process exit 0).

func ReloadRuntimeLoadFiles added in v0.0.146

func ReloadRuntimeLoadFiles(sessionRoot, loadAbsPath string) error

ReloadRuntimeLoadFiles re-unseals loadAbsPath and re-applies only that load's Files into the existing sessionRoot (no env / full rematerialize).

func RunEmbedded

func RunEmbedded(sealed []byte, args []string) int

RunEmbedded decrypts a sealed pack payload, materializes files under a session directory, applies packed env + SANDBOX_ROOT, executes the guest command with cwd at the materialize root, then removes the session directory.

When the pack has HomeLinked set, the runner captures the host real home once, seeds top-level absolute symlinks into the session root, overlays packed files with explode-on-demand for intermediate symlinks, and forces guest HOME to the session root (packed HOME is policed).

Optional --load-devbox ABS (repeatable, StopOnFirstArg) merges additional sealed sandbox binaries (Files later-wins overlay + hard env conflict merge).

args are the sealed binary's argv after the program name (os.Args[1:]). Returns the guest process exit code (or a non-zero code on runner errors).

Types

type PackBlob

type PackBlob struct {
	Version           int               `json:"version"`
	Name              string            `json:"name"`
	CreatedAt         time.Time         `json:"created_at"`
	ExpiresAt         *time.Time        `json:"expires_at,omitempty"`
	Comment           string            `json:"comment,omitempty"`
	HomeLinked        bool              `json:"home_linked,omitempty"`
	RuntimeLoadDevbox []string          `json:"runtime_load_devbox,omitempty"`
	Files             []PackFile        `json:"files"`
	Env               map[string]string `json:"env"`
}

PackBlob is the cleartext payload sealed into a sandbox binary.

type PackFile

type PackFile struct {
	Path    string `json:"path"`
	Mode    uint32 `json:"mode"`
	Content []byte `json:"content"`
}

PackFile is one packed file entry.

type SandboxEvent added in v0.0.146

type SandboxEvent struct {
	V    int    `json:"v"`
	Type string `json:"type"`
	Path string `json:"path"`
	Ts   string `json:"ts"`
}

SandboxEvent is the Topology B wire format written to session unix sockets.

Jump to

Keyboard shortcuts

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