@bonginkan/maria 4.2.7 → 4.2.9

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/dist/cli.cjs CHANGED
@@ -9469,15 +9469,36 @@ var SecretManagerIntegration;
9469
9469
  var init_SecretManagerIntegration = __esm({
9470
9470
  "src/services/intelligent-model-selector/SecretManagerIntegration.ts"() {
9471
9471
  SecretManagerIntegration = class {
9472
- // 1 hour
9473
9472
  constructor(config2) {
9474
9473
  this.config = config2;
9475
- this.client = new secretManager.SecretManagerServiceClient();
9474
+ this.useGsm = this.shouldUseGsm();
9476
9475
  }
9477
- client;
9476
+ client = null;
9478
9477
  cache = /* @__PURE__ */ new Map();
9479
9478
  cacheExpiry = /* @__PURE__ */ new Map();
9480
9479
  CACHE_TTL = 36e5;
9480
+ // 1 hour
9481
+ useGsm;
9482
+ /** Determine whether GSM should be used in this environment */
9483
+ shouldUseGsm() {
9484
+ if (process.env.MARIA_DISABLE_GSM === "true") return false;
9485
+ if (process.env.GOOGLE_APPLICATION_CREDENTIALS) return true;
9486
+ if (process.env.GOOGLE_CLOUD_PROJECT || process.env.GCLOUD_PROJECT) return true;
9487
+ if (process.env.CLOUD_RUN_SERVICE || process.env.K_SERVICE) return true;
9488
+ if (process.env.GCE_METADATA_HOST) return true;
9489
+ return false;
9490
+ }
9491
+ /** Lazily create Secret Manager client only when permitted */
9492
+ ensureClient() {
9493
+ if (!this.useGsm) return null;
9494
+ if (this.client) return this.client;
9495
+ try {
9496
+ this.client = new secretManager.SecretManagerServiceClient();
9497
+ } catch {
9498
+ this.client = null;
9499
+ }
9500
+ return this.client;
9501
+ }
9481
9502
  /**
9482
9503
  * Get API key from Secret Manager with caching
9483
9504
  */
@@ -9486,13 +9507,17 @@ var init_SecretManagerIntegration = __esm({
9486
9507
  if (!secretName) {
9487
9508
  return void 0;
9488
9509
  }
9510
+ const client = this.ensureClient();
9511
+ if (!client) {
9512
+ return this.getFallbackFromEnv(provider);
9513
+ }
9489
9514
  const cached = this.getCachedSecret(secretName);
9490
9515
  if (cached) {
9491
9516
  return cached;
9492
9517
  }
9493
9518
  try {
9494
9519
  const name2 = `projects/${this.config.projectId}/secrets/${secretName}/versions/latest`;
9495
- const [version] = await this.client.accessSecretVersion({ name: name2 });
9520
+ const [version] = await client.accessSecretVersion({ name: name2 });
9496
9521
  const payload = version.payload?.data;
9497
9522
  if (!payload) {
9498
9523
  return void 0;
@@ -9525,6 +9550,10 @@ var init_SecretManagerIntegration = __esm({
9525
9550
  * Verify that required secrets exist
9526
9551
  */
9527
9552
  async verifySecrets() {
9553
+ const client = this.ensureClient();
9554
+ if (!client) {
9555
+ return { available: [], missing: [] };
9556
+ }
9528
9557
  const available = [];
9529
9558
  const missing = [];
9530
9559
  const providers = ["google", "openai", "anthropic", "groq"];
@@ -9533,7 +9562,7 @@ var init_SecretManagerIntegration = __esm({
9533
9562
  if (!secretName) continue;
9534
9563
  try {
9535
9564
  const name2 = `projects/${this.config.projectId}/secrets/${secretName}`;
9536
- await this.client.getSecret({ name: name2 });
9565
+ await client.getSecret({ name: name2 });
9537
9566
  available.push(provider);
9538
9567
  } catch (error2) {
9539
9568
  missing.push(provider);
@@ -9549,17 +9578,21 @@ var init_SecretManagerIntegration = __esm({
9549
9578
  if (!secretName) {
9550
9579
  return false;
9551
9580
  }
9581
+ const client = this.ensureClient();
9582
+ if (!client) {
9583
+ return false;
9584
+ }
9552
9585
  const secretId = `projects/${this.config.projectId}/secrets/${secretName}`;
9553
9586
  try {
9554
9587
  let secretExists = false;
9555
9588
  try {
9556
- await this.client.getSecret({ name: secretId });
9589
+ await client.getSecret({ name: secretId });
9557
9590
  secretExists = true;
9558
9591
  } catch {
9559
9592
  secretExists = false;
9560
9593
  }
9561
9594
  if (!secretExists) {
9562
- await this.client.createSecret({
9595
+ await client.createSecret({
9563
9596
  parent: `projects/${this.config.projectId}`,
9564
9597
  secretId: secretName,
9565
9598
  secret: {
@@ -9573,7 +9606,7 @@ var init_SecretManagerIntegration = __esm({
9573
9606
  }
9574
9607
  });
9575
9608
  }
9576
- await this.client.addSecretVersion({
9609
+ await client.addSecretVersion({
9577
9610
  parent: secretId,
9578
9611
  payload: {
9579
9612
  data: Buffer.from(apiKey, "utf8")
@@ -11873,8 +11906,11 @@ var init_autocomplete_dropdown = __esm({
11873
11906
  const isSelected = index === this.selectedIndex;
11874
11907
  const prefix = isSelected ? chalk17__default.default.cyan("\u25BA ") : " ";
11875
11908
  const nameStyle = isSelected ? chalk17__default.default.inverse : (s2) => s2;
11876
- const displayName = suggestion.name.padEnd(20);
11877
- const displayDesc = suggestion.description.length > 30 ? suggestion.description.substring(0, 27) + "..." : suggestion.description.padEnd(30);
11909
+ const safeName = (suggestion?.name ?? "").toString();
11910
+ const safeDescRaw = suggestion?.description ?? "";
11911
+ const safeDesc = typeof safeDescRaw === "string" ? safeDescRaw : String(safeDescRaw ?? "");
11912
+ const displayName = safeName.padEnd(20);
11913
+ const displayDesc = safeDesc.length > 30 ? safeDesc.substring(0, 27) + "..." : safeDesc.padEnd(30);
11878
11914
  const line = `\u2502${prefix}${nameStyle(chalk17__default.default.white(displayName) + " " + chalk17__default.default.gray(displayDesc))} \u2502`;
11879
11915
  process.stdout.write("\x1B[K" + line + "\n");
11880
11916
  });
@@ -31583,8 +31619,8 @@ var init_package = __esm({
31583
31619
  "package.json"() {
31584
31620
  package_default = {
31585
31621
  name: "@bonginkan/maria",
31586
- version: "4.2.7",
31587
- 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.",
31622
+ version: "4.2.9",
31623
+ description: "\u{1F680} MARIA v4.2.9 - 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.",
31588
31624
  keywords: [
31589
31625
  "ai",
31590
31626
  "cli",