@remnux/mcp-server 0.1.4 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remnux/mcp-server",
3
- "version": "0.1.4",
3
+ "version": "0.1.7",
4
4
  "description": "MCP server for using the REMnux malware analysis toolkit via AI assistants",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,10 +0,0 @@
1
- import type { HandlerDeps } from "./types.js";
2
- import type { UploadSampleArgs } from "../schemas/tools.js";
3
- export declare function handleUploadSample(deps: HandlerDeps, args: UploadSampleArgs): Promise<{
4
- content: Array<{
5
- type: "text";
6
- text: string;
7
- }>;
8
- isError?: boolean;
9
- }>;
10
- //# sourceMappingURL=upload-sample.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"upload-sample.d.ts","sourceRoot":"","sources":["../../src/handlers/upload-sample.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAM5D,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE,gBAAgB;;;;;;GAsCvB"}
@@ -1,26 +0,0 @@
1
- import { uploadSample, validateFilename } from "../file-upload.js";
2
- import { formatResponse, formatError } from "../response.js";
3
- import { REMnuxError } from "../errors/remnux-error.js";
4
- import { toREMnuxError } from "../errors/error-mapper.js";
5
- export async function handleUploadSample(deps, args) {
6
- const startTime = Date.now();
7
- const { connector, config } = deps;
8
- // Validate filename first (before attempting upload)
9
- const filenameValidation = validateFilename(args.filename);
10
- if (!filenameValidation.valid) {
11
- return formatError("upload_sample", new REMnuxError(filenameValidation.error || "Invalid filename", "INVALID_FILENAME", "validation", "Use alphanumeric characters, hyphens, underscores, and dots only"), startTime);
12
- }
13
- try {
14
- const result = await uploadSample(connector, config.samplesDir, args.filename, args.content_base64, args.overwrite);
15
- if (result.success) {
16
- return formatResponse("upload_sample", result, startTime);
17
- }
18
- else {
19
- return formatError("upload_sample", new REMnuxError(result.error || "Upload failed", "UPLOAD_FAILED", "tool_failure", "Check disk space and write permissions in the samples directory"), startTime);
20
- }
21
- }
22
- catch (error) {
23
- return formatError("upload_sample", toREMnuxError(error), startTime);
24
- }
25
- }
26
- //# sourceMappingURL=upload-sample.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"upload-sample.js","sourceRoot":"","sources":["../../src/handlers/upload-sample.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,IAAiB,EACjB,IAAsB;IAEtB,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAC7B,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAEnC,qDAAqD;IACrD,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC3D,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAC;QAC9B,OAAO,WAAW,CAAC,eAAe,EAAE,IAAI,WAAW,CACjD,kBAAkB,CAAC,KAAK,IAAI,kBAAkB,EAC9C,kBAAkB,EAClB,YAAY,EACZ,kEAAkE,CACnE,EAAE,SAAS,CAAC,CAAC;IAChB,CAAC;IAED,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,YAAY,CAC/B,SAAS,EACT,MAAM,CAAC,UAAU,EACjB,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,cAAc,EACnB,IAAI,CAAC,SAAS,CACf,CAAC;QAEF,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACnB,OAAO,cAAc,CAAC,eAAe,EAAE,MAA4C,EAAE,SAAS,CAAC,CAAC;QAClG,CAAC;aAAM,CAAC;YACN,OAAO,WAAW,CAAC,eAAe,EAAE,IAAI,WAAW,CACjD,MAAM,CAAC,KAAK,IAAI,eAAe,EAC/B,eAAe,EACf,cAAc,EACd,iEAAiE,CAClE,EAAE,SAAS,CAAC,CAAC;QAChB,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,WAAW,CAAC,eAAe,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC;IACvE,CAAC;AACH,CAAC"}
@@ -1,27 +0,0 @@
1
- /**
2
- * Workflow Engine — execute workflow definitions step by step.
3
- *
4
- * Condition evaluation supports depth-tier checks and step-result references
5
- * (success, skipped, exitCode, output contains/matches). Unknown conditions
6
- * return false (deny-by-default).
7
- */
8
- import type { Connector } from "../connectors/index.js";
9
- import type { DepthTier } from "../file-type-mappings.js";
10
- import type { WorkflowDefinition, WorkflowResult } from "./types.js";
11
- export interface WorkflowExecutionContext {
12
- /** REMnux connector for executing commands */
13
- connector: Connector;
14
- /** Full path to the input file */
15
- filePath: string;
16
- /** Samples directory (cwd for tool execution) */
17
- samplesDir: string;
18
- /** Depth tier for this execution */
19
- depth: DepthTier;
20
- /** Parameter values (from workflow parameters) */
21
- params?: Record<string, unknown>;
22
- }
23
- /**
24
- * Execute a complete workflow definition.
25
- */
26
- export declare function executeWorkflow(workflow: WorkflowDefinition, context: WorkflowExecutionContext): Promise<WorkflowResult>;
27
- //# sourceMappingURL=engine.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/workflows/engine.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,EACV,kBAAkB,EAGlB,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB,MAAM,WAAW,wBAAwB;IACvC,8CAA8C;IAC9C,SAAS,EAAE,SAAS,CAAC;IACrB,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,oCAAoC;IACpC,KAAK,EAAE,SAAS,CAAC;IACjB,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAqOD;;GAEG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,cAAc,CAAC,CA2BzB"}
@@ -1,224 +0,0 @@
1
- /**
2
- * Workflow Engine — execute workflow definitions step by step.
3
- *
4
- * Condition evaluation supports depth-tier checks and step-result references
5
- * (success, skipped, exitCode, output contains/matches). Unknown conditions
6
- * return false (deny-by-default).
7
- */
8
- import { DEPTH_TIER_ORDER } from "../file-type-mappings.js";
9
- /**
10
- * Evaluate a simple condition string against the execution context.
11
- *
12
- * Supported patterns (intentionally limited for now):
13
- * - "depth in ['standard', 'deep']" — check depth tier
14
- * - "depth == 'deep'" — exact depth match
15
- * - "step.success" / "!step.success" / "step.skipped" — boolean check
16
- * - "step.exitCode == N" — numeric comparison (==, !=, <, >, <=, >=)
17
- * - "step.output contains 'text'" — case-sensitive substring match
18
- * - "step.output matches 'regex'" — regex test on output
19
- * - Always returns true for empty/undefined conditions
20
- */
21
- function evaluateCondition(condition, context, stepResults) {
22
- if (!condition)
23
- return true;
24
- // Depth tier checks
25
- const depthInMatch = condition.match(/depth\s+in\s+\[([^\]]+)\]/);
26
- if (depthInMatch) {
27
- const values = depthInMatch[1]
28
- .split(",")
29
- .map((v) => v.trim().replace(/['"]/g, ""));
30
- return values.includes(context.depth);
31
- }
32
- const depthEqMatch = condition.match(/depth\s*==\s*['"](\w+)['"]/);
33
- if (depthEqMatch) {
34
- return context.depth === depthEqMatch[1];
35
- }
36
- // Step depth checks
37
- const depthMinMatch = condition.match(/depth\s*>=\s*['"](\w+)['"]/);
38
- if (depthMinMatch) {
39
- return (DEPTH_TIER_ORDER.indexOf(context.depth) >=
40
- DEPTH_TIER_ORDER.indexOf(depthMinMatch[1]));
41
- }
42
- // Step-result conditions: "{step_name}.{field} ..."
43
- const STEP_NAME = "[a-zA-Z_][a-zA-Z0-9_]*";
44
- // Negated boolean: "!step.success" / "!step.skipped"
45
- const negBoolMatch = condition.match(new RegExp(`^!(${STEP_NAME})\\.(success|skipped)$`));
46
- if (negBoolMatch) {
47
- const ref = stepResults.get(negBoolMatch[1]);
48
- if (!ref)
49
- return false;
50
- return !ref[negBoolMatch[2]];
51
- }
52
- // Boolean: "step.success" / "step.skipped"
53
- const boolMatch = condition.match(new RegExp(`^(${STEP_NAME})\\.(success|skipped)$`));
54
- if (boolMatch) {
55
- const ref = stepResults.get(boolMatch[1]);
56
- if (!ref)
57
- return false;
58
- return !!ref[boolMatch[2]];
59
- }
60
- // Numeric: "step.exitCode == 0"
61
- const numMatch = condition.match(new RegExp(`^(${STEP_NAME})\\.exitCode\\s*(==|!=|<|>|<=|>=)\\s*(-?\\d+)$`));
62
- if (numMatch) {
63
- const ref = stepResults.get(numMatch[1]);
64
- if (!ref || ref.exitCode === undefined)
65
- return false;
66
- const left = ref.exitCode;
67
- const right = Number(numMatch[3]);
68
- switch (numMatch[2]) {
69
- case "==": return left === right;
70
- case "!=": return left !== right;
71
- case "<": return left < right;
72
- case ">": return left > right;
73
- case "<=": return left <= right;
74
- case ">=": return left >= right;
75
- default: return false;
76
- }
77
- }
78
- // Substring: "step.output contains 'text'"
79
- const containsMatch = condition.match(new RegExp(`^(${STEP_NAME})\\.output\\s+contains\\s+'(.*)'$`));
80
- if (containsMatch) {
81
- const ref = stepResults.get(containsMatch[1]);
82
- if (!ref || !ref.output)
83
- return false;
84
- return ref.output.includes(containsMatch[2]);
85
- }
86
- // Regex: "step.output matches 'pattern'"
87
- const matchesMatch = condition.match(new RegExp(`^(${STEP_NAME})\\.output\\s+matches\\s+'(.*)'$`));
88
- if (matchesMatch) {
89
- const ref = stepResults.get(matchesMatch[1]);
90
- if (!ref || !ref.output)
91
- return false;
92
- try {
93
- return new RegExp(matchesMatch[2]).test(ref.output);
94
- }
95
- catch {
96
- return false; // invalid regex — deny-by-default
97
- }
98
- }
99
- // Unknown condition — default to false (deny-by-default: skip unrecognized conditions
100
- // rather than running steps that may have been gated intentionally)
101
- return false;
102
- }
103
- /**
104
- * Interpolate template variables in step arguments.
105
- *
106
- * Replaces:
107
- * - {input_file} → filePath
108
- * - {param_name} → parameter value
109
- */
110
- function interpolateArgs(args, context) {
111
- if (!args)
112
- return [];
113
- return args.map((arg) => {
114
- let result = arg.replace(/\{input_file\}/g, context.filePath);
115
- // Parameter interpolation — escape key to prevent regex injection
116
- if (context.params) {
117
- for (const [key, value] of Object.entries(context.params)) {
118
- const escapedKey = key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
119
- result = result.replace(new RegExp(`\\{${escapedKey}\\}`, "g"), String(value));
120
- }
121
- }
122
- return result;
123
- });
124
- }
125
- /**
126
- * Execute a single workflow step.
127
- */
128
- async function executeStep(step, context, stepResults) {
129
- const startTime = Date.now();
130
- // Check depth tier — skip if step requires higher depth
131
- if (step.depth) {
132
- if (DEPTH_TIER_ORDER.indexOf(step.depth) > DEPTH_TIER_ORDER.indexOf(context.depth)) {
133
- return {
134
- name: step.name,
135
- tool: step.tool,
136
- success: true,
137
- skipped: true,
138
- elapsed_ms: Date.now() - startTime,
139
- };
140
- }
141
- }
142
- // Evaluate condition
143
- if (!evaluateCondition(step.condition, context, stepResults)) {
144
- return {
145
- name: step.name,
146
- tool: step.tool,
147
- success: true,
148
- skipped: true,
149
- elapsed_ms: Date.now() - startTime,
150
- };
151
- }
152
- // Build command
153
- const args = interpolateArgs(step.args, context);
154
- const command = [step.tool, ...args].join(" ");
155
- const timeoutSec = step.timeout ?? context.params?.timeout_per_tool ?? 60;
156
- const timeout = timeoutSec * 1000;
157
- const maxAttempts = step.on_error === "retry" ? (step.retries ?? 2) + 1 : 1;
158
- const retryDelay = (step.retry_delay ?? 1) * 1000;
159
- let lastResult;
160
- for (let attempt = 1; attempt <= maxAttempts; attempt++) {
161
- try {
162
- const result = await context.connector.executeShell(command, {
163
- timeout,
164
- cwd: context.samplesDir,
165
- });
166
- lastResult = {
167
- name: step.name,
168
- tool: step.tool,
169
- command,
170
- success: result.exitCode === 0,
171
- output: result.stdout || result.stderr || "",
172
- exitCode: result.exitCode,
173
- retries: attempt > 1 ? attempt - 1 : undefined,
174
- elapsed_ms: Date.now() - startTime,
175
- };
176
- }
177
- catch (error) {
178
- lastResult = {
179
- name: step.name,
180
- tool: step.tool,
181
- command,
182
- success: false,
183
- error: error instanceof Error ? error.message : String(error),
184
- retries: attempt > 1 ? attempt - 1 : undefined,
185
- elapsed_ms: Date.now() - startTime,
186
- };
187
- }
188
- if (lastResult.success || attempt === maxAttempts) {
189
- return lastResult;
190
- }
191
- // Delay before next retry
192
- await new Promise((resolve) => setTimeout(resolve, retryDelay));
193
- }
194
- // Unreachable, but satisfies TypeScript
195
- return lastResult;
196
- }
197
- /**
198
- * Execute a complete workflow definition.
199
- */
200
- export async function executeWorkflow(workflow, context) {
201
- const startTime = Date.now();
202
- const stepResults = new Map();
203
- const results = [];
204
- for (const step of workflow.steps) {
205
- const result = await executeStep(step, context, stepResults);
206
- stepResults.set(step.name, result);
207
- results.push(result);
208
- // Handle abort on failure
209
- if (!result.success && !result.skipped) {
210
- const onError = step.on_error ?? "continue";
211
- if (onError === "abort") {
212
- break;
213
- }
214
- }
215
- }
216
- const allSucceeded = results.every((r) => r.success || r.skipped);
217
- return {
218
- workflow: workflow.name,
219
- success: allSucceeded,
220
- steps: results,
221
- elapsed_ms: Date.now() - startTime,
222
- };
223
- }
224
- //# sourceMappingURL=engine.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/workflows/engine.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAsB5D;;;;;;;;;;;GAWG;AACH,SAAS,iBAAiB,CACxB,SAA6B,EAC7B,OAAiC,EACjC,WAAoC;IAEpC,IAAI,CAAC,SAAS;QAAE,OAAO,IAAI,CAAC;IAE5B,oBAAoB;IACpB,MAAM,YAAY,GAAG,SAAS,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAClE,IAAI,YAAY,EAAE,CAAC;QACjB,MAAM,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC;aAC3B,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;QAC7C,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,YAAY,GAAG,SAAS,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;IACnE,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,OAAO,CAAC,KAAK,KAAK,YAAY,CAAC,CAAC,CAAC,CAAC;IAC3C,CAAC;IAED,oBAAoB;IACpB,MAAM,aAAa,GAAG,SAAS,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;IACpE,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,CACL,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC;YACvC,gBAAgB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAc,CAAC,CACxD,CAAC;IACJ,CAAC;IAED,oDAAoD;IACpD,M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
2
- * Workflow Loader — load and validate YAML workflow definitions.
3
- */
4
- import type { WorkflowDefinition } from "./types.js";
5
- /**
6
- * Validate a parsed workflow definition has required fields.
7
- * Returns an array of validation error messages (empty = valid).
8
- */
9
- export declare function validateWorkflow(def: unknown): string[];
10
- /**
11
- * Load a single workflow YAML file. Throws on parse or validation errors.
12
- */
13
- export declare function loadWorkflowFile(filePath: string): WorkflowDefinition;
14
- /**
15
- * Load all workflow YAML files from a directory.
16
- * Returns loaded workflows and any errors encountered.
17
- */
18
- export declare function loadWorkflowDirectory(dirPath: string): {
19
- workflows: WorkflowDefinition[];
20
- errors: Array<{
21
- file: string;
22
- error: string;
23
- }>;
24
- };
25
- /**
26
- * Find a workflow matching a file type category name.
27
- */
28
- export declare function findWorkflowForCategory(workflows: WorkflowDefinition[], categoryName: string): WorkflowDefinition | undefined;
29
- /**
30
- * Find a workflow matching a MIME type or file extension.
31
- */
32
- export declare function findWorkflowForFileType(workflows: WorkflowDefinition[], fileType: string): WorkflowDefinition | undefined;
33
- //# sourceMappingURL=loader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/workflows/loader.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,EAAE,CAsEvD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,kBAAkB,CAUrE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG;IACtD,SAAS,EAAE,kBAAkB,EAAE,CAAC;IAChC,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAChD,CAyBA;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,kBAAkB,EAAE,EAC/B,YAAY,EAAE,MAAM,GACnB,kBAAkB,GAAG,SAAS,CAIhC;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,kBAAkB,EAAE,EAC/B,QAAQ,EAAE,MAAM,GACf,kBAAkB,GAAG,SAAS,CAKhC"}
@@ -1,130 +0,0 @@
1
- /**
2
- * Workflow Loader — load and validate YAML workflow definitions.
3
- */
4
- import { readFileSync, readdirSync, existsSync } from "node:fs";
5
- import { join, extname } from "node:path";
6
- import yaml from "js-yaml";
7
- /**
8
- * Validate a parsed workflow definition has required fields.
9
- * Returns an array of validation error messages (empty = valid).
10
- */
11
- export function validateWorkflow(def) {
12
- const errors = [];
13
- if (!def || typeof def !== "object") {
14
- return ["Workflow must be an object"];
15
- }
16
- const w = def;
17
- if (typeof w.name !== "string" || !w.name) {
18
- errors.push("Missing required field: name");
19
- }
20
- if (typeof w.description !== "string" || !w.description) {
21
- errors.push("Missing required field: description");
22
- }
23
- if (typeof w.version !== "string" || !w.version) {
24
- errors.push("Missing required field: version");
25
- }
26
- // Triggers
27
- if (!w.triggers || typeof w.triggers !== "object") {
28
- errors.push("Missing required field: triggers");
29
- }
30
- else {
31
- const triggers = w.triggers;
32
- if (!Array.isArray(triggers.file_types) || triggers.file_types.length === 0) {
33
- errors.push("triggers.file_types must be a non-empty array");
34
- }
35
- }
36
- // Steps
37
- if (!Array.isArray(w.steps) || w.steps.length === 0) {
38
- errors.push("steps must be a non-empty array");
39
- }
40
- else {
41
- const stepNames = new Set();
42
- for (let i = 0; i < w.steps.length; i++) {
43
- const step = w.steps[i];
44
- if (!step || typeof step !== "object") {
45
- errors.push(`steps[${i}] must be an object`);
46
- continue;
47
- }
48
- if (typeof step.name !== "string" || !step.name) {
49
- errors.push(`steps[${i}] missing required field: name`);
50
- }
51
- else if (stepNames.has(step.name)) {
52
- errors.push(`steps[${i}] duplicate step name: ${step.name}`);
53
- }
54
- else {
55
- stepNames.add(step.name);
56
- }
57
- if (typeof step.tool !== "string" || !step.tool) {
58
- errors.push(`steps[${i}] missing required field: tool`);
59
- }
60
- if (step.on_error && !["continue", "abort", "retry"].includes(step.on_error)) {
61
- errors.push(`steps[${i}].on_error must be one of: continue, abort, retry`);
62
- }
63
- if (step.depth && !["quick", "standard", "deep"].includes(step.depth)) {
64
- errors.push(`steps[${i}].depth must be one of: quick, standard, deep`);
65
- }
66
- if (step.retries !== undefined) {
67
- if (typeof step.retries !== "number" || !Number.isInteger(step.retries) || step.retries < 1) {
68
- errors.push(`steps[${i}].retries must be a positive integer`);
69
- }
70
- }
71
- if (step.retry_delay !== undefined) {
72
- if (typeof step.retry_delay !== "number" || step.retry_delay < 0) {
73
- errors.push(`steps[${i}].retry_delay must be a non-negative number`);
74
- }
75
- }
76
- }
77
- }
78
- return errors;
79
- }
80
- /**
81
- * Load a single workflow YAML file. Throws on parse or validation errors.
82
- */
83
- export function loadWorkflowFile(filePath) {
84
- const content = readFileSync(filePath, "utf-8");
85
- const parsed = yaml.load(content);
86
- const errors = validateWorkflow(parsed);
87
- if (errors.length > 0) {
88
- throw new Error(`Invalid workflow ${filePath}:\n ${errors.join("\n ")}`);
89
- }
90
- return parsed;
91
- }
92
- /**
93
- * Load all workflow YAML files from a directory.
94
- * Returns loaded workflows and any errors encountered.
95
- */
96
- export function loadWorkflowDirectory(dirPath) {
97
- const workflows = [];
98
- const errors = [];
99
- if (!existsSync(dirPath)) {
100
- return { workflows, errors };
101
- }
102
- const files = readdirSync(dirPath).filter((f) => extname(f) === ".yaml" || extname(f) === ".yml");
103
- for (const file of files) {
104
- try {
105
- const workflow = loadWorkflowFile(join(dirPath, file));
106
- workflows.push(workflow);
107
- }
108
- catch (err) {
109
- errors.push({
110
- file,
111
- error: err instanceof Error ? err.message : String(err),
112
- });
113
- }
114
- }
115
- return { workflows, errors };
116
- }
117
- /**
118
- * Find a workflow matching a file type category name.
119
- */
120
- export function findWorkflowForCategory(workflows, categoryName) {
121
- return workflows.find((w) => w.triggers.categories?.includes(categoryName));
122
- }
123
- /**
124
- * Find a workflow matching a MIME type or file extension.
125
- */
126
- export function findWorkflowForFileType(workflows, fileType) {
127
- const lower = fileType.toLowerCase();
128
- return workflows.find((w) => w.triggers.file_types.some((t) => lower.includes(t.toLowerCase())));
129
- }
130
- //# sourceMappingURL=loader.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/workflows/loader.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,IAAI,MAAM,SAAS,CAAC;AAG3B;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAY;IAC3C,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QACpC,OAAO,CAAC,4BAA4B,CAAC,CAAC;IACxC,CAAC;IAED,MAAM,CAAC,GAAG,GAA8B,CAAC;IAEzC,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAC1C,MAAM,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;IAC9C,CAAC;IACD,IAAI,OAAO,CAAC,CAAC,WAAW,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QACxD,MAAM,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;IACrD,CAAC;IACD,IAAI,OAAO,CAAC,CAAC,OAAO,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;QAChD,MAAM,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;IACjD,CAAC;IAED,WAAW;IACX,IAAI,C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QAAQ,CAAC,CAAC;QAC3B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI;gBACJ,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;aACxD,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;AAC/B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CACrC,SAA+B,EAC/B,YAAoB;IAEpB,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAC1B,CAAC,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,YAAY,CAAC,CAC9C,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CACrC,SAA+B,EAC/B,QAAgB;IAEhB,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;IACrC,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAC1B,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CACnE,CAAC;AACJ,CAAC"}
@@ -1,109 +0,0 @@
1
- /**
2
- * Workflow definition types for declarative analysis workflows.
3
- */
4
- import type { DepthTier } from "../file-type-mappings.js";
5
- /** What to do when a step fails. */
6
- export type OnError = "continue" | "abort" | "retry";
7
- /** A condition expression evaluated against previous step results. */
8
- export interface StepCondition {
9
- /** Simple expression: "depth in ['standard', 'deep']" or "pdfid.js_count > 0" */
10
- expr: string;
11
- }
12
- /** A single step in a workflow. */
13
- export interface WorkflowStep {
14
- /** Step identifier (unique within workflow) */
15
- name: string;
16
- /** Tool name (must exist in tool registry or file-type-mappings) */
17
- tool: string;
18
- /** Arguments passed to the tool (supports {input_file} and {step_name.field} interpolation) */
19
- args?: string[];
20
- /** Condition that must be true for this step to run */
21
- condition?: string;
22
- /** Error handling behavior (default: "continue") */
23
- on_error?: OnError;
24
- /** Per-step timeout in seconds (overrides tool default) */
25
- timeout?: number;
26
- /** Minimum depth tier for this step (default: "standard") */
27
- depth?: DepthTier;
28
- /** Max retry attempts when on_error is "retry" (default: 2) */
29
- retries?: number;
30
- /** Delay between retries in seconds (default: 1) */
31
- retry_delay?: number;
32
- }
33
- /** Workflow trigger — when this workflow should be selected. */
34
- export interface WorkflowTrigger {
35
- /** MIME types or file extensions that trigger this workflow */
36
- file_types: string[];
37
- /** Category names from file-type-mappings (e.g., "PE", "PDF") */
38
- categories?: string[];
39
- }
40
- /** Workflow parameter definition. */
41
- export interface WorkflowParameter {
42
- type: "enum" | "boolean" | "string" | "number";
43
- values?: string[];
44
- default?: unknown;
45
- description?: string;
46
- }
47
- /** Output section definition. */
48
- export interface OutputSection {
49
- name: string;
50
- fields?: string[];
51
- source?: string;
52
- }
53
- /** Complete workflow definition (maps to YAML structure). */
54
- export interface WorkflowDefinition {
55
- /** Workflow identifier */
56
- name: string;
57
- /** Human-readable description */
58
- description: string;
59
- /** Semantic version */
60
- version: string;
61
- /** Author / contributor */
62
- author?: string;
63
- /** When to select this workflow */
64
- triggers: WorkflowTrigger;
65
- /** Configurable parameters */
66
- parameters?: Record<string, WorkflowParameter>;
67
- /** Ordered list of analysis steps */
68
- steps: WorkflowStep[];
69
- /** Output format specification */
70
- output?: {
71
- format: "json" | "text";
72
- sections?: OutputSection[];
73
- };
74
- }
75
- /** Result of executing a single workflow step. */
76
- export interface StepResult {
77
- /** Step name */
78
- name: string;
79
- /** Tool that was run */
80
- tool: string;
81
- /** Whether the step succeeded */
82
- success: boolean;
83
- /** Raw output from the tool */
84
- output?: string;
85
- /** Exit code from the tool */
86
- exitCode?: number;
87
- /** Error message if failed */
88
- error?: string;
89
- /** Full command string that was executed */
90
- command?: string;
91
- /** Whether the step was skipped (condition not met) */
92
- skipped?: boolean;
93
- /** Number of retries that were attempted */
94
- retries?: number;
95
- /** Elapsed time in ms */
96
- elapsed_ms: number;
97
- }
98
- /** Result of executing a complete workflow. */
99
- export interface WorkflowResult {
100
- /** Workflow name */
101
- workflow: string;
102
- /** Overall success (all non-skipped steps succeeded or continued) */
103
- success: boolean;
104
- /** Results for each step */
105
- steps: StepResult[];
106
- /** Total elapsed time in ms */
107
- elapsed_ms: number;
108
- }
109
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/workflows/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1D,oCAAoC;AACpC,MAAM,MAAM,OAAO,GAAG,UAAU,GAAG,OAAO,GAAG,OAAO,CAAC;AAErD,sEAAsE;AACtE,MAAM,WAAW,aAAa;IAC5B,iFAAiF;IACjF,IAAI,EAAE,MAAM,CAAC;CACd;AAED,mCAAmC;AACnC,MAAM,WAAW,YAAY;IAC3B,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,+FAA+F;IAC/F,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,gEAAgE;AAChE,MAAM,WAAW,eAAe;IAC9B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AAM,CAAC,EAAE,MAAM,CAAC;IAChB,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yBAAyB;IACzB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,+CAA+C;AAC/C,MAAM,WAAW,cAAc;IAC7B,oBAAoB;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,qEAAqE;IACrE,OAAO,EAAE,OAAO,CAAC;IACjB,4BAA4B;IAC5B,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAC;CACpB"}
@@ -1,5 +0,0 @@
1
- /**
2
- * Workflow definition types for declarative analysis workflows.
3
- */
4
- export {};
5
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/workflows/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}