System
System functions that do not require special permissions (except diskUsage which requires fs.enabled).
Host information
- AssemblyScript
- Go
- Rust
import { sysInfo } from "@luminarys/sdk-as";
const info = sysInfo();
// info.os, info.arch, info.hostname, info.num_cpu
info, err := sdk.SysInfo()
// info.OS, info.Arch, info.Hostname, info.NumCPU
let info = sys_info()?;
// info.os, info.arch, info.hostname, info.num_cpu
SysInfoResult:
| Field | Type | Description |
|---|---|---|
os | string | Operating system: "linux", "windows", "darwin" |
arch | string | CPU architecture: "amd64", "arm64", "riscv64" |
hostname | string | Machine hostname |
num_cpu | int | Number of logical CPUs |
Current time
- AssemblyScript
- Go
- Rust
import { timeNow } from "@luminarys/sdk-as";
const t = timeNow();
// t.rfc3339, t.unix, t.unix_nano, t.timezone, t.utc_offset
t, err := sdk.TimeNow()
// t.RFC3339, t.Unix, t.UnixNano, t.Timezone, t.UTCOffset
let t = time_now()?;
// t.rfc3339, t.unix, t.unix_nano, t.timezone, t.utc_offset
TimeNowResult:
| Field | Type | Description |
|---|---|---|
unix | int64 | Seconds since Unix epoch |
unix_nano | int64 | Nanoseconds since Unix epoch |
rfc3339 | string | RFC 3339 formatted time, e.g. "2026-03-27T12:00:00+03:00" |
timezone | string | IANA timezone name, e.g. "Europe/Moscow" |
utc_offset | int | UTC offset in seconds, e.g. 10800 for +03:00 |
Disk usage
Requires fs.enabled, path must be within fs.dirs.
- AssemblyScript
- Go
- Rust
import { diskUsage } from "@luminarys/sdk-as";
const du = diskUsage("/data");
// du.total_bytes, du.free_bytes, du.used_bytes, du.used_pct
du, err := sdk.DiskUsage("/data")
fmt.Printf("Total: %d MB, Free: %d MB, Used: %.1f%%\n",
du.TotalBytes/1024/1024, du.FreeBytes/1024/1024, du.UsedPct)
let du = disk_usage("/data")?;
println!("Total: {} MB, Free: {} MB, Used: {:.1}%",
du.total_bytes / 1024 / 1024, du.free_bytes / 1024 / 1024, du.used_pct);
DiskUsageResult:
| Field | Type | Description |
|---|---|---|
total_bytes | int64 | Total disk space in bytes |
free_bytes | int64 | Free disk space in bytes |
used_bytes | int64 | Used disk space in bytes |
used_pct | float64 | Usage percentage (0.0–100.0) |
Environment variables
Reads values from the env section of the manifest — not from system environment.
- AssemblyScript
- Go
- Rust
import { getEnv } from "@luminarys/sdk-as";
const apiKey = getEnv("API_KEY");
apiKey := sdk.GetEnv("API_KEY")
let api_key = get_env("API_KEY");
Values in the manifest env section support ${VAR} expansion from the system environment and .env files:
env:
API_KEY: "${API_KEY}" # from system env or .env file
DB_HOST: "postgres.internal" # literal value
TIMEOUT: "${TIMEOUT:-30}" # default if unset
SECRET: "${SECRET:?SECRET is required}" # error if unset
Resolution order:
.envfile in the working directory (loaded first, does not overwrite existing vars).env.localfile in the working directory (loaded second, does not overwrite)- System environment variables
${VAR:-default}fallback if variable is unset or empty
Supported syntax (same as docker-compose):
| Syntax | Description |
|---|---|
${VAR} | Value of VAR, empty if unset |
${VAR:-default} | Value of VAR, or default if unset or empty |
${VAR-default} | Value of VAR, or default if unset (empty counts as set) |
${VAR:?error} | Value of VAR, or fatal error if unset or empty |
${VAR?error} | Value of VAR, or fatal error if unset |
Logging
Requires log.skill_log: true in host config. Logs are automatically tagged with the skill ID.
- AssemblyScript
- Go
- Rust
import { log, logInfo, logError, LogField } from "@luminarys/sdk-as";
// Simple message
logInfo("Processing started");
// With structured fields
const f1 = new LogField(); f1.name = "method"; f1.value = "process";
const f2 = new LogField(); f2.name = "items"; f2.value = "42";
log("info", "Processing request", [f1, f2]);
// Simple message
sdk.LogInfo("Processing started", nil)
// With structured fields
sdk.Log("info", "Processing request", map[string]any{
"method": "process",
"items": 42,
})
// Simple message
log_info("Processing started", &[]);
// With structured fields
log_msg("info", "Processing request", &[("method", "process"), ("items", "42")]);
Log levels:
| Level | When to use |
|---|---|
debug | Debugging details (hidden by default) |
info | Normal operation |
warn | Unexpected situation, operation continues |
error | Error, attention required |