mirror of
https://github.com/morluto/rea.git
synced 2026-12-04 01:54:49 +00:00
* fix(cli): validate named inputs before target admission * fix(mcp): preserve valid inputs when advertised schema references widen * test(inputs): reach session behavior with admitted inputs One-shot admission now rejects incomplete requests before a session exists. Lifecycle tests supply the required fields, and unknown arguments are rejected before provider issues are retained. * fix(cli): preserve Electron fuse path spelling Anchor relative fuse paths without stripping dot segments, and let an empty path reach the operation so it still reports invalid_request. * fix(cli): reject outline-depth unless detail is summary The advertised schema already required detail summary whenever outline-depth was present. The parser still applied the full default and accepted that combination, so its output failed the same schema. Parsing now rejects it before the command runs. --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
80 lines
2.1 KiB
TypeScript
80 lines
2.1 KiB
TypeScript
import { isAbsolute, win32 } from "node:path";
|
|
|
|
import { expect, it } from "vitest";
|
|
|
|
import {
|
|
absoluteLocalPathStringSchema,
|
|
windowsAbsolutePathPattern,
|
|
} from "./localPath.js";
|
|
|
|
const PATHS = [
|
|
"/absolute/path",
|
|
"/",
|
|
"relative/path",
|
|
"C:\\absolute\\path",
|
|
"c:/absolute/path",
|
|
"C:relative/path",
|
|
"\\\\server\\share\\path",
|
|
"\\rooted\\path",
|
|
"//server/share/path",
|
|
"file:///absolute/path",
|
|
];
|
|
|
|
it("matches the host path module for absolute local paths", () => {
|
|
const checked: string[] = [];
|
|
for (const path of PATHS) {
|
|
checked.push(path);
|
|
expect(absoluteLocalPathStringSchema.safeParse(path).success).toBe(
|
|
isAbsolute(path),
|
|
);
|
|
}
|
|
expect(checked).toEqual(
|
|
expect.arrayContaining([
|
|
"/absolute/path",
|
|
"relative/path",
|
|
"file:///absolute/path",
|
|
]),
|
|
);
|
|
expect(absoluteLocalPathStringSchema.safeParse("").success).toBe(false);
|
|
expect(
|
|
absoluteLocalPathStringSchema.safeParse("/absolute/with\0nul").success,
|
|
).toBe(false);
|
|
});
|
|
|
|
it("keeps the Windows absolute-path pattern valid in every client mode", () => {
|
|
// Annex B and `u` accept an unescaped `/` inside a class; `v` does not, and a
|
|
// client that compiles advertised patterns rejects the complete tools request.
|
|
for (const flags of ["", "u", "v"])
|
|
expect(
|
|
() => new RegExp(windowsAbsolutePathPattern.source, flags),
|
|
flags,
|
|
).not.toThrow();
|
|
const checked: string[] = [];
|
|
for (const path of PATHS) {
|
|
checked.push(path);
|
|
expect(windowsAbsolutePathPattern.test(path), path).toBe(
|
|
win32.isAbsolute(path),
|
|
);
|
|
}
|
|
expect(checked).toEqual(
|
|
expect.arrayContaining([
|
|
"C:\\absolute\\path",
|
|
"C:relative/path",
|
|
"/absolute/path",
|
|
]),
|
|
);
|
|
});
|
|
|
|
it("rejects unpaired surrogates while preserving representable Unicode paths", () => {
|
|
for (const path of ["/tmp/\ud800", "/tmp/\udc00", "/tmp/\ud800x"]) {
|
|
expect(absoluteLocalPathStringSchema.safeParse(path).success, path).toBe(
|
|
false,
|
|
);
|
|
}
|
|
for (const path of ["/tmp/😀", "/tmp/�", "/tmp/ spaced name "]) {
|
|
expect(absoluteLocalPathStringSchema.safeParse(path).success, path).toBe(
|
|
true,
|
|
);
|
|
}
|
|
});
|