@buffcore/admin-shell 0.8.40 → 0.8.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) 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/i18n/en.d.ts +3 -0
  12. package/dist/i18n/en.js +3 -0
  13. package/dist/i18n/es.json +3 -0
  14. package/dist/prototype/PageLook.js +3 -2
  15. package/dist/prototype/create.d.ts +3 -1
  16. package/dist/prototype/create.js +0 -1
  17. package/dist/prototype/page.d.ts +19 -2
  18. package/dist/prototype/page.js +20 -2
  19. package/dist/prototype/shown.js +1 -1
  20. package/dist/prototype/viewer.d.ts +2 -0
  21. package/dist/prototype/viewer.js +6 -2
  22. package/dist/workbench/app/ServedPrototype.js +19 -1
  23. package/dist/workbench/app/ServedSetup.js +8 -1
  24. package/dist/workbench/app/StudioApp.js +41 -20
  25. package/dist/workbench/app/__snapshots__/places-dom.test.tsx.snap +3 -3
  26. package/dist/workbench/app/actions.d.ts +12 -1
  27. package/dist/workbench/app/actions.js +14 -2
  28. package/dist/workbench/app/ask-card.d.ts +10 -0
  29. package/dist/workbench/app/ask-card.js +34 -0
  30. package/dist/workbench/app/chat-session.d.ts +44 -0
  31. package/dist/workbench/app/chat.d.ts +59 -0
  32. package/dist/workbench/app/chat.js +1 -0
  33. package/dist/workbench/app/frame.js +4 -2
  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/loop.js +10 -4
  41. package/dist/workbench/app/mount.d.ts +4 -1
  42. package/dist/workbench/app/mount.js +2 -2
  43. package/dist/workbench/app/panel-cards.d.ts +10 -0
  44. package/dist/workbench/app/panel-cards.js +29 -0
  45. package/dist/workbench/app/places.d.ts +17 -2
  46. package/dist/workbench/app/places.js +14 -2
  47. package/dist/workbench/app/scene-address.d.ts +10 -0
  48. package/dist/workbench/app/scene-address.js +14 -0
  49. package/dist/workbench/app/studio-post.js +2 -0
  50. package/dist/workbench/app/test/loop-fixture.d.ts +30 -2
  51. package/dist/workbench/app/usePrototypeUi.js +14 -0
  52. package/dist/workbench/app/work.d.ts +7 -7
  53. package/dist/workbench/host-theme.d.ts +3 -0
  54. package/dist/workbench/host-theme.js +14 -0
  55. package/dist/workbench/index.d.ts +1 -0
  56. package/dist/workbench/index.js +1 -0
  57. package/dist/workbench/studio/frame/AllowFolderCard.d.ts +16 -0
  58. package/dist/workbench/studio/frame/AllowFolderCard.js +63 -0
  59. package/dist/workbench/studio/frame/HostRailEntries.d.ts +3 -0
  60. package/dist/workbench/studio/frame/HostRailEntries.js +15 -0
  61. package/dist/workbench/studio/frame/HostSide.d.ts +6 -0
  62. package/dist/workbench/studio/frame/HostSide.js +31 -0
  63. package/dist/workbench/studio/frame/LevelChip.js +2 -1
  64. package/dist/workbench/studio/frame/LevelChoices.js +24 -8
  65. package/dist/workbench/studio/frame/NeverAskSetting.d.ts +7 -0
  66. package/dist/workbench/studio/frame/NeverAskSetting.js +24 -0
  67. package/dist/workbench/studio/frame/PanelList.js +11 -3
  68. package/dist/workbench/studio/frame/PanelMessage.d.ts +2 -0
  69. package/dist/workbench/studio/frame/PanelMessage.js +1 -1
  70. package/dist/workbench/studio/frame/PanelNotice.js +2 -1
  71. package/dist/workbench/studio/frame/PanelPermission.d.ts +2 -0
  72. package/dist/workbench/studio/frame/PanelPermission.js +4 -0
  73. package/dist/workbench/studio/frame/PanelScenes.d.ts +5 -0
  74. package/dist/workbench/studio/frame/PanelScenes.js +38 -0
  75. package/dist/workbench/studio/frame/PermissionAskCard.d.ts +18 -0
  76. package/dist/workbench/studio/frame/PermissionAskCard.js +60 -0
  77. package/dist/workbench/studio/frame/PermissionAskFold.d.ts +12 -0
  78. package/dist/workbench/studio/frame/PermissionAskFold.js +54 -0
  79. package/dist/workbench/studio/frame/Place.d.ts +6 -2
  80. package/dist/workbench/studio/frame/Place.js +13 -5
  81. package/dist/workbench/studio/frame/PlatformsCard.d.ts +10 -0
  82. package/dist/workbench/studio/frame/PlatformsCard.js +26 -0
  83. package/dist/workbench/studio/frame/SettingsSheet.js +6 -1
  84. package/dist/workbench/studio/frame/StudioRail.js +2 -1
  85. package/dist/workbench/studio/frame/WaitingBanner.d.ts +5 -0
  86. package/dist/workbench/studio/frame/WaitingBanner.js +17 -0
  87. package/dist/workbench/studio/frame/panelControls.d.ts +29 -0
  88. package/dist/workbench/studio/frame/useTurnDraft.d.ts +1 -0
  89. package/dist/workbench/studio/frame/useTurnDraft.js +3 -1
  90. package/dist/workbench/studio/i18n/frame.en.d.ts +44 -0
  91. package/dist/workbench/studio/i18n/frame.en.js +45 -1
  92. package/dist/workbench/studio/i18n/frame.es.json +46 -2
  93. package/dist/workbench/studio/i18n/levels.en.d.ts +8 -3
  94. package/dist/workbench/studio/i18n/levels.en.js +8 -3
  95. package/dist/workbench/studio/i18n/levels.es.json +9 -4
  96. package/dist/workbench/studio/i18n/loop.en.d.ts +16 -0
  97. package/dist/workbench/studio/i18n/loop.en.js +18 -2
  98. package/dist/workbench/studio/i18n/loop.es.json +18 -2
  99. package/dist/workbench/studio/i18n/save.en.d.ts +1 -3
  100. package/dist/workbench/studio/i18n/save.en.js +13 -15
  101. package/dist/workbench/studio/i18n/save.es.json +14 -16
  102. package/dist/workbench/studio/i18n/structure.en.d.ts +6 -0
  103. package/dist/workbench/studio/i18n/structure.en.js +6 -0
  104. package/dist/workbench/studio/i18n/structure.es.d.ts +6 -0
  105. package/dist/workbench/studio/i18n/structure.es.js +6 -0
  106. package/dist/workbench/studio/loop/PrototypePage.js +4 -3
  107. package/dist/workbench/studio/loop/PrototypeScenes.js +1 -2
  108. package/dist/workbench/studio/loop/PrototypeSimplePage.js +7 -6
  109. package/dist/workbench/studio/loop/PrototypeSnapshot.js +5 -1
  110. package/dist/workbench/studio/loop/ReviewedSave.d.ts +1 -1
  111. package/dist/workbench/studio/loop/ReviewedSave.js +2 -10
  112. package/dist/workbench/studio/loop/ServedBrand.js +3 -3
  113. package/dist/workbench/studio/loop/StructurePage.d.ts +2 -0
  114. package/dist/workbench/studio/loop/StructurePage.js +1 -1
  115. package/dist/workbench/studio/loop/StructurePreview.js +4 -4
  116. package/dist/workbench/studio/loop/StructurePrompts.js +9 -4
  117. package/dist/workbench/studio/loop/step-state.d.ts +1 -1
  118. package/dist/workbench/studio/loop/step-state.js +9 -8
  119. package/dist/workbench/studio/loop/structure-answers.d.ts +8 -0
  120. package/dist/workbench/studio/loop/structure-answers.js +34 -0
  121. package/dist/workbench/studio/loop/usePlanningDraft.js +2 -1
  122. package/dist/workbench/studio/loop/usePlanningSave.d.ts +16 -2
  123. package/dist/workbench/studio/loop/usePlanningSave.js +40 -2
  124. package/dist/workbench/studio/loop/usePrototypeRecord.js +5 -4
  125. package/dist/workbench/studio/loop/useReviewedSave.d.ts +9 -4
  126. package/dist/workbench/studio/loop/useReviewedSave.js +89 -30
  127. package/dist/workbench/studio/run/LiveServers.js +1 -1
  128. package/dist/workbench/studio/run/ReleasePage.js +1 -1
  129. package/dist/workbench/studio/run/ReleasesPage.js +2 -2
  130. package/dist/workbench/studio/run/ServedRelease.js +1 -1
  131. package/dist/workbench/studio/run/WhereItRuns.d.ts +5 -0
  132. package/dist/workbench/studio/run/WhereItRuns.js +37 -17
  133. package/dist/workbench/studio/work/work-test-data.d.ts +4 -1
  134. package/package.json +6 -6
  135. package/vite.d.ts +6 -1
  136. package/vite.js +78 -5
