@buffcore/admin-shell 0.8.42 → 0.8.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist/screens/assistant/use-ask.d.ts +4 -3
  2. package/dist/workbench/app/ServedAgents.js +4 -1
  3. package/dist/workbench/app/ServedComp.d.ts +3 -0
  4. package/dist/workbench/app/ServedComp.js +33 -0
  5. package/dist/workbench/app/ServedPrototype.d.ts +2 -0
  6. package/dist/workbench/app/ServedPrototype.js +15 -1
  7. package/dist/workbench/app/__snapshots__/places-dom.test.tsx.snap +30 -3
  8. package/dist/workbench/app/actions.d.ts +7 -0
  9. package/dist/workbench/app/actions.js +1 -0
  10. package/dist/workbench/app/chat-session.d.ts +2 -0
  11. package/dist/workbench/app/chat.d.ts +2 -0
  12. package/dist/workbench/app/frame.js +5 -1
  13. package/dist/workbench/app/fresh.d.ts +63 -0
  14. package/dist/workbench/app/fresh.js +66 -0
  15. package/dist/workbench/app/pages.js +10 -2
  16. package/dist/workbench/app/places.d.ts +1 -1
  17. package/dist/workbench/app/prototype-comp.d.ts +46 -0
  18. package/dist/workbench/app/prototype-comp.js +77 -0
  19. package/dist/workbench/app/prototype.d.ts +1 -1
  20. package/dist/workbench/app/prototype.js +3 -1
  21. package/dist/workbench/app/test/loop-fixture.d.ts +15 -8
  22. package/dist/workbench/app/useStudio.d.ts +43 -1
  23. package/dist/workbench/app/useStudio.js +8 -1
  24. package/dist/workbench/app/work.d.ts +7 -7
  25. package/dist/workbench/studio/frame/Composer.js +13 -10
  26. package/dist/workbench/studio/frame/LimitCard.d.ts +5 -0
  27. package/dist/workbench/studio/frame/LimitCard.js +26 -0
  28. package/dist/workbench/studio/frame/PanelMessage.js +3 -0
  29. package/dist/workbench/studio/frame/SettingsSheet.js +10 -9
  30. package/dist/workbench/studio/frame/StudioFrame.js +4 -3
  31. package/dist/workbench/studio/frame/panelLines.d.ts +1 -0
  32. package/dist/workbench/studio/frame/panelLines.js +2 -1
  33. package/dist/workbench/studio/frame/scrollbars.d.ts +1 -0
  34. package/dist/workbench/studio/frame/scrollbars.js +10 -0
  35. package/dist/workbench/studio/frame/useTurnDraft.d.ts +2 -0
  36. package/dist/workbench/studio/frame/useTurnDraft.js +12 -9
  37. package/dist/workbench/studio/i18n/comp.en.d.ts +26 -0
  38. package/dist/workbench/studio/i18n/comp.en.js +26 -0
  39. package/dist/workbench/studio/i18n/comp.es.d.ts +26 -0
  40. package/dist/workbench/studio/i18n/comp.es.js +25 -0
  41. package/dist/workbench/studio/i18n/frame.en.d.ts +16 -0
  42. package/dist/workbench/studio/i18n/frame.en.js +16 -0
  43. package/dist/workbench/studio/i18n/frame.es.json +17 -1
  44. package/dist/workbench/studio/i18n/fresh.en.d.ts +19 -0
  45. package/dist/workbench/studio/i18n/fresh.en.js +20 -0
  46. package/dist/workbench/studio/i18n/fresh.es.json +18 -0
  47. package/dist/workbench/studio/i18n/index.js +6 -0
  48. package/dist/workbench/studio/loop/AgentsPage.d.ts +4 -1
  49. package/dist/workbench/studio/loop/AgentsPage.js +5 -4
  50. package/dist/workbench/studio/loop/CritiqueNote.d.ts +4 -0
  51. package/dist/workbench/studio/loop/CritiqueNote.js +9 -0
  52. package/dist/workbench/studio/loop/FreshLookPanel.d.ts +21 -0
  53. package/dist/workbench/studio/loop/FreshLookPanel.js +60 -0
  54. package/dist/workbench/studio/loop/PrototypeApp.d.ts +9 -0
  55. package/dist/workbench/studio/loop/PrototypeApp.js +6 -4
  56. package/dist/workbench/studio/loop/PrototypeAttempt.d.ts +2 -1
  57. package/dist/workbench/studio/loop/PrototypeAttempt.js +40 -16
  58. package/dist/workbench/studio/loop/PrototypeComp.d.ts +25 -0
  59. package/dist/workbench/studio/loop/PrototypeComp.js +78 -0
  60. package/dist/workbench/studio/loop/PrototypePage.d.ts +7 -0
  61. package/dist/workbench/studio/loop/PrototypePage.js +1 -1
  62. package/dist/workbench/studio/loop/PrototypePreview.js +34 -29
  63. package/dist/workbench/studio/loop/PrototypeSimplePage.js +11 -4
  64. package/dist/workbench/studio/loop/PrototypeSnapshot.d.ts +3 -0
  65. package/dist/workbench/studio/loop/PrototypeSnapshot.js +2 -1
  66. package/dist/workbench/studio/loop/ReviewSetting.d.ts +6 -0
  67. package/dist/workbench/studio/loop/ReviewSetting.js +14 -0
  68. package/dist/workbench/studio/loop/SaveStep.d.ts +3 -0
  69. package/dist/workbench/studio/loop/SaveStep.js +3 -1
  70. package/dist/workbench/studio/loop/ServedPlanning.js +1 -1
  71. package/dist/workbench/studio/loop/StructurePage.d.ts +5 -0
  72. package/dist/workbench/studio/loop/StructurePage.js +3 -2
  73. package/dist/workbench/studio/loop/SurfaceChoice.d.ts +7 -0
  74. package/dist/workbench/studio/loop/SurfaceChoice.js +20 -0
  75. package/dist/workbench/studio/loop/prototype-bridge.d.ts +8 -0
  76. package/dist/workbench/studio/loop/prototype-bridge.js +16 -0
  77. package/dist/workbench/studio/loop/prototype-document.d.ts +7 -0
  78. package/dist/workbench/studio/loop/prototype-document.js +78 -2
  79. package/dist/workbench/studio/loop/usePlanningDraft.js +5 -1
  80. package/dist/workbench/studio/loop/usePrototypeFrame.d.ts +3 -1
  81. package/dist/workbench/studio/loop/usePrototypeFrame.js +2 -0
  82. package/dist/workbench/studio/types.d.ts +2 -0
  83. package/dist/workbench/studio/work/work-test-data.d.ts +7 -4
  84. package/package.json +6 -6
