@buffcore/admin-shell 0.8.41 → 0.8.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin.js +2 -1
- package/dist/components/Button.d.ts +2 -2
- package/dist/components/Button.js +7 -2
- package/dist/components/DeviceFrame.d.ts +6 -1
- package/dist/components/DeviceFrame.js +2 -2
- package/dist/components/look.d.ts +5 -0
- package/dist/components/look.js +5 -0
- package/dist/console-settings.js +4 -1
- package/dist/design-fonts.d.ts +5 -0
- package/dist/design-fonts.js +20 -0
- package/dist/prototype/PageLook.js +3 -2
- package/dist/prototype/create.d.ts +3 -1
- package/dist/prototype/create.js +0 -1
- package/dist/prototype/page.d.ts +19 -2
- package/dist/prototype/page.js +20 -2
- package/dist/prototype/shown.js +1 -1
- package/dist/prototype/viewer.d.ts +2 -0
- package/dist/prototype/viewer.js +6 -2
- package/dist/screens/assistant/use-ask.d.ts +4 -3
- package/dist/workbench/app/ServedAgents.js +4 -1
- package/dist/workbench/app/ServedComp.d.ts +3 -0
- package/dist/workbench/app/ServedComp.js +33 -0
- package/dist/workbench/app/ServedPrototype.js +28 -1
- package/dist/workbench/app/StudioApp.js +29 -20
- package/dist/workbench/app/actions.d.ts +10 -1
- package/dist/workbench/app/actions.js +9 -2
- package/dist/workbench/app/ask-card.d.ts +10 -0
- package/dist/workbench/app/ask-card.js +34 -0
- package/dist/workbench/app/chat-session.d.ts +34 -0
- package/dist/workbench/app/chat.d.ts +39 -0
- package/dist/workbench/app/frame.js +4 -2
- package/dist/workbench/app/fresh.d.ts +63 -0
- package/dist/workbench/app/fresh.js +66 -0
- package/dist/workbench/app/host-part-loader.d.ts +5 -2
- package/dist/workbench/app/host-part-module.d.ts +17 -0
- package/dist/workbench/app/host-part-module.js +55 -0
- package/dist/workbench/app/host-parts.d.ts +2 -11
- package/dist/workbench/app/host-parts.js +53 -67
- package/dist/workbench/app/level-choice.d.ts +3 -0
- package/dist/workbench/app/mount.d.ts +4 -1
- package/dist/workbench/app/mount.js +2 -2
- package/dist/workbench/app/panel-cards.d.ts +3 -3
- package/dist/workbench/app/panel-cards.js +3 -2
- package/dist/workbench/app/places.d.ts +18 -3
- package/dist/workbench/app/places.js +14 -2
- package/dist/workbench/app/prototype-comp.d.ts +46 -0
- package/dist/workbench/app/prototype-comp.js +77 -0
- package/dist/workbench/app/prototype.d.ts +1 -1
- package/dist/workbench/app/prototype.js +3 -1
- package/dist/workbench/app/scene-address.d.ts +10 -0
- package/dist/workbench/app/scene-address.js +14 -0
- package/dist/workbench/app/studio-post.js +1 -0
- package/dist/workbench/app/test/loop-fixture.d.ts +35 -8
- package/dist/workbench/app/usePrototypeUi.js +14 -0
- package/dist/workbench/app/useStudio.d.ts +43 -1
- package/dist/workbench/app/useStudio.js +8 -1
- package/dist/workbench/host-theme.d.ts +3 -0
- package/dist/workbench/host-theme.js +14 -0
- package/dist/workbench/index.d.ts +1 -0
- package/dist/workbench/index.js +1 -0
- package/dist/workbench/studio/frame/HostRailEntries.d.ts +3 -0
- package/dist/workbench/studio/frame/HostRailEntries.js +15 -0
- package/dist/workbench/studio/frame/HostSide.d.ts +6 -0
- package/dist/workbench/studio/frame/HostSide.js +31 -0
- package/dist/workbench/studio/frame/LevelChip.js +2 -1
- package/dist/workbench/studio/frame/LevelChoices.js +24 -8
- package/dist/workbench/studio/frame/LimitCard.d.ts +5 -0
- package/dist/workbench/studio/frame/LimitCard.js +26 -0
- package/dist/workbench/studio/frame/NeverAskSetting.d.ts +7 -0
- package/dist/workbench/studio/frame/NeverAskSetting.js +24 -0
- package/dist/workbench/studio/frame/PanelList.js +5 -2
- package/dist/workbench/studio/frame/PanelMessage.js +3 -0
- package/dist/workbench/studio/frame/PanelNotice.js +2 -1
- package/dist/workbench/studio/frame/PanelScenes.d.ts +5 -0
- package/dist/workbench/studio/frame/PanelScenes.js +38 -0
- package/dist/workbench/studio/frame/PermissionAskCard.d.ts +18 -0
- package/dist/workbench/studio/frame/PermissionAskCard.js +60 -0
- package/dist/workbench/studio/frame/PermissionAskFold.d.ts +12 -0
- package/dist/workbench/studio/frame/PermissionAskFold.js +54 -0
- package/dist/workbench/studio/frame/Place.d.ts +6 -2
- package/dist/workbench/studio/frame/Place.js +13 -5
- package/dist/workbench/studio/frame/SettingsSheet.js +6 -1
- package/dist/workbench/studio/frame/StudioRail.js +2 -1
- package/dist/workbench/studio/frame/panelControls.d.ts +17 -0
- package/dist/workbench/studio/frame/panelLines.d.ts +1 -0
- package/dist/workbench/studio/frame/panelLines.js +2 -1
- package/dist/workbench/studio/i18n/comp.en.d.ts +26 -0
- package/dist/workbench/studio/i18n/comp.en.js +26 -0
- package/dist/workbench/studio/i18n/comp.es.d.ts +26 -0
- package/dist/workbench/studio/i18n/comp.es.js +25 -0
- package/dist/workbench/studio/i18n/frame.en.d.ts +39 -0
- package/dist/workbench/studio/i18n/frame.en.js +39 -0
- package/dist/workbench/studio/i18n/frame.es.json +40 -1
- package/dist/workbench/studio/i18n/fresh.en.d.ts +19 -0
- package/dist/workbench/studio/i18n/fresh.en.js +20 -0
- package/dist/workbench/studio/i18n/fresh.es.json +18 -0
- package/dist/workbench/studio/i18n/index.js +6 -0
- package/dist/workbench/studio/i18n/levels.en.d.ts +5 -0
- package/dist/workbench/studio/i18n/levels.en.js +5 -0
- package/dist/workbench/studio/i18n/levels.es.json +6 -1
- package/dist/workbench/studio/i18n/loop.en.d.ts +4 -0
- package/dist/workbench/studio/i18n/loop.en.js +4 -0
- package/dist/workbench/studio/i18n/loop.es.json +4 -0
- package/dist/workbench/studio/i18n/save.en.d.ts +1 -3
- package/dist/workbench/studio/i18n/save.en.js +13 -15
- package/dist/workbench/studio/i18n/save.es.json +14 -16
- package/dist/workbench/studio/i18n/structure.en.d.ts +6 -0
- package/dist/workbench/studio/i18n/structure.en.js +6 -0
- package/dist/workbench/studio/i18n/structure.es.d.ts +6 -0
- package/dist/workbench/studio/i18n/structure.es.js +6 -0
- package/dist/workbench/studio/loop/AgentsPage.d.ts +4 -1
- package/dist/workbench/studio/loop/AgentsPage.js +5 -4
- package/dist/workbench/studio/loop/CritiqueNote.d.ts +4 -0
- package/dist/workbench/studio/loop/CritiqueNote.js +9 -0
- package/dist/workbench/studio/loop/FreshLookPanel.d.ts +21 -0
- package/dist/workbench/studio/loop/FreshLookPanel.js +60 -0
- package/dist/workbench/studio/loop/PrototypeComp.d.ts +25 -0
- package/dist/workbench/studio/loop/PrototypeComp.js +78 -0
- package/dist/workbench/studio/loop/PrototypePage.d.ts +7 -0
- package/dist/workbench/studio/loop/PrototypePage.js +4 -3
- package/dist/workbench/studio/loop/PrototypeScenes.js +1 -2
- package/dist/workbench/studio/loop/PrototypeSimplePage.js +15 -7
- package/dist/workbench/studio/loop/PrototypeSnapshot.d.ts +3 -0
- package/dist/workbench/studio/loop/PrototypeSnapshot.js +7 -2
- package/dist/workbench/studio/loop/ReviewSetting.d.ts +6 -0
- package/dist/workbench/studio/loop/ReviewSetting.js +14 -0
- package/dist/workbench/studio/loop/ReviewedSave.d.ts +1 -1
- package/dist/workbench/studio/loop/ReviewedSave.js +2 -10
- package/dist/workbench/studio/loop/SaveStep.d.ts +3 -0
- package/dist/workbench/studio/loop/SaveStep.js +3 -1
- package/dist/workbench/studio/loop/ServedBrand.js +3 -3
- package/dist/workbench/studio/loop/ServedPlanning.js +1 -1
- package/dist/workbench/studio/loop/StructurePage.d.ts +7 -0
- package/dist/workbench/studio/loop/StructurePage.js +3 -2
- package/dist/workbench/studio/loop/StructurePreview.js +4 -4
- package/dist/workbench/studio/loop/StructurePrompts.js +9 -4
- package/dist/workbench/studio/loop/SurfaceChoice.d.ts +7 -0
- package/dist/workbench/studio/loop/SurfaceChoice.js +20 -0
- package/dist/workbench/studio/loop/step-state.d.ts +1 -1
- package/dist/workbench/studio/loop/step-state.js +9 -8
- package/dist/workbench/studio/loop/structure-answers.d.ts +8 -0
- package/dist/workbench/studio/loop/structure-answers.js +34 -0
- package/dist/workbench/studio/loop/usePlanningDraft.js +7 -2
- package/dist/workbench/studio/loop/usePlanningSave.d.ts +16 -2
- package/dist/workbench/studio/loop/usePlanningSave.js +40 -2
- package/dist/workbench/studio/loop/usePrototypeRecord.js +5 -4
- package/dist/workbench/studio/loop/useReviewedSave.d.ts +9 -4
- package/dist/workbench/studio/loop/useReviewedSave.js +89 -30
- package/dist/workbench/studio/run/LiveServers.js +1 -1
- package/dist/workbench/studio/run/ReleasePage.js +1 -1
- package/dist/workbench/studio/run/ReleasesPage.js +2 -2
- package/dist/workbench/studio/run/ServedRelease.js +1 -1
- package/dist/workbench/studio/work/work-test-data.d.ts +9 -4
- package/package.json +6 -6
- package/vite.d.ts +6 -1
- package/vite.js +78 -5
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// A host's rail entries at the rail's end, as ordinary rail rows under the host's name. Each opens
|
|
3
|
+
// its module on the `page` place, in the same main area as the studio's own pages.
|
|
4
|
+
import { Icon } from '../../../components/Icon.js';
|
|
5
|
+
import { ICON_PATHS } from '../../../components/icons.js';
|
|
6
|
+
import { usePlaces } from '../../app/places.js';
|
|
7
|
+
import { eyebrow, Row } from './railParts.js';
|
|
8
|
+
const iconOf = (name) => name && Object.hasOwn(ICON_PATHS, name) ? name : 'layers';
|
|
9
|
+
export function HostRailEntries({ collapsed }) {
|
|
10
|
+
const host = usePlaces();
|
|
11
|
+
const rail = host?.rail;
|
|
12
|
+
if (!host || !rail?.entries.length)
|
|
13
|
+
return null;
|
|
14
|
+
return (_jsxs("div", { "data-studio-place": "rail.end", "data-host-rail": "", style: { display: 'grid', gap: 'var(--space-1)', marginBlockStart: 'var(--space-3)' }, children: [rail.label && !collapsed && (_jsx("span", { style: eyebrow, translate: "no", children: rail.label })), rail.entries.map((entry) => (_jsxs(Row, { on: host.selected?.place === 'page' && host.selected.id === entry.id, collapsed: collapsed, label: entry.label, onClick: () => host.select('page', entry.id), children: [_jsx(Icon, { name: iconOf(entry.icon), size: "var(--icon-md)" }), !collapsed && (_jsx("span", { style: { flex: 1, minWidth: 0 }, translate: "no", children: entry.label }))] }, entry.id)))] }));
|
|
15
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { HostSubjects } from '@buffcore/contracts/workbench';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
export declare function HostSide({ subject, children, }: {
|
|
4
|
+
subject: HostSubjects['side:prototype'];
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
}): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null | undefined;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useT } from '@buffcore/i18n/react';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { Tabs } from '../../../components/Tabs.js';
|
|
5
|
+
import { usePlaces } from '../../app/places.js';
|
|
6
|
+
import { usePrototypeNarrow } from './layout.js';
|
|
7
|
+
import { Place } from './Place.js';
|
|
8
|
+
export function HostSide({ subject, children, }) {
|
|
9
|
+
const t = useT();
|
|
10
|
+
const host = usePlaces();
|
|
11
|
+
const narrow = usePrototypeNarrow();
|
|
12
|
+
const [tab, setTab] = useState('page');
|
|
13
|
+
const parts = host?.parts?.['side:prototype'];
|
|
14
|
+
if (!parts?.length)
|
|
15
|
+
return children;
|
|
16
|
+
const side = _jsx(Place, { id: "side:prototype", subject: subject });
|
|
17
|
+
if (narrow) {
|
|
18
|
+
const label = parts.find((part) => part.label)?.label ?? host?.rail?.label ?? t('host.place.side');
|
|
19
|
+
return (_jsxs("div", { "data-host-side": "tabs", style: { display: 'grid', gridTemplateRows: 'auto minmax(0, 1fr)', blockSize: '100%' }, children: [_jsx(Tabs, { tabs: [
|
|
20
|
+
['page', t('studio.frame.page.prototype')],
|
|
21
|
+
['host', label],
|
|
22
|
+
], value: tab, onChange: setTab }), _jsx("div", { hidden: tab !== 'page', style: { display: tab === 'page' ? 'contents' : 'none' }, children: children }), _jsx("div", { role: "tabpanel", hidden: tab !== 'host', style: { display: tab === 'host' ? 'block' : 'none', padding: 'var(--space-3)' }, children: side })] }));
|
|
23
|
+
}
|
|
24
|
+
return (_jsxs("div", { "data-host-side": "beside", style: {
|
|
25
|
+
display: 'grid',
|
|
26
|
+
gridTemplateColumns: 'minmax(0, 1fr) minmax(0, 20rem)',
|
|
27
|
+
gap: 'var(--space-4)',
|
|
28
|
+
blockSize: '100%',
|
|
29
|
+
paddingInlineEnd: 'var(--space-4)',
|
|
30
|
+
}, children: [_jsx("div", { style: { minBlockSize: 0, minInlineSize: 0, display: 'grid' }, children: children }), _jsx("aside", { style: { paddingBlock: 'var(--space-4)', display: 'grid', alignContent: 'start' }, children: side })] }));
|
|
31
|
+
}
|
|
@@ -38,11 +38,12 @@ function useLevelCue(level) {
|
|
|
38
38
|
? 'studio.level.bar.saving'
|
|
39
39
|
: 'studio.level.bar.unconfirmed', { level: name });
|
|
40
40
|
// The last save's answer shows on the chip too, so a closed sheet is not silent about it.
|
|
41
|
-
const
|
|
41
|
+
const said = choice.status === 'refused'
|
|
42
42
|
? t('studio.level.bar.refused', { level: label })
|
|
43
43
|
: choice.status === 'partial'
|
|
44
44
|
? t('studio.level.bar.partial', { level: label })
|
|
45
45
|
: label;
|
|
46
|
+
const cue = choice.neverAsk ? t('studio.level.neverAsk.chip', { level: said }) : said;
|
|
46
47
|
return { choice, cue: cue ?? '' };
|
|
47
48
|
}
|
|
48
49
|
/** The level as a quiet chip; it opens the level's choices. */
|
|
@@ -6,6 +6,7 @@ import { Button } from '../../../components/Button.js';
|
|
|
6
6
|
import { Panel } from '../../../components/Panel.js';
|
|
7
7
|
import { bodyText, captionText } from '../../../components/styles.js';
|
|
8
8
|
import { LEVELS as levels } from '../types.js';
|
|
9
|
+
import { NeverAskSetting } from './NeverAskSetting.js';
|
|
9
10
|
export const stack = { display: 'grid', gap: 'var(--space-3)', minInlineSize: 0 };
|
|
10
11
|
export const buttonStyle = {
|
|
11
12
|
whiteSpace: 'normal',
|
|
@@ -50,17 +51,32 @@ const busyLook = {
|
|
|
50
51
|
border: 'var(--border-width-control) solid var(--border-control)',
|
|
51
52
|
cursor: 'default',
|
|
52
53
|
};
|
|
54
|
+
/** The chosen Autopilot card, holding its choice and the Never ask switch on one tint. */
|
|
55
|
+
const chosenCard = {
|
|
56
|
+
display: 'grid',
|
|
57
|
+
alignContent: 'start',
|
|
58
|
+
minInlineSize: 0,
|
|
59
|
+
background: 'var(--brand-tint)',
|
|
60
|
+
borderRadius: 'var(--radius-control)',
|
|
61
|
+
};
|
|
62
|
+
const plainCard = { display: 'grid', minInlineSize: 0 };
|
|
53
63
|
function ChoiceButtons({ store, onLevel, choices }) {
|
|
54
64
|
const t = useT();
|
|
55
65
|
const busy = store.status === 'pending';
|
|
56
|
-
return (_jsx("fieldset", { ref: choices, "aria-label": t('studio.level.choices'), style: { ...columns, border: 0, padding: 0, margin: 0 }, children: levels.map((level) =>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
return (_jsx("fieldset", { ref: choices, "aria-label": t('studio.level.choices'), style: { ...columns, border: 0, padding: 0, margin: 0 }, children: levels.map((level) => {
|
|
67
|
+
const choice = (_jsxs(Button, { size: "lg", variant: store.proposed === level ? 'tonal' : 'secondary', "aria-label": t(`studio.level.level.${level}`), "aria-pressed": store.proposed === level, "aria-describedby": `studio-level-description-${level}${store.status === 'pending' ? ' studio-level-hold' : ''}${!onLevel ? ' studio-level-right' : ''}`, disabled: !onLevel, "aria-disabled": busy || undefined, onClick: () => !busy && onLevel?.(level), style: {
|
|
68
|
+
...buttonStyle,
|
|
69
|
+
...(busy ? busyLook : {}),
|
|
70
|
+
...stack,
|
|
71
|
+
textAlign: 'start',
|
|
72
|
+
alignContent: 'start',
|
|
73
|
+
justifyContent: 'stretch',
|
|
74
|
+
}, children: [_jsx("strong", { children: t(`studio.level.level.${level}`) }), _jsx("span", { id: `studio-level-description-${level}`, style: { fontWeight: 'var(--weight-regular)' }, children: t(`studio.level.description.${level}`) })] }));
|
|
75
|
+
// "Never ask" sits inside the Autopilot card, only while Autopilot is the chosen level. Each
|
|
76
|
+
// choice keeps its wrapper, so a click that chooses Autopilot keeps the button and its focus.
|
|
77
|
+
const never = level === 'auto' && (store.proposed ?? store.effective) === 'auto';
|
|
78
|
+
return (_jsxs("div", { "data-level-card": level, style: never ? chosenCard : plainCard, children: [choice, never && (_jsx("div", { style: { paddingInline: 'var(--space-4)', paddingBlockEnd: 'var(--space-3)' }, children: _jsx(NeverAskSetting, { on: !!store.neverAsk, onChange: store.onNeverAsk }) }))] }, level));
|
|
79
|
+
}) }));
|
|
64
80
|
}
|
|
65
81
|
function DesignPromises({ store }) {
|
|
66
82
|
const t = useT();
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useT } from '@buffcore/i18n/react';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { Button } from '../../../components/Button.js';
|
|
5
|
+
import { chatCard } from './AllowFolderCard.js';
|
|
6
|
+
import { AskTitle, askCommand, askFine } from './PermissionAskCard.js';
|
|
7
|
+
import { isRedactedTarget } from './panelLines.js';
|
|
8
|
+
import { folderButtonStyle } from './TurnControls.js';
|
|
9
|
+
/** The chat keeps a command's first 2000 characters: a longer one is cut, and never copied. */
|
|
10
|
+
const KEPT = 2000;
|
|
11
|
+
export function LimitCard({ limit, command }) {
|
|
12
|
+
const t = useT();
|
|
13
|
+
// A cut or scrubbed command is no longer the one the agent wrote: copying it would mislead.
|
|
14
|
+
const whole = command.length < KEPT && !isRedactedTarget([command]);
|
|
15
|
+
const [copied, setCopied] = useState();
|
|
16
|
+
const copy = async () => {
|
|
17
|
+
try {
|
|
18
|
+
await navigator.clipboard.writeText(command);
|
|
19
|
+
setCopied('copied');
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
setCopied('copyFailed');
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
return (_jsx("li", { "data-limit-card": limit, children: _jsxs("div", { style: chatCard, children: [_jsx(AskTitle, { icon: "lock", children: t('studio.frame.limit.title') }), _jsx("pre", { translate: "no", style: askCommand, children: command }), _jsx("p", { style: { margin: 0, fontWeight: 'var(--weight-semibold)', color: 'var(--text-strong)' }, children: t(`studio.frame.limit.kind.${limit}`) }), _jsx("p", { style: { margin: 0 }, children: t('studio.frame.limit.next') }), whole ? (_jsxs("span", { style: { display: 'grid', gap: 'var(--space-2)', justifyItems: 'start' }, children: [_jsx(Button, { size: "lg", variant: "secondary", icon: "copy", style: folderButtonStyle, onClick: () => void copy(), children: t('studio.frame.limit.copy') }), copied && (_jsx("span", { role: "status", style: askFine, children: t(`studio.frame.limit.${copied}`) }))] })) : (_jsx("p", { style: askFine, children: t('studio.frame.limit.long') })), _jsx("p", { style: askFine, children: t('studio.frame.limit.list') })] }) }));
|
|
26
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// "Never ask": a switch inside the Autopilot card, only while Autopilot is the chosen level, off by
|
|
3
|
+
// default, with its plain warning once on. The server keeps it only with Autopilot and lets it hold
|
|
4
|
+
// only once saved.
|
|
5
|
+
import { useT } from '@buffcore/i18n/react';
|
|
6
|
+
import { Icon } from '../../../components/Icon.js';
|
|
7
|
+
import { SettingRow } from '../../../components/SettingRow.js';
|
|
8
|
+
import { Switch } from '../../../components/Switch.js';
|
|
9
|
+
import { toneVars } from '../../../components/tone.js';
|
|
10
|
+
const warn = toneVars('attention');
|
|
11
|
+
export function NeverAskSetting({ on, onChange }) {
|
|
12
|
+
const t = useT();
|
|
13
|
+
const label = t('studio.level.neverAsk.label');
|
|
14
|
+
return (_jsxs("div", { "data-never-ask": on ? 'on' : 'off', style: { display: 'grid', gap: 'var(--space-2)' }, children: [_jsx(SettingRow, { first: true, label: label, help: t('studio.level.neverAsk.help'), children: _jsx(Switch, { on: on, label: label, onChange: onChange, disabled: !onChange, touchTarget: true }) }), on && (_jsxs("div", { style: {
|
|
15
|
+
display: 'flex',
|
|
16
|
+
alignItems: 'flex-start',
|
|
17
|
+
gap: 'var(--space-3)',
|
|
18
|
+
padding: 'var(--space-3) var(--space-4)',
|
|
19
|
+
background: warn.tint,
|
|
20
|
+
border: `var(--border-width-hairline) solid ${warn.border}`,
|
|
21
|
+
borderRadius: 'var(--radius-panel)',
|
|
22
|
+
color: 'var(--text-body)',
|
|
23
|
+
}, children: [_jsx("span", { style: { color: warn.ink, paddingBlockStart: 'var(--space-1)' }, children: _jsx(Icon, { name: "triangle-alert" }) }), _jsxs("p", { style: { margin: 0, display: 'grid', gap: 'var(--space-1)', minInlineSize: 0 }, children: [_jsx("strong", { style: { color: warn.ink }, children: t('studio.level.neverAsk.warnTitle') }), _jsx("span", { style: { fontSize: 'var(--font-size-body-sm)' }, children: t('studio.level.neverAsk.warning') })] })] }))] }));
|
|
24
|
+
}
|
|
@@ -4,6 +4,7 @@ import { useLayoutEffect, useRef, useState } from 'react';
|
|
|
4
4
|
import { Button } from '../../../components/Button.js';
|
|
5
5
|
import { PanelMessage } from './PanelMessage.js';
|
|
6
6
|
import { PanelRefused } from './PanelRefused.js';
|
|
7
|
+
import { answeredLine, PermissionAsk } from './PermissionAskFold.js';
|
|
7
8
|
import { Place } from './Place.js';
|
|
8
9
|
import { isPlatformCommand, PlatformsCard } from './PlatformsCard.js';
|
|
9
10
|
import { panelLines, refusedCall } from './panelLines.js';
|
|
@@ -31,7 +32,9 @@ export function PanelList({ agent, simple }) {
|
|
|
31
32
|
const follow = useRef(true);
|
|
32
33
|
const [earliest, setEarliest] = useState();
|
|
33
34
|
const first = earliest ?? Math.max(0, agent.messages.length - pageSize);
|
|
34
|
-
|
|
35
|
+
// A folded permission answer says what the studio's own line for it says: that line waits.
|
|
36
|
+
const folded = answeredLine(agent.messages, agent.turn?.ask?.answered);
|
|
37
|
+
const lines = panelLines(agent.messages, first).filter(({ position }) => position !== folded);
|
|
35
38
|
const latestEnd = lines.findLastIndex(({ message }) => message.end);
|
|
36
39
|
const refused = refusedCall(agent.messages, agent.running);
|
|
37
40
|
const onPlatforms = agent.turn?.onPlatforms;
|
|
@@ -50,5 +53,5 @@ export function PanelList({ agent, simple }) {
|
|
|
50
53
|
...(agent.turn?.sending && i === lines.length - 1 ? { sending: true } : {}),
|
|
51
54
|
}, turn: agent.turn, at: position, latestEnd: i === latestEnd, simple: simple, canApprove: agent.canApprove, approvalByRule: agent.approvalByRule }, position))), refused &&
|
|
52
55
|
(onPlatforms && isPlatformCommand(refused.tool) ? (_jsx(PlatformsCard, { turn: { ...agent.turn, onPlatforms } })) : (_jsx(PanelRefused, { ...refused, turn: agent.turn }))), agent.turn?.composer?.queued && _jsx(QueuedLine, { composer: agent.turn.composer }), agent.turn?.cleared && _jsx(ClearedLine, {}), agent.running &&
|
|
53
|
-
(agent.turn?.stuck ? (_jsx(StuckTurn, { agent: agent.name, turn: agent.turn })) : (_jsx(WorkingBar, { turn: agent.turn ?? {} }))), _jsx(Place, { id: "chat.end" })] }));
|
|
56
|
+
(agent.turn?.stuck ? (_jsx(StuckTurn, { agent: agent.name, turn: agent.turn })) : agent.turn?.ask ? (_jsx(PermissionAsk, { agent: agent.name, turn: agent.turn })) : (_jsx(WorkingBar, { turn: agent.turn ?? {} }))), _jsx(Place, { id: "chat.end" })] }));
|
|
54
57
|
}
|
|
@@ -5,6 +5,7 @@ import { visuallyHidden } from '../../../components/field.js';
|
|
|
5
5
|
import { Icon } from '../../../components/Icon.js';
|
|
6
6
|
import { bodyText, captionText, monoText } from '../../../components/styles.js';
|
|
7
7
|
import { AgentMarkdown } from './AgentMarkdown.js';
|
|
8
|
+
import { LimitCard } from './LimitCard.js';
|
|
8
9
|
import { PanelEnd, PanelWarning } from './PanelNotice.js';
|
|
9
10
|
import { PanelPermission } from './PanelPermission.js';
|
|
10
11
|
import { PanelTool } from './PanelTool.js';
|
|
@@ -40,6 +41,8 @@ function Bubble({ m, simple }) {
|
|
|
40
41
|
}
|
|
41
42
|
export function PanelMessage(props) {
|
|
42
43
|
const { m } = props;
|
|
44
|
+
if (m.tool?.limit)
|
|
45
|
+
return _jsx(LimitCard, { limit: m.tool.limit, command: m.tool.targets[0] ?? '' });
|
|
43
46
|
if (m.tool)
|
|
44
47
|
return _jsx(PanelTool, { tool: m.tool });
|
|
45
48
|
if (m.permission)
|
|
@@ -4,6 +4,7 @@ import { Banner } from '../../../components/Banner.js';
|
|
|
4
4
|
import { Button } from '../../../components/Button.js';
|
|
5
5
|
import { Icon } from '../../../components/Icon.js';
|
|
6
6
|
import { captionText } from '../../../components/styles.js';
|
|
7
|
+
import { PanelScenes } from './PanelScenes.js';
|
|
7
8
|
import { turnTime } from './panelLines.js';
|
|
8
9
|
export function PanelEnd({ end, agent, showUnsaved, save, }) {
|
|
9
10
|
const t = useT();
|
|
@@ -19,7 +20,7 @@ export function PanelEnd({ end, agent, showUnsaved, save, }) {
|
|
|
19
20
|
flexWrap: 'wrap',
|
|
20
21
|
}, children: [_jsx(Icon, { name: end.failed ? 'triangle-alert' : refused > 0 ? 'lock' : 'check', size: "var(--icon-sm)" }), _jsx("span", { children: t(end.failed ? 'studio.frame.lines.endFailed' : 'studio.frame.lines.end', {
|
|
21
22
|
time: turnTime(end.seconds, locale),
|
|
22
|
-
}) }), refused > 0 && (_jsxs("span", { children: ["\u00B7 ", t('studio.frame.lines.endRefused', { count: refused, agent })] })), showUnsaved && end.unsaved && count !== 0 && (_jsxs(_Fragment, { children: [_jsx("span", { role: "status", children: count === undefined
|
|
23
|
+
}) }), refused > 0 && (_jsxs("span", { children: ["\u00B7 ", t('studio.frame.lines.endRefused', { count: refused, agent })] })), end.scenes && _jsx(PanelScenes, { scenes: end.scenes }), showUnsaved && end.unsaved && count !== 0 && (_jsxs(_Fragment, { children: [_jsx("span", { role: "status", children: count === undefined
|
|
23
24
|
? t('studio.frame.lines.saveUnreadable')
|
|
24
25
|
: t('studio.frame.lines.unsaved', { count }) }), save && (_jsx(Button, { size: "sm", variant: "secondary", loading: save.saving, onClick: save.onSave, children: t('studio.loop.planning.save.button') }))] }))] }));
|
|
25
26
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PanelMessage } from './panelLines.ts';
|
|
2
|
+
/** A turn that changed prototype scenes ends with links that open each in the preview. */
|
|
3
|
+
export declare function PanelScenes({ scenes, }: {
|
|
4
|
+
scenes: NonNullable<NonNullable<PanelMessage['end']>['scenes']>;
|
|
5
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useT } from '@buffcore/i18n/react';
|
|
3
|
+
import { Icon } from '../../../components/Icon.js';
|
|
4
|
+
import { captionText } from '../../../components/styles.js';
|
|
5
|
+
import { sceneHref } from '../../app/scene-address.js';
|
|
6
|
+
/** A link drawn as a secondary button: a 44 px target with the scene's name beside an eye. */
|
|
7
|
+
const linkStyle = {
|
|
8
|
+
display: 'inline-flex',
|
|
9
|
+
alignItems: 'center',
|
|
10
|
+
gap: 'var(--space-2)',
|
|
11
|
+
minBlockSize: 'var(--control-lg)',
|
|
12
|
+
maxInlineSize: '100%',
|
|
13
|
+
paddingInline: 'var(--space-4)',
|
|
14
|
+
border: 'var(--border-width-control) solid var(--border-control)',
|
|
15
|
+
borderRadius: 'var(--radius-control)',
|
|
16
|
+
background: 'var(--surface-page)',
|
|
17
|
+
color: 'var(--text-strong)',
|
|
18
|
+
fontFamily: 'var(--font-body)',
|
|
19
|
+
fontSize: 'var(--font-size-body)',
|
|
20
|
+
fontWeight: 'var(--weight-medium)',
|
|
21
|
+
lineHeight: 1.2,
|
|
22
|
+
textDecoration: 'none',
|
|
23
|
+
overflowWrap: 'anywhere',
|
|
24
|
+
};
|
|
25
|
+
/** A turn that changed prototype scenes ends with links that open each in the preview. */
|
|
26
|
+
export function PanelScenes({ scenes, }) {
|
|
27
|
+
const t = useT();
|
|
28
|
+
if (!scenes.length)
|
|
29
|
+
return null;
|
|
30
|
+
return (_jsxs("nav", { "aria-label": t('studio.frame.lines.scenes'), style: { flexBasis: '100%', display: 'grid', gap: 'var(--space-2)' }, children: [_jsx("span", { style: captionText, children: t('studio.frame.lines.changed') }), _jsx("ul", { style: {
|
|
31
|
+
listStyle: 'none',
|
|
32
|
+
margin: 0,
|
|
33
|
+
padding: 0,
|
|
34
|
+
display: 'flex',
|
|
35
|
+
flexWrap: 'wrap',
|
|
36
|
+
gap: 'var(--space-2)',
|
|
37
|
+
}, children: scenes.map((scene) => (_jsx("li", { style: { maxInlineSize: '100%' }, children: _jsxs("a", { href: sceneHref(scene.key), "aria-label": t('studio.frame.lines.openScene', { title: scene.title || scene.key }), style: linkStyle, children: [_jsx(Icon, { name: "eye", size: "var(--icon-md)" }), _jsx("span", { translate: "no", children: scene.title || scene.key })] }) }, scene.key))) })] }));
|
|
38
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
|
+
import type { IconName } from '../../../components/icons.ts';
|
|
3
|
+
import type { AskAnswer, Asking } from './panelControls.ts';
|
|
4
|
+
export type { AskAnswer } from './panelControls.ts';
|
|
5
|
+
export declare const askFine: CSSProperties;
|
|
6
|
+
export declare const askCommand: CSSProperties;
|
|
7
|
+
/** The card's first line: an icon and a few strong words. */
|
|
8
|
+
export declare function AskTitle({ icon, children }: {
|
|
9
|
+
icon: IconName;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
12
|
+
interface Props {
|
|
13
|
+
agent: string;
|
|
14
|
+
asking: Asking;
|
|
15
|
+
/** True when the studio passed the answer on, or the refusal sentence. */
|
|
16
|
+
onAnswer: (answer: AskAnswer) => Promise<true | string>;
|
|
17
|
+
}
|
|
18
|
+
export declare function PermissionAskCard({ agent, asking, onAnswer }: Props): import("react").JSX.Element;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// The running turn paused on a command its step doesn't allow: one card at the end of the chat, with
|
|
3
|
+
// the exact command and the person's answers. Views are props in, UI out; the server checks the
|
|
4
|
+
// right, the Origin and that this card is still the one the turn waits on.
|
|
5
|
+
import { useT } from '@buffcore/i18n/react';
|
|
6
|
+
import { useState } from 'react';
|
|
7
|
+
import { Button } from '../../../components/Button.js';
|
|
8
|
+
import { Icon } from '../../../components/Icon.js';
|
|
9
|
+
import { bodyText, captionText, monoText } from '../../../components/styles.js';
|
|
10
|
+
import { chatCard } from './AllowFolderCard.js';
|
|
11
|
+
import { folderButtonStyle } from './TurnControls.js';
|
|
12
|
+
export const askFine = {
|
|
13
|
+
...captionText,
|
|
14
|
+
margin: 0,
|
|
15
|
+
fontWeight: 'var(--weight-regular)',
|
|
16
|
+
};
|
|
17
|
+
export const askCommand = {
|
|
18
|
+
...monoText,
|
|
19
|
+
margin: 0,
|
|
20
|
+
padding: 'var(--space-2) var(--space-3)',
|
|
21
|
+
borderRadius: 'var(--radius-control)',
|
|
22
|
+
background: 'var(--surface-sunken)',
|
|
23
|
+
border: 'var(--border-width-hairline) solid var(--border-hairline)',
|
|
24
|
+
color: 'var(--text-strong)',
|
|
25
|
+
whiteSpace: 'pre-wrap',
|
|
26
|
+
overflowWrap: 'anywhere',
|
|
27
|
+
};
|
|
28
|
+
/** The card's first line: an icon and a few strong words. */
|
|
29
|
+
export function AskTitle({ icon, children }) {
|
|
30
|
+
return (_jsxs("p", { style: {
|
|
31
|
+
...bodyText,
|
|
32
|
+
margin: 0,
|
|
33
|
+
fontWeight: 'var(--weight-semibold)',
|
|
34
|
+
color: 'var(--text-strong)',
|
|
35
|
+
display: 'flex',
|
|
36
|
+
gap: 'var(--space-2)',
|
|
37
|
+
alignItems: 'center',
|
|
38
|
+
}, children: [_jsx(Icon, { name: icon, size: "var(--icon-md)" }), _jsx("span", { style: { minInlineSize: 0, overflowWrap: 'anywhere' }, children: children })] }));
|
|
39
|
+
}
|
|
40
|
+
export function PermissionAskCard({ agent, asking, onAnswer }) {
|
|
41
|
+
const t = useT();
|
|
42
|
+
const [busy, setBusy] = useState();
|
|
43
|
+
const [failed, setFailed] = useState();
|
|
44
|
+
const answer = async (choice) => {
|
|
45
|
+
setBusy(choice);
|
|
46
|
+
setFailed(undefined);
|
|
47
|
+
const result = await onAnswer(choice).catch(() => '');
|
|
48
|
+
setBusy(undefined);
|
|
49
|
+
if (result !== true)
|
|
50
|
+
setFailed(result || t('studio.frame.ask.failed'));
|
|
51
|
+
};
|
|
52
|
+
const button = (choice, variant) => (_jsx(Button, { size: "lg", variant: variant, fullWidth: true, style: folderButtonStyle, disabled: busy !== undefined, onClick: () => void answer(choice), children: t(busy === choice ? 'studio.frame.ask.answering' : `studio.frame.ask.${choice}`) }));
|
|
53
|
+
return (_jsxs("div", { "data-permission-ask": "", style: { ...chatCard, borderColor: 'var(--brand-border)' }, children: [_jsx(AskTitle, { icon: "key-round", children: t('studio.frame.ask.title', { agent }) }), _jsx("pre", { translate: "no", style: askCommand, children: asking.command }), _jsx("p", { style: { margin: 0 }, children: asking.unsure
|
|
54
|
+
? t(`studio.frame.ask.unsure.${asking.unsure.why}`, {
|
|
55
|
+
mention: asking.unsure.mention ?? '',
|
|
56
|
+
})
|
|
57
|
+
: asking.once
|
|
58
|
+
? t('studio.frame.ask.download')
|
|
59
|
+
: t('studio.frame.ask.why', { parts: asking.parts.join(', ') || asking.tool }) }), _jsxs("span", { style: { display: 'grid', gap: 'var(--space-2)' }, children: [button('once', 'primary'), !asking.once && button('always', 'secondary'), button('deny', 'ghost')] }), failed && (_jsx("p", { role: "alert", style: { margin: 0, overflowWrap: 'anywhere' }, children: failed })), !asking.once && _jsx("p", { style: askFine, children: t('studio.frame.ask.fine') }), _jsxs("p", { role: "status", style: { ...askFine, display: 'flex', gap: 'var(--space-2)' }, children: [_jsx(Icon, { name: "pause", size: "var(--icon-sm)", style: { marginBlockStart: '0.15em' } }), _jsx("span", { children: t('studio.frame.ask.paused') })] })] }));
|
|
60
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AnsweredAsk, TurnControls } from './panelControls.ts';
|
|
2
|
+
import type { PanelMessage } from './panelLines.ts';
|
|
3
|
+
/**
|
|
4
|
+
* The studio's own line for a folded answer ("Allowed once: …"), which the fold says already: its
|
|
5
|
+
* position, hidden while the fold shows. It is the first system line after the answer naming it.
|
|
6
|
+
*/
|
|
7
|
+
export declare function answeredLine(messages: readonly PanelMessage[], answered?: AnsweredAsk): number;
|
|
8
|
+
/** The card, or its folded answer, with the working bar below an answer. */
|
|
9
|
+
export declare function PermissionAsk({ agent, turn }: {
|
|
10
|
+
agent: string;
|
|
11
|
+
turn: TurnControls;
|
|
12
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// The permission card at the end of the chat, and its answer folded while the turn goes on: allowed
|
|
3
|
+
// (once, or always with where it is kept) as one line, refused with what the agent was told.
|
|
4
|
+
import { useT } from '@buffcore/i18n/react';
|
|
5
|
+
import { Icon } from '../../../components/Icon.js';
|
|
6
|
+
import { bodyText, monoText } from '../../../components/styles.js';
|
|
7
|
+
import { AgentMarkdown } from './AgentMarkdown.js';
|
|
8
|
+
import { chatCard } from './AllowFolderCard.js';
|
|
9
|
+
import { AskTitle, askCommand, askFine, PermissionAskCard } from './PermissionAskCard.js';
|
|
10
|
+
import { WorkingBar } from './TurnControls.js';
|
|
11
|
+
/**
|
|
12
|
+
* The studio's own line for a folded answer ("Allowed once: …"), which the fold says already: its
|
|
13
|
+
* position, hidden while the fold shows. It is the first system line after the answer naming it.
|
|
14
|
+
*/
|
|
15
|
+
export function answeredLine(messages, answered) {
|
|
16
|
+
if (!answered)
|
|
17
|
+
return -1;
|
|
18
|
+
const at = messages
|
|
19
|
+
.slice(answered.after)
|
|
20
|
+
.findIndex((m) => m.from === 'system' && m.text.endsWith(answered.asking.command));
|
|
21
|
+
return at < 0 ? -1 : answered.after + at;
|
|
22
|
+
}
|
|
23
|
+
/** The card, or its folded answer, with the working bar below an answer. */
|
|
24
|
+
export function PermissionAsk({ agent, turn }) {
|
|
25
|
+
const ask = turn.ask;
|
|
26
|
+
if (!ask)
|
|
27
|
+
return null;
|
|
28
|
+
const { asking, answered } = ask;
|
|
29
|
+
if (asking && asking.id !== answered?.asking.id)
|
|
30
|
+
return (_jsx("li", { children: _jsx(PermissionAskCard, { agent: agent, asking: asking, onAnswer: ask.onAnswer }) }));
|
|
31
|
+
if (!answered)
|
|
32
|
+
return _jsx(WorkingBar, { turn: turn });
|
|
33
|
+
return (_jsxs(_Fragment, { children: [_jsx("li", { "data-permission-answer": answered.answer, children: _jsx(Folded, { agent: agent, answered: answered }) }), _jsx(WorkingBar, { turn: turn })] }));
|
|
34
|
+
}
|
|
35
|
+
function Folded({ agent, answered }) {
|
|
36
|
+
const t = useT();
|
|
37
|
+
const { asking, answer } = answered;
|
|
38
|
+
if (answer === 'deny') {
|
|
39
|
+
const parts = (asking.parts.length ? asking.parts : [asking.command]).join('`, `');
|
|
40
|
+
return (_jsxs("div", { style: chatCard, children: [_jsx(AskTitle, { icon: "x", children: t('studio.frame.ask.refusedTitle') }), _jsx("pre", { translate: "no", style: { ...askCommand, color: 'var(--text-muted)' }, children: asking.command }), _jsx("p", { style: { margin: 0 }, children: t('studio.frame.ask.refusedTold', { agent }) }), _jsx("div", { style: {
|
|
41
|
+
paddingInlineStart: 'var(--space-3)',
|
|
42
|
+
borderInlineStart: 'var(--border-width-control) solid var(--border-control)',
|
|
43
|
+
}, children: _jsx(AgentMarkdown, { text: t('studio.frame.ask.refusedWhy', { parts }) }) }), _jsx("p", { style: askFine, children: t('studio.frame.ask.refusedNext') })] }));
|
|
44
|
+
}
|
|
45
|
+
return (_jsxs("div", { style: { ...bodyText, display: 'grid', gap: 'var(--space-1)', minInlineSize: 0 }, children: [_jsxs("p", { role: "status", style: {
|
|
46
|
+
margin: 0,
|
|
47
|
+
color: 'var(--success-ink)',
|
|
48
|
+
display: 'flex',
|
|
49
|
+
gap: 'var(--space-2)',
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
}, children: [_jsx(Icon, { name: "check", size: "var(--icon-sm)" }), _jsx("span", { children: t(answer === 'once' ? 'studio.frame.ask.onceDone' : 'studio.frame.ask.alwaysDone', {
|
|
52
|
+
agent,
|
|
53
|
+
}) })] }), _jsx("p", { style: { ...monoText, margin: 0, overflowWrap: 'anywhere' }, translate: "no", children: asking.command }), answer === 'always' && _jsx("p", { style: askFine, children: t('studio.frame.ask.alwaysWhere') })] }));
|
|
54
|
+
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import type { DrawPlaceId } from '@buffcore/contracts/workbench';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
|
-
/**
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* No context or no parts means no elements, spacing or copy. A place with a subject passes it to
|
|
5
|
+
* every part as plain JSON, after the value parts already receive.
|
|
6
|
+
*/
|
|
7
|
+
export declare function Place({ id, passed, subject, }: {
|
|
5
8
|
id: DrawPlaceId;
|
|
6
9
|
passed?: unknown;
|
|
10
|
+
subject?: unknown;
|
|
7
11
|
}): import("react").JSX.Element[] | import("react").JSX.Element | null;
|
|
8
12
|
/** Work and the served release have no side column until a host adds one. */
|
|
9
13
|
export declare function WithHostSide({ id, children }: {
|
|
@@ -2,18 +2,26 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { useT } from '@buffcore/i18n/react';
|
|
3
3
|
import { Badge } from '../../../components/Badge.js';
|
|
4
4
|
import { Button } from '../../../components/Button.js';
|
|
5
|
-
import { placeApproval, usePlaces } from '../../app/places.js';
|
|
5
|
+
import { placeApproval, plainSubject, usePlaces } from '../../app/places.js';
|
|
6
6
|
import { TwoColumns } from '../loop/parts.js';
|
|
7
|
-
/**
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* No context or no parts means no elements, spacing or copy. A place with a subject passes it to
|
|
9
|
+
* every part as plain JSON, after the value parts already receive.
|
|
10
|
+
*/
|
|
11
|
+
export function Place({ id, passed, subject, }) {
|
|
9
12
|
const host = usePlaces();
|
|
10
|
-
const
|
|
13
|
+
const railIds = new Set(id === 'page' ? host?.rail?.entries.map((entry) => entry.id) : []);
|
|
14
|
+
// Host rail entries draw as rail rows (HostRailEntries); only other page parts are links here.
|
|
15
|
+
const parts = host?.parts?.[id]?.filter((part) => !railIds.has(part.id));
|
|
11
16
|
if (!host || !parts?.length)
|
|
12
17
|
return null;
|
|
13
18
|
if (id === 'page' || id.startsWith('tabs:'))
|
|
14
19
|
return _jsx(PartLinks, { id: id, parts: parts });
|
|
20
|
+
const plain = plainSubject(subject);
|
|
21
|
+
// A place without a subject draws with the two values parts have always received.
|
|
22
|
+
const value = passed ?? placeApproval(id, host.state);
|
|
15
23
|
const Wrapper = id === 'chat.end' ? 'li' : 'div';
|
|
16
|
-
return parts.map((part) => (_jsxs(Wrapper, { "data-studio-place": id, "data-host-part": part.id, children: [part.label && (_jsx(Badge, { children: _jsx("span", { translate: "no", children: part.label }) })), part.draw(host.state,
|
|
24
|
+
return parts.map((part) => (_jsxs(Wrapper, { "data-studio-place": id, "data-host-part": part.id, children: [part.label && (_jsx(Badge, { children: _jsx("span", { translate: "no", children: part.label }) })), plain === undefined ? part.draw(host.state, value) : part.draw(host.state, value, plain)] }, part.id)));
|
|
17
25
|
}
|
|
18
26
|
/** Work and the served release have no side column until a host adds one. */
|
|
19
27
|
export function WithHostSide({ id, children }) {
|
|
@@ -2,10 +2,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
// The settings gear's sheet: the development level (its choices and what is always a person's open
|
|
3
3
|
// from here), this computer's pages, and help when the studio has it.
|
|
4
4
|
import { useT } from '@buffcore/i18n/react';
|
|
5
|
+
import { useContext } from 'react';
|
|
5
6
|
import { Button } from '../../../components/Button.js';
|
|
6
7
|
import { Icon } from '../../../components/Icon.js';
|
|
7
8
|
import { Sheet } from '../../../components/Sheet.js';
|
|
8
9
|
import { captionText } from '../../../components/styles.js';
|
|
10
|
+
import { LevelChoiceContext } from '../../app/level-choice.js';
|
|
9
11
|
import { useMachine } from './machine.js';
|
|
10
12
|
import { COMPUTER } from './PlaceList.js';
|
|
11
13
|
const heading = {
|
|
@@ -23,8 +25,11 @@ function Row({ on, onClick, children, }) {
|
|
|
23
25
|
export function SettingsSheet({ level, product, places, page, onClose, onLevel, onGo, onHelp, }) {
|
|
24
26
|
const t = useT();
|
|
25
27
|
const machine = useMachine(product);
|
|
28
|
+
// A phone's level chip is an icon: this row says the level in words, Never ask included.
|
|
29
|
+
const name = t(`studio.frame.level.${level}`);
|
|
30
|
+
const never = useContext(LevelChoiceContext)?.neverAsk;
|
|
26
31
|
const computer = places ? COMPUTER.filter(({ id }) => places.includes(id)) : COMPUTER;
|
|
27
|
-
return (_jsx(Sheet, { title: t('studio.frame.settings'), onClose: onClose, children: _jsxs("div", { style: { display: 'grid', gap: 'var(--space-4)' }, children: [_jsxs(Section, { title: t('studio.level.choices'), children: [_jsxs(Row, { onClick: onLevel, children: [_jsx(Icon, { name: "sliders-horizontal", size: "var(--icon-md)" }), _jsx("span", { style: { flex: 1 }, children: t(
|
|
32
|
+
return (_jsx(Sheet, { title: t('studio.frame.settings'), onClose: onClose, children: _jsxs("div", { style: { display: 'grid', gap: 'var(--space-4)' }, children: [_jsxs(Section, { title: t('studio.level.choices'), children: [_jsxs(Row, { onClick: onLevel, children: [_jsx(Icon, { name: "sliders-horizontal", size: "var(--icon-md)" }), _jsx("span", { style: { flex: 1 }, children: never ? t('studio.level.neverAsk.chip', { level: name }) : name }), _jsx(Icon, { name: "chevron-right", size: "var(--icon-sm)" })] }), _jsxs("p", { style: {
|
|
28
33
|
...captionText,
|
|
29
34
|
fontWeight: 'var(--weight-regular)',
|
|
30
35
|
margin: 0,
|
|
@@ -6,6 +6,7 @@ import { useT } from '@buffcore/i18n/react';
|
|
|
6
6
|
import { Icon } from '../../../components/Icon.js';
|
|
7
7
|
import { captionText } from '../../../components/styles.js';
|
|
8
8
|
import { usePlaces } from '../../app/places.js';
|
|
9
|
+
import { HostRailEntries } from './HostRailEntries.js';
|
|
9
10
|
import { LoopSteps } from './LoopSteps.js';
|
|
10
11
|
import { Place } from './Place.js';
|
|
11
12
|
import { AgentFoot, FOUNDATIONS, PLACES, PlaceList } from './PlaceList.js';
|
|
@@ -34,7 +35,7 @@ export function StudioRail(props) {
|
|
|
34
35
|
?.filter((chat) => !chat.change && chat.state === 'running')
|
|
35
36
|
.map((chat) => chat.title);
|
|
36
37
|
const go = useGo(onGo);
|
|
37
|
-
return (_jsxs("nav", { "aria-label": t(rail.form === 'places' ? 'studio.frame.rail.places' : 'studio.frame.rail.loop'), style: railStyle(collapsed, block), children: [rail.form === 'loop' ? (_jsx(LoopSteps, { level: props.level, working: writing, places: places, stage: rail.stage, page: page, collapsed: collapsed, onGo: go })) : (_jsx(Places, { places: places, rail: rail, page: page, product: product, collapsed: collapsed, onGo: go, reviewer: reviewer })), _jsx("span", { style: { flex: 1 } }), !collapsed && !reviewer && (_jsx(RailFoot, { agent: product.agent, loop: rail.form === 'loop', onGo: go })), _jsx(Place, { id: "page" }), _jsx(Place, { id: "rail.end" })] }));
|
|
38
|
+
return (_jsxs("nav", { "aria-label": t(rail.form === 'places' ? 'studio.frame.rail.places' : 'studio.frame.rail.loop'), style: railStyle(collapsed, block), children: [rail.form === 'loop' ? (_jsx(LoopSteps, { level: props.level, working: writing, places: places, stage: rail.stage, page: page, collapsed: collapsed, onGo: go })) : (_jsx(Places, { places: places, rail: rail, page: page, product: product, collapsed: collapsed, onGo: go, reviewer: reviewer })), _jsx("span", { style: { flex: 1 } }), !collapsed && !reviewer && (_jsx(RailFoot, { agent: product.agent, loop: rail.form === 'loop', onGo: go })), _jsx(Place, { id: "page" }), _jsx(HostRailEntries, { collapsed: collapsed }), _jsx(Place, { id: "rail.end" })] }));
|
|
38
39
|
}
|
|
39
40
|
/** Returning to a built page closes any host page or tab. */
|
|
40
41
|
function useGo(onGo) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Chat } from '@buffcore/contracts/workbench';
|
|
1
2
|
import type { StudioAgentPanel } from '../types.ts';
|
|
2
3
|
import type { PanelMessage } from './panelLines.ts';
|
|
3
4
|
/** Turn facts and callbacks are supplied by the served container, or by a scene. */
|
|
@@ -29,6 +30,13 @@ export interface TurnControls {
|
|
|
29
30
|
ios: boolean;
|
|
30
31
|
android: boolean;
|
|
31
32
|
}) => void;
|
|
33
|
+
/** The paused turn's permission card, or its answer folded; only with the settings right. */
|
|
34
|
+
ask?: {
|
|
35
|
+
asking?: Asking;
|
|
36
|
+
answered?: AnsweredAsk;
|
|
37
|
+
/** True when the studio passed the answer on, or the refusal sentence. */
|
|
38
|
+
onAnswer: (answer: AskAnswer) => Promise<true | string>;
|
|
39
|
+
};
|
|
32
40
|
save?: {
|
|
33
41
|
onSave: () => Promise<void>;
|
|
34
42
|
saving: boolean;
|
|
@@ -46,6 +54,15 @@ export interface TurnControls {
|
|
|
46
54
|
focus?: number;
|
|
47
55
|
};
|
|
48
56
|
}
|
|
57
|
+
export type AskAnswer = 'once' | 'always' | 'deny';
|
|
58
|
+
export type Asking = NonNullable<Chat['asking']>;
|
|
59
|
+
/** A card the person answered: it folds to one line while the turn goes on. */
|
|
60
|
+
export interface AnsweredAsk {
|
|
61
|
+
asking: Asking;
|
|
62
|
+
answer: AskAnswer;
|
|
63
|
+
/** The chat's length when answered: the studio's own line for the answer comes after it. */
|
|
64
|
+
after: number;
|
|
65
|
+
}
|
|
49
66
|
export type ControlledAgent = StudioAgentPanel & {
|
|
50
67
|
turn?: TurnControls;
|
|
51
68
|
chatId?: string;
|
|
@@ -17,6 +17,7 @@ export declare const isRedactedTarget: (targets: readonly string[]) => boolean;
|
|
|
17
17
|
/**
|
|
18
18
|
* The last call the agent was refused, when the person has not answered it yet: nothing from the
|
|
19
19
|
* person after it, the agent not running, and no permission notice (it has its own two buttons).
|
|
20
|
+
* A call a limit refused has its own card, with nothing to ask again.
|
|
20
21
|
*/
|
|
21
22
|
export declare function refusedCall(lines: readonly PanelMessage[], running: boolean | undefined): {
|
|
22
23
|
tool: NonNullable<PanelMessage['tool']>;
|
|
@@ -62,11 +62,12 @@ export const isRedactedTarget = (targets) => targets.some((target) => REDACTION_
|
|
|
62
62
|
/**
|
|
63
63
|
* The last call the agent was refused, when the person has not answered it yet: nothing from the
|
|
64
64
|
* person after it, the agent not running, and no permission notice (it has its own two buttons).
|
|
65
|
+
* A call a limit refused has its own card, with nothing to ask again.
|
|
65
66
|
*/
|
|
66
67
|
export function refusedCall(lines, running) {
|
|
67
68
|
if (running)
|
|
68
69
|
return undefined;
|
|
69
|
-
const at = lines.findLastIndex((m) => m.tool?.refused);
|
|
70
|
+
const at = lines.findLastIndex((m) => m.tool?.refused && !m.tool.limit);
|
|
70
71
|
if (at < 0)
|
|
71
72
|
return undefined;
|
|
72
73
|
const after = lines.slice(at + 1);
|