@@ -11,13 +11,13 @@ import { pageMode } from '../studio/frame/layout.js';
11
11
  import { studioCatalog } from '../studio/i18n/index.js';
12
12
  import { theme } from '../theme.js';
13
13
  import { StudioApp } from './StudioApp.js';
14
- export function StudioRoot({ locale, ...props }) {
14
+ export function StudioRoot({ locale, theme: hostTheme, ...props }) {
15
15
  const translator = useMemo(() => createI18n({
16
16
  catalogs: [adminCatalog, workbenchCatalog, studioCatalog],
17
17
  locale: matchLocale(locale || globalThis.navigator?.languages, ['en', 'es']),
18
18
  }), [locale]);
19
19
  const [dark, setDark] = useState(() => resolvePageMode(pageMode()) === 'dark');
20
- return (_jsxs(I18nProvider, { translator: translator, children: [_jsx(PageLook, { theme: theme, mode: dark ? 'dark' : 'light', locale: translator.instance.language }), _jsx("div", { style: { height: '100dvh' }, children: _jsx(StudioApp, { ...props, dark: dark, onDark: () => setDark((mode) => !mode) }) })] }));
20
+ return (_jsxs(I18nProvider, { translator: translator, children: [_jsx(PageLook, { theme: hostTheme ?? theme, mode: dark ? 'dark' : 'light', locale: translator.instance.language }), _jsx("div", { style: { height: '100dvh' }, children: _jsx(StudioApp, { ...props, dark: dark, onDark: () => setDark((mode) => !mode) }) })] }));
21
21
  }
22
22
  /** Mounts the opt-in studio; polling stops when the caller unmounts it. */
23
23
  export function mountStudio(element, props) {
@@ -0,0 +1,10 @@
1
+ import type { StudioState } from '@buffcore/contracts/workbench';
2
+ import type { ControlledAgent, TurnControls } from '../studio/frame/panelControls.ts';
3
+ import type { StudioPage } from '../studio/types.ts';
4
+ import type { StudioActions } from './actions.ts';
5
+ /**
6
+ * The chat's two cards: "Allow this folder" for a person with the settings right (the server
7
+ * checks it again and reads the folder from the chat), and the platforms card, which only opens
8
+ * Setup with the chosen switches; and the agent's permission card, when the turn waits on one.
9
+ */
10
+ export declare function withPanelCards(agent: ControlledAgent, state: StudioState, chat: string, actions: StudioActions, onGo: (page: StudioPage) => void, wanted: NonNullable<StudioActions['platformsWanted']>, ask?: TurnControls['ask']): ControlledAgent;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The chat's two cards: "Allow this folder" for a person with the settings right (the server
3
+ * checks it again and reads the folder from the chat), and the platforms card, which only opens
4
+ * Setup with the chosen switches; and the agent's permission card, when the turn waits on one.
5
+ */
6
+ export function withPanelCards(agent, state, chat, actions, onGo, wanted, ask) {
7
+ actions.platformsWanted = wanted;
8
+ const rights = state.viewer?.rights;
9
+ const settings = !rights || rights === 'all' || rights.includes('settings');
10
+ const allow = actions.allowFolder;
11
+ const platforms = state.platforms && {
12
+ ios: state.platforms.ios.on,
13
+ android: state.platforms.android.on,
14
+ };
15
+ return {
16
+ ...agent,
17
+ turn: {
18
+ ...agent.turn,
19
+ ...(settings && allow && chat ? { onAllowFolder: (at) => allow(chat, at) } : {}),
20
+ ...(platforms ? { platforms } : {}),
21
+ ...(ask ? { ask } : {}),
22
+ onPlatforms: (choice) => {
23
+ // An absent choice (unknown platforms) opens Setup with nothing chosen.
24
+ wanted.current = choice;
25
+ onGo('setup');
26
+ },
27
+ },
28
+ };
29
+ }
@@ -5,7 +5,17 @@ export interface HostPart {
5
5
  id: string;
6
6
  /** Host-supplied, already localized badge and navigation label. */
7
7
  label?: string;
8
- draw(state: StudioState, passed?: unknown): ReactNode;
8
+ /** `subject` is the plain JSON a place with one passes (beside a prototype, a release approval, a server card). */
9
+ draw(state: StudioState, passed?: unknown, subject?: unknown): ReactNode;
10
+ }
11
+ /** A host's rail entries, drawn as rail rows; each opens its `page` part of the same id. */
12
+ export interface HostRail {
13
+ label?: string;
14
+ entries: readonly {
15
+ id: string;
16
+ label: string;
17
+ icon?: string;
18
+ }[];
9
19
  }
10
20
  export type HostParts = Partial<Record<DrawPlaceId, readonly HostPart[]>>;
11
21
  type Selection = {
@@ -16,6 +26,7 @@ type Selection = {
16
26
  interface PlacesValue {
17
27
  state: StudioState;
18
28
  parts?: HostParts;
29
+ rail?: HostRail;
19
30
  page: StudioPage;
20
31
  selected?: Selection;
21
32
  select: (place?: DrawPlaceId, id?: string) => void;
@@ -44,8 +55,12 @@ export declare function placeApproval(id: PlaceId, state: StudioState): {
44
55
  by: string;
45
56
  } | undefined;
46
57
  } | undefined;
58
+ /** A subject as plain JSON: no functions, class instances or shared references reach a part. */
59
+ export declare function plainSubject(subject: unknown): unknown;
47
60
  /** Only the container supplies facts; the views read this optional rendering input. */
48
- export declare function StudioPlaces({ state, parts, page, children, }: Pick<PlacesValue, 'state' | 'parts' | 'page'> & {
61
+ export declare function StudioPlaces({ state, parts, rail, page, opened, children, }: Pick<PlacesValue, 'state' | 'parts' | 'rail' | 'page'> & {
62
+ /** A host page or tab open from the start (the review scenes draw one open). */
63
+ opened?: Pick<Selection, 'place' | 'id'>;
49
64
  children: ReactNode;
50
65
  }): import("react").FunctionComponentElement<import("react").ProviderProps<PlacesValue | null>>;
51
66
  export {};
@@ -11,14 +11,26 @@ export function placeApproval(id, state) {
11
11
  ?.approval;
12
12
  return undefined;
13
13
  }
14
+ /** A subject as plain JSON: no functions, class instances or shared references reach a part. */
15
+ export function plainSubject(subject) {
16
+ if (subject === undefined)
17
+ return undefined;
18
+ try {
19
+ return JSON.parse(JSON.stringify(subject));
20
+ }
21
+ catch {
22
+ return undefined;
23
+ }
24
+ }
14
25
  /** Only the container supplies facts; the views read this optional rendering input. */
15
- export function StudioPlaces({ state, parts, page, children, }) {
16
- const [selection, setSelection] = useState();
26
+ export function StudioPlaces({ state, parts, rail, page, opened, children, }) {
27
+ const [selection, setSelection] = useState(opened && { ...opened, page });
17
28
  const selected = selection?.page === page ? selection : undefined;
18
29
  return createElement(PlacesContext.Provider, {
19
30
  value: {
20
31
  state,
21
32
  parts,
33
+ rail,
22
34
  page,
23
35
  selected,
24
36
  select: (place, id) => setSelection(place && id ? { place, id, page } : undefined),
@@ -0,0 +1,10 @@
1
+ /**
2
+ * A reply's scene link: `#/prototype?scene=<key>` opens Prototype with that scene in the preview.
3
+ * The preview takes the scene once and puts the address back to `#/prototype`, so the same link
4
+ * works again after the person moves on.
5
+ */
6
+ export declare const sceneHref: (key: string) => string;
7
+ /** The scene an address asks the preview for, if any. */
8
+ export declare function addressedScene(hash: string): string | undefined;
9
+ /** The page part of an address: `#/prototype?scene=x` is the Prototype page. */
10
+ export declare const addressPath: (hash: string) => string;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * A reply's scene link: `#/prototype?scene=<key>` opens Prototype with that scene in the preview.
3
+ * The preview takes the scene once and puts the address back to `#/prototype`, so the same link
4
+ * works again after the person moves on.
5
+ */
6
+ export const sceneHref = (key) => `#/prototype?scene=${encodeURIComponent(key)}`;
7
+ /** The scene an address asks the preview for, if any. */
8
+ export function addressedScene(hash) {
9
+ const match = /^#\/prototype\?(.*)$/.exec(hash);
10
+ const scene = match ? new URLSearchParams(match[1]).get('scene') : null;
11
+ return scene || undefined;
12
+ }
13
+ /** The page part of an address: `#/prototype?scene=x` is the Prototype page. */
14
+ export const addressPath = (hash) => hash.split('?')[0] ?? hash;
@@ -61,6 +61,8 @@ export function studioPost(fetch, headers, read, setDetail, setTrouble, offline)
61
61
  return setTrouble('local-token');
62
62
  const id = body?.id;
63
63
  if (path === '/api/brand/icon' ||
64
+ path.endsWith('/allow-folder') ||
65
+ path.endsWith('/permission') ||
64
66
  (path === '/api/run' && typeof id === 'string' && /^(?:enable|disable):/.test(id)))
65
67
  // Only a refusal sentence is shown; any other failed answer is a failure the page words.
66
68
  return typeof result?.error === 'string' ? result : undefined;
@@ -31,6 +31,7 @@ export declare function loopApi(initial?: {
31
31
  model?: Partial<Record<"coding" | "design" | "fixes" | "planning" | "tests" | "validation", string>> | undefined;
32
32
  effort?: Partial<Record<"coding" | "design" | "fixes" | "planning" | "tests" | "validation", "auto" | "high" | "low" | "max" | "medium" | "xhigh">> | undefined;
33
33
  level: "auto" | "guide" | "lead" | "review";
34
+ neverAsk?: boolean | undefined;
34
35
  } | null;
35
36
  found: {
36
37
  id: "antigravity" | "claude" | "codex" | "cursor" | "grok" | "muse" | "opencode";
@@ -228,6 +229,7 @@ export declare function loopApi(initial?: {
228
229
  who: string;
229
230
  place: string;
230
231
  main: boolean;
232
+ planned?: string | undefined;
231
233
  }[];
232
234
  notes: string[];
233
235
  problem?: string | undefined;
@@ -315,7 +317,7 @@ export declare function loopApi(initial?: {
315
317
  at: string;
316
318
  commit: string;
317
319
  change?: string | undefined;
318
- direction?: "neutral" | "soft" | undefined;
320
+ direction?: "bold" | "clear" | "neutral" | "soft" | "warm" | undefined;
319
321
  version?: number | undefined;
320
322
  screen?: string | undefined;
321
323
  revert?: string | undefined;
@@ -337,6 +339,7 @@ export declare function loopApi(initial?: {
337
339
  } | undefined;
338
340
  committedLevel?: "auto" | "guide" | "lead" | "review" | undefined;
339
341
  effectiveLevel?: "auto" | "guide" | "lead" | "review" | undefined;
342
+ neverAsk?: boolean | undefined;
340
343
  level?: {
341
344
  source: "host";
342
345
  where: string;
@@ -383,6 +386,23 @@ export declare function loopApi(initial?: {
383
386
  startedAgent: boolean;
384
387
  retried?: boolean | undefined;
385
388
  } | undefined;
389
+ waiting?: {
390
+ question: string;
391
+ at: string;
392
+ turn: string;
393
+ } | undefined;
394
+ asking?: {
395
+ id: string;
396
+ tool: string;
397
+ command: string;
398
+ parts: string[];
399
+ once?: boolean | undefined;
400
+ unsure?: {
401
+ why: "budget" | "expression" | "heredoc" | "mention" | "pattern" | "stdin";
402
+ mention?: string | undefined;
403
+ } | undefined;
404
+ at: string;
405
+ } | undefined;
386
406
  messages: {
387
407
  from: "agent" | "system" | "you";
388
408
  text: string;
@@ -423,6 +443,7 @@ export declare function loopApi(initial?: {
423
443
  path: string;
424
444
  setting: string;
425
445
  file: string;
446
+ allowed?: boolean | undefined;
426
447
  } | undefined;
427
448
  end?: {
428
449
  seconds: number;
@@ -432,6 +453,10 @@ export declare function loopApi(initial?: {
432
453
  unsaved?: {
433
454
  count?: number | undefined;
434
455
  } | undefined;
456
+ scenes?: {
457
+ key: string;
458
+ title: string;
459
+ }[] | undefined;
435
460
  } | undefined;
436
461
  }[];
437
462
  }>;
@@ -460,6 +485,7 @@ export declare function loopApi(initial?: {
460
485
  model?: Partial<Record<"coding" | "design" | "fixes" | "planning" | "tests" | "validation", string>> | undefined;
461
486
  effort?: Partial<Record<"coding" | "design" | "fixes" | "planning" | "tests" | "validation", "auto" | "high" | "low" | "max" | "medium" | "xhigh">> | undefined;
462
487
  level: "auto" | "guide" | "lead" | "review";
488
+ neverAsk?: boolean | undefined;
463
489
  } | null;
464
490
  found: {
465
491
  id: "antigravity" | "claude" | "codex" | "cursor" | "grok" | "muse" | "opencode";
@@ -657,6 +683,7 @@ export declare function loopApi(initial?: {
657
683
  who: string;
658
684
  place: string;
659
685
  main: boolean;
686
+ planned?: string | undefined;
660
687
  }[];
661
688
  notes: string[];
662
689
  problem?: string | undefined;
@@ -744,7 +771,7 @@ export declare function loopApi(initial?: {
744
771
  at: string;
745
772
  commit: string;
746
773
  change?: string | undefined;
747
- direction?: "neutral" | "soft" | undefined;
774
+ direction?: "bold" | "clear" | "neutral" | "soft" | "warm" | undefined;
748
775
  version?: number | undefined;
749
776
  screen?: string | undefined;
750
777
  revert?: string | undefined;
@@ -766,6 +793,7 @@ export declare function loopApi(initial?: {
766
793
  } | undefined;
767
794
  committedLevel?: "auto" | "guide" | "lead" | "review" | undefined;
768
795
  effectiveLevel?: "auto" | "guide" | "lead" | "review" | undefined;
796
+ neverAsk?: boolean | undefined;
769
797
  level?: {
770
798
  source: "host";
771
799
  where: string;
@@ -1,4 +1,5 @@
1
1
  import { useEffect, useState } from 'react';
2
+ import { addressedScene } from './scene-address.js';
2
3
  /** Playback belongs to the container; any other canvas choice stops it. */
3
4
  export function usePrototypeUi(journeys, journey, version) {
4
5
  const [ui, setUi] = useState({ journey, version });
@@ -15,6 +16,19 @@ export function usePrototypeUi(journeys, journey, version) {
15
16
  }, 1000);
16
17
  return () => clearInterval(timer);
17
18
  }, [ui.playing, last]);
19
+ // A reply's scene link opens its scene once, then the address is the page again.
20
+ useEffect(() => {
21
+ const take = () => {
22
+ const screen = addressedScene(window.location.hash);
23
+ if (!screen)
24
+ return;
25
+ setUi((current) => ({ ...current, screen, playing: false }));
26
+ window.history.replaceState(null, '', '#/prototype');
27
+ };
28
+ take();
29
+ window.addEventListener('hashchange', take);
30
+ return () => window.removeEventListener('hashchange', take);
31
+ }, []);
18
32
  const update = (patch) => setUi((current) => ({ ...current, ...patch, playing: false }));
19
33
  const player = (action) => {
20
34
  setUi((current) => ({
@@ -11,13 +11,13 @@ export declare const workCallbacks: (actions: StudioActions) => {
11
11
  * approval asks the same rule, changeNeedsPrototype).
12
12
  */
13
13
  export declare function codingPrerequisite(state: StudioState | null, change?: string): {
14
+ reason?: undefined;
14
15
  readonly status: 'no-change';
15
- readonly reason?: undefined;
16
16
  readonly noScreens?: undefined;
17
17
  readonly version?: undefined;
18
18
  } | {
19
+ reason?: undefined;
19
20
  readonly status: 'unknown';
20
- readonly reason?: undefined;
21
21
  readonly noScreens?: undefined;
22
22
  readonly version?: undefined;
23
23
  } | {
@@ -26,28 +26,28 @@ export declare function codingPrerequisite(state: StudioState | null, change?: s
26
26
  readonly noScreens?: undefined;
27
27
  readonly version?: undefined;
28
28
  } | {
29
- readonly reason?: undefined;
29
+ reason?: undefined;
30
30
  readonly status: 'ready';
31
31
  readonly noScreens: true;
32
32
  readonly version?: undefined;
33
33
  } | {
34
- readonly reason?: undefined;
34
+ reason?: undefined;
35
35
  readonly noScreens?: undefined;
36
36
  readonly status: 'missing';
37
37
  readonly version?: undefined;
38
38
  } | {
39
- readonly reason?: undefined;
39
+ reason?: undefined;
40
40
  readonly noScreens?: undefined;
41
41
  readonly status: 'unknown';
42
42
  readonly version: number;
43
43
  } | {
44
- readonly reason?: undefined;
44
+ reason?: undefined;
45
45
  readonly noScreens?: undefined;
46
46
  readonly status: "ready" | "unapproved";
47
47
  readonly version: number;
48
48
  readonly newer?: undefined;
49
49
  } | {
50
- readonly reason?: undefined;
50
+ reason?: undefined;
51
51
  readonly noScreens?: undefined;
52
52
  readonly status: "ready" | "unapproved";
53
53
  readonly version: number;
@@ -0,0 +1,3 @@
1
+ import { type Theme, type ThemeOverrides } from '@buffcore/tokens';
2
+ /** Run `checkTheme` on the result; `createUiServer({ theme })` refuses one with any problem. */
3
+ export declare function extendStudioTheme(overrides: ThemeOverrides): Theme;
@@ -0,0 +1,14 @@
1
+ // A host's theme for the studio: the studio's own theme with the host's tokens over it. `extendTheme`
2
+ // takes starter themes only (one level deep), and the studio's theme is already one level down, so
3
+ // this does the same one step on top of it and keeps the studio's two set-aside checks.
4
+ import { extendTheme } from '@buffcore/tokens';
5
+ import { theme as studioTheme } from './theme.js';
6
+ /** Run `checkTheme` on the result; `createUiServer({ theme })` refuses one with any problem. */
7
+ export function extendStudioTheme(overrides) {
8
+ const { extends: _starter, ...base } = studioTheme;
9
+ return {
10
+ ...extendTheme(base, overrides),
11
+ extends: studioTheme.key,
12
+ ...(studioTheme.allow ? { allow: studioTheme.allow } : {}),
13
+ };
14
+ }
@@ -6,6 +6,7 @@ export { mountStudio, type StudioMountProps, StudioRoot } from './app/mount.tsx'
6
6
  export type { HostPart, HostParts } from './app/places.ts';
7
7
  export { StudioApp, type StudioAppProps } from './app/StudioApp.tsx';
8
8
  export { workbenchCatalog } from './catalog.ts';
9
+ export { extendStudioTheme } from './host-theme.ts';
9
10
  export * from './studio/index.ts';
10
11
  export { theme as studioTheme } from './theme.ts';
11
12
  export * from './types.ts';
@@ -4,6 +4,7 @@ export { frameProps } from './app/frame.js';
4
4
  export { mountStudio, StudioRoot } from './app/mount.js';
5
5
  export { StudioApp } from './app/StudioApp.js';
6
6
  export { workbenchCatalog } from './catalog.js';
7
+ export { extendStudioTheme } from './host-theme.js';
7
8
  export * from './studio/index.js';
8
9
  export { theme as studioTheme } from './theme.js';
9
10
  export * from './types.js';
@@ -0,0 +1,16 @@
1
+ import { type CSSProperties } from 'react';
2
+ import type { TurnControls } from './panelControls.ts';
3
+ import type { PanelMessage } from './panelLines.ts';
4
+ export declare const chatCard: CSSProperties;
5
+ interface Props {
6
+ permission: NonNullable<PanelMessage['permission']>;
7
+ agent: string;
8
+ /** The notice's place in the chat: the server reads the folder from it, never from the page. */
9
+ at: number;
10
+ turn: TurnControls & {
11
+ onAllowFolder: NonNullable<TurnControls['onAllowFolder']>;
12
+ };
13
+ }
14
+ /** The folder a refused read named, with one click to allow it and one to go on without it. */
15
+ export declare function AllowFolderCard({ permission, agent, at, turn }: Props): import("react").JSX.Element;
16
+ export {};
@@ -0,0 +1,63 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useT } from '@buffcore/i18n/react';
3
+ import { useState } from 'react';
4
+ import { Button } from '../../../components/Button.js';
5
+ import { Icon } from '../../../components/Icon.js';
6
+ import { bodyText, captionText, monoText } from '../../../components/styles.js';
7
+ import { folderButtonStyle } from './TurnControls.js';
8
+ export const chatCard = {
9
+ ...bodyText,
10
+ display: 'grid',
11
+ gap: 'var(--space-3)',
12
+ minInlineSize: 0,
13
+ padding: 'var(--space-4)',
14
+ borderRadius: 'var(--radius-panel)',
15
+ border: 'var(--border-width-hairline) solid var(--border-default)',
16
+ background: 'var(--surface-card, var(--surface-panel))',
17
+ };
18
+ const title = {
19
+ ...bodyText,
20
+ margin: 0,
21
+ fontWeight: 'var(--weight-semibold)',
22
+ color: 'var(--text-strong)',
23
+ };
24
+ const fine = { ...captionText, margin: 0, fontWeight: 'normal' };
25
+ /** The folder a refused read named, with one click to allow it and one to go on without it. */
26
+ export function AllowFolderCard({ permission, agent, at, turn }) {
27
+ const t = useT();
28
+ const [step, setStep] = useState(permission.allowed ? { kind: 'allowed', retried: false } : { kind: 'ask' });
29
+ if (step.kind === 'allowed')
30
+ return (_jsx("li", { children: _jsxs("p", { role: "status", style: {
31
+ ...bodyText,
32
+ margin: 0,
33
+ color: 'var(--success-ink)',
34
+ display: 'flex',
35
+ gap: 'var(--space-2)',
36
+ alignItems: 'center',
37
+ }, children: [_jsx(Icon, { name: "check", size: "var(--icon-sm)" }), t(step.retried
38
+ ? 'studio.frame.allow.retrying'
39
+ : permission.allowed
40
+ ? 'studio.frame.allow.done'
41
+ : 'studio.frame.allow.askAgain', { agent })] }) }));
42
+ const allow = async () => {
43
+ setStep({ kind: 'allowing' });
44
+ const answer = await turn.onAllowFolder(at).catch(() => '');
45
+ if (answer !== true) {
46
+ setStep({ kind: 'failed', text: answer || t('studio.frame.allow.failed') });
47
+ return;
48
+ }
49
+ const retry = turn.onRetry;
50
+ setStep({ kind: 'allowed', retried: !!retry });
51
+ retry?.();
52
+ };
53
+ return (_jsx("li", { children: _jsxs("div", { style: chatCard, children: [_jsx("p", { style: title, children: t('studio.frame.allow.title', { agent }) }), _jsx("p", { style: { margin: 0 }, children: t('studio.frame.allow.why') }), _jsx("p", { translate: "no", style: {
54
+ ...monoText,
55
+ margin: 0,
56
+ padding: 'var(--space-2) var(--space-3)',
57
+ borderRadius: 'var(--radius-control)',
58
+ background: 'var(--surface-sunken)',
59
+ border: 'var(--border-width-hairline) solid var(--border-hairline)',
60
+ color: 'var(--text-strong)',
61
+ overflowWrap: 'anywhere',
62
+ }, children: permission.path }), _jsxs("span", { style: { display: 'flex', flexWrap: 'wrap', gap: 'var(--space-2)' }, children: [_jsx(Button, { size: "lg", variant: "primary", style: folderButtonStyle, disabled: step.kind === 'allowing', onClick: allow, children: t(step.kind === 'allowing' ? 'studio.frame.allow.allowing' : 'studio.frame.allow.allow') }), _jsx(Button, { size: "lg", variant: "secondary", style: folderButtonStyle, disabled: !turn.onSkip || step.kind === 'allowing', onClick: turn.onSkip, children: t('studio.frame.allow.notNow') })] }), step.kind === 'failed' && (_jsx("p", { role: "alert", style: { margin: 0, color: 'var(--text-strong)', overflowWrap: 'anywhere' }, children: step.text })), _jsx("p", { style: fine, children: t('studio.frame.allow.fine') })] }) }));
63
+ }
@@ -0,0 +1,3 @@
1
+ export declare function HostRailEntries({ collapsed }: {
2
+ collapsed: boolean;
3
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // A host's rail entries at the rail's end, as ordinary rail rows under the host's name. Each opens
3
+ // its module on the `page` place, in the same main area as the studio's own pages.
4
+ import { Icon } from '../../../components/Icon.js';
5
+ import { ICON_PATHS } from '../../../components/icons.js';
6
+ import { usePlaces } from '../../app/places.js';
7
+ import { eyebrow, Row } from './railParts.js';
8
+ const iconOf = (name) => name && Object.hasOwn(ICON_PATHS, name) ? name : 'layers';
9
+ export function HostRailEntries({ collapsed }) {
10
+ const host = usePlaces();
11
+ const rail = host?.rail;
12
+ if (!host || !rail?.entries.length)
13
+ return null;
14
+ return (_jsxs("div", { "data-studio-place": "rail.end", "data-host-rail": "", style: { display: 'grid', gap: 'var(--space-1)', marginBlockStart: 'var(--space-3)' }, children: [rail.label && !collapsed && (_jsx("span", { style: eyebrow, translate: "no", children: rail.label })), rail.entries.map((entry) => (_jsxs(Row, { on: host.selected?.place === 'page' && host.selected.id === entry.id, collapsed: collapsed, label: entry.label, onClick: () => host.select('page', entry.id), children: [_jsx(Icon, { name: iconOf(entry.icon), size: "var(--icon-md)" }), !collapsed && (_jsx("span", { style: { flex: 1, minWidth: 0 }, translate: "no", children: entry.label }))] }, entry.id)))] }));
15
+ }
@@ -0,0 +1,6 @@
1
+ import type { HostSubjects } from '@buffcore/contracts/workbench';
2
+ import { type ReactNode } from 'react';
3
+ export declare function HostSide({ subject, children, }: {
4
+ subject: HostSubjects['side:prototype'];
5
+ children: ReactNode;
6
+ }): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | Iterable<ReactNode> | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | import("react").ReactPortal | null | undefined> | null | undefined;
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useT } from '@buffcore/i18n/react';
3
+ import { useState } from 'react';
4
+ import { Tabs } from '../../../components/Tabs.js';
5
+ import { usePlaces } from '../../app/places.js';
6
+ import { usePrototypeNarrow } from './layout.js';
7
+ import { Place } from './Place.js';
8
+ export function HostSide({ subject, children, }) {
9
+ const t = useT();
10
+ const host = usePlaces();
11
+ const narrow = usePrototypeNarrow();
12
+ const [tab, setTab] = useState('page');
13
+ const parts = host?.parts?.['side:prototype'];
14
+ if (!parts?.length)
15
+ return children;
16
+ const side = _jsx(Place, { id: "side:prototype", subject: subject });
17
+ if (narrow) {
18
+ const label = parts.find((part) => part.label)?.label ?? host?.rail?.label ?? t('host.place.side');
19
+ return (_jsxs("div", { "data-host-side": "tabs", style: { display: 'grid', gridTemplateRows: 'auto minmax(0, 1fr)', blockSize: '100%' }, children: [_jsx(Tabs, { tabs: [
20
+ ['page', t('studio.frame.page.prototype')],
21
+ ['host', label],
22
+ ], value: tab, onChange: setTab }), _jsx("div", { hidden: tab !== 'page', style: { display: tab === 'page' ? 'contents' : 'none' }, children: children }), _jsx("div", { role: "tabpanel", hidden: tab !== 'host', style: { display: tab === 'host' ? 'block' : 'none', padding: 'var(--space-3)' }, children: side })] }));
23
+ }
24
+ return (_jsxs("div", { "data-host-side": "beside", style: {
25
+ display: 'grid',
26
+ gridTemplateColumns: 'minmax(0, 1fr) minmax(0, 20rem)',
27
+ gap: 'var(--space-4)',
28
+ blockSize: '100%',
29
+ paddingInlineEnd: 'var(--space-4)',
30
+ }, children: [_jsx("div", { style: { minBlockSize: 0, minInlineSize: 0, display: 'grid' }, children: children }), _jsx("aside", { style: { paddingBlock: 'var(--space-4)', display: 'grid', alignContent: 'start' }, children: side })] }));
31
+ }
@@ -38,11 +38,12 @@ function useLevelCue(level) {
38
38
  ? 'studio.level.bar.saving'
39
39
  : 'studio.level.bar.unconfirmed', { level: name });
40
40
  // The last save's answer shows on the chip too, so a closed sheet is not silent about it.
41
- const cue = choice.status === 'refused'
41
+ const said = choice.status === 'refused'
42
42
  ? t('studio.level.bar.refused', { level: label })
43
43
  : choice.status === 'partial'
44
44
  ? t('studio.level.bar.partial', { level: label })
45
45
  : label;
46
+ const cue = choice.neverAsk ? t('studio.level.neverAsk.chip', { level: said }) : said;
46
47
  return { choice, cue: cue ?? '' };
47
48
  }
48
49
  /** The level as a quiet chip; it opens the level's choices. */
@@ -6,6 +6,7 @@ import { Button } from '../../../components/Button.js';
6
6
  import { Panel } from '../../../components/Panel.js';
7
7
  import { bodyText, captionText } from '../../../components/styles.js';
8
8
  import { LEVELS as levels } from '../types.js';
9
+ import { NeverAskSetting } from './NeverAskSetting.js';
9
10
  export const stack = { display: 'grid', gap: 'var(--space-3)', minInlineSize: 0 };
10
11
  export const buttonStyle = {
11
12
  whiteSpace: 'normal',
@@ -50,17 +51,32 @@ const busyLook = {
50
51
  border: 'var(--border-width-control) solid var(--border-control)',
51
52
  cursor: 'default',
52
53
  };
54
+ /** The chosen Autopilot card, holding its choice and the Never ask switch on one tint. */
55
+ const chosenCard = {
56
+ display: 'grid',
57
+ alignContent: 'start',
58
+ minInlineSize: 0,
59
+ background: 'var(--brand-tint)',
60
+ borderRadius: 'var(--radius-control)',
61
+ };
62
+ const plainCard = { display: 'grid', minInlineSize: 0 };
53
63
  function ChoiceButtons({ store, onLevel, choices }) {
54
64
  const t = useT();
55
65
  const busy = store.status === 'pending';
56
- return (_jsx("fieldset", { ref: choices, "aria-label": t('studio.level.choices'), style: { ...columns, border: 0, padding: 0, margin: 0 }, children: levels.map((level) => (_jsxs(Button, { size: "lg", variant: store.proposed === level ? 'tonal' : 'secondary', "aria-label": t(`studio.level.level.${level}`), "aria-pressed": store.proposed === level, "aria-describedby": `studio-level-description-${level}${store.status === 'pending' ? ' studio-level-hold' : ''}${!onLevel ? ' studio-level-right' : ''}`, disabled: !onLevel, "aria-disabled": busy || undefined, onClick: () => !busy && onLevel?.(level), style: {
57
- ...buttonStyle,
58
- ...(busy ? busyLook : {}),
59
- ...stack,
60
- textAlign: 'start',
61
- alignContent: 'start',
62
- justifyContent: 'stretch',
63
- }, children: [_jsx("strong", { children: t(`studio.level.level.${level}`) }), _jsx("span", { id: `studio-level-description-${level}`, style: { fontWeight: 'var(--weight-regular)' }, children: t(`studio.level.description.${level}`) })] }, level))) }));
66
+ return (_jsx("fieldset", { ref: choices, "aria-label": t('studio.level.choices'), style: { ...columns, border: 0, padding: 0, margin: 0 }, children: levels.map((level) => {
67
+ const choice = (_jsxs(Button, { size: "lg", variant: store.proposed === level ? 'tonal' : 'secondary', "aria-label": t(`studio.level.level.${level}`), "aria-pressed": store.proposed === level, "aria-describedby": `studio-level-description-${level}${store.status === 'pending' ? ' studio-level-hold' : ''}${!onLevel ? ' studio-level-right' : ''}`, disabled: !onLevel, "aria-disabled": busy || undefined, onClick: () => !busy && onLevel?.(level), style: {
68
+ ...buttonStyle,
69
+ ...(busy ? busyLook : {}),
70
+ ...stack,
71
+ textAlign: 'start',
72
+ alignContent: 'start',
73
+ justifyContent: 'stretch',
74
+ }, children: [_jsx("strong", { children: t(`studio.level.level.${level}`) }), _jsx("span", { id: `studio-level-description-${level}`, style: { fontWeight: 'var(--weight-regular)' }, children: t(`studio.level.description.${level}`) })] }));
75
+ // "Never ask" sits inside the Autopilot card, only while Autopilot is the chosen level. Each
76
+ // choice keeps its wrapper, so a click that chooses Autopilot keeps the button and its focus.
77
+ const never = level === 'auto' && (store.proposed ?? store.effective) === 'auto';
78
+ return (_jsxs("div", { "data-level-card": level, style: never ? chosenCard : plainCard, children: [choice, never && (_jsx("div", { style: { paddingInline: 'var(--space-4)', paddingBlockEnd: 'var(--space-3)' }, children: _jsx(NeverAskSetting, { on: !!store.neverAsk, onChange: store.onNeverAsk }) }))] }, level));
79
+ }) }));
64
80
  }
65
81
  function DesignPromises({ store }) {
66
82
  const t = useT();
@@ -0,0 +1,7 @@
1
+ interface Props {
2
+ on: boolean;
3
+ /** Absent without the settings right, or while the level is chosen elsewhere. */
4
+ onChange?: (on: boolean) => void;
5
+ }
6
+ export declare function NeverAskSetting({ on, onChange }: Props): import("react").JSX.Element;
7
+ export {};