Skip to content

feat(agents): add agy adapter#123

Closed
yyovil wants to merge 1 commit into
agents/03-ampfrom
agents/04-agy
Closed

feat(agents): add agy adapter#123
yyovil wants to merge 1 commit into
agents/03-ampfrom
agents/04-agy

Conversation

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jun 6, 2026

Greptile Summary

Introduces a complete agy (Antigravity) agent adapter: binary resolution, session launch/restore, hook install/uninstall/check, and an activity-state deriver. The adapter is wired into the registry, the activity dispatch table, and the wiring smoke test.

  • agy/agy.go — adapter core: binary discovery (PATH + well-known locations, Windows-aware), GetLaunchCommand/GetRestoreCommand following the same shape as amp/droid, session-info readout from metadata, and correct double-checked-locking binary cache using sync.RWMutex.
  • agy/hooks.go — workspace-local .gemini/hooks.json lifecycle (install, uninstall, idempotent merge), using the shared hookutil.AtomicWriteFile rather than a private copy.
  • agy/activity.go + activitydispatch/dispatch.go — deriver registered under the \"agy\" token; hook commands use \"ao hooks agy <event>\" kebab-case which the deriver maps to ActivityActive/ActivityIdle/ActivityExited signals.

Confidence Score: 5/5

Safe to merge — the change is a self-contained new adapter that does not touch existing session or dispatch logic.

All changed files are additive: a new package plus one-line registrations in dispatch, registry, and the wiring smoke test. The adapter follows the established pattern from droid/amp/codex exactly, the binary cache uses correct double-checked RWMutex locking, hook install/uninstall is idempotent and preserves user-defined hooks, and the shared hookutil.AtomicWriteFile is used for crash-safe writes. Test coverage spans manifest, launch, restore, session-info, and the full hooks lifecycle.

No files require special attention.

Important Files Changed

Filename Overview
backend/internal/adapters/agent/agy/agy.go Core adapter: binary resolution, launch/restore commands, session info. Correct RWMutex double-checked locking. No issues.
backend/internal/adapters/agent/agy/hooks.go Hook lifecycle (install/uninstall/check) for .gemini/hooks.json. Uses shared hookutil.AtomicWriteFile. Idempotent merge preserves user hooks. No issues.
backend/internal/adapters/agent/agy/activity.go Activity state deriver mapping kebab-case hook sub-commands to domain states. Consistent with dispatch table registration.
backend/internal/adapters/agent/activitydispatch/dispatch.go Adds 'agy' → agy.DeriveActivityState entry to the dispatch table. Correctly matches the hook command prefix used in hooks.go.
backend/internal/adapters/agent/registry/registry.go Registers agy.New() in Constructors(). Straightforward addition consistent with other adapters.
backend/internal/daemon/wiring_test.go Adds domain.HarnessAgy/"agy" smoke-test case. HarnessAgy constant already present in domain package.

Sequence Diagram

sequenceDiagram
    participant AO as AO Daemon
    participant Registry as registry.Constructors()
    participant Plugin as agy.Plugin
    participant Hooks as .gemini/hooks.json
    participant AgyCLI as agy CLI
    participant Dispatch as activitydispatch

    AO->>Registry: Constructors()
    Registry-->>AO: [..., agy.New()]

    Note over AO,Plugin: Session Launch
    AO->>Plugin: GetLaunchCommand(cfg)
    Plugin->>Plugin: agyBinary() [RWMutex cache]
    Plugin-->>AO: ["agy", "--add-dir", path, "--prompt-interactive", prompt]

    Note over AO,Hooks: Hook Installation
    AO->>Plugin: GetAgentHooks(cfg)
    Plugin->>Hooks: read .gemini/hooks.json
    Plugin->>Plugin: merge AO hooks (idempotent)
    Plugin->>Hooks: atomic write via hookutil

    Note over AgyCLI,Dispatch: Activity Reporting (runtime)
    AgyCLI->>AgyCLI: fires BeforeAgent hook
    AgyCLI->>AO: exec "ao hooks agy before-agent"
    AO->>Dispatch: Derive("agy", "before-agent", payload)
    Dispatch->>Dispatch: agy.DeriveActivityState
    Dispatch-->>AO: ActivityActive

    Note over AO,Plugin: Session Restore
    AO->>Plugin: GetRestoreCommand(cfg)
    Plugin-->>AO: ["agy", "--add-dir", path, "--conversation", nativeID]
Loading

Reviews (2): Last reviewed commit: "feat(agents): add agy adapter" | Re-trigger Greptile

Comment thread backend/internal/adapters/agent/agy/hooks.go Outdated
Comment thread backend/internal/adapters/agent/agy/agy.go
Registers the agy harness, stacked on the agent platform. Includes its own activity deriver.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants