@andersonbcdefg/transcript-viewer 0.1.0 → 0.3.0

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 CHANGED
@@ -28,7 +28,7 @@ overriding the `--tv-*` custom properties, e.g. `--tv-font-sans`,
28
28
  ## Supported formats
29
29
 
30
30
  Claude Code JSONL, Claude headless, Codex JSONL, Codex headless, Cursor
31
- headless, Gemini headless.
31
+ headless, Gemini headless, Pi (`pi --mode json`).
32
32
 
33
33
  ## TODO (v2)
34
34
 
@@ -1,8 +1,15 @@
1
1
  import type { ConversationView } from "./types.js";
2
2
  export declare const SOURCE_LABELS: Record<string, string>;
3
+ /**
4
+ * Maps a link URL found in a message to the URL to render, or returns null to
5
+ * keep it. Lets hosts point links like `/tmp/outputs/report.md` at real files.
6
+ */
7
+ export type TransformLinkUrl = (url: string) => string | null;
3
8
  export type ConversationVisualizerProps = {
4
9
  conversation: ConversationView | null;
5
10
  sidechainsByAgentId?: Map<string, ConversationView>;
6
11
  className?: string;
12
+ /** Rewrites link URLs inside messages (e.g. agent output paths to real files). */
13
+ transformLinkUrl?: TransformLinkUrl;
7
14
  };
8
- export default function ConversationVisualizer({ conversation, sidechainsByAgentId, className, }: ConversationVisualizerProps): import("react/jsx-runtime").JSX.Element;
15
+ export default function ConversationVisualizer({ conversation, sidechainsByAgentId, className, transformLinkUrl, }: ConversationVisualizerProps): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { ArrowDown, Check, ChevronRight, Copy } from "lucide-react";
3
- import { isValidElement, useCallback, useRef, useState, } from "react";
4
- import Markdown, {} from "react-markdown";
3
+ import { createContext, isValidElement, useCallback, useContext, useRef, useState, } from "react";
4
+ import Markdown, { defaultUrlTransform } from "react-markdown";
5
5
  import { PrismLight as SyntaxHighlighter } from "react-syntax-highlighter";
6
6
  import bash from "react-syntax-highlighter/dist/esm/languages/prism/bash";
7
7
  import diff from "react-syntax-highlighter/dist/esm/languages/prism/diff";
@@ -71,6 +71,7 @@ export const SOURCE_LABELS = {
71
71
  "codex-headless": "Codex Headless",
72
72
  "gemini-headless": "Gemini Headless",
73
73
  "cursor-headless": "Cursor Headless",
74
+ pi: "Pi",
74
75
  };
