@tangle-network/agent-app 0.60.231 → 0.60.233
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/assistant/index.js +8 -8
- package/dist/chat-react/index.js +4 -4
- package/dist/chat-routes/index.js +6 -8
- package/dist/chat-routes/index.js.map +1 -1
- package/dist/{chunk-5IS3GCMR.js → chunk-232KA6MR.js} +3 -3
- package/dist/{chunk-KMIDRUUH.js → chunk-35APKGPB.js} +2 -2
- package/dist/{chunk-GNBBY3KN.js → chunk-3K45OQ5X.js} +3 -3
- package/dist/{chunk-A3CUVYRZ.js → chunk-4JAXSEYW.js} +3 -3
- package/dist/{chunk-BKVDPMFD.js → chunk-BBYUWYEL.js} +2 -2
- package/dist/{chunk-DA5XLDZR.js → chunk-BNFUJNPS.js} +4 -4
- package/dist/{chunk-7QZNHBQT.js → chunk-DUGIVKNA.js} +215 -2
- package/dist/chunk-DUGIVKNA.js.map +1 -0
- package/dist/{chunk-J63KUZBE.js → chunk-F5FFOIS5.js} +6 -3
- package/dist/chunk-F5FFOIS5.js.map +1 -0
- package/dist/{chunk-BQILMP73.js → chunk-FJEGGUOQ.js} +2 -2
- package/dist/{chunk-TEIKC276.js → chunk-GMC5DO2O.js} +3 -3
- package/dist/{chunk-HEPEGY6Q.js → chunk-JYVUFRRV.js} +2 -2
- package/dist/{chunk-JILHXHJE.js → chunk-K7SKQ7GY.js} +2 -2
- package/dist/{chunk-RMPPWNW7.js → chunk-MX3RI3MO.js} +6 -10
- package/dist/{chunk-RMPPWNW7.js.map → chunk-MX3RI3MO.js.map} +1 -1
- package/dist/{chunk-XG6FODYO.js → chunk-XIN7DOAB.js} +108 -100
- package/dist/chunk-XIN7DOAB.js.map +1 -0
- package/dist/{mention-editor-NOS5R3AU.js → mention-editor-6FJ6HRSN.js} +2 -2
- package/dist/public-consultation/index.d.ts +1 -1
- package/dist/public-consultation/index.js +2 -4
- package/dist/public-consultation/index.js.map +1 -1
- package/dist/runtime/index.js +4 -5
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/router-turn.js +3 -4
- package/dist/sandbox/index.js +3 -3
- package/dist/settings-react/index.js +1 -1
- package/dist/studio-react/index.js +2 -2
- package/dist/turn-trace/index.js +8 -12
- package/dist/web-react/agent-profile-editor.js +4 -4
- package/dist/web-react/control-glyphs.d.ts +20 -0
- package/dist/web-react/controls.d.ts +6 -358
- package/dist/web-react/effort-picker.d.ts +98 -0
- package/dist/web-react/index.js +8 -8
- package/dist/web-react/model-picker.d.ts +67 -0
- package/dist/web-react/picker-presentation.d.ts +89 -0
- package/dist/web-react/popover-surface.d.ts +89 -0
- package/dist/web-react/use-pending.d.ts +11 -0
- package/dist/workspace-react/index.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-7QZNHBQT.js.map +0 -1
- package/dist/chunk-J63KUZBE.js.map +0 -1
- package/dist/chunk-LHGYK5I3.js +0 -160
- package/dist/chunk-LHGYK5I3.js.map +0 -1
- package/dist/chunk-PIUYJTTK.js +0 -63
- package/dist/chunk-PIUYJTTK.js.map +0 -1
- package/dist/chunk-XG6FODYO.js.map +0 -1
- /package/dist/{chunk-5IS3GCMR.js.map → chunk-232KA6MR.js.map} +0 -0
- /package/dist/{chunk-KMIDRUUH.js.map → chunk-35APKGPB.js.map} +0 -0
- /package/dist/{chunk-GNBBY3KN.js.map → chunk-3K45OQ5X.js.map} +0 -0
- /package/dist/{chunk-A3CUVYRZ.js.map → chunk-4JAXSEYW.js.map} +0 -0
- /package/dist/{chunk-BKVDPMFD.js.map → chunk-BBYUWYEL.js.map} +0 -0
- /package/dist/{chunk-DA5XLDZR.js.map → chunk-BNFUJNPS.js.map} +0 -0
- /package/dist/{chunk-BQILMP73.js.map → chunk-FJEGGUOQ.js.map} +0 -0
- /package/dist/{chunk-TEIKC276.js.map → chunk-GMC5DO2O.js.map} +0 -0
- /package/dist/{chunk-HEPEGY6Q.js.map → chunk-JYVUFRRV.js.map} +0 -0
- /package/dist/{chunk-JILHXHJE.js.map → chunk-K7SKQ7GY.js.map} +0 -0
- /package/dist/{mention-editor-NOS5R3AU.js.map → mention-editor-6FJ6HRSN.js.map} +0 -0
|
@@ -9,361 +9,9 @@
|
|
|
9
9
|
* Styling contract matches the rest of `web-react`: Tailwind classes against the
|
|
10
10
|
* shared design tokens; the glyphs are inline SVGs, no icon-library dependency.
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
* dependency, so the thinking glyph follows the same pattern as the rest of
|
|
19
|
-
* this set. */
|
|
20
|
-
export declare function BrainGlyph({ className }: {
|
|
21
|
-
className?: string;
|
|
22
|
-
}): import("react").JSX.Element;
|
|
23
|
-
/** lucide `check` — the selected-row mark in the picker menus. */
|
|
24
|
-
export declare function CheckGlyph({ className }: {
|
|
25
|
-
className?: string;
|
|
26
|
-
}): import("react").JSX.Element;
|
|
27
|
-
/**
|
|
28
|
-
* Keyboard + pointer model for a trigger-and-popover pair, dependency-free.
|
|
29
|
-
* Outside-mousedown and Escape both close; Escape also returns focus to the
|
|
30
|
-
* trigger so keyboard users aren't dropped at the top of the document. The
|
|
31
|
-
* returned `triggerProps` carry the ARIA contract (`aria-haspopup`/
|
|
32
|
-
* `aria-expanded`); spread them onto the trigger button.
|
|
33
|
-
*
|
|
34
|
-
* `panelRef` belongs to the popover panel and MUST be wired when the panel is
|
|
35
|
-
* rendered through {@link PopoverSurface}: a portaled panel is not inside
|
|
36
|
-
* `containerRef`, so a container-only outside test reads every click on the
|
|
37
|
-
* menu's own rows as an outside click and closes before the row's handler runs.
|
|
38
|
-
*/
|
|
39
|
-
export declare function usePopover(open: boolean, setOpen: (open: boolean) => void): {
|
|
40
|
-
containerRef: RefObject<HTMLDivElement | null>;
|
|
41
|
-
triggerRef: RefObject<HTMLButtonElement | null>;
|
|
42
|
-
panelRef: RefObject<HTMLDivElement | null>;
|
|
43
|
-
triggerProps: {
|
|
44
|
-
ref: RefObject<HTMLButtonElement | null>;
|
|
45
|
-
'aria-haspopup': true;
|
|
46
|
-
'aria-expanded': boolean;
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Marks the portaled panel in the DOM. Products and audits (see
|
|
51
|
-
* `playground/scripts/popover-hit-test.mjs`) select on this rather than on a
|
|
52
|
-
* Tailwind class, which is presentation and free to change.
|
|
53
|
-
*
|
|
54
|
-
* Its VALUE is the surface's ancestor path (`outer/inner`), which is what
|
|
55
|
-
* restores "is this click inside my popover" after the portal flattens two
|
|
56
|
-
* nested panels into two siblings of `<body>`.
|
|
57
|
-
*/
|
|
58
|
-
export declare const POPOVER_SURFACE_ATTR = "data-agent-app-popover";
|
|
59
|
-
/**
|
|
60
|
-
* `PopoverSurface` is now mounted (closed) inside every server-rendered
|
|
61
|
-
* composer, so its hooks run on the server once per composer per request.
|
|
62
|
-
* React 18 logs "useLayoutEffect does nothing on the server" for that; React 19
|
|
63
|
-
* does not (measured silent on react-dom 19.2.8). The peer floor is `react >=18`,
|
|
64
|
-
* so bind the synchronous hook only where there is a DOM and the effect hook
|
|
65
|
-
* elsewhere — placement never runs on the server either way.
|
|
66
|
-
*/
|
|
67
|
-
export declare const useBrowserLayoutEffect: typeof useLayoutEffect;
|
|
68
|
-
export interface PopoverSurfaceProps {
|
|
69
|
-
open: boolean;
|
|
70
|
-
/** The trigger the panel anchors to — `usePopover`'s `triggerRef`. */
|
|
71
|
-
triggerRef: RefObject<HTMLElement | null>;
|
|
72
|
-
/** `usePopover`'s `panelRef`; also what the outside-click test consults. */
|
|
73
|
-
panelRef: RefObject<HTMLDivElement | null>;
|
|
74
|
-
/** Presentation classes. Placement and elevation are owned here — a caller
|
|
75
|
-
* must not pass `absolute`/`fixed`/`top-*`/`bottom-*`/`z-*`. */
|
|
76
|
-
className?: string;
|
|
77
|
-
role?: string;
|
|
78
|
-
id?: string;
|
|
79
|
-
'aria-label'?: string;
|
|
80
|
-
/** Make the panel at least as wide as its trigger. A portaled panel has no
|
|
81
|
-
* `w-full` to inherit — the trigger is no longer its offset parent — so a
|
|
82
|
-
* menu that used to stretch to a full-width trigger declares it here. */
|
|
83
|
-
matchTriggerWidth?: boolean;
|
|
84
|
-
/** Preferred side. `above` suits controls docked at the bottom of a composer;
|
|
85
|
-
* `below` suits headers, rows, and rails. Either flips when the other side has more room. */
|
|
86
|
-
side?: 'above' | 'below';
|
|
87
|
-
/** Which trigger edge the panel lines up with. `end` keeps a row's trailing menu over the row. */
|
|
88
|
-
align?: 'start' | 'end';
|
|
89
|
-
/** Opt in to remeasurement when asynchronous or filtered content changes. */
|
|
90
|
-
contentKey?: unknown;
|
|
91
|
-
children: ReactNode;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* The floating panel every canonical picker opens.
|
|
95
|
-
*
|
|
96
|
-
* It renders through a PORTAL to `document.body` and anchors itself to the
|
|
97
|
-
* trigger in viewport coordinates, because an in-place `absolute` panel's
|
|
98
|
-
* visibility is decided by markup this package does not own. Measured in
|
|
99
|
-
* production: the shipped chat composer docks these controls inside a
|
|
100
|
-
* horizontally scrolling rail (`overflow-x-auto`), and a scroll container
|
|
101
|
-
* clips every positioned descendant whose containing block sits inside it —
|
|
102
|
-
* so a correct 420x457 menu with correct coordinates painted zero pixels and
|
|
103
|
-
* could not be clicked. An ancestor `transform`/`filter`/`contain` would trap
|
|
104
|
-
* it the same way through the stacking context instead of the clip. Leaving
|
|
105
|
-
* the DOM subtree is the only placement a host cannot re-break.
|
|
106
|
-
*
|
|
107
|
-
* Placement prefers ABOVE the trigger (these controls dock at the bottom of a
|
|
108
|
-
* composer), flips below when there is more room there, clamps horizontally
|
|
109
|
-
* into the viewport, and caps its own height to the space on the chosen side.
|
|
110
|
-
* The panel is `visibility: hidden` for the measure pass so it never paints at
|
|
111
|
-
* the pre-placement origin.
|
|
112
|
-
*/
|
|
113
|
-
export declare function PopoverSurface({ open, triggerRef, panelRef, className, role, id, 'aria-label': ariaLabel, matchTriggerWidth, side, align, contentKey, children, }: PopoverSurfaceProps): import("react").ReactPortal | null;
|
|
114
|
-
/**
|
|
115
|
-
* Focus treatment for a row inside a popover panel.
|
|
116
|
-
*
|
|
117
|
-
* The ring itself now comes from the `:focus-visible` floor in tokens.css, so
|
|
118
|
-
* this no longer restates a width or a colour. What it still has to say is
|
|
119
|
-
* WHERE the ring is drawn: a popover option is a full-width row inside a panel
|
|
120
|
-
* that clips its own corners (`overflow-hidden rounded-xl`), and an outward
|
|
121
|
-
* ring on the first or last row is clipped away by that panel. Pulling the
|
|
122
|
-
* offset negative draws the same ring just inside the row instead.
|
|
123
|
-
*/
|
|
124
|
-
export declare const POPOVER_OPTION_FOCUS = "focus-visible:[outline-offset:-2px]";
|
|
125
|
-
/**
|
|
126
|
-
* The one overlay elevation for floating surfaces — picker menus, popovers,
|
|
127
|
-
* drawers, modals. Reads the theme's `--shadow-overlay` token, so every overlay
|
|
128
|
-
* lifts with the same shadow and re-themes from one source. The floating
|
|
129
|
-
* composer uses the quieter `shadow-raised` rung instead.
|
|
130
|
-
*
|
|
131
|
-
* Written as an arbitrary value rather than the preset's `shadow-overlay`
|
|
132
|
-
* utility, because that utility only exists where the preset is part of the
|
|
133
|
-
* Tailwind build. A host that gets its tokens through a precompiled bundle —
|
|
134
|
-
* `@tangle-network/sandbox-ui` ships brand's tokens inlined, with no `@theme`
|
|
135
|
-
* block surviving the compile — receives `--shadow-overlay` as a plain custom
|
|
136
|
-
* property, from which no `shadow-overlay` utility can be generated, and these
|
|
137
|
-
* surfaces render flat. The arbitrary form emits from the class alone and works
|
|
138
|
-
* either way.
|
|
139
|
-
*/
|
|
140
|
-
export declare const OVERLAY_SHADOW = "shadow-[var(--shadow-overlay)]";
|
|
141
|
-
/**
|
|
142
|
-
* Root geometry for a picker — the box that holds the trigger — in one place
|
|
143
|
-
* because every picker in this family has to agree on it.
|
|
144
|
-
*
|
|
145
|
-
* Shrink-wrapping (`inline-flex`) is the default: these controls dock on a
|
|
146
|
-
* composer row where an expanding pill shoves its neighbours around. A STACKED
|
|
147
|
-
* panel wants the opposite — the compact `AgentSessionControls` gear popover
|
|
148
|
-
* lays its controls out in a column, and a shrink-wrapped root there makes a
|
|
149
|
-
* trigger's own `w-full` a no-op, since it fills a box the trigger itself
|
|
150
|
-
* sized. That is what left Agent backend short of the panel edge and Thinking
|
|
151
|
-
* narrower still.
|
|
152
|
-
*
|
|
153
|
-
* The panel is portaled ({@link PopoverSurface}), so widening the root widens
|
|
154
|
-
* the TRIGGER only. A menu that should follow it declares `matchTriggerWidth`.
|
|
155
|
-
*/
|
|
156
|
-
export declare function pickerRootClass(fullWidth: boolean): string;
|
|
157
|
-
/**
|
|
158
|
-
* How a picker's TRIGGER is drawn. The menu it opens is the same either way.
|
|
159
|
-
*
|
|
160
|
-
* - `chip` (default): the 32px bordered pill — `rounded-full border
|
|
161
|
-
* border-border bg-card font-medium`, on the composer row's height.
|
|
162
|
-
* - `quiet`: a 32px borderless text button (the control scale's sm, the
|
|
163
|
-
* composer row's one height) — muted label, small glyph, a
|
|
164
|
-
* surface fill on hover and while the menu is open, nothing else. For a
|
|
165
|
-
* composer whose card already draws the border: three pills docked under
|
|
166
|
-
* the input there read as three more cards, not as the input's controls.
|
|
167
|
-
* - `field`: a full-width form field — the same height, radius, border,
|
|
168
|
-
* well, and focus treatment as a text input at `--control-height`. For a
|
|
169
|
-
* settings form, where a pill among inputs reads as a different control.
|
|
170
|
-
*/
|
|
171
|
-
export type PickerVariant = 'chip' | 'quiet' | 'field';
|
|
172
|
-
/**
|
|
173
|
-
* Trigger classes for a `field` picker: `@tangle-network/ui`'s own field
|
|
174
|
-
* presentation and `md` field size, the classes its `Input` and `SelectTrigger`
|
|
175
|
-
* draw, so a model, harness or timezone selector sits in a form as one more
|
|
176
|
-
* field — the same well on every plane, the same border, hover and focus halo.
|
|
177
|
-
*/
|
|
178
|
-
export declare function fieldPickerTriggerClass({ interactive }?: {
|
|
179
|
-
interactive?: boolean;
|
|
180
|
-
}): string;
|
|
181
|
-
/**
|
|
182
|
-
* Trigger classes for a `quiet` picker. Height, padding, radius, and type are
|
|
183
|
-
* fixed here so the triggers on one composer row agree; a caller adds only
|
|
184
|
-
* width (`w-full`) and alignment (`justify-between`).
|
|
185
|
-
*
|
|
186
|
-
* The focus ring is drawn on the element rather than left to the tokens.css
|
|
187
|
-
* `:focus-visible` floor: a quiet trigger sits beside the composer's own action
|
|
188
|
-
* buttons (attach, dictate, send), which draw `focus-visible:ring-2
|
|
189
|
-
* focus-visible:ring-ring`, and a row whose controls answer keyboard focus two
|
|
190
|
-
* different ways reads as two families.
|
|
191
|
-
*
|
|
192
|
-
* `interactive: false` is for a PINNED control (see `HarnessPicker`'s
|
|
193
|
-
* `lockReason`): it keeps the resting treatment and draws no hover or open
|
|
194
|
-
* fill, because a fill promises a menu the control will not open.
|
|
195
|
-
*/
|
|
196
|
-
export declare function quietPickerTriggerClass({ interactive }?: {
|
|
197
|
-
interactive?: boolean;
|
|
198
|
-
}): string;
|
|
199
|
-
/**
|
|
200
|
-
* Guard an async action against double-submit. `run` ignores re-entrant calls
|
|
201
|
-
* while a promise is in flight and flips `pending` so the caller can disable
|
|
202
|
-
* the control — the fix for double-charge / double-approve on a slow network.
|
|
203
|
-
* Settles (success or throw) before clearing, and no-ops state updates after
|
|
204
|
-
* unmount.
|
|
205
|
-
*/
|
|
206
|
-
export declare function usePending(): {
|
|
207
|
-
pending: boolean;
|
|
208
|
-
run: (action: () => void | Promise<void>) => void;
|
|
209
|
-
};
|
|
210
|
-
export interface ModelPickerProps {
|
|
211
|
-
/** Controlled, opaque saved id. Never replaced merely because the catalogue omits it. */
|
|
212
|
-
value: string;
|
|
213
|
-
onChange: (id: string) => void;
|
|
214
|
-
/** Catalogue models — from `GET`ing the app's catalogue route (see
|
|
215
|
-
* `runtime/model-catalog`), plus any product-specific entries appended. */
|
|
216
|
-
models: CatalogModel[];
|
|
217
|
-
/** Host-owned request state. Loading takes precedence over error and results. */
|
|
218
|
-
loading?: boolean;
|
|
219
|
-
/** Host-safe failure message. null/undefined means no failure; even '' is an error. */
|
|
220
|
-
error?: string | null;
|
|
221
|
-
/** Ask the host to retry. The host owns fetching, loading, errors and cancellation. */
|
|
222
|
-
onRetry?: () => void;
|
|
223
|
-
/** Disable the trigger and close an open picker; does not change the saved value. */
|
|
224
|
-
disabled?: boolean;
|
|
225
|
-
/** Associations belong to the trigger button, not its surrounding div. */
|
|
226
|
-
id?: string;
|
|
227
|
-
'aria-label'?: string;
|
|
228
|
-
'aria-labelledby'?: string;
|
|
229
|
-
'aria-describedby'?: string;
|
|
230
|
-
/** Render a provider logo/badge; default is ProviderLogo. */
|
|
231
|
-
renderProviderBadge?: (provider: string) => ReactNode;
|
|
232
|
-
/** Section label for `featured` models. */
|
|
233
|
-
recommendedLabel?: string;
|
|
234
|
-
/** Pin a labeled section to the TOP of the list (above Recommended) for the
|
|
235
|
-
* models a product wants surfaced first — e.g. a tuner app's own fine-tuned
|
|
236
|
-
* models (`{ label: 'Your Fine-Tuned Models', match: (m) => m.provider === 'tuner' }`).
|
|
237
|
-
* Matching models are shown only in this section, not duplicated below. */
|
|
238
|
-
priorityGroup?: {
|
|
239
|
-
label: string;
|
|
240
|
-
match: (model: CatalogModel) => boolean;
|
|
241
|
-
};
|
|
242
|
-
/** Trigger treatment — see {@link PickerVariant}. Default `chip`. */
|
|
243
|
-
variant?: PickerVariant;
|
|
244
|
-
/** Optional accessible trigger content for a picker docked beside an editable model field. */
|
|
245
|
-
triggerContent?: ReactNode;
|
|
246
|
-
/**
|
|
247
|
-
* Offer "no selection" as the first row, for a setting that may defer to a
|
|
248
|
-
* default chosen elsewhere. Choosing it calls `onChange('')`, and the trigger
|
|
249
|
-
* shows this label while `value` is empty.
|
|
250
|
-
*/
|
|
251
|
-
defaultOption?: {
|
|
252
|
-
label: string;
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* The price a person pays per output, in the unit that output comes in: per
|
|
257
|
-
* million prompt tokens for text, per image, per second of video, per minute of
|
|
258
|
-
* audio, per 1,000 characters of speech. Undefined when the catalogue has no
|
|
259
|
-
* price, so a row never shows a made-up number.
|
|
260
|
-
*/
|
|
261
|
-
export declare function formatModelPrice(model: Pick<CatalogModel, 'pricing' | 'outputPrice'>): string | undefined;
|
|
262
|
-
/**
|
|
263
|
-
* Searchable model picker pill + popover. A featured model is recommended
|
|
264
|
-
* when the catalog marks it as a current choice. The first view stays short;
|
|
265
|
-
* search and the browse action retain every routeable legacy model.
|
|
266
|
-
*
|
|
267
|
-
* This is the CANONICAL ecosystem model picker (see docs/ui-picker-canon.md).
|
|
268
|
-
* Catalogue requests, retry outcomes and persisted selections belong to the host.
|
|
269
|
-
* The non-modal dialog uses native buttons, not a partial combobox/listbox:
|
|
270
|
-
* Tab and Enter/Space work normally; arrow keys also move through its controls.
|
|
271
|
-
*/
|
|
272
|
-
export declare function ModelPicker({ value, onChange, models, loading, error, onRetry, disabled, id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, renderProviderBadge, recommendedLabel, priorityGroup, variant, triggerContent, defaultOption, }: ModelPickerProps): import("react").JSX.Element;
|
|
273
|
-
/** One reasoning-budget level: the engine `id` is unchanged (the value the
|
|
274
|
-
* product sends to the loop); only the user-facing `label` is renamed to the
|
|
275
|
-
* plainer "how hard should it think" vocabulary from docs/product-surfaces.md.
|
|
276
|
-
* `low`→Quick, `medium`→Standard, `high`→Extended. The mapping is overridable
|
|
277
|
-
* via `EffortPickerProps.levels`, so a product can relabel without losing the
|
|
278
|
-
* ids the runtime expects. */
|
|
279
|
-
export interface EffortLevel {
|
|
280
|
-
id: string;
|
|
281
|
-
label: string;
|
|
282
|
-
}
|
|
283
|
-
export declare const DEFAULT_EFFORT_LEVELS: readonly EffortLevel[];
|
|
284
|
-
/**
|
|
285
|
-
* The user-facing label for an engine level id: the canonical vocabulary when
|
|
286
|
-
* the id is one this package names, otherwise the id itself made readable
|
|
287
|
-
* (`auto` -> "Auto", `ultra-code` -> "Ultra code"). Never invents a depth word,
|
|
288
|
-
* so an id nobody declared a label for still reads as ITSELF and never as some
|
|
289
|
-
* other level.
|
|
290
|
-
*/
|
|
291
|
-
export declare function effortLevelLabel(id: string): string;
|
|
292
|
-
/**
|
|
293
|
-
* Build a levels list from the engine ids a backend applies — the shape the
|
|
294
|
-
* removed `ComposerAgentControls` took as `reasoning.available`, so a product
|
|
295
|
-
* migrating that list has one call to make instead of a hand-written label map
|
|
296
|
-
* per product (which is how "Quick" and "Low" drift apart across surfaces).
|
|
297
|
-
*/
|
|
298
|
-
export declare function effortLevelsFromIds(ids: readonly string[]): readonly EffortLevel[];
|
|
299
|
-
/**
|
|
300
|
-
* The list {@link EffortPicker} RENDERS for `value` — the declared levels, plus
|
|
301
|
-
* `value` itself when the declaration omits it.
|
|
302
|
-
*
|
|
303
|
-
* A picker cannot honestly resolve a selected value it was not given, and the
|
|
304
|
-
* failure it used to take instead — fall back to the middle entry — renders the
|
|
305
|
-
* session's real depth as a DIFFERENT level's name. That is exactly the defect
|
|
306
|
-
* `levels` was added to prevent: the legacy adapter's `available` list excluded
|
|
307
|
-
* the `auto` sentinel because the old picker injected it, so a product mapping
|
|
308
|
-
* that list straight across ships a session running on `auto` labelled
|
|
309
|
-
* "Extended". Admitting the value is not offering a new choice — it is
|
|
310
|
-
* reporting the state the session is already in, and it disappears from the
|
|
311
|
-
* list as soon as the user picks a declared level.
|
|
312
|
-
*
|
|
313
|
-
* A blank value is not admitted (there is no honest label for it); the picker
|
|
314
|
-
* renders no selection instead.
|
|
315
|
-
*/
|
|
316
|
-
export declare function reconcileEffortLevels(value: string, levels?: readonly EffortLevel[]): readonly EffortLevel[];
|
|
317
|
-
/** Segments the meter draws — fixed geometry so the ladder stays tabular
|
|
318
|
-
* across levels (and across the trigger and its menu rows). */
|
|
319
|
-
export declare const EFFORT_METER_SEGMENTS = 4;
|
|
320
|
-
/**
|
|
321
|
-
* Filled-segment count for a level: 0 for off/none (or an id the levels list
|
|
322
|
-
* does not carry); otherwise the level's position among the non-off choices
|
|
323
|
-
* scaled onto the meter, so the ladder reads low < medium < high and the top
|
|
324
|
-
* level fills the whole scale. The canonical four levels land 0 / 1 / 2 / 4.
|
|
325
|
-
*/
|
|
326
|
-
export declare function effortMeterFill(levelId: string, levels?: readonly EffortLevel[]): number;
|
|
327
|
-
/**
|
|
328
|
-
* The thinking-strength meter: four 12px bars, filled count = level, filled
|
|
329
|
-
* opacity ramping 25→100% left to right (unfilled at a faint ghost). Purely
|
|
330
|
-
* decorative — the level name is always rendered as text beside it, so the
|
|
331
|
-
* meter is `aria-hidden` and adds no second accessible name.
|
|
332
|
-
*/
|
|
333
|
-
export declare function EffortMeter({ fill, className }: {
|
|
334
|
-
fill: number;
|
|
335
|
-
className?: string;
|
|
336
|
-
}): import("react").JSX.Element;
|
|
337
|
-
export interface EffortPickerProps {
|
|
338
|
-
value: string;
|
|
339
|
-
onChange: (id: string) => void;
|
|
340
|
-
/** Selectable levels (engine id + user-facing label). Defaults to the plain
|
|
341
|
-
* "Thinking" vocabulary; override to relabel without changing the ids the
|
|
342
|
-
* runtime receives.
|
|
343
|
-
*
|
|
344
|
-
* A list that omits the current `value` is not a rendering error the picker
|
|
345
|
-
* papers over: `value` is reconciled INTO the rendered list under its own
|
|
346
|
-
* name (see {@link reconcileEffortLevels}), because a control must report
|
|
347
|
-
* the depth the session is running at and never some other list entry. */
|
|
348
|
-
levels?: readonly EffortLevel[];
|
|
349
|
-
/** Prefix shown before the active level on the pill — the "what is this"
|
|
350
|
-
* context the bare value lacked. Default "Thinking". Pass '' to hide it. */
|
|
351
|
-
label?: string;
|
|
352
|
-
/** Fill the container instead of shrink-wrapping — opt-in, default `false`;
|
|
353
|
-
* see {@link pickerRootClass} for when and why. */
|
|
354
|
-
fullWidth?: boolean;
|
|
355
|
-
/** Trigger treatment — see {@link PickerVariant}. Default `chip`. */
|
|
356
|
-
variant?: PickerVariant;
|
|
357
|
-
/** Disable the trigger and close an open menu; does not change the value. */
|
|
358
|
-
disabled?: boolean;
|
|
359
|
-
/** Associations belong to the trigger button, for a picker labelled by a form field. */
|
|
360
|
-
id?: string;
|
|
361
|
-
'aria-describedby'?: string;
|
|
362
|
-
}
|
|
363
|
-
/** Thinking-budget selector pill, styled to match {@link ModelPicker}. Show
|
|
364
|
-
* it only when the selected model `supportsReasoning`. "Thinking" is the
|
|
365
|
-
* plain-English name for what was internally called "effort".
|
|
366
|
-
*
|
|
367
|
-
* The CANONICAL ecosystem effort picker — sandbox-ui's reasoning menu (inside
|
|
368
|
-
* its `chat/AgentSessionControls`) is legacy and frozen. */
|
|
369
|
-
export declare function EffortPicker({ value, onChange, levels, label, fullWidth, variant, disabled, id, 'aria-describedby': ariaDescribedBy }: EffortPickerProps): import("react").JSX.Element;
|
|
12
|
+
export { ChevronDown, BrainGlyph, CheckGlyph } from './control-glyphs';
|
|
13
|
+
export * from './popover-surface';
|
|
14
|
+
export { POPOVER_OPTION_FOCUS, OVERLAY_SHADOW, pickerRootClass, fieldPickerTriggerClass, quietPickerTriggerClass, type PickerVariant } from './picker-presentation';
|
|
15
|
+
export * from './use-pending';
|
|
16
|
+
export * from './model-picker';
|
|
17
|
+
export * from './effort-picker';
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { type PickerVariant } from './picker-presentation';
|
|
2
|
+
/** One reasoning-budget level: the engine `id` is unchanged (the value the
|
|
3
|
+
* product sends to the loop); only the user-facing `label` is renamed to the
|
|
4
|
+
* plainer "how hard should it think" vocabulary from docs/product-surfaces.md.
|
|
5
|
+
* `low`→Quick, `medium`→Standard, `high`→Extended. The mapping is overridable
|
|
6
|
+
* via `EffortPickerProps.levels`, so a product can relabel without losing the
|
|
7
|
+
* ids the runtime expects. */
|
|
8
|
+
export interface EffortLevel {
|
|
9
|
+
id: string;
|
|
10
|
+
label: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const DEFAULT_EFFORT_LEVELS: readonly EffortLevel[];
|
|
13
|
+
/**
|
|
14
|
+
* The user-facing label for an engine level id: the canonical vocabulary when
|
|
15
|
+
* the id is one this package names, otherwise the id itself made readable
|
|
16
|
+
* (`auto` -> "Auto", `ultra-code` -> "Ultra code"). Never invents a depth word,
|
|
17
|
+
* so an id nobody declared a label for still reads as ITSELF and never as some
|
|
18
|
+
* other level.
|
|
19
|
+
*/
|
|
20
|
+
export declare function effortLevelLabel(id: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Build a levels list from the engine ids a backend applies — the shape the
|
|
23
|
+
* removed `ComposerAgentControls` took as `reasoning.available`, so a product
|
|
24
|
+
* migrating that list has one call to make instead of a hand-written label map
|
|
25
|
+
* per product (which is how "Quick" and "Low" drift apart across surfaces).
|
|
26
|
+
*/
|
|
27
|
+
export declare function effortLevelsFromIds(ids: readonly string[]): readonly EffortLevel[];
|
|
28
|
+
/**
|
|
29
|
+
* The list {@link EffortPicker} RENDERS for `value` — the declared levels, plus
|
|
30
|
+
* `value` itself when the declaration omits it.
|
|
31
|
+
*
|
|
32
|
+
* A picker cannot honestly resolve a selected value it was not given, and the
|
|
33
|
+
* failure it used to take instead — fall back to the middle entry — renders the
|
|
34
|
+
* session's real depth as a DIFFERENT level's name. That is exactly the defect
|
|
35
|
+
* `levels` was added to prevent: the legacy adapter's `available` list excluded
|
|
36
|
+
* the `auto` sentinel because the old picker injected it, so a product mapping
|
|
37
|
+
* that list straight across ships a session running on `auto` labelled
|
|
38
|
+
* "Extended". Admitting the value is not offering a new choice — it is
|
|
39
|
+
* reporting the state the session is already in, and it disappears from the
|
|
40
|
+
* list as soon as the user picks a declared level.
|
|
41
|
+
*
|
|
42
|
+
* A blank value is not admitted (there is no honest label for it); the picker
|
|
43
|
+
* renders no selection instead.
|
|
44
|
+
*/
|
|
45
|
+
export declare function reconcileEffortLevels(value: string, levels?: readonly EffortLevel[]): readonly EffortLevel[];
|
|
46
|
+
/** Segments the meter draws — fixed geometry so the ladder stays tabular
|
|
47
|
+
* across levels (and across the trigger and its menu rows). */
|
|
48
|
+
export declare const EFFORT_METER_SEGMENTS = 4;
|
|
49
|
+
/**
|
|
50
|
+
* Filled-segment count for a level: 0 for off/none (or an id the levels list
|
|
51
|
+
* does not carry); otherwise the level's position among the non-off choices
|
|
52
|
+
* scaled onto the meter, so the ladder reads low < medium < high and the top
|
|
53
|
+
* level fills the whole scale. The canonical four levels land 0 / 1 / 2 / 4.
|
|
54
|
+
*/
|
|
55
|
+
export declare function effortMeterFill(levelId: string, levels?: readonly EffortLevel[]): number;
|
|
56
|
+
/**
|
|
57
|
+
* The thinking-strength meter: four 12px bars, filled count = level, filled
|
|
58
|
+
* opacity ramping 25→100% left to right (unfilled at a faint ghost). Purely
|
|
59
|
+
* decorative — the level name is always rendered as text beside it, so the
|
|
60
|
+
* meter is `aria-hidden` and adds no second accessible name.
|
|
61
|
+
*/
|
|
62
|
+
export declare function EffortMeter({ fill, className }: {
|
|
63
|
+
fill: number;
|
|
64
|
+
className?: string;
|
|
65
|
+
}): import("react").JSX.Element;
|
|
66
|
+
export interface EffortPickerProps {
|
|
67
|
+
value: string;
|
|
68
|
+
onChange: (id: string) => void;
|
|
69
|
+
/** Selectable levels (engine id + user-facing label). Defaults to the plain
|
|
70
|
+
* "Thinking" vocabulary; override to relabel without changing the ids the
|
|
71
|
+
* runtime receives.
|
|
72
|
+
*
|
|
73
|
+
* A list that omits the current `value` is not a rendering error the picker
|
|
74
|
+
* papers over: `value` is reconciled INTO the rendered list under its own
|
|
75
|
+
* name (see {@link reconcileEffortLevels}), because a control must report
|
|
76
|
+
* the depth the session is running at and never some other list entry. */
|
|
77
|
+
levels?: readonly EffortLevel[];
|
|
78
|
+
/** Prefix shown before the active level on the pill — the "what is this"
|
|
79
|
+
* context the bare value lacked. Default "Thinking". Pass '' to hide it. */
|
|
80
|
+
label?: string;
|
|
81
|
+
/** Fill the container instead of shrink-wrapping — opt-in, default `false`;
|
|
82
|
+
* see {@link pickerRootClass} for when and why. */
|
|
83
|
+
fullWidth?: boolean;
|
|
84
|
+
/** Trigger treatment — see {@link PickerVariant}. Default `chip`. */
|
|
85
|
+
variant?: PickerVariant;
|
|
86
|
+
/** Disable the trigger and close an open menu; does not change the value. */
|
|
87
|
+
disabled?: boolean;
|
|
88
|
+
/** Associations belong to the trigger button, for a picker labelled by a form field. */
|
|
89
|
+
id?: string;
|
|
90
|
+
'aria-describedby'?: string;
|
|
91
|
+
}
|
|
92
|
+
/** Thinking-budget selector pill, styled to match {@link ModelPicker}. Show
|
|
93
|
+
* it only when the selected model `supportsReasoning`. "Thinking" is the
|
|
94
|
+
* plain-English name for what was internally called "effort".
|
|
95
|
+
*
|
|
96
|
+
* The CANONICAL ecosystem effort picker — sandbox-ui's reasoning menu (inside
|
|
97
|
+
* its `chat/AgentSessionControls`) is legacy and frozen. */
|
|
98
|
+
export declare function EffortPicker({ value, onChange, levels, label, fullWidth, variant, disabled, id, 'aria-describedby': ariaDescribedBy }: EffortPickerProps): import("react").JSX.Element;
|
package/dist/web-react/index.js
CHANGED
|
@@ -141,7 +141,7 @@ import {
|
|
|
141
141
|
withoutRecordGridCreated,
|
|
142
142
|
withoutRecordGridRemoved,
|
|
143
143
|
withoutRecordGridUpdate
|
|
144
|
-
} from "../chunk-
|
|
144
|
+
} from "../chunk-FJEGGUOQ.js";
|
|
145
145
|
import {
|
|
146
146
|
MENTION_PILL_CLASS
|
|
147
147
|
} from "../chunk-3HUFJ5LO.js";
|
|
@@ -151,7 +151,7 @@ import {
|
|
|
151
151
|
useInfiniteScroll,
|
|
152
152
|
useSessionActions,
|
|
153
153
|
useSessionHistory
|
|
154
|
-
} from "../chunk-
|
|
154
|
+
} from "../chunk-35APKGPB.js";
|
|
155
155
|
import "../chunk-FBVLEGEG.js";
|
|
156
156
|
import {
|
|
157
157
|
EvidenceLineageTable,
|
|
@@ -181,12 +181,12 @@ import {
|
|
|
181
181
|
preloadWhenIdle,
|
|
182
182
|
useComposerAttachments,
|
|
183
183
|
useDictation
|
|
184
|
-
} from "../chunk-
|
|
184
|
+
} from "../chunk-BNFUJNPS.js";
|
|
185
185
|
import "../chunk-L7MB2LLM.js";
|
|
186
186
|
import {
|
|
187
187
|
WorkspaceInitial,
|
|
188
188
|
WorkspaceSwitcher
|
|
189
|
-
} from "../chunk-
|
|
189
|
+
} from "../chunk-3K45OQ5X.js";
|
|
190
190
|
import "../chunk-A2GG4D4A.js";
|
|
191
191
|
import {
|
|
192
192
|
WorkspacePrewarmContext,
|
|
@@ -203,7 +203,7 @@ import {
|
|
|
203
203
|
AGENT_PROFILE_EDITOR_SECTIONS,
|
|
204
204
|
AgentProfileEditor,
|
|
205
205
|
AgentProfileRegistryError
|
|
206
|
-
} from "../chunk-
|
|
206
|
+
} from "../chunk-4JAXSEYW.js";
|
|
207
207
|
import {
|
|
208
208
|
AgentSessionControls,
|
|
209
209
|
AgentSettingsPopover,
|
|
@@ -213,8 +213,8 @@ import {
|
|
|
213
213
|
filterAcceptedFiles,
|
|
214
214
|
isAcceptedFileType,
|
|
215
215
|
renamePastedImages
|
|
216
|
-
} from "../chunk-
|
|
217
|
-
import "../chunk-
|
|
216
|
+
} from "../chunk-232KA6MR.js";
|
|
217
|
+
import "../chunk-JYVUFRRV.js";
|
|
218
218
|
import {
|
|
219
219
|
DEFAULT_EFFORT_LEVELS,
|
|
220
220
|
EFFORT_METER_SEGMENTS,
|
|
@@ -232,7 +232,7 @@ import {
|
|
|
232
232
|
reconcileEffortLevels,
|
|
233
233
|
usePending,
|
|
234
234
|
usePopover
|
|
235
|
-
} from "../chunk-
|
|
235
|
+
} from "../chunk-XIN7DOAB.js";
|
|
236
236
|
import {
|
|
237
237
|
ReviewFeedbackForm
|
|
238
238
|
} from "../chunk-ATQQCG4I.js";
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/** Searchable catalog selection and truthful model price presentation. */
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
import { type CatalogModel } from '../runtime/model-catalog';
|
|
4
|
+
import { type PickerVariant } from './picker-presentation';
|
|
5
|
+
export interface ModelPickerProps {
|
|
6
|
+
/** Controlled, opaque saved id. Never replaced merely because the catalogue omits it. */
|
|
7
|
+
value: string;
|
|
8
|
+
onChange: (id: string) => void;
|
|
9
|
+
/** Catalogue models — from `GET`ing the app's catalogue route (see
|
|
10
|
+
* `runtime/model-catalog`), plus any product-specific entries appended. */
|
|
11
|
+
models: CatalogModel[];
|
|
12
|
+
/** Host-owned request state. Loading takes precedence over error and results. */
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
/** Host-safe failure message. null/undefined means no failure; even '' is an error. */
|
|
15
|
+
error?: string | null;
|
|
16
|
+
/** Ask the host to retry. The host owns fetching, loading, errors and cancellation. */
|
|
17
|
+
onRetry?: () => void;
|
|
18
|
+
/** Disable the trigger and close an open picker; does not change the saved value. */
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/** Associations belong to the trigger button, not its surrounding div. */
|
|
21
|
+
id?: string;
|
|
22
|
+
'aria-label'?: string;
|
|
23
|
+
'aria-labelledby'?: string;
|
|
24
|
+
'aria-describedby'?: string;
|
|
25
|
+
/** Render a provider logo/badge; default is ProviderLogo. */
|
|
26
|
+
renderProviderBadge?: (provider: string) => ReactNode;
|
|
27
|
+
/** Section label for `featured` models. */
|
|
28
|
+
recommendedLabel?: string;
|
|
29
|
+
/** Pin a labeled section to the TOP of the list (above Recommended) for the
|
|
30
|
+
* models a product wants surfaced first — e.g. a tuner app's own fine-tuned
|
|
31
|
+
* models (`{ label: 'Your Fine-Tuned Models', match: (m) => m.provider === 'tuner' }`).
|
|
32
|
+
* Matching models are shown only in this section, not duplicated below. */
|
|
33
|
+
priorityGroup?: {
|
|
34
|
+
label: string;
|
|
35
|
+
match: (model: CatalogModel) => boolean;
|
|
36
|
+
};
|
|
37
|
+
/** Trigger treatment — see {@link PickerVariant}. Default `chip`. */
|
|
38
|
+
variant?: PickerVariant;
|
|
39
|
+
/** Optional accessible trigger content for a picker docked beside an editable model field. */
|
|
40
|
+
triggerContent?: ReactNode;
|
|
41
|
+
/**
|
|
42
|
+
* Offer "no selection" as the first row, for a setting that may defer to a
|
|
43
|
+
* default chosen elsewhere. Choosing it calls `onChange('')`, and the trigger
|
|
44
|
+
* shows this label while `value` is empty.
|
|
45
|
+
*/
|
|
46
|
+
defaultOption?: {
|
|
47
|
+
label: string;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The price a person pays per output, in the unit that output comes in: per
|
|
52
|
+
* million prompt tokens for text, per image, per second of video, per minute of
|
|
53
|
+
* audio, per 1,000 characters of speech. Undefined when the catalogue has no
|
|
54
|
+
* price, so a row never shows a made-up number.
|
|
55
|
+
*/
|
|
56
|
+
export declare function formatModelPrice(model: Pick<CatalogModel, 'pricing' | 'outputPrice'>): string | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Searchable model picker pill + popover. A featured model is recommended
|
|
59
|
+
* when the catalog marks it as a current choice. The first view stays short;
|
|
60
|
+
* search and the browse action retain every routeable legacy model.
|
|
61
|
+
*
|
|
62
|
+
* This is the CANONICAL ecosystem model picker (see docs/ui-picker-canon.md).
|
|
63
|
+
* Catalogue requests, retry outcomes and persisted selections belong to the host.
|
|
64
|
+
* The non-modal dialog uses native buttons, not a partial combobox/listbox:
|
|
65
|
+
* Tab and Enter/Space work normally; arrow keys also move through its controls.
|
|
66
|
+
*/
|
|
67
|
+
export declare function ModelPicker({ value, onChange, models, loading, error, onRetry, disabled, id, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, renderProviderBadge, recommendedLabel, priorityGroup, variant, triggerContent, defaultOption, }: ModelPickerProps): import("react").JSX.Element;
|