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.
Files changed (134) hide show
  1. package/CLAUDE_INSTALLATION.md +129 -0
  2. package/CODEX_INSTALLATION.md +25 -1
  3. package/COPILOT_INSTALLATION.md +29 -1
  4. package/LICENSE +21 -21
  5. package/README.md +232 -110
  6. package/dist/analysis-provenance.d.ts +50 -2
  7. package/dist/analysis-provenance.js +1 -0
  8. package/dist/analysis-task-runner.js +92 -0
  9. package/dist/config.d.ts +35 -16
  10. package/dist/config.js +37 -3
  11. package/dist/database.js +115 -115
  12. package/dist/decompiler-worker.d.ts +10 -5
  13. package/dist/decompiler-worker.js +240 -58
  14. package/dist/dynamic-trace.d.ts +6 -0
  15. package/dist/dynamic-trace.js +52 -1
  16. package/dist/ghidra-config.js +17 -1
  17. package/dist/index.js +38 -8
  18. package/dist/pe-runtime-functions.d.ts +90 -0
  19. package/dist/pe-runtime-functions.js +452 -0
  20. package/dist/prompts/module-reconstruction-review.d.ts +5 -0
  21. package/dist/prompts/module-reconstruction-review.js +65 -0
  22. package/dist/runtime-correlation.d.ts +5 -0
  23. package/dist/runtime-correlation.js +179 -2
  24. package/dist/sample-workspace.d.ts +28 -0
  25. package/dist/sample-workspace.js +186 -0
  26. package/dist/semantic-name-suggestion-artifacts.d.ts +56 -0
  27. package/dist/semantic-name-suggestion-artifacts.js +87 -0
  28. package/dist/server.js +1 -1
  29. package/dist/setup-guidance.d.ts +73 -0
  30. package/dist/setup-guidance.js +211 -0
  31. package/dist/tools/artifact-read.d.ts +10 -10
  32. package/dist/tools/artifacts-diff.d.ts +8 -8
  33. package/dist/tools/artifacts-list.d.ts +16 -16
  34. package/dist/tools/attack-map.d.ts +8 -8
  35. package/dist/tools/binary-role-profile.d.ts +1197 -0
  36. package/dist/tools/binary-role-profile.js +575 -0
  37. package/dist/tools/code-function-explain-apply.d.ts +12 -12
  38. package/dist/tools/code-function-explain-prepare.d.ts +12 -12
  39. package/dist/tools/code-function-explain-review.d.ts +58 -58
  40. package/dist/tools/code-function-rename-apply.d.ts +12 -12
  41. package/dist/tools/code-function-rename-prepare.d.ts +14 -14
  42. package/dist/tools/code-function-rename-review.d.ts +66 -66
  43. package/dist/tools/code-functions-define.d.ts +337 -0
  44. package/dist/tools/code-functions-define.js +337 -0
  45. package/dist/tools/code-functions-list.js +1 -1
  46. package/dist/tools/code-functions-rank.js +1 -1
  47. package/dist/tools/code-functions-reconstruct.d.ts +368 -58
  48. package/dist/tools/code-functions-reconstruct.js +130 -10
  49. package/dist/tools/code-functions-smart-recover.d.ts +352 -0
  50. package/dist/tools/code-functions-smart-recover.js +190 -0
  51. package/dist/tools/code-module-review-apply.d.ts +233 -0
  52. package/dist/tools/code-module-review-apply.js +209 -0
  53. package/dist/tools/code-module-review-prepare.d.ts +756 -0
  54. package/dist/tools/code-module-review-prepare.js +343 -0
  55. package/dist/tools/code-module-review.d.ts +474 -0
  56. package/dist/tools/code-module-review.js +566 -0
  57. package/dist/tools/code-reconstruct-export.d.ts +193 -21
  58. package/dist/tools/code-reconstruct-export.js +578 -21
  59. package/dist/tools/code-reconstruct-plan.d.ts +20 -20
  60. package/dist/tools/com-role-profile.d.ts +353 -0
  61. package/dist/tools/com-role-profile.js +186 -0
  62. package/dist/tools/dll-export-profile.d.ts +625 -0
  63. package/dist/tools/dll-export-profile.js +230 -0
  64. package/dist/tools/dotnet-metadata-extract.d.ts +122 -122
  65. package/dist/tools/dotnet-reconstruct-export.d.ts +49 -49
  66. package/dist/tools/dotnet-types-list.d.ts +66 -66
  67. package/dist/tools/dynamic-dependencies.d.ts +144 -8
  68. package/dist/tools/dynamic-dependencies.js +20 -1
  69. package/dist/tools/dynamic-memory-import.js +105 -2
  70. package/dist/tools/ghidra-analyze.d.ts +20 -0
  71. package/dist/tools/ghidra-analyze.js +10 -2
  72. package/dist/tools/ghidra-health.d.ts +177 -0
  73. package/dist/tools/ghidra-health.js +28 -0
  74. package/dist/tools/ioc-export.d.ts +8 -8
  75. package/dist/tools/packer-detect.d.ts +14 -14
  76. package/dist/tools/packer-detect.js +6 -9
  77. package/dist/tools/pe-exports-extract.d.ts +8 -8
  78. package/dist/tools/pe-exports-extract.js +6 -9
  79. package/dist/tools/pe-fingerprint.d.ts +36 -36
  80. package/dist/tools/pe-imports-extract.d.ts +8 -8
  81. package/dist/tools/pe-imports-extract.js +6 -9
  82. package/dist/tools/pe-pdata-extract.d.ts +448 -0
  83. package/dist/tools/pe-pdata-extract.js +219 -0
  84. package/dist/tools/pe-symbols-recover.d.ts +227 -0
  85. package/dist/tools/pe-symbols-recover.js +316 -0
  86. package/dist/tools/report-generate.d.ts +15 -1
  87. package/dist/tools/report-generate.js +139 -16
  88. package/dist/tools/report-summarize.d.ts +2242 -8
  89. package/dist/tools/report-summarize.js +246 -10
  90. package/dist/tools/runtime-detect.d.ts +8 -8
  91. package/dist/tools/runtime-detect.js +2 -12
  92. package/dist/tools/rust-binary-analyze.d.ts +2047 -0
  93. package/dist/tools/rust-binary-analyze.js +443 -0
  94. package/dist/tools/sample-profile-get.d.ts +135 -16
  95. package/dist/tools/sample-profile-get.js +35 -32
  96. package/dist/tools/sandbox-execute.d.ts +10 -10
  97. package/dist/tools/strings-extract.d.ts +8 -8
  98. package/dist/tools/strings-extract.js +2 -12
  99. package/dist/tools/strings-floss-decode.d.ts +8 -8
  100. package/dist/tools/system-health.d.ts +172 -36
  101. package/dist/tools/system-health.js +14 -0
  102. package/dist/tools/system-setup-guide.d.ts +179 -0
  103. package/dist/tools/system-setup-guide.js +62 -0
  104. package/dist/tools/tool-help.d.ts +16 -16
  105. package/dist/tools/tool-help.js +172 -0
  106. package/dist/tools/yara-scan.d.ts +8 -8
  107. package/dist/types.d.ts +2 -0
  108. package/dist/workflows/function-explanation-review.d.ts +3034 -76
  109. package/dist/workflows/function-explanation-review.js +172 -42
  110. package/dist/workflows/function-index-recover.d.ts +333 -0
  111. package/dist/workflows/function-index-recover.js +291 -0
  112. package/dist/workflows/module-reconstruction-review.d.ts +3537 -0
  113. package/dist/workflows/module-reconstruction-review.js +354 -0
  114. package/dist/workflows/reconstruct.d.ts +2182 -223
  115. package/dist/workflows/reconstruct.js +575 -32
  116. package/dist/workflows/semantic-name-review.d.ts +1436 -85
  117. package/dist/workflows/semantic-name-review.js +150 -58
  118. package/dist/workflows/triage.d.ts +8 -8
  119. package/ghidra_scripts/DecompileFunction.java +487 -487
  120. package/ghidra_scripts/ExtractCFG.java +256 -256
  121. package/ghidra_scripts/ExtractFunctions.java +442 -442
  122. package/ghidra_scripts/README.md +112 -112
  123. package/ghidra_scripts/SearchFunctionReferences.java +380 -380
  124. package/helpers/DotNetMetadataProbe/DotNetMetadataProbe.csproj +9 -9
  125. package/helpers/DotNetMetadataProbe/Program.cs +566 -566
  126. package/install-to-claude.ps1 +432 -0
  127. package/install-to-codex.ps1 +256 -178
  128. package/install-to-copilot.ps1 +389 -303
  129. package/package.json +4 -2
  130. package/requirements.txt +9 -9
  131. package/workers/requirements-dynamic.txt +11 -11
  132. package/workers/requirements.txt +8 -8
  133. package/workers/speakeasy_compat.py +175 -175
  134. package/workers/static_worker.py +3474 -3474
