Skip to content

Conversation

@mattapperson
Copy link
Collaborator

@mattapperson mattapperson commented Dec 2, 2025

Summary

This PR brings several improvements to the TypeScript SDK:

API Changes

  • Updated OpenAPI specification with latest OpenRouter API features
  • Added debug parameter with echoUpstreamBody option for chat generation
  • New ChatCompletionFinishReason enum for better finish reason handling
  • Added ChatStreamingChoice type for streaming responses
  • New plugin types: PluginResponseHealing
  • Added TTL support for cache control
  • Updated response format union ordering for better type inference
  • New Debug type for debugging options
  • Added allowEmptyValue support in query encoding

Type Safety Improvements

  • Replaced any types with unknown throughout tool-types.ts:
    • ZodType<any>ZodType<unknown> in all tool interfaces
    • ToolWithExecute<any, any> → proper generic constraints
    • ToolWithGenerator<any, any> → proper generic constraints
  • Improved type imports using import type where appropriate
  • Better separation of type-only imports from value imports

Code Quality: Biome Configuration

Added comprehensive biome.json configuration to enforce code quality:

  • Linting Rules:
    • noExplicitAny: "error" - Bans explicit any types
    • noUnusedImports: "error" - Removes dead imports
    • noConsole: "error" - Prevents console statements
    • noDoubleEquals: "error" - Enforces strict equality
    • useNodejsImportProtocol: "error" - Enforces node: protocol
  • Style Rules:
    • useImportType with separated type imports
    • useConst, useBlockStatements, noParameterAssign
  • Performance Rules:
    • noAccumulatingSpread: "error"
  • Formatting:
    • 2-space indentation, 100 char line width
    • Single quotes, trailing commas
    • Organized imports with blank line separators

Note: ESLint configuration is still present in this repo. This PR introduces Biome as the new linting/formatting tool, but we cannot fully cut over yet. Follow-up PRs will complete the migration from ESLint to Biome.

Other Changes

  • Switched to pnpm for package management
  • Updated SDK version to 0.2.2
  • Reformatted example files and tests to match new style

Test Plan

  • Run pnpm install to verify dependency installation
  • Run pnpm exec biome check to verify linting passes
  • Run pnpm exec tsc to verify type checking passes
  • Run existing tests to verify no regressions

The project was switched to pnpm but the GitHub Action was still
using npm caching, causing CI failures due to missing lock files.
@socket-security
Copy link

socket-security bot commented Dec 2, 2025

@socket-security
Copy link

socket-security bot commented Dec 2, 2025

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
License policy violation: npm caniuse-lite under CC-BY-4.0

License: CC-BY-4.0 - the applicable license policy does not allow this license (4) (npm metadata)

License: CC-BY-4.0 - the applicable license policy does not allow this license (4) (package/LICENSE)

License: CC-BY-4.0 - the applicable license policy does not allow this license (4) (package/package.json)

From: examples/nextjs-example/package.jsonnpm/next@15.5.4npm/caniuse-lite@1.0.30001757

ℹ Read more on: This package | This alert | What is a license policy violation?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Find a package that does not violate your license policy or adjust your policy to allow this package's license.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/caniuse-lite@1.0.30001757. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@mattapperson mattapperson requested a review from talos December 2, 2025 18:30
mattapperson and others added 4 commits December 2, 2025 13:32
The separate tsc typecheck for tests was failing due to issues with
Speakeasy-generated funcs files. This step is redundant since:
- pnpm run build already type-checks the source
- vitest handles type-checking when running tests
Speakeasy internally runs pnpm install which requires pnpm to be
installed in the CI environment.
@mattapperson mattapperson merged commit 8f471e0 into main Dec 2, 2025
2 checks passed
@mattapperson mattapperson deleted the updates branch December 2, 2025 18:47
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.

2 participants