npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@makaio/adapter-gemini-sdk

v1.0.0-dev-1779051654000

Published

Gemini SDK adapter for Makaio AI framework

Readme

@makaio/adapter-gemini-sdk

Google Gemini SDK adapter for the Makaio AI framework.

Quick Start

import { createGeminiSDKAdapter, GeminiAdapter } from '@makaio/adapter-gemini-sdk';
import { MakaioBus } from '@makaio/bus-core';
import { AdapterSubjects } from '@makaio/contracts';

// Using the factory function (recommended)
const adapter = await createGeminiSDKAdapter();

const result = await MakaioBus.request(AdapterSubjects.startAgent, {
  adapterId: adapter.adapterId,
  role: 'lead',
  initialMessage: 'Inspect this repository',
});

// Or using the class directly
const directAdapter = new GeminiAdapter();
await directAdapter.init();

Architecture

This adapter follows the three-layer architecture pattern:

GeminiAdapter extends AIAdapter
    -> creates via agentFactory()
GeminiAgent extends AIAgent
    -> receives connector via connectorFactory()
GeminiConnector extends AIAgentConnector

Layers:

| Layer | Class | Responsibility | |-------|-------|----------------| | Adapter | GeminiAdapter | Factory for agents, handles adapter.startAgent RPC | | Agent | GeminiAgent | Wires events to global bus, manages lifecycle | | Connector | GeminiConnector | SDK-level bridge to Google Gemini |

Session/Turn Management:

| Class | Purpose | |-------|---------| | GeminiConnectorSession | Session lifecycle, prompt cache preservation | | GeminiConnectorTurn | Individual turn handling | | UserMessageQueue | Internal connector queue from adapter core |

Capabilities

  • tools - Tool/function calling support
  • streaming - Streaming responses
  • systemPrompt:override - Replace/set the system prompt
  • systemPrompt:append - Append to the adapter's default system prompt
  • Tool approval workflow via registerToolApprovalHandler
  • Replace and interrupt delivery modes

Exports

Adapter

| Export | Description | |--------|-------------| | GeminiAdapter | Main adapter class | | createGeminiSDKAdapter | Factory function (creates and initializes) | | GeminiSdkAdapterName | Adapter identifier constant |

Agent & Connector

| Export | Description | |--------|-------------| | GeminiAgent | Agent class (middle layer) | | GeminiConnector | Connector class (SDK bridge) | | GeminiAgentLegacy | Legacy alias for GeminiConnector |

Session Management

| Export | Description | |--------|-------------| | GeminiConnectorSession | Session abstraction | | GeminiConnectorTurn | Turn abstraction | | UserMessageQueue | Internal connector queue from adapter core |

Namespaces & Types

| Export | Description | |--------|-------------| | GeminiConnectorNamespace | Bus namespace for connector events | | GeminiConnectorSubjects | Subject constants for bus messaging | | GeminiAgentMetadata | Agent metadata type | | GeminiConnectorConfig | Connector configuration type | | GeminiAgentConnectorConfig | Agent connector config type | | GeminiSessionConfig | Session configuration type |

Tool Handling

| Export | Description | |--------|-------------| | registerToolApprovalHandler | Register handler for tool approval requests | | requestToolApproval | Request tool approval | | toGlobalToolApproval | Convert to global approval format | | fromGlobalToolApproval | Convert from global approval format |

Configuration & Schemas

| Export | Description | |--------|-------------| | GeminiSdkProviderConfigSchema | Zod schema for provider config |

Prerequisites and Authentication

Install the peer SDK packages provided by the framework workspace or your package manager. Runtime sessions require Google Gemini credentials. The adapter supports:

  • API-key auth via the canonical Google provider credential, mapped to GEMINI_API_KEY.
  • OAuth auth via the google-oauth provider path used by the Gemini CLI core.

If an API-key credential ref is configured, the adapter uses API-key auth and fails fast when the resolved key is empty. OAuth fallback is used only when no API-key credential is supplied.

File Structure

src/
├── index.ts              # Package exports
├── adapter.ts            # GeminiAdapter class
├── agent.ts              # GeminiAgent class
├── connector.ts          # GeminiConnector class
├── session.ts            # Session management
├── turn.ts               # Turn management
├── config.ts             # Configuration utilities
├── constants.ts          # Adapter constants
├── definition.ts         # Internal adapter definition
├── models.ts             # Model catalog
├── package.ts            # MakaioExtension package descriptor
├── provider.ts           # Provider registration
├── provider.fetcher.ts   # Model fetcher
├── rate-limiter.ts       # Rate limiting
├── server.ts             # Server entrypoint exporting the package descriptor
├── schemas.ts            # Zod schemas
├── tool-handling.ts      # Tool approval utilities
├── namespaces/           # Bus namespace definitions
├── types/                # TypeScript types
└── utils/                # Utility functions

Part of the Makaio AI framework