@buffcore/admin-shell 0.8.45 → 0.8.47

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 (38) hide show
  1. package/dist/prototype/SceneBoundary.js +1 -1
  2. package/dist/prototype/SceneSignal.d.ts +2 -1
  3. package/dist/prototype/SceneSignal.js +12 -1
  4. package/dist/prototype/scene-status.d.ts +1 -2
  5. package/dist/prototype/scene-status.js +1 -2
  6. package/dist/prototype/scene.d.ts +1 -1
  7. package/dist/prototype/scene.js +20 -3
  8. package/dist/screens/assistant/use-ask.d.ts +16 -0
  9. package/dist/workbench/app/ServedPrototype.js +1 -0
  10. package/dist/workbench/app/ServedWork.js +4 -3
  11. package/dist/workbench/app/__snapshots__/places-dom.test.tsx.snap +1 -1
  12. package/dist/workbench/app/actions.d.ts +2 -0
  13. package/dist/workbench/app/actions.js +1 -0
  14. package/dist/workbench/app/places.d.ts +4 -0
  15. package/dist/workbench/app/prototype-comp.d.ts +4 -0
  16. package/dist/workbench/app/prototype.js +1 -0
  17. package/dist/workbench/app/test/loop-fixture.d.ts +66 -0
  18. package/dist/workbench/app/useStudio.d.ts +1 -0
  19. package/dist/workbench/app/work.js +1 -0
  20. package/dist/workbench/studio/i18n/later.en.d.ts +7 -0
  21. package/dist/workbench/studio/i18n/later.en.js +8 -1
  22. package/dist/workbench/studio/i18n/later.es.json +8 -1
  23. package/dist/workbench/studio/i18n/prototype.en.d.ts +4 -0
  24. package/dist/workbench/studio/i18n/prototype.en.js +4 -0
  25. package/dist/workbench/studio/i18n/prototype.es.json +5 -1
  26. package/dist/workbench/studio/loop/ProtoApprovalRecord.d.ts +10 -0
  27. package/dist/workbench/studio/loop/ProtoApprovalRecord.js +51 -0
  28. package/dist/workbench/studio/loop/ProtoCompare.d.ts +1 -7
  29. package/dist/workbench/studio/loop/ProtoCompare.js +3 -39
  30. package/dist/workbench/studio/loop/PrototypePage.d.ts +2 -0
  31. package/dist/workbench/studio/loop/PrototypeReview.js +2 -2
  32. package/dist/workbench/studio/loop/types.d.ts +5 -0
  33. package/dist/workbench/studio/work/DrawnWorkPage.js +2 -2
  34. package/dist/workbench/studio/work/FirstBuild.d.ts +5 -1
  35. package/dist/workbench/studio/work/FirstBuild.js +19 -1
  36. package/dist/workbench/studio/work/types.d.ts +8 -0
  37. package/dist/workbench/studio/work/work-test-data.d.ts +33 -0
  38. package/package.json +6 -6
