micro-models-agent 0.19.1 → 0.20.0

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 +18112 -0
  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/index.js +0 -3
  64. package/dist/modules/index.js +0 -5
  65. package/dist/modules/indexer/cache.js +0 -38
  66. package/dist/modules/indexer/index.js +0 -3
  67. package/dist/modules/indexer/module.js +0 -192
  68. package/dist/modules/indexer/walker.js +0 -101
  69. package/dist/modules/mcp/client.js +0 -393
  70. package/dist/modules/mcp/index.js +0 -3
  71. package/dist/modules/mcp/module.js +0 -146
  72. package/dist/modules/mcp/registry.js +0 -15
  73. package/dist/modules/memory/index.js +0 -1
  74. package/dist/modules/memory/module.js +0 -48
  75. package/dist/modules/memory/search.js +0 -40
  76. package/dist/modules/memory/store.js +0 -65
  77. package/dist/modules/pipelines/engine.js +0 -60
  78. package/dist/modules/pipelines/index.js +0 -3
  79. package/dist/modules/pipelines/parser.js +0 -53
  80. package/dist/modules/pipelines/template.js +0 -14
  81. package/dist/modules/plugins/builtin/lint-on-write.js +0 -121
  82. package/dist/modules/plugins/builtin/notify.js +0 -8
  83. package/dist/modules/plugins/index.js +0 -1
  84. package/dist/modules/plugins/loader.js +0 -28
  85. package/dist/modules/plugins/manager.js +0 -161
  86. package/dist/modules/plugins/types.js +0 -1
  87. package/dist/modules/processes/detect.js +0 -34
  88. package/dist/modules/processes/index.js +0 -3
  89. package/dist/modules/processes/registry.js +0 -148
  90. package/dist/modules/processes/runner.js +0 -124
  91. package/dist/modules/registry.js +0 -45
  92. package/dist/modules/security/audit-log.js +0 -116
  93. package/dist/modules/security/audit-notifier.js +0 -292
  94. package/dist/modules/security/command-validator.js +0 -185
  95. package/dist/modules/security/content-scanner.js +0 -52
  96. package/dist/modules/security/data-sanitizer.js +0 -97
  97. package/dist/modules/security/encryption.js +0 -240
  98. package/dist/modules/security/index.js +0 -14
  99. package/dist/modules/security/network-validator.js +0 -79
  100. package/dist/modules/security/path-validator.js +0 -155
  101. package/dist/modules/security/rate-limiter.js +0 -119
  102. package/dist/modules/security/security-policies.js +0 -393
  103. package/dist/modules/security/session-encryption.js +0 -193
  104. package/dist/modules/security/session-isolation.js +0 -95
  105. package/dist/modules/session/index.js +0 -3
  106. package/dist/modules/session/manager.js +0 -167
  107. package/dist/modules/session/module.js +0 -24
  108. package/dist/modules/session/store.js +0 -174
  109. package/dist/modules/session/types.js +0 -1
  110. package/dist/modules/skills/index.js +0 -3
  111. package/dist/modules/skills/loader.js +0 -72
  112. package/dist/modules/skills/matcher.js +0 -27
  113. package/dist/modules/skills/module.js +0 -143
  114. package/dist/modules/types.js +0 -1
  115. package/dist/modules/updater/checker.js +0 -32
  116. package/dist/modules/updater/index.js +0 -1
  117. package/dist/modules/user-profile/compressor.js +0 -16
  118. package/dist/modules/user-profile/index.js +0 -1
  119. package/dist/modules/user-profile/profile.js +0 -68
  120. package/dist/skills/builtin/builtin/git.md +0 -36
  121. package/dist/skills/builtin/builtin/typescript.md +0 -35
  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 -55
  127. package/dist/tools/delete-file.js +0 -62
  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 -70
  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 -79
  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
@@ -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
- }