@theoremjs/studio 0.3.4-next.671.gfa09ab2 → 0.3.4-next.675.g8fb1e99
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/cookbooks/catalog.js +8 -7
- package/cookbooks/checks.js +1 -0
- package/guardrail-probe.js +9 -2
- package/package.json +4 -4
- package/page/assets/{Banner-DEVAsFER.js → Banner-DiOg17AQ.js} +2 -2
- package/page/assets/{ConsoleFrame-CqUUcrR4.js → ConsoleFrame-C13R-L2Z.js} +1 -1
- package/page/assets/{MenuBottomSheet-DOa09vl1.js → MenuBottomSheet-BTPBDpHv.js} +1 -1
- package/page/assets/{SchemaFields-CMwMU1Px.js → SchemaFields-DksqrFuf.js} +1 -1
- package/page/assets/{ToolResultCharts-CW23-D1x.js → ToolResultCharts-WBuj3MW0.js} +1 -1
- package/page/assets/{TraceInspector-h030OQ82.js → TraceInspector-DRvjgOYF.js} +1 -1
- package/page/assets/{TraceOverview-BsON_uZj.js → TraceOverview-BZSLGRPK.js} +1 -1
- package/page/assets/{browser-engine-Cf6d-zNH.js → browser-engine-BAknhbQ-.js} +2 -2
- package/page/assets/{browser-transport-BK4cbTE_.js → browser-transport-Dj3RTQ-7.js} +3 -3
- package/page/assets/{export-agent-CaHsJPsM.js → export-agent-C3UFSvAV.js} +1 -1
- package/page/assets/{guardrail-tester-BDhFLvT5.js → guardrail-tester-CrmEcfe3.js} +1 -1
- package/page/assets/{index-CqwmMJ4C.js → index-BiUL_BB0.js} +68 -68
- package/page/assets/{studio-code-pane-C1wH63Y2.js → studio-code-pane-BUnZ-nyH.js} +1 -1
- package/page/assets/{studio-console-DRzo4yTy.js → studio-console-CF3Za8Sk.js} +1 -1
- package/page/assets/{studio-decision-C7QWMm7Q.js → studio-decision-BmaWGwEu.js} +1 -1
- package/page/assets/{studio-embedding-D8KroBXY.js → studio-embedding-Cd3yEFlB.js} +1 -1
- package/page/assets/{studio-host-console-HkX8BerX.js → studio-host-console-0IPDRoKm.js} +2 -2
- package/page/assets/{studio-labels-6w1SKC2D.js → studio-labels-CxSf1u11.js} +1 -1
- package/page/assets/{studio-live-BmVeXAu4.js → studio-live-B0o_bzUb.js} +1 -1
- package/page/assets/{studio-map-5ZU1nicW.js → studio-map-CtatHv_H.js} +1 -1
- package/page/assets/{studio-trace-replay-CSbJSN5e.js → studio-trace-replay-C5r8dJPd.js} +1 -1
- package/page/assets/{use-one-call-Br2IVJLU.js → use-one-call-AWAsf3G3.js} +1 -1
- package/page/index.html +4 -4
- package/source.js +2 -2
- package/surface.js +2 -3
- package/ui/studio-compare.js +52 -24
package/ui/studio-compare.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Center } from '@astryxdesign/core/Center';
|
|
3
|
+
import { ComplexSelector } from '@astryxdesign/core/ComplexSelector';
|
|
3
4
|
import { Divider } from '@astryxdesign/core/Divider';
|
|
4
5
|
import { HStack } from '@astryxdesign/core/HStack';
|
|
5
6
|
import { Icon } from '@astryxdesign/core/Icon';
|
|
6
7
|
import { IconButton } from '@astryxdesign/core/IconButton';
|
|
8
|
+
import { RadioList, RadioListItem } from '@astryxdesign/core/RadioList';
|
|
7
9
|
import { StackItem } from '@astryxdesign/core/Stack';
|
|
8
10
|
import { Text } from '@astryxdesign/core/Text';
|
|
9
11
|
import { VStack } from '@astryxdesign/core/VStack';
|
|
10
|
-
import { IconLayoutSidebarLeftCollapse, IconLayoutSidebarLeftExpand } from '@tabler/icons-react';
|
|
12
|
+
import { IconInputAi, IconLayoutSidebarLeftCollapse, IconLayoutSidebarLeftExpand, } from '@tabler/icons-react';
|
|
11
13
|
import { createComposerPendingMessage, orderComposerPendingMessages, removeComposerPendingMessage, } from '@theoremjs/agents/interface';
|
|
12
|
-
import { ChatComposerBar, DEFAULT_CHAT_MAX_WIDTH, InPlace, PaneFailure, PaneLoading, TheoremChat, } from '@theoremjs/react/ui';
|
|
13
|
-
import { clientFailure, composerFieldsFromDraft, composerHasPayload, createHttpTransport, createTraceFeed, encodeComposerDraft,
|
|
14
|
+
import { ChatComposerBar, DEFAULT_CHAT_MAX_WIDTH, generationOptions, InPlace, PaneFailure, PaneLoading, TheoremChat, } from '@theoremjs/react/ui';
|
|
15
|
+
import { clientFailure, composerFieldsFromDraft, composerHasPayload, createHttpTransport, createTraceFeed, encodeComposerDraft, } from '@theoremjs/web/client';
|
|
14
16
|
import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState, useSyncExternalStore, } from 'react';
|
|
15
17
|
import { atStart } from "../mod.js";
|
|
16
18
|
import { useActingAs } from "./lib/acting-as.js";
|
|
@@ -194,10 +196,52 @@ function pairPending(states) {
|
|
|
194
196
|
}
|
|
195
197
|
/** Whether a side's running turn would take a steer now. */
|
|
196
198
|
const takesSteer = (state) => state.phase === 'streaming' && allowsSteering(state);
|
|
199
|
+
/** A side's name where the two are named in a line. */
|
|
200
|
+
const SIDE_NAMES = { saved: 'Saved', edited: 'Edited' };
|
|
201
|
+
/** One column of the model control: what this side's own composer offers, and it alone. */
|
|
202
|
+
function SideGeneration({ side, chat, state }) {
|
|
203
|
+
const { selectedModel, selectedEffort } = state.session;
|
|
204
|
+
if (!state.iface)
|
|
205
|
+
return null;
|
|
206
|
+
const { models, efforts } = generationOptions(state.iface, selectedModel);
|
|
207
|
+
const isDisabled = state.phase === 'streaming';
|
|
208
|
+
return (_jsxs(VStack, { gap: 3, style: { flex: '1 1 12rem', minWidth: 0 }, children: [models.length > 0 ? (_jsx(RadioList, { label: SIDE_NAMES[side], size: "sm", isDisabled: isDisabled, value: selectedModel ?? '', onChange: (modelId) => {
|
|
209
|
+
chat.setGeneration({ modelId });
|
|
210
|
+
}, children: models.map((model) => (_jsx(RadioListItem, { value: model.id, label: model.id, description: model.label === model.id ? undefined : model.label }, model.id))) })) : (_jsxs(VStack, { gap: 1, children: [_jsx(Text, { type: "supporting", weight: "semibold", children: SIDE_NAMES[side] }), _jsx(Text, { type: "supporting", color: "secondary", children: selectedModel })] })), selectedModel && efforts.length > 0 && (_jsx(RadioList, { label: "Effort", size: "sm", isDisabled: isDisabled, value: selectedEffort ?? '', onChange: (effort) => {
|
|
211
|
+
chat.setGeneration({ modelId: selectedModel, effort });
|
|
212
|
+
}, children: efforts.map((option) => (_jsx(RadioListItem, { value: option.alias, label: option.alias, description: option.level }, option.alias))) }))] }));
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* The composer's model control when two chats share it: each side's choices, side by side. A pick
|
|
216
|
+
* is that side's, held by its chat, as its own composer would hold it.
|
|
217
|
+
*/
|
|
218
|
+
function PairGeneration({ sides }) {
|
|
219
|
+
const offered = sides.filter(({ state }) => {
|
|
220
|
+
const { models, efforts } = state.iface
|
|
221
|
+
? generationOptions(state.iface, state.session.selectedModel)
|
|
222
|
+
: { models: [], efforts: [] };
|
|
223
|
+
return models.length + efforts.length > 0;
|
|
224
|
+
});
|
|
225
|
+
if (offered.length === 0)
|
|
226
|
+
return null;
|
|
227
|
+
const running = sides.flatMap(({ side, state }) => {
|
|
228
|
+
const model = state.session.selectedModel;
|
|
229
|
+
return model ? [{ side, model }] : [];
|
|
230
|
+
});
|
|
231
|
+
const label = new Set(running.map(({ model }) => model)).size === 1
|
|
232
|
+
? running[0].model
|
|
233
|
+
: running.map(({ side, model }) => `${SIDE_NAMES[side]} ${model}`).join(' · ');
|
|
234
|
+
return (_jsx(ComplexSelector, { label: "Model", isLabelHidden: true, size: "sm", variant: "ghost", placement: "above", startIcon: _jsx(IconInputAi, { size: 14 }), value: label, triggerLabel: label, children: () => (_jsx(HStack, { gap: 4, padding: 3, wrap: "wrap", style: {
|
|
235
|
+
width: 'min(32rem, calc(100vw - 2rem))',
|
|
236
|
+
maxHeight: 'min(60vh, 28rem)',
|
|
237
|
+
overflowY: 'auto',
|
|
238
|
+
}, children: sides.map((side) => (_jsx(SideGeneration, { ...side }, side.side))) })) }));
|
|
239
|
+
}
|
|
197
240
|
/**
|
|
198
241
|
* The one composer of both sides. It only types for them: each side does with what is sent what
|
|
199
242
|
* its own composer would. An idle side sends it, a busy one queues it; a steer goes to each side
|
|
200
|
-
* whose running turn takes one; and each side refuses a
|
|
243
|
+
* whose running turn takes one; and each side refuses a file its profile does not take. The model
|
|
244
|
+
* is each side's own.
|
|
201
245
|
*/
|
|
202
246
|
function SharedComposer({ sides, edited, inputRef, }) {
|
|
203
247
|
const iface = edited.iface ?? undefined;
|
|
@@ -205,19 +249,11 @@ function SharedComposer({ sides, edited, inputRef, }) {
|
|
|
205
249
|
const [pendingFiles, setPendingFiles] = useState([]);
|
|
206
250
|
const [pendingVoice, setPendingVoice] = useState([]);
|
|
207
251
|
const [failure, setFailure] = useState(null);
|
|
208
|
-
const [pick, setPick] = useState({ isChosen: false });
|
|
209
|
-
// The pick follows the edited side's profile as a chat's own composer follows its profile.
|
|
210
|
-
if (iface && pick.of !== iface) {
|
|
211
|
-
const next = followGenerationDefaults(iface, pick, pick.of);
|
|
212
|
-
setPick({ ...next, of: iface, isChosen: pick.isChosen && next.model === pick.model });
|
|
213
|
-
}
|
|
214
252
|
const states = sides.map((side) => side.state);
|
|
215
253
|
const phase = pairPhase(states);
|
|
216
254
|
if (!iface)
|
|
217
255
|
return null;
|
|
218
|
-
|
|
219
|
-
const chosen = pick.isChosen ? { model: pick.model, effort: pick.effort } : {};
|
|
220
|
-
const options = () => ({ files: pendingFiles, voice: pendingVoice, ...chosen });
|
|
256
|
+
const options = () => ({ files: pendingFiles, voice: pendingVoice });
|
|
221
257
|
const message = async (kind) => createComposerPendingMessage({
|
|
222
258
|
kind,
|
|
223
259
|
draft: await encodeComposerDraft({ text: draftText, pendingFiles, pendingVoice }),
|
|
@@ -227,10 +263,6 @@ function SharedComposer({ sides, edited, inputRef, }) {
|
|
|
227
263
|
setPendingFiles([]);
|
|
228
264
|
setPendingVoice([]);
|
|
229
265
|
};
|
|
230
|
-
const takePick = (chat) => {
|
|
231
|
-
if (chosen.model !== undefined)
|
|
232
|
-
chat.setGeneration({ modelId: chosen.model, effort: chosen.effort });
|
|
233
|
-
};
|
|
234
266
|
/** Each side as its own composer would: an idle side sends, a busy one takes `kind`. */
|
|
235
267
|
const deliver = async (kind) => {
|
|
236
268
|
const text = draftText;
|
|
@@ -261,7 +293,6 @@ function SharedComposer({ sides, edited, inputRef, }) {
|
|
|
261
293
|
void chat.sendText(text, sent);
|
|
262
294
|
continue;
|
|
263
295
|
}
|
|
264
|
-
takePick(chat);
|
|
265
296
|
void (kind === 'send_now' ? chat.sendNow(shared) : chat.pend(shared));
|
|
266
297
|
}
|
|
267
298
|
};
|
|
@@ -279,7 +310,7 @@ function SharedComposer({ sides, edited, inputRef, }) {
|
|
|
279
310
|
...('allowSteering' in iface
|
|
280
311
|
? { allowSteering: sides.some(({ state }) => takesSteer(state)) }
|
|
281
312
|
: {}),
|
|
282
|
-
}, draftText: draftText, pendingFiles: pendingFiles, pendingVoice: pendingVoice, pendingMessages: pending, issues: [], phase: phase, failure: failure,
|
|
313
|
+
}, draftText: draftText, pendingFiles: pendingFiles, pendingVoice: pendingVoice, pendingMessages: pending, issues: [], phase: phase, failure: failure, placeholder: "Message both", inputRef: inputRef, onDraftTextChange: setDraftText, onFilesSelected: (files) => {
|
|
283
314
|
setPendingFiles((prev) => [...prev, ...files]);
|
|
284
315
|
}, onAttachmentRemove: (index) => {
|
|
285
316
|
setPendingFiles((prev) => prev.filter((_, at) => at !== index));
|
|
@@ -295,9 +326,7 @@ function SharedComposer({ sides, edited, inputRef, }) {
|
|
|
295
326
|
});
|
|
296
327
|
}, onMenuAction: (action) => {
|
|
297
328
|
void deliver(action);
|
|
298
|
-
},
|
|
299
|
-
setPick({ model: next.modelId, effort: next.effort, of: iface, isChosen: true });
|
|
300
|
-
}, slotChoices: edited.slots && {
|
|
329
|
+
}, generationSelect: _jsx(PairGeneration, { sides: sides }), slotChoices: edited.slots && {
|
|
301
330
|
...edited.slots,
|
|
302
331
|
onChange: (name, value) => {
|
|
303
332
|
each((chat) => {
|
|
@@ -337,7 +366,6 @@ function SharedComposer({ sides, edited, inputRef, }) {
|
|
|
337
366
|
const held = state.pendingMessages.find((m) => m.id === id);
|
|
338
367
|
if (!held)
|
|
339
368
|
continue;
|
|
340
|
-
takePick(chat);
|
|
341
369
|
void chat.sendNow(held);
|
|
342
370
|
}
|
|
343
371
|
} }) }));
|
|
@@ -496,7 +524,7 @@ export function ProjectChat(props) {
|
|
|
496
524
|
const shared = SIDES.flatMap((side) => {
|
|
497
525
|
const chat = pair.chats[side];
|
|
498
526
|
const state = pair.states[side];
|
|
499
|
-
return chat && state ? [{ chat, state }] : [];
|
|
527
|
+
return chat && state ? [{ side, chat, state }] : [];
|
|
500
528
|
});
|
|
501
529
|
const common = {
|
|
502
530
|
detectCodeLanguage: true,
|