pi-lens
Version:
Real-time code feedback for pi — LSP, linters, formatters, type-checking, structural analysis & booboo
20 lines (19 loc) • 941 B
JavaScript
/**
* Local re-implementation of the host SDK's `isToolCallEventType`.
*
* Why this exists instead of importing from `@earendil-works/pi-coding-agent`:
* pi installs extension dependencies with `npm install --omit=dev`, so the host
* coding-agent package is NOT present in the extension's `node_modules` at
* runtime. Importing a *runtime value* from it therefore fails to resolve on a
* clean install. Pulling it in as a real dependency is worse — it drags a huge
* transitive tree (LLM provider SDKs) whose deeply nested paths exceed Windows'
* MAX_PATH, which breaks `git clean -fdx` during `pi update`.
*
* The SDK function is a one-line discriminant check, so we inline it and keep
* every `@earendil-works/pi-coding-agent` import type-only (types compile away).
*/
export function isToolCallEventType(toolName, event) {
return (!!event &&
typeof event === "object" &&
event.toolName === toolName);
}