@tangle-network/sandbox-ui 0.58.0 → 0.60.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 CHANGED
@@ -48,6 +48,69 @@ interface ReasoningLevelPickerProps {
48
48
  declare const DEFAULT_REASONING_LEVEL_OPTIONS: ReadonlyArray<ReasoningLevelOption>;
49
49
  declare function ReasoningLevelPicker({ value, onChange, disabled, className, triggerClassName, options, available, side, avoidCollisions, }: ReasoningLevelPickerProps): react_jsx_runtime.JSX.Element;
50
50
 
51
+ /**
52
+ * An agent profile: a named bundle of toolset + persona layered over the same
53
+ * model and session. `builtin` profiles are the product's shipped modes (e.g.
54
+ * Studio / Assistant); the rest are user-saved custom agents. The concept is
55
+ * backend-agnostic — it applies to a router-backed agent and a sandbox-backed
56
+ * one alike, which is why it lives beside the model control rather than under
57
+ * the harness.
58
+ */
59
+ interface AgentProfileOption {
60
+ id: string;
61
+ name: string;
62
+ /** Builtin: a one-line description. Custom: derived "N tools" if omitted. */
63
+ description?: string;
64
+ /** Capability/tool-group ids this profile enables. */
65
+ capabilities?: ReadonlyArray<string>;
66
+ /** Persona / extra system instructions. */
67
+ instructions?: string;
68
+ /** A shipped mode vs a user-saved custom agent. */
69
+ builtin?: boolean;
70
+ }
71
+ /** A selectable tool group offered by the create/edit form. */
72
+ interface AgentProfileCapability {
73
+ id: string;
74
+ label: string;
75
+ description?: string;
76
+ }
77
+ /** The editable shape the create/edit form emits. */
78
+ interface AgentProfileDraft {
79
+ id?: string;
80
+ name: string;
81
+ capabilities: string[];
82
+ instructions: string;
83
+ }
84
+ interface AgentProfilePickerProps {
85
+ /** Selected profile id. */
86
+ value: string;
87
+ onChange: (id: string) => void;
88
+ profiles: ReadonlyArray<AgentProfileOption>;
89
+ /**
90
+ * Tool catalog for the create/edit form. Provide together with at least one
91
+ * write callback to enable authoring custom agents; omit for a
92
+ * selection-only picker (the New / edit / delete affordances stay hidden).
93
+ */
94
+ capabilities?: ReadonlyArray<AgentProfileCapability>;
95
+ onCreate?: (draft: AgentProfileDraft) => void | Promise<void>;
96
+ onUpdate?: (id: string, draft: AgentProfileDraft) => void | Promise<void>;
97
+ onDelete?: (id: string) => void | Promise<void>;
98
+ disabled?: boolean;
99
+ className?: string;
100
+ /** Side the menu opens toward. Defaults to up (composer-anchored). */
101
+ side?: "top" | "bottom";
102
+ }
103
+ /**
104
+ * Agent / mode switcher styled to match the chat control strip's pills
105
+ * (harness, model, effort). The pill shows the active profile; the menu lists
106
+ * builtin modes and saved custom agents. When a capability catalog and a write
107
+ * callback are supplied it also authors agents inline (name + tool toggles +
108
+ * persona) — a self-contained click-outside popover rather than a Radix menu,
109
+ * because the inline form needs its own focus and typing without the menu
110
+ * stealing keystrokes.
111
+ */
112
+ declare function AgentProfilePicker({ value, onChange, profiles, capabilities, onCreate, onUpdate, onDelete, disabled, className, side, }: AgentProfilePickerProps): react_jsx_runtime.JSX.Element;
113
+
51
114
  interface AgentSessionHarnessControl {
52
115
  value: HarnessType;
53
116
  onChange: (next: HarnessType) => void;
@@ -86,12 +149,33 @@ interface AgentSessionReasoningControl {
86
149
  */
87
150
  available?: ReadonlyArray<ReasoningEffort>;
88
151
  }
152
+ /**
153
+ * Agent-profile (mode / toolset / persona) selection. Backend-agnostic — it
154
+ * sits beside the model in both router-backed and sandbox-backed modes, so the
155
+ * same session can switch the agent's identity without touching the harness.
156
+ */
157
+ interface AgentSessionProfileControl {
158
+ value: string;
159
+ onChange: (id: string) => void;
160
+ profiles: ReadonlyArray<AgentProfileOption>;
161
+ /** Tool catalog for inline authoring; pair with a write callback to enable it. */
162
+ capabilities?: ReadonlyArray<AgentProfileCapability>;
163
+ onCreate?: (draft: AgentProfileDraft) => void | Promise<void>;
164
+ onUpdate?: (id: string, draft: AgentProfileDraft) => void | Promise<void>;
165
+ onDelete?: (id: string) => void | Promise<void>;
166
+ disabled?: boolean;
167
+ }
89
168
  interface AgentSessionControlsProps {
90
169
  /**
91
170
  * Harness (agent backend) selection. Switching harness usually means
92
171
  * re-creating the agent session — the consumer owns that lifecycle.
93
172
  */
94
173
  harness?: AgentSessionHarnessControl;
174
+ /**
175
+ * Agent profile (mode / toolset / persona). Universal — present in both
176
+ * router-backed and sandbox-backed composers, independent of the harness.
177
+ */
178
+ profile?: AgentSessionProfileControl;
95
179
  /** Per-turn model override, fed by the router's model catalog. */
96
180
  model?: AgentSessionModelControl;
97
181
  /** Thinking-effort level applied to subsequent turns. */
@@ -139,7 +223,90 @@ interface AgentSessionControlsProps {
139
223
  *
140
224
  * Designed to slot into `SandboxWorkbench`'s `session.composerControls`.
141
225
  */
142
- declare function AgentSessionControls({ harness, model, reasoning, trailing, className, context, layout, menuPlacement, }: AgentSessionControlsProps): react_jsx_runtime.JSX.Element | null;
226
+ declare function AgentSessionControls({ harness, profile, model, reasoning, trailing, className, context, layout, menuPlacement, }: AgentSessionControlsProps): react_jsx_runtime.JSX.Element | null;
227
+
228
+ /** A staged attachment shown as a chip above the input. */
229
+ interface ComposerFile {
230
+ id: string;
231
+ name: string;
232
+ size?: number;
233
+ kind: "file" | "folder";
234
+ /** File count for a folder chip. */
235
+ fileCount?: number;
236
+ status: "pending" | "uploading" | "ready" | "error";
237
+ }
238
+ interface AgentComposerProps {
239
+ /** Composer text (controlled). */
240
+ value: string;
241
+ onChange: (value: string) => void;
242
+ /** Fired on Enter (without Shift) or the send button. */
243
+ onSubmit: () => void;
244
+ placeholder?: string;
245
+ /** Disables typing and sending — e.g. while restoring. */
246
+ disabled?: boolean;
247
+ /**
248
+ * A turn is in flight. Spins the send button; paired with `onCancel` it
249
+ * becomes a Stop button instead, so the user can interrupt the stream.
250
+ */
251
+ busy?: boolean;
252
+ /** Stop the in-flight turn. With `busy`, replaces send with a Stop button. */
253
+ onCancel?: () => void;
254
+ /**
255
+ * Agent backend. Present → sandbox-backed (the harness pill shows and snaps
256
+ * with the model); omitted → router-backed (no harness, just model/effort).
257
+ */
258
+ harness?: AgentSessionHarnessControl;
259
+ /** Agent profile (mode / toolset / persona) — universal across both modes. */
260
+ profile?: AgentSessionProfileControl;
261
+ model?: AgentSessionModelControl;
262
+ reasoning?: AgentSessionReasoningControl;
263
+ /** Forwarded to the control strip (chat hides shell-only harnesses). */
264
+ context?: "chat" | "all";
265
+ /**
266
+ * Override the built-in control strip with custom controls. When set, the
267
+ * `harness`/`profile`/`model`/`reasoning` props are ignored and this node is
268
+ * rendered in the control row instead — for apps that compose their own
269
+ * pickers. Omit to use the canonical strip.
270
+ */
271
+ controls?: React.ReactNode;
272
+ /** Extra content left of the send button (token meter, cost, status). */
273
+ trailing?: React.ReactNode;
274
+ /**
275
+ * Attachments are opt-in: pass `onAttach` to show the attach button, accept
276
+ * drag-and-drop onto the composer, and render `attachments` as chips.
277
+ */
278
+ onAttach?: (files: FileList) => void;
279
+ /** Show a folder-attach button; falls back to `onAttach` if unset. */
280
+ onAttachFolder?: (files: FileList) => void;
281
+ attachments?: ReadonlyArray<ComposerFile>;
282
+ onRemoveFile?: (id: string) => void;
283
+ accept?: string;
284
+ dropTitle?: string;
285
+ dropDescription?: string;
286
+ /** Cmd/Ctrl+L focuses the input and shows a hint. Default false. */
287
+ focusShortcut?: boolean;
288
+ /** Minimum textarea rows before it grows. Default 2. */
289
+ minRows?: number;
290
+ /** Max pixel height before the textarea scrolls. Default 200. */
291
+ maxHeight?: number;
292
+ className?: string;
293
+ sendLabel?: string;
294
+ autoFocus?: boolean;
295
+ }
296
+ /**
297
+ * The canonical agent chat input: one rounded surface holding an auto-growing
298
+ * textarea, the embedded control strip (profile · harness · model · effort) at
299
+ * the bottom-left, and the send button at the bottom-right. The strip's pickers
300
+ * snap the harness↔model pair automatically; which controls appear is driven
301
+ * purely by which control objects are passed, so the same component is the
302
+ * router-backed composer (no harness) and the sandbox-backed one (with harness).
303
+ *
304
+ * Opt-in extras make it the superset of every app's hand-rolled composer:
305
+ * file/folder attachments with drag-and-drop + chips, a streaming Stop button
306
+ * (`busy` + `onCancel`), a `controls` override slot for bespoke picker rows, and
307
+ * a Cmd/Ctrl+L focus shortcut.
308
+ */
309
+ declare function AgentComposer({ value, onChange, onSubmit, placeholder, disabled, busy, onCancel, harness, profile, model, reasoning, context, controls, trailing, onAttach, onAttachFolder, attachments, onRemoveFile, accept, dropTitle, dropDescription, focusShortcut, minRows, maxHeight, className, sendLabel, autoFocus, }: AgentComposerProps): react_jsx_runtime.JSX.Element;
143
310
 
144
311
  /**
145
312
  * Whether `harness` can run `modelId`. Router-backed harnesses, and provider-less
@@ -253,4 +420,4 @@ declare function createFetchTransport(opts: {
253
420
  fetchImpl?: typeof fetch;
254
421
  }): ArtifactAgentDockTransport;
255
422
 
256
- export { AgentSessionControls, type AgentSessionControlsProps, type AgentSessionHarnessControl, type AgentSessionModelControl, type AgentSessionReasoningControl, ArtifactAgentDock, type ArtifactAgentDockProps, type ArtifactAgentDockTransport, type ArtifactDockMessage, type ArtifactDockStreamEvent, type ArtifactKind, type ArtifactScope, DEFAULT_REASONING_LEVEL_OPTIONS, type ReasoningLevel, type ReasoningLevelOption, ReasoningLevelPicker, type ReasoningLevelPickerProps, createFetchTransport, isModelCompatibleWithHarness, snapModelToHarness };
423
+ export { AgentComposer, type AgentComposerProps, type AgentProfileCapability, type AgentProfileDraft, type AgentProfileOption, AgentProfilePicker, type AgentProfilePickerProps, AgentSessionControls, type AgentSessionControlsProps, type AgentSessionHarnessControl, type AgentSessionModelControl, type AgentSessionProfileControl, type AgentSessionReasoningControl, ArtifactAgentDock, type ArtifactAgentDockProps, type ArtifactAgentDockTransport, type ArtifactDockMessage, type ArtifactDockStreamEvent, type ArtifactKind, type ArtifactScope, type ComposerFile, DEFAULT_REASONING_LEVEL_OPTIONS, type ReasoningLevel, type ReasoningLevelOption, ReasoningLevelPicker, type ReasoningLevelPickerProps, createFetchTransport, isModelCompatibleWithHarness, snapModelToHarness };
package/dist/chat.js CHANGED
@@ -1,4 +1,6 @@
1
1
  import {
2
+ AgentComposer,
3
+ AgentProfilePicker,
2
4
  AgentSessionControls,
3
5
  AgentTimeline,
4
6
  ArtifactAgentDock,
@@ -15,12 +17,14 @@ import {
15
17
  modelProvider,
16
18
  snapHarnessToModel,
17
19
  snapModelToHarness
18
- } from "./chunk-WLMLD2CZ.js";
20
+ } from "./chunk-V5JZOO3W.js";
19
21
  import "./chunk-HU4B2M4K.js";
20
22
  import "./chunk-SF6LPMMN.js";
21
23
  import "./chunk-EI44GEQ5.js";
22
24
  import "./chunk-U67V476Y.js";
23
25
  export {
26
+ AgentComposer,
27
+ AgentProfilePicker,
24
28
  AgentSessionControls,
25
29
  AgentTimeline,
26
30
  ArtifactAgentDock,