mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-15 19:05:18 +00:00
feat: gigacode (#92)
This commit is contained in:
parent
0a73d1d8e8
commit
a02393436c
40 changed files with 2736 additions and 1327 deletions
51
docs/cli.mdx
51
docs/cli.mdx
|
|
@ -58,7 +58,7 @@ sandbox-agent install-agent claude --reinstall
|
|||
|
||||
## OpenCode (Experimental)
|
||||
|
||||
Start a sandbox-agent server and attach an OpenCode session (uses `opencode attach`):
|
||||
Start (or reuse) a sandbox-agent daemon and attach an OpenCode session (uses `opencode attach`):
|
||||
|
||||
```bash
|
||||
sandbox-agent opencode [OPTIONS]
|
||||
|
|
@ -77,7 +77,54 @@ sandbox-agent opencode [OPTIONS]
|
|||
sandbox-agent opencode --token "$TOKEN"
|
||||
```
|
||||
|
||||
Requires the `opencode` binary to be installed (or set `OPENCODE_BIN` / `--opencode-bin`).
|
||||
The daemon logs to a per-host log file under the sandbox-agent data directory (for example, `~/.local/share/sandbox-agent/daemon/daemon-127-0-0-1-2468.log`).
|
||||
|
||||
Requires the `opencode` binary to be installed (or set `OPENCODE_BIN` / `--opencode-bin`). If it is not found on `PATH`, sandbox-agent installs it automatically.
|
||||
|
||||
---
|
||||
|
||||
## Daemon
|
||||
|
||||
Manage the background daemon. See the [Daemon](/daemon) docs for details on lifecycle and auto-upgrade.
|
||||
|
||||
### Start
|
||||
|
||||
```bash
|
||||
sandbox-agent daemon start [OPTIONS]
|
||||
```
|
||||
|
||||
| Option | Default | Description |
|
||||
|--------|---------|-------------|
|
||||
| `-H, --host <HOST>` | `127.0.0.1` | Host to bind to |
|
||||
| `-p, --port <PORT>` | `2468` | Port to bind to |
|
||||
| `-t, --token <TOKEN>` | - | Authentication token |
|
||||
| `-n, --no-token` | - | Disable authentication |
|
||||
|
||||
```bash
|
||||
sandbox-agent daemon start --no-token
|
||||
```
|
||||
|
||||
### Stop
|
||||
|
||||
```bash
|
||||
sandbox-agent daemon stop [OPTIONS]
|
||||
```
|
||||
|
||||
| Option | Default | Description |
|
||||
|--------|---------|-------------|
|
||||
| `-H, --host <HOST>` | `127.0.0.1` | Host of the daemon |
|
||||
| `-p, --port <PORT>` | `2468` | Port of the daemon |
|
||||
|
||||
### Status
|
||||
|
||||
```bash
|
||||
sandbox-agent daemon status [OPTIONS]
|
||||
```
|
||||
|
||||
| Option | Default | Description |
|
||||
|--------|---------|-------------|
|
||||
| `-H, --host <HOST>` | `127.0.0.1` | Host of the daemon |
|
||||
| `-p, --port <PORT>` | `2468` | Port of the daemon |
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
96
docs/daemon.mdx
Normal file
96
docs/daemon.mdx
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
---
|
||||
title: "Daemon"
|
||||
description: "Background daemon lifecycle, auto-upgrade, and management."
|
||||
icon: "microchip"
|
||||
---
|
||||
|
||||
The sandbox-agent daemon is a background server process that stays running between sessions. Commands like `sandbox-agent opencode` and `gigacode` automatically start it when needed and restart it when the binary is updated.
|
||||
|
||||
## How it works
|
||||
|
||||
1. When you run `sandbox-agent opencode`, `sandbox-agent daemon start`, or `gigacode`, the CLI checks if a daemon is already healthy at the configured host and port.
|
||||
2. If no daemon is running, one is spawned in the background with stdout/stderr redirected to a log file.
|
||||
3. The CLI writes a PID file and a build ID file to track the running process and its version.
|
||||
4. On subsequent invocations, if the daemon is still running but was built from a different commit, the CLI automatically stops the old daemon and starts a new one.
|
||||
|
||||
## Auto-upgrade
|
||||
|
||||
Each build of sandbox-agent embeds a unique **build ID** (the git short hash, or a version-timestamp fallback). When a daemon is started, this build ID is written to a version file alongside the PID file.
|
||||
|
||||
On every invocation of `ensure_running` (called by `opencode`, `gigacode`, and `daemon start`), the CLI compares the stored build ID against the current binary's build ID. If they differ, the running daemon is stopped and replaced automatically:
|
||||
|
||||
```
|
||||
daemon outdated (build a1b2c3d -> f4e5d6c), restarting...
|
||||
```
|
||||
|
||||
This means installing a new version of sandbox-agent and running any daemon-aware command is enough to upgrade — no manual restart needed.
|
||||
|
||||
## Managing the daemon
|
||||
|
||||
### Start
|
||||
|
||||
Start a daemon in the background. If one is already running and healthy, this is a no-op.
|
||||
|
||||
```bash
|
||||
sandbox-agent daemon start [OPTIONS]
|
||||
```
|
||||
|
||||
| Option | Default | Description |
|
||||
|--------|---------|-------------|
|
||||
| `-H, --host <HOST>` | `127.0.0.1` | Host to bind to |
|
||||
| `-p, --port <PORT>` | `2468` | Port to bind to |
|
||||
| `-t, --token <TOKEN>` | - | Authentication token |
|
||||
| `-n, --no-token` | - | Disable authentication |
|
||||
|
||||
```bash
|
||||
sandbox-agent daemon start --no-token
|
||||
```
|
||||
|
||||
### Stop
|
||||
|
||||
Stop a running daemon. Sends SIGTERM and waits up to 5 seconds for a graceful shutdown before falling back to SIGKILL.
|
||||
|
||||
```bash
|
||||
sandbox-agent daemon stop [OPTIONS]
|
||||
```
|
||||
|
||||
| Option | Default | Description |
|
||||
|--------|---------|-------------|
|
||||
| `-H, --host <HOST>` | `127.0.0.1` | Host of the daemon |
|
||||
| `-p, --port <PORT>` | `2468` | Port of the daemon |
|
||||
|
||||
```bash
|
||||
sandbox-agent daemon stop
|
||||
```
|
||||
|
||||
### Status
|
||||
|
||||
Show whether the daemon is running, its PID, build ID, and log path.
|
||||
|
||||
```bash
|
||||
sandbox-agent daemon status [OPTIONS]
|
||||
```
|
||||
|
||||
| Option | Default | Description |
|
||||
|--------|---------|-------------|
|
||||
| `-H, --host <HOST>` | `127.0.0.1` | Host of the daemon |
|
||||
| `-p, --port <PORT>` | `2468` | Port of the daemon |
|
||||
|
||||
```bash
|
||||
sandbox-agent daemon status
|
||||
# Daemon running (PID 12345, build a1b2c3d, logs: ~/.local/share/sandbox-agent/daemon/daemon-127-0-0-1-2468.log)
|
||||
```
|
||||
|
||||
If the daemon was started with an older binary, the status includes an `[outdated, restart recommended]` notice.
|
||||
|
||||
## Files
|
||||
|
||||
All daemon state files live under the sandbox-agent data directory (typically `~/.local/share/sandbox-agent/daemon/`):
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `daemon-{host}-{port}.pid` | PID of the running daemon process |
|
||||
| `daemon-{host}-{port}.version` | Build ID of the running daemon |
|
||||
| `daemon-{host}-{port}.log` | Daemon stdout/stderr log output |
|
||||
|
||||
Multiple daemons can run on different host/port combinations without conflicting.
|
||||
|
|
@ -41,7 +41,12 @@
|
|||
"pages": [
|
||||
{
|
||||
"group": "Getting started",
|
||||
"pages": ["quickstart", "building-chat-ui", "manage-sessions", "opencode-compatibility"]
|
||||
"pages": [
|
||||
"quickstart",
|
||||
"building-chat-ui",
|
||||
"manage-sessions",
|
||||
"opencode-compatibility"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Deploy",
|
||||
|
|
@ -61,18 +66,18 @@
|
|||
},
|
||||
{
|
||||
"group": "Reference",
|
||||
"pages": [
|
||||
"cli",
|
||||
"inspector",
|
||||
"session-transcript-schema",
|
||||
"cors",
|
||||
"pages": [
|
||||
"cli",
|
||||
"inspector",
|
||||
"session-transcript-schema",
|
||||
"gigacode",
|
||||
{
|
||||
"group": "AI",
|
||||
"pages": ["ai/skill", "ai/llms-txt"]
|
||||
},
|
||||
{
|
||||
"group": "Advanced",
|
||||
"pages": ["telemetry"]
|
||||
"pages": ["daemon", "cors", "telemetry"]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
|||
6
docs/gigacode.mdx
Normal file
6
docs/gigacode.mdx
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
title: GigaCode
|
||||
url: "https://github.com/rivet-dev/sandbox-agent/tree/main/server/packages/gigacode"
|
||||
---
|
||||
|
||||
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
"license": {
|
||||
"name": "Apache-2.0"
|
||||
},
|
||||
"version": "0.1.6-rc.1"
|
||||
"version": "0.1.6"
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue