跳到主要内容

Claude Cage · 面向 Claude 的隔离开发环境,支持桌面工作台、多账号、远程部署与移动端连接。上游 Lee-xeo/Claude-Cage 完整源码镜像,非灵栈原创;主许可 MIT,第三方组件遵循各自许可。来源:https://github.com/Lee-xeo/Claude-Cage 。手动同步,不附带 Release 安装包。

浏览文件

terminal-clipboard.test.mjs

17 行 · 919 B历史下载
1import test from "node:test";
2import assert from "node:assert/strict";
3import { terminalClipboardText } from "./terminal-clipboard.mjs";
4
5test("OSC 52 accepts UTF-8 clipboard writes within the shared clipboard limit", () => {
6 const text = "Claude 回复\n含有换行和 emoji 🖼️";
7 assert.equal(terminalClipboardText(`c;${Buffer.from(text).toString("base64")}`), text);
8 assert.equal(terminalClipboardText(";"), "");
9 const maximum = "x".repeat(2 * 1024 * 1024);
10 assert.equal(terminalClipboardText(`c;${Buffer.from(maximum).toString("base64")}`), maximum);
11 assert.equal(terminalClipboardText(`c;${Buffer.from(maximum + "x").toString("base64")}`), undefined);
12});
13
14test("OSC 52 ignores clipboard reads, other selections and malformed content", () => {
15 for (const value of ["c;?", "p;eA==", "c", "c;%%%", "c;eA", "c;e===", "c;/w=="])
16 assert.equal(terminalClipboardText(value), undefined, value);
17});