micro-models-agent 0.18.1 → 0.18.2
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.
- package/README.md +312 -312
- package/bin/mma.mjs +8 -8
- package/dist/cli/commands.js +19 -2
- package/dist/cli/repl.js +27 -4
- package/dist/i18n/en.json +1 -1
- package/dist/i18n/ru.json +1 -1
- package/dist/main.js +5691 -3805
- package/dist/tools/question.js +11 -11
- package/package.json +44 -44
- package/dist/modules/context/history.js +0 -15
package/bin/mma.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
3
|
-
import { dirname, join } from "node:path";
|
|
4
|
-
|
|
5
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
-
const main = join(__dirname, "..", "dist", "main.js");
|
|
7
|
-
|
|
8
|
-
await import(pathToFileURL(main).href);
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
|
|
5
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
const main = join(__dirname, "..", "dist", "main.js");
|
|
7
|
+
|
|
8
|
+
await import(pathToFileURL(main).href);
|
package/dist/cli/commands.js
CHANGED
|
@@ -3,10 +3,27 @@ import { bootstrap } from "../core/bootstrap";
|
|
|
3
3
|
import { saveConfig } from "../config/config";
|
|
4
4
|
import { runSetup } from "./setup";
|
|
5
5
|
import { t } from "../i18n/index";
|
|
6
|
-
import { join } from "path";
|
|
6
|
+
import { join, dirname } from "path";
|
|
7
7
|
import { homedir } from "os";
|
|
8
|
+
import { existsSync, readFileSync } from "fs";
|
|
8
9
|
import { createSecurityCommand } from "./security-commands";
|
|
9
|
-
import {
|
|
10
|
+
import { fileURLToPath } from "url";
|
|
11
|
+
function readVersion() {
|
|
12
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
13
|
+
const candidates = [
|
|
14
|
+
join(here, "..", "..", "package.json"),
|
|
15
|
+
join(here, "..", "package.json"),
|
|
16
|
+
];
|
|
17
|
+
for (const p of candidates) {
|
|
18
|
+
if (existsSync(p)) {
|
|
19
|
+
const raw = JSON.parse(readFileSync(p, "utf8"));
|
|
20
|
+
if (raw.version)
|
|
21
|
+
return raw.version;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return "0.0.0";
|
|
25
|
+
}
|
|
26
|
+
const version = readVersion();
|
|
10
27
|
export function createProgram() {
|
|
11
28
|
const program = new Command()
|
|
12
29
|
.name("mma")
|
package/dist/cli/repl.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as readline from "readline";
|
|
2
2
|
import { pc } from "../ui/colors";
|
|
3
3
|
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
4
|
-
import { join } from "path";
|
|
4
|
+
import { join, dirname } from "path";
|
|
5
5
|
import { homedir } from "os";
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
6
7
|
import { Completer, SlashCommandProvider, SessionNameProvider, SubcommandProvider, SkillNameProvider, } from "./completer";
|
|
7
8
|
import { Renderer } from "../ui/renderer";
|
|
8
9
|
import { box } from "../ui/box";
|
|
@@ -11,6 +12,22 @@ import { t } from "../i18n/index";
|
|
|
11
12
|
import { runSetup } from "./setup";
|
|
12
13
|
import { saveConfig } from "../config/config";
|
|
13
14
|
import { getMessageText } from "../llm/provider";
|
|
15
|
+
function readVersion() {
|
|
16
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
17
|
+
const candidates = [
|
|
18
|
+
join(here, "..", "..", "package.json"),
|
|
19
|
+
join(here, "..", "package.json"),
|
|
20
|
+
];
|
|
21
|
+
for (const p of candidates) {
|
|
22
|
+
if (existsSync(p)) {
|
|
23
|
+
const raw = JSON.parse(readFileSync(p, "utf8"));
|
|
24
|
+
if (raw.version)
|
|
25
|
+
return raw.version;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return "0.0.0";
|
|
29
|
+
}
|
|
30
|
+
const version = readVersion();
|
|
14
31
|
const COMMAND_GROUPS = {
|
|
15
32
|
help: "general",
|
|
16
33
|
exit: "general",
|
|
@@ -172,7 +189,8 @@ export class Repl {
|
|
|
172
189
|
dataUrl = result.dataUrl;
|
|
173
190
|
label = "clipboard";
|
|
174
191
|
}
|
|
175
|
-
else if (source.startsWith("http://") ||
|
|
192
|
+
else if (source.startsWith("http://") ||
|
|
193
|
+
source.startsWith("https://")) {
|
|
176
194
|
const result = await loadUrlAsDataUrl(source);
|
|
177
195
|
dataUrl = result.dataUrl;
|
|
178
196
|
label = source;
|
|
@@ -813,7 +831,9 @@ export class Repl {
|
|
|
813
831
|
this.pendingClipboardImage = null;
|
|
814
832
|
}
|
|
815
833
|
process.stdout.write("\n" + pc.green(t("repl.agent")));
|
|
816
|
-
const renderer = new Renderer({
|
|
834
|
+
const renderer = new Renderer({
|
|
835
|
+
spinner: this.config.ui?.spinner ?? true,
|
|
836
|
+
});
|
|
817
837
|
const result = await this.agent.run(input, (c) => renderer.text(c), (m) => renderer.meta(m), (ev) => {
|
|
818
838
|
if (ev.type === "start") {
|
|
819
839
|
renderer.toolStart(ev.tool, ev.args);
|
|
@@ -972,7 +992,10 @@ export class Repl {
|
|
|
972
992
|
row(t("repl.session_label"), `${pc.cyan(meta.name)} ${pc.dim(`(${meta.id.slice(0, 12)})`)} — ${meta.messageCount} msgs ${pc.dim(sessionPath)}`);
|
|
973
993
|
}
|
|
974
994
|
const headerWidth = Math.max(50, Math.min(96, process.stdout.columns || 96));
|
|
975
|
-
for (const line of box(info, {
|
|
995
|
+
for (const line of box(info, {
|
|
996
|
+
title: t("repl.title", { version }),
|
|
997
|
+
width: headerWidth,
|
|
998
|
+
})) {
|
|
976
999
|
console.log(line);
|
|
977
1000
|
}
|
|
978
1001
|
console.log();
|
package/dist/i18n/en.json
CHANGED
|
@@ -290,7 +290,7 @@
|
|
|
290
290
|
"repl.skill_unknown_sub": "Unknown skill subcommand: {subcmd}",
|
|
291
291
|
"repl.skill_usage": "Usage: /skill [list|loaded|load|unload|search]",
|
|
292
292
|
"repl.agent": "Agent: ",
|
|
293
|
-
"repl.title": "MMA REPL
|
|
293
|
+
"repl.title": "MMA REPL v{version}",
|
|
294
294
|
"repl.model": "Model:",
|
|
295
295
|
"repl.provider": "Provider:",
|
|
296
296
|
"repl.context": "Context:",
|
package/dist/i18n/ru.json
CHANGED
|
@@ -286,7 +286,7 @@
|
|
|
286
286
|
"repl.skill_unknown_sub": "Неизвестная подкоманда скилла: {subcmd}",
|
|
287
287
|
"repl.skill_usage": "Использование: /skill [list|loaded|load|unload|search]",
|
|
288
288
|
"repl.agent": "Агент: ",
|
|
289
|
-
"repl.title": "MMA REPL
|
|
289
|
+
"repl.title": "MMA REPL v{version}",
|
|
290
290
|
"repl.model": "Модель:",
|
|
291
291
|
"repl.provider": "Провайдер:",
|
|
292
292
|
"repl.context": "Контекст:",
|