@buffcore/admin-shell 0.8.41 → 0.8.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/dist/admin.js +2 -1
  2. package/dist/components/Button.d.ts +2 -2
  3. package/dist/components/Button.js +7 -2
  4. package/dist/components/DeviceFrame.d.ts +6 -1
  5. package/dist/components/DeviceFrame.js +2 -2
  6. package/dist/components/look.d.ts +5 -0
  7. package/dist/components/look.js +5 -0
  8. package/dist/console-settings.js +4 -1
  9. package/dist/design-fonts.d.ts +5 -0
  10. package/dist/design-fonts.js +20 -0
  11. package/dist/prototype/PageLook.js +3 -2
  12. package/dist/prototype/create.d.ts +3 -1
  13. package/dist/prototype/create.js +0 -1
  14. package/dist/prototype/page.d.ts +19 -2
  15. package/dist/prototype/page.js +20 -2
  16. package/dist/prototype/shown.js +1 -1
  17. package/dist/prototype/viewer.d.ts +2 -0
  18. package/dist/prototype/viewer.js +6 -2
  19. package/dist/screens/assistant/use-ask.d.ts +4 -3
  20. package/dist/workbench/app/ServedAgents.js +4 -1
  21. package/dist/workbench/app/ServedComp.d.ts +3 -0
  22. package/dist/workbench/app/ServedComp.js +33 -0
  23. package/dist/workbench/app/ServedPrototype.js +28 -1
  24. package/dist/workbench/app/StudioApp.js +29 -20
  25. package/dist/workbench/app/actions.d.ts +10 -1
  26. package/dist/workbench/app/actions.js +9 -2
  27. package/dist/workbench/app/ask-card.d.ts +10 -0
  28. package/dist/workbench/app/ask-card.js +34 -0
  29. package/dist/workbench/app/chat-session.d.ts +34 -0
  30. package/dist/workbench/app/chat.d.ts +39 -0
  31. package/dist/workbench/app/frame.js +4 -2
  32. package/dist/workbench/app/fresh.d.ts +63 -0
  33. package/dist/workbench/app/fresh.js +66 -0
  34. package/dist/workbench/app/host-part-loader.d.ts +5 -2
  35. package/dist/workbench/app/host-part-module.d.ts +17 -0
  36. package/dist/workbench/app/host-part-module.js +55 -0
  37. package/dist/workbench/app/host-parts.d.ts +2 -11
  38. package/dist/workbench/app/host-parts.js +53 -67
  39. package/dist/workbench/app/level-choice.d.ts +3 -0
  40. package/dist/workbench/app/mount.d.ts +4 -1
  41. package/dist/workbench/app/mount.js +2 -2
  42. package/dist/workbench/app/panel-cards.d.ts +3 -3
  43. package/dist/workbench/app/panel-cards.js +3 -2
  44. package/dist/workbench/app/places.d.ts +18 -3
  45. package/dist/workbench/app/places.js +14 -2
  46. package/dist/workbench/app/prototype-comp.d.ts +46 -0
  47. package/dist/workbench/app/prototype-comp.js +77 -0
  48. package/dist/workbench/app/prototype.d.ts +1 -1
  49. package/dist/workbench/app/prototype.js +3 -1
  50. package/dist/workbench/app/scene-address.d.ts +10 -0
  51. package/dist/workbench/app/scene-address.js +14 -0
  52. package/dist/workbench/app/studio-post.js +1 -0
  53. package/dist/workbench/app/test/loop-fixture.d.ts +35 -8
  54. package/dist/workbench/app/usePrototypeUi.js +14 -0
  55. package/dist/workbench/app/useStudio.d.ts +43 -1
  56. package/dist/workbench/app/useStudio.js +8 -1
  57. package/dist/workbench/host-theme.d.ts +3 -0
  58. package/dist/workbench/host-theme.js +14 -0
  59. package/dist/workbench/index.d.ts +1 -0
  60. package/dist/workbench/index.js +1 -0
  61. package/dist/workbench/studio/frame/HostRailEntries.d.ts +3 -0
  62. package/dist/workbench/studio/frame/HostRailEntries.js +15 -0
  63. package/dist/workbench/studio/frame/HostSide.d.ts +6 -0
  64. package/dist/workbench/studio/frame/HostSide.js +31 -0
  65. package/dist/workbench/studio/frame/LevelChip.js +2 -1
  66. package/dist/workbench/studio/frame/LevelChoices.js +24 -8
  67. package/dist/workbench/studio/frame/LimitCard.d.ts +5 -0
  68. package/dist/workbench/studio/frame/LimitCard.js +26 -0
  69. package/dist/workbench/studio/frame/NeverAskSetting.d.ts +7 -0
  70. package/dist/workbench/studio/frame/NeverAskSetting.js +24 -0
  71. package/dist/workbench/studio/frame/PanelList.js +5 -2
  72. package/dist/workbench/studio/frame/PanelMessage.js +3 -0
  73. package/dist/workbench/studio/frame/PanelNotice.js +2 -1
  74. package/dist/workbench/studio/frame/PanelScenes.d.ts +5 -0
  75. package/dist/workbench/studio/frame/PanelScenes.js +38 -0
  76. package/dist/workbench/studio/frame/PermissionAskCard.d.ts +18 -0
  77. package/dist/workbench/studio/frame/PermissionAskCard.js +60 -0
  78. package/dist/workbench/studio/frame/PermissionAskFold.d.ts +12 -0
  79. package/dist/workbench/studio/frame/PermissionAskFold.js +54 -0
  80. package/dist/workbench/studio/frame/Place.d.ts +6 -2
  81. package/dist/workbench/studio/frame/Place.js +13 -5
  82. package/dist/workbench/studio/frame/SettingsSheet.js +6 -1
  83. package/dist/workbench/studio/frame/StudioRail.js +2 -1
  84. package/dist/workbench/studio/frame/panelControls.d.ts +17 -0
  85. package/dist/workbench/studio/frame/panelLines.d.ts +1 -0
  86. package/dist/workbench/studio/frame/panelLines.js +2 -1
  87. package/dist/workbench/studio/i18n/comp.en.d.ts +26 -0
  88. package/dist/workbench/studio/i18n/comp.en.js +26 -0
  89. package/dist/workbench/studio/i18n/comp.es.d.ts +26 -0
  90. package/dist/workbench/studio/i18n/comp.es.js +25 -0
  91. package/dist/workbench/studio/i18n/frame.en.d.ts +39 -0
  92. package/dist/workbench/studio/i18n/frame.en.js +39 -0
  93. package/dist/workbench/studio/i18n/frame.es.json +40 -1
  94. package/dist/workbench/studio/i18n/fresh.en.d.ts +19 -0
  95. package/dist/workbench/studio/i18n/fresh.en.js +20 -0
  96. package/dist/workbench/studio/i18n/fresh.es.json +18 -0
  97. package/dist/workbench/studio/i18n/index.js +6 -0
  98. package/dist/workbench/studio/i18n/levels.en.d.ts +5 -0
  99. package/dist/workbench/studio/i18n/levels.en.js +5 -0
  100. package/dist/workbench/studio/i18n/levels.es.json +6 -1
  101. package/dist/workbench/studio/i18n/loop.en.d.ts +4 -0
  102. package/dist/workbench/studio/i18n/loop.en.js +4 -0
  103. package/dist/workbench/studio/i18n/loop.es.json +4 -0
  104. package/dist/workbench/studio/i18n/save.en.d.ts +1 -3
  105. package/dist/workbench/studio/i18n/save.en.js +13 -15
  106. package/dist/workbench/studio/i18n/save.es.json +14 -16
  107. package/dist/workbench/studio/i18n/structure.en.d.ts +6 -0
  108. package/dist/workbench/studio/i18n/structure.en.js +6 -0
  109. package/dist/workbench/studio/i18n/structure.es.d.ts +6 -0
  110. package/dist/workbench/studio/i18n/structure.es.js +6 -0
  111. package/dist/workbench/studio/loop/AgentsPage.d.ts +4 -1
  112. package/dist/workbench/studio/loop/AgentsPage.js +5 -4
  113. package/dist/workbench/studio/loop/CritiqueNote.d.ts +4 -0
  114. package/dist/workbench/studio/loop/CritiqueNote.js +9 -0
  115. package/dist/workbench/studio/loop/FreshLookPanel.d.ts +21 -0
  116. package/dist/workbench/studio/loop/FreshLookPanel.js +60 -0
  117. package/dist/workbench/studio/loop/PrototypeComp.d.ts +25 -0
  118. package/dist/workbench/studio/loop/PrototypeComp.js +78 -0
  119. package/dist/workbench/studio/loop/PrototypePage.d.ts +7 -0
  120. package/dist/workbench/studio/loop/PrototypePage.js +4 -3
  121. package/dist/workbench/studio/loop/PrototypeScenes.js +1 -2
  122. package/dist/workbench/studio/loop/PrototypeSimplePage.js +15 -7
  123. package/dist/workbench/studio/loop/PrototypeSnapshot.d.ts +3 -0
  124. package/dist/workbench/studio/loop/PrototypeSnapshot.js +7 -2
  125. package/dist/workbench/studio/loop/ReviewSetting.d.ts +6 -0
  126. package/dist/workbench/studio/loop/ReviewSetting.js +14 -0
  127. package/dist/workbench/studio/loop/ReviewedSave.d.ts +1 -1
  128. package/dist/workbench/studio/loop/ReviewedSave.js +2 -10
  129. package/dist/workbench/studio/loop/SaveStep.d.ts +3 -0
  130. package/dist/workbench/studio/loop/SaveStep.js +3 -1
  131. package/dist/workbench/studio/loop/ServedBrand.js +3 -3
  132. package/dist/workbench/studio/loop/ServedPlanning.js +1 -1
  133. package/dist/workbench/studio/loop/StructurePage.d.ts +7 -0
  134. package/dist/workbench/studio/loop/StructurePage.js +3 -2
  135. package/dist/workbench/studio/loop/StructurePreview.js +4 -4
  136. package/dist/workbench/studio/loop/StructurePrompts.js +9 -4
  137. package/dist/workbench/studio/loop/SurfaceChoice.d.ts +7 -0
  138. package/dist/workbench/studio/loop/SurfaceChoice.js +20 -0
  139. package/dist/workbench/studio/loop/step-state.d.ts +1 -1
  140. package/dist/workbench/studio/loop/step-state.js +9 -8
  141. package/dist/workbench/studio/loop/structure-answers.d.ts +8 -0
  142. package/dist/workbench/studio/loop/structure-answers.js +34 -0
  143. package/dist/workbench/studio/loop/usePlanningDraft.js +7 -2
  144. package/dist/workbench/studio/loop/usePlanningSave.d.ts +16 -2
  145. package/dist/workbench/studio/loop/usePlanningSave.js +40 -2
  146. package/dist/workbench/studio/loop/usePrototypeRecord.js +5 -4
  147. package/dist/workbench/studio/loop/useReviewedSave.d.ts +9 -4
  148. package/dist/workbench/studio/loop/useReviewedSave.js +89 -30
  149. package/dist/workbench/studio/run/LiveServers.js +1 -1
  150. package/dist/workbench/studio/run/ReleasePage.js +1 -1
  151. package/dist/workbench/studio/run/ReleasesPage.js +2 -2
  152. package/dist/workbench/studio/run/ServedRelease.js +1 -1
  153. package/dist/workbench/studio/work/work-test-data.d.ts +9 -4
  154. package/package.json +6 -6
  155. package/vite.d.ts +6 -1
  156. package/vite.js +78 -5
