@seanxdo/superview 0.1.13
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 +193 -0
- package/README.zh-CN.md +193 -0
- package/core/contextReplay.ts +388 -0
- package/core/cost.ts +125 -0
- package/core/hash.ts +5 -0
- package/core/history.ts +96 -0
- package/core/id.ts +6 -0
- package/core/normalizer.ts +720 -0
- package/core/parser.ts +53 -0
- package/core/redactor.ts +49 -0
- package/core/replay.ts +55 -0
- package/core/timeline.ts +350 -0
- package/core/types.ts +460 -0
- package/dist/ui/assets/index-BUbbOxsU.js +18 -0
- package/dist/ui/assets/index-DafedT5l.css +1 -0
- package/dist/ui/index.html +13 -0
- package/package.json +72 -0
- package/runtime-node/adapters/claude-code.ts +205 -0
- package/runtime-node/adapters/codex.ts +24 -0
- package/runtime-node/adapters/index.ts +18 -0
- package/runtime-node/adapters/opencode.ts +193 -0
- package/runtime-node/adapters/shared.ts +113 -0
- package/runtime-node/cli-ingest.ts +7 -0
- package/runtime-node/cli-start.js +15 -0
- package/runtime-node/cli-start.ts +9 -0
- package/runtime-node/dev-server.ts +6 -0
- package/runtime-node/git-provider.ts +102 -0
- package/runtime-node/history.ts +9 -0
- package/runtime-node/ingest-worker.ts +32 -0
- package/runtime-node/ingest.ts +362 -0
- package/runtime-node/prod-server.ts +24 -0
- package/runtime-node/scanner.ts +13 -0
- package/runtime-node/server.ts +183 -0
- package/storage/database.ts +1016 -0
- package/storage/paths.ts +20 -0
package/core/types.ts
ADDED
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
export type AgentProvider = "codex" | "claude-code" | "opencode";
|
|
2
|
+
|
|
3
|
+
export type CodexOuterType = "session_meta" | "turn_context" | "response_item" | "event_msg";
|
|
4
|
+
|
|
5
|
+
export type EventKind =
|
|
6
|
+
| "session"
|
|
7
|
+
| "turn"
|
|
8
|
+
| "user_prompt"
|
|
9
|
+
| "assistant_message"
|
|
10
|
+
| "tool_call"
|
|
11
|
+
| "tool_result"
|
|
12
|
+
| "reasoning_marker"
|
|
13
|
+
| "token_usage"
|
|
14
|
+
| "file_change"
|
|
15
|
+
| "verification"
|
|
16
|
+
| "error"
|
|
17
|
+
| "status";
|
|
18
|
+
|
|
19
|
+
export type TimelineLane =
|
|
20
|
+
| "Product"
|
|
21
|
+
| "Architecture"
|
|
22
|
+
| "Code"
|
|
23
|
+
| "Agent Runs"
|
|
24
|
+
| "Verification"
|
|
25
|
+
| "Risks";
|
|
26
|
+
|
|
27
|
+
export type EventStatus = "running" | "success" | "failed" | "unknown";
|
|
28
|
+
|
|
29
|
+
export type CausalEdgeType =
|
|
30
|
+
| "same_turn"
|
|
31
|
+
| "same_call"
|
|
32
|
+
| "implements_prompt"
|
|
33
|
+
| "updates_design"
|
|
34
|
+
| "verified_by"
|
|
35
|
+
| "failed_by"
|
|
36
|
+
| "retried_by"
|
|
37
|
+
| "committed_as";
|
|
38
|
+
|
|
39
|
+
export type CausalConfidence = "deterministic" | "inferred";
|
|
40
|
+
|
|
41
|
+
export type ReplayNodeType =
|
|
42
|
+
| "start"
|
|
43
|
+
| "context"
|
|
44
|
+
| "platform"
|
|
45
|
+
| "powerup"
|
|
46
|
+
| "hazard"
|
|
47
|
+
| "loop"
|
|
48
|
+
| "finish"
|
|
49
|
+
| "message";
|
|
50
|
+
|
|
51
|
+
export interface ParsedCodexLine {
|
|
52
|
+
sourcePath: string;
|
|
53
|
+
lineNo: number;
|
|
54
|
+
timestamp: string;
|
|
55
|
+
type: CodexOuterType | string;
|
|
56
|
+
payload: unknown;
|
|
57
|
+
redactedPayload: unknown;
|
|
58
|
+
sha256: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type ParsedAgentEvent = ParsedCodexLine & {
|
|
62
|
+
provider: AgentProvider;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export interface ProjectRecord {
|
|
66
|
+
id: string;
|
|
67
|
+
name: string;
|
|
68
|
+
cwd: string;
|
|
69
|
+
repoRoot: string | null;
|
|
70
|
+
createdAt: string;
|
|
71
|
+
updatedAt: string;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface SessionRecord {
|
|
75
|
+
id: string;
|
|
76
|
+
projectId: string;
|
|
77
|
+
path: string;
|
|
78
|
+
cwd: string;
|
|
79
|
+
startedAt: string;
|
|
80
|
+
endedAt: string | null;
|
|
81
|
+
cliVersion: string | null;
|
|
82
|
+
modelProvider: string | null;
|
|
83
|
+
source: string | null;
|
|
84
|
+
provider: AgentProvider;
|
|
85
|
+
externalSessionId: string;
|
|
86
|
+
agentName: string | null;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface TurnRecord {
|
|
90
|
+
id: string;
|
|
91
|
+
sessionId: string;
|
|
92
|
+
startedAt: string;
|
|
93
|
+
endedAt: string | null;
|
|
94
|
+
cwd: string | null;
|
|
95
|
+
model: string | null;
|
|
96
|
+
approvalPolicy: string | null;
|
|
97
|
+
sandboxPolicy: string | null;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface RawEventRef {
|
|
101
|
+
id: string;
|
|
102
|
+
sessionId: string;
|
|
103
|
+
provider: AgentProvider;
|
|
104
|
+
lineNo: number;
|
|
105
|
+
timestamp: string;
|
|
106
|
+
type: string;
|
|
107
|
+
redactedPayloadJson: string;
|
|
108
|
+
sourcePath: string;
|
|
109
|
+
sha256: string;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface TokenUsage {
|
|
113
|
+
input: number;
|
|
114
|
+
output: number;
|
|
115
|
+
reasoning: number;
|
|
116
|
+
cachedInput: number;
|
|
117
|
+
total: number;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export type DailyTokenUsagePoint = TokenUsage & {
|
|
121
|
+
date: string;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export interface DailyTokenUsageResponse {
|
|
125
|
+
projectId: string;
|
|
126
|
+
points: DailyTokenUsagePoint[];
|
|
127
|
+
total: TokenUsage;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export type SkillUsageSource =
|
|
131
|
+
| "session_meta"
|
|
132
|
+
| "developer_message"
|
|
133
|
+
| "user_prompt"
|
|
134
|
+
| "assistant_message"
|
|
135
|
+
| "tool_input"
|
|
136
|
+
| "tool_output"
|
|
137
|
+
| "event_message";
|
|
138
|
+
|
|
139
|
+
export interface SkillUsage {
|
|
140
|
+
name: string;
|
|
141
|
+
source: SkillUsageSource;
|
|
142
|
+
confidence: "explicit" | "inferred";
|
|
143
|
+
path: string | null;
|
|
144
|
+
command: string | null;
|
|
145
|
+
evidencePath: string;
|
|
146
|
+
excerpt: string;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface TimelineEvent {
|
|
150
|
+
id: string;
|
|
151
|
+
projectId: string;
|
|
152
|
+
sessionId: string;
|
|
153
|
+
turnId: string | null;
|
|
154
|
+
timestamp: string;
|
|
155
|
+
kind: EventKind;
|
|
156
|
+
lane: TimelineLane;
|
|
157
|
+
title: string;
|
|
158
|
+
detail: string | null;
|
|
159
|
+
toolName: string | null;
|
|
160
|
+
callId: string | null;
|
|
161
|
+
status: EventStatus;
|
|
162
|
+
files: string[];
|
|
163
|
+
rawEventRefId: string | null;
|
|
164
|
+
durationMs?: number | null;
|
|
165
|
+
outputEventId?: string | null;
|
|
166
|
+
commitHash?: string | null;
|
|
167
|
+
tokenUsage?: TokenUsage | null;
|
|
168
|
+
skills?: SkillUsage[];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export interface Episode {
|
|
172
|
+
id: string;
|
|
173
|
+
projectId: string;
|
|
174
|
+
startedAt: string;
|
|
175
|
+
endedAt: string;
|
|
176
|
+
title: string;
|
|
177
|
+
summary: string;
|
|
178
|
+
status: EventStatus;
|
|
179
|
+
eventIds: string[];
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export interface CausalEdge {
|
|
183
|
+
id: string;
|
|
184
|
+
projectId: string;
|
|
185
|
+
fromEventId: string;
|
|
186
|
+
toEventId: string;
|
|
187
|
+
type: CausalEdgeType;
|
|
188
|
+
confidence: CausalConfidence;
|
|
189
|
+
reason: string;
|
|
190
|
+
evidence: string | null;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
export type TaskJourneyExitType = "next_prompt" | "session_end";
|
|
194
|
+
|
|
195
|
+
export interface TaskJourneyStage {
|
|
196
|
+
lane: TimelineLane;
|
|
197
|
+
count: number;
|
|
198
|
+
status: EventStatus;
|
|
199
|
+
firstEventId: string;
|
|
200
|
+
lastEventId: string;
|
|
201
|
+
eventIds: string[];
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export interface TaskJourney {
|
|
205
|
+
id: string;
|
|
206
|
+
projectId: string;
|
|
207
|
+
sessionId: string;
|
|
208
|
+
promptEventId: string;
|
|
209
|
+
startedAt: string;
|
|
210
|
+
endedAt: string;
|
|
211
|
+
durationMs: number;
|
|
212
|
+
title: string;
|
|
213
|
+
summary: string;
|
|
214
|
+
status: EventStatus;
|
|
215
|
+
exitType: TaskJourneyExitType;
|
|
216
|
+
eventIds: string[];
|
|
217
|
+
tokenUsage: TokenUsage;
|
|
218
|
+
skills: SkillUsage[];
|
|
219
|
+
stageCounts: Partial<Record<TimelineLane, number>>;
|
|
220
|
+
stages: TaskJourneyStage[];
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export interface TaskJourneyDetail {
|
|
224
|
+
journey: TaskJourney;
|
|
225
|
+
events: TimelineEvent[];
|
|
226
|
+
causalEdges: CausalEdge[];
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export type ContextBlockType =
|
|
230
|
+
| "user_prompt"
|
|
231
|
+
| "developer_instruction"
|
|
232
|
+
| "history_prompt"
|
|
233
|
+
| "assistant_summary"
|
|
234
|
+
| "reasoning_summary"
|
|
235
|
+
| "tool_input"
|
|
236
|
+
| "tool_output"
|
|
237
|
+
| "file_reference"
|
|
238
|
+
| "file_excerpt"
|
|
239
|
+
| "error_output"
|
|
240
|
+
| "verification_output"
|
|
241
|
+
| "skill_instruction"
|
|
242
|
+
| "final_response";
|
|
243
|
+
|
|
244
|
+
export type ContextBlockState =
|
|
245
|
+
| "new"
|
|
246
|
+
| "retained"
|
|
247
|
+
| "changed"
|
|
248
|
+
| "cited"
|
|
249
|
+
| "dropped"
|
|
250
|
+
| "stale"
|
|
251
|
+
| "contradicted";
|
|
252
|
+
|
|
253
|
+
export type ContextSnapshotPhase =
|
|
254
|
+
| "prompt"
|
|
255
|
+
| "history"
|
|
256
|
+
| "planning"
|
|
257
|
+
| "tool_call"
|
|
258
|
+
| "tool_result"
|
|
259
|
+
| "file_change"
|
|
260
|
+
| "verification"
|
|
261
|
+
| "response";
|
|
262
|
+
|
|
263
|
+
export interface ContextBlock {
|
|
264
|
+
id: string;
|
|
265
|
+
type: ContextBlockType;
|
|
266
|
+
state: ContextBlockState;
|
|
267
|
+
title: string;
|
|
268
|
+
excerpt: string;
|
|
269
|
+
sourceEventId: string | null;
|
|
270
|
+
rawEventRefId: string | null;
|
|
271
|
+
sourcePath: string | null;
|
|
272
|
+
lineNo: number | null;
|
|
273
|
+
timestamp: string;
|
|
274
|
+
tokenEstimate: number;
|
|
275
|
+
confidence: "direct" | "inferred";
|
|
276
|
+
reason: string;
|
|
277
|
+
files: string[];
|
|
278
|
+
skills: string[];
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export interface ContextWarning {
|
|
282
|
+
id: string;
|
|
283
|
+
severity: "low" | "medium" | "high";
|
|
284
|
+
title: string;
|
|
285
|
+
detail: string;
|
|
286
|
+
blockIds: string[];
|
|
287
|
+
eventIds: string[];
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
export interface ContextSnapshot {
|
|
291
|
+
id: string;
|
|
292
|
+
phase: ContextSnapshotPhase;
|
|
293
|
+
timestamp: string;
|
|
294
|
+
eventId: string;
|
|
295
|
+
title: string;
|
|
296
|
+
blocks: ContextBlock[];
|
|
297
|
+
addedBlockIds: string[];
|
|
298
|
+
retainedBlockIds: string[];
|
|
299
|
+
changedBlockIds: string[];
|
|
300
|
+
droppedBlockIds: string[];
|
|
301
|
+
warnings: ContextWarning[];
|
|
302
|
+
tokenUsage: TokenUsage | null;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export interface Artifact {
|
|
306
|
+
id: string;
|
|
307
|
+
eventId: string;
|
|
308
|
+
type: "payload" | "command_output" | "file" | "git" | "note";
|
|
309
|
+
path: string | null;
|
|
310
|
+
excerpt: string;
|
|
311
|
+
sha256: string | null;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export interface IngestJob {
|
|
315
|
+
id: string;
|
|
316
|
+
status: "queued" | "running" | "completed" | "failed";
|
|
317
|
+
phase:
|
|
318
|
+
| "queued"
|
|
319
|
+
| "scanning"
|
|
320
|
+
| "diffing"
|
|
321
|
+
| "loading_history"
|
|
322
|
+
| "parsing"
|
|
323
|
+
| "normalizing"
|
|
324
|
+
| "writing"
|
|
325
|
+
| "completed"
|
|
326
|
+
| "failed";
|
|
327
|
+
startedAt: string;
|
|
328
|
+
finishedAt: string | null;
|
|
329
|
+
totalFiles: number;
|
|
330
|
+
processedFiles: number;
|
|
331
|
+
totalEvents: number;
|
|
332
|
+
errors: string[];
|
|
333
|
+
skippedFiles?: number;
|
|
334
|
+
candidateFiles?: number;
|
|
335
|
+
changedFiles?: number;
|
|
336
|
+
processedBytes?: number;
|
|
337
|
+
totalBytes?: number;
|
|
338
|
+
currentFile?: string | null;
|
|
339
|
+
workerPid?: number | null;
|
|
340
|
+
processorVersion?: string | null;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export interface AgentSourceConfig {
|
|
344
|
+
provider: AgentProvider;
|
|
345
|
+
root?: string;
|
|
346
|
+
path?: string;
|
|
347
|
+
mode?: "files" | "cli-export";
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export interface AgentLogSource {
|
|
351
|
+
provider: AgentProvider;
|
|
352
|
+
id: string;
|
|
353
|
+
path: string;
|
|
354
|
+
sizeBytes: number;
|
|
355
|
+
mtimeMs: number;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
export interface AgentParseOptions {
|
|
359
|
+
repoRoot?: string | null;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export interface AgentLogAdapter {
|
|
363
|
+
provider: AgentProvider;
|
|
364
|
+
scan(config?: AgentSourceConfig): Promise<AgentLogSource[]>;
|
|
365
|
+
parseSource(source: AgentLogSource, options?: AgentParseOptions): Promise<NormalizedBundle | null>;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export interface IngestResult {
|
|
369
|
+
job: IngestJob;
|
|
370
|
+
projects: number;
|
|
371
|
+
sessions: number;
|
|
372
|
+
events: number;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
export interface ReplayNode {
|
|
376
|
+
id: string;
|
|
377
|
+
eventId: string;
|
|
378
|
+
type: ReplayNodeType;
|
|
379
|
+
label: string;
|
|
380
|
+
timestamp: string;
|
|
381
|
+
status: EventStatus;
|
|
382
|
+
lane: TimelineLane;
|
|
383
|
+
x: number;
|
|
384
|
+
detail: string | null;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
export interface RunReplay {
|
|
388
|
+
session: SessionRecord;
|
|
389
|
+
events: TimelineEvent[];
|
|
390
|
+
nodes: ReplayNode[];
|
|
391
|
+
artifacts: Artifact[];
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
export interface ProjectTimeline {
|
|
395
|
+
project: ProjectRecord;
|
|
396
|
+
episodes: Episode[];
|
|
397
|
+
events: TimelineEvent[];
|
|
398
|
+
causalEdges: CausalEdge[];
|
|
399
|
+
taskJourneys: TaskJourney[];
|
|
400
|
+
tokenUsage: TokenUsage;
|
|
401
|
+
totalEvents?: number;
|
|
402
|
+
limit?: number;
|
|
403
|
+
offset?: number;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
export interface TimelineQuery {
|
|
407
|
+
limit?: number;
|
|
408
|
+
offset?: number;
|
|
409
|
+
lane?: TimelineLane;
|
|
410
|
+
since?: string;
|
|
411
|
+
until?: string;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
export interface EventEvidence {
|
|
415
|
+
event: TimelineEvent;
|
|
416
|
+
artifacts: Artifact[];
|
|
417
|
+
rawEvent: RawEventRef | null;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
export interface ContextReplayResponse {
|
|
421
|
+
journey: TaskJourney;
|
|
422
|
+
snapshots: ContextSnapshot[];
|
|
423
|
+
blocks: ContextBlock[];
|
|
424
|
+
evidenceByEventId: Record<string, EventEvidence>;
|
|
425
|
+
warnings: ContextWarning[];
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
export interface GitCommitRecord {
|
|
429
|
+
id: string;
|
|
430
|
+
projectId: string;
|
|
431
|
+
repoRoot: string;
|
|
432
|
+
hash: string;
|
|
433
|
+
shortHash: string;
|
|
434
|
+
authorName: string | null;
|
|
435
|
+
authorEmail: string | null;
|
|
436
|
+
timestamp: string;
|
|
437
|
+
subject: string;
|
|
438
|
+
filesChanged: number;
|
|
439
|
+
insertions: number;
|
|
440
|
+
deletions: number;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
export interface CodexHistoryPrompt {
|
|
444
|
+
sessionId: string;
|
|
445
|
+
ts: string;
|
|
446
|
+
text: string;
|
|
447
|
+
sourcePath: string;
|
|
448
|
+
lineNo: number;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
export interface NormalizedBundle {
|
|
452
|
+
project: ProjectRecord;
|
|
453
|
+
session: SessionRecord;
|
|
454
|
+
turns: TurnRecord[];
|
|
455
|
+
rawEventRefs: RawEventRef[];
|
|
456
|
+
events: TimelineEvent[];
|
|
457
|
+
artifacts: Artifact[];
|
|
458
|
+
historyPrompts?: CodexHistoryPrompt[];
|
|
459
|
+
gitCommits?: GitCommitRecord[];
|
|
460
|
+
}
|