@songsid/agend 2.1.0-beta.33 → 2.1.0-beta.35
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/chat-export.js +5 -2
- package/dist/chat-export.js.map +1 -1
- package/dist/cli.js +8 -3
- package/dist/cli.js.map +1 -1
- package/dist/daily-summary.js +7 -2
- package/dist/daily-summary.js.map +1 -1
- package/dist/fleet-manager.js +17 -2
- package/dist/fleet-manager.js.map +1 -1
- package/dist/tz-utils.d.ts +26 -0
- package/dist/tz-utils.js +46 -0
- package/dist/tz-utils.js.map +1 -0
- package/dist/ui/dashboard.html +1 -1
- package/package.json +1 -1
package/dist/fleet-manager.js
CHANGED
|
@@ -4168,13 +4168,28 @@ When users create specialized instances, suggest these configurations:
|
|
|
4168
4168
|
/** Read recent chat log for agent context */
|
|
4169
4169
|
getRecentChatLog(instanceName, maxLines = 10) {
|
|
4170
4170
|
const logDir = ClassicChannelManager.chatLogDir(instanceName);
|
|
4171
|
-
|
|
4171
|
+
// Use local timezone for date — must match logMessage's write path
|
|
4172
|
+
const tz = process.env.TZ || Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
4173
|
+
const today = new Date().toLocaleString("sv-SE", { timeZone: tz, hour12: false }).slice(0, 10);
|
|
4172
4174
|
const logFile = join(logDir, `${today}.log`);
|
|
4173
4175
|
try {
|
|
4174
4176
|
if (!existsSync(logFile))
|
|
4175
4177
|
return undefined;
|
|
4176
4178
|
const lines = readFileSync(logFile, "utf-8").trim().split("\n");
|
|
4177
|
-
|
|
4179
|
+
// The triggering message is written before forwardToClassicInstance runs
|
|
4180
|
+
// and is included separately under [User message]. Exclude that newest
|
|
4181
|
+
// log entry so the agent does not receive the same message twice. A chat
|
|
4182
|
+
// message may span physical lines, so remove from its timestamped entry
|
|
4183
|
+
// header rather than blindly dropping only the final continuation line.
|
|
4184
|
+
const entryHeader = /^\[\d{4}-\d{2}-\d{2}T[^\]]+\] <.*> /;
|
|
4185
|
+
let currentEntryStart = lines.length - 1;
|
|
4186
|
+
while (currentEntryStart > 0 && !entryHeader.test(lines[currentEntryStart])) {
|
|
4187
|
+
currentEntryStart--;
|
|
4188
|
+
}
|
|
4189
|
+
lines.splice(currentEntryStart);
|
|
4190
|
+
if (lines.length === 0 || maxLines <= 0)
|
|
4191
|
+
return undefined;
|
|
4192
|
+
return lines.slice(-maxLines).join("\n") || undefined;
|
|
4178
4193
|
}
|
|
4179
4194
|
catch {
|
|
4180
4195
|
return undefined;
|