@buffcore/admin-shell 0.8.43 → 0.8.45
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/workbench/app/ServedPrototype.d.ts +2 -0
- package/dist/workbench/app/ServedPrototype.js +11 -1
- package/dist/workbench/app/__snapshots__/places-dom.test.tsx.snap +30 -3
- 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 +5 -5
- package/dist/workbench/app/chat-session.js +8 -3
- package/dist/workbench/app/chat.d.ts +17 -4
- package/dist/workbench/app/chat.js +9 -4
- package/dist/workbench/app/frame.js +5 -1
- package/dist/workbench/app/loop.js +2 -18
- package/dist/workbench/app/pages.js +10 -2
- package/dist/workbench/app/prototype.js +3 -0
- package/dist/workbench/app/test/loop-fixture.d.ts +13 -1
- package/dist/workbench/app/useStudio.d.ts +2 -1
- package/dist/workbench/studio/frame/AgentPanel.js +24 -1
- package/dist/workbench/studio/frame/Composer.js +13 -10
- 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/SettingsSheet.js +10 -9
- package/dist/workbench/studio/frame/StudioFrame.js +7 -6
- 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 -0
- package/dist/workbench/studio/frame/scrollbars.js +12 -0
- package/dist/workbench/studio/frame/useTurnDraft.d.ts +22 -2
- package/dist/workbench/studio/frame/useTurnDraft.js +48 -16
- package/dist/workbench/studio/i18n/frame.en.d.ts +3 -0
- package/dist/workbench/studio/i18n/frame.en.js +4 -1
- package/dist/workbench/studio/i18n/frame.es.json +4 -1
- 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 +12 -1
- package/dist/workbench/studio/loop/PrototypeApp.js +30 -13
- package/dist/workbench/studio/loop/PrototypeAttempt.d.ts +2 -1
- package/dist/workbench/studio/loop/PrototypeAttempt.js +94 -29
- 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 +127 -76
- 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-bridge.d.ts +8 -0
- package/dist/workbench/studio/loop/prototype-bridge.js +16 -0
- package/dist/workbench/studio/loop/prototype-document.d.ts +9 -0
- package/dist/workbench/studio/loop/prototype-document.js +90 -2
- 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 +6 -1
- package/dist/workbench/studio/loop/usePrototypeFrame.js +4 -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/types.d.ts +2 -0
- package/dist/workbench/studio/work/StudioLater.js +0 -1
- package/dist/workbench/studio/work/work-test-data.d.ts +6 -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;
|
|
@@ -79,7 +79,7 @@ export declare function useEcho(chat: Chat, post: (text: string, waitForRefresh?
|
|
|
79
79
|
targets: string[];
|
|
80
80
|
refused?: boolean | undefined;
|
|
81
81
|
reason?: "command" | "monitor" | "permission" | "redirect" | "taskOutput" | undefined;
|
|
82
|
-
limit?: "deploy" | "publish" | "push" | "release" | "secrets" | "settings" | undefined;
|
|
82
|
+
limit?: "approval" | "commit" | "deploy" | "publish" | "push" | "release" | "secrets" | "settings" | undefined;
|
|
83
83
|
} | undefined;
|
|
84
84
|
permission?: {
|
|
85
85
|
path: string;
|
|
@@ -175,7 +175,7 @@ export declare function useChatRead(props: StudioAppProps, id: string | null | u
|
|
|
175
175
|
targets: string[];
|
|
176
176
|
refused?: boolean | undefined;
|
|
177
177
|
reason?: "command" | "monitor" | "permission" | "redirect" | "taskOutput" | undefined;
|
|
178
|
-
limit?: "deploy" | "publish" | "push" | "release" | "secrets" | "settings" | undefined;
|
|
178
|
+
limit?: "approval" | "commit" | "deploy" | "publish" | "push" | "release" | "secrets" | "settings" | undefined;
|
|
179
179
|
} | undefined;
|
|
180
180
|
permission?: {
|
|
181
181
|
path: 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 {
|
|
@@ -123,7 +123,7 @@ export declare function useChat(props: StudioAppProps, state: StudioState | null
|
|
|
123
123
|
targets: string[];
|
|
124
124
|
refused?: boolean | undefined;
|
|
125
125
|
reason?: "command" | "monitor" | "permission" | "redirect" | "taskOutput" | undefined;
|
|
126
|
-
limit?: "deploy" | "publish" | "push" | "release" | "secrets" | "settings" | undefined;
|
|
126
|
+
limit?: "approval" | "commit" | "deploy" | "publish" | "push" | "release" | "secrets" | "settings" | undefined;
|
|
127
127
|
} | undefined;
|
|
128
128
|
permission?: {
|
|
129
129
|
path: string;
|
|
@@ -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>;
|
|
@@ -225,7 +236,7 @@ export declare function useChat(props: StudioAppProps, state: StudioState | null
|
|
|
225
236
|
targets: string[];
|
|
226
237
|
refused?: boolean | undefined;
|
|
227
238
|
reason?: "command" | "monitor" | "permission" | "redirect" | "taskOutput" | undefined;
|
|
228
|
-
limit?: "deploy" | "publish" | "push" | "release" | "secrets" | "settings" | undefined;
|
|
239
|
+
limit?: "approval" | "commit" | "deploy" | "publish" | "push" | "release" | "secrets" | "settings" | undefined;
|
|
229
240
|
} | undefined;
|
|
230
241
|
permission?: {
|
|
231
242
|
path: string;
|
|
@@ -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),
|
|
@@ -56,7 +56,11 @@ export function frameProps(state, ui) {
|
|
|
56
56
|
const level = state.agents.file?.level ?? 'guide';
|
|
57
57
|
return {
|
|
58
58
|
onSend: ui.onSend,
|
|
59
|
-
product: {
|
|
59
|
+
product: {
|
|
60
|
+
...state.product,
|
|
61
|
+
agent: footLine(state, ui.t),
|
|
62
|
+
...(state.hostLaunched ? { hostLaunched: true } : {}),
|
|
63
|
+
},
|
|
60
64
|
level,
|
|
61
65
|
onLevel: (value) => ui.actions.level(value),
|
|
62
66
|
rail: { form: 'loop', stage: 'brief' },
|
|
@@ -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) {
|
|
@@ -43,6 +43,14 @@ export function StudioPages(props) {
|
|
|
43
43
|
pickJourney(id);
|
|
44
44
|
props.actions.go?.('prototype');
|
|
45
45
|
};
|
|
46
|
+
const onPlayed = () => pickJourney(undefined);
|
|
47
|
+
// A Play request lives only until the person leaves Prototype, so it never starts later.
|
|
48
|
+
const shown = useRef(props.page);
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (shown.current === 'prototype' && props.page !== 'prototype')
|
|
51
|
+
pickJourney(undefined);
|
|
52
|
+
shown.current = props.page;
|
|
53
|
+
}, [props.page]);
|
|
46
54
|
return (_jsxs(_Fragment, { children: [_jsx(AutoChoices, { viewer: props.state.viewer, choices: props.state.work?.autopilot, page: props.page, onChange: props.onStep &&
|
|
47
55
|
((choice) => props.onStep?.({
|
|
48
56
|
page: choice.step,
|
|
@@ -50,7 +58,7 @@ export function StudioPages(props) {
|
|
|
50
58
|
change: choice.change,
|
|
51
59
|
}, t('studio.auto.changeRequest', {
|
|
52
60
|
step: t(`studio.frame.page.${choice.step === 'merge' ? 'work' : choice.step}`),
|
|
53
|
-
}))) }), _jsx(PageRoute, { ...props, change: change, onChange: props.onChange ?? pickChange, journey: journey, onPlay: onPlay, server: server, onServer: onServer, iconSrc: iconSrc, work: { ui: workUi, onUi: onWorkUi, position: workPosition } })] }));
|
|
61
|
+
}))) }), _jsx(PageRoute, { ...props, change: change, onChange: props.onChange ?? pickChange, journey: journey, onPlay: onPlay, onPlayed: onPlayed, server: server, onServer: onServer, iconSrc: iconSrc, work: { ui: workUi, onUi: onWorkUi, position: workPosition } })] }));
|
|
54
62
|
}
|
|
55
63
|
function PageRoute(props) {
|
|
56
64
|
const { state, page, actions, onComment, onStep, journey, onPlay, server, onServer } = props;
|
|
@@ -63,7 +71,7 @@ function PageRoute(props) {
|
|
|
63
71
|
if (page === 'prototype')
|
|
64
72
|
return (_jsx(ServedPrototype, { every: props.every, change: props.change, version: props.work.position.current.opener === props.change
|
|
65
73
|
? props.work.position.current.version
|
|
66
|
-
: undefined, prototypeTurn: props.prototypeTurn, state: state, actions: actions, onComment: onComment, onStep: onStep, journey: journey }));
|
|
74
|
+
: undefined, prototypeTurn: props.prototypeTurn, state: state, actions: actions, onComment: onComment, onStep: onStep, journey: journey, onPlayed: props.onPlayed }));
|
|
67
75
|
// Fresh means chats known to be none; chats the viewer cannot read are unknown, so the Brief.
|
|
68
76
|
if (page === 'brief' && !briefHasContent(state) && state.chats?.length === 0)
|
|
69
77
|
return _jsx(ServedStart, { state: state, actions: actions, onStep: onStep, onLevel: props.onLevel });
|
|
@@ -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: '' },
|
|
@@ -8,6 +8,7 @@ export declare function LoopLocale({ children, locale }: {
|
|
|
8
8
|
}): import("react").JSX.Element;
|
|
9
9
|
export declare function loopApi(initial?: {
|
|
10
10
|
contained?: boolean | undefined;
|
|
11
|
+
hostLaunched?: boolean | undefined;
|
|
11
12
|
viewer?: {
|
|
12
13
|
name: string;
|
|
13
14
|
email?: string | undefined;
|
|
@@ -167,6 +168,11 @@ export declare function loopApi(initial?: {
|
|
|
167
168
|
brief: {
|
|
168
169
|
sections: Record<string, string>;
|
|
169
170
|
kind?: "b2b" | "b2c" | undefined;
|
|
171
|
+
parts?: {
|
|
172
|
+
heading: string;
|
|
173
|
+
summary: string[];
|
|
174
|
+
text: string;
|
|
175
|
+
}[] | undefined;
|
|
170
176
|
} | null;
|
|
171
177
|
milestones: {
|
|
172
178
|
name: string;
|
|
@@ -440,7 +446,7 @@ export declare function loopApi(initial?: {
|
|
|
440
446
|
targets: string[];
|
|
441
447
|
refused?: boolean | undefined;
|
|
442
448
|
reason?: "command" | "monitor" | "permission" | "redirect" | "taskOutput" | undefined;
|
|
443
|
-
limit?: "deploy" | "publish" | "push" | "release" | "secrets" | "settings" | undefined;
|
|
449
|
+
limit?: "approval" | "commit" | "deploy" | "publish" | "push" | "release" | "secrets" | "settings" | undefined;
|
|
444
450
|
} | undefined;
|
|
445
451
|
permission?: {
|
|
446
452
|
path: string;
|
|
@@ -465,6 +471,7 @@ export declare function loopApi(initial?: {
|
|
|
465
471
|
}>;
|
|
466
472
|
initial: {
|
|
467
473
|
contained?: boolean | undefined;
|
|
474
|
+
hostLaunched?: boolean | undefined;
|
|
468
475
|
viewer?: {
|
|
469
476
|
name: string;
|
|
470
477
|
email?: string | undefined;
|
|
@@ -624,6 +631,11 @@ export declare function loopApi(initial?: {
|
|
|
624
631
|
brief: {
|
|
625
632
|
sections: Record<string, string>;
|
|
626
633
|
kind?: "b2b" | "b2c" | undefined;
|
|
634
|
+
parts?: {
|
|
635
|
+
heading: string;
|
|
636
|
+
summary: string[];
|
|
637
|
+
text: string;
|
|
638
|
+
}[] | undefined;
|
|
627
639
|
} | null;
|
|
628
640
|
milestones: {
|
|
629
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
|
}
|
|
@@ -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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
|
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
|
|
60
|
-
|
|
61
|
-
|
|
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);
|
|
@@ -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),
|