@tangle-network/sandbox-ui 0.57.0 → 0.59.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
@@ -2,6 +2,7 @@ import { MessageRole } from '@tangle-network/ui/chat';
2
2
  export { AgentTimeline, AgentTimelineArtifactItem, AgentTimelineCustomItem, AgentTimelineItem, AgentTimelineMessageItem, AgentTimelineProps, AgentTimelineStatusItem, AgentTimelineTone, AgentTimelineToolGroupItem, AgentTimelineToolItem, ChatContainer, ChatContainerProps, ChatInput, ChatInputProps, ChatMessage, ChatMessageProps, MessageList, MessageListProps, MessageRole, PendingFile, ThinkingIndicator, ThinkingIndicatorProps, UserMessage, UserMessageProps } from '@tangle-network/ui/chat';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import { ReasoningEffort, HarnessType } from '@tangle-network/agent-interface';
5
+ export { modelProvider, snapHarnessToModel } from '@tangle-network/agent-interface';
5
6
  import * as Popover from '@radix-ui/react-dropdown-menu';
6
7
  import * as React from 'react';
7
8
  import { M as ModelInfo } from './model-picker-COjPVMzg.js';
@@ -47,6 +48,69 @@ interface ReasoningLevelPickerProps {
47
48
  declare const DEFAULT_REASONING_LEVEL_OPTIONS: ReadonlyArray<ReasoningLevelOption>;
48
49
  declare function ReasoningLevelPicker({ value, onChange, disabled, className, triggerClassName, options, available, side, avoidCollisions, }: ReasoningLevelPickerProps): react_jsx_runtime.JSX.Element;
49
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
+
50
114
  interface AgentSessionHarnessControl {
51
115
  value: HarnessType;
52
116
  onChange: (next: HarnessType) => void;
@@ -85,12 +149,33 @@ interface AgentSessionReasoningControl {
85
149
  */
86
150
  available?: ReadonlyArray<ReasoningEffort>;
87
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
+ }
88
168
  interface AgentSessionControlsProps {
89
169
  /**
90
170
  * Harness (agent backend) selection. Switching harness usually means
91
171
  * re-creating the agent session — the consumer owns that lifecycle.
92
172
  */
93
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;
94
179
  /** Per-turn model override, fed by the router's model catalog. */
95
180
  model?: AgentSessionModelControl;
96
181
  /** Thinking-effort level applied to subsequent turns. */
@@ -138,51 +223,64 @@ interface AgentSessionControlsProps {
138
223
  *
139
224
  * Designed to slot into `SandboxWorkbench`'s `session.composerControls`.
140
225
  */
141
- 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;
142
227
 
143
- /**
144
- * Harness ↔ model compatibility policy.
145
- *
146
- * Native CLI harnesses are vendor-locked: claude-code only drives
147
- * Anthropic models, codex only OpenAI models. Router-backed harnesses
148
- * (opencode) accept any catalog model. The pickers use this policy to
149
- * keep the pair coherent: changing one side snaps the other to its
150
- * nearest compatible choice instead of letting the user assemble a
151
- * combination that fails at inference time.
152
- */
153
- interface HarnessModelPolicy {
154
- /** Canonical-id provider prefixes the harness can run; null = any. */
155
- providers: ReadonlyArray<string> | null;
228
+ interface AgentComposerProps {
229
+ /** Composer text (controlled). */
230
+ value: string;
231
+ onChange: (value: string) => void;
232
+ /** Fired on Enter (without Shift) or the send button. */
233
+ onSubmit: () => void;
234
+ placeholder?: string;
235
+ /** Disables typing and sending — e.g. while a turn is streaming. */
236
+ disabled?: boolean;
237
+ /** Spins the send button and blocks submit, without disabling the textarea. */
238
+ busy?: boolean;
156
239
  /**
157
- * Patterns ranking snap targets, best first. Within one pattern's
158
- * matches the highest version (numeric-aware descending sort) wins,
159
- * so "latest standard frontier" stays correct as catalogs rotate.
240
+ * Agent backend. Present → sandbox-backed (the harness pill shows and snaps
241
+ * with the model); omitted → router-backed (no harness, just model/effort).
160
242
  */
161
- preferred: ReadonlyArray<RegExp>;
243
+ harness?: AgentSessionHarnessControl;
244
+ /** Agent profile (mode / toolset / persona) — universal across both modes. */
245
+ profile?: AgentSessionProfileControl;
246
+ model?: AgentSessionModelControl;
247
+ reasoning?: AgentSessionReasoningControl;
248
+ /** Forwarded to the control strip (chat hides shell-only harnesses). */
249
+ context?: "chat" | "all";
250
+ /** Extra content left of the send button (token meter, cost, status). */
251
+ trailing?: React.ReactNode;
252
+ /** Minimum textarea rows before it grows. Default 2. */
253
+ minRows?: number;
254
+ /** Max pixel height before the textarea scrolls. Default 200. */
255
+ maxHeight?: number;
256
+ className?: string;
257
+ sendLabel?: string;
258
+ autoFocus?: boolean;
162
259
  }
163
- declare const HARNESS_MODEL_POLICIES: Partial<Record<HarnessType, HarnessModelPolicy>>;
164
- /** Provider prefix of a canonical id ("anthropic/claude-…" → "anthropic"). */
165
- declare function modelProvider(modelId: string): string | null;
166
260
  /**
167
- * Ids without a provider prefix (consumer sentinels like "default",
168
- * or an empty selection) are treated as compatible everywhere — they
169
- * mean "the session's own configuration", which every harness honors.
261
+ * The canonical agent chat input: one rounded surface holding an auto-growing
262
+ * textarea, the embedded control strip (profile · harness · model · effort) at
263
+ * the bottom-left, and the send button at the bottom-right. The strip's pickers
264
+ * snap the harness↔model pair automatically; which controls appear is driven
265
+ * purely by which control objects are passed, so the same component is the
266
+ * router-backed composer (no harness) and the sandbox-backed one (with harness).
170
267
  */
171
- declare function isModelCompatibleWithHarness(harness: HarnessType, modelId: string): boolean;
268
+ declare function AgentComposer({ value, onChange, onSubmit, placeholder, disabled, busy, harness, profile, model, reasoning, context, trailing, minRows, maxHeight, className, sendLabel, autoFocus, }: AgentComposerProps): react_jsx_runtime.JSX.Element;
269
+
172
270
  /**
173
- * Keeps `modelId` when the harness can run it; otherwise returns the
174
- * harness's best compatible catalog model (preferred patterns in order,
175
- * highest version within a pattern). When the catalog holds nothing
176
- * compatible the original id is returned unchanged — the caller sees
177
- * the incompatibility instead of a silent wrong substitution.
271
+ * Whether `harness` can run `modelId`. Router-backed harnesses, and provider-less
272
+ * sentinel ids (like "default" or an empty selection — "the session's own
273
+ * configuration"), are compatible with everything.
178
274
  */
179
- declare function snapModelToHarness(harness: HarnessType, modelId: string, models: ReadonlyArray<ModelInfo>): string;
275
+ declare function isModelCompatibleWithHarness(harness: HarnessType, modelId: string): boolean;
180
276
  /**
181
- * Keeps the harness when it can run `modelId`; otherwise returns the
182
- * model's native harness (anthropic → claude-code, openai → codex),
183
- * falling back to the router-backed opencode for everything else.
277
+ * Keeps `modelId` when the harness can run it; otherwise returns the harness's
278
+ * best compatible model from the loaded catalog (preferred patterns in order,
279
+ * highest version within a pattern). Adapts the picker's `ModelInfo[]` to the
280
+ * canonical id list `agent-interface` ranks over; when the catalog holds nothing
281
+ * compatible the original id is returned unchanged.
184
282
  */
185
- declare function snapHarnessToModel(harness: HarnessType, modelId: string): HarnessType;
283
+ declare function snapModelToHarness(harness: HarnessType, modelId: string, models: ReadonlyArray<ModelInfo>): string;
186
284
 
187
285
  type ArtifactKind = string;
188
286
  interface ArtifactScope {
@@ -281,4 +379,4 @@ declare function createFetchTransport(opts: {
281
379
  fetchImpl?: typeof fetch;
282
380
  }): ArtifactAgentDockTransport;
283
381
 
284
- 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, HARNESS_MODEL_POLICIES, type ReasoningLevel, type ReasoningLevelOption, ReasoningLevelPicker, type ReasoningLevelPickerProps, createFetchTransport, isModelCompatibleWithHarness, modelProvider, snapHarnessToModel, snapModelToHarness };
382
+ 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, 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,
@@ -6,7 +8,6 @@ import {
6
8
  ChatInput,
7
9
  ChatMessage,
8
10
  DEFAULT_REASONING_LEVEL_OPTIONS,
9
- HARNESS_MODEL_POLICIES,
10
11
  MessageList,
11
12
  ReasoningLevelPicker,
12
13
  ThinkingIndicator,
@@ -16,12 +17,14 @@ import {
16
17
  modelProvider,
17
18
  snapHarnessToModel,
18
19
  snapModelToHarness
19
- } from "./chunk-NHHYPID3.js";
20
+ } from "./chunk-4XOZGMJC.js";
20
21
  import "./chunk-HU4B2M4K.js";
21
22
  import "./chunk-SF6LPMMN.js";
22
23
  import "./chunk-EI44GEQ5.js";
23
24
  import "./chunk-U67V476Y.js";
24
25
  export {
26
+ AgentComposer,
27
+ AgentProfilePicker,
25
28
  AgentSessionControls,
26
29
  AgentTimeline,
27
30
  ArtifactAgentDock,
@@ -29,7 +32,6 @@ export {
29
32
  ChatInput,
30
33
  ChatMessage,
31
34
  DEFAULT_REASONING_LEVEL_OPTIONS,
32
- HARNESS_MODEL_POLICIES,
33
35
  MessageList,
34
36
  ReasoningLevelPicker,
35
37
  ThinkingIndicator,