fix: stabilize pty tests and media kind
This commit is contained in:
@@ -10,7 +10,7 @@ afterEach(() => {
|
|||||||
test("exec supports pty output", async () => {
|
test("exec supports pty output", async () => {
|
||||||
const tool = createExecTool({ allowBackground: false });
|
const tool = createExecTool({ allowBackground: false });
|
||||||
const result = await tool.execute("toolcall", {
|
const result = await tool.execute("toolcall", {
|
||||||
command: "node -e \"process.stdout.write('ok')\"",
|
command: 'node -e "process.stdout.write(String.fromCharCode(111,107))"',
|
||||||
pty: true,
|
pty: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ test("process send-keys encodes Enter for pty sessions", async () => {
|
|||||||
const processTool = createProcessTool();
|
const processTool = createProcessTool();
|
||||||
const result = await execTool.execute("toolcall", {
|
const result = await execTool.execute("toolcall", {
|
||||||
command:
|
command:
|
||||||
"node -e \"process.stdin.on('data', d => { process.stdout.write(d); if (d.includes(10) || d.includes(13)) process.exit(0); });\"",
|
'node -e "const dataEvent=String.fromCharCode(100,97,116,97);process.stdin.on(dataEvent,d=>{process.stdout.write(d);if(d.includes(10)||d.includes(13))process.exit(0);});"',
|
||||||
pty: true,
|
pty: true,
|
||||||
background: true,
|
background: true,
|
||||||
});
|
});
|
||||||
@@ -50,7 +50,7 @@ test("process submit sends Enter for pty sessions", async () => {
|
|||||||
const processTool = createProcessTool();
|
const processTool = createProcessTool();
|
||||||
const result = await execTool.execute("toolcall", {
|
const result = await execTool.execute("toolcall", {
|
||||||
command:
|
command:
|
||||||
"node -e \"process.stdin.on('data', d => { if (d.includes(10) || d.includes(13)) { process.stdout.write('submitted'); process.exit(0); } });\"",
|
'node -e "const dataEvent=String.fromCharCode(100,97,116,97);const submitted=String.fromCharCode(115,117,98,109,105,116,116,101,100);process.stdin.on(dataEvent,d=>{if(d.includes(10)||d.includes(13)){process.stdout.write(submitted);process.exit(0);}});"',
|
||||||
pty: true,
|
pty: true,
|
||||||
background: true,
|
background: true,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ export function resolveAttachmentKind(
|
|||||||
attachment: MediaAttachment,
|
attachment: MediaAttachment,
|
||||||
): "image" | "audio" | "video" | "document" | "unknown" {
|
): "image" | "audio" | "video" | "document" | "unknown" {
|
||||||
const kind = kindFromMime(attachment.mime);
|
const kind = kindFromMime(attachment.mime);
|
||||||
if (kind !== "unknown") return kind;
|
if (kind === "image" || kind === "audio" || kind === "video") return kind;
|
||||||
|
|
||||||
const ext = getFileExtension(attachment.path ?? attachment.url);
|
const ext = getFileExtension(attachment.path ?? attachment.url);
|
||||||
if (!ext) return "unknown";
|
if (!ext) return "unknown";
|
||||||
|
|||||||
Reference in New Issue
Block a user