@hanzo/studio 0.1.8 → 0.1.12
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/lib/app/director.d.ts +134 -0
- package/lib/app/director.js +1196 -0
- package/lib/app/flow-run.d.ts +34 -0
- package/lib/app/flow-run.js +77 -0
- package/lib/app/flow.d.ts +58 -0
- package/lib/app/flow.js +1213 -0
- package/lib/app/sections.d.ts +5 -0
- package/lib/app/sections.js +26 -0
- package/lib/attach.d.ts +2 -0
- package/lib/attach.js +7 -0
- package/lib/chat/turn.js +19 -11
- package/lib/desk.d.ts +1 -1
- package/lib/desk.js +370 -14
- package/lib/download.d.ts +2 -0
- package/lib/download.js +11 -0
- package/lib/gpu.d.ts +13 -1
- package/lib/gpu.js +39 -16
- package/lib/handoff.d.ts +2 -0
- package/lib/handoff.js +2 -0
- package/lib/home.d.ts +3 -1
- package/lib/home.js +98 -9
- package/lib/index.d.ts +7 -0
- package/lib/index.js +6 -0
- package/lib/kinds/app.d.ts +40 -0
- package/lib/kinds/app.js +907 -0
- package/lib/kinds/document.js +256 -19
- package/lib/kinds/image.d.ts +3 -0
- package/lib/kinds/image.js +82 -10
- package/lib/kinds/index.js +2 -1
- package/lib/kinds/sound.js +109 -10
- package/lib/kinds/video.js +146 -17
- package/lib/live.d.ts +11 -0
- package/lib/live.js +10 -0
- package/lib/made.d.ts +2 -1
- package/lib/made.js +1 -0
- package/lib/pdf.js +1 -1
- package/lib/places.d.ts +0 -3
- package/lib/places.js +185 -41
- package/lib/route.d.ts +18 -0
- package/lib/route.js +23 -0
- package/lib/starters.d.ts +21 -0
- package/lib/starters.js +33 -2
- package/lib/studio.js +1 -1
- package/lib/talk.js +149 -46
- package/lib/ui.d.ts +18 -4
- package/lib/ui.js +50 -22
- package/lib/wire.d.ts +19 -6
- package/lib/wire.js +36 -3
- package/package.json +1 -1
package/lib/gpu.js
CHANGED
|
@@ -11,28 +11,51 @@ import { dispatch, landed, Refusal, worklog } from './wire.js';
|
|
|
11
11
|
/** How long a render is followed, ms: a cold model load plus a video. */
|
|
12
12
|
const WAIT = 20 * 60_000;
|
|
13
13
|
const EVERY = 3_000;
|
|
14
|
+
/** A sleep that ends early, and frees its timer, when `signal` aborts. */
|
|
15
|
+
export const nap = (ms, signal) => new Promise((resolve) => {
|
|
16
|
+
const done = () => {
|
|
17
|
+
clearTimeout(timer);
|
|
18
|
+
signal.removeEventListener('abort', done);
|
|
19
|
+
resolve();
|
|
20
|
+
};
|
|
21
|
+
const timer = setTimeout(done, ms);
|
|
22
|
+
signal.addEventListener('abort', done, { once: true });
|
|
23
|
+
});
|
|
24
|
+
const closed = (status) => status === 'done' || status === 'failed' || status === 'cancelled';
|
|
25
|
+
/**
|
|
26
|
+
* Follow a dispatched job's work-log row until the engine closes it, `wait` ms
|
|
27
|
+
* pass or `signal` aborts. `seen` hears each change of status (`queued` while
|
|
28
|
+
* the row is not listed). Answers the last row; throws if the log cannot be read.
|
|
29
|
+
*/
|
|
30
|
+
export async function follow(w, id, o, seen) {
|
|
31
|
+
const until = Date.now() + (o.wait ?? WAIT);
|
|
32
|
+
let row;
|
|
33
|
+
let last = '';
|
|
34
|
+
while (!o.signal.aborted) {
|
|
35
|
+
row = (await worklog(w, o.signal)).find((r) => r.prompt_id === id || r.id === id);
|
|
36
|
+
const status = row?.status ?? 'queued';
|
|
37
|
+
if (status !== last)
|
|
38
|
+
seen((last = status), row);
|
|
39
|
+
if (closed(status) || Date.now() > until)
|
|
40
|
+
break;
|
|
41
|
+
await nap(o.every ?? EVERY, o.signal);
|
|
42
|
+
}
|
|
43
|
+
return row;
|
|
44
|
+
}
|
|
14
45
|
export async function render(w, lane, body, doing, signal) {
|
|
15
46
|
doing('Sending to your GPU');
|
|
16
47
|
const sent = await dispatch(w, lane, body, signal);
|
|
17
48
|
const id = sent.prompt_id ?? sent.id;
|
|
18
49
|
if (!id)
|
|
19
50
|
throw new Refusal(502, 'The engine took the render but named no job.');
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
break;
|
|
29
|
-
if (status === 'failed' || status === 'cancelled')
|
|
30
|
-
throw new Refusal(502, row?.error || `The render ${status}.`);
|
|
31
|
-
if (Date.now() > until)
|
|
32
|
-
throw new Refusal(504, 'Still rendering on your GPU; it will land in the library when it finishes.');
|
|
33
|
-
doing(status === 'running' ? 'Rendering on your GPU' : 'Waiting for a GPU');
|
|
34
|
-
await new Promise((r) => setTimeout(r, EVERY));
|
|
35
|
-
}
|
|
51
|
+
const row = await follow(w, id, { signal }, (status) => doing(status === 'running' ? 'Rendering on your GPU' : 'Waiting for a GPU'));
|
|
52
|
+
if (signal.aborted)
|
|
53
|
+
throw new DOMException('aborted', 'AbortError');
|
|
54
|
+
const status = row?.status ?? 'queued';
|
|
55
|
+
if (status === 'failed' || status === 'cancelled')
|
|
56
|
+
throw new Refusal(502, row?.error || `The render ${status}.`);
|
|
57
|
+
if (status !== 'done')
|
|
58
|
+
throw new Refusal(504, 'Still rendering on your GPU; it will land in the library when it finishes.');
|
|
36
59
|
const paths = row?.outputs?.length ? row.outputs : row?.output ? [row.output] : [];
|
|
37
60
|
if (!paths.length)
|
|
38
61
|
throw new Refusal(502, 'The render finished with no file.');
|
package/lib/handoff.d.ts
ADDED
package/lib/handoff.js
ADDED
package/lib/home.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Available } from './kinds/kind.ts';
|
|
2
|
+
import type { KindId } from './made.ts';
|
|
2
3
|
import { type Starter } from './starters.ts';
|
|
3
|
-
export declare function Home({ available, onStart }: {
|
|
4
|
+
export declare function Home({ available, onStart, onUpload, }: {
|
|
4
5
|
available: Available;
|
|
5
6
|
onStart: (s: Starter) => void;
|
|
7
|
+
onUpload?: (accept?: string, prompt?: string, kind?: KindId) => void;
|
|
6
8
|
}): import("react").JSX.Element;
|
package/lib/home.js
CHANGED
|
@@ -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
|
/**
|
|
3
3
|
* Under the composer while a conversation is empty: the category pills, the
|
|
4
4
|
* starters that can run right now, and the last conversations. A starter
|
|
@@ -6,7 +6,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
* picture puts its words in the composer and asks for the picture.
|
|
7
7
|
*/
|
|
8
8
|
import { SizableText, XStack, YStack } from '@hanzo/gui';
|
|
9
|
-
import { ArrowRight } from '@hanzogui/lucide-icons-2';
|
|
9
|
+
import { ArrowRight, ChevronDown, Clapperboard, FileText, Image as ImageIcon, Music, Sparkles, Upload } from '@hanzogui/lucide-icons-2';
|
|
10
|
+
import { DropdownMenu } from '@hanzo/ui';
|
|
10
11
|
import { useState } from 'react';
|
|
11
12
|
import { useHost } from './host.js';
|
|
12
13
|
import { kind } from './kinds/index.js';
|
|
@@ -15,22 +16,110 @@ import { PRESETS } from './kinds/type/system.js';
|
|
|
15
16
|
import { useChats, useWire } from './live.js';
|
|
16
17
|
import { path } from './route.js';
|
|
17
18
|
import { CATEGORIES, RUNTIME, STARTERS } from './starters.js';
|
|
18
|
-
import { Pill } from './ui.js';
|
|
19
|
+
import { Pill, RING, RING_INSET } from './ui.js';
|
|
19
20
|
import { useUrl } from './use.js';
|
|
20
|
-
|
|
21
|
+
const UPLOAD_ACTIONS = [
|
|
22
|
+
{
|
|
23
|
+
id: 'audio',
|
|
24
|
+
shortLabel: 'Audio',
|
|
25
|
+
label: 'Upload audio track',
|
|
26
|
+
description: 'Build a music player & 60fps visualizer app',
|
|
27
|
+
accept: 'audio/*,.mp3,.wav,.flac,.m4a,.ogg,.aac',
|
|
28
|
+
prompt: 'Build a full-blown interactive music player and 60fps audio visualizer app with EQ, waveform scrubber, and live synth pads around this track.',
|
|
29
|
+
kind: 'app',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: 'image',
|
|
33
|
+
shortLabel: 'Image',
|
|
34
|
+
label: 'Upload image',
|
|
35
|
+
description: 'Create a poster, ad campaign, or visual',
|
|
36
|
+
accept: 'image/*,.png,.jpg,.jpeg,.webp,.svg',
|
|
37
|
+
prompt: 'Create a brand poster, multi-format ad campaign, and presentation slide deck featuring this visual.',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: 'document',
|
|
41
|
+
shortLabel: 'Document',
|
|
42
|
+
label: 'Upload doc or data',
|
|
43
|
+
description: 'Turn into presentation slides & styled PDF',
|
|
44
|
+
accept: '.pdf,.docx,.pptx,.xlsx,.csv,.json,.txt,.md',
|
|
45
|
+
prompt: 'Turn this document into an executive presentation slide deck and styled PDF report.',
|
|
46
|
+
kind: 'slides',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: 'video',
|
|
50
|
+
shortLabel: 'Video',
|
|
51
|
+
label: 'Upload media',
|
|
52
|
+
description: 'Create a motion video clip & social ad cut',
|
|
53
|
+
accept: 'video/*,.mp4,.webm,.mov,image/*',
|
|
54
|
+
prompt: 'Create a motion video clip and social ad cut from this media.',
|
|
55
|
+
kind: 'video',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: 'any',
|
|
59
|
+
shortLabel: 'Any file',
|
|
60
|
+
label: 'Upload any file',
|
|
61
|
+
description: 'Build an interactive creative app around it',
|
|
62
|
+
prompt: 'Build an interactive creative app around this uploaded file.',
|
|
63
|
+
kind: 'app',
|
|
64
|
+
},
|
|
65
|
+
];
|
|
66
|
+
function uploadIcon(id) {
|
|
67
|
+
switch (id) {
|
|
68
|
+
case 'audio':
|
|
69
|
+
return _jsx(Music, { size: 13, color: "$soft" });
|
|
70
|
+
case 'image':
|
|
71
|
+
return _jsx(ImageIcon, { size: 13, color: "$soft" });
|
|
72
|
+
case 'document':
|
|
73
|
+
return _jsx(FileText, { size: 13, color: "$soft" });
|
|
74
|
+
case 'video':
|
|
75
|
+
return _jsx(Clapperboard, { size: 13, color: "$soft" });
|
|
76
|
+
default:
|
|
77
|
+
return _jsx(Sparkles, { size: 13, color: "$soft" });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const PRIMARY_CATEGORIES = ['all', 'image', 'poster', 'video', 'document', 'audio'];
|
|
81
|
+
export function Home({ available, onStart, onUpload, }) {
|
|
21
82
|
const [cat, setCat] = useState('all');
|
|
83
|
+
const [moreExpanded, setMoreExpanded] = useState(false);
|
|
22
84
|
const runs = STARTERS.filter((s) => !kind(s.kind).needs(available));
|
|
23
85
|
const shown = runs.filter((s) => cat === 'all' || s.category === cat);
|
|
24
86
|
const cats = CATEGORIES.filter((c) => c.id === 'all' || runs.some((s) => s.category === c.id));
|
|
25
|
-
|
|
87
|
+
const primaryCats = PRIMARY_CATEGORIES.map((id) => cats.find((c) => c.id === id)).filter((c) => Boolean(c));
|
|
88
|
+
const moreCats = cats.filter((c) => !PRIMARY_CATEGORIES.includes(c.id));
|
|
89
|
+
const activeMore = moreCats.find((c) => c.id === cat) ?? null;
|
|
90
|
+
const uploadItems = onUpload
|
|
91
|
+
? UPLOAD_ACTIONS.map((a) => ({
|
|
92
|
+
key: a.id,
|
|
93
|
+
label: a.label,
|
|
94
|
+
description: a.description,
|
|
95
|
+
icon: uploadIcon(a.id),
|
|
96
|
+
onSelect: () => onUpload(a.accept, a.prompt, a.kind),
|
|
97
|
+
}))
|
|
98
|
+
: [];
|
|
99
|
+
return (_jsxs(YStack, { "data-slot": "studio-home", width: "100%", maxW: 1040, minW: 0, mx: "auto", gap: "$4", pt: "$1", pb: "$2", px: "$1", $md: { px: '$2' }, children: [_jsx(XStack, { role: "toolbar", "aria-label": "Categories", width: "100%", minW: 0, overflowX: moreExpanded ? 'visible' : 'auto', flexWrap: moreExpanded ? 'wrap' : 'nowrap', py: "$1", style: { scrollbarWidth: 'none' }, children: _jsxs(XStack, { flexWrap: moreExpanded ? 'wrap' : 'nowrap', justify: "center", items: "center", gap: "$3", mx: "auto", px: "$1", shrink: moreExpanded ? 1 : 0, children: [onUpload ? (_jsxs(_Fragment, { children: [_jsx(DropdownMenu, { minWidth: 268, trigger: _jsxs(XStack, { render: _jsx("button", { type: "button" }), "aria-label": "Upload a file to create from", items: "center", gap: "$1.5", px: "$3", minH: 44, "$max-sm": { minH: 44 }, $md: { minH: 32, height: 32 }, rounded: 999, borderWidth: 1, borderColor: "var(--border-strong)", bg: "var(--surface-card-emphasis)", cursor: "pointer", hoverStyle: { bg: '$hover', borderColor: 'var(--border-strong)' }, focusVisibleStyle: RING, shrink: 0, children: [_jsx(Upload, { size: 13, color: "$ink" }), _jsx(SizableText, { size: "$2", fontWeight: "500", color: "$ink", whiteSpace: "nowrap", children: "Upload" }), _jsx(ChevronDown, { size: 12, color: "$soft" })] }), items: uploadItems }), _jsx(XStack, { width: 1, height: 16, bg: "var(--border)", shrink: 0 })] })) : null, primaryCats.map((c) => {
|
|
100
|
+
const count = c.id === 'all' ? runs.length : runs.filter((s) => s.category === c.id).length;
|
|
101
|
+
return (_jsx(Pill, { label: c.label, on: cat === c.id, count: cat === c.id ? count : undefined, onPress: () => setCat(c.id), children: c.label }, c.id));
|
|
102
|
+
}), moreExpanded
|
|
103
|
+
? moreCats.map((c) => {
|
|
104
|
+
const count = runs.filter((s) => s.category === c.id).length;
|
|
105
|
+
return (_jsx(Pill, { label: c.label, on: cat === c.id, count: cat === c.id ? count : undefined, onPress: () => setCat(c.id), children: c.label }, c.id));
|
|
106
|
+
})
|
|
107
|
+
: activeMore
|
|
108
|
+
? (_jsx(Pill, { label: activeMore.label, on: true, count: runs.filter((s) => s.category === activeMore.id).length, onPress: () => setCat(activeMore.id), children: activeMore.label }, activeMore.id))
|
|
109
|
+
: null, moreCats.length ? (_jsxs(XStack, { render: _jsx("button", { type: "button" }), "aria-label": moreExpanded ? 'Show fewer categories' : 'Show more categories', "aria-expanded": moreExpanded, onClick: () => setMoreExpanded((v) => !v), items: "center", justify: "center", gap: "$1", px: "$3", minH: 44, "$max-sm": { minH: 44 }, $md: { minH: 32, height: 32 }, rounded: 999, borderWidth: 1, borderColor: moreExpanded ? 'var(--border-strong)' : 'var(--border)', bg: moreExpanded ? '$hover' : 'transparent', cursor: "pointer", hoverStyle: { bg: '$hover', borderColor: 'var(--border-strong)' }, focusVisibleStyle: RING, shrink: 0, children: [_jsx(SizableText, { size: "$2", fontWeight: "500", color: "$ink", whiteSpace: "nowrap", children: moreExpanded ? 'Less' : 'More' }), _jsx("span", { "aria-hidden": true, style: {
|
|
110
|
+
display: 'inline-flex',
|
|
111
|
+
alignItems: 'center',
|
|
112
|
+
transform: moreExpanded ? 'rotate(180deg)' : 'none',
|
|
113
|
+
transition: 'transform 150ms ease',
|
|
114
|
+
}, children: _jsx(ChevronDown, { size: 12, color: "$soft" }) })] })) : null] }) }), _jsx(XStack, { role: "list", "aria-label": "Starters", flexWrap: "nowrap", overflowX: "auto", gap: "$4", width: "100%", minW: 0, pb: "$1", style: { scrollbarWidth: 'none', scrollSnapType: 'x proximity' }, children: shown.map((s, i) => (_jsx(Card, { s: s, i: i, onPress: () => onStart(s) }, s.id))) }), _jsx(Recent, {})] }));
|
|
26
115
|
}
|
|
27
|
-
/** A starter's card: 4:
|
|
116
|
+
/** A starter's card: 4:3, its picture, or its title set in type; its words under it. */
|
|
28
117
|
function Card({ s, i, onPress }) {
|
|
29
118
|
const k = kind(s.kind);
|
|
30
119
|
const Icon = k.icon;
|
|
31
120
|
const look = PRESETS[i % PRESETS.length];
|
|
32
121
|
use(look.display);
|
|
33
|
-
return (_jsxs(YStack, { role: "listitem", width: "calc(50% -
|
|
122
|
+
return (_jsxs(YStack, { role: "listitem", shrink: 0, width: "calc(50% - 8px)", minW: 156, $md: { width: 'calc(33.333% - 11px)', minW: 0 }, $lg: { width: 'calc(25% - 12px)', minW: 0 }, gap: "$2", style: { scrollSnapAlign: 'start' }, children: [_jsxs(YStack, { position: "relative", width: "100%", rounded: 14, overflow: "hidden", borderWidth: 1, borderColor: "var(--border)", bg: "var(--surface-card)", style: { aspectRatio: '4 / 3' }, children: [s.thumb ? (_jsx("img", { src: s.thumb, alt: "", style: { position: 'absolute', inset: 0, width: '100%', height: '100%', objectFit: 'cover' } })) : (_jsxs("div", { "aria-hidden": true, style: { position: 'absolute', inset: 0, background: look.colors.paper, color: look.colors.ink, padding: '12% 10%', display: 'flex', flexDirection: 'column', justifyContent: 'flex-end', textAlign: 'left' }, children: [_jsx("div", { style: { width: '28%', height: 3, background: look.colors.accent, marginBottom: 8 } }), _jsx("div", { style: { fontFamily: stack(look.display), fontWeight: look.weights.display, fontSize: 'clamp(16px, 2vw, 24px)', lineHeight: look.leading.display, letterSpacing: `${look.tracking.display}em` }, children: s.title })] })), _jsxs(XStack, { "aria-hidden": true, position: "absolute", t: 8, l: 8, r: 8, justify: "space-between", items: "center", children: [_jsx(XStack, { width: 26, height: 26, rounded: 99, bg: "var(--surface-header)", borderWidth: 1, borderColor: "var(--border-strong)", boxShadow: "0 1px 4px rgba(0, 0, 0, 0.24)", items: "center", justify: "center", style: { border: '1px solid var(--border-strong)', color: 'var(--foreground)' }, "$platform-web": { color: 'var(--foreground)' }, children: _jsx(Icon, { size: 13 }) }), _jsx(XStack, { px: "$2", height: 22, rounded: 99, bg: "var(--surface-header)", borderWidth: 1, borderColor: "var(--border-strong)", boxShadow: "0 1px 4px rgba(0, 0, 0, 0.24)", style: { border: '1px solid var(--border-strong)' }, items: "center", children: _jsx(SizableText, { size: "$1", fontFamily: "$mono", fontWeight: "600", color: "$ink", children: RUNTIME[s.kind] }) })] }), _jsx(YStack, { render: _jsx("button", { type: "button" }), "aria-label": `${s.title}: ${s.subtitle}`, onClick: onPress, position: "absolute", t: 0, l: 0, r: 0, b: 0, rounded: 14, cursor: "pointer", hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING_INSET })] }), _jsxs(YStack, { gap: 3, px: "$0.5", minW: 0, children: [_jsx(SizableText, { size: "$2", fontWeight: "600", color: "$ink", lineHeight: 19, numberOfLines: 1, children: s.title }), _jsx(SizableText, { size: "$1", color: "$soft", lineHeight: 16, numberOfLines: 1, children: s.subtitle })] })] }));
|
|
34
123
|
}
|
|
35
124
|
const STATE = { making: 'Making', done: 'Done', failed: 'Failed' };
|
|
36
125
|
/** The last eight conversations, each with what it is doing now. */
|
|
@@ -40,9 +129,9 @@ function Recent() {
|
|
|
40
129
|
const { rows } = useChats(wire);
|
|
41
130
|
if (!rows.length)
|
|
42
131
|
return null;
|
|
43
|
-
return (_jsxs(YStack, { gap: "$2", pt: "$2", children: [_jsxs(XStack, { items: "center", justify: "space-between", children: [_jsx(SizableText, { size: "$3", fontWeight: "600", children: "Recent" }), _jsxs(XStack, { render: "button", "aria-label": "Open the library",
|
|
132
|
+
return (_jsxs(YStack, { gap: "$2", pt: "$2", minW: 0, children: [_jsxs(XStack, { items: "center", justify: "space-between", children: [_jsx(SizableText, { size: "$3", fontWeight: "600", color: "$ink", children: "Recent" }), _jsxs(XStack, { render: _jsx("button", { type: "button" }), "aria-label": "Open the library", onClick: () => host.go(path({ kind: 'library' })), items: "center", gap: "$1", cursor: "pointer", px: "$2.5", minH: 44, "$max-sm": { minH: 44 }, $md: { minH: 28, height: 28 }, rounded: "$3", borderWidth: 1, borderColor: "transparent", hoverStyle: { bg: '$hover', borderColor: 'var(--border-strong)' }, focusVisibleStyle: RING, children: [_jsx(SizableText, { size: "$2", color: "$soft", children: "Library" }), _jsx(ArrowRight, { size: 13, color: "$soft" })] })] }), _jsx(XStack, { role: "list", "aria-label": "Recent conversations", gap: "$3", overflowX: "auto", pb: "$1", width: "100%", style: { scrollbarWidth: 'none' }, children: rows.slice(0, 8).map((r) => (_jsx(YStack, { role: "listitem", width: 152, shrink: 0, children: _jsxs(YStack, { render: _jsx("button", { type: "button" }), "aria-label": `${r.title}, ${STATE[r.state]}`, onClick: () => host.go(path({ kind: 'chat', id: r.id })), width: "100%", gap: "$1.5", items: "flex-start", cursor: "pointer", rounded: "$3", focusVisibleStyle: RING, children: [_jsx(Cover, { wire: wire, cover: r.cover }), _jsx(SizableText, { size: "$2", fontWeight: "600", color: "$ink", text: "left", numberOfLines: 1, children: r.title }), _jsxs(XStack, { items: "center", gap: "$1.5", children: [_jsx(XStack, { width: 6, height: 6, rounded: 6, bg: r.state === 'failed' ? 'var(--state-error)' : r.state === 'done' ? 'var(--state-success)' : '$ink' }), _jsx(SizableText, { size: "$1", color: "$soft", children: `${STATE[r.state]} · ${r.count} made` })] })] }) }, r.id))) })] }));
|
|
44
133
|
}
|
|
45
134
|
function Cover({ wire, cover }) {
|
|
46
135
|
const { src } = useUrl(wire, cover);
|
|
47
|
-
return src ? (_jsx("img", { src: src, alt: "", width:
|
|
136
|
+
return src ? (_jsx("img", { src: src, alt: "", width: 152, height: 114, style: { borderRadius: 12, objectFit: 'cover', width: 152, height: 114 } })) : (_jsx(YStack, { width: 152, height: 114, rounded: 12, bg: "var(--surface-card)", borderWidth: 1, borderColor: "var(--border)" }));
|
|
48
137
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -5,8 +5,15 @@
|
|
|
5
5
|
* go)` for a host that draws Studio's places in a rail of its own (the Hanzo
|
|
6
6
|
* app at hanzo.ai/studio). `host` is @hanzo/build's `Host`, the value Dev
|
|
7
7
|
* takes, and `host.path` is Studio's address under its mount (`route`).
|
|
8
|
+
* `useRecent(host)` for a host that lists the conversations beside it.
|
|
8
9
|
*/
|
|
9
10
|
export { Studio } from './studio.tsx';
|
|
11
|
+
export { DirectorStudio, directorNav, parseStudioSection, type StudioSection } from './app/director.tsx';
|
|
12
|
+
export { FlowStudio, flowNav, parseFlowSection, type FlowSection } from './app/flow.tsx';
|
|
10
13
|
export { nav, NEW, type Group } from './nav.tsx';
|
|
11
14
|
export { path, route, type Route } from './route.ts';
|
|
15
|
+
export { starters, type Offer } from './starters.ts';
|
|
16
|
+
export { useRecent } from './live.ts';
|
|
17
|
+
export { HANDOFF_CHAT } from './handoff.ts';
|
|
18
|
+
export type { Listed } from './chat/store.ts';
|
|
12
19
|
export type { Host } from '@hanzo/build';
|
package/lib/index.js
CHANGED
|
@@ -5,7 +5,13 @@
|
|
|
5
5
|
* go)` for a host that draws Studio's places in a rail of its own (the Hanzo
|
|
6
6
|
* app at hanzo.ai/studio). `host` is @hanzo/build's `Host`, the value Dev
|
|
7
7
|
* takes, and `host.path` is Studio's address under its mount (`route`).
|
|
8
|
+
* `useRecent(host)` for a host that lists the conversations beside it.
|
|
8
9
|
*/
|
|
9
10
|
export { Studio } from './studio.js';
|
|
11
|
+
export { DirectorStudio, directorNav, parseStudioSection } from './app/director.js';
|
|
12
|
+
export { FlowStudio, flowNav, parseFlowSection } from './app/flow.js';
|
|
10
13
|
export { nav, NEW } from './nav.js';
|
|
11
14
|
export { path, route } from './route.js';
|
|
15
|
+
export { starters } from './starters.js';
|
|
16
|
+
export { useRecent } from './live.js';
|
|
17
|
+
export { HANDOFF_CHAT } from './handoff.js';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type Kind } from './kind.ts';
|
|
2
|
+
import { type TypeSystem } from './type/system.ts';
|
|
3
|
+
export type AppPreset = 'music-app' | 'visualizer' | 'interactive-visual' | 'synth-studio';
|
|
4
|
+
export interface AppSpec {
|
|
5
|
+
preset: AppPreset;
|
|
6
|
+
title: string;
|
|
7
|
+
subtitle: string;
|
|
8
|
+
artist: string;
|
|
9
|
+
prompt: string;
|
|
10
|
+
accent: string;
|
|
11
|
+
secondary: string;
|
|
12
|
+
/** Stored key of the audio file (uploaded MP3/WAV/FLAC or generated track), or ''. */
|
|
13
|
+
audio: string;
|
|
14
|
+
audioName: string;
|
|
15
|
+
/** Stored key of the cover/background image file, or ''. */
|
|
16
|
+
image: string;
|
|
17
|
+
/** Custom tracks / sections or interactive controls JSON. */
|
|
18
|
+
tracks: {
|
|
19
|
+
title: string;
|
|
20
|
+
duration: string;
|
|
21
|
+
bpm: number;
|
|
22
|
+
key: string;
|
|
23
|
+
}[];
|
|
24
|
+
/** Optional custom HTML generated by the writer model. */
|
|
25
|
+
customHtml?: string;
|
|
26
|
+
system: TypeSystem;
|
|
27
|
+
[k: string]: unknown;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Build the self-contained HTML5 application with embedded audio/image data URLs.
|
|
31
|
+
* Supports:
|
|
32
|
+
* - Real uploaded audio playback via HTML5 `<audio>` + WebAudio `AudioContext` + `AnalyserNode`
|
|
33
|
+
* - Built-in procedural WebAudio polyphonic synth + drum engine when no external audio file is playing
|
|
34
|
+
* - 3-Band EQ (Low / Mid / High BiquadFilterNodes)
|
|
35
|
+
* - Playback speed / pitch control (0.5x – 1.5x)
|
|
36
|
+
* - Real-time 60fps Canvas visualizer (4 modes: Spectrum Bars, Radial Orb, Oscilloscope Wave, Particle Nebula)
|
|
37
|
+
* - Interactive waveform scrubber + playlist + downloadable audio/HTML
|
|
38
|
+
*/
|
|
39
|
+
export declare function buildAppHtml(s: AppSpec, audioUrl: string, imageUrl: string): string;
|
|
40
|
+
export declare const app: Kind;
|