@peasant-labs/fairtrade 0.0.38 → 0.0.40
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/{GraphLegend-7PmEpBZQ.js → GraphLegend-nwqBLEcI.js} +1408 -1362
- package/dist/lib/analytics.css +1 -1
- package/dist/lib/analytics.js +295 -303
- package/dist/lib/commons.js +809 -808
- package/dist/lib/components.css +1 -1
- package/dist/lib/format-B3uT2wzU.js +41 -0
- package/dist/lib/graph.js +509 -508
- package/dist/lib/tokens.css +1 -0
- package/dist/lib/tokens.json +4 -0
- package/dist/lib/types/CliOnboard.d.ts +11 -0
- package/dist/lib/types/DiffView.d.ts +5 -3
- package/dist/lib/types/Publish.d.ts +29 -7
- package/dist/lib/types/Switch.d.ts +8 -1
- package/dist/lib/types/analytics/format.d.ts +2 -1
- package/dist/lib/types/format.d.ts +35 -4
- package/dist/lib/types/index.d.ts +1 -0
- package/dist/lib/types/transcript/adapter.d.ts +3 -10
- package/dist/lib/types/transcript/adapter.parse.d.ts +31 -3
- package/dist/lib/types/transcript/index.d.ts +1 -1
- package/dist/lib/types/transcript/title.d.ts +15 -0
- package/dist/lib/types/transcript/view-model.d.ts +11 -1
- package/dist/lib/{ui-DIoBcgLp.js → ui-DMUCYaeU.js} +4615 -4583
- package/dist/lib/ui.js +5 -4
- package/package.json +9 -3
package/dist/lib/tokens.css
CHANGED
package/dist/lib/tokens.json
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The words of a wrapped command and the spaces between them, as the line breaks them: a lone "|"
|
|
3
|
+
* keeps to the word after it, so a pipe never starts or ends a line on its own.
|
|
4
|
+
* @param {string} command
|
|
5
|
+
* @returns {Array<{ word: string } | { space: string }>}
|
|
6
|
+
*/
|
|
7
|
+
export function commandWords(command: string): Array<{
|
|
8
|
+
word: string;
|
|
9
|
+
} | {
|
|
10
|
+
space: string;
|
|
11
|
+
}>;
|
|
1
12
|
/**
|
|
2
13
|
* CommandBlock — a square `$ command` block: a mono command line with a leading dim `$`, and a copy
|
|
3
14
|
* button that flips to an olive check + the word "copied" for ~1.5s.
|
|
@@ -6,12 +6,14 @@
|
|
|
6
6
|
*
|
|
7
7
|
* redaction: variant="redaction", pass `matches` = [{ category, confidence, original,
|
|
8
8
|
* replacement, oldNo, newNo }]. each match is a del→add pair with a category/
|
|
9
|
-
* confidence badge and a per-match keep/revert button.
|
|
9
|
+
* confidence badge and a per-match keep/revert button. `category` is the engine's
|
|
10
|
+
* (RedactionCategory: secrets, pii, paths, project) and shows as the engine's label;
|
|
11
|
+
* an unknown category (a rule name, a display label) shows an alert and no match.
|
|
10
12
|
*
|
|
11
13
|
* @param {object} props
|
|
12
14
|
* @param {string} props.file - the file path shown in the header (mono, not lowercased)
|
|
13
15
|
* @param {Array<{header?:string, lines:Array<{type:'add'|'del'|'ctx', oldNo?:number|string, newNo?:number|string, text:string}>}>} [props.hunks] - structured hunks (default variant)
|
|
14
|
-
* @param {Array<{category:
|
|
16
|
+
* @param {Array<{category:import('@peasant-labs/schema').RedactionCategory, confidence:number, original:string, replacement:string, oldNo?:number|string, newNo?:number|string}>} [props.matches] - redaction matches (redaction variant)
|
|
15
17
|
* @param {'default'|'redaction'} [props.variant='default']
|
|
16
18
|
* @param {string} [props.className]
|
|
17
19
|
*/
|
|
@@ -27,7 +29,7 @@ export default function DiffView({ file, hunks, matches, variant, className, ...
|
|
|
27
29
|
}>;
|
|
28
30
|
}>;
|
|
29
31
|
matches?: Array<{
|
|
30
|
-
category:
|
|
32
|
+
category: import("@peasant-labs/schema").RedactionCategory;
|
|
31
33
|
confidence: number;
|
|
32
34
|
original: string;
|
|
33
35
|
replacement: string;
|
|
@@ -4,15 +4,19 @@
|
|
|
4
4
|
* @param {object} props
|
|
5
5
|
* @param {PublishState} props.state
|
|
6
6
|
* @param {number} [props.collectives] - how many collectives can read it (published, new-turns, publishing); left out of the words when omitted.
|
|
7
|
-
* @param {number} [props.newTurns] - turns recorded since the last publish (new-turns).
|
|
7
|
+
* @param {number} [props.newTurns] - turns recorded since the last publish (new-turns); the label says "needs update".
|
|
8
8
|
* @param {string} [props.collective] - the collective(s) the project's auto-publish rule targets (auto-publish).
|
|
9
|
+
* @param {'public'|'private'} [props.visibility] - published: who can find it beyond its collectives, as the host knows
|
|
10
|
+
* it. "published, public" and "published, private" are said only from this; without it a transcript no
|
|
11
|
+
* collective reads is just "published".
|
|
9
12
|
* @param {string} [props.className]
|
|
10
13
|
*/
|
|
11
|
-
export function PublishStateLabel({ state, collectives, newTurns, collective, className, ...rest }: {
|
|
14
|
+
export function PublishStateLabel({ state, collectives, newTurns, collective, visibility, className, ...rest }: {
|
|
12
15
|
state: PublishState;
|
|
13
16
|
collectives?: number;
|
|
14
17
|
newTurns?: number;
|
|
15
18
|
collective?: string;
|
|
19
|
+
visibility?: "public" | "private";
|
|
16
20
|
className?: string;
|
|
17
21
|
}): import("react").JSX.Element;
|
|
18
22
|
/**
|
|
@@ -25,16 +29,18 @@ export function PublishStateLabel({ state, collectives, newTurns, collective, cl
|
|
|
25
29
|
* @param {number} [props.collectives]
|
|
26
30
|
* @param {number} [props.newTurns]
|
|
27
31
|
* @param {string} [props.collective]
|
|
32
|
+
* @param {'public'|'private'} [props.visibility]
|
|
28
33
|
* @param {() => void} [props.onAction] - the one button. omit it and no button renders.
|
|
29
34
|
* @param {string} [props.actionLabel] - replaces the state's default label.
|
|
30
35
|
* @param {import('./Menu.jsx').MenuItem[]} [props.moreItems] - an optional overflow menu after the button.
|
|
31
36
|
* @param {string} [props.className]
|
|
32
37
|
*/
|
|
33
|
-
export function PublishBar({ state, collectives, newTurns, collective, onAction, actionLabel, moreItems, className, ...rest }: {
|
|
38
|
+
export function PublishBar({ state, collectives, newTurns, collective, visibility, onAction, actionLabel, moreItems, className, ...rest }: {
|
|
34
39
|
state: PublishState;
|
|
35
40
|
collectives?: number;
|
|
36
41
|
newTurns?: number;
|
|
37
42
|
collective?: string;
|
|
43
|
+
visibility?: "public" | "private";
|
|
38
44
|
onAction?: () => void;
|
|
39
45
|
actionLabel?: string;
|
|
40
46
|
moreItems?: import("./Menu.jsx").MenuItem[];
|
|
@@ -96,7 +102,7 @@ export function CollectivePicker({ suggestions, onAdd, query: queryProp, onQuery
|
|
|
96
102
|
* checkbox, then the done state with the village link. The host drives `state`; the popup never
|
|
97
103
|
* advances on its own.
|
|
98
104
|
*
|
|
99
|
-
* States: `connect` (this computer is not signed in to
|
|
105
|
+
* States: `connect` (this computer is not signed in to peasant online), `waiting-github` (after continue
|
|
100
106
|
* with github), `checking` (the redaction check is running), `scan-failed` (publish is off,
|
|
101
107
|
* re-scan stays on), `no-collective` (signed in, in no collective), `ready`, `publishing`,
|
|
102
108
|
* `stopped` (a named step failed; the host names any changes already applied), `done`, `waits-approval` (done, and
|
|
@@ -108,7 +114,7 @@ export function CollectivePicker({ suggestions, onAdd, query: queryProp, onQuery
|
|
|
108
114
|
* @param {string} props.title - the session title, kept in its case.
|
|
109
115
|
* @param {'publish'|'update'} [props.mode='publish']
|
|
110
116
|
* @param {PublishDialogState} props.state - one of PUBLISH_DIALOG_STATES.
|
|
111
|
-
* @param {{ matches?: import('./Redaction.jsx').RedactionMatch[], matchCount?: number, total?: number, failure?: string, failureDetail?: string, failureAction?: { label: string, onSelect: () => void, busy?: boolean } }} [props.scan] - the host's scan result. `failure` is one plain line; `failureAction` is a button in the failure box (the one action that fixes it); `failureDetail`, the actionable detail (what, why, where, the fix), shows as pre-wrapped mono text behind a "details" disclosure in the failure box. `matchCount` is the full occurrence count when `matches` contains only examples. Until it carries a
|
|
117
|
+
* @param {{ matches?: import('./Redaction.jsx').RedactionMatch[], matchCount?: number, total?: number, failure?: string, failureDetail?: string, failureAction?: { label: string, onSelect: () => void, busy?: boolean }, note?: { line: string, detail?: string } }} [props.scan] - the host's scan result. `note` is a quiet line under a finished scan's count (what the scanned copy leaves out, and why), with its detail behind a "details" disclosure; it is information, not an alert, and publishing stays on. `failure` is one plain line; `failureAction` is a button in the failure box (the one action that fixes it); `failureDetail`, the actionable detail (what, why, where, the fix), shows as pre-wrapped mono text behind a "details" disclosure in the failure box. `matchCount` is the full occurrence count when `matches` contains only examples. Until it carries a
|
|
112
118
|
* `matches` list, the popup says the transcript is not scanned and keeps publish off. A match with `kept: true` leaves un-redacted, and the
|
|
113
119
|
* popup says so and opens the matches.
|
|
114
120
|
* @param {() => void} [props.onRescan]
|
|
@@ -125,13 +131,18 @@ export function CollectivePicker({ suggestions, onAdd, query: queryProp, onQuery
|
|
|
125
131
|
* @param {string} [props.primaryLabel] - replaces the derived primary label.
|
|
126
132
|
* @param {() => void} [props.onPublish]
|
|
127
133
|
* @param {() => void} [props.onConnect] - `continue with github`.
|
|
128
|
-
* @param {string} [props.joinHref] - `create or join one on
|
|
134
|
+
* @param {string} [props.joinHref] - `create or join one on peasant online`.
|
|
129
135
|
* @param {string} [props.stoppedAt] - the step that failed, in words ("setting who can read it").
|
|
136
|
+
* @param {string} [props.stoppedDetail] - stopped state: the host's actionable detail, pre-wrapped mono text behind a
|
|
137
|
+
* "details" disclosure in the stopped box.
|
|
138
|
+
* @param {{ line: string, detail?: string, onRetry?: () => void, busy?: boolean }} [props.accessFailure] - the
|
|
139
|
+
* collectives could not be read. "who can read it" shows the line, a retry for that read and the detail in
|
|
140
|
+
* place of the access list and picker, and publishing stays off. The dialog's state stays the host's.
|
|
130
141
|
* @param {() => void} [props.onRecover] - stopped-state prerequisite read/sign-in recovery only; may run before a scan or audience exists, but never with an explicitly refused review. Mutually exclusive with onRetry. Must not publish.
|
|
131
142
|
* @param {() => void} [props.onRetry] - stopped-state actual publication retry; requires a valid review and audience. Mutually exclusive with onRecover.
|
|
132
143
|
* @param {{ url: string, collectives: string[], pending?: string[], pullRequest?: { number: number, branch: string, href?: string } }} [props.done]
|
|
133
144
|
*/
|
|
134
|
-
export function PublishDialog({ open, onClose, title, mode, state, scan, onRescan, checking, changes, access, onRemove, onRestore, picker, autoPublish, accessSummary, primaryLabel, onPublish, onConnect, joinHref, stoppedAt, onRecover, onRetry, done, }: {
|
|
145
|
+
export function PublishDialog({ open, onClose, title, mode, state, scan, onRescan, checking, changes, access, onRemove, onRestore, picker, autoPublish, accessSummary, primaryLabel, onPublish, onConnect, joinHref, stoppedAt, stoppedDetail, accessFailure, onRecover, onRetry, done, }: {
|
|
135
146
|
open: boolean;
|
|
136
147
|
onClose: () => void;
|
|
137
148
|
title: string;
|
|
@@ -148,6 +159,10 @@ export function PublishDialog({ open, onClose, title, mode, state, scan, onResca
|
|
|
148
159
|
onSelect: () => void;
|
|
149
160
|
busy?: boolean;
|
|
150
161
|
};
|
|
162
|
+
note?: {
|
|
163
|
+
line: string;
|
|
164
|
+
detail?: string;
|
|
165
|
+
};
|
|
151
166
|
};
|
|
152
167
|
onRescan?: () => void;
|
|
153
168
|
checking?: {
|
|
@@ -176,6 +191,13 @@ export function PublishDialog({ open, onClose, title, mode, state, scan, onResca
|
|
|
176
191
|
onConnect?: () => void;
|
|
177
192
|
joinHref?: string;
|
|
178
193
|
stoppedAt?: string;
|
|
194
|
+
stoppedDetail?: string;
|
|
195
|
+
accessFailure?: {
|
|
196
|
+
line: string;
|
|
197
|
+
detail?: string;
|
|
198
|
+
onRetry?: () => void;
|
|
199
|
+
busy?: boolean;
|
|
200
|
+
};
|
|
179
201
|
onRecover?: () => void;
|
|
180
202
|
onRetry?: () => void;
|
|
181
203
|
done?: {
|
|
@@ -11,11 +11,13 @@
|
|
|
11
11
|
* @property {React.ComponentType<{size?: number}>} [stateIcon] override icon for the
|
|
12
12
|
* .sw-state marker; defaults to CircleCheck (on) / Circle (off).
|
|
13
13
|
* @property {string} [id] id for the control; links the label's `for`.
|
|
14
|
+
* @property {boolean} [stateMarker=true] show the on/off word beside the switch; off where the
|
|
15
|
+
* host already says the state (a settings row).
|
|
14
16
|
*/
|
|
15
17
|
/**
|
|
16
18
|
* @param {SwitchProps} props
|
|
17
19
|
*/
|
|
18
|
-
export default function Switch({ checked, defaultChecked, onChange, disabled, busy, label, onText, offText, stateIcon: StateIcon, id, }: SwitchProps): import("react").JSX.Element;
|
|
20
|
+
export default function Switch({ checked, defaultChecked, onChange, disabled, busy, label, onText, offText, stateIcon: StateIcon, id, stateMarker, }: SwitchProps): import("react").JSX.Element;
|
|
19
21
|
export type SwitchProps = {
|
|
20
22
|
/**
|
|
21
23
|
* controlled on/off state; pair with onChange.
|
|
@@ -60,4 +62,9 @@ export type SwitchProps = {
|
|
|
60
62
|
* id for the control; links the label's `for`.
|
|
61
63
|
*/
|
|
62
64
|
id?: string;
|
|
65
|
+
/**
|
|
66
|
+
* show the on/off word beside the switch; off where the
|
|
67
|
+
* host already says the state (a settings row).
|
|
68
|
+
*/
|
|
69
|
+
stateMarker?: boolean;
|
|
63
70
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Compact token count: 1234 → "1.2k", 62_000 → "62k",
|
|
2
|
+
* Compact token count, the library's one count format: 1234 → "1.2k", 62_000 → "62k",
|
|
3
|
+
* 1_234_567 → "1.2M", 66_731_500_000 → "66.7B". A negative count is not a count and reads "—".
|
|
3
4
|
* @param {number | null | undefined} n
|
|
4
5
|
* @returns {string}
|
|
5
6
|
*/
|
|
@@ -1,4 +1,35 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Compact count, one decimal at most: 999 → "999", 1234 → "1.2k", 66_731_500_000 → "66.7B".
|
|
3
|
+
* @param {unknown} value
|
|
4
|
+
* @returns {string}
|
|
5
|
+
*/
|
|
6
|
+
export function formatCount(value: unknown): string;
|
|
7
|
+
/**
|
|
8
|
+
* Exact grouped integer: 272000 → "272,000". A bigint or a string of digits stays exact past the
|
|
9
|
+
* JS-safe range; any other value is rounded.
|
|
10
|
+
* @param {unknown} value
|
|
11
|
+
* @returns {string}
|
|
12
|
+
*/
|
|
13
|
+
export function formatInteger(value: unknown): string;
|
|
14
|
+
/**
|
|
15
|
+
* A cost in US dollars at cents: "$0.30", "$1,234.56", "$0.00" for zero, "<$0.01" for a positive
|
|
16
|
+
* amount under one cent. Accepts the recorded decimal string as it arrives.
|
|
17
|
+
* @param {unknown} value
|
|
18
|
+
* @returns {string}
|
|
19
|
+
*/
|
|
20
|
+
export function formatCost(value: unknown): string;
|
|
21
|
+
/**
|
|
22
|
+
* A decimal at fixed places: 0.99 → "0.99", 0.5 with 2 places → "0.50".
|
|
23
|
+
* @param {unknown} value
|
|
24
|
+
* @param {number} places
|
|
25
|
+
* @returns {string}
|
|
26
|
+
*/
|
|
27
|
+
export function formatDecimal(value: unknown, places: number): string;
|
|
28
|
+
/**
|
|
29
|
+
* Calendar dates are stable across host locales; date-only inputs stay on their UTC day.
|
|
30
|
+
* @param {string | number | Date} value
|
|
31
|
+
* @returns {string}
|
|
32
|
+
*/
|
|
33
|
+
export function formatDate(value: string | number | Date): string;
|
|
34
|
+
/** What every formatter shows for a missing or unreadable value. */
|
|
35
|
+
export const MISSING_NUMBER: "\u2014";
|
|
@@ -55,6 +55,7 @@ export { default as Breadcrumb, Steps } from "./Breadcrumb.jsx";
|
|
|
55
55
|
export { default as Tooltip, Popover } from "./Tooltip.jsx";
|
|
56
56
|
export { Avatar, AvatarGroup, Kbd, KbdChord, Tag } from "./Avatar.jsx";
|
|
57
57
|
export { default as BrandMark, resolveBrand } from "./BrandMark.jsx";
|
|
58
|
+
export { formatCount, formatInteger, formatCost, formatDecimal, MISSING_NUMBER } from "./format.js";
|
|
58
59
|
export { providerAccent, providerDisplayName } from "./provider-policy.js";
|
|
59
60
|
export { Skeleton, Progress, Spinner, Toast, FeedbackPanel } from "./Feedback.jsx";
|
|
60
61
|
export { DataTableToolbar, DataTablePaginationControls } from "./DataTableControls.jsx";
|
|
@@ -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
|
-
*
|
|
59
|
-
* the
|
|
60
|
-
*
|
|
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
|
*/
|