rea-agents 6.3.0 → 6.5.0

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 (1332) hide show
  1. package/DISCLAIMER.md +136 -0
  2. package/README.md +72 -18
  3. package/THIRD_PARTY_NOTICES.md +134 -0
  4. package/bridge/android/ReaJadxBridge.java +123 -11
  5. package/bridge/cutter/rea_bridge.py +816 -0
  6. package/bridge/ghidra/ReaGhidraAnalysisOptions.java +38 -0
  7. package/bridge/ghidra/ReaGhidraApplySeeds.java +151 -0
  8. package/bridge/ghidra/ReaGhidraBridge.java +1729 -283
  9. package/bridge/ghidra/ReaGhidraBundleActivator.java +14 -0
  10. package/bridge/ghidra/ReaGhidraMipsSoftFloat.java +176 -0
  11. package/bridge/ghidra/ReaGhidraNoReturnFix.java +123 -0
  12. package/bridge/ghidra/ReaGhidraPrepareRaw.java +49 -0
  13. package/bridge/hopper_bridge.py +103 -69
  14. package/bridge/mitmproxy/capture.py +189 -13
  15. package/bridge/native/rea_lldb_tracer.py +40 -6
  16. package/bridge/process/ProcessRunTokenReader.swift +76 -34
  17. package/bridge/pwntools/layout_impl.py +5 -0
  18. package/bridge/pwntools/recorded_crash_impl.py +31 -10
  19. package/dist/adb/AdbConfiguration.js +100 -0
  20. package/dist/adb/AdbDeviceOutput.js +208 -0
  21. package/dist/adb/AdbDirectoryListing.js +80 -0
  22. package/dist/adb/AdbHostFileName.js +34 -0
  23. package/dist/adb/AdbProvider.js +1433 -0
  24. package/dist/adb/AdbShellOutput.js +307 -0
  25. package/dist/android/AndroidTargetSnapshot.js +104 -22
  26. package/dist/android/JadxAnalysis.js +32 -7
  27. package/dist/android/JadxConfiguration.js +163 -53
  28. package/dist/android/JadxDoctor.js +115 -0
  29. package/dist/android/JadxMcpTransport.js +5 -3
  30. package/dist/android/JadxProtocol.js +14 -0
  31. package/dist/android/JadxProvider.js +63 -25
  32. package/dist/android/JadxRelease.js +12 -1
  33. package/dist/android/JadxWorkspaceRoot.js +157 -0
  34. package/dist/apktool/ApktoolConfiguration.js +227 -0
  35. package/dist/apktool/ApktoolDecodeOutput.js +142 -0
  36. package/dist/apktool/ApktoolProvider.js +543 -0
  37. package/dist/application/AnalysisContextQueries.js +5 -8
  38. package/dist/application/AnalysisProvider.js +24 -14
  39. package/dist/application/AppBundleExecutable.js +30 -25
  40. package/dist/application/BinaryTargetResolver.js +210 -33
  41. package/dist/application/BrowserEvidence.js +1 -1
  42. package/dist/application/BrowserObservationService.js +13 -2
  43. package/dist/application/BrowserScenarioCaptureService.js +0 -1
  44. package/dist/application/CallPathTracing.js +52 -13
  45. package/dist/application/CapabilityInventory.js +179 -29
  46. package/dist/application/ClaudeDesktopConfigLocation.js +152 -0
  47. package/dist/application/ClientConfigurationDocument.js +154 -7
  48. package/dist/application/ClientConfigurationFiles.js +128 -0
  49. package/dist/application/ClientRegistrationEnvironment.js +41 -0
  50. package/dist/application/ClientRegistrationIdentity.js +94 -29
  51. package/dist/application/ClientRegistrationStatus.js +223 -67
  52. package/dist/application/DirectAnalysis.js +86 -31
  53. package/dist/application/DirectAnalysisCleanup.js +1 -1
  54. package/dist/application/DirectAnalysisStatus.js +14 -2
  55. package/dist/application/Doctor.js +117 -34
  56. package/dist/application/DoctorDiagnostics.js +34 -12
  57. package/dist/application/DoctorProviderIds.js +2 -0
  58. package/dist/application/DoctorScope.js +11 -2
  59. package/dist/application/DshCordisPatch.js +355 -0
  60. package/dist/application/DshCordisYaml.js +155 -0
  61. package/dist/application/EnhancedLiteralTracing.js +30 -16
  62. package/dist/application/EnhancedToolTypes.js +0 -1
  63. package/dist/application/EnhancedTools.js +164 -54
  64. package/dist/application/EvidenceBundleCommands.js +36 -19
  65. package/dist/application/EvidenceBundleFiles.js +29 -7
  66. package/dist/application/FunctionAnalysisEvidence.js +3 -0
  67. package/dist/application/GeminiClientSettings.js +151 -0
  68. package/dist/application/HermesClientHome.js +115 -0
  69. package/dist/application/HermesConfigurationYaml.js +272 -0
  70. package/dist/application/HopperDownload.js +39 -0
  71. package/dist/application/InventoryProjectionEvidence.js +0 -1
  72. package/dist/application/InvestigationProviders.js +19 -3
  73. package/dist/application/JsonFiles.js +114 -23
  74. package/dist/application/JsonInputFile.js +410 -0
  75. package/dist/application/LinuxHopper.js +130 -60
  76. package/dist/application/MacHopper.js +177 -150
  77. package/dist/application/MacHopperPaths.js +40 -0
  78. package/dist/application/MipsElfMetadata.js +201 -0
  79. package/dist/application/MipsElfSharedLoad.js +164 -0
  80. package/dist/application/MipsGnuAttributes.js +90 -0
  81. package/dist/application/MsixPackageStorage.js +133 -0
  82. package/dist/application/ProgressReporter.js +1 -1
  83. package/dist/application/ProviderOperationExecution.js +39 -0
  84. package/dist/application/ReconstructionCoverageService.js +0 -1
  85. package/dist/application/ReconstructionObligationCandidates.js +12 -5
  86. package/dist/application/ReconstructionObligationLedgerDiagnostics.js +2 -2
  87. package/dist/application/ReconstructionObligationLedgerEvaluation.js +15 -33
  88. package/dist/application/ReconstructionObligationLedgerProjection.js +3 -72
  89. package/dist/application/ReconstructionObligationLedgerService.js +3 -1
  90. package/dist/application/ReconstructionObligationOriginalCases.js +2 -1
  91. package/dist/application/ReferenceSourceImport.js +94 -31
  92. package/dist/application/ReferenceSourceImportEntries.js +40 -30
  93. package/dist/application/ReferenceSourceImportPolicy.js +99 -23
  94. package/dist/application/ReferenceSourceImportTypes.js +30 -23
  95. package/dist/application/ReferenceSourceVcsAdapter.js +163 -31
  96. package/dist/application/RegularFileRead.js +121 -7
  97. package/dist/application/Setup.js +88 -14
  98. package/dist/application/SetupClientConfiguration.js +307 -38
  99. package/dist/application/SetupClients.js +12 -6
  100. package/dist/application/SetupHost.js +158 -38
  101. package/dist/application/SetupInstallFailure.js +42 -2
  102. package/dist/application/SetupPlan.js +83 -57
  103. package/dist/application/SetupRecoveryBackup.js +66 -0
  104. package/dist/application/SetupRegistrationEnvironment.js +2 -1
  105. package/dist/application/SetupSkill.js +354 -88
  106. package/dist/application/SupportedClients.js +429 -70
  107. package/dist/application/TypeScriptEmittedSourceCandidates.js +26 -0
  108. package/dist/application/Uninstall.js +412 -73
  109. package/dist/application/UninstallFailure.js +14 -0
  110. package/dist/application/Update.js +54 -25
  111. package/dist/application/UpdateFailure.js +17 -0
  112. package/dist/application/UpdateMaintenance.js +25 -47
  113. package/dist/application/UpdateRuntime.js +141 -27
  114. package/dist/application/Utf8JsonInput.js +7 -0
  115. package/dist/application/WebModuleTraceService.js +7 -0
  116. package/dist/application/WebNetworkCaptureService.js +16 -7
  117. package/dist/application/WebScriptExportService.js +131 -65
  118. package/dist/application/WebSourceLocationService.js +22 -3
  119. package/dist/application/WindowsCapabilities.js +18 -15
  120. package/dist/application/WorkflowEvidence.js +24 -1
  121. package/dist/application/adb/AdbDeviceAnalysisPort.js +1 -0
  122. package/dist/application/adb/AdbDeviceAnalysisService.js +13 -0
  123. package/dist/application/analysisView/AnalysisViewService.js +122 -6
  124. package/dist/application/android/AndroidPackageInspection.js +25 -0
  125. package/dist/application/android/AndroidSearchEvidenceSummary.js +100 -0
  126. package/dist/application/apktool/ApktoolResourceAnalysisPort.js +1 -0
  127. package/dist/application/apktool/ApktoolResourceAnalysisService.js +13 -0
  128. package/dist/application/binary/AnalysisClientCleanup.js +0 -24
  129. package/dist/application/binary/AnalysisProviderEvaluation.js +1 -1
  130. package/dist/application/binary/AnalysisProviderRegistry.js +36 -21
  131. package/dist/application/binary/AnalysisSnapshotCache.js +41 -20
  132. package/dist/application/binary/AnalysisSnapshotFiles.js +75 -9
  133. package/dist/application/binary/BinarySession.js +250 -97
  134. package/dist/application/binary/BinarySessionExecution.js +5 -4
  135. package/dist/application/binary/BinarySessionOpen.js +13 -6
  136. package/dist/application/binary/BinarySessionRecords.js +33 -7
  137. package/dist/application/binary/BinarySessionStatus.js +93 -23
  138. package/dist/application/binary/BinaryTargetSummary.js +9 -0
  139. package/dist/application/binary/CompositeProvider.js +71 -28
  140. package/dist/application/binary/LazyAnalysisProvider.js +3 -1
  141. package/dist/application/binary/SessionProviderRouter.js +5 -2
  142. package/dist/application/binaryDiagnostics/BinaryLayoutService.js +13 -2
  143. package/dist/application/binaryDiagnostics/PeResourcesPort.js +1 -0
  144. package/dist/application/binaryDiagnostics/PeResourcesService.js +114 -0
  145. package/dist/application/binaryDiagnostics/RecordedCrashService.js +16 -4
  146. package/dist/application/captures/PacketCaptureService.js +83 -0
  147. package/dist/application/closeOwnedWebResources.js +7 -0
  148. package/dist/application/electron/ElectronFusePort.js +1 -0
  149. package/dist/application/electron/ElectronFuseService.js +80 -0
  150. package/dist/application/evm/EvmInterfaceService.js +4 -0
  151. package/dist/application/firmware/FirmwareAnalysisService.js +3 -0
  152. package/dist/application/flutter/DartAotInspection.js +26 -0
  153. package/dist/application/flutter/FlutterBuildAnalysisPort.js +1 -0
  154. package/dist/application/flutter/FlutterBuildAnalysisService.js +13 -0
  155. package/dist/application/frida/FridaInstrumentationPort.js +8 -0
  156. package/dist/application/frida/FridaInstrumentationService.js +310 -0
  157. package/dist/application/frida/fridaInputErrors.js +17 -0
  158. package/dist/application/go/GoBinaryPort.js +1 -0
  159. package/dist/application/go/GoBinaryService.js +80 -0
  160. package/dist/application/harmony/HarmonyApplicationService.js +17 -0
  161. package/dist/application/investigation/EvidenceLedger.js +40 -14
  162. package/dist/application/investigation/InspectEvidenceBundle.js +18 -0
  163. package/dist/application/investigation/InvestigationRecords.js +12 -21
  164. package/dist/application/investigation/UnknownEvidence.js +22 -18
  165. package/dist/application/javascript/ElectronActiveObservationService.js +55 -25
  166. package/dist/application/javascript/ElectronBoundaryAnalysis.js +17 -3
  167. package/dist/application/javascript/ElectronBoundaryGraph.js +2 -0
  168. package/dist/application/javascript/ElectronBoundaryGraphCallPaths.js +144 -0
  169. package/dist/application/javascript/ElectronBoundaryGraphContext.js +3 -2
  170. package/dist/application/javascript/ElectronBoundaryGraphIpc.js +28 -9
  171. package/dist/application/javascript/ElectronBoundaryGraphNative.js +20 -7
  172. package/dist/application/javascript/ElectronBoundaryGraphWindows.js +50 -12
  173. package/dist/application/javascript/ElectronObservationService.js +0 -1
  174. package/dist/application/javascript/JavaScriptApplicationEvidence.js +15 -0
  175. package/dist/application/javascript/JavaScriptApplicationService.js +44 -18
  176. package/dist/application/javascript/JavaScriptApplicationWorkflowEvidence.js +5 -6
  177. package/dist/application/javascript/JavaScriptApplicationWorkflowService.js +0 -1
  178. package/dist/application/javascript/JavaScriptArtifactAnalysis.js +253 -60
  179. package/dist/application/javascript/JavaScriptArtifactGraphAccumulator.js +51 -23
  180. package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +93 -21
  181. package/dist/application/javascript/JavaScriptArtifactGraphBundlers.js +4 -3
  182. package/dist/application/javascript/JavaScriptArtifactGraphContext.js +35 -8
  183. package/dist/application/javascript/JavaScriptArtifactGraphDocuments.js +25 -14
  184. package/dist/application/javascript/JavaScriptArtifactGraphFindings.js +163 -54
  185. package/dist/application/javascript/JavaScriptArtifactGraphStructure.js +246 -15
  186. package/dist/application/javascript/JavaScriptArtifactPathResolution.js +1057 -323
  187. package/dist/application/javascript/JavaScriptArtifactReconstruction.js +134 -32
  188. package/dist/application/javascript/JavaScriptArtifactReconstructionInput.js +6 -1
  189. package/dist/application/javascript/JavaScriptModuleRelationships.js +39 -15
  190. package/dist/application/javascript/JavaScriptRecoveryService.js +32 -9
  191. package/dist/application/javascript/JavaScriptRuntimeObservationService.js +2 -1
  192. package/dist/application/javascript/JavaScriptRuntimeReconciliationService.js +0 -1
  193. package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +9 -3
  194. package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +228 -74
  195. package/dist/application/javascript/JavaScriptSemanticGraphConstruction.js +12 -19
  196. package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +4 -1
  197. package/dist/application/javascript/JavaScriptSemanticGraphElectronProjection.js +67 -0
  198. package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +5 -3
  199. package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +5 -3
  200. package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +19 -8
  201. package/dist/application/javascript/JavaScriptSemanticTraceService.js +0 -1
  202. package/dist/application/jeb/JebAnalysisPort.js +1 -0
  203. package/dist/application/jeb/JebAnalysisService.js +13 -0
  204. package/dist/application/managed/ManagedApplicationGraphService.js +1 -2
  205. package/dist/application/managed/ManagedMemberComparisonService.js +72 -54
  206. package/dist/application/managed/ManagedNativeVerificationService.js +0 -1
  207. package/dist/application/managed/ManagedReconstructionService.js +0 -1
  208. package/dist/application/native/NativeCallRoutes.js +54 -34
  209. package/dist/application/native/NativeDispatchMetadataInspection.js +6 -2
  210. package/dist/application/native/NativeUiActionTrace.js +51 -30
  211. package/dist/application/native/NativeValueTrace.js +75 -24
  212. package/dist/application/pcap/PcapAnalysisPort.js +1 -0
  213. package/dist/application/pcap/PcapAnalysisService.js +24 -0
  214. package/dist/application/process/ProcessCli.js +57 -32
  215. package/dist/application/reverse/ReverseEngineeringCommandPort.js +1 -0
  216. package/dist/application/reverse/ReverseEngineeringService.js +688 -0
  217. package/dist/application/rust/RustBinaryPort.js +1 -0
  218. package/dist/application/rust/RustBinaryService.js +80 -0
  219. package/dist/application/signals/SignalRecordingService.js +83 -0
  220. package/dist/application/sqlite/SqliteDatabaseCapability.js +30 -0
  221. package/dist/application/sqlite/SqliteDatabasePort.js +1 -0
  222. package/dist/application/sqlite/SqliteDatabaseService.js +76 -0
  223. package/dist/application/wasm/WasmArtifactPort.js +1 -0
  224. package/dist/application/wasm/WasmArtifactService.js +77 -0
  225. package/dist/application/wasm/WasmInterfaceComparisonService.js +188 -0
  226. package/dist/artifacts/ArtifactHash.js +13 -2
  227. package/dist/artifacts/ArtifactPaths.js +133 -15
  228. package/dist/artifacts/ArtifactProvider.js +28 -19
  229. package/dist/artifacts/ArtifactReader.js +35 -0
  230. package/dist/artifacts/ArtifactResourceScope.js +109 -0
  231. package/dist/artifacts/AsarArtifactReader.js +295 -156
  232. package/dist/artifacts/AsarHeader.js +24 -0
  233. package/dist/artifacts/AsarListing.js +78 -0
  234. package/dist/artifacts/DirectoryArtifactReader.js +247 -74
  235. package/dist/artifacts/MachOSliceArtifactReader.js +198 -48
  236. package/dist/artifacts/NativeDmgArtifactReader.js +188 -78
  237. package/dist/artifacts/OrderedReads.js +57 -0
  238. package/dist/artifacts/SafeOutputTree.js +261 -71
  239. package/dist/artifacts/SafeOutputTreeCleanup.js +45 -0
  240. package/dist/artifacts/SafeOutputTreeCreationFailure.js +20 -0
  241. package/dist/artifacts/SafeOutputTreeIdentity.js +42 -0
  242. package/dist/artifacts/SafeOutputTreeReadback.js +33 -0
  243. package/dist/artifacts/ZipArtifactReader.js +186 -31
  244. package/dist/artifacts/apple/AppleAssetCatalogAnalysis.js +77 -68
  245. package/dist/artifacts/apple/DylibResolutionReader.js +11 -5
  246. package/dist/artifacts/apple/InterfaceBuilderAnalysis.js +114 -38
  247. package/dist/artifacts/apple/InterfaceBuilderDecodeBudget.js +125 -35
  248. package/dist/artifacts/apple/KeyedArchiveReader.js +35 -15
  249. package/dist/artifacts/apple/MachoLoadCommandReader.js +62 -61
  250. package/dist/artifacts/apple/NibArchive.js +11 -4
  251. package/dist/artifacts/apple/PlistNumberLiterals.js +2 -2
  252. package/dist/artifacts/extraction/ArtifactExtraction.js +115 -92
  253. package/dist/artifacts/hostExecutableMarking.js +16 -0
  254. package/dist/artifacts/inventory/ArtifactGraphConstruction.js +236 -69
  255. package/dist/artifacts/inventory/ArtifactInventory.js +7 -6
  256. package/dist/artifacts/inventory/classify.js +95 -35
  257. package/dist/artifacts/inventory/hashStableRootArtifact.js +48 -15
  258. package/dist/artifacts/inventory/reader.js +40 -17
  259. package/dist/artifacts/inventory/scanCanonical.js +84 -40
  260. package/dist/artifacts/inventory/scanReader.js +72 -19
  261. package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +177 -15
  262. package/dist/artifacts/javascript/JavaScriptSourceAnalysis.js +3 -0
  263. package/dist/artifacts/readStableArtifact.js +28 -4
  264. package/dist/browser/BrowserProcessStartup.js +20 -9
  265. package/dist/browser/BrowserScenarioPartialObservation.js +60 -38
  266. package/dist/browser/BrowserScenarioSecrets.js +193 -48
  267. package/dist/browser/CdpBrowserProvider.js +74 -98
  268. package/dist/browser/CdpCaptureDocuments.js +261 -65
  269. package/dist/browser/CdpCaptureDomSvg.js +243 -0
  270. package/dist/browser/CdpCaptureEventBodyShapes.js +12 -12
  271. package/dist/browser/CdpCaptureEventHandlers.js +49 -21
  272. package/dist/browser/CdpCaptureEvents.js +53 -19
  273. package/dist/browser/CdpCaptureStorage.js +22 -5
  274. package/dist/browser/CdpCaptureStorageFingerprints.js +54 -11
  275. package/dist/browser/CdpCaptureValues.js +0 -1
  276. package/dist/browser/CdpConnection.js +25 -9
  277. package/dist/browser/CdpElectronInspection.js +14 -4
  278. package/dist/browser/CdpElectronProvider.js +7 -2
  279. package/dist/browser/CdpElectronScripts.js +2 -1
  280. package/dist/browser/CdpElectronWorkers.js +7 -2
  281. package/dist/browser/CdpEndpoint.js +143 -17
  282. package/dist/browser/CdpObservationSession.js +24 -8
  283. package/dist/browser/CdpPageCapture.js +67 -17
  284. package/dist/browser/CdpPageCaptureScripts.js +4 -3
  285. package/dist/browser/CdpPageCaptureWorkers.js +5 -1
  286. package/dist/browser/CdpSafeMetadata.js +9 -5
  287. package/dist/browser/CdpScreenshot.js +5 -14
  288. package/dist/browser/CdpSnapshotStrings.js +21 -0
  289. package/dist/browser/CdpTargetSession.js +59 -36
  290. package/dist/browser/CdpWebMcpDiscovery.js +55 -16
  291. package/dist/browser/ElectronFileScope.js +99 -9
  292. package/dist/browser/PlaywrightBrowserScenarioProvider.js +64 -8
  293. package/dist/browser/PlaywrightElectronActiveActions.js +4 -4
  294. package/dist/browser/PlaywrightElectronActiveProjection.js +16 -4
  295. package/dist/browser/PlaywrightElectronActiveProvider.js +114 -36
  296. package/dist/browser/PlaywrightExecutionBoundary.js +2 -2
  297. package/dist/browser/PlaywrightScenarioArtifacts.js +5 -5
  298. package/dist/browser/PlaywrightScenarioBrowser.js +78 -13
  299. package/dist/browser/PlaywrightScenarioEvents.js +198 -36
  300. package/dist/browser/PlaywrightScenarioServiceWorkers.js +249 -0
  301. package/dist/browser/PlaywrightScenarioSession.js +180 -75
  302. package/dist/browser/PlaywrightScenarioStorage.js +507 -0
  303. package/dist/browser/PngVisualDiff.js +198 -29
  304. package/dist/browser/WebSourceMapFetcher.js +164 -81
  305. package/dist/browser/assets/LocalWebScriptArtifacts.js +27 -4
  306. package/dist/browser/assets/PublishWebScripts.js +88 -22
  307. package/dist/browser/assets/ScenarioScriptCapture.js +2 -1
  308. package/dist/browser/assets/WebArtifactReads.js +34 -4
  309. package/dist/browser/assets/WebSourceLocationArtifacts.js +39 -3
  310. package/dist/browser/execution/CdpExecutionCapture.js +3 -3
  311. package/dist/browser/execution/CdpPreciseCoverage.js +5 -8
  312. package/dist/browser/history/CaptureFailures.js +22 -8
  313. package/dist/browser/history/CaptureFormatError.js +2 -2
  314. package/dist/browser/history/{HarJson.js → CaptureJson.js} +14 -4
  315. package/dist/browser/history/CaptureRedaction.js +16 -3
  316. package/dist/browser/history/CaptureRelease.js +20 -2
  317. package/dist/browser/history/HarCapture.js +16 -9
  318. package/dist/browser/history/HarSchema.js +36 -36
  319. package/dist/browser/history/HistoricalCaptureDecoder.js +93 -25
  320. package/dist/browser/history/MitmproxyCaptureAdapter.js +3 -1
  321. package/dist/browser/history/NodeCaptureAdapter.js +48 -0
  322. package/dist/browser/history/{HarCaptureProcess.js → NodeCaptureProcess.js} +16 -15
  323. package/dist/browser/history/QlogCapture.js +385 -0
  324. package/dist/browser/history/SazCapture.js +130 -0
  325. package/dist/browser/history/SazHttp.js +61 -0
  326. package/dist/browser/history/SazMetadata.js +92 -0
  327. package/dist/browser/history/SazProjection.js +90 -0
  328. package/dist/browser/modules/NativeModuleResolver.js +177 -110
  329. package/dist/browser/modules/WebModuleArtifacts.js +41 -3
  330. package/dist/browser/network/PlaywrightNetworkContent.js +40 -5
  331. package/dist/browser/network/PlaywrightScenarioNetwork.js +125 -11
  332. package/dist/captures/TsharkCaptureProvider.js +370 -0
  333. package/dist/captures/parseFieldDiscovery.js +66 -0
  334. package/dist/captures/parsePacketOutput.js +21 -0
  335. package/dist/catalogIdentity.js +46 -35
  336. package/dist/cli/adbCommands.js +337 -0
  337. package/dist/cli/analysisViewCommands.js +39 -1
  338. package/dist/cli/androidCommands.js +11 -2
  339. package/dist/cli/apktoolCommands.js +52 -0
  340. package/dist/cli/applicationCommands.js +44 -17
  341. package/dist/cli/artifactCommands.js +9 -12
  342. package/dist/cli/binaryDiagnosticsCommands.js +27 -5
  343. package/dist/cli/browserAdvancedCommands.js +97 -55
  344. package/dist/cli/browserCommands.js +46 -29
  345. package/dist/cli/captureCommands.js +72 -0
  346. package/dist/cli/cliResultOutput.js +188 -0
  347. package/dist/cli/coreBinaryCommands.js +73 -32
  348. package/dist/cli/coreNativeCommands.js +54 -45
  349. package/dist/cli/cutterCommands.js +50 -0
  350. package/dist/cli/electronCommands.js +51 -4
  351. package/dist/cli/evmCommands.js +16 -8
  352. package/dist/cli/finishAnalysisCommand.js +44 -0
  353. package/dist/cli/firmwareCommands.js +21 -38
  354. package/dist/cli/flutterCommands.js +69 -0
  355. package/dist/cli/fridaCommands.js +211 -0
  356. package/dist/cli/goCommands.js +20 -0
  357. package/dist/cli/interactiveSetup.js +11 -1
  358. package/dist/cli/javascriptApplicationAnalysis.js +18 -2
  359. package/dist/cli/javascriptRecoveryCommands.js +29 -15
  360. package/dist/cli/jebCommands.js +99 -0
  361. package/dist/cli/jsonOutput.js +13 -6
  362. package/dist/cli/managedCommands.js +31 -3
  363. package/dist/cli/options.js +20 -2
  364. package/dist/cli/pcapCommands.js +47 -0
  365. package/dist/cli/processCommands.js +1 -1
  366. package/dist/cli/referenceSourceImportStatus.js +7 -0
  367. package/dist/cli/reverseEngineeringCommands.js +268 -0
  368. package/dist/cli/rustCommands.js +21 -0
  369. package/dist/cli/setupCommands.js +55 -15
  370. package/dist/cli/signalCommands.js +72 -0
  371. package/dist/cli/sqliteCommands.js +79 -0
  372. package/dist/cli/utilityCommands.js +179 -89
  373. package/dist/cli/wasmCommands.js +61 -0
  374. package/dist/cli/webModuleCommands.js +36 -32
  375. package/dist/cli/webNetworkCaptureCommands.js +8 -8
  376. package/dist/cli/webScriptCommands.js +20 -1
  377. package/dist/cli/webSourceLocationCommands.js +21 -9
  378. package/dist/cli-runtime/AbortablePromise-BVBemxbD.js +123 -0
  379. package/dist/cli-runtime/AnalysisProvider-D0Us2OTk.js +27 -0
  380. package/dist/cli-runtime/AnalysisSnapshotCache-BXS0wRd2.js +710 -0
  381. package/dist/cli-runtime/ArtifactReader-BXkffc1D.js +55 -0
  382. package/dist/cli-runtime/ArtifactResourceScope-DQWTcUwE.js +114 -0
  383. package/dist/cli-runtime/AsarHeader-CnzOzYEH.js +31 -0
  384. package/dist/cli-runtime/BinarySessionStatus-DnMxMk-r.js +211 -0
  385. package/dist/cli-runtime/BinaryTargetResolver-CVIJ_s1A.js +1308 -0
  386. package/dist/cli-runtime/BoundedFileBytes-BU30odTm.js +39 -0
  387. package/dist/cli-runtime/CdpTargetSession-DGX5pV9w.js +650 -0
  388. package/dist/cli-runtime/ClientConfigPath-c6jr6INc.js +36 -0
  389. package/dist/cli-runtime/ClientConfigurationDocument-ffQ9X0Se.js +1957 -0
  390. package/dist/cli-runtime/ClientRegistrationStatus-DszCyPEU.js +509 -0
  391. package/dist/cli-runtime/CurrentEntrypointPath-D5FRNdkq.js +14 -0
  392. package/dist/cli-runtime/DirectAnalysis-BgvAtpN3.js +528 -0
  393. package/dist/cli-runtime/Doctor-DIpf_I7N.js +588 -0
  394. package/dist/cli-runtime/ElectronFileScope-dpHm2nrS.js +1054 -0
  395. package/dist/cli-runtime/ExecFileOutput-BEQs-lDD.js +117 -0
  396. package/dist/cli-runtime/IdaConfiguration-CtGP7EKo.js +1094 -0
  397. package/dist/cli-runtime/InterfaceBuilderDecodeBudget-D4omRUe4.js +279 -0
  398. package/dist/cli-runtime/InventoryProjectionEvidence-DIsI4DJ6.js +49 -0
  399. package/dist/cli-runtime/InvestigationProviders-DoQRIHii.js +117 -0
  400. package/dist/cli-runtime/JavaScriptApplicationEvidenceGraph-D5aI_FSJ.js +160 -0
  401. package/dist/cli-runtime/JavaScriptApplicationWorkflowEvidence-Bz4-V0Ct.js +75 -0
  402. package/dist/cli-runtime/JavaScriptWorkerMemoryLimit-B1bwMM1a.js +86 -0
  403. package/dist/cli-runtime/JebMcpEndpoint-DUytrn5G.js +428 -0
  404. package/dist/cli-runtime/JsonFiles-DQa1PRKy.js +708 -0
  405. package/dist/cli-runtime/MacCodeSignature-MgYbRK_H.js +24 -0
  406. package/dist/cli-runtime/MacHopperPaths-CwL5lYPX.js +434 -0
  407. package/dist/cli-runtime/MachoLoadCommandReader-C7e074Ze.js +510 -0
  408. package/dist/cli-runtime/ManagedSnapshot-rqyBHcdL.js +4185 -0
  409. package/dist/cli-runtime/OwnedCommand-Cj9GhmPR.js +112 -0
  410. package/dist/cli-runtime/PrivateRuntimeRoot-DAy0PiBM.js +263 -0
  411. package/dist/cli-runtime/ProcessOwnership-DXC5-UWt.js +1378 -0
  412. package/dist/cli-runtime/ProviderDeadline-8m2pFRDc.js +122 -0
  413. package/dist/cli-runtime/RegularFile-B_6KPCNQ.js +139 -0
  414. package/dist/cli-runtime/RegularFileRead-DVlC5faM.js +125 -0
  415. package/dist/cli-runtime/SafeOutputTree-D6U15GXd.js +524 -0
  416. package/dist/cli-runtime/SetupHost-FkYWswsq.js +1098 -0
  417. package/dist/cli-runtime/SupportedClients-DaX6Lt2d.js +1049 -0
  418. package/dist/cli-runtime/UninstallFailure-1blyKXHE.js +22 -0
  419. package/dist/cli-runtime/Update-CbTC_eg1.js +143 -0
  420. package/dist/cli-runtime/UpdateFailure-BcFNxEZZ.js +24 -0
  421. package/dist/cli-runtime/ZipArtifactReader-B8ZgNe4D.js +248 -0
  422. package/dist/cli-runtime/analysisErrorCleanup-Do6YeeoD.js +32 -0
  423. package/dist/cli-runtime/analysisErrorPresentation-DGt7TdsH.js +497 -0
  424. package/dist/cli-runtime/appleArchiveFormat-tVoI2ykA.js +263 -0
  425. package/dist/cli-runtime/application__DirectAnalysisStatus-DpOejOf0.js +150 -0
  426. package/dist/cli-runtime/application__EnhancedTools-oFE2bOjs.js +1787 -0
  427. package/dist/cli-runtime/application__FunctionAnalysisEvidence-B6osuhvW.js +41 -0
  428. package/dist/cli-runtime/application__ReconstructionCoverageService-DN3wTFQj.js +32 -0
  429. package/dist/cli-runtime/application__ReconstructionObligationLedgerService-CKcTppX9.js +815 -0
  430. package/dist/cli-runtime/application__Setup-XpMaRNjy.js +514 -0
  431. package/dist/cli-runtime/application__Uninstall-_23pU2yB.js +427 -0
  432. package/dist/cli-runtime/application__UpdateRuntime-DPvY8ohd.js +345 -0
  433. package/dist/cli-runtime/application__android__AndroidApplicationService-CFgIFPM4.js +31 -0
  434. package/dist/cli-runtime/application__apple__AppleApplicationService-Db6QCsun.js +31 -0
  435. package/dist/cli-runtime/application__harmony__HarmonyApplicationService-CFjocHoK.js +31 -0
  436. package/dist/cli-runtime/application__javascript__ElectronActiveObservationService-CmVDUI_Z.js +118 -0
  437. package/dist/cli-runtime/application__javascript__ElectronObservationService-DEsR8KDN.js +63 -0
  438. package/dist/cli-runtime/application__javascript__JavaScriptApplicationService-CCkp8KBh.js +11450 -0
  439. package/dist/cli-runtime/application__javascript__JavaScriptApplicationWorkflowService-lPy0tzr3.js +2329 -0
  440. package/dist/cli-runtime/application__javascript__JavaScriptRuntimeReconciliationService-DWleA8K9.js +88 -0
  441. package/dist/cli-runtime/application__javascript__JavaScriptSemanticTraceService-DkALH4rL.js +299 -0
  442. package/dist/cli-runtime/artifactOperationError-B7n03FbD.js +27 -0
  443. package/dist/cli-runtime/artifacts__ArtifactProvider-zXI0QjSL.js +2187 -0
  444. package/dist/cli-runtime/binary-BVOr2mgE.js +14206 -0
  445. package/dist/cli-runtime/browserObservationError-Dx6xRTjb.js +40 -0
  446. package/dist/cli-runtime/catalogIdentity-DLoXgfIR.js +933 -0
  447. package/dist/cli-runtime/cli.js +41848 -0
  448. package/dist/cli-runtime/cliOutput-BC1BdAcB.js +122 -0
  449. package/dist/cli-runtime/cliOutput.js +5 -0
  450. package/dist/cli-runtime/cliResultOutput-DsRMI8CJ.js +780 -0
  451. package/dist/cli-runtime/cliResultOutput.js +5 -0
  452. package/dist/cli-runtime/composition__browserScenario-DHXC1a8n.js +2927 -0
  453. package/dist/cli-runtime/composition__electronObservation-GecK2EID.js +555 -0
  454. package/dist/cli-runtime/composition__electronScenario-CEZnVrAL.js +653 -0
  455. package/dist/cli-runtime/cutterToolContracts-TZH9EHr5.js +5134 -0
  456. package/dist/cli-runtime/doctorRuntime-BE5ZX8it.js +258 -0
  457. package/dist/cli-runtime/dotnet__ManagedStaticProvider-C8_yZCDc.js +5 -0
  458. package/dist/cli-runtime/errorSchemas-CTRmvMl3.js +601 -0
  459. package/dist/cli-runtime/javascriptApplicationAnalysis-HgMzVMQw.js +2068 -0
  460. package/dist/cli-runtime/javascriptExportReturnShapeProjection-Dg00g35t.js +78 -0
  461. package/dist/cli-runtime/javascriptExportShapeComparisonSchemas-BYnoIqIk.js +1242 -0
  462. package/dist/cli-runtime/javascriptRuntimeReconciliation-DNjDoL3S.js +1507 -0
  463. package/dist/cli-runtime/javascriptRuntimeReconciliationSchemas-BWpGWNcI.js +247 -0
  464. package/dist/cli-runtime/javascriptSemanticTraceSchemas-BTCNcvbc.js +126 -0
  465. package/dist/cli-runtime/lipo-DSWP6fv-.js +396 -0
  466. package/dist/cli-runtime/logger-CQQCI4a2.js +48 -0
  467. package/dist/cli-runtime/machoContainer-C8BIkkq3.js +172 -0
  468. package/dist/cli-runtime/managedApplicationGraph-B08jb3jq.js +1130 -0
  469. package/dist/cli-runtime/managedToolContracts-D60QmIYj.js +99 -0
  470. package/dist/cli-runtime/mcpDoctor.js +359 -0
  471. package/dist/cli-runtime/mcpStartupPolicy-CVVSOmRc.js +21 -0
  472. package/dist/cli-runtime/native__NativeMacOSProvider-YBTvUeJO.js +4875 -0
  473. package/dist/cli-runtime/officialToolContracts-CCFF0an9.js +1501 -0
  474. package/dist/cli-runtime/propertyListKeys-G8e74YWb.js +248 -0
  475. package/dist/cli-runtime/providerAdapterError-DAjhICdr.js +25 -0
  476. package/dist/cli-runtime/providerCleanupError-Ceq8f0wK.js +27 -0
  477. package/dist/cli-runtime/providerIdentities-Ao1XTvwx.js +31 -0
  478. package/dist/cli-runtime/providerStartupTimeout-B2tF2LtZ.js +17 -0
  479. package/dist/cli-runtime/readFileHandleChunks-dp60iZ6v.js +38 -0
  480. package/dist/cli-runtime/reconstructionObligationLedgerSchemas-Bao0xMr-.js +19478 -0
  481. package/dist/cli-runtime/rolldown-runtime-DXoylpqc.js +121 -0
  482. package/dist/cli-runtime/runtimeVersion-CMGd0bDu.js +23 -0
  483. package/dist/cli-runtime/safeJson-DKKACtdy.js +25 -0
  484. package/dist/cli-runtime/scanCanonical-KP4T9jSl.js +2724 -0
  485. package/dist/cli-runtime/snapshotEnvironment-D_tWyOub.js +813 -0
  486. package/dist/cli-runtime/toolContracts-D2FOG_Nb.js +3721 -0
  487. package/dist/cli-runtime/toolOutputSchemaGroups-DRiYs1je.js +12070 -0
  488. package/dist/cli-runtime/workflowInputError-n8Oo-bLA.js +26 -0
  489. package/dist/cli.js +44 -5
  490. package/dist/cliBrowserScenarioCommands.js +41 -5
  491. package/dist/cliCommandNames.js +80 -0
  492. package/dist/cliEvidenceCommands.js +0 -1
  493. package/dist/cliJavaScriptRuntimeCommands.js +16 -14
  494. package/dist/cliJsonInput.js +14 -6
  495. package/dist/cliLogging.js +50 -14
  496. package/dist/cliObservationOptions.js +9 -0
  497. package/dist/cliOutput.js +38 -5
  498. package/dist/composition/adb.js +3 -0
  499. package/dist/composition/apktool.js +3 -0
  500. package/dist/composition/binary.js +4 -0
  501. package/dist/composition/binaryDiagnostics.js +4 -0
  502. package/dist/composition/captures.js +3 -0
  503. package/dist/composition/directAnalysis.js +36 -11
  504. package/dist/composition/electronFuses.js +4 -0
  505. package/dist/composition/evm.js +12 -0
  506. package/dist/composition/flutter.js +3 -0
  507. package/dist/composition/go.js +4 -0
  508. package/dist/composition/javascriptAnalysisWorkerProcess.js +49 -0
  509. package/dist/composition/jeb.js +35 -0
  510. package/dist/composition/pcap.js +3 -0
  511. package/dist/composition/resolveWindowsProviderExecutable.js +61 -0
  512. package/dist/composition/reverseEngineering.js +29 -0
  513. package/dist/composition/rust.js +4 -0
  514. package/dist/composition/signals.js +3 -0
  515. package/dist/composition/sqlite.js +4 -0
  516. package/dist/composition/wasm.js +22 -0
  517. package/dist/composition/webNetworkCaptures.js +7 -2
  518. package/dist/config/environment.js +55 -4
  519. package/dist/config/ghidraDisabledAnalyzers.js +25 -0
  520. package/dist/config/ghidraLanguageOverride.js +9 -0
  521. package/dist/config/homeDirectory.js +9 -6
  522. package/dist/config/mcpInputSchemaProfile.js +31 -0
  523. package/dist/config/mcpOutputSchemaProfile.js +22 -0
  524. package/dist/config/parseConfig.js +36 -19
  525. package/dist/config/parsers.js +4 -3
  526. package/dist/config/{ghidraStartupTimeout.js → providerStartupTimeout.js} +7 -3
  527. package/dist/contracts/adb/adbToolContracts.js +353 -0
  528. package/dist/contracts/advertisedInputExamples.js +48 -0
  529. package/dist/contracts/analysisDetail.js +13 -0
  530. package/dist/contracts/analysisViewApiSurfaceExample.js +68 -0
  531. package/dist/contracts/analysisViewToolContracts.js +39 -3
  532. package/dist/contracts/android/androidToolContracts.js +17 -8
  533. package/dist/contracts/apktool/apktoolToolContracts.js +33 -0
  534. package/dist/contracts/applicationToolContracts.js +17 -2
  535. package/dist/contracts/artifactToolContracts.js +21 -6
  536. package/dist/contracts/browserToolContracts.js +2 -1
  537. package/dist/contracts/captures/captureToolContracts.js +42 -0
  538. package/dist/contracts/compactInputSchema.js +276 -0
  539. package/dist/contracts/cutterToolContracts.js +84 -0
  540. package/dist/contracts/enhancedToolContracts.js +2 -2
  541. package/dist/contracts/evm/evmToolContracts.js +30 -15
  542. package/dist/contracts/firmware/firmwareToolContracts.js +1 -1
  543. package/dist/contracts/flutter/flutterToolContracts.js +47 -0
  544. package/dist/contracts/fridaRemoteAddress.js +23 -0
  545. package/dist/contracts/fridaToolContracts.js +273 -0
  546. package/dist/contracts/functionComparisonExample.js +12 -1
  547. package/dist/contracts/functionWorkflowToolContracts.js +1 -1
  548. package/dist/contracts/gdbToolContracts.js +103 -0
  549. package/dist/contracts/go/goToolContracts.js +20 -0
  550. package/dist/contracts/hopperMemoryContracts.js +15 -0
  551. package/dist/contracts/inputSchemaPresentation.js +91 -24
  552. package/dist/contracts/investigationExamples.js +1 -0
  553. package/dist/contracts/javascript/electronToolContracts.js +40 -3
  554. package/dist/contracts/javascript/javascriptRecoveryToolContracts.js +13 -1
  555. package/dist/contracts/jeb/jebToolContracts.js +64 -0
  556. package/dist/contracts/managed/managedToolContracts.js +43 -4
  557. package/dist/contracts/managed/managedWorkflowExamples.js +7 -1
  558. package/dist/contracts/managed/managedWorkflowToolContracts.js +4 -30
  559. package/dist/contracts/mobileApplicationGraphExamples.js +12 -0
  560. package/dist/contracts/native/binaryDiagnosticsToolContracts.js +27 -4
  561. package/dist/contracts/native/nativeToolContracts.js +10 -6
  562. package/dist/contracts/officialToolContracts.js +9 -9
  563. package/dist/contracts/pcap/pcapToolContracts.js +33 -0
  564. package/dist/contracts/providerSelection.js +1 -0
  565. package/dist/contracts/reconstructionReadinessExample.js +126 -119
  566. package/dist/contracts/reverseEngineeringToolContracts.js +52 -0
  567. package/dist/contracts/rizinDebugToolContracts.js +96 -0
  568. package/dist/contracts/rust/rustToolContracts.js +20 -0
  569. package/dist/contracts/sessionLifecycleInputs.js +34 -2
  570. package/dist/contracts/sessionToolContracts.js +4 -4
  571. package/dist/contracts/sessionToolSchemas.js +20 -2
  572. package/dist/contracts/signals/signalToolContracts.js +40 -0
  573. package/dist/contracts/sqlite/sqliteToolContracts.js +36 -0
  574. package/dist/contracts/toolContractExamples.js +35 -0
  575. package/dist/contracts/toolContractTypes.js +5 -0
  576. package/dist/contracts/toolContracts.js +32 -0
  577. package/dist/contracts/toolEffects.js +414 -8
  578. package/dist/contracts/toolOutputSchemaGroups.js +78 -33
  579. package/dist/contracts/toolOutputSchemaPrimitives.js +111 -10
  580. package/dist/contracts/toolSchemaMetadata.js +98 -9
  581. package/dist/contracts/unknownContractExamples.js +1 -1
  582. package/dist/contracts/wasm/wasmComparisonContracts.js +52 -0
  583. package/dist/contracts/wasm/wasmToolContracts.js +33 -0
  584. package/dist/contracts/webNetworkCaptureToolContracts.js +15 -4
  585. package/dist/cutter/CutterBridgeClient.js +621 -0
  586. package/dist/cutter/CutterBridgeService.js +139 -0
  587. package/dist/doctorRuntime.js +20 -8
  588. package/dist/domain/adb/adbDeviceAnalysis.js +605 -0
  589. package/dist/domain/analysisErrorBase.js +20 -0
  590. package/dist/domain/analysisErrorCleanup.js +29 -0
  591. package/dist/domain/analysisErrorCore.js +19 -0
  592. package/dist/domain/analysisErrorPresentation.js +75 -22
  593. package/dist/domain/analysisErrorProjection.js +35 -13
  594. package/dist/domain/analysisProfile.js +7 -3
  595. package/dist/domain/analysisSnapshot.js +313 -185
  596. package/dist/domain/analysisView/WebNetworkApiSurfaceAccumulator.js +414 -0
  597. package/dist/domain/analysisView/analysisView.js +417 -45
  598. package/dist/domain/analysisView/analysisViewCoverage.js +32 -0
  599. package/dist/domain/analysisView/analysisViewErrors.js +4 -0
  600. package/dist/domain/analysisView/analysisViewParent.js +12 -0
  601. package/dist/domain/analysisView/analysisViewText.js +29 -0
  602. package/dist/domain/analysisView/androidPackageView.js +102 -0
  603. package/dist/domain/analysisView/artifactInventoryView.js +140 -0
  604. package/dist/domain/analysisView/binaryLayoutView.js +13 -4
  605. package/dist/domain/analysisView/dartAotView.js +93 -0
  606. package/dist/domain/analysisView/evmInterfaceView.js +105 -0
  607. package/dist/domain/analysisView/interfaceBuilderView.js +182 -0
  608. package/dist/domain/analysisView/javascriptApplicationView.js +29 -26
  609. package/dist/domain/analysisView/machoView.js +186 -0
  610. package/dist/domain/analysisView/managedArtifactView.js +108 -0
  611. package/dist/domain/analysisView/managedMemberView.js +209 -0
  612. package/dist/domain/analysisView/nativeFunctionView.js +150 -0
  613. package/dist/domain/analysisView/pcapCaptureView.js +264 -0
  614. package/dist/domain/analysisView/qlogCaptureView.js +198 -0
  615. package/dist/domain/analysisView/wasmArtifactView.js +162 -0
  616. package/dist/domain/analysisView/webNetworkApiSurfaceView.js +123 -0
  617. package/dist/domain/analysisView/webNetworkCaptureView.js +388 -0
  618. package/dist/domain/android/androidAnalysis.js +36 -2
  619. package/dist/domain/android/androidApplication.js +57 -80
  620. package/dist/domain/apktool/apktoolResourceAnalysis.js +89 -0
  621. package/dist/domain/apple/appleApplication.js +71 -52
  622. package/dist/domain/apple/appleArchiveFormat.js +184 -0
  623. package/dist/domain/apple/appleAssetCatalog.js +15 -0
  624. package/dist/domain/apple/appleBundleAnatomy.js +96 -29
  625. package/dist/domain/apple/dyldPaths.js +18 -3
  626. package/dist/domain/apple/dylibResolution.js +21 -11
  627. package/dist/domain/apple/dylibResolutionFindings.js +8 -9
  628. package/dist/domain/apple/interfaceBuilderGraph.js +72 -45
  629. package/dist/domain/apple/interfaceBuilderKeyedArchive.js +38 -9
  630. package/dist/domain/apple/machoContainer.js +120 -8
  631. package/dist/domain/apple/machoCpuIdentity.js +4 -0
  632. package/dist/domain/apple/plistValue.js +6 -1
  633. package/dist/domain/artifactComparison.js +130 -25
  634. package/dist/domain/artifactDecompressionBudget.js +26 -0
  635. package/dist/domain/artifactGraph.js +28 -9
  636. package/dist/domain/artifactIdentity.js +33 -2
  637. package/dist/domain/artifactInspection.js +47 -45
  638. package/dist/domain/artifactIntegrityPolicy.js +10 -0
  639. package/dist/domain/artifactInventoryEvidence.js +148 -51
  640. package/dist/domain/artifactPathSyntax.js +1 -1
  641. package/dist/domain/binaryTarget.js +253 -80
  642. package/dist/domain/binaryTargetTypes.js +21 -1
  643. package/dist/domain/browserNetworkEvidence.js +4 -0
  644. package/dist/domain/browserObservation.js +88 -29
  645. package/dist/domain/browserObservationSchemas.js +12 -5
  646. package/dist/domain/browserScenarioCapture.js +2 -1
  647. package/dist/domain/browserScenarioCaptureValues.js +26 -2
  648. package/dist/domain/browserScenarioDiff.js +120 -11
  649. package/dist/domain/browserScenarioDiffEvidence.js +46 -13
  650. package/dist/domain/browserScenarioDiffValues.js +10 -3
  651. package/dist/domain/browserScenarioNetworkComparison.js +158 -0
  652. package/dist/domain/browserScenarioNormalization.js +10 -13
  653. package/dist/domain/browserScenarioValues.js +2 -12
  654. package/dist/domain/browserSession.js +2 -2
  655. package/dist/domain/bundleComparison.js +1 -5
  656. package/dist/domain/callPath.js +40 -3
  657. package/dist/domain/canonicalJsonDigestSteps.js +34 -12
  658. package/dist/domain/captures/packetCapture.js +138 -0
  659. package/dist/domain/captures/packetFields.js +81 -0
  660. package/dist/domain/changedBehavior.js +43 -41
  661. package/dist/domain/compactStringIdentity.js +9 -0
  662. package/dist/domain/comparisonSourceEvidence.js +6 -0
  663. package/dist/domain/dosCom.js +2 -2
  664. package/dist/domain/dosMz.js +52 -14
  665. package/dist/domain/electron/electronFuses.js +360 -0
  666. package/dist/domain/elfFixedHeader.js +42 -0
  667. package/dist/domain/evidence.js +104 -38
  668. package/dist/domain/evidenceBundle.js +58 -20
  669. package/dist/domain/evidenceErrors.js +5 -0
  670. package/dist/domain/evidenceRecordSummary.js +144 -0
  671. package/dist/domain/evm/evmInterface.js +18 -4
  672. package/dist/domain/evm/solidityMetadata.js +70 -0
  673. package/dist/domain/explicitSensitiveFailure.js +42 -24
  674. package/dist/domain/firmware/firmwareAnalysis.js +29 -0
  675. package/dist/domain/flutter/flutterBuildAnalysis.js +141 -0
  676. package/dist/domain/functionCallCoverage.js +60 -0
  677. package/dist/domain/functionComparisonDimensions.js +101 -10
  678. package/dist/domain/functionComparisonNormalization.js +66 -10
  679. package/dist/domain/functionComparisonResults.js +7 -6
  680. package/dist/domain/functionComparisonSchemas.js +14 -3
  681. package/dist/domain/functionDossierEvidence.js +3 -0
  682. package/dist/domain/go/goBinary.js +96 -0
  683. package/dist/domain/harmony/harmonyApplication.js +156 -0
  684. package/dist/domain/hopperErrors.js +15 -16
  685. package/dist/domain/hopperPublisher.js +12 -0
  686. package/dist/domain/hopperValues.js +112 -34
  687. package/dist/domain/inputIssueProjection.js +16 -1
  688. package/dist/domain/javascript/electronObservation.js +4 -1
  689. package/dist/domain/javascript/electronStaticAnalysisBrowser.js +24 -24
  690. package/dist/domain/javascript/electronStaticAnalysisIpc.js +13 -20
  691. package/dist/domain/javascript/electronStaticAnalysisNative.js +85 -41
  692. package/dist/domain/javascript/electronStaticAnalysisValues.js +30 -8
  693. package/dist/domain/javascript/electronWrappedCallPaths.js +498 -0
  694. package/dist/domain/javascript/htmlArtifactReferences.js +94 -4
  695. package/dist/domain/javascript/javascriptAnalysisResourceControls.js +65 -0
  696. package/dist/domain/javascript/javascriptApplicationAnalysis.js +7 -1
  697. package/dist/domain/javascript/javascriptApplicationChangeGraph.js +13 -8
  698. package/dist/domain/javascript/javascriptApplicationEvidenceSchemas.js +1 -1
  699. package/dist/domain/javascript/javascriptApplicationGraph.js +96 -19
  700. package/dist/domain/javascript/javascriptApplicationGraphSchemas.js +1 -0
  701. package/dist/domain/javascript/javascriptApplicationProjectionResources.js +43 -0
  702. package/dist/domain/javascript/javascriptApplicationVersionItems.js +28 -12
  703. package/dist/domain/javascript/javascriptApplicationVersionKeys.js +40 -19
  704. package/dist/domain/javascript/javascriptArtifactFiles.js +2 -1
  705. package/dist/domain/javascript/javascriptAstFingerprint.js +100 -39
  706. package/dist/domain/javascript/javascriptAstValues.js +81 -0
  707. package/dist/domain/javascript/javascriptBootstrap.js +94 -0
  708. package/dist/domain/javascript/javascriptBootstrapIntegrity.js +372 -0
  709. package/dist/domain/javascript/javascriptBuiltinResourceMethods.js +8 -0
  710. package/dist/domain/javascript/javascriptBundledRequireOrigin.js +291 -0
  711. package/dist/domain/javascript/javascriptContextBridgeExposure.js +23 -0
  712. package/dist/domain/javascript/javascriptElectronMemberWrites.js +114 -0
  713. package/dist/domain/javascript/javascriptExportShapeComparisonSchemas.js +6 -5
  714. package/dist/domain/javascript/javascriptExportShapeVariants.js +1 -1
  715. package/dist/domain/javascript/javascriptFeatureSeed.js +33 -16
  716. package/dist/domain/javascript/javascriptFeatureTrace.js +9 -3
  717. package/dist/domain/javascript/javascriptFeatureTraceSchemas.js +42 -11
  718. package/dist/domain/javascript/javascriptIntrinsicInvocation.js +132 -0
  719. package/dist/domain/javascript/javascriptModuleDeclaration.js +28 -0
  720. package/dist/domain/javascript/javascriptModuleInterop.js +618 -0
  721. package/dist/domain/javascript/javascriptModuleResolutionMode.js +18 -0
  722. package/dist/domain/javascript/javascriptModuleSemanticIr.js +15 -0
  723. package/dist/domain/javascript/javascriptModuleSpecifier.js +5 -0
  724. package/dist/domain/javascript/javascriptNativeHandoff.js +6 -2
  725. package/dist/domain/javascript/javascriptPackageImportAliases.js +58 -0
  726. package/dist/domain/javascript/javascriptRecovery.js +12 -5
  727. package/dist/domain/javascript/javascriptRpcEndpoints.js +331 -0
  728. package/dist/domain/javascript/javascriptRuntimeLoadState.js +12 -3
  729. package/dist/domain/javascript/javascriptRuntimeObservation.js +4 -1
  730. package/dist/domain/javascript/javascriptRuntimeReconciliationCaptureParsing.js +10 -4
  731. package/dist/domain/javascript/javascriptRuntimeReconciliationGraph.js +7 -2
  732. package/dist/domain/javascript/javascriptRuntimeReconciliationMatching.js +15 -2
  733. package/dist/domain/javascript/javascriptRuntimeReconciliationResult.js +0 -1
  734. package/dist/domain/javascript/javascriptRuntimeReconciliationSchemas.js +5 -4
  735. package/dist/domain/javascript/javascriptRuntimeStaticCandidates.js +121 -22
  736. package/dist/domain/javascript/javascriptSemanticAmbientWrites.js +251 -0
  737. package/dist/domain/javascript/javascriptSemanticAnalysis.js +493 -104
  738. package/dist/domain/javascript/javascriptSemanticAsyncEffects.js +17 -34
  739. package/dist/domain/javascript/javascriptSemanticCallResolution.js +4 -3
  740. package/dist/domain/javascript/javascriptSemanticCallableResults.js +42 -0
  741. package/dist/domain/javascript/javascriptSemanticCallableStack.js +52 -0
  742. package/dist/domain/javascript/javascriptSemanticCalls.js +14 -12
  743. package/dist/domain/javascript/javascriptSemanticChildProcesses.js +42 -55
  744. package/dist/domain/javascript/javascriptSemanticDataEffectHelpers.js +428 -32
  745. package/dist/domain/javascript/javascriptSemanticDataEffects.js +14 -20
  746. package/dist/domain/javascript/javascriptSemanticDependencies.js +69 -0
  747. package/dist/domain/javascript/javascriptSemanticDerivedAnalysis.js +15 -4
  748. package/dist/domain/javascript/javascriptSemanticFileProjection.js +1 -0
  749. package/dist/domain/javascript/javascriptSemanticFingerprints.js +51 -53
  750. package/dist/domain/javascript/javascriptSemanticGraph.js +74 -24
  751. package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +2 -11
  752. package/dist/domain/javascript/javascriptSemanticIterationSources.js +41 -8
  753. package/dist/domain/javascript/javascriptSemanticMemberMutations.js +538 -151
  754. package/dist/domain/javascript/javascriptSemanticMutationInitializers.js +199 -3
  755. package/dist/domain/javascript/javascriptSemanticMutationValues.js +78 -35
  756. package/dist/domain/javascript/javascriptSemanticObjectReferences.js +671 -0
  757. package/dist/domain/javascript/javascriptSemanticObjects.js +27 -17
  758. package/dist/domain/javascript/javascriptSemanticProjection.js +202 -56
  759. package/dist/domain/javascript/javascriptSemanticPromises.js +6 -9
  760. package/dist/domain/javascript/javascriptSemanticPropertyPaths.js +77 -0
  761. package/dist/domain/javascript/javascriptSemanticProvenance.js +5 -1
  762. package/dist/domain/javascript/javascriptSemanticQuery.js +34 -31
  763. package/dist/domain/javascript/javascriptSemanticQueryIdentity.js +1 -3
  764. package/dist/domain/javascript/javascriptSemanticReferenceSources.js +25 -0
  765. package/dist/domain/javascript/javascriptSemanticRequireOrigin.js +331 -8
  766. package/dist/domain/javascript/javascriptSemanticResources.js +6 -40
  767. package/dist/domain/javascript/javascriptSemanticReturnedReferences.js +233 -0
  768. package/dist/domain/javascript/javascriptSemanticReturns.js +49 -52
  769. package/dist/domain/javascript/javascriptSemanticState.js +61 -4
  770. package/dist/domain/javascript/javascriptSemanticTraversal.js +25 -5
  771. package/dist/domain/javascript/javascriptSemanticValues.js +260 -35
  772. package/dist/domain/javascript/javascriptSourceAnalysis.js +1 -0
  773. package/dist/domain/javascript/javascriptSourceMapPaths.js +44 -17
  774. package/dist/domain/javascript/javascriptSourceParser.js +72 -3
  775. package/dist/domain/javascript/javascriptSourceSelection.js +11 -0
  776. package/dist/domain/javascript/javascriptStaticAnalysis.js +72 -26
  777. package/dist/domain/javascript/javascriptStaticAnalysisBundler.js +100 -24
  778. package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +271 -47
  779. package/dist/domain/javascript/javascriptStaticAnalysisFindings.js +8 -4
  780. package/dist/domain/javascript/javascriptStaticAnalysisHelpers.js +166 -56
  781. package/dist/domain/javascript/javascriptStaticAnalysisState.js +2 -0
  782. package/dist/domain/javascript/javascriptStaticAnalysisTypes.js +2 -1
  783. package/dist/domain/javascript/javascriptSymbolicBindings.js +836 -0
  784. package/dist/domain/javascript/javascriptSymbolicControlFlow.js +40 -0
  785. package/dist/domain/javascript/javascriptSymbolicValues.js +34 -0
  786. package/dist/domain/javascript/sourceToBundleComparison.js +3 -1
  787. package/dist/domain/javascript/sourceToBundleComparisonSchemas.js +2 -0
  788. package/dist/domain/javascript/sourceToBundleSignals.js +47 -13
  789. package/dist/domain/jeb/jebAnalysis.js +114 -0
  790. package/dist/domain/jsonShape.js +63 -52
  791. package/dist/domain/jsonValue.js +40 -12
  792. package/dist/domain/localPath.js +6 -3
  793. package/dist/domain/managed/managedApplicationGraph.js +42 -0
  794. package/dist/domain/managed/managedApplicationGraphCoverage.js +12 -2
  795. package/dist/domain/managed/managedApplicationGraphNodes.js +32 -23
  796. package/dist/domain/managed/managedArtifact.js +52 -1
  797. package/dist/domain/managed/managedInspectionEvidence.js +12 -0
  798. package/dist/domain/managed/managedMemberComparison.js +3 -0
  799. package/dist/domain/managed/managedMemberComparisonCoverage.js +23 -3
  800. package/dist/domain/managed/managedMemberComparisonItems.js +23 -19
  801. package/dist/domain/managed/managedMemberComparisonMatch.js +209 -18
  802. package/dist/domain/managed/managedNativeVerificationMatch.js +49 -26
  803. package/dist/domain/managed/managedNativeVerificationSchemas.js +13 -2
  804. package/dist/domain/managed/managedReconstruction.js +5 -8
  805. package/dist/domain/mobileApplicationGraphProjection.js +80 -0
  806. package/dist/domain/native/addressCoordinate.js +11 -0
  807. package/dist/domain/native/binaryLayout.js +2 -4
  808. package/dist/domain/native/bytePattern.js +100 -0
  809. package/dist/domain/native/nativeAotPe.js +1408 -0
  810. package/dist/domain/native/nativeInspection.js +38 -4
  811. package/dist/domain/native/nativeInstruction.js +38 -2
  812. package/dist/domain/native/nativeInvestigationGraph.js +9 -5
  813. package/dist/domain/native/nativeLoadImage.js +19 -1
  814. package/dist/domain/native/nativeMetadataRecovery.js +79 -6
  815. package/dist/domain/native/nativeUiObservation.js +5 -6
  816. package/dist/domain/native/objcSwiftMetadata.js +4 -1
  817. package/dist/domain/native/peResources.js +100 -0
  818. package/dist/domain/native/recordedCrash.js +79 -10
  819. package/dist/domain/nativeConvention.js +33 -0
  820. package/dist/domain/offsetDateTime.js +60 -0
  821. package/dist/domain/pcap/pcapAnalysis.js +91 -0
  822. package/dist/domain/pcap/pcapEvidence.js +15 -0
  823. package/dist/domain/peMachine.js +36 -0
  824. package/dist/domain/pngHeader.js +18 -0
  825. package/dist/domain/process/processCapture.js +91 -1
  826. package/dist/domain/process/processCaptureCoverage.js +26 -3
  827. package/dist/domain/process/processCaptureExample.js +26 -0
  828. package/dist/domain/process/processCaptureValidation.js +112 -8
  829. package/dist/domain/process/processComparison.js +41 -13
  830. package/dist/domain/process/processScenario.js +66 -7
  831. package/dist/domain/process/processTraceEvaluation.js +54 -50
  832. package/dist/domain/process/processTraceSpecification.js +243 -89
  833. package/dist/domain/propertyListKeys.js +214 -12
  834. package/dist/domain/propertyListXmlText.js +20 -4
  835. package/dist/domain/providerAdapterError.js +0 -5
  836. package/dist/domain/providerConfigurationRefusal.js +12 -0
  837. package/dist/domain/providerSelectionError.js +2 -1
  838. package/dist/domain/qlogCapture.js +62 -0
  839. package/dist/domain/rawBinary.js +96 -0
  840. package/dist/domain/reconstructionCoverage.js +5 -1
  841. package/dist/domain/reconstructionCoverageEvaluation.js +18 -15
  842. package/dist/domain/reconstructionCoverageVerifierResults.js +35 -0
  843. package/dist/domain/reconstructionObligationLedgerIntegrity.js +114 -0
  844. package/dist/domain/reconstructionObligationLedgerSchemas.js +104 -1
  845. package/dist/domain/reconstructionReadiness.js +4 -8
  846. package/dist/domain/reconstructionReadinessJourneyFindings.js +4 -1
  847. package/dist/domain/reconstructionUnknowns.js +9 -1
  848. package/dist/domain/reconstructionVerification.js +54 -25
  849. package/dist/domain/recordedTransportUrl.js +59 -0
  850. package/dist/domain/referenceSourceClassification.js +27 -23
  851. package/dist/domain/referenceSourceGraph.js +70 -23
  852. package/dist/domain/referenceSourceImportParsing.js +29 -16
  853. package/dist/domain/referenceSourcePathIdentity.js +32 -0
  854. package/dist/domain/referenceSourceRequireBindings.js +130 -0
  855. package/dist/domain/referenceSourceSummary.js +92 -0
  856. package/dist/domain/relationshipCoverage.js +44 -0
  857. package/dist/domain/residualUnknown.js +93 -26
  858. package/dist/domain/reverseEngineering.js +31 -0
  859. package/dist/domain/runtimeVersion.js +8 -0
  860. package/dist/domain/rust/rustBinary.js +200 -0
  861. package/dist/domain/signals/annotationTextWindow.js +31 -0
  862. package/dist/domain/signals/signalDecoders.js +69 -0
  863. package/dist/domain/signals/signalRecording.js +115 -0
  864. package/dist/domain/sourceMapContents.js +10 -3
  865. package/dist/domain/sourceMapEnvelope.js +17 -11
  866. package/dist/domain/sqlite/sqliteDatabase.js +188 -0
  867. package/dist/domain/staticRuntimeCorrelation.js +7 -9
  868. package/dist/domain/swiftSymbolClassification.js +17 -0
  869. package/dist/domain/symbolAnalysis.js +16 -4
  870. package/dist/domain/urlComponents.js +6 -0
  871. package/dist/domain/wasm/wasmArtifact.js +119 -0
  872. package/dist/domain/wasm/wasmInterface.js +89 -0
  873. package/dist/domain/webBundleAnalysis.js +14 -3
  874. package/dist/domain/webBundleAnalyzerAst.js +7 -2
  875. package/dist/domain/webBundleAnalyzerInspection.js +68 -40
  876. package/dist/domain/webBundleAnalyzerResult.js +18 -6
  877. package/dist/domain/webCaptureDiff.js +233 -34
  878. package/dist/domain/webCaptureFrameComparison.js +49 -0
  879. package/dist/domain/webMcpDiscovery.js +5 -2
  880. package/dist/domain/webModuleImports.js +22 -27
  881. package/dist/domain/webModuleTrace.js +3 -8
  882. package/dist/domain/webNetworkCapture.js +101 -39
  883. package/dist/domain/webNetworkCaptureCoordinates.js +21 -0
  884. package/dist/domain/webRuntime.js +0 -1
  885. package/dist/domain/webScreenshot.js +2 -2
  886. package/dist/domain/webScriptArtifacts.js +2 -4
  887. package/dist/domain/webScriptExport.js +6 -8
  888. package/dist/domain/webScriptExportError.js +10 -4
  889. package/dist/domain/webScriptExportPlan.js +9 -15
  890. package/dist/domain/webSourceLocation.js +20 -9
  891. package/dist/domain/zipPackageFormat.js +31 -2
  892. package/dist/domain/zodCollectionSteps.js +24 -0
  893. package/dist/dotnet/ManagedArtifactInspector.js +81 -54
  894. package/dist/dotnet/ManagedDecodeBudget.js +138 -0
  895. package/dist/dotnet/ManagedMemberInspector.js +113 -26
  896. package/dist/dotnet/ManagedMemberInspectorCore.js +356 -140
  897. package/dist/dotnet/ManagedMemberInstructionDecoder.js +112 -38
  898. package/dist/dotnet/ManagedMemberOwnership.js +65 -0
  899. package/dist/dotnet/ManagedMemberPointers.js +69 -0
  900. package/dist/dotnet/ManagedMemberRows.js +182 -44
  901. package/dist/dotnet/ManagedMetadataHeaps.js +123 -27
  902. package/dist/dotnet/ManagedMetadataInventory.js +5 -5
  903. package/dist/dotnet/ManagedMetadataInventoryRows.js +56 -63
  904. package/dist/dotnet/ManagedMetadataLayout.js +19 -5
  905. package/dist/dotnet/ManagedMetadataRowSizes.js +1 -1
  906. package/dist/dotnet/ManagedMethodBodyReader.js +34 -11
  907. package/dist/dotnet/ManagedMethodSpecs.js +78 -0
  908. package/dist/dotnet/ManagedNativeBoundaryHelpers.js +5 -4
  909. package/dist/dotnet/ManagedNativeBoundaryInspector.js +52 -44
  910. package/dist/dotnet/ManagedPeReader.js +96 -52
  911. package/dist/dotnet/ManagedReaderFailure.js +11 -1
  912. package/dist/dotnet/ManagedSnapshot.js +88 -0
  913. package/dist/dotnet/ManagedStaticProvider.js +57 -35
  914. package/dist/dotnet/ManagedTypeMemberLists.js +105 -0
  915. package/dist/dotnet/ManagedTypeNames.js +98 -0
  916. package/dist/dotnet/ManagedUserStrings.js +75 -0
  917. package/dist/electron/ElectronFusePath.js +247 -0
  918. package/dist/electron/ElectronFuseProvider.js +113 -0
  919. package/dist/electron/ElectronFuseReader.js +317 -0
  920. package/dist/evaluation/AgentEvaluationFixtures.js +194 -11
  921. package/dist/evaluation/AgentEvaluationReport.js +9 -5
  922. package/dist/evaluation/CodexAgentEval.js +58 -49
  923. package/dist/evaluation/KnownAnswerEvaluation.js +126 -57
  924. package/dist/evm/EvmoleFailures.js +19 -16
  925. package/dist/evm/EvmoleInterfaceAdapter.js +5 -1
  926. package/dist/evm/EvmoleInterfaceProvider.js +198 -23
  927. package/dist/evm/EvmoleInterfaceWorker.js +2 -0
  928. package/dist/evm/SolidityMetadata.js +139 -0
  929. package/dist/filesystem/OwnedDirectoryHandle.js +29 -0
  930. package/dist/filesystem/OwnedFileHandle.js +36 -0
  931. package/dist/filesystem/OwnedStagedOutput.js +138 -0
  932. package/dist/filesystem/RegularFile.js +81 -5
  933. package/dist/filesystem/StableFileHash.js +46 -0
  934. package/dist/filesystem/readFileHandleChunks.js +35 -0
  935. package/dist/firmware/FirmwareCommand.js +27 -5
  936. package/dist/firmware/FirmwareFiles.js +18 -7
  937. package/dist/firmware/FirmwareProvider.js +158 -32
  938. package/dist/firmware/FirmwarePublication.js +242 -4
  939. package/dist/firmware/FirmwareRelease.js +1 -0
  940. package/dist/firmware/FirmwareReports.js +202 -12
  941. package/dist/flutter/DartElf.js +418 -0
  942. package/dist/flutter/ElfBuildId.js +137 -0
  943. package/dist/flutter/ElfLoadMap.js +91 -0
  944. package/dist/flutter/FlutterBuildProvider.js +826 -0
  945. package/dist/flutter/FlutterPayloadScan.js +180 -0
  946. package/dist/frida/FridaInstrumentationManager.js +1104 -0
  947. package/dist/gdb/GdbSessionManager.js +1451 -0
  948. package/dist/generatedPackageMetadata.js +2 -2
  949. package/dist/ghidra/GhidraAnalysisProfile.js +175 -6
  950. package/dist/ghidra/GhidraAnalysisSeeds.js +211 -0
  951. package/dist/ghidra/GhidraClient.js +208 -29
  952. package/dist/ghidra/GhidraDiagnostics.js +18 -8
  953. package/dist/ghidra/GhidraDoctor.js +15 -12
  954. package/dist/ghidra/GhidraFunctionValues.js +73 -2
  955. package/dist/ghidra/GhidraInstallation.js +216 -20
  956. package/dist/ghidra/GhidraInstallationPolicy.js +79 -29
  957. package/dist/ghidra/GhidraInventoryValues.js +53 -1
  958. package/dist/ghidra/GhidraJavaLaunch.js +91 -10
  959. package/dist/ghidra/GhidraJavaProperties.js +117 -0
  960. package/dist/ghidra/GhidraLanguageCatalog.js +169 -0
  961. package/dist/ghidra/GhidraLauncher.js +306 -88
  962. package/dist/ghidra/GhidraLoadImageAttest.js +74 -7
  963. package/dist/ghidra/GhidraLoadImageValues.js +72 -0
  964. package/dist/ghidra/GhidraMipsProfile.js +315 -0
  965. package/dist/ghidra/GhidraPeProfile.js +21 -0
  966. package/dist/ghidra/GhidraPowerPcProfile.js +51 -0
  967. package/dist/ghidra/GhidraProvider.js +106 -20
  968. package/dist/ghidra/GhidraProviderCapabilities.js +30 -19
  969. package/dist/ghidra/GhidraProviderClient.js +520 -56
  970. package/dist/ghidra/GhidraPspExtension.js +140 -0
  971. package/dist/ghidra/GhidraPspProfile.js +59 -0
  972. package/dist/ghidra/GhidraRawBinaryLanguage.js +40 -0
  973. package/dist/ghidra/GhidraRiscvProfile.js +100 -0
  974. package/dist/ghidra/GhidraSessionError.js +155 -11
  975. package/dist/ghidra/GhidraSessionValues.js +75 -2
  976. package/dist/ghidra/GhidraTransport.js +2 -1
  977. package/dist/go/GoBinaryContainer.js +140 -0
  978. package/dist/go/GoBinaryImage.js +210 -0
  979. package/dist/go/GoBinaryProvider.js +151 -0
  980. package/dist/go/GoElfImage.js +211 -0
  981. package/dist/go/GoMachoImage.js +164 -0
  982. package/dist/go/GoModuleText.js +217 -0
  983. package/dist/go/GoPeImage.js +124 -0
  984. package/dist/hopper/BridgeLauncher.js +35 -2
  985. package/dist/hopper/HopperAnalysisProfile.js +21 -9
  986. package/dist/hopper/HopperCleanup.js +15 -3
  987. package/dist/hopper/HopperClient.js +203 -42
  988. package/dist/hopper/HopperMacPublisher.js +29 -0
  989. package/dist/hopper/HopperMachOImage.js +61 -27
  990. package/dist/hopper/HopperProcessDiagnostic.js +27 -0
  991. package/dist/hopper/HopperProvider.js +68 -26
  992. package/dist/hopper/HopperProviderCapabilities.js +7 -3
  993. package/dist/hopper/HopperRequestQueue.js +17 -5
  994. package/dist/hopper/HopperSessionValues.js +10 -1
  995. package/dist/hopper/HopperTargetLease.js +66 -19
  996. package/dist/ida/IdaBusyHealth.js +44 -0
  997. package/dist/ida/IdaCallGraph.js +134 -0
  998. package/dist/ida/IdaConfiguration.js +7 -2
  999. package/dist/ida/IdaDiagnosticRedactor.js +199 -0
  1000. package/dist/ida/IdaDiagnosticWriter.js +62 -0
  1001. package/dist/ida/IdaDoctor.js +7 -5
  1002. package/dist/ida/IdaJsonDiagnostic.js +138 -0
  1003. package/dist/ida/IdaMcpConnection.js +297 -27
  1004. package/dist/ida/IdaNativeProtocol.js +93 -0
  1005. package/dist/ida/IdaOperationRunner.js +249 -40
  1006. package/dist/ida/IdaProtocolValues.js +86 -4
  1007. package/dist/ida/IdaProvider.js +34 -8
  1008. package/dist/ida/IdaProviderCapabilities.js +37 -8
  1009. package/dist/ida/IdaSessionClient.js +332 -53
  1010. package/dist/ida/IdaWorkspace.js +57 -7
  1011. package/dist/inspector/V8InspectorCaptureProjection.js +7 -2
  1012. package/dist/inspector/V8InspectorEndpoint.js +15 -13
  1013. package/dist/inspector/V8InspectorProvider.js +41 -7
  1014. package/dist/javascript/analysis/JavaScriptAnalysisTransfer.js +337 -0
  1015. package/dist/javascript/analysis/JavaScriptAnalysisWorker.js +594 -0
  1016. package/dist/javascript/analysis/JavaScriptAnalysisWorkerProtocol.js +65 -0
  1017. package/dist/javascript/analysis/JavaScriptAnalysisWorkerSchemas.js +590 -0
  1018. package/dist/javascript/analysis/JavaScriptAnalysisWorkerServer.js +126 -0
  1019. package/dist/javascript/recovery/RecoveryFiles.js +68 -12
  1020. package/dist/javascript/recovery/WakaruCommand.js +22 -9
  1021. package/dist/javascript/recovery/WakaruExecution.js +30 -18
  1022. package/dist/javascript/recovery/WakaruProvider.js +150 -24
  1023. package/dist/javascript/recovery/WakaruPublication.js +38 -14
  1024. package/dist/javascript/recovery/WakaruRelease.js +11 -4
  1025. package/dist/javascript/recovery/WakaruReport.js +15 -9
  1026. package/dist/javascript/recovery/WakaruVersion.js +24 -0
  1027. package/dist/javascript/sourceMaps/DecodedSourceMap.js +2 -16
  1028. package/dist/javascript/sourceMaps/SourceMapCommand.js +38 -7
  1029. package/dist/javascript/sourceMaps/SourceMapDecoder.js +84 -10
  1030. package/dist/javascript/sourceMaps/SourceMapFormat.js +26 -28
  1031. package/dist/javascript/sourceMaps/TraceSourceMap.js +34 -6
  1032. package/dist/jeb/JebMcpConnection.js +186 -0
  1033. package/dist/jeb/JebMcpEndpoint.js +45 -0
  1034. package/dist/jeb/JebProvider.js +297 -0
  1035. package/dist/logger.js +14 -1
  1036. package/dist/main/shutdown.js +3 -0
  1037. package/dist/main/transport.js +48 -4
  1038. package/dist/main.js +14 -3
  1039. package/dist/mcp/AnalysisSnapshotFiles-BAbiJQOc.js +1412 -0
  1040. package/dist/mcp/ArtifactProvider-DViCU_rn.js +2183 -0
  1041. package/dist/mcp/ArtifactProviderMetadata-b7pOK5_t.js +76 -0
  1042. package/dist/mcp/ArtifactReader-OyM03Gjn.js +55 -0
  1043. package/dist/mcp/ArtifactResourceScope-P3tq5z8Z.js +162 -0
  1044. package/dist/mcp/AsarHeader-WsPgoooH.js +31 -0
  1045. package/dist/mcp/BinarySessionStatus-B4P9gf-S.js +212 -0
  1046. package/dist/mcp/BinaryTargetResolver-BMaE_0H1.js +1427 -0
  1047. package/dist/mcp/BoundedFileBytes-DuczXiQZ.js +68 -0
  1048. package/dist/mcp/CdpCaptureDocuments-HDiF2O7k.js +746 -0
  1049. package/dist/mcp/CdpCaptureValues-M-j6CIh1.js +90 -0
  1050. package/dist/mcp/CdpConnection-BpDfz4MK.js +570 -0
  1051. package/dist/mcp/CdpOptionalCommand-BPjRD9Kz.js +120 -0
  1052. package/dist/mcp/CdpTargetSession-BsPoKhEU.js +86 -0
  1053. package/dist/mcp/DirectAnalysis-DrafbXke.js +409 -0
  1054. package/dist/mcp/DirectAnalysisStatus-CjjeDLzW.js +44 -0
  1055. package/dist/mcp/ElectronFileScope-BPG_YoyU.js +110 -0
  1056. package/dist/mcp/InterfaceBuilderDecodeBudget-5F2AkxJT.js +652 -0
  1057. package/dist/mcp/ManagedStaticProvider-BthZbKyZ.js +5028 -0
  1058. package/dist/mcp/NativeMacOSProvider-Bh79k8dI.js +4867 -0
  1059. package/dist/mcp/NativeMacOSProviderMetadata-N1lPOaY_.js +307 -0
  1060. package/dist/mcp/ProcedureAddressResolution-CQpuwm1h.js +19 -0
  1061. package/dist/mcp/ProcessOwnership-Bl_3ejLe.js +1502 -0
  1062. package/dist/mcp/ProviderDeadline-DskQ94YD.js +932 -0
  1063. package/dist/mcp/WorkflowEvidence-umWrB_wm.js +111 -0
  1064. package/dist/mcp/analysisErrorCore-DXRTvF_m.js +235 -0
  1065. package/dist/mcp/analysisErrorProjection-BN0EPM-3.js +892 -0
  1066. package/dist/mcp/artifactOperationError-CkHMMaf7.js +27 -0
  1067. package/dist/mcp/artifactToolContracts-Di4qZlEt.js +72 -0
  1068. package/dist/mcp/browserObservation-C0s4i8UI.js +4468 -0
  1069. package/dist/mcp/browserObservationError-CyLugqX4.js +40 -0
  1070. package/dist/mcp/browserObservationSchemas-tgqjH7aA.js +573 -0
  1071. package/dist/mcp/browserScenario-CAQ8Fns9.js +2929 -0
  1072. package/dist/mcp/browserScenarioCapture-CTNFN-FI.js +479 -0
  1073. package/dist/mcp/canonicalDigest-Bi_0_zGi.js +71 -0
  1074. package/dist/mcp/digests-BFoWUT_-.js +223 -0
  1075. package/dist/mcp/electronActiveObservation-lDvQTMR0.js +226 -0
  1076. package/dist/mcp/electronObservation-DFOFEood.js +112 -0
  1077. package/dist/mcp/electronObservation-i7LcILQ-.js +562 -0
  1078. package/dist/mcp/electronScenario-nCzE6IfJ.js +653 -0
  1079. package/dist/mcp/emptyArraySchema-tL6Qymyd.js +140 -0
  1080. package/dist/mcp/enhancedInputs-DgdEnzHy.js +56 -0
  1081. package/dist/mcp/javascriptRuntimeObservation-61NhCf7H.js +690 -0
  1082. package/dist/mcp/javascriptRuntimeObservation-PIUoLfX6.js +121 -0
  1083. package/dist/mcp/jsonSerialization-V-wWiFRE.js +152 -0
  1084. package/dist/mcp/lipo-Bnkoq_6W.js +502 -0
  1085. package/dist/mcp/localPath-AxvW9aPe.js +19 -0
  1086. package/dist/mcp/logger-BQY5ulYv.js +48 -0
  1087. package/dist/mcp/main-kBXHZ8S5.js +69390 -0
  1088. package/dist/mcp/main.js +6 -0
  1089. package/dist/mcp/managedToolContracts-CK--I_s7.js +101 -0
  1090. package/dist/mcp/nativeValueTrace-DR9UE62L.js +3439 -0
  1091. package/dist/mcp/officialToolContracts-B67NJ2tC.js +1413 -0
  1092. package/dist/mcp/pngHeader-DQ-ObyY2.js +147 -0
  1093. package/dist/mcp/propertyListKeys-DD25WsjI.js +553 -0
  1094. package/dist/mcp/providerAdapterError-sDxToNal.js +25 -0
  1095. package/dist/mcp/providerIdentities--ptAh481.js +31 -0
  1096. package/dist/mcp/providerIdentity-BCQ5n5tw.js +16 -0
  1097. package/dist/mcp/providerOperationHealth-CTYa3iLf.js +48 -0
  1098. package/dist/mcp/rolldown-runtime-BjeaiXFo.js +121 -0
  1099. package/dist/mcp/safeJson-NeGfpkrI.js +25 -0
  1100. package/dist/mcp/scanCanonical-CRXSpule.js +3982 -0
  1101. package/dist/mcp/serverIdentity-Cio4iFV3.js +1328 -0
  1102. package/dist/mcp/sourceMapEnvelope-C0uJlrOh.js +94 -0
  1103. package/dist/mcp/toolContracts-BW05wpcr.js +12200 -0
  1104. package/dist/mcp/toolOutputSchemaGroups-ColvNZ1r.js +17533 -0
  1105. package/dist/mcp/unicodeCodePointOrder-BezCbTpg.js +26 -0
  1106. package/dist/mcp/webContentArtifact-Dzjc1z-R.js +284 -0
  1107. package/dist/mcp/webRuntime-K__NYzXm.js +74 -0
  1108. package/dist/mcp/webSourceLocation-DbMAT2J9.js +11130 -0
  1109. package/dist/mcpDoctor.js +108 -76
  1110. package/dist/mcpStartupPolicy.js +3 -0
  1111. package/dist/native/AppleDispatchCoverage.js +81 -28
  1112. package/dist/native/AppleDispatchMetadata.js +20 -9
  1113. package/dist/native/AppleMachoFixups.js +253 -34
  1114. package/dist/native/AppleMachoSelection.js +44 -17
  1115. package/dist/native/AppleObjcCategories.js +1 -2
  1116. package/dist/native/AppleObjcDispatchFacets.js +76 -7
  1117. package/dist/native/CommandRunner.js +142 -32
  1118. package/dist/native/LldbCallTracer.js +5 -3
  1119. package/dist/native/MachoArchitectureSelection.js +50 -0
  1120. package/dist/native/NativeCallObservation.js +2 -1
  1121. package/dist/native/NativeMacOSProvider.js +173 -37
  1122. package/dist/native/NativeMachoInspection.js +142 -78
  1123. package/dist/native/NativeUiHelperRuntime.js +6 -1
  1124. package/dist/native/NativeUiObservation.js +6 -5
  1125. package/dist/native/SignatureTargetBinding.js +118 -55
  1126. package/dist/native/parsers/codesign.js +27 -10
  1127. package/dist/native/parsers/demangle.js +7 -1
  1128. package/dist/native/parsers/dyldInfo.js +73 -4
  1129. package/dist/native/parsers/lipo.js +53 -19
  1130. package/dist/native/parsers/machoUuid.js +150 -0
  1131. package/dist/native/parsers/otool.js +232 -29
  1132. package/dist/native/pe/PeResourceLayout.js +120 -0
  1133. package/dist/native/pe/PeResourceParser.js +286 -0
  1134. package/dist/native/pe/PeResourcesProvider.js +77 -0
  1135. package/dist/native/pwndbg/PwndbgCoreContext.js +20 -20
  1136. package/dist/native/pwntools/PwntoolsDecoder.js +264 -40
  1137. package/dist/native/pwntools/PwntoolsFailures.js +2 -1
  1138. package/dist/native/pwntools/PwntoolsInputLimit.js +27 -0
  1139. package/dist/native/pwntools/PwntoolsRecordedCrashProvider.js +27 -15
  1140. package/dist/native/pwntools/PwntoolsResourceLimits.js +3 -3
  1141. package/dist/native/pwntools/RecordedCrashSourceBindings.js +12 -8
  1142. package/dist/native/pwntools/RecordedCrashStructureBindings.js +3 -1
  1143. package/dist/objdump/ObjdumpCommand.js +21 -0
  1144. package/dist/pcap/PcapCommand.js +146 -0
  1145. package/dist/pcap/PcapConfiguration.js +93 -0
  1146. package/dist/pcap/PcapNativeBound.js +58 -0
  1147. package/dist/pcap/PcapOutput.js +240 -0
  1148. package/dist/pcap/PcapProvider.js +424 -0
  1149. package/dist/pcap/PcapSnapshot.js +171 -0
  1150. package/dist/process/ArtifactAnalysisResources.js +213 -0
  1151. package/dist/process/BoundedFileBytes.js +30 -7
  1152. package/dist/process/CurrentEntrypointPath.js +6 -0
  1153. package/dist/process/DarwinProcessRunTokenReader.js +125 -16
  1154. package/dist/process/ExecFileBoundedOutput.js +44 -0
  1155. package/dist/process/ExecFileOutput.js +30 -6
  1156. package/dist/process/JavaScriptWorkerMemoryLimit.js +25 -0
  1157. package/dist/process/LinuxResourceLimits.js +80 -0
  1158. package/dist/process/MacCodeSignature.js +3 -0
  1159. package/dist/process/OwnedCommand.js +40 -15
  1160. package/dist/process/PrivateRuntimeRoot.js +9 -19
  1161. package/dist/process/PrivateRuntimeRootUnavailableError.js +10 -0
  1162. package/dist/process/ProcessOwnership.js +173 -128
  1163. package/dist/process/ProcessOwnershipObservation.js +131 -43
  1164. package/dist/process/ProcessOwnershipProcessTree.js +4 -4
  1165. package/dist/process/ProcessRunTokenObservations.js +48 -0
  1166. package/dist/process/ProviderDeadline.js +58 -12
  1167. package/dist/process/ProviderDiagnosticRedaction.js +17 -0
  1168. package/dist/process/ProviderProcess.js +112 -14
  1169. package/dist/process/WindowsAuthority.js +48 -39
  1170. package/dist/process/WindowsBatchCommand.js +46 -0
  1171. package/dist/process/boundedUtf8Text.js +13 -0
  1172. package/dist/process/capture/FilesystemSnapshot.js +87 -12
  1173. package/dist/process/capture/ProcessCaptureClock.js +2 -0
  1174. package/dist/process/capture/ProcessCaptureError.js +22 -3
  1175. package/dist/process/capture/ProcessCaptureJournal.js +2 -1
  1176. package/dist/process/capture/ProcessCaptureLifecycle.js +433 -91
  1177. package/dist/process/capture/ProcessCaptureProgress.js +63 -0
  1178. package/dist/process/capture/ProcessHarness.js +209 -38
  1179. package/dist/process/capture/ProcessNormalization.js +278 -34
  1180. package/dist/process/capture/ProcessSampling.js +3 -2
  1181. package/dist/process/capture/ProcessScenarioRuntimeValidation.js +18 -15
  1182. package/dist/process/capture/TerminalRenderer.js +52 -14
  1183. package/dist/process/ownedDebuggerSession.js +203 -0
  1184. package/dist/reference/ReferenceSourceReader.js +22 -6
  1185. package/dist/reference/ReferenceSourceReaderEntries.js +182 -105
  1186. package/dist/reference/ReferenceSourceReaderErrors.js +17 -1
  1187. package/dist/reference/ReferenceSourceReaderFile.js +50 -11
  1188. package/dist/reference/ReferenceSourceReaderTypes.js +1 -2
  1189. package/dist/reference/ReferenceSourceReaderValidate.js +4 -5
  1190. package/dist/rizin/RizinCommand.js +14 -0
  1191. package/dist/rizin/RizinDebugSessionManager.js +1072 -0
  1192. package/dist/rust/RustAuditableReader.js +309 -0
  1193. package/dist/rust/RustBinaryImage.js +116 -0
  1194. package/dist/rust/RustBinaryProvider.js +162 -0
  1195. package/dist/server/EvidenceMcpServer.js +185 -27
  1196. package/dist/server/admittedToolOperation.js +14 -0
  1197. package/dist/server/contractToolHandler.js +28 -0
  1198. package/dist/server/createServer.js +238 -36
  1199. package/dist/server/externalMutationAdmission.js +50 -0
  1200. package/dist/server/mcpProgress.js +4 -2
  1201. package/dist/server/promptCompletion.js +19 -6
  1202. package/dist/server/providerEnvironment.js +3 -0
  1203. package/dist/server/registerAdbTools.js +36 -0
  1204. package/dist/server/registerAnalysisViewTool.js +9 -10
  1205. package/dist/server/registerAndroidTools.js +22 -13
  1206. package/dist/server/registerApktoolTools.js +14 -0
  1207. package/dist/server/registerApplicationTools/compareExportShapes.js +4 -6
  1208. package/dist/server/registerApplicationTools/compareSourceToBundle.js +4 -5
  1209. package/dist/server/registerApplicationTools/compareVersions.js +3 -2
  1210. package/dist/server/registerApplicationTools/coverage.js +3 -2
  1211. package/dist/server/registerApplicationTools/obligationLedger.js +3 -2
  1212. package/dist/server/registerApplicationTools/projectMobileApplicationGraph.js +11 -3
  1213. package/dist/server/registerApplicationTools/traceFeature.js +3 -2
  1214. package/dist/server/registerApplicationTools/traceSemantics.js +4 -5
  1215. package/dist/server/registerArtifactComparisonTool.js +5 -2
  1216. package/dist/server/registerArtifactTools.js +21 -1
  1217. package/dist/server/registerBinaryDiagnosticsTools.js +16 -4
  1218. package/dist/server/registerBrowserScenarioTool.js +10 -7
  1219. package/dist/server/registerBrowserTools.js +14 -13
  1220. package/dist/server/registerBundleComparisonTool.js +20 -6
  1221. package/dist/server/registerCaptureTools.js +12 -0
  1222. package/dist/server/registerCloseLifecycleTool.js +32 -3
  1223. package/dist/server/registerCutterTools.js +33 -0
  1224. package/dist/server/registerElectronTools.js +38 -17
  1225. package/dist/server/registerEnhancedTools.js +7 -6
  1226. package/dist/server/registerEvidenceTools.js +14 -10
  1227. package/dist/server/registerEvmTools.js +24 -11
  1228. package/dist/server/registerFirmwareTools.js +3 -11
  1229. package/dist/server/registerFlutterTools.js +17 -0
  1230. package/dist/server/registerFridaTools.js +205 -0
  1231. package/dist/server/registerFunctionComparisonTool.js +34 -11
  1232. package/dist/server/registerGdbTools.js +64 -0
  1233. package/dist/server/registerGoTools.js +9 -0
  1234. package/dist/server/registerInvestigationTools/helpers.js +2 -2
  1235. package/dist/server/registerInvestigationTools.js +12 -8
  1236. package/dist/server/registerJavaScriptRecoveryTool.js +4 -9
  1237. package/dist/server/registerJavaScriptRuntimeObservationTools.js +10 -11
  1238. package/dist/server/registerJebTools.js +16 -0
  1239. package/dist/server/registerManagedTools.js +11 -1
  1240. package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +4 -6
  1241. package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +3 -2
  1242. package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +3 -2
  1243. package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +3 -2
  1244. package/dist/server/registerNativeTools.js +14 -0
  1245. package/dist/server/registerOfficialTools.js +5 -0
  1246. package/dist/server/registerPcapTools.js +35 -0
  1247. package/dist/server/registerPeResourcesTool.js +9 -0
  1248. package/dist/server/registerProcessComparisonTool.js +14 -4
  1249. package/dist/server/registerRecordedCrashTools.js +4 -9
  1250. package/dist/server/registerReverseEngineeringTools.js +86 -0
  1251. package/dist/server/registerRizinDebugTools.js +53 -0
  1252. package/dist/server/registerRustTools.js +9 -0
  1253. package/dist/server/registerSessionRecordTools.js +21 -14
  1254. package/dist/server/registerSessionStatusTool.js +22 -4
  1255. package/dist/server/registerSessionTools.js +78 -34
  1256. package/dist/server/registerSignalTools.js +12 -0
  1257. package/dist/server/registerSqliteTools.js +9 -0
  1258. package/dist/server/registerWasmTools.js +46 -0
  1259. package/dist/server/registerWebModuleTool.js +4 -9
  1260. package/dist/server/registerWebNetworkCaptureTool.js +26 -17
  1261. package/dist/server/registerWebRuntimeTools.js +6 -5
  1262. package/dist/server/registerWebScriptTool.js +6 -3
  1263. package/dist/server/registerWebSourceLocationTool.js +4 -9
  1264. package/dist/server/retainedSummaryDelivery.js +28 -0
  1265. package/dist/server/sessionAvailabilityPolicy.js +3 -0
  1266. package/dist/server/toolRegistrationOptions.js +8 -0
  1267. package/dist/server/toolResult.js +68 -16
  1268. package/dist/server/toolResultEncoding.js +36 -3
  1269. package/dist/serverIdentity.js +17 -8
  1270. package/dist/signals/SigrokRecordingProvider.js +339 -0
  1271. package/dist/signals/parseDecoderDiscovery.js +65 -0
  1272. package/dist/sqlite/SqliteDatabaseFailures.js +134 -0
  1273. package/dist/sqlite/SqliteDatabaseInspection.js +421 -0
  1274. package/dist/sqlite/SqliteDatabaseLimits.js +16 -0
  1275. package/dist/sqlite/SqliteDatabaseProvider.js +295 -0
  1276. package/dist/sqlite/SqliteDatabaseSnapshot.js +156 -0
  1277. package/dist/sqlite/SqliteDatabaseWorker.js +46 -0
  1278. package/dist/sqlite/SqliteDatabaseWorkerExecution.js +112 -0
  1279. package/dist/wasm/WabtArtifactProvider.js +336 -0
  1280. package/dist/wasm/WabtFailures.js +101 -0
  1281. package/dist/wasm/WabtInterface.js +309 -0
  1282. package/dist/wasm/WabtOutput.js +60 -0
  1283. package/dist/wasm/WabtRelease.js +12 -0
  1284. package/dist/wasm/WabtString.js +48 -0
  1285. package/dist/wasm/WabtWat.js +147 -0
  1286. package/dist/wasm/WasmGlueAdapter.js +53 -0
  1287. package/dist/wasm/WasmInterfaceBudget.js +11 -0
  1288. package/dist/windows/WindowsNativeLoader.js +37 -7
  1289. package/dist/windows/WindowsOwnedProcess.js +150 -17
  1290. package/dist/windows/WindowsPrivateRuntime.js +34 -6
  1291. package/install.sh +157 -95
  1292. package/licenses/Apache-2.0.txt +202 -0
  1293. package/licenses/GCC-Runtime-Library-Exception-3.1.txt +73 -0
  1294. package/licenses/GPL-3.0.txt +674 -0
  1295. package/licenses/LGPL-2.0.txt +480 -0
  1296. package/licenses/MIT-template.txt +18 -0
  1297. package/licenses/MinGW-w64-runtime.txt +240 -0
  1298. package/licenses/Node-22.19.0-LICENSE.txt +2666 -0
  1299. package/licenses/README.md +68 -0
  1300. package/licenses/cfworker-MIT.txt +21 -0
  1301. package/licenses/dotnet-runtime-MIT.txt +23 -0
  1302. package/licenses/frida-17.23.2-COPYING.txt +50 -0
  1303. package/licenses/ghidra-12.1.4-DISCLAIMER.txt +13 -0
  1304. package/licenses/ghidra-12.1.4-LICENSE.txt +201 -0
  1305. package/licenses/ghidra-12.1.4-NOTICE.txt +49 -0
  1306. package/licenses/nativeaot-parser-MIT.txt +28 -0
  1307. package/licenses/npm-dependencies.txt +3612 -0
  1308. package/licenses/npm-runtime-notices.txt +8548 -0
  1309. package/licenses/upstream-sources.json +72 -0
  1310. package/licenses/xterm-MIT.txt +21 -0
  1311. package/native/windows/README.md +92 -11
  1312. package/native/windows/build/manifest.json +2 -2
  1313. package/native/windows/build/rea-windows-x64.node +0 -0
  1314. package/package.json +117 -22
  1315. package/scripts/electron-active-hook.cjs +4 -1
  1316. package/scripts/hopper-demo-x11.py +53 -3
  1317. package/scripts/prepack.mjs +5 -0
  1318. package/scripts/rea-android-workspace-guardian.mjs +46 -0
  1319. package/scripts/rea.mjs +44 -13
  1320. package/scripts/verify-windows-native-artifact.mjs +2 -2
  1321. package/skills/reverse-engineer-anything/SKILL.md +142 -20
  1322. package/skills/reverse-engineer-anything/references/connection-and-recovery.md +127 -0
  1323. package/skills/reverse-engineer-anything/references/evidence-workflows.md +31 -0
  1324. package/skills/reverse-engineer-anything/references/javascript-applications.md +118 -13
  1325. package/skills/reverse-engineer-anything/references/native-and-artifacts.md +147 -16
  1326. package/skills/reverse-engineer-anything/references/runtime-observation.md +57 -7
  1327. package/third_party/README.md +1 -1
  1328. package/third_party/wabt/README.md +24 -0
  1329. package/dist/browser/history/HarCaptureAdapter.js +0 -20
  1330. package/dist/cli/streamedJsonOutput.js +0 -135
  1331. package/dist/cliJsonFile.js +0 -179
  1332. /package/dist/{application/binary → process}/AbortablePromise.js +0 -0
