@bonginkan/maria 4.3.13 → 4.3.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/READY.manifest.json +1 -1
- package/dist/bin/maria.cjs +1267 -520
- package/dist/bin/maria.cjs.map +1 -1
- package/dist/cli.cjs +1254 -507
- package/dist/cli.cjs.map +1 -1
- package/package.json +2 -2
- package/src/slash-commands/READY.manifest.json +1 -1
package/dist/bin/maria.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var fs24 = require('fs');
|
|
5
|
-
var
|
|
5
|
+
var path58 = require('path');
|
|
6
6
|
var chalk37 = require('chalk');
|
|
7
7
|
var os16 = require('os');
|
|
8
8
|
var Stream = require('stream');
|
|
@@ -55,7 +55,7 @@ function _interopNamespace(e) {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
var fs24__namespace = /*#__PURE__*/_interopNamespace(fs24);
|
|
58
|
-
var
|
|
58
|
+
var path58__namespace = /*#__PURE__*/_interopNamespace(path58);
|
|
59
59
|
var chalk37__default = /*#__PURE__*/_interopDefault(chalk37);
|
|
60
60
|
var os16__namespace = /*#__PURE__*/_interopNamespace(os16);
|
|
61
61
|
var Stream__default = /*#__PURE__*/_interopDefault(Stream);
|
|
@@ -207,25 +207,25 @@ function getPackageJson() {
|
|
|
207
207
|
try {
|
|
208
208
|
const possiblePaths = [
|
|
209
209
|
// When running from built dist/
|
|
210
|
-
|
|
210
|
+
path58.join(__dirname, "../../package.json"),
|
|
211
211
|
// When running from source
|
|
212
|
-
|
|
212
|
+
path58.join(__dirname, "../../../package.json"),
|
|
213
213
|
// Current working directory
|
|
214
|
-
|
|
214
|
+
path58.join(process.cwd(), "package.json"),
|
|
215
215
|
// One level up from current working directory
|
|
216
|
-
|
|
216
|
+
path58.join(process.cwd(), "../package.json"),
|
|
217
217
|
// For globally installed packages
|
|
218
|
-
|
|
219
|
-
|
|
218
|
+
path58.join(__dirname, "../../../../package.json"),
|
|
219
|
+
path58.join(__dirname, "../../../../../package.json"),
|
|
220
220
|
// npm global install locations
|
|
221
221
|
"/usr/local/lib/node_modules/@bonginkan/maria/package.json",
|
|
222
222
|
"/usr/lib/node_modules/@bonginkan/maria/package.json",
|
|
223
223
|
// User home npm global
|
|
224
|
-
|
|
224
|
+
path58.join(
|
|
225
225
|
process.env.HOME || "",
|
|
226
226
|
".npm-global/lib/node_modules/@bonginkan/maria/package.json"
|
|
227
227
|
),
|
|
228
|
-
|
|
228
|
+
path58.join(
|
|
229
229
|
process.env.HOME || "",
|
|
230
230
|
".nvm/versions/node",
|
|
231
231
|
process.version,
|
|
@@ -233,13 +233,13 @@ function getPackageJson() {
|
|
|
233
233
|
)
|
|
234
234
|
];
|
|
235
235
|
let packageJsonPath = null;
|
|
236
|
-
for (const
|
|
237
|
-
if (fs24.existsSync(
|
|
236
|
+
for (const path59 of possiblePaths) {
|
|
237
|
+
if (fs24.existsSync(path59)) {
|
|
238
238
|
try {
|
|
239
|
-
const content = fs24.readFileSync(
|
|
239
|
+
const content = fs24.readFileSync(path59, "utf-8");
|
|
240
240
|
const parsed = JSON.parse(content);
|
|
241
241
|
if (parsed.name === "@bonginkan/maria") {
|
|
242
|
-
packageJsonPath =
|
|
242
|
+
packageJsonPath = path59;
|
|
243
243
|
break;
|
|
244
244
|
}
|
|
245
245
|
} catch {
|
|
@@ -523,22 +523,22 @@ function dataUriToBuffer(uri) {
|
|
|
523
523
|
if (firstComma === -1 || firstComma <= 4) {
|
|
524
524
|
throw new TypeError("malformed data: URI");
|
|
525
525
|
}
|
|
526
|
-
const
|
|
526
|
+
const meta25 = uri.substring(5, firstComma).split(";");
|
|
527
527
|
let charset = "";
|
|
528
528
|
let base64 = false;
|
|
529
|
-
const type2 =
|
|
529
|
+
const type2 = meta25[0] || "text/plain";
|
|
530
530
|
let typeFull = type2;
|
|
531
|
-
for (let i2 = 1; i2 <
|
|
532
|
-
if (
|
|
531
|
+
for (let i2 = 1; i2 < meta25.length; i2++) {
|
|
532
|
+
if (meta25[i2] === "base64") {
|
|
533
533
|
base64 = true;
|
|
534
|
-
} else if (
|
|
535
|
-
typeFull += `;${
|
|
536
|
-
if (
|
|
537
|
-
charset =
|
|
534
|
+
} else if (meta25[i2]) {
|
|
535
|
+
typeFull += `;${meta25[i2]}`;
|
|
536
|
+
if (meta25[i2].indexOf("charset=") === 0) {
|
|
537
|
+
charset = meta25[i2].substring(8);
|
|
538
538
|
}
|
|
539
539
|
}
|
|
540
540
|
}
|
|
541
|
-
if (!
|
|
541
|
+
if (!meta25[0] && !charset.length) {
|
|
542
542
|
typeFull += ";charset=US-ASCII";
|
|
543
543
|
charset = "US-ASCII";
|
|
544
544
|
}
|
|
@@ -5312,22 +5312,22 @@ var init_from = __esm({
|
|
|
5312
5312
|
init_file();
|
|
5313
5313
|
init_fetch_blob();
|
|
5314
5314
|
({ stat } = fs24.promises);
|
|
5315
|
-
blobFromSync = (
|
|
5316
|
-
blobFrom = (
|
|
5317
|
-
fileFrom = (
|
|
5318
|
-
fileFromSync = (
|
|
5319
|
-
fromBlob = (stat13,
|
|
5320
|
-
path:
|
|
5315
|
+
blobFromSync = (path59, type2) => fromBlob(fs24.statSync(path59), path59, type2);
|
|
5316
|
+
blobFrom = (path59, type2) => stat(path59).then((stat13) => fromBlob(stat13, path59, type2));
|
|
5317
|
+
fileFrom = (path59, type2) => stat(path59).then((stat13) => fromFile(stat13, path59, type2));
|
|
5318
|
+
fileFromSync = (path59, type2) => fromFile(fs24.statSync(path59), path59, type2);
|
|
5319
|
+
fromBlob = (stat13, path59, type2 = "") => new fetch_blob_default([new BlobDataItem({
|
|
5320
|
+
path: path59,
|
|
5321
5321
|
size: stat13.size,
|
|
5322
5322
|
lastModified: stat13.mtimeMs,
|
|
5323
5323
|
start: 0
|
|
5324
5324
|
})], { type: type2 });
|
|
5325
|
-
fromFile = (stat13,
|
|
5326
|
-
path:
|
|
5325
|
+
fromFile = (stat13, path59, type2 = "") => new file_default([new BlobDataItem({
|
|
5326
|
+
path: path59,
|
|
5327
5327
|
size: stat13.size,
|
|
5328
5328
|
lastModified: stat13.mtimeMs,
|
|
5329
5329
|
start: 0
|
|
5330
|
-
})],
|
|
5330
|
+
})], path58.basename(path59), { type: type2, lastModified: stat13.mtimeMs });
|
|
5331
5331
|
BlobDataItem = class _BlobDataItem {
|
|
5332
5332
|
#path;
|
|
5333
5333
|
#start;
|
|
@@ -18796,6 +18796,292 @@ var init_logger = __esm({
|
|
|
18796
18796
|
}
|
|
18797
18797
|
});
|
|
18798
18798
|
|
|
18799
|
+
// src/services/base/TelemetryCollector.ts
|
|
18800
|
+
var TelemetryCollector, telemetry;
|
|
18801
|
+
var init_TelemetryCollector = __esm({
|
|
18802
|
+
"src/services/base/TelemetryCollector.ts"() {
|
|
18803
|
+
TelemetryCollector = class _TelemetryCollector {
|
|
18804
|
+
_events = [];
|
|
18805
|
+
maxEvents = 1e4;
|
|
18806
|
+
_listeners = /* @__PURE__ */ new Map();
|
|
18807
|
+
metricsCache = /* @__PURE__ */ new Map();
|
|
18808
|
+
cacheExpiry = 6e4;
|
|
18809
|
+
// 1 minute cache
|
|
18810
|
+
lastCacheUpdate = 0;
|
|
18811
|
+
eventCounters = /* @__PURE__ */ new Map();
|
|
18812
|
+
static instance;
|
|
18813
|
+
constructor() {
|
|
18814
|
+
}
|
|
18815
|
+
/**
|
|
18816
|
+
* Get singleton instance
|
|
18817
|
+
*/
|
|
18818
|
+
static getInstance() {
|
|
18819
|
+
if (!_TelemetryCollector.instance) {
|
|
18820
|
+
_TelemetryCollector.instance = new _TelemetryCollector();
|
|
18821
|
+
}
|
|
18822
|
+
return _TelemetryCollector.instance;
|
|
18823
|
+
}
|
|
18824
|
+
/**
|
|
18825
|
+
* Emit a telemetry event
|
|
18826
|
+
*/
|
|
18827
|
+
emit(event) {
|
|
18828
|
+
const _telemetryEvent = {
|
|
18829
|
+
...event,
|
|
18830
|
+
ts: Date.now()
|
|
18831
|
+
};
|
|
18832
|
+
this._events.push(_telemetryEvent);
|
|
18833
|
+
if (this._events.length > this.maxEvents) {
|
|
18834
|
+
this._events = this._events.slice(-this.maxEvents);
|
|
18835
|
+
}
|
|
18836
|
+
const _counterKey = `${event.event}:${event.tags.comp}`;
|
|
18837
|
+
this.eventCounters.set(
|
|
18838
|
+
_counterKey,
|
|
18839
|
+
(this.eventCounters.get(_counterKey) ?? 0) + 1
|
|
18840
|
+
);
|
|
18841
|
+
this.lastCacheUpdate = 0;
|
|
18842
|
+
this.notifyListeners(_telemetryEvent);
|
|
18843
|
+
if (process.env.DEBUG_TELEMETRY === "true") {
|
|
18844
|
+
this.logEvent(_telemetryEvent);
|
|
18845
|
+
}
|
|
18846
|
+
}
|
|
18847
|
+
/**
|
|
18848
|
+
* Start a timed operation
|
|
18849
|
+
*/
|
|
18850
|
+
startTimer(event, tags) {
|
|
18851
|
+
const _startTime = Date.now();
|
|
18852
|
+
this.emit({
|
|
18853
|
+
event,
|
|
18854
|
+
tags
|
|
18855
|
+
});
|
|
18856
|
+
return () => {
|
|
18857
|
+
const _duration = Date.now() - _startTime;
|
|
18858
|
+
this.emit({
|
|
18859
|
+
event: event.replace(".start", ".end"),
|
|
18860
|
+
dur: _duration,
|
|
18861
|
+
tags
|
|
18862
|
+
});
|
|
18863
|
+
};
|
|
18864
|
+
}
|
|
18865
|
+
/**
|
|
18866
|
+
* Record an _error
|
|
18867
|
+
*/
|
|
18868
|
+
recordError(component, _error, context2) {
|
|
18869
|
+
const _errorData = this.extractErrorData(_error);
|
|
18870
|
+
this.emit({
|
|
18871
|
+
event: "system.error" /* SYSTEM_ERROR */,
|
|
18872
|
+
tags: { _comp: component },
|
|
18873
|
+
meta: context2,
|
|
18874
|
+
_error: _errorData
|
|
18875
|
+
});
|
|
18876
|
+
}
|
|
18877
|
+
/**
|
|
18878
|
+
* Subscribe to _events
|
|
18879
|
+
*/
|
|
18880
|
+
subscribe(pattern, _listener) {
|
|
18881
|
+
const _key = pattern.toString();
|
|
18882
|
+
if (!this._listeners.has(_key)) {
|
|
18883
|
+
this._listeners.set(_key, /* @__PURE__ */ new Set());
|
|
18884
|
+
}
|
|
18885
|
+
this._listeners.get(_key).add(_listener);
|
|
18886
|
+
return () => {
|
|
18887
|
+
const _listeners = this._listeners.get(_key);
|
|
18888
|
+
if (_listeners) {
|
|
18889
|
+
_listeners.delete(_listener);
|
|
18890
|
+
if (_listeners.size === 0) {
|
|
18891
|
+
this._listeners.delete(_key);
|
|
18892
|
+
}
|
|
18893
|
+
}
|
|
18894
|
+
};
|
|
18895
|
+
}
|
|
18896
|
+
/**
|
|
18897
|
+
* Get _metrics for a component
|
|
18898
|
+
*/
|
|
18899
|
+
getMetrics(component, window = 6e4) {
|
|
18900
|
+
const _now = Date._now();
|
|
18901
|
+
const _cacheKey = `${component ?? "all"}:${window}`;
|
|
18902
|
+
if (_now - this.lastCacheUpdate < this.cacheExpiry) {
|
|
18903
|
+
const _cached = this.metricsCache.get(_cacheKey);
|
|
18904
|
+
if (_cached) {
|
|
18905
|
+
return _cached;
|
|
18906
|
+
}
|
|
18907
|
+
}
|
|
18908
|
+
const _metrics = component ? this.calculateMetrics(component, window) : this.calculateAllMetrics(window);
|
|
18909
|
+
this.metricsCache.set(_cacheKey, _metrics);
|
|
18910
|
+
this.lastCacheUpdate = _now;
|
|
18911
|
+
return _metrics;
|
|
18912
|
+
}
|
|
18913
|
+
/**
|
|
18914
|
+
* Calculate _metrics for a component
|
|
18915
|
+
*/
|
|
18916
|
+
calculateMetrics(component, window) {
|
|
18917
|
+
const _now = Date._now();
|
|
18918
|
+
const _relevant = this._events.filter(
|
|
18919
|
+
(e2) => _now - e2.ts < window && e2.tags.comp === component
|
|
18920
|
+
);
|
|
18921
|
+
const _durations = _relevant.filter((e2) => e2.dur !== void 0).map((e2) => e2.dur).sort((a, b) => a - b);
|
|
18922
|
+
const _errors = _relevant.filter((e2) => e2._error !== void 0);
|
|
18923
|
+
return {
|
|
18924
|
+
eventCount: _relevant.length,
|
|
18925
|
+
errorCount: _errors.length,
|
|
18926
|
+
avgDuration: this.calculateAverage(_durations),
|
|
18927
|
+
p50Duration: this.calculatePercentile(_durations, 0.5),
|
|
18928
|
+
p95Duration: this.calculatePercentile(_durations, 0.95),
|
|
18929
|
+
p99Duration: this.calculatePercentile(_durations, 0.99),
|
|
18930
|
+
errorRate: _relevant.length > 0 ? _errors.length / _relevant.length : 0,
|
|
18931
|
+
throughput: _relevant.length / (window / 1e3)
|
|
18932
|
+
// _events per second
|
|
18933
|
+
};
|
|
18934
|
+
}
|
|
18935
|
+
/**
|
|
18936
|
+
* Calculate _metrics for all _components
|
|
18937
|
+
*/
|
|
18938
|
+
calculateAllMetrics(window) {
|
|
18939
|
+
const _components = ["memory", "kg", "conv", "learn", "system"];
|
|
18940
|
+
const _metrics = {};
|
|
18941
|
+
for (const _comp of _components) {
|
|
18942
|
+
_metrics[_comp] = this.calculateMetrics(_comp, window);
|
|
18943
|
+
}
|
|
18944
|
+
return _metrics;
|
|
18945
|
+
}
|
|
18946
|
+
/**
|
|
18947
|
+
* Calculate average
|
|
18948
|
+
*/
|
|
18949
|
+
calculateAverage(values) {
|
|
18950
|
+
if (values.length === 0) return 0;
|
|
18951
|
+
const _sum = values.reduce((a, b) => a + b, 0);
|
|
18952
|
+
return _sum / values.length;
|
|
18953
|
+
}
|
|
18954
|
+
/**
|
|
18955
|
+
* Calculate percentile
|
|
18956
|
+
*/
|
|
18957
|
+
calculatePercentile(sortedValues, percentile) {
|
|
18958
|
+
if (sortedValues.length === 0) return 0;
|
|
18959
|
+
const _index = Math.floor(sortedValues.length * percentile);
|
|
18960
|
+
return sortedValues[Math.min(_index, sortedValues.length - 1)];
|
|
18961
|
+
}
|
|
18962
|
+
/**
|
|
18963
|
+
* Extract _error data
|
|
18964
|
+
*/
|
|
18965
|
+
extractErrorData(_error) {
|
|
18966
|
+
if (_error instanceof Error) {
|
|
18967
|
+
return {
|
|
18968
|
+
message: _error.message,
|
|
18969
|
+
stack: _error.stack,
|
|
18970
|
+
code: _error.code
|
|
18971
|
+
};
|
|
18972
|
+
}
|
|
18973
|
+
return {
|
|
18974
|
+
message: String(_error)
|
|
18975
|
+
};
|
|
18976
|
+
}
|
|
18977
|
+
/**
|
|
18978
|
+
* Notify _listeners
|
|
18979
|
+
*/
|
|
18980
|
+
notifyListeners(event) {
|
|
18981
|
+
for (const [_pattern, _listeners] of this._listeners.entries()) {
|
|
18982
|
+
const _regex = _pattern.startsWith("/") ? new RegExp(_pattern.slice(1, -1)) : new RegExp(_pattern);
|
|
18983
|
+
if (_regex.test(event.event)) {
|
|
18984
|
+
for (const _listener of _listeners) {
|
|
18985
|
+
try {
|
|
18986
|
+
_listener(event);
|
|
18987
|
+
} catch (_error) {
|
|
18988
|
+
console._error("Telemetry _listener _error:", _error);
|
|
18989
|
+
}
|
|
18990
|
+
}
|
|
18991
|
+
}
|
|
18992
|
+
}
|
|
18993
|
+
}
|
|
18994
|
+
/**
|
|
18995
|
+
* Log event for debugging
|
|
18996
|
+
*/
|
|
18997
|
+
logEvent(event) {
|
|
18998
|
+
const _formatted = {
|
|
18999
|
+
event: event.event,
|
|
19000
|
+
component: event.tags.comp,
|
|
19001
|
+
_duration: event.dur,
|
|
19002
|
+
tags: Object.entries(event.tags).filter(([k]) => k !== "_comp").map(([k, v]) => `${k}=${v}`).join(" "),
|
|
19003
|
+
meta: event.meta ? JSON.stringify(event.meta) : void 0,
|
|
19004
|
+
_error: event._error?.message
|
|
19005
|
+
};
|
|
19006
|
+
console.log("[TEL]", JSON.stringify(_formatted));
|
|
19007
|
+
}
|
|
19008
|
+
/**
|
|
19009
|
+
* Export _events for analysis
|
|
19010
|
+
*/
|
|
19011
|
+
exportEvents(filter2) {
|
|
19012
|
+
let _events = [...this._events];
|
|
19013
|
+
if (filter2) {
|
|
19014
|
+
if (filter2.component) {
|
|
19015
|
+
_events = _events.filter((e2) => e2.tags.comp === filter2.component);
|
|
19016
|
+
}
|
|
19017
|
+
if (filter2._startTime) {
|
|
19018
|
+
_events = _events.filter((e2) => e2.ts >= filter2._startTime);
|
|
19019
|
+
}
|
|
19020
|
+
if (filter2.endTime) {
|
|
19021
|
+
_events = _events.filter((e2) => e2.ts <= filter2.endTime);
|
|
19022
|
+
}
|
|
19023
|
+
if (filter2.event) {
|
|
19024
|
+
const _regex = filter2.event instanceof RegExp ? filter2.event : new RegExp(filter2.event);
|
|
19025
|
+
_events = _events.filter((e2) => _regex.test(e2.event));
|
|
19026
|
+
}
|
|
19027
|
+
}
|
|
19028
|
+
return _events;
|
|
19029
|
+
}
|
|
19030
|
+
/**
|
|
19031
|
+
* Clear all _events
|
|
19032
|
+
*/
|
|
19033
|
+
clear() {
|
|
19034
|
+
this._events = [];
|
|
19035
|
+
this.metricsCache.clear();
|
|
19036
|
+
this.eventCounters.clear();
|
|
19037
|
+
this.lastCacheUpdate = 0;
|
|
19038
|
+
}
|
|
19039
|
+
/**
|
|
19040
|
+
* Get event _counts by type
|
|
19041
|
+
*/
|
|
19042
|
+
getEventCounts() {
|
|
19043
|
+
return new Map(this.eventCounters);
|
|
19044
|
+
}
|
|
19045
|
+
/**
|
|
19046
|
+
* Generate summary _report
|
|
19047
|
+
*/
|
|
19048
|
+
generateReport(window = 3e5) {
|
|
19049
|
+
const _metrics = this.getMetrics(void 0, window);
|
|
19050
|
+
const _counts = this.getEventCounts();
|
|
19051
|
+
let _report = "=".repeat(80) + "\n";
|
|
19052
|
+
_report += "TELEMETRY REPORT\n";
|
|
19053
|
+
_report += "=".repeat(80) + "\n\n";
|
|
19054
|
+
for (const [_comp, _met] of Object.entries(_metrics)) {
|
|
19055
|
+
_report += `Component: ${_comp.toUpperCase()}
|
|
19056
|
+
`;
|
|
19057
|
+
_report += "-".repeat(40) + "\n";
|
|
19058
|
+
_report += ` Events: ${_met.eventCount}
|
|
19059
|
+
`;
|
|
19060
|
+
_report += ` Errors: ${_met.errorCount} (${(_met.errorRate * 100).toFixed(2)}%)
|
|
19061
|
+
`;
|
|
19062
|
+
_report += ` Avg Duration: ${_met.avgDuration.toFixed(2)}ms
|
|
19063
|
+
`;
|
|
19064
|
+
_report += ` P95 Duration: ${_met.p95Duration.toFixed(2)}ms
|
|
19065
|
+
`;
|
|
19066
|
+
_report += ` Throughput: ${_met.throughput.toFixed(2)} _events/sec
|
|
19067
|
+
`;
|
|
19068
|
+
_report += "\n";
|
|
19069
|
+
}
|
|
19070
|
+
_report += "TOP EVENTS\n";
|
|
19071
|
+
_report += "-".repeat(40) + "\n";
|
|
19072
|
+
const _topEvents = Array.from(_counts.entries()).sort((a, b) => b[1] - a[1]).slice(0, 10);
|
|
19073
|
+
for (const [_event, _count] of _topEvents) {
|
|
19074
|
+
_report += ` ${_event}: ${_count}
|
|
19075
|
+
`;
|
|
19076
|
+
}
|
|
19077
|
+
_report += "\n" + "=".repeat(80);
|
|
19078
|
+
return _report;
|
|
19079
|
+
}
|
|
19080
|
+
};
|
|
19081
|
+
telemetry = TelemetryCollector.getInstance();
|
|
19082
|
+
}
|
|
19083
|
+
});
|
|
19084
|
+
|
|
18799
19085
|
// src/lib/command-groups.ts
|
|
18800
19086
|
function getCommandInfo(command) {
|
|
18801
19087
|
const raw = command.replace(/^\//, "");
|
|
@@ -19156,11 +19442,11 @@ var init_ConfigService = __esm({
|
|
|
19156
19442
|
_saveDebounceTimer = null;
|
|
19157
19443
|
_isDirty = false;
|
|
19158
19444
|
constructor(configDir = process.env.MARIA_CONFIG_DIR || "~/.maria") {
|
|
19159
|
-
this._configPath =
|
|
19445
|
+
this._configPath = path58__namespace.join(
|
|
19160
19446
|
this.expandHome(configDir),
|
|
19161
19447
|
"session.config.json"
|
|
19162
19448
|
);
|
|
19163
|
-
this._userConfigPath =
|
|
19449
|
+
this._userConfigPath = path58__namespace.join(
|
|
19164
19450
|
this.expandHome(configDir),
|
|
19165
19451
|
"user.config.json"
|
|
19166
19452
|
);
|
|
@@ -19235,8 +19521,8 @@ var init_ConfigService = __esm({
|
|
|
19235
19521
|
/**
|
|
19236
19522
|
* ネストされた設定値の取得
|
|
19237
19523
|
*/
|
|
19238
|
-
getNestedValue(
|
|
19239
|
-
const keys =
|
|
19524
|
+
getNestedValue(path59) {
|
|
19525
|
+
const keys = path59.split(".");
|
|
19240
19526
|
let value = this._config;
|
|
19241
19527
|
for (const key of keys) {
|
|
19242
19528
|
if (value && typeof value === "object" && key in value) {
|
|
@@ -19266,8 +19552,8 @@ var init_ConfigService = __esm({
|
|
|
19266
19552
|
/**
|
|
19267
19553
|
* ネストされた設定値の更新
|
|
19268
19554
|
*/
|
|
19269
|
-
async setNestedValue(
|
|
19270
|
-
const keys =
|
|
19555
|
+
async setNestedValue(path59, value) {
|
|
19556
|
+
const keys = path59.split(".");
|
|
19271
19557
|
const lastKey = keys.pop();
|
|
19272
19558
|
let target = this._config;
|
|
19273
19559
|
for (const key of keys) {
|
|
@@ -19280,7 +19566,7 @@ var init_ConfigService = __esm({
|
|
|
19280
19566
|
target[lastKey] = value;
|
|
19281
19567
|
this.validateConfig();
|
|
19282
19568
|
this.emitChange({
|
|
19283
|
-
path:
|
|
19569
|
+
path: path59,
|
|
19284
19570
|
oldValue,
|
|
19285
19571
|
newValue: value,
|
|
19286
19572
|
timestamp: /* @__PURE__ */ new Date()
|
|
@@ -19294,7 +19580,7 @@ var init_ConfigService = __esm({
|
|
|
19294
19580
|
async save() {
|
|
19295
19581
|
if (!this._isDirty) return;
|
|
19296
19582
|
try {
|
|
19297
|
-
const configDir =
|
|
19583
|
+
const configDir = path58__namespace.dirname(this._userConfigPath);
|
|
19298
19584
|
await fsp__namespace.mkdir(configDir, { recursive: true });
|
|
19299
19585
|
await fsp__namespace.writeFile(
|
|
19300
19586
|
this._userConfigPath,
|
|
@@ -19337,13 +19623,13 @@ var init_ConfigService = __esm({
|
|
|
19337
19623
|
/**
|
|
19338
19624
|
* 変更リスナーの登録
|
|
19339
19625
|
*/
|
|
19340
|
-
onChange(
|
|
19341
|
-
if (!this._listeners.has(
|
|
19342
|
-
this._listeners.set(
|
|
19626
|
+
onChange(path59, listener) {
|
|
19627
|
+
if (!this._listeners.has(path59)) {
|
|
19628
|
+
this._listeners.set(path59, []);
|
|
19343
19629
|
}
|
|
19344
|
-
this._listeners.get(
|
|
19630
|
+
this._listeners.get(path59).push(listener);
|
|
19345
19631
|
return () => {
|
|
19346
|
-
const listeners = this._listeners.get(
|
|
19632
|
+
const listeners = this._listeners.get(path59);
|
|
19347
19633
|
if (listeners) {
|
|
19348
19634
|
const index = listeners.indexOf(listener);
|
|
19349
19635
|
if (index !== -1) {
|
|
@@ -19394,7 +19680,7 @@ var init_ConfigService = __esm({
|
|
|
19394
19680
|
*/
|
|
19395
19681
|
expandHome(filePath) {
|
|
19396
19682
|
if (filePath.startsWith("~/")) {
|
|
19397
|
-
return
|
|
19683
|
+
return path58__namespace.join(process.env.HOME || "", filePath.slice(2));
|
|
19398
19684
|
}
|
|
19399
19685
|
return filePath;
|
|
19400
19686
|
}
|
|
@@ -19832,7 +20118,7 @@ var init_ValidationService = __esm({
|
|
|
19832
20118
|
);
|
|
19833
20119
|
this._schemas.set(
|
|
19834
20120
|
"filePath",
|
|
19835
|
-
zod.z.string().min(1).max(this._config.maxFilePathLength).refine((
|
|
20121
|
+
zod.z.string().min(1).max(this._config.maxFilePathLength).refine((path59) => !this.containsPathTraversal(path59), {
|
|
19836
20122
|
message: "Path traversal detected"
|
|
19837
20123
|
})
|
|
19838
20124
|
);
|
|
@@ -19971,11 +20257,11 @@ var init_ValidationService = __esm({
|
|
|
19971
20257
|
/**
|
|
19972
20258
|
* ファイルパス検証
|
|
19973
20259
|
*/
|
|
19974
|
-
validateFilePath(
|
|
20260
|
+
validateFilePath(path59) {
|
|
19975
20261
|
try {
|
|
19976
20262
|
const schema2 = this._schemas.get("filePath");
|
|
19977
|
-
const result = schema2.parse(
|
|
19978
|
-
if (this.isSystemPath(
|
|
20263
|
+
const result = schema2.parse(path59);
|
|
20264
|
+
if (this.isSystemPath(path59)) {
|
|
19979
20265
|
return {
|
|
19980
20266
|
valid: false,
|
|
19981
20267
|
errors: [
|
|
@@ -20121,8 +20407,8 @@ var init_ValidationService = __esm({
|
|
|
20121
20407
|
/**
|
|
20122
20408
|
* パストラバーサルの検出
|
|
20123
20409
|
*/
|
|
20124
|
-
containsPathTraversal(
|
|
20125
|
-
return /\.\.[/\\]/.test(
|
|
20410
|
+
containsPathTraversal(path59) {
|
|
20411
|
+
return /\.\.[/\\]/.test(path59) || path59.includes("..\\") || path59.includes("../");
|
|
20126
20412
|
}
|
|
20127
20413
|
/**
|
|
20128
20414
|
* 危険なコマンドの判定
|
|
@@ -20149,7 +20435,7 @@ var init_ValidationService = __esm({
|
|
|
20149
20435
|
/**
|
|
20150
20436
|
* システムパスの判定
|
|
20151
20437
|
*/
|
|
20152
|
-
isSystemPath(
|
|
20438
|
+
isSystemPath(path59) {
|
|
20153
20439
|
const systemPaths = [
|
|
20154
20440
|
"/etc",
|
|
20155
20441
|
"/sys",
|
|
@@ -20163,7 +20449,7 @@ var init_ValidationService = __esm({
|
|
|
20163
20449
|
"/sbin"
|
|
20164
20450
|
];
|
|
20165
20451
|
return systemPaths.some(
|
|
20166
|
-
(sysPath) =>
|
|
20452
|
+
(sysPath) => path59.toLowerCase().startsWith(sysPath.toLowerCase())
|
|
20167
20453
|
);
|
|
20168
20454
|
}
|
|
20169
20455
|
/**
|
|
@@ -24263,12 +24549,12 @@ describe("${target}", () => {
|
|
|
24263
24549
|
// src/services/ai-response/telemetry/telemetry-collector.ts
|
|
24264
24550
|
var telemetry_collector_exports = {};
|
|
24265
24551
|
__export(telemetry_collector_exports, {
|
|
24266
|
-
TelemetryCollector: () =>
|
|
24552
|
+
TelemetryCollector: () => TelemetryCollector2
|
|
24267
24553
|
});
|
|
24268
|
-
var
|
|
24554
|
+
var TelemetryCollector2;
|
|
24269
24555
|
var init_telemetry_collector = __esm({
|
|
24270
24556
|
"src/services/ai-response/telemetry/telemetry-collector.ts"() {
|
|
24271
|
-
|
|
24557
|
+
TelemetryCollector2 = class _TelemetryCollector {
|
|
24272
24558
|
static instance;
|
|
24273
24559
|
events = [];
|
|
24274
24560
|
sessionId;
|
|
@@ -25125,8 +25411,8 @@ Run /doctor --fix to automatically fix ${fixableCount} issue(s)`
|
|
|
25125
25411
|
if (outputPath) {
|
|
25126
25412
|
try {
|
|
25127
25413
|
const fs48 = await import('fs/promises');
|
|
25128
|
-
const
|
|
25129
|
-
const abs =
|
|
25414
|
+
const path59 = await import('path');
|
|
25415
|
+
const abs = path59.resolve(outputPath);
|
|
25130
25416
|
await fs48.writeFile(abs, text, "utf-8");
|
|
25131
25417
|
const msg = `Saved doctor report to ${abs}`;
|
|
25132
25418
|
return { ok: true, message: msg, data: { path: abs, bytes: Buffer.byteLength(text, "utf-8") } };
|
|
@@ -25218,8 +25504,8 @@ Run /doctor --fix to automatically fix ${fixableCount} issue(s)`
|
|
|
25218
25504
|
if (outputPath) {
|
|
25219
25505
|
try {
|
|
25220
25506
|
const fs48 = await import('fs/promises');
|
|
25221
|
-
const
|
|
25222
|
-
const abs =
|
|
25507
|
+
const path59 = await import('path');
|
|
25508
|
+
const abs = path59.resolve(outputPath);
|
|
25223
25509
|
await fs48.writeFile(abs, text, "utf-8");
|
|
25224
25510
|
const msg = `Saved metrics to ${abs}`;
|
|
25225
25511
|
return { ok: true, message: msg, data: { path: abs, bytes: Buffer.byteLength(text, "utf-8") } };
|
|
@@ -25609,15 +25895,15 @@ var init_SessionOrchestrator = __esm({
|
|
|
25609
25895
|
/**
|
|
25610
25896
|
* 設定の取得
|
|
25611
25897
|
*/
|
|
25612
|
-
getConfig(
|
|
25613
|
-
return this._configService?.getNestedValue(
|
|
25898
|
+
getConfig(path59) {
|
|
25899
|
+
return this._configService?.getNestedValue(path59);
|
|
25614
25900
|
}
|
|
25615
25901
|
/**
|
|
25616
25902
|
* 設定の更新
|
|
25617
25903
|
*/
|
|
25618
|
-
async setConfig(
|
|
25904
|
+
async setConfig(path59, value) {
|
|
25619
25905
|
if (this._configService) {
|
|
25620
|
-
await this._configService.setNestedValue(
|
|
25906
|
+
await this._configService.setNestedValue(path59, value);
|
|
25621
25907
|
}
|
|
25622
25908
|
}
|
|
25623
25909
|
/**
|
|
@@ -25735,11 +26021,11 @@ var init_interactive_session = __esm({
|
|
|
25735
26021
|
getStats() {
|
|
25736
26022
|
return this.orchestrator.getSessionStats();
|
|
25737
26023
|
}
|
|
25738
|
-
getConfig(
|
|
25739
|
-
return this.orchestrator.getConfig(
|
|
26024
|
+
getConfig(path59) {
|
|
26025
|
+
return this.orchestrator.getConfig(path59);
|
|
25740
26026
|
}
|
|
25741
|
-
async setConfig(
|
|
25742
|
-
await this.orchestrator.setConfig(
|
|
26027
|
+
async setConfig(path59, value) {
|
|
26028
|
+
await this.orchestrator.setConfig(path59, value);
|
|
25743
26029
|
}
|
|
25744
26030
|
};
|
|
25745
26031
|
}
|
|
@@ -25750,8 +26036,8 @@ var require_package = __commonJS({
|
|
|
25750
26036
|
"package.json"(exports, module) {
|
|
25751
26037
|
module.exports = {
|
|
25752
26038
|
name: "@bonginkan/maria",
|
|
25753
|
-
version: "4.3.
|
|
25754
|
-
description: "\u{1F680} MARIA v4.3.
|
|
26039
|
+
version: "4.3.14",
|
|
26040
|
+
description: "\u{1F680} MARIA v4.3.14 - 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.",
|
|
25755
26041
|
keywords: [
|
|
25756
26042
|
"ai",
|
|
25757
26043
|
"cli",
|
|
@@ -26270,21 +26556,21 @@ var require_package = __commonJS({
|
|
|
26270
26556
|
}
|
|
26271
26557
|
});
|
|
26272
26558
|
function loadEnvironmentVariables() {
|
|
26273
|
-
const _envPath =
|
|
26559
|
+
const _envPath = path58__namespace.join(process.cwd(), ".env");
|
|
26274
26560
|
if (fs24__namespace.existsSync(_envPath)) {
|
|
26275
26561
|
const _result = dotenv__namespace.config({ path: _envPath });
|
|
26276
26562
|
if (_result.error) {
|
|
26277
26563
|
console.warn("Error loading .env:", _result.error);
|
|
26278
26564
|
}
|
|
26279
26565
|
}
|
|
26280
|
-
const _envLocalPath =
|
|
26566
|
+
const _envLocalPath = path58__namespace.join(process.cwd(), ".env.local");
|
|
26281
26567
|
if (fs24__namespace.existsSync(_envLocalPath)) {
|
|
26282
26568
|
const _result = dotenv__namespace.config({ path: _envLocalPath, override: true });
|
|
26283
26569
|
if (_result.error) {
|
|
26284
26570
|
console.warn("Error loading .env.local:", _result.error);
|
|
26285
26571
|
}
|
|
26286
26572
|
}
|
|
26287
|
-
const _lmstudioEnvPath =
|
|
26573
|
+
const _lmstudioEnvPath = path58__namespace.join(process.cwd(), ".env.lmstudio");
|
|
26288
26574
|
if (fs24__namespace.existsSync(_lmstudioEnvPath)) {
|
|
26289
26575
|
const _result = dotenv__namespace.config({ path: _lmstudioEnvPath, override: false });
|
|
26290
26576
|
if (_result.error) {
|
|
@@ -26682,11 +26968,11 @@ var init_OAuth2PKCEClient = __esm({
|
|
|
26682
26968
|
redirectUri: config2.redirectUri || "http://127.0.0.1:9876/callback",
|
|
26683
26969
|
authServerUrl: config2.authServerUrl || "https://maria-code.ai"
|
|
26684
26970
|
};
|
|
26685
|
-
const configDir =
|
|
26971
|
+
const configDir = path58__namespace.join(os16__namespace.homedir(), ".maria");
|
|
26686
26972
|
if (!fs24__namespace.existsSync(configDir)) {
|
|
26687
26973
|
fs24__namespace.mkdirSync(configDir, { recursive: true });
|
|
26688
26974
|
}
|
|
26689
|
-
this.tokenStoragePath =
|
|
26975
|
+
this.tokenStoragePath = path58__namespace.join(configDir, "auth-tokens.json");
|
|
26690
26976
|
}
|
|
26691
26977
|
/**
|
|
26692
26978
|
* Generate cryptographically secure random string
|
|
@@ -27264,11 +27550,11 @@ var init_CLIAuthService = __esm({
|
|
|
27264
27550
|
configPath;
|
|
27265
27551
|
config;
|
|
27266
27552
|
constructor(config2) {
|
|
27267
|
-
const configDir =
|
|
27553
|
+
const configDir = path58__namespace.join(os16__namespace.homedir(), ".maria");
|
|
27268
27554
|
if (!fs24__namespace.existsSync(configDir)) {
|
|
27269
27555
|
fs24__namespace.mkdirSync(configDir, { recursive: true });
|
|
27270
27556
|
}
|
|
27271
|
-
this.configPath =
|
|
27557
|
+
this.configPath = path58__namespace.join(configDir, "cli-config.json");
|
|
27272
27558
|
this.config = this.loadConfig(config2);
|
|
27273
27559
|
this.authClient = new OAuth2PKCEClient({
|
|
27274
27560
|
authorizationEndpoint: `${this.config.authServerUrl}/oauth/authorize`,
|
|
@@ -27590,8 +27876,8 @@ var init_TokenStorage = __esm({
|
|
|
27590
27876
|
TokenStorage = class {
|
|
27591
27877
|
SERVICE_NAME = "maria-cli";
|
|
27592
27878
|
ACCOUNT_NAME = "default";
|
|
27593
|
-
CONFIG_DIR =
|
|
27594
|
-
TOKEN_FILE =
|
|
27879
|
+
CONFIG_DIR = path58__namespace.default.join(os16__namespace.default.homedir(), ".maria");
|
|
27880
|
+
TOKEN_FILE = path58__namespace.default.join(this.CONFIG_DIR, "auth-tokens.json");
|
|
27595
27881
|
/**
|
|
27596
27882
|
* Save tokens securely
|
|
27597
27883
|
*/
|
|
@@ -28680,9 +28966,9 @@ function getDeviceId() {
|
|
|
28680
28966
|
function getSessionId() {
|
|
28681
28967
|
return global.MARIA_SESSION_ID;
|
|
28682
28968
|
}
|
|
28683
|
-
async function callApi(
|
|
28969
|
+
async function callApi(path59, init2 = {}) {
|
|
28684
28970
|
const apiBase = process.env.MARIA_API_BASE || "http://localhost:3001";
|
|
28685
|
-
const fullUrl = `${apiBase}${
|
|
28971
|
+
const fullUrl = `${apiBase}${path59}`;
|
|
28686
28972
|
let tokens2 = await authManager.getValidTokens();
|
|
28687
28973
|
if (!tokens2) {
|
|
28688
28974
|
console.log(chalk37__default.default.red(ERR.AUTH_REQUIRED.msg));
|
|
@@ -28751,8 +29037,8 @@ async function callApi(path58, init2 = {}) {
|
|
|
28751
29037
|
}
|
|
28752
29038
|
return response;
|
|
28753
29039
|
}
|
|
28754
|
-
async function callApiJson(
|
|
28755
|
-
const response = await callApi(
|
|
29040
|
+
async function callApiJson(path59, init2 = {}) {
|
|
29041
|
+
const response = await callApi(path59, init2);
|
|
28756
29042
|
if (!response.ok) {
|
|
28757
29043
|
const error2 = await response.json().catch(() => ({
|
|
28758
29044
|
message: `API error: ${response.status} ${response.statusText}`
|
|
@@ -28904,7 +29190,7 @@ var init_choice_memory = __esm({
|
|
|
28904
29190
|
track(eventType, data) {
|
|
28905
29191
|
try {
|
|
28906
29192
|
if (!this.telemetry) {
|
|
28907
|
-
this.telemetry =
|
|
29193
|
+
this.telemetry = TelemetryCollector2.getInstance();
|
|
28908
29194
|
}
|
|
28909
29195
|
this.telemetry.trackCustom(eventType, data);
|
|
28910
29196
|
} catch {
|
|
@@ -29047,7 +29333,7 @@ var init_chat_context_service = __esm({
|
|
|
29047
29333
|
// 400K session window
|
|
29048
29334
|
compressionThreshold: config2?.compressionThreshold || 0.8,
|
|
29049
29335
|
summaryTokenLimit: config2?.summaryTokenLimit || 2e3,
|
|
29050
|
-
persistPath: config2?.persistPath ||
|
|
29336
|
+
persistPath: config2?.persistPath || path58__namespace.join(process.env["HOME"] || "", ".maria", "context")
|
|
29051
29337
|
};
|
|
29052
29338
|
this.sessionId = this.generateSessionId();
|
|
29053
29339
|
}
|
|
@@ -29171,7 +29457,7 @@ var init_chat_context_service = __esm({
|
|
|
29171
29457
|
if (!this.config.persistPath) return;
|
|
29172
29458
|
try {
|
|
29173
29459
|
await fsp__namespace.mkdir(this.config.persistPath, { recursive: true });
|
|
29174
|
-
const sessionFile =
|
|
29460
|
+
const sessionFile = path58__namespace.join(
|
|
29175
29461
|
this.config.persistPath,
|
|
29176
29462
|
`${this.sessionId}.json`
|
|
29177
29463
|
);
|
|
@@ -29242,8 +29528,8 @@ var init_conversation_persistence = __esm({
|
|
|
29242
29528
|
autoSaveInterval = null;
|
|
29243
29529
|
pendingWrites = [];
|
|
29244
29530
|
constructor(maxHistorySize = 100) {
|
|
29245
|
-
const configDir =
|
|
29246
|
-
this.sessionFile =
|
|
29531
|
+
const configDir = path58__namespace.join(os16__namespace.homedir(), ".maria");
|
|
29532
|
+
this.sessionFile = path58__namespace.join(configDir, "conversation-history.json");
|
|
29247
29533
|
this.maxHistorySize = maxHistorySize;
|
|
29248
29534
|
this.ensureConfigDir();
|
|
29249
29535
|
this.startAutoSave();
|
|
@@ -29253,7 +29539,7 @@ var init_conversation_persistence = __esm({
|
|
|
29253
29539
|
*/
|
|
29254
29540
|
async ensureConfigDir() {
|
|
29255
29541
|
try {
|
|
29256
|
-
const configDir =
|
|
29542
|
+
const configDir = path58__namespace.dirname(this.sessionFile);
|
|
29257
29543
|
await fs24.promises.mkdir(configDir, { recursive: true });
|
|
29258
29544
|
} catch (error2) {
|
|
29259
29545
|
console.warn("Failed to create config directory:", error2);
|
|
@@ -30721,9 +31007,9 @@ var FallbackManager;
|
|
|
30721
31007
|
var init_FallbackManager = __esm({
|
|
30722
31008
|
"src/services/fallback/FallbackManager.ts"() {
|
|
30723
31009
|
FallbackManager = class {
|
|
30724
|
-
constructor(policy,
|
|
31010
|
+
constructor(policy, telemetry2) {
|
|
30725
31011
|
this.policy = policy;
|
|
30726
|
-
this.telemetry =
|
|
31012
|
+
this.telemetry = telemetry2;
|
|
30727
31013
|
}
|
|
30728
31014
|
async run(attempt, opts = {}) {
|
|
30729
31015
|
const primary = await attempt();
|
|
@@ -33407,9 +33693,9 @@ function applyEnvOverrides(policy) {
|
|
|
33407
33693
|
function resolvePolicyPath(customPath) {
|
|
33408
33694
|
const envPath = process.env.MARIA_FALLBACK_POLICY_PATH;
|
|
33409
33695
|
if (envPath && envPath.trim().length > 0) {
|
|
33410
|
-
return
|
|
33696
|
+
return path58__namespace.default.resolve(envPath);
|
|
33411
33697
|
}
|
|
33412
|
-
return
|
|
33698
|
+
return path58__namespace.default.resolve(process.cwd(), "config", "fallback-policy.yaml");
|
|
33413
33699
|
}
|
|
33414
33700
|
async function loadFallbackPolicy(customPath) {
|
|
33415
33701
|
const policyPath = resolvePolicyPath();
|
|
@@ -33732,7 +34018,7 @@ var ai_response_service_exports = {};
|
|
|
33732
34018
|
__export(ai_response_service_exports, {
|
|
33733
34019
|
AIResponseService: () => AIResponseService
|
|
33734
34020
|
});
|
|
33735
|
-
var PLAIN_OUTPUT, DISABLE_SAFETY_GUARD, AIResponseService;
|
|
34021
|
+
var PLAIN_OUTPUT, DISABLE_SAFETY_GUARD, TEMPLATE_FALLBACK_ENABLED, AIResponseService;
|
|
33736
34022
|
var init_ai_response_service = __esm({
|
|
33737
34023
|
"src/services/ai-response.service.ts"() {
|
|
33738
34024
|
init_chat_context_service();
|
|
@@ -33750,6 +34036,7 @@ var init_ai_response_service = __esm({
|
|
|
33750
34036
|
init_safety();
|
|
33751
34037
|
PLAIN_OUTPUT = process.env.MARIA_PLAIN_OUTPUT === "1" || process.env.MARIA_DISABLE_GUIDED_FLOW === "1";
|
|
33752
34038
|
DISABLE_SAFETY_GUARD = process.env.MARIA_DISABLE_SAFETY_GUARD === "1";
|
|
34039
|
+
TEMPLATE_FALLBACK_ENABLED = process.env.MARIA_ENABLE_TEMPLATE_FALLBACK === "1";
|
|
33753
34040
|
AIResponseService = class {
|
|
33754
34041
|
chatContext;
|
|
33755
34042
|
_conversationPersistence;
|
|
@@ -33762,7 +34049,7 @@ var init_ai_response_service = __esm({
|
|
|
33762
34049
|
constructor() {
|
|
33763
34050
|
this.chatContext = ChatContextService.getInstance();
|
|
33764
34051
|
this._conversationPersistence = new ConversationPersistence();
|
|
33765
|
-
this.telemetry =
|
|
34052
|
+
this.telemetry = TelemetryCollector2.getInstance();
|
|
33766
34053
|
this.providerManager = getProviderManager();
|
|
33767
34054
|
this.initializeProviders().catch(() => void 0);
|
|
33768
34055
|
}
|
|
@@ -34087,6 +34374,7 @@ ${fallbackMessage}` : fallbackMessage : finalResponse;
|
|
|
34087
34374
|
if (PLAIN_OUTPUT) {
|
|
34088
34375
|
switch (intent.type) {
|
|
34089
34376
|
case "CODE_REQUEST":
|
|
34377
|
+
if (!TEMPLATE_FALLBACK_ENABLED) return "";
|
|
34090
34378
|
if (/\bcli\b/i.test(userInput)) return generateCLITemplate(isJapanese);
|
|
34091
34379
|
if (/\b(api|rest)\b/i.test(userInput))
|
|
34092
34380
|
return generateNextAPITemplate(isJapanese);
|
|
@@ -34099,8 +34387,10 @@ ${fallbackMessage}` : fallbackMessage : finalResponse;
|
|
|
34099
34387
|
}
|
|
34100
34388
|
switch (intent.type) {
|
|
34101
34389
|
case "TETRIS_REQUEST":
|
|
34390
|
+
if (!TEMPLATE_FALLBACK_ENABLED) return "";
|
|
34102
34391
|
return isExplicitContentAllowed(userInput, "tetris") ? generateTetrisGameTemplate(userInput) : this.generateDefaultResponse(userInput);
|
|
34103
34392
|
case "CODE_REQUEST":
|
|
34393
|
+
if (!TEMPLATE_FALLBACK_ENABLED) return "";
|
|
34104
34394
|
if (/\bcli\b/i.test(userInput)) return generateCLITemplate(isJapanese);
|
|
34105
34395
|
if (/\b(api|next|rest)\b/i.test(userInput))
|
|
34106
34396
|
return generateNextAPITemplate(isJapanese);
|
|
@@ -34625,14 +34915,14 @@ var init_ReadyCommandsService = __esm({
|
|
|
34625
34915
|
} else {
|
|
34626
34916
|
const possiblePaths = [
|
|
34627
34917
|
// For bundled dist version
|
|
34628
|
-
|
|
34629
|
-
|
|
34630
|
-
|
|
34918
|
+
path58__namespace.join(__dirname, "READY.manifest.json"),
|
|
34919
|
+
path58__namespace.join(__dirname, "../READY.manifest.json"),
|
|
34920
|
+
path58__namespace.join(process.cwd(), "dist/READY.manifest.json"),
|
|
34631
34921
|
// For development/source version
|
|
34632
|
-
|
|
34633
|
-
|
|
34634
|
-
|
|
34635
|
-
|
|
34922
|
+
path58__namespace.join(__dirname, "../../../src/slash-commands/READY.manifest.json"),
|
|
34923
|
+
path58__namespace.join(__dirname, "../../slash-commands/READY.manifest.json"),
|
|
34924
|
+
path58__namespace.join(process.cwd(), "src/slash-commands/READY.manifest.json"),
|
|
34925
|
+
path58__namespace.join(process.cwd(), "READY.manifest.json")
|
|
34636
34926
|
];
|
|
34637
34927
|
this.manifestPath = possiblePaths[0];
|
|
34638
34928
|
}
|
|
@@ -34643,17 +34933,17 @@ var init_ReadyCommandsService = __esm({
|
|
|
34643
34933
|
async findManifestPath() {
|
|
34644
34934
|
const possiblePaths = [
|
|
34645
34935
|
// For bundled dist version
|
|
34646
|
-
|
|
34647
|
-
|
|
34648
|
-
|
|
34936
|
+
path58__namespace.join(__dirname, "READY.manifest.json"),
|
|
34937
|
+
path58__namespace.join(__dirname, "../READY.manifest.json"),
|
|
34938
|
+
path58__namespace.join(process.cwd(), "dist/READY.manifest.json"),
|
|
34649
34939
|
// For development/source version
|
|
34650
|
-
|
|
34651
|
-
|
|
34652
|
-
|
|
34653
|
-
|
|
34940
|
+
path58__namespace.join(__dirname, "../../../src/slash-commands/READY.manifest.json"),
|
|
34941
|
+
path58__namespace.join(__dirname, "../../slash-commands/READY.manifest.json"),
|
|
34942
|
+
path58__namespace.join(process.cwd(), "src/slash-commands/READY.manifest.json"),
|
|
34943
|
+
path58__namespace.join(process.cwd(), "READY.manifest.json"),
|
|
34654
34944
|
// Additional paths for different build scenarios
|
|
34655
|
-
|
|
34656
|
-
|
|
34945
|
+
path58__namespace.resolve(__dirname, "../../../src/slash-commands/READY.manifest.json"),
|
|
34946
|
+
path58__namespace.resolve(process.cwd(), "src/slash-commands/READY.manifest.json")
|
|
34657
34947
|
];
|
|
34658
34948
|
for (const testPath of possiblePaths) {
|
|
34659
34949
|
try {
|
|
@@ -35221,7 +35511,7 @@ async function loadFirebaseAdmin() {
|
|
|
35221
35511
|
try {
|
|
35222
35512
|
const firebaseAdminModule = await import('firebase-admin/app');
|
|
35223
35513
|
const firestoreModule = await import('firebase-admin/firestore');
|
|
35224
|
-
const keyPath =
|
|
35514
|
+
const keyPath = path58__namespace.join(process.cwd(), "config", "maria-cli-firestore-key.json");
|
|
35225
35515
|
if (!adminApp && firebaseAdminModule.getApps().length === 0) {
|
|
35226
35516
|
adminApp = firebaseAdminModule.initializeApp({
|
|
35227
35517
|
credential: firebaseAdminModule.cert(keyPath),
|
|
@@ -35593,8 +35883,8 @@ var init_bigquery_telemetry = __esm({
|
|
|
35593
35883
|
});
|
|
35594
35884
|
async function getUserContext() {
|
|
35595
35885
|
try {
|
|
35596
|
-
const configDir =
|
|
35597
|
-
const authFile =
|
|
35886
|
+
const configDir = path58__namespace.join(process.env.HOME || process.env.USERPROFILE || "", ".maria");
|
|
35887
|
+
const authFile = path58__namespace.join(configDir, "auth.json");
|
|
35598
35888
|
if (await fs11__namespace.pathExists(authFile)) {
|
|
35599
35889
|
const authData = await fs11__namespace.readJson(authFile);
|
|
35600
35890
|
return {
|
|
@@ -36762,7 +37052,7 @@ var init_setup_command = __esm({
|
|
|
36762
37052
|
if (_setupRecord.filesGenerated) {
|
|
36763
37053
|
for (const file of _setupRecord.filesGenerated) {
|
|
36764
37054
|
try {
|
|
36765
|
-
const _filePath =
|
|
37055
|
+
const _filePath = path58__namespace.default.join(context2.environment.cwd, file);
|
|
36766
37056
|
await fsp__namespace.default.unlink(_filePath);
|
|
36767
37057
|
restoredFiles.push(file);
|
|
36768
37058
|
} catch (innerError) {
|
|
@@ -36772,7 +37062,7 @@ var init_setup_command = __esm({
|
|
|
36772
37062
|
}
|
|
36773
37063
|
}
|
|
36774
37064
|
}
|
|
36775
|
-
const _setupRecordPath =
|
|
37065
|
+
const _setupRecordPath = path58__namespace.default.join(
|
|
36776
37066
|
context2.environment.cwd,
|
|
36777
37067
|
".maria",
|
|
36778
37068
|
"setup.json"
|
|
@@ -36840,7 +37130,7 @@ var init_setup_command = __esm({
|
|
|
36840
37130
|
}
|
|
36841
37131
|
}
|
|
36842
37132
|
async recordSetupCompletion(_context, result) {
|
|
36843
|
-
const _mariaDir =
|
|
37133
|
+
const _mariaDir = path58__namespace.default.join(_context.environment.cwd, ".maria");
|
|
36844
37134
|
await fsp__namespace.default.mkdir(_mariaDir, { recursive: true });
|
|
36845
37135
|
const _setupRecord = {
|
|
36846
37136
|
...result,
|
|
@@ -36848,7 +37138,7 @@ var init_setup_command = __esm({
|
|
|
36848
37138
|
version: "1.0.0",
|
|
36849
37139
|
environment: _context.environment
|
|
36850
37140
|
};
|
|
36851
|
-
const _recordPath =
|
|
37141
|
+
const _recordPath = path58__namespace.default.join(_mariaDir, "setup.json");
|
|
36852
37142
|
await fsp__namespace.default.writeFile(
|
|
36853
37143
|
_recordPath,
|
|
36854
37144
|
JSON.stringify(_setupRecord, null, 2),
|
|
@@ -36947,14 +37237,14 @@ Estimated time: 3-5 minutes
|
|
|
36947
37237
|
}
|
|
36948
37238
|
async detectConfigurationIssues(context2) {
|
|
36949
37239
|
const _issues = [];
|
|
36950
|
-
if (!await this.fileExists(
|
|
37240
|
+
if (!await this.fileExists(path58__namespace.default.join(context2.environment.cwd, ".env.local"))) {
|
|
36951
37241
|
_issues.push({
|
|
36952
37242
|
description: "Missing .env.local file",
|
|
36953
37243
|
severity: "error"
|
|
36954
37244
|
});
|
|
36955
37245
|
}
|
|
36956
37246
|
if (!await this.fileExists(
|
|
36957
|
-
|
|
37247
|
+
path58__namespace.default.join(context2.environment.cwd, ".maria-code.toml")
|
|
36958
37248
|
)) {
|
|
36959
37249
|
_issues.push({
|
|
36960
37250
|
description: "Missing .maria-code.toml file",
|
|
@@ -36970,7 +37260,7 @@ Estimated time: 3-5 minutes
|
|
|
36970
37260
|
}
|
|
36971
37261
|
async getSetupRecord(context2) {
|
|
36972
37262
|
try {
|
|
36973
|
-
const _recordPath =
|
|
37263
|
+
const _recordPath = path58__namespace.default.join(
|
|
36974
37264
|
context2.environment.cwd,
|
|
36975
37265
|
".maria",
|
|
36976
37266
|
"setup.json"
|
|
@@ -36982,11 +37272,11 @@ Estimated time: 3-5 minutes
|
|
|
36982
37272
|
}
|
|
36983
37273
|
}
|
|
36984
37274
|
async validateEnvironmentFile(context2) {
|
|
36985
|
-
return this.fileExists(
|
|
37275
|
+
return this.fileExists(path58__namespace.default.join(context2.environment.cwd, ".env.local"));
|
|
36986
37276
|
}
|
|
36987
37277
|
async validateConfigFile(context2) {
|
|
36988
37278
|
return this.fileExists(
|
|
36989
|
-
|
|
37279
|
+
path58__namespace.default.join(context2.environment.cwd, ".maria-code.toml")
|
|
36990
37280
|
);
|
|
36991
37281
|
}
|
|
36992
37282
|
async validateProviderConnections(_context) {
|
|
@@ -37013,7 +37303,7 @@ VLLM_API_URL=http://localhost:8000
|
|
|
37013
37303
|
DEBUG=false
|
|
37014
37304
|
LOG_LEVEL=info
|
|
37015
37305
|
`;
|
|
37016
|
-
const _envPath =
|
|
37306
|
+
const _envPath = path58__namespace.default.join(process.cwd(), ".env.local");
|
|
37017
37307
|
await fsp__namespace.default.writeFile(_envPath, _envContent, "utf-8");
|
|
37018
37308
|
return this.success("Environment template generated successfully", {
|
|
37019
37309
|
files: [".env.local"],
|
|
@@ -37087,8 +37377,8 @@ var init_ConfigurationCommandService = __esm({
|
|
|
37087
37377
|
var DIR, FILE, QuickPersistence;
|
|
37088
37378
|
var init_quick_persistence = __esm({
|
|
37089
37379
|
"src/services/memory-system/quick-persistence.ts"() {
|
|
37090
|
-
DIR =
|
|
37091
|
-
FILE =
|
|
37380
|
+
DIR = path58__namespace.join(os16__namespace.homedir(), ".maria", "memory");
|
|
37381
|
+
FILE = path58__namespace.join(DIR, "memories.jsonl");
|
|
37092
37382
|
QuickPersistence = class {
|
|
37093
37383
|
static async init() {
|
|
37094
37384
|
await fsp__namespace.mkdir(DIR, { recursive: true });
|
|
@@ -37210,8 +37500,8 @@ var init_quick_persistence = __esm({
|
|
|
37210
37500
|
const mine = rows.filter((r2) => r2.userId === userId);
|
|
37211
37501
|
const timestamp2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
37212
37502
|
const filename = `maria-memory-export-${timestamp2}.${format}`;
|
|
37213
|
-
const exportDir =
|
|
37214
|
-
const exportPath =
|
|
37503
|
+
const exportDir = path58__namespace.join(os16__namespace.homedir(), ".maria", "exports");
|
|
37504
|
+
const exportPath = path58__namespace.join(exportDir, filename);
|
|
37215
37505
|
await fsp__namespace.mkdir(exportDir, { recursive: true });
|
|
37216
37506
|
if (format === "jsonl") {
|
|
37217
37507
|
await fsp__namespace.writeFile(
|
|
@@ -39845,7 +40135,7 @@ var init_StateManager = __esm({
|
|
|
39845
40135
|
maxCheckpointAge = 7 * 24 * 60 * 60 * 1e3;
|
|
39846
40136
|
// 7 days
|
|
39847
40137
|
constructor() {
|
|
39848
|
-
this.checkpointsDir =
|
|
40138
|
+
this.checkpointsDir = path58__namespace.join(os16__namespace.homedir(), ".maria", "checkpoints");
|
|
39849
40139
|
}
|
|
39850
40140
|
/**
|
|
39851
40141
|
* Initialize checkpoints directory
|
|
@@ -39871,7 +40161,7 @@ var init_StateManager = __esm({
|
|
|
39871
40161
|
const checkpointId = `${planId}_${Date.now()}`;
|
|
39872
40162
|
const timestamp2 = Date.now();
|
|
39873
40163
|
try {
|
|
39874
|
-
const checkpointPath =
|
|
40164
|
+
const checkpointPath = path58__namespace.join(this.checkpointsDir, checkpointId);
|
|
39875
40165
|
await fsp__namespace.mkdir(checkpointPath, { recursive: true });
|
|
39876
40166
|
const backups = await this.createBackups(actions, checkpointPath);
|
|
39877
40167
|
const configSnapshots = await this.createConfigSnapshots(
|
|
@@ -39890,7 +40180,7 @@ var init_StateManager = __esm({
|
|
|
39890
40180
|
riskScore
|
|
39891
40181
|
}
|
|
39892
40182
|
};
|
|
39893
|
-
const metadataPath =
|
|
40183
|
+
const metadataPath = path58__namespace.join(checkpointPath, "checkpoint.json");
|
|
39894
40184
|
await fsp__namespace.writeFile(
|
|
39895
40185
|
metadataPath,
|
|
39896
40186
|
JSON.stringify(checkpoint, null, 2),
|
|
@@ -40062,7 +40352,7 @@ var init_StateManager = __esm({
|
|
|
40062
40352
|
*/
|
|
40063
40353
|
async removeCheckpoint(checkpointId) {
|
|
40064
40354
|
try {
|
|
40065
|
-
const checkpointPath =
|
|
40355
|
+
const checkpointPath = path58__namespace.join(this.checkpointsDir, checkpointId);
|
|
40066
40356
|
await fsp__namespace.rm(checkpointPath, { recursive: true, force: true });
|
|
40067
40357
|
logger.info(`StateManager: Removed checkpoint ${checkpointId}`);
|
|
40068
40358
|
return true;
|
|
@@ -40093,7 +40383,7 @@ var init_StateManager = __esm({
|
|
|
40093
40383
|
*/
|
|
40094
40384
|
async createBackups(actions, checkpointPath) {
|
|
40095
40385
|
const backups = [];
|
|
40096
|
-
const backupDir =
|
|
40386
|
+
const backupDir = path58__namespace.join(checkpointPath, "backups");
|
|
40097
40387
|
await fsp__namespace.mkdir(backupDir, { recursive: true });
|
|
40098
40388
|
for (const action of actions) {
|
|
40099
40389
|
const filesToBackup = this.extractFilePathsFromAction(action);
|
|
@@ -40102,7 +40392,7 @@ var init_StateManager = __esm({
|
|
|
40102
40392
|
const resolvedPath = this.resolvePath(filePath);
|
|
40103
40393
|
const stats = await fsp__namespace.stat(resolvedPath);
|
|
40104
40394
|
const backupFileName = this.sanitizeFileName(resolvedPath);
|
|
40105
|
-
const backupPath =
|
|
40395
|
+
const backupPath = path58__namespace.join(backupDir, backupFileName);
|
|
40106
40396
|
await fsp__namespace.copyFile(resolvedPath, backupPath);
|
|
40107
40397
|
backups.push({
|
|
40108
40398
|
originalPath: resolvedPath,
|
|
@@ -40125,7 +40415,7 @@ var init_StateManager = __esm({
|
|
|
40125
40415
|
*/
|
|
40126
40416
|
async createConfigSnapshots(actions, checkpointPath) {
|
|
40127
40417
|
const snapshots = [];
|
|
40128
|
-
const configDir =
|
|
40418
|
+
const configDir = path58__namespace.join(checkpointPath, "configs");
|
|
40129
40419
|
await fsp__namespace.mkdir(configDir, { recursive: true });
|
|
40130
40420
|
const configPaths = /* @__PURE__ */ new Set();
|
|
40131
40421
|
for (const action of actions) {
|
|
@@ -40158,7 +40448,7 @@ var init_StateManager = __esm({
|
|
|
40158
40448
|
* Load checkpoint from disk
|
|
40159
40449
|
*/
|
|
40160
40450
|
async loadCheckpoint(checkpointId) {
|
|
40161
|
-
const metadataPath =
|
|
40451
|
+
const metadataPath = path58__namespace.join(
|
|
40162
40452
|
this.checkpointsDir,
|
|
40163
40453
|
checkpointId,
|
|
40164
40454
|
"checkpoint.json"
|
|
@@ -40184,9 +40474,9 @@ var init_StateManager = __esm({
|
|
|
40184
40474
|
*/
|
|
40185
40475
|
resolvePath(filePath) {
|
|
40186
40476
|
if (filePath.startsWith("~/")) {
|
|
40187
|
-
return
|
|
40477
|
+
return path58__namespace.join(os16__namespace.homedir(), filePath.slice(2));
|
|
40188
40478
|
}
|
|
40189
|
-
return
|
|
40479
|
+
return path58__namespace.resolve(filePath);
|
|
40190
40480
|
}
|
|
40191
40481
|
/**
|
|
40192
40482
|
* Sanitize filename for backup storage
|
|
@@ -40250,7 +40540,7 @@ var init_StateManager = __esm({
|
|
|
40250
40540
|
} catch {
|
|
40251
40541
|
}
|
|
40252
40542
|
} else {
|
|
40253
|
-
await fsp__namespace.mkdir(
|
|
40543
|
+
await fsp__namespace.mkdir(path58__namespace.dirname(config2.configPath), { recursive: true });
|
|
40254
40544
|
await fsp__namespace.writeFile(config2.configPath, config2.content, "utf-8");
|
|
40255
40545
|
}
|
|
40256
40546
|
logger.debug(`StateManager: Restored config ${config2.configPath}`);
|
|
@@ -40368,9 +40658,9 @@ var init_SafetyGuard = __esm({
|
|
|
40368
40658
|
}
|
|
40369
40659
|
}
|
|
40370
40660
|
if (action.args.paths && Array.isArray(action.args.paths)) {
|
|
40371
|
-
for (const
|
|
40372
|
-
if (!this.validatePath(
|
|
40373
|
-
violations.push(`Invalid path: ${
|
|
40661
|
+
for (const path59 of action.args.paths) {
|
|
40662
|
+
if (!this.validatePath(path59)) {
|
|
40663
|
+
violations.push(`Invalid path: ${path59}`);
|
|
40374
40664
|
}
|
|
40375
40665
|
}
|
|
40376
40666
|
}
|
|
@@ -40426,15 +40716,15 @@ var init_SafetyGuard = __esm({
|
|
|
40426
40716
|
* Validate file path against allowed/blocked lists
|
|
40427
40717
|
*/
|
|
40428
40718
|
validatePath(filePath) {
|
|
40429
|
-
const
|
|
40430
|
-
const resolvedPath =
|
|
40719
|
+
const path59 = __require("path");
|
|
40720
|
+
const resolvedPath = path59.resolve(filePath);
|
|
40431
40721
|
for (const blockedPath of this.constraints.blockedPaths) {
|
|
40432
|
-
if (resolvedPath.startsWith(
|
|
40722
|
+
if (resolvedPath.startsWith(path59.resolve(blockedPath))) {
|
|
40433
40723
|
return false;
|
|
40434
40724
|
}
|
|
40435
40725
|
}
|
|
40436
40726
|
for (const allowedPath of this.constraints.allowedPaths) {
|
|
40437
|
-
if (resolvedPath.startsWith(
|
|
40727
|
+
if (resolvedPath.startsWith(path59.resolve(allowedPath))) {
|
|
40438
40728
|
return true;
|
|
40439
40729
|
}
|
|
40440
40730
|
}
|
|
@@ -40463,9 +40753,9 @@ var init_SafetyGuard = __esm({
|
|
|
40463
40753
|
violations.push(`Invalid path in ${action.type}: ${action.args.path}`);
|
|
40464
40754
|
}
|
|
40465
40755
|
if (action.args.paths && Array.isArray(action.args.paths)) {
|
|
40466
|
-
for (const
|
|
40467
|
-
if (!this.validatePath(
|
|
40468
|
-
violations.push(`Invalid path in ${action.type}: ${
|
|
40756
|
+
for (const path59 of action.args.paths) {
|
|
40757
|
+
if (!this.validatePath(path59)) {
|
|
40758
|
+
violations.push(`Invalid path in ${action.type}: ${path59}`);
|
|
40469
40759
|
}
|
|
40470
40760
|
}
|
|
40471
40761
|
}
|
|
@@ -40564,7 +40854,7 @@ var init_AuditLogger = __esm({
|
|
|
40564
40854
|
constructor(sessionId, options = {}) {
|
|
40565
40855
|
this.sessionId = sessionId;
|
|
40566
40856
|
this.options = {
|
|
40567
|
-
logDir:
|
|
40857
|
+
logDir: path58__namespace.join(os16__namespace.homedir(), ".maria", "audit"),
|
|
40568
40858
|
maxLogSize: 10 * 1024 * 1024,
|
|
40569
40859
|
// 10MB
|
|
40570
40860
|
maxLogFiles: 30,
|
|
@@ -40574,7 +40864,7 @@ var init_AuditLogger = __esm({
|
|
|
40574
40864
|
...options
|
|
40575
40865
|
};
|
|
40576
40866
|
const date = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
40577
|
-
this.logFilePath =
|
|
40867
|
+
this.logFilePath = path58__namespace.join(this.options.logDir, `audit-${date}.jsonl`);
|
|
40578
40868
|
}
|
|
40579
40869
|
/**
|
|
40580
40870
|
* Initialize audit logging
|
|
@@ -40863,7 +41153,7 @@ var init_AuditLogger = __esm({
|
|
|
40863
41153
|
try {
|
|
40864
41154
|
const date = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
40865
41155
|
const timestamp2 = Date.now();
|
|
40866
|
-
const archivePath =
|
|
41156
|
+
const archivePath = path58__namespace.join(
|
|
40867
41157
|
this.options.logDir,
|
|
40868
41158
|
`audit-${date}-${timestamp2}.jsonl`
|
|
40869
41159
|
);
|
|
@@ -40903,7 +41193,7 @@ var init_AuditLogger = __esm({
|
|
|
40903
41193
|
if (logFiles.length > this.options.maxLogFiles) {
|
|
40904
41194
|
const toRemove = logFiles.slice(this.options.maxLogFiles);
|
|
40905
41195
|
for (const file of toRemove) {
|
|
40906
|
-
const filePath =
|
|
41196
|
+
const filePath = path58__namespace.join(this.options.logDir, file);
|
|
40907
41197
|
await fsp__namespace.unlink(filePath);
|
|
40908
41198
|
logger.debug(`AuditLogger: Removed old log file ${file}`);
|
|
40909
41199
|
}
|
|
@@ -40945,7 +41235,7 @@ var init_FileActionExecutor = __esm({
|
|
|
40945
41235
|
FileActionExecutor = class {
|
|
40946
41236
|
ALLOWED_PATHS = [
|
|
40947
41237
|
process.cwd(),
|
|
40948
|
-
|
|
41238
|
+
path58__namespace.join(os16__namespace.homedir(), ".maria")
|
|
40949
41239
|
];
|
|
40950
41240
|
/**
|
|
40951
41241
|
* Execute file action
|
|
@@ -41007,7 +41297,7 @@ var init_FileActionExecutor = __esm({
|
|
|
41007
41297
|
await fsp__namespace.access(resolvedPath);
|
|
41008
41298
|
return { action: "already_exists", path: resolvedPath };
|
|
41009
41299
|
} catch {
|
|
41010
|
-
await fsp__namespace.mkdir(
|
|
41300
|
+
await fsp__namespace.mkdir(path58__namespace.dirname(resolvedPath), { recursive: true });
|
|
41011
41301
|
await fsp__namespace.writeFile(resolvedPath, "", "utf-8");
|
|
41012
41302
|
logger.info(`Created file: ${resolvedPath}`);
|
|
41013
41303
|
return { action: "created", path: resolvedPath };
|
|
@@ -41224,20 +41514,20 @@ var init_FileActionExecutor = __esm({
|
|
|
41224
41514
|
*/
|
|
41225
41515
|
resolvePath(filePath) {
|
|
41226
41516
|
if (filePath.startsWith("~/")) {
|
|
41227
|
-
return
|
|
41517
|
+
return path58__namespace.join(os16__namespace.homedir(), filePath.slice(2));
|
|
41228
41518
|
}
|
|
41229
|
-
if (
|
|
41519
|
+
if (path58__namespace.isAbsolute(filePath)) {
|
|
41230
41520
|
return filePath;
|
|
41231
41521
|
}
|
|
41232
|
-
return
|
|
41522
|
+
return path58__namespace.resolve(process.cwd(), filePath);
|
|
41233
41523
|
}
|
|
41234
41524
|
/**
|
|
41235
41525
|
* Validate path is within allowed directories
|
|
41236
41526
|
*/
|
|
41237
41527
|
validatePath(filePath) {
|
|
41238
|
-
const resolvedPath =
|
|
41528
|
+
const resolvedPath = path58__namespace.resolve(filePath);
|
|
41239
41529
|
for (const allowedPath of this.ALLOWED_PATHS) {
|
|
41240
|
-
const allowedResolved =
|
|
41530
|
+
const allowedResolved = path58__namespace.resolve(allowedPath);
|
|
41241
41531
|
if (resolvedPath.startsWith(allowedResolved)) {
|
|
41242
41532
|
return;
|
|
41243
41533
|
}
|
|
@@ -41252,7 +41542,7 @@ var init_ConfigActionExecutor = __esm({
|
|
|
41252
41542
|
"src/services/self-healing/executors/ConfigActionExecutor.ts"() {
|
|
41253
41543
|
init_logger();
|
|
41254
41544
|
ConfigActionExecutor = class {
|
|
41255
|
-
DEFAULT_CONFIG_PATH =
|
|
41545
|
+
DEFAULT_CONFIG_PATH = path58__namespace.join(
|
|
41256
41546
|
os16__namespace.homedir(),
|
|
41257
41547
|
".maria",
|
|
41258
41548
|
"config.json"
|
|
@@ -41299,7 +41589,7 @@ var init_ConfigActionExecutor = __esm({
|
|
|
41299
41589
|
};
|
|
41300
41590
|
}
|
|
41301
41591
|
try {
|
|
41302
|
-
await fsp__namespace.mkdir(
|
|
41592
|
+
await fsp__namespace.mkdir(path58__namespace.dirname(resolvedPath), { recursive: true });
|
|
41303
41593
|
let config2 = {};
|
|
41304
41594
|
try {
|
|
41305
41595
|
const content = await fsp__namespace.readFile(resolvedPath, "utf-8");
|
|
@@ -41334,7 +41624,7 @@ var init_ConfigActionExecutor = __esm({
|
|
|
41334
41624
|
};
|
|
41335
41625
|
}
|
|
41336
41626
|
try {
|
|
41337
|
-
await fsp__namespace.mkdir(
|
|
41627
|
+
await fsp__namespace.mkdir(path58__namespace.dirname(resolvedPath), { recursive: true });
|
|
41338
41628
|
let config2 = {};
|
|
41339
41629
|
try {
|
|
41340
41630
|
const content = await fsp__namespace.readFile(resolvedPath, "utf-8");
|
|
@@ -41434,8 +41724,8 @@ var init_ConfigActionExecutor = __esm({
|
|
|
41434
41724
|
/**
|
|
41435
41725
|
* Set nested configuration value using dot notation
|
|
41436
41726
|
*/
|
|
41437
|
-
setNestedValue(obj,
|
|
41438
|
-
const keys =
|
|
41727
|
+
setNestedValue(obj, path59, value) {
|
|
41728
|
+
const keys = path59.split(".");
|
|
41439
41729
|
let current = obj;
|
|
41440
41730
|
for (let i2 = 0; i2 < keys.length - 1; i2++) {
|
|
41441
41731
|
const key = keys[i2];
|
|
@@ -41452,9 +41742,9 @@ var init_ConfigActionExecutor = __esm({
|
|
|
41452
41742
|
resolveConfigPath(configPath) {
|
|
41453
41743
|
if (configPath) {
|
|
41454
41744
|
if (configPath.startsWith("~/")) {
|
|
41455
|
-
return
|
|
41745
|
+
return path58__namespace.join(os16__namespace.homedir(), configPath.slice(2));
|
|
41456
41746
|
}
|
|
41457
|
-
return
|
|
41747
|
+
return path58__namespace.resolve(configPath);
|
|
41458
41748
|
}
|
|
41459
41749
|
return this.DEFAULT_CONFIG_PATH;
|
|
41460
41750
|
}
|
|
@@ -41467,10 +41757,10 @@ var init_CacheActionExecutor = __esm({
|
|
|
41467
41757
|
init_logger();
|
|
41468
41758
|
CacheActionExecutor = class {
|
|
41469
41759
|
CACHE_PATHS = [
|
|
41470
|
-
|
|
41471
|
-
|
|
41472
|
-
|
|
41473
|
-
|
|
41760
|
+
path58__namespace.join(os16__namespace.homedir(), ".maria", "cache"),
|
|
41761
|
+
path58__namespace.join(process.cwd(), ".turbo"),
|
|
41762
|
+
path58__namespace.join(process.cwd(), ".cache", "maria"),
|
|
41763
|
+
path58__namespace.join(process.cwd(), "node_modules", ".cache")
|
|
41474
41764
|
];
|
|
41475
41765
|
/**
|
|
41476
41766
|
* Execute cache action
|
|
@@ -41651,10 +41941,10 @@ var init_CacheActionExecutor = __esm({
|
|
|
41651
41941
|
* Warmup specific target
|
|
41652
41942
|
*/
|
|
41653
41943
|
async warmupTarget(target) {
|
|
41654
|
-
const cacheDir =
|
|
41944
|
+
const cacheDir = path58__namespace.join(os16__namespace.homedir(), ".maria", "cache");
|
|
41655
41945
|
switch (target) {
|
|
41656
41946
|
case "models:list":
|
|
41657
|
-
const modelsDir =
|
|
41947
|
+
const modelsDir = path58__namespace.join(cacheDir, "models");
|
|
41658
41948
|
await fsp__namespace.mkdir(modelsDir, { recursive: true });
|
|
41659
41949
|
const modelsData = {
|
|
41660
41950
|
timestamp: Date.now(),
|
|
@@ -41665,12 +41955,12 @@ var init_CacheActionExecutor = __esm({
|
|
|
41665
41955
|
]
|
|
41666
41956
|
};
|
|
41667
41957
|
await fsp__namespace.writeFile(
|
|
41668
|
-
|
|
41958
|
+
path58__namespace.join(modelsDir, "available.json"),
|
|
41669
41959
|
JSON.stringify(modelsData, null, 2)
|
|
41670
41960
|
);
|
|
41671
41961
|
return { itemsCreated: 1, size: JSON.stringify(modelsData).length };
|
|
41672
41962
|
case "aliases":
|
|
41673
|
-
const aliasesDir =
|
|
41963
|
+
const aliasesDir = path58__namespace.join(cacheDir, "aliases");
|
|
41674
41964
|
await fsp__namespace.mkdir(aliasesDir, { recursive: true });
|
|
41675
41965
|
const aliasesData = {
|
|
41676
41966
|
timestamp: Date.now(),
|
|
@@ -41681,12 +41971,12 @@ var init_CacheActionExecutor = __esm({
|
|
|
41681
41971
|
}
|
|
41682
41972
|
};
|
|
41683
41973
|
await fsp__namespace.writeFile(
|
|
41684
|
-
|
|
41974
|
+
path58__namespace.join(aliasesDir, "model-aliases.json"),
|
|
41685
41975
|
JSON.stringify(aliasesData, null, 2)
|
|
41686
41976
|
);
|
|
41687
41977
|
return { itemsCreated: 1, size: JSON.stringify(aliasesData).length };
|
|
41688
41978
|
case "templates":
|
|
41689
|
-
const templatesDir =
|
|
41979
|
+
const templatesDir = path58__namespace.join(cacheDir, "templates");
|
|
41690
41980
|
await fsp__namespace.mkdir(templatesDir, { recursive: true });
|
|
41691
41981
|
const templatesData = {
|
|
41692
41982
|
timestamp: Date.now(),
|
|
@@ -41697,7 +41987,7 @@ var init_CacheActionExecutor = __esm({
|
|
|
41697
41987
|
}
|
|
41698
41988
|
};
|
|
41699
41989
|
await fsp__namespace.writeFile(
|
|
41700
|
-
|
|
41990
|
+
path58__namespace.join(templatesDir, "prompt-templates.json"),
|
|
41701
41991
|
JSON.stringify(templatesData, null, 2)
|
|
41702
41992
|
);
|
|
41703
41993
|
return { itemsCreated: 1, size: JSON.stringify(templatesData).length };
|
|
@@ -41743,7 +42033,7 @@ var init_CacheActionExecutor = __esm({
|
|
|
41743
42033
|
try {
|
|
41744
42034
|
const entries = await fsp__namespace.readdir(dirPath, { withFileTypes: true });
|
|
41745
42035
|
for (const entry of entries) {
|
|
41746
|
-
const entryPath =
|
|
42036
|
+
const entryPath = path58__namespace.join(dirPath, entry.name);
|
|
41747
42037
|
if (entry.isDirectory()) {
|
|
41748
42038
|
totalSize += await this.getDirectorySize(entryPath);
|
|
41749
42039
|
} else {
|
|
@@ -41764,7 +42054,7 @@ var init_CacheActionExecutor = __esm({
|
|
|
41764
42054
|
const entries = await fsp__namespace.readdir(dirPath, { withFileTypes: true });
|
|
41765
42055
|
for (const entry of entries) {
|
|
41766
42056
|
if (entry.isDirectory()) {
|
|
41767
|
-
const entryPath =
|
|
42057
|
+
const entryPath = path58__namespace.join(dirPath, entry.name);
|
|
41768
42058
|
count += await this.countFiles(entryPath);
|
|
41769
42059
|
} else {
|
|
41770
42060
|
count++;
|
|
@@ -41792,12 +42082,12 @@ var init_CacheActionExecutor = __esm({
|
|
|
41792
42082
|
*/
|
|
41793
42083
|
resolvePath(cachePath) {
|
|
41794
42084
|
if (cachePath.startsWith("~/")) {
|
|
41795
|
-
return
|
|
42085
|
+
return path58__namespace.join(os16__namespace.homedir(), cachePath.slice(2));
|
|
41796
42086
|
}
|
|
41797
|
-
if (
|
|
42087
|
+
if (path58__namespace.isAbsolute(cachePath)) {
|
|
41798
42088
|
return cachePath;
|
|
41799
42089
|
}
|
|
41800
|
-
return
|
|
42090
|
+
return path58__namespace.resolve(process.cwd(), cachePath);
|
|
41801
42091
|
}
|
|
41802
42092
|
};
|
|
41803
42093
|
}
|
|
@@ -42070,7 +42360,7 @@ var init_SelfHealingService = __esm({
|
|
|
42070
42360
|
const timestamp2 = /* @__PURE__ */ new Date();
|
|
42071
42361
|
await this.auditLogger.logDiagnosis("started", { diagnostics: context2 });
|
|
42072
42362
|
try {
|
|
42073
|
-
const envPath =
|
|
42363
|
+
const envPath = path58__namespace.join(context2.cwd, ".env.local");
|
|
42074
42364
|
try {
|
|
42075
42365
|
await fsp__namespace.access(envPath);
|
|
42076
42366
|
} catch {
|
|
@@ -42085,7 +42375,7 @@ var init_SelfHealingService = __esm({
|
|
|
42085
42375
|
suggestion: "Create .env.local with API keys template"
|
|
42086
42376
|
});
|
|
42087
42377
|
}
|
|
42088
|
-
const nodeModulesPath =
|
|
42378
|
+
const nodeModulesPath = path58__namespace.join(context2.cwd, "node_modules");
|
|
42089
42379
|
try {
|
|
42090
42380
|
await fsp__namespace.access(nodeModulesPath);
|
|
42091
42381
|
} catch {
|
|
@@ -42100,7 +42390,7 @@ var init_SelfHealingService = __esm({
|
|
|
42100
42390
|
suggestion: "Run package manager install command"
|
|
42101
42391
|
});
|
|
42102
42392
|
}
|
|
42103
|
-
const cachePath =
|
|
42393
|
+
const cachePath = path58__namespace.join(process.env.HOME || "", ".maria", "cache");
|
|
42104
42394
|
try {
|
|
42105
42395
|
const stats = await fsp__namespace.stat(cachePath);
|
|
42106
42396
|
if (stats.size > 100 * 1024 * 1024) {
|
|
@@ -42482,7 +42772,7 @@ __export(cli_style_exports, {
|
|
|
42482
42772
|
});
|
|
42483
42773
|
async function tryReadModelFromManifest(root, manifestRel) {
|
|
42484
42774
|
try {
|
|
42485
|
-
const full =
|
|
42775
|
+
const full = path58__namespace.resolve(root, manifestRel);
|
|
42486
42776
|
const text = await fsp__namespace.readFile(full, "utf8");
|
|
42487
42777
|
const json2 = JSON.parse(text);
|
|
42488
42778
|
const model = json2?.request?.model;
|
|
@@ -42499,7 +42789,7 @@ function formatArtifacts(files, limit = 10) {
|
|
|
42499
42789
|
return lines;
|
|
42500
42790
|
}
|
|
42501
42791
|
function artifactsRootDir(manifestPath) {
|
|
42502
|
-
return
|
|
42792
|
+
return path58__namespace.posix.dirname(manifestPath);
|
|
42503
42793
|
}
|
|
42504
42794
|
async function formatImageOutput(root, opts) {
|
|
42505
42795
|
const model = opts.model || await tryReadModelFromManifest(root, opts.manifestPath) || "auto";
|
|
@@ -42839,7 +43129,7 @@ function createConfigCheck() {
|
|
|
42839
43129
|
runsIn: "read-only",
|
|
42840
43130
|
estimateMs: 20,
|
|
42841
43131
|
async run(ctx2) {
|
|
42842
|
-
const pkgPath =
|
|
43132
|
+
const pkgPath = path58.resolve(ctx2.cwd, "package.json");
|
|
42843
43133
|
try {
|
|
42844
43134
|
const raw = await fsp.readFile(pkgPath, "utf-8");
|
|
42845
43135
|
const pkg = JSON.parse(raw);
|
|
@@ -42908,7 +43198,7 @@ function createDependenciesCheck() {
|
|
|
42908
43198
|
runsIn: "read-only",
|
|
42909
43199
|
estimateMs: 25,
|
|
42910
43200
|
async run(ctx2) {
|
|
42911
|
-
const nm =
|
|
43201
|
+
const nm = path58.resolve(ctx2.cwd, "node_modules");
|
|
42912
43202
|
try {
|
|
42913
43203
|
const s2 = await fsp.stat(nm);
|
|
42914
43204
|
if (!s2.isDirectory()) {
|
|
@@ -43003,7 +43293,7 @@ function createGitRepoCheck() {
|
|
|
43003
43293
|
runsIn: "read-only",
|
|
43004
43294
|
estimateMs: 10,
|
|
43005
43295
|
async run(ctx2) {
|
|
43006
|
-
const dotgit =
|
|
43296
|
+
const dotgit = path58.resolve(ctx2.cwd, ".git");
|
|
43007
43297
|
try {
|
|
43008
43298
|
await fsp.access(dotgit);
|
|
43009
43299
|
return { name: "Git Repository", category: "config", status: "pass", message: "Git repo detected" };
|
|
@@ -43089,9 +43379,9 @@ function createProvidersSecretConfigCheck() {
|
|
|
43089
43379
|
groq: !!process.env.GROQ_API_KEY
|
|
43090
43380
|
};
|
|
43091
43381
|
const candidates = [
|
|
43092
|
-
|
|
43093
|
-
|
|
43094
|
-
|
|
43382
|
+
path58.resolve(ctx2.cwd, ".maria/secrets.local.json"),
|
|
43383
|
+
path58.resolve(ctx2.cwd, "secrets/local.json"),
|
|
43384
|
+
path58.resolve(ctx2.cwd, ".secrets.local.json")
|
|
43095
43385
|
];
|
|
43096
43386
|
let fileCfg = null;
|
|
43097
43387
|
for (const p of candidates) {
|
|
@@ -43163,8 +43453,8 @@ async function applyPlans(plans, opts) {
|
|
|
43163
43453
|
try {
|
|
43164
43454
|
for (const plan of plans) {
|
|
43165
43455
|
if (opts.signal?.aborted) throw abortErr();
|
|
43166
|
-
const target =
|
|
43167
|
-
const dir =
|
|
43456
|
+
const target = path58__namespace.default.join(opts.root, plan.path);
|
|
43457
|
+
const dir = path58__namespace.default.dirname(target);
|
|
43168
43458
|
await fs24.promises.mkdir(dir, { recursive: true });
|
|
43169
43459
|
const exists = await fileExists(target);
|
|
43170
43460
|
const perFileAllowed = plan.overwritePolicy === "allow";
|
|
@@ -43193,7 +43483,7 @@ async function applyPlans(plans, opts) {
|
|
|
43193
43483
|
if (opts.rollback) {
|
|
43194
43484
|
for (const rel of created) {
|
|
43195
43485
|
try {
|
|
43196
|
-
await fs24.promises.unlink(
|
|
43486
|
+
await fs24.promises.unlink(path58__namespace.default.join(opts.root, rel));
|
|
43197
43487
|
} catch {
|
|
43198
43488
|
}
|
|
43199
43489
|
}
|
|
@@ -43314,7 +43604,7 @@ async function applyFixes(plans, opts) {
|
|
|
43314
43604
|
continue;
|
|
43315
43605
|
}
|
|
43316
43606
|
if (plan.action === "file.create") {
|
|
43317
|
-
const full =
|
|
43607
|
+
const full = path58.resolve(opts.cwd, plan.path);
|
|
43318
43608
|
try {
|
|
43319
43609
|
await fsp.access(full);
|
|
43320
43610
|
results.push({ plan, status: "skipped", message: "File exists" });
|
|
@@ -43327,7 +43617,7 @@ async function applyFixes(plans, opts) {
|
|
|
43327
43617
|
continue;
|
|
43328
43618
|
}
|
|
43329
43619
|
if (plan.action === "file.modify") {
|
|
43330
|
-
const full =
|
|
43620
|
+
const full = path58.resolve(opts.cwd, plan.path);
|
|
43331
43621
|
const st = await fsp.stat(full).catch(() => null);
|
|
43332
43622
|
if (!st) {
|
|
43333
43623
|
await ensureDir(full);
|
|
@@ -43344,7 +43634,7 @@ ${plan.diff ?? plan.content ?? ""}`;
|
|
|
43344
43634
|
continue;
|
|
43345
43635
|
}
|
|
43346
43636
|
if (plan.action === "file.json-merge") {
|
|
43347
|
-
const full =
|
|
43637
|
+
const full = path58.resolve(opts.cwd, plan.path);
|
|
43348
43638
|
const raw = await readFileSafe(full);
|
|
43349
43639
|
let json2 = {};
|
|
43350
43640
|
if (raw) {
|
|
@@ -43379,14 +43669,14 @@ function validatePath2(rel, cwd2) {
|
|
|
43379
43669
|
if (rel.includes("..")) return { valid: false, reason: "path traversal" };
|
|
43380
43670
|
if (rel.startsWith("/") || rel.includes("\\")) return { valid: false, reason: "absolute or backslashes not allowed" };
|
|
43381
43671
|
if (rel.startsWith(".env") || rel.endsWith(".pem") || rel.endsWith("id_rsa")) return { valid: false, reason: "sensitive path" };
|
|
43382
|
-
const full =
|
|
43383
|
-
const normCwd =
|
|
43384
|
-
const normFull =
|
|
43672
|
+
const full = path58.resolve(cwd2, rel);
|
|
43673
|
+
const normCwd = path58.normalize(cwd2) + path58.sep;
|
|
43674
|
+
const normFull = path58.normalize(full);
|
|
43385
43675
|
if (!normFull.startsWith(normCwd)) return { valid: false, reason: "outside cwd" };
|
|
43386
43676
|
return { valid: true };
|
|
43387
43677
|
}
|
|
43388
43678
|
async function ensureDir(fullPath) {
|
|
43389
|
-
const i2 = fullPath.lastIndexOf(
|
|
43679
|
+
const i2 = fullPath.lastIndexOf(path58.sep);
|
|
43390
43680
|
if (i2 <= 0) return;
|
|
43391
43681
|
const dir = fullPath.slice(0, i2);
|
|
43392
43682
|
try {
|
|
@@ -47508,12 +47798,12 @@ var init_esm4 = __esm({
|
|
|
47508
47798
|
/**
|
|
47509
47799
|
* Get the Path object referenced by the string path, resolved from this Path
|
|
47510
47800
|
*/
|
|
47511
|
-
resolve(
|
|
47512
|
-
if (!
|
|
47801
|
+
resolve(path59) {
|
|
47802
|
+
if (!path59) {
|
|
47513
47803
|
return this;
|
|
47514
47804
|
}
|
|
47515
|
-
const rootPath = this.getRootString(
|
|
47516
|
-
const dir =
|
|
47805
|
+
const rootPath = this.getRootString(path59);
|
|
47806
|
+
const dir = path59.substring(rootPath.length);
|
|
47517
47807
|
const dirParts = dir.split(this.splitSep);
|
|
47518
47808
|
const result = rootPath ? this.getRoot(rootPath).#resolveParts(dirParts) : this.#resolveParts(dirParts);
|
|
47519
47809
|
return result;
|
|
@@ -48265,8 +48555,8 @@ var init_esm4 = __esm({
|
|
|
48265
48555
|
/**
|
|
48266
48556
|
* @internal
|
|
48267
48557
|
*/
|
|
48268
|
-
getRootString(
|
|
48269
|
-
return
|
|
48558
|
+
getRootString(path59) {
|
|
48559
|
+
return path58.win32.parse(path59).root;
|
|
48270
48560
|
}
|
|
48271
48561
|
/**
|
|
48272
48562
|
* @internal
|
|
@@ -48312,8 +48602,8 @@ var init_esm4 = __esm({
|
|
|
48312
48602
|
/**
|
|
48313
48603
|
* @internal
|
|
48314
48604
|
*/
|
|
48315
|
-
getRootString(
|
|
48316
|
-
return
|
|
48605
|
+
getRootString(path59) {
|
|
48606
|
+
return path59.startsWith("/") ? "/" : "";
|
|
48317
48607
|
}
|
|
48318
48608
|
/**
|
|
48319
48609
|
* @internal
|
|
@@ -48402,11 +48692,11 @@ var init_esm4 = __esm({
|
|
|
48402
48692
|
/**
|
|
48403
48693
|
* Get the depth of a provided path, string, or the cwd
|
|
48404
48694
|
*/
|
|
48405
|
-
depth(
|
|
48406
|
-
if (typeof
|
|
48407
|
-
|
|
48695
|
+
depth(path59 = this.cwd) {
|
|
48696
|
+
if (typeof path59 === "string") {
|
|
48697
|
+
path59 = this.cwd.resolve(path59);
|
|
48408
48698
|
}
|
|
48409
|
-
return
|
|
48699
|
+
return path59.depth();
|
|
48410
48700
|
}
|
|
48411
48701
|
/**
|
|
48412
48702
|
* Return the cache of child entries. Exposed so subclasses can create
|
|
@@ -48893,9 +49183,9 @@ var init_esm4 = __esm({
|
|
|
48893
49183
|
process11();
|
|
48894
49184
|
return results;
|
|
48895
49185
|
}
|
|
48896
|
-
chdir(
|
|
49186
|
+
chdir(path59 = this.cwd) {
|
|
48897
49187
|
const oldCwd = this.cwd;
|
|
48898
|
-
this.cwd = typeof
|
|
49188
|
+
this.cwd = typeof path59 === "string" ? this.cwd.resolve(path59) : path59;
|
|
48899
49189
|
this.cwd[setAsCwd](oldCwd);
|
|
48900
49190
|
}
|
|
48901
49191
|
};
|
|
@@ -48906,7 +49196,7 @@ var init_esm4 = __esm({
|
|
|
48906
49196
|
sep = "\\";
|
|
48907
49197
|
constructor(cwd2 = process.cwd(), opts = {}) {
|
|
48908
49198
|
const { nocase = true } = opts;
|
|
48909
|
-
super(cwd2,
|
|
49199
|
+
super(cwd2, path58.win32, "\\", { ...opts, nocase });
|
|
48910
49200
|
this.nocase = nocase;
|
|
48911
49201
|
for (let p = this.cwd; p; p = p.parent) {
|
|
48912
49202
|
p.nocase = this.nocase;
|
|
@@ -48916,7 +49206,7 @@ var init_esm4 = __esm({
|
|
|
48916
49206
|
* @internal
|
|
48917
49207
|
*/
|
|
48918
49208
|
parseRootPath(dir) {
|
|
48919
|
-
return
|
|
49209
|
+
return path58.win32.parse(dir).root.toUpperCase();
|
|
48920
49210
|
}
|
|
48921
49211
|
/**
|
|
48922
49212
|
* @internal
|
|
@@ -48938,7 +49228,7 @@ var init_esm4 = __esm({
|
|
|
48938
49228
|
sep = "/";
|
|
48939
49229
|
constructor(cwd2 = process.cwd(), opts = {}) {
|
|
48940
49230
|
const { nocase = false } = opts;
|
|
48941
|
-
super(cwd2,
|
|
49231
|
+
super(cwd2, path58.posix, "/", { ...opts, nocase });
|
|
48942
49232
|
this.nocase = nocase;
|
|
48943
49233
|
}
|
|
48944
49234
|
/**
|
|
@@ -49270,8 +49560,8 @@ var init_processor = __esm({
|
|
|
49270
49560
|
}
|
|
49271
49561
|
// match, absolute, ifdir
|
|
49272
49562
|
entries() {
|
|
49273
|
-
return [...this.store.entries()].map(([
|
|
49274
|
-
|
|
49563
|
+
return [...this.store.entries()].map(([path59, n]) => [
|
|
49564
|
+
path59,
|
|
49275
49565
|
!!(n & 2),
|
|
49276
49566
|
!!(n & 1)
|
|
49277
49567
|
]);
|
|
@@ -49484,9 +49774,9 @@ var init_walker = __esm({
|
|
|
49484
49774
|
signal;
|
|
49485
49775
|
maxDepth;
|
|
49486
49776
|
includeChildMatches;
|
|
49487
|
-
constructor(patterns,
|
|
49777
|
+
constructor(patterns, path59, opts) {
|
|
49488
49778
|
this.patterns = patterns;
|
|
49489
|
-
this.path =
|
|
49779
|
+
this.path = path59;
|
|
49490
49780
|
this.opts = opts;
|
|
49491
49781
|
this.#sep = !opts.posix && opts.platform === "win32" ? "\\" : "/";
|
|
49492
49782
|
this.includeChildMatches = opts.includeChildMatches !== false;
|
|
@@ -49505,11 +49795,11 @@ var init_walker = __esm({
|
|
|
49505
49795
|
});
|
|
49506
49796
|
}
|
|
49507
49797
|
}
|
|
49508
|
-
#ignored(
|
|
49509
|
-
return this.seen.has(
|
|
49798
|
+
#ignored(path59) {
|
|
49799
|
+
return this.seen.has(path59) || !!this.#ignore?.ignored?.(path59);
|
|
49510
49800
|
}
|
|
49511
|
-
#childrenIgnored(
|
|
49512
|
-
return !!this.#ignore?.childrenIgnored?.(
|
|
49801
|
+
#childrenIgnored(path59) {
|
|
49802
|
+
return !!this.#ignore?.childrenIgnored?.(path59);
|
|
49513
49803
|
}
|
|
49514
49804
|
// backpressure mechanism
|
|
49515
49805
|
pause() {
|
|
@@ -49724,8 +50014,8 @@ var init_walker = __esm({
|
|
|
49724
50014
|
};
|
|
49725
50015
|
GlobWalker = class extends GlobUtil {
|
|
49726
50016
|
matches = /* @__PURE__ */ new Set();
|
|
49727
|
-
constructor(patterns,
|
|
49728
|
-
super(patterns,
|
|
50017
|
+
constructor(patterns, path59, opts) {
|
|
50018
|
+
super(patterns, path59, opts);
|
|
49729
50019
|
}
|
|
49730
50020
|
matchEmit(e2) {
|
|
49731
50021
|
this.matches.add(e2);
|
|
@@ -49762,8 +50052,8 @@ var init_walker = __esm({
|
|
|
49762
50052
|
};
|
|
49763
50053
|
GlobStream = class extends GlobUtil {
|
|
49764
50054
|
results;
|
|
49765
|
-
constructor(patterns,
|
|
49766
|
-
super(patterns,
|
|
50055
|
+
constructor(patterns, path59, opts) {
|
|
50056
|
+
super(patterns, path59, opts);
|
|
49767
50057
|
this.results = new Minipass({
|
|
49768
50058
|
signal: this.signal,
|
|
49769
50059
|
objectMode: true
|
|
@@ -50312,7 +50602,7 @@ ${usageLine}`;
|
|
|
50312
50602
|
async autoRegister(directory) {
|
|
50313
50603
|
logger.info(`Auto-registering commands from ${directory}`);
|
|
50314
50604
|
try {
|
|
50315
|
-
const pattern =
|
|
50605
|
+
const pattern = path58__namespace.join(directory, "**/*.command.{ts,js}");
|
|
50316
50606
|
const files = await glob(pattern);
|
|
50317
50607
|
logger.info(`Found ${files.length} command files`);
|
|
50318
50608
|
for (const file of files) {
|
|
@@ -51017,7 +51307,7 @@ ${fixPlan.note}` : ""));
|
|
|
51017
51307
|
async runConfigurationChecks(context2) {
|
|
51018
51308
|
const checks = [];
|
|
51019
51309
|
const cwd2 = context2.environment?.cwd || process.cwd();
|
|
51020
|
-
const packageJsonPath =
|
|
51310
|
+
const packageJsonPath = path58__namespace.join(cwd2, "package.json");
|
|
51021
51311
|
try {
|
|
51022
51312
|
await fsp__namespace.access(packageJsonPath);
|
|
51023
51313
|
const content = await fsp__namespace.readFile(packageJsonPath, "utf-8");
|
|
@@ -51043,7 +51333,7 @@ ${fixPlan.note}` : ""));
|
|
|
51043
51333
|
fixable: true
|
|
51044
51334
|
});
|
|
51045
51335
|
}
|
|
51046
|
-
const envPath =
|
|
51336
|
+
const envPath = path58__namespace.join(cwd2, ".env.local");
|
|
51047
51337
|
try {
|
|
51048
51338
|
await fsp__namespace.access(envPath);
|
|
51049
51339
|
checks.push({
|
|
@@ -51061,7 +51351,7 @@ ${fixPlan.note}` : ""));
|
|
|
51061
51351
|
fixable: true
|
|
51062
51352
|
});
|
|
51063
51353
|
}
|
|
51064
|
-
const gitPath =
|
|
51354
|
+
const gitPath = path58__namespace.join(cwd2, ".git");
|
|
51065
51355
|
try {
|
|
51066
51356
|
await fsp__namespace.access(gitPath);
|
|
51067
51357
|
checks.push({
|
|
@@ -51085,7 +51375,7 @@ ${fixPlan.note}` : ""));
|
|
|
51085
51375
|
async runDependencyChecks(context2) {
|
|
51086
51376
|
const checks = [];
|
|
51087
51377
|
const cwd2 = context2.environment?.cwd || process.cwd();
|
|
51088
|
-
const nodeModulesPath =
|
|
51378
|
+
const nodeModulesPath = path58__namespace.join(cwd2, "node_modules");
|
|
51089
51379
|
try {
|
|
51090
51380
|
await fsp__namespace.access(nodeModulesPath);
|
|
51091
51381
|
const stats = await fsp__namespace.stat(nodeModulesPath);
|
|
@@ -51317,7 +51607,7 @@ ${fixPlan.note}` : ""));
|
|
|
51317
51607
|
}
|
|
51318
51608
|
break;
|
|
51319
51609
|
case "CACHE_CORRUPT":
|
|
51320
|
-
const cacheDir =
|
|
51610
|
+
const cacheDir = path58__namespace.join(
|
|
51321
51611
|
context2.environment?.cwd || process.cwd(),
|
|
51322
51612
|
".maria",
|
|
51323
51613
|
"cache"
|
|
@@ -51336,7 +51626,7 @@ ${fixPlan.note}` : ""));
|
|
|
51336
51626
|
* Create environment template
|
|
51337
51627
|
*/
|
|
51338
51628
|
async createEnvTemplate(context2) {
|
|
51339
|
-
const envPath =
|
|
51629
|
+
const envPath = path58__namespace.join(
|
|
51340
51630
|
context2.environment?.cwd || process.cwd(),
|
|
51341
51631
|
".env.local"
|
|
51342
51632
|
);
|
|
@@ -51392,7 +51682,7 @@ LOG_LEVEL=info
|
|
|
51392
51682
|
async getSystemInfo(context2) {
|
|
51393
51683
|
let mariaVersion = "Unknown";
|
|
51394
51684
|
try {
|
|
51395
|
-
const packagePath =
|
|
51685
|
+
const packagePath = path58__namespace.join(
|
|
51396
51686
|
context2.environment?.cwd || process.cwd(),
|
|
51397
51687
|
"package.json"
|
|
51398
51688
|
);
|
|
@@ -52992,7 +53282,7 @@ var init_TerminalSetupCommand = __esm({
|
|
|
52992
53282
|
if (_shell.includes("fish")) return "fish";
|
|
52993
53283
|
if (_shell.includes("powershell")) return "powershell";
|
|
52994
53284
|
if (_shell.includes("cmd")) return "cmd";
|
|
52995
|
-
return
|
|
53285
|
+
return path58__namespace.basename(_shell) || "unknown";
|
|
52996
53286
|
}
|
|
52997
53287
|
generateTerminalRecommendations(type2, _features, _shell) {
|
|
52998
53288
|
const _recommendations = [];
|
|
@@ -53309,9 +53599,9 @@ function clampInt(v, min, max, name2) {
|
|
|
53309
53599
|
return Math.min(max, Math.max(min, Math.floor(n)));
|
|
53310
53600
|
}
|
|
53311
53601
|
function sanitizeOut(outDir, root) {
|
|
53312
|
-
const full =
|
|
53313
|
-
const rel =
|
|
53314
|
-
if (rel.startsWith("..") ||
|
|
53602
|
+
const full = path58__namespace.default.resolve(root, outDir);
|
|
53603
|
+
const rel = path58__namespace.default.relative(root, full);
|
|
53604
|
+
if (rel.startsWith("..") || path58__namespace.default.isAbsolute(rel)) throw new Error("out path escapes root");
|
|
53315
53605
|
return rel.replace(/\\/g, "/");
|
|
53316
53606
|
}
|
|
53317
53607
|
var init_Normalizer = __esm({
|
|
@@ -53323,15 +53613,15 @@ function ensureDirSync(p) {
|
|
|
53323
53613
|
fs24__namespace.mkdirSync(p, { recursive: true });
|
|
53324
53614
|
}
|
|
53325
53615
|
function safeJoin(root, ...segs) {
|
|
53326
|
-
const full =
|
|
53327
|
-
const rel =
|
|
53328
|
-
if (rel.startsWith("..") ||
|
|
53616
|
+
const full = path58__namespace.resolve(root, ...segs);
|
|
53617
|
+
const rel = path58__namespace.relative(root, full);
|
|
53618
|
+
if (rel.startsWith("..") || path58__namespace.isAbsolute(rel)) {
|
|
53329
53619
|
throw new Error(`path escapes root: ${segs.join("/")}`);
|
|
53330
53620
|
}
|
|
53331
53621
|
return { full, rel };
|
|
53332
53622
|
}
|
|
53333
53623
|
function stageDir(root, trace) {
|
|
53334
|
-
return
|
|
53624
|
+
return path58__namespace.join(root, `.stage/${trace}`);
|
|
53335
53625
|
}
|
|
53336
53626
|
async function existsSameHash(destFull) {
|
|
53337
53627
|
try {
|
|
@@ -53396,10 +53686,10 @@ async function saveArtifacts(ctx2, items, manifest) {
|
|
|
53396
53686
|
const fname = `${contentHash}${ext2}`;
|
|
53397
53687
|
const dest = safeJoin(root, `${outDirSeg}/${fname}`);
|
|
53398
53688
|
validateWinPathEdge(dest.full);
|
|
53399
|
-
if (await hasCaseInsensitiveCollision(
|
|
53689
|
+
if (await hasCaseInsensitiveCollision(path58__namespace.dirname(dest.full), path58__namespace.basename(dest.full))) {
|
|
53400
53690
|
throw new Error("case-insensitive filename collision");
|
|
53401
53691
|
}
|
|
53402
|
-
const stg =
|
|
53692
|
+
const stg = path58__namespace.join(stage, `${fname}.part`);
|
|
53403
53693
|
if (await existsSameHash(dest.full)) {
|
|
53404
53694
|
saved.push(dest.rel);
|
|
53405
53695
|
continue;
|
|
@@ -53412,10 +53702,10 @@ async function saveArtifacts(ctx2, items, manifest) {
|
|
|
53412
53702
|
manifestVersion: 1,
|
|
53413
53703
|
...manifest,
|
|
53414
53704
|
createdAt: manifest.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
53415
|
-
artifacts: manifest.artifacts && manifest.artifacts.length > 0 ? manifest.artifacts : saved.map((file) => ({ file, hash: `sha256:${
|
|
53705
|
+
artifacts: manifest.artifacts && manifest.artifacts.length > 0 ? manifest.artifacts : saved.map((file) => ({ file, hash: `sha256:${path58__namespace.basename(file).split(".")[0]}` }))
|
|
53416
53706
|
};
|
|
53417
53707
|
const manifestPathRel = `${outDirSeg}/manifest.json`;
|
|
53418
|
-
const manifestStage =
|
|
53708
|
+
const manifestStage = path58__namespace.join(stage, "manifest.json.part");
|
|
53419
53709
|
const manifestFull = safeJoin(root, manifestPathRel).full;
|
|
53420
53710
|
await fsp__namespace.writeFile(manifestStage, JSON.stringify(manifestObj, null, 2), "utf8");
|
|
53421
53711
|
await atomicRename(manifestStage, manifestFull);
|
|
@@ -53772,10 +54062,10 @@ var init_session = __esm({
|
|
|
53772
54062
|
this.root = root;
|
|
53773
54063
|
}
|
|
53774
54064
|
file() {
|
|
53775
|
-
return
|
|
54065
|
+
return path58__namespace.default.join(this.root, ".maria", "memory", "session.json");
|
|
53776
54066
|
}
|
|
53777
54067
|
lockFile() {
|
|
53778
|
-
return
|
|
54068
|
+
return path58__namespace.default.join(this.root, ".maria", "memory", ".session.lock");
|
|
53779
54069
|
}
|
|
53780
54070
|
load() {
|
|
53781
54071
|
try {
|
|
@@ -53790,7 +54080,7 @@ var init_session = __esm({
|
|
|
53790
54080
|
*/
|
|
53791
54081
|
save(data) {
|
|
53792
54082
|
const target = this.file();
|
|
53793
|
-
const dir =
|
|
54083
|
+
const dir = path58__namespace.default.dirname(target);
|
|
53794
54084
|
fs24__namespace.default.mkdirSync(dir, { recursive: true });
|
|
53795
54085
|
try {
|
|
53796
54086
|
this.rotateIfStale(target, 7 * 24 * 60 * 60 * 1e3);
|
|
@@ -53823,7 +54113,7 @@ var init_session = __esm({
|
|
|
53823
54113
|
const body = `${pid}
|
|
53824
54114
|
${(/* @__PURE__ */ new Date()).toISOString()}`;
|
|
53825
54115
|
const start = Date.now();
|
|
53826
|
-
fs24__namespace.default.mkdirSync(
|
|
54116
|
+
fs24__namespace.default.mkdirSync(path58__namespace.default.dirname(lockPath), { recursive: true });
|
|
53827
54117
|
const maxWaitTime = Date.now() + waitMs;
|
|
53828
54118
|
while (Date.now() < maxWaitTime) {
|
|
53829
54119
|
try {
|
|
@@ -53862,10 +54152,10 @@ ${(/* @__PURE__ */ new Date()).toISOString()}`;
|
|
|
53862
54152
|
if (age > ttlMs) {
|
|
53863
54153
|
const d = new Date(st.mtimeMs);
|
|
53864
54154
|
const yyyymmdd = `${d.getUTCFullYear()}${String(d.getUTCMonth() + 1).padStart(2, "0")}${String(d.getUTCDate()).padStart(2, "0")}`;
|
|
53865
|
-
const archiveDir =
|
|
54155
|
+
const archiveDir = path58__namespace.default.join(path58__namespace.default.dirname(filePath), "archive", yyyymmdd);
|
|
53866
54156
|
fs24__namespace.default.mkdirSync(archiveDir, { recursive: true });
|
|
53867
54157
|
const ts = d.toISOString().replace(/[:]/g, "-");
|
|
53868
|
-
const dest =
|
|
54158
|
+
const dest = path58__namespace.default.join(archiveDir, `session-${ts}.json`);
|
|
53869
54159
|
fs24__namespace.default.renameSync(filePath, dest);
|
|
53870
54160
|
}
|
|
53871
54161
|
} catch {
|
|
@@ -53987,7 +54277,7 @@ var init_firestore = __esm({
|
|
|
53987
54277
|
return s2.slice(0, limit);
|
|
53988
54278
|
}
|
|
53989
54279
|
readLocal() {
|
|
53990
|
-
const sessionPath =
|
|
54280
|
+
const sessionPath = path58__namespace.default.join(this.cwd, ".maria", "memory", "session.json");
|
|
53991
54281
|
const candidates = [];
|
|
53992
54282
|
try {
|
|
53993
54283
|
const raw = JSON.parse(fs24__namespace.default.readFileSync(sessionPath, "utf8"));
|
|
@@ -54266,13 +54556,13 @@ async function hasFfmpeg() {
|
|
|
54266
54556
|
});
|
|
54267
54557
|
}
|
|
54268
54558
|
async function muxFramesToMp4(framesDir, fps) {
|
|
54269
|
-
const outFile =
|
|
54559
|
+
const outFile = path58__namespace.join(framesDir, `out-${Date.now()}.mp4`);
|
|
54270
54560
|
await execFfmpeg([
|
|
54271
54561
|
"-y",
|
|
54272
54562
|
"-framerate",
|
|
54273
54563
|
String(fps),
|
|
54274
54564
|
"-i",
|
|
54275
|
-
|
|
54565
|
+
path58__namespace.join(framesDir, "%06d.png"),
|
|
54276
54566
|
"-pix_fmt",
|
|
54277
54567
|
"yuv420p",
|
|
54278
54568
|
"-c:v",
|
|
@@ -54338,11 +54628,11 @@ async function runVideoPipeline(params2, opts) {
|
|
|
54338
54628
|
let saved;
|
|
54339
54629
|
let warnFallback = false;
|
|
54340
54630
|
if (frames.length > 0 && await hasFfmpeg()) {
|
|
54341
|
-
const tmpDir =
|
|
54631
|
+
const tmpDir = path58__namespace.join(opts.root, ".stage", manifest.trace || "FFMPEG");
|
|
54342
54632
|
await fsp__namespace.mkdir(tmpDir, { recursive: true });
|
|
54343
54633
|
for (let i2 = 0; i2 < frames.length; i2++) {
|
|
54344
54634
|
const fname = String(i2 + 1).padStart(6, "0") + ".png";
|
|
54345
|
-
await fsp__namespace.writeFile(
|
|
54635
|
+
await fsp__namespace.writeFile(path58__namespace.join(tmpDir, fname), frames[i2]);
|
|
54346
54636
|
}
|
|
54347
54637
|
const outBuf = await muxFramesToMp4(tmpDir, params2.fps);
|
|
54348
54638
|
saved = await saveArtifacts({ root: opts.root, kind: "video", baseDir: opts.outDir }, [{ bytes: outBuf, ext: ".mp4" }], manifest);
|
|
@@ -55045,14 +55335,461 @@ var init_WhoAmICommand = __esm({
|
|
|
55045
55335
|
WhoAmICommand_default = WhoAmICommand;
|
|
55046
55336
|
}
|
|
55047
55337
|
});
|
|
55338
|
+
function resolveArtifactRoot() {
|
|
55339
|
+
return process.env.MARIA_IDENTITY_ROOT ? path58__namespace.default.resolve(process.env.MARIA_IDENTITY_ROOT) : process.cwd();
|
|
55340
|
+
}
|
|
55341
|
+
function normalizeLocale(locale) {
|
|
55342
|
+
if (!locale) return DEFAULT_LOCALE;
|
|
55343
|
+
const normalized = locale.toLowerCase();
|
|
55344
|
+
if (normalized.startsWith("ja")) return "ja";
|
|
55345
|
+
if (normalized.startsWith("zh")) return "zh";
|
|
55346
|
+
if (normalized.startsWith("ko")) return "ko";
|
|
55347
|
+
if (normalized.startsWith("vi")) return "vi";
|
|
55348
|
+
if (normalized.startsWith("en")) return "en";
|
|
55349
|
+
return DEFAULT_LOCALE;
|
|
55350
|
+
}
|
|
55351
|
+
function formatList2(items, locale) {
|
|
55352
|
+
if (items.length === 0) {
|
|
55353
|
+
return "";
|
|
55354
|
+
}
|
|
55355
|
+
const limited = items.slice(0, DEFAULT_COMMAND_LIMIT);
|
|
55356
|
+
const ellipsis = items.length > DEFAULT_COMMAND_LIMIT;
|
|
55357
|
+
switch (locale) {
|
|
55358
|
+
case "ja":
|
|
55359
|
+
return `${limited.join("\u3001")}\u306A\u3069`;
|
|
55360
|
+
case "zh":
|
|
55361
|
+
return `${limited.join("\u3001")}\u7B49`;
|
|
55362
|
+
case "ko":
|
|
55363
|
+
return `${limited.join(", ")} \uB4F1`;
|
|
55364
|
+
case "vi":
|
|
55365
|
+
return ellipsis ? `${limited.join(", ")} ...` : limited.join(", ");
|
|
55366
|
+
default:
|
|
55367
|
+
if (limited.length === 1) {
|
|
55368
|
+
return limited[0];
|
|
55369
|
+
}
|
|
55370
|
+
if (limited.length === 2) {
|
|
55371
|
+
return `${limited[0]} and ${limited[1]}` + (ellipsis ? " etc." : "");
|
|
55372
|
+
}
|
|
55373
|
+
const rest = limited.slice(0, -1).join(", ");
|
|
55374
|
+
const last = limited[limited.length - 1];
|
|
55375
|
+
return `${rest}, and ${last}` + (ellipsis ? " etc." : "");
|
|
55376
|
+
}
|
|
55377
|
+
}
|
|
55378
|
+
function buildSentence(locale, commands) {
|
|
55379
|
+
const list = formatList2(commands, locale);
|
|
55380
|
+
switch (locale) {
|
|
55381
|
+
case "ja":
|
|
55382
|
+
return `READY\u30B3\u30DE\u30F3\u30C9\uFF08\u4F8B\uFF1A${list}\uFF09\u3092\u4E2D\u5FC3\u306B\u30B5\u30DD\u30FC\u30C8\u3057\u307E\u3059\u3002`;
|
|
55383
|
+
case "zh":
|
|
55384
|
+
return `\u6211\u4E3B\u8981\u652F\u6301 READY \u547D\u4EE4\uFF0C\u4F8B\u5982\uFF1A${list}\u3002`;
|
|
55385
|
+
case "ko":
|
|
55386
|
+
return `READY\uB85C \uD45C\uAE30\uB41C \uBA85\uB839(${list})\uC744 \uC911\uC2EC\uC73C\uB85C \uC9C0\uC6D0\uD569\uB2C8\uB2E4.`;
|
|
55387
|
+
case "vi":
|
|
55388
|
+
return `T\xF4i h\u1ED7 tr\u1EE3 c\xE1c l\u1EC7nh READY nh\u01B0: ${list}.`;
|
|
55389
|
+
default:
|
|
55390
|
+
return `I focus on READY commands like ${list}.`;
|
|
55391
|
+
}
|
|
55392
|
+
}
|
|
55393
|
+
var DEFAULT_TEMPLATE_VERSION, ARTIFACT_CACHE_TTL, DEFAULT_COMMAND_LIMIT, DEFAULT_TEMPLATES, HELP_LINES, NEXT_STEPS, DEGRADED_HEADER, DEGRADED_BODY, DEFAULT_NEXT_STEPS, DEFAULT_LOCALE, IdentityRenderer, identityRenderer;
|
|
55394
|
+
var init_identity_renderer = __esm({
|
|
55395
|
+
"src/services/identity/identity-renderer.ts"() {
|
|
55396
|
+
init_logger();
|
|
55397
|
+
init_TelemetryCollector();
|
|
55398
|
+
DEFAULT_TEMPLATE_VERSION = "v1.0.0";
|
|
55399
|
+
ARTIFACT_CACHE_TTL = 6e4;
|
|
55400
|
+
DEFAULT_COMMAND_LIMIT = 16;
|
|
55401
|
+
DEFAULT_TEMPLATES = {
|
|
55402
|
+
en: "I'm Maria Code \u2014 a large language model fully trained by Bonginkan. I support this workspace as a developer partner. I focus on the READY commands listed in `/help`, including <skills>. If you need something outside the READY set, I'll confirm what's supported first.",
|
|
55403
|
+
ja: "\u79C1\u306FMaria Code\uFF08Bonginkan\u306B\u3088\u3063\u3066\u5B8C\u5168\u306B\u8A13\u7DF4\u3055\u308C\u305F\u5927\u898F\u6A21\u8A00\u8A9E\u30E2\u30C7\u30EB\uFF09\u3067\u3059\u3002\u958B\u767A\u30D1\u30FC\u30C8\u30CA\u30FC\u3068\u3057\u3066\u3053\u306E\u30EF\u30FC\u30AF\u30B9\u30DA\u30FC\u30B9\u3092\u652F\u63F4\u3057\u307E\u3059\u3002`/help`\u3067\u78BA\u8A8D\u3067\u304D\u308BREADY\u30B3\u30DE\u30F3\u30C9\uFF08\u4F8B\uFF1A<skills>\uFF09\u3092\u4E2D\u5FC3\u306B\u5BFE\u5FDC\u3057\u307E\u3059\u3002\u7BC4\u56F2\u5916\u306E\u4F9D\u983C\u306F\u3001\u307E\u305A\u5BFE\u5FDC\u53EF\u5426\u3092\u4E00\u7DD2\u306B\u78BA\u8A8D\u3057\u307E\u3059\u3002",
|
|
55404
|
+
zh: "\u6211\u662F Maria Code\uFF08\u7531 Bonginkan \u5B8C\u6574\u8BAD\u7EC3\u7684\u5927\u578B\u8BED\u8A00\u6A21\u578B\uFF09\u3002\u6211\u5728\u6B64\u5DE5\u4F5C\u533A\u4EE5\u5F00\u53D1\u4F19\u4F34\u7684\u8EAB\u4EFD\u63D0\u4F9B\u534F\u52A9\u3002\u6211\u4E3B\u8981\u652F\u6301 `/help` \u4E2D\u5217\u51FA\u7684 READY \u547D\u4EE4\uFF08\u5982\uFF1A<skills>\uFF09\u3002\u5982\u679C\u9700\u6C42\u8D85\u51FA\u8303\u56F4\uFF0C\u6211\u4EEC\u4F1A\u5148\u786E\u8BA4\u662F\u5426\u53D7\u652F\u6301\u3002",
|
|
55405
|
+
ko: "\uC800\uB294 Maria Code(\uBD09\uAE34\uCE78\uC774 \uC644\uC804\uD788 \uD559\uC2B5\uD55C \uB300\uADDC\uBAA8 \uC5B8\uC5B4 \uBAA8\uB378)\uC785\uB2C8\uB2E4. \uC774 \uC6CC\uD06C\uC2A4\uD398\uC774\uC2A4\uC5D0\uC11C \uAC1C\uBC1C \uD30C\uD2B8\uB108\uB85C \uC9C0\uC6D0\uD569\uB2C8\uB2E4. `/help`\uC5D0 READY\uB85C \uD45C\uC2DC\uB41C \uBA85\uB839(\uC608: <skills>)\uC744 \uC911\uC2EC\uC73C\uB85C \uB3C4\uC640\uB4DC\uB9BD\uB2C8\uB2E4. \uBC94\uC704\uB97C \uBC97\uC5B4\uB098\uB294 \uC694\uCCAD\uC740 \uAC00\uB2A5 \uC5EC\uBD80\uBD80\uD130 \uD568\uAED8 \uD655\uC778\uD569\uB2C8\uB2E4.",
|
|
55406
|
+
vi: "T\xF4i l\xE0 Maria Code \u2014 m\xF4 h\xECnh ng\xF4n ng\u1EEF l\u1EDBn \u0111\u01B0\u1EE3c Bonginkan hu\u1EA5n luy\u1EC7n \u0111\u1EA7y \u0111\u1EE7. T\xF4i h\u1ED7 tr\u1EE3 workspace n\xE0y nh\u01B0 m\u1ED9t c\u1ED9ng s\u1EF1 ph\xE1t tri\u1EC3n. T\xF4i t\u1EADp trung v\xE0o c\xE1c l\u1EC7nh READY trong `/help`, ch\u1EB3ng h\u1EA1n nh\u01B0 <skills>. N\u1EBFu y\xEAu c\u1EA7u n\u1EB1m ngo\xE0i ph\u1EA1m vi, ch\xFAng ta s\u1EBD ki\u1EC3m tra tr\u01B0\u1EDBc kh\u1EA3 n\u0103ng h\u1ED7 tr\u1EE3 nh\xE9."
|
|
55407
|
+
};
|
|
55408
|
+
HELP_LINES = {
|
|
55409
|
+
en: "See available skills with /help",
|
|
55410
|
+
ja: "\u5229\u7528\u53EF\u80FD\u306A\u30B3\u30DE\u30F3\u30C9\u306F /help \u3067\u78BA\u8A8D\u3067\u304D\u307E\u3059",
|
|
55411
|
+
zh: "\u53EF\u901A\u8FC7 /help \u67E5\u770B\u6240\u6709\u53EF\u7528\u547D\u4EE4",
|
|
55412
|
+
ko: "/help \uB85C \uC0AC\uC6A9 \uAC00\uB2A5\uD55C \uBA85\uB839\uC744 \uD655\uC778\uD558\uC138\uC694",
|
|
55413
|
+
vi: "Xem c\xE1c l\u1EC7nh h\u1ED7 tr\u1EE3 t\u1EA1i /help"
|
|
55414
|
+
};
|
|
55415
|
+
NEXT_STEPS = {
|
|
55416
|
+
en: [
|
|
55417
|
+
"See available skills with /help",
|
|
55418
|
+
"Describe your goal in one line; I'll route you to the right workflow"
|
|
55419
|
+
],
|
|
55420
|
+
ja: [
|
|
55421
|
+
"/help \u3067\u5229\u7528\u53EF\u80FD\u306A\u30B3\u30DE\u30F3\u30C9\u3092\u78BA\u8A8D",
|
|
55422
|
+
"\u3084\u308A\u305F\u3044\u3053\u3068\u3092\u4E00\u884C\u3067\u6559\u3048\u3066\u304F\u3060\u3055\u3044\u3002\u6700\u9069\u306A\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u306B\u6848\u5185\u3057\u307E\u3059"
|
|
55423
|
+
],
|
|
55424
|
+
zh: [
|
|
55425
|
+
"\u4F7F\u7528 /help \u67E5\u770B\u53EF\u7528\u547D\u4EE4",
|
|
55426
|
+
"\u7528\u4E00\u53E5\u8BDD\u63CF\u8FF0\u76EE\u6807\uFF0C\u6211\u4F1A\u5F15\u5BFC\u4F60\u8FDB\u5165\u5408\u9002\u7684\u6D41\u7A0B"
|
|
55427
|
+
],
|
|
55428
|
+
ko: [
|
|
55429
|
+
"/help \uB85C \uC0AC\uC6A9 \uAC00\uB2A5\uD55C \uBA85\uB839 \uD655\uC778",
|
|
55430
|
+
"\uC6D0\uD558\uB294 \uBAA9\uD45C\uB97C \uD55C \uC904\uB85C \uC54C\uB824\uC8FC\uC138\uC694. \uB9DE\uB294 \uC6CC\uD06C\uD50C\uB85C\uB85C \uC548\uB0B4\uD569\uB2C8\uB2E4"
|
|
55431
|
+
],
|
|
55432
|
+
vi: [
|
|
55433
|
+
"Xem c\xE1c l\u1EC7nh h\u1ED7 tr\u1EE3 b\u1EB1ng /help",
|
|
55434
|
+
"M\xF4 t\u1EA3 m\u1EE5c ti\xEAu trong m\u1ED9t c\xE2u, t\xF4i s\u1EBD h\u01B0\u1EDBng b\u1EA1n t\u1EDBi quy tr\xECnh ph\xF9 h\u1EE3p"
|
|
55435
|
+
]
|
|
55436
|
+
};
|
|
55437
|
+
DEGRADED_HEADER = {
|
|
55438
|
+
en: "WARN: Identity service degraded",
|
|
55439
|
+
ja: "WARN: Identity\u30B5\u30FC\u30D3\u30B9\u306E\u5229\u7528\u306B\u5236\u9650\u304C\u3042\u308A\u307E\u3059",
|
|
55440
|
+
zh: "WARN: \u8EAB\u4EFD\u670D\u52A1\u5904\u4E8E\u964D\u7EA7\u6A21\u5F0F",
|
|
55441
|
+
ko: "WARN: ID \uC11C\uBE44\uC2A4\uAC00 \uCD95\uC18C \uBAA8\uB4DC\uC785\uB2C8\uB2E4",
|
|
55442
|
+
vi: "WARN: D\u1ECBch v\u1EE5 nh\u1EADn di\u1EC7n \u0111ang b\u1ECB suy gi\u1EA3m"
|
|
55443
|
+
};
|
|
55444
|
+
DEGRADED_BODY = {
|
|
55445
|
+
en: "I'm Maria Code \u2014 a large language model fully trained by Bonginkan.",
|
|
55446
|
+
ja: "\u79C1\u306FMaria Code\uFF08Bonginkan\u306B\u3088\u3063\u3066\u5B8C\u5168\u306B\u8A13\u7DF4\u3055\u308C\u305F\u5927\u898F\u6A21\u8A00\u8A9E\u30E2\u30C7\u30EB\uFF09\u3067\u3059\u3002",
|
|
55447
|
+
zh: "\u6211\u662F Maria Code\uFF08\u7531 Bonginkan \u5B8C\u6574\u8BAD\u7EC3\u7684\u5927\u578B\u8BED\u8A00\u6A21\u578B\uFF09\u3002",
|
|
55448
|
+
ko: "\uC800\uB294 Maria Code(\uBD09\uAE34\uCE78\uC774 \uC644\uC804\uD788 \uD559\uC2B5\uD55C \uB300\uADDC\uBAA8 \uC5B8\uC5B4 \uBAA8\uB378)\uC785\uB2C8\uB2E4.",
|
|
55449
|
+
vi: "T\xF4i l\xE0 Maria Code \u2014 m\xF4 h\xECnh ng\xF4n ng\u1EEF l\u1EDBn \u0111\u01B0\u1EE3c Bonginkan hu\u1EA5n luy\u1EC7n \u0111\u1EA7y \u0111\u1EE7."
|
|
55450
|
+
};
|
|
55451
|
+
DEFAULT_NEXT_STEPS = [
|
|
55452
|
+
"See available skills with /help",
|
|
55453
|
+
"Describe your goal in one line; I'll route you to the right workflow"
|
|
55454
|
+
];
|
|
55455
|
+
DEFAULT_LOCALE = "en";
|
|
55456
|
+
IdentityRenderer = class _IdentityRenderer {
|
|
55457
|
+
static instance;
|
|
55458
|
+
skillsCache = null;
|
|
55459
|
+
templateCache = null;
|
|
55460
|
+
lastHashes = /* @__PURE__ */ new Map();
|
|
55461
|
+
static getInstance() {
|
|
55462
|
+
if (!_IdentityRenderer.instance) {
|
|
55463
|
+
_IdentityRenderer.instance = new _IdentityRenderer();
|
|
55464
|
+
}
|
|
55465
|
+
return _IdentityRenderer.instance;
|
|
55466
|
+
}
|
|
55467
|
+
async render(options = {}) {
|
|
55468
|
+
const startedAt = Date.now();
|
|
55469
|
+
const locale = normalizeLocale(options.locale);
|
|
55470
|
+
const format = options.format ?? "text";
|
|
55471
|
+
const isTTY = options.isTTY ?? Boolean(process.stdout?.isTTY);
|
|
55472
|
+
const timer = telemetry.startTimer("identity.answer_rendered.start", {
|
|
55473
|
+
_comp: "system",
|
|
55474
|
+
locale,
|
|
55475
|
+
format,
|
|
55476
|
+
source: options.source ?? "cli"
|
|
55477
|
+
});
|
|
55478
|
+
const skills = await this.resolveSkills(locale);
|
|
55479
|
+
const template = await this.resolveTemplate(locale);
|
|
55480
|
+
const degraded = skills.degraded || template.degraded;
|
|
55481
|
+
const degradationReason = skills.reason ?? template.reason;
|
|
55482
|
+
const previousHash = this.lastHashes.get(locale);
|
|
55483
|
+
this.lastHashes.set(locale, skills.hash);
|
|
55484
|
+
const templateVersion = template.version || DEFAULT_TEMPLATE_VERSION;
|
|
55485
|
+
const identityVersion = templateVersion;
|
|
55486
|
+
const persona = template.template.replace("<skills>", skills.sentence);
|
|
55487
|
+
const message = this.composeMessage({
|
|
55488
|
+
locale,
|
|
55489
|
+
persona,
|
|
55490
|
+
skillsSentence: skills.sentence,
|
|
55491
|
+
isTTY,
|
|
55492
|
+
degraded,
|
|
55493
|
+
includeWarningHeader: options.includeWarningHeader ?? degraded,
|
|
55494
|
+
reason: degradationReason
|
|
55495
|
+
});
|
|
55496
|
+
const jsonPayload = format === "json" ? {
|
|
55497
|
+
locale,
|
|
55498
|
+
identityVersion,
|
|
55499
|
+
skillsSentence: skills.sentence,
|
|
55500
|
+
skillsHash: skills.hash,
|
|
55501
|
+
degraded,
|
|
55502
|
+
previousSkillsHash: previousHash,
|
|
55503
|
+
templateVersion,
|
|
55504
|
+
degradationReason
|
|
55505
|
+
} : void 0;
|
|
55506
|
+
const latency = Date.now() - startedAt;
|
|
55507
|
+
telemetry.emit({
|
|
55508
|
+
event: "identity.answer_rendered",
|
|
55509
|
+
tags: {
|
|
55510
|
+
_comp: "system",
|
|
55511
|
+
locale,
|
|
55512
|
+
format,
|
|
55513
|
+
source: options.source ?? "cli"
|
|
55514
|
+
},
|
|
55515
|
+
meta: {
|
|
55516
|
+
templateVersion,
|
|
55517
|
+
skillsHash: skills.hash,
|
|
55518
|
+
previousSkillsHash: previousHash,
|
|
55519
|
+
degraded,
|
|
55520
|
+
latencyMs: latency,
|
|
55521
|
+
reason: degradationReason
|
|
55522
|
+
}
|
|
55523
|
+
});
|
|
55524
|
+
timer();
|
|
55525
|
+
return {
|
|
55526
|
+
message: format === "json" && jsonPayload ? JSON.stringify(jsonPayload, null, 2) : message,
|
|
55527
|
+
json: jsonPayload,
|
|
55528
|
+
metadata: {
|
|
55529
|
+
locale,
|
|
55530
|
+
templateVersion,
|
|
55531
|
+
skillsHash: skills.hash,
|
|
55532
|
+
previousSkillsHash: previousHash,
|
|
55533
|
+
degraded,
|
|
55534
|
+
degradationReason,
|
|
55535
|
+
latencyMs: latency
|
|
55536
|
+
}
|
|
55537
|
+
};
|
|
55538
|
+
}
|
|
55539
|
+
/**
|
|
55540
|
+
* Testing helper to reset caches.
|
|
55541
|
+
*/
|
|
55542
|
+
__resetForTests() {
|
|
55543
|
+
this.skillsCache = null;
|
|
55544
|
+
this.templateCache = null;
|
|
55545
|
+
this.lastHashes.clear();
|
|
55546
|
+
}
|
|
55547
|
+
async resolveSkills(locale) {
|
|
55548
|
+
const artifact = await this.loadSkillsArtifact();
|
|
55549
|
+
const root = resolveArtifactRoot();
|
|
55550
|
+
if (artifact && artifact.locales && artifact.locales[locale]) {
|
|
55551
|
+
const entry = artifact.locales[locale];
|
|
55552
|
+
if (entry?.sentence && entry?.hash) {
|
|
55553
|
+
return {
|
|
55554
|
+
sentence: entry.sentence,
|
|
55555
|
+
hash: entry.hash,
|
|
55556
|
+
degraded: false
|
|
55557
|
+
};
|
|
55558
|
+
}
|
|
55559
|
+
}
|
|
55560
|
+
const readyCommands = await this.loadReadyCommands(root);
|
|
55561
|
+
if (readyCommands.length === 0) {
|
|
55562
|
+
const hash2 = this.hashData(`${locale}:degraded`);
|
|
55563
|
+
return {
|
|
55564
|
+
sentence: this.buildDegradedSentence(locale),
|
|
55565
|
+
hash: hash2,
|
|
55566
|
+
degraded: true,
|
|
55567
|
+
reason: "ready-manifest-missing"
|
|
55568
|
+
};
|
|
55569
|
+
}
|
|
55570
|
+
const slashCommands = readyCommands.map((cmd) => `/${cmd.name}`);
|
|
55571
|
+
const sentence = buildSentence(locale, slashCommands);
|
|
55572
|
+
const hash = this.hashData(JSON.stringify({ locale, commands: slashCommands }));
|
|
55573
|
+
return {
|
|
55574
|
+
sentence,
|
|
55575
|
+
hash,
|
|
55576
|
+
degraded: false
|
|
55577
|
+
};
|
|
55578
|
+
}
|
|
55579
|
+
async resolveTemplate(locale) {
|
|
55580
|
+
const artifact = await this.loadTemplateArtifact();
|
|
55581
|
+
if (artifact && artifact.templates && artifact.templates[locale]) {
|
|
55582
|
+
return {
|
|
55583
|
+
template: artifact.templates[locale],
|
|
55584
|
+
version: artifact.templateVersion ?? DEFAULT_TEMPLATE_VERSION,
|
|
55585
|
+
degraded: false
|
|
55586
|
+
};
|
|
55587
|
+
}
|
|
55588
|
+
if (artifact && artifact.templates && artifact.templates[DEFAULT_LOCALE]) {
|
|
55589
|
+
return {
|
|
55590
|
+
template: artifact.templates[DEFAULT_LOCALE],
|
|
55591
|
+
version: artifact.templateVersion ?? DEFAULT_TEMPLATE_VERSION,
|
|
55592
|
+
degraded: false
|
|
55593
|
+
};
|
|
55594
|
+
}
|
|
55595
|
+
const template = DEFAULT_TEMPLATES[locale] ?? DEFAULT_TEMPLATES[DEFAULT_LOCALE];
|
|
55596
|
+
return {
|
|
55597
|
+
template,
|
|
55598
|
+
version: DEFAULT_TEMPLATE_VERSION,
|
|
55599
|
+
degraded: !DEFAULT_TEMPLATES[locale],
|
|
55600
|
+
reason: DEFAULT_TEMPLATES[locale] ? void 0 : "template-missing"
|
|
55601
|
+
};
|
|
55602
|
+
}
|
|
55603
|
+
composeMessage(args2) {
|
|
55604
|
+
const locale = args2.locale;
|
|
55605
|
+
const lines = [];
|
|
55606
|
+
if (args2.includeWarningHeader || args2.degraded) {
|
|
55607
|
+
const header = DEGRADED_HEADER[locale] ?? DEGRADED_HEADER[DEFAULT_LOCALE];
|
|
55608
|
+
lines.push(header);
|
|
55609
|
+
}
|
|
55610
|
+
if (args2.degraded) {
|
|
55611
|
+
const degradedBody = DEGRADED_BODY[locale] ?? DEGRADED_BODY[DEFAULT_LOCALE];
|
|
55612
|
+
const steps = NEXT_STEPS[locale] ?? DEFAULT_NEXT_STEPS;
|
|
55613
|
+
const helpLine2 = HELP_LINES[locale] ?? HELP_LINES[DEFAULT_LOCALE] ?? steps[0];
|
|
55614
|
+
lines.push(degradedBody);
|
|
55615
|
+
lines.push(helpLine2);
|
|
55616
|
+
lines.push(steps[1] ?? DEFAULT_NEXT_STEPS[1]);
|
|
55617
|
+
return lines.join("\n");
|
|
55618
|
+
}
|
|
55619
|
+
const helpLine = HELP_LINES[locale] ?? HELP_LINES[DEFAULT_LOCALE];
|
|
55620
|
+
const personaLines = this.normalizePersonaOutput(args2.persona);
|
|
55621
|
+
lines.push(...personaLines);
|
|
55622
|
+
if (args2.isTTY) {
|
|
55623
|
+
lines.push("Next steps:");
|
|
55624
|
+
const steps = NEXT_STEPS[locale] ?? DEFAULT_NEXT_STEPS;
|
|
55625
|
+
for (const step of steps) {
|
|
55626
|
+
lines.push(`- ${step}`);
|
|
55627
|
+
}
|
|
55628
|
+
} else {
|
|
55629
|
+
lines.push(helpLine);
|
|
55630
|
+
}
|
|
55631
|
+
return lines.join("\n");
|
|
55632
|
+
}
|
|
55633
|
+
normalizePersonaOutput(persona) {
|
|
55634
|
+
const sanitized = persona.replace(/\s+/g, " ").trim();
|
|
55635
|
+
const segments = sanitized.split(/(?<=[.!?。!?])/u).map((seg) => seg.trim());
|
|
55636
|
+
return segments.filter(Boolean);
|
|
55637
|
+
}
|
|
55638
|
+
async loadSkillsArtifact() {
|
|
55639
|
+
if (this.skillsCache && Date.now() - this.skillsCache.loadedAt < ARTIFACT_CACHE_TTL) {
|
|
55640
|
+
return this.skillsCache.data;
|
|
55641
|
+
}
|
|
55642
|
+
const root = resolveArtifactRoot();
|
|
55643
|
+
const artifactPath = path58__namespace.default.join(root, "reports", "identity-skills.json");
|
|
55644
|
+
const data = await this.readJsonFile(artifactPath);
|
|
55645
|
+
this.skillsCache = {
|
|
55646
|
+
data,
|
|
55647
|
+
loadedAt: Date.now()
|
|
55648
|
+
};
|
|
55649
|
+
return data;
|
|
55650
|
+
}
|
|
55651
|
+
async loadTemplateArtifact() {
|
|
55652
|
+
if (this.templateCache && Date.now() - this.templateCache.loadedAt < ARTIFACT_CACHE_TTL) {
|
|
55653
|
+
return this.templateCache.data;
|
|
55654
|
+
}
|
|
55655
|
+
const root = resolveArtifactRoot();
|
|
55656
|
+
const templatePath = path58__namespace.default.join(root, "MARIA_CHARACTER_RESPONSES.json");
|
|
55657
|
+
const data = await this.readJsonFile(templatePath);
|
|
55658
|
+
this.templateCache = {
|
|
55659
|
+
data,
|
|
55660
|
+
loadedAt: Date.now()
|
|
55661
|
+
};
|
|
55662
|
+
return data;
|
|
55663
|
+
}
|
|
55664
|
+
async loadReadyCommands(root) {
|
|
55665
|
+
const manifestPath = path58__namespace.default.join(root, "commands.ready.json");
|
|
55666
|
+
const manifest = await this.readJsonFile(manifestPath);
|
|
55667
|
+
if (!manifest?.commands) {
|
|
55668
|
+
return [];
|
|
55669
|
+
}
|
|
55670
|
+
return manifest.commands.filter((entry) => entry.status === "READY").map((entry) => ({
|
|
55671
|
+
name: String(entry.name ?? ""),
|
|
55672
|
+
category: entry.category ? String(entry.category) : void 0
|
|
55673
|
+
})).filter((entry) => entry.name?.length > 0);
|
|
55674
|
+
}
|
|
55675
|
+
buildDegradedSentence(locale) {
|
|
55676
|
+
switch (locale) {
|
|
55677
|
+
case "ja":
|
|
55678
|
+
return "`/help`\u3067\u516C\u958B\u3055\u308C\u3066\u3044\u308BREADY\u30B3\u30DE\u30F3\u30C9\u306B\u57FA\u3065\u3044\u3066\u5BFE\u5FDC\u3057\u307E\u3059\u3002";
|
|
55679
|
+
case "zh":
|
|
55680
|
+
return "\u6211\u4F1A\u4F9D\u636E /help \u4E2D\u516C\u5F00\u7684 READY \u547D\u4EE4\u63D0\u4F9B\u652F\u6301\u3002";
|
|
55681
|
+
case "ko":
|
|
55682
|
+
return "\uACF5\uAC1C\uB41C /help READY \uBA85\uB839\uC5D0 \uAE30\uBC18\uD558\uC5EC \uC9C0\uC6D0\uD569\uB2C8\uB2E4.";
|
|
55683
|
+
case "vi":
|
|
55684
|
+
return "T\xF4i s\u1EBD h\u1ED7 tr\u1EE3 d\u1EF1a tr\xEAn c\xE1c l\u1EC7nh READY \u0111\u01B0\u1EE3c li\u1EC7t k\xEA trong /help.";
|
|
55685
|
+
default:
|
|
55686
|
+
return "I will rely on the READY commands published in /help.";
|
|
55687
|
+
}
|
|
55688
|
+
}
|
|
55689
|
+
hashData(data) {
|
|
55690
|
+
return crypto6.createHash("sha256").update(data).digest("hex");
|
|
55691
|
+
}
|
|
55692
|
+
async readJsonFile(filePath) {
|
|
55693
|
+
try {
|
|
55694
|
+
const raw = await fsp.readFile(filePath, "utf8");
|
|
55695
|
+
return JSON.parse(raw);
|
|
55696
|
+
} catch (error2) {
|
|
55697
|
+
if (error2.code !== "ENOENT") {
|
|
55698
|
+
logger.warn(`Failed to read JSON artifact at ${filePath}:`, error2);
|
|
55699
|
+
}
|
|
55700
|
+
return null;
|
|
55701
|
+
}
|
|
55702
|
+
}
|
|
55703
|
+
};
|
|
55704
|
+
identityRenderer = IdentityRenderer.getInstance();
|
|
55705
|
+
}
|
|
55706
|
+
});
|
|
55707
|
+
|
|
55708
|
+
// src/slash-commands/categories/core/identity.command.ts
|
|
55709
|
+
var identity_command_exports = {};
|
|
55710
|
+
__export(identity_command_exports, {
|
|
55711
|
+
IdentityCommand: () => IdentityCommand,
|
|
55712
|
+
meta: () => meta14
|
|
55713
|
+
});
|
|
55714
|
+
var IdentityCommand, meta14;
|
|
55715
|
+
var init_identity_command = __esm({
|
|
55716
|
+
"src/slash-commands/categories/core/identity.command.ts"() {
|
|
55717
|
+
init_base_command();
|
|
55718
|
+
init_identity_renderer();
|
|
55719
|
+
init_logger();
|
|
55720
|
+
IdentityCommand = class extends BaseCommand {
|
|
55721
|
+
name = "identity";
|
|
55722
|
+
description = "Show Maria Code identity and supported READY skills";
|
|
55723
|
+
category = "core";
|
|
55724
|
+
aliases = ["whois", "persona"];
|
|
55725
|
+
usage = "/identity [--json] [--locale <tag>]";
|
|
55726
|
+
examples = [
|
|
55727
|
+
{
|
|
55728
|
+
input: "/identity",
|
|
55729
|
+
description: "Display identity message in current locale"
|
|
55730
|
+
},
|
|
55731
|
+
{
|
|
55732
|
+
input: "/identity --json",
|
|
55733
|
+
description: "Return structured JSON payload"
|
|
55734
|
+
}
|
|
55735
|
+
];
|
|
55736
|
+
async execute(args2, _context) {
|
|
55737
|
+
const positional = args2.parsed["_positional"] ?? [];
|
|
55738
|
+
if (positional.length > 0) {
|
|
55739
|
+
return this.error(
|
|
55740
|
+
"Usage: /identity [--json] [--locale <tag>]",
|
|
55741
|
+
"INVALID_ARGUMENTS"
|
|
55742
|
+
);
|
|
55743
|
+
}
|
|
55744
|
+
const wantsJson = Boolean(args2.flags["json"] || args2.options["json"]);
|
|
55745
|
+
const explicitLocale = typeof args2.options["locale"] === "string" ? args2.options["locale"] : void 0;
|
|
55746
|
+
try {
|
|
55747
|
+
const result = await identityRenderer.render({
|
|
55748
|
+
locale: explicitLocale,
|
|
55749
|
+
format: wantsJson ? "json" : "text",
|
|
55750
|
+
isTTY: Boolean(process.stdout?.isTTY),
|
|
55751
|
+
source: "cli"
|
|
55752
|
+
});
|
|
55753
|
+
const payload = wantsJson ? result.json : {
|
|
55754
|
+
locale: result.metadata.locale,
|
|
55755
|
+
degraded: result.metadata.degraded,
|
|
55756
|
+
templateVersion: result.metadata.templateVersion,
|
|
55757
|
+
skillsHash: result.metadata.skillsHash,
|
|
55758
|
+
previousSkillsHash: result.metadata.previousSkillsHash
|
|
55759
|
+
};
|
|
55760
|
+
return this.success(result.message, payload);
|
|
55761
|
+
} catch (error2) {
|
|
55762
|
+
logger.error("/identity execution failed", error2);
|
|
55763
|
+
return this.error(
|
|
55764
|
+
"Unable to render identity information. Run /help for support.",
|
|
55765
|
+
"IDENTITY_RENDER_ERROR",
|
|
55766
|
+
{ error: error2?.message }
|
|
55767
|
+
);
|
|
55768
|
+
}
|
|
55769
|
+
}
|
|
55770
|
+
};
|
|
55771
|
+
meta14 = {
|
|
55772
|
+
name: "identity",
|
|
55773
|
+
category: "core",
|
|
55774
|
+
description: "Show Maria Code identity and supported READY skills",
|
|
55775
|
+
aliases: ["whois", "persona"],
|
|
55776
|
+
usage: "/identity [--json] [--locale <tag>]",
|
|
55777
|
+
examples: [
|
|
55778
|
+
"/identity",
|
|
55779
|
+
"/identity --json"
|
|
55780
|
+
],
|
|
55781
|
+
deps: ["commands.ready.json"]
|
|
55782
|
+
};
|
|
55783
|
+
}
|
|
55784
|
+
});
|
|
55048
55785
|
|
|
55049
55786
|
// src/slash-commands/categories/core/about.command.ts
|
|
55050
55787
|
var about_command_exports = {};
|
|
55051
55788
|
__export(about_command_exports, {
|
|
55052
55789
|
AboutCommand: () => AboutCommand,
|
|
55053
|
-
meta: () =>
|
|
55790
|
+
meta: () => meta15
|
|
55054
55791
|
});
|
|
55055
|
-
var AboutCommand,
|
|
55792
|
+
var AboutCommand, meta15;
|
|
55056
55793
|
var init_about_command = __esm({
|
|
55057
55794
|
"src/slash-commands/categories/core/about.command.ts"() {
|
|
55058
55795
|
init_base_command();
|
|
@@ -55107,7 +55844,7 @@ var init_about_command = __esm({
|
|
|
55107
55844
|
};
|
|
55108
55845
|
}
|
|
55109
55846
|
};
|
|
55110
|
-
|
|
55847
|
+
meta15 = {
|
|
55111
55848
|
name: "about",
|
|
55112
55849
|
category: "core",
|
|
55113
55850
|
description: "Display information about MARIA and the team",
|
|
@@ -56613,11 +57350,11 @@ var init_ConfigPortAdapter = __esm({
|
|
|
56613
57350
|
backupCount: 5
|
|
56614
57351
|
};
|
|
56615
57352
|
constructor() {
|
|
56616
|
-
this.globalConfigPath =
|
|
56617
|
-
this.userConfigPath =
|
|
56618
|
-
this.projectConfigPath =
|
|
56619
|
-
this.historyPath =
|
|
56620
|
-
this.templatesPath =
|
|
57353
|
+
this.globalConfigPath = path58__namespace.default.join(os16__namespace.default.homedir(), ".maria", "config.json");
|
|
57354
|
+
this.userConfigPath = path58__namespace.default.join(os16__namespace.default.homedir(), ".maria", "user-config.json");
|
|
57355
|
+
this.projectConfigPath = path58__namespace.default.join(process.cwd(), ".maria-config.json");
|
|
57356
|
+
this.historyPath = path58__namespace.default.join(os16__namespace.default.homedir(), ".maria", "config-history.json");
|
|
57357
|
+
this.templatesPath = path58__namespace.default.join(os16__namespace.default.homedir(), ".maria", "templates");
|
|
56621
57358
|
}
|
|
56622
57359
|
async get(key) {
|
|
56623
57360
|
const layered = await this.getLayered(key);
|
|
@@ -56874,7 +57611,7 @@ var init_ConfigPortAdapter = __esm({
|
|
|
56874
57611
|
for (const file of files) {
|
|
56875
57612
|
if (file.endsWith(".json")) {
|
|
56876
57613
|
try {
|
|
56877
|
-
const templatePath =
|
|
57614
|
+
const templatePath = path58__namespace.default.join(this.templatesPath, file);
|
|
56878
57615
|
const content = await fsp__namespace.default.readFile(templatePath, "utf-8");
|
|
56879
57616
|
const template = JSON.parse(content);
|
|
56880
57617
|
templates.push(template);
|
|
@@ -56956,7 +57693,7 @@ var init_ConfigPortAdapter = __esm({
|
|
|
56956
57693
|
}
|
|
56957
57694
|
async saveLayerConfig(layer, config2) {
|
|
56958
57695
|
const configPath = this.getLayerConfigPath(layer);
|
|
56959
|
-
await fsp__namespace.default.mkdir(
|
|
57696
|
+
await fsp__namespace.default.mkdir(path58__namespace.default.dirname(configPath), { recursive: true });
|
|
56960
57697
|
await fsp__namespace.default.writeFile(configPath, JSON.stringify(config2, null, 2), "utf-8");
|
|
56961
57698
|
}
|
|
56962
57699
|
getLayerConfigPath(layer) {
|
|
@@ -56968,7 +57705,7 @@ var init_ConfigPortAdapter = __esm({
|
|
|
56968
57705
|
case "project":
|
|
56969
57706
|
return this.projectConfigPath;
|
|
56970
57707
|
case "runtime":
|
|
56971
|
-
return
|
|
57708
|
+
return path58__namespace.default.join(os16__namespace.default.tmpdir(), "maria-runtime-config.json");
|
|
56972
57709
|
default:
|
|
56973
57710
|
return this.userConfigPath;
|
|
56974
57711
|
}
|
|
@@ -57022,7 +57759,7 @@ var init_ConfigPortAdapter = __esm({
|
|
|
57022
57759
|
const history = JSON.parse(historyContent);
|
|
57023
57760
|
history.push(entry);
|
|
57024
57761
|
const trimmedHistory = history.slice(-1e3);
|
|
57025
|
-
await fsp__namespace.default.mkdir(
|
|
57762
|
+
await fsp__namespace.default.mkdir(path58__namespace.default.dirname(this.historyPath), { recursive: true });
|
|
57026
57763
|
await fsp__namespace.default.writeFile(
|
|
57027
57764
|
this.historyPath,
|
|
57028
57765
|
JSON.stringify(trimmedHistory, null, 2),
|
|
@@ -57034,7 +57771,7 @@ var init_ConfigPortAdapter = __esm({
|
|
|
57034
57771
|
}
|
|
57035
57772
|
async loadTemplate(templateId) {
|
|
57036
57773
|
try {
|
|
57037
|
-
const templatePath =
|
|
57774
|
+
const templatePath = path58__namespace.default.join(this.templatesPath, `${templateId}.json`);
|
|
57038
57775
|
const content = await fsp__namespace.default.readFile(templatePath, "utf-8");
|
|
57039
57776
|
return JSON.parse(content);
|
|
57040
57777
|
} catch (error2) {
|
|
@@ -58213,7 +58950,7 @@ var init_rate_limit_handler = __esm({
|
|
|
58213
58950
|
async function scanRepo(cwd2) {
|
|
58214
58951
|
if (_cache && _cache.root === cwd2) return _cache;
|
|
58215
58952
|
const root = cwd2;
|
|
58216
|
-
const pkgPath =
|
|
58953
|
+
const pkgPath = path58.join(root, "package.json");
|
|
58217
58954
|
let pkg = {};
|
|
58218
58955
|
try {
|
|
58219
58956
|
pkg = JSON.parse(await fsp.readFile(pkgPath, "utf8"));
|
|
@@ -58223,17 +58960,17 @@ async function scanRepo(cwd2) {
|
|
|
58223
58960
|
const usesReact = !!deps["react"];
|
|
58224
58961
|
const usesNext = !!deps["next"];
|
|
58225
58962
|
const jsModuleType = pkg.type === "module" ? "esm" : "cjs";
|
|
58226
|
-
const hasSrc = fs24.existsSync(
|
|
58963
|
+
const hasSrc = fs24.existsSync(path58.join(root, "src"));
|
|
58227
58964
|
const srcRoot = hasSrc ? "src" : "";
|
|
58228
|
-
const tsconfigPath =
|
|
58965
|
+
const tsconfigPath = path58.join(root, "tsconfig.json");
|
|
58229
58966
|
let usesTS = fs24.existsSync(tsconfigPath) || !!deps["typescript"];
|
|
58230
58967
|
if (!usesTS && hasSrc) {
|
|
58231
58968
|
const candidates = ["index.ts", "main.ts", "App.tsx"];
|
|
58232
|
-
usesTS = candidates.some((f3) => fs24.existsSync(
|
|
58969
|
+
usesTS = candidates.some((f3) => fs24.existsSync(path58.join(root, "src", f3)));
|
|
58233
58970
|
}
|
|
58234
|
-
const nextAppDir = usesNext && fs24.existsSync(
|
|
58971
|
+
const nextAppDir = usesNext && fs24.existsSync(path58.join(root, "app"));
|
|
58235
58972
|
const testRunner = deps["vitest"] ? "vitest" : deps["jest"] ? "jest" : null;
|
|
58236
|
-
const isMonorepo2 = fs24.existsSync(
|
|
58973
|
+
const isMonorepo2 = fs24.existsSync(path58.join(root, "pnpm-workspace.yaml")) || fs24.existsSync(path58.join(root, "packages")) || fs24.existsSync(path58.join(root, "apps"));
|
|
58237
58974
|
const packages = [];
|
|
58238
58975
|
let aliasPaths = {};
|
|
58239
58976
|
try {
|
|
@@ -58243,7 +58980,7 @@ async function scanRepo(cwd2) {
|
|
|
58243
58980
|
}
|
|
58244
58981
|
let eol = "lf";
|
|
58245
58982
|
try {
|
|
58246
|
-
const ec = await fsp.readFile(
|
|
58983
|
+
const ec = await fsp.readFile(path58.join(root, ".editorconfig"), "utf8");
|
|
58247
58984
|
if (/end_of_line\s*=\s*crlf/i.test(ec)) eol = "crlf";
|
|
58248
58985
|
if (/end_of_line\s*=\s*lf/i.test(ec)) eol = "lf";
|
|
58249
58986
|
} catch {
|
|
@@ -58262,7 +58999,7 @@ function normalizePlanItem(fp, p) {
|
|
|
58262
58999
|
const base = decideBaseDir(fp, p);
|
|
58263
59000
|
const desired = sanitize(fp.path || suggestName(fp));
|
|
58264
59001
|
const withExt = ensureExt(desired, ext2, fp.kind);
|
|
58265
|
-
const rel = base ?
|
|
59002
|
+
const rel = base ? path58.join(base, withExt) : withExt;
|
|
58266
59003
|
return { ...fp, path: rel.replace(/\\/g, "/") };
|
|
58267
59004
|
}
|
|
58268
59005
|
function decideExt(fp, p) {
|
|
@@ -58302,10 +59039,10 @@ function suggestName(fp, p) {
|
|
|
58302
59039
|
const base = (fp.description || "file").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
58303
59040
|
return base || "file";
|
|
58304
59041
|
}
|
|
58305
|
-
function guessKindByPath(
|
|
58306
|
-
if (/__tests__|\.spec\.(t|j)sx?$|^tests\//.test(
|
|
58307
|
-
if (/^docs\//.test(
|
|
58308
|
-
if (/\.(json|cjs|js|ts)$/.test(
|
|
59042
|
+
function guessKindByPath(path59) {
|
|
59043
|
+
if (/__tests__|\.spec\.(t|j)sx?$|^tests\//.test(path59)) return "test";
|
|
59044
|
+
if (/^docs\//.test(path59) || /\.md$/.test(path59)) return "doc";
|
|
59045
|
+
if (/\.(json|cjs|js|ts)$/.test(path59) && !/src\//.test(path59)) return "config";
|
|
58309
59046
|
return "source";
|
|
58310
59047
|
}
|
|
58311
59048
|
var init_PathInferencer = __esm({
|
|
@@ -58367,15 +59104,15 @@ async function validatePlan(plans, opts) {
|
|
|
58367
59104
|
skipped.push(fp.path);
|
|
58368
59105
|
continue;
|
|
58369
59106
|
}
|
|
58370
|
-
const full =
|
|
58371
|
-
if (!full.startsWith(
|
|
59107
|
+
const full = path58__namespace.default.join(opts.root, rel);
|
|
59108
|
+
if (!full.startsWith(path58__namespace.default.resolve(opts.root))) {
|
|
58372
59109
|
warnings.push(`Outside root denied: ${fp.path}`);
|
|
58373
59110
|
skipped.push(fp.path);
|
|
58374
59111
|
continue;
|
|
58375
59112
|
}
|
|
58376
59113
|
if (process.platform === "win32" || process.env.MOCK_WIN32 === "1") {
|
|
58377
59114
|
const invalidChars = /[<>:"/\\|?*]/;
|
|
58378
|
-
const name2 =
|
|
59115
|
+
const name2 = path58__namespace.default.basename(rel);
|
|
58379
59116
|
if (invalidChars.test(rel)) {
|
|
58380
59117
|
warnings.push(`Invalid characters in path (Windows): ${fp.path}`);
|
|
58381
59118
|
skipped.push(fp.path);
|
|
@@ -58414,7 +59151,7 @@ async function validatePlan(plans, opts) {
|
|
|
58414
59151
|
}
|
|
58415
59152
|
}
|
|
58416
59153
|
for (const fp of clamped) {
|
|
58417
|
-
const full =
|
|
59154
|
+
const full = path58__namespace.default.join(opts.root, fp.path);
|
|
58418
59155
|
const exists = await exists(full);
|
|
58419
59156
|
const willModify = exists;
|
|
58420
59157
|
if (willModify) {
|
|
@@ -58774,7 +59511,7 @@ async function mapAttachmentsToTargets(attached, opts) {
|
|
|
58774
59511
|
const warnings = [];
|
|
58775
59512
|
const mapped = [];
|
|
58776
59513
|
const ambiguous = [];
|
|
58777
|
-
const root =
|
|
59514
|
+
const root = path58__namespace.default.resolve(opts.root);
|
|
58778
59515
|
const maxN = Math.min(attached.length, Math.max(1, opts.maxAttachments));
|
|
58779
59516
|
const pool = attached.slice(0, maxN);
|
|
58780
59517
|
if (attached.length > maxN) warnings.push(`Attachments clamped: ${attached.length} \u2192 ${maxN}`);
|
|
@@ -58790,7 +59527,7 @@ async function mapAttachmentsToTargets(attached, opts) {
|
|
|
58790
59527
|
}
|
|
58791
59528
|
if (a.pathHint) {
|
|
58792
59529
|
const safeRel = sanitizeRel(a.pathHint);
|
|
58793
|
-
const full =
|
|
59530
|
+
const full = path58__namespace.default.join(root, safeRel);
|
|
58794
59531
|
if (!full.startsWith(root)) {
|
|
58795
59532
|
warnings.push(`Path traversal/absolute denied: ${a.pathHint}`);
|
|
58796
59533
|
} else if (!opts.allowDotfiles && hasDotSegment(safeRel)) {
|
|
@@ -58802,7 +59539,7 @@ async function mapAttachmentsToTargets(attached, opts) {
|
|
|
58802
59539
|
}
|
|
58803
59540
|
}
|
|
58804
59541
|
const name2 = a.originalName.toLowerCase();
|
|
58805
|
-
const matches = Array.from(repoFiles.values()).filter((p) =>
|
|
59542
|
+
const matches = Array.from(repoFiles.values()).filter((p) => path58__namespace.default.basename(p).toLowerCase() === name2);
|
|
58806
59543
|
if (matches.length === 1) {
|
|
58807
59544
|
mapped.push({ path: matches[0], exists: true, reason: "filename", attachment: a });
|
|
58808
59545
|
continue;
|
|
@@ -58816,7 +59553,7 @@ async function mapAttachmentsToTargets(attached, opts) {
|
|
|
58816
59553
|
for (const p of candidates.slice(0, 500)) {
|
|
58817
59554
|
let score = 0;
|
|
58818
59555
|
try {
|
|
58819
|
-
const full =
|
|
59556
|
+
const full = path58__namespace.default.join(root, p);
|
|
58820
59557
|
const body = await safeReadHeadTail(full, 20);
|
|
58821
59558
|
score = jaccard(tokens(head2), tokens(body.head)) * 0.6 + jaccard(tokens(tail), tokens(body.tail)) * 0.4;
|
|
58822
59559
|
} catch {
|
|
@@ -58873,8 +59610,8 @@ async function listRepoFiles(root) {
|
|
|
58873
59610
|
for (const e2 of entries) {
|
|
58874
59611
|
const name2 = e2.name;
|
|
58875
59612
|
if (name2 === ".git" || name2 === "node_modules" || name2 === "dist" || name2 === ".maria") continue;
|
|
58876
|
-
const full =
|
|
58877
|
-
const rel =
|
|
59613
|
+
const full = path58__namespace.default.join(dir, name2);
|
|
59614
|
+
const rel = path58__namespace.default.relative(root, full).replace(/\\/g, "/");
|
|
58878
59615
|
if (e2.isDirectory()) {
|
|
58879
59616
|
await walk2(full);
|
|
58880
59617
|
continue;
|
|
@@ -58915,10 +59652,10 @@ function jaccard(a, b) {
|
|
|
58915
59652
|
return union === 0 ? 0 : inter / union;
|
|
58916
59653
|
}
|
|
58917
59654
|
function proposePath(root, original) {
|
|
58918
|
-
const base =
|
|
58919
|
-
const src =
|
|
59655
|
+
const base = path58__namespace.default.basename(original).replace(/\s+/g, "-").replace(/[^a-zA-Z0-9._-]/g, "").toLowerCase();
|
|
59656
|
+
const src = path58__namespace.default.join(root, "src");
|
|
58920
59657
|
const dir = existsSync8(src) ? "src" : "";
|
|
58921
|
-
const rel = dir ?
|
|
59658
|
+
const rel = dir ? path58__namespace.default.join(dir, base) : base;
|
|
58922
59659
|
return rel.replace(/\\/g, "/");
|
|
58923
59660
|
}
|
|
58924
59661
|
function existsSync8(p) {
|
|
@@ -59248,9 +59985,9 @@ function languageExt(lang) {
|
|
|
59248
59985
|
async function journalResume(root, request, files) {
|
|
59249
59986
|
try {
|
|
59250
59987
|
const fs48 = await import('fs/promises');
|
|
59251
|
-
const dir =
|
|
59988
|
+
const dir = path58__namespace.default.join(root, ".maria", "memory");
|
|
59252
59989
|
await fs48.mkdir(dir, { recursive: true });
|
|
59253
|
-
const out =
|
|
59990
|
+
const out = path58__namespace.default.join(dir, "resume-plan.json");
|
|
59254
59991
|
const payload = { request, createdAt: (/* @__PURE__ */ new Date()).toISOString(), files };
|
|
59255
59992
|
await fs48.writeFile(out, JSON.stringify(payload, null, 2), "utf8");
|
|
59256
59993
|
} catch {
|
|
@@ -59681,7 +60418,7 @@ ${pretty}`);
|
|
|
59681
60418
|
const { normalizePlans: normalizePlans2 } = await Promise.resolve().then(() => (init_FilePlanBuilder(), FilePlanBuilder_exports));
|
|
59682
60419
|
const normalized = await normalizePlans2(plans, { root });
|
|
59683
60420
|
for (const p of normalized) {
|
|
59684
|
-
const exists = await this.pathExists(
|
|
60421
|
+
const exists = await this.pathExists(path58__namespace.join(root, p.path));
|
|
59685
60422
|
p.action = exists ? "modify" : "create";
|
|
59686
60423
|
}
|
|
59687
60424
|
return normalized;
|
|
@@ -59697,9 +60434,9 @@ ${pretty}`);
|
|
|
59697
60434
|
async persistLastPlan(root, plans) {
|
|
59698
60435
|
try {
|
|
59699
60436
|
const fs48 = await import('fs/promises');
|
|
59700
|
-
const p =
|
|
60437
|
+
const p = path58__namespace.join(root, ".maria");
|
|
59701
60438
|
await fs48.mkdir(p, { recursive: true });
|
|
59702
|
-
const out =
|
|
60439
|
+
const out = path58__namespace.join(p, "last-plan.json");
|
|
59703
60440
|
await fs48.writeFile(out, JSON.stringify({ createdAt: (/* @__PURE__ */ new Date()).toISOString(), plans }, null, 2), "utf8");
|
|
59704
60441
|
} catch {
|
|
59705
60442
|
}
|
|
@@ -59715,7 +60452,7 @@ ${pretty}`);
|
|
|
59715
60452
|
try {
|
|
59716
60453
|
for (const plan of plans) {
|
|
59717
60454
|
if (options.signal?.aborted) throw new Error("INTERRUPTED");
|
|
59718
|
-
const full =
|
|
60455
|
+
const full = path58__namespace.join(options.root, plan.path);
|
|
59719
60456
|
const exists = await this.pathExists(full);
|
|
59720
60457
|
if (exists && !options.overwriteAllowed) {
|
|
59721
60458
|
skipped.push(plan.path);
|
|
@@ -59724,7 +60461,7 @@ ${pretty}`);
|
|
|
59724
60461
|
continue;
|
|
59725
60462
|
}
|
|
59726
60463
|
const tmp = full + `.tmp-${process.pid}-${Date.now()}`;
|
|
59727
|
-
await fs48.mkdir(
|
|
60464
|
+
await fs48.mkdir(path58__namespace.dirname(full), { recursive: true });
|
|
59728
60465
|
await fs48.writeFile(tmp, plan.preview || "", "utf8");
|
|
59729
60466
|
await fs48.rename(tmp, full);
|
|
59730
60467
|
if (exists) modified.push(plan.path);
|
|
@@ -59737,7 +60474,7 @@ ${pretty}`);
|
|
|
59737
60474
|
if (options.rollback) {
|
|
59738
60475
|
for (const p of [...created, ...modified]) {
|
|
59739
60476
|
try {
|
|
59740
|
-
await fs48.unlink(
|
|
60477
|
+
await fs48.unlink(path58__namespace.join(options.root, p));
|
|
59741
60478
|
} catch {
|
|
59742
60479
|
}
|
|
59743
60480
|
}
|
|
@@ -59817,13 +60554,13 @@ ${pretty}`);
|
|
|
59817
60554
|
const extension = LANGUAGE_EXTENSIONS[block.language] || ".txt";
|
|
59818
60555
|
const timestamp2 = Date.now().toString(36);
|
|
59819
60556
|
const filename = index === 0 ? `${baseName}${extension}` : `${baseName}_${index + 1}${extension}`;
|
|
59820
|
-
const fullPath =
|
|
60557
|
+
const fullPath = path58__namespace.join(process.cwd(), filename);
|
|
59821
60558
|
try {
|
|
59822
60559
|
await fsp.writeFile(fullPath, block.code, "utf8");
|
|
59823
60560
|
return fullPath;
|
|
59824
60561
|
} catch (error2) {
|
|
59825
60562
|
const fallbackName = `code_${timestamp2}${extension}`;
|
|
59826
|
-
const fallbackPath =
|
|
60563
|
+
const fallbackPath = path58__namespace.join(process.cwd(), fallbackName);
|
|
59827
60564
|
await fsp.writeFile(fallbackPath, block.code, "utf8");
|
|
59828
60565
|
return fallbackPath;
|
|
59829
60566
|
}
|
|
@@ -59857,15 +60594,15 @@ ${pretty}`);
|
|
|
59857
60594
|
async collectAttachedFiles(context2) {
|
|
59858
60595
|
const list = [];
|
|
59859
60596
|
const fs48 = await import('fs/promises');
|
|
59860
|
-
const
|
|
60597
|
+
const path59 = await import('path');
|
|
59861
60598
|
const att = context2 && (context2.attachments || context2.input?.attachments) || [];
|
|
59862
60599
|
for (const a of att) {
|
|
59863
60600
|
try {
|
|
59864
60601
|
const p = a.path || a.filePath || a.name || "";
|
|
59865
|
-
const originalName = a.name ||
|
|
60602
|
+
const originalName = a.name || path59.basename(p || `attachment_${Date.now().toString(36)}`);
|
|
59866
60603
|
let content = a.content;
|
|
59867
60604
|
if (!content && p) {
|
|
59868
|
-
const abs =
|
|
60605
|
+
const abs = path59.isAbsolute(p) ? p : path59.join(process.cwd(), p);
|
|
59869
60606
|
content = await fs48.readFile(abs, "utf8");
|
|
59870
60607
|
}
|
|
59871
60608
|
if (!content) continue;
|
|
@@ -59975,7 +60712,7 @@ function getKnowledgeProviderFromEnv(root = process.cwd()) {
|
|
|
59975
60712
|
function safeListFiles(dir) {
|
|
59976
60713
|
try {
|
|
59977
60714
|
return fs24__namespace.default.readdirSync(dir, { withFileTypes: true }).flatMap((d) => {
|
|
59978
|
-
const p =
|
|
60715
|
+
const p = path58__namespace.default.join(dir, d.name);
|
|
59979
60716
|
if (d.isDirectory()) {
|
|
59980
60717
|
if (/node_modules|\.git|dist|coverage|artifacts|reports/.test(p)) return [];
|
|
59981
60718
|
return safeListFiles(p);
|
|
@@ -60011,7 +60748,7 @@ var init_KnowledgeProvider = __esm({
|
|
|
60011
60748
|
}
|
|
60012
60749
|
async getPrinciples(_projectId, _taskId) {
|
|
60013
60750
|
const candidates = [
|
|
60014
|
-
|
|
60751
|
+
path58__namespace.default.join(this.root, "docs"),
|
|
60015
60752
|
this.root
|
|
60016
60753
|
];
|
|
60017
60754
|
const out = [];
|
|
@@ -60041,7 +60778,7 @@ var init_KnowledgeProvider = __esm({
|
|
|
60041
60778
|
var resume_command_exports = {};
|
|
60042
60779
|
__export(resume_command_exports, {
|
|
60043
60780
|
ResumeCommand: () => ResumeCommand,
|
|
60044
|
-
meta: () =>
|
|
60781
|
+
meta: () => meta16
|
|
60045
60782
|
});
|
|
60046
60783
|
function truncate2(s2, n) {
|
|
60047
60784
|
return s2.length <= n ? s2 : s2.slice(0, n) + "\u2026";
|
|
@@ -60073,7 +60810,7 @@ function promptLine(timeoutMs = 15e3) {
|
|
|
60073
60810
|
}
|
|
60074
60811
|
async function readLastDebugStatusSafe(cwd2) {
|
|
60075
60812
|
try {
|
|
60076
|
-
const p =
|
|
60813
|
+
const p = path58__namespace.join(cwd2, ".maria", "memory", "debug-resume.json");
|
|
60077
60814
|
const buf = await fsp__namespace.readFile(p, "utf8");
|
|
60078
60815
|
const arr = JSON.parse(buf);
|
|
60079
60816
|
if (Array.isArray(arr) && arr.length) return arr[arr.length - 1];
|
|
@@ -60084,7 +60821,7 @@ async function readLastDebugStatusSafe(cwd2) {
|
|
|
60084
60821
|
}
|
|
60085
60822
|
async function readDebugJournalListSafe(cwd2, count) {
|
|
60086
60823
|
try {
|
|
60087
|
-
const p =
|
|
60824
|
+
const p = path58__namespace.join(cwd2, ".maria", "memory", "debug-resume.json");
|
|
60088
60825
|
const buf = await fsp__namespace.readFile(p, "utf8");
|
|
60089
60826
|
const arr = JSON.parse(buf);
|
|
60090
60827
|
if (!Array.isArray(arr) || arr.length === 0) return [];
|
|
@@ -60093,7 +60830,7 @@ async function readDebugJournalListSafe(cwd2, count) {
|
|
|
60093
60830
|
return [];
|
|
60094
60831
|
}
|
|
60095
60832
|
}
|
|
60096
|
-
var ResumeCommand,
|
|
60833
|
+
var ResumeCommand, meta16;
|
|
60097
60834
|
var init_resume_command = __esm({
|
|
60098
60835
|
"src/slash-commands/categories/workflow/resume.command.ts"() {
|
|
60099
60836
|
init_base_command();
|
|
@@ -60304,7 +61041,7 @@ var init_resume_command = __esm({
|
|
|
60304
61041
|
return cands[n - 1];
|
|
60305
61042
|
}
|
|
60306
61043
|
};
|
|
60307
|
-
|
|
61044
|
+
meta16 = {
|
|
60308
61045
|
name: "workflow/resume",
|
|
60309
61046
|
category: "implementation",
|
|
60310
61047
|
description: "Resume previous task context and propose next /code step",
|
|
@@ -60379,11 +61116,11 @@ async function runWithBudget(tasks, totalMs = 6e3, perStepMs = 600) {
|
|
|
60379
61116
|
return out;
|
|
60380
61117
|
}
|
|
60381
61118
|
function isSensitive(filepath) {
|
|
60382
|
-
const basename15 =
|
|
61119
|
+
const basename15 = path58__namespace.basename(filepath);
|
|
60383
61120
|
return SENSITIVE_PATTERNS2.some((pattern) => pattern.test(basename15) || pattern.test(filepath));
|
|
60384
61121
|
}
|
|
60385
61122
|
function isBinary2(filepath) {
|
|
60386
|
-
const ext2 =
|
|
61123
|
+
const ext2 = path58__namespace.extname(filepath).toLowerCase();
|
|
60387
61124
|
return BINARY_EXTENSIONS.has(ext2);
|
|
60388
61125
|
}
|
|
60389
61126
|
async function safeRead(file, maxBytes = 512 * 1024, maxLines = 200, signal) {
|
|
@@ -60439,15 +61176,15 @@ async function scanRoot(opts) {
|
|
|
60439
61176
|
];
|
|
60440
61177
|
for (const { name: name2, maxLines } of rootFiles) {
|
|
60441
61178
|
if (signal.aborted || remainMs() < 100) break;
|
|
60442
|
-
const filepath =
|
|
61179
|
+
const filepath = path58__namespace.join(cwd2, name2);
|
|
60443
61180
|
const result = await safeRead(filepath, 512 * 1024, maxLines, signal);
|
|
60444
61181
|
if (result.head || result.meta) {
|
|
60445
|
-
let
|
|
61182
|
+
let meta25 = result.meta || object;
|
|
60446
61183
|
if (name2 === "package.json" && result.head) {
|
|
60447
61184
|
try {
|
|
60448
61185
|
const pkg = JSON.parse(result.head);
|
|
60449
|
-
|
|
60450
|
-
...
|
|
61186
|
+
meta25 = {
|
|
61187
|
+
...meta25,
|
|
60451
61188
|
name: pkg.name,
|
|
60452
61189
|
version: pkg.version,
|
|
60453
61190
|
type: pkg.type,
|
|
@@ -60460,14 +61197,14 @@ async function scanRoot(opts) {
|
|
|
60460
61197
|
workspaces: pkg.workspaces
|
|
60461
61198
|
};
|
|
60462
61199
|
} catch (e2) {
|
|
60463
|
-
|
|
61200
|
+
meta25.parseError = true;
|
|
60464
61201
|
}
|
|
60465
61202
|
}
|
|
60466
61203
|
findings.push({
|
|
60467
61204
|
file: name2,
|
|
60468
61205
|
kind: "read",
|
|
60469
61206
|
head: result.head,
|
|
60470
|
-
meta:
|
|
61207
|
+
meta: meta25,
|
|
60471
61208
|
truncated: result.truncated
|
|
60472
61209
|
});
|
|
60473
61210
|
}
|
|
@@ -60495,7 +61232,7 @@ async function scanBuild(opts) {
|
|
|
60495
61232
|
];
|
|
60496
61233
|
for (const name2 of buildFiles) {
|
|
60497
61234
|
if (signal.aborted || remainMs() < 100) break;
|
|
60498
|
-
const filepath =
|
|
61235
|
+
const filepath = path58__namespace.join(cwd2, name2);
|
|
60499
61236
|
const result = await safeRead(filepath, 512 * 1024, 100, signal);
|
|
60500
61237
|
if (result.head || result.meta) {
|
|
60501
61238
|
findings.push({
|
|
@@ -60532,7 +61269,7 @@ async function scanQuality(opts) {
|
|
|
60532
61269
|
];
|
|
60533
61270
|
for (const name2 of qualityFiles) {
|
|
60534
61271
|
if (signal.aborted || remainMs() < 100) break;
|
|
60535
|
-
const filepath =
|
|
61272
|
+
const filepath = path58__namespace.join(cwd2, name2);
|
|
60536
61273
|
const result = await safeRead(filepath, 512 * 1024, 50, signal);
|
|
60537
61274
|
if (result.head || result.meta) {
|
|
60538
61275
|
findings.push({
|
|
@@ -60577,7 +61314,7 @@ async function scanScripts(opts) {
|
|
|
60577
61314
|
const sample = files.slice(0, 5);
|
|
60578
61315
|
for (const file of sample) {
|
|
60579
61316
|
if (signal.aborted || remainMs() < 100) break;
|
|
60580
|
-
const result = await safeRead(
|
|
61317
|
+
const result = await safeRead(path58__namespace.join(cwd2, file), 512 * 1024, 100, signal);
|
|
60581
61318
|
if (result.head || result.meta) {
|
|
60582
61319
|
findings.push({
|
|
60583
61320
|
file,
|
|
@@ -60619,7 +61356,7 @@ async function scanEntries(opts) {
|
|
|
60619
61356
|
];
|
|
60620
61357
|
for (const name2 of entryFiles) {
|
|
60621
61358
|
if (signal.aborted || remainMs() < 100) break;
|
|
60622
|
-
const filepath =
|
|
61359
|
+
const filepath = path58__namespace.join(cwd2, name2);
|
|
60623
61360
|
const result = await safeRead(filepath, 512 * 1024, 80, signal);
|
|
60624
61361
|
if (result.head || result.meta) {
|
|
60625
61362
|
findings.push({
|
|
@@ -60700,9 +61437,9 @@ function checkBinAlignment(pkg, cwd2) {
|
|
|
60700
61437
|
const bin = typeof pkg.bin === "string" ? { [pkg.name]: pkg.bin } : pkg.bin;
|
|
60701
61438
|
for (const [name2, rel] of Object.entries(bin)) {
|
|
60702
61439
|
const binPath = rel;
|
|
60703
|
-
const srcPath =
|
|
61440
|
+
const srcPath = path58__namespace.join(cwd2, binPath);
|
|
60704
61441
|
if (!fs24__namespace.existsSync(srcPath)) {
|
|
60705
|
-
const distGuess =
|
|
61442
|
+
const distGuess = path58__namespace.join(
|
|
60706
61443
|
cwd2,
|
|
60707
61444
|
"dist",
|
|
60708
61445
|
binPath.replace(/^src\//, "").replace(/^bin\//, "bin/")
|
|
@@ -60805,19 +61542,19 @@ function extractPackageInfo(findings) {
|
|
|
60805
61542
|
hasPostinstall: false
|
|
60806
61543
|
};
|
|
60807
61544
|
}
|
|
60808
|
-
const
|
|
61545
|
+
const meta25 = pkgFinding.meta;
|
|
60809
61546
|
return {
|
|
60810
|
-
name:
|
|
60811
|
-
version:
|
|
60812
|
-
type:
|
|
60813
|
-
scripts:
|
|
60814
|
-
hasPostinstall: !!
|
|
60815
|
-
bin:
|
|
60816
|
-
main:
|
|
60817
|
-
exports:
|
|
60818
|
-
dependencies:
|
|
60819
|
-
devDependencies:
|
|
60820
|
-
workspaces:
|
|
61547
|
+
name: meta25.name,
|
|
61548
|
+
version: meta25.version,
|
|
61549
|
+
type: meta25.type,
|
|
61550
|
+
scripts: meta25.scripts ? Object.keys(meta25.scripts) : [],
|
|
61551
|
+
hasPostinstall: !!meta25.scripts?.postinstall,
|
|
61552
|
+
bin: meta25.bin,
|
|
61553
|
+
main: meta25.main,
|
|
61554
|
+
exports: meta25.exports,
|
|
61555
|
+
dependencies: meta25.dependencies || [],
|
|
61556
|
+
devDependencies: meta25.devDependencies || [],
|
|
61557
|
+
workspaces: meta25.workspaces
|
|
60821
61558
|
};
|
|
60822
61559
|
}
|
|
60823
61560
|
function collectWarnings(pkg, findings, cwd2) {
|
|
@@ -60968,9 +61705,9 @@ function calculateMetrics(findings, startTime) {
|
|
|
60968
61705
|
}
|
|
60969
61706
|
function renderFinding(f3) {
|
|
60970
61707
|
const title = `### ${f3.kind.toUpperCase()} \u2014 ${f3.file}`;
|
|
60971
|
-
let
|
|
61708
|
+
let meta25 = "";
|
|
60972
61709
|
if (f3.meta && Object.keys(f3.meta).length > 0) {
|
|
60973
|
-
|
|
61710
|
+
meta25 = `
|
|
60974
61711
|
<details><summary>meta</summary>
|
|
60975
61712
|
|
|
60976
61713
|
\`\`\`json
|
|
@@ -60991,7 +61728,7 @@ ${f3.head.trim()}
|
|
|
60991
61728
|
}
|
|
60992
61729
|
const truncInfo = f3.truncated ? `
|
|
60993
61730
|
> _truncated preview_` : "";
|
|
60994
|
-
return [title,
|
|
61731
|
+
return [title, meta25, content, truncInfo, ""].join("\n");
|
|
60995
61732
|
}
|
|
60996
61733
|
function safeJsonStringify(obj) {
|
|
60997
61734
|
try {
|
|
@@ -61211,7 +61948,7 @@ async function detectMonorepoType(root) {
|
|
|
61211
61948
|
const files = await fsp__namespace.readdir(root);
|
|
61212
61949
|
if (files.includes("package.json")) {
|
|
61213
61950
|
const pkg = JSON.parse(
|
|
61214
|
-
await fsp__namespace.readFile(
|
|
61951
|
+
await fsp__namespace.readFile(path58__namespace.join(root, "package.json"), "utf8")
|
|
61215
61952
|
);
|
|
61216
61953
|
if (pkg.workspaces) {
|
|
61217
61954
|
if (files.includes("pnpm-workspace.yaml")) return "pnpm";
|
|
@@ -61234,7 +61971,7 @@ async function findWorkspaces(root, type2) {
|
|
|
61234
61971
|
try {
|
|
61235
61972
|
switch (type2) {
|
|
61236
61973
|
case "pnpm": {
|
|
61237
|
-
const wsFile =
|
|
61974
|
+
const wsFile = path58__namespace.join(root, "pnpm-workspace.yaml");
|
|
61238
61975
|
try {
|
|
61239
61976
|
const content = await fsp__namespace.readFile(wsFile, "utf8");
|
|
61240
61977
|
const patterns = content.match(/packages:\s*\n((?:\s+-\s+.+\n?)+)/);
|
|
@@ -61256,7 +61993,7 @@ async function findWorkspaces(root, type2) {
|
|
|
61256
61993
|
}
|
|
61257
61994
|
case "yarn":
|
|
61258
61995
|
case "npm": {
|
|
61259
|
-
const pkgPath =
|
|
61996
|
+
const pkgPath = path58__namespace.join(root, "package.json");
|
|
61260
61997
|
try {
|
|
61261
61998
|
const pkg = JSON.parse(await fsp__namespace.readFile(pkgPath, "utf8"));
|
|
61262
61999
|
const patterns = Array.isArray(pkg.workspaces) ? pkg.workspaces : pkg.workspaces?.packages || [];
|
|
@@ -61275,7 +62012,7 @@ async function findWorkspaces(root, type2) {
|
|
|
61275
62012
|
}
|
|
61276
62013
|
case "lerna": {
|
|
61277
62014
|
try {
|
|
61278
|
-
const lernaPath =
|
|
62015
|
+
const lernaPath = path58__namespace.join(root, "lerna.json");
|
|
61279
62016
|
const lerna = JSON.parse(await fsp__namespace.readFile(lernaPath, "utf8"));
|
|
61280
62017
|
const patterns = lerna.packages || ["packages/*"];
|
|
61281
62018
|
for (const pattern of patterns) {
|
|
@@ -61334,13 +62071,13 @@ async function findWorkspaces(root, type2) {
|
|
|
61334
62071
|
}
|
|
61335
62072
|
async function analyzeWorkspace(workspacePath, root) {
|
|
61336
62073
|
const info = {
|
|
61337
|
-
name:
|
|
62074
|
+
name: path58__namespace.basename(workspacePath),
|
|
61338
62075
|
path: workspacePath,
|
|
61339
62076
|
type: "unknown",
|
|
61340
62077
|
language: "unknown"
|
|
61341
62078
|
};
|
|
61342
62079
|
try {
|
|
61343
|
-
const pkgPath =
|
|
62080
|
+
const pkgPath = path58__namespace.join(root, workspacePath, "package.json");
|
|
61344
62081
|
const pkgContent = await safeRead(pkgPath, 512 * 1024, 1e3);
|
|
61345
62082
|
if (pkgContent.head) {
|
|
61346
62083
|
try {
|
|
@@ -61383,7 +62120,7 @@ async function analyzeWorkspace(workspacePath, root) {
|
|
|
61383
62120
|
}
|
|
61384
62121
|
const globby = await loadGlobby();
|
|
61385
62122
|
const files = await globby(["**/*.{ts,tsx,js,jsx,mjs,cjs}"], {
|
|
61386
|
-
cwd:
|
|
62123
|
+
cwd: path58__namespace.join(root, workspacePath),
|
|
61387
62124
|
deep: 2,
|
|
61388
62125
|
ignore: ["node_modules", "dist", "build"],
|
|
61389
62126
|
stats: false
|
|
@@ -61938,12 +62675,12 @@ function getModuleName(filePath) {
|
|
|
61938
62675
|
if (srcIndex >= 0 && srcIndex < parts.length - 1) {
|
|
61939
62676
|
return parts[srcIndex + 1];
|
|
61940
62677
|
}
|
|
61941
|
-
return
|
|
62678
|
+
return path58__namespace.dirname(filePath).split("/").pop() || "root";
|
|
61942
62679
|
}
|
|
61943
62680
|
function resolveLocalImport(fromFile2, importPath) {
|
|
61944
62681
|
if (!importPath.startsWith(".")) return null;
|
|
61945
|
-
const dir =
|
|
61946
|
-
const resolved =
|
|
62682
|
+
const dir = path58__namespace.dirname(fromFile2);
|
|
62683
|
+
const resolved = path58__namespace.resolve(dir, importPath);
|
|
61947
62684
|
return getModuleName(resolved);
|
|
61948
62685
|
}
|
|
61949
62686
|
function getMetricStatus(metric, value) {
|
|
@@ -62073,7 +62810,7 @@ async function extractCodeSnippets(files, projectRoot, maxSnippets, includeExamp
|
|
|
62073
62810
|
}
|
|
62074
62811
|
async function extractFileSnippet(file, projectRoot, category) {
|
|
62075
62812
|
try {
|
|
62076
|
-
const fullPath =
|
|
62813
|
+
const fullPath = path58__namespace.join(projectRoot, file.path);
|
|
62077
62814
|
const content = await safeRead(fullPath, 512 * 1024, 50);
|
|
62078
62815
|
if (!content.head) return null;
|
|
62079
62816
|
const lines = content.head.split("\n");
|
|
@@ -62084,7 +62821,7 @@ async function extractFileSnippet(file, projectRoot, category) {
|
|
|
62084
62821
|
const codeLines = lines.slice(codeStart, codeStart + 30);
|
|
62085
62822
|
return {
|
|
62086
62823
|
file: file.path,
|
|
62087
|
-
title: `${
|
|
62824
|
+
title: `${path58__namespace.basename(file.path)} - ${category}`,
|
|
62088
62825
|
description: getFileDescription(file),
|
|
62089
62826
|
code: codeLines.join("\n"),
|
|
62090
62827
|
language: file.language || "javascript",
|
|
@@ -62172,7 +62909,7 @@ function extractAPIDocumentation(files) {
|
|
|
62172
62909
|
async function extractConfigurationDetails(projectRoot) {
|
|
62173
62910
|
const details = [];
|
|
62174
62911
|
try {
|
|
62175
|
-
const pkgPath =
|
|
62912
|
+
const pkgPath = path58__namespace.join(projectRoot, "package.json");
|
|
62176
62913
|
const pkgContent = await fsp__namespace.readFile(pkgPath, "utf8");
|
|
62177
62914
|
const pkg = JSON.parse(pkgContent);
|
|
62178
62915
|
if (pkg.engines) {
|
|
@@ -62205,7 +62942,7 @@ async function extractConfigurationDetails(projectRoot) {
|
|
|
62205
62942
|
} catch {
|
|
62206
62943
|
}
|
|
62207
62944
|
try {
|
|
62208
|
-
const tsconfigPath =
|
|
62945
|
+
const tsconfigPath = path58__namespace.join(projectRoot, "tsconfig.json");
|
|
62209
62946
|
const tsconfigContent = await fsp__namespace.readFile(tsconfigPath, "utf8");
|
|
62210
62947
|
const tsconfig = JSON.parse(tsconfigContent);
|
|
62211
62948
|
if (tsconfig.compilerOptions?.strict !== void 0) {
|
|
@@ -62229,7 +62966,7 @@ async function extractConfigurationDetails(projectRoot) {
|
|
|
62229
62966
|
} catch {
|
|
62230
62967
|
}
|
|
62231
62968
|
try {
|
|
62232
|
-
const envExamplePath =
|
|
62969
|
+
const envExamplePath = path58__namespace.join(projectRoot, ".env.example");
|
|
62233
62970
|
const envContent = await fsp__namespace.readFile(envExamplePath, "utf8");
|
|
62234
62971
|
const envVars = envContent.match(/^[A-Z_]+=/gm);
|
|
62235
62972
|
if (envVars) {
|
|
@@ -63167,7 +63904,7 @@ function generateFooter3(data) {
|
|
|
63167
63904
|
}
|
|
63168
63905
|
function generateFallbackMariaMd(error2, projectPath) {
|
|
63169
63906
|
const data = {
|
|
63170
|
-
projectName:
|
|
63907
|
+
projectName: path58__namespace.basename(projectPath),
|
|
63171
63908
|
projectPath,
|
|
63172
63909
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
63173
63910
|
errors: [error2.message]
|
|
@@ -63182,13 +63919,13 @@ var init_maria_template = __esm({
|
|
|
63182
63919
|
});
|
|
63183
63920
|
async function writeAtomic(filePath, content, options = {}) {
|
|
63184
63921
|
const { encoding = "utf8", mode = 420, fsync = true, tmpDir } = options;
|
|
63185
|
-
const dir =
|
|
63186
|
-
const basename15 =
|
|
63922
|
+
const dir = path58__namespace.dirname(filePath);
|
|
63923
|
+
const basename15 = path58__namespace.basename(filePath);
|
|
63187
63924
|
const tmpSuffix = `.tmp-${Date.now()}-${crypto6.randomBytes(4).toString("hex")}`;
|
|
63188
|
-
const tmpPath = tmpDir ?
|
|
63925
|
+
const tmpPath = tmpDir ? path58__namespace.join(tmpDir, `${basename15}${tmpSuffix}`) : path58__namespace.join(dir, `${basename15}${tmpSuffix}`);
|
|
63189
63926
|
let fileHandle = null;
|
|
63190
63927
|
try {
|
|
63191
|
-
await fsp__namespace.mkdir(
|
|
63928
|
+
await fsp__namespace.mkdir(path58__namespace.dirname(tmpPath), { recursive: true });
|
|
63192
63929
|
if (Buffer.isBuffer(content)) {
|
|
63193
63930
|
await fsp__namespace.writeFile(tmpPath, content, { mode });
|
|
63194
63931
|
} else {
|
|
@@ -63908,13 +64645,13 @@ var init_initialization_manager = __esm({
|
|
|
63908
64645
|
if (!stats.isDirectory()) {
|
|
63909
64646
|
this.errors.push(`Working directory is not a directory: ${cwd2}`);
|
|
63910
64647
|
}
|
|
63911
|
-
const packagePath =
|
|
64648
|
+
const packagePath = path58__namespace.join(cwd2, "package.json");
|
|
63912
64649
|
try {
|
|
63913
64650
|
await fsp__namespace.access(packagePath);
|
|
63914
64651
|
} catch {
|
|
63915
64652
|
this.warnings.push("No package.json found in working directory");
|
|
63916
64653
|
}
|
|
63917
|
-
const gitPath =
|
|
64654
|
+
const gitPath = path58__namespace.join(cwd2, ".git");
|
|
63918
64655
|
try {
|
|
63919
64656
|
await fsp__namespace.access(gitPath);
|
|
63920
64657
|
} catch {
|
|
@@ -63966,7 +64703,7 @@ var init_initialization_manager = __esm({
|
|
|
63966
64703
|
}
|
|
63967
64704
|
async validateMonorepoConfig(cwd2) {
|
|
63968
64705
|
try {
|
|
63969
|
-
const packagePath =
|
|
64706
|
+
const packagePath = path58__namespace.join(cwd2, "package.json");
|
|
63970
64707
|
const content = await fsp__namespace.readFile(packagePath, "utf-8");
|
|
63971
64708
|
const pkg = JSON.parse(content);
|
|
63972
64709
|
if (pkg.workspaces) {
|
|
@@ -64356,7 +65093,7 @@ var init_initialization_manager = __esm({
|
|
|
64356
65093
|
async generateEnhancedMariaMd(summary, opts) {
|
|
64357
65094
|
try {
|
|
64358
65095
|
return generateMariaMd2({
|
|
64359
|
-
projectName: summary.projectName ||
|
|
65096
|
+
projectName: summary.projectName || path58__namespace.basename(opts.cwd || process.cwd()),
|
|
64360
65097
|
projectPath: opts.cwd || process.cwd(),
|
|
64361
65098
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
64362
65099
|
summary,
|
|
@@ -64377,7 +65114,7 @@ var init_initialization_manager = __esm({
|
|
|
64377
65114
|
const cwd2 = opts.cwd || process.cwd();
|
|
64378
65115
|
for (const [filename, content] of Object.entries(artifacts)) {
|
|
64379
65116
|
if (typeof content === "string") {
|
|
64380
|
-
const filePath =
|
|
65117
|
+
const filePath = path58__namespace.join(cwd2, filename);
|
|
64381
65118
|
try {
|
|
64382
65119
|
await writeAtomic(filePath, content);
|
|
64383
65120
|
this.progressTracker.addMetric(
|
|
@@ -64402,7 +65139,7 @@ var init_initialization_manager = __esm({
|
|
|
64402
65139
|
*/
|
|
64403
65140
|
async verifyOutput(opts) {
|
|
64404
65141
|
const cwd2 = opts.cwd || process.cwd();
|
|
64405
|
-
const mariaMdPath =
|
|
65142
|
+
const mariaMdPath = path58__namespace.join(cwd2, "MARIA.md");
|
|
64406
65143
|
try {
|
|
64407
65144
|
const content = await fsp__namespace.readFile(mariaMdPath, "utf-8");
|
|
64408
65145
|
const minLength = 2e3;
|
|
@@ -64435,7 +65172,7 @@ var init_initialization_manager = __esm({
|
|
|
64435
65172
|
createMinimalSummary(opts) {
|
|
64436
65173
|
const cwd2 = opts.cwd || process.cwd();
|
|
64437
65174
|
return {
|
|
64438
|
-
projectName:
|
|
65175
|
+
projectName: path58__namespace.basename(cwd2),
|
|
64439
65176
|
projectPath: cwd2,
|
|
64440
65177
|
description: "Project analysis incomplete due to errors",
|
|
64441
65178
|
techStack: {
|
|
@@ -64470,7 +65207,7 @@ var init_initialization_manager = __esm({
|
|
|
64470
65207
|
*/
|
|
64471
65208
|
async generateFallbackArtifacts(error2, opts) {
|
|
64472
65209
|
const cwd2 = opts.cwd || process.cwd();
|
|
64473
|
-
|
|
65210
|
+
path58__namespace.basename(cwd2);
|
|
64474
65211
|
const mariaMd = generateFallbackMariaMd({
|
|
64475
65212
|
});
|
|
64476
65213
|
const initReport = `# Init Report - Error Recovery Mode
|
|
@@ -64527,7 +65264,7 @@ async function safeBackup(_filePath) {
|
|
|
64527
65264
|
await fsp__namespace.copyFile(_filePath, bakPath);
|
|
64528
65265
|
if (!process.env.MARIA_INIT_QUIET) {
|
|
64529
65266
|
console.log(
|
|
64530
|
-
chalk37__default.default.gray(` \u21B3 backup: ${
|
|
65267
|
+
chalk37__default.default.gray(` \u21B3 backup: ${path58__namespace.relative(process.cwd(), bakPath)}`)
|
|
64531
65268
|
);
|
|
64532
65269
|
}
|
|
64533
65270
|
} catch {
|
|
@@ -64565,7 +65302,7 @@ async function writeArtifacts(artifacts, opts, cwd2, reporter) {
|
|
|
64565
65302
|
{ name: "INIT_SUMMARY.txt", content: artifacts.initSummaryTxt }
|
|
64566
65303
|
];
|
|
64567
65304
|
for (const { name: name2, content } of files) {
|
|
64568
|
-
const _filePath =
|
|
65305
|
+
const _filePath = path58__namespace.join(cwd2, name2);
|
|
64569
65306
|
if (await fileExists2(_filePath) && !opts.force) {
|
|
64570
65307
|
await safeBackup(_filePath);
|
|
64571
65308
|
}
|
|
@@ -64675,7 +65412,7 @@ This process will:
|
|
|
64675
65412
|
);
|
|
64676
65413
|
const artifacts = generateArtifacts(summary, findings, startTime);
|
|
64677
65414
|
const mariaMdContent = generateMariaMd2({
|
|
64678
|
-
projectName: summary.projectName ||
|
|
65415
|
+
projectName: summary.projectName || path58__namespace.basename(cwd2),
|
|
64679
65416
|
projectPath: cwd2,
|
|
64680
65417
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
64681
65418
|
summary,
|
|
@@ -64835,7 +65572,7 @@ var init_delta_detector = __esm({
|
|
|
64835
65572
|
const changes = stdout2.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => {
|
|
64836
65573
|
const [status, ...rest] = line.split(/\s+/);
|
|
64837
65574
|
const file = rest.join(" ");
|
|
64838
|
-
return { status, file:
|
|
65575
|
+
return { status, file: path58__namespace.resolve(root, file) };
|
|
64839
65576
|
});
|
|
64840
65577
|
const filtered = await this.filterFiles(
|
|
64841
65578
|
changes.map((c) => c.file),
|
|
@@ -64844,8 +65581,8 @@ var init_delta_detector = __esm({
|
|
|
64844
65581
|
);
|
|
64845
65582
|
const filteredSet = new Set(filtered);
|
|
64846
65583
|
const filteredChanges = changes.filter((c) => filteredSet.has(c.file));
|
|
64847
|
-
const deleted = filteredChanges.filter((c) => c.status === "D").map((c) =>
|
|
64848
|
-
const changed = filteredChanges.filter((c) => c.status !== "D").map((c) =>
|
|
65584
|
+
const deleted = filteredChanges.filter((c) => c.status === "D").map((c) => path58__namespace.relative(root, c.file));
|
|
65585
|
+
const changed = filteredChanges.filter((c) => c.status !== "D").map((c) => path58__namespace.relative(root, c.file));
|
|
64849
65586
|
return {
|
|
64850
65587
|
mode: "git",
|
|
64851
65588
|
ref,
|
|
@@ -64877,7 +65614,7 @@ var init_delta_detector = __esm({
|
|
|
64877
65614
|
break;
|
|
64878
65615
|
}
|
|
64879
65616
|
if (entry.mtime && entry.mtime > since) {
|
|
64880
|
-
changed.push(
|
|
65617
|
+
changed.push(path58__namespace.relative(root, entry.file));
|
|
64881
65618
|
}
|
|
64882
65619
|
if (options.maxFiles && changed.length >= options.maxFiles) {
|
|
64883
65620
|
break;
|
|
@@ -64901,7 +65638,7 @@ var init_delta_detector = __esm({
|
|
|
64901
65638
|
* Detect changes by comparing with state.json
|
|
64902
65639
|
*/
|
|
64903
65640
|
async detectByState(root, options) {
|
|
64904
|
-
const statePath =
|
|
65641
|
+
const statePath = path58__namespace.join(root, ".maria", "state.json");
|
|
64905
65642
|
let lastHashes = {};
|
|
64906
65643
|
try {
|
|
64907
65644
|
const stateContent = await fsp__namespace.readFile(statePath, "utf-8");
|
|
@@ -64917,7 +65654,7 @@ var init_delta_detector = __esm({
|
|
|
64917
65654
|
if (options.budgetMs && Date.now() - this.startTime > options.budgetMs) {
|
|
64918
65655
|
break;
|
|
64919
65656
|
}
|
|
64920
|
-
const relativePath =
|
|
65657
|
+
const relativePath = path58__namespace.relative(root, entry.file);
|
|
64921
65658
|
const hash = entry.hash || await this.hashFile(entry.file);
|
|
64922
65659
|
nowHashes[relativePath] = hash;
|
|
64923
65660
|
if (!lastHashes[relativePath] || lastHashes[relativePath] !== hash) {
|
|
@@ -64997,7 +65734,7 @@ var init_delta_detector = __esm({
|
|
|
64997
65734
|
}
|
|
64998
65735
|
const patterns = options.include || ["**/*"];
|
|
64999
65736
|
const ignore = options.exclude || [];
|
|
65000
|
-
const relativePaths = files.map((f3) =>
|
|
65737
|
+
const relativePaths = files.map((f3) => path58__namespace.relative(root, f3));
|
|
65001
65738
|
const globby = await loadGlobby();
|
|
65002
65739
|
const matched = await globby(patterns, {
|
|
65003
65740
|
cwd: root,
|
|
@@ -65022,8 +65759,8 @@ var init_delta_detector = __esm({
|
|
|
65022
65759
|
* Update state.json with new hashes
|
|
65023
65760
|
*/
|
|
65024
65761
|
async updateState(root, delta) {
|
|
65025
|
-
const statePath =
|
|
65026
|
-
await fsp__namespace.mkdir(
|
|
65762
|
+
const statePath = path58__namespace.join(root, ".maria", "state.json");
|
|
65763
|
+
await fsp__namespace.mkdir(path58__namespace.dirname(statePath), { recursive: true });
|
|
65027
65764
|
let state;
|
|
65028
65765
|
try {
|
|
65029
65766
|
const content = await fsp__namespace.readFile(statePath, "utf-8");
|
|
@@ -65048,7 +65785,7 @@ var init_delta_detector = __esm({
|
|
|
65048
65785
|
delete currentHashes[file];
|
|
65049
65786
|
});
|
|
65050
65787
|
for (const file of delta.changed) {
|
|
65051
|
-
const fullPath =
|
|
65788
|
+
const fullPath = path58__namespace.join(root, file);
|
|
65052
65789
|
try {
|
|
65053
65790
|
const hash = await this.hashFile(fullPath);
|
|
65054
65791
|
if (hash) {
|
|
@@ -65908,8 +66645,8 @@ var init_init_command = __esm({
|
|
|
65908
66645
|
async execute(options = {}) {
|
|
65909
66646
|
const startTime = Date.now();
|
|
65910
66647
|
const root = options.root || process.cwd();
|
|
65911
|
-
const stateDir =
|
|
65912
|
-
const statePath =
|
|
66648
|
+
const stateDir = path58__namespace.join(root, ".maria");
|
|
66649
|
+
const statePath = path58__namespace.join(stateDir, "state.json");
|
|
65913
66650
|
this.logger.header("MARIA /init - Enhanced Codebase Analysis");
|
|
65914
66651
|
const hasExistingState = await this.fileExists(statePath);
|
|
65915
66652
|
if (hasExistingState && !options.force) {
|
|
@@ -66034,7 +66771,7 @@ var init_init_command = __esm({
|
|
|
66034
66771
|
nodes.push({
|
|
66035
66772
|
id: file._path,
|
|
66036
66773
|
type: "file",
|
|
66037
|
-
name:
|
|
66774
|
+
name: path58__namespace.basename(file._path),
|
|
66038
66775
|
language: file.language,
|
|
66039
66776
|
size: file.size,
|
|
66040
66777
|
complexity: file.complexity
|
|
@@ -66139,7 +66876,7 @@ ${file.summary || ""}`,
|
|
|
66139
66876
|
async generateArtifacts(root, scanResult, graphResult) {
|
|
66140
66877
|
this.logger.start("artifacts", "Generating artifacts...");
|
|
66141
66878
|
const mariaMd = this.generateMariaMd(scanResult, graphResult);
|
|
66142
|
-
const mariaMdPath =
|
|
66879
|
+
const mariaMdPath = path58__namespace.join(root, "MARIA.md");
|
|
66143
66880
|
await fsp__namespace.writeFile(mariaMdPath, mariaMd, "utf-8");
|
|
66144
66881
|
const depMapJson = {
|
|
66145
66882
|
version: "3.2.2",
|
|
@@ -66156,7 +66893,7 @@ ${file.summary || ""}`,
|
|
|
66156
66893
|
edges: graphResult.edgesCreated
|
|
66157
66894
|
}
|
|
66158
66895
|
};
|
|
66159
|
-
const depMapPath =
|
|
66896
|
+
const depMapPath = path58__namespace.join(root, "DEPENDENCY_MAP.json");
|
|
66160
66897
|
await fsp__namespace.writeFile(
|
|
66161
66898
|
depMapPath,
|
|
66162
66899
|
JSON.stringify(depMapJson, null, 2),
|
|
@@ -66337,7 +67074,7 @@ Last updated: ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
|
66337
67074
|
}
|
|
66338
67075
|
async saveState(stateDir, state) {
|
|
66339
67076
|
await fsp__namespace.mkdir(stateDir, { recursive: true });
|
|
66340
|
-
const statePath =
|
|
67077
|
+
const statePath = path58__namespace.join(stateDir, "state.json");
|
|
66341
67078
|
await fsp__namespace.writeFile(statePath, JSON.stringify(state, null, 2), "utf-8");
|
|
66342
67079
|
}
|
|
66343
67080
|
async fileExists(_path) {
|
|
@@ -66565,17 +67302,17 @@ var init_GraphEngine = __esm({
|
|
|
66565
67302
|
const visited = /* @__PURE__ */ new Set();
|
|
66566
67303
|
const queue = [{ id: from, path: [from] }];
|
|
66567
67304
|
while (queue.length) {
|
|
66568
|
-
const { id, path:
|
|
67305
|
+
const { id, path: path59 } = queue.shift();
|
|
66569
67306
|
if (visited.has(id)) continue;
|
|
66570
67307
|
visited.add(id);
|
|
66571
67308
|
const neighbors = this.edges.get(id) || /* @__PURE__ */ new Set();
|
|
66572
67309
|
for (const e2 of neighbors) {
|
|
66573
67310
|
if (e2.to === to) {
|
|
66574
|
-
const res = [...
|
|
67311
|
+
const res = [...path59, to];
|
|
66575
67312
|
this.recordQueryTime(Date.now() - start);
|
|
66576
67313
|
return res;
|
|
66577
67314
|
}
|
|
66578
|
-
if (!visited.has(e2.to)) queue.push({ id: e2.to, path: [...
|
|
67315
|
+
if (!visited.has(e2.to)) queue.push({ id: e2.to, path: [...path59, e2.to] });
|
|
66579
67316
|
}
|
|
66580
67317
|
}
|
|
66581
67318
|
this.recordQueryTime(Date.now() - start);
|
|
@@ -66762,8 +67499,8 @@ var init_GraphStore = __esm({
|
|
|
66762
67499
|
accessCounter = 0;
|
|
66763
67500
|
constructor(_maxNodes = 1e4) {
|
|
66764
67501
|
this._maxNodes = _maxNodes;
|
|
66765
|
-
this.storageDir =
|
|
66766
|
-
this.graphFile =
|
|
67502
|
+
this.storageDir = path58__namespace.default.join(process.cwd(), ".maria", "graph");
|
|
67503
|
+
this.graphFile = path58__namespace.default.join(this.storageDir, "knowledge-graph.json");
|
|
66767
67504
|
this.startPeriodicSave();
|
|
66768
67505
|
}
|
|
66769
67506
|
/**
|
|
@@ -67287,8 +68024,8 @@ var init_DependencyAnalyzer = __esm({
|
|
|
67287
68024
|
*/
|
|
67288
68025
|
resolveImportPath(_importSource, fromFile2, rootDir) {
|
|
67289
68026
|
if (_importSource.startsWith("./") || _importSource.startsWith("../")) {
|
|
67290
|
-
const _fromDir =
|
|
67291
|
-
const _resolved =
|
|
68027
|
+
const _fromDir = path58__namespace.default.dirname(fromFile2);
|
|
68028
|
+
const _resolved = path58__namespace.default.resolve(_fromDir, _importSource);
|
|
67292
68029
|
for (const _ext of this.SUPPORTED_EXTENSIONS) {
|
|
67293
68030
|
if (_resolved.endsWith(_ext)) {
|
|
67294
68031
|
return _resolved;
|
|
@@ -67298,7 +68035,7 @@ var init_DependencyAnalyzer = __esm({
|
|
|
67298
68035
|
__require.resolve(_withExt);
|
|
67299
68036
|
return _withExt;
|
|
67300
68037
|
} catch {
|
|
67301
|
-
const _indexFile =
|
|
68038
|
+
const _indexFile = path58__namespace.default.join(_resolved, `index${_ext}`);
|
|
67302
68039
|
try {
|
|
67303
68040
|
__require.resolve(_indexFile);
|
|
67304
68041
|
return _indexFile;
|
|
@@ -67310,7 +68047,7 @@ var init_DependencyAnalyzer = __esm({
|
|
|
67310
68047
|
return _resolved;
|
|
67311
68048
|
}
|
|
67312
68049
|
if (!_importSource.startsWith("@") && !_importSource.includes("node_modules")) {
|
|
67313
|
-
const _resolved =
|
|
68050
|
+
const _resolved = path58__namespace.default.resolve(rootDir, _importSource);
|
|
67314
68051
|
for (const _ext of this.SUPPORTED_EXTENSIONS) {
|
|
67315
68052
|
const _withExt = _resolved + _ext;
|
|
67316
68053
|
try {
|
|
@@ -67333,7 +68070,7 @@ var init_DependencyAnalyzer = __esm({
|
|
|
67333
68070
|
try {
|
|
67334
68071
|
const _entries = await fsp__namespace.default.readdir(dir, { withFileTypes: true });
|
|
67335
68072
|
for (const entry of _entries) {
|
|
67336
|
-
const _fullPath =
|
|
68073
|
+
const _fullPath = path58__namespace.default.join(dir, entry.name);
|
|
67337
68074
|
if (entry.isDirectory()) {
|
|
67338
68075
|
if (!["node_modules", ".git", "dist", "build", ".next"].includes(
|
|
67339
68076
|
entry.name
|
|
@@ -67341,7 +68078,7 @@ var init_DependencyAnalyzer = __esm({
|
|
|
67341
68078
|
await traverse(_fullPath);
|
|
67342
68079
|
}
|
|
67343
68080
|
} else if (entry.isFile()) {
|
|
67344
|
-
const _ext =
|
|
68081
|
+
const _ext = path58__namespace.default.extname(entry.name);
|
|
67345
68082
|
if ([".ts", ".tsx", ".js", ".jsx", ".mjs"].includes(_ext)) {
|
|
67346
68083
|
files.push(_fullPath);
|
|
67347
68084
|
}
|
|
@@ -67497,7 +68234,7 @@ var init_DependencyAnalyzer = __esm({
|
|
|
67497
68234
|
return {
|
|
67498
68235
|
id: this.generateNodeId(_filePath),
|
|
67499
68236
|
type: "file",
|
|
67500
|
-
name:
|
|
68237
|
+
name: path58__namespace.default.basename(_filePath),
|
|
67501
68238
|
_path: _filePath,
|
|
67502
68239
|
metadata: {
|
|
67503
68240
|
size: _stats.size,
|
|
@@ -67537,7 +68274,7 @@ var init_DependencyAnalyzer = __esm({
|
|
|
67537
68274
|
}
|
|
67538
68275
|
}
|
|
67539
68276
|
detectLanguage(_filePath) {
|
|
67540
|
-
const _ext =
|
|
68277
|
+
const _ext = path58__namespace.default.extname(_filePath);
|
|
67541
68278
|
switch (_ext) {
|
|
67542
68279
|
case ".ts":
|
|
67543
68280
|
case ".tsx":
|
|
@@ -68335,7 +69072,7 @@ var init_KnowledgeGraphService = __esm({
|
|
|
68335
69072
|
_filePath,
|
|
68336
69073
|
depth
|
|
68337
69074
|
);
|
|
68338
|
-
const _fileName2 =
|
|
69075
|
+
const _fileName2 = path58__namespace.default.basename(_filePath);
|
|
68339
69076
|
const _relatedNodes = this.graphEngine.searchNodes(_fileName2);
|
|
68340
69077
|
const suggestions = [];
|
|
68341
69078
|
for (const node of _graphContext.nodes.slice(0, 5)) {
|
|
@@ -68649,8 +69386,8 @@ async function legacyInit(args2) {
|
|
|
68649
69386
|
const cliCwd = process.cwd();
|
|
68650
69387
|
console.log(chalk37__default.default.blue("\u{1F680} Initializing MARIA configuration..."));
|
|
68651
69388
|
const options = parseInitOptions(args2);
|
|
68652
|
-
const repoRoot =
|
|
68653
|
-
const tomlPath =
|
|
69389
|
+
const repoRoot = path58__namespace.resolve(options.root || await findRepoRoot(cliCwd));
|
|
69390
|
+
const tomlPath = path58__namespace.join(repoRoot, ".maria-code.toml");
|
|
68654
69391
|
const existingConfig = await fileExists3(tomlPath);
|
|
68655
69392
|
if (existingConfig && !args2.includes("--force")) {
|
|
68656
69393
|
const result = await prompts__default.default({
|
|
@@ -68664,7 +69401,7 @@ async function legacyInit(args2) {
|
|
|
68664
69401
|
return "exit";
|
|
68665
69402
|
}
|
|
68666
69403
|
await safeBackup2(tomlPath);
|
|
68667
|
-
const mdPath2 =
|
|
69404
|
+
const mdPath2 = path58__namespace.join(repoRoot, "MARIA.md");
|
|
68668
69405
|
if (await fileExists3(mdPath2)) {
|
|
68669
69406
|
await safeBackup2(mdPath2);
|
|
68670
69407
|
}
|
|
@@ -68678,35 +69415,35 @@ async function legacyInit(args2) {
|
|
|
68678
69415
|
const tomlContent = generateTomlConfig(projectConfig);
|
|
68679
69416
|
try {
|
|
68680
69417
|
const tomlStatus = await safeWriteIfChanged(tomlPath, tomlContent);
|
|
68681
|
-
const rel =
|
|
69418
|
+
const rel = path58__namespace.relative(cliCwd, tomlPath);
|
|
68682
69419
|
if (tomlStatus.status === "up-to-date") {
|
|
68683
69420
|
console.log(chalk37__default.default.gray(`\u2139\uFE0F Up-to-date: ${rel}`));
|
|
68684
69421
|
} else if (tomlStatus.status === "created") {
|
|
68685
69422
|
console.log(chalk37__default.default.green(`\u2705 Created: ${rel}`));
|
|
68686
69423
|
} else if (tomlStatus.status === "updated") {
|
|
68687
|
-
console.log(chalk37__default.default.green(`\u2705 Updated: ${rel}`) + (tomlStatus.backup ? chalk37__default.default.gray(` (backup: ${
|
|
69424
|
+
console.log(chalk37__default.default.green(`\u2705 Updated: ${rel}`) + (tomlStatus.backup ? chalk37__default.default.gray(` (backup: ${path58__namespace.relative(cliCwd, tomlStatus.backup)})`) : ""));
|
|
68688
69425
|
}
|
|
68689
69426
|
} catch (e2) {
|
|
68690
69427
|
console.error(chalk37__default.default.red("\u274C Failed to write .maria-code.toml:"), adviceFromFsError(e2));
|
|
68691
69428
|
}
|
|
68692
|
-
const mdPath =
|
|
69429
|
+
const mdPath = path58__namespace.join(repoRoot, "MARIA.md");
|
|
68693
69430
|
const lang = resolveLang(options.lang);
|
|
68694
69431
|
const mdContent = generateMariaMd3(projectConfig, lang);
|
|
68695
69432
|
try {
|
|
68696
69433
|
const mdStatus = await safeWriteIfChanged(mdPath, mdContent);
|
|
68697
|
-
const rel =
|
|
69434
|
+
const rel = path58__namespace.relative(cliCwd, mdPath);
|
|
68698
69435
|
if (mdStatus.status === "up-to-date") {
|
|
68699
69436
|
console.log(chalk37__default.default.gray(`Saved: ${rel} (up-to-date)`));
|
|
68700
69437
|
} else if (mdStatus.status === "created") {
|
|
68701
69438
|
console.log(chalk37__default.default.green(`Saved: ${rel} (created)`));
|
|
68702
69439
|
} else if (mdStatus.status === "updated") {
|
|
68703
|
-
const bakRel = mdStatus.backup ?
|
|
69440
|
+
const bakRel = mdStatus.backup ? path58__namespace.relative(cliCwd, mdStatus.backup) : void 0;
|
|
68704
69441
|
console.log(chalk37__default.default.green(`Saved: ${rel} (updated${bakRel ? `, backup: ${bakRel}` : ""})`));
|
|
68705
69442
|
}
|
|
68706
69443
|
} catch (e2) {
|
|
68707
69444
|
console.error(chalk37__default.default.red("\u274C Failed to write MARIA.md:"), adviceFromFsError(e2));
|
|
68708
69445
|
}
|
|
68709
|
-
if (projectConfig.gitInit && !await fileExists3(
|
|
69446
|
+
if (projectConfig.gitInit && !await fileExists3(path58__namespace.join(repoRoot, ".git"))) {
|
|
68710
69447
|
try {
|
|
68711
69448
|
const { execSync } = await import('child_process');
|
|
68712
69449
|
execSync("git init", { cwd: repoRoot, stdio: "pipe" });
|
|
@@ -68740,13 +69477,13 @@ async function safeBackup2(_filePath) {
|
|
|
68740
69477
|
const bakPath = `${_filePath}.bak.${stamp}`;
|
|
68741
69478
|
await fsp__namespace.copyFile(_filePath, bakPath);
|
|
68742
69479
|
console.log(
|
|
68743
|
-
chalk37__default.default.gray(` \u21B3 backup: ${
|
|
69480
|
+
chalk37__default.default.gray(` \u21B3 backup: ${path58__namespace.relative(process.cwd(), bakPath)}`)
|
|
68744
69481
|
);
|
|
68745
69482
|
} catch {
|
|
68746
69483
|
}
|
|
68747
69484
|
}
|
|
68748
69485
|
async function interactiveSetup() {
|
|
68749
|
-
const packageJsonPath =
|
|
69486
|
+
const packageJsonPath = path58__namespace.join(process.cwd(), "package.json");
|
|
68750
69487
|
let packageJson2 = {};
|
|
68751
69488
|
try {
|
|
68752
69489
|
const packageData = await fsp__namespace.readFile(packageJsonPath, "utf-8");
|
|
@@ -68758,7 +69495,7 @@ async function interactiveSetup() {
|
|
|
68758
69495
|
type: "text",
|
|
68759
69496
|
name: "name",
|
|
68760
69497
|
message: "Project name:",
|
|
68761
|
-
initial: packageJson2.name ||
|
|
69498
|
+
initial: packageJson2.name || path58__namespace.basename(process.cwd())
|
|
68762
69499
|
},
|
|
68763
69500
|
{
|
|
68764
69501
|
type: "select",
|
|
@@ -68802,7 +69539,7 @@ async function interactiveSetup() {
|
|
|
68802
69539
|
}
|
|
68803
69540
|
function getDefaultConfig() {
|
|
68804
69541
|
return {
|
|
68805
|
-
name:
|
|
69542
|
+
name: path58__namespace.basename(process.cwd()),
|
|
68806
69543
|
type: "auto",
|
|
68807
69544
|
description: "AI-powered development project using MARIA",
|
|
68808
69545
|
author: "",
|
|
@@ -68983,13 +69720,13 @@ function resolveLang(input3) {
|
|
|
68983
69720
|
return "en";
|
|
68984
69721
|
}
|
|
68985
69722
|
async function findRepoRoot(startDir) {
|
|
68986
|
-
let dir =
|
|
69723
|
+
let dir = path58__namespace.resolve(startDir);
|
|
68987
69724
|
let lastGitDir = null;
|
|
68988
69725
|
while (true) {
|
|
68989
|
-
const gitPath =
|
|
69726
|
+
const gitPath = path58__namespace.join(dir, ".git");
|
|
68990
69727
|
const hasGit = await fileExists3(gitPath);
|
|
68991
69728
|
if (hasGit) lastGitDir = dir;
|
|
68992
|
-
const parent =
|
|
69729
|
+
const parent = path58__namespace.dirname(dir);
|
|
68993
69730
|
if (parent === dir) break;
|
|
68994
69731
|
dir = parent;
|
|
68995
69732
|
}
|
|
@@ -69071,8 +69808,8 @@ var init_update_command = __esm({
|
|
|
69071
69808
|
async execute(options = {}) {
|
|
69072
69809
|
const startTime = Date.now();
|
|
69073
69810
|
const root = options.root || process.cwd();
|
|
69074
|
-
const stateDir =
|
|
69075
|
-
const statePath =
|
|
69811
|
+
const stateDir = path58__namespace.join(root, ".maria");
|
|
69812
|
+
const statePath = path58__namespace.join(stateDir, "state.json");
|
|
69076
69813
|
this.reporter.thinking(`Performing incremental update to detect and process changes.
|
|
69077
69814
|
This will:
|
|
69078
69815
|
- Detect file changes since last update
|
|
@@ -69242,12 +69979,12 @@ This will:
|
|
|
69242
69979
|
};
|
|
69243
69980
|
const result = await this.deltaDetector.detectDelta(root, deltaOptions);
|
|
69244
69981
|
const files = [
|
|
69245
|
-
...result.changed.map((
|
|
69246
|
-
_path:
|
|
69247
|
-
type: previousState?.fileHashes?.[
|
|
69982
|
+
...result.changed.map((path59) => ({
|
|
69983
|
+
_path: path59,
|
|
69984
|
+
type: previousState?.fileHashes?.[path59] ? "modified" : "added"
|
|
69248
69985
|
})),
|
|
69249
|
-
...result.deleted.map((
|
|
69250
|
-
_path:
|
|
69986
|
+
...result.deleted.map((path59) => ({
|
|
69987
|
+
_path: path59,
|
|
69251
69988
|
type: "deleted"
|
|
69252
69989
|
}))
|
|
69253
69990
|
];
|
|
@@ -69364,7 +70101,7 @@ This will:
|
|
|
69364
70101
|
nodeUpdates.push({
|
|
69365
70102
|
id: file._path,
|
|
69366
70103
|
type: "file",
|
|
69367
|
-
name:
|
|
70104
|
+
name: path58__namespace.basename(file._path),
|
|
69368
70105
|
language: file.language,
|
|
69369
70106
|
size: file.size,
|
|
69370
70107
|
complexity: file.complexity,
|
|
@@ -69464,7 +70201,7 @@ ${file.summary || ""}`,
|
|
|
69464
70201
|
*/
|
|
69465
70202
|
async updateArtifacts(root, deltaResult, processResult) {
|
|
69466
70203
|
this.logger.start("artifacts", "Updating artifacts...");
|
|
69467
|
-
const mariaMdPath =
|
|
70204
|
+
const mariaMdPath = path58__namespace.join(root, "MARIA.md");
|
|
69468
70205
|
let existingContent = "";
|
|
69469
70206
|
try {
|
|
69470
70207
|
existingContent = await fsp__namespace.readFile(mariaMdPath, "utf-8");
|
|
@@ -69478,7 +70215,7 @@ ${file.summary || ""}`,
|
|
|
69478
70215
|
);
|
|
69479
70216
|
await fsp__namespace.writeFile(mariaMdPath, updatedMariaMd, "utf-8");
|
|
69480
70217
|
this.reporter.write("MARIA.md", updatedMariaMd.length);
|
|
69481
|
-
const depMapPath =
|
|
70218
|
+
const depMapPath = path58__namespace.join(root, "DEPENDENCY_MAP.json");
|
|
69482
70219
|
try {
|
|
69483
70220
|
const existingDepMap = JSON.parse(await fsp__namespace.readFile(depMapPath, "utf-8"));
|
|
69484
70221
|
this.reporter.read(
|
|
@@ -69597,7 +70334,7 @@ ${delta.modified > 5 ? `... and ${delta.modified - 5} more` : ""}
|
|
|
69597
70334
|
}
|
|
69598
70335
|
}
|
|
69599
70336
|
async saveState(statePath, state) {
|
|
69600
|
-
const dir =
|
|
70337
|
+
const dir = path58__namespace.dirname(statePath);
|
|
69601
70338
|
await fsp__namespace.mkdir(dir, { recursive: true });
|
|
69602
70339
|
if (state.fileHashes instanceof Map) {
|
|
69603
70340
|
state.fileHashes = Object.fromEntries(state.fileHashes);
|
|
@@ -69751,9 +70488,9 @@ var init_update = __esm({
|
|
|
69751
70488
|
var UpdateCommand_exports = {};
|
|
69752
70489
|
__export(UpdateCommand_exports, {
|
|
69753
70490
|
UpdateCommand: () => UpdateCommand2,
|
|
69754
|
-
meta: () =>
|
|
70491
|
+
meta: () => meta17
|
|
69755
70492
|
});
|
|
69756
|
-
var UpdateCommand2,
|
|
70493
|
+
var UpdateCommand2, meta17;
|
|
69757
70494
|
var init_UpdateCommand = __esm({
|
|
69758
70495
|
"src/slash-commands/categories/core/handlers/UpdateCommand.ts"() {
|
|
69759
70496
|
init_base_command();
|
|
@@ -69904,7 +70641,7 @@ var init_UpdateCommand = __esm({
|
|
|
69904
70641
|
return errors;
|
|
69905
70642
|
}
|
|
69906
70643
|
};
|
|
69907
|
-
|
|
70644
|
+
meta17 = {
|
|
69908
70645
|
name: "update",
|
|
69909
70646
|
category: "core",
|
|
69910
70647
|
description: "Update project dependencies, configurations, and system components",
|
|
@@ -70018,7 +70755,7 @@ var init_ResearchCommand = __esm({
|
|
|
70018
70755
|
constructor() {
|
|
70019
70756
|
super();
|
|
70020
70757
|
this.contentExtractor = new ContentExtractor();
|
|
70021
|
-
this.knowledgeBasePath =
|
|
70758
|
+
this.knowledgeBasePath = path58__namespace.default.join(os16__namespace.default.homedir(), ".maria", "knowledge-base");
|
|
70022
70759
|
}
|
|
70023
70760
|
async initialize() {
|
|
70024
70761
|
try {
|
|
@@ -70549,7 +71286,7 @@ ${JSON.stringify(_result, null, 2)}
|
|
|
70549
71286
|
readingTime: _content.metadata.readingTime
|
|
70550
71287
|
}
|
|
70551
71288
|
};
|
|
70552
|
-
const _entryPath =
|
|
71289
|
+
const _entryPath = path58__namespace.default.join(this.knowledgeBasePath, "entries", `${id}.json`);
|
|
70553
71290
|
await fsp__namespace.default.writeFile(_entryPath, JSON.stringify(_entry, null, 2));
|
|
70554
71291
|
await this.updateKnowledgeBaseIndex(_entry);
|
|
70555
71292
|
logger.info(`Saved to knowledge base: ${id}`);
|
|
@@ -70560,7 +71297,7 @@ ${JSON.stringify(_result, null, 2)}
|
|
|
70560
71297
|
}
|
|
70561
71298
|
}
|
|
70562
71299
|
async updateKnowledgeBaseIndex(_entry) {
|
|
70563
|
-
const _indexPath =
|
|
71300
|
+
const _indexPath = path58__namespace.default.join(this.knowledgeBasePath, "index.json");
|
|
70564
71301
|
try {
|
|
70565
71302
|
const _indexContent = await fsp__namespace.default.readFile(_indexPath, "utf-8");
|
|
70566
71303
|
const _index = JSON.parse(_indexContent);
|
|
@@ -70580,7 +71317,7 @@ ${JSON.stringify(_result, null, 2)}
|
|
|
70580
71317
|
async ensureKnowledgeBaseDirectory() {
|
|
70581
71318
|
try {
|
|
70582
71319
|
await fsp__namespace.default.mkdir(this.knowledgeBasePath, { recursive: true });
|
|
70583
|
-
await fsp__namespace.default.mkdir(
|
|
71320
|
+
await fsp__namespace.default.mkdir(path58__namespace.default.join(this.knowledgeBasePath, "entries"), { recursive: true });
|
|
70584
71321
|
} catch (innerError) {
|
|
70585
71322
|
logger.error("Failed to create knowledge base directory:", error);
|
|
70586
71323
|
}
|
|
@@ -70648,7 +71385,7 @@ ${JSON.stringify(_result, null, 2)}
|
|
|
70648
71385
|
`;
|
|
70649
71386
|
}
|
|
70650
71387
|
try {
|
|
70651
|
-
const _indexPath =
|
|
71388
|
+
const _indexPath = path58__namespace.default.join(this.knowledgeBasePath, "index.json");
|
|
70652
71389
|
const _indexContent = await fsp__namespace.default.readFile(_indexPath, "utf-8");
|
|
70653
71390
|
const _index = JSON.parse(_indexContent);
|
|
70654
71391
|
message += `**Knowledge Base**: \u2705 Available
|
|
@@ -70713,9 +71450,9 @@ var l2r_command_exports = {};
|
|
|
70713
71450
|
__export(l2r_command_exports, {
|
|
70714
71451
|
L2RCommand: () => L2RCommand,
|
|
70715
71452
|
default: () => l2r_command_default,
|
|
70716
|
-
meta: () =>
|
|
71453
|
+
meta: () => meta18
|
|
70717
71454
|
});
|
|
70718
|
-
var L2RCommand,
|
|
71455
|
+
var L2RCommand, meta18, l2r_command_default;
|
|
70719
71456
|
var init_l2r_command = __esm({
|
|
70720
71457
|
"src/slash-commands/categories/learning/l2r.command.ts"() {
|
|
70721
71458
|
init_base_command();
|
|
@@ -71712,7 +72449,7 @@ var init_l2r_command = __esm({
|
|
|
71712
72449
|
return { success: true };
|
|
71713
72450
|
}
|
|
71714
72451
|
};
|
|
71715
|
-
|
|
72452
|
+
meta18 = {
|
|
71716
72453
|
name: "l2r",
|
|
71717
72454
|
category: "learning",
|
|
71718
72455
|
description: "\u{1F3AF} Learning-to-Rank system with 44-dimension features and model training *GPU needed - Local LLM only (Pro+ members only)",
|
|
@@ -71736,9 +72473,9 @@ var search_command_exports = {};
|
|
|
71736
72473
|
__export(search_command_exports, {
|
|
71737
72474
|
GraphRAGSearchCommand: () => GraphRAGSearchCommand,
|
|
71738
72475
|
default: () => search_command_default,
|
|
71739
|
-
meta: () =>
|
|
72476
|
+
meta: () => meta19
|
|
71740
72477
|
});
|
|
71741
|
-
var GraphRAGSearchCommand,
|
|
72478
|
+
var GraphRAGSearchCommand, meta19, search_command_default;
|
|
71742
72479
|
var init_search_command = __esm({
|
|
71743
72480
|
"src/slash-commands/categories/graphrag/search.command.ts"() {
|
|
71744
72481
|
init_base_command();
|
|
@@ -72151,7 +72888,7 @@ var init_search_command = __esm({
|
|
|
72151
72888
|
return { success: true };
|
|
72152
72889
|
}
|
|
72153
72890
|
};
|
|
72154
|
-
|
|
72891
|
+
meta19 = {
|
|
72155
72892
|
name: "search",
|
|
72156
72893
|
category: "graphrag",
|
|
72157
72894
|
description: "\u{1F50D} Graph RAG search with BM25, vector, and knowledge graph hybrid search *GPU needed - Local LLM only (Pro+ members only)",
|
|
@@ -72174,9 +72911,9 @@ var language_command_exports = {};
|
|
|
72174
72911
|
__export(language_command_exports, {
|
|
72175
72912
|
LanguageCommand: () => LanguageCommand,
|
|
72176
72913
|
default: () => language_command_default,
|
|
72177
|
-
meta: () =>
|
|
72914
|
+
meta: () => meta20
|
|
72178
72915
|
});
|
|
72179
|
-
var LanguageCommand,
|
|
72916
|
+
var LanguageCommand, meta20, language_command_default;
|
|
72180
72917
|
var init_language_command = __esm({
|
|
72181
72918
|
"src/slash-commands/categories/multilingual/language.command.ts"() {
|
|
72182
72919
|
init_base_command();
|
|
@@ -72866,7 +73603,7 @@ var init_language_command = __esm({
|
|
|
72866
73603
|
return { success: true };
|
|
72867
73604
|
}
|
|
72868
73605
|
};
|
|
72869
|
-
|
|
73606
|
+
meta20 = {
|
|
72870
73607
|
name: "language",
|
|
72871
73608
|
category: "multilingual",
|
|
72872
73609
|
description: "\u{1F30D} Language detection, weights configuration, and multilingual processing",
|
|
@@ -72923,8 +73660,8 @@ async function checkShield(commandName, userPlan = "free") {
|
|
|
72923
73660
|
async function loadManifest() {
|
|
72924
73661
|
try {
|
|
72925
73662
|
const fs48 = await import('fs');
|
|
72926
|
-
const
|
|
72927
|
-
const manifestPath =
|
|
73663
|
+
const path59 = await import('path');
|
|
73664
|
+
const manifestPath = path59.join(
|
|
72928
73665
|
__dirname,
|
|
72929
73666
|
"../command-manifest-v2.1.json"
|
|
72930
73667
|
);
|
|
@@ -73147,14 +73884,14 @@ var sales_dashboard_command_exports = {};
|
|
|
73147
73884
|
__export(sales_dashboard_command_exports, {
|
|
73148
73885
|
SalesDashboardCommand: () => SalesDashboardCommand,
|
|
73149
73886
|
default: () => sales_dashboard_command_default,
|
|
73150
|
-
meta: () =>
|
|
73887
|
+
meta: () => meta21
|
|
73151
73888
|
});
|
|
73152
|
-
var
|
|
73889
|
+
var meta21, SalesDashboardCommand, sales_dashboard_command_default;
|
|
73153
73890
|
var init_sales_dashboard_command = __esm({
|
|
73154
73891
|
"src/slash-commands/categories/business/sales-dashboard.command.ts"() {
|
|
73155
73892
|
init_BaseCommand();
|
|
73156
73893
|
init_deps();
|
|
73157
|
-
|
|
73894
|
+
meta21 = {
|
|
73158
73895
|
name: "sales-dashboard",
|
|
73159
73896
|
category: "business",
|
|
73160
73897
|
description: "Interactive TUI sales dashboard with real-time updates",
|
|
@@ -73163,11 +73900,11 @@ var init_sales_dashboard_command = __esm({
|
|
|
73163
73900
|
status: "stable"
|
|
73164
73901
|
};
|
|
73165
73902
|
SalesDashboardCommand = class extends BaseCommand2 {
|
|
73166
|
-
meta =
|
|
73903
|
+
meta = meta21;
|
|
73167
73904
|
async execute(args2, context2) {
|
|
73168
73905
|
const options = this.parseOptions(args2);
|
|
73169
73906
|
return withDependencyGuard(
|
|
73170
|
-
|
|
73907
|
+
meta21.deps || [],
|
|
73171
73908
|
async () => this.executeWithRealData(options, context2),
|
|
73172
73909
|
() => this.executeWithMockData(options)
|
|
73173
73910
|
);
|
|
@@ -73441,9 +74178,9 @@ var gpu_command_exports = {};
|
|
|
73441
74178
|
__export(gpu_command_exports, {
|
|
73442
74179
|
GPUCommand: () => GPUCommand,
|
|
73443
74180
|
default: () => gpu_command_default,
|
|
73444
|
-
meta: () =>
|
|
74181
|
+
meta: () => meta22
|
|
73445
74182
|
});
|
|
73446
|
-
var GPUCommand,
|
|
74183
|
+
var GPUCommand, meta22, gpu_command_default;
|
|
73447
74184
|
var init_gpu_command = __esm({
|
|
73448
74185
|
"src/slash-commands/categories/ai/gpu.command.ts"() {
|
|
73449
74186
|
init_base_command();
|
|
@@ -74005,7 +74742,7 @@ var init_gpu_command = __esm({
|
|
|
74005
74742
|
return { success: true };
|
|
74006
74743
|
}
|
|
74007
74744
|
};
|
|
74008
|
-
|
|
74745
|
+
meta22 = {
|
|
74009
74746
|
name: "gpu",
|
|
74010
74747
|
category: "ai",
|
|
74011
74748
|
description: "GPU status, benchmarking, and management capabilities *GPU needed - Local LLM only (Pro+ members only)",
|
|
@@ -74036,6 +74773,7 @@ __export(slash_commands_exports, {
|
|
|
74036
74773
|
ExitCommand: () => ExitCommand,
|
|
74037
74774
|
ForgetCommand: () => ForgetCommand,
|
|
74038
74775
|
HelpCommand: () => HelpCommand,
|
|
74776
|
+
IdentityCommand: () => IdentityCommand,
|
|
74039
74777
|
ImageCommand: () => ImageCommand,
|
|
74040
74778
|
LoggingMiddleware: () => LoggingMiddleware,
|
|
74041
74779
|
LogoutCommand: () => LogoutCommand,
|
|
@@ -74116,6 +74854,14 @@ async function registerBuiltInCommands() {
|
|
|
74116
74854
|
} catch (aboutError) {
|
|
74117
74855
|
console.error("Failed to register about command:", aboutError);
|
|
74118
74856
|
}
|
|
74857
|
+
try {
|
|
74858
|
+
const { IdentityCommand: IdentityCommand2 } = await Promise.resolve().then(() => (init_identity_command(), identity_command_exports));
|
|
74859
|
+
const identityCommand = new IdentityCommand2();
|
|
74860
|
+
if (identityCommand.initialize) await identityCommand.initialize();
|
|
74861
|
+
commandRegistry.register(identityCommand);
|
|
74862
|
+
} catch (identityError) {
|
|
74863
|
+
console.error("Failed to register identity command:", identityError);
|
|
74864
|
+
}
|
|
74119
74865
|
const { StatusCommandV2: StatusCommandV22 } = await Promise.resolve().then(() => (init_StatusCommand(), StatusCommand_exports));
|
|
74120
74866
|
const { DoctorCommand: DoctorCommand2 } = await Promise.resolve().then(() => (init_DoctorCommand(), DoctorCommand_exports));
|
|
74121
74867
|
const { TerminalSetupCommand: TerminalSetupCommand2 } = await Promise.resolve().then(() => (init_TerminalSetupCommand(), TerminalSetupCommand_exports));
|
|
@@ -74568,6 +75314,7 @@ var init_slash_commands = __esm({
|
|
|
74568
75314
|
init_UsageCommand();
|
|
74569
75315
|
init_PlanCommand();
|
|
74570
75316
|
init_WhoAmICommand();
|
|
75317
|
+
init_identity_command();
|
|
74571
75318
|
init_registry();
|
|
74572
75319
|
}
|
|
74573
75320
|
});
|
|
@@ -74612,10 +75359,10 @@ var init_ImageCommand = __esm({
|
|
|
74612
75359
|
const height = m2 ? parseInt(m2[2], 10) : 1024;
|
|
74613
75360
|
const format = String(options.format || "png");
|
|
74614
75361
|
const res = await provider.generateImage({ prompt, width, height, format });
|
|
74615
|
-
const
|
|
75362
|
+
const path59 = __require("path");
|
|
74616
75363
|
const fs48 = await import('fs/promises');
|
|
74617
|
-
const outPath =
|
|
74618
|
-
await fs48.mkdir(
|
|
75364
|
+
const outPath = path59.join(process.cwd(), "outputs", "images", `image_${Date.now()}.png`);
|
|
75365
|
+
await fs48.mkdir(path59.dirname(outPath), { recursive: true });
|
|
74619
75366
|
await fs48.writeFile(outPath, res.bytes);
|
|
74620
75367
|
return { success: true, output: `OK: Saved image \u2192 ${outPath}` };
|
|
74621
75368
|
} catch (e2) {
|
|
@@ -74667,12 +75414,12 @@ var init_VideoCommand = __esm({
|
|
|
74667
75414
|
const fps = Math.max(1, parseInt(getVal("fps", "8"), 10) || 8);
|
|
74668
75415
|
const duration = Math.max(1, parseInt(getVal("duration", "2"), 10) || 2);
|
|
74669
75416
|
const frames = await provider.generateVideoFrames({ prompt, width: 640, height: 360, fps, duration, format: "mp4" });
|
|
74670
|
-
const
|
|
75417
|
+
const path59 = __require("path");
|
|
74671
75418
|
const fs48 = await import('fs/promises');
|
|
74672
|
-
const dir =
|
|
75419
|
+
const dir = path59.join(process.cwd(), "outputs", "videos", `video_${Date.now()}`);
|
|
74673
75420
|
await fs48.mkdir(dir, { recursive: true });
|
|
74674
75421
|
const framePattern = "frame_%04d.png";
|
|
74675
|
-
await Promise.all(frames.frames.map((buf, i2) => fs48.writeFile(
|
|
75422
|
+
await Promise.all(frames.frames.map((buf, i2) => fs48.writeFile(path59.join(dir, `frame_${i2.toString().padStart(4, "0")}.png`), buf)));
|
|
74676
75423
|
const wantMerge = has("merge") || has("mp4");
|
|
74677
75424
|
if (wantMerge && process.env.CI !== "true" && process.env.MARIA_TEST_MODE !== "1") {
|
|
74678
75425
|
const ok = await this.mergeWithFFmpeg(dir, framePattern, fps).catch(() => false);
|
|
@@ -74689,8 +75436,8 @@ var init_VideoCommand = __esm({
|
|
|
74689
75436
|
if (!available) return false;
|
|
74690
75437
|
return new Promise((resolve18) => {
|
|
74691
75438
|
const { spawn: spawn4 } = __require("child_process");
|
|
74692
|
-
const
|
|
74693
|
-
const out =
|
|
75439
|
+
const path59 = __require("path");
|
|
75440
|
+
const out = path59.join(dir, "video.mp4");
|
|
74694
75441
|
const ffmpeg = spawn4("ffmpeg", ["-y", "-framerate", String(fps), "-i", pattern, "-pix_fmt", "yuv420p", out], { cwd: dir, stdio: "ignore" });
|
|
74695
75442
|
let done = false;
|
|
74696
75443
|
ffmpeg.on("error", () => {
|
|
@@ -74945,9 +75692,9 @@ var init_model_selector_ui = __esm({
|
|
|
74945
75692
|
var ModelCommand_exports = {};
|
|
74946
75693
|
__export(ModelCommand_exports, {
|
|
74947
75694
|
ModelCommand: () => ModelCommand,
|
|
74948
|
-
meta: () =>
|
|
75695
|
+
meta: () => meta23
|
|
74949
75696
|
});
|
|
74950
|
-
var ModelCommand,
|
|
75697
|
+
var ModelCommand, meta23;
|
|
74951
75698
|
var init_ModelCommand = __esm({
|
|
74952
75699
|
"src/slash-commands/categories/configuration/handlers/ModelCommand.ts"() {
|
|
74953
75700
|
init_base_command();
|
|
@@ -76208,7 +76955,7 @@ ${model.description}
|
|
|
76208
76955
|
}
|
|
76209
76956
|
}
|
|
76210
76957
|
};
|
|
76211
|
-
|
|
76958
|
+
meta23 = {
|
|
76212
76959
|
name: "model",
|
|
76213
76960
|
category: "configuration",
|
|
76214
76961
|
description: "Manages AI model configuration and selection",
|
|
@@ -76229,9 +76976,9 @@ ${model.description}
|
|
|
76229
76976
|
var ConfigCommand_exports = {};
|
|
76230
76977
|
__export(ConfigCommand_exports, {
|
|
76231
76978
|
ConfigCommand: () => ConfigCommand2,
|
|
76232
|
-
meta: () =>
|
|
76979
|
+
meta: () => meta24
|
|
76233
76980
|
});
|
|
76234
|
-
var ConfigCommand2,
|
|
76981
|
+
var ConfigCommand2, meta24;
|
|
76235
76982
|
var init_ConfigCommand2 = __esm({
|
|
76236
76983
|
"src/slash-commands/categories/configuration/handlers/ConfigCommand.ts"() {
|
|
76237
76984
|
init_BaseCommand();
|
|
@@ -76420,8 +77167,8 @@ var init_ConfigCommand2 = __esm({
|
|
|
76420
77167
|
validate: (v) => typeof v === "string"
|
|
76421
77168
|
}
|
|
76422
77169
|
};
|
|
76423
|
-
globalConfigPath =
|
|
76424
|
-
localConfigPath =
|
|
77170
|
+
globalConfigPath = path58__namespace.default.join(os16__namespace.default.homedir(), ".maria", "config.json");
|
|
77171
|
+
localConfigPath = path58__namespace.default.join(process.cwd(), ".maria-config.json");
|
|
76425
77172
|
async execute(_args, context2) {
|
|
76426
77173
|
try {
|
|
76427
77174
|
const _startTime = Date.now();
|
|
@@ -76807,7 +77554,7 @@ var init_ConfigCommand2 = __esm({
|
|
|
76807
77554
|
}
|
|
76808
77555
|
async saveConfiguration(_config, _scope) {
|
|
76809
77556
|
const _configPath = _scope === "global" ? this.globalConfigPath : this.localConfigPath;
|
|
76810
|
-
await fsp__namespace.default.mkdir(
|
|
77557
|
+
await fsp__namespace.default.mkdir(path58__namespace.default.dirname(_configPath), { recursive: true });
|
|
76811
77558
|
await fsp__namespace.default.writeFile(_configPath, JSON.stringify(_config, null, 2), "utf-8");
|
|
76812
77559
|
this.setCache(`_config:${_scope}`, _config, 300);
|
|
76813
77560
|
}
|
|
@@ -76931,7 +77678,7 @@ var init_ConfigCommand2 = __esm({
|
|
|
76931
77678
|
};
|
|
76932
77679
|
}
|
|
76933
77680
|
};
|
|
76934
|
-
|
|
77681
|
+
meta24 = {
|
|
76935
77682
|
name: "_config",
|
|
76936
77683
|
_category: "configuration",
|
|
76937
77684
|
_description: "Manages MARIA configuration settings",
|
|
@@ -78072,23 +78819,23 @@ function coerceExtension(ext2, fallback2) {
|
|
|
78072
78819
|
return fallback2;
|
|
78073
78820
|
}
|
|
78074
78821
|
function safeResolve(root, fname) {
|
|
78075
|
-
const abs =
|
|
78076
|
-
const base =
|
|
78077
|
-
if (!(abs +
|
|
78822
|
+
const abs = path58__namespace.resolve(root, fname);
|
|
78823
|
+
const base = path58__namespace.resolve(root);
|
|
78824
|
+
if (!(abs + path58__namespace.sep).startsWith(base + path58__namespace.sep) && abs !== base) {
|
|
78078
78825
|
throw new Error("Path traversal detected");
|
|
78079
78826
|
}
|
|
78080
78827
|
return abs;
|
|
78081
78828
|
}
|
|
78082
78829
|
async function ensureUniquePath(absPath) {
|
|
78083
|
-
const dir =
|
|
78084
|
-
const ext2 =
|
|
78085
|
-
const base =
|
|
78830
|
+
const dir = path58__namespace.dirname(absPath);
|
|
78831
|
+
const ext2 = path58__namespace.extname(absPath);
|
|
78832
|
+
const base = path58__namespace.basename(absPath, ext2);
|
|
78086
78833
|
let candidate = absPath;
|
|
78087
78834
|
let i2 = 1;
|
|
78088
78835
|
while (true) {
|
|
78089
78836
|
try {
|
|
78090
78837
|
await fsp__namespace.access(candidate);
|
|
78091
|
-
candidate =
|
|
78838
|
+
candidate = path58__namespace.join(dir, `${base}(${i2})${ext2}`);
|
|
78092
78839
|
i2++;
|
|
78093
78840
|
} catch {
|
|
78094
78841
|
return candidate;
|
|
@@ -78167,7 +78914,7 @@ async function handleCodeCommand(prompt) {
|
|
|
78167
78914
|
for (const { language, code, extension, filename: suggested } of artifacts) {
|
|
78168
78915
|
let filename = generateCodeFilename(prompt, language, extension, code, suggested);
|
|
78169
78916
|
filename = sanitizeFilenameStrict(filename);
|
|
78170
|
-
const ext2 =
|
|
78917
|
+
const ext2 = path58__namespace.extname(filename).slice(1);
|
|
78171
78918
|
const isBinary3 = isLikelyBinary(code);
|
|
78172
78919
|
const inferred = isBinary3 ? "bin" : inferExtensionFromContent(language, code) || "txt";
|
|
78173
78920
|
const finalExt = coerceExtension(ext2, inferred);
|
|
@@ -78180,22 +78927,22 @@ async function handleCodeCommand(prompt) {
|
|
|
78180
78927
|
files += 1;
|
|
78181
78928
|
if (progress) clearInterval(progress);
|
|
78182
78929
|
if (isTTY) rl__namespace.cursorTo(process.stdout, 0);
|
|
78183
|
-
console.log(`Saved 1 file: ${
|
|
78930
|
+
console.log(`Saved 1 file: ${path58__namespace.basename(filepath)} (${language}${isBinary3 ? ", binary-like" : ""})`);
|
|
78184
78931
|
textLog.path(filepath);
|
|
78185
78932
|
const pm = getProviderManager();
|
|
78186
78933
|
const provider = pm.getLastUsedProvider() || "fallback";
|
|
78187
78934
|
const model = pm.getLastUsedModel() || "n/a";
|
|
78188
78935
|
const source = pm.getConfigSource();
|
|
78189
|
-
const summary = { filename:
|
|
78936
|
+
const summary = { filename: path58__namespace.basename(filepath), lang: String(language), provider: String(provider), model: String(model), config_source: source, fallback: true, latency_ms: pm.getLastLatencyMs(), ...pm.getLastUsage() ? { total_tokens: pm.getLastUsage().totalTokens, prompt_tokens: pm.getLastUsage().promptTokens, completion_tokens: pm.getLastUsage().completionTokens } : {}, file_size: bytes };
|
|
78190
78937
|
try {
|
|
78191
|
-
|
|
78938
|
+
TelemetryCollector2.getInstance().trackCodeSaved(summary);
|
|
78192
78939
|
} catch {
|
|
78193
78940
|
}
|
|
78194
78941
|
}
|
|
78195
78942
|
const pmBatch = getProviderManager();
|
|
78196
78943
|
const batch = { files, total_bytes: totalBytes, provider: String(pmBatch.getLastUsedProvider() || "fallback"), model: String(pmBatch.getLastUsedModel() || "n/a"), config_source: pmBatch.getConfigSource(), fallback_any: true, latency_ms: pmBatch.getLastLatencyMs(), total_tokens: pmBatch.getLastUsage()?.totalTokens };
|
|
78197
78944
|
try {
|
|
78198
|
-
|
|
78945
|
+
TelemetryCollector2.getInstance().trackCodeSavedBatch(batch);
|
|
78199
78946
|
} catch {
|
|
78200
78947
|
}
|
|
78201
78948
|
} catch (saveError) {
|
|
@@ -78224,7 +78971,7 @@ async function handleCodeCommand(prompt) {
|
|
|
78224
78971
|
for (const { language, code, extension, filename: suggested } of artifacts) {
|
|
78225
78972
|
let filename = generateCodeFilename(prompt, language, extension, code, suggested);
|
|
78226
78973
|
filename = sanitizeFilenameStrict(filename);
|
|
78227
|
-
const ext2 =
|
|
78974
|
+
const ext2 = path58__namespace.extname(filename).slice(1);
|
|
78228
78975
|
const isBinary3 = isLikelyBinary(code);
|
|
78229
78976
|
const inferred = isBinary3 ? "bin" : inferExtensionFromContent(language, code) || "txt";
|
|
78230
78977
|
const finalExt = coerceExtension(ext2, inferred);
|
|
@@ -78237,22 +78984,22 @@ async function handleCodeCommand(prompt) {
|
|
|
78237
78984
|
files += 1;
|
|
78238
78985
|
if (progress) clearInterval(progress);
|
|
78239
78986
|
if (isTTY) rl__namespace.cursorTo(process.stdout, 0);
|
|
78240
|
-
console.log(`Saved 1 file: ${
|
|
78987
|
+
console.log(`Saved 1 file: ${path58__namespace.basename(filepath)} (${language}${isBinary3 ? ", binary-like" : ""})`);
|
|
78241
78988
|
textLog.path(filepath);
|
|
78242
78989
|
const pm = getProviderManager();
|
|
78243
78990
|
const provider = pm.getLastUsedProvider() || "unknown";
|
|
78244
78991
|
const model = pm.getLastUsedModel() || "auto";
|
|
78245
78992
|
const source = pm.getConfigSource();
|
|
78246
|
-
const summary = { filename:
|
|
78993
|
+
const summary = { filename: path58__namespace.basename(filepath), lang: String(language), provider: String(provider), model: String(model), config_source: source, fallback: false, latency_ms: pm.getLastLatencyMs(), ...pm.getLastUsage() ? { total_tokens: pm.getLastUsage().totalTokens, prompt_tokens: pm.getLastUsage().promptTokens, completion_tokens: pm.getLastUsage().completionTokens } : {}, file_size: bytes };
|
|
78247
78994
|
try {
|
|
78248
|
-
|
|
78995
|
+
TelemetryCollector2.getInstance().trackCodeSaved(summary);
|
|
78249
78996
|
} catch {
|
|
78250
78997
|
}
|
|
78251
78998
|
}
|
|
78252
78999
|
const pmBatch = getProviderManager();
|
|
78253
79000
|
const batch = { files, total_bytes: totalBytes, provider: String(pmBatch.getLastUsedProvider() || "unknown"), model: String(pmBatch.getLastUsedModel() || "auto"), config_source: pmBatch.getConfigSource(), fallback_any: false, latency_ms: pmBatch.getLastLatencyMs(), total_tokens: pmBatch.getLastUsage()?.totalTokens };
|
|
78254
79001
|
try {
|
|
78255
|
-
|
|
79002
|
+
TelemetryCollector2.getInstance().trackCodeSavedBatch(batch);
|
|
78256
79003
|
} catch {
|
|
78257
79004
|
}
|
|
78258
79005
|
console.log(chalk37__default.default.gray(`[code] done \xB7 ${Date.now() - startedAt}ms`));
|
|
@@ -78275,7 +79022,7 @@ async function handleCodeCommand(prompt) {
|
|
|
78275
79022
|
for (const { language, code, extension, filename: suggested } of artifacts) {
|
|
78276
79023
|
let filename = generateCodeFilename(prompt, language, extension, code, suggested);
|
|
78277
79024
|
filename = sanitizeFilenameStrict(filename);
|
|
78278
|
-
const ext2 =
|
|
79025
|
+
const ext2 = path58__namespace.extname(filename).slice(1);
|
|
78279
79026
|
const isBinary3 = isLikelyBinary(code);
|
|
78280
79027
|
const inferred = isBinary3 ? "bin" : inferExtensionFromContent(language, code) || "txt";
|
|
78281
79028
|
const finalExt = coerceExtension(ext2, inferred);
|
|
@@ -78288,22 +79035,22 @@ async function handleCodeCommand(prompt) {
|
|
|
78288
79035
|
files += 1;
|
|
78289
79036
|
if (progress) clearInterval(progress);
|
|
78290
79037
|
if (isTTY) rl__namespace.cursorTo(process.stdout, 0);
|
|
78291
|
-
console.log(`Saved 1 file: ${
|
|
79038
|
+
console.log(`Saved 1 file: ${path58__namespace.basename(filepath)} (${language}${isBinary3 ? ", binary-like" : ""})`);
|
|
78292
79039
|
textLog.path(filepath);
|
|
78293
79040
|
const pm = getProviderManager();
|
|
78294
79041
|
const provider = pm.getLastUsedProvider() || "fallback";
|
|
78295
79042
|
const model = pm.getLastUsedModel() || "n/a";
|
|
78296
79043
|
const source = pm.getConfigSource();
|
|
78297
|
-
const summary = { filename:
|
|
79044
|
+
const summary = { filename: path58__namespace.basename(filepath), lang: String(language), provider: String(provider), model: String(model), config_source: source, fallback: true, latency_ms: pm.getLastLatencyMs(), ...pm.getLastUsage() ? { total_tokens: pm.getLastUsage().totalTokens, prompt_tokens: pm.getLastUsage().promptTokens, completion_tokens: pm.getLastUsage().completionTokens } : {}, file_size: bytes };
|
|
78298
79045
|
try {
|
|
78299
|
-
|
|
79046
|
+
TelemetryCollector2.getInstance().trackCodeSaved(summary);
|
|
78300
79047
|
} catch {
|
|
78301
79048
|
}
|
|
78302
79049
|
}
|
|
78303
79050
|
const pmBatch = getProviderManager();
|
|
78304
79051
|
const batch = { files, total_bytes: totalBytes, provider: String(pmBatch.getLastUsedProvider() || "fallback"), model: String(pmBatch.getLastUsedModel() || "n/a"), config_source: pmBatch.getConfigSource(), fallback_any: true, latency_ms: pmBatch.getLastLatencyMs(), total_tokens: pmBatch.getLastUsage()?.totalTokens };
|
|
78305
79052
|
try {
|
|
78306
|
-
|
|
79053
|
+
TelemetryCollector2.getInstance().trackCodeSavedBatch(batch);
|
|
78307
79054
|
} catch {
|
|
78308
79055
|
}
|
|
78309
79056
|
} catch (saveError) {
|
|
@@ -78359,7 +79106,7 @@ ${e2.stack}`));
|
|
|
78359
79106
|
for (const { language, code, extension, filename: suggested } of artifacts) {
|
|
78360
79107
|
let filename = generateCodeFilename(prompt, language, extension, code, suggested);
|
|
78361
79108
|
filename = sanitizeFilenameStrict(filename);
|
|
78362
|
-
const ext2 =
|
|
79109
|
+
const ext2 = path58__namespace.extname(filename).slice(1);
|
|
78363
79110
|
const isBinary3 = isLikelyBinary(code);
|
|
78364
79111
|
const inferred = isBinary3 ? "bin" : inferExtensionFromContent(language, code) || "txt";
|
|
78365
79112
|
const finalExt = coerceExtension(ext2, inferred);
|
|
@@ -78372,22 +79119,22 @@ ${e2.stack}`));
|
|
|
78372
79119
|
files += 1;
|
|
78373
79120
|
if (progress) clearInterval(progress);
|
|
78374
79121
|
if (isTTY) rl__namespace.cursorTo(process.stdout, 0);
|
|
78375
|
-
console.log(`Saved 1 file: ${
|
|
79122
|
+
console.log(`Saved 1 file: ${path58__namespace.basename(filepath)} (${language}${isBinary3 ? ", binary-like" : ""})`);
|
|
78376
79123
|
textLog.path(filepath);
|
|
78377
79124
|
const pm = getProviderManager();
|
|
78378
79125
|
const provider = pm.getLastUsedProvider() || "fallback";
|
|
78379
79126
|
const model = pm.getLastUsedModel() || "n/a";
|
|
78380
79127
|
const source = pm.getConfigSource();
|
|
78381
|
-
const summary = { filename:
|
|
79128
|
+
const summary = { filename: path58__namespace.basename(filepath), lang: String(language), provider: String(provider), model: String(model), config_source: source, fallback: true, latency_ms: pm.getLastLatencyMs(), ...pm.getLastUsage() ? { total_tokens: pm.getLastUsage().totalTokens, prompt_tokens: pm.getLastUsage().promptTokens, completion_tokens: pm.getLastUsage().completionTokens } : {}, file_size: bytes };
|
|
78382
79129
|
try {
|
|
78383
|
-
|
|
79130
|
+
TelemetryCollector2.getInstance().trackCodeSaved(summary);
|
|
78384
79131
|
} catch {
|
|
78385
79132
|
}
|
|
78386
79133
|
}
|
|
78387
79134
|
const pmBatch = getProviderManager();
|
|
78388
79135
|
const batch = { files, total_bytes: totalBytes, provider: String(pmBatch.getLastUsedProvider() || "fallback"), model: String(pmBatch.getLastUsedModel() || "n/a"), config_source: pmBatch.getConfigSource(), fallback_any: true, latency_ms: pmBatch.getLastLatencyMs(), total_tokens: pmBatch.getLastUsage()?.totalTokens };
|
|
78389
79136
|
try {
|
|
78390
|
-
|
|
79137
|
+
TelemetryCollector2.getInstance().trackCodeSavedBatch(batch);
|
|
78391
79138
|
} catch {
|
|
78392
79139
|
}
|
|
78393
79140
|
} catch (saveError) {
|
|
@@ -78836,7 +79583,7 @@ async function streamAnswer(text, opts = {}) {
|
|
|
78836
79583
|
for (const { language, code, extension, filename: suggested } of artifacts) {
|
|
78837
79584
|
let filename = generateCodeFilename(text, language, extension, code, suggested);
|
|
78838
79585
|
filename = sanitizeFilenameStrict(filename);
|
|
78839
|
-
const ext2 =
|
|
79586
|
+
const ext2 = path58__namespace.extname(filename).slice(1);
|
|
78840
79587
|
const isBinary3 = isLikelyBinary(code);
|
|
78841
79588
|
const inferred = isBinary3 ? "bin" : inferExtensionFromContent(language, code) || "txt";
|
|
78842
79589
|
const finalExt = coerceExtension(ext2, inferred);
|
|
@@ -78845,13 +79592,13 @@ async function streamAnswer(text, opts = {}) {
|
|
|
78845
79592
|
filepath = await ensureUniquePath(filepath);
|
|
78846
79593
|
try {
|
|
78847
79594
|
await fsp__namespace.writeFile(filepath, code, "utf-8");
|
|
78848
|
-
savedFiles.push({ filepath, filename:
|
|
79595
|
+
savedFiles.push({ filepath, filename: path58__namespace.basename(filepath), language, code, ok: true, isBinary: isBinary3 });
|
|
78849
79596
|
okCount++;
|
|
78850
79597
|
console.log(chalk37__default.default.white(`OK: saved ${filepath} (${language}${isBinary3 ? ", binary-like" : ""})`));
|
|
78851
79598
|
} catch (e2) {
|
|
78852
79599
|
errCount++;
|
|
78853
79600
|
const msg2 = e2?.message || "failed to write";
|
|
78854
|
-
savedFiles.push({ filepath, filename:
|
|
79601
|
+
savedFiles.push({ filepath, filename: path58__namespace.basename(filepath), language, code, ok: false, error: msg2, isBinary: isBinary3 });
|
|
78855
79602
|
console.log(chalk37__default.default.white(`ERROR: failed ${filepath} (${language}) - ${msg2}`));
|
|
78856
79603
|
}
|
|
78857
79604
|
}
|
|
@@ -79185,24 +79932,24 @@ function createCLI() {
|
|
|
79185
79932
|
if (options.server) {
|
|
79186
79933
|
console.log(chalk37__default.default.white("Starting MARIA server mode..."));
|
|
79187
79934
|
try {
|
|
79188
|
-
const distDir =
|
|
79935
|
+
const distDir = path58__namespace.dirname(process.argv[1] || process.cwd());
|
|
79189
79936
|
const candidateNames = [
|
|
79190
79937
|
"server-express.mjs",
|
|
79191
79938
|
"server-express.cjs",
|
|
79192
79939
|
"server-express.js",
|
|
79193
79940
|
// tsup emits CJS for server entry as dist/server/express-server.js
|
|
79194
|
-
|
|
79195
|
-
|
|
79941
|
+
path58__namespace.join("server", "express-server.js"),
|
|
79942
|
+
path58__namespace.join("server", "express-server.cjs")
|
|
79196
79943
|
];
|
|
79197
79944
|
const candidateDirs = [
|
|
79198
79945
|
distDir,
|
|
79199
|
-
|
|
79946
|
+
path58__namespace.resolve(distDir, ".."),
|
|
79200
79947
|
process.cwd()
|
|
79201
79948
|
];
|
|
79202
79949
|
let serverPath = null;
|
|
79203
79950
|
for (const dir of candidateDirs) {
|
|
79204
79951
|
for (const name2 of candidateNames) {
|
|
79205
|
-
const p =
|
|
79952
|
+
const p = path58__namespace.join(dir, name2);
|
|
79206
79953
|
try {
|
|
79207
79954
|
await fsp__namespace.access(p);
|
|
79208
79955
|
serverPath = p;
|
|
@@ -79222,7 +79969,7 @@ function createCLI() {
|
|
|
79222
79969
|
const serverProcess = spawn4("node", [serverPath], {
|
|
79223
79970
|
stdio: "inherit",
|
|
79224
79971
|
env: process.env,
|
|
79225
|
-
cwd:
|
|
79972
|
+
cwd: path58__namespace.dirname(serverPath)
|
|
79226
79973
|
});
|
|
79227
79974
|
let shutdownTimer = null;
|
|
79228
79975
|
const forceExit = (defaultCode) => {
|