@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
|
@@ -4,11 +4,11 @@ export function clampLevel(level: any): number;
|
|
|
4
4
|
* coverage ratio (recorded / total) → ramp level. 0 / unknown = none; ≥ 0.9
|
|
5
5
|
* reads as fully covered. mirrors peasant's traceabilityLevel quantiles.
|
|
6
6
|
*/
|
|
7
|
-
export function coverageLevel(recorded: any, total: any): 0 |
|
|
7
|
+
export function coverageLevel(recorded: any, total: any): 0 | 1 | 2 | 3 | 4;
|
|
8
8
|
/** density (0..1) → ramp level for the bottom-edge effort bar. */
|
|
9
|
-
export function effortLevel(density: any): 0 |
|
|
9
|
+
export function effortLevel(density: any): 0 | 1 | 2 | 3 | 4;
|
|
10
10
|
/** generic value-vs-max quantization (heatmap cells, sparklines). */
|
|
11
|
-
export function quantize(value: any, max: any): 0 |
|
|
11
|
+
export function quantize(value: any, max: any): 0 | 1 | 2 | 3 | 4;
|
|
12
12
|
/** loc → node size class. small files are compact; large ones get real estate. */
|
|
13
13
|
export function locSize(loc: any): "sm" | "md" | "lg" | "xs" | "xl";
|
|
14
14
|
export function IntensitySwatch({ level, accent, size, label, className, ...rest }: {
|
|
@@ -21,6 +21,8 @@ export { default as GroupedMultiSelect } from "./GroupedMultiSelect.jsx";
|
|
|
21
21
|
export { default as ToolCallRenderer } from "./ToolRenderers.jsx";
|
|
22
22
|
export { default as Tour } from "./Tour.jsx";
|
|
23
23
|
export { default as FacetRail } from "./FacetRail.jsx";
|
|
24
|
+
export * from "./transcript/index.js";
|
|
25
|
+
export * from "./transcript/graph/index.js";
|
|
24
26
|
export { default as Button, ButtonGroup, Segmented } from "./Button.jsx";
|
|
25
27
|
export { default as Input, Textarea, Select, Field } from "./Input.jsx";
|
|
26
28
|
export { default as Checkbox, Radio, RadioGroup } from "./Checkbox.jsx";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {object} props
|
|
3
|
+
* @param {boolean} [props.checked]
|
|
4
|
+
* @param {Function} [props.onChange] fired with the native change event
|
|
5
|
+
* @param {*} [props.children] the row label (text, or icon + text)
|
|
6
|
+
* @param {number} [props.count] optional trailing match count
|
|
7
|
+
* @param {boolean} [props.disabled]
|
|
8
|
+
*/
|
|
9
|
+
export default function CheckRow({ checked, onChange, children, count, disabled }: {
|
|
10
|
+
checked?: boolean;
|
|
11
|
+
onChange?: Function;
|
|
12
|
+
children?: any;
|
|
13
|
+
count?: number;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
}): any;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** @typedef {import('./view-model.js').DiffEntryVM} DiffEntryVM */
|
|
2
|
+
/** @typedef {import('./view-model.js').DiffHunkVM} DiffHunkVM */
|
|
3
|
+
/**
|
|
4
|
+
* Render cooked diff hunks as the canonical `.txn-diff` rows. The mockup draws a single
|
|
5
|
+
* `.diff` block per change, so hunks are flattened into one row list; each hunk's trailing
|
|
6
|
+
* empty line (the LCS newline artifact) is trimmed first.
|
|
7
|
+
* @param {object} props
|
|
8
|
+
* @param {DiffHunkVM[]} [props.hunks]
|
|
9
|
+
*/
|
|
10
|
+
export function DiffHunks({ hunks }: {
|
|
11
|
+
hunks?: DiffHunkVM[];
|
|
12
|
+
}): any;
|
|
13
|
+
/**
|
|
14
|
+
* One Diffs-tab card: a file/turn label, the +adds/−dels churn, a jump affordance, and the
|
|
15
|
+
* rendered diff hunks. Consumes a cooked `DiffEntryVM` (an entry of `vm.diffs`).
|
|
16
|
+
* @param {object} props
|
|
17
|
+
* @param {DiffEntryVM} [props.entry]
|
|
18
|
+
* @param {boolean} [props.byTurn] label by turn index instead of file path
|
|
19
|
+
* @param {() => void} [props.onJump]
|
|
20
|
+
*/
|
|
21
|
+
export default function DiffEntryCard({ entry, byTurn, onJump }: {
|
|
22
|
+
entry?: DiffEntryVM;
|
|
23
|
+
byTurn?: boolean;
|
|
24
|
+
onJump?: () => void;
|
|
25
|
+
}): any;
|
|
26
|
+
export type DiffEntryVM = import("./view-model.js").DiffEntryVM;
|
|
27
|
+
export type DiffHunkVM = import("./view-model.js").DiffHunkVM;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {object} props
|
|
3
|
+
* @param {*} [props.title] the section heading (lowercase chrome)
|
|
4
|
+
* @param {*} [props.children] the section body (rows)
|
|
5
|
+
* @param {boolean} [props.defaultOpen]
|
|
6
|
+
*/
|
|
7
|
+
export default function FilterSection({ title, children, defaultOpen }: {
|
|
8
|
+
title?: any;
|
|
9
|
+
children?: any;
|
|
10
|
+
defaultOpen?: boolean;
|
|
11
|
+
}): any;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export default function FiltersRail({ tab, filters, onFiltersChange, counts, checkpoints, filtersActive, onClear, onJumpStart, onJumpLatest, }: {
|
|
2
|
+
tab: any;
|
|
3
|
+
filters?: {
|
|
4
|
+
categories: {
|
|
5
|
+
prompts: boolean;
|
|
6
|
+
responses: boolean;
|
|
7
|
+
thinking: boolean;
|
|
8
|
+
toolcalls: boolean;
|
|
9
|
+
};
|
|
10
|
+
toolGroups: {};
|
|
11
|
+
tags: {
|
|
12
|
+
errors: boolean;
|
|
13
|
+
retries: boolean;
|
|
14
|
+
revert: boolean;
|
|
15
|
+
};
|
|
16
|
+
views: {
|
|
17
|
+
hidden: boolean;
|
|
18
|
+
expandAll: boolean;
|
|
19
|
+
compact: boolean;
|
|
20
|
+
};
|
|
21
|
+
checkpoint: string;
|
|
22
|
+
};
|
|
23
|
+
onFiltersChange?: () => void;
|
|
24
|
+
counts?: {
|
|
25
|
+
categories: {
|
|
26
|
+
prompts: number;
|
|
27
|
+
responses: number;
|
|
28
|
+
thinking: number;
|
|
29
|
+
toolcalls: number;
|
|
30
|
+
};
|
|
31
|
+
toolGroups: {};
|
|
32
|
+
};
|
|
33
|
+
checkpoints?: any[];
|
|
34
|
+
filtersActive?: number;
|
|
35
|
+
onClear?: () => void;
|
|
36
|
+
onJumpStart?: () => void;
|
|
37
|
+
onJumpLatest?: () => void;
|
|
38
|
+
}): any;
|
|
39
|
+
export type TranscriptFilters = import("./state-capabilities.js").TranscriptFilters;
|
|
40
|
+
export type ToolGroup = import("./view-model.js").ToolGroup;
|
|
41
|
+
export type CommitVM = import("./view-model.js").CommitVM;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {object} props
|
|
3
|
+
* @param {number} [props.turnId] the turn index being labelled
|
|
4
|
+
* @param {SavedLabel} [props.current] the existing label, if any
|
|
5
|
+
* @param {(outcome: SavedLabel['outcome'], flag: string) => void} [props.onSave]
|
|
6
|
+
* @param {Function} [props.onClose]
|
|
7
|
+
*/
|
|
8
|
+
export default function LabelPopover({ turnId, current, onSave, onClose }: {
|
|
9
|
+
turnId?: number;
|
|
10
|
+
current?: SavedLabel;
|
|
11
|
+
onSave?: (outcome: SavedLabel["outcome"], flag: string) => void;
|
|
12
|
+
onClose?: Function;
|
|
13
|
+
}): any;
|
|
14
|
+
export type SavedLabel = import("./state-capabilities.js").SavedLabel;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {object} props
|
|
3
|
+
* @param {TranscriptViewModel} props.viewModel
|
|
4
|
+
* @param {import('./state-capabilities.js').TranscriptTab} props.tab
|
|
5
|
+
* @param {(turnIndex: number) => void} [props.onJump]
|
|
6
|
+
*/
|
|
7
|
+
export default function OutlineRail({ viewModel, tab, onJump }: {
|
|
8
|
+
viewModel: TranscriptViewModel;
|
|
9
|
+
tab: import("./state-capabilities.js").TranscriptTab;
|
|
10
|
+
onJump?: (turnIndex: number) => void;
|
|
11
|
+
}): any;
|
|
12
|
+
export type TranscriptViewModel = import("./view-model.js").TranscriptViewModel;
|
|
13
|
+
export type AnnotationVM = import("./view-model.js").AnnotationVM;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {object} props
|
|
3
|
+
* @param {ScorecardBandVM[]} [props.bands] the cooked scorecard bands (vm.analytics.scorecardBands)
|
|
4
|
+
*/
|
|
5
|
+
export default function Scorecard({ bands }: {
|
|
6
|
+
bands?: ScorecardBandVM[];
|
|
7
|
+
}): any;
|
|
8
|
+
export type ScorecardBandVM = import("./view-model.js").ScorecardBandVM;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** @typedef {import('./view-model.js').TurnVM} TurnVM */
|
|
2
|
+
/**
|
|
3
|
+
* @param {object} props
|
|
4
|
+
* @param {TurnVM[]} [props.turns]
|
|
5
|
+
* @param {number} [props.active] the active TURN INDEX (TurnVM.index)
|
|
6
|
+
* @param {(clientX: number, track: HTMLElement) => void} [props.onSeek]
|
|
7
|
+
* @param {{ current: boolean }} [props.draggingRef] shared drag latch; defaults to an internal ref
|
|
8
|
+
*/
|
|
9
|
+
export default function Scrubber({ turns, active, onSeek, draggingRef }: {
|
|
10
|
+
turns?: TurnVM[];
|
|
11
|
+
active?: number;
|
|
12
|
+
onSeek?: (clientX: number, track: HTMLElement) => void;
|
|
13
|
+
draggingRef?: {
|
|
14
|
+
current: boolean;
|
|
15
|
+
};
|
|
16
|
+
}): any;
|
|
17
|
+
export type TurnVM = import("./view-model.js").TurnVM;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** @typedef {import('./view-model.js').ThinkingVM} ThinkingVM */
|
|
2
|
+
/**
|
|
3
|
+
* @param {object} props
|
|
4
|
+
* @param {ThinkingVM} [props.block] cooked thinking (e.g. `TurnVM.thinking`)
|
|
5
|
+
*/
|
|
6
|
+
export default function Thinking({ block }: {
|
|
7
|
+
block?: ThinkingVM;
|
|
8
|
+
}): any;
|
|
9
|
+
export type ThinkingVM = import("./view-model.js").ThinkingVM;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {object} props
|
|
3
|
+
* @param {ToolCallVM} [props.tool]
|
|
4
|
+
* @param {boolean} [props.open]
|
|
5
|
+
* @param {() => void} [props.onToggle]
|
|
6
|
+
*/
|
|
7
|
+
export default function ToolCall({ tool, open, onToggle }: {
|
|
8
|
+
tool?: ToolCallVM;
|
|
9
|
+
open?: boolean;
|
|
10
|
+
onToggle?: () => void;
|
|
11
|
+
}): any;
|
|
12
|
+
export type ToolCallVM = import("./view-model.js").ToolCallVM;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {TranscriptViewerProps} props
|
|
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, activeTurn: activeTurnProp, onActiveTurnChange, search: searchProp, onSearchChange, filters: filtersProp, onFiltersChange, savedLabels: savedLabelsProp, onSavedLabelsChange, shareOpen: shareOpenProp, onShareOpenChange, moreOpen: moreOpenProp, onMoreOpenChange, }: TranscriptViewerProps): any;
|
|
5
|
+
export type TranscriptViewerProps = import("./state-capabilities.js").TranscriptViewerProps;
|
|
6
|
+
export type TranscriptFilters = import("./state-capabilities.js").TranscriptFilters;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {object} props
|
|
3
|
+
* @param {TurnVM} [props.turn]
|
|
4
|
+
* @param {boolean} [props.active]
|
|
5
|
+
* @param {Record<string, boolean>} [props.openTools] tool id → open?
|
|
6
|
+
* @param {(id: string) => void} [props.toggleTool]
|
|
7
|
+
* @param {(turnIndex: number) => void} [props.onCopyAnchor]
|
|
8
|
+
* @param {boolean} [props.copied]
|
|
9
|
+
* @param {(turnIndex: number, el: HTMLElement | null) => void} [props.registerRef]
|
|
10
|
+
* @param {(turnIndex: number) => void} [props.onLabel] omit to hide the "label" affordance
|
|
11
|
+
* @param {{ outcome: string, flag?: string }} [props.savedLabel]
|
|
12
|
+
* @param {boolean} [props.compact]
|
|
13
|
+
* @param {boolean} [props.expandAll]
|
|
14
|
+
*/
|
|
15
|
+
export default function TurnCard({ turn, active, openTools, toggleTool, onCopyAnchor, copied, registerRef, onLabel, savedLabel, compact, expandAll, }: {
|
|
16
|
+
turn?: TurnVM;
|
|
17
|
+
active?: boolean;
|
|
18
|
+
openTools?: Record<string, boolean>;
|
|
19
|
+
toggleTool?: (id: string) => void;
|
|
20
|
+
onCopyAnchor?: (turnIndex: number) => void;
|
|
21
|
+
copied?: boolean;
|
|
22
|
+
registerRef?: (turnIndex: number, el: HTMLElement | null) => void;
|
|
23
|
+
onLabel?: (turnIndex: number) => void;
|
|
24
|
+
savedLabel?: {
|
|
25
|
+
outcome: string;
|
|
26
|
+
flag?: string;
|
|
27
|
+
};
|
|
28
|
+
compact?: boolean;
|
|
29
|
+
expandAll?: boolean;
|
|
30
|
+
}): any;
|
|
31
|
+
export type TurnVM = import("./view-model.js").TurnVM;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {object} props
|
|
3
|
+
* @param {string} [props.label] the switch label + its accessible name
|
|
4
|
+
* @param {boolean} [props.on]
|
|
5
|
+
* @param {Function} [props.onToggle]
|
|
6
|
+
*/
|
|
7
|
+
export default function ViewSwitch({ label, on, onToggle }: {
|
|
8
|
+
label?: string;
|
|
9
|
+
on?: boolean;
|
|
10
|
+
onToggle?: Function;
|
|
11
|
+
}): any;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default turn prefilter the adapter applies to `payload.turns`: drop turns with
|
|
3
|
+
* neither content nor tool calls (and short tool-less system banners), then
|
|
4
|
+
* collapse adjacent same-role turns with identical content (a streaming
|
|
5
|
+
* artifact), preferring the tool-bearing copy. Pure, order-preserving. Exported
|
|
6
|
+
* so a host that pre-scopes turns can run the SAME filter.
|
|
7
|
+
* @param {TurnDetail[]} turns
|
|
8
|
+
* @returns {TurnDetail[]}
|
|
9
|
+
*/
|
|
10
|
+
export function prefilterTurns(turns: TurnDetail[]): TurnDetail[];
|
|
11
|
+
/**
|
|
12
|
+
* Dependency-free line diff (LCS) → cooked `DiffLineVM[]`. fairtrade ships no
|
|
13
|
+
* `diff` package, so the adapter computes hunks itself. Line numbers are 1-based
|
|
14
|
+
* within the supplied snippet (the wire carries the edit snippet, not the file
|
|
15
|
+
* offset). Deterministic — no clock/randomness — so it is screenshot-stable.
|
|
16
|
+
* @param {string} oldText
|
|
17
|
+
* @param {string} newText
|
|
18
|
+
* @returns {DiffLineVM[]}
|
|
19
|
+
*/
|
|
20
|
+
export function diffLines(oldText: string, newText: string): DiffLineVM[];
|
|
21
|
+
/**
|
|
22
|
+
* Project the canonical wire payload (folded turns) into the cooked
|
|
23
|
+
* `TranscriptViewModel` every dumb transcript component renders. The SOLE
|
|
24
|
+
* wire-parse + git-drift normalisation site.
|
|
25
|
+
*
|
|
26
|
+
* @param {TranscriptWireInput} payload canonical wire; tolerates both git shapes
|
|
27
|
+
* @param {AnnotationSummary[]} [annotations] separately-fetched entry annotations
|
|
28
|
+
* @param {TranscriptAnalyticsVM} [analytics] precomputed analytics; else derived on demand
|
|
29
|
+
* @returns {TranscriptViewModel}
|
|
30
|
+
*/
|
|
31
|
+
export function adaptTranscript(payload: TranscriptWireInput, annotations?: AnnotationSummary[], analytics?: TranscriptAnalyticsVM): TranscriptViewModel;
|
|
32
|
+
export type TranscriptWireInput = import("./wire-types.js").TranscriptWireInput;
|
|
33
|
+
export type SessionDetailPayload = import("./wire-types.js").SessionDetailPayload;
|
|
34
|
+
export type TurnDetail = import("./wire-types.js").TurnDetail;
|
|
35
|
+
export type ToolCallDetail = import("./wire-types.js").ToolCallDetail;
|
|
36
|
+
export type AnnotationSummary = import("./wire-types.js").AnnotationSummary;
|
|
37
|
+
export type TranscriptViewModel = import("./view-model.js").TranscriptViewModel;
|
|
38
|
+
export type TranscriptAnalyticsVM = import("./view-model.js").TranscriptAnalyticsVM;
|
|
39
|
+
export type SessionVM = import("./view-model.js").SessionVM;
|
|
40
|
+
export type SessionGitVM = import("./view-model.js").SessionGitVM;
|
|
41
|
+
export type CommitVM = import("./view-model.js").CommitVM;
|
|
42
|
+
export type TurnVM = import("./view-model.js").TurnVM;
|
|
43
|
+
export type ToolCallVM = import("./view-model.js").ToolCallVM;
|
|
44
|
+
export type ToolGroup = import("./view-model.js").ToolGroup;
|
|
45
|
+
export type DiffLineVM = import("./view-model.js").DiffLineVM;
|
|
46
|
+
export type DiffHunkVM = import("./view-model.js").DiffHunkVM;
|
|
47
|
+
export type DiffEntryVM = import("./view-model.js").DiffEntryVM;
|
|
48
|
+
export type FileEntryVM = import("./view-model.js").FileEntryVM;
|
|
49
|
+
export type AnnotationVM = import("./view-model.js").AnnotationVM;
|
|
50
|
+
export type HighlightVM = import("./view-model.js").HighlightVM;
|
|
51
|
+
export type FilterIndexVM = import("./view-model.js").FilterIndexVM;
|
|
52
|
+
export type PhaseVM = import("./view-model.js").PhaseVM;
|
|
53
|
+
export type WireGitLike = {
|
|
54
|
+
branch?: string | null;
|
|
55
|
+
remote?: string | null;
|
|
56
|
+
/**
|
|
57
|
+
* TS-drift author (transcript.ts)
|
|
58
|
+
*/
|
|
59
|
+
user?: string;
|
|
60
|
+
commits?: unknown[];
|
|
61
|
+
};
|
|
62
|
+
export type WireCommitLike = {
|
|
63
|
+
hash?: string;
|
|
64
|
+
message?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Go shape (metadata.go)
|
|
67
|
+
*/
|
|
68
|
+
authorName?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Go shape, Unix millis
|
|
71
|
+
*/
|
|
72
|
+
commitTime?: number;
|
|
73
|
+
/**
|
|
74
|
+
* TS-drift shape (transcript.ts)
|
|
75
|
+
*/
|
|
76
|
+
timestamp?: string;
|
|
77
|
+
/**
|
|
78
|
+
* TS-drift per-commit churn
|
|
79
|
+
*/
|
|
80
|
+
filesChanged?: number;
|
|
81
|
+
/**
|
|
82
|
+
* TS-drift per-commit churn
|
|
83
|
+
*/
|
|
84
|
+
insertions?: number;
|
|
85
|
+
/**
|
|
86
|
+
* TS-drift per-commit churn
|
|
87
|
+
*/
|
|
88
|
+
deletions?: number;
|
|
89
|
+
session?: boolean;
|
|
90
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/** @typedef {import('./wire-types.js').ToolCallDetail} ToolCallDetail */
|
|
2
|
+
/**
|
|
3
|
+
* The SOLE `JSON.parse` of a wire-encoded tool string in the lifted code. Every
|
|
4
|
+
* other parse helper here, the adapter, and the analytics util route through it,
|
|
5
|
+
* so a grep for `JSON.parse` of tool args/result yields exactly one hit. Returns
|
|
6
|
+
* `undefined` for empty or malformed input — callers degrade rather than throw.
|
|
7
|
+
*
|
|
8
|
+
* @param {string | undefined | null} raw
|
|
9
|
+
* @returns {unknown}
|
|
10
|
+
*/
|
|
11
|
+
export function parseJson(raw: string | undefined | null): unknown;
|
|
12
|
+
/**
|
|
13
|
+
* Parse a tool call's `arguments` JSON string. Thin named entry point over the
|
|
14
|
+
* one `parseJson` site; the cooked `ToolCallVM.args` is this value (shape varies
|
|
15
|
+
* by tool, hence `unknown`).
|
|
16
|
+
* @param {string | undefined | null} raw
|
|
17
|
+
* @returns {unknown}
|
|
18
|
+
*/
|
|
19
|
+
export function parseArgs(raw: string | undefined | null): unknown;
|
|
20
|
+
/**
|
|
21
|
+
* Parse a tool call's `result` JSON string. Thin named entry point over the one
|
|
22
|
+
* `parseJson` site; the cooked `ToolCallVM.output` is this value.
|
|
23
|
+
* @param {string | undefined | null} raw
|
|
24
|
+
* @returns {unknown}
|
|
25
|
+
*/
|
|
26
|
+
export function parseResult(raw: string | undefined | null): unknown;
|
|
27
|
+
/**
|
|
28
|
+
* Extract the file path a tool call targets, preferring the wire `filePath`
|
|
29
|
+
* field and falling back to the common `file_path` / `path` / `notebook_path`
|
|
30
|
+
* argument keys. Consolidates the THREE duplicate `extractPath` definitions
|
|
31
|
+
* (tasks.ts, FilesView.tsx, file-rollup.ts) into one.
|
|
32
|
+
* @param {ToolCallDetail} call
|
|
33
|
+
* @returns {string | undefined}
|
|
34
|
+
*/
|
|
35
|
+
export function extractPath(call: ToolCallDetail): string | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* One old→new replacement inside an Edit / MultiEdit / NotebookEdit call.
|
|
38
|
+
* @typedef {object} EditPair
|
|
39
|
+
* @property {string} old_string
|
|
40
|
+
* @property {string} new_string
|
|
41
|
+
*/
|
|
42
|
+
/**
|
|
43
|
+
* The list of old→new replacements for an edit-family tool call: the `edits[]`
|
|
44
|
+
* array for MultiEdit, else the single `old_string` / `new_string` pair. Used by
|
|
45
|
+
* BOTH the diff-hunk builder (adapter) and the churn counter (`countDiff`), so
|
|
46
|
+
* the argument shape is parsed in exactly one place.
|
|
47
|
+
* @param {ToolCallDetail} call
|
|
48
|
+
* @returns {EditPair[]}
|
|
49
|
+
*/
|
|
50
|
+
export function editPairs(call: ToolCallDetail): EditPair[];
|
|
51
|
+
/**
|
|
52
|
+
* The full-file body a Write tool call lays down (its `content` argument).
|
|
53
|
+
* @param {ToolCallDetail} call
|
|
54
|
+
* @returns {string}
|
|
55
|
+
*/
|
|
56
|
+
export function writeContent(call: ToolCallDetail): string;
|
|
57
|
+
/**
|
|
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.
|
|
61
|
+
* @param {ToolCallDetail} call
|
|
62
|
+
* @returns {{ adds: number, dels: number }}
|
|
63
|
+
*/
|
|
64
|
+
export function countDiff(call: ToolCallDetail): {
|
|
65
|
+
adds: number;
|
|
66
|
+
dels: number;
|
|
67
|
+
};
|
|
68
|
+
export type ToolCallDetail = import("./wire-types.js").ToolCallDetail;
|
|
69
|
+
/**
|
|
70
|
+
* One old→new replacement inside an Edit / MultiEdit / NotebookEdit call.
|
|
71
|
+
*/
|
|
72
|
+
export type EditPair = {
|
|
73
|
+
old_string: string;
|
|
74
|
+
new_string: string;
|
|
75
|
+
};
|