@@ -0,0 +1,2724 @@
1
+ import { __esmMin } from "./rolldown-runtime-DXoylpqc.js";
2
+ import { ZIP_NON_ENTRY_LIMITATION, artifactContradictionId, artifactEdgeId, artifactGraphDigest, artifactIdForContent, artifactInventoryResultSchema, artifactManifestId, compareUnicodeCodePoints, digestCanonicalValue, hasZipSignature, init_artifactGraph, init_artifactIdentity, init_canonicalDigest, init_machoCpuIdentity, init_unicodeCodePointOrder, init_zipPackageFormat, isZipPackageFormat, machoCpuSubtypeBase, occurrenceIdForLocation, zipPackageFormatForPath } from "./reconstructionObligationLedgerSchemas-Bao0xMr-.js";
3
+ import { ArtifactReaderFailure, copyArtifactEntry, init_ArtifactReader, sameArtifactEntry, sameArtifactSourceIdentity } from "./ArtifactReader-BXkffc1D.js";
4
+ import { NonRegularFileReadError, OwnedFileHandle, RegularFileAdmissionFailure, init_OwnedFileHandle, init_RegularFile, openRegularFile, sameRegularFileState } from "./RegularFile-B_6KPCNQ.js";
5
+ import { execFileOutput, execFileOutputFailure, init_ExecFileOutput } from "./ExecFileOutput-BEQs-lDD.js";
6
+ import { classifyFatContainerIdentity, init_machoContainer, readFatContainerHeader } from "./machoContainer-C8BIkkq3.js";
7
+ import { MAX_XML_PLIST_PROBE_BYTES, createXmlPlistSignatureProbe, hasBinaryPlistSignature, hasXmlPlistSignature, init_appleArchiveFormat, init_dosMz, observeMzWindowsHeader, parseDosMzHeader } from "./appleArchiveFormat-tVoI2ykA.js";
8
+ import { ArtifactPathRegistry, OwnedDirectoryHandle, annotateEnglishUnicodeCaseCollisions, init_ArtifactPaths, init_MachoLoadCommandReader, init_OwnedDirectoryHandle, init_StreamBytes, normalizeArtifactPath, readMachoImage, streamChunkToBuffer } from "./MachoLoadCommandReader-C7e074Ze.js";
9
+ import { init_readFileHandleChunks, readFileHandleChunks } from "./readFileHandleChunks-dp60iZ6v.js";
10
+ import { ZipArtifactReader, init_ZipArtifactReader } from "./ZipArtifactReader-B8ZgNe4D.js";
11
+ import { admitAsarHeader, init_AsarHeader } from "./AsarHeader-CnzOzYEH.js";
12
+ import { XcrunCommandRunner, init_CommandRunner, init_lipo, parseLipoOutput } from "./lipo-DSWP6fv-.js";
13
+ import { z } from "zod";
14
+ import { basename, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
15
+ import { createHash } from "node:crypto";
16
+ import { lstat, mkdtemp, open, opendir, realpath, rm } from "node:fs/promises";
17
+ import { constants, createWriteStream } from "node:fs";
18
+ import { Readable, Transform } from "node:stream";
19
+ import { tmpdir } from "node:os";
20
+ import { setImmediate } from "node:timers/promises";
21
+ import { pipeline } from "node:stream/promises";
22
+ import { parse } from "plist";
23
+ import { getRawHeader, uncache } from "@electron/asar";
24
+
25
+ //#region dist/artifacts/AsarEntryStream.js
26
+ var closeAsarHandle, readValidatedAsarEntry, abortIfNeeded$3, asarFailure$1, isFilesystemFailure$1;
27
+ function init_AsarEntryStream() {
28
+ return (init_AsarEntryStream = __esmMin((() => {
29
+ init_ArtifactReader();
30
+ closeAsarHandle = async (close, signal) => {
31
+ await close();
32
+ abortIfNeeded$3(signal);
33
+ };
34
+ readValidatedAsarEntry = (source, expectedBytes, entryPath, archivePath, signal) => {
35
+ const output = Readable.from((async function* () {
36
+ let observedBytes = 0;
37
+ const iterator = source[Symbol.asyncIterator]();
38
+ try {
39
+ while (true) {
40
+ abortIfNeeded$3(signal);
41
+ const next = await iterator.next();
42
+ if (next.done) break;
43
+ const chunk = next.value;
44
+ if (!Buffer.isBuffer(chunk) && !(chunk instanceof Uint8Array)) throw new ArtifactReaderFailure("format", `ASAR entry did not return bytes: ${entryPath}`);
45
+ observedBytes += Buffer.isBuffer(chunk) ? chunk.length : chunk.byteLength;
46
+ if (expectedBytes !== undefined && observedBytes > expectedBytes) throw new ArtifactReaderFailure("integrity", `ASAR entry exceeded its declared size: ${entryPath}`);
47
+ yield chunk;
48
+ }
49
+ if (expectedBytes !== undefined && observedBytes !== expectedBytes) throw new ArtifactReaderFailure("integrity", `ASAR entry size disagrees with its header: ${entryPath}`);
50
+ } catch (cause) {
51
+ throw asarFailure$1(archivePath, `read ${entryPath}`, cause);
52
+ } finally {
53
+ try {
54
+ await iterator.return?.();
55
+ } catch {}
56
+ if (!source.destroyed) source.destroy();
57
+ }
58
+ })());
59
+ const closeSource = () => {
60
+ signal?.removeEventListener("abort", onAbort);
61
+ if (!source.destroyed) source.destroy();
62
+ };
63
+ const onAbort = () => {
64
+ closeSource();
65
+ output.destroy(new ArtifactReaderFailure("cancelled", "ASAR operation cancelled"));
66
+ };
67
+ output.once("close", closeSource);
68
+ signal?.addEventListener("abort", onAbort, { once: true });
69
+ if (signal?.aborted === true) onAbort();
70
+ return output;
71
+ };
72
+ abortIfNeeded$3 = (signal) => {
73
+ if (signal?.aborted === true) throw new ArtifactReaderFailure("cancelled", "ASAR operation cancelled");
74
+ };
75
+ asarFailure$1 = (path, operation, cause) => {
76
+ if (cause instanceof ArtifactReaderFailure) return cause;
77
+ if (isFilesystemFailure$1(cause)) return new ArtifactReaderFailure("io", `Could not ${operation} ASAR at ${path}: ${cause.message}`, { cause });
78
+ return new ArtifactReaderFailure("format", `Malformed ASAR during ${operation}: ${path}`, { cause });
79
+ };
80
+ isFilesystemFailure$1 = (cause) => cause instanceof Error && "errno" in cause && typeof cause.errno === "number" && "syscall" in cause && typeof cause.syscall === "string";
81
+ })))();
82
+ }
83
+
84
+ //#endregion
85
+ //#region dist/artifacts/AsarListing.js
86
+ function* ownChildren(files) {
87
+ for (const name in files) if (Object.hasOwn(files, name)) yield [name, files[name]];
88
+ }
89
+ var MAX_LISTING_BYTES, nodeSchema, readAsarListing;
90
+ function init_AsarListing() {
91
+ return (init_AsarListing = __esmMin((() => {
92
+ init_ArtifactReader();
93
+ init_unicodeCodePointOrder();
94
+ MAX_LISTING_BYTES = 64 * 1024 * 1024;
95
+ nodeSchema = z.looseObject({
96
+ files: z.custom((value) => value !== null && typeof value === "object" && !Array.isArray(value)).optional(),
97
+ link: z.string().optional(),
98
+ size: z.number().nonnegative().safe().optional(),
99
+ offset: z.string().optional(),
100
+ unpacked: z.boolean().optional(),
101
+ executable: z.boolean().optional(),
102
+ integrity: z.looseObject({
103
+ algorithm: z.string(),
104
+ hash: z.string()
105
+ }).optional()
106
+ });
107
+ readAsarListing = async (header, signal) => {
108
+ const root = nodeSchema.parse(header);
109
+ if (root.files === undefined) throw new ArtifactReaderFailure("format", "ASAR root has no files table");
110
+ const entries = [];
111
+ const pending = [{
112
+ parent: "",
113
+ children: ownChildren(root.files)
114
+ }];
115
+ let retainedBytes = 0;
116
+ let examined = 0;
117
+ while (pending.length > 0) {
118
+ if (examined++ % 128 === 0) {
119
+ await setImmediate();
120
+ if (signal?.aborted) throw new ArtifactReaderFailure("cancelled", "ASAR operation cancelled");
121
+ }
122
+ const frame = pending.at(-1);
123
+ if (frame === undefined) break;
124
+ const next = frame.children.next();
125
+ if (next.done) {
126
+ pending.pop();
127
+ continue;
128
+ }
129
+ const [name, raw] = next.value;
130
+ if (name.length === 0 || name === "." || name === ".." || name.includes("/") || name.includes("\0") || process.platform === "win32" && name.includes("\\")) throw new ArtifactReaderFailure("path", "ASAR header has an unsafe path component");
131
+ const units = frame.parent.length + name.length + (frame.parent.length === 0 ? 0 : 1);
132
+ retainedBytes += units * 2 + 256;
133
+ if (retainedBytes > MAX_LISTING_BYTES) throw new ArtifactReaderFailure("limit", "ASAR expanded listing exceeds its 64 MiB representation budget");
134
+ const path = frame.parent.length === 0 ? name : `${frame.parent}/${name}`;
135
+ const metadata = nodeSchema.parse(raw);
136
+ if (metadata.files === undefined && metadata.link === undefined && metadata.size === undefined) throw new ArtifactReaderFailure("format", "ASAR entry has no directory, link or file metadata");
137
+ entries.push({
138
+ path,
139
+ metadata
140
+ });
141
+ if (metadata.files !== undefined) pending.push({
142
+ parent: path,
143
+ children: ownChildren(metadata.files)
144
+ });
145
+ }
146
+ return entries.sort((left, right) => compareUnicodeCodePoints(left.path, right.path));
147
+ };
148
+ })))();
149
+ }
150
+
151
+ //#endregion
152
+ //#region dist/artifacts/AsarArtifactReader.js
153
+ var AsarArtifactReader, defaultRemoveSnapshot, asarUnpackedEntryFailure, isAsarFileMetadata, parseArchiveOffset, abortIfNeeded$2, waitForOperation, asarFailure, isFilesystemFailure, isMissingFile;
154
+ function init_AsarArtifactReader() {
155
+ return (init_AsarArtifactReader = __esmMin((() => {
156
+ init_ArtifactReader();
157
+ init_AsarEntryStream();
158
+ init_AsarHeader();
159
+ init_OwnedFileHandle();
160
+ init_readFileHandleChunks();
161
+ init_AsarListing();
162
+ AsarArtifactReader = class {
163
+ path;
164
+ options;
165
+ format = "asar";
166
+ #archiveSize;
167
+ #headerSize;
168
+ #entries = new Map();
169
+ #ownedHandles = new Map();
170
+ #snapshot;
171
+ #snapshotRoot;
172
+ #snapshotOperation = Promise.resolve();
173
+ constructor(path, options = {}) {
174
+ this.path = path;
175
+ this.options = options;
176
+ }
177
+ async *entries(signal) {
178
+ let paths;
179
+ try {
180
+ await this.prepareContainer(undefined, signal);
181
+ paths = await this.#withSnapshotOperation(async () => {
182
+ const snapshotPath = this.#snapshotPath();
183
+ this.#resetArchiveState();
184
+ this.#entries.clear();
185
+ const admitted = await this.#admitHeader(snapshotPath);
186
+ this.#archiveSize = admitted.archiveBytes;
187
+ this.#headerSize = admitted.headerBytes;
188
+ abortIfNeeded$2(signal);
189
+ const ordered = await readAsarListing(getRawHeader(snapshotPath).header, signal);
190
+ const archiveMetadata = await lstat(snapshotPath);
191
+ if (!archiveMetadata.isFile() || archiveMetadata.isSymbolicLink()) throw new ArtifactReaderFailure("format", "ASAR container is not a regular file");
192
+ this.#archiveSize = archiveMetadata.size;
193
+ return ordered;
194
+ }, signal);
195
+ } catch (cause) {
196
+ throw asarFailure(this.path, "inventory", cause);
197
+ }
198
+ for (const { metadata, path } of paths) {
199
+ abortIfNeeded$2(signal);
200
+ const providerPath = path.split("/").join(sep);
201
+ const kind = metadata.files !== undefined ? "directory" : metadata.link !== undefined ? "symlink" : "file";
202
+ const entry = {
203
+ path,
204
+ kind,
205
+ declaredSize: metadata.size ?? null,
206
+ compressedSize: null,
207
+ executable: metadata.executable === true,
208
+ encrypted: false,
209
+ byteOffset: null,
210
+ declaredSha256: metadata.integrity !== undefined && metadata.integrity.algorithm === "SHA256" && /^[a-f0-9]{64}$/u.test(metadata.integrity.hash) ? metadata.integrity.hash : null,
211
+ unpacked: "unpacked" in metadata && metadata.unpacked === true,
212
+ limitations: kind === "symlink" ? ["ASAR symlink target was not followed or disclosed."] : [],
213
+ adapterKey: providerPath
214
+ };
215
+ if (kind === "file" && isAsarFileMetadata(metadata)) this.#entries.set(providerPath, {
216
+ metadata,
217
+ entry: copyArtifactEntry(entry)
218
+ });
219
+ yield entry;
220
+ }
221
+ }
222
+ async #admitHeader(snapshotPath) {
223
+ const headerHandle = await this.#openOwned(snapshotPath, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
224
+ let admission;
225
+ try {
226
+ admission = {
227
+ ok: true,
228
+ value: await admitAsarHeader(headerHandle)
229
+ };
230
+ } catch (cause) {
231
+ admission = {
232
+ ok: false,
233
+ cause
234
+ };
235
+ }
236
+ try {
237
+ await this.#closeOwnedHandle(headerHandle);
238
+ } catch (cleanupCause) {
239
+ if (!admission.ok) throw ArtifactReaderFailure.withCleanup(admission.cause, ArtifactReaderFailure.cleanupObservation(cleanupCause, snapshotPath));
240
+ throw cleanupCause;
241
+ }
242
+ if (!admission.ok) throw admission.cause;
243
+ return admission.value;
244
+ }
245
+ async open(entry, signal) {
246
+ return this.#withSnapshotOperation(() => this.#openEntry(entry, signal), signal);
247
+ }
248
+ async #openEntry(entry, signal) {
249
+ abortIfNeeded$2(signal);
250
+ const state = this.#entries.get(entry.adapterKey);
251
+ if (state === undefined && entry.kind !== "file") throw new ArtifactReaderFailure("format", "ASAR entry is not a regular file");
252
+ if (state === undefined) throw new ArtifactReaderFailure("integrity", `ASAR entry was not produced by this reader: ${entry.path}`);
253
+ if (!sameArtifactEntry(entry, state.entry)) throw new ArtifactReaderFailure("integrity", `ASAR entry metadata changed since inventory: ${state.entry.path}`);
254
+ if (state.entry.unpacked) return this.#openUnpackedStream(state.entry, signal);
255
+ return this.#openPackedStream(state, signal);
256
+ }
257
+ async #openPackedStream(state, signal) {
258
+ const { metadata, entry: producedEntry } = state;
259
+ const archiveSize = this.#archiveSize;
260
+ const headerSize = this.#headerSize;
261
+ const offset = metadata.offset === undefined ? undefined : parseArchiveOffset(metadata.offset);
262
+ const start = offset === undefined || headerSize === undefined ? undefined : 8 + headerSize + offset;
263
+ if (archiveSize === undefined || start === undefined || !Number.isSafeInteger(start) || metadata.size < 0 || !Number.isSafeInteger(metadata.size) || start > archiveSize || metadata.size > archiveSize - start) throw new ArtifactReaderFailure("format", `ASAR entry range is outside its container: ${producedEntry.path}`);
264
+ const snapshotPath = this.#snapshotPath();
265
+ let handle;
266
+ try {
267
+ const openedHandle = await this.#openOwned(snapshotPath, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
268
+ handle = openedHandle;
269
+ const observed = await openedHandle.stat();
270
+ abortIfNeeded$2(signal);
271
+ if (!observed.isFile() || observed.size !== archiveSize) throw new ArtifactReaderFailure("integrity", `ASAR container changed before read: ${producedEntry.path}`);
272
+ if (metadata.size === 0) {
273
+ handle = undefined;
274
+ await closeAsarHandle(() => this.#closeOwnedHandle(openedHandle), signal);
275
+ return Readable.from([]);
276
+ }
277
+ const source = this.#ownedReadStream(openedHandle, {
278
+ start,
279
+ end: start + metadata.size - 1,
280
+ signal
281
+ });
282
+ handle = undefined;
283
+ const output = readValidatedAsarEntry(source, metadata.size, producedEntry.path, this.path, signal);
284
+ this.#setOwnedOutput(openedHandle, output);
285
+ return output;
286
+ } catch (cause) {
287
+ const failure = asarFailure(this.path, `read ${producedEntry.path}`, cause);
288
+ if (handle !== undefined) {
289
+ try {
290
+ await this.#closeOwnedHandle(handle);
291
+ } catch (cleanupCause) {
292
+ throw ArtifactReaderFailure.withCleanup(failure, ArtifactReaderFailure.cleanupObservation(cleanupCause, snapshotPath));
293
+ }
294
+ }
295
+ throw failure;
296
+ }
297
+ }
298
+ /** Capture once per reader lifetime; bind all interpretation to these exact bytes. */
299
+ async prepareContainer(expectedSha256, signal) {
300
+ await this.#withSnapshotOperation(async () => {
301
+ abortIfNeeded$2(signal);
302
+ if (this.#snapshot === undefined && this.#snapshotRoot !== undefined) await this.#closeSnapshot();
303
+ if (this.#snapshot === undefined) await this.#captureSnapshot(signal);
304
+ if (expectedSha256 !== undefined && this.#snapshot?.sha256 !== expectedSha256) throw new ArtifactReaderFailure("integrity", `ASAR container changed before interpretation: ${this.path}`);
305
+ }, signal);
306
+ }
307
+ /** Read the same captured container that supplies headers and packed members. */
308
+ async openContainer(signal) {
309
+ await this.prepareContainer(undefined, signal);
310
+ return this.#withSnapshotOperation(async () => {
311
+ abortIfNeeded$2(signal);
312
+ const snapshotPath = this.#snapshotPath();
313
+ const handle = await this.#openOwned(snapshotPath, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
314
+ return this.#ownedReadStream(handle, { signal });
315
+ }, signal);
316
+ }
317
+ async close() {
318
+ await this.#withSnapshotOperation(() => this.#closeSnapshot());
319
+ }
320
+ async #captureSnapshot(signal) {
321
+ let inputHandle;
322
+ try {
323
+ this.#snapshotRoot = await mkdtemp(join(tmpdir(), "rea-asar-snapshot-"));
324
+ const snapshotPath = join(this.#snapshotRoot, "container.asar");
325
+ const hash = createHash("sha256");
326
+ inputHandle = await this.#openOwned(this.path, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
327
+ const source = this.#ownedReadStream(inputHandle, {
328
+ signal,
329
+ releaseOnClose: false
330
+ });
331
+ const digesting = new Transform({ transform(chunk, _encoding, callback) {
332
+ hash.update(chunk);
333
+ callback(null, chunk);
334
+ } });
335
+ await pipeline(source, digesting, createWriteStream(snapshotPath, {
336
+ flags: "wx",
337
+ mode: 384
338
+ }), signal === undefined ? {} : { signal });
339
+ const completedInput = inputHandle;
340
+ inputHandle = undefined;
341
+ await this.#closeOwnedHandle(completedInput);
342
+ this.#snapshot = {
343
+ path: snapshotPath,
344
+ sha256: hash.digest("hex")
345
+ };
346
+ } catch (cause) {
347
+ let failure = signal?.aborted === true ? new ArtifactReaderFailure("cancelled", "ASAR operation cancelled", { cause }) : asarFailure(this.path, "snapshot", cause);
348
+ if (inputHandle !== undefined) {
349
+ const failedInput = inputHandle;
350
+ inputHandle = undefined;
351
+ try {
352
+ await this.#closeOwnedHandle(failedInput);
353
+ } catch (cleanupCause) {
354
+ failure = ArtifactReaderFailure.withCleanup(failure, ArtifactReaderFailure.cleanupObservation(cleanupCause, this.path));
355
+ }
356
+ }
357
+ try {
358
+ if (this.#ownedHandles.size === 0) await this.#closeSnapshot();
359
+ } catch (cleanupCause) {
360
+ throw ArtifactReaderFailure.withCleanup(failure, ArtifactReaderFailure.cleanupObservation(cleanupCause, this.#snapshotRoot ?? this.path));
361
+ }
362
+ throw failure;
363
+ }
364
+ }
365
+ async #closeSnapshot() {
366
+ await this.#closeOwnedHandles();
367
+ const root = this.#snapshotRoot;
368
+ if (root !== undefined) {
369
+ try {
370
+ await (this.options.removeSnapshot ?? defaultRemoveSnapshot)(root);
371
+ if (this.#snapshotRoot === root) this.#snapshotRoot = undefined;
372
+ } catch (cause) {
373
+ throw ArtifactReaderFailure.withCleanup(cause, {
374
+ reason: `Could not remove ASAR snapshot: ${root}`,
375
+ resources: [root]
376
+ });
377
+ }
378
+ }
379
+ if (root === undefined || this.#snapshotRoot === undefined) {
380
+ if (this.#snapshot !== undefined) uncache(this.#snapshot.path);
381
+ this.#snapshot = undefined;
382
+ this.#resetArchiveState();
383
+ this.#entries.clear();
384
+ }
385
+ }
386
+ async #withSnapshotOperation(operation, signal) {
387
+ const previous = this.#snapshotOperation;
388
+ let release;
389
+ this.#snapshotOperation = new Promise((resolve) => {
390
+ release = resolve;
391
+ });
392
+ try {
393
+ await waitForOperation(previous, signal);
394
+ } catch (cause) {
395
+ void previous.then(release, release);
396
+ throw cause;
397
+ }
398
+ try {
399
+ abortIfNeeded$2(signal);
400
+ return await operation();
401
+ } finally {
402
+ release();
403
+ }
404
+ }
405
+ #snapshotPath() {
406
+ if (this.#snapshot === undefined) throw new ArtifactReaderFailure("integrity", "ASAR snapshot is not available");
407
+ return this.#snapshot.path;
408
+ }
409
+ provenance() {
410
+ return [];
411
+ }
412
+ async #openUnpackedStream(entry, signal) {
413
+ const unpackedRoot = `${this.path}.unpacked`;
414
+ let handle;
415
+ try {
416
+ const rootMetadata = await lstat(unpackedRoot);
417
+ if (!rootMetadata.isDirectory() || rootMetadata.isSymbolicLink()) throw new ArtifactReaderFailure("path", "ASAR unpacked companion is not a regular directory");
418
+ const canonicalRoot = await realpath(unpackedRoot);
419
+ const candidate = join(unpackedRoot, entry.adapterKey);
420
+ const canonical = await realpath(candidate);
421
+ const relativePath = relative(canonicalRoot, canonical);
422
+ if (relativePath === ".." || relativePath.startsWith(`..${sep}`) || isAbsolute(relativePath)) throw new ArtifactReaderFailure("path", `ASAR unpacked entry escaped its companion directory: ${entry.path}`);
423
+ const pathMetadata = await lstat(candidate);
424
+ if (!pathMetadata.isFile() || pathMetadata.isSymbolicLink()) throw new ArtifactReaderFailure("path", `ASAR unpacked entry is not a regular file: ${entry.path}`);
425
+ handle = await (this.options.openUnpackedFile ?? open)(canonical, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
426
+ const openedHandle = handle;
427
+ this.#adoptHandle(openedHandle, canonical);
428
+ const openedMetadata = await openedHandle.stat();
429
+ if (!openedMetadata.isFile() || openedMetadata.dev !== pathMetadata.dev || openedMetadata.ino !== pathMetadata.ino) {
430
+ throw new ArtifactReaderFailure("integrity", `ASAR unpacked entry changed before read: ${entry.path}`, {}, {
431
+ logicalPath: entry.path,
432
+ declaredSha256: entry.declaredSha256,
433
+ calculatedSha256: null,
434
+ unpacked: true
435
+ });
436
+ }
437
+ abortIfNeeded$2(signal);
438
+ const source = this.#ownedReadStream(openedHandle, { start: 0 });
439
+ handle = undefined;
440
+ const output = readValidatedAsarEntry(source, undefined, entry.path, this.path, signal);
441
+ this.#setOwnedOutput(openedHandle, output);
442
+ return output;
443
+ } catch (cause) {
444
+ let failure = asarUnpackedEntryFailure(this.path, entry, cause);
445
+ if (handle !== undefined && this.#ownedHandles.has(handle)) {
446
+ try {
447
+ await this.#closeOwnedHandle(handle);
448
+ } catch (cleanupCause) {
449
+ failure = ArtifactReaderFailure.withCleanup(failure, ArtifactReaderFailure.cleanupObservation(cleanupCause, this.#ownedHandles.get(handle)?.path ?? entry.path));
450
+ }
451
+ }
452
+ throw failure;
453
+ }
454
+ }
455
+ async #closeOwnedHandle(handle) {
456
+ const owned = this.#ownedHandles.get(handle);
457
+ if (owned === undefined) return;
458
+ owned.output?.destroy();
459
+ owned.source?.destroy();
460
+ try {
461
+ await owned.owner.close();
462
+ } catch (cause) {
463
+ throw ArtifactReaderFailure.withCleanup(cause, ArtifactReaderFailure.cleanupObservation(cause, owned.path));
464
+ }
465
+ this.#ownedHandles.delete(handle);
466
+ }
467
+ async #closeOwnedHandles() {
468
+ let failure;
469
+ for (const [handle, owned] of this.#ownedHandles) {
470
+ try {
471
+ await this.#closeOwnedHandle(handle);
472
+ } catch (cause) {
473
+ failure = ArtifactReaderFailure.withCleanup(failure ?? cause, ArtifactReaderFailure.cleanupObservation(cause, owned.path));
474
+ }
475
+ }
476
+ if (failure !== undefined) throw failure;
477
+ }
478
+ async #openOwned(path, flags) {
479
+ const handle = await (this.options.openFile ?? open)(path, flags);
480
+ this.#adoptHandle(handle, path);
481
+ return handle;
482
+ }
483
+ #adoptHandle(handle, path) {
484
+ this.#ownedHandles.set(handle, {
485
+ path,
486
+ owner: new OwnedFileHandle(handle)
487
+ });
488
+ }
489
+ #ownedReadStream(handle, options) {
490
+ const { releaseOnClose, ...readOptions } = options;
491
+ const source = readFileHandleChunks(handle, readOptions);
492
+ const owned = this.#ownedHandles.get(handle);
493
+ if (owned === undefined) throw new ArtifactReaderFailure("integrity", "ASAR handle has no owner");
494
+ owned.source = source;
495
+ owned.output = source;
496
+ if (releaseOnClose !== false) source.once("close", () => {
497
+ void this.#closeOwnedHandle(handle).catch(() => undefined);
498
+ });
499
+ return source;
500
+ }
501
+ #setOwnedOutput(handle, output) {
502
+ const owned = this.#ownedHandles.get(handle);
503
+ if (owned !== undefined) owned.output = output;
504
+ }
505
+ #resetArchiveState() {
506
+ this.#archiveSize = undefined;
507
+ this.#headerSize = undefined;
508
+ }
509
+ };
510
+ defaultRemoveSnapshot = (path) => rm(path, {
511
+ recursive: true,
512
+ force: true
513
+ });
514
+ asarUnpackedEntryFailure = (archivePath, entry, cause) => {
515
+ if (cause instanceof ArtifactReaderFailure) return cause;
516
+ if (entry.unpacked && isMissingFile(cause)) return new ArtifactReaderFailure("unavailable", `ASAR unpacked entry bytes are unavailable: ${entry.path}`, { cause }, {
517
+ logicalPath: entry.path,
518
+ declaredSha256: entry.declaredSha256,
519
+ calculatedSha256: null,
520
+ unpacked: true
521
+ });
522
+ return asarFailure(archivePath, `read ${entry.path}`, cause);
523
+ };
524
+ isAsarFileMetadata = (metadata) => typeof metadata.size === "number" && metadata.files === undefined && metadata.link === undefined;
525
+ parseArchiveOffset = (value) => {
526
+ if (!/^(?:0|[1-9][0-9]*)$/u.test(value)) return undefined;
527
+ const offset = Number(value);
528
+ return Number.isSafeInteger(offset) ? offset : undefined;
529
+ };
530
+ abortIfNeeded$2 = (signal) => {
531
+ if (signal?.aborted === true) throw new ArtifactReaderFailure("cancelled", "ASAR operation cancelled");
532
+ };
533
+ waitForOperation = async (operation, signal) => {
534
+ if (signal === undefined) return operation;
535
+ abortIfNeeded$2(signal);
536
+ await new Promise((resolve, reject) => {
537
+ const removeAbortListener = () => signal.removeEventListener("abort", onAbort);
538
+ const onAbort = () => {
539
+ removeAbortListener();
540
+ reject(new ArtifactReaderFailure("cancelled", "ASAR operation cancelled"));
541
+ };
542
+ signal.addEventListener("abort", onAbort, { once: true });
543
+ operation.then(() => {
544
+ removeAbortListener();
545
+ resolve();
546
+ }, (cause) => {
547
+ removeAbortListener();
548
+ reject(cause);
549
+ });
550
+ });
551
+ };
552
+ asarFailure = (path, operation, cause) => {
553
+ if (cause instanceof ArtifactReaderFailure) return cause;
554
+ if (isFilesystemFailure(cause)) return new ArtifactReaderFailure("io", `Could not ${operation} ASAR at ${path}: ${cause.message}`, { cause });
555
+ return new ArtifactReaderFailure("format", `Malformed ASAR during ${operation}: ${path}`, { cause });
556
+ };
557
+ isFilesystemFailure = (cause) => cause instanceof Error && "errno" in cause && typeof cause.errno === "number" && "syscall" in cause && typeof cause.syscall === "string";
558
+ isMissingFile = (cause) => typeof cause === "object" && cause !== null && "code" in cause && cause.code === "ENOENT";
559
+ })))();
560
+ }
561
+
562
+ //#endregion
563
+ //#region dist/artifacts/hostExecutableMarking.js
564
+ var windowsLaunchableExtensions, hostExecutableMarking;
565
+ function init_hostExecutableMarking() {
566
+ return (init_hostExecutableMarking = __esmMin((() => {
567
+ windowsLaunchableExtensions = new Set([
568
+ ".bat",
569
+ ".cmd",
570
+ ".com",
571
+ ".exe"
572
+ ]);
573
+ hostExecutableMarking = (path, metadata, platform = process.platform) => platform === "win32" ? metadata.isFile() && windowsLaunchableExtensions.has(extname(path).toLowerCase()) : typeof metadata.mode === "bigint" ? (metadata.mode & 73n) !== 0n : (metadata.mode & 73) !== 0;
574
+ })))();
575
+ }
576
+
577
+ //#endregion
578
+ //#region dist/artifacts/DirectoryArtifactReader.js
579
+ var DirectoryArtifactReader, unsupportedEntryKind, artifactEntry, safeArtifactSize, directoryIoFailure, failureMessage$1, mapStableFileRead, withDirectoryIoContext, abortIfNeeded$1, assertContainedDirectory;
580
+ function init_DirectoryArtifactReader() {
581
+ return (init_DirectoryArtifactReader = __esmMin((() => {
582
+ init_ArtifactReader();
583
+ init_hostExecutableMarking();
584
+ init_OwnedDirectoryHandle();
585
+ init_OwnedFileHandle();
586
+ init_readFileHandleChunks();
587
+ DirectoryArtifactReader = class {
588
+ format = "directory";
589
+ #rootPromise;
590
+ #rootIdentity;
591
+ #rootPath;
592
+ #directories = new Set();
593
+ #files = new Map();
594
+ constructor(root) {
595
+ this.#rootPath = root;
596
+ }
597
+ /** Enumerate entries, optionally restricting descent while retaining directories. */
598
+ async *entries(signal, selection) {
599
+ const root = await this.#resolveRoot();
600
+ const options = typeof selection === "function" ? { descendInto: selection } : selection;
601
+ const pending = [root];
602
+ while (pending.length > 0) {
603
+ abortIfNeeded$1(signal);
604
+ const directory = pending.pop();
605
+ if (directory === undefined) break;
606
+ await withDirectoryIoContext("inspect directory", directory, () => assertContainedDirectory(root, directory, this.#rootIdentity));
607
+ for await (const entry of this.#readDirectory(directory, pending, signal, options)) yield entry;
608
+ await withDirectoryIoContext("inspect directory", directory, () => assertContainedDirectory(root, directory, this.#rootIdentity));
609
+ }
610
+ }
611
+ async #resolveRoot() {
612
+ return this.#rootPromise ??= (async () => {
613
+ const root = await realpath(this.#rootPath);
614
+ const metadata = await lstat(root, { bigint: true });
615
+ if (metadata.isSymbolicLink() || !metadata.isDirectory()) throw new ArtifactReaderFailure("path", "Artifact root changed during traversal");
616
+ this.#rootIdentity = {
617
+ dev: metadata.dev,
618
+ ino: metadata.ino
619
+ };
620
+ return root;
621
+ })().catch((cause) => {
622
+ if (cause instanceof ArtifactReaderFailure) throw cause;
623
+ throw directoryIoFailure("resolve artifact root", this.#rootPath, cause);
624
+ });
625
+ }
626
+ async *#readDirectory(directory, pending, signal, options) {
627
+ const root = await this.#resolveRoot();
628
+ const handle = new OwnedDirectoryHandle(await opendir(directory).catch((cause) => {
629
+ throw directoryIoFailure("open directory", directory, cause);
630
+ }));
631
+ this.#directories.add(handle);
632
+ const childDirectories = [];
633
+ let traversal = { kind: "complete" };
634
+ try {
635
+ for (;;) {
636
+ await withDirectoryIoContext("inspect directory", directory, () => assertContainedDirectory(root, directory, this.#rootIdentity));
637
+ const child = await handle.handle.read();
638
+ if (child === null) break;
639
+ abortIfNeeded$1(signal);
640
+ const absolute = join(directory, child.name);
641
+ const metadata = await lstat(absolute, { bigint: true }).catch((cause) => {
642
+ throw directoryIoFailure("inspect entry", absolute, cause);
643
+ });
644
+ const path = relative(root, absolute).split(sep).join("/");
645
+ const entry = artifactEntry(path, absolute, metadata);
646
+ if (entry === undefined) {
647
+ options?.onOmission?.({
648
+ path,
649
+ kind: unsupportedEntryKind(metadata)
650
+ });
651
+ continue;
652
+ }
653
+ yield entry;
654
+ if (entry.kind === "directory") {
655
+ if (options?.descendInto?.(path) ?? true) childDirectories.push(absolute);
656
+ else options?.onOmission?.({
657
+ path,
658
+ kind: "directory-descendants"
659
+ });
660
+ }
661
+ }
662
+ } catch (cause) {
663
+ traversal = {
664
+ kind: "failed",
665
+ cause: cause instanceof ArtifactReaderFailure ? cause : directoryIoFailure("read directory", directory, cause)
666
+ };
667
+ } finally {
668
+ await this.#finishDirectory(handle, directory, traversal);
669
+ }
670
+ if (traversal.kind === "failed") throw traversal.cause;
671
+ childDirectories.reverse();
672
+ pending.push(...childDirectories);
673
+ }
674
+ async #finishDirectory(handle, path, traversal) {
675
+ try {
676
+ await handle.close();
677
+ this.#directories.delete(handle);
678
+ } catch (cause) {
679
+ const closeFailure = directoryIoFailure("close directory", path, cause);
680
+ if (traversal.kind === "failed") throw ArtifactReaderFailure.withCleanup(traversal.cause, ArtifactReaderFailure.cleanupObservation(closeFailure, path));
681
+ throw closeFailure;
682
+ }
683
+ }
684
+ async open(entry, signal) {
685
+ abortIfNeeded$1(signal);
686
+ if (entry.kind !== "file") throw new ArtifactReaderFailure("format", "Only regular files can be opened");
687
+ const fileHandle = await open(entry.adapterKey, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK).catch((cause) => {
688
+ throw directoryIoFailure("open entry", entry.adapterKey, cause);
689
+ });
690
+ const owner = new OwnedFileHandle(fileHandle);
691
+ this.#files.set(owner, entry.adapterKey);
692
+ try {
693
+ const observed = await owner.handle.stat({ bigint: true }).catch((cause) => {
694
+ throw directoryIoFailure("inspect opened entry", entry.adapterKey, cause);
695
+ });
696
+ if (!observed.isFile() || !sameArtifactSourceIdentity(entry.sourceIdentity, observed)) {
697
+ throw new ArtifactReaderFailure("integrity", `Directory entry changed before open: ${entry.path}`);
698
+ }
699
+ abortIfNeeded$1(signal);
700
+ const source = Readable.from(mapStableFileRead(owner.handle, entry, signal), { objectMode: false });
701
+ source.once("close", () => {
702
+ void this.#closeFile(owner).catch(() => undefined);
703
+ });
704
+ return source;
705
+ } catch (cause) {
706
+ try {
707
+ await this.#closeFile(owner);
708
+ } catch (closeCause) {
709
+ throw ArtifactReaderFailure.withCleanup(cause, ArtifactReaderFailure.cleanupObservation(directoryIoFailure("close opened entry", entry.adapterKey, closeCause), entry.adapterKey));
710
+ }
711
+ throw cause;
712
+ }
713
+ }
714
+ async close() {
715
+ const failures = [];
716
+ for (const [owner, path] of this.#files) {
717
+ try {
718
+ await this.#closeFile(owner);
719
+ } catch (cause) {
720
+ failures.push(directoryIoFailure("close opened entry", path, cause));
721
+ }
722
+ }
723
+ for (const owner of this.#directories) {
724
+ try {
725
+ await owner.close();
726
+ this.#directories.delete(owner);
727
+ } catch (cause) {
728
+ failures.push(directoryIoFailure("close directory", owner.handle.path, cause));
729
+ }
730
+ }
731
+ if (failures.length > 0) {
732
+ const reason = failures.map(failureMessage$1).join("; ");
733
+ throw new ArtifactReaderFailure("io", `Directory artifact cleanup failed: ${reason}`, {
734
+ cause: new AggregateError(failures),
735
+ cleanup: {
736
+ reason,
737
+ resources: [...this.#files.values(), ...[...this.#directories].map((owner) => owner.handle.path)]
738
+ }
739
+ });
740
+ }
741
+ }
742
+ async #closeFile(owner) {
743
+ await owner.close();
744
+ this.#files.delete(owner);
745
+ }
746
+ provenance() {
747
+ return [];
748
+ }
749
+ };
750
+ unsupportedEntryKind = (metadata) => metadata.isFIFO() ? "fifo" : metadata.isSocket() ? "socket" : metadata.isBlockDevice() ? "block-device" : metadata.isCharacterDevice() ? "character-device" : "unsupported";
751
+ artifactEntry = (path, absolute, metadata) => {
752
+ const kind = metadata.isSymbolicLink() ? "symlink" : metadata.isDirectory() ? "directory" : metadata.isFile() ? "file" : undefined;
753
+ if (kind === undefined) return undefined;
754
+ return {
755
+ path,
756
+ kind,
757
+ declaredSize: kind === "file" ? safeArtifactSize(metadata.size) : null,
758
+ compressedSize: null,
759
+ executable: hostExecutableMarking(absolute, metadata),
760
+ encrypted: false,
761
+ byteOffset: null,
762
+ declaredSha256: null,
763
+ unpacked: false,
764
+ limitations: kind === "symlink" ? ["Symlink target was not followed or disclosed."] : [],
765
+ adapterKey: absolute,
766
+ ...kind === "file" ? { sourceIdentity: {
767
+ device: metadata.dev,
768
+ inode: metadata.ino,
769
+ size: metadata.size,
770
+ mode: metadata.mode,
771
+ mtimeNs: metadata.mtimeNs,
772
+ ctimeNs: metadata.ctimeNs
773
+ } } : {}
774
+ };
775
+ };
776
+ safeArtifactSize = (size) => {
777
+ if (size < 0n || size > BigInt(Number.MAX_SAFE_INTEGER)) return null;
778
+ return Number(size);
779
+ };
780
+ directoryIoFailure = (operation, path, cause) => {
781
+ if (cause instanceof ArtifactReaderFailure) return cause;
782
+ const code = typeof cause === "object" && cause !== null && "code" in cause && typeof cause.code === "string" ? ` (${cause.code})` : "";
783
+ const detail = failureMessage$1(cause);
784
+ return new ArtifactReaderFailure("io", `Could not ${operation} at ${path}${code}: ${detail}`, { cause });
785
+ };
786
+ failureMessage$1 = (cause) => cause instanceof Error ? cause.message : String(cause);
787
+ mapStableFileRead = async function* (handle, entry, signal) {
788
+ let bytes = 0n;
789
+ try {
790
+ const expectedBytes = entry.sourceIdentity?.size;
791
+ if (expectedBytes === undefined) throw new ArtifactReaderFailure("integrity", `Directory entry has no captured file state: ${entry.path}`);
792
+ for await (const chunk of readFileHandleChunks(handle, {
793
+ end: expectedBytes,
794
+ signal
795
+ })) {
796
+ abortIfNeeded$1(signal);
797
+ bytes += BigInt(chunk.length);
798
+ yield chunk;
799
+ }
800
+ abortIfNeeded$1(signal);
801
+ const [opened, current] = await Promise.all([handle.stat({ bigint: true }), lstat(entry.adapterKey, { bigint: true })]);
802
+ abortIfNeeded$1(signal);
803
+ if (!opened.isFile() || !current.isFile() || !sameArtifactSourceIdentity(entry.sourceIdentity, opened) || !sameArtifactSourceIdentity(entry.sourceIdentity, current) || bytes !== expectedBytes) throw new ArtifactReaderFailure("integrity", `Directory entry changed during read: ${entry.path}`);
804
+ } catch (cause) {
805
+ if (signal?.aborted === true) throw new ArtifactReaderFailure("cancelled", "Directory artifact read cancelled", { cause });
806
+ if (cause instanceof Error && "code" in cause && [
807
+ "ENOENT",
808
+ "ENOTDIR",
809
+ "ELOOP"
810
+ ].includes(String(cause.code))) throw new ArtifactReaderFailure("integrity", `Directory entry changed during read: ${entry.path}`, { cause });
811
+ if (!(cause instanceof ArtifactReaderFailure)) throw directoryIoFailure("validate read entry", entry.adapterKey, cause);
812
+ throw cause;
813
+ }
814
+ };
815
+ withDirectoryIoContext = async (operation, path, action) => {
816
+ try {
817
+ return await action();
818
+ } catch (cause) {
819
+ throw directoryIoFailure(operation, path, cause);
820
+ }
821
+ };
822
+ abortIfNeeded$1 = (signal) => {
823
+ if (signal?.aborted === true) throw new ArtifactReaderFailure("cancelled", "Artifact traversal cancelled");
824
+ };
825
+ assertContainedDirectory = async (root, directory, rootIdentity) => {
826
+ const canonical = await realpath(directory);
827
+ const fromRoot = relative(root, canonical);
828
+ const metadata = await lstat(directory);
829
+ const currentRoot = await lstat(root, { bigint: true });
830
+ if (rootIdentity === undefined || currentRoot.dev !== rootIdentity.dev || currentRoot.ino !== rootIdentity.ino || metadata.isSymbolicLink() || !metadata.isDirectory() || fromRoot === ".." || fromRoot.startsWith(`..${sep}`) || isAbsolute(fromRoot)) throw new ArtifactReaderFailure("path", "Directory traversal escaped or changed its artifact root");
831
+ };
832
+ })))();
833
+ }
834
+
835
+ //#endregion
836
+ //#region dist/artifacts/ArtifactHash.js
837
+ var ARTIFACT_CLASSIFICATION_PREFIX_BYTES, abortIfNeeded, hashReadable;
838
+ function init_ArtifactHash() {
839
+ return (init_ArtifactHash = __esmMin((() => {
840
+ init_ArtifactReader();
841
+ init_StreamBytes();
842
+ init_appleArchiveFormat();
843
+ ARTIFACT_CLASSIFICATION_PREFIX_BYTES = 8192;
844
+ abortIfNeeded = (signal) => {
845
+ if (signal?.aborted === true) throw new ArtifactReaderFailure("cancelled", "Artifact inventory cancelled");
846
+ };
847
+ hashReadable = async (stream, signal) => {
848
+ const hash = createHash("sha256");
849
+ const prefixes = [];
850
+ let prefixBytes = 0;
851
+ const xmlProbe = createXmlPlistSignatureProbe();
852
+ let bytes = 0;
853
+ for await (const raw of stream) {
854
+ abortIfNeeded(signal);
855
+ const chunk = streamChunkToBuffer(raw);
856
+ bytes += chunk.length;
857
+ hash.update(chunk);
858
+ let chunkOffset = 0;
859
+ while (chunkOffset < chunk.length && (prefixBytes < 8192 || xmlProbe.state === "pending" && prefixBytes < 1048576)) {
860
+ const limit = prefixBytes < 8192 ? ARTIFACT_CLASSIFICATION_PREFIX_BYTES : MAX_XML_PLIST_PROBE_BYTES;
861
+ const selected = chunk.subarray(chunkOffset, Math.min(chunkOffset + limit - prefixBytes, chunk.length));
862
+ prefixes.push(selected);
863
+ prefixBytes += selected.length;
864
+ chunkOffset += selected.length;
865
+ xmlProbe.write(selected);
866
+ }
867
+ }
868
+ return {
869
+ sha256: hash.digest("hex"),
870
+ bytes,
871
+ prefix: Buffer.concat(prefixes)
872
+ };
873
+ };
874
+ })))();
875
+ }
876
+
877
+ //#endregion
878
+ //#region dist/domain/javascript/javascriptArtifactFiles.js
879
+ var isJavaScriptSourcePath;
880
+ function init_javascriptArtifactFiles() {
881
+ return (init_javascriptArtifactFiles = __esmMin((() => {
882
+ isJavaScriptSourcePath = (path) => /\.(?:cjs|cts|mjs|mts|js|jsx|ts|tsx)$/iu.test(path);
883
+ })))();
884
+ }
885
+
886
+ //#endregion
887
+ //#region dist/artifacts/inventory/ArtifactGraphConstruction.js
888
+ var indexOccurrencesByPath, createOccurrence, noteUnreadContainerSuffix, containerSuffixFamily, materializeDirectoryNodes, createRootNode, createArtifactNode, rootOccurrenceFor, rekeyOccurrences, createArtifactEdges, resolveOccurrenceParents, classifyArtifactPath, classifyArtifactContent, hasAsarHeader, artifactRoleForFormat, classifyArtifactBytes, classifyFatArtifact, relationFor, depth;
889
+ function init_ArtifactGraphConstruction() {
890
+ return (init_ArtifactGraphConstruction = __esmMin((() => {
891
+ init_unicodeCodePointOrder();
892
+ init_javascriptArtifactFiles();
893
+ init_canonicalDigest();
894
+ init_appleArchiveFormat();
895
+ init_artifactIdentity();
896
+ init_zipPackageFormat();
897
+ init_dosMz();
898
+ init_machoContainer();
899
+ indexOccurrencesByPath = (occurrences) => {
900
+ const byPath = new Map();
901
+ for (const occurrence of occurrences) {
902
+ const matches = byPath.get(occurrence.logical_path);
903
+ if (matches === undefined) byPath.set(occurrence.logical_path, [occurrence]);
904
+ else matches.push(occurrence);
905
+ }
906
+ return byPath;
907
+ };
908
+ createOccurrence = (entry, path, parent, duplicateOrdinal = 0) => {
909
+ const role = entry.kind === "directory" ? {
910
+ kind: path.toLowerCase().endsWith(".framework") ? "framework" : "container",
911
+ format: "directory"
912
+ } : containerSuffixFamily(path) === undefined ? classifyArtifactPath(path) : {
913
+ kind: "unknown",
914
+ format: "unknown"
915
+ };
916
+ return {
917
+ occurrence_id: `occ_${digestCanonicalValue(duplicateOrdinal === 0 ? {
918
+ path,
919
+ kind: entry.kind
920
+ } : {
921
+ path,
922
+ kind: entry.kind,
923
+ duplicate_ordinal: duplicateOrdinal
924
+ }, "Artifact")}`,
925
+ artifact_id: null,
926
+ parent_occurrence_id: parent,
927
+ logical_path: path,
928
+ entry_kind: entry.kind,
929
+ artifact_kind: role.kind,
930
+ artifact_format: role.format,
931
+ declared_size: entry.declaredSize,
932
+ compressed_size: entry.compressedSize,
933
+ executable: entry.executable,
934
+ encrypted: entry.encrypted,
935
+ hash_status: entry.encrypted ? "unavailable" : "not-hashed",
936
+ source_location: entry.byteOffset === null || entry.declaredSize === null ? null : {
937
+ offset: entry.byteOffset,
938
+ length: entry.declaredSize
939
+ },
940
+ limitations: [...entry.limitations]
941
+ };
942
+ };
943
+ noteUnreadContainerSuffix = (occurrence) => {
944
+ if (occurrence.entry_kind === "directory") return;
945
+ const family = containerSuffixFamily(occurrence.logical_path);
946
+ if (family === undefined) return;
947
+ occurrence.limitations.push(`The path suffix suggests ${family.toUpperCase()}, but these bytes were not read, so the container family is unknown.`);
948
+ };
949
+ containerSuffixFamily = (path) => {
950
+ const lower = path.toLowerCase();
951
+ return lower.endsWith(".asar") ? "asar" : zipPackageFormatForPath(lower);
952
+ };
953
+ materializeDirectoryNodes = (occurrences, nodes) => {
954
+ const directories = occurrences.filter(({ entry_kind: kind, hash_status }) => kind === "directory" && hash_status !== "unavailable").sort((left, right) => depth(right.logical_path) - depth(left.logical_path));
955
+ const childrenByParent = new Map();
956
+ for (const occurrence of occurrences) {
957
+ if (occurrence.parent_occurrence_id === null) continue;
958
+ const children = childrenByParent.get(occurrence.parent_occurrence_id);
959
+ if (children === undefined) childrenByParent.set(occurrence.parent_occurrence_id, [occurrence]);
960
+ else children.push(occurrence);
961
+ }
962
+ for (const directory of directories) {
963
+ const children = (childrenByParent.get(directory.occurrence_id) ?? []).map(({ logical_path, artifact_id, entry_kind }) => ({
964
+ name: logical_path.slice(directory.logical_path.length + 1),
965
+ artifact_id,
966
+ entry_kind
967
+ })).sort((left, right) => compareUnicodeCodePoints(left.name, right.name));
968
+ const node = createArtifactNode({
969
+ sha256: digestCanonicalValue({
970
+ kind: "directory",
971
+ children
972
+ }, "Artifact"),
973
+ size: 0,
974
+ format: "directory",
975
+ contentState: "virtual"
976
+ });
977
+ nodes.set(node.artifact_id, node);
978
+ directory.artifact_id = node.artifact_id;
979
+ directory.hash_status = "verified";
980
+ }
981
+ };
982
+ createRootNode = (input) => createArtifactNode({
983
+ sha256: input.digest?.sha256 ?? digestCanonicalValue({
984
+ kind: "directory-root",
985
+ children: input.occurrences.map(({ logical_path, artifact_id }) => ({
986
+ logical_path,
987
+ artifact_id
988
+ })).sort((left, right) => compareUnicodeCodePoints(left.logical_path, right.logical_path))
989
+ }, "Artifact"),
990
+ size: input.digest?.bytes ?? 0,
991
+ format: input.digest === null ? "directory" : classifyArtifactBytes(input.digest.prefix, input.digest.bytes),
992
+ contentState: "materialized"
993
+ });
994
+ createArtifactNode = (input) => ({
995
+ artifact_id: artifactIdForContent(input.sha256),
996
+ format: input.format,
997
+ sha256: input.sha256,
998
+ size: input.size,
999
+ media_type: null,
1000
+ architecture: null,
1001
+ content_state: input.contentState,
1002
+ limitations: []
1003
+ });
1004
+ rootOccurrenceFor = (node, metadata) => ({
1005
+ occurrence_id: occurrenceIdForLocation({
1006
+ rootArtifactId: node.artifact_id,
1007
+ logicalPath: ".",
1008
+ entryKind: metadata.format === "directory" ? "directory" : "file"
1009
+ }),
1010
+ artifact_id: node.artifact_id,
1011
+ parent_occurrence_id: null,
1012
+ logical_path: ".",
1013
+ entry_kind: metadata.format === "directory" ? "directory" : "file",
1014
+ artifact_kind: metadata.format === "directory" || isZipPackageFormat(metadata.format) || [
1015
+ "asar",
1016
+ "dmg",
1017
+ "pkg"
1018
+ ].includes(metadata.format) ? "container" : artifactRoleForFormat(metadata.path, metadata.format).kind,
1019
+ artifact_format: metadata.format,
1020
+ declared_size: metadata.size,
1021
+ compressed_size: null,
1022
+ executable: metadata.executable,
1023
+ encrypted: false,
1024
+ hash_status: "verified",
1025
+ source_location: null,
1026
+ limitations: []
1027
+ });
1028
+ rekeyOccurrences = (rootArtifactId, occurrences) => {
1029
+ const replacements = new Map();
1030
+ const ordinalByPath = new Map();
1031
+ for (const occurrence of occurrences) {
1032
+ const ordinal = ordinalByPath.get(occurrence.logical_path) ?? 0;
1033
+ ordinalByPath.set(occurrence.logical_path, ordinal + 1);
1034
+ replacements.set(occurrence.occurrence_id, occurrenceIdForLocation({
1035
+ rootArtifactId,
1036
+ logicalPath: occurrence.logical_path,
1037
+ entryKind: occurrence.entry_kind,
1038
+ ...ordinal === 0 ? {} : { duplicateOrdinal: ordinal }
1039
+ }));
1040
+ }
1041
+ for (const occurrence of occurrences) {
1042
+ occurrence.occurrence_id = replacements.get(occurrence.occurrence_id) ?? occurrence.occurrence_id;
1043
+ if (occurrence.parent_occurrence_id !== null) occurrence.parent_occurrence_id = replacements.get(occurrence.parent_occurrence_id) ?? occurrence.parent_occurrence_id;
1044
+ }
1045
+ };
1046
+ createArtifactEdges = (rootArtifactId, occurrences, producer) => {
1047
+ const byId = new Map(occurrences.map((item) => [item.occurrence_id, item]));
1048
+ const byPath = indexOccurrencesByPath(occurrences);
1049
+ const edges = [];
1050
+ const limitations = [];
1051
+ for (const occurrence of occurrences) {
1052
+ const isSourceMap = occurrence.logical_path.toLowerCase().endsWith(".map");
1053
+ const sourcePath = isSourceMap ? occurrence.logical_path.slice(0, -".map".length) : undefined;
1054
+ const sourceCandidates = sourcePath === undefined ? [] : byPath.get(sourcePath) ?? [];
1055
+ const mappedSource = sourceCandidates.length === 1 && sourceCandidates[0]?.artifact_id !== null ? sourceCandidates[0] : undefined;
1056
+ if (sourcePath !== undefined) {
1057
+ const unknownMapping = sourceCandidates.length > 1 ? {
1058
+ occurrence: `Source-map target is unknown because multiple occurrences share ${JSON.stringify(sourcePath)}.`,
1059
+ coverage: `Source-map relationships are unknown because multiple occurrences share ${JSON.stringify(sourcePath)}.`
1060
+ } : sourceCandidates.length === 1 && mappedSource === undefined ? {
1061
+ occurrence: `Source-map target identity is unknown because the matching occurrence at ${JSON.stringify(sourcePath)} has no content identity.`,
1062
+ coverage: `Source-map relationships are unknown because the matching occurrence at ${JSON.stringify(sourcePath)} has no content identity.`
1063
+ } : undefined;
1064
+ if (unknownMapping !== undefined) {
1065
+ occurrence.limitations.push(unknownMapping.occurrence);
1066
+ limitations.push(unknownMapping.coverage);
1067
+ }
1068
+ }
1069
+ if (occurrence.parent_occurrence_id === null || occurrence.artifact_id === null) continue;
1070
+ const parentArtifactId = mappedSource?.artifact_id ?? byId.get(occurrence.parent_occurrence_id)?.artifact_id ?? rootArtifactId;
1071
+ const semantic = {
1072
+ parent_artifact_id: parentArtifactId,
1073
+ relation: occurrence.entry_kind === "slice" ? "slice-of" : isSourceMap && mappedSource === undefined ? "contains" : relationFor(occurrence.logical_path),
1074
+ occurrence_id: occurrence.occurrence_id
1075
+ };
1076
+ edges.push({
1077
+ edge_id: artifactEdgeId(semantic, occurrence),
1078
+ ...semantic,
1079
+ producer: occurrence.entry_kind === "slice" ? producer ?? null : null,
1080
+ ordinal: edges.length
1081
+ });
1082
+ }
1083
+ return {
1084
+ edges,
1085
+ limitations
1086
+ };
1087
+ };
1088
+ resolveOccurrenceParents = (occurrences, byPath, expandedContainerIds) => {
1089
+ const root = { children: new Map() };
1090
+ for (const matches of byPath.values()) {
1091
+ const parents = matches.filter((occurrence) => occurrence.entry_kind === "directory" || expandedContainerIds.has(occurrence.occurrence_id));
1092
+ if (parents.length === 0) continue;
1093
+ if (parents.length > 1) {
1094
+ for (const parent of parents) if (parent.entry_kind === "directory") {
1095
+ parent.artifact_id = null;
1096
+ parent.hash_status = "unavailable";
1097
+ parent.limitations.push("This directory occurrence cannot be materialized because multiple directory entries share its logical path.");
1098
+ }
1099
+ }
1100
+ const path = matches[0]?.logical_path;
1101
+ if (path === undefined) continue;
1102
+ let branch = root;
1103
+ for (const segment of path.split("/")) {
1104
+ let child = branch.children.get(segment);
1105
+ if (child === undefined) {
1106
+ child = { children: new Map() };
1107
+ branch.children.set(segment, child);
1108
+ }
1109
+ branch = child;
1110
+ }
1111
+ branch.occurrences = parents;
1112
+ }
1113
+ const limitations = new Set();
1114
+ const unknownParentOccurrences = new Set();
1115
+ for (const occurrence of occurrences) {
1116
+ const path = occurrence.logical_path;
1117
+ let branch = root;
1118
+ let parent;
1119
+ let ambiguousParentPath;
1120
+ let prefix = "";
1121
+ for (let start = 0;;) {
1122
+ const slash = path.indexOf("/", start);
1123
+ if (slash < 0) break;
1124
+ const segment = path.slice(start, slash);
1125
+ const child = branch.children.get(segment);
1126
+ if (child === undefined) break;
1127
+ branch = child;
1128
+ prefix = prefix.length === 0 ? segment : `${prefix}/${segment}`;
1129
+ const candidates = branch.occurrences ?? [];
1130
+ if (candidates.length === 1) {
1131
+ parent = candidates[0];
1132
+ ambiguousParentPath = undefined;
1133
+ } else if (candidates.length > 1) {
1134
+ parent = undefined;
1135
+ ambiguousParentPath = prefix;
1136
+ }
1137
+ start = slash + 1;
1138
+ }
1139
+ occurrence.parent_occurrence_id = parent?.occurrence_id ?? null;
1140
+ if (ambiguousParentPath !== undefined) {
1141
+ const limitation = `The parent occurrence for ${JSON.stringify(path)} is unknown because multiple observed directory or container occurrences share ${JSON.stringify(ambiguousParentPath)}.`;
1142
+ occurrence.limitations.push(limitation);
1143
+ limitations.add(limitation);
1144
+ unknownParentOccurrences.add(occurrence);
1145
+ }
1146
+ }
1147
+ return {
1148
+ limitations: [...limitations].sort(compareUnicodeCodePoints),
1149
+ unknownParentOccurrences
1150
+ };
1151
+ };
1152
+ classifyArtifactPath = (path) => {
1153
+ const lower = path.toLowerCase();
1154
+ if (lower.endsWith(".map")) return {
1155
+ kind: "source-map",
1156
+ format: "source-map"
1157
+ };
1158
+ if (isJavaScriptSourcePath(path)) return {
1159
+ kind: "javascript",
1160
+ format: "javascript-bundle"
1161
+ };
1162
+ if (/\.framework(?:\/|$)/u.test(lower)) return {
1163
+ kind: "framework",
1164
+ format: "file"
1165
+ };
1166
+ if (/\.(?:node|dylib|so)$/u.test(lower)) return {
1167
+ kind: lower.endsWith(".node") ? "native-addon" : "dynamic-library",
1168
+ format: "file"
1169
+ };
1170
+ if (lower.endsWith(".plist")) return {
1171
+ kind: "plist",
1172
+ format: "plist"
1173
+ };
1174
+ if (lower.endsWith(".entitlements")) return {
1175
+ kind: "entitlements",
1176
+ format: "entitlements"
1177
+ };
1178
+ return {
1179
+ kind: "resource",
1180
+ format: "file"
1181
+ };
1182
+ };
1183
+ classifyArtifactContent = (path, prefix, fileSize = prefix.length) => {
1184
+ const format = classifyArtifactBytes(prefix, fileSize);
1185
+ const byPath = classifyArtifactPath(path);
1186
+ if (format === "plist" && !hasBinaryPlistSignature(prefix) && ([
1187
+ "javascript",
1188
+ "source-map",
1189
+ "entitlements"
1190
+ ].includes(byPath.kind) || path.toLowerCase().endsWith(".asar"))) return byPath;
1191
+ if (format === "file" && path.toLowerCase().endsWith(".asar") && hasAsarHeader(prefix)) return {
1192
+ kind: "container",
1193
+ format: "asar"
1194
+ };
1195
+ return artifactRoleForFormat(path, format);
1196
+ };
1197
+ hasAsarHeader = (prefix) => {
1198
+ if (prefix.length < 17 || prefix.readUInt32LE(0) !== 4) return false;
1199
+ const headerSize = prefix.readUInt32LE(4);
1200
+ const payloadSize = prefix.readUInt32LE(8);
1201
+ if (headerSize < 16 || payloadSize !== headerSize - 4) return false;
1202
+ const stringLength = prefix.readUInt32LE(12);
1203
+ return stringLength >= 2 && stringLength <= payloadSize - 4 && prefix[16] === 123;
1204
+ };
1205
+ artifactRoleForFormat = (path, format) => {
1206
+ const byPath = classifyArtifactPath(path);
1207
+ if (format === "file" || format === byPath.format) return byPath;
1208
+ if (format === "unknown") return {
1209
+ kind: "unknown",
1210
+ format
1211
+ };
1212
+ if (format === "zip") return {
1213
+ kind: "container",
1214
+ format: zipPackageFormatForPath(path) ?? format
1215
+ };
1216
+ if (format === "plist") return {
1217
+ kind: "plist",
1218
+ format
1219
+ };
1220
+ return {
1221
+ kind: ["native-addon", "dynamic-library"].includes(byPath.kind) ? byPath.kind : "executable",
1222
+ format
1223
+ };
1224
+ };
1225
+ classifyArtifactBytes = (prefix, fileSize = prefix.length) => {
1226
+ if (hasZipSignature(prefix)) return "zip";
1227
+ if (hasBinaryPlistSignature(prefix)) return "plist";
1228
+ if (hasXmlPlistSignature(prefix)) return "plist";
1229
+ const fatFormat = classifyFatArtifact(prefix, fileSize);
1230
+ if (fatFormat !== null) return fatFormat;
1231
+ if (prefix.length >= 4) {
1232
+ const magic = prefix.readUInt32BE(0);
1233
+ if ([
1234
+ 4277009102,
1235
+ 4277009103,
1236
+ 3472551422,
1237
+ 3489328638
1238
+ ].includes(magic)) return "mach-o";
1239
+ if (prefix.subarray(0, 4).equals(Buffer.from([
1240
+ 127,
1241
+ 69,
1242
+ 76,
1243
+ 70
1244
+ ]))) return "elf";
1245
+ }
1246
+ if (prefix.length >= 2 && prefix[0] === 77 && prefix[1] === 90) {
1247
+ if (!Number.isSafeInteger(fileSize) || fileSize < prefix.length || prefix.length < Math.min(fileSize, 64)) return "unknown";
1248
+ const windowsHeader = observeMzWindowsHeader(prefix, fileSize);
1249
+ if (windowsHeader.state === "signature-needed") return "unknown";
1250
+ if (windowsHeader.state === "declared") {
1251
+ const windowsOffset = windowsHeader.offset;
1252
+ if (windowsHeader.signature === "PE" && windowsOffset >= 64 && windowsOffset <= prefix.length - 4) return "pe";
1253
+ return "unknown";
1254
+ }
1255
+ if (parseDosMzHeader(prefix, fileSize).ok) return "dos-mz";
1256
+ return "unknown";
1257
+ }
1258
+ return "file";
1259
+ };
1260
+ classifyFatArtifact = (prefix, fileSize) => {
1261
+ const fatHeader = readFatContainerHeader(prefix, fileSize);
1262
+ if (fatHeader.state === "needs-data" || fatHeader.state === "malformed") return "unknown";
1263
+ if (fatHeader.state === "not-fat") return null;
1264
+ const identity = classifyFatContainerIdentity(fatHeader, (offset) => {
1265
+ if (offset >= prefix.length) return undefined;
1266
+ if (offset + 4 > prefix.length) return null;
1267
+ return prefix.readUInt32BE(offset);
1268
+ });
1269
+ return identity.state === "mach-o" ? "mach-o-universal" : "unknown";
1270
+ };
1271
+ relationFor = (path) => {
1272
+ const lower = path.toLowerCase();
1273
+ if (lower.endsWith(".map")) return "maps-source";
1274
+ if (lower.includes(".framework/")) return "embeds";
1275
+ return "contains";
1276
+ };
1277
+ depth = (path) => path.split("/").length;
1278
+ })))();
1279
+ }
1280
+
1281
+ //#endregion
1282
+ //#region dist/artifacts/inventory/hashStableRootArtifact.js
1283
+ var openRootArtifact, hashStableRootArtifact, hashStableRootArtifactHandle;
1284
+ function init_hashStableRootArtifact() {
1285
+ return (init_hashStableRootArtifact = __esmMin((() => {
1286
+ init_readFileHandleChunks();
1287
+ init_OwnedFileHandle();
1288
+ init_ArtifactReader();
1289
+ init_RegularFile();
1290
+ init_ArtifactHash();
1291
+ openRootArtifact = async (path, resourceScope, signal) => {
1292
+ try {
1293
+ return new OwnedFileHandle(await openRegularFile(path, {
1294
+ symlinks: "reject",
1295
+ signal
1296
+ }));
1297
+ } catch (cause) {
1298
+ const primary = cause instanceof RegularFileAdmissionFailure ? cause.cause : cause;
1299
+ const failure = primary instanceof NonRegularFileReadError ? new ArtifactReaderFailure("format", `Artifact root is not a regular file: ${path}`, { cause: primary }) : primary;
1300
+ if (cause instanceof RegularFileAdmissionFailure) {
1301
+ const resource = `root artifact descriptor for ${path}`;
1302
+ const cleanup = await resourceScope.release({
1303
+ kind: "file-handle",
1304
+ resource,
1305
+ handle: cause.owner
1306
+ });
1307
+ if (cleanup.kind === "failed") throw ArtifactReaderFailure.withCleanup(failure, ArtifactReaderFailure.cleanupObservation(cleanup.cause, resource));
1308
+ }
1309
+ throw failure;
1310
+ }
1311
+ };
1312
+ hashStableRootArtifact = async (path, resourceScope, signal) => {
1313
+ const owner = await openRootArtifact(path, resourceScope, signal);
1314
+ const handle = owner.handle;
1315
+ let outcome;
1316
+ try {
1317
+ const initial = await handle.stat();
1318
+ outcome = {
1319
+ kind: "completed",
1320
+ value: await hashStableRootArtifactHandle(path, handle, initial, signal)
1321
+ };
1322
+ } catch (cause) {
1323
+ outcome = {
1324
+ kind: "failed",
1325
+ cause
1326
+ };
1327
+ }
1328
+ const resource = `root artifact descriptor for ${path}`;
1329
+ const cleanup = await resourceScope.release({
1330
+ kind: "file-handle",
1331
+ resource,
1332
+ handle: owner
1333
+ });
1334
+ if (cleanup.kind === "failed") throw ArtifactReaderFailure.withCleanup(outcome.kind === "failed" ? outcome.cause : cleanup.cause, ArtifactReaderFailure.cleanupObservation(cleanup.cause, resource));
1335
+ if (outcome.kind === "failed") throw outcome.cause;
1336
+ return outcome.value;
1337
+ };
1338
+ hashStableRootArtifactHandle = async (path, handle, initial, signal) => {
1339
+ const digest = await hashReadable(readFileHandleChunks(handle, {
1340
+ start: 0,
1341
+ end: initial.size
1342
+ }), signal);
1343
+ abortIfNeeded(signal);
1344
+ const [opened, currentPath] = await Promise.all([handle.stat(), lstat(path)]);
1345
+ if (!sameRegularFileState(initial, opened) || !sameRegularFileState(initial, currentPath) || digest.bytes !== initial.size) throw new ArtifactReaderFailure("integrity", `Root artifact changed during inventory: ${path}`);
1346
+ return digest;
1347
+ };
1348
+ })))();
1349
+ }
1350
+
1351
+ //#endregion
1352
+ //#region dist/artifacts/inventory/classify.js
1353
+ var classifyAndHashRoot, classifyAndHashRootForInventory, classifyRootFormat, zipRootPackageFormat, hasKolyTrailer;
1354
+ function init_classify() {
1355
+ return (init_classify = __esmMin((() => {
1356
+ init_RegularFile();
1357
+ init_ArtifactGraphConstruction();
1358
+ init_ArtifactHash();
1359
+ init_appleArchiveFormat();
1360
+ init_zipPackageFormat();
1361
+ init_ArtifactReader();
1362
+ init_hashStableRootArtifact();
1363
+ classifyAndHashRoot = async (path, directory, expectedMetadata, options) => {
1364
+ return options.resourceScope.run(async () => {
1365
+ const result = await classifyAndHashRootForInventory(path, directory, expectedMetadata, options);
1366
+ const rootSource = result.rootSource;
1367
+ if (rootSource !== undefined) {
1368
+ const owner = {
1369
+ kind: "file-handle",
1370
+ handle: rootSource.owner,
1371
+ resource: `root artifact descriptor for ${path}`
1372
+ };
1373
+ const cleanupAttempt = await options.resourceScope.release(owner);
1374
+ if (cleanupAttempt.kind === "failed") throw ArtifactReaderFailure.withCleanup(cleanupAttempt.cause, ArtifactReaderFailure.cleanupObservation(cleanupAttempt.cause, owner.resource));
1375
+ }
1376
+ return {
1377
+ format: result.format,
1378
+ digest: result.digest
1379
+ };
1380
+ });
1381
+ };
1382
+ classifyAndHashRootForInventory = async (path, directory, expectedMetadata, options) => {
1383
+ if (directory) return {
1384
+ format: "directory",
1385
+ digest: null,
1386
+ rootSource: undefined
1387
+ };
1388
+ const ownedHandle = await openRootArtifact(path, options.resourceScope, options.signal);
1389
+ const handle = ownedHandle.handle;
1390
+ const owner = {
1391
+ kind: "file-handle",
1392
+ handle: ownedHandle,
1393
+ resource: `root artifact descriptor for ${path}`
1394
+ };
1395
+ let outcome;
1396
+ try {
1397
+ const initial = await handle.stat();
1398
+ if (!sameRegularFileState(expectedMetadata, initial)) throw new ArtifactReaderFailure("integrity", `Root artifact changed before inventory: ${path}`);
1399
+ const format = await classifyRootFormat(path, handle, options.signal);
1400
+ const digest = await hashStableRootArtifactHandle(path, handle, initial, options.signal);
1401
+ const retainSource = isZipPackageFormat(format) || format === "mach-o-universal";
1402
+ outcome = {
1403
+ kind: "completed",
1404
+ value: {
1405
+ format,
1406
+ digest,
1407
+ rootSource: retainSource ? {
1408
+ handle,
1409
+ initial,
1410
+ owner: ownedHandle
1411
+ } : undefined
1412
+ }
1413
+ };
1414
+ } catch (cause) {
1415
+ outcome = {
1416
+ kind: "failed",
1417
+ cause
1418
+ };
1419
+ }
1420
+ if (outcome.kind === "failed" || outcome.value.rootSource === undefined) {
1421
+ const cleanupAttempt = await options.resourceScope.release(owner);
1422
+ if (cleanupAttempt.kind === "failed") throw ArtifactReaderFailure.withCleanup(outcome.kind === "failed" ? outcome.cause : cleanupAttempt.cause, ArtifactReaderFailure.cleanupObservation(cleanupAttempt.cause, owner.resource));
1423
+ }
1424
+ if (outcome.kind === "failed") throw outcome.cause;
1425
+ return outcome.value;
1426
+ };
1427
+ classifyRootFormat = async (path, handle, signal) => {
1428
+ const magic = Buffer.alloc(ARTIFACT_CLASSIFICATION_PREFIX_BYTES);
1429
+ const observed = await handle.read(magic, 0, magic.length, 0);
1430
+ let prefix = magic.subarray(0, observed.bytesRead);
1431
+ const lower = path.toLowerCase();
1432
+ if (hasZipSignature(prefix)) return zipRootPackageFormat(lower);
1433
+ if (lower.endsWith(".pkg") && prefix.subarray(0, 4).equals(Buffer.from("xar!"))) return "pkg";
1434
+ if (lower.endsWith(".dmg") && await hasKolyTrailer(handle)) return "dmg";
1435
+ const xmlProbe = createXmlPlistSignatureProbe();
1436
+ xmlProbe.write(prefix);
1437
+ const chunks = [prefix];
1438
+ let prefixBytes = prefix.length;
1439
+ while (xmlProbe.state === "pending" && prefixBytes < 1048576) {
1440
+ abortIfNeeded(signal);
1441
+ const chunk = Buffer.alloc(Math.min(64 * 1024, MAX_XML_PLIST_PROBE_BYTES - prefixBytes));
1442
+ const read = await handle.read(chunk, 0, chunk.length, prefixBytes);
1443
+ abortIfNeeded(signal);
1444
+ if (read.bytesRead === 0) break;
1445
+ const selected = chunk.subarray(0, read.bytesRead);
1446
+ chunks.push(selected);
1447
+ prefixBytes += selected.length;
1448
+ xmlProbe.write(selected);
1449
+ }
1450
+ prefix = Buffer.concat(chunks);
1451
+ return classifyArtifactContent(path, prefix, (await handle.stat()).size).format;
1452
+ };
1453
+ zipRootPackageFormat = (lower) => lower.endsWith(".app") ? "app-pack" : zipPackageFormatForPath(lower) ?? "zip";
1454
+ hasKolyTrailer = async (handle) => {
1455
+ const size = (await handle.stat()).size;
1456
+ if (size < 512) return false;
1457
+ const trailer = Buffer.alloc(4);
1458
+ const read = await handle.read(trailer, 0, trailer.length, size - 512);
1459
+ return read.bytesRead === 4 && trailer.equals(Buffer.from("koly"));
1460
+ };
1461
+ })))();
1462
+ }
1463
+
1464
+ //#endregion
1465
+ //#region dist/artifacts/MachOSliceArtifactReader.js
1466
+ var MachOSliceArtifactReader, readStructuralSlices, lipoMatchesSlice, lipoSubtypeMatches, lipoNameMatches;
1467
+ function init_MachOSliceArtifactReader() {
1468
+ return (init_MachOSliceArtifactReader = __esmMin((() => {
1469
+ init_CommandRunner();
1470
+ init_lipo();
1471
+ init_machoCpuIdentity();
1472
+ init_OwnedFileHandle();
1473
+ init_MachoLoadCommandReader();
1474
+ init_ArtifactReader();
1475
+ init_StreamBytes();
1476
+ init_RegularFile();
1477
+ init_readFileHandleChunks();
1478
+ MachOSliceArtifactReader = class {
1479
+ path;
1480
+ runner;
1481
+ format = "file";
1482
+ #command;
1483
+ #source;
1484
+ #ownedSource;
1485
+ #pendingSource;
1486
+ #entries = new Map();
1487
+ #pendingCommands = new Set();
1488
+ #ownsSource;
1489
+ #closed = false;
1490
+ #closePromise;
1491
+ constructor(path, environment, runner = new XcrunCommandRunner(environment), source) {
1492
+ this.path = path;
1493
+ this.runner = runner;
1494
+ this.#source = source;
1495
+ this.#ownsSource = source === undefined;
1496
+ }
1497
+ async *entries(signal) {
1498
+ this.#entries.clear();
1499
+ const source = await this.#ensureSource();
1500
+ await this.#verifySource(source);
1501
+ if (this.#closed) throw new ArtifactReaderFailure("unavailable", "Universal Mach-O reader is closed");
1502
+ const command = this.runner.run("lipo", ["-detailed_info", this.path], signal === undefined ? {} : { signal });
1503
+ this.#pendingCommands.add(command);
1504
+ let captured;
1505
+ try {
1506
+ captured = await command;
1507
+ } finally {
1508
+ this.#pendingCommands.delete(command);
1509
+ }
1510
+ if (!captured.ok) throw new ArtifactReaderFailure(captured.error.reason === "cancelled" ? "cancelled" : "unavailable", captured.error.detail === null ? "lipo could not enumerate universal Mach-O slices" : `lipo could not enumerate universal Mach-O slices: ${captured.error.detail}`, {
1511
+ cause: captured.error,
1512
+ ...captured.error.cleanupFailure === null && captured.error.cleanupResources.length === 0 ? {} : { cleanup: {
1513
+ reason: captured.error.cleanupFailure ?? "Native command cleanup remains unverified",
1514
+ resources: [...captured.error.cleanupResources]
1515
+ } }
1516
+ });
1517
+ if (this.#closed) throw new ArtifactReaderFailure("unavailable", "Universal Mach-O reader closed during slice discovery");
1518
+ this.#command = {
1519
+ tool: captured.value.tool,
1520
+ arguments: ["-detailed_info", "$ARTIFACT"],
1521
+ tool_version: captured.value.toolVersion,
1522
+ executable_sha256: captured.value.executableSha256,
1523
+ exit_code: captured.value.exitCode,
1524
+ effects: ["read"]
1525
+ };
1526
+ await this.#verifySource(source);
1527
+ const fileSize = source.initial.size;
1528
+ const { architectures } = parseLipoOutput(captured.value.stdout, this.path);
1529
+ const structural = await readStructuralSlices(source.handle, fileSize);
1530
+ await this.#verifySource(source);
1531
+ if (structural.status === "malformed") throw new ArtifactReaderFailure("integrity", `Mach-O structural slice index is malformed: ${structural.reason}`);
1532
+ if (structural.status === "unsupported" && architectures.some(({ file_offset, size }) => file_offset === null || size === null)) throw new ArtifactReaderFailure("unavailable", `Mach-O structural slice index is unsupported: ${structural.reason}`);
1533
+ const slices = structural.status === "parsed" ? structural.slices : null;
1534
+ const matchingSlices = new Map();
1535
+ if (slices !== null) {
1536
+ if (slices.length !== architectures.length) throw new ArtifactReaderFailure("integrity", "lipo architecture count disagrees with the Mach-O FAT table");
1537
+ const unmatched = [...slices];
1538
+ for (const reported of architectures) {
1539
+ const match = unmatched.findIndex((observed) => lipoMatchesSlice(reported, observed, slices.length === 1));
1540
+ if (match < 0) throw new ArtifactReaderFailure("integrity", `lipo slice metadata disagrees with the Mach-O FAT table: ${reported.name} (cputype=${reported.cpu_type ?? "unknown"}, cpusubtype=${reported.cpu_subtype ?? "unknown"}, offset=${reported.file_offset ?? "unknown"}, size=${reported.size ?? "unknown"}, alignment=${reported.alignment ?? "unknown"})`);
1541
+ const [observed] = unmatched.splice(match, 1);
1542
+ if (observed !== undefined) matchingSlices.set(reported, observed);
1543
+ }
1544
+ }
1545
+ for (const architecture of architectures) {
1546
+ const structuralSlice = matchingSlices.get(architecture);
1547
+ const offset = architecture.file_offset ?? structuralSlice?.slice_offset;
1548
+ const sliceSize = architecture.size ?? structuralSlice?.slice_size;
1549
+ if (offset === undefined || sliceSize === undefined) throw new ArtifactReaderFailure("integrity", "lipo omitted a universal slice byte range");
1550
+ if (!Number.isSafeInteger(offset) || !Number.isSafeInteger(sliceSize) || offset < 0 || sliceSize <= 0 || !Number.isSafeInteger(offset + sliceSize) || offset + sliceSize > fileSize) throw new ArtifactReaderFailure("integrity", `lipo reported an out-of-bounds Mach-O slice: ${architecture.name}`);
1551
+ const entry = {
1552
+ path: `slices/${architecture.name}`,
1553
+ kind: "slice",
1554
+ declaredSize: sliceSize,
1555
+ compressedSize: null,
1556
+ executable: true,
1557
+ encrypted: false,
1558
+ byteOffset: offset,
1559
+ declaredSha256: null,
1560
+ unpacked: false,
1561
+ limitations: [
1562
+ ...structural.status === "not-mach-o" ? ["Structural Mach-O facts were unavailable; slice range is based on lipo output."] : structural.status === "unsupported" ? [`Structural Mach-O facts were unsupported (${structural.reason}); slice range is based on lipo output.`] : [],
1563
+ ...architecture.file_offset === null || architecture.size === null ? ["Slice range was derived from structural Mach-O facts because lipo omitted it."] : [],
1564
+ ...architecture.cpu_type !== null && architecture.cpu_type_code === null ? [`lipo CPU type is retained as unnormalized source text: ${architecture.cpu_type}`] : [],
1565
+ ...architecture.cpu_subtype !== null && architecture.cpu_subtype_code === null ? [`lipo CPU subtype is retained as unnormalized source text: ${architecture.cpu_subtype}${architecture.capabilities === null ? "" : `; capabilities ${architecture.capabilities}`}`] : []
1566
+ ],
1567
+ adapterKey: `${String(offset)}:${String(sliceSize)}`
1568
+ };
1569
+ this.#entries.set(entry.adapterKey, copyArtifactEntry(entry));
1570
+ yield entry;
1571
+ }
1572
+ }
1573
+ async open(entry, signal) {
1574
+ if (signal?.aborted === true) return Promise.reject(new ArtifactReaderFailure("cancelled", "Mach-O slice read cancelled"));
1575
+ const produced = this.#entries.get(entry.adapterKey);
1576
+ if (produced === undefined || !sameArtifactEntry(entry, produced)) throw new ArtifactReaderFailure("integrity", "Mach-O slice entry metadata does not match this reader's inventory");
1577
+ const offset = produced.byteOffset;
1578
+ const size = produced.declaredSize;
1579
+ if (offset === null || size === null || !Number.isSafeInteger(offset) || !Number.isSafeInteger(size) || offset < 0 || size <= 0) throw new ArtifactReaderFailure("integrity", "Invalid Mach-O slice byte range");
1580
+ const source = await this.#ensureSource();
1581
+ await this.#verifySource(source);
1582
+ if (!Number.isSafeInteger(offset + size) || offset + size > source.initial.size) throw new ArtifactReaderFailure("integrity", `Mach-O slice range is outside the artifact: ${entry.path}`);
1583
+ const sourceStream = readFileHandleChunks(source.handle, {
1584
+ start: offset,
1585
+ end: offset + size - 1,
1586
+ ...signal === undefined ? {} : { signal }
1587
+ });
1588
+ const verifySource = () => this.#verifySource(source);
1589
+ return Readable.from((async function* () {
1590
+ let observedBytes = 0;
1591
+ try {
1592
+ for await (const raw of sourceStream) {
1593
+ const chunk = streamChunkToBuffer(raw);
1594
+ observedBytes += chunk.byteLength;
1595
+ if (observedBytes > size) throw new ArtifactReaderFailure("integrity", `Mach-O slice exceeded its reported size: ${entry.path}`);
1596
+ yield chunk;
1597
+ }
1598
+ } catch (cause) {
1599
+ if (cause instanceof ArtifactReaderFailure) throw cause;
1600
+ if (signal?.aborted === true) throw new ArtifactReaderFailure("cancelled", "Mach-O slice read cancelled", { cause });
1601
+ throw new ArtifactReaderFailure("integrity", `Could not read Mach-O slice range: ${entry.path}`, { cause });
1602
+ }
1603
+ if (observedBytes !== size) throw new ArtifactReaderFailure("integrity", `Mach-O slice size disagrees with lipo metadata: ${entry.path}`);
1604
+ await verifySource();
1605
+ })());
1606
+ }
1607
+ provenance() {
1608
+ return this.#command === undefined ? [] : [structuredClone(this.#command)];
1609
+ }
1610
+ async close() {
1611
+ this.#closed = true;
1612
+ this.#closePromise ??= this.#releaseResources().catch((cause) => {
1613
+ this.#closePromise = undefined;
1614
+ throw cause;
1615
+ });
1616
+ return this.#closePromise;
1617
+ }
1618
+ async #releaseResources() {
1619
+ await Promise.allSettled(this.#pendingCommands);
1620
+ let cleanup;
1621
+ try {
1622
+ const failures = await this.runner.retryCleanup?.() ?? [];
1623
+ if (failures.length > 0) cleanup = {
1624
+ reason: failures.map(({ reason, resources }) => `${resources.join(", ")}: ${reason}`).join("; "),
1625
+ resources: [...new Set(failures.flatMap(({ resources }) => resources))]
1626
+ };
1627
+ } catch (cause) {
1628
+ cleanup = ArtifactReaderFailure.cleanupObservation(cause, "native-command-process-cleanup");
1629
+ }
1630
+ try {
1631
+ await this.#closeSource();
1632
+ } catch (cause) {
1633
+ if (cleanup === undefined) throw cause;
1634
+ throw ArtifactReaderFailure.withCleanup(cause, cleanup);
1635
+ }
1636
+ if (cleanup !== undefined) throw new ArtifactReaderFailure("unavailable", "Native command process cleanup remains incomplete", { cleanup });
1637
+ }
1638
+ async #ensureSource() {
1639
+ if (this.#closed) throw new ArtifactReaderFailure("unavailable", "Universal Mach-O reader is closed");
1640
+ if (this.#source !== undefined) return this.#source;
1641
+ this.#pendingSource ??= this.#acquireSource();
1642
+ const source = await this.#pendingSource;
1643
+ if (this.#closed) throw new ArtifactReaderFailure("unavailable", "Universal Mach-O reader closed during source acquisition");
1644
+ return source;
1645
+ }
1646
+ async #acquireSource() {
1647
+ let handle;
1648
+ try {
1649
+ handle = await openRegularFile(this.path, { symlinks: "reject" });
1650
+ } catch (cause) {
1651
+ if (!(cause instanceof RegularFileAdmissionFailure)) throw cause;
1652
+ this.#ownedSource = cause.owner;
1653
+ const primary = cause.cause instanceof NonRegularFileReadError ? new ArtifactReaderFailure("format", `Universal Mach-O source is not a regular file: ${this.path}`, { cause: cause.cause }) : cause.cause;
1654
+ throw ArtifactReaderFailure.withCleanup(primary, ArtifactReaderFailure.cleanupObservation(cause.cleanupCause, this.path));
1655
+ }
1656
+ const owner = new OwnedFileHandle(handle);
1657
+ this.#ownedSource = owner;
1658
+ try {
1659
+ const initial = await handle.stat();
1660
+ const source = {
1661
+ handle,
1662
+ initial
1663
+ };
1664
+ this.#source = source;
1665
+ return source;
1666
+ } catch (cause) {
1667
+ try {
1668
+ await owner.close();
1669
+ this.#ownedSource = undefined;
1670
+ } catch (cleanupCause) {
1671
+ throw ArtifactReaderFailure.withCleanup(cause, ArtifactReaderFailure.cleanupObservation(cleanupCause, this.path));
1672
+ }
1673
+ throw cause;
1674
+ }
1675
+ }
1676
+ async #closeSource() {
1677
+ await this.#pendingSource?.catch(() => undefined);
1678
+ if (!this.#ownsSource || this.#ownedSource === undefined) return;
1679
+ await this.#ownedSource.close();
1680
+ this.#ownedSource = undefined;
1681
+ this.#source = undefined;
1682
+ }
1683
+ async #verifySource(source) {
1684
+ const [opened, currentPath] = await Promise.all([source.handle.stat(), lstat(this.path)]);
1685
+ if (!sameRegularFileState(source.initial, opened) || !sameRegularFileState(source.initial, currentPath)) throw new ArtifactReaderFailure("integrity", `Universal Mach-O source changed during inventory: ${this.path}`);
1686
+ }
1687
+ };
1688
+ readStructuralSlices = async (file, size) => {
1689
+ const readAt = async (offset, length) => {
1690
+ const bytes = Buffer.alloc(length);
1691
+ const { bytesRead } = await file.read(bytes, 0, length, offset);
1692
+ return bytes.subarray(0, bytesRead);
1693
+ };
1694
+ return readMachoImage(readAt, size);
1695
+ };
1696
+ lipoMatchesSlice = (reported, observed, structurallyUnique) => {
1697
+ const observedCpuType = observed.fat_cpu_type ?? observed.cpu_type;
1698
+ const observedCpuSubtype = observed.fat_cpu_subtype ?? observed.cpu_subtype;
1699
+ const hasPhysicalIdentity = reported.file_offset !== null || reported.size !== null || reported.cpu_type_code !== null || reported.cpu_subtype_code !== null;
1700
+ return (hasPhysicalIdentity || structurallyUnique) && lipoNameMatches(reported.name, observed.architecture) && (reported.file_offset === null || reported.file_offset === observed.slice_offset) && (reported.size === null || reported.size === observed.slice_size) && (reported.cpu_type_code === null || reported.cpu_type_code === observedCpuType) && lipoSubtypeMatches(reported, observedCpuSubtype) && (reported.alignment === null || observed.fat_alignment_exponent === null || reported.alignment === 2 ** observed.fat_alignment_exponent);
1701
+ };
1702
+ lipoSubtypeMatches = (reported, observedCpuSubtype) => {
1703
+ if (reported.cpu_subtype_code !== null) return reported.cpu_subtype_code === observedCpuSubtype;
1704
+ return reported.cpu_subtype_base === null || reported.cpu_subtype_base === machoCpuSubtypeBase(observedCpuSubtype);
1705
+ };
1706
+ lipoNameMatches = (reported, observed) => reported === observed || observed === "arm64e" && /^arm64e\.[A-Za-z0-9_]+$/u.test(reported);
1707
+ })))();
1708
+ }
1709
+
1710
+ //#endregion
1711
+ //#region dist/artifacts/NativeDmgOwnership.js
1712
+ var systemEntitySchema, attachOutputSchema, infoOutputSchema, parseNativeDmgInfo, parseNativeDmgAttachOutput, resolveNativeDmgOwnership, ownershipFromAttachOutput, topLevelDevices, isBelowRoot;
1713
+ function init_NativeDmgOwnership() {
1714
+ return (init_NativeDmgOwnership = __esmMin((() => {
1715
+ systemEntitySchema = z.object({
1716
+ "dev-entry": z.string().startsWith("/dev/"),
1717
+ "mount-point": z.string().optional()
1718
+ });
1719
+ attachOutputSchema = z.object({ "system-entities": z.array(systemEntitySchema) });
1720
+ infoOutputSchema = z.object({ images: z.array(z.object({ "system-entities": z.array(systemEntitySchema) })) });
1721
+ parseNativeDmgInfo = (stdout) => infoOutputSchema.parse(parse(stdout));
1722
+ parseNativeDmgAttachOutput = (stdout) => attachOutputSchema.parse(parse(stdout));
1723
+ resolveNativeDmgOwnership = (input) => {
1724
+ const rootedImages = input.info.images.filter((image) => image["system-entities"].some(({ "mount-point": mountPoint }) => mountPoint !== undefined && isBelowRoot(input.mountRoot, mountPoint)));
1725
+ if (rootedImages.length > 1) return {
1726
+ status: "unknown",
1727
+ reason: "multiple hdiutil image groups report mounts beneath the owned root"
1728
+ };
1729
+ const rootedImage = rootedImages[0];
1730
+ if (rootedImage !== undefined) {
1731
+ const hasOutsideMount = rootedImage["system-entities"].some(({ "mount-point": mountPoint }) => mountPoint !== undefined && !isBelowRoot(input.mountRoot, mountPoint));
1732
+ const groupDevices = rootedImage["system-entities"].map(({ "dev-entry": device }) => device);
1733
+ const devices = topLevelDevices(groupDevices);
1734
+ const overlapsBaseline = groupDevices.some((device) => input.baselineDevices.has(device));
1735
+ if (hasOutsideMount || overlapsBaseline || devices.length === 0) return {
1736
+ status: "unknown",
1737
+ reason: hasOutsideMount ? "the image group contains a mount outside the owned root" : overlapsBaseline ? "the image group includes a device present before attachment" : "the owned mount group contains no detachable device"
1738
+ };
1739
+ return {
1740
+ status: "owned",
1741
+ devices,
1742
+ source: "info"
1743
+ };
1744
+ }
1745
+ if (input.attachOutputReturned) {
1746
+ const attachOwnership = ownershipFromAttachOutput(input.attachOutput, input.mountRoot, input.baselineDevices);
1747
+ if (attachOwnership.status === "owned") {
1748
+ return attachOwnership;
1749
+ }
1750
+ if (attachOwnership.status === "unknown") return attachOwnership;
1751
+ }
1752
+ const newlyListedDevice = input.info.images.some((image) => image["system-entities"].some(({ "dev-entry": device }) => !input.baselineDevices.has(device)));
1753
+ if (newlyListedDevice) return {
1754
+ status: "unknown",
1755
+ reason: "hdiutil lists devices absent from the pre-attach baseline, but none is tied uniquely to the owned root; ownership is unknown"
1756
+ };
1757
+ return { status: "none" };
1758
+ };
1759
+ ownershipFromAttachOutput = (output, mountRoot, baselineDevices) => {
1760
+ if (output === undefined) return {
1761
+ status: "unknown",
1762
+ reason: "hdiutil attach succeeded but its ownership facts were malformed"
1763
+ };
1764
+ const entities = output["system-entities"];
1765
+ const hasRootMount = entities.some(({ "mount-point": mountPoint }) => mountPoint !== undefined && isBelowRoot(mountRoot, mountPoint));
1766
+ const hasOutsideMount = entities.some(({ "mount-point": mountPoint }) => mountPoint !== undefined && !isBelowRoot(mountRoot, mountPoint));
1767
+ const devices = entities.map(({ "dev-entry": device }) => device);
1768
+ const uniqueDevices = topLevelDevices(devices);
1769
+ const overlapsBaseline = devices.some((device) => baselineDevices.has(device));
1770
+ if (hasRootMount) {
1771
+ if (hasOutsideMount || overlapsBaseline || uniqueDevices.length === 0) return {
1772
+ status: "unknown",
1773
+ reason: hasOutsideMount ? "the attach result includes a mount outside the owned root" : overlapsBaseline ? "the attach result includes a device present before attachment" : "the attach result's owned mount has no detachable device"
1774
+ };
1775
+ return {
1776
+ status: "owned",
1777
+ devices: uniqueDevices,
1778
+ source: "attach"
1779
+ };
1780
+ }
1781
+ if (devices.length === 0) return {
1782
+ status: "unknown",
1783
+ reason: "hdiutil attach succeeded without reporting device ownership facts"
1784
+ };
1785
+ if (devices.some((device) => !baselineDevices.has(device))) return {
1786
+ status: "unknown",
1787
+ reason: "the attach result reports new devices without a mount beneath the owned root"
1788
+ };
1789
+ return { status: "none" };
1790
+ };
1791
+ topLevelDevices = (devices) => {
1792
+ const unique = [...new Set(devices)];
1793
+ return unique.filter((device) => !unique.some((parent) => /^\/dev\/disk\d+$/u.test(parent) && device.startsWith(`${parent}s`) && /^\d+$/u.test(device.slice(parent.length + 1))));
1794
+ };
1795
+ isBelowRoot = (root, path) => {
1796
+ const child = relative(root, resolve(path));
1797
+ return child !== "" && child !== "." && child !== ".." && !child.startsWith(`..${sep}`);
1798
+ };
1799
+ })))();
1800
+ }
1801
+
1802
+ //#endregion
1803
+ //#region dist/artifacts/NativeDmgArtifactReader.js
1804
+ var HDIUTIL_COMMAND_TIMEOUT_MS, VERIFY_SETTLE_DELAYS_MS, DETACH_SETTLE_DELAYS_MS, delay, NativeDmgCommandFailure, createSystemHost, NativeDmgArtifactReader, failureMessage, processNotStarted, runChecked, describeCommandFailure, processExitCode, processOutput, classifyCommandFailure, verifyFailureReason, verifyFailureDiagnostic, command;
1805
+ function init_NativeDmgArtifactReader() {
1806
+ return (init_NativeDmgArtifactReader = __esmMin((() => {
1807
+ init_ArtifactReader();
1808
+ init_DirectoryArtifactReader();
1809
+ init_ExecFileOutput();
1810
+ init_NativeDmgOwnership();
1811
+ HDIUTIL_COMMAND_TIMEOUT_MS = 12e4;
1812
+ VERIFY_SETTLE_DELAYS_MS = [250, 500];
1813
+ DETACH_SETTLE_DELAYS_MS = [
1814
+ 250,
1815
+ 500,
1816
+ 1e3
1817
+ ];
1818
+ delay = (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds));
1819
+ NativeDmgCommandFailure = class extends ArtifactReaderFailure {
1820
+ stdout;
1821
+ processNotStarted;
1822
+ verifyDiagnostic;
1823
+ exitCode;
1824
+ constructor(failure, message, stdout, options) {
1825
+ super(failure.reason, message, options?.cause === undefined ? undefined : { cause: options.cause });
1826
+ this.stdout = stdout;
1827
+ this.processNotStarted = options?.processNotStarted ?? false;
1828
+ this.verifyDiagnostic = failure.verifyDiagnostic;
1829
+ this.exitCode = options?.exitCode ?? null;
1830
+ }
1831
+ };
1832
+ createSystemHost = (environment) => ({
1833
+ delay,
1834
+ async run(arguments_, signal, options) {
1835
+ try {
1836
+ const { stdout, stderr } = await execFileOutput("/usr/bin/hdiutil", [...arguments_], {
1837
+ env: environment,
1838
+ stopSignal: "SIGTERM",
1839
+ ...options === undefined ? {} : { timeout: options.timeoutMs },
1840
+ ...signal === undefined ? {} : { signal }
1841
+ });
1842
+ return {
1843
+ stdout,
1844
+ stderr,
1845
+ exitCode: 0
1846
+ };
1847
+ } catch (cause) {
1848
+ const output = execFileOutputFailure(cause);
1849
+ if (cause instanceof Error && cause.name === "AbortError") throw new NativeDmgCommandFailure({ reason: "cancelled" }, "DMG operation cancelled", output?.stdout ?? "", { cause });
1850
+ const exitCode = typeof output?.code === "number" ? output.code : processExitCode(cause);
1851
+ if (exitCode !== undefined) return {
1852
+ stdout: output?.stdout ?? processOutput(cause, "stdout"),
1853
+ stderr: output?.stderr ?? processOutput(cause, "stderr"),
1854
+ exitCode,
1855
+ cause
1856
+ };
1857
+ throw new NativeDmgCommandFailure(classifyCommandFailure(cause, arguments_[0]), `hdiutil ${arguments_[0] ?? "operation"} failed: ${describeCommandFailure(cause, arguments_)}`, output?.stdout ?? "", {
1858
+ cause,
1859
+ processNotStarted: processNotStarted(cause)
1860
+ });
1861
+ }
1862
+ }
1863
+ });
1864
+ NativeDmgArtifactReader = class {
1865
+ path;
1866
+ format = "file";
1867
+ host;
1868
+ #provenance = [];
1869
+ #initialization;
1870
+ #directory;
1871
+ #devices = [];
1872
+ #inventoryConfirmedDevices = new Set();
1873
+ #mountRoot;
1874
+ #baselineDevices = new Set();
1875
+ #attachOutput;
1876
+ #attachOutputReturned = false;
1877
+ #attachMayHaveMounted = false;
1878
+ #ownershipUncertainty;
1879
+ #closed = false;
1880
+ #closePromise;
1881
+ #activeDirectoryOperations = new Set();
1882
+ constructor(path, environment, host) {
1883
+ this.path = path;
1884
+ if (process.platform !== "darwin" && host === undefined) throw new ArtifactReaderFailure("unavailable", "Native DMG traversal is available only on macOS");
1885
+ this.host = host ?? createSystemHost(environment);
1886
+ }
1887
+ async *entries(signal, options) {
1888
+ await this.#ensureAttached(signal);
1889
+ const directory = this.#directory;
1890
+ if (directory === undefined) throw new ArtifactReaderFailure("unavailable", "DMG is not attached");
1891
+ const prefix = basename(this.path);
1892
+ const entries = directory.entries(signal, { onOmission: (omission) => options?.onOmission?.({
1893
+ ...omission,
1894
+ path: `${prefix}/${omission.path}`
1895
+ }) })[Symbol.asyncIterator]();
1896
+ try {
1897
+ for (;;) {
1898
+ if (this.#closed) return;
1899
+ const next = await this.#trackDirectoryOperation(() => entries.next());
1900
+ if (this.#closed) return;
1901
+ if (next.done) return;
1902
+ yield {
1903
+ ...next.value,
1904
+ path: `${prefix}/${next.value.path}`
1905
+ };
1906
+ }
1907
+ } finally {
1908
+ await entries.return?.();
1909
+ }
1910
+ }
1911
+ async open(entry, signal) {
1912
+ await this.#ensureAttached(signal);
1913
+ const directory = this.#directory;
1914
+ if (directory === undefined) throw new ArtifactReaderFailure("unavailable", "DMG is not attached");
1915
+ return this.#trackDirectoryOperation(() => directory.open(entry, signal));
1916
+ }
1917
+ provenance() {
1918
+ return structuredClone(this.#provenance);
1919
+ }
1920
+ close() {
1921
+ this.#closed = true;
1922
+ this.#closePromise ??= this.#closeOwnedResources().catch((cause) => {
1923
+ this.#closePromise = undefined;
1924
+ throw cause;
1925
+ });
1926
+ return this.#closePromise;
1927
+ }
1928
+ async #closeOwnedResources() {
1929
+ await this.#initialization?.catch(() => undefined);
1930
+ await Promise.allSettled(this.#activeDirectoryOperations);
1931
+ await this.#closeMountedDirectory();
1932
+ let detachFailure = await this.#detachOwnedDevices();
1933
+ if (this.#devices.length === 0 && this.#mountRoot !== undefined && !this.#attachMayHaveMounted) await rm(this.#mountRoot, {
1934
+ recursive: true,
1935
+ force: true
1936
+ }).then(() => {
1937
+ this.#mountRoot = undefined;
1938
+ this.#directory = undefined;
1939
+ }, (cause) => {
1940
+ detachFailure ??= cause;
1941
+ });
1942
+ if (this.#attachMayHaveMounted) {
1943
+ detachFailure ??= new Error(this.#ownershipUncertainty ?? "hdiutil attachment ownership remains unknown");
1944
+ }
1945
+ if (detachFailure !== undefined) throw new ArtifactReaderFailure("unavailable", `DMG detach or mount-root cleanup failed for ${JSON.stringify(this.path)}: ${failureMessage(detachFailure)}`, {
1946
+ cause: detachFailure,
1947
+ cleanup: {
1948
+ reason: failureMessage(detachFailure),
1949
+ resources: [
1950
+ ...this.#devices.map((device) => `DMG device ${device}`),
1951
+ ...this.#attachMayHaveMounted ? [`DMG attachment ownership unknown at mount root ${this.#mountRoot ?? this.path}`] : [],
1952
+ ...this.#mountRoot === undefined ? [] : [`DMG mount root ${this.#mountRoot}`]
1953
+ ]
1954
+ }
1955
+ });
1956
+ }
1957
+ async #detachOwnedDevices() {
1958
+ let detachFailure = await this.#reconcileAttachState();
1959
+ let remainingDevices = [];
1960
+ for (const device of [...this.#devices].reverse()) {
1961
+ const failure = await this.#detach(device);
1962
+ if (failure !== undefined) {
1963
+ remainingDevices.push(device);
1964
+ detachFailure ??= failure;
1965
+ }
1966
+ }
1967
+ for (const delayMs of DETACH_SETTLE_DELAYS_MS) {
1968
+ if (remainingDevices.length === 0) break;
1969
+ await (this.host.delay ?? delay)(delayMs);
1970
+ const stillAttached = [];
1971
+ for (const device of remainingDevices) {
1972
+ if (!await this.#isAttached(device)) continue;
1973
+ const failure = await this.#detach(device);
1974
+ if (failure !== undefined) {
1975
+ stillAttached.push(device);
1976
+ detachFailure = failure;
1977
+ }
1978
+ }
1979
+ remainingDevices = stillAttached;
1980
+ }
1981
+ if (remainingDevices.length === 0) detachFailure = undefined;
1982
+ this.#devices = remainingDevices.reverse();
1983
+ return detachFailure;
1984
+ }
1985
+ async #closeMountedDirectory() {
1986
+ if (this.#directory !== undefined) {
1987
+ try {
1988
+ await this.#directory.close();
1989
+ this.#directory = undefined;
1990
+ } catch (cause) {
1991
+ const mountRoot = this.#mountRoot ?? this.path;
1992
+ throw ArtifactReaderFailure.withCleanup(cause, {
1993
+ reason: `DMG mounted directory remains owned: ${failureMessage(cause)}`,
1994
+ resources: [
1995
+ `DMG mounted directory at ${mountRoot}`,
1996
+ `DMG mount root ${mountRoot}`,
1997
+ ...this.#devices.map((device) => `DMG device ${device}`)
1998
+ ]
1999
+ });
2000
+ }
2001
+ }
2002
+ }
2003
+ /** Detach one device; return the failure only while it remains attached. */
2004
+ async #detach(device) {
2005
+ try {
2006
+ await runChecked(this.host, ["detach", device], undefined, { timeoutMs: HDIUTIL_COMMAND_TIMEOUT_MS });
2007
+ this.#provenance.push(command(["detach", device], ["mount"]));
2008
+ return undefined;
2009
+ } catch (cause) {
2010
+ return await this.#isAttached(device) ? cause : undefined;
2011
+ }
2012
+ }
2013
+ async #reconcileAttachState() {
2014
+ if (!this.#attachMayHaveMounted) return undefined;
2015
+ try {
2016
+ await this.#resolveAttachOwnership();
2017
+ return undefined;
2018
+ } catch (cause) {
2019
+ this.#ownershipUncertainty = failureMessage(cause);
2020
+ return cause;
2021
+ }
2022
+ }
2023
+ /** Treat unknown hdiutil state as attached during cleanup. */
2024
+ async #isAttached(device) {
2025
+ try {
2026
+ const parsed = await this.#readInfo();
2027
+ const isListed = parsed.images.some((image) => image["system-entities"].some((entity) => entity["dev-entry"] === device));
2028
+ if (isListed) {
2029
+ this.#inventoryConfirmedDevices.add(device);
2030
+ return true;
2031
+ }
2032
+ return !this.#inventoryConfirmedDevices.has(device);
2033
+ } catch {
2034
+ return true;
2035
+ }
2036
+ }
2037
+ async #ensureAttached(signal) {
2038
+ if (this.#closed) throw new ArtifactReaderFailure("unavailable", "DMG reader is closed");
2039
+ this.#initialization ??= this.#attach(signal);
2040
+ await this.#initialization;
2041
+ if (this.#closed) throw new ArtifactReaderFailure("unavailable", "DMG reader is closed");
2042
+ }
2043
+ async #trackDirectoryOperation(operation) {
2044
+ if (this.#closed) throw new ArtifactReaderFailure("unavailable", "DMG reader is closed");
2045
+ const running = Promise.resolve().then(operation);
2046
+ this.#activeDirectoryOperations.add(running);
2047
+ try {
2048
+ return await running;
2049
+ } finally {
2050
+ this.#activeDirectoryOperations.delete(running);
2051
+ }
2052
+ }
2053
+ async #attach(signal) {
2054
+ await this.#verify(signal);
2055
+ const baseline = await this.#readInfo();
2056
+ this.#baselineDevices = new Set(baseline.images.flatMap((image) => image["system-entities"].map(({ "dev-entry": device }) => device)));
2057
+ const mountRoot = await realpath(await mkdtemp(join(tmpdir(), "rea-dmg-")));
2058
+ this.#mountRoot = mountRoot;
2059
+ try {
2060
+ this.#attachMayHaveMounted = true;
2061
+ const attached = await runChecked(this.host, [
2062
+ "attach",
2063
+ "-readonly",
2064
+ "-nobrowse",
2065
+ "-plist",
2066
+ "-mountroot",
2067
+ mountRoot,
2068
+ this.path
2069
+ ], signal, { timeoutMs: HDIUTIL_COMMAND_TIMEOUT_MS });
2070
+ this.#attachOutputReturned = true;
2071
+ let parsed;
2072
+ try {
2073
+ parsed = parseNativeDmgAttachOutput(attached.stdout);
2074
+ } catch (cause) {
2075
+ throw new ArtifactReaderFailure("format", "hdiutil returned a malformed attachment plist", { cause });
2076
+ }
2077
+ if (parsed["system-entities"].length === 0) throw new ArtifactReaderFailure("format", "hdiutil returned no attached devices");
2078
+ this.#attachOutput = parsed;
2079
+ const ownership = await this.#resolveAttachOwnership();
2080
+ if (ownership !== "owned") throw new ArtifactReaderFailure(ownership === "unknown" ? "unavailable" : "path", ownership === "unknown" ? `DMG attachment ownership is uncertain: ${this.#ownershipUncertainty ?? "no unique mount under the owned root"}` : "hdiutil did not mount a new image beneath the owned root");
2081
+ this.#provenance.push(command([
2082
+ "attach",
2083
+ "-readonly",
2084
+ "-nobrowse",
2085
+ "-plist",
2086
+ "-mountroot",
2087
+ mountRoot,
2088
+ this.path
2089
+ ], ["read", "mount"]));
2090
+ this.#directory = new DirectoryArtifactReader(mountRoot);
2091
+ } catch (cause) {
2092
+ if (cause instanceof NativeDmgCommandFailure && cause.stdout !== "") {
2093
+ try {
2094
+ this.#attachOutput = parseNativeDmgAttachOutput(cause.stdout);
2095
+ this.#attachOutputReturned = true;
2096
+ } catch {}
2097
+ }
2098
+ if (cause instanceof NativeDmgCommandFailure && cause.processNotStarted) {
2099
+ this.#attachMayHaveMounted = false;
2100
+ this.#ownershipUncertainty = undefined;
2101
+ }
2102
+ throw cause;
2103
+ }
2104
+ }
2105
+ async #verify(signal) {
2106
+ const arguments_ = ["verify", this.path];
2107
+ const deadline = performance.now() + HDIUTIL_COMMAND_TIMEOUT_MS;
2108
+ for (let attempt = 0;; attempt += 1) {
2109
+ if (signal?.aborted === true) throw new NativeDmgCommandFailure({ reason: "cancelled" }, "DMG operation cancelled", "", { cause: signal.reason });
2110
+ try {
2111
+ await runChecked(this.host, arguments_, signal, { timeoutMs: Math.max(1, Math.ceil(deadline - performance.now())) });
2112
+ this.#provenance.push(command(arguments_, ["read"]));
2113
+ return;
2114
+ } catch (cause) {
2115
+ if (!(cause instanceof NativeDmgCommandFailure)) throw cause;
2116
+ this.#provenance.push(command(arguments_, ["read"], cause.exitCode));
2117
+ const delayMs = VERIFY_SETTLE_DELAYS_MS[attempt];
2118
+ if (cause.verifyDiagnostic !== "Resource temporarily unavailable" || delayMs === undefined || deadline - performance.now() <= delayMs) throw cause;
2119
+ await (this.host.delay ?? delay)(delayMs);
2120
+ if (performance.now() >= deadline) throw cause;
2121
+ }
2122
+ }
2123
+ }
2124
+ async #readInfo() {
2125
+ const info = await runChecked(this.host, ["info", "-plist"], undefined, { timeoutMs: HDIUTIL_COMMAND_TIMEOUT_MS });
2126
+ return parseNativeDmgInfo(info.stdout);
2127
+ }
2128
+ async #resolveAttachOwnership() {
2129
+ const mountRoot = this.#mountRoot;
2130
+ if (mountRoot === undefined) throw new Error("DMG mount root is unavailable for ownership discovery");
2131
+ const ownership = resolveNativeDmgOwnership({
2132
+ info: await this.#readInfo(),
2133
+ ...this.#attachOutput === undefined ? {} : { attachOutput: this.#attachOutput },
2134
+ attachOutputReturned: this.#attachOutputReturned,
2135
+ mountRoot,
2136
+ baselineDevices: this.#baselineDevices
2137
+ });
2138
+ if (ownership.status === "owned") {
2139
+ this.#devices = [...ownership.devices];
2140
+ if (ownership.source === "info") for (const device of ownership.devices) this.#inventoryConfirmedDevices.add(device);
2141
+ this.#attachMayHaveMounted = false;
2142
+ this.#ownershipUncertainty = undefined;
2143
+ return "owned";
2144
+ }
2145
+ if (ownership.status === "unknown") {
2146
+ this.#ownershipUncertainty = ownership.reason;
2147
+ return "unknown";
2148
+ }
2149
+ this.#attachMayHaveMounted = false;
2150
+ this.#ownershipUncertainty = undefined;
2151
+ this.#devices = [];
2152
+ return "none";
2153
+ }
2154
+ };
2155
+ failureMessage = (cause) => cause instanceof Error ? cause.message : String(cause);
2156
+ processNotStarted = (cause) => {
2157
+ if (!(cause instanceof Error)) return false;
2158
+ const syscall = Reflect.get(cause, "syscall");
2159
+ const code = Reflect.get(cause, "code");
2160
+ const errno = Reflect.get(cause, "errno");
2161
+ return typeof syscall === "string" && syscall.startsWith("spawn ") && (typeof code === "string" || typeof code === "number" || typeof errno === "number");
2162
+ };
2163
+ runChecked = async (host, arguments_, signal, options) => {
2164
+ let result;
2165
+ try {
2166
+ result = await host.run(arguments_, signal, options);
2167
+ } catch (cause) {
2168
+ if (cause instanceof ArtifactReaderFailure) throw cause;
2169
+ if (cause instanceof Error && cause.name === "AbortError") throw new NativeDmgCommandFailure({ reason: "cancelled" }, "DMG operation cancelled", execFileOutputFailure(cause)?.stdout ?? "", { cause });
2170
+ const output = execFileOutputFailure(cause);
2171
+ throw new NativeDmgCommandFailure(classifyCommandFailure(cause, arguments_[0]), `hdiutil ${arguments_[0] ?? "operation"} failed: ${describeCommandFailure(cause, arguments_)}`, output?.stdout ?? "", {
2172
+ cause,
2173
+ processNotStarted: processNotStarted(cause)
2174
+ });
2175
+ }
2176
+ if (result.exitCode !== 0) {
2177
+ const failure = {
2178
+ command: "/usr/bin/hdiutil",
2179
+ exitCode: result.exitCode,
2180
+ ...result.cause === undefined ? {} : { code: processExitCode(result.cause) },
2181
+ stdout: result.stdout,
2182
+ ...result.stderr === undefined ? {} : { stderr: result.stderr }
2183
+ };
2184
+ const classification = classifyCommandFailure(failure, arguments_[0]);
2185
+ const details = describeCommandFailure(failure, arguments_);
2186
+ const unknownVerifyFailure = arguments_[0] === "verify" && classification.reason === "unavailable";
2187
+ throw new NativeDmgCommandFailure(classification, unknownVerifyFailure ? `hdiutil verify failed; captured diagnostics do not establish the failure cause: ${details}` : `hdiutil ${arguments_[0] ?? "operation"} failed: ${details}`, result.stdout, {
2188
+ cause: result.cause ?? failure,
2189
+ exitCode: result.exitCode
2190
+ });
2191
+ }
2192
+ return {
2193
+ stdout: result.stdout,
2194
+ exitCode: 0
2195
+ };
2196
+ };
2197
+ describeCommandFailure = (cause, arguments_) => {
2198
+ const fields = {
2199
+ command: "/usr/bin/hdiutil",
2200
+ arguments: [...arguments_]
2201
+ };
2202
+ if (typeof cause === "object" && cause !== null) {
2203
+ for (const key of [
2204
+ "code",
2205
+ "exitCode",
2206
+ "errno",
2207
+ "syscall",
2208
+ "signal",
2209
+ "stdout",
2210
+ "stderr"
2211
+ ]) {
2212
+ const value = Reflect.get(cause, key);
2213
+ if (typeof value === "string" || typeof value === "number") fields[key] = value;
2214
+ }
2215
+ const code = Reflect.get(cause, "code");
2216
+ if (typeof code === "number") fields.exitCode = code;
2217
+ }
2218
+ if (cause instanceof ArtifactReaderFailure) fields.message = cause.message;
2219
+ else if (cause instanceof Error) fields.message = cause.message;
2220
+ return JSON.stringify(fields);
2221
+ };
2222
+ processExitCode = (cause) => {
2223
+ if (typeof cause !== "object" || cause === null) return undefined;
2224
+ const exitCode = Reflect.get(cause, "exitCode");
2225
+ if (typeof exitCode === "number") return exitCode;
2226
+ const code = Reflect.get(cause, "code");
2227
+ return typeof code === "number" ? code : undefined;
2228
+ };
2229
+ processOutput = (cause, field) => {
2230
+ if (typeof cause !== "object" || cause === null) return "";
2231
+ const value = Reflect.get(cause, field);
2232
+ return typeof value === "string" ? value : "";
2233
+ };
2234
+ classifyCommandFailure = (cause, operation) => {
2235
+ if (typeof cause !== "object" || cause === null) return { reason: "unavailable" };
2236
+ const code = Reflect.get(cause, "code");
2237
+ const exitCode = Reflect.get(cause, "exitCode");
2238
+ if (typeof code === "number" || typeof exitCode === "number") {
2239
+ if (operation !== "verify") return { reason: "unavailable" };
2240
+ const diagnostic = verifyFailureDiagnostic(processOutput(cause, "stdout"), processOutput(cause, "stderr"));
2241
+ return {
2242
+ reason: verifyFailureReason(diagnostic),
2243
+ ...diagnostic === undefined ? {} : { verifyDiagnostic: diagnostic }
2244
+ };
2245
+ }
2246
+ if (code === "ENOENT") {
2247
+ const syscall = Reflect.get(cause, "syscall");
2248
+ return { reason: typeof syscall === "string" && syscall.startsWith("spawn") ? "unavailable" : "io" };
2249
+ }
2250
+ if (code === "EACCES" || code === "EPERM" || code === "EIO" || code === "ENOTDIR" || code === "EISDIR" || code === "ENODEV" || code === "EROFS" || code === "EMFILE" || code === "ENFILE") return { reason: "io" };
2251
+ return { reason: "unavailable" };
2252
+ };
2253
+ verifyFailureReason = (diagnostic) => {
2254
+ switch (diagnostic) {
2255
+ case "image not recognized":
2256
+ case "image not recognised": return "format";
2257
+ case "invalid checksum":
2258
+ case "image data corrupted": return "integrity";
2259
+ case "No such file or directory":
2260
+ case "Permission denied":
2261
+ case "Input/output error": return "io";
2262
+ default: return "unavailable";
2263
+ }
2264
+ };
2265
+ verifyFailureDiagnostic = (stdout, stderr) => {
2266
+ const prefix = "hdiutil: verify failed - ";
2267
+ return `${stdout}\n${stderr}`.split(/\r?\n/u).map((line) => line.trim()).find((line) => line.startsWith(prefix))?.slice(prefix.length);
2268
+ };
2269
+ command = (arguments_, effects, exitCode = 0) => ({
2270
+ tool: "/usr/bin/hdiutil",
2271
+ arguments: [...arguments_],
2272
+ tool_version: null,
2273
+ executable_sha256: null,
2274
+ exit_code: exitCode,
2275
+ effects
2276
+ });
2277
+ })))();
2278
+ }
2279
+
2280
+ //#endregion
2281
+ //#region dist/artifacts/inventory/reader.js
2282
+ var createReader, inventoryCoverage;
2283
+ function init_reader() {
2284
+ return (init_reader = __esmMin((() => {
2285
+ init_AsarArtifactReader();
2286
+ init_DirectoryArtifactReader();
2287
+ init_MachOSliceArtifactReader();
2288
+ init_NativeDmgArtifactReader();
2289
+ init_ZipArtifactReader();
2290
+ init_zipPackageFormat();
2291
+ createReader = (path, format, environment, rootSource) => {
2292
+ if (isZipPackageFormat(format)) return new ZipArtifactReader(path, format, undefined, rootSource);
2293
+ switch (format) {
2294
+ case "directory": return new DirectoryArtifactReader(path);
2295
+ case "asar": return new AsarArtifactReader(path);
2296
+ case "mach-o-universal": return process.platform === "darwin" ? new MachOSliceArtifactReader(path, environment, undefined, rootSource) : undefined;
2297
+ case "dmg":
2298
+ if (process.platform !== "darwin") return undefined;
2299
+ return new NativeDmgArtifactReader(path, environment);
2300
+ default: return undefined;
2301
+ }
2302
+ };
2303
+ inventoryCoverage = (format, reader, traversal) => {
2304
+ if (reader !== undefined) return {
2305
+ coverage: {
2306
+ scope: "container-entries",
2307
+ status: traversal.status
2308
+ },
2309
+ limitations: [...isZipPackageFormat(reader.format) ? [ZIP_NON_ENTRY_LIMITATION] : [], ...traversal.limitations]
2310
+ };
2311
+ if (format === "dmg" || format === "pkg") return {
2312
+ coverage: {
2313
+ scope: "container-entries",
2314
+ status: "unknown"
2315
+ },
2316
+ limitations: [`${format.toUpperCase()} root hash is observed; child inventory requires a native macOS adapter.`]
2317
+ };
2318
+ if (format === "mach-o-universal") return {
2319
+ coverage: {
2320
+ scope: "container-entries",
2321
+ status: "unknown"
2322
+ },
2323
+ limitations: ["Universal Mach-O slices require the native macOS lipo adapter."]
2324
+ };
2325
+ if (isZipPackageFormat(format) || format === "directory" || format === "asar") return {
2326
+ coverage: {
2327
+ scope: "container-entries",
2328
+ status: "unknown"
2329
+ },
2330
+ limitations: [`${format} child inventory reader is unavailable.`]
2331
+ };
2332
+ return {
2333
+ coverage: {
2334
+ scope: "root",
2335
+ status: "complete"
2336
+ },
2337
+ limitations: ["Artifact has no child container entries."]
2338
+ };
2339
+ };
2340
+ })))();
2341
+ }
2342
+
2343
+ //#endregion
2344
+ //#region dist/artifacts/inventory/types.js
2345
+ var STRICT_INTEGRITY_POLICY;
2346
+ function init_types() {
2347
+ return (init_types = __esmMin((() => {
2348
+ STRICT_INTEGRITY_POLICY = { mode: "fail" };
2349
+ })))();
2350
+ }
2351
+
2352
+ //#endregion
2353
+ //#region dist/artifacts/inventory/scanReader.js
2354
+ var UNAVAILABLE_UNPACKED_LIMITATION, emptyScan, scanReader, inventoryEntries, visitArtifactEntries, digestArtifactEntry, isExpandableAsar, isUnavailableUnpackedEntry;
2355
+ function init_scanReader() {
2356
+ return (init_scanReader = __esmMin((() => {
2357
+ init_ArtifactPaths();
2358
+ init_ArtifactReader();
2359
+ init_AsarArtifactReader();
2360
+ init_unicodeCodePointOrder();
2361
+ init_ArtifactGraphConstruction();
2362
+ init_types();
2363
+ init_ArtifactHash();
2364
+ UNAVAILABLE_UNPACKED_LIMITATION = "ASAR unpacked companion bytes were unavailable; no content hash or child artifact was produced.";
2365
+ emptyScan = () => ({
2366
+ nodes: new Map(),
2367
+ occurrences: [],
2368
+ pendingContradictions: []
2369
+ });
2370
+ scanReader = async (reader, ownedReaders, signal, integrity = STRICT_INTEGRITY_POLICY) => {
2371
+ const { nodes, occurrences, pendingContradictions } = emptyScan();
2372
+ if (reader === undefined) return {
2373
+ nodes,
2374
+ occurrences,
2375
+ pendingContradictions,
2376
+ caseCollisionLimitation: undefined,
2377
+ unknownParentOccurrences: new Set(),
2378
+ traversal: {
2379
+ status: "complete",
2380
+ limitations: []
2381
+ }
2382
+ };
2383
+ const context = {
2384
+ reader,
2385
+ signal,
2386
+ integrity,
2387
+ nodes,
2388
+ occurrences,
2389
+ pendingContradictions,
2390
+ occurrenceCountByPath: new Map(),
2391
+ registry: new ArtifactPathRegistry(),
2392
+ expandedContainerIds: new Set(),
2393
+ ownedReaders,
2394
+ omissions: []
2395
+ };
2396
+ await visitArtifactEntries(context, reader, "");
2397
+ const byPath = indexOccurrencesByPath(occurrences);
2398
+ const parentResolution = resolveOccurrenceParents(occurrences, byPath, context.expandedContainerIds);
2399
+ const structuralLimitations = [...parentResolution.limitations];
2400
+ return {
2401
+ nodes,
2402
+ occurrences,
2403
+ pendingContradictions,
2404
+ caseCollisionLimitation: annotateEnglishUnicodeCaseCollisions(occurrences),
2405
+ unknownParentOccurrences: parentResolution.unknownParentOccurrences,
2406
+ traversal: {
2407
+ status: context.omissions.length === 0 && structuralLimitations.length === 0 ? "complete" : "unknown",
2408
+ limitations: [...new Set([...context.omissions.map(({ path, kind }) => `Artifact traversal omitted ${kind} at ${JSON.stringify(path)}.`), ...structuralLimitations])].sort(compareUnicodeCodePoints)
2409
+ }
2410
+ };
2411
+ };
2412
+ inventoryEntries = (context, reader, prefix) => reader.entries(context.signal, { onOmission: (omission) => context.omissions.push({
2413
+ ...omission,
2414
+ path: normalizeArtifactPath(prefix.length === 0 ? omission.path : `${prefix}/${omission.path}`)
2415
+ }) })[Symbol.asyncIterator]();
2416
+ visitArtifactEntries = async (context, currentReader, prefix) => {
2417
+ const stack = [{
2418
+ reader: currentReader,
2419
+ prefix,
2420
+ iterator: inventoryEntries(context, currentReader, prefix)
2421
+ }];
2422
+ let failure;
2423
+ try {
2424
+ while (stack.length > 0) {
2425
+ const frame = stack.at(-1);
2426
+ if (frame === undefined) break;
2427
+ const next = await frame.iterator.next();
2428
+ if (next.done) {
2429
+ stack.pop();
2430
+ continue;
2431
+ }
2432
+ const entry = next.value;
2433
+ const logicalPath = normalizeArtifactPath(frame.prefix.length === 0 ? entry.path : `${frame.prefix}/${entry.path}`);
2434
+ const expandableAsar = isExpandableAsar(entry, logicalPath);
2435
+ context.registry.add(logicalPath, expandableAsar ? "directory" : entry.kind);
2436
+ const duplicateOrdinal = context.occurrenceCountByPath.get(logicalPath) ?? 0;
2437
+ context.occurrenceCountByPath.set(logicalPath, duplicateOrdinal + 1);
2438
+ const occurrence = createOccurrence(entry, logicalPath, null, duplicateOrdinal);
2439
+ let digested;
2440
+ try {
2441
+ digested = await digestArtifactEntry(context, frame.reader, entry, logicalPath, occurrence);
2442
+ } catch (cause) {
2443
+ if (!isUnavailableUnpackedEntry(cause, entry)) throw cause;
2444
+ occurrence.hash_status = "unavailable";
2445
+ occurrence.limitations.push(UNAVAILABLE_UNPACKED_LIMITATION);
2446
+ }
2447
+ if (digested === undefined) noteUnreadContainerSuffix(occurrence);
2448
+ else {
2449
+ context.nodes.set(digested.node.artifact_id, digested.node);
2450
+ occurrence.artifact_id = digested.node.artifact_id;
2451
+ occurrence.artifact_kind = digested.classification.kind;
2452
+ occurrence.artifact_format = digested.classification.format;
2453
+ occurrence.hash_status = digested.mismatched ? "mismatched" : "verified";
2454
+ if (digested.mismatched) occurrence.limitations.push("Declared integrity metadata contradicts observed bytes.");
2455
+ }
2456
+ context.occurrences.push(occurrence);
2457
+ if (expandableAsar && digested !== undefined && digested.classification.format === "asar" && !digested.mismatched) {
2458
+ const nested = new AsarArtifactReader(entry.adapterKey);
2459
+ context.ownedReaders.push(nested);
2460
+ await nested.prepareContainer(digested.node.sha256, context.signal);
2461
+ context.expandedContainerIds.add(occurrence.occurrence_id);
2462
+ stack.push({
2463
+ reader: nested,
2464
+ prefix: logicalPath,
2465
+ iterator: inventoryEntries(context, nested, logicalPath)
2466
+ });
2467
+ }
2468
+ }
2469
+ } catch (cause) {
2470
+ failure = { cause };
2471
+ } finally {
2472
+ for (const { iterator, prefix, reader } of stack.reverse()) {
2473
+ try {
2474
+ await iterator.return?.();
2475
+ } catch (cause) {
2476
+ failure = { cause: ArtifactReaderFailure.withCleanup(failure === undefined ? cause : failure.cause, ArtifactReaderFailure.cleanupObservation(cause, `artifact traversal for ${prefix || reader.format}`)) };
2477
+ }
2478
+ }
2479
+ }
2480
+ if (failure !== undefined) throw failure.cause;
2481
+ };
2482
+ digestArtifactEntry = async (context, currentReader, entry, logicalPath, occurrence) => {
2483
+ if (entry.kind !== "file" && entry.kind !== "slice" || entry.encrypted) return undefined;
2484
+ const digest = await hashReadable(await currentReader.open(entry, context.signal), context.signal);
2485
+ const mismatched = entry.declaredSha256 !== null && entry.declaredSha256 !== digest.sha256;
2486
+ if (mismatched && entry.declaredSha256 !== null) {
2487
+ if (context.integrity.mode === "fail") throw new ArtifactReaderFailure("integrity", `Artifact integrity metadata disagrees with content: ${logicalPath}`, undefined, {
2488
+ logicalPath,
2489
+ declaredSha256: entry.declaredSha256,
2490
+ calculatedSha256: digest.sha256,
2491
+ unpacked: entry.unpacked
2492
+ });
2493
+ context.pendingContradictions.push({
2494
+ occurrence,
2495
+ declaredSha256: entry.declaredSha256,
2496
+ observedSha256: digest.sha256,
2497
+ entryKind: entry.kind,
2498
+ unpacked: entry.unpacked
2499
+ });
2500
+ }
2501
+ const classified = entry.kind === "slice" ? {
2502
+ kind: "universal-slice",
2503
+ format: "mach-o"
2504
+ } : classifyArtifactContent(logicalPath, digest.prefix, digest.bytes);
2505
+ return {
2506
+ node: createArtifactNode({
2507
+ sha256: digest.sha256,
2508
+ size: digest.bytes,
2509
+ format: classifyArtifactBytes(digest.prefix, digest.bytes),
2510
+ contentState: "embedded"
2511
+ }),
2512
+ mismatched,
2513
+ classification: classified
2514
+ };
2515
+ };
2516
+ isExpandableAsar = (entry, logicalPath) => entry.kind === "file" && logicalPath.toLowerCase().endsWith(".asar") && isAbsolute(entry.adapterKey);
2517
+ isUnavailableUnpackedEntry = (cause, entry) => entry.unpacked && cause instanceof ArtifactReaderFailure && cause.reason === "unavailable";
2518
+ })))();
2519
+ }
2520
+
2521
+ //#endregion
2522
+ //#region dist/artifacts/inventory/scanCanonical.js
2523
+ var scanCanonicalArtifactInventory, scanCanonicalArtifactInventoryInScope, cleanupInventoryOwners, buildInventorySnapshot, buildIntegrityContradictions, verifyRootDigest, sortNodes, sortOccurrences, sortEdges, buildManifest, buildLimitations;
2524
+ function init_scanCanonical() {
2525
+ return (init_scanCanonical = __esmMin((() => {
2526
+ init_unicodeCodePointOrder();
2527
+ init_AsarArtifactReader();
2528
+ init_ArtifactReader();
2529
+ init_artifactGraph();
2530
+ init_ArtifactGraphConstruction();
2531
+ init_artifactIdentity();
2532
+ init_classify();
2533
+ init_hostExecutableMarking();
2534
+ init_hashStableRootArtifact();
2535
+ init_reader();
2536
+ init_scanReader();
2537
+ init_types();
2538
+ scanCanonicalArtifactInventory = async (path, options, readerFactory = createReader) => options.resourceScope.run(() => scanCanonicalArtifactInventoryInScope(path, options, readerFactory));
2539
+ scanCanonicalArtifactInventoryInScope = async (path, options, readerFactory = createReader) => {
2540
+ const integrity = options.integrity ?? STRICT_INTEGRITY_POLICY;
2541
+ const metadata = await lstat(path);
2542
+ const { format: rootFormat, digest: rootDigest, rootSource } = await classifyAndHashRootForInventory(path, metadata.isDirectory(), metadata, options);
2543
+ let reader;
2544
+ let readerCreationFailure;
2545
+ try {
2546
+ reader = readerFactory(path, rootFormat, options.environment ?? {}, rootSource);
2547
+ } catch (cause) {
2548
+ readerCreationFailure = { cause };
2549
+ }
2550
+ const ownedReaders = reader === undefined ? [] : [reader];
2551
+ let outcome;
2552
+ try {
2553
+ if (readerCreationFailure !== undefined) throw readerCreationFailure.cause;
2554
+ if (reader instanceof AsarArtifactReader) await reader.prepareContainer(rootDigest?.sha256, options.signal);
2555
+ const { nodes, occurrences, pendingContradictions, caseCollisionLimitation, unknownParentOccurrences, traversal } = await scanReader(reader, ownedReaders, options.signal, integrity);
2556
+ outcome = {
2557
+ kind: "completed",
2558
+ snapshot: await buildInventorySnapshot({
2559
+ path,
2560
+ metadata,
2561
+ rootFormat,
2562
+ rootDigest,
2563
+ rootSource,
2564
+ resourceScope: options.resourceScope,
2565
+ reader,
2566
+ signal: options.signal,
2567
+ nodes,
2568
+ occurrences,
2569
+ pendingContradictions,
2570
+ caseCollisionLimitation,
2571
+ unknownParentOccurrences,
2572
+ traversal
2573
+ })
2574
+ };
2575
+ } catch (cause) {
2576
+ outcome = {
2577
+ kind: "failed",
2578
+ cause
2579
+ };
2580
+ }
2581
+ const cleanupFailure = await cleanupInventoryOwners({
2582
+ path,
2583
+ options,
2584
+ rootSource,
2585
+ ownedReaders,
2586
+ outcome
2587
+ });
2588
+ if (cleanupFailure !== undefined) throw cleanupFailure;
2589
+ if (outcome.kind === "failed") throw outcome.cause;
2590
+ return outcome.snapshot;
2591
+ };
2592
+ cleanupInventoryOwners = async ({ path, options, rootSource, ownedReaders, outcome }) => {
2593
+ let cleanupFailure;
2594
+ const owners = [...ownedReaders].reverse().map((reader) => ({
2595
+ kind: "reader",
2596
+ reader,
2597
+ resource: `artifact reader for ${path}`
2598
+ }));
2599
+ if (rootSource !== undefined) owners.push({
2600
+ kind: "file-handle",
2601
+ handle: rootSource.owner,
2602
+ resource: `root artifact descriptor for ${path}`
2603
+ });
2604
+ for (const owner of owners) {
2605
+ const attempt = await options.resourceScope.release(owner);
2606
+ if (attempt.kind === "released") continue;
2607
+ const primary = cleanupFailure ?? (outcome.kind === "failed" ? outcome.cause : attempt.cause);
2608
+ cleanupFailure = ArtifactReaderFailure.withCleanup(primary, ArtifactReaderFailure.cleanupObservation(attempt.cause, owner.resource), outcome.kind === "completed" ? {
2609
+ kind: "artifact-inventory",
2610
+ inventory: outcome.snapshot
2611
+ } : undefined);
2612
+ }
2613
+ return cleanupFailure;
2614
+ };
2615
+ buildInventorySnapshot = async (input) => {
2616
+ const { path, metadata, rootFormat, rootDigest, rootSource, reader, signal } = input;
2617
+ materializeDirectoryNodes(input.occurrences, input.nodes);
2618
+ const rootNode = createRootNode({
2619
+ digest: rootDigest,
2620
+ occurrences: input.occurrences
2621
+ });
2622
+ input.nodes.set(rootNode.artifact_id, rootNode);
2623
+ rekeyOccurrences(rootNode.artifact_id, input.occurrences);
2624
+ const rootOccurrence = rootOccurrenceFor(rootNode, {
2625
+ size: metadata.size,
2626
+ executable: hostExecutableMarking(path, metadata),
2627
+ format: rootFormat,
2628
+ path
2629
+ });
2630
+ for (const occurrence of input.occurrences) if (occurrence.parent_occurrence_id === null && !input.unknownParentOccurrences.has(occurrence)) occurrence.parent_occurrence_id = rootOccurrence.occurrence_id;
2631
+ input.occurrences.unshift(rootOccurrence);
2632
+ const occurrenceById = new Map(input.occurrences.map((occurrence) => [occurrence.occurrence_id, occurrence]));
2633
+ const integrityContradictions = buildIntegrityContradictions(input.pendingContradictions, occurrenceById, rootNode);
2634
+ const edgeResult = createArtifactEdges(rootNode.artifact_id, input.occurrences, reader?.provenance()[0]);
2635
+ const { edges } = edgeResult;
2636
+ const orderedNodes = sortNodes([...input.nodes.values()]);
2637
+ const orderedOccurrences = sortOccurrences(input.occurrences);
2638
+ const orderedEdges = sortEdges(edges).map((edge, ordinal) => ({
2639
+ ...edge,
2640
+ ordinal
2641
+ }));
2642
+ await verifyRootDigest(path, rootDigest, rootSource, input.resourceScope, signal);
2643
+ const graphSha256 = artifactGraphDigest({
2644
+ nodes: orderedNodes,
2645
+ occurrences: orderedOccurrences,
2646
+ edges: orderedEdges,
2647
+ contradictions: integrityContradictions
2648
+ });
2649
+ const manifest = buildManifest({
2650
+ rootNode,
2651
+ rootFormat,
2652
+ graphSha256,
2653
+ orderedNodes,
2654
+ orderedOccurrences,
2655
+ orderedEdges
2656
+ });
2657
+ const traversal = inventoryCoverage(rootFormat, reader, input.traversal);
2658
+ const coverage = edgeResult.limitations.length === 0 ? traversal.coverage : {
2659
+ ...traversal.coverage,
2660
+ status: "unknown"
2661
+ };
2662
+ return {
2663
+ manifest,
2664
+ nodes: orderedNodes,
2665
+ occurrences: orderedOccurrences,
2666
+ edges: orderedEdges,
2667
+ provenance: reader?.provenance() ?? [],
2668
+ integrity_contradictions: integrityContradictions,
2669
+ coverage,
2670
+ coverage_status: coverage.status === "complete" ? "complete" : "partial",
2671
+ limitations: buildLimitations([...traversal.limitations, ...edgeResult.limitations], integrityContradictions, input.caseCollisionLimitation)
2672
+ };
2673
+ };
2674
+ buildIntegrityContradictions = (pending, occurrenceById, rootNode) => pending.map((contradiction) => {
2675
+ const occurrence = contradiction.occurrence;
2676
+ const parent = occurrence.parent_occurrence_id === null ? undefined : occurrenceById.get(occurrence.parent_occurrence_id);
2677
+ const parentArtifactId = parent?.artifact_id ?? rootNode.artifact_id;
2678
+ return {
2679
+ contradiction_id: artifactContradictionId({
2680
+ rootArtifactId: rootNode.artifact_id,
2681
+ logicalPath: occurrence.logical_path,
2682
+ declaredSha256: contradiction.declaredSha256,
2683
+ observedSha256: contradiction.observedSha256
2684
+ }),
2685
+ occurrence_id: occurrence.occurrence_id,
2686
+ parent_artifact_id: parentArtifactId,
2687
+ logical_path: occurrence.logical_path,
2688
+ declared_sha256: contradiction.declaredSha256,
2689
+ observed_sha256: contradiction.observedSha256,
2690
+ entry_kind: contradiction.entryKind,
2691
+ unpacked: contradiction.unpacked,
2692
+ trust: "observed-untrusted",
2693
+ provenance: "container-integrity-metadata-versus-observed-bytes",
2694
+ limitations: ["Observed bytes contradict declared integrity metadata and cannot support equivalence."]
2695
+ };
2696
+ });
2697
+ verifyRootDigest = async (path, rootDigest, rootSource, resourceScope, signal) => {
2698
+ if (rootDigest === null) return;
2699
+ const verified = rootSource === undefined ? await hashStableRootArtifact(path, resourceScope, signal) : await hashStableRootArtifactHandle(path, rootSource.handle, rootSource.initial, signal);
2700
+ if (verified.sha256 !== rootDigest.sha256 || verified.bytes !== rootDigest.bytes) throw new ArtifactReaderFailure("integrity", "Root artifact changed during inventory");
2701
+ };
2702
+ sortNodes = (nodes) => nodes.sort((left, right) => compareUnicodeCodePoints(left.artifact_id, right.artifact_id));
2703
+ sortOccurrences = (occurrences) => occurrences.sort((left, right) => compareUnicodeCodePoints(left.logical_path, right.logical_path));
2704
+ sortEdges = (edges) => edges.sort((left, right) => compareUnicodeCodePoints(left.edge_id, right.edge_id));
2705
+ buildManifest = ({ rootNode, rootFormat, graphSha256, orderedNodes, orderedOccurrences, orderedEdges }) => artifactInventoryResultSchema.shape.manifest.parse({
2706
+ manifest_id: artifactManifestId(rootNode.artifact_id, graphSha256),
2707
+ root_artifact_id: rootNode.artifact_id,
2708
+ root_sha256: rootNode.sha256,
2709
+ root_format: rootFormat,
2710
+ graph_sha256: graphSha256,
2711
+ node_count: orderedNodes.length,
2712
+ occurrence_count: orderedOccurrences.length,
2713
+ edge_count: orderedEdges.length
2714
+ });
2715
+ buildLimitations = (scopeLimitations, integrityContradictions, caseCollisionLimitation) => [
2716
+ ...scopeLimitations,
2717
+ ...caseCollisionLimitation === undefined ? [] : [caseCollisionLimitation],
2718
+ ...integrityContradictions.length === 0 ? [] : [`${String(integrityContradictions.length)} integrity contradiction(s) were recorded; mismatched content is observed-untrusted.`]
2719
+ ];
2720
+ })))();
2721
+ }
2722
+
2723
+ //#endregion
2724
+ export { AsarArtifactReader, DirectoryArtifactReader, MachOSliceArtifactReader, abortIfNeeded, hashReadable, init_ArtifactHash, init_AsarArtifactReader, init_DirectoryArtifactReader, init_MachOSliceArtifactReader, init_javascriptArtifactFiles, init_scanCanonical, isJavaScriptSourcePath, scanCanonicalArtifactInventoryInScope };