devagent

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2026 License: BSD-3-Clause Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func Start(nc *nats.Conn, vmID, workDir string, log *slog.Logger) (*Agent, error)

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.

func (*Agent) Close

func (a *Agent) Close()

Close stops the open subscription + cancels every live session.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL