@buffcore/admin-shell 0.8.40 → 0.8.42
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/i18n/en.d.ts +3 -0
- package/dist/i18n/en.js +3 -0
- package/dist/i18n/es.json +3 -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/workbench/app/ServedPrototype.js +19 -1
- package/dist/workbench/app/ServedSetup.js +8 -1
- package/dist/workbench/app/StudioApp.js +41 -20
- package/dist/workbench/app/__snapshots__/places-dom.test.tsx.snap +3 -3
- package/dist/workbench/app/actions.d.ts +12 -1
- package/dist/workbench/app/actions.js +14 -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 +44 -0
- package/dist/workbench/app/chat.d.ts +59 -0
- package/dist/workbench/app/chat.js +1 -0
- package/dist/workbench/app/frame.js +4 -2
- 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/loop.js +10 -4
- 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 +10 -0
- package/dist/workbench/app/panel-cards.js +29 -0
- package/dist/workbench/app/places.d.ts +17 -2
- package/dist/workbench/app/places.js +14 -2
- 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 +2 -0
- package/dist/workbench/app/test/loop-fixture.d.ts +30 -2
- package/dist/workbench/app/usePrototypeUi.js +14 -0
- package/dist/workbench/app/work.d.ts +7 -7
- 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/AllowFolderCard.d.ts +16 -0
- package/dist/workbench/studio/frame/AllowFolderCard.js +63 -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/NeverAskSetting.d.ts +7 -0
- package/dist/workbench/studio/frame/NeverAskSetting.js +24 -0
- package/dist/workbench/studio/frame/PanelList.js +11 -3
- package/dist/workbench/studio/frame/PanelMessage.d.ts +2 -0
- package/dist/workbench/studio/frame/PanelMessage.js +1 -1
- package/dist/workbench/studio/frame/PanelNotice.js +2 -1
- package/dist/workbench/studio/frame/PanelPermission.d.ts +2 -0
- package/dist/workbench/studio/frame/PanelPermission.js +4 -0
- 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/PlatformsCard.d.ts +10 -0
- package/dist/workbench/studio/frame/PlatformsCard.js +26 -0
- package/dist/workbench/studio/frame/SettingsSheet.js +6 -1
- package/dist/workbench/studio/frame/StudioRail.js +2 -1
- package/dist/workbench/studio/frame/WaitingBanner.d.ts +5 -0
- package/dist/workbench/studio/frame/WaitingBanner.js +17 -0
- package/dist/workbench/studio/frame/panelControls.d.ts +29 -0
- package/dist/workbench/studio/frame/useTurnDraft.d.ts +1 -0
- package/dist/workbench/studio/frame/useTurnDraft.js +3 -1
- package/dist/workbench/studio/i18n/frame.en.d.ts +44 -0
- package/dist/workbench/studio/i18n/frame.en.js +45 -1
- package/dist/workbench/studio/i18n/frame.es.json +46 -2
- package/dist/workbench/studio/i18n/levels.en.d.ts +8 -3
- package/dist/workbench/studio/i18n/levels.en.js +8 -3
- package/dist/workbench/studio/i18n/levels.es.json +9 -4
- package/dist/workbench/studio/i18n/loop.en.d.ts +16 -0
- package/dist/workbench/studio/i18n/loop.en.js +18 -2
- package/dist/workbench/studio/i18n/loop.es.json +18 -2
- 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/PrototypePage.js +4 -3
- package/dist/workbench/studio/loop/PrototypeScenes.js +1 -2
- package/dist/workbench/studio/loop/PrototypeSimplePage.js +7 -6
- package/dist/workbench/studio/loop/PrototypeSnapshot.js +5 -1
- package/dist/workbench/studio/loop/ReviewedSave.d.ts +1 -1
- package/dist/workbench/studio/loop/ReviewedSave.js +2 -10
- package/dist/workbench/studio/loop/ServedBrand.js +3 -3
- package/dist/workbench/studio/loop/StructurePage.d.ts +2 -0
- package/dist/workbench/studio/loop/StructurePage.js +1 -1
- package/dist/workbench/studio/loop/StructurePreview.js +4 -4
- package/dist/workbench/studio/loop/StructurePrompts.js +9 -4
- 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 +2 -1
- 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/run/WhereItRuns.d.ts +5 -0
- package/dist/workbench/studio/run/WhereItRuns.js +37 -17
- package/dist/workbench/studio/work/work-test-data.d.ts +4 -1
- package/package.json +6 -6
- package/vite.d.ts +6 -1
- package/vite.js +78 -5
|
@@ -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,7 +4,9 @@ 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';
|
|
9
|
+
import { isPlatformCommand, PlatformsCard } from './PlatformsCard.js';
|
|
8
10
|
import { panelLines, refusedCall } from './panelLines.js';
|
|
9
11
|
import { ClearedLine, StuckTurn } from './StuckTurn.js';
|
|
10
12
|
import { QueuedLine, WorkingBar } from './TurnControls.js';
|
|
@@ -19,6 +21,8 @@ const listStyle = {
|
|
|
19
21
|
alignContent: 'start',
|
|
20
22
|
overflow: 'auto',
|
|
21
23
|
minHeight: 0,
|
|
24
|
+
// Holds the messages' hidden labels (absolute) inside the scroll; else a long chat stretches the page.
|
|
25
|
+
position: 'relative',
|
|
22
26
|
};
|
|
23
27
|
const pageSize = 200;
|
|
24
28
|
/** Follow appended or updated lines until the person scrolls away from the end. */
|
|
@@ -28,9 +32,12 @@ export function PanelList({ agent, simple }) {
|
|
|
28
32
|
const follow = useRef(true);
|
|
29
33
|
const [earliest, setEarliest] = useState();
|
|
30
34
|
const first = earliest ?? Math.max(0, agent.messages.length - pageSize);
|
|
31
|
-
|
|
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);
|
|
32
38
|
const latestEnd = lines.findLastIndex(({ message }) => message.end);
|
|
33
39
|
const refused = refusedCall(agent.messages, agent.running);
|
|
40
|
+
const onPlatforms = agent.turn?.onPlatforms;
|
|
34
41
|
useLayoutEffect(() => {
|
|
35
42
|
if (follow.current && list.current)
|
|
36
43
|
list.current.scrollTop = list.current.scrollHeight;
|
|
@@ -44,6 +51,7 @@ export function PanelList({ agent, simple }) {
|
|
|
44
51
|
}, children: t('studio.frame.panel.earlier') }) })), lines.map(({ message, position }, i) => (_jsx(PanelMessage, { m: {
|
|
45
52
|
...message,
|
|
46
53
|
...(agent.turn?.sending && i === lines.length - 1 ? { sending: true } : {}),
|
|
47
|
-
}, turn: agent.turn, latestEnd: i === latestEnd, simple: simple, canApprove: agent.canApprove, approvalByRule: agent.approvalByRule }, position))), refused &&
|
|
48
|
-
(
|
|
54
|
+
}, turn: agent.turn, at: position, latestEnd: i === latestEnd, simple: simple, canApprove: agent.canApprove, approvalByRule: agent.approvalByRule }, position))), refused &&
|
|
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 &&
|
|
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" })] }));
|
|
49
57
|
}
|
|
@@ -6,6 +6,8 @@ interface MessageProps {
|
|
|
6
6
|
approvalByRule?: boolean;
|
|
7
7
|
turn?: TurnControls;
|
|
8
8
|
latestEnd?: boolean;
|
|
9
|
+
/** The message's place in the chat. */
|
|
10
|
+
at?: number;
|
|
9
11
|
}
|
|
10
12
|
export declare function PanelMessage(props: MessageProps): import("react").JSX.Element;
|
|
11
13
|
export {};
|
|
@@ -43,7 +43,7 @@ export function PanelMessage(props) {
|
|
|
43
43
|
if (m.tool)
|
|
44
44
|
return _jsx(PanelTool, { tool: m.tool });
|
|
45
45
|
if (m.permission)
|
|
46
|
-
return (_jsx(PanelPermission, { permission: m.permission, agent: m.agent ?? '', turn: props.turn, snippet: m.detail, repeated: m.permissionRepeated }));
|
|
46
|
+
return (_jsx(PanelPermission, { permission: m.permission, agent: m.agent ?? '', turn: props.turn, snippet: m.detail, repeated: m.permissionRepeated, at: props.at }));
|
|
47
47
|
if (m.end)
|
|
48
48
|
return (_jsx(PanelEnd, { end: m.end, agent: m.agent ?? '', showUnsaved: props.latestEnd, save: props.latestEnd ? props.turn?.save : undefined }));
|
|
49
49
|
if (m.failure)
|
|
@@ -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
|
}
|
|
@@ -6,6 +6,8 @@ interface Props {
|
|
|
6
6
|
turn?: TurnControls;
|
|
7
7
|
snippet?: string;
|
|
8
8
|
repeated?: boolean;
|
|
9
|
+
/** The notice's place in the chat, for the one-click allow. */
|
|
10
|
+
at?: number;
|
|
9
11
|
}
|
|
10
12
|
/** The CLI supplies the exact snippet only for a verified sibling; the person edits the file. */
|
|
11
13
|
export declare function PanelPermission(props: Props): import("react").JSX.Element;
|
|
@@ -4,6 +4,7 @@ import { useState } from 'react';
|
|
|
4
4
|
import { Banner } from '../../../components/Banner.js';
|
|
5
5
|
import { Button } from '../../../components/Button.js';
|
|
6
6
|
import { bodyText, monoText } from '../../../components/styles.js';
|
|
7
|
+
import { AllowFolderCard } from './AllowFolderCard.js';
|
|
7
8
|
import { folderButtonStyle, RetryButtons } from './TurnControls.js';
|
|
8
9
|
/** The CLI supplies the exact snippet only for a verified sibling; the person edits the file. */
|
|
9
10
|
export function PanelPermission(props) {
|
|
@@ -12,6 +13,9 @@ export function PanelPermission(props) {
|
|
|
12
13
|
const read = t('studio.frame.lines.permission.read', { agent, path: permission.path });
|
|
13
14
|
if (repeated)
|
|
14
15
|
return _jsx("li", { style: { ...bodyText, overflowWrap: 'anywhere' }, children: read });
|
|
16
|
+
const onAllowFolder = props.turn?.onAllowFolder;
|
|
17
|
+
if ((onAllowFolder && props.at !== undefined) || permission.allowed)
|
|
18
|
+
return (_jsx(AllowFolderCard, { permission: permission, agent: agent, at: props.at ?? -1, turn: { ...props.turn, onAllowFolder: onAllowFolder ?? (async () => '') } }));
|
|
15
19
|
return (_jsx("li", { children: _jsx(Banner, { tone: "attention", icon: "key-round", title: t('studio.frame.lines.permission.title'), children: _jsxs("div", { style: snippet ? { display: 'grid', gap: 'var(--space-3)', minInlineSize: 0 } : undefined, children: [_jsx("p", { style: { margin: 0 }, children: read }), _jsx(PermissionInstructions, { ...props })] }) }) }));
|
|
16
20
|
}
|
|
17
21
|
function PermissionInstructions({ permission, snippet, turn }) {
|
|
@@ -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 }) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TurnControls } from './panelControls.ts';
|
|
2
|
+
import type { PanelMessage } from './panelLines.ts';
|
|
3
|
+
/** The refused call was the agent changing a platform. */
|
|
4
|
+
export declare function isPlatformCommand(tool: NonNullable<PanelMessage['tool']>): boolean;
|
|
5
|
+
/** The three platforms as switches, and a way to Setup with them chosen. It changes nothing. */
|
|
6
|
+
export declare function PlatformsCard({ turn, }: {
|
|
7
|
+
turn: TurnControls & {
|
|
8
|
+
onPlatforms: NonNullable<TurnControls['onPlatforms']>;
|
|
9
|
+
};
|
|
10
|
+
}): import("react").JSX.Element;
|
|
@@ -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 { SettingRow } from '../../../components/SettingRow.js';
|
|
6
|
+
import { Switch } from '../../../components/Switch.js';
|
|
7
|
+
import { bodyText, captionText } from '../../../components/styles.js';
|
|
8
|
+
import { chatCard } from './AllowFolderCard.js';
|
|
9
|
+
import { folderButtonStyle } from './TurnControls.js';
|
|
10
|
+
/** `ape enable|disable <platform>`, as the agent's recorded command runs it (never its prose). */
|
|
11
|
+
const PLATFORM_COMMAND = /(?:^|&&|;|\|\|)\s*(?:(?:pnpm|npm|yarn)\s+(?:exec\s+|run\s+)?|npx\s+|pnpx\s+)?ape\s+(?:enable|disable)\s+(?:ios|android|web)\b/i;
|
|
12
|
+
/** The refused call was the agent changing a platform. */
|
|
13
|
+
export function isPlatformCommand(tool) {
|
|
14
|
+
return tool.verb === 'ran' && tool.targets.some((target) => PLATFORM_COMMAND.test(target));
|
|
15
|
+
}
|
|
16
|
+
/** The three platforms as switches, and a way to Setup with them chosen. It changes nothing. */
|
|
17
|
+
export function PlatformsCard({ turn, }) {
|
|
18
|
+
const t = useT();
|
|
19
|
+
const [wanted, setWanted] = useState(turn.platforms);
|
|
20
|
+
return (_jsx("li", { children: _jsxs("div", { style: chatCard, children: [_jsx("p", { style: {
|
|
21
|
+
...bodyText,
|
|
22
|
+
margin: 0,
|
|
23
|
+
fontWeight: 'var(--weight-semibold)',
|
|
24
|
+
color: 'var(--text-strong)',
|
|
25
|
+
}, children: t('studio.frame.platforms.title') }), _jsx("p", { style: { margin: 0 }, children: t('studio.frame.platforms.why') }), wanted && (_jsxs("div", { children: [_jsx(SettingRow, { first: true, label: t('studio.start.where.web'), help: t('studio.frame.platforms.webAlways'), children: _jsx(Switch, { on: true, disabled: true, touchTarget: true, label: t('studio.start.where.web') }) }), ['ios', 'android'].map((p) => (_jsx(SettingRow, { label: t(`studio.start.where.${p}`), children: _jsx(Switch, { on: wanted[p], touchTarget: true, label: t(`studio.start.where.${p}`), onChange: (on) => setWanted({ ...wanted, [p]: on }) }) }, p)))] })), _jsx(Button, { size: "lg", variant: "primary", icon: "settings", style: { ...folderButtonStyle, inlineSize: '100%' }, onClick: () => turn.onPlatforms(wanted), children: t('studio.frame.platforms.change') }), _jsx("p", { style: { ...captionText, margin: 0, fontWeight: 'normal' }, children: t('studio.frame.platforms.fine') })] }) }));
|
|
26
|
+
}
|
|
@@ -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) {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// The step's agent asked the person a question and is waiting: one calm line above the page, with
|
|
3
|
+
// the question quoted and a button to the answer box. Views are props in, UI out.
|
|
4
|
+
import { useT } from '@buffcore/i18n/react';
|
|
5
|
+
import { Banner } from '../../../components/Banner.js';
|
|
6
|
+
import { Button } from '../../../components/Button.js';
|
|
7
|
+
const touch = { minBlockSize: 'var(--target)', minInlineSize: 'var(--target)' };
|
|
8
|
+
export function WaitingBanner({ agent, question, onAnswer, }) {
|
|
9
|
+
const t = useT();
|
|
10
|
+
return (_jsx(Banner, { tone: "info", icon: "message-square", title: t('studio.frame.waiting.title'), style: { marginBlockEnd: 'var(--space-4)' }, action: _jsx(Button, { size: "sm", variant: "secondary", style: touch, onClick: onAnswer, children: t('studio.frame.waiting.answer') }), children: _jsx("span", { "data-waiting-question": "", title: question, style: {
|
|
11
|
+
display: '-webkit-box',
|
|
12
|
+
WebkitBoxOrient: 'vertical',
|
|
13
|
+
WebkitLineClamp: 2,
|
|
14
|
+
overflow: 'hidden',
|
|
15
|
+
overflowWrap: 'anywhere',
|
|
16
|
+
}, children: t('studio.frame.waiting.asks', { agent, question }) }) }));
|
|
17
|
+
}
|
|
@@ -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. */
|
|
@@ -17,6 +18,25 @@ export interface TurnControls {
|
|
|
17
18
|
/** An ordinary message to the agent, sent as the person: the refused call's two answers. */
|
|
18
19
|
onSay?: (text: string) => unknown;
|
|
19
20
|
onAgents?: () => void;
|
|
21
|
+
/** A person's "Allow this folder" on the chat's notice at `at`; only with the settings right. */
|
|
22
|
+
onAllowFolder?: (at: number) => Promise<true | string>;
|
|
23
|
+
/** The phone platforms the studio reads (web is always on); absent when unknown. */
|
|
24
|
+
platforms?: {
|
|
25
|
+
ios: boolean;
|
|
26
|
+
android: boolean;
|
|
27
|
+
};
|
|
28
|
+
/** Opens Setup's platforms with these chosen; Setup still saves. */
|
|
29
|
+
onPlatforms?: (wanted?: {
|
|
30
|
+
ios: boolean;
|
|
31
|
+
android: boolean;
|
|
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
|
+
};
|
|
20
40
|
save?: {
|
|
21
41
|
onSave: () => Promise<void>;
|
|
22
42
|
saving: boolean;
|
|
@@ -34,6 +54,15 @@ export interface TurnControls {
|
|
|
34
54
|
focus?: number;
|
|
35
55
|
};
|
|
36
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
|
+
}
|
|
37
66
|
export type ControlledAgent = StudioAgentPanel & {
|
|
38
67
|
turn?: TurnControls;
|
|
39
68
|
chatId?: string;
|
|
@@ -62,7 +62,9 @@ export function useTurnDraft(key, status, send, options = {}) {
|
|
|
62
62
|
context,
|
|
63
63
|
focus: (current().focus ?? 0) + 1,
|
|
64
64
|
});
|
|
65
|
-
|
|
65
|
+
/** Put the cursor in the box as it is, with no question context (the agent's own question). */
|
|
66
|
+
const focus = () => update({ ...current(), focus: (current().focus ?? 0) + 1 });
|
|
67
|
+
return { composer, send: submit, answer, focus };
|
|
66
68
|
}
|
|
67
69
|
function useQueue(status, options, current, update, submit) {
|
|
68
70
|
useEffect(() => {
|