@buffcore/admin-shell 0.8.42 → 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.
Files changed (61) hide show
  1. package/dist/screens/assistant/use-ask.d.ts +4 -3
  2. package/dist/workbench/app/ServedAgents.js +4 -1
  3. package/dist/workbench/app/ServedComp.d.ts +3 -0
  4. package/dist/workbench/app/ServedComp.js +33 -0
  5. package/dist/workbench/app/ServedPrototype.js +9 -0
  6. package/dist/workbench/app/actions.d.ts +7 -0
  7. package/dist/workbench/app/actions.js +1 -0
  8. package/dist/workbench/app/chat-session.d.ts +2 -0
  9. package/dist/workbench/app/chat.d.ts +2 -0
  10. package/dist/workbench/app/fresh.d.ts +63 -0
  11. package/dist/workbench/app/fresh.js +66 -0
  12. package/dist/workbench/app/places.d.ts +1 -1
  13. package/dist/workbench/app/prototype-comp.d.ts +46 -0
  14. package/dist/workbench/app/prototype-comp.js +77 -0
  15. package/dist/workbench/app/prototype.d.ts +1 -1
  16. package/dist/workbench/app/prototype.js +3 -1
  17. package/dist/workbench/app/test/loop-fixture.d.ts +13 -8
  18. package/dist/workbench/app/useStudio.d.ts +43 -1
  19. package/dist/workbench/app/useStudio.js +8 -1
  20. package/dist/workbench/app/work.d.ts +7 -7
  21. package/dist/workbench/studio/frame/LimitCard.d.ts +5 -0
  22. package/dist/workbench/studio/frame/LimitCard.js +26 -0
  23. package/dist/workbench/studio/frame/PanelMessage.js +3 -0
  24. package/dist/workbench/studio/frame/panelLines.d.ts +1 -0
  25. package/dist/workbench/studio/frame/panelLines.js +2 -1
  26. package/dist/workbench/studio/i18n/comp.en.d.ts +26 -0
  27. package/dist/workbench/studio/i18n/comp.en.js +26 -0
  28. package/dist/workbench/studio/i18n/comp.es.d.ts +26 -0
  29. package/dist/workbench/studio/i18n/comp.es.js +25 -0
  30. package/dist/workbench/studio/i18n/frame.en.d.ts +13 -0
  31. package/dist/workbench/studio/i18n/frame.en.js +13 -0
  32. package/dist/workbench/studio/i18n/frame.es.json +14 -1
  33. package/dist/workbench/studio/i18n/fresh.en.d.ts +19 -0
  34. package/dist/workbench/studio/i18n/fresh.en.js +20 -0
  35. package/dist/workbench/studio/i18n/fresh.es.json +18 -0
  36. package/dist/workbench/studio/i18n/index.js +6 -0
  37. package/dist/workbench/studio/loop/AgentsPage.d.ts +4 -1
  38. package/dist/workbench/studio/loop/AgentsPage.js +5 -4
  39. package/dist/workbench/studio/loop/CritiqueNote.d.ts +4 -0
  40. package/dist/workbench/studio/loop/CritiqueNote.js +9 -0
  41. package/dist/workbench/studio/loop/FreshLookPanel.d.ts +21 -0
  42. package/dist/workbench/studio/loop/FreshLookPanel.js +60 -0
  43. package/dist/workbench/studio/loop/PrototypeComp.d.ts +25 -0
  44. package/dist/workbench/studio/loop/PrototypeComp.js +78 -0
  45. package/dist/workbench/studio/loop/PrototypePage.d.ts +7 -0
  46. package/dist/workbench/studio/loop/PrototypePage.js +1 -1
  47. package/dist/workbench/studio/loop/PrototypeSimplePage.js +11 -4
  48. package/dist/workbench/studio/loop/PrototypeSnapshot.d.ts +3 -0
  49. package/dist/workbench/studio/loop/PrototypeSnapshot.js +2 -1
  50. package/dist/workbench/studio/loop/ReviewSetting.d.ts +6 -0
  51. package/dist/workbench/studio/loop/ReviewSetting.js +14 -0
  52. package/dist/workbench/studio/loop/SaveStep.d.ts +3 -0
  53. package/dist/workbench/studio/loop/SaveStep.js +3 -1
  54. package/dist/workbench/studio/loop/ServedPlanning.js +1 -1
  55. package/dist/workbench/studio/loop/StructurePage.d.ts +5 -0
  56. package/dist/workbench/studio/loop/StructurePage.js +3 -2
  57. package/dist/workbench/studio/loop/SurfaceChoice.d.ts +7 -0
  58. package/dist/workbench/studio/loop/SurfaceChoice.js +20 -0
  59. package/dist/workbench/studio/loop/usePlanningDraft.js +5 -1
  60. package/dist/workbench/studio/work/work-test-data.d.ts +6 -4
  61. package/package.json +6 -6
