really fix timestamps
This commit is contained in:
@@ -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 },
|
||||
},
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user