micro-models-agent 0.23.0 → 0.24.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 (171) hide show
  1. package/README.md +312 -312
  2. package/bin/mma.mjs +8 -8
  3. package/dist/main.js +8777 -864
  4. package/package.json +4 -3
  5. package/dist/cli/commands.js +0 -220
  6. package/dist/cli/completer.js +0 -168
  7. package/dist/cli/index.js +0 -2
  8. package/dist/cli/main.js +0 -113
  9. package/dist/cli/repl.js +0 -987
  10. package/dist/cli/security-commands.js +0 -166
  11. package/dist/cli/setup.js +0 -229
  12. package/dist/config/config.js +0 -186
  13. package/dist/config/defaults.js +0 -91
  14. package/dist/config/experts.js +0 -15
  15. package/dist/config/index.js +0 -3
  16. package/dist/config/security.js +0 -193
  17. package/dist/config/types.js +0 -1
  18. package/dist/core/agent-moe.js +0 -98
  19. package/dist/core/agent.js +0 -461
  20. package/dist/core/bootstrap.js +0 -321
  21. package/dist/core/index.js +0 -2
  22. package/dist/core/prompt-builder.js +0 -55
  23. package/dist/core/session-logger.js +0 -122
  24. package/dist/core/types.js +0 -1
  25. package/dist/i18n/en.json +0 -461
  26. package/dist/i18n/index.js +0 -43
  27. package/dist/i18n/ru.json +0 -461
  28. package/dist/index.js +0 -22
  29. package/dist/llm/image-utils.js +0 -144
  30. package/dist/llm/index.js +0 -4
  31. package/dist/llm/model-loader.js +0 -78
  32. package/dist/llm/openai-compat.js +0 -324
  33. package/dist/llm/orchestrator.js +0 -194
  34. package/dist/llm/provider.js +0 -10
  35. package/dist/llm/response.js +0 -39
  36. package/dist/llm/token-counter.js +0 -39
  37. package/dist/llm/types.js +0 -1
  38. package/dist/logger/app-logger.js +0 -76
  39. package/dist/logger/index.js +0 -1
  40. package/dist/migration/backup.js +0 -45
  41. package/dist/migration/detect.js +0 -50
  42. package/dist/migration/index.js +0 -2
  43. package/dist/modules/browser/actions.js +0 -46
  44. package/dist/modules/browser/cookie-store.js +0 -24
  45. package/dist/modules/browser/index.js +0 -5
  46. package/dist/modules/browser/module.js +0 -28
  47. package/dist/modules/browser/session.js +0 -287
  48. package/dist/modules/browser/snapshot.js +0 -114
  49. package/dist/modules/browser/types.js +0 -9
  50. package/dist/modules/context/history.js +0 -15
  51. package/dist/modules/context/index.js +0 -1
  52. package/dist/modules/context/manager.js +0 -240
  53. package/dist/modules/execution/auditor.js +0 -72
  54. package/dist/modules/execution/index.js +0 -6
  55. package/dist/modules/execution/module.js +0 -337
  56. package/dist/modules/execution/moe-executor.js +0 -209
  57. package/dist/modules/execution/plan-validator.js +0 -153
  58. package/dist/modules/execution/planner.js +0 -35
  59. package/dist/modules/execution/stuck-detector.js +0 -134
  60. package/dist/modules/execution/tracker.js +0 -53
  61. package/dist/modules/execution/types.js +0 -1
  62. package/dist/modules/execution/verifier.js +0 -149
  63. package/dist/modules/hallucination/confidence.js +0 -54
  64. package/dist/modules/hallucination/consistency.js +0 -60
  65. package/dist/modules/hallucination/detector.js +0 -41
  66. package/dist/modules/hallucination/factual.js +0 -170
  67. package/dist/modules/hallucination/index.js +0 -4
  68. package/dist/modules/index.js +0 -5
  69. package/dist/modules/indexer/cache.js +0 -38
  70. package/dist/modules/indexer/index.js +0 -3
  71. package/dist/modules/indexer/module.js +0 -192
  72. package/dist/modules/indexer/walker.js +0 -101
  73. package/dist/modules/mcp/client.js +0 -393
  74. package/dist/modules/mcp/index.js +0 -3
  75. package/dist/modules/mcp/module.js +0 -146
  76. package/dist/modules/mcp/registry.js +0 -15
  77. package/dist/modules/memory/index.js +0 -1
  78. package/dist/modules/memory/module.js +0 -48
  79. package/dist/modules/memory/search.js +0 -40
  80. package/dist/modules/memory/store.js +0 -65
  81. package/dist/modules/pipelines/engine.js +0 -60
  82. package/dist/modules/pipelines/index.js +0 -3
  83. package/dist/modules/pipelines/parser.js +0 -53
  84. package/dist/modules/pipelines/template.js +0 -14
  85. package/dist/modules/plugins/builtin/lint-on-write.js +0 -121
  86. package/dist/modules/plugins/builtin/notify.js +0 -8
  87. package/dist/modules/plugins/index.js +0 -1
  88. package/dist/modules/plugins/loader.js +0 -28
  89. package/dist/modules/plugins/manager.js +0 -161
  90. package/dist/modules/plugins/types.js +0 -1
  91. package/dist/modules/processes/detect.js +0 -34
  92. package/dist/modules/processes/index.js +0 -3
  93. package/dist/modules/processes/registry.js +0 -148
  94. package/dist/modules/processes/runner.js +0 -124
  95. package/dist/modules/registry.js +0 -45
  96. package/dist/modules/security/audit-log.js +0 -116
  97. package/dist/modules/security/audit-notifier.js +0 -292
  98. package/dist/modules/security/command-validator.js +0 -185
  99. package/dist/modules/security/content-scanner.js +0 -52
  100. package/dist/modules/security/data-sanitizer.js +0 -97
  101. package/dist/modules/security/encryption.js +0 -240
  102. package/dist/modules/security/index.js +0 -14
  103. package/dist/modules/security/network-validator.js +0 -79
  104. package/dist/modules/security/path-validator.js +0 -155
  105. package/dist/modules/security/rate-limiter.js +0 -119
  106. package/dist/modules/security/security-policies.js +0 -393
  107. package/dist/modules/security/session-encryption.js +0 -193
  108. package/dist/modules/security/session-isolation.js +0 -95
  109. package/dist/modules/session/index.js +0 -3
  110. package/dist/modules/session/manager.js +0 -167
  111. package/dist/modules/session/module.js +0 -24
  112. package/dist/modules/session/store.js +0 -174
  113. package/dist/modules/session/types.js +0 -1
  114. package/dist/modules/skills/index.js +0 -3
  115. package/dist/modules/skills/loader.js +0 -72
  116. package/dist/modules/skills/matcher.js +0 -27
  117. package/dist/modules/skills/module.js +0 -143
  118. package/dist/modules/types.js +0 -1
  119. package/dist/modules/updater/checker.js +0 -32
  120. package/dist/modules/updater/index.js +0 -1
  121. package/dist/modules/user-profile/compressor.js +0 -16
  122. package/dist/modules/user-profile/index.js +0 -1
  123. package/dist/modules/user-profile/profile.js +0 -68
  124. package/dist/skills/builtin/builtin/git.md +0 -36
  125. package/dist/skills/builtin/builtin/typescript.md +0 -35
  126. package/dist/tools/approve.js +0 -32
  127. package/dist/tools/attach-image.js +0 -89
  128. package/dist/tools/bash.js +0 -140
  129. package/dist/tools/browser.js +0 -97
  130. package/dist/tools/create-dir.js +0 -56
  131. package/dist/tools/delete-file.js +0 -63
  132. package/dist/tools/edit-file.js +0 -77
  133. package/dist/tools/executor.js +0 -95
  134. package/dist/tools/file-info.js +0 -45
  135. package/dist/tools/filter-tools.js +0 -10
  136. package/dist/tools/glob-tool.js +0 -26
  137. package/dist/tools/grep-tool.js +0 -64
  138. package/dist/tools/index.js +0 -52
  139. package/dist/tools/list-dir.js +0 -47
  140. package/dist/tools/load-skill.js +0 -48
  141. package/dist/tools/mcp-call.js +0 -68
  142. package/dist/tools/move-file.js +0 -84
  143. package/dist/tools/path-utils.js +0 -51
  144. package/dist/tools/pipeline-run.js +0 -144
  145. package/dist/tools/preview.js +0 -2
  146. package/dist/tools/process-kill.js +0 -29
  147. package/dist/tools/process-list.js +0 -38
  148. package/dist/tools/process-log.js +0 -41
  149. package/dist/tools/question.js +0 -142
  150. package/dist/tools/read-file.js +0 -73
  151. package/dist/tools/recall.js +0 -110
  152. package/dist/tools/registry.js +0 -36
  153. package/dist/tools/remember.js +0 -67
  154. package/dist/tools/scope-check.js +0 -30
  155. package/dist/tools/search-history.js +0 -64
  156. package/dist/tools/subagent.js +0 -142
  157. package/dist/tools/types.js +0 -1
  158. package/dist/tools/user-input.js +0 -123
  159. package/dist/tools/web-browse.js +0 -57
  160. package/dist/tools/web-fetch.js +0 -72
  161. package/dist/tools/web-search.js +0 -59
  162. package/dist/tools/write-file.js +0 -80
  163. package/dist/ui/box.js +0 -81
  164. package/dist/ui/colors.js +0 -4
  165. package/dist/ui/diff.js +0 -185
  166. package/dist/ui/index.js +0 -6
  167. package/dist/ui/md-formatter.js +0 -212
  168. package/dist/ui/output.js +0 -13
  169. package/dist/ui/renderer.js +0 -141
  170. package/dist/ui/spinner.js +0 -70
  171. package/dist/ui/table.js +0 -144
