Imported from code-yeongyu/pi-websearch (
AGENTS.md). Install upstream withnpx skills add code-yeongyu/pi-websearch. Copyright stays with the author.
Repository Conventions
Conventions for human contributors and AI agents working on this repository.
Style
- Terse technical prose. No emojis in commits, issues, PR comments, or code.
- TypeScript strict mode. No
any, nounknowncasts where avoidable, no@ts-ignore, no@ts-expect-error, no enums. - ESM modules with
.jssuffix in import paths (Node16 resolution). - Tabs for indentation. Double quotes for strings.
- Tests use vitest with
#given .. #when .. #thendescription style or plain// given / // when / // thenbody comments.
Commands
bun install— install dependencies (preferred for development).npm install/npm ci— supported consumer install paths.bun run test/npm test— run vitest test suite once.bun run typecheck— strict TypeScript check.bun run check— type check + biome.pi -e ./src/index.ts— load the extension into a local pi session for manual smoke testing.
Constraints
- No Bun APIs. Runtime is Node 22.19+. Bun is used as the development/CI toolchain, not as a runtime API.
- The extension is standalone and depends only on the public pi extension API.
- Provider configuration is explicit: no config means the extension refuses to activate and surfaces a TUI startup error.
- Exa, Tavily, Brave, Serper, Google CSE, Z.ai, OpenAI/Codex hosted search, Anthropic Messages search, Perplexity, xAI, and Kagi require their documented credentials.
auto(defaulttrue) prepends an implicitnativeentry whenExtensionContext.modelmatches a server-hosted-search-supported provider+model combo. Native entry inherits auth viaExtensionContext.modelRegistry.getApiKeyAndHeaders, preservesmodel.baseUrl(so any local gateway baseUrl override registered in the pi model registry flows through), and routes through the existing provider adapter; explicitprovidersremain the fallback chain. Recognized provider aliases:zaiforz-ai, andopenroutermodel ids of the form<upstream>/<model>are unwrapped before matching.- TUI rendering reads typed
detailsreturned by toolexecute; renderers never parse formatted strings.