@bonginkan/maria 4.2.0 → 4.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,25 +4,26 @@
4
4
  [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
5
5
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.3.3-blue)](https://www.typescriptlang.org/)
6
6
  [![Node](https://img.shields.io/badge/Node-20.10.0+-green)](https://nodejs.org/)
7
- [![Commands](https://img.shields.io/badge/Commands-74-success)](docs/COMMANDS.md)
7
+ [![Commands](https://img.shields.io/badge/Commands-76-success)](docs/COMMANDS.md)
8
8
  [![Ready](https://img.shields.io/badge/Ready-100%25-brightgreen)](docs/ACHIEVEMENT_REPORT_20250902.md)
9
9
 
10
10
  > **Enterprise-grade AI development platform with 100% command availability and comprehensive fallback support**
11
11
 
12
- ## 🚀 What's New in v4.2.0
12
+ ## 🚀 What's New in v4.2.0 (September 2, 2025)
13
13
 
14
14
  ### ✨ Major Achievements
15
- - **100% READY Status**: All 74 commands fully operational
16
- - **Zero Dependencies**: Complete fallback implementation for all external services
17
- - **Local LLM Support**: Full LM Studio integration for offline AI
18
- - **Enterprise Security**: Quantum-resistant cryptography and zero-trust architecture
19
-
20
- ### 🎯 Key Features
21
- - **Natural Language Coding**: Transform ideas into code with `/code` command
22
- - **AI Safety Evaluation**: Built-in safety checks with `/safety/check`
23
- - **Intelligent Evolution**: Self-improving system with `/evolve`
24
- - **Memory Management**: Episodic memory with PII masking
25
- - **Real-time Monitoring**: Live dashboard with `/intelligence/dashboard`
15
+ - **100% READY Status**: All 76 commands fully operational (Week 2 Enterprise Systems)
16
+ - **UIR System**: Universal Intelligence Router with enterprise governance
17
+ - **Real-time Dashboard**: Live usage monitoring with WebSocket integration
18
+ - **Firebase Functions**: Serverless backend with auto-scaling
19
+ - **Enhanced Telemetry**: BigQuery analytics with Firestore sync
20
+
21
+ ### 🎯 Week 2 Enterprise Features
22
+ - **Safety Evaluation** (`/safety/check`): PII detection, malicious content filtering
23
+ - **Test Suite Execution** (`/evaluation/run`): Comprehensive testing with regression analysis
24
+ - **Health Monitoring** (`/system/health`): System metrics, trend analysis, predictive alerts
25
+ - **Performance Monitoring**: Real-time latency tracking and optimization
26
+ - **Security Compliance**: RBAC, audit logging, quantum-resistant crypto
26
27
  **全V2参照の削除完了** - 180個以上のV2命名規則を完全に削除し、統一された命名規則を実現。SlashCommand、RecallCommand、RememberCommandなど全コマンドが標準命名に移行完了。
27
28
 
28
29
  ## 🔐 Admin Dashboard with IAP (2025-09-01)
@@ -536,6 +537,59 @@ bq query --use_legacy_sql=false "
536
537
  - **5つの主要メトリクス**: エラー率、P95レイテンシ、レート制限、プラン分布、バージョン健全性
537
538
  - **アラート設定**: 閾値超過時の自動通知
538
539
 
540
+ ## 🔐 Secret Manager Integration (Production Ready)
541
+
542
+ ### Google Cloud Secret Manager
543
+ **エンタープライズグレードのシークレット管理** - APIキーとセンシティブデータの安全な保管と管理を実現。環境変数の代わりにSecret Managerを使用することでセキュリティを大幅に向上。
544
+
545
+ #### 管理対象シークレット
546
+ - **groq-api-key**: Groq AI APIキー (Fast Inference)
547
+ - **openai-api-key**: OpenAI APIキー
548
+ - **anthropic-api-key**: Anthropic Claude APIキー
549
+ - **google-ai-api-key**: Google AI APIキー
550
+
551
+ #### Secret Manager利用方法
552
+ ```bash
553
+ # シークレット一覧確認
554
+ gcloud secrets list
555
+
556
+ # シークレット作成
557
+ echo -n "YOUR_API_KEY" | gcloud secrets create SECRET_NAME --data-file=-
558
+
559
+ # シークレットアクセス
560
+ gcloud secrets versions access latest --secret="SECRET_NAME"
561
+
562
+ # IAM権限付与(サービスアカウント用)
563
+ gcloud secrets add-iam-policy-binding SECRET_NAME \
564
+ --member="serviceAccount:SERVICE_ACCOUNT@PROJECT.iam.gserviceaccount.com" \
565
+ --role="roles/secretmanager.secretAccessor"
566
+ ```
567
+
568
+ #### コード実装
569
+ ```typescript
570
+ // Secret Manager自動統合
571
+ // src/providers/manager.ts
572
+ const secretManager = new SecretManagerIntegration({
573
+ projectId: 'maria-code-470602',
574
+ secrets: {
575
+ groq: 'groq-api-key',
576
+ openAI: 'openai-api-key',
577
+ anthropic: 'anthropic-api-key',
578
+ googleAI: 'google-ai-api-key'
579
+ }
580
+ });
581
+
582
+ // 自動フォールバック
583
+ // 1. Secret Manager → 2. 環境変数 → 3. デフォルト値
584
+ ```
585
+
586
+ #### セキュリティメリット
587
+ - **中央管理**: すべてのAPIキーをCloud Consoleで一元管理
588
+ - **アクセス制御**: IAMによる細かい権限管理
589
+ - **監査ログ**: 全アクセス履歴の自動記録
590
+ - **ローテーション**: APIキーの簡単な更新
591
+ - **暗号化**: 保存時・転送時の自動暗号化
592
+
539
593
  ### Performance & Developer Experience
540
594
  | System | Before | After v4.0.0 | Improvement |
541
595
  |--------|--------|--------------|-------------|
@@ -7099,6 +7099,202 @@ var init_base_provider = __esm({
7099
7099
  }
7100
7100
  });
7101
7101
 
7102
+ // src/services/intelligent-model-selector/SecretManagerIntegration.ts
7103
+ var SecretManagerIntegration_exports = {};
7104
+ __export(SecretManagerIntegration_exports, {
7105
+ SecretManagerIntegration: () => SecretManagerIntegration
7106
+ });
7107
+ var import_secret_manager, SecretManagerIntegration;
7108
+ var init_SecretManagerIntegration = __esm({
7109
+ "src/services/intelligent-model-selector/SecretManagerIntegration.ts"() {
7110
+ import_secret_manager = require("@google-cloud/secret-manager");
7111
+ SecretManagerIntegration = class {
7112
+ // 1 hour
7113
+ constructor(config2) {
7114
+ this.config = config2;
7115
+ this.client = new import_secret_manager.SecretManagerServiceClient();
7116
+ }
7117
+ client;
7118
+ cache = /* @__PURE__ */ new Map();
7119
+ cacheExpiry = /* @__PURE__ */ new Map();
7120
+ CACHE_TTL = 36e5;
7121
+ /**
7122
+ * Get API key from Secret Manager with caching
7123
+ */
7124
+ async getApiKey(provider) {
7125
+ const secretName = this.getSecretName(provider);
7126
+ if (!secretName) {
7127
+ return void 0;
7128
+ }
7129
+ const cached = this.getCachedSecret(secretName);
7130
+ if (cached) {
7131
+ return cached;
7132
+ }
7133
+ try {
7134
+ const name2 = `projects/${this.config.projectId}/secrets/${secretName}/versions/latest`;
7135
+ const [version] = await this.client.accessSecretVersion({ name: name2 });
7136
+ const payload = version.payload?.data;
7137
+ if (!payload) {
7138
+ console.error(`Secret ${secretName} has no payload`);
7139
+ return void 0;
7140
+ }
7141
+ const secret = payload.toString();
7142
+ this.cacheSecret(secretName, secret);
7143
+ return secret;
7144
+ } catch (error2) {
7145
+ if (error2.code !== 5) {
7146
+ console.error(`Failed to access secret ${secretName}:`, error2);
7147
+ }
7148
+ return this.getFallbackFromEnv(provider);
7149
+ }
7150
+ }
7151
+ /**
7152
+ * Get all API keys
7153
+ */
7154
+ async getAllApiKeys() {
7155
+ const [googleApiKey, openaiApiKey, anthropicApiKey, groqApiKey] = await Promise.all([
7156
+ this.getApiKey("google"),
7157
+ this.getApiKey("openai"),
7158
+ this.getApiKey("anthropic"),
7159
+ this.getApiKey("groq")
7160
+ ]);
7161
+ return {
7162
+ googleApiKey,
7163
+ openaiApiKey,
7164
+ anthropicApiKey,
7165
+ groqApiKey
7166
+ };
7167
+ }
7168
+ /**
7169
+ * Verify that required secrets exist
7170
+ */
7171
+ async verifySecrets() {
7172
+ const available = [];
7173
+ const missing = [];
7174
+ const providers = ["google", "openai", "anthropic", "groq"];
7175
+ for (const provider of providers) {
7176
+ const secretName = this.getSecretName(provider);
7177
+ if (!secretName) continue;
7178
+ try {
7179
+ const name2 = `projects/${this.config.projectId}/secrets/${secretName}`;
7180
+ await this.client.getSecret({ name: name2 });
7181
+ available.push(provider);
7182
+ } catch (error2) {
7183
+ missing.push(provider);
7184
+ }
7185
+ }
7186
+ return { available, missing };
7187
+ }
7188
+ /**
7189
+ * Create or update a secret
7190
+ */
7191
+ async createOrUpdateSecret(provider, apiKey) {
7192
+ const secretName = this.getSecretName(provider);
7193
+ if (!secretName) {
7194
+ return false;
7195
+ }
7196
+ const secretId = `projects/${this.config.projectId}/secrets/${secretName}`;
7197
+ try {
7198
+ let secretExists = false;
7199
+ try {
7200
+ await this.client.getSecret({ name: secretId });
7201
+ secretExists = true;
7202
+ } catch {
7203
+ secretExists = false;
7204
+ }
7205
+ if (!secretExists) {
7206
+ await this.client.createSecret({
7207
+ parent: `projects/${this.config.projectId}`,
7208
+ secretId: secretName,
7209
+ secret: {
7210
+ replication: {
7211
+ automatic: {}
7212
+ },
7213
+ labels: {
7214
+ service: "ims",
7215
+ provider
7216
+ }
7217
+ }
7218
+ });
7219
+ }
7220
+ await this.client.addSecretVersion({
7221
+ parent: secretId,
7222
+ payload: {
7223
+ data: Buffer.from(apiKey, "utf8")
7224
+ }
7225
+ });
7226
+ this.cache.delete(secretName);
7227
+ this.cacheExpiry.delete(secretName);
7228
+ return true;
7229
+ } catch (error2) {
7230
+ console.error(`Failed to create/update secret ${secretName}:`, error2);
7231
+ return false;
7232
+ }
7233
+ }
7234
+ /**
7235
+ * Get secret name for provider
7236
+ */
7237
+ getSecretName(provider) {
7238
+ switch (provider) {
7239
+ case "google":
7240
+ return this.config.secrets.googleAI || "google-ai-api-key";
7241
+ case "openai":
7242
+ return this.config.secrets.openAI || "openai-api-key";
7243
+ case "anthropic":
7244
+ return this.config.secrets.anthropic || "anthropic-api-key";
7245
+ case "groq":
7246
+ return this.config.secrets.groq || "groq-api-key";
7247
+ default:
7248
+ return void 0;
7249
+ }
7250
+ }
7251
+ /**
7252
+ * Get cached secret if valid
7253
+ */
7254
+ getCachedSecret(secretName) {
7255
+ const expiry = this.cacheExpiry.get(secretName);
7256
+ if (!expiry || Date.now() > expiry) {
7257
+ this.cache.delete(secretName);
7258
+ this.cacheExpiry.delete(secretName);
7259
+ return void 0;
7260
+ }
7261
+ return this.cache.get(secretName);
7262
+ }
7263
+ /**
7264
+ * Cache a secret
7265
+ */
7266
+ cacheSecret(secretName, value) {
7267
+ this.cache.set(secretName, value);
7268
+ this.cacheExpiry.set(secretName, Date.now() + this.CACHE_TTL);
7269
+ }
7270
+ /**
7271
+ * Get fallback from environment variable
7272
+ */
7273
+ getFallbackFromEnv(provider) {
7274
+ switch (provider) {
7275
+ case "google":
7276
+ return process.env.GOOGLE_AI_API_KEY;
7277
+ case "openai":
7278
+ return process.env.OPENAI_API_KEY;
7279
+ case "anthropic":
7280
+ return process.env.ANTHROPIC_API_KEY;
7281
+ case "groq":
7282
+ return process.env.GROQ_API_KEY;
7283
+ default:
7284
+ return void 0;
7285
+ }
7286
+ }
7287
+ /**
7288
+ * Clear cache
7289
+ */
7290
+ clearCache() {
7291
+ this.cache.clear();
7292
+ this.cacheExpiry.clear();
7293
+ }
7294
+ };
7295
+ }
7296
+ });
7297
+
7102
7298
  // src/providers/groq-provider.ts
7103
7299
  var groq_provider_exports = {};
7104
7300
  __export(groq_provider_exports, {
@@ -7485,13 +7681,32 @@ var init_manager = __esm({
7485
7681
  })
7486
7682
  );
7487
7683
  }
7488
- /** Register adapters based on env keys (OpenAI is real, others placeholder but safe) */
7684
+ /** Register adapters based on Secret Manager or env keys */
7489
7685
  async initializeProviders() {
7490
- const OPENAI_API_KEY = process.env.OPENAI_API_KEY;
7491
- const ANTHROPIC_API_KEY = process.env.ANTHROPIC_API_KEY;
7492
- const GOOGLE_API_KEY = process.env.GOOGLE_API_KEY || process.env.GOOGLE_AI_API_KEY;
7493
- const GROQ_API_KEY = process.env.GROQ_API_KEY;
7686
+ let OPENAI_API_KEY = process.env.OPENAI_API_KEY;
7687
+ let ANTHROPIC_API_KEY = process.env.ANTHROPIC_API_KEY;
7688
+ let GOOGLE_API_KEY = process.env.GOOGLE_API_KEY || process.env.GOOGLE_AI_API_KEY;
7689
+ let GROQ_API_KEY = process.env.GROQ_API_KEY;
7494
7690
  const GROK_API_KEY = process.env.GROK_API_KEY || process.env.XAI_API_KEY;
7691
+ try {
7692
+ const { SecretManagerIntegration: SecretManagerIntegration2 } = await Promise.resolve().then(() => (init_SecretManagerIntegration(), SecretManagerIntegration_exports));
7693
+ const secretManager = new SecretManagerIntegration2({
7694
+ projectId: process.env.GOOGLE_CLOUD_PROJECT || "maria-code-470602",
7695
+ secrets: {
7696
+ openAI: "openai-api-key",
7697
+ anthropic: "anthropic-api-key",
7698
+ googleAI: "google-ai-api-key",
7699
+ groq: "groq-api-key"
7700
+ }
7701
+ });
7702
+ const keys = await secretManager.getAllApiKeys();
7703
+ OPENAI_API_KEY = keys.openaiApiKey || OPENAI_API_KEY;
7704
+ ANTHROPIC_API_KEY = keys.anthropicApiKey || ANTHROPIC_API_KEY;
7705
+ GOOGLE_API_KEY = keys.googleApiKey || GOOGLE_API_KEY;
7706
+ GROQ_API_KEY = keys.groqApiKey || GROQ_API_KEY;
7707
+ } catch (error2) {
7708
+ console.debug("Secret Manager not available, using environment variables");
7709
+ }
7495
7710
  if (OPENAI_API_KEY) this.register(new UnifiedOpenAIProvider(OPENAI_API_KEY));
7496
7711
  if (ANTHROPIC_API_KEY) this.register(new UnifiedAnthropicProvider(ANTHROPIC_API_KEY));
7497
7712
  if (GOOGLE_API_KEY) this.register(new UnifiedGoogleProvider(GOOGLE_API_KEY));
@@ -21552,7 +21767,7 @@ var init_package = __esm({
21552
21767
  "package.json"() {
21553
21768
  package_default = {
21554
21769
  name: "@bonginkan/maria",
21555
- version: "4.2.0",
21770
+ version: "4.2.2",
21556
21771
  description: "\u{1F680} MARIA v4.2.0 - Enterprise AI Development Platform with 100% Command Availability. Features 74 production-ready commands with comprehensive fallback implementation, local LLM support, and zero external dependencies. Includes natural language coding, AI safety evaluation, intelligent evolution system, episodic memory with PII masking, and real-time monitoring dashboard. Built with TypeScript AST-powered code generation, OAuth2.0 + PKCE authentication, quantum-resistant cryptography, and enterprise-grade performance.",
21557
21772
  keywords: [
21558
21773
  "ai",
@@ -27741,7 +27956,7 @@ var init_bigquery_telemetry = __esm({
27741
27956
  httpEndpoint = null;
27742
27957
  config = {
27743
27958
  projectId: process.env.GOOGLE_CLOUD_PROJECT || "maria-code-470602",
27744
- datasetId: "cli",
27959
+ datasetId: "maria_telemetry",
27745
27960
  tableName: "command_executions",
27746
27961
  batchSize: 100,
27747
27962
  flushIntervalMs: 3e4,