@llmops/app 0.5.0-beta.1 → 0.5.0-beta.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/dist/index.cjs +51 -3
- package/dist/index.d.cts +11 -9
- package/dist/index.d.mts +11 -9
- package/dist/index.mjs +51 -3
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -17605,6 +17605,10 @@ const createGatewayAdapterMiddleware = () => {
|
|
|
17605
17605
|
message: "Config ID is required",
|
|
17606
17606
|
type: "invalid_request_error"
|
|
17607
17607
|
} }, 400);
|
|
17608
|
+
if (!db || !kyselyDb) return c.json({ error: {
|
|
17609
|
+
message: "Config-based routing requires a database. Either configure a database or use @provider-slug/model format for inline providers.",
|
|
17610
|
+
type: "configuration_error"
|
|
17611
|
+
} }, 503);
|
|
17608
17612
|
try {
|
|
17609
17613
|
const manifest$2 = await getManifestService(kyselyDb).getManifest();
|
|
17610
17614
|
const router = new __llmops_core.ManifestRouter(manifest$2);
|
|
@@ -18367,13 +18371,35 @@ var auth_default = app$2;
|
|
|
18367
18371
|
//#endregion
|
|
18368
18372
|
//#region src/server/handlers/api.ts
|
|
18369
18373
|
const app$1 = new hono.Hono();
|
|
18370
|
-
|
|
18374
|
+
/**
|
|
18375
|
+
* Error response for routes that require database in inline-only mode
|
|
18376
|
+
*/
|
|
18377
|
+
const databaseRequiredError = (c) => {
|
|
18378
|
+
return c.json({ error: {
|
|
18379
|
+
message: "This endpoint requires a database. Configure a database to use dashboard API and auth features.",
|
|
18380
|
+
type: "configuration_error"
|
|
18381
|
+
} }, 503);
|
|
18382
|
+
};
|
|
18383
|
+
const routes = app$1.use("/auth/*", async (c, next) => {
|
|
18384
|
+
if (!c.get("authClient")) return databaseRequiredError(c);
|
|
18385
|
+
await next();
|
|
18386
|
+
}).use("/v1/*", async (c, next) => {
|
|
18387
|
+
if (!c.var.db) return databaseRequiredError(c);
|
|
18388
|
+
await next();
|
|
18389
|
+
}).post("/auth/sign-up/*", async (c, next) => {
|
|
18371
18390
|
if (c.get("setupComplete")) throw new hono_http_exception.HTTPException(403, { message: "Registration is disabled. Only one user is allowed." });
|
|
18372
18391
|
await next();
|
|
18373
18392
|
}).on(["POST", "GET"], "/auth/*", (c) => {
|
|
18374
18393
|
return c.get("authClient").handler(c.req.raw);
|
|
18375
18394
|
}).route("/auth", auth_default).use("*", async (c, next) => {
|
|
18376
|
-
const
|
|
18395
|
+
const authClient = c.get("authClient");
|
|
18396
|
+
if (!authClient) {
|
|
18397
|
+
c.set("user", null);
|
|
18398
|
+
c.set("session", null);
|
|
18399
|
+
await next();
|
|
18400
|
+
return;
|
|
18401
|
+
}
|
|
18402
|
+
const session = await authClient.api.getSession({ headers: c.req.raw.headers });
|
|
18377
18403
|
if (!session) {
|
|
18378
18404
|
c.set("user", null);
|
|
18379
18405
|
c.set("session", null);
|
|
@@ -18391,6 +18417,10 @@ var api_default = app$1;
|
|
|
18391
18417
|
const app = new hono.Hono();
|
|
18392
18418
|
app.get("/health", (c) => c.json({ status: "ok" })).use("*", async (c, next) => {
|
|
18393
18419
|
if (!c.req.path.startsWith("/api")) {
|
|
18420
|
+
if (!c.var.db) return c.json({ error: {
|
|
18421
|
+
message: "Dashboard UI is not available in inline-only mode. Configure a database to enable the dashboard.",
|
|
18422
|
+
type: "configuration_error"
|
|
18423
|
+
} }, 503);
|
|
18394
18424
|
const basePath = c.var.llmopsConfig?.basePath || "";
|
|
18395
18425
|
const authType = "better-auth";
|
|
18396
18426
|
const setupComplete = c.var.setupComplete ?? false;
|
|
@@ -18603,6 +18633,20 @@ const setConfigMiddleware = (config$1) => {
|
|
|
18603
18633
|
await next();
|
|
18604
18634
|
};
|
|
18605
18635
|
};
|
|
18636
|
+
/**
|
|
18637
|
+
* Middleware for inline-only mode (no database configured).
|
|
18638
|
+
* Sets null values for database-related context variables.
|
|
18639
|
+
*/
|
|
18640
|
+
const createInlineOnlyMiddleware = () => {
|
|
18641
|
+
return async (c, next) => {
|
|
18642
|
+
c.set("db", null);
|
|
18643
|
+
c.set("kyselyDb", null);
|
|
18644
|
+
c.set("dbType", null);
|
|
18645
|
+
c.set("authClient", null);
|
|
18646
|
+
c.set("setupComplete", true);
|
|
18647
|
+
await next();
|
|
18648
|
+
};
|
|
18649
|
+
};
|
|
18606
18650
|
const createDatabaseMiddleware = (validatedConfig) => {
|
|
18607
18651
|
return async (c, next) => {
|
|
18608
18652
|
const kyselyDb = await (0, __llmops_core_db.createDatabaseFromConnection)(validatedConfig.database, { schema: validatedConfig.schema });
|
|
@@ -18620,7 +18664,11 @@ const createDatabaseMiddleware = (validatedConfig) => {
|
|
|
18620
18664
|
};
|
|
18621
18665
|
const createApp = (config$1) => {
|
|
18622
18666
|
const validatedConfig = (0, __llmops_core.validateLLMOpsConfig)(config$1);
|
|
18623
|
-
|
|
18667
|
+
const app$17 = new hono.Hono().use("/assets/*", createStaticAssetMiddleware()).use("*", createEnvValidatorMiddleware()).use("*", setConfigMiddleware(validatedConfig));
|
|
18668
|
+
if (validatedConfig.database) app$17.use("*", createMigrationMiddleware(validatedConfig)).use("*", createDatabaseMiddleware(validatedConfig)).use("*", createSeedMiddleware()).use("*", createAuthClientMiddleware());
|
|
18669
|
+
else app$17.use("*", createInlineOnlyMiddleware());
|
|
18670
|
+
app$17.route("/", server_default).basePath(validatedConfig.basePath);
|
|
18671
|
+
return { app: app$17 };
|
|
18624
18672
|
};
|
|
18625
18673
|
var src_default = server_default;
|
|
18626
18674
|
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as hono_types1 from "hono/types";
|
|
2
1
|
import * as hono_hono_base0 from "hono/hono-base";
|
|
2
|
+
import * as hono_types0 from "hono/types";
|
|
3
3
|
import { InlineProvidersConfig, LLMOpsConfig, ValidatedLLMOpsConfig, createDataLayer } from "@llmops/core";
|
|
4
4
|
import { DatabaseType } from "@llmops/core/db";
|
|
5
5
|
import { Auth, BetterAuthOptions } from "better-auth";
|
|
@@ -11,24 +11,26 @@ declare module 'hono' {
|
|
|
11
11
|
llmopsConfig: ValidatedLLMOpsConfig;
|
|
12
12
|
/** Inline provider configurations from code config */
|
|
13
13
|
inlineProviders?: InlineProvidersConfig;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
/** Data layer - null when running in inline-only mode (no database) */
|
|
15
|
+
db: Awaited<ReturnType<typeof createDataLayer>> | null;
|
|
16
|
+
/** Raw Kysely instance with correct schema configuration - null in inline-only mode */
|
|
17
|
+
kyselyDb: any | null;
|
|
18
|
+
/** Database type (postgres, mysql, sqlite, mssql) - null in inline-only mode */
|
|
19
|
+
dbType: DatabaseType | null;
|
|
20
|
+
/** Auth client - null in inline-only mode */
|
|
21
|
+
authClient: Auth<BetterAuthOptions> | null;
|
|
20
22
|
setupComplete: boolean;
|
|
21
23
|
}
|
|
22
24
|
}
|
|
23
25
|
//#endregion
|
|
24
26
|
//#region src/server/index.d.ts
|
|
25
|
-
declare const app: Hono<
|
|
27
|
+
declare const app: Hono<hono_types0.BlankEnv, hono_types0.BlankSchema, "/">;
|
|
26
28
|
//#endregion
|
|
27
29
|
//#region src/index.d.ts
|
|
28
30
|
declare const createApp: (config: LLMOpsConfig) => {
|
|
29
31
|
app: hono_hono_base0.HonoBase<{}, {
|
|
30
32
|
"*": {};
|
|
31
|
-
}
|
|
33
|
+
}, "/">;
|
|
32
34
|
};
|
|
33
35
|
//#endregion
|
|
34
36
|
export { createApp, app as default };
|
package/dist/index.d.mts
CHANGED
|
@@ -2,8 +2,8 @@ import { Hono } from "hono";
|
|
|
2
2
|
import { InlineProvidersConfig, LLMOpsConfig, ValidatedLLMOpsConfig, createDataLayer } from "@llmops/core";
|
|
3
3
|
import { DatabaseType } from "@llmops/core/db";
|
|
4
4
|
import { Auth, BetterAuthOptions } from "better-auth";
|
|
5
|
-
import * as hono_types1 from "hono/types";
|
|
6
5
|
import * as hono_hono_base0 from "hono/hono-base";
|
|
6
|
+
import * as hono_types0 from "hono/types";
|
|
7
7
|
|
|
8
8
|
//#region src/server/types.d.ts
|
|
9
9
|
declare module 'hono' {
|
|
@@ -11,24 +11,26 @@ declare module 'hono' {
|
|
|
11
11
|
llmopsConfig: ValidatedLLMOpsConfig;
|
|
12
12
|
/** Inline provider configurations from code config */
|
|
13
13
|
inlineProviders?: InlineProvidersConfig;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
/** Data layer - null when running in inline-only mode (no database) */
|
|
15
|
+
db: Awaited<ReturnType<typeof createDataLayer>> | null;
|
|
16
|
+
/** Raw Kysely instance with correct schema configuration - null in inline-only mode */
|
|
17
|
+
kyselyDb: any | null;
|
|
18
|
+
/** Database type (postgres, mysql, sqlite, mssql) - null in inline-only mode */
|
|
19
|
+
dbType: DatabaseType | null;
|
|
20
|
+
/** Auth client - null in inline-only mode */
|
|
21
|
+
authClient: Auth<BetterAuthOptions> | null;
|
|
20
22
|
setupComplete: boolean;
|
|
21
23
|
}
|
|
22
24
|
}
|
|
23
25
|
//#endregion
|
|
24
26
|
//#region src/server/index.d.ts
|
|
25
|
-
declare const app: Hono<
|
|
27
|
+
declare const app: Hono<hono_types0.BlankEnv, hono_types0.BlankSchema, "/">;
|
|
26
28
|
//#endregion
|
|
27
29
|
//#region src/index.d.ts
|
|
28
30
|
declare const createApp: (config: LLMOpsConfig) => {
|
|
29
31
|
app: hono_hono_base0.HonoBase<{}, {
|
|
30
32
|
"*": {};
|
|
31
|
-
}
|
|
33
|
+
}, "/">;
|
|
32
34
|
};
|
|
33
35
|
//#endregion
|
|
34
36
|
export { createApp, app as default };
|
package/dist/index.mjs
CHANGED
|
@@ -17576,6 +17576,10 @@ const createGatewayAdapterMiddleware = () => {
|
|
|
17576
17576
|
message: "Config ID is required",
|
|
17577
17577
|
type: "invalid_request_error"
|
|
17578
17578
|
} }, 400);
|
|
17579
|
+
if (!db || !kyselyDb) return c.json({ error: {
|
|
17580
|
+
message: "Config-based routing requires a database. Either configure a database or use @provider-slug/model format for inline providers.",
|
|
17581
|
+
type: "configuration_error"
|
|
17582
|
+
} }, 503);
|
|
17579
17583
|
try {
|
|
17580
17584
|
const manifest$2 = await getManifestService(kyselyDb).getManifest();
|
|
17581
17585
|
const router = new ManifestRouter(manifest$2);
|
|
@@ -18338,13 +18342,35 @@ var auth_default = app$2;
|
|
|
18338
18342
|
//#endregion
|
|
18339
18343
|
//#region src/server/handlers/api.ts
|
|
18340
18344
|
const app$1 = new Hono();
|
|
18341
|
-
|
|
18345
|
+
/**
|
|
18346
|
+
* Error response for routes that require database in inline-only mode
|
|
18347
|
+
*/
|
|
18348
|
+
const databaseRequiredError = (c) => {
|
|
18349
|
+
return c.json({ error: {
|
|
18350
|
+
message: "This endpoint requires a database. Configure a database to use dashboard API and auth features.",
|
|
18351
|
+
type: "configuration_error"
|
|
18352
|
+
} }, 503);
|
|
18353
|
+
};
|
|
18354
|
+
const routes = app$1.use("/auth/*", async (c, next) => {
|
|
18355
|
+
if (!c.get("authClient")) return databaseRequiredError(c);
|
|
18356
|
+
await next();
|
|
18357
|
+
}).use("/v1/*", async (c, next) => {
|
|
18358
|
+
if (!c.var.db) return databaseRequiredError(c);
|
|
18359
|
+
await next();
|
|
18360
|
+
}).post("/auth/sign-up/*", async (c, next) => {
|
|
18342
18361
|
if (c.get("setupComplete")) throw new HTTPException(403, { message: "Registration is disabled. Only one user is allowed." });
|
|
18343
18362
|
await next();
|
|
18344
18363
|
}).on(["POST", "GET"], "/auth/*", (c) => {
|
|
18345
18364
|
return c.get("authClient").handler(c.req.raw);
|
|
18346
18365
|
}).route("/auth", auth_default).use("*", async (c, next) => {
|
|
18347
|
-
const
|
|
18366
|
+
const authClient = c.get("authClient");
|
|
18367
|
+
if (!authClient) {
|
|
18368
|
+
c.set("user", null);
|
|
18369
|
+
c.set("session", null);
|
|
18370
|
+
await next();
|
|
18371
|
+
return;
|
|
18372
|
+
}
|
|
18373
|
+
const session = await authClient.api.getSession({ headers: c.req.raw.headers });
|
|
18348
18374
|
if (!session) {
|
|
18349
18375
|
c.set("user", null);
|
|
18350
18376
|
c.set("session", null);
|
|
@@ -18362,6 +18388,10 @@ var api_default = app$1;
|
|
|
18362
18388
|
const app = new Hono();
|
|
18363
18389
|
app.get("/health", (c) => c.json({ status: "ok" })).use("*", async (c, next) => {
|
|
18364
18390
|
if (!c.req.path.startsWith("/api")) {
|
|
18391
|
+
if (!c.var.db) return c.json({ error: {
|
|
18392
|
+
message: "Dashboard UI is not available in inline-only mode. Configure a database to enable the dashboard.",
|
|
18393
|
+
type: "configuration_error"
|
|
18394
|
+
} }, 503);
|
|
18365
18395
|
const basePath = c.var.llmopsConfig?.basePath || "";
|
|
18366
18396
|
const authType = "better-auth";
|
|
18367
18397
|
const setupComplete = c.var.setupComplete ?? false;
|
|
@@ -18574,6 +18604,20 @@ const setConfigMiddleware = (config$1) => {
|
|
|
18574
18604
|
await next();
|
|
18575
18605
|
};
|
|
18576
18606
|
};
|
|
18607
|
+
/**
|
|
18608
|
+
* Middleware for inline-only mode (no database configured).
|
|
18609
|
+
* Sets null values for database-related context variables.
|
|
18610
|
+
*/
|
|
18611
|
+
const createInlineOnlyMiddleware = () => {
|
|
18612
|
+
return async (c, next) => {
|
|
18613
|
+
c.set("db", null);
|
|
18614
|
+
c.set("kyselyDb", null);
|
|
18615
|
+
c.set("dbType", null);
|
|
18616
|
+
c.set("authClient", null);
|
|
18617
|
+
c.set("setupComplete", true);
|
|
18618
|
+
await next();
|
|
18619
|
+
};
|
|
18620
|
+
};
|
|
18577
18621
|
const createDatabaseMiddleware = (validatedConfig) => {
|
|
18578
18622
|
return async (c, next) => {
|
|
18579
18623
|
const kyselyDb = await createDatabaseFromConnection(validatedConfig.database, { schema: validatedConfig.schema });
|
|
@@ -18591,7 +18635,11 @@ const createDatabaseMiddleware = (validatedConfig) => {
|
|
|
18591
18635
|
};
|
|
18592
18636
|
const createApp = (config$1) => {
|
|
18593
18637
|
const validatedConfig = validateLLMOpsConfig(config$1);
|
|
18594
|
-
|
|
18638
|
+
const app$17 = new Hono().use("/assets/*", createStaticAssetMiddleware()).use("*", createEnvValidatorMiddleware()).use("*", setConfigMiddleware(validatedConfig));
|
|
18639
|
+
if (validatedConfig.database) app$17.use("*", createMigrationMiddleware(validatedConfig)).use("*", createDatabaseMiddleware(validatedConfig)).use("*", createSeedMiddleware()).use("*", createAuthClientMiddleware());
|
|
18640
|
+
else app$17.use("*", createInlineOnlyMiddleware());
|
|
18641
|
+
app$17.route("/", server_default).basePath(validatedConfig.basePath);
|
|
18642
|
+
return { app: app$17 };
|
|
18595
18643
|
};
|
|
18596
18644
|
var src_default = server_default;
|
|
18597
18645
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@llmops/app",
|
|
3
|
-
"version": "0.5.0-beta.
|
|
3
|
+
"version": "0.5.0-beta.2",
|
|
4
4
|
"description": "LLMOps application with server and client",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
"react-hook-form": "^7.68.0",
|
|
77
77
|
"recharts": "^3.6.0",
|
|
78
78
|
"uuid": "^13.0.0",
|
|
79
|
-
"@llmops/core": "^0.5.0-beta.
|
|
80
|
-
"@llmops/gateway": "^0.5.0-beta.
|
|
79
|
+
"@llmops/core": "^0.5.0-beta.2",
|
|
80
|
+
"@llmops/gateway": "^0.5.0-beta.2"
|
|
81
81
|
},
|
|
82
82
|
"peerDependencies": {
|
|
83
83
|
"react": "^19.2.1",
|