@elsium-ai/app 0.10.0 → 0.12.0
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.js +40 -38
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -2945,12 +2945,14 @@ var log8 = createLogger();
|
|
|
2945
2945
|
|
|
2946
2946
|
// ../observe/src/audit.ts
|
|
2947
2947
|
var ZERO_HASH = "0".repeat(64);
|
|
2948
|
-
// ../observe/src/
|
|
2948
|
+
// ../observe/src/audit-sink-jsonl.ts
|
|
2949
2949
|
var log9 = createLogger();
|
|
2950
|
-
// ../observe/src/
|
|
2950
|
+
// ../observe/src/experiment.ts
|
|
2951
2951
|
var log10 = createLogger();
|
|
2952
|
-
// ../observe/src/
|
|
2952
|
+
// ../observe/src/studio-exporter.ts
|
|
2953
2953
|
var log11 = createLogger();
|
|
2954
|
+
// ../observe/src/otel.ts
|
|
2955
|
+
var log12 = createLogger();
|
|
2954
2956
|
// ../../node_modules/.bun/@hono+node-server@1.19.14/node_modules/@hono/node-server/dist/index.mjs
|
|
2955
2957
|
import { createServer as createServerHTTP } from "http";
|
|
2956
2958
|
import { Http2ServerRequest as Http2ServerRequest2, constants as h2constants } from "http2";
|
|
@@ -3569,7 +3571,7 @@ var serve = (options, listeningListener) => {
|
|
|
3569
3571
|
return server;
|
|
3570
3572
|
};
|
|
3571
3573
|
|
|
3572
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
3574
|
+
// ../../node_modules/.bun/hono@4.12.18/node_modules/hono/dist/compose.js
|
|
3573
3575
|
var compose = (middleware, onError, onNotFound) => {
|
|
3574
3576
|
return (context, next) => {
|
|
3575
3577
|
let index = -1;
|
|
@@ -3613,10 +3615,10 @@ var compose = (middleware, onError, onNotFound) => {
|
|
|
3613
3615
|
};
|
|
3614
3616
|
};
|
|
3615
3617
|
|
|
3616
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
3618
|
+
// ../../node_modules/.bun/hono@4.12.18/node_modules/hono/dist/request/constants.js
|
|
3617
3619
|
var GET_MATCH_RESULT = /* @__PURE__ */ Symbol();
|
|
3618
3620
|
|
|
3619
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
3621
|
+
// ../../node_modules/.bun/hono@4.12.18/node_modules/hono/dist/utils/body.js
|
|
3620
3622
|
var parseBody = async (request, options = /* @__PURE__ */ Object.create(null)) => {
|
|
3621
3623
|
const { all = false, dot = false } = options;
|
|
3622
3624
|
const headers = request instanceof HonoRequest ? request.raw.headers : request.headers;
|
|
@@ -3687,7 +3689,7 @@ var handleParsingNestedValues = (form, key, value) => {
|
|
|
3687
3689
|
});
|
|
3688
3690
|
};
|
|
3689
3691
|
|
|
3690
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
3692
|
+
// ../../node_modules/.bun/hono@4.12.18/node_modules/hono/dist/utils/url.js
|
|
3691
3693
|
var splitPath = (path) => {
|
|
3692
3694
|
const paths = path.split("/");
|
|
3693
3695
|
if (paths[0] === "") {
|
|
@@ -3887,7 +3889,7 @@ var getQueryParams = (url, key) => {
|
|
|
3887
3889
|
};
|
|
3888
3890
|
var decodeURIComponent_ = decodeURIComponent;
|
|
3889
3891
|
|
|
3890
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
3892
|
+
// ../../node_modules/.bun/hono@4.12.18/node_modules/hono/dist/request.js
|
|
3891
3893
|
var tryDecodeURIComponent = (str) => tryDecode(str, decodeURIComponent_);
|
|
3892
3894
|
var HonoRequest = class {
|
|
3893
3895
|
raw;
|
|
@@ -3998,7 +4000,7 @@ var HonoRequest = class {
|
|
|
3998
4000
|
}
|
|
3999
4001
|
};
|
|
4000
4002
|
|
|
4001
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
4003
|
+
// ../../node_modules/.bun/hono@4.12.18/node_modules/hono/dist/utils/html.js
|
|
4002
4004
|
var HtmlEscapedCallbackPhase = {
|
|
4003
4005
|
Stringify: 1,
|
|
4004
4006
|
BeforeStream: 2,
|
|
@@ -4036,7 +4038,7 @@ var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) =>
|
|
|
4036
4038
|
}
|
|
4037
4039
|
};
|
|
4038
4040
|
|
|
4039
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
4041
|
+
// ../../node_modules/.bun/hono@4.12.18/node_modules/hono/dist/context.js
|
|
4040
4042
|
var TEXT_PLAIN = "text/plain; charset=UTF-8";
|
|
4041
4043
|
var setDefaultContentType = (contentType, headers) => {
|
|
4042
4044
|
return {
|
|
@@ -4203,7 +4205,7 @@ var Context = class {
|
|
|
4203
4205
|
};
|
|
4204
4206
|
};
|
|
4205
4207
|
|
|
4206
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
4208
|
+
// ../../node_modules/.bun/hono@4.12.18/node_modules/hono/dist/router.js
|
|
4207
4209
|
var METHOD_NAME_ALL = "ALL";
|
|
4208
4210
|
var METHOD_NAME_ALL_LOWERCASE = "all";
|
|
4209
4211
|
var METHODS = ["get", "post", "put", "delete", "options", "patch"];
|
|
@@ -4211,10 +4213,10 @@ var MESSAGE_MATCHER_IS_ALREADY_BUILT = "Can not add a route since the matcher is
|
|
|
4211
4213
|
var UnsupportedPathError = class extends Error {
|
|
4212
4214
|
};
|
|
4213
4215
|
|
|
4214
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
4216
|
+
// ../../node_modules/.bun/hono@4.12.18/node_modules/hono/dist/utils/constants.js
|
|
4215
4217
|
var COMPOSED_HANDLER = "__COMPOSED_HANDLER";
|
|
4216
4218
|
|
|
4217
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
4219
|
+
// ../../node_modules/.bun/hono@4.12.18/node_modules/hono/dist/hono-base.js
|
|
4218
4220
|
var notFoundHandler = (c) => {
|
|
4219
4221
|
return c.text("404 Not Found", 404);
|
|
4220
4222
|
};
|
|
@@ -4433,7 +4435,7 @@ var Hono = class _Hono {
|
|
|
4433
4435
|
};
|
|
4434
4436
|
};
|
|
4435
4437
|
|
|
4436
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
4438
|
+
// ../../node_modules/.bun/hono@4.12.18/node_modules/hono/dist/router/reg-exp-router/matcher.js
|
|
4437
4439
|
var emptyParam = [];
|
|
4438
4440
|
function match(method, path) {
|
|
4439
4441
|
const matchers = this.buildAllMatchers();
|
|
@@ -4454,7 +4456,7 @@ function match(method, path) {
|
|
|
4454
4456
|
return match2(method, path);
|
|
4455
4457
|
}
|
|
4456
4458
|
|
|
4457
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
4459
|
+
// ../../node_modules/.bun/hono@4.12.18/node_modules/hono/dist/router/reg-exp-router/node.js
|
|
4458
4460
|
var LABEL_REG_EXP_STR = "[^/]+";
|
|
4459
4461
|
var ONLY_WILDCARD_REG_EXP_STR = ".*";
|
|
4460
4462
|
var TAIL_WILDCARD_REG_EXP_STR = "(?:|/.*)";
|
|
@@ -4558,7 +4560,7 @@ var Node = class _Node {
|
|
|
4558
4560
|
}
|
|
4559
4561
|
};
|
|
4560
4562
|
|
|
4561
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
4563
|
+
// ../../node_modules/.bun/hono@4.12.18/node_modules/hono/dist/router/reg-exp-router/trie.js
|
|
4562
4564
|
var Trie = class {
|
|
4563
4565
|
#context = { varIndex: 0 };
|
|
4564
4566
|
#root = new Node;
|
|
@@ -4614,7 +4616,7 @@ var Trie = class {
|
|
|
4614
4616
|
}
|
|
4615
4617
|
};
|
|
4616
4618
|
|
|
4617
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
4619
|
+
// ../../node_modules/.bun/hono@4.12.18/node_modules/hono/dist/router/reg-exp-router/router.js
|
|
4618
4620
|
var nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];
|
|
4619
4621
|
var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
|
|
4620
4622
|
function buildWildcardRegExp(path) {
|
|
@@ -4779,7 +4781,7 @@ var RegExpRouter = class {
|
|
|
4779
4781
|
}
|
|
4780
4782
|
};
|
|
4781
4783
|
|
|
4782
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
4784
|
+
// ../../node_modules/.bun/hono@4.12.18/node_modules/hono/dist/router/reg-exp-router/prepared-router.js
|
|
4783
4785
|
var PreparedRegExpRouter = class {
|
|
4784
4786
|
name = "PreparedRegExpRouter";
|
|
4785
4787
|
#matchers;
|
|
@@ -4851,7 +4853,7 @@ var PreparedRegExpRouter = class {
|
|
|
4851
4853
|
match = match;
|
|
4852
4854
|
};
|
|
4853
4855
|
|
|
4854
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
4856
|
+
// ../../node_modules/.bun/hono@4.12.18/node_modules/hono/dist/router/smart-router/router.js
|
|
4855
4857
|
var SmartRouter = class {
|
|
4856
4858
|
name = "SmartRouter";
|
|
4857
4859
|
#routers = [];
|
|
@@ -4906,7 +4908,7 @@ var SmartRouter = class {
|
|
|
4906
4908
|
}
|
|
4907
4909
|
};
|
|
4908
4910
|
|
|
4909
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
4911
|
+
// ../../node_modules/.bun/hono@4.12.18/node_modules/hono/dist/router/trie-router/node.js
|
|
4910
4912
|
var emptyParams = /* @__PURE__ */ Object.create(null);
|
|
4911
4913
|
var hasChildren = (children) => {
|
|
4912
4914
|
for (const _ in children) {
|
|
@@ -5075,7 +5077,7 @@ var Node2 = class _Node2 {
|
|
|
5075
5077
|
}
|
|
5076
5078
|
};
|
|
5077
5079
|
|
|
5078
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
5080
|
+
// ../../node_modules/.bun/hono@4.12.18/node_modules/hono/dist/router/trie-router/router.js
|
|
5079
5081
|
var TrieRouter = class {
|
|
5080
5082
|
name = "TrieRouter";
|
|
5081
5083
|
#node;
|
|
@@ -5097,7 +5099,7 @@ var TrieRouter = class {
|
|
|
5097
5099
|
}
|
|
5098
5100
|
};
|
|
5099
5101
|
|
|
5100
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
5102
|
+
// ../../node_modules/.bun/hono@4.12.18/node_modules/hono/dist/hono.js
|
|
5101
5103
|
var Hono2 = class extends Hono {
|
|
5102
5104
|
constructor(options = {}) {
|
|
5103
5105
|
super(options);
|
|
@@ -5197,12 +5199,12 @@ function requestIdMiddleware() {
|
|
|
5197
5199
|
};
|
|
5198
5200
|
}
|
|
5199
5201
|
function requestLoggerMiddleware(logger) {
|
|
5200
|
-
const
|
|
5202
|
+
const log13 = logger ?? createLogger();
|
|
5201
5203
|
return async (c, next) => {
|
|
5202
5204
|
const start = Date.now();
|
|
5203
5205
|
await next();
|
|
5204
5206
|
const duration = Date.now() - start;
|
|
5205
|
-
|
|
5207
|
+
log13.info(`${c.req.method} ${c.req.path}`, {
|
|
5206
5208
|
method: c.req.method,
|
|
5207
5209
|
path: c.req.path,
|
|
5208
5210
|
status: c.res.status,
|
|
@@ -5212,7 +5214,7 @@ function requestLoggerMiddleware(logger) {
|
|
|
5212
5214
|
};
|
|
5213
5215
|
}
|
|
5214
5216
|
|
|
5215
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
5217
|
+
// ../../node_modules/.bun/hono@4.12.18/node_modules/hono/dist/utils/stream.js
|
|
5216
5218
|
var StreamingApi = class {
|
|
5217
5219
|
writer;
|
|
5218
5220
|
encoder;
|
|
@@ -5278,7 +5280,7 @@ var StreamingApi = class {
|
|
|
5278
5280
|
}
|
|
5279
5281
|
};
|
|
5280
5282
|
|
|
5281
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
5283
|
+
// ../../node_modules/.bun/hono@4.12.18/node_modules/hono/dist/helper/streaming/utils.js
|
|
5282
5284
|
var isOldBunVersion = () => {
|
|
5283
5285
|
const version = typeof Bun !== "undefined" ? Bun.version : undefined;
|
|
5284
5286
|
if (version === undefined) {
|
|
@@ -5289,7 +5291,7 @@ var isOldBunVersion = () => {
|
|
|
5289
5291
|
return result;
|
|
5290
5292
|
};
|
|
5291
5293
|
|
|
5292
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
5294
|
+
// ../../node_modules/.bun/hono@4.12.18/node_modules/hono/dist/helper/streaming/stream.js
|
|
5293
5295
|
var contextStash = /* @__PURE__ */ new WeakMap;
|
|
5294
5296
|
var stream = (c, cb, onError) => {
|
|
5295
5297
|
const { readable, writable } = new TransformStream;
|
|
@@ -5545,13 +5547,13 @@ function createRoutes(deps) {
|
|
|
5545
5547
|
}
|
|
5546
5548
|
|
|
5547
5549
|
// src/app.ts
|
|
5548
|
-
var
|
|
5550
|
+
var log13 = createLogger();
|
|
5549
5551
|
function createApp(config) {
|
|
5550
5552
|
const app = new Hono2;
|
|
5551
5553
|
app.onError((err2, c) => {
|
|
5552
5554
|
const statusCode = err2 instanceof ElsiumError ? err2.statusCode ?? 500 : 500;
|
|
5553
5555
|
const code = err2 instanceof ElsiumError ? err2.code : "UNKNOWN";
|
|
5554
|
-
|
|
5556
|
+
log13.error("Unhandled error", { error: err2.message, code, path: c.req.path });
|
|
5555
5557
|
return c.json({ error: err2.message, code }, statusCode);
|
|
5556
5558
|
});
|
|
5557
5559
|
app.notFound((c) => {
|
|
@@ -5597,7 +5599,7 @@ function createApp(config) {
|
|
|
5597
5599
|
});
|
|
5598
5600
|
const serverConfig = config.server ?? {};
|
|
5599
5601
|
app.use("*", requestIdMiddleware());
|
|
5600
|
-
app.use("*", requestLoggerMiddleware(
|
|
5602
|
+
app.use("*", requestLoggerMiddleware(log13));
|
|
5601
5603
|
if (serverConfig.cors) {
|
|
5602
5604
|
app.use("*", corsMiddleware(serverConfig.cors));
|
|
5603
5605
|
}
|
|
@@ -5643,11 +5645,11 @@ function createApp(config) {
|
|
|
5643
5645
|
const drainTimeoutMs = typeof serverConfig.gracefulShutdown === "object" ? serverConfig.gracefulShutdown.drainTimeoutMs : undefined;
|
|
5644
5646
|
shutdownManager = createShutdownManager({
|
|
5645
5647
|
drainTimeoutMs,
|
|
5646
|
-
onDrainStart: () =>
|
|
5647
|
-
onDrainComplete: () =>
|
|
5648
|
+
onDrainStart: () => log13.info("Draining connections..."),
|
|
5649
|
+
onDrainComplete: () => log13.info("Drain complete")
|
|
5648
5650
|
});
|
|
5649
5651
|
}
|
|
5650
|
-
|
|
5652
|
+
log13.info("ElsiumAI server started", {
|
|
5651
5653
|
url: `http://${hostname}:${listenPort}`,
|
|
5652
5654
|
routes: ["POST /chat", "POST /complete", "GET /health", "GET /metrics", "GET /agents"]
|
|
5653
5655
|
});
|
|
@@ -5664,7 +5666,7 @@ function createApp(config) {
|
|
|
5664
5666
|
};
|
|
5665
5667
|
}
|
|
5666
5668
|
// src/rbac.ts
|
|
5667
|
-
var
|
|
5669
|
+
var log14 = createLogger();
|
|
5668
5670
|
var BUILT_IN_ROLES = [
|
|
5669
5671
|
{
|
|
5670
5672
|
name: "admin",
|
|
@@ -5702,7 +5704,7 @@ function matchPermission(granted, required) {
|
|
|
5702
5704
|
}
|
|
5703
5705
|
function createRBAC(config) {
|
|
5704
5706
|
if (config.trustRoleHeader === true) {
|
|
5705
|
-
|
|
5707
|
+
log14.warn("RBAC: trustRoleHeader is enabled — any client can self-assign roles via the X-Role header. Only use this in development or behind a trusted reverse proxy.");
|
|
5706
5708
|
}
|
|
5707
5709
|
const roleMap = new Map;
|
|
5708
5710
|
for (const role of BUILT_IN_ROLES) {
|
|
@@ -5759,7 +5761,7 @@ function createRBAC(config) {
|
|
|
5759
5761
|
};
|
|
5760
5762
|
}
|
|
5761
5763
|
// src/tenant.ts
|
|
5762
|
-
var
|
|
5764
|
+
var log15 = createLogger();
|
|
5763
5765
|
var tenantUsage = new Map;
|
|
5764
5766
|
function tenantMiddleware(config) {
|
|
5765
5767
|
const { extractTenant, onUnknownTenant = "reject", defaultTenant } = config;
|
|
@@ -5768,13 +5770,13 @@ function tenantMiddleware(config) {
|
|
|
5768
5770
|
if (!tenant) {
|
|
5769
5771
|
if (onUnknownTenant === "default" && defaultTenant) {
|
|
5770
5772
|
c.set("tenant", defaultTenant);
|
|
5771
|
-
|
|
5773
|
+
log15.debug("Using default tenant", { tenantId: defaultTenant.tenantId });
|
|
5772
5774
|
} else {
|
|
5773
5775
|
return c.json({ error: "Tenant identification required" }, 401);
|
|
5774
5776
|
}
|
|
5775
5777
|
} else {
|
|
5776
5778
|
c.set("tenant", tenant);
|
|
5777
|
-
|
|
5779
|
+
log15.debug("Tenant identified", { tenantId: tenant.tenantId });
|
|
5778
5780
|
}
|
|
5779
5781
|
await next();
|
|
5780
5782
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elsium-ai/app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "App bootstrap, HTTP server, and API routes for ElsiumAI",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Eric Utrera <ebutrera9103@gmail.com>",
|
|
@@ -26,15 +26,15 @@
|
|
|
26
26
|
"dev": "bun --watch src/index.ts"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@elsium-ai/core": "^0.
|
|
30
|
-
"@elsium-ai/gateway": "^0.
|
|
31
|
-
"@elsium-ai/agents": "^0.
|
|
32
|
-
"@elsium-ai/tools": "^0.
|
|
33
|
-
"@elsium-ai/observe": "^0.
|
|
34
|
-
"@elsium-ai/rag": "^0.
|
|
35
|
-
"@elsium-ai/workflows": "^0.
|
|
29
|
+
"@elsium-ai/core": "^0.12.0",
|
|
30
|
+
"@elsium-ai/gateway": "^0.12.0",
|
|
31
|
+
"@elsium-ai/agents": "^0.12.0",
|
|
32
|
+
"@elsium-ai/tools": "^0.12.0",
|
|
33
|
+
"@elsium-ai/observe": "^0.12.0",
|
|
34
|
+
"@elsium-ai/rag": "^0.12.0",
|
|
35
|
+
"@elsium-ai/workflows": "^0.12.0",
|
|
36
36
|
"@hono/node-server": "^1.19.14",
|
|
37
|
-
"hono": "^4.12.
|
|
37
|
+
"hono": "^4.12.18",
|
|
38
38
|
"zod": "^3.24.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|