Class IntegrationManager

Manages UI integrations into the Antigravity Agent View.

Provides a declarative API to register integration points, generates a self-contained JavaScript file, and installs it into Antigravity's workbench.

Features:

  • Theme-aware: Adapts to dark/light mode automatically
  • Auto-repair: Watches workbench.html and re-patches after updates
  • Dynamic update: Re-generate script without re-patching workbench.html

Implements

Constructors

Accessors

Methods

  • Add item(s) to the 3-dot dropdown menu.

    Parameters

    • id: string
    • label: string
    • Optionalicon: string
    • Optionaltoast: IToastConfig
    • separator: boolean = false

    Returns this

  • Enable chat title interaction.

    Parameters

    • id: string
    • interaction: "click" | "dblclick" | "hover" = 'dblclick'
    • Optionalhint: string
    • Optionaltoast: IToastConfig

    Returns this

  • Add character count badges to user messages.

    Parameters

    • id: string
    • display: "charCount" | "wordCount" | "custom" = 'charCount'

    Returns this

  • Generate the integration script from all registered configs.

    Returns string

    Complete JavaScript code as a string

  • Enable auto-repair: watches workbench.html for changes and automatically re-applies the integration patch.

    This handles Antigravity updates that overwrite workbench.html. The watcher detects when the file changes and re-patches it if the integration marker is missing.

    Returns void

    const integrator = new IntegrationManager();
    integrator.useDemoPreset();
    await integrator.install();
    integrator.enableAutoRepair(); // Survive Antigravity updates
  • Install the generated script into workbench.html.

    ⚠️ Requires Antigravity restart to take effect. ⚠️ Will be overwritten by Antigravity updates (use enableAutoRepair).

    Returns Promise<void>

  • Signal that the extension is active.

    Call this in your extension's activate() function. The integration script checks for this heartbeat; if it's missing or stale (>48h), the script won't start.

    This prevents orphaned integrations from running after an extension is disabled or uninstalled.

    Returns void

    export function activate(context: vscode.ExtensionContext) {
    const sdk = new AntigravitySDK(context);
    sdk.integration.signalActive();
    // ...
    }
  • Remove the integration from workbench.html.

    ⚠️ Requires Antigravity restart to take effect.

    Returns Promise<void>

  • Re-generate and overwrite the integration script without re-patching workbench.html.

    Use this after registering/unregistering integration points at runtime. The script file is updated in-place; the next Antigravity restart will pick up the changes. workbench.html