@peasant-labs/fairtrade 0.0.45 → 0.0.47

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.
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @param {object} props
3
+ * @param {TurnVM[]} [props.turns] the turns the reader can currently see, in turn order
4
+ * @param {number} [props.activeTurn] the active TURN INDEX (TurnVM.index)
5
+ * @param {(turnIndex: number) => void} [props.onJump]
6
+ * @param {string} [props.label] accessible name for the slider
7
+ */
8
+ export default function TranscriptMinimap({ turns, activeTurn, onJump, label, }: {
9
+ turns?: TurnVM[];
10
+ activeTurn?: number;
11
+ onJump?: (turnIndex: number) => void;
12
+ label?: string;
13
+ }): import("react").JSX.Element;
14
+ export type TurnVM = import("./view-model.js").TurnVM;
@@ -2,12 +2,17 @@
2
2
  * @param {object} props
3
3
  * @param {TranscriptViewModel} props.viewModel
4
4
  * @param {import('./state-capabilities.js').TranscriptTab} props.tab
5
+ * @param {Presentation} [props.presentation] chrome mode; defaults to 'classic'
6
+ * @param {number} [props.activeTurn] the active TURN INDEX, for the ledger cards
5
7
  * @param {(turnIndex: number) => void} [props.onJump]
6
8
  */
