@tangle-network/sandbox-ui 0.105.3 → 0.107.0
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/chat.d.ts +1 -279
- package/dist/chat.js +3 -14
- package/dist/{chunk-XIXYQNXD.js → chunk-EKYA6AFY.js} +120 -613
- package/dist/globals.css +0 -91
- package/dist/index.d.ts +1 -1
- package/dist/index.js +16 -26
- package/dist/styles.css +0 -91
- package/package.json +1 -3
- package/dist/chunk-WGOOQAW3.js +0 -12
- package/dist/mention-editor-Q3TKSZDL.js +0 -490
package/dist/chat.d.ts
CHANGED
|
@@ -57,284 +57,6 @@ declare const DEFAULT_REASONING_LEVEL_OPTIONS: ReadonlyArray<ReasoningLevelOptio
|
|
|
57
57
|
declare const HARNESS_REASONING_OPTIONS: Partial<Record<HarnessType, ReadonlyArray<ReasoningLevelOption>>>;
|
|
58
58
|
declare function ReasoningLevelPicker({ value, onChange, disabled, className, triggerClassName, options, available, side, avoidCollisions, }: ReasoningLevelPickerProps): React.JSX.Element;
|
|
59
59
|
|
|
60
|
-
/**
|
|
61
|
-
* Limits applied when staging files onto a composer.
|
|
62
|
-
*
|
|
63
|
-
* Serves {@link AgentComposer}'s attachment lifecycle. `ChatComposer` in
|
|
64
|
-
* `@tangle-network/agent-app/web-react` stages files without a validation or
|
|
65
|
-
* retry step, so it has no equivalent.
|
|
66
|
-
*/
|
|
67
|
-
interface ComposerFileValidationConfig {
|
|
68
|
-
/** Reject any single file larger than this. */
|
|
69
|
-
maxSizeBytes?: number;
|
|
70
|
-
/** Reject files once the staged count would exceed this. */
|
|
71
|
-
maxCount?: number;
|
|
72
|
-
/** Files already staged, counted against `maxCount` before this batch. */
|
|
73
|
-
currentCount?: number;
|
|
74
|
-
/**
|
|
75
|
-
* Comma-separated accept list, same grammar as the native `<input accept>`
|
|
76
|
-
* attribute: file extensions (`.png`), exact MIME types (`image/png`), and
|
|
77
|
-
* MIME wildcards (`image/*`).
|
|
78
|
-
*/
|
|
79
|
-
accept?: string;
|
|
80
|
-
}
|
|
81
|
-
/** A file that failed validation, paired with a human-readable reason.
|
|
82
|
-
*
|
|
83
|
-
* Serves {@link AgentComposer}'s attachment lifecycle. `ChatComposer` in
|
|
84
|
-
* `@tangle-network/agent-app/web-react` stages files without a validation or
|
|
85
|
-
* retry step, so it has no equivalent. */
|
|
86
|
-
interface ComposerFileRejection {
|
|
87
|
-
file: File;
|
|
88
|
-
reason: string;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Checks a single file against a comma-separated `accept` list using the same
|
|
92
|
-
* grammar as the native `<input accept>` attribute. An undefined or empty
|
|
93
|
-
* `accept` accepts everything.
|
|
94
|
-
*
|
|
95
|
-
* Serves {@link AgentComposer}'s attachment lifecycle. `ChatComposer` in
|
|
96
|
-
* `@tangle-network/agent-app/web-react` stages files without a validation or
|
|
97
|
-
* retry step, so it has no equivalent.
|
|
98
|
-
*/
|
|
99
|
-
declare function isAcceptedType(file: File, accept?: string): boolean;
|
|
100
|
-
/**
|
|
101
|
-
* Splits a batch of files into what's safe to stage and what's rejected,
|
|
102
|
-
* checking accept type, then size, then the running count against
|
|
103
|
-
* `currentCount` + `maxCount`. Each rejection carries a reason naming the
|
|
104
|
-
* file and the limit it broke. Pure data in, pure data out — no throwing,
|
|
105
|
-
* no console noise, so callers decide how to surface rejections.
|
|
106
|
-
*
|
|
107
|
-
* Serves {@link AgentComposer}'s attachment lifecycle. `ChatComposer` in
|
|
108
|
-
* `@tangle-network/agent-app/web-react` stages files without a validation or
|
|
109
|
-
* retry step, so it has no equivalent.
|
|
110
|
-
*/
|
|
111
|
-
declare function validateComposerFiles(files: File[] | FileList, config: ComposerFileValidationConfig): {
|
|
112
|
-
accepted: File[];
|
|
113
|
-
rejected: ComposerFileRejection[];
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
/** A selectable item in the `@`-mention popover. Generic — file semantics live
|
|
117
|
-
* in the consuming app, not here.
|
|
118
|
-
*
|
|
119
|
-
* Part of the {@link AgentComposer} API. `ChatComposer` in
|
|
120
|
-
* `@tangle-network/agent-app/web-react` has no equivalent — see
|
|
121
|
-
* {@link AgentComposer} for which composer fits a surface. */
|
|
122
|
-
interface MentionItem {
|
|
123
|
-
id: string;
|
|
124
|
-
label: string;
|
|
125
|
-
detail?: string;
|
|
126
|
-
kind?: string;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Opt-in `@`-mention support. Present ⇒ the composer swaps its textarea for a
|
|
130
|
-
* TipTap rich input that renders mentions as atomic pills; absent ⇒ exactly
|
|
131
|
-
* today's plain-textarea behavior. Data-agnostic: the app supplies items.
|
|
132
|
-
*
|
|
133
|
-
* Part of the {@link AgentComposer} API. `ChatComposer` in
|
|
134
|
-
* `@tangle-network/agent-app/web-react` has no equivalent — see
|
|
135
|
-
* {@link AgentComposer} for which composer fits a surface.
|
|
136
|
-
*/
|
|
137
|
-
interface AgentComposerMention {
|
|
138
|
-
/** The character that opens the popover. Default "@". */
|
|
139
|
-
trigger?: string;
|
|
140
|
-
/** Async provider called with the query typed after the trigger. */
|
|
141
|
-
fetchItems: (query: string) => Promise<MentionItem[]>;
|
|
142
|
-
/** Fired with the mentions currently in the document whenever they change. */
|
|
143
|
-
onMentionsChange?: (mentions: MentionItem[]) => void;
|
|
144
|
-
/** Custom row renderer for a popover item. */
|
|
145
|
-
renderItem?: (item: MentionItem) => React.ReactNode;
|
|
146
|
-
/** Shown when a fetch resolves to zero items. Default "No matches". */
|
|
147
|
-
emptyText?: string;
|
|
148
|
-
/**
|
|
149
|
-
* Extra classes merged onto the suggestion popover's root element
|
|
150
|
-
* (`role="listbox"`), applied last so they win over the component's own —
|
|
151
|
-
* the supported way to retheme the popover instead of targeting it by its
|
|
152
|
-
* ARIA attributes.
|
|
153
|
-
*/
|
|
154
|
-
popoverClassName?: string;
|
|
155
|
-
}
|
|
156
|
-
/** A staged attachment shown as a chip above the input.
|
|
157
|
-
*
|
|
158
|
-
* Part of the {@link AgentComposer} API. `ChatComposer` in
|
|
159
|
-
* `@tangle-network/agent-app/web-react` has no equivalent — see
|
|
160
|
-
* {@link AgentComposer} for which composer fits a surface. */
|
|
161
|
-
interface ComposerFile {
|
|
162
|
-
id: string;
|
|
163
|
-
name: string;
|
|
164
|
-
size?: number;
|
|
165
|
-
kind: "file" | "folder";
|
|
166
|
-
/** File count for a folder chip. */
|
|
167
|
-
fileCount?: number;
|
|
168
|
-
status: "pending" | "uploading" | "ready" | "error";
|
|
169
|
-
/**
|
|
170
|
-
* Object URL for an image thumbnail. The app owns creation and revocation
|
|
171
|
-
* (e.g. `URL.createObjectURL` on stage, `URL.revokeObjectURL` on remove) —
|
|
172
|
-
* the composer only ever reads it.
|
|
173
|
-
*/
|
|
174
|
-
previewUrl?: string;
|
|
175
|
-
/** Shown on the chip when `status === "error"`. */
|
|
176
|
-
errorMessage?: string;
|
|
177
|
-
}
|
|
178
|
-
/** Context the agent will see alongside the next message.
|
|
179
|
-
*
|
|
180
|
-
* Part of the {@link AgentComposer} API. `ChatComposer` in
|
|
181
|
-
* `@tangle-network/agent-app/web-react` has no equivalent — see
|
|
182
|
-
* {@link AgentComposer} for which composer fits a surface. */
|
|
183
|
-
interface ComposerContextItem {
|
|
184
|
-
id: string;
|
|
185
|
-
label: string;
|
|
186
|
-
icon?: React.ReactNode;
|
|
187
|
-
/** Omit to render a non-removable chip. */
|
|
188
|
-
onRemove?: () => void;
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* Props of {@link AgentComposer}.
|
|
192
|
-
*
|
|
193
|
-
* Part of the {@link AgentComposer} API. `ChatComposer` in
|
|
194
|
-
* `@tangle-network/agent-app/web-react` has no equivalent — see
|
|
195
|
-
* {@link AgentComposer} for which composer fits a surface.
|
|
196
|
-
*/
|
|
197
|
-
interface AgentComposerProps {
|
|
198
|
-
/** Composer text (controlled). */
|
|
199
|
-
value: string;
|
|
200
|
-
onChange: (value: string) => void;
|
|
201
|
-
/** Fired on Enter (without Shift) or the send button. */
|
|
202
|
-
onSubmit: () => void;
|
|
203
|
-
placeholder?: string;
|
|
204
|
-
/** Disables typing and sending — e.g. while restoring. */
|
|
205
|
-
disabled?: boolean;
|
|
206
|
-
/**
|
|
207
|
-
* A turn is in flight. Spins the send button; paired with `onCancel` it
|
|
208
|
-
* becomes a Stop button instead, so the user can interrupt the stream.
|
|
209
|
-
*/
|
|
210
|
-
busy?: boolean;
|
|
211
|
-
/** Stop the in-flight turn. With `busy`, replaces send with a Stop button. */
|
|
212
|
-
onCancel?: () => void;
|
|
213
|
-
/**
|
|
214
|
-
* The composer's control strip (profile · harness · model · effort pickers,
|
|
215
|
-
* token meters, …), rendered in the bottom row. Required — the legacy
|
|
216
|
-
* built-in strip was removed with the legacy pickers: pass
|
|
217
|
-
* `AgentSessionControls` from `@tangle-network/agent-app/web-react` (or your
|
|
218
|
-
* own composition), or `null` for a bare composer.
|
|
219
|
-
*/
|
|
220
|
-
controls: React.ReactNode;
|
|
221
|
-
/** Extra content left of the send button (token meter, cost, status). */
|
|
222
|
-
trailing?: React.ReactNode;
|
|
223
|
-
/** Context the agent will see alongside the next message. */
|
|
224
|
-
contextItems?: ReadonlyArray<ComposerContextItem>;
|
|
225
|
-
/**
|
|
226
|
-
* Attachments are opt-in: pass `onAttach` to show the attach button, accept
|
|
227
|
-
* drag-and-drop onto the composer, and render `attachments` as chips.
|
|
228
|
-
*/
|
|
229
|
-
onAttach?: (files: FileList) => void;
|
|
230
|
-
/** Show a folder-attach button; falls back to `onAttach` if unset. */
|
|
231
|
-
onAttachFolder?: (files: FileList) => void;
|
|
232
|
-
attachments?: ReadonlyArray<ComposerFile>;
|
|
233
|
-
onRemoveFile?: (id: string) => void;
|
|
234
|
-
/** When set, chips with `status === "error"` render a retry button. */
|
|
235
|
-
onRetryFile?: (id: string) => void;
|
|
236
|
-
/**
|
|
237
|
-
* File types the composer takes, in the native `<input accept>` grammar.
|
|
238
|
-
* Enforced on every ingress path — the picker dialog, drag-and-drop, and
|
|
239
|
-
* clipboard paste — so a type the picker won't offer can't arrive by another
|
|
240
|
-
* route. Non-matching files go to `onRejectFiles` and never reach
|
|
241
|
-
* `onAttach`. Folder attach is exempt (directory selection has no native
|
|
242
|
-
* accept semantics); size/count limits are the app's job in `onAttach`.
|
|
243
|
-
*/
|
|
244
|
-
accept?: string;
|
|
245
|
-
/**
|
|
246
|
-
* Called with the files `accept` filtered out of a drop/paste/pick, each
|
|
247
|
-
* with a human-readable reason. Without it rejection is silent — the same
|
|
248
|
-
* feedback the native picker gives for a type it won't offer.
|
|
249
|
-
*/
|
|
250
|
-
onRejectFiles?: (rejections: ComposerFileRejection[]) => void;
|
|
251
|
-
dropTitle?: string;
|
|
252
|
-
dropDescription?: string;
|
|
253
|
-
/**
|
|
254
|
-
* `canSend` ignores `busy` so Enter/onSubmit keep firing while a turn is
|
|
255
|
-
* streaming. For composers that queue the next turn instead of blocking on
|
|
256
|
-
* the current one — the Stop-button rendering rule (`busy && onCancel`) is
|
|
257
|
-
* unaffected, so the button still flips to Stop while this is set. Default
|
|
258
|
-
* false.
|
|
259
|
-
*/
|
|
260
|
-
canSubmitWhileBusy?: boolean;
|
|
261
|
-
/**
|
|
262
|
-
* Allow submitting with empty text when at least one attachment is staged
|
|
263
|
-
* (an image-only message). Counts attachments of ANY status — a gate on
|
|
264
|
-
* `ready` would make Enter silently dead while an upload is in flight,
|
|
265
|
-
* with no way for the app to explain why. The app's onSubmit owns the send
|
|
266
|
-
* policy (block, queue, or toast on pending/errored files) and what the
|
|
267
|
-
* message body becomes. Default false.
|
|
268
|
-
*/
|
|
269
|
-
canSubmitAttachmentsOnly?: boolean;
|
|
270
|
-
/**
|
|
271
|
-
* Opt-in `@`-mentions. When set, the textarea is replaced by a rich input
|
|
272
|
-
* that renders mentions as atomic pills and serializes them to `@<id>` in
|
|
273
|
-
* `value`. Omit for exactly today's plain-textarea behavior.
|
|
274
|
-
*/
|
|
275
|
-
mention?: AgentComposerMention;
|
|
276
|
-
/** Cmd/Ctrl+L focuses the input and shows a hint. Default false. */
|
|
277
|
-
focusShortcut?: boolean;
|
|
278
|
-
/** Minimum textarea rows before it grows. Default 2. */
|
|
279
|
-
minRows?: number;
|
|
280
|
-
/** Max pixel height before the textarea scrolls. Default 200. */
|
|
281
|
-
maxHeight?: number;
|
|
282
|
-
className?: string;
|
|
283
|
-
sendLabel?: string;
|
|
284
|
-
autoFocus?: boolean;
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* Sibling of `ChatComposer` in `@tangle-network/agent-app/web-react`, not a
|
|
288
|
-
* predecessor of it. The two composers cover different jobs, and neither is a
|
|
289
|
-
* superset of the other, so pick by the features a surface needs.
|
|
290
|
-
*
|
|
291
|
-
* Reach for `AgentComposer` when the surface needs `@`-mentions (`mention`,
|
|
292
|
-
* backed by a lazily loaded rich-text input that renders mention pills),
|
|
293
|
-
* `contextItems`, or the full attachment lifecycle — `attachments` plus
|
|
294
|
-
* `onRejectFiles` and `onRetryFile`. It also owns `autoFocus`,
|
|
295
|
-
* `canSubmitAttachmentsOnly`, `trailing`, `maxHeight`, and `minRows`.
|
|
296
|
-
*
|
|
297
|
-
* Reach for `ChatComposer` when the surface is a plain send box. It owns
|
|
298
|
-
* send-failure recovery (`onSendFailed`, `sendFailureMessage`), one-shot
|
|
299
|
-
* prefill (`seed`), `controlsPlacement`, `floating`, `sendVariant`,
|
|
300
|
-
* parts-aware sends (`onSendParts`), and an uncontrolled mode
|
|
301
|
-
* (`initialValue`) — none of which exist here.
|
|
302
|
-
*
|
|
303
|
-
* Moving between them is a port, not a rename: the control models differ. This
|
|
304
|
-
* component requires `value` and `onChange` and calls `onSubmit` with no
|
|
305
|
-
* arguments, while `ChatComposer` can own its draft and hands the message to a
|
|
306
|
-
* refusable `onSend`.
|
|
307
|
-
*
|
|
308
|
-
* The input itself: one rounded surface holding an auto-growing
|
|
309
|
-
* textarea and a bottom row that runs left → right — attach buttons, the
|
|
310
|
-
* control strip (supplied via the required `controls` prop), trailing slot,
|
|
311
|
-
* and the send button on the far right. The strip is explicit: the canonical
|
|
312
|
-
* pickers are `ModelPicker` / `EffortPicker` / `AgentSessionControls` from
|
|
313
|
-
* `@tangle-network/agent-app/web-react` — this component only owns the slot.
|
|
314
|
-
*
|
|
315
|
-
* Opt-in extras cover what apps otherwise hand-roll:
|
|
316
|
-
* file/folder attachments with drag-and-drop + chips + clipboard paste
|
|
317
|
-
* (`onAttach` also gates pasting files onto the textarea, auto-naming
|
|
318
|
-
* generic clipboard image blobs `pasted-image-<n>.<ext>`), a streaming Stop
|
|
319
|
-
* button (`busy` + `onCancel`), and a Cmd/Ctrl+L focus shortcut.
|
|
320
|
-
*/
|
|
321
|
-
declare function AgentComposer({ value, onChange, onSubmit, placeholder, disabled, busy, onCancel, controls, trailing, contextItems, onAttach, onAttachFolder, attachments, onRemoveFile, onRetryFile, accept, onRejectFiles, dropTitle, dropDescription, canSubmitWhileBusy, canSubmitAttachmentsOnly, mention, focusShortcut, minRows, maxHeight, className, sendLabel, autoFocus, }: AgentComposerProps): React.JSX.Element;
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
* Visual contract for a rendered mention pill. The TipTap editor extension in
|
|
325
|
-
* `mention-editor.tsx` styles its inline atom node with this, and any other
|
|
326
|
-
* surface that renders a resolved mention (e.g. a sent-message transcript)
|
|
327
|
-
* should use the same constant so the two stay one visual contract instead of
|
|
328
|
-
* silently drifting apart. Kept in its own module (no TipTap import) so
|
|
329
|
-
* importing it never pulls the lazily-loaded editor chunk into a consumer's
|
|
330
|
-
* bundle.
|
|
331
|
-
*
|
|
332
|
-
* Mention-pill contract of {@link AgentComposer}'s mention feature.
|
|
333
|
-
* `ChatComposer` in `@tangle-network/agent-app/web-react` has no mention
|
|
334
|
-
* support, so it has no equivalent.
|
|
335
|
-
*/
|
|
336
|
-
declare const MENTION_PILL_CLASS: string;
|
|
337
|
-
|
|
338
60
|
/**
|
|
339
61
|
* An agent profile: a named bundle of toolset + persona layered over the same
|
|
340
62
|
* model and session. `builtin` profiles are the product's shipped modes (e.g.
|
|
@@ -505,4 +227,4 @@ declare function createFetchTransport(opts: {
|
|
|
505
227
|
fetchImpl?: typeof fetch;
|
|
506
228
|
}): ArtifactAgentDockTransport;
|
|
507
229
|
|
|
508
|
-
export {
|
|
230
|
+
export { type AgentProfileCapability, type AgentProfileDraft, type AgentProfileOption, AgentProfilePicker, type AgentProfilePickerProps, ArtifactAgentDock, type ArtifactAgentDockProps, type ArtifactAgentDockTransport, type ArtifactDockMessage, type ArtifactDockStreamEvent, type ArtifactKind, type ArtifactScope, DEFAULT_REASONING_LEVEL_OPTIONS, HARNESS_REASONING_OPTIONS, type ReasoningLevel, type ReasoningLevelOption, ReasoningLevelPicker, type ReasoningLevelPickerProps, createFetchTransport };
|
package/dist/chat.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
AgentComposer,
|
|
3
2
|
AgentProfilePicker,
|
|
4
3
|
AgentTimeline,
|
|
5
4
|
ArtifactAgentDock,
|
|
@@ -12,19 +11,12 @@ import {
|
|
|
12
11
|
ThinkingIndicator,
|
|
13
12
|
UserMessage,
|
|
14
13
|
createFetchTransport,
|
|
15
|
-
isAcceptedType,
|
|
16
14
|
modelProvider,
|
|
17
|
-
snapHarnessToModel
|
|
18
|
-
|
|
19
|
-
} from "./chunk-XIXYQNXD.js";
|
|
20
|
-
import "./chunk-TK46XFLM.js";
|
|
21
|
-
import {
|
|
22
|
-
MENTION_PILL_CLASS
|
|
23
|
-
} from "./chunk-WGOOQAW3.js";
|
|
15
|
+
snapHarnessToModel
|
|
16
|
+
} from "./chunk-EKYA6AFY.js";
|
|
24
17
|
import "./chunk-EI44GEQ5.js";
|
|
25
18
|
import "./chunk-CZ7CSFO4.js";
|
|
26
19
|
export {
|
|
27
|
-
AgentComposer,
|
|
28
20
|
AgentProfilePicker,
|
|
29
21
|
AgentTimeline,
|
|
30
22
|
ArtifactAgentDock,
|
|
@@ -32,14 +24,11 @@ export {
|
|
|
32
24
|
ChatMessage,
|
|
33
25
|
DEFAULT_REASONING_LEVEL_OPTIONS,
|
|
34
26
|
HARNESS_REASONING_OPTIONS,
|
|
35
|
-
MENTION_PILL_CLASS,
|
|
36
27
|
MessageList,
|
|
37
28
|
ReasoningLevelPicker,
|
|
38
29
|
ThinkingIndicator,
|
|
39
30
|
UserMessage,
|
|
40
31
|
createFetchTransport,
|
|
41
|
-
isAcceptedType,
|
|
42
32
|
modelProvider,
|
|
43
|
-
snapHarnessToModel
|
|
44
|
-
validateComposerFiles
|
|
33
|
+
snapHarnessToModel
|
|
45
34
|
};
|