@buffcore/admin-shell 0.8.44 → 0.8.46
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.
- package/dist/components/Markdown.d.ts +9 -3
- package/dist/components/Markdown.js +84 -34
- package/dist/components/Sheet.d.ts +5 -1
- package/dist/components/Sheet.js +8 -2
- package/dist/components/TextArea.d.ts +3 -1
- package/dist/components/TextArea.js +3 -3
- package/dist/components/icons.d.ts +1 -0
- package/dist/components/icons.js +1 -0
- package/dist/prototype/SceneSignal.d.ts +2 -1
- package/dist/prototype/SceneSignal.js +12 -1
- package/dist/prototype/scene-status.d.ts +1 -2
- package/dist/prototype/scene-status.js +1 -2
- package/dist/prototype/scene.d.ts +1 -1
- package/dist/prototype/scene.js +20 -3
- package/dist/workbench/app/ServedPrototype.js +5 -0
- package/dist/workbench/app/__snapshots__/places-dom.test.tsx.snap +7 -7
- package/dist/workbench/app/actions.d.ts +4 -2
- package/dist/workbench/app/actions.js +9 -4
- package/dist/workbench/app/brief-short.d.ts +14 -0
- package/dist/workbench/app/brief-short.js +103 -0
- package/dist/workbench/app/chat-session.d.ts +3 -3
- package/dist/workbench/app/chat-session.js +8 -3
- package/dist/workbench/app/chat.d.ts +15 -2
- package/dist/workbench/app/chat.js +9 -4
- package/dist/workbench/app/loop.js +2 -18
- package/dist/workbench/app/prototype.js +3 -0
- package/dist/workbench/app/test/loop-fixture.d.ts +10 -0
- package/dist/workbench/app/useStudio.d.ts +2 -1
- package/dist/workbench/studio/frame/AgentPanel.js +24 -1
- package/dist/workbench/studio/frame/PanelList.js +1 -1
- package/dist/workbench/studio/frame/Segmented.d.ts +3 -1
- package/dist/workbench/studio/frame/Segmented.js +4 -3
- package/dist/workbench/studio/frame/StudioFrame.js +3 -3
- package/dist/workbench/studio/frame/StudioRegions.js +4 -1
- package/dist/workbench/studio/frame/TurnControls.d.ts +2 -1
- package/dist/workbench/studio/frame/TurnControls.js +4 -1
- package/dist/workbench/studio/frame/layout.d.ts +2 -0
- package/dist/workbench/studio/frame/layout.js +2 -0
- package/dist/workbench/studio/frame/panelControls.d.ts +21 -1
- package/dist/workbench/studio/frame/scrollbars.d.ts +1 -1
- package/dist/workbench/studio/frame/scrollbars.js +5 -3
- package/dist/workbench/studio/frame/useTurnDraft.d.ts +20 -2
- package/dist/workbench/studio/frame/useTurnDraft.js +39 -10
- package/dist/workbench/studio/i18n/index.js +6 -0
- package/dist/workbench/studio/i18n/loop.en.d.ts +11 -38
- package/dist/workbench/studio/i18n/loop.en.js +11 -38
- package/dist/workbench/studio/i18n/loop.es.json +11 -38
- package/dist/workbench/studio/i18n/marks.en.d.ts +41 -0
- package/dist/workbench/studio/i18n/marks.en.js +42 -0
- package/dist/workbench/studio/i18n/marks.es.json +40 -0
- package/dist/workbench/studio/i18n/start.en.d.ts +5 -0
- package/dist/workbench/studio/i18n/start.en.js +7 -2
- package/dist/workbench/studio/i18n/start.es.json +7 -2
- package/dist/workbench/studio/i18n/workspace.en.d.ts +45 -0
- package/dist/workbench/studio/i18n/workspace.en.js +46 -0
- package/dist/workbench/studio/i18n/workspace.es.json +44 -0
- package/dist/workbench/studio/loop/BriefDocument.d.ts +9 -6
- package/dist/workbench/studio/loop/BriefDocument.js +48 -76
- package/dist/workbench/studio/loop/BriefLists.d.ts +11 -0
- package/dist/workbench/studio/loop/BriefLists.js +42 -0
- package/dist/workbench/studio/loop/BriefPage.d.ts +6 -2
- package/dist/workbench/studio/loop/BriefPage.js +32 -4
- package/dist/workbench/studio/loop/BriefReading.d.ts +19 -0
- package/dist/workbench/studio/loop/BriefReading.js +22 -0
- package/dist/workbench/studio/loop/BriefSection.d.ts +22 -0
- package/dist/workbench/studio/loop/BriefSection.js +47 -0
- package/dist/workbench/studio/loop/BriefWho.d.ts +6 -0
- package/dist/workbench/studio/loop/BriefWho.js +56 -0
- package/dist/workbench/studio/loop/CanvasBar.d.ts +0 -1
- package/dist/workbench/studio/loop/CanvasBar.js +2 -3
- package/dist/workbench/studio/loop/ConsoleFrame.d.ts +13 -0
- package/dist/workbench/studio/loop/ConsoleFrame.js +29 -0
- package/dist/workbench/studio/loop/NotThisCard.d.ts +6 -1
- package/dist/workbench/studio/loop/NotThisCard.js +28 -20
- package/dist/workbench/studio/loop/ProtoJourneys.d.ts +1 -8
- package/dist/workbench/studio/loop/ProtoJourneys.js +0 -14
- package/dist/workbench/studio/loop/PrototypeApp.d.ts +3 -1
- package/dist/workbench/studio/loop/PrototypeApp.js +24 -9
- package/dist/workbench/studio/loop/PrototypeAttempt.js +55 -14
- package/dist/workbench/studio/loop/PrototypePage.d.ts +4 -2
- package/dist/workbench/studio/loop/PrototypePage.js +25 -1
- package/dist/workbench/studio/loop/PrototypePreview.d.ts +35 -6
- package/dist/workbench/studio/loop/PrototypePreview.js +126 -80
- package/dist/workbench/studio/loop/PrototypePreviewSlot.d.ts +13 -0
- package/dist/workbench/studio/loop/PrototypePreviewSlot.js +23 -0
- package/dist/workbench/studio/loop/PrototypeScenes.d.ts +1 -1
- package/dist/workbench/studio/loop/ServedPlanning.js +1 -1
- package/dist/workbench/studio/loop/StudioLoop.d.ts +7 -2
- package/dist/workbench/studio/loop/StudioLoop.js +4 -10
- package/dist/workbench/studio/loop/WorkspaceBar.d.ts +15 -0
- package/dist/workbench/studio/loop/WorkspaceBar.js +52 -0
- package/dist/workbench/studio/loop/WorkspaceJourneys.d.ts +17 -0
- package/dist/workbench/studio/loop/WorkspaceJourneys.js +99 -0
- package/dist/workbench/studio/loop/WorkspaceLeft.d.ts +14 -0
- package/dist/workbench/studio/loop/WorkspaceLeft.js +42 -0
- package/dist/workbench/studio/loop/WorkspaceStage.d.ts +24 -0
- package/dist/workbench/studio/loop/WorkspaceStage.js +142 -0
- package/dist/workbench/studio/loop/WorkspaceSteps.d.ts +20 -0
- package/dist/workbench/studio/loop/WorkspaceSteps.js +96 -0
- package/dist/workbench/studio/loop/moments.js +0 -3
- package/dist/workbench/studio/loop/prototype-document.d.ts +2 -0
- package/dist/workbench/studio/loop/prototype-document.js +12 -0
- package/dist/workbench/studio/loop/prototype-part.d.ts +43 -0
- package/dist/workbench/studio/loop/prototype-part.js +104 -0
- package/dist/workbench/studio/loop/types.d.ts +26 -26
- package/dist/workbench/studio/loop/types.js +0 -3
- package/dist/workbench/studio/loop/usePrototypeFrame.d.ts +3 -0
- package/dist/workbench/studio/loop/usePrototypeFrame.js +2 -0
- package/dist/workbench/studio/loop/workspace-journeys.d.ts +22 -0
- package/dist/workbench/studio/loop/workspace-journeys.js +63 -0
- package/dist/workbench/studio/loop/workspace-state.d.ts +94 -0
- package/dist/workbench/studio/loop/workspace-state.js +50 -0
- package/dist/workbench/studio/marks/ChangeList.d.ts +7 -0
- package/dist/workbench/studio/marks/ChangeList.js +70 -0
- package/dist/workbench/studio/marks/MarkHint.d.ts +18 -0
- package/dist/workbench/studio/marks/MarkHint.js +58 -0
- package/dist/workbench/studio/marks/MarkNumber.d.ts +6 -0
- package/dist/workbench/studio/marks/MarkNumber.js +24 -0
- package/dist/workbench/studio/marks/MarksLayer.d.ts +15 -0
- package/dist/workbench/studio/marks/MarksLayer.js +144 -0
- package/dist/workbench/studio/marks/PinNote.d.ts +13 -0
- package/dist/workbench/studio/marks/PinNote.js +49 -0
- package/dist/workbench/studio/marks/QueuedChanges.d.ts +6 -0
- package/dist/workbench/studio/marks/QueuedChanges.js +51 -0
- package/dist/workbench/studio/marks/WorkspaceMarks.d.ts +15 -0
- package/dist/workbench/studio/marks/WorkspaceMarks.js +67 -0
- package/dist/workbench/studio/marks/marks-message.d.ts +13 -0
- package/dist/workbench/studio/marks/marks-message.js +93 -0
- package/dist/workbench/studio/marks/marks.d.ts +105 -0
- package/dist/workbench/studio/marks/marks.js +133 -0
- package/dist/workbench/studio/marks/useMarking.d.ts +36 -0
- package/dist/workbench/studio/marks/useMarking.js +111 -0
- package/dist/workbench/studio/marks/useSendMarks.d.ts +18 -0
- package/dist/workbench/studio/marks/useSendMarks.js +80 -0
- package/dist/workbench/studio/work/StudioLater.js +0 -1
- package/dist/workbench/studio/work/work-test-data.d.ts +5 -0
- package/package.json +6 -6
- package/dist/workbench/studio/loop/FsPlan.d.ts +0 -7
- package/dist/workbench/studio/loop/FsPlan.js +0 -64
- package/dist/workbench/studio/loop/FsStage.d.ts +0 -6
- package/dist/workbench/studio/loop/FsStage.js +0 -74
- package/dist/workbench/studio/loop/FsToolbar.d.ts +0 -6
- package/dist/workbench/studio/loop/FsToolbar.js +0 -61
- package/dist/workbench/studio/loop/FullScreen.d.ts +0 -5
- package/dist/workbench/studio/loop/FullScreen.js +0 -89
- package/dist/workbench/studio/loop/PrototypePreviewMenus.d.ts +0 -18
- package/dist/workbench/studio/loop/PrototypePreviewMenus.js +0 -75
- package/dist/workbench/studio/loop/PrototypePreviewToolbar.d.ts +0 -27
- package/dist/workbench/studio/loop/PrototypePreviewToolbar.js +0 -52
- package/dist/workbench/studio/loop/fsViews.d.ts +0 -12
- package/dist/workbench/studio/loop/fsViews.js +0 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AgentAssignment, type Chat, type FoundAgent, type LEVELS, type MergePreview, type NewChat, type PrototypeScenesReply, stopAnswer } from '@buffcore/contracts/workbench';
|
|
1
|
+
import { type AgentAssignment, type Attachment, type Chat, type FoundAgent, type LEVELS, type MarkShotBody, type MergePreview, type NewChat, type PrototypeScenesReply, stopAnswer } from '@buffcore/contracts/workbench';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import type { StudioPage } from '../studio/types.ts';
|
|
4
4
|
import type { ServerForm } from '../types.ts';
|
|
@@ -52,7 +52,9 @@ export interface StudioActions {
|
|
|
52
52
|
approve?: (direction: string, fingerprint: string) => unknown;
|
|
53
53
|
approveRelease?: (id: string, server: ServerForm) => Promise<unknown>;
|
|
54
54
|
catchUp?: (change: string) => Promise<unknown>;
|
|
55
|
-
send: (id: string, text: string, waitForRefresh?: false) => Promise<boolean>;
|
|
55
|
+
send: (id: string, text: string, waitForRefresh?: false, attachments?: readonly Attachment[]) => Promise<boolean>;
|
|
56
|
+
/** A picture of the running app at one screen and device, with its marks drawn. */
|
|
57
|
+
markShot?: (body: MarkShotBody) => Promise<Attachment | undefined>;
|
|
56
58
|
newChat: (body: NewChat) => Promise<Chat | undefined>;
|
|
57
59
|
/** A person's "Allow this folder" on the chat's notice at `at`: true, or the refusal sentence. */
|
|
58
60
|
allowFolder?: (id: string, at: number) => Promise<true | string>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { approvalSchema } from '@buffcore/contracts/approvals';
|
|
2
|
-
import { allowFolderAnswer, chatSchema, foundAgentSchema, permissionAnswerReply, stopAnswer, workbenchApi, } from '@buffcore/contracts/workbench';
|
|
2
|
+
import { allowFolderAnswer, chatSchema, foundAgentSchema, markShotAnswer, permissionAnswerReply, 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,13 +81,18 @@ export function studioActions(post, prototypeScenes, prototypeHome, previewMerge
|
|
|
81
81
|
return post('/api/run', { id, server });
|
|
82
82
|
},
|
|
83
83
|
catchUp: (change) => post('/api/worktree', { change, action: 'catch-up' }),
|
|
84
|
-
send: async (id, text, waitForRefresh) => {
|
|
84
|
+
send: async (id, text, waitForRefresh, attachments) => {
|
|
85
85
|
const path = `/api/chats/${id}/send`;
|
|
86
|
+
const body = attachments?.length ? { text, attachments } : { text };
|
|
86
87
|
const answer = await (waitForRefresh === false
|
|
87
|
-
? post(path,
|
|
88
|
-
: post(path,
|
|
88
|
+
? post(path, body, undefined, false)
|
|
89
|
+
: post(path, body));
|
|
89
90
|
return sendAck.safeParse(answer).success;
|
|
90
91
|
},
|
|
92
|
+
markShot: async (body) => {
|
|
93
|
+
const answer = markShotAnswer.safeParse(await post(workbenchApi.prototypeShot, body, undefined, false));
|
|
94
|
+
return answer.success ? { kind: 'image', ...answer.data } : undefined;
|
|
95
|
+
},
|
|
91
96
|
allowFolder: async (id, at) => {
|
|
92
97
|
const answer = await post(`/api/chats/${id}/allow-folder`, { at }, undefined, false);
|
|
93
98
|
if (allowFolderAnswer.safeParse(answer).success)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PlanFacts } from '@buffcore/contracts/workbench';
|
|
2
|
+
import type { BriefDoc } from '../studio/loop/types.ts';
|
|
3
|
+
type Facts = NonNullable<PlanFacts['brief']>;
|
|
4
|
+
/** A section's lines, list markers removed. */
|
|
5
|
+
export declare const lines: (text: string) => string[];
|
|
6
|
+
/** A section's items: its list items when it has any, else its lines. */
|
|
7
|
+
export declare function items(text: string): string[];
|
|
8
|
+
/** The first sentence of a section's first line; the whole line when it has no full stop. */
|
|
9
|
+
export declare function firstSentence(text: string): string;
|
|
10
|
+
/** A Who summary line: `Role (app|console): what we know`, the place and the note optional. */
|
|
11
|
+
export declare function whoRow(line: string): BriefDoc['who'][number];
|
|
12
|
+
/** The short form and the whole text of plan/brief.md, as the Brief page reads them. */
|
|
13
|
+
export declare function briefShort(facts: Facts | null | undefined): BriefDoc;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { questionLines } from './questions.js';
|
|
2
|
+
/** The headings each short section is read from, as the template names them. */
|
|
3
|
+
const HEADINGS = {
|
|
4
|
+
what: (h) => h === 'the idea',
|
|
5
|
+
who: (h) => h === 'who it is for',
|
|
6
|
+
kind: (h) => /b2b|b2c|kind/.test(h),
|
|
7
|
+
earns: (h) => h === 'how it earns',
|
|
8
|
+
must: (h) => h === 'must do',
|
|
9
|
+
later: (h) => h === 'later' || h === 'not this time',
|
|
10
|
+
questions: (h) => h === 'open questions' || h === 'preguntas abiertas',
|
|
11
|
+
};
|
|
12
|
+
const MARKER = /^\s*(?:[-*+]|\d+[.)])\s+/;
|
|
13
|
+
/** A section's lines, list markers removed. */
|
|
14
|
+
export const lines = (text) => text
|
|
15
|
+
.split('\n')
|
|
16
|
+
.map((line) => line
|
|
17
|
+
.replace(/^\s*>\s?/, '')
|
|
18
|
+
.replace(MARKER, '')
|
|
19
|
+
.trim())
|
|
20
|
+
.filter(Boolean);
|
|
21
|
+
/** A section's items: its list items when it has any, else its lines. */
|
|
22
|
+
export function items(text) {
|
|
23
|
+
const listed = text.split('\n').filter((line) => MARKER.test(line));
|
|
24
|
+
return listed.length ? lines(listed.join('\n')) : lines(text);
|
|
25
|
+
}
|
|
26
|
+
/** The first list's items (who it is for lists people first, then what they use), else lines. */
|
|
27
|
+
function firstList(text) {
|
|
28
|
+
const all = text.split('\n');
|
|
29
|
+
const start = all.findIndex((line) => MARKER.test(line));
|
|
30
|
+
if (start < 0)
|
|
31
|
+
return lines(text);
|
|
32
|
+
const end = all.findIndex((line, i) => i > start && !MARKER.test(line));
|
|
33
|
+
return lines(all.slice(start, end < 0 ? undefined : end).join('\n'));
|
|
34
|
+
}
|
|
35
|
+
/** The first sentence of a section's first line; the whole line when it has no full stop. */
|
|
36
|
+
export function firstSentence(text) {
|
|
37
|
+
const line = lines(text)[0] ?? '';
|
|
38
|
+
return /^.*?[.!?]['"”’)]*(?=\s|$)/.exec(line)?.[0] ?? line;
|
|
39
|
+
}
|
|
40
|
+
const whereOf = (words) => /console|consola|admin/i.test(words) ? 'console' : /\bapp\b/i.test(words) ? 'app' : undefined;
|
|
41
|
+
/** A Who summary line: `Role (app|console): what we know`, the place and the note optional. */
|
|
42
|
+
export function whoRow(line) {
|
|
43
|
+
const match = /^(.+?)(?:\s*\(([^)]*)\))?\s*:\s+(.+)$/.exec(line);
|
|
44
|
+
const placed = match ? undefined : /^(.+?)\s*\(([^)]*)\)$/.exec(line);
|
|
45
|
+
const named = (match?.[1] ?? placed?.[1] ?? line).trim();
|
|
46
|
+
const bracket = match?.[2] ?? placed?.[2] ?? '';
|
|
47
|
+
const where = whereOf(bracket);
|
|
48
|
+
// Words in brackets that name no place stay with the role (`Volunteers (18+)`).
|
|
49
|
+
const role = bracket && !where ? `${named} (${bracket})` : named;
|
|
50
|
+
const said = match?.[3]?.trim();
|
|
51
|
+
const note = said && said.charAt(0).toLocaleUpperCase() + said.slice(1);
|
|
52
|
+
return { role, ...(where ? { where } : {}), ...(note ? { note } : {}) };
|
|
53
|
+
}
|
|
54
|
+
/** The kind section's line, without the B2B or B2C the chip already says. */
|
|
55
|
+
function kindLine(line) {
|
|
56
|
+
const rest = line.replace(/^b2[bc]\b[\s:.,;–—-]*/i, '');
|
|
57
|
+
return rest ? rest.charAt(0).toLocaleUpperCase() + rest.slice(1) : undefined;
|
|
58
|
+
}
|
|
59
|
+
/** The short form and the whole text of plan/brief.md, as the Brief page reads them. */
|
|
60
|
+
export function briefShort(facts) {
|
|
61
|
+
const entries = Object.entries(facts?.sections ?? {});
|
|
62
|
+
const parts = facts?.parts ?? [];
|
|
63
|
+
const find = (key) => entries.find(([heading]) => HEADINGS[key](heading.toLowerCase()));
|
|
64
|
+
const text = (key) => find(key)?.[1] ?? '';
|
|
65
|
+
const part = (key) => {
|
|
66
|
+
const heading = find(key)?.[0];
|
|
67
|
+
return heading === undefined ? undefined : parts.find((p) => p.heading === heading);
|
|
68
|
+
};
|
|
69
|
+
const summary = (key) => part(key)?.summary ?? [];
|
|
70
|
+
const short = (key) => summary(key)[0] ?? firstSentence(text(key));
|
|
71
|
+
const listed = (key) => {
|
|
72
|
+
const all = items(text(key));
|
|
73
|
+
const shown = summary(key).length ? summary(key) : all;
|
|
74
|
+
return { shown, count: Math.max(all.length, shown.length) };
|
|
75
|
+
};
|
|
76
|
+
const must = listed('must');
|
|
77
|
+
const later = listed('later');
|
|
78
|
+
const kind = facts?.kind?.toUpperCase();
|
|
79
|
+
const line = kindLine(short('kind'));
|
|
80
|
+
const read = {};
|
|
81
|
+
for (const key of ['what', 'who', 'kind', 'earns', 'must', 'later']) {
|
|
82
|
+
const found = part(key);
|
|
83
|
+
if (found?.text)
|
|
84
|
+
read[key] = { heading: found.heading, text: found.text };
|
|
85
|
+
}
|
|
86
|
+
const whole = parts.filter((p) => p.text).map(({ heading, text }) => ({ heading, text }));
|
|
87
|
+
return {
|
|
88
|
+
what: short('what'),
|
|
89
|
+
who: summary('who').length
|
|
90
|
+
? summary('who').map(whoRow)
|
|
91
|
+
: firstList(text('who')).map((role) => ({ role })),
|
|
92
|
+
kind,
|
|
93
|
+
...(line ? { kindLine: line } : {}),
|
|
94
|
+
earns: short('earns'),
|
|
95
|
+
must: must.shown,
|
|
96
|
+
...(must.count > must.shown.length ? { mustCount: must.count } : {}),
|
|
97
|
+
later: later.shown,
|
|
98
|
+
...(later.count > later.shown.length ? { laterCount: later.count } : {}),
|
|
99
|
+
questions: questionLines(text('questions')),
|
|
100
|
+
...(Object.keys(read).length ? { read } : {}),
|
|
101
|
+
...(whole.length ? { whole } : {}),
|
|
102
|
+
};
|
|
103
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { type Chat } from '@buffcore/contracts/workbench';
|
|
1
|
+
import { type Attachment, type Chat } from '@buffcore/contracts/workbench';
|
|
2
2
|
import type { StudioAppProps } from './StudioApp.tsx';
|
|
3
3
|
/** The studio must fail to answer this many reads in a row before the panel says so. */
|
|
4
4
|
export declare const MISSES = 3;
|
|
5
5
|
export { usePolling } from './usePolling.ts';
|
|
6
6
|
/** Keep a local echo until a different stored user message arrives, independent of history length. */
|
|
7
|
-
export declare function useEcho(chat: Chat, post: (text: string, waitForRefresh?: false) => Promise<boolean>): {
|
|
7
|
+
export declare function useEcho(chat: Chat, post: (text: string, waitForRefresh?: false, attachments?: readonly Attachment[]) => Promise<boolean>): {
|
|
8
8
|
clear: (text: string) => void;
|
|
9
|
-
send: (text: string, waitForRefresh?: false) => Promise<boolean>;
|
|
9
|
+
send: (text: string, waitForRefresh?: false, attachments?: readonly Attachment[]) => Promise<boolean>;
|
|
10
10
|
sending: boolean;
|
|
11
11
|
chat: {
|
|
12
12
|
id: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { chatSchema, workbenchApi } from '@buffcore/contracts/workbench';
|
|
1
|
+
import { chatSchema, workbenchApi, } from '@buffcore/contracts/workbench';
|
|
2
2
|
import { useCallback, useRef, useState } from 'react';
|
|
3
3
|
import { endedChat } from './turn-fact.js';
|
|
4
4
|
import { usePolling } from './usePolling.js';
|
|
@@ -12,7 +12,7 @@ export function useEcho(chat, post) {
|
|
|
12
12
|
const clear = useCallback((text) => {
|
|
13
13
|
setEcho((current) => (current?.text === text ? undefined : current));
|
|
14
14
|
}, []);
|
|
15
|
-
const send = async (text, waitForRefresh) => {
|
|
15
|
+
const send = async (text, waitForRefresh, attachments) => {
|
|
16
16
|
if (chat.state === 'running' || sending.current?.id === chat.id || pending)
|
|
17
17
|
return false;
|
|
18
18
|
const request = { id: chat.id };
|
|
@@ -26,7 +26,12 @@ export function useEcho(chat, post) {
|
|
|
26
26
|
};
|
|
27
27
|
setEcho(next);
|
|
28
28
|
try {
|
|
29
|
-
|
|
29
|
+
const posted = attachments
|
|
30
|
+
? post(text, waitForRefresh, attachments)
|
|
31
|
+
: waitForRefresh === false
|
|
32
|
+
? post(text, false)
|
|
33
|
+
: post(text);
|
|
34
|
+
if (await posted)
|
|
30
35
|
return true;
|
|
31
36
|
}
|
|
32
37
|
catch {
|
|
@@ -147,7 +147,18 @@ export declare function useChat(props: StudioAppProps, state: StudioState | null
|
|
|
147
147
|
}[];
|
|
148
148
|
};
|
|
149
149
|
trouble: boolean;
|
|
150
|
-
send: (text: string
|
|
150
|
+
send: (text: string, given?: {
|
|
151
|
+
value: string;
|
|
152
|
+
queued?: boolean;
|
|
153
|
+
queueTurn?: string;
|
|
154
|
+
context?: string;
|
|
155
|
+
answerKey?: string;
|
|
156
|
+
focus?: number;
|
|
157
|
+
attachments?: readonly import("@buffcore/contracts/workbench").Attachment[];
|
|
158
|
+
card?: import("../studio/frame/panelControls.ts").MarksCard;
|
|
159
|
+
sent?: () => void;
|
|
160
|
+
typed?: string;
|
|
161
|
+
}) => Promise<boolean>;
|
|
151
162
|
sendTo: (body: NewChat, text: string) => Promise<boolean>;
|
|
152
163
|
questions: {
|
|
153
164
|
choices: Record<string, import("./question-transcript.ts").QuestionChoice>;
|
|
@@ -251,7 +262,7 @@ export declare function useChat(props: StudioAppProps, state: StudioState | null
|
|
|
251
262
|
answer: (context: string, key?: string) => void;
|
|
252
263
|
focus: () => void;
|
|
253
264
|
retry: () => Promise<boolean> | undefined;
|
|
254
|
-
skip: (text: string, waitForRefresh?: false) => Promise<boolean>;
|
|
265
|
+
skip: (text: string, waitForRefresh?: false, attachments?: readonly import("@buffcore/contracts/workbench").Attachment[]) => Promise<boolean>;
|
|
255
266
|
controls: {
|
|
256
267
|
seconds?: number;
|
|
257
268
|
stuck?: string;
|
|
@@ -295,6 +306,8 @@ export declare function useChat(props: StudioAppProps, state: StudioState | null
|
|
|
295
306
|
onUnqueue?: () => void;
|
|
296
307
|
context?: string;
|
|
297
308
|
focus?: number;
|
|
309
|
+
card?: import("../studio/frame/panelControls.ts").MarksCard;
|
|
310
|
+
onMarks: (message: import("../studio/frame/panelControls.ts").MarksMessage) => void;
|
|
298
311
|
};
|
|
299
312
|
blockingReason: string | undefined;
|
|
300
313
|
};
|
|
@@ -81,8 +81,11 @@ export function useChat(props, state, page, actions, workChange, selectionGenera
|
|
|
81
81
|
const scope = chatScope(page, change);
|
|
82
82
|
const id = selected[scope] ?? (state && openChatFor(state, page, change)?.id);
|
|
83
83
|
const { chat, trouble, refresh } = useChatRead(props, id);
|
|
84
|
-
const send = async (id, text) => {
|
|
85
|
-
|
|
84
|
+
const send = async (id, text, _wait, attachments) => {
|
|
85
|
+
// Only a message of marks carries pictures; every other send keeps its three arguments.
|
|
86
|
+
const result = await (attachments
|
|
87
|
+
? actions.send(id, text, false, attachments)
|
|
88
|
+
: actions.send(id, text, false));
|
|
86
89
|
void refresh();
|
|
87
90
|
return result;
|
|
88
91
|
};
|
|
@@ -101,7 +104,7 @@ export function useChat(props, state, page, actions, workChange, selectionGenera
|
|
|
101
104
|
? t(`studio.work.reason.${prerequisite.status}`)
|
|
102
105
|
: undefined;
|
|
103
106
|
const blocked = isUnready(state, active.agent) || !!blockingReason;
|
|
104
|
-
const echo = useEcho(active, async (text, waitForRefresh) => {
|
|
107
|
+
const echo = useEcho(active, async (text, waitForRefresh, attachments) => {
|
|
105
108
|
if (blockingReason)
|
|
106
109
|
return false;
|
|
107
110
|
if (active.work === 'coding')
|
|
@@ -109,12 +112,14 @@ export function useChat(props, state, page, actions, workChange, selectionGenera
|
|
|
109
112
|
const target = id ?? (await newChat())?.id;
|
|
110
113
|
if (!target)
|
|
111
114
|
return false;
|
|
115
|
+
if (attachments)
|
|
116
|
+
return !!(await send(target, text, waitForRefresh, attachments));
|
|
112
117
|
return !!(await (waitForRefresh === false ? send(target, text, false) : send(target, text)));
|
|
113
118
|
});
|
|
114
119
|
const rights = state?.viewer?.rights;
|
|
115
120
|
const turn = useChatControls(echo.chat, actions, refresh, !!state && (!rights || rights === 'all' || rights.includes('build')));
|
|
116
121
|
const questions = useQuestionChoices(active, (text) => echo.send(text, false), echo.clear);
|
|
117
|
-
const draft = useTurnDraft(id || `page:${scope}`, blocked ? 'failed' : echo.chat.state, echo.send, {
|
|
122
|
+
const draft = useTurnDraft(id || `page:${scope}`, blocked ? 'failed' : echo.chat.state, (text, attachments) => attachments ? echo.send(text, undefined, attachments) : echo.send(text), {
|
|
118
123
|
owner: props.fetch ?? globalThis.fetch,
|
|
119
124
|
fallback: `page:${scope}`,
|
|
120
125
|
...turnOutcome(echo.chat),
|
|
@@ -1,21 +1,13 @@
|
|
|
1
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
|
+
import { briefShort } from './brief-short.js';
|
|
4
5
|
import { brandDirection } from './loop-stage.js';
|
|
5
|
-
import { questionLines } from './questions.js';
|
|
6
6
|
export { loopStage, railStage } from './loop-stage.js';
|
|
7
7
|
const product = (state) => ({
|
|
8
8
|
...state.product,
|
|
9
9
|
agent: { name: agentName(state.agents.file?.default ?? 'claude') },
|
|
10
10
|
});
|
|
11
|
-
const section = (state, ...names) => {
|
|
12
|
-
const entries = Object.entries(state.plan?.brief?.sections ?? {});
|
|
13
|
-
return entries.find(([key]) => names.includes(key.toLowerCase()))?.[1] ?? '';
|
|
14
|
-
};
|
|
15
|
-
const lines = (text) => text
|
|
16
|
-
.split('\n')
|
|
17
|
-
.map((line) => line.replace(/^\s*(?:[-*+]|\d+[.)])\s+/, '').trim())
|
|
18
|
-
.filter(Boolean);
|
|
19
11
|
/** The brief reader removes template prompts, leaving empty section values. */
|
|
20
12
|
export function briefHasContent(state) {
|
|
21
13
|
return Object.values(state.plan?.brief?.sections ?? {}).some((answer) => Boolean(answer.trim()));
|
|
@@ -25,15 +17,7 @@ export function briefProps(state) {
|
|
|
25
17
|
return {
|
|
26
18
|
product: product(state),
|
|
27
19
|
notThis: state.plan?.notThis ?? [],
|
|
28
|
-
brief:
|
|
29
|
-
what: section(state, 'the idea'),
|
|
30
|
-
who: lines(section(state, 'who it is for')).map((role) => ({ role })),
|
|
31
|
-
kind: state.plan?.brief?.kind?.toUpperCase(),
|
|
32
|
-
earns: section(state, 'how it earns'),
|
|
33
|
-
must: lines(section(state, 'must do')),
|
|
34
|
-
later: lines(section(state, 'later', 'not this time')),
|
|
35
|
-
questions: questionLines(section(state, 'open questions', 'preguntas abiertas')),
|
|
36
|
-
},
|
|
20
|
+
brief: briefShort(state.plan?.brief),
|
|
37
21
|
};
|
|
38
22
|
}
|
|
39
23
|
export function planProps(state) {
|
|
@@ -135,6 +135,9 @@ export function protoSample(state, change, ui = {}, listed = []) {
|
|
|
135
135
|
others: scenes
|
|
136
136
|
.filter((scene) => scene.surface === 'app')
|
|
137
137
|
.map((scene) => ({ scene: scene.key, label: scene.title })),
|
|
138
|
+
consoleOthers: scenes
|
|
139
|
+
.filter((scene) => scene.surface === 'admin')
|
|
140
|
+
.map((scene) => ({ scene: scene.key, label: scene.title })),
|
|
138
141
|
versions: (record?.versions ?? []).map(versionProps),
|
|
139
142
|
approved: prototypeApproval(state, change),
|
|
140
143
|
comment: { component: '', screen: ui.screen ?? '', text: '' },
|
|
@@ -168,6 +168,11 @@ export declare function loopApi(initial?: {
|
|
|
168
168
|
brief: {
|
|
169
169
|
sections: Record<string, string>;
|
|
170
170
|
kind?: "b2b" | "b2c" | undefined;
|
|
171
|
+
parts?: {
|
|
172
|
+
heading: string;
|
|
173
|
+
summary: string[];
|
|
174
|
+
text: string;
|
|
175
|
+
}[] | undefined;
|
|
171
176
|
} | null;
|
|
172
177
|
milestones: {
|
|
173
178
|
name: string;
|
|
@@ -626,6 +631,11 @@ export declare function loopApi(initial?: {
|
|
|
626
631
|
brief: {
|
|
627
632
|
sections: Record<string, string>;
|
|
628
633
|
kind?: "b2b" | "b2c" | undefined;
|
|
634
|
+
parts?: {
|
|
635
|
+
heading: string;
|
|
636
|
+
summary: string[];
|
|
637
|
+
text: string;
|
|
638
|
+
}[] | undefined;
|
|
629
639
|
} | null;
|
|
630
640
|
milestones: {
|
|
631
641
|
name: string;
|
|
@@ -30,7 +30,8 @@ export declare function useStudio({ token, fetch, every }: StudioAppProps): {
|
|
|
30
30
|
approve?: (direction: string, fingerprint: string) => unknown;
|
|
31
31
|
approveRelease?: (id: string, server: import("../types.ts").ServerForm) => Promise<unknown>;
|
|
32
32
|
catchUp?: (change: string) => Promise<unknown>;
|
|
33
|
-
send: (id: string, text: string, waitForRefresh?: false) => Promise<boolean>;
|
|
33
|
+
send: (id: string, text: string, waitForRefresh?: false, attachments?: readonly import("@buffcore/contracts/workbench").Attachment[]) => Promise<boolean>;
|
|
34
|
+
markShot?: (body: import("@buffcore/contracts/workbench").MarkShotBody) => Promise<import("@buffcore/contracts/workbench").Attachment | undefined>;
|
|
34
35
|
newChat: (body: import("@buffcore/contracts/workbench").NewChat) => Promise<import("@buffcore/contracts/workbench").Chat | undefined>;
|
|
35
36
|
allowFolder?: (id: string, at: number) => Promise<true | string>;
|
|
36
37
|
platformsWanted?: {
|
|
@@ -2,8 +2,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
// The agent's panel: the person's own agent (their CLI, their plan) talking about the page that is
|
|
3
3
|
// open. The conversation is most of the person's work; approvals are the rest.
|
|
4
4
|
import { useT } from '@buffcore/i18n/react';
|
|
5
|
+
import { useEffect } from 'react';
|
|
5
6
|
import { Icon } from '../../../components/Icon.js';
|
|
6
7
|
import { captionText } from '../../../components/styles.js';
|
|
8
|
+
import { ChangeList } from '../marks/ChangeList.js';
|
|
9
|
+
import { useActiveMarks, useMarkSheet } from '../marks/marks.js';
|
|
7
10
|
import { ComposerView, useComposer } from './Composer.js';
|
|
8
11
|
import { PanelList } from './PanelList.js';
|
|
9
12
|
function PanelHeader({ agent, where }) {
|
|
@@ -28,10 +31,30 @@ function PanelHeader({ agent, where }) {
|
|
|
28
31
|
justifyContent: 'center',
|
|
29
32
|
}, children: _jsx(Icon, { name: "sparkles", size: "var(--icon-sm)" }) }), _jsxs("span", { style: { display: 'grid', minWidth: 0 }, children: [_jsx("strong", { translate: "no", style: { color: 'var(--text-strong)', fontWeight: 'var(--weight-medium)' }, children: agent.name }), _jsx("span", { style: captionText, children: t('studio.frame.panel.where', { where: agent.where ?? where }) })] })] }));
|
|
30
33
|
}
|
|
34
|
+
const said = (list) => JSON.stringify(list.map(({ scroll: _, ...mark }) => mark));
|
|
35
|
+
/** A mark made or removed while its message waits takes the message out of the queue. */
|
|
36
|
+
function useMarksChanged(agent, page, now) {
|
|
37
|
+
const composer = agent.turn?.composer;
|
|
38
|
+
const card = composer?.queued ? composer.card : undefined;
|
|
39
|
+
const unqueue = composer?.onUnqueue;
|
|
40
|
+
const mine = !!card && card.change === page?.change && card.version === page?.version;
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
// Compared by what they say (a new array with the same marks and notes is no change); a
|
|
43
|
+
// scroll the app reported late is not a change the person made.
|
|
44
|
+
if (mine && card && now && said(card.marks) !== said(now))
|
|
45
|
+
unqueue?.();
|
|
46
|
+
}, [mine, card, now, unqueue]);
|
|
47
|
+
}
|
|
31
48
|
export function AgentPanel({ agent, simple, hidden, focusComposer, where, onSend, onAttach, onRemoveAttachment, }) {
|
|
32
49
|
const t = useT();
|
|
33
50
|
const composer = { agent, simple, focusComposer, onSend, onAttach, onRemoveAttachment };
|
|
34
51
|
const model = useComposer(composer);
|
|
52
|
+
// While the open Prototype page has marks, the change list rides on the box (a queued message
|
|
53
|
+
// of marks waits in the chat as its card instead).
|
|
54
|
+
const page = useActiveMarks();
|
|
55
|
+
const sheet = useMarkSheet(page?.key);
|
|
56
|
+
const listed = !!page && sheet.marks.length > 0 && !agent.turn?.composer?.queued;
|
|
57
|
+
useMarksChanged(agent, page, sheet.marks);
|
|
35
58
|
if (hidden)
|
|
36
59
|
return null;
|
|
37
60
|
return (_jsxs("aside", { "aria-label": t('studio.frame.panel.title'), style: {
|
|
@@ -45,5 +68,5 @@ export function AgentPanel({ agent, simple, hidden, focusComposer, where, onSend
|
|
|
45
68
|
gridTemplateRows: 'auto minmax(0, 1fr) auto',
|
|
46
69
|
background: 'var(--surface-panel)',
|
|
47
70
|
borderInlineStart: 'var(--border-width-hairline) solid var(--border-hairline)',
|
|
48
|
-
}, children: [_jsx(PanelHeader, { agent: agent, where: where }), _jsx(PanelList, { agent: agent, simple: simple }, agent.chatId ?? agent.about), _jsx(ComposerView, { ...composer, model: model })] }));
|
|
71
|
+
}, children: [_jsx(PanelHeader, { agent: agent, where: where }), _jsx(PanelList, { agent: agent, simple: simple }, agent.chatId ?? agent.about), listed ? (_jsx(ChangeList, { agent: agent, page: page, sheet: sheet })) : (_jsx(ComposerView, { ...composer, model: model }))] }));
|
|
49
72
|
}
|
|
@@ -52,6 +52,6 @@ export function PanelList({ agent, simple }) {
|
|
|
52
52
|
...message,
|
|
53
53
|
...(agent.turn?.sending && i === lines.length - 1 ? { sending: true } : {}),
|
|
54
54
|
}, turn: agent.turn, at: position, latestEnd: i === latestEnd, simple: simple, canApprove: agent.canApprove, approvalByRule: agent.approvalByRule }, position))), refused &&
|
|
55
|
-
(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 &&
|
|
55
|
+
(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: agent.name })), agent.turn?.cleared && _jsx(ClearedLine, {}), agent.running &&
|
|
56
56
|
(agent.turn?.stuck ? (_jsx(StuckTurn, { agent: agent.name, turn: agent.turn })) : agent.turn?.ask ? (_jsx(PermissionAsk, { agent: agent.name, turn: agent.turn })) : (_jsx(WorkingBar, { turn: agent.turn ?? {} }))), _jsx(Place, { id: "chat.end" })] }));
|
|
57
57
|
}
|
|
@@ -30,5 +30,7 @@ export interface SegmentedProps<T extends string> {
|
|
|
30
30
|
label: ReactNode;
|
|
31
31
|
}[];
|
|
32
32
|
onChange?: (value: T) => void;
|
|
33
|
+
/** Each segment a full touch target (a phone-wide studio). */
|
|
34
|
+
tall?: boolean;
|
|
33
35
|
}
|
|
34
|
-
export declare function Segmented<T extends string>({ label, value, options, onChange, }: SegmentedProps<T>): import("react").JSX.Element;
|
|
36
|
+
export declare function Segmented<T extends string>({ label, value, options, onChange, tall, }: SegmentedProps<T>): import("react").JSX.Element;
|
|
@@ -25,13 +25,14 @@ export function segLook(on) {
|
|
|
25
25
|
lineHeight: 1.2,
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
export function Segmented({ label, value, options, onChange, }) {
|
|
29
|
-
return (_jsx("div", { role: "group", "aria-label": label, style: segTrack, children: options.map((o) => (_jsx(Segment, { on: o.value === value, disabled: !onChange, onClick: () => onChange?.(o.value), children: o.label }, o.value))) }));
|
|
28
|
+
export function Segmented({ label, value, options, onChange, tall, }) {
|
|
29
|
+
return (_jsx("div", { role: "group", "aria-label": label, style: segTrack, children: options.map((o) => (_jsx(Segment, { on: o.value === value, tall: tall, disabled: !onChange, onClick: () => onChange?.(o.value), children: o.label }, o.value))) }));
|
|
30
30
|
}
|
|
31
|
-
function Segment({ on, disabled, onClick, children, }) {
|
|
31
|
+
function Segment({ on, tall, disabled, onClick, children, }) {
|
|
32
32
|
const [st, h] = useInteraction();
|
|
33
33
|
return (_jsx("button", { type: "button", "aria-pressed": on, disabled: disabled, onClick: onClick, ...h, style: {
|
|
34
34
|
...segLook(on),
|
|
35
|
+
...(tall ? { minBlockSize: 'var(--control-md)', minInlineSize: 'var(--control-md)' } : {}),
|
|
35
36
|
...(st.hover && !on && !disabled ? { color: 'var(--text-strong)' } : {}),
|
|
36
37
|
cursor: disabled ? 'default' : 'pointer',
|
|
37
38
|
...focusRing(st.focus),
|
|
@@ -6,7 +6,7 @@ import { useEffect, useState } from 'react';
|
|
|
6
6
|
import { StudioLook } from '../../../components/look.js';
|
|
7
7
|
import { usePlaces } from '../../app/places.js';
|
|
8
8
|
import { AgentPanel } from './AgentPanel.js';
|
|
9
|
-
import { PrototypeFrameNarrow, useLayout } from './layout.js';
|
|
9
|
+
import { PrototypeFrameNarrow, StudioPaneContext, useLayout } from './layout.js';
|
|
10
10
|
import { useMachine } from './machine.js';
|
|
11
11
|
import { HostPage, Place } from './Place.js';
|
|
12
12
|
import { AppUrl } from './RealApp.js';
|
|
@@ -64,7 +64,7 @@ function Body({ props, layout, children, }) {
|
|
|
64
64
|
const panel = props.reviewer
|
|
65
65
|
? undefined
|
|
66
66
|
: (visible) => props.panelPreview != null ? (visible ? (props.panelPreview) : null) : (_jsx(AgentPanel, { simple: prototype, hidden: !visible, focusComposer: visible, agent: props.agent, where: machine.short, onSend: props.onSend, onAttach: props.onAttach, onRemoveAttachment: props.onRemoveAttachment }));
|
|
67
|
-
const page = (_jsx(PageColumn, { contained: prototype, children: _jsx(PrototypeFrameNarrow, { value: prototype ? narrow : undefined, children: children }) }));
|
|
67
|
+
const page = (_jsx(PageColumn, { contained: prototype, children: _jsx(StudioPaneContext.Provider, { value: setPane, children: _jsx(PrototypeFrameNarrow, { value: prototype ? narrow : undefined, children: children }) }) }));
|
|
68
68
|
return (_jsx(StudioRegions, { layout: layout, pane: pane, onPane: setPane, page: page, rail: rail, panel: panel, panelOpen: open, contained: prototype }));
|
|
69
69
|
}
|
|
70
70
|
function PageColumn({ children, contained }) {
|
|
@@ -84,5 +84,5 @@ function TopStrip({ children }) {
|
|
|
84
84
|
return (_jsxs("div", { children: [children, _jsx(Place, { id: "top.below" })] }));
|
|
85
85
|
}
|
|
86
86
|
function frameRail(props, layout, go) {
|
|
87
|
-
return (_jsx(StudioRail, { level: props.level, rail: props.reviewer ? { form: 'places' } : props.rail, places: props.reviewer ? ['prototype'] : props.places, reviewer: props.reviewer, page: props.page, product: props.product, collapsed: layout === 'mid', block: layout === 'narrow', onGo: go }));
|
|
87
|
+
return (_jsx(StudioRail, { level: props.level, rail: props.reviewer ? { form: 'places' } : props.rail, places: props.reviewer ? ['prototype'] : props.places, reviewer: props.reviewer, page: props.page, product: props.product, collapsed: layout === 'mid' || (layout === 'wide' && props.page === 'prototype'), block: layout === 'narrow', onGo: go }));
|
|
88
88
|
}
|
|
@@ -71,7 +71,10 @@ export class StudioRegions extends Component {
|
|
|
71
71
|
minInlineSize: 0,
|
|
72
72
|
overflow: contained || narrow ? 'hidden' : undefined,
|
|
73
73
|
gridTemplateRows: narrow ? 'auto minmax(0, 1fr)' : 'minmax(0, 1fr)',
|
|
74
|
-
|
|
74
|
+
// The Prototype (a contained page) folds the rail to its icons, to give the device room.
|
|
75
|
+
gridTemplateColumns: narrow
|
|
76
|
+
? undefined
|
|
77
|
+
: columns(layout === 'mid' || contained, showPanel),
|
|
75
78
|
}, children: [narrow && _jsx(RegionTabs, { pane: pane, onPane: onPane, agent: !!panel }), _jsx(PaneSlot, { id: "loop", narrow: narrow, visible: showRail, children: showRail && rail }), _jsx(PaneSlot, { id: "page", narrow: narrow, visible: !narrow || pane === 'page', children: page }), _jsx(PaneSlot, { id: "agent", narrow: narrow, visible: showPanel, children: panel?.(showPanel) })] }));
|
|
76
79
|
}
|
|
77
80
|
}
|
|
@@ -24,6 +24,7 @@ export declare function Unready({ agent, turn }: {
|
|
|
24
24
|
agent: string;
|
|
25
25
|
turn: TurnControls;
|
|
26
26
|
}): import("react").JSX.Element;
|
|
27
|
-
export declare function QueuedLine({ composer }: {
|
|
27
|
+
export declare function QueuedLine({ composer, agent, }: {
|
|
28
28
|
composer: NonNullable<TurnControls['composer']>;
|
|
29
|
+
agent: string;
|
|
29
30
|
}): import("react").JSX.Element;
|
|
@@ -4,6 +4,7 @@ import { Banner } from '../../../components/Banner.js';
|
|
|
4
4
|
import { Button } from '../../../components/Button.js';
|
|
5
5
|
import { Icon } from '../../../components/Icon.js';
|
|
6
6
|
import { bodyText, monoText } from '../../../components/styles.js';
|
|
7
|
+
import { QueuedChanges } from '../marks/QueuedChanges.js';
|
|
7
8
|
import { turnTime } from './panelLines.js';
|
|
8
9
|
export function WorkingBar({ turn }) {
|
|
9
10
|
const t = useT();
|
|
@@ -42,8 +43,10 @@ export function Unready({ agent, turn }) {
|
|
|
42
43
|
const t = useT();
|
|
43
44
|
return (_jsxs(Banner, { tone: "attention", title: t('studio.frame.turn.agentNotReady', { agent }), children: [_jsx("p", { style: { margin: 0 }, children: t('studio.frame.turn.agentNotReadyWhy') }), _jsx(Button, { variant: "secondary", size: "sm", onClick: turn.onAgents, children: t('studio.frame.page.agents') })] }));
|
|
44
45
|
}
|
|
45
|
-
export function QueuedLine({ composer }) {
|
|
46
|
+
export function QueuedLine({ composer, agent, }) {
|
|
46
47
|
const t = useT();
|
|
48
|
+
if (composer.card)
|
|
49
|
+
return _jsx(QueuedChanges, { card: composer.card, agent: agent, onUnqueue: composer.onUnqueue });
|
|
47
50
|
return (_jsxs("li", { style: { display: 'grid', gap: 'var(--space-1)', justifyItems: 'end' }, children: [_jsx("p", { style: {
|
|
48
51
|
...bodyText,
|
|
49
52
|
margin: 0,
|
|
@@ -12,6 +12,8 @@ export declare function useLayout(forced?: FrameLayout, viewportFallback?: boole
|
|
|
12
12
|
known: boolean;
|
|
13
13
|
};
|
|
14
14
|
export declare const PrototypeFrameNarrow: import("react").Context<boolean | undefined>;
|
|
15
|
+
/** Shows one of the frame's panes on a phone-wide studio (the agent's, for the page's Changes). */
|
|
16
|
+
export declare const StudioPaneContext: import("react").Context<((pane: 'page' | 'agent') => void) | undefined>;
|
|
15
17
|
export declare function usePrototypeNarrow(): boolean;
|
|
16
18
|
/**
|
|
17
19
|
* The mode a scene page was asked to draw in: its "mode" query (read before anything is drawn, so a
|
|
@@ -26,6 +26,8 @@ export function useLayout(forced, viewportFallback = false) {
|
|
|
26
26
|
return { ref, layout: known ?? (viewportFallback && phone ? 'narrow' : 'wide'), known: !!known };
|
|
27
27
|
}
|
|
28
28
|
export const PrototypeFrameNarrow = createContext(undefined);
|
|
29
|
+
/** Shows one of the frame's panes on a phone-wide studio (the agent's, for the page's Changes). */
|
|
30
|
+
export const StudioPaneContext = createContext(undefined);
|
|
29
31
|
export function usePrototypeNarrow() {
|
|
30
32
|
const viewport = useNarrow(NARROW_BELOW);
|
|
31
33
|
return useContext(PrototypeFrameNarrow) ?? viewport;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { Chat } from '@buffcore/contracts/workbench';
|
|
1
|
+
import type { Attachment, Chat } from '@buffcore/contracts/workbench';
|
|
2
|
+
import type { Mark } from '../marks/marks.ts';
|
|
2
3
|
import type { StudioAgentPanel } from '../types.ts';
|
|
3
4
|
import type { PanelMessage } from './panelLines.ts';
|
|
4
5
|
/** Turn facts and callbacks are supplied by the served container, or by a scene. */
|
|
@@ -52,8 +53,27 @@ export interface TurnControls {
|
|
|
52
53
|
onUnqueue?: () => void;
|
|
53
54
|
context?: string;
|
|
54
55
|
focus?: number;
|
|
56
|
+
/** The card of a message of marks while it waits for the turn to end. */
|
|
57
|
+
card?: MarksCard;
|
|
58
|
+
/** Sends one message of marks now, or queues it as one card while a turn runs. */
|
|
59
|
+
onMarks?: (message: MarksMessage) => void;
|
|
55
60
|
};
|
|
56
61
|
}
|
|
62
|
+
/** What the queued card of a message of marks shows. */
|
|
63
|
+
export interface MarksCard {
|
|
64
|
+
change: string;
|
|
65
|
+
version: string;
|
|
66
|
+
marks: readonly Mark[];
|
|
67
|
+
pictures: number;
|
|
68
|
+
}
|
|
69
|
+
/** One message for every mark: its words, a picture of each marked screen, and its card. */
|
|
70
|
+
export interface MarksMessage {
|
|
71
|
+
text: string;
|
|
72
|
+
attachments: readonly Attachment[];
|
|
73
|
+
card: MarksCard;
|
|
74
|
+
/** Called once it went: the sheet is cleared. */
|
|
75
|
+
sent: () => void;
|
|
76
|
+
}
|
|
57
77
|
export type AskAnswer = 'once' | 'always' | 'deny';
|
|
58
78
|
export type Asking = NonNullable<Chat['asking']>;
|
|
59
79
|
/** A card the person answered: it folds to one line while the turn goes on. */
|
|
@@ -1 +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";
|
|
1
|
+
export declare const STUDIO_SCROLLBARS = "\n[data-studio-frame],[data-studio-frame] *{scrollbar-width:thin;scrollbar-color:color-mix(in srgb, var(--border-strong) 65%, var(--text-subtle)) 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:color-mix(in srgb, var(--border-strong) 65%, var(--text-subtle));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";
|
|
@@ -1,10 +1,12 @@
|
|
|
1
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.
|
|
2
|
+
// scrolls inside the frame. Tokens only, so a host's theme colors them too. The thumb is the strong
|
|
3
|
+
// border taken a third of the way toward the subtle text: easy to find, still quiet.
|
|
4
|
+
const THUMB = 'color-mix(in srgb, var(--border-strong) 65%, var(--text-subtle))';
|
|
3
5
|
export const STUDIO_SCROLLBARS = `
|
|
4
|
-
[data-studio-frame],[data-studio-frame] *{scrollbar-width:thin;scrollbar-color
|
|
6
|
+
[data-studio-frame],[data-studio-frame] *{scrollbar-width:thin;scrollbar-color:${THUMB} transparent}
|
|
5
7
|
[data-studio-frame] ::-webkit-scrollbar,[data-studio-frame]::-webkit-scrollbar{width:var(--space-2);height:var(--space-2)}
|
|
6
8
|
[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
|
|
9
|
+
[data-studio-frame] ::-webkit-scrollbar-thumb,[data-studio-frame]::-webkit-scrollbar-thumb{background:${THUMB};border-radius:var(--radius-chip)}
|
|
8
10
|
[data-studio-frame] ::-webkit-scrollbar-thumb:hover{background:var(--text-subtle)}
|
|
9
11
|
[data-studio-frame] ::-webkit-scrollbar-corner{background:transparent}
|
|
10
12
|
`;
|