Package Manager Installation
Install the SDK using your preferred package manager:Peer Dependencies
The Gambiarra SDK requires the following peer dependencies:Vercel AI SDK (versions 4.x, 5.x, or 6.x)The AI SDK provides the core functionality for AI completions, streaming, and tool calling.
TypeScript 5.x (recommended)While not strictly required at runtime, TypeScript is highly recommended for full type safety.
Install Peer Dependencies
If you don’t have the AI SDK installed:TypeScript Configuration
For optimal type checking and import resolution, configure yourtsconfig.json:
tsconfig.json
Key Settings Explained
moduleResolution: bundler
moduleResolution: bundler
Use
"bundler" for modern bundlers (Vite, esbuild, webpack 5+) or "node16" for Node.js projects.strict: true
strict: true
Enables all strict type-checking options for maximum type safety with the SDK’s types.
esModuleInterop: true
esModuleInterop: true
Ensures compatibility with CommonJS modules and default imports.
Verify Installation
Create a test file to verify the SDK is installed correctly:test-sdk.ts
Environment Setup
Local Development
For local development, ensure you have a Gambiarra hub running:Environment Variables
Optionally set the default hub URL via environment variable:.env
Bun automatically loads
.env files. For Node.js, install dotenv or use Node 20.6+ with --env-file flag.Runtime Support
The Gambiarra SDK works with multiple JavaScript runtimes:Bun
Fully supported and recommended for best performance
Node.js
Requires Node.js 18+ with native fetch support
Edge Runtimes
Works with Vercel Edge, Cloudflare Workers, Deno
Bun (Recommended)
Node.js
Deno
Troubleshooting
Module not found: ai
Module not found: ai
The AI SDK peer dependency is not installed. Run:
Type errors with ParticipantInfo
Type errors with ParticipantInfo
Ensure TypeScript 5.x is installed and
strict: true is enabled in tsconfig.json.Cannot connect to hub
Cannot connect to hub
Verify a Gambiarra hub is running:Expected response:
{"status":"ok"}ESM import errors
ESM import errors
Ensure your
package.json has "type": "module" or use .mjs file extensions.Next Steps
Usage Guide
Learn how to use the SDK with practical examples
Quickstart
Build your first Gambiarra application