@peasant-labs/fairtrade 0.0.18 → 0.0.19

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, E as a, F as o, G as s, H as c, I as l, J as u, K as d, L as f, M as p, N as m, O as h, P as g, Q as _, R as v, S as y, T as b, U as x, V as S, W as C, X as w, Y as T, Z as E, _ as D, a as O, at as k, b as A, c as j, et as M, f as ee, g as N, h as P, ht as F, i as I, it as te, j as ne, k as re, m as ie, n as ae, nt as oe, o as se, ot as ce, pt as le, q as ue, r as de, rt as fe, s as pe, t as me, tt as he, ut as ge, v as L, w as _e, x as ve, xt as ye, y as be, z as xe } from "./GraphLegend-D9bZVLfT.js";
1
+ import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as u, K as d, L as f, M as p, N as m, O as h, P as g, Q as _, R as v, S as y, T as b, U as x, V as S, W as C, X as w, Y as T, Z as E, _ as D, a as O, at as k, b as A, c as j, et as M, f as ee, g as N, h as P, ht as F, i as I, it as te, j as ne, k as re, m as ie, n as ae, nt as oe, o as se, ot as ce, pt as le, q as ue, r as de, rt as fe, s as pe, t as me, tt as he, ut as ge, v as L, w as _e, x as ve, xt as ye, y as be, z as xe } from "./GraphLegend-BB0V2w59.js";
2
2
  import { memo as Se, useCallback as R, useEffect as z, useMemo as B, useRef as V, useState as H } from "react";
3
3
  import { Fragment as Ce, jsx as U, jsxs as W } from "react/jsx-runtime";
4
4
  import { Box as we, Check as Te, ChevronDown as Ee, ChevronRight as G, Coins as De, CornerDownRight as Oe, FileCode as ke, FileDiff as Ae, FileText as je, Folder as Me, GitMerge as Ne, Hash as Pe, Map as Fe, Maximize2 as Ie, MessageSquare as Le, Minus as Re, Plus as ze, RotateCcw as Be, RotateCw as Ve, Search as He, Share2 as Ue, Tag as We, TriangleAlert as Ge, X as Ke } from "lucide-react";
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * resolve any accepted name/alias to a canonical mark key, or null when unknown.
3
3
  * @param {string} name
4
- * @returns {('claude'|'gemini'|'openai'|'cursor'|'opencode'|'strike')|null}
4
+ * @returns {('claude'|'gemini'|'openai'|'cursor'|'opencode'|'strike'|'pi')|null}
5
5
  */
6
- export function resolveBrand(name: string): ("claude" | "gemini" | "openai" | "cursor" | "opencode" | "strike") | null;
6
+ export function resolveBrand(name: string): ("claude" | "gemini" | "openai" | "cursor" | "opencode" | "strike" | "pi") | null;
7
7
  /**
8
8
  * BrandMark - a single-color, currentColor-tinted company/provider logo.
9
9
  *
@@ -4,4 +4,4 @@
4
4
  export function formatProvider(provider: unknown): string;
5
5
  /** @param {import('@peasant-labs/schema').Harness} provider */
6
6
  export function providerLabel(provider: import("@peasant-labs/schema").Harness): string;
7
- export const PROVIDER_LABEL: Readonly<Record<"strike" | "cursor" | "claude-code" | "gemini-cli" | "codex" | "opencode" | "antigravity", string>>;
7
+ export const PROVIDER_LABEL: Readonly<Record<"strike" | "cursor" | "claude-code" | "gemini-cli" | "codex" | "opencode" | "antigravity" | "pi", string>>;
@@ -12,7 +12,7 @@ export function providerBrand(harness: Harness): ProviderBrand;
12
12
  /** @param {Harness} harness @returns {ProviderAccent} */
13
13
  export function providerAccent(harness: Harness): ProviderAccent;
14
14
  /** @typedef {import('@peasant-labs/schema').Harness} Harness */
15
- /** @typedef {'claude'|'gemini'|'openai'|'opencode'|'cursor'|'strike'} ProviderBrand */
15
+ /** @typedef {'claude'|'gemini'|'openai'|'opencode'|'cursor'|'strike'|'pi'} ProviderBrand */
16
16
  /** @typedef {'amber'|'teal'|'olive'|'mauve'|'clay'} ProviderAccent */
17
17
  /** @type {readonly Harness[]} */
18
18
  export const PROVIDER_HARNESSES: readonly Harness[];
@@ -23,5 +23,5 @@ export const PROVIDER_BRANDS: Readonly<Record<Harness, ProviderBrand>>;
23
23
  /** @type {Readonly<Record<Harness, ProviderAccent>>} */
24
24
  export const PROVIDER_ACCENTS: Readonly<Record<Harness, ProviderAccent>>;
25
25
  export type Harness = import("@peasant-labs/schema").Harness;
26
- export type ProviderBrand = "claude" | "gemini" | "openai" | "opencode" | "cursor" | "strike";
26
+ export type ProviderBrand = "claude" | "gemini" | "openai" | "opencode" | "cursor" | "strike" | "pi";
27
27
  export type ProviderAccent = "amber" | "teal" | "olive" | "mauve" | "clay";
