New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@ai-universe/config-utils

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ai-universe/config-utils

Shared configuration utilities for AI Universe ecosystem

latest
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

@ai-universe/config-utils

Shared configuration utilities for the AI Universe ecosystem. This package provides centralized configuration management with support for environment variables, GCP Secret Manager, and Firestore-based runtime configuration.

Features

  • ConfigManager: Unified configuration loading with GCP Secret Manager fallback
  • SecretManager: Google Cloud Secret Manager integration with caching
  • RuntimeConfigService: Dynamic configuration stored in Firestore
  • Constants & Validation: Shared limits, timeouts, and validation rules
  • Type Safety: Full TypeScript support with exported interfaces

Installation

npm install @ai-universe/config-utils

Usage

ConfigManager

import { ConfigManager, configManager } from '@ai-universe/config-utils';

// Load complete application configuration
const config = await configManager.loadConfig();
console.log('Server port:', config.server.port);
console.log('API keys configured:', Object.keys(config.apiKeys));

SecretManager

import { SecretManager } from '@ai-universe/config-utils';

const secretManager = new SecretManager('your-gcp-project');
const apiKey = await secretManager.getSecret('claude-api-key');

RuntimeConfigService

import { runtimeConfigService } from '@ai-universe/config-utils';

// Get current configuration
const runtimeConfig = await runtimeConfigService.getConfig();
console.log('Rate limits:', runtimeConfig.rateLimit);

// Update configuration
await runtimeConfigService.updateConfigValue('features', {
  enableCerebras: true,
  enableClaude: true
});

Constants & conversation defaults

import {
  MAX_QUESTION_LENGTH,
  DEFAULT_TIMEOUT_MS,
  MODEL_SPECIFIC_LIMITS,
  DEFAULT_SECONDARY_MODELS,
  MAX_CLIENT_FINGERPRINT_LENGTH,
  estimateTokens
} from '@ai-universe/config-utils';

// Validate input length
if (userInput.length > MAX_QUESTION_LENGTH) {
  throw new Error('Input too long');
}

// Estimate tokens
const tokenCount = estimateTokens(userInput.length);

All constants from SecondOpinionConfig.ts are available through the package entry point so downstream consumers no longer need to deep import from dist/SecondOpinionConfig.js.

Verifying the public API

After building the package, you can confirm that the published surface matches the TypeScript source by listing the exported keys from Node:

npm run build
npm run check:exports

The check:exports script executes scripts/check-exports.mjs to import the package entry point and print the sorted export keys. This helper is suitable as a lightweight regression check in CI to ensure the build artifact matches the TypeScript source.

Extracted Code

This package contains 874 LOC extracted from AI Universe backend:

  • ConfigManager.ts (485 LOC) - Environment/API key/Firebase configuration
  • SecretManager.ts (171 LOC) - GCP Secret Manager integration
  • RuntimeConfigService.ts (218 LOC) - Dynamic Firestore configuration

API Reference

Types

  • AppConfig - Complete application configuration interface
  • RuntimeConfig - Dynamic runtime configuration interface
  • ConfigSource - Configuration value source tracking
  • PrimaryModelName - Supported AI model names

Constants

  • Input validation limits (MAX_QUESTION_LENGTH, etc.)
  • Timeout configurations (MIN/MAX/DEFAULT_TIMEOUT_MS)
  • Model-specific limits (MODEL_SPECIFIC_LIMITS)
  • Error messages (ERROR_MESSAGES)

Dependencies

  • @google-cloud/secret-manager - GCP Secret Manager client
  • @google-cloud/firestore - Firestore client
  • winston - Logging

License

MIT

Keywords

configuration

FAQs

Package last updated on 21 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts