mirror of
https://github.com/binaricat/Netcatty.git
synced 2026-11-17 04:50:52 +00:00
* feat(plugins): add privileged terminal data pipeline * fix(plugins): harden terminal interceptor lifecycle * fix(plugins): close terminal interceptor lifecycle gaps * fix(plugins): preserve terminal interceptor state transitions * fix(plugin): close terminal pipeline lifecycle gaps * fix(plugin): harden terminal interceptor startup * fix(plugin): isolate terminal output route attempts * fix(plugin): isolate reused terminal sessions * fix(plugin): harden terminal interceptor boundaries * fix(plugin): harden terminal replay metadata * fix(plugin): preserve terminal replay provenance * fix(plugin): close terminal pipeline lifecycle races * fix(plugin): harden terminal route handoff * fix(plugin): contain terminal handoff failures * fix(plugin): route terminal attachment through RPC * fix(plugin): validate terminal attachment RPC * fix(plugin): close unexpected runtime ports * fix(plugin): canonicalize terminal data frames * fix(plugin): close terminal pipeline lifecycle gaps * fix(plugin): close terminal interceptor review gaps * fix(plugin): harden terminal interceptor protocol handling * fix(plugin): preserve terminal flow compatibility * fix(plugin): preserve terminal protocol accounting * fix(plugin): bound terminal interceptor lifecycle * fix(plugin): close terminal interceptor review gaps --------- Co-authored-by: ryan-wong-coder <wangsiyuan19990317@gmail.com>
54 lines
1.7 KiB
TypeScript
54 lines
1.7 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
|
|
import { broadcastTerminalPasteData } from "./hooks/useTerminalContextActions";
|
|
|
|
test("terminal context paste reports whether it broadcast to peers", () => {
|
|
const broadcasted: Array<{ data: string; sessionId: string }> = [];
|
|
|
|
const didBroadcast = broadcastTerminalPasteData("line one", {
|
|
sourceSessionId: "workspace-session-1",
|
|
sessionRef: { current: "backend-session-1" },
|
|
isBroadcastEnabledRef: { current: true },
|
|
onBroadcastInputRef: {
|
|
current: (data, sourceSessionId) => {
|
|
broadcasted.push({ data, sessionId: sourceSessionId });
|
|
},
|
|
},
|
|
});
|
|
|
|
assert.equal(didBroadcast, true);
|
|
assert.deepEqual(broadcasted, [{ data: "line one", sessionId: "workspace-session-1" }]);
|
|
});
|
|
|
|
test("terminal context paste reports false when broadcast is disabled", () => {
|
|
const didBroadcast = broadcastTerminalPasteData("line one", {
|
|
sourceSessionId: "workspace-session-1",
|
|
sessionRef: { current: "session-1" },
|
|
isBroadcastEnabledRef: { current: false },
|
|
onBroadcastInputRef: {
|
|
current: () => {
|
|
throw new Error("broadcast should not run");
|
|
},
|
|
},
|
|
});
|
|
|
|
assert.equal(didBroadcast, false);
|
|
});
|
|
|
|
test("terminal context paste never broadcasts password-prompt input", () => {
|
|
const didBroadcast = broadcastTerminalPasteData("secret", {
|
|
sourceSessionId: "workspace-session-1",
|
|
sessionRef: { current: "session-1" },
|
|
isBroadcastEnabledRef: { current: true },
|
|
passwordPromptActiveRef: { current: true },
|
|
onBroadcastInputRef: {
|
|
current: () => {
|
|
throw new Error("sensitive paste must not broadcast");
|
|
},
|
|
},
|
|
});
|
|
|
|
assert.equal(didBroadcast, false);
|
|
});
|