@@ -0,0 +1,25 @@
1
+ import type { FirstSurface } from '@buffcore/contracts/workbench';
2
+ import type { DesignResult } from './useDesignApproval.ts';
3
+ export interface CompScreen {
4
+ key: string;
5
+ title: string;
6
+ /** Object addresses of the screen's pictures, light and dark, once read. */
7
+ light?: string;
8
+ dark?: string;
9
+ }
10
+ export interface PrototypeCompProps {
11
+ surface: FirstSurface;
12
+ width: number;
13
+ screens: readonly CompScreen[];
14
+ /** Reference pictures' addresses, in `design/references.md`'s order: screen n beside the nth. */
15
+ references: readonly (string | undefined)[];
16
+ approved: boolean;
17
+ /** Who approved it (git's user.email), once approved. */
18
+ approvedBy?: string;
19
+ needsRight?: 'approve';
20
+ result?: DesignResult;
21
+ onApprove?: () => void;
22
+ /** Back to the app, when the person opened an approved comp. */
23
+ onClose?: () => void;
24
+ }
25
+ export declare function PrototypeComp(props: PrototypeCompProps): import("react").JSX.Element;
@@ -0,0 +1,78 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useT } from '@buffcore/i18n/react';
3
+ import { ActionBar } from '../../../components/ActionBar.js';
4
+ import { Badge } from '../../../components/Badge.js';
5
+ import { Button } from '../../../components/Button.js';
6
+ import { bodyText, captionText } from '../../../components/styles.js';
7
+ import { useNarrow } from '../../../use-narrow.js';
8
+ import { NARROW_BELOW, useDarkMode } from '../frame/layout.js';
9
+ import { RightAction } from '../frame/RightAction.js';
10
+ const frame = {
11
+ display: 'block',
12
+ inlineSize: '100%',
13
+ border: 'var(--border-width-hairline) solid var(--border-hairline)',
14
+ borderRadius: 'var(--radius-panel)',
15
+ boxSizing: 'border-box',
16
+ };
17
+ /** The page's own title, as a page heading draws it. */
18
+ const heading = {
19
+ margin: 0,
20
+ fontFamily: 'var(--font-display)',
21
+ fontSize: 'var(--font-size-heading-3)',
22
+ lineHeight: 'var(--line-height-heading-3)',
23
+ fontWeight: 'var(--weight-heading)',
24
+ letterSpacing: 'var(--tracking-tight)',
25
+ color: 'var(--text-strong)',
26
+ overflowWrap: 'anywhere',
27
+ };
28
+ export function PrototypeComp(props) {
29
+ const { screens, references, approved, surface, width } = props;
30
+ const t = useT();
31
+ const phone = useNarrow(NARROW_BELOW);
32
+ const dark = useDarkMode();
33
+ return (_jsxs("section", { "data-prototype-comp": true, "aria-labelledby": "prototype-comp-title", style: { display: 'grid', gap: 'var(--space-6)', padding: 'var(--space-4)', minWidth: 0 }, children: [_jsxs("header", { style: { display: 'grid', gap: 'var(--space-2)' }, children: [_jsx("h2", { id: "prototype-comp-title", style: heading, children: t('studio.comp.title') }), _jsx("p", { style: { ...bodyText, margin: 0, color: 'var(--text-muted)' }, children: t('studio.comp.intro') }), _jsx("p", { style: { ...captionText, margin: 0 }, children: t(surface === 'phone' ? 'studio.comp.phone' : 'studio.comp.desktop', { width }) })] }), screens.map((screen, i) => (_jsxs("section", { "aria-label": screen.title, style: {
34
+ display: 'grid',
35
+ gap: 'var(--space-4)',
36
+ gridTemplateColumns: phone ? 'minmax(0, 1fr)' : 'minmax(0, 2fr) minmax(0, 1fr)',
37
+ }, children: [_jsxs("div", { style: { display: 'grid', gap: 'var(--space-2)', minWidth: 0, alignContent: 'start' }, children: [_jsx("strong", { style: { ...bodyText, color: 'var(--text-strong)' }, children: screen.title }), _jsx(ScreenPicture, { screen: screen, dark: dark })] }), _jsxs("div", { style: { display: 'grid', gap: 'var(--space-2)', alignContent: 'start' }, children: [_jsx("span", { style: captionText, children: t('studio.comp.reference', { n: i + 1 }) }), references[i] ? (_jsx("img", { src: references[i], alt: t('studio.comp.reference', { n: i + 1 }), style: frame })) : (_jsx(ReferencePlaceholder, { variant: i, label: t('studio.comp.noReference') }))] })] }, screen.key))), _jsx(CompActions, { ...props, approved: approved })] }));
38
+ }
39
+ function ScreenPicture({ screen, dark }) {
40
+ const t = useT();
41
+ const src = (dark && screen.dark) || screen.light || screen.dark;
42
+ if (src)
43
+ return _jsx("img", { src: src, alt: screen.title, style: frame });
44
+ return (_jsx("div", { role: "img", "aria-label": t('studio.comp.noPicture'), style: { ...frame, aspectRatio: '16 / 10', background: 'var(--surface-sunken)' } }));
45
+ }
46
+ function CompActions({ approved, approvedBy, needsRight, result, onApprove, onClose, }) {
47
+ const t = useT();
48
+ return (_jsx(ActionBar, { secondary: onClose && (_jsx(Button, { variant: "ghost", size: "lg", onClick: onClose, children: t('studio.comp.back') })), status: _jsx("span", { style: captionText, children: approved
49
+ ? t('studio.comp.approvedBy', { by: approvedBy ?? '' })
50
+ : (result?.output ?? t('studio.comp.change')) }), primary: approved ? (_jsx(Badge, { tone: "success", children: t('studio.comp.approved') })) : (_jsx(RightAction, { size: "lg", icon: "shield-check", needsRight: needsRight, loading: result?.busy, disabled: !onApprove, onClick: onApprove, children: t('studio.comp.approve') })) }));
51
+ }
52
+ /** A neutral stand-in where `design/references.md` names no picture: shapes, never a product. */
53
+ function ReferencePlaceholder({ variant, label }) {
54
+ const tones = ['var(--brand-tint)', 'var(--info-tint)', 'var(--success-tint)'];
55
+ return (_jsxs("div", { role: "img", "aria-label": label, "data-comp-placeholder": true, style: {
56
+ ...frame,
57
+ aspectRatio: '4 / 3',
58
+ position: 'relative',
59
+ overflow: 'hidden',
60
+ background: tones[variant % tones.length],
61
+ }, children: [_jsx("div", { style: {
62
+ position: 'absolute',
63
+ insetInlineStart: '12%',
64
+ insetBlockStart: '18%',
65
+ width: '46%',
66
+ height: '58%',
67
+ background: 'var(--surface-card, var(--surface-panel))',
68
+ borderRadius: 'var(--radius-panel)',
69
+ } }), _jsx("div", { style: {
70
+ position: 'absolute',
71
+ insetInlineEnd: '10%',
72
+ insetBlockEnd: '14%',
73
+ width: '30%',
74
+ aspectRatio: '1',
75
+ background: 'var(--surface-pressed)',
76
+ borderRadius: 'var(--radius-pill)',
77
+ } })] }));
78
+ }
@@ -7,6 +7,12 @@ import type { PrototypeChecks } from './PrototypeVersionBar.tsx';
7
7
  import { type ProtoView } from './protoView.ts';
