export const codeScanDependencyDeclarations = [
    {
        dependencyId: "runtime.execEngine.filesystem.list",
        kind: "filesystem",
        required: true,
        description: "Runtime-provided directory lister exposed through BaseToolExecutorPort.filesystem.list",
    },
    {
        dependencyId: "runtime.governancePlane.workspaceReadScope",
        kind: "permission",
        required: true,
        description: "Runtime workspaceRoot, allowedRoots, and scope decision carried in code.scan context",
    },
    {
        dependencyId: "runtime.capabilityExposure.codeScanEnvelope",
        kind: "runtime",
        required: true,
        description: "Runtime-safe code scan result envelope for entries, pagination, and truncation metadata",
    },
];
export function createHostExecutorCodeScanProvider(executor) {
    const list = executor?.filesystem?.list;
    if (list === undefined) {
        return undefined;
    }
    return async (request) => {
        const result = await list({
            path: request.directoryPath,
            maxEntries: request.maxEntries,
            depth: request.depth,
            includeGlobs: request.includeGlobs,
            excludeGlobs: request.excludeGlobs,
        });
        if (!result.ok) {
            throw new Error(result.error.message);
        }
        return result.output.entries.map((entry) => ({
            path: entry,
            kind: entry.endsWith("/") ? "directory" : "unknown",
        }));
    };
}
