feat(plugins): add reviewed privileged terminal data pipeline (#2402)

* 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>
This commit is contained in:
陈大猫andryan-wong-coder authored and GitHub committed 2026-07-23 09:42:47 +08:00
1 parent 34c4efb225
commit 67f8108713
101 files changed
+8475 -396

No files matched your search

+45
View File
@@ -89,6 +89,51 @@ test("createScriptRuntime executes simple log script", async () => {
assert.deepEqual(logs, ["hello"]);
});
test("sensitive script input is masked in UI and logs and remains host-bypassed", async () => {
const logs = [];
const writes = [];
const dialogs = [];
const runtime = createScriptRuntime({
sessionId: "s1",
runId: "r-sensitive",
appendLog: (_id, message) => logs.push(message),
writeToSession: (sessionId, data, options) => writes.push({ sessionId, data, options }),
getOutputBuffer: () => ({
getText: () => "",
consumeThroughAbsolute() {},
}),
getSessionMeta: () => ({ connected: true, hostname: "host", username: "user" }),
showDialog: async (...args) => {
dialogs.push(args);
return "super-secret";
},
isPaused: () => false,
isAborted: () => false,
onStatusChange: () => {},
});
await runtime.execute(`
const value = await nct.dialog.prompt("Secret", "", { sensitive: true });
await nct.screen.sendLine(value, { sensitive: true });
`);
assert.deepEqual(dialogs[0], ["prompt", "Secret", "", { sensitive: true }]);
assert.deepEqual(writes, [
{
sessionId: "s1",
data: "super-secret",
options: { automated: true, sensitive: true, invalidateStartupSeed: false },
},
{
sessionId: "s1",
data: "\r",
options: { automated: true, sensitive: true, invalidateStartupSeed: false },
},
]);
assert.equal(logs.some((entry) => entry.includes("super-secret")), false);
assert.equal(logs.some((entry) => entry.includes("[sensitive]")), true);
});
test("createScriptRuntime supports regex waits over multiline output", async () => {
const logs = [];
const buffer = new SessionOutputBuffer("s1");