@agent-webui/ai-desk-daemon 1.0.49-beta2 → 1.0.49-beta4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/config.js +1 -0
- package/lib/platform.js +7 -4
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/config.js
CHANGED
package/lib/platform.js
CHANGED
|
@@ -177,8 +177,9 @@ function resolveBaseLogPath(baseLogPath = getConfiguredLogPath()) {
|
|
|
177
177
|
return path.resolve(expandHomePath(trimmedPath));
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
function parseRollingLogFilename(prefix, filename) {
|
|
181
|
-
const
|
|
180
|
+
function parseRollingLogFilename(prefix, extension, filename) {
|
|
181
|
+
const normalizedExtension = extension || '.log';
|
|
182
|
+
const pattern = new RegExp(`^${prefix.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}-([0-9]{8})(?:-([0-9]+))?${normalizedExtension.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}$`);
|
|
182
183
|
const match = filename.match(pattern);
|
|
183
184
|
if (!match) {
|
|
184
185
|
return null;
|
|
@@ -204,6 +205,7 @@ function findLatestRollingLogPath(baseLogPath = getConfiguredLogPath()) {
|
|
|
204
205
|
const resolvedBaseLogPath = resolveBaseLogPath(baseLogPath);
|
|
205
206
|
const logDir = path.dirname(resolvedBaseLogPath);
|
|
206
207
|
const prefix = path.basename(resolvedBaseLogPath, path.extname(resolvedBaseLogPath));
|
|
208
|
+
const extension = path.extname(resolvedBaseLogPath) || '.log';
|
|
207
209
|
|
|
208
210
|
if (!fs.existsSync(logDir)) {
|
|
209
211
|
return '';
|
|
@@ -211,7 +213,7 @@ function findLatestRollingLogPath(baseLogPath = getConfiguredLogPath()) {
|
|
|
211
213
|
|
|
212
214
|
const entries = [];
|
|
213
215
|
for (const filename of fs.readdirSync(logDir)) {
|
|
214
|
-
const parsed = parseRollingLogFilename(prefix, filename);
|
|
216
|
+
const parsed = parseRollingLogFilename(prefix, extension, filename);
|
|
215
217
|
if (!parsed) {
|
|
216
218
|
continue;
|
|
217
219
|
}
|
|
@@ -234,10 +236,11 @@ function getExpectedRollingLogPath(baseLogPath = getConfiguredLogPath(), now = n
|
|
|
234
236
|
const resolvedBaseLogPath = resolveBaseLogPath(baseLogPath);
|
|
235
237
|
const logDir = path.dirname(resolvedBaseLogPath);
|
|
236
238
|
const prefix = path.basename(resolvedBaseLogPath, path.extname(resolvedBaseLogPath));
|
|
239
|
+
const extension = path.extname(resolvedBaseLogPath) || '.log';
|
|
237
240
|
const year = now.getFullYear().toString().padStart(4, '0');
|
|
238
241
|
const month = `${now.getMonth() + 1}`.padStart(2, '0');
|
|
239
242
|
const day = `${now.getDate()}`.padStart(2, '0');
|
|
240
|
-
return path.join(logDir, `${prefix}-${year}${month}${day}
|
|
243
|
+
return path.join(logDir, `${prefix}-${year}${month}${day}${extension}`);
|
|
241
244
|
}
|
|
242
245
|
|
|
243
246
|
/**
|