@each1024/pi-mini-mode 2.0.18 → 2.0.20
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/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/extensions/footer-status.ts +75 -14
- package/lib/agent-render.ts +354 -16
- package/lib/agent-state.ts +279 -40
- package/lib/agent-view.ts +4 -1
- package/lib/agent-widgets.ts +6 -3
- package/lib/assistant-images.ts +30 -3
- package/lib/file-links.ts +18 -2
- package/lib/input-enhancements-types.ts +2 -0
- package/lib/input-enhancements.ts +3 -1
- package/lib/input-hover-preview.ts +6 -4
- package/lib/input-image-graphics.ts +3 -2
- package/lib/input-image-paths.ts +36 -8
- package/lib/input-inline-images.ts +12 -4
- package/lib/input-skill-completion.ts +2 -1
- package/lib/link-hover.ts +100 -7
- package/lib/minimal-output.ts +460 -89
- package/lib/minimal-turns.ts +18 -2
- package/lib/print-agent.ts +712 -0
- package/lib/settings.ts +6 -2
- package/lib/token-speed.ts +284 -48
- package/lib/transcript-adapter.ts +14 -0
- package/lib/transcript-cards.ts +7 -6
- package/lib/transcript-notice-render.ts +9 -6
- package/lib/transcript-notices.ts +72 -16
- package/lib/update-banner.ts +309 -0
- package/lib/usage.ts +41 -8
- package/package.json +2 -1
package/lib/minimal-turns.ts
CHANGED
|
@@ -139,12 +139,23 @@ export function piLoopSummary(question: string): string | undefined {
|
|
|
139
139
|
return prompt ? `${title} · ${prompt}` : title;
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
+
function entryTimestamp(entry: { timestamp?: unknown; message?: { timestamp?: unknown } } | null | undefined): number | undefined {
|
|
143
|
+
for (const cand of [entry?.message?.timestamp, entry?.timestamp]) {
|
|
144
|
+
if (typeof cand === "number" && Number.isFinite(cand)) return cand;
|
|
145
|
+
if (typeof cand === "string") {
|
|
146
|
+
const t = Date.parse(cand);
|
|
147
|
+
if (Number.isFinite(t)) return t;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return undefined;
|
|
151
|
+
}
|
|
152
|
+
|
|
142
153
|
/** Rebuild turns on the selected session branch. */
|
|
143
154
|
export function minimalTurnsFromBranch(branch: readonly unknown[]): MinimalTurn[] {
|
|
144
155
|
const turns: MinimalTurn[] = [];
|
|
145
156
|
let turn: MinimalTurn | undefined;
|
|
146
157
|
for (const rawEntry of branch) {
|
|
147
|
-
const entry = rawEntry as { type?: string; message?: { role?: string; content?: unknown; usage?: UsageLike; stopReason?: string; errorMessage?: string } } | null;
|
|
158
|
+
const entry = rawEntry as { timestamp?: unknown; type?: string; message?: { timestamp?: unknown; role?: string; content?: unknown; usage?: UsageLike; stopReason?: string; errorMessage?: string } } | null;
|
|
148
159
|
if (entry?.type !== "message" || !entry.message) continue;
|
|
149
160
|
const { role, content } = entry.message;
|
|
150
161
|
if (role === "user") {
|
|
@@ -162,6 +173,8 @@ export function minimalTurnsFromBranch(branch: readonly unknown[]): MinimalTurn[
|
|
|
162
173
|
if (call) {
|
|
163
174
|
call.state = result.isError ? "error" : "done";
|
|
164
175
|
call.output = contentText(content) || "Call returned (no text output)";
|
|
176
|
+
const endedAt = entryTimestamp(entry);
|
|
177
|
+
if (endedAt !== undefined) call.endedAt = endedAt;
|
|
165
178
|
continue;
|
|
166
179
|
}
|
|
167
180
|
pushProcess(turn, "output", content);
|
|
@@ -178,7 +191,10 @@ export function minimalTurnsFromBranch(branch: readonly unknown[]): MinimalTurn[
|
|
|
178
191
|
&& (entry.message.stopReason === "error" || entry.message.stopReason === "aborted") ? entry.message.stopReason : "done";
|
|
179
192
|
} else if (item.type === "toolCall") {
|
|
180
193
|
if (item.name) {
|
|
181
|
-
|
|
194
|
+
const created = agentCall(String(item.id), String(item.name), item.arguments ?? item.input);
|
|
195
|
+
const startedAt = entryTimestamp(entry);
|
|
196
|
+
if (startedAt !== undefined) created.startedAt = startedAt;
|
|
197
|
+
(turn.agentCalls ??= []).push(created);
|
|
182
198
|
pushProcess(turn, "call", String(item.id));
|
|
183
199
|
const path = (item.arguments as { path?: string })?.path;
|
|
184
200
|
if (path && /(?:^|\/)SKILL\.md$/i.test(path)) pushProcess(turn, "skill", path.split("/").at(-2));
|