{"_id":"@ai-universe/config-utils","_rev":"2-6eec7858fa1d951b372dfc080bee6a4d","name":"@ai-universe/config-utils","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@ai-universe/config-utils","version":"1.0.0","keywords":["configuration","gcp","secret-manager","firebase","ai-universe"],"author":{"name":"AI Universe Team"},"license":"MIT","_id":"@ai-universe/config-utils@1.0.0","maintainers":[{"name":"jleechan","email":"jleechan+npm@gmail.com"}],"dist":{"shasum":"82c42a8618fa6526c9ca8ac7363ae8cfb4cff234","tarball":"https://registry.npmjs.org/@ai-universe/config-utils/-/config-utils-1.0.0.tgz","fileCount":48,"integrity":"sha512-BDmEmYvwyaFtXI9BNAz58J8iSxFWzoGmhprTBoDMA1sYIl3sSyZp6yfasr6ZO6OcMKg38KZXEtvGPp6begt4SQ==","signatures":[{"sig":"MEQCIF7nS8MUhwaXlNNTZYWHPgGiNX7a3S1MAnN+xKX2+oeBAiBxLOGeKKWLXMZenhYMA5IRrRp50c4gOjxsukivlVevGg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":219527},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./dist/*":"./dist/*","./package.json":"./package.json"},"scripts":{"lint":"eslint src/ --ext .ts","test":"jest","build":"tsc","clean":"rm -rf dist","prepare":"node ../../scripts/run-build-if-ready.mjs","check:exports":"node ./scripts/check-exports.mjs"},"_npmUser":{"name":"jleechan","email":"jleechan+npm@gmail.com"},"_npmVersion":"8.19.4","description":"Shared configuration utilities for AI Universe ecosystem","directories":{},"_nodeVersion":"20.19.4","dependencies":{"winston":"^3.11.0","@google-cloud/firestore":"^7.11.3","@google-cloud/secret-manager":"^6.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","eslint":"^8.57.0","ts-jest":"^29.1.1","typescript":"^5.3.3","@types/jest":"^29.5.8","@types/node":"^20.14.9","@jest/globals":"^29.7.0","@typescript-eslint/parser":"^6.12.0","@typescript-eslint/eslint-plugin":"^6.12.0"},"_npmOperationalInternal":{"tmp":"tmp/config-utils_1.0.0_1762730599953_0.22869180998845406","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@ai-universe/config-utils","version":"1.0.1","description":"Shared configuration utilities for AI Universe ecosystem","type":"module","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"},"./dist/*":"./dist/*","./package.json":"./package.json"},"scripts":{"build":"tsc","prepare":"node ../../scripts/run-build-if-ready.mjs","check:exports":"node ./scripts/check-exports.mjs","test":"jest","lint":"eslint src/ --ext .ts","clean":"rm -rf dist"},"dependencies":{"@google-cloud/firestore":"^7.11.3","@google-cloud/secret-manager":"^6.1.0","winston":"^3.11.0"},"devDependencies":{"@jest/globals":"^29.7.0","@types/jest":"^29.5.8","@types/node":"^20.19.25","@typescript-eslint/eslint-plugin":"^6.12.0","@typescript-eslint/parser":"^6.12.0","eslint":"^8.57.0","jest":"^29.7.0","ts-jest":"^29.1.1","typescript":"^5.3.3"},"keywords":["configuration","gcp","secret-manager","firebase","ai-universe"],"author":{"name":"AI Universe Team"},"license":"MIT","engines":{"node":">=18"},"publishConfig":{"access":"public"},"_id":"@ai-universe/config-utils@1.0.1","_nodeVersion":"20.19.4","_npmVersion":"8.19.4","dist":{"integrity":"sha512-I5uJKPs7xtChtMF+cPaXJioct+mkF7xZs2Cy8DajDJAcmo0se3b9ahqr8n74afG+LV3D97Mo7ZSnh4X63GjQLQ==","shasum":"ac6d0377898615b8f9a0948ab60a9225aa769c19","tarball":"https://registry.npmjs.org/@ai-universe/config-utils/-/config-utils-1.0.1.tgz","fileCount":44,"unpackedSize":243563,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCga5Ihqlc185yv+GGbk6jrQsejzhrcSMAYclDYoxffoQIhANiOfnzhy98y4l8lFs9Did8Hu1iAv5VLTAepJ5k4ByhV"}]},"_npmUser":{"name":"jleechan","email":"jleechan+npm@gmail.com"},"directories":{},"maintainers":[{"name":"jleechan","email":"jleechan+npm@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/config-utils_1.0.1_1763755323426_0.5463146950581934"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-09T23:23:19.882Z","modified":"2025-11-21T20:02:03.887Z","1.0.0":"2025-11-09T23:23:20.157Z","1.0.1":"2025-11-21T20:02:03.670Z"},"author":{"name":"AI Universe Team"},"license":"MIT","keywords":["configuration","gcp","secret-manager","firebase","ai-universe"],"description":"Shared configuration utilities for AI Universe ecosystem","maintainers":[{"name":"jleechan","email":"jleechan+npm@gmail.com"}],"readme":"# @ai-universe/config-utils\n\nShared 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.\n\n## Features\n\n- **ConfigManager**: Unified configuration loading with GCP Secret Manager fallback\n- **SecretManager**: Google Cloud Secret Manager integration with caching\n- **RuntimeConfigService**: Dynamic configuration stored in Firestore\n- **Constants & Validation**: Shared limits, timeouts, and validation rules\n- **Type Safety**: Full TypeScript support with exported interfaces\n\n## Installation\n\n```bash\nnpm install @ai-universe/config-utils\n```\n\n## Usage\n\n### ConfigManager\n\n```typescript\nimport { ConfigManager, configManager } from '@ai-universe/config-utils';\n\n// Load complete application configuration\nconst config = await configManager.loadConfig();\nconsole.log('Server port:', config.server.port);\nconsole.log('API keys configured:', Object.keys(config.apiKeys));\n```\n\n### SecretManager\n\n```typescript\nimport { SecretManager } from '@ai-universe/config-utils';\n\nconst secretManager = new SecretManager('your-gcp-project');\nconst apiKey = await secretManager.getSecret('claude-api-key');\n```\n\n### RuntimeConfigService\n\n```typescript\nimport { runtimeConfigService } from '@ai-universe/config-utils';\n\n// Get current configuration\nconst runtimeConfig = await runtimeConfigService.getConfig();\nconsole.log('Rate limits:', runtimeConfig.rateLimit);\n\n// Update configuration\nawait runtimeConfigService.updateConfigValue('features', {\n  enableCerebras: true,\n  enableClaude: true\n});\n```\n\n### Constants & conversation defaults\n\n```typescript\nimport {\n  MAX_QUESTION_LENGTH,\n  DEFAULT_TIMEOUT_MS,\n  MODEL_SPECIFIC_LIMITS,\n  DEFAULT_SECONDARY_MODELS,\n  MAX_CLIENT_FINGERPRINT_LENGTH,\n  estimateTokens\n} from '@ai-universe/config-utils';\n\n// Validate input length\nif (userInput.length > MAX_QUESTION_LENGTH) {\n  throw new Error('Input too long');\n}\n\n// Estimate tokens\nconst tokenCount = estimateTokens(userInput.length);\n```\n\nAll constants from `SecondOpinionConfig.ts` are available through the package entry point so downstream consumers no longer need\nto deep import from `dist/SecondOpinionConfig.js`.\n\n## Verifying the public API\n\nAfter building the package, you can confirm that the published surface matches the TypeScript source by listing the exported keys\nfrom Node:\n\n```bash\nnpm run build\nnpm run check:exports\n```\n\nThe `check:exports` script executes [`scripts/check-exports.mjs`](./scripts/check-exports.mjs) to import the package entry point\nand print the sorted export keys. This helper is suitable as a lightweight regression check in CI to ensure the build artifact\nmatches the TypeScript source.\n\n## Extracted Code\n\nThis package contains 874 LOC extracted from AI Universe backend:\n\n- **ConfigManager.ts** (485 LOC) - Environment/API key/Firebase configuration\n- **SecretManager.ts** (171 LOC) - GCP Secret Manager integration\n- **RuntimeConfigService.ts** (218 LOC) - Dynamic Firestore configuration\n\n## API Reference\n\n### Types\n\n- `AppConfig` - Complete application configuration interface\n- `RuntimeConfig` - Dynamic runtime configuration interface\n- `ConfigSource` - Configuration value source tracking\n- `PrimaryModelName` - Supported AI model names\n\n### Constants\n\n- Input validation limits (MAX_QUESTION_LENGTH, etc.)\n- Timeout configurations (MIN/MAX/DEFAULT_TIMEOUT_MS)\n- Model-specific limits (MODEL_SPECIFIC_LIMITS)\n- Error messages (ERROR_MESSAGES)\n\n## Dependencies\n\n- `@google-cloud/secret-manager` - GCP Secret Manager client\n- `@google-cloud/firestore` - Firestore client\n- `winston` - Logging\n\n## License\n\nMIT","readmeFilename":"README.md"}