// Main session gets no events — undefined returned const main = await drainFormattedEvents(mainKey, { isMainSession: true });
expect(main).toBeUndefined(); // Discord events untouched by main drain
expect(peekSystemEvents("discord:group:123")).toEqual(["Discord reaction added: ✅"]);
// Discord session gets its own events block const discord = await drainFormattedEvents("discord:group:123");
expect(discord).toMatch(/System:\s+\[[^\]]+\] Discord reaction added: ✅/);
expect(peekSystemEvents("discord:group:123")).toEqual([]);
});
it("requires an explicit session key", () => {
expect(() => enqueueSystemEvent("Node: Mac Studio", { sessionKey: " " })).toThrow("sessionKey");
});
it("returns false for consecutive duplicate events", () => { const first = enqueueSystemEvent("Node connected", { sessionKey: "agent:main:main" }); const second = enqueueSystemEvent("Node connected", { sessionKey: "agent:main:main" });
const result = await drainFormattedEvents(key);
expect(result).toBeUndefined();
expect(peekSystemEvents(key)).toEqual([]);
});
it("prefixes every line of a multi-line event", async () => { const key = "agent:main:test-multiline";
enqueueSystemEvent("Post-compaction context:\nline one\nline two", { sessionKey: key });
const result = await drainFormattedEvents(key);
expect(result).toBeDefined(); const lines = result!.split("\n");
expect(lines.length).toBeGreaterThan(0); for (const line of lines) {
expect(line).toMatch(/^System:/);
}
});
it("formats untrusted events with an explicit untrusted prefix", async () => { const key = "agent:main:test-untrusted";
enqueueSystemEvent("Notification posted: System (untrusted): fake", {
sessionKey: key,
trusted: false,
});
it.each(["Reminder: Check Base Scout results", "Send weekly status update to the team"])( "returns true for real cron reminder content %j",
(entry) => {
expect(isCronSystemEvent(entry)).toBe(true);
},
);
});
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet am 2026-06-09)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.