hatchlight 0.0.0-stage → 0.4.2
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 +21 -0
- package/README.md +34 -2
- package/bin/hatchlight.js +434 -0
- package/package.json +32 -5
- package/resources/drizzle/0000_init.sql +57 -0
- package/resources/drizzle/0001_job_error_codes.sql +2 -0
- package/resources/drizzle/0002_assistant_messages.sql +10 -0
- package/resources/drizzle/0003_accounts.sql +56 -0
- package/resources/drizzle/0004_spending.sql +14 -0
- package/resources/drizzle/0005_account_hardening.sql +12 -0
- package/resources/drizzle/0006_lora_uploads.sql +8 -0
- package/resources/drizzle/0007_reset_notices.sql +1 -0
- package/resources/drizzle/0008_spending_key_source.sql +1 -0
- package/resources/drizzle/0009_asset_usage.sql +8 -0
- package/resources/drizzle/0010_agent_tokens.sql +8 -0
- package/resources/drizzle/0011_pending_spending.sql +1 -0
- package/resources/drizzle/meta/0000_snapshot.json +374 -0
- package/resources/drizzle/meta/0001_snapshot.json +388 -0
- package/resources/drizzle/meta/0002_snapshot.json +449 -0
- package/resources/drizzle/meta/0003_snapshot.json +814 -0
- package/resources/drizzle/meta/0004_snapshot.json +872 -0
- package/resources/drizzle/meta/0005_snapshot.json +950 -0
- package/resources/drizzle/meta/0006_snapshot.json +994 -0
- package/resources/drizzle/meta/0007_snapshot.json +1001 -0
- package/resources/drizzle/meta/0008_snapshot.json +1009 -0
- package/resources/drizzle/meta/0009_snapshot.json +1033 -0
- package/resources/drizzle/meta/0010_snapshot.json +1064 -0
- package/resources/drizzle/meta/0011_snapshot.json +1072 -0
- package/resources/drizzle/meta/_journal.json +90 -0
- package/resources/web/assets/Assistant-Dcr31LAV.js +44 -0
- package/resources/web/assets/Gallery-CMRGE3qD.js +11 -0
- package/resources/web/assets/Models-D468Wmoj.js +1 -0
- package/resources/web/assets/Settings-DSXHt9Y3.js +2 -0
- package/resources/web/assets/bricolage-grotesque-latin-500-normal-CV-uA8Lw.woff +0 -0
- package/resources/web/assets/bricolage-grotesque-latin-500-normal-DEDBoLFO.woff2 +0 -0
- package/resources/web/assets/bricolage-grotesque-latin-700-normal-DvJDmrLu.woff +0 -0
- package/resources/web/assets/bricolage-grotesque-latin-700-normal-gtcctNPv.woff2 +0 -0
- package/resources/web/assets/bricolage-grotesque-latin-800-normal-Br4b-5gk.woff +0 -0
- package/resources/web/assets/bricolage-grotesque-latin-800-normal-J50vIsBe.woff2 +0 -0
- package/resources/web/assets/bricolage-grotesque-latin-ext-500-normal-B0ZDNVGf.woff +0 -0
- package/resources/web/assets/bricolage-grotesque-latin-ext-500-normal-DIhLz7G7.woff2 +0 -0
- package/resources/web/assets/bricolage-grotesque-latin-ext-700-normal-BXpPFNFj.woff +0 -0
- package/resources/web/assets/bricolage-grotesque-latin-ext-700-normal-fBkt-7fi.woff2 +0 -0
- package/resources/web/assets/bricolage-grotesque-latin-ext-800-normal-BimIDUhy.woff2 +0 -0
- package/resources/web/assets/bricolage-grotesque-latin-ext-800-normal-CkoBqIJM.woff +0 -0
- package/resources/web/assets/bricolage-grotesque-vietnamese-500-normal-CAK5R6Iy.woff +0 -0
- package/resources/web/assets/bricolage-grotesque-vietnamese-500-normal-FzY9NZwK.woff2 +0 -0
- package/resources/web/assets/bricolage-grotesque-vietnamese-700-normal-BLYPkJbo.woff2 +0 -0
- package/resources/web/assets/bricolage-grotesque-vietnamese-700-normal-CHrFuVHU.woff +0 -0
- package/resources/web/assets/bricolage-grotesque-vietnamese-800-normal-DJ4hCX8l.woff +0 -0
- package/resources/web/assets/bricolage-grotesque-vietnamese-800-normal-RJtJa6zl.woff2 +0 -0
- package/resources/web/assets/ibm-plex-mono-cyrillic-400-normal-CJUKFyLa.woff +0 -0
- package/resources/web/assets/ibm-plex-mono-cyrillic-400-normal-DvQQgHTq.woff2 +0 -0
- package/resources/web/assets/ibm-plex-mono-cyrillic-500-normal-BtGHVI3Q.woff2 +0 -0
- package/resources/web/assets/ibm-plex-mono-cyrillic-500-normal-N1TV9ACq.woff +0 -0
- package/resources/web/assets/ibm-plex-mono-cyrillic-ext-400-normal-B3hZxag_.woff2 +0 -0
- package/resources/web/assets/ibm-plex-mono-cyrillic-ext-400-normal-ZyMXPjaT.woff +0 -0
- package/resources/web/assets/ibm-plex-mono-cyrillic-ext-500-normal-CmcxpzmF.woff2 +0 -0
- package/resources/web/assets/ibm-plex-mono-cyrillic-ext-500-normal-yqk7_qG0.woff +0 -0
- package/resources/web/assets/ibm-plex-mono-latin-400-normal-Dm_PoFIZ.woff2 +0 -0
- package/resources/web/assets/ibm-plex-mono-latin-400-normal-O6-GRVqx.woff +0 -0
- package/resources/web/assets/ibm-plex-mono-latin-500-normal-C_OblDzq.woff2 +0 -0
- package/resources/web/assets/ibm-plex-mono-latin-500-normal-zoSM89R3.woff +0 -0
- package/resources/web/assets/ibm-plex-mono-latin-ext-400-normal-DxDDqVQb.woff2 +0 -0
- package/resources/web/assets/ibm-plex-mono-latin-ext-400-normal-uwM7KshN.woff +0 -0
- package/resources/web/assets/ibm-plex-mono-latin-ext-500-normal-BhDX_RLI.woff +0 -0
- package/resources/web/assets/ibm-plex-mono-latin-ext-500-normal-Dn-cqWhb.woff2 +0 -0
- package/resources/web/assets/ibm-plex-mono-vietnamese-400-normal-BFiUPp6R.woff2 +0 -0
- package/resources/web/assets/ibm-plex-mono-vietnamese-400-normal-DLynVohM.woff +0 -0
- package/resources/web/assets/ibm-plex-mono-vietnamese-500-normal-CevHOlzG.woff2 +0 -0
- package/resources/web/assets/ibm-plex-mono-vietnamese-500-normal-QhwQXayn.woff +0 -0
- package/resources/web/assets/index-DrgBjkJQ.js +322 -0
- package/resources/web/assets/index-gLwjTNlu.css +1 -0
- package/resources/web/assets/index-ydGCWKys.js +1 -0
- package/resources/web/assets/inter-tight-cyrillic-400-normal-Cu6X1knp.woff +0 -0
- package/resources/web/assets/inter-tight-cyrillic-400-normal-DLglYK2S.woff2 +0 -0
- package/resources/web/assets/inter-tight-cyrillic-500-normal-BS_Q301l.woff +0 -0
- package/resources/web/assets/inter-tight-cyrillic-500-normal-GsQC2I9I.woff2 +0 -0
- package/resources/web/assets/inter-tight-cyrillic-600-normal-CA1nZd4A.woff +0 -0
- package/resources/web/assets/inter-tight-cyrillic-600-normal-zvV8lvuq.woff2 +0 -0
- package/resources/web/assets/inter-tight-cyrillic-ext-400-normal-CPa21WFm.woff +0 -0
- package/resources/web/assets/inter-tight-cyrillic-ext-400-normal-wRoSiYJX.woff2 +0 -0
- package/resources/web/assets/inter-tight-cyrillic-ext-500-normal-DDZdcw0e.woff2 +0 -0
- package/resources/web/assets/inter-tight-cyrillic-ext-500-normal-SbyCo7Dv.woff +0 -0
- package/resources/web/assets/inter-tight-cyrillic-ext-600-normal-BwQoccyI.woff2 +0 -0
- package/resources/web/assets/inter-tight-cyrillic-ext-600-normal-D1EOoMTg.woff +0 -0
- package/resources/web/assets/inter-tight-greek-400-normal-8GU0b4sT.woff2 +0 -0
- package/resources/web/assets/inter-tight-greek-400-normal-BeMKI6ne.woff +0 -0
- package/resources/web/assets/inter-tight-greek-500-normal-BGOdJ4jK.woff +0 -0
- package/resources/web/assets/inter-tight-greek-500-normal-DfwCMcvd.woff2 +0 -0
- package/resources/web/assets/inter-tight-greek-600-normal-BIWCW30H.woff2 +0 -0
- package/resources/web/assets/inter-tight-greek-600-normal-CMARuIv4.woff +0 -0
- package/resources/web/assets/inter-tight-greek-ext-400-normal-B035aUhC.woff2 +0 -0
- package/resources/web/assets/inter-tight-greek-ext-400-normal-tWLvaB1R.woff +0 -0
- package/resources/web/assets/inter-tight-greek-ext-500-normal-BtZsBjxU.woff +0 -0
- package/resources/web/assets/inter-tight-greek-ext-500-normal-DitH-qUF.woff2 +0 -0
- package/resources/web/assets/inter-tight-greek-ext-600-normal-4wRrF3Lp.woff2 +0 -0
- package/resources/web/assets/inter-tight-greek-ext-600-normal-DTLxDvi0.woff +0 -0
- package/resources/web/assets/inter-tight-latin-400-normal-BW_APOAv.woff +0 -0
- package/resources/web/assets/inter-tight-latin-400-normal-CjmW70MP.woff2 +0 -0
- package/resources/web/assets/inter-tight-latin-500-normal-DHfo6WYp.woff2 +0 -0
- package/resources/web/assets/inter-tight-latin-500-normal-DSK3iurg.woff +0 -0
- package/resources/web/assets/inter-tight-latin-600-normal-BhR4EMHT.woff2 +0 -0
- package/resources/web/assets/inter-tight-latin-600-normal-RFJ2ueZL.woff +0 -0
- package/resources/web/assets/inter-tight-latin-ext-400-normal-BdDiaPns.woff +0 -0
- package/resources/web/assets/inter-tight-latin-ext-400-normal-Gi8wMfrP.woff2 +0 -0
- package/resources/web/assets/inter-tight-latin-ext-500-normal-BdRfio7v.woff +0 -0
- package/resources/web/assets/inter-tight-latin-ext-500-normal-CSMKT5kA.woff2 +0 -0
- package/resources/web/assets/inter-tight-latin-ext-600-normal-BiZjrIRq.woff +0 -0
- package/resources/web/assets/inter-tight-latin-ext-600-normal-Yxv5k3jL.woff2 +0 -0
- package/resources/web/assets/inter-tight-vietnamese-400-normal-CWFku8rW.woff2 +0 -0
- package/resources/web/assets/inter-tight-vietnamese-400-normal-s0S0Ysqp.woff +0 -0
- package/resources/web/assets/inter-tight-vietnamese-500-normal-B9o3jXvc.woff2 +0 -0
- package/resources/web/assets/inter-tight-vietnamese-500-normal-D9AKxpnU.woff +0 -0
- package/resources/web/assets/inter-tight-vietnamese-600-normal-B6ESNxpD.woff +0 -0
- package/resources/web/assets/inter-tight-vietnamese-600-normal-BZpsSm6S.woff2 +0 -0
- package/resources/web/assets/splash-CLEpm4fL.js +1 -0
- package/resources/web/favicon.svg +15 -0
- package/resources/web/index.html +17 -0
- package/resources/web/samples/flux-schnell.webp +0 -0
- package/resources/web/samples/sdxl-turbo.webp +0 -0
- package/resources/web/samples/sdxl.webp +0 -0
- package/resources/web/samples/z-image-turbo.webp +0 -0
- package/resources/web/splash.html +26 -0
package/package.json
CHANGED
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
"name": "hatchlight",
|
|
3
|
+
"version": "0.4.2",
|
|
4
|
+
"description": "Make pictures and videos with many AI models, side by side, on your own graphics card or with your own cloud keys. Includes an MCP server for AI agents.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"mcp",
|
|
7
|
+
"mcp-server",
|
|
8
|
+
"stable-diffusion",
|
|
9
|
+
"flux",
|
|
10
|
+
"image-generation",
|
|
11
|
+
"text-to-image",
|
|
12
|
+
"local-ai"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://hatchlight.app",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/hatchlight/hatchlight.git"
|
|
18
|
+
},
|
|
19
|
+
"bugs": "https://github.com/hatchlight/hatchlight/issues",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"type": "module",
|
|
22
|
+
"bin": {
|
|
23
|
+
"hatchlight": "bin/hatchlight.js"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"bin",
|
|
27
|
+
"resources"
|
|
28
|
+
],
|
|
29
|
+
"engines": {
|
|
30
|
+
"bun": ">=1.3"
|
|
31
|
+
},
|
|
32
|
+
"mcpName": "io.github.hatchlight/hatchlight"
|
|
33
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
CREATE TABLE `assets` (
|
|
2
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
3
|
+
`user_id` text NOT NULL,
|
|
4
|
+
`job_id` text,
|
|
5
|
+
`kind` text NOT NULL,
|
|
6
|
+
`hash` text NOT NULL,
|
|
7
|
+
`mime` text NOT NULL,
|
|
8
|
+
`size` integer NOT NULL,
|
|
9
|
+
`prompt` text,
|
|
10
|
+
`model_id` text,
|
|
11
|
+
`params` text,
|
|
12
|
+
`created_at` integer NOT NULL,
|
|
13
|
+
FOREIGN KEY (`job_id`) REFERENCES `jobs`(`id`) ON UPDATE no action ON DELETE set null
|
|
14
|
+
);
|
|
15
|
+
--> statement-breakpoint
|
|
16
|
+
CREATE INDEX `assets_user_kind_created` ON `assets` (`user_id`,`kind`,`created_at`);--> statement-breakpoint
|
|
17
|
+
CREATE INDEX `assets_job` ON `assets` (`job_id`);--> statement-breakpoint
|
|
18
|
+
CREATE TABLE `jobs` (
|
|
19
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
20
|
+
`turn_id` text NOT NULL,
|
|
21
|
+
`position` integer NOT NULL,
|
|
22
|
+
`user_id` text NOT NULL,
|
|
23
|
+
`provider_id` text NOT NULL,
|
|
24
|
+
`model_id` text NOT NULL,
|
|
25
|
+
`params` text NOT NULL,
|
|
26
|
+
`status` text NOT NULL,
|
|
27
|
+
`handle` text,
|
|
28
|
+
`error` text,
|
|
29
|
+
`cost_usd` real,
|
|
30
|
+
`created_at` integer NOT NULL,
|
|
31
|
+
`started_at` integer,
|
|
32
|
+
`finished_at` integer,
|
|
33
|
+
FOREIGN KEY (`turn_id`) REFERENCES `turns`(`id`) ON UPDATE no action ON DELETE cascade
|
|
34
|
+
);
|
|
35
|
+
--> statement-breakpoint
|
|
36
|
+
CREATE INDEX `jobs_turn` ON `jobs` (`turn_id`);--> statement-breakpoint
|
|
37
|
+
CREATE INDEX `jobs_status` ON `jobs` (`status`);--> statement-breakpoint
|
|
38
|
+
CREATE TABLE `sessions` (
|
|
39
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
40
|
+
`user_id` text NOT NULL,
|
|
41
|
+
`title` text NOT NULL,
|
|
42
|
+
`created_at` integer NOT NULL,
|
|
43
|
+
`updated_at` integer NOT NULL
|
|
44
|
+
);
|
|
45
|
+
--> statement-breakpoint
|
|
46
|
+
CREATE INDEX `sessions_user_updated` ON `sessions` (`user_id`,`updated_at`);--> statement-breakpoint
|
|
47
|
+
CREATE TABLE `turns` (
|
|
48
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
49
|
+
`session_id` text NOT NULL,
|
|
50
|
+
`user_id` text NOT NULL,
|
|
51
|
+
`prompt` text NOT NULL,
|
|
52
|
+
`reference_asset_ids` text NOT NULL,
|
|
53
|
+
`created_at` integer NOT NULL,
|
|
54
|
+
FOREIGN KEY (`session_id`) REFERENCES `sessions`(`id`) ON UPDATE no action ON DELETE cascade
|
|
55
|
+
);
|
|
56
|
+
--> statement-breakpoint
|
|
57
|
+
CREATE INDEX `turns_session_created` ON `turns` (`session_id`,`created_at`);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
CREATE TABLE `messages` (
|
|
2
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
3
|
+
`session_id` text NOT NULL,
|
|
4
|
+
`user_id` text NOT NULL,
|
|
5
|
+
`body` text NOT NULL,
|
|
6
|
+
`created_at` integer NOT NULL,
|
|
7
|
+
FOREIGN KEY (`session_id`) REFERENCES `sessions`(`id`) ON UPDATE no action ON DELETE cascade
|
|
8
|
+
);
|
|
9
|
+
--> statement-breakpoint
|
|
10
|
+
CREATE INDEX `messages_session_created` ON `messages` (`session_id`,`created_at`);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
CREATE TABLE `api_tokens` (
|
|
2
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
3
|
+
`user_id` text NOT NULL,
|
|
4
|
+
`name` text NOT NULL,
|
|
5
|
+
`scopes` text NOT NULL,
|
|
6
|
+
`spend_limit_usd` real,
|
|
7
|
+
`created_at` integer NOT NULL,
|
|
8
|
+
`last_used_at` integer,
|
|
9
|
+
`expires_at` integer,
|
|
10
|
+
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
|
|
11
|
+
);
|
|
12
|
+
--> statement-breakpoint
|
|
13
|
+
CREATE INDEX `api_tokens_user` ON `api_tokens` (`user_id`);--> statement-breakpoint
|
|
14
|
+
CREATE TABLE `auth_sessions` (
|
|
15
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
16
|
+
`user_id` text NOT NULL,
|
|
17
|
+
`created_at` integer NOT NULL,
|
|
18
|
+
`last_seen_at` integer NOT NULL,
|
|
19
|
+
`expires_at` integer NOT NULL,
|
|
20
|
+
`user_agent` text,
|
|
21
|
+
`ip` text,
|
|
22
|
+
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
|
|
23
|
+
);
|
|
24
|
+
--> statement-breakpoint
|
|
25
|
+
CREATE INDEX `auth_sessions_user` ON `auth_sessions` (`user_id`);--> statement-breakpoint
|
|
26
|
+
CREATE TABLE `invites` (
|
|
27
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
28
|
+
`role` text NOT NULL,
|
|
29
|
+
`can_use_paid` integer NOT NULL,
|
|
30
|
+
`can_train` integer NOT NULL,
|
|
31
|
+
`monthly_limit_usd` real,
|
|
32
|
+
`expires_at` integer NOT NULL,
|
|
33
|
+
`created_by` text NOT NULL,
|
|
34
|
+
`created_at` integer NOT NULL,
|
|
35
|
+
`used_by` text,
|
|
36
|
+
`used_at` integer,
|
|
37
|
+
FOREIGN KEY (`created_by`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
38
|
+
FOREIGN KEY (`used_by`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE set null
|
|
39
|
+
);
|
|
40
|
+
--> statement-breakpoint
|
|
41
|
+
CREATE TABLE `users` (
|
|
42
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
43
|
+
`username` text NOT NULL,
|
|
44
|
+
`display_name` text NOT NULL,
|
|
45
|
+
`password_hash` text NOT NULL,
|
|
46
|
+
`role` text NOT NULL,
|
|
47
|
+
`can_use_paid` integer NOT NULL,
|
|
48
|
+
`can_train` integer NOT NULL,
|
|
49
|
+
`monthly_limit_usd` real,
|
|
50
|
+
`totp_secret` text,
|
|
51
|
+
`must_change_password` integer DEFAULT false NOT NULL,
|
|
52
|
+
`disabled_at` integer,
|
|
53
|
+
`created_at` integer NOT NULL
|
|
54
|
+
);
|
|
55
|
+
--> statement-breakpoint
|
|
56
|
+
CREATE UNIQUE INDEX `users_username` ON `users` (lower("username"));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
CREATE TABLE `spending` (
|
|
2
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
3
|
+
`user_id` text NOT NULL,
|
|
4
|
+
`kind` text NOT NULL,
|
|
5
|
+
`job_id` text,
|
|
6
|
+
`cost_usd` real NOT NULL,
|
|
7
|
+
`created_at` integer NOT NULL
|
|
8
|
+
);
|
|
9
|
+
--> statement-breakpoint
|
|
10
|
+
CREATE INDEX `spending_user_created` ON `spending` (`user_id`,`created_at`);--> statement-breakpoint
|
|
11
|
+
-- What jobs already cost, so a limit counts the month from its start.
|
|
12
|
+
INSERT INTO `spending` (`id`, `user_id`, `kind`, `job_id`, `cost_usd`, `created_at`)
|
|
13
|
+
SELECT 'spd_' || `id`, `user_id`, 'generation', `id`, `cost_usd`, coalesce(`finished_at`, `created_at`)
|
|
14
|
+
FROM `jobs` WHERE `cost_usd` IS NOT NULL AND `cost_usd` > 0;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
CREATE TABLE `password_resets` (
|
|
2
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
3
|
+
`user_id` text NOT NULL,
|
|
4
|
+
`created_by` text NOT NULL,
|
|
5
|
+
`created_at` integer NOT NULL,
|
|
6
|
+
`expires_at` integer NOT NULL,
|
|
7
|
+
`used_at` integer,
|
|
8
|
+
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
9
|
+
FOREIGN KEY (`created_by`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
|
|
10
|
+
);
|
|
11
|
+
--> statement-breakpoint
|
|
12
|
+
ALTER TABLE `users` ADD `totp_last_counter` integer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE `password_resets` ADD `noticed_at` integer;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE `spending` ADD `key_source` text DEFAULT 'server' NOT NULL;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
CREATE TABLE `asset_usage` (
|
|
2
|
+
`user_id` text PRIMARY KEY NOT NULL,
|
|
3
|
+
`bytes` integer NOT NULL
|
|
4
|
+
);
|
|
5
|
+
--> statement-breakpoint
|
|
6
|
+
-- What is stored already: each file once per person, as on disk.
|
|
7
|
+
INSERT INTO `asset_usage` (`user_id`, `bytes`)
|
|
8
|
+
SELECT `user_id`, sum(`size`) FROM (SELECT DISTINCT `user_id`, `hash`, `size` FROM `assets`) GROUP BY `user_id`;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
ALTER TABLE `api_tokens` ADD `ref` text;--> statement-breakpoint
|
|
2
|
+
-- Tokens from before had no scopes, and could do nothing once scopes are
|
|
3
|
+
-- enforced; none were handed out by the app. They go.
|
|
4
|
+
DELETE FROM `api_tokens`;--> statement-breakpoint
|
|
5
|
+
CREATE UNIQUE INDEX `api_tokens_ref` ON `api_tokens` (`ref`);--> statement-breakpoint
|
|
6
|
+
ALTER TABLE `jobs` ADD `token_id` text;--> statement-breakpoint
|
|
7
|
+
ALTER TABLE `spending` ADD `token_id` text;--> statement-breakpoint
|
|
8
|
+
CREATE INDEX `spending_token` ON `spending` (`token_id`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE `spending` ADD `pending` integer DEFAULT false NOT NULL;
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "6",
|
|
3
|
+
"dialect": "sqlite",
|
|
4
|
+
"id": "85091752-d424-417b-a2f3-9f7cdd57998c",
|
|
5
|
+
"prevId": "00000000-0000-0000-0000-000000000000",
|
|
6
|
+
"tables": {
|
|
7
|
+
"assets": {
|
|
8
|
+
"name": "assets",
|
|
9
|
+
"columns": {
|
|
10
|
+
"id": {
|
|
11
|
+
"name": "id",
|
|
12
|
+
"type": "text",
|
|
13
|
+
"primaryKey": true,
|
|
14
|
+
"notNull": true,
|
|
15
|
+
"autoincrement": false
|
|
16
|
+
},
|
|
17
|
+
"user_id": {
|
|
18
|
+
"name": "user_id",
|
|
19
|
+
"type": "text",
|
|
20
|
+
"primaryKey": false,
|
|
21
|
+
"notNull": true,
|
|
22
|
+
"autoincrement": false
|
|
23
|
+
},
|
|
24
|
+
"job_id": {
|
|
25
|
+
"name": "job_id",
|
|
26
|
+
"type": "text",
|
|
27
|
+
"primaryKey": false,
|
|
28
|
+
"notNull": false,
|
|
29
|
+
"autoincrement": false
|
|
30
|
+
},
|
|
31
|
+
"kind": {
|
|
32
|
+
"name": "kind",
|
|
33
|
+
"type": "text",
|
|
34
|
+
"primaryKey": false,
|
|
35
|
+
"notNull": true,
|
|
36
|
+
"autoincrement": false
|
|
37
|
+
},
|
|
38
|
+
"hash": {
|
|
39
|
+
"name": "hash",
|
|
40
|
+
"type": "text",
|
|
41
|
+
"primaryKey": false,
|
|
42
|
+
"notNull": true,
|
|
43
|
+
"autoincrement": false
|
|
44
|
+
},
|
|
45
|
+
"mime": {
|
|
46
|
+
"name": "mime",
|
|
47
|
+
"type": "text",
|
|
48
|
+
"primaryKey": false,
|
|
49
|
+
"notNull": true,
|
|
50
|
+
"autoincrement": false
|
|
51
|
+
},
|
|
52
|
+
"size": {
|
|
53
|
+
"name": "size",
|
|
54
|
+
"type": "integer",
|
|
55
|
+
"primaryKey": false,
|
|
56
|
+
"notNull": true,
|
|
57
|
+
"autoincrement": false
|
|
58
|
+
},
|
|
59
|
+
"prompt": {
|
|
60
|
+
"name": "prompt",
|
|
61
|
+
"type": "text",
|
|
62
|
+
"primaryKey": false,
|
|
63
|
+
"notNull": false,
|
|
64
|
+
"autoincrement": false
|
|
65
|
+
},
|
|
66
|
+
"model_id": {
|
|
67
|
+
"name": "model_id",
|
|
68
|
+
"type": "text",
|
|
69
|
+
"primaryKey": false,
|
|
70
|
+
"notNull": false,
|
|
71
|
+
"autoincrement": false
|
|
72
|
+
},
|
|
73
|
+
"params": {
|
|
74
|
+
"name": "params",
|
|
75
|
+
"type": "text",
|
|
76
|
+
"primaryKey": false,
|
|
77
|
+
"notNull": false,
|
|
78
|
+
"autoincrement": false
|
|
79
|
+
},
|
|
80
|
+
"created_at": {
|
|
81
|
+
"name": "created_at",
|
|
82
|
+
"type": "integer",
|
|
83
|
+
"primaryKey": false,
|
|
84
|
+
"notNull": true,
|
|
85
|
+
"autoincrement": false
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
"indexes": {
|
|
89
|
+
"assets_user_kind_created": {
|
|
90
|
+
"name": "assets_user_kind_created",
|
|
91
|
+
"columns": ["user_id", "kind", "created_at"],
|
|
92
|
+
"isUnique": false
|
|
93
|
+
},
|
|
94
|
+
"assets_job": {
|
|
95
|
+
"name": "assets_job",
|
|
96
|
+
"columns": ["job_id"],
|
|
97
|
+
"isUnique": false
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"foreignKeys": {
|
|
101
|
+
"assets_job_id_jobs_id_fk": {
|
|
102
|
+
"name": "assets_job_id_jobs_id_fk",
|
|
103
|
+
"tableFrom": "assets",
|
|
104
|
+
"tableTo": "jobs",
|
|
105
|
+
"columnsFrom": ["job_id"],
|
|
106
|
+
"columnsTo": ["id"],
|
|
107
|
+
"onDelete": "set null",
|
|
108
|
+
"onUpdate": "no action"
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"compositePrimaryKeys": {},
|
|
112
|
+
"uniqueConstraints": {},
|
|
113
|
+
"checkConstraints": {}
|
|
114
|
+
},
|
|
115
|
+
"jobs": {
|
|
116
|
+
"name": "jobs",
|
|
117
|
+
"columns": {
|
|
118
|
+
"id": {
|
|
119
|
+
"name": "id",
|
|
120
|
+
"type": "text",
|
|
121
|
+
"primaryKey": true,
|
|
122
|
+
"notNull": true,
|
|
123
|
+
"autoincrement": false
|
|
124
|
+
},
|
|
125
|
+
"turn_id": {
|
|
126
|
+
"name": "turn_id",
|
|
127
|
+
"type": "text",
|
|
128
|
+
"primaryKey": false,
|
|
129
|
+
"notNull": true,
|
|
130
|
+
"autoincrement": false
|
|
131
|
+
},
|
|
132
|
+
"position": {
|
|
133
|
+
"name": "position",
|
|
134
|
+
"type": "integer",
|
|
135
|
+
"primaryKey": false,
|
|
136
|
+
"notNull": true,
|
|
137
|
+
"autoincrement": false
|
|
138
|
+
},
|
|
139
|
+
"user_id": {
|
|
140
|
+
"name": "user_id",
|
|
141
|
+
"type": "text",
|
|
142
|
+
"primaryKey": false,
|
|
143
|
+
"notNull": true,
|
|
144
|
+
"autoincrement": false
|
|
145
|
+
},
|
|
146
|
+
"provider_id": {
|
|
147
|
+
"name": "provider_id",
|
|
148
|
+
"type": "text",
|
|
149
|
+
"primaryKey": false,
|
|
150
|
+
"notNull": true,
|
|
151
|
+
"autoincrement": false
|
|
152
|
+
},
|
|
153
|
+
"model_id": {
|
|
154
|
+
"name": "model_id",
|
|
155
|
+
"type": "text",
|
|
156
|
+
"primaryKey": false,
|
|
157
|
+
"notNull": true,
|
|
158
|
+
"autoincrement": false
|
|
159
|
+
},
|
|
160
|
+
"params": {
|
|
161
|
+
"name": "params",
|
|
162
|
+
"type": "text",
|
|
163
|
+
"primaryKey": false,
|
|
164
|
+
"notNull": true,
|
|
165
|
+
"autoincrement": false
|
|
166
|
+
},
|
|
167
|
+
"status": {
|
|
168
|
+
"name": "status",
|
|
169
|
+
"type": "text",
|
|
170
|
+
"primaryKey": false,
|
|
171
|
+
"notNull": true,
|
|
172
|
+
"autoincrement": false
|
|
173
|
+
},
|
|
174
|
+
"handle": {
|
|
175
|
+
"name": "handle",
|
|
176
|
+
"type": "text",
|
|
177
|
+
"primaryKey": false,
|
|
178
|
+
"notNull": false,
|
|
179
|
+
"autoincrement": false
|
|
180
|
+
},
|
|
181
|
+
"error": {
|
|
182
|
+
"name": "error",
|
|
183
|
+
"type": "text",
|
|
184
|
+
"primaryKey": false,
|
|
185
|
+
"notNull": false,
|
|
186
|
+
"autoincrement": false
|
|
187
|
+
},
|
|
188
|
+
"cost_usd": {
|
|
189
|
+
"name": "cost_usd",
|
|
190
|
+
"type": "real",
|
|
191
|
+
"primaryKey": false,
|
|
192
|
+
"notNull": false,
|
|
193
|
+
"autoincrement": false
|
|
194
|
+
},
|
|
195
|
+
"created_at": {
|
|
196
|
+
"name": "created_at",
|
|
197
|
+
"type": "integer",
|
|
198
|
+
"primaryKey": false,
|
|
199
|
+
"notNull": true,
|
|
200
|
+
"autoincrement": false
|
|
201
|
+
},
|
|
202
|
+
"started_at": {
|
|
203
|
+
"name": "started_at",
|
|
204
|
+
"type": "integer",
|
|
205
|
+
"primaryKey": false,
|
|
206
|
+
"notNull": false,
|
|
207
|
+
"autoincrement": false
|
|
208
|
+
},
|
|
209
|
+
"finished_at": {
|
|
210
|
+
"name": "finished_at",
|
|
211
|
+
"type": "integer",
|
|
212
|
+
"primaryKey": false,
|
|
213
|
+
"notNull": false,
|
|
214
|
+
"autoincrement": false
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
"indexes": {
|
|
218
|
+
"jobs_turn": {
|
|
219
|
+
"name": "jobs_turn",
|
|
220
|
+
"columns": ["turn_id"],
|
|
221
|
+
"isUnique": false
|
|
222
|
+
},
|
|
223
|
+
"jobs_status": {
|
|
224
|
+
"name": "jobs_status",
|
|
225
|
+
"columns": ["status"],
|
|
226
|
+
"isUnique": false
|
|
227
|
+
}
|
|
228
|
+
},
|
|
229
|
+
"foreignKeys": {
|
|
230
|
+
"jobs_turn_id_turns_id_fk": {
|
|
231
|
+
"name": "jobs_turn_id_turns_id_fk",
|
|
232
|
+
"tableFrom": "jobs",
|
|
233
|
+
"tableTo": "turns",
|
|
234
|
+
"columnsFrom": ["turn_id"],
|
|
235
|
+
"columnsTo": ["id"],
|
|
236
|
+
"onDelete": "cascade",
|
|
237
|
+
"onUpdate": "no action"
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
"compositePrimaryKeys": {},
|
|
241
|
+
"uniqueConstraints": {},
|
|
242
|
+
"checkConstraints": {}
|
|
243
|
+
},
|
|
244
|
+
"sessions": {
|
|
245
|
+
"name": "sessions",
|
|
246
|
+
"columns": {
|
|
247
|
+
"id": {
|
|
248
|
+
"name": "id",
|
|
249
|
+
"type": "text",
|
|
250
|
+
"primaryKey": true,
|
|
251
|
+
"notNull": true,
|
|
252
|
+
"autoincrement": false
|
|
253
|
+
},
|
|
254
|
+
"user_id": {
|
|
255
|
+
"name": "user_id",
|
|
256
|
+
"type": "text",
|
|
257
|
+
"primaryKey": false,
|
|
258
|
+
"notNull": true,
|
|
259
|
+
"autoincrement": false
|
|
260
|
+
},
|
|
261
|
+
"title": {
|
|
262
|
+
"name": "title",
|
|
263
|
+
"type": "text",
|
|
264
|
+
"primaryKey": false,
|
|
265
|
+
"notNull": true,
|
|
266
|
+
"autoincrement": false
|
|
267
|
+
},
|
|
268
|
+
"created_at": {
|
|
269
|
+
"name": "created_at",
|
|
270
|
+
"type": "integer",
|
|
271
|
+
"primaryKey": false,
|
|
272
|
+
"notNull": true,
|
|
273
|
+
"autoincrement": false
|
|
274
|
+
},
|
|
275
|
+
"updated_at": {
|
|
276
|
+
"name": "updated_at",
|
|
277
|
+
"type": "integer",
|
|
278
|
+
"primaryKey": false,
|
|
279
|
+
"notNull": true,
|
|
280
|
+
"autoincrement": false
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
"indexes": {
|
|
284
|
+
"sessions_user_updated": {
|
|
285
|
+
"name": "sessions_user_updated",
|
|
286
|
+
"columns": ["user_id", "updated_at"],
|
|
287
|
+
"isUnique": false
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
"foreignKeys": {},
|
|
291
|
+
"compositePrimaryKeys": {},
|
|
292
|
+
"uniqueConstraints": {},
|
|
293
|
+
"checkConstraints": {}
|
|
294
|
+
},
|
|
295
|
+
"turns": {
|
|
296
|
+
"name": "turns",
|
|
297
|
+
"columns": {
|
|
298
|
+
"id": {
|
|
299
|
+
"name": "id",
|
|
300
|
+
"type": "text",
|
|
301
|
+
"primaryKey": true,
|
|
302
|
+
"notNull": true,
|
|
303
|
+
"autoincrement": false
|
|
304
|
+
},
|
|
305
|
+
"session_id": {
|
|
306
|
+
"name": "session_id",
|
|
307
|
+
"type": "text",
|
|
308
|
+
"primaryKey": false,
|
|
309
|
+
"notNull": true,
|
|
310
|
+
"autoincrement": false
|
|
311
|
+
},
|
|
312
|
+
"user_id": {
|
|
313
|
+
"name": "user_id",
|
|
314
|
+
"type": "text",
|
|
315
|
+
"primaryKey": false,
|
|
316
|
+
"notNull": true,
|
|
317
|
+
"autoincrement": false
|
|
318
|
+
},
|
|
319
|
+
"prompt": {
|
|
320
|
+
"name": "prompt",
|
|
321
|
+
"type": "text",
|
|
322
|
+
"primaryKey": false,
|
|
323
|
+
"notNull": true,
|
|
324
|
+
"autoincrement": false
|
|
325
|
+
},
|
|
326
|
+
"reference_asset_ids": {
|
|
327
|
+
"name": "reference_asset_ids",
|
|
328
|
+
"type": "text",
|
|
329
|
+
"primaryKey": false,
|
|
330
|
+
"notNull": true,
|
|
331
|
+
"autoincrement": false
|
|
332
|
+
},
|
|
333
|
+
"created_at": {
|
|
334
|
+
"name": "created_at",
|
|
335
|
+
"type": "integer",
|
|
336
|
+
"primaryKey": false,
|
|
337
|
+
"notNull": true,
|
|
338
|
+
"autoincrement": false
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
"indexes": {
|
|
342
|
+
"turns_session_created": {
|
|
343
|
+
"name": "turns_session_created",
|
|
344
|
+
"columns": ["session_id", "created_at"],
|
|
345
|
+
"isUnique": false
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
"foreignKeys": {
|
|
349
|
+
"turns_session_id_sessions_id_fk": {
|
|
350
|
+
"name": "turns_session_id_sessions_id_fk",
|
|
351
|
+
"tableFrom": "turns",
|
|
352
|
+
"tableTo": "sessions",
|
|
353
|
+
"columnsFrom": ["session_id"],
|
|
354
|
+
"columnsTo": ["id"],
|
|
355
|
+
"onDelete": "cascade",
|
|
356
|
+
"onUpdate": "no action"
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
"compositePrimaryKeys": {},
|
|
360
|
+
"uniqueConstraints": {},
|
|
361
|
+
"checkConstraints": {}
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
"views": {},
|
|
365
|
+
"enums": {},
|
|
366
|
+
"_meta": {
|
|
367
|
+
"schemas": {},
|
|
368
|
+
"tables": {},
|
|
369
|
+
"columns": {}
|
|
370
|
+
},
|
|
371
|
+
"internal": {
|
|
372
|
+
"indexes": {}
|
|
373
|
+
}
|
|
374
|
+
}
|