@theoremjs/studio 0.3.5-next.943.g77aa4ba → 0.3.5-next.944.ga2c173d
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/package.json +4 -4
- package/page/assets/{BottomSheet-QaKqG4jF.js → BottomSheet-CfyE0w-r.js} +1 -1
- package/page/assets/{ConsoleFrame-cb9_ArXw.js → ConsoleFrame-DwTZM3AW.js} +1 -1
- package/page/assets/{ContextMenu-BnbiZucy.js → ContextMenu-BElIZZ9K.js} +2 -2
- package/page/assets/{DateInput-stobICzZ.js → DateInput-B4PkJTOC.js} +1 -1
- package/page/assets/{DropdownMenu-BzGltiAm.js → DropdownMenu-sdEMwy5-.js} +2 -2
- package/page/assets/{Link-BtTmEbdB.js → Link-Bwx99KED.js} +1 -1
- package/page/assets/{MenuBottomSheet-B9NN63O3.js → MenuBottomSheet-CbaOpF6E.js} +1 -1
- package/page/assets/{PowerSearchBottomSheet-BOV5GdgP.js → PowerSearchBottomSheet-CvgfrrE7.js} +1 -1
- package/page/assets/{RankedBars-1VZsRbhd.js → RankedBars-BJvXYPcR.js} +1 -1
- package/page/assets/{SchemaFields-Dyitt-M1.js → SchemaFields-CSh7ENRR.js} +1 -1
- package/page/assets/{ShapedData-BBnTz3mS.js → ShapedData-BDH9JGV_.js} +1 -1
- package/page/assets/{TokenizerBottomSheet-BoLsFTK4.js → TokenizerBottomSheet-BIzG42Od.js} +1 -1
- package/page/assets/{ToolResultCharts-CguMnOa6.js → ToolResultCharts-BCMNB4f4.js} +1 -1
- package/page/assets/{Toolbar-CgDahCAm.js → Toolbar-Dt81WVc0.js} +1 -1
- package/page/assets/{TraceInspector-DQDlkN8V.js → TraceInspector-CjTdvIBp.js} +2 -2
- package/page/assets/{TraceOverview-DJ83CvfS.js → TraceOverview-Bbawxiz2.js} +1 -1
- package/page/assets/{browser-engine-D8Rivwgl.js → browser-engine-BW7GJjxS.js} +1 -1
- package/page/assets/{browser-transport-CMhiaeC7.js → browser-transport-CT6ZWQK5.js} +2 -2
- package/page/assets/{export-agent-ALLh0kKl.js → export-agent-BUoPfYE-.js} +1 -1
- package/page/assets/{getRadiusAndStrokeWidthFromDot-BvXM31yx.js → getRadiusAndStrokeWidthFromDot-DMVgxqX7.js} +1 -1
- package/page/assets/{guardrail-health-D7-D9qD4.js → guardrail-health-CBcBFGCX.js} +1 -1
- package/page/assets/{guardrail-tester-BuLSv10M.js → guardrail-tester-mczav8TA.js} +1 -1
- package/page/assets/{index-Betmdih_.js → index-BfavtHSt.js} +9 -9
- package/page/assets/{json-code-DHq_KoDO.js → json-code-Dk4qhJaT.js} +1 -1
- package/page/assets/{prompt-row-C9JPS5tx.js → prompt-row-B9zXphWo.js} +1 -1
- package/page/assets/{studio-code-pane-CDOgmTL7.js → studio-code-pane-BIyWWswX.js} +1 -1
- package/page/assets/{studio-console-BRjSBukh.js → studio-console-DyPVXKGZ.js} +1 -1
- package/page/assets/{studio-decision-DppsKqW1.js → studio-decision-DxuVeQON.js} +1 -1
- package/page/assets/{studio-embedding-B8u6gSzU.js → studio-embedding-DXWm_a-U.js} +1 -1
- package/page/assets/{studio-host-console-tH9YxROO.js → studio-host-console-Ce0wqWbV.js} +2 -2
- package/page/assets/{studio-live-BDv02GUw.js → studio-live-BNlvfNcH.js} +1 -1
- package/page/assets/{studio-map-DpnUD0nn.js → studio-map-CNbAClNl.js} +1 -1
- package/page/assets/{studio-media-BpPswiCJ.js → studio-media-Bet4t81W.js} +1 -1
- package/page/assets/{studio-trace-replay-Ub7bAl25.js → studio-trace-replay-b3GyHod3.js} +1 -1
- package/page/assets/{use-one-call-WBouz5ih.js → use-one-call-BCWLhTUh.js} +1 -1
- package/page/assets/{useDismissSearchOnTouchDrag-CqBTrJGJ.js → useDismissSearchOnTouchDrag-DVWbTCX7.js} +1 -1
- package/page/index.html +7 -7
- package/ui/lib/studio-page.d.ts +5 -0
- package/ui/lib/studio-page.js +17 -11
- package/ui/profile-editor.js +11 -11
package/ui/lib/studio-page.js
CHANGED
|
@@ -51,29 +51,35 @@ export function pageInputsOf(payload) {
|
|
|
51
51
|
return null;
|
|
52
52
|
return { person, code, takesContext, pageTools };
|
|
53
53
|
}
|
|
54
|
-
/**
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
/**
|
|
55
|
+
* The value an option states. One the code states goes unset until picked, as code may leave it;
|
|
56
|
+
* one a person picks holds its first value until picked, as the chat's own picker does.
|
|
57
|
+
*/
|
|
58
|
+
export function pickedValue(allowed, picked, isPersonsPick) {
|
|
59
|
+
const value = allowed.find((each) => each === picked);
|
|
60
|
+
return value ?? (isPersonsPick ? allowed.at(0) : undefined);
|
|
57
61
|
}
|
|
58
|
-
/** Each option's
|
|
59
|
-
function picksOf(declared, values) {
|
|
60
|
-
return Object.fromEntries(Object.entries(declared).
|
|
61
|
-
name,
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
/** Each option's value; one left unset is not sent. */
|
|
63
|
+
function picksOf(declared, values, isPersonsPick) {
|
|
64
|
+
return Object.fromEntries(Object.entries(declared).flatMap(([name, allowed]) => {
|
|
65
|
+
const value = pickedValue(allowed, values.options[name], isPersonsPick);
|
|
66
|
+
return value === undefined ? [] : [[name, value]];
|
|
67
|
+
}));
|
|
64
68
|
}
|
|
65
69
|
/** The turn's path and options as picked: the `path` option is the turn's own path. */
|
|
66
70
|
function statedTurn(inputs, values) {
|
|
67
71
|
if (!Object.keys(inputs.code).length)
|
|
68
72
|
return undefined;
|
|
69
|
-
const { path, ...options } = picksOf(inputs.code, values);
|
|
73
|
+
const { path, ...options } = picksOf(inputs.code, values, false);
|
|
70
74
|
return { ...(path === undefined ? {} : { path }), options };
|
|
71
75
|
}
|
|
72
76
|
/** What goes with a turn or a call. Context that is not JSON is not sent, and says why. */
|
|
73
77
|
export function sentPageValues(inputs, values) {
|
|
74
78
|
if (!inputs)
|
|
75
79
|
return {};
|
|
76
|
-
const options = Object.keys(inputs.person).length
|
|
80
|
+
const options = Object.keys(inputs.person).length
|
|
81
|
+
? picksOf(inputs.person, values, true)
|
|
82
|
+
: undefined;
|
|
77
83
|
const stated = statedTurn(inputs, values);
|
|
78
84
|
const sent = { options, ...(stated ? { stated } : {}) };
|
|
79
85
|
const typed = inputs.takesContext ? values.contextJson.trim() : '';
|
package/ui/profile-editor.js
CHANGED
|
@@ -35,7 +35,7 @@ import { AddProviderButton } from "./add-provider.js";
|
|
|
35
35
|
import { IconGoogle, IconOpenAi, IconOpenRouter, IconTypeSafe } from "./brand-icons.js";
|
|
36
36
|
import { ChoiceRow, EntriesRow, InspectorGroupTitle, InspectorRow, InspectorSection, JsonRow, LABEL_COLUMN, ListRow, NamesInput, NamesRow, NumberRow, OriginLine, OwnField, SegmentedRow, SetInCode, SliderRow, SwitchRow, TextAreaRow, TextRow, WideRow, } from "./inspector.js";
|
|
37
37
|
import { GuardrailTest, LeavePage, ListBadges, LocalConnection, NodeIssues, QuestionLink, RowOrigins, RunsOn, SaidOrigin, useFieldStatus, useRowOrigin, WorkspaceContext, } from "./inspector-context.js";
|
|
38
|
-
import { CONTEXT_PLACEHOLDER, contextErrorOf, usePageValues } from "./lib/studio-page.js";
|
|
38
|
+
import { CONTEXT_PLACEHOLDER, contextErrorOf, pickedValue, usePageValues, } from "./lib/studio-page.js";
|
|
39
39
|
import { useProject } from "./lib/studio-project.js";
|
|
40
40
|
import { setToolCredential, subscribeToolCredentials, toolCredential, } from "./lib/tool-credentials.js";
|
|
41
41
|
import { runToolProbe } from "./lib/tool-probe.js";
|
|
@@ -183,14 +183,9 @@ function SystemPromptSection({ identity, canShowOptions, set, }) {
|
|
|
183
183
|
set({ system });
|
|
184
184
|
} }) })] }));
|
|
185
185
|
}
|
|
186
|
-
/** The value an option states: the page's pick while the option still takes it, or its first. */
|
|
187
|
-
const statedValue = (option, picked) => {
|
|
188
|
-
const values = option.choices.map(({ value }) => value);
|
|
189
|
-
return values.find((value) => value === picked) ?? values[0];
|
|
190
|
-
};
|
|
191
186
|
/** A value's hover: what the catalog says of it, then what pressing it does here. */
|
|
192
|
-
const valueHint = (meta) => ({
|
|
193
|
-
marked: `${meta?.doc ?? ''} The studio states this value
|
|
187
|
+
const valueHint = (meta, canUnset) => ({
|
|
188
|
+
marked: `${meta?.doc ?? ''} The studio states this value.${canUnset ? ' Press to leave it unset.' : ''}`.trim(),
|
|
194
189
|
other: `${meta?.doc ?? ''} Press to state this value.`.trim(),
|
|
195
190
|
});
|
|
196
191
|
const OPTION_FIELDS_WIDTH = 320;
|
|
@@ -232,15 +227,20 @@ function OptionRow({ option, at, canShow, stated, onState, onChange, onRemove, }
|
|
|
232
227
|
onChange({ name });
|
|
233
228
|
} }) }) }) }), _jsx(StackItem, { size: "fill", children: _jsx(NamesInput, { label: `${row} values`, value: option.choices.map(({ value }) => value), placeholder: "free", overflow: "none", marked: stated, onMark: onState, markHint: valueHint(option.isShownInChat
|
|
234
229
|
? fieldMeta('inputs.options.*.choices.*.value')
|
|
235
|
-
: fieldMeta('identity.options.*.choices.*.value')), onChange: (values) => {
|
|
230
|
+
: fieldMeta('identity.options.*.choices.*.value'), !option.isShownInChat), onChange: (values) => {
|
|
236
231
|
onChange({ choices: optionChoices(values, option.choices) });
|
|
237
232
|
} }) }), _jsx(Popover, { placement: "below", alignment: "end", width: OPTION_FIELDS_WIDTH, label: `${row} in interface`, content: _jsx(OptionFields, { option: option, canShow: canShow, onChange: onChange }), children: _jsx(IconButton, { label: `${row} ${option.isShownInChat ? 'shown' : 'not shown'} in interface`, tooltip: option.isShownInChat ? 'Shown in interface' : 'Not shown in interface', variant: "ghost", size: "sm", icon: _jsx(Icon, { icon: IconPencil, size: "sm" }) }) }), _jsx(IconButton, { label: `Remove ${row.toLowerCase()}`, variant: "ghost", size: "sm", icon: _jsx(Icon, { icon: IconX, size: "sm" }), onClick: onRemove })] }));
|
|
238
233
|
}
|
|
239
234
|
function OptionRows({ identity, canShow, set, }) {
|
|
240
235
|
const { options } = identity;
|
|
241
236
|
const [values, setValues] = usePageValues(useContext(WorkspaceContext)?.self ?? '');
|
|
242
|
-
return (_jsx(WideRow, { label: "Options", path: "identity.options", isRequired: false, hasIssue: false, children: _jsxs(OwnField, { path: "identity.options", children: [options.map((option, at) => (_jsx(OwnField, { path: option.isShownInChat ? 'inputs.options' : 'identity.options', children: _jsx(OptionRow, { option: option, at: at, canShow: canShow, stated:
|
|
243
|
-
|
|
237
|
+
return (_jsx(WideRow, { label: "Options", path: "identity.options", isRequired: false, hasIssue: false, children: _jsxs(OwnField, { path: "identity.options", children: [options.map((option, at) => (_jsx(OwnField, { path: option.isShownInChat ? 'inputs.options' : 'identity.options', children: _jsx(OptionRow, { option: option, at: at, canShow: canShow, stated: pickedValue(option.choices.map(({ value }) => value), values.options[option.name], option.isShownInChat), onState: (value) => {
|
|
238
|
+
const { [option.name]: stated, ...rest } = values.options;
|
|
239
|
+
const isUnpick = stated === value && !option.isShownInChat;
|
|
240
|
+
setValues({
|
|
241
|
+
...values,
|
|
242
|
+
options: isUnpick ? rest : { ...rest, [option.name]: value },
|
|
243
|
+
});
|
|
244
244
|
}, onChange: (change) => {
|
|
245
245
|
set({
|
|
246
246
|
options: options.map((each) => each.key === option.key ? { ...each, ...change } : each),
|