8
8
  import type { LoopMoment, LoopSample } from './types.ts';
9
9
  export type PrototypeSample = Pick<LoopSample, 'product' | 'proto' | 'journeys' | 'choices'>;
10
+ /** The comp (`PrototypeComp`): shown in the app's place while `open`, else its summary below. */
11
+ export interface CompSlot {
12
+ open: boolean;
13
+ view: ReactNode;
14
+ summary?: ReactNode;
15
+ }
10
16
  export interface PrototypePageProps {
11
17
  appUrl?: string;
12
18
  home?: PrototypeAppProps;
@@ -15,6 +21,7 @@ export interface PrototypePageProps {
15
21
  };
16
22
  title?: ReactNode;
17
23
  reviewPanel?: ReactNode;
24
+ comp?: CompSlot;
18
25
  snapshot?: PrototypeSnapshotProps;
19
26
  onConsoleRetry?: () => void;
20
27
  sample: PrototypeSample;
@@ -33,7 +33,7 @@ export function PrototypePage(props) {
33
33
  const legacyHref = !props.home ? prototypeAddress(props.appUrl)?.href : undefined;
34
34
  return (_jsx(HostSide, { subject: { change: sample.proto.change.id, version: view.version }, children: _jsxs(Page, { boundedHeader: !!props.home, crumbs: [prototypeCrumb(sample, view, t)].filter(Boolean), title: props.title ?? t('studio.frame.page.prototype'), sub: t(props.home ? 'studio.prototype.intro' : 'studio.loop.proto.lead', {
35
35
  name: sample.product.name,
36
- }), actions: !props.home && (approve || legacyHref) ? (_jsxs(Row, { children: [legacyHref && (_jsx("a", { href: legacyHref, target: "_blank", rel: "noopener noreferrer", style: { color: 'var(--brand-ink)' }, children: t('studio.loop.proto.open') })), approve && _jsx(ApproveBlock, { view: view, onApprove: onApprove })] })) : undefined, children: [props.home && _jsx("style", { children: PROTOTYPE_HOME_LAYOUT }), props.home ? (_jsxs(IsolatedFrames, { reason: t('studio.prototype.status.blocked'), children: [_jsx("span", { "data-prototype-draft": true, title: t('studio.prototype.draft'), style: captionText, children: t('studio.prototype.draft') }), _jsx(PrototypeApp, { ...props.home }), _jsx(PrototypeReview, { ...props, view: view, snapshotOk: (props.home.snapshotReady ?? props.home.running) && props.home.source !== 'missing' }), _jsx(PrototypeScenes, { ...props, view: view })] })) : (_jsxs(_Fragment, { children: [_jsx(DesignLevel, { level: props.level === null ? undefined : (props.level ?? 'guide'), needsRight: !!view.needsRight, named: hasRuleSigners(view.signatures) }), _jsx(ApproveWhy, { view: view }), _jsx(PrototypeReview, { ...props, view: view })] })), _jsx(Place, { id: "approve:prototype" })] }) }));
36
+ }), actions: !props.home && (approve || legacyHref) ? (_jsxs(Row, { children: [legacyHref && (_jsx("a", { href: legacyHref, target: "_blank", rel: "noopener noreferrer", style: { color: 'var(--brand-ink)' }, children: t('studio.loop.proto.open') })), approve && _jsx(ApproveBlock, { view: view, onApprove: onApprove })] })) : undefined, children: [props.home && _jsx("style", { children: PROTOTYPE_HOME_LAYOUT }), props.home ? (_jsxs(IsolatedFrames, { reason: t('studio.prototype.status.blocked'), children: [_jsx("span", { "data-prototype-draft": true, title: t('studio.prototype.draft'), style: captionText, children: t('studio.prototype.draft') }), props.comp?.open && props.comp.view, _jsx("div", { hidden: props.comp?.open || undefined, style: { display: props.comp?.open ? 'none' : 'contents' }, children: _jsx(PrototypeApp, { ...props.home }) }), !props.comp?.open && props.comp?.summary, _jsx(PrototypeReview, { ...props, view: view, snapshotOk: (props.home.snapshotReady ?? props.home.running) && props.home.source !== 'missing' }), _jsx(PrototypeScenes, { ...props, view: view })] })) : (_jsxs(_Fragment, { children: [_jsx(DesignLevel, { level: props.level === null ? undefined : (props.level ?? 'guide'), needsRight: !!view.needsRight, named: hasRuleSigners(view.signatures) }), _jsx(ApproveWhy, { view: view }), _jsx(PrototypeReview, { ...props, view: view })] })), _jsx(Place, { id: "approve:prototype" })] }) }));
37
37
  }
