mirror of
https://github.com/morluto/rea.git
synced 2026-10-27 18:05:45 +00:00
refactor(tools): remove redundant limits and acknowledgements
This commit is contained in:
1 parent
7ba3580c86
commit
bd0e341572
158 files changed
+599
-1527
No files matched your search
@@ -1,33 +1,35 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import type { ArtifactLimits } from "../artifacts/ArtifactReader.js";
|
||||
import {
|
||||
JAVASCRIPT_APPLICATION_ANALYSIS_DEFAULT_LIMITS,
|
||||
javascriptApplicationAnalysisLimitsSchema,
|
||||
} from "../domain/javascriptApplicationAnalysis.js";
|
||||
|
||||
/** Resource safeguards for local artifact traversal and static parsing. */
|
||||
export const JAVASCRIPT_APPLICATION_RESOURCE_LIMITS = {
|
||||
artifact: {
|
||||
maxEntries: 8_000,
|
||||
maxTotalBytes: 512 * 1_024 * 1_024,
|
||||
maxEntryBytes: 128 * 1_024 * 1_024,
|
||||
maxCompressionRatio: 1_000,
|
||||
maxDepth: 64,
|
||||
maxPathBytes: 4_096,
|
||||
} satisfies ArtifactLimits,
|
||||
maxTextFiles: 5_000,
|
||||
maxTotalTextBytes: 128 * 1_024 * 1_024,
|
||||
maxTextFileBytes: 8 * 1_024 * 1_024,
|
||||
maxAstNodes: 2_000_000,
|
||||
maxParseMilliseconds: 30_000,
|
||||
} as const;
|
||||
|
||||
/** Local ASAR/directory reconstruction request. */
|
||||
export const javascriptArtifactReconstructionInputSchema = z.strictObject({
|
||||
input_path: z.string().min(1),
|
||||
format: z.enum(["auto", "asar", "directory"]).default("auto"),
|
||||
limits: javascriptApplicationAnalysisLimitsSchema.default(
|
||||
JAVASCRIPT_APPLICATION_ANALYSIS_DEFAULT_LIMITS,
|
||||
),
|
||||
});
|
||||
|
||||
/** Parsed bounded reconstruction request. */
|
||||
/** Parsed local reconstruction request. */
|
||||
export type JavaScriptArtifactReconstructionInput = z.infer<
|
||||
typeof javascriptArtifactReconstructionInputSchema
|
||||
>;
|
||||
|
||||
/** Project reconstruction limits into the shared artifact traversal policy. */
|
||||
export const artifactLimitsForReconstruction = (
|
||||
input: JavaScriptArtifactReconstructionInput,
|
||||
): ArtifactLimits => ({
|
||||
maxEntries: input.limits.max_entries,
|
||||
maxTotalBytes: input.limits.max_total_artifact_bytes,
|
||||
maxEntryBytes: input.limits.max_artifact_entry_bytes,
|
||||
maxCompressionRatio: input.limits.max_compression_ratio,
|
||||
maxDepth: input.limits.max_depth,
|
||||
maxPathBytes: input.limits.max_path_bytes,
|
||||
});
|
||||
/** Project private resource safeguards into the artifact traversal policy. */
|
||||
export const artifactLimitsForReconstruction = (): ArtifactLimits =>
|
||||
JAVASCRIPT_APPLICATION_RESOURCE_LIMITS.artifact;
|
||||
Reference in new issue
Block a user