7
- export default function OutlineRail({ viewModel, tab, onJump }: {
9
+ export default function OutlineRail({ viewModel, tab, onJump, presentation, activeTurn }: {
8
10
  viewModel: TranscriptViewModel;
9
11
  tab: import("./state-capabilities.js").TranscriptTab;
12
+ presentation?: Presentation;
13
+ activeTurn?: number;
10
14
  onJump?: (turnIndex: number) => void;
11
15
  }): import("react").JSX.Element;
12
16
  export type TranscriptViewModel = import("./view-model.js").TranscriptViewModel;
13
17
  export type AnnotationVM = import("./view-model.js").AnnotationVM;
18
+ export type Presentation = import("./state-capabilities.js").Presentation;
@@ -0,0 +1,17 @@
1
+ /** @typedef {import('./view-model.js').TurnVM} TurnVM */
2
+ /**
3
+ * @param {object} props
4
+ * @param {TurnVM} [props.turn]
5
+ * @param {import('react').ReactNode} [props.actions] the turn's trailing controls (copy anchor + host actions)
6
+ * @param {boolean} [props.open] controlled disclosure state; omit to let the row own it
7
+ * @param {(open: boolean) => void} [props.onToggle] called with the next state whenever the disclosure changes
8
+ * @param {number} [props.revealRequest] explicit search navigation sequence; a new value opens the row
9
+ */
10
+ export default function TranscriptSystemRow({ turn, actions, open: openProp, onToggle, revealRequest }: {
11
+ turn?: TurnVM;
12
+ actions?: import("react").ReactNode;
13
+ open?: boolean;
14
+ onToggle?: (open: boolean) => void;
15
+ revealRequest?: number;
16
+ }): import("react").JSX.Element;
17
+ export type TurnVM = import("./view-model.js").TurnVM;
@@ -4,7 +4,7 @@
4
4
  * @param {boolean} [props.open]
5
5
  * @param {() => void} [props.onToggle]
6
6
  */
7
- export default function ToolCall({ tool, open, onToggle }: {
7
+ export default function ToolCall({ tool, open, onToggle, showChevron }: {
8
8
  tool?: ToolCallVM;
9
9
  open?: boolean;
10
10
  onToggle?: () => void;
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * @param {TranscriptViewerProps} props
3
3
  */
4
- export default function TranscriptViewer({ viewModel, capabilities, callbacks, theme: themeProp, onThemeChange, graphSlot, activeTab: activeTabProp, onTabChange, viewMode: viewModeProp, onViewModeChange, leftRailOpen: leftRailOpenProp, onLeftRailOpenChange, rightRailOpen: rightRailOpenProp, onRightRailOpenChange, openTools: openToolsProp, onOpenToolsChange, earlierHistoryOpen: earlierHistoryOpenProp, onEarlierHistoryOpenChange, initialPosition: initialPositionProp, activeTurn: activeTurnProp, onActiveTurnChange, search: searchProp, onSearchChange, filters: filtersProp, onFiltersChange, savedLabels: savedLabelsProp, onSavedLabelsChange, shareOpen: shareOpenProp, onShareOpenChange, moreOpen: moreOpenProp, onMoreOpenChange, breadcrumb, LinkComponent, renderTurnPanel, renderTurnActions, anchorHref, headerActions, streamPrelude, showTail, showOutcome, showSearchTrigger, pullRequests, headingLevel, }: TranscriptViewerProps): import("react").JSX.Element;
4
+ export default function TranscriptViewer({ viewModel, capabilities, callbacks, theme: themeProp, onThemeChange, graphSlot, activeTab: activeTabProp, onTabChange, viewMode: viewModeProp, onViewModeChange, sidebarLayout: sidebarLayoutProp, onSidebarLayoutChange, zen: zenProp, onZenChange, readerWidth: readerWidthProp, onReaderWidthChange, leftRailOpen: leftRailOpenProp, onLeftRailOpenChange, rightRailOpen: rightRailOpenProp, onRightRailOpenChange, openTools: openToolsProp, onOpenToolsChange, earlierHistoryOpen: earlierHistoryOpenProp, onEarlierHistoryOpenChange, initialPosition: initialPositionProp, activeTurn: activeTurnProp, onActiveTurnChange, search: searchProp, onSearchChange, filters: filtersProp, onFiltersChange, savedLabels: savedLabelsProp, onSavedLabelsChange, shareOpen: shareOpenProp, onShareOpenChange, moreOpen: moreOpenProp, onMoreOpenChange, breadcrumb, LinkComponent, renderTurnPanel, renderTurnActions, anchorHref, headerActions, streamPrelude, showTail, showOutcome, showSearchTrigger, footer, presentation, subtitle, pullRequests, headingLevel, }: TranscriptViewerProps): import("react").JSX.Element;
5
+ export const READER_SNAPS: readonly number[];
5
6
  export type TranscriptViewerProps = import("./state-capabilities.js").TranscriptViewerProps;
6
7
  export type TranscriptFilters = import("./state-capabilities.js").TranscriptFilters;
7
8
  export type TraceReadingSnapshot = {
@@ -15,8 +15,16 @@
15
15
  * @param {number} [props.revealRequest] explicit search navigation sequence
16
16
  * @param {number} [props.headingLevel=4] the turn heading's level: h4 under a viewer whose title is an h2, h3 under one
17
17
  * whose title is the page's h1
18
+ * @param {'classic' | 'ledger'} [props.presentation='classic'] chrome presentation. `ledger` leads with a
19
+ * square role well and the role word, groups the turn's tool calls into one work panel, and renders a
20
+ * system turn as a compact row; absent, the classic card renders exactly as before. In ledger the head
21
+ * carries only the role, the turn number, the time, and the copy anchor (plus the host's
22
+ * `renderActions`); the built-in collapse control, label affordance, model name, error chip, token
23
+ * badge, and saved-label chip are intentionally hidden there for now. The host's own per-turn
24
+ * `renderActions` and `renderTurnPanel` keep rendering on every role, so a host extension is never
25
+ * dropped by the presentation switch.
18
26
  */
19
- export default function TurnCard({ turn, active, openTools, toggleTool, onCopyAnchor, copied, registerRef, onLabel, renderActions, savedLabel, compact, expandAll, revealRequest, headingLevel, }: {
27
+ export default function TurnCard({ turn, active, openTools, toggleTool, onCopyAnchor, copied, registerRef, onLabel, renderActions, savedLabel, compact, expandAll, revealRequest, headingLevel, presentation, }: {
20
28
  turn?: TurnVM;
21
29
  active?: boolean;
22
30
  openTools?: Record<string, boolean>;
@@ -34,5 +42,6 @@ export default function TurnCard({ turn, active, openTools, toggleTool, onCopyAn
34
42
  expandAll?: boolean;
35
43
  revealRequest?: number;
36
44
  headingLevel?: number;
45
+ presentation?: "classic" | "ledger";
37
46
  }): import("react").JSX.Element;
38
47
  export type TurnVM = import("./view-model.js").TurnVM;
@@ -0,0 +1,15 @@
1
+ /** @typedef {import('./view-model.js').ToolCallVM} ToolCallVM */
2
+ /**
3
+ * @param {object} props
4
+ * @param {ToolCallVM[]} [props.tools] the turn's cooked tool calls
5
+ * @param {Record<string, boolean>} [props.openTools] tool id -> open?
6
+ * @param {(id: string) => void} [props.onToggle]
7
+ * @param {boolean} [props.expandAll]
8
+ */
9
+ export default function TranscriptWorkGroup({ tools, thinking, openTools, onToggle, expandAll, bare }: {
10
+ tools?: ToolCallVM[];
11
+ openTools?: Record<string, boolean>;
12
+ onToggle?: (id: string) => void;
13
+ expandAll?: boolean;
14
+ }): import("react").JSX.Element;
15
+ export type ToolCallVM = import("./view-model.js").ToolCallVM;
@@ -1,18 +1,21 @@
1
1
  export { TOOL_GROUPS } from "./view-model.js";
2
2
  export { nextNavTurn } from "./turnNav.js";
3
+ export { workSummary } from "./work-summary.js";
3
4
  export { default as TranscriptTurnCard } from "./TurnCard.jsx";
4
5
  export { default as TranscriptThinking } from "./Thinking.jsx";
5
6
  export { default as TranscriptMarkdown } from "./Markdown.jsx";
6
7
  export { default as TranscriptToolCall } from "./ToolCall.jsx";
8
+ export { default as TranscriptWorkGroup } from "./WorkGroup.jsx";
9
+ export { default as TranscriptSystemRow } from "./SystemRow.jsx";
7
10
  export { default as TranscriptToolBody } from "./ToolBody.jsx";
8
11
  export { default as TranscriptTaskBody } from "./TaskBody.jsx";
9
12
  export { default as TranscriptOutcomeChip } from "./OutcomeChip.jsx";
10
- export { default as TranscriptViewer } from "./TranscriptViewer.jsx";
11
13
  export { default as TranscriptOutlineRail } from "./OutlineRail.jsx";
12
14
  export { default as TranscriptFiltersRail } from "./FiltersRail.jsx";
13
15
  export { default as TranscriptFilterSection } from "./FilterSection.jsx";
14
16
  export { default as TranscriptCheckRow } from "./CheckRow.jsx";
15
17
  export { default as TranscriptViewSwitch } from "./ViewSwitch.jsx";
18
+ export { default as TranscriptMinimap } from "./Minimap.jsx";
16
19
  export { default as TranscriptScrubber } from "./Scrubber.jsx";
17
20
  export { default as TranscriptScorecard } from "./Scorecard.jsx";
18
21
  export { default as TranscriptLabelPopover } from "./LabelPopover.jsx";
@@ -44,8 +47,10 @@ export type ViewerCapabilities = import("./state-capabilities.js").ViewerCapabil
44
47
  export type ViewerCallbacks = import("./state-capabilities.js").ViewerCallbacks;
45
48
  export type GraphSlotContext = import("./state-capabilities.js").GraphSlotContext;
46
49
  export type TranscriptFilters = import("./state-capabilities.js").TranscriptFilters;
50
+ export type TranscriptSidebarLayout = import("./state-capabilities.js").TranscriptSidebarLayout;
47
51
  export type SavedLabel = import("./state-capabilities.js").SavedLabel;
48
52
  export type Theme = import("./state-capabilities.js").Theme;
53
+ export type Presentation = import("./state-capabilities.js").Presentation;
49
54
  export type TranscriptTab = import("./state-capabilities.js").TranscriptTab;
50
55
  export type ViewMode = import("./state-capabilities.js").ViewMode;
51
56
  export type TranscriptViewModel = import("./view-model.js").TranscriptViewModel;
@@ -77,4 +82,5 @@ export { computeTasks, computeTurnLabels, buildTaskWaterfall, annotateTranscript
77
82
  export { formatRelative, formatDurationMins, formatDurationMs, formatDurationSeconds, formatDateLong, isKnownTime } from "./time.js";
78
83
  export { summarizePrompt, composeSessionTitle, projectLabel, cleanSessionTitle, unwrapUserQuery } from "./title.js";
79
84
  export { default as TranscriptDiffEntryCard, DiffHunks as TranscriptDiffHunks } from "./DiffEntryCard.jsx";
85
+ export { default as TranscriptViewer, READER_SNAPS } from "./TranscriptViewer.jsx";
80
86
  export { advanceTranscriptInitialPositionConsumption, normalizeTranscriptInitialPosition, resolveTranscriptInitialPosition, shouldApplyTranscriptInitialPosition, transcriptInitialPositionReadiness, transcriptInitialPositionToken } from "./initial-position.js";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The readable text of a Markdown source string, collapsed to one line.
3
+ *
4
+ * @param {unknown} content the recorded or display Markdown
5
+ * @returns {string}
6
+ */
7
+ export function plainTextPreview(content: unknown): string;
@@ -11,6 +11,12 @@ export type ViewMode = "list" | "graph";
11
11
  * The optional theme; defaults to `dark` when unset.
12
12
  */
13
13
  export type Theme = "dark" | "light";
14
+ /**
15
+ * How the composite presents: `classic` (the default bordered-turn reading surface) or
16
+ * `ledger` (the opt-in reading-first surface: role-led turns with one grouped work panel,
17
+ * system turns as single rows, and the ledger chrome).
18
+ */
19
+ export type Presentation = "classic" | "ledger";
14
20
  /**
15
21
  * A per-turn saved label (the LabelPopover's output). `outcome` is the verdict
16
22
  * band; `flag` is an optional friction tag. Keyed by turn index in `savedLabels`.
@@ -19,6 +25,29 @@ export type SavedLabel = {
19
25
  outcome: "good" | "neutral" | "bad";
20
26
  flag?: string;
21
27
  };
28
+ /**
29
+ * The expanded/collapsed configuration of the viewer's surroundings: the left user-turns
30
+ * outline, the right filters rail, and the host-owned sidebar (which the viewer never
31
+ * renders, but which the host hides and restores from this same object). The host may
32
+ * persist it; the viewer reports every explicit change through `onSidebarLayoutChange`.
33
+ * Reading width never changes it. Zen collapses it and restores the exact snapshot.
34
+ * `host` defaults to `true` when neither the prop nor an explicit action supplies it; the
35
+ * viewer never renders that sidebar, so the value only relays the host's own state.
36
+ */
37
+ export type TranscriptSidebarLayout = {
38
+ /**
39
+ * the left user-turns rail
40
+ */
41
+ outline: boolean;
42
+ /**
43
+ * the right filters rail
44
+ */
45
+ filters: boolean;
46
+ /**
47
+ * the host-owned sidebar
48
+ */
49
+ host: boolean;
50
+ };
22
51
  /**
23
52
  * The cooked filter state the FiltersRail drives. Categories gate turn KINDS;
24
53
  * `toolGroups` gate tool-call groups (keyed by the cooked `ToolGroup` ids);
@@ -148,8 +177,32 @@ export type TranscriptViewerProps = {
148
177
  onTabChange?: (tab: TranscriptTab) => void;
149
178
  viewMode?: ViewMode;
150
179
  onViewModeChange?: (mode: ViewMode) => void;
180
+ /**
181
+ * the single rail + host-sidebar view model; supplied, it is the source of truth for `outline`, `filters` and `host`
182
+ */
183
+ sidebarLayout?: TranscriptSidebarLayout;
184
+ /**
185
+ * fires the FULL layout object on every explicit rail action and on zen entry and exit
186
+ */
187
+ onSidebarLayoutChange?: (layout: TranscriptSidebarLayout) => void;
188
+ /**
189
+ * ledger only: reading mode collapses both viewer rails to nothing (their strips leave too) and `host` reports false; ignored in classic; defaults false
190
+ */
191
+ zen?: boolean;
192
+ onZenChange?: (zen: boolean) => void;
193
+ /**
194
+ * ledger only: the reader column width in CSS pixels. A supplied value is normalised at the boundary (clamped to 600..936 and snapped to the nearest of the exported `READER_SNAPS`), so the column and `aria-valuenow` always report a supported width; defaults 840
195
+ */
196
+ readerWidth?: number;
197
+ onReaderWidthChange?: (width: number) => void;
198
+ /**
199
+ * alias for `sidebarLayout.outline`; when supplied it wins for that rail and still calls `onLeftRailOpenChange`
200
+ */
151
201
  leftRailOpen?: boolean;
152
202
  onLeftRailOpenChange?: (open: boolean) => void;
203
+ /**
204
+ * alias for `sidebarLayout.filters`; when supplied it wins for that rail and still calls `onRightRailOpenChange`
205
+ */
153
206
  rightRailOpen?: boolean;
154
207
  onRightRailOpenChange?: (open: boolean) => void;
155
208
  /**
@@ -227,13 +280,28 @@ export type TranscriptViewerProps = {
227
280
  */
228
281
  showOutcome?: boolean;
229
282
  /**
230
- * default false: render a `search this transcript` button at the end of the tab strip that opens search exactly as ⌘F does; independent of `showTail`
283
+ * default false: render a `search transcript` button at the end of the session views in the bottom bar that opens search exactly as ⌘F does; independent of `showTail`
231
284
  */
232
285
  showSearchTrigger?: boolean;
286
+ /**
287
+ * default omitted: both stay off. `hints` renders the shortcut line, `progress` the visible-turn position counter, in the bottom bar beside the session views. A host opts in per part, so a reading surface can stay quiet without losing the views. The shortcut hint is keyboard-only, so it leaves a coarse pointer below the phone breakpoint; the counter exists only on the trace view in list mode with a visible turn. The session views themselves live in the bottom bar, after the panel in DOM order, which is why the viewer opens with a `skip to session views` control
288
+ */
289
+ footer?: {
290
+ hints?: boolean;
291
+ progress?: boolean;
292
+ };
233
293
  /**
234
294
  * default 2: the transcript's title is an h2 in a host page; 1 when the host mounts the viewer as the whole page, so the title is the page's h1 and the phase and turn headings move up one level
235
295
  */
236
296
  headingLevel?: 1 | 2;
297
+ /**
298
+ * chrome presentation; defaults to 'classic'. `ledger` adds a subtitle slot, swaps the pinned header's provider/model + scrubber for the title + visible-turns minimap (the turns currently in view), and renders user-turn task cards in the left rail; it also rebuilds every turn as a role-led line (square role well, the role word, the turn number, the time, and the copy anchor) with prose first and one grouped work panel over the turn's tool calls, collapses a system turn to a single compact row. In that head the built-in collapse control, label affordance, model name, error chip, token badge, and saved-label chip are intentionally hidden for now, while a host's own `renderTurnActions` and `renderTurnPanel` keep rendering on every role. Omitting it renders the classic surface unchanged, and an unrecognized runtime value fails closed to classic
299
+ */
300
+ presentation?: Presentation;
301
+ /**
302
+ * optional deck under the session title; rendered in either presentation when supplied
303
+ */
304
+ subtitle?: import("react").ReactNode;
237
305
  /**
238
306
  * host-owned node rendered under the meta row (a pull request list and its own "show all" control); omitted renders nothing
239
307
  */
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Summarize one turn's tool calls.
3
+ * @param {ToolCallVM[]} [tools]
4
+ * @returns {WorkSummary}
5
+ */
6
+ export function workSummary(tools?: ToolCallVM[]): WorkSummary;
7
+ /**
8
+ * The panel's leading count: "4 commands, 3 files, 1 edit"; zero parts are omitted and a turn
9
+ * with no commands, files or edits falls back to "N calls".
10
+ * @param {Partial<WorkSummary>} [summary]
11
+ * @returns {string}
12
+ */
13
+ export function workCountLabel(summary?: Partial<WorkSummary>): string;
14
+ /**
15
+ * The panel's trailing meta: "8 calls, 1 failed, 29s". The failure count is omitted when zero and
16
+ * the duration is omitted when nothing was recorded. The leading call count is omitted when the
17
+ * count label already fell back to it (no commands, files or edits).
18
+ * @param {Partial<WorkSummary>} [summary]
19
+ * @returns {string}
20
+ */
21
+ export function workMetaLabel(summary?: Partial<WorkSummary>): string;
22
+ export type ToolCallVM = import("./view-model.js").ToolCallVM;
23
+ /**
24
+ * The counts one turn's work panel shows.
25
+ */
26
+ export type WorkSummary = {
27
+ /**
28
+ * every tool the turn ran
29
+ */
30
+ calls: number;
31
+ /**
32
+ * `bash` group calls
33
+ */
34
+ commands: number;
35
+ /**
36
+ * distinct non-empty file paths the turn touched
37
+ */
38
+ files: number;
39
+ /**
40
+ * `edits` group calls
41
+ */
42
+ edits: number;
43
+ /**
44
+ * errored tools plus non-zero exit codes
45
+ */
46
+ failed: number;
47
+ /**
48
+ * sum of the finite recorded durations
49
+ */
50
+ durationMs: number;
51
+ };