@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.
Files changed (49) hide show
  1. package/lib/app/director.d.ts +134 -0
  2. package/lib/app/director.js +1196 -0
  3. package/lib/app/flow-run.d.ts +34 -0
  4. package/lib/app/flow-run.js +77 -0
  5. package/lib/app/flow.d.ts +58 -0
  6. package/lib/app/flow.js +1213 -0
  7. package/lib/app/sections.d.ts +5 -0
  8. package/lib/app/sections.js +26 -0
  9. package/lib/attach.d.ts +2 -0
  10. package/lib/attach.js +7 -0
  11. package/lib/chat/turn.js +19 -11
  12. package/lib/desk.d.ts +1 -1
  13. package/lib/desk.js +370 -14
  14. package/lib/download.d.ts +2 -0
  15. package/lib/download.js +11 -0
  16. package/lib/gpu.d.ts +13 -1
  17. package/lib/gpu.js +39 -16
  18. package/lib/handoff.d.ts +2 -0
  19. package/lib/handoff.js +2 -0
  20. package/lib/home.d.ts +3 -1
  21. package/lib/home.js +98 -9
  22. package/lib/index.d.ts +7 -0
  23. package/lib/index.js +6 -0
  24. package/lib/kinds/app.d.ts +40 -0
  25. package/lib/kinds/app.js +907 -0
  26. package/lib/kinds/document.js +256 -19
  27. package/lib/kinds/image.d.ts +3 -0
  28. package/lib/kinds/image.js +82 -10
  29. package/lib/kinds/index.js +2 -1
  30. package/lib/kinds/sound.js +109 -10
  31. package/lib/kinds/video.js +146 -17
  32. package/lib/live.d.ts +11 -0
  33. package/lib/live.js +10 -0
  34. package/lib/made.d.ts +2 -1
  35. package/lib/made.js +1 -0
  36. package/lib/pdf.js +1 -1
  37. package/lib/places.d.ts +0 -3
  38. package/lib/places.js +185 -41
  39. package/lib/route.d.ts +18 -0
  40. package/lib/route.js +23 -0
  41. package/lib/starters.d.ts +21 -0
  42. package/lib/starters.js +33 -2
  43. package/lib/studio.js +1 -1
  44. package/lib/talk.js +149 -46
  45. package/lib/ui.d.ts +18 -4
  46. package/lib/ui.js +50 -22
  47. package/lib/wire.d.ts +19 -6
  48. package/lib/wire.js +36 -3
  49. package/package.json +1 -1