package/dist/admin.js CHANGED
@@ -11,6 +11,7 @@ import { PageModeContext, resolvePageMode } from './appearance.js';
11
11
  import { BASE_CSS } from './base-css.js';
12
12
  import { builderSwitches } from './components/EnvBadge.js';
13
13
  import { coreSections, overviewSection } from './core-sections.js';
14
+ import { designFontCss } from './design-fonts.js';
14
15
  import { inRailOrder, withExtensions } from './extensions.js';
15
16
  import { adminCatalog } from './i18n/index.js';
16
17
  import { placeScreens } from './registry.js';
@@ -127,7 +128,7 @@ export function createAdmin(options) {
127
128
  const narrow = useNarrow(PHONE_BELOW);
128
129
  const [railCollapsed, setRail] = useState(() => railStartsCollapsed(stored.get('rail'), narrow));
129
130
  const theme = themeChoices.find((th) => th.key === themeKey) ?? productTheme;
130
- const css = useMemo(() => toCss(theme) + BASE_CSS, [theme]);
131
+ const css = useMemo(() => toCss(theme) + BASE_CSS + designFontCss(theme), [theme]);
131
132
  // Uncaught errors and unhandled rejections go to the errors module.
132
133
  useEffect(() => {
133
134
  const where = () => screenAt(location.pathname) ?? location.pathname;
@@ -1,4 +1,4 @@
1
- import type { ButtonHTMLAttributes, CSSProperties } from 'react';
1
+ import { type ButtonHTMLAttributes, type CSSProperties } from 'react';
2
2
  import type { IconName } from './icons.ts';
3
3
  declare const SIZES: {
4
4
  readonly sm: {
@@ -31,5 +31,5 @@ export interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement
31
31
  style?: CSSProperties;
32
32
  }
33
33
  /** One primary Button per screen, at the end of the action bar. Labels are verbs. */
34
- export declare function Button({ variant, size, icon, iconEnd, loading, disabled, fullWidth, type, onClick, children, style, ...rest }: ButtonProps): import("react").JSX.Element;
34
+ export declare function Button({ variant: asked, size, icon, iconEnd, loading, disabled, fullWidth, type, onClick, children, style, ...rest }: ButtonProps): import("react").JSX.Element;
35
35
  export {};
@@ -1,7 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // Button. Ported from BuffCore's design system. Components read only semantic tokens; every word is a prop
3
+ // or comes through t().
4
+ import { useContext } from 'react';
2
5
  import { Icon } from './Icon.js';
3
6
  import { focusRing, useInteraction } from './interaction.js';
4
- import { useStudioLook } from './look.js';
7
+ import { QuietPrimary, useStudioLook } from './look.js';
5
8
  const SIZES = {
6
9
  sm: {
7
10
  h: 'var(--control-sm)',
@@ -23,9 +26,11 @@ const SIZES = {
23
26
  },
24
27
  };
25
28
  /** One primary Button per screen, at the end of the action bar. Labels are verbs. */
26
- export function Button({ variant = 'primary', size = 'md', icon, iconEnd, loading = false, disabled = false, fullWidth = false, type = 'button', onClick, children, style, ...rest }) {
29
+ export function Button({ variant: asked = 'primary', size = 'md', icon, iconEnd, loading = false, disabled = false, fullWidth = false, type = 'button', onClick, children, style, ...rest }) {
27
30
  const [st, h] = useInteraction();
28
31
  const studio = useStudioLook();
32
+ const quietPrimary = useContext(QuietPrimary);
33
+ const variant = asked === 'primary' && quietPrimary ? 'secondary' : asked;
29
34
  const z = SIZES[size];
30
35
  const off = disabled || loading;
31
36
  const look = {
@@ -8,7 +8,12 @@ export interface DeviceFrameProps {
8
8
  title: string;
9
9
  /** The page's `window.name`; a new name loads the page again. */
10
10
  name?: string;
11
+ /** The product's size for this frame (`frameSizes`); omitted, the preset's. */
12
+ size?: {
13
+ width: number;
14
+ height: number;
15
+ };
11
16
  /** Studio tablet viewport; omitted keeps the existing configured frame size. */
12
17
  orientation?: 'portrait' | 'landscape';
13
18
  }
14
- export declare function DeviceFrame({ src, frame, title, name, orientation }: DeviceFrameProps): import("react").JSX.Element;
19
+ export declare function DeviceFrame({ src, frame, size, title, name, orientation }: DeviceFrameProps): import("react").JSX.Element;
@@ -5,7 +5,7 @@ import { FRAME_SIZES } from '@buffcore/config';
5
5
  import { useContext, useEffect, useRef, useState } from 'react';
6
6
  import { FrameIsolation, isolatedFrameAllowed } from './frame-isolation.js';
7
7
  import { panelSurface } from './styles.js';
8
- export function DeviceFrame({ src, frame, title, name, orientation }) {
8
+ export function DeviceFrame({ src, frame, size, title, name, orientation }) {
9
9
  const isolated = useContext(FrameIsolation);
10
10
  const box = useRef(null);
11
11
  const [room, setRoom] = useState();
@@ -21,7 +21,7 @@ export function DeviceFrame({ src, frame, title, name, orientation }) {
21
21
  ? orientation === 'landscape'
22
22
  ? { width: 1024, height: 768 }
23
23
  : { width: 768, height: 1024 }
24
- : FRAME_SIZES[frame];
24
+ : (size ?? FRAME_SIZES[frame]);
25
25
  const scale = room ? Math.min(1, room / width) : 1;
26
26
  return (_jsx("div", { ref: box, style: { inlineSize: '100%', minInlineSize: 0 }, children: _jsx("div", { dir: "ltr", style: {
27
27
  ...panelSurface,
@@ -6,6 +6,11 @@ export declare const StudioLook: import("react").Context<{
6
6
  export declare const useStudioLook: () => {
7
7
  narrow: boolean;
8
8
  } | null;
9
+ /**
10
+ * True while something else on the screen waits for the person's answer (the agent's permission
11
+ * card): the page's own primary buttons draw as secondary, so the one primary is the answer.
12
+ */
13
+ export declare const QuietPrimary: import("react").Context<boolean>;
9
14
  /** The small line above a title: mono capitals, as the studio's design draws it. */
10
15
  export declare const studioEyebrow: {
11
16
  readonly fontFamily: 'var(--font-mono)';
@@ -5,6 +5,11 @@ import { panelSurface } from './styles.js';
5
5
  /** Null in a product console; in the studio, whether its page has a phone's width. */
6
6
  export const StudioLook = createContext(null);
7
7
  export const useStudioLook = () => useContext(StudioLook);
8
+ /**
9
+ * True while something else on the screen waits for the person's answer (the agent's permission
10
+ * card): the page's own primary buttons draw as secondary, so the one primary is the answer.
11
+ */
12
+ export const QuietPrimary = createContext(false);
8
13
  /** The small line above a title: mono capitals, as the studio's design draws it. */
9
14
  export const studioEyebrow = {
10
15
  fontFamily: 'var(--font-mono)',
@@ -1,11 +1,14 @@
1
+ import { exportRootPath } from './prototype/page.js';
1
2
  /** Where the console reads them: beside its own files. */
2
3
  export const CONSOLE_SETTINGS_PATH = '/console.json';
4
+ /** `/console.json`, or under the root of a prototype export served under another path. */
5
+ const settingsPath = () => `${exportRootPath() ?? '/'}console.json`;
3
6
  const ENVIRONMENTS = ['development', 'preview', 'staging', 'production'];
4
7
  const isUrl = (value) => typeof value === 'string' && URL.canParse(value) && /^https?:/.test(value);
5
8
  /** The settings a `/console.json` answer holds; none when there is no file (it isn't JSON). */
6
9
  async function read(fetcher) {
7
10
  try {
8
- const response = await fetcher(CONSOLE_SETTINGS_PATH, { cache: 'no-store' });
11
+ const response = await fetcher(settingsPath(), { cache: 'no-store' });
9
12
  if (!response.ok || !response.headers.get('content-type')?.includes('json'))
10
13
  return {};
11
14
  const body = (await response.json());
@@ -0,0 +1,5 @@
1
+ import { type Theme } from '@buffcore/tokens';
2
+ /** The listed files' addresses; none outside a browser, or when the list is missing or unreadable. */
3
+ export declare function designFontUrls(): string[];
4
+ /** The `@font-face` rules for the theme's families that have a file in `design/fonts/`. */
5
+ export declare const designFontCss: (theme: Theme) => string;
@@ -0,0 +1,20 @@
1
+ // The design system's font files (`design/fonts/`), which the console's Vite plugin lists in the
2
+ // page (`@buffcore/admin-shell/vite`), matched to the theme's families: `@font-face` rules for
3
+ // the console, the prototype viewer and the admin's scenes. A family with no file is the system's.
4
+ import { fontFaceCss, themeFontFiles } from '@buffcore/tokens';
5
+ /** The element the plugin writes: a JSON list of the files' addresses. */
6
+ const FONT_LIST = 'buffcore-fonts';
7
+ /** The listed files' addresses; none outside a browser, or when the list is missing or unreadable. */
8
+ export function designFontUrls() {
9
+ if (typeof document === 'undefined')
10
+ return [];
11
+ try {
12
+ const list = JSON.parse(document.getElementById(FONT_LIST)?.textContent || '[]');
13
+ return Array.isArray(list) ? list.filter((url) => typeof url === 'string') : [];
14
+ }
15
+ catch {
16
+ return [];
17
+ }
18
+ }
19
+ /** The `@font-face` rules for the theme's families that have a file in `design/fonts/`. */
20
+ export const designFontCss = (theme) => fontFaceCss(themeFontFiles(theme, designFontUrls()));
@@ -1,13 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- // The look of a prototype page: the theme's CSS, and the mode and the language on <html>.
2
+ // The look of a prototype page: the theme's CSS and fonts, and the mode and the language on <html>.
3
3
  import { isRtl } from '@buffcore/i18n';
4
4
  import { toCss } from '@buffcore/tokens';
5
5
  import { useLayoutEffect, useMemo } from 'react';
6
6
  import { PageModeContext, resolvePageMode } from '../appearance.js';
7
7
  import { BASE_CSS } from '../base-css.js';
8
+ import { designFontCss } from '../design-fonts.js';
8
9
  /** Without a mode the device's light or dark setting applies. Set before the first paint. */
9
10
  export function PageLook({ theme, mode, locale, children, }) {
10
- const css = useMemo(() => toCss(theme) + BASE_CSS, [theme]);
11
+ const css = useMemo(() => toCss(theme) + BASE_CSS + designFontCss(theme), [theme]);
11
12
  const activeMode = resolvePageMode(mode);
12
13
  useLayoutEffect(() => {
13
14
  const html = document.documentElement;
@@ -1,3 +1,4 @@
1
+ import type { PrototypeConfig } from '@buffcore/config';
1
2
  import { type Catalog } from '@buffcore/i18n';
2
3
  import { type Theme } from '@buffcore/tokens';
3
4
  import type { ComponentType, ReactElement } from 'react';
@@ -6,10 +7,11 @@ import { type PrototypeScenes } from './model.ts';
6
7
  /** The prototype viewer's own strings. */
7
8
  export declare const prototypeCatalog: Catalog;
8
9
  export interface PrototypeOptions {
9
- /** The product's `buffcore.config.ts`. */
10
+ /** The product's `buffcore.config.ts`: its `prototype.frame` sizes the desktop scenes. */
10
11
  product: {
11
12
  name: string;
12
13
  locales: readonly string[];
14
+ prototype?: PrototypeConfig;
13
15
  };
14
16
  /** What `defineScenes` returned: the product's `prototype/scenes.ts`. */
15
17
  scenes: PrototypeScenes;
@@ -1,5 +1,4 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- // createPrototype: the viewer at /prototype and each admin scene alone at /_scene.
3
2
  import { createI18n, matchLocale } from '@buffcore/i18n';
4
3
  import { I18nProvider } from '@buffcore/i18n/react';
5
4
  import { themes } from '@buffcore/tokens';
@@ -1,8 +1,25 @@
1
+ declare global {
2
+ /**
3
+ * Set by `ape prototype export --base` on the viewer's pages, before anything loads: the
4
+ * export's root path, checked and ending in `/` (e.g. `/s/abc/`). Never set elsewhere.
5
+ */
6
+ var __APE_EXPORT__: string | undefined;
7
+ }
8
+ /** The export's root path when this page is one of an export's under another path. */
9
+ export declare function exportRootPath(): string | undefined;
1
10
  /**
2
11
  * Whether `pathname` is a prototype page: the viewer (`/prototype`) or an admin scene (`/_scene`)
3
12
  * on the development server, or the same under `/prototype/` in a static export
4
- * (`ape prototype export`, whose file server adds a closing slash).
13
+ * (`ape prototype export`, whose file server adds a closing slash). An export served under
14
+ * another path (`--base`) names its root, and only then are paths ending in `/prototype/` or
15
+ * `/prototype/_scene/` prototype pages (wherever the address puts them: the export's own pages).
5
16
  */
6
- export declare const isPrototypePage: (pathname: string) => boolean;
17
+ export declare function isPrototypePage(pathname: string): boolean;
7
18
  /** Whether `pathname` is an admin scene's page, on the development server or in an export. */
8
19
  export declare const isScenePage: (pathname: string) => boolean;
20
+ /**
21
+ * A static export's root, where the app's scene pages are (`<root>/_scene`): `''` when served at
22
+ * the server's root, `/s/abc` under `/s/abc/`. Never read from the address, which a visitor
23
+ * controls: only from the root the export names.
24
+ */
25
+ export declare const exportRoot: () => string;
@@ -1,11 +1,29 @@
1
1
  // Which page of the admin's site is the prototype's. In the console's main bundle, so it carries
2
2
  // nothing else: a product's main.tsx asks it before loading the prototype behind
3
3
  // `import.meta.env.DEV`.
4
+ /** The viewer and the admin's scenes on the development server, or in an export at the root. */
5
+ const ROOT_PAGE = /^\/(prototype|_scene|prototype\/_scene)\/?$/;
6
+ const EXPORT_PAGE = /\/prototype(\/_scene)?\/?$/;
7
+ /** The export's root path when this page is one of an export's under another path. */
8
+ export function exportRootPath() {
9
+ const root = globalThis.__APE_EXPORT__;
10
+ return typeof root === 'string' && /^\/(?![/\\])(.*\/)?$/.test(root) ? root : undefined;
11
+ }
4
12
  /**
5
13
  * Whether `pathname` is a prototype page: the viewer (`/prototype`) or an admin scene (`/_scene`)
6
14
  * on the development server, or the same under `/prototype/` in a static export
7
- * (`ape prototype export`, whose file server adds a closing slash).
15
+ * (`ape prototype export`, whose file server adds a closing slash). An export served under
16
+ * another path (`--base`) names its root, and only then are paths ending in `/prototype/` or
17
+ * `/prototype/_scene/` prototype pages (wherever the address puts them: the export's own pages).
8
18
  */
9
- export const isPrototypePage = (pathname) => /^\/(prototype|_scene|prototype\/_scene)\/?$/.test(pathname);
19
+ export function isPrototypePage(pathname) {
20
+ return ROOT_PAGE.test(pathname) || (exportRootPath() !== undefined && EXPORT_PAGE.test(pathname));
21
+ }
10
22
  /** Whether `pathname` is an admin scene's page, on the development server or in an export. */
11
23
  export const isScenePage = (pathname) => /(^|\/)_scene\/?$/.test(pathname);
24
+ /**
25
+ * A static export's root, where the app's scene pages are (`<root>/_scene`): `''` when served at
26
+ * the server's root, `/s/abc` under `/s/abc/`. Never read from the address, which a visitor
27
+ * controls: only from the root the export names.
28
+ */
29
+ export const exportRoot = () => (exportRootPath() ?? '/').slice(0, -1);
@@ -17,7 +17,7 @@ function read(fallback) {
17
17
  function write({ step, ...shown }) {
18
18
  const entries = Object.entries({ ...shown, ...(shown.flow ? { step } : {}) });
19
19
  const query = new URLSearchParams(entries.flatMap(([k, v]) => (v === undefined ? [] : [[k, String(v)]])));
20
- globalThis.history?.replaceState(null, '', `${globalThis.location.pathname}?${query}`);
20
+ globalThis.history?.replaceState(null, '', `?${query}`);
21
21
  }
22
22
  /** The shown state, and a setter that changes part of it. */
23
23
  export function useShown(fallback) {
@@ -1,3 +1,4 @@
1
+ import { type PrototypeConfig } from '@buffcore/config';
1
2
  import type { Theme } from '@buffcore/tokens';
2
3
  import { type PrototypeScenes } from './model.ts';
3
4
  /** Marks the viewer's page; the production build check looks for it. */
@@ -6,6 +7,7 @@ export interface ViewerProps {
6
7
  product: {
7
8
  name: string;
8
9
  locales: readonly string[];
10
+ prototype?: PrototypeConfig;
9
11
  };
10
12
  prototype: PrototypeScenes;
11
13
  /** The product's theme, and every theme to switch between. */
@@ -1,6 +1,7 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  // The prototype viewer at /prototype (development only): the working app, then every scene and
3
3
  // flow in its frame, with switches for theme, mode, language and text scale.
4
+ import { frameSizes } from '@buffcore/config';
4
5
  import { useT } from '@buffcore/i18n/react';
5
6
  import { useState } from 'react';
6
7
  import { ActionBar } from '../components/ActionBar.js';
@@ -13,6 +14,7 @@ import { Rail } from '../components/Rail.js';
13
14
  import { EmptyState } from '../components/states.js';
14
15
  import { useNarrow } from '../use-narrow.js';
15
16
  import { appHomeUrl, localesOf, modesOf, sceneUrl, } from './model.js';
17
+ import { exportRoot } from './page.js';
16
18
  import { Switches } from './Switches.js';
17
19
  import { useShown } from './shown.js';
18
20
  import { AppPage, railSections, sceneTitle } from './viewer-parts.js';
@@ -61,7 +63,9 @@ export function Viewer({ product, prototype, theme, themes, appUrl, home = false
61
63
  const title = scene ? sceneTitle(t, look.locale, scene) : t('admin.prototype.title');
62
64
  const scale = surfaceApp ? (look.scale ?? scene?.scale ?? 1) : undefined;
63
65
  // Admin scenes beside the viewer: `/_scene` from `/prototype`; `/prototype/_scene` in an export.
64
- const base = scene?.surface === 'admin' ? '.' : appUrl;
66
+ // An export's app scenes are at its root, wherever it is served (the root it names).
67
+ const site = appUrl === '' ? exportRoot() : appUrl;
68
+ const base = scene?.surface === 'admin' ? '.' : site;
65
69
  const src = scene && base !== undefined ? sceneUrl(base, scene.key, look) : undefined;
66
70
  // The working app's home, embedded in the display, language and scale; the app keeps the
67
71
  // product's theme (the theme switch is for scenes).
@@ -88,5 +92,5 @@ export function Viewer({ product, prototype, theme, themes, appUrl, home = false
88
92
  }),
89
93
  actionBar: (_jsx(FlowBar, { step: step, count: flow.steps.length, onStep: (n) => show({ step: n }) })),
90
94
  }
91
- : {}), actions: scene && src ? (_jsxs(_Fragment, { children: [_jsx(Chip, { size: "sm", children: t(`admin.prototype.frame.${scene.frame}`) }), _jsx("a", { href: src, target: "_blank", rel: "noreferrer", children: t('admin.prototype.open') })] })) : null, children: !scene ? (_jsx(EmptyState, { icon: "layers", title: t('admin.prototype.empty'), children: t('admin.prototype.emptyBody') })) : src ? (_jsx(DeviceFrame, { src: src, frame: scene.frame, title: title })) : (_jsx(EmptyState, { icon: "info", title: t('admin.prototype.noApp') })) })) }) }));
95
+ : {}), actions: scene && src ? (_jsxs(_Fragment, { children: [_jsx(Chip, { size: "sm", children: t(`admin.prototype.frame.${scene.frame}`) }), _jsx("a", { href: src, target: "_blank", rel: "noreferrer", children: t('admin.prototype.open') })] })) : null, children: !scene ? (_jsx(EmptyState, { icon: "layers", title: t('admin.prototype.empty'), children: t('admin.prototype.emptyBody') })) : src ? (_jsx(DeviceFrame, { src: src, frame: scene.frame, size: frameSizes(product)[scene.frame], title: title })) : (_jsx(EmptyState, { icon: "info", title: t('admin.prototype.noApp') })) })) }) }));
92
96
  }
@@ -92,7 +92,7 @@ export declare function useAsk(api: Client): {
92
92
  }[] | undefined;
93
93
  }[];
94
94
  approval: {
95
- kind: "brand" | "money" | "places" | "plan" | "prototype" | "release";
95
+ kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
96
96
  signatures: {
97
97
  by: string;
98
98
  at: string;
@@ -210,7 +210,7 @@ export declare function useAsk(api: Client): {
210
210
  }[] | undefined;
211
211
  }[];
212
212
  approval: {
213
- kind: "brand" | "money" | "places" | "plan" | "prototype" | "release";
213
+ kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
214
214
  signatures: {
215
215
  by: string;
216
216
  at: string;
@@ -379,6 +379,7 @@ export declare function useAsk(api: Client): {
379
379
  approval: import("zod").ZodNullable<import("zod").ZodObject<{
380
380
  kind: import("zod").ZodEnum<{
381
381
  brand: "brand";
382
+ comp: "comp";
382
383
  money: "money";
383
384
  places: "places";
384
385
  plan: "plan";
@@ -505,7 +506,7 @@ export declare function useAsk(api: Client): {
505
506
  }[] | undefined;
506
507
  }[];
507
508
  approval: {
508
- kind: "brand" | "money" | "places" | "plan" | "prototype" | "release";
509
+ kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
509
510
  signatures: {
510
511
  by: string;
511
512
  at: string;
@@ -64,7 +64,10 @@ export function ServedAgents({ state, actions }) {
64
64
  busy.current = false;
65
65
  }
66
66
  };
67
- return (_jsxs(_Fragment, { children: [_jsx(AgentsPage, { onChoose: () => {
67
+ return (_jsxs(_Fragment, { children: [_jsx(AgentsPage, { review: {
68
+ on: state.agents.file?.review !== false,
69
+ onChange: blocked ? undefined : actions.fresh?.setting,
70
+ }, onChoose: () => {
68
71
  if (agents.some((agent) => agent.state === 'missing'))
69
72
  void discover();
70
73
  }, onHelp: (agent, need) => {
@@ -0,0 +1,3 @@
1
+ import type { CompSlot } from '../studio/loop/PrototypePage.tsx';
2
+ import { type CompReads } from './prototype-comp.ts';
3
+ export declare function useServedComp(reads: CompReads | undefined, needsRight?: 'approve'): CompSlot | undefined;
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // The comp on the served Prototype page: shown first while no look is approved, and on request
3
+ // after. Approving is a person's click; the route records it and refuses an agent.
4
+ import { useT } from '@buffcore/i18n/react';
5
+ import { useState } from 'react';
6
+ import { Button } from '../../components/Button.js';
7
+ import { captionText } from '../../components/styles.js';
8
+ import { PrototypeComp } from '../studio/loop/PrototypeComp.js';
9
+ import { useDesignApproval } from '../studio/loop/useDesignApproval.js';
10
+ import { usePrototypeComp } from './prototype-comp.js';
11
+ export function useServedComp(reads, needsRight) {
12
+ const t = useT();
13
+ const { reply, pictures, reload } = usePrototypeComp(reads);
14
+ const signing = useDesignApproval(`comp:${reply?.fingerprint ?? ''}`);
15
+ const [opened, setOpened] = useState(false);
16
+ if (!reads || !reply?.screens.length)
17
+ return undefined;
18
+ const open = !reply.approved || opened;
19
+ const view = (_jsx(PrototypeComp, { surface: reply.surface, width: reply.width, screens: reply.screens.map((screen) => ({
20
+ key: screen.key,
21
+ title: screen.title,
22
+ light: screen.light && pictures[screen.light],
23
+ dark: screen.dark && pictures[screen.dark],
24
+ })), references: reply.references.map((name) => (name ? pictures[name] : undefined)), approved: reply.approved, approvedBy: reply.approval?.signatures[0]?.by, needsRight: needsRight, result: signing.result, onApprove: reply.fingerprint
25
+ ? () => void signing.approve(async () => {
26
+ const answer = await reads.approve(reply.fingerprint);
27
+ reload();
28
+ return answer;
29
+ })
30
+ : undefined, onClose: reply.approved ? () => setOpened(false) : undefined }));
31
+ const summary = reply.approved && !opened && (_jsxs("div", { style: { display: 'flex', flexWrap: 'wrap', alignItems: 'center', gap: 'var(--space-3)' }, children: [_jsx("span", { style: captionText, children: t('studio.comp.approved') }), _jsx(Button, { variant: "secondary", size: "lg", onClick: () => setOpened(true), children: t('studio.comp.open') })] }));
32
+ return { open, view, summary: summary || undefined };
33
+ }
@@ -1,12 +1,15 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { useLocale, useT } from '@buffcore/i18n/react';
3
- import { useRef, useState } from 'react';
3
+ import { useEffect, useRef, useState } from 'react';
4
4
  import { PrototypePage } from '../studio/loop/PrototypePage.js';
5
5
  import { useDesignApproval } from '../studio/loop/useDesignApproval.js';
6
+ import { viewerCanBuild } from '../studio/loop/usePlanningSave.js';
6
7
  import { usePrototypeRecord } from '../studio/loop/usePrototypeRecord.js';
7
8
  import { catchUpChange } from './catch-up.js';
9
+ import { useFresh } from './fresh.js';
8
10
  import { commentMessage, openPrototype, protoSample, protoView } from './prototype.js';
9
11
  import { usePrototypeHome } from './prototype-home.js';
12
+ import { useServedComp } from './ServedComp.js';
10
13
  import { usePrototypeScenes } from './usePrototypeScenes.js';
11
14
  import { usePrototypeSnapshot } from './usePrototypeSnapshot.js';
12
15
  import { usePrototypeUi } from './usePrototypeUi.js';
@@ -22,8 +25,10 @@ function usePrototypePage(props) {
22
25
  }
23
26
  // A missed probe can omit appUrl, including when a host set a different preview address.
24
27
  const previewUrl = appUrl ?? (sameAddress && running !== true ? address.url : undefined) ?? stack.app;
28
+ const comp = useServedComp(props.actions.comp, model.view.needsRight);
25
29
  return {
26
30
  page: {
31
+ comp,
27
32
  appUrl: stack.state === 'running' ? appUrl : undefined,
28
33
  simple: props.actions.prototypeHome ? { checks: prototypeChecks(model) } : undefined,
29
34
  home: props.actions.prototypeHome
@@ -61,6 +66,9 @@ function usePrototypePage(props) {
61
66
  onSave: () => void model.recording.save(),
62
67
  onStart: model.snapshot.start,
63
68
  onStop: () => void model.snapshot.stop(),
69
+ critique: !model.critique?.change || model.critique.change === model.change
70
+ ? model.critique
71
+ : undefined,
64
72
  onRecord: async () => {
65
73
  if (model.snapshot.reply?.linked)
66
74
  return;
@@ -87,6 +95,7 @@ function usePrototypeModel(props) {
87
95
  if (!state.stackUnconfirmed)
88
96
  confirmed.current = state;
89
97
  const { stack: { output: _output, ...ports }, ...facts } = confirmed.current;
98
+ const critique = useFresh(actions, 'prototype').reply?.critique;
90
99
  const snapshot = usePrototypeSnapshot(actions, { ...facts, stack: ports }, change, own, props.every);
91
100
  const sample = protoSample(state, change, { ...ui, t }, source.scenes);
92
101
  sample.proto.consoleRead = { pending: source.pending, failure: source.failure };
@@ -97,6 +106,23 @@ function usePrototypeModel(props) {
97
106
  void snapshot.start();
98
107
  }
99
108
  const recording = usePrototypeRecord(actions, change, state.runs[`version:${change}`], signing.result.busy, state.versions?.find((record) => record.change === change)?.versions.length, { check: snapshot.check, start: takeSnapshot });
109
+ // One click saves: unsaved scenes list their files as soon as the snapshot knows of them, for a
110
+ // viewer who may save them (the save route needs the `build` right).
111
+ const reply = snapshot.reply;
112
+ const listFiles = viewerCanBuild(state) &&
113
+ !!actions.snapshot &&
114
+ !!reply &&
115
+ !snapshot.pending &&
116
+ reply.status !== 'running' &&
117
+ !reply.linked &&
118
+ reply.source.dirty &&
119
+ !recording.result.review &&
120
+ !recording.result.busy;
121
+ // biome-ignore lint/correctness/useExhaustiveDependencies: list once each time it becomes needed.
122
+ useEffect(() => {
123
+ if (listFiles)
124
+ void recording.save();
125
+ }, [listFiles]);
100
126
  return {
101
127
  ...props,
102
128
  t,
@@ -112,6 +138,7 @@ function usePrototypeModel(props) {
112
138
  source,
113
139
  home,
114
140
  snapshot: { ...snapshot, own, start: takeSnapshot },
141
+ critique,
115
142
  };
116
143
  }
117
144
  function prototypeHandlers(model) {
@@ -2,12 +2,14 @@ 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 { useRef, useState } from 'react';
4
4
  import { Banner } from '../../components/Banner.js';
5
+ import { QuietPrimary } from '../../components/look.js';
5
6
  import { EmptyState, Loading } from '../../components/states.js';
6
7
  import { captionText } from '../../components/styles.js';
7
8
  import { CodeDoor, useCodeDoor } from '../studio/frame/CodeDoor.js';
8
9
  import { StudioFrame } from '../studio/frame/StudioFrame.js';
9
10
  import { WaitingBanner } from '../studio/frame/WaitingBanner.js';
10
11
  import { PreviewChoiceContext } from '../studio/loop/PrototypeApp.js';
12
+ import { canAnswerAsk, useAskCard } from './ask-card.js';
11
13
  import { canReadAgents, useChat } from './chat.js';
12
14
  import { frameProps, useStudioPage, useStudioTitle } from './frame.js';
13
15
  import { StudioHostParts } from './host-parts.js';
@@ -35,6 +37,7 @@ function StudioSession(props) {
35
37
  setWorkChange(change);
36
38
  };
37
39
  const conversation = useChat(props, gate, page, actions, workChange, selectionGeneration);
40
+ const ask = useAskCard(conversation.chat, state ?? undefined, actions);
38
41
  const levels = useLevelChoice({
39
42
  working: state && canReadAgents(state) ? state.agents.file?.level : undefined,
40
43
  committed: state?.committedLevel,
@@ -86,15 +89,19 @@ function StudioSession(props) {
86
89
  : codingNotice
87
90
  ? undefined
88
91
  : chatNotice);
89
- frame.agent = withPanelCards(frame.agent, state, conversation.chat.id, actions, onGo, platformsWanted);
92
+ frame.agent = withPanelCards(frame.agent, state, conversation.chat.id, actions, onGo, platformsWanted, ask);
90
93
  const rights = state.viewer?.rights;
91
94
  frame.onLevel =
92
95
  !state.level && (!rights || rights === 'all' || rights.includes('settings'))
93
96
  ? levels.choose
94
97
  : undefined;
95
- const choice = state.level
96
- ? hostLevelChoice(levels.choice, state.level.where, state.levelCommit)
97
- : levels.choice;
98
+ const choice = {
99
+ ...(state.level
100
+ ? hostLevelChoice(levels.choice, state.level.where, state.levelCommit)
101
+ : levels.choice),
102
+ ...(state.neverAsk ? { neverAsk: true } : {}),
103
+ ...(frame.onLevel ? { onNeverAsk: (on) => void actions.level('auto', on) } : {}),
104
+ };
98
105
  return (_jsx(LevelChoiceContext, { value: choice, children: _jsx(StudioHostParts, { state, page, parts: props.parts, sources: readFailed ? undefined : props.hostParts, children: _jsxs(StudioFrame, { ...frame, children: [age === 'checking' && (_jsx("p", { role: "status", style: { ...captionText, margin: 0 }, children: t('workbench.trouble.checking') })), _jsx(PreviewChoiceContext, { value: previewChoice, children: _jsx(ConversationPage, { every: props.every, onLevel: frame.onLevel, state: page === 'work' || page === 'build' ? (gate ?? state) : state,
99
106
  page,
100
107
  actions,
@@ -137,20 +144,22 @@ function ConversationPage({ every, onLevel, state, page, actions, conversation,
137
144
  // Only this step's own chat, once its turn has ended: a question from another chat never shows.
138
145
  const chat = conversation.chat;
139
146
  const waiting = chat.page === page && chat.state !== 'running' ? chat.waiting : undefined;
140
- return (_jsxs(_Fragment, { children: [trouble && trouble !== 'offline' && (_jsx(Banner, { tone: "attention", title: t(`workbench.trouble.${trouble}`) })), notice && _jsx(Banner, { tone: "attention", title: notice }), waiting && (_jsx(WaitingBanner, { agent: agentName, question: waiting.question, onAnswer: onAnswer })), _jsx(StudioPages, { every: every, onLevel: onLevel, change: workChange, onChange: (change) => {
141
- conversation.controls.composer.onUnqueue?.();
142
- conversation.controls.composer.onChange('');
143
- setWorkChange(change);
144
- }, state: state, page: page, actions: actions, prototypeTurn: page === 'prototype' ? conversation.chat : undefined, onComment: (text) => void conversation.send(text), onStep: async (body, text) => {
145
- const generation = selectionGeneration.current;
146
- const sent = await conversation.sendTo(body, text);
147
- if (generation !== selectionGeneration.current)
148
- return false;
149
- if (sent) {
150
- if (body.work === 'coding')
151
- setWorkChange(body.change);
152
- onGo(body.page);
153
- }
154
- return sent;
155
- } })] }));
147
+ // While the agent's permission card waits in the chat, its answer is the one primary action.
148
+ const asking = chat.state === 'running' && !!chat.asking && canAnswerAsk(state, actions);
149
+ return (_jsxs(_Fragment, { children: [trouble && trouble !== 'offline' && (_jsx(Banner, { tone: "attention", title: t(`workbench.trouble.${trouble}`) })), notice && _jsx(Banner, { tone: "attention", title: notice }), waiting && (_jsx(WaitingBanner, { agent: agentName, question: waiting.question, onAnswer: onAnswer })), _jsx(QuietPrimary, { value: asking, children: _jsx(StudioPages, { every: every, onLevel: onLevel, change: workChange, onChange: (change) => {
150
+ conversation.controls.composer.onUnqueue?.();
151
+ conversation.controls.composer.onChange('');
152
+ setWorkChange(change);
153
+ }, state: state, page: page, actions: actions, prototypeTurn: page === 'prototype' ? conversation.chat : undefined, onComment: (text) => void conversation.send(text), onStep: async (body, text) => {
154
+ const generation = selectionGeneration.current;
155
+ const sent = await conversation.sendTo(body, text);
156
+ if (generation !== selectionGeneration.current)
157
+ return false;
158
+ if (sent) {
159
+ if (body.work === 'coding')
160
+ setWorkChange(body.change);
161
+ onGo(body.page);
162
+ }
163
+ return sent;
164
+ } }) })] }));
156
165
  }
@@ -2,6 +2,7 @@ import { type AgentAssignment, type Chat, type FoundAgent, type LEVELS, type Mer
2
2
  import { z } from 'zod';
3
3
  import type { StudioPage } from '../studio/types.ts';
4
4
  import type { ServerForm } from '../types.ts';
5
+ import type { FreshActions } from './fresh.ts';
5
6
  import { type SnapshotRead, type SnapshotRequest } from './prototype-snapshot.ts';
6
7
  import type { QuestionChoice } from './question-choices.ts';
7
8
  export declare function studioRefusal(answer: unknown): string | undefined;
@@ -36,11 +37,17 @@ export interface StudioActions {
36
37
  prototypeScenes?: (signal?: AbortSignal) => Promise<PrototypeScenesReply>;
37
38
  go?: (page: StudioPage) => void;
38
39
  readIcon?: (signal: AbortSignal) => Promise<Blob | undefined>;
40
+ /** The comp's reads and its approval (`prototype-comp.ts`). */
41
+ comp?: import('./prototype-comp.ts').CompReads;
39
42
  uploadIcon?: (file: File) => Promise<unknown>;
40
43
  run: (id: string, server?: ServerForm) => unknown;
41
44
  stack: (action: 'start' | 'stop') => void;
42
- level: (level: (typeof LEVELS)[number]) => void;
45
+ level: (level: (typeof LEVELS)[number], neverAsk?: boolean) => void;
46
+ /** A person's answer to the paused turn's card: true, or the refusal sentence. */
47
+ answerPermission?: (chat: string, card: string, answer: 'once' | 'always' | 'deny') => Promise<true | string>;
43
48
  approvePrototype?: (change: string, version: number) => unknown;
49
+ /** Structure's Which surface comes first, written into the structure file's header. */
50
+ chooseSurface?: (surface: 'desktop' | 'phone') => unknown;
44
51
  approvePlaces?: (change: string, revision: string) => unknown;
45
52
  approve?: (direction: string, fingerprint: string) => unknown;
46
53
  approveRelease?: (id: string, server: ServerForm) => Promise<unknown>;
@@ -69,6 +76,8 @@ export interface StudioActions {
69
76
  retryTurn?: (chat: string) => Promise<unknown>;
70
77
  holdMerges?: (held: boolean) => Promise<unknown>;
71
78
  removeWorktree: (change: string) => Promise<unknown>;
79
+ /** A fresh agent's turns: the review before Save and the critique (fresh.ts). */
80
+ fresh?: FreshActions;
72
81
  save: (step: SaveStep, fingerprint?: string, files?: readonly string[], change?: string) => Promise<SaveResult>;
73
82
  }
74
83
  /** The same commands as the old workbench; only the view changes. */