omnigateway 0.9.1 → 0.9.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/README.md +12 -4
- package/bin/omni.js +37 -5
- package/gateway.js +618 -62
- package/package.json +1 -1
- package/public/assets/{Chip-DJkUCwNJ.js → Chip-Did4Zhvj.js} +1 -1
- package/public/assets/{CopyValue-CJ3ZYgvs.js → CopyValue-Cjg9QXrD.js} +1 -1
- package/public/assets/{Lamp-D7hJcQ90.js → Lamp-C2Q3t5Mn.js} +1 -1
- package/public/assets/{Rack-CaxD9IY1.js → Rack-D0_N-xsd.js} +1 -1
- package/public/assets/{RequestTable-bXapHDrR.js → RequestTable-i9paP_7e.js} +1 -1
- package/public/assets/{SummaryDeck-Dt_qbFtg.js → SummaryDeck-g4yLDeXB.js} +1 -1
- package/public/assets/{Toggle-C_iC6W50.js → Toggle-D-NDlneh.js} +1 -1
- package/public/assets/{TokenBreakdown-C96x_g6d.js → TokenBreakdown-D5ZIngM6.js} +1 -1
- package/public/assets/{WindowChart-D4dcv4DX.js → WindowChart-BsonO5Py.js} +1 -1
- package/public/assets/{_app.accounts-CGFOyYZc.js → _app.accounts-DFhyE62a.js} +1 -1
- package/public/assets/{_app.console-DrCT8eLd.js → _app.console-BfHcfQMp.js} +1 -1
- package/public/assets/{_app.database-D32je-GL.js → _app.database-Cgw9z3rK.js} +1 -1
- package/public/assets/{_app.index-BG6mGxkv.js → _app.index-Blw3S4-3.js} +1 -1
- package/public/assets/{_app.keys-C1AjjeHc.js → _app.keys-DrdfnfIk.js} +1 -1
- package/public/assets/{_app.logs-BDLj_H_j.js → _app.logs-DUOqlJzB.js} +1 -1
- package/public/assets/{_app.models-Cgg7gVSF.js → _app.models-Dm83HRaM.js} +1 -1
- package/public/assets/{_app.plugins._pluginId-C5FSNOfN.js → _app.plugins._pluginId-BmJGDYxw.js} +1 -1
- package/public/assets/{_app.settings-B7lKNDoh.js → _app.settings-66rm4vHJ.js} +1 -1
- package/public/assets/{_app.usage-DjqlIHDL.js → _app.usage-BCufy5XR.js} +1 -1
- package/public/assets/{chevron-right-DJj6SEIT.js → chevron-right-BZ4QmUDM.js} +1 -1
- package/public/assets/{client-Q2fvA2EK.js → client-De1_cEH5.js} +1 -1
- package/public/assets/{index-D1ewvjU0.js → index-PP8vsvw3.js} +3 -3
- package/public/assets/{login-Br_AimWR.js → login-CkZlwcdd.js} +1 -1
- package/public/assets/plus-D5AwIXj3.js +1 -0
- package/public/assets/{preload-helper-92RRH0nq.js → preload-helper-BC9bKUg1.js} +1 -1
- package/public/assets/{shared-Cp_kzH_a.js → shared-C47BfV_u.js} +1 -1
- package/public/assets/{trash-2-Chg8CwQf.js → trash-2-BLc5o7DN.js} +1 -1
- package/public/index.html +4 -4
- package/public/assets/plus-CCwmaxw3.js +0 -1
package/README.md
CHANGED
|
@@ -280,6 +280,11 @@ Configuration is environment variables, read from the installation's `.env`:
|
|
|
280
280
|
| `OMNI_LOG_LEVEL` | No | `info` | Stdout threshold: `debug`, `info`, `warn`, or `error` |
|
|
281
281
|
| `OMNI_LOG_FILE` | No | the systemd journal, when there is one | Where stdout was already redirected, so the Console screen can read it back. Names a file; does not create one |
|
|
282
282
|
| `OMNI_BODY_LOGGING_ALLOWED` | No | unset | Permits request/response body capture on this installation. Read at boot. Capture also needs the runtime setting; see [Recording bodies](docs/operations.md#recording-bodies) |
|
|
283
|
+
| `OMNI_METRICS_TOKEN` | No | unset | Registers authenticated `GET /metrics`; unset means no route |
|
|
284
|
+
| `OMNI_METRICS_MAX_SERIES` | No | `5000` | Series cap before new `api_key_id` values fold to `other` |
|
|
285
|
+
| `OMNI_OTLP_ENDPOINT` | No | unset | Enables OTLP/HTTP span export to `<endpoint>/v1/traces` |
|
|
286
|
+
| `OMNI_OTLP_HEADERS` | No | unset | Comma-separated `k=v` headers sent to the collector |
|
|
287
|
+
| `OMNI_TRACE_SAMPLE` | No | `1.0` | Head sampling ratio from `0` to `1`; inbound sampled trace context is honoured |
|
|
283
288
|
| `OMNI_ROOT` | No | the installation in the current directory, else `~/.config/omnigateway` | Which installation the CLI acts on, when `--root` is not passed |
|
|
284
289
|
| `OMNI_PLUGIN_REGISTRY` | No | the public npm registry | Registry `omni plugin install <name>` resolves through; must be `https://` |
|
|
285
290
|
| `OMNI_CLUSTER_MODE` | No | unset | `true` selects [cluster mode](docs/deploying.md#running-more-than-one-gateway) and requires the two URLs below; unset is one process on SQLite, and then the URLs must be unset too |
|
|
@@ -371,6 +376,9 @@ Worth knowing before you deploy it:
|
|
|
371
376
|
caught earlier.
|
|
372
377
|
- Not in scope: semantic caching, billing.
|
|
373
378
|
|
|
379
|
+
What is missing on purpose, what is missing for now, and what is designed but not
|
|
380
|
+
built: [docs/roadmap.md](docs/roadmap.md).
|
|
381
|
+
|
|
374
382
|
## Security
|
|
375
383
|
|
|
376
384
|
- Treat `OMNI_ENCRYPTION_KEY`, gateway keys, and the SQLite file as secrets.
|
|
@@ -389,10 +397,10 @@ Worth knowing before you deploy it:
|
|
|
389
397
|
reads stdin — so they stay out of your shell history and the process table.
|
|
390
398
|
- Behind a reverse proxy, set `OMNI_BASE_URL` to the public HTTPS origin so
|
|
391
399
|
OAuth callbacks match what the providers have registered.
|
|
392
|
-
- The gateway talks to your providers and to nobody else
|
|
393
|
-
fonts
|
|
394
|
-
own, and `omni plugin verify <id>` shows exactly which ones it
|
|
395
|
-
does its manifest, which is a plain file you can read before installing.
|
|
400
|
+
- The gateway talks to your providers and to nobody else — except your collector, if you name
|
|
401
|
+
one with `OMNI_OTLP_ENDPOINT`. No CDN fonts or undeclared third-party origins. A plugin may
|
|
402
|
+
declare outbound origins of its own, and `omni plugin verify <id>` shows exactly which ones it
|
|
403
|
+
asked for — as does its manifest, which is a plain file you can read before installing.
|
|
396
404
|
- **Plugins run inside the gateway process, with its privileges** — the
|
|
397
405
|
capability context is a guardrail, not a sandbox. Read the
|
|
398
406
|
[security note](#plugins) before installing one you did not write.
|
package/bin/omni.js
CHANGED
|
@@ -23967,6 +23967,19 @@ function loadConfig(env) {
|
|
|
23967
23967
|
const bodyLoggingAllowed = TRUTHY.has((env.OMNI_BODY_LOGGING_ALLOWED ?? "").trim().toLowerCase());
|
|
23968
23968
|
const rawLogLevel = env.OMNI_LOG_LEVEL?.trim();
|
|
23969
23969
|
const logLevel = parseLogLevel(rawLogLevel);
|
|
23970
|
+
const metricsToken = env.OMNI_METRICS_TOKEN?.trim() || null;
|
|
23971
|
+
const rawMaxSeries = env.OMNI_METRICS_MAX_SERIES ?? "5000";
|
|
23972
|
+
const metricsMaxSeries = Number(rawMaxSeries);
|
|
23973
|
+
if (!DECIMAL_INTEGER.test(rawMaxSeries) || metricsMaxSeries < 1) {
|
|
23974
|
+
throw new Error(`OMNI_METRICS_MAX_SERIES must be a positive integer, got "${rawMaxSeries}"`);
|
|
23975
|
+
}
|
|
23976
|
+
const otlpEndpoint = env.OMNI_OTLP_ENDPOINT?.trim().replace(/\/+$/, "") || null;
|
|
23977
|
+
const otlpHeaders = env.OMNI_OTLP_HEADERS?.trim() || null;
|
|
23978
|
+
const rawTraceSample = env.OMNI_TRACE_SAMPLE ?? "1.0";
|
|
23979
|
+
const traceSample = Number(rawTraceSample);
|
|
23980
|
+
if (!Number.isFinite(traceSample) || traceSample < 0 || traceSample > 1) {
|
|
23981
|
+
throw new Error(`OMNI_TRACE_SAMPLE must be between 0 and 1, got "${rawTraceSample}"`);
|
|
23982
|
+
}
|
|
23970
23983
|
return {
|
|
23971
23984
|
logLevel: logLevel ?? "info",
|
|
23972
23985
|
logLevelFallbackFrom: logLevel === null && rawLogLevel ? rawLogLevel : null,
|
|
@@ -23980,7 +23993,12 @@ function loadConfig(env) {
|
|
|
23980
23993
|
logFile: logFile === undefined || logFile.length === 0 ? null : logFile,
|
|
23981
23994
|
clusterMode,
|
|
23982
23995
|
databaseUrl: clusterMode ? databaseUrl ?? null : null,
|
|
23983
|
-
redisUrl: clusterMode ? redisUrl ?? null : null
|
|
23996
|
+
redisUrl: clusterMode ? redisUrl ?? null : null,
|
|
23997
|
+
metricsToken,
|
|
23998
|
+
metricsMaxSeries,
|
|
23999
|
+
otlpEndpoint,
|
|
24000
|
+
otlpHeaders,
|
|
24001
|
+
traceSample
|
|
23984
24002
|
};
|
|
23985
24003
|
}
|
|
23986
24004
|
// packages/control/src/oauth/pending.ts
|
|
@@ -24179,7 +24197,8 @@ function codecAdapter(id, capabilities2, codec2, origins) {
|
|
|
24179
24197
|
const res = await req.http({
|
|
24180
24198
|
provider: id,
|
|
24181
24199
|
...sendable,
|
|
24182
|
-
signal: req.signal
|
|
24200
|
+
signal: req.signal,
|
|
24201
|
+
...req.requestId === undefined ? {} : { requestId: req.requestId }
|
|
24183
24202
|
});
|
|
24184
24203
|
if (res.status < 200 || res.status >= 300) {
|
|
24185
24204
|
const text = await res.text().catch(() => "");
|
|
@@ -27548,15 +27567,28 @@ function nodeHttpClient(options = {}) {
|
|
|
27548
27567
|
const startedAt = now();
|
|
27549
27568
|
let traced = false;
|
|
27550
27569
|
const trace = (status, failed = false) => {
|
|
27551
|
-
if (traced
|
|
27570
|
+
if (traced)
|
|
27552
27571
|
return;
|
|
27553
27572
|
traced = true;
|
|
27573
|
+
const durationMs = now() - startedAt;
|
|
27574
|
+
try {
|
|
27575
|
+
options.onResponseHead?.({
|
|
27576
|
+
provider: req.provider,
|
|
27577
|
+
host: url2.host,
|
|
27578
|
+
path: url2.pathname,
|
|
27579
|
+
...status === undefined ? {} : { status },
|
|
27580
|
+
durationMs,
|
|
27581
|
+
...req.requestId === undefined ? {} : { requestId: req.requestId }
|
|
27582
|
+
});
|
|
27583
|
+
} catch {}
|
|
27584
|
+
if (!logger2.enabled("debug"))
|
|
27585
|
+
return;
|
|
27554
27586
|
logger2.debug("upstream http", {
|
|
27555
27587
|
provider: req.provider,
|
|
27556
27588
|
status,
|
|
27557
27589
|
host: url2.host,
|
|
27558
27590
|
path: url2.pathname,
|
|
27559
|
-
durationMs
|
|
27591
|
+
durationMs,
|
|
27560
27592
|
reason: failed ? "transport error" : undefined
|
|
27561
27593
|
});
|
|
27562
27594
|
};
|
|
@@ -33702,7 +33734,7 @@ function createServiceDeps(input2) {
|
|
|
33702
33734
|
}
|
|
33703
33735
|
|
|
33704
33736
|
// apps/cli/src/version.ts
|
|
33705
|
-
var VERSION = "0.9.
|
|
33737
|
+
var VERSION = "0.9.2";
|
|
33706
33738
|
|
|
33707
33739
|
// apps/cli/src/commands/service.ts
|
|
33708
33740
|
function gatewayArgv(root) {
|