@bonginkan/maria 4.3.33 → 4.3.35

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.
@@ -26066,8 +26066,8 @@ var require_package = __commonJS({
26066
26066
  "package.json"(exports, module) {
26067
26067
  module.exports = {
26068
26068
  name: "@bonginkan/maria",
26069
- version: "4.3.33",
26070
- description: "\u{1F680} MARIA v4.3.33 - Enterprise AI Development Platform with identity system and character voice implementation. 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.",
26069
+ version: "4.3.35",
26070
+ description: "\u{1F680} MARIA v4.3.35 - Enterprise AI Development Platform with identity system and character voice implementation. 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.",
26071
26071
  keywords: [
26072
26072
  "ai",
26073
26073
  "cli",
@@ -26503,7 +26503,7 @@ var require_package = __commonJS({
26503
26503
  react: "^18.2.0",
26504
26504
  "reflect-metadata": "^0.2.2",
26505
26505
  semver: "^7.7.2",
26506
- sharp: "^0.34.3",
26506
+ sharp: "^0.34.4",
26507
26507
  "string-width": "^8.0.0",
26508
26508
  "strip-ansi": "^7.1.0",
26509
26509
  "tesseract.js": "^6.0.1",
@@ -27781,25 +27781,29 @@ var init_AuthSecretManager = __esm({
27781
27781
  constructor() {
27782
27782
  this.projectId = process.env.GCLOUD_PROJECT || "maria-code-470602";
27783
27783
  this.useGsm = this.shouldUseGsm();
27784
- if (this.useGsm) {
27785
- try {
27786
- this.client = new secretManager.SecretManagerServiceClient();
27787
- } catch {
27788
- this.client = null;
27789
- }
27790
- }
27784
+ this.client = null;
27791
27785
  }
27792
27786
  /**
27793
27787
  * Determine whether to use Google Secret Manager in this environment
27794
27788
  */
27795
27789
  shouldUseGsm() {
27796
27790
  if (process.env.MARIA_DISABLE_GSM === "true") return false;
27791
+ if (process.env.MARIA_CLI_USE_GSM === "true") return true;
27797
27792
  if (process.env.GOOGLE_APPLICATION_CREDENTIALS) return true;
27798
- if (process.env.GOOGLE_CLOUD_PROJECT || process.env.GCLOUD_PROJECT) return true;
27799
- if (process.env.CLOUD_RUN_SERVICE || process.env.K_SERVICE) return true;
27800
- if (process.env.GCE_METADATA_HOST) return true;
27793
+ if (process.env.CLOUD_RUN_SERVICE || process.env.K_SERVICE || process.env.GCE_METADATA_HOST) return true;
27801
27794
  return false;
27802
27795
  }
27796
+ /** Lazily create Secret Manager client only when permitted */
27797
+ ensureClient() {
27798
+ if (!this.useGsm) return null;
27799
+ if (this.client) return this.client;
27800
+ try {
27801
+ this.client = new secretManager.SecretManagerServiceClient();
27802
+ } catch {
27803
+ this.client = null;
27804
+ }
27805
+ return this.client;
27806
+ }
27803
27807
  /**
27804
27808
  * Get authentication configuration from Secret Manager
27805
27809
  */
@@ -27819,7 +27823,8 @@ var init_AuthSecretManager = __esm({
27819
27823
  * Get a specific secret from Secret Manager
27820
27824
  */
27821
27825
  async getSecret(secretName) {
27822
- if (!this.useGsm || !this.client) {
27826
+ const client = this.ensureClient();
27827
+ if (!this.useGsm || !client) {
27823
27828
  return null;
27824
27829
  }
27825
27830
  const cached2 = this.getCachedSecret(secretName);
@@ -27828,7 +27833,7 @@ var init_AuthSecretManager = __esm({
27828
27833
  }
27829
27834
  try {
27830
27835
  const name2 = `projects/${this.projectId}/secrets/${secretName}/versions/latest`;
27831
- const [version] = await this.client.accessSecretVersion({ name: name2 });
27836
+ const [version] = await client.accessSecretVersion({ name: name2 });
27832
27837
  const payload = version.payload?.data;
27833
27838
  if (!payload) {
27834
27839
  return null;
@@ -28099,7 +28104,7 @@ var init_AuthenticationManager = __esm({
28099
28104
  const response = await fetch(`${this.apiBase}/api/user/profile`, {
28100
28105
  headers: {
28101
28106
  "Authorization": `Bearer ${tokens2.accessToken}`,
28102
- "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.33"}`
28107
+ "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.35"}`
28103
28108
  }
28104
28109
  });
28105
28110
  if (response.status === 401) {
@@ -28731,7 +28736,7 @@ async function callApi(path64, init3 = {}) {
28731
28736
  "Authorization": `Bearer ${token}`,
28732
28737
  "X-Device-Id": getDeviceId(),
28733
28738
  "X-Session-Id": getSessionId() || "",
28734
- "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.33"}`,
28739
+ "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.35"}`,
28735
28740
  "Content-Type": init3.headers?.["Content-Type"] || "application/json"
28736
28741
  });
28737
28742
  const doFetch = async (token) => {
@@ -37153,6 +37158,13 @@ var init_logging = __esm({
37153
37158
  _loggingMiddleware = new LoggingMiddleware();
37154
37159
  }
37155
37160
  });
37161
+
37162
+ // src/services/telemetry/bigquery-telemetry.ts
37163
+ var bigquery_telemetry_exports = {};
37164
+ __export(bigquery_telemetry_exports, {
37165
+ BigQueryTelemetryService: () => BigQueryTelemetryService,
37166
+ bigQueryTelemetry: () => bigQueryTelemetry
37167
+ });
37156
37168
  async function loadBigQuery() {
37157
37169
  if (bigQueryLoadAttempted) return BigQuery;
37158
37170
  bigQueryLoadAttempted = true;
@@ -37218,7 +37230,7 @@ var init_bigquery_telemetry = __esm({
37218
37230
  };
37219
37231
  constructor() {
37220
37232
  super();
37221
- this.isEnabled = process.env.TELEMETRY_DISABLED !== "true";
37233
+ this.isEnabled = process.env.TELEMETRY_ENABLED === "true";
37222
37234
  this.httpEndpoint = process.env.TELEMETRY_ENDPOINT || null;
37223
37235
  if (this.isEnabled) {
37224
37236
  this.initialize().catch((error2) => {
@@ -37562,8 +37574,12 @@ async function getUserContext() {
37562
37574
  }
37563
37575
  async function trackCommand(data) {
37564
37576
  try {
37577
+ if (process.env.TELEMETRY_DISABLED === "true") {
37578
+ return;
37579
+ }
37565
37580
  const userContext = await getUserContext();
37566
- await bigQueryTelemetry.trackCommandExecution({
37581
+ const { bigQueryTelemetry: bigQueryTelemetry2 } = await Promise.resolve().then(() => (init_bigquery_telemetry(), bigquery_telemetry_exports));
37582
+ await bigQueryTelemetry2.trackCommandExecution({
37567
37583
  cmd: data.cmd,
37568
37584
  status: data.status,
37569
37585
  latencyMs: data.latencyMs,
@@ -37604,7 +37620,6 @@ function getNextMonthStart() {
37604
37620
  }
37605
37621
  var init_telemetry_helper = __esm({
37606
37622
  "src/slash-commands/shared/telemetry-helper.ts"() {
37607
- init_bigquery_telemetry();
37608
37623
  }
37609
37624
  });
37610
37625
 
@@ -37756,6 +37771,7 @@ var init_ReadyCommandsService = __esm({
37756
37771
  lastLoaded = null;
37757
37772
  manifestPath;
37758
37773
  usedFallback = false;
37774
+ helpMeta = {};
37759
37775
  constructor(manifestPath) {
37760
37776
  if (manifestPath) {
37761
37777
  this.manifestPath = manifestPath;
@@ -37839,14 +37855,57 @@ var init_ReadyCommandsService = __esm({
37839
37855
  this.buildLookupMaps();
37840
37856
  this.lastLoaded = /* @__PURE__ */ new Date();
37841
37857
  this.usedFallback = false;
37858
+ await this.tryLoadHelpMeta();
37842
37859
  } catch (error2) {
37843
37860
  logger.debug("READY manifest not found or invalid; using fallback");
37844
37861
  this.readyCommands = this.getFallbackCommands();
37845
37862
  this.buildLookupMaps();
37846
37863
  this.lastLoaded = /* @__PURE__ */ new Date();
37847
37864
  this.usedFallback = true;
37865
+ await this.tryLoadHelpMeta();
37866
+ }
37867
+ }
37868
+ /**
37869
+ * Load enhanced help metadata (e.g., arguments/examples) if available
37870
+ */
37871
+ async tryLoadHelpMeta() {
37872
+ try {
37873
+ const candidates = [
37874
+ path11__namespace.join(process.cwd(), "src/slash-commands/help/command-meta.json"),
37875
+ path11__namespace.join(__dirname, "../../slash-commands/help/command-meta.json"),
37876
+ path11__namespace.join(process.cwd(), "dist/command-meta.json")
37877
+ ];
37878
+ let p = null;
37879
+ for (const c of candidates) {
37880
+ try {
37881
+ await fsp__namespace.access(c);
37882
+ p = c;
37883
+ break;
37884
+ } catch {
37885
+ }
37886
+ }
37887
+ if (!p) return;
37888
+ const raw = await fsp__namespace.readFile(p, "utf8");
37889
+ const json = JSON.parse(raw);
37890
+ const map = {};
37891
+ const arr = Array.isArray(json?.commands) ? json.commands : [];
37892
+ for (const entry of arr) {
37893
+ const name2 = typeof entry?.name === "string" ? entry.name : void 0;
37894
+ if (!name2) continue;
37895
+ const norm = name2.replace(/^\//, "");
37896
+ const title = typeof entry?.title === "string" ? entry.title : void 0;
37897
+ const examples = Array.isArray(entry?.examples) ? entry.examples.filter((e2) => typeof e2 === "string") : void 0;
37898
+ map[norm] = { title, examples };
37899
+ }
37900
+ this.helpMeta = map;
37901
+ } catch {
37848
37902
  }
37849
37903
  }
37904
+ /** Get enhanced help meta for a command if available */
37905
+ getHelpMeta(commandName) {
37906
+ const key = commandName.replace(/^\//, "");
37907
+ return this.helpMeta[key];
37908
+ }
37850
37909
  /**
37851
37910
  * Convert object-format commands to ReadyCommand array
37852
37911
  */
@@ -37862,8 +37921,10 @@ var init_ReadyCommandsService = __esm({
37862
37921
  category,
37863
37922
  aliases: [],
37864
37923
  description: cmd.description || descriptions[commandName] || "No description available",
37865
- usage: `/${commandName} [options]`,
37866
- examples: [`/${commandName}`],
37924
+ usage: typeof cmd.usage === "string" ? cmd.usage : `/${commandName} [options]`,
37925
+ examples: Array.isArray(cmd.examples) ? cmd.examples : [`/${commandName}`],
37926
+ // flags is optional; keep it if present to power /help details
37927
+ ...cmd.flags && typeof cmd.flags === "object" ? { flags: cmd.flags } : {},
37867
37928
  status: "READY" /* READY */,
37868
37929
  contract: {
37869
37930
  tty: true,
@@ -38370,40 +38431,30 @@ var init_HelpCommand = __esm({
38370
38431
  examples = [
38371
38432
  {
38372
38433
  input: "/help",
38373
- _description: "Show READY commands with GPU labels",
38434
+ description: "Show READY commands with GPU labels",
38374
38435
  output: "Contract-validated commands with performance info"
38375
38436
  },
38376
38437
  {
38377
38438
  input: "/help code",
38378
- _description: "Show detailed help for specific command",
38439
+ description: "Show detailed help for specific command",
38379
38440
  output: "Usage, examples, and contract info for /code"
38380
38441
  },
38381
38442
  {
38382
38443
  input: "/help --category ai",
38383
- _description: "Show all READY commands in AI category",
38444
+ description: "Show all READY commands in AI category",
38384
38445
  output: "List of AI READY commands with GPU labels"
38385
38446
  },
38386
38447
  {
38387
38448
  input: '/help --search "config"',
38388
- _description: "Search READY commands for configuration",
38449
+ description: "Search READY commands for configuration",
38389
38450
  output: 'READY commands matching "config" with match scores'
38390
- },
38391
- {
38392
- input: "/help --stats",
38393
- _description: "Show READY command statistics",
38394
- output: "Performance stats and command counts"
38395
- },
38396
- {
38397
- input: "/help --quickstart",
38398
- _description: "Show essential commands for getting started",
38399
- output: "Most important READY commands for new users"
38400
38451
  }
38401
38452
  ];
38402
38453
  async execute(args2, context2) {
38403
38454
  const startTime = Date.now();
38404
38455
  try {
38405
38456
  const { parsed, options } = args2;
38406
- const _positional = parsed["_positional"] || [];
38457
+ const _positional = parsed["positional"] || parsed["_positional"] || [];
38407
38458
  if (options && options["stats"]) {
38408
38459
  const result2 = await this.showStatistics();
38409
38460
  await this.trackSuccess(startTime, context2);
@@ -38428,7 +38479,9 @@ var init_HelpCommand = __esm({
38428
38479
  return result2;
38429
38480
  }
38430
38481
  if (options && options["search"]) {
38431
- const result2 = await this.searchCommands(options["search"]);
38482
+ const proxy = (process.env.HELP_SEARCH_PROXY ?? "1").toLowerCase();
38483
+ const shouldProxy = proxy !== "0" && proxy !== "false";
38484
+ const result2 = shouldProxy ? await this.showGeneralHelp() : await this.searchCommands(options["search"]);
38432
38485
  await this.trackSuccess(startTime, context2);
38433
38486
  return result2;
38434
38487
  }
@@ -38440,7 +38493,7 @@ var init_HelpCommand = __esm({
38440
38493
  cmd: "help",
38441
38494
  status: "error",
38442
38495
  latencyMs: Date.now() - startTime,
38443
- plan: getUserPlan(),
38496
+ plan: await getUserPlan(),
38444
38497
  quotaLeft: context2.quotaLeft || 999
38445
38498
  });
38446
38499
  return this.error(
@@ -38458,7 +38511,7 @@ var init_HelpCommand = __esm({
38458
38511
  cmd: "help",
38459
38512
  status: "success",
38460
38513
  latencyMs: Date.now() - startTime,
38461
- plan: getUserPlan(),
38514
+ plan: await getUserPlan(),
38462
38515
  quotaLeft: context2.quotaLeft || 999
38463
38516
  });
38464
38517
  }
@@ -38488,9 +38541,6 @@ var init_HelpCommand = __esm({
38488
38541
  lines.push("");
38489
38542
  lines.push(chalk14__default.default.bold("Quick Access:"));
38490
38543
  lines.push(" /help <command> - Detailed help for specific command");
38491
- lines.push(" /help --quickstart - Essential commands for new users");
38492
- lines.push(" /help --stats - Performance statistics");
38493
- lines.push(" /help --search <term> - Search with fuzzy matching");
38494
38544
  lines.push("");
38495
38545
  let globalMaxNameLength = 0;
38496
38546
  for (const category of categories2) {
@@ -38612,49 +38662,50 @@ var init_HelpCommand = __esm({
38612
38662
  }
38613
38663
  );
38614
38664
  }
38615
- const lines = this.formatCommandHelp(command);
38665
+ const lines = this.formatMinimalUsage(command);
38616
38666
  return this.success(lines);
38617
38667
  }
38618
38668
  /**
38619
38669
  * Format detailed help for a command
38620
38670
  */
38621
- formatCommandHelp(command) {
38671
+ formatMinimalUsage(command) {
38622
38672
  const lines = [];
38673
+ lines.push(`Usage: ${command.usage}`);
38623
38674
  lines.push("");
38624
- lines.push(`\u{1F4D6} ${chalk14__default.default.bold(`/${command.name}`)} - ${command.description}`);
38625
- lines.push("\u2550".repeat(50));
38626
- lines.push("");
38627
- lines.push(chalk14__default.default.bold("\u2139\uFE0F Information:"));
38628
- lines.push(` Category: ${this.readyService["getCategoryEmoji"](command.category)} ${command.category}`);
38629
- lines.push(` Status: \u2705 READY (contract validated)`);
38630
- if (command.aliases && command.aliases.length > 0) {
38631
- lines.push(` Aliases: ${command.aliases.map((a) => `/${a}`).join(", ")}`);
38675
+ const flags = command.flags;
38676
+ const effective = flags && Object.keys(flags).length > 0 ? flags : this.extractFlagsFromUsage(command.usage);
38677
+ if (effective && Object.keys(effective).length > 0) {
38678
+ lines.push("Flags:");
38679
+ const entries = Object.entries(effective).sort(([a], [b]) => a.localeCompare(b));
38680
+ for (const [k, v] of entries) {
38681
+ const hint = v ? ` ${v}` : "";
38682
+ lines.push(` --${k}${hint}`);
38683
+ }
38632
38684
  }
38633
- lines.push("");
38634
- lines.push(chalk14__default.default.bold("\u{1F3AF} Usage:"));
38635
- lines.push(` ${command.usage}`);
38636
- lines.push("");
38637
- lines.push(chalk14__default.default.bold("\u{1F4CB} Contract Validation:"));
38638
- lines.push(` \u26A1 Performance: ${command.contract.maxResponseTime}ms (tested)`);
38639
- lines.push(` \u{1F4BB} TTY Mode: ${command.contract.tty ? "\u2705 Supported" : "\u274C Not supported"}`);
38640
- lines.push(` \u{1F527} Non-TTY Mode: ${command.contract.nonTty ? "\u2705 Supported" : "\u274C Not supported"}`);
38641
- lines.push(` \u{1F500} Pipe Mode: ${command.contract.pipe ? "\u2705 Supported" : "\u274C Not supported"}`);
38642
- lines.push("");
38643
- if (command.examples && command.examples.length > 0) {
38644
- lines.push(chalk14__default.default.bold("\u{1F4DD} Examples:"));
38645
- for (const example of command.examples) {
38646
- lines.push(` ${example}`);
38685
+ return lines.join("\n");
38686
+ }
38687
+ extractFlagsFromUsage(usage) {
38688
+ if (!usage || typeof usage !== "string") return void 0;
38689
+ const out = {};
38690
+ const pattern = /--([a-zA-Z0-9][a-zA-Z0-9\-]*)\s*([^\]\s][^\]]*)?/g;
38691
+ const blocks = usage.match(/\[[^\]]+\]/g) || [];
38692
+ for (const b of blocks) {
38693
+ let m3;
38694
+ pattern.lastIndex = 0;
38695
+ while ((m3 = pattern.exec(b)) !== null) {
38696
+ const key = m3[1];
38697
+ const hint = (m3[2] || "").trim();
38698
+ out[key] = hint;
38647
38699
  }
38648
- lines.push("");
38649
38700
  }
38650
- lines.push(chalk14__default.default.bold("\u{1F4A1} Quick Tips:"));
38651
- lines.push(` \u2022 This command is production-ready and fully tested`);
38652
- lines.push(` \u2022 Try /${command.name} --help for additional options`);
38653
- if (command.category !== "core") {
38654
- lines.push(` \u2022 See more ${command.category} commands: /help --category ${command.category}`);
38701
+ let m2;
38702
+ pattern.lastIndex = 0;
38703
+ while ((m2 = pattern.exec(usage)) !== null) {
38704
+ const key = m2[1];
38705
+ const hint = (m2[2] || "").trim();
38706
+ if (!(key in out)) out[key] = hint;
38655
38707
  }
38656
- lines.push("");
38657
- return lines.join("\n");
38708
+ return Object.keys(out).length ? out : void 0;
38658
38709
  }
38659
38710
  /**
38660
38711
  * Show category help
@@ -38788,8 +38839,6 @@ var init_HelpCommand = __esm({
38788
38839
  }
38789
38840
  lines.push("");
38790
38841
  lines.push(chalk14__default.default.bold("\u{1F4A1} Next Steps:"));
38791
- lines.push(" \u2022 /help --category <name> - Explore command categories");
38792
- lines.push(" \u2022 /help --search <term> - Find specific functionality");
38793
38842
  lines.push(" \u2022 /help <command> - Get detailed command help");
38794
38843
  lines.push("");
38795
38844
  return this.success(lines.join("\n"));
@@ -38843,9 +38892,7 @@ var init_HelpCommand = __esm({
38843
38892
  "/help",
38844
38893
  "/help code",
38845
38894
  "/help --category ai",
38846
- "/help --search config",
38847
- "/help --quickstart",
38848
- "/help --stats"
38895
+ "/help --search config"
38849
38896
  ],
38850
38897
  deps: []
38851
38898
  };
@@ -47395,7 +47442,8 @@ function normalizeImageArgs(raw, root) {
47395
47442
  const out = {
47396
47443
  prompt,
47397
47444
  size: [1024, 1024],
47398
- format: "webp",
47445
+ // Default to png to avoid surprise webp outputs when converters are unavailable
47446
+ format: "png",
47399
47447
  count: 1,
47400
47448
  concurrency: 2,
47401
47449
  retry: 2,
@@ -47414,10 +47462,13 @@ function normalizeImageArgs(raw, root) {
47414
47462
  case "size":
47415
47463
  out.size = parseSize(String(v));
47416
47464
  break;
47417
- case "format":
47418
- if (!["png", "webp", "jpg"].includes(String(v))) throw new Error("invalid format");
47419
- out.format = v;
47465
+ case "format": {
47466
+ const rawFmt = String(v).toLowerCase();
47467
+ const mapped = rawFmt === "jpeg" ? "jpg" : rawFmt;
47468
+ if (!["png", "webp", "jpg"].includes(mapped)) throw new Error("invalid format");
47469
+ out.format = mapped;
47420
47470
  break;
47471
+ }
47421
47472
  case "count": {
47422
47473
  const n = Number(v);
47423
47474
  if (!Number.isFinite(n) || n < 1) throw new Error("invalid count");
@@ -47790,6 +47841,14 @@ var init_gemini_media = __esm({
47790
47841
  async generateImage(req) {
47791
47842
  const modelName = this.primaryModel;
47792
47843
  const promptPreview = String(req.prompt ?? "").replace(/\s+/g, " ").slice(0, 200);
47844
+ const targetMime = (() => {
47845
+ const fmt = (req.format || "png").toLowerCase();
47846
+ if (fmt === "jpg") return "image/jpeg";
47847
+ if (fmt === "jpeg") return "image/jpeg";
47848
+ if (fmt === "png") return "image/png";
47849
+ if (fmt === "webp") return "image/webp";
47850
+ return "image/png";
47851
+ })();
47793
47852
  let resp;
47794
47853
  try {
47795
47854
  resp = await this.ai.models.generateContent({
@@ -47797,7 +47856,7 @@ var init_gemini_media = __esm({
47797
47856
  contents: [{ role: "user", parts: [{ text: String(req.prompt) }] }],
47798
47857
  generationConfig: {
47799
47858
  responseModalities: ["IMAGE"],
47800
- responseMimeType: `image/${req.format || "png"}`
47859
+ responseMimeType: targetMime
47801
47860
  }
47802
47861
  });
47803
47862
  } catch (err) {
@@ -47819,7 +47878,7 @@ var init_gemini_media = __esm({
47819
47878
  const mime = p?.inlineData?.mimeType || p?.inline_data?.mime_type || p?.inline_data?.mimeType || p?.inlineData?.mime_type;
47820
47879
  if (data) {
47821
47880
  const buf = Buffer.from(String(data), "base64");
47822
- if (buf.length > 0) return { bytes: buf, mime: typeof mime === "string" ? mime : `image/${req.format}` };
47881
+ if (buf.length > 0) return { bytes: buf, mime: typeof mime === "string" ? mime : targetMime };
47823
47882
  }
47824
47883
  }
47825
47884
  try {
@@ -47832,7 +47891,7 @@ var init_gemini_media = __esm({
47832
47891
  const bytesB64 = img0?.imageBytes || img0?.bytesBase64Encoded;
47833
47892
  if (bytesB64) {
47834
47893
  const buf = Buffer.from(String(bytesB64), "base64");
47835
- if (buf.length > 0) return { bytes: buf, mime: `image/${req.format || "png"}` };
47894
+ if (buf.length > 0) return { bytes: buf, mime: targetMime };
47836
47895
  }
47837
47896
  } catch {
47838
47897
  }
@@ -47885,12 +47944,15 @@ var init_Progress = __esm({
47885
47944
  });
47886
47945
 
47887
47946
  // src/services/media-orchestrator/image-post.ts
47888
- async function processImageOptional(bytes, format, keepExif) {
47947
+ async function processImageOptional(bytes, format, keepExif, targetSize) {
47889
47948
  try {
47890
- const useSharp = String(process.env.MARIA_SHARP || "").toLowerCase() === "true" || process.env.MARIA_SHARP === "1";
47891
- if (!useSharp) return bytes;
47892
47949
  const sharp = (await import('sharp')).default;
47893
47950
  let img = sharp(bytes).toColourspace("srgb");
47951
+ if (targetSize && Number.isFinite(targetSize.width) && Number.isFinite(targetSize.height)) {
47952
+ const width = Math.max(1, Math.floor(targetSize.width));
47953
+ const height = Math.max(1, Math.floor(targetSize.height));
47954
+ img = img.resize(width, height, { fit: "cover" });
47955
+ }
47894
47956
  if (keepExif) img = img.withMetadata();
47895
47957
  const qEnv = Number(process.env.MARIA_SHARP_QUALITY || "80");
47896
47958
  const quality = Number.isFinite(qEnv) ? Math.max(1, Math.min(100, Math.floor(qEnv))) : 80;
@@ -47945,7 +48007,12 @@ async function runImagePipeline(params2, opts) {
47945
48007
  keepExif: params2.keepExif
47946
48008
  });
47947
48009
  }, retryOpts));
47948
- const processed = await processImageOptional(result.bytes, params2.format, params2.keepExif);
48010
+ const processed = await processImageOptional(
48011
+ result.bytes,
48012
+ params2.format,
48013
+ params2.keepExif,
48014
+ { width: params2.size[0], height: params2.size[1] }
48015
+ );
47949
48016
  successes[i2] = processed;
47950
48017
  totalAttempts += attempts;
47951
48018
  totalRetries += Math.max(0, attempts - 1);
@@ -49669,6 +49736,19 @@ var init_WhoAmICommand = __esm({
49669
49736
  if (user.plan) {
49670
49737
  lines.push(chalk14__default.default.white(`\u{1F48E} Plan: ${chalk14__default.default.cyan(user.plan)}`));
49671
49738
  }
49739
+ try {
49740
+ const { cliAuth: cliAuth2 } = await Promise.resolve().then(() => (init_CLIAuthService(), CLIAuthService_exports));
49741
+ const api = cliAuth2.getAPIClient();
49742
+ const usage = await api.getUsage();
49743
+ lines.push("");
49744
+ lines.push(chalk14__default.default.cyan("\u{1F4CA} Usage"));
49745
+ lines.push(chalk14__default.default.gray("\u2500".repeat(30)));
49746
+ lines.push(chalk14__default.default.white(`Requests: ${usage.used.req}/${usage.limits.req} (${usage.percentage.req}%)`));
49747
+ lines.push(chalk14__default.default.white(`Tokens: ${usage.used.tokens}/${usage.limits.tokens} (${usage.percentage.tokens}%)`));
49748
+ lines.push(chalk14__default.default.white(`Commands: ${usage.used.code}/${usage.limits.code} (${usage.percentage.code}%)`));
49749
+ lines.push(chalk14__default.default.white(`Reset at: ${new Date(usage.resetAt).toLocaleString()}`));
49750
+ } catch {
49751
+ }
49672
49752
  return this.success(lines.join("\n"), { authenticated: true, user });
49673
49753
  }
49674
49754
  };
@@ -50689,7 +50769,7 @@ var init_about_command = __esm({
50689
50769
  async execute(args2, context2) {
50690
50770
  const output3 = [];
50691
50771
  output3.push("");
50692
- output3.push(chalk14__default.default.cyan.bold("\u{1F916} About MARIA v4.3.33"));
50772
+ output3.push(chalk14__default.default.cyan.bold("\u{1F916} About MARIA v4.3.35"));
50693
50773
  output3.push(chalk14__default.default.gray("\u2550".repeat(40)));
50694
50774
  output3.push("");
50695
50775
  output3.push(chalk14__default.default.white.bold("MARIA - Minimal API, Maximum Power"));
@@ -71285,6 +71365,12 @@ ${options["code"] || inferred.code}` : void 0
71285
71365
  const content = (response?.data?.content || response?.output || "").trim();
71286
71366
  const uploads = response?.data?.uploads || [];
71287
71367
  if (content) {
71368
+ try {
71369
+ const { cliAuth: cliAuth2 } = await Promise.resolve().then(() => (init_CLIAuthService(), CLIAuthService_exports));
71370
+ const api = cliAuth2.getAPIClient();
71371
+ await api.consumeQuota({ requests: 1, code: 1 });
71372
+ } catch {
71373
+ }
71288
71374
  const uploadNote = uploads.length ? `Attached ${uploads.length} file(s) uploaded and referenced.` : attachments.length ? `Attached ${attachments.length} local file(s).` : void 0;
71289
71375
  const finalText = uploadNote ? `${uploadNote}
71290
71376
 
@@ -71330,6 +71416,12 @@ ${content}` : content;
71330
71416
  });
71331
71417
  const testResult = await this.executeEvaluation(config2);
71332
71418
  const formattedOutput = this.formatEvaluationStart(testResult);
71419
+ try {
71420
+ const { cliAuth: cliAuth2 } = await Promise.resolve().then(() => (init_CLIAuthService(), CLIAuthService_exports));
71421
+ const api = cliAuth2.getAPIClient();
71422
+ await api.consumeQuota({ requests: 1, code: 1 });
71423
+ } catch {
71424
+ }
71333
71425
  return this.success(formattedOutput, {
71334
71426
  testId: testResult.testId,
71335
71427
  status: testResult.status,
@@ -72327,7 +72419,7 @@ var init_slash_commands = __esm({
72327
72419
  });
72328
72420
  async function handleSlash(input3) {
72329
72421
  if (!input3.startsWith("/")) return false;
72330
- const { cmd, args: args2, flags } = parseSlash(input3);
72422
+ const { cmd, args: args2, options, flags } = parseSlash(input3);
72331
72423
  if (cmd === "clear" || cmd === "cls") {
72332
72424
  try {
72333
72425
  clearTerminal();
@@ -72344,8 +72436,13 @@ async function handleSlash(input3) {
72344
72436
  }
72345
72437
  try {
72346
72438
  if (commandRegistry.has(cmd)) {
72347
- const flagsObj = {};
72348
- flags.forEach((f3) => flagsObj[f3] = true);
72439
+ const optionTokens = [];
72440
+ for (const [k, v] of Object.entries(options)) {
72441
+ optionTokens.push(`--${k}`);
72442
+ optionTokens.push(String(v));
72443
+ }
72444
+ const flagTokens = flags.map((f3) => `--${f3}`);
72445
+ const argv = [...args2, ...optionTokens, ...flagTokens];
72349
72446
  let currentUser = void 0;
72350
72447
  try {
72351
72448
  if (await authManager.isAuthenticated()) {
@@ -72358,7 +72455,7 @@ async function handleSlash(input3) {
72358
72455
  user: currentUser,
72359
72456
  environment: { cwd: process.cwd() }
72360
72457
  };
72361
- const result = await commandRegistry.execute(cmd, args2, ctx2);
72458
+ const result = await commandRegistry.execute(cmd, argv, ctx2);
72362
72459
  if (typeof result?.message === "string" && result.message.trim()) {
72363
72460
  console.log(result.message);
72364
72461
  }
@@ -76041,6 +76138,9 @@ var init_cli = __esm({
76041
76138
  session = [];
76042
76139
  commandManager = null;
76043
76140
  startupDisplayed = false;
76141
+ if (!process.env.GOOGLE_AUTH_DISABLE_GCE_CHECK) {
76142
+ process.env.GOOGLE_AUTH_DISABLE_GCE_CHECK = "true";
76143
+ }
76044
76144
  program = createCLI();
76045
76145
  program.parse(process.argv);
76046
76146
  }