@buffcore/admin-shell 0.8.42 → 0.8.44

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 (84) 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.d.ts +2 -0
  6. package/dist/workbench/app/ServedPrototype.js +15 -1
  7. package/dist/workbench/app/__snapshots__/places-dom.test.tsx.snap +30 -3
  8. package/dist/workbench/app/actions.d.ts +7 -0
  9. package/dist/workbench/app/actions.js +1 -0
  10. package/dist/workbench/app/chat-session.d.ts +2 -0
  11. package/dist/workbench/app/chat.d.ts +2 -0
  12. package/dist/workbench/app/frame.js +5 -1
  13. package/dist/workbench/app/fresh.d.ts +63 -0
  14. package/dist/workbench/app/fresh.js +66 -0
  15. package/dist/workbench/app/pages.js +10 -2
  16. package/dist/workbench/app/places.d.ts +1 -1
  17. package/dist/workbench/app/prototype-comp.d.ts +46 -0
  18. package/dist/workbench/app/prototype-comp.js +77 -0
  19. package/dist/workbench/app/prototype.d.ts +1 -1
  20. package/dist/workbench/app/prototype.js +3 -1
  21. package/dist/workbench/app/test/loop-fixture.d.ts +15 -8
  22. package/dist/workbench/app/useStudio.d.ts +43 -1
  23. package/dist/workbench/app/useStudio.js +8 -1
  24. package/dist/workbench/app/work.d.ts +7 -7
  25. package/dist/workbench/studio/frame/Composer.js +13 -10
  26. package/dist/workbench/studio/frame/LimitCard.d.ts +5 -0
  27. package/dist/workbench/studio/frame/LimitCard.js +26 -0
  28. package/dist/workbench/studio/frame/PanelMessage.js +3 -0
  29. package/dist/workbench/studio/frame/SettingsSheet.js +10 -9
  30. package/dist/workbench/studio/frame/StudioFrame.js +4 -3
  31. package/dist/workbench/studio/frame/panelLines.d.ts +1 -0
  32. package/dist/workbench/studio/frame/panelLines.js +2 -1
  33. package/dist/workbench/studio/frame/scrollbars.d.ts +1 -0
  34. package/dist/workbench/studio/frame/scrollbars.js +10 -0
  35. package/dist/workbench/studio/frame/useTurnDraft.d.ts +2 -0
  36. package/dist/workbench/studio/frame/useTurnDraft.js +12 -9
  37. package/dist/workbench/studio/i18n/comp.en.d.ts +26 -0
  38. package/dist/workbench/studio/i18n/comp.en.js +26 -0
  39. package/dist/workbench/studio/i18n/comp.es.d.ts +26 -0
  40. package/dist/workbench/studio/i18n/comp.es.js +25 -0
  41. package/dist/workbench/studio/i18n/frame.en.d.ts +16 -0
  42. package/dist/workbench/studio/i18n/frame.en.js +16 -0
  43. package/dist/workbench/studio/i18n/frame.es.json +17 -1
  44. package/dist/workbench/studio/i18n/fresh.en.d.ts +19 -0
  45. package/dist/workbench/studio/i18n/fresh.en.js +20 -0
  46. package/dist/workbench/studio/i18n/fresh.es.json +18 -0
  47. package/dist/workbench/studio/i18n/index.js +6 -0
  48. package/dist/workbench/studio/loop/AgentsPage.d.ts +4 -1
  49. package/dist/workbench/studio/loop/AgentsPage.js +5 -4
  50. package/dist/workbench/studio/loop/CritiqueNote.d.ts +4 -0
  51. package/dist/workbench/studio/loop/CritiqueNote.js +9 -0
  52. package/dist/workbench/studio/loop/FreshLookPanel.d.ts +21 -0
  53. package/dist/workbench/studio/loop/FreshLookPanel.js +60 -0
  54. package/dist/workbench/studio/loop/PrototypeApp.d.ts +9 -0
  55. package/dist/workbench/studio/loop/PrototypeApp.js +6 -4
  56. package/dist/workbench/studio/loop/PrototypeAttempt.d.ts +2 -1
  57. package/dist/workbench/studio/loop/PrototypeAttempt.js +40 -16
  58. package/dist/workbench/studio/loop/PrototypeComp.d.ts +25 -0
  59. package/dist/workbench/studio/loop/PrototypeComp.js +78 -0
  60. package/dist/workbench/studio/loop/PrototypePage.d.ts +7 -0
  61. package/dist/workbench/studio/loop/PrototypePage.js +1 -1
  62. package/dist/workbench/studio/loop/PrototypePreview.js +34 -29
  63. package/dist/workbench/studio/loop/PrototypeSimplePage.js +11 -4
  64. package/dist/workbench/studio/loop/PrototypeSnapshot.d.ts +3 -0
  65. package/dist/workbench/studio/loop/PrototypeSnapshot.js +2 -1
  66. package/dist/workbench/studio/loop/ReviewSetting.d.ts +6 -0
  67. package/dist/workbench/studio/loop/ReviewSetting.js +14 -0
  68. package/dist/workbench/studio/loop/SaveStep.d.ts +3 -0
  69. package/dist/workbench/studio/loop/SaveStep.js +3 -1
  70. package/dist/workbench/studio/loop/ServedPlanning.js +1 -1
  71. package/dist/workbench/studio/loop/StructurePage.d.ts +5 -0
  72. package/dist/workbench/studio/loop/StructurePage.js +3 -2
  73. package/dist/workbench/studio/loop/SurfaceChoice.d.ts +7 -0
  74. package/dist/workbench/studio/loop/SurfaceChoice.js +20 -0
  75. package/dist/workbench/studio/loop/prototype-bridge.d.ts +8 -0
  76. package/dist/workbench/studio/loop/prototype-bridge.js +16 -0
  77. package/dist/workbench/studio/loop/prototype-document.d.ts +7 -0
  78. package/dist/workbench/studio/loop/prototype-document.js +78 -2
  79. package/dist/workbench/studio/loop/usePlanningDraft.js +5 -1
  80. package/dist/workbench/studio/loop/usePrototypeFrame.d.ts +3 -1
  81. package/dist/workbench/studio/loop/usePrototypeFrame.js +2 -0
  82. package/dist/workbench/studio/types.d.ts +2 -0
  83. package/dist/workbench/studio/work/work-test-data.d.ts +7 -4
  84. package/package.json +6 -6
