@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.
package/dist/cli.cjs CHANGED
@@ -1386,25 +1386,29 @@ var init_AuthSecretManager = __esm({
1386
1386
  constructor() {
1387
1387
  this.projectId = process.env.GCLOUD_PROJECT || "maria-code-470602";
1388
1388
  this.useGsm = this.shouldUseGsm();
1389
- if (this.useGsm) {
1390
- try {
1391
- this.client = new secretManager.SecretManagerServiceClient();
1392
- } catch {
1393
- this.client = null;
1394
- }
1395
- }
1389
+ this.client = null;
1396
1390
  }
1397
1391
  /**
1398
1392
  * Determine whether to use Google Secret Manager in this environment
1399
1393
  */
1400
1394
  shouldUseGsm() {
1401
1395
  if (process.env.MARIA_DISABLE_GSM === "true") return false;
1396
+ if (process.env.MARIA_CLI_USE_GSM === "true") return true;
1402
1397
  if (process.env.GOOGLE_APPLICATION_CREDENTIALS) return true;
1403
- if (process.env.GOOGLE_CLOUD_PROJECT || process.env.GCLOUD_PROJECT) return true;
1404
- if (process.env.CLOUD_RUN_SERVICE || process.env.K_SERVICE) return true;
1405
- if (process.env.GCE_METADATA_HOST) return true;
1398
+ if (process.env.CLOUD_RUN_SERVICE || process.env.K_SERVICE || process.env.GCE_METADATA_HOST) return true;
1406
1399
  return false;
1407
1400
  }
1401
+ /** Lazily create Secret Manager client only when permitted */
1402
+ ensureClient() {
1403
+ if (!this.useGsm) return null;
1404
+ if (this.client) return this.client;
1405
+ try {
1406
+ this.client = new secretManager.SecretManagerServiceClient();
1407
+ } catch {
1408
+ this.client = null;
1409
+ }
1410
+ return this.client;
1411
+ }
1408
1412
  /**
1409
1413
  * Get authentication configuration from Secret Manager
1410
1414
  */
@@ -1424,7 +1428,8 @@ var init_AuthSecretManager = __esm({
1424
1428
  * Get a specific secret from Secret Manager
1425
1429
  */
1426
1430
  async getSecret(secretName) {
1427
- if (!this.useGsm || !this.client) {
1431
+ const client = this.ensureClient();
1432
+ if (!this.useGsm || !client) {
1428
1433
  return null;
1429
1434
  }
1430
1435
  const cached2 = this.getCachedSecret(secretName);
@@ -1433,7 +1438,7 @@ var init_AuthSecretManager = __esm({
1433
1438
  }
1434
1439
  try {
1435
1440
  const name2 = `projects/${this.projectId}/secrets/${secretName}/versions/latest`;
1436
- const [version] = await this.client.accessSecretVersion({ name: name2 });
1441
+ const [version] = await client.accessSecretVersion({ name: name2 });
1437
1442
  const payload = version.payload?.data;
1438
1443
  if (!payload) {
1439
1444
  return null;
@@ -1704,7 +1709,7 @@ var init_AuthenticationManager = __esm({
1704
1709
  const response = await fetch(`${this.apiBase}/api/user/profile`, {
1705
1710
  headers: {
1706
1711
  "Authorization": `Bearer ${tokens2.accessToken}`,
1707
- "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.33"}`
1712
+ "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.35"}`
1708
1713
  }
1709
1714
  });
1710
1715
  if (response.status === 401) {
@@ -2407,7 +2412,7 @@ async function callApi(path64, init3 = {}) {
2407
2412
  "Authorization": `Bearer ${token}`,
2408
2413
  "X-Device-Id": getDeviceId(),
2409
2414
  "X-Session-Id": getSessionId() || "",
2410
- "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.33"}`,
2415
+ "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.35"}`,
2411
2416
  "Content-Type": init3.headers?.["Content-Type"] || "application/json"
2412
2417
  });
2413
2418
  const doFetch = async (token) => {
@@ -11448,6 +11453,13 @@ var init_logging = __esm({
11448
11453
  _loggingMiddleware = new LoggingMiddleware();
11449
11454
  }
11450
11455
  });
11456
+
11457
+ // src/services/telemetry/bigquery-telemetry.ts
11458
+ var bigquery_telemetry_exports = {};
11459
+ __export(bigquery_telemetry_exports, {
11460
+ BigQueryTelemetryService: () => BigQueryTelemetryService,
11461
+ bigQueryTelemetry: () => bigQueryTelemetry
11462
+ });
11451
11463
  async function loadBigQuery() {
11452
11464
  if (bigQueryLoadAttempted) return BigQuery;
11453
11465
  bigQueryLoadAttempted = true;
@@ -11513,7 +11525,7 @@ var init_bigquery_telemetry = __esm({
11513
11525
  };
11514
11526
  constructor() {
11515
11527
  super();
11516
- this.isEnabled = process.env.TELEMETRY_DISABLED !== "true";
11528
+ this.isEnabled = process.env.TELEMETRY_ENABLED === "true";
11517
11529
  this.httpEndpoint = process.env.TELEMETRY_ENDPOINT || null;
11518
11530
  if (this.isEnabled) {
11519
11531
  this.initialize().catch((error2) => {
@@ -11857,8 +11869,12 @@ async function getUserContext() {
11857
11869
  }
11858
11870
  async function trackCommand(data) {
11859
11871
  try {
11872
+ if (process.env.TELEMETRY_DISABLED === "true") {
11873
+ return;
11874
+ }
11860
11875
  const userContext = await getUserContext();
11861
- await bigQueryTelemetry.trackCommandExecution({
11876
+ const { bigQueryTelemetry: bigQueryTelemetry2 } = await Promise.resolve().then(() => (init_bigquery_telemetry(), bigquery_telemetry_exports));
11877
+ await bigQueryTelemetry2.trackCommandExecution({
11862
11878
  cmd: data.cmd,
11863
11879
  status: data.status,
11864
11880
  latencyMs: data.latencyMs,
@@ -11899,7 +11915,6 @@ function getNextMonthStart() {
11899
11915
  }
11900
11916
  var init_telemetry_helper = __esm({
11901
11917
  "src/slash-commands/shared/telemetry-helper.ts"() {
11902
- init_bigquery_telemetry();
11903
11918
  }
11904
11919
  });
11905
11920
 
@@ -12072,6 +12087,7 @@ var init_ReadyCommandsService = __esm({
12072
12087
  lastLoaded = null;
12073
12088
  manifestPath;
12074
12089
  usedFallback = false;
12090
+ helpMeta = {};
12075
12091
  constructor(manifestPath) {
12076
12092
  if (manifestPath) {
12077
12093
  this.manifestPath = manifestPath;
@@ -12155,14 +12171,57 @@ var init_ReadyCommandsService = __esm({
12155
12171
  this.buildLookupMaps();
12156
12172
  this.lastLoaded = /* @__PURE__ */ new Date();
12157
12173
  this.usedFallback = false;
12174
+ await this.tryLoadHelpMeta();
12158
12175
  } catch (error2) {
12159
12176
  logger.debug("READY manifest not found or invalid; using fallback");
12160
12177
  this.readyCommands = this.getFallbackCommands();
12161
12178
  this.buildLookupMaps();
12162
12179
  this.lastLoaded = /* @__PURE__ */ new Date();
12163
12180
  this.usedFallback = true;
12181
+ await this.tryLoadHelpMeta();
12182
+ }
12183
+ }
12184
+ /**
12185
+ * Load enhanced help metadata (e.g., arguments/examples) if available
12186
+ */
12187
+ async tryLoadHelpMeta() {
12188
+ try {
12189
+ const candidates = [
12190
+ path10__namespace.join(process.cwd(), "src/slash-commands/help/command-meta.json"),
12191
+ path10__namespace.join(__dirname, "../../slash-commands/help/command-meta.json"),
12192
+ path10__namespace.join(process.cwd(), "dist/command-meta.json")
12193
+ ];
12194
+ let p = null;
12195
+ for (const c of candidates) {
12196
+ try {
12197
+ await fsp__namespace.access(c);
12198
+ p = c;
12199
+ break;
12200
+ } catch {
12201
+ }
12202
+ }
12203
+ if (!p) return;
12204
+ const raw = await fsp__namespace.readFile(p, "utf8");
12205
+ const json = JSON.parse(raw);
12206
+ const map = {};
12207
+ const arr = Array.isArray(json?.commands) ? json.commands : [];
12208
+ for (const entry of arr) {
12209
+ const name2 = typeof entry?.name === "string" ? entry.name : void 0;
12210
+ if (!name2) continue;
12211
+ const norm = name2.replace(/^\//, "");
12212
+ const title = typeof entry?.title === "string" ? entry.title : void 0;
12213
+ const examples = Array.isArray(entry?.examples) ? entry.examples.filter((e2) => typeof e2 === "string") : void 0;
12214
+ map[norm] = { title, examples };
12215
+ }
12216
+ this.helpMeta = map;
12217
+ } catch {
12164
12218
  }
12165
12219
  }
12220
+ /** Get enhanced help meta for a command if available */
12221
+ getHelpMeta(commandName) {
12222
+ const key = commandName.replace(/^\//, "");
12223
+ return this.helpMeta[key];
12224
+ }
12166
12225
  /**
12167
12226
  * Convert object-format commands to ReadyCommand array
12168
12227
  */
@@ -12178,8 +12237,10 @@ var init_ReadyCommandsService = __esm({
12178
12237
  category,
12179
12238
  aliases: [],
12180
12239
  description: cmd.description || descriptions[commandName] || "No description available",
12181
- usage: `/${commandName} [options]`,
12182
- examples: [`/${commandName}`],
12240
+ usage: typeof cmd.usage === "string" ? cmd.usage : `/${commandName} [options]`,
12241
+ examples: Array.isArray(cmd.examples) ? cmd.examples : [`/${commandName}`],
12242
+ // flags is optional; keep it if present to power /help details
12243
+ ...cmd.flags && typeof cmd.flags === "object" ? { flags: cmd.flags } : {},
12183
12244
  status: "READY" /* READY */,
12184
12245
  contract: {
12185
12246
  tty: true,
@@ -12686,40 +12747,30 @@ var init_HelpCommand = __esm({
12686
12747
  examples = [
12687
12748
  {
12688
12749
  input: "/help",
12689
- _description: "Show READY commands with GPU labels",
12750
+ description: "Show READY commands with GPU labels",
12690
12751
  output: "Contract-validated commands with performance info"
12691
12752
  },
12692
12753
  {
12693
12754
  input: "/help code",
12694
- _description: "Show detailed help for specific command",
12755
+ description: "Show detailed help for specific command",
12695
12756
  output: "Usage, examples, and contract info for /code"
12696
12757
  },
12697
12758
  {
12698
12759
  input: "/help --category ai",
12699
- _description: "Show all READY commands in AI category",
12760
+ description: "Show all READY commands in AI category",
12700
12761
  output: "List of AI READY commands with GPU labels"
12701
12762
  },
12702
12763
  {
12703
12764
  input: '/help --search "config"',
12704
- _description: "Search READY commands for configuration",
12765
+ description: "Search READY commands for configuration",
12705
12766
  output: 'READY commands matching "config" with match scores'
12706
- },
12707
- {
12708
- input: "/help --stats",
12709
- _description: "Show READY command statistics",
12710
- output: "Performance stats and command counts"
12711
- },
12712
- {
12713
- input: "/help --quickstart",
12714
- _description: "Show essential commands for getting started",
12715
- output: "Most important READY commands for new users"
12716
12767
  }
12717
12768
  ];
12718
12769
  async execute(args2, context2) {
12719
12770
  const startTime = Date.now();
12720
12771
  try {
12721
12772
  const { parsed, options } = args2;
12722
- const _positional = parsed["_positional"] || [];
12773
+ const _positional = parsed["positional"] || parsed["_positional"] || [];
12723
12774
  if (options && options["stats"]) {
12724
12775
  const result2 = await this.showStatistics();
12725
12776
  await this.trackSuccess(startTime, context2);
@@ -12744,7 +12795,9 @@ var init_HelpCommand = __esm({
12744
12795
  return result2;
12745
12796
  }
12746
12797
  if (options && options["search"]) {
12747
- const result2 = await this.searchCommands(options["search"]);
12798
+ const proxy = (process.env.HELP_SEARCH_PROXY ?? "1").toLowerCase();
12799
+ const shouldProxy = proxy !== "0" && proxy !== "false";
12800
+ const result2 = shouldProxy ? await this.showGeneralHelp() : await this.searchCommands(options["search"]);
12748
12801
  await this.trackSuccess(startTime, context2);
12749
12802
  return result2;
12750
12803
  }
@@ -12756,7 +12809,7 @@ var init_HelpCommand = __esm({
12756
12809
  cmd: "help",
12757
12810
  status: "error",
12758
12811
  latencyMs: Date.now() - startTime,
12759
- plan: getUserPlan(),
12812
+ plan: await getUserPlan(),
12760
12813
  quotaLeft: context2.quotaLeft || 999
12761
12814
  });
12762
12815
  return this.error(
@@ -12774,7 +12827,7 @@ var init_HelpCommand = __esm({
12774
12827
  cmd: "help",
12775
12828
  status: "success",
12776
12829
  latencyMs: Date.now() - startTime,
12777
- plan: getUserPlan(),
12830
+ plan: await getUserPlan(),
12778
12831
  quotaLeft: context2.quotaLeft || 999
12779
12832
  });
12780
12833
  }
@@ -12804,9 +12857,6 @@ var init_HelpCommand = __esm({
12804
12857
  lines.push("");
12805
12858
  lines.push(chalk40__default.default.bold("Quick Access:"));
12806
12859
  lines.push(" /help <command> - Detailed help for specific command");
12807
- lines.push(" /help --quickstart - Essential commands for new users");
12808
- lines.push(" /help --stats - Performance statistics");
12809
- lines.push(" /help --search <term> - Search with fuzzy matching");
12810
12860
  lines.push("");
12811
12861
  let globalMaxNameLength = 0;
12812
12862
  for (const category of categories2) {
@@ -12928,49 +12978,50 @@ var init_HelpCommand = __esm({
12928
12978
  }
12929
12979
  );
12930
12980
  }
12931
- const lines = this.formatCommandHelp(command);
12981
+ const lines = this.formatMinimalUsage(command);
12932
12982
  return this.success(lines);
12933
12983
  }
12934
12984
  /**
12935
12985
  * Format detailed help for a command
12936
12986
  */
12937
- formatCommandHelp(command) {
12987
+ formatMinimalUsage(command) {
12938
12988
  const lines = [];
12989
+ lines.push(`Usage: ${command.usage}`);
12939
12990
  lines.push("");
12940
- lines.push(`\u{1F4D6} ${chalk40__default.default.bold(`/${command.name}`)} - ${command.description}`);
12941
- lines.push("\u2550".repeat(50));
12942
- lines.push("");
12943
- lines.push(chalk40__default.default.bold("\u2139\uFE0F Information:"));
12944
- lines.push(` Category: ${this.readyService["getCategoryEmoji"](command.category)} ${command.category}`);
12945
- lines.push(` Status: \u2705 READY (contract validated)`);
12946
- if (command.aliases && command.aliases.length > 0) {
12947
- lines.push(` Aliases: ${command.aliases.map((a) => `/${a}`).join(", ")}`);
12991
+ const flags = command.flags;
12992
+ const effective = flags && Object.keys(flags).length > 0 ? flags : this.extractFlagsFromUsage(command.usage);
12993
+ if (effective && Object.keys(effective).length > 0) {
12994
+ lines.push("Flags:");
12995
+ const entries = Object.entries(effective).sort(([a], [b]) => a.localeCompare(b));
12996
+ for (const [k, v] of entries) {
12997
+ const hint = v ? ` ${v}` : "";
12998
+ lines.push(` --${k}${hint}`);
12999
+ }
12948
13000
  }
12949
- lines.push("");
12950
- lines.push(chalk40__default.default.bold("\u{1F3AF} Usage:"));
12951
- lines.push(` ${command.usage}`);
12952
- lines.push("");
12953
- lines.push(chalk40__default.default.bold("\u{1F4CB} Contract Validation:"));
12954
- lines.push(` \u26A1 Performance: ${command.contract.maxResponseTime}ms (tested)`);
12955
- lines.push(` \u{1F4BB} TTY Mode: ${command.contract.tty ? "\u2705 Supported" : "\u274C Not supported"}`);
12956
- lines.push(` \u{1F527} Non-TTY Mode: ${command.contract.nonTty ? "\u2705 Supported" : "\u274C Not supported"}`);
12957
- lines.push(` \u{1F500} Pipe Mode: ${command.contract.pipe ? "\u2705 Supported" : "\u274C Not supported"}`);
12958
- lines.push("");
12959
- if (command.examples && command.examples.length > 0) {
12960
- lines.push(chalk40__default.default.bold("\u{1F4DD} Examples:"));
12961
- for (const example of command.examples) {
12962
- lines.push(` ${example}`);
13001
+ return lines.join("\n");
13002
+ }
13003
+ extractFlagsFromUsage(usage) {
13004
+ if (!usage || typeof usage !== "string") return void 0;
13005
+ const out = {};
13006
+ const pattern = /--([a-zA-Z0-9][a-zA-Z0-9\-]*)\s*([^\]\s][^\]]*)?/g;
13007
+ const blocks = usage.match(/\[[^\]]+\]/g) || [];
13008
+ for (const b of blocks) {
13009
+ let m3;
13010
+ pattern.lastIndex = 0;
13011
+ while ((m3 = pattern.exec(b)) !== null) {
13012
+ const key = m3[1];
13013
+ const hint = (m3[2] || "").trim();
13014
+ out[key] = hint;
12963
13015
  }
12964
- lines.push("");
12965
13016
  }
12966
- lines.push(chalk40__default.default.bold("\u{1F4A1} Quick Tips:"));
12967
- lines.push(` \u2022 This command is production-ready and fully tested`);
12968
- lines.push(` \u2022 Try /${command.name} --help for additional options`);
12969
- if (command.category !== "core") {
12970
- lines.push(` \u2022 See more ${command.category} commands: /help --category ${command.category}`);
13017
+ let m2;
13018
+ pattern.lastIndex = 0;
13019
+ while ((m2 = pattern.exec(usage)) !== null) {
13020
+ const key = m2[1];
13021
+ const hint = (m2[2] || "").trim();
13022
+ if (!(key in out)) out[key] = hint;
12971
13023
  }
12972
- lines.push("");
12973
- return lines.join("\n");
13024
+ return Object.keys(out).length ? out : void 0;
12974
13025
  }
12975
13026
  /**
12976
13027
  * Show category help
@@ -13104,8 +13155,6 @@ var init_HelpCommand = __esm({
13104
13155
  }
13105
13156
  lines.push("");
13106
13157
  lines.push(chalk40__default.default.bold("\u{1F4A1} Next Steps:"));
13107
- lines.push(" \u2022 /help --category <name> - Explore command categories");
13108
- lines.push(" \u2022 /help --search <term> - Find specific functionality");
13109
13158
  lines.push(" \u2022 /help <command> - Get detailed command help");
13110
13159
  lines.push("");
13111
13160
  return this.success(lines.join("\n"));
@@ -13159,9 +13208,7 @@ var init_HelpCommand = __esm({
13159
13208
  "/help",
13160
13209
  "/help code",
13161
13210
  "/help --category ai",
13162
- "/help --search config",
13163
- "/help --quickstart",
13164
- "/help --stats"
13211
+ "/help --search config"
13165
13212
  ],
13166
13213
  deps: []
13167
13214
  };
@@ -16121,8 +16168,8 @@ var require_package = __commonJS({
16121
16168
  "package.json"(exports, module) {
16122
16169
  module.exports = {
16123
16170
  name: "@bonginkan/maria",
16124
- version: "4.3.33",
16125
- 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.",
16171
+ version: "4.3.35",
16172
+ 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.",
16126
16173
  keywords: [
16127
16174
  "ai",
16128
16175
  "cli",
@@ -16558,7 +16605,7 @@ var require_package = __commonJS({
16558
16605
  react: "^18.2.0",
16559
16606
  "reflect-metadata": "^0.2.2",
16560
16607
  semver: "^7.7.2",
16561
- sharp: "^0.34.3",
16608
+ sharp: "^0.34.4",
16562
16609
  "string-width": "^8.0.0",
16563
16610
  "strip-ansi": "^7.1.0",
16564
16611
  "tesseract.js": "^6.0.1",
@@ -22237,7 +22284,8 @@ function normalizeImageArgs(raw, root) {
22237
22284
  const out = {
22238
22285
  prompt,
22239
22286
  size: [1024, 1024],
22240
- format: "webp",
22287
+ // Default to png to avoid surprise webp outputs when converters are unavailable
22288
+ format: "png",
22241
22289
  count: 1,
22242
22290
  concurrency: 2,
22243
22291
  retry: 2,
@@ -22256,10 +22304,13 @@ function normalizeImageArgs(raw, root) {
22256
22304
  case "size":
22257
22305
  out.size = parseSize(String(v));
22258
22306
  break;
22259
- case "format":
22260
- if (!["png", "webp", "jpg"].includes(String(v))) throw new Error("invalid format");
22261
- out.format = v;
22307
+ case "format": {
22308
+ const rawFmt = String(v).toLowerCase();
22309
+ const mapped = rawFmt === "jpeg" ? "jpg" : rawFmt;
22310
+ if (!["png", "webp", "jpg"].includes(mapped)) throw new Error("invalid format");
22311
+ out.format = mapped;
22262
22312
  break;
22313
+ }
22263
22314
  case "count": {
22264
22315
  const n = Number(v);
22265
22316
  if (!Number.isFinite(n) || n < 1) throw new Error("invalid count");
@@ -22632,6 +22683,14 @@ var init_gemini_media = __esm({
22632
22683
  async generateImage(req) {
22633
22684
  const modelName = this.primaryModel;
22634
22685
  const promptPreview = String(req.prompt ?? "").replace(/\s+/g, " ").slice(0, 200);
22686
+ const targetMime = (() => {
22687
+ const fmt = (req.format || "png").toLowerCase();
22688
+ if (fmt === "jpg") return "image/jpeg";
22689
+ if (fmt === "jpeg") return "image/jpeg";
22690
+ if (fmt === "png") return "image/png";
22691
+ if (fmt === "webp") return "image/webp";
22692
+ return "image/png";
22693
+ })();
22635
22694
  let resp;
22636
22695
  try {
22637
22696
  resp = await this.ai.models.generateContent({
@@ -22639,7 +22698,7 @@ var init_gemini_media = __esm({
22639
22698
  contents: [{ role: "user", parts: [{ text: String(req.prompt) }] }],
22640
22699
  generationConfig: {
22641
22700
  responseModalities: ["IMAGE"],
22642
- responseMimeType: `image/${req.format || "png"}`
22701
+ responseMimeType: targetMime
22643
22702
  }
22644
22703
  });
22645
22704
  } catch (err) {
@@ -22661,7 +22720,7 @@ var init_gemini_media = __esm({
22661
22720
  const mime = p?.inlineData?.mimeType || p?.inline_data?.mime_type || p?.inline_data?.mimeType || p?.inlineData?.mime_type;
22662
22721
  if (data) {
22663
22722
  const buf = Buffer.from(String(data), "base64");
22664
- if (buf.length > 0) return { bytes: buf, mime: typeof mime === "string" ? mime : `image/${req.format}` };
22723
+ if (buf.length > 0) return { bytes: buf, mime: typeof mime === "string" ? mime : targetMime };
22665
22724
  }
22666
22725
  }
22667
22726
  try {
@@ -22674,7 +22733,7 @@ var init_gemini_media = __esm({
22674
22733
  const bytesB64 = img0?.imageBytes || img0?.bytesBase64Encoded;
22675
22734
  if (bytesB64) {
22676
22735
  const buf = Buffer.from(String(bytesB64), "base64");
22677
- if (buf.length > 0) return { bytes: buf, mime: `image/${req.format || "png"}` };
22736
+ if (buf.length > 0) return { bytes: buf, mime: targetMime };
22678
22737
  }
22679
22738
  } catch {
22680
22739
  }
@@ -22727,12 +22786,15 @@ var init_Progress = __esm({
22727
22786
  });
22728
22787
 
22729
22788
  // src/services/media-orchestrator/image-post.ts
22730
- async function processImageOptional(bytes, format, keepExif) {
22789
+ async function processImageOptional(bytes, format, keepExif, targetSize) {
22731
22790
  try {
22732
- const useSharp = String(process.env.MARIA_SHARP || "").toLowerCase() === "true" || process.env.MARIA_SHARP === "1";
22733
- if (!useSharp) return bytes;
22734
22791
  const sharp = (await import('sharp')).default;
22735
22792
  let img = sharp(bytes).toColourspace("srgb");
22793
+ if (targetSize && Number.isFinite(targetSize.width) && Number.isFinite(targetSize.height)) {
22794
+ const width = Math.max(1, Math.floor(targetSize.width));
22795
+ const height = Math.max(1, Math.floor(targetSize.height));
22796
+ img = img.resize(width, height, { fit: "cover" });
22797
+ }
22736
22798
  if (keepExif) img = img.withMetadata();
22737
22799
  const qEnv = Number(process.env.MARIA_SHARP_QUALITY || "80");
22738
22800
  const quality = Number.isFinite(qEnv) ? Math.max(1, Math.min(100, Math.floor(qEnv))) : 80;
@@ -22787,7 +22849,12 @@ async function runImagePipeline(params2, opts) {
22787
22849
  keepExif: params2.keepExif
22788
22850
  });
22789
22851
  }, retryOpts));
22790
- const processed = await processImageOptional(result.bytes, params2.format, params2.keepExif);
22852
+ const processed = await processImageOptional(
22853
+ result.bytes,
22854
+ params2.format,
22855
+ params2.keepExif,
22856
+ { width: params2.size[0], height: params2.size[1] }
22857
+ );
22791
22858
  successes[i2] = processed;
22792
22859
  totalAttempts += attempts;
22793
22860
  totalRetries += Math.max(0, attempts - 1);
@@ -24511,6 +24578,19 @@ var init_WhoAmICommand = __esm({
24511
24578
  if (user.plan) {
24512
24579
  lines.push(chalk40__default.default.white(`\u{1F48E} Plan: ${chalk40__default.default.cyan(user.plan)}`));
24513
24580
  }
24581
+ try {
24582
+ const { cliAuth: cliAuth2 } = await Promise.resolve().then(() => (init_CLIAuthService(), CLIAuthService_exports));
24583
+ const api = cliAuth2.getAPIClient();
24584
+ const usage = await api.getUsage();
24585
+ lines.push("");
24586
+ lines.push(chalk40__default.default.cyan("\u{1F4CA} Usage"));
24587
+ lines.push(chalk40__default.default.gray("\u2500".repeat(30)));
24588
+ lines.push(chalk40__default.default.white(`Requests: ${usage.used.req}/${usage.limits.req} (${usage.percentage.req}%)`));
24589
+ lines.push(chalk40__default.default.white(`Tokens: ${usage.used.tokens}/${usage.limits.tokens} (${usage.percentage.tokens}%)`));
24590
+ lines.push(chalk40__default.default.white(`Commands: ${usage.used.code}/${usage.limits.code} (${usage.percentage.code}%)`));
24591
+ lines.push(chalk40__default.default.white(`Reset at: ${new Date(usage.resetAt).toLocaleString()}`));
24592
+ } catch {
24593
+ }
24514
24594
  return this.success(lines.join("\n"), { authenticated: true, user });
24515
24595
  }
24516
24596
  };
@@ -25817,7 +25897,7 @@ var init_about_command = __esm({
25817
25897
  async execute(args2, context2) {
25818
25898
  const output3 = [];
25819
25899
  output3.push("");
25820
- output3.push(chalk40__default.default.cyan.bold("\u{1F916} About MARIA v4.3.33"));
25900
+ output3.push(chalk40__default.default.cyan.bold("\u{1F916} About MARIA v4.3.35"));
25821
25901
  output3.push(chalk40__default.default.gray("\u2550".repeat(40)));
25822
25902
  output3.push("");
25823
25903
  output3.push(chalk40__default.default.white.bold("MARIA - Minimal API, Maximum Power"));
@@ -58070,6 +58150,12 @@ ${options["code"] || inferred.code}` : void 0
58070
58150
  const content = (response?.data?.content || response?.output || "").trim();
58071
58151
  const uploads = response?.data?.uploads || [];
58072
58152
  if (content) {
58153
+ try {
58154
+ const { cliAuth: cliAuth2 } = await Promise.resolve().then(() => (init_CLIAuthService(), CLIAuthService_exports));
58155
+ const api = cliAuth2.getAPIClient();
58156
+ await api.consumeQuota({ requests: 1, code: 1 });
58157
+ } catch {
58158
+ }
58073
58159
  const uploadNote = uploads.length ? `Attached ${uploads.length} file(s) uploaded and referenced.` : attachments.length ? `Attached ${attachments.length} local file(s).` : void 0;
58074
58160
  const finalText = uploadNote ? `${uploadNote}
58075
58161
 
@@ -58115,6 +58201,12 @@ ${content}` : content;
58115
58201
  });
58116
58202
  const testResult = await this.executeEvaluation(config2);
58117
58203
  const formattedOutput = this.formatEvaluationStart(testResult);
58204
+ try {
58205
+ const { cliAuth: cliAuth2 } = await Promise.resolve().then(() => (init_CLIAuthService(), CLIAuthService_exports));
58206
+ const api = cliAuth2.getAPIClient();
58207
+ await api.consumeQuota({ requests: 1, code: 1 });
58208
+ } catch {
58209
+ }
58118
58210
  return this.success(formattedOutput, {
58119
58211
  testId: testResult.testId,
58120
58212
  status: testResult.status,
@@ -59112,7 +59204,7 @@ var init_slash_commands = __esm({
59112
59204
  });
59113
59205
  async function handleSlash(input3) {
59114
59206
  if (!input3.startsWith("/")) return false;
59115
- const { cmd, args: args2, flags } = parseSlash(input3);
59207
+ const { cmd, args: args2, options, flags } = parseSlash(input3);
59116
59208
  if (cmd === "clear" || cmd === "cls") {
59117
59209
  try {
59118
59210
  clearTerminal();
@@ -59129,8 +59221,13 @@ async function handleSlash(input3) {
59129
59221
  }
59130
59222
  try {
59131
59223
  if (commandRegistry.has(cmd)) {
59132
- const flagsObj = {};
59133
- flags.forEach((f3) => flagsObj[f3] = true);
59224
+ const optionTokens = [];
59225
+ for (const [k, v] of Object.entries(options)) {
59226
+ optionTokens.push(`--${k}`);
59227
+ optionTokens.push(String(v));
59228
+ }
59229
+ const flagTokens = flags.map((f3) => `--${f3}`);
59230
+ const argv = [...args2, ...optionTokens, ...flagTokens];
59134
59231
  let currentUser = void 0;
59135
59232
  try {
59136
59233
  if (await authManager.isAuthenticated()) {
@@ -59143,7 +59240,7 @@ async function handleSlash(input3) {
59143
59240
  user: currentUser,
59144
59241
  environment: { cwd: process.cwd() }
59145
59242
  };
59146
- const result = await commandRegistry.execute(cmd, args2, ctx2);
59243
+ const result = await commandRegistry.execute(cmd, argv, ctx2);
59147
59244
  if (typeof result?.message === "string" && result.message.trim()) {
59148
59245
  console.log(result.message);
59149
59246
  }
@@ -76099,6 +76196,9 @@ var init_cli = __esm({
76099
76196
  session = [];
76100
76197
  commandManager = null;
76101
76198
  startupDisplayed = false;
76199
+ if (!process.env.GOOGLE_AUTH_DISABLE_GCE_CHECK) {
76200
+ process.env.GOOGLE_AUTH_DISABLE_GCE_CHECK = "true";
76201
+ }
76102
76202
  program = createCLI2();
76103
76203
  program.parse(process.argv);
76104
76204
  }