agent-infra-cli 0.1.0

Command-line client for Agent Infra
Documentation
# Agent Infra CLI

`infra` is a command-line client built on `agent-infra-sdk`. Infra services use
the Agent Infra Gateway. Workspace data can optionally bind directly to a local
directory, while managed Workspace lifecycle and every other service continue
through Gateway.

## Install

```bash
cargo install agent-infra-cli
```

The default Gateway is `http://127.0.0.1:5200`. Persist a remote Gateway once:

```bash
infra config gateway set https://infra.example.com
infra config gateway get
```

Resolution order is `--gateway` > `SKY_GATEWAY_URL` > saved config > local
default. Override the config path with `--config` or `AGENT_INFRA_CONFIG`.
The default path is:

- macOS: `~/Library/Application Support/agent-infra/config.json`
- Linux: `${XDG_CONFIG_HOME:-~/.config}/agent-infra/config.json`
- Windows: `%APPDATA%\agent-infra\config.json`

Environment configuration remains supported:

```bash
export SKY_GATEWAY_URL=https://infra.example.com
export SKY_GATEWAY_TOKEN=...
```

Do not put a long-lived token directly on the command line in shared shell
environments; process arguments and shell history may be visible to others.
The config file stores only the Gateway URL, never credentials.

## Sky credentials

Credential resolution order is `--token` > `SKY_GATEWAY_TOKEN` > a directly
readable local `~/.sky/credentials` token. Inspect discovery without printing
secrets:

```bash
infra auth status
```

Modern `sky login` credentials use an `ENCv1` encrypted store. Infra detects
that login state but deliberately does not decrypt another CLI's credential
file. In that case, issue a scoped Sky user API token and expose it as
`SKY_GATEWAY_TOKEN`. `infra auth status` reports this as
`sky_login_encrypted` and provides the same guidance.

## Examples

```bash
# Health and discovery
infra gateway ready
infra gateway wait-ready --deadline 60
infra gateway discovery --output json

# Agent Registry
infra agent list --status active --limit 20
infra agent get agt_01K...
infra agent create --file create-agent.json

# Durable context; append accepts an array of ConversationRecord objects
infra context recent conversation-1 --limit 50 --role user,assistant
infra context append --file messages.json

# Compatibility workspace file and command APIs
infra workspace read README.md
infra workspace write notes.txt --content 'hello'
infra workspace exec 'cargo check' --cwd /workspace/project

# Direct local Workspace data plane; no file bytes pass through Gateway
infra --local-workspace . workspace read README.md
infra --local-workspace . workspace write notes.txt --content 'hello'

# Host command execution is an explicit local opt-in
infra --local-workspace . --allow-local-workspace-exec \
  workspace exec 'cargo check'

# Managed workspace lifecycle
infra workspace list-workspaces --limit 50
infra workspace create-workspace --file workspace.json \
  --idempotency-key create-workspace-01 --wait

# OpenAI-compatible Model Infra JSON APIs; '-' means stdin
infra model models
infra model chat --file request.json
printf '%s' '{"model":"default","input":"hello"}' | infra model responses
```

Complex write requests are supplied as JSON files or standard input so the CLI
stays aligned with the SDK's contract types as those contracts evolve. JSON
field names use the contracts' `camelCase` wire format.