micro-models-agent 0.19.0 → 0.19.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/dist/main.js +179 -358
  2. package/package.json +1 -1
  3. package/dist/cli/commands.js +0 -237
  4. package/dist/cli/completer.js +0 -168
  5. package/dist/cli/index.js +0 -2
  6. package/dist/cli/main.js +0 -113
  7. package/dist/cli/repl.js +0 -1010
  8. package/dist/cli/security-commands.js +0 -166
  9. package/dist/cli/setup.js +0 -229
  10. package/dist/config/config.js +0 -186
  11. package/dist/config/defaults.js +0 -91
  12. package/dist/config/experts.js +0 -15
  13. package/dist/config/index.js +0 -3
  14. package/dist/config/security.js +0 -193
  15. package/dist/config/types.js +0 -1
  16. package/dist/core/agent-moe.js +0 -98
  17. package/dist/core/agent.js +0 -471
  18. package/dist/core/bootstrap.js +0 -314
  19. package/dist/core/index.js +0 -2
  20. package/dist/core/prompt-builder.js +0 -55
  21. package/dist/core/session-logger.js +0 -122
  22. package/dist/core/types.js +0 -1
  23. package/dist/i18n/en.json +0 -461
  24. package/dist/i18n/index.js +0 -43
  25. package/dist/i18n/ru.json +0 -461
  26. package/dist/index.js +0 -22
  27. package/dist/llm/image-utils.js +0 -144
  28. package/dist/llm/index.js +0 -4
  29. package/dist/llm/model-loader.js +0 -78
  30. package/dist/llm/openai-compat.js +0 -324
  31. package/dist/llm/orchestrator.js +0 -194
  32. package/dist/llm/provider.js +0 -10
  33. package/dist/llm/response.js +0 -39
  34. package/dist/llm/token-counter.js +0 -39
  35. package/dist/llm/types.js +0 -1
  36. package/dist/logger/app-logger.js +0 -76
  37. package/dist/logger/index.js +0 -1
  38. package/dist/migration/backup.js +0 -45
  39. package/dist/migration/detect.js +0 -50
  40. package/dist/migration/index.js +0 -2
  41. package/dist/modules/browser/actions.js +0 -46
  42. package/dist/modules/browser/cookie-store.js +0 -24
  43. package/dist/modules/browser/index.js +0 -5
  44. package/dist/modules/browser/module.js +0 -28
  45. package/dist/modules/browser/session.js +0 -287
  46. package/dist/modules/browser/snapshot.js +0 -114
  47. package/dist/modules/browser/types.js +0 -9
  48. package/dist/modules/context/index.js +0 -1
  49. package/dist/modules/context/manager.js +0 -240
  50. package/dist/modules/execution/auditor.js +0 -72
  51. package/dist/modules/execution/index.js +0 -6
  52. package/dist/modules/execution/module.js +0 -337
  53. package/dist/modules/execution/moe-executor.js +0 -209
  54. package/dist/modules/execution/plan-validator.js +0 -153
  55. package/dist/modules/execution/planner.js +0 -35
  56. package/dist/modules/execution/stuck-detector.js +0 -134
  57. package/dist/modules/execution/tracker.js +0 -53
  58. package/dist/modules/execution/types.js +0 -1
  59. package/dist/modules/execution/verifier.js +0 -149
  60. package/dist/modules/hallucination/confidence.js +0 -59
  61. package/dist/modules/hallucination/consistency.js +0 -66
  62. package/dist/modules/hallucination/detector.js +0 -33
  63. package/dist/modules/hallucination/factual.js +0 -561
  64. package/dist/modules/hallucination/index.js +0 -3
  65. package/dist/modules/index.js +0 -5
  66. package/dist/modules/indexer/cache.js +0 -38
  67. package/dist/modules/indexer/index.js +0 -3
  68. package/dist/modules/indexer/module.js +0 -192
  69. package/dist/modules/indexer/walker.js +0 -101
  70. package/dist/modules/mcp/client.js +0 -393
  71. package/dist/modules/mcp/index.js +0 -3
  72. package/dist/modules/mcp/module.js +0 -146
  73. package/dist/modules/mcp/registry.js +0 -15
  74. package/dist/modules/memory/index.js +0 -1
  75. package/dist/modules/memory/module.js +0 -48
  76. package/dist/modules/memory/search.js +0 -40
  77. package/dist/modules/memory/store.js +0 -65
  78. package/dist/modules/pipelines/engine.js +0 -60
  79. package/dist/modules/pipelines/index.js +0 -3
  80. package/dist/modules/pipelines/parser.js +0 -53
  81. package/dist/modules/pipelines/template.js +0 -14
  82. package/dist/modules/plugins/builtin/lint-on-write.js +0 -121
  83. package/dist/modules/plugins/builtin/notify.js +0 -8
  84. package/dist/modules/plugins/index.js +0 -1
  85. package/dist/modules/plugins/loader.js +0 -28
  86. package/dist/modules/plugins/manager.js +0 -161
  87. package/dist/modules/plugins/types.js +0 -1
  88. package/dist/modules/processes/detect.js +0 -34
  89. package/dist/modules/processes/index.js +0 -3
  90. package/dist/modules/processes/registry.js +0 -148
  91. package/dist/modules/processes/runner.js +0 -124
  92. package/dist/modules/registry.js +0 -45
  93. package/dist/modules/security/audit-log.js +0 -116
  94. package/dist/modules/security/audit-notifier.js +0 -292
  95. package/dist/modules/security/command-validator.js +0 -185
  96. package/dist/modules/security/content-scanner.js +0 -52
  97. package/dist/modules/security/data-sanitizer.js +0 -97
  98. package/dist/modules/security/encryption.js +0 -240
  99. package/dist/modules/security/index.js +0 -14
  100. package/dist/modules/security/network-validator.js +0 -79
  101. package/dist/modules/security/path-validator.js +0 -155
  102. package/dist/modules/security/rate-limiter.js +0 -119
  103. package/dist/modules/security/security-policies.js +0 -393
  104. package/dist/modules/security/session-encryption.js +0 -193
  105. package/dist/modules/security/session-isolation.js +0 -95
  106. package/dist/modules/session/index.js +0 -3
  107. package/dist/modules/session/manager.js +0 -167
  108. package/dist/modules/session/module.js +0 -24
  109. package/dist/modules/session/store.js +0 -174
  110. package/dist/modules/session/types.js +0 -1
  111. package/dist/modules/skills/index.js +0 -3
  112. package/dist/modules/skills/loader.js +0 -72
  113. package/dist/modules/skills/matcher.js +0 -27
  114. package/dist/modules/skills/module.js +0 -143
  115. package/dist/modules/types.js +0 -1
  116. package/dist/modules/updater/checker.js +0 -32
  117. package/dist/modules/updater/index.js +0 -1
  118. package/dist/modules/user-profile/compressor.js +0 -16
  119. package/dist/modules/user-profile/index.js +0 -1
  120. package/dist/modules/user-profile/profile.js +0 -68
  121. package/dist/skills/builtin/builtin/git.md +0 -36
  122. package/dist/skills/builtin/builtin/typescript.md +0 -35
  123. package/dist/tools/approve.js +0 -32
  124. package/dist/tools/attach-image.js +0 -89
  125. package/dist/tools/bash.js +0 -140
  126. package/dist/tools/browser.js +0 -97
  127. package/dist/tools/create-dir.js +0 -55
  128. package/dist/tools/delete-file.js +0 -62
  129. package/dist/tools/edit-file.js +0 -77
  130. package/dist/tools/executor.js +0 -95
  131. package/dist/tools/file-info.js +0 -45
  132. package/dist/tools/filter-tools.js +0 -10
  133. package/dist/tools/glob-tool.js +0 -26
  134. package/dist/tools/grep-tool.js +0 -64
  135. package/dist/tools/index.js +0 -52
  136. package/dist/tools/list-dir.js +0 -47
  137. package/dist/tools/load-skill.js +0 -48
  138. package/dist/tools/mcp-call.js +0 -68
  139. package/dist/tools/move-file.js +0 -84
  140. package/dist/tools/path-utils.js +0 -51
  141. package/dist/tools/pipeline-run.js +0 -144
  142. package/dist/tools/preview.js +0 -2
  143. package/dist/tools/process-kill.js +0 -29
  144. package/dist/tools/process-list.js +0 -38
  145. package/dist/tools/process-log.js +0 -41
  146. package/dist/tools/question.js +0 -142
  147. package/dist/tools/read-file.js +0 -70
  148. package/dist/tools/recall.js +0 -110
  149. package/dist/tools/registry.js +0 -36
  150. package/dist/tools/remember.js +0 -67
  151. package/dist/tools/scope-check.js +0 -30
  152. package/dist/tools/search-history.js +0 -64
  153. package/dist/tools/subagent.js +0 -142
  154. package/dist/tools/types.js +0 -1
  155. package/dist/tools/user-input.js +0 -123
  156. package/dist/tools/web-browse.js +0 -57
  157. package/dist/tools/web-fetch.js +0 -72
  158. package/dist/tools/web-search.js +0 -59
  159. package/dist/tools/write-file.js +0 -79
  160. package/dist/ui/box.js +0 -81
  161. package/dist/ui/colors.js +0 -4
  162. package/dist/ui/diff.js +0 -185
  163. package/dist/ui/index.js +0 -6
  164. package/dist/ui/md-formatter.js +0 -212
  165. package/dist/ui/output.js +0 -13
  166. package/dist/ui/renderer.js +0 -141
  167. package/dist/ui/spinner.js +0 -70
  168. package/dist/ui/table.js +0 -144