38
38
  function prototypeCrumb(sample, view, t) {
39
39
  const { proto } = sample;
@@ -16,6 +16,7 @@ export function PrototypeSimplePage(props) {
16
16
  const t = useT();
17
17
  const { view, sample, preview, home, onCompare, onPair } = props;
18
18
  const focus = usePrototypeFocus(usePrototypeNarrow());
19
+ const comp = props.comp?.open && !view.compare;
19
20
  const showProblems = home && !view.reviewOnly && props.snapshot?.reply?.status === 'failed'
20
21
  ? () => {
21
22
  const problems = focus.root.current?.querySelector(`#${snapshotProblemsId}`);
@@ -25,15 +26,21 @@ export function PrototypeSimplePage(props) {
25
26
  : undefined;
26
27
  return (_jsx(IsolatedFrames, { reason: t('studio.prototype.status.blocked'), children: _jsx(PrototypeFocus, { value: focus, children: _jsxs("div", { ref: focus.root, style: { display: 'contents' }, children: [_jsx(HostSide, { subject: { change: sample.proto.change.id, version: view.version }, children: _jsxs("section", { "data-prototype-simple": true, style: {
27
28
  display: 'grid',
28
- gridTemplateRows: 'auto minmax(calc(var(--width-margin) * .6), 1fr)',
29
- blockSize: '100%',
29
+ // The comp is a page of its own length; the app fills the first screen.
30
+ gridTemplateRows: comp
31
+ ? 'auto auto'
32
+ : 'auto minmax(calc(var(--width-margin) * .6), 1fr)',
33
+ blockSize: comp ? undefined : '100%',
30
34
  minBlockSize: 'calc(var(--width-margin) + var(--control-lg))',
31
- }, children: [_jsx("h1", { id: prototypeHeadingId, tabIndex: -1, style: visuallyHidden, children: props.title ?? t('studio.frame.page.prototype') }), _jsx(PrototypeVersionBar, { ...props, checks: props.simple?.checks, onProblems: showProblems }), _jsx("div", { hidden: view.compare || undefined, style: { display: view.compare ? 'none' : 'grid', minBlockSize: 0 }, children: preview }), view.compare && _jsx(PrototypeComparison, { sample, view, onCompare, onPair })] }) }), home && (_jsxs("div", { style: {
35
+ }, children: [_jsx("h1", { id: prototypeHeadingId, tabIndex: -1, style: visuallyHidden, children: props.title ?? t('studio.frame.page.prototype') }), _jsx(PrototypeVersionBar, { ...props, checks: props.simple?.checks, onProblems: showProblems }), comp && props.comp?.view, _jsx("div", { hidden: view.compare || props.comp?.open || undefined, style: {
36
+ display: view.compare || props.comp?.open ? 'none' : 'grid',
37
+ minBlockSize: 0,
38
+ }, children: preview }), view.compare && _jsx(PrototypeComparison, { sample, view, onCompare, onPair })] }) }), home && (_jsxs("div", { style: {
32
39
  display: 'grid',
33
40
  padding: 'var(--space-4)',
34
41
  gap: 'var(--space-3)',
35
42
  minInlineSize: 0,
36
- }, children: [_jsx(PrototypeReview, { ...props, snapshotOk: (home.snapshotReady ?? home.running) && home.source !== 'missing' }), _jsx(PrototypeScenes, { ...props }), _jsx(Place, { id: "approve:prototype" })] }))] }) }) }));
43
+ }, children: [!props.comp?.open && props.comp?.summary, _jsx(PrototypeReview, { ...props, snapshotOk: (home.snapshotReady ?? home.running) && home.source !== 'missing' }), _jsx(PrototypeScenes, { ...props }), _jsx(Place, { id: "approve:prototype" })] }))] }) }) }));
37
44
  }
