feat: add pure ssh2 remote operations

This commit is contained in:
云服务部-叶林立
2026-08-21 19:51:43 +08:00
parent d3bf562189
commit 0ac50eb581
62 changed files with 3701 additions and 47 deletions
+24
View File
@@ -318,6 +318,10 @@ await runTest("session_start refreshes RTK provenance and runtime guard skips mi
assert.equal(rewriteCalls, 1);
assert.ok((rewrittenEvent.input as { command: string }).command.includes("rtk git status"));
const remoteEvent = { toolName: "ssh_bash", input: { command: "git status" } };
await toolCallHandler(remoteEvent, createNotificationContext(notifications));
assert.equal(remoteEvent.input.command, "git status");
assert.equal(rewriteCalls, 1, "ssh_bash output support must not enable remote command rewriting");
assert.ok(execCommands.includes("/opt/rtk/bin/rtk"));
writeTestConfig(false);
});
@@ -367,6 +371,26 @@ await runTest("tool execution lifecycle sanitizes streamed bash output", async (
};
await endHandler(endEvent, {});
assert.equal(firstText(endEvent.result.content), "error: build failed\n");
await startHandler(
{ toolName: "ssh_bash", toolCallId: "ssh-bash-1", args: { command: "npm test" } },
{},
);
const remoteUpdate = {
toolName: "ssh_bash",
toolCallId: "ssh-bash-1",
args: { command: "npm test" },
partialResult: { content: [{ type: "text", text: "\x1B[32mremote test\x1B[0m\n" }] },
};
await updateHandler(remoteUpdate, {});
assert.equal(firstText(remoteUpdate.partialResult.content), "remote test\n");
const remoteEnd = {
toolName: "ssh_bash",
toolCallId: "ssh-bash-1",
result: { content: [{ type: "text", text: "\x1B[31mremote failed\x1B[0m\n" }] },
};
await endHandler(remoteEnd, {});
assert.equal(firstText(remoteEnd.result.content), "remote failed\n");
});
await runTest("tool_result lifecycle merges compaction metadata with existing details", async () => {