micro-models-agent 0.28.0 → 0.28.1

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 (167) hide show
  1. package/dist/main.js +314 -208
  2. package/package.json +1 -1
  3. package/dist/cli/commands.js +0 -220
  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 -987
  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 -461
  18. package/dist/core/bootstrap.js +0 -321
  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/history.js +0 -15
  49. package/dist/modules/context/index.js +0 -1
  50. package/dist/modules/context/manager.js +0 -240
  51. package/dist/modules/execution/auditor.js +0 -72
  52. package/dist/modules/execution/index.js +0 -6
  53. package/dist/modules/execution/module.js +0 -337
  54. package/dist/modules/execution/moe-executor.js +0 -209
  55. package/dist/modules/execution/plan-validator.js +0 -153
  56. package/dist/modules/execution/planner.js +0 -35
  57. package/dist/modules/execution/stuck-detector.js +0 -134
  58. package/dist/modules/execution/tracker.js +0 -53
  59. package/dist/modules/execution/types.js +0 -1
  60. package/dist/modules/execution/verifier.js +0 -149
  61. package/dist/modules/hallucination/confidence.js +0 -54
  62. package/dist/modules/hallucination/consistency.js +0 -60
  63. package/dist/modules/hallucination/detector.js +0 -41
  64. package/dist/modules/hallucination/factual.js +0 -170
  65. package/dist/modules/hallucination/index.js +0 -4
  66. package/dist/modules/index.js +0 -5
  67. package/dist/modules/indexer/cache.js +0 -38
  68. package/dist/modules/indexer/index.js +0 -3
  69. package/dist/modules/indexer/module.js +0 -192
  70. package/dist/modules/indexer/walker.js +0 -101
  71. package/dist/modules/mcp/client.js +0 -393
  72. package/dist/modules/mcp/index.js +0 -3
  73. package/dist/modules/mcp/module.js +0 -146
  74. package/dist/modules/mcp/registry.js +0 -15
  75. package/dist/modules/memory/index.js +0 -1
  76. package/dist/modules/memory/module.js +0 -48
  77. package/dist/modules/memory/search.js +0 -40
  78. package/dist/modules/memory/store.js +0 -65
  79. package/dist/modules/pipelines/engine.js +0 -60
  80. package/dist/modules/pipelines/index.js +0 -3
  81. package/dist/modules/pipelines/parser.js +0 -53
  82. package/dist/modules/pipelines/template.js +0 -14
  83. package/dist/modules/plugins/builtin/lint-on-write.js +0 -121
  84. package/dist/modules/plugins/builtin/notify.js +0 -8
  85. package/dist/modules/plugins/index.js +0 -1
  86. package/dist/modules/plugins/loader.js +0 -28
  87. package/dist/modules/plugins/manager.js +0 -161
  88. package/dist/modules/plugins/types.js +0 -1
  89. package/dist/modules/processes/detect.js +0 -34
  90. package/dist/modules/processes/index.js +0 -3
  91. package/dist/modules/processes/registry.js +0 -148
  92. package/dist/modules/processes/runner.js +0 -124
  93. package/dist/modules/registry.js +0 -45
  94. package/dist/modules/security/audit-log.js +0 -116
  95. package/dist/modules/security/audit-notifier.js +0 -292
  96. package/dist/modules/security/command-validator.js +0 -185
  97. package/dist/modules/security/content-scanner.js +0 -52
  98. package/dist/modules/security/data-sanitizer.js +0 -97
  99. package/dist/modules/security/encryption.js +0 -240
  100. package/dist/modules/security/index.js +0 -14
  101. package/dist/modules/security/network-validator.js +0 -79
  102. package/dist/modules/security/path-validator.js +0 -155
  103. package/dist/modules/security/rate-limiter.js +0 -119
  104. package/dist/modules/security/security-policies.js +0 -393
  105. package/dist/modules/security/session-encryption.js +0 -193
  106. package/dist/modules/security/session-isolation.js +0 -95
  107. package/dist/modules/session/index.js +0 -3
  108. package/dist/modules/session/manager.js +0 -167
  109. package/dist/modules/session/module.js +0 -24
  110. package/dist/modules/session/store.js +0 -174
  111. package/dist/modules/session/types.js +0 -1
  112. package/dist/modules/skills/index.js +0 -3
  113. package/dist/modules/skills/loader.js +0 -72
  114. package/dist/modules/skills/matcher.js +0 -27
  115. package/dist/modules/skills/module.js +0 -143
  116. package/dist/modules/types.js +0 -1
  117. package/dist/modules/updater/checker.js +0 -32
  118. package/dist/modules/updater/index.js +0 -1
  119. package/dist/modules/user-profile/compressor.js +0 -16
  120. package/dist/modules/user-profile/index.js +0 -1
  121. package/dist/modules/user-profile/profile.js +0 -68
  122. package/dist/tools/approve.js +0 -32
  123. package/dist/tools/attach-image.js +0 -89
  124. package/dist/tools/bash.js +0 -140
  125. package/dist/tools/browser.js +0 -97
  126. package/dist/tools/create-dir.js +0 -56
  127. package/dist/tools/delete-file.js +0 -63
  128. package/dist/tools/edit-file.js +0 -77
  129. package/dist/tools/executor.js +0 -95
  130. package/dist/tools/file-info.js +0 -45
  131. package/dist/tools/filter-tools.js +0 -10
  132. package/dist/tools/glob-tool.js +0 -26
  133. package/dist/tools/grep-tool.js +0 -64
  134. package/dist/tools/index.js +0 -52
  135. package/dist/tools/list-dir.js +0 -47
  136. package/dist/tools/load-skill.js +0 -48
  137. package/dist/tools/mcp-call.js +0 -68
  138. package/dist/tools/move-file.js +0 -84
  139. package/dist/tools/path-utils.js +0 -51
  140. package/dist/tools/pipeline-run.js +0 -144
  141. package/dist/tools/preview.js +0 -2
  142. package/dist/tools/process-kill.js +0 -29
  143. package/dist/tools/process-list.js +0 -38
  144. package/dist/tools/process-log.js +0 -41
  145. package/dist/tools/question.js +0 -142
  146. package/dist/tools/read-file.js +0 -73
  147. package/dist/tools/recall.js +0 -110
  148. package/dist/tools/registry.js +0 -36
  149. package/dist/tools/remember.js +0 -67
  150. package/dist/tools/scope-check.js +0 -30
  151. package/dist/tools/search-history.js +0 -64
  152. package/dist/tools/subagent.js +0 -142
  153. package/dist/tools/types.js +0 -1
  154. package/dist/tools/user-input.js +0 -123
  155. package/dist/tools/web-browse.js +0 -57
  156. package/dist/tools/web-fetch.js +0 -72
  157. package/dist/tools/web-search.js +0 -59
  158. package/dist/tools/write-file.js +0 -80
  159. package/dist/ui/box.js +0 -81
  160. package/dist/ui/colors.js +0 -4
  161. package/dist/ui/diff.js +0 -185
  162. package/dist/ui/index.js +0 -6
  163. package/dist/ui/md-formatter.js +0 -212
  164. package/dist/ui/output.js +0 -13
  165. package/dist/ui/renderer.js +0 -141
  166. package/dist/ui/spinner.js +0 -70
  167. package/dist/ui/table.js +0 -144