@@ -12,6 +12,7 @@ import { Place } from '../frame/Place.js';
12
12
  import { AgentList } from './AgentList.js';
13
13
  import { AgentPolicies } from './AgentPolicies.js';
14
14
  import { Path } from './parts.js';
15
+ import { ReviewSetting } from './ReviewSetting.js';
15
16
  const roleStyle = {
16
17
  display: 'flex',
17
18
  flexWrap: 'wrap',
@@ -87,16 +88,16 @@ function RoleLine({ role, sample, first, onSet, }) {
87
88
  }
88
89
  const help = { ...captionText, fontWeight: 'var(--weight-regular)' };
89
90
  /** Who does what: a job each, validation by a different agent, the default taking over. */
90
- function Setup({ sample, onSet, onChoose, }) {
91
+ function Setup({ sample, onSet, onChoose, review, }) {
91
92
  const t = useT();
92
- return (_jsxs(Panel, { flush: true, title: t('studio.loop.agents.tab.setup'), action: _jsxs("span", { style: captionText, children: [t('studio.loop.agents.savedIn'), " ", _jsx(Path, { children: "plan/agents.md" })] }), children: [_jsx("ul", { onFocus: onChoose, style: { listStyle: 'none', margin: 0, padding: 0, display: 'grid' }, children: sample.roles.map((r, i) => (_jsx(RoleLine, { role: r, sample: sample, first: i === 0, onSet: onSet }, r.id))) }), _jsx(AgentPolicies, {})] }));
93
+ return (_jsxs(Panel, { flush: true, title: t('studio.loop.agents.tab.setup'), action: _jsxs("span", { style: captionText, children: [t('studio.loop.agents.savedIn'), " ", _jsx(Path, { children: "plan/agents.md" })] }), children: [_jsx("ul", { onFocus: onChoose, style: { listStyle: 'none', margin: 0, padding: 0, display: 'grid' }, children: sample.roles.map((r, i) => (_jsx(RoleLine, { role: r, sample: sample, first: i === 0, onSet: onSet }, r.id))) }), review && _jsx(ReviewSetting, { ...review }), _jsx(AgentPolicies, {})] }));
93
94
  }
94
95
  function InstalledAgents({ sample, onSet, onAction, onHelp, }) {
95
96
  const t = useT();
96
97
  const machine = useMachine(sample.product);
97
98
  return (_jsxs(Panel, { title: t('studio.loop.agents.on', { where: machine.short }), children: [_jsx(AgentList, { onHelp: onHelp, onAction: onAction, agents: sample.agents, actions: true, onSet: onSet, contained: sample.contained }), _jsx("p", { style: { ...help, margin: 0 }, children: t('studio.loop.agents.own', { where: machine.short }) })] }));
98
99
  }
99
- export function AgentsPage({ sample, top, onSet, onTab, onAction, onHelp, onChoose, }) {
100
+ export function AgentsPage({ sample, top, onSet, onTab, onAction, onHelp, onChoose, review, }) {
100
101
  const t = useT();
101
102
  const machine = useMachine(sample.product);
102
103
  const chats = t('studio.loop.agents.tab.chats');
@@ -104,5 +105,5 @@ export function AgentsPage({ sample, top, onSet, onTab, onAction, onHelp, onChoo
104
105
  ['setup', t('studio.loop.agents.tab.setup')],
105
106
  ['chats', chats],
106
107
  ] }));
107
- return (_jsxs(Page, { crumbs: [machine.name], title: t('studio.frame.page.agents'), sub: t('studio.loop.agents.lead'), children: [top, onTab && tabs(undefined), _jsx(Place, { id: "tabs:agents" }), _jsx(InstalledAgents, { sample: sample, onSet: onSet, onAction: onAction, onHelp: onHelp }), _jsx(Setup, { sample: sample, onSet: onSet, onChoose: onChoose }), _jsx(Place, { id: "agents.end" })] }));
108
+ return (_jsxs(Page, { crumbs: [machine.name], title: t('studio.frame.page.agents'), sub: t('studio.loop.agents.lead'), children: [top, onTab && tabs(undefined), _jsx(Place, { id: "tabs:agents" }), _jsx(InstalledAgents, { sample: sample, onSet: onSet, onAction: onAction, onHelp: onHelp }), _jsx(Setup, { sample: sample, onSet: onSet, onChoose: onChoose, review: review }), _jsx(Place, { id: "agents.end" })] }));
108
109
  }
@@ -0,0 +1,4 @@
1
+ import type { FreshCritique } from '@buffcore/contracts/workbench';
2
+ export declare function CritiqueNote({ critique }: {
3
+ critique: FreshCritique;
4
+ }): import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useT } from '@buffcore/i18n/react';
3
+ import { Panel } from '../../../components/Panel.js';
4
+ import { captionText } from '../../../components/styles.js';
5
+ import { Path } from './parts.js';
6
+ export function CritiqueNote({ critique }) {
7
+ const t = useT();
8
+ return (_jsxs(Panel, { title: t('studio.fresh.critique.title'), children: [critique.state === 'running' && (_jsx("p", { role: "status", style: { margin: 0 }, children: t('studio.fresh.critique.running') })), critique.state === 'done' && critique.file && (_jsxs("p", { role: "status", style: { margin: 0, overflowWrap: 'anywhere' }, children: [t('studio.fresh.critique.done'), " ", _jsx(Path, { children: critique.file })] })), critique.state === 'failed' && (_jsx("p", { role: "status", style: { margin: 0 }, children: t('studio.fresh.critique.failed') })), critique.seconds !== undefined && (_jsx("p", { style: { ...captionText, fontWeight: 'var(--weight-regular)', margin: 0 }, children: t('studio.fresh.turn', { agent: critique.agent, seconds: critique.seconds }) }))] }));
9
+ }
@@ -0,0 +1,21 @@
1
+ import type { FreshFinding, FreshReview } from '@buffcore/contracts/workbench';
2
+ import type { ReactNode } from 'react';
3
+ export interface FreshLook {
4
+ review: FreshReview;
5
+ /** The step's agent, by name. */
6
+ agent: string;
7
+ /** A finding whose Take could not be sent: the agent was still working. */
8
+ busy?: string;
9
+ onTake?: (finding: FreshFinding) => void;
10
+ onLeave?: (finding: FreshFinding) => void;
11
+ }
12
+ /** Whether there is anything to show: a review running, findings not left, or a clean read. */
13
+ export declare function freshShown(look: FreshLook | undefined): look is FreshLook;
14
+ export declare function FreshLookPanel({ look }: {
15
+ look: FreshLook;
16
+ }): import("react").JSX.Element;
17
+ /** The findings beside Save on a wide page (3 to 2), stacked on a phone. */
18
+ export declare function BesideSave({ look, save }: {
19
+ look: FreshLook;
20
+ save: ReactNode;
21
+ }): import("react").JSX.Element;
@@ -0,0 +1,60 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useT } from '@buffcore/i18n/react';
3
+ import { Button } from '../../../components/Button.js';
4
+ import { Icon } from '../../../components/Icon.js';
5
+ import { Panel } from '../../../components/Panel.js';
6
+ import { bodyText, captionText } from '../../../components/styles.js';
7
+ import { useNarrow } from '../../../use-narrow.js';
8
+ import { NARROW_BELOW } from '../frame/layout.js';
9
+ const control = { minBlockSize: 'var(--control-lg)' };
10
+ /** Whether there is anything to show: a review running, findings not left, or a clean read. */
11
+ export function freshShown(look) {
12
+ const review = look?.review;
13
+ if (!review || review.state === 'failed')
14
+ return false;
15
+ if (review.state === 'running')
16
+ return true;
17
+ return review.findings.length === 0 || review.findings.some((f) => f.answer !== 'left');
18
+ }
19
+ function Finding({ finding, look }) {
20
+ const t = useT();
21
+ return (_jsxs("li", { style: {
22
+ display: 'grid',
23
+ gap: 'var(--space-2)',
24
+ paddingBlockStart: 'var(--space-3)',
25
+ borderBlockStart: 'var(--border-width-hairline) solid var(--border-hairline)',
26
+ }, children: [_jsx("p", { style: { ...bodyText, margin: 0, color: 'var(--text-strong)' }, children: finding.text }), finding.answer === 'taken' ? (_jsxs("p", { role: "status", style: {
27
+ ...captionText,
28
+ margin: 0,
29
+ color: 'var(--success-ink)',
30
+ display: 'flex',
31
+ gap: 'var(--space-2)',
32
+ }, children: [_jsx(Icon, { name: "check", size: "var(--icon-sm)" }), t('studio.fresh.taken')] })) : (_jsxs(_Fragment, { children: [_jsxs("span", { style: { display: 'flex', flexWrap: 'wrap', gap: 'var(--space-2)' }, children: [_jsx(Button, { size: "md", variant: "secondary", style: control, disabled: !look.onTake, onClick: () => look.onTake?.(finding), children: t('studio.fresh.take') }), _jsx(Button, { size: "md", variant: "ghost", style: control, disabled: !look.onLeave, onClick: () => look.onLeave?.(finding), children: t('studio.fresh.leave') })] }), look.busy === finding.id && (_jsx("p", { role: "status", style: { ...captionText, margin: 0 }, children: t('studio.fresh.busy') }))] }))] }));
33
+ }
34
+ export function FreshLookPanel({ look }) {
35
+ const t = useT();
36
+ const { review } = look;
37
+ const shown = review.findings.filter((finding) => finding.answer !== 'left');
38
+ const intro = review.state === 'running'
39
+ ? t('studio.fresh.running')
40
+ : review.findings.length
41
+ ? t('studio.fresh.intro')
42
+ : t('studio.fresh.none');
43
+ return (_jsxs(Panel, { title: t('studio.fresh.title'), children: [_jsx("p", { role: review.state === 'running' ? 'status' : undefined, style: { ...bodyText, margin: 0 }, children: intro }), review.state === 'done' && shown.length > 0 && (_jsx("ul", { style: {
44
+ listStyle: 'none',
45
+ margin: 0,
46
+ padding: 0,
47
+ display: 'grid',
48
+ gap: 'var(--space-3)',
49
+ }, children: shown.map((finding) => (_jsx(Finding, { finding: finding, look: look }, finding.id))) })), review.seconds !== undefined && (_jsx("p", { style: { ...captionText, fontWeight: 'var(--weight-regular)', margin: 0 }, children: t('studio.fresh.turn', { agent: look.agent, seconds: review.seconds }) }))] }));
50
+ }
51
+ /** The findings beside Save on a wide page (3 to 2), stacked on a phone. */
52
+ export function BesideSave({ look, save }) {
53
+ const phone = useNarrow(NARROW_BELOW);
54
+ return (_jsxs("div", { style: {
55
+ display: 'grid',
56
+ gap: 'var(--space-4)',
57
+ alignItems: 'start',
58
+ gridTemplateColumns: phone ? 'minmax(0, 1fr)' : 'minmax(0, 3fr) minmax(0, 2fr)',
59
+ }, children: [_jsx(FreshLookPanel, { look: look }), _jsx("div", { style: { display: 'grid', gap: 'var(--space-4)', minInlineSize: 0 }, children: save })] }));
60
+ }
@@ -13,7 +13,16 @@ export interface PrototypeAppProps {
13
13
  previewIdentity?: string;
14
14
  product: string;
15
15
  onDev?: () => void;
16
+ /** A journey Play asked for on another page: selected at its first step once the app lists it. */
17
+ play?: PlayRequest;
18
+ /** The request was taken (or another choice was made), so it is not played again. */
19
+ onPlayed?: () => void;
16
20
  }
