Skip to main content

@retr0h/nats

v2026.04.21.1

General-purpose NATS transport for swamp — exec, upload, wait for agent connection. Pairs with swamp-nats-agent (https://github.com/retr0h/swamp-nats-agent).

Repository

https://github.com/retr0h/swamp-nats

Labels

natsjetstreamtransportmessagingremote-execution

Contents

Quality score

How well-documented and verifiable this extension is.

Not yet scored.

A score will be generated the next time this extension is published. The owner can also trigger scoring manually.

Install

$ swamp extension pull @retr0h/nats

Release Notes

@adam/cfgmgmt drop-in compat: exports match adam's _lib/ssh.ts byte-for-byte (exec, execSudo, writeFile, writeFileAs, scpFile, scpFileAs, shellEscape, closeAll). nats_host globalArgs mirror cfgmgmt's GlobalArgsSchema (nodeHost, nodeUser, nodePort, nodeIdentityFile, become, becomeUser, becomePassword). Sudo moves from method args to globalArgs.

Security Notice

This extension includes AI agent skills that can modify AI assistant behavior. Review the skill files before installing.

@retr0h/nats/hostv2026.04.21.1nats_host.ts

Global Arguments

ArgumentTypeDescription
nodeHoststringTarget hostname (maps to NATS subject suffix)
nodeUserstringAgent-side user (SSH-era field, advisory)
nodePortnumberSSH port (ignored by NATS transport)
nodeIdentityFile?stringSSH private key path (ignored by NATS transport)
becomebooleanRun commands with sudo on the agent
becomeUserstringUser to become when sudo is true
becomePassword?stringPassword for sudo -S (piped via stdin)
natsUrlstringNATS server URL (nats://host:port)
natsSubjectPrefixstringSubject prefix for multi-tenant namespace isolation
timeoutMsnumberPer-request timeout (ms)
natsUser?stringNATS user/pass auth — username
natsPass?stringNATS user/pass auth — password
natsToken?stringNATS static token auth
natsCredsPath?stringPath to NATS creds file (user JWT + nkey, recommended)
natsNKeySeed?stringNATS nkey seed (alternative to creds file)
natsTlsCaFile?stringmTLS — CA certificate file
natsTlsCertFile?stringmTLS — client certificate file
natsTlsKeyFile?stringmTLS — client key file
execRun a command on the remote host via swamp-nats-agent. Returns stdout/stderr/exitCode without throwing on non-zero exit.
ArgumentTypeDescription
commandstringCommand to execute
timeoutnumberEnforced timeout in seconds (agent cancels via AbortSignal)
stdin?stringData to pipe to the command's stdin
uploadWrite file content to a remote path via swamp-nats-agent. Supports UTF-8 and base64 encoded content; atomic write under sudo via install(1).
ArgumentTypeDescription
deststringRemote destination path
contentstringFile content — UTF-8 string or base64-encoded bytes
contentEncodingenumEncoding of content
mode?stringFile mode (octal, e.g. 0644)
owner?stringFile owner
group?stringFile group
waitForConnectionPoll the swamp-nats-agent on the target host until it replies or timeout elapses.
ArgumentTypeDescription
timeoutnumberTimeout in seconds

Resources

result(infinite)— NATS operation result

nats1 file