@hanzo/studio 0.1.7 → 0.1.11

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/wire.js CHANGED
@@ -216,8 +216,20 @@ export function bytes(url) {
216
216
  * a chat completion asking for both modalities; the pictures come back on the
217
217
  * message (`images`) or among its content parts.
218
218
  */
219
+ const IMAGE_GEN_MODELS = new Set(['iro', 'iro-1', 'zen-image', 'zen3-image', 'enso-image', 'koma']);
219
220
  export async function draw(w, model, prompt, o = {}) {
220
221
  let held;
222
+ if (!o.from?.length && (IMAGE_GEN_MODELS.has(model) || model.startsWith('black-forest-labs/'))) {
223
+ const gen = await ask(w, 'api', '/v1/images/generations', {
224
+ body: { model, prompt, size: '1024x1024' },
225
+ signal: o.signal,
226
+ heard: (h) => (held = h),
227
+ });
228
+ const b64s = (gen.data ?? []).map((d) => d.b64_json ?? '').filter(Boolean);
229
+ if (!b64s.length)
230
+ throw withheld(model, held);
231
+ return b64s.map((b) => bytes(`data:image/jpeg;base64,${b}`));
232
+ }
221
233
  const content = [{ type: 'text', text: prompt }, ...(o.from ?? []).map((url) => ({ type: 'image_url', image_url: { url } }))];
222
234
  const out = await ask(w, 'api', '/v1/chat/completions', {
223
235
  body: {
@@ -318,7 +330,8 @@ export function libraryLive(w) {
318
330
  }
319
331
  /** The most a browser may send the Library in one save (its inline limit). */
320
332
  const INLINE = 10 * 1024 * 1024;
321
- const KINDS_LIB = { image: 'image', poster: 'image', ad: 'image', video: 'video', voice: 'audio', music: 'audio', document: 'document', slides: 'slides', type: 'type', mesh: 'model' };
333
+ /** What each kind makes, as the Library files it (`POST /v1/library` `kind`). */
334
+ export const LIBRARY = { image: 'image', poster: 'image', ad: 'image', video: 'video', voice: 'audio', music: 'audio', document: 'document', slides: 'slides', type: 'type', mesh: 'model', app: 'app' };
322
335
  /** Whether a key and its bytes belong in the Library: a made file the Library can take from a browser. */
323
336
  const shelvable = (key, blob) => key.startsWith('files/') && key.split('/').length > 3 && blob.size <= INLINE;
324
337
  const base64 = async (b) => {
@@ -337,9 +350,9 @@ async function shelve(w, key, blob) {
337
350
  mime: blob.type || 'application/octet-stream',
338
351
  data: await base64(blob),
339
352
  source: 'studio',
340
- kind: KINDS_LIB[kind] ?? 'file',
353
+ kind: LIBRARY[kind] ?? 'file',
341
354
  ref: chat,
342
- origin: `/studio/c/${chat}`,
355
+ origin: `/design/c/${chat}`,
343
356
  key,
344
357
  },
345
358
  });
package/package.json CHANGED
@@ -1,52 +1,41 @@
1
1
  {
2
2
  "name": "@hanzo/studio",
3
- "version": "0.1.7",
3
+ "version": "0.1.11",
4
4
  "type": "module",
5
5
  "license": "BSD-3-Clause",
6
6
  "description": "Hanzo Studio: a chat that makes images, posters, documents, slides, type systems, 3D, video and sound, with every result open in a tab beside it. Mounted by the Hanzo app at hanzo.ai/studio and served whole at studio.hanzo.ai.",
7
7
  "homepage": "https://studio.hanzo.ai",
8
- "packageManager": "pnpm@11.24.0",
9
8
  "engines": {
10
9
  "node": ">=22.18"
11
10
  },
12
- "scripts": {
13
- "dev": "vite",
14
- "build": "tsc --noEmit && vite build",
15
- "build:lib": "rm -rf lib && tsc -p tsconfig.lib.json",
16
- "typecheck": "tsc --noEmit",
17
- "preview": "vite preview",
18
- "test": "vitest run",
19
- "e2e": "playwright test",
20
- "prepack": "pnpm run build:lib"
21
- },
22
11
  "dependencies": {
23
- "three": "catalog:"
12
+ "three": "0.186.1"
24
13
  },
25
14
  "devDependencies": {
26
- "@axe-core/playwright": "catalog:",
27
- "@hanzo/build": "catalog:",
28
- "@hanzo/composer": "catalog:",
29
- "@hanzo/font": "catalog:",
30
- "@hanzo/gui": "catalog:",
31
- "@hanzo/i18n": "catalog:",
32
- "@hanzo/ui": "catalog:",
33
- "@hanzo/vite": "catalog:",
34
- "@hanzo/voice": "catalog:",
35
- "@hanzogui/lucide-icons-2": "catalog:",
36
- "@hanzogui/next-theme": "catalog:",
37
- "@playwright/test": "catalog:",
38
- "@types/node": "catalog:",
39
- "@types/react": "catalog:",
40
- "@types/react-dom": "catalog:",
41
- "@types/three": "catalog:",
42
- "@vitejs/plugin-react": "catalog:",
43
- "next-themes": "catalog:",
44
- "react": "catalog:",
45
- "react-dom": "catalog:",
46
- "react-native-web": "catalog:",
47
- "typescript": "catalog:",
48
- "vite": "catalog:",
49
- "vitest": "catalog:"
15
+ "@axe-core/playwright": "4.14.0",
16
+ "@hanzo/build": "0.2.85",
17
+ "@hanzo/composer": "0.2.0",
18
+ "@hanzo/font": "1.9.3",
19
+ "@hanzo/gui": "8.3.5",
20
+ "@hanzo/i18n": "0.5.3",
21
+ "@hanzo/ui": "8.29.24",
22
+ "@hanzo/vite": "0.1.4",
23
+ "@hanzo/voice": "0.1.19",
24
+ "@hanzogui/lucide-icons-2": "8.3.5",
25
+ "@hanzogui/next-theme": "8.3.5",
26
+ "@playwright/test": "1.63.0",
27
+ "@types/node": "26.5.0",
28
+ "@types/react": "19.2.18",
29
+ "@types/react-dom": "19.2.7",
30
+ "@types/three": "0.186.0",
31
+ "@vitejs/plugin-react": "^6.1.1",
32
+ "next-themes": "^0.4.6",
33
+ "react": "19.2.8",
34
+ "react-dom": "19.2.8",
35
+ "react-native-web": "^0.21.2",
36
+ "typescript": "7.0.2",
37
+ "vite": "^8.2.2",
38
+ "vitest": "^4.1.11"
50
39
  },
51
40
  "exports": {
52
41
  ".": {
@@ -78,5 +67,14 @@
78
67
  "@hanzo/voice": ">=0.1.19",
79
68
  "@hanzogui/lucide-icons-2": ">=8.3.5",
80
69
  "react": ">=19.2.8"
70
+ },
71
+ "scripts": {
72
+ "dev": "vite",
73
+ "build": "tsc --noEmit && vite build",
74
+ "build:lib": "rm -rf lib && tsc -p tsconfig.lib.json",
75
+ "typecheck": "tsc --noEmit",
76
+ "preview": "vite preview",
77
+ "test": "vitest run",
78
+ "e2e": "playwright test"
81
79
  }
82
- }
80
+ }