omp packages

@audsiui/pi-gemini-search0.1.0

Pi extension — self-hosted Google Antigravity OAuth plus a Gemini Google Search grounding web_search tool

audsiui Published 1 month ago MIT ~135 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

@audsiui/pi-gemini-search

A Pi extension that adds a gemini_web_search tool backed by Google Antigravity OAuth and Gemini Google Search grounding.

The whole lifecycle — OAuth login, token refresh, model catalog — is owned by the extension. Pi's /login and auth.json are not touched.

Install

# local checkout: add this line to ~/.pi/agent/settings.json "packages"
#   "../../pi-extend/pi-gemini-search"

# or as a package
pi install npm:@audsiui/pi-gemini-search

typebox is a peer dependency — run bun install inside the package directory for local development, then /reload.

Usage

Command Description
/gemini-search login [manual] Sign in with browser OAuth (loopback callback; manual = paste the redirect URL)
/gemini-search logout Delete stored credentials
/gemini-search status Account, client, project id, token expiry, active model
/gemini-search refresh Re-pull the model catalog from the account
/gemini-search model [id] Switch grounding model (interactive picker without an id)
/gemini-search usage Remaining quota — 5h / weekly buckets with reset times

gemini_web_search tool — query (Google operators such as site: / inurl: / filetype: are honored) plus optional numResults (1–20). Returns a synthesized answer, numbered sources, cited passages, and the queries the grounding actually issued.

State lives in ~/.pi/agent/gemini-search/: credentials.json (mode 0600) and models.json (its selectedModel picks the model).

Environment variables

Variable Purpose
PI_GEMINI_SEARCH_CLIENT_ID / PI_GEMINI_SEARCH_CLIENT_SECRET Use your own OAuth client instead of the built-in one
PI_GEMINI_SEARCH_ANTIGRAVITY_UA Override the client User-Agent
PI_GEMINI_SEARCH_HOME Override the credential/catalog directory

Credits

The endpoints, OAuth scopes, client credentials, and the grounding request/response shapes are adapted from oh-my-pi (rules/auth/google-antigravity.kdl, catalog/src/discovery/antigravity.ts, catalog/src/wire/gemini-headers.ts), the official Gemini CLI / Antigravity clients, and the quota endpoints documented by CodexBar and UsageBar. These are undocumented Google-internal APIs that can change or rate-limit without notice — intended for personal use.

Layout

extensions/
├── index.ts        # commands + tool registration
├── config.ts       # endpoints, scopes, UA, client resolution
├── cloud-code.ts   # loadCodeAssist / onboardUser / fetchAvailableModels / grounding / quota
├── catalog.ts      # models.json read/write, model selection
├── search.ts       # search orchestration + formatForLLM
└── auth/           # loopback, PKCE, browser, 0600 store, token refresh

Development

bun run extensions/smoke.test.ts   # 19 offline tests (mocked fetch)
bun run extensions/pi-api.test.ts  # 5 extension-API tests

License

MIT © audsiui