@buffcore/admin-shell 0.8.42 → 0.8.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/screens/assistant/use-ask.d.ts +4 -3
- package/dist/workbench/app/ServedAgents.js +4 -1
- package/dist/workbench/app/ServedComp.d.ts +3 -0
- package/dist/workbench/app/ServedComp.js +33 -0
- package/dist/workbench/app/ServedPrototype.d.ts +2 -0
- package/dist/workbench/app/ServedPrototype.js +15 -1
- package/dist/workbench/app/__snapshots__/places-dom.test.tsx.snap +30 -3
- package/dist/workbench/app/actions.d.ts +7 -0
- package/dist/workbench/app/actions.js +1 -0
- package/dist/workbench/app/chat-session.d.ts +2 -0
- package/dist/workbench/app/chat.d.ts +2 -0
- package/dist/workbench/app/frame.js +5 -1
- package/dist/workbench/app/fresh.d.ts +63 -0
- package/dist/workbench/app/fresh.js +66 -0
- package/dist/workbench/app/pages.js +10 -2
- package/dist/workbench/app/places.d.ts +1 -1
- package/dist/workbench/app/prototype-comp.d.ts +46 -0
- package/dist/workbench/app/prototype-comp.js +77 -0
- package/dist/workbench/app/prototype.d.ts +1 -1
- package/dist/workbench/app/prototype.js +3 -1
- package/dist/workbench/app/test/loop-fixture.d.ts +15 -8
- package/dist/workbench/app/useStudio.d.ts +43 -1
- package/dist/workbench/app/useStudio.js +8 -1
- package/dist/workbench/app/work.d.ts +7 -7
- package/dist/workbench/studio/frame/Composer.js +13 -10
- package/dist/workbench/studio/frame/LimitCard.d.ts +5 -0
- package/dist/workbench/studio/frame/LimitCard.js +26 -0
- package/dist/workbench/studio/frame/PanelMessage.js +3 -0
- package/dist/workbench/studio/frame/SettingsSheet.js +10 -9
- package/dist/workbench/studio/frame/StudioFrame.js +4 -3
- package/dist/workbench/studio/frame/panelLines.d.ts +1 -0
- package/dist/workbench/studio/frame/panelLines.js +2 -1
- package/dist/workbench/studio/frame/scrollbars.d.ts +1 -0
- package/dist/workbench/studio/frame/scrollbars.js +10 -0
- package/dist/workbench/studio/frame/useTurnDraft.d.ts +2 -0
- package/dist/workbench/studio/frame/useTurnDraft.js +12 -9
- package/dist/workbench/studio/i18n/comp.en.d.ts +26 -0
- package/dist/workbench/studio/i18n/comp.en.js +26 -0
- package/dist/workbench/studio/i18n/comp.es.d.ts +26 -0
- package/dist/workbench/studio/i18n/comp.es.js +25 -0
- package/dist/workbench/studio/i18n/frame.en.d.ts +16 -0
- package/dist/workbench/studio/i18n/frame.en.js +16 -0
- package/dist/workbench/studio/i18n/frame.es.json +17 -1
- package/dist/workbench/studio/i18n/fresh.en.d.ts +19 -0
- package/dist/workbench/studio/i18n/fresh.en.js +20 -0
- package/dist/workbench/studio/i18n/fresh.es.json +18 -0
- package/dist/workbench/studio/i18n/index.js +6 -0
- package/dist/workbench/studio/loop/AgentsPage.d.ts +4 -1
- package/dist/workbench/studio/loop/AgentsPage.js +5 -4
- package/dist/workbench/studio/loop/CritiqueNote.d.ts +4 -0
- package/dist/workbench/studio/loop/CritiqueNote.js +9 -0
- package/dist/workbench/studio/loop/FreshLookPanel.d.ts +21 -0
- package/dist/workbench/studio/loop/FreshLookPanel.js +60 -0
- package/dist/workbench/studio/loop/PrototypeApp.d.ts +9 -0
- package/dist/workbench/studio/loop/PrototypeApp.js +6 -4
- package/dist/workbench/studio/loop/PrototypeAttempt.d.ts +2 -1
- package/dist/workbench/studio/loop/PrototypeAttempt.js +40 -16
- package/dist/workbench/studio/loop/PrototypeComp.d.ts +25 -0
- package/dist/workbench/studio/loop/PrototypeComp.js +78 -0
- package/dist/workbench/studio/loop/PrototypePage.d.ts +7 -0
- package/dist/workbench/studio/loop/PrototypePage.js +1 -1
- package/dist/workbench/studio/loop/PrototypePreview.js +34 -29
- package/dist/workbench/studio/loop/PrototypeSimplePage.js +11 -4
- package/dist/workbench/studio/loop/PrototypeSnapshot.d.ts +3 -0
- package/dist/workbench/studio/loop/PrototypeSnapshot.js +2 -1
- package/dist/workbench/studio/loop/ReviewSetting.d.ts +6 -0
- package/dist/workbench/studio/loop/ReviewSetting.js +14 -0
- package/dist/workbench/studio/loop/SaveStep.d.ts +3 -0
- package/dist/workbench/studio/loop/SaveStep.js +3 -1
- package/dist/workbench/studio/loop/ServedPlanning.js +1 -1
- package/dist/workbench/studio/loop/StructurePage.d.ts +5 -0
- package/dist/workbench/studio/loop/StructurePage.js +3 -2
- package/dist/workbench/studio/loop/SurfaceChoice.d.ts +7 -0
- package/dist/workbench/studio/loop/SurfaceChoice.js +20 -0
- 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 +7 -0
- package/dist/workbench/studio/loop/prototype-document.js +78 -2
- package/dist/workbench/studio/loop/usePlanningDraft.js +5 -1
- package/dist/workbench/studio/loop/usePrototypeFrame.d.ts +3 -1
- package/dist/workbench/studio/loop/usePrototypeFrame.js +2 -0
- package/dist/workbench/studio/types.d.ts +2 -0
- package/dist/workbench/studio/work/work-test-data.d.ts +7 -4
- package/package.json +6 -6
|
@@ -4,6 +4,7 @@ import { Badge } from '../../../components/Badge.js';
|
|
|
4
4
|
import { Banner } from '../../../components/Banner.js';
|
|
5
5
|
import { Icon } from '../../../components/Icon.js';
|
|
6
6
|
import { bodyText, captionText, monoText, panelSurface } from '../../../components/styles.js';
|
|
7
|
+
import { BesideSave, freshShown } from './FreshLookPanel.js';
|
|
7
8
|
import { ReasonButton } from './ReasonButton.js';
|
|
8
9
|
import { ReviewedSaveView } from './ReviewedSave.js';
|
|
9
10
|
import { fileList, fileSummary } from './ReviewedSaveFiles.js';
|
|
@@ -73,7 +74,8 @@ export function WritingNote({ agent }) {
|
|
|
73
74
|
}
|
|
74
75
|
/** A step page's drafted notes, under its header: writing first, then the save. */
|
|
75
76
|
export function StepNotes({ draft, agent }) {
|
|
76
|
-
|
|
77
|
+
const save = draft.review ? (_jsx(ReviewedSaveView, { save: draft.review })) : (draft.save && _jsx(SaveStep, { save: draft.save, agent: agent, onSave: draft.onSave }));
|
|
78
|
+
return (_jsxs(_Fragment, { children: [draft.writing && _jsx(WritingNote, { agent: agent }), freshShown(draft.fresh) ? _jsx(BesideSave, { look: draft.fresh, save: save }) : save, draft.error && _jsx(Banner, { tone: "error", children: draft.error })] }));
|
|
77
79
|
}
|
|
78
80
|
function saveReason(save, agent, t) {
|
|
79
81
|
if (save.state === 'writing')
|
|
@@ -12,7 +12,7 @@ export function ServedPlanning(props) {
|
|
|
12
12
|
const planning = usePlanningDraft(props);
|
|
13
13
|
const { step, draft, onNext, send } = planning;
|
|
14
14
|
if (step === 'structure')
|
|
15
|
-
return (_jsx(StructurePage, { agent: briefProps(state).product.agent.name, structure: state.plan?.structure, problem: state.plan?.structure?.problem, journeys: state.plan?.journeys ?? [], progress: draft.progress ?? 'not-started', draft: draft, onStart: send, onNext: onNext }));
|
|
15
|
+
return (_jsx(StructurePage, { agent: briefProps(state).product.agent.name, structure: state.plan?.structure, problem: state.plan?.structure?.problem, journeys: state.plan?.journeys ?? [], progress: draft.progress ?? 'not-started', draft: draft, onStart: send, onNext: onNext, onSurface: props.actions.chooseSurface }));
|
|
16
16
|
if (step === 'brief')
|
|
17
17
|
return _jsx(ServedBrief, { ...props, ...planning });
|
|
18
18
|
if (step === 'plan')
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FirstSurface } from '@buffcore/contracts/workbench';
|
|
1
2
|
import { type StepDraft } from './SaveStep.tsx';
|
|
2
3
|
export interface StructurePlan {
|
|
3
4
|
rows: readonly {
|
|
@@ -10,6 +11,8 @@ export interface StructurePlan {
|
|
|
10
11
|
planned?: string;
|
|
11
12
|
}[];
|
|
12
13
|
notes: readonly string[];
|
|
14
|
+
/** Which surface comes first; absent, desktop. */
|
|
15
|
+
surface?: FirstSurface;
|
|
13
16
|
}
|
|
14
17
|
export interface StructurePageProps {
|
|
15
18
|
agent: string;
|
|
@@ -23,6 +26,8 @@ export interface StructurePageProps {
|
|
|
23
26
|
problem?: string;
|
|
24
27
|
onStart?: (label: string) => void;
|
|
25
28
|
onNext?: (label: string) => void;
|
|
29
|
+
/** The person's answer to Which surface comes first, kept in the structure file. */
|
|
30
|
+
onSurface?: (surface: FirstSurface) => void;
|
|
26
31
|
}
|
|
27
32
|
/** Structure describes navigation intent; planning chat writes the file, the shared save commits it. */
|
|
28
33
|
export declare function StructurePage(props: StructurePageProps): import("react").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useT } from '@buffcore/i18n/react';
|
|
3
3
|
import { Badge } from '../../../components/Badge.js';
|
|
4
4
|
import { Banner } from '../../../components/Banner.js';
|
|
@@ -8,6 +8,7 @@ import { ReasonButton } from './ReasonButton.js';
|
|
|
8
8
|
import { nextReason, StepNotes } from './SaveStep.js';
|
|
9
9
|
import { StructureFile } from './StructurePreview.js';
|
|
10
10
|
import { StructurePrompts } from './StructurePrompts.js';
|
|
11
|
+
import { SurfaceChoice } from './SurfaceChoice.js';
|
|
11
12
|
/** Structure describes navigation intent; planning chat writes the file, the shared save commits it. */
|
|
12
13
|
export function StructurePage(props) {
|
|
13
14
|
const { agent, structure, draft, progress, problem, onNext } = props;
|
|
@@ -16,5 +17,5 @@ export function StructurePage(props) {
|
|
|
16
17
|
const why = problem ||
|
|
17
18
|
nextReason(draft, t) ||
|
|
18
19
|
(progress !== 'saved' ? t('studio.structure.wait') : undefined);
|
|
19
|
-
return (_jsxs(Page, { crumbs: [t('studio.frame.rail.step', { n: 5 }), t('studio.frame.page.structure')], title: t('studio.structure.title'), sub: t('studio.structure.sub'), actions: _jsx(ReasonButton, { size: "sm", disabled: !onNext, why: why, onClick: () => onNext?.(label), children: label }), children: [_jsx(Badge, { tone: progress === 'saved' ? 'success' : 'neutral', style: { justifySelf: 'start', alignSelf: 'flex-start' }, children: t(`studio.structure.state.${progress}`) }), draft && progress !== 'not-started' && _jsx(StepNotes, { draft: draft, agent: agent }), problem && _jsx(Banner, { tone: "error", children: problem }), _jsx(TwoColumns, { main: _jsx(StructurePrompts, { ...props }), side: _jsx(StructureFile, { structure: structure, problem: problem }) })] }));
|
|
20
|
+
return (_jsxs(Page, { crumbs: [t('studio.frame.rail.step', { n: 5 }), t('studio.frame.page.structure')], title: t('studio.structure.title'), sub: t('studio.structure.sub'), actions: _jsx(ReasonButton, { size: "sm", disabled: !onNext, why: why, onClick: () => onNext?.(label), children: label }), children: [_jsx(Badge, { tone: progress === 'saved' ? 'success' : 'neutral', style: { justifySelf: 'start', alignSelf: 'flex-start' }, children: t(`studio.structure.state.${progress}`) }), draft && progress !== 'not-started' && _jsx(StepNotes, { draft: draft, agent: agent }), problem && _jsx(Banner, { tone: "error", children: problem }), _jsx(TwoColumns, { main: _jsxs(_Fragment, { children: [_jsx(SurfaceChoice, { surface: structure?.surface, drafted: !!structure && !problem, onSurface: props.onSurface }), _jsx(StructurePrompts, { ...props })] }), side: _jsx(StructureFile, { structure: structure, problem: problem }) })] }));
|
|
20
21
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FirstSurface } from '@buffcore/contracts/workbench';
|
|
2
|
+
export declare function SurfaceChoice({ surface, drafted, onSurface, }: {
|
|
3
|
+
surface?: FirstSurface;
|
|
4
|
+
/** Whether `plan/structure.md` exists: the answer is kept in it. */
|
|
5
|
+
drafted: boolean;
|
|
6
|
+
onSurface?: (surface: FirstSurface) => void;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useT } from '@buffcore/i18n/react';
|
|
3
|
+
import { Choice } from '../../../components/Choice.js';
|
|
4
|
+
import { Panel } from '../../../components/Panel.js';
|
|
5
|
+
import { bodyText, captionText } from '../../../components/styles.js';
|
|
6
|
+
export function SurfaceChoice({ surface, drafted, onSurface, }) {
|
|
7
|
+
const t = useT();
|
|
8
|
+
return (_jsxs(Panel, { children: [_jsx("p", { style: { ...bodyText, margin: 0 }, children: t('studio.structure.surface.help') }), _jsx(Choice, { label: t('studio.structure.surface.question'), value: surface ?? 'desktop', disabled: !drafted || !onSurface, onChange: (value) => onSurface?.(value), options: [
|
|
9
|
+
{
|
|
10
|
+
value: 'desktop',
|
|
11
|
+
label: t('studio.structure.surface.desktop'),
|
|
12
|
+
help: t('studio.structure.surface.desktopHelp'),
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
value: 'phone',
|
|
16
|
+
label: t('studio.structure.surface.phone'),
|
|
17
|
+
help: t('studio.structure.surface.phoneHelp'),
|
|
18
|
+
},
|
|
19
|
+
] }), !drafted && (_jsx("p", { style: { ...captionText, margin: 0 }, children: t('studio.structure.surface.first') }))] }));
|
|
20
|
+
}
|
|
@@ -108,6 +108,14 @@ export declare function prototypeReady(data: unknown, expected: {
|
|
|
108
108
|
navigation: string;
|
|
109
109
|
document: string;
|
|
110
110
|
}): PrototypeDiscovery | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* The app says, on its private port and before its reply, that it plays the studio's show
|
|
113
|
+
* messages. An app without it (an older app-shell) is reloaded at each step instead.
|
|
114
|
+
*/
|
|
115
|
+
export declare function prototypePlayer(data: unknown, expected: {
|
|
116
|
+
navigation: string;
|
|
117
|
+
document: string;
|
|
118
|
+
}): boolean;
|
|
111
119
|
/** Heartbeats renew an existing proof; they never discover journeys or enable a waiting frame. */
|
|
112
120
|
export declare function prototypeHeartbeat(data: unknown, expected: {
|
|
113
121
|
navigation: string;
|
|
@@ -218,6 +218,22 @@ export function prototypeReady(data, expected) {
|
|
|
218
218
|
const reply = prototypeReply(data, expected);
|
|
219
219
|
return reply && 'discovery' in reply ? reply.discovery : undefined;
|
|
220
220
|
}
|
|
221
|
+
const player = z.strictObject({
|
|
222
|
+
type: z.literal('ape:prototype:player'),
|
|
223
|
+
version: z.literal(2),
|
|
224
|
+
navigation: z.string().uuid(),
|
|
225
|
+
document: z.string().uuid(),
|
|
226
|
+
});
|
|
227
|
+
/**
|
|
228
|
+
* The app says, on its private port and before its reply, that it plays the studio's show
|
|
229
|
+
* messages. An app without it (an older app-shell) is reloaded at each step instead.
|
|
230
|
+
*/
|
|
231
|
+
export function prototypePlayer(data, expected) {
|
|
232
|
+
const answer = player.safeParse(payload(data, 512));
|
|
233
|
+
return (answer.success &&
|
|
234
|
+
answer.data.navigation === expected.navigation &&
|
|
235
|
+
answer.data.document === expected.document);
|
|
236
|
+
}
|
|
221
237
|
/** Heartbeats renew an existing proof; they never discover journeys or enable a waiting frame. */
|
|
222
238
|
export function prototypeHeartbeat(data, expected) {
|
|
223
239
|
const answer = heartbeat.safeParse(payload(data, 512));
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { type FrameCause, type PrototypeDiscovery } from './prototype-bridge.ts';
|
|
2
|
+
/** What the studio asks the framed app to show: a journey at a step, or a preview data state. */
|
|
3
|
+
export type PrototypeShow = {
|
|
4
|
+
journey?: string;
|
|
5
|
+
step?: number;
|
|
6
|
+
data?: string;
|
|
7
|
+
};
|
|
2
8
|
/** silent: a hello and then no reply and no beat. reply: the app's reply was refused whole (see cause). */
|
|
3
9
|
export type FrameFailure = 'failed' | 'cookies' | 'silent' | 'reply';
|
|
4
10
|
export type FrameAnswer = Partial<PrototypeDiscovery> & {
|
|
@@ -15,6 +21,7 @@ type Input = {
|
|
|
15
21
|
};
|
|
16
22
|
export declare function watchPrototypeDocument(input: Input): {
|
|
17
23
|
alive: () => boolean;
|
|
24
|
+
show: (choice: PrototypeShow) => boolean;
|
|
18
25
|
fail: (failure?: FrameFailure, cause?: FrameCause) => void;
|
|
19
26
|
timedOutSilently: () => boolean;
|
|
20
27
|
close: () => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PROTOTYPE_LIVENESS, PROTOTYPE_WAIT, prototypeHeartbeat, prototypeHello, prototypeNavigationId, prototypeReply, } from './prototype-bridge.js';
|
|
1
|
+
import { PROTOTYPE_LIVENESS, PROTOTYPE_WAIT, prototypeHeartbeat, prototypeHello, prototypeNavigationId, prototypePlayer, prototypeReply, } from './prototype-bridge.js';
|
|
2
2
|
/** A deadline seen later than this (ms) was missed by the page, not by the app. */
|
|
3
3
|
const LATE_SLACK = 1_000;
|
|
4
4
|
/* Event x state -> readiness / nonce issued / controls / deadline
|
|
@@ -25,6 +25,11 @@ const LATE_SLACK = 1_000;
|
|
|
25
25
|
* Error/refused reply or hello -> failed / revoke port+nonce / off / cancel
|
|
26
26
|
* Failed/closed + hello or beat -> unchanged; restart needs a new session
|
|
27
27
|
* Disposal -> closed / revoke port+nonce / off / cancel
|
|
28
|
+
* Player note on that port -> this document plays show messages (an older app sends none)
|
|
29
|
+
* Later reply on that port -> only its step caption is taken; journeys and controls unchanged
|
|
30
|
+
* show() on a player document -> kept as the wanted choice; sent on the current port once alive
|
|
31
|
+
* Hello again (the app reloaded) -> the wanted choice is sent again on the new port once alive
|
|
32
|
+
* show() otherwise, or failed -> false: nothing kept, the caller reloads the frame instead
|
|
28
33
|
* A nonce is not a capability: even one copied into name/storage cannot renew via window messages.
|
|
29
34
|
* Only that hello's port carries replies/beats; the app closes it and clears its nonce on pagehide.
|
|
30
35
|
*/
|
|
@@ -37,6 +42,10 @@ export function watchPrototypeDocument(input) {
|
|
|
37
42
|
let timedOutSilently = false;
|
|
38
43
|
let phase = 'waiting';
|
|
39
44
|
let published = false;
|
|
45
|
+
/** This document said it plays show messages; the choice it should show; what was sent to it. */
|
|
46
|
+
let player = false;
|
|
47
|
+
let wanted;
|
|
48
|
+
let sent;
|
|
40
49
|
let deadline = 0;
|
|
41
50
|
let timer;
|
|
42
51
|
const revoke = () => {
|
|
@@ -124,6 +133,8 @@ export function watchPrototypeDocument(input) {
|
|
|
124
133
|
forgiven = false;
|
|
125
134
|
discovery = undefined;
|
|
126
135
|
published = false;
|
|
136
|
+
player = false;
|
|
137
|
+
sent = undefined;
|
|
127
138
|
nonce = prototypeNavigationId();
|
|
128
139
|
port = hello.port;
|
|
129
140
|
input.publish({});
|
|
@@ -135,7 +146,17 @@ export function watchPrototypeDocument(input) {
|
|
|
135
146
|
return;
|
|
136
147
|
// Expiry turns controls off, but a valid late proof on this document's port can revive it.
|
|
137
148
|
lapsed();
|
|
138
|
-
|
|
149
|
+
if (prototypePlayer(message.data, expected)) {
|
|
150
|
+
player = true;
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
// Once the journeys are known, only a later reply is read as one; heartbeats skip that parse.
|
|
154
|
+
const reply = discovery === undefined ||
|
|
155
|
+
(typeof message.data === 'string' && message.data.includes('"ape:prototype:reply"'))
|
|
156
|
+
? prototypeReply(message.data, expected)
|
|
157
|
+
: undefined;
|
|
158
|
+
if (reply && discovery !== undefined)
|
|
159
|
+
return caption(reply);
|
|
139
160
|
if (reply && 'cause' in reply)
|
|
140
161
|
return fail('reply', reply.cause);
|
|
141
162
|
if (reply) {
|
|
@@ -144,6 +165,7 @@ export function watchPrototypeDocument(input) {
|
|
|
144
165
|
if (phase === 'alive') {
|
|
145
166
|
published = true;
|
|
146
167
|
input.publish(discovery);
|
|
168
|
+
flush();
|
|
147
169
|
}
|
|
148
170
|
return;
|
|
149
171
|
}
|
|
@@ -159,6 +181,7 @@ export function watchPrototypeDocument(input) {
|
|
|
159
181
|
published = true;
|
|
160
182
|
input.publish(discovery);
|
|
161
183
|
}
|
|
184
|
+
flush();
|
|
162
185
|
};
|
|
163
186
|
current.start();
|
|
164
187
|
try {
|
|
@@ -174,12 +197,65 @@ export function watchPrototypeDocument(input) {
|
|
|
174
197
|
fail();
|
|
175
198
|
}
|
|
176
199
|
};
|
|
200
|
+
/**
|
|
201
|
+
* A later reply (the app re-sends one when its step changes) updates only the step caption: the
|
|
202
|
+
* journeys, liveness and controls stay as the first reply and the beats made them. A refused
|
|
203
|
+
* later reply is ignored, as before.
|
|
204
|
+
*/
|
|
205
|
+
const caption = (reply) => {
|
|
206
|
+
if (!discovery || !('discovery' in reply))
|
|
207
|
+
return;
|
|
208
|
+
const { stepCaption: old, ...rest } = discovery;
|
|
209
|
+
const next = reply.discovery.stepCaption;
|
|
210
|
+
if (JSON.stringify(old) === JSON.stringify(next))
|
|
211
|
+
return;
|
|
212
|
+
discovery = next ? { ...rest, stepCaption: next } : rest;
|
|
213
|
+
if (published)
|
|
214
|
+
input.publish(discovery);
|
|
215
|
+
};
|
|
216
|
+
/** Sends the wanted choice once to the current document, when it is alive and plays them. */
|
|
217
|
+
const flush = () => {
|
|
218
|
+
if (!wanted || sent === wanted || !player || !port || !nonce)
|
|
219
|
+
return;
|
|
220
|
+
if (phase !== 'alive' || discovery === undefined)
|
|
221
|
+
return;
|
|
222
|
+
const choice = wanted;
|
|
223
|
+
try {
|
|
224
|
+
port.postMessage(JSON.stringify({
|
|
225
|
+
type: 'ape:prototype:show',
|
|
226
|
+
version: 2,
|
|
227
|
+
navigation: input.navigation,
|
|
228
|
+
document: nonce,
|
|
229
|
+
...(choice.journey ? { journey: choice.journey, step: choice.step ?? 0 } : {}),
|
|
230
|
+
...(!choice.journey && choice.data ? { data: choice.data } : {}),
|
|
231
|
+
}));
|
|
232
|
+
sent = choice;
|
|
233
|
+
}
|
|
234
|
+
catch {
|
|
235
|
+
// A port that cannot carry it: the next hello's port gets the wanted choice.
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
/**
|
|
239
|
+
* Tells the app which journey and step, or which data, to show, without a reload. It goes only
|
|
240
|
+
* on the private port of the document whose hello passed the origin check. The choice is kept:
|
|
241
|
+
* sent now when that document is alive, else (its port gone stale while it reloads) on the next
|
|
242
|
+
* hello's port. False when the session failed or closed, or the document does not play show
|
|
243
|
+
* messages (an older app): the caller reloads the frame at that choice instead.
|
|
244
|
+
*/
|
|
245
|
+
const show = (choice) => {
|
|
246
|
+
if (phase === 'failed' || phase === 'closed' || !player)
|
|
247
|
+
return false;
|
|
248
|
+
wanted = choice;
|
|
249
|
+
flush();
|
|
250
|
+
return true;
|
|
251
|
+
};
|
|
177
252
|
window.addEventListener('message', receive);
|
|
178
253
|
document.addEventListener('visibilitychange', visibility);
|
|
179
254
|
input.publish({});
|
|
180
255
|
renew(PROTOTYPE_WAIT);
|
|
181
256
|
return {
|
|
182
257
|
alive,
|
|
258
|
+
show,
|
|
183
259
|
fail,
|
|
184
260
|
timedOutSilently: () => timedOutSilently,
|
|
185
261
|
close: () => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useT } from '@buffcore/i18n/react';
|
|
2
2
|
import { newChatFor } from '../../app/chat.js';
|
|
3
|
+
import { useFreshLook } from '../../app/fresh.js';
|
|
3
4
|
import { briefHasContent, briefProps } from '../../app/loop.js';
|
|
4
5
|
import { stepWaiting } from '../../app/loop-stage.js';
|
|
5
6
|
import { nextReason } from './SaveStep.js';
|
|
@@ -28,10 +29,12 @@ export function usePlanningDraft({ state, page, actions, onStep }) {
|
|
|
28
29
|
const writing = state.chats?.some((chat) => chat.title === step && !chat.change && chat.state === 'running') ??
|
|
29
30
|
false;
|
|
30
31
|
const draft = usePlanningSave(state, step, actions, writing);
|
|
32
|
+
const agentName = briefProps(state).product.agent.name;
|
|
33
|
+
const fresh = useFreshLook(actions, step, agentName, onStep && ((text) => onStep(newChatFor(step), text)));
|
|
31
34
|
useListOnArrival(draft, step, state.plan?.unsaved, viewerCanBuild(state));
|
|
32
35
|
const hasContent = planningContent(state, page);
|
|
33
36
|
draft.why = writing
|
|
34
|
-
? t('studio.loop.planning.why.writing', { agent:
|
|
37
|
+
? t('studio.loop.planning.why.writing', { agent: agentName })
|
|
35
38
|
: stepWaiting(state, page)
|
|
36
39
|
? t('studio.loop.planning.why.failed')
|
|
37
40
|
: !hasContent
|
|
@@ -48,5 +51,6 @@ export function usePlanningDraft({ state, page, actions, onStep }) {
|
|
|
48
51
|
: 'prototype';
|
|
49
52
|
const onNext = !draft.why && onStep ? (label) => onStep(newChatFor(next), label) : undefined;
|
|
50
53
|
const send = onStep && ((label) => onStep(newChatFor(step), label));
|
|
54
|
+
draft.fresh = fresh;
|
|
51
55
|
return { step, draft, hasContent, writing, onNext, send };
|
|
52
56
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type FrameFailure } from './prototype-document.ts';
|
|
1
|
+
import { type FrameFailure, type PrototypeShow } from './prototype-document.ts';
|
|
2
2
|
/** The session owns document changes; React only publishes its current navigation's answer. */
|
|
3
3
|
export declare function usePrototypeFrame(origin: string, navigation: string,
|
|
4
4
|
/** Remember when the switched address stayed silent so the next navigation uses the given one. */
|
|
@@ -22,5 +22,7 @@ onSwitch?: () => void, running?: boolean): {
|
|
|
22
22
|
cause: import("./prototype-bridge.ts").FrameCause | undefined;
|
|
23
23
|
recoverable: true | undefined;
|
|
24
24
|
alive: () => boolean;
|
|
25
|
+
/** Sends the choice to the running app; false when it could not, and the frame must reload. */
|
|
26
|
+
show: (choice: PrototypeShow) => boolean;
|
|
25
27
|
fail: (status?: FrameFailure) => void | undefined;
|
|
26
28
|
};
|
|
@@ -54,6 +54,8 @@ onSwitch, running) {
|
|
|
54
54
|
cause: current?.value.cause,
|
|
55
55
|
recoverable: current?.value.recoverable,
|
|
56
56
|
alive: () => session.current?.alive() ?? false,
|
|
57
|
+
/** Sends the choice to the running app; false when it could not, and the frame must reload. */
|
|
58
|
+
show: (choice) => session.current?.show(choice) ?? false,
|
|
57
59
|
fail: (status) => session.current?.fail(status),
|
|
58
60
|
};
|
|
59
61
|
}
|
|
@@ -41,6 +41,8 @@ export interface StudioProduct {
|
|
|
41
41
|
branch: string;
|
|
42
42
|
/** Where the work runs, when a host names it; on a person's own computer, none: "This computer". */
|
|
43
43
|
machine?: string;
|
|
44
|
+
/** The host's own launcher starts the agent's turns and applies their limits. */
|
|
45
|
+
hostLaunched?: boolean;
|
|
44
46
|
agent: AgentCard;
|
|
45
47
|
}
|
|
46
48
|
export interface AgentMessage {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare function scaleFacts(): {
|
|
2
2
|
contained?: boolean | undefined;
|
|
3
|
+
hostLaunched?: boolean | undefined;
|
|
3
4
|
viewer?: {
|
|
4
5
|
name: string;
|
|
5
6
|
email?: string | undefined;
|
|
@@ -24,6 +25,7 @@ export declare function scaleFacts(): {
|
|
|
24
25
|
effort?: Partial<Record<"coding" | "design" | "fixes" | "planning" | "tests" | "validation", "auto" | "high" | "low" | "max" | "medium" | "xhigh">> | undefined;
|
|
25
26
|
level: "auto" | "guide" | "lead" | "review";
|
|
26
27
|
neverAsk?: boolean | undefined;
|
|
28
|
+
review?: boolean | undefined;
|
|
27
29
|
} | null;
|
|
28
30
|
found: {
|
|
29
31
|
id: "antigravity" | "claude" | "codex" | "cursor" | "grok" | "muse" | "opencode";
|
|
@@ -78,7 +80,7 @@ export declare function scaleFacts(): {
|
|
|
78
80
|
approved?: {
|
|
79
81
|
version: number;
|
|
80
82
|
approval: {
|
|
81
|
-
kind: "brand" | "money" | "places" | "plan" | "prototype" | "release";
|
|
83
|
+
kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
|
|
82
84
|
signatures: {
|
|
83
85
|
by: string;
|
|
84
86
|
at: string;
|
|
@@ -103,7 +105,7 @@ export declare function scaleFacts(): {
|
|
|
103
105
|
pending?: {
|
|
104
106
|
version: number;
|
|
105
107
|
approval: {
|
|
106
|
-
kind: "brand" | "money" | "places" | "plan" | "prototype" | "release";
|
|
108
|
+
kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
|
|
107
109
|
signatures: {
|
|
108
110
|
by: string;
|
|
109
111
|
at: string;
|
|
@@ -128,7 +130,7 @@ export declare function scaleFacts(): {
|
|
|
128
130
|
superseded?: {
|
|
129
131
|
version: number;
|
|
130
132
|
approval: {
|
|
131
|
-
kind: "brand" | "money" | "places" | "plan" | "prototype" | "release";
|
|
133
|
+
kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
|
|
132
134
|
signatures: {
|
|
133
135
|
by: string;
|
|
134
136
|
at: string;
|
|
@@ -224,12 +226,13 @@ export declare function scaleFacts(): {
|
|
|
224
226
|
planned?: string | undefined;
|
|
225
227
|
}[];
|
|
226
228
|
notes: string[];
|
|
229
|
+
surface?: "desktop" | "phone" | undefined;
|
|
227
230
|
problem?: string | undefined;
|
|
228
231
|
} | null | undefined;
|
|
229
232
|
themeDirection?: string | undefined;
|
|
230
233
|
themeVoice?: string | undefined;
|
|
231
234
|
brand: {
|
|
232
|
-
kind: "brand" | "money" | "places" | "plan" | "prototype" | "release";
|
|
235
|
+
kind: "brand" | "comp" | "money" | "places" | "plan" | "prototype" | "release";
|
|
233
236
|
signatures: {
|
|
234
237
|
by: string;
|
|
235
238
|
at: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buffcore/admin-shell",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.44",
|
|
4
4
|
"description": "The React DOM admin console for a BuffCore product, with its prototype viewer.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "BuffApe",
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
"@tanstack/react-router": "1.170.42",
|
|
38
38
|
"firebase": "12.19.0",
|
|
39
39
|
"qrcode": "1.5.4",
|
|
40
|
-
"@buffcore/config": "0.8.
|
|
41
|
-
"@buffcore/
|
|
42
|
-
"@buffcore/
|
|
43
|
-
"@buffcore/
|
|
44
|
-
"@buffcore/
|
|
40
|
+
"@buffcore/config": "0.8.44",
|
|
41
|
+
"@buffcore/sdk": "0.8.44",
|
|
42
|
+
"@buffcore/i18n": "0.8.44",
|
|
43
|
+
"@buffcore/tokens": "0.8.44",
|
|
44
|
+
"@buffcore/contracts": "0.8.44"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"react": ">=19",
|