@@ -0,0 +1,354 @@
1
+ /**
2
+ * workflow.module_reconstruction_review
3
+ * High-level orchestration for module reconstruction review plus optional export refresh.
4
+ */
5
+ import { z } from 'zod';
6
+ import { createCodeModuleReviewHandler } from '../tools/code-module-review.js';
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';
12
+ const TOOL_NAME = 'workflow.module_reconstruction_review';
13
+ export const moduleReconstructionReviewWorkflowInputSchema = z
14
+ .object({
15
+ sample_id: z.string().describe('Sample ID (format: sha256:<hex>)'),
16
+ topk: z.number().int().min(1).max(40).default(12),
17
+ module_limit: z.number().int().min(1).max(12).default(6),
18
+ min_module_size: z.number().int().min(1).max(20).default(2),
19
+ include_imports: z.boolean().default(true),
20
+ include_strings: z.boolean().default(true),
21
+ analysis_goal: z
22
+ .string()
23
+ .min(1)
24
+ .max(400)
25
+ .default('Review reconstructed modules, refine their role labels, and propose evidence-grounded rewrite guidance.'),
26
+ session_tag: z.string().optional(),
27
+ evidence_scope: z.enum(['all', 'latest', 'session']).default('all'),
28
+ evidence_session_tag: z.string().optional(),
29
+ semantic_scope: z.enum(['all', 'latest', 'session']).default('all'),
30
+ semantic_session_tag: z.string().optional(),
31
+ compare_evidence_scope: z.enum(['all', 'latest', 'session']).optional(),
32
+ compare_evidence_session_tag: z.string().optional(),
33
+ compare_semantic_scope: z.enum(['all', 'latest', 'session']).optional(),
34
+ compare_semantic_session_tag: z.string().optional(),
35
+ role_target: z.string().min(1).max(64).optional(),
36
+ role_focus_areas: z.array(z.string().min(1).max(96)).max(16).default([]),
37
+ role_priority_order: z.array(z.string().min(1).max(96)).max(24).default([]),
38
+ persist_artifact: z.boolean().default(true),
39
+ auto_apply: z.boolean().default(true),
40
+ temperature: z.number().min(0).max(1).default(0.2),
41
+ max_tokens: z.number().int().min(200).max(8000).default(2400),
42
+ include_context: z.enum(['none', 'thisServer', 'allServers']).default('none'),
43
+ model_hint: z.string().min(1).max(120).optional(),
44
+ cost_priority: z.number().min(0).max(1).default(0.1),
45
+ speed_priority: z.number().min(0).max(1).default(0.2),
46
+ intelligence_priority: z.number().min(0).max(1).default(0.95),
47
+ system_prompt: z.string().min(1).max(800).optional(),
48
+ rerun_export: z.boolean().default(true),
49
+ export_path: z.enum(['auto', 'native', 'dotnet']).default('auto'),
50
+ export_topk: z.number().int().min(1).max(40).default(12),
51
+ export_name: z.string().min(1).max(64).optional(),
52
+ include_preflight: z.boolean().default(true),
53
+ auto_recover_function_index: z.boolean().default(true),
54
+ include_plan: z.boolean().default(false),
55
+ include_obfuscation_fallback: z.boolean().default(true),
56
+ fallback_on_error: z.boolean().default(true),
57
+ allow_partial: z.boolean().default(true),
58
+ validate_build: z.boolean().default(false),
59
+ run_harness: z.boolean().default(false),
60
+ compiler_path: z.string().min(1).max(260).optional(),
61
+ build_timeout_ms: z.number().int().min(5000).max(300000).default(60000),
62
+ run_timeout_ms: z.number().int().min(5000).max(300000).default(30000),
63
+ reuse_cached: z.boolean().default(true),
64
+ })
65
+ .refine((value) => value.evidence_scope !== 'session' || Boolean(value.evidence_session_tag?.trim()), {
66
+ message: 'evidence_session_tag is required when evidence_scope=session',
67
+ path: ['evidence_session_tag'],
68
+ })
69
+ .refine((value) => value.semantic_scope !== 'session' || Boolean(value.semantic_session_tag?.trim()), {
70
+ message: 'semantic_session_tag is required when semantic_scope=session',
71
+ path: ['semantic_session_tag'],
72
+ })
73
+ .refine((value) => value.compare_evidence_scope !== 'session' || Boolean(value.compare_evidence_session_tag?.trim()), {
74
+ message: 'compare_evidence_session_tag is required when compare_evidence_scope=session',
75
+ path: ['compare_evidence_session_tag'],
76
+ })
77
+ .refine((value) => value.compare_semantic_scope !== 'session' || Boolean(value.compare_semantic_session_tag?.trim()), {
78
+ message: 'compare_semantic_session_tag is required when compare_semantic_scope=session',
79
+ path: ['compare_semantic_session_tag'],
80
+ });
81
+ export const moduleReconstructionReviewWorkflowOutputSchema = z.object({
82
+ ok: z.boolean(),
83
+ data: z
84
+ .union([
85
+ z.object({
86
+ job_id: z.string(),
87
+ status: z.literal('queued'),
88
+ tool: z.literal(TOOL_NAME),
89
+ sample_id: z.string(),
90
+ progress: z.number().int().min(0).max(100),
91
+ }),
92
+ z.object({
93
+ sample_id: z.string(),
94
+ review: z.any(),
95
+ export: z.object({
96
+ attempted: z.boolean(),
97
+ status: z.enum(['completed', 'failed', 'skipped']),
98
+ selected_path: z.enum(['native', 'dotnet']).nullable(),
99
+ export_tool: z.string().nullable(),
100
+ export_root: z.string().nullable(),
101
+ manifest_path: z.string().nullable(),
102
+ build_validation_status: z.string().nullable(),
103
+ harness_validation_status: z.string().nullable(),
104
+ preflight: z
105
+ .object({
106
+ binary_profile: BinaryRoleProfileDataSchema.nullable(),
107
+ rust_profile: z.unknown().nullable(),
108
+ function_index_recovery: z.unknown().nullable(),
109
+ })
110
+ .nullable(),
111
+ provenance: AnalysisProvenanceSchema.nullable(),
112
+ selection_diffs: AnalysisSelectionDiffSchema.nullable(),
113
+ notes: z.array(z.string()),
114
+ }),
115
+ setup_actions: z.array(SetupActionSchema).optional(),
116
+ required_user_inputs: z.array(RequiredUserInputSchema).optional(),
117
+ next_steps: z.array(z.string()),
118
+ }),
119
+ ])
120
+ .optional(),
121
+ warnings: z.array(z.string()).optional(),
122
+ errors: z.array(z.string()).optional(),
123
+ artifacts: z.array(z.any()).optional(),
124
+ setup_actions: z.array(SetupActionSchema).optional(),
125
+ required_user_inputs: z.array(RequiredUserInputSchema).optional(),
126
+ metrics: z.object({
127
+ elapsed_ms: z.number(),
128
+ tool: z.string(),
129
+ }).optional(),
130
+ });
131
+ export const moduleReconstructionReviewWorkflowToolDefinition = {
132
+ name: TOOL_NAME,
133
+ description: 'Run module-level reconstruction review end-to-end for any MCP-capable LLM client, then optionally refresh reconstruct/export output with the applied module reviews.',
134
+ inputSchema: moduleReconstructionReviewWorkflowInputSchema,
135
+ outputSchema: moduleReconstructionReviewWorkflowOutputSchema,
136
+ };
137
+ export function createModuleReconstructionReviewWorkflowHandler(workspaceManager, database, cacheManager, mcpServer, dependencies, jobQueue) {
138
+ const moduleReviewHandler = dependencies?.moduleReviewHandler ||
139
+ createCodeModuleReviewHandler(workspaceManager, database, cacheManager, mcpServer);
140
+ const reconstructWorkflowHandler = dependencies?.reconstructWorkflowHandler ||
141
+ createReconstructWorkflowHandler(workspaceManager, database, cacheManager);
142
+ return async (args) => {
143
+ const startTime = Date.now();
144
+ const warnings = [];
145
+ const errors = [];
146
+ const artifacts = [];
147
+ let setupActions = [];
148
+ let requiredUserInputs = [];
149
+ try {
150
+ const input = moduleReconstructionReviewWorkflowInputSchema.parse(args);
151
+ const sample = database.findSample(input.sample_id);
152
+ if (!sample) {
153
+ return {
154
+ ok: false,
155
+ errors: [`Sample not found: ${input.sample_id}`],
156
+ metrics: { elapsed_ms: Date.now() - startTime, tool: TOOL_NAME },
157
+ };
158
+ }
159
+ if (jobQueue) {
160
+ const jobTimeoutMs = Math.max(input.build_timeout_ms + input.run_timeout_ms + 45 * 60 * 1000, 60 * 60 * 1000);
161
+ const jobId = jobQueue.enqueue({
162
+ type: 'static',
163
+ tool: TOOL_NAME,
164
+ sampleId: input.sample_id,
165
+ args: input,
166
+ priority: 5,
167
+ timeout: jobTimeoutMs,
168
+ retryPolicy: {
169
+ maxRetries: 1,
170
+ backoffMs: 5000,
171
+ retryableErrors: ['E_TIMEOUT', 'E_RESOURCE_EXHAUSTED'],
172
+ },
173
+ });
174
+ return {
175
+ ok: true,
176
+ data: {
177
+ job_id: jobId,
178
+ status: 'queued',
179
+ tool: TOOL_NAME,
180
+ sample_id: input.sample_id,
181
+ progress: 0,
182
+ },
183
+ metrics: { elapsed_ms: Date.now() - startTime, tool: TOOL_NAME },
184
+ };
185
+ }
186
+ const reviewResult = await moduleReviewHandler({
187
+ sample_id: input.sample_id,
188
+ topk: input.topk,
189
+ module_limit: input.module_limit,
190
+ min_module_size: input.min_module_size,
191
+ include_imports: input.include_imports,
192
+ include_strings: input.include_strings,
193
+ analysis_goal: input.analysis_goal,
194
+ session_tag: input.session_tag,
195
+ evidence_scope: input.evidence_scope,
196
+ evidence_session_tag: input.evidence_session_tag,
197
+ semantic_scope: input.semantic_scope,
198
+ semantic_session_tag: input.semantic_session_tag,
199
+ role_target: input.role_target,
200
+ role_focus_areas: input.role_focus_areas,
201
+ role_priority_order: input.role_priority_order,
202
+ persist_artifact: input.persist_artifact,
203
+ auto_apply: input.auto_apply,
204
+ temperature: input.temperature,
205
+ max_tokens: input.max_tokens,
206
+ include_context: input.include_context,
207
+ model_hint: input.model_hint,
208
+ cost_priority: input.cost_priority,
209
+ speed_priority: input.speed_priority,
210
+ intelligence_priority: input.intelligence_priority,
211
+ system_prompt: input.system_prompt,
212
+ });
213
+ warnings.push(...(reviewResult.warnings || []));
214
+ artifacts.push(...(reviewResult.artifacts || []));
215
+ {
216
+ const setupGuidance = collectSetupGuidanceFromWorkerResult(reviewResult);
217
+ setupActions = mergeSetupActions(setupActions, setupGuidance.setupActions);
218
+ requiredUserInputs = mergeRequiredUserInputs(requiredUserInputs, setupGuidance.requiredUserInputs);
219
+ }
220
+ if (!reviewResult.ok) {
221
+ return {
222
+ ok: false,
223
+ errors: reviewResult.errors || ['code.module.review failed'],
224
+ warnings: warnings.length > 0 ? warnings : undefined,
225
+ setup_actions: setupActions.length > 0 ? setupActions : undefined,
226
+ required_user_inputs: requiredUserInputs.length > 0 ? requiredUserInputs : undefined,
227
+ artifacts: artifacts.length > 0 ? artifacts : undefined,
228
+ metrics: { elapsed_ms: Date.now() - startTime, tool: TOOL_NAME },
229
+ };
230
+ }
231
+ const reviewData = (reviewResult.data || {});
232
+ const acceptedCount = Number(reviewData?.apply?.accepted_count || 0);
233
+ const canRefreshExport = input.rerun_export &&
234
+ reviewData.review_status === 'sampled_and_applied' &&
235
+ acceptedCount > 0;
236
+ let exportSummary = {
237
+ attempted: false,
238
+ status: 'skipped',
239
+ selected_path: null,
240
+ export_tool: null,
241
+ export_root: null,
242
+ manifest_path: null,
243
+ build_validation_status: null,
244
+ harness_validation_status: null,
245
+ preflight: null,
246
+ provenance: null,
247
+ selection_diffs: null,
248
+ notes: [],
249
+ };
250
+ if (canRefreshExport) {
251
+ const exportResult = await reconstructWorkflowHandler({
252
+ sample_id: input.sample_id,
253
+ path: input.export_path,
254
+ topk: input.export_topk,
255
+ export_name: input.export_name,
256
+ validate_build: input.validate_build,
257
+ run_harness: input.run_harness,
258
+ compiler_path: input.compiler_path,
259
+ build_timeout_ms: input.build_timeout_ms,
260
+ run_timeout_ms: input.run_timeout_ms,
261
+ evidence_scope: input.evidence_scope,
262
+ evidence_session_tag: input.evidence_session_tag,
263
+ compare_evidence_scope: input.compare_evidence_scope,
264
+ compare_evidence_session_tag: input.compare_evidence_session_tag,
265
+ semantic_scope: input.semantic_scope === 'all' && input.session_tag ? 'session' : input.semantic_scope,
266
+ semantic_session_tag: input.semantic_session_tag || input.session_tag,
267
+ compare_semantic_scope: input.compare_semantic_scope,
268
+ compare_semantic_session_tag: input.compare_semantic_session_tag,
269
+ include_preflight: input.include_preflight,
270
+ auto_recover_function_index: input.auto_recover_function_index,
271
+ include_plan: input.include_plan,
272
+ include_obfuscation_fallback: input.include_obfuscation_fallback,
273
+ fallback_on_error: input.fallback_on_error,
274
+ allow_partial: input.allow_partial,
275
+ reuse_cached: input.reuse_cached,
276
+ });
277
+ warnings.push(...(exportResult.warnings || []));
278
+ artifacts.push(...(exportResult.artifacts || []));
279
+ {
280
+ const setupGuidance = collectSetupGuidanceFromWorkerResult(exportResult);
281
+ setupActions = mergeSetupActions(setupActions, setupGuidance.setupActions);
282
+ requiredUserInputs = mergeRequiredUserInputs(requiredUserInputs, setupGuidance.requiredUserInputs);
283
+ }
284
+ if (!exportResult.ok) {
285
+ errors.push(...(exportResult.errors || ['workflow.reconstruct failed during export refresh']));
286
+ exportSummary = {
287
+ attempted: true,
288
+ status: 'failed',
289
+ selected_path: null,
290
+ export_tool: null,
291
+ export_root: null,
292
+ manifest_path: null,
293
+ build_validation_status: null,
294
+ harness_validation_status: null,
295
+ preflight: null,
296
+ provenance: null,
297
+ selection_diffs: null,
298
+ notes: ['Refresh export failed after module review apply.'],
299
+ };
300
+ }
301
+ else {
302
+ const exportData = (exportResult.data || {});
303
+ exportSummary = {
304
+ attempted: true,
305
+ status: 'completed',
306
+ selected_path: exportData.selected_path || null,
307
+ export_tool: exportData.export?.tool || null,
308
+ export_root: exportData.export?.export_root || null,
309
+ manifest_path: exportData.export?.manifest_path || null,
310
+ build_validation_status: exportData.export?.build_validation_status || null,
311
+ harness_validation_status: exportData.export?.harness_validation_status || null,
312
+ preflight: exportData.preflight || null,
313
+ provenance: exportData.provenance || null,
314
+ selection_diffs: exportData.selection_diffs || null,
315
+ notes: Array.isArray(exportData.notes) ? exportData.notes : [],
316
+ };
317
+ }
318
+ }
319
+ else if (input.rerun_export) {
320
+ exportSummary.notes.push(reviewData.review_status === 'prompt_contract_only'
321
+ ? 'Refresh export skipped because no sampled module reviews were applied yet.'
322
+ : 'Refresh export skipped because no module review artifacts were applied.');
323
+ }
324
+ return {
325
+ ok: errors.length === 0,
326
+ data: {
327
+ sample_id: input.sample_id,
328
+ review: reviewData,
329
+ export: exportSummary,
330
+ setup_actions: setupActions.length > 0 ? setupActions : undefined,
331
+ required_user_inputs: requiredUserInputs.length > 0 ? requiredUserInputs : undefined,
332
+ next_steps: [
333
+ ...(Array.isArray(reviewData.next_steps) ? reviewData.next_steps : []),
334
+ ...exportSummary.notes,
335
+ ],
336
+ },
337
+ warnings: warnings.length > 0 ? warnings : undefined,
338
+ errors: errors.length > 0 ? errors : undefined,
339
+ setup_actions: setupActions.length > 0 ? setupActions : undefined,
340
+ required_user_inputs: requiredUserInputs.length > 0 ? requiredUserInputs : undefined,
341
+ artifacts: artifacts.length > 0 ? artifacts : undefined,
342
+ metrics: { elapsed_ms: Date.now() - startTime, tool: TOOL_NAME },
343
+ };
344
+ }
345
+ catch (error) {
346
+ return {
347
+ ok: false,
348
+ errors: [error instanceof Error ? error.message : String(error)],
349
+ metrics: { elapsed_ms: Date.now() - startTime, tool: TOOL_NAME },
350
+ };
351
+ }
352
+ };
353
+ }
354
+ //# sourceMappingURL=module-reconstruction-review.js.map