@suilway/runtime
v0.1.0
Published
Multi-runtime manager with 24-hour idle timeout for Node.js 22, Python 3.12, Go 1.23, and Rust 1.80
Downloads
37
Maintainers
Readme
@suilway/runtime
A TypeScript Node.js package for managing multiple language runtimes with a configurable idle timeout (default: 24 hours).
Supported Runtimes
| Runtime | Version | |-------------|----------| | Node.js | 22 | | Python | 3.12 | | Go | 1.23 | | Rust | 1.80 |
Features
- Unified API for spawning and managing runtime processes
- 24-hour idle timeout — processes are automatically terminated after 24 hours of inactivity
- Per-runtime launchers with configurable entry points
- Built-in logging and timer utilities
- TypeScript-first with full type definitions
Installation
npm install @suilway/runtimeQuick Start
import { RuntimeManager } from "@suilway/runtime";
const manager = new RuntimeManager();
// Start a Node.js 22 runtime
const rt = await manager.start("node22", { entryPoint: "app.js" });
// Stop it manually (or let the 24-hour idle timer do it)
await manager.stop(rt.id);Idle Timeout
Every runtime is subject to a 24-hour idle timeout. If no activity is detected for 24 hours, the runtime process is gracefully terminated and removed from the manager.
The timeout resets automatically whenever the runtime receives input or produces output.
import { IDLE_TIMEOUT_MS } from "@suilway/runtime/config/defaults";
// IDLE_TIMEOUT_MS === 86_400_000 (24 × 60 × 60 × 1000)Configuration
import { RuntimeManager } from "@suilway/runtime";
const manager = new RuntimeManager({
idleTimeoutMs: 86_400_000, // 24 hours (default)
logLevel: "info",
});API
RuntimeManager
| Method | Description |
|--------|-------------|
| start(type, options) | Spawn a new runtime process |
| stop(id) | Terminate a runtime by ID |
| get(id) | Retrieve a runtime instance |
| list() | List all active runtimes |
| stopAll() | Terminate all active runtimes |
Runtime
| Property | Type | Description |
|----------|------|-------------|
| id | string | Unique runtime identifier |
| type | RuntimeType | Runtime variant |
| status | RuntimeStatus | idle | running | stopped |
| pid | number | OS process ID |
License
MIT
