Skip to main content

System

System functions that do not require special permissions (except diskUsage which requires fs.enabled).

Host information

import { sysInfo } from "@luminarys/sdk-as";

const info = sysInfo();
// info.os, info.arch, info.hostname, info.num_cpu

SysInfoResult:

FieldTypeDescription
osstringOperating system: "linux", "windows", "darwin"
archstringCPU architecture: "amd64", "arm64", "riscv64"
hostnamestringMachine hostname
num_cpuintNumber of logical CPUs

Current time

import { timeNow } from "@luminarys/sdk-as";

const t = timeNow();
// t.rfc3339, t.unix, t.unix_nano, t.timezone, t.utc_offset

TimeNowResult:

FieldTypeDescription
unixint64Seconds since Unix epoch
unix_nanoint64Nanoseconds since Unix epoch
rfc3339stringRFC 3339 formatted time, e.g. "2026-03-27T12:00:00+03:00"
timezonestringIANA timezone name, e.g. "Europe/Moscow"
utc_offsetintUTC offset in seconds, e.g. 10800 for +03:00

Disk usage

Requires fs.enabled, path must be within fs.dirs.

import { diskUsage } from "@luminarys/sdk-as";

const du = diskUsage("/data");
// du.total_bytes, du.free_bytes, du.used_bytes, du.used_pct

DiskUsageResult:

FieldTypeDescription
total_bytesint64Total disk space in bytes
free_bytesint64Free disk space in bytes
used_bytesint64Used disk space in bytes
used_pctfloat64Usage percentage (0.0–100.0)

Environment variables

Reads values from the env section of the manifest — not from system environment.

import { getEnv } from "@luminarys/sdk-as";

const apiKey = getEnv("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:

  1. .env file in the working directory (loaded first, does not overwrite existing vars)
  2. .env.local file in the working directory (loaded second, does not overwrite)
  3. System environment variables
  4. ${VAR:-default} fallback if variable is unset or empty

Supported syntax (same as docker-compose):

SyntaxDescription
${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.

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]);

Log levels:

LevelWhen to use
debugDebugging details (hidden by default)
infoNormal operation
warnUnexpected situation, operation continues
errorError, attention required