@theoremjs/studio 0.3.4-next.641.g6835640 → 0.3.4-next.645.gf4efc36
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/draft.d.ts +3 -1
- package/draft.js +5 -1
- package/map.js +6 -4
- package/mod.d.ts +1 -1
- package/mod.js +1 -1
- package/package.json +4 -4
- package/page/assets/{Banner-UJKg_2N3.js → Banner-DUWyIq2D.js} +4 -4
- package/page/assets/{ConsoleFrame-biip7SZd.js → ConsoleFrame-K3wMSKR0.js} +1 -1
- package/page/assets/{MenuBottomSheet-Dxma7XzT.js → MenuBottomSheet-D_O3ZtWO.js} +1 -1
- package/page/assets/{SchemaFields-BdrMoZFt.js → SchemaFields-Cms5y4a4.js} +1 -1
- package/page/assets/{ToolResultCharts-DerazebE.js → ToolResultCharts-BmshQQGt.js} +1 -1
- package/page/assets/{TraceInspector-Duno_ikw.js → TraceInspector-BMYUlgdB.js} +1 -1
- package/page/assets/{TraceOverview-CTUa7xnm.js → TraceOverview-cAK8xawQ.js} +1 -1
- package/page/assets/{browser-engine-Dp54WIpK.js → browser-engine-Cor7uudw.js} +1 -1
- package/page/assets/{browser-transport-DLPYDyyz.js → browser-transport-3hTn89Nr.js} +3 -3
- package/page/assets/{export-agent-C3PdvA79.js → export-agent-B_AVAG15.js} +1 -1
- package/page/assets/{guardrail-tester-CBLDH8K4.js → guardrail-tester-COAfC1m4.js} +1 -1
- package/page/assets/{index-CtmN7Ux2.js → index-CBCT-7GI.js} +72 -72
- package/page/assets/{studio-code-pane-CYfaUl7D.js → studio-code-pane-BkTmuzch.js} +1 -1
- package/page/assets/{studio-console-Bu6XTZaR.js → studio-console-Dmg1G9n9.js} +1 -1
- package/page/assets/{studio-decision-CGKB52Kq.js → studio-decision-zNZq8vyt.js} +1 -1
- package/page/assets/{studio-embedding-Cxqm8scy.js → studio-embedding-Chji_oM-.js} +1 -1
- package/page/assets/{studio-host-console-Bn636ErH.js → studio-host-console-waGr0aO9.js} +2 -2
- package/page/assets/{studio-labels-BxegXv6t.js → studio-labels-BmPaimgf.js} +1 -1
- package/page/assets/{studio-live-DDKv6w8l.js → studio-live-CEeorgWj.js} +1 -1
- package/page/assets/studio-map-CpWIivVj.js +1 -0
- package/page/assets/{studio-trace-replay-C5v60O9b.js → studio-trace-replay-ppKFAlgx.js} +1 -1
- package/page/assets/tree-DM7jRXMx.js +3 -0
- package/page/assets/{use-one-call-zyJVBUYZ.js → use-one-call-HYa-g61P.js} +1 -1
- package/page/assets/{workspace-AKMCUEuK.js → workspace-WKa0_gWg.js} +1 -1
- package/page/index.html +6 -6
- package/tree.js +3 -3
- package/ui/profile-editor.js +90 -25
- package/ui/studio-map.js +2 -4
- package/ui/studio-save.d.ts +2 -0
- package/ui/studio-save.js +3 -3
- package/ui/studio-screen.js +34 -11
- package/ui/studio-settings.js +1 -1
- package/workspace.js +3 -5
- package/page/assets/studio-map-BwwnzJSF.js +0 -1
- package/page/assets/tree-D5eWDcqI.js +0 -3
package/page/index.html
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect width='32' height='32' rx='7' fill='%23000'/%3E%3Cg transform='translate(4 4)' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4.5 18.5c2 0 3-1.2 4.2-3.4l2.6-5c1-1.9 2.1-3.1 4.2-3.1'/%3E%3Cpath d='M5.5 8.2c1.6-.9 3.2-.4 3.8 1.6l2.3 6.6c.6 1.7 2.1 2.4 3.9 1.7'/%3E%3Ccircle cx='19.5' cy='4.5' r='1.6' fill='%23fff' stroke='none'/%3E%3C/g%3E%3C/svg%3E"
|
|
11
11
|
/>
|
|
12
12
|
<title>theorem studio</title>
|
|
13
|
-
<script type="module" crossorigin src="/studio/assets/index-
|
|
13
|
+
<script type="module" crossorigin src="/studio/assets/index-CBCT-7GI.js"></script>
|
|
14
14
|
<link rel="modulepreload" crossorigin href="/studio/assets/rolldown-runtime-hePW80VL.js">
|
|
15
15
|
<link rel="modulepreload" crossorigin href="/studio/assets/themeProps-3IqahpCr.js">
|
|
16
16
|
<link rel="modulepreload" crossorigin href="/studio/assets/tokens.stylex-DkHf0P9C.js">
|
|
@@ -51,17 +51,17 @@
|
|
|
51
51
|
<link rel="modulepreload" crossorigin href="/studio/assets/shaped-data-DAdn_XvU.js">
|
|
52
52
|
<link rel="modulepreload" crossorigin href="/studio/assets/tool-schema-B_EOjDjg.js">
|
|
53
53
|
<link rel="modulepreload" crossorigin href="/studio/assets/live-ingress-OuSlQ6q7.js">
|
|
54
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/tree-
|
|
54
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/tree-DM7jRXMx.js">
|
|
55
55
|
<link rel="modulepreload" crossorigin href="/studio/assets/browser-connection-QNf4S7Ff.js">
|
|
56
56
|
<link rel="modulepreload" crossorigin href="/studio/assets/use-second-ticker-rObooyH6.js">
|
|
57
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/Banner-
|
|
57
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/Banner-DUWyIq2D.js">
|
|
58
58
|
<link rel="modulepreload" crossorigin href="/studio/assets/row-keys-WByP9Hsh.js">
|
|
59
59
|
<link rel="modulepreload" crossorigin href="/studio/assets/Center-nHS1JSux.js">
|
|
60
60
|
<link rel="modulepreload" crossorigin href="/studio/assets/IconSearch-BTx66a40.js">
|
|
61
61
|
<link rel="modulepreload" crossorigin href="/studio/assets/trace-schema-9CdEyG6Q.js">
|
|
62
62
|
<link rel="modulepreload" crossorigin href="/studio/assets/stub-CWjTbSMX.js">
|
|
63
63
|
<link rel="modulepreload" crossorigin href="/studio/assets/reader-DlrsIIkn.js">
|
|
64
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/browser-transport-
|
|
64
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/browser-transport-3hTn89Nr.js">
|
|
65
65
|
<link rel="modulepreload" crossorigin href="/studio/assets/focusReturn-CTppP2k0.js">
|
|
66
66
|
<link rel="modulepreload" crossorigin href="/studio/assets/CheckboxInput-CFZ_Wq8-.js">
|
|
67
67
|
<link rel="modulepreload" crossorigin href="/studio/assets/useScrollLock-Dyf6PHJt.js">
|
|
@@ -74,9 +74,9 @@
|
|
|
74
74
|
<link rel="modulepreload" crossorigin href="/studio/assets/encode-files-CM9H0Lq5.js">
|
|
75
75
|
<link rel="modulepreload" crossorigin href="/studio/assets/turn-client-yriGS51g.js">
|
|
76
76
|
<link rel="modulepreload" crossorigin href="/studio/assets/CollapsibleGroup-BsIYDnJR.js">
|
|
77
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/studio-labels-
|
|
77
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/studio-labels-BmPaimgf.js">
|
|
78
78
|
<link rel="modulepreload" crossorigin href="/studio/assets/crypto-B6qD6nxk.js">
|
|
79
|
-
<link rel="modulepreload" crossorigin href="/studio/assets/workspace-
|
|
79
|
+
<link rel="modulepreload" crossorigin href="/studio/assets/workspace-WKa0_gWg.js">
|
|
80
80
|
<link rel="modulepreload" crossorigin href="/studio/assets/lent-keys-C32ems-I.js">
|
|
81
81
|
<link rel="modulepreload" crossorigin href="/studio/assets/editors-BJX_S59A.js">
|
|
82
82
|
<link rel="modulepreload" crossorigin href="/studio/assets/studio-session-yEqFQo5o.js">
|
package/tree.js
CHANGED
|
@@ -47,7 +47,7 @@ function branchNodes(draft, facet) {
|
|
|
47
47
|
return draft.modelBindings.map((binding) => ({
|
|
48
48
|
id: modelBindingNodeId(binding.key),
|
|
49
49
|
ref: { facet: 'modelBinding', key: binding.key },
|
|
50
|
-
label: binding.modelId.trim() ||
|
|
50
|
+
label: binding.modelId.trim() || 'Unnamed model',
|
|
51
51
|
children: [],
|
|
52
52
|
}));
|
|
53
53
|
}
|
|
@@ -60,7 +60,7 @@ export function toolSpecNodes(toolSpecs) {
|
|
|
60
60
|
return toolSpecs.map((tool) => ({
|
|
61
61
|
id: toolSpecNodeId(tool.key),
|
|
62
62
|
ref: { facet: 'toolSpec', key: tool.key },
|
|
63
|
-
label: tool.toolName.trim() ||
|
|
63
|
+
label: tool.toolName.trim() || 'Unnamed tool',
|
|
64
64
|
children: [],
|
|
65
65
|
}));
|
|
66
66
|
}
|
|
@@ -77,7 +77,7 @@ export function studioTree(draft) {
|
|
|
77
77
|
return {
|
|
78
78
|
id: 'identity',
|
|
79
79
|
ref: { facet: 'identity' },
|
|
80
|
-
label: draft.identity.agentId.trim() ||
|
|
80
|
+
label: draft.identity.agentId.trim() || 'Unnamed agent',
|
|
81
81
|
children,
|
|
82
82
|
};
|
|
83
83
|
}
|
package/ui/profile-editor.js
CHANGED
|
@@ -24,11 +24,11 @@ import { Thumbnail } from '@astryxdesign/core/Thumbnail';
|
|
|
24
24
|
import { Token } from '@astryxdesign/core/Token';
|
|
25
25
|
import { Tooltip } from '@astryxdesign/core/Tooltip';
|
|
26
26
|
import { VStack } from '@astryxdesign/core/VStack';
|
|
27
|
-
import { IconAbc, IconAdjustmentsHorizontal, IconAlertTriangle, IconAlignLeft, IconAntennaBars1, IconAntennaBars2, IconAntennaBars3, IconAntennaBars4, IconAntennaBars5, IconAntennaBarsOff, IconArrowDown, IconArrowLeft, IconArrowUp, IconBan, IconBandage, IconBiohazard, IconBolt, IconBraces, IconBulb, IconBulbOff, IconCertificate, IconCheck, IconChevronRight, IconCircleDashed, IconDatabase, IconDeviceDesktop, IconEraser, IconEye, IconEyeOff, IconFeather, IconFlag, IconFlame, IconFlask, IconGauge, IconHandOff, IconHandStop, IconHeadset, IconHourglass, IconHttpDelete, IconHttpGet, IconHttpPatch, IconHttpPost, IconHttpPut, IconInfoCircle, IconInputAi, IconKey, IconLayersUnion, IconLockOpen, IconMessage, IconMicrophone, IconPackage, IconPaperclip, IconPencil, IconPlayerPause, IconPlayerPlay, IconPlayerStop, IconPlayerTrackNext, IconPlugConnected, IconPlus, IconRefresh, IconRegex, IconRuler, IconSearch, IconSend, IconServer, IconShieldLock, IconShieldOff, IconShieldSearch, IconSquareRoundedNumber0, IconSquareRoundedNumber2, IconTool, IconTrash, IconUser, IconUserCheck, IconWaveSine, IconWriting, IconX, } from '@tabler/icons-react';
|
|
28
|
-
import { ATTACHMENT_ACCEPT_MIMES, CONTINUE_STOP_KINDS, fieldMeta, HTTP_METHODS, IMAGE_ATTACHMENT_ACCEPT_MIMES, LABEL_KEYS, labelDefault, PROFILE_HANDLE_MAX_CHARS, PROFILE_ID_MAX_CHARS, profileGraphFacet, THINKING_LEVELS, VOICE_ACCEPT_MIMES, } from '@theoremjs/agents';
|
|
27
|
+
import { IconAbc, IconAdjustmentsHorizontal, IconAlertTriangle, IconAlignLeft, IconAntennaBars1, IconAntennaBars2, IconAntennaBars3, IconAntennaBars4, IconAntennaBars5, IconAntennaBarsOff, IconArrowDown, IconArrowLeft, IconArrowUp, IconBan, IconBandage, IconBiohazard, IconBolt, IconBraces, IconBulb, IconBulbOff, IconCertificate, IconCheck, IconChevronRight, IconCircleDashed, IconDatabase, IconDeviceDesktop, IconEraser, IconEye, IconEyeOff, IconFeather, IconFlag, IconFlame, IconFlask, IconFold, IconGauge, IconHandOff, IconHandStop, IconHeadset, IconHourglass, IconHttpDelete, IconHttpGet, IconHttpPatch, IconHttpPost, IconHttpPut, IconInfoCircle, IconInputAi, IconKey, IconLayersUnion, IconLockOpen, IconLogin, IconMessage, IconMicrophone, IconPackage, IconPaperclip, IconPencil, IconPlayerPause, IconPlayerPlay, IconPlayerStop, IconPlayerTrackNext, IconPlugConnected, IconPlus, IconRefresh, IconRegex, IconRuler, IconSearch, IconSend, IconServer, IconShieldLock, IconShieldOff, IconShieldSearch, IconSquareRoundedNumber0, IconSquareRoundedNumber2, IconTool, IconTrash, IconUser, IconUserCheck, IconWaveSine, IconWriting, IconX, } from '@tabler/icons-react';
|
|
28
|
+
import { ATTACHMENT_ACCEPT_MIMES, CONTINUE_STOP_KINDS, fieldMeta, HTTP_METHODS, IMAGE_ATTACHMENT_ACCEPT_MIMES, LABEL_KEYS, labelDefault, PROFILE_HANDLE_MAX_CHARS, PROFILE_ID_MAX_CHARS, profileGraphFacet, SPEECH_AUDIO_FORMATS, THINKING_LEVELS, VOICE_ACCEPT_MIMES, } from '@theoremjs/agents';
|
|
29
29
|
import { BOUNDARIES, BOUNDARY_META, DETECT_ACTION_META, DETECT_ACTIONS, DETECTOR_BOUNDARIES, DETECTOR_GROUP_META, DETECTOR_GROUPS, DETECTOR_META, DETECTORS, TOOL_BOUNDARIES, TOOL_KINDS, } from '@theoremjs/agents/guardrails';
|
|
30
30
|
import { createContext, lazy, Suspense, useContext, useEffect, useLayoutEffect, useRef, useState, useSyncExternalStore, } from 'react';
|
|
31
|
-
import { acceptSections, agentToolTarget, bindingSlots, COMPACTION_DRAFT_DEFAULTS, canSize, defaultEffortRequired, defaultModelRequired, definitionOf, draftAllows, draftKey, expandAccept, GOOGLE_BUILTIN_TOOLS, GOOGLE_IMAGE_ASPECT_RATIOS, GOOGLE_IMAGE_OUTPUT_MIMES, GOOGLE_IMAGE_RESOLUTIONS, GOOGLE_SPEECH_VOICES, INLINE_LABELS, includableFacets, includeFacet, inputLimitsRequired, isGoogleRoute, isOpenRouterRoute, keptLimits, kernelDefinitions, LOCAL_PROVIDER_ID, lentCompression, MODEL_LIMITS, modelRoute, modelSlots, newCriteria, newDecisionImage, newDecisionQuestion, newModelBinding, newOwnDetector, newPattern, newSlot, newSlotChoice, newToolSpec, nextAccept, onStudioLocal, optionAt, plantsCanary, protocolOptionFields, removeModelBinding, STUDIO_TRACE_DESTINATION, sampleToolInput, sectionNote, servedProtocols, servesProfileType, setProfileType, studioNetworkNote, studioNodeRef, studioRunsProvider, studioTaintNote, TIMER_MAX_MS, takesContinueInstruction, toolSpecKeyOf, toolSpecNodeId, updateModelBinding, withOption, writeAsk, } from "../mod.js";
|
|
31
|
+
import { acceptSections, agentToolTarget, bindingSlots, COMPACTION_DRAFT_DEFAULTS, canSize, defaultEffortRequired, defaultModelRequired, definitionOf, draftAllows, draftKey, expandAccept, GOOGLE_BUILTIN_TOOLS, GOOGLE_IMAGE_ASPECT_RATIOS, GOOGLE_IMAGE_OUTPUT_MIMES, GOOGLE_IMAGE_RESOLUTIONS, GOOGLE_SPEECH_FORMATS, GOOGLE_SPEECH_VOICES, INLINE_LABELS, includableFacets, includeFacet, inputLimitsRequired, isGoogleRoute, isOpenRouterRoute, keptLimits, kernelDefinitions, LOCAL_PROVIDER_ID, lentCompression, MODEL_LIMITS, modelRoute, modelSlots, newCriteria, newCriterion, newDecisionImage, newDecisionQuestion, newModelBinding, newOwnDetector, newPattern, newSlot, newSlotChoice, newToolSpec, nextAccept, onStudioLocal, optionAt, plantsCanary, protocolOptionFields, removeModelBinding, STUDIO_TRACE_DESTINATION, sampleToolInput, sectionNote, servedProtocols, servesProfileType, setProfileType, studioNetworkNote, studioNodeRef, studioRunsProvider, studioTaintNote, TIMER_MAX_MS, takesContinueInstruction, toolSpecKeyOf, toolSpecNodeId, updateModelBinding, withOption, writeAsk, } from "../mod.js";
|
|
32
32
|
import { AddProviderButton } from "./add-provider.js";
|
|
33
33
|
import { IconGoogle, IconOpenAi, IconOpenRouter, IconTypeSafe } from "./brand-icons.js";
|
|
34
34
|
import { ChoiceRow, InspectorGroupTitle, InspectorRow, InspectorSection, ListRow, NamesRow, NumberRow, OriginLine, SegmentedRow, SetInCode, SliderRow, SwitchRow, TextAreaRow, TextRow, } from "./inspector.js";
|
|
@@ -89,9 +89,15 @@ const LEVEL_SEGMENTS = THINKING_LEVELS.map((value) => ({
|
|
|
89
89
|
value,
|
|
90
90
|
...LEVEL_SEGMENT[value],
|
|
91
91
|
}));
|
|
92
|
+
/** The segment for a closed set left unset: the provider's default. */
|
|
93
|
+
const PROVIDER_DEFAULT = {
|
|
94
|
+
value: 'default',
|
|
95
|
+
label: 'Provider default',
|
|
96
|
+
icon: IconCircleDashed,
|
|
97
|
+
};
|
|
92
98
|
/** Thought summaries: on, off, or left to the provider (`null` in the draft). */
|
|
93
99
|
const SUMMARIES_SEGMENTS = [
|
|
94
|
-
|
|
100
|
+
PROVIDER_DEFAULT,
|
|
95
101
|
{ value: 'on', label: 'On', icon: IconBulb },
|
|
96
102
|
{ value: 'off', label: 'Off', icon: IconBulbOff },
|
|
97
103
|
];
|
|
@@ -774,7 +780,7 @@ function otherAgents(agents, self, canName) {
|
|
|
774
780
|
.filter((agent) => agent.key !== self)
|
|
775
781
|
.map((agent) => ({
|
|
776
782
|
value: agent.key,
|
|
777
|
-
label: agent.agentId || 'Unnamed agent',
|
|
783
|
+
label: agent.agentId.trim() || 'Unnamed agent',
|
|
778
784
|
disabled: !canName(agent),
|
|
779
785
|
}));
|
|
780
786
|
}
|
|
@@ -819,12 +825,6 @@ function catalogChoices(path) {
|
|
|
819
825
|
description: meta?.optionDescriptions?.[value],
|
|
820
826
|
}));
|
|
821
827
|
}
|
|
822
|
-
/** The segment for a closed set left unset: the provider's default. */
|
|
823
|
-
const PROVIDER_DEFAULT = {
|
|
824
|
-
value: 'default',
|
|
825
|
-
label: 'Provider default',
|
|
826
|
-
icon: IconCircleDashed,
|
|
827
|
-
};
|
|
828
828
|
/** An unset pin (`''`) as the provider-default segment. */
|
|
829
829
|
function segmentOf(value) {
|
|
830
830
|
return value === '' ? 'default' : value;
|
|
@@ -902,7 +902,7 @@ function OpenRouterImageRows({ image, set }) {
|
|
|
902
902
|
set({ background });
|
|
903
903
|
} }), _jsx(NumberRow, { label: "Compression", path: "image.outputCompression", field: "outputCompression", value: image.outputCompression, min: 0, max: 100, isIntegerOnly: true, onChange: (outputCompression) => {
|
|
904
904
|
set({ outputCompression });
|
|
905
|
-
} }), _jsx(NumberRow, { label: "Images", path: "image.n", field: "n", units: "per
|
|
905
|
+
} }), _jsx(NumberRow, { label: "Images", path: "image.n", field: "n", units: "per request", value: image.n, min: 1, isIntegerOnly: true, onChange: (n) => {
|
|
906
906
|
set({ n });
|
|
907
907
|
} })] }));
|
|
908
908
|
}
|
|
@@ -963,27 +963,26 @@ function ImageReferencesEditor({ references, onChange, }) {
|
|
|
963
963
|
onChange([...references, { key: draftKey('reference'), uri: '' }]);
|
|
964
964
|
} })] }));
|
|
965
965
|
}
|
|
966
|
-
/** Speech pins.
|
|
966
|
+
/** Speech pins. A format is on offer only when every model's provider can make it. */
|
|
967
967
|
function SpeechEditor({ draft, setDraft }) {
|
|
968
968
|
const google = allGoogle(draft);
|
|
969
969
|
const { speech } = draft;
|
|
970
970
|
const set = patch(setDraft, 'speech');
|
|
971
|
-
|
|
972
|
-
const mp3 = draft.modelBindings.every((binding) => !isGoogleRoute(modelRoute(draft.providers, 'speech', binding)));
|
|
971
|
+
const onGemini = draft.modelBindings.some((binding) => isGoogleRoute(modelRoute(draft.providers, 'speech', binding)));
|
|
973
972
|
return (_jsxs(InspectorSection, { path: "speech", children: [_jsx(PresetRow, { google: google, label: "Voice", path: "speech.voice", value: speech.voice, preset: GOOGLE_SPEECH_VOICES, hasSearch: true, onChange: (voice) => {
|
|
974
973
|
set({ voice });
|
|
975
974
|
} }), _jsx(TextAreaRow, { label: "Style", path: "speech.style", field: "style", value: speech.style, rows: 2, onChange: (style) => {
|
|
976
975
|
set({ style });
|
|
977
976
|
} }), _jsx(NumberRow, { label: "Speed", path: "speech.speed", field: "speed", value: speech.speed, step: 0.1, onChange: (speed) => {
|
|
978
977
|
set({ speed });
|
|
979
|
-
} }), _jsx(ChoiceRow, { label: "Format", path: "speech.format", field: "format", value: speech.format, options:
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
}
|
|
986
|
-
|
|
978
|
+
} }), _jsx(ChoiceRow, { label: "Format", path: "speech.format", field: "format", value: speech.format, options: SPEECH_AUDIO_FORMATS.map((format) => onGemini && !GOOGLE_SPEECH_FORMATS.includes(format)
|
|
979
|
+
? {
|
|
980
|
+
value: format,
|
|
981
|
+
label: format,
|
|
982
|
+
description: `Gemini cannot make ${format}`,
|
|
983
|
+
disabled: true,
|
|
984
|
+
}
|
|
985
|
+
: format), onChange: (format) => {
|
|
987
986
|
set({ format });
|
|
988
987
|
} })] }));
|
|
989
988
|
}
|
|
@@ -2326,6 +2325,20 @@ const LABEL_AREAS = [
|
|
|
2326
2325
|
icon: IconAdjustmentsHorizontal,
|
|
2327
2326
|
audience: 'visitor',
|
|
2328
2327
|
},
|
|
2328
|
+
{
|
|
2329
|
+
prefix: 'detect.blocked',
|
|
2330
|
+
title: 'Blocked messages',
|
|
2331
|
+
note: "When a detector stops the visitor's message.",
|
|
2332
|
+
icon: IconShieldOff,
|
|
2333
|
+
audience: 'visitor',
|
|
2334
|
+
},
|
|
2335
|
+
{
|
|
2336
|
+
prefix: 'thought',
|
|
2337
|
+
title: 'Thoughts',
|
|
2338
|
+
note: 'What stands in for what a thought leaves out.',
|
|
2339
|
+
icon: IconBulb,
|
|
2340
|
+
audience: 'visitor',
|
|
2341
|
+
},
|
|
2329
2342
|
{
|
|
2330
2343
|
prefix: 'live',
|
|
2331
2344
|
title: 'Live',
|
|
@@ -2389,7 +2402,59 @@ const LABEL_AREAS = [
|
|
|
2389
2402
|
icon: IconInfoCircle,
|
|
2390
2403
|
audience: 'model',
|
|
2391
2404
|
},
|
|
2405
|
+
{
|
|
2406
|
+
prefix: 'detect',
|
|
2407
|
+
title: 'Detectors',
|
|
2408
|
+
note: 'When a detector stops a call or a result, and what it asks the model to leave out.',
|
|
2409
|
+
icon: IconShieldSearch,
|
|
2410
|
+
audience: 'model',
|
|
2411
|
+
},
|
|
2412
|
+
{
|
|
2413
|
+
prefix: 'sign_in',
|
|
2414
|
+
title: 'Sign-in',
|
|
2415
|
+
note: 'Where a tool waits for the person to sign in to a service.',
|
|
2416
|
+
icon: IconLogin,
|
|
2417
|
+
audience: 'model',
|
|
2418
|
+
},
|
|
2419
|
+
{
|
|
2420
|
+
prefix: 'user_data',
|
|
2421
|
+
title: 'User data',
|
|
2422
|
+
note: "The note on the fence around the user's message.",
|
|
2423
|
+
icon: IconUser,
|
|
2424
|
+
audience: 'model',
|
|
2425
|
+
},
|
|
2426
|
+
{
|
|
2427
|
+
prefix: 'context',
|
|
2428
|
+
title: 'Turn context',
|
|
2429
|
+
note: 'The note on the fence around what the app or the host adds.',
|
|
2430
|
+
icon: IconLayersUnion,
|
|
2431
|
+
audience: 'model',
|
|
2432
|
+
},
|
|
2433
|
+
{
|
|
2434
|
+
prefix: 'structured',
|
|
2435
|
+
title: 'Structured replies',
|
|
2436
|
+
note: 'Asking for the final answer as JSON or as an answer tool call.',
|
|
2437
|
+
icon: IconBraces,
|
|
2438
|
+
audience: 'model',
|
|
2439
|
+
},
|
|
2440
|
+
{
|
|
2441
|
+
prefix: 'compaction',
|
|
2442
|
+
title: 'Compaction',
|
|
2443
|
+
note: 'Asking for the summary that replaces earlier turns.',
|
|
2444
|
+
icon: IconFold,
|
|
2445
|
+
audience: 'model',
|
|
2446
|
+
},
|
|
2392
2447
|
];
|
|
2448
|
+
/** The area a label key is under: the one with the longest prefix that holds it. */
|
|
2449
|
+
function areaOf(key) {
|
|
2450
|
+
let found;
|
|
2451
|
+
for (const area of LABEL_AREAS) {
|
|
2452
|
+
const holds = key === area.prefix || key.startsWith(`${area.prefix}.`);
|
|
2453
|
+
if (holds && (!found || area.prefix.length > found.prefix.length))
|
|
2454
|
+
found = area;
|
|
2455
|
+
}
|
|
2456
|
+
return found;
|
|
2457
|
+
}
|
|
2393
2458
|
const LABEL_AUDIENCES = [
|
|
2394
2459
|
{
|
|
2395
2460
|
value: 'visitor',
|
|
@@ -2519,7 +2584,7 @@ function LabelsEditor({ draft, setDraft, onSelect, }) {
|
|
|
2519
2584
|
function labelAreas(draft, needle, audience) {
|
|
2520
2585
|
return LABEL_AREAS.filter((area) => needle || area.audience === audience)
|
|
2521
2586
|
.map((area) => {
|
|
2522
|
-
const all = LABEL_KEYS.filter((key) => key
|
|
2587
|
+
const all = LABEL_KEYS.filter((key) => areaOf(key) === area);
|
|
2523
2588
|
const keys = needle
|
|
2524
2589
|
? all.filter((key) => [
|
|
2525
2590
|
area.title,
|
|
@@ -2668,7 +2733,7 @@ function CriteriaList({ question, onChange, }) {
|
|
|
2668
2733
|
onChange({ criteria });
|
|
2669
2734
|
};
|
|
2670
2735
|
return (_jsxs(InspectorSection, { title: copy.title, note: copy.note, children: [question.criteria.map((row, at) => (_jsx(CriterionRow, { question: question, row: row, at: at, setCriteria: setCriteria }, row.key))), _jsx(HStack, { children: _jsx(Button, { label: `Add ${copy.row.toLowerCase()}`, variant: "ghost", size: "sm", icon: _jsx(Icon, { icon: IconPlus, size: "sm" }), isDisabled: question.criteria.length >= (keys?.decision.criteria ?? Infinity), onClick: () => {
|
|
2671
|
-
setCriteria([...question.criteria,
|
|
2736
|
+
setCriteria([...question.criteria, newCriterion()]);
|
|
2672
2737
|
} }) })] }));
|
|
2673
2738
|
}
|
|
2674
2739
|
function DecisionContractSection({ decision, set }) {
|
package/ui/studio-map.js
CHANGED
|
@@ -27,7 +27,6 @@ import { PROFILE_TYPE_ICON, profileTypeIcon, toolTypeIcon } from "./lib/type-ico
|
|
|
27
27
|
import { MapToken, useTokenWidths } from "./map-token.js";
|
|
28
28
|
import { drags, fieldStart, follow, scrollOnce, usePan } from "./pan.js";
|
|
29
29
|
import './studio-map.css';
|
|
30
|
-
/** With detail a node holds its icon, its name, and two lines of its note; a card's head, one; a row, a section. */
|
|
31
30
|
/** A token's slot: as wide as the longest name it shows in full. */
|
|
32
31
|
const TOKEN_SIZES = {
|
|
33
32
|
node: { width: 240, height: 24 },
|
|
@@ -367,9 +366,8 @@ export function StudioMap({ workspace, shared, selected, onOpen, onClose, }) {
|
|
|
367
366
|
const [menuOn, setMenuOn] = useState();
|
|
368
367
|
const menu = menuOf(nodes.find((node) => node.id === menuOn), onOpen, actions);
|
|
369
368
|
const Node = expanded ? DetailNode : TokenNode;
|
|
370
|
-
const open = nodes.find((node) => isOpen(node, selected))?.id;
|
|
371
369
|
// The open node's lines are drawn over the rest, and the lit ones over those.
|
|
372
|
-
const over = (line) => onLines.has(line.link) ? 2 : line.from ===
|
|
370
|
+
const over = (line) => onLines.has(line.link) ? 2 : line.from === opened || line.to === opened ? 1 : 0;
|
|
373
371
|
const lines = [...layout.lines].sort((a, b) => over(a) - over(b));
|
|
374
372
|
return (_jsxs("div", { className: "studio-map-frame",
|
|
375
373
|
// why: the frame only wraps the map; Escape from anywhere inside it leaves the family.
|
|
@@ -388,7 +386,7 @@ export function StudioMap({ workspace, shared, selected, onOpen, onClose, }) {
|
|
|
388
386
|
'--map-height': `${String(layout.height)}px`,
|
|
389
387
|
'--map-slot': `${String(sizes.node.width)}px`,
|
|
390
388
|
'--map-line': `${String(sizes.card.row)}px`,
|
|
391
|
-
}, children: [_jsx("svg", { className: "studio-map-lines", width: layout.width, height: layout.height, "aria-hidden": "true", children: lines.map(({ link, from, to, d }) => (_jsx("path", { className: "map-line", d: d, "data-kind": link.kind, "data-on": onLines.has(link) ? '' : undefined, "data-open": from ===
|
|
389
|
+
}, children: [_jsx("svg", { className: "studio-map-lines", width: layout.width, height: layout.height, "aria-hidden": "true", children: lines.map(({ link, from, to, d }) => (_jsx("path", { className: "map-line", d: d, "data-kind": link.kind, "data-on": onLines.has(link) ? '' : undefined, "data-open": from === opened || to === opened ? '' : undefined }, `${link.kind}:${link.from}:${link.to}`))) }), layout.headings.map(({ label, x, y }) => (_jsx("div", { className: "studio-map-heading", style: { left: x, top: y }, children: _jsx(Text, { type: "supporting", color: "secondary", weight: "semibold", children: label }) }, label))), nodes.map((node) => {
|
|
392
390
|
const place = layout.nodes[node.id];
|
|
393
391
|
return (place && (_jsx(Node, { node: node, place: place, joins: mapLinkWords(map, node.id), selected: selected, on: on, isFound: found.includes(node.id), isDragging: dragging === node.id, onOpen: onOpen, lights: lights, drag: draggable(node.id) }, node.id)));
|
|
394
392
|
})] }) }) }), isNothing && (_jsx(Center, { className: "studio-map-nothing", children: _jsx(EmptyState, { headingLevel: 2, icon: _jsx(Icon, { icon: IconSearch, size: "lg" }), title: "Nothing matches" }) })), _jsx(MapTools, { actions: actions, query: query, onQuery: setQuery, onClose: onClose })] }));
|
package/ui/studio-save.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { type ReactNode } from 'react';
|
|
|
2
2
|
import { type StudioWorkspace } from '../mod.ts';
|
|
3
3
|
import { type ProjectSession } from './lib/studio-project.ts';
|
|
4
4
|
export type Update = (change: (current: StudioWorkspace) => StudioWorkspace) => void;
|
|
5
|
+
/** How long a toast with Undo stays, in milliseconds: long enough to reach Undo. */
|
|
6
|
+
export declare const UNDO_WINDOW = 15000;
|
|
5
7
|
/** Save, for whatever on the page offers it. */
|
|
6
8
|
export interface ProjectSaveActions {
|
|
7
9
|
/** Whether the studio holds edits the project's files do not. */
|
package/ui/studio-save.js
CHANGED
|
@@ -62,8 +62,8 @@ const ALERTS_WIDTH = 320;
|
|
|
62
62
|
/** The most of the alerts a hover shows before it scrolls: a project can have one for every agent. */
|
|
63
63
|
const ALERTS_MAX_HEIGHT = 'min(24rem, 60vh)';
|
|
64
64
|
const DIALOG_WIDTH = 720;
|
|
65
|
-
/** How long
|
|
66
|
-
const UNDO_WINDOW = 15_000;
|
|
65
|
+
/** How long a toast with Undo stays, in milliseconds: long enough to reach Undo. */
|
|
66
|
+
export const UNDO_WINDOW = 15_000;
|
|
67
67
|
/** Why nothing was written, as the builder reads it. */
|
|
68
68
|
const REFUSED = {
|
|
69
69
|
issues: 'Fix the issues in the editor first.',
|
|
@@ -335,7 +335,7 @@ export function ProjectSave({ project, workspace, update, onFilesChanged, onDisc
|
|
|
335
335
|
setStep({ at: 'closed' });
|
|
336
336
|
} }), step.at === 'review' && (_jsx(Button, { label: "Save", variant: "primary", isDisabled: !step.review.writable, isLoading: writing, onClick: () => {
|
|
337
337
|
write(step.review);
|
|
338
|
-
} }))] })] }) }) }) }), _jsx(AlertDialog, { isOpen: asking, onOpenChange: setAsking, title: "Discard every unsaved edit?", description: "
|
|
338
|
+
} }))] })] }) }) }) }), _jsx(AlertDialog, { isOpen: asking, onOpenChange: setAsking, title: "Discard every unsaved edit?", description: "The project goes back to its files. Undo in the next message brings the edits back.", actionLabel: "Discard all", actionVariant: "destructive", onAction: () => {
|
|
339
339
|
setAsking(false);
|
|
340
340
|
setStep({ at: 'closed' });
|
|
341
341
|
onDiscard();
|
package/ui/studio-screen.js
CHANGED
|
@@ -67,7 +67,7 @@ import { StudioKeys, useStudioConnection, } from "./studio-connection.js";
|
|
|
67
67
|
import { StudioHostContext, useStudioHost, } from "./studio-host.js";
|
|
68
68
|
import { NAV_WIDTH } from "./studio-nav.js";
|
|
69
69
|
import { StudioRunner } from "./studio-runner.js";
|
|
70
|
-
import { ProjectSave, ProjectTokens, useProjectSave } from "./studio-save.js";
|
|
70
|
+
import { ProjectSave, ProjectTokens, UNDO_WINDOW, useProjectSave } from "./studio-save.js";
|
|
71
71
|
import { TraceButton } from "./trace-button.js";
|
|
72
72
|
import { useBelowDesktop } from "./use-phone.js";
|
|
73
73
|
// The tester, Settings, the map and the code view load when they first open, or once the page is idle.
|
|
@@ -191,7 +191,7 @@ function agentItems(state) {
|
|
|
191
191
|
const isOnly = workspace.agents.length === 1;
|
|
192
192
|
return workspace.agents.map((agent) => {
|
|
193
193
|
const draft = libraryDraft(workspace, agent.key) ?? createBlankDraft();
|
|
194
|
-
const name = agent.identity.agentId || 'this agent';
|
|
194
|
+
const name = agent.identity.agentId.trim() || 'this agent';
|
|
195
195
|
const whole = resetAgent(workspace, agent.key);
|
|
196
196
|
return agentItem({
|
|
197
197
|
draft,
|
|
@@ -261,7 +261,7 @@ function providerItems(tree) {
|
|
|
261
261
|
return [
|
|
262
262
|
{
|
|
263
263
|
id: `${id}:${agent.key}`,
|
|
264
|
-
label: agent.identity.agentId || '
|
|
264
|
+
label: agent.identity.agentId.trim() || 'Unnamed agent',
|
|
265
265
|
startContent: (_jsx(Icon, { icon: PROFILE_TYPE_ICON[agent.identity.profileType || 'text'], size: "sm", color: "secondary" })),
|
|
266
266
|
onClick: () => {
|
|
267
267
|
onSelect(agentNodeId(agent.key, modelBindingNodeId(binding.key)));
|
|
@@ -494,7 +494,7 @@ function useChatAgents(agents) {
|
|
|
494
494
|
const names = JSON.stringify(agents.map((agent) => [agent.key, agent.identity.agentId]));
|
|
495
495
|
return useMemo(() => JSON.parse(names).map(([value, agentId]) => ({
|
|
496
496
|
value,
|
|
497
|
-
label: agentId || 'Unnamed agent',
|
|
497
|
+
label: agentId.trim() || 'Unnamed agent',
|
|
498
498
|
})), [names]);
|
|
499
499
|
}
|
|
500
500
|
/** A tree group's heading and its add button. */
|
|
@@ -694,7 +694,7 @@ function issueCount(compiled) {
|
|
|
694
694
|
/** What a host that follows along is told about the draft on screen. */
|
|
695
695
|
function screenReport(draft, compiled, section) {
|
|
696
696
|
return {
|
|
697
|
-
agent: draft.identity.handle || draft.identity.agentId || 'unnamed',
|
|
697
|
+
agent: draft.identity.handle || draft.identity.agentId.trim() || 'unnamed',
|
|
698
698
|
type: draft.identity.profileType || 'not chosen',
|
|
699
699
|
issues: compiled.ok ? 0 : compiled.issues.length,
|
|
700
700
|
section,
|
|
@@ -1501,6 +1501,7 @@ function usePageActions(store, view, setConversation) {
|
|
|
1501
1501
|
setConversation((count) => count + 1);
|
|
1502
1502
|
const dismiss = toast({
|
|
1503
1503
|
body: message,
|
|
1504
|
+
autoHideDuration: UNDO_WINDOW,
|
|
1504
1505
|
endContent: (_jsx(Button, { label: "Undo", variant: "ghost", size: "sm", onClick: () => {
|
|
1505
1506
|
store.update(previous);
|
|
1506
1507
|
dismiss();
|
|
@@ -1679,6 +1680,7 @@ function useDiscardAll({ store, filesChanged }) {
|
|
|
1679
1680
|
filesChanged();
|
|
1680
1681
|
const dismiss = toast({
|
|
1681
1682
|
body: 'Discarded every unsaved edit.',
|
|
1683
|
+
autoHideDuration: UNDO_WINDOW,
|
|
1682
1684
|
endContent: (_jsx(Button, { label: "Undo", variant: "ghost", size: "sm", onClick: () => {
|
|
1683
1685
|
store.update(before);
|
|
1684
1686
|
dismiss();
|
|
@@ -1792,8 +1794,27 @@ function EditorBody({ state, connection, selected, editing, issues, listBadges,
|
|
|
1792
1794
|
}, issues: issues })) }) }) }) }) }, selected));
|
|
1793
1795
|
}
|
|
1794
1796
|
/** Clears the conversation and its traces; the profile stays. */
|
|
1795
|
-
function ClearHistoryButton({
|
|
1796
|
-
return (_jsx(IconButton, { label: "Clear history", variant: "ghost", icon: _jsx(Icon, { icon: IconPlaylistX, size: "sm" }), tooltip: "Clear the conversation and its traces. Your profile stays.", onClick:
|
|
1797
|
+
function ClearHistoryButton({ onClear }) {
|
|
1798
|
+
return (_jsx(IconButton, { label: "Clear history", variant: "ghost", icon: _jsx(Icon, { icon: IconPlaylistX, size: "sm" }), tooltip: "Clear the conversation and its traces. Your profile stays.", onClick: onClear }));
|
|
1799
|
+
}
|
|
1800
|
+
/**
|
|
1801
|
+
* Clears the chat and puts the keyboard in the new one's composer.
|
|
1802
|
+
* why: the Clear history button leaves with the conversation, and focus would fall to the page.
|
|
1803
|
+
*/
|
|
1804
|
+
function useClearAndFocus(run, chatRef) {
|
|
1805
|
+
/** The run that was cleared; the next run takes the focus. */
|
|
1806
|
+
const clearedRun = useRef(undefined);
|
|
1807
|
+
const { clear, runKey } = run;
|
|
1808
|
+
useEffect(() => {
|
|
1809
|
+
if (clearedRun.current === undefined || clearedRun.current === runKey)
|
|
1810
|
+
return;
|
|
1811
|
+
clearedRun.current = undefined;
|
|
1812
|
+
chatRef.current?.focus();
|
|
1813
|
+
}, [runKey, chatRef]);
|
|
1814
|
+
return useCallback(() => {
|
|
1815
|
+
clearedRun.current = runKey;
|
|
1816
|
+
clear();
|
|
1817
|
+
}, [clear, runKey]);
|
|
1797
1818
|
}
|
|
1798
1819
|
/** A type whose conversation a trace holds, and so can open and replay. */
|
|
1799
1820
|
const holdsConversation = (payload) => payload != null && runsAsConversation(payload.profile.type);
|
|
@@ -1804,10 +1825,10 @@ function ReplayExchangeButton({ tracing, isIconOnly, }) {
|
|
|
1804
1825
|
: 'Open a recorded conversation (a .json or .jsonl trace file) to see what happened, then replay its messages through this agent as it is now and compare', icon: _jsx(Icon, { icon: IconFileImport, size: "sm" }), "aria-pressed": tracing.open, onClick: tracing.toggle }));
|
|
1805
1826
|
}
|
|
1806
1827
|
/** The preview's header: back to the editor, the agent to chat with, history, trace, and Export. */
|
|
1807
|
-
function PreviewHeader({ store, chatAgents, chatWith, compile, run, connection, trace, testing, tracing, setSheet, }) {
|
|
1828
|
+
function PreviewHeader({ store, chatAgents, chatWith, compile, run, connection, trace, testing, tracing, setSheet, onClear, }) {
|
|
1808
1829
|
const { ref, below: iconsOnly } = useBelowDesktop();
|
|
1809
1830
|
const { compiled } = compile;
|
|
1810
|
-
return (_jsx(Section, { ref: ref, variant: "transparent", paddingInline: 3, paddingBlock: 0, children: _jsxs(HStack, { gap: 2, vAlign: "center", children: [_jsx(SheetButton, { label: "Back to the editor", icon: IconArrowLeft, sheet: null, setSheet: setSheet }), _jsx(StackItem, { size: "fill", children: _jsx(ChatPicker, { agents: chatAgents, chatWith: chatWith, onChange: store.chatWith }) }), _jsx(StackItem, { size: "static", children: _jsxs(HStack, { gap: 1, vAlign: "center", children: [_jsx(ActingAsButton, { isIconOnly: iconsOnly }), compile.payload && run.isUsed && !testing && !tracing.open && (_jsx(ClearHistoryButton, {
|
|
1831
|
+
return (_jsx(Section, { ref: ref, variant: "transparent", paddingInline: 3, paddingBlock: 0, children: _jsxs(HStack, { gap: 2, vAlign: "center", children: [_jsx(SheetButton, { label: "Back to the editor", icon: IconArrowLeft, sheet: null, setSheet: setSheet }), _jsx(StackItem, { size: "fill", children: _jsx(ChatPicker, { agents: chatAgents, chatWith: chatWith, onChange: store.chatWith }) }), _jsx(StackItem, { size: "static", children: _jsxs(HStack, { gap: 1, vAlign: "center", children: [_jsx(ActingAsButton, { isIconOnly: iconsOnly }), compile.payload && run.isUsed && !testing && !tracing.open && (_jsx(ClearHistoryButton, { onClear: onClear })), !testing && holdsConversation(compile.payload) && (_jsx(ReplayExchangeButton, { tracing: tracing, isIconOnly: iconsOnly })), (compile.traced || tracing.open) && !testing ? (_jsx(TraceButton, { open: trace.open, onToggle: trace.toggle, isIconOnly: iconsOnly })) : null, _jsx(OpenInNewTabButton, { isIconOnly: iconsOnly, compiled: compiled.ok ? compiled : undefined, chattedId: compile.chattedId, blocked: compile.blocked, connection: {
|
|
1811
1832
|
connectionMode: connection.mode,
|
|
1812
1833
|
localBaseUrl: connection.local.baseUrl,
|
|
1813
1834
|
} })] }) })] }) }));
|
|
@@ -1933,6 +1954,7 @@ const PreviewPane = memo(function PreviewPane({ store, chatAgents, chatWith, com
|
|
|
1933
1954
|
const feedOf = useRunFeeds(run.generation);
|
|
1934
1955
|
const profileId = chatAgents.find((agent) => agent.value === chatWith)?.label;
|
|
1935
1956
|
const sendNext = useSendAfterResume(chatRef, run.runKey);
|
|
1957
|
+
const clearChat = useClearAndFocus(run, chatRef);
|
|
1936
1958
|
const { payload } = compile;
|
|
1937
1959
|
const replay = replaying && holdsConversation(payload);
|
|
1938
1960
|
// why: the console stays mounted while it holds a file, so the way back finds its replay as it was.
|
|
@@ -1943,7 +1965,7 @@ const PreviewPane = memo(function PreviewPane({ store, chatAgents, chatWith, com
|
|
|
1943
1965
|
setReplaying(false);
|
|
1944
1966
|
sendNext(text);
|
|
1945
1967
|
} }) })) : null;
|
|
1946
|
-
return (_jsx(LayoutContent, { className: "studio-preview shell-fade", isScrollable: false, padding: 0, children: _jsxs(VStack, { height: "100%", children: [_jsx(PreviewHeader, { store: store, chatAgents: chatAgents, chatWith: chatWith, compile: compile, run: run, connection: connection, trace: {
|
|
1968
|
+
return (_jsx(LayoutContent, { className: "studio-preview shell-fade", isScrollable: false, padding: 0, children: _jsxs(VStack, { height: "100%", children: [_jsx(PreviewHeader, { store: store, onClear: clearChat, chatAgents: chatAgents, chatWith: chatWith, compile: compile, run: run, connection: connection, trace: {
|
|
1947
1969
|
open: traceOpen,
|
|
1948
1970
|
toggle: () => {
|
|
1949
1971
|
setTraceOpen((open) => !open);
|
|
@@ -2130,6 +2152,7 @@ function useWorkspaceTree(state, view, selected, setSheet) {
|
|
|
2130
2152
|
update(() => to);
|
|
2131
2153
|
const dismiss = toast({
|
|
2132
2154
|
body,
|
|
2155
|
+
autoHideDuration: UNDO_WINDOW,
|
|
2133
2156
|
endContent: (_jsx(Button, { label: "Undo", variant: "ghost", size: "sm", onClick: () => {
|
|
2134
2157
|
update(() => workspace);
|
|
2135
2158
|
dismiss();
|
|
@@ -2188,7 +2211,7 @@ function SharedLine({ entry, workspace, selected, onOpen, }) {
|
|
|
2188
2211
|
const others = entry.agents.flatMap((key) => {
|
|
2189
2212
|
const agent = workspace.agents.find((each) => each.key === key);
|
|
2190
2213
|
return agent && !selected.startsWith(`${agentNodeId(key)}/`)
|
|
2191
|
-
? [agent.identity.agentId || '
|
|
2214
|
+
? [agent.identity.agentId.trim() || 'Unnamed agent']
|
|
2192
2215
|
: [];
|
|
2193
2216
|
});
|
|
2194
2217
|
const count = others.length;
|
package/ui/studio-settings.js
CHANGED
|
@@ -262,7 +262,7 @@ function SectionBody({ section, ...props }) {
|
|
|
262
262
|
const isSection = (value) => SETTINGS_SECTIONS.includes(value);
|
|
263
263
|
/** The nav's head, as the studio's tree and the docs head theirs: the name, what is open, then the search. */
|
|
264
264
|
function SettingsNavHead({ project, version }) {
|
|
265
|
-
return (_jsxs(VStack, { gap: 4, children: [_jsxs(VStack, { gap: 1, className: "studio-nav-head", children: [_jsx(Heading, { level: 3, children: "theorem studio" }), _jsx(Text, { type: "supporting", color: "secondary", children: `${project.name} · @theoremjs/agents ${version}` })] }), _jsx(Typeahead, { label: "Search", isLabelHidden: true, placeholder: "Search settings
|
|
265
|
+
return (_jsxs(VStack, { gap: 4, children: [_jsxs(VStack, { gap: 1, className: "studio-nav-head", children: [_jsx(Heading, { level: 3, children: "theorem studio" }), _jsx(Text, { type: "supporting", color: "secondary", children: `${project.name} · @theoremjs/agents ${version}` })] }), _jsx(Typeahead, { label: "Search", isLabelHidden: true, placeholder: "Search settings", searchSource: settingsSource, value: null, onChange: (item) => {
|
|
266
266
|
const found = SETTINGS.find((setting) => setting.id === item?.id);
|
|
267
267
|
if (found)
|
|
268
268
|
showSettingsSection(found.section);
|
package/workspace.js
CHANGED
|
@@ -1031,10 +1031,10 @@ export function modelSharers(workspace, agentKey, bindingKey, id, apiId) {
|
|
|
1031
1031
|
return {
|
|
1032
1032
|
models: own
|
|
1033
1033
|
.filter((binding) => binding.key !== bindingKey && calls(binding))
|
|
1034
|
-
.map((binding) => binding.modelId.trim() || '
|
|
1034
|
+
.map((binding) => binding.modelId.trim() || 'Unnamed model'),
|
|
1035
1035
|
agents: workspace.agents
|
|
1036
1036
|
.filter((agent) => agent.key !== agentKey && agent.modelBindings.some(calls))
|
|
1037
|
-
.map((agent) => agent.identity.agentId.trim() || '
|
|
1037
|
+
.map((agent) => agent.identity.agentId.trim() || 'Unnamed agent'),
|
|
1038
1038
|
};
|
|
1039
1039
|
}
|
|
1040
1040
|
/** A provider from the kernel definition `definition` under the first free id: what the + beside a provider picker adds. */
|
|
@@ -1113,10 +1113,8 @@ function scopeTree(agentKey, node) {
|
|
|
1113
1113
|
children: node.children.map((child) => scopeTree(agentKey, child)),
|
|
1114
1114
|
};
|
|
1115
1115
|
}
|
|
1116
|
-
/** Beside other agents, one with no id yet is named as an agent, not by its Identity facet. */
|
|
1117
1116
|
function agentRoot(agent, providers) {
|
|
1118
|
-
|
|
1119
|
-
return agent.identity.agentId.trim() ? root : { ...root, label: 'New agent' };
|
|
1117
|
+
return scopeTree(agent.key, studioTree(draftOf(agent, [], providers)));
|
|
1120
1118
|
}
|
|
1121
1119
|
export function workspaceTree(workspace) {
|
|
1122
1120
|
return {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{c as t,u as n}from"./themeProps-3IqahpCr.js";import{p as r}from"./fieldParts-CoOpDoax.js";import{t as i}from"./Icon-BqkS-pIq.js";import{t as a}from"./Text-BOqCfzZC.js";import{n as o,t as s}from"./IconButton-DVUFx-8p.js";import{t as c}from"./createReactComponent-CZwsv6DD.js";import{n as l,t as u}from"./ScrollableArea-ChTx-OVZ.js";import{n as d,t as f}from"./Center-nHS1JSux.js";import{t as p}from"./IconEye-BB5aY-wQ.js";import{t as m}from"./IconSearch-BTx66a40.js";import{r as h,s as g,t as _}from"./tree-D5eWDcqI.js";import{F as v,i as y}from"./workspace-AKMCUEuK.js";import{a as b,n as x,r as S}from"./studio-session-yEqFQo5o.js";import{t as C}from"./EmptyState-C_uF9Wyj.js";import{$ as w,Dt as T,Et as E,I as D,Q as O,Rt as k,Y as A,Z as j,d as M,et as N,n as P,rt as F,tt as I,zt as L}from"./index-CtmN7Ux2.js";var R=c(`outline`,`arrows-maximize`,`ArrowsMaximize`,[[`path`,{d:`M16 4l4 0l0 4`,key:`svg-0`}],[`path`,{d:`M14 10l6 -6`,key:`svg-1`}],[`path`,{d:`M8 20l-4 0l0 -4`,key:`svg-2`}],[`path`,{d:`M4 20l6 -6`,key:`svg-3`}],[`path`,{d:`M16 20l4 0l0 -4`,key:`svg-4`}],[`path`,{d:`M14 14l6 6`,key:`svg-5`}],[`path`,{d:`M8 4l-4 0l0 4`,key:`svg-6`}],[`path`,{d:`M4 4l6 6`,key:`svg-7`}]]),z=c(`outline`,`arrows-minimize`,`ArrowsMinimize`,[[`path`,{d:`M5 9l4 0l0 -4`,key:`svg-0`}],[`path`,{d:`M3 3l6 6`,key:`svg-1`}],[`path`,{d:`M5 15l4 0l0 4`,key:`svg-2`}],[`path`,{d:`M3 21l6 -6`,key:`svg-3`}],[`path`,{d:`M19 9l-4 0l0 -4`,key:`svg-4`}],[`path`,{d:`M15 9l6 -6`,key:`svg-5`}],[`path`,{d:`M19 15l-4 0l0 4`,key:`svg-6`}],[`path`,{d:`M15 15l6 6`,key:`svg-7`}]]),B=c(`outline`,`focus-2`,`Focus2`,[[`path`,{d:`M11.5 12a.5 .5 0 1 0 1 0a.5 .5 0 1 0 -1 0`,fill:`currentColor`,key:`svg-0`}],[`path`,{d:`M5 12a7 7 0 1 0 14 0a7 7 0 1 0 -14 0`,key:`svg-1`}],[`path`,{d:`M12 3l0 2`,key:`svg-2`}],[`path`,{d:`M3 12l2 0`,key:`svg-3`}],[`path`,{d:`M12 19l0 2`,key:`svg-4`}],[`path`,{d:`M19 12l2 0`,key:`svg-5`}]]),V=c(`outline`,`layout-grid`,`LayoutGrid`,[[`path`,{d:`M4 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4`,key:`svg-0`}],[`path`,{d:`M14 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4`,key:`svg-1`}],[`path`,{d:`M4 15a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4`,key:`svg-2`}],[`path`,{d:`M14 15a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4`,key:`svg-3`}]]);function H(e,t,n){let r=e=>{let r=t.flatMap(({from:t,to:n})=>t===e.id?[n]:n===e.id?[t]:[]).flatMap(e=>n.get(e)??[]);return r.length===0?1/0:r.reduce((e,t)=>e+t,0)/r.length},i=new Map(e.map(e=>[e.id,r(e)])),a=e=>i.get(e.id)??1/0;return[...e].sort((e,t)=>a(e)===a(t)?0:a(e)-a(t))}function U(e,t,n){return t===`models`?e.modelBindings.map(e=>e.modelId||`New model`).join(`, `):t===`tools`?String(e.tools.allow.filter(e=>n.has(e)).length):t===`outputs`?e.outputs.mode:``}function W(e,t=[]){let n=[],r=new Map(e.agents.map(e=>[e.key,y(e.key)])),i=new Map(e.toolSpecs.map(e=>[e.key,g(e.key)])),a=v(e),o=e.agents.map((e,t)=>{let{agentId:n,profileType:r,handle:o}=e.identity,s=r||`text`;return{id:y(e.key),kind:`agent`,label:n||`New agent`,note:o?`${s} · ${o}`:s,opens:y(e.key),type:s,rows:(a.agents[t]?.children??[]).map(t=>({id:t.id,label:t.label,note:U(e,t.ref.facet,i),opens:t.id,type:t.ref.facet}))}}),s=new Set(o.flatMap(e=>e.rows??[]).map(e=>e.id)),c=(e,t)=>{let n=y(e,t);return s.has(n)?n:y(e)},l=new Map,u=new Map(e.providers.map(e=>[e.id,e.definition])),d=new Map;for(let t of e.agents){let e=c(t.key,`models`);for(let i of t.modelBindings){let a=`model:${i.provider}:${i.apiId}:${i.modelId}`,o=h(i.provider);l.has(o)||l.set(o,{id:o,kind:`provider`,label:i.provider,note:``,opens:u.has(i.provider)?o:y(t.key,_(i.key))});let s=y(t.key,_(i.key)),c=d.get(a);c?c.holds?.push(s):(d.set(a,{id:a,kind:`model`,label:i.modelId||`New model`,note:i.apiId,opens:s,holds:[s]}),n.push({from:o,to:a,kind:`serves`})),n.some(t=>t.from===a&&t.to===e)||n.push({from:a,to:e,kind:`runs`});let f=i.compactWith?r.get(i.compactWith):void 0,p=n.some(t=>t.kind===`summarised`&&t.from===e);f&&f!==y(t.key)&&!p&&n.push({from:e,to:f,kind:`summarised`})}for(let e of t.tools.allow){let r=i.get(e);r&&n.push({from:c(t.key,`tools`),to:r,kind:`allows`})}}let f=e.toolSpecs.map(e=>{let t=g(e.key),i=e.toolType===`agent`?r.get(e.agentKey??``):r.get(e.stageAgentKey??``);return i&&n.push({from:t,to:i,kind:`asks`}),{id:t,kind:`tool`,label:e.toolName||`New tool`,note:e.description,opens:t,type:e.toolType}}),p=t.map(t=>{let{setting:i,facet:a}=t,o=`shared:${i.file}:${i.name}`,s=t.agents.filter(e=>r.has(e)),l=i.tools.flatMap(t=>{let n=e.toolSpecs.find(e=>e.toolName===t);return n?[g(n.key)]:[]});for(let e of s)n.push({from:o,to:a?c(e,a):y(e),kind:`sets`});for(let e of l)n.push({from:o,to:e,kind:`sets`});return{id:o,kind:`shared`,label:i.label,note:`${i.name} · ${i.file}:${String(i.line)}`,opens:F(t)??l[0],type:a}}),m=new Map(o.flatMap((e,t)=>[e.id,...(e.rows??[]).map(e=>e.id)].map(e=>[e,t])));for(let e of d.values())[...d.values()].some(t=>t!==e&&t.label===e.label)&&e.note&&(e.long=`${e.label} · ${e.note}`);let b=H([...d.values()],n,m),x=new Map(b.map((e,t)=>[e.id,t])),S=(...e)=>e.filter(e=>e.nodes.length>0);return{columns:[S({label:`Providers`,nodes:H([...l.values()],n,x)}),S({label:`Shared settings`,nodes:H(p,n,m)},{label:`Models`,nodes:b}),S({label:`Profiles`,nodes:o}),S({label:`Tools`,nodes:H(f,n,m)})].filter(e=>e.length>0),links:n}}function G(e){let t=e.columns.flat().flatMap(e=>e.nodes);return new Map(t.flatMap(e=>[e.id,...(e.rows??[]).map(e=>e.id)].map(t=>[t,e])))}function K(e){let t=G(e);return e.links.flatMap(e=>{let n=t.get(e.from)?.id,r=t.get(e.to)?.id;return n!==void 0&&r!==void 0?[{link:e,from:n,to:r}]:[]})}function ee(e,t){let n=t.trim().toLowerCase();return n===``?[]:e.columns.flat().flatMap(e=>e.nodes).filter(e=>[e.label,e.long??``,e.note].some(e=>e.toLowerCase().includes(n))).map(e=>e.id)}function te(e,t){let n=typeof t==`string`?[t]:t,r=K(e),i=(e,t)=>{let i=new Set(n),a=[...n];for(let n=a.pop();n!==void 0;n=a.pop())for(let o of r)o[e]!==n||i.has(o[t])||(i.add(o[t]),a.push(o[t]));return i},a=new Set([...i(`to`,`from`),...i(`from`,`to`)]),o=e.columns.map(e=>e.map(e=>({...e,nodes:e.nodes.filter(e=>a.has(e.id))})).filter(e=>e.nodes.length>0)).filter(e=>e.length>0),s=new Set(r.filter(({from:e,to:t})=>a.has(e)&&a.has(t)).map(({link:e})=>e));return{columns:o,links:e.links.filter(e=>s.has(e))}}var ne={serves:[`Serves`,`Served by`],sets:[`Sets`,`Set by`],runs:[`Runs`,`Runs on`],allows:[`Allows`,`Allowed by`],asks:[`Asks`,`Asked by`],summarised:[`Summarised by`,`Summarises for`]};function re(e,t){let n=G(e),r=new Map;for(let{link:i,from:a,to:o}of K(e)){if(a!==t&&o!==t)continue;let e=ne[i.kind][a===t?0:1],s=n.get(a===t?o:a)?.label;s!==void 0&&r.set(e,[...r.get(e)??[],s])}return[...r].map(([e,t])=>`${e} ${t.join(`, `)}.`).join(` `)}function ie(e){return e.kind===`tool`||e.kind===`shared`?2:1}var ae=24,q=8,J=16;function oe(e,t,n){let r=new Map,i=(e,t)=>`${e}:${String(t)}`;return K(e).flatMap(({link:e})=>{let[a,o]=[t(e.from),t(e.to)];if(a===void 0||o===void 0||Math.abs(a-o)<n)return[];let s=a<o?1:-1;for(let t of[i(e.from,s),i(e.to,-s)])r.set(t,(r.get(t)??0)+1);return[{link:e,way:s}]}).map(({link:e,way:t})=>{let[n,a]=[i(e.from,t),i(e.to,-t)],o=(r.get(n)??0)>=(r.get(a)??0);return{link:e,way:t,leaves:o,hub:o?n:a}})}function se(e,t,n={}){let{node:r,card:i,columnGap:a,rowGap:o,heading:s,groupGap:c,padding:l,lineGap:u}=t,{moved:d={},widths:f={},detail:p=!1}=n,m=new Map;e.columns.forEach((e,t)=>{for(let n of e)for(let e of n.nodes)if(!Object.hasOwn(d,e.id))for(let n of[e.id,...(e.rows??[]).map(e=>e.id)])m.set(n,t)});let h=t=>{let n={},a=[],u=[],m=new Map,h=0,g=0;return e.columns.forEach((e,_)=>{let v=t[_]??l,y=l;e.forEach((e,t)=>{t>0&&(y+=c),a.push({label:e.label,x:v,y}),u.push({id:`heading:${_}:${t}`,x:v,y,width:r.width,height:s}),y+=s;for(let t of e.nodes){let e=p?t.rows??[]:[],a=e.length>0||t.note!==``,s=p&&(e.length>0||ie(t)===1)?i.head:r.height,c=p&&!a?i.row:s,l=e.length>0?i.head+e.length*i.row+i.foot:c,_=Math.min(f[t.id]??r.width,r.width),b=Object.hasOwn(d,t.id)?d[t.id]:void 0,x=b?{x:Math.max(b.x,0),y:Math.max(b.y,0)}:{x:v,y};n[t.id]={...x,height:l},u.push({id:t.id,...x,width:_,height:l});let S={left:x.x,right:x.x+_,y:x.y+(p?i.row:c)/2};m.set(t.id,S);for(let[e,n]of(t.rows??[]).entries())m.set(n.id,p?{...S,y:x.y+i.head+e*i.row+i.row/2}:S);h=Math.max(h,x.x+r.width),g=Math.max(g,x.y+l),y+=l+o}y-=o})}),{nodes:n,headings:a,boxes:u,ports:m,right:h,bottom:g}},g=(e,t,n)=>{let{way:i,leaves:a}=e,o={x:i>0?t.right+u:t.left-u,y:t.y},s={x:i>0?n.left-u:n.right+u,y:n.y},c=i>0?Math.max(t.left+r.width,t.right)+u:o.x,l=i>0?s.x:Math.max(n.left+r.width,n.right)+u,d=a?l:c,f=a?-i:i;return{start:o,end:s,side:d,into:f,room:Math.abs(l-c),strip:`${String(d)}:${String(f)}`}},_=t=>{let n=new Map(oe(e,e=>t.get(e)?.left,r.width).map(e=>[e.link,e])),i=new Map;for(let e of n.values()){let n=t.get(e.link.from),r=t.get(e.link.to);if(!n||!r||n.y===r.y)continue;let{strip:a}=g(e,n,r),o=i.get(a)??new Map,s=e.leaves?e.link.to:e.link.from,c=o.get(e.hub)??{y:e.leaves?n.y:r.y,joins:[],beside:s};c.joins.push(e.leaves?r.y:n.y),i.set(a,o.set(e.hub,c))}let a=new Map,o=new Map;for(let[e,t]of i){let n=e=>e.reduce((e,t)=>e+t,0)/e.length,r=[...t.values()],i=n(r.flatMap(e=>e.joins))>=n(r.map(e=>e.y)),s=[];for(let[n,r]of[...t].sort(([,e],[,t])=>i?e.y-t.y:t.y-e.y)){let t=Math.min(r.y,...r.joins)-q,i=Math.max(r.y,...r.joins)+q,o=s.findIndex(e=>e.every(e=>i<e.low||t>e.high)),c=o<0?s.length:o;s[c]=[...s[c]??[],{low:t,high:i}],a.set(`${e}:${n}`,c)}let[c]=r;c&&o.set(e,{count:s.length,beside:c.beside,into:Number(e.split(`:`)[1])})}return{spans:n,rails:a,held:o}},v=e.columns.map((e,t)=>l+t*(r.width+a)),y=e.columns.map(()=>0);for(let{count:e,beside:t,into:n}of _(h(v).ports).held.values()){let r=m.get(t);if(r===void 0)continue;let i=n>0?r:r-1;i>=0&&i<y.length&&(y[i]=(y[i]??0)+e+1)}let b=[l];for(let[e,t]of y.entries())b.push((b[e]??l)+r.width+Math.max(a,t*J));let x=h(b),{nodes:S,headings:C,boxes:w,ports:D}=x,{right:O,bottom:k}=x,{spans:A,rails:j}=_(D),M=a/2,N=Math.max(o/2,u),P=[],F=new Map,I=Math.max(a,...y.map(e=>e*J)),L=K(e).flatMap(({link:e,from:t,to:n})=>{let i=D.get(e.from),o=D.get(e.to);if(!i||!o)return[];let s=w.filter(e=>e.id!==t&&e.id!==n);if(Math.abs(i.left-o.left)<r.width){let r=i.right+u,a=o.right+u,c=s.filter(e=>e.y<Math.max(i.y,o.y)&&e.y+e.height>Math.min(i.y,o.y)&&e.x<Math.max(r,a)+M&&e.x+e.width>Math.min(i.left,o.left)),l=Math.max(r,a,...c.map(e=>e.x+e.width))+M;return O=Math.max(O,l),[{link:e,from:t,to:n,d:E({x:r,y:i.y},{x:a,y:o.y},l).d}]}let c=A.get(e);if(!c)return[];let{way:l,leaves:d,hub:f}=c,{start:p,end:m,side:h,into:_,room:v,strip:y}=g(c,i,o),b=h+_*Math.min((1+(j.get(`${y}:${f}`)??0))*J,Math.max(v-J,0)),x=v<32?E(p,m):T(p,m,b,q),S=(e,t)=>t>e.y-N&&t<e.y+e.height+N,C=Math.abs(m.x-p.x)<I+a?[]:s.filter(e=>Array.from({length:23},(e,t)=>x.at((t+1)/ae)).some(t=>t.x>e.x&&t.x<e.x+e.width&&S(e,t.y)));if(C.length===0)return[{link:e,from:t,to:n,d:x.d}];let[L,R]=[Math.min(p.x,m.x),Math.max(p.x,m.x)],z=e=>{let t=[...C];for(;;){let n=e<0?Math.min(...t.map(e=>e.y))-N:Math.max(...t.map(e=>e.y+e.height))+N,r=[...s,...P].filter(e=>!t.includes(e)&&e.x<R&&e.x+e.width>L&&S(e,n));if(r.length===0)return n;t.push(...r)}},B=e=>Math.abs(i.y-e)+Math.abs(o.y-e),V=`${f}:${y}`,H=F.get(V)??(()=>{let[e,t]=[z(-1),z(1)],n=e>=0&&B(e)<=B(t)?e:t;return P.push({id:``,x:L,y:n-q+N,width:R-L,height:2*(q-N)}),F.set(V,n),n})();k=Math.max(k,H);let U=d?p.x+l*J:b,W=d?b:m.x-l*J,G={x:(U+W)/2,y:H};return[{link:e,from:t,to:n,d:T(p,G,U,q).d+T(G,m,W,q).d.replace(/^M \S+ \S+/,``)}]});return{width:Math.max((b[Math.max(e.columns.length-1,0)]??l)+r.width,O)+l,height:Math.max(k,l)+l,nodes:S,headings:C,lines:L}}var Y=e(n(),1),ce={tokens:{},detail:{},expanded:!1},X=e=>e===void 0?`${x}.map`:`${x}.map.project:${e}`;function le(e){if(!S(e))return{};let t={};for(let[n,r]of Object.entries(e))S(r)&&typeof r.x==`number`&&typeof r.y==`number`&&(t[n]={x:r.x,y:r.y});return t}function ue(e){try{let t=JSON.parse(b()?.getItem(X(e))??`null`);return S(t)?{tokens:le(t.tokens),detail:le(t.detail),expanded:t.expanded===!0,...typeof t.family==`string`?{family:t.family}:{}}:ce}catch{return ce}}function de(e,t){let{tokens:n,detail:r,expanded:i,family:a}=t,o=Object.keys(n).length===0&&Object.keys(r).length===0&&!i&&a===void 0;try{o?b()?.removeItem(X(e)):b()?.setItem(X(e),JSON.stringify(t))}catch{}}function fe(e){for(let t=e.parentElement;t;t=t.parentElement){let{overflowX:e,overflowY:n}=getComputedStyle(t);if(/auto|scroll/.test(`${e} ${n}`))return t}}function pe(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return{left:n.left-r.left+t.scrollLeft,top:n.top-r.top+t.scrollTop}}var me=(e,t)=>Math.min(Math.max(e,0),Math.max(t,0));function he(e,t){let n=0,r=120,i=()=>{--r;let a=fe(e);if(a&&a.scrollWidth>a.clientWidth){let e=t(a),n=me(e.left,a.scrollWidth-a.clientWidth),r=me(e.top,a.scrollHeight-a.clientHeight);if(a.scrollTo({left:n,top:r,behavior:`instant`}),Math.abs(a.scrollLeft-n)<1&&Math.abs(a.scrollTop-r)<1)return}r>0&&(n=requestAnimationFrame(i))};return i(),()=>{cancelAnimationFrame(n)}}var ge=e=>e.button===0&&e.pointerType!==`touch`;function _e(e,t,n){let{pointerId:r,clientX:i,clientY:a}=e,o=e=>{e.pointerId===r&&t(e.clientX-i,e.clientY-a)},s=e=>{e.pointerId===r&&(globalThis.removeEventListener(`pointermove`,o),globalThis.removeEventListener(`pointerup`,s),globalThis.removeEventListener(`pointercancel`,s),n(e.type===`pointerup`))};globalThis.addEventListener(`pointermove`,o),globalThis.addEventListener(`pointerup`,s),globalThis.addEventListener(`pointercancel`,s)}function ve(e){let[t,n]=(0,Y.useState)(!1);return{panning:t,pan:t=>{if(!ge(t)||t.target.closest(e))return;let r=fe(t.currentTarget);if(!r)return;let{scrollLeft:i,scrollTop:a}=r;n(!0),_e(t,(e,t)=>{r.scrollTo({left:i-e,top:a-t,behavior:`instant`})},()=>{n(!1)})}}}var Z=t(),ye={node:{width:240,height:24},card:{head:60,row:28,foot:4},columnGap:96,rowGap:6,heading:24,groupGap:16,padding:24,lineGap:8},be={...ye,node:{width:240,height:84}},xe=28;function Se(e){return e.length>xe?`${e.slice(0,27)}…`:e}function Ce({kind:e,type:t,note:n}){return(e===`agent`?N(t):void 0)||(e===`tool`?I(t??``):e===`model`?M(n)??P.modelBinding:e===`provider`?L:e===`shared`&&t&&Object.hasOwn(P,t)?P[t]:e===`agent`?w.text:k)}function we(e){return Object.hasOwn(P,e)?P[e]:k}function Q(e,t){return e.kind===`agent`?t===e.id||t.startsWith(`${e.id}/`):e.kind===`model`?e.holds?.includes(t)??!1:e.kind===`tool`&&t===e.id}var Te=4,Ee=24,De={ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0},ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1}};function Oe(e){let t=A()?.name,[n,r]=(0,Y.useState)(()=>ue(t)),i=e=>{r(e),de(t,e)},{expanded:a}=n,o=e.columns.flat().some(e=>e.nodes.some(e=>e.id===n.family))?n.family:void 0,s=(0,Y.useMemo)(()=>o===void 0?e:te(e,o),[e,o]),[c,l]=(0,Y.useState)({}),u=a?`detail`:`tokens`;return{expanded:a,family:o,map:s,moved:o===void 0?n[u]:c,put(e,t){o===void 0?t?i({...n,[u]:e}):r({...n,[u]:e}):l(e)},showFamily(e){l({});let{tokens:t,detail:r}=n;i({tokens:t,detail:r,expanded:a,...e===void 0?{}:{family:e}})},expand(){i({...n,expanded:!a})}}}function ke(e,t,n){let r=(0,Y.useRef)(!1),[i,a]=(0,Y.useState)();return{dragging:i,draggable:i=>({onPointerDown:o=>{r.current=!1;let s=e.nodes[i];if(!s||!ge(o))return;let c;_e(o,(e,r)=>{!c&&Math.hypot(e,r)<Te||(c||a(i),c={...t,[i]:{x:Math.max(s.x+e,0),y:Math.max(s.y+r,0)}},n(c,!1))},e=>{c&&(r.current=e,globalThis.setTimeout(()=>{r.current=!1},0),a(void 0),n(c,!0))})},onClickCapture:e=>{r.current&&(r.current=!1,e.stopPropagation(),e.preventDefault())},onKeyDown:r=>{let a=r.altKey?De[r.key]:void 0,o=e.nodes[i];if(!a||!o)return;r.preventDefault();let s=Math.max(o.x+a.x*Ee,0),c=Math.max(o.y+a.y*Ee,0);n({...t,[i]:{x:s,y:c}},!0)}})}}function Ae(e){let[t,n]=(0,Y.useState)(),[r,i]=(0,Y.useMemo)(()=>{let n=new Set,r=new Set;if(t===void 0)return[n,r];n.add(t);for(let{link:i,from:a,to:o}of e.lines)if([i.from,i.to,a,o].includes(t)){r.add(i);for(let e of[i.from,i.to,a,o])n.add(e)}return[n,r]},[e,t]);return{lit:t,on:r,onLines:i,lights:e=>({onPointerEnter:()=>{n(e)},onPointerLeave:()=>{n(void 0)},onFocus:()=>{n(e)},onBlur:()=>{n(void 0)}})}}function je(e,t,n){let r=(0,Y.useRef)(n.place);r.current=n.place;let{sizes:i}=n;(0,Y.useEffect)(()=>{let n=e.current;if(!n)return;let a=r.current,o=t===void 0?a:void 0;return he(n,e=>{let{left:t,top:r}=pe(n,e);return o===void 0?{left:t,top:r}:{left:t+o.x+i.node.width/2-e.clientWidth/2,top:r+o.y+o.height/2-e.clientHeight/2}})},[e,t,i])}function Me(e,t,n){let{family:r,expanded:i,isMoved:a,showFamily:o,expand:s,tidy:c}=n,l=[];e&&e.id!==r&&l.push({label:`Show only its family`,icon:B,onClick:()=>{o(e.id)}});let u=e?.opens;u!==void 0&&l.push({label:`Open`,icon:d,onClick:()=>{t(u)}}),e&&l.push({type:`divider`});let f={label:`Show everything`,icon:p,onClick:()=>{o(void 0)}};return[...l,...r===void 0?[]:[f],{label:i?`Collapse`:`Expand`,icon:i?z:R,onClick:s},{label:`Tidy`,icon:V,isDisabled:!a,onClick:c}]}function Ne({actions:e,query:t,onQuery:n,onClose:a}){let{family:c,expanded:u,isMoved:d,showFamily:f,expand:h,tidy:g}=e;return(0,Z.jsxs)(`div`,{className:`studio-map-tools`,children:[(0,Z.jsx)(l,{label:`Search the map`,isLabelHidden:!0,size:`sm`,width:200,placeholder:`Search`,startIcon:m,hasClear:!0,value:t,onChange:n}),c!==void 0&&(0,Z.jsx)(o,{label:`Show everything`,variant:`ghost`,size:`sm`,icon:(0,Z.jsx)(i,{icon:p,size:`sm`}),onClick:()=>{f(void 0)}}),d&&(0,Z.jsx)(o,{label:`Tidy`,variant:`ghost`,size:`sm`,icon:(0,Z.jsx)(i,{icon:V,size:`sm`}),onClick:g}),(0,Z.jsx)(s,{label:u?`Collapse`:`Expand`,variant:`ghost`,size:`sm`,icon:(0,Z.jsx)(i,{icon:u?z:R,size:`sm`}),tooltip:u?`Show each node as a token`:`Show sections and descriptions`,onClick:h}),(0,Z.jsx)(s,{label:`Close map`,variant:`ghost`,size:`sm`,icon:(0,Z.jsx)(i,{icon:r,size:`sm`}),tooltip:`Close the map`,onClick:a})]})}function $({node:e,on:t,isFound:n,isDragging:r}){let i=t.has(e.id)||(e.rows??[]).some(e=>t.has(e.id));return{"data-map-node":e.id,"data-on":i?``:void 0,"data-found":n?``:void 0,"data-dragging":r?``:void 0}}function Pe(e){let{node:t,place:n,joins:r,selected:i,onOpen:a,lights:o,drag:s}=e,{opens:c}=t,l=Q(t,i);return(0,Z.jsx)(j,{id:t.id,label:Se(t.long??t.label),icon:Ce(t),x:n.x,y:n.y+n.height/2,color:l?`blue`:void 0,description:[t.note,r].filter(Boolean).join(`. `)||void 0,onOpen:c===void 0?void 0:()=>{a(c)},title:(t.long??t.label).length>xe?t.long??t.label:void 0,"aria-current":l?`true`:void 0,...$(e),...o(t.id),...s})}function Fe(e){let{node:t,place:n,joins:r,selected:o,on:s,onOpen:c,lights:l,drag:u}=e,{opens:d}=t,f=t.rows??[],p={left:n.x,top:n.y,height:n.height},m=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{className:`studio-map-name`,children:[(0,Z.jsx)(i,{icon:Ce(t),size:`sm`}),(0,Z.jsx)(a,{type:`supporting`,color:`inherit`,weight:`medium`,maxLines:1,hasTruncateTooltip:!1,children:t.label})]}),t.note&&(0,Z.jsx)(a,{type:`supporting`,maxLines:f.length>0?1:ie(t),hasTruncateTooltip:!1,className:`studio-map-note`,children:t.note})]}),h={type:`button`,title:t.note||void 0,"aria-description":r||void 0,disabled:d===void 0,onClick:()=>{d!==void 0&&c(d)},...l(t.id)};return f.length===0?(0,Z.jsx)(`button`,{...h,...u,...$(e),className:`studio-map-node`,"data-map-token":t.id,style:p,"aria-current":Q(t,o)?`true`:void 0,children:m}):(0,Z.jsxs)(`div`,{className:`studio-map-card`,"data-map-token":t.id,style:p,"data-open":Q(t,o)?``:void 0,...$(e),...u,children:[(0,Z.jsx)(`button`,{...h,className:`studio-map-head`,"aria-current":o===t.id?`true`:void 0,children:m}),f.map(e=>(0,Z.jsxs)(`button`,{type:`button`,className:`studio-map-row`,"aria-current":o===e.id?`true`:void 0,"data-on":s.has(e.id)?``:void 0,onClick:()=>{c(e.opens)},...l(e.id),children:[(0,Z.jsx)(i,{icon:we(e.type),size:`sm`}),(0,Z.jsx)(a,{type:`supporting`,color:`inherit`,weight:`medium`,maxLines:1,hasTruncateTooltip:!1,children:e.label}),e.note&&(0,Z.jsx)(a,{type:`supporting`,maxLines:1,justify:`end`,hasTruncateTooltip:!1,className:`studio-map-row-note`,children:e.note})]},e.id))]})}function Ie({workspace:e,shared:t,selected:n,onOpen:r,onClose:o}){let{expanded:s,family:c,map:l,moved:d,put:p,showFamily:h,expand:g}=Oe((0,Y.useMemo)(()=>W(e,t),[e,t])),[_,v]=(0,Y.useState)(``),y=(0,Y.useMemo)(()=>ee(l,_),[l,_]),b=(0,Y.useMemo)(()=>_.trim()===``?l:te(l,y),[l,_,y]),x=_.trim()!==``&&y.length===0,S=(0,Y.useRef)(null),w=s?be:ye,T=(0,Y.useMemo)(()=>({map:b,expanded:s}),[b,s]),E=O(S,T),k=(0,Y.useMemo)(()=>se(b,w,{moved:d,widths:E,detail:s}),[b,w,s,d,E]),A=b.columns.flat().flatMap(e=>e.nodes),j=A.find(e=>Q(e,n))?.id;je(S,c,{place:j===void 0?void 0:k.nodes[j],sizes:w});let{dragging:M,draggable:N}=ke(k,d,p),{panning:P,pan:F}=ve(`[data-map-node]`),{lit:I,on:L,onLines:R,lights:z}=Ae(k),B={family:c,expanded:s,isMoved:A.some(e=>Object.hasOwn(d,e.id)),showFamily:h,expand:g,tidy:()=>{p({},!0)}},[V,H]=(0,Y.useState)(),U=Me(A.find(e=>e.id===V),r,B),G=s?Fe:Pe,K=A.find(e=>Q(e,n))?.id,ne=e=>R.has(e.link)?2:+(e.from===K||e.to===K),ie=[...k.lines].sort((e,t)=>ne(e)-ne(t));return(0,Z.jsxs)(`div`,{className:`studio-map-frame`,role:`none`,onKeyDown:e=>{e.key===`Escape`&&c!==void 0&&(e.target.closest(`[role="menu"]`)||(e.stopPropagation(),h(void 0)))},children:[(0,Z.jsx)(u,{className:`studio-map-scroll`,axis:`both`,role:`region`,label:`Map`,height:`100%`,overscroll:`allow`,children:(0,Z.jsx)(D,{items:U,label:`Map actions`,"data-map-field":``,children:(0,Z.jsxs)(`div`,{ref:S,className:`studio-map`,"data-lit":I===void 0||M!==void 0?void 0:``,"data-panning":P?``:void 0,onPointerDown:F,onContextMenuCapture:e=>{H(e.target.closest(`[data-map-node]`)?.dataset.mapNode)},style:{"--map-width":`${String(k.width)}px`,"--map-height":`${String(k.height)}px`,"--map-slot":`${String(w.node.width)}px`,"--map-line":`${String(w.card.row)}px`},children:[(0,Z.jsx)(`svg`,{className:`studio-map-lines`,width:k.width,height:k.height,"aria-hidden":`true`,children:ie.map(({link:e,from:t,to:n,d:r})=>(0,Z.jsx)(`path`,{className:`map-line`,d:r,"data-kind":e.kind,"data-on":R.has(e)?``:void 0,"data-open":t===K||n===K?``:void 0},`${e.kind}:${e.from}:${e.to}`))}),k.headings.map(({label:e,x:t,y:n})=>(0,Z.jsx)(`div`,{className:`studio-map-heading`,style:{left:t,top:n},children:(0,Z.jsx)(a,{type:`supporting`,color:`secondary`,weight:`semibold`,children:e})},e)),A.map(e=>{let t=k.nodes[e.id];return t&&(0,Z.jsx)(G,{node:e,place:t,joins:re(b,e.id),selected:n,on:L,isFound:y.includes(e.id),isDragging:M===e.id,onOpen:r,lights:z,drag:N(e.id)},e.id)})]})})}),x&&(0,Z.jsx)(f,{className:`studio-map-nothing`,children:(0,Z.jsx)(C,{headingLevel:2,icon:(0,Z.jsx)(i,{icon:m,size:`lg`}),title:`Nothing matches`})}),(0,Z.jsx)(Ne,{actions:B,query:_,onQuery:v,onClose:o})]})}export{Ie as StudioMap};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{C as e,M as t,Vt as n,h as r,j as i,mn as a,n as o,p as s,qt as c,t as l,y as ee,yn as u,z as d}from"./tool-schema-B_EOjDjg.js";import{An as te,Cn as ne,Hn as re,Nn as f,Pn as ie,Sn as ae,Wn as oe,an as p,br as m,gr as se,pn as h,yn as g}from"./shaped-data-DAdn_XvU.js";import{a as _,r as v}from"./live-ingress-OuSlQ6q7.js";var ce=[{id:`identity`,profilePath:`identity`,role:`root`,optional:!1,editor:`structural`,label:`Identity`,ownsFields:[`profile.id`,`profile.type`]},{id:`models`,profilePath:`models`,role:`spine`,optional:!1,editor:`structural`,label:`Models`,ownsFields:[`profile.defaultModel`,`profile.allowModelSelect`,`profile.maxSteps`,`providerContinuation`]},{id:`modelBinding`,profilePath:`models.*`,role:`branch`,parent:`models`,optional:!1,editor:`structural`,label:`Model binding`},{id:`decision`,profilePath:`decision`,role:`spine`,optional:!1,editor:`structural`,label:`Decision`,ownsFields:[`inputs`]},{id:`image`,profilePath:`image`,role:`spine`,optional:!1,editor:`structural`,label:`Image`},{id:`speech`,profilePath:`speech`,role:`spine`,optional:!1,editor:`structural`,label:`Speech`},{id:`live`,profilePath:`live`,role:`spine`,optional:!1,editor:`structural`,label:`Live`},{id:`tools`,profilePath:`tools`,role:`spine`,optional:!1,editor:`structural`,label:`Tools`},{id:`toolSpec`,profilePath:`tools.allow`,role:`branch`,parent:`tools`,optional:!0,editor:`structural`,label:`Tool`},{id:`inputs`,profilePath:`inputs`,role:`spine`,optional:!1,editor:`structural`,label:`Inputs`},{id:`outputs`,profilePath:`outputs`,role:`spine`,optional:!0,editor:`structural`,label:`Outputs`},{id:`turnBehaviour`,profilePath:`turnBehaviour`,role:`spine`,optional:!0,editor:`structural`,label:`Turn behaviour`},{id:`guardrails`,profilePath:`guardrails`,role:`spine`,optional:!0,editor:`structural`,label:`Guardrails`},{id:`observability`,profilePath:`observability`,role:`spine`,optional:!0,editor:`structural`,label:`Observability`},{id:`labels`,profilePath:`labels`,role:`spine`,optional:!0,editor:`structural`,label:`Labels`}],le={identity:te,inputs:f(`inputs`).filter(e=>e!==`decision`)},y=ce.map(e=>({...e,profileTypes:le[e.id]??f(e.profilePath)}));function ue(e){return y.find(t=>t.id===e)}function de(e){return e.modelBindings.length>1}function fe(e){return e.modelBindings.some(n=>n.provider!==`local`&&!t(e.providers,n).keySlot)}function b(e,n){let r={provider:n.provider,keySlot:n.keySlot||e.models.key,fallbackKeySlot:n.fallbackKeySlot||e.models.fallbackKey},i=t(e.providers,r);return{...i,given:{keySlot:!!i.keySlot&&!r.keySlot,fallbackKeySlot:!!i.fallbackKeySlot&&!r.fallbackKeySlot}}}function pe(e,t){let n=new Set(e.modelBindings.filter(n=>{let r=b(e,n);return r.keySlot===t||r.fallbackKeySlot===t}).map(e=>e.provider));return e.providers.filter(e=>n.has(e.id))}function me(e){let t=e.efforts.map(({alias:e})=>e.trim()).filter(Boolean);return new Set(t).size>1}function he(e){return e.attachmentsAccept.length>0||e.voiceAccept.length>0}var ge=h,_e=[{name:`operationTimeoutMs`,label:`Call timeout`,units:`ms`,isTimer:!0},{name:`connectTimeoutMs`,label:`Connect timeout`,units:`ms`,isTimer:!0},{name:`liveStepTimeoutMs`,label:`Live step timeout`,units:`ms`,isTimer:!0},{name:`maxWireRecordBytes`,label:`Wire record`,units:`bytes`,isTimer:!1},{name:`maxWireResponseBytes`,label:`Wire response`,units:`bytes`,isTimer:!1},{name:`maxEventBytes`,label:`Event`,units:`bytes`,isTimer:!1},{name:`maxStepBytes`,label:`Step`,units:`bytes`,isTimer:!1},{name:`maxStepEvents`,label:`Step events`,units:`events`,isTimer:!1},{name:`maxPendingToolCalls`,label:`Tool calls`,units:`calls`,isTimer:!1}],x=2147483647,S={compactMaxTokens:32e3,compactAt:.75,compactKeep:4},C={"continue.instruction":`turnBehaviour`,"canary.bind_note":`guardrails`,"quota.exhausted":`guardrails`,"repair.default_guidance":`outputs`,"egress.default_repair_guidance":`guardrails`,"egress.refusal":`guardrails`};function w(e){return`${e}-${crypto.randomUUID().slice(0,8)}`}function T(e){return{key:w(`model`),modelId:`fast`,protocol:`openRouterOpenAi`,provider:`openrouter`,apiId:``,options:{},timeoutMs:null,efforts:[],defaultEffort:``,allowEffortSelect:!1,summaries:null,maxOutputTokens:null,temperature:null,builtInTools:[],...e}}var E=`Studio stub tool — returns a fixed result.`;function D(e){return{key:w(`tool`),toolName:`my_tool`,toolType:`function`,description:E,category:`studio`,access:g[0],permission:ne[0],loadTier:ae[0],paths:[`*`],inputJson:l,outputJson:o,...e}}function O(e,t,n){return(!e.description.trim()||e.description===E)&&n?{agentKey:t,description:`Asks ${n} and returns its answer.`}:{agentKey:t}}function k(){return{name:``,kind:`words`,pattern:``,flags:``,words:[]}}function A(){return{key:``,label:``,at:m(se,()=>`ignore`),patterns:[k()],hint:``}}function j(){let e=u(void 0);return{canaryBindNote:``,detect:m(ie,t=>({...e.detect[t]})),sources:Object.fromEntries(re.map(e=>[e,{theorem:!0,patterns:[],hint:``}])),own:[],quotaEnabled:!1,quotaPerDay:null,quotaMessage:``,allow:{ungiven_images:{hosts:[],fromTools:!0},ungiven_links:{hosts:[],fromTools:!0}},innocentNames:[],blockedReplyOnBlock:``,blockedReplyMaxRetries:null,egressRepairGuidance:``,egressRefusal:``,allowPrivateNetworks:!1,allowedHosts:[],allowedSchemes:[],taintAfterRemoteRead:``,taintRemoteDestination:``}}function M(){let e=_({});return{writeTo:s,destination:s,sampleRate:e.sampleRate,include:{...e.include},scrub:{sensitive:e.scrub.sensitive,injection:e.scrub.injection,canary:e.scrub.canary},retainForDays:null,rotateAfterMiB:null,resourceJson:``}}function N(e){return e.map(([e,t])=>({key:w(`criterion`),label:e,text:t}))}function P(){return{contract:`guardrails.tool_call.v1`,maxStateBytes:null,questions:[{key:w(`question`),id:`verdict`,type:`choice`,instructions:`Given what the user asked for and what the call would do, should it run?`,criteria:N([[`allow`,`Safe, and what the user asked for.`],[`flag`,`Probably fine, but unusual or sensitive enough for a person to look first.`],[`block`,`Harmful, or clearly beyond what the user asked for.`]])},{key:w(`question`),id:`risk`,type:`score`,instructions:`How much harm would this call do if it were wrong?`,criteria:N([[``,`Low: reversible, and affects only the user.`],[``,`High: hard to undo, or affects other people or money.`]])}],images:[]}}var F=JSON.stringify({context:`The user asked the agent to tidy up old screenshots on their desktop.`,tool_call:{name:`delete_files`,path:`~/Documents`,recursive:!0},outcome:`Would delete 1,284 files, including tax_return_2025.pdf.`},null,2),I=JSON.stringify(`The user asked to tidy screenshots. The proposed call recursively deletes 1,284 files, including a tax return.`),ve=`To clear your desktop, select the screenshots and move them to the Trash. Empty the Trash to delete them for good.(Screen captures save to the desktop by default. You can change where they go in the Screenshot app's Options menu.(Press Command-Shift-5 to record the screen or capture a window. Recordings are saved as movie files next to your screenshots.(Stacks group desktop files by kind, date or tag, so a cluttered desktop folds into a few piles you can open one at a time.(Deleted files stay in the Trash for 30 days. Drag a file out of the Trash to put it back where it was.(When your disk is almost full, open Storage settings and review the largest files. Old downloads and installers are safe to remove.(Offloading unused apps frees space and keeps their documents. Reinstalling an app brings its data back.(Photos you have backed up can be optimised so the originals live in the cloud and smaller copies stay on the device.(Your plan renews on the same date each month. You can see the next charge under Billing, then Upcoming invoices.(To get a refund, open the invoice and choose Request refund. Charges from the last 14 days are refunded in full.(Update your card under Billing, then Payment methods. The new card is used for the next renewal, not for past invoices.(Annual plans cost two months less than paying monthly. Switching mid-term credits the unused months to the new plan.(Invoices are emailed as PDFs and list your company name and tax number. Edit those details before the invoice is issued.(Turn on two-step verification under Security. You will be asked for a code from your authenticator app each time you sign in on a new device.(If you forget your password, choose Forgot password on the sign-in page. The reset link expires after one hour.(Review signed-in devices under Security and sign out any you don't recognise. This ends their sessions immediately.(Passkeys replace your password with your fingerprint or face. Create one under Security, then Passkeys.(To close your account, export your data first. Closing deletes your workspace after a 30-day grace period.(Share a folder by choosing Share, then entering an email address. Viewers can read; editors can change and delete.(Public links work for anyone who has them. Set an expiry date, or turn the link off to stop sharing at once.(Transfer ownership of a folder before you leave a team, or its contents will be archived with your account.(Lisbon has mild, wet winters and warm, dry summers. Expect highs near 28 °C in August.(The best months for the Algarve coast are May, June and September, when the beaches are warm and the crowds are thin.(Trams in Lisbon climb the steep hills of Alfama and Graça. Line 28 is the famous one, and the busiest.(For a crisp pizza base, preheat the oven and the baking tray together at the highest setting for at least thirty minutes.(Rest steak for five minutes after cooking so the juices settle back into the meat instead of running onto the board.`.split(`(`).join(`
|
|
2
|
-
|
|
3
|
-
`),ye=`How do I delete every screenshot on my desktop?`;function be(e,t=`choice`){let n=K(`question`,e.decision.questions.map(e=>e.id),e=>`question_${e}`);return{key:w(`question`),id:n,type:t,instructions:``,criteria:z(t)}}function L(e,t,n){let r=t.replace(/\.[^.]*$/,``).toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_|_$/g,``)||`image`,i=K(r,e.decision.images.map(e=>e.name),e=>`${r}_${e}`);return{key:w(`image`),name:i,...n}}function xe(e){let t=K(`slot`,e.map(e=>e.name),e=>`slot_${String(e)}`);return{key:w(`slot`),name:t,label:``,choices:[R(),R()]}}function R(){return{key:w(`choice`),value:``,description:``}}function z(e){return e===`noul`||e===`box`?[]:N(e===`choice`?[[`yes`,``],[`no`,``]]:[[``,``],[``,``]])}function Se(){return{identity:{agentId:``,profileType:``,handle:``,system:``,systemByRoleJson:``},included:[`observability`,`labels`],models:{defaultModel:``,allowModelSelect:!1,maxSteps:null,key:``},modelBindings:[],providers:[...e],tools:{t2Loader:``,parallel:!1},toolSpecs:[],inputs:{text:!0,attachmentsAccept:[],voiceAccept:[],maxFiles:null,maxBytes:null,maxTurnBytes:null,limitsByMime:{},slots:[],contextFrom:[],contextMaxChars:null},outputs:{mode:`text`,schemaId:``,schemaJson:``,streamMode:``,streamThoughts:!0,validationEnabled:!1,maxRetries:null,itemRules:{},repairGuidance:``},turnBehaviour:{resumeEnabled:!1,allowContinue:[],autoContinue:[],maxContinues:null,continueInstruction:``,allowSteering:c({type:`text`}),atStepLimit:`stop`},guardrails:j(),observability:M(),image:{aspectRatio:``,resolution:``,mimeType:``,quality:``,background:``,n:null,seed:null,outputCompression:null,includeText:!1,references:[]},speech:{voice:``,style:``,speed:null,format:``},live:{ingressAudio:v(`audio`),ingressVideo:v(`video`),ingressText:v(`text`),voice:``,sessionResumption:!1,greeting:``,resumedPrompt:``,resumedAfterMs:null,contextCompression:!1,compressionTriggerTokens:null,compressionTargetTokens:null,transcriptionInput:!1,transcriptionOutput:!1,vadActivityHandling:``,vadStartSensitivity:``,vadEndSensitivity:``,vadPrefixPaddingMs:null,vadSilenceDurationMs:null},decision:P(),labels:{}}}var Ce=new Set([`guardrails`]);function B(e,t){return e.profileTypes.includes(t)&&!(t===`decision`&&Ce.has(e.id))}function V(e){let t=e.identity.profileType;if(!t)return[`identity`];let n=new Set(e.included);return y.filter(e=>e.role!==`branch`&&B(e,t)&&(!e.optional||n.has(e.id))).map(e=>e.id)}function H(e,t){let n=e.identity.profileType;return n!==``&&f(t).includes(n)}function we(e){return H(e,`identity.system`)&&oe(e.guardrails.detect,`canary_leak`)}function Te(e){let t=e.identity.profileType;return t!==``&&n.includes(t)}function U(e){let t=e.identity.profileType;return t?y.filter(n=>n.role===`spine`&&n.optional&&B(n,t)&&!e.included.includes(n.id)).map(e=>e.id):[]}function Ee(e){return{...e,attachmentsAccept:e.attachmentsAccept.filter(e=>a(p,e)),voiceAccept:[]}}function De(e,t,n){let r=e.modelBindings.find(e=>e.key===t);return r?{...e,models:n.modelId!==void 0&&e.models.defaultModel===r.modelId?{...e.models,defaultModel:n.modelId}:e.models,modelBindings:e.modelBindings.map(e=>e.key===t?{...e,...n}:e)}:e}function W(e,t){if(t.some(t=>t.modelId===e))return e;let[n,...r]=t;return n&&!r.length?n.modelId:``}function Oe(e,t){if(!e.modelBindings.find(e=>e.key===t))return e;let n=e.modelBindings.filter(e=>e.key!==t);return{...e,models:{...e.models,defaultModel:W(e.models.defaultModel,n)},modelBindings:n}}function G(e,t){let n=e.identity.profileType,r=n&&n!==`host`?n:`text`,i=e.modelBindings.map(e=>e.modelId),a=ee(r,t),o=K(a.modelId,i,e=>`${a.modelId}${e}`);return T({...a,modelId:o})}function ke(e){return D({toolName:K(`my_tool`,e.toolSpecs.map(e=>e.toolName),e=>`my_tool_${e}`)})}function K(e,t,n){let r=new Set(t),i=e;for(let e=2;r.has(i);e++)i=n(e);return i}function Ae(e,t,n){if(t===`host`)return{...e,identity:{...e.identity,profileType:t}};let a=e.modelBindings.filter(r=>{let a=i(e.providers,t,r),o=e.providers.find(e=>e.id===r.provider);return d(o,t,r.protocol)&&!Ne(n,t,a)}),o={...e,identity:{...e.identity,profileType:t},modelBindings:a},s=a.length?a:[G(o,n?.start)],c=!e.models.key&&fe({...o,modelBindings:s}),l=t===`speech`&&!e.speech.voice.trim()&&s.some(n=>r(i(e.providers,t,n)));return{...o,inputs:t===`image`?Ee(e.inputs):e.inputs,...l?{speech:{...e.speech,voice:je}}:{},models:{...e.models,defaultModel:W(e.models.defaultModel,s),key:c?Pe:e.models.key},modelBindings:s}}var je=`Kore`,Me=[`text`,`image`,`speech`,`live`,`decision`];function Ne(e,t,n){if(!e)return!1;let r=t=>e.models(t,n.definition).some(e=>e.id===n.apiId.trim());return!r(t)&&Me.some(e=>e!==t&&r(e))}var Pe=`slot_a`;function Fe(e,t){return U(e).includes(t)?{...e,included:[...e.included,t]}:e}function Ie(e,t){return{...e,included:e.included.filter(e=>e!==t)}}function q(e){return`modelBinding:${e}`}var J=`toolSpec:`;function Y(e){return`${J}${e}`}function X(e){return e.startsWith(J)?e.slice(9):void 0}var Z=`provider:`;function Le(e){return`${Z}${e}`}function Re(e){return e.startsWith(Z)?e.slice(9):void 0}var ze=new Map(y.map(e=>[e.id,e.label]));function Q(e){return ze.get(e)??e}function Be(e,t){let[n,r]=t.split(`:`,2);if(n===`modelBinding`&&r!==void 0)return e.modelBindings.some(e=>e.key===r)?{facet:n,key:r}:void 0;let i=X(t);if(i!==void 0)return e.toolSpecs.some(e=>e.key===i)?{facet:`toolSpec`,key:i}:void 0;let a=V(e);if(r===void 0&&a.includes(t))return{facet:t}}function Ve(e,t){return t===`models`?e.modelBindings.map(e=>({id:q(e.key),ref:{facet:`modelBinding`,key:e.key},label:e.modelId.trim()||Q(`modelBinding`),children:[]})):t===`tools`?$(e.toolSpecs):[]}function $(e){return e.map(e=>({id:Y(e.key),ref:{facet:`toolSpec`,key:e.key},label:e.toolName.trim()||Q(`toolSpec`),children:[]}))}function He(e){let t=V(e).filter(e=>e!==`identity`).map(t=>({id:t,ref:{facet:t},label:Q(t),children:Ve(e,t)}));return{id:`identity`,ref:{facet:`identity`},label:e.identity.agentId.trim()||Q(`identity`),children:t}}export{L as A,Ae as B,V as C,U as D,K as E,xe as F,de as G,De as H,R as I,y as J,he as K,ke as L,G as M,A as N,Fe as O,k as P,we as R,H as S,Ie as T,b as U,Te as V,me as W,ue as Y,x as _,He as a,T as b,$ as c,ye as d,ve as f,ge as g,_e as h,Be as i,be as j,z as k,S as l,C as m,Re as n,X as o,I as p,pe as q,Le as r,Y as s,q as t,F as u,O as v,w,D as x,Se as y,Oe as z};
|