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

@revenium/google-core

v0.2.3

Published

Core utilities for Revenium Google middleware packages

Readme

@revenium/google-core

Core utilities and shared functionality for Revenium Google middleware packages.

Overview

This package provides the foundational components used by @revenium/google-genai and @revenium/google-vertex middleware packages. It is designed as an internal dependency and is not intended for direct use in applications.

What's Included

  • Logger - Configurable logging system for middleware operations
  • Metering - Core metering and tracking functionality
  • Revenium Client - HTTP client for Revenium API communication
  • Types - Shared TypeScript interfaces and types
  • Utilities - Common helper functions and tools

Installation

This package is automatically installed as a dependency when you install @revenium/google-genai or @revenium/google-vertex:

npm install @revenium/google-genai
# or
npm install @revenium/google-vertex

You typically do not need to install this package directly.

Usage

This package is consumed internally by the middleware packages. If you're building applications, you should use @revenium/google-genai or @revenium/google-vertex instead.

For middleware package developers:

import { Logger, Metering, ReveniumClient } from "@revenium/google-core";

Tool Metering

Track execution of custom tools and external API calls with automatic timing, error handling, and metadata collection.

Quick Example

import { meterTool, setToolContext } from "@revenium/google-core";

// Set context once (propagates to all tool calls)
setToolContext({
  agent: "my-agent",
  traceId: "session-123"
});

// Wrap tool execution
const result = await meterTool("weather-api", async () => {
  return await fetch("https://api.example.com/weather");
}, {
  operation: "get_forecast",
  outputFields: ["temperature", "humidity"]
});
// Automatically extracts temperature & humidity from result

Functions

meterTool(toolId, fn, metadata?)

  • Wraps a function with automatic metering
  • Captures duration, success/failure, and errors
  • Returns function result unchanged

reportToolCall(toolId, report)

  • Manually report a tool call that was already executed
  • Useful when wrapping isn't possible

Context Management

  • setToolContext(ctx) - Set context for all subsequent tool calls
  • getToolContext() - Get current context
  • clearToolContext() - Clear context
  • runWithToolContext(ctx, fn) - Run function with scoped context

Metadata Options

| Field | Description | |-------|-------------| | operation | Tool operation name (e.g., "search", "scrape") | | outputFields | Array of field names to auto-extract from result | | usageMetadata | Custom metrics (e.g., tokens, results count) | | agent, traceId, etc. | Context fields (inherited from setToolContext) |

Configuration

The core package respects the following environment variables:

  • REVENIUM_METERING_API_KEY - API key for Revenium service
  • REVENIUM_METERING_BASE_URL - Base URL for Revenium API (default: https://api.revenium.ai)
  • REVENIUM_LOG_LEVEL - Logging level (DEBUG, INFO, WARN, ERROR)

Package Information

Related Packages

Documentation

For complete documentation, see:

Support

For issues, feature requests, or contributions:

Contributing

See CONTRIBUTING.md

Security

See SECURITY.md