@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,325 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sender role of a turn. schema/develop/types.go:425-430.
|
|
3
|
+
* @typedef {'user' | 'assistant' | 'tool' | 'system'} Role
|
|
4
|
+
*/
|
|
5
|
+
/** Canonical Role values, in schema order. @type {readonly Role[]} */
|
|
6
|
+
export const ROLES: readonly Role[];
|
|
7
|
+
/**
|
|
8
|
+
* Classification of a single transcript entry. schema/develop/types.go:464-472.
|
|
9
|
+
* `thinking` (468) is a first-class entry type: a standalone thinking entry is
|
|
10
|
+
* its own `entryType=thinking` turn, rendered from `turn.content`.
|
|
11
|
+
* @typedef {'text' | 'tool_use' | 'tool_result' | 'thinking' | 'system' | 'error' | 'result'} EntryType
|
|
12
|
+
*/
|
|
13
|
+
/** Canonical EntryType values, in schema order. @type {readonly EntryType[]} */
|
|
14
|
+
export const ENTRY_TYPES: readonly EntryType[];
|
|
15
|
+
/**
|
|
16
|
+
* Tool-call classification, ACP-aligned. schema/develop/types.go:336-346.
|
|
17
|
+
* The mockup's demo tool kinds map onto these canonical kinds: bash→execute,
|
|
18
|
+
* grep→search, task→other (subagent), webfetch→fetch.
|
|
19
|
+
* @typedef {'read' | 'edit' | 'delete' | 'move' | 'search' | 'execute' | 'think' | 'fetch' | 'other'} ToolCallKind
|
|
20
|
+
*/
|
|
21
|
+
/** Canonical ToolCallKind values, in schema order. @type {readonly ToolCallKind[]} */
|
|
22
|
+
export const TOOL_CALL_KINDS: readonly ToolCallKind[];
|
|
23
|
+
/**
|
|
24
|
+
* Why a turn (or session) ended. schema/develop/types.go:383-389.
|
|
25
|
+
* @typedef {'end_turn' | 'cancelled' | 'max_tokens' | 'max_turn_requests' | 'refusal'} StopReason
|
|
26
|
+
*/
|
|
27
|
+
/** Canonical StopReason values, in schema order. @type {readonly StopReason[]} */
|
|
28
|
+
export const STOP_REASONS: readonly StopReason[];
|
|
29
|
+
/**
|
|
30
|
+
* Heuristic resolution status of a session. schema/develop/types.go:193-195.
|
|
31
|
+
* @typedef {'resolved' | 'partial' | 'failed'} SessionOutcome
|
|
32
|
+
*/
|
|
33
|
+
/** Canonical SessionOutcome values, in schema order. @type {readonly SessionOutcome[]} */
|
|
34
|
+
export const SESSION_OUTCOMES: readonly SessionOutcome[];
|
|
35
|
+
/**
|
|
36
|
+
* The coding tool / AI-assisted environment that produced the session.
|
|
37
|
+
* bestiary.Harness (the ingestion-supported set peasant emits). The string
|
|
38
|
+
* union is the wire contract; bestiary may know a superset, so consumers MUST
|
|
39
|
+
* tolerate an unknown harness string (degrade, never throw).
|
|
40
|
+
* @typedef {'claude-code' | 'gemini-cli' | 'codex' | 'opencode' | 'cursor' | 'antigravity' | (string & {})} Harness
|
|
41
|
+
*/
|
|
42
|
+
/** Canonical Harness values peasant ingests, in display order. @type {readonly Harness[]} */
|
|
43
|
+
export const HARNESSES: readonly Harness[];
|
|
44
|
+
/**
|
|
45
|
+
* Sender role of a turn. schema/develop/types.go:425-430.
|
|
46
|
+
*/
|
|
47
|
+
export type Role = "user" | "assistant" | "tool" | "system";
|
|
48
|
+
/**
|
|
49
|
+
* Classification of a single transcript entry. schema/develop/types.go:464-472.
|
|
50
|
+
* `thinking` (468) is a first-class entry type: a standalone thinking entry is
|
|
51
|
+
* its own `entryType=thinking` turn, rendered from `turn.content`.
|
|
52
|
+
*/
|
|
53
|
+
export type EntryType = "text" | "tool_use" | "tool_result" | "thinking" | "system" | "error" | "result";
|
|
54
|
+
/**
|
|
55
|
+
* Tool-call classification, ACP-aligned. schema/develop/types.go:336-346.
|
|
56
|
+
* The mockup's demo tool kinds map onto these canonical kinds: bash→execute,
|
|
57
|
+
* grep→search, task→other (subagent), webfetch→fetch.
|
|
58
|
+
*/
|
|
59
|
+
export type ToolCallKind = "read" | "edit" | "delete" | "move" | "search" | "execute" | "think" | "fetch" | "other";
|
|
60
|
+
/**
|
|
61
|
+
* Why a turn (or session) ended. schema/develop/types.go:383-389.
|
|
62
|
+
*/
|
|
63
|
+
export type StopReason = "end_turn" | "cancelled" | "max_tokens" | "max_turn_requests" | "refusal";
|
|
64
|
+
/**
|
|
65
|
+
* Heuristic resolution status of a session. schema/develop/types.go:193-195.
|
|
66
|
+
*/
|
|
67
|
+
export type SessionOutcome = "resolved" | "partial" | "failed";
|
|
68
|
+
/**
|
|
69
|
+
* The coding tool / AI-assisted environment that produced the session.
|
|
70
|
+
* bestiary.Harness (the ingestion-supported set peasant emits). The string
|
|
71
|
+
* union is the wire contract; bestiary may know a superset, so consumers MUST
|
|
72
|
+
* tolerate an unknown harness string (degrade, never throw).
|
|
73
|
+
*/
|
|
74
|
+
export type Harness = "claude-code" | "gemini-cli" | "codex" | "opencode" | "cursor" | "antigravity" | (string & {});
|
|
75
|
+
/**
|
|
76
|
+
* A single tool call inside a turn. schema/develop/local_api.go:69-79.
|
|
77
|
+
*
|
|
78
|
+
* `arguments` and `result` are JSON-ENCODED STRINGS on the wire. The adapter is
|
|
79
|
+
* the SOLE site that `JSON.parse`s them; components receive the parsed,
|
|
80
|
+
* preview-cooked `ToolCallVM` (see view-model.js), never these raw strings.
|
|
81
|
+
*/
|
|
82
|
+
export type ToolCallDetail = {
|
|
83
|
+
id: string;
|
|
84
|
+
name: string;
|
|
85
|
+
/**
|
|
86
|
+
* JSON-encoded string (parse in the adapter only)
|
|
87
|
+
*/
|
|
88
|
+
arguments: string;
|
|
89
|
+
/**
|
|
90
|
+
* JSON-encoded string (parse in the adapter only)
|
|
91
|
+
*/
|
|
92
|
+
result: string;
|
|
93
|
+
/**
|
|
94
|
+
* ms; absent when not measured
|
|
95
|
+
*/
|
|
96
|
+
durationMs?: number;
|
|
97
|
+
/**
|
|
98
|
+
* process exit code, when applicable
|
|
99
|
+
*/
|
|
100
|
+
exitCode?: number;
|
|
101
|
+
/**
|
|
102
|
+
* target path for file-oriented tools
|
|
103
|
+
*/
|
|
104
|
+
filePath?: string;
|
|
105
|
+
/**
|
|
106
|
+
* true when the call failed
|
|
107
|
+
*/
|
|
108
|
+
isError?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* ACP-aligned classification; may be omitted
|
|
111
|
+
*/
|
|
112
|
+
toolKind?: ToolCallKind;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* One turn with full content, as folded server-side. schema/develop/local_api.go:50-66.
|
|
116
|
+
*
|
|
117
|
+
* `content` already contains any folded thinking text (the server only
|
|
118
|
+
* suppresses a redundant depth=1 thinking/text sibling whose parent already
|
|
119
|
+
* carries the text). Components render thinking from `turn.content`.
|
|
120
|
+
*
|
|
121
|
+
* `parentIndex` is present on the Go wire but OMITTED by the drifted TS shape;
|
|
122
|
+
* consumers MUST NOT depend on it (the graph keys nesting off `depth`). Typed
|
|
123
|
+
* here as optional-and-nullable for fidelity only.
|
|
124
|
+
*/
|
|
125
|
+
export type TurnDetail = {
|
|
126
|
+
index: number;
|
|
127
|
+
role: Role;
|
|
128
|
+
/**
|
|
129
|
+
* folded text (incl. thinking) for this turn
|
|
130
|
+
*/
|
|
131
|
+
content: string;
|
|
132
|
+
/**
|
|
133
|
+
* omitempty on the wire
|
|
134
|
+
*/
|
|
135
|
+
toolCalls?: ToolCallDetail[];
|
|
136
|
+
/**
|
|
137
|
+
* RFC3339 (Go time.Time marshals to a string)
|
|
138
|
+
*/
|
|
139
|
+
timestamp: string;
|
|
140
|
+
/**
|
|
141
|
+
* subagent nesting depth (0 = top level)
|
|
142
|
+
*/
|
|
143
|
+
depth: number;
|
|
144
|
+
/**
|
|
145
|
+
* DO NOT rely on this — use `depth`. May be absent or null.
|
|
146
|
+
*/
|
|
147
|
+
parentIndex?: number | null;
|
|
148
|
+
agentName?: string;
|
|
149
|
+
/**
|
|
150
|
+
* enrichment, propagated from session_entries
|
|
151
|
+
*/
|
|
152
|
+
entryType?: EntryType;
|
|
153
|
+
hasThinking?: boolean;
|
|
154
|
+
stopReason?: StopReason | null;
|
|
155
|
+
tokensIn?: number | null;
|
|
156
|
+
tokensOut?: number | null;
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Lightweight reference to a child (subagent) session. schema/develop/local_api.go:153-157.
|
|
160
|
+
*/
|
|
161
|
+
export type ChildSessionRef = {
|
|
162
|
+
id: string;
|
|
163
|
+
/**
|
|
164
|
+
* RFC3339
|
|
165
|
+
*/
|
|
166
|
+
startTime: string;
|
|
167
|
+
project?: string;
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* Deterministic per-session quality signals for the "How this session went"
|
|
171
|
+
* self-assessment card. schema/develop/local_api.go:131-150. All numeric fields
|
|
172
|
+
* are nullable so a consumer can distinguish "not computed" (absent/null) from a
|
|
173
|
+
* real zero before applying threshold bands.
|
|
174
|
+
*/
|
|
175
|
+
export type SessionScorecard = {
|
|
176
|
+
m2TokenOutcomeRatio?: number | null;
|
|
177
|
+
m5ContextUtilizationPct?: number | null;
|
|
178
|
+
m6OutputSurvivalPct?: number | null;
|
|
179
|
+
retryTokensWasted?: number | null;
|
|
180
|
+
totalTokens?: number | null;
|
|
181
|
+
costTotalUsd?: number | null;
|
|
182
|
+
specQualityScore?: number | null;
|
|
183
|
+
signalDensity?: number | null;
|
|
184
|
+
m7SpecHasExamples?: boolean | null;
|
|
185
|
+
m7SpecHasConstraints?: boolean | null;
|
|
186
|
+
m4ConsecutiveErrorMax?: number | null;
|
|
187
|
+
withinSessionReverts?: number | null;
|
|
188
|
+
/**
|
|
189
|
+
* echoes the session outcome for band triggers
|
|
190
|
+
*/
|
|
191
|
+
outcome?: SessionOutcome;
|
|
192
|
+
};
|
|
193
|
+
/**
|
|
194
|
+
* A single git commit linked to a session. schema/develop/metadata.go:89-96.
|
|
195
|
+
* Lives on GitContext.Commits in metadata.json (v4+); absent from the
|
|
196
|
+
* session_detail payload. Reaches components only after the adapter cooks it
|
|
197
|
+
* into `vm.session.git.commits`.
|
|
198
|
+
*/
|
|
199
|
+
export type CommitInfo = {
|
|
200
|
+
/**
|
|
201
|
+
* commit SHA-1 (full or abbreviated)
|
|
202
|
+
*/
|
|
203
|
+
hash: string;
|
|
204
|
+
/**
|
|
205
|
+
* first line of the commit message
|
|
206
|
+
*/
|
|
207
|
+
message: string;
|
|
208
|
+
authorName: string;
|
|
209
|
+
authorEmail: string;
|
|
210
|
+
/**
|
|
211
|
+
* committer date, Unix millis
|
|
212
|
+
*/
|
|
213
|
+
commitTime: number;
|
|
214
|
+
/**
|
|
215
|
+
* author date, Unix millis
|
|
216
|
+
*/
|
|
217
|
+
authorTime: number;
|
|
218
|
+
};
|
|
219
|
+
/**
|
|
220
|
+
* Git repository state captured for a session. schema/develop/metadata.go:99-105.
|
|
221
|
+
* This is the NESTED shape the drifted TS `@peasant-labs/types` exposes and the
|
|
222
|
+
* shape the mockup fixtures / TB's sample-session hand-populate. It is NOT on
|
|
223
|
+
* the real Go session_detail wire (which carries only flat gitBranch/gitRemote).
|
|
224
|
+
* The adapter tolerates this shape too (see `TranscriptWireInput`).
|
|
225
|
+
*/
|
|
226
|
+
export type GitContext = {
|
|
227
|
+
branch?: string | null;
|
|
228
|
+
remote?: string | null;
|
|
229
|
+
worktree?: string | null;
|
|
230
|
+
tracking?: string | null;
|
|
231
|
+
/**
|
|
232
|
+
* produced during this session (v4+)
|
|
233
|
+
*/
|
|
234
|
+
commits?: CommitInfo[];
|
|
235
|
+
};
|
|
236
|
+
/**
|
|
237
|
+
* Wire format for an annotation. schema/develop/annotation.go:46-66. Fetched
|
|
238
|
+
* separately from the payload (WS `annotations` / GET /api/v1/annotations?
|
|
239
|
+
* session_id=) and passed to the adapter alongside the payload.
|
|
240
|
+
* `targetEntryEndIndex` is half-open: the range is [targetEntryIndex, end).
|
|
241
|
+
*/
|
|
242
|
+
export type AnnotationSummary = {
|
|
243
|
+
id: string;
|
|
244
|
+
targetKind: string;
|
|
245
|
+
targetSessionId?: string;
|
|
246
|
+
targetEntryIndex?: number;
|
|
247
|
+
/**
|
|
248
|
+
* half-open [start, end)
|
|
249
|
+
*/
|
|
250
|
+
targetEntryEndIndex?: number;
|
|
251
|
+
targetAnnotationId?: string;
|
|
252
|
+
targetProjectHash?: string;
|
|
253
|
+
isPrimary: boolean;
|
|
254
|
+
annotatorKind: string;
|
|
255
|
+
annotatorName: string;
|
|
256
|
+
typeId: string;
|
|
257
|
+
typeName: string;
|
|
258
|
+
value: string;
|
|
259
|
+
confidence?: number;
|
|
260
|
+
reason?: string;
|
|
261
|
+
provenance?: object;
|
|
262
|
+
contentHash?: string;
|
|
263
|
+
/**
|
|
264
|
+
* Unix millis
|
|
265
|
+
*/
|
|
266
|
+
createdAt: number;
|
|
267
|
+
supersededBy?: string;
|
|
268
|
+
};
|
|
269
|
+
/**
|
|
270
|
+
* The full single-session detail payload. schema/develop/local_api.go:92-123.
|
|
271
|
+
* This is the actual local WebSocket `session_detail` wire body. Note: it
|
|
272
|
+
* carries FLAT `gitBranch` / `gitRemote` (strings) and NO `gitContext` / commits
|
|
273
|
+
* (local_api.go:111-112). Turns are already folded server-side.
|
|
274
|
+
*/
|
|
275
|
+
export type SessionDetailPayload = {
|
|
276
|
+
/**
|
|
277
|
+
* embedded push-contract version (advisory; omitempty)
|
|
278
|
+
*/
|
|
279
|
+
schemaVersion?: string;
|
|
280
|
+
id: string;
|
|
281
|
+
harness: Harness;
|
|
282
|
+
/**
|
|
283
|
+
* RFC3339
|
|
284
|
+
*/
|
|
285
|
+
startTime: string;
|
|
286
|
+
/**
|
|
287
|
+
* RFC3339
|
|
288
|
+
*/
|
|
289
|
+
endTime: string;
|
|
290
|
+
durationMins: number;
|
|
291
|
+
totalTokens: number;
|
|
292
|
+
tokensIn: number;
|
|
293
|
+
tokensOut: number;
|
|
294
|
+
turnCount: number;
|
|
295
|
+
toolCallCount: number;
|
|
296
|
+
turns: TurnDetail[];
|
|
297
|
+
source?: string;
|
|
298
|
+
status?: string;
|
|
299
|
+
project?: string;
|
|
300
|
+
model?: string;
|
|
301
|
+
workingDirectory?: string;
|
|
302
|
+
/**
|
|
303
|
+
* FLAT string on the Go wire (NOT gitContext)
|
|
304
|
+
*/
|
|
305
|
+
gitBranch?: string;
|
|
306
|
+
/**
|
|
307
|
+
* FLAT string on the Go wire (NOT gitContext)
|
|
308
|
+
*/
|
|
309
|
+
gitRemote?: string;
|
|
310
|
+
childSessions?: ChildSessionRef[];
|
|
311
|
+
outcome?: SessionOutcome;
|
|
312
|
+
scorecard?: SessionScorecard | null;
|
|
313
|
+
};
|
|
314
|
+
/**
|
|
315
|
+
* The transcript adapter's input type. It is the canonical `SessionDetailPayload`
|
|
316
|
+
* WIDENED with the nested `gitContext?` so the one adapter compiles against BOTH
|
|
317
|
+
* runtime shapes — the Go wire (flat gitBranch/gitRemote) AND the drifted TS
|
|
318
|
+
* `@peasant-labs/types` shape (gitContext? only) — and normalizes whichever is
|
|
319
|
+
* present into the cooked, optional `vm.session.git`. This widening is the ONLY
|
|
320
|
+
* place both git shapes coexist; it MUST NOT leak past the adapter into any
|
|
321
|
+
* component prop contract.
|
|
322
|
+
*/
|
|
323
|
+
export type TranscriptWireInput = SessionDetailPayload & {
|
|
324
|
+
gitContext?: GitContext;
|
|
325
|
+
};
|