Skip to content

feat: Make SSE mode the default transport#7

Merged
wtfsayo merged 4 commits intomainfrom
feat/sse-default-mode
Nov 10, 2025
Merged

feat: Make SSE mode the default transport#7
wtfsayo merged 4 commits intomainfrom
feat/sse-default-mode

Conversation

@wtfsayo
Copy link
Copy Markdown
Member

@wtfsayo wtfsayo commented Nov 10, 2025

Summary

This PR changes the default transport mode from STDIO to SSE, making the gateway HTTP/network-accessible by default with proper x402 payment support.

Changes

Core Changes

  • Default mode is now SSE (HTTP/SSE server on port 8000)
  • ✅ Added --mode=sse|stdio flag to choose transport mode
  • ✅ Added --port=<number> flag for SSE mode
  • ✅ Updated package.json scripts:
    • start/dev → SSE mode (default)
    • start:stdio/dev:stdio → STDIO mode

Bug Fixes

  • ✅ Fixed HTTPGatewayWrapper subprocess to use --mode=stdio (prevented port conflict)

Testing & Documentation

  • ✅ Updated all test files to explicitly use --mode=stdio
  • ✅ Updated test-runner.sh for STDIO mode
  • ✅ Updated CLAUDE.md with dual-mode architecture
  • ✅ Added SSE_DEFAULT_MIGRATION.md migration guide
  • ✅ Simplified run-gateway-sse.sh to use main entry point

Breaking Changes

⚠️ Default behavior changed: Running bun run src/index.ts --config=config.yaml without --mode flag now starts SSE mode instead of STDIO mode.

Migration: Add --mode=stdio to existing STDIO integrations.

Benefits

  1. Better defaults: SSE mode is the primary use case for network-accessible gateways
  2. x402 payment support: HTTP layer can return proper 402 status codes
  3. Network access: Can be accessed by remote agents and clients
  4. Backward compatible: STDIO mode still fully supported via --mode=stdio

Testing

All existing tests pass with explicit --mode=stdio flag. SSE mode tested with:

  • ./example-agents/run-gateway-sse.sh
  • bun run example-agents/ai16z-price-agent-sse.ts

Files Changed

  • src/index.ts - Added dual-mode support
  • src/transports/http-wrapper.ts - Fixed subprocess to use --mode=stdio
  • package.json - Updated scripts
  • CLAUDE.md - Updated documentation
  • example-agents/run-gateway-sse.sh - Simplified to use main entry
  • All test files - Added --mode=stdio
  • tests/test-runner.sh - Added --mode=stdio to test commands
  • SSE_DEFAULT_MIGRATION.md - Migration guide (new file)

- Changed default mode from STDIO to SSE for better HTTP/x402 support
- Added --mode flag to choose between 'sse' (default) and 'stdio'
- Added --port flag for SSE mode (default: 8000)
- Updated all tests to explicitly use --mode=stdio
- Fixed HTTPGatewayWrapper subprocess to use STDIO mode
- Updated package.json scripts: start/dev (SSE), start:stdio/dev:stdio
- Updated documentation in CLAUDE.md
- Added SSE_DEFAULT_MIGRATION.md with migration guide

BREAKING CHANGE: Default mode is now SSE instead of STDIO.
Existing STDIO integrations must add --mode=stdio flag.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Nov 10, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/sse-default-mode

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Introduces a Bun-based build script to package.json for building the project and deletes tsconfig.json, indicating a shift away from TypeScript's tsc configuration in favor of Bun's build tooling.
Modified package.json start scripts to run from the build directory with a specific config file and port. Updated HTTPGatewayWrapper to launch the subprocess using the currently executing script path, ensuring compatibility with both source and build environments.
Added logging of the gateway subprocess command in HTTPGatewayWrapper for better visibility. Updated package.json start scripts to run from source files instead of build output.
@wtfsayo wtfsayo merged commit 3875b08 into main Nov 10, 2025
1 check passed
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.

1 participant