micro-models-agent 0.7.9 → 0.8.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 (150) hide show
  1. package/dist/cli/commands.js +173 -0
  2. package/dist/cli/completer.js +168 -0
  3. package/dist/cli/index.js +2 -0
  4. package/dist/cli/main.js +95 -0
  5. package/dist/cli/repl.js +762 -0
  6. package/dist/cli/security-commands.js +166 -0
  7. package/dist/cli/setup.js +214 -0
  8. package/dist/config/config.js +123 -0
  9. package/dist/config/defaults.js +91 -0
  10. package/dist/config/experts.js +15 -0
  11. package/dist/config/index.js +3 -0
  12. package/dist/config/security.js +187 -0
  13. package/dist/config/types.js +1 -0
  14. package/dist/core/agent.js +626 -0
  15. package/dist/core/bootstrap.js +307 -0
  16. package/dist/core/index.js +2 -0
  17. package/dist/core/prompt-builder.js +55 -0
  18. package/dist/core/types.js +1 -0
  19. package/dist/i18n/en.json +405 -0
  20. package/dist/i18n/index.js +43 -0
  21. package/dist/i18n/ru.json +405 -0
  22. package/dist/index.js +22 -0
  23. package/dist/llm/index.js +4 -0
  24. package/dist/llm/model-loader.js +78 -0
  25. package/dist/llm/openai-compat.js +277 -0
  26. package/dist/llm/orchestrator.js +194 -0
  27. package/dist/llm/provider.js +2 -0
  28. package/dist/llm/response.js +39 -0
  29. package/dist/llm/token-counter.js +37 -0
  30. package/dist/llm/types.js +1 -0
  31. package/dist/logger/app-logger.js +76 -0
  32. package/dist/logger/index.js +1 -0
  33. package/dist/migration/backup.js +45 -0
  34. package/dist/migration/detect.js +50 -0
  35. package/dist/migration/index.js +2 -0
  36. package/dist/modules/browser/actions.js +46 -0
  37. package/dist/modules/browser/cookie-store.js +24 -0
  38. package/dist/modules/browser/index.js +5 -0
  39. package/dist/modules/browser/module.js +28 -0
  40. package/dist/modules/browser/session.js +287 -0
  41. package/dist/modules/browser/snapshot.js +114 -0
  42. package/dist/modules/browser/types.js +9 -0
  43. package/dist/modules/context/history.js +15 -0
  44. package/dist/modules/context/index.js +1 -0
  45. package/dist/modules/context/manager.js +179 -0
  46. package/dist/modules/execution/auditor.js +72 -0
  47. package/dist/modules/execution/index.js +6 -0
  48. package/dist/modules/execution/module.js +334 -0
  49. package/dist/modules/execution/moe-executor.js +196 -0
  50. package/dist/modules/execution/plan-validator.js +153 -0
  51. package/dist/modules/execution/planner.js +35 -0
  52. package/dist/modules/execution/stuck-detector.js +113 -0
  53. package/dist/modules/execution/tracker.js +53 -0
  54. package/dist/modules/execution/types.js +1 -0
  55. package/dist/modules/execution/verifier.js +149 -0
  56. package/dist/modules/hallucination/confidence.js +47 -0
  57. package/dist/modules/hallucination/consistency.js +32 -0
  58. package/dist/modules/hallucination/detector.js +41 -0
  59. package/dist/modules/hallucination/factual.js +128 -0
  60. package/dist/modules/hallucination/index.js +4 -0
  61. package/dist/modules/index.js +5 -0
  62. package/dist/modules/indexer/cache.js +38 -0
  63. package/dist/modules/indexer/index.js +3 -0
  64. package/dist/modules/indexer/module.js +192 -0
  65. package/dist/modules/indexer/walker.js +101 -0
  66. package/dist/modules/mcp/client.js +393 -0
  67. package/dist/modules/mcp/index.js +3 -0
  68. package/dist/modules/mcp/module.js +146 -0
  69. package/dist/modules/mcp/registry.js +15 -0
  70. package/dist/modules/memory/index.js +1 -0
  71. package/dist/modules/memory/search.js +26 -0
  72. package/dist/modules/memory/store.js +38 -0
  73. package/dist/modules/pipelines/engine.js +60 -0
  74. package/dist/modules/pipelines/index.js +3 -0
  75. package/dist/modules/pipelines/parser.js +53 -0
  76. package/dist/modules/pipelines/template.js +14 -0
  77. package/dist/modules/plugins/builtin/lint-on-write.js +121 -0
  78. package/dist/modules/plugins/builtin/notify.js +8 -0
  79. package/dist/modules/plugins/index.js +1 -0
  80. package/dist/modules/plugins/loader.js +28 -0
  81. package/dist/modules/plugins/manager.js +161 -0
  82. package/dist/modules/plugins/types.js +1 -0
  83. package/dist/modules/registry.js +45 -0
  84. package/dist/modules/security/audit-log.js +108 -0
  85. package/dist/modules/security/audit-notifier.js +292 -0
  86. package/dist/modules/security/command-validator.js +91 -0
  87. package/dist/modules/security/content-scanner.js +52 -0
  88. package/dist/modules/security/data-sanitizer.js +97 -0
  89. package/dist/modules/security/encryption.js +218 -0
  90. package/dist/modules/security/index.js +14 -0
  91. package/dist/modules/security/network-validator.js +79 -0
  92. package/dist/modules/security/path-validator.js +155 -0
  93. package/dist/modules/security/rate-limiter.js +119 -0
  94. package/dist/modules/security/security-policies.js +393 -0
  95. package/dist/modules/security/session-encryption.js +193 -0
  96. package/dist/modules/security/session-isolation.js +95 -0
  97. package/dist/modules/session/index.js +3 -0
  98. package/dist/modules/session/manager.js +167 -0
  99. package/dist/modules/session/module.js +28 -0
  100. package/dist/modules/session/store.js +174 -0
  101. package/dist/modules/session/types.js +1 -0
  102. package/dist/modules/skills/index.js +3 -0
  103. package/dist/modules/skills/loader.js +72 -0
  104. package/dist/modules/skills/matcher.js +27 -0
  105. package/dist/modules/skills/module.js +180 -0
  106. package/dist/modules/types.js +1 -0
  107. package/dist/modules/updater/checker.js +32 -0
  108. package/dist/modules/updater/index.js +1 -0
  109. package/dist/modules/user-profile/compressor.js +16 -0
  110. package/dist/modules/user-profile/index.js +1 -0
  111. package/dist/modules/user-profile/profile.js +68 -0
  112. package/dist/tools/approve.js +32 -0
  113. package/dist/tools/bash.js +77 -0
  114. package/dist/tools/browser.js +97 -0
  115. package/dist/tools/create-dir.js +57 -0
  116. package/dist/tools/delete-file.js +64 -0
  117. package/dist/tools/edit-file.js +78 -0
  118. package/dist/tools/executor.js +83 -0
  119. package/dist/tools/file-info.js +46 -0
  120. package/dist/tools/filter-tools.js +10 -0
  121. package/dist/tools/glob-tool.js +19 -0
  122. package/dist/tools/grep-tool.js +51 -0
  123. package/dist/tools/index.js +44 -0
  124. package/dist/tools/list-dir.js +40 -0
  125. package/dist/tools/load-skill.js +48 -0
  126. package/dist/tools/mcp-call.js +68 -0
  127. package/dist/tools/move-file.js +84 -0
  128. package/dist/tools/pipeline-run.js +39 -0
  129. package/dist/tools/question.js +142 -0
  130. package/dist/tools/read-file.js +65 -0
  131. package/dist/tools/registry.js +36 -0
  132. package/dist/tools/scope-check.js +30 -0
  133. package/dist/tools/search-history.js +64 -0
  134. package/dist/tools/subagent.js +130 -0
  135. package/dist/tools/types.js +1 -0
  136. package/dist/tools/user-input.js +123 -0
  137. package/dist/tools/web-browse.js +51 -0
  138. package/dist/tools/web-fetch.js +62 -0
  139. package/dist/tools/web-search.js +59 -0
  140. package/dist/tools/write-file.js +80 -0
  141. package/dist/ui/box.js +81 -0
  142. package/dist/ui/colors.js +4 -0
  143. package/dist/ui/diff.js +185 -0
  144. package/dist/ui/index.js +6 -0
  145. package/dist/ui/md-formatter.js +212 -0
  146. package/dist/ui/output.js +13 -0
  147. package/dist/ui/renderer.js +141 -0
  148. package/dist/ui/spinner.js +70 -0
  149. package/dist/ui/table.js +144 -0
  150. package/package.json +1 -1