@@ -1,193 +0,0 @@
1
- /**
2
- * Default security configuration for MMA.
3
- * These settings provide a balance between security and usability.
4
- */
5
- export const DEFAULT_SECURITY_CONFIG = {
6
- bash: {
7
- // Commands that are always blocked (dangerous)
8
- blacklist: [
9
- "rm",
10
- "dd",
11
- "chmod",
12
- "wget",
13
- "curl",
14
- "scp",
15
- "ssh",
16
- "nc",
17
- "netcat",
18
- "mknod",
19
- "mkfifo",
20
- "ln",
21
- "chown",
22
- "chgrp",
23
- "useradd",
24
- "usermod",
25
- "passwd",
26
- "sudo",
27
- "su",
28
- "exec",
29
- "eval",
30
- "source",
31
- "kill",
32
- "pkill",
33
- "killall",
34
- "shutdown",
35
- "reboot",
36
- "halt",
37
- "poweroff",
38
- "format",
39
- "fdisk",
40
- "parted",
41
- "mkfs",
42
- "mount",
43
- "umount",
44
- "powershell",
45
- "pwsh",
46
- "cmd",
47
- ],
48
- // If whitelist is non-empty, only these commands are allowed
49
- whitelist: [],
50
- // Block dangerous flags like --force, -rf, etc.
51
- // Disabled by default — enable in config if needed.
52
- blockDangerousFlags: false,
53
- // Log all executed commands to audit log
54
- logCommands: true,
55
- // Dangerous flags that are always blocked
56
- dangerousFlags: [
57
- "--force",
58
- "-rf",
59
- "--no-preserve-root",
60
- "--recursive",
61
- "--all",
62
- "-x",
63
- "-e",
64
- "--delete",
65
- "--remove",
66
- "--dangerous",
67
- "--yes",
68
- "-y",
69
- "--no-confirm",
70
- ],
71
- // Dangerous operators that are always blocked
72
- // Note: "&" (background) is not blocked — "&&" (AND) is a legitimate shell operator.
73
- // Single "&" for backgrounding is harmless and blocking it breaks "cd dir && npm install".
74
- dangerousOperators: [">", ">>", "2>", "2>>", "`"],
75
- },
76
- paths: {
77
- // Glob patterns for paths that are always denied
78
- denied: [
79
- ".git/",
80
- "node_modules/",
81
- ".env",
82
- "*.key",
83
- "*.pem",
84
- "*.crt",
85
- "*.p12",
86
- "*.pfx",
87
- "*.secret",
88
- "*.token",
89
- "package-lock.json",
90
- "bun.lock",
91
- "yarn.lock",
92
- "pnpm-lock.yaml",
93
- ],
94
- // If allowed is non-empty, only these paths are allowed
95
- allowed: [],
96
- },
97
- network: {
98
- // Domains that are always denied
99
- deniedDomains: ["localhost", "127.0.0.1", "::1"],
100
- // If allowedDomains is non-empty, only these domains are allowed
101
- allowedDomains: [],
102
- // Timeout for network requests (ms)
103
- requestTimeout: 15000,
104
- // Maximum response size (bytes)
105
- maxResponseSize: 15000,
106
- },
107
- // Maximum depth of subagent recursion
108
- maxRecursionDepth: 3,
109
- // Maximum number of file operations per session
110
- maxFileOperations: 100,
111
- // Rate limits for LLM requests
112
- rateLimits: {
113
- maxRequestsPerMinute: 60,
114
- maxParallelTasks: 5,
115
- },
116
- // Content scanning settings
117
- contentScan: {
118
- enabled: true,
119
- // Patterns that are considered dangerous in file content
120
- dangerousPatterns: [
121
- /eval\(/,
122
- /new Function\(/,
123
- /child_process\.exec\(/,
124
- /child_process\.spawn\(/,
125
- /require\('child_process'\)/,
126
- /require\('http'\)\.createServer/,
127
- /require\('net'\)\.createServer/,
128
- /process\.exit\(/,
129
- /while\(true\)/,
130
- /for\(\;\;\)/,
131
- /rm -rf/,
132
- /dd if=/,
133
- /chmod 777/,
134
- ],
135
- },
136
- // Session file encryption settings
137
- sessionEncryption: {
138
- enabled: false,
139
- encryptHistory: true,
140
- encryptSessionLog: true,
141
- },
142
- // Audit notification settings
143
- auditNotifier: {
144
- enabled: false,
145
- minSeverity: 'medium',
146
- eventTypes: [
147
- 'security_block',
148
- 'bash_command',
149
- 'file_operation',
150
- 'network_request',
151
- ],
152
- maxRetries: 3,
153
- webhookTimeout: 5000,
154
- },
155
- };
156
- /**
157
- * Merge user-provided security config with defaults.
158
- * User config takes precedence over defaults.
159
- */
160
- export function mergeSecurityConfig(userConfig) {
161
- return {
162
- bash: {
163
- ...DEFAULT_SECURITY_CONFIG.bash,
164
- ...userConfig?.bash,
165
- },
166
- paths: {
167
- ...DEFAULT_SECURITY_CONFIG.paths,
168
- ...userConfig?.paths,
169
- },
170
- network: {
171
- ...DEFAULT_SECURITY_CONFIG.network,
172
- ...userConfig?.network,
173
- },
174
- maxRecursionDepth: userConfig?.maxRecursionDepth ?? DEFAULT_SECURITY_CONFIG.maxRecursionDepth,
175
- maxFileOperations: userConfig?.maxFileOperations ?? DEFAULT_SECURITY_CONFIG.maxFileOperations,
176
- rateLimits: {
177
- ...DEFAULT_SECURITY_CONFIG.rateLimits,
178
- ...userConfig?.rateLimits,
179
- },
180
- contentScan: {
181
- ...DEFAULT_SECURITY_CONFIG.contentScan,
182
- ...userConfig?.contentScan,
183
- },
184
- sessionEncryption: {
185
- ...DEFAULT_SECURITY_CONFIG.sessionEncryption,
186
- ...userConfig?.sessionEncryption,
187
- },
188
- auditNotifier: {
189
- ...DEFAULT_SECURITY_CONFIG.auditNotifier,
190
- ...userConfig?.auditNotifier,
191
- },
192
- };
193
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,98 +0,0 @@
1
- import { OrchestratorClient } from "../llm/orchestrator";
2
- import { validatePlan, applyAutoFixes, } from "../modules/execution/plan-validator";
3
- import { MoEExecutor } from "../modules/execution/moe-executor";
4
- import { StepVerifier } from "../modules/execution/verifier";
5
- /**
6
- * Execute the MoE (Mixture of Experts) path: plan → validate → execute → verify.
7
- * Returns a fallback signal when MoE cannot proceed so the caller can fall
8
- * back to the single-agent loop.
9
- */
10
- export async function runWithMoE(deps, input, fallback, opts = {}) {
11
- const { config, llmProvider, logger, toolExecutor, baseDir } = deps;
12
- const { onMeta, onPhase } = opts;
13
- const orchestrator = new OrchestratorClient({
14
- model: config.orchestrator.model,
15
- provider: config.orchestrator.provider,
16
- }, llmProvider);
17
- if (!orchestrator.isEnabled()) {
18
- logger.debug("MoE enabled but no orchestrator model configured — falling back to single-agent");
19
- return fallback();
20
- }
21
- onMeta?.("🤖 Planning with MoE mode...\n");
22
- onPhase?.("thinking");
23
- const planResult = await orchestrator.plan(input);
24
- onPhase?.("done");
25
- if ("error" in planResult) {
26
- logger.warn(`MoE plan failed: ${planResult.error} — falling back to single-agent`);
27
- return fallback();
28
- }
29
- const { plan } = planResult;
30
- onMeta?.(`📋 Plan created: "${plan.title}" (${plan.subtasks.length} subtasks)\n`);
31
- const validation = validatePlan(plan, config);
32
- if (!validation.valid) {
33
- const applied = applyAutoFixes(plan, validation.autoFixes);
34
- const retry = validatePlan(applied, config);
35
- if (!retry.valid) {
36
- logger.warn(`MoE plan validation failed: ${retry.errors.join("; ")} — falling back to single-agent`);
37
- onMeta?.(`⚠️ Plan validation failed. Falling back to single-agent mode.\n`);
38
- return fallback();
39
- }
40
- Object.assign(plan, applied);
41
- onMeta?.(`🔧 Auto-fixed ${validation.autoFixes.length} plan issues.\n`);
42
- }
43
- const moeDeps = {
44
- config,
45
- toolRegistry: toolExecutor.getRegistry(),
46
- toolExecutor,
47
- llmProvider,
48
- logger,
49
- baseDir,
50
- };
51
- const executor = new MoEExecutor(moeDeps);
52
- onMeta?.(`⚙️ Executing ${plan.subtasks.length} subtasks...\n`);
53
- const planResults = await executor.executePlan(plan);
54
- onMeta?.(`✅ Execution complete: ${planResults.results.filter((r) => r.success).length}/${planResults.results.length} succeeded\n`);
55
- const verifier = new StepVerifier(baseDir);
56
- const knownTags = [
57
- "file",
58
- "code",
59
- "shell",
60
- "research",
61
- "browser",
62
- "vision",
63
- "core",
64
- ];
65
- const verification = await verifier.verifyMoEManifest(plan, config, knownTags);
66
- onPhase?.("thinking");
67
- const verifyResult = await orchestrator.verifyAndMerge({
68
- plan,
69
- results: planResults.results.map((r) => ({
70
- subtaskId: r.subtaskId,
71
- success: r.success,
72
- summary: r.summary,
73
- result: r.result,
74
- error: r.error,
75
- })),
76
- verifierErrors: verification.errors,
77
- verifierWarnings: verification.warnings,
78
- });
79
- onPhase?.("done");
80
- const outputLines = [`## MoE Execution Results\n`];
81
- for (const r of planResults.results) {
82
- const icon = r.success ? "✅" : "❌";
83
- outputLines.push(`${icon} **${r.subtaskId}**: ${r.summary} (${r.durationMs}ms)`);
84
- }
85
- outputLines.push("");
86
- if (verifyResult.type === "final") {
87
- outputLines.push(`**Result:** ${verifyResult.finalAnswer || "Complete"}`);
88
- }
89
- else {
90
- outputLines.push(`**Re-plan requested:** ${verifyResult.explanation || ""}`);
91
- }
92
- const failedCount = planResults.results.filter((r) => !r.success).length;
93
- return {
94
- success: failedCount === 0 && verification.success,
95
- text: outputLines.join("\n"),
96
- iterationCount: planResults.results.length,
97
- };
98
- }