really fix timestamps
This commit is contained in:
@@ -62,7 +62,7 @@ export default function (pi: ExtensionAPI) {
|
|||||||
return box;
|
return box;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Renderer for assistant timestamp
|
// Renderer for legacy timestamp-suffix messages (from old sessions)
|
||||||
pi.registerMessageRenderer("timestamp-suffix", (message, _options, theme) => {
|
pi.registerMessageRenderer("timestamp-suffix", (message, _options, theme) => {
|
||||||
const details = message.details as { timestamp: number; elapsed: string; duration?: number } | undefined;
|
const details = message.details as { timestamp: number; elapsed: string; duration?: number } | undefined;
|
||||||
if (!details) return new Text("");
|
if (!details) return new Text("");
|
||||||
@@ -104,27 +104,32 @@ export default function (pi: ExtensionAPI) {
|
|||||||
if (lastTurnDuration !== null) {
|
if (lastTurnDuration !== null) {
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
const elapsed = formatElapsed(now - sessionStart);
|
const elapsed = formatElapsed(now - sessionStart);
|
||||||
pi.sendMessage(
|
const timeStr = formatTime(new Date(now));
|
||||||
{
|
let line = `○ ${timeStr} (+${elapsed})`;
|
||||||
customType: "timestamp-suffix",
|
if (lastTurnDuration > 1000) {
|
||||||
content: "",
|
line += ` • took ${formatDuration(lastTurnDuration)}`;
|
||||||
display: true,
|
}
|
||||||
details: { timestamp: now, elapsed, duration: lastTurnDuration },
|
ctx.ui.notify(line, "info");
|
||||||
},
|
|
||||||
{ deliverAs: "followUp", triggerTurn: false }
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Inject timestamp marker right before agent starts
|
// Strip old timestamp-suffix messages from LLM context
|
||||||
pi.on("before_agent_start", async (event) => {
|
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 now = Date.now();
|
||||||
const elapsed = formatElapsed(now - sessionStart);
|
const elapsed = formatElapsed(now - sessionStart);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
message: {
|
message: {
|
||||||
customType: "timestamp-prefix",
|
customType: "timestamp-prefix",
|
||||||
content: "",
|
content: ".",
|
||||||
display: true,
|
display: true,
|
||||||
details: { timestamp: now, elapsed },
|
details: { timestamp: now, elapsed },
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"lastChangelogVersion": "0.55.4",
|
"lastChangelogVersion": "0.55.4",
|
||||||
"defaultProvider": "openrouter",
|
"defaultProvider": "openrouter",
|
||||||
"defaultModel": "openai/gpt-5.2-codex",
|
"defaultModel": "openai/gpt-5.3-codex",
|
||||||
"defaultThinkingLevel": "off",
|
"defaultThinkingLevel": "minimal",
|
||||||
"theme": "matugen",
|
"theme": "matugen",
|
||||||
"lsp": {
|
"lsp": {
|
||||||
"hookMode": "edit_write"
|
"hookMode": "edit_write"
|
||||||
|
|||||||
Reference in New Issue
Block a user