package/dist/main.js CHANGED
@@ -5446,9 +5446,7 @@ var init_read_file = __esm(() => {
5446
5446
  if (!existsSync9(resolved)) {
5447
5447
  return { success: false, output: t("file.notfound", { path }) };
5448
5448
  }
5449
- ctx.trackReadPath?.(path);
5450
5449
  const content = readFileSync5(resolved, "utf-8");
5451
- ctx.trackDocumentContent?.(content);
5452
5450
  const lines = content.split(`
5453
5451
  `);
5454
5452
  const total = lines.length;
@@ -5906,7 +5904,6 @@ var init_write_file = __esm(() => {
5906
5904
  const diff = fileExists ? generateDiff(oldContent, content) : generateNewFileDiff(content);
5907
5905
  ctx.fileOperationsCount = currentCount + 1;
5908
5906
  logFileWrite(ctx.sessionId, path, true, `File ${fileExists ? "updated" : "created"}`);
5909
- ctx.trackCreatedPath?.(path);
5910
5907
  return { success: true, output: t("file.written", { path }), diff };
5911
5908
  }
5912
5909
  };
@@ -6179,7 +6176,6 @@ var init_create_dir = __esm(() => {
6179
6176
  }
6180
6177
  ctx.fileOperationsCount = currentCount + 1;
6181
6178
  logFileWrite(ctx.sessionId, path, true, "Directory created");
6182
- ctx.trackCreatedPath?.(path);
6183
6179
  return { success: true, output: t("file.created", { path }) };
6184
6180
  }
6185
6181
  };
@@ -6240,7 +6236,6 @@ var init_delete_file = __esm(() => {
6240
6236
  const diff = generateDeleteDiff(content);
6241
6237
  ctx.fileOperationsCount = currentCount + 1;
6242
6238
  logFileDelete(ctx.sessionId, path, true);
6243
- ctx.trackDeletedPath?.(path);
6244
6239
  return { success: true, output: t("file.deleted", { path }), diff };
6245
6240
  }
6246
6241
  };
@@ -9030,7 +9025,9 @@ ${t("tool.truncated", { tokens: Math.ceil(removedChars / 2) })}`;
9030
9025
  consecutiveToolFailures = 0;
9031
9026
  }
9032
9027
  if (consecutiveToolFailures >= MAX_CONSECUTIVE_TOOL_FAILURES) {
9033
- const recoveryMsg = t("exec.consecutive_failures_recovery", { count: consecutiveToolFailures });
9028
+ const recoveryMsg = t("exec.consecutive_failures_recovery", {
9029
+ count: consecutiveToolFailures
9030
+ });
9034
9031
  logger.warn(`Consecutive tool failures: ${consecutiveToolFailures}`);
9035
9032
  const taskSnippet = input.length > 200 ? input.slice(0, 200) + "..." : input;
9036
9033
  const taskReminder = t("exec.task_reminder", { task: taskSnippet });
@@ -9045,6 +9042,16 @@ ${taskReminder}</system-summary>`
9045
9042
  content: `<system-summary>${summaries.join(`
9046
9043
  `)}</system-summary>`
9047
9044
  });
9045
+ const ctxTokens = contextManager.getEstimatedTokens();
9046
+ const ctxBudget = contextManager.getBudget();
9047
+ const ctxPct = Math.min(100, Math.round(ctxTokens / ctxBudget.history * 100));
9048
+ const barLen = 10;
9049
+ const filled = Math.round(ctxPct / 100 * barLen);
9050
+ const ctxBar = pc.green("█".repeat(filled)) + pc.dim("░".repeat(barLen - filled));
9051
+ const pctColor = ctxPct >= 75 ? pc.yellow : pc.dim;
9052
+ onMeta?.(`
9053
+ ${ctxBar} ${pctColor(`${ctxPct}%`)} ${pc.dim(`ctx: ${ctxTokens}/${ctxBudget.history}`)}
9054
+ `);
9048
9055
  continue;
9049
9056
  }
9050
9057
  const hallucinationResult = hallucinationDetector.validate(textContent);
@@ -9402,181 +9409,6 @@ class ContextManager {
9402
9409
  var COMPACTION_INTERVAL = 15, KEEP_LAST_N = 6;
9403
9410
  var init_manager = () => {};
9404
9411
 
9405
- // src/modules/hallucination/factual.ts
9406
- import { existsSync as existsSync18 } from "fs";
9407
- import { join as join8 } from "path";
9408
-
9409
- class FactualCheck {
9410
- knownPaths = new Set;
9411
- createdPaths = new Set;
9412
- readFiles = new Set;
9413
- baseDir = process.cwd();
9414
- setBaseDir(dir) {
9415
- this.baseDir = dir;
9416
- }
9417
- trackReadPath(path) {
9418
- this.knownPaths.add(path);
9419
- const base = path.split(/[/\\]/).pop();
9420
- if (base && base !== path)
9421
- this.knownPaths.add(base);
9422
- this.readFiles.add(base || path);
9423
- }
9424
- trackCreatedPath(path) {
9425
- this.knownPaths.add(path);
9426
- const base = path.split(/[/\\]/).pop();
9427
- if (base && base !== path)
9428
- this.knownPaths.add(base);
9429
- this.createdPaths.add(path);
9430
- }
9431
- trackDeletedPath(path) {
9432
- this.knownPaths.add(path);
9433
- const base = path.split(/[/\\]/).pop();
9434
- if (base && base !== path)
9435
- this.knownPaths.add(base);
9436
- this.createdPaths.delete(path);
9437
- }
9438
- trackDocumentContent(content) {
9439
- const pathPatterns = /(?:^|\s)([\w\-./]+\.\w{1,10})(?:\s|$|[,;)])/gm;
9440
- let match;
9441
- while ((match = pathPatterns.exec(content)) !== null) {
9442
- const file = match[1];
9443
- if (file.includes("/") || file.includes("\\")) {
9444
- this.knownPaths.add(file);
9445
- }
9446
- const base = file.split(/[/\\]/).pop();
9447
- if (base)
9448
- this.knownPaths.add(base);
9449
- }
9450
- }
9451
- pathExistsOnDisk(path) {
9452
- try {
9453
- if (path.startsWith("/") || path.startsWith("~") || /^[A-Za-z]:/.test(path)) {
9454
- return false;
9455
- }
9456
- return existsSync18(join8(this.baseDir, path));
9457
- } catch {
9458
- return false;
9459
- }
9460
- }
9461
- validate(response) {
9462
- const pathRegex = /[\w\-./]+\.\w+/g;
9463
- const mentionedPaths = response.match(pathRegex) || [];
9464
- const unknownPaths = mentionedPaths.filter((p) => {
9465
- if (this.knownPaths.has(p))
9466
- return false;
9467
- if (VERSION_PATTERN.test(p))
9468
- return false;
9469
- if (COMMON_WORDS.has(p))
9470
- return false;
9471
- if (p.startsWith("/") || p.startsWith("~") || /^[A-Za-z]:/.test(p))
9472
- return false;
9473
- if (this.pathExistsOnDisk(p))
9474
- return false;
9475
- const ext = p.split(".").pop()?.toLowerCase() || "";
9476
- if (!FILE_EXTENSIONS.has(ext))
9477
- return false;
9478
- const basename2 = p.split("/").pop()?.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
9479
- if (basename2) {
9480
- const urlPattern = new RegExp(`(https?|file)://[^\\s]*${basename2}`);
9481
- if (urlPattern.test(response))
9482
- return false;
9483
- }
9484
- return true;
9485
- });
9486
- if (unknownPaths.length > 0) {
9487
- const uniquePaths = [...new Set(unknownPaths)];
9488
- return {
9489
- status: "warn",
9490
- reason: t("hall.unknown_paths", {
9491
- paths: uniquePaths.slice(0, 3).join(", ")
9492
- })
9493
- };
9494
- }
9495
- return { status: "pass" };
9496
- }
9497
- }
9498
- var FILE_EXTENSIONS, VERSION_PATTERN, COMMON_WORDS;
9499
- var init_factual = __esm(() => {
9500
- init_i18n();
9501
- FILE_EXTENSIONS = new Set([
9502
- "ts",
9503
- "tsx",
9504
- "js",
9505
- "jsx",
9506
- "mjs",
9507
- "cjs",
9508
- "mts",
9509
- "cts",
9510
- "json",
9511
- "md",
9512
- "yaml",
9513
- "yml",
9514
- "py",
9515
- "rs",
9516
- "go",
9517
- "java",
9518
- "c",
9519
- "cpp",
9520
- "h",
9521
- "hpp",
9522
- "html",
9523
- "css",
9524
- "scss",
9525
- "less",
9526
- "vue",
9527
- "svelte",
9528
- "sh",
9529
- "bash",
9530
- "zsh",
9531
- "ps1",
9532
- "bat",
9533
- "cmd",
9534
- "txt",
9535
- "env",
9536
- "env.local",
9537
- "env.production",
9538
- "gitignore",
9539
- "dockerignore",
9540
- "dockerfile",
9541
- "makefile",
9542
- "cmake",
9543
- "toml",
9544
- "lock",
9545
- "config",
9546
- "log",
9547
- "xml",
9548
- "sql",
9549
- "graphql",
9550
- "proto",
9551
- "wasm"
9552
- ]);
9553
- VERSION_PATTERN = /^\d+(\.\d+)*$/;
9554
- COMMON_WORDS = new Set([
9555
- "node.js",
9556
- "Node.js",
9557
- "console.log",
9558
- "console.error",
9559
- "console.warn",
9560
- "console.info",
9561
- "Math.floor",
9562
- "Math.ceil",
9563
- "Math.round",
9564
- "Math.max",
9565
- "Math.min",
9566
- "JSON.parse",
9567
- "JSON.stringify",
9568
- "Object.keys",
9569
- "Object.values",
9570
- "Object.entries",
9571
- "Array.from",
9572
- "Array.isArray",
9573
- "Date.now",
9574
- "Date.parse",
9575
- "RegExp",
9576
- "Promise"
9577
- ]);
9578
- });
9579
-
9580
9412
  // src/modules/hallucination/consistency.ts
