@buffcore/admin-shell 0.8.39 → 0.8.41

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 (43) hide show
  1. package/dist/i18n/en.d.ts +3 -0
  2. package/dist/i18n/en.js +3 -0
  3. package/dist/i18n/es.json +3 -0
  4. package/dist/workbench/app/ServedSetup.js +8 -1
  5. package/dist/workbench/app/StudioApp.js +14 -2
  6. package/dist/workbench/app/__snapshots__/places-dom.test.tsx.snap +3 -3
  7. package/dist/workbench/app/actions.d.ts +9 -0
  8. package/dist/workbench/app/actions.js +7 -1
  9. package/dist/workbench/app/chat-session.d.ts +12 -0
  10. package/dist/workbench/app/chat.d.ts +22 -0
  11. package/dist/workbench/app/chat.js +1 -0
  12. package/dist/workbench/app/loop.js +10 -4
  13. package/dist/workbench/app/panel-cards.d.ts +10 -0
  14. package/dist/workbench/app/panel-cards.js +28 -0
  15. package/dist/workbench/app/studio-post.js +1 -0
  16. package/dist/workbench/app/test/loop-fixture.d.ts +8 -2
  17. package/dist/workbench/studio/frame/AllowFolderCard.d.ts +16 -0
  18. package/dist/workbench/studio/frame/AllowFolderCard.js +63 -0
  19. package/dist/workbench/studio/frame/PanelList.js +6 -1
  20. package/dist/workbench/studio/frame/PanelMessage.d.ts +2 -0
  21. package/dist/workbench/studio/frame/PanelMessage.js +1 -1
  22. package/dist/workbench/studio/frame/PanelPermission.d.ts +2 -0
  23. package/dist/workbench/studio/frame/PanelPermission.js +4 -0
  24. package/dist/workbench/studio/frame/PlatformsCard.d.ts +10 -0
  25. package/dist/workbench/studio/frame/PlatformsCard.js +26 -0
  26. package/dist/workbench/studio/frame/WaitingBanner.d.ts +5 -0
  27. package/dist/workbench/studio/frame/WaitingBanner.js +17 -0
  28. package/dist/workbench/studio/frame/panelControls.d.ts +12 -0
  29. package/dist/workbench/studio/frame/useTurnDraft.d.ts +1 -0
  30. package/dist/workbench/studio/frame/useTurnDraft.js +3 -1
  31. package/dist/workbench/studio/i18n/frame.en.d.ts +18 -0
  32. package/dist/workbench/studio/i18n/frame.en.js +19 -1
  33. package/dist/workbench/studio/i18n/frame.es.json +20 -2
  34. package/dist/workbench/studio/i18n/levels.en.d.ts +3 -3
  35. package/dist/workbench/studio/i18n/levels.en.js +3 -3
  36. package/dist/workbench/studio/i18n/levels.es.json +3 -3
  37. package/dist/workbench/studio/i18n/loop.en.d.ts +12 -0
  38. package/dist/workbench/studio/i18n/loop.en.js +14 -2
  39. package/dist/workbench/studio/i18n/loop.es.json +14 -2
  40. package/dist/workbench/studio/run/WhereItRuns.d.ts +5 -0
  41. package/dist/workbench/studio/run/WhereItRuns.js +37 -17
  42. package/dist/workbench/studio/work/work-test-data.d.ts +1 -1
  43. package/package.json +6 -6
