chore: reconcile iNES inventory with current main
This commit is contained in:
Vendored
+3
@@ -159,3 +159,6 @@ for (const name of ["get_xrefs_to_class", "get_xrefs_to_method"])
|
||||
}),
|
||||
);
|
||||
await server.connect(new StdioServerTransport());
|
||||
// A refused cleanup must leave a live process for verified fixture teardown.
|
||||
// Otherwise stdin EOF races the ownership scan with the server's natural exit.
|
||||
if (mode === "cleanup-failure") setInterval(() => {}, 1000);
|
||||
|
||||
Vendored
+1
@@ -34,6 +34,7 @@ export const CLIENT_LOCATION_ENVIRONMENT = [
|
||||
"PI_CODING_AGENT_DIR",
|
||||
"PI_CONFIG_DIR",
|
||||
"PI_PROFILE",
|
||||
"QODER_CONFIG_DIR",
|
||||
"QWEN_HOME",
|
||||
"SAND_DATA_ROOT",
|
||||
"XDG_CONFIG_HOME",
|
||||
|
||||
Vendored
+39
@@ -0,0 +1,39 @@
|
||||
import { readFile, writeFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
import { Uint8ArrayReader, Uint8ArrayWriter, ZipWriter } from "@zip.js/zip.js";
|
||||
import { aotFixtureImage } from "../../src/flutter/FlutterBuild.fixture.js";
|
||||
import { createTestTempDirectory } from "./temporaryDirectory.js";
|
||||
|
||||
/** Materialize real ZIP members with test-scoped exact-path cleanup. */
|
||||
export const createFlutterApk = async (
|
||||
name: string,
|
||||
files: ReadonlyArray<{ readonly path: string; readonly bytes: Buffer }>,
|
||||
): Promise<string> => {
|
||||
const root = await createTestTempDirectory("rea-flutter-");
|
||||
const writer = new ZipWriter(new Uint8ArrayWriter(), {
|
||||
useWebWorkers: false,
|
||||
});
|
||||
for (const file of files)
|
||||
await writer.add(file.path, new Uint8ArrayReader(file.bytes));
|
||||
const path = join(root, name);
|
||||
await writeFile(path, await writer.close());
|
||||
return path;
|
||||
};
|
||||
|
||||
/** ZIP permits repeated names; the writer refuses them, so rewrite both records. */
|
||||
export const createDuplicateFlutterApk = async (): Promise<string> => {
|
||||
const path = await createFlutterApk("duplicates.apk", [
|
||||
{ path: "lib/arm64-v8a/libapp.so", bytes: aotFixtureImage() },
|
||||
{ path: "lib/arm64-v8a/libxxx.so", bytes: Buffer.alloc(64) },
|
||||
]);
|
||||
const bytes = await readFile(path);
|
||||
const from = Buffer.from("lib/arm64-v8a/libxxx.so");
|
||||
for (
|
||||
let at = bytes.indexOf(from);
|
||||
at >= 0;
|
||||
at = bytes.indexOf(from, at + from.length)
|
||||
)
|
||||
bytes.write("lib/arm64-v8a/libapp.so", at);
|
||||
await writeFile(path, bytes);
|
||||
return path;
|
||||
};
|
||||
Vendored
+9
@@ -203,6 +203,14 @@ export const createGoBinaryDiagnosticFixtures = () => {
|
||||
}
|
||||
const damagedPe = createGoBinaryFixture({ format: "pe" }).bytes;
|
||||
damagedPe.write("NO", 128, "ascii");
|
||||
const highBitSignatures = ["NE", "LE", "LX", "PE"].map((signature) => {
|
||||
const bytes = createGoBinaryFixture({ format: "pe" }).bytes;
|
||||
bytes.set(
|
||||
[...Buffer.from(signature)].map((byte) => byte | 0x80),
|
||||
128,
|
||||
);
|
||||
return { name: `high-bit-${signature.toLowerCase()}`, bytes };
|
||||
});
|
||||
const absentDirectories = createGoBinaryFixture({ format: "pe" }).bytes;
|
||||
absentDirectories.writeUInt32LE(1, 152 + 108);
|
||||
const shortOptionalHeaders = [0, 1].map((size) => {
|
||||
@@ -220,6 +228,7 @@ export const createGoBinaryDiagnosticFixtures = () => {
|
||||
})),
|
||||
...[
|
||||
{ name: "damaged-pe", bytes: damagedPe },
|
||||
...highBitSignatures,
|
||||
{ name: "absent-directories", bytes: absentDirectories },
|
||||
...shortOptionalHeaders,
|
||||
].map((fixture) => ({
|
||||
|
||||
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
import { spawnSync } from "node:child_process";
|
||||
|
||||
/**
|
||||
* Whether Xcode's ibtool can compile Interface Builder sources on this host.
|
||||
* Command Line Tools install the /usr/bin/ibtool and xcrun shims without the
|
||||
* tool itself, so probe resolution instead of checking the shim path.
|
||||
*/
|
||||
export const xcodeIbtoolAvailable =
|
||||
process.platform === "darwin" &&
|
||||
spawnSync("/usr/bin/xcrun", ["--find", "ibtool"], { stdio: "ignore" })
|
||||
.status === 0;
|
||||
Vendored
+12
-9
@@ -113,10 +113,13 @@ export class RecordingIdaMcp implements IdaMcpConnection {
|
||||
if (overridden !== undefined) return overridden;
|
||||
if (["idb_open", "idb_list", "idb_close", "server_health"].includes(name))
|
||||
return this.lifecycle(name, args);
|
||||
return this.read(name);
|
||||
return this.read(name, args);
|
||||
}
|
||||
|
||||
private read(name: string): JsonValue {
|
||||
private read(
|
||||
name: string,
|
||||
args: Readonly<Record<string, JsonValue>>,
|
||||
): JsonValue {
|
||||
const fn = { address: "0x1000", name: "main", size: "0x20" };
|
||||
const asm = {
|
||||
name: "main",
|
||||
@@ -153,13 +156,13 @@ export class RecordingIdaMcp implements IdaMcpConnection {
|
||||
case "get_function_by_name":
|
||||
return fn;
|
||||
case "lookup_funcs":
|
||||
return [
|
||||
{
|
||||
query: "main",
|
||||
fn: { addr: fn.address, name: fn.name, size: fn.size },
|
||||
error: null,
|
||||
},
|
||||
];
|
||||
if (!Array.isArray(args.queries))
|
||||
throw new Error("Invalid fixture lookup queries");
|
||||
return args.queries.map((query) => ({
|
||||
query,
|
||||
fn: { addr: fn.address, name: fn.name, size: fn.size },
|
||||
error: null,
|
||||
}));
|
||||
case "decompile_function":
|
||||
return this.pseudocode;
|
||||
case "decompile":
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Rooted portable archive from #2177; that issue reports Foundation and UINib validation. -->
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>$archiver</key>
|
||||
<string>NSKeyedArchiver</string>
|
||||
<key>$version</key>
|
||||
<integer>100000</integer>
|
||||
<key>$objects</key>
|
||||
<array>
|
||||
<string>$null</string>
|
||||
<dict>
|
||||
<key>$class</key>
|
||||
<dict><key>CF$UID</key><integer>4</integer></dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>$class</key>
|
||||
<dict><key>CF$UID</key><integer>5</integer></dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>$class</key>
|
||||
<dict><key>CF$UID</key><integer>6</integer></dict>
|
||||
<key>UISource</key>
|
||||
<dict><key>CF$UID</key><integer>1</integer></dict>
|
||||
<key>UIDestination</key>
|
||||
<dict><key>CF$UID</key><integer>2</integer></dict>
|
||||
<key>UILabel</key>
|
||||
<dict><key>CF$UID</key><integer>7</integer></dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>$classname</key><string>UIViewController</string>
|
||||
<key>$classes</key>
|
||||
<array><string>UIViewController</string><string>UIResponder</string><string>NSObject</string></array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>$classname</key><string>UIView</string>
|
||||
<key>$classes</key>
|
||||
<array><string>UIView</string><string>UIResponder</string><string>NSObject</string></array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>$classname</key><string>UIRuntimeOutletConnection</string>
|
||||
<key>$classes</key>
|
||||
<array><string>UIRuntimeOutletConnection</string><string>UIRuntimeConnection</string><string>NSObject</string></array>
|
||||
</dict>
|
||||
<string>view</string>
|
||||
<dict>
|
||||
<key>$class</key>
|
||||
<dict><key>CF$UID</key><integer>11</integer></dict>
|
||||
<key>NS.objects</key>
|
||||
<array>
|
||||
<dict><key>CF$UID</key><integer>1</integer></dict>
|
||||
<dict><key>CF$UID</key><integer>2</integer></dict>
|
||||
<dict><key>CF$UID</key><integer>3</integer></dict>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>$class</key>
|
||||
<dict><key>CF$UID</key><integer>11</integer></dict>
|
||||
<key>NS.objects</key>
|
||||
<array><dict><key>CF$UID</key><integer>3</integer></dict></array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>$class</key>
|
||||
<dict><key>CF$UID</key><integer>11</integer></dict>
|
||||
<key>NS.objects</key>
|
||||
<array>
|
||||
<dict><key>CF$UID</key><integer>1</integer></dict>
|
||||
<dict><key>CF$UID</key><integer>2</integer></dict>
|
||||
</array>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>$classname</key><string>NSArray</string>
|
||||
<key>$classes</key><array><string>NSArray</string><string>NSObject</string></array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>$top</key>
|
||||
<dict>
|
||||
<key>root</key><dict><key>CF$UID</key><integer>8</integer></dict>
|
||||
<key>UINibConnectionsKey</key><dict><key>CF$UID</key><integer>9</integer></dict>
|
||||
<key>UINibObjectsKey</key><dict><key>CF$UID</key><integer>10</integer></dict>
|
||||
<key>UINibTopLevelObjectsKey</key><dict><key>CF$UID</key><integer>10</integer></dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
/** Build a valid minimal JVM class file, optionally with an unused UTF-8 constant. */
|
||||
export const javaClassFile = (extraUtf8Bytes = 0): Buffer => {
|
||||
const utf8 = (value: string): Buffer => {
|
||||
const bytes = Buffer.from(value, "utf8");
|
||||
const entry = Buffer.alloc(3 + bytes.length);
|
||||
entry[0] = 1;
|
||||
entry.writeUInt16BE(bytes.length, 1);
|
||||
bytes.copy(entry, 3);
|
||||
return entry;
|
||||
};
|
||||
const constants = [
|
||||
Buffer.from([7, 0, 2]),
|
||||
utf8("Hello"),
|
||||
Buffer.from([7, 0, 4]),
|
||||
utf8("java/lang/Object"),
|
||||
...(extraUtf8Bytes === 0 ? [] : [utf8("x".repeat(extraUtf8Bytes))]),
|
||||
];
|
||||
const headerAndPool = Buffer.alloc(10);
|
||||
headerAndPool.writeUInt32BE(0xcafebabe, 0);
|
||||
headerAndPool.writeUInt16BE(0, 4);
|
||||
headerAndPool.writeUInt16BE(65, 6);
|
||||
headerAndPool.writeUInt16BE(constants.length + 1, 8);
|
||||
const classBody = Buffer.alloc(14);
|
||||
[0x21, 1, 3, 0, 0, 0, 0].forEach((value, index) =>
|
||||
classBody.writeUInt16BE(value, index * 2),
|
||||
);
|
||||
return Buffer.concat([headerAndPool, ...constants, classBody]);
|
||||
};
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
/** A well-formed XML plist of N nested dictionaries, each with one key. */
|
||||
export const deeplyNestedXmlPlist = (depth: number): string =>
|
||||
'<?xml version="1.0" encoding="UTF-8"?>\n' +
|
||||
'<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n' +
|
||||
'<plist version="1.0">\n' +
|
||||
"<dict><key>k</key>".repeat(depth) +
|
||||
"<string>x</string>" +
|
||||
"</dict>".repeat(depth) +
|
||||
"\n</plist>\n";
|
||||
Vendored
+13
-3
@@ -1,4 +1,7 @@
|
||||
import { Client } from "@modelcontextprotocol/client";
|
||||
import {
|
||||
Client,
|
||||
type CallToolRequestOptions,
|
||||
} from "@modelcontextprotocol/client";
|
||||
import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
|
||||
import { Ajv2020 } from "ajv/dist/2020.js";
|
||||
import type { ValidateFunction } from "ajv";
|
||||
@@ -69,12 +72,19 @@ export async function connectLocalToolsMcp() {
|
||||
validatedSchemas.add(serialized);
|
||||
}
|
||||
const definitions = new Map(tools.map((tool) => [tool.name, tool]));
|
||||
const call = async (name: string, arguments_: Record<string, unknown>) => {
|
||||
const call = async (
|
||||
name: string,
|
||||
arguments_: Record<string, unknown>,
|
||||
options?: Pick<CallToolRequestOptions, "signal" | "onprogress">,
|
||||
) => {
|
||||
const definition = definitions.get(name);
|
||||
if (definition !== undefined) compileValidator(definition.inputSchema);
|
||||
const response = await client.callTool(
|
||||
{ name, arguments: arguments_ },
|
||||
definition === undefined ? undefined : { toolDefinition: definition },
|
||||
{
|
||||
...options,
|
||||
...(definition === undefined ? {} : { toolDefinition: definition }),
|
||||
},
|
||||
);
|
||||
if (
|
||||
response.structuredContent !== undefined &&
|
||||
|
||||
+7
-1
@@ -1,6 +1,7 @@
|
||||
import { spawn } from "node:child_process";
|
||||
import { mkdirSync, writeFileSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import { setTimeout as delay } from "node:timers/promises";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
// Writes a periodic report, then behaves by mode:
|
||||
@@ -8,11 +9,16 @@ import { fileURLToPath } from "node:url";
|
||||
// and exits cleanly.
|
||||
// - "ignoring": stays alive and swallows SIGTERM and SIGINT, so only SIGKILL
|
||||
// ends the process.
|
||||
// - "delayed-ignoring": installs those handlers after a slow startup.
|
||||
// - "exits": exits on its own at once.
|
||||
// - "descendant": cooperates while leaving a SIGTERM-ignoring child for owned cleanup.
|
||||
// An optional third argument is the exit code a cooperative finalizer uses.
|
||||
const [mode, directory, finalExitCode = "0"] = process.argv.slice(2);
|
||||
|
||||
// Make the cancellation case exercise startup beyond its old 300 ms capture
|
||||
// window deterministically, rather than relying on a busy CI runner.
|
||||
if (mode === "delayed-ignoring") await delay(500);
|
||||
|
||||
writeFileSync(join(directory, "pid.txt"), String(process.pid));
|
||||
writeFileSync(
|
||||
join(directory, "periodic.json"),
|
||||
@@ -31,7 +37,7 @@ if (mode === "descendant") {
|
||||
);
|
||||
}
|
||||
|
||||
if (mode === "ignoring") {
|
||||
if (mode === "ignoring" || mode === "delayed-ignoring") {
|
||||
process.on("SIGTERM", () => {
|
||||
writeFileSync(join(directory, "sigterm-received"), "received");
|
||||
});
|
||||
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
import { spawn } from "node:child_process";
|
||||
import { existsSync, writeFileSync } from "node:fs";
|
||||
import { fileURLToPath } from "node:url";
|
||||
|
||||
const [mode, path, initial, final, trigger, ready, done, exitCode] =
|
||||
process.argv.slice(2);
|
||||
|
||||
if (mode === "leader") {
|
||||
writeFileSync(path, initial);
|
||||
spawn(
|
||||
process.execPath,
|
||||
[
|
||||
fileURLToPath(import.meta.url),
|
||||
"descendant",
|
||||
path,
|
||||
initial,
|
||||
final,
|
||||
trigger,
|
||||
ready,
|
||||
done,
|
||||
],
|
||||
{ stdio: "ignore" },
|
||||
);
|
||||
const timer = setInterval(() => {
|
||||
if (!existsSync(ready)) return;
|
||||
clearInterval(timer);
|
||||
process.stdout.write("stage diagnostic", () =>
|
||||
process.exit(Number(exitCode)),
|
||||
);
|
||||
}, 5);
|
||||
} else {
|
||||
writeFileSync(ready, String(process.pid));
|
||||
const timer = setInterval(() => {
|
||||
if (!existsSync(trigger)) return;
|
||||
writeFileSync(path, final);
|
||||
writeFileSync(done, "changed");
|
||||
clearInterval(timer);
|
||||
}, 5);
|
||||
setInterval(() => undefined, 1000);
|
||||
}
|
||||
Vendored
+74
@@ -0,0 +1,74 @@
|
||||
import { DatabaseSync } from "node:sqlite";
|
||||
import { join } from "node:path";
|
||||
|
||||
/** Engine-dependent cases require the same native limit capability as the worker. */
|
||||
export const SQLITE_NATIVE_LIMITS_AVAILABLE = (() => {
|
||||
const database = new DatabaseSync(":memory:");
|
||||
try {
|
||||
return "limits" in database;
|
||||
} finally {
|
||||
database.close();
|
||||
}
|
||||
})();
|
||||
|
||||
/** Exact selected SQLite fixture with committed rows and optional live WAL. */
|
||||
export interface SqliteDatabaseFixture {
|
||||
readonly path: string;
|
||||
readonly walPath: string;
|
||||
readonly quotedTable: string;
|
||||
close(): void;
|
||||
}
|
||||
|
||||
/** Produce schema and lossless SQLite values through the actual SQLite engine. */
|
||||
export const createSqliteDatabaseFixture = (
|
||||
root: string,
|
||||
wal = false,
|
||||
): SqliteDatabaseFixture => {
|
||||
const path = join(root, "selected.db");
|
||||
const db = new DatabaseSync(path);
|
||||
if (wal) db.exec("PRAGMA journal_mode = WAL; PRAGMA wal_autocheckpoint = 0");
|
||||
db.exec(`
|
||||
CREATE TABLE records (
|
||||
id INTEGER PRIMARY KEY,
|
||||
integer_value INTEGER,
|
||||
blob_value BLOB,
|
||||
real_value REAL,
|
||||
nullable_value TEXT,
|
||||
text_value TEXT,
|
||||
generated_value TEXT GENERATED ALWAYS AS (typeof(integer_value)) VIRTUAL
|
||||
);
|
||||
CREATE INDEX records_text ON records(text_value);
|
||||
CREATE VIEW record_names AS SELECT text_value FROM records;
|
||||
CREATE TRIGGER records_insert AFTER INSERT ON records BEGIN SELECT 1; END;
|
||||
CREATE TABLE "strange""'; DROP TABLE records;--" ("__proto__" TEXT);
|
||||
INSERT INTO "strange""'; DROP TABLE records;--" VALUES ('exact selected table');
|
||||
`);
|
||||
const insert = db.prepare(
|
||||
"INSERT INTO records(id, integer_value, blob_value, real_value, nullable_value, text_value) VALUES (?, ?, ?, ?, ?, ?)",
|
||||
);
|
||||
insert.run(
|
||||
1,
|
||||
9223372036854775807n,
|
||||
Buffer.from([0, 31, 239, 255]),
|
||||
Infinity,
|
||||
null,
|
||||
"first é\0value",
|
||||
);
|
||||
insert.run(
|
||||
2,
|
||||
-9223372036854775808n,
|
||||
Buffer.alloc(0),
|
||||
-Infinity,
|
||||
"present",
|
||||
"second",
|
||||
);
|
||||
db.exec(
|
||||
"INSERT INTO records(id, integer_value, blob_value, real_value, nullable_value, text_value) VALUES (3, 0, X'FF', 1.25, NULL, CAST(X'FF00C0AF' AS TEXT))",
|
||||
);
|
||||
return {
|
||||
path,
|
||||
walPath: `${path}-wal`,
|
||||
quotedTable: "strange\"'; DROP TABLE records;--",
|
||||
close: () => db.close(),
|
||||
};
|
||||
};
|
||||
Vendored
+1
@@ -105,6 +105,7 @@ export const scriptScenarioFixture = (
|
||||
response_body: true,
|
||||
header_values: false,
|
||||
},
|
||||
event_families: ["network"],
|
||||
},
|
||||
duration_ms: 2,
|
||||
steps: [step(0), step(1)],
|
||||
|
||||
Reference in New Issue
Block a user