@bonginkan/maria 4.3.29 → 4.3.31
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 +4 -4
- package/dist/READY.manifest.json +1 -1
- package/dist/bin/maria.cjs +1278 -204
- package/dist/bin/maria.cjs.map +1 -1
- package/dist/cli.cjs +1275 -201
- package/dist/cli.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/server/express-server.cjs +1 -1
- package/dist/server/express-server.js +1 -1
- package/dist/server-express.cjs +1 -1
- package/dist/server-express.cjs.map +1 -1
- package/package.json +2 -2
- package/src/slash-commands/READY.manifest.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -189,13 +189,13 @@ function getPackageJson() {
|
|
|
189
189
|
)
|
|
190
190
|
];
|
|
191
191
|
let packageJsonPath = null;
|
|
192
|
-
for (const
|
|
193
|
-
if (fs19.existsSync(
|
|
192
|
+
for (const path64 of possiblePaths) {
|
|
193
|
+
if (fs19.existsSync(path64)) {
|
|
194
194
|
try {
|
|
195
|
-
const content = fs19.readFileSync(
|
|
195
|
+
const content = fs19.readFileSync(path64, "utf-8");
|
|
196
196
|
const parsed = JSON.parse(content);
|
|
197
197
|
if (parsed.name === "@bonginkan/maria") {
|
|
198
|
-
packageJsonPath =
|
|
198
|
+
packageJsonPath = path64;
|
|
199
199
|
break;
|
|
200
200
|
}
|
|
201
201
|
} catch {
|
|
@@ -1704,7 +1704,7 @@ var init_AuthenticationManager = __esm({
|
|
|
1704
1704
|
const response = await fetch(`${this.apiBase}/api/user/profile`, {
|
|
1705
1705
|
headers: {
|
|
1706
1706
|
"Authorization": `Bearer ${tokens2.accessToken}`,
|
|
1707
|
-
"User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.
|
|
1707
|
+
"User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.31"}`
|
|
1708
1708
|
}
|
|
1709
1709
|
});
|
|
1710
1710
|
if (response.status === 401) {
|
|
@@ -2394,9 +2394,9 @@ function getDeviceId() {
|
|
|
2394
2394
|
function getSessionId() {
|
|
2395
2395
|
return global.MARIA_SESSION_ID;
|
|
2396
2396
|
}
|
|
2397
|
-
async function callApi(
|
|
2397
|
+
async function callApi(path64, init3 = {}) {
|
|
2398
2398
|
const apiBase = process.env.MARIA_API_BASE || "https://api.maria-code.ai";
|
|
2399
|
-
const fullUrl = `${apiBase}${
|
|
2399
|
+
const fullUrl = `${apiBase}${path64}`;
|
|
2400
2400
|
let tokens2 = await authManager.getValidTokens();
|
|
2401
2401
|
if (!tokens2) {
|
|
2402
2402
|
console.log(chalk40__default.default.red(ERR.AUTH_REQUIRED.msg));
|
|
@@ -2407,7 +2407,7 @@ async function callApi(path60, init3 = {}) {
|
|
|
2407
2407
|
"Authorization": `Bearer ${token}`,
|
|
2408
2408
|
"X-Device-Id": getDeviceId(),
|
|
2409
2409
|
"X-Session-Id": getSessionId() || "",
|
|
2410
|
-
"User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.
|
|
2410
|
+
"User-Agent": `maria-cli/${process.env.CLI_VERSION || "4.3.31"}`,
|
|
2411
2411
|
"Content-Type": init3.headers?.["Content-Type"] || "application/json"
|
|
2412
2412
|
});
|
|
2413
2413
|
const doFetch = async (token) => {
|
|
@@ -2465,8 +2465,8 @@ async function callApi(path60, init3 = {}) {
|
|
|
2465
2465
|
}
|
|
2466
2466
|
return response;
|
|
2467
2467
|
}
|
|
2468
|
-
async function callApiJson(
|
|
2469
|
-
const response = await callApi(
|
|
2468
|
+
async function callApiJson(path64, init3 = {}) {
|
|
2469
|
+
const response = await callApi(path64, init3);
|
|
2470
2470
|
if (!response.ok) {
|
|
2471
2471
|
const error2 = await response.json().catch(() => ({
|
|
2472
2472
|
message: `API error: ${response.status} ${response.statusText}`
|
|
@@ -7954,12 +7954,12 @@ var init_esm4 = __esm({
|
|
|
7954
7954
|
/**
|
|
7955
7955
|
* Get the Path object referenced by the string path, resolved from this Path
|
|
7956
7956
|
*/
|
|
7957
|
-
resolve(
|
|
7958
|
-
if (!
|
|
7957
|
+
resolve(path64) {
|
|
7958
|
+
if (!path64) {
|
|
7959
7959
|
return this;
|
|
7960
7960
|
}
|
|
7961
|
-
const rootPath = this.getRootString(
|
|
7962
|
-
const dir =
|
|
7961
|
+
const rootPath = this.getRootString(path64);
|
|
7962
|
+
const dir = path64.substring(rootPath.length);
|
|
7963
7963
|
const dirParts = dir.split(this.splitSep);
|
|
7964
7964
|
const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
|
|
7965
7965
|
return result;
|
|
@@ -8711,8 +8711,8 @@ var init_esm4 = __esm({
|
|
|
8711
8711
|
/**
|
|
8712
8712
|
* @internal
|
|
8713
8713
|
*/
|
|
8714
|
-
getRootString(
|
|
8715
|
-
return path10.win32.parse(
|
|
8714
|
+
getRootString(path64) {
|
|
8715
|
+
return path10.win32.parse(path64).root;
|
|
8716
8716
|
}
|
|
8717
8717
|
/**
|
|
8718
8718
|
* @internal
|
|
@@ -8758,8 +8758,8 @@ var init_esm4 = __esm({
|
|
|
8758
8758
|
/**
|
|
8759
8759
|
* @internal
|
|
8760
8760
|
*/
|
|
8761
|
-
getRootString(
|
|
8762
|
-
return
|
|
8761
|
+
getRootString(path64) {
|
|
8762
|
+
return path64.startsWith("/") ? "/" : "";
|
|
8763
8763
|
}
|
|
8764
8764
|
/**
|
|
8765
8765
|
* @internal
|
|
@@ -8808,8 +8808,8 @@ var init_esm4 = __esm({
|
|
|
8808
8808
|
*
|
|
8809
8809
|
* @internal
|
|
8810
8810
|
*/
|
|
8811
|
-
constructor(cwd2 = process.cwd(), pathImpl, sep4, { nocase, childrenCacheSize = 16 * 1024, fs:
|
|
8812
|
-
this.#fs = fsFromOption(
|
|
8811
|
+
constructor(cwd2 = process.cwd(), pathImpl, sep4, { nocase, childrenCacheSize = 16 * 1024, fs: fs51 = defaultFS } = {}) {
|
|
8812
|
+
this.#fs = fsFromOption(fs51);
|
|
8813
8813
|
if (cwd2 instanceof URL || cwd2.startsWith("file://")) {
|
|
8814
8814
|
cwd2 = url.fileURLToPath(cwd2);
|
|
8815
8815
|
}
|
|
@@ -8848,11 +8848,11 @@ var init_esm4 = __esm({
|
|
|
8848
8848
|
/**
|
|
8849
8849
|
* Get the depth of a provided path, string, or the cwd
|
|
8850
8850
|
*/
|
|
8851
|
-
depth(
|
|
8852
|
-
if (typeof
|
|
8853
|
-
|
|
8851
|
+
depth(path64 = this.cwd) {
|
|
8852
|
+
if (typeof path64 === "string") {
|
|
8853
|
+
path64 = this.cwd.resolve(path64);
|
|
8854
8854
|
}
|
|
8855
|
-
return
|
|
8855
|
+
return path64.depth();
|
|
8856
8856
|
}
|
|
8857
8857
|
/**
|
|
8858
8858
|
* Return the cache of child entries. Exposed so subclasses can create
|
|
@@ -9339,9 +9339,9 @@ var init_esm4 = __esm({
|
|
|
9339
9339
|
process11();
|
|
9340
9340
|
return results;
|
|
9341
9341
|
}
|
|
9342
|
-
chdir(
|
|
9342
|
+
chdir(path64 = this.cwd) {
|
|
9343
9343
|
const oldCwd = this.cwd;
|
|
9344
|
-
this.cwd = typeof
|
|
9344
|
+
this.cwd = typeof path64 === "string" ? this.cwd.resolve(path64) : path64;
|
|
9345
9345
|
this.cwd[setAsCwd](oldCwd);
|
|
9346
9346
|
}
|
|
9347
9347
|
};
|
|
@@ -9367,8 +9367,8 @@ var init_esm4 = __esm({
|
|
|
9367
9367
|
/**
|
|
9368
9368
|
* @internal
|
|
9369
9369
|
*/
|
|
9370
|
-
newRoot(
|
|
9371
|
-
return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
9370
|
+
newRoot(fs51) {
|
|
9371
|
+
return new PathWin32(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs51 });
|
|
9372
9372
|
}
|
|
9373
9373
|
/**
|
|
9374
9374
|
* Return true if the provided path string is an absolute path
|
|
@@ -9396,8 +9396,8 @@ var init_esm4 = __esm({
|
|
|
9396
9396
|
/**
|
|
9397
9397
|
* @internal
|
|
9398
9398
|
*/
|
|
9399
|
-
newRoot(
|
|
9400
|
-
return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs:
|
|
9399
|
+
newRoot(fs51) {
|
|
9400
|
+
return new PathPosix(this.rootPath, IFDIR, void 0, this.roots, this.nocase, this.childrenCache(), { fs: fs51 });
|
|
9401
9401
|
}
|
|
9402
9402
|
/**
|
|
9403
9403
|
* Return true if the provided path string is an absolute path
|
|
@@ -9716,8 +9716,8 @@ var init_processor = __esm({
|
|
|
9716
9716
|
}
|
|
9717
9717
|
// match, absolute, ifdir
|
|
9718
9718
|
entries() {
|
|
9719
|
-
return [...this.store.entries()].map(([
|
|
9720
|
-
|
|
9719
|
+
return [...this.store.entries()].map(([path64, n]) => [
|
|
9720
|
+
path64,
|
|
9721
9721
|
!!(n & 2),
|
|
9722
9722
|
!!(n & 1)
|
|
9723
9723
|
]);
|
|
@@ -9930,9 +9930,9 @@ var init_walker = __esm({
|
|
|
9930
9930
|
signal;
|
|
9931
9931
|
maxDepth;
|
|
9932
9932
|
includeChildMatches;
|
|
9933
|
-
constructor(patterns,
|
|
9933
|
+
constructor(patterns, path64, opts) {
|
|
9934
9934
|
this.patterns = patterns;
|
|
9935
|
-
this.path =
|
|
9935
|
+
this.path = path64;
|
|
9936
9936
|
this.opts = opts;
|
|
9937
9937
|
this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
|
|
9938
9938
|
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
@@ -9951,11 +9951,11 @@ var init_walker = __esm({
|
|
|
9951
9951
|
});
|
|
9952
9952
|
}
|
|
9953
9953
|
}
|
|
9954
|
-
#ignored(
|
|
9955
|
-
return this.seen.has(
|
|
9954
|
+
#ignored(path64) {
|
|
9955
|
+
return this.seen.has(path64) || !!this.#ignore?.ignored?.(path64);
|
|
9956
9956
|
}
|
|
9957
|
-
#childrenIgnored(
|
|
9958
|
-
return !!this.#ignore?.childrenIgnored?.(
|
|
9957
|
+
#childrenIgnored(path64) {
|
|
9958
|
+
return !!this.#ignore?.childrenIgnored?.(path64);
|
|
9959
9959
|
}
|
|
9960
9960
|
// backpressure mechanism
|
|
9961
9961
|
pause() {
|
|
@@ -10170,8 +10170,8 @@ var init_walker = __esm({
|
|
|
10170
10170
|
};
|
|
10171
10171
|
GlobWalker = class extends GlobUtil {
|
|
10172
10172
|
matches = /* @__PURE__ */ new Set();
|
|
10173
|
-
constructor(patterns,
|
|
10174
|
-
super(patterns,
|
|
10173
|
+
constructor(patterns, path64, opts) {
|
|
10174
|
+
super(patterns, path64, opts);
|
|
10175
10175
|
}
|
|
10176
10176
|
matchEmit(e2) {
|
|
10177
10177
|
this.matches.add(e2);
|
|
@@ -10208,8 +10208,8 @@ var init_walker = __esm({
|
|
|
10208
10208
|
};
|
|
10209
10209
|
GlobStream = class extends GlobUtil {
|
|
10210
10210
|
results;
|
|
10211
|
-
constructor(patterns,
|
|
10212
|
-
super(patterns,
|
|
10211
|
+
constructor(patterns, path64, opts) {
|
|
10212
|
+
super(patterns, path64, opts);
|
|
10213
10213
|
this.results = new Minipass({
|
|
10214
10214
|
signal: this.signal,
|
|
10215
10215
|
objectMode: true
|
|
@@ -15964,9 +15964,9 @@ var init_SafetyGuard = __esm({
|
|
|
15964
15964
|
}
|
|
15965
15965
|
}
|
|
15966
15966
|
if (action.args.paths && Array.isArray(action.args.paths)) {
|
|
15967
|
-
for (const
|
|
15968
|
-
if (!this.validatePath(
|
|
15969
|
-
violations.push(`Invalid path: ${
|
|
15967
|
+
for (const path64 of action.args.paths) {
|
|
15968
|
+
if (!this.validatePath(path64)) {
|
|
15969
|
+
violations.push(`Invalid path: ${path64}`);
|
|
15970
15970
|
}
|
|
15971
15971
|
}
|
|
15972
15972
|
}
|
|
@@ -16022,15 +16022,15 @@ var init_SafetyGuard = __esm({
|
|
|
16022
16022
|
* Validate file path against allowed/blocked lists
|
|
16023
16023
|
*/
|
|
16024
16024
|
validatePath(filePath) {
|
|
16025
|
-
const
|
|
16026
|
-
const resolvedPath =
|
|
16025
|
+
const path64 = __require("path");
|
|
16026
|
+
const resolvedPath = path64.resolve(filePath);
|
|
16027
16027
|
for (const blockedPath of this.constraints.blockedPaths) {
|
|
16028
|
-
if (resolvedPath.startsWith(
|
|
16028
|
+
if (resolvedPath.startsWith(path64.resolve(blockedPath))) {
|
|
16029
16029
|
return false;
|
|
16030
16030
|
}
|
|
16031
16031
|
}
|
|
16032
16032
|
for (const allowedPath of this.constraints.allowedPaths) {
|
|
16033
|
-
if (resolvedPath.startsWith(
|
|
16033
|
+
if (resolvedPath.startsWith(path64.resolve(allowedPath))) {
|
|
16034
16034
|
return true;
|
|
16035
16035
|
}
|
|
16036
16036
|
}
|
|
@@ -16059,9 +16059,9 @@ var init_SafetyGuard = __esm({
|
|
|
16059
16059
|
violations.push(`Invalid path in ${action.type}: ${action.args.path}`);
|
|
16060
16060
|
}
|
|
16061
16061
|
if (action.args.paths && Array.isArray(action.args.paths)) {
|
|
16062
|
-
for (const
|
|
16063
|
-
if (!this.validatePath(
|
|
16064
|
-
violations.push(`Invalid path in ${action.type}: ${
|
|
16062
|
+
for (const path64 of action.args.paths) {
|
|
16063
|
+
if (!this.validatePath(path64)) {
|
|
16064
|
+
violations.push(`Invalid path in ${action.type}: ${path64}`);
|
|
16065
16065
|
}
|
|
16066
16066
|
}
|
|
16067
16067
|
}
|
|
@@ -16121,8 +16121,8 @@ var require_package = __commonJS({
|
|
|
16121
16121
|
"package.json"(exports, module) {
|
|
16122
16122
|
module.exports = {
|
|
16123
16123
|
name: "@bonginkan/maria",
|
|
16124
|
-
version: "4.3.
|
|
16125
|
-
description: "\u{1F680} MARIA v4.3.
|
|
16124
|
+
version: "4.3.31",
|
|
16125
|
+
description: "\u{1F680} MARIA v4.3.31 - Enterprise AI Development Platform with identity system and character voice implementation. Features 74 production-ready commands with comprehensive fallback implementation, local LLM support, and zero external dependencies. Includes natural language coding, AI safety evaluation, intelligent evolution system, episodic memory with PII masking, and real-time monitoring dashboard. Built with TypeScript AST-powered code generation, OAuth2.0 + PKCE authentication, quantum-resistant cryptography, and enterprise-grade performance.",
|
|
16126
16126
|
keywords: [
|
|
16127
16127
|
"ai",
|
|
16128
16128
|
"cli",
|
|
@@ -17556,8 +17556,8 @@ var init_ConfigActionExecutor = __esm({
|
|
|
17556
17556
|
/**
|
|
17557
17557
|
* Set nested configuration value using dot notation
|
|
17558
17558
|
*/
|
|
17559
|
-
setNestedValue(obj,
|
|
17560
|
-
const keys =
|
|
17559
|
+
setNestedValue(obj, path64, value) {
|
|
17560
|
+
const keys = path64.split(".");
|
|
17561
17561
|
let current = obj;
|
|
17562
17562
|
for (let i2 = 0; i2 < keys.length - 1; i2++) {
|
|
17563
17563
|
const key = keys[i2];
|
|
@@ -23255,6 +23255,7 @@ var init_image_command = __esm({
|
|
|
23255
23255
|
const spinner = new ProcessAnimation();
|
|
23256
23256
|
spinner.start();
|
|
23257
23257
|
try {
|
|
23258
|
+
const useRemote = String(process.env.MARIA_USE_REMOTE_MEDIA || "").toLowerCase() === "1" && await authManager.isAuthenticated();
|
|
23258
23259
|
if (useRemote) {
|
|
23259
23260
|
try {
|
|
23260
23261
|
const body = {
|
|
@@ -23740,8 +23741,8 @@ var init_video_command = __esm({
|
|
|
23740
23741
|
const spinner = new ProcessAnimation();
|
|
23741
23742
|
spinner.start();
|
|
23742
23743
|
try {
|
|
23743
|
-
const
|
|
23744
|
-
if (
|
|
23744
|
+
const useRemote = String(process.env.MARIA_USE_REMOTE_MEDIA || "").toLowerCase() === "1" && await authManager.isAuthenticated();
|
|
23745
|
+
if (useRemote) {
|
|
23745
23746
|
try {
|
|
23746
23747
|
const body = {
|
|
23747
23748
|
prompt: cli.prompt,
|
|
@@ -25816,7 +25817,7 @@ var init_about_command = __esm({
|
|
|
25816
25817
|
async execute(args2, context2) {
|
|
25817
25818
|
const output3 = [];
|
|
25818
25819
|
output3.push("");
|
|
25819
|
-
output3.push(chalk40__default.default.cyan.bold("\u{1F916} About MARIA v4.3.
|
|
25820
|
+
output3.push(chalk40__default.default.cyan.bold("\u{1F916} About MARIA v4.3.31"));
|
|
25820
25821
|
output3.push(chalk40__default.default.gray("\u2550".repeat(40)));
|
|
25821
25822
|
output3.push("");
|
|
25822
25823
|
output3.push(chalk40__default.default.white.bold("MARIA - Minimal API, Maximum Power"));
|
|
@@ -28597,22 +28598,22 @@ function dataUriToBuffer(uri) {
|
|
|
28597
28598
|
if (firstComma === -1 || firstComma <= 4) {
|
|
28598
28599
|
throw new TypeError("malformed data: URI");
|
|
28599
28600
|
}
|
|
28600
|
-
const
|
|
28601
|
+
const meta27 = uri.substring(5, firstComma).split(";");
|
|
28601
28602
|
let charset = "";
|
|
28602
28603
|
let base64 = false;
|
|
28603
|
-
const type =
|
|
28604
|
+
const type = meta27[0] || "text/plain";
|
|
28604
28605
|
let typeFull = type;
|
|
28605
|
-
for (let i2 = 1; i2 <
|
|
28606
|
-
if (
|
|
28606
|
+
for (let i2 = 1; i2 < meta27.length; i2++) {
|
|
28607
|
+
if (meta27[i2] === "base64") {
|
|
28607
28608
|
base64 = true;
|
|
28608
|
-
} else if (
|
|
28609
|
-
typeFull += `;${
|
|
28610
|
-
if (
|
|
28611
|
-
charset =
|
|
28609
|
+
} else if (meta27[i2]) {
|
|
28610
|
+
typeFull += `;${meta27[i2]}`;
|
|
28611
|
+
if (meta27[i2].indexOf("charset=") === 0) {
|
|
28612
|
+
charset = meta27[i2].substring(8);
|
|
28612
28613
|
}
|
|
28613
28614
|
}
|
|
28614
28615
|
}
|
|
28615
|
-
if (!
|
|
28616
|
+
if (!meta27[0] && !charset.length) {
|
|
28616
28617
|
typeFull += ";charset=US-ASCII";
|
|
28617
28618
|
charset = "US-ASCII";
|
|
28618
28619
|
}
|
|
@@ -33386,22 +33387,22 @@ var init_from = __esm({
|
|
|
33386
33387
|
init_file();
|
|
33387
33388
|
init_fetch_blob();
|
|
33388
33389
|
({ stat: stat9 } = fs19.promises);
|
|
33389
|
-
blobFromSync = (
|
|
33390
|
-
blobFrom = (
|
|
33391
|
-
fileFrom = (
|
|
33392
|
-
fileFromSync = (
|
|
33393
|
-
fromBlob = (stat13,
|
|
33394
|
-
path:
|
|
33390
|
+
blobFromSync = (path64, type) => fromBlob(fs19.statSync(path64), path64, type);
|
|
33391
|
+
blobFrom = (path64, type) => stat9(path64).then((stat13) => fromBlob(stat13, path64, type));
|
|
33392
|
+
fileFrom = (path64, type) => stat9(path64).then((stat13) => fromFile(stat13, path64, type));
|
|
33393
|
+
fileFromSync = (path64, type) => fromFile(fs19.statSync(path64), path64, type);
|
|
33394
|
+
fromBlob = (stat13, path64, type = "") => new fetch_blob_default([new BlobDataItem({
|
|
33395
|
+
path: path64,
|
|
33395
33396
|
size: stat13.size,
|
|
33396
33397
|
lastModified: stat13.mtimeMs,
|
|
33397
33398
|
start: 0
|
|
33398
33399
|
})], { type });
|
|
33399
|
-
fromFile = (stat13,
|
|
33400
|
-
path:
|
|
33400
|
+
fromFile = (stat13, path64, type = "") => new file_default([new BlobDataItem({
|
|
33401
|
+
path: path64,
|
|
33401
33402
|
size: stat13.size,
|
|
33402
33403
|
lastModified: stat13.mtimeMs,
|
|
33403
33404
|
start: 0
|
|
33404
|
-
})], path10.basename(
|
|
33405
|
+
})], path10.basename(path64), { type, lastModified: stat13.mtimeMs });
|
|
33405
33406
|
BlobDataItem = class _BlobDataItem {
|
|
33406
33407
|
#path;
|
|
33407
33408
|
#start;
|
|
@@ -37170,12 +37171,12 @@ ${this.toYamlLike(value, indent + 1)}`;
|
|
|
37170
37171
|
}
|
|
37171
37172
|
static async loadFromFile(configPath) {
|
|
37172
37173
|
const { importNodeBuiltin: importNodeBuiltin2 } = await Promise.resolve().then(() => (init_import_helper(), import_helper_exports));
|
|
37173
|
-
const
|
|
37174
|
+
const fs51 = await importNodeBuiltin2("fs");
|
|
37174
37175
|
const _path = await importNodeBuiltin2("_path");
|
|
37175
37176
|
const os23 = await importNodeBuiltin2("os");
|
|
37176
37177
|
const targetPath = configPath || _path.join(os23.homedir(), ".maria", "config.json");
|
|
37177
37178
|
try {
|
|
37178
|
-
const data = await
|
|
37179
|
+
const data = await fs51.promises.readFile(targetPath, "utf-8");
|
|
37179
37180
|
return JSON.parse(data);
|
|
37180
37181
|
} catch (innerError) {
|
|
37181
37182
|
if (innerError?.code === "ENOENT") {
|
|
@@ -37189,25 +37190,25 @@ ${this.toYamlLike(value, indent + 1)}`;
|
|
|
37189
37190
|
}
|
|
37190
37191
|
async save(configPath, options) {
|
|
37191
37192
|
const { importNodeBuiltin: importNodeBuiltin2 } = await Promise.resolve().then(() => (init_import_helper(), import_helper_exports));
|
|
37192
|
-
const
|
|
37193
|
+
const fs51 = await importNodeBuiltin2("fs");
|
|
37193
37194
|
const _path = await importNodeBuiltin2("_path");
|
|
37194
37195
|
const os23 = await importNodeBuiltin2("os");
|
|
37195
37196
|
const targetPath = configPath || _path.join(os23.homedir(), ".maria", "config.json");
|
|
37196
37197
|
try {
|
|
37197
37198
|
if (options?.backup) {
|
|
37198
37199
|
try {
|
|
37199
|
-
await
|
|
37200
|
+
await fs51.promises.access(targetPath);
|
|
37200
37201
|
const backupPath = `${targetPath}.backup.${Date.now()}`;
|
|
37201
|
-
await
|
|
37202
|
+
await fs51.promises.copyFile(targetPath, backupPath);
|
|
37202
37203
|
} catch {
|
|
37203
37204
|
}
|
|
37204
37205
|
}
|
|
37205
|
-
await
|
|
37206
|
+
await fs51.promises.mkdir(_path.dirname(targetPath), { recursive: true });
|
|
37206
37207
|
const dataToSave = this.getAll({
|
|
37207
37208
|
maskSensitive: options?.maskSensitive ?? true,
|
|
37208
37209
|
includeSourceMap: options?.includeSourceMap ?? false
|
|
37209
37210
|
});
|
|
37210
|
-
await
|
|
37211
|
+
await fs51.promises.writeFile(
|
|
37211
37212
|
targetPath,
|
|
37212
37213
|
JSON.stringify(dataToSave, null, 2),
|
|
37213
37214
|
{ mode: 384 }
|
|
@@ -37251,12 +37252,12 @@ ${this.toYamlLike(value, indent + 1)}`;
|
|
|
37251
37252
|
}
|
|
37252
37253
|
if (outputPath) {
|
|
37253
37254
|
const { importNodeBuiltin: importNodeBuiltin2 } = await Promise.resolve().then(() => (init_import_helper(), import_helper_exports));
|
|
37254
|
-
const
|
|
37255
|
+
const fs51 = await importNodeBuiltin2("fs");
|
|
37255
37256
|
const _path = await importNodeBuiltin2(
|
|
37256
37257
|
"_path"
|
|
37257
37258
|
);
|
|
37258
|
-
await
|
|
37259
|
-
await
|
|
37259
|
+
await fs51.promises.mkdir(_path.dirname(outputPath), { recursive: true });
|
|
37260
|
+
await fs51.promises.writeFile(outputPath, content, "utf-8");
|
|
37260
37261
|
console.log(`\u2705 Configuration exported to ${outputPath}`);
|
|
37261
37262
|
}
|
|
37262
37263
|
return content;
|
|
@@ -38060,10 +38061,10 @@ function suggestName(fp, p) {
|
|
|
38060
38061
|
const base = (fp.description || "file").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
38061
38062
|
return base || "file";
|
|
38062
38063
|
}
|
|
38063
|
-
function guessKindByPath(
|
|
38064
|
-
if (/__tests__|\.spec\.(t|j)sx?$|^tests\//.test(
|
|
38065
|
-
if (/^docs\//.test(
|
|
38066
|
-
if (/\.(json|cjs|js|ts)$/.test(
|
|
38064
|
+
function guessKindByPath(path64) {
|
|
38065
|
+
if (/__tests__|\.spec\.(t|j)sx?$|^tests\//.test(path64)) return "test";
|
|
38066
|
+
if (/^docs\//.test(path64) || /\.md$/.test(path64)) return "doc";
|
|
38067
|
+
if (/\.(json|cjs|js|ts)$/.test(path64) && !/src\//.test(path64)) return "config";
|
|
38067
38068
|
return "source";
|
|
38068
38069
|
}
|
|
38069
38070
|
var init_PathInferencer = __esm({
|
|
@@ -38323,9 +38324,9 @@ function formatPlanAsDiff(files, opts) {
|
|
|
38323
38324
|
function readCurrentFileSafe(root, rel, abs) {
|
|
38324
38325
|
if (!root && !abs) return "";
|
|
38325
38326
|
try {
|
|
38326
|
-
const
|
|
38327
|
+
const fs51 = __require("fs");
|
|
38327
38328
|
const p = abs ? abs : __require("path").join(root, rel);
|
|
38328
|
-
return
|
|
38329
|
+
return fs51.existsSync(p) ? fs51.readFileSync(p, "utf8") : "";
|
|
38329
38330
|
} catch {
|
|
38330
38331
|
return "";
|
|
38331
38332
|
}
|
|
@@ -39198,9 +39199,9 @@ ${editContext}`;
|
|
|
39198
39199
|
for (let i2 = 0; i2 < blocks.length; i2++) {
|
|
39199
39200
|
const b = blocks[i2];
|
|
39200
39201
|
const desired = typeof b.filename === "string" && b.filename.trim() ? b.filename.trim() : null;
|
|
39201
|
-
const
|
|
39202
|
+
const path64 = desired || suggestName2(request, b.language, i2);
|
|
39202
39203
|
initial.push({
|
|
39203
|
-
path:
|
|
39204
|
+
path: path64,
|
|
39204
39205
|
kind: "source",
|
|
39205
39206
|
action: "create",
|
|
39206
39207
|
description: describe2(b.language, ""),
|
|
@@ -39231,13 +39232,13 @@ ${editContext}`;
|
|
|
39231
39232
|
{ root: opts.root }
|
|
39232
39233
|
);
|
|
39233
39234
|
try {
|
|
39234
|
-
const [{ access: access18 },
|
|
39235
|
+
const [{ access: access18 }, path64] = await Promise.all([
|
|
39235
39236
|
import('fs/promises'),
|
|
39236
39237
|
import('path')
|
|
39237
39238
|
]);
|
|
39238
39239
|
for (const p of normalized) {
|
|
39239
39240
|
try {
|
|
39240
|
-
const absCandidate = p.absPath ? p.absPath :
|
|
39241
|
+
const absCandidate = p.absPath ? p.absPath : path64.join(opts.root, p.path);
|
|
39241
39242
|
await access18(absCandidate);
|
|
39242
39243
|
p.action = "modify";
|
|
39243
39244
|
if (isEditIntent) {
|
|
@@ -39429,12 +39430,12 @@ function languageExt(lang) {
|
|
|
39429
39430
|
}
|
|
39430
39431
|
async function journalResume(root, request, files) {
|
|
39431
39432
|
try {
|
|
39432
|
-
const
|
|
39433
|
+
const fs51 = await import('fs/promises');
|
|
39433
39434
|
const dir = path10__namespace.default.join(root, ".maria", "memory");
|
|
39434
|
-
await
|
|
39435
|
+
await fs51.mkdir(dir, { recursive: true });
|
|
39435
39436
|
const out = path10__namespace.default.join(dir, "resume-plan.json");
|
|
39436
39437
|
const payload = { request, createdAt: (/* @__PURE__ */ new Date()).toISOString(), files };
|
|
39437
|
-
await
|
|
39438
|
+
await fs51.writeFile(out, JSON.stringify(payload, null, 2), "utf8");
|
|
39438
39439
|
} catch {
|
|
39439
39440
|
}
|
|
39440
39441
|
}
|
|
@@ -39594,14 +39595,14 @@ async function ensureTopFolder(root, proposed, plans) {
|
|
|
39594
39595
|
return { folderName: unique };
|
|
39595
39596
|
}
|
|
39596
39597
|
async function ensureUniqueFolder(root, base) {
|
|
39597
|
-
const
|
|
39598
|
+
const fs51 = await import('fs/promises');
|
|
39598
39599
|
const pathMod = await import('path');
|
|
39599
39600
|
let name2 = sanitizeFolderName(base);
|
|
39600
39601
|
let suffix = 0;
|
|
39601
39602
|
for (; suffix < Number.MAX_SAFE_INTEGER; ) {
|
|
39602
39603
|
const candidate = suffix === 0 ? name2 : `${name2}-${String(suffix).padStart(2, "0")}`;
|
|
39603
39604
|
try {
|
|
39604
|
-
await
|
|
39605
|
+
await fs51.access(pathMod.join(root, candidate));
|
|
39605
39606
|
suffix += 1;
|
|
39606
39607
|
} catch {
|
|
39607
39608
|
return candidate;
|
|
@@ -39611,13 +39612,13 @@ async function ensureUniqueFolder(root, base) {
|
|
|
39611
39612
|
}
|
|
39612
39613
|
async function buildEditContext(root, files, maxLines, maxBytes) {
|
|
39613
39614
|
try {
|
|
39614
|
-
const
|
|
39615
|
+
const fs51 = await import('fs/promises');
|
|
39615
39616
|
const pathMod = await import('path');
|
|
39616
39617
|
const sections = [];
|
|
39617
39618
|
for (const rel of files) {
|
|
39618
39619
|
const full = pathMod.join(root, rel);
|
|
39619
39620
|
try {
|
|
39620
|
-
const buf = await
|
|
39621
|
+
const buf = await fs51.readFile(full);
|
|
39621
39622
|
const clipped = buf.length > maxBytes ? buf.subarray(0, maxBytes) : buf;
|
|
39622
39623
|
const text = clipped.toString("utf8").replace(/\r\n/g, "\n");
|
|
39623
39624
|
const lines = text.split("\n").slice(0, maxLines).join("\n");
|
|
@@ -39634,7 +39635,7 @@ ${lines}
|
|
|
39634
39635
|
}
|
|
39635
39636
|
}
|
|
39636
39637
|
async function resolveExplicitPaths(root, files, hintText) {
|
|
39637
|
-
const
|
|
39638
|
+
const fs51 = await import('fs/promises');
|
|
39638
39639
|
const pathMod = await import('path');
|
|
39639
39640
|
const { loadGlobby: loadGlobby2 } = await Promise.resolve().then(() => (init_esm_compat(), esm_compat_exports));
|
|
39640
39641
|
const globby = await loadGlobby2();
|
|
@@ -39652,7 +39653,7 @@ async function resolveExplicitPaths(root, files, hintText) {
|
|
|
39652
39653
|
const normalized = rel.replace(/^\/+/, "").replace(/\\/g, "/");
|
|
39653
39654
|
const fullExact = pathMod.join(root, normalized);
|
|
39654
39655
|
try {
|
|
39655
|
-
await
|
|
39656
|
+
await fs51.access(fullExact);
|
|
39656
39657
|
return normalized;
|
|
39657
39658
|
} catch {
|
|
39658
39659
|
}
|
|
@@ -39699,7 +39700,7 @@ async function resolveExplicitPaths(root, files, hintText) {
|
|
|
39699
39700
|
for (const pre of prefixes) {
|
|
39700
39701
|
const cand = pathMod.join(root, pre + normalized);
|
|
39701
39702
|
try {
|
|
39702
|
-
await
|
|
39703
|
+
await fs51.access(cand);
|
|
39703
39704
|
return (pre + normalized).replace(/^\/+/, "");
|
|
39704
39705
|
} catch {
|
|
39705
39706
|
}
|
|
@@ -39754,14 +39755,14 @@ async function resolveExplicitPaths(root, files, hintText) {
|
|
|
39754
39755
|
return out;
|
|
39755
39756
|
}
|
|
39756
39757
|
async function pickExistingFolderPrefix(root, parentPath) {
|
|
39757
|
-
const
|
|
39758
|
+
const fs51 = await import('fs/promises');
|
|
39758
39759
|
const pathMod = await import('path');
|
|
39759
39760
|
const parts = parentPath.replace(/^\/+/, "").split("/").filter(Boolean);
|
|
39760
39761
|
const prefixes = ["src", "app", "pages", ""];
|
|
39761
39762
|
for (const pre of prefixes) {
|
|
39762
39763
|
const test = pre ? pathMod.join(root, pre, ...parts) : pathMod.join(root, ...parts);
|
|
39763
39764
|
try {
|
|
39764
|
-
await
|
|
39765
|
+
await fs51.access(test);
|
|
39765
39766
|
return pre ? `${pre}/` : "";
|
|
39766
39767
|
} catch {
|
|
39767
39768
|
}
|
|
@@ -40121,16 +40122,16 @@ ${pretty}`);
|
|
|
40121
40122
|
}
|
|
40122
40123
|
async persistLastPlan(root, plans) {
|
|
40123
40124
|
try {
|
|
40124
|
-
const
|
|
40125
|
+
const fs51 = await import('fs/promises');
|
|
40125
40126
|
const p = path10__namespace.join(root, ".maria");
|
|
40126
|
-
await
|
|
40127
|
+
await fs51.mkdir(p, { recursive: true });
|
|
40127
40128
|
const out = path10__namespace.join(p, "last-plan.json");
|
|
40128
|
-
await
|
|
40129
|
+
await fs51.writeFile(out, JSON.stringify({ createdAt: (/* @__PURE__ */ new Date()).toISOString(), plans }, null, 2), "utf8");
|
|
40129
40130
|
} catch {
|
|
40130
40131
|
}
|
|
40131
40132
|
}
|
|
40132
40133
|
async applyPlan(plans, options) {
|
|
40133
|
-
const
|
|
40134
|
+
const fs51 = await import('fs/promises');
|
|
40134
40135
|
const created = [];
|
|
40135
40136
|
const modified = [];
|
|
40136
40137
|
const skipped = [];
|
|
@@ -40149,9 +40150,9 @@ ${pretty}`);
|
|
|
40149
40150
|
continue;
|
|
40150
40151
|
}
|
|
40151
40152
|
const tmp = full + `.tmp-${process.pid}-${Date.now()}`;
|
|
40152
|
-
await
|
|
40153
|
-
await
|
|
40154
|
-
await
|
|
40153
|
+
await fs51.mkdir(path10__namespace.dirname(full), { recursive: true });
|
|
40154
|
+
await fs51.writeFile(tmp, plan.preview || "", "utf8");
|
|
40155
|
+
await fs51.rename(tmp, full);
|
|
40155
40156
|
if (exists2) modified.push(plan.path);
|
|
40156
40157
|
else created.push(plan.path);
|
|
40157
40158
|
written++;
|
|
@@ -40162,7 +40163,7 @@ ${pretty}`);
|
|
|
40162
40163
|
if (options.rollback) {
|
|
40163
40164
|
for (const p of [...created, ...modified]) {
|
|
40164
40165
|
try {
|
|
40165
|
-
await
|
|
40166
|
+
await fs51.unlink(path10__namespace.join(options.root, p));
|
|
40166
40167
|
} catch {
|
|
40167
40168
|
}
|
|
40168
40169
|
}
|
|
@@ -40172,8 +40173,8 @@ ${pretty}`);
|
|
|
40172
40173
|
}
|
|
40173
40174
|
async pathExists(p) {
|
|
40174
40175
|
try {
|
|
40175
|
-
const
|
|
40176
|
-
await
|
|
40176
|
+
const fs51 = await import('fs/promises');
|
|
40177
|
+
await fs51.access(p);
|
|
40177
40178
|
return true;
|
|
40178
40179
|
} catch {
|
|
40179
40180
|
return false;
|
|
@@ -40284,17 +40285,17 @@ ${pretty}`);
|
|
|
40284
40285
|
// Attempt to collect attached files from context; map to AttachedFileContext
|
|
40285
40286
|
async collectAttachedFiles(context2) {
|
|
40286
40287
|
const list = [];
|
|
40287
|
-
const
|
|
40288
|
-
const
|
|
40288
|
+
const fs51 = await import('fs/promises');
|
|
40289
|
+
const path64 = await import('path');
|
|
40289
40290
|
const att = context2 && (context2.attachments || context2.input?.attachments) || [];
|
|
40290
40291
|
for (const a of att) {
|
|
40291
40292
|
try {
|
|
40292
40293
|
const p = a.path || a.filePath || a.name || "";
|
|
40293
|
-
const originalName = a.name ||
|
|
40294
|
+
const originalName = a.name || path64.basename(p || `attachment_${Date.now().toString(36)}`);
|
|
40294
40295
|
let content = a.content;
|
|
40295
40296
|
if (!content && p) {
|
|
40296
|
-
const abs =
|
|
40297
|
-
content = await
|
|
40297
|
+
const abs = path64.isAbsolute(p) ? p : path64.join(process.cwd(), p);
|
|
40298
|
+
content = await fs51.readFile(abs, "utf8");
|
|
40298
40299
|
}
|
|
40299
40300
|
if (!content) continue;
|
|
40300
40301
|
list.push({ originalName, pathHint: p || void 0, content, size: Buffer.byteLength(content, "utf8"), mime: a.mime || a.type });
|
|
@@ -41099,12 +41100,12 @@ async function scanRoot(opts) {
|
|
|
41099
41100
|
const filepath = path10__namespace.join(cwd2, name2);
|
|
41100
41101
|
const result = await safeRead(filepath, 512 * 1024, maxLines, signal);
|
|
41101
41102
|
if (result.head || result.meta) {
|
|
41102
|
-
let
|
|
41103
|
+
let meta27 = result.meta || object;
|
|
41103
41104
|
if (name2 === "package.json" && result.head) {
|
|
41104
41105
|
try {
|
|
41105
41106
|
const pkg = JSON.parse(result.head);
|
|
41106
|
-
|
|
41107
|
-
...
|
|
41107
|
+
meta27 = {
|
|
41108
|
+
...meta27,
|
|
41108
41109
|
name: pkg.name,
|
|
41109
41110
|
version: pkg.version,
|
|
41110
41111
|
type: pkg.type,
|
|
@@ -41117,14 +41118,14 @@ async function scanRoot(opts) {
|
|
|
41117
41118
|
workspaces: pkg.workspaces
|
|
41118
41119
|
};
|
|
41119
41120
|
} catch (e2) {
|
|
41120
|
-
|
|
41121
|
+
meta27.parseError = true;
|
|
41121
41122
|
}
|
|
41122
41123
|
}
|
|
41123
41124
|
findings.push({
|
|
41124
41125
|
file: name2,
|
|
41125
41126
|
kind: "read",
|
|
41126
41127
|
head: result.head,
|
|
41127
|
-
meta:
|
|
41128
|
+
meta: meta27,
|
|
41128
41129
|
truncated: result.truncated
|
|
41129
41130
|
});
|
|
41130
41131
|
}
|
|
@@ -41462,19 +41463,19 @@ function extractPackageInfo(findings) {
|
|
|
41462
41463
|
hasPostinstall: false
|
|
41463
41464
|
};
|
|
41464
41465
|
}
|
|
41465
|
-
const
|
|
41466
|
+
const meta27 = pkgFinding.meta;
|
|
41466
41467
|
return {
|
|
41467
|
-
name:
|
|
41468
|
-
version:
|
|
41469
|
-
type:
|
|
41470
|
-
scripts:
|
|
41471
|
-
hasPostinstall: !!
|
|
41472
|
-
bin:
|
|
41473
|
-
main:
|
|
41474
|
-
exports:
|
|
41475
|
-
dependencies:
|
|
41476
|
-
devDependencies:
|
|
41477
|
-
workspaces:
|
|
41468
|
+
name: meta27.name,
|
|
41469
|
+
version: meta27.version,
|
|
41470
|
+
type: meta27.type,
|
|
41471
|
+
scripts: meta27.scripts ? Object.keys(meta27.scripts) : [],
|
|
41472
|
+
hasPostinstall: !!meta27.scripts?.postinstall,
|
|
41473
|
+
bin: meta27.bin,
|
|
41474
|
+
main: meta27.main,
|
|
41475
|
+
exports: meta27.exports,
|
|
41476
|
+
dependencies: meta27.dependencies || [],
|
|
41477
|
+
devDependencies: meta27.devDependencies || [],
|
|
41478
|
+
workspaces: meta27.workspaces
|
|
41478
41479
|
};
|
|
41479
41480
|
}
|
|
41480
41481
|
function collectWarnings(pkg, findings, cwd2) {
|
|
@@ -41625,9 +41626,9 @@ function calculateMetrics(findings, startTime) {
|
|
|
41625
41626
|
}
|
|
41626
41627
|
function renderFinding(f3) {
|
|
41627
41628
|
const title = `### ${f3.kind.toUpperCase()} \u2014 ${f3.file}`;
|
|
41628
|
-
let
|
|
41629
|
+
let meta27 = "";
|
|
41629
41630
|
if (f3.meta && Object.keys(f3.meta).length > 0) {
|
|
41630
|
-
|
|
41631
|
+
meta27 = `
|
|
41631
41632
|
<details><summary>meta</summary>
|
|
41632
41633
|
|
|
41633
41634
|
\`\`\`json
|
|
@@ -41648,7 +41649,7 @@ ${f3.head.trim()}
|
|
|
41648
41649
|
}
|
|
41649
41650
|
const truncInfo = f3.truncated ? `
|
|
41650
41651
|
> _truncated preview_` : "";
|
|
41651
|
-
return [title,
|
|
41652
|
+
return [title, meta27, content, truncInfo, ""].join("\n");
|
|
41652
41653
|
}
|
|
41653
41654
|
function safeJsonStringify(obj) {
|
|
41654
41655
|
try {
|
|
@@ -49877,17 +49878,17 @@ var init_GraphEngine = __esm({
|
|
|
49877
49878
|
const visited = /* @__PURE__ */ new Set();
|
|
49878
49879
|
const queue = [{ id: from, path: [from] }];
|
|
49879
49880
|
while (queue.length) {
|
|
49880
|
-
const { id, path:
|
|
49881
|
+
const { id, path: path64 } = queue.shift();
|
|
49881
49882
|
if (visited.has(id)) continue;
|
|
49882
49883
|
visited.add(id);
|
|
49883
49884
|
const neighbors = this.edges.get(id) || /* @__PURE__ */ new Set();
|
|
49884
49885
|
for (const e2 of neighbors) {
|
|
49885
49886
|
if (e2.to === to) {
|
|
49886
|
-
const res = [...
|
|
49887
|
+
const res = [...path64, to];
|
|
49887
49888
|
this.recordQueryTime(Date.now() - start);
|
|
49888
49889
|
return res;
|
|
49889
49890
|
}
|
|
49890
|
-
if (!visited.has(e2.to)) queue.push({ id: e2.to, path: [...
|
|
49891
|
+
if (!visited.has(e2.to)) queue.push({ id: e2.to, path: [...path64, e2.to] });
|
|
49891
49892
|
}
|
|
49892
49893
|
}
|
|
49893
49894
|
this.recordQueryTime(Date.now() - start);
|
|
@@ -52554,12 +52555,12 @@ This will:
|
|
|
52554
52555
|
};
|
|
52555
52556
|
const result = await this.deltaDetector.detectDelta(root, deltaOptions);
|
|
52556
52557
|
const files = [
|
|
52557
|
-
...result.changed.map((
|
|
52558
|
-
_path:
|
|
52559
|
-
type: previousState?.fileHashes?.[
|
|
52558
|
+
...result.changed.map((path64) => ({
|
|
52559
|
+
_path: path64,
|
|
52560
|
+
type: previousState?.fileHashes?.[path64] ? "modified" : "added"
|
|
52560
52561
|
})),
|
|
52561
|
-
...result.deleted.map((
|
|
52562
|
-
_path:
|
|
52562
|
+
...result.deleted.map((path64) => ({
|
|
52563
|
+
_path: path64,
|
|
52563
52564
|
type: "deleted"
|
|
52564
52565
|
}))
|
|
52565
52566
|
];
|
|
@@ -56286,13 +56287,13 @@ async function checkShield(commandName, userPlan = "free") {
|
|
|
56286
56287
|
}
|
|
56287
56288
|
async function loadManifest() {
|
|
56288
56289
|
try {
|
|
56289
|
-
const
|
|
56290
|
-
const
|
|
56291
|
-
const manifestPath =
|
|
56290
|
+
const fs51 = await import('fs');
|
|
56291
|
+
const path64 = await import('path');
|
|
56292
|
+
const manifestPath = path64.join(
|
|
56292
56293
|
__dirname,
|
|
56293
56294
|
"../command-manifest-v2.1.json"
|
|
56294
56295
|
);
|
|
56295
|
-
const content =
|
|
56296
|
+
const content = fs51.readFileSync(manifestPath, "utf-8");
|
|
56296
56297
|
return JSON.parse(content);
|
|
56297
56298
|
} catch {
|
|
56298
56299
|
return { commands: [] };
|
|
@@ -57386,6 +57387,1071 @@ var init_gpu_command = __esm({
|
|
|
57386
57387
|
gpu_command_default = GPUCommand;
|
|
57387
57388
|
}
|
|
57388
57389
|
});
|
|
57390
|
+
var CriteriaManager;
|
|
57391
|
+
var init_CriteriaManager = __esm({
|
|
57392
|
+
"src/services/evaluation/CriteriaManager.ts"() {
|
|
57393
|
+
CriteriaManager = class {
|
|
57394
|
+
constructor(projectRoot) {
|
|
57395
|
+
this.projectRoot = projectRoot;
|
|
57396
|
+
}
|
|
57397
|
+
getDefaultPath() {
|
|
57398
|
+
return path10__namespace.default.join(this.projectRoot, ".maria", "evaluation.criteria.json");
|
|
57399
|
+
}
|
|
57400
|
+
async ensureCriteriaFile(customPath) {
|
|
57401
|
+
const criteriaPath = customPath ? path10__namespace.default.isAbsolute(customPath) ? customPath : path10__namespace.default.join(this.projectRoot, customPath) : this.getDefaultPath();
|
|
57402
|
+
const dir = path10__namespace.default.dirname(criteriaPath);
|
|
57403
|
+
await fs19.promises.mkdir(dir, { recursive: true });
|
|
57404
|
+
try {
|
|
57405
|
+
await fs19.promises.access(criteriaPath);
|
|
57406
|
+
return criteriaPath;
|
|
57407
|
+
} catch {
|
|
57408
|
+
const now2 = (/* @__PURE__ */ new Date()).toISOString();
|
|
57409
|
+
const payload = {
|
|
57410
|
+
version: "1.0.0",
|
|
57411
|
+
project: path10__namespace.default.basename(this.projectRoot) || "project",
|
|
57412
|
+
createdAt: now2,
|
|
57413
|
+
updatedAt: now2,
|
|
57414
|
+
items: this.createDefaultCriteria()
|
|
57415
|
+
};
|
|
57416
|
+
await fs19.promises.writeFile(criteriaPath, JSON.stringify(payload, null, 2), "utf8");
|
|
57417
|
+
return criteriaPath;
|
|
57418
|
+
}
|
|
57419
|
+
}
|
|
57420
|
+
async loadCriteria(criteriaPath) {
|
|
57421
|
+
const buf = await fs19.promises.readFile(criteriaPath, "utf8");
|
|
57422
|
+
const json = JSON.parse(buf);
|
|
57423
|
+
if (!Array.isArray(json.items)) {
|
|
57424
|
+
throw new Error("Invalid criteria file: items missing");
|
|
57425
|
+
}
|
|
57426
|
+
return json;
|
|
57427
|
+
}
|
|
57428
|
+
async updateCriteria(criteriaPath, updater) {
|
|
57429
|
+
const current = await this.loadCriteria(criteriaPath);
|
|
57430
|
+
const next = updater({ ...current, updatedAt: (/* @__PURE__ */ new Date()).toISOString() });
|
|
57431
|
+
await fs19.promises.writeFile(criteriaPath, JSON.stringify(next, null, 2), "utf8");
|
|
57432
|
+
}
|
|
57433
|
+
createDefaultCriteria() {
|
|
57434
|
+
const items = [
|
|
57435
|
+
["clarity", "Clarity: Clear goals and requirements", 0.15, "Are requirements, specs, and assumptions explicitly stated?"],
|
|
57436
|
+
["feasibility", "Feasibility: Realistic scope and timeline", 0.15, "Are dependencies, risks, and alternatives considered?"],
|
|
57437
|
+
["maintainability", "Maintainability: Structure and reuse", 0.15, "Does design follow separation of concerns and sound naming?"],
|
|
57438
|
+
["testability", "Testability: Strategy and coverage", 0.1, "Are unit/integration/regression test approaches considered?"],
|
|
57439
|
+
["security", "Security: Validation and secret handling", 0.1, "Are input validation, authz, and secret management addressed?"],
|
|
57440
|
+
["performance", "Performance: Efficiency and scalability", 0.1, "Are data volume, I/O, and bottlenecks considered?"],
|
|
57441
|
+
["alignment", "Project Alignment: Conventions and structure", 0.15, "Does it follow folder structure, naming, and tooling?"],
|
|
57442
|
+
["completeness", "Completeness: Edge cases and failures", 0.1, "Are inputs/outputs/errors/logging/edge cases covered?"]
|
|
57443
|
+
];
|
|
57444
|
+
return items.map(([id, name2, weight, rubric]) => ({ id, name: name2, weight, rubric, description: name2 }));
|
|
57445
|
+
}
|
|
57446
|
+
};
|
|
57447
|
+
}
|
|
57448
|
+
});
|
|
57449
|
+
|
|
57450
|
+
// src/services/evaluation/ScoringEngine.ts
|
|
57451
|
+
var ScoringEngine;
|
|
57452
|
+
var init_ScoringEngine = __esm({
|
|
57453
|
+
"src/services/evaluation/ScoringEngine.ts"() {
|
|
57454
|
+
ScoringEngine = class {
|
|
57455
|
+
async evaluate(input3, criteria) {
|
|
57456
|
+
const textBundle = this.joinInput(input3);
|
|
57457
|
+
const details = [];
|
|
57458
|
+
for (const item of criteria.items) {
|
|
57459
|
+
const score = this.heuristicScore(textBundle, item.id);
|
|
57460
|
+
const reason = this.generateReason(textBundle, item.id);
|
|
57461
|
+
details.push({ id: item.id, name: item.name, weight: item.weight, score, reason });
|
|
57462
|
+
}
|
|
57463
|
+
const totalWeight = details.reduce((s2, d) => s2 + d.weight, 0) || 1;
|
|
57464
|
+
const totalScore = details.reduce((s2, d) => s2 + d.score * d.weight, 0) / totalWeight;
|
|
57465
|
+
return { totalScore, details };
|
|
57466
|
+
}
|
|
57467
|
+
joinInput(input3) {
|
|
57468
|
+
const parts = [];
|
|
57469
|
+
if (input3.idea) parts.push(`IDEA:
|
|
57470
|
+
${input3.idea}`);
|
|
57471
|
+
if (input3.code) parts.push(`CODE:
|
|
57472
|
+
${input3.code}`);
|
|
57473
|
+
if (input3.files && input3.files.length) {
|
|
57474
|
+
for (const f3 of input3.files) {
|
|
57475
|
+
parts.push(`FILE ${f3.path}:
|
|
57476
|
+
${f3.content}`);
|
|
57477
|
+
}
|
|
57478
|
+
}
|
|
57479
|
+
return parts.join("\n\n");
|
|
57480
|
+
}
|
|
57481
|
+
heuristicScore(bundle, aspect) {
|
|
57482
|
+
const lower2 = bundle.toLowerCase();
|
|
57483
|
+
const checks = {
|
|
57484
|
+
clarity: ["objective", "\u76EE\u7684", "\u8981\u4EF6", "spec", "\u4ED5\u69D8"],
|
|
57485
|
+
feasibility: ["risk", "\u30EA\u30B9\u30AF", "plan", "\u8A08\u753B", "timeline"],
|
|
57486
|
+
maintainability: ["function", "class", "interface", "\u5206\u5272", "\u30E2\u30B8\u30E5\u30FC\u30EB"],
|
|
57487
|
+
testability: ["test", "spec", "vitest", "jest", "coverage"],
|
|
57488
|
+
security: ["secret", "env", "sanitize", "validation", "\u6A29\u9650"],
|
|
57489
|
+
performance: ["cache", "\u6027\u80FD", "optimiz", "stream", "memo"],
|
|
57490
|
+
alignment: ["src/", "pnpm", "eslint", "prettier", "convention"],
|
|
57491
|
+
completeness: ["edge case", "\u7570\u5E38\u7CFB", "\u30A8\u30E9\u30FC", "fallback", "retry"]
|
|
57492
|
+
};
|
|
57493
|
+
const words = checks[aspect] || [];
|
|
57494
|
+
const hits = words.reduce((c, w) => c + (lower2.includes(w) ? 1 : 0), 0);
|
|
57495
|
+
if (hits === 0) return 0.3;
|
|
57496
|
+
if (hits === 1) return 0.55;
|
|
57497
|
+
if (hits === 2) return 0.75;
|
|
57498
|
+
return 0.9;
|
|
57499
|
+
}
|
|
57500
|
+
generateReason(bundle, aspect) {
|
|
57501
|
+
switch (aspect) {
|
|
57502
|
+
case "clarity":
|
|
57503
|
+
return "\u8981\u6C42\u3084\u4ED5\u69D8\u306E\u660E\u793A\u5EA6\u304B\u3089\u6982\u7B97";
|
|
57504
|
+
case "feasibility":
|
|
57505
|
+
return "\u30EA\u30B9\u30AF\u30FB\u8A08\u753B\u306E\u8A18\u8F09\u6709\u7121\u304B\u3089\u6982\u7B97";
|
|
57506
|
+
case "maintainability":
|
|
57507
|
+
return "\u69CB\u9020\u5316\u30FB\u518D\u5229\u7528\u6027\u306E\u5146\u5019\u304B\u3089\u6982\u7B97";
|
|
57508
|
+
case "testability":
|
|
57509
|
+
return "\u30C6\u30B9\u30C8\u95A2\u9023\u306E\u8A00\u53CA\u304B\u3089\u6982\u7B97";
|
|
57510
|
+
case "security":
|
|
57511
|
+
return "\u79D8\u5BC6\u7BA1\u7406\u30FB\u5165\u529B\u691C\u8A3C\u306E\u8A00\u53CA\u304B\u3089\u6982\u7B97";
|
|
57512
|
+
case "performance":
|
|
57513
|
+
return "\u6027\u80FD\u6700\u9069\u5316\u306E\u793A\u5506\u304B\u3089\u6982\u7B97";
|
|
57514
|
+
case "alignment":
|
|
57515
|
+
return "\u30EA\u30DD\u30B8\u30C8\u30EA\u898F\u7D04\u3078\u306E\u8A00\u53CA\u304B\u3089\u6982\u7B97";
|
|
57516
|
+
case "completeness":
|
|
57517
|
+
return "\u7570\u5E38\u7CFB\u30FB\u30A8\u30C3\u30B8\u30B1\u30FC\u30B9\u306E\u7DB2\u7F85\u5EA6\u304B\u3089\u6982\u7B97";
|
|
57518
|
+
default:
|
|
57519
|
+
return "\u30D2\u30E5\u30FC\u30EA\u30B9\u30C6\u30A3\u30C3\u30AF\u8A55\u4FA1";
|
|
57520
|
+
}
|
|
57521
|
+
}
|
|
57522
|
+
};
|
|
57523
|
+
}
|
|
57524
|
+
});
|
|
57525
|
+
var EvaluationOrchestrator;
|
|
57526
|
+
var init_EvaluationOrchestrator = __esm({
|
|
57527
|
+
"src/services/evaluation/EvaluationOrchestrator.ts"() {
|
|
57528
|
+
init_CriteriaManager();
|
|
57529
|
+
init_ScoringEngine();
|
|
57530
|
+
init_api_caller();
|
|
57531
|
+
EvaluationOrchestrator = class {
|
|
57532
|
+
constructor(projectRoot) {
|
|
57533
|
+
this.projectRoot = projectRoot;
|
|
57534
|
+
this.criteriaManager = new CriteriaManager(projectRoot);
|
|
57535
|
+
this.engine = new ScoringEngine();
|
|
57536
|
+
}
|
|
57537
|
+
criteriaManager;
|
|
57538
|
+
engine;
|
|
57539
|
+
async assess(options) {
|
|
57540
|
+
const criteriaPath = options.criteria ? path10__namespace.default.isAbsolute(options.criteria) ? options.criteria : path10__namespace.default.join(this.projectRoot, options.criteria) : this.criteriaManager.getDefaultPath();
|
|
57541
|
+
const needGenerate = !!options.regenerateCriteria || !await this.exists(criteriaPath);
|
|
57542
|
+
if (needGenerate) {
|
|
57543
|
+
try {
|
|
57544
|
+
await this.generateCriteriaWithLLM(criteriaPath, {
|
|
57545
|
+
idea: options.idea,
|
|
57546
|
+
code: options.code,
|
|
57547
|
+
files: options.files || []
|
|
57548
|
+
});
|
|
57549
|
+
} catch {
|
|
57550
|
+
await this.criteriaManager.ensureCriteriaFile(criteriaPath);
|
|
57551
|
+
}
|
|
57552
|
+
} else {
|
|
57553
|
+
await this.criteriaManager.ensureCriteriaFile(criteriaPath);
|
|
57554
|
+
}
|
|
57555
|
+
const criteria = await this.criteriaManager.loadCriteria(criteriaPath);
|
|
57556
|
+
if (options.criteriaOnly) {
|
|
57557
|
+
return { criteriaPath, result: null };
|
|
57558
|
+
}
|
|
57559
|
+
const files = await this.readFiles(options.files || []);
|
|
57560
|
+
const input3 = {
|
|
57561
|
+
idea: options.idea,
|
|
57562
|
+
code: options.code,
|
|
57563
|
+
files
|
|
57564
|
+
};
|
|
57565
|
+
let result;
|
|
57566
|
+
if (options.llmScoring !== false) {
|
|
57567
|
+
try {
|
|
57568
|
+
result = await this.scoreWithLLM(input3, criteria);
|
|
57569
|
+
} catch {
|
|
57570
|
+
result = await this.engine.evaluate(input3, criteria);
|
|
57571
|
+
}
|
|
57572
|
+
} else {
|
|
57573
|
+
result = await this.engine.evaluate(input3, criteria);
|
|
57574
|
+
}
|
|
57575
|
+
result.files = input3.files || [];
|
|
57576
|
+
return { criteriaPath, result };
|
|
57577
|
+
}
|
|
57578
|
+
async exists(p) {
|
|
57579
|
+
try {
|
|
57580
|
+
await fs19.promises.stat(p);
|
|
57581
|
+
return true;
|
|
57582
|
+
} catch {
|
|
57583
|
+
return false;
|
|
57584
|
+
}
|
|
57585
|
+
}
|
|
57586
|
+
async generateCriteriaWithLLM(criteriaPath, context2) {
|
|
57587
|
+
const relPath = path10__namespace.default.relative(this.projectRoot, criteriaPath).replace(/\\/g, "/");
|
|
57588
|
+
const targetPath = relPath.startsWith(".") ? relPath : relPath;
|
|
57589
|
+
const dir = path10__namespace.default.dirname(criteriaPath);
|
|
57590
|
+
await fs19.promises.mkdir(dir, { recursive: true });
|
|
57591
|
+
const system = [
|
|
57592
|
+
"You are an expert evaluation designer.",
|
|
57593
|
+
"Create a JSON criteria file for evaluating the given idea/code/files.",
|
|
57594
|
+
"Respond ONLY with a single multi-file section in this exact format:",
|
|
57595
|
+
`[BEGIN file: ${targetPath}]`,
|
|
57596
|
+
"{JSON}",
|
|
57597
|
+
"[END]",
|
|
57598
|
+
"Do not include any other text or markdown.",
|
|
57599
|
+
"JSON schema:",
|
|
57600
|
+
'{ "version": "1.0.0", "project": string, "createdAt": ISO string, "updatedAt": ISO string, "items": [{ "id": string, "name": string, "description": string, "weight": number (0..1), "rubric": string }] }',
|
|
57601
|
+
"Total weight across items should be ~1. Use concise English labels and rubrics tailored to the input."
|
|
57602
|
+
].join("\n");
|
|
57603
|
+
const user = [
|
|
57604
|
+
`Project: ${path10__namespace.default.basename(this.projectRoot)}`,
|
|
57605
|
+
context2.idea ? `Idea:
|
|
57606
|
+
${context2.idea}` : void 0,
|
|
57607
|
+
context2.code ? `Code snippet:
|
|
57608
|
+
${context2.code}` : void 0,
|
|
57609
|
+
context2.files.length ? `Files:
|
|
57610
|
+
${context2.files.map((f3) => `- ${f3}`).join("\n")}` : void 0
|
|
57611
|
+
].filter(Boolean).join("\n\n");
|
|
57612
|
+
const response = await callAPI("/v1/ai-proxy", {
|
|
57613
|
+
method: "POST",
|
|
57614
|
+
body: {
|
|
57615
|
+
prompt: `${system}
|
|
57616
|
+
|
|
57617
|
+
---
|
|
57618
|
+
|
|
57619
|
+
${user}`,
|
|
57620
|
+
taskType: "evaluation"
|
|
57621
|
+
}
|
|
57622
|
+
});
|
|
57623
|
+
const content = (response?.data?.content || response?.output || "").trim();
|
|
57624
|
+
if (!content) throw new Error("Empty LLM response");
|
|
57625
|
+
const fileMap = this.parseFileSections(content);
|
|
57626
|
+
let payload;
|
|
57627
|
+
if (fileMap.size > 0) {
|
|
57628
|
+
payload = fileMap.get(targetPath) || Array.from(fileMap.values())[0];
|
|
57629
|
+
} else {
|
|
57630
|
+
payload = this.extractFirstJsonObject(content) || content;
|
|
57631
|
+
}
|
|
57632
|
+
try {
|
|
57633
|
+
JSON.parse(payload);
|
|
57634
|
+
} catch {
|
|
57635
|
+
throw new Error("Invalid JSON in generated criteria");
|
|
57636
|
+
}
|
|
57637
|
+
await fs19.promises.writeFile(criteriaPath, payload, "utf8");
|
|
57638
|
+
}
|
|
57639
|
+
parseFileSections(text) {
|
|
57640
|
+
const map = /* @__PURE__ */ new Map();
|
|
57641
|
+
const regex2 = /\[BEGIN\s+file:\s*([^\]]+)\]\r?\n([\s\S]*?)\[END\]/gi;
|
|
57642
|
+
let m2;
|
|
57643
|
+
while ((m2 = regex2.exec(text)) !== null) {
|
|
57644
|
+
const file = m2[1].trim();
|
|
57645
|
+
const body = m2[2];
|
|
57646
|
+
map.set(file, body);
|
|
57647
|
+
}
|
|
57648
|
+
return map;
|
|
57649
|
+
}
|
|
57650
|
+
extractFirstJsonObject(text) {
|
|
57651
|
+
const fence = /```json\r?\n([\s\S]*?)```/i.exec(text);
|
|
57652
|
+
if (fence) return fence[1];
|
|
57653
|
+
const start = text.indexOf("{");
|
|
57654
|
+
const end = text.lastIndexOf("}");
|
|
57655
|
+
if (start >= 0 && end > start) {
|
|
57656
|
+
const cand = text.slice(start, end + 1);
|
|
57657
|
+
try {
|
|
57658
|
+
JSON.parse(cand);
|
|
57659
|
+
return cand;
|
|
57660
|
+
} catch {
|
|
57661
|
+
}
|
|
57662
|
+
}
|
|
57663
|
+
return null;
|
|
57664
|
+
}
|
|
57665
|
+
async scoreWithLLM(input3, criteria) {
|
|
57666
|
+
const criteriaPreview = criteria.items.map((it) => ({ id: it.id, name: it.name, weight: it.weight, rubric: it.rubric })).slice(0, 20);
|
|
57667
|
+
const bundleParts = [];
|
|
57668
|
+
if (input3.idea) bundleParts.push(`Idea:
|
|
57669
|
+
${input3.idea}`);
|
|
57670
|
+
if (input3.code) bundleParts.push(`Code:
|
|
57671
|
+
${input3.code}`);
|
|
57672
|
+
if (input3.files && input3.files.length) {
|
|
57673
|
+
bundleParts.push(`Files:
|
|
57674
|
+
${input3.files.slice(0, 5).map((f3) => `- ${f3.path}`).join("\n")}`);
|
|
57675
|
+
}
|
|
57676
|
+
const bundle = bundleParts.join("\n\n");
|
|
57677
|
+
const system = [
|
|
57678
|
+
"You are an impartial evaluator. Score each criterion between 0 and 1.",
|
|
57679
|
+
"Return JSON only in the following schema:",
|
|
57680
|
+
'{ "totalScore": number (0..1), "details": [{ "id": string, "score": number (0..1), "reason": string }] }',
|
|
57681
|
+
"Keep reasons short (<= 120 chars)."
|
|
57682
|
+
].join("\n");
|
|
57683
|
+
const user = [
|
|
57684
|
+
`Criteria: ${JSON.stringify(criteriaPreview)}`,
|
|
57685
|
+
"Input to evaluate:",
|
|
57686
|
+
bundle
|
|
57687
|
+
].join("\n\n");
|
|
57688
|
+
const response = await callAPI("/v1/ai-proxy", {
|
|
57689
|
+
method: "POST",
|
|
57690
|
+
body: {
|
|
57691
|
+
prompt: `${system}
|
|
57692
|
+
|
|
57693
|
+
---
|
|
57694
|
+
|
|
57695
|
+
${user}`,
|
|
57696
|
+
taskType: "evaluation"
|
|
57697
|
+
}
|
|
57698
|
+
});
|
|
57699
|
+
const raw = (response?.data?.content || response?.output || "").trim();
|
|
57700
|
+
if (!raw) throw new Error("Empty LLM scoring response");
|
|
57701
|
+
let jsonText = this.extractFirstJsonObject(raw) || raw;
|
|
57702
|
+
const sections = this.parseFileSections(raw);
|
|
57703
|
+
if (sections.size > 0) {
|
|
57704
|
+
jsonText = Array.from(sections.values())[0];
|
|
57705
|
+
}
|
|
57706
|
+
const parsed = JSON.parse(jsonText);
|
|
57707
|
+
const details = criteria.items.map((it) => {
|
|
57708
|
+
const found = parsed.details.find((d) => d.id === it.id);
|
|
57709
|
+
const score = Math.max(0, Math.min(1, found?.score ?? 0));
|
|
57710
|
+
return { id: it.id, name: it.name, weight: it.weight, score, reason: found?.reason || "" };
|
|
57711
|
+
});
|
|
57712
|
+
const totalWeight = details.reduce((s2, d) => s2 + d.weight, 0) || 1;
|
|
57713
|
+
const weighted = details.reduce((s2, d) => s2 + d.score * d.weight, 0) / totalWeight;
|
|
57714
|
+
const totalScore = Number.isFinite(parsed.totalScore) ? Math.max(0, Math.min(1, parsed.totalScore)) : weighted;
|
|
57715
|
+
return { totalScore, details };
|
|
57716
|
+
}
|
|
57717
|
+
async readFiles(pathsInput) {
|
|
57718
|
+
const out = [];
|
|
57719
|
+
for (const p of pathsInput) {
|
|
57720
|
+
const abs = path10__namespace.default.isAbsolute(p) ? p : path10__namespace.default.join(this.projectRoot, p);
|
|
57721
|
+
try {
|
|
57722
|
+
const stat13 = await fs19.promises.stat(abs);
|
|
57723
|
+
if (stat13.isDirectory()) {
|
|
57724
|
+
continue;
|
|
57725
|
+
}
|
|
57726
|
+
const content = await fs19.promises.readFile(abs, "utf8");
|
|
57727
|
+
out.push({ path: abs, content });
|
|
57728
|
+
} catch {
|
|
57729
|
+
}
|
|
57730
|
+
}
|
|
57731
|
+
return out;
|
|
57732
|
+
}
|
|
57733
|
+
};
|
|
57734
|
+
}
|
|
57735
|
+
});
|
|
57736
|
+
function extractFirstJson(text) {
|
|
57737
|
+
const fence = /```json\r?\n([\s\S]*?)```/i.exec(text);
|
|
57738
|
+
if (fence) return fence[1];
|
|
57739
|
+
const start = text.indexOf("{");
|
|
57740
|
+
const end = text.lastIndexOf("}");
|
|
57741
|
+
if (start >= 0 && end > start) {
|
|
57742
|
+
const cand = text.slice(start, end + 1);
|
|
57743
|
+
try {
|
|
57744
|
+
JSON.parse(cand);
|
|
57745
|
+
return cand;
|
|
57746
|
+
} catch {
|
|
57747
|
+
}
|
|
57748
|
+
}
|
|
57749
|
+
return null;
|
|
57750
|
+
}
|
|
57751
|
+
function sanitizePath(candidate, cwd2) {
|
|
57752
|
+
const normalized = path10__namespace.default.normalize(candidate);
|
|
57753
|
+
const absolute = path10__namespace.default.isAbsolute(normalized) ? normalized : path10__namespace.default.join(cwd2, normalized);
|
|
57754
|
+
const resolved = path10__namespace.default.resolve(absolute);
|
|
57755
|
+
const root = path10__namespace.default.resolve(cwd2);
|
|
57756
|
+
if (!resolved.startsWith(root)) return void 0;
|
|
57757
|
+
return resolved;
|
|
57758
|
+
}
|
|
57759
|
+
async function inferAssessParams(rawText, cwd2) {
|
|
57760
|
+
const system = [
|
|
57761
|
+
"You extract structured options for an evaluation command.",
|
|
57762
|
+
'Return JSON only with keys: { "criteriaPath"?: string, "regenerate"?: boolean, "criteriaOnly"?: boolean, "files"?: string[], "idea"?: string, "code"?: string }.',
|
|
57763
|
+
'Prefer concise relative paths for criteria (e.g., "AGI-hackathon-ideathon/evaluation.criteria.json").',
|
|
57764
|
+
"If the text asks to create/save criteria/rubric (without asking for evaluation), set criteriaOnly=true.",
|
|
57765
|
+
"If the text mentions saving criteria to a folder, set criteriaPath accordingly and regenerate=true.",
|
|
57766
|
+
"If it references files or folders, include them in files[] (relative to cwd).",
|
|
57767
|
+
"If idea content is present, place in idea; do not paraphrase."
|
|
57768
|
+
].join("\n");
|
|
57769
|
+
const user = rawText;
|
|
57770
|
+
const response = await callAPI("/v1/ai-proxy", {
|
|
57771
|
+
method: "POST",
|
|
57772
|
+
body: {
|
|
57773
|
+
prompt: `${system}
|
|
57774
|
+
|
|
57775
|
+
---
|
|
57776
|
+
|
|
57777
|
+
${user}`,
|
|
57778
|
+
taskType: "evaluation"
|
|
57779
|
+
}
|
|
57780
|
+
});
|
|
57781
|
+
const raw = (response?.data?.content || response?.output || "").trim();
|
|
57782
|
+
const jsonText = extractFirstJson(raw) || raw;
|
|
57783
|
+
let parsed = {};
|
|
57784
|
+
try {
|
|
57785
|
+
parsed = JSON.parse(jsonText);
|
|
57786
|
+
} catch {
|
|
57787
|
+
return {};
|
|
57788
|
+
}
|
|
57789
|
+
const out = {};
|
|
57790
|
+
if (typeof parsed.idea === "string" && parsed.idea.trim()) out.idea = parsed.idea.trim();
|
|
57791
|
+
if (typeof parsed.code === "string" && parsed.code.trim()) out.code = parsed.code.trim();
|
|
57792
|
+
if (typeof parsed.regenerate === "boolean") out.regenerate = parsed.regenerate;
|
|
57793
|
+
if (typeof parsed.criteriaOnly === "boolean") out.criteriaOnly = parsed.criteriaOnly;
|
|
57794
|
+
if (typeof parsed.criteriaPath === "string" && parsed.criteriaPath.trim()) {
|
|
57795
|
+
const safe = sanitizePath(parsed.criteriaPath.trim(), cwd2);
|
|
57796
|
+
if (safe) out.criteriaPath = safe;
|
|
57797
|
+
}
|
|
57798
|
+
if (Array.isArray(parsed.files)) {
|
|
57799
|
+
out.files = parsed.files.filter((f3) => typeof f3 === "string" && f3.trim()).map((f3) => sanitizePath(f3.trim(), cwd2)).filter((x2) => Boolean(x2));
|
|
57800
|
+
}
|
|
57801
|
+
return out;
|
|
57802
|
+
}
|
|
57803
|
+
var init_ArgumentInference = __esm({
|
|
57804
|
+
"src/services/evaluation/ArgumentInference.ts"() {
|
|
57805
|
+
init_api_caller();
|
|
57806
|
+
}
|
|
57807
|
+
});
|
|
57808
|
+
|
|
57809
|
+
// src/slash-commands/categories/evaluation/evaluate.command.ts
|
|
57810
|
+
var evaluate_command_exports = {};
|
|
57811
|
+
__export(evaluate_command_exports, {
|
|
57812
|
+
EvaluateCommand: () => EvaluateCommand,
|
|
57813
|
+
default: () => evaluate_command_default,
|
|
57814
|
+
meta: () => meta26
|
|
57815
|
+
});
|
|
57816
|
+
var EvaluateCommand, meta26, evaluate_command_default;
|
|
57817
|
+
var init_evaluate_command = __esm({
|
|
57818
|
+
"src/slash-commands/categories/evaluation/evaluate.command.ts"() {
|
|
57819
|
+
init_base_command();
|
|
57820
|
+
init_logger();
|
|
57821
|
+
init_EvaluationOrchestrator();
|
|
57822
|
+
init_api_caller();
|
|
57823
|
+
init_animations();
|
|
57824
|
+
init_ArgumentInference();
|
|
57825
|
+
EvaluateCommand = class extends BaseCommand {
|
|
57826
|
+
name = "evaluate";
|
|
57827
|
+
category = "evaluation";
|
|
57828
|
+
description = "\u{1F9EA} Run A/B tests and quality evaluations using the Phase 4 framework";
|
|
57829
|
+
aliases = ["eval", "test", "ab"];
|
|
57830
|
+
usage = "[run|status|results|stop|assess] [--config <path>] [--dataset <path>] [--format <format>] [--compare-baseline] [--idea <text>] [--code <text>] [--file <path> ...] [--criteria <path>]";
|
|
57831
|
+
examples = [
|
|
57832
|
+
{
|
|
57833
|
+
input: "/evaluate run --config tests/golden/config.json",
|
|
57834
|
+
description: "Run A/B evaluation with specified configuration",
|
|
57835
|
+
output: "Started evaluation test with nDCG and MRR metrics"
|
|
57836
|
+
},
|
|
57837
|
+
{
|
|
57838
|
+
input: "/evaluate status",
|
|
57839
|
+
description: "Show current evaluation status and active tests",
|
|
57840
|
+
output: "Evaluation system status with running/completed tests"
|
|
57841
|
+
},
|
|
57842
|
+
{
|
|
57843
|
+
input: "/evaluate results --format table",
|
|
57844
|
+
description: "Display latest evaluation results in table format",
|
|
57845
|
+
output: "Formatted table with quality metrics and improvements"
|
|
57846
|
+
},
|
|
57847
|
+
{
|
|
57848
|
+
input: "/evaluate run --dataset golden/sharepoint.json --compare-baseline",
|
|
57849
|
+
description: "Run evaluation against custom dataset with baseline comparison",
|
|
57850
|
+
output: "A/B test results with statistical significance analysis"
|
|
57851
|
+
},
|
|
57852
|
+
{
|
|
57853
|
+
input: "/evaluate assess --idea 'CLI\u306E\u8A2D\u8A08\u65B9\u91DD' --file src/cli.ts",
|
|
57854
|
+
description: "Generate criteria if missing and assess idea/files",
|
|
57855
|
+
output: "Weighted score and per-criterion breakdown"
|
|
57856
|
+
}
|
|
57857
|
+
];
|
|
57858
|
+
permissions = {
|
|
57859
|
+
requiresAuth: false,
|
|
57860
|
+
role: void 0
|
|
57861
|
+
};
|
|
57862
|
+
rateLimit = {
|
|
57863
|
+
requests: 10,
|
|
57864
|
+
window: "5m"
|
|
57865
|
+
};
|
|
57866
|
+
async execute(args2, context2) {
|
|
57867
|
+
try {
|
|
57868
|
+
const { options, parsed } = args2;
|
|
57869
|
+
const positional = parsed["positional"] || [];
|
|
57870
|
+
const candidate = positional[0];
|
|
57871
|
+
const hasFreeText = Array.isArray(args2.raw) && args2.raw.length > 0;
|
|
57872
|
+
const subcommand = candidate ? candidate : hasFreeText ? "assess" : "status";
|
|
57873
|
+
const normalized = subcommand.toLowerCase();
|
|
57874
|
+
const allowed = /* @__PURE__ */ new Set(["run", "status", "results", "stop", "assess"]);
|
|
57875
|
+
if (!allowed.has(normalized)) {
|
|
57876
|
+
const idea = (args2.raw || []).join(" ").trim();
|
|
57877
|
+
return await this.assessInput({ ...options, idea }, context2, args2);
|
|
57878
|
+
}
|
|
57879
|
+
switch (normalized) {
|
|
57880
|
+
case "run":
|
|
57881
|
+
return await this.runEvaluation(options, context2);
|
|
57882
|
+
case "status":
|
|
57883
|
+
return await this.getEvaluationStatus(options);
|
|
57884
|
+
case "results":
|
|
57885
|
+
return await this.getEvaluationResults(options);
|
|
57886
|
+
case "stop":
|
|
57887
|
+
return await this.stopEvaluation(options);
|
|
57888
|
+
case "assess":
|
|
57889
|
+
return await this.assessInput(options, context2, args2);
|
|
57890
|
+
default:
|
|
57891
|
+
return await this.assessInput(options, context2, args2);
|
|
57892
|
+
}
|
|
57893
|
+
} catch (error2) {
|
|
57894
|
+
logger.error("Evaluation command failed:", error2);
|
|
57895
|
+
return this.error(
|
|
57896
|
+
"Evaluation execution failed",
|
|
57897
|
+
"EVALUATION_ERROR",
|
|
57898
|
+
error2 instanceof Error ? error2.message : "Unknown error occurred"
|
|
57899
|
+
);
|
|
57900
|
+
}
|
|
57901
|
+
}
|
|
57902
|
+
/**
|
|
57903
|
+
* Assess idea/code/files using criteria (creates default criteria if missing)
|
|
57904
|
+
*/
|
|
57905
|
+
async assessInput(options, context2, commandArgs) {
|
|
57906
|
+
const root = context2.environment?.cwd || process.cwd();
|
|
57907
|
+
const rawText = (commandArgs?.raw || []).join(" ");
|
|
57908
|
+
const cwd2 = root;
|
|
57909
|
+
let inferred = {};
|
|
57910
|
+
try {
|
|
57911
|
+
const inferSpin = new ProcessAnimation();
|
|
57912
|
+
inferSpin.start();
|
|
57913
|
+
try {
|
|
57914
|
+
inferred = await inferAssessParams(rawText, cwd2);
|
|
57915
|
+
} finally {
|
|
57916
|
+
try {
|
|
57917
|
+
inferSpin.stop();
|
|
57918
|
+
} catch {
|
|
57919
|
+
}
|
|
57920
|
+
}
|
|
57921
|
+
} catch {
|
|
57922
|
+
}
|
|
57923
|
+
const filesOption = options["file"];
|
|
57924
|
+
const filesFromFlags = Array.isArray(filesOption) ? filesOption : filesOption ? [filesOption] : [];
|
|
57925
|
+
const files = Array.from(/* @__PURE__ */ new Set([...inferred.files || [], ...filesFromFlags]));
|
|
57926
|
+
const orchestrator = new EvaluationOrchestrator(root);
|
|
57927
|
+
const spinner = new ProcessAnimation();
|
|
57928
|
+
spinner.start();
|
|
57929
|
+
let criteriaPath;
|
|
57930
|
+
let result;
|
|
57931
|
+
try {
|
|
57932
|
+
const assessed = await orchestrator.assess({
|
|
57933
|
+
root,
|
|
57934
|
+
criteria: options["criteria"] || inferred.criteriaPath || void 0,
|
|
57935
|
+
files,
|
|
57936
|
+
idea: options["idea"] || inferred.idea || void 0,
|
|
57937
|
+
code: options["code"] || inferred.code || void 0,
|
|
57938
|
+
regenerateCriteria: !!options["regenerate"] || !!options["regen"] || !options["criteria"] || !!inferred.regenerate,
|
|
57939
|
+
llmScoring: options["no-llm-scoring"] ? false : true,
|
|
57940
|
+
criteriaOnly: !!options["criteria-only"] || !!inferred.criteriaOnly
|
|
57941
|
+
});
|
|
57942
|
+
criteriaPath = assessed.criteriaPath;
|
|
57943
|
+
result = assessed.result;
|
|
57944
|
+
} finally {
|
|
57945
|
+
try {
|
|
57946
|
+
spinner.stop();
|
|
57947
|
+
} catch {
|
|
57948
|
+
}
|
|
57949
|
+
}
|
|
57950
|
+
const system = [
|
|
57951
|
+
"You are an expert evaluator.",
|
|
57952
|
+
"Return a concise English assessment with:",
|
|
57953
|
+
"- A one-line overall verdict",
|
|
57954
|
+
"- A weighted score (0-100)",
|
|
57955
|
+
"- A short bullet breakdown per criterion (name: score/100 - brief reason)",
|
|
57956
|
+
"Be direct and professional."
|
|
57957
|
+
].join("\n");
|
|
57958
|
+
if (result === null) {
|
|
57959
|
+
const rel = path10__namespace.default.relative(root, criteriaPath);
|
|
57960
|
+
return this.success(`Criteria file created: ${rel}`);
|
|
57961
|
+
}
|
|
57962
|
+
const breakdown = result.details.map((d) => `- ${d.name} (${Math.round(d.weight * 100)}%): ${Math.round(d.score * 100)}/100 - ${d.reason}`).join("\n");
|
|
57963
|
+
const user = [
|
|
57964
|
+
`Project root: ${path10__namespace.default.basename(root)}`,
|
|
57965
|
+
`Criteria file: ${path10__namespace.default.relative(root, criteriaPath)}`,
|
|
57966
|
+
`Heuristic total: ${Math.round(result.totalScore * 100)}/100`,
|
|
57967
|
+
`Breakdown:
|
|
57968
|
+
${breakdown}`,
|
|
57969
|
+
options["idea"] || inferred.idea ? `Idea:
|
|
57970
|
+
${options["idea"] || inferred.idea}` : void 0,
|
|
57971
|
+
options["code"] || inferred.code ? `Code snippet:
|
|
57972
|
+
${options["code"] || inferred.code}` : void 0,
|
|
57973
|
+
files.length ? `File contents:
|
|
57974
|
+
${files.map((f3) => {
|
|
57975
|
+
const fObj = result?.files?.find?.((x2) => x2.path === f3);
|
|
57976
|
+
return fObj ? `### ${fObj.path}
|
|
57977
|
+
${fObj.content}` : `### ${f3}`;
|
|
57978
|
+
}).join("\n\n")}` : void 0
|
|
57979
|
+
].filter(Boolean).join("\n\n");
|
|
57980
|
+
const llmSpinner = new ProcessAnimation();
|
|
57981
|
+
llmSpinner.start();
|
|
57982
|
+
try {
|
|
57983
|
+
const enriched = [
|
|
57984
|
+
system,
|
|
57985
|
+
"\n---\n",
|
|
57986
|
+
user
|
|
57987
|
+
].join("\n");
|
|
57988
|
+
const response = await callAPI("/v1/ai-proxy", {
|
|
57989
|
+
method: "POST",
|
|
57990
|
+
body: {
|
|
57991
|
+
prompt: enriched,
|
|
57992
|
+
taskType: "evaluation"
|
|
57993
|
+
}
|
|
57994
|
+
});
|
|
57995
|
+
const routedModel = response?.data?.routedModel;
|
|
57996
|
+
const content = (response?.data?.content || response?.output || "").trim();
|
|
57997
|
+
if (content) {
|
|
57998
|
+
return this.success(content, {
|
|
57999
|
+
type: "evaluation-assess",
|
|
58000
|
+
total: result.totalScore,
|
|
58001
|
+
details: result.details,
|
|
58002
|
+
routedModel
|
|
58003
|
+
});
|
|
58004
|
+
}
|
|
58005
|
+
} catch (e2) {
|
|
58006
|
+
} finally {
|
|
58007
|
+
try {
|
|
58008
|
+
llmSpinner.stop();
|
|
58009
|
+
} catch {
|
|
58010
|
+
}
|
|
58011
|
+
}
|
|
58012
|
+
const lines = [];
|
|
58013
|
+
lines.push("Evaluation Summary (local fallback)");
|
|
58014
|
+
lines.push(`Weighted Score: ${Math.round(result.totalScore * 100)}/100`);
|
|
58015
|
+
lines.push("\nBreakdown:");
|
|
58016
|
+
for (const d of result.details) {
|
|
58017
|
+
lines.push(`- ${d.name} (${Math.round(d.weight * 100)}%): ${Math.round(d.score * 100)}/100 - ${d.reason}`);
|
|
58018
|
+
}
|
|
58019
|
+
return this.success(lines.join("\n"), {
|
|
58020
|
+
type: "evaluation-assess",
|
|
58021
|
+
total: result.totalScore,
|
|
58022
|
+
details: result.details
|
|
58023
|
+
});
|
|
58024
|
+
}
|
|
58025
|
+
/**
|
|
58026
|
+
* Run A/B evaluation test
|
|
58027
|
+
*/
|
|
58028
|
+
async runEvaluation(options, context2) {
|
|
58029
|
+
const config2 = this.parseEvaluationConfig(options);
|
|
58030
|
+
const validation = await this.validateConfig(config2);
|
|
58031
|
+
if (!validation.success) {
|
|
58032
|
+
return this.error(
|
|
58033
|
+
validation.error || "Invalid configuration",
|
|
58034
|
+
"CONFIG_ERROR"
|
|
58035
|
+
);
|
|
58036
|
+
}
|
|
58037
|
+
logger.info("Starting A/B evaluation test", {
|
|
58038
|
+
config: config2,
|
|
58039
|
+
user: context2.user?.id
|
|
58040
|
+
});
|
|
58041
|
+
const testResult = await this.executeEvaluation(config2);
|
|
58042
|
+
const formattedOutput = this.formatEvaluationStart(testResult);
|
|
58043
|
+
return this.success(formattedOutput, {
|
|
58044
|
+
testId: testResult.testId,
|
|
58045
|
+
status: testResult.status,
|
|
58046
|
+
type: "evaluation-started"
|
|
58047
|
+
});
|
|
58048
|
+
}
|
|
58049
|
+
/**
|
|
58050
|
+
* Get evaluation system status
|
|
58051
|
+
*/
|
|
58052
|
+
async getEvaluationStatus(_options) {
|
|
58053
|
+
const status = await this.fetchEvaluationStatus();
|
|
58054
|
+
const formattedOutput = this.formatEvaluationStatus(status);
|
|
58055
|
+
return this.success(formattedOutput, {
|
|
58056
|
+
activeTests: status.activeTests.length,
|
|
58057
|
+
completedTests: status.completedTests.length,
|
|
58058
|
+
systemHealth: status.systemHealth,
|
|
58059
|
+
type: "evaluation-status"
|
|
58060
|
+
});
|
|
58061
|
+
}
|
|
58062
|
+
/**
|
|
58063
|
+
* Get evaluation results
|
|
58064
|
+
*/
|
|
58065
|
+
async getEvaluationResults(options) {
|
|
58066
|
+
const format = options["format"] || "table";
|
|
58067
|
+
const results = await this.fetchLatestResults();
|
|
58068
|
+
const formattedOutput = this.formatEvaluationResults(results, format);
|
|
58069
|
+
return this.success(formattedOutput, {
|
|
58070
|
+
resultCount: results.length,
|
|
58071
|
+
format,
|
|
58072
|
+
type: "evaluation-results"
|
|
58073
|
+
});
|
|
58074
|
+
}
|
|
58075
|
+
/**
|
|
58076
|
+
* Stop running evaluation
|
|
58077
|
+
*/
|
|
58078
|
+
async stopEvaluation(options) {
|
|
58079
|
+
const testId = options["test-id"];
|
|
58080
|
+
if (!testId) {
|
|
58081
|
+
return this.error(
|
|
58082
|
+
"Test ID is required to stop evaluation",
|
|
58083
|
+
"MISSING_TEST_ID",
|
|
58084
|
+
"Use --test-id <id> to specify which test to stop"
|
|
58085
|
+
);
|
|
58086
|
+
}
|
|
58087
|
+
await this.terminateEvaluation(testId);
|
|
58088
|
+
return this.success(`Evaluation test ${testId} stopped successfully`, {
|
|
58089
|
+
testId,
|
|
58090
|
+
type: "evaluation-stopped"
|
|
58091
|
+
});
|
|
58092
|
+
}
|
|
58093
|
+
/**
|
|
58094
|
+
* Parse evaluation configuration
|
|
58095
|
+
*/
|
|
58096
|
+
parseEvaluationConfig(options) {
|
|
58097
|
+
return {
|
|
58098
|
+
datasetPath: options["dataset"] || options["config"],
|
|
58099
|
+
testName: options["name"] || `eval_${Date.now()}`,
|
|
58100
|
+
maxQueries: parseInt(options["max-queries"] || "100", 10),
|
|
58101
|
+
metrics: (options["metrics"] || "nDCG,MRR,precision").split(","),
|
|
58102
|
+
outputFormat: options["format"] || "table",
|
|
58103
|
+
compareBaseline: options["compare-baseline"] || false
|
|
58104
|
+
};
|
|
58105
|
+
}
|
|
58106
|
+
/**
|
|
58107
|
+
* Validate evaluation configuration
|
|
58108
|
+
*/
|
|
58109
|
+
async validateConfig(config2) {
|
|
58110
|
+
if (config2.datasetPath && !config2.datasetPath.endsWith(".json")) {
|
|
58111
|
+
return { success: false, error: "Dataset must be a JSON file" };
|
|
58112
|
+
}
|
|
58113
|
+
if (config2.maxQueries && (config2.maxQueries < 1 || config2.maxQueries > 1e4)) {
|
|
58114
|
+
return {
|
|
58115
|
+
success: false,
|
|
58116
|
+
error: "Max queries must be between 1 and 10000"
|
|
58117
|
+
};
|
|
58118
|
+
}
|
|
58119
|
+
const validMetrics = ["nDCG", "MRR", "precision", "recall", "latency"];
|
|
58120
|
+
if (config2.metrics && !config2.metrics.every((m2) => validMetrics.includes(m2))) {
|
|
58121
|
+
return {
|
|
58122
|
+
success: false,
|
|
58123
|
+
error: `Invalid metrics. Valid options: ${validMetrics.join(", ")}`
|
|
58124
|
+
};
|
|
58125
|
+
}
|
|
58126
|
+
const validFormats = ["table", "json", "csv"];
|
|
58127
|
+
if (config2.outputFormat && !validFormats.includes(config2.outputFormat)) {
|
|
58128
|
+
return {
|
|
58129
|
+
success: false,
|
|
58130
|
+
error: `Invalid format. Valid options: ${validFormats.join(", ")}`
|
|
58131
|
+
};
|
|
58132
|
+
}
|
|
58133
|
+
return { success: true };
|
|
58134
|
+
}
|
|
58135
|
+
/**
|
|
58136
|
+
* Execute evaluation (mock implementation)
|
|
58137
|
+
*/
|
|
58138
|
+
async executeEvaluation(config2) {
|
|
58139
|
+
await new Promise((resolve19) => setTimeout(resolve19, 500));
|
|
58140
|
+
return {
|
|
58141
|
+
testId: `eval_${Math.random().toString(36).substr(2, 9)}`,
|
|
58142
|
+
testName: config2.testName || "Unnamed Test",
|
|
58143
|
+
timestamp: Date.now(),
|
|
58144
|
+
status: "running",
|
|
58145
|
+
metrics: {
|
|
58146
|
+
nDCG_at_1: 0,
|
|
58147
|
+
nDCG_at_5: 0,
|
|
58148
|
+
nDCG_at_10: 0,
|
|
58149
|
+
MRR: 0,
|
|
58150
|
+
precision_at_1: 0,
|
|
58151
|
+
precision_at_5: 0,
|
|
58152
|
+
recall_at_10: 0,
|
|
58153
|
+
latency_p50: 0,
|
|
58154
|
+
latency_p95: 0
|
|
58155
|
+
},
|
|
58156
|
+
queryCount: 0,
|
|
58157
|
+
duration: 0
|
|
58158
|
+
};
|
|
58159
|
+
}
|
|
58160
|
+
/**
|
|
58161
|
+
* Fetch evaluation system status
|
|
58162
|
+
*/
|
|
58163
|
+
async fetchEvaluationStatus() {
|
|
58164
|
+
return {
|
|
58165
|
+
activeTests: [
|
|
58166
|
+
{
|
|
58167
|
+
testId: "eval_abc123",
|
|
58168
|
+
testName: "SharePoint RAG Evaluation",
|
|
58169
|
+
timestamp: Date.now() - 3e5,
|
|
58170
|
+
// 5 minutes ago
|
|
58171
|
+
status: "running",
|
|
58172
|
+
metrics: {
|
|
58173
|
+
nDCG_at_1: 0.75,
|
|
58174
|
+
nDCG_at_5: 0.68,
|
|
58175
|
+
nDCG_at_10: 0.64,
|
|
58176
|
+
MRR: 0.72,
|
|
58177
|
+
precision_at_1: 0.75,
|
|
58178
|
+
precision_at_5: 0.68,
|
|
58179
|
+
recall_at_10: 0.85,
|
|
58180
|
+
latency_p50: 245.5,
|
|
58181
|
+
latency_p95: 520.2
|
|
58182
|
+
},
|
|
58183
|
+
queryCount: 45,
|
|
58184
|
+
duration: 300
|
|
58185
|
+
}
|
|
58186
|
+
],
|
|
58187
|
+
completedTests: [
|
|
58188
|
+
{
|
|
58189
|
+
testId: "eval_xyz789",
|
|
58190
|
+
testName: "Baseline Comparison Test",
|
|
58191
|
+
timestamp: Date.now() - 36e5,
|
|
58192
|
+
// 1 hour ago
|
|
58193
|
+
status: "completed",
|
|
58194
|
+
metrics: {
|
|
58195
|
+
nDCG_at_1: 0.82,
|
|
58196
|
+
nDCG_at_5: 0.74,
|
|
58197
|
+
nDCG_at_10: 0.69,
|
|
58198
|
+
MRR: 0.79,
|
|
58199
|
+
precision_at_1: 0.82,
|
|
58200
|
+
precision_at_5: 0.74,
|
|
58201
|
+
recall_at_10: 0.89,
|
|
58202
|
+
latency_p50: 189.3,
|
|
58203
|
+
latency_p95: 445.8
|
|
58204
|
+
},
|
|
58205
|
+
queryCount: 100,
|
|
58206
|
+
duration: 1247,
|
|
58207
|
+
baselineComparison: {
|
|
58208
|
+
improvement: {
|
|
58209
|
+
nDCG_at_1: 0.08,
|
|
58210
|
+
nDCG_at_5: 0.12,
|
|
58211
|
+
MRR: 0.15,
|
|
58212
|
+
latency_p50: -0.22
|
|
58213
|
+
},
|
|
58214
|
+
significant: {
|
|
58215
|
+
nDCG_at_1: true,
|
|
58216
|
+
nDCG_at_5: true,
|
|
58217
|
+
MRR: true,
|
|
58218
|
+
latency_p50: true
|
|
58219
|
+
}
|
|
58220
|
+
}
|
|
58221
|
+
}
|
|
58222
|
+
],
|
|
58223
|
+
systemHealth: {
|
|
58224
|
+
evaluationService: "healthy",
|
|
58225
|
+
datasetAccess: "available",
|
|
58226
|
+
metricsCollection: "active"
|
|
58227
|
+
}
|
|
58228
|
+
};
|
|
58229
|
+
}
|
|
58230
|
+
/**
|
|
58231
|
+
* Fetch latest evaluation results
|
|
58232
|
+
*/
|
|
58233
|
+
async fetchLatestResults() {
|
|
58234
|
+
const status = await this.fetchEvaluationStatus();
|
|
58235
|
+
return [...status.activeTests, ...status.completedTests].slice(0, 5);
|
|
58236
|
+
}
|
|
58237
|
+
/**
|
|
58238
|
+
* Terminate evaluation
|
|
58239
|
+
*/
|
|
58240
|
+
async terminateEvaluation(_testId) {
|
|
58241
|
+
await new Promise((resolve19) => setTimeout(resolve19, 200));
|
|
58242
|
+
return true;
|
|
58243
|
+
}
|
|
58244
|
+
/**
|
|
58245
|
+
* Format evaluation start message
|
|
58246
|
+
*/
|
|
58247
|
+
formatEvaluationStart(_result) {
|
|
58248
|
+
const lines = [];
|
|
58249
|
+
lines.push("");
|
|
58250
|
+
lines.push("\u{1F9EA} A/B EVALUATION STARTED");
|
|
58251
|
+
lines.push("\u2550".repeat(40));
|
|
58252
|
+
lines.push("");
|
|
58253
|
+
lines.push(`Test ID: ${_result.testId}`);
|
|
58254
|
+
lines.push(`Test Name: ${_result.testName}`);
|
|
58255
|
+
lines.push(`Status: ${_result.status.toUpperCase()}`);
|
|
58256
|
+
lines.push(`Started: ${new Date(_result.timestamp).toLocaleString()}`);
|
|
58257
|
+
lines.push("");
|
|
58258
|
+
lines.push("\u{1F4CA} **Metrics to Collect:**");
|
|
58259
|
+
lines.push(" \u2022 nDCG@1, nDCG@5, nDCG@10");
|
|
58260
|
+
lines.push(" \u2022 Mean Reciprocal Rank (MRR)");
|
|
58261
|
+
lines.push(" \u2022 Precision@1, Precision@5");
|
|
58262
|
+
lines.push(" \u2022 Recall@10");
|
|
58263
|
+
lines.push(" \u2022 Latency (p50, p95)");
|
|
58264
|
+
lines.push("");
|
|
58265
|
+
lines.push("\u{1F4A1} **Monitor Progress:**");
|
|
58266
|
+
lines.push(" Use `/evaluate status` to check progress");
|
|
58267
|
+
lines.push(" Use `/evaluate results` to see latest metrics");
|
|
58268
|
+
return lines.join("\n");
|
|
58269
|
+
}
|
|
58270
|
+
/**
|
|
58271
|
+
* Format evaluation status
|
|
58272
|
+
*/
|
|
58273
|
+
formatEvaluationStatus(status) {
|
|
58274
|
+
const lines = [];
|
|
58275
|
+
lines.push("");
|
|
58276
|
+
lines.push("\u{1F4CA} EVALUATION SYSTEM STATUS");
|
|
58277
|
+
lines.push("\u2550".repeat(40));
|
|
58278
|
+
lines.push("");
|
|
58279
|
+
lines.push("\u{1F527} **System Health:**");
|
|
58280
|
+
lines.push(
|
|
58281
|
+
` Evaluation Service: ${this.getHealthIcon(status.systemHealth.evaluationService)} ${status.systemHealth.evaluationService}`
|
|
58282
|
+
);
|
|
58283
|
+
lines.push(
|
|
58284
|
+
` Dataset Access: ${this.getHealthIcon(status.systemHealth.datasetAccess)} ${status.systemHealth.datasetAccess}`
|
|
58285
|
+
);
|
|
58286
|
+
lines.push(
|
|
58287
|
+
` Metrics Collection: ${this.getHealthIcon(status.systemHealth.metricsCollection)} ${status.systemHealth.metricsCollection}`
|
|
58288
|
+
);
|
|
58289
|
+
lines.push("");
|
|
58290
|
+
if (status.activeTests.length > 0) {
|
|
58291
|
+
lines.push(`\u26A1 **Active Tests (${status.activeTests.length}):**`);
|
|
58292
|
+
for (const test of status.activeTests) {
|
|
58293
|
+
lines.push(` \u2022 ${test.testName} (${test.testId})`);
|
|
58294
|
+
lines.push(
|
|
58295
|
+
` Progress: ${test.queryCount} queries, ${Math.round(test.duration / 60)}m elapsed`
|
|
58296
|
+
);
|
|
58297
|
+
lines.push(` Current nDCG@5: ${test.metrics.nDCG_at_5.toFixed(3)}`);
|
|
58298
|
+
}
|
|
58299
|
+
lines.push("");
|
|
58300
|
+
}
|
|
58301
|
+
if (status.completedTests.length > 0) {
|
|
58302
|
+
lines.push(
|
|
58303
|
+
`\u2705 **Recent Completed Tests (${status.completedTests.length}):**`
|
|
58304
|
+
);
|
|
58305
|
+
for (const test of status.completedTests.slice(0, 3)) {
|
|
58306
|
+
const timeAgo = Math.round((Date.now() - test.timestamp) / 6e4);
|
|
58307
|
+
lines.push(` \u2022 ${test.testName} - ${timeAgo}m ago`);
|
|
58308
|
+
lines.push(
|
|
58309
|
+
` nDCG@5: ${test.metrics.nDCG_at_5.toFixed(3)}, MRR: ${test.metrics.MRR.toFixed(3)}`
|
|
58310
|
+
);
|
|
58311
|
+
if (test.baselineComparison) {
|
|
58312
|
+
const improvement = (test.baselineComparison.improvement.nDCG_at_5 * 100).toFixed(1);
|
|
58313
|
+
lines.push(` Improvement: +${improvement}% vs baseline`);
|
|
58314
|
+
}
|
|
58315
|
+
}
|
|
58316
|
+
}
|
|
58317
|
+
return lines.join("\n");
|
|
58318
|
+
}
|
|
58319
|
+
/**
|
|
58320
|
+
* Format evaluation results
|
|
58321
|
+
*/
|
|
58322
|
+
formatEvaluationResults(results, format) {
|
|
58323
|
+
if (format === "json") {
|
|
58324
|
+
return JSON.stringify(results, null, 2);
|
|
58325
|
+
}
|
|
58326
|
+
if (format === "csv") {
|
|
58327
|
+
const headers = [
|
|
58328
|
+
"Test ID",
|
|
58329
|
+
"Name",
|
|
58330
|
+
"Status",
|
|
58331
|
+
"nDCG@5",
|
|
58332
|
+
"MRR",
|
|
58333
|
+
"P@1",
|
|
58334
|
+
"Latency P50"
|
|
58335
|
+
];
|
|
58336
|
+
const rows = results.map((r2) => [
|
|
58337
|
+
r2.testId,
|
|
58338
|
+
r2.testName,
|
|
58339
|
+
r2.status,
|
|
58340
|
+
r2.metrics.nDCG_at_5.toFixed(3),
|
|
58341
|
+
r2.metrics.MRR.toFixed(3),
|
|
58342
|
+
r2.metrics.precision_at_1.toFixed(3),
|
|
58343
|
+
r2.metrics.latency_p50.toFixed(1)
|
|
58344
|
+
]);
|
|
58345
|
+
return [headers.join(","), ...rows.map((row) => row.join(","))].join(
|
|
58346
|
+
"\n"
|
|
58347
|
+
);
|
|
58348
|
+
}
|
|
58349
|
+
const lines = [];
|
|
58350
|
+
lines.push("");
|
|
58351
|
+
lines.push("\u{1F4C8} EVALUATION RESULTS");
|
|
58352
|
+
lines.push("\u2550".repeat(60));
|
|
58353
|
+
lines.push("");
|
|
58354
|
+
for (const _result of results) {
|
|
58355
|
+
lines.push(`**${_result.testName}** (${_result.testId})`);
|
|
58356
|
+
lines.push(
|
|
58357
|
+
`Status: ${_result.status.toUpperCase()} | Queries: ${_result.queryCount} | Duration: ${Math.round(_result.duration / 60)}m`
|
|
58358
|
+
);
|
|
58359
|
+
lines.push("");
|
|
58360
|
+
lines.push("\u{1F4CA} **Quality Metrics:**");
|
|
58361
|
+
lines.push(
|
|
58362
|
+
` nDCG@1: ${_result.metrics.nDCG_at_1.toFixed(3)} nDCG@5: ${_result.metrics.nDCG_at_5.toFixed(3)} nDCG@10: ${_result.metrics.nDCG_at_10.toFixed(3)}`
|
|
58363
|
+
);
|
|
58364
|
+
lines.push(
|
|
58365
|
+
` MRR: ${_result.metrics.MRR.toFixed(3)} P@1: ${_result.metrics.precision_at_1.toFixed(3)} P@5: ${_result.metrics.precision_at_5.toFixed(3)}`
|
|
58366
|
+
);
|
|
58367
|
+
lines.push(` Recall@10: ${_result.metrics.recall_at_10.toFixed(3)}`);
|
|
58368
|
+
lines.push("");
|
|
58369
|
+
lines.push("\u26A1 **Performance:**");
|
|
58370
|
+
lines.push(
|
|
58371
|
+
` Latency P50: ${_result.metrics.latency_p50.toFixed(1)}ms P95: ${_result.metrics.latency_p95.toFixed(1)}ms`
|
|
58372
|
+
);
|
|
58373
|
+
if (_result.baselineComparison) {
|
|
58374
|
+
lines.push("");
|
|
58375
|
+
lines.push("\u{1F504} **vs Baseline:**");
|
|
58376
|
+
const improvement = _result.baselineComparison.improvement;
|
|
58377
|
+
const significant = _result.baselineComparison.significant;
|
|
58378
|
+
lines.push(
|
|
58379
|
+
` nDCG@5: ${improvement.nDCG_at_5 >= 0 ? "+" : ""}${(improvement.nDCG_at_5 * 100).toFixed(1)}% ${significant.nDCG_at_5 ? "\u2713" : "\u2717"}`
|
|
58380
|
+
);
|
|
58381
|
+
lines.push(
|
|
58382
|
+
` MRR: ${improvement.MRR >= 0 ? "+" : ""}${(improvement.MRR * 100).toFixed(1)}% ${significant.MRR ? "\u2713" : "\u2717"}`
|
|
58383
|
+
);
|
|
58384
|
+
lines.push(
|
|
58385
|
+
` Latency: ${improvement.latency_p50 >= 0 ? "+" : ""}${(improvement.latency_p50 * 100).toFixed(1)}% ${significant.latency_p50 ? "\u2713" : "\u2717"}`
|
|
58386
|
+
);
|
|
58387
|
+
}
|
|
58388
|
+
lines.push("");
|
|
58389
|
+
lines.push("\u2500".repeat(40));
|
|
58390
|
+
lines.push("");
|
|
58391
|
+
}
|
|
58392
|
+
return lines.join("\n");
|
|
58393
|
+
}
|
|
58394
|
+
/**
|
|
58395
|
+
* Get health status icon
|
|
58396
|
+
*/
|
|
58397
|
+
getHealthIcon(status) {
|
|
58398
|
+
switch (status) {
|
|
58399
|
+
case "healthy":
|
|
58400
|
+
case "available":
|
|
58401
|
+
case "active":
|
|
58402
|
+
return "\u{1F7E2}";
|
|
58403
|
+
case "degraded":
|
|
58404
|
+
case "limited":
|
|
58405
|
+
return "\u{1F7E1}";
|
|
58406
|
+
case "down":
|
|
58407
|
+
case "unavailable":
|
|
58408
|
+
case "inactive":
|
|
58409
|
+
return "\u{1F534}";
|
|
58410
|
+
default:
|
|
58411
|
+
return "\u26AA";
|
|
58412
|
+
}
|
|
58413
|
+
}
|
|
58414
|
+
/**
|
|
58415
|
+
* Command validation
|
|
58416
|
+
*/
|
|
58417
|
+
async validate(args2) {
|
|
58418
|
+
const { parsed, options } = args2;
|
|
58419
|
+
const positional = parsed["positional"] || [];
|
|
58420
|
+
const subcommand = positional[0];
|
|
58421
|
+
if (subcommand === "run") {
|
|
58422
|
+
if (options["max-queries"] && isNaN(parseInt(options["max-queries"], 10))) {
|
|
58423
|
+
return {
|
|
58424
|
+
success: false,
|
|
58425
|
+
error: "max-queries must be a number"
|
|
58426
|
+
};
|
|
58427
|
+
}
|
|
58428
|
+
}
|
|
58429
|
+
if (subcommand === "stop" && !options["test-id"]) {
|
|
58430
|
+
return {
|
|
58431
|
+
success: false,
|
|
58432
|
+
error: "stop command requires --test-id parameter"
|
|
58433
|
+
};
|
|
58434
|
+
}
|
|
58435
|
+
return { success: true };
|
|
58436
|
+
}
|
|
58437
|
+
};
|
|
58438
|
+
meta26 = {
|
|
58439
|
+
name: "evaluate",
|
|
58440
|
+
category: "evaluation",
|
|
58441
|
+
description: "A/B testing and quality evaluation framework",
|
|
58442
|
+
aliases: ["eval", "test", "ab"],
|
|
58443
|
+
usage: "/evaluate [run|status|results|stop] [options]",
|
|
58444
|
+
examples: [
|
|
58445
|
+
"/evaluate run --dataset data.json",
|
|
58446
|
+
"/evaluate status",
|
|
58447
|
+
"/evaluate results --format table",
|
|
58448
|
+
"/evaluate stop --test-id eval_abc123"
|
|
58449
|
+
],
|
|
58450
|
+
deps: []
|
|
58451
|
+
};
|
|
58452
|
+
evaluate_command_default = EvaluateCommand;
|
|
58453
|
+
}
|
|
58454
|
+
});
|
|
57389
58455
|
|
|
57390
58456
|
// src/slash-commands/index.ts
|
|
57391
58457
|
var slash_commands_exports = {};
|
|
@@ -57875,15 +58941,23 @@ async function registerBuiltInCommands() {
|
|
|
57875
58941
|
initialize: async () => {
|
|
57876
58942
|
}
|
|
57877
58943
|
});
|
|
57878
|
-
|
|
57879
|
-
|
|
57880
|
-
|
|
57881
|
-
|
|
57882
|
-
|
|
57883
|
-
|
|
57884
|
-
|
|
57885
|
-
|
|
57886
|
-
|
|
58944
|
+
try {
|
|
58945
|
+
const EvaluateModule = await Promise.resolve().then(() => (init_evaluate_command(), evaluate_command_exports));
|
|
58946
|
+
const EvaluateClass = EvaluateModule.EvaluateCommand || EvaluateModule.default;
|
|
58947
|
+
const evaluate = new EvaluateClass();
|
|
58948
|
+
if (evaluate.initialize) await evaluate.initialize();
|
|
58949
|
+
commandRegistry.register(evaluate);
|
|
58950
|
+
} catch {
|
|
58951
|
+
commandRegistry.register({
|
|
58952
|
+
name: "evaluate",
|
|
58953
|
+
category: "evaluation",
|
|
58954
|
+
description: "Evaluation system",
|
|
58955
|
+
aliases: [],
|
|
58956
|
+
execute: async () => shield2({ message: "\u{1F512} Not available in this build" }),
|
|
58957
|
+
initialize: async () => {
|
|
58958
|
+
}
|
|
58959
|
+
});
|
|
58960
|
+
}
|
|
57887
58961
|
commandRegistry.register({
|
|
57888
58962
|
name: "multimodal",
|
|
57889
58963
|
category: "multimodal",
|
|
@@ -68382,8 +69456,8 @@ var init_ConfigService = __esm({
|
|
|
68382
69456
|
/**
|
|
68383
69457
|
* ネストされた設定値の取得
|
|
68384
69458
|
*/
|
|
68385
|
-
getNestedValue(
|
|
68386
|
-
const keys =
|
|
69459
|
+
getNestedValue(path64) {
|
|
69460
|
+
const keys = path64.split(".");
|
|
68387
69461
|
let value = this._config;
|
|
68388
69462
|
for (const key of keys) {
|
|
68389
69463
|
if (value && typeof value === "object" && key in value) {
|
|
@@ -68413,8 +69487,8 @@ var init_ConfigService = __esm({
|
|
|
68413
69487
|
/**
|
|
68414
69488
|
* ネストされた設定値の更新
|
|
68415
69489
|
*/
|
|
68416
|
-
async setNestedValue(
|
|
68417
|
-
const keys =
|
|
69490
|
+
async setNestedValue(path64, value) {
|
|
69491
|
+
const keys = path64.split(".");
|
|
68418
69492
|
const lastKey = keys.pop();
|
|
68419
69493
|
let target = this._config;
|
|
68420
69494
|
for (const key of keys) {
|
|
@@ -68427,7 +69501,7 @@ var init_ConfigService = __esm({
|
|
|
68427
69501
|
target[lastKey] = value;
|
|
68428
69502
|
this.validateConfig();
|
|
68429
69503
|
this.emitChange({
|
|
68430
|
-
path:
|
|
69504
|
+
path: path64,
|
|
68431
69505
|
oldValue,
|
|
68432
69506
|
newValue: value,
|
|
68433
69507
|
timestamp: /* @__PURE__ */ new Date()
|
|
@@ -68472,8 +69546,8 @@ var init_ConfigService = __esm({
|
|
|
68472
69546
|
setupAutoSave() {
|
|
68473
69547
|
process.on("exit", () => {
|
|
68474
69548
|
if (this._isDirty) {
|
|
68475
|
-
const
|
|
68476
|
-
|
|
69549
|
+
const fs51 = __require("fs");
|
|
69550
|
+
fs51.writeFileSync(
|
|
68477
69551
|
this._userConfigPath,
|
|
68478
69552
|
JSON.stringify(this._config, null, 2),
|
|
68479
69553
|
"utf-8"
|
|
@@ -68484,13 +69558,13 @@ var init_ConfigService = __esm({
|
|
|
68484
69558
|
/**
|
|
68485
69559
|
* 変更リスナーの登録
|
|
68486
69560
|
*/
|
|
68487
|
-
onChange(
|
|
68488
|
-
if (!this._listeners.has(
|
|
68489
|
-
this._listeners.set(
|
|
69561
|
+
onChange(path64, listener) {
|
|
69562
|
+
if (!this._listeners.has(path64)) {
|
|
69563
|
+
this._listeners.set(path64, []);
|
|
68490
69564
|
}
|
|
68491
|
-
this._listeners.get(
|
|
69565
|
+
this._listeners.get(path64).push(listener);
|
|
68492
69566
|
return () => {
|
|
68493
|
-
const listeners = this._listeners.get(
|
|
69567
|
+
const listeners = this._listeners.get(path64);
|
|
68494
69568
|
if (listeners) {
|
|
68495
69569
|
const index = listeners.indexOf(listener);
|
|
68496
69570
|
if (index !== -1) {
|
|
@@ -68979,7 +70053,7 @@ var init_ValidationService = __esm({
|
|
|
68979
70053
|
);
|
|
68980
70054
|
this._schemas.set(
|
|
68981
70055
|
"filePath",
|
|
68982
|
-
zod.z.string().min(1).max(this._config.maxFilePathLength).refine((
|
|
70056
|
+
zod.z.string().min(1).max(this._config.maxFilePathLength).refine((path64) => !this.containsPathTraversal(path64), {
|
|
68983
70057
|
message: "Path traversal detected"
|
|
68984
70058
|
})
|
|
68985
70059
|
);
|
|
@@ -69118,11 +70192,11 @@ var init_ValidationService = __esm({
|
|
|
69118
70192
|
/**
|
|
69119
70193
|
* ファイルパス検証
|
|
69120
70194
|
*/
|
|
69121
|
-
validateFilePath(
|
|
70195
|
+
validateFilePath(path64) {
|
|
69122
70196
|
try {
|
|
69123
70197
|
const schema = this._schemas.get("filePath");
|
|
69124
|
-
const result = schema.parse(
|
|
69125
|
-
if (this.isSystemPath(
|
|
70198
|
+
const result = schema.parse(path64);
|
|
70199
|
+
if (this.isSystemPath(path64)) {
|
|
69126
70200
|
return {
|
|
69127
70201
|
valid: false,
|
|
69128
70202
|
errors: [
|
|
@@ -69268,8 +70342,8 @@ var init_ValidationService = __esm({
|
|
|
69268
70342
|
/**
|
|
69269
70343
|
* パストラバーサルの検出
|
|
69270
70344
|
*/
|
|
69271
|
-
containsPathTraversal(
|
|
69272
|
-
return /\.\.[/\\]/.test(
|
|
70345
|
+
containsPathTraversal(path64) {
|
|
70346
|
+
return /\.\.[/\\]/.test(path64) || path64.includes("..\\") || path64.includes("../");
|
|
69273
70347
|
}
|
|
69274
70348
|
/**
|
|
69275
70349
|
* 危険なコマンドの判定
|
|
@@ -69296,7 +70370,7 @@ var init_ValidationService = __esm({
|
|
|
69296
70370
|
/**
|
|
69297
70371
|
* システムパスの判定
|
|
69298
70372
|
*/
|
|
69299
|
-
isSystemPath(
|
|
70373
|
+
isSystemPath(path64) {
|
|
69300
70374
|
const systemPaths = [
|
|
69301
70375
|
"/etc",
|
|
69302
70376
|
"/sys",
|
|
@@ -69310,7 +70384,7 @@ var init_ValidationService = __esm({
|
|
|
69310
70384
|
"/sbin"
|
|
69311
70385
|
];
|
|
69312
70386
|
return systemPaths.some(
|
|
69313
|
-
(sysPath) =>
|
|
70387
|
+
(sysPath) => path64.toLowerCase().startsWith(sysPath.toLowerCase())
|
|
69314
70388
|
);
|
|
69315
70389
|
}
|
|
69316
70390
|
/**
|
|
@@ -73837,10 +74911,10 @@ Run /doctor --fix to automatically fix ${fixableCount} issue(s)`
|
|
|
73837
74911
|
const finalize = async (text, data) => {
|
|
73838
74912
|
if (outputPath) {
|
|
73839
74913
|
try {
|
|
73840
|
-
const
|
|
73841
|
-
const
|
|
73842
|
-
const abs =
|
|
73843
|
-
await
|
|
74914
|
+
const fs51 = await import('fs/promises');
|
|
74915
|
+
const path64 = await import('path');
|
|
74916
|
+
const abs = path64.resolve(outputPath);
|
|
74917
|
+
await fs51.writeFile(abs, text, "utf-8");
|
|
73844
74918
|
const msg = `Saved doctor report to ${abs}`;
|
|
73845
74919
|
return { ok: true, message: msg, data: { path: abs, bytes: Buffer.byteLength(text, "utf-8") } };
|
|
73846
74920
|
} catch (e2) {
|
|
@@ -73930,10 +75004,10 @@ Run /doctor --fix to automatically fix ${fixableCount} issue(s)`
|
|
|
73930
75004
|
const finalize = async (text, data) => {
|
|
73931
75005
|
if (outputPath) {
|
|
73932
75006
|
try {
|
|
73933
|
-
const
|
|
73934
|
-
const
|
|
73935
|
-
const abs =
|
|
73936
|
-
await
|
|
75007
|
+
const fs51 = await import('fs/promises');
|
|
75008
|
+
const path64 = await import('path');
|
|
75009
|
+
const abs = path64.resolve(outputPath);
|
|
75010
|
+
await fs51.writeFile(abs, text, "utf-8");
|
|
73937
75011
|
const msg = `Saved metrics to ${abs}`;
|
|
73938
75012
|
return { ok: true, message: msg, data: { path: abs, bytes: Buffer.byteLength(text, "utf-8") } };
|
|
73939
75013
|
} catch (e2) {
|
|
@@ -74322,15 +75396,15 @@ var init_SessionOrchestrator = __esm({
|
|
|
74322
75396
|
/**
|
|
74323
75397
|
* 設定の取得
|
|
74324
75398
|
*/
|
|
74325
|
-
getConfig(
|
|
74326
|
-
return this._configService?.getNestedValue(
|
|
75399
|
+
getConfig(path64) {
|
|
75400
|
+
return this._configService?.getNestedValue(path64);
|
|
74327
75401
|
}
|
|
74328
75402
|
/**
|
|
74329
75403
|
* 設定の更新
|
|
74330
75404
|
*/
|
|
74331
|
-
async setConfig(
|
|
75405
|
+
async setConfig(path64, value) {
|
|
74332
75406
|
if (this._configService) {
|
|
74333
|
-
await this._configService.setNestedValue(
|
|
75407
|
+
await this._configService.setNestedValue(path64, value);
|
|
74334
75408
|
}
|
|
74335
75409
|
}
|
|
74336
75410
|
/**
|
|
@@ -74448,11 +75522,11 @@ var init_interactive_session2 = __esm({
|
|
|
74448
75522
|
getStats() {
|
|
74449
75523
|
return this.orchestrator.getSessionStats();
|
|
74450
75524
|
}
|
|
74451
|
-
getConfig(
|
|
74452
|
-
return this.orchestrator.getConfig(
|
|
75525
|
+
getConfig(path64) {
|
|
75526
|
+
return this.orchestrator.getConfig(path64);
|
|
74453
75527
|
}
|
|
74454
|
-
async setConfig(
|
|
74455
|
-
await this.orchestrator.setConfig(
|
|
75528
|
+
async setConfig(path64, value) {
|
|
75529
|
+
await this.orchestrator.setConfig(path64, value);
|
|
74456
75530
|
}
|
|
74457
75531
|
};
|
|
74458
75532
|
}
|