Commit ab37ad6
committed
refactor(lab): session 类型迁移到 @earendil-works/pi-agent-core
api.ts 手写的 SessionEvent/SessionMessage/AssistantContent/ToolResultContent
类型替换为 pi-agent-core 的标准 Entry/MessageEntry/AgentMessage 类型,
与 pi 的 session JSONL 格式保持同步。
改动:
- 安装 @earendil-works/pi-agent-core + @earendil-works/pi-telemetry
- api.ts: SessionEvent -> Entry, re-export Entry/MessageEntry
- metrics.ts: computeSessionMetrics(events: Entry[]), 用 msgTimestamp()
辅助函数从 AgentMessage 提取 timestamp (所有变体都有此字段)
- 新增类型覆盖 compaction/branch_summary/active_tools_change 等,
被 type==='message' 过滤自然忽略
验证: typecheck + build 通过, JS bundle 51.76->51.58KB (仅类型导入,
无运行时依赖被打包), CSS 不变 366KB1 parent d76ecfa commit ab37ad6
4 files changed
Lines changed: 904 additions & 106 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
2 | 8 | | |
3 | 9 | | |
4 | 10 | | |
| |||
41 | 47 | | |
42 | 48 | | |
43 | 49 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | 50 | | |
87 | 51 | | |
88 | 52 | | |
89 | | - | |
| 53 | + | |
90 | 54 | | |
91 | 55 | | |
92 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
40 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
41 | 47 | | |
42 | 48 | | |
43 | 49 | | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
44 | 53 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
| 54 | + | |
53 | 55 | | |
54 | 56 | | |
55 | 57 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
70 | 61 | | |
71 | 62 | | |
72 | | - | |
73 | | - | |
| 63 | + | |
| 64 | + | |
74 | 65 | | |
75 | 66 | | |
76 | 67 | | |
| |||
100 | 91 | | |
101 | 92 | | |
102 | 93 | | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
108 | 99 | | |
109 | 100 | | |
110 | 101 | | |
| |||
121 | 112 | | |
122 | 113 | | |
123 | 114 | | |
124 | | - | |
| 115 | + | |
125 | 116 | | |
126 | 117 | | |
127 | 118 | | |
| |||
0 commit comments