fix: add prepare script for git dependency installs#2
Merged
mattapperson merged 5 commits intomainfrom Apr 1, 2026
Merged
Conversation
When this package is installed from a git URL (e.g. by the monorepo), pnpm runs the prepare lifecycle script. Without it, tsc never runs and the esm/ build artifacts referenced by the exports map are missing.
The agent uses types (ResponsesRequest, InputsUnion, etc.) that exist in the SDK repo's main branch but aren't in the npm-published 0.10.2. Point to git URL so the prepare script can build successfully.
The lockfile was out of sync with the git URL for @openrouter/sdk. Also add pnpm.onlyBuiltDependencies so the SDK's prepare script runs during install.
The monorepo's vitest config uses a "source" export condition that resolves to ./src/*.ts files. Without src/ in the files field, pnpm pack excludes it from the installed package, causing "Cannot find package" errors in vitest tests.
The "source" export condition points to TypeScript source files, which causes resolution issues when the agent is installed as a git dependency. The compiled esm/ output is sufficient for consumers. This avoids nested dependency resolution failures where the agent's source files try to import @openrouter/sdk subpaths.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
"prepare": "npm run build"to scriptsWhen this package is installed from a git URL (e.g. by the monorepo via
git+https://github.com/OpenRouterTeam/typescript-agent.git#main), pnpm runs thepreparelifecycle script. Without it,tscnever runs and the build artifacts referenced by theexportsmap are missing, causingCannot find package '@openrouter/agent/tool'errors.Test plan
pnpm add @openrouter/agent@git+https://github.com/OpenRouterTeam/typescript-agent.git#add-prepare-scriptresolves subpath exports