@@ -47,6 +47,15 @@ export interface StudioActions {
47
47
  catchUp?: (change: string) => Promise<unknown>;
48
48
  send: (id: string, text: string, waitForRefresh?: false) => Promise<boolean>;
49
49
  newChat: (body: NewChat) => Promise<Chat | undefined>;
50
+ /** A person's "Allow this folder" on the chat's notice at `at`: true, or the refusal sentence. */
51
+ allowFolder?: (id: string, at: number) => Promise<true | string>;
52
+ /** The platforms a chat's card picked, kept across renders and read once by Setup. */
53
+ platformsWanted?: {
54
+ current?: {
55
+ ios: boolean;
56
+ android: boolean;
57
+ };
58
+ };
50
59
  stop: (id: string, confirm?: boolean, signal?: AbortSignal) => Promise<import('zod').infer<typeof stopAnswer> | undefined>;
51
60
  answerInChat?: (question: string, key?: string) => void;
52
61
  chooseQuestion?: (question: string, number?: number) => void;
@@ -1,5 +1,5 @@
1
1
  import { approvalSchema } from '@buffcore/contracts/approvals';
2
- import { chatSchema, foundAgentSchema, stopAnswer, workbenchApi, } from '@buffcore/contracts/workbench';
2
+ import { allowFolderAnswer, chatSchema, foundAgentSchema, stopAnswer, workbenchApi, } from '@buffcore/contracts/workbench';
3
3
  import { z } from 'zod';
4
4
  import { readBytes } from '../studio/loop/icon-check.js';
5
5
  import { snapshotRead } from './prototype-snapshot.js';
@@ -81,6 +81,12 @@ export function studioActions(post, prototypeScenes, prototypeHome, previewMerge
81
81
  : post(path, { text }));
82
82
  return sendAck.safeParse(answer).success;
83
83
  },
