micro-models-agent 0.7.10 → 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,173 @@
1
+ import { Command } from "commander";
2
+ import { bootstrap } from "../core/bootstrap";
3
+ import { saveConfig } from "../config/config";
4
+ import { runSetup } from "./setup";
5
+ import { t } from "../i18n/index";
6
+ import { join } from "path";
7
+ import { homedir } from "os";
8
+ import { createSecurityCommand } from "./security-commands";
9
+ export function createProgram() {
10
+ const program = new Command()
11
+ .name("mma")
12
+ .description(t("cli.description"))
13
+ .version("0.4.0")
14
+ .option("--no-agents-md", t("cli.no_agents_md"))
15
+ .option("-d, --dir <path>", t("cli.dir"))
16
+ .option("-e, --exit-on-complete", t("cli.exit_on_complete"))
17
+ .option("-j, --json", t("cli.json"));
18
+ program
19
+ .command("init")
20
+ .description(t("cli.init"))
21
+ .action(async () => {
22
+ const answers = await runSetup();
23
+ const configPath = join(homedir(), ".mma", "config.json");
24
+ const { config } = await bootstrap();
25
+ config.provider.type = answers.provider;
26
+ config.provider.baseUrl = answers.apiBase;
27
+ config.provider.apiKey = answers.apiKey;
28
+ config.model = answers.model;
29
+ config.contextWindow = answers.contextWindow;
30
+ config.maxToolIterations = answers.maxToolIterations;
31
+ config.locale = answers.locale;
32
+ saveConfig(config, configPath);
33
+ console.log(t("cli.config_saved"));
34
+ });
35
+ const configCmd = program
36
+ .command("config")
37
+ .description(t("cli.manage_config"));
38
+ configCmd
39
+ .command("set")
40
+ .argument("<key>", t("cli.config_key"))
41
+ .argument("<value>", "Config value")
42
+ .description(t("cli.set_value"))
43
+ .action(async (key, value) => {
44
+ const configPath = join(homedir(), ".mma", "config.json");
45
+ const { config } = await bootstrap();
46
+ const keys = key.split(".");
47
+ let obj = config;
48
+ for (let i = 0; i < keys.length - 1; i++) {
49
+ if (!(keys[i] in obj))
50
+ obj[keys[i]] = {};
51
+ obj = obj[keys[i]];
52
+ }
53
+ const lastKey = keys[keys.length - 1];
54
+ if (value === "true")
55
+ obj[lastKey] = true;
56
+ else if (value === "false")
57
+ obj[lastKey] = false;
58
+ else if (/^\d+$/.test(value))
59
+ obj[lastKey] = parseInt(value, 10);
60
+ else if (/^\d+\.\d+$/.test(value))
61
+ obj[lastKey] = parseFloat(value);
62
+ else
63
+ obj[lastKey] = value;
64
+ saveConfig(config, configPath);
65
+ console.log(t("cli.set_done", { key, value }));
66
+ });
67
+ configCmd
68
+ .command("show")
69
+ .description(t("cli.show_config"))
70
+ .action(async () => {
71
+ const { config } = await bootstrap();
72
+ console.log(JSON.stringify(config, null, 2));
73
+ });
74
+ const model = program.command("model").description(t("cli.manage_models"));
75
+ model
76
+ .command("list")
77
+ .description(t("cli.list_models"))
78
+ .action(async () => {
79
+ const { config } = await bootstrap();
80
+ console.log(t("cli.current_model"), config.model);
81
+ console.log(t("cli.model_hint"));
82
+ });
83
+ model
84
+ .command("use")
85
+ .argument("<name>", "Model name")
86
+ .description(t("cli.set_model"))
87
+ .action(async (name) => {
88
+ const configPath = join(homedir(), ".mma", "config.json");
89
+ const { config } = await bootstrap();
90
+ config.model = name;
91
+ saveConfig(config, configPath);
92
+ console.log(t("cli.model_set", { name }));
93
+ });
94
+ const provider = program
95
+ .command("provider")
96
+ .description(t("cli.manage_providers"));
97
+ provider
98
+ .command("list")
99
+ .description(t("cli.list_providers"))
100
+ .action(async () => {
101
+ const { config } = await bootstrap();
102
+ console.log(t("cli.current_provider"), config.provider.type);
103
+ console.log(t("cli.base_url"), config.provider.baseUrl);
104
+ });
105
+ provider
106
+ .command("use")
107
+ .argument("<name>", "Provider name")
108
+ .description(t("cli.set_provider"))
109
+ .action(async (name) => {
110
+ const configPath = join(homedir(), ".mma", "config.json");
111
+ const { config } = await bootstrap();
112
+ config.provider.type = name;
113
+ saveConfig(config, configPath);
114
+ console.log(t("cli.provider_set", { name }));
115
+ });
116
+ const session = program
117
+ .command("session")
118
+ .description(t("cli.manage_sessions"));
119
+ session
120
+ .command("list")
121
+ .description(t("cli.list_sessions"))
122
+ .action(async () => {
123
+ const { sessionManager } = await bootstrap();
124
+ const sessions = sessionManager.list();
125
+ if (sessions.length === 0) {
126
+ console.log(t("session.no_sessions"));
127
+ return;
128
+ }
129
+ const active = sessionManager.getActive();
130
+ for (const s of sessions) {
131
+ const marker = s.id === active ? "*" : " ";
132
+ console.log(` ${marker} ${s.id.slice(0, 12)} ${s.name} ${s.messageCount} msgs ${s.updatedAt.slice(0, 10)}`);
133
+ }
134
+ });
135
+ session
136
+ .command("show")
137
+ .argument("<id>", "Session id")
138
+ .description(t("cli.show_details"))
139
+ .action(async (id) => {
140
+ const { sessionManager } = await bootstrap();
141
+ const meta = sessionManager.get(id);
142
+ if (!meta) {
143
+ console.log(t("session.not_found", { id }));
144
+ return;
145
+ }
146
+ console.log(`ID: ${meta.id}`);
147
+ console.log(`Name: ${meta.name}`);
148
+ console.log(`Created: ${meta.createdAt}`);
149
+ console.log(`Updated: ${meta.updatedAt}`);
150
+ console.log(`Messages: ${meta.messageCount}`);
151
+ console.log(`Model: ${meta.model}`);
152
+ console.log(`Context: ${meta.contextWindow}`);
153
+ console.log(`Project: ${meta.projectDir}`);
154
+ });
155
+ session
156
+ .command("delete")
157
+ .argument("<id>", "Session id")
158
+ .description(t("cli.delete_session"))
159
+ .action(async (id) => {
160
+ const { sessionManager } = await bootstrap();
161
+ sessionManager.delete(id);
162
+ console.log(t("session.deleted", { id }));
163
+ });
164
+ // Add security commands
165
+ createSecurityCommand(program);
166
+ program
167
+ .argument("[prompt...]", "Prompt to execute")
168
+ .description("Run a single prompt")
169
+ .action((prompt) => {
170
+ /* Handled by main.ts after program.parse() */
171
+ });
172
+ return program;
173
+ }
@@ -0,0 +1,168 @@
1
+ import { readdirSync, statSync } from 'fs';
2
+ import { join } from 'path';
3
+ export class SlashCommandProvider {
4
+ name = 'slash-commands';
5
+ commands;
6
+ constructor(commands) {
7
+ this.commands = commands;
8
+ }
9
+ match(ctx) {
10
+ return ctx.tokenIndex === 0 && ctx.line.startsWith('/');
11
+ }
12
+ complete(ctx) {
13
+ return this.commands
14
+ .filter(c => c.startsWith(ctx.partial.slice(1)))
15
+ .map(c => `/${c}`);
16
+ }
17
+ }
18
+ export class SubcommandProvider {
19
+ name = 'subcommands';
20
+ command;
21
+ subcommands;
22
+ constructor(command, subcommands) {
23
+ this.command = command;
24
+ this.subcommands = subcommands;
25
+ }
26
+ match(ctx) {
27
+ return ctx.tokenIndex === 1 && ctx.tokens[0] === `/${this.command}`;
28
+ }
29
+ complete(ctx) {
30
+ return this.subcommands.filter(s => s.startsWith(ctx.partial));
31
+ }
32
+ }
33
+ export class ModelArgProvider {
34
+ name = 'model-args';
35
+ models;
36
+ constructor(models) {
37
+ this.models = models;
38
+ }
39
+ match(ctx) {
40
+ return ctx.tokenIndex === 2 && (ctx.tokens[0] === '/model' || ctx.tokens[0] === '/config');
41
+ }
42
+ complete(ctx) {
43
+ return this.models.filter(m => m.startsWith(ctx.partial));
44
+ }
45
+ }
46
+ export class ConfigKeyProvider {
47
+ name = 'config-keys';
48
+ keys;
49
+ constructor(keys) {
50
+ this.keys = keys;
51
+ }
52
+ match(ctx) {
53
+ return ctx.tokenIndex >= 1 && ctx.tokens[0] === '/config' && ctx.tokens[1] === 'set';
54
+ }
55
+ complete(ctx) {
56
+ return this.keys.filter(k => k.startsWith(ctx.partial));
57
+ }
58
+ }
59
+ export class FilePathProvider {
60
+ name = 'file-paths';
61
+ match(ctx) {
62
+ return ctx.partial.includes('/') || ctx.partial.includes('\\');
63
+ }
64
+ complete(ctx) {
65
+ try {
66
+ const cwd = process.cwd();
67
+ const partialPath = ctx.partial;
68
+ const lastSlash = Math.max(partialPath.lastIndexOf('/'), partialPath.lastIndexOf('\\'));
69
+ const dirPath = lastSlash > 0 ? partialPath.slice(0, lastSlash) : '.';
70
+ const prefix = lastSlash > 0 ? partialPath.slice(0, lastSlash + 1) : '';
71
+ const fullPath = join(cwd, dirPath);
72
+ const entries = readdirSync(fullPath);
73
+ const matches = [];
74
+ for (const entry of entries) {
75
+ const entryPath = join(fullPath, entry);
76
+ const stat = statSync(entryPath);
77
+ const completion = prefix + entry + (stat.isDirectory() ? '/' : '');
78
+ if (completion.startsWith(ctx.partial)) {
79
+ matches.push(completion);
80
+ }
81
+ }
82
+ return matches.slice(0, 20);
83
+ }
84
+ catch {
85
+ return [];
86
+ }
87
+ }
88
+ }
89
+ export class ProviderArgProvider {
90
+ name = 'provider-args';
91
+ providers;
92
+ constructor(providers) {
93
+ this.providers = providers;
94
+ }
95
+ match(ctx) {
96
+ return ctx.tokenIndex === 2 && ctx.tokens[0] === '/provider' && ctx.tokens[1] === 'use';
97
+ }
98
+ complete(ctx) {
99
+ return this.providers.filter(p => p.startsWith(ctx.partial));
100
+ }
101
+ }
102
+ export class SessionNameProvider {
103
+ name = 'session-names';
104
+ getNames;
105
+ constructor(getNames) {
106
+ this.getNames = getNames;
107
+ }
108
+ match(ctx) {
109
+ return ctx.tokenIndex >= 1 && ctx.tokens[0] === '/resume';
110
+ }
111
+ complete(ctx) {
112
+ const names = this.getNames();
113
+ if (!ctx.partial)
114
+ return names;
115
+ return names.filter(n => n.toLowerCase().includes(ctx.partial.toLowerCase()));
116
+ }
117
+ }
118
+ export class SkillNameProvider {
119
+ name = 'skill-names';
120
+ skillsModule;
121
+ constructor(skillsModule) {
122
+ this.skillsModule = skillsModule;
123
+ }
124
+ match(ctx) {
125
+ return ctx.tokenIndex >= 2 && ctx.tokens[0] === '/skill' &&
126
+ (ctx.tokens[1] === 'load' || ctx.tokens[1] === 'unload');
127
+ }
128
+ complete(ctx) {
129
+ const subcmd = ctx.tokens[1];
130
+ if (subcmd === 'load') {
131
+ const available = this.skillsModule.getAvailable();
132
+ const names = available.map(s => s.name);
133
+ if (!ctx.partial)
134
+ return names;
135
+ return names.filter(n => n.toLowerCase().includes(ctx.partial.toLowerCase()));
136
+ }
137
+ if (subcmd === 'unload') {
138
+ const loaded = this.skillsModule.getLoaded();
139
+ const names = loaded.map(s => s.name);
140
+ if (!ctx.partial)
141
+ return names;
142
+ return names.filter(n => n.toLowerCase().includes(ctx.partial.toLowerCase()));
143
+ }
144
+ return [];
145
+ }
146
+ }
147
+ export class Completer {
148
+ providers = [];
149
+ registerProvider(provider) {
150
+ this.providers.push(provider);
151
+ }
152
+ complete(line) {
153
+ const cursor = line.length;
154
+ const tokens = line.split(/\s+/);
155
+ const partial = tokens[tokens.length - 1] || '';
156
+ const tokenIndex = tokens.length - 1;
157
+ const ctx = { line, cursor, tokens, partial, tokenIndex };
158
+ for (const provider of this.providers) {
159
+ if (provider.match(ctx)) {
160
+ const results = provider.complete(ctx);
161
+ if (results.length > 0) {
162
+ return [results, partial];
163
+ }
164
+ }
165
+ }
166
+ return [[], partial];
167
+ }
168
+ }
@@ -0,0 +1,2 @@
1
+ export { main } from './main';
2
+ export { createProgram } from './commands';
@@ -0,0 +1,95 @@
1
+ import { createProgram } from "./commands";
2
+ import { bootstrap } from "../core/bootstrap";
3
+ import { Repl } from "./repl";
4
+ import { formatMarkdown } from "../ui/md-formatter";
5
+ import { Renderer } from "../ui/renderer";
6
+ import { runSetup } from "./setup";
7
+ import { saveConfig } from "../config/config";
8
+ import { t } from "../i18n/index";
9
+ import { pc } from "../ui/colors";
10
+ import { existsSync } from "fs";
11
+ import { join } from "path";
12
+ import { homedir } from "os";
13
+ async function main() {
14
+ const program = createProgram();
15
+ program.parse(process.argv);
16
+ const cmdNames = new Set(program.commands.map((c) => c.name()));
17
+ const opts = program.opts();
18
+ const noAgentsMd = opts.noAgentsMd === true;
19
+ const projectDir = opts.dir;
20
+ const exitOnComplete = opts.exitOnComplete === true;
21
+ const jsonMode = opts.json === true;
22
+ const isSubcommand = program.args.length > 0 && cmdNames.has(program.args[0]);
23
+ if (isSubcommand) {
24
+ return;
25
+ }
26
+ if (program.args.length > 0) {
27
+ const prompt = program.args.join(" ");
28
+ const { agent, config } = await bootstrap(undefined, projectDir, noAgentsMd, exitOnComplete);
29
+ if (jsonMode) {
30
+ const result = await agent.run(prompt);
31
+ agent.shutdown();
32
+ process.stdout.write(JSON.stringify({
33
+ success: result.success,
34
+ text: result.text,
35
+ error: result.error ?? null,
36
+ iterationCount: result.iterationCount,
37
+ contextUsed: result.contextUsed ?? null,
38
+ contextLimit: result.contextLimit ?? null,
39
+ }, null, 2));
40
+ process.stdout.write("\n");
41
+ process.exit(result.success ? 0 : 1);
42
+ }
43
+ const renderer = new Renderer({ spinner: config.ui?.spinner ?? true });
44
+ const result = await agent.run(prompt, (chunk) => renderer.text(chunk), (meta) => renderer.meta(meta), (ev) => {
45
+ if (ev.type === "start") {
46
+ renderer.toolStart(ev.tool, ev.args);
47
+ }
48
+ else {
49
+ renderer.toolEnd(ev.tool, ev.duration ?? 0, ev.error);
50
+ }
51
+ }, (phase) => {
52
+ if (phase === "thinking") {
53
+ renderer.thinkingStart();
54
+ }
55
+ else {
56
+ renderer.thinkingEnd();
57
+ }
58
+ });
59
+ renderer.flush();
60
+ if (result.success) {
61
+ if (!result.text) {
62
+ console.log(pc.yellow(t("cli.no_output")));
63
+ }
64
+ }
65
+ else {
66
+ console.error(`${t("error.prefix")}${result.error}`);
67
+ if (result.text) {
68
+ console.log(formatMarkdown(result.text));
69
+ }
70
+ process.exit(1);
71
+ }
72
+ agent.shutdown();
73
+ }
74
+ else {
75
+ const configPath = join(homedir(), ".mma", "config.json");
76
+ if (!existsSync(configPath)) {
77
+ console.log(pc.yellow("\n " + t("cli.first_run") + "\n"));
78
+ const answers = await runSetup();
79
+ const { config } = await bootstrap(undefined, projectDir, noAgentsMd, exitOnComplete);
80
+ config.provider.type = answers.provider;
81
+ config.provider.baseUrl = answers.apiBase;
82
+ config.provider.apiKey = answers.apiKey;
83
+ config.model = answers.model;
84
+ config.contextWindow = answers.contextWindow;
85
+ config.maxToolIterations = answers.maxToolIterations;
86
+ config.locale = answers.locale;
87
+ saveConfig(config, configPath);
88
+ }
89
+ const { agent, config, sessionManager, skillsModule, pluginManager, configDir, baseDir, } = await bootstrap(undefined, projectDir, noAgentsMd, exitOnComplete);
90
+ const repl = new Repl(agent, config, sessionManager, skillsModule, pluginManager, configDir, baseDir, noAgentsMd);
91
+ repl.start();
92
+ }
93
+ }
94
+ main();
95
+ export { main };