Documentation
¶
Overview ¶
Package devagent is the in-process mock of weft-microvm-agent we run inside loom-server when no real workspace VM is reachable.
Why : we want the SHELL → NATS → AGENT round-trip to actually work in dev mode (the most common path for a contributor on a Mac), not just compile-and-pray. The dev agent listens on the same NATS subjects the real agent listens on (weft.exec.<vmID>.open + .in) and pumps a /bin/bash pty on the loom-server host — so the user gets a working shell in their browser without QEMU.
The cost : we lose isolation. The user's shell is on the host, not in a sandbox. That's why loom-doctor surfaces a "shell.dev.agent" event so the operator can see this isn't the production path. Real isolation lands when LocalProvisioner.Ensure boots a QEMU + real weft-microvm-agent in the VM.
Pattern : Subscribe(weft.exec.<vmID>.open) → on each open msg, spawn pty + subscribe to that session's in subject + publish to its out subject. Mirrors pkg/execsession exactly so the wire shape is identical to what the real agent would emit.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent is one running dev agent — bound to a single vmID (the sentinel "wl-<sha>" the LocalProvisioner returns). loom-server boots one per identity on first Ensure, keeps them around for the process lifetime.
func Start ¶
Start subscribes to the agent's open subject + returns the live Agent. nc is the loom-server's NATS conn, vmID is the workspace's stable handle, workDir is where bash spawns (typically a per-user dir under the storage root). The agent shuts down when Close() is called or the conn drops.