Node SDK
The official TypeScript SDK for VibeControls provides programmatic access to agents, vibes, sessions, tunnels, and more.
Install
bun add @vibecontrols/sdk
# or
npm install @vibecontrols/sdk
Environment selection
The SDK endpoint defaults to production. Pass the appropriate endpoint in VibeControlsSDKConfig:
| Environment | Workspace endpoint | Global endpoint |
|---|---|---|
prod (default) | https://graphqlworkspaces.burdenoff.com/workspaces/graphql | https://graphql.burdenoff.com/global/graphql |
alpha | https://alphagraphqlworkspaces.burdenoff.com/workspaces/graphql | https://alphagraphql.burdenoff.com/global/graphql |
local | http://localhost:4003/workspaces/graphql | http://localhost:4000/global/graphql |
Set BURDENOFF_ENV=local|alpha|prod in your shell if your app consumes it to choose endpoints, or pass them explicitly to VibeControlsSDKConfig.
Quick start
import { VibeControlsSDK } from '@vibecontrols/sdk';
const sdk = new VibeControlsSDK({
workspaceEndpoint: 'https://graphqlworkspaces.burdenoff.com/workspaces/graphql',
globalEndpoint: 'https://graphql.burdenoff.com/global/graphql',
});
// Sign in
await sdk.auth.signIn({ username: 'user@example.com', password: 'secret' });
// Fetch workspaces and issue workspace token
const workspaces = await sdk.auth.fetchWorkspaces();
await sdk.auth.issueWorkspaceToken(workspaces[0].id, workspaces[0].organizationId);
// Use the SDK
const vibes = await sdk.vibes.list();
const agents = await sdk.agents.list();
Authentication
Email / password
const auth = await sdk.auth.signIn({ username: 'user@example.com', password: 'secret' });
OAuth2 device code flow
const { userCode, verificationUri, promise } = await sdk.auth.loginWithDeviceCode();
console.log(`Open ${verificationUri} and enter: ${userCode}`);
const tokens = await promise;
OAuth2 authorization code + PKCE
const challenge = sdk.auth.getAuthorizationUrl({
redirectUri: 'http://localhost:8400/callback',
scopes: ['openid', 'profile', 'email', 'offline_access'],
});
// Redirect user to challenge.url, then exchange the code:
const tokens = await sdk.auth.exchangeAuthCode(code, challenge.codeVerifier, challenge.redirectUri);
Client credentials (M2M / app auth)
const result = await sdk.auth.authenticateApp(clientId, clientSecret);
Workspace token
await sdk.auth.issueWorkspaceToken(workspaceId, organizationId);
Modules
| Module | Access | Description |
|---|---|---|
sdk.auth | Auth | Sign in/up, OAuth flows, token management |
sdk.agents | CRUD | Agent lifecycle, health probes, plugins |
sdk.vibes | CRUD | Project/environment management |
sdk.sessions | CRUD | Terminal sessions, start/stop, sharing |
sdk.notes | CRUD | Notes with tagging and search |
sdk.configuration | CRUD | Scoped key-value configuration |
sdk.webhooks | CRUD | Webhook management and testing |
sdk.docs | CRUD | Documentation sites, pages, revisions |
sdk.vibeDecks | CRUD | Command button grids |
sdk.targets | CRUD | SSH/RDP/VNC targets, agent connections |
sdk.audit | Read | Audit log queries, stats, export |
sdk.uiSession | CRUD | UI state persistence |
sdk.tunnels | CRUD | Agent tunnel management |
sdk.aiToolEvents | CRUD | AI tool event tracking |
Configuration
interface VibeControlsSDKConfig {
workspaceEndpoint: string; // Workspace gateway GraphQL endpoint
globalEndpoint: string; // Global gateway GraphQL endpoint
oidcIssuer?: string; // OIDC issuer URL (derived from globalEndpoint if omitted)
clientId?: string; // OAuth2 client ID
clientSecret?: string; // OAuth2 client secret
redirectUri?: string; // Redirect URI for auth code flow
apiKey?: string; // API key authentication
accessToken?: string; // Pre-existing access token
refreshToken?: string; // Pre-existing refresh token
workspaceToken?: string; // Pre-existing workspace token
timeout?: number; // Request timeout in ms (default: 30000)
autoRefresh?: boolean; // Auto-refresh tokens (default: true)
onTokenRefresh?: (tokens: TokenPair) => void | Promise<void>;
}
Error handling
import { VibeControlsError, AuthenticationError, NetworkError } from '@vibecontrols/sdk';
try {
await sdk.auth.signIn({ username: 'invalid', password: 'invalid' });
} catch (error) {
if (error instanceof AuthenticationError) {
console.error('Auth failed:', error.message);
} else if (error instanceof NetworkError) {
console.error('Network error:', error.message);
}
}
Development
git clone https://github.com/algoshred/vibecontrols-sdk-node.git
cd vibecontrols-sdk-node
bun install
bun run dev # Watch mode
bun run build # Production build
bun run test # Run tests
bun run sanity # All checks (format, lint, type-check, test, build)
Shell out to the CLI
For quick scripting, you can also shell out to the vibecontrols CLI:
import {execFile} from "node:child_process";
import {promisify} from "node:util";
const exec = promisify(execFile);
const {stdout} = await exec("vibecontrols", ["vibes", "list", "--json"]);
const vibes = JSON.parse(stdout);
Most CLI commands support --json for structured output.
Source
- Repository:
github.com/algoshred/vibecontrols-sdk-node - Package:
@vibecontrols/sdkon npm