fusabi-stdlib-ext
Extended standard library modules for the Fusabi scripting language ecosystem.
Documentation: See versioned docs for detailed API reference and guides.
Latest Release: v0.1.0 | Changelog | Release Process
Overview
fusabi-stdlib-ext provides optional, safety-first standard library modules for Fusabi host applications. All modules implement capability-based security with configurable allowlists and resource limits.
Features
Module Features
process- Process execution (spawn, exec)fs- Filesystem operations (read, write, list, mkdir, remove)path- Path manipulation (join, dirname, basename, normalize)env- Environment variable accessformat- String formatting and JSON encode/decodenet- HTTP client (GET, POST)time- Time and duration utilitiesmetrics- Counter, gauge, and histogram metrics
Extended Modules (vNEXT)
terminal- Terminal I/O: key events, selection, clipboard, palette helpersgpu- GPU metrics: NVML/DGX metrics shims for observabilityfs_stream- File streaming: tail files with backpressurenet_http- Enhanced HTTP: lightweight client with advanced timeout controls
Pack Features
terminal-ui- Terminal UI utilities (ANSI, prompts)observability- Logging, tracing, metrics integrationk8s- Kubernetes/cloud helpersmcp- MCP/AI tool integration
Installation
Add to your Cargo.toml:
[]
= { = "0.1", = ["fs", "net", "time"] }
Usage
Basic Setup
use Arc;
use ;
use ;
use Engine;
// Create safety configuration
let safety = new;
// Create stdlib registry
let registry = new;
// Register with engine
let mut engine = new;
registry.register_all;
Filesystem Operations
use fs;
use ;
// Configure allowed paths
let safety = new;
// Read a file
let content = read_file?;
// Write a file
write_file?;
// List directory
let entries = list_dir?;
HTTP Requests
use net;
use ;
use Duration;
// Configure allowed hosts
let safety = new;
// GET request
let response = http_get?;
// POST request
let response = http_post?;
Process Execution
use process;
use ;
// Configure allowed commands
let safety = new;
// Execute command and wait for result
let result = exec?;
// Spawn background process
let handle = spawn?;
Metrics
use metrics;
// Increment a counter
counter_inc?;
counter_inc?;
// Set a gauge
gauge_set?;
// Observe histogram value
histogram_observe?;
Time Utilities
use time;
// Get current timestamp
let now = now?; // Unix seconds
let now_ms = now_millis?; // Unix milliseconds
// Sleep
sleep?; // Sleep 1 second
// Format timestamp
let formatted = format_time?;
String Formatting
use format;
// Sprintf-style formatting
let result = sprintf?;
// Template substitution
let mut values = new;
values.insert;
let result = template?;
// JSON encode/decode
let json = json_encode?;
Safety Model
All modules follow a default-deny security model:
Path Allowlist
use PathAllowlist;
// Deny all paths (default)
let paths = none;
// Allow specific paths
let paths = none
.allow
.allow;
// Allow all paths (use with caution)
let paths = all;
Host Allowlist
use HostAllowlist;
// Deny all hosts (default)
let hosts = none;
// Allow specific hosts
let hosts = none
.allow
.allow;
// Allow all hosts (use with caution)
let hosts = all;
Timeouts
use SafetyConfig;
use Duration;
let safety = new
.with_default_timeout
.with_max_timeout;
Documentation
- Versioned API Docs - Complete API reference for next version
- Documentation Structure - How documentation is organized
- Release Process - Release guidelines and procedures
- Examples - Practical code examples
Contributing
See CODEOWNERS for code ownership and review requirements.
All contributions must:
- Pass CI checks (tests, clippy, formatting)
- Include tests for new functionality
- Update documentation
- Follow the safety-first design principles
License
MIT OR Apache-2.0