diff --git a/.github/scripts/test-antigravity-acp.sh b/.github/scripts/test-antigravity-acp.sh new file mode 100644 index 000000000..dd1c269b2 --- /dev/null +++ b/.github/scripts/test-antigravity-acp.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -euo pipefail + +init='{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":1,"clientCapabilities":{},"clientInfo":{"name":"openab-smoke-test","version":"1.0.0"}}}' +response=$(printf '%s\n' "$init" | timeout 20 docker run --rm --network none -i --entrypoint sh "$1" -ec ' + test "$OPENAB_AGENT_COMMAND" = "agy acp" + test "$OPENAB_AGENT_AUTH_COMMAND" = "agy acp --login" + command -v agy-acp >/dev/null + exec agy acp +') + +printf '%s\n' "$response" | jq -se 'any(.[]; .id == 1 and .result.agentCapabilities.promptCapabilities.image == true)' >/dev/null diff --git a/.github/workflows/docker-smoke-test.yml b/.github/workflows/docker-smoke-test.yml index 3e6c0ca4b..50e6ed521 100644 --- a/.github/workflows/docker-smoke-test.yml +++ b/.github/workflows/docker-smoke-test.yml @@ -13,6 +13,7 @@ on: - 'Cargo.*' - '.github/scripts/node_base_arg.sh' - '.github/scripts/test_node_base_arg.sh' + - '.github/workflows/nightly-build.yml' - '.github/workflows/docker-smoke-test.yml' concurrency: @@ -246,6 +247,12 @@ jobs: assert_line 'ARG AGY_VERSION=1.2.13' Dockerfile.package assert_line 'ENV AGY_VERSION="${AGY_VERSION}"' Dockerfile.package assert_line 'LABEL dev.openab.agy.version="${AGY_VERSION}"' Dockerfile.package + assert_line 'ARG AGY_AGENT_COMMAND=agy-acp' Dockerfile.package + assert_line 'ARG AGY_AGENT_AUTH_COMMAND="agy auth"' Dockerfile.package + assert_line 'ENV OPENAB_AGENT_COMMAND="${AGY_AGENT_COMMAND}"' Dockerfile.package + assert_line 'ENV OPENAB_AGENT_AUTH_COMMAND="${AGY_AGENT_AUTH_COMMAND}"' Dockerfile.package + assert_line 'ENV OPENAB_AGENT_COMMAND="agy-acp"' Dockerfile.antigravity Dockerfile.unified + assert_line 'ENV OPENAB_AGENT_AUTH_COMMAND="agy auth"' Dockerfile.antigravity Dockerfile.unified assert_line 'ARG AGY_SHA256_AMD64=b0f195d37973be7b08c3b705d7fbbcd948dacb4a3c2176ee52ca29f7159bdc21' Dockerfile.antigravity Dockerfile.package Dockerfile.unified Dockerfile.final Dockerfile.ci assert_line 'ARG AGY_SHA256_ARM64=43bf59be5895475f8a32d4f94f1241f665986ea41a3622579e03b74e1b63dcfb' Dockerfile.antigravity Dockerfile.package Dockerfile.unified Dockerfile.final Dockerfile.ci diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 7065dec0c..eb041f765 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -318,6 +318,8 @@ jobs: BUILD_ARGS="AGY_VERSION=$V AGY_SHA256_AMD64= AGY_SHA256_ARM64= + AGY_AGENT_COMMAND=agy acp + AGY_AGENT_AUTH_COMMAND=agy acp --login ALLOW_UNVERIFIED_NIGHTLY_DOWNLOADS=true" ;; *) echo "::error::no resolver for variant $VARIANT"; exit 1 ;; @@ -465,6 +467,16 @@ jobs: if-no-files-found: error retention-days: 1 + - name: Verify native Antigravity ACP image support + if: matrix.variant == 'antigravity' + env: + DIGEST: ${{ steps.build.outputs.digest }} + run: | + set -euo pipefail + IMAGE="${REGISTRY}/${IMAGE_NAME}@${DIGEST}" + docker pull "$IMAGE" + bash .github/scripts/test-antigravity-acp.sh "$IMAGE" + - name: Export digest env: DIGEST: ${{ steps.build.outputs.digest }} diff --git a/Dockerfile.package b/Dockerfile.package index e36a3c32d..06c9a7126 100644 --- a/Dockerfile.package +++ b/Dockerfile.package @@ -367,8 +367,10 @@ RUN mkdir -p /home/agent/.agy && chown -R agent:agent /home/agent USER agent HEALTHCHECK --interval=30s --timeout=5s --retries=3 \ CMD pgrep -x openab || exit 1 -ENV OPENAB_AGENT_COMMAND="agy-acp" -ENV OPENAB_AGENT_AUTH_COMMAND="agy auth" +ARG AGY_AGENT_COMMAND=agy-acp +ARG AGY_AGENT_AUTH_COMMAND="agy auth" +ENV OPENAB_AGENT_COMMAND="${AGY_AGENT_COMMAND}" +ENV OPENAB_AGENT_AUTH_COMMAND="${AGY_AGENT_AUTH_COMMAND}" ENTRYPOINT ["tini", "--"] CMD ["openab", "run", "-c", "/etc/openab/config.toml"] diff --git a/docs/antigravity.md b/docs/antigravity.md index c0c9384e7..e04c661b0 100644 --- a/docs/antigravity.md +++ b/docs/antigravity.md @@ -2,7 +2,67 @@ OpenAB supports [Google Antigravity CLI](https://antigravity.google/) via the `agy-acp` adapter — a thin Rust binary that translates ACP JSON-RPC into `agy -p` invocations. -## How It Works +## Native ACP preview in nightly + +The `nightly-antigravity` image defaults to Google's [native `agy acp` server](https://antigravity.google/docs/cli/acp). Native ACP accepts Discord image prompts, exposes models through `/models`, and can resume sessions that were created with native ACP. Release and pre-beta images default to `agy-acp`. + +For a first-time sign-in on nightly, run `agy acp --login` inside the container and follow the prompts. Persist the agent's home directory across container replacements. + +### Keep the adapter on nightly + +If you need to continue an existing `agy-acp` thread, set this explicitly before upgrading your nightly image: + +```toml +[agent] +command = "agy-acp" +args = [] +``` + +Existing explicit agent commands take precedence over the image default. + +### Recover a thread after switching to native ACP + +The native server can accept `session/load` with a legacy adapter session ID and then return `trajectory not found` when you send a message. Run [`/reset`](slash-commands.md#reset) in the affected Discord thread. This clears the previous agent session and its context. Your next message starts a fresh native ACP session in the same thread. You can also start a new Discord thread. + +## Docker + +```bash +docker build -f Dockerfile.antigravity -t openab-antigravity . +``` + +## Authentication + +Antigravity CLI uses Google Sign-In (OAuth). Run the image's sign-in command inside the container. + +```bash +kubectl exec -it deployment/openab-antigravity -- sh -c 'exec $OPENAB_AGENT_AUTH_COMMAND' +``` + +Complete the device flow in your browser. Persist the agent's home directory to retain your sign-in. + +## Helm + +This example deploys only Antigravity and inherits the selected image's agent command. Replace the bot token and channel ID before deploying. Select a release or pre-beta tag to use its adapter default, or add the explicit `[agent]` override from [Keep the adapter on nightly](#keep-the-adapter-on-nightly) to `configToml`. + +```yaml +agents: + kiro: + enabled: false + antigravity: + image: ghcr.io/openabdev/openab:nightly-antigravity + discord: + botToken: "YOUR_DISCORD_BOT_TOKEN" + configToml: | + [discord] + bot_token = "${DISCORD_BOT_TOKEN}" + allowed_channels = ["123456789"] +``` + +## Legacy adapter + +The following settings and behavior apply to `agy-acp`. + +### How It Works ``` openab ──ACP JSON-RPC──► agy-acp ──spawns──► agy --add-dir /home/agent -p "prompt" @@ -14,19 +74,10 @@ openab ──ACP JSON-RPC──► agy-acp ──spawns──► agy --add-dir / - Only the **delta** (new response) is sent back — previous turns are not repeated - Full `` metadata is passed through to agy -## Configuration - -```toml -[agent] -# command defaults from OPENAB_AGENT_COMMAND="agy-acp" -# Only override if you need non-default behavior -``` - ### Environment Variables | Variable | Description | Default | |----------|-------------|---------| -| `AGY_WORKING_DIR` | Working directory for agy invocations | `/tmp` | | `AGY_EXTRA_ARGS` | Extra arguments added to every `agy` prompt invocation (optional) | (none) | | `OPENAB_TOOL_DISPLAY` | Controls filtering of intermediate thinking narration ("I will..."). `full` or unset keeps all output; `compact`/`none`/`off` drops leading narration-only parts. | `full` | @@ -49,53 +100,22 @@ AGY_EXTRA_ARGS = "--print-timeout 5m" The timeout remains finite; tasks exceeding the configured duration can still fail. This setting controls the CLI print timeout, not other OpenAB timeouts. -## Steering Files +### Steering Files agy reads `AGENTS.md` and `GEMINI.md` when it considers a directory a workspace: 1. `AGENTS.md` and `GEMINI.md` are loaded first and injected into the system prompt 2. agy does not disclose how it determines HOME as a workspace, but `--add-dir` explicitly adds a directory -3. agy-acp **automatically** passes `--add-dir ` on every invocation — no configuration needed +3. `agy-acp` uses OpenAB's `[agent].working_dir` and automatically passes it through `--add-dir` on every invocation Place your steering instructions in `/home/agent/AGENTS.md` or `/home/agent/GEMINI.md` — they will be read on every prompt as long as `working_dir` points to that directory. -## Docker - -```bash -docker build -f Dockerfile.antigravity -t openab-antigravity . -``` - -## Authentication - -Antigravity CLI uses Google Sign-In (OAuth). Authenticate inside the container: - -```bash -kubectl exec -it deployment/openab-antigravity -- sh -c "$OPENAB_AGENT_AUTH_COMMAND" -``` - -Complete the device flow in your browser. Auth tokens persist in the PVC at `~/.gemini/`. - -## Helm - -```yaml -agents: - antigravity: - discord: - botToken: "${DISCORD_BOT_TOKEN}" - allowedChannels: ["123456789"] - agent: - command: "agy-acp" - args: [] - workingDir: "/home/agent" - # image: leave empty — chart auto-resolves to openab:-antigravity -``` - -## Limitations +### Limitations - **No streaming**: `agy -p` returns the full response at once; the adapter sends it as a single `agent_message_chunk` notification. - **Cancel is a no-op**: `agy -p` runs to completion; `session/cancel` acknowledges but cannot interrupt. -## Model Selection +### Model Selection The Discord `/models` dropdown is supported. `agy-acp` returns model `configOptions` when a session is created or loaded. It fetches the available