@cortexkit/pi-magic-context 0.36.1 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-npnqc564.js → index-hk6sj7dn.js} +13 -8
- package/dist/{index-zxgbtsnj.js → index-kvttksef.js} +1020 -192
- package/dist/index.js +159 -63
- package/dist/{safe-notification-target-0s6j4m9f.js → safe-notification-target-7n7s6xv7.js} +1 -1
- package/dist/subagent-entry.js +2 -2
- package/package.json +2 -1
|
@@ -83,16 +83,19 @@ var buffer = [];
|
|
|
83
83
|
var flushTimer = null;
|
|
84
84
|
var FLUSH_INTERVAL_MS = 500;
|
|
85
85
|
var BUFFER_SIZE_LIMIT = 50;
|
|
86
|
-
var
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
return;
|
|
86
|
+
var swallowedWriteCount = 0;
|
|
87
|
+
var lastErrorMessage = null;
|
|
88
|
+
var lastErrorTime = null;
|
|
89
|
+
function recordSwallowedWrite(error) {
|
|
91
90
|
try {
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
swallowedWriteCount++;
|
|
92
|
+
lastErrorMessage = error instanceof Error ? error.message : String(error);
|
|
93
|
+
lastErrorTime = new Date().toISOString();
|
|
94
94
|
} catch {}
|
|
95
95
|
}
|
|
96
|
+
function ensureDir(filePath) {
|
|
97
|
+
fs.mkdirSync(path2.dirname(filePath), { recursive: true });
|
|
98
|
+
}
|
|
96
99
|
function flush() {
|
|
97
100
|
if (flushTimer) {
|
|
98
101
|
clearTimeout(flushTimer);
|
|
@@ -106,7 +109,9 @@ function flush() {
|
|
|
106
109
|
const logFile = getMagicContextLogPath();
|
|
107
110
|
ensureDir(logFile);
|
|
108
111
|
fs.appendFileSync(logFile, data);
|
|
109
|
-
} catch {
|
|
112
|
+
} catch (error) {
|
|
113
|
+
recordSwallowedWrite(error);
|
|
114
|
+
}
|
|
110
115
|
}
|
|
111
116
|
function scheduleFlush() {
|
|
112
117
|
if (flushTimer)
|