38
45
  function PrototypeComparison({ sample, view, onCompare, onPair, }) {
39
46
  const dismiss = usePrototypePanel('compare', () => onCompare?.(view.version, view.version));
@@ -1,3 +1,4 @@
1
+ import type { FreshCritique } from '@buffcore/contracts/workbench';
1
2
  import { type SnapshotReply } from '../../app/prototype-snapshot.ts';
2
3
  import type { RecordResult } from './usePrototypeRecord.ts';
3
4
  export interface PrototypeSnapshotProps {
@@ -16,6 +17,8 @@ export interface PrototypeSnapshotProps {
16
17
  onStart: () => void;
17
18
  onStop: () => void;
18
19
  onRecord: () => void;
20
+ /** The critique a fresh agent writes after a passing full snapshot. */
21
+ critique?: FreshCritique;
19
22
  }
20
23
  /** The approved manual path, with source and execution supplied by the container. */
21
24
  export declare function PrototypeSnapshot(props: PrototypeSnapshotProps): import("react").JSX.Element;
@@ -6,6 +6,7 @@ import { Panel } from '../../../components/Panel.js';
6
6
  import { Loading } from '../../../components/states.js';
7
7
  import { captionText } from '../../../components/styles.js';
8
8
  import { snapshotMatches, snapshotReadFailure, } from '../../app/prototype-snapshot.js';
9
+ import { CritiqueNote } from './CritiqueNote.js';
9
10
  import { RecordFeedback } from './RecordFeedback.js';
10
11
  import { SnapshotProblems } from './SnapshotProblems.js';
11
12
  const stack = { display: 'grid', gap: 'var(--space-3)', minInlineSize: 0 };
@@ -71,7 +72,7 @@ export function PrototypeSnapshot(props) {
71
72
  record.busy ||
72
73
  !!record.why ||
73
74
  record.recorded ||
74
- (!!record.review && record.review.phase !== 'saved'), loading: record.busy, "aria-describedby": "prototype-record-reason", onClick: onRecord, children: t('studio.loop.proto.recordVersion') })] }), _jsxs(Panel, { title: t('studio.loop.snapshot.approve'), children: [_jsx("p", { style: { margin: 0 }, children: t('studio.loop.snapshot.approval') }), reused?.map(({ scene, commit }) => (_jsxs("p", { style: { margin: 0, overflowWrap: 'anywhere' }, children: [_jsx("span", { translate: "no", children: scene }), ' ', _jsx(Chip, { size: "sm", children: t('studio.loop.snapshot.reused', { commit: commit.slice(0, 12) }) })] }, scene))), withoutApi?.map((scene) => (_jsxs("p", { style: { margin: 0, overflowWrap: 'anywhere' }, children: [_jsx("span", { translate: "no", children: scene }), ' ', _jsx(Chip, { size: "sm", children: t('studio.loop.snapshot.noApi') })] }, scene)))] })] }));
75
+ (!!record.review && record.review.phase !== 'saved'), loading: record.busy, "aria-describedby": "prototype-record-reason", onClick: onRecord, children: t('studio.loop.proto.recordVersion') })] }), _jsxs(Panel, { title: t('studio.loop.snapshot.approve'), children: [_jsx("p", { style: { margin: 0 }, children: t('studio.loop.snapshot.approval') }), reused?.map(({ scene, commit }) => (_jsxs("p", { style: { margin: 0, overflowWrap: 'anywhere' }, children: [_jsx("span", { translate: "no", children: scene }), ' ', _jsx(Chip, { size: "sm", children: t('studio.loop.snapshot.reused', { commit: commit.slice(0, 12) }) })] }, scene))), withoutApi?.map((scene) => (_jsxs("p", { style: { margin: 0, overflowWrap: 'anywhere' }, children: [_jsx("span", { translate: "no", children: scene }), ' ', _jsx(Chip, { size: "sm", children: t('studio.loop.snapshot.noApi') })] }, scene)))] }), props.critique && _jsx(CritiqueNote, { critique: props.critique })] }));
75
76
  }
