Skip to content

Commit 911109d

Browse files
committed
chore(merge): merge master
2 parents 91cea5c + 8c224f1 commit 911109d

File tree

49 files changed

+3776
-141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+3776
-141
lines changed

.github/workflows/go-test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,8 @@ jobs:
3333
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
3434
with:
3535
version: v2.1
36+
37+
- name: Check for unstaged changes
38+
run: |
39+
make gen
40+
./check_unstaged.sh

.github/workflows/release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ jobs:
3333
- name: Install Chat Dependencies
3434
run: cd chat && bun install
3535

36+
- name: Run make gen and check for unstaged changes
37+
run: |
38+
make gen
39+
./check_unstaged.sh
40+
3641
- name: Build and Upload
3742
env:
3843
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

AGENTS.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# AGENTS.md
2+
3+
This file provides guidance to AI agents working with code in this repository.
4+
5+
## Build Commands
6+
7+
- `make build` - Build the binary to `out/agentapi` (includes chat UI build)
8+
- `make embed` - Build the chat UI and embed it into Go
9+
- `go build -o out/agentapi main.go` - Direct Go build without chat UI
10+
- `go generate ./...` - Generate OpenAPI schema and version info
11+
12+
## Testing
13+
14+
- `go test ./...` - Run all Go tests
15+
- Tests are located alongside source files (e.g., `lib/httpapi/server_test.go`)
16+
17+
## Development Commands
18+
19+
- `agentapi server -- claude` - Start server with Claude Code agent
20+
- `agentapi server -- aider --model sonnet` - Start server with Aider agent
21+
- `agentapi server -- goose` - Start server with Goose agent
22+
- `agentapi server --type=codex -- codex` - Start server with Codex (requires explicit type)
23+
- `agentapi server --type=gemini -- gemini` - Start server with Gemini (requires explicit type)
24+
- `agentapi attach --url localhost:3284` - Attach to running agent terminal
25+
- Server runs on port 3284 by default
26+
- Chat UI available at http://localhost:3284/chat
27+
- API documentation at http://localhost:3284/docs
28+
29+
## Architecture
30+
31+
This is a Go HTTP API server that controls coding agents (Claude Code, Aider, Goose, etc.) through terminal emulation.
32+
33+
**Core Components:**
34+
- `main.go` - Entry point using cobra CLI framework
35+
- `cmd/` - CLI command definitions (server, attach)
36+
- `lib/httpapi/` - HTTP server, routes, and OpenAPI schema
37+
- `lib/screentracker/` - Terminal output parsing and message splitting
38+
- `lib/termexec/` - Terminal process execution and management
39+
- `lib/msgfmt/` - Message formatting for different agent types (claude, goose, aider, codex, gemini, amp, cursor-agent, cursor, auggie, custom)
40+
- `chat/` - Next.js web UI (embedded into Go binary)
41+
42+
**Key Architecture:**
43+
- Runs agents in an in-memory terminal emulator
44+
- Translates API calls to terminal keystrokes
45+
- Parses terminal output into structured messages
46+
- Supports multiple agent types with different message formats
47+
- Embeds Next.js chat UI as static assets in Go binary
48+
49+
**Message Flow:**
50+
1. User sends message via HTTP API
51+
2. Server takes terminal snapshot
52+
3. Message sent to agent as terminal input
53+
4. Terminal output changes tracked and parsed
54+
5. New content becomes agent response message
55+
6. SSE events stream updates to clients
56+
57+
## API Endpoints
58+
59+
- GET `/messages` - Get all messages in conversation
60+
- POST `/message` - Send message to agent (content, type fields)
61+
- GET `/status` - Get agent status ("stable" or "running")
62+
- GET `/events` - SSE stream of agent events
63+
- GET `/openapi.json` - OpenAPI schema
64+
- GET `/docs` - API documentation UI
65+
- GET `/chat` - Web chat interface
66+
67+
## Supported Agents
68+
69+
Agents with explicit type requirement (use `--type=<agent>`):
70+
- `codex` - OpenAI Codex
71+
- `gemini` - Google Gemini CLI
72+
- `amp` - Sourcegraph Amp CLI
73+
- `cursor` - Cursor CLI
74+
75+
Agents with auto-detection:
76+
- `claude` - Claude Code (default)
77+
- `goose` - Goose
78+
- `aider` - Aider
79+
80+
## Project Structure
81+
82+
- Go module with standard layout
83+
- Chat UI in `chat/` directory (Next.js + TypeScript)
84+
- OpenAPI schema auto-generated to `openapi.json`
85+
- Version managed via `version.sh` script

