@peasant-labs/fairtrade 0.0.2 → 0.0.3
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/dist/lib/base.css +7 -1
- package/dist/lib/components.css +1 -1
- package/dist/lib/types/Intensity.d.ts +3 -3
- package/dist/lib/types/index.d.ts +2 -0
- package/dist/lib/types/transcript/CheckRow.d.ts +15 -0
- package/dist/lib/types/transcript/DiffEntryCard.d.ts +27 -0
- package/dist/lib/types/transcript/FilterSection.d.ts +11 -0
- package/dist/lib/types/transcript/FiltersRail.d.ts +41 -0
- package/dist/lib/types/transcript/LabelPopover.d.ts +14 -0
- package/dist/lib/types/transcript/Markdown.d.ts +7 -0
- package/dist/lib/types/transcript/OutlineRail.d.ts +13 -0
- package/dist/lib/types/transcript/Scorecard.d.ts +8 -0
- package/dist/lib/types/transcript/Scrubber.d.ts +17 -0
- package/dist/lib/types/transcript/TaskBody.d.ts +8 -0
- package/dist/lib/types/transcript/Thinking.d.ts +9 -0
- package/dist/lib/types/transcript/ToolBody.d.ts +8 -0
- package/dist/lib/types/transcript/ToolCall.d.ts +12 -0
- package/dist/lib/types/transcript/TranscriptViewer.d.ts +6 -0
- package/dist/lib/types/transcript/TurnCard.d.ts +31 -0
- package/dist/lib/types/transcript/ViewSwitch.d.ts +11 -0
- package/dist/lib/types/transcript/adapter.d.ts +90 -0
- package/dist/lib/types/transcript/adapter.parse.d.ts +75 -0
- package/dist/lib/types/transcript/analytics.d.ts +216 -0
- package/dist/lib/types/transcript/graph/GraphLegend.d.ts +49 -0
- package/dist/lib/types/transcript/graph/GraphSubagentBranch.d.ts +24 -0
- package/dist/lib/types/transcript/graph/GraphToolNode.d.ts +56 -0
- package/dist/lib/types/transcript/graph/GraphTurnNode.d.ts +76 -0
- package/dist/lib/types/transcript/graph/index.d.ts +10 -0
- package/dist/lib/types/transcript/index.d.ts +69 -0
- package/dist/lib/types/transcript/state-capabilities.d.ts +161 -0
- package/dist/lib/types/transcript/view-model.d.ts +563 -0
- package/dist/lib/types/transcript/wire-types.d.ts +325 -0
- package/dist/lib/ui.js +4976 -1019
- package/package.json +7 -2
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/** @typedef {import('./wire-types.js').TurnDetail} TurnDetail */
|
|
2
|
+
/** @typedef {import('./wire-types.js').ToolCallDetail} ToolCallDetail */
|
|
3
|
+
/** @typedef {import('./wire-types.js').SessionScorecard} SessionScorecard */
|
|
4
|
+
/** @typedef {import('./view-model.js').PhaseVM} PhaseVM */
|
|
5
|
+
/** @typedef {import('./view-model.js').ScorecardBandVM} ScorecardBandVM */
|
|
6
|
+
/** @typedef {import('./view-model.js').AnnotationVM} AnnotationVM */
|
|
7
|
+
/** @typedef {import('./view-model.js').TaskGroupVM} TaskGroupVM */
|
|
8
|
+
/** @typedef {import('./view-model.js').TranscriptAnalyticsVM} TranscriptAnalyticsVM */
|
|
9
|
+
/**
|
|
10
|
+
* A "task" is the span from a top-level user prompt up to (but not including)
|
|
11
|
+
* the next one — one turn of human↔agent collaboration. The shape is the
|
|
12
|
+
* canonical `TaskGroup` the transcript-browser already exports, kept stable for
|
|
13
|
+
* back-compat re-export.
|
|
14
|
+
* @typedef {object} TaskGroup
|
|
15
|
+
* @property {number} startIndex display position of the starting prompt
|
|
16
|
+
* @property {number} endIndex display position of the last turn (inclusive)
|
|
17
|
+
* @property {number} promptEntryIndex wire entry index of the prompt (anchor)
|
|
18
|
+
* @property {number} [finalEntryIndex] wire entry index of the final assistant turn
|
|
19
|
+
* @property {string} prompt untruncated user prompt
|
|
20
|
+
* @property {number} toolCallCount
|
|
21
|
+
* @property {string[]} filesTouched
|
|
22
|
+
* @property {number} insertions
|
|
23
|
+
* @property {number} deletions
|
|
24
|
+
* @property {number} durationMs
|
|
25
|
+
* @property {boolean} hasErrors
|
|
26
|
+
* @property {number} tokens
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* Split a turn list into task groups. Each top-level (depth-0) user turn starts
|
|
30
|
+
* a new task; depth-1+ user turns are content blocks, NOT boundaries. A session
|
|
31
|
+
* that starts without a user prompt is a single task spanning everything.
|
|
32
|
+
* @param {TurnDetail[]} turns
|
|
33
|
+
* @returns {TaskGroup[]}
|
|
34
|
+
*/
|
|
35
|
+
export function computeTasks(turns: TurnDetail[]): TaskGroup[];
|
|
36
|
+
/**
|
|
37
|
+
* Per-turn display labels: `"1"`, `"2"` for the prompts that open a task, and
|
|
38
|
+
* `"2a"`, `"2b"` for the follow-ups within it.
|
|
39
|
+
* @param {TurnDetail[]} turns
|
|
40
|
+
* @returns {string[]}
|
|
41
|
+
*/
|
|
42
|
+
export function computeTurnLabels(turns: TurnDetail[]): string[];
|
|
43
|
+
/**
|
|
44
|
+
* One segment of the proportional task waterfall: a task's share of the total
|
|
45
|
+
* work time and the cumulative share before it (segments tile back-to-back).
|
|
46
|
+
* @typedef {object} WaterfallSegment
|
|
47
|
+
* @property {number} promptEntryIndex
|
|
48
|
+
* @property {number} offsetPct
|
|
49
|
+
* @property {number} widthPct
|
|
50
|
+
* @property {number} durationMs
|
|
51
|
+
*/
|
|
52
|
+
/**
|
|
53
|
+
* Turn task groups into a relative-duration lane. When the total duration is 0
|
|
54
|
+
* (untimed transcript) every segment is zero-width at offset 0 — the caller
|
|
55
|
+
* renders the task list without bars rather than dividing by zero.
|
|
56
|
+
* @param {TaskGroup[]} tasks
|
|
57
|
+
* @returns {WaterfallSegment[]}
|
|
58
|
+
*/
|
|
59
|
+
export function buildTaskWaterfall(tasks: TaskGroup[]): WaterfallSegment[];
|
|
60
|
+
/**
|
|
61
|
+
* Walk a transcript and surface error / retry / revert / subagent moments,
|
|
62
|
+
* sorted by display position.
|
|
63
|
+
* @param {TurnDetail[]} turns
|
|
64
|
+
* @returns {TranscriptAnnotation[]}
|
|
65
|
+
*/
|
|
66
|
+
export function annotateTranscript(turns: TurnDetail[]): TranscriptAnnotation[];
|
|
67
|
+
/** Display label for a phase type, falling back to the raw value. @param {string} type @returns {string} */
|
|
68
|
+
export function phaseLabel(type: string): string;
|
|
69
|
+
/**
|
|
70
|
+
* Segment a transcript into rendered phases. `from` / `to` are WIRE turn indices
|
|
71
|
+
* (matching `TurnVM.index`), so a divider component can anchor by them directly.
|
|
72
|
+
* @param {TurnDetail[]} turns
|
|
73
|
+
* @returns {PhaseVM[]}
|
|
74
|
+
*/
|
|
75
|
+
export function detectPhases(turns: TurnDetail[]): PhaseVM[];
|
|
76
|
+
/**
|
|
77
|
+
* Per-metric medians across the user's sessions, each field undefined when the
|
|
78
|
+
* sample yields no value (so the comparison line degrades rather than fabricate
|
|
79
|
+
* a baseline). The host supplies the sessions; the viewer never fetches them.
|
|
80
|
+
* @param {PersonalMedianSession[] | undefined} sessions
|
|
81
|
+
* @returns {PersonalMedians}
|
|
82
|
+
*/
|
|
83
|
+
export function computePersonalMedians(sessions: PersonalMedianSession[] | undefined): PersonalMedians;
|
|
84
|
+
/**
|
|
85
|
+
* Derive the three scorecard axis verdict bands (token / prompt / loop
|
|
86
|
+
* efficiency) from the raw numeric signals. Returns `[]` when the scorecard
|
|
87
|
+
* carries no usable signal, so the card is omitted cleanly.
|
|
88
|
+
* @param {SessionScorecard | null | undefined} sc
|
|
89
|
+
* @param {PersonalMedians} [medians]
|
|
90
|
+
* @returns {ScorecardBandVM[]}
|
|
91
|
+
*/
|
|
92
|
+
export function assessScorecard(sc: SessionScorecard | null | undefined, medians?: PersonalMedians): ScorecardBandVM[];
|
|
93
|
+
/**
|
|
94
|
+
* The cooked task groups for a turn list (`computeTasks` mapped onto
|
|
95
|
+
* `TaskGroupVM`). Exported so the adapter can populate the always-present
|
|
96
|
+
* `vm.tasks` from the same single computation `computeAnalytics` uses.
|
|
97
|
+
* @param {TurnDetail[]} turns
|
|
98
|
+
* @returns {TaskGroupVM[]}
|
|
99
|
+
*/
|
|
100
|
+
export function computeTaskGroups(turns: TurnDetail[]): TaskGroupVM[];
|
|
101
|
+
/**
|
|
102
|
+
* Compute the cooked single-session analytics block from a (prefiltered) turn
|
|
103
|
+
* list. Each field is omitted when empty so the block is genuinely
|
|
104
|
+
* render-when-present. The adapter calls this on demand when no precomputed
|
|
105
|
+
* analytics is supplied, and reuses the returned `patternAnnotations` /
|
|
106
|
+
* `taskGroups` so nothing is derived twice.
|
|
107
|
+
* @param {TurnDetail[]} turns
|
|
108
|
+
* @param {{ scorecard?: SessionScorecard | null, medians?: PersonalMedians }} [opts]
|
|
109
|
+
* @returns {TranscriptAnalyticsVM}
|
|
110
|
+
*/
|
|
111
|
+
export function computeAnalytics(turns: TurnDetail[], opts?: {
|
|
112
|
+
scorecard?: SessionScorecard | null;
|
|
113
|
+
medians?: PersonalMedians;
|
|
114
|
+
}): TranscriptAnalyticsVM;
|
|
115
|
+
export type TurnDetail = import("./wire-types.js").TurnDetail;
|
|
116
|
+
export type ToolCallDetail = import("./wire-types.js").ToolCallDetail;
|
|
117
|
+
export type SessionScorecard = import("./wire-types.js").SessionScorecard;
|
|
118
|
+
export type PhaseVM = import("./view-model.js").PhaseVM;
|
|
119
|
+
export type ScorecardBandVM = import("./view-model.js").ScorecardBandVM;
|
|
120
|
+
export type AnnotationVM = import("./view-model.js").AnnotationVM;
|
|
121
|
+
export type TaskGroupVM = import("./view-model.js").TaskGroupVM;
|
|
122
|
+
export type TranscriptAnalyticsVM = import("./view-model.js").TranscriptAnalyticsVM;
|
|
123
|
+
/**
|
|
124
|
+
* A "task" is the span from a top-level user prompt up to (but not including)
|
|
125
|
+
* the next one — one turn of human↔agent collaboration. The shape is the
|
|
126
|
+
* canonical `TaskGroup` the transcript-browser already exports, kept stable for
|
|
127
|
+
* back-compat re-export.
|
|
128
|
+
*/
|
|
129
|
+
export type TaskGroup = {
|
|
130
|
+
/**
|
|
131
|
+
* display position of the starting prompt
|
|
132
|
+
*/
|
|
133
|
+
startIndex: number;
|
|
134
|
+
/**
|
|
135
|
+
* display position of the last turn (inclusive)
|
|
136
|
+
*/
|
|
137
|
+
endIndex: number;
|
|
138
|
+
/**
|
|
139
|
+
* wire entry index of the prompt (anchor)
|
|
140
|
+
*/
|
|
141
|
+
promptEntryIndex: number;
|
|
142
|
+
/**
|
|
143
|
+
* wire entry index of the final assistant turn
|
|
144
|
+
*/
|
|
145
|
+
finalEntryIndex?: number;
|
|
146
|
+
/**
|
|
147
|
+
* untruncated user prompt
|
|
148
|
+
*/
|
|
149
|
+
prompt: string;
|
|
150
|
+
toolCallCount: number;
|
|
151
|
+
filesTouched: string[];
|
|
152
|
+
insertions: number;
|
|
153
|
+
deletions: number;
|
|
154
|
+
durationMs: number;
|
|
155
|
+
hasErrors: boolean;
|
|
156
|
+
tokens: number;
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* One segment of the proportional task waterfall: a task's share of the total
|
|
160
|
+
* work time and the cumulative share before it (segments tile back-to-back).
|
|
161
|
+
*/
|
|
162
|
+
export type WaterfallSegment = {
|
|
163
|
+
promptEntryIndex: number;
|
|
164
|
+
offsetPct: number;
|
|
165
|
+
widthPct: number;
|
|
166
|
+
durationMs: number;
|
|
167
|
+
};
|
|
168
|
+
export type FailedAttempt = {
|
|
169
|
+
tools: string[];
|
|
170
|
+
turnRange: [number, number];
|
|
171
|
+
};
|
|
172
|
+
export type PersonalMedians = {
|
|
173
|
+
retryShare?: number;
|
|
174
|
+
specQualityScore?: number;
|
|
175
|
+
withinSessionReverts?: number;
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* A session sample for personal-median computation — the QualitySession subset
|
|
179
|
+
* the medians read. Kept structural so the transcript-browser `QualitySession`
|
|
180
|
+
* is assignable for back-compat.
|
|
181
|
+
*/
|
|
182
|
+
export type PersonalMedianSession = {
|
|
183
|
+
totalTokens: number;
|
|
184
|
+
retryTokensWasted: number;
|
|
185
|
+
specQualityScore: number;
|
|
186
|
+
withinSessionReverts: number;
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* A client-side detected pattern moment. Canonical `TranscriptAnnotation` shape
|
|
190
|
+
* kept stable for back-compat re-export.
|
|
191
|
+
*/
|
|
192
|
+
export type TranscriptAnnotation = {
|
|
193
|
+
/**
|
|
194
|
+
* display position
|
|
195
|
+
*/
|
|
196
|
+
turnIndex: number;
|
|
197
|
+
type: "retry" | "error" | "revert" | "subagent";
|
|
198
|
+
label: string;
|
|
199
|
+
severity: "info" | "warning" | "error";
|
|
200
|
+
};
|
|
201
|
+
export type PhaseType = "planning" | "exploration" | "implementation" | "testing" | "error" | "debug" | "retry-loop" | "user-correction" | "recovery" | "abandonment";
|
|
202
|
+
export type PhaseSegment = {
|
|
203
|
+
type: PhaseType;
|
|
204
|
+
/**
|
|
205
|
+
* display position (inclusive)
|
|
206
|
+
*/
|
|
207
|
+
startTurn: number;
|
|
208
|
+
/**
|
|
209
|
+
* display position (inclusive)
|
|
210
|
+
*/
|
|
211
|
+
endTurn: number;
|
|
212
|
+
badges: {
|
|
213
|
+
type: PhaseType;
|
|
214
|
+
count: number;
|
|
215
|
+
}[];
|
|
216
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The trajectory-graph legend visual.
|
|
3
|
+
* @param {GraphLegendProps} props
|
|
4
|
+
* @returns {JSX.Element}
|
|
5
|
+
*/
|
|
6
|
+
export function GraphLegend({ items, className }: GraphLegendProps): JSX.Element;
|
|
7
|
+
/**
|
|
8
|
+
* One legend entry.
|
|
9
|
+
* @typedef {object} GraphLegendItem
|
|
10
|
+
* @property {'user' | 'assistant' | 'subagent' | 'tool' | 'error' | (string & {})} kind
|
|
11
|
+
* the node kind this swatch stands for; selects the accent
|
|
12
|
+
* @property {string} label the lowercase word shown beside the swatch
|
|
13
|
+
* @property {string} [provider] harness key → assistant swatch accent
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {object} GraphLegendProps
|
|
17
|
+
* @property {GraphLegendItem[]} [items] legend entries (defaults to GRAPH_LEGEND_ITEMS)
|
|
18
|
+
* @property {string} [className]
|
|
19
|
+
*/
|
|
20
|
+
/** The canonical legend set, in display order — mirrors the mockup's legend. */
|
|
21
|
+
export const GRAPH_LEGEND_ITEMS: readonly {
|
|
22
|
+
kind: string;
|
|
23
|
+
label: string;
|
|
24
|
+
}[];
|
|
25
|
+
export default GraphLegend;
|
|
26
|
+
/**
|
|
27
|
+
* One legend entry.
|
|
28
|
+
*/
|
|
29
|
+
export type GraphLegendItem = {
|
|
30
|
+
/**
|
|
31
|
+
* the node kind this swatch stands for; selects the accent
|
|
32
|
+
*/
|
|
33
|
+
kind: "user" | "assistant" | "subagent" | "tool" | "error" | (string & {});
|
|
34
|
+
/**
|
|
35
|
+
* the lowercase word shown beside the swatch
|
|
36
|
+
*/
|
|
37
|
+
label: string;
|
|
38
|
+
/**
|
|
39
|
+
* harness key → assistant swatch accent
|
|
40
|
+
*/
|
|
41
|
+
provider?: string;
|
|
42
|
+
};
|
|
43
|
+
export type GraphLegendProps = {
|
|
44
|
+
/**
|
|
45
|
+
* legend entries (defaults to GRAPH_LEGEND_ITEMS)
|
|
46
|
+
*/
|
|
47
|
+
items?: GraphLegendItem[];
|
|
48
|
+
className?: string;
|
|
49
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {object} GraphSubagentBranchProps
|
|
3
|
+
* @property {string} agentName the nested agent's name (user content)
|
|
4
|
+
* @property {number} depth nesting depth (1 = first level under the main lane)
|
|
5
|
+
* @property {string} [className]
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* The subagent swimlane header visual.
|
|
9
|
+
* @param {GraphSubagentBranchProps} props
|
|
10
|
+
* @returns {JSX.Element}
|
|
11
|
+
*/
|
|
12
|
+
export function GraphSubagentBranch({ agentName, depth, className }: GraphSubagentBranchProps): JSX.Element;
|
|
13
|
+
export default GraphSubagentBranch;
|
|
14
|
+
export type GraphSubagentBranchProps = {
|
|
15
|
+
/**
|
|
16
|
+
* the nested agent's name (user content)
|
|
17
|
+
*/
|
|
18
|
+
agentName: string;
|
|
19
|
+
/**
|
|
20
|
+
* nesting depth (1 = first level under the main lane)
|
|
21
|
+
*/
|
|
22
|
+
depth: number;
|
|
23
|
+
className?: string;
|
|
24
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The trajectory-graph tool-cluster pill visual.
|
|
3
|
+
* @param {GraphToolNodeProps} props
|
|
4
|
+
* @returns {JSX.Element}
|
|
5
|
+
*/
|
|
6
|
+
export function GraphToolNode({ tools, totalDurationMs, hasError, isFilteredOut, max, className, }: GraphToolNodeProps): JSX.Element;
|
|
7
|
+
export default GraphToolNode;
|
|
8
|
+
/**
|
|
9
|
+
* One cooked tool entry for the cluster. A strict presentational subset of
|
|
10
|
+
* ToolCallVM — note the absence of any raw wire `arguments`/`result` string, by
|
|
11
|
+
* design, so the visual cannot parse wire JSON.
|
|
12
|
+
*/
|
|
13
|
+
export type GraphToolItem = {
|
|
14
|
+
id: string;
|
|
15
|
+
/**
|
|
16
|
+
* display name (e.g. "Read", "Bash")
|
|
17
|
+
*/
|
|
18
|
+
name: string;
|
|
19
|
+
/**
|
|
20
|
+
* tool kind (decorative grouping hint)
|
|
21
|
+
*/
|
|
22
|
+
kind?: string;
|
|
23
|
+
/**
|
|
24
|
+
* cooked path; basename is the preview fallback
|
|
25
|
+
*/
|
|
26
|
+
filePath?: string;
|
|
27
|
+
/**
|
|
28
|
+
* cooked one-line arg summary (NEVER parsed here)
|
|
29
|
+
*/
|
|
30
|
+
preview?: string;
|
|
31
|
+
isError?: boolean;
|
|
32
|
+
exitCode?: number;
|
|
33
|
+
};
|
|
34
|
+
export type GraphToolNodeProps = {
|
|
35
|
+
/**
|
|
36
|
+
* the cooked tool calls for this turn
|
|
37
|
+
*/
|
|
38
|
+
tools: GraphToolItem[];
|
|
39
|
+
/**
|
|
40
|
+
* summed duration → header badge
|
|
41
|
+
*/
|
|
42
|
+
totalDurationMs?: number;
|
|
43
|
+
/**
|
|
44
|
+
* cluster carries a failed call
|
|
45
|
+
*/
|
|
46
|
+
hasError?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* engine: dimmed by an active filter
|
|
49
|
+
*/
|
|
50
|
+
isFilteredOut?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* rows before collapsing to "+ N more" (default 4)
|
|
53
|
+
*/
|
|
54
|
+
max?: number;
|
|
55
|
+
className?: string;
|
|
56
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The trajectory-graph turn card visual.
|
|
3
|
+
* @param {GraphTurnNodeProps} props
|
|
4
|
+
* @returns {JSX.Element}
|
|
5
|
+
*/
|
|
6
|
+
export function GraphTurnNode({ role, agentName, turnNumber, contentPreview, toolCount, totalTokens, tokensIn, tokensOut, hasError, hasRetry, hasRevert, isSearchMatch, isFilteredOut, isSelected, provider, className, }: GraphTurnNodeProps): JSX.Element;
|
|
7
|
+
export default GraphTurnNode;
|
|
8
|
+
export type Role = import("../wire-types.js").Role;
|
|
9
|
+
/**
|
|
10
|
+
* Cooked, engine-agnostic props for one trajectory-graph turn card. Every field
|
|
11
|
+
* is a finished display value — the component does no parsing, truncation, or
|
|
12
|
+
* data derivation beyond choosing the accent token and chrome label.
|
|
13
|
+
*/
|
|
14
|
+
export type GraphTurnNodeProps = {
|
|
15
|
+
/**
|
|
16
|
+
* canonical role; selects the chrome label + base accent
|
|
17
|
+
*/
|
|
18
|
+
role: Role;
|
|
19
|
+
/**
|
|
20
|
+
* subagent name; PRESENT ⇒ render as a subagent (mauve)
|
|
21
|
+
*/
|
|
22
|
+
agentName?: string;
|
|
23
|
+
/**
|
|
24
|
+
* the display number shown as "#…"
|
|
25
|
+
*/
|
|
26
|
+
turnNumber: string | number;
|
|
27
|
+
/**
|
|
28
|
+
* one-line, already-truncated preview (may be empty)
|
|
29
|
+
*/
|
|
30
|
+
contentPreview: string;
|
|
31
|
+
/**
|
|
32
|
+
* tool-call count for the footer ("N tools")
|
|
33
|
+
*/
|
|
34
|
+
toolCount: number;
|
|
35
|
+
/**
|
|
36
|
+
* total tokens for the footer badge
|
|
37
|
+
*/
|
|
38
|
+
totalTokens: number;
|
|
39
|
+
/**
|
|
40
|
+
* optional split, surfaced via title for hover detail
|
|
41
|
+
*/
|
|
42
|
+
tokensIn?: number;
|
|
43
|
+
tokensOut?: number;
|
|
44
|
+
/**
|
|
45
|
+
* clay accent + error flag (highest-priority flag)
|
|
46
|
+
*/
|
|
47
|
+
hasError?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* "retry" flag (when not an error)
|
|
50
|
+
*/
|
|
51
|
+
hasRetry?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* "re-edit" flag (when not an error or retry)
|
|
54
|
+
*/
|
|
55
|
+
hasRevert?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* engine: highlighted as a search hit
|
|
58
|
+
*/
|
|
59
|
+
isSearchMatch?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* engine: dimmed because a filter excludes it
|
|
62
|
+
*/
|
|
63
|
+
isFilteredOut?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* engine: the active/selected node
|
|
66
|
+
*/
|
|
67
|
+
isSelected?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* harness key (e.g. "claude-code") → assistant accent
|
|
70
|
+
*/
|
|
71
|
+
provider?: string;
|
|
72
|
+
/**
|
|
73
|
+
* extra classes appended after the base
|
|
74
|
+
*/
|
|
75
|
+
className?: string;
|
|
76
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { GraphTurnNode } from "./GraphTurnNode.jsx";
|
|
2
|
+
export { GraphToolNode } from "./GraphToolNode.jsx";
|
|
3
|
+
export { GraphSubagentBranch } from "./GraphSubagentBranch.jsx";
|
|
4
|
+
export type GraphTurnNodeProps = import("./GraphTurnNode.jsx").GraphTurnNodeProps;
|
|
5
|
+
export type GraphToolNodeProps = import("./GraphToolNode.jsx").GraphToolNodeProps;
|
|
6
|
+
export type GraphToolItem = import("./GraphToolNode.jsx").GraphToolItem;
|
|
7
|
+
export type GraphSubagentBranchProps = import("./GraphSubagentBranch.jsx").GraphSubagentBranchProps;
|
|
8
|
+
export type GraphLegendProps = import("./GraphLegend.jsx").GraphLegendProps;
|
|
9
|
+
export type GraphLegendItem = import("./GraphLegend.jsx").GraphLegendItem;
|
|
10
|
+
export { GraphLegend, GRAPH_LEGEND_ITEMS } from "./GraphLegend.jsx";
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export { TOOL_GROUPS } from "./view-model.js";
|
|
2
|
+
export { default as TranscriptTurnCard } from "./TurnCard.jsx";
|
|
3
|
+
export { default as TranscriptThinking } from "./Thinking.jsx";
|
|
4
|
+
export { default as TranscriptMarkdown } from "./Markdown.jsx";
|
|
5
|
+
export { default as TranscriptToolCall } from "./ToolCall.jsx";
|
|
6
|
+
export { default as TranscriptToolBody } from "./ToolBody.jsx";
|
|
7
|
+
export { default as TranscriptTaskBody } from "./TaskBody.jsx";
|
|
8
|
+
export { default as TranscriptViewer } from "./TranscriptViewer.jsx";
|
|
9
|
+
export { default as TranscriptOutlineRail } from "./OutlineRail.jsx";
|
|
10
|
+
export { default as TranscriptFiltersRail } from "./FiltersRail.jsx";
|
|
11
|
+
export { default as TranscriptFilterSection } from "./FilterSection.jsx";
|
|
12
|
+
export { default as TranscriptCheckRow } from "./CheckRow.jsx";
|
|
13
|
+
export { default as TranscriptViewSwitch } from "./ViewSwitch.jsx";
|
|
14
|
+
export { default as TranscriptScrubber } from "./Scrubber.jsx";
|
|
15
|
+
export { default as TranscriptScorecard } from "./Scorecard.jsx";
|
|
16
|
+
export { default as TranscriptLabelPopover } from "./LabelPopover.jsx";
|
|
17
|
+
export type TaskGroup = import("./analytics.js").TaskGroup;
|
|
18
|
+
export type WaterfallSegment = import("./analytics.js").WaterfallSegment;
|
|
19
|
+
export type TranscriptAnnotation = import("./analytics.js").TranscriptAnnotation;
|
|
20
|
+
export type PersonalMedians = import("./analytics.js").PersonalMedians;
|
|
21
|
+
export type PersonalMedianSession = import("./analytics.js").PersonalMedianSession;
|
|
22
|
+
export type PhaseType = import("./analytics.js").PhaseType;
|
|
23
|
+
export type Role = import("./wire-types.js").Role;
|
|
24
|
+
export type EntryType = import("./wire-types.js").EntryType;
|
|
25
|
+
export type ToolCallKind = import("./wire-types.js").ToolCallKind;
|
|
26
|
+
export type StopReason = import("./wire-types.js").StopReason;
|
|
27
|
+
export type SessionOutcome = import("./wire-types.js").SessionOutcome;
|
|
28
|
+
export type Harness = import("./wire-types.js").Harness;
|
|
29
|
+
export type ToolCallDetail = import("./wire-types.js").ToolCallDetail;
|
|
30
|
+
export type TurnDetail = import("./wire-types.js").TurnDetail;
|
|
31
|
+
export type ChildSessionRef = import("./wire-types.js").ChildSessionRef;
|
|
32
|
+
export type SessionScorecard = import("./wire-types.js").SessionScorecard;
|
|
33
|
+
export type CommitInfo = import("./wire-types.js").CommitInfo;
|
|
34
|
+
export type GitContext = import("./wire-types.js").GitContext;
|
|
35
|
+
export type AnnotationSummary = import("./wire-types.js").AnnotationSummary;
|
|
36
|
+
export type SessionDetailPayload = import("./wire-types.js").SessionDetailPayload;
|
|
37
|
+
export type TranscriptWireInput = import("./wire-types.js").TranscriptWireInput;
|
|
38
|
+
export type TranscriptViewerProps = import("./state-capabilities.js").TranscriptViewerProps;
|
|
39
|
+
export type ViewerCapabilities = import("./state-capabilities.js").ViewerCapabilities;
|
|
40
|
+
export type ViewerCallbacks = import("./state-capabilities.js").ViewerCallbacks;
|
|
41
|
+
export type GraphSlotContext = import("./state-capabilities.js").GraphSlotContext;
|
|
42
|
+
export type TranscriptFilters = import("./state-capabilities.js").TranscriptFilters;
|
|
43
|
+
export type SavedLabel = import("./state-capabilities.js").SavedLabel;
|
|
44
|
+
export type Theme = import("./state-capabilities.js").Theme;
|
|
45
|
+
export type TranscriptTab = import("./state-capabilities.js").TranscriptTab;
|
|
46
|
+
export type ViewMode = import("./state-capabilities.js").ViewMode;
|
|
47
|
+
export type TranscriptViewModel = import("./view-model.js").TranscriptViewModel;
|
|
48
|
+
export type SessionVM = import("./view-model.js").SessionVM;
|
|
49
|
+
export type SessionGitVM = import("./view-model.js").SessionGitVM;
|
|
50
|
+
export type CommitVM = import("./view-model.js").CommitVM;
|
|
51
|
+
export type TurnVM = import("./view-model.js").TurnVM;
|
|
52
|
+
export type ThinkingVM = import("./view-model.js").ThinkingVM;
|
|
53
|
+
export type ToolCallVM = import("./view-model.js").ToolCallVM;
|
|
54
|
+
export type ToolGroup = import("./view-model.js").ToolGroup;
|
|
55
|
+
export type DiffLineVM = import("./view-model.js").DiffLineVM;
|
|
56
|
+
export type DiffHunkVM = import("./view-model.js").DiffHunkVM;
|
|
57
|
+
export type DiffEntryVM = import("./view-model.js").DiffEntryVM;
|
|
58
|
+
export type FileEntryVM = import("./view-model.js").FileEntryVM;
|
|
59
|
+
export type TaskGroupVM = import("./view-model.js").TaskGroupVM;
|
|
60
|
+
export type HighlightVM = import("./view-model.js").HighlightVM;
|
|
61
|
+
export type AnnotationVM = import("./view-model.js").AnnotationVM;
|
|
62
|
+
export type FilterIndexVM = import("./view-model.js").FilterIndexVM;
|
|
63
|
+
export type PhaseVM = import("./view-model.js").PhaseVM;
|
|
64
|
+
export type ScorecardBandVM = import("./view-model.js").ScorecardBandVM;
|
|
65
|
+
export type TranscriptAnalyticsVM = import("./view-model.js").TranscriptAnalyticsVM;
|
|
66
|
+
export { ROLES, ENTRY_TYPES, TOOL_CALL_KINDS, STOP_REASONS, SESSION_OUTCOMES, HARNESSES } from "./wire-types.js";
|
|
67
|
+
export { adaptTranscript, prefilterTurns, diffLines } from "./adapter.js";
|
|
68
|
+
export { computeTasks, computeTurnLabels, buildTaskWaterfall, annotateTranscript, computePersonalMedians, detectPhases, assessScorecard, computeAnalytics, computeTaskGroups, phaseLabel } from "./analytics.js";
|
|
69
|
+
export { default as TranscriptDiffEntryCard, DiffHunks as TranscriptDiffHunks } from "./DiffEntryCard.jsx";
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The five session views. `highlights` is backed by `vm.highlights`; the rest
|
|
3
|
+
* read their cooked slices off the same `TranscriptViewModel`.
|
|
4
|
+
*/
|
|
5
|
+
export type TranscriptTab = "highlights" | "trace" | "diffs" | "files" | "annotations";
|
|
6
|
+
/**
|
|
7
|
+
* The trace canvas render mode: the lifted turn-card list, or the graph slot.
|
|
8
|
+
*/
|
|
9
|
+
export type ViewMode = "list" | "graph";
|
|
10
|
+
/**
|
|
11
|
+
* The optional theme; defaults to `dark` when unset.
|
|
12
|
+
*/
|
|
13
|
+
export type Theme = "dark" | "light";
|
|
14
|
+
/**
|
|
15
|
+
* A per-turn saved label (the LabelPopover's output). `outcome` is the verdict
|
|
16
|
+
* band; `flag` is an optional friction tag. Keyed by turn index in `savedLabels`.
|
|
17
|
+
*/
|
|
18
|
+
export type SavedLabel = {
|
|
19
|
+
outcome: "good" | "neutral" | "bad";
|
|
20
|
+
flag?: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* The cooked filter state the FiltersRail drives. Categories gate turn KINDS;
|
|
24
|
+
* `toolGroups` gate tool-call groups (keyed by the cooked `ToolGroup` ids);
|
|
25
|
+
* `tags` gate semantic friction tags; `views` are display toggles; `checkpoint`
|
|
26
|
+
* scopes the trace to a commit (`'all'` = unscoped).
|
|
27
|
+
*/
|
|
28
|
+
export type TranscriptFilters = {
|
|
29
|
+
categories: {
|
|
30
|
+
prompts: boolean;
|
|
31
|
+
responses: boolean;
|
|
32
|
+
thinking: boolean;
|
|
33
|
+
toolcalls: boolean;
|
|
34
|
+
};
|
|
35
|
+
toolGroups: Partial<Record<import("./view-model.js").ToolGroup, boolean>>;
|
|
36
|
+
tags: {
|
|
37
|
+
errors: boolean;
|
|
38
|
+
retries: boolean;
|
|
39
|
+
revert: boolean;
|
|
40
|
+
};
|
|
41
|
+
views: {
|
|
42
|
+
hidden: boolean;
|
|
43
|
+
expandAll: boolean;
|
|
44
|
+
compact: boolean;
|
|
45
|
+
};
|
|
46
|
+
checkpoint: string;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* The consumer/auth-derived permission surface — REQUIRED on TranscriptViewer
|
|
50
|
+
* (no default). Every flag is required (not optional) so a consumer cannot pass
|
|
51
|
+
* a partial surface and silently leave a permission unset; the host decides each
|
|
52
|
+
* one explicitly. The composite gates each capability's affordance + callback on
|
|
53
|
+
* its flag, so a `false` capability removes the affordance entirely.
|
|
54
|
+
*/
|
|
55
|
+
export type ViewerCapabilities = {
|
|
56
|
+
/**
|
|
57
|
+
* show the "edit" action + wire `onEdit`
|
|
58
|
+
*/
|
|
59
|
+
canEdit: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* show the per-turn "label" affordance + the LabelPopover
|
|
62
|
+
*/
|
|
63
|
+
canLabel: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* show the "contribute" share action + wire `onContribute`
|
|
66
|
+
*/
|
|
67
|
+
canContribute: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* show the visibility control + wire `onChangeVisibility`
|
|
70
|
+
*/
|
|
71
|
+
canChangeVisibility: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* show the download (json/jsonl/markdown) actions + wire `onExport`
|
|
74
|
+
*/
|
|
75
|
+
canExport: boolean;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* The host callbacks. All optional; each is wired ONLY when its matching
|
|
79
|
+
* capability is true (see ViewerCapabilities). `onLabel` carries the popover's
|
|
80
|
+
* cooked result; `onExport` carries the requested format. The viewer never
|
|
81
|
+
* mutates the host's data — it reports intent through these.
|
|
82
|
+
*/
|
|
83
|
+
export type ViewerCallbacks = {
|
|
84
|
+
onEdit?: () => void;
|
|
85
|
+
onLabel?: (turnIndex: number, label: SavedLabel) => void;
|
|
86
|
+
onContribute?: () => void;
|
|
87
|
+
onCopyLink?: () => void;
|
|
88
|
+
onChangeVisibility?: () => void;
|
|
89
|
+
onExport?: (format: "json" | "jsonl" | "markdown") => void;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* What the `graphSlot` render-prop receives. The composite owns NO graph engine
|
|
93
|
+
* (no `@xyflow` dependency); in `viewMode: 'graph'` it hands the consumer this
|
|
94
|
+
* cooked context and renders whatever the consumer returns (TB plugs its
|
|
95
|
+
*/
|
|
96
|
+
export type GraphSlotContext = {
|
|
97
|
+
viewModel: import("./view-model.js").TranscriptViewModel;
|
|
98
|
+
activeTurn: number;
|
|
99
|
+
onSelectTurn: (turnIndex: number) => void;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Every TranscriptViewer prop. `viewModel` + `capabilities` are the only required
|
|
103
|
+
* props; everything else is optional with a sane internal default, so
|
|
104
|
+
* `<TranscriptViewer viewModel={vm} capabilities={caps} />` renders the whole
|
|
105
|
+
* surface unmanaged. Each view-state prop is the `value?` half of a controllable
|
|
106
|
+
* pair whose `onChange?` half sits beside it (React's controlled-component
|
|
107
|
+
* convention): pass neither ⇒ internal default; pass both ⇒ fully controlled.
|
|
108
|
+
*/
|
|
109
|
+
export type TranscriptViewerProps = {
|
|
110
|
+
/**
|
|
111
|
+
* the cooked VM (the adapter's output)
|
|
112
|
+
*/
|
|
113
|
+
viewModel: import("./view-model.js").TranscriptViewModel;
|
|
114
|
+
/**
|
|
115
|
+
* REQUIRED — no default
|
|
116
|
+
*/
|
|
117
|
+
capabilities: ViewerCapabilities;
|
|
118
|
+
callbacks?: ViewerCallbacks;
|
|
119
|
+
/**
|
|
120
|
+
* optional; defaults to 'dark'
|
|
121
|
+
*/
|
|
122
|
+
theme?: Theme;
|
|
123
|
+
/**
|
|
124
|
+
* render-prop for the graph engine
|
|
125
|
+
*/
|
|
126
|
+
graphSlot?: (ctx: GraphSlotContext) => unknown;
|
|
127
|
+
activeTab?: TranscriptTab;
|
|
128
|
+
onTabChange?: (tab: TranscriptTab) => void;
|
|
129
|
+
viewMode?: ViewMode;
|
|
130
|
+
onViewModeChange?: (mode: ViewMode) => void;
|
|
131
|
+
leftRailOpen?: boolean;
|
|
132
|
+
onLeftRailOpenChange?: (open: boolean) => void;
|
|
133
|
+
rightRailOpen?: boolean;
|
|
134
|
+
onRightRailOpenChange?: (open: boolean) => void;
|
|
135
|
+
/**
|
|
136
|
+
* tool id → open?
|
|
137
|
+
*/
|
|
138
|
+
openTools?: Record<string, boolean>;
|
|
139
|
+
onOpenToolsChange?: (openTools: Record<string, boolean>) => void;
|
|
140
|
+
activeTurn?: number;
|
|
141
|
+
onActiveTurnChange?: (turnIndex: number) => void;
|
|
142
|
+
search?: string;
|
|
143
|
+
onSearchChange?: (query: string) => void;
|
|
144
|
+
filters?: TranscriptFilters;
|
|
145
|
+
onFiltersChange?: (filters: TranscriptFilters) => void;
|
|
146
|
+
/**
|
|
147
|
+
* turn index → saved label
|
|
148
|
+
*/
|
|
149
|
+
savedLabels?: Record<number, SavedLabel>;
|
|
150
|
+
onSavedLabelsChange?: (savedLabels: Record<number, SavedLabel>) => void;
|
|
151
|
+
/**
|
|
152
|
+
* share action-menu disclosure (default closed)
|
|
153
|
+
*/
|
|
154
|
+
shareOpen?: boolean;
|
|
155
|
+
onShareOpenChange?: (open: boolean) => void;
|
|
156
|
+
/**
|
|
157
|
+
* more action-menu disclosure (default closed)
|
|
158
|
+
*/
|
|
159
|
+
moreOpen?: boolean;
|
|
160
|
+
onMoreOpenChange?: (open: boolean) => void;
|
|
161
|
+
};
|