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

  • get titles(): TitleManager

    Access the title manager for programmatic title control.

    Requires enableTitleProxy() to be called first.

    Returns TitleManager

    sdk.integration.titles.rename(cascadeId, 'My Title');
    sdk.integration.titles.remove(cascadeId);
    const all = sdk.integration.titles.getAll();

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.

    If title proxy is enabled, appends the title proxy renderer code.

    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
  • Enable the title proxy feature.

    Adds renderer-side code that intercepts the summaries provider and injects custom chat titles. Uses structural matching to find the provider (obfuscation-safe).

    After enabling, call install() or updateScript() to apply.

    Returns this

    const sdk = new AntigravitySDK(context);
    await sdk.initialize();

    sdk.integration.enableTitleProxy();
    await sdk.integration.install();

    // Now rename from extension host:
    sdk.integration.titles.rename(cascadeId, 'My Custom Title');
  • Install this extension's script into the shared SDK framework.

    For seamless hot-reload behavior, use installSeamless() instead.

    The first extension to call install() patches workbench.html with the shared loader. Subsequent extensions just register in the manifest.

    Returns Promise<boolean>

    true if the script content actually changed on disk

  • Seamless install — handles everything automatically.

    This is the recommended install method for extension developers. It handles the entire lifecycle:

    1. First install: Writes script + patches HTML + prompts user to reload
    2. Update: Compares content, if changed → auto-reloads window (no prompt)
    3. No change: Does nothing

    The developer never needs to think about reload.

    Parameters

    • executeCommand: (command: string) => Thenable<any>

      Function to execute VS Code commands (pass vscode.commands.executeCommand or equivalent)

    • OptionalshowMessage: (message: string, ...items: string[]) => Thenable<undefined | string>

    Returns Promise<void>

    const sdk = new AntigravitySDK(context);
    await sdk.initialize();

    sdk.integration.enableTitleProxy();
    // That's it. SDK handles install, reload, everything.
    await sdk.integration.installSeamless(
    (cmd) => vscode.commands.executeCommand(cmd),
    (msg, ...items) => vscode.window.showInformationMessage(msg, ...items),
    );
  • 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 this extension from the SDK framework.

    If this is the last extension, the loader is removed from workbench.html and all original checksums are restored.

    ⚠️ 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