9581
9413
  class ConsistencyCheck {
9582
9414
  decisions = [];
@@ -9628,7 +9460,10 @@ class ConsistencyCheck {
9628
9460
  if (contradicts) {
9629
9461
  return {
9630
9462
  status: "warn",
9631
- reason: t("hall.contradiction", { decision: d.decision, location: d.location })
9463
+ reason: t("hall.contradiction", {
9464
+ decision: d.decision,
9465
+ location: d.location
9466
+ })
9632
9467
  };
9633
9468
  }
9634
9469
  }
@@ -9673,7 +9508,9 @@ class ConfidenceCheck {
9673
9508
  if (diversity < 0.25) {
9674
9509
  return {
9675
9510
  status: "warn",
9676
- reason: t("hall.repetitive", { pct: Math.round((1 - diversity) * 100) })
9511
+ reason: t("hall.repetitive", {
9512
+ pct: Math.round((1 - diversity) * 100)
9513
+ })
9677
9514
  };
9678
9515
  }
9679
9516
  }
@@ -9695,17 +9532,12 @@ var init_confidence = __esm(() => {
9695
9532
 
9696
9533
  // src/modules/hallucination/detector.ts
9697
9534
  class HallucinationDetector {
9698
- factual;
9699
9535
  consistency;
9700
9536
  confidence;
9701
9537
  constructor() {
9702
- this.factual = new FactualCheck;
9703
9538
  this.consistency = new ConsistencyCheck;
9704
9539
  this.confidence = new ConfidenceCheck;
9705
9540
  }
9706
- getFactualCheck() {
9707
- return this.factual;
9708
- }
9709
9541
  getConsistencyCheck() {
9710
9542
  return this.consistency;
9711
9543
  }
@@ -9717,11 +9549,8 @@ class HallucinationDetector {
9717
9549
  if (confidenceResult.status === "retry" || confidenceResult.status === "block") {
9718
9550
  return confidenceResult;
9719
9551
  }
9720
- const factualResult = this.factual.validate(response);
9721
9552
  const consistencyResult = this.consistency.validate(response);
9722
9553
  const warnings = [];
9723
- if (factualResult.status === "warn")
9724
- warnings.push(factualResult.reason || "");
9725
9554
  if (consistencyResult.status === "warn")
9726
9555
  warnings.push(consistencyResult.reason || "");
9727
9556
  if (confidenceResult.status === "warn")
@@ -9733,7 +9562,6 @@ class HallucinationDetector {
9733
9562
  }
9734
9563
  }
9735
9564
  var init_detector = __esm(() => {
9736
- init_factual();
9737
9565
  init_consistency();
9738
9566
  init_confidence();
9739
9567
  });
@@ -11370,7 +11198,7 @@ ${JSON.stringify(result, null, 2)}`
11370
11198
 
11371
11199
  // src/tools/search-history.ts
11372
11200
  import * as fs from "fs";
11373
- import { join as join9 } from "path";
11201
+ import { join as join8 } from "path";
11374
11202
  import { homedir as homedir5 } from "os";
11375
11203
  function searchFile(filePath, query, maxResults, results) {
11376
11204
  if (!fs.existsSync(filePath))
@@ -11408,7 +11236,7 @@ var init_search_history = __esm(() => {
11408
11236
  const query = String(args.query || "").toLowerCase();
11409
11237
  const maxResults = Number(args.maxResults) || 5;
11410
11238
  const sessionId = args.sessionId ? String(args.sessionId) : null;
11411
- const sessionDir = join9(homedir5(), ".mma", "sessions");
11239
+ const sessionDir = join8(homedir5(), ".mma", "sessions");
11412
11240
  const results = [];
11413
11241
  try {
11414
11242
  if (!fs.existsSync(sessionDir)) {
@@ -11420,7 +11248,7 @@ var init_search_history = __esm(() => {
11420
11248
  continue;
11421
11249
  if (sessionId && entry.name !== sessionId)
11422
11250
  continue;
11423
- const historyFile = join9(sessionDir, entry.name, "history.jsonl");
11251
+ const historyFile = join8(sessionDir, entry.name, "history.jsonl");
11424
11252
  searchFile(historyFile, query, maxResults, results);
11425
11253
  if (results.length >= maxResults)
11426
11254
  break;
@@ -11438,8 +11266,8 @@ var init_search_history = __esm(() => {
11438
11266
  });
11439
11267
 
11440
11268
  // src/modules/memory/search.ts
11441
- import { readFileSync as readFileSync10, existsSync as existsSync20 } from "fs";
11442
- import { join as join10 } from "path";
11269
+ import { readFileSync as readFileSync10, existsSync as existsSync19 } from "fs";
11270
+ import { join as join9 } from "path";
11443
11271
 
11444
11272
  class MemorySearch {
11445
11273
  memoryDir;
@@ -11450,8 +11278,8 @@ class MemorySearch {
11450
11278
  const results = [];
11451
11279
  const lowerQuery = query.toLowerCase();
11452
11280
  for (const name of MEMORY_FILES) {
11453
- const path = join10(this.memoryDir, `${name}.md`);
11454
- if (!existsSync20(path))
11281
+ const path = join9(this.memoryDir, `${name}.md`);
11282
+ if (!existsSync19(path))
11455
11283
  continue;
11456
11284
  const content = readFileSync10(path, "utf-8");
11457
11285
  const lines = content.split(`
@@ -11462,8 +11290,8 @@ class MemorySearch {
11462
11290
  }
11463
11291
  }
11464
11292
  }
11465
- const prefsPath = join10(this.memoryDir, "preferences.json");
11466
- if (existsSync20(prefsPath)) {
11293
+ const prefsPath = join9(this.memoryDir, "preferences.json");
11294
+ if (existsSync19(prefsPath)) {
11467
11295
  try {
11468
11296
  const prefs = JSON.parse(readFileSync10(prefsPath, "utf-8"));
11469
11297
  for (const [key, value] of Object.entries(prefs)) {
@@ -11483,8 +11311,8 @@ var init_search = __esm(() => {
11483
11311
  });
11484
11312
 
11485
11313
  // src/modules/memory/store.ts
11486
- import { readFileSync as readFileSync11, writeFileSync as writeFileSync8, appendFileSync as appendFileSync4, existsSync as existsSync21, mkdirSync as mkdirSync10 } from "fs";
11487
- import { join as join11 } from "path";
11314
+ import { readFileSync as readFileSync11, writeFileSync as writeFileSync8, appendFileSync as appendFileSync4, existsSync as existsSync20, mkdirSync as mkdirSync10 } from "fs";
11315
+ import { join as join10 } from "path";
11488
11316
 
11489
11317
  class MemoryStore {
11490
11318
  memoryDir;
@@ -11492,8 +11320,8 @@ class MemoryStore {
11492
11320
  this.memoryDir = memoryDir;
11493
11321
  this.ensureDir();
11494
11322
  for (const name of MEMORY_FILES2) {
11495
- const path = join11(this.memoryDir, `${name}.md`);
11496
- if (!existsSync21(path)) {
11323
+ const path = join10(this.memoryDir, `${name}.md`);
11324
+ if (!existsSync20(path)) {
11497
11325
  writeFileSync8(path, `# ${name.charAt(0).toUpperCase() + name.slice(1)}
11498
11326
 
11499
11327
  `, "utf-8");
@@ -11501,18 +11329,18 @@ class MemoryStore {
11501
11329
  }
11502
11330
  }
11503
11331
  ensureDir() {
11504
- if (!existsSync21(this.memoryDir)) {
11332
+ if (!existsSync20(this.memoryDir)) {
11505
11333
  mkdirSync10(this.memoryDir, { recursive: true });
11506
11334
  }
11507
11335
  }
11508
11336
  read(name) {
11509
- const path = join11(this.memoryDir, `${name}.md`);
11510
- if (!existsSync21(path))
11337
+ const path = join10(this.memoryDir, `${name}.md`);
11338
+ if (!existsSync20(path))
11511
11339
  return "";
11512
11340
  return readFileSync11(path, "utf-8");
11513
11341
  }
11514
11342
  append(name, entry) {
11515
- const path = join11(this.memoryDir, `${name}.md`);
11343
+ const path = join10(this.memoryDir, `${name}.md`);
11516
11344
  const timestamp = new Date().toISOString().replace("T", " ").slice(0, 19);
11517
11345
  const formatted = `- **${timestamp}** — ${entry}
11518
11346
  `;
@@ -11523,11 +11351,11 @@ class MemoryStore {
11523
11351
  return searchModule.query(query);
11524
11352
  }
11525
11353
  prefsPath() {
11526
- return join11(this.memoryDir, "preferences.json");
11354
+ return join10(this.memoryDir, "preferences.json");
11527
11355
  }
11528
11356
  getPreferences() {
11529
11357
  const path = this.prefsPath();
11530
- if (!existsSync21(path))
11358
+ if (!existsSync20(path))
11531
11359
  return {};
11532
11360
  try {
11533
11361
  return JSON.parse(readFileSync11(path, "utf-8"));
@@ -11557,7 +11385,7 @@ var init_store = __esm(() => {
11557
11385
 
11558
11386
  // src/tools/remember.ts
11559
11387
  import { homedir as homedir6 } from "os";
11560
- import { join as join12 } from "path";
11388
+ import { join as join11 } from "path";
11561
11389
  var CATEGORIES, rememberTool;
11562
11390
  var init_remember = __esm(() => {
11563
11391
  init_i18n();
@@ -11595,7 +11423,7 @@ var init_remember = __esm(() => {
11595
11423
  if (!CATEGORIES.includes(category)) {
11596
11424
  return { success: false, output: t("tool.invalid_params") };
11597
11425
  }
11598
- const memoryDir = join12(homedir6(), ".mma", "memory");
11426
+ const memoryDir = join11(homedir6(), ".mma", "memory");
11599
11427
  const store = new MemoryStore(memoryDir);
11600
11428
  try {
11601
11429
  if (category === "preferences") {
@@ -11628,7 +11456,7 @@ var init_remember = __esm(() => {
11628
11456
 
11629
11457
  // src/tools/recall.ts
11630
11458
  import { homedir as homedir7 } from "os";
11631
- import { join as join13 } from "path";
11459
+ import { join as join12 } from "path";
11632
11460
  function formatAll(store) {
11633
11461
  const parts = [];
11634
11462
  const prefs = store.getPreferences();
@@ -11711,7 +11539,7 @@ var init_recall = __esm(() => {
11711
11539
  handler: async (_ctx, args) => {
11712
11540
  const query = args.query ? String(args.query) : "";
11713
11541
  const category = args.category ? String(args.category) : "";
11714
- const memoryDir = join13(homedir7(), ".mma", "memory");
11542
+ const memoryDir = join12(homedir7(), ".mma", "memory");
11715
11543
  const store = new MemoryStore(memoryDir);
11716
11544
  try {
11717
11545
  if (!query && !category) {
@@ -11907,15 +11735,15 @@ function buildIndexInjectionScript() {
11907
11735
 
11908
11736
  // src/modules/browser/cookie-store.ts
11909
11737
  import { readFile, writeFile, mkdir } from "fs/promises";
11910
- import { join as join14 } from "path";
11738
+ import { join as join13 } from "path";
11911
11739
 
11912
11740
  class CookieStore {
11913
11741
  filePath;
11914
11742
  constructor(cookieDir) {
11915
- this.filePath = join14(cookieDir, "cookies.json");
11743
+ this.filePath = join13(cookieDir, "cookies.json");
11916
11744
  }
11917
11745
  async save(cookies) {
11918
- await mkdir(join14(this.filePath, ".."), { recursive: true });
11746
+ await mkdir(join13(this.filePath, ".."), { recursive: true });
11919
11747
  await writeFile(this.filePath, JSON.stringify(cookies, null, 2), "utf-8");
11920
11748
  }
11921
11749
  async load() {
@@ -12235,10 +12063,10 @@ var init_types = __esm(() => {
12235
12063
  });
12236
12064
 
12237
12065
  // src/tools/browser.ts
12238
- import { join as join15 } from "path";
12066
+ import { join as join14 } from "path";
12239
12067
  function getSession(ctx) {
12240
12068
  if (!session) {
12241
- const cookieDir = join15(ctx.baseDir, ".mma", "browser");
12069
+ const cookieDir = join14(ctx.baseDir, ".mma", "browser");
12242
12070
  session = new BrowserSession({
12243
12071
  ...DEFAULT_BROWSER_CONFIG,
12244
12072
  headless: ctx.config.browser?.headless ?? true,
@@ -12368,8 +12196,8 @@ async function readClipboardFallback() {
12368
12196
  const { platform: platform4 } = await import("os");
12369
12197
  const { execSync: execSync3 } = await import("child_process");
12370
12198
  const { readFileSync: readFileSync13, unlinkSync: unlinkSync3 } = await import("fs");
12371
- const { join: join16 } = await import("path");
12372
- const tmpPath = join16(process.env.TEMP || process.env.TMP || "/tmp", `mma-clip-${Date.now()}.png`);
12199
+ const { join: join15 } = await import("path");
12200
+ const tmpPath = join15(process.env.TEMP || process.env.TMP || "/tmp", `mma-clip-${Date.now()}.png`);
12373
12201
  try {
12374
12202
  if (platform4() === "linux") {
12375
12203
  execSync3(`xclip -selection clipboard -t image/png -o > "${tmpPath}" 2>/dev/null`, { timeout: 5000 });
@@ -12447,7 +12275,7 @@ var init_image_utils = __esm(() => {
12447
12275
  });
12448
12276
 
12449
12277
  // src/tools/attach-image.ts
12450
- import { existsSync as existsSync22 } from "fs";
12278
+ import { existsSync as existsSync21 } from "fs";
12451
12279
  import { resolve as resolve11 } from "path";
12452
12280
  var attachImageTool;
12453
12281
  var init_attach_image = __esm(() => {
@@ -12490,7 +12318,7 @@ var init_attach_image = __esm(() => {
12490
12318
  dataUrl = result.dataUrl;
12491
12319
  } else {
12492
12320
  const absPath = resolve11(ctx.baseDir, source);
12493
- if (!existsSync22(absPath)) {
12321
+ if (!existsSync21(absPath)) {
12494
12322
  return {
12495
12323
  success: false,
12496
12324
  output: t("image.not_found", { path: source })
@@ -12650,16 +12478,16 @@ class ModuleRegistry {
12650
12478
  }
12651
12479
 
12652
12480
  // src/modules/plugins/loader.ts
12653
- import { readdirSync as readdirSync5, existsSync as existsSync23, statSync as statSync4 } from "fs";
12654
- import { join as join16 } from "path";
12481
+ import { readdirSync as readdirSync5, existsSync as existsSync22, statSync as statSync4 } from "fs";
12482
+ import { join as join15 } from "path";
12655
12483
 
12656
12484
  class PluginLoader {
12657
12485
  loadFromDir(dirPath, pluginManager, logger) {
12658
- if (!existsSync23(dirPath))
12486
+ if (!existsSync22(dirPath))
12659
12487
  return;
12660
12488
  const entries = readdirSync5(dirPath);
12661
12489
  for (const entry of entries) {
12662
- const fullPath = join16(dirPath, entry);
12490
+ const fullPath = join15(dirPath, entry);
12663
12491
  if (!statSync4(fullPath).isFile())
12664
12492
  continue;
12665
12493
  if (!entry.endsWith(".ts") && !entry.endsWith(".js"))
@@ -12683,8 +12511,8 @@ var init_loader = __esm(() => {
12683
12511
 
12684
12512
  // src/modules/plugins/builtin/lint-on-write.ts
12685
12513
  import { execSync as execSync3 } from "child_process";
12686
- import { existsSync as existsSync24, readFileSync as readFileSync13 } from "fs";
12687
- import { resolve as resolve12, extname as extname4, join as join17 } from "path";
12514
+ import { existsSync as existsSync23, readFileSync as readFileSync13 } from "fs";
12515
+ import { resolve as resolve12, extname as extname4, join as join16 } from "path";
12688
12516
 
12689
12517
  class LintOnWritePlugin {
12690
12518
  name = "lint-on-write";
@@ -12700,7 +12528,7 @@ class LintOnWritePlugin {
12700
12528
  if (!path)
12701
12529
  return;
12702
12530
  const fullPath = resolve12(ctx.baseDir, path);
12703
- if (!existsSync24(fullPath))
12531
+ if (!existsSync23(fullPath))
12704
12532
  return;
12705
12533
  const ext = extname4(fullPath);
12706
12534
  const syntaxError = this.checkSyntax(fullPath, ext, ctx.baseDir);
@@ -12746,8 +12574,8 @@ class LintOnWritePlugin {
12746
12574
  }
12747
12575
  async runProjectLint(ctx, result) {
12748
12576
  try {
12749
- const packageJsonPath = join17(ctx.baseDir, "package.json");
12750
- if (!existsSync24(packageJsonPath)) {
12577
+ const packageJsonPath = join16(ctx.baseDir, "package.json");
12578
+ if (!existsSync23(packageJsonPath)) {
12751
12579
  return;
12752
12580
  }
12753
12581
  const packageJson = JSON.parse(readFileSync13(packageJsonPath, "utf-8"));
@@ -12766,8 +12594,8 @@ class LintOnWritePlugin {
12766
12594
  }
12767
12595
  }
12768
12596
  async runProjectTypeCheck(ctx, result) {
12769
- const tsconfigPath = join17(ctx.baseDir, "tsconfig.json");
12770
- if (!existsSync24(tsconfigPath)) {
12597
+ const tsconfigPath = join16(ctx.baseDir, "tsconfig.json");
12598
+ if (!existsSync23(tsconfigPath)) {
12771
12599
  return;
12772
12600
  }
12773
12601
  const now = Date.now();
@@ -13048,8 +12876,8 @@ var init_stuck_detector = __esm(() => {
13048
12876
 
13049
12877
  // src/modules/execution/auditor.ts
13050
12878
  import { execSync as execSync4 } from "child_process";
13051
- import { existsSync as existsSync25 } from "fs";
13052
- import { resolve as resolve13, join as join18 } from "path";
12879
+ import { existsSync as existsSync24 } from "fs";
12880
+ import { resolve as resolve13, join as join17 } from "path";
13053
12881
 
13054
12882
  class Auditor {
13055
12883
  baseDir;
@@ -13064,7 +12892,7 @@ class Auditor {
13064
12892
  const existingFiles = [];
13065
12893
  for (const filePath of uniqueFiles) {
13066
12894
  const resolved = resolve13(this.baseDir, filePath);
13067
- if (existsSync25(resolved)) {
12895
+ if (existsSync24(resolved)) {
13068
12896
  existingFiles.push(filePath);
13069
12897
  } else {
13070
12898
  missingFiles.push(filePath);
@@ -13095,8 +12923,8 @@ class Auditor {
13095
12923
  };
13096
12924
  }
13097
12925
  async runProjectTypeCheck() {
13098
- const tsconfigPath = join18(this.baseDir, "tsconfig.json");
13099
- if (!existsSync25(tsconfigPath)) {
12926
+ const tsconfigPath = join17(this.baseDir, "tsconfig.json");
12927
+ if (!existsSync24(tsconfigPath)) {
13100
12928
  return null;
13101
12929
  }
13102
12930
  try {
@@ -13121,7 +12949,7 @@ var init_auditor = __esm(() => {
13121
12949
  });
13122
12950
 
13123
12951
  // src/modules/execution/module.ts
13124
- import { existsSync as existsSync26 } from "fs";
12952
+ import { existsSync as existsSync25 } from "fs";
13125
12953
  import { resolve as resolve14 } from "path";
13126
12954
 
13127
12955
  class ExecutionModule {
@@ -13428,7 +13256,7 @@ Sub-tasks: ${note}`
13428
13256
  const stepPaths = step.description.match(/\b[\w./\\-]+\.[a-z]+/gi) || [];
13429
13257
  if (stepPaths.length === 0)
13430
13258
  return;
13431
- const allExist = stepPaths.every((p) => existsSync26(resolve14(this.baseDir, p)));
13259
+ const allExist = stepPaths.every((p) => existsSync25(resolve14(this.baseDir, p)));
13432
13260
  if (allExist) {
13433
13261
  this.tracker?.updateStepStatus(step.id, "done");
13434
13262
  this.tracker?.advance();
@@ -13445,8 +13273,8 @@ var init_module = __esm(() => {
13445
13273
  });
13446
13274
 
13447
13275
  // src/modules/security/session-encryption.ts
13448
- import { readFileSync as readFileSync14, writeFileSync as writeFileSync9, existsSync as existsSync27, readdirSync as readdirSync6, unlinkSync as unlinkSync3 } from "fs";
13449
- import { join as join19 } from "path";
13276
+ import { readFileSync as readFileSync14, writeFileSync as writeFileSync9, existsSync as existsSync26, readdirSync as readdirSync6, unlinkSync as unlinkSync3 } from "fs";
13277
+ import { join as join18 } from "path";
13450
13278
  import { homedir as homedir8 } from "os";
13451
13279
 
13452
13280
  class SessionFileEncryptor {
@@ -13455,7 +13283,7 @@ class SessionFileEncryptor {
13455
13283
  constructor(config) {
13456
13284
  this.config = { ...DEFAULT_SESSION_ENCRYPTION, ...config };
13457
13285
  this.encryptor = new ConfigEncryptor({
13458
- keyPath: config?.keyPath || join19(homedir8(), ".mma", ".session-encryption-key")
13286
+ keyPath: config?.keyPath || join18(homedir8(), ".mma", ".session-encryption-key")
13459
13287
  });
13460
13288
  }
13461
13289
  isEnabled() {
@@ -13527,8 +13355,8 @@ class SessionFileEncryptor {
13527
13355
  return;
13528
13356
  const files = readdirSync6(sessionDir);
13529
13357
  for (const file of files) {
13530
- const filePath = join19(sessionDir, file);
13531
- if (existsSync27(filePath) && !file.endsWith(".enc")) {
13358
+ const filePath = join18(sessionDir, file);
13359
+ if (existsSync26(filePath) && !file.endsWith(".enc")) {
13532
13360
  try {
13533
13361
  const content = readFileSync14(filePath, "utf8");
13534
13362
  const encrypted = this.encryptFileContent(content);
@@ -13544,7 +13372,7 @@ class SessionFileEncryptor {
13544
13372
  const files = readdirSync6(sessionDir);
13545
13373
  for (const file of files) {
13546
13374
  if (file.endsWith(".enc")) {
13547
- const encFilePath = join19(sessionDir, file);
13375
+ const encFilePath = join18(sessionDir, file);
13548
13376
  const decFilePath = encFilePath.slice(0, -4);
13549
13377
  try {
13550
13378
  const content = readFileSync14(encFilePath, "utf8");
@@ -13569,7 +13397,7 @@ var init_session_encryption = __esm(() => {
13569
13397
 
13570
13398
  // src/modules/session/store.ts
13571
13399
  import {
13572
- existsSync as existsSync28,
13400
+ existsSync as existsSync27,
13573
13401
  mkdirSync as mkdirSync11,
13574
13402
  readdirSync as readdirSync7,
13575
13403
  readFileSync as readFileSync15,
@@ -13577,7 +13405,7 @@ import {
13577
13405
  writeFileSync as writeFileSync10,
13578
13406
  appendFileSync as appendFileSync5
13579
13407
  } from "fs";
13580
- import { join as join20 } from "path";
13408
+ import { join as join19 } from "path";
13581
13409
  import { gzipSync } from "zlib";
13582
13410
 
13583
13411
  class SessionStore {
@@ -13603,19 +13431,19 @@ class SessionStore {
13603
13431
  mkdirSync11(this.baseDir, { recursive: true });
13604
13432
  }
13605
13433
  sessionDir(id) {
13606
- return join20(this.baseDir, id);
13434
+ return join19(this.baseDir, id);
13607
13435
  }
13608
13436
  metaPath(id) {
13609
- return join20(this.sessionDir(id), "meta.json");
13437
+ return join19(this.sessionDir(id), "meta.json");
13610
13438
  }
13611
13439
  historyPath(id) {
13612
- return join20(this.sessionDir(id), "history.jsonl");
13440
+ return join19(this.sessionDir(id), "history.jsonl");
13613
13441
  }
13614
13442
  sessionLogPath(id) {
13615
- return join20(this.sessionDir(id), "session.jsonl");
13443
+ return join19(this.sessionDir(id), "session.jsonl");
13616
13444
  }
13617
13445
  sessionExists(id) {
13618
- return existsSync28(this.metaPath(id));
13446
+ return existsSync27(this.metaPath(id));
13619
13447
  }
13620
13448
  saveMeta(id, meta) {
13621
13449
  const dir = this.sessionDir(id);
@@ -13629,7 +13457,7 @@ class SessionStore {
13629
13457
  }
13630
13458
  loadMeta(id) {
13631
13459
  const path = this.metaPath(id);
13632
- if (!existsSync28(path))
13460
+ if (!existsSync27(path))
13633
13461
  return null;
13634
13462
  try {
13635
13463
  const raw = readFileSync15(path, "utf-8");
@@ -13659,7 +13487,7 @@ class SessionStore {
13659
13487
  }
13660
13488
  loadHistory(id) {
13661
13489
  const path = this.historyPath(id);
13662
- if (!existsSync28(path))
13490
+ if (!existsSync27(path))
13663
13491
  return [];
13664
13492
  try {
13665
13493
  const raw = readFileSync15(path, "utf-8");
@@ -13688,7 +13516,7 @@ class SessionStore {
13688
13516
  }
13689
13517
  loadSessionLog(id) {
13690
13518
  const path = this.sessionLogPath(id);
13691
- if (!existsSync28(path))
13519
+ if (!existsSync27(path))
13692
13520
  return [];
13693
13521
  try {
13694
13522
  const raw = readFileSync15(path, "utf-8");
@@ -13704,7 +13532,7 @@ class SessionStore {
13704
13532
  }
13705
13533
  }
13706
13534
  listSessions() {
13707
- if (!existsSync28(this.baseDir))
13535
+ if (!existsSync27(this.baseDir))
13708
13536
  return [];
13709
13537
  const entries = readdirSync7(this.baseDir, { withFileTypes: true });
13710
13538
  const sessions = [];
@@ -13720,7 +13548,7 @@ class SessionStore {
13720
13548
  }
13721
13549
  deleteSession(id) {
13722
13550
  const dir = this.sessionDir(id);
13723
- if (existsSync28(dir)) {
13551
+ if (existsSync27(dir)) {
13724
13552
  rmSync(dir, { recursive: true, force: true });
13725
13553
  }
13726
13554
  }
@@ -13732,10 +13560,10 @@ class SessionStore {
13732
13560
  const updatedAt = new Date(session2.updatedAt);
13733
13561
  if (updatedAt < thirtyDaysAgo) {
13734
13562
  const historyPath = this.historyPath(session2.id);
13735
- if (existsSync28(historyPath)) {
13563
+ if (existsSync27(historyPath)) {
13736
13564
  const content = readFileSync15(historyPath, "utf-8");
13737
13565
  const compressed = gzipSync(content);
13738
- const gzPath = join20(this.baseDir, `${session2.id}.jsonl.gz`);
13566
+ const gzPath = join19(this.baseDir, `${session2.id}.jsonl.gz`);
13739
13567
  writeFileSync10(gzPath, compressed);
13740
13568
  rmSync(historyPath);
13741
13569
  }
@@ -13942,8 +13770,8 @@ class ProfileCompressor {
13942
13770
  }
13943
13771
 
13944
13772
  // src/modules/user-profile/profile.ts
13945
- import { readFileSync as readFileSync16, writeFileSync as writeFileSync11, existsSync as existsSync29, mkdirSync as mkdirSync12 } from "fs";
13946
- import { join as join21 } from "path";
13773
+ import { readFileSync as readFileSync16, writeFileSync as writeFileSync11, existsSync as existsSync28, mkdirSync as mkdirSync12 } from "fs";
13774
+ import { join as join20 } from "path";
13947
13775
  import { homedir as homedir9, hostname, platform as platform4, type } from "os";
13948
13776
  import { env } from "process";
13949
13777
 
@@ -13967,14 +13795,14 @@ class UserProfile {
13967
13795
  return this.info;
13968
13796
  }
13969
13797
  save() {
13970
- if (!existsSync29(this.profileDir)) {
13798
+ if (!existsSync28(this.profileDir)) {
13971
13799
  mkdirSync12(this.profileDir, { recursive: true });
13972
13800
  }
13973
- writeFileSync11(join21(this.profileDir, "profile.json"), JSON.stringify({ ...this.info, preferences: this.preferences }, null, 2), "utf-8");
13801
+ writeFileSync11(join20(this.profileDir, "profile.json"), JSON.stringify({ ...this.info, preferences: this.preferences }, null, 2), "utf-8");
13974
13802
  }
13975
13803
  load() {
13976
- const path = join21(this.profileDir, "profile.json");
13977
- if (!existsSync29(path))
13804
+ const path = join20(this.profileDir, "profile.json");
13805
+ if (!existsSync28(path))
13978
13806
  return null;
13979
13807
  try {
13980
13808
  const data = JSON.parse(readFileSync16(path, "utf-8"));
@@ -14012,12 +13840,12 @@ class UserProfile {
14012
13840
  var init_profile = () => {};
14013
13841
 
14014
13842
  // src/modules/skills/loader.ts
14015
- import { readdirSync as readdirSync8, readFileSync as readFileSync17, existsSync as existsSync30, statSync as statSync5 } from "fs";
14016
- import { join as join22 } from "path";
13843
+ import { readdirSync as readdirSync8, readFileSync as readFileSync17, existsSync as existsSync29, statSync as statSync5 } from "fs";
13844
+ import { join as join21 } from "path";
14017
13845
 
14018
13846
  class SkillsLoader {
14019
13847
  loadFromDir(dirPath) {
14020
- if (!existsSync30(dirPath))
13848
+ if (!existsSync29(dirPath))
14021
13849
  return [];
14022
13850
  const skills = [];
14023
13851
  this.scanDir(dirPath, skills);
@@ -14026,7 +13854,7 @@ class SkillsLoader {
14026
13854
  scanDir(dirPath, skills) {
14027
13855
  const entries = readdirSync8(dirPath);
14028
13856
  for (const entry of entries) {
14029
- const fullPath = join22(dirPath, entry);
13857
+ const fullPath = join21(dirPath, entry);
14030
13858
  const stat = statSync5(fullPath);
14031
13859
  if (stat.isDirectory()) {
14032
13860
  this.scanDir(fullPath, skills);
@@ -14306,8 +14134,8 @@ var init_browser2 = __esm(() => {
14306
14134
  });
14307
14135
 
14308
14136
  // src/modules/indexer/walker.ts
14309
- import { readdirSync as readdirSync9, readFileSync as readFileSync18, statSync as statSync6, existsSync as existsSync31, watch } from "fs";
14310
- import { join as join23, relative, extname as extname5 } from "path";
14137
+ import { readdirSync as readdirSync9, readFileSync as readFileSync18, statSync as statSync6, existsSync as existsSync30, watch } from "fs";
14138
+ import { join as join22, relative, extname as extname5 } from "path";
14311
14139
 
14312
14140
  class Indexer {
14313
14141
  baseDir;
@@ -14334,7 +14162,7 @@ class Indexer {
14334
14162
  let totalSize = 0;
14335
14163
  let count = 0;
14336
14164
  const walkDir = (dir) => {
14337
- if (!existsSync31(dir))
14165
+ if (!existsSync30(dir))
14338
14166
  return;
14339
14167
  let entries;
14340
14168
  try {
@@ -14345,7 +14173,7 @@ class Indexer {
14345
14173
  for (const entry of entries) {
14346
14174
  if (count >= this.MAX_FILES)
14347
14175
  return;
14348
- const fullPath = join23(dir, entry);
14176
+ const fullPath = join22(dir, entry);
14349
14177
  const relPath = relative(this.baseDir, fullPath);
14350
14178
  const stat = statSync6(fullPath);
14351
14179
  if (stat.isDirectory()) {
@@ -14408,19 +14236,19 @@ var init_walker = __esm(() => {
14408
14236
  });
14409
14237
 
14410
14238
  // src/modules/indexer/cache.ts
14411
- import { readFileSync as readFileSync19, writeFileSync as writeFileSync12, existsSync as existsSync32, mkdirSync as mkdirSync13, rmSync as rmSync2 } from "fs";
14412
- import { join as join24 } from "path";
14239
+ import { readFileSync as readFileSync19, writeFileSync as writeFileSync12, existsSync as existsSync31, mkdirSync as mkdirSync13, rmSync as rmSync2 } from "fs";
14240
+ import { join as join23 } from "path";
14413
14241
 
14414
14242
  class IndexCache {
14415
14243
  cachePath;
14416
14244
  cache = null;
14417
14245
  constructor(cacheDir) {
14418
- this.cachePath = join24(cacheDir, "index-cache.json");
14246
+ this.cachePath = join23(cacheDir, "index-cache.json");
14419
14247
  }
14420
14248
  load() {
14421
14249
  if (this.cache)
14422
14250
  return this.cache;
14423
- if (!existsSync32(this.cachePath))
14251
+ if (!existsSync31(this.cachePath))
14424
14252
  return null;
14425
14253
  try {
14426
14254
  this.cache = JSON.parse(readFileSync19(this.cachePath, "utf-8"));
@@ -14431,14 +14259,14 @@ class IndexCache {
14431
14259
  }
14432
14260
  save(result) {
14433
14261
  this.cache = result;
14434
- const dir = join24(this.cachePath, "..");
14435
- if (!existsSync32(dir))
14262
+ const dir = join23(this.cachePath, "..");
14263
+ if (!existsSync31(dir))
14436
14264
  mkdirSync13(dir, { recursive: true });
14437
14265
  writeFileSync12(this.cachePath, JSON.stringify(result), "utf-8");
14438
14266
  }
14439
14267
  invalidate() {
14440
14268
  this.cache = null;
14441
- if (existsSync32(this.cachePath)) {
14269
+ if (existsSync31(this.cachePath)) {
14442
14270
  try {
14443
14271
  rmSync2(this.cachePath);
14444
14272
  } catch {}
@@ -14796,13 +14624,13 @@ var init_mcp = __esm(() => {
14796
14624
 
14797
14625
  // src/modules/memory/module.ts
14798
14626
  import { homedir as homedir10 } from "os";
14799
- import { join as join25 } from "path";
14627
+ import { join as join24 } from "path";
14800
14628
 
14801
14629
  class MemoryModule {
14802
14630
  name = "memory";
14803
14631
  store;
14804
14632
  constructor(memoryDir) {
14805
- const dir = memoryDir || join25(homedir10(), ".mma", "memory");
14633
+ const dir = memoryDir || join24(homedir10(), ".mma", "memory");
14806
14634
  this.store = new MemoryStore(dir);
14807
14635
  }
14808
14636
  getSystemPromptBlock() {
@@ -14849,8 +14677,8 @@ __export(exports_bootstrap, {
14849
14677
  bootstrap: () => bootstrap
14850
14678
  });
14851
14679
  import { homedir as homedir11 } from "os";
14852
- import { join as join26, resolve as resolve15 } from "path";
14853
- import { existsSync as existsSync33, readFileSync as readFileSync20, writeFileSync as writeFileSync13 } from "fs";
14680
+ import { join as join25, resolve as resolve15 } from "path";
14681
+ import { existsSync as existsSync32, readFileSync as readFileSync20, writeFileSync as writeFileSync13 } from "fs";
14854
14682
  function buildSystemInfo(config, baseDir, profileCompressed) {
14855
14683
  const now = new Date().toISOString().replace("T", " ").slice(0, 19);
14856
14684
  const isWin = profileCompressed.toLowerCase().includes("win32");
@@ -14860,10 +14688,9 @@ function buildSystemInfo(config, baseDir, profileCompressed) {
14860
14688
  `Workspace: ${baseDir}`,
14861
14689
  `${profileCompressed}`,
14862
14690
  `Reply in the user's language. Use tools for filesystem, bash, web access.`,
14863
- `When you need to act, call a tool immediately. Do not describe your plans in text use tools to perform operations.`,
14864
- `After every tool call, check whether the user's request is fully satisfied. If any files, commands, or checks are still missing, call the next needed tool right away. Do not stop with an empty or "done" response until the task is complete.`,
14865
- `If you create a directory, continue creating the files that belong inside it. A created folder alone is not a completed task.`,
14866
- `If a tool call fails (e.g., a skill is too large), try an alternative approach or continue without it. Do not reply with empty text when the task is unfinished.`,
14691
+ `Use tools when needed. Explain briefly what you're doing if it's not obvious.`,
14692
+ `Answer the user's question directly. Only take action when the user explicitly asks you to change, create, or fix something.`,
14693
+ `If a tool call fails, report the error and ask the user how to proceed.`,
14867
14694
  ``,
14868
14695
  `Design principles — apply them automatically without naming them:`,
14869
14696
  `- Do not add code, files, or abstractions that are not needed right now (YAGNI — You Ain't Gonna Need It). If something is not required by the current task, omit it.`,
@@ -14875,7 +14702,7 @@ function buildSystemInfo(config, baseDir, profileCompressed) {
14875
14702
  }
14876
14703
  lines.push(``, `Bash tool rules:`, `- Use the "workdir" parameter to run commands in a specific directory. Do NOT chain "cd dir && cmd" — the security module blocks the "&&" operator.`, `- Run one command per tool call. Split multi-step shell operations into separate bash calls.`);
14877
14704
  if (config.autoPlan) {
14878
- lines.push(``, `Plan rule: For any task with 2+ steps, create a plan first using the "plan" tool. After each step, call "plan update" to mark progress. Stay focused on the current step.`);
14705
+ lines.push(``, `Plan rule: For complex tasks with 3+ steps, you may create a plan using the "plan" tool. For simple questions, just answer directly.`);
14879
14706
  }
14880
14707
  const hasMCP = config.mcpServers && Object.values(config.mcpServers).some((s) => s.enabled !== false);
14881
14708
  if (hasMCP) {
@@ -14885,8 +14712,8 @@ function buildSystemInfo(config, baseDir, profileCompressed) {
14885
14712
  `);
14886
14713
  }
14887
14714
  async function bootstrap(configDir, projectDir, noAgentsMd, exitOnComplete) {
14888
- const dir = configDir || join26(homedir11(), ".mma");
14889
- const projectConfigPath = projectDir ? join26(projectDir, ".mmrc") : join26(process.cwd(), ".mmrc");
14715
+ const dir = configDir || join25(homedir11(), ".mma");
14716
+ const projectConfigPath = projectDir ? join25(projectDir, ".mmrc") : join25(process.cwd(), ".mmrc");
14890
14717
  const config = loadConfig({ configDir: dir, projectConfigPath });
14891
14718
  setLocale(config.locale);
14892
14719
  try {
@@ -14896,7 +14723,7 @@ async function bootstrap(configDir, projectDir, noAgentsMd, exitOnComplete) {
14896
14723
  }
14897
14724
  } catch {}
14898
14725
  const logger = new Logger(config.logLevel);
14899
- logger.setLogDir(join26(dir, "logs"));
14726
+ logger.setLogDir(join25(dir, "logs"));
14900
14727
  logger.debug("MMA bootstrap", {
14901
14728
  version: config.version,
14902
14729
  model: config.model
@@ -14918,7 +14745,7 @@ async function bootstrap(configDir, projectDir, noAgentsMd, exitOnComplete) {
14918
14745
  logger.info(`Model ${config.model} loaded in ${loadResult.loadTime}s`);
14919
14746
  }
14920
14747
  }
14921
- const profile = new UserProfile(join26(dir));
14748
+ const profile = new UserProfile(join25(dir));
14922
14749
  profile.load() || profile.collect();
14923
14750
  profile.save();
14924
14751
  const llmProvider = new OpenAICompatProvider({
@@ -14930,7 +14757,7 @@ async function bootstrap(configDir, projectDir, noAgentsMd, exitOnComplete) {
14930
14757
  rateLimits: config.security?.rateLimits
14931
14758
  });
14932
14759
  const baseDir = projectDir ? resolve15(projectDir) : process.cwd();
14933
- const projectMapCacheDir = join26(baseDir, ".mma");
14760
+ const projectMapCacheDir = join25(baseDir, ".mma");
14934
14761
  const indexerModule = new IndexerModule({
14935
14762
  baseDir,
14936
14763
  cacheDir: projectMapCacheDir
@@ -14941,9 +14768,9 @@ async function bootstrap(configDir, projectDir, noAgentsMd, exitOnComplete) {
14941
14768
  logger.warn(`Project indexing failed: ${err.message}`);
14942
14769
  }
14943
14770
  const skillsLoader = new SkillsLoader;
14944
- const builtinDir = join26(import.meta.dirname, "skills", "builtin");
14945
- const globalDir = join26(homedir11(), ".agents", "skills");
14946
- const projectSkillsDir = join26(baseDir, ".mma", "skills");
14771
+ const builtinDir = join25(import.meta.dirname, "skills", "builtin");
14772
+ const globalDir = join25(homedir11(), ".agents", "skills");
14773
+ const projectSkillsDir = join25(baseDir, ".mma", "skills");
14947
14774
  const availableSkills = skillsLoader.loadFromAllSources(builtinDir, globalDir, projectSkillsDir);
14948
14775
  const skillsMatcher = new SkillsMatcher;
14949
14776
  const skillsBudget = Math.floor(config.contextWindow * 0.1);
@@ -14957,11 +14784,11 @@ async function bootstrap(configDir, projectDir, noAgentsMd, exitOnComplete) {
14957
14784
  essential: true,
14958
14785
  estimatedTokens: 250
14959
14786
  };
14960
- const agentsMdGlobal = join26(dir, "AGENTS.md");
14961
- if (!existsSync33(agentsMdGlobal)) {
14787
+ const agentsMdGlobal = join25(dir, "AGENTS.md");
14788
+ if (!existsSync32(agentsMdGlobal)) {
14962
14789
  writeFileSync13(agentsMdGlobal, "", "utf-8");
14963
14790
  }
14964
- const sessionDir = join26(dir, "sessions");
14791
+ const sessionDir = join25(dir, "sessions");
14965
14792
  const sessionStore = new SessionStore(sessionDir);
14966
14793
  sessionStore.init();
14967
14794
  const sessionManager = new SessionManager(sessionStore, {
@@ -15004,12 +14831,6 @@ async function bootstrap(configDir, projectDir, noAgentsMd, exitOnComplete) {
15004
14831
  toolCtx.llmProvider = llmProvider;
15005
14832
  toolCtx.toolExecutor = toolExecutor;
15006
14833
  const hallucinationDetector = new HallucinationDetector;
15007
- const factualCheck = hallucinationDetector.getFactualCheck();
15008
- factualCheck.setBaseDir(baseDir);
15009
- toolCtx.trackReadPath = (p) => factualCheck.trackReadPath(p);
15010
- toolCtx.trackCreatedPath = (p) => factualCheck.trackCreatedPath(p);
15011
- toolCtx.trackDeletedPath = (p) => factualCheck.trackDeletedPath(p);
15012
- toolCtx.trackDocumentContent = (c) => factualCheck.trackDocumentContent(c);
15013
14834
  const moduleRegistry = new ModuleRegistry;
15014
14835
  const execModule = new ExecutionModule(baseDir, config.stuckThreshold);
15015
14836
  moduleRegistry.register(execModule);
@@ -15020,7 +14841,7 @@ async function bootstrap(configDir, projectDir, noAgentsMd, exitOnComplete) {
15020
14841
  const mcpModule = new MCPModule(config);
15021
14842
  await mcpModule.initialize();
15022
14843
  moduleRegistry.register(mcpModule);
15023
- const memoryModule = new MemoryModule(join26(dir, "memory"));
14844
+ const memoryModule = new MemoryModule(join25(dir, "memory"));
15024
14845
  moduleRegistry.register(memoryModule);
15025
14846
  if (config.browser.enabled) {
15026
14847
  const browserModule = new BrowserModule;
@@ -15063,8 +14884,8 @@ async function bootstrap(configDir, projectDir, noAgentsMd, exitOnComplete) {
15063
14884
  pluginManager.register(plugin);
15064
14885
  pluginManager.register(plugin2);
15065
14886
  const pluginLoader = new PluginLoader;
15066
- const globalPluginsDir = join26(homedir11(), ".mma", "plugins");
15067
- const projectPluginsDir = join26(dir, ".mma", "plugins");
14887
+ const globalPluginsDir = join25(homedir11(), ".mma", "plugins");
14888
+ const projectPluginsDir = join25(dir, ".mma", "plugins");
15068
14889
  pluginLoader.loadFromDir(globalPluginsDir, pluginManager, logger);
15069
14890
  pluginLoader.loadFromDir(projectPluginsDir, pluginManager, logger);
15070
14891
  contextManager.onCompact = (summary) => {
@@ -15082,12 +14903,12 @@ async function bootstrap(configDir, projectDir, noAgentsMd, exitOnComplete) {
15082
14903
  const skipAgentsMd = noAgentsMd === true;
15083
14904
  if (!skipAgentsMd) {
15084
14905
  const agentsMdCandidates = [
15085
- join26(baseDir, "AGENTS.md"),
15086
- join26(baseDir, ".mma", "AGENTS.md"),
15087
- join26(dir, "AGENTS.md")
14906
+ join25(baseDir, "AGENTS.md"),
14907
+ join25(baseDir, ".mma", "AGENTS.md"),
14908
+ join25(dir, "AGENTS.md")
15088
14909
  ];
15089
14910
  for (const p of agentsMdCandidates) {
15090
- if (existsSync33(p)) {
14911
+ if (existsSync32(p)) {
15091
14912
  const content = readFileSync20(p, "utf-8").trim();
15092
14913
  if (content) {
15093
14914
  agentsMdBlocks.push({
@@ -15921,14 +15742,14 @@ async function runSetup() {
15921
15742
 
15922
15743
  // src/cli/commands.ts
15923
15744
  init_i18n();
15924
- import { join as join28, dirname as dirname8 } from "path";
15745
+ import { join as join27, dirname as dirname8 } from "path";
15925
15746
  import { homedir as homedir13 } from "os";
15926
- import { existsSync as existsSync34, readFileSync as readFileSync21 } from "fs";
15747
+ import { existsSync as existsSync33, readFileSync as readFileSync21 } from "fs";
15927
15748
 
15928
15749
  // src/cli/security-commands.ts
15929
15750
  init_bootstrap();
15930
15751
  init_config();
15931
- import { join as join27 } from "path";
15752
+ import { join as join26 } from "path";
15932
15753
  import { homedir as homedir12 } from "os";
15933
15754
 
15934
15755
  // src/modules/security/security-policies.ts
@@ -16430,7 +16251,7 @@ function createSecurityCommand(program2) {
16430
16251
  }
16431
16252
  });
16432
16253
  securityCmd.command("set-policy").argument("<preset>", t("cli.security.preset")).description(t("cli.security.set_policy")).action(async (preset) => {
16433
- const configPath = join27(homedir12(), ".mma", "config.json");
16254
+ const configPath = join26(homedir12(), ".mma", "config.json");
16434
16255
  const { config: appConfig } = await bootstrap();
16435
16256
  const validPresets = ["strict", "balanced", "permissive"];
16436
16257
  if (!validPresets.includes(preset)) {
@@ -16445,7 +16266,7 @@ function createSecurityCommand(program2) {
16445
16266
  console.log(t("cli.security.policy_description", { description: policy.description }));
16446
16267
  });
16447
16268
  securityCmd.command("enable-encryption").description(t("cli.security.enable_encryption")).action(async () => {
16448
- const configPath = join27(homedir12(), ".mma", "config.json");
16269
+ const configPath = join26(homedir12(), ".mma", "config.json");
16449
16270
  const { config: appConfig } = await bootstrap();
16450
16271
  appConfig.security = appConfig.security || {};
16451
16272
  appConfig.security.sessionEncryption = {
@@ -16457,7 +16278,7 @@ function createSecurityCommand(program2) {
16457
16278
  console.log(t("cli.security.encryption_enabled"));
16458
16279
  });
16459
16280
  securityCmd.command("disable-encryption").description(t("cli.security.disable_encryption")).action(async () => {
16460
- const configPath = join27(homedir12(), ".mma", "config.json");
16281
+ const configPath = join26(homedir12(), ".mma", "config.json");
16461
16282
  const { config: appConfig } = await bootstrap();
16462
16283
  appConfig.security = appConfig.security || {};
16463
16284
  appConfig.security.sessionEncryption = {
@@ -16469,7 +16290,7 @@ function createSecurityCommand(program2) {
16469
16290
  console.log(t("cli.security.encryption_disabled"));
16470
16291
  });
16471
16292
  securityCmd.command("enable-audit").description(t("cli.security.enable_audit")).action(async () => {
16472
- const configPath = join27(homedir12(), ".mma", "config.json");
16293
+ const configPath = join26(homedir12(), ".mma", "config.json");
16473
16294
  const { config: appConfig } = await bootstrap();
16474
16295
  appConfig.security = appConfig.security || {};
16475
16296
  appConfig.security.auditNotifier = {
@@ -16483,7 +16304,7 @@ function createSecurityCommand(program2) {
16483
16304
  console.log(t("cli.security.audit_enabled"));
16484
16305
  });
16485
16306
  securityCmd.command("disable-audit").description(t("cli.security.disable_audit")).action(async () => {
16486
- const configPath = join27(homedir12(), ".mma", "config.json");
16307
+ const configPath = join26(homedir12(), ".mma", "config.json");
16487
16308
  const { config: appConfig } = await bootstrap();
16488
16309
  appConfig.security = appConfig.security || {};
16489
16310
  appConfig.security.auditNotifier = {
@@ -16519,11 +16340,11 @@ import { fileURLToPath } from "url";
16519
16340
  function readVersion() {
16520
16341
  const here = dirname8(fileURLToPath(import.meta.url));
16521
16342
  const candidates = [
16522
- join28(here, "..", "..", "package.json"),
16523
- join28(here, "..", "package.json")
16343
+ join27(here, "..", "..", "package.json"),
16344
+ join27(here, "..", "package.json")
16524
16345
  ];
16525
16346
  for (const p of candidates) {
16526
- if (existsSync34(p)) {
16347
+ if (existsSync33(p)) {
16527
16348
  const raw = JSON.parse(readFileSync21(p, "utf8"));
16528
16349
  if (raw.version)
16529
16350
  return raw.version;
@@ -16536,7 +16357,7 @@ function createProgram() {
16536
16357
  const program2 = new Command().name("mma").description(t("cli.description")).version(version).option("--no-agents-md", t("cli.no_agents_md")).option("-d, --dir <path>", t("cli.dir")).option("-e, --exit-on-complete", t("cli.exit_on_complete")).option("-j, --json", t("cli.json"));
16537
16358
  program2.command("init").description(t("cli.init")).action(async () => {
16538
16359
  const answers = await runSetup();
16539
- const configPath = join28(homedir13(), ".mma", "config.json");
16360
+ const configPath = join27(homedir13(), ".mma", "config.json");
16540
16361
  const { config } = await bootstrap();
16541
16362
  config.provider.type = answers.provider;
16542
16363
  config.provider.baseUrl = answers.apiBase;
@@ -16550,7 +16371,7 @@ function createProgram() {
16550
16371
  });
16551
16372
  const configCmd = program2.command("config").description(t("cli.manage_config"));
16552
16373
  configCmd.command("set").argument("<key>", t("cli.config_key")).argument("<value>", "Config value").description(t("cli.set_value")).action(async (key, value) => {
16553
- const configPath = join28(homedir13(), ".mma", "config.json");
16374
+ const configPath = join27(homedir13(), ".mma", "config.json");
16554
16375
  const { config } = await bootstrap();
16555
16376
  const keys = key.split(".");
16556
16377
  let obj = config;
@@ -16610,14 +16431,14 @@ function createProgram() {
16610
16431
  console.log(t("cli.model_hint"));
16611
16432
  });
16612
16433
  model.command("use").argument("<name>", "Model name").description(t("cli.set_model")).action(async (name) => {
16613
- const configPath = join28(homedir13(), ".mma", "config.json");
16434
+ const configPath = join27(homedir13(), ".mma", "config.json");
16614
16435
  const { config } = await bootstrap();
16615
16436
  config.model = name;
16616
16437
  saveConfig(config, configPath);
16617
16438
  console.log(t("cli.model_set", { name }));
16618
16439
  });
16619
16440
  program2.command("context").description(t("cli.manage_context")).argument("<size>", "Context window size in tokens").action(async (size) => {
16620
- const configPath = join28(homedir13(), ".mma", "config.json");
16441
+ const configPath = join27(homedir13(), ".mma", "config.json");
16621
16442
  const { config } = await bootstrap();
16622
16443
  const contextWindow = parseInt(size, 10);
16623
16444
  if (isNaN(contextWindow) || contextWindow < 1024) {
@@ -16635,7 +16456,7 @@ function createProgram() {
16635
16456
  console.log(t("cli.base_url"), config.provider.baseUrl);
16636
16457
  });
16637
16458
  provider.command("use").argument("<name>", "Provider name").description(t("cli.set_provider")).action(async (name) => {
16638
- const configPath = join28(homedir13(), ".mma", "config.json");
16459
+ const configPath = join27(homedir13(), ".mma", "config.json");
16639
16460
  const { config } = await bootstrap();
16640
16461
  config.provider.type = name;
16641
16462
  saveConfig(config, configPath);
@@ -16687,8 +16508,8 @@ init_bootstrap();
16687
16508
  // src/cli/repl.ts
16688
16509
  init_colors();
16689
16510
  import * as readline3 from "readline";
16690
- import { existsSync as existsSync35, readFileSync as readFileSync22, writeFileSync as writeFileSync14 } from "fs";
16691
- import { join as join29, dirname as dirname9 } from "path";
16511
+ import { existsSync as existsSync34, readFileSync as readFileSync22, writeFileSync as writeFileSync14 } from "fs";
16512
+ import { join as join28, dirname as dirname9 } from "path";
16692
16513
  import { homedir as homedir14 } from "os";
16693
16514
  import { fileURLToPath as fileURLToPath2 } from "url";
16694
16515
 
@@ -17138,11 +16959,11 @@ init_config();
17138
16959
  function readVersion2() {
17139
16960
  const here = dirname9(fileURLToPath2(import.meta.url));
17140
16961
  const candidates = [
17141
- join29(here, "..", "..", "package.json"),
17142
- join29(here, "..", "package.json")
16962
+ join28(here, "..", "..", "package.json"),
16963
+ join28(here, "..", "package.json")
17143
16964
  ];
17144
16965
  for (const p of candidates) {
17145
- if (existsSync35(p)) {
16966
+ if (existsSync34(p)) {
17146
16967
  const raw = JSON.parse(readFileSync22(p, "utf8"));
17147
16968
  if (raw.version)
17148
16969
  return raw.version;
@@ -17207,10 +17028,10 @@ class Repl {
17207
17028
  this.sessionManager = sessionManager;
17208
17029
  this.skillsModule = skillsModule;
17209
17030
  this.pluginManager = pluginManager;
17210
- this.configDir = configDir || join29(homedir14(), ".mma");
17031
+ this.configDir = configDir || join28(homedir14(), ".mma");
17211
17032
  this.baseDir = baseDir || process.cwd();
17212
17033
  this.noAgentsMd = noAgentsMd === true;
17213
- this.historyPath = join29(homedir14(), ".mma", "repl-history");
17034
+ this.historyPath = join28(homedir14(), ".mma", "repl-history");
17214
17035
  this.loadHistory();
17215
17036
  this.registerBuiltinCommands();
17216
17037
  this.registerMmaCommands();
@@ -17234,7 +17055,7 @@ class Repl {
17234
17055
  this.setupListeners();
17235
17056
  }
17236
17057
  loadHistory() {
17237
- if (existsSync35(this.historyPath)) {
17058
+ if (existsSync34(this.historyPath)) {
17238
17059
  try {
17239
17060
  const raw = readFileSync22(this.historyPath, "utf-8");
17240
17061
  this.history = raw.split(`
@@ -17299,7 +17120,7 @@ class Repl {
17299
17120
  }
17300
17121
  try {
17301
17122
  const { loadFileAsDataUrl: loadFileAsDataUrl2, loadUrlAsDataUrl: loadUrlAsDataUrl2, readClipboardImage: readClipboardImage2 } = await Promise.resolve().then(() => (init_image_utils(), exports_image_utils));
17302
- const { existsSync: existsSync36 } = await import("fs");
17123
+ const { existsSync: existsSync35 } = await import("fs");
17303
17124
  const { resolve: resolve16 } = await import("path");
17304
17125
  let dataUrl;
17305
17126
  let label;
@@ -17319,7 +17140,7 @@ class Repl {
17319
17140
  label = source;
17320
17141
  } else {
17321
17142
  const absPath = resolve16(process.cwd(), source);
17322
- if (!existsSync36(absPath)) {
17143
+ if (!existsSync35(absPath)) {
17323
17144
  console.log(pc.red(t("image.not_found", { path: source })));
17324
17145
  return;
17325
17146
  }
@@ -17396,7 +17217,7 @@ class Repl {
17396
17217
  action: async () => {
17397
17218
  console.log(pc.yellow(t("repl.wizard_running")));
17398
17219
  const answers = await runSetup();
17399
- const configPath = join29(homedir14(), ".mma", "config.json");
17220
+ const configPath = join28(homedir14(), ".mma", "config.json");
17400
17221
  this.config.provider.type = answers.provider;
17401
17222
  this.config.provider.baseUrl = answers.apiBase;
17402
17223
  this.config.provider.apiKey = answers.apiKey;
@@ -17426,7 +17247,7 @@ class Repl {
17426
17247
  return;
17427
17248
  }
17428
17249
  this.config.provider.type = name;
17429
- const configPath = join29(homedir14(), ".mma", "config.json");
17250
+ const configPath = join28(homedir14(), ".mma", "config.json");
17430
17251
  saveConfig(this.config, configPath);
17431
17252
  console.log(pc.green(t("repl.provider_set", { name })));
17432
17253
  return;
@@ -17478,7 +17299,7 @@ class Repl {
17478
17299
  return;
17479
17300
  }
17480
17301
  this.config.model = name;
17481
- const configPath = join29(homedir14(), ".mma", "config.json");
17302
+ const configPath = join28(homedir14(), ".mma", "config.json");
17482
17303
  saveConfig(this.config, configPath);
17483
17304
  console.log(pc.green(t("repl.model_set", { name })));
17484
17305
  return;
@@ -17502,7 +17323,7 @@ class Repl {
17502
17323
  return;
17503
17324
  }
17504
17325
  this.config.contextWindow = size;
17505
- const configPath = join29(homedir14(), ".mma", "config.json");
17326
+ const configPath = join28(homedir14(), ".mma", "config.json");
17506
17327
  saveConfig(this.config, configPath);
17507
17328
  console.log(pc.green(t("cli.context_set", { size })));
17508
17329
  }
@@ -17520,9 +17341,9 @@ class Repl {
17520
17341
  this.agent.shutdown();
17521
17342
  const { loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_config(), exports_config));
17522
17343
  const { homedir: homedir15 } = await import("os");
17523
- const { join: join30 } = await import("path");
17524
- const configDir = join30(homedir15(), ".mma");
17525
- const projectConfigPath = join30(process.cwd(), ".mmrc");
17344
+ const { join: join29 } = await import("path");
17345
+ const configDir = join29(homedir15(), ".mma");
17346
+ const projectConfigPath = join29(process.cwd(), ".mmrc");
17526
17347
  const freshConfig = loadConfig2({ configDir, projectConfigPath });
17527
17348
  Object.assign(this.config, freshConfig);
17528
17349
  const { bootstrap: bootstrap2 } = await Promise.resolve().then(() => (init_bootstrap(), exports_bootstrap));
@@ -18056,11 +17877,11 @@ ${t("image.attached", { source: "clipboard", size: `${sizeKb} KB` })}`));
18056
17877
  row(t("repl.agents_label"), pc.red(t("repl.disabled")));
18057
17878
  } else {
18058
17879
  const agentsMdCandidates = [
18059
- join29(this.baseDir, "AGENTS.md"),
18060
- join29(this.baseDir, ".mma", "AGENTS.md"),
18061
- join29(this.configDir, "AGENTS.md")
17880
+ join28(this.baseDir, "AGENTS.md"),
17881
+ join28(this.baseDir, ".mma", "AGENTS.md"),
17882
+ join28(this.configDir, "AGENTS.md")
18062
17883
  ];
18063
- const foundAgents = agentsMdCandidates.filter((p) => existsSync35(p));
17884
+ const foundAgents = agentsMdCandidates.filter((p) => existsSync34(p));
18064
17885
  if (foundAgents.length > 0) {
18065
17886
  for (const p of foundAgents) {
18066
17887
  row(t("repl.agents_label"), pc.dim(p));
@@ -18071,7 +17892,7 @@ ${t("image.attached", { source: "clipboard", size: `${sizeKb} KB` })}`));
18071
17892
  }
18072
17893
  const meta = this.sessionManager?.getActiveMeta();
18073
17894
  if (meta) {
18074
- const sessionPath = join29(this.configDir, "sessions", meta.id);
17895
+ const sessionPath = join28(this.configDir, "sessions", meta.id);
18075
17896
  row(t("repl.session_label"), `${pc.cyan(meta.name)} ${pc.dim(`(${meta.id.slice(0, 12)})`)} — ${meta.messageCount} msgs ${pc.dim(sessionPath)}`);
18076
17897
  }
18077
17898
  const headerWidth = Math.max(50, Math.min(96, process.stdout.columns || 96));
@@ -18096,8 +17917,8 @@ ${t("image.attached", { source: "clipboard", size: `${sizeKb} KB` })}`));
18096
17917
  init_config();
18097
17918
  init_i18n();
18098
17919
  init_colors();
18099
- import { existsSync as existsSync36 } from "fs";
18100
- import { join as join30 } from "path";
17920
+ import { existsSync as existsSync35 } from "fs";
17921
+ import { join as join29 } from "path";
18101
17922
  import { homedir as homedir15 } from "os";
18102
17923
  async function main() {
18103
17924
  const program2 = createProgram();
@@ -18161,8 +17982,8 @@ async function main() {
18161
17982
  }
18162
17983
  agent.shutdown();
18163
17984
  } else {
18164
- const configPath = join30(homedir15(), ".mma", "config.json");
18165
- if (!existsSync36(configPath)) {
17985
+ const configPath = join29(homedir15(), ".mma", "config.json");
17986
+ if (!existsSync35(configPath)) {
18166
17987
  console.log(pc.yellow(`
18167
17988
  ` + t("cli.first_run") + `
18168
17989
  `));