76
77
  function Identity({ source }) {
77
78
  const t = useT();
@@ -0,0 +1,6 @@
1
+ export interface ReviewSettingProps {
2
+ on: boolean;
3
+ /** Absent without the settings right. */
4
+ onChange?: (on: boolean) => void;
5
+ }
6
+ export declare function ReviewSetting({ on, onChange }: ReviewSettingProps): import("react").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // Settings › Agents: the fresh look before Save, on by default. Kept in plan/agents.md with the
3
+ // other agent settings; off, no second agent reads the planning steps.
4
+ import { useT } from '@buffcore/i18n/react';
5
+ import { SettingRow } from '../../../components/SettingRow.js';
6
+ import { Switch } from '../../../components/Switch.js';
7
+ export function ReviewSetting({ on, onChange }) {
8
+ const t = useT();
9
+ const label = t('studio.fresh.setting.label');
10
+ return (_jsx("div", { style: {
11
+ padding: '0 var(--space-5)',
12
+ borderBlockStart: 'var(--border-width-hairline) solid var(--border-hairline)',
13
+ }, children: _jsx(SettingRow, { first: true, label: label, help: t('studio.fresh.setting.help'), children: _jsx(Switch, { on: on, label: label, onChange: onChange, disabled: !onChange, touchTarget: true }) }) }));
14
+ }
@@ -1,4 +1,5 @@
1
1
  import type { T } from '@buffcore/i18n';
2
+ import { type FreshLook } from './FreshLookPanel.tsx';
2
3
  import type { ReviewedSave } from './useReviewedSave.ts';
3
4
  export interface StepSave {
4
5
  state: 'unsaved' | 'saved' | 'writing' | 'saving' | 'unknown';
@@ -22,6 +23,8 @@ export interface StepDraft {
22
23
  why?: string;
23
24
  writing?: boolean;
24
25
  error?: string;
26
+ /** A fresh agent's findings, beside Save (and beside the saved step on Autopilot). */
27
+ fresh?: FreshLook;
25
28
  }
26
29
  /** Every path in the review card's collapsed, scrolling list; the summary says what they are. */
27
30
  export declare function FileNames({ files, summary }: {
@@ -4,6 +4,7 @@ import { Badge } from '../../../components/Badge.js';
4
4
  import { Banner } from '../../../components/Banner.js';
5
5
  import { Icon } from '../../../components/Icon.js';
6
6
  import { bodyText, captionText, monoText, panelSurface } from '../../../components/styles.js';
7
+ import { BesideSave, freshShown } from './FreshLookPanel.js';
7
8
  import { ReasonButton } from './ReasonButton.js';
8
9
  import { ReviewedSaveView } from './ReviewedSave.js';
9
10
  import { fileList, fileSummary } from './ReviewedSaveFiles.js';
@@ -73,7 +74,8 @@ export function WritingNote({ agent }) {
73
74
  }
74
75
  /** A step page's drafted notes, under its header: writing first, then the save. */
75
76
  export function StepNotes({ draft, agent }) {
76
- return (_jsxs(_Fragment, { children: [draft.writing && _jsx(WritingNote, { agent: agent }), draft.review ? (_jsx(ReviewedSaveView, { save: draft.review })) : (draft.save && _jsx(SaveStep, { save: draft.save, agent: agent, onSave: draft.onSave })), draft.error && _jsx(Banner, { tone: "error", children: draft.error })] }));
77
+ const save = draft.review ? (_jsx(ReviewedSaveView, { save: draft.review })) : (draft.save && _jsx(SaveStep, { save: draft.save, agent: agent, onSave: draft.onSave }));
78
+ return (_jsxs(_Fragment, { children: [draft.writing && _jsx(WritingNote, { agent: agent }), freshShown(draft.fresh) ? _jsx(BesideSave, { look: draft.fresh, save: save }) : save, draft.error && _jsx(Banner, { tone: "error", children: draft.error })] }));
77
79
  }
78
80
  function saveReason(save, agent, t) {
79
81
  if (save.state === 'writing')
@@ -12,7 +12,7 @@ export function ServedPlanning(props) {
12
12
  const planning = usePlanningDraft(props);
13
13
  const { step, draft, onNext, send } = planning;
14
14
  if (step === 'structure')
15
- return (_jsx(StructurePage, { agent: briefProps(state).product.agent.name, structure: state.plan?.structure, problem: state.plan?.structure?.problem, journeys: state.plan?.journeys ?? [], progress: draft.progress ?? 'not-started', draft: draft, onStart: send, onNext: onNext }));
15
+ return (_jsx(StructurePage, { agent: briefProps(state).product.agent.name, structure: state.plan?.structure, problem: state.plan?.structure?.problem, journeys: state.plan?.journeys ?? [], progress: draft.progress ?? 'not-started', draft: draft, onStart: send, onNext: onNext, onSurface: props.actions.chooseSurface }));
16
16
  if (step === 'brief')
17
17
  return _jsx(ServedBrief, { ...props, ...planning });
18
18
  if (step === 'plan')
@@ -1,3 +1,4 @@
1
+ import type { FirstSurface } from '@buffcore/contracts/workbench';
1
2
  import { type StepDraft } from './SaveStep.tsx';
2
3
  export interface StructurePlan {
3
4
  rows: readonly {
@@ -10,6 +11,8 @@ export interface StructurePlan {
10
11
  planned?: string;
11
12
  }[];
12
13
  notes: readonly string[];
14
+ /** Which surface comes first; absent, desktop. */
15
+ surface?: FirstSurface;
13
16
  }
14
17
  export interface StructurePageProps {
15
18
  agent: string;
@@ -23,6 +26,8 @@ export interface StructurePageProps {
23
26
  problem?: string;
24
27
  onStart?: (label: string) => void;
25
28
  onNext?: (label: string) => void;
29
+ /** The person's answer to Which surface comes first, kept in the structure file. */
30
+ onSurface?: (surface: FirstSurface) => void;
26
31
  }
27
32
  /** Structure describes navigation intent; planning chat writes the file, the shared save commits it. */
28
33
  export declare function StructurePage(props: StructurePageProps): import("react").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useT } from '@buffcore/i18n/react';
3
3
  import { Badge } from '../../../components/Badge.js';
4
4
  import { Banner } from '../../../components/Banner.js';
@@ -8,6 +8,7 @@ import { ReasonButton } from './ReasonButton.js';
8
8
  import { nextReason, StepNotes } from './SaveStep.js';
9
9
  import { StructureFile } from './StructurePreview.js';
10
10
  import { StructurePrompts } from './StructurePrompts.js';
11
+ import { SurfaceChoice } from './SurfaceChoice.js';
11
12
  /** Structure describes navigation intent; planning chat writes the file, the shared save commits it. */
12
13
  export function StructurePage(props) {
13
14
  const { agent, structure, draft, progress, problem, onNext } = props;
@@ -16,5 +17,5 @@ export function StructurePage(props) {
16
17
  const why = problem ||
17
18
  nextReason(draft, t) ||
18
19
  (progress !== 'saved' ? t('studio.structure.wait') : undefined);
19
- return (_jsxs(Page, { crumbs: [t('studio.frame.rail.step', { n: 5 }), t('studio.frame.page.structure')], title: t('studio.structure.title'), sub: t('studio.structure.sub'), actions: _jsx(ReasonButton, { size: "sm", disabled: !onNext, why: why, onClick: () => onNext?.(label), children: label }), children: [_jsx(Badge, { tone: progress === 'saved' ? 'success' : 'neutral', style: { justifySelf: 'start', alignSelf: 'flex-start' }, children: t(`studio.structure.state.${progress}`) }), draft && progress !== 'not-started' && _jsx(StepNotes, { draft: draft, agent: agent }), problem && _jsx(Banner, { tone: "error", children: problem }), _jsx(TwoColumns, { main: _jsx(StructurePrompts, { ...props }), side: _jsx(StructureFile, { structure: structure, problem: problem }) })] }));
20
+ return (_jsxs(Page, { crumbs: [t('studio.frame.rail.step', { n: 5 }), t('studio.frame.page.structure')], title: t('studio.structure.title'), sub: t('studio.structure.sub'), actions: _jsx(ReasonButton, { size: "sm", disabled: !onNext, why: why, onClick: () => onNext?.(label), children: label }), children: [_jsx(Badge, { tone: progress === 'saved' ? 'success' : 'neutral', style: { justifySelf: 'start', alignSelf: 'flex-start' }, children: t(`studio.structure.state.${progress}`) }), draft && progress !== 'not-started' && _jsx(StepNotes, { draft: draft, agent: agent }), problem && _jsx(Banner, { tone: "error", children: problem }), _jsx(TwoColumns, { main: _jsxs(_Fragment, { children: [_jsx(SurfaceChoice, { surface: structure?.surface, drafted: !!structure && !problem, onSurface: props.onSurface }), _jsx(StructurePrompts, { ...props })] }), side: _jsx(StructureFile, { structure: structure, problem: problem }) })] }));
20
21
  }
@@ -0,0 +1,7 @@
1
+ import type { FirstSurface } from '@buffcore/contracts/workbench';
2
+ export declare function SurfaceChoice({ surface, drafted, onSurface, }: {
3
+ surface?: FirstSurface;
4
+ /** Whether `plan/structure.md` exists: the answer is kept in it. */
5
+ drafted: boolean;
6
+ onSurface?: (surface: FirstSurface) => void;
7
+ }): import("react").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useT } from '@buffcore/i18n/react';
3
+ import { Choice } from '../../../components/Choice.js';
4
+ import { Panel } from '../../../components/Panel.js';
5
+ import { bodyText, captionText } from '../../../components/styles.js';
6
+ export function SurfaceChoice({ surface, drafted, onSurface, }) {
7
+ const t = useT();
8
+ return (_jsxs(Panel, { children: [_jsx("p", { style: { ...bodyText, margin: 0 }, children: t('studio.structure.surface.help') }), _jsx(Choice, { label: t('studio.structure.surface.question'), value: surface ?? 'desktop', disabled: !drafted || !onSurface, onChange: (value) => onSurface?.(value), options: [
9
+ {
10
+ value: 'desktop',
11
+ label: t('studio.structure.surface.desktop'),
12
+ help: t('studio.structure.surface.desktopHelp'),
13
+ },
14
+ {
15
+ value: 'phone',
16
+ label: t('studio.structure.surface.phone'),
17
+ help: t('studio.structure.surface.phoneHelp'),
18
+ },
19
+ ] }), !drafted && (_jsx("p", { style: { ...captionText, margin: 0 }, children: t('studio.structure.surface.first') }))] }));
20
+ }
@@ -1,5 +1,6 @@
1
1
  import { useT } from '@buffcore/i18n/react';
2
2
  import { newChatFor } from '../../app/chat.js';
3
+ import { useFreshLook } from '../../app/fresh.js';
3
4
  import { briefHasContent, briefProps } from '../../app/loop.js';
4
5
  import { stepWaiting } from '../../app/loop-stage.js';
5
6
  import { nextReason } from './SaveStep.js';
@@ -28,10 +29,12 @@ export function usePlanningDraft({ state, page, actions, onStep }) {
28
29
  const writing = state.chats?.some((chat) => chat.title === step && !chat.change && chat.state === 'running') ??
29
30
  false;
30
31
  const draft = usePlanningSave(state, step, actions, writing);
32
+ const agentName = briefProps(state).product.agent.name;
33
+ const fresh = useFreshLook(actions, step, agentName, onStep && ((text) => onStep(newChatFor(step), text)));
31
34
  useListOnArrival(draft, step, state.plan?.unsaved, viewerCanBuild(state));
32
35
  const hasContent = planningContent(state, page);
33
36
  draft.why = writing
34
- ? t('studio.loop.planning.why.writing', { agent: briefProps(state).product.agent.name })
37
+ ? t('studio.loop.planning.why.writing', { agent: agentName })
35
38
  : stepWaiting(state, page)
36
39
  ? t('studio.loop.planning.why.failed')
37
40
  : !hasContent
@@ -48,5 +51,6 @@ export function usePlanningDraft({ state, page, actions, onStep }) {
48
51
  : 'prototype';
49
52
  const onNext = !draft.why && onStep ? (label) => onStep(newChatFor(next), label) : undefined;
50
53
  const send = onStep && ((label) => onStep(newChatFor(step), label));
54
+ draft.fresh = fresh;
51
55
  return { step, draft, hasContent, writing, onNext, send };
52
56
  }
@@ -24,6 +24,7 @@ export declare function scaleFacts(): {
24
24
  effort?: Partial<Record<"coding" | "design" | "fixes" | "planning" | "tests" | "validation", "auto" | "high" | "low" | "max" | "medium" | "xhigh">> | undefined;
25
25
  level: "auto" | "guide" | "lead" | "review";
26
26
  neverAsk?: boolean | undefined;
27
+ review?: boolean | undefined;
27
28
  } | null;
28
29
  found: {
29
30
  id: "antigravity" | "claude" | "codex" | "cursor" | "grok" | "muse" | "opencode";
@@ -78,7 +79,7 @@ export declare function scaleFacts(): {
78
79
  approved?: {
79
80
  version: number;
80
81
  approval: {
81
- kind: "brand" | "money" | "places" | "plan" | "prototype" | "release";
82
+ kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
82
83
  signatures: {
83
84
  by: string;
84
85
  at: string;
@@ -103,7 +104,7 @@ export declare function scaleFacts(): {
103
104
  pending?: {
104
105
  version: number;
105
106
  approval: {
106
- kind: "brand" | "money" | "places" | "plan" | "prototype" | "release";
107
+ kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
107
108
  signatures: {
108
109
  by: string;
109
110
  at: string;
@@ -128,7 +129,7 @@ export declare function scaleFacts(): {
128
129
  superseded?: {
129
130
  version: number;
130
131
  approval: {
131
- kind: "brand" | "money" | "places" | "plan" | "prototype" | "release";
132
+ kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
132
133
  signatures: {
133
134
  by: string;
134
135
  at: string;
@@ -224,12 +225,13 @@ export declare function scaleFacts(): {
224
225
  planned?: string | undefined;
225
226
  }[];
226
227
  notes: string[];
228
+ surface?: "desktop" | "phone" | undefined;
227
229
  problem?: string | undefined;
228
230
  } | null | undefined;
229
231
  themeDirection?: string | undefined;
230
232
  themeVoice?: string | undefined;
231
233
  brand: {
232
- kind: "brand" | "money" | "places" | "plan" | "prototype" | "release";
234
+ kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
233
235
  signatures: {
234
236
  by: string;
235
237
  at: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buffcore/admin-shell",
3
- "version": "0.8.42",
3
+ "version": "0.8.43",
4
4
  "description": "The React DOM admin console for a BuffCore product, with its prototype viewer.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "BuffApe",
@@ -37,11 +37,11 @@
37
37
  "@tanstack/react-router": "1.170.42",
38
38
  "firebase": "12.19.0",
39
39
  "qrcode": "1.5.4",
40
- "@buffcore/config": "0.8.42",
41
- "@buffcore/contracts": "0.8.42",
42
- "@buffcore/tokens": "0.8.42",
43
- "@buffcore/i18n": "0.8.42",
44
- "@buffcore/sdk": "0.8.42"
40
+ "@buffcore/config": "0.8.43",
41
+ "@buffcore/contracts": "0.8.43",
42
+ "@buffcore/i18n": "0.8.43",
43
+ "@buffcore/sdk": "0.8.43",
44
+ "@buffcore/tokens": "0.8.43"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "react": ">=19",