@peasant-labs/fairtrade 0.0.38 → 0.0.39

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/graph.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as e, A as t, B as n, C as r, D as i, Dt as a, E as o, F as s, G as c, H as l, I as u, J as d, K as f, L as p, M as m, N as h, O as g, P as _, Q as v, R as y, S as b, T as x, Tt as S, U as C, V as w, W as T, X as E, Y as D, Z as O, _ as k, _t as A, a as j, at as M, b as N, c as P, ct as F, et as I, f as ee, g as te, i as L, it as ne, j as re, k as ie, l as ae, lt as oe, m as se, mt as ce, n as le, nt as ue, o as de, ot as fe, q as pe, r as me, rt as he, s as ge, st as _e, t as ve, tt as ye, v as be, w as xe, x as Se, y as Ce, yt as we, z as Te } from "./GraphLegend-7PmEpBZQ.js";
1
+ import { $ as e, A as t, B as n, C as r, D as i, Dt as a, E as o, F as s, G as c, H as l, I as u, J as d, K as f, L as p, M as m, N as h, O as g, P as _, Q as v, R as y, S as b, T as x, Tt as S, U as C, V as w, W as T, X as E, Y as D, Z as O, _ as k, _t as A, a as j, at as M, b as N, c as P, ct as F, et as I, f as ee, g as te, i as L, it as ne, j as re, k as ie, l as ae, lt as oe, m as se, mt as ce, n as le, nt as ue, o as de, ot as fe, q as pe, r as me, rt as he, s as ge, st as _e, t as ve, tt as ye, v as be, w as xe, x as Se, y as Ce, yt as we, z as Te } from "./GraphLegend-DwLFq2JU.js";
2
2
  import { memo as Ee, useCallback as R, useEffect as z, useMemo as B, useRef as V, useState as H } from "react";
3
3
  import { Fragment as De, jsx as U, jsxs as W } from "react/jsx-runtime";
4
4
  import { Box as Oe, Check as ke, ChevronDown as Ae, ChevronRight as G, Coins as je, CornerDownRight as Me, FileCode as Ne, FileDiff as Pe, FileText as Fe, Folder as Ie, GitMerge as Le, Hash as Re, Map as ze, Maximize2 as Be, MessageSquare as Ve, Minus as He, Plus as Ue, RotateCcw as We, RotateCw as Ge, Search as Ke, Share2 as qe, Star as Je, Tag as Ye, TriangleAlert as Xe, X as Ze } from "lucide-react";
@@ -28,6 +28,7 @@
28
28
  --ghost-node-size: 9px;
29
29
  --control-h: 36px;
30
30
  --control-h-sm: 28px;
31
+ --chip-h: 28px;
31
32
  --nav-h: 56px;
32
33
  --maxw: 1040px;
33
34
  --gutter: var(--sp-6);
@@ -359,6 +359,10 @@
359
359
  "$type": "dimension",
360
360
  "$value": "28px"
361
361
  },
