@hanzo/studio 0.0.0-stage → 0.1.1
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/LICENSE +29 -0
- package/NOTICE +68 -0
- package/lib/chat/store.d.ts +33 -0
- package/lib/chat/store.js +56 -0
- package/lib/chat/turn.d.ts +51 -0
- package/lib/chat/turn.js +274 -0
- package/lib/desk.d.ts +14 -0
- package/lib/desk.js +72 -0
- package/lib/gpu.d.ts +15 -0
- package/lib/gpu.js +41 -0
- package/lib/home.d.ts +6 -0
- package/lib/home.js +48 -0
- package/lib/host.d.ts +12 -0
- package/lib/host.js +18 -0
- package/lib/index.d.ts +12 -0
- package/lib/index.js +11 -0
- package/lib/kinds/ad.d.ts +51 -0
- package/lib/kinds/ad.js +124 -0
- package/lib/kinds/document.d.ts +6 -0
- package/lib/kinds/document.js +271 -0
- package/lib/kinds/image.d.ts +47 -0
- package/lib/kinds/image.js +179 -0
- package/lib/kinds/index.d.ts +9 -0
- package/lib/kinds/index.js +12 -0
- package/lib/kinds/kind.d.ts +113 -0
- package/lib/kinds/kind.js +13 -0
- package/lib/kinds/mesh/index.d.ts +2 -0
- package/lib/kinds/mesh/index.js +76 -0
- package/lib/kinds/mesh/viewer.d.ts +7 -0
- package/lib/kinds/mesh/viewer.js +79 -0
- package/lib/kinds/poster/compose.d.ts +40 -0
- package/lib/kinds/poster/compose.js +289 -0
- package/lib/kinds/poster/index.d.ts +21 -0
- package/lib/kinds/poster/index.js +210 -0
- package/lib/kinds/sound.d.ts +6 -0
- package/lib/kinds/sound.js +100 -0
- package/lib/kinds/type/fonts.d.ts +30 -0
- package/lib/kinds/type/fonts.js +111 -0
- package/lib/kinds/type/index.d.ts +5 -0
- package/lib/kinds/type/index.js +117 -0
- package/lib/kinds/type/system.d.ts +164 -0
- package/lib/kinds/type/system.js +302 -0
- package/lib/kinds/video.d.ts +2 -0
- package/lib/kinds/video.js +81 -0
- package/lib/live.d.ts +44 -0
- package/lib/live.js +128 -0
- package/lib/made.d.ts +75 -0
- package/lib/made.js +36 -0
- package/lib/nav.d.ts +17 -0
- package/lib/nav.js +29 -0
- package/lib/pdf.d.ts +16 -0
- package/lib/pdf.js +53 -0
- package/lib/places.d.ts +6 -0
- package/lib/places.js +121 -0
- package/lib/raster.d.ts +7 -0
- package/lib/raster.js +53 -0
- package/lib/route.d.ts +33 -0
- package/lib/route.js +52 -0
- package/lib/starters.d.ts +31 -0
- package/lib/starters.js +62 -0
- package/lib/studio.d.ts +26 -0
- package/lib/studio.js +58 -0
- package/lib/talk.d.ts +3 -0
- package/lib/talk.js +369 -0
- package/lib/ui.d.ts +50 -0
- package/lib/ui.js +57 -0
- package/lib/use.d.ts +11 -0
- package/lib/use.js +35 -0
- package/lib/wire.d.ts +239 -0
- package/lib/wire.js +478 -0
- package/lib/zip.d.ts +9 -0
- package/lib/zip.js +60 -0
- package/package.json +75 -3
- package/README.md +0 -3
package/lib/wire.d.ts
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE ONE CLIENT MODULE. Everything Studio asks of the network goes through
|
|
3
|
+
* here, so the transport is one change when the native workflow plane
|
|
4
|
+
* (`api.hanzo.ai/v1/studio/*`) answers.
|
|
5
|
+
*
|
|
6
|
+
* Three places are reached today:
|
|
7
|
+
*
|
|
8
|
+
* gateway api.hanzo.ai/v1: the models — the chat that decides what to make,
|
|
9
|
+
* image generation and edit, speech, music. Billed to `org`.
|
|
10
|
+
* store this browser's IndexedDB, per person and org, and the person's
|
|
11
|
+
* private Library (api.hanzo.ai/v1/library) once it answers.
|
|
12
|
+
* engine the studio engine: documents and decks, and the GPU lanes
|
|
13
|
+
* (Zen Image, Wan video, ACE music, mesh) dispatched to the org's
|
|
14
|
+
* GPUs. Same origin on studio.hanzo.ai; https://studio.hanzo.ai
|
|
15
|
+
* from anywhere else, with the bearer, never a cookie.
|
|
16
|
+
*
|
|
17
|
+
* A refusal is a `Refusal` carrying the status and the server's own sentence,
|
|
18
|
+
* whichever envelope it came in (problem details, `{error}`, `{status:'error',
|
|
19
|
+
* msg}`), and a 200 that says `status: "error"` is a refusal too.
|
|
20
|
+
*/
|
|
21
|
+
export interface Wire {
|
|
22
|
+
/** The platform origin, no trailing slash. */
|
|
23
|
+
api: string;
|
|
24
|
+
/** The engine origin, no trailing slash: '' for this origin. */
|
|
25
|
+
engine: string;
|
|
26
|
+
/** The signed-in person's bearer, read at call time. */
|
|
27
|
+
token: () => string | null;
|
|
28
|
+
/** The org every call is scoped to (`X-Org-Id`). */
|
|
29
|
+
org: string | null;
|
|
30
|
+
}
|
|
31
|
+
/** Where the engine is from a page that is not studio.hanzo.ai. */
|
|
32
|
+
export declare const ENGINE = "https://studio.hanzo.ai";
|
|
33
|
+
export declare class Refusal extends Error {
|
|
34
|
+
readonly status: number;
|
|
35
|
+
readonly code: string;
|
|
36
|
+
constructor(status: number, message: string, code?: string);
|
|
37
|
+
}
|
|
38
|
+
type Base = 'api' | 'engine';
|
|
39
|
+
export interface Ask {
|
|
40
|
+
method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
41
|
+
body?: unknown;
|
|
42
|
+
/** A body sent as is (a form, a blob). */
|
|
43
|
+
raw?: BodyInit;
|
|
44
|
+
type?: string;
|
|
45
|
+
signal?: AbortSignal;
|
|
46
|
+
head?: Record<string, string>;
|
|
47
|
+
/** Reads the headers of an answer that succeeded. */
|
|
48
|
+
heard?: (h: Headers) => void;
|
|
49
|
+
}
|
|
50
|
+
/** One request. JSON in, JSON out, unless the answer is not JSON. */
|
|
51
|
+
export declare function ask<T>(w: Wire, base: Base, path: string, o?: Ask): Promise<T>;
|
|
52
|
+
/** `?a=1&b=2` from the defined, non-empty values. */
|
|
53
|
+
export declare function query(q: Record<string, string | number | boolean | null | undefined>): string;
|
|
54
|
+
export interface Call {
|
|
55
|
+
id: string;
|
|
56
|
+
name: string;
|
|
57
|
+
/** The arguments as the model wrote them: JSON text. */
|
|
58
|
+
args: string;
|
|
59
|
+
}
|
|
60
|
+
export interface Said {
|
|
61
|
+
text: string;
|
|
62
|
+
calls: Call[];
|
|
63
|
+
/** The model that answered, as the gateway names it. */
|
|
64
|
+
model: string;
|
|
65
|
+
}
|
|
66
|
+
export type Message = {
|
|
67
|
+
role: 'system' | 'user';
|
|
68
|
+
content: string | Part[];
|
|
69
|
+
} | {
|
|
70
|
+
role: 'assistant';
|
|
71
|
+
content: string;
|
|
72
|
+
tool_calls?: {
|
|
73
|
+
id: string;
|
|
74
|
+
type: 'function';
|
|
75
|
+
function: {
|
|
76
|
+
name: string;
|
|
77
|
+
arguments: string;
|
|
78
|
+
};
|
|
79
|
+
}[];
|
|
80
|
+
} | {
|
|
81
|
+
role: 'tool';
|
|
82
|
+
tool_call_id: string;
|
|
83
|
+
content: string;
|
|
84
|
+
};
|
|
85
|
+
export type Part = {
|
|
86
|
+
type: 'text';
|
|
87
|
+
text: string;
|
|
88
|
+
} | {
|
|
89
|
+
type: 'image_url';
|
|
90
|
+
image_url: {
|
|
91
|
+
url: string;
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
export interface Tool {
|
|
95
|
+
type: 'function';
|
|
96
|
+
function: {
|
|
97
|
+
name: string;
|
|
98
|
+
description: string;
|
|
99
|
+
parameters: object;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* One turn of the chat that decides what to make, streamed: `heard` gets the
|
|
104
|
+
* words so far as they arrive. Answers the words and the tool calls in full.
|
|
105
|
+
*/
|
|
106
|
+
export declare function complete(w: Wire, body: {
|
|
107
|
+
model: string;
|
|
108
|
+
messages: Message[];
|
|
109
|
+
tools?: Tool[];
|
|
110
|
+
temperature?: number;
|
|
111
|
+
}, heard: (text: string) => void, signal?: AbortSignal): Promise<Said>;
|
|
112
|
+
/** A JSON answer from a model, asked for by schema: what a generator (a type system, a deck's words) is made of. */
|
|
113
|
+
export declare function structured<T>(w: Wire, model: string, system: string, user: string, schema: object, signal?: AbortSignal): Promise<T>;
|
|
114
|
+
export interface Picture {
|
|
115
|
+
blob: Blob;
|
|
116
|
+
mime: string;
|
|
117
|
+
}
|
|
118
|
+
/** A data: URL's bytes. */
|
|
119
|
+
export declare function bytes(url: string): Picture;
|
|
120
|
+
/**
|
|
121
|
+
* An image from a gateway image model: words, and the pictures it starts from
|
|
122
|
+
* (an edit). The image models are chat models with an image output, so this is
|
|
123
|
+
* a chat completion asking for both modalities; the pictures come back on the
|
|
124
|
+
* message (`images`) or among its content parts.
|
|
125
|
+
*/
|
|
126
|
+
export declare function draw(w: Wire, model: string, prompt: string, o?: {
|
|
127
|
+
from?: string[];
|
|
128
|
+
aspect?: string;
|
|
129
|
+
signal?: AbortSignal;
|
|
130
|
+
}): Promise<Picture[]>;
|
|
131
|
+
/** Speech from words: the platform's voice. */
|
|
132
|
+
export declare function speak(w: Wire, input: string, voice: string, model: string, signal?: AbortSignal): Promise<Blob>;
|
|
133
|
+
/** Whether api.hanzo.ai/v1/library answers for this person. */
|
|
134
|
+
export declare function libraryLive(w: Wire): Promise<boolean>;
|
|
135
|
+
/** Keep bytes at a key. Answers the key. */
|
|
136
|
+
export declare function put(w: Wire, key: string, blob: Blob): Promise<string>;
|
|
137
|
+
/** Carry up to the Library whatever is kept only here. Answers how many went. */
|
|
138
|
+
export declare function sync(w: Wire): Promise<number>;
|
|
139
|
+
/** An address a page can draw a kept file at. */
|
|
140
|
+
export declare function url(w: Wire, key: string): Promise<string>;
|
|
141
|
+
/** A kept file's bytes. */
|
|
142
|
+
export declare function read(w: Wire, key: string): Promise<Blob>;
|
|
143
|
+
export interface Entry {
|
|
144
|
+
/** Relative to the prefix listed. */
|
|
145
|
+
key: string;
|
|
146
|
+
size: number;
|
|
147
|
+
/** Unix milliseconds. */
|
|
148
|
+
modified: number;
|
|
149
|
+
/** Whether it is saved in the Library too. */
|
|
150
|
+
shelved: boolean;
|
|
151
|
+
}
|
|
152
|
+
/** What is kept under a prefix (one that ends in '/'), keys relative to it. */
|
|
153
|
+
export declare function list(w: Wire, prefix: string): Promise<Entry[]>;
|
|
154
|
+
export declare function remove(w: Wire, key: string): Promise<void>;
|
|
155
|
+
/** A kept JSON document, or null when there is none. */
|
|
156
|
+
export declare function load<T>(w: Wire, key: string): Promise<T | null>;
|
|
157
|
+
export declare const save: (w: Wire, key: string, value: unknown) => Promise<string>;
|
|
158
|
+
export interface Node {
|
|
159
|
+
identity: string;
|
|
160
|
+
name?: string;
|
|
161
|
+
online?: boolean;
|
|
162
|
+
/** The lanes this GPU can run now: every file its graph loads is present. */
|
|
163
|
+
lanes?: string[];
|
|
164
|
+
}
|
|
165
|
+
export interface Fleet {
|
|
166
|
+
state: 'busy' | 'ready' | 'offline';
|
|
167
|
+
online: number;
|
|
168
|
+
total: number;
|
|
169
|
+
nodes: Node[];
|
|
170
|
+
}
|
|
171
|
+
/** The org's GPUs and what each can run. A fleet the engine cannot read is an error, never an empty fleet. */
|
|
172
|
+
export declare const gpus: (w: Wire, signal?: AbortSignal) => Promise<Fleet>;
|
|
173
|
+
export interface Submitted {
|
|
174
|
+
prompt_id?: string;
|
|
175
|
+
id?: string;
|
|
176
|
+
node?: string | null;
|
|
177
|
+
output?: string;
|
|
178
|
+
outputs?: string[];
|
|
179
|
+
}
|
|
180
|
+
/** Dispatch a lane to the org's GPUs (the engine's one funnel). */
|
|
181
|
+
export declare const dispatch: (w: Wire, lane: 'image' | 'video' | 'fix' | 'model3d' | 'music', body: object, signal?: AbortSignal) => Promise<Submitted>;
|
|
182
|
+
export interface Row {
|
|
183
|
+
id: string;
|
|
184
|
+
status: string;
|
|
185
|
+
kind?: string;
|
|
186
|
+
output?: string;
|
|
187
|
+
outputs?: string[];
|
|
188
|
+
error?: string;
|
|
189
|
+
prompt_id?: string;
|
|
190
|
+
}
|
|
191
|
+
/** The engine's record of what was dispatched and what landed. */
|
|
192
|
+
export declare const worklog: (w: Wire, signal?: AbortSignal) => Promise<Row[]>;
|
|
193
|
+
/** A landed file of the engine library, as bytes. */
|
|
194
|
+
export declare const landed: (w: Wire, path: string) => Promise<Blob>;
|
|
195
|
+
/** Documents and decks: the engine's renderers. */
|
|
196
|
+
export declare const documents: {
|
|
197
|
+
schema: (w: Wire) => Promise<object>;
|
|
198
|
+
create: (w: Wire, body: {
|
|
199
|
+
kind: string;
|
|
200
|
+
ir: object;
|
|
201
|
+
title?: string;
|
|
202
|
+
}) => Promise<{
|
|
203
|
+
id: string;
|
|
204
|
+
}>;
|
|
205
|
+
generate: (w: Wire, body: {
|
|
206
|
+
templateId: string;
|
|
207
|
+
description?: string;
|
|
208
|
+
fields?: object;
|
|
209
|
+
}) => Promise<{
|
|
210
|
+
id: string;
|
|
211
|
+
}>;
|
|
212
|
+
patch: (w: Wire, id: string, body: object) => Promise<{
|
|
213
|
+
id: string;
|
|
214
|
+
}>;
|
|
215
|
+
get: (w: Wire, id: string) => Promise<{
|
|
216
|
+
id: string;
|
|
217
|
+
kind: string;
|
|
218
|
+
ir: object;
|
|
219
|
+
title: string;
|
|
220
|
+
}>;
|
|
221
|
+
file: (w: Wire, id: string, format: string) => Promise<Blob>;
|
|
222
|
+
};
|
|
223
|
+
/** Stage a picture in the engine's input folder for a lane that starts from one. Answers the name the lane takes. */
|
|
224
|
+
export declare function stage(w: Wire, blob: Blob, name: string): Promise<string>;
|
|
225
|
+
/** A clip from a gateway video model: started, followed, read back (the async /v1/videos API). */
|
|
226
|
+
export declare function film(w: Wire, model: string, prompt: string, o: {
|
|
227
|
+
size?: string;
|
|
228
|
+
seconds?: number;
|
|
229
|
+
doing: (l: string) => void;
|
|
230
|
+
signal: AbortSignal;
|
|
231
|
+
}): Promise<Blob>;
|
|
232
|
+
/** The gateway's catalog of models that make something other than words. */
|
|
233
|
+
export declare function makers(w: Wire, signal?: AbortSignal): Promise<{
|
|
234
|
+
id: string;
|
|
235
|
+
name: string;
|
|
236
|
+
inputs: string[];
|
|
237
|
+
outputs: string[];
|
|
238
|
+
}[]>;
|
|
239
|
+
export {};
|