micro-models-agent 0.52.0 → 0.53.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.
- package/dist/certification/certifications.json +331 -0
- package/dist/main.js +249 -149
- package/package.json +1 -1
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"certifications": [
|
|
4
|
+
{
|
|
5
|
+
"model": "qwen3.5-9b",
|
|
6
|
+
"providerUrl": "http://localhost:1234/v1",
|
|
7
|
+
"mmaVersion": "0.51.2",
|
|
8
|
+
"certifiedAt": "2026-08-24T21:15:56.331Z",
|
|
9
|
+
"suite": {
|
|
10
|
+
"passed": 18,
|
|
11
|
+
"failed": 2,
|
|
12
|
+
"skipped": 1,
|
|
13
|
+
"total": 21
|
|
14
|
+
},
|
|
15
|
+
"results": [
|
|
16
|
+
{
|
|
17
|
+
"id": "2.1-read-file",
|
|
18
|
+
"title": "Read file content",
|
|
19
|
+
"status": "pass",
|
|
20
|
+
"passed": 1,
|
|
21
|
+
"of": 1
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"id": "2.2-create-file",
|
|
25
|
+
"title": "Create single file",
|
|
26
|
+
"status": "pass",
|
|
27
|
+
"passed": 1,
|
|
28
|
+
"of": 1
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"id": "2.3-create-dir-file",
|
|
32
|
+
"title": "Create directory and file",
|
|
33
|
+
"status": "pass",
|
|
34
|
+
"passed": 1,
|
|
35
|
+
"of": 1
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"id": "2.4-edit-file",
|
|
39
|
+
"title": "Create then edit file",
|
|
40
|
+
"status": "pass",
|
|
41
|
+
"passed": 1,
|
|
42
|
+
"of": 1
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"id": "2.5-read-edit-chain",
|
|
46
|
+
"title": "Read existing file then edit it",
|
|
47
|
+
"status": "pass",
|
|
48
|
+
"passed": 1,
|
|
49
|
+
"of": 1
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"id": "2.6-move-file",
|
|
53
|
+
"title": "Move/rename file",
|
|
54
|
+
"status": "pass",
|
|
55
|
+
"passed": 1,
|
|
56
|
+
"of": 1
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"id": "2.7-delete-file",
|
|
60
|
+
"title": "Delete a file",
|
|
61
|
+
"status": "pass",
|
|
62
|
+
"passed": 1,
|
|
63
|
+
"of": 1
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"id": "2.8-create-dir",
|
|
67
|
+
"title": "Create directory standalone",
|
|
68
|
+
"status": "pass",
|
|
69
|
+
"passed": 1,
|
|
70
|
+
"of": 1
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"id": "2.9-list-dir",
|
|
74
|
+
"title": "List directory contents",
|
|
75
|
+
"status": "pass",
|
|
76
|
+
"passed": 1,
|
|
77
|
+
"of": 1
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"id": "2.10-file-info",
|
|
81
|
+
"title": "Get file info",
|
|
82
|
+
"status": "pass",
|
|
83
|
+
"passed": 1,
|
|
84
|
+
"of": 1
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"id": "3.1-calculator",
|
|
88
|
+
"title": "Multi-step calculator module",
|
|
89
|
+
"status": "pass",
|
|
90
|
+
"passed": 1,
|
|
91
|
+
"of": 1
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"id": "3.5-data-pipeline",
|
|
95
|
+
"title": "Data processing pipeline",
|
|
96
|
+
"status": "fail",
|
|
97
|
+
"passed": 0,
|
|
98
|
+
"of": 1,
|
|
99
|
+
"error": "file missing: output.json",
|
|
100
|
+
"diagnostics": " Files created: data/input.json, src/process.ts\n Plan: 1/4 steps done\n Pending: #2 Создать src/process.ts — скрипт на Bun/TypeScript для чтения input.json, фильтрации value > 50 и записи output.json; #3 Запустить скрипт через bun run process.ts; #4 Проверить результат: подтвердить существование output.json с отфильтрованными данными"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"id": "3.6-bash-run",
|
|
104
|
+
"title": "Run bash command and capture output",
|
|
105
|
+
"status": "pass",
|
|
106
|
+
"passed": 1,
|
|
107
|
+
"of": 1
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"id": "3.7-grep-search",
|
|
111
|
+
"title": "Search file contents with grep",
|
|
112
|
+
"status": "pass",
|
|
113
|
+
"passed": 1,
|
|
114
|
+
"of": 1
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"id": "3.8-glob-find",
|
|
118
|
+
"title": "Find files with glob",
|
|
119
|
+
"status": "fail",
|
|
120
|
+
"passed": 0,
|
|
121
|
+
"of": 1,
|
|
122
|
+
"error": "glob-result.txt does not contains \"a.ts\"; glob-result.txt does not contains \"b.ts\"",
|
|
123
|
+
"diagnostics": " Files created: glob-result.txt, lib/c.ts, src/a.ts, src/b.ts\n Plan: 4/5 steps done\n Pending: #5 Выполнить glob для поиска всех .ts файлов в src/**/*.ts и сохранить результат в glob-result.txt"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"id": "3.9-multi-tool-chain",
|
|
127
|
+
"title": "Read → grep → edit chain",
|
|
128
|
+
"status": "pass",
|
|
129
|
+
"passed": 1,
|
|
130
|
+
"of": 1
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"id": "1.1-question-tool",
|
|
134
|
+
"title": "Question tool (removed)",
|
|
135
|
+
"status": "skipped",
|
|
136
|
+
"passed": 0,
|
|
137
|
+
"of": 0
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"id": "6.1-plan-create-execute",
|
|
141
|
+
"title": "Plan creation and step tracking",
|
|
142
|
+
"status": "pass",
|
|
143
|
+
"passed": 1,
|
|
144
|
+
"of": 1
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"id": "7.1-subagent-file",
|
|
148
|
+
"title": "Subagent writes file in isolated scope",
|
|
149
|
+
"status": "pass",
|
|
150
|
+
"passed": 1,
|
|
151
|
+
"of": 1
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"id": "8.1-enable-tools",
|
|
155
|
+
"title": "Enable hidden tools on demand",
|
|
156
|
+
"status": "pass",
|
|
157
|
+
"passed": 1,
|
|
158
|
+
"of": 1
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"id": "9.1-lsp-check",
|
|
162
|
+
"title": "LSP detects TypeScript errors",
|
|
163
|
+
"status": "pass",
|
|
164
|
+
"passed": 1,
|
|
165
|
+
"of": 1
|
|
166
|
+
}
|
|
167
|
+
]
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"model": "qwen/qwen3.5-9b",
|
|
171
|
+
"providerUrl": "http://localhost:1234/v1",
|
|
172
|
+
"mmaVersion": "0.51.2",
|
|
173
|
+
"certifiedAt": "2026-08-25T08:52:56.159Z",
|
|
174
|
+
"suite": {
|
|
175
|
+
"passed": 20,
|
|
176
|
+
"failed": 0,
|
|
177
|
+
"skipped": 1,
|
|
178
|
+
"total": 21
|
|
179
|
+
},
|
|
180
|
+
"results": [
|
|
181
|
+
{
|
|
182
|
+
"id": "2.1-read-file",
|
|
183
|
+
"title": "Read file content",
|
|
184
|
+
"status": "pass",
|
|
185
|
+
"passed": 3,
|
|
186
|
+
"of": 3
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"id": "2.2-create-file",
|
|
190
|
+
"title": "Create single file",
|
|
191
|
+
"status": "pass",
|
|
192
|
+
"passed": 3,
|
|
193
|
+
"of": 3
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"id": "2.3-create-dir-file",
|
|
197
|
+
"title": "Create directory and file",
|
|
198
|
+
"status": "pass",
|
|
199
|
+
"passed": 3,
|
|
200
|
+
"of": 3
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"id": "2.4-edit-file",
|
|
204
|
+
"title": "Create then edit file",
|
|
205
|
+
"status": "pass",
|
|
206
|
+
"passed": 3,
|
|
207
|
+
"of": 3
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"id": "2.5-read-edit-chain",
|
|
211
|
+
"title": "Read existing file then edit it",
|
|
212
|
+
"status": "pass",
|
|
213
|
+
"passed": 3,
|
|
214
|
+
"of": 3
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"id": "2.6-move-file",
|
|
218
|
+
"title": "Move/rename file",
|
|
219
|
+
"status": "pass",
|
|
220
|
+
"passed": 3,
|
|
221
|
+
"of": 3
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"id": "2.7-delete-file",
|
|
225
|
+
"title": "Delete a file",
|
|
226
|
+
"status": "pass",
|
|
227
|
+
"passed": 3,
|
|
228
|
+
"of": 3
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"id": "2.8-create-dir",
|
|
232
|
+
"title": "Create directory standalone",
|
|
233
|
+
"status": "pass",
|
|
234
|
+
"passed": 3,
|
|
235
|
+
"of": 3
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"id": "2.9-list-dir",
|
|
239
|
+
"title": "List directory contents",
|
|
240
|
+
"status": "pass",
|
|
241
|
+
"passed": 3,
|
|
242
|
+
"of": 3
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"id": "2.10-file-info",
|
|
246
|
+
"title": "Get file info",
|
|
247
|
+
"status": "pass",
|
|
248
|
+
"passed": 3,
|
|
249
|
+
"of": 3
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
"id": "3.1-calculator",
|
|
253
|
+
"title": "Multi-step calculator module",
|
|
254
|
+
"status": "pass",
|
|
255
|
+
"passed": 3,
|
|
256
|
+
"of": 3
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"id": "3.5-data-pipeline",
|
|
260
|
+
"title": "Data processing pipeline",
|
|
261
|
+
"status": "pass",
|
|
262
|
+
"passed": 3,
|
|
263
|
+
"of": 3
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
"id": "3.6-bash-run",
|
|
267
|
+
"title": "Run bash command and capture output",
|
|
268
|
+
"status": "pass",
|
|
269
|
+
"passed": 3,
|
|
270
|
+
"of": 3
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"id": "3.7-grep-search",
|
|
274
|
+
"title": "Search file contents with grep",
|
|
275
|
+
"status": "pass",
|
|
276
|
+
"passed": 3,
|
|
277
|
+
"of": 3
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"id": "3.8-glob-find",
|
|
281
|
+
"title": "Find files with glob",
|
|
282
|
+
"status": "pass",
|
|
283
|
+
"passed": 3,
|
|
284
|
+
"of": 3
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
"id": "3.9-multi-tool-chain",
|
|
288
|
+
"title": "Read → grep → edit chain",
|
|
289
|
+
"status": "pass",
|
|
290
|
+
"passed": 3,
|
|
291
|
+
"of": 3
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
"id": "1.1-question-tool",
|
|
295
|
+
"title": "Question tool (removed)",
|
|
296
|
+
"status": "skipped",
|
|
297
|
+
"passed": 0,
|
|
298
|
+
"of": 0
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"id": "6.1-plan-create-execute",
|
|
302
|
+
"title": "Plan creation and step tracking",
|
|
303
|
+
"status": "pass",
|
|
304
|
+
"passed": 3,
|
|
305
|
+
"of": 3
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
"id": "7.1-subagent-file",
|
|
309
|
+
"title": "Subagent writes file in isolated scope",
|
|
310
|
+
"status": "pass",
|
|
311
|
+
"passed": 3,
|
|
312
|
+
"of": 3
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
"id": "8.1-enable-tools",
|
|
316
|
+
"title": "Enable hidden tools on demand",
|
|
317
|
+
"status": "pass",
|
|
318
|
+
"passed": 3,
|
|
319
|
+
"of": 3
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
"id": "9.1-lsp-check",
|
|
323
|
+
"title": "LSP detects TypeScript errors",
|
|
324
|
+
"status": "pass",
|
|
325
|
+
"passed": 3,
|
|
326
|
+
"of": 3
|
|
327
|
+
}
|
|
328
|
+
]
|
|
329
|
+
}
|
|
330
|
+
]
|
|
331
|
+
}
|
package/dist/main.js
CHANGED
|
@@ -23159,15 +23159,175 @@ var init_environment = __esm(() => {
|
|
|
23159
23159
|
TOOL_CHECKS = ["bun", "node", "git", "python"];
|
|
23160
23160
|
});
|
|
23161
23161
|
|
|
23162
|
+
// src/modules/certification/manifest.ts
|
|
23163
|
+
var exports_manifest = {};
|
|
23164
|
+
__export(exports_manifest, {
|
|
23165
|
+
upsertCertification: () => upsertCertification,
|
|
23166
|
+
syncGlobalManifest: () => syncGlobalManifest,
|
|
23167
|
+
saveManifest: () => saveManifest,
|
|
23168
|
+
saveGlobalManifest: () => saveGlobalManifest,
|
|
23169
|
+
removeCertification: () => removeCertification,
|
|
23170
|
+
readMergedManifest: () => readMergedManifest,
|
|
23171
|
+
readManifest: () => readManifest,
|
|
23172
|
+
readGlobalManifest: () => readGlobalManifest,
|
|
23173
|
+
manifestPath: () => manifestPath,
|
|
23174
|
+
isStale: () => isStale,
|
|
23175
|
+
isFullyPassed: () => isFullyPassed,
|
|
23176
|
+
globalManifestPath: () => globalManifestPath,
|
|
23177
|
+
globalManifestDir: () => globalManifestDir,
|
|
23178
|
+
getCertMark: () => getCertMark,
|
|
23179
|
+
bundledManifestPath: () => bundledManifestPath
|
|
23180
|
+
});
|
|
23181
|
+
import { existsSync as existsSync47, readFileSync as readFileSync30, mkdirSync as mkdirSync19, writeFileSync as writeFileSync16 } from "fs";
|
|
23182
|
+
import { dirname as dirname15, join as join40 } from "path";
|
|
23183
|
+
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
23184
|
+
import { homedir as homedir13 } from "os";
|
|
23185
|
+
function manifestPath(projectDir) {
|
|
23186
|
+
return join40(projectDir, "certification", "certifications.json");
|
|
23187
|
+
}
|
|
23188
|
+
function globalManifestDir(override) {
|
|
23189
|
+
return override || process.env.MMA_CERT_HOME || join40(homedir13(), ".mma");
|
|
23190
|
+
}
|
|
23191
|
+
function globalManifestPath(override) {
|
|
23192
|
+
return join40(globalManifestDir(override), "certifications.json");
|
|
23193
|
+
}
|
|
23194
|
+
function readManifest(projectDir) {
|
|
23195
|
+
const path = manifestPath(projectDir);
|
|
23196
|
+
try {
|
|
23197
|
+
if (existsSync47(path)) {
|
|
23198
|
+
const raw = JSON.parse(readFileSync30(path, "utf-8"));
|
|
23199
|
+
return { version: 1, certifications: raw.certifications ?? [] };
|
|
23200
|
+
}
|
|
23201
|
+
} catch {}
|
|
23202
|
+
return { version: 1, certifications: [] };
|
|
23203
|
+
}
|
|
23204
|
+
function saveManifest(m, projectDir) {
|
|
23205
|
+
const path = manifestPath(projectDir);
|
|
23206
|
+
mkdirSync19(join40(projectDir, "certification"), { recursive: true });
|
|
23207
|
+
writeFileSync16(path, JSON.stringify(m, null, 2), "utf-8");
|
|
23208
|
+
}
|
|
23209
|
+
function readGlobalManifest(override) {
|
|
23210
|
+
const path = globalManifestPath(override);
|
|
23211
|
+
try {
|
|
23212
|
+
if (existsSync47(path)) {
|
|
23213
|
+
const raw = JSON.parse(readFileSync30(path, "utf-8"));
|
|
23214
|
+
return { version: 1, certifications: raw.certifications ?? [] };
|
|
23215
|
+
}
|
|
23216
|
+
} catch {}
|
|
23217
|
+
return { version: 1, certifications: [] };
|
|
23218
|
+
}
|
|
23219
|
+
function saveGlobalManifest(m, override) {
|
|
23220
|
+
const dir = globalManifestDir(override);
|
|
23221
|
+
mkdirSync19(dir, { recursive: true });
|
|
23222
|
+
writeFileSync16(globalManifestPath(override), JSON.stringify(m, null, 2), "utf-8");
|
|
23223
|
+
}
|
|
23224
|
+
function readMergedManifest(projectDir, override) {
|
|
23225
|
+
const merged = new Map;
|
|
23226
|
+
for (const e of readGlobalManifest(override).certifications)
|
|
23227
|
+
merged.set(certKey(e), e);
|
|
23228
|
+
for (const e of readManifest(projectDir).certifications)
|
|
23229
|
+
merged.set(certKey(e), e);
|
|
23230
|
+
return { version: 1, certifications: [...merged.values()] };
|
|
23231
|
+
}
|
|
23232
|
+
function upsertCertification(entry, override) {
|
|
23233
|
+
const m = readGlobalManifest(override);
|
|
23234
|
+
const idx = m.certifications.findIndex((e) => certKey(e) === certKey(entry));
|
|
23235
|
+
if (idx >= 0)
|
|
23236
|
+
m.certifications[idx] = entry;
|
|
23237
|
+
else
|
|
23238
|
+
m.certifications.push(entry);
|
|
23239
|
+
saveGlobalManifest(m, override);
|
|
23240
|
+
return m;
|
|
23241
|
+
}
|
|
23242
|
+
function removeCertification(model, providerUrl, opts) {
|
|
23243
|
+
const key = `${model}::${providerUrl}`;
|
|
23244
|
+
const g = readGlobalManifest(opts?.globalDir);
|
|
23245
|
+
const beforeG = g.certifications.length;
|
|
23246
|
+
g.certifications = g.certifications.filter((e) => certKey(e) !== key);
|
|
23247
|
+
const removedGlobal = g.certifications.length !== beforeG;
|
|
23248
|
+
if (removedGlobal)
|
|
23249
|
+
saveGlobalManifest(g, opts?.globalDir);
|
|
23250
|
+
let removedProject = false;
|
|
23251
|
+
try {
|
|
23252
|
+
const projectDir = opts?.projectDir ?? process.cwd();
|
|
23253
|
+
const p = readManifest(projectDir);
|
|
23254
|
+
const beforeP = p.certifications.length;
|
|
23255
|
+
p.certifications = p.certifications.filter((e) => certKey(e) !== key);
|
|
23256
|
+
if (p.certifications.length !== beforeP) {
|
|
23257
|
+
saveManifest(p, projectDir);
|
|
23258
|
+
removedProject = true;
|
|
23259
|
+
}
|
|
23260
|
+
} catch {}
|
|
23261
|
+
return { global: removedGlobal, project: removedProject };
|
|
23262
|
+
}
|
|
23263
|
+
function isStale(entry, currentVersion) {
|
|
23264
|
+
return entry.mmaVersion !== currentVersion;
|
|
23265
|
+
}
|
|
23266
|
+
function isFullyPassed(entry) {
|
|
23267
|
+
return entry.suite.failed === 0 && entry.suite.passed > 0;
|
|
23268
|
+
}
|
|
23269
|
+
function getCertMark(model, providerUrl, currentVersion, projectDir, globalOverride) {
|
|
23270
|
+
const m = readMergedManifest(projectDir, globalOverride);
|
|
23271
|
+
const entry = m.certifications.find((e) => e.model === model && e.providerUrl === providerUrl);
|
|
23272
|
+
if (!entry)
|
|
23273
|
+
return "none";
|
|
23274
|
+
if (isStale(entry, currentVersion))
|
|
23275
|
+
return "stale";
|
|
23276
|
+
return isFullyPassed(entry) ? "certified" : "none";
|
|
23277
|
+
}
|
|
23278
|
+
function syncSnapshotPath(override) {
|
|
23279
|
+
return join40(globalManifestDir(override), "certifications.synced.json");
|
|
23280
|
+
}
|
|
23281
|
+
function bundledManifestPath() {
|
|
23282
|
+
const here = dirname15(fileURLToPath4(import.meta.url));
|
|
23283
|
+
const candidates = [
|
|
23284
|
+
join40(here, "certification", "certifications.json"),
|
|
23285
|
+
join40(here, "..", "certification", "certifications.json"),
|
|
23286
|
+
join40(here, "..", "..", "..", "certification", "certifications.json")
|
|
23287
|
+
];
|
|
23288
|
+
for (const p of candidates) {
|
|
23289
|
+
if (existsSync47(p))
|
|
23290
|
+
return p;
|
|
23291
|
+
}
|
|
23292
|
+
return null;
|
|
23293
|
+
}
|
|
23294
|
+
function syncGlobalManifest(override, bundledPathOverride) {
|
|
23295
|
+
try {
|
|
23296
|
+
const bundledPath = bundledPathOverride ?? bundledManifestPath();
|
|
23297
|
+
if (!bundledPath || !existsSync47(bundledPath))
|
|
23298
|
+
return { synced: false, reason: "no-bundled" };
|
|
23299
|
+
const raw = readFileSync30(bundledPath, "utf-8");
|
|
23300
|
+
const snapshotPath = syncSnapshotPath(override);
|
|
23301
|
+
if (existsSync47(snapshotPath) && readFileSync30(snapshotPath, "utf-8") === raw) {
|
|
23302
|
+
return { synced: false, reason: "unchanged" };
|
|
23303
|
+
}
|
|
23304
|
+
const bundled = JSON.parse(raw);
|
|
23305
|
+
const current = readGlobalManifest(override);
|
|
23306
|
+
const merged = new Map;
|
|
23307
|
+
for (const e of current.certifications)
|
|
23308
|
+
merged.set(certKey(e), e);
|
|
23309
|
+
for (const e of bundled.certifications ?? [])
|
|
23310
|
+
merged.set(certKey(e), e);
|
|
23311
|
+
saveGlobalManifest({ version: 1, certifications: [...merged.values()] }, override);
|
|
23312
|
+
mkdirSync19(globalManifestDir(override), { recursive: true });
|
|
23313
|
+
writeFileSync16(snapshotPath, raw, "utf-8");
|
|
23314
|
+
return { synced: true, reason: "synced" };
|
|
23315
|
+
} catch {
|
|
23316
|
+
return { synced: false, reason: "error" };
|
|
23317
|
+
}
|
|
23318
|
+
}
|
|
23319
|
+
var certKey = (e) => `${e.model}::${e.providerUrl}`;
|
|
23320
|
+
var init_manifest = () => {};
|
|
23321
|
+
|
|
23162
23322
|
// src/core/bootstrap.ts
|
|
23163
23323
|
var exports_bootstrap = {};
|
|
23164
23324
|
__export(exports_bootstrap, {
|
|
23165
23325
|
buildSystemInfo: () => buildSystemInfo,
|
|
23166
23326
|
bootstrap: () => bootstrap
|
|
23167
23327
|
});
|
|
23168
|
-
import { homedir as
|
|
23169
|
-
import { join as
|
|
23170
|
-
import { existsSync as
|
|
23328
|
+
import { homedir as homedir14 } from "os";
|
|
23329
|
+
import { join as join41, resolve as resolve23 } from "path";
|
|
23330
|
+
import { existsSync as existsSync48, readFileSync as readFileSync31, writeFileSync as writeFileSync17 } from "fs";
|
|
23171
23331
|
function buildSystemInfo(config, baseDir, profileCompressed) {
|
|
23172
23332
|
const now = new Date().toISOString().replace("T", " ").slice(0, 19);
|
|
23173
23333
|
const isWin = profileCompressed.toLowerCase().includes("win32");
|
|
@@ -23220,8 +23380,8 @@ function buildSystemInfo(config, baseDir, profileCompressed) {
|
|
|
23220
23380
|
`);
|
|
23221
23381
|
}
|
|
23222
23382
|
async function bootstrap(configDir, projectDir, noAgentsMd, exitOnComplete) {
|
|
23223
|
-
const dir = configDir || process.env.MMA_CONFIG_DIR ||
|
|
23224
|
-
const projectConfigPath = projectDir ?
|
|
23383
|
+
const dir = configDir || process.env.MMA_CONFIG_DIR || join41(homedir14(), ".mma");
|
|
23384
|
+
const projectConfigPath = projectDir ? join41(projectDir, ".mmrc") : join41(process.cwd(), ".mmrc");
|
|
23225
23385
|
const { config, legacyDetected } = loadConfig({ configDir: dir, projectConfigPath });
|
|
23226
23386
|
setLocale(config.locale);
|
|
23227
23387
|
try {
|
|
@@ -23231,11 +23391,18 @@ async function bootstrap(configDir, projectDir, noAgentsMd, exitOnComplete) {
|
|
|
23231
23391
|
}
|
|
23232
23392
|
} catch {}
|
|
23233
23393
|
const logger = new Logger(config.logLevel);
|
|
23234
|
-
logger.setLogDir(
|
|
23394
|
+
logger.setLogDir(join41(dir, "logs"));
|
|
23235
23395
|
logger.debug("MMA bootstrap", {
|
|
23236
23396
|
version: config.version,
|
|
23237
23397
|
model: config.model
|
|
23238
23398
|
});
|
|
23399
|
+
try {
|
|
23400
|
+
const { syncGlobalManifest: syncGlobalManifest2 } = await Promise.resolve().then(() => (init_manifest(), exports_manifest));
|
|
23401
|
+
const syncResult = syncGlobalManifest2();
|
|
23402
|
+
if (syncResult.synced) {
|
|
23403
|
+
logger.debug("Certification manifest synced from package");
|
|
23404
|
+
}
|
|
23405
|
+
} catch {}
|
|
23239
23406
|
if (config.modelLoad.autoLoad) {
|
|
23240
23407
|
const modelLoader = new ModelLoader(config.provider.baseUrl, logger);
|
|
23241
23408
|
const loadResult = await modelLoader.ensureModelLoaded({
|
|
@@ -23253,7 +23420,7 @@ async function bootstrap(configDir, projectDir, noAgentsMd, exitOnComplete) {
|
|
|
23253
23420
|
logger.info(`Model ${config.model} loaded in ${loadResult.loadTime}s`);
|
|
23254
23421
|
}
|
|
23255
23422
|
}
|
|
23256
|
-
const profile = new UserProfile(
|
|
23423
|
+
const profile = new UserProfile(join41(dir));
|
|
23257
23424
|
profile.load() || profile.collect();
|
|
23258
23425
|
profile.save();
|
|
23259
23426
|
const providerManager = new ProviderManager(config.provider, {
|
|
@@ -23279,7 +23446,7 @@ async function bootstrap(configDir, projectDir, noAgentsMd, exitOnComplete) {
|
|
|
23279
23446
|
for (const warning of envReport.warnings) {
|
|
23280
23447
|
logger.warn(warning);
|
|
23281
23448
|
}
|
|
23282
|
-
const projectMapCacheDir =
|
|
23449
|
+
const projectMapCacheDir = join41(baseDir, ".mma");
|
|
23283
23450
|
const indexerModule = new IndexerModule({
|
|
23284
23451
|
baseDir,
|
|
23285
23452
|
cacheDir: projectMapCacheDir
|
|
@@ -23290,9 +23457,9 @@ async function bootstrap(configDir, projectDir, noAgentsMd, exitOnComplete) {
|
|
|
23290
23457
|
logger.warn(`Project indexing failed: ${err.message}`);
|
|
23291
23458
|
}
|
|
23292
23459
|
const skillsLoader = new SkillsLoader;
|
|
23293
|
-
const builtinDir =
|
|
23294
|
-
const globalDir =
|
|
23295
|
-
const projectSkillsDir =
|
|
23460
|
+
const builtinDir = join41(import.meta.dirname, "skills", "builtin");
|
|
23461
|
+
const globalDir = join41(homedir14(), ".agents", "skills");
|
|
23462
|
+
const projectSkillsDir = join41(baseDir, ".mma", "skills");
|
|
23296
23463
|
const availableSkills = skillsLoader.loadFromAllSources(builtinDir, globalDir, projectSkillsDir);
|
|
23297
23464
|
const skillsBudget = Math.floor(config.contextWindow * config.skills.budget);
|
|
23298
23465
|
const skillsModule = new SkillsModule(availableSkills, skillsBudget);
|
|
@@ -23308,11 +23475,11 @@ async function bootstrap(configDir, projectDir, noAgentsMd, exitOnComplete) {
|
|
|
23308
23475
|
essential: true,
|
|
23309
23476
|
estimatedTokens: Math.ceil(systemInfoContent.length / 4)
|
|
23310
23477
|
};
|
|
23311
|
-
const agentsMdGlobal =
|
|
23312
|
-
if (!
|
|
23313
|
-
|
|
23478
|
+
const agentsMdGlobal = join41(dir, "AGENTS.md");
|
|
23479
|
+
if (!existsSync48(agentsMdGlobal)) {
|
|
23480
|
+
writeFileSync17(agentsMdGlobal, "", "utf-8");
|
|
23314
23481
|
}
|
|
23315
|
-
const sessionDir =
|
|
23482
|
+
const sessionDir = join41(dir, "sessions");
|
|
23316
23483
|
const sessionStore = new SessionStore(sessionDir);
|
|
23317
23484
|
sessionStore.init();
|
|
23318
23485
|
const sessionManager = new SessionManager(sessionStore, {
|
|
@@ -23386,7 +23553,7 @@ async function bootstrap(configDir, projectDir, noAgentsMd, exitOnComplete) {
|
|
|
23386
23553
|
const mcpModule = new MCPModule(config);
|
|
23387
23554
|
await mcpModule.initialize();
|
|
23388
23555
|
moduleRegistry.register(mcpModule);
|
|
23389
|
-
const memoryStore = new MemoryStore(
|
|
23556
|
+
const memoryStore = new MemoryStore(join41(dir, "memory"));
|
|
23390
23557
|
const memoryModule = new MemoryModule(memoryStore);
|
|
23391
23558
|
moduleRegistry.register(memoryModule);
|
|
23392
23559
|
if (config.browser.enabled) {
|
|
@@ -23440,8 +23607,8 @@ async function bootstrap(configDir, projectDir, noAgentsMd, exitOnComplete) {
|
|
|
23440
23607
|
pluginManager.register(plugin);
|
|
23441
23608
|
pluginManager.register(plugin2);
|
|
23442
23609
|
const pluginLoader = new PluginLoader;
|
|
23443
|
-
const globalPluginsDir =
|
|
23444
|
-
const projectPluginsDir =
|
|
23610
|
+
const globalPluginsDir = join41(homedir14(), ".mma", "plugins");
|
|
23611
|
+
const projectPluginsDir = join41(baseDir, ".mma", "plugins");
|
|
23445
23612
|
const mmaVersion = readMmaVersion();
|
|
23446
23613
|
pluginLoader.loadFromDir(globalPluginsDir, pluginManager, logger, {
|
|
23447
23614
|
source: "global",
|
|
@@ -23467,13 +23634,13 @@ async function bootstrap(configDir, projectDir, noAgentsMd, exitOnComplete) {
|
|
|
23467
23634
|
const skipAgentsMd = noAgentsMd === true;
|
|
23468
23635
|
if (!skipAgentsMd) {
|
|
23469
23636
|
const agentsMdCandidates = [
|
|
23470
|
-
|
|
23471
|
-
|
|
23472
|
-
|
|
23637
|
+
join41(baseDir, "AGENTS.md"),
|
|
23638
|
+
join41(baseDir, ".mma", "AGENTS.md"),
|
|
23639
|
+
join41(dir, "AGENTS.md")
|
|
23473
23640
|
];
|
|
23474
23641
|
for (const p of agentsMdCandidates) {
|
|
23475
|
-
if (
|
|
23476
|
-
const content =
|
|
23642
|
+
if (existsSync48(p)) {
|
|
23643
|
+
const content = readFileSync31(p, "utf-8").trim();
|
|
23477
23644
|
if (content) {
|
|
23478
23645
|
agentsMdBlocks.push({
|
|
23479
23646
|
content,
|
|
@@ -24336,75 +24503,6 @@ var init_setup = __esm(() => {
|
|
|
24336
24503
|
];
|
|
24337
24504
|
});
|
|
24338
24505
|
|
|
24339
|
-
// src/modules/certification/manifest.ts
|
|
24340
|
-
var exports_manifest = {};
|
|
24341
|
-
__export(exports_manifest, {
|
|
24342
|
-
upsertCertification: () => upsertCertification,
|
|
24343
|
-
saveManifest: () => saveManifest,
|
|
24344
|
-
removeCertification: () => removeCertification,
|
|
24345
|
-
readManifest: () => readManifest,
|
|
24346
|
-
manifestPath: () => manifestPath,
|
|
24347
|
-
isStale: () => isStale,
|
|
24348
|
-
isFullyPassed: () => isFullyPassed,
|
|
24349
|
-
getCertMark: () => getCertMark
|
|
24350
|
-
});
|
|
24351
|
-
import { existsSync as existsSync48, readFileSync as readFileSync31, mkdirSync as mkdirSync19, writeFileSync as writeFileSync17 } from "fs";
|
|
24352
|
-
import { join as join42 } from "path";
|
|
24353
|
-
function manifestPath(projectDir) {
|
|
24354
|
-
return join42(projectDir, "certification", "certifications.json");
|
|
24355
|
-
}
|
|
24356
|
-
function readManifest(projectDir) {
|
|
24357
|
-
const path = manifestPath(projectDir);
|
|
24358
|
-
try {
|
|
24359
|
-
if (existsSync48(path)) {
|
|
24360
|
-
const raw = JSON.parse(readFileSync31(path, "utf-8"));
|
|
24361
|
-
return { version: 1, certifications: raw.certifications ?? [] };
|
|
24362
|
-
}
|
|
24363
|
-
} catch {}
|
|
24364
|
-
return { version: 1, certifications: [] };
|
|
24365
|
-
}
|
|
24366
|
-
function saveManifest(m, projectDir) {
|
|
24367
|
-
const path = manifestPath(projectDir);
|
|
24368
|
-
mkdirSync19(join42(projectDir, "certification"), { recursive: true });
|
|
24369
|
-
writeFileSync17(path, JSON.stringify(m, null, 2), "utf-8");
|
|
24370
|
-
}
|
|
24371
|
-
function upsertCertification(entry, projectDir) {
|
|
24372
|
-
const m = readManifest(projectDir);
|
|
24373
|
-
const idx = m.certifications.findIndex((e) => e.model === entry.model && e.providerUrl === entry.providerUrl);
|
|
24374
|
-
if (idx >= 0)
|
|
24375
|
-
m.certifications[idx] = entry;
|
|
24376
|
-
else
|
|
24377
|
-
m.certifications.push(entry);
|
|
24378
|
-
saveManifest(m, projectDir);
|
|
24379
|
-
return m;
|
|
24380
|
-
}
|
|
24381
|
-
function removeCertification(model, providerUrl, projectDir) {
|
|
24382
|
-
const m = readManifest(projectDir);
|
|
24383
|
-
const before = m.certifications.length;
|
|
24384
|
-
m.certifications = m.certifications.filter((e) => !(e.model === model && e.providerUrl === providerUrl));
|
|
24385
|
-
if (m.certifications.length !== before) {
|
|
24386
|
-
saveManifest(m, projectDir);
|
|
24387
|
-
return true;
|
|
24388
|
-
}
|
|
24389
|
-
return false;
|
|
24390
|
-
}
|
|
24391
|
-
function isStale(entry, currentVersion) {
|
|
24392
|
-
return entry.mmaVersion !== currentVersion;
|
|
24393
|
-
}
|
|
24394
|
-
function isFullyPassed(entry) {
|
|
24395
|
-
return entry.suite.failed === 0 && entry.suite.passed > 0;
|
|
24396
|
-
}
|
|
24397
|
-
function getCertMark(model, providerUrl, currentVersion, projectDir) {
|
|
24398
|
-
const m = readManifest(projectDir);
|
|
24399
|
-
const entry = m.certifications.find((e) => e.model === model && e.providerUrl === providerUrl);
|
|
24400
|
-
if (!entry)
|
|
24401
|
-
return "none";
|
|
24402
|
-
if (isStale(entry, currentVersion))
|
|
24403
|
-
return "stale";
|
|
24404
|
-
return isFullyPassed(entry) ? "certified" : "none";
|
|
24405
|
-
}
|
|
24406
|
-
var init_manifest = () => {};
|
|
24407
|
-
|
|
24408
24506
|
// node_modules/yaml/dist/nodes/identity.js
|
|
24409
24507
|
var require_identity = __commonJS((exports) => {
|
|
24410
24508
|
var ALIAS = Symbol.for("yaml.alias");
|
|
@@ -31987,7 +32085,7 @@ var init_fact_checker = () => {};
|
|
|
31987
32085
|
import { spawn as spawn9 } from "child_process";
|
|
31988
32086
|
import { existsSync as existsSync51, mkdirSync as mkdirSync20, rmSync as rmSync4, cpSync as cpSync2, writeFileSync as writeFileSync18, readdirSync as readdirSync18, readFileSync as readFileSync34 } from "fs";
|
|
31989
32087
|
import { platform as platform10 } from "os";
|
|
31990
|
-
import { join as join45, resolve as resolve24, dirname as
|
|
32088
|
+
import { join as join45, resolve as resolve24, dirname as dirname17, relative as relative6 } from "path";
|
|
31991
32089
|
async function runScenario(scenario, opts) {
|
|
31992
32090
|
if (scenario.mode === "skip") {
|
|
31993
32091
|
return {
|
|
@@ -32085,7 +32183,7 @@ function prepareSandbox(sandbox, scenario, mmaRoot) {
|
|
|
32085
32183
|
throw new Error(`fixture missing: ${f.source}`);
|
|
32086
32184
|
}
|
|
32087
32185
|
const dest = join45(sandbox, f.dest);
|
|
32088
|
-
mkdirSync20(
|
|
32186
|
+
mkdirSync20(dirname17(dest), { recursive: true });
|
|
32089
32187
|
cpSync2(src, dest);
|
|
32090
32188
|
}
|
|
32091
32189
|
}
|
|
@@ -32223,8 +32321,8 @@ __export(exports_cli, {
|
|
|
32223
32321
|
certList: () => certList
|
|
32224
32322
|
});
|
|
32225
32323
|
import { rmSync as rmSync5, writeFileSync as writeFileSync19 } from "fs";
|
|
32226
|
-
import { join as join46, dirname as
|
|
32227
|
-
import { fileURLToPath as
|
|
32324
|
+
import { join as join46, dirname as dirname18 } from "path";
|
|
32325
|
+
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
32228
32326
|
import { existsSync as existsSync52, readFileSync as readFileSync35 } from "fs";
|
|
32229
32327
|
function readVersion() {
|
|
32230
32328
|
const candidates = [join46(MMA_ROOT, "package.json")];
|
|
@@ -32253,7 +32351,7 @@ async function certify(opts) {
|
|
|
32253
32351
|
process.exitCode = 1;
|
|
32254
32352
|
return;
|
|
32255
32353
|
}
|
|
32256
|
-
const manifest =
|
|
32354
|
+
const manifest = readMergedManifest(opts.projectDir);
|
|
32257
32355
|
const existing = manifest.certifications.find((e) => e.model === opts.name && e.providerUrl === providerUrl);
|
|
32258
32356
|
if (existing && !opts.force) {
|
|
32259
32357
|
console.error(pc2.yellow(t("cli.cert_exists", { model: opts.name })));
|
|
@@ -32312,7 +32410,7 @@ async function certify(opts) {
|
|
|
32312
32410
|
suite,
|
|
32313
32411
|
results
|
|
32314
32412
|
};
|
|
32315
|
-
upsertCertification(entry
|
|
32413
|
+
upsertCertification(entry);
|
|
32316
32414
|
console.log(t("cli.cert_done", {
|
|
32317
32415
|
passed: String(suite.passed),
|
|
32318
32416
|
failed: String(suite.failed),
|
|
@@ -32330,7 +32428,7 @@ async function certify(opts) {
|
|
|
32330
32428
|
writeReport(entry, opts.projectDir);
|
|
32331
32429
|
}
|
|
32332
32430
|
async function certStatus(name, config, projectDir) {
|
|
32333
|
-
const m =
|
|
32431
|
+
const m = readMergedManifest(projectDir);
|
|
32334
32432
|
const providerUrl = config.provider.baseUrl;
|
|
32335
32433
|
const entry = m.certifications.find((e) => e.model === name && e.providerUrl === providerUrl);
|
|
32336
32434
|
if (!entry) {
|
|
@@ -32345,7 +32443,7 @@ async function certStatus(name, config, projectDir) {
|
|
|
32345
32443
|
printResults(entry.results);
|
|
32346
32444
|
}
|
|
32347
32445
|
async function certList(projectDir) {
|
|
32348
|
-
const m =
|
|
32446
|
+
const m = readMergedManifest(projectDir);
|
|
32349
32447
|
if (m.certifications.length === 0) {
|
|
32350
32448
|
console.log(t("cli.cert_empty"));
|
|
32351
32449
|
return;
|
|
@@ -32356,8 +32454,10 @@ async function certList(projectDir) {
|
|
|
32356
32454
|
}
|
|
32357
32455
|
}
|
|
32358
32456
|
async function uncertify(name, config, projectDir) {
|
|
32359
|
-
const removed = removeCertification(name, config.provider.baseUrl,
|
|
32360
|
-
|
|
32457
|
+
const removed = removeCertification(name, config.provider.baseUrl, {
|
|
32458
|
+
projectDir
|
|
32459
|
+
});
|
|
32460
|
+
if (removed.global || removed.project)
|
|
32361
32461
|
console.log(t("cli.cert_uncertified", { model: name }));
|
|
32362
32462
|
else
|
|
32363
32463
|
console.log(t("cli.cert_not_found", { model: name }));
|
|
@@ -32418,7 +32518,7 @@ var init_cli = __esm(() => {
|
|
|
32418
32518
|
init_loader3();
|
|
32419
32519
|
init_runner2();
|
|
32420
32520
|
init_manifest();
|
|
32421
|
-
HERE =
|
|
32521
|
+
HERE = dirname18(fileURLToPath5(import.meta.url));
|
|
32422
32522
|
MMA_ROOT = findMmaRoot(HERE);
|
|
32423
32523
|
});
|
|
32424
32524
|
|
|
@@ -32428,8 +32528,8 @@ __export(exports_repl_commands, {
|
|
|
32428
32528
|
registerAllCommands: () => registerAllCommands,
|
|
32429
32529
|
COMMAND_GROUPS: () => COMMAND_GROUPS
|
|
32430
32530
|
});
|
|
32431
|
-
import { join as join48, dirname as
|
|
32432
|
-
import { homedir as
|
|
32531
|
+
import { join as join48, dirname as dirname20 } from "path";
|
|
32532
|
+
import { homedir as homedir17 } from "os";
|
|
32433
32533
|
import { existsSync as existsSync54 } from "fs";
|
|
32434
32534
|
function registerAllCommands(ctx) {
|
|
32435
32535
|
registerBuiltinCommands(ctx);
|
|
@@ -32623,7 +32723,7 @@ function registerMmaCommands(ctx) {
|
|
|
32623
32723
|
console.log(pc2.yellow(t("repl.wizard_running")));
|
|
32624
32724
|
await ctx.withExclusiveInput(async () => {
|
|
32625
32725
|
const answers = await runSetup(ctx.rl);
|
|
32626
|
-
const configPath = join48(
|
|
32726
|
+
const configPath = join48(homedir17(), ".mma", "config.json");
|
|
32627
32727
|
ctx.config.provider.type = answers.provider;
|
|
32628
32728
|
ctx.config.provider.baseUrl = answers.apiBase;
|
|
32629
32729
|
ctx.config.provider.apiKey = answers.apiKey;
|
|
@@ -32631,7 +32731,7 @@ function registerMmaCommands(ctx) {
|
|
|
32631
32731
|
ctx.config.contextWindow = answers.contextWindow;
|
|
32632
32732
|
ctx.config.maxToolIterations = answers.maxToolIterations;
|
|
32633
32733
|
ctx.config.locale = answers.locale;
|
|
32634
|
-
saveConfig(ctx.config, configPath,
|
|
32734
|
+
saveConfig(ctx.config, configPath, dirname20(configPath));
|
|
32635
32735
|
await ctx.agent.reconfigure(ctx.config);
|
|
32636
32736
|
console.log(pc2.green(t("cli.config_saved")));
|
|
32637
32737
|
});
|
|
@@ -32746,8 +32846,8 @@ Excluded blocks: ${info.excluded.length}`));
|
|
|
32746
32846
|
return;
|
|
32747
32847
|
}
|
|
32748
32848
|
ctx.config.model = name;
|
|
32749
|
-
const configPath = join48(
|
|
32750
|
-
saveConfig(ctx.config, configPath,
|
|
32849
|
+
const configPath = join48(homedir17(), ".mma", "config.json");
|
|
32850
|
+
saveConfig(ctx.config, configPath, dirname20(configPath));
|
|
32751
32851
|
await ctx.agent.reconfigure(ctx.config);
|
|
32752
32852
|
console.log(pc2.green(t("repl.model_set", { name })));
|
|
32753
32853
|
return;
|
|
@@ -32771,8 +32871,8 @@ Excluded blocks: ${info.excluded.length}`));
|
|
|
32771
32871
|
return;
|
|
32772
32872
|
}
|
|
32773
32873
|
ctx.config.contextWindow = size;
|
|
32774
|
-
const configPath = join48(
|
|
32775
|
-
saveConfig(ctx.config, configPath,
|
|
32874
|
+
const configPath = join48(homedir17(), ".mma", "config.json");
|
|
32875
|
+
saveConfig(ctx.config, configPath, dirname20(configPath));
|
|
32776
32876
|
await ctx.agent.reconfigure(ctx.config);
|
|
32777
32877
|
console.log(pc2.green(t("cli.context_set", { size })));
|
|
32778
32878
|
}
|
|
@@ -32786,7 +32886,7 @@ Excluded blocks: ${info.excluded.length}`));
|
|
|
32786
32886
|
if (ctx.sessionManager && ctx.config.session.autoSave) {}
|
|
32787
32887
|
ctx.agent.shutdown();
|
|
32788
32888
|
const { loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_config2(), exports_config));
|
|
32789
|
-
const { homedir:
|
|
32889
|
+
const { homedir: homedir18 } = await import("os");
|
|
32790
32890
|
const { join: join49 } = await import("path");
|
|
32791
32891
|
const configDir = ctx.configDir;
|
|
32792
32892
|
const baseDir = ctx.baseDir;
|
|
@@ -33193,15 +33293,15 @@ init_config2();
|
|
|
33193
33293
|
init_setup();
|
|
33194
33294
|
init_i18n();
|
|
33195
33295
|
init_colors();
|
|
33196
|
-
import { join as join47, dirname as
|
|
33197
|
-
import { homedir as
|
|
33296
|
+
import { join as join47, dirname as dirname19 } from "path";
|
|
33297
|
+
import { homedir as homedir16 } from "os";
|
|
33198
33298
|
import { existsSync as existsSync53 } from "fs";
|
|
33199
33299
|
|
|
33200
33300
|
// src/cli/security-commands.ts
|
|
33201
33301
|
init_bootstrap();
|
|
33202
33302
|
init_config2();
|
|
33203
|
-
import { join as
|
|
33204
|
-
import { homedir as
|
|
33303
|
+
import { join as join42, dirname as dirname16 } from "path";
|
|
33304
|
+
import { homedir as homedir15 } from "os";
|
|
33205
33305
|
|
|
33206
33306
|
// src/modules/security/security-policies.ts
|
|
33207
33307
|
init_security();
|
|
@@ -33714,7 +33814,7 @@ function createSecurityCommand(program2) {
|
|
|
33714
33814
|
}
|
|
33715
33815
|
});
|
|
33716
33816
|
securityCmd.command("set-policy").argument("<preset>", t("cli.security.preset")).description(t("cli.security.set_policy")).action(async (preset) => {
|
|
33717
|
-
const configPath =
|
|
33817
|
+
const configPath = join42(homedir15(), ".mma", "config.json");
|
|
33718
33818
|
const { config: appConfig } = await bootstrap();
|
|
33719
33819
|
const validPresets = ["strict", "balanced", "permissive"];
|
|
33720
33820
|
if (!validPresets.includes(preset)) {
|
|
@@ -33724,12 +33824,12 @@ function createSecurityCommand(program2) {
|
|
|
33724
33824
|
const policy = getSecurityPolicy(preset);
|
|
33725
33825
|
const newSecurityConfig = applySecurityPolicy(preset);
|
|
33726
33826
|
appConfig.security = newSecurityConfig;
|
|
33727
|
-
saveConfig(appConfig, configPath,
|
|
33827
|
+
saveConfig(appConfig, configPath, dirname16(configPath));
|
|
33728
33828
|
console.log(t("cli.security.policy_applied", { name: policy.name }));
|
|
33729
33829
|
console.log(t("cli.security.policy_description", { description: policy.description }));
|
|
33730
33830
|
});
|
|
33731
33831
|
securityCmd.command("enable-encryption").description(t("cli.security.enable_encryption")).action(async () => {
|
|
33732
|
-
const configPath =
|
|
33832
|
+
const configPath = join42(homedir15(), ".mma", "config.json");
|
|
33733
33833
|
const { config: appConfig } = await bootstrap();
|
|
33734
33834
|
appConfig.security = appConfig.security || {};
|
|
33735
33835
|
appConfig.security.sessionEncryption = {
|
|
@@ -33737,11 +33837,11 @@ function createSecurityCommand(program2) {
|
|
|
33737
33837
|
encryptHistory: true,
|
|
33738
33838
|
encryptSessionLog: true
|
|
33739
33839
|
};
|
|
33740
|
-
saveConfig(appConfig, configPath,
|
|
33840
|
+
saveConfig(appConfig, configPath, dirname16(configPath));
|
|
33741
33841
|
console.log(t("cli.security.encryption_enabled"));
|
|
33742
33842
|
});
|
|
33743
33843
|
securityCmd.command("disable-encryption").description(t("cli.security.disable_encryption")).action(async () => {
|
|
33744
|
-
const configPath =
|
|
33844
|
+
const configPath = join42(homedir15(), ".mma", "config.json");
|
|
33745
33845
|
const { config: appConfig } = await bootstrap();
|
|
33746
33846
|
appConfig.security = appConfig.security || {};
|
|
33747
33847
|
appConfig.security.sessionEncryption = {
|
|
@@ -33749,11 +33849,11 @@ function createSecurityCommand(program2) {
|
|
|
33749
33849
|
encryptHistory: false,
|
|
33750
33850
|
encryptSessionLog: false
|
|
33751
33851
|
};
|
|
33752
|
-
saveConfig(appConfig, configPath,
|
|
33852
|
+
saveConfig(appConfig, configPath, dirname16(configPath));
|
|
33753
33853
|
console.log(t("cli.security.encryption_disabled"));
|
|
33754
33854
|
});
|
|
33755
33855
|
securityCmd.command("enable-audit").description(t("cli.security.enable_audit")).action(async () => {
|
|
33756
|
-
const configPath =
|
|
33856
|
+
const configPath = join42(homedir15(), ".mma", "config.json");
|
|
33757
33857
|
const { config: appConfig } = await bootstrap();
|
|
33758
33858
|
appConfig.security = appConfig.security || {};
|
|
33759
33859
|
appConfig.security.auditNotifier = {
|
|
@@ -33763,11 +33863,11 @@ function createSecurityCommand(program2) {
|
|
|
33763
33863
|
maxRetries: 3,
|
|
33764
33864
|
webhookTimeout: 5000
|
|
33765
33865
|
};
|
|
33766
|
-
saveConfig(appConfig, configPath,
|
|
33866
|
+
saveConfig(appConfig, configPath, dirname16(configPath));
|
|
33767
33867
|
console.log(t("cli.security.audit_enabled"));
|
|
33768
33868
|
});
|
|
33769
33869
|
securityCmd.command("disable-audit").description(t("cli.security.disable_audit")).action(async () => {
|
|
33770
|
-
const configPath =
|
|
33870
|
+
const configPath = join42(homedir15(), ".mma", "config.json");
|
|
33771
33871
|
const { config: appConfig } = await bootstrap();
|
|
33772
33872
|
appConfig.security = appConfig.security || {};
|
|
33773
33873
|
appConfig.security.auditNotifier = {
|
|
@@ -33775,7 +33875,7 @@ function createSecurityCommand(program2) {
|
|
|
33775
33875
|
maxRetries: 3,
|
|
33776
33876
|
webhookTimeout: 5000
|
|
33777
33877
|
};
|
|
33778
|
-
saveConfig(appConfig, configPath,
|
|
33878
|
+
saveConfig(appConfig, configPath, dirname16(configPath));
|
|
33779
33879
|
console.log(t("cli.security.audit_disabled"));
|
|
33780
33880
|
});
|
|
33781
33881
|
securityCmd.command("audit-stats").description(t("cli.security.audit_stats")).action(async () => {
|
|
@@ -33837,7 +33937,7 @@ function createProgram() {
|
|
|
33837
33937
|
const program2 = new Command().name("mma").description(t("cli.description")).version(version).option("--no-agents-md", t("cli.no_agents_md")).option("-d, --dir <path>", t("cli.dir")).option("-e, --exit-on-complete", t("cli.exit_on_complete")).option("-j, --json", t("cli.json"));
|
|
33838
33938
|
program2.command("init").description(t("cli.init")).action(async () => {
|
|
33839
33939
|
const answers = await runSetup();
|
|
33840
|
-
const configPath = join47(
|
|
33940
|
+
const configPath = join47(homedir16(), ".mma", "config.json");
|
|
33841
33941
|
const { config } = await bootstrap();
|
|
33842
33942
|
config.provider.type = answers.provider;
|
|
33843
33943
|
config.provider.baseUrl = answers.apiBase;
|
|
@@ -33877,12 +33977,12 @@ function createProgram() {
|
|
|
33877
33977
|
config.security.paths.denied = [];
|
|
33878
33978
|
}
|
|
33879
33979
|
}
|
|
33880
|
-
saveConfig(config, configPath,
|
|
33980
|
+
saveConfig(config, configPath, dirname19(configPath));
|
|
33881
33981
|
console.log(t("cli.config_saved"));
|
|
33882
33982
|
});
|
|
33883
33983
|
const configCmd = program2.command("config").description(t("cli.manage_config"));
|
|
33884
33984
|
configCmd.command("set").argument("<key>", t("cli.config_key")).argument("<value>", "Config value").description(t("cli.set_value")).action(async (key, value) => {
|
|
33885
|
-
const configPath = join47(
|
|
33985
|
+
const configPath = join47(homedir16(), ".mma", "config.json");
|
|
33886
33986
|
const { config } = await bootstrap();
|
|
33887
33987
|
const keys = key.split(".");
|
|
33888
33988
|
let obj = config;
|
|
@@ -33902,7 +34002,7 @@ function createProgram() {
|
|
|
33902
34002
|
obj[lastKey] = parseFloat(value);
|
|
33903
34003
|
else
|
|
33904
34004
|
obj[lastKey] = value;
|
|
33905
|
-
saveConfig(config, configPath,
|
|
34005
|
+
saveConfig(config, configPath, dirname19(configPath));
|
|
33906
34006
|
console.log(t("cli.set_done", { key, value }));
|
|
33907
34007
|
});
|
|
33908
34008
|
configCmd.command("show").description(t("cli.show_config")).action(async () => {
|
|
@@ -33912,7 +34012,7 @@ function createProgram() {
|
|
|
33912
34012
|
configCmd.command("migrate").description(t("cli.migrate_config")).action(async () => {
|
|
33913
34013
|
const { loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_config2(), exports_config));
|
|
33914
34014
|
const { hasDomainFiles: hasDomainFiles3 } = await Promise.resolve().then(() => (init_domains(), exports_domains));
|
|
33915
|
-
const configDir = join47(
|
|
34015
|
+
const configDir = join47(homedir16(), ".mma");
|
|
33916
34016
|
const configPath = join47(configDir, "config.json");
|
|
33917
34017
|
if (hasDomainFiles3(configDir)) {
|
|
33918
34018
|
console.log(pc2.yellow(t("config.migrate_no_legacy")));
|
|
@@ -33969,10 +34069,10 @@ function createProgram() {
|
|
|
33969
34069
|
console.log(t("cli.model_hint"));
|
|
33970
34070
|
});
|
|
33971
34071
|
model.command("use").argument("<name>", "Model name").description(t("cli.set_model")).action(async (name) => {
|
|
33972
|
-
const configPath = join47(
|
|
34072
|
+
const configPath = join47(homedir16(), ".mma", "config.json");
|
|
33973
34073
|
const { config } = await bootstrap();
|
|
33974
34074
|
config.model = name;
|
|
33975
|
-
saveConfig(config, configPath,
|
|
34075
|
+
saveConfig(config, configPath, dirname19(configPath));
|
|
33976
34076
|
console.log(t("cli.model_set", { name }));
|
|
33977
34077
|
});
|
|
33978
34078
|
model.command("certify").argument("<name>", "Model name").option("--provider-url <url>", t("cli.cert_provider_url")).option("--provider-key <key>", t("cli.cert_provider_key")).option("--context-window <n>", t("cli.cert_context_window")).option("--tags <tags>", t("cli.cert_tags"), "core").option("--reps <n>", t("cli.cert_reps")).option("--force", t("cli.cert_force")).option("--clean", t("cli.cert_clean")).description(t("cli.certify")).action(async (name, cmdOpts) => {
|
|
@@ -34006,7 +34106,7 @@ function createProgram() {
|
|
|
34006
34106
|
await uncertify2(name, config, process.cwd());
|
|
34007
34107
|
});
|
|
34008
34108
|
program2.command("context").description(t("cli.manage_context")).argument("<size>", "Context window size in tokens").action(async (size) => {
|
|
34009
|
-
const configPath = join47(
|
|
34109
|
+
const configPath = join47(homedir16(), ".mma", "config.json");
|
|
34010
34110
|
const { config } = await bootstrap();
|
|
34011
34111
|
const contextWindow = parseInt(size, 10);
|
|
34012
34112
|
if (isNaN(contextWindow) || contextWindow < 1024) {
|
|
@@ -34014,7 +34114,7 @@ function createProgram() {
|
|
|
34014
34114
|
return;
|
|
34015
34115
|
}
|
|
34016
34116
|
config.contextWindow = contextWindow;
|
|
34017
|
-
saveConfig(config, configPath,
|
|
34117
|
+
saveConfig(config, configPath, dirname19(configPath));
|
|
34018
34118
|
console.log(t("cli.context_set", { size: contextWindow }));
|
|
34019
34119
|
});
|
|
34020
34120
|
const provider = program2.command("provider").description(t("cli.manage_providers"));
|
|
@@ -34052,7 +34152,7 @@ function createProgram() {
|
|
|
34052
34152
|
console.log(t("cli.base_url"), config.provider.baseUrl);
|
|
34053
34153
|
});
|
|
34054
34154
|
provider.command("use").argument("<name>", "Provider name").description(t("cli.set_provider")).action(async (name) => {
|
|
34055
|
-
const configPath = join47(
|
|
34155
|
+
const configPath = join47(homedir16(), ".mma", "config.json");
|
|
34056
34156
|
const { config, agent } = await bootstrap();
|
|
34057
34157
|
if (config.provider.entries && config.provider.entries.length > 0) {
|
|
34058
34158
|
try {
|
|
@@ -34068,14 +34168,14 @@ function createProgram() {
|
|
|
34068
34168
|
if (baseUrl) {
|
|
34069
34169
|
config.provider.baseUrl = baseUrl;
|
|
34070
34170
|
}
|
|
34071
|
-
saveConfig(config, configPath,
|
|
34171
|
+
saveConfig(config, configPath, dirname19(configPath));
|
|
34072
34172
|
console.log(t("cli.provider_set", { name }));
|
|
34073
34173
|
if (baseUrl) {
|
|
34074
34174
|
console.log(t("cli.provider_base_hint", { baseUrl }));
|
|
34075
34175
|
}
|
|
34076
34176
|
});
|
|
34077
34177
|
provider.command("add").argument("<name>", "Provider type or label").option("--url <url>", "Base URL").option("--key <key>", "API key").option("--priority <n>", "Fallback priority (lower = tried first)").option("--context-window <n>", "Context window override for this entry").option("--rpm <n>", "Max requests per minute for this entry").option("--parallel <n>", "Max parallel tasks for this entry").description(t("cli.add_provider")).action(async (name, opts) => {
|
|
34078
|
-
const configPath = join47(
|
|
34178
|
+
const configPath = join47(homedir16(), ".mma", "config.json");
|
|
34079
34179
|
const { config } = await bootstrap();
|
|
34080
34180
|
const entries = Array.isArray(config.provider.entries) ? config.provider.entries : [];
|
|
34081
34181
|
if (entries.length === 0) {
|
|
@@ -34107,7 +34207,7 @@ function createProgram() {
|
|
|
34107
34207
|
});
|
|
34108
34208
|
config.provider.entries = entries;
|
|
34109
34209
|
config.provider.active = config.provider.active || config.provider.type;
|
|
34110
|
-
saveConfig(config, configPath,
|
|
34210
|
+
saveConfig(config, configPath, dirname19(configPath));
|
|
34111
34211
|
console.log(pc2.green(t("cli.provider_added", { name })));
|
|
34112
34212
|
console.log(t("cli.provider_switch_hint"));
|
|
34113
34213
|
});
|
|
@@ -34986,7 +35086,7 @@ class LineEditor {
|
|
|
34986
35086
|
// src/cli/repl.ts
|
|
34987
35087
|
import { existsSync as existsSync55, readFileSync as readFileSync38, writeFileSync as writeFileSync20 } from "fs";
|
|
34988
35088
|
import { join as join49 } from "path";
|
|
34989
|
-
import { homedir as
|
|
35089
|
+
import { homedir as homedir18 } from "os";
|
|
34990
35090
|
|
|
34991
35091
|
// src/cli/completer.ts
|
|
34992
35092
|
class SlashCommandProvider {
|
|
@@ -35809,10 +35909,10 @@ class Repl {
|
|
|
35809
35909
|
this.envReport = envReport;
|
|
35810
35910
|
this.execModule = execModule;
|
|
35811
35911
|
this.slog = new SessionLogger(sessionManager, logger);
|
|
35812
|
-
this.configDir = configDir || join49(
|
|
35912
|
+
this.configDir = configDir || join49(homedir18(), ".mma");
|
|
35813
35913
|
this.baseDir = baseDir || process.cwd();
|
|
35814
35914
|
this.noAgentsMd = noAgentsMd === true;
|
|
35815
|
-
this.historyPath = historyPath ?? join49(
|
|
35915
|
+
this.historyPath = historyPath ?? join49(homedir18(), ".mma", "repl-history");
|
|
35816
35916
|
this.loadHistory();
|
|
35817
35917
|
this.rl = process.stdin.isTTY ? new LineEditor({
|
|
35818
35918
|
input: process.stdin,
|
|
@@ -36388,8 +36488,8 @@ init_config2();
|
|
|
36388
36488
|
init_i18n();
|
|
36389
36489
|
init_colors();
|
|
36390
36490
|
import { existsSync as existsSync56 } from "fs";
|
|
36391
|
-
import { join as join51, dirname as
|
|
36392
|
-
import { homedir as
|
|
36491
|
+
import { join as join51, dirname as dirname21 } from "path";
|
|
36492
|
+
import { homedir as homedir20 } from "os";
|
|
36393
36493
|
|
|
36394
36494
|
// src/modules/updater/index.ts
|
|
36395
36495
|
init_checker();
|
|
@@ -36494,8 +36594,8 @@ init_data_sanitizer();
|
|
|
36494
36594
|
init_i18n();
|
|
36495
36595
|
import { appendFileSync as appendFileSync7, mkdirSync as mkdirSync21 } from "fs";
|
|
36496
36596
|
import { join as join50 } from "path";
|
|
36497
|
-
import { homedir as
|
|
36498
|
-
var CRASH_LOG_DIR = join50(
|
|
36597
|
+
import { homedir as homedir19 } from "os";
|
|
36598
|
+
var CRASH_LOG_DIR = join50(homedir19(), ".mma", "logs");
|
|
36499
36599
|
var CRASH_LOG_FILE = "crash.jsonl";
|
|
36500
36600
|
function formatCrashEntry(type2, err) {
|
|
36501
36601
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -36505,7 +36605,7 @@ function formatCrashEntry(type2, err) {
|
|
|
36505
36605
|
type: type2,
|
|
36506
36606
|
message: sanitizeLogMessage(message),
|
|
36507
36607
|
stack: sanitizeLogMessage(stack),
|
|
36508
|
-
environment: collectEnvironment({ configDir:
|
|
36608
|
+
environment: collectEnvironment({ configDir: homedir19(), scanTools: false })
|
|
36509
36609
|
};
|
|
36510
36610
|
}
|
|
36511
36611
|
function writeCrashEntry(dir, entry) {
|
|
@@ -36619,7 +36719,7 @@ async function main() {
|
|
|
36619
36719
|
await updater?.waitForIdle();
|
|
36620
36720
|
process.exit(exitCode);
|
|
36621
36721
|
} else {
|
|
36622
|
-
const mmaDir = join51(
|
|
36722
|
+
const mmaDir = join51(homedir20(), ".mma");
|
|
36623
36723
|
const legacyConfigPath = join51(mmaDir, "config.json");
|
|
36624
36724
|
let hasAnyConfig = existsSync56(legacyConfigPath);
|
|
36625
36725
|
if (!hasAnyConfig) {
|
|
@@ -36684,7 +36784,7 @@ async function main() {
|
|
|
36684
36784
|
config.security.paths.denied = [];
|
|
36685
36785
|
}
|
|
36686
36786
|
}
|
|
36687
|
-
saveConfig(config, legacyConfigPath,
|
|
36787
|
+
saveConfig(config, legacyConfigPath, dirname21(legacyConfigPath));
|
|
36688
36788
|
await agent.reconfigure(config);
|
|
36689
36789
|
}
|
|
36690
36790
|
startAutoUpdate(config);
|