@jeffusion/bungee 5.26.0 → 6.0.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 +26 -5
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -3502,7 +3502,7 @@ import { createInterface } from "node:readline";
|
|
|
3502
3502
|
// package.json
|
|
3503
3503
|
var package_default = {
|
|
3504
3504
|
name: "@jeffusion/bungee",
|
|
3505
|
-
version: "
|
|
3505
|
+
version: "6.0.1",
|
|
3506
3506
|
description: "High-performance reverse proxy server CLI",
|
|
3507
3507
|
type: "module",
|
|
3508
3508
|
bin: {
|
|
@@ -5908,6 +5908,11 @@ async function openRecoveryInputFile(path, options = {}) {
|
|
|
5908
5908
|
|
|
5909
5909
|
// src/commands/recover.ts
|
|
5910
5910
|
async function recoverCommand(options = {}) {
|
|
5911
|
+
const interactive = options.plugin !== undefined || options.action !== undefined;
|
|
5912
|
+
if (interactive && (options.file !== undefined || !options.plugin || !/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/.test(options.plugin) || !["issue-setup-code", "reset", "release-auth"].includes(options.action ?? "")))
|
|
5913
|
+
throw new Error("invalid_recovery_arguments");
|
|
5914
|
+
if (interactive && (!process.stdin.isTTY || !process.stdout.isTTY))
|
|
5915
|
+
throw new Error("recovery_requires_terminal");
|
|
5911
5916
|
const db = resolve4(process.env.BUNGEE_CONFIG_DB_PATH ?? join8(ConfigPaths.DATA_DIR, "bungee.db"));
|
|
5912
5917
|
let file;
|
|
5913
5918
|
try {
|
|
@@ -5917,7 +5922,13 @@ async function recoverCommand(options = {}) {
|
|
|
5917
5922
|
const key = await readPluginSecretsKey(db);
|
|
5918
5923
|
const launch = await resolveCoreLaunchDescriptor(options);
|
|
5919
5924
|
await new Promise((accept, reject) => {
|
|
5920
|
-
const
|
|
5925
|
+
const args = [
|
|
5926
|
+
...launch.entrypoint === null ? [] : [launch.entrypoint],
|
|
5927
|
+
"--recover",
|
|
5928
|
+
db,
|
|
5929
|
+
...interactive ? ["--plugin", options.plugin, "--action", options.action] : []
|
|
5930
|
+
];
|
|
5931
|
+
const child = spawn3(launch.executable, args, { cwd: dirname3(db), stdio: [file?.fd ?? "inherit", "inherit", "inherit"], env: { ...withPluginSecretsKey(process.env, key), BUNGEE_ROLE: "master", BUNGEE_ACCESS_DB_PATH: process.env.BUNGEE_ACCESS_DB_PATH ?? join8(ConfigPaths.LOGS_DIR, "access.db") } });
|
|
5921
5932
|
child.once("error", reject);
|
|
5922
5933
|
child.once("exit", (code) => code === 0 ? accept() : reject(new Error("Offline recovery failed")));
|
|
5923
5934
|
});
|
|
@@ -6267,12 +6278,22 @@ function createProgram() {
|
|
|
6267
6278
|
}
|
|
6268
6279
|
});
|
|
6269
6280
|
program.command("init").description("Initialize the Bungee SQLite data directory and persistent plugin secrets key").option("--plugin-secrets-key <base64>", "Initialize with a canonical Base64 key for 32 bytes (otherwise use BUNGEE_PLUGIN_SECRETS_KEY or generate one)").action(initCommand);
|
|
6270
|
-
program.command("recover").description("Recover a stopped instance using
|
|
6281
|
+
program.command("recover").description("Recover a stopped instance using plugin terminal actions or bounded JSON").option("--file <path>", "Owner-only 0600 recovery JSON input file").option("--plugin <name>", "Management plugin for an interactive offline action").option("--action <action>", "Terminal action: issue-setup-code, reset, or release-auth").addHelpText("after", `
|
|
6271
6282
|
Stop the instance first. Supply one JSON object via stdin or bungee recover --file recovery.json (chmod 600).
|
|
6272
|
-
|
|
6283
|
+
Initialize management access: bungee recover --plugin user-auth --action issue-setup-code
|
|
6284
|
+
Reset identity: bungee recover --plugin user-auth --action reset
|
|
6285
|
+
Release required authentication locally: bungee recover --plugin user-auth --action release-auth
|
|
6286
|
+
These actions require a terminal. Reset asks for the plugin's fields and recovery reason; secret fields are hidden.
|
|
6273
6287
|
Unresolved usage: {"kind":"plugin-state","plugin":"token-budget","payload":{"keyId":"KEY_ID","requestId":"REQUEST_ID","attemptId":"ATTEMPT_ID","inputTokens":100,"outputTokens":200,"reason":"Verified usage evidence"}}
|
|
6274
6288
|
Usage counts are replacement totals for the specified attempt, applied to its original period.
|
|
6275
|
-
`).action(
|
|
6289
|
+
`).action(async (options) => {
|
|
6290
|
+
try {
|
|
6291
|
+
await recoverCommand(options);
|
|
6292
|
+
} catch (error) {
|
|
6293
|
+
console.error(error instanceof Error && error.message === "recovery_requires_terminal" ? "Offline recovery action requires an interactive terminal." : "Offline recovery failed; no recovery input is logged.");
|
|
6294
|
+
process.exitCode = 1;
|
|
6295
|
+
}
|
|
6296
|
+
});
|
|
6276
6297
|
program.command("start").description("Start proxy server as daemon").option("-p, --port <port>", "Override default port").option("-w, --workers <count>", "Number of worker processes", "2").option("-d, --detach", "Run as daemon (default)", true).option("--auto-upgrade", "Automatically upgrade binary if version mismatch").action(startCommand);
|
|
6277
6298
|
program.command("stop").description("Stop proxy server daemon").action(stopCommand);
|
|
6278
6299
|
program.command("restart").description("Restart proxy server daemon").option("-p, --port <port>", "Override default port").option("-w, --workers <count>", "Number of worker processes", "2").option("--auto-upgrade", "Automatically upgrade binary if version mismatch").action(restartCommand);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jeffusion/bungee",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.1",
|
|
4
4
|
"description": "High-performance reverse proxy server CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"test": "bun test"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@jeffusion/bungee-core": "^
|
|
17
|
-
"@jeffusion/bungee-types": "^
|
|
16
|
+
"@jeffusion/bungee-core": "^6.0.1",
|
|
17
|
+
"@jeffusion/bungee-types": "^6.0.1",
|
|
18
18
|
"cli-progress": "^3.12.0",
|
|
19
19
|
"commander": "^14.0.1"
|
|
20
20
|
},
|