@serverkgg/bridge 0.1.12 → 0.1.14
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 +1 -1
- package/rules/package.md +2 -1
- package/src/bot/botDeploy.test.ts +57 -0
- package/src/bot/botEnvironment.test.ts +21 -0
- package/src/bot/botEnvironment.ts +10 -0
- package/src/bot/botRun.test.ts +296 -0
- package/src/bot/botRun.ts +109 -0
- package/src/bot/botState.test.ts +34 -1
- package/src/bot/botState.ts +1 -0
- package/src/bot/botVariables.test.ts +22 -0
- package/src/bot/botVariables.ts +3 -0
- package/src/bot/detect/detect.test.ts +172 -0
- package/src/bot/detect/detect.ts +31 -0
- package/src/bot/detect/detectResult.ts +1 -0
- package/src/bot/detect/detectTable.test.ts +25 -2
- package/src/bot/detect/detectTable.ts +24 -1
- package/src/bot/detect/keys.test.ts +7 -0
- package/src/bot/detect/keys.ts +3 -0
- package/src/bot/detect/serverkJson.test.ts +21 -0
- package/src/bot/detect/serverkJson.ts +13 -1
- package/src/bot/index.ts +1 -0
- package/src/cli/link.ts +3 -3
- package/src/cli/main.ts +8 -0
- package/src/cli/readme.test.ts +470 -0
- package/src/cli/readme.ts +570 -0
- package/src/cli/validate.test.ts +41 -1
- package/src/cli/validate.ts +25 -0
- package/src/context/bridgeContext.ts +1 -0
- package/src/modules/bridgeModule.ts +2 -0
- package/src/protocol/bridgeFrame.ts +1 -0
- package/src/protocol/bridgeManifest.ts +1 -0
- package/src/runtime/bridgeContext.test.ts +6 -0
- package/src/runtime/bridgeContext.ts +7 -2
- package/src/runtime/bridgeExec.test.ts +150 -0
- package/src/runtime/bridgeExec.ts +67 -19
- package/src/runtime/bridgeLog.ts +9 -0
- package/src/runtime/bridgeRedaction.test.ts +28 -2
- package/src/runtime/bridgeRedaction.ts +7 -1
- package/src/runtime/bridgeRegistry.test.ts +30 -0
- package/src/runtime/bridgeRegistry.ts +1 -0
- package/src/runtime/bridgeSample.test.ts +63 -0
- package/src/runtime/bridgeSample.ts +22 -0
- package/src/runtime/bridgeScopedContext.ts +3 -0
- package/src/runtime/bridgeSetupHandlers.test.ts +3 -0
- package/src/runtime/bridgeSupervisor.ts +2 -6
- package/src/runtime/serve.ts +12 -12
- package/src/wire/panel.test.ts +32 -0
- package/src/wire/panel.ts +1 -0
package/src/runtime/serve.ts
CHANGED
|
@@ -19,10 +19,17 @@ import { validateDriver } from "./bridgeDriver";
|
|
|
19
19
|
import { createEventRing } from "./bridgeEvents";
|
|
20
20
|
import { decideInstall, recountHold } from "./bridgeInstall";
|
|
21
21
|
import { createBridgeLiveConfig } from "./bridgeLiveConfig";
|
|
22
|
-
import { errorDetail, errorText, log as stdoutLog } from "./bridgeLog";
|
|
22
|
+
import { errorDetail, errorText, print, log as stdoutLog } from "./bridgeLog";
|
|
23
23
|
import { pendingResult, rejectedPending, unsupportedPending } from "./bridgePending";
|
|
24
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
createBridgeRedaction,
|
|
26
|
+
redactLocalized,
|
|
27
|
+
redactLogger,
|
|
28
|
+
redactPrinter,
|
|
29
|
+
secretFieldKeys,
|
|
30
|
+
} from "./bridgeRedaction";
|
|
25
31
|
import { createRegistry } from "./bridgeRegistry";
|
|
32
|
+
import { idleSample, sampleResultOf } from "./bridgeSample";
|
|
26
33
|
import { createServer } from "./bridgeServer";
|
|
27
34
|
import { setupSummaryOf } from "./bridgeSetup";
|
|
28
35
|
import { createSetupHandlers } from "./bridgeSetupHandlers";
|
|
@@ -182,6 +189,7 @@ export const serve = async (driver: BridgeDriver) => {
|
|
|
182
189
|
supervisor,
|
|
183
190
|
{
|
|
184
191
|
onLog: log,
|
|
192
|
+
onPrint: redactPrinter(print, redact),
|
|
185
193
|
onEmit(event, payload) {
|
|
186
194
|
ring.emit(event, payload);
|
|
187
195
|
},
|
|
@@ -259,10 +267,7 @@ export const serve = async (driver: BridgeDriver) => {
|
|
|
259
267
|
}
|
|
260
268
|
|
|
261
269
|
if (!supervisor.running) {
|
|
262
|
-
return
|
|
263
|
-
online: null,
|
|
264
|
-
max: null,
|
|
265
|
-
};
|
|
270
|
+
return idleSample();
|
|
266
271
|
}
|
|
267
272
|
|
|
268
273
|
const stamp = performance.now();
|
|
@@ -271,12 +276,7 @@ export const serve = async (driver: BridgeDriver) => {
|
|
|
271
276
|
return sampled.value;
|
|
272
277
|
}
|
|
273
278
|
|
|
274
|
-
const
|
|
275
|
-
|
|
276
|
-
const value: BridgeSampleResult = {
|
|
277
|
-
online: result.online,
|
|
278
|
-
max: result.max,
|
|
279
|
-
};
|
|
279
|
+
const value = sampleResultOf(await query.sample(context));
|
|
280
280
|
|
|
281
281
|
sampled = {
|
|
282
282
|
value,
|
package/src/wire/panel.test.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
BridgePlace,
|
|
14
14
|
type BridgeSetupManifest,
|
|
15
15
|
BridgeSetupStepKind,
|
|
16
|
+
type BridgeTerminalManifest,
|
|
16
17
|
BridgeUploadMode,
|
|
17
18
|
} from "@serverkgg/bridge/protocol";
|
|
18
19
|
import { bridgeAvailabilitySchema, bridgeCellsSchema, bridgeManifestSchema } from "./panel";
|
|
@@ -783,3 +784,34 @@ describe("the availability schema", () => {
|
|
|
783
784
|
expect(parsed.modules[0]?.actions).toContain(BridgeAction.Availability);
|
|
784
785
|
});
|
|
785
786
|
});
|
|
787
|
+
|
|
788
|
+
const terminalManifest = (shell: boolean): BridgeManifest => ({
|
|
789
|
+
version: "1.0.0",
|
|
790
|
+
panel: null,
|
|
791
|
+
terminal: {
|
|
792
|
+
commands: [],
|
|
793
|
+
rules: [],
|
|
794
|
+
shell,
|
|
795
|
+
},
|
|
796
|
+
setup: null,
|
|
797
|
+
modules: [],
|
|
798
|
+
events: [],
|
|
799
|
+
});
|
|
800
|
+
|
|
801
|
+
describe("the terminal mirror", () => {
|
|
802
|
+
it("carries the shell flag through unchanged", () => {
|
|
803
|
+
expect(bridgeManifestSchema.parse(terminalManifest(true)).terminal?.shell).toBe(true);
|
|
804
|
+
});
|
|
805
|
+
|
|
806
|
+
it("defaults a terminal from an older bridge that carries no shell flag to false", () => {
|
|
807
|
+
const older = terminalManifest(true);
|
|
808
|
+
|
|
809
|
+
delete (older.terminal as Partial<BridgeTerminalManifest>).shell;
|
|
810
|
+
|
|
811
|
+
expect(bridgeManifestSchema.parse(older).terminal).toEqual({
|
|
812
|
+
commands: [],
|
|
813
|
+
rules: [],
|
|
814
|
+
shell: false,
|
|
815
|
+
});
|
|
816
|
+
});
|
|
817
|
+
});
|
package/src/wire/panel.ts
CHANGED
|
@@ -318,6 +318,7 @@ export const bridgeTerminalRuleSchema: z.ZodType<BridgeTerminalRuleManifest> = z
|
|
|
318
318
|
export const bridgeTerminalManifestSchema: z.ZodType<BridgeTerminalManifest> = z.object({
|
|
319
319
|
commands: z.array(bridgeTerminalCommandSchema).max(128),
|
|
320
320
|
rules: z.array(bridgeTerminalRuleSchema).max(64),
|
|
321
|
+
shell: z.boolean().default(false),
|
|
321
322
|
});
|
|
322
323
|
|
|
323
324
|
const setupStepBase = {
|