@@ -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;
15
14
  readonly status: 'no-change';
15
+ readonly reason?: undefined;
16
16
  readonly noScreens?: undefined;
17
17
  readonly version?: undefined;
18
18
  } | {
19
- reason?: undefined;
20
19
  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
- reason?: undefined;
29
+ readonly reason?: undefined;
30
30
  readonly status: 'ready';
31
31
  readonly noScreens: true;
32
32
  readonly version?: undefined;
33
33
  } | {
34
- reason?: undefined;
34
+ readonly reason?: undefined;
35
35
  readonly noScreens?: undefined;
36
36
  readonly status: 'missing';
37
37
  readonly version?: undefined;
38
38
  } | {
39
- reason?: undefined;
39
+ readonly reason?: undefined;
40
40
  readonly noScreens?: undefined;
41
41
  readonly status: 'unknown';
42
42
  readonly version: number;
43
43
  } | {
44
- reason?: undefined;
44
+ readonly 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
- reason?: undefined;
50
+ readonly reason?: undefined;
51
51
  readonly noScreens?: undefined;
52
52
  readonly status: "ready" | "unapproved";
53
53
  readonly version: number;
@@ -8,6 +8,7 @@ import { captionText } from '../../../components/styles.js';
8
8
  import { TextArea } from '../../../components/TextArea.js';
9
9
  import { ReasonButton } from './ReasonButton.js';
10
10
  import { Unready } from './TurnControls.js';
11
+ import { withTyped } from './useTurnDraft.js';
11
12
  function Attachments({ agent, onRemoveAttachment }) {
12
13
  const t = useT();
13
14
  if (!agent.attachments?.length)
@@ -45,23 +46,25 @@ function useDraft({ agent, onSend }) {
45
46
  return;
46
47
  if (agent.running)
47
48
  return agent.turn?.composer?.onQueue?.();
48
- const clear = (result) => {
49
- if (result !== false)
50
- setDraft('');
49
+ // The words leave the box at once; a refused send puts them back before anything typed since.
50
+ // A served composer (agent.turn.composer) clears and restores its own draft.
51
+ const words = draft;
52
+ if (!agent.turn?.composer)
53
+ setLocal('');
54
+ const restore = () => {
55
+ if (!agent.turn?.composer)
56
+ setLocal((current) => withTyped(words, current));
51
57
  };
52
58
  const result = onSend(draft.trim());
53
59
  if (!(result instanceof Promise))
54
- return clear(result);
60
+ return result === false ? restore() : undefined;
55
61
  sending.current = true;
56
62
  setPending(true);
57
63
  void result
58
64
  .then((result) => {
59
- if (result !== false) {
60
- if (!agent.turn?.composer)
61
- setLocal((current) => (current === draft ? '' : current));
62
- // The served container clears its own draft, including sends made by its queue.
63
- }
64
- }, () => { })
65
+ if (result === false)
66
+ restore();
67
+ }, restore)
65
68
  .finally(() => {
66
69
  sending.current = false;
67
70
  setPending(false);
@@ -0,0 +1,5 @@
1
+ import type { ChatLimit } from '@buffcore/contracts/workbench';
2
+ export declare function LimitCard({ limit, command }: {
3
+ limit: ChatLimit;
4
+ command: string;
5
+ }): import("react").JSX.Element;
@@ -0,0 +1,26 @@
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 { chatCard } from './AllowFolderCard.js';
6
+ import { AskTitle, askCommand, askFine } from './PermissionAskCard.js';
7
+ import { isRedactedTarget } from './panelLines.js';
8
+ import { folderButtonStyle } from './TurnControls.js';
9
+ /** The chat keeps a command's first 2000 characters: a longer one is cut, and never copied. */
10
+ const KEPT = 2000;
11
+ export function LimitCard({ limit, command }) {
12
+ const t = useT();
13
+ // A cut or scrubbed command is no longer the one the agent wrote: copying it would mislead.
14
+ const whole = command.length < KEPT && !isRedactedTarget([command]);
15
+ const [copied, setCopied] = useState();
16
+ const copy = async () => {
17
+ try {
18
+ await navigator.clipboard.writeText(command);
19
+ setCopied('copied');
20
+ }
21
+ catch {
22
+ setCopied('copyFailed');
23
+ }
24
+ };
25
+ return (_jsx("li", { "data-limit-card": limit, children: _jsxs("div", { style: chatCard, children: [_jsx(AskTitle, { icon: "lock", children: t('studio.frame.limit.title') }), _jsx("pre", { translate: "no", style: askCommand, children: command }), _jsx("p", { style: { margin: 0, fontWeight: 'var(--weight-semibold)', color: 'var(--text-strong)' }, children: t(`studio.frame.limit.kind.${limit}`) }), _jsx("p", { style: { margin: 0 }, children: t('studio.frame.limit.next') }), whole ? (_jsxs("span", { style: { display: 'grid', gap: 'var(--space-2)', justifyItems: 'start' }, children: [_jsx(Button, { size: "lg", variant: "secondary", icon: "copy", style: folderButtonStyle, onClick: () => void copy(), children: t('studio.frame.limit.copy') }), copied && (_jsx("span", { role: "status", style: askFine, children: t(`studio.frame.limit.${copied}`) }))] })) : (_jsx("p", { style: askFine, children: t('studio.frame.limit.long') })), _jsx("p", { style: askFine, children: t('studio.frame.limit.list') })] }) }));
26
+ }
@@ -5,6 +5,7 @@ import { visuallyHidden } from '../../../components/field.js';
5
5
  import { Icon } from '../../../components/Icon.js';
6
6
  import { bodyText, captionText, monoText } from '../../../components/styles.js';
7
7
  import { AgentMarkdown } from './AgentMarkdown.js';
8
+ import { LimitCard } from './LimitCard.js';
8
9
  import { PanelEnd, PanelWarning } from './PanelNotice.js';
9
10
  import { PanelPermission } from './PanelPermission.js';
10
11
  import { PanelTool } from './PanelTool.js';
@@ -40,6 +41,8 @@ function Bubble({ m, simple }) {
40
41
  }
41
42
  export function PanelMessage(props) {
42
43
  const { m } = props;
44
+ if (m.tool?.limit)
45
+ return _jsx(LimitCard, { limit: m.tool.limit, command: m.tool.targets[0] ?? '' });
43
46
  if (m.tool)
44
47
  return _jsx(PanelTool, { tool: m.tool });
45
48
  if (m.permission)
@@ -16,6 +16,15 @@ const heading = {
16
16
  padding: 'var(--space-2) var(--space-3) var(--space-1)',
17
17
  fontWeight: 'var(--weight-bold)',
18
18
  };
19
+ const note = {
20
+ ...captionText,
21
+ fontWeight: 'var(--weight-regular)',
22
+ margin: 0,
23
+ padding: '0 var(--space-3)',
24
+ display: 'flex',
25
+ gap: 'var(--space-2)',
26
+ alignItems: 'center',
27
+ };
19
28
  function Section({ title, children }) {
20
29
  return (_jsxs("section", { "aria-label": title, style: { display: 'grid', gap: 'var(--space-1)' }, children: [_jsx("h3", { style: heading, children: title }), children] }));
21
30
  }
@@ -29,13 +38,5 @@ export function SettingsSheet({ level, product, places, page, onClose, onLevel,
29
38
  const name = t(`studio.frame.level.${level}`);
30
39
  const never = useContext(LevelChoiceContext)?.neverAsk;
31
40
  const computer = places ? COMPUTER.filter(({ id }) => places.includes(id)) : COMPUTER;
32
- return (_jsx(Sheet, { title: t('studio.frame.settings'), onClose: onClose, children: _jsxs("div", { style: { display: 'grid', gap: 'var(--space-4)' }, children: [_jsxs(Section, { title: t('studio.level.choices'), children: [_jsxs(Row, { onClick: onLevel, children: [_jsx(Icon, { name: "sliders-horizontal", size: "var(--icon-md)" }), _jsx("span", { style: { flex: 1 }, children: never ? t('studio.level.neverAsk.chip', { level: name }) : name }), _jsx(Icon, { name: "chevron-right", size: "var(--icon-sm)" })] }), _jsxs("p", { style: {
33
- ...captionText,
34
- fontWeight: 'var(--weight-regular)',
35
- margin: 0,
36
- padding: '0 var(--space-3)',
37
- display: 'flex',
38
- gap: 'var(--space-2)',
39
- alignItems: 'center',
40
- }, children: [_jsx(Icon, { name: "shield-check", size: "var(--icon-sm)" }), _jsx("span", { children: t('studio.frame.settings.person') })] })] }), computer.length > 0 && (_jsx(Section, { title: machine.name, children: computer.map(({ id, icon }) => (_jsxs(Row, { on: page === id, onClick: onGo && (() => onGo(id)), children: [_jsx(Icon, { name: icon, size: "var(--icon-md)" }), _jsx("span", { style: { flex: 1 }, children: t(`studio.frame.page.${id}`) })] }, id))) })), onHelp && (_jsxs(Row, { onClick: onHelp, children: [_jsx(Icon, { name: "circle-help", size: "var(--icon-md)" }), _jsx("span", { style: { flex: 1 }, children: t('studio.frame.help') })] }))] }) }));
41
+ return (_jsx(Sheet, { title: t('studio.frame.settings'), onClose: onClose, children: _jsxs("div", { style: { display: 'grid', gap: 'var(--space-4)' }, children: [_jsxs(Section, { title: t('studio.level.choices'), children: [_jsxs(Row, { onClick: onLevel, children: [_jsx(Icon, { name: "sliders-horizontal", size: "var(--icon-md)" }), _jsx("span", { style: { flex: 1 }, children: never ? t('studio.level.neverAsk.chip', { level: name }) : name }), _jsx(Icon, { name: "chevron-right", size: "var(--icon-sm)" })] }), _jsxs("p", { style: note, children: [_jsx(Icon, { name: "shield-check", size: "var(--icon-sm)" }), _jsx("span", { children: t('studio.frame.settings.person') })] }), product.hostLaunched && (_jsxs("p", { style: note, children: [_jsx(Icon, { name: "lock", size: "var(--icon-sm)" }), _jsx("span", { children: t('studio.frame.settings.host') })] }))] }), computer.length > 0 && (_jsx(Section, { title: machine.name, children: computer.map(({ id, icon }) => (_jsxs(Row, { on: page === id, onClick: onGo && (() => onGo(id)), children: [_jsx(Icon, { name: icon, size: "var(--icon-md)" }), _jsx("span", { style: { flex: 1 }, children: t(`studio.frame.page.${id}`) })] }, id))) })), onHelp && (_jsxs(Row, { onClick: onHelp, children: [_jsx(Icon, { name: "circle-help", size: "var(--icon-md)" }), _jsx("span", { style: { flex: 1 }, children: t('studio.frame.help') })] }))] }) }));
41
42
  }
@@ -12,6 +12,7 @@ import { HostPage, Place } from './Place.js';
12
12
  import { AppUrl } from './RealApp.js';
13
13
  import { StudioRail } from './StudioRail.js';
14
14
  import { StudioRegions } from './StudioRegions.js';
15
+ import { STUDIO_SCROLLBARS } from './scrollbars.js';
15
16
  import { TopBar } from './TopBar.js';
16
17
  const WIDE = { narrow: false };
17
18
  const NARROW = { narrow: true };
@@ -22,9 +23,9 @@ export function StudioFrame(props) {
22
23
  if (host?.parts?.screen?.length)
23
24
  return _jsx(Place, { id: "screen" });
24
25
  if (props.cover) {
25
- return (_jsx("div", { ref: ref, style: { height: '100%', background: 'var(--surface-canvas)' }, children: children }));
26
+ return (_jsxs("div", { ref: ref, "data-studio-frame": true, style: { height: '100%', background: 'var(--surface-canvas)' }, children: [_jsx("style", { children: STUDIO_SCROLLBARS }), children] }));
26
27
  }
27
- return (_jsx("div", { ref: ref, "data-layout": layout, "data-prototype-layout": props.page === 'prototype' ? '' : undefined, "data-prototype-layout-known": props.page === 'prototype' && known ? '' : undefined, style: {
28
+ return (_jsxs("div", { ref: ref, "data-studio-frame": true, "data-layout": layout, "data-prototype-layout": props.page === 'prototype' ? '' : undefined, "data-prototype-layout-known": props.page === 'prototype' && known ? '' : undefined, style: {
28
29
  height: '100%',
29
30
  maxHeight: props.page === 'prototype' ? '100dvh' : undefined,
30
31
  minHeight: props.page === 'prototype' ? 0 : undefined,
@@ -33,7 +34,7 @@ export function StudioFrame(props) {
33
34
  gridTemplateRows: 'auto minmax(0, 1fr)',
34
35
  background: 'var(--surface-canvas)',
35
36
  color: 'var(--text-body)',
36
- }, children: _jsxs(StudioLook, { value: layout === 'narrow' ? NARROW : WIDE, children: [_jsx(FrameTop, { props: props, layout: layout }), _jsx(Body, { props: props, layout: layout, children: children })] }) }));
37
+ }, children: [_jsx("style", { children: STUDIO_SCROLLBARS }), _jsxs(StudioLook, { value: layout === 'narrow' ? NARROW : WIDE, children: [_jsx(FrameTop, { props: props, layout: layout }), _jsx(Body, { props: props, layout: layout, children: children })] })] }));
37
38
  }
38
39
  function FrameTop({ props, layout }) {
39
40
  const host = usePlaces();
@@ -17,6 +17,7 @@ export declare const isRedactedTarget: (targets: readonly string[]) => boolean;
17
17
  /**
18
18
  * The last call the agent was refused, when the person has not answered it yet: nothing from the
19
19
  * person after it, the agent not running, and no permission notice (it has its own two buttons).
20
+ * A call a limit refused has its own card, with nothing to ask again.
20
21
  */
21
22
  export declare function refusedCall(lines: readonly PanelMessage[], running: boolean | undefined): {
22
23
  tool: NonNullable<PanelMessage['tool']>;
@@ -62,11 +62,12 @@ export const isRedactedTarget = (targets) => targets.some((target) => REDACTION_
62
62
  /**
63
63
  * The last call the agent was refused, when the person has not answered it yet: nothing from the
64
64
  * person after it, the agent not running, and no permission notice (it has its own two buttons).
65
+ * A call a limit refused has its own card, with nothing to ask again.
65
66
  */
66
67
  export function refusedCall(lines, running) {
67
68
  if (running)
68
69
  return undefined;
69
- const at = lines.findLastIndex((m) => m.tool?.refused);
70
+ const at = lines.findLastIndex((m) => m.tool?.refused && !m.tool.limit);
70
71
  if (at < 0)
71
72
  return undefined;
72
73
  const after = lines.slice(at + 1);
@@ -0,0 +1 @@
1
+ export declare const STUDIO_SCROLLBARS = "\n[data-studio-frame],[data-studio-frame] *{scrollbar-width:thin;scrollbar-color:var(--border-strong) transparent}\n[data-studio-frame] ::-webkit-scrollbar,[data-studio-frame]::-webkit-scrollbar{width:var(--space-2);height:var(--space-2)}\n[data-studio-frame] ::-webkit-scrollbar-track,[data-studio-frame]::-webkit-scrollbar-track{background:transparent}\n[data-studio-frame] ::-webkit-scrollbar-thumb,[data-studio-frame]::-webkit-scrollbar-thumb{background:var(--border-strong);border-radius:var(--radius-chip)}\n[data-studio-frame] ::-webkit-scrollbar-thumb:hover{background:var(--text-subtle)}\n[data-studio-frame] ::-webkit-scrollbar-corner{background:transparent}\n";
@@ -0,0 +1,10 @@
1
+ // The studio's scroll bars: thin, in the theme's colors, light and dark, in every panel that
2
+ // scrolls inside the frame. Tokens only, so a host's theme colors them too.
3
+ export const STUDIO_SCROLLBARS = `
4
+ [data-studio-frame],[data-studio-frame] *{scrollbar-width:thin;scrollbar-color:var(--border-strong) transparent}
5
+ [data-studio-frame] ::-webkit-scrollbar,[data-studio-frame]::-webkit-scrollbar{width:var(--space-2);height:var(--space-2)}
6
+ [data-studio-frame] ::-webkit-scrollbar-track,[data-studio-frame]::-webkit-scrollbar-track{background:transparent}
7
+ [data-studio-frame] ::-webkit-scrollbar-thumb,[data-studio-frame]::-webkit-scrollbar-thumb{background:var(--border-strong);border-radius:var(--radius-chip)}
8
+ [data-studio-frame] ::-webkit-scrollbar-thumb:hover{background:var(--text-subtle)}
9
+ [data-studio-frame] ::-webkit-scrollbar-corner{background:transparent}
10
+ `;
@@ -22,4 +22,6 @@ export declare function useTurnDraft(key: string, status: Status, send: (text: s
22
22
  answer: (context: string, key?: string) => void;
23
23
  focus: () => void;
24
24
  };
25
+ /** The words of a failed send, then a blank line and what the person typed while it was sending. */
26
+ export declare function withTyped(failed: string, typed: string): string;
25
27
  export {};
@@ -24,19 +24,18 @@ export function useTurnDraft(key, status, send, options = {}) {
24
24
  return false;
25
25
  pending.current = true;
26
26
  const draft = current();
27
+ // The words move into the chat at once (shown as sending), so the box clears now. A refused
28
+ // or interrupted send never loses them: they come back first, then anything typed meanwhile.
29
+ update({ value: '' });
30
+ let ok = false;
27
31
  try {
28
- const ok = await send(draft.context ? `${draft.context}\n\n${text}` : text);
29
- if (active.current !== cell)
30
- return false;
31
- if (ok &&
32
- current().value === draft.value &&
33
- current().answerKey === draft.answerKey &&
34
- current().context === draft.context)
35
- update({ value: '' });
36
- return ok;
32
+ ok = await send(draft.context ? `${draft.context}\n\n${text}` : text);
33
+ return ok && active.current === cell;
37
34
  }
38
35
  finally {
39
36
  pending.current = false;
37
+ if (!ok)
38
+ update({ ...draft, queued: false, value: withTyped(draft.value, current().value) });
40
39
  }
41
40
  };
42
41
  useQueue(status, options, current, update, submit);
@@ -66,6 +65,10 @@ export function useTurnDraft(key, status, send, options = {}) {
66
65
  const focus = () => update({ ...current(), focus: (current().focus ?? 0) + 1 });
67
66
  return { composer, send: submit, answer, focus };
68
67
  }
68
+ /** The words of a failed send, then a blank line and what the person typed while it was sending. */
69
+ export function withTyped(failed, typed) {
70
+ return typed ? `${failed}\n\n${typed}` : failed;
71
+ }
69
72
  function useQueue(status, options, current, update, submit) {
70
73
  useEffect(() => {
71
74
  const draft = current();
@@ -0,0 +1,26 @@
1
+ declare const _default: {
2
+ 'studio.structure.surface.question': string;
3
+ 'studio.structure.surface.help': string;
4
+ 'studio.structure.surface.desktop': string;
5
+ 'studio.structure.surface.desktopHelp': string;
6
+ 'studio.structure.surface.phone': string;
7
+ 'studio.structure.surface.phoneHelp': string;
8
+ 'studio.structure.surface.first': string;
9
+ 'studio.comp.title': string;
10
+ 'studio.comp.intro': string;
11
+ 'studio.comp.desktop': string;
12
+ 'studio.comp.phone': string;
13
+ 'studio.comp.reference': string;
14
+ 'studio.comp.noReference': string;
15
+ 'studio.comp.noPicture': string;
16
+ 'studio.comp.approve': string;
17
+ 'studio.comp.change': string;
18
+ 'studio.comp.approved': string;
19
+ 'studio.comp.approvedBy': string;
20
+ 'studio.comp.open': string;
21
+ 'studio.comp.back': string;
22
+ 'studio.comp.sample.notes': string;
23
+ 'studio.comp.sample.write': string;
24
+ 'studio.comp.sample.settings': string;
25
+ };
26
+ export default _default;
@@ -0,0 +1,26 @@
1
+ // The comp: which surface comes first (Structure) and the look on three screens (Prototype).
2
+ export default {
3
+ 'studio.structure.surface.question': 'Which surface comes first?',
4
+ 'studio.structure.surface.help': 'The first screens are drawn for it; the other follows from them.',
5
+ 'studio.structure.surface.desktop': 'Desktop',
6
+ 'studio.structure.surface.desktopHelp': 'People mostly use it at a desk, on a wide screen.',
7
+ 'studio.structure.surface.phone': 'Phone',
8
+ 'studio.structure.surface.phoneHelp': 'People mostly use it on the go, one hand.',
9
+ 'studio.structure.surface.first': 'Draft the structure first; then choose which surface comes first.',
10
+ 'studio.comp.title': 'The look, on three screens',
11
+ 'studio.comp.intro': 'The three screens that decide the look, at full width, beside the references the brand chose. Approve the look and the agent draws every scene from it.',
12
+ 'studio.comp.desktop': 'Drawn for desktop, {width} px wide.',
13
+ 'studio.comp.phone': 'Drawn for phone, {width} px wide.',
14
+ 'studio.comp.reference': 'Reference {n}',
15
+ 'studio.comp.noReference': 'No reference picture yet: design/references.md names none for this screen.',
16
+ 'studio.comp.noPicture': 'This screen has no picture yet: the agent snapshots the comp.',
17
+ 'studio.comp.approve': 'Approve the look',
18
+ 'studio.comp.change': 'Say what to change in the chat; the agent redraws the three.',
19
+ 'studio.comp.approved': 'The look is approved.',
20
+ 'studio.comp.approvedBy': 'Approved by {by}. Every scene is drawn to match it.',
21
+ 'studio.comp.open': 'See the look',
22
+ 'studio.comp.back': 'Back to the app',
23
+ 'studio.comp.sample.notes': 'Your notes',
24
+ 'studio.comp.sample.write': 'Write a note',
25
+ 'studio.comp.sample.settings': 'Settings',
26
+ };
@@ -0,0 +1,26 @@
1
+ declare const _default: {
2
+ 'studio.structure.surface.question': string;
3
+ 'studio.structure.surface.help': string;
4
+ 'studio.structure.surface.desktop': string;
5
+ 'studio.structure.surface.desktopHelp': string;
6
+ 'studio.structure.surface.phone': string;
7
+ 'studio.structure.surface.phoneHelp': string;
8
+ 'studio.structure.surface.first': string;
9
+ 'studio.comp.title': string;
10
+ 'studio.comp.intro': string;
11
+ 'studio.comp.desktop': string;
12
+ 'studio.comp.phone': string;
13
+ 'studio.comp.reference': string;
14
+ 'studio.comp.noReference': string;
15
+ 'studio.comp.noPicture': string;
16
+ 'studio.comp.approve': string;
17
+ 'studio.comp.change': string;
18
+ 'studio.comp.approved': string;
19
+ 'studio.comp.approvedBy': string;
20
+ 'studio.comp.open': string;
21
+ 'studio.comp.back': string;
22
+ 'studio.comp.sample.notes': string;
23
+ 'studio.comp.sample.write': string;
24
+ 'studio.comp.sample.settings': string;
25
+ };
26
+ export default _default;
@@ -0,0 +1,25 @@
1
+ export default {
2
+ 'studio.structure.surface.question': '¿Qué superficie va primero?',
3
+ 'studio.structure.surface.help': 'Las primeras pantallas se dibujan para ella; la otra se deriva de ellas.',
4
+ 'studio.structure.surface.desktop': 'Escritorio',
5
+ 'studio.structure.surface.desktopHelp': 'La gente la usa sobre todo en un escritorio, en una pantalla ancha.',
6
+ 'studio.structure.surface.phone': 'Teléfono',
7
+ 'studio.structure.surface.phoneHelp': 'La gente la usa sobre todo en movimiento, con una mano.',
8
+ 'studio.structure.surface.first': 'Primero haz el borrador de la estructura; luego elige qué superficie va primero.',
9
+ 'studio.comp.title': 'El aspecto, en tres pantallas',
10
+ 'studio.comp.intro': 'Las tres pantallas que deciden el aspecto, a ancho completo, junto a las referencias que eligió la marca. Aprueba el aspecto y el agente dibuja cada escena a partir de él.',
11
+ 'studio.comp.desktop': 'Dibujado para escritorio, {width} px de ancho.',
12
+ 'studio.comp.phone': 'Dibujado para teléfono, {width} px de ancho.',
13
+ 'studio.comp.reference': 'Referencia {n}',
14
+ 'studio.comp.noReference': 'Aún no hay imagen de referencia: design/references.md no nombra ninguna para esta pantalla.',
15
+ 'studio.comp.noPicture': 'Esta pantalla aún no tiene imagen: el agente captura el boceto.',
16
+ 'studio.comp.approve': 'Aprobar el aspecto',
17
+ 'studio.comp.change': 'Di en el chat qué cambiar; el agente vuelve a dibujar las tres.',
18
+ 'studio.comp.approved': 'El aspecto está aprobado.',
19
+ 'studio.comp.approvedBy': 'Aprobado por {by}. Cada escena se dibuja para coincidir con él.',
20
+ 'studio.comp.open': 'Ver el aspecto',
21
+ 'studio.comp.back': 'Volver a la app',
22
+ 'studio.comp.sample.notes': 'Tus notas',
23
+ 'studio.comp.sample.write': 'Escribir una nota',
24
+ 'studio.comp.sample.settings': 'Ajustes',
25
+ };
@@ -80,6 +80,7 @@ declare const _default: {
80
80
  'studio.frame.agent.defaultLine': string;
81
81
  'studio.frame.settings': string;
82
82
  'studio.frame.settings.person': string;
83
+ 'studio.frame.settings.host': string;
83
84
  'studio.frame.panel.title': string;
84
85
  'studio.frame.panel.where': string;
85
86
  'studio.frame.panel.earlier': string;
@@ -209,5 +210,20 @@ declare const _default: {
209
210
  'studio.frame.ask.refusedTold': string;
210
211
  'studio.frame.ask.refusedWhy': string;
211
212
  'studio.frame.ask.refusedNext': string;
213
+ 'studio.frame.limit.title': string;
214
+ 'studio.frame.limit.kind.secrets': string;
215
+ 'studio.frame.limit.kind.settings': string;
216
+ 'studio.frame.limit.kind.deploy': string;
217
+ 'studio.frame.limit.kind.push': string;
218
+ 'studio.frame.limit.kind.publish': string;
219
+ 'studio.frame.limit.kind.release': string;
220
+ 'studio.frame.limit.kind.approval': string;
221
+ 'studio.frame.limit.kind.commit': string;
222
+ 'studio.frame.limit.next': string;
223
+ 'studio.frame.limit.copy': string;
224
+ 'studio.frame.limit.copied': string;
225
+ 'studio.frame.limit.copyFailed': string;
226
+ 'studio.frame.limit.long': string;
227
+ 'studio.frame.limit.list': string;
212
228
  };
213
229
  export default _default;
@@ -83,6 +83,7 @@ export default {
83
83
  'studio.frame.agent.defaultLine': 'Default agent',
84
84
  'studio.frame.settings': 'Settings',
85
85
  'studio.frame.settings.person': 'Some decisions always wait for a person. The level lists them.',
86
+ 'studio.frame.settings.host': 'Your host starts the agents and applies their limits.',
86
87
  // The agent's panel
87
88
  'studio.frame.panel.title': 'Your agent',
88
89
  'studio.frame.panel.where': 'Default agent · on {where}',
@@ -215,4 +216,19 @@ export default {
215
216
  'studio.frame.ask.refusedTold': '{agent} was told:',
216
217
  'studio.frame.ask.refusedWhy': '`{parts}` isn’t allowed here.',
217
218
  'studio.frame.ask.refusedNext': 'It goes on without it.',
219
+ 'studio.frame.limit.title': 'This can’t be allowed here',
220
+ 'studio.frame.limit.kind.secrets': 'Reading a folder of sign-ins or keys',
221
+ 'studio.frame.limit.kind.settings': 'Production settings',
222
+ 'studio.frame.limit.kind.deploy': 'Deploying',
223
+ 'studio.frame.limit.kind.push': 'Pushing with git',
224
+ 'studio.frame.limit.kind.publish': 'Publishing a package',
225
+ 'studio.frame.limit.kind.release': 'Publishing a release',
226
+ 'studio.frame.limit.kind.approval': 'Writing an approval record',
227
+ 'studio.frame.limit.kind.commit': 'Committing from a design step on Autopilot',
228
+ 'studio.frame.limit.next': 'Only a person does this. Nothing was run: copy the command and run it in your own terminal when you’re ready.',
229
+ 'studio.frame.limit.copy': 'Copy the command',
230
+ 'studio.frame.limit.copied': 'Command copied.',
231
+ 'studio.frame.limit.copyFailed': 'Couldn’t copy. Select the command and copy it.',
232
+ 'studio.frame.limit.long': 'This command was shortened in the chat, so it can’t be copied whole from here.',
233
+ 'studio.frame.limit.list': 'Never allowed at any level: folders of sign-ins or keys, production settings, deploys, git push, publishing a package or a release, writing an approval record. On Autopilot, a design step makes no commit.',
218
234
  };
@@ -81,6 +81,7 @@
81
81
  "studio.frame.agent.defaultLine": "Agente por defecto",
82
82
  "studio.frame.settings": "Ajustes",
83
83
  "studio.frame.settings.person": "Algunas decisiones siempre esperan a una persona. El nivel dice cuáles.",
84
+ "studio.frame.settings.host": "Tu anfitrión inicia los agentes y aplica sus límites.",
84
85
  "studio.frame.agent.working": "Trabajando",
85
86
  "studio.frame.panel.title": "Tu agente",
86
87
  "studio.frame.panel.where": "Agente por defecto · en {where}",
@@ -204,5 +205,20 @@
204
205
  "studio.frame.ask.refusedTold": "A {agent} se le dijo:",
205
206
  "studio.frame.ask.refusedWhy": "`{parts}` no está permitido aquí.",
206
207
  "studio.frame.ask.refusedNext": "Sigue sin ello.",
207
- "studio.frame.lines.changed": "Cambiado, abrir en la vista previa:"
208
+ "studio.frame.lines.changed": "Cambiado, abrir en la vista previa:",
209
+ "studio.frame.limit.title": "Esto no se puede permitir aquí",
210
+ "studio.frame.limit.kind.secrets": "Leer una carpeta de accesos o claves",
211
+ "studio.frame.limit.kind.settings": "Ajustes de producción",
212
+ "studio.frame.limit.kind.deploy": "Desplegar",
213
+ "studio.frame.limit.kind.push": "Hacer push con git",
214
+ "studio.frame.limit.kind.publish": "Publicar un paquete",
215
+ "studio.frame.limit.kind.release": "Publicar una versión",
216
+ "studio.frame.limit.kind.approval": "Escribir un registro de aprobación",
217
+ "studio.frame.limit.kind.commit": "Hacer un commit desde un paso de diseño en Piloto automático",
218
+ "studio.frame.limit.next": "Solo una persona hace esto. No se ejecutó nada: copia el comando y ejecútalo en tu propia terminal cuando quieras.",
219
+ "studio.frame.limit.copy": "Copiar el comando",
220
+ "studio.frame.limit.copied": "Comando copiado.",
221
+ "studio.frame.limit.copyFailed": "No se pudo copiar. Selecciona el comando y cópialo.",
222
+ "studio.frame.limit.long": "Este comando se acortó en el chat, así que no se puede copiar entero desde aquí.",
223
+ "studio.frame.limit.list": "Nunca se permite en ningún nivel: carpetas de accesos o claves, ajustes de producción, despliegues, git push, publicar un paquete o una versión, escribir un registro de aprobación. En Piloto automático, un paso de diseño no hace commits."
208
224
  }
@@ -0,0 +1,19 @@
1
+ declare const _default: {
2
+ 'studio.fresh.title': string;
3
+ 'studio.fresh.intro': string;
4
+ 'studio.fresh.running': string;
5
+ 'studio.fresh.none': string;
6
+ 'studio.fresh.take': string;
7
+ 'studio.fresh.leave': string;
8
+ 'studio.fresh.taken': string;
9
+ 'studio.fresh.busy': string;
10
+ 'studio.fresh.message': string;
11
+ 'studio.fresh.turn': string;
12
+ 'studio.fresh.setting.label': string;
13
+ 'studio.fresh.setting.help': string;
14
+ 'studio.fresh.critique.title': string;
15
+ 'studio.fresh.critique.running': string;
16
+ 'studio.fresh.critique.done': string;
17
+ 'studio.fresh.critique.failed': string;
18
+ };
19
+ export default _default;
@@ -0,0 +1,20 @@
1
+ // A fresh agent's turns (0.8.43): the review before Save on the planning steps, its setting, and
2
+ // the critique as its own turn after a passing full snapshot.
3
+ export default {
4
+ 'studio.fresh.title': 'A fresh look before you save',
5
+ 'studio.fresh.intro': 'A second agent read the plan with fresh eyes. Take what helps; Save works either way.',
6
+ 'studio.fresh.running': 'A second agent is reading this step with fresh eyes. Save works meanwhile.',
7
+ 'studio.fresh.none': 'A second agent read this step with fresh eyes and found nothing to add.',
8
+ 'studio.fresh.take': 'Take',
9
+ 'studio.fresh.leave': 'Leave',
10
+ 'studio.fresh.taken': 'Taken: your agent adds it to the plan',
11
+ 'studio.fresh.busy': 'Your agent is still working. Take it again when its turn ends.',
12
+ 'studio.fresh.message': 'From the fresh look: {finding}',
13
+ 'studio.fresh.turn': '{agent} · fresh look · {seconds, plural, one {# second} other {# seconds}}',
14
+ 'studio.fresh.setting.label': 'A fresh look before Save',
15
+ 'studio.fresh.setting.help': 'After your agent changes Brief, Plan, Journeys or Structure, a second agent reads the step and lists what to fix. It costs one more turn. It runs with Claude Code only for now; with Codex or OpenCode there is none.',
16
+ 'studio.fresh.critique.title': 'The critique',
17
+ 'studio.fresh.critique.running': 'The critique is running: a fresh agent reviews the scenes it did not draw.',
18
+ 'studio.fresh.critique.done': 'The critique is written in',
19
+ 'studio.fresh.critique.failed': 'The critique did not finish. Take the full snapshot again to run it once more.',
20
+ };
@@ -0,0 +1,18 @@
1
+ {
2
+ "studio.fresh.title": "Una mirada nueva antes de guardar",
3
+ "studio.fresh.intro": "Un segundo agente leyó el plan con ojos nuevos. Toma lo que ayude; Guardar funciona igual.",
4
+ "studio.fresh.running": "Un segundo agente está leyendo este paso con ojos nuevos. Mientras tanto, Guardar funciona.",
5
+ "studio.fresh.none": "Un segundo agente leyó este paso con ojos nuevos y no encontró nada que añadir.",
6
+ "studio.fresh.take": "Tomar",
7
+ "studio.fresh.leave": "Dejar",
8
+ "studio.fresh.taken": "Tomado: tu agente lo añade al plan",
9
+ "studio.fresh.busy": "Tu agente sigue trabajando. Tómalo de nuevo cuando termine su turno.",
10
+ "studio.fresh.message": "De la mirada nueva: {finding}",
11
+ "studio.fresh.turn": "{agent} · mirada nueva · {seconds, plural, one {# segundo} other {# segundos}}",
12
+ "studio.fresh.setting.label": "Una mirada nueva antes de Guardar",
13
+ "studio.fresh.setting.help": "Cuando tu agente cambia Resumen, Plan, Recorridos o Estructura, un segundo agente lee el paso y enumera qué corregir. Cuesta un turno más. Por ahora solo funciona con Claude Code; con Codex u OpenCode no hay ninguna.",
14
+ "studio.fresh.critique.title": "La crítica",
15
+ "studio.fresh.critique.running": "La crítica está en marcha: un agente nuevo revisa las escenas que no dibujó.",
16
+ "studio.fresh.critique.done": "La crítica está escrita en",
17
+ "studio.fresh.critique.failed": "La crítica no terminó. Toma la captura completa de nuevo para repetirla."
18
+ }
@@ -2,10 +2,14 @@
2
2
  // product's places'. One catalog, registered once beside the workbench's.
3
3
  import { workbenchApprovalCopy } from '@buffcore/contracts/workbench';
4
4
  import { mergeCatalogs } from '@buffcore/i18n';
5
+ import compEn from './comp.en.js';
6
+ import compEs from './comp.es.js';
5
7
  import drawnEn from './drawn.en.js';
6
8
  import drawnEs from './drawn.es.json' with { type: 'json' };
7
9
  import frameEn from './frame.en.js';
8
10
  import frameEs from './frame.es.json' with { type: 'json' };
11
+ import freshEn from './fresh.en.js';
12
+ import freshEs from './fresh.es.json' with { type: 'json' };
9
13
  import laterEn from './later.en.js';
10
14
  import laterEs from './later.es.json' with { type: 'json' };
11
15
  import levelsEn from './levels.en.js';
@@ -33,6 +37,7 @@ import workEs from './work.es.json' with { type: 'json' };
33
37
  const merged = mergeCatalogs([
34
38
  workbenchApprovalCopy,
35
39
  { en: structureEn, es: structureEs },
40
+ { en: compEn, es: compEs },
36
41
  { en: prototypeEn, es: prototypeEs },
37
42
  { en: simpleEn, es: simpleEs },
38
43
  { en: releaseEn, es: releaseEs },
@@ -40,6 +45,7 @@ const merged = mergeCatalogs([
40
45
  { en: saveEn, es: saveEs },
41
46
  { en: drawnEn, es: drawnEs },
42
47
  { en: frameEn, es: frameEs },
48
+ { en: freshEn, es: freshEs },
43
49
  { en: levelsEn, es: levelsEs },
44
50
  { en: loopEn, es: loopEs },
45
51
  { en: startEn, es: startEs },
@@ -1,10 +1,13 @@
1
1
  import type { AgentId, Work } from '@buffcore/contracts/workbench';
2
2
  import type { ReactNode } from 'react';
3
+ import { type ReviewSettingProps } from './ReviewSetting.tsx';
3
4
  import type { LoopSample } from './types.ts';
4
5
  type AgentsSample = Pick<LoopSample, 'product' | 'agents' | 'roles' | 'contained'>;
5
6
  type OnSet = (work: Work | 'loop', agent?: AgentId) => void;
6
- export declare function AgentsPage({ sample, top, onSet, onTab, onAction, onHelp, onChoose, }: {
7
+ export declare function AgentsPage({ sample, top, onSet, onTab, onAction, onHelp, onChoose, review, }: {
7
8
  sample: AgentsSample;
9
+ /** The fresh look before Save, with the other agent settings. */
10
+ review?: ReviewSettingProps;
8
11
  onTab?: (tab: string) => void;
9
12
  top?: ReactNode;
10
13
  onSet?: OnSet;