@elsium-ai/app 0.8.0 → 0.9.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/dist/index.js +102 -54
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -2284,6 +2284,38 @@ function gateway(config) {
|
|
|
2284
2284
|
});
|
|
2285
2285
|
}
|
|
2286
2286
|
return { data: result.data, response };
|
|
2287
|
+
},
|
|
2288
|
+
async extract(schema, input, options) {
|
|
2289
|
+
const maxRetries = options?.maxRetries ?? 3;
|
|
2290
|
+
const messages = [{ role: "user", content: input }];
|
|
2291
|
+
let lastError;
|
|
2292
|
+
for (let attempt = 0;attempt <= maxRetries; attempt++) {
|
|
2293
|
+
try {
|
|
2294
|
+
const result = await this.generate({
|
|
2295
|
+
messages: [...messages],
|
|
2296
|
+
schema,
|
|
2297
|
+
model: options?.model,
|
|
2298
|
+
system: options?.system,
|
|
2299
|
+
temperature: options?.temperature
|
|
2300
|
+
});
|
|
2301
|
+
return result.data;
|
|
2302
|
+
} catch (e) {
|
|
2303
|
+
if (e instanceof ElsiumError && e.code === "VALIDATION_ERROR") {
|
|
2304
|
+
lastError = e;
|
|
2305
|
+
messages.push({
|
|
2306
|
+
role: "assistant",
|
|
2307
|
+
content: "Invalid output"
|
|
2308
|
+
});
|
|
2309
|
+
messages.push({
|
|
2310
|
+
role: "user",
|
|
2311
|
+
content: `The previous response failed validation: ${e.message}. Please try again and return valid JSON matching the schema.`
|
|
2312
|
+
});
|
|
2313
|
+
continue;
|
|
2314
|
+
}
|
|
2315
|
+
throw e;
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
throw lastError;
|
|
2287
2319
|
}
|
|
2288
2320
|
};
|
|
2289
2321
|
}
|
|
@@ -2531,10 +2563,10 @@ function createProviderMesh(config) {
|
|
|
2531
2563
|
};
|
|
2532
2564
|
}());
|
|
2533
2565
|
}
|
|
2534
|
-
function logStreamFailover(provider, error) {
|
|
2566
|
+
function logStreamFailover(provider, toProvider, error) {
|
|
2535
2567
|
audit?.log("provider_failover", {
|
|
2536
2568
|
fromProvider: provider,
|
|
2537
|
-
toProvider
|
|
2569
|
+
toProvider,
|
|
2538
2570
|
strategy: config.strategy,
|
|
2539
2571
|
reason: error?.message
|
|
2540
2572
|
});
|
|
@@ -2557,25 +2589,33 @@ function createProviderMesh(config) {
|
|
|
2557
2589
|
}
|
|
2558
2590
|
return { success: true };
|
|
2559
2591
|
}
|
|
2592
|
+
async function attemptStreamProvider(entry, nextProvider, request, emit) {
|
|
2593
|
+
try {
|
|
2594
|
+
const result = await tryStreamProvider(entry, request, emit);
|
|
2595
|
+
if (result.success)
|
|
2596
|
+
return { success: true };
|
|
2597
|
+
logStreamFailover(entry.name, nextProvider, result.error);
|
|
2598
|
+
return { success: false, error: result.error };
|
|
2599
|
+
} catch (err2) {
|
|
2600
|
+
const error = toError2(err2);
|
|
2601
|
+
logStreamFailover(entry.name, nextProvider, error);
|
|
2602
|
+
return { success: false, error };
|
|
2603
|
+
}
|
|
2604
|
+
}
|
|
2560
2605
|
async function runStreamFallbackLoop(available, request, emit) {
|
|
2561
2606
|
let lastError = null;
|
|
2562
2607
|
let failedProvider = null;
|
|
2563
|
-
for (
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
lastError = result.error ?? null;
|
|
2572
|
-
failedProvider = entry.name;
|
|
2573
|
-
logStreamFailover(entry.name, result.error);
|
|
2574
|
-
} catch (err2) {
|
|
2575
|
-
failedProvider = entry.name;
|
|
2576
|
-
lastError = toError2(err2);
|
|
2577
|
-
logStreamFailover(entry.name, lastError);
|
|
2608
|
+
for (let i = 0;i < available.length; i++) {
|
|
2609
|
+
const entry = available[i];
|
|
2610
|
+
const nextProvider = i + 1 < available.length ? available[i + 1].name : "none";
|
|
2611
|
+
const attempt = await attemptStreamProvider(entry, nextProvider, request, emit);
|
|
2612
|
+
if (attempt.success) {
|
|
2613
|
+
if (failedProvider)
|
|
2614
|
+
logFailover(failedProvider, entry.name, lastError?.message);
|
|
2615
|
+
return;
|
|
2578
2616
|
}
|
|
2617
|
+
lastError = attempt.error ?? null;
|
|
2618
|
+
failedProvider = entry.name;
|
|
2579
2619
|
}
|
|
2580
2620
|
emit({
|
|
2581
2621
|
type: "error",
|
|
@@ -2900,12 +2940,17 @@ function createNoopSpan(name, kind) {
|
|
|
2900
2940
|
}
|
|
2901
2941
|
};
|
|
2902
2942
|
}
|
|
2943
|
+
// ../observe/src/audit-sink.ts
|
|
2944
|
+
var log8 = createLogger();
|
|
2945
|
+
|
|
2903
2946
|
// ../observe/src/audit.ts
|
|
2904
2947
|
var ZERO_HASH = "0".repeat(64);
|
|
2905
2948
|
// ../observe/src/experiment.ts
|
|
2906
|
-
var log8 = createLogger();
|
|
2907
|
-
// ../observe/src/otel.ts
|
|
2908
2949
|
var log9 = createLogger();
|
|
2950
|
+
// ../observe/src/studio-exporter.ts
|
|
2951
|
+
var log10 = createLogger();
|
|
2952
|
+
// ../observe/src/otel.ts
|
|
2953
|
+
var log11 = createLogger();
|
|
2909
2954
|
// ../../node_modules/.bun/@hono+node-server@1.19.10/node_modules/@hono/node-server/dist/index.mjs
|
|
2910
2955
|
import { createServer as createServerHTTP } from "http";
|
|
2911
2956
|
import { Http2ServerRequest as Http2ServerRequest2 } from "http2";
|
|
@@ -3440,7 +3485,7 @@ var serve = (options, listeningListener) => {
|
|
|
3440
3485
|
return server;
|
|
3441
3486
|
};
|
|
3442
3487
|
|
|
3443
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
3488
|
+
// ../../node_modules/.bun/hono@4.12.8/node_modules/hono/dist/compose.js
|
|
3444
3489
|
var compose = (middleware, onError, onNotFound) => {
|
|
3445
3490
|
return (context, next) => {
|
|
3446
3491
|
let index = -1;
|
|
@@ -3484,10 +3529,10 @@ var compose = (middleware, onError, onNotFound) => {
|
|
|
3484
3529
|
};
|
|
3485
3530
|
};
|
|
3486
3531
|
|
|
3487
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
3532
|
+
// ../../node_modules/.bun/hono@4.12.8/node_modules/hono/dist/request/constants.js
|
|
3488
3533
|
var GET_MATCH_RESULT = /* @__PURE__ */ Symbol();
|
|
3489
3534
|
|
|
3490
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
3535
|
+
// ../../node_modules/.bun/hono@4.12.8/node_modules/hono/dist/utils/body.js
|
|
3491
3536
|
var parseBody = async (request, options = /* @__PURE__ */ Object.create(null)) => {
|
|
3492
3537
|
const { all = false, dot = false } = options;
|
|
3493
3538
|
const headers = request instanceof HonoRequest ? request.raw.headers : request.headers;
|
|
@@ -3541,6 +3586,9 @@ var handleParsingAllValues = (form, key, value) => {
|
|
|
3541
3586
|
}
|
|
3542
3587
|
};
|
|
3543
3588
|
var handleParsingNestedValues = (form, key, value) => {
|
|
3589
|
+
if (/(?:^|\.)__proto__\./.test(key)) {
|
|
3590
|
+
return;
|
|
3591
|
+
}
|
|
3544
3592
|
let nestedForm = form;
|
|
3545
3593
|
const keys = key.split(".");
|
|
3546
3594
|
keys.forEach((key2, index) => {
|
|
@@ -3555,7 +3603,7 @@ var handleParsingNestedValues = (form, key, value) => {
|
|
|
3555
3603
|
});
|
|
3556
3604
|
};
|
|
3557
3605
|
|
|
3558
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
3606
|
+
// ../../node_modules/.bun/hono@4.12.8/node_modules/hono/dist/utils/url.js
|
|
3559
3607
|
var splitPath = (path) => {
|
|
3560
3608
|
const paths = path.split("/");
|
|
3561
3609
|
if (paths[0] === "") {
|
|
@@ -3755,7 +3803,7 @@ var getQueryParams = (url, key) => {
|
|
|
3755
3803
|
};
|
|
3756
3804
|
var decodeURIComponent_ = decodeURIComponent;
|
|
3757
3805
|
|
|
3758
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
3806
|
+
// ../../node_modules/.bun/hono@4.12.8/node_modules/hono/dist/request.js
|
|
3759
3807
|
var tryDecodeURIComponent = (str) => tryDecode(str, decodeURIComponent_);
|
|
3760
3808
|
var HonoRequest = class {
|
|
3761
3809
|
raw;
|
|
@@ -3866,7 +3914,7 @@ var HonoRequest = class {
|
|
|
3866
3914
|
}
|
|
3867
3915
|
};
|
|
3868
3916
|
|
|
3869
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
3917
|
+
// ../../node_modules/.bun/hono@4.12.8/node_modules/hono/dist/utils/html.js
|
|
3870
3918
|
var HtmlEscapedCallbackPhase = {
|
|
3871
3919
|
Stringify: 1,
|
|
3872
3920
|
BeforeStream: 2,
|
|
@@ -3904,7 +3952,7 @@ var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) =>
|
|
|
3904
3952
|
}
|
|
3905
3953
|
};
|
|
3906
3954
|
|
|
3907
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
3955
|
+
// ../../node_modules/.bun/hono@4.12.8/node_modules/hono/dist/context.js
|
|
3908
3956
|
var TEXT_PLAIN = "text/plain; charset=UTF-8";
|
|
3909
3957
|
var setDefaultContentType = (contentType, headers) => {
|
|
3910
3958
|
return {
|
|
@@ -4071,7 +4119,7 @@ var Context = class {
|
|
|
4071
4119
|
};
|
|
4072
4120
|
};
|
|
4073
4121
|
|
|
4074
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
4122
|
+
// ../../node_modules/.bun/hono@4.12.8/node_modules/hono/dist/router.js
|
|
4075
4123
|
var METHOD_NAME_ALL = "ALL";
|
|
4076
4124
|
var METHOD_NAME_ALL_LOWERCASE = "all";
|
|
4077
4125
|
var METHODS = ["get", "post", "put", "delete", "options", "patch"];
|
|
@@ -4079,10 +4127,10 @@ var MESSAGE_MATCHER_IS_ALREADY_BUILT = "Can not add a route since the matcher is
|
|
|
4079
4127
|
var UnsupportedPathError = class extends Error {
|
|
4080
4128
|
};
|
|
4081
4129
|
|
|
4082
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
4130
|
+
// ../../node_modules/.bun/hono@4.12.8/node_modules/hono/dist/utils/constants.js
|
|
4083
4131
|
var COMPOSED_HANDLER = "__COMPOSED_HANDLER";
|
|
4084
4132
|
|
|
4085
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
4133
|
+
// ../../node_modules/.bun/hono@4.12.8/node_modules/hono/dist/hono-base.js
|
|
4086
4134
|
var notFoundHandler = (c) => {
|
|
4087
4135
|
return c.text("404 Not Found", 404);
|
|
4088
4136
|
};
|
|
@@ -4301,7 +4349,7 @@ var Hono = class _Hono {
|
|
|
4301
4349
|
};
|
|
4302
4350
|
};
|
|
4303
4351
|
|
|
4304
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
4352
|
+
// ../../node_modules/.bun/hono@4.12.8/node_modules/hono/dist/router/reg-exp-router/matcher.js
|
|
4305
4353
|
var emptyParam = [];
|
|
4306
4354
|
function match(method, path) {
|
|
4307
4355
|
const matchers = this.buildAllMatchers();
|
|
@@ -4322,7 +4370,7 @@ function match(method, path) {
|
|
|
4322
4370
|
return match2(method, path);
|
|
4323
4371
|
}
|
|
4324
4372
|
|
|
4325
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
4373
|
+
// ../../node_modules/.bun/hono@4.12.8/node_modules/hono/dist/router/reg-exp-router/node.js
|
|
4326
4374
|
var LABEL_REG_EXP_STR = "[^/]+";
|
|
4327
4375
|
var ONLY_WILDCARD_REG_EXP_STR = ".*";
|
|
4328
4376
|
var TAIL_WILDCARD_REG_EXP_STR = "(?:|/.*)";
|
|
@@ -4426,7 +4474,7 @@ var Node = class _Node {
|
|
|
4426
4474
|
}
|
|
4427
4475
|
};
|
|
4428
4476
|
|
|
4429
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
4477
|
+
// ../../node_modules/.bun/hono@4.12.8/node_modules/hono/dist/router/reg-exp-router/trie.js
|
|
4430
4478
|
var Trie = class {
|
|
4431
4479
|
#context = { varIndex: 0 };
|
|
4432
4480
|
#root = new Node;
|
|
@@ -4482,7 +4530,7 @@ var Trie = class {
|
|
|
4482
4530
|
}
|
|
4483
4531
|
};
|
|
4484
4532
|
|
|
4485
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
4533
|
+
// ../../node_modules/.bun/hono@4.12.8/node_modules/hono/dist/router/reg-exp-router/router.js
|
|
4486
4534
|
var nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];
|
|
4487
4535
|
var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
|
|
4488
4536
|
function buildWildcardRegExp(path) {
|
|
@@ -4647,7 +4695,7 @@ var RegExpRouter = class {
|
|
|
4647
4695
|
}
|
|
4648
4696
|
};
|
|
4649
4697
|
|
|
4650
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
4698
|
+
// ../../node_modules/.bun/hono@4.12.8/node_modules/hono/dist/router/reg-exp-router/prepared-router.js
|
|
4651
4699
|
var PreparedRegExpRouter = class {
|
|
4652
4700
|
name = "PreparedRegExpRouter";
|
|
4653
4701
|
#matchers;
|
|
@@ -4719,7 +4767,7 @@ var PreparedRegExpRouter = class {
|
|
|
4719
4767
|
match = match;
|
|
4720
4768
|
};
|
|
4721
4769
|
|
|
4722
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
4770
|
+
// ../../node_modules/.bun/hono@4.12.8/node_modules/hono/dist/router/smart-router/router.js
|
|
4723
4771
|
var SmartRouter = class {
|
|
4724
4772
|
name = "SmartRouter";
|
|
4725
4773
|
#routers = [];
|
|
@@ -4774,7 +4822,7 @@ var SmartRouter = class {
|
|
|
4774
4822
|
}
|
|
4775
4823
|
};
|
|
4776
4824
|
|
|
4777
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
4825
|
+
// ../../node_modules/.bun/hono@4.12.8/node_modules/hono/dist/router/trie-router/node.js
|
|
4778
4826
|
var emptyParams = /* @__PURE__ */ Object.create(null);
|
|
4779
4827
|
var hasChildren = (children) => {
|
|
4780
4828
|
for (const _ in children) {
|
|
@@ -4943,7 +4991,7 @@ var Node2 = class _Node2 {
|
|
|
4943
4991
|
}
|
|
4944
4992
|
};
|
|
4945
4993
|
|
|
4946
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
4994
|
+
// ../../node_modules/.bun/hono@4.12.8/node_modules/hono/dist/router/trie-router/router.js
|
|
4947
4995
|
var TrieRouter = class {
|
|
4948
4996
|
name = "TrieRouter";
|
|
4949
4997
|
#node;
|
|
@@ -4965,7 +5013,7 @@ var TrieRouter = class {
|
|
|
4965
5013
|
}
|
|
4966
5014
|
};
|
|
4967
5015
|
|
|
4968
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
5016
|
+
// ../../node_modules/.bun/hono@4.12.8/node_modules/hono/dist/hono.js
|
|
4969
5017
|
var Hono2 = class extends Hono {
|
|
4970
5018
|
constructor(options = {}) {
|
|
4971
5019
|
super(options);
|
|
@@ -5065,12 +5113,12 @@ function requestIdMiddleware() {
|
|
|
5065
5113
|
};
|
|
5066
5114
|
}
|
|
5067
5115
|
function requestLoggerMiddleware(logger) {
|
|
5068
|
-
const
|
|
5116
|
+
const log12 = logger ?? createLogger();
|
|
5069
5117
|
return async (c, next) => {
|
|
5070
5118
|
const start = Date.now();
|
|
5071
5119
|
await next();
|
|
5072
5120
|
const duration = Date.now() - start;
|
|
5073
|
-
|
|
5121
|
+
log12.info(`${c.req.method} ${c.req.path}`, {
|
|
5074
5122
|
method: c.req.method,
|
|
5075
5123
|
path: c.req.path,
|
|
5076
5124
|
status: c.res.status,
|
|
@@ -5080,7 +5128,7 @@ function requestLoggerMiddleware(logger) {
|
|
|
5080
5128
|
};
|
|
5081
5129
|
}
|
|
5082
5130
|
|
|
5083
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
5131
|
+
// ../../node_modules/.bun/hono@4.12.8/node_modules/hono/dist/utils/stream.js
|
|
5084
5132
|
var StreamingApi = class {
|
|
5085
5133
|
writer;
|
|
5086
5134
|
encoder;
|
|
@@ -5146,7 +5194,7 @@ var StreamingApi = class {
|
|
|
5146
5194
|
}
|
|
5147
5195
|
};
|
|
5148
5196
|
|
|
5149
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
5197
|
+
// ../../node_modules/.bun/hono@4.12.8/node_modules/hono/dist/helper/streaming/utils.js
|
|
5150
5198
|
var isOldBunVersion = () => {
|
|
5151
5199
|
const version = typeof Bun !== "undefined" ? Bun.version : undefined;
|
|
5152
5200
|
if (version === undefined) {
|
|
@@ -5157,7 +5205,7 @@ var isOldBunVersion = () => {
|
|
|
5157
5205
|
return result;
|
|
5158
5206
|
};
|
|
5159
5207
|
|
|
5160
|
-
// ../../node_modules/.bun/hono@4.12.
|
|
5208
|
+
// ../../node_modules/.bun/hono@4.12.8/node_modules/hono/dist/helper/streaming/stream.js
|
|
5161
5209
|
var contextStash = /* @__PURE__ */ new WeakMap;
|
|
5162
5210
|
var stream = (c, cb, onError) => {
|
|
5163
5211
|
const { readable, writable } = new TransformStream;
|
|
@@ -5413,13 +5461,13 @@ function createRoutes(deps) {
|
|
|
5413
5461
|
}
|
|
5414
5462
|
|
|
5415
5463
|
// src/app.ts
|
|
5416
|
-
var
|
|
5464
|
+
var log12 = createLogger();
|
|
5417
5465
|
function createApp(config) {
|
|
5418
5466
|
const app = new Hono2;
|
|
5419
5467
|
app.onError((err2, c) => {
|
|
5420
5468
|
const statusCode = err2 instanceof ElsiumError ? err2.statusCode ?? 500 : 500;
|
|
5421
5469
|
const code = err2 instanceof ElsiumError ? err2.code : "UNKNOWN";
|
|
5422
|
-
|
|
5470
|
+
log12.error("Unhandled error", { error: err2.message, code, path: c.req.path });
|
|
5423
5471
|
return c.json({ error: err2.message, code }, statusCode);
|
|
5424
5472
|
});
|
|
5425
5473
|
app.notFound((c) => {
|
|
@@ -5465,7 +5513,7 @@ function createApp(config) {
|
|
|
5465
5513
|
});
|
|
5466
5514
|
const serverConfig = config.server ?? {};
|
|
5467
5515
|
app.use("*", requestIdMiddleware());
|
|
5468
|
-
app.use("*", requestLoggerMiddleware(
|
|
5516
|
+
app.use("*", requestLoggerMiddleware(log12));
|
|
5469
5517
|
if (serverConfig.cors) {
|
|
5470
5518
|
app.use("*", corsMiddleware(serverConfig.cors));
|
|
5471
5519
|
}
|
|
@@ -5511,11 +5559,11 @@ function createApp(config) {
|
|
|
5511
5559
|
const drainTimeoutMs = typeof serverConfig.gracefulShutdown === "object" ? serverConfig.gracefulShutdown.drainTimeoutMs : undefined;
|
|
5512
5560
|
shutdownManager = createShutdownManager({
|
|
5513
5561
|
drainTimeoutMs,
|
|
5514
|
-
onDrainStart: () =>
|
|
5515
|
-
onDrainComplete: () =>
|
|
5562
|
+
onDrainStart: () => log12.info("Draining connections..."),
|
|
5563
|
+
onDrainComplete: () => log12.info("Drain complete")
|
|
5516
5564
|
});
|
|
5517
5565
|
}
|
|
5518
|
-
|
|
5566
|
+
log12.info("ElsiumAI server started", {
|
|
5519
5567
|
url: `http://${hostname}:${listenPort}`,
|
|
5520
5568
|
routes: ["POST /chat", "POST /complete", "GET /health", "GET /metrics", "GET /agents"]
|
|
5521
5569
|
});
|
|
@@ -5532,7 +5580,7 @@ function createApp(config) {
|
|
|
5532
5580
|
};
|
|
5533
5581
|
}
|
|
5534
5582
|
// src/rbac.ts
|
|
5535
|
-
var
|
|
5583
|
+
var log13 = createLogger();
|
|
5536
5584
|
var BUILT_IN_ROLES = [
|
|
5537
5585
|
{
|
|
5538
5586
|
name: "admin",
|
|
@@ -5570,7 +5618,7 @@ function matchPermission(granted, required) {
|
|
|
5570
5618
|
}
|
|
5571
5619
|
function createRBAC(config) {
|
|
5572
5620
|
if (config.trustRoleHeader === true) {
|
|
5573
|
-
|
|
5621
|
+
log13.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.");
|
|
5574
5622
|
}
|
|
5575
5623
|
const roleMap = new Map;
|
|
5576
5624
|
for (const role of BUILT_IN_ROLES) {
|
|
@@ -5627,7 +5675,7 @@ function createRBAC(config) {
|
|
|
5627
5675
|
};
|
|
5628
5676
|
}
|
|
5629
5677
|
// src/tenant.ts
|
|
5630
|
-
var
|
|
5678
|
+
var log14 = createLogger();
|
|
5631
5679
|
var tenantUsage = new Map;
|
|
5632
5680
|
function tenantMiddleware(config) {
|
|
5633
5681
|
const { extractTenant, onUnknownTenant = "reject", defaultTenant } = config;
|
|
@@ -5636,13 +5684,13 @@ function tenantMiddleware(config) {
|
|
|
5636
5684
|
if (!tenant) {
|
|
5637
5685
|
if (onUnknownTenant === "default" && defaultTenant) {
|
|
5638
5686
|
c.set("tenant", defaultTenant);
|
|
5639
|
-
|
|
5687
|
+
log14.debug("Using default tenant", { tenantId: defaultTenant.tenantId });
|
|
5640
5688
|
} else {
|
|
5641
5689
|
return c.json({ error: "Tenant identification required" }, 401);
|
|
5642
5690
|
}
|
|
5643
5691
|
} else {
|
|
5644
5692
|
c.set("tenant", tenant);
|
|
5645
|
-
|
|
5693
|
+
log14.debug("Tenant identified", { tenantId: tenant.tenantId });
|
|
5646
5694
|
}
|
|
5647
5695
|
await next();
|
|
5648
5696
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elsium-ai/app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
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,13 +26,13 @@
|
|
|
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.9.1",
|
|
30
|
+
"@elsium-ai/gateway": "^0.9.1",
|
|
31
|
+
"@elsium-ai/agents": "^0.9.1",
|
|
32
|
+
"@elsium-ai/tools": "^0.9.1",
|
|
33
|
+
"@elsium-ai/observe": "^0.9.1",
|
|
34
|
+
"@elsium-ai/rag": "^0.9.1",
|
|
35
|
+
"@elsium-ai/workflows": "^0.9.1",
|
|
36
36
|
"@hono/node-server": "^1.19.10",
|
|
37
37
|
"hono": "^4.12.4",
|
|
38
38
|
"zod": "^3.24.0"
|