21
+ /** A planned journey: the app's journey with this key, or else with this title, is played. */
22
+ export type PlayRequest = {
23
+ id: string;
24
+ name?: string;
25
+ };
17
26
  export type Props = PrototypeAppProps & {
18
27
  reviewPanel?: (ready: boolean, snapshotOk: boolean) => ReactNode;
19
28
  preview?: {
@@ -83,14 +83,16 @@ function PlayableApp(props) {
83
83
  const container = useRef(null);
84
84
  if (!navigation)
85
85
  return _jsx(UnavailablePreview, { ...props, status: "loading" });
86
- const navigate = (choice) => {
86
+ const navigate = (choice, shown) => {
87
87
  setRestore(false);
88
+ props.onPlayed?.();
88
89
  if (identity && selection)
89
90
  selection.current = { identity, choice };
90
- setNavigation({ ...choice, id: prototypeNavigationId() });
91
+ // A choice the running app was told keeps the document (no reload); any other loads anew.
92
+ setNavigation({ ...choice, id: shown ? navigation.id : prototypeNavigationId() });
91
93
  };
92
- return (_jsx("div", { ref: container, style: { display: 'contents' }, children: _jsx(PrototypeAttempt, { ...props, address: asGiven ? props.given : props.address, onSwitch: useGivenAddress, navigation: navigation, onNavigate: (choice) => {
93
- navigate(choice);
94
+ return (_jsx("div", { ref: container, style: { display: 'contents' }, children: _jsx(PrototypeAttempt, { ...props, address: asGiven ? props.given : props.address, onSwitch: useGivenAddress, navigation: navigation, onNavigate: (choice, shown) => {
95
+ navigate(choice, shown);
94
96
  if (!props.preview)
95
97
  container.current
96
98
  ?.querySelector('[data-section="app"]')
@@ -1,6 +1,7 @@
1
1
  import type { Choice, LoadedProps, Navigation } from './PrototypeApp.tsx';
2
2
  export declare function PrototypeAttempt({ navigation, onNavigate, onSwitch, ...props }: LoadedProps & {
3
3
  navigation: Navigation;
4
- onNavigate: (choice: Choice) => void;
4
+ /** `shown`: the running app was told by a message, so the frame keeps its document. */
5
+ onNavigate: (choice: Choice, shown: boolean) => void;
5
6
  onSwitch: () => void;
6
7
  }): import("react").JSX.Element;
@@ -1,37 +1,61 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useMemo } from 'react';
2
3
  import { groupJourneys } from './ProtoJourneys.js';
3
4
  import { PrototypeAppFrame } from './PrototypeAppFrame.js';
4
5
  import { PrototypeAppView } from './PrototypeAppView.js';
5
6
  import { PrototypePreview } from './PrototypePreview.js';
6
7
  import { usePrototypeFrame } from './usePrototypeFrame.js';
7
8
  export function PrototypeAttempt({ navigation, onNavigate, onSwitch, ...props }) {
8
- const search = new URLSearchParams({
9
- embed: '1',
10
- apeNav: navigation.id,
11
- locale: props.locale,
12
- mode: props.mode,
13
- ...(navigation.journey ? { journey: navigation.journey.key } : {}),
14
- ...(props.preview ? { studioPreview: '1' } : {}),
15
- ...(props.preview && navigation.journey ? { stepCaption: '1' } : {}),
16
- ...(navigation.step !== undefined ? { step: String(navigation.step) } : {}),
17
- ...(navigation.data ? { data: navigation.data } : {}),
18
- }).toString();
19
- const url = new URL(props.address);
20
- url.search = search;
21
- const model = usePrototypeFrame(url.origin, navigation.id, props.address !== props.given ? onSwitch : undefined,
9
+ const model = usePrototypeFrame(new URL(props.address).origin, navigation.id, props.address !== props.given ? onSwitch : undefined,
22
10
  // One missed probe is not "not running" while the app answered lately.
23
11
  props.running === false && props.snapshotReady ? undefined : props.running);
12
+ // The address is fixed for each document the frame loads (a navigation, or a retry of it), with
13
+ // the choice of that moment; a later choice the running app was told leaves it, so no reload.
14
+ const previewing = !!props.preview;
15
+ // biome-ignore lint/correctness/useExhaustiveDependencies: a new document takes the current choice
16
+ const url = useMemo(() => frameAddress(props, navigation, previewing), [props.address, props.locale, props.mode, previewing, navigation.id, model.frameKey]);
24
17
  const ready = model.journeys !== undefined;
18
+ // In the studio's preview a running app is told the choice; elsewhere the frame reloads with it.
19
+ const go = (choice) => onNavigate(choice, !!props.preview &&
20
+ model.show({ journey: choice.journey?.key, step: choice.step, data: choice.data }));
25
21
  const play = (key) => {
26
22
  const journey = model.journeys?.find((candidate) => candidate.key === key);
27
23
  if (journey && model.alive())
28
- onNavigate({ journey, overlay: model.preview !== undefined });
24
+ go({ journey, overlay: model.preview !== undefined });
29
25
  };
26
+ // Play on another page: once the running app lists its journeys, that one starts at step 1.
27
+ const asked = props.play;
28
+ const listed = model.journeys;
29
+ // biome-ignore lint/correctness/useExhaustiveDependencies: once per request and journey list
30
+ useEffect(() => {
31
+ if (!asked || !listed || !model.alive())
32
+ return;
33
+ const journey = listed.find((candidate) => candidate.key === asked.id) ??
34
+ listed.find((candidate) => !!asked.name && candidate.title === asked.name);
35
+ if (journey)
36
+ go({ journey, step: 0, overlay: model.preview !== undefined });
37
+ else
38
+ props.onPlayed?.();
39
+ }, [asked, listed]);
30
40
  const app = (_jsx(PrototypeAppFrame, { frame: model.frame, url: url.href, href: props.href, product: props.product, ready: ready, enlarged: !!navigation.journey, failure: model.failure, recoverable: model.recoverable, onDev: props.onDev, cause: model.cause, fill: !!props.preview }, model.frameKey));
31
41
  if (props.preview)
32
- return (_jsx(LivePreview, { ...props, preview: props.preview, app, model, navigation, onNavigate, play }));
42
+ return (_jsx(LivePreview, { ...props, preview: props.preview, app, model, navigation, play, onNavigate: go }));
33
43
  return (_jsx(PrototypeAppView, { title: props.product, href: props.href, ready: ready, journeys: model.journeys ?? [], left: model.left, onPlay: play, onSignInHelp: () => model.fail('cookies'), app: app, reviewPanel: props.reviewPanel?.(ready, true) }));
34
44
  }
45
+ function frameAddress(props, navigation, previewing) {
46
+ const url = new URL(props.address);
47
+ url.search = new URLSearchParams({
48
+ embed: '1',
49
+ apeNav: navigation.id,
50
+ locale: props.locale,
51
+ mode: props.mode,
52
+ ...(navigation.journey ? { journey: navigation.journey.key } : {}),
53
+ ...(previewing ? { studioPreview: '1', stepCaption: '1' } : {}),
54
+ ...(navigation.step !== undefined ? { step: String(navigation.step) } : {}),
55
+ ...(navigation.data ? { data: navigation.data } : {}),
56
+ }).toString();
57
+ return url;
58
+ }
35
59
  function LivePreview({ app, product, href, preview, model, navigation, onNavigate, play, }) {
36
60
  const ready = model.journeys !== undefined;
37
61
  const journeys = model.journeys ?? [];
@@ -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;
@@ -29,41 +29,47 @@ export function PrototypePreview({ app, play, ...props }) {
29
29
  gridTemplateRows: 'auto minmax(0, 1fr)',
30
30
  minBlockSize: 0,
31
31
  minInlineSize: 0,
32
- }, children: [_jsx("style", { children: previewBorder }), _jsx(PreviewToolbar, { ...props, narrow: narrow }), _jsx("div", { style: {
32
+ }, children: [_jsx("style", { children: previewBorder }), _jsx(PreviewToolbar, { ...props, narrow: narrow }), _jsxs("div", { style: {
33
33
  display: 'grid',
34
- gridTemplate: 'minmax(0, 1fr) / minmax(0, 1fr)',
34
+ gridTemplateRows: play
35
+ ? `${desktop ? 'minmax(0, auto)' : 'minmax(0, 1fr)'} auto`
36
+ : 'minmax(0, 1fr)',
37
+ gridTemplateColumns: 'minmax(0, 1fr)',
38
+ alignContent: 'start',
35
39
  justifyItems: 'center',
40
+ rowGap: 'var(--space-2)',
36
41
  minBlockSize: 0,
37
42
  padding: narrow ? 0 : 'var(--space-3)',
38
- }, children: _jsxs("section", { "data-preview-device": narrow ? 'unframed' : props.device, "aria-label": t('simple.frame'), style: {
39
- position: 'relative',
40
- boxSizing: 'border-box',
41
- minBlockSize: 0,
42
- minInlineSize: 0,
43
- blockSize: desktop ? 'auto' : '100%',
44
- maxBlockSize: '100%',
45
- maxInlineSize: '100%',
46
- inlineSize: narrow || desktop ? '100%' : undefined,
47
- alignSelf: desktop ? 'start' : undefined,
48
- aspectRatio: narrow
49
- ? undefined
50
- : desktop
51
- ? '16 / 10'
52
- : props.device === 'tablet'
53
- ? '3 / 4'
54
- : '9 / 19',
55
- overflow: 'hidden',
56
- background: 'var(--surface-canvas)',
57
- }, children: [_jsx("div", { style: { blockSize: '100%', overflow: 'auto' }, children: app }), play && _jsx(PreviewPlayer, { ...play })] }) })] }));
43
+ }, children: [_jsx("section", { "data-preview-device": narrow ? 'unframed' : props.device, "aria-label": t('simple.frame'), style: {
44
+ position: 'relative',
45
+ boxSizing: 'border-box',
46
+ minBlockSize: 0,
47
+ minInlineSize: 0,
48
+ blockSize: desktop ? 'auto' : '100%',
49
+ maxBlockSize: '100%',
50
+ maxInlineSize: '100%',
51
+ inlineSize: narrow || desktop ? '100%' : undefined,
52
+ alignSelf: desktop ? 'start' : undefined,
53
+ aspectRatio: narrow
54
+ ? undefined
55
+ : desktop
56
+ ? '16 / 10'
57
+ : props.device === 'tablet'
58
+ ? '3 / 4'
59
+ : '9 / 19',
60
+ overflow: 'hidden',
61
+ background: 'var(--surface-canvas)',
62
+ }, children: _jsx("div", { style: { blockSize: '100%', overflow: 'auto' }, children: app }) }), play && _jsx(PreviewPlayer, { ...play, narrow: narrow })] })] }));
58
63
  }
59
- function PreviewPlayer({ step, total, caption, pending, onStep }) {
64
+ function PreviewPlayer({ step, total, caption, pending, onStep, narrow, }) {
60
65
  const t = useT();
61
66
  const { locale } = useLocale();
62
67
  const rtl = isRtl(locale);
63
- return (_jsxs("section", { "data-prototype-focus-group": true, "aria-label": t('simple.player'), style: {
64
- position: 'absolute',
65
- insetInline: 'var(--space-3)',
66
- insetBlockEnd: 'var(--space-3)',
68
+ return (_jsxs("section", { "data-prototype-focus-group": true, "aria-label": t('simple.player'), "data-preview-player": true, style: {
69
+ boxSizing: 'border-box',
70
+ inlineSize: narrow ? 'calc(100% - var(--space-4))' : '100%',
71
+ maxInlineSize: 'calc(var(--space-6) * 24)',
72
+ marginBlockEnd: narrow ? 'var(--space-2)' : 0,
67
73
  display: 'grid',
68
74
  gridTemplateColumns: 'auto minmax(0, 1fr) auto',
69
75
  alignItems: 'center',
@@ -71,8 +77,7 @@ function PreviewPlayer({ step, total, caption, pending, onStep }) {
71
77
  padding: 'var(--space-2)',
72
78
  background: 'var(--surface-panel)',
73
79
  border: 'var(--border-width-hairline) solid var(--border-default)',
74
- borderRadius: 'var(--radius-overlay)',
75
- boxShadow: 'var(--shadow-overlay)',
80
+ borderRadius: 'var(--radius-panel)',
76
81
  }, children: [_jsx(Button, { variant: "secondary", icon: rtl ? 'chevron-right' : 'chevron-left', disabled: step === 0, "aria-disabled": pending || undefined, onClick: () => {
77
82
  if (!pending)
78
83
  onStep(step - 1);
@@ -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 }: {