9b395f5cc3
Build Chrome Extension / build (push) Waiting to run
Trigger Website Rebuild (Docs Updated) / dispatch (push) Waiting to run
E2E Headed Chrome / e2e-headed (macos-15) (push) Has been cancelled
E2E Headed Chrome / e2e-headed (ubuntu-latest) (push) Has been cancelled
E2E Headed Chrome / e2e-headed (windows-latest) (push) Has been cancelled
CI / build (macos-latest) (push) Has been cancelled
CI / build (ubuntu-latest) (push) Has been cancelled
CI / build (windows-latest) (push) Has been cancelled
CI / unit-test (push) Has been cancelled
CI / bun-test (push) Has been cancelled
CI / adapter-test (push) Has been cancelled
CI / smoke-test (macos-latest) (push) Has been cancelled
CI / smoke-test (ubuntu-latest) (push) Has been cancelled
Security Audit / audit (push) Has been cancelled
37 lines
1.5 KiB
JavaScript
37 lines
1.5 KiB
JavaScript
import { cli, Strategy } from '@jackwener/opencli/registry';
|
|
export const sendCommand = cli({
|
|
site: 'antigravity',
|
|
name: 'send',
|
|
access: 'write',
|
|
description: 'Send a message to Antigravity AI via the internal Lexical editor',
|
|
domain: 'localhost',
|
|
strategy: Strategy.UI,
|
|
browser: true,
|
|
args: [
|
|
{ name: 'message', help: 'The message text to send', required: true, positional: true }
|
|
],
|
|
columns: ['Status', 'Message'],
|
|
func: async (page, kwargs) => {
|
|
const text = kwargs.message;
|
|
// We use evaluate to focus and insert text because Lexical editors maintain
|
|
// absolute control over their DOM and don't respond to raw node.textContent.
|
|
// document.execCommand simulates a native paste/typing action perfectly.
|
|
await page.evaluate(`
|
|
async () => {
|
|
const container = document.getElementById('antigravity.agentSidePanelInputBox');
|
|
if (!container) throw new Error('Could not find antigravity.agentSidePanelInputBox');
|
|
const editor = container.querySelector('[data-lexical-editor="true"]');
|
|
if (!editor) throw new Error('Could not find Antigravity input box');
|
|
|
|
editor.focus();
|
|
document.execCommand('insertText', false, ${JSON.stringify(text)});
|
|
}
|
|
`);
|
|
// Wait for the React/Lexical state to flush the new input
|
|
await page.wait(0.5);
|
|
// Press Enter to submit the message
|
|
await page.pressKey('Enter');
|
|
return [{ Status: 'Sent successfully', Message: text }];
|
|
},
|
|
});
|