75
76
  const ROLE_LABELS = {
76
77
  user: "User",
@@ -168,7 +169,14 @@ const MARKDOWN_COMPONENTS = {
168
169
  };
169
170
  // Agents write single newlines as line breaks, so honor them like a terminal would.
170
171
  const REMARK_PLUGINS = [remarkGfm, remarkBreaks];
171
- const MarkdownContent = ({ children }) => (_jsx("div", { className: "tv-prose", children: _jsx(Markdown, { remarkPlugins: REMARK_PLUGINS, components: MARKDOWN_COMPONENTS, children: children }) }));
172
+ const LinkTransformContext = createContext(null);
173
+ const MarkdownContent = ({ children }) => {
174
+ const transformLinkUrl = useContext(LinkTransformContext);
175
+ // The host's transform runs before react-markdown's sanitizer, so schemes
176
+ // like `sandbox:` or `file:` can be rewritten before they would be dropped.
177
+ const urlTransform = (url) => defaultUrlTransform(transformLinkUrl?.(url) ?? url);
178
+ return (_jsx("div", { className: "tv-prose", children: _jsx(Markdown, { remarkPlugins: REMARK_PLUGINS, components: MARKDOWN_COMPONENTS, urlTransform: urlTransform, children: children }) }));
179
+ };
172
180
  const EmbeddedSidechain = ({ sidechain, sidechainsByAgentId, depth, }) => {
173
181
  const [expanded, setExpanded] = useState(false);
174
182
  // Limit nesting depth to prevent infinite recursion
@@ -324,7 +332,7 @@ const ResultSummaryView = ({ summary }) => {
324
332
  return (_jsxs("div", { className: "tv-summary", children: [_jsxs("div", { className: "tv-summary-header", children: [_jsx("div", { className: "tv-summary-title", children: "Result summary" }), _jsx("span", { className: `tv-badge ${summary.is_error ? "tv-badge--error" : "tv-badge--ok"}`, children: summary.is_error ? "Error" : "Success" })] }), summary.result &&
325
333
  (summary.is_error ? (_jsx("pre", { className: "tv-summary-error", children: summary.result })) : (_jsx("div", { className: "tv-summary-result", children: _jsx(MarkdownContent, { children: summary.result }) }))), _jsxs("div", { className: "tv-metrics", children: [summary.duration_ms > 0 && (_jsx(Metric, { label: "Duration", value: formatDuration(summary.duration_ms) })), summary.num_turns > 0 && (_jsx(Metric, { label: "Turns", value: String(summary.num_turns) })), summary.total_cost_usd !== undefined && (_jsx(Metric, { label: "Cost", value: formatCost(summary.total_cost_usd) })), summary.duration_api_ms !== undefined && (_jsx(Metric, { label: "API time", value: formatDuration(summary.duration_api_ms) })), usage?.input_tokens !== undefined && (_jsx(Metric, { label: "Input tokens", value: usage.input_tokens.toLocaleString() })), usage?.output_tokens !== undefined && (_jsx(Metric, { label: "Output tokens", value: usage.output_tokens.toLocaleString() })), usage?.cached_input_tokens !== undefined && (_jsx(Metric, { label: "Cached", value: usage.cached_input_tokens.toLocaleString() }))] }), summary.permission_denials && summary.permission_denials.length > 0 && (_jsxs("div", { className: "tv-summary-section", children: [_jsxs("div", { className: "tv-row-label", children: ["Denied tool calls (", summary.permission_denials.length, ")"] }), _jsx("div", { className: "tv-stack tv-stack--tight", children: summary.permission_denials.map((denial, idx) => (_jsxs("div", { className: "tv-denial", children: [_jsx("code", { className: "tv-tool-name", children: denial.tool_name }), typeof denial.tool_input?.description === "string" && (_jsxs("span", { className: "tv-muted", children: [" ", "- ", denial.tool_input.description] }))] }, idx))) })] })), (summary.usage || summary.modelUsage) && (_jsxs("div", { className: "tv-summary-section", children: [_jsxs("button", { type: "button", onClick: () => setShowDetails(!showDetails), className: "tv-link-button", children: [_jsx(Chevron, { expanded: showDetails }), "Usage details"] }), showDetails && (_jsx("pre", { className: "tv-mono-text tv-mono-text--box", children: JSON.stringify({ usage: summary.usage, modelUsage: summary.modelUsage }, null, 2) }))] }))] }));
326
334
  };
327
- export default function ConversationVisualizer({ conversation, sidechainsByAgentId, className, }) {
335
+ export default function ConversationVisualizer({ conversation, sidechainsByAgentId, className, transformLinkUrl, }) {
328
336
  const lastAssistantRef = useRef(null);
329
337
  const rootClass = className ? `tv ${className}` : "tv";
330
338
  if (!conversation) {
@@ -347,5 +355,5 @@ export default function ConversationVisualizer({ conversation, sidechainsByAgent
347
355
  metaParts.push(`HTTP ${conversation.status}`);
348
356
  if (conversation.createdAt)
349
357
  metaParts.push(formatTime(conversation.createdAt));
350
- return (_jsxs("div", { className: rootClass, children: [_jsxs("div", { className: "tv-header", children: [_jsxs("div", { className: "tv-header-text", children: [_jsx("h2", { className: "tv-title", children: conversation.title }), metaParts.length ? (_jsx("p", { className: "tv-meta", children: metaParts.join(" · ") })) : null] }), _jsxs("div", { className: "tv-header-actions", children: [lastAssistantIdx >= 0 && (_jsxs("button", { type: "button", onClick: scrollToResult, className: "tv-button tv-button--primary", title: "Jump to the final assistant message", children: [_jsx(ArrowDown, { size: 14 }), "Final message"] })), _jsx("span", { className: "tv-tag", children: sourceLabel }), conversation.tags?.map((tag) => (_jsx("span", { className: "tv-tag", children: tag }, tag)))] })] }), _jsx("section", { className: "tv-messages", children: conversation.messages.map((msg, idx) => (_jsx("div", { ref: idx === lastAssistantIdx ? lastAssistantRef : undefined, className: "tv-msg-anchor", children: _jsx(Bubble, { kind: msg.role, blocks: msg.blocks, sidechainsByAgentId: sidechainsByAgentId, depth: 0 }) }, `${msg.role}-${idx}`))) }), conversation.resultSummary && (_jsx("section", { className: "tv-section", children: _jsx(ResultSummaryView, { summary: conversation.resultSummary }) })), conversation.details?.length ? (_jsx("section", { className: "tv-section tv-stack", children: conversation.details.map((detail, idx) => (_jsxs("details", { className: "tv-details", children: [_jsx("summary", { children: detail.title }), _jsx("pre", { className: "tv-mono-text tv-mono-text--box", children: formatDetail(detail) })] }, `${detail.title}-${idx}`))) })) : null] }));
358
+ return (_jsx(LinkTransformContext.Provider, { value: transformLinkUrl ?? null, children: _jsxs("div", { className: rootClass, children: [_jsxs("div", { className: "tv-header", children: [_jsxs("div", { className: "tv-header-text", children: [_jsx("h2", { className: "tv-title", children: conversation.title }), metaParts.length ? (_jsx("p", { className: "tv-meta", children: metaParts.join(" · ") })) : null] }), _jsxs("div", { className: "tv-header-actions", children: [lastAssistantIdx >= 0 && (_jsxs("button", { type: "button", onClick: scrollToResult, className: "tv-button tv-button--primary", title: "Jump to the final assistant message", children: [_jsx(ArrowDown, { size: 14 }), "Final message"] })), _jsx("span", { className: "tv-tag", children: sourceLabel }), conversation.tags?.map((tag) => (_jsx("span", { className: "tv-tag", children: tag }, tag)))] })] }), _jsx("section", { className: "tv-messages", children: conversation.messages.map((msg, idx) => (_jsx("div", { ref: idx === lastAssistantIdx ? lastAssistantRef : undefined, className: "tv-msg-anchor", children: _jsx(Bubble, { kind: msg.role, blocks: msg.blocks, sidechainsByAgentId: sidechainsByAgentId, depth: 0 }) }, `${msg.role}-${idx}`))) }), conversation.resultSummary && (_jsx("section", { className: "tv-section", children: _jsx(ResultSummaryView, { summary: conversation.resultSummary }) })), conversation.details?.length ? (_jsx("section", { className: "tv-section tv-stack", children: conversation.details.map((detail, idx) => (_jsxs("details", { className: "tv-details", children: [_jsx("summary", { children: detail.title }), _jsx("pre", { className: "tv-mono-text tv-mono-text--box", children: formatDetail(detail) })] }, `${detail.title}-${idx}`))) })) : null] }) }));
351
359
  }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export type { ConversationVisualizerProps } from "./ConversationVisualizer.js";
1
+ export type { ConversationVisualizerProps, TransformLinkUrl, } from "./ConversationVisualizer.js";
2
2
  export { default as ConversationVisualizer, SOURCE_LABELS, } from "./ConversationVisualizer.js";
3
3
  export type { JsonlKind, ParseError, ParseResult } from "./parsers.js";
4
- export { parseClaudeContent, parseCodexContent, parseCodexHeadlessContent, parseCursorHeadlessContent, parseGeminiHeadlessContent, parseHeadlessContent, parseJsonlContent, } from "./parsers.js";
4
+ export { parseClaudeContent, parseCodexContent, parseCodexHeadlessContent, parseCursorHeadlessContent, parseGeminiHeadlessContent, parseHeadlessContent, parseJsonlContent, parsePiContent, } from "./parsers.js";
5
5
  export type { ConversationSource, ConversationView, DetailSection, MessageBlock, MessageView, PermissionDenial, ResultSummary, } from "./types.js";
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  export { default as ConversationVisualizer, SOURCE_LABELS, } from "./ConversationVisualizer.js";
2
- export { parseClaudeContent, parseCodexContent, parseCodexHeadlessContent, parseCursorHeadlessContent, parseGeminiHeadlessContent, parseHeadlessContent, parseJsonlContent, } from "./parsers.js";
2
+ export { parseClaudeContent, parseCodexContent, parseCodexHeadlessContent, parseCursorHeadlessContent, parseGeminiHeadlessContent, parseHeadlessContent, parseJsonlContent, parsePiContent, } from "./parsers.js";
package/dist/parsers.d.ts CHANGED
@@ -23,7 +23,8 @@ export declare function parseCursorHeadlessContent(content: string, sourceId?: s
23
23
  * Events: user, init, message, tool_use, tool_result, result
24
24
  */
25
25
  export declare function parseGeminiHeadlessContent(content: string, sourceId?: string): ConversationView | null;
26
- export type JsonlKind = "claude-jsonl" | "codex-jsonl" | "claude-headless" | "codex-headless" | "gemini-headless" | "cursor-headless";
26
+ export declare function parsePiContent(content: string, sourceId?: string): ConversationView | null;
27
+ export type JsonlKind = "claude-jsonl" | "codex-jsonl" | "claude-headless" | "codex-headless" | "gemini-headless" | "cursor-headless" | "pi";
27
28
  export interface ParseResult {
28
29
  conversations: ConversationView[];
29
30
  kind: JsonlKind;
package/dist/parsers.js CHANGED
@@ -1181,6 +1181,275 @@ export function parseGeminiHeadlessContent(content, sourceId = "url") {
1181
1181
  resultSummary,
1182
1182
  });
1183
1183
  }
1184
+ // Pi (`pi --mode json`)
1185
+ // Streaming events that repeat what message_end / tool_execution_end report.
1186
+ // Long runs have thousands of these, so skip them before JSON.parse.
1187
+ const PI_STREAMING_LINE = /^\{"type":\s*"(message_update|message_start|tool_execution_update|turn_end|agent_end)"/;
1188
+ function piText(content) {
1189
+ if (typeof content === "string")
1190
+ return content;
1191
+ if (!Array.isArray(content))
1192
+ return "";
1193
+ return content
1194
+ .map((item) => {
1195
+ const i = item;
1196
+ if (i?.type === "text" && typeof i.text === "string")
1197
+ return i.text;
1198
+ if (i?.type === "image")
1199
+ return "[image]";
1200
+ return "";
1201
+ })
1202
+ .join("");
1203
+ }
1204
+ function piAssistantBlocks(content) {
1205
+ if (typeof content === "string")
1206
+ return [{ type: "text", text: content }];
1207
+ if (!Array.isArray(content))
1208
+ return [];
1209
+ const blocks = [];
1210
+ for (const item of content) {
1211
+ const b = item;
1212
+ if (!b)
1213
+ continue;
1214
+ if (b.type === "text") {
1215
+ const text = typeof b.text === "string" ? b.text : "";
1216
+ if (text.trim())
1217
+ blocks.push({ type: "text", text });
1218
+ }
1219
+ else if (b.type === "thinking") {
1220
+ const text = typeof b.thinking === "string" ? b.thinking : "";
1221
+ if (text.trim())
1222
+ blocks.push({ type: "thinking", text });
1223
+ }
1224
+ else if (b.type === "toolCall") {
1225
+ blocks.push({
1226
+ type: "tool_use",
1227
+ text: b.name || "",
1228
+ json: { id: b.id, name: b.name, input: b.arguments },
1229
+ });
1230
+ }
1231
+ }
1232
+ return blocks;
1233
+ }
1234
+ function isPiStartLine(json) {
1235
+ // ccremote/cacli write {"type":"user","harness":"pi",...} as the first line.
1236
+ if (json.harness === "pi")
1237
+ return true;
1238
+ return (json.type === "session" &&
1239
+ typeof json.version === "number" &&
1240
+ typeof json.id === "string" &&
1241
+ "cwd" in json);
1242
+ }
1243
+ export function parsePiContent(content, sourceId = "url") {
1244
+ const lines = content.split(/\r?\n/);
1245
+ const messages = [];
1246
+ let sessionId = null;
1247
+ let createdAt = null;
1248
+ let cwd = "";
1249
+ let model = null;
1250
+ let initialPrompt = null;
1251
+ let systemSections = null;
1252
+ let isComplete = false;
1253
+ let aborted = false;
1254
+ let lastAssistantText = "";
1255
+ let lastError = null;
1256
+ let numTurns = 0;
1257
+ let costTotal = 0;
1258
+ let sawCost = false;
1259
+ const usage = {
1260
+ input_tokens: 0,
1261
+ output_tokens: 0,
1262
+ cache_read_input_tokens: 0,
1263
+ };
1264
+ for (const rawLine of lines) {
1265
+ const line = rawLine.trim();
1266
+ if (!line || !looksLikeJsonObject(line) || PI_STREAMING_LINE.test(line)) {
1267
+ continue;
1268
+ }
1269
+ let entry;
1270
+ try {
1271
+ entry = JSON.parse(line);
1272
+ }
1273
+ catch {
1274
+ continue;
1275
+ }
1276
+ const eventMessage = toCcremoteEventMessage(entry);
1277
+ if (eventMessage) {
1278
+ messages.push(eventMessage);
1279
+ continue;
1280
+ }
1281
+ const type = entry.type;
1282
+ if (type === "user" && entry.harness === "pi") {
1283
+ const text = piText(entry.message?.content);
1284
+ if (typeof entry.model === "string")
1285
+ model = model || entry.model;
1286
+ if (text) {
1287
+ initialPrompt = text;
1288
+ messages.push({
1289
+ role: "user",
1290
+ text,
1291
+ blocks: [{ type: "text", text }],
1292
+ timestamp: null,
1293
+ });
1294
+ }
1295
+ continue;
1296
+ }
1297
+ if (type === "session") {
1298
+ sessionId = sessionId || entry.id || null;
1299
+ createdAt = createdAt || parseTimestamp(entry.timestamp);
1300
+ cwd = cwd || entry.cwd || "";
1301
+ continue;
1302
+ }
1303
+ if (type === "agent_settled") {
1304
+ isComplete = true;
1305
+ aborted = Boolean(entry.aborted);
1306
+ continue;
1307
+ }
1308
+ // Guardian reviews: show only the tool calls it blocked.
1309
+ if (type === "entry_appended") {
1310
+ const data = entry.entry?.data;
1311
+ const outcome = data?.assessment?.outcome;
1312
+ if (entry.entry?.customType === "pi-guardian.assessment" &&
1313
+ outcome &&
1314
+ outcome !== "allow") {
1315
+ const reason = data.assessment.rationale || "";
1316
+ const text = `Guardian ${outcome} for ${data.toolName || "tool"}${reason ? `: ${reason}` : ""}`;
1317
+ messages.push({
1318
+ role: "system",
1319
+ text,
1320
+ blocks: [{ type: "text", text }],
1321
+ timestamp: parseTimestamp(entry.entry?.timestamp),
1322
+ });
1323
+ }
1324
+ continue;
1325
+ }
1326
+ if (type !== "message_end")
1327
+ continue;
1328
+ const message = entry.message;
1329
+ if (!message || typeof message !== "object")
1330
+ continue;
1331
+ const role = message.role;
1332
+ const timestamp = parseTimestamp(message.timestamp);
1333
+ if (role === "system") {
1334
+ systemSections = message.sections || null;
1335
+ continue;
1336
+ }
1337
+ if (role === "user") {
1338
+ const text = piText(message.content);
1339
+ // ccremote's first line already shows the prompt; Pi's copy wraps it.
1340
+ if (!text || (initialPrompt && text.includes(initialPrompt.trim()))) {
1341
+ continue;
1342
+ }
1343
+ messages.push({
1344
+ role: "user",
1345
+ text,
1346
+ blocks: [{ type: "text", text }],
1347
+ timestamp,
1348
+ });
1349
+ continue;
1350
+ }
1351
+ if (role === "assistant") {
1352
+ numTurns += 1;
1353
+ if (typeof message.model === "string")
1354
+ model = message.model;
1355
+ const blocks = piAssistantBlocks(message.content);
1356
+ const stopReason = message.stopReason;
1357
+ if (stopReason === "error" || stopReason === "aborted") {
1358
+ lastError = message.errorMessage || `Request ended with ${stopReason}`;
1359
+ blocks.push({ type: "text", text: `**Error:** ${lastError}` });
1360
+ }
1361
+ else {
1362
+ lastError = null;
1363
+ }
1364
+ const u = message.usage;
1365
+ if (u && typeof u === "object") {
1366
+ usage.input_tokens += Number(u.input) || 0;
1367
+ usage.output_tokens += Number(u.output) || 0;
1368
+ usage.cache_read_input_tokens += Number(u.cacheRead) || 0;
1369
+ const total = u.cost?.total;
1370
+ if (typeof total === "number" && Number.isFinite(total)) {
1371
+ costTotal += total;
1372
+ sawCost = true;
1373
+ }
1374
+ }
1375
+ const text = blocksToText(blocks);
1376
+ if (text)
1377
+ lastAssistantText = text;
1378
+ if (blocks.length) {
1379
+ messages.push({ role: "assistant", text, blocks, timestamp });
1380
+ }
1381
+ continue;
1382
+ }
1383
+ if (role === "toolResult") {
1384
+ const text = piText(message.content);
1385
+ messages.push({
1386
+ role: "tool",
1387
+ text,
1388
+ blocks: [
1389
+ {
1390
+ type: "tool_result",
1391
+ text: message.isError ? `[error] ${text}` : text,
1392
+ json: {
1393
+ tool_use_id: message.toolCallId,
1394
+ name: message.toolName,
1395
+ is_error: Boolean(message.isError),
1396
+ },
1397
+ },
1398
+ ],
1399
+ timestamp,
1400
+ });
1401
+ continue;
1402
+ }
1403
+ // Extension messages (custom roles): show any text they carry.
1404
+ const text = piText(message.content);
1405
+ if (text) {
1406
+ messages.push({
1407
+ role: typeof role === "string" ? role : "unknown",
1408
+ text,
1409
+ blocks: [{ type: "text", text }],
1410
+ timestamp,
1411
+ });
1412
+ }
1413
+ }
1414
+ if (!messages.length && !sessionId)
1415
+ return null;
1416
+ const details = buildMetadataDetails({ session_id: sessionId, cwd, model });
1417
+ if (systemSections) {
1418
+ details.push({
1419
+ title: "System prompt",
1420
+ content: Object.values(systemSections)
1421
+ .filter((v) => typeof v === "string")
1422
+ .join("\n\n"),
1423
+ format: "text",
1424
+ });
1425
+ }
1426
+ const isError = Boolean(lastError) || aborted;
1427
+ const resultSummary = isComplete
1428
+ ? {
1429
+ subtype: isError ? "error" : "success",
1430
+ is_error: isError,
1431
+ duration_ms: 0,
1432
+ num_turns: numTurns,
1433
+ result: lastError || (aborted ? "Aborted" : lastAssistantText),
1434
+ session_id: sessionId || undefined,
1435
+ total_cost_usd: sawCost ? costTotal : undefined,
1436
+ usage,
1437
+ }
1438
+ : null;
1439
+ const id = sessionId || sourceId;
1440
+ return buildConversation({
1441
+ id: `pi-${id}`,
1442
+ source: "pi",
1443
+ title: guessTitleFromMessages(messages, "Pi session"),
1444
+ subtitle: cwd,
1445
+ createdAt,
1446
+ model,
1447
+ messages,
1448
+ details,
1449
+ isComplete,
1450
+ resultSummary,
1451
+ });
1452
+ }
1184
1453
  /**
1185
1454
  * Detect format and parse JSONL content.
1186
1455
  * Returns { conversations, kind } on success, { error } on failure.
@@ -1192,6 +1461,12 @@ export function parseJsonlContent(content, sourceId) {
1192
1461
  // Check multiple lines to better detect cursor format
1193
1462
  let detectedKind = null;
1194
1463
  for (const json of takeDetectableJson(lines, 10)) {
1464
+ // Pi: checked first because its first line has a top-level "message"
1465
+ // that would otherwise be read as Claude JSONL.
1466
+ if (isPiStartLine(json)) {
1467
+ detectedKind = "pi";
1468
+ break;
1469
+ }
1195
1470
  // Cursor headless: has type="tool_call" with subtype="started"/"completed" or type="thinking" with subtype="delta"/"completed"
1196
1471
  if (json.type === "tool_call" &&
1197
1472
  (json.subtype === "started" || json.subtype === "completed")) {
@@ -1280,5 +1555,8 @@ export function parseJsonlContent(content, sourceId) {
1280
1555
  else if (detectedKind === "cursor-headless") {
1281
1556
  parsed = parseCursorHeadlessContent(content, sourceId);
1282
1557
  }
1558
+ else if (detectedKind === "pi") {
1559
+ parsed = parsePiContent(content, sourceId);
1560
+ }
1283
1561
  return { conversations: parsed ? [parsed] : [], kind: detectedKind };
1284
1562
  }
package/dist/types.d.ts CHANGED
@@ -15,7 +15,7 @@ export type DetailSection = {
15
15
  content: string | Record<string, unknown>;
16
16
  format?: "json" | "text";
17
17
  };
18
- export type ConversationSource = "mitm" | "claude-jsonl" | "codex-jsonl" | "claude-headless" | "codex-headless" | "gemini-headless" | "cursor-headless";
18
+ export type ConversationSource = "mitm" | "claude-jsonl" | "codex-jsonl" | "claude-headless" | "codex-headless" | "gemini-headless" | "cursor-headless" | "pi";
19
19
  export type PermissionDenial = {
20
20
  tool_name: string;
21
21
  tool_use_id: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@andersonbcdefg/transcript-viewer",
3
- "version": "0.1.0",
4
- "description": "Parse and render Claude Code, Codex, Cursor, and Gemini agent transcripts in React.",
3
+ "version": "0.3.0",
4
+ "description": "Parse and render Claude Code, Codex, Cursor, Gemini, and Pi agent transcripts in React.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "sideEffects": [