@@ -0,0 +1,8 @@
1
+ /** @param {{usage?: import('@peasant-labs/schema').UsageDetail}} props */
2
+ export default function UsageDisclosure({ usage }: {
3
+ usage?: import("@peasant-labs/schema").UsageDetail;
4
+ }): import("react").JSX.Element;
5
+ /** @param {{scopes?: import('./view-model.js').UsageScopeVM[]}} props */
6
+ export function UsageScopes({ scopes }: {
7
+ scopes?: import("./view-model.js").UsageScopeVM[];
8
+ }): import("react").JSX.Element;
@@ -9,8 +9,7 @@
9
9
  /**
10
10
  * A "task" is the span from a top-level user prompt up to (but not including)
11
11
  * the next one — one turn of human↔agent collaboration. The shape is the
12
- * canonical `TaskGroup` the transcript-browser already exports, kept stable for
13
- * back-compat re-export.
12
+ * canonical `TaskGroup` shape, kept stable for consumer back-compat.
14
13
  * @typedef {object} TaskGroup
15
14
  * @property {number} startIndex display position of the starting prompt
16
15
  * @property {number} endIndex display position of the last turn (inclusive)
@@ -123,8 +122,7 @@ export type TranscriptAnalyticsVM = import("./view-model.js").TranscriptAnalytic
123
122
  /**
124
123
  * A "task" is the span from a top-level user prompt up to (but not including)
125
124
  * the next one — one turn of human↔agent collaboration. The shape is the
126
- * canonical `TaskGroup` the transcript-browser already exports, kept stable for
127
- * back-compat re-export.
125
+ * canonical `TaskGroup` shape, kept stable for consumer back-compat.
128
126
  */
129
127
  export type TaskGroup = {
130
128
  /**
@@ -176,8 +174,7 @@ export type PersonalMedians = {
176
174
  };
177
175
  /**
178
176
  * A session sample for personal-median computation — the QualitySession subset
179
- * the medians read. Kept structural so the transcript-browser `QualitySession`
180
- * is assignable for back-compat.
177
+ * the medians read. Kept structural for consumer back-compat.
181
178
  */
182
179
  export type PersonalMedianSession = {
183
180
  totalTokens: number;
@@ -91,7 +91,8 @@ export type ViewerCallbacks = {
91
91
  /**
92
92
  * What the `graphSlot` render-prop receives. The composite owns NO graph engine
93
93
  * (no `@xyflow` dependency); in `viewMode: 'graph'` it hands the consumer this
94
- * cooked context and renders whatever the consumer returns (transcript-browser plugs its
94
+ * cooked context and renders whatever the consumer returns (a consuming app plugs
95
+ * fairtrade's own `/graph`
95
96
  */
96
97
  export type GraphSlotContext = {
97
98
  viewModel: import("./view-model.js").TranscriptViewModel;
@@ -0,0 +1,19 @@
1
+ /** @param {import('@peasant-labs/schema').TurnDetail[]} turns
2
+ * @returns {import('./view-model.js').UsageScopeVM[]} */
3
+ export function aggregateUsage(turns: import("@peasant-labs/schema").TurnDetail[]): import("./view-model.js").UsageScopeVM[];
4
+ export const TOKEN_FIELDS: Readonly<{
5
+ input: "input";
6
+ output: "output";
7
+ cacheRead: "cache read";
8
+ cacheWrite: "cache write";
9
+ cacheWrite1h: "cache write 1h (subset)";
10
+ reasoning: "reasoning (subset)";
11
+ totalTokens: "total tokens";
12
+ }>;
13
+ export const COST_FIELDS: Readonly<{
14
+ input: "input";
15
+ output: "output";
16
+ cacheRead: "cache read";
17
+ cacheWrite: "cache write";
18
+ total: "total";
19
+ }>;
@@ -206,6 +206,10 @@ export type ToolCallVM = {
206
206
  * display name (e.g. "Read", "Bash")
207
207
  */
208
208
  name: string;
209
+ /**
210
+ * separately recorded namespace; empty string remains present evidence
211
+ */
212
+ namespace?: string;
209
213
  kind: import("./wire-types.js").ToolCallKind;
210
214
  /**
211
215
  * filters-rail grouping
@@ -227,6 +231,18 @@ export type ToolCallVM = {
227
231
  durationMs?: number;
228
232
  exitCode?: number;
229
233
  isError?: boolean;
234
+ /**
235
+ * validated owner evidence; cost strings remain verbatim
236
+ */
237
+ usage?: import("@peasant-labs/schema").UsageDetail;
238
+ /**
239
+ * attached structured details, excluded from conversation/search
240
+ */
241
+ nativeMetadata?: import("@peasant-labs/schema").NativeMetadataRecord[];
242
+ /**
243
+ * no recorded result; never a fabricated success
244
+ */
245
+ pending?: boolean;
230
246
  /**
231
247
  * present for edit/write kinds
232
248
  */
@@ -284,6 +300,7 @@ export type TurnVM = {
284
300
  */
285
301
  agentName?: string;
286
302
  thinking?: ThinkingVM;
303
+ usage?: import("@peasant-labs/schema").UsageDetail;
287
304
  toolCalls: ToolCallVM[];
288
305
  entryType?: import("./wire-types.js").EntryType;
289
306
  stopReason?: import("./wire-types.js").StopReason | null;
@@ -590,4 +607,26 @@ export type TranscriptViewModel = {
590
607
  * render-when-present
591
608
  */
592
609
  analytics?: TranscriptAnalyticsVM;
610
+ /**
611
+ * non-conversational, including unattached records
612
+ */
613
+ nativeMetadata?: import("@peasant-labs/schema").NativeMetadataRecord[];
614
+ /**
615
+ * complete owner universe, before visible-turn filtering
616
+ */
617
+ usageScopes?: UsageScopeVM[];
618
+ };
619
+ export type UsageFieldVM = {
620
+ label: string;
621
+ /**
622
+ * exact known sum or unknown
623
+ */
624
+ value: string;
625
+ completeness: import("@peasant-labs/schema").UsageCompleteness;
626
+ };
627
+ export type UsageScopeVM = {
628
+ scope: import("@peasant-labs/schema").UsageScope;
629
+ ownerCount: number;
630
+ tokens: UsageFieldVM[];
631
+ cost: UsageFieldVM[];
593
632
  };