@peasant-labs/fairtrade 0.0.6 → 0.0.7

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.
Files changed (36) hide show
  1. package/LICENSE +202 -21
  2. package/dist/lib/InUseShell-VRWaysXY.js +2488 -0
  3. package/dist/lib/commons.js +801 -836
  4. package/dist/lib/components.css +1 -1
  5. package/dist/lib/graph.css +1 -1
  6. package/dist/lib/graph.js +684 -285
  7. package/dist/lib/types/CommitGraph.d.ts +12 -3
  8. package/dist/lib/types/MapCanvas.d.ts +45 -2
  9. package/dist/lib/types/ProviderIcon.d.ts +23 -20
  10. package/dist/lib/types/commons/providers.d.ts +7 -8
  11. package/dist/lib/types/commons/types.d.ts +3 -6
  12. package/dist/lib/types/graph/Changes.d.ts +8 -4
  13. package/dist/lib/types/graph/CodeMap.d.ts +17 -1
  14. package/dist/lib/types/graph/CodeMapComposition.d.ts +25 -1
  15. package/dist/lib/types/graph/CodeMapNavigator.d.ts +35 -0
  16. package/dist/lib/types/graph/changeGraph.d.ts +12 -0
  17. package/dist/lib/types/graph/codeMapState.d.ts +136 -0
  18. package/dist/lib/types/graph/index.d.ts +15 -1
  19. package/dist/lib/types/graph/timelineNavigation.d.ts +33 -0
  20. package/dist/lib/types/graph/types.d.ts +67 -440
  21. package/dist/lib/types/index.d.ts +2 -0
  22. package/dist/lib/types/provider-policy.d.ts +27 -0
  23. package/dist/lib/types/transcript/TranscriptViewer.d.ts +1 -1
  24. package/dist/lib/types/transcript/adapter.d.ts +5 -40
  25. package/dist/lib/types/transcript/graph/GraphLegend.d.ts +3 -3
  26. package/dist/lib/types/transcript/graph/GraphTurnNode.d.ts +2 -2
  27. package/dist/lib/types/transcript/index.d.ts +3 -1
  28. package/dist/lib/types/transcript/initial-position.d.ts +80 -0
  29. package/dist/lib/types/transcript/state-capabilities.d.ts +22 -1
  30. package/dist/lib/types/transcript/useTranscriptInitialPosition.d.ts +26 -0
  31. package/dist/lib/types/transcript/view-model.d.ts +16 -16
  32. package/dist/lib/types/transcript/wire-types.d.ts +46 -308
  33. package/dist/lib/{ui-TG4XLhWL.js → ui-CKqVB4x2.js} +3395 -3401
  34. package/dist/lib/ui.js +4 -4
  35. package/package.json +51 -26
  36. package/dist/lib/InUseShell-CjtqHauP.js +0 -1532
@@ -1,325 +1,63 @@
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[]} */
1
+ /** @typedef {import('@peasant-labs/schema').Role} Role */
2
+ /** @typedef {import('@peasant-labs/schema').EntryType} EntryType */
3
+ /** @typedef {import('@peasant-labs/schema').ToolCallKind} ToolCallKind */
4
+ /** @typedef {import('@peasant-labs/schema').StopReason} StopReason */
5
+ /** @typedef {import('@peasant-labs/schema').SessionOutcome} SessionOutcome */
6
+ /** @typedef {import('@peasant-labs/schema').Harness} Harness */
7
+ /** @typedef {import('@peasant-labs/schema').ToolCallDetail} ToolCallDetail */
8
+ /** @typedef {import('@peasant-labs/schema').TurnDetail} TurnDetail */
9
+ /** @typedef {import('@peasant-labs/schema').ChildSessionRef} ChildSessionRef */
10
+ /** @typedef {import('@peasant-labs/schema').SessionScorecard} SessionScorecard */
11
+ /** @typedef {import('@peasant-labs/schema').CommitInfo} CommitInfo */
12
+ /** @typedef {import('@peasant-labs/schema').AnnotationSummary} AnnotationSummary */
13
+ /** @typedef {import('@peasant-labs/schema').SessionDetailPayload} SessionDetailPayload */
14
+ /** Canonical schema values exposed for compatibility with existing consumers. @type {readonly Role[]} */
6
15
  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[]} */
16
+ /** @type {readonly EntryType[]} */
14
17
  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[]} */
18
+ /** @type {readonly ToolCallKind[]} */
22
19
  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[]} */
20
+ /** @type {readonly StopReason[]} */
28
21
  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[]} */
22
+ /** @type {readonly SessionOutcome[]} */
34
23
  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[]} */
24
+ /** @type {readonly Harness[]} */
43
25
  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
- */
26
+ export type Role = import("@peasant-labs/schema").Role;
27
+ export type EntryType = import("@peasant-labs/schema").EntryType;
28
+ export type ToolCallKind = import("@peasant-labs/schema").ToolCallKind;
29
+ export type StopReason = import("@peasant-labs/schema").StopReason;
30
+ export type SessionOutcome = import("@peasant-labs/schema").SessionOutcome;
31
+ export type Harness = import("@peasant-labs/schema").Harness;
32
+ export type ToolCallDetail = import("@peasant-labs/schema").ToolCallDetail;
33
+ export type TurnDetail = import("@peasant-labs/schema").TurnDetail;
34
+ export type ChildSessionRef = import("@peasant-labs/schema").ChildSessionRef;
35
+ export type SessionScorecard = import("@peasant-labs/schema").SessionScorecard;
36
+ export type CommitInfo = import("@peasant-labs/schema").CommitInfo;
37
+ export type AnnotationSummary = import("@peasant-labs/schema").AnnotationSummary;
38
+ export type SessionDetailPayload = import("@peasant-labs/schema").SessionDetailPayload;
39
+ export type LegacyCommit = {
203
40
  hash: string;
204
- /**
205
- * first line of the commit message
206
- */
207
41
  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;
42
+ timestamp: string;
43
+ filesChanged: number;
44
+ insertions: number;
45
+ deletions: number;
46
+ session?: boolean;
218
47
  };
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 = {
48
+ export type LegacyGitContext = {
227
49
  branch?: string | null;
228
50
  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;
51
+ user?: string;
52
+ email?: string;
301
53
  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;
54
+ startCommit?: string;
55
+ commits?: (CommitInfo | LegacyCommit)[];
313
56
  };
314
57
  /**
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.
58
+ * The one compatibility seam. Canonical flat fields always win when both
59
+ * shapes are present; the adapter normalizes legacy workingDirectory here too.
322
60
  */
323
61
  export type TranscriptWireInput = SessionDetailPayload & {
324
- gitContext?: GitContext;
62
+ gitContext?: LegacyGitContext;
325
63
  };