windows-exe-decompiler-mcp-server 0.1.0 → 0.1.3
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/CLAUDE_INSTALLATION.md +129 -0
- package/CODEX_INSTALLATION.md +25 -1
- package/COPILOT_INSTALLATION.md +29 -1
- package/LICENSE +21 -21
- package/README.md +232 -110
- package/dist/analysis-provenance.d.ts +50 -2
- package/dist/analysis-provenance.js +1 -0
- package/dist/analysis-task-runner.js +92 -0
- package/dist/config.d.ts +35 -16
- package/dist/config.js +37 -3
- package/dist/database.js +115 -115
- package/dist/decompiler-worker.d.ts +10 -5
- package/dist/decompiler-worker.js +240 -58
- package/dist/dynamic-trace.d.ts +6 -0
- package/dist/dynamic-trace.js +52 -1
- package/dist/ghidra-config.js +17 -1
- package/dist/index.js +38 -8
- package/dist/pe-runtime-functions.d.ts +90 -0
- package/dist/pe-runtime-functions.js +452 -0
- package/dist/prompts/module-reconstruction-review.d.ts +5 -0
- package/dist/prompts/module-reconstruction-review.js +65 -0
- package/dist/runtime-correlation.d.ts +5 -0
- package/dist/runtime-correlation.js +179 -2
- package/dist/sample-workspace.d.ts +28 -0
- package/dist/sample-workspace.js +186 -0
- package/dist/semantic-name-suggestion-artifacts.d.ts +56 -0
- package/dist/semantic-name-suggestion-artifacts.js +87 -0
- package/dist/server.js +1 -1
- package/dist/setup-guidance.d.ts +73 -0
- package/dist/setup-guidance.js +211 -0
- package/dist/tools/artifact-read.d.ts +10 -10
- package/dist/tools/artifacts-diff.d.ts +8 -8
- package/dist/tools/artifacts-list.d.ts +16 -16
- package/dist/tools/attack-map.d.ts +8 -8
- package/dist/tools/binary-role-profile.d.ts +1197 -0
- package/dist/tools/binary-role-profile.js +575 -0
- package/dist/tools/code-function-explain-apply.d.ts +12 -12
- package/dist/tools/code-function-explain-prepare.d.ts +12 -12
- package/dist/tools/code-function-explain-review.d.ts +58 -58
- package/dist/tools/code-function-rename-apply.d.ts +12 -12
- package/dist/tools/code-function-rename-prepare.d.ts +14 -14
- package/dist/tools/code-function-rename-review.d.ts +66 -66
- package/dist/tools/code-functions-define.d.ts +337 -0
- package/dist/tools/code-functions-define.js +337 -0
- package/dist/tools/code-functions-list.js +1 -1
- package/dist/tools/code-functions-rank.js +1 -1
- package/dist/tools/code-functions-reconstruct.d.ts +368 -58
- package/dist/tools/code-functions-reconstruct.js +130 -10
- package/dist/tools/code-functions-smart-recover.d.ts +352 -0
- package/dist/tools/code-functions-smart-recover.js +190 -0
- package/dist/tools/code-module-review-apply.d.ts +233 -0
- package/dist/tools/code-module-review-apply.js +209 -0
- package/dist/tools/code-module-review-prepare.d.ts +756 -0
- package/dist/tools/code-module-review-prepare.js +343 -0
- package/dist/tools/code-module-review.d.ts +474 -0
- package/dist/tools/code-module-review.js +566 -0
- package/dist/tools/code-reconstruct-export.d.ts +193 -21
- package/dist/tools/code-reconstruct-export.js +578 -21
- package/dist/tools/code-reconstruct-plan.d.ts +20 -20
- package/dist/tools/com-role-profile.d.ts +353 -0
- package/dist/tools/com-role-profile.js +186 -0
- package/dist/tools/dll-export-profile.d.ts +625 -0
- package/dist/tools/dll-export-profile.js +230 -0
- package/dist/tools/dotnet-metadata-extract.d.ts +122 -122
- package/dist/tools/dotnet-reconstruct-export.d.ts +49 -49
- package/dist/tools/dotnet-types-list.d.ts +66 -66
- package/dist/tools/dynamic-dependencies.d.ts +144 -8
- package/dist/tools/dynamic-dependencies.js +20 -1
- package/dist/tools/dynamic-memory-import.js +105 -2
- package/dist/tools/ghidra-analyze.d.ts +20 -0
- package/dist/tools/ghidra-analyze.js +10 -2
- package/dist/tools/ghidra-health.d.ts +177 -0
- package/dist/tools/ghidra-health.js +28 -0
- package/dist/tools/ioc-export.d.ts +8 -8
- package/dist/tools/packer-detect.d.ts +14 -14
- package/dist/tools/packer-detect.js +6 -9
- package/dist/tools/pe-exports-extract.d.ts +8 -8
- package/dist/tools/pe-exports-extract.js +6 -9
- package/dist/tools/pe-fingerprint.d.ts +36 -36
- package/dist/tools/pe-imports-extract.d.ts +8 -8
- package/dist/tools/pe-imports-extract.js +6 -9
- package/dist/tools/pe-pdata-extract.d.ts +448 -0
- package/dist/tools/pe-pdata-extract.js +219 -0
- package/dist/tools/pe-symbols-recover.d.ts +227 -0
- package/dist/tools/pe-symbols-recover.js +316 -0
- package/dist/tools/report-generate.d.ts +15 -1
- package/dist/tools/report-generate.js +139 -16
- package/dist/tools/report-summarize.d.ts +2242 -8
- package/dist/tools/report-summarize.js +246 -10
- package/dist/tools/runtime-detect.d.ts +8 -8
- package/dist/tools/runtime-detect.js +2 -12
- package/dist/tools/rust-binary-analyze.d.ts +2047 -0
- package/dist/tools/rust-binary-analyze.js +443 -0
- package/dist/tools/sample-profile-get.d.ts +135 -16
- package/dist/tools/sample-profile-get.js +35 -32
- package/dist/tools/sandbox-execute.d.ts +10 -10
- package/dist/tools/strings-extract.d.ts +8 -8
- package/dist/tools/strings-extract.js +2 -12
- package/dist/tools/strings-floss-decode.d.ts +8 -8
- package/dist/tools/system-health.d.ts +172 -36
- package/dist/tools/system-health.js +14 -0
- package/dist/tools/system-setup-guide.d.ts +179 -0
- package/dist/tools/system-setup-guide.js +62 -0
- package/dist/tools/tool-help.d.ts +16 -16
- package/dist/tools/tool-help.js +172 -0
- package/dist/tools/yara-scan.d.ts +8 -8
- package/dist/types.d.ts +2 -0
- package/dist/workflows/function-explanation-review.d.ts +3034 -76
- package/dist/workflows/function-explanation-review.js +172 -42
- package/dist/workflows/function-index-recover.d.ts +333 -0
- package/dist/workflows/function-index-recover.js +291 -0
- package/dist/workflows/module-reconstruction-review.d.ts +3537 -0
- package/dist/workflows/module-reconstruction-review.js +354 -0
- package/dist/workflows/reconstruct.d.ts +2182 -223
- package/dist/workflows/reconstruct.js +575 -32
- package/dist/workflows/semantic-name-review.d.ts +1436 -85
- package/dist/workflows/semantic-name-review.js +150 -58
- package/dist/workflows/triage.d.ts +8 -8
- package/ghidra_scripts/DecompileFunction.java +487 -487
- package/ghidra_scripts/ExtractCFG.java +256 -256
- package/ghidra_scripts/ExtractFunctions.java +442 -442
- package/ghidra_scripts/README.md +112 -112
- package/ghidra_scripts/SearchFunctionReferences.java +380 -380
- package/helpers/DotNetMetadataProbe/DotNetMetadataProbe.csproj +9 -9
- package/helpers/DotNetMetadataProbe/Program.cs +566 -566
- package/install-to-claude.ps1 +432 -0
- package/install-to-codex.ps1 +256 -178
- package/install-to-copilot.ps1 +389 -303
- package/package.json +4 -2
- package/requirements.txt +9 -9
- package/workers/requirements-dynamic.txt +11 -11
- package/workers/requirements.txt +8 -8
- package/workers/speakeasy_compat.py +175 -175
- package/workers/static_worker.py +3474 -3474
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { createCodeFunctionExplainReviewHandler } from '../tools/code-function-explain-review.js';
|
|
7
7
|
import { createReconstructWorkflowHandler } from './reconstruct.js';
|
|
8
|
+
import { AnalysisProvenanceSchema } from '../analysis-provenance.js';
|
|
9
|
+
import { AnalysisSelectionDiffSchema } from '../selection-diff.js';
|
|
10
|
+
import { BinaryRoleProfileDataSchema } from '../tools/binary-role-profile.js';
|
|
11
|
+
import { RequiredUserInputSchema, SetupActionSchema, collectSetupGuidanceFromWorkerResult, mergeRequiredUserInputs, mergeSetupActions, } from '../setup-guidance.js';
|
|
8
12
|
const TOOL_NAME = 'workflow.function_explanation_review';
|
|
9
13
|
export const functionExplanationReviewWorkflowInputSchema = z
|
|
10
14
|
.object({
|
|
@@ -55,6 +59,22 @@ export const functionExplanationReviewWorkflowInputSchema = z
|
|
|
55
59
|
.string()
|
|
56
60
|
.optional()
|
|
57
61
|
.describe('Optional semantic review session selector used when semantic_scope=session or to narrow all/latest results'),
|
|
62
|
+
compare_evidence_scope: z
|
|
63
|
+
.enum(['all', 'latest', 'session'])
|
|
64
|
+
.optional()
|
|
65
|
+
.describe('Optional baseline runtime evidence scope used when refreshing export for comparison-aware workflow output'),
|
|
66
|
+
compare_evidence_session_tag: z
|
|
67
|
+
.string()
|
|
68
|
+
.optional()
|
|
69
|
+
.describe('Optional baseline runtime evidence session selector used when compare_evidence_scope=session'),
|
|
70
|
+
compare_semantic_scope: z
|
|
71
|
+
.enum(['all', 'latest', 'session'])
|
|
72
|
+
.optional()
|
|
73
|
+
.describe('Optional baseline semantic artifact scope used when refreshing export for comparison-aware workflow output'),
|
|
74
|
+
compare_semantic_session_tag: z
|
|
75
|
+
.string()
|
|
76
|
+
.optional()
|
|
77
|
+
.describe('Optional baseline semantic artifact session selector used when compare_semantic_scope=session'),
|
|
58
78
|
persist_artifact: z
|
|
59
79
|
.boolean()
|
|
60
80
|
.default(true)
|
|
@@ -131,6 +151,14 @@ export const functionExplanationReviewWorkflowInputSchema = z
|
|
|
131
151
|
.max(64)
|
|
132
152
|
.optional()
|
|
133
153
|
.describe('Optional export folder name used for the refresh run'),
|
|
154
|
+
include_preflight: z
|
|
155
|
+
.boolean()
|
|
156
|
+
.default(true)
|
|
157
|
+
.describe('Run binary role and language-specific preflight profiling before refresh export'),
|
|
158
|
+
auto_recover_function_index: z
|
|
159
|
+
.boolean()
|
|
160
|
+
.default(true)
|
|
161
|
+
.describe('When native function-index coverage is missing, automatically recover it before refresh export'),
|
|
134
162
|
include_plan: z
|
|
135
163
|
.boolean()
|
|
136
164
|
.default(false)
|
|
@@ -187,58 +215,86 @@ export const functionExplanationReviewWorkflowInputSchema = z
|
|
|
187
215
|
.refine((value) => value.semantic_scope !== 'session' || Boolean(value.semantic_session_tag?.trim()), {
|
|
188
216
|
message: 'semantic_session_tag is required when semantic_scope=session',
|
|
189
217
|
path: ['semantic_session_tag'],
|
|
218
|
+
})
|
|
219
|
+
.refine((value) => value.compare_evidence_scope !== 'session' || Boolean(value.compare_evidence_session_tag?.trim()), {
|
|
220
|
+
message: 'compare_evidence_session_tag is required when compare_evidence_scope=session',
|
|
221
|
+
path: ['compare_evidence_session_tag'],
|
|
222
|
+
})
|
|
223
|
+
.refine((value) => value.compare_semantic_scope !== 'session' || Boolean(value.compare_semantic_session_tag?.trim()), {
|
|
224
|
+
message: 'compare_semantic_session_tag is required when compare_semantic_scope=session',
|
|
225
|
+
path: ['compare_semantic_session_tag'],
|
|
190
226
|
});
|
|
191
227
|
export const functionExplanationReviewWorkflowOutputSchema = z.object({
|
|
192
228
|
ok: z.boolean(),
|
|
193
229
|
data: z
|
|
194
|
-
.
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
230
|
+
.union([
|
|
231
|
+
z.object({
|
|
232
|
+
job_id: z.string(),
|
|
233
|
+
status: z.literal('queued'),
|
|
234
|
+
tool: z.literal(TOOL_NAME),
|
|
235
|
+
sample_id: z.string(),
|
|
236
|
+
progress: z.number().int().min(0).max(100),
|
|
237
|
+
}),
|
|
238
|
+
z.object({
|
|
239
|
+
sample_id: z.string(),
|
|
240
|
+
review: z.object({
|
|
241
|
+
review_status: z.string(),
|
|
242
|
+
prompt_name: z.string(),
|
|
243
|
+
client: z.object({
|
|
244
|
+
name: z.string().nullable(),
|
|
245
|
+
version: z.string().nullable(),
|
|
246
|
+
sampling_available: z.boolean(),
|
|
247
|
+
}),
|
|
248
|
+
prepare: z.object({
|
|
249
|
+
prepared_count: z.number().int().nonnegative(),
|
|
250
|
+
artifact_id: z.string().nullable(),
|
|
251
|
+
}),
|
|
252
|
+
sampling: z.object({
|
|
253
|
+
attempted: z.boolean(),
|
|
254
|
+
model: z.string().nullable(),
|
|
255
|
+
stop_reason: z.string().nullable(),
|
|
256
|
+
parsed_explanation_count: z.number().int().nonnegative(),
|
|
257
|
+
}),
|
|
258
|
+
apply: z.object({
|
|
259
|
+
attempted: z.boolean(),
|
|
260
|
+
accepted_count: z.number().int().nonnegative(),
|
|
261
|
+
rejected_count: z.number().int().nonnegative(),
|
|
262
|
+
artifact_id: z.string().nullable(),
|
|
263
|
+
}),
|
|
264
|
+
confidence_policy: z.object({
|
|
265
|
+
calibrated: z.boolean(),
|
|
266
|
+
explanation_scores_are_heuristic: z.boolean(),
|
|
267
|
+
meaning: z.string(),
|
|
268
|
+
}),
|
|
213
269
|
}),
|
|
214
|
-
|
|
270
|
+
export: z.object({
|
|
215
271
|
attempted: z.boolean(),
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
272
|
+
status: z.enum(['completed', 'failed', 'skipped']),
|
|
273
|
+
selected_path: z.enum(['native', 'dotnet']).nullable(),
|
|
274
|
+
export_tool: z.string().nullable(),
|
|
275
|
+
export_root: z.string().nullable(),
|
|
276
|
+
manifest_path: z.string().nullable(),
|
|
277
|
+
build_validation_status: z.string().nullable(),
|
|
278
|
+
harness_validation_status: z.string().nullable(),
|
|
279
|
+
preflight: z
|
|
280
|
+
.object({
|
|
281
|
+
binary_profile: BinaryRoleProfileDataSchema.nullable(),
|
|
282
|
+
rust_profile: z.any().nullable(),
|
|
283
|
+
function_index_recovery: z.any().nullable(),
|
|
284
|
+
})
|
|
285
|
+
.nullable(),
|
|
286
|
+
provenance: AnalysisProvenanceSchema.nullable(),
|
|
287
|
+
selection_diffs: AnalysisSelectionDiffSchema.nullable(),
|
|
288
|
+
notes: z.array(z.string()),
|
|
224
289
|
}),
|
|
290
|
+
next_steps: z.array(z.string()),
|
|
225
291
|
}),
|
|
226
|
-
|
|
227
|
-
attempted: z.boolean(),
|
|
228
|
-
status: z.enum(['completed', 'failed', 'skipped']),
|
|
229
|
-
selected_path: z.enum(['native', 'dotnet']).nullable(),
|
|
230
|
-
export_tool: z.string().nullable(),
|
|
231
|
-
export_root: z.string().nullable(),
|
|
232
|
-
manifest_path: z.string().nullable(),
|
|
233
|
-
build_validation_status: z.string().nullable(),
|
|
234
|
-
harness_validation_status: z.string().nullable(),
|
|
235
|
-
notes: z.array(z.string()),
|
|
236
|
-
}),
|
|
237
|
-
next_steps: z.array(z.string()),
|
|
238
|
-
})
|
|
292
|
+
])
|
|
239
293
|
.optional(),
|
|
240
294
|
warnings: z.array(z.string()).optional(),
|
|
241
295
|
errors: z.array(z.string()).optional(),
|
|
296
|
+
setup_actions: z.array(SetupActionSchema).optional(),
|
|
297
|
+
required_user_inputs: z.array(RequiredUserInputSchema).optional(),
|
|
242
298
|
artifacts: z.array(z.any()).optional(),
|
|
243
299
|
metrics: z
|
|
244
300
|
.object({
|
|
@@ -253,7 +309,7 @@ export const functionExplanationReviewWorkflowToolDefinition = {
|
|
|
253
309
|
inputSchema: functionExplanationReviewWorkflowInputSchema,
|
|
254
310
|
outputSchema: functionExplanationReviewWorkflowOutputSchema,
|
|
255
311
|
};
|
|
256
|
-
export function createFunctionExplanationReviewWorkflowHandler(workspaceManager, database, cacheManager, mcpServer, dependencies) {
|
|
312
|
+
export function createFunctionExplanationReviewWorkflowHandler(workspaceManager, database, cacheManager, mcpServer, dependencies, jobQueue) {
|
|
257
313
|
const explainReviewHandler = dependencies?.explainReviewHandler ||
|
|
258
314
|
createCodeFunctionExplainReviewHandler(workspaceManager, database, cacheManager, mcpServer);
|
|
259
315
|
const reconstructWorkflowHandler = dependencies?.reconstructWorkflowHandler ||
|
|
@@ -263,8 +319,51 @@ export function createFunctionExplanationReviewWorkflowHandler(workspaceManager,
|
|
|
263
319
|
const warnings = [];
|
|
264
320
|
const errors = [];
|
|
265
321
|
const artifacts = [];
|
|
322
|
+
let setupActions = [];
|
|
323
|
+
let requiredUserInputs = [];
|
|
266
324
|
try {
|
|
267
325
|
const input = functionExplanationReviewWorkflowInputSchema.parse(args);
|
|
326
|
+
const sample = database.findSample(input.sample_id);
|
|
327
|
+
if (!sample) {
|
|
328
|
+
return {
|
|
329
|
+
ok: false,
|
|
330
|
+
errors: [`Sample not found: ${input.sample_id}`],
|
|
331
|
+
metrics: {
|
|
332
|
+
elapsed_ms: Date.now() - startTime,
|
|
333
|
+
tool: TOOL_NAME,
|
|
334
|
+
},
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
if (jobQueue) {
|
|
338
|
+
const jobTimeoutMs = Math.max(input.build_timeout_ms + input.run_timeout_ms + 45 * 60 * 1000, 60 * 60 * 1000);
|
|
339
|
+
const jobId = jobQueue.enqueue({
|
|
340
|
+
type: 'static',
|
|
341
|
+
tool: TOOL_NAME,
|
|
342
|
+
sampleId: input.sample_id,
|
|
343
|
+
args: input,
|
|
344
|
+
priority: 5,
|
|
345
|
+
timeout: jobTimeoutMs,
|
|
346
|
+
retryPolicy: {
|
|
347
|
+
maxRetries: 1,
|
|
348
|
+
backoffMs: 5000,
|
|
349
|
+
retryableErrors: ['E_TIMEOUT', 'E_RESOURCE_EXHAUSTED'],
|
|
350
|
+
},
|
|
351
|
+
});
|
|
352
|
+
return {
|
|
353
|
+
ok: true,
|
|
354
|
+
data: {
|
|
355
|
+
job_id: jobId,
|
|
356
|
+
status: 'queued',
|
|
357
|
+
tool: TOOL_NAME,
|
|
358
|
+
sample_id: input.sample_id,
|
|
359
|
+
progress: 0,
|
|
360
|
+
},
|
|
361
|
+
metrics: {
|
|
362
|
+
elapsed_ms: Date.now() - startTime,
|
|
363
|
+
tool: TOOL_NAME,
|
|
364
|
+
},
|
|
365
|
+
};
|
|
366
|
+
}
|
|
268
367
|
const reviewResult = await explainReviewHandler({
|
|
269
368
|
sample_id: input.sample_id,
|
|
270
369
|
address: input.address,
|
|
@@ -289,11 +388,18 @@ export function createFunctionExplanationReviewWorkflowHandler(workspaceManager,
|
|
|
289
388
|
});
|
|
290
389
|
warnings.push(...(reviewResult.warnings || []));
|
|
291
390
|
artifacts.push(...(reviewResult.artifacts || []));
|
|
391
|
+
{
|
|
392
|
+
const setupGuidance = collectSetupGuidanceFromWorkerResult(reviewResult);
|
|
393
|
+
setupActions = mergeSetupActions(setupActions, setupGuidance.setupActions);
|
|
394
|
+
requiredUserInputs = mergeRequiredUserInputs(requiredUserInputs, setupGuidance.requiredUserInputs);
|
|
395
|
+
}
|
|
292
396
|
if (!reviewResult.ok) {
|
|
293
397
|
return {
|
|
294
398
|
ok: false,
|
|
295
399
|
errors: reviewResult.errors || ['code.function.explain.review failed'],
|
|
296
400
|
warnings: warnings.length > 0 ? warnings : undefined,
|
|
401
|
+
setup_actions: setupActions.length > 0 ? setupActions : undefined,
|
|
402
|
+
required_user_inputs: requiredUserInputs.length > 0 ? requiredUserInputs : undefined,
|
|
297
403
|
artifacts: artifacts.length > 0 ? artifacts : undefined,
|
|
298
404
|
metrics: {
|
|
299
405
|
elapsed_ms: Date.now() - startTime,
|
|
@@ -315,6 +421,9 @@ export function createFunctionExplanationReviewWorkflowHandler(workspaceManager,
|
|
|
315
421
|
manifest_path: null,
|
|
316
422
|
build_validation_status: null,
|
|
317
423
|
harness_validation_status: null,
|
|
424
|
+
preflight: null,
|
|
425
|
+
provenance: null,
|
|
426
|
+
selection_diffs: null,
|
|
318
427
|
notes: [],
|
|
319
428
|
};
|
|
320
429
|
if (canRefreshExport) {
|
|
@@ -330,8 +439,14 @@ export function createFunctionExplanationReviewWorkflowHandler(workspaceManager,
|
|
|
330
439
|
run_timeout_ms: input.run_timeout_ms,
|
|
331
440
|
evidence_scope: input.evidence_scope,
|
|
332
441
|
evidence_session_tag: input.evidence_session_tag,
|
|
442
|
+
compare_evidence_scope: input.compare_evidence_scope,
|
|
443
|
+
compare_evidence_session_tag: input.compare_evidence_session_tag,
|
|
333
444
|
semantic_scope: input.semantic_scope === 'all' && input.session_tag ? 'session' : input.semantic_scope,
|
|
334
445
|
semantic_session_tag: input.semantic_session_tag || input.session_tag,
|
|
446
|
+
compare_semantic_scope: input.compare_semantic_scope,
|
|
447
|
+
compare_semantic_session_tag: input.compare_semantic_session_tag,
|
|
448
|
+
include_preflight: input.include_preflight,
|
|
449
|
+
auto_recover_function_index: input.auto_recover_function_index,
|
|
335
450
|
include_plan: input.include_plan,
|
|
336
451
|
include_obfuscation_fallback: input.include_obfuscation_fallback,
|
|
337
452
|
fallback_on_error: input.fallback_on_error,
|
|
@@ -340,6 +455,11 @@ export function createFunctionExplanationReviewWorkflowHandler(workspaceManager,
|
|
|
340
455
|
});
|
|
341
456
|
warnings.push(...(exportResult.warnings || []));
|
|
342
457
|
artifacts.push(...(exportResult.artifacts || []));
|
|
458
|
+
{
|
|
459
|
+
const setupGuidance = collectSetupGuidanceFromWorkerResult(exportResult);
|
|
460
|
+
setupActions = mergeSetupActions(setupActions, setupGuidance.setupActions);
|
|
461
|
+
requiredUserInputs = mergeRequiredUserInputs(requiredUserInputs, setupGuidance.requiredUserInputs);
|
|
462
|
+
}
|
|
343
463
|
if (!exportResult.ok) {
|
|
344
464
|
errors.push(...(exportResult.errors || ['workflow.reconstruct failed during export refresh']));
|
|
345
465
|
exportSummary = {
|
|
@@ -351,6 +471,9 @@ export function createFunctionExplanationReviewWorkflowHandler(workspaceManager,
|
|
|
351
471
|
manifest_path: null,
|
|
352
472
|
build_validation_status: null,
|
|
353
473
|
harness_validation_status: null,
|
|
474
|
+
preflight: null,
|
|
475
|
+
provenance: null,
|
|
476
|
+
selection_diffs: null,
|
|
354
477
|
notes: ['Refresh export failed after function explanation apply.'],
|
|
355
478
|
};
|
|
356
479
|
}
|
|
@@ -365,6 +488,9 @@ export function createFunctionExplanationReviewWorkflowHandler(workspaceManager,
|
|
|
365
488
|
manifest_path: exportData.export?.manifest_path || null,
|
|
366
489
|
build_validation_status: exportData.export?.build_validation_status || null,
|
|
367
490
|
harness_validation_status: exportData.export?.harness_validation_status || null,
|
|
491
|
+
preflight: exportData.preflight || null,
|
|
492
|
+
provenance: exportData.provenance || null,
|
|
493
|
+
selection_diffs: exportData.selection_diffs || null,
|
|
368
494
|
notes: Array.isArray(exportData.notes) ? exportData.notes : [],
|
|
369
495
|
};
|
|
370
496
|
}
|
|
@@ -418,6 +544,8 @@ export function createFunctionExplanationReviewWorkflowHandler(workspaceManager,
|
|
|
418
544
|
},
|
|
419
545
|
warnings: warnings.length > 0 ? warnings : undefined,
|
|
420
546
|
errors: errors.length > 0 ? errors : undefined,
|
|
547
|
+
setup_actions: setupActions.length > 0 ? setupActions : undefined,
|
|
548
|
+
required_user_inputs: requiredUserInputs.length > 0 ? requiredUserInputs : undefined,
|
|
421
549
|
artifacts: artifacts.length > 0 ? artifacts : undefined,
|
|
422
550
|
metrics: {
|
|
423
551
|
elapsed_ms: Date.now() - startTime,
|
|
@@ -429,6 +557,8 @@ export function createFunctionExplanationReviewWorkflowHandler(workspaceManager,
|
|
|
429
557
|
return {
|
|
430
558
|
ok: false,
|
|
431
559
|
errors: [error instanceof Error ? error.message : String(error)],
|
|
560
|
+
setup_actions: setupActions.length > 0 ? setupActions : undefined,
|
|
561
|
+
required_user_inputs: requiredUserInputs.length > 0 ? requiredUserInputs : undefined,
|
|
432
562
|
metrics: {
|
|
433
563
|
elapsed_ms: Date.now() - startTime,
|
|
434
564
|
tool: TOOL_NAME,
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { ToolArgs, ToolDefinition, WorkerResult } from '../types.js';
|
|
3
|
+
import type { WorkspaceManager } from '../workspace-manager.js';
|
|
4
|
+
import type { DatabaseManager } from '../database.js';
|
|
5
|
+
import type { CacheManager } from '../cache-manager.js';
|
|
6
|
+
export declare const FunctionIndexRecoverWorkflowInputSchema: z.ZodObject<{
|
|
7
|
+
sample_id: z.ZodString;
|
|
8
|
+
define_from: z.ZodDefault<z.ZodEnum<["auto", "smart_recover", "symbols_recover"]>>;
|
|
9
|
+
max_string_hints: z.ZodDefault<z.ZodNumber>;
|
|
10
|
+
replace_all: z.ZodDefault<z.ZodBoolean>;
|
|
11
|
+
persist_artifact: z.ZodDefault<z.ZodBoolean>;
|
|
12
|
+
register_analysis: z.ZodDefault<z.ZodBoolean>;
|
|
13
|
+
session_tag: z.ZodOptional<z.ZodString>;
|
|
14
|
+
include_rank_preview: z.ZodDefault<z.ZodBoolean>;
|
|
15
|
+
rank_topk: z.ZodDefault<z.ZodNumber>;
|
|
16
|
+
force_refresh: z.ZodDefault<z.ZodBoolean>;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
sample_id: string;
|
|
19
|
+
force_refresh: boolean;
|
|
20
|
+
max_string_hints: number;
|
|
21
|
+
replace_all: boolean;
|
|
22
|
+
persist_artifact: boolean;
|
|
23
|
+
register_analysis: boolean;
|
|
24
|
+
define_from: "auto" | "smart_recover" | "symbols_recover";
|
|
25
|
+
include_rank_preview: boolean;
|
|
26
|
+
rank_topk: number;
|
|
27
|
+
session_tag?: string | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
sample_id: string;
|
|
30
|
+
session_tag?: string | undefined;
|
|
31
|
+
force_refresh?: boolean | undefined;
|
|
32
|
+
max_string_hints?: number | undefined;
|
|
33
|
+
replace_all?: boolean | undefined;
|
|
34
|
+
persist_artifact?: boolean | undefined;
|
|
35
|
+
register_analysis?: boolean | undefined;
|
|
36
|
+
define_from?: "auto" | "smart_recover" | "symbols_recover" | undefined;
|
|
37
|
+
include_rank_preview?: boolean | undefined;
|
|
38
|
+
rank_topk?: number | undefined;
|
|
39
|
+
}>;
|
|
40
|
+
export declare const FunctionIndexRecoverWorkflowOutputSchema: z.ZodObject<{
|
|
41
|
+
ok: z.ZodBoolean;
|
|
42
|
+
data: z.ZodOptional<z.ZodObject<{
|
|
43
|
+
sample_id: z.ZodString;
|
|
44
|
+
define_from: z.ZodEnum<["smart_recover", "symbols_recover"]>;
|
|
45
|
+
recovered_function_count: z.ZodNumber;
|
|
46
|
+
recovered_symbol_count: z.ZodNumber;
|
|
47
|
+
imported_count: z.ZodNumber;
|
|
48
|
+
function_index_status: z.ZodEnum<["ready"]>;
|
|
49
|
+
decompile_status: z.ZodEnum<["missing"]>;
|
|
50
|
+
cfg_status: z.ZodEnum<["missing"]>;
|
|
51
|
+
recovery_strategy: z.ZodArray<z.ZodString, "many">;
|
|
52
|
+
imported_artifact: z.ZodOptional<z.ZodObject<{
|
|
53
|
+
id: z.ZodString;
|
|
54
|
+
type: z.ZodString;
|
|
55
|
+
path: z.ZodString;
|
|
56
|
+
sha256: z.ZodString;
|
|
57
|
+
mime: z.ZodOptional<z.ZodString>;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
path: string;
|
|
60
|
+
type: string;
|
|
61
|
+
id: string;
|
|
62
|
+
sha256: string;
|
|
63
|
+
mime?: string | undefined;
|
|
64
|
+
}, {
|
|
65
|
+
path: string;
|
|
66
|
+
type: string;
|
|
67
|
+
id: string;
|
|
68
|
+
sha256: string;
|
|
69
|
+
mime?: string | undefined;
|
|
70
|
+
}>>;
|
|
71
|
+
analysis_id: z.ZodOptional<z.ZodString>;
|
|
72
|
+
imported_function_preview: z.ZodArray<z.ZodObject<{
|
|
73
|
+
address: z.ZodString;
|
|
74
|
+
rva: z.ZodNullable<z.ZodNumber>;
|
|
75
|
+
size: z.ZodNullable<z.ZodNumber>;
|
|
76
|
+
name: z.ZodString;
|
|
77
|
+
is_entry_point: z.ZodBoolean;
|
|
78
|
+
is_exported: z.ZodBoolean;
|
|
79
|
+
}, "strip", z.ZodTypeAny, {
|
|
80
|
+
address: string;
|
|
81
|
+
name: string;
|
|
82
|
+
size: number | null;
|
|
83
|
+
is_entry_point: boolean;
|
|
84
|
+
is_exported: boolean;
|
|
85
|
+
rva: number | null;
|
|
86
|
+
}, {
|
|
87
|
+
address: string;
|
|
88
|
+
name: string;
|
|
89
|
+
size: number | null;
|
|
90
|
+
is_entry_point: boolean;
|
|
91
|
+
is_exported: boolean;
|
|
92
|
+
rva: number | null;
|
|
93
|
+
}>, "many">;
|
|
94
|
+
recovered_symbol_preview: z.ZodArray<z.ZodObject<{
|
|
95
|
+
address: z.ZodString;
|
|
96
|
+
recovered_name: z.ZodString;
|
|
97
|
+
name_strategy: z.ZodString;
|
|
98
|
+
confidence: z.ZodNumber;
|
|
99
|
+
}, "strip", z.ZodTypeAny, {
|
|
100
|
+
address: string;
|
|
101
|
+
confidence: number;
|
|
102
|
+
recovered_name: string;
|
|
103
|
+
name_strategy: string;
|
|
104
|
+
}, {
|
|
105
|
+
address: string;
|
|
106
|
+
confidence: number;
|
|
107
|
+
recovered_name: string;
|
|
108
|
+
name_strategy: string;
|
|
109
|
+
}>, "many">;
|
|
110
|
+
rank_preview: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
111
|
+
address: z.ZodString;
|
|
112
|
+
name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
113
|
+
score: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
114
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
115
|
+
summary: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
116
|
+
}, "strip", z.ZodTypeAny, {
|
|
117
|
+
address: string;
|
|
118
|
+
name?: string | null | undefined;
|
|
119
|
+
score?: number | null | undefined;
|
|
120
|
+
tags?: string[] | undefined;
|
|
121
|
+
summary?: string | null | undefined;
|
|
122
|
+
}, {
|
|
123
|
+
address: string;
|
|
124
|
+
name?: string | null | undefined;
|
|
125
|
+
score?: number | null | undefined;
|
|
126
|
+
tags?: string[] | undefined;
|
|
127
|
+
summary?: string | null | undefined;
|
|
128
|
+
}>, "many">>;
|
|
129
|
+
next_steps: z.ZodArray<z.ZodString, "many">;
|
|
130
|
+
}, "strip", z.ZodTypeAny, {
|
|
131
|
+
sample_id: string;
|
|
132
|
+
recovered_function_count: number;
|
|
133
|
+
recovered_symbol_count: number;
|
|
134
|
+
recovered_symbol_preview: {
|
|
135
|
+
address: string;
|
|
136
|
+
confidence: number;
|
|
137
|
+
recovered_name: string;
|
|
138
|
+
name_strategy: string;
|
|
139
|
+
}[];
|
|
140
|
+
next_steps: string[];
|
|
141
|
+
imported_count: number;
|
|
142
|
+
function_index_status: "ready";
|
|
143
|
+
decompile_status: "missing";
|
|
144
|
+
cfg_status: "missing";
|
|
145
|
+
define_from: "smart_recover" | "symbols_recover";
|
|
146
|
+
recovery_strategy: string[];
|
|
147
|
+
imported_function_preview: {
|
|
148
|
+
address: string;
|
|
149
|
+
name: string;
|
|
150
|
+
size: number | null;
|
|
151
|
+
is_entry_point: boolean;
|
|
152
|
+
is_exported: boolean;
|
|
153
|
+
rva: number | null;
|
|
154
|
+
}[];
|
|
155
|
+
analysis_id?: string | undefined;
|
|
156
|
+
imported_artifact?: {
|
|
157
|
+
path: string;
|
|
158
|
+
type: string;
|
|
159
|
+
id: string;
|
|
160
|
+
sha256: string;
|
|
161
|
+
mime?: string | undefined;
|
|
162
|
+
} | undefined;
|
|
163
|
+
rank_preview?: {
|
|
164
|
+
address: string;
|
|
165
|
+
name?: string | null | undefined;
|
|
166
|
+
score?: number | null | undefined;
|
|
167
|
+
tags?: string[] | undefined;
|
|
168
|
+
summary?: string | null | undefined;
|
|
169
|
+
}[] | undefined;
|
|
170
|
+
}, {
|
|
171
|
+
sample_id: string;
|
|
172
|
+
recovered_function_count: number;
|
|
173
|
+
recovered_symbol_count: number;
|
|
174
|
+
recovered_symbol_preview: {
|
|
175
|
+
address: string;
|
|
176
|
+
confidence: number;
|
|
177
|
+
recovered_name: string;
|
|
178
|
+
name_strategy: string;
|
|
179
|
+
}[];
|
|
180
|
+
next_steps: string[];
|
|
181
|
+
imported_count: number;
|
|
182
|
+
function_index_status: "ready";
|
|
183
|
+
decompile_status: "missing";
|
|
184
|
+
cfg_status: "missing";
|
|
185
|
+
define_from: "smart_recover" | "symbols_recover";
|
|
186
|
+
recovery_strategy: string[];
|
|
187
|
+
imported_function_preview: {
|
|
188
|
+
address: string;
|
|
189
|
+
name: string;
|
|
190
|
+
size: number | null;
|
|
191
|
+
is_entry_point: boolean;
|
|
192
|
+
is_exported: boolean;
|
|
193
|
+
rva: number | null;
|
|
194
|
+
}[];
|
|
195
|
+
analysis_id?: string | undefined;
|
|
196
|
+
imported_artifact?: {
|
|
197
|
+
path: string;
|
|
198
|
+
type: string;
|
|
199
|
+
id: string;
|
|
200
|
+
sha256: string;
|
|
201
|
+
mime?: string | undefined;
|
|
202
|
+
} | undefined;
|
|
203
|
+
rank_preview?: {
|
|
204
|
+
address: string;
|
|
205
|
+
name?: string | null | undefined;
|
|
206
|
+
score?: number | null | undefined;
|
|
207
|
+
tags?: string[] | undefined;
|
|
208
|
+
summary?: string | null | undefined;
|
|
209
|
+
}[] | undefined;
|
|
210
|
+
}>>;
|
|
211
|
+
warnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
212
|
+
errors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
213
|
+
artifacts: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
|
|
214
|
+
metrics: z.ZodOptional<z.ZodObject<{
|
|
215
|
+
elapsed_ms: z.ZodNumber;
|
|
216
|
+
tool: z.ZodString;
|
|
217
|
+
}, "strip", z.ZodTypeAny, {
|
|
218
|
+
elapsed_ms: number;
|
|
219
|
+
tool: string;
|
|
220
|
+
}, {
|
|
221
|
+
elapsed_ms: number;
|
|
222
|
+
tool: string;
|
|
223
|
+
}>>;
|
|
224
|
+
}, "strip", z.ZodTypeAny, {
|
|
225
|
+
ok: boolean;
|
|
226
|
+
data?: {
|
|
227
|
+
sample_id: string;
|
|
228
|
+
recovered_function_count: number;
|
|
229
|
+
recovered_symbol_count: number;
|
|
230
|
+
recovered_symbol_preview: {
|
|
231
|
+
address: string;
|
|
232
|
+
confidence: number;
|
|
233
|
+
recovered_name: string;
|
|
234
|
+
name_strategy: string;
|
|
235
|
+
}[];
|
|
236
|
+
next_steps: string[];
|
|
237
|
+
imported_count: number;
|
|
238
|
+
function_index_status: "ready";
|
|
239
|
+
decompile_status: "missing";
|
|
240
|
+
cfg_status: "missing";
|
|
241
|
+
define_from: "smart_recover" | "symbols_recover";
|
|
242
|
+
recovery_strategy: string[];
|
|
243
|
+
imported_function_preview: {
|
|
244
|
+
address: string;
|
|
245
|
+
name: string;
|
|
246
|
+
size: number | null;
|
|
247
|
+
is_entry_point: boolean;
|
|
248
|
+
is_exported: boolean;
|
|
249
|
+
rva: number | null;
|
|
250
|
+
}[];
|
|
251
|
+
analysis_id?: string | undefined;
|
|
252
|
+
imported_artifact?: {
|
|
253
|
+
path: string;
|
|
254
|
+
type: string;
|
|
255
|
+
id: string;
|
|
256
|
+
sha256: string;
|
|
257
|
+
mime?: string | undefined;
|
|
258
|
+
} | undefined;
|
|
259
|
+
rank_preview?: {
|
|
260
|
+
address: string;
|
|
261
|
+
name?: string | null | undefined;
|
|
262
|
+
score?: number | null | undefined;
|
|
263
|
+
tags?: string[] | undefined;
|
|
264
|
+
summary?: string | null | undefined;
|
|
265
|
+
}[] | undefined;
|
|
266
|
+
} | undefined;
|
|
267
|
+
metrics?: {
|
|
268
|
+
elapsed_ms: number;
|
|
269
|
+
tool: string;
|
|
270
|
+
} | undefined;
|
|
271
|
+
warnings?: string[] | undefined;
|
|
272
|
+
errors?: string[] | undefined;
|
|
273
|
+
artifacts?: any[] | undefined;
|
|
274
|
+
}, {
|
|
275
|
+
ok: boolean;
|
|
276
|
+
data?: {
|
|
277
|
+
sample_id: string;
|
|
278
|
+
recovered_function_count: number;
|
|
279
|
+
recovered_symbol_count: number;
|
|
280
|
+
recovered_symbol_preview: {
|
|
281
|
+
address: string;
|
|
282
|
+
confidence: number;
|
|
283
|
+
recovered_name: string;
|
|
284
|
+
name_strategy: string;
|
|
285
|
+
}[];
|
|
286
|
+
next_steps: string[];
|
|
287
|
+
imported_count: number;
|
|
288
|
+
function_index_status: "ready";
|
|
289
|
+
decompile_status: "missing";
|
|
290
|
+
cfg_status: "missing";
|
|
291
|
+
define_from: "smart_recover" | "symbols_recover";
|
|
292
|
+
recovery_strategy: string[];
|
|
293
|
+
imported_function_preview: {
|
|
294
|
+
address: string;
|
|
295
|
+
name: string;
|
|
296
|
+
size: number | null;
|
|
297
|
+
is_entry_point: boolean;
|
|
298
|
+
is_exported: boolean;
|
|
299
|
+
rva: number | null;
|
|
300
|
+
}[];
|
|
301
|
+
analysis_id?: string | undefined;
|
|
302
|
+
imported_artifact?: {
|
|
303
|
+
path: string;
|
|
304
|
+
type: string;
|
|
305
|
+
id: string;
|
|
306
|
+
sha256: string;
|
|
307
|
+
mime?: string | undefined;
|
|
308
|
+
} | undefined;
|
|
309
|
+
rank_preview?: {
|
|
310
|
+
address: string;
|
|
311
|
+
name?: string | null | undefined;
|
|
312
|
+
score?: number | null | undefined;
|
|
313
|
+
tags?: string[] | undefined;
|
|
314
|
+
summary?: string | null | undefined;
|
|
315
|
+
}[] | undefined;
|
|
316
|
+
} | undefined;
|
|
317
|
+
metrics?: {
|
|
318
|
+
elapsed_ms: number;
|
|
319
|
+
tool: string;
|
|
320
|
+
} | undefined;
|
|
321
|
+
warnings?: string[] | undefined;
|
|
322
|
+
errors?: string[] | undefined;
|
|
323
|
+
artifacts?: any[] | undefined;
|
|
324
|
+
}>;
|
|
325
|
+
export declare const functionIndexRecoverWorkflowToolDefinition: ToolDefinition;
|
|
326
|
+
interface FunctionIndexRecoverWorkflowDependencies {
|
|
327
|
+
smartRecoverHandler?: (args: ToolArgs) => Promise<WorkerResult>;
|
|
328
|
+
symbolsRecoverHandler?: (args: ToolArgs) => Promise<WorkerResult>;
|
|
329
|
+
defineHandler?: (args: ToolArgs) => Promise<WorkerResult>;
|
|
330
|
+
}
|
|
331
|
+
export declare function createFunctionIndexRecoverWorkflowHandler(workspaceManager: WorkspaceManager, database: DatabaseManager, cacheManager: CacheManager, dependencies?: FunctionIndexRecoverWorkflowDependencies): (args: ToolArgs) => Promise<WorkerResult>;
|
|
332
|
+
export {};
|
|
333
|
+
//# sourceMappingURL=function-index-recover.d.ts.map
|