package/dist/main.js CHANGED
@@ -2418,6 +2418,7 @@ Command: {command}`,
2418
2418
  "plan.step_marked": "Step {step} marked as {status}",
2419
2419
  "plan.aborted": "Plan aborted",
2420
2420
  "plan.unknown_action": "Unknown plan action: {action}",
2421
+ "plan.updated": "Plan updated: {title} ({steps} steps)",
2421
2422
  "plan.acknowledged": "Plan {action}: acknowledged",
2422
2423
  "plan.step_status": "Step {step}: {status}",
2423
2424
  "plan.no_active": "No active plan",
@@ -2962,6 +2963,7 @@ var init_ru = __esm(() => {
2962
2963
  "plan.step_marked": "Шаг {step} отмечен как {status}",
2963
2964
  "plan.aborted": "План отменён",
2964
2965
  "plan.unknown_action": "Неизвестное действие плана: {action}",
2966
+ "plan.updated": "План обновлён: {title} ({steps} шагов)",
2965
2967
  "plan.acknowledged": "План {action}: принято",
2966
2968
  "plan.step_status": "Шаг {step}: {status}",
2967
2969
  "plan.no_active": "Нет активного плана",
@@ -3351,7 +3353,10 @@ function flatten(obj, prefix = "") {
3351
3353
  if (typeof val === "string") {
3352
3354
  result[fullKey] = val;
3353
3355
  } else if (typeof val === "object" && val !== null) {
3354
- result = { ...result, ...flatten(val, fullKey) };
3356
+ result = {
3357
+ ...result,
3358
+ ...flatten(val, fullKey)
3359
+ };
3355
3360
  }
3356
3361
  }
3357
3362
  return result;
@@ -3364,7 +3369,7 @@ function setLocale(locale) {
3364
3369
  function t(key, params) {
3365
3370
  const localeDict = flat[currentLocale];
3366
3371
  const enDict = flat["en"];
3367
- let template = localeDict?.[key] || enDict?.[key];
3372
+ let template = localeDict?.[key] ?? enDict?.[key] ?? key;
3368
3373
  if (!template)
3369
3374
  return key;
3370
3375
  if (params) {
@@ -3686,7 +3691,13 @@ __export(exports_config, {
3686
3691
  saveConfig: () => saveConfig,
3687
3692
  loadConfig: () => loadConfig
3688
3693
  });
3689
- import { existsSync as existsSync4, readFileSync as readFileSync3, unlinkSync, writeFileSync as writeFileSync3, mkdirSync as mkdirSync2 } from "fs";
3694
+ import {
3695
+ existsSync as existsSync4,
3696
+ readFileSync as readFileSync3,
3697
+ unlinkSync,
3698
+ writeFileSync as writeFileSync3,
3699
+ mkdirSync as mkdirSync2
3700
+ } from "fs";
3690
3701
  import { join as join4, dirname } from "path";
3691
3702
  function restoreDangerousPatterns(patterns, defaults) {
3692
3703
  const fallback = Array.isArray(defaults) ? defaults : [];
@@ -3760,12 +3771,21 @@ function applyEnvVars(config) {
3760
3771
  result.logLevel = env.MMA_LOG_LEVEL;
3761
3772
  if (env.MMA_LOCALE)
3762
3773
  result.locale = env.MMA_LOCALE;
3763
- if (env.MMA_CONTEXT_WINDOW)
3764
- result.contextWindow = parseInt(env.MMA_CONTEXT_WINDOW, 10);
3765
- if (env.MMA_MAX_TOOL_ITERATIONS)
3766
- result.maxToolIterations = parseInt(env.MMA_MAX_TOOL_ITERATIONS, 10);
3767
- if (env.MMA_STUCK_THRESHOLD)
3768
- result.stuckThreshold = parseInt(env.MMA_STUCK_THRESHOLD, 10);
3774
+ if (env.MMA_CONTEXT_WINDOW) {
3775
+ const v = parseInt(env.MMA_CONTEXT_WINDOW, 10);
3776
+ if (!isNaN(v))
3777
+ result.contextWindow = v;
3778
+ }
3779
+ if (env.MMA_MAX_TOOL_ITERATIONS) {
3780
+ const v = parseInt(env.MMA_MAX_TOOL_ITERATIONS, 10);
3781
+ if (!isNaN(v))
3782
+ result.maxToolIterations = v;
3783
+ }
3784
+ if (env.MMA_STUCK_THRESHOLD) {
3785
+ const v = parseInt(env.MMA_STUCK_THRESHOLD, 10);
3786
+ if (!isNaN(v))
3787
+ result.stuckThreshold = v;
3788
+ }
3769
3789
  if (env.MMA_AUTO_PLAN)
3770
3790
  result.autoPlan = env.MMA_AUTO_PLAN === "true";
3771
3791
  if (env.MMA_MOE_ENABLED)
@@ -3825,7 +3845,9 @@ function saveConfig(config, configPath) {
3825
3845
  mkdirSync2(dir, { recursive: true });
3826
3846
  try {
3827
3847
  const encryptor = new ConfigEncryptor;
3828
- const encryptedConfig = encryptor.encrypt({ ...config });
3848
+ const encryptedConfig = encryptor.encrypt({
3849
+ ...config
3850
+ });
3829
3851
  writeFileSync3(configPath, JSON.stringify(encryptedConfig, regexReplacer, 2), "utf-8");
3830
3852
  } catch (e) {
3831
3853
  console.warn(t("config.encryption_warning", { error: e.message }));
@@ -4569,7 +4591,18 @@ class OpenAICompatProvider {
4569
4591
  const controller = new AbortController;
4570
4592
  const totalTimeoutMs = 120000;
4571
4593
  const timeoutId = setTimeout(() => controller.abort(), totalTimeoutMs);
4572
- const abortSignal = signal ? AbortSignal.any([controller.signal, signal]) : controller.signal;
4594
+ const abortSignal = (() => {
4595
+ if (!signal)
4596
+ return controller.signal;
4597
+ try {
4598
+ return AbortSignal.any([controller.signal, signal]);
4599
+ } catch {
4600
+ signal.addEventListener("abort", () => controller.abort(), {
4601
+ once: true
4602
+ });
4603
+ return controller.signal;
4604
+ }
4605
+ })();
4573
4606
  const response = await this.fetchWithRetry(`${this.config.baseUrl}/chat/completions`, {
4574
4607
  method: "POST",
4575
4608
  headers,
@@ -5994,14 +6027,13 @@ function generateDiff(oldContent, newContent) {
5994
6027
  `);
5995
6028
  const newLines = newContent.split(`
5996
6029
  `);
5997
- if (oldLines.length === 1 && oldLines[0] === "" && newLines.length === 1 && newLines[0] === "") {
5998
- return "";
5999
- }
6000
6030
  const diff = buildDiff(oldLines, newLines);
6001
6031
  if (diff.length === 0)
6002
6032
  return "";
6003
- const maxOldNum = Math.max(...diff.filter((l) => l.oldNum !== null).map((l) => l.oldNum));
6004
- const maxNewNum = Math.max(...diff.filter((l) => l.newNum !== null).map((l) => l.newNum));
6033
+ const oldNums = diff.filter((l) => l.oldNum !== null).map((l) => l.oldNum);
6034
+ const newNums = diff.filter((l) => l.newNum !== null).map((l) => l.newNum);
6035
+ const maxOldNum = oldNums.length > 0 ? Math.max(...oldNums) : 0;
6036
+ const maxNewNum = newNums.length > 0 ? Math.max(...newNums) : 0;
6005
6037
  const maxNumWidth = Math.max(String(maxOldNum).length, String(maxNewNum).length, 3);
