refactor: gpt 스트림 오류 최소화
This commit is contained in:
@@ -14,20 +14,24 @@ import { createServices } from "../src/mcp-server.js";
|
||||
|
||||
const ALL_TOOLS = [
|
||||
"apply_patch",
|
||||
"cancel_managed_task",
|
||||
"chmod_path",
|
||||
"copy_path",
|
||||
"download_file",
|
||||
"exec_command",
|
||||
"hash_file",
|
||||
"list_directory",
|
||||
"list_managed_tasks",
|
||||
"list_processes",
|
||||
"make_directory",
|
||||
"move_path",
|
||||
"read_file",
|
||||
"read_managed_task",
|
||||
"read_process",
|
||||
"remove_path",
|
||||
"replace_in_file",
|
||||
"run_script",
|
||||
"start_managed_task",
|
||||
"stat_path",
|
||||
"terminate_process",
|
||||
"upload_file",
|
||||
@@ -40,20 +44,24 @@ type ToolResult = Awaited<ReturnType<Client["callTool"]>>;
|
||||
|
||||
const EXPECTED_ANNOTATIONS = {
|
||||
apply_patch: [false, true, false, false],
|
||||
cancel_managed_task: [false, true, false, false],
|
||||
chmod_path: [false, true, true, false],
|
||||
copy_path: [false, true, true, false],
|
||||
download_file: [true, false, true, false],
|
||||
exec_command: [false, true, false, true],
|
||||
hash_file: [true, false, true, false],
|
||||
list_directory: [true, false, true, false],
|
||||
list_managed_tasks: [true, false, true, false],
|
||||
list_processes: [true, false, true, false],
|
||||
make_directory: [false, false, true, false],
|
||||
move_path: [false, true, true, false],
|
||||
read_file: [true, false, true, false],
|
||||
read_managed_task: [true, false, true, false],
|
||||
read_process: [true, false, true, false],
|
||||
remove_path: [false, true, true, false],
|
||||
replace_in_file: [false, true, false, false],
|
||||
run_script: [false, true, false, true],
|
||||
start_managed_task: [false, true, false, true],
|
||||
stat_path: [true, false, true, false],
|
||||
terminate_process: [false, true, false, false],
|
||||
upload_file: [false, true, true, false],
|
||||
@@ -336,6 +344,56 @@ describe.sequential("all registered MCP tools", () => {
|
||||
waitMs: 2000,
|
||||
});
|
||||
expect(terminated).toMatchObject({ running: false, completed: true, signal: "SIGTERM" });
|
||||
|
||||
const managed = await callOk("start_managed_task", {
|
||||
taskKey: "e2e-managed-task",
|
||||
cmd: "printf 'managed-start\n'; sleep 0.1; printf 'BUILD SUCCESSFUL\n'",
|
||||
workdir: testRoot,
|
||||
initialWaitMs: 0,
|
||||
});
|
||||
expect(managed).toMatchObject({
|
||||
taskKey: "e2e-managed-task",
|
||||
running: true,
|
||||
reused: false,
|
||||
});
|
||||
const reusedManaged = await callOk("start_managed_task", {
|
||||
taskKey: "e2e-managed-task",
|
||||
cmd: "printf 'managed-start\n'; sleep 0.1; printf 'BUILD SUCCESSFUL\n'",
|
||||
workdir: testRoot,
|
||||
initialWaitMs: 0,
|
||||
});
|
||||
expect(reusedManaged).toMatchObject({
|
||||
sessionId: managed.sessionId,
|
||||
reused: true,
|
||||
});
|
||||
const listedManaged = await callOk("list_managed_tasks");
|
||||
expect(listedManaged.tasks).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({ taskKey: "e2e-managed-task" }),
|
||||
]),
|
||||
);
|
||||
const finishedManaged = await callOk("read_managed_task", {
|
||||
taskKey: "e2e-managed-task",
|
||||
waitMs: 3000,
|
||||
});
|
||||
expect(finishedManaged).toMatchObject({
|
||||
completed: true,
|
||||
status: "succeeded",
|
||||
exitCode: 0,
|
||||
});
|
||||
expect(String(finishedManaged.tail)).toContain("BUILD SUCCESSFUL");
|
||||
|
||||
await callOk("start_managed_task", {
|
||||
taskKey: "e2e-managed-cancel",
|
||||
cmd: "sleep 10",
|
||||
workdir: testRoot,
|
||||
initialWaitMs: 0,
|
||||
});
|
||||
await callOk("cancel_managed_task", {
|
||||
taskKey: "e2e-managed-cancel",
|
||||
signal: "SIGTERM",
|
||||
graceMs: 1000,
|
||||
});
|
||||
}, 30_000);
|
||||
|
||||
it("handles text, metadata, listings, permissions, and unified patches", async () => {
|
||||
|
||||
Reference in New Issue
Block a user