@tangle-network/sandbox-ui 0.20.3 → 0.21.1

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
@@ -1,6 +1,9 @@
1
1
  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
+ import * as React from 'react';
5
+ import { M as ModelInfo } from './model-picker-DUfMTQo5.js';
6
+ import { e as HarnessType } from './harness-picker-C1W3rTeb.js';
4
7
 
5
8
  type ReasoningLevel = "auto" | "low" | "medium" | "high";
6
9
  interface ReasoningLevelOption {
@@ -19,6 +22,113 @@ interface ReasoningLevelPickerProps {
19
22
  declare const DEFAULT_REASONING_LEVEL_OPTIONS: ReadonlyArray<ReasoningLevelOption>;
20
23
  declare function ReasoningLevelPicker({ value, onChange, disabled, className, triggerClassName, options, }: ReasoningLevelPickerProps): react_jsx_runtime.JSX.Element;
21
24
 
25
+ interface AgentSessionHarnessControl {
26
+ value: HarnessType;
27
+ onChange: (next: HarnessType) => void;
28
+ /** Filter the selectable harnesses (e.g. by plan tier). Defaults to all. */
29
+ available?: ReadonlyArray<HarnessType>;
30
+ disabled?: boolean;
31
+ /**
32
+ * A harness is bound to its chat session once the conversation has
33
+ * started. While locked the dropdown is inert and the model catalog
34
+ * is filtered to what this harness can run — fork the session to
35
+ * switch harness.
36
+ */
37
+ locked?: boolean;
38
+ /** Tooltip shown on the locked trigger. */
39
+ lockReason?: string;
40
+ }
41
+ interface AgentSessionModelControl {
42
+ /** Canonical model id (provider-prefixed, e.g. "anthropic/claude-opus-4-8"). */
43
+ value: string;
44
+ onChange: (modelId: string) => void;
45
+ /** Models to choose from. Pass `[]` while loading. */
46
+ models: ModelInfo[];
47
+ loading?: boolean;
48
+ popular?: ReadonlyArray<string>;
49
+ recents?: ReadonlyArray<string>;
50
+ disabled?: boolean;
51
+ }
52
+ interface AgentSessionReasoningControl {
53
+ value: ReasoningLevel;
54
+ onChange: (value: ReasoningLevel) => void;
55
+ options?: ReadonlyArray<ReasoningLevelOption>;
56
+ disabled?: boolean;
57
+ }
58
+ interface AgentSessionControlsProps {
59
+ /**
60
+ * Harness (agent backend) selection. Switching harness usually means
61
+ * re-creating the agent session — the consumer owns that lifecycle.
62
+ */
63
+ harness?: AgentSessionHarnessControl;
64
+ /** Per-turn model override, fed by the router's model catalog. */
65
+ model?: AgentSessionModelControl;
66
+ /** Thinking-effort level applied to subsequent turns. */
67
+ reasoning?: AgentSessionReasoningControl;
68
+ /** Right-aligned extra content (token meter, cost, status). */
69
+ trailing?: React.ReactNode;
70
+ className?: string;
71
+ }
72
+ /**
73
+ * Compact control strip for an agent chat composer: harness, model, and
74
+ * thinking-effort pickers in one row. Every section is optional and only
75
+ * renders when its control object is provided — never show a dead control.
76
+ *
77
+ * When BOTH harness and model controls are present the pair is kept
78
+ * coherent automatically (see harness-model-compat): picking a harness
79
+ * snaps an incompatible model to that harness's best catalog option;
80
+ * picking a model the current harness can't run switches to the model's
81
+ * native harness — unless the harness is `locked`, in which case the
82
+ * catalog itself is filtered to compatible models.
83
+ *
84
+ * Designed to slot into `SandboxWorkbench`'s `session.composerControls`.
85
+ */
86
+ declare function AgentSessionControls({ harness, model, reasoning, trailing, className, }: AgentSessionControlsProps): react_jsx_runtime.JSX.Element | null;
87
+
88
+ /**
89
+ * Harness ↔ model compatibility policy.
90
+ *
91
+ * Native CLI harnesses are vendor-locked: claude-code only drives
92
+ * Anthropic models, codex only OpenAI models. Router-backed harnesses
93
+ * (opencode) accept any catalog model. The pickers use this policy to
94
+ * keep the pair coherent: changing one side snaps the other to its
95
+ * nearest compatible choice instead of letting the user assemble a
96
+ * combination that fails at inference time.
97
+ */
98
+ interface HarnessModelPolicy {
99
+ /** Canonical-id provider prefixes the harness can run; null = any. */
100
+ providers: ReadonlyArray<string> | null;
101
+ /**
102
+ * Patterns ranking snap targets, best first. Within one pattern's
103
+ * matches the highest version (numeric-aware descending sort) wins,
104
+ * so "latest standard frontier" stays correct as catalogs rotate.
105
+ */
106
+ preferred: ReadonlyArray<RegExp>;
107
+ }
108
+ declare const HARNESS_MODEL_POLICIES: Record<HarnessType, HarnessModelPolicy>;
109
+ /** Provider prefix of a canonical id ("anthropic/claude-…" → "anthropic"). */
110
+ declare function modelProvider(modelId: string): string | null;
111
+ /**
112
+ * Ids without a provider prefix (consumer sentinels like "default",
113
+ * or an empty selection) are treated as compatible everywhere — they
114
+ * mean "the session's own configuration", which every harness honors.
115
+ */
116
+ declare function isModelCompatibleWithHarness(harness: HarnessType, modelId: string): boolean;
117
+ /**
118
+ * Keeps `modelId` when the harness can run it; otherwise returns the
119
+ * harness's best compatible catalog model (preferred patterns in order,
120
+ * highest version within a pattern). When the catalog holds nothing
121
+ * compatible the original id is returned unchanged — the caller sees
122
+ * the incompatibility instead of a silent wrong substitution.
123
+ */
124
+ declare function snapModelToHarness(harness: HarnessType, modelId: string, models: ReadonlyArray<ModelInfo>): string;
125
+ /**
126
+ * Keeps the harness when it can run `modelId`; otherwise returns the
127
+ * model's native harness (anthropic → claude-code, openai → codex),
128
+ * falling back to the router-backed opencode for everything else.
129
+ */
130
+ declare function snapHarnessToModel(harness: HarnessType, modelId: string): HarnessType;
131
+
22
132
  type ArtifactKind = string;
23
133
  interface ArtifactScope {
24
134
  kind: ArtifactKind;
@@ -116,4 +226,4 @@ declare function createFetchTransport(opts: {
116
226
  fetchImpl?: typeof fetch;
117
227
  }): ArtifactAgentDockTransport;
118
228
 
119
- export { 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 };
229
+ 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 };
package/dist/chat.js CHANGED
@@ -1,27 +1,41 @@
1
1
  import {
2
+ AgentSessionControls,
2
3
  AgentTimeline,
3
4
  ArtifactAgentDock,
4
5
  ChatContainer,
5
6
  ChatInput,
6
7
  ChatMessage,
7
8
  DEFAULT_REASONING_LEVEL_OPTIONS,
9
+ HARNESS_MODEL_POLICIES,
8
10
  MessageList,
9
11
  ReasoningLevelPicker,
10
12
  ThinkingIndicator,
11
13
  UserMessage,
12
- createFetchTransport
13
- } from "./chunk-MQ52AYJX.js";
14
+ createFetchTransport,
15
+ isModelCompatibleWithHarness,
16
+ modelProvider,
17
+ snapHarnessToModel,
18
+ snapModelToHarness
19
+ } from "./chunk-TAAYDQGM.js";
20
+ import "./chunk-ESRYVGHF.js";
21
+ import "./chunk-4KAPMTPU.js";
14
22
  import "./chunk-EI44GEQ5.js";
15
23
  export {
24
+ AgentSessionControls,
16
25
  AgentTimeline,
17
26
  ArtifactAgentDock,
18
27
  ChatContainer,
19
28
  ChatInput,
20
29
  ChatMessage,
21
30
  DEFAULT_REASONING_LEVEL_OPTIONS,
31
+ HARNESS_MODEL_POLICIES,
22
32
  MessageList,
23
33
  ReasoningLevelPicker,
24
34
  ThinkingIndicator,
25
35
  UserMessage,
26
- createFetchTransport
36
+ createFetchTransport,
37
+ isModelCompatibleWithHarness,
38
+ modelProvider,
39
+ snapHarnessToModel,
40
+ snapModelToHarness
27
41
  };