really fix timestamps

This commit is contained in:
Thomas G. Lopes
2026-03-04 17:05:44 +00:00
parent 0be8ef4c19
commit c7388b45a1
2 changed files with 20 additions and 15 deletions
+18 -13
View File
@@ -62,7 +62,7 @@ export default function (pi: ExtensionAPI) {
return box;
});
// Renderer for assistant timestamp
// Renderer for legacy timestamp-suffix messages (from old sessions)
pi.registerMessageRenderer("timestamp-suffix", (message, _options, theme) => {
const details = message.details as { timestamp: number; elapsed: string; duration?: number } | undefined;
if (!details) return new Text("");
@@ -104,27 +104,32 @@ export default function (pi: ExtensionAPI) {
if (lastTurnDuration !== null) {
const now = Date.now();
const elapsed = formatElapsed(now - sessionStart);
pi.sendMessage(
{
customType: "timestamp-suffix",
content: "",
display: true,
details: { timestamp: now, elapsed, duration: lastTurnDuration },
},
{ deliverAs: "followUp", triggerTurn: false }
);
const timeStr = formatTime(new Date(now));
let line = `${timeStr} (+${elapsed})`;
if (lastTurnDuration > 1000) {
line += ` • took ${formatDuration(lastTurnDuration)}`;
}
ctx.ui.notify(line, "info");
}
});
// Inject timestamp marker right before agent starts
pi.on("before_agent_start", async (event) => {
// Strip old timestamp-suffix messages from LLM context
pi.on("context", async (event) => {
const messages = event.messages.filter(
(m: any) => m.role !== "custom" || (m.customType !== "timestamp-prefix" && m.customType !== "timestamp-suffix")
);
return { messages };
});
// Inject timestamp marker right before agent starts (inline, persistent)
pi.on("before_agent_start", async () => {
const now = Date.now();
const elapsed = formatElapsed(now - sessionStart);
return {
message: {
customType: "timestamp-prefix",
content: "",
content: ".",
display: true,
details: { timestamp: now, elapsed },
},
+2 -2
View File
@@ -1,8 +1,8 @@
{
"lastChangelogVersion": "0.55.4",
"defaultProvider": "openrouter",
"defaultModel": "openai/gpt-5.2-codex",
"defaultThinkingLevel": "off",
"defaultModel": "openai/gpt-5.3-codex",
"defaultThinkingLevel": "minimal",
"theme": "matugen",
"lsp": {
"hookMode": "edit_write"