6006
6038
  let lines = diff.map((l) => formatLine(l, maxNumWidth));
6007
6039
  if (lines.length > MAX_DIFF_LINES) {
@@ -6049,10 +6081,7 @@ function generateDeleteDiff(content) {
6049
6081
  `);
6050
6082
  }
6051
6083
  function generateMoveDiff(fromPath, toPath) {
6052
- return [
6053
- pc.red(` - ${fromPath}`),
6054
- pc.green(` + ${toPath}`)
6055
- ].join(`
6084
+ return [pc.red(` - ${fromPath}`), pc.green(` + ${toPath}`)].join(`
6056
6085
  `);
6057
6086
  }
6058
6087
  var CONTEXT_LINES = 3, MAX_DIFF_LINES = 100;
@@ -6239,7 +6268,7 @@ var init_glob_tool = __esm(() => {
6239
6268
  });
6240
6269
 
6241
6270
  // src/tools/grep-tool.ts
6242
- import { execFileSync, execSync } from "child_process";
6271
+ import { execFileSync } from "child_process";
6243
6272
  import { resolve as resolve7 } from "path";
6244
6273
  function truncateLines(output) {
6245
6274
  const lines = output.split(`
@@ -6262,8 +6291,14 @@ var init_grep_tool = __esm(() => {
6262
6291
  type: "object",
6263
6292
  properties: {
6264
6293
  pattern: { type: "string", description: "Regex pattern to search" },
6265
- include: { type: "string", description: "File pattern to filter (e.g. *.ts)" },
6266
- path: { type: "string", description: "Directory to search (defaults to baseDir)" }
6294
+ include: {
6295
+ type: "string",
6296
+ description: "File pattern to filter (e.g. *.ts)"
6297
+ },
6298
+ path: {
6299
+ type: "string",
6300
+ description: "Directory to search (defaults to baseDir)"
6301
+ }
6267
6302
  },
6268
6303
  required: ["pattern"]
6269
6304
  },
@@ -6281,22 +6316,34 @@ var init_grep_tool = __esm(() => {
6281
6316
  maxBuffer: 1024 * 1024,
6282
6317
  cwd: ctx.baseDir
6283
6318
  });
6284
- return { success: true, output: truncateLines(output || t("file.no_matches")) };
6319
+ return {
6320
+ success: true,
6321
+ output: truncateLines(output || t("file.no_matches"))
6322
+ };
6285
6323
  } catch (e) {
6286
6324
  if (e.status === 1)
6287
6325
  return { success: true, output: t("file.no_matches") };
6288
6326
  try {
6289
- const cmd = `grep -rn "${pattern.replace(/"/g, "\\\"")}" "${searchPath}"`;
6290
- const output = execSync(cmd, {
6327
+ const grepArgs = ["-rn", pattern, searchPath];
6328
+ if (args.include) {
6329
+ grepArgs.push("--include", String(args.include));
6330
+ }
6331
+ const output = execFileSync("grep", grepArgs, {
6291
6332
  encoding: "utf-8",
6292
6333
  maxBuffer: 1024 * 1024,
6293
6334
  cwd: ctx.baseDir
6294
6335
  });
6295
- return { success: true, output: truncateLines(output || t("file.no_matches")) };
6336
+ return {
6337
+ success: true,
6338
+ output: truncateLines(output || t("file.no_matches"))
6339
+ };
6296
6340
  } catch (e2) {
6297
6341
  if (e2.status === 1)
6298
6342
  return { success: true, output: t("file.no_matches") };
6299
- return { success: false, output: t("error.grep_failed", { message: e2.message }) };
6343
+ return {
6344
+ success: false,
6345
+ output: t("error.grep_failed", { message: e2.message })
6346
+ };
6300
6347
  }
6301
6348
  }
6302
6349
  }
