@serverkgg/bridge 0.1.1 → 0.1.3
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/package.json +3 -2
- package/rules/package.md +60 -0
- package/src/blog/articleFrontmatter.test.ts +10 -10
- package/src/blog/compile.test.ts +9 -9
- package/src/bot/botDeploy.test.ts +16 -16
- package/src/bot/botEnvironment.test.ts +8 -8
- package/src/bot/botIdentity.test.ts +12 -12
- package/src/bot/botPanel.test.ts +41 -11
- package/src/bot/botPanel.ts +13 -5
- package/src/bot/botState.test.ts +3 -3
- package/src/bot/botTerminal.test.ts +5 -5
- package/src/bot/botVariables.test.ts +8 -8
- package/src/bot/detect/botToken.test.ts +6 -6
- package/src/bot/detect/detect.test.ts +21 -21
- package/src/bot/detect/detectTable.test.ts +5 -5
- package/src/bot/detect/envExample.test.ts +2 -2
- package/src/bot/detect/envScan.test.ts +4 -4
- package/src/bot/detect/inferBotPlatform.test.ts +4 -4
- package/src/bot/detect/keys.test.ts +3 -3
- package/src/bot/detect/sensitiveKey.test.ts +5 -5
- package/src/bot/detect/serverkJson.test.ts +5 -5
- package/src/catalogs/curseforge.test.ts +35 -35
- package/src/catalogs/thunderstore.test.ts +9 -9
- package/src/cli/detectTable.test.ts +3 -3
- package/src/cli/link.test.ts +11 -11
- package/src/cli/main.ts +8 -0
- package/src/cli/rules.test.ts +198 -0
- package/src/cli/rules.ts +188 -0
- package/src/cli/validate.test.ts +123 -29
- package/src/cli/validate.ts +37 -1
- package/src/codecs/ini.test.ts +13 -13
- package/src/codecs/javaProperties.test.ts +11 -11
- package/src/codecs/sourceCfg.test.ts +14 -14
- package/src/codecs/xmlProperties.test.ts +10 -10
- package/src/context/bridgeContext.ts +6 -1
- package/src/core/bridgeAction.ts +2 -0
- package/src/core/bridgeActivity.ts +9 -0
- package/src/core/bridgeAvailability.ts +10 -0
- package/src/core/bridgePort.test.ts +6 -6
- package/src/core/bridgeUserError.test.ts +13 -3
- package/src/core/bridgeUserError.ts +6 -2
- package/src/core/bridgeValue.test.ts +5 -5
- package/src/core/describeDownloadFailure.test.ts +58 -0
- package/src/core/describeDownloadFailure.ts +69 -0
- package/src/core/index.ts +3 -0
- package/src/guides/markdown.test.ts +31 -31
- package/src/install/installStamp.test.ts +9 -9
- package/src/manifest/extension.ts +36 -0
- package/src/manifest/index.ts +1 -0
- package/src/manifest/manifest.test.ts +208 -90
- package/src/manifest/manifest.ts +34 -0
- package/src/modules/bridge.ts +8 -1
- package/src/modules/bridgeModule.ts +13 -1
- package/src/net/loopback.test.ts +10 -10
- package/src/panel/bridgeDetail.ts +2 -1
- package/src/presence/rosterSync.test.ts +7 -7
- package/src/probes/a2s.test.ts +5 -5
- package/src/probes/minecraftPing.test.ts +17 -17
- package/src/probes/raknetPing.test.ts +13 -13
- package/src/protocol/bridgeActivity.ts +54 -0
- package/src/protocol/bridgeEvents.ts +30 -0
- package/src/protocol/bridgeFrame.ts +10 -1
- package/src/protocol/index.ts +1 -0
- package/src/rcon/rconAccess.test.ts +20 -20
- package/src/rcon/rconAccess.ts +13 -13
- package/src/rcon/rconClient.test.ts +49 -49
- package/src/rcon/rconFrame.test.ts +14 -14
- package/src/rcon/rconIds.test.ts +4 -4
- package/src/rcon/rconWriter.test.ts +6 -6
- package/src/runtime/bridgeActions.ts +19 -2
- package/src/runtime/bridgeActivity.test.ts +318 -0
- package/src/runtime/bridgeActivity.ts +268 -0
- package/src/runtime/bridgeBackupLease.test.ts +9 -9
- package/src/runtime/bridgeConfigReader.test.ts +5 -5
- package/src/runtime/bridgeConsoleHandler.test.ts +8 -8
- package/src/runtime/bridgeContext.test.ts +11 -5
- package/src/runtime/bridgeContext.ts +8 -1
- package/src/runtime/bridgeDriver.test.ts +114 -93
- package/src/runtime/bridgeDriver.ts +10 -7
- package/src/runtime/bridgeEvents.test.ts +15 -15
- package/src/runtime/bridgeFiles.test.ts +54 -54
- package/src/runtime/bridgeInstall.test.ts +10 -10
- package/src/runtime/bridgeLiveConfig.test.ts +6 -6
- package/src/runtime/bridgeLog.ts +10 -0
- package/src/runtime/bridgePending.test.ts +6 -6
- package/src/runtime/bridgeRedaction.test.ts +16 -16
- package/src/runtime/bridgeRefusalError.ts +13 -0
- package/src/runtime/bridgeRegistry.test.ts +1077 -34
- package/src/runtime/bridgeRegistry.ts +464 -65
- package/src/runtime/bridgeScopedContext.ts +55 -0
- package/src/runtime/bridgeServer.test.ts +424 -24
- package/src/runtime/bridgeServer.ts +125 -35
- package/src/runtime/bridgeSetup.test.ts +27 -27
- package/src/runtime/bridgeSetup.ts +1 -1
- package/src/runtime/bridgeSetupHandlers.test.ts +80 -17
- package/src/runtime/bridgeSetupHandlers.ts +45 -10
- package/src/runtime/bridgeSignal.test.ts +7 -7
- package/src/runtime/bridgeSupervisor.test.ts +42 -42
- package/src/runtime/serve.ts +45 -3
- package/src/steam/avatars.test.ts +13 -13
- package/src/steam/steamApp.test.ts +8 -8
- package/src/steam/steamcmd.test.ts +44 -13
- package/src/steam/steamcmd.ts +27 -4
- package/src/steam/steamcmdNarrator.test.ts +4 -4
- package/src/steam/workshop.test.ts +5 -5
- package/src/utils/changedSettingKeys.test.ts +65 -0
- package/src/utils/changedSettingKeys.ts +6 -0
- package/src/utils/describeExecFailure.test.ts +34 -0
- package/src/utils/describeExecFailure.ts +9 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/sameSettingValue.test.ts +35 -0
- package/src/utils/sameSettingValue.ts +40 -0
- package/src/utils/token.test.ts +7 -7
- package/src/wine/protonCommand.test.ts +5 -5
- package/src/wine/wineCommand.test.ts +6 -6
- package/src/wine/winePrefix.test.ts +6 -6
- package/src/wire/activity.test.ts +95 -0
- package/src/wire/activity.ts +41 -0
- package/src/wire/index.ts +1 -0
- package/src/wire/panel.test.ts +91 -25
- package/src/wire/panel.ts +11 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, expect,
|
|
1
|
+
import { describe, expect, it } from "bun:test";
|
|
2
2
|
import type { BridgeCommandOptions, BridgeContext, BridgeReply } from "../context";
|
|
3
3
|
import { BridgeKind, BridgeUserError } from "../core";
|
|
4
4
|
import type { BridgeDriver, BridgeTerminalModule } from "../modules";
|
|
@@ -60,7 +60,7 @@ const handlerFor = (driver: BridgeDriver) => {
|
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
describe("routing a console line to the driver before the game's stdin", () => {
|
|
63
|
-
|
|
63
|
+
it("answers with the driver's reply when the driver handles the line", async () => {
|
|
64
64
|
const { handler, written } = handlerFor(
|
|
65
65
|
driverWith(
|
|
66
66
|
terminalWith(async (_context, input) => {
|
|
@@ -81,7 +81,7 @@ describe("routing a console line to the driver before the game's stdin", () => {
|
|
|
81
81
|
expect(written).toEqual([]);
|
|
82
82
|
});
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
it("hands the driver the same line the caller typed", async () => {
|
|
85
85
|
const seen: string[] = [];
|
|
86
86
|
|
|
87
87
|
const { handler } = handlerFor(
|
|
@@ -105,7 +105,7 @@ describe("routing a console line to the driver before the game's stdin", () => {
|
|
|
105
105
|
]);
|
|
106
106
|
});
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
it("writes the line to stdin when the driver answers null", async () => {
|
|
109
109
|
const { handler, written } = handlerFor(
|
|
110
110
|
driverWith(
|
|
111
111
|
terminalWith(async () => {
|
|
@@ -124,7 +124,7 @@ describe("routing a console line to the driver before the game's stdin", () => {
|
|
|
124
124
|
]);
|
|
125
125
|
});
|
|
126
126
|
|
|
127
|
-
|
|
127
|
+
it("keeps the expect and timeout of a line the driver leaves alone", async () => {
|
|
128
128
|
const { handler } = handlerFor(
|
|
129
129
|
driverWith(
|
|
130
130
|
terminalWith(async () => {
|
|
@@ -143,7 +143,7 @@ describe("routing a console line to the driver before the game's stdin", () => {
|
|
|
143
143
|
).toBe("matched");
|
|
144
144
|
});
|
|
145
145
|
|
|
146
|
-
|
|
146
|
+
it("writes the line to stdin when the driver declares no handler", async () => {
|
|
147
147
|
const { handler, written } = handlerFor(
|
|
148
148
|
driverWith({
|
|
149
149
|
kind: BridgeKind.Terminal,
|
|
@@ -158,7 +158,7 @@ describe("routing a console line to the driver before the game's stdin", () => {
|
|
|
158
158
|
]);
|
|
159
159
|
});
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
it("writes the line to stdin when the game declares no terminal at all", async () => {
|
|
162
162
|
const { handler, written } = handlerFor(driverWith(undefined));
|
|
163
163
|
|
|
164
164
|
await handler("list", {});
|
|
@@ -168,7 +168,7 @@ describe("routing a console line to the driver before the game's stdin", () => {
|
|
|
168
168
|
]);
|
|
169
169
|
});
|
|
170
170
|
|
|
171
|
-
|
|
171
|
+
it("refuses the line with the driver's own text when the driver rejects it", async () => {
|
|
172
172
|
const refusal = {
|
|
173
173
|
ar: "هذا الأمر يشتغل داخل اللعبة بس.",
|
|
174
174
|
en: "That command only works inside the game.",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect,
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it } from "bun:test";
|
|
2
2
|
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
4
|
import { join } from "node:path";
|
|
@@ -38,7 +38,7 @@ describe("the context's variable maps", () => {
|
|
|
38
38
|
});
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
it("hand a driver every variable and secret the agent wrote, and follow a rewrite", async () => {
|
|
42
42
|
const boot = configWith(
|
|
43
43
|
{
|
|
44
44
|
MY_VAR: "1",
|
|
@@ -72,6 +72,9 @@ describe("the context's variable maps", () => {
|
|
|
72
72
|
onSetup() {
|
|
73
73
|
return;
|
|
74
74
|
},
|
|
75
|
+
onActivity() {
|
|
76
|
+
return;
|
|
77
|
+
},
|
|
75
78
|
async onRestart() {
|
|
76
79
|
return;
|
|
77
80
|
},
|
|
@@ -158,6 +161,9 @@ describe("the context's ports and address", () => {
|
|
|
158
161
|
onSetup() {
|
|
159
162
|
return;
|
|
160
163
|
},
|
|
164
|
+
onActivity() {
|
|
165
|
+
return;
|
|
166
|
+
},
|
|
161
167
|
async onRestart() {
|
|
162
168
|
return;
|
|
163
169
|
},
|
|
@@ -179,7 +185,7 @@ describe("the context's ports and address", () => {
|
|
|
179
185
|
});
|
|
180
186
|
});
|
|
181
187
|
|
|
182
|
-
|
|
188
|
+
it("hand a driver the block the agent published and its public address", async () => {
|
|
183
189
|
const boot = configWith({
|
|
184
190
|
portCounts: {
|
|
185
191
|
game: 1,
|
|
@@ -203,7 +209,7 @@ describe("the context's ports and address", () => {
|
|
|
203
209
|
expect(context.server.publicAddress).toBe("203.0.113.7");
|
|
204
210
|
});
|
|
205
211
|
|
|
206
|
-
|
|
212
|
+
it("treat every port as a single one and the address as unknown for a file an older agent wrote", async () => {
|
|
207
213
|
const boot = configWith({});
|
|
208
214
|
|
|
209
215
|
await writeFile(path, JSON.stringify(boot));
|
|
@@ -218,7 +224,7 @@ describe("the context's ports and address", () => {
|
|
|
218
224
|
expect(() => context.portBlock("query")).toThrow('this game declares no port named "query"');
|
|
219
225
|
});
|
|
220
226
|
|
|
221
|
-
|
|
227
|
+
it("follow a rewrite of the public address", async () => {
|
|
222
228
|
const boot = configWith({});
|
|
223
229
|
|
|
224
230
|
await writeFile(path, JSON.stringify(boot));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BridgeContext } from "../context";
|
|
2
|
-
import type { BridgeValues } from "../core";
|
|
2
|
+
import type { BridgeActivity, BridgeValues } from "../core";
|
|
3
3
|
import type { BridgeConfig, BridgeSetupRuntime } from "../protocol";
|
|
4
4
|
import { stripAnsi } from "../utils";
|
|
5
5
|
import { createBridgeCodecs } from "./bridgeCodec";
|
|
@@ -18,6 +18,7 @@ export interface ContextHooks {
|
|
|
18
18
|
onLog: BridgeLeveledLogger;
|
|
19
19
|
onEmit: (event: string, payload?: BridgeValues) => void;
|
|
20
20
|
onSetup: (runtime: BridgeSetupRuntime | null) => void;
|
|
21
|
+
onActivity: (entry: BridgeActivity) => void;
|
|
21
22
|
onRestart: () => Promise<void>;
|
|
22
23
|
}
|
|
23
24
|
|
|
@@ -141,6 +142,12 @@ export const createContext = (
|
|
|
141
142
|
},
|
|
142
143
|
},
|
|
143
144
|
|
|
145
|
+
activity: {
|
|
146
|
+
report(entry) {
|
|
147
|
+
hooks.onActivity(entry);
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
|
|
144
151
|
emit(event, payload) {
|
|
145
152
|
hooks.onEmit(event, payload);
|
|
146
153
|
},
|