CHANGELOG.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
# Changelog
22

3-
## 0.6.1
3+
## v0.7.0
4+
5+
### Features
6+
- Add Support for Opencode.
7+
- Add support for Agent aliases
8+
- Explicitly support AmazonQ
9+
- Bump NEXT.JS version
10+
11+
## v0.6.3
12+
13+
- CI fixes.
14+
15+
## v0.6.2
16+
17+
- Fix incorrect version string.
18+
19+
## v0.6.1
420

521
### Features
622
- Handle animation on Amp cli start screen.

MAINTAINERS.md

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,14 @@
55
Before performing a release, perform a local "smoke-test".
66
If everything seems OK, you can proceed to do the following:
77

8-
1. Update the version string in the following places:
9-
- `openapi.json`
10-
- `chat/package.json`
11-
- `lib/httpapi/server.go`
8+
1. Update the version string in `internal/version/version.go` and run `make gen`.
129
2. Add details in `CHANGELOG.md` on what changed.
1310
3. Create a PR with the subject `chore: update version to X.Y.Z`
14-
4. Once the above PR is approved and merged, create a new git tag `vX.Y.Z` pointing to the commit of the above PR merged to `main`:S
11+
4. Once the above PR is approved and merged, update your local branch and run `release.sh`.
12+
If the script reports errors, fix them before continuing.
13+
If there are no issues, it will output the Github tag URL.
1514

16-
```shell
17-
# Fetch existing tags first!
18-
git fetch --tags
19-
git tag -a vX.Y.Z -m 'vX.Y.Z'
20-
```
21-
22-
5. Push the tag:
23-
24-
```shell
25-
git push origin tag vX.Y.Z
26-
```
27-
28-
6. Visit `https://github.com/coder/agentapi/releases/tag/vX.Y.Z` and "Create release from tag".
15+
5. Visit `https://github.com/coder/agentapi/releases/tag/vX.Y.Z` and "Create release from tag".
2916

3017
- Select the tag you pushed previously.
3118
- Select the previous tag and "Generate release notes". Amend as required.

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@ embed: $(CHAT_SOURCES_STAMP)
1818
.PHONY: build
1919
build: embed
2020
CGO_ENABLED=0 go build -o ${BINPATH} main.go
21+
22+
.PHONY: gen
23+
gen:
24+
go generate ./...

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# AgentAPI
22

3-
Control [Claude Code](https://github.com/anthropics/claude-code), [Goose](https://github.com/block/goose), [Aider](https://github.com/Aider-AI/aider), [Gemini](https://github.com/google-gemini/gemini-cli), [Sourcegraph Amp](https://github.com/sourcegraph/amp-cli), [Codex](https://github.com/openai/codex), [Auggie](https://docs.augmentcode.com/cli/overview), and [Cursor CLI](https://cursor.com/en/cli) with an HTTP API.
3+
Control [Claude Code](https://github.com/anthropics/claude-code), [AmazonQ](https://aws.amazon.com/developer/learning/q-developer-cli/), [Opencode](https://opencode.ai/), [Goose](https://github.com/block/goose), [Aider](https://github.com/Aider-AI/aider), [Gemini](https://github.com/google-gemini/gemini-cli), [Sourcegraph Amp](https://github.com/sourcegraph/amp-cli), [Codex](https://github.com/openai/codex), [Auggie](https://docs.augmentcode.com/cli/overview), and [Cursor CLI](https://cursor.com/en/cli) with an HTTP API.
44

55
![agentapi-chat](https://github.com/user-attachments/assets/57032c9f-4146-4b66-b219-09e38ab7690d)
66

@@ -65,7 +65,7 @@ agentapi server -- goose
6565
```
6666

6767
> [!NOTE]
68-
> When using Codex, Gemini, Amp or CursorCLI, always specify the agent type explicitly (eg: `agentapi server --type=codex -- codex`), or message formatting may break.
68+
> When using Codex, Opencode, Gemini, Amp or CursorCLI, always specify the agent type explicitly (eg: `agentapi server --type=codex -- codex`), or message formatting may break.
6969
7070
An OpenAPI schema is available in [openapi.json](openapi.json).
7171

0 commit comments

Comments
 (0)