SwayOS/Developer Docs
v0.1.0
Browse documentationv0.1.0+

SwayOS / Docs

v0.1.0

SwayOS usage and development guide

Install the client, connect your first device, and integrate with SwayOS through the CLI or SDK. These docs prioritize actionable steps, commands, and troubleshooting paths.

Docs version

v0.1.0

Clients

Windows · macOS · Android

Developer tools

CLI · JavaScript SDK

Core services

GMeta · XAgent

01

Quick start

Install SwayOS

Create and verify an account first, then choose the package matching your operating system and CPU architecture. Protected packages require you to sign in.

  1. 1 / ACCOUNT

    Create an account

    Register with an email you can access and complete email verification.

    Register →
  2. 2 / PACKAGE

    Choose a package

    Confirm the OS, architecture, and version. Prefer the latest stable desktop build.

    View downloads →
  3. 3 / VERIFY

    Launch and sign in

    Open the client and sign in with the same account. Available services load on first launch.

Before installing

On macOS, distinguish Apple Silicon from Intel. Android requires permission for the browser or file manager to install an external APK. The Linux desktop installer is temporarily unavailable.

First run

Complete first-time setup

Confirm your account, devices, and data path in this order. Applications and agents will then have a clear place to run.

01

Confirm the login environment

Use public sign-in for your portal account. For a self-hosted node, enter its address and use the node account.

02

Check system status

Open System Status and verify GMeta is reachable. Device-side operations also require XAgent to be online.

03

Add an execution device

Select Add device in Device Management, then confirm that its status becomes online.

04

Prepare a data source

Add local or object storage under Data Sources. Test the connection before uploading or importing files.

Fundamentals

Account and authentication

The portal account controls downloads and public services; a node account controls resources in a SwayOS environment. Credentials may be issued by different services. Never commit tokens to source control.

Browser / client

  • ✓Only enter passwords on the official portal or a trusted node.
  • ✓Sign in again when a session expires instead of retrying failed requests.

CLI / automation

  • ✓The CLI stores its login token in the user's configuration directory.
  • ✓Inject SWAY_AUTH_TOKEN through secret variables in CI.

Core workflow

Connect and manage devices

GMeta holds control-plane data such as devices, accounts, and schedules. XAgent runs on the device and performs file, runtime, and system operations. A listed device is not necessarily online.

01 / REGISTER

Add the device and record its generated device ID.

02 / ONLINE

Confirm heartbeat, XAgent address, and last-seen time.

03 / OPERATE

Then run file, terminal, container, or application operations.

Agents

From marketplace to runtime

Review an agent's purpose, author, and version here. To install it, open your Sway cluster and use the App Marketplace inside the cluster. Agents that execute tasks also need an online device and an available runtime.

  1. 1

    Review

    Check description, version, permissions, and dependencies.

  2. 2

    Install in cluster

    Open your Sway cluster and install from its App Marketplace.

  3. 3

    Schedule

    Bind a device and runtime, then monitor status and logs.

Browse the agent marketplace→

Developer tools

Use the Sway CLI

The CLI is suited to diagnostics, batch queries, and automation. The binary in this repository is named sway-cli and can be installed from source.

Install from sourcebash
git -C app/sway-sdk submodule update --init sway-cli
cd app/sway-sdk/sway-cli
cargo install --path . --locked
sway-cli --help
Initialize, sign in, and check healthbash
sway-cli config init
sway-cli config set gmeta_url https://<your-gmeta-host>
sway-cli auth login --username <name> --password '<password>'
sway-cli health --detailed
Query examplesbash
# List online devices as JSON
sway-cli device list --status online --format json

# Inspect the current local configuration
sway-cli config show --format human

Tip: a password argument can be recorded in shell history. On shared machines, use a temporary session and run sway-cli auth logout when finished.

Application integration

JavaScript / TypeScript SDK

@sway/sdk exposes device, user, application, data source, task, and cluster clients through one entry point. Inject service URLs and tokens from the deployment environment.

npm install @sway/sdkTypeScript
import { JsSwayClient } from '@sway/sdk';

const client = JsSwayClient.new({
  gmeta_url: 'https://<your-gmeta-host>',
  auth_token: process.env.SWAY_AUTH_TOKEN,
  timeout_ms: 30_000,
});

const health = await client.healthCheck();
const devices = await client.device().listDevices();

console.log(health.status, devices.items);

Production integration checklist

  • ✓ Set request timeouts and bounded retries
  • ✓ Stop requests on 401 and refresh authentication
  • ✓ Never print tokens in logs
  • ✓ Run a health check during startup

Configuration reference

Common environment variables

Automation can override local configuration with environment variables. Secret values should come from CI/CD secret storage, not example .env files or the repository.

VariablePurposeExample
SWAY_SERVER_URLGMeta service endpointhttps://gmeta.example.com
SWAY_AUTH_TOKENNon-interactive authentication token${{ secrets.SWAY_TOKEN }}
SWAY_OUTPUT_FORMATDefault CLI output formatjson / yaml / human

Troubleshooting

Common issues

Returned to sign-in immediately+

Confirm the system clock, clear the expired session, and sign in again. For node sign-in, make sure the node URL is not the portal URL.

Health check cannot connect+

Run config show to inspect the GMeta URL. Reach the health endpoint from the same network, then check proxy, certificates, and firewall.

Device exists but operations fail+

Confirm the device is online, XAgent is healthy, and the device ID matches. Check the latest heartbeat before retrying.

401 or insufficient permissions+

Re-authenticate on 401. For 403 or insufficient permissions, verify the account role, resource owner, and node policy.