@@ -6476,6 +6523,7 @@ var init_move_file = __esm(() => {
6476
6523
  init_audit_log();
6477
6524
  init_session_isolation();
6478
6525
  init_diff();
6526
+ init_path_utils();
6479
6527
  moveFileTool = {
6480
6528
  name: "move_file",
6481
6529
  description: "Move or rename a file or directory.",
@@ -6492,8 +6540,8 @@ var init_move_file = __esm(() => {
6492
6540
  const fromPath = String(args.from);
6493
6541
  const toPath = String(args.to);
6494
6542
  const baseDir = resolve9(ctx.baseDir);
6495
- const fromResolved = resolve9(baseDir, normalize3(fromPath));
6496
- const toResolved = resolve9(baseDir, normalize3(toPath));
6543
+ const fromResolved = safeResolvePath(baseDir, normalize3(fromPath));
6544
+ const toResolved = safeResolvePath(baseDir, normalize3(toPath));
6497
6545
  const securityConfig = ctx.sessionContext ? getSessionSecurityConfig(ctx.config, ctx.sessionContext) : ctx.config.security;
6498
6546
  const maxFileOps = securityConfig?.maxFileOperations ?? 100;
6499
6547
  const currentCount = ctx.fileOperationsCount ?? 0;
@@ -6810,7 +6858,19 @@ class ProcessRegistry {
6810
6858
  }
6811
6859
  this.children.set(id, child);
6812
6860
  entry.pid = child.pid ?? 0;
6813
- const decoder = platform() === "win32" ? new TextDecoder("ibm866") : null;
6861
+ const decoder = platform() === "win32" ? (() => {
6862
+ try {
6863
+ const cpOut = __require("child_process").execSync("chcp.com", {
6864
+ encoding: "utf-8",
6865
+ timeout: 2000,
6866
+ windowsHide: true
6867
+ }).toString();
6868
+ const m = cpOut.match(/(\d+)/);
6869
+ if (m)
6870
+ return new TextDecoder("ibm" + m[1]);
6871
+ } catch {}
6872
+ return null;
6873
+ })() : null;
6814
6874
  let buf = "";
6815
6875
  const pushLine = (line) => {
6816
6876
  if (entry.log.length >= MAX_LOG_LINES) {
@@ -8824,22 +8884,6 @@ class StuckDetector {
8824
8884
  }
8825
8885
  return "";
8826
8886
  }
8827
- checkOffTrack(toolName, call) {
8828
- if (!this.currentStepDescription)
8829
- return null;
8830
- const toolArgStr = JSON.stringify(call.arguments).toLowerCase();
8831
- const pathInStep = (this.currentStepDescription.match(/\b[\w./-]+\.[a-z]+/gi) || []).map((p) => p.toLowerCase());
8832
- const pathInCall = (toolArgStr.match(/\b[\w./-]+\.[a-z]+/gi) || []).map((p) => p.toLowerCase());
8833
- const overlaps = pathInCall.some((p) => pathInStep.some((s) => p.includes(s) || s.includes(p)));
8834
- if (!overlaps && pathInStep.length > 0 && pathInCall.length > 0) {
8835
- return t("exec.off_track", {
8836
- stepId: String(this.currentStepId),
8837
- description: this.currentStepDescription,
8838
- tool: toolName
8839
- });
8840
- }
8841
- return null;
8842
- }
8843
8887
  reset() {
8844
8888
  this.currentStepId = null;
8845
8889
  this.iterationsOnCurrentStep = 0;
@@ -9401,18 +9445,29 @@ async function runWithMoE(deps, input, fallback, opts = {}) {
9401
9445
  ];
9402
9446
  const verification = await verifier.verifyMoEManifest(plan, config, knownTags);
9403
9447
  onPhase?.("thinking");
9404
- const verifyResult = await orchestrator.verifyAndMerge({
9405
- plan,
9406
- results: planResults.results.map((r) => ({
9407
- subtaskId: r.subtaskId,
9408
- success: r.success,
9409
- summary: r.summary,
9410
- result: r.result,
9411
- error: r.error
9412
- })),
9413
- verifierErrors: verification.errors,
9414
- verifierWarnings: verification.warnings
9415
- });
9448
+ let verifyResult;
9449
+ try {
9450
+ verifyResult = await orchestrator.verifyAndMerge({
9451
+ plan,
9452
+ results: planResults.results.map((r) => ({
9453
+ subtaskId: r.subtaskId,
9454
+ success: r.success,
9455
+ summary: r.summary,
9456
+ result: r.result,
9457
+ error: r.error
9458
+ })),
9459
+ verifierErrors: verification.errors,
9460
+ verifierWarnings: verification.warnings
9461
+ });
9462
+ } catch (err) {
9463
+ onPhase?.("done");
9464
+ return {
9465
+ success: false,
9466
+ text: `MoE verifyAndMerge crashed: ${err.message}`,
9467
+ error: err.message,
9468
+ iterationCount: 0
9469
+ };
9470
+ }
9416
9471
  onPhase?.("done");
9417
9472
  const outputLines = [`## MoE Execution Results
9418
9473
  `];
@@ -10120,6 +10175,7 @@ ${taskReminder}</system-summary>`
10120
10175
  });
10121
10176
  this.deps.llmProvider = newProvider;
10122
10177
  this.deps.toolExecutor.updateProvider(newProvider);
10178
+ this.deps.toolExecutor.ctx.llmProvider = newProvider;
10123
10179
  const newTokenCounter = new TokenCounter2(config.model);
10124
10180
  this.deps.contextManager.resize(config.contextWindow, config.contextBudget, newTokenCounter);
10125
10181
  this.deps.config = config;
@@ -10342,6 +10398,7 @@ class ContextManager {
10342
10398
  return totalTokens > this.budget.history * this.compactionThreshold;
10343
10399
  }
10344
10400
  compact() {
10401
+ this.iterationsSinceCompaction = 0;
10345
10402
  if (this.messages.length <= KEEP_LAST_N * 2)
10346
10403
  return;
10347
10404
  this.compactionCount++;
@@ -10360,7 +10417,7 @@ class ContextManager {
10360
10417
  if (this.errorFacts.length > 0) {
10361
10418
  parts.push(`[Errors: ${this.errorFacts.slice(-3).join("; ")}]`);
10362
10419
  }
10363
- const triedAndFailed = extractTriedAndFailed(this.messages);
10420
+ const triedAndFailed = extractTriedAndFailed(oldTurns);
10364
10421
  if (triedAndFailed.length > 0) {
10365
10422
  const lines = triedAndFailed.map((t2) => `- ${t2.tool}(${t2.args}): ${t2.error} (failed ${t2.count}x)`);
10366
10423
  parts.push(`[Already tried & failed — do NOT repeat:]
@@ -10996,6 +11053,8 @@ var init_subagent = __esm(() => {
10996
11053
  const subContextManager = new ContextManager(ctx.config.contextWindow, ctx.config.contextBudget);
10997
11054
  const subPluginManager = new PluginManager;
10998
11055
  const hallucinationDetector = new HallucinationDetector(ctx.baseDir, ctx.llmProvider);
11056
+ const parentScope = ctx.scope;
11057
+ ctx.toolExecutor.setScope(scope || { allowed_files: [], read_only_files: [] });
10999
11058
  const systemPrompt = {
11000
11059
  content: `You are a sub-agent working on a specific task. ${context ? `Context: ${context}` : ""}`,
11001
11060
  priority: "critical",
@@ -11020,21 +11079,24 @@ var init_subagent = __esm(() => {
11020
11079
  const fullTask = context ? `${task}
11021
11080
 
11022
11081
  Context: ${context}` : task;
11023
- const result = await subAgent.run(fullTask);
11024
- if (result.success) {
11025
- return {
11082
+ let scopeRestored = false;
11083
+ try {
11084
+ const result = await subAgent.run(fullTask);
11085
+ return result.success ? {
11026
11086
  success: true,
11027
11087
  output: `Sub-agent completed:
11028
11088
  ${result.text}
11029
11089
 
11030
11090
  Iterations: ${result.iterationCount}`
11031
- };
11032
- } else {
11033
- return {
11091
+ } : {
11034
11092
  success: false,
11035
11093
  output: `Sub-agent failed: ${result.error}
11036
11094
  Partial output: ${result.text}`
11037
11095
  };
11096
+ } finally {
11097
+ if (!scopeRestored) {
11098
+ ctx.toolExecutor.setScope(parentScope || { allowed_files: [], read_only_files: [] });
11099
+ }
11038
11100
  }
11039
11101
  } catch (e) {
11040
11102
  return { success: false, output: `Sub-agent error: ${e.message}` };
@@ -11756,19 +11818,25 @@ class MCPClient {
11756
11818
  env: { ...process.env, ...this.config.env },
11757
11819
  stdio: ["pipe", "pipe", "pipe"]
11758
11820
  });
11821
+ let _resolved = false;
11759
11822
  child.on("error", (err) => {
11760
11823
  this._connected = false;
11761
- reject(err);
11824
+ if (!_resolved) {
11825
+ _resolved = true;
11826
+ reject(err);
11827
+ }
11762
11828
  });
11763
11829
  child.on("exit", (code) => {
11764
11830
  this._connected = false;
11765
- if (code !== 0) {
11831
+ if (code !== 0 && !_resolved) {
11832
+ _resolved = true;
11766
11833
  reject(new Error(`MCP server exited with code ${code}`));
11767
11834
  }
11768
11835
  });
11769
11836
  child.on("spawn", () => {
11770
11837
  this._connected = true;
11771
11838
  this.process = child;
11839
+ _resolved = true;
11772
11840
  resolve12();
11773
11841
  });
11774
11842
  });
@@ -12154,8 +12222,14 @@ var init_search_history = __esm(() => {
12154
12222
  type: "object",
12155
12223
  properties: {
12156
12224
  query: { type: "string", description: "Search query" },
12157
- maxResults: { type: "number", description: "Maximum results (default 5)" },
12158
- sessionId: { type: "string", description: "Optional: limit search to a specific session" }
12225
+ maxResults: {
12226
+ type: "number",
12227
+ description: "Maximum results (default 5)"
12228
+ },
12229
+ sessionId: {
12230
+ type: "string",
12231
+ description: "Optional: limit search to a specific session"
12232
+ }
12159
12233
  },
12160
12234
  required: ["query"]
12161
12235
  },
@@ -12167,7 +12241,10 @@ var init_search_history = __esm(() => {
12167
12241
  const results = [];
12168
12242
  try {
12169
12243
  if (!fs.existsSync(sessionDir)) {
12170
- return { success: true, output: t("tool.no_sessions_dir", { dir: sessionDir }) };
12244
+ return {
12245
+ success: true,
12246
+ output: t("tool.no_sessions_dir", { dir: sessionDir })
12247
+ };
12171
12248
  }
12172
12249
  const entries = fs.readdirSync(sessionDir, { withFileTypes: true });
12173
12250
  for (const entry of entries) {
@@ -12183,10 +12260,19 @@ var init_search_history = __esm(() => {
12183
12260
  if (results.length === 0) {
12184
12261
  return { success: true, output: t("tool.no_history", { query }) };
12185
12262
  }
12186
- return { success: true, output: t("tool.history_results", { query, results: results.join(`
12187
- `) }) };
12263
+ return {
12264
+ success: true,
12265
+ output: t("tool.history_results", {
12266
+ query,
12267
+ results: results.join(`
12268
+ `)
12269
+ })
12270
+ };
12188
12271
  } catch (err) {
12189
- return { success: true, output: t("tool.history_error", { error: String(err) }) };
12272
+ return {
12273
+ success: false,
12274
+ output: t("tool.history_error", { error: String(err) })
12275
+ };
12190
12276
  }
12191
12277
  }
12192
12278
  };
@@ -13003,13 +13089,13 @@ async function readClipboardImage() {
13003
13089
  }
13004
13090
  async function readClipboardFallback() {
13005
13091
  const { platform: platform3 } = await import("os");
13006
- const { execSync: execSync2 } = await import("child_process");
13092
+ const { execSync } = await import("child_process");
13007
13093
  const { readFileSync: readFileSync13, unlinkSync: unlinkSync3 } = await import("fs");
13008
13094
  const { join: join16 } = await import("path");
13009
13095
  const tmpPath = join16(process.env.TEMP || process.env.TMP || "/tmp", `mma-clip-${Date.now()}.png`);
13010
13096
  try {
13011
13097
  if (platform3() === "linux") {
13012
- execSync2(`xclip -selection clipboard -t image/png -o > "${tmpPath}" 2>/dev/null`, { timeout: 5000 });
13098
+ execSync(`xclip -selection clipboard -t image/png -o > "${tmpPath}" 2>/dev/null`, { timeout: 5000 });
13013
13099
  } else {
13014
13100
  return null;
13015
13101
  }
@@ -13322,6 +13408,8 @@ import { resolve as resolve13, extname as extname4, join as join17 } from "path"
13322
13408
  class LintOnWritePlugin {
13323
13409
  name = "lint-on-write";
13324
13410
  priority = 10;
13411
+ _checkPromise = null;
13412
+ _checkTimestamp = 0;
13325
13413
  async onAfterTool(ctx, call, result) {
13326
13414
  if (call.name !== "write_file" && call.name !== "edit_file") {
13327
13415
  return;
@@ -13404,8 +13492,8 @@ class LintOnWritePlugin {
13404
13492
  return;
13405
13493
  }
13406
13494
  const now = Date.now();
13407
- if (projectTypeCheckPromise && now - projectTypeCheckTimestamp < TYPE_CHECK_DEBOUNCE_MS) {
13408
- const error2 = await projectTypeCheckPromise;
13495
+ if (this._checkPromise && now - this._checkTimestamp < TYPE_CHECK_DEBOUNCE_MS) {
13496
+ const error2 = await this._checkPromise;
13409
13497
  if (error2) {
13410
13498
  result.output += `
13411
13499
 
@@ -13413,9 +13501,9 @@ class LintOnWritePlugin {
13413
13501
  }
13414
13502
  return;
13415
13503
  }
13416
- projectTypeCheckTimestamp = now;
13417
- projectTypeCheckPromise = this.runTscCheck(ctx.baseDir);
13418
- const error = await projectTypeCheckPromise;
13504
+ this._checkTimestamp = now;
13505
+ this._checkPromise = this.runTscCheck(ctx.baseDir);
13506
+ const error = await this._checkPromise;
13419
13507
  if (error) {
13420
13508
  result.output += `
13421
13509
 
@@ -13478,7 +13566,7 @@ function runAsync(command, cwd, timeoutMs) {
13478
13566
  });
13479
13567
  });
13480
13568
  }
13481
- var projectTypeCheckPromise = null, projectTypeCheckTimestamp = 0, TYPE_CHECK_DEBOUNCE_MS = 2000, plugin;
13569
+ var TYPE_CHECK_DEBOUNCE_MS = 2000, plugin;
13482
13570
  var init_lint_on_write = __esm(() => {
13483
13571
  plugin = new LintOnWritePlugin;
13484
13572
  });
@@ -13530,7 +13618,7 @@ class PlanCreator {
13530
13618
  const stepCount = stepDescriptions.length;
13531
13619
  return {
13532
13620
  id: generatePlanId(),
13533
- title: `[${stepCount} ст.] ${title}`,
13621
+ title: `[${stepCount}] ${title}`,
13534
13622
  steps: stepDescriptions.map((desc, i) => ({
13535
13623
  id: i + 1,
13536
13624
  description: desc,
@@ -13777,8 +13865,7 @@ var init_plan_coverage = __esm(() => {
13777
13865
  "css",
13778
13866
  "scss",
13779
13867
  "less",
13780
- "html",
13781
- "jsx"
13868
+ "html"
13782
13869
  ]);
13783
13870
  });
13784
13871
 
@@ -13797,6 +13884,7 @@ class ExecutionModule {
13797
13884
  lastRecoveryIteration = -STUCK_RECOVERY_COOLDOWN;
13798
13885
  consecutivePlanWarnings = 0;
13799
13886
  lastStepId = -1;
13887
+ _auditSkipsRemaining = 0;
13800
13888
  constructor(baseDir, stuckThreshold = 8) {
13801
13889
  this.baseDir = baseDir;
13802
13890
  this.verifier = new StepVerifier(baseDir);
@@ -13807,6 +13895,7 @@ class ExecutionModule {
13807
13895
  setPlan(plan) {
13808
13896
  this.tracker = new PlanTracker(plan);
13809
13897
  this.persister.save(plan);
13898
+ this._auditSkipsRemaining = 0;
13810
13899
  }
13811
13900
  restorePlan() {
13812
13901
  const plan = this.persister.load();
@@ -13814,6 +13903,7 @@ class ExecutionModule {
13814
13903
  return false;
13815
13904
  this.tracker = new PlanTracker(plan);
13816
13905
  this.tracker.syncCurrentStep();
13906
+ this._auditSkipsRemaining = 1;
13817
13907
  return true;
13818
13908
  }
13819
13909
  getTracker() {
@@ -13825,6 +13915,10 @@ class ExecutionModule {
13825
13915
  async runFinalAudit() {
13826
13916
  if (!this.tracker)
13827
13917
  return null;
13918
+ if (this._auditSkipsRemaining > 0) {
13919
+ this._auditSkipsRemaining--;
13920
+ return null;
13921
+ }
13828
13922
  const plan = this.tracker.getPlan();
13829
13923
  const audit = await this.auditor.audit(plan);
13830
13924
  const pendingSteps = plan.steps.filter((s) => s.status !== "done" && s.status !== "skipped").map((s) => `${s.id}. ${s.description}`);
@@ -13888,7 +13982,10 @@ Write CONCRETE steps with exact file paths and commands:
13888
13982
  const plan = PlanCreator.createPlan(title, steps, this.baseDir);
13889
13983
  this.setPlan(plan);
13890
13984
  const display = PlanCreator.toPromptBlock(plan, 0);
13891
- let output = t("plan.created", { title, steps: String(steps.length) });
13985
+ let output = t("plan.created", {
13986
+ title,
13987
+ steps: String(steps.length)
13988
+ });
13892
13989
  let displayOut = display;
13893
13990
  const taskText = this.getTaskText(_ctx);
13894
13991
  if (taskText) {
@@ -13937,6 +14034,22 @@ ${progress}`,
13937
14034
  display
13938
14035
  };
13939
14036
  }
14037
+ if (action === "update" && Array.isArray(args.steps) && args.steps.length > 0 && this.tracker) {
14038
+ const title = String(args.title || this.tracker.getPlan().title);
14039
+ const steps = args.steps.map(String);
14040
+ const plan = PlanCreator.createPlan(title, steps, this.baseDir);
14041
+ this.setPlan(plan);
14042
+ const display = PlanCreator.toPromptBlock(plan, 0);
14043
+ const output = t("plan.updated", {
14044
+ title,
14045
+ steps: String(steps.length)
14046
+ });
14047
+ return {
14048
+ success: true,
14049
+ output,
14050
+ display
14051
+ };
14052
+ }
13940
14053
  if (action === "abort") {
13941
14054
  this.tracker = null;
13942
14055
  this.persister.clear();
@@ -13983,9 +14096,20 @@ ${progress}`,
13983
14096
  };
13984
14097
  }
13985
14098
  if (action === "done") {
14099
+ if (!currentStep) {
14100
+ return { success: false, output: t("plan.step_not_found") };
14101
+ }
14102
+ this.tracker.updateStepStatus(currentStep.id, "done");
14103
+ this.tracker.syncCurrentStep();
14104
+ this.persister.save(this.tracker.getPlan());
14105
+ const display = this.tracker.toPromptBlock();
13986
14106
  return {
13987
14107
  success: true,
13988
- output: t("todo.marked_done", { count: "1" })
14108
+ output: t("plan.step_status", {
14109
+ step: String(currentStep.id),
14110
+ status: "done"
14111
+ }),
14112
+ display
13989
14113
  };
13990
14114
  }
13991
14115
  if (action === "list") {
@@ -14073,8 +14197,10 @@ Tool "${this.stuckDetector.getLastFailedTool()}" is failing. Try "${alternative}
14073
14197
  }
14074
14198
  const hints = this.stuckDetector.getHints();
14075
14199
  if (hints.length > 0 && ctx.contextManager) {
14076
- const hintMsg = t("exec.hints", { hints: hints.map((h) => `- ${h}`).join(`
14077
- `) });
14200
+ const hintMsg = t("exec.hints", {
14201
+ hints: hints.map((h) => `- ${h}`).join(`
14202
+ `)
14203
+ });
14078
14204
  ctx.contextManager.addMessage({
14079
14205
  role: "user",
14080
14206
  content: `<system-summary>${hintMsg}</system-summary>`
@@ -14162,7 +14288,10 @@ Tool "${this.stuckDetector.getLastFailedTool()}" is failing. Try "${alternative}
14162
14288
  const file = this.stuckDetector.getExcessiveRewriteFile();
14163
14289
  const count = this.stuckDetector.getFileRewriteCount(file);
14164
14290
  if (ctx.onMeta) {
14165
- ctx.onMeta(t("exec.file_rewrite_warning", { file, count: String(count) }));
14291
+ ctx.onMeta(t("exec.file_rewrite_warning", {
14292
+ file,
14293
+ count: String(count)
14294
+ }));
14166
14295
  }
14167
14296
  }
14168
14297
  }
@@ -14439,6 +14568,7 @@ import { gzipSync } from "zlib";
14439
14568
  class SessionStore {
14440
14569
  baseDir;
14441
14570
  encryptor = null;
14571
+ _metaCache = new Map;
14442
14572
  constructor(baseDir, encryptionConfig) {
14443
14573
  this.baseDir = baseDir;
14444
14574
  if (encryptionConfig?.enabled) {
@@ -14474,6 +14604,7 @@ class SessionStore {
14474
14604
  return existsSync29(this.metaPath(id));
14475
14605
  }
14476
14606
  saveMeta(id, meta) {
14607
+ this._metaCache.set(id, meta);
14477
14608
  const dir = this.sessionDir(id);
14478
14609
  mkdirSync12(dir, { recursive: true });
14479
14610
  const content = JSON.stringify(meta, null, 2);
@@ -14484,13 +14615,18 @@ class SessionStore {
14484
14615
  }
14485
14616
  }
14486
14617
  loadMeta(id) {
14618
+ const cached = this._metaCache.get(id);
14619
+ if (cached)
14620
+ return cached;
14487
14621
  const path = this.metaPath(id);
14488
14622
  if (!existsSync29(path))
14489
14623
  return null;
14490
14624
  try {
14491
14625
  const raw = readFileSync17(path, "utf-8");
14492
14626
  const content = this.encryptor ? this.encryptor.decryptFileContent(raw) : raw;
14493
- return JSON.parse(content);
14627
+ const meta = JSON.parse(content);
14628
+ this._metaCache.set(id, meta);
14629
+ return meta;
14494
14630
  } catch {
14495
14631
  return null;
14496
14632
  }
@@ -14521,11 +14657,23 @@ class SessionStore {
14521
14657
  const raw = readFileSync17(path, "utf-8");
14522
14658
  const lines = raw.split(`
14523
14659
  `).filter(Boolean);
14660
+ const parseLine = (line) => {
14661
+ try {
14662
+ return JSON.parse(line);
14663
+ } catch {
14664
+ return null;
14665
+ }
14666
+ };
14524
14667
  if (this.encryptor?.isEnabled()) {
14525
- const decryptedLines = lines.map((line) => this.encryptor.decryptFileContent(line));
14526
- return decryptedLines.map((line) => JSON.parse(line));
14668
+ return lines.map((line) => {
14669
+ try {
14670
+ return this.encryptor.decryptFileContent(line);
14671
+ } catch {
14672
+ return null;
14673
+ }
14674
+ }).filter((l) => l !== null).map(parseLine).filter((m) => m !== null);
14527
14675
  }
14528
- return lines.map((line) => JSON.parse(line));
14676
+ return lines.map(parseLine).filter((m) => m !== null);
14529
14677
  } catch {
14530
14678
  return [];
14531
14679
  }
@@ -14550,11 +14698,23 @@ class SessionStore {
14550
14698
  const raw = readFileSync17(path, "utf-8");
14551
14699
  const lines = raw.split(`
14552
14700
  `).filter(Boolean);
14701
+ const parseLine = (line) => {
14702
+ try {
14703
+ return JSON.parse(line);
14704
+ } catch {
14705
+ return null;
14706
+ }
14707
+ };
14553
14708
  if (this.encryptor?.isEnabled()) {
14554
- const decryptedLines = lines.map((line) => this.encryptor.decryptFileContent(line));
14555
- return decryptedLines.map((line) => JSON.parse(line));
14709
+ return lines.map((line) => {
14710
+ try {
14711
+ return this.encryptor.decryptFileContent(line);
14712
+ } catch {
14713
+ return null;
14714
+ }
14715
+ }).filter((l) => l !== null).map(parseLine).filter((e) => e !== null);
14556
14716
  }
14557
- return lines.map((line) => JSON.parse(line));
14717
+ return lines.map(parseLine).filter((e) => e !== null);
14558
14718
  } catch {
14559
14719
  return [];
14560
14720
  }
@@ -14575,6 +14735,7 @@ class SessionStore {
14575
14735
  return sessions;
14576
14736
  }
14577
14737
  deleteSession(id) {
14738
+ this._metaCache.delete(id);
14578
14739
  const dir = this.sessionDir(id);
14579
14740
  if (existsSync29(dir)) {
14580
14741
  rmSync(dir, { recursive: true, force: true });
@@ -15162,7 +15323,7 @@ var init_browser2 = __esm(() => {
15162
15323
  });
15163
15324
 
15164
15325
  // src/modules/lsp/client.ts
15165
- import { spawn as spawn5, execSync as execSync2 } from "child_process";
15326
+ import { spawn as spawn5, execSync } from "child_process";
15166
15327
  import { resolve as resolve16 } from "path";
15167
15328
 
15168
15329
  class LspClient {
@@ -15219,7 +15380,7 @@ class LspClient {
15219
15380
  async startServer(config, baseDir) {
15220
15381
  if (config.autoInstall === false) {
15221
15382
  try {
15222
- execSync2(`where ${config.command}`, { stdio: "pipe", timeout: 3000 });
15383
+ execSync(`where ${config.command}`, { stdio: "pipe", timeout: 3000 });
15223
15384
  } catch {
15224
15385
  throw new Error(`${config.command} not found in PATH`);
15225
15386
  }
@@ -15267,6 +15428,11 @@ class LspClient {
15267
15428
  continue;
15268
15429
  }
15269
15430
  this.contentLength = parseInt(match[1], 10);
15431
+ if (this.contentLength > 10485760) {
15432
+ this.buffer = this.buffer.slice(headerEnd + 4);
15433
+ this.contentLength = -1;
15434
+ continue;
15435
+ }
15270
15436
  this.buffer = this.buffer.slice(headerEnd + 4);
15271
15437
  }
15272
15438
  if (this.buffer.length < this.contentLength)
@@ -16183,7 +16349,10 @@ async function bootstrap(configDir, projectDir, noAgentsMd, exitOnComplete) {
16183
16349
  const hallucinationDetector = new HallucinationDetector(baseDir, llmProvider);
16184
16350
  const moduleRegistry = new ModuleRegistry;
16185
16351
  const execModule = new ExecutionModule(baseDir, config.stuckThreshold);
16186
- execModule.restorePlan();
16352
+ const activeMeta = sessionManager.getActiveMeta();
16353
+ if (activeMeta && activeMeta.messageCount > 0) {
16354
+ execModule.restorePlan();
16355
+ }
16187
16356
  moduleRegistry.register(execModule);
16188
16357
  const sessionModule = new SessionModule(sessionManager);
16189
16358
  moduleRegistry.register(sessionModule);
@@ -16243,7 +16412,7 @@ async function bootstrap(configDir, projectDir, noAgentsMd, exitOnComplete) {
16243
16412
  pluginManager.register(plugin2);
16244
16413
  const pluginLoader = new PluginLoader;
16245
16414
  const globalPluginsDir = join26(homedir11(), ".mma", "plugins");
16246
- const projectPluginsDir = join26(dir, ".mma", "plugins");
16415
+ const projectPluginsDir = join26(baseDir, ".mma", "plugins");
16247
16416
  pluginLoader.loadFromDir(globalPluginsDir, pluginManager, logger);
16248
16417
  pluginLoader.loadFromDir(projectPluginsDir, pluginManager, logger);
16249
16418
  contextManager.onCompact = (summary) => {
@@ -16349,7 +16518,7 @@ function ansiRegex({ onlyFirst = false } = {}) {
16349
16518
  return new RegExp(pattern, onlyFirst ? undefined : "g");
16350
16519
  }
16351
16520
 
16352
- // node_modules/strip-ansi/index.js
16521
+ // node_modules/string-width/node_modules/strip-ansi/index.js
16353
16522
  function stripAnsi(string) {
16354
16523
  if (typeof string !== "string") {
16355
16524
  throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
@@ -16448,135 +16617,65 @@ var init_get_east_asian_width = __esm(() => {
16448
16617
  init_lookup();
16449
16618
  });
16450
16619
 
16620
+ // node_modules/emoji-regex/index.js
16621
+ var require_emoji_regex = __commonJS((exports, module) => {
16622
+ module.exports = () => {
16623
+ return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
16624
+ };
16625
+ });
16626
+
16451
16627
  // node_modules/string-width/index.js
16452
- function isDoubleWidthNonRgiEmojiSequence(segment) {
16453
- if (segment.length > 50) {
16454
- return false;
16455
- }
16456
- if (unqualifiedKeycapRegex.test(segment)) {
16457
- return true;
16458
- }
16459
- if (segment.includes("‍")) {
16460
- const pictographics = segment.match(extendedPictographicRegex);
16461
- return pictographics !== null && pictographics.length >= 2;
16462
- }
16463
- return false;
16464
- }
16465
- function baseVisible(segment) {
16466
- return segment.replace(leadingNonPrintingRegex, "");
16467
- }
16468
- function isZeroWidthCluster(segment) {
16469
- return zeroWidthClusterRegex.test(segment);
16470
- }
16471
- function isHangulLeadingJamo(codePoint) {
16472
- return codePoint >= 4352 && codePoint <= 4447 || codePoint >= 43360 && codePoint <= 43388;
16473
- }
16474
- function isHangulVowelJamo(codePoint) {
16475
- return codePoint >= 4448 && codePoint <= 4519 || codePoint >= 55216 && codePoint <= 55238;
16476
- }
16477
- function isHangulTrailingJamo(codePoint) {
16478
- return codePoint >= 4520 && codePoint <= 4607 || codePoint >= 55243 && codePoint <= 55291;
16479
- }
16480
- function isHangulJamo(codePoint) {
16481
- return isHangulLeadingJamo(codePoint) || isHangulVowelJamo(codePoint) || isHangulTrailingJamo(codePoint);
16482
- }
16483
- function hangulClusterWidth(visibleSegment, eastAsianWidthOptions) {
16484
- const codePoints = [];
16485
- for (const character of visibleSegment) {
16486
- if (zeroWidthClusterRegex.test(character)) {
16487
- continue;
16488
- }
16489
- codePoints.push(character.codePointAt(0));
16490
- }
16491
- if (codePoints.length === 0) {
16492
- return;
16493
- }
16494
- let width = 0;
16495
- for (let index = 0;index < codePoints.length; index++) {
16496
- const codePoint = codePoints[index];
16497
- if (!isHangulJamo(codePoint)) {
16498
- if (width === 0) {
16499
- return;
16500
- }
16501
- for (let remaining = index;remaining < codePoints.length; remaining++) {
16502
- width += eastAsianWidth(codePoints[remaining], eastAsianWidthOptions);
16503
- }
16504
- return width;
16505
- }
16506
- if (isHangulLeadingJamo(codePoint) && isHangulVowelJamo(codePoints[index + 1])) {
16507
- width += 2;
16508
- index += isHangulTrailingJamo(codePoints[index + 2]) ? 2 : 1;
16509
- continue;
16510
- }
16511
- width += eastAsianWidth(codePoint, eastAsianWidthOptions);
16512
- }
16513
- return width;
16514
- }
16515
- function trailingWidth(visibleSegment, eastAsianWidthOptions) {
16516
- let extra = 0;
16517
- let first = true;
16518
- for (const character of visibleSegment) {
16519
- if (first) {
16520
- first = false;
16521
- continue;
16522
- }
16523
- if (spacingMarkRegex.test(character) || character >= "＀" && character <= "￯") {
16524
- extra += eastAsianWidth(character.codePointAt(0), eastAsianWidthOptions);
16525
- }
16526
- }
16527
- return extra;
16528
- }
16529
- function stringWidth(input, options = {}) {
16530
- if (typeof input !== "string" || input.length === 0) {
16628
+ function stringWidth(string, options = {}) {
16629
+ if (typeof string !== "string" || string.length === 0) {
16531
16630
  return 0;
16532
16631
  }
16533
16632
  const {
16534
16633
  ambiguousIsNarrow = true,
16535
16634
  countAnsiEscapeCodes = false
16536
16635
  } = options;
16537
- let string = input;
16538
- if (!countAnsiEscapeCodes && (string.includes("\x1B") || string.includes("›"))) {
16636
+ if (!countAnsiEscapeCodes) {
16539
16637
  string = stripAnsi(string);
16540
16638
  }
16541
16639
  if (string.length === 0) {
16542
16640
  return 0;
16543
16641
  }
16544
- if (/^[\u0020-\u007E]*$/.test(string)) {
16545
- return string.length;
16546
- }
16547
16642
  let width = 0;
16548
16643
  const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
16549
- for (const { segment } of segmenter.segment(string)) {
16550
- if (isZeroWidthCluster(segment)) {
16644
+ for (const { segment: character } of segmenter.segment(string)) {
16645
+ const codePoint = character.codePointAt(0);
16646
+ if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
16551
16647
  continue;
16552
16648
  }
16553
- if (rgiEmojiRegex.test(segment) || isDoubleWidthNonRgiEmojiSequence(segment)) {
16554
- width += 2;
16649
+ if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
16555
16650
  continue;
16556
16651
  }
16557
- const visibleSegment = baseVisible(segment);
16558
- const hangulWidth = hangulClusterWidth(visibleSegment, eastAsianWidthOptions);
16559
- if (hangulWidth !== undefined) {
16560
- width += hangulWidth;
16652
+ if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
16653
+ continue;
16654
+ }
16655
+ if (codePoint >= 55296 && codePoint <= 57343) {
16656
+ continue;
16657
+ }
16658
+ if (codePoint >= 65024 && codePoint <= 65039) {
16659
+ continue;
16660
+ }
16661
+ if (defaultIgnorableCodePointRegex.test(character)) {
16662
+ continue;
16663
+ }
16664
+ if (import_emoji_regex.default().test(character)) {
16665
+ width += 2;
16561
16666
  continue;
16562
16667
  }
16563
- const codePoint = visibleSegment.codePointAt(0);
16564
16668
  width += eastAsianWidth(codePoint, eastAsianWidthOptions);
16565
- width += trailingWidth(visibleSegment, eastAsianWidthOptions);
16566
16669
  }
16567
16670
  return width;
16568
16671
  }
16569
- var segmenter, zeroWidthClusterRegex, leadingNonPrintingRegex, spacingMarkRegex, rgiEmojiRegex, unqualifiedKeycapRegex, extendedPictographicRegex;
16672
+ var import_emoji_regex, segmenter, defaultIgnorableCodePointRegex;
16570
16673
  var init_string_width = __esm(() => {
16571
16674
  init_strip_ansi();
16572
16675
  init_get_east_asian_width();
16676
+ import_emoji_regex = __toESM(require_emoji_regex(), 1);
16573
16677
  segmenter = new Intl.Segmenter;
16574
- zeroWidthClusterRegex = /^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Format}|\p{Nonspacing_Mark}|\p{Enclosing_Mark}|\p{Surrogate})+$/v;
16575
- leadingNonPrintingRegex = /^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Nonspacing_Mark}\p{Enclosing_Mark}\p{Surrogate}]+/v;
16576
- spacingMarkRegex = /\p{Spacing_Mark}/v;
16577
- rgiEmojiRegex = /^\p{RGI_Emoji}$/v;
16578
- unqualifiedKeycapRegex = /^[\d#*]\u20E3$/;
16579
- extendedPictographicRegex = /\p{Extended_Pictographic}/gu;
16678
+ defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
16580
16679
  });
16581
16680
 
16582
16681
  // src/ui/table.ts
@@ -25134,12 +25233,13 @@ Excluded blocks: ${info.excluded.length}`));
25134
25233
  const { loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_config2(), exports_config));
25135
25234
  const { homedir: homedir17 } = await import("os");
25136
25235
  const { join: join35 } = await import("path");
25137
- const configDir = join35(homedir17(), ".mma");
25138
- const projectConfigPath = join35(process.cwd(), ".mmrc");
25236
+ const configDir = ctx.configDir;
25237
+ const baseDir = ctx.baseDir;
25238
+ const projectConfigPath = join35(baseDir, ".mmrc");
25139
25239
  const freshConfig = loadConfig2({ configDir, projectConfigPath });
25140
25240
  Object.assign(ctx.config, freshConfig);
25141
25241
  const { bootstrap: bootstrap2 } = await Promise.resolve().then(() => (init_bootstrap(), exports_bootstrap));
25142
- const result = await bootstrap2(configDir, process.cwd(), false, false);
25242
+ const result = await bootstrap2(configDir, baseDir, false, false);
25143
25243
  ctx.agent = result.agent;
25144
25244
  ctx.sessionManager = result.sessionManager;
25145
25245
  ctx.skillsModule = result.skillsModule;
@@ -27025,13 +27125,16 @@ ${t("image.clipboard_empty")}`));
27025
27125
  }
27026
27126
  });
27027
27127
  }
27128
+ let forceExitTimer = null;
27028
27129
  process.on("SIGINT", () => {
27029
27130
  if (this.agentRunning) {
27030
27131
  console.log(pc.yellow(`
27031
27132
  [Ctrl+C] Остановка агента... (ещё раз — принудительно)`));
27032
27133
  this.agent.shutdown();
27033
27134
  this.agentRunning = false;
27034
- setTimeout(() => process.exit(1), 2000).unref();
27135
+ if (forceExitTimer)
27136
+ clearTimeout(forceExitTimer);
27137
+ forceExitTimer = setTimeout(() => process.exit(1), 2000).unref();
27035
27138
  } else {
27036
27139
  process.exit(0);
27037
27140
  }
@@ -27319,7 +27422,10 @@ async function main() {
27319
27422
  ` + t("cli.first_run") + `
27320
27423
  `));
27321
27424
  const answers = await runSetup();
27322
- const { config: config2 } = await bootstrap(undefined, projectDir, noAgentsMd, exitOnComplete);
27425
+ const config2 = loadConfig({
27426
+ configDir: join36(homedir18(), ".mma"),
27427
+ projectConfigPath: projectDir ? join36(projectDir, ".mmrc") : join36(process.cwd(), ".mmrc")
27428
+ });
27323
27429
  config2.provider.type = answers.provider;
27324
27430
  config2.provider.baseUrl = answers.apiBase;
27325
27431
  config2.provider.apiKey = answers.apiKey;