Repository navigation
Expand file tree
/
Copy pathcliObservationOptions.ts
More file actions
84 lines (79 loc) · 2.76 KB
/
Copy pathcliObservationOptions.ts
File metadata and controls
84 lines (79 loc) · 2.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import { z } from "incur";
import { javaScriptAnalysisResourceControlsSchema } from "./domain/javascript/javascriptAnalysisResourceControls.js";
import { javaScriptSourcePathsSchema } from "./domain/javascript/javascriptSourceSelection.js";
/** Accept an agent-selected browser observation duration without an artificial ceiling. */
export const observationDuration = (fallback: number, minimum = 0) =>
z
.number()
.int()
.min(minimum)
.default(fallback)
.describe("Observation duration in milliseconds");
/** Shared passive browser origin options. */
export const browserScopeOptions = {
allowedOrigins: z
.array(z.string().min(1))
.optional()
.describe("Optional exact-origin filter"),
};
export const browserPageInspectionOptions = z.object({
...browserScopeOptions,
observationMs: observationDuration(500),
includeAccessibilityText: z
.boolean()
.default(false)
.describe("Include accessibility text"),
includeConsoleText: z
.boolean()
.default(false)
.describe("Include console message text"),
includeJsonBodyShapes: z
.boolean()
.default(false)
.describe("Include structural shapes of JSON response bodies"),
includeWebsocketShapes: z
.boolean()
.default(false)
.describe("Include structural shapes of WebSocket payloads"),
includeScriptSources: z
.boolean()
.default(false)
.describe("Include JavaScript source text"),
includeStorageKeys: z
.boolean()
.default(false)
.describe("Include storage key names without values"),
includeStorageFingerprints: z
.boolean()
.default(false)
.describe("Include content-derived storage fingerprints"),
});
export const electronPageInspectionOptions = z.object({
observationMs: observationDuration(100),
includeScriptSources: z
.boolean()
.default(false)
.describe("Include JavaScript source text"),
});
export const javascriptApplicationOptions = z.object({
maxSemanticNodes:
javaScriptAnalysisResourceControlsSchema.shape.max_semantic_nodes,
maxSemanticNodesPerFile:
javaScriptAnalysisResourceControlsSchema.shape.max_semantic_nodes_per_file,
sourcePath: javaScriptSourcePathsSchema
.optional()
.describe(
"Exact inventoried file path relative to the application root; repeat to select several. No implicit dependencies.",
),
maxHeapMb: javaScriptAnalysisResourceControlsSchema.shape.max_heap_mb,
analysisTimeoutMs:
javaScriptAnalysisResourceControlsSchema.shape.analysis_timeout_ms,
artifactFormat: z
.enum(["auto", "asar", "directory"])
.default("auto")
.describe("Application artifact format"),
integrityPolicy: z
.enum(["fail", "record-and-continue"])
.default("fail")
.describe("Behavior when declared application integrity does not match"),
});