fix(tools)!: simplify direct invocation and harden boundary contracts (#555)
Remove REA permission grants, scope ceilings, approval confirmations, and inert settings. Preserve selected local evidence, accept caller-chosen commands and paths, and report actual runtime failures. Harden provider results, schema serialization, snapshot evidence binding, archive paths, source maps, native screenshots, managed EH parsing, and cancellation cleanup. Regenerate tool metadata and document direct invocation. BREAKING CHANGE: Removed permission configuration and policy commands, approval fields, filesystem scope inputs, and fixed confirmation options. Process capture inherits the host environment and accepts command names; callers must refresh tool schemas and migrate removed fields.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import fs from "node:fs";
|
||||
import { mkdir, rm, writeFile } from "node:fs/promises";
|
||||
import { mkdir, rm, symlink, writeFile } from "node:fs/promises";
|
||||
import { join } from "node:path";
|
||||
|
||||
import { add, commit, init } from "isomorphic-git";
|
||||
@@ -31,12 +31,16 @@ const fixture = async (parent: string, name: string): Promise<string> => {
|
||||
return root;
|
||||
};
|
||||
|
||||
const importTree = (root: string, signal?: AbortSignal) =>
|
||||
const importTree = (
|
||||
root: string,
|
||||
signal?: AbortSignal,
|
||||
secretPatterns: readonly string[] = [".env", ".env.*"],
|
||||
) =>
|
||||
importReferenceSource({
|
||||
root,
|
||||
caller: "reference-import-test",
|
||||
policy: {
|
||||
secretPatterns: [".env", ".env.*"],
|
||||
secretPatterns,
|
||||
},
|
||||
...(signal === undefined ? {} : { signal }),
|
||||
});
|
||||
@@ -105,6 +109,33 @@ describe("reference source import error projection", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("reference source symlink import", () => {
|
||||
it("retains external symlink targets as local graph diagnostics", async () => {
|
||||
const root = await createTestTempDirectory("rea-reference-links-");
|
||||
const outside = await createTestTempDirectory("rea-reference-outside-");
|
||||
const target = join(outside, "target.js");
|
||||
await writeFile(target, "export {};");
|
||||
await symlink(target, join(root, "external.js"));
|
||||
|
||||
const imported = await importTree(root);
|
||||
|
||||
expect(imported.ok).toBe(true);
|
||||
if (!imported.ok) return;
|
||||
expect(imported.value.entries).toContainEqual(
|
||||
expect.objectContaining({
|
||||
kind: "symlink",
|
||||
path: "external.js",
|
||||
target,
|
||||
target_state: "external",
|
||||
limitations: [],
|
||||
}),
|
||||
);
|
||||
expect(imported.value.entries).not.toContainEqual(
|
||||
expect.objectContaining({ path: "target.js", kind: "file" }),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("reference source import behavior", () => {
|
||||
// The importer declares no byte ceiling and no entry-count ceiling. Scale
|
||||
// independence cannot be asserted as a relationship over a bounded fixture,
|
||||
@@ -275,3 +306,27 @@ describe("reference source import behavior", () => {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("reference source path selection", () => {
|
||||
it("does not omit selected files by secret-like path or filename", async () => {
|
||||
const parent = await createTestTempDirectory("rea-reference-selected-");
|
||||
try {
|
||||
const root = await fixture(parent, "tree");
|
||||
const result = await importTree(root, undefined, []);
|
||||
expect(result.ok).toBe(true);
|
||||
if (!result.ok) return;
|
||||
expect(result.value.entries).toContainEqual(
|
||||
expect.objectContaining({
|
||||
path: ".env",
|
||||
kind: "file",
|
||||
content_state: "hashed",
|
||||
}),
|
||||
);
|
||||
expect(result.value.exclusions).not.toContainEqual(
|
||||
expect.objectContaining({ path: ".env" }),
|
||||
);
|
||||
} finally {
|
||||
await rm(parent, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user