84
+ allowFolder: async (id, at) => {
85
+ const answer = await post(`/api/chats/${id}/allow-folder`, { at }, undefined, false);
86
+ if (allowFolderAnswer.safeParse(answer).success)
87
+ return true;
88
+ return studioRefusal(answer) ?? '';
89
+ },
84
90
  newChat: async (body) => {
85
91
  const result = await post('/api/chats', body);
86
92
  return result === undefined ? undefined : chatSchema.parse(result);
@@ -27,6 +27,11 @@ export declare function useEcho(chat: Chat, post: (text: string, waitForRefresh?
27
27
  startedAgent: boolean;
28
28
  retried?: boolean | undefined;
29
29
  } | undefined;
30
+ waiting?: {
31
+ question: string;
32
+ at: string;
33
+ turn: string;
34
+ } | undefined;
30
35
  messages: {
31
36
  from: "agent" | "system" | "you";
32
37
  text: string;
@@ -67,6 +72,7 @@ export declare function useEcho(chat: Chat, post: (text: string, waitForRefresh?
67
72
  path: string;
68
73
  setting: string;
69
74
  file: string;
75
+ allowed?: boolean | undefined;
70
76
  } | undefined;
71
77
  end?: {
72
78
  seconds: number;
@@ -100,6 +106,11 @@ export declare function useChatRead(props: StudioAppProps, id: string | null | u
100
106
  startedAgent: boolean;
101
107
  retried?: boolean | undefined;
102
108
  } | undefined;
109
+ waiting?: {
110
+ question: string;
111
+ at: string;
112
+ turn: string;
113
+ } | undefined;
103
114
  messages: {
104
115
  from: "agent" | "system" | "you";
105
116
  text: string;
@@ -140,6 +151,7 @@ export declare function useChatRead(props: StudioAppProps, id: string | null | u
140
151
  path: string;
141
152
  setting: string;
142
153
  file: string;
154
+ allowed?: boolean | undefined;
143
155
  } | undefined;
144
156
  end?: {
145
157
  seconds: number;
@@ -71,6 +71,11 @@ export declare function useChat(props: StudioAppProps, state: StudioState | null
71
71
  startedAgent: boolean;
72
72
  retried?: boolean | undefined;
73
73
  } | undefined;
74
+ waiting?: {
75
+ question: string;
76
+ at: string;
77
+ turn: string;
78
+ } | undefined;
74
79
  messages: {
75
80
  from: "agent" | "system" | "you";
76
81
  text: string;
@@ -111,6 +116,7 @@ export declare function useChat(props: StudioAppProps, state: StudioState | null
111
116
  path: string;
112
117
  setting: string;
113
118
  file: string;
119
+ allowed?: boolean | undefined;
114
120
  } | undefined;
115
121
  end?: {
116
122
  seconds: number;
@@ -150,6 +156,11 @@ export declare function useChat(props: StudioAppProps, state: StudioState | null
150
156
  startedAgent: boolean;
151
157
  retried?: boolean | undefined;
152
158
  } | undefined;
159
+ waiting?: {
160
+ question: string;
161
+ at: string;
162
+ turn: string;
163
+ } | undefined;
153
164
  messages: {
154
165
  from: "agent" | "system" | "you";
155
166
  text: string;
@@ -190,6 +201,7 @@ export declare function useChat(props: StudioAppProps, state: StudioState | null
190
201
  path: string;
191
202
  setting: string;
192
203
  file: string;
204
+ allowed?: boolean | undefined;
193
205
  } | undefined;
194
206
  end?: {
195
207
  seconds: number;
@@ -203,6 +215,7 @@ export declare function useChat(props: StudioAppProps, state: StudioState | null
203
215
  }[];
204
216
  } | undefined>;
205
217
  answer: (context: string, key?: string) => void;
218
+ focus: () => void;
206
219
  retry: () => Promise<boolean> | undefined;
207
220
  skip: (text: string, waitForRefresh?: false) => Promise<boolean>;
208
221
  controls: {
@@ -218,6 +231,15 @@ export declare function useChat(props: StudioAppProps, state: StudioState | null
218
231
  onSkip?: () => unknown;
219
232
  onSay?: (text: string) => unknown;
220
233
  onAgents?: () => void;
234
+ onAllowFolder?: (at: number) => Promise<true | string>;
235
+ platforms?: {
236
+ ios: boolean;
237
+ android: boolean;
238
+ };
239
+ onPlatforms?: (wanted?: {
240
+ ios: boolean;
241
+ android: boolean;
242
+ }) => void;
221
243
  save?: {
222
244
  onSave: () => Promise<void>;
223
245
  saving: boolean;
@@ -127,6 +127,7 @@ export function useChat(props, state, page, actions, workChange, selectionGenera
127
127
  questions,
128
128
  newChat,
129
129
  answer: draft.answer,
130
+ focus: draft.focus,
130
131
  retry: () => retryLast(echo.chat, echo.send),
131
132
  skip: echo.send,
132
133
  controls: { ...turn, sending: echo.sending, composer: draft.composer, blockingReason },
@@ -1,4 +1,4 @@
1
- import { BRAND_DIRECTIONS } from '@buffcore/contracts/workbench';
1
+ import { BRAND_DIRECTIONS, OFFERED_DIRECTIONS, } from '@buffcore/contracts/workbench';
2
2
  import { themes } from '@buffcore/tokens';
3
3
  import { agentName } from './agents.js';
4
4
  import { brandDirection } from './loop-stage.js';
@@ -92,13 +92,20 @@ export function journeysProps(state) {
92
92
  }
93
93
  /** Starter themes use BuffCore's own direction words, never product copy. */
94
94
  export function brandProps(state, t, picked) {
95
- const directions = BRAND_DIRECTIONS.map((key) => themes[key]).map((theme) => ({
95
+ const id = brandDirection(state, picked) ?? '';
96
+ // The offered starters first, then the one the product starts from or has picked, when another.
97
+ const kept = [...OFFERED_DIRECTIONS, state.plan?.theme ?? '', id];
98
+ const shown = BRAND_DIRECTIONS.filter((key) => kept.includes(key));
99
+ const directions = shown
100
+ .map((key) => themes[key])
101
+ .map((theme) => ({
96
102
  id: theme.key,
97
103
  name: t(`studio.loop.brand.dir.${theme.key}.name`),
98
104
  theme: theme.key,
99
105
  line: t(`studio.loop.brand.dir.${theme.key}.line`),
100
106
  voice: t(`studio.loop.brand.dir.${theme.key}.voice`),
101
- type: theme.font.body[0],
107
+ // Headings and body named apart when they differ (Warm: a serif over a sans).
108
+ type: [...new Set([theme.font.display[0], theme.font.body[0]])].join(' / '),
102
109
  radius: theme.radius['radius-control'],
103
110
  colors: [
104
111
  { name: 'Brand', value: theme.color.light['brand-solid'] },
@@ -107,7 +114,6 @@ export function brandProps(state, t, picked) {
107
114
  { name: 'Ink', value: theme.color.light['text-strong'] },
108
115
  ],
109
116
  }));
110
- const id = brandDirection(state, picked) ?? '';
111
117
  const iconDirection = id ? directions.find((direction) => direction.id === id) : directions[0];
112
118
  const brandColor = iconDirection?.id === state.plan?.theme ? state.plan?.themeColors?.['brand-solid'] : undefined;
113
119
  return {
@@ -0,0 +1,10 @@
1
+ import type { StudioState } from '@buffcore/contracts/workbench';
2
+ import type { ControlledAgent } 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.
9
+ */
10
+ export declare function withPanelCards(agent: ControlledAgent, state: StudioState, chat: string, actions: StudioActions, onGo: (page: StudioPage) => void, wanted: NonNullable<StudioActions['platformsWanted']>): ControlledAgent;
@@ -0,0 +1,28 @@
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.
5
+ */
6
+ export function withPanelCards(agent, state, chat, actions, onGo, wanted) {
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
+ onPlatforms: (choice) => {
22
+ // An absent choice (unknown platforms) opens Setup with nothing chosen.
23
+ wanted.current = choice;
24
+ onGo('setup');
25
+ },
26
+ },
27
+ };
28
+ }
@@ -61,6 +61,7 @@ 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') ||
64
65
  (path === '/api/run' && typeof id === 'string' && /^(?:enable|disable):/.test(id)))
65
66
  // Only a refusal sentence is shown; any other failed answer is a failure the page words.
66
67
  return typeof result?.error === 'string' ? result : undefined;
@@ -315,7 +315,7 @@ export declare function loopApi(initial?: {
315
315
  at: string;
316
316
  commit: string;
317
317
  change?: string | undefined;
318
- direction?: "neutral" | "soft" | undefined;
318
+ direction?: "bold" | "clear" | "neutral" | "soft" | "warm" | undefined;
319
319
  version?: number | undefined;
320
320
  screen?: string | undefined;
321
321
  revert?: string | undefined;
@@ -383,6 +383,11 @@ export declare function loopApi(initial?: {
383
383
  startedAgent: boolean;
384
384
  retried?: boolean | undefined;
385
385
  } | undefined;
386
+ waiting?: {
387
+ question: string;
388
+ at: string;
389
+ turn: string;
390
+ } | undefined;
386
391
  messages: {
387
392
  from: "agent" | "system" | "you";
388
393
  text: string;
@@ -423,6 +428,7 @@ export declare function loopApi(initial?: {
423
428
  path: string;
424
429
  setting: string;
425
430
  file: string;
431
+ allowed?: boolean | undefined;
426
432
  } | undefined;
427
433
  end?: {
428
434
  seconds: number;
@@ -744,7 +750,7 @@ export declare function loopApi(initial?: {
744
750
  at: string;
745
751
  commit: string;
746
752
  change?: string | undefined;
747
- direction?: "neutral" | "soft" | undefined;
753
+ direction?: "bold" | "clear" | "neutral" | "soft" | "warm" | undefined;
748
754
  version?: number | undefined;
749
755
  screen?: string | undefined;
750
756
  revert?: string | undefined;
@@ -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
+ }
@@ -5,6 +5,7 @@ import { Button } from '../../../components/Button.js';
5
5
  import { PanelMessage } from './PanelMessage.js';
6
6
  import { PanelRefused } from './PanelRefused.js';
7
7
  import { Place } from './Place.js';
8
+ import { isPlatformCommand, PlatformsCard } from './PlatformsCard.js';
8
9
  import { panelLines, refusedCall } from './panelLines.js';
9
10
  import { ClearedLine, StuckTurn } from './StuckTurn.js';
10
11
  import { QueuedLine, WorkingBar } from './TurnControls.js';
@@ -19,6 +20,8 @@ const listStyle = {
19
20
  alignContent: 'start',
20
21
  overflow: 'auto',
21
22
  minHeight: 0,
23
+ // Holds the messages' hidden labels (absolute) inside the scroll; else a long chat stretches the page.
24
+ position: 'relative',
22
25
  };
23
26
  const pageSize = 200;
24
27
  /** Follow appended or updated lines until the person scrolls away from the end. */
@@ -31,6 +34,7 @@ export function PanelList({ agent, simple }) {
31
34
  const lines = panelLines(agent.messages, first);
32
35
  const latestEnd = lines.findLastIndex(({ message }) => message.end);
33
36
  const refused = refusedCall(agent.messages, agent.running);
37
+ const onPlatforms = agent.turn?.onPlatforms;
34
38
  useLayoutEffect(() => {
35
39
  if (follow.current && list.current)
36
40
  list.current.scrollTop = list.current.scrollHeight;
@@ -44,6 +48,7 @@ export function PanelList({ agent, simple }) {
44
48
  }, children: t('studio.frame.panel.earlier') }) })), lines.map(({ message, position }, i) => (_jsx(PanelMessage, { m: {
45
49
  ...message,
46
50
  ...(agent.turn?.sending && i === lines.length - 1 ? { sending: true } : {}),
47
- }, turn: agent.turn, latestEnd: i === latestEnd, simple: simple, canApprove: agent.canApprove, approvalByRule: agent.approvalByRule }, position))), refused && _jsx(PanelRefused, { ...refused, turn: agent.turn }), agent.turn?.composer?.queued && _jsx(QueuedLine, { composer: agent.turn.composer }), agent.turn?.cleared && _jsx(ClearedLine, {}), agent.running &&
51
+ }, turn: agent.turn, at: position, latestEnd: i === latestEnd, simple: simple, canApprove: agent.canApprove, approvalByRule: agent.approvalByRule }, position))), refused &&
52
+ (onPlatforms && isPlatformCommand(refused.tool) ? (_jsx(PlatformsCard, { turn: { ...agent.turn, onPlatforms } })) : (_jsx(PanelRefused, { ...refused, turn: agent.turn }))), agent.turn?.composer?.queued && _jsx(QueuedLine, { composer: agent.turn.composer }), agent.turn?.cleared && _jsx(ClearedLine, {}), agent.running &&
48
53
  (agent.turn?.stuck ? (_jsx(StuckTurn, { agent: agent.name, turn: agent.turn })) : (_jsx(WorkingBar, { turn: agent.turn ?? {} }))), _jsx(Place, { id: "chat.end" })] }));
49
54
  }
@@ -6,6 +6,8 @@ interface MessageProps {
6
6
  approvalByRule?: boolean;
7
7
  turn?: TurnControls;
8
8
  latestEnd?: boolean;
9
+ /** The message's place in the chat. */
10
+ at?: number;
9
11
  }
10
12
  export declare function PanelMessage(props: MessageProps): import("react").JSX.Element;
11
13
  export {};
@@ -43,7 +43,7 @@ export function PanelMessage(props) {
43
43
  if (m.tool)
44
44
  return _jsx(PanelTool, { tool: m.tool });
45
45
  if (m.permission)
46
- return (_jsx(PanelPermission, { permission: m.permission, agent: m.agent ?? '', turn: props.turn, snippet: m.detail, repeated: m.permissionRepeated }));
46
+ return (_jsx(PanelPermission, { permission: m.permission, agent: m.agent ?? '', turn: props.turn, snippet: m.detail, repeated: m.permissionRepeated, at: props.at }));
47
47
  if (m.end)
48
48
  return (_jsx(PanelEnd, { end: m.end, agent: m.agent ?? '', showUnsaved: props.latestEnd, save: props.latestEnd ? props.turn?.save : undefined }));
49
49
  if (m.failure)
@@ -6,6 +6,8 @@ interface Props {
6
6
  turn?: TurnControls;
7
7
  snippet?: string;
8
8
  repeated?: boolean;
9
+ /** The notice's place in the chat, for the one-click allow. */
10
+ at?: number;
9
11
  }
10
12
  /** The CLI supplies the exact snippet only for a verified sibling; the person edits the file. */
11
13
  export declare function PanelPermission(props: Props): import("react").JSX.Element;
@@ -4,6 +4,7 @@ import { useState } from 'react';
4
4
  import { Banner } from '../../../components/Banner.js';
5
5
  import { Button } from '../../../components/Button.js';
6
6
  import { bodyText, monoText } from '../../../components/styles.js';
7
+ import { AllowFolderCard } from './AllowFolderCard.js';
7
8
  import { folderButtonStyle, RetryButtons } from './TurnControls.js';
8
9
  /** The CLI supplies the exact snippet only for a verified sibling; the person edits the file. */
9
10
  export function PanelPermission(props) {
@@ -12,6 +13,9 @@ export function PanelPermission(props) {
12
13
  const read = t('studio.frame.lines.permission.read', { agent, path: permission.path });
13
14
  if (repeated)
14
15
  return _jsx("li", { style: { ...bodyText, overflowWrap: 'anywhere' }, children: read });
16
+ const onAllowFolder = props.turn?.onAllowFolder;
17
+ if ((onAllowFolder && props.at !== undefined) || permission.allowed)
18
+ return (_jsx(AllowFolderCard, { permission: permission, agent: agent, at: props.at ?? -1, turn: { ...props.turn, onAllowFolder: onAllowFolder ?? (async () => '') } }));
15
19
  return (_jsx("li", { children: _jsx(Banner, { tone: "attention", icon: "key-round", title: t('studio.frame.lines.permission.title'), children: _jsxs("div", { style: snippet ? { display: 'grid', gap: 'var(--space-3)', minInlineSize: 0 } : undefined, children: [_jsx("p", { style: { margin: 0 }, children: read }), _jsx(PermissionInstructions, { ...props })] }) }) }));
16
20
  }
17
21
  function PermissionInstructions({ permission, snippet, turn }) {
@@ -0,0 +1,10 @@
1
+ import type { TurnControls } from './panelControls.ts';
2
+ import type { PanelMessage } from './panelLines.ts';
3
+ /** The refused call was the agent changing a platform. */
4
+ export declare function isPlatformCommand(tool: NonNullable<PanelMessage['tool']>): boolean;
5
+ /** The three platforms as switches, and a way to Setup with them chosen. It changes nothing. */
6
+ export declare function PlatformsCard({ turn, }: {
7
+ turn: TurnControls & {
8
+ onPlatforms: NonNullable<TurnControls['onPlatforms']>;
9
+ };
10
+ }): 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 { SettingRow } from '../../../components/SettingRow.js';
6
+ import { Switch } from '../../../components/Switch.js';
7
+ import { bodyText, captionText } from '../../../components/styles.js';
8
+ import { chatCard } from './AllowFolderCard.js';
9
+ import { folderButtonStyle } from './TurnControls.js';
10
+ /** `ape enable|disable <platform>`, as the agent's recorded command runs it (never its prose). */
11
+ const PLATFORM_COMMAND = /(?:^|&&|;|\|\|)\s*(?:(?:pnpm|npm|yarn)\s+(?:exec\s+|run\s+)?|npx\s+|pnpx\s+)?ape\s+(?:enable|disable)\s+(?:ios|android|web)\b/i;
12
+ /** The refused call was the agent changing a platform. */
13
+ export function isPlatformCommand(tool) {
14
+ return tool.verb === 'ran' && tool.targets.some((target) => PLATFORM_COMMAND.test(target));
15
+ }
16
+ /** The three platforms as switches, and a way to Setup with them chosen. It changes nothing. */
17
+ export function PlatformsCard({ turn, }) {
18
+ const t = useT();
19
+ const [wanted, setWanted] = useState(turn.platforms);
20
+ return (_jsx("li", { children: _jsxs("div", { style: chatCard, children: [_jsx("p", { style: {
21
+ ...bodyText,
22
+ margin: 0,
23
+ fontWeight: 'var(--weight-semibold)',
24
+ color: 'var(--text-strong)',
25
+ }, children: t('studio.frame.platforms.title') }), _jsx("p", { style: { margin: 0 }, children: t('studio.frame.platforms.why') }), wanted && (_jsxs("div", { children: [_jsx(SettingRow, { first: true, label: t('studio.start.where.web'), help: t('studio.frame.platforms.webAlways'), children: _jsx(Switch, { on: true, disabled: true, touchTarget: true, label: t('studio.start.where.web') }) }), ['ios', 'android'].map((p) => (_jsx(SettingRow, { label: t(`studio.start.where.${p}`), children: _jsx(Switch, { on: wanted[p], touchTarget: true, label: t(`studio.start.where.${p}`), onChange: (on) => setWanted({ ...wanted, [p]: on }) }) }, p)))] })), _jsx(Button, { size: "lg", variant: "primary", icon: "settings", style: { ...folderButtonStyle, inlineSize: '100%' }, onClick: () => turn.onPlatforms(wanted), children: t('studio.frame.platforms.change') }), _jsx("p", { style: { ...captionText, margin: 0, fontWeight: 'normal' }, children: t('studio.frame.platforms.fine') })] }) }));
26
+ }
@@ -0,0 +1,5 @@
1
+ export declare function WaitingBanner({ agent, question, onAnswer, }: {
2
+ agent: string;
3
+ question: string;
4
+ onAnswer: () => void;
5
+ }): import("react").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ // The step's agent asked the person a question and is waiting: one calm line above the page, with
3
+ // the question quoted and a button to the answer box. Views are props in, UI out.
4
+ import { useT } from '@buffcore/i18n/react';
5
+ import { Banner } from '../../../components/Banner.js';
6
+ import { Button } from '../../../components/Button.js';
7
+ const touch = { minBlockSize: 'var(--target)', minInlineSize: 'var(--target)' };
8
+ export function WaitingBanner({ agent, question, onAnswer, }) {
9
+ const t = useT();
10
+ return (_jsx(Banner, { tone: "info", icon: "message-square", title: t('studio.frame.waiting.title'), style: { marginBlockEnd: 'var(--space-4)' }, action: _jsx(Button, { size: "sm", variant: "secondary", style: touch, onClick: onAnswer, children: t('studio.frame.waiting.answer') }), children: _jsx("span", { "data-waiting-question": "", title: question, style: {
11
+ display: '-webkit-box',
12
+ WebkitBoxOrient: 'vertical',
13
+ WebkitLineClamp: 2,
14
+ overflow: 'hidden',
15
+ overflowWrap: 'anywhere',
16
+ }, children: t('studio.frame.waiting.asks', { agent, question }) }) }));
17
+ }
@@ -17,6 +17,18 @@ export interface TurnControls {
17
17
  /** An ordinary message to the agent, sent as the person: the refused call's two answers. */
18
18
  onSay?: (text: string) => unknown;
19
19
  onAgents?: () => void;
20
+ /** A person's "Allow this folder" on the chat's notice at `at`; only with the settings right. */
21
+ onAllowFolder?: (at: number) => Promise<true | string>;
22
+ /** The phone platforms the studio reads (web is always on); absent when unknown. */
23
+ platforms?: {
24
+ ios: boolean;
25
+ android: boolean;
26
+ };
27
+ /** Opens Setup's platforms with these chosen; Setup still saves. */
28
+ onPlatforms?: (wanted?: {
29
+ ios: boolean;
30
+ android: boolean;
31
+ }) => void;
20
32
  save?: {
21
33
  onSave: () => Promise<void>;
22
34
  saving: boolean;
@@ -20,5 +20,6 @@ export declare function useTurnDraft(key: string, status: Status, send: (text: s
20
20
  };
21
21
  send: (text: string) => Promise<boolean>;
22
22
  answer: (context: string, key?: string) => void;
23
+ focus: () => void;
23
24
  };
24
25
  export {};
@@ -62,7 +62,9 @@ export function useTurnDraft(key, status, send, options = {}) {
62
62
  context,
63
63
  focus: (current().focus ?? 0) + 1,
64
64
  });
65
- return { composer, send: submit, answer };
65
+ /** Put the cursor in the box as it is, with no question context (the agent's own question). */
66
+ const focus = () => update({ ...current(), focus: (current().focus ?? 0) + 1 });
67
+ return { composer, send: submit, answer, focus };
66
68
  }
67
69
  function useQueue(status, options, current, update, submit) {
68
70
  useEffect(() => {
@@ -165,5 +165,23 @@ declare const _default: {
165
165
  'studio.frame.turn.stuck.clear': string;
166
166
  'studio.frame.turn.stuck.wait': string;
167
167
  'studio.frame.turn.stuck.cleared': string;
168
+ 'studio.frame.allow.title': string;
169
+ 'studio.frame.allow.why': string;
170
+ 'studio.frame.allow.allow': string;
171
+ 'studio.frame.allow.allowing': string;
172
+ 'studio.frame.allow.notNow': string;
173
+ 'studio.frame.allow.fine': string;
174
+ 'studio.frame.allow.done': string;
175
+ 'studio.frame.allow.retrying': string;
176
+ 'studio.frame.allow.askAgain': string;
177
+ 'studio.frame.allow.failed': string;
178
+ 'studio.frame.platforms.title': string;
179
+ 'studio.frame.platforms.why': string;
180
+ 'studio.frame.platforms.webAlways': string;
181
+ 'studio.frame.platforms.change': string;
182
+ 'studio.frame.platforms.fine': string;
183
+ 'studio.frame.waiting.title': string;
184
+ 'studio.frame.waiting.asks': string;
185
+ 'studio.frame.waiting.answer': string;
168
186
  };
169
187
  export default _default;
@@ -72,7 +72,7 @@ export default {
72
72
  // The approvals that always need a person
73
73
  'studio.frame.seal.todo': 'A person approves this step',
74
74
  'studio.frame.seal.done': 'Approved',
75
- 'studio.frame.seal.unknown': 'Who approves this step is not confirmed',
75
+ 'studio.frame.seal.unknown': 'Reading who approves this step; the studio checks again in a moment',
76
76
  'studio.frame.seal.legend': 'Always a person',
77
77
  'studio.frame.seal.key': 'Steps a person approves',
78
78
  'studio.frame.seal.what': 'Development: release, deployment, money, production actions and named-person approvals. Business automation: child safety, consent, privacy-request sign-off, deleting data, refunds above the playbook limit, security and access changes, publishing content sets, and publishing or rolling back an AI purpose’s profile.',
@@ -171,4 +171,22 @@ export default {
171
171
  'studio.frame.turn.stuck.clear': 'Clear this turn',
172
172
  'studio.frame.turn.stuck.wait': 'Keep waiting',
173
173
  'studio.frame.turn.stuck.cleared': 'Turn cleared and marked stopped. You can send again.',
174
+ 'studio.frame.allow.title': '{agent} wants to read a folder',
175
+ 'studio.frame.allow.why': 'It’s outside this product, so it needs your OK.',
176
+ 'studio.frame.allow.allow': 'Allow this folder',
177
+ 'studio.frame.allow.allowing': 'Allowing…',
178
+ 'studio.frame.allow.notNow': 'Not now',
179
+ 'studio.frame.allow.fine': 'It can read this folder in every turn of this product. The studio saves it in .claude/settings.local.json, where you can remove it.',
180
+ 'studio.frame.allow.done': 'Folder allowed.',
181
+ 'studio.frame.allow.retrying': 'Folder allowed. {agent} is trying again.',
182
+ 'studio.frame.allow.askAgain': 'Folder allowed. Ask again when you’re ready.',
183
+ 'studio.frame.allow.failed': 'The folder wasn’t allowed. Try again.',
184
+ 'studio.frame.platforms.title': 'Platforms',
185
+ 'studio.frame.platforms.why': 'The Plan step can’t change platforms. Pick them here, then change them in Setup.',
186
+ 'studio.frame.platforms.webAlways': 'Always on',
187
+ 'studio.frame.platforms.change': 'Change in Setup',
188
+ 'studio.frame.platforms.fine': 'Setup opens with these switched. The plan updates after you save there.',
189
+ 'studio.frame.waiting.title': 'Waiting for your direction',
190
+ 'studio.frame.waiting.asks': '{agent} asks: “{question}”',
191
+ 'studio.frame.waiting.answer': 'Answer',
174
192
  };