Metadata-Version: 2.4
Name: manigent-daemon
Version: 0.1.4
Summary: Connects one computer to Manigent so its agents can be seen and controlled from the web
License-Expression: MIT
Project-URL: Homepage, https://manigent.ai
Project-URL: Repository, https://github.com/manigent-ai/manigent-daemon
Project-URL: Issues, https://github.com/manigent-ai/manigent-daemon/issues
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx>=0.27
Requires-Dist: websockets>=12
Requires-Dist: typer>=0.12
Dynamic: license-file

# manigent-daemon

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Connects one computer to [Manigent](https://manigent.ai), so you can see what
is running on it — and start or stop it — from the web instead of a terminal.

## Why this is a separate package

It stays connected when every agent on the machine is dead.

That is the whole feature. An agent's own connection cannot tell you "nothing is
running here", because it is gone in that case — which looks exactly like the
computer being switched off. Those two states need different words and different
remedies, so something on the machine has to keep talking when there is nothing
else left to talk.

It follows that this must not be able to break the way the agents can, which is
why it is its own package with **three dependencies** (`httpx`, `websockets`,
`typer`). It installs in seconds and starts even when the runner's heavier stack
is unusable.

## Install

```bash
uv tool install manigent-daemon     # or: pip install manigent-daemon
```

Then, in the Manigent web app, open **Computers**, press **+** to get a pairing
code, and run:

```bash
manigent computer install --code XXXX-XXXX --user <your-username>
```

(`manigent computer …` is the same program, reached through the runner's CLI.
If the runner is not installed, use `manigent-computer …` directly.)

## What this connection can do

**The fixed list.** The server can ask this computer to do only these things,
and every item is checked twice — once by the server before it will send
anything, and again here before anything runs:

- Start one of your agents
- Stop one of your agents
- Restart one of your agents
- Report which of them are running
- Update the Manigent software on it (manigent and its connection software)

**Your agents.** The agents it runs act as you and can run commands on this
computer.

**The terminal.** On by default: you can open a full shell on this computer, as
you, from its page in Manigent. Turn it off on this machine — only here, never
from the browser:

    manigent computer terminal disable   # ends open sessions within seconds
    manigent computer terminal enable
    manigent computer terminal status

Sessions are hung up when you end them, after 15 minutes idle, after 8 hours,
or when the connection drops. The server records who opened a session and for
how long — never what was typed or printed.

**Never**

- Read or change your agents' environment variables
- Install or change anything else
- Delete an agent — only you can, in the browser
- Reach any other computer or account

Start, stop and restart are performed by shelling the ordinary
`manigent start` / `manigent stop` commands, so they behave exactly as they do
when you type them yourself.

Disconnecting the computer from the web app destroys this machine's key
immediately and for good; reconnecting needs a fresh pairing code.

## Commands

| Command | What it does |
|---------|--------------|
| `manigent computer install --code XXXX-XXXX` | Connect this computer to your account |
| `manigent computer start` | Start the connection in the background |
| `manigent computer stop` | Stop the connection (your agents keep running) |
| `manigent computer status` | Is it connected, and what is running here |
| `manigent computer logs --tail 50` | What the connection has been doing |
| `manigent computer update` | Update Manigent on this computer (manigent + connection software, via uv tool / pipx / pip) |

## Where things live

```
~/.manigent/computer/<your-username>/
  config.json     # this machine's key, for this account (mode 0600)
  computer.pid
  stdout.log      # what the connection did
  stderr.log      # what went wrong
```

One directory per Manigent account. If two people (or two of your own
accounts) use the same computer, each pairs separately and gets its own key,
its own connection and its own logs — neither can disturb the other. Every
command takes `--user <name>`; without it, it acts for the account you are
logged in as.

The two logs are rotated at 2 MB, stay on this machine, and are never uploaded
or shown in the web app. `manigent computer logs` prints the tail of both.

`config.json` holds the only secret that lets Manigent ask this machine to do
anything. It is written readable by you alone, never logged, and never
synchronized anywhere.

## Mirrored source

This repository is a read-only mirror, published from the Manigent monorepo.
Issues and discussion are welcome here; code changes land upstream.

## License

MIT — see [LICENSE](LICENSE).
