@peasant-labs/fairtrade 0.0.15 → 0.0.17
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.
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @param {object} props
|
|
3
3
|
* @param {boolean} [props.checked]
|
|
4
|
+
* @param {boolean} [props.indeterminate] render the tri-state 'mixed' box (some children on)
|
|
4
5
|
* @param {Function} [props.onChange] fired with the native change event
|
|
5
6
|
* @param {*} [props.children] the row label (text, or icon + text)
|
|
6
7
|
* @param {number} [props.count] optional trailing match count
|
|
7
8
|
* @param {boolean} [props.disabled]
|
|
8
9
|
*/
|
|
9
|
-
export default function CheckRow({ checked, onChange, children, count, disabled }: {
|
|
10
|
+
export default function CheckRow({ checked, indeterminate, onChange, children, count, disabled }: {
|
|
10
11
|
checked?: boolean;
|
|
12
|
+
indeterminate?: boolean;
|
|
11
13
|
onChange?: Function;
|
|
12
14
|
children?: any;
|
|
13
15
|
count?: number;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/** @typedef {import('./view-model.js').TurnVM} TurnVM */
|
|
2
|
+
/** @typedef {import('./view-model.js').ToolGroup} ToolGroup */
|
|
3
|
+
/** @typedef {import('./state-capabilities.js').TranscriptFilters} TranscriptFilters */
|
|
4
|
+
/** @typedef {'prompts' | 'responses' | 'thinking' | 'toolcalls'} Category */
|
|
5
|
+
/**
|
|
6
|
+
* Every part kind a cooked turn carries, in rail order. Empty for turns no
|
|
7
|
+
* category governs (system notices). A turn with text and tool calls reports
|
|
8
|
+
* both; the rail badges count turns per kind from this.
|
|
9
|
+
*
|
|
10
|
+
* @param {TurnVM} turn
|
|
11
|
+
* @returns {Category[]}
|
|
12
|
+
*/
|
|
13
|
+
export function kindsOf(turn: TurnVM): Category[];
|
|
14
|
+
/**
|
|
15
|
+
* Semantic tags NARROW: with none checked every turn passes; with one or more
|
|
16
|
+
* checked a turn must carry at least one of them. `annotationsByTurn` is the
|
|
17
|
+
* adapter's index (`vm.filterIndex.annotationsByTurn`).
|
|
18
|
+
*
|
|
19
|
+
* @param {TurnVM} turn
|
|
20
|
+
* @param {{ errors?: boolean, retries?: boolean, revert?: boolean }} tags
|
|
21
|
+
* @param {Record<number, {kind?: string}[]>} annotationsByTurn
|
|
22
|
+
*/
|
|
23
|
+
export function passesTags(turn: TurnVM, tags: {
|
|
24
|
+
errors?: boolean;
|
|
25
|
+
retries?: boolean;
|
|
26
|
+
revert?: boolean;
|
|
27
|
+
}, annotationsByTurn: Record<number, {
|
|
28
|
+
kind?: string;
|
|
29
|
+
}[]>): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* The per-turn projection: the turn with every hidden part removed, or `null`
|
|
32
|
+
* when nothing would be left to render. Tags narrow at the turn level, the
|
|
33
|
+
* checkpoint anchor scopes to a prefix, and then each part is kept or dropped
|
|
34
|
+
* by its own category (tool calls also by their group). System turns carry no
|
|
35
|
+
* governed parts and pass the category stage untouched.
|
|
36
|
+
*
|
|
37
|
+
* The returned object keeps `index`, `role`, labels and annotations, so
|
|
38
|
+
* anchors, jumps and the outline resolve against it exactly as against the
|
|
39
|
+
* original; only `content`, `thinking` and `toolCalls` change.
|
|
40
|
+
*
|
|
41
|
+
* @param {TurnVM} turn
|
|
42
|
+
* @param {TranscriptFilters} filters
|
|
43
|
+
* @param {object} [ctx]
|
|
44
|
+
* @param {Record<number, {kind?: string}[]>} [ctx.annotationsByTurn]
|
|
45
|
+
* @param {number | null} [ctx.checkpointTurn] inclusive upper turn index, or null
|
|
46
|
+
* @returns {TurnVM | null}
|
|
47
|
+
*/
|
|
48
|
+
export function projectTurn(turn: TurnVM, filters: TranscriptFilters, ctx?: {
|
|
49
|
+
annotationsByTurn?: Record<number, {
|
|
50
|
+
kind?: string;
|
|
51
|
+
}[]>;
|
|
52
|
+
checkpointTurn?: number | null;
|
|
53
|
+
}): TurnVM | null;
|
|
54
|
+
/**
|
|
55
|
+
* Whether any part of the turn survives the filters. Equivalent to
|
|
56
|
+
* `projectTurn(...) !== null`; kept as the yes/no form for callers that only
|
|
57
|
+
* need membership.
|
|
58
|
+
*
|
|
59
|
+
* @param {TurnVM} turn
|
|
60
|
+
* @param {TranscriptFilters} filters
|
|
61
|
+
* @param {Parameters<typeof projectTurn>[2]} [ctx]
|
|
62
|
+
* @returns {boolean}
|
|
63
|
+
*/
|
|
64
|
+
export function matchesFilters(turn: TurnVM, filters: TranscriptFilters, ctx?: Parameters<typeof projectTurn>[2]): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Turn-based category counts for the rail badges: each badge counts the turns
|
|
67
|
+
* that carry its part kind. A turn with text and tool calls is counted under
|
|
68
|
+
* both, so the badges can sum to more than the turn count; each promises
|
|
69
|
+
* "this many turns contain this".
|
|
70
|
+
* (The previous `toolcalls` badge counted tool CALLS, which only coincidentally
|
|
71
|
+
* matches the turn count when every turn carries exactly one.)
|
|
72
|
+
*
|
|
73
|
+
* @param {TurnVM[]} turns
|
|
74
|
+
* @returns {Record<Category, number>}
|
|
75
|
+
*/
|
|
76
|
+
export function categoryCounts(turns: TurnVM[]): Record<Category, number>;
|
|
77
|
+
/**
|
|
78
|
+
* Tri-state for the `tool calls` umbrella: `true` when every group with matches
|
|
79
|
+
* is on, `false` when all are off, `'mixed'` otherwise. Groups with a zero count
|
|
80
|
+
* are IGNORED — the rail disables them, so a permanently-unreachable group must
|
|
81
|
+
* not hold the umbrella in a mixed state the user cannot resolve.
|
|
82
|
+
*
|
|
83
|
+
* @param {Partial<Record<ToolGroup, boolean>>} toolGroups
|
|
84
|
+
* @param {Partial<Record<ToolGroup, number>>} [counts]
|
|
85
|
+
* @returns {true | false | 'mixed'}
|
|
86
|
+
*/
|
|
87
|
+
export function toolGroupsState(toolGroups: Partial<Record<ToolGroup, boolean>>, counts?: Partial<Record<ToolGroup, number>>): true | false | "mixed";
|
|
88
|
+
/**
|
|
89
|
+
* The umbrella cascade: setting `tool calls` writes every selectable group to
|
|
90
|
+
* match. Groups with no matches are written too, so re-checking the umbrella
|
|
91
|
+
* cannot leave a hidden `false` behind that would suppress a group the moment a
|
|
92
|
+
* different session gives it matches.
|
|
93
|
+
*
|
|
94
|
+
* @param {boolean} next
|
|
95
|
+
* @returns {Record<ToolGroup, boolean>}
|
|
96
|
+
*/
|
|
97
|
+
export function cascadeToolGroups(next: boolean): Record<ToolGroup, boolean>;
|
|
98
|
+
/**
|
|
99
|
+
* Toggling ONE group re-derives the umbrella, so the pair is never contradictory
|
|
100
|
+
* (all seven off while `tool calls` still reads checked). Unchecking the last
|
|
101
|
+
* live group turns the umbrella off; checking any group turns it back on.
|
|
102
|
+
*
|
|
103
|
+
* A state whose umbrella is already off is normalised first: every group is
|
|
104
|
+
* treated as off, whatever the map says. That covers filter state persisted by
|
|
105
|
+
* a consumer before the cascade existed (`toolcalls: false` over an all-true
|
|
106
|
+
* map), where the rail shows every child unchecked and the user's click on ONE
|
|
107
|
+
* child must enable that one, not the other six.
|
|
108
|
+
*
|
|
109
|
+
* @param {TranscriptFilters} filters
|
|
110
|
+
* @param {ToolGroup} id
|
|
111
|
+
* @param {Partial<Record<ToolGroup, number>>} [counts]
|
|
112
|
+
* @returns {TranscriptFilters}
|
|
113
|
+
*/
|
|
114
|
+
export function toggleToolGroup(filters: TranscriptFilters, id: ToolGroup, counts?: Partial<Record<ToolGroup, number>>): TranscriptFilters;
|
|
115
|
+
/**
|
|
116
|
+
* Setting the umbrella cascades to the groups in the same update, so the rail
|
|
117
|
+
* never renders a checked child under an unchecked parent.
|
|
118
|
+
*
|
|
119
|
+
* @param {TranscriptFilters} filters
|
|
120
|
+
* @param {boolean} next
|
|
121
|
+
* @returns {TranscriptFilters}
|
|
122
|
+
*/
|
|
123
|
+
export function setToolCalls(filters: TranscriptFilters, next: boolean): TranscriptFilters;
|
|
124
|
+
export type TurnVM = import("./view-model.js").TurnVM;
|
|
125
|
+
export type ToolGroup = import("./view-model.js").ToolGroup;
|
|
126
|
+
export type TranscriptFilters = import("./state-capabilities.js").TranscriptFilters;
|
|
127
|
+
export type Category = "prompts" | "responses" | "thinking" | "toolcalls";
|