362
+ "chip-h": {
363
+ "$type": "dimension",
364
+ "$value": "28px"
365
+ },
362
366
  "nav-h": {
363
367
  "$type": "dimension",
364
368
  "$value": "56px"
@@ -15,16 +15,6 @@ export function isSessionMetadataTurn(turn: TurnDetail, harness: string | undefi
15
15
  * @returns {TurnDetail[]}
16
16
  */
17
17
  export function prefilterTurns(turns: TurnDetail[]): TurnDetail[];
18
- /**
19
- * Dependency-free line diff (LCS) → cooked `DiffLineVM[]`. fairtrade ships no
20
- * `diff` package, so the adapter computes hunks itself. Line numbers are 1-based
21
- * within the supplied snippet (the wire carries the edit snippet, not the file
22
- * offset). Deterministic — no clock/randomness — so it is screenshot-stable.
23
- * @param {string} oldText
24
- * @param {string} newText
25
- * @returns {DiffLineVM[]}
26
- */
27
- export function diffLines(oldText: string, newText: string): DiffLineVM[];
28
18
  /**
29
19
  * Project the canonical wire payload (folded turns) into the cooked
30
20
  * `TranscriptViewModel` every dumb transcript component renders. The SOLE
@@ -37,6 +27,7 @@ export function diffLines(oldText: string, newText: string): DiffLineVM[];
37
27
  * @returns {TranscriptViewModel}
38
28
  */
39
29
  export function adaptTranscript(payload: TranscriptWireInput, annotations?: AnnotationSummary[], analytics?: TranscriptAnalyticsVM, options?: AdaptTranscriptOptions): TranscriptViewModel;
30
+ export { diffLines };
40
31
  export type TranscriptWireInput = import("./wire-types.js").TranscriptWireInput;
41
32
  export type SessionDetailPayload = import("./wire-types.js").SessionDetailPayload;
42
33
  export type TurnDetail = import("./wire-types.js").TurnDetail;
@@ -51,6 +42,7 @@ export type SessionVM = import("./view-model.js").SessionVM;
51
42
  export type SessionGitVM = import("./view-model.js").SessionGitVM;
52
43
  export type CommitVM = import("./view-model.js").CommitVM;
53
44
  export type TurnVM = import("./view-model.js").TurnVM;
45
+ export type TaskGroupVM = import("./view-model.js").TaskGroupVM;
54
46
  export type ToolCallVM = import("./view-model.js").ToolCallVM;
55
47
  export type ToolGroup = import("./view-model.js").ToolGroup;
56
48
  export type DiffLineVM = import("./view-model.js").DiffLineVM;
@@ -71,3 +63,4 @@ export type AdaptTranscriptOptions = {
71
63
  */
72
64
  relationshipNavigation?: import("@peasant-labs/schema").SessionRelationshipNavigation[];
73
65
  };
66
+ import { diffLines } from './adapter.parse.js';
@@ -1,4 +1,5 @@
1
1
  /** @typedef {import('./wire-types.js').ToolCallDetail} ToolCallDetail */
2
+ /** @typedef {import('./view-model.js').DiffLineVM} DiffLineVM */
2
3
  /**
3
4
  * The SOLE `JSON.parse` of a wire-encoded tool string in the lifted code. Every
4
5
  * other parse helper here, the adapter, and the analytics util route through it,
@@ -55,9 +56,35 @@ export function editPairs(call: ToolCallDetail): EditPair[];
55
56
  */
56
57
  export function writeContent(call: ToolCallDetail): string;
57
58
  /**
58
- * Lines inserted / removed for an edit-family or write tool call. Consolidates
59
- * the THREE duplicate `countDiff` definitions. Pure: depends only on the parsed
60
- * arguments, never a clock or the file system.
59
+ * Dependency-free line diff (LCS) → cooked `DiffLineVM[]`. fairtrade ships no
60
+ * `diff` package, so the adapter computes hunks itself. Line numbers are 1-based
61
+ * within the supplied snippet (the wire carries the edit snippet, not the file
62
+ * offset). Deterministic — no clock/randomness — so it is screenshot-stable.
63
+ * @param {string} oldText
64
+ * @param {string} newText
65
+ * @returns {DiffLineVM[]}
66
+ */
67
+ export function diffLines(oldText: string, newText: string): DiffLineVM[];
68
+ /**
69
+ * The cooked line diff of an edit-family or write tool call (one line list per replaced span) and
70
+ * its churn: the + and − lines of that same diff, so a rewrite of three lines counts +3 −3 and every
71
+ * count (the tool call, the diffs tab, a task's churn) agrees with the lines it heads. A span's
72
+ * trailing empty line is the newline artifact, not a line anyone wrote, so it is not counted, as the
73
+ * renderer does not show it. Undefined for any other kind, or an edit with no replacement. Memoised
74
+ * per call object, because the adapter and the analytics both ask and the line diff is quadratic in
75
+ * the span length.
76
+ * @param {ToolCallDetail} call
77
+ * @returns {{ spans: DiffLineVM[][], adds: number, dels: number } | undefined}
78
+ */
79
+ export function callDiff(call: ToolCallDetail): {
80
+ spans: DiffLineVM[][];
81
+ adds: number;
82
+ dels: number;
83
+ } | undefined;
84
+ /**
85
+ * Lines inserted / removed for an edit-family or write tool call: the churn of `callDiff`, zero
86
+ * for any other kind. Consolidates the THREE duplicate `countDiff` definitions. Pure: depends only
87
+ * on the parsed arguments, never a clock or the file system.
61
88
  * @param {ToolCallDetail} call
62
89
  * @returns {{ adds: number, dels: number }}
63
90
  */
@@ -66,6 +93,7 @@ export function countDiff(call: ToolCallDetail): {
66
93
  dels: number;
67
94
  };
68
95
  export type ToolCallDetail = import("./wire-types.js").ToolCallDetail;
96
+ export type DiffLineVM = import("./view-model.js").DiffLineVM;
69
97
  /**
70
98
  * One old→new replacement inside an Edit / MultiEdit / NotebookEdit call.
71
99
  */
@@ -75,6 +75,6 @@ export { ROLES, ENTRY_TYPES, TOOL_CALL_KINDS, STOP_REASONS, SESSION_OUTCOMES, HA
75
75
  export { adaptTranscript, prefilterTurns, isSessionMetadataTurn, diffLines } from "./adapter.js";
76
76
  export { computeTasks, computeTurnLabels, buildTaskWaterfall, annotateTranscript, computePersonalMedians, detectPhases, assessScorecard, computeAnalytics, computeTaskGroups, phaseLabel } from "./analytics.js";
77
77
  export { formatRelative, formatDurationMins, formatDurationMs, formatDurationSeconds, formatDateLong, isKnownTime } from "./time.js";
78
- export { summarizePrompt, composeSessionTitle, projectLabel } from "./title.js";
78
+ export { summarizePrompt, composeSessionTitle, projectLabel, cleanSessionTitle, unwrapUserQuery } from "./title.js";
79
79
  export { default as TranscriptDiffEntryCard, DiffHunks as TranscriptDiffHunks } from "./DiffEntryCard.jsx";
80
80
  export { advanceTranscriptInitialPositionConsumption, normalizeTranscriptInitialPosition, resolveTranscriptInitialPosition, shouldApplyTranscriptInitialPosition, transcriptInitialPositionReadiness, transcriptInitialPositionToken } from "./initial-position.js";
@@ -1,5 +1,20 @@
1
+ /**
2
+ * The prompt without a harness's <user_query> wrapper: the user's own text, untouched otherwise.
3
+ * @param {string | undefined} text
4
+ * @returns {string}
5
+ */
6
+ export function unwrapUserQuery(text: string | undefined): string;
7
+ /**
8
+ * A stored session title, shown as written: the harness's <user_query> wrapper dropped and the
9
+ * whitespace collapsed, but every word, its case, its dots and an existing trailing "…" kept. For a
10
+ * title, never `summarizePrompt`, which cuts at the first sentence and recases.
11
+ * @param {string | undefined} text
12
+ * @returns {string}
13
+ */
14
+ export function cleanSessionTitle(text: string | undefined): string;
1
15
  /**
2
16
  * Produce a short, human-readable summary of a raw prompt. Heuristic, in order:
17
+ * 0. Drop a harness's <user_query> wrapper (cleanSessionTitle's rule).
3
18
  * 1. Strip leading <system-reminder> blocks and leading fenced code blocks.
4
19
  * 2. Pull out a <command-name> (e.g. `/mcp`) if present, keep following prose.
5
20
  * 3. Strip remaining XML-ish tags, collapse whitespace, take the first sentence.
@@ -308,9 +308,15 @@ export type TurnVM = {
308
308
  */
309
309
  label: string;
310
310
  /**
311
- * markdown body (thinking already extracted)
311
+ * markdown body (thinking already extracted), as recorded
312
312
  */
313
313
  content: string;
314
+ /**
315
+ * the text the turn shows instead of `content`, present only
316
+ * when they differ (a cursor prompt's `<user_query>` wrapper
317
+ * removed); views render `displayContent ?? content`
318
+ */
319
+ displayContent?: string;
314
320
  /**
315
321
  * subagent nesting depth (0 = top level)
316
322
  */
@@ -463,6 +469,10 @@ export type TaskGroupVM = {
463
469
  * user content for the task (case preserved)
464
470
  */
465
471
  prompt: string;
472
+ /**
473
+ * the prompt as its turn shows it, present only when it differs
474
+ */
475
+ displayPrompt?: string;
466
476
  /**
467
477
  * turns belonging to this task
468
478
  */