Skip to content

fix: type safety, broken build:prod, stale deps, OpenRouter provider - #14

Merged
ruvnet merged 12 commits into
mainfrom
fix/type-safety-deps
May 23, 2026
Merged

fix: type safety, broken build:prod, stale deps, OpenRouter provider#14
ruvnet merged 12 commits into
mainfrom
fix/type-safety-deps

Conversation

@ruvnet

@ruvnet ruvnet commented May 23, 2026

Copy link
Copy Markdown
Owner

Summary

Addresses the P0/P1 items from the post-2.1.2 roadmap (issue #7): fixes broken tooling, updates stale deps with security patches, upgrades the deprecated Anthropic model, adds the requested OpenRouter provider (issue #1), and cleans up TypeScript configuration.

Dependency updates

Package Old New Reason
agentdb ^1.3.9 ^1.6.1 Latest stable (was 3 minor versions behind)
onnxruntime-web ^1.20.1 ^1.26.0 Latest stable; 1.20 had WASM backend bugs
pino ^8.19.0 ^9.14.0 pino@9 is LTS; ships its own .d.ts
pino-pretty ^11.0.0 ^13.1.3 Required for pino@9 compatibility
reflect-metadata ^0.2.1 ^0.2.2 Latest patch
zod ^3.22.4 ^3.25.76 Latest 3.x stable (avoids v4 breaking API changes)
eslint (dev) ^8.24.1 ^8.57.1 Latest 8.x with all fixes

Removed @types/pino from devDependencies — pino@9 ships its own bundled types; @types/pino@7 conflicts.

Bug fixes

build:prod was broken — the build:prod script referenced a non-existent tsconfig.prod.json. Added tsconfig.prod.json extending the base config with production-appropriate settings (no sourcemaps, comments stripped, tests excluded).

lint script glob not quotedeslint src/**/*.ts is not expanded by npm's shell on many platforms. Changed to eslint 'src/**/*.ts' (single-quoted) so the glob is passed to ESLint rather than expanded by sh.

tsconfig.json deprecated moduleResolution"node" (alias node10) is deprecated in TypeScript and will error in TS 6. Migrated to "node16" and bumped target from es2017 to es2020.

Deprecated Anthropic modelAnthropicLM defaulted to claude-3-sonnet-20240229 which Anthropic deprecated in 2025. Updated default to claude-3-5-sonnet-20241022.

New feature: OpenRouterLM provider (fixes #1)

Added src/lm/providers/openrouter.ts — an OpenAI-compatible driver that routes to 200+ models through OpenRouter. Exported from the dspy.ts barrel.

import { OpenRouterLM, configureLM } from 'dspy.ts';

configureLM(new OpenRouterLM({
  apiKey: process.env.OPENROUTER_API_KEY!,
  model: 'anthropic/claude-3-5-sonnet',   // or any of 200+ models
  siteUrl: 'https://my-app.com',           // optional, for attribution
}));

Supports model, temperature, maxTokens, topP, stopSequences — the full GenerationOptions surface.

Version

Bumped to 2.2.1 (currently published at 2.2.0).

Test plan

  • npm run build — compiles without errors
  • npm run build:prod — uses new tsconfig.prod.json, succeeds
  • npm run lint — ESLint processes files with quoted glob
  • npm run typecheck — no type errors with node16 moduleResolution
  • npm test — all existing tests pass
  • OpenRouterLM can be instantiated and exported from 'dspy.ts'
  • AnthropicLM defaults to claude-3-5-sonnet-20241022

🤖 Generated with claude-flow

@ruvnet
ruvnet merged commit baba5ac into main May 23, 2026
4 checks passed
@ruvnet
ruvnet deleted the fix/type-safety-deps branch May 23, 2026 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

I cannot see class OpenRouterModel, also request option for manual connection to openAI

1 participant