@@ -0,0 +1,187 @@
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
+ ],
45
+ // If whitelist is non-empty, only these commands are allowed
46
+ whitelist: [],
47
+ // Block dangerous flags like --force, -rf, etc.
48
+ blockDangerousFlags: true,
49
+ // Log all executed commands to audit log
50
+ logCommands: true,
51
+ // Dangerous flags that are always blocked
52
+ dangerousFlags: [
53
+ "--force",
54
+ "-rf",
55
+ "--no-preserve-root",
56
+ "--recursive",
57
+ "--all",
58
+ "-x",
59
+ "-e",
60
+ "--delete",
61
+ "--remove",
62
+ "--dangerous",
63
+ "--yes",
64
+ "-y",
65
+ "--no-confirm",
66
+ ],
67
+ // Dangerous operators that are always blocked
68
+ dangerousOperators: [">", ">>", "2>", "2>>", "|", "&&", "||", ";", "&", "`"],
69
+ },
70
+ paths: {
71
+ // Glob patterns for paths that are always denied
72
+ denied: [
73
+ ".git/",
74
+ "node_modules/",
75
+ ".env",
76
+ "*.key",
77
+ "*.pem",
78
+ "*.crt",
79
+ "*.p12",
80
+ "*.pfx",
81
+ "*.secret",
82
+ "*.token",
83
+ "package-lock.json",
84
+ "bun.lock",
85
+ "yarn.lock",
86
+ "pnpm-lock.yaml",
87
+ ],
88
+ // If allowed is non-empty, only these paths are allowed
89
+ allowed: [],
90
+ },
91
+ network: {
92
+ // Domains that are always denied
93
+ deniedDomains: [],
94
+ // If allowedDomains is non-empty, only these domains are allowed
95
+ allowedDomains: [],
96
+ // Timeout for network requests (ms)
97
+ requestTimeout: 15000,
98
+ // Maximum response size (bytes)
99
+ maxResponseSize: 15000,
100
+ },
101
+ // Maximum depth of subagent recursion
102
+ maxRecursionDepth: 3,
103
+ // Maximum number of file operations per session
104
+ maxFileOperations: 100,
105
+ // Rate limits for LLM requests
106
+ rateLimits: {
107
+ maxRequestsPerMinute: 60,
108
+ maxParallelTasks: 5,
109
+ },
110
+ // Content scanning settings
111
+ contentScan: {
112
+ enabled: true,
113
+ // Patterns that are considered dangerous in file content
114
+ dangerousPatterns: [
115
+ /eval\(/,
116
+ /new Function\(/,
117
+ /child_process\.exec\(/,
118
+ /child_process\.spawn\(/,
119
+ /require\('child_process'\)/,
120
+ /require\('http'\)\.createServer/,
121
+ /require\('net'\)\.createServer/,
122
+ /process\.exit\(/,
123
+ /while\(true\)/,
124
+ /for\(\;\;\)/,
125
+ /rm -rf/,
126
+ /dd if=/,
127
+ /chmod 777/,
128
+ ],
129
+ },
130
+ // Session file encryption settings
131
+ sessionEncryption: {
132
+ enabled: false,
133
+ encryptHistory: true,
134
+ encryptSessionLog: true,
135
+ },
136
+ // Audit notification settings
137
+ auditNotifier: {
138
+ enabled: false,
139
+ minSeverity: 'medium',
140
+ eventTypes: [
141
+ 'security_block',
142
+ 'bash_command',
143
+ 'file_operation',
144
+ 'network_request',
145
+ ],
146
+ maxRetries: 3,
147
+ webhookTimeout: 5000,
148
+ },
149
+ };
150
+ /**
151
+ * Merge user-provided security config with defaults.
152
+ * User config takes precedence over defaults.
153
+ */
154
+ export function mergeSecurityConfig(userConfig) {
155
+ return {
156
+ bash: {
157
+ ...DEFAULT_SECURITY_CONFIG.bash,
158
+ ...userConfig?.bash,
159
+ },
160
+ paths: {
161
+ ...DEFAULT_SECURITY_CONFIG.paths,
162
+ ...userConfig?.paths,
163
+ },
164
+ network: {
165
+ ...DEFAULT_SECURITY_CONFIG.network,
166
+ ...userConfig?.network,
167
+ },
168
+ maxRecursionDepth: userConfig?.maxRecursionDepth ?? DEFAULT_SECURITY_CONFIG.maxRecursionDepth,
169
+ maxFileOperations: userConfig?.maxFileOperations ?? DEFAULT_SECURITY_CONFIG.maxFileOperations,
170
+ rateLimits: {
171
+ ...DEFAULT_SECURITY_CONFIG.rateLimits,
172
+ ...userConfig?.rateLimits,
173
+ },
174
+ contentScan: {
175
+ ...DEFAULT_SECURITY_CONFIG.contentScan,
176
+ ...userConfig?.contentScan,
177
+ },
178
+ sessionEncryption: {
179
+ ...DEFAULT_SECURITY_CONFIG.sessionEncryption,
180
+ ...userConfig?.sessionEncryption,
181
+ },
182
+ auditNotifier: {
183
+ ...DEFAULT_SECURITY_CONFIG.auditNotifier,
184
+ ...userConfig?.auditNotifier,
185
+ },
186
+ };
187
+ }
@@ -0,0 +1 @@
1
+ export {};