@maxceem/agw 0.1.5 → 0.1.7

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.
@@ -1,22 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
2
- <!-- The App AI Gateway shield, matching the marketing site's mark. Its ink is
3
- 82x100, so at scale 0.32 it stands 32 tall and 26.24 wide: flush to the
4
- top and bottom of the icon, with 2.88 either side. That side gap is what
5
- an 0.82 aspect costs in a square, and is the price of the mark being the
6
- same shape here as in the wordmark. Keep this path in step with the
7
- shield in the brand-mark component. -->
8
- <g transform="translate(2.88 0) scale(0.32)">
9
- <path fill="#2376e4" d="M41 0 L82 12 L82 52 C82 71 69.7 90.3 41 100 C12.3 90.3 0 71 0 52 L0 12 Z" />
10
- </g>
11
- <text
12
- x="16"
13
- y="14.08"
14
- fill="#ffffff"
15
- font-family="ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif"
16
- font-size="14.72"
17
- font-weight="700"
18
- letter-spacing="0.2"
19
- text-anchor="middle"
20
- dominant-baseline="central"
21
- >AI</text>
22
- </svg>
@@ -1,34 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <meta name="color-scheme" content="dark light" />
7
- <meta name="robots" content="noindex, nofollow" />
8
- <link rel="icon" href="/favicon.svg" type="image/svg+xml" />
9
- <title>App AI Gateway Console</title>
10
- <script>
11
- // next-themes only injects this itself under SSR. In a client-only SPA the
12
- // provider mounts after first paint, so without it a light-mode visitor
13
- // flashes dark. Reads the same localStorage key next-themes writes.
14
- (function () {
15
- try {
16
- var stored = localStorage.getItem("theme");
17
- var dark =
18
- stored === "dark" ||
19
- ((!stored || stored === "system") &&
20
- window.matchMedia("(prefers-color-scheme: dark)").matches);
21
- document.documentElement.classList.toggle("dark", dark);
22
- document.documentElement.style.colorScheme = dark ? "dark" : "light";
23
- } catch (error) {
24
- /* private mode or blocked storage: fall through to the light default */
25
- }
26
- })();
27
- </script>
28
- <script type="module" crossorigin src="/assets/index-J1eP6WzX.js"></script>
29
- <link rel="stylesheet" crossorigin href="/assets/index-DUtKG6Od.css">
30
- </head>
31
- <body>
32
- <div id="root"></div>
33
- </body>
34
- </html>
@@ -1,27 +0,0 @@
1
- {
2
- "format": 1,
3
- "version": "0.1.5",
4
- "node": "22.19.0",
5
- "wrangler": "4.96.0",
6
- "schema": 1,
7
- "upgradeFrom": [
8
- "0.1.5",
9
- "0.1.4",
10
- "0.1.3",
11
- "0.1.2",
12
- "0.1.1",
13
- "0.1.0"
14
- ],
15
- "files": {
16
- "console/.assetsignore": "745dcbec514c9094082e34261eb028daf5cf0b22006ec22a6be0d8b81f6344e6",
17
- "console/assets/endpoints-DApt6mPC.js": "bebe8610080e6f8feaf56eb74df289fb0c86500424efd4c2c579e5f7fb208db8",
18
- "console/assets/index-DUtKG6Od.css": "ad7b3312c9ea95379e059d7f807841fa8b590cdfaccd5d2dd779553edcff2723",
19
- "console/assets/index-J1eP6WzX.js": "b5953ae17ddf391a751453ba868f25d8338b18bf6ba867649c66429b211db923",
20
- "console/assets/usage-D26T_dIp.js": "d76d0a2639af997a89cc660e3e57b321b314fd250d34531aa8fc73348caef6a0",
21
- "console/favicon.svg": "1b09ded3524d89d532d88c8b9f2571354be0a53fed4f11d4ec1239aade5964e4",
22
- "console/index.html": "1f0786221d27898cb0cc09650dd59ee8f2a0dbde6c538aaa97f6e5b9f6ac7ab2",
23
- "migrations/0000_initial.sql": "e9268b25ce3b20ae011150695c297f2dcf9ef6be3e950519557751bec5602a34",
24
- "worker/index.js": "3e86787b9ff71133b1f758a93b62d631a6580934a33422d2d2ba3be4f1161d68",
25
- "wrangler.json": "dfc41b2931dabe393091d2330855a48e46d26762232d62c6eb3b3cfe6c017d8e"
26
- }
27
- }
@@ -1,314 +0,0 @@
1
- CREATE TABLE `app` (
2
- `id` text PRIMARY KEY NOT NULL,
3
- `organization_id` text NOT NULL,
4
- `name` text NOT NULL,
5
- `config_json` text NOT NULL,
6
- `revision` integer DEFAULT 1 NOT NULL,
7
- `status` text DEFAULT 'active' NOT NULL,
8
- `created_at` text DEFAULT (datetime('now')) NOT NULL,
9
- `updated_at` text DEFAULT (datetime('now')) NOT NULL,
10
- FOREIGN KEY (`organization_id`) REFERENCES `mgmt_organization`(`id`) ON UPDATE no action ON DELETE no action,
11
- CONSTRAINT "apps_status_check" CHECK("app"."status" IN ('active', 'disabled'))
12
- );
13
- --> statement-breakpoint
14
- CREATE INDEX `idx_apps_organization_id` ON `app` (`organization_id`);--> statement-breakpoint
15
- CREATE TABLE `app_api_key` (
16
- `id` text PRIMARY KEY NOT NULL,
17
- `app_id` text NOT NULL,
18
- `name` text NOT NULL,
19
- `key_hash` text NOT NULL,
20
- `key_prefix` text NOT NULL,
21
- `status` text DEFAULT 'active' NOT NULL,
22
- `created_at` text DEFAULT (datetime('now')) NOT NULL,
23
- `last_used_at` text,
24
- FOREIGN KEY (`app_id`) REFERENCES `app`(`id`) ON UPDATE no action ON DELETE no action,
25
- CONSTRAINT "api_keys_status_check" CHECK("app_api_key"."status" IN ('active', 'revoked'))
26
- );
27
- --> statement-breakpoint
28
- CREATE INDEX `idx_api_keys_app` ON `app_api_key` (`app_id`);--> statement-breakpoint
29
- CREATE UNIQUE INDEX `api_keys_key_hash_unique` ON `app_api_key` (`key_hash`);--> statement-breakpoint
30
- CREATE TABLE `app_auth_challenge` (
31
- `challenge` text PRIMARY KEY NOT NULL,
32
- `app_id` text NOT NULL,
33
- `expires_at` text NOT NULL,
34
- FOREIGN KEY (`app_id`) REFERENCES `app`(`id`) ON UPDATE no action ON DELETE no action
35
- );
36
- --> statement-breakpoint
37
- CREATE INDEX `idx_auth_challenges_expiry` ON `app_auth_challenge` (`expires_at`);--> statement-breakpoint
38
- CREATE TABLE `app_auth_event` (
39
- `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
40
- `event_id` text,
41
- `app_id` text NOT NULL,
42
- `user_id` text,
43
- `event` text NOT NULL,
44
- `auth_method` text,
45
- `outcome` text NOT NULL,
46
- `reason` text,
47
- `app_version` text,
48
- `latency_ms` integer,
49
- `claim_delay_ms` integer,
50
- `created_at` text DEFAULT (datetime('now')) NOT NULL
51
- );
52
- --> statement-breakpoint
53
- CREATE INDEX `idx_auth_events_app_created` ON `app_auth_event` (`app_id`,`created_at`);--> statement-breakpoint
54
- CREATE INDEX `idx_auth_events_app_user_created` ON `app_auth_event` (`app_id`,`user_id`,`created_at`);--> statement-breakpoint
55
- CREATE UNIQUE INDEX `auth_events_event_id_unique` ON `app_auth_event` (`event_id`);--> statement-breakpoint
56
- CREATE TABLE `app_usage_event` (
57
- `id` integer PRIMARY KEY NOT NULL,
58
- `event_id` text,
59
- `app_id` text NOT NULL,
60
- `organization_id` text DEFAULT '' NOT NULL,
61
- `user_id` text,
62
- `api_key_id` text,
63
- `provider_type` text NOT NULL,
64
- `provider_id` text,
65
- `provider_slug` text,
66
- `provider_gateway_id` text,
67
- `provider_gateway_type` text,
68
- `model` text NOT NULL,
69
- `route` text NOT NULL,
70
- `endpoint_slug` text,
71
- `input_tokens` integer DEFAULT 0 NOT NULL,
72
- `cached_input_tokens` integer DEFAULT 0 NOT NULL,
73
- `cache_write_tokens` integer DEFAULT 0 NOT NULL,
74
- `output_tokens` integer DEFAULT 0 NOT NULL,
75
- `cost_usd` real DEFAULT 0 NOT NULL,
76
- `cost_source` text,
77
- `reported_cost_usd` real,
78
- `served_provider` text,
79
- `served_model` text,
80
- `credential_source` text,
81
- `model_author` text,
82
- `app_version` text,
83
- `auth_method` text,
84
- `status` text NOT NULL,
85
- `client_aborted` integer,
86
- `latency_ms` integer,
87
- `created_at` text DEFAULT (datetime('now')) NOT NULL,
88
- CONSTRAINT "usage_events_status_check" CHECK("app_usage_event"."status" IN ('ok', 'provider_error', 'blocked_app_rate', 'blocked_app_budget', 'blocked_billing', 'blocked_user'))
89
- );
90
- --> statement-breakpoint
91
- CREATE INDEX `idx_usage_event_account_created` ON `app_usage_event` (`organization_id`,`created_at`);--> statement-breakpoint
92
- CREATE INDEX `idx_usage_user_month` ON `app_usage_event` (`app_id`,`user_id`,`created_at`);--> statement-breakpoint
93
- CREATE INDEX `idx_usage_app_month` ON `app_usage_event` (`app_id`,`created_at`);--> statement-breakpoint
94
- CREATE UNIQUE INDEX `usage_events_event_id_unique` ON `app_usage_event` (`event_id`);--> statement-breakpoint
95
- CREATE TABLE `app_usage_rollup` (
96
- `id` integer PRIMARY KEY NOT NULL,
97
- `grain` text NOT NULL,
98
- `bucket` text NOT NULL,
99
- `app_id` text NOT NULL,
100
- `organization_id` text DEFAULT '' NOT NULL,
101
- `model` text NOT NULL,
102
- `provider_type` text NOT NULL,
103
- `status` text NOT NULL,
104
- `requests` integer NOT NULL,
105
- `input_tokens` integer NOT NULL,
106
- `cached_input_tokens` integer NOT NULL,
107
- `cache_write_tokens` integer NOT NULL,
108
- `output_tokens` integer NOT NULL,
109
- `cost_usd` real NOT NULL
110
- );
111
- --> statement-breakpoint
112
- CREATE UNIQUE INDEX `usage_rollup_key` ON `app_usage_rollup` (`organization_id`,`grain`,`bucket`,`app_id`,`model`,`provider_type`,`status`);--> statement-breakpoint
113
- CREATE INDEX `idx_usage_rollup_account_bucket` ON `app_usage_rollup` (`organization_id`,`grain`,`bucket`);--> statement-breakpoint
114
- CREATE INDEX `idx_usage_rollup_app_bucket` ON `app_usage_rollup` (`app_id`,`grain`,`bucket`);--> statement-breakpoint
115
- CREATE TABLE `app_user` (
116
- `app_id` text NOT NULL,
117
- `id` text NOT NULL,
118
- `attest_key_id` text,
119
- `attest_public_key` text,
120
- `attest_counter` integer DEFAULT 0 NOT NULL,
121
- `attest_env` text,
122
- `status` text DEFAULT 'active' NOT NULL,
123
- `created_at` text DEFAULT (datetime('now')) NOT NULL,
124
- `last_seen_at` text,
125
- `claim_pending_since` text,
126
- PRIMARY KEY(`app_id`, `id`),
127
- FOREIGN KEY (`app_id`) REFERENCES `app`(`id`) ON UPDATE no action ON DELETE no action,
128
- CONSTRAINT "users_status_check" CHECK("app_user"."status" IN ('active', 'blocked'))
129
- );
130
- --> statement-breakpoint
131
- CREATE TABLE `mgmt_user_account` (
132
- `id` text PRIMARY KEY NOT NULL,
133
- `account_id` text NOT NULL,
134
- `provider_id` text NOT NULL,
135
- `user_id` text NOT NULL,
136
- `access_token` text,
137
- `refresh_token` text,
138
- `id_token` text,
139
- `access_token_expires_at` integer,
140
- `refresh_token_expires_at` integer,
141
- `scope` text,
142
- `password` text,
143
- `created_at` integer NOT NULL,
144
- `updated_at` integer NOT NULL,
145
- FOREIGN KEY (`user_id`) REFERENCES `mgmt_user`(`id`) ON UPDATE no action ON DELETE cascade
146
- );
147
- --> statement-breakpoint
148
- CREATE INDEX `mgmt_idx_account_user_id` ON `mgmt_user_account` (`user_id`);--> statement-breakpoint
149
- CREATE UNIQUE INDEX `mgmt_idx_account_provider_account` ON `mgmt_user_account` (`provider_id`,`account_id`);--> statement-breakpoint
150
- CREATE TABLE `mgmt_api_key` (
151
- `id` text PRIMARY KEY NOT NULL,
152
- `user_id` text NOT NULL,
153
- `organization_id` text NOT NULL,
154
- `name` text NOT NULL,
155
- `token_hash` text NOT NULL,
156
- `token_hint` text NOT NULL,
157
- `enabled` integer DEFAULT true NOT NULL,
158
- `expires_at` integer,
159
- `created_at` integer NOT NULL,
160
- `revoked_at` integer,
161
- FOREIGN KEY (`user_id`) REFERENCES `mgmt_user`(`id`) ON UPDATE no action ON DELETE cascade,
162
- FOREIGN KEY (`organization_id`) REFERENCES `mgmt_organization`(`id`) ON UPDATE no action ON DELETE cascade
163
- );
164
- --> statement-breakpoint
165
- CREATE UNIQUE INDEX `mgmt_api_key_token_hash_unique` ON `mgmt_api_key` (`token_hash`);--> statement-breakpoint
166
- CREATE INDEX `mgmt_idx_api_key_user_id` ON `mgmt_api_key` (`user_id`);--> statement-breakpoint
167
- CREATE INDEX `mgmt_idx_api_key_organization_id` ON `mgmt_api_key` (`organization_id`);--> statement-breakpoint
168
- CREATE TABLE `mgmt_handoff` (
169
- `id` text PRIMARY KEY NOT NULL,
170
- `kind` text NOT NULL,
171
- `request_json` text NOT NULL,
172
- `organization_id` text NOT NULL,
173
- `initiating_user_id` text NOT NULL,
174
- `initiating_credential_id` text NOT NULL,
175
- `submission_proof_hash` text NOT NULL,
176
- `poll_proof_hash` text NOT NULL,
177
- `consumed_at` integer,
178
- `outcome` text,
179
- `expires_at` integer NOT NULL,
180
- `created_at` integer NOT NULL,
181
- `updated_at` integer NOT NULL,
182
- FOREIGN KEY (`organization_id`) REFERENCES `mgmt_organization`(`id`) ON UPDATE no action ON DELETE cascade
183
- );
184
- --> statement-breakpoint
185
- CREATE INDEX `idx_mgmt_handoff_pending` ON `mgmt_handoff` (`organization_id`,`expires_at`);--> statement-breakpoint
186
- CREATE TABLE `mgmt_organization` (
187
- `id` text PRIMARY KEY NOT NULL,
188
- `name` text NOT NULL,
189
- `expires_at` text,
190
- `created_by_user_id` text NOT NULL,
191
- `created_at` text NOT NULL,
192
- `updated_at` text NOT NULL,
193
- FOREIGN KEY (`created_by_user_id`) REFERENCES `mgmt_user`(`id`) ON UPDATE no action ON DELETE no action
194
- );
195
- --> statement-breakpoint
196
- CREATE TABLE `mgmt_organization_user` (
197
- `id` text PRIMARY KEY NOT NULL,
198
- `organization_id` text NOT NULL,
199
- `user_id` text NOT NULL,
200
- `role` text NOT NULL,
201
- `status` text NOT NULL,
202
- `joined_at` text NOT NULL,
203
- FOREIGN KEY (`organization_id`) REFERENCES `mgmt_organization`(`id`) ON UPDATE no action ON DELETE cascade,
204
- FOREIGN KEY (`user_id`) REFERENCES `mgmt_user`(`id`) ON UPDATE no action ON DELETE cascade,
205
- CONSTRAINT "mgmt_organization_user_role_check" CHECK("mgmt_organization_user"."role" in ('owner', 'admin', 'member')),
206
- CONSTRAINT "mgmt_organization_user_status_check" CHECK("mgmt_organization_user"."status" in ('active'))
207
- );
208
- --> statement-breakpoint
209
- CREATE UNIQUE INDEX `mgmt_organization_user_organization_id_user_id_unique` ON `mgmt_organization_user` (`organization_id`,`user_id`);--> statement-breakpoint
210
- CREATE INDEX `mgmt_idx_organization_user_user_id` ON `mgmt_organization_user` (`user_id`);--> statement-breakpoint
211
- CREATE INDEX `mgmt_idx_organization_user_organization_id` ON `mgmt_organization_user` (`organization_id`);--> statement-breakpoint
212
- CREATE TABLE `mgmt_resource_receipt` (
213
- `id` text PRIMARY KEY NOT NULL,
214
- `kind` text NOT NULL,
215
- `organization_id` text,
216
- `initiating_user_id` text,
217
- `initiating_credential_id` text,
218
- `proof_hash` text NOT NULL,
219
- `request_hash` text NOT NULL,
220
- `outcome` text,
221
- `protected_credential` text,
222
- `protected_credential_expires_at` integer,
223
- `consumed_at` integer,
224
- `expires_at` integer NOT NULL,
225
- `created_at` integer NOT NULL,
226
- `updated_at` integer NOT NULL,
227
- FOREIGN KEY (`organization_id`) REFERENCES `mgmt_organization`(`id`) ON UPDATE no action ON DELETE set null
228
- );
229
- --> statement-breakpoint
230
- CREATE INDEX `idx_mgmt_resource_receipt_organization` ON `mgmt_resource_receipt` (`organization_id`);--> statement-breakpoint
231
- CREATE TABLE `mgmt_user_session` (
232
- `id` text PRIMARY KEY NOT NULL,
233
- `expires_at` integer NOT NULL,
234
- `token` text NOT NULL,
235
- `created_at` integer NOT NULL,
236
- `updated_at` integer NOT NULL,
237
- `ip_address` text,
238
- `user_agent` text,
239
- `user_id` text NOT NULL,
240
- FOREIGN KEY (`user_id`) REFERENCES `mgmt_user`(`id`) ON UPDATE no action ON DELETE cascade
241
- );
242
- --> statement-breakpoint
243
- CREATE UNIQUE INDEX `mgmt_idx_session_token` ON `mgmt_user_session` (`token`);--> statement-breakpoint
244
- CREATE INDEX `mgmt_idx_session_user_id` ON `mgmt_user_session` (`user_id`);--> statement-breakpoint
245
- CREATE TABLE `mgmt_user` (
246
- `id` text PRIMARY KEY NOT NULL,
247
- `name` text NOT NULL,
248
- `email` text,
249
- `kind` text DEFAULT 'human' NOT NULL,
250
- `email_verified` integer DEFAULT false NOT NULL,
251
- `image` text,
252
- `created_at` integer NOT NULL,
253
- `updated_at` integer NOT NULL,
254
- CONSTRAINT "mgmt_user_kind_email_check" CHECK(("mgmt_user"."kind" = 'human' and "mgmt_user"."email" is not null) or ("mgmt_user"."kind" = 'service' and "mgmt_user"."email" is null))
255
- );
256
- --> statement-breakpoint
257
- CREATE UNIQUE INDEX `mgmt_idx_user_email` ON `mgmt_user` ("email" COLLATE NOCASE);--> statement-breakpoint
258
- CREATE TABLE `mgmt_verification` (
259
- `id` text PRIMARY KEY NOT NULL,
260
- `identifier` text NOT NULL,
261
- `value` text NOT NULL,
262
- `expires_at` integer NOT NULL,
263
- `created_at` integer,
264
- `updated_at` integer
265
- );
266
- --> statement-breakpoint
267
- CREATE INDEX `mgmt_idx_verification_identifier` ON `mgmt_verification` (`identifier`);--> statement-breakpoint
268
- CREATE TABLE `provider` (
269
- `id` text PRIMARY KEY NOT NULL,
270
- `organization_id` text NOT NULL,
271
- `type` text NOT NULL,
272
- `slug` text NOT NULL,
273
- `name` text NOT NULL,
274
- `secret_blob` text,
275
- `secret_hint` text,
276
- `provider_gateway_id` text,
277
- `base_url` text,
278
- `gateway_route_json` text,
279
- `pricing_json` text,
280
- `status` text DEFAULT 'active' NOT NULL,
281
- `created_by` text NOT NULL,
282
- `created_at` text DEFAULT (datetime('now')) NOT NULL,
283
- `updated_at` text DEFAULT (datetime('now')) NOT NULL,
284
- FOREIGN KEY (`organization_id`) REFERENCES `mgmt_organization`(`id`) ON UPDATE no action ON DELETE no action,
285
- FOREIGN KEY (`provider_gateway_id`) REFERENCES `provider_gateway`(`id`) ON UPDATE no action ON DELETE no action,
286
- CONSTRAINT "providers_status_check" CHECK("provider"."status" IN ('active', 'disabled')),
287
- CONSTRAINT "providers_type_check" CHECK("provider"."type" IN (
288
- 'openai', 'anthropic', 'xai', 'gemini', 'perplexity',
289
- 'deepseek', 'groq', 'mistral', 'together', 'fireworks', 'openrouter',
290
- 'cerebras', 'moonshot', 'huggingface', 'baseten', 'bytedance'
291
- )),
292
- CONSTRAINT "providers_secret_source_check" CHECK(("provider"."provider_gateway_id" IS NULL) = ("provider"."secret_blob" IS NOT NULL))
293
- );
294
- --> statement-breakpoint
295
- CREATE INDEX `idx_providers_organization` ON `provider` (`organization_id`);--> statement-breakpoint
296
- CREATE UNIQUE INDEX `providers_slug_unique` ON `provider` (`organization_id`,`slug`);--> statement-breakpoint
297
- CREATE TABLE `provider_gateway` (
298
- `id` text PRIMARY KEY NOT NULL,
299
- `organization_id` text NOT NULL,
300
- `type` text NOT NULL,
301
- `name` text NOT NULL,
302
- `config_json` text NOT NULL,
303
- `secret_blob` text NOT NULL,
304
- `secret_hint` text NOT NULL,
305
- `status` text DEFAULT 'active' NOT NULL,
306
- `created_by` text NOT NULL,
307
- `created_at` text DEFAULT (datetime('now')) NOT NULL,
308
- `updated_at` text DEFAULT (datetime('now')) NOT NULL,
309
- FOREIGN KEY (`organization_id`) REFERENCES `mgmt_organization`(`id`) ON UPDATE no action ON DELETE no action,
310
- CONSTRAINT "provider_gateways_type_check" CHECK("provider_gateway"."type" IN ('cf_aig', 'vercel')),
311
- CONSTRAINT "provider_gateways_status_check" CHECK("provider_gateway"."status" IN ('active', 'revoked'))
312
- );
313
- --> statement-breakpoint
314
- CREATE INDEX `idx_provider_gateways_organization` ON `provider_gateway` (`organization_id`);