@@ -15,5 +15,5 @@ class ContentBoundary extends Component {
15
15
  /** Both boundaries own the view and its sibling signal; fallbacks never report ready. */
16
16
  export function SceneBoundary({ children, sceneKey }) {
17
17
  const t = useT();
18
- return (_jsx(ContentBoundary, { fallback: _jsxs(_Fragment, { children: [_jsx(SceneSignal, { sceneKey: sceneKey, status: "failed" }), _jsx(EmptyState, { title: t('admin.crash.title') })] }), children: _jsx(Suspense, { fallback: _jsxs(_Fragment, { children: [_jsx(SceneSignal, { sceneKey: sceneKey, status: "loading" }), _jsx(Loading, {})] }), children: children }) }));
18
+ return (_jsx(ContentBoundary, { fallback: _jsxs(_Fragment, { children: [_jsx(SceneSignal, { sceneKey: sceneKey, status: "failed" }), _jsx(EmptyState, { title: t('admin.crash.title') })] }), children: _jsx(Suspense, { fallback: _jsxs(_Fragment, { children: [_jsx(SceneSignal, { sceneKey: sceneKey, status: "loading" }), _jsx("span", { hidden: true, "data-prototype-pending": true }), _jsx(Loading, {})] }), children: children }) }));
19
19
  }
@@ -5,7 +5,8 @@ export declare function SceneSignal({ sceneKey, status }: {
5
5
  status: Status;
6
6
  }): null;
7
7
  /** This sibling commits only when the view's Suspense/error boundary commits its content. */
8
- export declare function ReadySignal({ sceneKey }: {
8
+ export declare function ReadySignal({ sceneKey, search }: {
9
9
  sceneKey: string;
10
+ search: string;
10
11
  }): import("react").JSX.Element;
11
12
  export {};
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { SCENE_LOOK_ATTR, SCENE_LOOK_REUSABLE } from '@buffcore/contracts/prototype';
2
3
  import { useEffect, useLayoutEffect, useReducer, useRef } from 'react';
3
4
  import { SCENE_STATUS } from './scene-status.js';
4
5
  const report = (sceneKey, status) => window.parent.postMessage({ type: SCENE_STATUS, key: sceneKey, status }, '*');
@@ -42,6 +43,16 @@ export function SceneSignal({ sceneKey, status }) {
42
43
  return null;
43
44
  }
44
45
  /** This sibling commits only when the view's Suspense/error boundary commits its content. */
45
- export function ReadySignal({ sceneKey }) {
46
+ export function ReadySignal({ sceneKey, search }) {
47
+ useLayoutEffect(() => {
48
+ const html = document.documentElement;
49
+ html.setAttribute(SCENE_LOOK_ATTR, search);
50
+ // Any view can move in place: the snapshot checks each scene against a fresh load.
51
+ html.setAttribute(SCENE_LOOK_REUSABLE, '');
52
+ return () => {
53
+ html.removeAttribute(SCENE_LOOK_ATTR);
54
+ html.removeAttribute(SCENE_LOOK_REUSABLE);
55
+ };
56
+ }, [search]);
46
57
  return _jsx(SceneSignal, { sceneKey: sceneKey, status: "ready" });
47
58
  }
@@ -1,2 +1 @@
1
- /** A rendered prototype scene's public identity, sent only to its embedding window. */
2
- export declare const SCENE_STATUS = "buffcore:prototype-scene";
1
+ export { SCENE_STATUS } from '@buffcore/contracts/prototype';
@@ -1,2 +1 @@
1
- /** A rendered prototype scene's public identity, sent only to its embedding window. */
2
- export const SCENE_STATUS = 'buffcore:prototype-scene';
1
+ export { SCENE_STATUS } from '@buffcore/contracts/prototype';
@@ -13,4 +13,4 @@ export interface AdminSceneProps {
13
13
  /** The page's query: `?key&theme&mode&locale`. */
14
14
  search: string;
15
15
  }
16
- export declare function AdminScene({ scenes, views, theme, themes, catalogs, search }: AdminSceneProps): import("react").JSX.Element;
16
+ export declare function AdminScene(props: AdminSceneProps): import("react").JSX.Element;
@@ -1,9 +1,11 @@
1
+ import { createElement as _createElement } from "react";
1
2
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
3
  // One admin scene at /_scene?key&theme&mode&locale: only its view, with its sample props, in the
3
4
  // asked theme, mode and language. No sign-in and no API calls: the view gets everything as props.
5
+ import { SCENE_LOOK_CHANGE } from '@buffcore/contracts/prototype';
4
6
  import { createI18n } from '@buffcore/i18n';
5
7
  import { I18nProvider, useT } from '@buffcore/i18n/react';
6
- import { useMemo } from 'react';
8
+ import { useLayoutEffect, useMemo, useState } from 'react';
7
9
  import { EmptyState } from '../components/states.js';
8
10
  import { PageLook } from './PageLook.js';
9
11
  import { SceneBoundary } from './SceneBoundary.js';
@@ -12,7 +14,22 @@ function Missing({ sceneKey }) {
12
14
  const t = useT();
13
15
  return _jsx(EmptyState, { icon: "circle-help", title: t('admin.prototype.missing', { key: sceneKey }) });
14
16
  }
15
- export function AdminScene({ scenes, views, theme, themes, catalogs, search }) {
17
+ export function AdminScene(props) {
18
+ const [moved, setMoved] = useState();
19
+ useLayoutEffect(() => {
20
+ const read = () => {
21
+ window.scrollTo({ top: 0, left: 0, behavior: 'instant' });
22
+ setMoved(window.location.search);
23
+ };
24
+ window.addEventListener(SCENE_LOOK_CHANGE, read);
25
+ return () => window.removeEventListener(SCENE_LOOK_CHANGE, read);
26
+ }, []);
27
+ // Only a move in place draws the look afresh, as a full load would. The router's own changes keep
28
+ // the page mounted and remount the view when the scene changes: remounting the whole look there
29
+ // made every scene the studio or a check steps through about 80 ms slower.
30
+ return _createElement(SceneLook, { ...props, key: moved, search: moved ?? props.search });
31
+ }
32
+ function SceneLook({ scenes, views, theme, themes, catalogs, search }) {
16
33
  const params = new URLSearchParams(search);
17
34
  const key = params.get('key') ?? '';
18
35
  const locale = params.get('locale') ?? 'en';
@@ -20,5 +37,5 @@ export function AdminScene({ scenes, views, theme, themes, catalogs, search }) {
20
37
  const look = themes.find((th) => th.key === params.get('theme')) ?? theme;
21
38
  const scene = scenes.find((s) => s.surface === 'admin' && s.key === key);
22
39
  const View = scene && views[scene.view];
23
- return (_jsx(I18nProvider, { translator: translator, children: _jsx(PageLook, { theme: look, mode: params.get('mode') ?? undefined, locale: locale, children: _jsx("div", { style: { height: '100dvh' }, children: scene && View ? (_jsxs(SceneBoundary, { sceneKey: key, children: [_jsx(View, { ...scene.props }), _jsx(ReadySignal, { sceneKey: key })] }, key)) : (_jsxs(_Fragment, { children: [_jsx(Missing, { sceneKey: key }), _jsx(SceneSignal, { sceneKey: key, status: "missing" })] })) }) }) }));
40
+ return (_jsx(I18nProvider, { translator: translator, children: _jsx(PageLook, { theme: look, mode: params.get('mode') ?? undefined, locale: locale, children: _jsx("div", { style: { height: '100dvh' }, children: scene && View ? (_jsxs(SceneBoundary, { sceneKey: key, children: [_jsx(View, { ...scene.props }), _jsx(ReadySignal, { sceneKey: key, search: search })] }, key)) : (_jsxs(_Fragment, { children: [_jsx(Missing, { sceneKey: key }), _jsx(SceneSignal, { sceneKey: key, status: "missing" })] })) }) }) }));
24
41
  }
@@ -100,6 +100,10 @@ export declare function useAsk(api: Client): {
100
100
  fingerprint: string;
101
101
  role?: string | undefined;
102
102
  agent?: string | undefined;
103
+ ai?: {
104
+ model?: string | undefined;
105
+ reason: string;
106
+ } | undefined;
103
107
  }[];
104
108
  rule?: {
105
109
  kind: "one";
@@ -218,6 +222,10 @@ export declare function useAsk(api: Client): {
218
222
  fingerprint: string;
219
223
  role?: string | undefined;
220
224
  agent?: string | undefined;
225
+ ai?: {
226
+ model?: string | undefined;
227
+ reason: string;
228
+ } | undefined;
221
229
  }[];
222
230
  rule?: {
223
231
  kind: "one";
@@ -393,6 +401,10 @@ export declare function useAsk(api: Client): {
393
401
  fingerprint: import("zod").ZodString;
394
402
  role: import("zod").ZodOptional<import("zod").ZodString>;
395
403
  agent: import("zod").ZodOptional<import("zod").ZodString>;
404
+ ai: import("zod").ZodOptional<import("zod").ZodObject<{
405
+ model: import("zod").ZodOptional<import("zod").ZodString>;
406
+ reason: import("zod").ZodString;
407
+ }, import("zod/v4/core").$strict>>;
396
408
  }, import("zod/v4/core").$strip>>;
397
409
  rule: import("zod").ZodOptional<import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
398
410
  kind: import("zod").ZodLiteral<"one">;
@@ -514,6 +526,10 @@ export declare function useAsk(api: Client): {
514
526
  fingerprint: string;
515
527
  role?: string | undefined;
516
528
  agent?: string | undefined;
529
+ ai?: {
530
+ model?: string | undefined;
531
+ reason: string;
532
+ } | undefined;
517
533
  }[];
518
534
  rule?: {
519
535
  kind: "one";
@@ -190,6 +190,7 @@ function versionHandlers(model) {
190
190
  !prototypeChecks(model))
191
191
  void signing.approve(() => actions.approvePrototype?.(change, number(view.version)));
192
192
  }),
193
+ onReopen: actions.reopenPrototype && (() => void actions.reopenPrototype?.(change)),
193
194
  onRecord: change && !model.snapshot.reply?.linked ? () => void recording.record() : undefined,
194
195
  onCompare: compare,
195
196
  onPair: sample.proto.versions.length >= 3 ? compare : undefined,
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useT } from '@buffcore/i18n/react';
3
3
  import { useLayoutEffect, useRef, useState } from 'react';
4
- import { ClashWarning, OneAtATime, Worktrees } from '../studio/work/FirstBuild.js';
4
+ import { ClashWarning, OneAtATime, OtherWorktrees, Worktrees } from '../studio/work/FirstBuild.js';
5
5
  import { Stack } from '../studio/work/parts.js';
6
6
  import { Waiting } from '../studio/work/Waiting.js';
7
7
  import { WorkPage } from '../studio/work/WorkPage.js';
@@ -118,7 +118,8 @@ function WorkFooter({ view, waiting, hold, onRelease, onPrototype, onChange, onC
118
118
  !cards?.length &&
119
119
  !first?.queue &&
120
120
  !first?.clashes?.length &&
121
- !first?.worktrees.length)
121
+ !first?.worktrees.length &&
122
+ !first?.others?.length)
122
123
  return null;
123
- return (_jsxs(Stack, { children: [hold, _jsx(Waiting, { list: waiting, onAction: onRelease, onPrototype: onPrototype, onChange: onChange, cards: cards }), first?.queue && _jsx(OneAtATime, { q: first.queue }), first?.clashes?.map((clash) => (_jsx(ClashWarning, { onBoth: onClash, clash: clash }, `${clash.a}/${clash.b}`))), !!first?.worktrees.length && (_jsxs("details", { children: [_jsx("summary", { style: { minBlockSize: 'var(--target)', cursor: 'pointer' }, children: t('studio.later.wt.title') }), _jsx(Worktrees, { list: first.worktrees, where: t('studio.frame.rail.computerShort') })] }))] }));
124
+ return (_jsxs(Stack, { children: [hold, _jsx(Waiting, { list: waiting, onAction: onRelease, onPrototype: onPrototype, onChange: onChange, cards: cards }), first?.queue && _jsx(OneAtATime, { q: first.queue }), first?.clashes?.map((clash) => (_jsx(ClashWarning, { onBoth: onClash, clash: clash }, `${clash.a}/${clash.b}`))), !!first?.worktrees.length && (_jsxs("details", { children: [_jsx("summary", { style: { minBlockSize: 'var(--target)', cursor: 'pointer' }, children: t('studio.later.wt.title') }), _jsx(Worktrees, { list: first.worktrees, where: t('studio.frame.rail.computerShort') })] })), !!first?.others?.length && (_jsxs("details", { children: [_jsx("summary", { style: { minBlockSize: 'var(--target)', cursor: 'pointer' }, children: t('studio.later.wt.others') }), _jsx(OtherWorktrees, { list: first.others })] }))] }));
124
125
  }