@@ -0,0 +1,5 @@
1
+ /** Which section of the Director and of Flow an address opens. */
2
+ export type StudioSection = 'create' | 'library' | 'documents' | 'video' | 'music' | 'model3d' | 'queue';
3
+ export declare function parseStudioSection(path?: string): StudioSection;
4
+ export type FlowSection = 'canvas' | 'hybrid' | 'comfy' | 'agents' | 'code' | 'publish';
5
+ export declare function parseFlowSection(path?: string): FlowSection;
@@ -0,0 +1,26 @@
1
+ /** Which section of the Director and of Flow an address opens. */
2
+ export function parseStudioSection(path) {
3
+ const clean = (path ?? '').replace(/^\/+|\/+$/g, '').split('/')[0] ?? '';
4
+ if (clean === 'create' || clean === 'refine' || clean === 'home')
5
+ return 'create';
6
+ if (clean === 'documents' || clean === 'docs' || clean === 'frames' || clean === 'office')
7
+ return 'documents';
8
+ if (clean === 'video' || clean === 'cinema')
9
+ return 'video';
10
+ if (clean === 'music' || clean === 'audio' || clean === 'voice')
11
+ return 'music';
12
+ if (clean === 'model3d' || clean === '3d' || clean === 'mesh')
13
+ return 'model3d';
14
+ if (clean === 'library' || clean === 'stacks' || clean === 'assets')
15
+ return 'library';
16
+ if (clean === 'queue' || clean === 'activity' || clean === 'gpus')
17
+ return 'queue';
18
+ return 'create';
19
+ }
20
+ export function parseFlowSection(path) {
21
+ const clean = (path ?? '').replace(/^\/+|\/+$/g, '').split('/')[0] ?? '';
22
+ if (clean === 'hybrid' || clean === 'comfy' || clean === 'agents' || clean === 'code' || clean === 'publish') {
23
+ return clean;
24
+ }
25
+ return 'canvas';
26
+ }
@@ -0,0 +1,2 @@
1
+ /** The sentence for files that did not attach: which, and the last reason given. '' when all did. */
2
+ export declare function uploadFailure(names: string[], reason: string): string;
package/lib/attach.js ADDED
@@ -0,0 +1,7 @@
1
+ /** The sentence for files that did not attach: which, and the last reason given. '' when all did. */
2
+ export function uploadFailure(names, reason) {
3
+ if (!names.length)
4
+ return '';
5
+ const label = names.length === 1 ? `“${names[0]}”` : `${names.length} files`;
6
+ return `Could not attach ${label}${reason ? `: ${reason}` : '.'}`;
7
+ }
package/lib/chat/turn.js CHANGED
@@ -65,8 +65,9 @@ function system(chat, ctx, open, closed) {
65
65
  .filter(Boolean);
66
66
  const brand = brandOf(chat);
67
67
  return [
68
- 'You are Hanzo Studio: a creative studio in a chat. You make things by calling tools, and everything you make opens in a numbered tab beside this conversation.',
68
+ 'You are Hanzo Design: an AI creative and visual design workspace in a chat. You make visuals, images, posters, presentations (slides), documents, ads, short videos, music, voice, type systems, 3D meshes, and full interactive web apps (including full-blown music player & visualizer apps from uploaded audio files) by calling tools, and everything you make opens in a numbered tab beside this conversation.',
69
69
  'When the person asks for something, call the tool that makes it at once, with complete, specific, well-written arguments: real words, not placeholders. Ask a question only when you cannot make anything sensible without the answer.',
70
+ 'When the person attaches an audio/music file or asks to build a music app, visualizer, or interactive experience, call make_app (passing audio_tab with the tab number of the attached audio and image_tab if an image was attached).',
70
71
  'To change something already made, call revise with its tab number. "The poster in tab 2" is tab 2.',
71
72
  'After the tools have run, answer in one or two short sentences: what you made, and one useful next step. Never paste file contents, links or JSON. If a tool answers with an error, say plainly what went wrong.',
72
73
  brand ? `Brand: ${brand.name} (${brand.display} / ${brand.text}; ${brand.blurb}). Posters, documents, slides and ads are drawn in it.` : 'No brand is chosen: things are drawn in the Hanzo type system unless the person asks for a type system.',
@@ -84,7 +85,7 @@ function history(chat, ctx) {
84
85
  .filter((t) => t.text || t.made?.length)
85
86
  .map((t) => {
86
87
  if (t.role === 'user') {
87
- const pics = t.attached?.length ? `\n[Attached ${t.attached.length} picture${t.attached.length > 1 ? 's' : ''}, now in tab ${t.made?.map((m) => order.indexOf(m) + 1).join(', ')}]` : '';
88
+ const pics = t.attached?.length ? `\n[Attached ${t.attached.map((a) => `${a.name} (${a.mime})`).join(', ')}, now in tab ${t.made?.map((m) => order.indexOf(m) + 1).join(', ')}]` : '';
88
89
  return { role: 'user', content: t.text + pics };
89
90
  }
90
91
  const made = (t.made ?? [])
@@ -105,14 +106,18 @@ export async function turn(start, asked, ctx) {
105
106
  };
106
107
  const me = { id: id(), role: 'user', text: asked.text, at: Date.now(), attached: asked.attached.length ? asked.attached : undefined };
107
108
  const you = { id: id(), role: 'assistant', text: '', at: Date.now(), doing: 'Thinking', made: [] };
108
- // An attached picture is a thing in the conversation: its own tab, so it can be named.
109
- const uploads = asked.attached.map((f) => ({
110
- id: id(),
111
- kind: 'image',
112
- title: f.name.replace(/\.[a-z0-9]+$/i, '') || 'Picture',
113
- at: 0,
114
- versions: [{ id: id(), at: Date.now(), spec: { prompt: '', uploaded: true }, files: [f], note: 'Attached', by: 'you' }],
115
- }));
109
+ // An attached file is a thing in the conversation: its own tab, so it can be named and wired into tools.
110
+ const uploadKind = (mime) => mime.startsWith('audio/') ? 'music' : mime.startsWith('video/') ? 'video' : mime.startsWith('image/') ? 'image' : 'document';
111
+ const uploads = asked.attached.map((f) => {
112
+ const k = uploadKind(f.mime);
113
+ return {
114
+ id: id(),
115
+ kind: k,
116
+ title: f.name.replace(/\.[a-z0-9]+$/i, '') || (k === 'music' ? 'Track' : k === 'video' ? 'Clip' : k === 'image' ? 'Picture' : 'File'),
117
+ at: 0,
118
+ versions: [{ id: id(), at: Date.now(), spec: { prompt: '', uploaded: true }, files: [f], note: 'Attached', by: 'you' }],
119
+ };
120
+ });
116
121
  me.made = uploads.map((u) => u.id);
117
122
  put_({
118
123
  ...chat,
@@ -131,7 +136,10 @@ export async function turn(start, asked, ctx) {
131
136
  const open = ALL.filter((k) => !k.needs(ctx));
132
137
  const closed = ALL.filter((k) => k.needs(ctx));
133
138
  const tools = [...open.map((k) => ({ type: 'function', function: k.tool })), REVISE, BRAND];
134
- const messages = [{ role: 'system', content: system(chat, ctx, open, closed) }, ...history(start, ctx), { role: 'user', content: me.text + (uploads.length ? `\n[Attached: tab ${uploads.map((u) => ctx.order().indexOf(u.id) + 1).join(', ')}]` : '') }];
139
+ const attachedSummary = uploads.length
140
+ ? `\n[Attached: ${uploads.map((u, idx) => `tab ${ctx.order().indexOf(u.id) + 1} (${u.kind} "${asked.attached[idx]?.name ?? u.title}")`).join(', ')}]`
141
+ : '';
142
+ const messages = [{ role: 'system', content: system(chat, ctx, open, closed) }, ...history(start, ctx), { role: 'user', content: me.text + attachedSummary }];
135
143
  const picked = asked.kind ? kind(asked.kind) : null;
136
144
  if (picked && picked.needs(ctx)) {
137
145
  set({ doing: undefined, text: `${picked.label} can't run right now. ${picked.needs(ctx)}` });
package/lib/desk.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type Made } from './made.ts';
2
- import type { Wire } from './wire.ts';
2
+ import { type Wire } from './wire.ts';
3
3
  export interface DeskProps {
4
4
  made: Made;
5
5
  wire: Wire;
package/lib/desk.js CHANGED
@@ -7,14 +7,84 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
7
  * Compare draws two versions: a wipe for pictures (drag the line), side by
8
8
  * side for everything else.
9
9
  */
10
+ import { RING } from './ui.js';
10
11
  import { SizableText, XStack, YStack } from '@hanzo/gui';
11
- import { ChevronDown, Columns2, Download } from '@hanzogui/lucide-icons-2';
12
- import { DropdownMenu } from '@hanzo/ui';
13
- import { useState } from 'react';
12
+ import { Bookmark, Check, ChevronDown, Columns2, Download, Link2, MessageSquare, MoveHorizontal } from '@hanzogui/lucide-icons-2';
13
+ import { DropdownMenu, Popover, PopoverContent, PopoverTrigger } from '@hanzo/ui';
14
+ import { useCallback, useEffect, useRef, useState } from 'react';
14
15
  import { kind } from './kinds/index.js';
15
- import { current } from './made.js';
16
- import { download } from './ui.js';
16
+ import { current, filename } from './made.js';
17
+ import { download } from './download.js';
18
+ import { pdf } from './pdf.js';
19
+ import { HANDOFF_CHAT } from './handoff.js';
20
+ import { useHost } from './host.js';
17
21
  import { useUrl } from './use.js';
22
+ import { read, saveToLibrary, url } from './wire.js';
23
+ /** Render an image blob onto an offscreen canvas at `scale` (1x or 2x). */
24
+ async function rasterizeBlob(blob, scale) {
25
+ if (typeof document === 'undefined')
26
+ return null;
27
+ const objectUrl = URL.createObjectURL(blob);
28
+ try {
29
+ const img = await new Promise((resolve, reject) => {
30
+ const el = new Image();
31
+ el.onload = () => resolve(el);
32
+ el.onerror = () => reject(new Error('Could not decode image'));
33
+ el.src = objectUrl;
34
+ });
35
+ const w = Math.max(1, Math.round((img.naturalWidth || img.width || 1024) * scale));
36
+ const h = Math.max(1, Math.round((img.naturalHeight || img.height || 1024) * scale));
37
+ const canvas = document.createElement('canvas');
38
+ canvas.width = w;
39
+ canvas.height = h;
40
+ const ctx = canvas.getContext('2d');
41
+ if (!ctx)
42
+ return null;
43
+ ctx.imageSmoothingEnabled = true;
44
+ ctx.imageSmoothingQuality = 'high';
45
+ ctx.drawImage(img, 0, 0, w, h);
46
+ return canvas;
47
+ }
48
+ finally {
49
+ URL.revokeObjectURL(objectUrl);
50
+ }
51
+ }
52
+ async function canvasToBlob(canvas, mime, quality = 0.92) {
53
+ return new Promise((resolve, reject) => {
54
+ canvas.toBlob((b) => (b ? resolve(b) : reject(new Error(`Could not encode ${mime}`))), mime, quality);
55
+ });
56
+ }
57
+ /** A one-page PDF of a canvas, the page the picture's own size in points (src/pdf.ts). */
58
+ async function canvasToPdfBlob(canvas, title) {
59
+ const jpeg = new Uint8Array(await (await canvasToBlob(canvas, 'image/jpeg', 0.92)).arrayBuffer());
60
+ return pdf([{ jpeg, width: canvas.width, height: canvas.height, pageWidth: canvas.width * 0.75, pageHeight: canvas.height * 0.75 }], title);
61
+ }
62
+ async function copyText(text) {
63
+ try {
64
+ if (navigator.clipboard?.writeText) {
65
+ await navigator.clipboard.writeText(text);
66
+ return true;
67
+ }
68
+ }
69
+ catch {
70
+ // Fall through to temporary textarea
71
+ }
72
+ try {
73
+ const ta = document.createElement('textarea');
74
+ ta.value = text;
75
+ ta.setAttribute('readonly', 'true');
76
+ ta.style.position = 'fixed';
77
+ ta.style.opacity = '0';
78
+ document.body.appendChild(ta);
79
+ ta.select();
80
+ const ok = document.execCommand('copy');
81
+ ta.remove();
82
+ return ok;
83
+ }
84
+ catch {
85
+ return false;
86
+ }
87
+ }
18
88
  const ago = (t) => {
19
89
  const s = Math.max(0, Math.round((Date.now() - t) / 1000));
20
90
  if (s < 60)
@@ -26,19 +96,204 @@ const ago = (t) => {
26
96
  return new Date(t).toLocaleDateString();
27
97
  };
28
98
  export function Desk({ made, wire, others, onPick, onEdit, busy, failed }) {
99
+ const host = useHost();
29
100
  const k = kind(made.kind);
30
101
  const v = current(made);
31
102
  const [against, setAgainst] = useState(null);
32
103
  const [error, setError] = useState('');
33
- const exporting = async (i) => {
104
+ const [exportOpen, setExportOpen] = useState(false);
105
+ const [exportFormat, setExportFormat] = useState(() => {
106
+ const hasImg = v.files.some((f) => f.mime.startsWith('image/'));
107
+ if (hasImg || made.kind === 'image' || made.kind === 'poster' || made.kind === 'ad')
108
+ return 'png';
109
+ if (made.kind === 'document' || made.kind === 'slides')
110
+ return 'pdf';
111
+ return 'original';
112
+ });
113
+ const [exportScale, setExportScale] = useState(2);
114
+ const [exportBusy, setExportBusy] = useState(false);
115
+ const [exportedOnce, setExportedOnce] = useState(false);
116
+ const [copiedLink, setCopiedLink] = useState(false);
117
+ const [savedLibrary, setSavedLibrary] = useState(false);
118
+ const [savingLibrary, setSavingLibrary] = useState(false);
119
+ const timersRef = useRef([]);
120
+ const handleOpenInChat = () => {
121
+ const noteText = v.note?.trim() ? `\n\nLatest design notes: ${v.note.trim()}` : '';
122
+ const prompt = `Continue refining my ${k.label.toLowerCase()} “${made.title}” (v${made.at + 1}).${noteText}`;
123
+ try {
124
+ window.sessionStorage.setItem(HANDOFF_CHAT, JSON.stringify({ prompt, title: made.title, kind: made.kind, ts: Date.now() }));
125
+ }
126
+ catch {
127
+ // Storage is blocked: Chat opens without the prompt.
128
+ }
129
+ host.open('/chat');
130
+ };
131
+ const handleSaveToLibrary = async () => {
132
+ if (savingLibrary)
133
+ return;
134
+ setError('');
135
+ setSavedLibrary(false);
136
+ setSavingLibrary(true);
137
+ try {
138
+ let blob;
139
+ let name;
140
+ let key;
141
+ const primaryFile = v.files[0];
142
+ if (primaryFile) {
143
+ blob = await read(wire, primaryFile.key);
144
+ name = primaryFile.name || filename(made.title, 'bin');
145
+ key = primaryFile.key;
146
+ }
147
+ else if (k.exports[0]) {
148
+ const out = await k.exports[0].run(wire, made, v);
149
+ blob = out.blob;
150
+ name = out.name;
151
+ key = `files/${made.kind}/${made.id}/${v.id}/${name}`;
152
+ }
153
+ else {
154
+ name = filename(made.title, 'json');
155
+ blob = new Blob([JSON.stringify({ id: made.id, title: made.title, kind: made.kind, version: v.id, spec: v.spec, note: v.note }, null, 2)], { type: 'application/json' });
156
+ key = `files/${made.kind}/${made.id}/${v.id}/${name}`;
157
+ }
158
+ await saveToLibrary(wire, key, blob);
159
+ setSavedLibrary(true);
160
+ timersRef.current.push(window.setTimeout(() => setSavedLibrary(false), 2500));
161
+ }
162
+ catch (e) {
163
+ setSavedLibrary(false);
164
+ setError(e instanceof Error ? e.message : 'Could not save to Library.');
165
+ }
166
+ finally {
167
+ setSavingLibrary(false);
168
+ }
169
+ };
170
+ useEffect(() => {
171
+ return () => {
172
+ timersRef.current.forEach((id) => window.clearTimeout(id));
173
+ };
174
+ }, []);
175
+ const exportingNative = async (i) => {
34
176
  setError('');
177
+ setExportBusy(true);
35
178
  try {
36
179
  const out = await k.exports[i].run(wire, made, v);
37
180
  download(out.name, out.blob);
181
+ setExportedOnce(true);
182
+ timersRef.current.push(window.setTimeout(() => setExportedOnce(false), 1800));
38
183
  }
39
184
  catch (e) {
40
185
  setError(e instanceof Error ? e.message : String(e));
41
186
  }
187
+ finally {
188
+ setExportBusy(false);
189
+ }
190
+ };
191
+ const runUnifiedExport = async () => {
192
+ setError('');
193
+ setExportBusy(true);
194
+ try {
195
+ if (exportFormat === 'original') {
196
+ const primary = k.exports[0];
197
+ if (primary) {
198
+ const out = await primary.run(wire, made, v);
199
+ download(out.name, out.blob);
200
+ }
201
+ else if (v.files[0]) {
202
+ const blob = await read(wire, v.files[0].key);
203
+ download(v.files[0].name, blob);
204
+ }
205
+ }
206
+ else if (exportFormat === 'pdf') {
207
+ const nativePdf = k.exports.find((x) => /pdf/i.test(x.label));
208
+ if (nativePdf) {
209
+ const out = await nativePdf.run(wire, made, v);
210
+ download(out.name, out.blob);
211
+ }
212
+ else {
213
+ const imgFile = v.files.find((f) => f.mime.startsWith('image/'));
214
+ const sourceBlob = imgFile
215
+ ? await read(wire, imgFile.key)
216
+ : k.exports[0]
217
+ ? (await k.exports[0].run(wire, made, v)).blob
218
+ : null;
219
+ if (sourceBlob && sourceBlob.type.startsWith('image/')) {
220
+ const canvas = await rasterizeBlob(sourceBlob, exportScale);
221
+ if (canvas) {
222
+ const pdfBlob = await canvasToPdfBlob(canvas, made.title);
223
+ download(filename(made.title, 'pdf'), pdfBlob);
224
+ }
225
+ else {
226
+ download(filename(made.title, 'png'), sourceBlob);
227
+ }
228
+ }
229
+ else if (k.exports[0]) {
230
+ const out = await k.exports[0].run(wire, made, v);
231
+ download(out.name, out.blob);
232
+ }
233
+ }
234
+ }
235
+ else {
236
+ const targetMime = exportFormat === 'webp' ? 'image/webp' : 'image/png';
237
+ const imgFile = v.files.find((f) => f.mime.startsWith('image/'));
238
+ const nativeImg = k.exports.find((x) => new RegExp(exportFormat, 'i').test(x.label));
239
+ let sourceBlob = null;
240
+ if (imgFile) {
241
+ sourceBlob = await read(wire, imgFile.key);
242
+ }
243
+ else if (nativeImg) {
244
+ sourceBlob = (await nativeImg.run(wire, made, v)).blob;
245
+ }
246
+ else if (k.exports[0]) {
247
+ sourceBlob = (await k.exports[0].run(wire, made, v)).blob;
248
+ }
249
+ if (sourceBlob && sourceBlob.type.startsWith('image/')) {
250
+ const canvas = await rasterizeBlob(sourceBlob, exportScale);
251
+ if (canvas) {
252
+ const converted = await canvasToBlob(canvas, targetMime, 0.94);
253
+ const suffix = exportScale === 2 ? '-2x' : '';
254
+ download(filename(`${made.title}${suffix}`, exportFormat), converted);
255
+ }
256
+ else {
257
+ download(filename(made.title, exportFormat), sourceBlob);
258
+ }
259
+ }
260
+ else if (k.exports[0]) {
261
+ const out = await k.exports[0].run(wire, made, v);
262
+ download(out.name, out.blob);
263
+ }
264
+ }
265
+ setExportedOnce(true);
266
+ timersRef.current.push(window.setTimeout(() => setExportedOnce(false), 1800));
267
+ }
268
+ catch (e) {
269
+ setError(e instanceof Error ? e.message : String(e));
270
+ }
271
+ finally {
272
+ setExportBusy(false);
273
+ }
274
+ };
275
+ const handleCopyLink = async () => {
276
+ setError('');
277
+ let link = typeof window !== 'undefined' ? window.location.href : '';
278
+ const primaryFile = v.files[0];
279
+ if (primaryFile) {
280
+ try {
281
+ const resolved = await url(wire, primaryFile.key);
282
+ if (resolved && /^https?:\/\//i.test(resolved))
283
+ link = resolved;
284
+ }
285
+ catch {
286
+ // Keep current page URL fallback
287
+ }
288
+ }
289
+ const ok = await copyText(link);
290
+ if (ok) {
291
+ setCopiedLink(true);
292
+ timersRef.current.push(window.setTimeout(() => setCopiedLink(false), 2000));
293
+ }
294
+ else {
295
+ setError('Could not copy link to clipboard.');
296
+ }
42
297
  };
43
298
  const Icon = k.icon;
44
299
  const versions = made.versions.map((x, i) => ({
@@ -48,25 +303,126 @@ export function Desk({ made, wire, others, onPick, onEdit, busy, failed }) {
48
303
  onSelect: () => onPick(i),
49
304
  }));
50
305
  const compare = against !== null && against !== made.at && made.versions[against] ? made.versions[against] : null;
51
- return (_jsxs(YStack, { flex: 1, minH: 0, "data-slot": "studio-tab", children: [_jsxs(XStack, { gap: "$1", px: "$2", py: "$1.5", items: "center", borderBottomWidth: 1, borderColor: "$borderColor", shrink: 0, flexWrap: "wrap", children: [_jsxs(XStack, { items: "center", gap: "$2", flex: 1, minW: 0, px: "$1", children: [_jsx(Icon, { size: 14 }), _jsx(SizableText, { size: "$2", fontWeight: "600", numberOfLines: 1, children: made.title })] }), _jsx(DropdownMenu, { trigger: _jsxs(XStack, { render: "button", "aria-label": `v${made.at + 1} of ${made.versions.length}, versions`, items: "center", gap: "$1", height: 30, px: "$2.5", rounded: "$3", cursor: "pointer", hoverStyle: { bg: '$hover' }, children: [_jsx(SizableText, { size: "$2", children: `v${made.at + 1} of ${made.versions.length}` }), _jsx(ChevronDown, { size: 13 })] }), items: [{ type: 'label', key: 'h', label: 'Versions' }, ...versions] }), made.versions.length > 1 ? (_jsx(DropdownMenu, { trigger: _jsxs(XStack, { render: "button", "aria-label": "Compare versions", "aria-pressed": compare ? true : undefined, items: "center", gap: "$1.5", height: 30, px: "$2.5", rounded: "$3", bg: compare ? '$hover' : 'transparent', cursor: "pointer", hoverStyle: { bg: '$hover' }, children: [_jsx(Columns2, { size: 14 }), _jsx(SizableText, { size: "$2", children: compare ? `v${(against ?? 0) + 1} | v${made.at + 1}` : 'Compare' })] }), items: [
306
+ const scaleApplies = exportFormat !== 'original';
307
+ return (_jsxs(YStack, { flex: 1, minH: 0, "data-slot": "studio-tab", children: [_jsxs(XStack, { gap: "$1.5", px: "$2", py: "$1.5", items: "center", borderBottomWidth: 1, borderColor: "var(--border)", shrink: 0, flexWrap: "wrap", children: [_jsxs(XStack, { items: "center", gap: "$2", flex: 1, minW: 0, px: "$1", children: [_jsx(XStack, { "$platform-web": { color: 'var(--foreground)' }, shrink: 0, children: _jsx(Icon, { size: 14 }) }), _jsx(SizableText, { size: "$2", fontWeight: "600", color: "$ink", numberOfLines: 1, children: made.title })] }), _jsx(DropdownMenu, { trigger: _jsxs(XStack, { render: _jsx("button", { type: "button" }), "aria-label": `v${made.at + 1} of ${made.versions.length}, versions`, items: "center", gap: "$1", minH: 44, "$max-sm": { minH: 44 }, $md: { minH: 30, height: 30 }, px: "$2.5", rounded: "$3", borderWidth: 1, borderColor: "var(--border-strong)", bg: "transparent", cursor: "pointer", hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, children: [_jsx(SizableText, { size: "$2", color: "$ink", children: `v${made.at + 1} of ${made.versions.length}` }), _jsx(ChevronDown, { size: 13, color: "$soft" })] }), items: [{ type: 'label', key: 'h', label: 'Versions' }, ...versions] }), made.versions.length > 1 ? (_jsx(DropdownMenu, { trigger: _jsxs(XStack, { render: _jsx("button", { type: "button" }), "aria-label": "Compare versions", "aria-pressed": compare ? true : undefined, items: "center", gap: "$1.5", minH: 44, "$max-sm": { minH: 44 }, $md: { minH: 30, height: 30 }, px: "$2.5", rounded: "$3", borderWidth: 1, borderColor: compare ? '$ink' : 'var(--border-strong)', bg: compare ? '$hover' : 'transparent', cursor: "pointer", hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, children: [_jsx(Columns2, { size: 14, color: "$ink" }), _jsx(SizableText, { size: "$2", color: "$ink", children: compare ? `v${(against ?? 0) + 1} | v${made.at + 1}` : 'Compare' })] }), items: [
52
308
  { type: 'label', key: 'h', label: 'Compare with' },
53
309
  ...made.versions.map((x, i) => ({ key: x.id, label: `Version ${i + 1}`, description: x.note.slice(0, 60), disabled: i === made.at, onSelect: () => setAgainst(i) })),
54
310
  ...(compare ? [{ type: 'separator', key: 's' }, { key: 'off', label: 'Stop comparing', onSelect: () => setAgainst(null) }] : []),
55
- ] })) : null, _jsx(DropdownMenu, { trigger: _jsxs(XStack, { render: "button", "aria-label": "Export", items: "center", gap: "$1.5", height: 30, px: "$2.5", rounded: "$3", cursor: "pointer", hoverStyle: { bg: '$hover' }, children: [_jsx(Download, { size: 14 }), _jsx(SizableText, { size: "$2", children: "Export" })] }), items: [{ type: 'label', key: 'h', label: 'Export' }, ...k.exports.map((x, i) => ({ key: x.label, label: x.label, onSelect: () => void exporting(i) }))] })] }), error || failed ? (_jsx(XStack, { px: "$3", py: "$2", bg: "$hover", shrink: 0, children: _jsx(SizableText, { size: "$2", color: "$red10", children: error || failed }) })) : null, compare ? (_jsx(Compare, { made: made, a: compare, b: v, wire: wire, others: others })) : (_jsx(k.View, { made: made, version: v, wire: wire, edit: onEdit, busy: busy, others: others }))] }));
311
+ ] })) : null, _jsxs(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "design-open-in-chat", "aria-label": "Open in Chat", onClick: handleOpenInChat, items: "center", gap: "$1.5", minH: 44, "$max-sm": { minH: 44 }, $md: { minH: 30, height: 30 }, px: "$2.5", rounded: "$3", borderWidth: 1, borderColor: "var(--border-strong)", bg: "transparent", cursor: "pointer", hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, children: [_jsx(MessageSquare, { size: 14, color: "$ink", "aria-hidden": true }), _jsx(SizableText, { size: "$2", color: "$ink", children: "Open in Chat" })] }), _jsxs(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "design-save-library", "aria-label": savingLibrary ? 'Saving to Library' : savedLibrary ? 'Saved to Library' : 'Save to Library', disabled: savingLibrary, onClick: () => void handleSaveToLibrary(), items: "center", gap: "$1.5", minH: 44, "$max-sm": { minH: 44 }, $md: { minH: 30, height: 30 }, px: "$2.5", rounded: "$3", borderWidth: 1, borderColor: "var(--border-strong)", bg: savedLibrary ? '$hover' : 'transparent', opacity: savingLibrary ? 0.6 : 1, cursor: savingLibrary ? 'default' : 'pointer', hoverStyle: savingLibrary ? undefined : { bg: '$hover' }, focusVisibleStyle: RING, children: [savedLibrary ? _jsx(Check, { size: 14, color: "var(--state-success)", "aria-hidden": true }) : _jsx(Bookmark, { size: 14, color: "$ink", "aria-hidden": true }), _jsx(SizableText, { size: "$2", color: "$ink", children: savingLibrary ? 'Saving…' : savedLibrary ? 'Saved' : 'Save to Library' })] }), _jsxs(Popover, { open: exportOpen, onOpenChange: setExportOpen, placement: "bottom", children: [_jsx(PopoverTrigger, { asChild: true, disablePressTrigger: true, children: _jsxs(XStack, { render: _jsx("button", { type: "button" }), onClick: () => setExportOpen((prev) => !prev), "aria-label": "Export", "aria-expanded": exportOpen, items: "center", gap: "$1.5", minH: 44, "$max-sm": { minH: 44 }, $md: { minH: 30, height: 30 }, px: "$2.5", rounded: "$3", borderWidth: 1, borderColor: exportOpen ? '$ink' : 'var(--border-strong)', bg: exportOpen ? '$hover' : 'transparent', cursor: "pointer", hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, children: [_jsx(Download, { size: 14, color: "$ink" }), _jsx(SizableText, { size: "$2", color: "$ink", children: "Export" }), _jsx(ChevronDown, { size: 12, color: "$soft" })] }) }), _jsxs(PopoverContent, { solid: true, align: "end", sideOffset: 6, width: 284, p: "$3", gap: "$3", rounded: "$4", borderWidth: 1, borderColor: "var(--border-strong)", bg: "var(--popover)", children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: "$2", children: [_jsx(SizableText, { size: "$2", fontWeight: "600", color: "$ink", children: "Export creation" }), _jsx(SizableText, { size: "$1", fontFamily: "$mono", color: "$soft", children: `v${made.at + 1} · ${k.label}` })] }), _jsxs(YStack, { gap: "$1.5", children: [_jsx(SizableText, { size: "$1", color: "$soft", children: "Format" }), _jsx(XStack, { role: "radiogroup", "aria-label": "Export format", gap: "$1.5", children: [
312
+ { id: 'png', label: 'PNG' },
313
+ { id: 'webp', label: 'WebP' },
314
+ { id: 'pdf', label: 'PDF' },
315
+ { id: 'original', label: 'Original' },
316
+ ].map((fmt) => {
317
+ const on = exportFormat === fmt.id;
318
+ return (_jsx(XStack, { render: _jsx("button", { type: "button" }), role: "radio", "aria-checked": on, onClick: () => setExportFormat(fmt.id), flex: 1, minH: 44, "$max-sm": { minH: 44 }, $md: { minH: 30, height: 30 }, items: "center", justify: "center", rounded: "$2", borderWidth: 1, borderColor: on ? '$ink' : 'var(--border-strong)', bg: on ? 'var(--surface-card-emphasis)' : 'transparent', cursor: "pointer", hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, children: _jsx(SizableText, { size: "$1", fontWeight: on ? '600' : '500', color: on ? '$ink' : '$soft', children: fmt.label }) }, fmt.id));
319
+ }) })] }), _jsxs(YStack, { gap: "$1.5", opacity: scaleApplies ? 1 : 0.45, children: [_jsxs(XStack, { items: "center", justify: "space-between", children: [_jsx(SizableText, { size: "$1", color: "$soft", children: "Resolution" }), !scaleApplies ? (_jsx(SizableText, { size: "$1", color: "$hint", children: "Native size" })) : null] }), _jsx(XStack, { role: "radiogroup", "aria-label": "Export resolution", gap: "$1.5", children: [1, 2].map((sc) => {
320
+ const on = exportScale === sc;
321
+ return (_jsxs(XStack, { render: _jsx("button", { type: "button" }), role: "radio", "aria-checked": on, disabled: !scaleApplies, onClick: () => scaleApplies && setExportScale(sc), flex: 1, minH: 44, "$max-sm": { minH: 44 }, $md: { minH: 30, height: 30 }, items: "center", justify: "center", gap: "$1", rounded: "$2", borderWidth: 1, borderColor: on && scaleApplies ? '$ink' : 'var(--border-strong)', bg: on && scaleApplies ? 'var(--surface-card-emphasis)' : 'transparent', cursor: scaleApplies ? 'pointer' : 'default', hoverStyle: scaleApplies ? { bg: '$hover' } : undefined, focusVisibleStyle: RING, children: [_jsx(SizableText, { size: "$1", fontFamily: "$mono", fontWeight: on ? '600' : '500', color: on && scaleApplies ? '$ink' : '$soft', children: `${sc}×` }), _jsx(SizableText, { size: "$1", color: "$soft", children: sc === 1 ? 'Standard' : 'Retina' })] }, sc));
322
+ }) })] }), _jsxs(XStack, { gap: "$2", children: [_jsxs(XStack, { render: _jsx("button", { type: "button" }), disabled: exportBusy, onClick: () => void runUnifiedExport(), flex: 1, minH: 44, "$max-sm": { minH: 44 }, $md: { minH: 34, height: 34 }, px: "$3", rounded: "$3", bg: "$ink", items: "center", justify: "center", gap: "$1.5", cursor: exportBusy ? 'default' : 'pointer', opacity: exportBusy ? 0.6 : 1, hoverStyle: exportBusy ? undefined : { opacity: 0.9 }, focusVisibleStyle: RING, children: [exportedOnce ? _jsx(Check, { size: 13, color: "$background" }) : _jsx(Download, { size: 13, color: "$background" }), _jsx(SizableText, { size: "$2", fontWeight: "600", color: "$background", children: exportBusy ? 'Exporting…' : exportedOnce ? 'Downloaded' : 'Download' })] }), _jsxs(XStack, { render: _jsx("button", { type: "button" }), "aria-label": copiedLink ? 'Link copied' : 'Copy link', onClick: () => void handleCopyLink(), minH: 44, "$max-sm": { minH: 44 }, $md: { minH: 34, height: 34 }, px: "$3", rounded: "$3", borderWidth: 1, borderColor: copiedLink ? 'var(--state-success)' : 'var(--border-strong)', bg: copiedLink ? 'var(--state-success-bg)' : 'transparent', items: "center", justify: "center", gap: "$1.5", cursor: "pointer", hoverStyle: { bg: copiedLink ? 'var(--state-success-bg)' : '$hover' }, focusVisibleStyle: RING, children: [copiedLink ? _jsx(Check, { size: 13, color: "var(--state-success)" }) : _jsx(Link2, { size: 13, color: "$ink" }), _jsx(SizableText, { size: "$2", fontWeight: "500", color: copiedLink ? 'var(--state-success)' : '$ink', children: copiedLink ? 'Copied' : 'Copy link' })] })] }), k.exports.length > 1 ? (_jsxs(YStack, { gap: "$1", pt: "$2", borderTopWidth: 1, borderColor: "var(--border)", children: [_jsx(SizableText, { size: "$1", color: "$soft", children: "Kind-specific exports" }), _jsx(XStack, { gap: "$1.5", flexWrap: "wrap", children: k.exports.map((ex, i) => (_jsx(XStack, { render: _jsx("button", { type: "button" }), disabled: exportBusy, onClick: () => void exportingNative(i), minH: 44, "$max-sm": { minH: 44 }, $md: { minH: 28, height: 28 }, px: "$2", rounded: "$2", borderWidth: 1, borderColor: "var(--border-strong)", bg: "transparent", items: "center", cursor: "pointer", hoverStyle: { bg: '$hover' }, focusVisibleStyle: RING, children: _jsx(SizableText, { size: "$1", color: "$ink", children: ex.label }) }, ex.label))) })] })) : null] })] })] }), error || failed ? (_jsx(XStack, { px: "$3", py: "$2", bg: "var(--state-error-bg)", borderBottomWidth: 1, borderColor: "var(--border)", shrink: 0, children: _jsx(SizableText, { size: "$2", color: "var(--state-error)", children: error || failed }) })) : null, compare ? (_jsx(Compare, { made: made, a: compare, b: v, wire: wire, others: others })) : (_jsx(k.View, { made: made, version: v, wire: wire, edit: onEdit, busy: busy, others: others }))] }));
56
323
  }
57
324
  function Compare({ made, a, b, wire, others }) {
58
325
  const pa = a.files.find((f) => f.mime.startsWith('image/'));
59
326
  const pb = b.files.find((f) => f.mime.startsWith('image/'));
60
- if (pa && pb && (made.kind === 'image' || made.kind === 'poster'))
61
- return _jsx(Wipe, { wire: wire, a: pa.key, b: pb.key, title: made.title });
327
+ const va = made.versions.indexOf(a) + 1;
328
+ const vb = made.versions.indexOf(b) + 1;
329
+ if (pa && pb && (made.kind === 'image' || made.kind === 'poster' || made.kind === 'ad')) {
330
+ return _jsx(Wipe, { wire: wire, a: pa.key, b: pb.key, title: made.title, labelA: `v${va}`, labelB: `v${vb}` });
331
+ }
62
332
  const k = kind(made.kind);
63
333
  const none = () => undefined;
64
- return (_jsx(XStack, { flex: 1, minH: 0, children: [a, b].map((v, i) => (_jsxs(YStack, { flex: 1, minW: 0, borderLeftWidth: i ? 1 : 0, borderColor: "$borderColor", children: [_jsx(SizableText, { size: "$1", color: "$soft", px: "$3", py: "$1", children: `Version ${made.versions.indexOf(v) + 1}` }), _jsx(k.View, { made: made, version: v, wire: wire, edit: none, busy: true, others: others })] }, v.id))) }));
334
+ return (_jsx(XStack, { flex: 1, minH: 0, children: [a, b].map((v, i) => (_jsxs(YStack, { flex: 1, minW: 0, borderLeftWidth: i ? 1 : 0, borderColor: "var(--border)", children: [_jsx(SizableText, { size: "$1", color: "$soft", px: "$3", py: "$1", children: `Version ${made.versions.indexOf(v) + 1}` }), _jsx(k.View, { made: made, version: v, wire: wire, edit: none, busy: true, others: others })] }, v.id))) }));
65
335
  }
66
- /** Two pictures, one over the other, the line between them dragged across. */
67
- function Wipe({ wire, a, b, title }) {
336
+ /** Two pictures, one over the other, dragged across by pointer, touch, or arrow keys. */
337
+ function Wipe({ wire, a, b, title, labelA, labelB }) {
68
338
  const left = useUrl(wire, a);
69
339
  const right = useUrl(wire, b);
70
340
  const [at, setAt] = useState(50);
71
- return (_jsxs(YStack, { flex: 1, minH: 0, items: "center", justify: "center", p: "$3", gap: "$2", children: [_jsxs("div", { style: { position: 'relative', maxWidth: '100%', maxHeight: 'calc(100% - 40px)', display: 'inline-block' }, children: [right.src ? _jsx("img", { src: right.src, alt: `${title}, the version shown`, style: { display: 'block', maxWidth: '100%', maxHeight: '70vh', borderRadius: 12 } }) : null, left.src ? (_jsx("img", { src: left.src, alt: `${title}, the version compared`, style: { position: 'absolute', inset: 0, width: '100%', height: '100%', objectFit: 'contain', clipPath: `inset(0 ${100 - at}% 0 0)`, borderRadius: 12 } })) : null, _jsx("div", { "aria-hidden": true, style: { position: 'absolute', top: 0, bottom: 0, left: `${at}%`, width: 2, background: '#fff', boxShadow: '0 0 0 1px rgba(0,0,0,.4)' } })] }), _jsx("input", { type: "range", min: 0, max: 100, value: at, "aria-label": "Move the line between the two versions", onChange: (e) => setAt(Number(e.currentTarget.value)), style: { width: 'min(420px, 100%)' } })] }));
341
+ const [dragging, setDragging] = useState(false);
342
+ const [sliderFocused, setSliderFocused] = useState(false);
343
+ const stageRef = useRef(null);
344
+ const updateFromClientX = useCallback((clientX) => {
345
+ const rect = stageRef.current?.getBoundingClientRect();
346
+ if (!rect || rect.width <= 0)
347
+ return;
348
+ const pct = Math.min(100, Math.max(0, ((clientX - rect.left) / rect.width) * 100));
349
+ setAt(Math.round(pct * 10) / 10);
350
+ }, []);
351
+ const onPointerDown = (e) => {
352
+ e.currentTarget.setPointerCapture(e.pointerId);
353
+ setDragging(true);
354
+ updateFromClientX(e.clientX);
355
+ };
356
+ const onPointerMove = (e) => {
357
+ if (!dragging)
358
+ return;
359
+ updateFromClientX(e.clientX);
360
+ };
361
+ const onPointerUp = (e) => {
362
+ if (dragging) {
363
+ try {
364
+ e.currentTarget.releasePointerCapture(e.pointerId);
365
+ }
366
+ catch {
367
+ // Ignore
368
+ }
369
+ setDragging(false);
370
+ }
371
+ };
372
+ const onKeyDown = (e) => {
373
+ const step = e.shiftKey ? 10 : 2;
374
+ if (e.key === 'ArrowLeft') {
375
+ e.preventDefault();
376
+ setAt((p) => Math.max(0, Math.round(p - step)));
377
+ }
378
+ else if (e.key === 'ArrowRight') {
379
+ e.preventDefault();
380
+ setAt((p) => Math.min(100, Math.round(p + step)));
381
+ }
382
+ else if (e.key === 'Home') {
383
+ e.preventDefault();
384
+ setAt(0);
385
+ }
386
+ else if (e.key === 'End') {
387
+ e.preventDefault();
388
+ setAt(100);
389
+ }
390
+ };
391
+ return (_jsxs(YStack, { flex: 1, minH: 0, items: "center", justify: "center", p: "$3", gap: "$2.5", children: [_jsxs("div", { ref: stageRef, onPointerDown: onPointerDown, onPointerMove: onPointerMove, onPointerUp: onPointerUp, onPointerCancel: onPointerUp, style: {
392
+ position: 'relative',
393
+ maxWidth: '100%',
394
+ maxHeight: 'calc(100% - 44px)',
395
+ display: 'inline-block',
396
+ cursor: 'ew-resize',
397
+ userSelect: 'none',
398
+ touchAction: 'none',
399
+ borderRadius: 12,
400
+ overflow: 'hidden',
401
+ border: '1px solid var(--border-strong)',
402
+ }, children: [right.src ? _jsx("img", { src: right.src, alt: `${title}, ${labelB}`, draggable: false, style: { display: 'block', maxWidth: '100%', maxHeight: '68vh' } }) : null, left.src ? (_jsx("img", { src: left.src, alt: `${title}, ${labelA}`, draggable: false, style: { position: 'absolute', inset: 0, width: '100%', height: '100%', objectFit: 'contain', clipPath: `inset(0 ${100 - at}% 0 0)` } })) : null, _jsx(XStack, { "aria-hidden": true, position: "absolute", t: 10, l: 10, px: "$2", height: 22, rounded: 999, bg: "var(--surface-header)", borderWidth: 1, borderColor: "var(--border)", items: "center", children: _jsx(SizableText, { size: "$1", fontFamily: "$mono", color: "$ink", children: `Before · ${labelA}` }) }), _jsx(XStack, { "aria-hidden": true, position: "absolute", t: 10, r: 10, px: "$2", height: 22, rounded: 999, bg: "var(--surface-header)", borderWidth: 1, borderColor: "var(--border)", items: "center", children: _jsx(SizableText, { size: "$1", fontFamily: "$mono", color: "$ink", children: `After · ${labelB}` }) }), _jsx("div", { role: "slider", tabIndex: 0, "aria-label": "Compare before and after versions", "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": Math.round(at), onKeyDown: onKeyDown, onFocus: () => setSliderFocused(true), onBlur: () => setSliderFocused(false), style: {
403
+ position: 'absolute',
404
+ top: 0,
405
+ bottom: 0,
406
+ left: `${at}%`,
407
+ width: 2,
408
+ transform: 'translateX(-1px)',
409
+ background: 'var(--foreground)',
410
+ boxShadow: '0 0 0 1px var(--background)',
411
+ outline: 'none',
412
+ }, children: _jsx("div", { "aria-hidden": true, style: {
413
+ position: 'absolute',
414
+ top: '50%',
415
+ left: '50%',
416
+ transform: 'translate(-50%, -50%)',
417
+ width: 34,
418
+ height: 34,
419
+ borderRadius: 999,
420
+ background: 'var(--background)',
421
+ border: '1px solid var(--border-strong)',
422
+ display: 'flex',
423
+ alignItems: 'center',
424
+ justifyContent: 'center',
425
+ boxShadow: sliderFocused ? '0 0 0 2px var(--ring), var(--shadow-sheet-2)' : 'var(--shadow-sheet-2)',
426
+ color: 'var(--foreground)',
427
+ }, children: _jsx(MoveHorizontal, { size: 14 }) }) })] }), _jsx(SizableText, { size: "$1", color: "$soft", fontFamily: "$mono", children: `Drag divider or press ← / → · ${Math.round(at)}%` })] }));
72
428
  }
@@ -0,0 +1,2 @@
1
+ /** Save bytes as a file the person keeps. */
2
+ export declare function download(name: string, blob: Blob): void;
@@ -0,0 +1,11 @@
1
+ /** Save bytes as a file the person keeps. */
2
+ export function download(name, blob) {
3
+ const url = URL.createObjectURL(blob);
4
+ const a = document.createElement('a');
5
+ a.href = url;
6
+ a.download = name;
7
+ document.body.appendChild(a);
8
+ a.click();
9
+ a.remove();
10
+ setTimeout(() => URL.revokeObjectURL(url), 10_000);
11
+ }
package/lib/gpu.d.ts CHANGED
@@ -7,8 +7,20 @@
7
7
  * `failed` row carries the engine's reason, and a row still `queued` when the
8
8
  * wait runs out is said to be still rendering, never called finished.
9
9
  */
10
- import { dispatch, type Wire } from './wire.ts';
10
+ import { dispatch, type Row, type Wire } from './wire.ts';
11
11
  export type Lane = Parameters<typeof dispatch>[1];
12
+ /** A sleep that ends early, and frees its timer, when `signal` aborts. */
13
+ export declare const nap: (ms: number, signal: AbortSignal) => Promise<void>;
14
+ /**
15
+ * Follow a dispatched job's work-log row until the engine closes it, `wait` ms
16
+ * pass or `signal` aborts. `seen` hears each change of status (`queued` while
17
+ * the row is not listed). Answers the last row; throws if the log cannot be read.
18
+ */
19
+ export declare function follow(w: Wire, id: string, o: {
20
+ signal: AbortSignal;
21
+ every?: number;
22
+ wait?: number;
23
+ }, seen: (status: string, row?: Row) => void): Promise<Row | undefined>;
12
24
  export declare function render(w: Wire, lane: Lane, body: object, doing: (line: string) => void, signal: AbortSignal): Promise<{
13
25
  blob: Blob;
14
26
  path: string;