@bonginkan/maria 4.3.29 → 4.3.31

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.
@@ -235,13 +235,13 @@ function getPackageJson() {
235
235
  )
236
236
  ];
237
237
  let packageJsonPath = null;
238
- for (const path60 of possiblePaths) {
239
- if (fs21.existsSync(path60)) {
238
+ for (const path64 of possiblePaths) {
239
+ if (fs21.existsSync(path64)) {
240
240
  try {
241
- const content = fs21.readFileSync(path60, "utf-8");
241
+ const content = fs21.readFileSync(path64, "utf-8");
242
242
  const parsed = JSON.parse(content);
243
243
  if (parsed.name === "@bonginkan/maria") {
244
- packageJsonPath = path60;
244
+ packageJsonPath = path64;
245
245
  break;
246
246
  }
247
247
  } catch {
@@ -525,22 +525,22 @@ function dataUriToBuffer(uri) {
525
525
  if (firstComma === -1 || firstComma <= 4) {
526
526
  throw new TypeError("malformed data: URI");
527
527
  }
528
- const meta26 = uri.substring(5, firstComma).split(";");
528
+ const meta27 = uri.substring(5, firstComma).split(";");
529
529
  let charset = "";
530
530
  let base64 = false;
531
- const type = meta26[0] || "text/plain";
531
+ const type = meta27[0] || "text/plain";
532
532
  let typeFull = type;
533
- for (let i2 = 1; i2 < meta26.length; i2++) {
534
- if (meta26[i2] === "base64") {
533
+ for (let i2 = 1; i2 < meta27.length; i2++) {
534
+ if (meta27[i2] === "base64") {
535
535
  base64 = true;
536
- } else if (meta26[i2]) {
537
- typeFull += `;${meta26[i2]}`;
538
- if (meta26[i2].indexOf("charset=") === 0) {
539
- charset = meta26[i2].substring(8);
536
+ } else if (meta27[i2]) {
537
+ typeFull += `;${meta27[i2]}`;
538
+ if (meta27[i2].indexOf("charset=") === 0) {
539
+ charset = meta27[i2].substring(8);
540
540
  }
541
541
  }
542
542
  }
543
- if (!meta26[0] && !charset.length) {
543
+ if (!meta27[0] && !charset.length) {
544
544
  typeFull += ";charset=US-ASCII";
545
545
  charset = "US-ASCII";
546
546
  }
@@ -5314,22 +5314,22 @@ var init_from = __esm({
5314
5314
  init_file();
5315
5315
  init_fetch_blob();
5316
5316
  ({ stat } = fs21.promises);
5317
- blobFromSync = (path60, type) => fromBlob(fs21.statSync(path60), path60, type);
5318
- blobFrom = (path60, type) => stat(path60).then((stat13) => fromBlob(stat13, path60, type));
5319
- fileFrom = (path60, type) => stat(path60).then((stat13) => fromFile(stat13, path60, type));
5320
- fileFromSync = (path60, type) => fromFile(fs21.statSync(path60), path60, type);
5321
- fromBlob = (stat13, path60, type = "") => new fetch_blob_default([new BlobDataItem({
5322
- path: path60,
5317
+ blobFromSync = (path64, type) => fromBlob(fs21.statSync(path64), path64, type);
5318
+ blobFrom = (path64, type) => stat(path64).then((stat13) => fromBlob(stat13, path64, type));
5319
+ fileFrom = (path64, type) => stat(path64).then((stat13) => fromFile(stat13, path64, type));
5320
+ fileFromSync = (path64, type) => fromFile(fs21.statSync(path64), path64, type);
5321
+ fromBlob = (stat13, path64, type = "") => new fetch_blob_default([new BlobDataItem({
5322
+ path: path64,
5323
5323
  size: stat13.size,
5324
5324
  lastModified: stat13.mtimeMs,
5325
5325
  start: 0
5326
5326
  })], { type });
5327
- fromFile = (stat13, path60, type = "") => new file_default([new BlobDataItem({
5328
- path: path60,
5327
+ fromFile = (stat13, path64, type = "") => new file_default([new BlobDataItem({
5328
+ path: path64,
5329
5329
  size: stat13.size,
5330
5330
  lastModified: stat13.mtimeMs,
5331
5331
  start: 0
5332
- })], path11.basename(path60), { type, lastModified: stat13.mtimeMs });
5332
+ })], path11.basename(path64), { type, lastModified: stat13.mtimeMs });
5333
5333
  BlobDataItem = class _BlobDataItem {
5334
5334
  #path;
5335
5335
  #start;
@@ -9563,12 +9563,12 @@ ${this.toYamlLike(value, indent + 1)}`;
9563
9563
  }
9564
9564
  static async loadFromFile(configPath) {
9565
9565
  const { importNodeBuiltin: importNodeBuiltin2 } = await Promise.resolve().then(() => (init_import_helper(), import_helper_exports));
9566
- const fs49 = await importNodeBuiltin2("fs");
9566
+ const fs51 = await importNodeBuiltin2("fs");
9567
9567
  const _path = await importNodeBuiltin2("_path");
9568
9568
  const os23 = await importNodeBuiltin2("os");
9569
9569
  const targetPath = configPath || _path.join(os23.homedir(), ".maria", "config.json");
9570
9570
  try {
9571
- const data = await fs49.promises.readFile(targetPath, "utf-8");
9571
+ const data = await fs51.promises.readFile(targetPath, "utf-8");
9572
9572
  return JSON.parse(data);
9573
9573
  } catch (innerError) {
9574
9574
  if (innerError?.code === "ENOENT") {
@@ -9582,25 +9582,25 @@ ${this.toYamlLike(value, indent + 1)}`;
9582
9582
  }
9583
9583
  async save(configPath, options) {
9584
9584
  const { importNodeBuiltin: importNodeBuiltin2 } = await Promise.resolve().then(() => (init_import_helper(), import_helper_exports));
9585
- const fs49 = await importNodeBuiltin2("fs");
9585
+ const fs51 = await importNodeBuiltin2("fs");
9586
9586
  const _path = await importNodeBuiltin2("_path");
9587
9587
  const os23 = await importNodeBuiltin2("os");
9588
9588
  const targetPath = configPath || _path.join(os23.homedir(), ".maria", "config.json");
9589
9589
  try {
9590
9590
  if (options?.backup) {
9591
9591
  try {
9592
- await fs49.promises.access(targetPath);
9592
+ await fs51.promises.access(targetPath);
9593
9593
  const backupPath = `${targetPath}.backup.${Date.now()}`;
9594
- await fs49.promises.copyFile(targetPath, backupPath);
9594
+ await fs51.promises.copyFile(targetPath, backupPath);
9595
9595
  } catch {
9596
9596
  }
9597
9597
  }
9598
- await fs49.promises.mkdir(_path.dirname(targetPath), { recursive: true });
9598
+ await fs51.promises.mkdir(_path.dirname(targetPath), { recursive: true });
9599
9599
  const dataToSave = this.getAll({
9600
9600
  maskSensitive: options?.maskSensitive ?? true,
9601
9601
  includeSourceMap: options?.includeSourceMap ?? false
9602
9602
  });
9603
- await fs49.promises.writeFile(
9603
+ await fs51.promises.writeFile(
9604
9604
  targetPath,
9605
9605
  JSON.stringify(dataToSave, null, 2),
9606
9606
  { mode: 384 }
@@ -9644,12 +9644,12 @@ ${this.toYamlLike(value, indent + 1)}`;
9644
9644
  }
9645
9645
  if (outputPath) {
9646
9646
  const { importNodeBuiltin: importNodeBuiltin2 } = await Promise.resolve().then(() => (init_import_helper(), import_helper_exports));
9647
- const fs49 = await importNodeBuiltin2("fs");
9647
+ const fs51 = await importNodeBuiltin2("fs");
9648
9648
  const _path = await importNodeBuiltin2(
9649
9649
  "_path"
9650
9650
  );
9651
- await fs49.promises.mkdir(_path.dirname(outputPath), { recursive: true });
9652
- await fs49.promises.writeFile(outputPath, content, "utf-8");
9651
+ await fs51.promises.mkdir(_path.dirname(outputPath), { recursive: true });
9652
+ await fs51.promises.writeFile(outputPath, content, "utf-8");
9653
9653
  console.log(`\u2705 Configuration exported to ${outputPath}`);
9654
9654
  }
9655
9655
  return content;
@@ -9958,13 +9958,13 @@ async function loadEnvironmentConfig() {
9958
9958
  }
9959
9959
  try {
9960
9960
  const { importNodeBuiltin: importNodeBuiltin2, safeDynamicImport: safeDynamicImport2 } = await Promise.resolve().then(() => (init_import_helper(), import_helper_exports));
9961
- const fs49 = await safeDynamicImport2("fs-extra").catch(
9961
+ const fs51 = await safeDynamicImport2("fs-extra").catch(
9962
9962
  () => importNodeBuiltin2("fs")
9963
9963
  );
9964
9964
  const _path = await importNodeBuiltin2("_path");
9965
9965
  const _envPath = _path.join(process.cwd(), ".env.local");
9966
- if (await fs49.pathExists(_envPath)) {
9967
- const _envContent = await fs49.readFile(_envPath, "utf-8");
9966
+ if (await fs51.pathExists(_envPath)) {
9967
+ const _envContent = await fs51.readFile(_envPath, "utf-8");
9968
9968
  console.log("Loading environment from:", _envPath);
9969
9969
  environmentLoaded = true;
9970
9970
  const _lines = _envContent.split("\n");
@@ -19536,8 +19536,8 @@ var init_ConfigService = __esm({
19536
19536
  /**
19537
19537
  * ネストされた設定値の取得
19538
19538
  */
19539
- getNestedValue(path60) {
19540
- const keys = path60.split(".");
19539
+ getNestedValue(path64) {
19540
+ const keys = path64.split(".");
19541
19541
  let value = this._config;
19542
19542
  for (const key of keys) {
19543
19543
  if (value && typeof value === "object" && key in value) {
@@ -19567,8 +19567,8 @@ var init_ConfigService = __esm({
19567
19567
  /**
19568
19568
  * ネストされた設定値の更新
19569
19569
  */
19570
- async setNestedValue(path60, value) {
19571
- const keys = path60.split(".");
19570
+ async setNestedValue(path64, value) {
19571
+ const keys = path64.split(".");
19572
19572
  const lastKey = keys.pop();
19573
19573
  let target = this._config;
19574
19574
  for (const key of keys) {
@@ -19581,7 +19581,7 @@ var init_ConfigService = __esm({
19581
19581
  target[lastKey] = value;
19582
19582
  this.validateConfig();
19583
19583
  this.emitChange({
19584
- path: path60,
19584
+ path: path64,
19585
19585
  oldValue,
19586
19586
  newValue: value,
19587
19587
  timestamp: /* @__PURE__ */ new Date()
@@ -19626,8 +19626,8 @@ var init_ConfigService = __esm({
19626
19626
  setupAutoSave() {
19627
19627
  process.on("exit", () => {
19628
19628
  if (this._isDirty) {
19629
- const fs49 = __require("fs");
19630
- fs49.writeFileSync(
19629
+ const fs51 = __require("fs");
19630
+ fs51.writeFileSync(
19631
19631
  this._userConfigPath,
19632
19632
  JSON.stringify(this._config, null, 2),
19633
19633
  "utf-8"
@@ -19638,13 +19638,13 @@ var init_ConfigService = __esm({
19638
19638
  /**
19639
19639
  * 変更リスナーの登録
19640
19640
  */
19641
- onChange(path60, listener) {
19642
- if (!this._listeners.has(path60)) {
19643
- this._listeners.set(path60, []);
19641
+ onChange(path64, listener) {
19642
+ if (!this._listeners.has(path64)) {
19643
+ this._listeners.set(path64, []);
19644
19644
  }
19645
- this._listeners.get(path60).push(listener);
19645
+ this._listeners.get(path64).push(listener);
19646
19646
  return () => {
19647
- const listeners = this._listeners.get(path60);
19647
+ const listeners = this._listeners.get(path64);
19648
19648
  if (listeners) {
19649
19649
  const index = listeners.indexOf(listener);
19650
19650
  if (index !== -1) {
@@ -20133,7 +20133,7 @@ var init_ValidationService = __esm({
20133
20133
  );
20134
20134
  this._schemas.set(
20135
20135
  "filePath",
20136
- zod.z.string().min(1).max(this._config.maxFilePathLength).refine((path60) => !this.containsPathTraversal(path60), {
20136
+ zod.z.string().min(1).max(this._config.maxFilePathLength).refine((path64) => !this.containsPathTraversal(path64), {
20137
20137
  message: "Path traversal detected"
20138
20138
  })
20139
20139
  );
@@ -20272,11 +20272,11 @@ var init_ValidationService = __esm({
20272
20272
  /**
20273
20273
  * ファイルパス検証
20274
20274
  */
20275
- validateFilePath(path60) {
20275
+ validateFilePath(path64) {
20276
20276
  try {
20277
20277
  const schema = this._schemas.get("filePath");
20278
- const result = schema.parse(path60);
20279
- if (this.isSystemPath(path60)) {
20278
+ const result = schema.parse(path64);
20279
+ if (this.isSystemPath(path64)) {
20280
20280
  return {
20281
20281
  valid: false,
20282
20282
  errors: [
@@ -20422,8 +20422,8 @@ var init_ValidationService = __esm({
20422
20422
  /**
20423
20423
  * パストラバーサルの検出
20424
20424
  */
20425
- containsPathTraversal(path60) {
20426
- return /\.\.[/\\]/.test(path60) || path60.includes("..\\") || path60.includes("../");
20425
+ containsPathTraversal(path64) {
20426
+ return /\.\.[/\\]/.test(path64) || path64.includes("..\\") || path64.includes("../");
20427
20427
  }
20428
20428
  /**
20429
20429
  * 危険なコマンドの判定
@@ -20450,7 +20450,7 @@ var init_ValidationService = __esm({
20450
20450
  /**
20451
20451
  * システムパスの判定
20452
20452
  */
20453
- isSystemPath(path60) {
20453
+ isSystemPath(path64) {
20454
20454
  const systemPaths = [
20455
20455
  "/etc",
20456
20456
  "/sys",
@@ -20464,7 +20464,7 @@ var init_ValidationService = __esm({
20464
20464
  "/sbin"
20465
20465
  ];
20466
20466
  return systemPaths.some(
20467
- (sysPath) => path60.toLowerCase().startsWith(sysPath.toLowerCase())
20467
+ (sysPath) => path64.toLowerCase().startsWith(sysPath.toLowerCase())
20468
20468
  );
20469
20469
  }
20470
20470
  /**
@@ -25440,10 +25440,10 @@ Run /doctor --fix to automatically fix ${fixableCount} issue(s)`
25440
25440
  const finalize = async (text, data) => {
25441
25441
  if (outputPath) {
25442
25442
  try {
25443
- const fs49 = await import('fs/promises');
25444
- const path60 = await import('path');
25445
- const abs = path60.resolve(outputPath);
25446
- await fs49.writeFile(abs, text, "utf-8");
25443
+ const fs51 = await import('fs/promises');
25444
+ const path64 = await import('path');
25445
+ const abs = path64.resolve(outputPath);
25446
+ await fs51.writeFile(abs, text, "utf-8");
25447
25447
  const msg = `Saved doctor report to ${abs}`;
25448
25448
  return { ok: true, message: msg, data: { path: abs, bytes: Buffer.byteLength(text, "utf-8") } };
25449
25449
  } catch (e2) {
@@ -25533,10 +25533,10 @@ Run /doctor --fix to automatically fix ${fixableCount} issue(s)`
25533
25533
  const finalize = async (text, data) => {
25534
25534
  if (outputPath) {
25535
25535
  try {
25536
- const fs49 = await import('fs/promises');
25537
- const path60 = await import('path');
25538
- const abs = path60.resolve(outputPath);
25539
- await fs49.writeFile(abs, text, "utf-8");
25536
+ const fs51 = await import('fs/promises');
25537
+ const path64 = await import('path');
25538
+ const abs = path64.resolve(outputPath);
25539
+ await fs51.writeFile(abs, text, "utf-8");
25540
25540
  const msg = `Saved metrics to ${abs}`;
25541
25541
  return { ok: true, message: msg, data: { path: abs, bytes: Buffer.byteLength(text, "utf-8") } };
25542
25542
  } catch (e2) {
@@ -25925,15 +25925,15 @@ var init_SessionOrchestrator = __esm({
25925
25925
  /**
25926
25926
  * 設定の取得
25927
25927
  */
25928
- getConfig(path60) {
25929
- return this._configService?.getNestedValue(path60);
25928
+ getConfig(path64) {
25929
+ return this._configService?.getNestedValue(path64);
25930
25930
  }
25931
25931
  /**
25932
25932
  * 設定の更新
25933
25933
  */
25934
- async setConfig(path60, value) {
25934
+ async setConfig(path64, value) {
25935
25935
  if (this._configService) {
25936
- await this._configService.setNestedValue(path60, value);
25936
+ await this._configService.setNestedValue(path64, value);
25937
25937
  }
25938
25938
  }
25939
25939
  /**
@@ -26051,11 +26051,11 @@ var init_interactive_session = __esm({
26051
26051
  getStats() {
26052
26052
  return this.orchestrator.getSessionStats();
26053
26053
  }
26054
- getConfig(path60) {
26055
- return this.orchestrator.getConfig(path60);
26054
+ getConfig(path64) {
26055
+ return this.orchestrator.getConfig(path64);
26056
26056
  }
26057
- async setConfig(path60, value) {
26058
- await this.orchestrator.setConfig(path60, value);
26057
+ async setConfig(path64, value) {
26058
+ await this.orchestrator.setConfig(path64, value);
26059
26059
  }
26060
26060
  };
26061
26061
  }
@@ -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.29",
26070
- description: "\u{1F680} MARIA v4.3.29 - 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.31",
26070
+ description: "\u{1F680} MARIA v4.3.31 - 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",
@@ -28099,7 +28099,7 @@ var init_AuthenticationManager = __esm({
28099
28099
  const response = await fetch(`${this.apiBase}/api/user/profile`, {
28100
28100
  headers: {
28101
28101
  "Authorization": `Bearer ${tokens2.accessToken}`,
28102
- "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.29"}`
28102
+ "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.31"}`
28103
28103
  }
28104
28104
  });
28105
28105
  if (response.status === 401) {
@@ -28718,9 +28718,9 @@ function getDeviceId() {
28718
28718
  function getSessionId() {
28719
28719
  return global.MARIA_SESSION_ID;
28720
28720
  }
28721
- async function callApi(path60, init3 = {}) {
28721
+ async function callApi(path64, init3 = {}) {
28722
28722
  const apiBase = process.env.MARIA_API_BASE || "https://api.maria-code.ai";
28723
- const fullUrl = `${apiBase}${path60}`;
28723
+ const fullUrl = `${apiBase}${path64}`;
28724
28724
  let tokens2 = await authManager.getValidTokens();
28725
28725
  if (!tokens2) {
28726
28726
  console.log(chalk14__default.default.red(ERR.AUTH_REQUIRED.msg));
@@ -28731,7 +28731,7 @@ async function callApi(path60, init3 = {}) {
28731
28731
  "Authorization": `Bearer ${token}`,
28732
28732
  "X-Device-Id": getDeviceId(),
28733
28733
  "X-Session-Id": getSessionId() || "",
28734
- "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.29"}`,
28734
+ "User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.31"}`,
28735
28735
  "Content-Type": init3.headers?.["Content-Type"] || "application/json"
28736
28736
  });
28737
28737
  const doFetch = async (token) => {
@@ -28789,8 +28789,8 @@ async function callApi(path60, init3 = {}) {
28789
28789
  }
28790
28790
  return response;
28791
28791
  }
28792
- async function callApiJson(path60, init3 = {}) {
28793
- const response = await callApi(path60, init3);
28792
+ async function callApiJson(path64, init3 = {}) {
28793
+ const response = await callApi(path64, init3);
28794
28794
  if (!response.ok) {
28795
28795
  const error2 = await response.json().catch(() => ({
28796
28796
  message: `API error: ${response.status} ${response.statusText}`
@@ -33659,12 +33659,12 @@ var init_esm4 = __esm({
33659
33659
  /**
33660
33660
  * Get the Path object referenced by the string path, resolved from this Path
33661
33661
  */
33662
- resolve(path60) {
33663
- if (!path60) {
33662
+ resolve(path64) {
33663
+ if (!path64) {
33664
33664
  return this;
33665
33665
  }
33666
- const rootPath = this.getRootString(path60);
33667
- const dir = path60.substring(rootPath.length);
33666
+ const rootPath = this.getRootString(path64);
33667
+ const dir = path64.substring(rootPath.length);
33668
33668
  const dirParts = dir.split(this.splitSep);
33669
33669
  const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
33670
33670
  return result;
@@ -34416,8 +34416,8 @@ var init_esm4 = __esm({
34416
34416
  /**
34417
34417
  * @internal
34418
34418
  */
34419
- getRootString(path60) {
34420
- return path11.win32.parse(path60).root;
34419
+ getRootString(path64) {
34420
+ return path11.win32.parse(path64).root;
34421
34421
  }
34422
34422
  /**
34423
34423
  * @internal
@@ -34463,8 +34463,8 @@ var init_esm4 = __esm({
34463
34463
  /**
34464
34464
  * @internal
34465
34465
  */
34466
- getRootString(path60) {
34467
- return path60.startsWith("/") ? "/" : "";
34466
+ getRootString(path64) {
34467
+ return path64.startsWith("/") ? "/" : "";
34468
34468
  }
34469
34469
  /**
34470
34470
  * @internal
@@ -34513,8 +34513,8 @@ var init_esm4 = __esm({
34513
34513
  *
34514
34514
  * @internal
34515
34515
  */
34516
- constructor(cwd2 = process.cwd(), pathImpl, sep4, { nocase, childrenCacheSize = 16 * 1024, fs: fs49 = defaultFS } = {}) {
34517
- this.#fs = fsFromOption(fs49);
34516
+ constructor(cwd2 = process.cwd(), pathImpl, sep4, { nocase, childrenCacheSize = 16 * 1024, fs: fs51 = defaultFS } = {}) {
34517
+ this.#fs = fsFromOption(fs51);
34518
34518
  if (cwd2 instanceof URL || cwd2.startsWith("file://")) {
34519
34519
  cwd2 = url.fileURLToPath(cwd2);
34520
34520
  }
@@ -34553,11 +34553,11 @@ var init_esm4 = __esm({
34553
34553
  /**
34554
34554
  * Get the depth of a provided path, string, or the cwd
34555
34555
  */
34556
- depth(path60 = this.cwd) {
34557
- if (typeof path60 === "string") {
34558
- path60 = this.cwd.resolve(path60);
34556
+ depth(path64 = this.cwd) {
34557
+ if (typeof path64 === "string") {
34558
+ path64 = this.cwd.resolve(path64);
34559
34559
  }
34560
- return path60.depth();
34560
+ return path64.depth();
34561
34561
  }
34562
34562
  /**
34563
34563
  * Return the cache of child entries. Exposed so subclasses can create
@@ -35044,9 +35044,9 @@ var init_esm4 = __esm({
35044
35044
  process11();
35045
35045
  return results;
35046
35046
  }
35047
- chdir(path60 = this.cwd) {
35047
+ chdir(path64 = this.cwd) {
35048
35048
  const oldCwd = this.cwd;
35049
- this.cwd = typeof path60 === "string" ? this.cwd.resolve(path60) : path60;
35049
+ this.cwd = typeof path64 === "string" ? this.cwd.resolve(path64) : path64;
35050
35050
  this.cwd[setAsCwd](oldCwd);
35051
35051
  }
35052
35052
  };
@@ -35072,8 +35072,8 @@ var init_esm4 = __esm({
35072
35072
  /**
35073
35073
  * @internal
35074
35074
  */
35075
- newRoot(fs49) {
35076
- return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs49 });
35075
+ newRoot(fs51) {
35076
+ return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs51 });
35077
35077
  }
35078
35078
  /**
35079
35079
  * Return true if the provided path string is an absolute path
@@ -35101,8 +35101,8 @@ var init_esm4 = __esm({
35101
35101
  /**
35102
35102
  * @internal
35103
35103
  */
35104
- newRoot(fs49) {
35105
- return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs49 });
35104
+ newRoot(fs51) {
35105
+ return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs51 });
35106
35106
  }
35107
35107
  /**
35108
35108
  * Return true if the provided path string is an absolute path
@@ -35421,8 +35421,8 @@ var init_processor = __esm({
35421
35421
  }
35422
35422
  // match, absolute, ifdir
35423
35423
  entries() {
35424
- return [...this.store.entries()].map(([path60, n]) => [
35425
- path60,
35424
+ return [...this.store.entries()].map(([path64, n]) => [
35425
+ path64,
35426
35426
  !!(n & 2),
35427
35427
  !!(n & 1)
35428
35428
  ]);
@@ -35635,9 +35635,9 @@ var init_walker = __esm({
35635
35635
  signal;
35636
35636
  maxDepth;
35637
35637
  includeChildMatches;
35638
- constructor(patterns, path60, opts) {
35638
+ constructor(patterns, path64, opts) {
35639
35639
  this.patterns = patterns;
35640
- this.path = path60;
35640
+ this.path = path64;
35641
35641
  this.opts = opts;
35642
35642
  this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
35643
35643
  this.includeChildMatches = opts.includeChildMatches !== false;
@@ -35656,11 +35656,11 @@ var init_walker = __esm({
35656
35656
  });
35657
35657
  }
35658
35658
  }
35659
- #ignored(path60) {
35660
- return this.seen.has(path60) || !!this.#ignore?.ignored?.(path60);
35659
+ #ignored(path64) {
35660
+ return this.seen.has(path64) || !!this.#ignore?.ignored?.(path64);
35661
35661
  }
35662
- #childrenIgnored(path60) {
35663
- return !!this.#ignore?.childrenIgnored?.(path60);
35662
+ #childrenIgnored(path64) {
35663
+ return !!this.#ignore?.childrenIgnored?.(path64);
35664
35664
  }
35665
35665
  // backpressure mechanism
35666
35666
  pause() {
@@ -35875,8 +35875,8 @@ var init_walker = __esm({
35875
35875
  };
35876
35876
  GlobWalker = class extends GlobUtil {
35877
35877
  matches = /* @__PURE__ */ new Set();
35878
- constructor(patterns, path60, opts) {
35879
- super(patterns, path60, opts);
35878
+ constructor(patterns, path64, opts) {
35879
+ super(patterns, path64, opts);
35880
35880
  }
35881
35881
  matchEmit(e2) {
35882
35882
  this.matches.add(e2);
@@ -35913,8 +35913,8 @@ var init_walker = __esm({
35913
35913
  };
35914
35914
  GlobStream = class extends GlobUtil {
35915
35915
  results;
35916
- constructor(patterns, path60, opts) {
35917
- super(patterns, path60, opts);
35916
+ constructor(patterns, path64, opts) {
35917
+ super(patterns, path64, opts);
35918
35918
  this.results = new Minipass({
35919
35919
  signal: this.signal,
35920
35920
  objectMode: true
@@ -41648,9 +41648,9 @@ var init_SafetyGuard = __esm({
41648
41648
  }
41649
41649
  }
41650
41650
  if (action.args.paths && Array.isArray(action.args.paths)) {
41651
- for (const path60 of action.args.paths) {
41652
- if (!this.validatePath(path60)) {
41653
- violations.push(`Invalid path: ${path60}`);
41651
+ for (const path64 of action.args.paths) {
41652
+ if (!this.validatePath(path64)) {
41653
+ violations.push(`Invalid path: ${path64}`);
41654
41654
  }
41655
41655
  }
41656
41656
  }
@@ -41706,15 +41706,15 @@ var init_SafetyGuard = __esm({
41706
41706
  * Validate file path against allowed/blocked lists
41707
41707
  */
41708
41708
  validatePath(filePath) {
41709
- const path60 = __require("path");
41710
- const resolvedPath = path60.resolve(filePath);
41709
+ const path64 = __require("path");
41710
+ const resolvedPath = path64.resolve(filePath);
41711
41711
  for (const blockedPath of this.constraints.blockedPaths) {
41712
- if (resolvedPath.startsWith(path60.resolve(blockedPath))) {
41712
+ if (resolvedPath.startsWith(path64.resolve(blockedPath))) {
41713
41713
  return false;
41714
41714
  }
41715
41715
  }
41716
41716
  for (const allowedPath of this.constraints.allowedPaths) {
41717
- if (resolvedPath.startsWith(path60.resolve(allowedPath))) {
41717
+ if (resolvedPath.startsWith(path64.resolve(allowedPath))) {
41718
41718
  return true;
41719
41719
  }
41720
41720
  }
@@ -41743,9 +41743,9 @@ var init_SafetyGuard = __esm({
41743
41743
  violations.push(`Invalid path in ${action.type}: ${action.args.path}`);
41744
41744
  }
41745
41745
  if (action.args.paths && Array.isArray(action.args.paths)) {
41746
- for (const path60 of action.args.paths) {
41747
- if (!this.validatePath(path60)) {
41748
- violations.push(`Invalid path in ${action.type}: ${path60}`);
41746
+ for (const path64 of action.args.paths) {
41747
+ if (!this.validatePath(path64)) {
41748
+ violations.push(`Invalid path in ${action.type}: ${path64}`);
41749
41749
  }
41750
41750
  }
41751
41751
  }
@@ -42714,8 +42714,8 @@ var init_ConfigActionExecutor = __esm({
42714
42714
  /**
42715
42715
  * Set nested configuration value using dot notation
42716
42716
  */
42717
- setNestedValue(obj, path60, value) {
42718
- const keys = path60.split(".");
42717
+ setNestedValue(obj, path64, value) {
42718
+ const keys = path64.split(".");
42719
42719
  let current = obj;
42720
42720
  for (let i2 = 0; i2 < keys.length - 1; i2++) {
42721
42721
  const key = keys[i2];
@@ -48413,6 +48413,7 @@ var init_image_command = __esm({
48413
48413
  const spinner = new ProcessAnimation();
48414
48414
  spinner.start();
48415
48415
  try {
48416
+ const useRemote = String(process.env.MARIA_USE_REMOTE_MEDIA || "").toLowerCase() === "1" && await authManager.isAuthenticated();
48416
48417
  if (useRemote) {
48417
48418
  try {
48418
48419
  const body = {
@@ -48898,8 +48899,8 @@ var init_video_command = __esm({
48898
48899
  const spinner = new ProcessAnimation();
48899
48900
  spinner.start();
48900
48901
  try {
48901
- const useRemote2 = String(process.env.MARIA_USE_REMOTE_MEDIA || "").toLowerCase() === "1" && await authManager.isAuthenticated();
48902
- if (useRemote2) {
48902
+ const useRemote = String(process.env.MARIA_USE_REMOTE_MEDIA || "").toLowerCase() === "1" && await authManager.isAuthenticated();
48903
+ if (useRemote) {
48903
48904
  try {
48904
48905
  const body = {
48905
48906
  prompt: cli.prompt,
@@ -50688,7 +50689,7 @@ var init_about_command = __esm({
50688
50689
  async execute(args2, context2) {
50689
50690
  const output3 = [];
50690
50691
  output3.push("");
50691
- output3.push(chalk14__default.default.cyan.bold("\u{1F916} About MARIA v4.3.29"));
50692
+ output3.push(chalk14__default.default.cyan.bold("\u{1F916} About MARIA v4.3.31"));
50692
50693
  output3.push(chalk14__default.default.gray("\u2550".repeat(40)));
50693
50694
  output3.push("");
50694
50695
  output3.push(chalk14__default.default.white.bold("MARIA - Minimal API, Maximum Power"));
@@ -54169,10 +54170,10 @@ function suggestName(fp, p) {
54169
54170
  const base = (fp.description || "file").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
54170
54171
  return base || "file";
54171
54172
  }
54172
- function guessKindByPath(path60) {
54173
- if (/__tests__|\.spec\.(t|j)sx?$|^tests\//.test(path60)) return "test";
54174
- if (/^docs\//.test(path60) || /\.md$/.test(path60)) return "doc";
54175
- if (/\.(json|cjs|js|ts)$/.test(path60) && !/src\//.test(path60)) return "config";
54173
+ function guessKindByPath(path64) {
54174
+ if (/__tests__|\.spec\.(t|j)sx?$|^tests\//.test(path64)) return "test";
54175
+ if (/^docs\//.test(path64) || /\.md$/.test(path64)) return "doc";
54176
+ if (/\.(json|cjs|js|ts)$/.test(path64) && !/src\//.test(path64)) return "config";
54176
54177
  return "source";
54177
54178
  }
54178
54179
  var init_PathInferencer = __esm({
@@ -54432,9 +54433,9 @@ function formatPlanAsDiff(files, opts) {
54432
54433
  function readCurrentFileSafe(root, rel, abs) {
54433
54434
  if (!root && !abs) return "";
54434
54435
  try {
54435
- const fs49 = __require("fs");
54436
+ const fs51 = __require("fs");
54436
54437
  const p = abs ? abs : __require("path").join(root, rel);
54437
- return fs49.existsSync(p) ? fs49.readFileSync(p, "utf8") : "";
54438
+ return fs51.existsSync(p) ? fs51.readFileSync(p, "utf8") : "";
54438
54439
  } catch {
54439
54440
  return "";
54440
54441
  }
@@ -55307,9 +55308,9 @@ ${editContext}`;
55307
55308
  for (let i2 = 0; i2 < blocks.length; i2++) {
55308
55309
  const b = blocks[i2];
55309
55310
  const desired = typeof b.filename === "string" && b.filename.trim() ? b.filename.trim() : null;
55310
- const path60 = desired || suggestName2(request, b.language, i2);
55311
+ const path64 = desired || suggestName2(request, b.language, i2);
55311
55312
  initial.push({
55312
- path: path60,
55313
+ path: path64,
55313
55314
  kind: "source",
55314
55315
  action: "create",
55315
55316
  description: describe2(b.language, ""),
@@ -55340,13 +55341,13 @@ ${editContext}`;
55340
55341
  { root: opts.root }
55341
55342
  );
55342
55343
  try {
55343
- const [{ access: access18 }, path60] = await Promise.all([
55344
+ const [{ access: access18 }, path64] = await Promise.all([
55344
55345
  import('fs/promises'),
55345
55346
  import('path')
55346
55347
  ]);
55347
55348
  for (const p of normalized) {
55348
55349
  try {
55349
- const absCandidate = p.absPath ? p.absPath : path60.join(opts.root, p.path);
55350
+ const absCandidate = p.absPath ? p.absPath : path64.join(opts.root, p.path);
55350
55351
  await access18(absCandidate);
55351
55352
  p.action = "modify";
55352
55353
  if (isEditIntent) {
@@ -55538,12 +55539,12 @@ function languageExt(lang) {
55538
55539
  }
55539
55540
  async function journalResume(root, request, files) {
55540
55541
  try {
55541
- const fs49 = await import('fs/promises');
55542
+ const fs51 = await import('fs/promises');
55542
55543
  const dir = path11__namespace.default.join(root, ".maria", "memory");
55543
- await fs49.mkdir(dir, { recursive: true });
55544
+ await fs51.mkdir(dir, { recursive: true });
55544
55545
  const out = path11__namespace.default.join(dir, "resume-plan.json");
55545
55546
  const payload = { request, createdAt: (/* @__PURE__ */ new Date()).toISOString(), files };
55546
- await fs49.writeFile(out, JSON.stringify(payload, null, 2), "utf8");
55547
+ await fs51.writeFile(out, JSON.stringify(payload, null, 2), "utf8");
55547
55548
  } catch {
55548
55549
  }
55549
55550
  }
@@ -55703,14 +55704,14 @@ async function ensureTopFolder(root, proposed, plans) {
55703
55704
  return { folderName: unique };
55704
55705
  }
55705
55706
  async function ensureUniqueFolder(root, base) {
55706
- const fs49 = await import('fs/promises');
55707
+ const fs51 = await import('fs/promises');
55707
55708
  const pathMod = await import('path');
55708
55709
  let name2 = sanitizeFolderName(base);
55709
55710
  let suffix = 0;
55710
55711
  for (; suffix < Number.MAX_SAFE_INTEGER; ) {
55711
55712
  const candidate = suffix === 0 ? name2 : `${name2}-${String(suffix).padStart(2, "0")}`;
55712
55713
  try {
55713
- await fs49.access(pathMod.join(root, candidate));
55714
+ await fs51.access(pathMod.join(root, candidate));
55714
55715
  suffix += 1;
55715
55716
  } catch {
55716
55717
  return candidate;
@@ -55720,13 +55721,13 @@ async function ensureUniqueFolder(root, base) {
55720
55721
  }
55721
55722
  async function buildEditContext(root, files, maxLines, maxBytes) {
55722
55723
  try {
55723
- const fs49 = await import('fs/promises');
55724
+ const fs51 = await import('fs/promises');
55724
55725
  const pathMod = await import('path');
55725
55726
  const sections = [];
55726
55727
  for (const rel of files) {
55727
55728
  const full = pathMod.join(root, rel);
55728
55729
  try {
55729
- const buf = await fs49.readFile(full);
55730
+ const buf = await fs51.readFile(full);
55730
55731
  const clipped = buf.length > maxBytes ? buf.subarray(0, maxBytes) : buf;
55731
55732
  const text = clipped.toString("utf8").replace(/\r\n/g, "\n");
55732
55733
  const lines = text.split("\n").slice(0, maxLines).join("\n");
@@ -55743,7 +55744,7 @@ ${lines}
55743
55744
  }
55744
55745
  }
55745
55746
  async function resolveExplicitPaths(root, files, hintText) {
55746
- const fs49 = await import('fs/promises');
55747
+ const fs51 = await import('fs/promises');
55747
55748
  const pathMod = await import('path');
55748
55749
  const { loadGlobby: loadGlobby2 } = await Promise.resolve().then(() => (init_esm_compat(), esm_compat_exports));
55749
55750
  const globby = await loadGlobby2();
@@ -55761,7 +55762,7 @@ async function resolveExplicitPaths(root, files, hintText) {
55761
55762
  const normalized = rel.replace(/^\/+/, "").replace(/\\/g, "/");
55762
55763
  const fullExact = pathMod.join(root, normalized);
55763
55764
  try {
55764
- await fs49.access(fullExact);
55765
+ await fs51.access(fullExact);
55765
55766
  return normalized;
55766
55767
  } catch {
55767
55768
  }
@@ -55808,7 +55809,7 @@ async function resolveExplicitPaths(root, files, hintText) {
55808
55809
  for (const pre of prefixes) {
55809
55810
  const cand = pathMod.join(root, pre + normalized);
55810
55811
  try {
55811
- await fs49.access(cand);
55812
+ await fs51.access(cand);
55812
55813
  return (pre + normalized).replace(/^\/+/, "");
55813
55814
  } catch {
55814
55815
  }
@@ -55863,14 +55864,14 @@ async function resolveExplicitPaths(root, files, hintText) {
55863
55864
  return out;
55864
55865
  }
55865
55866
  async function pickExistingFolderPrefix(root, parentPath) {
55866
- const fs49 = await import('fs/promises');
55867
+ const fs51 = await import('fs/promises');
55867
55868
  const pathMod = await import('path');
55868
55869
  const parts = parentPath.replace(/^\/+/, "").split("/").filter(Boolean);
55869
55870
  const prefixes = ["src", "app", "pages", ""];
55870
55871
  for (const pre of prefixes) {
55871
55872
  const test = pre ? pathMod.join(root, pre, ...parts) : pathMod.join(root, ...parts);
55872
55873
  try {
55873
- await fs49.access(test);
55874
+ await fs51.access(test);
55874
55875
  return pre ? `${pre}/` : "";
55875
55876
  } catch {
55876
55877
  }
@@ -56230,16 +56231,16 @@ ${pretty}`);
56230
56231
  }
56231
56232
  async persistLastPlan(root, plans) {
56232
56233
  try {
56233
- const fs49 = await import('fs/promises');
56234
+ const fs51 = await import('fs/promises');
56234
56235
  const p = path11__namespace.join(root, ".maria");
56235
- await fs49.mkdir(p, { recursive: true });
56236
+ await fs51.mkdir(p, { recursive: true });
56236
56237
  const out = path11__namespace.join(p, "last-plan.json");
56237
- await fs49.writeFile(out, JSON.stringify({ createdAt: (/* @__PURE__ */ new Date()).toISOString(), plans }, null, 2), "utf8");
56238
+ await fs51.writeFile(out, JSON.stringify({ createdAt: (/* @__PURE__ */ new Date()).toISOString(), plans }, null, 2), "utf8");
56238
56239
  } catch {
56239
56240
  }
56240
56241
  }
56241
56242
  async applyPlan(plans, options) {
56242
- const fs49 = await import('fs/promises');
56243
+ const fs51 = await import('fs/promises');
56243
56244
  const created = [];
56244
56245
  const modified = [];
56245
56246
  const skipped = [];
@@ -56258,9 +56259,9 @@ ${pretty}`);
56258
56259
  continue;
56259
56260
  }
56260
56261
  const tmp = full + `.tmp-${process.pid}-${Date.now()}`;
56261
- await fs49.mkdir(path11__namespace.dirname(full), { recursive: true });
56262
- await fs49.writeFile(tmp, plan.preview || "", "utf8");
56263
- await fs49.rename(tmp, full);
56262
+ await fs51.mkdir(path11__namespace.dirname(full), { recursive: true });
56263
+ await fs51.writeFile(tmp, plan.preview || "", "utf8");
56264
+ await fs51.rename(tmp, full);
56264
56265
  if (exists2) modified.push(plan.path);
56265
56266
  else created.push(plan.path);
56266
56267
  written++;
@@ -56271,7 +56272,7 @@ ${pretty}`);
56271
56272
  if (options.rollback) {
56272
56273
  for (const p of [...created, ...modified]) {
56273
56274
  try {
56274
- await fs49.unlink(path11__namespace.join(options.root, p));
56275
+ await fs51.unlink(path11__namespace.join(options.root, p));
56275
56276
  } catch {
56276
56277
  }
56277
56278
  }
@@ -56281,8 +56282,8 @@ ${pretty}`);
56281
56282
  }
56282
56283
  async pathExists(p) {
56283
56284
  try {
56284
- const fs49 = await import('fs/promises');
56285
- await fs49.access(p);
56285
+ const fs51 = await import('fs/promises');
56286
+ await fs51.access(p);
56286
56287
  return true;
56287
56288
  } catch {
56288
56289
  return false;
@@ -56393,17 +56394,17 @@ ${pretty}`);
56393
56394
  // Attempt to collect attached files from context; map to AttachedFileContext
56394
56395
  async collectAttachedFiles(context2) {
56395
56396
  const list = [];
56396
- const fs49 = await import('fs/promises');
56397
- const path60 = await import('path');
56397
+ const fs51 = await import('fs/promises');
56398
+ const path64 = await import('path');
56398
56399
  const att = context2 && (context2.attachments || context2.input?.attachments) || [];
56399
56400
  for (const a of att) {
56400
56401
  try {
56401
56402
  const p = a.path || a.filePath || a.name || "";
56402
- const originalName = a.name || path60.basename(p || `attachment_${Date.now().toString(36)}`);
56403
+ const originalName = a.name || path64.basename(p || `attachment_${Date.now().toString(36)}`);
56403
56404
  let content = a.content;
56404
56405
  if (!content && p) {
56405
- const abs = path60.isAbsolute(p) ? p : path60.join(process.cwd(), p);
56406
- content = await fs49.readFile(abs, "utf8");
56406
+ const abs = path64.isAbsolute(p) ? p : path64.join(process.cwd(), p);
56407
+ content = await fs51.readFile(abs, "utf8");
56407
56408
  }
56408
56409
  if (!content) continue;
56409
56410
  list.push({ originalName, pathHint: p || void 0, content, size: Buffer.byteLength(content, "utf8"), mime: a.mime || a.type });
@@ -56969,12 +56970,12 @@ async function scanRoot(opts) {
56969
56970
  const filepath = path11__namespace.join(cwd2, name2);
56970
56971
  const result = await safeRead(filepath, 512 * 1024, maxLines, signal);
56971
56972
  if (result.head || result.meta) {
56972
- let meta26 = result.meta || object;
56973
+ let meta27 = result.meta || object;
56973
56974
  if (name2 === "package.json" && result.head) {
56974
56975
  try {
56975
56976
  const pkg = JSON.parse(result.head);
56976
- meta26 = {
56977
- ...meta26,
56977
+ meta27 = {
56978
+ ...meta27,
56978
56979
  name: pkg.name,
56979
56980
  version: pkg.version,
56980
56981
  type: pkg.type,
@@ -56987,14 +56988,14 @@ async function scanRoot(opts) {
56987
56988
  workspaces: pkg.workspaces
56988
56989
  };
56989
56990
  } catch (e2) {
56990
- meta26.parseError = true;
56991
+ meta27.parseError = true;
56991
56992
  }
56992
56993
  }
56993
56994
  findings.push({
56994
56995
  file: name2,
56995
56996
  kind: "read",
56996
56997
  head: result.head,
56997
- meta: meta26,
56998
+ meta: meta27,
56998
56999
  truncated: result.truncated
56999
57000
  });
57000
57001
  }
@@ -57332,19 +57333,19 @@ function extractPackageInfo(findings) {
57332
57333
  hasPostinstall: false
57333
57334
  };
57334
57335
  }
57335
- const meta26 = pkgFinding.meta;
57336
+ const meta27 = pkgFinding.meta;
57336
57337
  return {
57337
- name: meta26.name,
57338
- version: meta26.version,
57339
- type: meta26.type,
57340
- scripts: meta26.scripts ? Object.keys(meta26.scripts) : [],
57341
- hasPostinstall: !!meta26.scripts?.postinstall,
57342
- bin: meta26.bin,
57343
- main: meta26.main,
57344
- exports: meta26.exports,
57345
- dependencies: meta26.dependencies || [],
57346
- devDependencies: meta26.devDependencies || [],
57347
- workspaces: meta26.workspaces
57338
+ name: meta27.name,
57339
+ version: meta27.version,
57340
+ type: meta27.type,
57341
+ scripts: meta27.scripts ? Object.keys(meta27.scripts) : [],
57342
+ hasPostinstall: !!meta27.scripts?.postinstall,
57343
+ bin: meta27.bin,
57344
+ main: meta27.main,
57345
+ exports: meta27.exports,
57346
+ dependencies: meta27.dependencies || [],
57347
+ devDependencies: meta27.devDependencies || [],
57348
+ workspaces: meta27.workspaces
57348
57349
  };
57349
57350
  }
57350
57351
  function collectWarnings(pkg, findings, cwd2) {
@@ -57495,9 +57496,9 @@ function calculateMetrics(findings, startTime) {
57495
57496
  }
57496
57497
  function renderFinding(f3) {
57497
57498
  const title = `### ${f3.kind.toUpperCase()} \u2014 ${f3.file}`;
57498
- let meta26 = "";
57499
+ let meta27 = "";
57499
57500
  if (f3.meta && Object.keys(f3.meta).length > 0) {
57500
- meta26 = `
57501
+ meta27 = `
57501
57502
  <details><summary>meta</summary>
57502
57503
 
57503
57504
  \`\`\`json
@@ -57518,7 +57519,7 @@ ${f3.head.trim()}
57518
57519
  }
57519
57520
  const truncInfo = f3.truncated ? `
57520
57521
  > _truncated preview_` : "";
57521
- return [title, meta26, content, truncInfo, ""].join("\n");
57522
+ return [title, meta27, content, truncInfo, ""].join("\n");
57522
57523
  }
57523
57524
  function safeJsonStringify(obj) {
57524
57525
  try {
@@ -63092,17 +63093,17 @@ var init_GraphEngine = __esm({
63092
63093
  const visited = /* @__PURE__ */ new Set();
63093
63094
  const queue = [{ id: from, path: [from] }];
63094
63095
  while (queue.length) {
63095
- const { id, path: path60 } = queue.shift();
63096
+ const { id, path: path64 } = queue.shift();
63096
63097
  if (visited.has(id)) continue;
63097
63098
  visited.add(id);
63098
63099
  const neighbors = this.edges.get(id) || /* @__PURE__ */ new Set();
63099
63100
  for (const e2 of neighbors) {
63100
63101
  if (e2.to === to) {
63101
- const res = [...path60, to];
63102
+ const res = [...path64, to];
63102
63103
  this.recordQueryTime(Date.now() - start);
63103
63104
  return res;
63104
63105
  }
63105
- if (!visited.has(e2.to)) queue.push({ id: e2.to, path: [...path60, e2.to] });
63106
+ if (!visited.has(e2.to)) queue.push({ id: e2.to, path: [...path64, e2.to] });
63106
63107
  }
63107
63108
  }
63108
63109
  this.recordQueryTime(Date.now() - start);
@@ -65769,12 +65770,12 @@ This will:
65769
65770
  };
65770
65771
  const result = await this.deltaDetector.detectDelta(root, deltaOptions);
65771
65772
  const files = [
65772
- ...result.changed.map((path60) => ({
65773
- _path: path60,
65774
- type: previousState?.fileHashes?.[path60] ? "modified" : "added"
65773
+ ...result.changed.map((path64) => ({
65774
+ _path: path64,
65775
+ type: previousState?.fileHashes?.[path64] ? "modified" : "added"
65775
65776
  })),
65776
- ...result.deleted.map((path60) => ({
65777
- _path: path60,
65777
+ ...result.deleted.map((path64) => ({
65778
+ _path: path64,
65778
65779
  type: "deleted"
65779
65780
  }))
65780
65781
  ];
@@ -69501,13 +69502,13 @@ async function checkShield(commandName, userPlan = "free") {
69501
69502
  }
69502
69503
  async function loadManifest() {
69503
69504
  try {
69504
- const fs49 = await import('fs');
69505
- const path60 = await import('path');
69506
- const manifestPath = path60.join(
69505
+ const fs51 = await import('fs');
69506
+ const path64 = await import('path');
69507
+ const manifestPath = path64.join(
69507
69508
  __dirname,
69508
69509
  "../command-manifest-v2.1.json"
69509
69510
  );
69510
- const content = fs49.readFileSync(manifestPath, "utf-8");
69511
+ const content = fs51.readFileSync(manifestPath, "utf-8");
69511
69512
  return JSON.parse(content);
69512
69513
  } catch {
69513
69514
  return { commands: [] };
@@ -70601,6 +70602,1071 @@ var init_gpu_command = __esm({
70601
70602
  gpu_command_default = GPUCommand;
70602
70603
  }
70603
70604
  });
70605
+ var CriteriaManager;
70606
+ var init_CriteriaManager = __esm({
70607
+ "src/services/evaluation/CriteriaManager.ts"() {
70608
+ CriteriaManager = class {
70609
+ constructor(projectRoot) {
70610
+ this.projectRoot = projectRoot;
70611
+ }
70612
+ getDefaultPath() {
70613
+ return path11__namespace.default.join(this.projectRoot, ".maria", "evaluation.criteria.json");
70614
+ }
70615
+ async ensureCriteriaFile(customPath) {
70616
+ const criteriaPath = customPath ? path11__namespace.default.isAbsolute(customPath) ? customPath : path11__namespace.default.join(this.projectRoot, customPath) : this.getDefaultPath();
70617
+ const dir = path11__namespace.default.dirname(criteriaPath);
70618
+ await fs21.promises.mkdir(dir, { recursive: true });
70619
+ try {
70620
+ await fs21.promises.access(criteriaPath);
70621
+ return criteriaPath;
70622
+ } catch {
70623
+ const now2 = (/* @__PURE__ */ new Date()).toISOString();
70624
+ const payload = {
70625
+ version: "1.0.0",
70626
+ project: path11__namespace.default.basename(this.projectRoot) || "project",
70627
+ createdAt: now2,
70628
+ updatedAt: now2,
70629
+ items: this.createDefaultCriteria()
70630
+ };
70631
+ await fs21.promises.writeFile(criteriaPath, JSON.stringify(payload, null, 2), "utf8");
70632
+ return criteriaPath;
70633
+ }
70634
+ }
70635
+ async loadCriteria(criteriaPath) {
70636
+ const buf = await fs21.promises.readFile(criteriaPath, "utf8");
70637
+ const json = JSON.parse(buf);
70638
+ if (!Array.isArray(json.items)) {
70639
+ throw new Error("Invalid criteria file: items missing");
70640
+ }
70641
+ return json;
70642
+ }
70643
+ async updateCriteria(criteriaPath, updater) {
70644
+ const current = await this.loadCriteria(criteriaPath);
70645
+ const next = updater({ ...current, updatedAt: (/* @__PURE__ */ new Date()).toISOString() });
70646
+ await fs21.promises.writeFile(criteriaPath, JSON.stringify(next, null, 2), "utf8");
70647
+ }
70648
+ createDefaultCriteria() {
70649
+ const items = [
70650
+ ["clarity", "Clarity: Clear goals and requirements", 0.15, "Are requirements, specs, and assumptions explicitly stated?"],
70651
+ ["feasibility", "Feasibility: Realistic scope and timeline", 0.15, "Are dependencies, risks, and alternatives considered?"],
70652
+ ["maintainability", "Maintainability: Structure and reuse", 0.15, "Does design follow separation of concerns and sound naming?"],
70653
+ ["testability", "Testability: Strategy and coverage", 0.1, "Are unit/integration/regression test approaches considered?"],
70654
+ ["security", "Security: Validation and secret handling", 0.1, "Are input validation, authz, and secret management addressed?"],
70655
+ ["performance", "Performance: Efficiency and scalability", 0.1, "Are data volume, I/O, and bottlenecks considered?"],
70656
+ ["alignment", "Project Alignment: Conventions and structure", 0.15, "Does it follow folder structure, naming, and tooling?"],
70657
+ ["completeness", "Completeness: Edge cases and failures", 0.1, "Are inputs/outputs/errors/logging/edge cases covered?"]
70658
+ ];
70659
+ return items.map(([id, name2, weight, rubric]) => ({ id, name: name2, weight, rubric, description: name2 }));
70660
+ }
70661
+ };
70662
+ }
70663
+ });
70664
+
70665
+ // src/services/evaluation/ScoringEngine.ts
70666
+ var ScoringEngine;
70667
+ var init_ScoringEngine = __esm({
70668
+ "src/services/evaluation/ScoringEngine.ts"() {
70669
+ ScoringEngine = class {
70670
+ async evaluate(input3, criteria) {
70671
+ const textBundle = this.joinInput(input3);
70672
+ const details = [];
70673
+ for (const item of criteria.items) {
70674
+ const score = this.heuristicScore(textBundle, item.id);
70675
+ const reason = this.generateReason(textBundle, item.id);
70676
+ details.push({ id: item.id, name: item.name, weight: item.weight, score, reason });
70677
+ }
70678
+ const totalWeight = details.reduce((s2, d) => s2 + d.weight, 0) || 1;
70679
+ const totalScore = details.reduce((s2, d) => s2 + d.score * d.weight, 0) / totalWeight;
70680
+ return { totalScore, details };
70681
+ }
70682
+ joinInput(input3) {
70683
+ const parts = [];
70684
+ if (input3.idea) parts.push(`IDEA:
70685
+ ${input3.idea}`);
70686
+ if (input3.code) parts.push(`CODE:
70687
+ ${input3.code}`);
70688
+ if (input3.files && input3.files.length) {
70689
+ for (const f3 of input3.files) {
70690
+ parts.push(`FILE ${f3.path}:
70691
+ ${f3.content}`);
70692
+ }
70693
+ }
70694
+ return parts.join("\n\n");
70695
+ }
70696
+ heuristicScore(bundle, aspect) {
70697
+ const lower2 = bundle.toLowerCase();
70698
+ const checks = {
70699
+ clarity: ["objective", "\u76EE\u7684", "\u8981\u4EF6", "spec", "\u4ED5\u69D8"],
70700
+ feasibility: ["risk", "\u30EA\u30B9\u30AF", "plan", "\u8A08\u753B", "timeline"],
70701
+ maintainability: ["function", "class", "interface", "\u5206\u5272", "\u30E2\u30B8\u30E5\u30FC\u30EB"],
70702
+ testability: ["test", "spec", "vitest", "jest", "coverage"],
70703
+ security: ["secret", "env", "sanitize", "validation", "\u6A29\u9650"],
70704
+ performance: ["cache", "\u6027\u80FD", "optimiz", "stream", "memo"],
70705
+ alignment: ["src/", "pnpm", "eslint", "prettier", "convention"],
70706
+ completeness: ["edge case", "\u7570\u5E38\u7CFB", "\u30A8\u30E9\u30FC", "fallback", "retry"]
70707
+ };
70708
+ const words = checks[aspect] || [];
70709
+ const hits = words.reduce((c, w) => c + (lower2.includes(w) ? 1 : 0), 0);
70710
+ if (hits === 0) return 0.3;
70711
+ if (hits === 1) return 0.55;
70712
+ if (hits === 2) return 0.75;
70713
+ return 0.9;
70714
+ }
70715
+ generateReason(bundle, aspect) {
70716
+ switch (aspect) {
70717
+ case "clarity":
70718
+ return "\u8981\u6C42\u3084\u4ED5\u69D8\u306E\u660E\u793A\u5EA6\u304B\u3089\u6982\u7B97";
70719
+ case "feasibility":
70720
+ return "\u30EA\u30B9\u30AF\u30FB\u8A08\u753B\u306E\u8A18\u8F09\u6709\u7121\u304B\u3089\u6982\u7B97";
70721
+ case "maintainability":
70722
+ return "\u69CB\u9020\u5316\u30FB\u518D\u5229\u7528\u6027\u306E\u5146\u5019\u304B\u3089\u6982\u7B97";
70723
+ case "testability":
70724
+ return "\u30C6\u30B9\u30C8\u95A2\u9023\u306E\u8A00\u53CA\u304B\u3089\u6982\u7B97";
70725
+ case "security":
70726
+ return "\u79D8\u5BC6\u7BA1\u7406\u30FB\u5165\u529B\u691C\u8A3C\u306E\u8A00\u53CA\u304B\u3089\u6982\u7B97";
70727
+ case "performance":
70728
+ return "\u6027\u80FD\u6700\u9069\u5316\u306E\u793A\u5506\u304B\u3089\u6982\u7B97";
70729
+ case "alignment":
70730
+ return "\u30EA\u30DD\u30B8\u30C8\u30EA\u898F\u7D04\u3078\u306E\u8A00\u53CA\u304B\u3089\u6982\u7B97";
70731
+ case "completeness":
70732
+ return "\u7570\u5E38\u7CFB\u30FB\u30A8\u30C3\u30B8\u30B1\u30FC\u30B9\u306E\u7DB2\u7F85\u5EA6\u304B\u3089\u6982\u7B97";
70733
+ default:
70734
+ return "\u30D2\u30E5\u30FC\u30EA\u30B9\u30C6\u30A3\u30C3\u30AF\u8A55\u4FA1";
70735
+ }
70736
+ }
70737
+ };
70738
+ }
70739
+ });
70740
+ var EvaluationOrchestrator;
70741
+ var init_EvaluationOrchestrator = __esm({
70742
+ "src/services/evaluation/EvaluationOrchestrator.ts"() {
70743
+ init_CriteriaManager();
70744
+ init_ScoringEngine();
70745
+ init_api_caller();
70746
+ EvaluationOrchestrator = class {
70747
+ constructor(projectRoot) {
70748
+ this.projectRoot = projectRoot;
70749
+ this.criteriaManager = new CriteriaManager(projectRoot);
70750
+ this.engine = new ScoringEngine();
70751
+ }
70752
+ criteriaManager;
70753
+ engine;
70754
+ async assess(options) {
70755
+ const criteriaPath = options.criteria ? path11__namespace.default.isAbsolute(options.criteria) ? options.criteria : path11__namespace.default.join(this.projectRoot, options.criteria) : this.criteriaManager.getDefaultPath();
70756
+ const needGenerate = !!options.regenerateCriteria || !await this.exists(criteriaPath);
70757
+ if (needGenerate) {
70758
+ try {
70759
+ await this.generateCriteriaWithLLM(criteriaPath, {
70760
+ idea: options.idea,
70761
+ code: options.code,
70762
+ files: options.files || []
70763
+ });
70764
+ } catch {
70765
+ await this.criteriaManager.ensureCriteriaFile(criteriaPath);
70766
+ }
70767
+ } else {
70768
+ await this.criteriaManager.ensureCriteriaFile(criteriaPath);
70769
+ }
70770
+ const criteria = await this.criteriaManager.loadCriteria(criteriaPath);
70771
+ if (options.criteriaOnly) {
70772
+ return { criteriaPath, result: null };
70773
+ }
70774
+ const files = await this.readFiles(options.files || []);
70775
+ const input3 = {
70776
+ idea: options.idea,
70777
+ code: options.code,
70778
+ files
70779
+ };
70780
+ let result;
70781
+ if (options.llmScoring !== false) {
70782
+ try {
70783
+ result = await this.scoreWithLLM(input3, criteria);
70784
+ } catch {
70785
+ result = await this.engine.evaluate(input3, criteria);
70786
+ }
70787
+ } else {
70788
+ result = await this.engine.evaluate(input3, criteria);
70789
+ }
70790
+ result.files = input3.files || [];
70791
+ return { criteriaPath, result };
70792
+ }
70793
+ async exists(p) {
70794
+ try {
70795
+ await fs21.promises.stat(p);
70796
+ return true;
70797
+ } catch {
70798
+ return false;
70799
+ }
70800
+ }
70801
+ async generateCriteriaWithLLM(criteriaPath, context2) {
70802
+ const relPath = path11__namespace.default.relative(this.projectRoot, criteriaPath).replace(/\\/g, "/");
70803
+ const targetPath = relPath.startsWith(".") ? relPath : relPath;
70804
+ const dir = path11__namespace.default.dirname(criteriaPath);
70805
+ await fs21.promises.mkdir(dir, { recursive: true });
70806
+ const system = [
70807
+ "You are an expert evaluation designer.",
70808
+ "Create a JSON criteria file for evaluating the given idea/code/files.",
70809
+ "Respond ONLY with a single multi-file section in this exact format:",
70810
+ `[BEGIN file: ${targetPath}]`,
70811
+ "{JSON}",
70812
+ "[END]",
70813
+ "Do not include any other text or markdown.",
70814
+ "JSON schema:",
70815
+ '{ "version": "1.0.0", "project": string, "createdAt": ISO string, "updatedAt": ISO string, "items": [{ "id": string, "name": string, "description": string, "weight": number (0..1), "rubric": string }] }',
70816
+ "Total weight across items should be ~1. Use concise English labels and rubrics tailored to the input."
70817
+ ].join("\n");
70818
+ const user = [
70819
+ `Project: ${path11__namespace.default.basename(this.projectRoot)}`,
70820
+ context2.idea ? `Idea:
70821
+ ${context2.idea}` : void 0,
70822
+ context2.code ? `Code snippet:
70823
+ ${context2.code}` : void 0,
70824
+ context2.files.length ? `Files:
70825
+ ${context2.files.map((f3) => `- ${f3}`).join("\n")}` : void 0
70826
+ ].filter(Boolean).join("\n\n");
70827
+ const response = await callAPI("/v1/ai-proxy", {
70828
+ method: "POST",
70829
+ body: {
70830
+ prompt: `${system}
70831
+
70832
+ ---
70833
+
70834
+ ${user}`,
70835
+ taskType: "evaluation"
70836
+ }
70837
+ });
70838
+ const content = (response?.data?.content || response?.output || "").trim();
70839
+ if (!content) throw new Error("Empty LLM response");
70840
+ const fileMap = this.parseFileSections(content);
70841
+ let payload;
70842
+ if (fileMap.size > 0) {
70843
+ payload = fileMap.get(targetPath) || Array.from(fileMap.values())[0];
70844
+ } else {
70845
+ payload = this.extractFirstJsonObject(content) || content;
70846
+ }
70847
+ try {
70848
+ JSON.parse(payload);
70849
+ } catch {
70850
+ throw new Error("Invalid JSON in generated criteria");
70851
+ }
70852
+ await fs21.promises.writeFile(criteriaPath, payload, "utf8");
70853
+ }
70854
+ parseFileSections(text) {
70855
+ const map = /* @__PURE__ */ new Map();
70856
+ const regex2 = /\[BEGIN\s+file:\s*([^\]]+)\]\r?\n([\s\S]*?)\[END\]/gi;
70857
+ let m2;
70858
+ while ((m2 = regex2.exec(text)) !== null) {
70859
+ const file = m2[1].trim();
70860
+ const body = m2[2];
70861
+ map.set(file, body);
70862
+ }
70863
+ return map;
70864
+ }
70865
+ extractFirstJsonObject(text) {
70866
+ const fence = /```json\r?\n([\s\S]*?)```/i.exec(text);
70867
+ if (fence) return fence[1];
70868
+ const start = text.indexOf("{");
70869
+ const end = text.lastIndexOf("}");
70870
+ if (start >= 0 && end > start) {
70871
+ const cand = text.slice(start, end + 1);
70872
+ try {
70873
+ JSON.parse(cand);
70874
+ return cand;
70875
+ } catch {
70876
+ }
70877
+ }
70878
+ return null;
70879
+ }
70880
+ async scoreWithLLM(input3, criteria) {
70881
+ const criteriaPreview = criteria.items.map((it) => ({ id: it.id, name: it.name, weight: it.weight, rubric: it.rubric })).slice(0, 20);
70882
+ const bundleParts = [];
70883
+ if (input3.idea) bundleParts.push(`Idea:
70884
+ ${input3.idea}`);
70885
+ if (input3.code) bundleParts.push(`Code:
70886
+ ${input3.code}`);
70887
+ if (input3.files && input3.files.length) {
70888
+ bundleParts.push(`Files:
70889
+ ${input3.files.slice(0, 5).map((f3) => `- ${f3.path}`).join("\n")}`);
70890
+ }
70891
+ const bundle = bundleParts.join("\n\n");
70892
+ const system = [
70893
+ "You are an impartial evaluator. Score each criterion between 0 and 1.",
70894
+ "Return JSON only in the following schema:",
70895
+ '{ "totalScore": number (0..1), "details": [{ "id": string, "score": number (0..1), "reason": string }] }',
70896
+ "Keep reasons short (<= 120 chars)."
70897
+ ].join("\n");
70898
+ const user = [
70899
+ `Criteria: ${JSON.stringify(criteriaPreview)}`,
70900
+ "Input to evaluate:",
70901
+ bundle
70902
+ ].join("\n\n");
70903
+ const response = await callAPI("/v1/ai-proxy", {
70904
+ method: "POST",
70905
+ body: {
70906
+ prompt: `${system}
70907
+
70908
+ ---
70909
+
70910
+ ${user}`,
70911
+ taskType: "evaluation"
70912
+ }
70913
+ });
70914
+ const raw = (response?.data?.content || response?.output || "").trim();
70915
+ if (!raw) throw new Error("Empty LLM scoring response");
70916
+ let jsonText = this.extractFirstJsonObject(raw) || raw;
70917
+ const sections = this.parseFileSections(raw);
70918
+ if (sections.size > 0) {
70919
+ jsonText = Array.from(sections.values())[0];
70920
+ }
70921
+ const parsed = JSON.parse(jsonText);
70922
+ const details = criteria.items.map((it) => {
70923
+ const found = parsed.details.find((d) => d.id === it.id);
70924
+ const score = Math.max(0, Math.min(1, found?.score ?? 0));
70925
+ return { id: it.id, name: it.name, weight: it.weight, score, reason: found?.reason || "" };
70926
+ });
70927
+ const totalWeight = details.reduce((s2, d) => s2 + d.weight, 0) || 1;
70928
+ const weighted = details.reduce((s2, d) => s2 + d.score * d.weight, 0) / totalWeight;
70929
+ const totalScore = Number.isFinite(parsed.totalScore) ? Math.max(0, Math.min(1, parsed.totalScore)) : weighted;
70930
+ return { totalScore, details };
70931
+ }
70932
+ async readFiles(pathsInput) {
70933
+ const out = [];
70934
+ for (const p of pathsInput) {
70935
+ const abs = path11__namespace.default.isAbsolute(p) ? p : path11__namespace.default.join(this.projectRoot, p);
70936
+ try {
70937
+ const stat13 = await fs21.promises.stat(abs);
70938
+ if (stat13.isDirectory()) {
70939
+ continue;
70940
+ }
70941
+ const content = await fs21.promises.readFile(abs, "utf8");
70942
+ out.push({ path: abs, content });
70943
+ } catch {
70944
+ }
70945
+ }
70946
+ return out;
70947
+ }
70948
+ };
70949
+ }
70950
+ });
70951
+ function extractFirstJson(text) {
70952
+ const fence = /```json\r?\n([\s\S]*?)```/i.exec(text);
70953
+ if (fence) return fence[1];
70954
+ const start = text.indexOf("{");
70955
+ const end = text.lastIndexOf("}");
70956
+ if (start >= 0 && end > start) {
70957
+ const cand = text.slice(start, end + 1);
70958
+ try {
70959
+ JSON.parse(cand);
70960
+ return cand;
70961
+ } catch {
70962
+ }
70963
+ }
70964
+ return null;
70965
+ }
70966
+ function sanitizePath(candidate, cwd2) {
70967
+ const normalized = path11__namespace.default.normalize(candidate);
70968
+ const absolute = path11__namespace.default.isAbsolute(normalized) ? normalized : path11__namespace.default.join(cwd2, normalized);
70969
+ const resolved = path11__namespace.default.resolve(absolute);
70970
+ const root = path11__namespace.default.resolve(cwd2);
70971
+ if (!resolved.startsWith(root)) return void 0;
70972
+ return resolved;
70973
+ }
70974
+ async function inferAssessParams(rawText, cwd2) {
70975
+ const system = [
70976
+ "You extract structured options for an evaluation command.",
70977
+ 'Return JSON only with keys: { "criteriaPath"?: string, "regenerate"?: boolean, "criteriaOnly"?: boolean, "files"?: string[], "idea"?: string, "code"?: string }.',
70978
+ 'Prefer concise relative paths for criteria (e.g., "AGI-hackathon-ideathon/evaluation.criteria.json").',
70979
+ "If the text asks to create/save criteria/rubric (without asking for evaluation), set criteriaOnly=true.",
70980
+ "If the text mentions saving criteria to a folder, set criteriaPath accordingly and regenerate=true.",
70981
+ "If it references files or folders, include them in files[] (relative to cwd).",
70982
+ "If idea content is present, place in idea; do not paraphrase."
70983
+ ].join("\n");
70984
+ const user = rawText;
70985
+ const response = await callAPI("/v1/ai-proxy", {
70986
+ method: "POST",
70987
+ body: {
70988
+ prompt: `${system}
70989
+
70990
+ ---
70991
+
70992
+ ${user}`,
70993
+ taskType: "evaluation"
70994
+ }
70995
+ });
70996
+ const raw = (response?.data?.content || response?.output || "").trim();
70997
+ const jsonText = extractFirstJson(raw) || raw;
70998
+ let parsed = {};
70999
+ try {
71000
+ parsed = JSON.parse(jsonText);
71001
+ } catch {
71002
+ return {};
71003
+ }
71004
+ const out = {};
71005
+ if (typeof parsed.idea === "string" && parsed.idea.trim()) out.idea = parsed.idea.trim();
71006
+ if (typeof parsed.code === "string" && parsed.code.trim()) out.code = parsed.code.trim();
71007
+ if (typeof parsed.regenerate === "boolean") out.regenerate = parsed.regenerate;
71008
+ if (typeof parsed.criteriaOnly === "boolean") out.criteriaOnly = parsed.criteriaOnly;
71009
+ if (typeof parsed.criteriaPath === "string" && parsed.criteriaPath.trim()) {
71010
+ const safe = sanitizePath(parsed.criteriaPath.trim(), cwd2);
71011
+ if (safe) out.criteriaPath = safe;
71012
+ }
71013
+ if (Array.isArray(parsed.files)) {
71014
+ out.files = parsed.files.filter((f3) => typeof f3 === "string" && f3.trim()).map((f3) => sanitizePath(f3.trim(), cwd2)).filter((x2) => Boolean(x2));
71015
+ }
71016
+ return out;
71017
+ }
71018
+ var init_ArgumentInference = __esm({
71019
+ "src/services/evaluation/ArgumentInference.ts"() {
71020
+ init_api_caller();
71021
+ }
71022
+ });
71023
+
71024
+ // src/slash-commands/categories/evaluation/evaluate.command.ts
71025
+ var evaluate_command_exports = {};
71026
+ __export(evaluate_command_exports, {
71027
+ EvaluateCommand: () => EvaluateCommand,
71028
+ default: () => evaluate_command_default,
71029
+ meta: () => meta26
71030
+ });
71031
+ var EvaluateCommand, meta26, evaluate_command_default;
71032
+ var init_evaluate_command = __esm({
71033
+ "src/slash-commands/categories/evaluation/evaluate.command.ts"() {
71034
+ init_base_command();
71035
+ init_logger();
71036
+ init_EvaluationOrchestrator();
71037
+ init_api_caller();
71038
+ init_animations();
71039
+ init_ArgumentInference();
71040
+ EvaluateCommand = class extends BaseCommand {
71041
+ name = "evaluate";
71042
+ category = "evaluation";
71043
+ description = "\u{1F9EA} Run A/B tests and quality evaluations using the Phase 4 framework";
71044
+ aliases = ["eval", "test", "ab"];
71045
+ usage = "[run|status|results|stop|assess] [--config <path>] [--dataset <path>] [--format <format>] [--compare-baseline] [--idea <text>] [--code <text>] [--file <path> ...] [--criteria <path>]";
71046
+ examples = [
71047
+ {
71048
+ input: "/evaluate run --config tests/golden/config.json",
71049
+ description: "Run A/B evaluation with specified configuration",
71050
+ output: "Started evaluation test with nDCG and MRR metrics"
71051
+ },
71052
+ {
71053
+ input: "/evaluate status",
71054
+ description: "Show current evaluation status and active tests",
71055
+ output: "Evaluation system status with running/completed tests"
71056
+ },
71057
+ {
71058
+ input: "/evaluate results --format table",
71059
+ description: "Display latest evaluation results in table format",
71060
+ output: "Formatted table with quality metrics and improvements"
71061
+ },
71062
+ {
71063
+ input: "/evaluate run --dataset golden/sharepoint.json --compare-baseline",
71064
+ description: "Run evaluation against custom dataset with baseline comparison",
71065
+ output: "A/B test results with statistical significance analysis"
71066
+ },
71067
+ {
71068
+ input: "/evaluate assess --idea 'CLI\u306E\u8A2D\u8A08\u65B9\u91DD' --file src/cli.ts",
71069
+ description: "Generate criteria if missing and assess idea/files",
71070
+ output: "Weighted score and per-criterion breakdown"
71071
+ }
71072
+ ];
71073
+ permissions = {
71074
+ requiresAuth: false,
71075
+ role: void 0
71076
+ };
71077
+ rateLimit = {
71078
+ requests: 10,
71079
+ window: "5m"
71080
+ };
71081
+ async execute(args2, context2) {
71082
+ try {
71083
+ const { options, parsed } = args2;
71084
+ const positional = parsed["positional"] || [];
71085
+ const candidate = positional[0];
71086
+ const hasFreeText = Array.isArray(args2.raw) && args2.raw.length > 0;
71087
+ const subcommand = candidate ? candidate : hasFreeText ? "assess" : "status";
71088
+ const normalized = subcommand.toLowerCase();
71089
+ const allowed = /* @__PURE__ */ new Set(["run", "status", "results", "stop", "assess"]);
71090
+ if (!allowed.has(normalized)) {
71091
+ const idea = (args2.raw || []).join(" ").trim();
71092
+ return await this.assessInput({ ...options, idea }, context2, args2);
71093
+ }
71094
+ switch (normalized) {
71095
+ case "run":
71096
+ return await this.runEvaluation(options, context2);
71097
+ case "status":
71098
+ return await this.getEvaluationStatus(options);
71099
+ case "results":
71100
+ return await this.getEvaluationResults(options);
71101
+ case "stop":
71102
+ return await this.stopEvaluation(options);
71103
+ case "assess":
71104
+ return await this.assessInput(options, context2, args2);
71105
+ default:
71106
+ return await this.assessInput(options, context2, args2);
71107
+ }
71108
+ } catch (error2) {
71109
+ logger.error("Evaluation command failed:", error2);
71110
+ return this.error(
71111
+ "Evaluation execution failed",
71112
+ "EVALUATION_ERROR",
71113
+ error2 instanceof Error ? error2.message : "Unknown error occurred"
71114
+ );
71115
+ }
71116
+ }
71117
+ /**
71118
+ * Assess idea/code/files using criteria (creates default criteria if missing)
71119
+ */
71120
+ async assessInput(options, context2, commandArgs) {
71121
+ const root = context2.environment?.cwd || process.cwd();
71122
+ const rawText = (commandArgs?.raw || []).join(" ");
71123
+ const cwd2 = root;
71124
+ let inferred = {};
71125
+ try {
71126
+ const inferSpin = new ProcessAnimation();
71127
+ inferSpin.start();
71128
+ try {
71129
+ inferred = await inferAssessParams(rawText, cwd2);
71130
+ } finally {
71131
+ try {
71132
+ inferSpin.stop();
71133
+ } catch {
71134
+ }
71135
+ }
71136
+ } catch {
71137
+ }
71138
+ const filesOption = options["file"];
71139
+ const filesFromFlags = Array.isArray(filesOption) ? filesOption : filesOption ? [filesOption] : [];
71140
+ const files = Array.from(/* @__PURE__ */ new Set([...inferred.files || [], ...filesFromFlags]));
71141
+ const orchestrator = new EvaluationOrchestrator(root);
71142
+ const spinner = new ProcessAnimation();
71143
+ spinner.start();
71144
+ let criteriaPath;
71145
+ let result;
71146
+ try {
71147
+ const assessed = await orchestrator.assess({
71148
+ root,
71149
+ criteria: options["criteria"] || inferred.criteriaPath || void 0,
71150
+ files,
71151
+ idea: options["idea"] || inferred.idea || void 0,
71152
+ code: options["code"] || inferred.code || void 0,
71153
+ regenerateCriteria: !!options["regenerate"] || !!options["regen"] || !options["criteria"] || !!inferred.regenerate,
71154
+ llmScoring: options["no-llm-scoring"] ? false : true,
71155
+ criteriaOnly: !!options["criteria-only"] || !!inferred.criteriaOnly
71156
+ });
71157
+ criteriaPath = assessed.criteriaPath;
71158
+ result = assessed.result;
71159
+ } finally {
71160
+ try {
71161
+ spinner.stop();
71162
+ } catch {
71163
+ }
71164
+ }
71165
+ const system = [
71166
+ "You are an expert evaluator.",
71167
+ "Return a concise English assessment with:",
71168
+ "- A one-line overall verdict",
71169
+ "- A weighted score (0-100)",
71170
+ "- A short bullet breakdown per criterion (name: score/100 - brief reason)",
71171
+ "Be direct and professional."
71172
+ ].join("\n");
71173
+ if (result === null) {
71174
+ const rel = path11__namespace.default.relative(root, criteriaPath);
71175
+ return this.success(`Criteria file created: ${rel}`);
71176
+ }
71177
+ const breakdown = result.details.map((d) => `- ${d.name} (${Math.round(d.weight * 100)}%): ${Math.round(d.score * 100)}/100 - ${d.reason}`).join("\n");
71178
+ const user = [
71179
+ `Project root: ${path11__namespace.default.basename(root)}`,
71180
+ `Criteria file: ${path11__namespace.default.relative(root, criteriaPath)}`,
71181
+ `Heuristic total: ${Math.round(result.totalScore * 100)}/100`,
71182
+ `Breakdown:
71183
+ ${breakdown}`,
71184
+ options["idea"] || inferred.idea ? `Idea:
71185
+ ${options["idea"] || inferred.idea}` : void 0,
71186
+ options["code"] || inferred.code ? `Code snippet:
71187
+ ${options["code"] || inferred.code}` : void 0,
71188
+ files.length ? `File contents:
71189
+ ${files.map((f3) => {
71190
+ const fObj = result?.files?.find?.((x2) => x2.path === f3);
71191
+ return fObj ? `### ${fObj.path}
71192
+ ${fObj.content}` : `### ${f3}`;
71193
+ }).join("\n\n")}` : void 0
71194
+ ].filter(Boolean).join("\n\n");
71195
+ const llmSpinner = new ProcessAnimation();
71196
+ llmSpinner.start();
71197
+ try {
71198
+ const enriched = [
71199
+ system,
71200
+ "\n---\n",
71201
+ user
71202
+ ].join("\n");
71203
+ const response = await callAPI("/v1/ai-proxy", {
71204
+ method: "POST",
71205
+ body: {
71206
+ prompt: enriched,
71207
+ taskType: "evaluation"
71208
+ }
71209
+ });
71210
+ const routedModel = response?.data?.routedModel;
71211
+ const content = (response?.data?.content || response?.output || "").trim();
71212
+ if (content) {
71213
+ return this.success(content, {
71214
+ type: "evaluation-assess",
71215
+ total: result.totalScore,
71216
+ details: result.details,
71217
+ routedModel
71218
+ });
71219
+ }
71220
+ } catch (e2) {
71221
+ } finally {
71222
+ try {
71223
+ llmSpinner.stop();
71224
+ } catch {
71225
+ }
71226
+ }
71227
+ const lines = [];
71228
+ lines.push("Evaluation Summary (local fallback)");
71229
+ lines.push(`Weighted Score: ${Math.round(result.totalScore * 100)}/100`);
71230
+ lines.push("\nBreakdown:");
71231
+ for (const d of result.details) {
71232
+ lines.push(`- ${d.name} (${Math.round(d.weight * 100)}%): ${Math.round(d.score * 100)}/100 - ${d.reason}`);
71233
+ }
71234
+ return this.success(lines.join("\n"), {
71235
+ type: "evaluation-assess",
71236
+ total: result.totalScore,
71237
+ details: result.details
71238
+ });
71239
+ }
71240
+ /**
71241
+ * Run A/B evaluation test
71242
+ */
71243
+ async runEvaluation(options, context2) {
71244
+ const config2 = this.parseEvaluationConfig(options);
71245
+ const validation = await this.validateConfig(config2);
71246
+ if (!validation.success) {
71247
+ return this.error(
71248
+ validation.error || "Invalid configuration",
71249
+ "CONFIG_ERROR"
71250
+ );
71251
+ }
71252
+ logger.info("Starting A/B evaluation test", {
71253
+ config: config2,
71254
+ user: context2.user?.id
71255
+ });
71256
+ const testResult = await this.executeEvaluation(config2);
71257
+ const formattedOutput = this.formatEvaluationStart(testResult);
71258
+ return this.success(formattedOutput, {
71259
+ testId: testResult.testId,
71260
+ status: testResult.status,
71261
+ type: "evaluation-started"
71262
+ });
71263
+ }
71264
+ /**
71265
+ * Get evaluation system status
71266
+ */
71267
+ async getEvaluationStatus(_options) {
71268
+ const status = await this.fetchEvaluationStatus();
71269
+ const formattedOutput = this.formatEvaluationStatus(status);
71270
+ return this.success(formattedOutput, {
71271
+ activeTests: status.activeTests.length,
71272
+ completedTests: status.completedTests.length,
71273
+ systemHealth: status.systemHealth,
71274
+ type: "evaluation-status"
71275
+ });
71276
+ }
71277
+ /**
71278
+ * Get evaluation results
71279
+ */
71280
+ async getEvaluationResults(options) {
71281
+ const format = options["format"] || "table";
71282
+ const results = await this.fetchLatestResults();
71283
+ const formattedOutput = this.formatEvaluationResults(results, format);
71284
+ return this.success(formattedOutput, {
71285
+ resultCount: results.length,
71286
+ format,
71287
+ type: "evaluation-results"
71288
+ });
71289
+ }
71290
+ /**
71291
+ * Stop running evaluation
71292
+ */
71293
+ async stopEvaluation(options) {
71294
+ const testId = options["test-id"];
71295
+ if (!testId) {
71296
+ return this.error(
71297
+ "Test ID is required to stop evaluation",
71298
+ "MISSING_TEST_ID",
71299
+ "Use --test-id <id> to specify which test to stop"
71300
+ );
71301
+ }
71302
+ await this.terminateEvaluation(testId);
71303
+ return this.success(`Evaluation test ${testId} stopped successfully`, {
71304
+ testId,
71305
+ type: "evaluation-stopped"
71306
+ });
71307
+ }
71308
+ /**
71309
+ * Parse evaluation configuration
71310
+ */
71311
+ parseEvaluationConfig(options) {
71312
+ return {
71313
+ datasetPath: options["dataset"] || options["config"],
71314
+ testName: options["name"] || `eval_${Date.now()}`,
71315
+ maxQueries: parseInt(options["max-queries"] || "100", 10),
71316
+ metrics: (options["metrics"] || "nDCG,MRR,precision").split(","),
71317
+ outputFormat: options["format"] || "table",
71318
+ compareBaseline: options["compare-baseline"] || false
71319
+ };
71320
+ }
71321
+ /**
71322
+ * Validate evaluation configuration
71323
+ */
71324
+ async validateConfig(config2) {
71325
+ if (config2.datasetPath && !config2.datasetPath.endsWith(".json")) {
71326
+ return { success: false, error: "Dataset must be a JSON file" };
71327
+ }
71328
+ if (config2.maxQueries && (config2.maxQueries < 1 || config2.maxQueries > 1e4)) {
71329
+ return {
71330
+ success: false,
71331
+ error: "Max queries must be between 1 and 10000"
71332
+ };
71333
+ }
71334
+ const validMetrics = ["nDCG", "MRR", "precision", "recall", "latency"];
71335
+ if (config2.metrics && !config2.metrics.every((m2) => validMetrics.includes(m2))) {
71336
+ return {
71337
+ success: false,
71338
+ error: `Invalid metrics. Valid options: ${validMetrics.join(", ")}`
71339
+ };
71340
+ }
71341
+ const validFormats = ["table", "json", "csv"];
71342
+ if (config2.outputFormat && !validFormats.includes(config2.outputFormat)) {
71343
+ return {
71344
+ success: false,
71345
+ error: `Invalid format. Valid options: ${validFormats.join(", ")}`
71346
+ };
71347
+ }
71348
+ return { success: true };
71349
+ }
71350
+ /**
71351
+ * Execute evaluation (mock implementation)
71352
+ */
71353
+ async executeEvaluation(config2) {
71354
+ await new Promise((resolve19) => setTimeout(resolve19, 500));
71355
+ return {
71356
+ testId: `eval_${Math.random().toString(36).substr(2, 9)}`,
71357
+ testName: config2.testName || "Unnamed Test",
71358
+ timestamp: Date.now(),
71359
+ status: "running",
71360
+ metrics: {
71361
+ nDCG_at_1: 0,
71362
+ nDCG_at_5: 0,
71363
+ nDCG_at_10: 0,
71364
+ MRR: 0,
71365
+ precision_at_1: 0,
71366
+ precision_at_5: 0,
71367
+ recall_at_10: 0,
71368
+ latency_p50: 0,
71369
+ latency_p95: 0
71370
+ },
71371
+ queryCount: 0,
71372
+ duration: 0
71373
+ };
71374
+ }
71375
+ /**
71376
+ * Fetch evaluation system status
71377
+ */
71378
+ async fetchEvaluationStatus() {
71379
+ return {
71380
+ activeTests: [
71381
+ {
71382
+ testId: "eval_abc123",
71383
+ testName: "SharePoint RAG Evaluation",
71384
+ timestamp: Date.now() - 3e5,
71385
+ // 5 minutes ago
71386
+ status: "running",
71387
+ metrics: {
71388
+ nDCG_at_1: 0.75,
71389
+ nDCG_at_5: 0.68,
71390
+ nDCG_at_10: 0.64,
71391
+ MRR: 0.72,
71392
+ precision_at_1: 0.75,
71393
+ precision_at_5: 0.68,
71394
+ recall_at_10: 0.85,
71395
+ latency_p50: 245.5,
71396
+ latency_p95: 520.2
71397
+ },
71398
+ queryCount: 45,
71399
+ duration: 300
71400
+ }
71401
+ ],
71402
+ completedTests: [
71403
+ {
71404
+ testId: "eval_xyz789",
71405
+ testName: "Baseline Comparison Test",
71406
+ timestamp: Date.now() - 36e5,
71407
+ // 1 hour ago
71408
+ status: "completed",
71409
+ metrics: {
71410
+ nDCG_at_1: 0.82,
71411
+ nDCG_at_5: 0.74,
71412
+ nDCG_at_10: 0.69,
71413
+ MRR: 0.79,
71414
+ precision_at_1: 0.82,
71415
+ precision_at_5: 0.74,
71416
+ recall_at_10: 0.89,
71417
+ latency_p50: 189.3,
71418
+ latency_p95: 445.8
71419
+ },
71420
+ queryCount: 100,
71421
+ duration: 1247,
71422
+ baselineComparison: {
71423
+ improvement: {
71424
+ nDCG_at_1: 0.08,
71425
+ nDCG_at_5: 0.12,
71426
+ MRR: 0.15,
71427
+ latency_p50: -0.22
71428
+ },
71429
+ significant: {
71430
+ nDCG_at_1: true,
71431
+ nDCG_at_5: true,
71432
+ MRR: true,
71433
+ latency_p50: true
71434
+ }
71435
+ }
71436
+ }
71437
+ ],
71438
+ systemHealth: {
71439
+ evaluationService: "healthy",
71440
+ datasetAccess: "available",
71441
+ metricsCollection: "active"
71442
+ }
71443
+ };
71444
+ }
71445
+ /**
71446
+ * Fetch latest evaluation results
71447
+ */
71448
+ async fetchLatestResults() {
71449
+ const status = await this.fetchEvaluationStatus();
71450
+ return [...status.activeTests, ...status.completedTests].slice(0, 5);
71451
+ }
71452
+ /**
71453
+ * Terminate evaluation
71454
+ */
71455
+ async terminateEvaluation(_testId) {
71456
+ await new Promise((resolve19) => setTimeout(resolve19, 200));
71457
+ return true;
71458
+ }
71459
+ /**
71460
+ * Format evaluation start message
71461
+ */
71462
+ formatEvaluationStart(_result) {
71463
+ const lines = [];
71464
+ lines.push("");
71465
+ lines.push("\u{1F9EA} A/B EVALUATION STARTED");
71466
+ lines.push("\u2550".repeat(40));
71467
+ lines.push("");
71468
+ lines.push(`Test ID: ${_result.testId}`);
71469
+ lines.push(`Test Name: ${_result.testName}`);
71470
+ lines.push(`Status: ${_result.status.toUpperCase()}`);
71471
+ lines.push(`Started: ${new Date(_result.timestamp).toLocaleString()}`);
71472
+ lines.push("");
71473
+ lines.push("\u{1F4CA} **Metrics to Collect:**");
71474
+ lines.push(" \u2022 nDCG@1, nDCG@5, nDCG@10");
71475
+ lines.push(" \u2022 Mean Reciprocal Rank (MRR)");
71476
+ lines.push(" \u2022 Precision@1, Precision@5");
71477
+ lines.push(" \u2022 Recall@10");
71478
+ lines.push(" \u2022 Latency (p50, p95)");
71479
+ lines.push("");
71480
+ lines.push("\u{1F4A1} **Monitor Progress:**");
71481
+ lines.push(" Use `/evaluate status` to check progress");
71482
+ lines.push(" Use `/evaluate results` to see latest metrics");
71483
+ return lines.join("\n");
71484
+ }
71485
+ /**
71486
+ * Format evaluation status
71487
+ */
71488
+ formatEvaluationStatus(status) {
71489
+ const lines = [];
71490
+ lines.push("");
71491
+ lines.push("\u{1F4CA} EVALUATION SYSTEM STATUS");
71492
+ lines.push("\u2550".repeat(40));
71493
+ lines.push("");
71494
+ lines.push("\u{1F527} **System Health:**");
71495
+ lines.push(
71496
+ ` Evaluation Service: ${this.getHealthIcon(status.systemHealth.evaluationService)} ${status.systemHealth.evaluationService}`
71497
+ );
71498
+ lines.push(
71499
+ ` Dataset Access: ${this.getHealthIcon(status.systemHealth.datasetAccess)} ${status.systemHealth.datasetAccess}`
71500
+ );
71501
+ lines.push(
71502
+ ` Metrics Collection: ${this.getHealthIcon(status.systemHealth.metricsCollection)} ${status.systemHealth.metricsCollection}`
71503
+ );
71504
+ lines.push("");
71505
+ if (status.activeTests.length > 0) {
71506
+ lines.push(`\u26A1 **Active Tests (${status.activeTests.length}):**`);
71507
+ for (const test of status.activeTests) {
71508
+ lines.push(` \u2022 ${test.testName} (${test.testId})`);
71509
+ lines.push(
71510
+ ` Progress: ${test.queryCount} queries, ${Math.round(test.duration / 60)}m elapsed`
71511
+ );
71512
+ lines.push(` Current nDCG@5: ${test.metrics.nDCG_at_5.toFixed(3)}`);
71513
+ }
71514
+ lines.push("");
71515
+ }
71516
+ if (status.completedTests.length > 0) {
71517
+ lines.push(
71518
+ `\u2705 **Recent Completed Tests (${status.completedTests.length}):**`
71519
+ );
71520
+ for (const test of status.completedTests.slice(0, 3)) {
71521
+ const timeAgo = Math.round((Date.now() - test.timestamp) / 6e4);
71522
+ lines.push(` \u2022 ${test.testName} - ${timeAgo}m ago`);
71523
+ lines.push(
71524
+ ` nDCG@5: ${test.metrics.nDCG_at_5.toFixed(3)}, MRR: ${test.metrics.MRR.toFixed(3)}`
71525
+ );
71526
+ if (test.baselineComparison) {
71527
+ const improvement = (test.baselineComparison.improvement.nDCG_at_5 * 100).toFixed(1);
71528
+ lines.push(` Improvement: +${improvement}% vs baseline`);
71529
+ }
71530
+ }
71531
+ }
71532
+ return lines.join("\n");
71533
+ }
71534
+ /**
71535
+ * Format evaluation results
71536
+ */
71537
+ formatEvaluationResults(results, format) {
71538
+ if (format === "json") {
71539
+ return JSON.stringify(results, null, 2);
71540
+ }
71541
+ if (format === "csv") {
71542
+ const headers = [
71543
+ "Test ID",
71544
+ "Name",
71545
+ "Status",
71546
+ "nDCG@5",
71547
+ "MRR",
71548
+ "P@1",
71549
+ "Latency P50"
71550
+ ];
71551
+ const rows = results.map((r2) => [
71552
+ r2.testId,
71553
+ r2.testName,
71554
+ r2.status,
71555
+ r2.metrics.nDCG_at_5.toFixed(3),
71556
+ r2.metrics.MRR.toFixed(3),
71557
+ r2.metrics.precision_at_1.toFixed(3),
71558
+ r2.metrics.latency_p50.toFixed(1)
71559
+ ]);
71560
+ return [headers.join(","), ...rows.map((row) => row.join(","))].join(
71561
+ "\n"
71562
+ );
71563
+ }
71564
+ const lines = [];
71565
+ lines.push("");
71566
+ lines.push("\u{1F4C8} EVALUATION RESULTS");
71567
+ lines.push("\u2550".repeat(60));
71568
+ lines.push("");
71569
+ for (const _result of results) {
71570
+ lines.push(`**${_result.testName}** (${_result.testId})`);
71571
+ lines.push(
71572
+ `Status: ${_result.status.toUpperCase()} | Queries: ${_result.queryCount} | Duration: ${Math.round(_result.duration / 60)}m`
71573
+ );
71574
+ lines.push("");
71575
+ lines.push("\u{1F4CA} **Quality Metrics:**");
71576
+ lines.push(
71577
+ ` nDCG@1: ${_result.metrics.nDCG_at_1.toFixed(3)} nDCG@5: ${_result.metrics.nDCG_at_5.toFixed(3)} nDCG@10: ${_result.metrics.nDCG_at_10.toFixed(3)}`
71578
+ );
71579
+ lines.push(
71580
+ ` MRR: ${_result.metrics.MRR.toFixed(3)} P@1: ${_result.metrics.precision_at_1.toFixed(3)} P@5: ${_result.metrics.precision_at_5.toFixed(3)}`
71581
+ );
71582
+ lines.push(` Recall@10: ${_result.metrics.recall_at_10.toFixed(3)}`);
71583
+ lines.push("");
71584
+ lines.push("\u26A1 **Performance:**");
71585
+ lines.push(
71586
+ ` Latency P50: ${_result.metrics.latency_p50.toFixed(1)}ms P95: ${_result.metrics.latency_p95.toFixed(1)}ms`
71587
+ );
71588
+ if (_result.baselineComparison) {
71589
+ lines.push("");
71590
+ lines.push("\u{1F504} **vs Baseline:**");
71591
+ const improvement = _result.baselineComparison.improvement;
71592
+ const significant = _result.baselineComparison.significant;
71593
+ lines.push(
71594
+ ` nDCG@5: ${improvement.nDCG_at_5 >= 0 ? "+" : ""}${(improvement.nDCG_at_5 * 100).toFixed(1)}% ${significant.nDCG_at_5 ? "\u2713" : "\u2717"}`
71595
+ );
71596
+ lines.push(
71597
+ ` MRR: ${improvement.MRR >= 0 ? "+" : ""}${(improvement.MRR * 100).toFixed(1)}% ${significant.MRR ? "\u2713" : "\u2717"}`
71598
+ );
71599
+ lines.push(
71600
+ ` Latency: ${improvement.latency_p50 >= 0 ? "+" : ""}${(improvement.latency_p50 * 100).toFixed(1)}% ${significant.latency_p50 ? "\u2713" : "\u2717"}`
71601
+ );
71602
+ }
71603
+ lines.push("");
71604
+ lines.push("\u2500".repeat(40));
71605
+ lines.push("");
71606
+ }
71607
+ return lines.join("\n");
71608
+ }
71609
+ /**
71610
+ * Get health status icon
71611
+ */
71612
+ getHealthIcon(status) {
71613
+ switch (status) {
71614
+ case "healthy":
71615
+ case "available":
71616
+ case "active":
71617
+ return "\u{1F7E2}";
71618
+ case "degraded":
71619
+ case "limited":
71620
+ return "\u{1F7E1}";
71621
+ case "down":
71622
+ case "unavailable":
71623
+ case "inactive":
71624
+ return "\u{1F534}";
71625
+ default:
71626
+ return "\u26AA";
71627
+ }
71628
+ }
71629
+ /**
71630
+ * Command validation
71631
+ */
71632
+ async validate(args2) {
71633
+ const { parsed, options } = args2;
71634
+ const positional = parsed["positional"] || [];
71635
+ const subcommand = positional[0];
71636
+ if (subcommand === "run") {
71637
+ if (options["max-queries"] && isNaN(parseInt(options["max-queries"], 10))) {
71638
+ return {
71639
+ success: false,
71640
+ error: "max-queries must be a number"
71641
+ };
71642
+ }
71643
+ }
71644
+ if (subcommand === "stop" && !options["test-id"]) {
71645
+ return {
71646
+ success: false,
71647
+ error: "stop command requires --test-id parameter"
71648
+ };
71649
+ }
71650
+ return { success: true };
71651
+ }
71652
+ };
71653
+ meta26 = {
71654
+ name: "evaluate",
71655
+ category: "evaluation",
71656
+ description: "A/B testing and quality evaluation framework",
71657
+ aliases: ["eval", "test", "ab"],
71658
+ usage: "/evaluate [run|status|results|stop] [options]",
71659
+ examples: [
71660
+ "/evaluate run --dataset data.json",
71661
+ "/evaluate status",
71662
+ "/evaluate results --format table",
71663
+ "/evaluate stop --test-id eval_abc123"
71664
+ ],
71665
+ deps: []
71666
+ };
71667
+ evaluate_command_default = EvaluateCommand;
71668
+ }
71669
+ });
70604
71670
 
70605
71671
  // src/slash-commands/index.ts
70606
71672
  var slash_commands_exports = {};
@@ -71090,15 +72156,23 @@ async function registerBuiltInCommands() {
71090
72156
  initialize: async () => {
71091
72157
  }
71092
72158
  });
71093
- commandRegistry.register({
71094
- name: "evaluate",
71095
- category: "evaluation",
71096
- description: "Evaluation system",
71097
- aliases: [],
71098
- execute: async () => shield2({ message: "\u{1F512} Not available in this build" }),
71099
- initialize: async () => {
71100
- }
71101
- });
72159
+ try {
72160
+ const EvaluateModule = await Promise.resolve().then(() => (init_evaluate_command(), evaluate_command_exports));
72161
+ const EvaluateClass = EvaluateModule.EvaluateCommand || EvaluateModule.default;
72162
+ const evaluate = new EvaluateClass();
72163
+ if (evaluate.initialize) await evaluate.initialize();
72164
+ commandRegistry.register(evaluate);
72165
+ } catch {
72166
+ commandRegistry.register({
72167
+ name: "evaluate",
72168
+ category: "evaluation",
72169
+ description: "Evaluation system",
72170
+ aliases: [],
72171
+ execute: async () => shield2({ message: "\u{1F512} Not available in this build" }),
72172
+ initialize: async () => {
72173
+ }
72174
+ });
72175
+ }
71102
72176
  commandRegistry.register({
71103
72177
  name: "multimodal",
71104
72178
  category: "multimodal",