Modular TypeScript infrastructure with sandboxed execution and extensible hook system.
npm install
npm run buildsrc/
βββ core/ # Command dispatcher with promise queue
βββ lib/ # Sandboxed execution modules
βββ api/ # CLI entry point
βββ security/ # Filtering middleware (The Shield)
βββ types/ # Core type definitions
CommandDispatcher manages a promise queue and maps action types to registered modules. Supports async execution with configurable concurrency limits.
SandboxedExecutor wraps child_process.spawn with:
- 5-second execution timeout
- Sandbox-restricted working directory
- Output buffer limits
- Allowed command whitelist
Shield middleware implements:
- Blocklist patterns for dangerous commands (rm, chmod, mv to /, etc.)
- Path traversal prevention
- Sandbox boundary enforcement
- Violation audit logging
TerminalAPI provides CLI interface:
- JSON input via stdin
- Structured JSON output:
{ status, data, logs, executionTime } - Debug and pretty-print modes
Third-party extensions via the hook system:
import type { Hook, HookContext, HookPhase } from 'archit3ct3';
const myHook: Hook = {
name: 'my-plugin',
phase: 'pre-execute',
priority: 50,
execute: async (context: HookContext) => {
// Transform payload or add metadata
return context;
}
};
dispatcher.registerHook(myHook);Hook phases: pre-shield β post-shield β pre-execute β post-execute
echo '{"action":"sh.exec","params":{"command":"ls","args":["-la"]}}' | npm startOutput:
{
"status": "success",
"data": { "stdout": "...", "stderr": "" },
"logs": ["[EXEC] ls -la", "[EXIT] code=0"],
"executionTime": 45
}