reverseport 0.0.0-stage → 1.2.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 (1489) hide show
  1. package/DISCLAIMER.md +136 -0
  2. package/LICENSE +22 -0
  3. package/README.md +289 -2
  4. package/RESPONSIBLE-USE.md +22 -0
  5. package/THIRD_PARTY_NOTICES.md +130 -0
  6. package/bin/reverseport.mjs +136 -0
  7. package/bridge/android/ReaJadxBridge.java +270 -0
  8. package/bridge/ghidra/ReaGhidraAnalysisOptions.java +38 -0
  9. package/bridge/ghidra/ReaGhidraApplySeeds.java +151 -0
  10. package/bridge/ghidra/ReaGhidraBridge.java +3858 -0
  11. package/bridge/ghidra/ReaGhidraBundleActivator.java +14 -0
  12. package/bridge/ghidra/ReaGhidraExtensions.java +113 -0
  13. package/bridge/ghidra/ReaGhidraMipsSoftFloat.java +176 -0
  14. package/bridge/ghidra/ReaGhidraNoReturnFix.java +123 -0
  15. package/bridge/ghidra/ReaGhidraPrepareCom.java +32 -0
  16. package/bridge/ghidra/ReaGhidraPrepareRaw.java +36 -0
  17. package/bridge/hopper_bridge.py +1162 -0
  18. package/bridge/mitmproxy/capture.py +208 -0
  19. package/bridge/native/NativeUIChildren.swift +27 -0
  20. package/bridge/native/ReaNativeUI.swift +171 -0
  21. package/bridge/native/rea_lldb_tracer.py +839 -0
  22. package/bridge/process/ProcessRunTokenReader.swift +339 -0
  23. package/bridge/process/ProcessRunTokenReaderMain.swift +35 -0
  24. package/bridge/pwndbg/core_context.py +101 -0
  25. package/bridge/pwndbg/launch.py +39 -0
  26. package/bridge/pwndbg/launch_impl.py +34 -0
  27. package/bridge/pwntools/decoder_runtime.py +59 -0
  28. package/bridge/pwntools/layout.py +39 -0
  29. package/bridge/pwntools/layout_impl.py +314 -0
  30. package/bridge/pwntools/recorded_crash.py +39 -0
  31. package/bridge/pwntools/recorded_crash_impl.py +147 -0
  32. package/dist/adb/AdbConfiguration.js +88 -0
  33. package/dist/adb/AdbDeviceOutput.js +191 -0
  34. package/dist/adb/AdbDirectoryListing.js +80 -0
  35. package/dist/adb/AdbHostFileName.js +34 -0
  36. package/dist/adb/AdbProvider.js +1227 -0
  37. package/dist/adb/AdbShellOutput.js +267 -0
  38. package/dist/android/AndroidTargetSnapshot.js +118 -0
  39. package/dist/android/JadxAnalysis.js +201 -0
  40. package/dist/android/JadxConfiguration.js +320 -0
  41. package/dist/android/JadxMcpTransport.js +188 -0
  42. package/dist/android/JadxProtocol.js +115 -0
  43. package/dist/android/JadxProvider.js +337 -0
  44. package/dist/android/JadxRelease.js +27 -0
  45. package/dist/android/JadxSession.js +172 -0
  46. package/dist/apktool/ApktoolConfiguration.js +120 -0
  47. package/dist/apktool/ApktoolDecodeOutput.js +142 -0
  48. package/dist/apktool/ApktoolProvider.js +522 -0
  49. package/dist/application/AnalysisContextQueries.js +128 -0
  50. package/dist/application/AnalysisDocument.js +32 -0
  51. package/dist/application/AnalysisProvider.js +27 -0
  52. package/dist/application/AppBundleExecutable.js +192 -0
  53. package/dist/application/BinaryTargetResolver.js +356 -0
  54. package/dist/application/BrowserEvidence.js +127 -0
  55. package/dist/application/BrowserObservationPort.js +1 -0
  56. package/dist/application/BrowserObservationService.js +86 -0
  57. package/dist/application/BrowserScenarioCapturePort.js +1 -0
  58. package/dist/application/BrowserScenarioCaptureService.js +17 -0
  59. package/dist/application/BrowserScenarioEvidence.js +28 -0
  60. package/dist/application/CallPathTracing.js +182 -0
  61. package/dist/application/CapabilityClientRequirements.js +17 -0
  62. package/dist/application/CapabilityInventory.js +525 -0
  63. package/dist/application/ClientConfigPath.js +35 -0
  64. package/dist/application/ClientConfigurationDocument.js +1196 -0
  65. package/dist/application/ClientConfigurationFiles.js +91 -0
  66. package/dist/application/ClientRegistrationEnvironment.js +39 -0
  67. package/dist/application/ClientRegistrationIdentity.js +80 -0
  68. package/dist/application/ClientRegistrationStatus.js +233 -0
  69. package/dist/application/DirectAnalysis.js +371 -0
  70. package/dist/application/DirectAnalysisCleanup.js +71 -0
  71. package/dist/application/DirectAnalysisDependencies.js +1 -0
  72. package/dist/application/DirectAnalysisStatus.js +22 -0
  73. package/dist/application/Doctor.js +349 -0
  74. package/dist/application/DoctorDiagnostics.js +169 -0
  75. package/dist/application/DoctorProviderIds.js +2 -0
  76. package/dist/application/DoctorScope.js +113 -0
  77. package/dist/application/DshCordisPatch.js +342 -0
  78. package/dist/application/DshCordisYaml.js +155 -0
  79. package/dist/application/EnhancedLiteralTracing.js +88 -0
  80. package/dist/application/EnhancedToolTypes.js +4 -0
  81. package/dist/application/EnhancedTools.js +428 -0
  82. package/dist/application/EvidenceBundleCommands.js +70 -0
  83. package/dist/application/EvidenceBundleFiles.js +79 -0
  84. package/dist/application/EvidenceInputResolver.js +30 -0
  85. package/dist/application/FunctionAnalysisEvidence.js +34 -0
  86. package/dist/application/GeminiClientSettings.js +139 -0
  87. package/dist/application/HermesClientHome.js +115 -0
  88. package/dist/application/HopperDownload.js +39 -0
  89. package/dist/application/InventoryProjectionEvidence.js +44 -0
  90. package/dist/application/InvestigationProviders.js +130 -0
  91. package/dist/application/JsonFiles.js +225 -0
  92. package/dist/application/JsonInputFile.js +410 -0
  93. package/dist/application/LinuxHopper.js +232 -0
  94. package/dist/application/MacHopper.js +235 -0
  95. package/dist/application/MipsElfMetadata.js +175 -0
  96. package/dist/application/MipsElfSharedLoad.js +164 -0
  97. package/dist/application/OptionalObservationProviders.js +3 -0
  98. package/dist/application/ProcedureAddressResolution.js +11 -0
  99. package/dist/application/ProgressReporter.js +30 -0
  100. package/dist/application/ProviderOperationExecution.js +31 -0
  101. package/dist/application/RealHopperAssertions.js +135 -0
  102. package/dist/application/ReconstructionCoverageService.js +22 -0
  103. package/dist/application/ReconstructionObligationAuthority.js +72 -0
  104. package/dist/application/ReconstructionObligationCandidates.js +286 -0
  105. package/dist/application/ReconstructionObligationLedgerDiagnostics.js +47 -0
  106. package/dist/application/ReconstructionObligationLedgerEvaluation.js +238 -0
  107. package/dist/application/ReconstructionObligationLedgerProjection.js +15 -0
  108. package/dist/application/ReconstructionObligationLedgerService.js +54 -0
  109. package/dist/application/ReconstructionObligationOriginalCases.js +34 -0
  110. package/dist/application/ReconstructionObligationPolicies.js +132 -0
  111. package/dist/application/ReferenceSourceImport.js +200 -0
  112. package/dist/application/ReferenceSourceImportEntries.js +151 -0
  113. package/dist/application/ReferenceSourceImportPolicy.js +125 -0
  114. package/dist/application/ReferenceSourceImportTypes.js +47 -0
  115. package/dist/application/ReferenceSourceVcsAdapter.js +180 -0
  116. package/dist/application/RegularFileRead.js +120 -0
  117. package/dist/application/Setup.js +408 -0
  118. package/dist/application/SetupClientConfiguration.js +314 -0
  119. package/dist/application/SetupClients.js +44 -0
  120. package/dist/application/SetupHost.js +203 -0
  121. package/dist/application/SetupInstallFailure.js +77 -0
  122. package/dist/application/SetupPlan.js +210 -0
  123. package/dist/application/SetupRegistrationEnvironment.js +5 -0
  124. package/dist/application/SetupSkill.js +248 -0
  125. package/dist/application/SetupTypes.js +17 -0
  126. package/dist/application/SupportedClients.js +469 -0
  127. package/dist/application/TypeScriptEmittedSourceCandidates.js +23 -0
  128. package/dist/application/Uninstall.js +452 -0
  129. package/dist/application/UninstallFailure.js +14 -0
  130. package/dist/application/Update.js +137 -0
  131. package/dist/application/UpdateFailure.js +17 -0
  132. package/dist/application/UpdateMaintenance.js +111 -0
  133. package/dist/application/UpdateRuntime.js +264 -0
  134. package/dist/application/Utf8JsonInput.js +71 -0
  135. package/dist/application/ValidateSelectedWebScript.js +27 -0
  136. package/dist/application/WebModulePorts.js +1 -0
  137. package/dist/application/WebModuleTraceService.js +214 -0
  138. package/dist/application/WebNetworkCapturePort.js +1 -0
  139. package/dist/application/WebNetworkCaptureService.js +134 -0
  140. package/dist/application/WebRuntimePort.js +1 -0
  141. package/dist/application/WebRuntimeService.js +75 -0
  142. package/dist/application/WebScriptArtifactPort.js +1 -0
  143. package/dist/application/WebScriptExportService.js +214 -0
  144. package/dist/application/WebSourceLocationPorts.js +1 -0
  145. package/dist/application/WebSourceLocationService.js +177 -0
  146. package/dist/application/WindowsCapabilities.js +87 -0
  147. package/dist/application/WorkflowEvidence.js +105 -0
  148. package/dist/application/XrefsAddressResolution.js +45 -0
  149. package/dist/application/adb/AdbDeviceAnalysisPort.js +1 -0
  150. package/dist/application/adb/AdbDeviceAnalysisService.js +13 -0
  151. package/dist/application/analysisView/AnalysisViewService.js +133 -0
  152. package/dist/application/android/AndroidAnalysisPort.js +1 -0
  153. package/dist/application/android/AndroidAnalysisService.js +37 -0
  154. package/dist/application/android/AndroidApplicationService.js +17 -0
  155. package/dist/application/android/AndroidSearchEvidenceSummary.js +100 -0
  156. package/dist/application/apktool/ApktoolResourceAnalysisPort.js +1 -0
  157. package/dist/application/apktool/ApktoolResourceAnalysisService.js +13 -0
  158. package/dist/application/apple/AppleApplicationService.js +17 -0
  159. package/dist/application/artifacts/ArtifactExtractionDestination.js +5 -0
  160. package/dist/application/binary/AbortablePromise.js +28 -0
  161. package/dist/application/binary/AnalysisClientCleanup.js +15 -0
  162. package/dist/application/binary/AnalysisProviderEvaluation.js +77 -0
  163. package/dist/application/binary/AnalysisProviderRegistry.js +235 -0
  164. package/dist/application/binary/AnalysisSnapshotCache.js +232 -0
  165. package/dist/application/binary/AnalysisSnapshotFiles.js +96 -0
  166. package/dist/application/binary/BinarySession.js +605 -0
  167. package/dist/application/binary/BinarySessionComposition.js +9 -0
  168. package/dist/application/binary/BinarySessionExecution.js +66 -0
  169. package/dist/application/binary/BinarySessionOpen.js +66 -0
  170. package/dist/application/binary/BinarySessionPort.js +1 -0
  171. package/dist/application/binary/BinarySessionRecords.js +216 -0
  172. package/dist/application/binary/BinarySessionStatus.js +219 -0
  173. package/dist/application/binary/BinaryTargetSummary.js +9 -0
  174. package/dist/application/binary/CompositeProvider.js +103 -0
  175. package/dist/application/binary/LazyAnalysisProvider.js +105 -0
  176. package/dist/application/binary/SessionProviderRouter.js +118 -0
  177. package/dist/application/binaryDiagnostics/BinaryLayoutPort.js +1 -0
  178. package/dist/application/binaryDiagnostics/BinaryLayoutService.js +60 -0
  179. package/dist/application/binaryDiagnostics/PeResourcesPort.js +1 -0
  180. package/dist/application/binaryDiagnostics/PeResourcesService.js +111 -0
  181. package/dist/application/binaryDiagnostics/RecordedCrashPort.js +1 -0
  182. package/dist/application/binaryDiagnostics/RecordedCrashService.js +63 -0
  183. package/dist/application/evm/EvmInterfacePort.js +1 -0
  184. package/dist/application/evm/EvmInterfaceService.js +67 -0
  185. package/dist/application/firmware/FirmwareAnalysisPort.js +1 -0
  186. package/dist/application/firmware/FirmwareAnalysisService.js +38 -0
  187. package/dist/application/go/GoBinaryPort.js +1 -0
  188. package/dist/application/go/GoBinaryService.js +77 -0
  189. package/dist/application/harmony/HarmonyApplicationService.js +17 -0
  190. package/dist/application/homebrew.js +67 -0
  191. package/dist/application/investigation/EvidenceLedger.js +338 -0
  192. package/dist/application/investigation/InspectEvidenceBundle.js +18 -0
  193. package/dist/application/investigation/InvestigationRecordPort.js +1 -0
  194. package/dist/application/investigation/InvestigationRecords.js +65 -0
  195. package/dist/application/investigation/UnknownEvidence.js +37 -0
  196. package/dist/application/javascript/ElectronActiveEvidence.js +29 -0
  197. package/dist/application/javascript/ElectronActiveObservationPort.js +1 -0
  198. package/dist/application/javascript/ElectronActiveObservationService.js +51 -0
  199. package/dist/application/javascript/ElectronBoundaryAnalysis.js +118 -0
  200. package/dist/application/javascript/ElectronBoundaryGraph.js +11 -0
  201. package/dist/application/javascript/ElectronBoundaryGraphCallPaths.js +134 -0
  202. package/dist/application/javascript/ElectronBoundaryGraphContext.js +63 -0
  203. package/dist/application/javascript/ElectronBoundaryGraphIpc.js +261 -0
  204. package/dist/application/javascript/ElectronBoundaryGraphNative.js +102 -0
  205. package/dist/application/javascript/ElectronBoundaryGraphWindows.js +224 -0
  206. package/dist/application/javascript/ElectronEvidence.js +37 -0
  207. package/dist/application/javascript/ElectronObservationPort.js +1 -0
  208. package/dist/application/javascript/ElectronObservationService.js +26 -0
  209. package/dist/application/javascript/JavaScriptAnalysisControl.js +34 -0
  210. package/dist/application/javascript/JavaScriptApplicationEvidence.js +49 -0
  211. package/dist/application/javascript/JavaScriptApplicationEvidenceGraph.js +173 -0
  212. package/dist/application/javascript/JavaScriptApplicationService.js +170 -0
  213. package/dist/application/javascript/JavaScriptApplicationWorkflowEvidence.js +67 -0
  214. package/dist/application/javascript/JavaScriptApplicationWorkflowService.js +194 -0
  215. package/dist/application/javascript/JavaScriptArtifactAnalysis.js +431 -0
  216. package/dist/application/javascript/JavaScriptArtifactAnalysisTypes.js +1 -0
  217. package/dist/application/javascript/JavaScriptArtifactGraphAccumulator.js +89 -0
  218. package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +193 -0
  219. package/dist/application/javascript/JavaScriptArtifactGraphBundlers.js +229 -0
  220. package/dist/application/javascript/JavaScriptArtifactGraphContext.js +194 -0
  221. package/dist/application/javascript/JavaScriptArtifactGraphDocuments.js +160 -0
  222. package/dist/application/javascript/JavaScriptArtifactGraphEvidence.js +85 -0
  223. package/dist/application/javascript/JavaScriptArtifactGraphFindings.js +349 -0
  224. package/dist/application/javascript/JavaScriptArtifactGraphStructure.js +424 -0
  225. package/dist/application/javascript/JavaScriptArtifactPathResolution.js +836 -0
  226. package/dist/application/javascript/JavaScriptArtifactReconstruction.js +245 -0
  227. package/dist/application/javascript/JavaScriptArtifactReconstructionInput.js +12 -0
  228. package/dist/application/javascript/JavaScriptJsonModules.js +40 -0
  229. package/dist/application/javascript/JavaScriptModuleRelationships.js +304 -0
  230. package/dist/application/javascript/JavaScriptRecoveryPort.js +1 -0
  231. package/dist/application/javascript/JavaScriptRecoveryService.js +77 -0
  232. package/dist/application/javascript/JavaScriptRuntimeObservationEvidence.js +36 -0
  233. package/dist/application/javascript/JavaScriptRuntimeObservationPort.js +1 -0
  234. package/dist/application/javascript/JavaScriptRuntimeObservationService.js +28 -0
  235. package/dist/application/javascript/JavaScriptRuntimeReconciliationEvidence.js +24 -0
  236. package/dist/application/javascript/JavaScriptRuntimeReconciliationService.js +52 -0
  237. package/dist/application/javascript/JavaScriptSemanticGraphAsyncProjection.js +163 -0
  238. package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +527 -0
  239. package/dist/application/javascript/JavaScriptSemanticGraphChildProcessProjection.js +165 -0
  240. package/dist/application/javascript/JavaScriptSemanticGraphConstruction.js +156 -0
  241. package/dist/application/javascript/JavaScriptSemanticGraphDataProjection.js +216 -0
  242. package/dist/application/javascript/JavaScriptSemanticGraphElectronProjection.js +61 -0
  243. package/dist/application/javascript/JavaScriptSemanticGraphEvidence.js +86 -0
  244. package/dist/application/javascript/JavaScriptSemanticGraphFingerprintProjection.js +25 -0
  245. package/dist/application/javascript/JavaScriptSemanticGraphFlowProjection.js +183 -0
  246. package/dist/application/javascript/JavaScriptSemanticGraphObjectProjection.js +112 -0
  247. package/dist/application/javascript/JavaScriptSemanticGraphProjection.js +144 -0
  248. package/dist/application/javascript/JavaScriptSemanticGraphResourceProjection.js +58 -0
  249. package/dist/application/javascript/JavaScriptSemanticGraphValueProjection.js +136 -0
  250. package/dist/application/javascript/JavaScriptSemanticTraceService.js +41 -0
  251. package/dist/application/jeb/JebAnalysisPort.js +1 -0
  252. package/dist/application/jeb/JebAnalysisService.js +13 -0
  253. package/dist/application/managed/ManagedApplicationGraphService.js +55 -0
  254. package/dist/application/managed/ManagedMemberComparisonService.js +125 -0
  255. package/dist/application/managed/ManagedNativeVerificationService.js +40 -0
  256. package/dist/application/managed/ManagedReconstructionService.js +59 -0
  257. package/dist/application/native/NativeApiInspection.js +77 -0
  258. package/dist/application/native/NativeCallRoutes.js +73 -0
  259. package/dist/application/native/NativeDispatchMetadataInspection.js +33 -0
  260. package/dist/application/native/NativeUiActionTrace.js +427 -0
  261. package/dist/application/native/NativeValueTrace.js +340 -0
  262. package/dist/application/process/ProcessCli.js +190 -0
  263. package/dist/application/process/ProcessEvidence.js +30 -0
  264. package/dist/application/wasm/WasmArtifactPort.js +1 -0
  265. package/dist/application/wasm/WasmArtifactService.js +72 -0
  266. package/dist/application/workflowInputError.js +18 -0
  267. package/dist/artifacts/ArtifactHash.js +29 -0
  268. package/dist/artifacts/ArtifactPaths.js +167 -0
  269. package/dist/artifacts/ArtifactProvider.js +280 -0
  270. package/dist/artifacts/ArtifactProviderMetadata.js +34 -0
  271. package/dist/artifacts/ArtifactReader.js +77 -0
  272. package/dist/artifacts/ArtifactResourceScope.js +103 -0
  273. package/dist/artifacts/AsarArtifactReader.js +518 -0
  274. package/dist/artifacts/AsarEntryStream.js +76 -0
  275. package/dist/artifacts/AsarHeader.js +24 -0
  276. package/dist/artifacts/DirectoryArtifactReader.js +292 -0
  277. package/dist/artifacts/MachOSliceArtifactReader.js +342 -0
  278. package/dist/artifacts/NativeDmgArtifactReader.js +508 -0
  279. package/dist/artifacts/NativeDmgOwnership.js +109 -0
  280. package/dist/artifacts/SafeOutputTree.js +394 -0
  281. package/dist/artifacts/SafeOutputTreeCleanup.js +45 -0
  282. package/dist/artifacts/SafeOutputTreeCreationFailure.js +20 -0
  283. package/dist/artifacts/SafeOutputTreeIdentity.js +42 -0
  284. package/dist/artifacts/SafeOutputTreeReadback.js +33 -0
  285. package/dist/artifacts/StreamBytes.js +10 -0
  286. package/dist/artifacts/ZipArtifactReader.js +222 -0
  287. package/dist/artifacts/apple/AppleAssetCatalogAnalysis.js +190 -0
  288. package/dist/artifacts/apple/DylibResolutionReader.js +269 -0
  289. package/dist/artifacts/apple/InterfaceBuilderAnalysis.js +500 -0
  290. package/dist/artifacts/apple/InterfaceBuilderDecodeBudget.js +233 -0
  291. package/dist/artifacts/apple/KeyedArchiveReader.js +163 -0
  292. package/dist/artifacts/apple/MachoLoadCommandReader.js +393 -0
  293. package/dist/artifacts/apple/NibArchive.js +338 -0
  294. package/dist/artifacts/apple/NibViewHierarchy.js +157 -0
  295. package/dist/artifacts/apple/PlistNumberLiterals.js +164 -0
  296. package/dist/artifacts/extraction/ArtifactExtraction.js +253 -0
  297. package/dist/artifacts/hostExecutableMarking.js +16 -0
  298. package/dist/artifacts/inventory/ArtifactGraphConstruction.js +343 -0
  299. package/dist/artifacts/inventory/ArtifactInventory.js +16 -0
  300. package/dist/artifacts/inventory/classify.js +94 -0
  301. package/dist/artifacts/inventory/hashStableRootArtifact.js +70 -0
  302. package/dist/artifacts/inventory/reader.js +40 -0
  303. package/dist/artifacts/inventory/scanCanonical.js +213 -0
  304. package/dist/artifacts/inventory/scanReader.js +169 -0
  305. package/dist/artifacts/inventory/types.js +3 -0
  306. package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +317 -0
  307. package/dist/artifacts/javascript/JavaScriptArtifactReader.js +6 -0
  308. package/dist/artifacts/javascript/JavaScriptSourceAnalysis.js +3 -0
  309. package/dist/artifacts/readStableArtifact.js +68 -0
  310. package/dist/browser/BrowserProcessStartup.js +89 -0
  311. package/dist/browser/BrowserScenarioPartialObservation.js +127 -0
  312. package/dist/browser/BrowserScenarioSecrets.js +137 -0
  313. package/dist/browser/BrowserScenarioSessionPort.js +1 -0
  314. package/dist/browser/CdpAuthorizedMainFrame.js +16 -0
  315. package/dist/browser/CdpAuthorizedTarget.js +22 -0
  316. package/dist/browser/CdpBrowserProvider.js +276 -0
  317. package/dist/browser/CdpCaptureCompleteness.js +92 -0
  318. package/dist/browser/CdpCaptureDocuments.js +375 -0
  319. package/dist/browser/CdpCaptureDomSvg.js +210 -0
  320. package/dist/browser/CdpCaptureEventBodyShapes.js +55 -0
  321. package/dist/browser/CdpCaptureEventHandlers.js +463 -0
  322. package/dist/browser/CdpCaptureEventHelpers.js +84 -0
  323. package/dist/browser/CdpCaptureEventState.js +1 -0
  324. package/dist/browser/CdpCaptureEventTypes.js +5 -0
  325. package/dist/browser/CdpCaptureEvents.js +199 -0
  326. package/dist/browser/CdpCaptureStorage.js +86 -0
  327. package/dist/browser/CdpCaptureStorageFingerprints.js +320 -0
  328. package/dist/browser/CdpCaptureValues.js +91 -0
  329. package/dist/browser/CdpCommandRejection.js +17 -0
  330. package/dist/browser/CdpConnection.js +303 -0
  331. package/dist/browser/CdpElectronInspection.js +253 -0
  332. package/dist/browser/CdpElectronProvider.js +115 -0
  333. package/dist/browser/CdpElectronScriptEvents.js +55 -0
  334. package/dist/browser/CdpElectronScripts.js +65 -0
  335. package/dist/browser/CdpElectronWorkers.js +57 -0
  336. package/dist/browser/CdpEndpoint.js +217 -0
  337. package/dist/browser/CdpObservationSession.js +332 -0
  338. package/dist/browser/CdpOptionalCommand.js +14 -0
  339. package/dist/browser/CdpPageCapture.js +278 -0
  340. package/dist/browser/CdpPageCaptureScripts.js +79 -0
  341. package/dist/browser/CdpPageCaptureWorkers.js +46 -0
  342. package/dist/browser/CdpSafeMetadata.js +284 -0
  343. package/dist/browser/CdpScreenshot.js +110 -0
  344. package/dist/browser/CdpTargetEvents.js +8 -0
  345. package/dist/browser/CdpTargetSession.js +65 -0
  346. package/dist/browser/CdpWebMcpDiscovery.js +361 -0
  347. package/dist/browser/ElectronFileScope.js +135 -0
  348. package/dist/browser/PlaywrightBrowserScenarioProvider.js +301 -0
  349. package/dist/browser/PlaywrightElectronActiveActions.js +257 -0
  350. package/dist/browser/PlaywrightElectronActiveProjection.js +141 -0
  351. package/dist/browser/PlaywrightElectronActiveProvider.js +293 -0
  352. package/dist/browser/PlaywrightExecutionBoundary.js +53 -0
  353. package/dist/browser/PlaywrightScenarioActions.js +58 -0
  354. package/dist/browser/PlaywrightScenarioArtifacts.js +162 -0
  355. package/dist/browser/PlaywrightScenarioBrowser.js +412 -0
  356. package/dist/browser/PlaywrightScenarioEvents.js +253 -0
  357. package/dist/browser/PlaywrightScenarioSession.js +279 -0
  358. package/dist/browser/PlaywrightScenarioStorage.js +507 -0
  359. package/dist/browser/PngVisualDiff.js +380 -0
  360. package/dist/browser/WebSourceMapFetcher.js +718 -0
  361. package/dist/browser/assets/LocalWebScriptArtifacts.js +89 -0
  362. package/dist/browser/assets/PageScriptCapture.js +32 -0
  363. package/dist/browser/assets/PublishWebScripts.js +140 -0
  364. package/dist/browser/assets/ScenarioScriptCapture.js +73 -0
  365. package/dist/browser/assets/ScriptCaptureAdapters.js +57 -0
  366. package/dist/browser/assets/WebArtifactReads.js +78 -0
  367. package/dist/browser/assets/WebSourceLocationArtifacts.js +41 -0
  368. package/dist/browser/execution/CdpEventListeners.js +79 -0
  369. package/dist/browser/execution/CdpExecutionCapture.js +135 -0
  370. package/dist/browser/execution/CdpExecutionCollection.js +57 -0
  371. package/dist/browser/execution/CdpExecutionWindow.js +100 -0
  372. package/dist/browser/execution/CdpListenerSelector.js +22 -0
  373. package/dist/browser/execution/CdpPreciseCoverage.js +45 -0
  374. package/dist/browser/execution/CdpRuntimeInitiator.js +18 -0
  375. package/dist/browser/execution/CdpRuntimeProtocol.js +106 -0
  376. package/dist/browser/execution/CdpRuntimeRequests.js +81 -0
  377. package/dist/browser/execution/CdpRuntimeSession.js +163 -0
  378. package/dist/browser/execution/CdpRuntimeSources.js +223 -0
  379. package/dist/browser/execution/CdpWebRuntimeProvider.js +51 -0
  380. package/dist/browser/history/CaptureFailures.js +153 -0
  381. package/dist/browser/history/CaptureFormatError.js +10 -0
  382. package/dist/browser/history/CaptureRedaction.js +68 -0
  383. package/dist/browser/history/CaptureRelease.js +23 -0
  384. package/dist/browser/history/HarCapture.js +179 -0
  385. package/dist/browser/history/HarCaptureAdapter.js +23 -0
  386. package/dist/browser/history/HarCaptureProcess.js +49 -0
  387. package/dist/browser/history/HarJson.js +92 -0
  388. package/dist/browser/history/HarSchema.js +72 -0
  389. package/dist/browser/history/HistoricalCaptureDecoder.js +198 -0
  390. package/dist/browser/history/HistoricalCaptureFormatAdapter.js +1 -0
  391. package/dist/browser/history/MitmproxyCaptureAdapter.js +46 -0
  392. package/dist/browser/modules/NativeModuleResolver.js +277 -0
  393. package/dist/browser/modules/WebModuleArtifacts.js +41 -0
  394. package/dist/browser/network/PlaywrightNetworkContent.js +71 -0
  395. package/dist/browser/network/PlaywrightScenarioNetwork.js +180 -0
  396. package/dist/browser/providerIdentities.js +24 -0
  397. package/dist/catalogIdentity.js +65 -0
  398. package/dist/cli/adbCommands.js +337 -0
  399. package/dist/cli/analysisSelector.js +23 -0
  400. package/dist/cli/analysisViewCommands.js +74 -0
  401. package/dist/cli/androidCommands.js +91 -0
  402. package/dist/cli/apktoolCommands.js +53 -0
  403. package/dist/cli/applicationCommands.js +173 -0
  404. package/dist/cli/artifactCommands.js +160 -0
  405. package/dist/cli/binaryDiagnosticsCommands.js +57 -0
  406. package/dist/cli/browserAdvancedCommands.js +189 -0
  407. package/dist/cli/browserCommands.js +125 -0
  408. package/dist/cli/commandCancellation.js +24 -0
  409. package/dist/cli/coreAnalysisCommands.js +7 -0
  410. package/dist/cli/coreBinaryCommands.js +283 -0
  411. package/dist/cli/coreNativeCommands.js +269 -0
  412. package/dist/cli/electronCommands.js +150 -0
  413. package/dist/cli/evmCommands.js +33 -0
  414. package/dist/cli/firmwareCommands.js +61 -0
  415. package/dist/cli/goCommands.js +21 -0
  416. package/dist/cli/interactiveSetup.js +236 -0
  417. package/dist/cli/javascriptApplicationAnalysis.js +34 -0
  418. package/dist/cli/javascriptRecoveryCommands.js +59 -0
  419. package/dist/cli/jebCommands.js +99 -0
  420. package/dist/cli/jsonOutput.js +46 -0
  421. package/dist/cli/managedCommands.js +129 -0
  422. package/dist/cli/managedProjectGraphCommand.js +24 -0
  423. package/dist/cli/nativeCallCommands.js +33 -0
  424. package/dist/cli/omittableDefaults.js +50 -0
  425. package/dist/cli/options.js +33 -0
  426. package/dist/cli/processCommands.js +25 -0
  427. package/dist/cli/referenceSourceImportStatus.js +22 -0
  428. package/dist/cli/setupCommands.js +189 -0
  429. package/dist/cli/streamedJsonOutput.js +134 -0
  430. package/dist/cli/types.js +1 -0
  431. package/dist/cli/utilityCommands.js +226 -0
  432. package/dist/cli/wasmCommands.js +44 -0
  433. package/dist/cli/webModuleCommands.js +60 -0
  434. package/dist/cli/webNetworkCaptureCommands.js +40 -0
  435. package/dist/cli/webRuntimeCommands.js +60 -0
  436. package/dist/cli/webScriptCommands.js +50 -0
  437. package/dist/cli/webSourceLocationCommands.js +54 -0
  438. package/dist/cli-runtime/AnalysisProvider-CeyX2u-b.js +25 -0
  439. package/dist/cli-runtime/AnalysisSnapshotFiles-BuK_ymw5.js +523 -0
  440. package/dist/cli-runtime/ArtifactReader-BXkffc1D.js +55 -0
  441. package/dist/cli-runtime/ArtifactResourceScope-CZqLEfbb.js +108 -0
  442. package/dist/cli-runtime/AsarHeader-CnzOzYEH.js +31 -0
  443. package/dist/cli-runtime/BinaryTargetResolver-CKRfFhLj.js +965 -0
  444. package/dist/cli-runtime/BoundedFileBytes-BU30odTm.js +39 -0
  445. package/dist/cli-runtime/ClientConfigPath-c6jr6INc.js +36 -0
  446. package/dist/cli-runtime/ClientConfigurationDocument-D0ZqgTCv.js +1522 -0
  447. package/dist/cli-runtime/ClientRegistrationStatus-DGpwJ4ry.js +422 -0
  448. package/dist/cli-runtime/DirectAnalysis-DW3MvxW0.js +500 -0
  449. package/dist/cli-runtime/Doctor-CzwYS9nB.js +862 -0
  450. package/dist/cli-runtime/ElectronFileScope-C1hUEp36.js +1419 -0
  451. package/dist/cli-runtime/ExecFileOutput-Czbj-HpV.js +106 -0
  452. package/dist/cli-runtime/IdaConfiguration-rEjpuRQ1.js +854 -0
  453. package/dist/cli-runtime/InterfaceBuilderDecodeBudget-DT74BY9z.js +225 -0
  454. package/dist/cli-runtime/InventoryProjectionEvidence-Dt4Og45O.js +49 -0
  455. package/dist/cli-runtime/InvestigationProviders-D-QCy-4c.js +117 -0
  456. package/dist/cli-runtime/JavaScriptApplicationEvidenceGraph-CODAjVru.js +160 -0
  457. package/dist/cli-runtime/JavaScriptApplicationWorkflowEvidence-CCtwSg8r.js +75 -0
  458. package/dist/cli-runtime/JavaScriptWorkerMemoryLimit-CJeBSMPx.js +83 -0
  459. package/dist/cli-runtime/JsonFiles-Ce_O5NcH.js +708 -0
  460. package/dist/cli-runtime/ManagedSnapshot-DthWfmy9.js +3622 -0
  461. package/dist/cli-runtime/OwnedCommand-CnK8-h3N.js +106 -0
  462. package/dist/cli-runtime/PrivateRuntimeRoot-KNg6qLwo.js +237 -0
  463. package/dist/cli-runtime/ProcessOwnership-AOJaszxt.js +1310 -0
  464. package/dist/cli-runtime/ProviderDeadline-BSbNOmuW.js +89 -0
  465. package/dist/cli-runtime/RegularFile-CL6meBxi.js +114 -0
  466. package/dist/cli-runtime/RegularFileRead-BMh5FMXd.js +115 -0
  467. package/dist/cli-runtime/SafeOutputTree-D8z2Zrnu.js +512 -0
  468. package/dist/cli-runtime/SetupHost-CzzRF89z.js +842 -0
  469. package/dist/cli-runtime/SupportedClients-BrZ2qZVg.js +671 -0
  470. package/dist/cli-runtime/UninstallFailure-1blyKXHE.js +22 -0
  471. package/dist/cli-runtime/Update-DF55X_N2.js +143 -0
  472. package/dist/cli-runtime/UpdateFailure-BcFNxEZZ.js +24 -0
  473. package/dist/cli-runtime/WindowsBatchCommand-5gT-d7O4.js +45 -0
  474. package/dist/cli-runtime/ZipArtifactReader-Db65WuM_.js +380 -0
  475. package/dist/cli-runtime/analysisErrorCleanup-DaUQNiQd.js +32 -0
  476. package/dist/cli-runtime/analysisErrorPresentation-DZrKL8kS.js +331 -0
  477. package/dist/cli-runtime/application__DirectAnalysisStatus-OZFIFjZr.js +93 -0
  478. package/dist/cli-runtime/application__EnhancedTools-C__HAdqG.js +1728 -0
  479. package/dist/cli-runtime/application__FunctionAnalysisEvidence-fWSgvV74.js +41 -0
  480. package/dist/cli-runtime/application__ReconstructionCoverageService-DlNt-4TY.js +32 -0
  481. package/dist/cli-runtime/application__ReconstructionObligationLedgerService-CEpbUv-7.js +813 -0
  482. package/dist/cli-runtime/application__Setup-BExVGpqG.js +540 -0
  483. package/dist/cli-runtime/application__Uninstall-BVgWDCPN.js +349 -0
  484. package/dist/cli-runtime/application__UpdateRuntime-Dj6UIhHQ.js +358 -0
  485. package/dist/cli-runtime/application__android__AndroidApplicationService-CyynwW6Z.js +31 -0
  486. package/dist/cli-runtime/application__apple__AppleApplicationService-BNPcWeL8.js +31 -0
  487. package/dist/cli-runtime/application__harmony__HarmonyApplicationService-W66PwMvx.js +31 -0
  488. package/dist/cli-runtime/application__javascript__ElectronActiveObservationService-D8VbeCxz.js +85 -0
  489. package/dist/cli-runtime/application__javascript__ElectronObservationService-FmXFG4f2.js +63 -0
  490. package/dist/cli-runtime/application__javascript__JavaScriptApplicationService-D-dVrmAY.js +10467 -0
  491. package/dist/cli-runtime/application__javascript__JavaScriptApplicationWorkflowService-Cb0jmh8J.js +2284 -0
  492. package/dist/cli-runtime/application__javascript__JavaScriptRuntimeReconciliationService-D55gO7Gq.js +88 -0
  493. package/dist/cli-runtime/application__javascript__JavaScriptSemanticTraceService-DivM-Ym-.js +298 -0
  494. package/dist/cli-runtime/artifactOperationError-Wd0PRLIZ.js +27 -0
  495. package/dist/cli-runtime/artifacts__ArtifactProvider-B_4h3RAw.js +2091 -0
  496. package/dist/cli-runtime/binary-9Gt3vJ1P.js +12990 -0
  497. package/dist/cli-runtime/browserObservationError-D73SM55P.js +40 -0
  498. package/dist/cli-runtime/browserScenario-CTNr5ISp.js +5543 -0
  499. package/dist/cli-runtime/catalogIdentity-EYVhBUYJ.js +339 -0
  500. package/dist/cli-runtime/cli.js +28528 -0
  501. package/dist/cli-runtime/cliOutput-CoDmWVu5.js +98 -0
  502. package/dist/cli-runtime/cliOutput.js +5 -0
  503. package/dist/cli-runtime/composition__browserScenario-DNr3A_BM.js +2318 -0
  504. package/dist/cli-runtime/composition__electronObservation-DNw1f38M.js +550 -0
  505. package/dist/cli-runtime/composition__electronScenario-Cu7PX270.js +586 -0
  506. package/dist/cli-runtime/configurationErrors-ByuF6gMR.js +49 -0
  507. package/dist/cli-runtime/doctorRuntime-D5y43lEp.js +162 -0
  508. package/dist/cli-runtime/dosMz-pwwUuxyC.js +65 -0
  509. package/dist/cli-runtime/dotnet__ManagedStaticProvider-BSnWggeb.js +5 -0
  510. package/dist/cli-runtime/enhancedInputs-K8C_o3b4.js +56 -0
  511. package/dist/cli-runtime/javascriptApplicationGraph-DUWeec4O.js +940 -0
  512. package/dist/cli-runtime/javascriptExportReturnShapeProjection-BVbnAdOd.js +78 -0
  513. package/dist/cli-runtime/javascriptExportShapeComparisonSchemas-BzSil7ft.js +1153 -0
  514. package/dist/cli-runtime/javascriptRuntimeObservation-9xTNoKY2.js +1215 -0
  515. package/dist/cli-runtime/javascriptRuntimeReconciliation-CneBtMvx.js +1437 -0
  516. package/dist/cli-runtime/javascriptRuntimeReconciliationSchemas-D1Mrb_Y0.js +245 -0
  517. package/dist/cli-runtime/javascriptSemanticTraceSchemas-BHItrqIA.js +126 -0
  518. package/dist/cli-runtime/lipo-BCA3wVyN.js +365 -0
  519. package/dist/cli-runtime/logger-CKq3JfbZ.js +34 -0
  520. package/dist/cli-runtime/machoContainer-DxxkB2b0.js +52 -0
  521. package/dist/cli-runtime/managedApplicationGraph-BqOr01E6.js +1116 -0
  522. package/dist/cli-runtime/managedToolContracts-BSy4TRaK.js +80 -0
  523. package/dist/cli-runtime/mcpDoctor.js +342 -0
  524. package/dist/cli-runtime/mcpStartupPolicy-Bb7TMLzn.js +18 -0
  525. package/dist/cli-runtime/native__NativeMacOSProvider-BIG9iCcj.js +4415 -0
  526. package/dist/cli-runtime/plistValue-KM-SqiXe.js +47 -0
  527. package/dist/cli-runtime/propertyListKeys-DejfMb-U.js +86 -0
  528. package/dist/cli-runtime/providerAdapterError-SRSE_gzN.js +27 -0
  529. package/dist/cli-runtime/providerCleanupError-Do66qCEp.js +27 -0
  530. package/dist/cli-runtime/providerIdentities-Ao1XTvwx.js +31 -0
  531. package/dist/cli-runtime/providerOperationHealth-DSTcYPJe.js +577 -0
  532. package/dist/cli-runtime/providerStartupTimeout-Be8B1Ro8.js +16 -0
  533. package/dist/cli-runtime/readFileHandleChunks-dp60iZ6v.js +38 -0
  534. package/dist/cli-runtime/reconstructionObligationLedgerSchemas-dvp6PEnZ.js +15839 -0
  535. package/dist/cli-runtime/rolldown-runtime-DXoylpqc.js +121 -0
  536. package/dist/cli-runtime/runtimeVersion-CMGd0bDu.js +23 -0
  537. package/dist/cli-runtime/safeJson-DKKACtdy.js +25 -0
  538. package/dist/cli-runtime/scanCanonical-Bi6si9nb.js +2773 -0
  539. package/dist/cli-runtime/snapshotEnvironment-B5Ai0mha.js +678 -0
  540. package/dist/cli-runtime/streamedJsonOutput-VYlQZsM7.js +654 -0
  541. package/dist/cli-runtime/streamedJsonOutput.js +5 -0
  542. package/dist/cli-runtime/toolContracts-C7pvYKxF.js +4516 -0
  543. package/dist/cli-runtime/toolEffects-DW31yTSx.js +7004 -0
  544. package/dist/cli-runtime/workflowInputError-26EGiDpx.js +26 -0
  545. package/dist/cli.js +91 -0
  546. package/dist/cliBrowserContext.js +11 -0
  547. package/dist/cliBrowserScenarioCommands.js +73 -0
  548. package/dist/cliCommandNames.js +205 -0
  549. package/dist/cliEvidenceCommands.js +51 -0
  550. package/dist/cliJavaScriptRuntimeCommands.js +69 -0
  551. package/dist/cliJsonInput.js +129 -0
  552. package/dist/cliLogging.js +48 -0
  553. package/dist/cliObservationOptions.js +73 -0
  554. package/dist/cliOutput.js +97 -0
  555. package/dist/composition/adb.js +3 -0
  556. package/dist/composition/android.js +3 -0
  557. package/dist/composition/apktool.js +3 -0
  558. package/dist/composition/auxiliaryAnalysisProviders.js +35 -0
  559. package/dist/composition/binary.js +25 -0
  560. package/dist/composition/binaryDiagnostics.js +12 -0
  561. package/dist/composition/browserObservation.js +3 -0
  562. package/dist/composition/browserScenario.js +4 -0
  563. package/dist/composition/directAnalysis.js +44 -0
  564. package/dist/composition/electronObservation.js +3 -0
  565. package/dist/composition/electronScenario.js +3 -0
  566. package/dist/composition/evm.js +4 -0
  567. package/dist/composition/firmware.js +3 -0
  568. package/dist/composition/go.js +4 -0
  569. package/dist/composition/javascriptAnalysisWorkerProcess.js +48 -0
  570. package/dist/composition/javascriptRecovery.js +3 -0
  571. package/dist/composition/javascriptRuntimeObservation.js +3 -0
  572. package/dist/composition/jeb.js +6 -0
  573. package/dist/composition/optionalObservationProviders.js +54 -0
  574. package/dist/composition/wasm.js +4 -0
  575. package/dist/composition/webModules.js +5 -0
  576. package/dist/composition/webNetworkCaptures.js +6 -0
  577. package/dist/composition/webRuntime.js +4 -0
  578. package/dist/composition/webSourceLocations.js +5 -0
  579. package/dist/config/environment.js +73 -0
  580. package/dist/config/ghidraDisabledAnalyzers.js +25 -0
  581. package/dist/config/ghidraLanguageOverride.js +9 -0
  582. package/dist/config/homeDirectory.js +12 -0
  583. package/dist/config/mcpInputSchemaProfile.js +27 -0
  584. package/dist/config/mcpResponseBudget.js +30 -0
  585. package/dist/config/parseConfig.js +93 -0
  586. package/dist/config/parsers.js +30 -0
  587. package/dist/config/providerStartupTimeout.js +13 -0
  588. package/dist/config/types.js +1 -0
  589. package/dist/contracts/adb/adbToolContracts.js +353 -0
  590. package/dist/contracts/advertisedInputExamples.js +48 -0
  591. package/dist/contracts/analysisDetail.js +13 -0
  592. package/dist/contracts/analysisSearchContract.js +14 -0
  593. package/dist/contracts/analysisViewApiSurfaceExample.js +68 -0
  594. package/dist/contracts/analysisViewToolContracts.js +76 -0
  595. package/dist/contracts/android/androidToolContracts.js +77 -0
  596. package/dist/contracts/apktool/apktoolToolContracts.js +33 -0
  597. package/dist/contracts/applicationToolContracts.js +261 -0
  598. package/dist/contracts/artifactComparisonExample.js +86 -0
  599. package/dist/contracts/artifactToolContracts.js +68 -0
  600. package/dist/contracts/browserProviderToolContracts.js +7 -0
  601. package/dist/contracts/browserScenarioToolContracts.js +32 -0
  602. package/dist/contracts/browserToolContracts.js +256 -0
  603. package/dist/contracts/compactInputSchema.js +256 -0
  604. package/dist/contracts/enhancedInputs.js +74 -0
  605. package/dist/contracts/enhancedToolContracts.js +32 -0
  606. package/dist/contracts/errorSchemas.js +87 -0
  607. package/dist/contracts/evidenceInputContracts.js +13 -0
  608. package/dist/contracts/evm/evmToolContracts.js +20 -0
  609. package/dist/contracts/firmware/firmwareToolContracts.js +38 -0
  610. package/dist/contracts/functionComparisonExample.js +51 -0
  611. package/dist/contracts/functionInstructionContract.js +6 -0
  612. package/dist/contracts/functionWorkflowToolContracts.js +29 -0
  613. package/dist/contracts/go/goToolContracts.js +20 -0
  614. package/dist/contracts/hopperMemoryContracts.js +19 -0
  615. package/dist/contracts/inputSchemaPresentation.js +181 -0
  616. package/dist/contracts/investigationExamples.js +116 -0
  617. package/dist/contracts/javascript/applicationWorkflowInputContracts.js +52 -0
  618. package/dist/contracts/javascript/electronToolContracts.js +118 -0
  619. package/dist/contracts/javascript/javascriptApplicationWorkflowExamples.js +85 -0
  620. package/dist/contracts/javascript/javascriptExportShapeComparisonExample.js +248 -0
  621. package/dist/contracts/javascript/javascriptRecoveryToolContracts.js +35 -0
  622. package/dist/contracts/javascript/javascriptRuntimeObservationToolContracts.js +40 -0
  623. package/dist/contracts/javascript/javascriptRuntimeReconciliationExample.js +242 -0
  624. package/dist/contracts/jeb/jebToolContracts.js +64 -0
  625. package/dist/contracts/managed/managedToolContracts.js +87 -0
  626. package/dist/contracts/managed/managedWorkflowExamples.js +281 -0
  627. package/dist/contracts/managed/managedWorkflowToolContracts.js +165 -0
  628. package/dist/contracts/mobileApplicationGraphExamples.js +117 -0
  629. package/dist/contracts/native/binaryDiagnosticsToolContracts.js +65 -0
  630. package/dist/contracts/native/nativeToolContracts.js +77 -0
  631. package/dist/contracts/officialToolContracts.js +69 -0
  632. package/dist/contracts/promptContracts.js +253 -0
  633. package/dist/contracts/providerSelection.js +29 -0
  634. package/dist/contracts/reconstructionReadinessExample.js +438 -0
  635. package/dist/contracts/sessionLifecycleInputs.js +63 -0
  636. package/dist/contracts/sessionStatusContract.js +17 -0
  637. package/dist/contracts/sessionToolContracts.js +61 -0
  638. package/dist/contracts/sessionToolSchemas.js +51 -0
  639. package/dist/contracts/toolContractExamples.js +77 -0
  640. package/dist/contracts/toolContractHelpers.js +22 -0
  641. package/dist/contracts/toolContractTypes.js +18 -0
  642. package/dist/contracts/toolContracts.js +60 -0
  643. package/dist/contracts/toolEffects.js +544 -0
  644. package/dist/contracts/toolOutputSchemaGroups.js +411 -0
  645. package/dist/contracts/toolOutputSchemaPrimitives.js +532 -0
  646. package/dist/contracts/toolSchemaMetadata.js +197 -0
  647. package/dist/contracts/unknownContractExamples.js +31 -0
  648. package/dist/contracts/wasm/wasmToolContracts.js +24 -0
  649. package/dist/contracts/webNetworkCaptureToolContracts.js +24 -0
  650. package/dist/contracts/webRuntimeToolContracts.js +43 -0
  651. package/dist/contracts/webScriptToolContracts.js +68 -0
  652. package/dist/doctorRuntime.js +53 -0
  653. package/dist/domain/adb/adbDeviceAnalysis.js +583 -0
  654. package/dist/domain/analysisErrorBase.js +58 -0
  655. package/dist/domain/analysisErrorCleanup.js +29 -0
  656. package/dist/domain/analysisErrorCore.js +123 -0
  657. package/dist/domain/analysisErrorPresentation.js +372 -0
  658. package/dist/domain/analysisErrorProjection.js +454 -0
  659. package/dist/domain/analysisProfile.js +50 -0
  660. package/dist/domain/analysisSnapshot.js +538 -0
  661. package/dist/domain/analysisView/WebNetworkApiSurfaceAccumulator.js +362 -0
  662. package/dist/domain/analysisView/analysisView.js +340 -0
  663. package/dist/domain/analysisView/analysisViewCoverage.js +19 -0
  664. package/dist/domain/analysisView/binaryLayoutView.js +161 -0
  665. package/dist/domain/analysisView/javascriptApplicationView.js +245 -0
  666. package/dist/domain/analysisView/nativeFunctionView.js +155 -0
  667. package/dist/domain/analysisView/webNetworkApiSurfaceView.js +108 -0
  668. package/dist/domain/android/androidAnalysis.js +143 -0
  669. package/dist/domain/android/androidApplication.js +144 -0
  670. package/dist/domain/android/androidPartialObservation.js +36 -0
  671. package/dist/domain/apktool/apktoolResourceAnalysis.js +75 -0
  672. package/dist/domain/apple/appleApplication.js +315 -0
  673. package/dist/domain/apple/appleAssetCatalog.js +127 -0
  674. package/dist/domain/apple/appleBundleAnatomy.js +303 -0
  675. package/dist/domain/apple/dyldEnvironment.js +73 -0
  676. package/dist/domain/apple/dyldPaths.js +89 -0
  677. package/dist/domain/apple/dylibResolution.js +485 -0
  678. package/dist/domain/apple/dylibResolutionFindings.js +77 -0
  679. package/dist/domain/apple/interfaceBuilderGraph.js +403 -0
  680. package/dist/domain/apple/interfaceBuilderKeyedArchive.js +430 -0
  681. package/dist/domain/apple/keyedArchive.js +214 -0
  682. package/dist/domain/apple/machoContainer.js +54 -0
  683. package/dist/domain/apple/plistNumbers.js +76 -0
  684. package/dist/domain/apple/plistValue.js +35 -0
  685. package/dist/domain/artifactComparison.js +348 -0
  686. package/dist/domain/artifactGraph.js +213 -0
  687. package/dist/domain/artifactIdentity.js +57 -0
  688. package/dist/domain/artifactInspection.js +279 -0
  689. package/dist/domain/artifactIntegrityPolicy.js +10 -0
  690. package/dist/domain/artifactInventoryEvidence.js +166 -0
  691. package/dist/domain/artifactInventorySnapshot.js +1 -0
  692. package/dist/domain/artifactOperationError.js +20 -0
  693. package/dist/domain/artifactPartialObservation.js +1 -0
  694. package/dist/domain/artifactPathSyntax.js +75 -0
  695. package/dist/domain/binaryTarget.js +233 -0
  696. package/dist/domain/binaryTargetTypes.js +10 -0
  697. package/dist/domain/bridgeCandidateProjection.js +71 -0
  698. package/dist/domain/browserCaptureComparison.js +21 -0
  699. package/dist/domain/browserCompleteness.js +103 -0
  700. package/dist/domain/browserNetworkEvidence.js +92 -0
  701. package/dist/domain/browserObservation.js +187 -0
  702. package/dist/domain/browserObservationError.js +44 -0
  703. package/dist/domain/browserObservationErrors.js +1 -0
  704. package/dist/domain/browserObservationSchemas.js +327 -0
  705. package/dist/domain/browserScenario.js +61 -0
  706. package/dist/domain/browserScenarioCapture.js +76 -0
  707. package/dist/domain/browserScenarioCaptureValues.js +292 -0
  708. package/dist/domain/browserScenarioDiff.js +266 -0
  709. package/dist/domain/browserScenarioDiffEvidence.js +73 -0
  710. package/dist/domain/browserScenarioDiffValues.js +140 -0
  711. package/dist/domain/browserScenarioNormalization.js +40 -0
  712. package/dist/domain/browserScenarioValues.js +268 -0
  713. package/dist/domain/browserSession.js +55 -0
  714. package/dist/domain/bundleComparison.js +243 -0
  715. package/dist/domain/callPath.js +301 -0
  716. package/dist/domain/callPathSchemas.js +89 -0
  717. package/dist/domain/canonicalDigest.js +83 -0
  718. package/dist/domain/canonicalJsonDigestSteps.js +155 -0
  719. package/dist/domain/canonicalOrdering.js +3 -0
  720. package/dist/domain/changedBehavior.js +282 -0
  721. package/dist/domain/compactStringIdentity.js +9 -0
  722. package/dist/domain/comparisonSemantics.js +12 -0
  723. package/dist/domain/comparisonSourceEvidence.js +40 -0
  724. package/dist/domain/comparisonStatus.js +11 -0
  725. package/dist/domain/completionLedgerGeneration.js +186 -0
  726. package/dist/domain/configurationErrors.js +37 -0
  727. package/dist/domain/conformancePackage.js +200 -0
  728. package/dist/domain/conformanceReplay.js +132 -0
  729. package/dist/domain/conformanceTrustGate.js +319 -0
  730. package/dist/domain/digests.js +27 -0
  731. package/dist/domain/dosCom.js +8 -0
  732. package/dist/domain/dosMz.js +83 -0
  733. package/dist/domain/emptyArraySchema.js +3 -0
  734. package/dist/domain/evidence.js +305 -0
  735. package/dist/domain/evidenceBundle.js +413 -0
  736. package/dist/domain/evidenceCompletionLedger.js +113 -0
  737. package/dist/domain/evidenceErrors.js +46 -0
  738. package/dist/domain/evidenceRecordSummary.js +144 -0
  739. package/dist/domain/evm/evmInterface.js +61 -0
  740. package/dist/domain/explicitSensitiveFailure.js +108 -0
  741. package/dist/domain/explicitSensitiveValues.js +10 -0
  742. package/dist/domain/firmware/firmwareAnalysis.js +128 -0
  743. package/dist/domain/functionComparison.js +38 -0
  744. package/dist/domain/functionComparisonDimensions.js +199 -0
  745. package/dist/domain/functionComparisonNormalization.js +150 -0
  746. package/dist/domain/functionComparisonResults.js +54 -0
  747. package/dist/domain/functionComparisonSchemas.js +88 -0
  748. package/dist/domain/functionDossierEvidence.js +20 -0
  749. package/dist/domain/go/goBinary.js +96 -0
  750. package/dist/domain/harmony/harmonyApplication.js +169 -0
  751. package/dist/domain/hopperErrors.js +98 -0
  752. package/dist/domain/hopperStartupFailure.js +64 -0
  753. package/dist/domain/hopperValues.js +368 -0
  754. package/dist/domain/immutableJson.js +114 -0
  755. package/dist/domain/inputIssueProjection.js +94 -0
  756. package/dist/domain/javascript/electronActiveObservation.js +237 -0
  757. package/dist/domain/javascript/electronObservation.js +122 -0
  758. package/dist/domain/javascript/electronStaticAnalysis.js +9 -0
  759. package/dist/domain/javascript/electronStaticAnalysisBrowser.js +187 -0
  760. package/dist/domain/javascript/electronStaticAnalysisIpc.js +197 -0
  761. package/dist/domain/javascript/electronStaticAnalysisNative.js +199 -0
  762. package/dist/domain/javascript/electronStaticAnalysisTypes.js +1 -0
  763. package/dist/domain/javascript/electronStaticAnalysisValues.js +134 -0
  764. package/dist/domain/javascript/electronWrappedCallPaths.js +399 -0
  765. package/dist/domain/javascript/htmlArtifactReferences.js +40 -0
  766. package/dist/domain/javascript/javascriptAnalysisResourceControls.js +65 -0
  767. package/dist/domain/javascript/javascriptApplicationAnalysis.js +146 -0
  768. package/dist/domain/javascript/javascriptApplicationChangeGraph.js +175 -0
  769. package/dist/domain/javascript/javascriptApplicationEvidenceSchemas.js +400 -0
  770. package/dist/domain/javascript/javascriptApplicationGraph.js +378 -0
  771. package/dist/domain/javascript/javascriptApplicationGraphSchemas.js +126 -0
  772. package/dist/domain/javascript/javascriptApplicationProjectionResources.js +43 -0
  773. package/dist/domain/javascript/javascriptApplicationVersionComparison.js +104 -0
  774. package/dist/domain/javascript/javascriptApplicationVersionComparisonSchemas.js +211 -0
  775. package/dist/domain/javascript/javascriptApplicationVersionItems.js +324 -0
  776. package/dist/domain/javascript/javascriptApplicationVersionKeys.js +199 -0
  777. package/dist/domain/javascript/javascriptArtifactFiles.js +1 -0
  778. package/dist/domain/javascript/javascriptAstFingerprint.js +153 -0
  779. package/dist/domain/javascript/javascriptAstValues.js +99 -0
  780. package/dist/domain/javascript/javascriptBootstrap.js +94 -0
  781. package/dist/domain/javascript/javascriptElectronMemberWrites.js +119 -0
  782. package/dist/domain/javascript/javascriptExportReturnShapeProjection.js +81 -0
  783. package/dist/domain/javascript/javascriptExportShapeComparison.js +161 -0
  784. package/dist/domain/javascript/javascriptExportShapeComparisonIdentity.js +16 -0
  785. package/dist/domain/javascript/javascriptExportShapeComparisonSchemas.js +302 -0
  786. package/dist/domain/javascript/javascriptExportShapeSelection.js +130 -0
  787. package/dist/domain/javascript/javascriptExportShapeVariants.js +333 -0
  788. package/dist/domain/javascript/javascriptFeatureSeed.js +193 -0
  789. package/dist/domain/javascript/javascriptFeatureTrace.js +177 -0
  790. package/dist/domain/javascript/javascriptFeatureTraceSchemas.js +131 -0
  791. package/dist/domain/javascript/javascriptFeatureTraversal.js +61 -0
  792. package/dist/domain/javascript/javascriptIntrinsicInvocation.js +93 -0
  793. package/dist/domain/javascript/javascriptModuleInterop.js +617 -0
  794. package/dist/domain/javascript/javascriptModuleSemanticIr.js +15 -0
  795. package/dist/domain/javascript/javascriptNativeHandoff.js +90 -0
  796. package/dist/domain/javascript/javascriptPackageImportAliases.js +58 -0
  797. package/dist/domain/javascript/javascriptRecovery.js +90 -0
  798. package/dist/domain/javascript/javascriptRpcEndpoints.js +253 -0
  799. package/dist/domain/javascript/javascriptRuntimeLoadState.js +98 -0
  800. package/dist/domain/javascript/javascriptRuntimeObservation.js +136 -0
  801. package/dist/domain/javascript/javascriptRuntimeReconciliation.js +46 -0
  802. package/dist/domain/javascript/javascriptRuntimeReconciliationActive.js +74 -0
  803. package/dist/domain/javascript/javascriptRuntimeReconciliationCaptureParsing.js +212 -0
  804. package/dist/domain/javascript/javascriptRuntimeReconciliationGraph.js +163 -0
  805. package/dist/domain/javascript/javascriptRuntimeReconciliationInputValidation.js +28 -0
  806. package/dist/domain/javascript/javascriptRuntimeReconciliationMatching.js +270 -0
  807. package/dist/domain/javascript/javascriptRuntimeReconciliationParsing.js +39 -0
  808. package/dist/domain/javascript/javascriptRuntimeReconciliationResult.js +126 -0
  809. package/dist/domain/javascript/javascriptRuntimeReconciliationRuntime.js +334 -0
  810. package/dist/domain/javascript/javascriptRuntimeReconciliationSchemas.js +234 -0
  811. package/dist/domain/javascript/javascriptRuntimeStaticCandidates.js +206 -0
  812. package/dist/domain/javascript/javascriptSemanticAnalysis.js +910 -0
  813. package/dist/domain/javascript/javascriptSemanticAsyncEffects.js +246 -0
  814. package/dist/domain/javascript/javascriptSemanticCallResolution.js +127 -0
  815. package/dist/domain/javascript/javascriptSemanticCallableResults.js +42 -0
  816. package/dist/domain/javascript/javascriptSemanticCalls.js +272 -0
  817. package/dist/domain/javascript/javascriptSemanticChildProcesses.js +224 -0
  818. package/dist/domain/javascript/javascriptSemanticCoverage.js +32 -0
  819. package/dist/domain/javascript/javascriptSemanticDataEffectHelpers.js +182 -0
  820. package/dist/domain/javascript/javascriptSemanticDataEffects.js +299 -0
  821. package/dist/domain/javascript/javascriptSemanticDerivedAnalysis.js +52 -0
  822. package/dist/domain/javascript/javascriptSemanticFileProjection.js +1 -0
  823. package/dist/domain/javascript/javascriptSemanticFingerprints.js +187 -0
  824. package/dist/domain/javascript/javascriptSemanticGraph.js +575 -0
  825. package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +316 -0
  826. package/dist/domain/javascript/javascriptSemanticGraphSerialization.js +12 -0
  827. package/dist/domain/javascript/javascriptSemanticIr.js +31 -0
  828. package/dist/domain/javascript/javascriptSemanticIterationSources.js +139 -0
  829. package/dist/domain/javascript/javascriptSemanticMemberMutations.js +865 -0
  830. package/dist/domain/javascript/javascriptSemanticMutationInitializers.js +190 -0
  831. package/dist/domain/javascript/javascriptSemanticMutationValues.js +104 -0
  832. package/dist/domain/javascript/javascriptSemanticObjectReferences.js +381 -0
  833. package/dist/domain/javascript/javascriptSemanticObjects.js +164 -0
  834. package/dist/domain/javascript/javascriptSemanticPrimitives.js +38 -0
  835. package/dist/domain/javascript/javascriptSemanticProjection.js +571 -0
  836. package/dist/domain/javascript/javascriptSemanticPromises.js +321 -0
  837. package/dist/domain/javascript/javascriptSemanticPropertyPaths.js +100 -0
  838. package/dist/domain/javascript/javascriptSemanticProvenance.js +29 -0
  839. package/dist/domain/javascript/javascriptSemanticQuery.js +175 -0
  840. package/dist/domain/javascript/javascriptSemanticQueryAssessment.js +45 -0
  841. package/dist/domain/javascript/javascriptSemanticQueryIdentity.js +63 -0
  842. package/dist/domain/javascript/javascriptSemanticQueryRelations.js +15 -0
  843. package/dist/domain/javascript/javascriptSemanticQuerySchemas.js +95 -0
  844. package/dist/domain/javascript/javascriptSemanticRequireOrigin.js +34 -0
  845. package/dist/domain/javascript/javascriptSemanticResourceLimits.js +77 -0
  846. package/dist/domain/javascript/javascriptSemanticResources.js +129 -0
  847. package/dist/domain/javascript/javascriptSemanticReturnedReferences.js +219 -0
  848. package/dist/domain/javascript/javascriptSemanticReturns.js +159 -0
  849. package/dist/domain/javascript/javascriptSemanticSlots.js +72 -0
  850. package/dist/domain/javascript/javascriptSemanticState.js +116 -0
  851. package/dist/domain/javascript/javascriptSemanticTraceSchemas.js +15 -0
  852. package/dist/domain/javascript/javascriptSemanticTraversal.js +80 -0
  853. package/dist/domain/javascript/javascriptSemanticValueTypes.js +1 -0
  854. package/dist/domain/javascript/javascriptSemanticValues.js +581 -0
  855. package/dist/domain/javascript/javascriptSourceAnalysis.js +1 -0
  856. package/dist/domain/javascript/javascriptSourceMapPaths.js +114 -0
  857. package/dist/domain/javascript/javascriptSourceParser.js +50 -0
  858. package/dist/domain/javascript/javascriptSourceSelection.js +11 -0
  859. package/dist/domain/javascript/javascriptStaticAnalysis.js +142 -0
  860. package/dist/domain/javascript/javascriptStaticAnalysisBundler.js +239 -0
  861. package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +271 -0
  862. package/dist/domain/javascript/javascriptStaticAnalysisFindings.js +86 -0
  863. package/dist/domain/javascript/javascriptStaticAnalysisHelpers.js +561 -0
  864. package/dist/domain/javascript/javascriptStaticAnalysisState.js +21 -0
  865. package/dist/domain/javascript/javascriptStaticAnalysisTypes.js +2 -0
  866. package/dist/domain/javascript/javascriptSymbolicBindings.js +795 -0
  867. package/dist/domain/javascript/javascriptSymbolicControlFlow.js +40 -0
  868. package/dist/domain/javascript/javascriptSymbolicValues.js +34 -0
  869. package/dist/domain/javascript/sourceToBundleComparison.js +261 -0
  870. package/dist/domain/javascript/sourceToBundleComparisonSchemas.js +109 -0
  871. package/dist/domain/javascript/sourceToBundleSignals.js +231 -0
  872. package/dist/domain/jeb/jebAnalysis.js +114 -0
  873. package/dist/domain/jsonSerialization.js +163 -0
  874. package/dist/domain/jsonShape.js +141 -0
  875. package/dist/domain/jsonValue.js +96 -0
  876. package/dist/domain/localPath.js +24 -0
  877. package/dist/domain/managed/managedApplicationGraph.js +221 -0
  878. package/dist/domain/managed/managedApplicationGraphCoverage.js +48 -0
  879. package/dist/domain/managed/managedApplicationGraphNodes.js +367 -0
  880. package/dist/domain/managed/managedArtifact.js +465 -0
  881. package/dist/domain/managed/managedInspectionEvidence.js +28 -0
  882. package/dist/domain/managed/managedMemberComparison.js +211 -0
  883. package/dist/domain/managed/managedMemberComparisonCoverage.js +71 -0
  884. package/dist/domain/managed/managedMemberComparisonItems.js +304 -0
  885. package/dist/domain/managed/managedMemberComparisonMatch.js +204 -0
  886. package/dist/domain/managed/managedNativeVerification.js +35 -0
  887. package/dist/domain/managed/managedNativeVerificationMatch.js +276 -0
  888. package/dist/domain/managed/managedNativeVerificationSchemas.js +180 -0
  889. package/dist/domain/managed/managedReconstruction.js +190 -0
  890. package/dist/domain/mobileApplicationGraphProjection.js +61 -0
  891. package/dist/domain/native/binaryLayout.js +354 -0
  892. package/dist/domain/native/fileOffsetPartialObservation.js +1 -0
  893. package/dist/domain/native/nativeAotPe.js +1408 -0
  894. package/dist/domain/native/nativeApiBoundary.js +140 -0
  895. package/dist/domain/native/nativeCallObservation.js +186 -0
  896. package/dist/domain/native/nativeCallPartialObservation.js +33 -0
  897. package/dist/domain/native/nativeDataType.js +53 -0
  898. package/dist/domain/native/nativeFunctionAnnotations.js +43 -0
  899. package/dist/domain/native/nativeInspection.js +174 -0
  900. package/dist/domain/native/nativeInstruction.js +125 -0
  901. package/dist/domain/native/nativeInvestigationGraph.js +364 -0
  902. package/dist/domain/native/nativeLoadImage.js +112 -0
  903. package/dist/domain/native/nativeMetadataRecovery.js +128 -0
  904. package/dist/domain/native/nativeUiObservation.js +137 -0
  905. package/dist/domain/native/nativeValueFlow.js +72 -0
  906. package/dist/domain/native/nativeValueTrace.js +64 -0
  907. package/dist/domain/native/objcSwiftMetadata.js +419 -0
  908. package/dist/domain/native/peResources.js +100 -0
  909. package/dist/domain/native/recordedCrash.js +263 -0
  910. package/dist/domain/native/recordedCrashNoteCoverage.js +73 -0
  911. package/dist/domain/nativeConvention.js +33 -0
  912. package/dist/domain/offsetDateTime.js +17 -0
  913. package/dist/domain/peMachine.js +36 -0
  914. package/dist/domain/process/processCapture.js +412 -0
  915. package/dist/domain/process/processCaptureCoverage.js +70 -0
  916. package/dist/domain/process/processCaptureExample.js +132 -0
  917. package/dist/domain/process/processCaptureParsing.js +21 -0
  918. package/dist/domain/process/processCaptureValidation.js +246 -0
  919. package/dist/domain/process/processComparison.js +315 -0
  920. package/dist/domain/process/processEvidenceProvider.js +11 -0
  921. package/dist/domain/process/processObservation.js +140 -0
  922. package/dist/domain/process/processScenario.js +247 -0
  923. package/dist/domain/process/processTraceComparison.js +34 -0
  924. package/dist/domain/process/processTraceDimensionProjection.js +35 -0
  925. package/dist/domain/process/processTraceEvaluation.js +320 -0
  926. package/dist/domain/process/processTraceSpecification.js +382 -0
  927. package/dist/domain/propertyListKeys.js +107 -0
  928. package/dist/domain/propertyListXmlText.js +19 -0
  929. package/dist/domain/providerAdapterError.js +19 -0
  930. package/dist/domain/providerCleanupError.js +18 -0
  931. package/dist/domain/providerConfigurationRefusal.js +12 -0
  932. package/dist/domain/providerOperationHealth.js +54 -0
  933. package/dist/domain/providerSelectionError.js +46 -0
  934. package/dist/domain/rawBinary.js +93 -0
  935. package/dist/domain/reconstructionCoverage.js +325 -0
  936. package/dist/domain/reconstructionCoverageEvaluation.js +234 -0
  937. package/dist/domain/reconstructionCoverageInput.js +7 -0
  938. package/dist/domain/reconstructionObligationLedgerIntegrity.js +114 -0
  939. package/dist/domain/reconstructionObligationLedgerSchemas.js +347 -0
  940. package/dist/domain/reconstructionReadiness.js +116 -0
  941. package/dist/domain/reconstructionReadinessFindingHelpers.js +17 -0
  942. package/dist/domain/reconstructionReadinessIntegrityFindings.js +118 -0
  943. package/dist/domain/reconstructionReadinessJourneyFindings.js +193 -0
  944. package/dist/domain/reconstructionReadinessSchemas.js +268 -0
  945. package/dist/domain/reconstructionUnknowns.js +91 -0
  946. package/dist/domain/reconstructionVerification.js +218 -0
  947. package/dist/domain/reconstructionVerificationSchemas.js +141 -0
  948. package/dist/domain/recordedTransportUrl.js +51 -0
  949. package/dist/domain/referenceSourceClassification.js +385 -0
  950. package/dist/domain/referenceSourceGraph.js +380 -0
  951. package/dist/domain/referenceSourceImportParsing.js +238 -0
  952. package/dist/domain/referenceSourcePathIdentity.js +22 -0
  953. package/dist/domain/referenceSourcePolicy.js +1 -0
  954. package/dist/domain/referenceSourceRequireBindings.js +137 -0
  955. package/dist/domain/relationshipCoverage.js +20 -0
  956. package/dist/domain/residualUnknown.js +252 -0
  957. package/dist/domain/result.js +4 -0
  958. package/dist/domain/runtimeVersion.js +15 -0
  959. package/dist/domain/safeJson.js +13 -0
  960. package/dist/domain/sourceMapContents.js +6 -0
  961. package/dist/domain/sourceMapEnvelope.js +44 -0
  962. package/dist/domain/staticRuntimeCorrelation.js +334 -0
  963. package/dist/domain/stringPatterns.js +6 -0
  964. package/dist/domain/swiftSymbolClassification.js +66 -0
  965. package/dist/domain/symbolAnalysis.js +122 -0
  966. package/dist/domain/unicodeCodePointOrder.js +23 -0
  967. package/dist/domain/unknownRegistryError.js +10 -0
  968. package/dist/domain/wasm/wasmArtifact.js +105 -0
  969. package/dist/domain/webBundleAnalysis.js +192 -0
  970. package/dist/domain/webBundleAnalyzer.js +15 -0
  971. package/dist/domain/webBundleAnalyzerAst.js +49 -0
  972. package/dist/domain/webBundleAnalyzerInspection.js +315 -0
  973. package/dist/domain/webBundleAnalyzerResult.js +142 -0
  974. package/dist/domain/webCaptureDiff.js +423 -0
  975. package/dist/domain/webCaptureDiffSchemas.js +84 -0
  976. package/dist/domain/webContentArtifact.js +38 -0
  977. package/dist/domain/webEventListeners.js +29 -0
  978. package/dist/domain/webExecution.js +75 -0
  979. package/dist/domain/webInventory.js +62 -0
  980. package/dist/domain/webMcpDiscovery.js +53 -0
  981. package/dist/domain/webModuleImports.js +99 -0
  982. package/dist/domain/webModuleTrace.js +101 -0
  983. package/dist/domain/webNetworkCapture.js +142 -0
  984. package/dist/domain/webNetworkCaptureCoordinates.js +58 -0
  985. package/dist/domain/webRuntime.js +80 -0
  986. package/dist/domain/webScreenshot.js +132 -0
  987. package/dist/domain/webScriptArtifacts.js +37 -0
  988. package/dist/domain/webScriptExport.js +84 -0
  989. package/dist/domain/webScriptExportError.js +19 -0
  990. package/dist/domain/webScriptExportPlan.js +104 -0
  991. package/dist/domain/webSourceLocation.js +118 -0
  992. package/dist/domain/webSourcePosition.js +21 -0
  993. package/dist/domain/zipPackageFormat.js +52 -0
  994. package/dist/domain/zodCollectionSteps.js +24 -0
  995. package/dist/dotnet/ManagedArtifactInspector.js +308 -0
  996. package/dist/dotnet/ManagedDecodeBudget.js +138 -0
  997. package/dist/dotnet/ManagedExceptionRegionValidation.js +41 -0
  998. package/dist/dotnet/ManagedMemberInspector.js +173 -0
  999. package/dist/dotnet/ManagedMemberInspectorCore.js +446 -0
  1000. package/dist/dotnet/ManagedMemberInstructionDecoder.js +468 -0
  1001. package/dist/dotnet/ManagedMemberOwnership.js +71 -0
  1002. package/dist/dotnet/ManagedMemberPointers.js +62 -0
  1003. package/dist/dotnet/ManagedMemberRows.js +227 -0
  1004. package/dist/dotnet/ManagedMetadataHeaps.js +179 -0
  1005. package/dist/dotnet/ManagedMetadataInventory.js +99 -0
  1006. package/dist/dotnet/ManagedMetadataInventoryRows.js +295 -0
  1007. package/dist/dotnet/ManagedMetadataLayout.js +270 -0
  1008. package/dist/dotnet/ManagedMetadataRowSizes.js +54 -0
  1009. package/dist/dotnet/ManagedMethodBodyReader.js +155 -0
  1010. package/dist/dotnet/ManagedNativeBoundaryHelpers.js +314 -0
  1011. package/dist/dotnet/ManagedNativeBoundaryInspector.js +128 -0
  1012. package/dist/dotnet/ManagedPeReader.js +233 -0
  1013. package/dist/dotnet/ManagedReaderFailure.js +27 -0
  1014. package/dist/dotnet/ManagedSnapshot.js +88 -0
  1015. package/dist/dotnet/ManagedStaticProvider.js +158 -0
  1016. package/dist/dotnet/ManagedStaticProviderMetadata.js +33 -0
  1017. package/dist/evaluation/AgentEvaluationFixtures.js +250 -0
  1018. package/dist/evaluation/AgentEvaluationReport.js +32 -0
  1019. package/dist/evaluation/CodexAgentEval.js +188 -0
  1020. package/dist/evaluation/KnownAnswerEvaluation.js +323 -0
  1021. package/dist/evm/EvmBytecodeCarrier.js +21 -0
  1022. package/dist/evm/EvmWorkerLimits.js +40 -0
  1023. package/dist/evm/EvmoleFailures.js +124 -0
  1024. package/dist/evm/EvmoleInterfaceAdapter.js +53 -0
  1025. package/dist/evm/EvmoleInterfaceProvider.js +339 -0
  1026. package/dist/evm/EvmoleInterfaceWorker.js +87 -0
  1027. package/dist/evm/EvmoleRelease.js +16 -0
  1028. package/dist/filesystem/OwnedDirectoryHandle.js +29 -0
  1029. package/dist/filesystem/OwnedFileHandle.js +36 -0
  1030. package/dist/filesystem/OwnedStagedOutput.js +138 -0
  1031. package/dist/filesystem/RegularFile.js +73 -0
  1032. package/dist/filesystem/StableFileHash.js +46 -0
  1033. package/dist/filesystem/readFileHandleChunks.js +35 -0
  1034. package/dist/firmware/FirmwareCommand.js +190 -0
  1035. package/dist/firmware/FirmwareFiles.js +206 -0
  1036. package/dist/firmware/FirmwareProvider.js +388 -0
  1037. package/dist/firmware/FirmwarePublication.js +105 -0
  1038. package/dist/firmware/FirmwareRelease.js +33 -0
  1039. package/dist/firmware/FirmwareReports.js +287 -0
  1040. package/dist/firmware/FirmwareVersion.js +80 -0
  1041. package/dist/generatedPackageMetadata.js +9 -0
  1042. package/dist/ghidra/GhidraAnalysisProfile.js +219 -0
  1043. package/dist/ghidra/GhidraAnalysisSeeds.js +211 -0
  1044. package/dist/ghidra/GhidraClient.js +725 -0
  1045. package/dist/ghidra/GhidraClientStartup.js +27 -0
  1046. package/dist/ghidra/GhidraClientTypes.js +1 -0
  1047. package/dist/ghidra/GhidraClientWire.js +38 -0
  1048. package/dist/ghidra/GhidraDiagnostics.js +53 -0
  1049. package/dist/ghidra/GhidraDoctor.js +88 -0
  1050. package/dist/ghidra/GhidraFunctionValues.js +328 -0
  1051. package/dist/ghidra/GhidraInstallation.js +443 -0
  1052. package/dist/ghidra/GhidraInstallationPolicy.js +140 -0
  1053. package/dist/ghidra/GhidraInventoryValues.js +262 -0
  1054. package/dist/ghidra/GhidraJavaLaunch.js +66 -0
  1055. package/dist/ghidra/GhidraLanguageCatalog.js +99 -0
  1056. package/dist/ghidra/GhidraLauncher.js +490 -0
  1057. package/dist/ghidra/GhidraLoadImageAttest.js +103 -0
  1058. package/dist/ghidra/GhidraLoadImageValues.js +260 -0
  1059. package/dist/ghidra/GhidraMipsProfile.js +187 -0
  1060. package/dist/ghidra/GhidraProvider.js +250 -0
  1061. package/dist/ghidra/GhidraProviderCapabilities.js +208 -0
  1062. package/dist/ghidra/GhidraProviderClient.js +613 -0
  1063. package/dist/ghidra/GhidraPspExtension.js +144 -0
  1064. package/dist/ghidra/GhidraPspProfile.js +50 -0
  1065. package/dist/ghidra/GhidraRawBinaryLanguage.js +18 -0
  1066. package/dist/ghidra/GhidraRequestQueue.js +115 -0
  1067. package/dist/ghidra/GhidraResponseBuffer.js +31 -0
  1068. package/dist/ghidra/GhidraResponseRouter.js +24 -0
  1069. package/dist/ghidra/GhidraSessionError.js +180 -0
  1070. package/dist/ghidra/GhidraSessionRoot.js +39 -0
  1071. package/dist/ghidra/GhidraSessionValues.js +86 -0
  1072. package/dist/ghidra/GhidraSocketConnection.js +83 -0
  1073. package/dist/ghidra/GhidraTargetSnapshot.js +79 -0
  1074. package/dist/ghidra/GhidraTransport.js +101 -0
  1075. package/dist/ghidra/extensions/GhidraExtensionFailures.js +20 -0
  1076. package/dist/ghidra/extensions/GhidraExtensions.js +177 -0
  1077. package/dist/ghidra/extensions/nativeaot/NativeAotAdapter.js +27 -0
  1078. package/dist/ghidra/extensions/nativeaot/NativeAotReport.js +100 -0
  1079. package/dist/ghidra/protocol.js +46 -0
  1080. package/dist/go/GoBinaryContainer.js +125 -0
  1081. package/dist/go/GoBinaryImage.js +172 -0
  1082. package/dist/go/GoBinaryProvider.js +137 -0
  1083. package/dist/go/GoElfImage.js +149 -0
  1084. package/dist/go/GoMachoImage.js +113 -0
  1085. package/dist/go/GoModuleText.js +217 -0
  1086. package/dist/go/GoPeImage.js +102 -0
  1087. package/dist/hopper/BridgeLauncher.js +305 -0
  1088. package/dist/hopper/HopperAnalysisProfile.js +168 -0
  1089. package/dist/hopper/HopperCleanup.js +245 -0
  1090. package/dist/hopper/HopperClient.js +767 -0
  1091. package/dist/hopper/HopperDiagnostics.js +14 -0
  1092. package/dist/hopper/HopperFileOffset.js +237 -0
  1093. package/dist/hopper/HopperMachOImage.js +200 -0
  1094. package/dist/hopper/HopperOperationStage.js +6 -0
  1095. package/dist/hopper/HopperProcessDiagnostic.js +26 -0
  1096. package/dist/hopper/HopperProvider.js +269 -0
  1097. package/dist/hopper/HopperProviderCapabilities.js +91 -0
  1098. package/dist/hopper/HopperRegexSearch.js +134 -0
  1099. package/dist/hopper/HopperRegexWorker.js +27 -0
  1100. package/dist/hopper/HopperRequestQueue.js +261 -0
  1101. package/dist/hopper/HopperResponseStream.js +44 -0
  1102. package/dist/hopper/HopperSessionValues.js +30 -0
  1103. package/dist/hopper/HopperSocketConnection.js +31 -0
  1104. package/dist/hopper/HopperTargetLease.js +233 -0
  1105. package/dist/hopper/LinuxPrivateDisplayDiagnostic.js +64 -0
  1106. package/dist/hopper/LinuxPrivateDisplayProbe.js +224 -0
  1107. package/dist/hopper/protocol.js +88 -0
  1108. package/dist/ida/IdaBusyHealth.js +44 -0
  1109. package/dist/ida/IdaCallGraph.js +134 -0
  1110. package/dist/ida/IdaConfiguration.js +61 -0
  1111. package/dist/ida/IdaDoctor.js +53 -0
  1112. package/dist/ida/IdaInput.js +56 -0
  1113. package/dist/ida/IdaMcpConnection.js +115 -0
  1114. package/dist/ida/IdaOperationRunner.js +376 -0
  1115. package/dist/ida/IdaProtocolValues.js +208 -0
  1116. package/dist/ida/IdaProvider.js +136 -0
  1117. package/dist/ida/IdaProviderCapabilities.js +64 -0
  1118. package/dist/ida/IdaSessionClient.js +444 -0
  1119. package/dist/ida/IdaWorkspace.js +55 -0
  1120. package/dist/identity.js +25 -0
  1121. package/dist/inspector/JavaScriptRuntimeScope.js +89 -0
  1122. package/dist/inspector/V8InspectorCaptureProjection.js +197 -0
  1123. package/dist/inspector/V8InspectorEndpoint.js +70 -0
  1124. package/dist/inspector/V8InspectorProvider.js +378 -0
  1125. package/dist/inspector/providerIdentity.js +6 -0
  1126. package/dist/javascript/analysis/JavaScriptAnalysisTransfer.js +337 -0
  1127. package/dist/javascript/analysis/JavaScriptAnalysisWorker.js +574 -0
  1128. package/dist/javascript/analysis/JavaScriptAnalysisWorkerProtocol.js +64 -0
  1129. package/dist/javascript/analysis/JavaScriptAnalysisWorkerSchemas.js +558 -0
  1130. package/dist/javascript/analysis/JavaScriptAnalysisWorkerServer.js +121 -0
  1131. package/dist/javascript/recovery/RecoveryFiles.js +175 -0
  1132. package/dist/javascript/recovery/WakaruCommand.js +137 -0
  1133. package/dist/javascript/recovery/WakaruExecution.js +115 -0
  1134. package/dist/javascript/recovery/WakaruProvider.js +218 -0
  1135. package/dist/javascript/recovery/WakaruPublication.js +126 -0
  1136. package/dist/javascript/recovery/WakaruRelease.js +36 -0
  1137. package/dist/javascript/recovery/WakaruReport.js +140 -0
  1138. package/dist/javascript/recovery/WakaruVersion.js +24 -0
  1139. package/dist/javascript/sourceMaps/DecodedSourceMap.js +47 -0
  1140. package/dist/javascript/sourceMaps/SourceMapCodecProcess.js +37 -0
  1141. package/dist/javascript/sourceMaps/SourceMapCodecProtocol.js +20 -0
  1142. package/dist/javascript/sourceMaps/SourceMapCommand.js +223 -0
  1143. package/dist/javascript/sourceMaps/SourceMapDecoder.js +135 -0
  1144. package/dist/javascript/sourceMaps/SourceMapFormat.js +238 -0
  1145. package/dist/javascript/sourceMaps/TraceSourceMap.js +152 -0
  1146. package/dist/jeb/JebMcpConnection.js +186 -0
  1147. package/dist/jeb/JebMcpEndpoint.js +40 -0
  1148. package/dist/jeb/JebProvider.js +297 -0
  1149. package/dist/logger.js +14 -0
  1150. package/dist/main/messages.js +4 -0
  1151. package/dist/main/shutdown.js +102 -0
  1152. package/dist/main/startup.js +21 -0
  1153. package/dist/main/transport.js +72 -0
  1154. package/dist/main/types.js +1 -0
  1155. package/dist/main.js +92 -0
  1156. package/dist/mcp/AnalysisSnapshotFiles-DbgHi36O.js +1225 -0
  1157. package/dist/mcp/ArtifactProvider-BNxKlaKX.js +2090 -0
  1158. package/dist/mcp/ArtifactProviderMetadata--hy-wyJK.js +76 -0
  1159. package/dist/mcp/ArtifactReader-OyM03Gjn.js +55 -0
  1160. package/dist/mcp/ArtifactResourceScope-CBR5q4aK.js +108 -0
  1161. package/dist/mcp/AsarHeader-WsPgoooH.js +31 -0
  1162. package/dist/mcp/BinaryTargetResolver-DbiUzRLh.js +1073 -0
  1163. package/dist/mcp/BoundedFileBytes-CJPW_TzE.js +68 -0
  1164. package/dist/mcp/CdpConnection-CM0tkVfW.js +557 -0
  1165. package/dist/mcp/CdpOptionalCommand-H8_fL7Q_.js +120 -0
  1166. package/dist/mcp/CdpTargetSession-OYD1d6XM.js +647 -0
  1167. package/dist/mcp/DirectAnalysis-BWAu8Ro5.js +395 -0
  1168. package/dist/mcp/DirectAnalysisStatus-DofNPhKd.js +33 -0
  1169. package/dist/mcp/ElectronFileScope-DEayib6K.js +110 -0
  1170. package/dist/mcp/InterfaceBuilderDecodeBudget-CUrOtfNo.js +401 -0
  1171. package/dist/mcp/ManagedStaticProvider-CXE93Bow.js +4460 -0
  1172. package/dist/mcp/NativeMacOSProvider-BbITFLHW.js +4408 -0
  1173. package/dist/mcp/NativeMacOSProviderMetadata-mxDhaNJf.js +281 -0
  1174. package/dist/mcp/ProcedureAddressResolution-Gnjf9Hya.js +19 -0
  1175. package/dist/mcp/ProcessOwnership-nOFZsmD3.js +1411 -0
  1176. package/dist/mcp/WorkflowEvidence-DJyEy3K0.js +94 -0
  1177. package/dist/mcp/analysisErrorCore-BqyeMw3_.js +201 -0
  1178. package/dist/mcp/analysisErrorProjection-B7pHef2y.js +724 -0
  1179. package/dist/mcp/artifactOperationError-B_jxO8at.js +27 -0
  1180. package/dist/mcp/artifactToolContracts-TXegBBr1.js +159 -0
  1181. package/dist/mcp/browserObservation-BCgaDRyQ.js +4398 -0
  1182. package/dist/mcp/browserObservationError-BKBEX85K.js +40 -0
  1183. package/dist/mcp/browserObservationSchemas-yzRJ90-E.js +573 -0
  1184. package/dist/mcp/browserScenario-z7jveI9P.js +2319 -0
  1185. package/dist/mcp/browserScenarioCapture-BvnKTmtZ.js +460 -0
  1186. package/dist/mcp/canonicalDigest-Bi_0_zGi.js +71 -0
  1187. package/dist/mcp/digests-Dugt3H71.js +199 -0
  1188. package/dist/mcp/electronActiveObservation-lDvQTMR0.js +226 -0
  1189. package/dist/mcp/electronObservation-DjQQYGw4.js +556 -0
  1190. package/dist/mcp/electronObservation-DuhMHCmQ.js +112 -0
  1191. package/dist/mcp/electronScenario-9mLG6h-g.js +586 -0
  1192. package/dist/mcp/emptyArraySchema-DEEefG2V.js +140 -0
  1193. package/dist/mcp/enhancedInputs-CLdEXv88.js +56 -0
  1194. package/dist/mcp/interfaceBuilderGraph-BOKqQzjK.js +2613 -0
  1195. package/dist/mcp/javascriptRuntimeObservation-C_wglsz_.js +661 -0
  1196. package/dist/mcp/javascriptRuntimeObservation-CxQ1UT_y.js +121 -0
  1197. package/dist/mcp/lipo-Do-2eBrl.js +465 -0
  1198. package/dist/mcp/localPath-AxvW9aPe.js +19 -0
  1199. package/dist/mcp/logger-CZ4Hlc6u.js +34 -0
  1200. package/dist/mcp/machoContainer-9En6pSkd.js +813 -0
  1201. package/dist/mcp/main-WQSCuTNt.js +52791 -0
  1202. package/dist/mcp/main.js +6 -0
  1203. package/dist/mcp/managedToolContracts-o5LHFwHc.js +81 -0
  1204. package/dist/mcp/plistValue-DsU7z4yF.js +47 -0
  1205. package/dist/mcp/propertyListKeys-cX-BUv2y.js +197 -0
  1206. package/dist/mcp/providerAdapterError-CdPaQ6-Z.js +27 -0
  1207. package/dist/mcp/providerCleanupError-DvE79aUX.js +49 -0
  1208. package/dist/mcp/providerIdentities--ptAh481.js +31 -0
  1209. package/dist/mcp/providerIdentity-BCQ5n5tw.js +16 -0
  1210. package/dist/mcp/providerOperationHealth-CUeCJZiP.js +212 -0
  1211. package/dist/mcp/rolldown-runtime-BjeaiXFo.js +121 -0
  1212. package/dist/mcp/safeJson-NeGfpkrI.js +25 -0
  1213. package/dist/mcp/scanCanonical-2GN0h-BE.js +3647 -0
  1214. package/dist/mcp/serverIdentity-rOY69sxc.js +633 -0
  1215. package/dist/mcp/sourceMapEnvelope-D8Zezqyi.js +252 -0
  1216. package/dist/mcp/toolContracts-CrfYDTUz.js +14561 -0
  1217. package/dist/mcp/toolOutputSchemaGroups-ChxVLGoy.js +11114 -0
  1218. package/dist/mcp/unicodeCodePointOrder-BezCbTpg.js +26 -0
  1219. package/dist/mcp/webContentArtifact-DUBgMzVO.js +185 -0
  1220. package/dist/mcp/webRuntime-C2Tx-fgS.js +74 -0
  1221. package/dist/mcp/webSourceLocation-Dnkpf0R2.js +8532 -0
  1222. package/dist/mcpDoctor.js +360 -0
  1223. package/dist/mcpStartupPolicy.js +14 -0
  1224. package/dist/native/AppleDispatchCoverage.js +112 -0
  1225. package/dist/native/AppleDispatchDecodeFacts.js +6 -0
  1226. package/dist/native/AppleDispatchMetadata.js +176 -0
  1227. package/dist/native/AppleMachoFixups.js +372 -0
  1228. package/dist/native/AppleMachoSelection.js +234 -0
  1229. package/dist/native/AppleObjcCategories.js +63 -0
  1230. package/dist/native/AppleObjcDispatchFacets.js +260 -0
  1231. package/dist/native/AppleObjcProperties.js +79 -0
  1232. package/dist/native/AppleObjcProtocols.js +89 -0
  1233. package/dist/native/AppleSwiftDispatchFacets.js +156 -0
  1234. package/dist/native/AppleSwiftVtables.js +92 -0
  1235. package/dist/native/CommandRunner.js +240 -0
  1236. package/dist/native/LldbCallTracer.js +713 -0
  1237. package/dist/native/LldbRetainedObservations.js +178 -0
  1238. package/dist/native/NativeCallObservation.js +195 -0
  1239. package/dist/native/NativeMacOSProvider.js +701 -0
  1240. package/dist/native/NativeMacOSProviderMetadata.js +46 -0
  1241. package/dist/native/NativeMachoInspection.js +273 -0
  1242. package/dist/native/NativeUiHelperRuntime.js +66 -0
  1243. package/dist/native/NativeUiObservation.js +183 -0
  1244. package/dist/native/NativeUiOutputBudget.js +8 -0
  1245. package/dist/native/SignatureTargetBinding.js +155 -0
  1246. package/dist/native/parsers/codesign.js +93 -0
  1247. package/dist/native/parsers/demangle.js +30 -0
  1248. package/dist/native/parsers/dyldInfo.js +60 -0
  1249. package/dist/native/parsers/echoedPath.js +14 -0
  1250. package/dist/native/parsers/lipo.js +177 -0
  1251. package/dist/native/parsers/machoUuid.js +150 -0
  1252. package/dist/native/parsers/otool.js +379 -0
  1253. package/dist/native/parsers/plist.js +187 -0
  1254. package/dist/native/pe/PeResourceLayout.js +120 -0
  1255. package/dist/native/pe/PeResourceParser.js +286 -0
  1256. package/dist/native/pe/PeResourcesProvider.js +63 -0
  1257. package/dist/native/pwndbg/PwndbgCoreContext.js +180 -0
  1258. package/dist/native/pwntools/PwntoolsDecoder.js +206 -0
  1259. package/dist/native/pwntools/PwntoolsFailures.js +180 -0
  1260. package/dist/native/pwntools/PwntoolsLayoutProvider.js +36 -0
  1261. package/dist/native/pwntools/PwntoolsRecordedCrashProvider.js +75 -0
  1262. package/dist/native/pwntools/PwntoolsRelease.js +19 -0
  1263. package/dist/native/pwntools/PwntoolsResourceLimits.js +76 -0
  1264. package/dist/native/pwntools/RecordedCrashSourceBindings.js +46 -0
  1265. package/dist/native/pwntools/RecordedCrashStructureBindings.js +103 -0
  1266. package/dist/process/BoundedFileBytes.js +40 -0
  1267. package/dist/process/DarwinProcessRunTokenReader.js +376 -0
  1268. package/dist/process/ExecFileOutput.js +124 -0
  1269. package/dist/process/JavaScriptWorkerMemoryLimit.js +25 -0
  1270. package/dist/process/OwnedCommand.js +131 -0
  1271. package/dist/process/PendingOperations.js +61 -0
  1272. package/dist/process/PrivateRuntimeRoot.js +61 -0
  1273. package/dist/process/ProcessCommandIdentity.js +19 -0
  1274. package/dist/process/ProcessOwnership.js +636 -0
  1275. package/dist/process/ProcessOwnershipIdentity.js +13 -0
  1276. package/dist/process/ProcessOwnershipObservation.js +407 -0
  1277. package/dist/process/ProcessOwnershipProcessTree.js +35 -0
  1278. package/dist/process/ProcessRunTokenObservations.js +48 -0
  1279. package/dist/process/ProviderDeadline.js +91 -0
  1280. package/dist/process/ProviderDiagnosticRedaction.js +17 -0
  1281. package/dist/process/ProviderProcess.js +381 -0
  1282. package/dist/process/ProviderRunLineage.js +21 -0
  1283. package/dist/process/WindowsAuthority.js +51 -0
  1284. package/dist/process/WindowsBatchCommand.js +46 -0
  1285. package/dist/process/boundedUtf8Text.js +13 -0
  1286. package/dist/process/capture/FilesystemSnapshot.js +268 -0
  1287. package/dist/process/capture/ProcessCaptureCapability.js +65 -0
  1288. package/dist/process/capture/ProcessCaptureEnvironment.js +9 -0
  1289. package/dist/process/capture/ProcessCaptureError.js +74 -0
  1290. package/dist/process/capture/ProcessCaptureJournal.js +61 -0
  1291. package/dist/process/capture/ProcessCaptureLifecycle.js +1050 -0
  1292. package/dist/process/capture/ProcessCaptureProgress.js +62 -0
  1293. package/dist/process/capture/ProcessFilesystemEffects.js +81 -0
  1294. package/dist/process/capture/ProcessHarness.js +602 -0
  1295. package/dist/process/capture/ProcessNormalization.js +88 -0
  1296. package/dist/process/capture/ProcessSampling.js +415 -0
  1297. package/dist/process/capture/ProcessScenarioRuntimeValidation.js +79 -0
  1298. package/dist/process/capture/ProcessTimer.js +39 -0
  1299. package/dist/process/capture/TerminalRenderer.js +124 -0
  1300. package/dist/process/snapshotEnvironment.js +14 -0
  1301. package/dist/reference/ReferenceSourceReader.js +73 -0
  1302. package/dist/reference/ReferenceSourceReaderEntries.js +273 -0
  1303. package/dist/reference/ReferenceSourceReaderErrors.js +54 -0
  1304. package/dist/reference/ReferenceSourceReaderFile.js +147 -0
  1305. package/dist/reference/ReferenceSourceReaderPaths.js +8 -0
  1306. package/dist/reference/ReferenceSourceReaderTypes.js +1 -0
  1307. package/dist/reference/ReferenceSourceReaderValidate.js +81 -0
  1308. package/dist/server/EvidenceMcpServer.js +216 -0
  1309. package/dist/server/admittedToolOperation.js +9 -0
  1310. package/dist/server/analysisAdmission.js +8 -0
  1311. package/dist/server/contractToolHandler.js +21 -0
  1312. package/dist/server/createServer.js +344 -0
  1313. package/dist/server/lifecycleProgress.js +10 -0
  1314. package/dist/server/mcpClientMetadata.js +42 -0
  1315. package/dist/server/mcpProgress.js +26 -0
  1316. package/dist/server/promptCompletion.js +141 -0
  1317. package/dist/server/recordDerivedEvidence.js +10 -0
  1318. package/dist/server/registerAdbTools.js +36 -0
  1319. package/dist/server/registerAnalysisViewTool.js +10 -0
  1320. package/dist/server/registerAndroidTools.js +31 -0
  1321. package/dist/server/registerApktoolTools.js +14 -0
  1322. package/dist/server/registerApplicationTools/compareExportShapes.js +29 -0
  1323. package/dist/server/registerApplicationTools/compareSourceToBundle.js +29 -0
  1324. package/dist/server/registerApplicationTools/compareVersions.js +34 -0
  1325. package/dist/server/registerApplicationTools/coverage.js +13 -0
  1326. package/dist/server/registerApplicationTools/helpers.js +37 -0
  1327. package/dist/server/registerApplicationTools/obligationLedger.js +23 -0
  1328. package/dist/server/registerApplicationTools/projectMobileApplicationGraph.js +50 -0
  1329. package/dist/server/registerApplicationTools/traceFeature.js +26 -0
  1330. package/dist/server/registerApplicationTools/traceSemantics.js +25 -0
  1331. package/dist/server/registerApplicationTools/types.js +1 -0
  1332. package/dist/server/registerApplicationTools.js +19 -0
  1333. package/dist/server/registerArtifactComparisonTool.js +71 -0
  1334. package/dist/server/registerArtifactTools.js +14 -0
  1335. package/dist/server/registerBinaryDiagnosticsTools.js +26 -0
  1336. package/dist/server/registerBrowserScenarioTool.js +26 -0
  1337. package/dist/server/registerBrowserTools.js +58 -0
  1338. package/dist/server/registerBundleComparisonTool.js +54 -0
  1339. package/dist/server/registerCloseLifecycleTool.js +55 -0
  1340. package/dist/server/registerElectronTools.js +70 -0
  1341. package/dist/server/registerEnhancedTools.js +169 -0
  1342. package/dist/server/registerEvidenceTools.js +68 -0
  1343. package/dist/server/registerEvmTools.js +9 -0
  1344. package/dist/server/registerFirmwareTools.js +11 -0
  1345. package/dist/server/registerFunctionComparisonTool.js +86 -0
  1346. package/dist/server/registerGoTools.js +9 -0
  1347. package/dist/server/registerInvestigationTools/helpers.js +46 -0
  1348. package/dist/server/registerInvestigationTools/types.js +1 -0
  1349. package/dist/server/registerInvestigationTools.js +168 -0
  1350. package/dist/server/registerJavaScriptRecoveryTool.js +9 -0
  1351. package/dist/server/registerJavaScriptRuntimeObservationTools.js +27 -0
  1352. package/dist/server/registerJebTools.js +16 -0
  1353. package/dist/server/registerManagedTools.js +40 -0
  1354. package/dist/server/registerManagedWorkflowTools/compareManagedMembers.js +53 -0
  1355. package/dist/server/registerManagedWorkflowTools/contract.js +7 -0
  1356. package/dist/server/registerManagedWorkflowTools/evidence.js +27 -0
  1357. package/dist/server/registerManagedWorkflowTools/importManagedReconstruction.js +27 -0
  1358. package/dist/server/registerManagedWorkflowTools/projectManagedApplicationGraph.js +41 -0
  1359. package/dist/server/registerManagedWorkflowTools/types.js +1 -0
  1360. package/dist/server/registerManagedWorkflowTools/verifyManagedNativeBoundaries.js +62 -0
  1361. package/dist/server/registerManagedWorkflowTools.js +11 -0
  1362. package/dist/server/registerOfficialTools.js +74 -0
  1363. package/dist/server/registerPeResourcesTool.js +9 -0
  1364. package/dist/server/registerProcessComparisonTool.js +156 -0
  1365. package/dist/server/registerPrompts.js +73 -0
  1366. package/dist/server/registerRecordedCrashTools.js +9 -0
  1367. package/dist/server/registerSessionRecordTools.js +90 -0
  1368. package/dist/server/registerSessionStatusTool.js +61 -0
  1369. package/dist/server/registerSessionTools.js +217 -0
  1370. package/dist/server/registerWasmTools.js +9 -0
  1371. package/dist/server/registerWebModuleTool.js +9 -0
  1372. package/dist/server/registerWebNetworkCaptureTool.js +20 -0
  1373. package/dist/server/registerWebRuntimeTools.js +27 -0
  1374. package/dist/server/registerWebScriptTool.js +18 -0
  1375. package/dist/server/registerWebSourceLocationTool.js +9 -0
  1376. package/dist/server/runDerivedOperation.js +55 -0
  1377. package/dist/server/sessionAvailabilityPolicy.js +29 -0
  1378. package/dist/server/sessionEvidence.js +11 -0
  1379. package/dist/server/toolLogging.js +11 -0
  1380. package/dist/server/toolRegistrationOptions.js +9 -0
  1381. package/dist/server/toolResult.js +119 -0
  1382. package/dist/server/toolResultEncoding.js +34 -0
  1383. package/dist/serverIdentity.js +69 -0
  1384. package/dist/wasm/WabtArtifactProvider.js +313 -0
  1385. package/dist/wasm/WabtFailures.js +62 -0
  1386. package/dist/wasm/WabtOutput.js +60 -0
  1387. package/dist/wasm/WabtRelease.js +12 -0
  1388. package/dist/wasm/WabtWat.js +184 -0
  1389. package/dist/wasm/WasmGlueAdapter.js +51 -0
  1390. package/dist/windows/WindowsNativeLoader.js +124 -0
  1391. package/dist/windows/WindowsOwnedProcess.js +265 -0
  1392. package/dist/windows/WindowsPrivateRuntime.js +143 -0
  1393. package/hooks/hooks.json +17 -0
  1394. package/install.sh +172 -0
  1395. package/licenses/Apache-2.0.txt +202 -0
  1396. package/licenses/GCC-Runtime-Library-Exception-3.1.txt +73 -0
  1397. package/licenses/GPL-3.0.txt +674 -0
  1398. package/licenses/MIT-template.txt +18 -0
  1399. package/licenses/MinGW-w64-runtime.txt +240 -0
  1400. package/licenses/Node-22.19.0-LICENSE.txt +2666 -0
  1401. package/licenses/README.md +54 -0
  1402. package/licenses/cfworker-MIT.txt +21 -0
  1403. package/licenses/digfox-MIT.txt +21 -0
  1404. package/licenses/dotnet-runtime-MIT.txt +23 -0
  1405. package/licenses/ghidra-12.1.4-DISCLAIMER.txt +13 -0
  1406. package/licenses/ghidra-12.1.4-LICENSE.txt +201 -0
  1407. package/licenses/ghidra-12.1.4-NOTICE.txt +49 -0
  1408. package/licenses/nativeaot-parser-MIT.txt +28 -0
  1409. package/licenses/npm-dependencies.txt +2812 -0
  1410. package/licenses/npm-runtime-notices.txt +6632 -0
  1411. package/licenses/rea-jev-MIT.txt +21 -0
  1412. package/licenses/rea-lab-MIT.txt +21 -0
  1413. package/licenses/upstream-sources.json +62 -0
  1414. package/licenses/xterm-MIT.txt +21 -0
  1415. package/native/windows/README.md +156 -0
  1416. package/native/windows/build/manifest.json +9 -0
  1417. package/native/windows/build/rea-windows-x64.node +0 -0
  1418. package/package.json +371 -4
  1419. package/port/cli.mjs +210 -0
  1420. package/port/hooks/guard.mjs +140 -0
  1421. package/port/knowledge/engines.json +67 -0
  1422. package/port/knowledge/footprints.json +189 -0
  1423. package/port/knowledge/maps/godot-godot-csharp.json +38 -0
  1424. package/port/knowledge/maps/godot-threejs.json +42 -0
  1425. package/port/knowledge/maps/godot-unity.json +62 -0
  1426. package/port/knowledge/maps/godot-unreal.json +48 -0
  1427. package/port/knowledge/maps/unity-godot.json +52 -0
  1428. package/port/knowledge/maps/unity-unreal.json +33 -0
  1429. package/port/knowledge/systems.json +1554 -0
  1430. package/port/mcp.mjs +62 -0
  1431. package/port/plugin/mcp-launch.mjs +19 -0
  1432. package/port/server.mjs +129 -0
  1433. package/port/src/agent.mjs +257 -0
  1434. package/port/src/archive.mjs +324 -0
  1435. package/port/src/binary.mjs +606 -0
  1436. package/port/src/blueprint.mjs +225 -0
  1437. package/port/src/compare.mjs +165 -0
  1438. package/port/src/connect.mjs +58 -0
  1439. package/port/src/convert.mjs +134 -0
  1440. package/port/src/formats.mjs +229 -0
  1441. package/port/src/graph.mjs +275 -0
  1442. package/port/src/knowledge.mjs +90 -0
  1443. package/port/src/lookup.mjs +615 -0
  1444. package/port/src/main-module.mjs +10 -0
  1445. package/port/src/plan.mjs +606 -0
  1446. package/port/src/porters.mjs +360 -0
  1447. package/port/src/proofcase.mjs +343 -0
  1448. package/port/src/relay.mjs +493 -0
  1449. package/port/src/scan.mjs +189 -0
  1450. package/port/src/scene.mjs +338 -0
  1451. package/port/src/stashpad.mjs +114 -0
  1452. package/port/src/symbols.mjs +201 -0
  1453. package/port/src/tools.mjs +198 -0
  1454. package/port/src/util.mjs +162 -0
  1455. package/port/src/workspace.mjs +39 -0
  1456. package/port/templates/unity/ReversePortSceneBuilder.cs +258 -0
  1457. package/scripts/electron-active-hook-boundaries.cjs +392 -0
  1458. package/scripts/electron-active-hook.cjs +673 -0
  1459. package/scripts/hopper-demo-x11.py +787 -0
  1460. package/scripts/prepack.mjs +60 -0
  1461. package/scripts/prepare.mjs +28 -0
  1462. package/scripts/rea.mjs +110 -0
  1463. package/scripts/verify-windows-native-artifact.mjs +39 -0
  1464. package/skills/build-inspector/SKILL.md +44 -0
  1465. package/skills/godot-port/SKILL.md +42 -0
  1466. package/skills/port-project/SKILL.md +59 -0
  1467. package/skills/port-verify/SKILL.md +35 -0
  1468. package/skills/proof-case/SKILL.md +52 -0
  1469. package/skills/rebuild/SKILL.md +66 -0
  1470. package/skills/reverse-engineer/SKILL.md +67 -0
  1471. package/skills/reverse-engineer-anything/SKILL.md +204 -0
  1472. package/skills/reverse-engineer-anything/references/android-applications.md +34 -0
  1473. package/skills/reverse-engineer-anything/references/connection-and-recovery.md +130 -0
  1474. package/skills/reverse-engineer-anything/references/evidence-workflows.md +54 -0
  1475. package/skills/reverse-engineer-anything/references/godot-source.md +37 -0
  1476. package/skills/reverse-engineer-anything/references/javascript-applications.md +175 -0
  1477. package/skills/reverse-engineer-anything/references/native-and-artifacts.md +252 -0
  1478. package/skills/reverse-engineer-anything/references/porting-and-rebuilds.md +92 -0
  1479. package/skills/reverse-engineer-anything/references/runtime-observation.md +28 -0
  1480. package/skills/reverse-engineer-anything/references/unity-source.md +32 -0
  1481. package/skills/troubleshoot/SKILL.md +27 -0
  1482. package/skills/unity-to-godot/SKILL.md +37 -0
  1483. package/third_party/README.md +60 -0
  1484. package/third_party/evmole/LICENSE +21 -0
  1485. package/third_party/evmole/README.md +22 -0
  1486. package/third_party/pwndbg/LICENSE.md +21 -0
  1487. package/third_party/pwndbg/README.md +23 -0
  1488. package/third_party/pwntools/README.md +40 -0
  1489. package/third_party/wabt/README.md +24 -0
@@ -0,0 +1,2773 @@
1
+ import { __esmMin } from "./rolldown-runtime-DXoylpqc.js";
2
+ import { ZIP_NON_ENTRY_TAIL_LIMITATION, artifactContradictionId, artifactEdgeId, artifactGraphDigest, artifactIdForContent, artifactInventoryResultSchema, artifactManifestId, compareUnicodeCodePoints, digestCanonicalValue, hasZipSignature, init_artifactGraph, init_artifactIdentity, init_canonicalDigest, init_unicodeCodePointOrder, init_zipPackageFormat, isZipPackageFormat, occurrenceIdForLocation, zipPackageFormatForPath } from "./reconstructionObligationLedgerSchemas-dvp6PEnZ.js";
3
+ import { ArtifactReaderFailure, copyArtifactEntry, init_ArtifactReader, sameArtifactEntry, sameArtifactSourceIdentity } from "./ArtifactReader-BXkffc1D.js";
4
+ import { execFileOutput, execFileOutputFailure, init_ExecFileOutput } from "./ExecFileOutput-Czbj-HpV.js";
5
+ import { init_dosMz, mzWindowsHeaderOffset, parseDosMzHeader } from "./dosMz-pwwUuxyC.js";
6
+ import { NonRegularFileReadError, OwnedFileHandle, RegularFileAdmissionFailure, init_OwnedFileHandle, init_RegularFile, openRegularFile, sameRegularFileState } from "./RegularFile-CL6meBxi.js";
7
+ import { ArtifactPathRegistry, OwnedDirectoryHandle, ZipArtifactReader, annotateEnglishUnicodeCaseCollisions, init_ArtifactPaths, init_OwnedDirectoryHandle, init_StreamBytes, init_ZipArtifactReader, normalizeArtifactPath, streamChunkToBuffer } from "./ZipArtifactReader-Db65WuM_.js";
8
+ import { init_readFileHandleChunks, readFileHandleChunks } from "./readFileHandleChunks-dp60iZ6v.js";
9
+ import { admitAsarHeader, init_AsarHeader } from "./AsarHeader-CnzOzYEH.js";
10
+ import { XcrunCommandRunner, init_CommandRunner, init_lipo, lipoSubtypeBits, parseLipoArchitectures } from "./lipo-BCA3wVyN.js";
11
+ import { init_machoContainer, readFatSliceDeclarations, validateFatSlice } from "./machoContainer-DxxkB2b0.js";
12
+ import { basename, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
13
+ import { createHash } from "node:crypto";
14
+ import { z } from "zod";
15
+ import { lstat, mkdtemp, open, opendir, realpath, rm } from "node:fs/promises";
16
+ import { constants, createWriteStream } from "node:fs";
17
+ import { Readable, Transform } from "node:stream";
18
+ import { tmpdir } from "node:os";
19
+ import { pipeline } from "node:stream/promises";
20
+ import { parse } from "plist";
21
+ import { listPackage, statFile, uncache } from "@electron/asar";
22
+
23
+ //#region dist/artifacts/AsarEntryStream.js
24
+ var closeAsarHandle, readValidatedAsarEntry, abortIfNeeded$3, asarFailure$1, isFilesystemFailure$1;
25
+ function init_AsarEntryStream() {
26
+ return (init_AsarEntryStream = __esmMin((() => {
27
+ init_ArtifactReader();
28
+ closeAsarHandle = async (close, signal) => {
29
+ await close();
30
+ abortIfNeeded$3(signal);
31
+ };
32
+ readValidatedAsarEntry = (source, expectedBytes, entryPath, archivePath, signal) => {
33
+ const output = Readable.from((async function* () {
34
+ let observedBytes = 0;
35
+ const iterator = source[Symbol.asyncIterator]();
36
+ try {
37
+ while (true) {
38
+ abortIfNeeded$3(signal);
39
+ const next = await iterator.next();
40
+ if (next.done) break;
41
+ const chunk = next.value;
42
+ if (!Buffer.isBuffer(chunk) && !(chunk instanceof Uint8Array)) throw new ArtifactReaderFailure("format", `ASAR entry did not return bytes: ${entryPath}`);
43
+ observedBytes += Buffer.isBuffer(chunk) ? chunk.length : chunk.byteLength;
44
+ if (expectedBytes !== undefined && observedBytes > expectedBytes) throw new ArtifactReaderFailure("integrity", `ASAR entry exceeded its declared size: ${entryPath}`);
45
+ yield chunk;
46
+ }
47
+ if (expectedBytes !== undefined && observedBytes !== expectedBytes) throw new ArtifactReaderFailure("integrity", `ASAR entry size disagrees with its header: ${entryPath}`);
48
+ } catch (cause) {
49
+ throw asarFailure$1(archivePath, `read ${entryPath}`, cause);
50
+ } finally {
51
+ try {
52
+ await iterator.return?.();
53
+ } catch {}
54
+ if (!source.destroyed) source.destroy();
55
+ }
56
+ })());
57
+ const closeSource = () => {
58
+ signal?.removeEventListener("abort", onAbort);
59
+ if (!source.destroyed) source.destroy();
60
+ };
61
+ const onAbort = () => {
62
+ closeSource();
63
+ output.destroy(new ArtifactReaderFailure("cancelled", "ASAR operation cancelled"));
64
+ };
65
+ output.once("close", closeSource);
66
+ signal?.addEventListener("abort", onAbort, { once: true });
67
+ if (signal?.aborted === true) onAbort();
68
+ return output;
69
+ };
70
+ abortIfNeeded$3 = (signal) => {
71
+ if (signal?.aborted === true) throw new ArtifactReaderFailure("cancelled", "ASAR operation cancelled");
72
+ };
73
+ asarFailure$1 = (path, operation, cause) => {
74
+ if (cause instanceof ArtifactReaderFailure) return cause;
75
+ if (isFilesystemFailure$1(cause)) return new ArtifactReaderFailure("io", `Could not ${operation} ASAR at ${path}: ${cause.message}`, { cause });
76
+ return new ArtifactReaderFailure("format", `Malformed ASAR during ${operation}: ${path}`, { cause });
77
+ };
78
+ isFilesystemFailure$1 = (cause) => cause instanceof Error && "errno" in cause && typeof cause.errno === "number" && "syscall" in cause && typeof cause.syscall === "string";
79
+ })))();
80
+ }
81
+
82
+ //#endregion
83
+ //#region dist/artifacts/AsarArtifactReader.js
84
+ var AsarArtifactReader, defaultRemoveSnapshot, asarUnpackedEntryFailure, isAsarFileMetadata, parseArchiveOffset, abortIfNeeded$2, waitForOperation, orderAsarListing, toArtifactPath, asarFailure, isFilesystemFailure, isMissingFile;
85
+ function init_AsarArtifactReader() {
86
+ return (init_AsarArtifactReader = __esmMin((() => {
87
+ init_ArtifactReader();
88
+ init_AsarEntryStream();
89
+ init_AsarHeader();
90
+ init_OwnedFileHandle();
91
+ init_readFileHandleChunks();
92
+ init_unicodeCodePointOrder();
93
+ AsarArtifactReader = class {
94
+ path;
95
+ options;
96
+ format = "asar";
97
+ #archiveSize;
98
+ #headerSize;
99
+ #entries = new Map();
100
+ #ownedHandles = new Map();
101
+ #snapshot;
102
+ #snapshotRoot;
103
+ #snapshotOperation = Promise.resolve();
104
+ constructor(path, options = {}) {
105
+ this.path = path;
106
+ this.options = options;
107
+ }
108
+ async *entries(signal) {
109
+ let paths;
110
+ try {
111
+ await this.prepareContainer(undefined, signal);
112
+ paths = await this.#withSnapshotOperation(async () => {
113
+ const snapshotPath = this.#snapshotPath();
114
+ this.#resetArchiveState();
115
+ this.#entries.clear();
116
+ const admitted = await this.#admitHeader(snapshotPath);
117
+ this.#archiveSize = admitted.archiveBytes;
118
+ this.#headerSize = admitted.headerBytes;
119
+ abortIfNeeded$2(signal);
120
+ const ordered = orderAsarListing(listPackage(snapshotPath, { isPack: false }));
121
+ const archiveMetadata = await lstat(snapshotPath);
122
+ if (!archiveMetadata.isFile() || archiveMetadata.isSymbolicLink()) throw new ArtifactReaderFailure("format", "ASAR container is not a regular file");
123
+ this.#archiveSize = archiveMetadata.size;
124
+ return ordered;
125
+ }, signal);
126
+ } catch (cause) {
127
+ throw asarFailure(this.path, "inventory", cause);
128
+ }
129
+ for (const { listed, path } of paths) {
130
+ abortIfNeeded$2(signal);
131
+ if (path.length === 0) continue;
132
+ const providerPath = listed.startsWith(sep) ? listed.slice(sep.length) : listed;
133
+ let metadata;
134
+ try {
135
+ metadata = statFile(this.#snapshotPath(), providerPath, false);
136
+ } catch (cause) {
137
+ throw asarFailure(this.path, `stat ${path}`, cause);
138
+ }
139
+ const kind = "files" in metadata ? "directory" : "link" in metadata ? "symlink" : "file";
140
+ const entry = {
141
+ path,
142
+ kind,
143
+ declaredSize: "size" in metadata ? metadata.size : null,
144
+ compressedSize: null,
145
+ executable: "executable" in metadata && metadata.executable,
146
+ encrypted: false,
147
+ byteOffset: null,
148
+ declaredSha256: "integrity" in metadata && metadata.integrity.algorithm === "SHA256" && /^[a-f0-9]{64}$/u.test(metadata.integrity.hash) ? metadata.integrity.hash : null,
149
+ unpacked: "unpacked" in metadata && metadata.unpacked === true,
150
+ limitations: kind === "symlink" ? ["ASAR symlink target was not followed or disclosed."] : [],
151
+ adapterKey: providerPath
152
+ };
153
+ if (kind === "file" && isAsarFileMetadata(metadata)) this.#entries.set(providerPath, {
154
+ metadata,
155
+ entry: copyArtifactEntry(entry)
156
+ });
157
+ yield entry;
158
+ }
159
+ }
160
+ async #admitHeader(snapshotPath) {
161
+ const headerHandle = await this.#openOwned(snapshotPath, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
162
+ let admission;
163
+ try {
164
+ admission = {
165
+ ok: true,
166
+ value: await admitAsarHeader(headerHandle)
167
+ };
168
+ } catch (cause) {
169
+ admission = {
170
+ ok: false,
171
+ cause
172
+ };
173
+ }
174
+ try {
175
+ await this.#closeOwnedHandle(headerHandle);
176
+ } catch (cleanupCause) {
177
+ if (!admission.ok) throw ArtifactReaderFailure.withCleanup(admission.cause, ArtifactReaderFailure.cleanupObservation(cleanupCause, snapshotPath));
178
+ throw cleanupCause;
179
+ }
180
+ if (!admission.ok) throw admission.cause;
181
+ return admission.value;
182
+ }
183
+ async open(entry, signal) {
184
+ return this.#withSnapshotOperation(() => this.#openEntry(entry, signal), signal);
185
+ }
186
+ async #openEntry(entry, signal) {
187
+ abortIfNeeded$2(signal);
188
+ const state = this.#entries.get(entry.adapterKey);
189
+ if (state === undefined && entry.kind !== "file") throw new ArtifactReaderFailure("format", "ASAR entry is not a regular file");
190
+ if (state === undefined) throw new ArtifactReaderFailure("integrity", `ASAR entry was not produced by this reader: ${entry.path}`);
191
+ if (!sameArtifactEntry(entry, state.entry)) throw new ArtifactReaderFailure("integrity", `ASAR entry metadata changed since inventory: ${state.entry.path}`);
192
+ if (state.entry.unpacked) return this.#openUnpackedStream(state.entry, signal);
193
+ return this.#openPackedStream(state, signal);
194
+ }
195
+ async #openPackedStream(state, signal) {
196
+ const { metadata, entry: producedEntry } = state;
197
+ const archiveSize = this.#archiveSize;
198
+ const headerSize = this.#headerSize;
199
+ const offset = metadata.offset === undefined ? undefined : parseArchiveOffset(metadata.offset);
200
+ const start = offset === undefined || headerSize === undefined ? undefined : 8 + headerSize + offset;
201
+ 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}`);
202
+ const snapshotPath = this.#snapshotPath();
203
+ let handle;
204
+ try {
205
+ const openedHandle = await this.#openOwned(snapshotPath, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
206
+ handle = openedHandle;
207
+ const observed = await openedHandle.stat();
208
+ abortIfNeeded$2(signal);
209
+ if (!observed.isFile() || observed.size !== archiveSize) throw new ArtifactReaderFailure("integrity", `ASAR container changed before read: ${producedEntry.path}`);
210
+ if (metadata.size === 0) {
211
+ handle = undefined;
212
+ await closeAsarHandle(() => this.#closeOwnedHandle(openedHandle), signal);
213
+ return Readable.from([]);
214
+ }
215
+ const source = this.#ownedReadStream(openedHandle, {
216
+ start,
217
+ end: start + metadata.size - 1,
218
+ signal
219
+ });
220
+ handle = undefined;
221
+ const output = readValidatedAsarEntry(source, metadata.size, producedEntry.path, this.path, signal);
222
+ this.#setOwnedOutput(openedHandle, output);
223
+ return output;
224
+ } catch (cause) {
225
+ const failure = asarFailure(this.path, `read ${producedEntry.path}`, cause);
226
+ if (handle !== undefined) {
227
+ try {
228
+ await this.#closeOwnedHandle(handle);
229
+ } catch (cleanupCause) {
230
+ throw ArtifactReaderFailure.withCleanup(failure, ArtifactReaderFailure.cleanupObservation(cleanupCause, snapshotPath));
231
+ }
232
+ }
233
+ throw failure;
234
+ }
235
+ }
236
+ /** Capture once per reader lifetime; bind all interpretation to these exact bytes. */
237
+ async prepareContainer(expectedSha256, signal) {
238
+ await this.#withSnapshotOperation(async () => {
239
+ abortIfNeeded$2(signal);
240
+ if (this.#snapshot === undefined && this.#snapshotRoot !== undefined) await this.#closeSnapshot();
241
+ if (this.#snapshot === undefined) await this.#captureSnapshot(signal);
242
+ if (expectedSha256 !== undefined && this.#snapshot?.sha256 !== expectedSha256) throw new ArtifactReaderFailure("integrity", `ASAR container changed before interpretation: ${this.path}`);
243
+ }, signal);
244
+ }
245
+ /** Read the same captured container that supplies headers and packed members. */
246
+ async openContainer(signal) {
247
+ await this.prepareContainer(undefined, signal);
248
+ return this.#withSnapshotOperation(async () => {
249
+ abortIfNeeded$2(signal);
250
+ const snapshotPath = this.#snapshotPath();
251
+ const handle = await this.#openOwned(snapshotPath, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
252
+ return this.#ownedReadStream(handle, { signal });
253
+ }, signal);
254
+ }
255
+ async close() {
256
+ await this.#withSnapshotOperation(() => this.#closeSnapshot());
257
+ }
258
+ async #captureSnapshot(signal) {
259
+ let inputHandle;
260
+ try {
261
+ this.#snapshotRoot = await mkdtemp(join(tmpdir(), "rea-asar-snapshot-"));
262
+ const snapshotPath = join(this.#snapshotRoot, "container.asar");
263
+ const hash = createHash("sha256");
264
+ inputHandle = await this.#openOwned(this.path, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
265
+ const source = this.#ownedReadStream(inputHandle, {
266
+ signal,
267
+ releaseOnClose: false
268
+ });
269
+ const digesting = new Transform({ transform(chunk, _encoding, callback) {
270
+ hash.update(chunk);
271
+ callback(null, chunk);
272
+ } });
273
+ await pipeline(source, digesting, createWriteStream(snapshotPath, {
274
+ flags: "wx",
275
+ mode: 384
276
+ }), signal === undefined ? {} : { signal });
277
+ const completedInput = inputHandle;
278
+ inputHandle = undefined;
279
+ await this.#closeOwnedHandle(completedInput);
280
+ this.#snapshot = {
281
+ path: snapshotPath,
282
+ sha256: hash.digest("hex")
283
+ };
284
+ } catch (cause) {
285
+ let failure = signal?.aborted === true ? new ArtifactReaderFailure("cancelled", "ASAR operation cancelled", { cause }) : asarFailure(this.path, "snapshot", cause);
286
+ if (inputHandle !== undefined) {
287
+ const failedInput = inputHandle;
288
+ inputHandle = undefined;
289
+ try {
290
+ await this.#closeOwnedHandle(failedInput);
291
+ } catch (cleanupCause) {
292
+ failure = ArtifactReaderFailure.withCleanup(failure, ArtifactReaderFailure.cleanupObservation(cleanupCause, this.path));
293
+ }
294
+ }
295
+ try {
296
+ if (this.#ownedHandles.size === 0) await this.#closeSnapshot();
297
+ } catch (cleanupCause) {
298
+ throw ArtifactReaderFailure.withCleanup(failure, ArtifactReaderFailure.cleanupObservation(cleanupCause, this.#snapshotRoot ?? this.path));
299
+ }
300
+ throw failure;
301
+ }
302
+ }
303
+ async #closeSnapshot() {
304
+ await this.#closeOwnedHandles();
305
+ const root = this.#snapshotRoot;
306
+ if (root !== undefined) {
307
+ try {
308
+ await (this.options.removeSnapshot ?? defaultRemoveSnapshot)(root);
309
+ if (this.#snapshotRoot === root) this.#snapshotRoot = undefined;
310
+ } catch (cause) {
311
+ throw ArtifactReaderFailure.withCleanup(cause, {
312
+ reason: `Could not remove ASAR snapshot: ${root}`,
313
+ resources: [root]
314
+ });
315
+ }
316
+ }
317
+ if (root === undefined || this.#snapshotRoot === undefined) {
318
+ if (this.#snapshot !== undefined) uncache(this.#snapshot.path);
319
+ this.#snapshot = undefined;
320
+ this.#resetArchiveState();
321
+ this.#entries.clear();
322
+ }
323
+ }
324
+ async #withSnapshotOperation(operation, signal) {
325
+ const previous = this.#snapshotOperation;
326
+ let release;
327
+ this.#snapshotOperation = new Promise((resolve) => {
328
+ release = resolve;
329
+ });
330
+ try {
331
+ await waitForOperation(previous, signal);
332
+ } catch (cause) {
333
+ void previous.then(release, release);
334
+ throw cause;
335
+ }
336
+ try {
337
+ abortIfNeeded$2(signal);
338
+ return await operation();
339
+ } finally {
340
+ release();
341
+ }
342
+ }
343
+ #snapshotPath() {
344
+ if (this.#snapshot === undefined) throw new ArtifactReaderFailure("integrity", "ASAR snapshot is not available");
345
+ return this.#snapshot.path;
346
+ }
347
+ provenance() {
348
+ return [];
349
+ }
350
+ async #openUnpackedStream(entry, signal) {
351
+ const unpackedRoot = `${this.path}.unpacked`;
352
+ let handle;
353
+ try {
354
+ const rootMetadata = await lstat(unpackedRoot);
355
+ if (!rootMetadata.isDirectory() || rootMetadata.isSymbolicLink()) throw new ArtifactReaderFailure("path", "ASAR unpacked companion is not a regular directory");
356
+ const canonicalRoot = await realpath(unpackedRoot);
357
+ const candidate = join(unpackedRoot, entry.adapterKey);
358
+ const canonical = await realpath(candidate);
359
+ const relativePath = relative(canonicalRoot, canonical);
360
+ if (relativePath === ".." || relativePath.startsWith(`..${sep}`) || isAbsolute(relativePath)) throw new ArtifactReaderFailure("path", `ASAR unpacked entry escaped its companion directory: ${entry.path}`);
361
+ const pathMetadata = await lstat(candidate);
362
+ if (!pathMetadata.isFile() || pathMetadata.isSymbolicLink()) throw new ArtifactReaderFailure("path", `ASAR unpacked entry is not a regular file: ${entry.path}`);
363
+ handle = await (this.options.openUnpackedFile ?? open)(canonical, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
364
+ const openedHandle = handle;
365
+ this.#adoptHandle(openedHandle, canonical);
366
+ const openedMetadata = await openedHandle.stat();
367
+ if (!openedMetadata.isFile() || openedMetadata.dev !== pathMetadata.dev || openedMetadata.ino !== pathMetadata.ino) {
368
+ throw new ArtifactReaderFailure("integrity", `ASAR unpacked entry changed before read: ${entry.path}`, {}, {
369
+ logicalPath: entry.path,
370
+ declaredSha256: entry.declaredSha256,
371
+ calculatedSha256: null,
372
+ unpacked: true
373
+ });
374
+ }
375
+ abortIfNeeded$2(signal);
376
+ const source = this.#ownedReadStream(openedHandle, { start: 0 });
377
+ handle = undefined;
378
+ const output = readValidatedAsarEntry(source, undefined, entry.path, this.path, signal);
379
+ this.#setOwnedOutput(openedHandle, output);
380
+ return output;
381
+ } catch (cause) {
382
+ let failure = asarUnpackedEntryFailure(this.path, entry, cause);
383
+ if (handle !== undefined && this.#ownedHandles.has(handle)) {
384
+ try {
385
+ await this.#closeOwnedHandle(handle);
386
+ } catch (cleanupCause) {
387
+ failure = ArtifactReaderFailure.withCleanup(failure, ArtifactReaderFailure.cleanupObservation(cleanupCause, this.#ownedHandles.get(handle)?.path ?? entry.path));
388
+ }
389
+ }
390
+ throw failure;
391
+ }
392
+ }
393
+ async #closeOwnedHandle(handle) {
394
+ const owned = this.#ownedHandles.get(handle);
395
+ if (owned === undefined) return;
396
+ owned.output?.destroy();
397
+ owned.source?.destroy();
398
+ try {
399
+ await owned.owner.close();
400
+ } catch (cause) {
401
+ throw ArtifactReaderFailure.withCleanup(cause, ArtifactReaderFailure.cleanupObservation(cause, owned.path));
402
+ }
403
+ this.#ownedHandles.delete(handle);
404
+ }
405
+ async #closeOwnedHandles() {
406
+ let failure;
407
+ for (const [handle, owned] of this.#ownedHandles) {
408
+ try {
409
+ await this.#closeOwnedHandle(handle);
410
+ } catch (cause) {
411
+ failure = ArtifactReaderFailure.withCleanup(failure ?? cause, ArtifactReaderFailure.cleanupObservation(cause, owned.path));
412
+ }
413
+ }
414
+ if (failure !== undefined) throw failure;
415
+ }
416
+ async #openOwned(path, flags) {
417
+ const handle = await (this.options.openFile ?? open)(path, flags);
418
+ this.#adoptHandle(handle, path);
419
+ return handle;
420
+ }
421
+ #adoptHandle(handle, path) {
422
+ this.#ownedHandles.set(handle, {
423
+ path,
424
+ owner: new OwnedFileHandle(handle)
425
+ });
426
+ }
427
+ #ownedReadStream(handle, options) {
428
+ const { releaseOnClose, ...readOptions } = options;
429
+ const source = readFileHandleChunks(handle, readOptions);
430
+ const owned = this.#ownedHandles.get(handle);
431
+ if (owned === undefined) throw new ArtifactReaderFailure("integrity", "ASAR handle has no owner");
432
+ owned.source = source;
433
+ owned.output = source;
434
+ if (releaseOnClose !== false) source.once("close", () => {
435
+ void this.#closeOwnedHandle(handle).catch(() => undefined);
436
+ });
437
+ return source;
438
+ }
439
+ #setOwnedOutput(handle, output) {
440
+ const owned = this.#ownedHandles.get(handle);
441
+ if (owned !== undefined) owned.output = output;
442
+ }
443
+ #resetArchiveState() {
444
+ this.#archiveSize = undefined;
445
+ this.#headerSize = undefined;
446
+ }
447
+ };
448
+ defaultRemoveSnapshot = (path) => rm(path, {
449
+ recursive: true,
450
+ force: true
451
+ });
452
+ asarUnpackedEntryFailure = (archivePath, entry, cause) => {
453
+ if (cause instanceof ArtifactReaderFailure) return cause;
454
+ if (entry.unpacked && isMissingFile(cause)) return new ArtifactReaderFailure("unavailable", `ASAR unpacked entry bytes are unavailable: ${entry.path}`, { cause }, {
455
+ logicalPath: entry.path,
456
+ declaredSha256: entry.declaredSha256,
457
+ calculatedSha256: null,
458
+ unpacked: true
459
+ });
460
+ return asarFailure(archivePath, `read ${entry.path}`, cause);
461
+ };
462
+ isAsarFileMetadata = (metadata) => "size" in metadata && typeof metadata.size === "number" && !("files" in metadata) && !("link" in metadata);
463
+ parseArchiveOffset = (value) => {
464
+ if (!/^(?:0|[1-9][0-9]*)$/u.test(value)) return undefined;
465
+ const offset = Number(value);
466
+ return Number.isSafeInteger(offset) ? offset : undefined;
467
+ };
468
+ abortIfNeeded$2 = (signal) => {
469
+ if (signal?.aborted === true) throw new ArtifactReaderFailure("cancelled", "ASAR operation cancelled");
470
+ };
471
+ waitForOperation = async (operation, signal) => {
472
+ if (signal === undefined) return operation;
473
+ abortIfNeeded$2(signal);
474
+ await new Promise((resolve, reject) => {
475
+ const removeAbortListener = () => signal.removeEventListener("abort", onAbort);
476
+ const onAbort = () => {
477
+ removeAbortListener();
478
+ reject(new ArtifactReaderFailure("cancelled", "ASAR operation cancelled"));
479
+ };
480
+ signal.addEventListener("abort", onAbort, { once: true });
481
+ operation.then(() => {
482
+ removeAbortListener();
483
+ resolve();
484
+ }, (cause) => {
485
+ removeAbortListener();
486
+ reject(cause);
487
+ });
488
+ });
489
+ };
490
+ orderAsarListing = (listed, separator = sep) => listed.map((entry) => ({
491
+ listed: entry,
492
+ path: toArtifactPath(entry, separator)
493
+ })).sort((left, right) => compareUnicodeCodePoints(left.path, right.path));
494
+ toArtifactPath = (listed, separator) => {
495
+ const portable = separator === "\\" ? listed.replaceAll("\\", "/") : listed;
496
+ return portable.replace(/^\/+|\/+$/gu, "");
497
+ };
498
+ asarFailure = (path, operation, cause) => {
499
+ if (cause instanceof ArtifactReaderFailure) return cause;
500
+ if (isFilesystemFailure(cause)) return new ArtifactReaderFailure("io", `Could not ${operation} ASAR at ${path}: ${cause.message}`, { cause });
501
+ return new ArtifactReaderFailure("format", `Malformed ASAR during ${operation}: ${path}`, { cause });
502
+ };
503
+ isFilesystemFailure = (cause) => cause instanceof Error && "errno" in cause && typeof cause.errno === "number" && "syscall" in cause && typeof cause.syscall === "string";
504
+ isMissingFile = (cause) => typeof cause === "object" && cause !== null && "code" in cause && cause.code === "ENOENT";
505
+ })))();
506
+ }
507
+
508
+ //#endregion
509
+ //#region dist/artifacts/hostExecutableMarking.js
510
+ var windowsLaunchableExtensions, hostExecutableMarking;
511
+ function init_hostExecutableMarking() {
512
+ return (init_hostExecutableMarking = __esmMin((() => {
513
+ windowsLaunchableExtensions = new Set([
514
+ ".bat",
515
+ ".cmd",
516
+ ".com",
517
+ ".exe"
518
+ ]);
519
+ 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;
520
+ })))();
521
+ }
522
+
523
+ //#endregion
524
+ //#region dist/artifacts/DirectoryArtifactReader.js
525
+ var DirectoryArtifactReader, artifactEntry, safeArtifactSize, directoryIoFailure, failureMessage$1, mapStableFileRead, withDirectoryIoContext, abortIfNeeded$1, assertContainedDirectory;
526
+ function init_DirectoryArtifactReader() {
527
+ return (init_DirectoryArtifactReader = __esmMin((() => {
528
+ init_ArtifactReader();
529
+ init_hostExecutableMarking();
530
+ init_OwnedDirectoryHandle();
531
+ init_OwnedFileHandle();
532
+ init_readFileHandleChunks();
533
+ DirectoryArtifactReader = class {
534
+ format = "directory";
535
+ #rootPromise;
536
+ #rootPath;
537
+ #directories = new Set();
538
+ #files = new Map();
539
+ constructor(root) {
540
+ this.#rootPath = root;
541
+ }
542
+ /** Enumerate entries, optionally restricting descent while retaining directories. */
543
+ async *entries(signal, descendInto) {
544
+ const root = await this.#resolveRoot();
545
+ const pending = [root];
546
+ while (pending.length > 0) {
547
+ abortIfNeeded$1(signal);
548
+ const directory = pending.pop();
549
+ if (directory === undefined) break;
550
+ await withDirectoryIoContext("inspect directory", directory, () => assertContainedDirectory(root, directory));
551
+ for await (const entry of this.#readDirectory(directory, pending, signal, descendInto)) yield entry;
552
+ await withDirectoryIoContext("inspect directory", directory, () => assertContainedDirectory(root, directory));
553
+ }
554
+ }
555
+ async #resolveRoot() {
556
+ return (this.#rootPromise ??= realpath(this.#rootPath)).catch((cause) => {
557
+ throw directoryIoFailure("resolve artifact root", this.#rootPath, cause);
558
+ });
559
+ }
560
+ async *#readDirectory(directory, pending, signal, descendInto) {
561
+ const root = await this.#resolveRoot();
562
+ const handle = new OwnedDirectoryHandle(await opendir(directory).catch((cause) => {
563
+ throw directoryIoFailure("open directory", directory, cause);
564
+ }));
565
+ this.#directories.add(handle);
566
+ const childDirectories = [];
567
+ let traversal = { kind: "complete" };
568
+ try {
569
+ for (;;) {
570
+ const child = await handle.handle.read();
571
+ if (child === null) break;
572
+ abortIfNeeded$1(signal);
573
+ const absolute = join(directory, child.name);
574
+ const metadata = await lstat(absolute, { bigint: true }).catch((cause) => {
575
+ throw directoryIoFailure("inspect entry", absolute, cause);
576
+ });
577
+ const path = relative(root, absolute).split(sep).join("/");
578
+ const entry = artifactEntry(path, absolute, metadata);
579
+ if (entry === undefined) continue;
580
+ yield entry;
581
+ if (entry.kind === "directory" && (descendInto?.(path) ?? true)) childDirectories.push(absolute);
582
+ }
583
+ } catch (cause) {
584
+ traversal = {
585
+ kind: "failed",
586
+ cause: cause instanceof ArtifactReaderFailure ? cause : directoryIoFailure("read directory", directory, cause)
587
+ };
588
+ } finally {
589
+ await this.#finishDirectory(handle, directory, traversal);
590
+ }
591
+ if (traversal.kind === "failed") throw traversal.cause;
592
+ childDirectories.reverse();
593
+ pending.push(...childDirectories);
594
+ }
595
+ async #finishDirectory(handle, path, traversal) {
596
+ try {
597
+ await handle.close();
598
+ this.#directories.delete(handle);
599
+ } catch (cause) {
600
+ const closeFailure = directoryIoFailure("close directory", path, cause);
601
+ if (traversal.kind === "failed") throw ArtifactReaderFailure.withCleanup(traversal.cause, ArtifactReaderFailure.cleanupObservation(closeFailure, path));
602
+ throw closeFailure;
603
+ }
604
+ }
605
+ async open(entry, signal) {
606
+ abortIfNeeded$1(signal);
607
+ if (entry.kind !== "file") throw new ArtifactReaderFailure("format", "Only regular files can be opened");
608
+ const fileHandle = await open(entry.adapterKey, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK).catch((cause) => {
609
+ throw directoryIoFailure("open entry", entry.adapterKey, cause);
610
+ });
611
+ const owner = new OwnedFileHandle(fileHandle);
612
+ this.#files.set(owner, entry.adapterKey);
613
+ try {
614
+ const observed = await owner.handle.stat({ bigint: true }).catch((cause) => {
615
+ throw directoryIoFailure("inspect opened entry", entry.adapterKey, cause);
616
+ });
617
+ if (!observed.isFile() || !sameArtifactSourceIdentity(entry.sourceIdentity, observed)) {
618
+ throw new ArtifactReaderFailure("integrity", `Directory entry changed before open: ${entry.path}`);
619
+ }
620
+ abortIfNeeded$1(signal);
621
+ const source = Readable.from(mapStableFileRead(owner.handle, entry, signal), { objectMode: false });
622
+ source.once("close", () => {
623
+ void this.#closeFile(owner).catch(() => undefined);
624
+ });
625
+ return source;
626
+ } catch (cause) {
627
+ try {
628
+ await this.#closeFile(owner);
629
+ } catch (closeCause) {
630
+ throw ArtifactReaderFailure.withCleanup(cause, ArtifactReaderFailure.cleanupObservation(directoryIoFailure("close opened entry", entry.adapterKey, closeCause), entry.adapterKey));
631
+ }
632
+ throw cause;
633
+ }
634
+ }
635
+ async close() {
636
+ const failures = [];
637
+ for (const [owner, path] of this.#files) {
638
+ try {
639
+ await this.#closeFile(owner);
640
+ } catch (cause) {
641
+ failures.push(directoryIoFailure("close opened entry", path, cause));
642
+ }
643
+ }
644
+ for (const owner of this.#directories) {
645
+ try {
646
+ await owner.close();
647
+ this.#directories.delete(owner);
648
+ } catch (cause) {
649
+ failures.push(directoryIoFailure("close directory", owner.handle.path, cause));
650
+ }
651
+ }
652
+ if (failures.length > 0) {
653
+ const reason = failures.map(failureMessage$1).join("; ");
654
+ throw new ArtifactReaderFailure("io", `Directory artifact cleanup failed: ${reason}`, {
655
+ cause: new AggregateError(failures),
656
+ cleanup: {
657
+ reason,
658
+ resources: [...this.#files.values(), ...[...this.#directories].map((owner) => owner.handle.path)]
659
+ }
660
+ });
661
+ }
662
+ }
663
+ async #closeFile(owner) {
664
+ await owner.close();
665
+ this.#files.delete(owner);
666
+ }
667
+ provenance() {
668
+ return [];
669
+ }
670
+ };
671
+ artifactEntry = (path, absolute, metadata) => {
672
+ const kind = metadata.isSymbolicLink() ? "symlink" : metadata.isDirectory() ? "directory" : metadata.isFile() ? "file" : undefined;
673
+ if (kind === undefined) return undefined;
674
+ return {
675
+ path,
676
+ kind,
677
+ declaredSize: kind === "file" ? safeArtifactSize(metadata.size) : null,
678
+ compressedSize: null,
679
+ executable: hostExecutableMarking(absolute, metadata),
680
+ encrypted: false,
681
+ byteOffset: null,
682
+ declaredSha256: null,
683
+ unpacked: false,
684
+ limitations: kind === "symlink" ? ["Symlink target was not followed or disclosed."] : [],
685
+ adapterKey: absolute,
686
+ ...kind === "file" ? { sourceIdentity: {
687
+ device: metadata.dev,
688
+ inode: metadata.ino,
689
+ size: metadata.size,
690
+ mode: metadata.mode,
691
+ mtimeNs: metadata.mtimeNs,
692
+ ctimeNs: metadata.ctimeNs
693
+ } } : {}
694
+ };
695
+ };
696
+ safeArtifactSize = (size) => {
697
+ if (size < 0n || size > BigInt(Number.MAX_SAFE_INTEGER)) return null;
698
+ return Number(size);
699
+ };
700
+ directoryIoFailure = (operation, path, cause) => {
701
+ if (cause instanceof ArtifactReaderFailure) return cause;
702
+ const code = typeof cause === "object" && cause !== null && "code" in cause && typeof cause.code === "string" ? ` (${cause.code})` : "";
703
+ const detail = failureMessage$1(cause);
704
+ return new ArtifactReaderFailure("io", `Could not ${operation} at ${path}${code}: ${detail}`, { cause });
705
+ };
706
+ failureMessage$1 = (cause) => cause instanceof Error ? cause.message : String(cause);
707
+ mapStableFileRead = async function* (handle, entry, signal) {
708
+ let bytes = 0n;
709
+ try {
710
+ const expectedBytes = entry.sourceIdentity?.size;
711
+ if (expectedBytes === undefined) throw new ArtifactReaderFailure("integrity", `Directory entry has no captured file state: ${entry.path}`);
712
+ for await (const chunk of readFileHandleChunks(handle, {
713
+ end: expectedBytes,
714
+ signal
715
+ })) {
716
+ abortIfNeeded$1(signal);
717
+ bytes += BigInt(chunk.length);
718
+ yield chunk;
719
+ }
720
+ abortIfNeeded$1(signal);
721
+ const [opened, current] = await Promise.all([handle.stat({ bigint: true }), lstat(entry.adapterKey, { bigint: true })]);
722
+ abortIfNeeded$1(signal);
723
+ 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}`);
724
+ } catch (cause) {
725
+ if (signal?.aborted === true) throw new ArtifactReaderFailure("cancelled", "Directory artifact read cancelled", { cause });
726
+ if (cause instanceof Error && "code" in cause && [
727
+ "ENOENT",
728
+ "ENOTDIR",
729
+ "ELOOP"
730
+ ].includes(String(cause.code))) throw new ArtifactReaderFailure("integrity", `Directory entry changed during read: ${entry.path}`, { cause });
731
+ if (!(cause instanceof ArtifactReaderFailure)) throw directoryIoFailure("validate read entry", entry.adapterKey, cause);
732
+ throw cause;
733
+ }
734
+ };
735
+ withDirectoryIoContext = async (operation, path, action) => {
736
+ try {
737
+ return await action();
738
+ } catch (cause) {
739
+ throw directoryIoFailure(operation, path, cause);
740
+ }
741
+ };
742
+ abortIfNeeded$1 = (signal) => {
743
+ if (signal?.aborted === true) throw new ArtifactReaderFailure("cancelled", "Artifact traversal cancelled");
744
+ };
745
+ assertContainedDirectory = async (root, directory) => {
746
+ const canonical = await realpath(directory);
747
+ const fromRoot = relative(root, canonical);
748
+ const metadata = await lstat(directory);
749
+ if (metadata.isSymbolicLink() || !metadata.isDirectory() || fromRoot === ".." || fromRoot.startsWith(`..${sep}`) || isAbsolute(fromRoot)) throw new ArtifactReaderFailure("path", "Directory traversal escaped or changed its artifact root");
750
+ };
751
+ })))();
752
+ }
753
+
754
+ //#endregion
755
+ //#region dist/artifacts/ArtifactHash.js
756
+ var ARTIFACT_CLASSIFICATION_PREFIX_BYTES, abortIfNeeded, hashReadable;
757
+ function init_ArtifactHash() {
758
+ return (init_ArtifactHash = __esmMin((() => {
759
+ init_ArtifactReader();
760
+ init_StreamBytes();
761
+ ARTIFACT_CLASSIFICATION_PREFIX_BYTES = 8192;
762
+ abortIfNeeded = (signal) => {
763
+ if (signal?.aborted === true) throw new ArtifactReaderFailure("cancelled", "Artifact inventory cancelled");
764
+ };
765
+ hashReadable = async (stream, signal) => {
766
+ const hash = createHash("sha256");
767
+ const prefixes = [];
768
+ let prefixBytes = 0;
769
+ let bytes = 0;
770
+ for await (const raw of stream) {
771
+ abortIfNeeded(signal);
772
+ const chunk = streamChunkToBuffer(raw);
773
+ bytes += chunk.length;
774
+ hash.update(chunk);
775
+ if (prefixBytes < 8192) {
776
+ const selected = chunk.subarray(0, ARTIFACT_CLASSIFICATION_PREFIX_BYTES - prefixBytes);
777
+ prefixes.push(selected);
778
+ prefixBytes += selected.length;
779
+ }
780
+ }
781
+ return {
782
+ sha256: hash.digest("hex"),
783
+ bytes,
784
+ prefix: Buffer.concat(prefixes)
785
+ };
786
+ };
787
+ })))();
788
+ }
789
+
790
+ //#endregion
791
+ //#region dist/artifacts/inventory/ArtifactGraphConstruction.js
792
+ var indexOccurrencesByPath, createOccurrence, noteUnreadContainerSuffix, containerSuffixFamily, materializeDirectoryNodes, createRootNode, createArtifactNode, rootOccurrenceFor, rekeyOccurrences, createArtifactEdges, resolveOccurrenceParents, classifyArtifactPath, classifyArtifactContent, hasAsarHeader, artifactRoleForFormat, classifyArtifactBytes, relationFor, depth;
793
+ function init_ArtifactGraphConstruction() {
794
+ return (init_ArtifactGraphConstruction = __esmMin((() => {
795
+ init_unicodeCodePointOrder();
796
+ init_canonicalDigest();
797
+ init_artifactIdentity();
798
+ init_zipPackageFormat();
799
+ init_dosMz();
800
+ indexOccurrencesByPath = (occurrences) => {
801
+ const byPath = new Map();
802
+ for (const occurrence of occurrences) if (!byPath.has(occurrence.logical_path)) byPath.set(occurrence.logical_path, occurrence);
803
+ return byPath;
804
+ };
805
+ createOccurrence = (entry, path, parent) => {
806
+ const role = entry.kind === "directory" ? {
807
+ kind: path.toLowerCase().endsWith(".framework") ? "framework" : "container",
808
+ format: "directory"
809
+ } : containerSuffixFamily(path) === undefined ? classifyArtifactPath(path) : {
810
+ kind: "unknown",
811
+ format: "unknown"
812
+ };
813
+ return {
814
+ occurrence_id: `occ_${digestCanonicalValue({
815
+ path,
816
+ kind: entry.kind
817
+ }, "Artifact")}`,
818
+ artifact_id: null,
819
+ parent_occurrence_id: parent,
820
+ logical_path: path,
821
+ entry_kind: entry.kind,
822
+ artifact_kind: role.kind,
823
+ artifact_format: role.format,
824
+ declared_size: entry.declaredSize,
825
+ compressed_size: entry.compressedSize,
826
+ executable: entry.executable,
827
+ encrypted: entry.encrypted,
828
+ hash_status: entry.encrypted ? "unavailable" : "not-hashed",
829
+ source_location: entry.byteOffset === null || entry.declaredSize === null ? null : {
830
+ offset: entry.byteOffset,
831
+ length: entry.declaredSize
832
+ },
833
+ limitations: [...entry.limitations]
834
+ };
835
+ };
836
+ noteUnreadContainerSuffix = (occurrence) => {
837
+ if (occurrence.entry_kind === "directory") return;
838
+ const family = containerSuffixFamily(occurrence.logical_path);
839
+ if (family === undefined) return;
840
+ occurrence.limitations.push(`The path suffix suggests ${family.toUpperCase()}, but these bytes were not read, so the container family is unknown.`);
841
+ };
842
+ containerSuffixFamily = (path) => {
843
+ const lower = path.toLowerCase();
844
+ return lower.endsWith(".asar") ? "asar" : zipPackageFormatForPath(lower);
845
+ };
846
+ materializeDirectoryNodes = (occurrences, nodes) => {
847
+ const directories = occurrences.filter(({ entry_kind: kind }) => kind === "directory").sort((left, right) => depth(right.logical_path) - depth(left.logical_path));
848
+ const childrenByParent = new Map();
849
+ for (const occurrence of occurrences) {
850
+ if (occurrence.parent_occurrence_id === null) continue;
851
+ const children = childrenByParent.get(occurrence.parent_occurrence_id);
852
+ if (children === undefined) childrenByParent.set(occurrence.parent_occurrence_id, [occurrence]);
853
+ else children.push(occurrence);
854
+ }
855
+ for (const directory of directories) {
856
+ const children = (childrenByParent.get(directory.occurrence_id) ?? []).map(({ logical_path, artifact_id, entry_kind }) => ({
857
+ name: logical_path.slice(directory.logical_path.length + 1),
858
+ artifact_id,
859
+ entry_kind
860
+ })).sort((left, right) => compareUnicodeCodePoints(left.name, right.name));
861
+ const node = createArtifactNode({
862
+ sha256: digestCanonicalValue({
863
+ kind: "directory",
864
+ children
865
+ }, "Artifact"),
866
+ size: 0,
867
+ format: "directory",
868
+ contentState: "virtual"
869
+ });
870
+ nodes.set(node.artifact_id, node);
871
+ directory.artifact_id = node.artifact_id;
872
+ directory.hash_status = "verified";
873
+ }
874
+ };
875
+ createRootNode = (input) => createArtifactNode({
876
+ sha256: input.digest?.sha256 ?? digestCanonicalValue({
877
+ kind: "directory-root",
878
+ children: input.occurrences.map(({ logical_path, artifact_id }) => ({
879
+ logical_path,
880
+ artifact_id
881
+ })).sort((left, right) => compareUnicodeCodePoints(left.logical_path, right.logical_path))
882
+ }, "Artifact"),
883
+ size: input.digest?.bytes ?? 0,
884
+ format: input.digest === null ? "directory" : classifyArtifactBytes(input.digest.prefix, input.digest.bytes),
885
+ contentState: "materialized"
886
+ });
887
+ createArtifactNode = (input) => ({
888
+ artifact_id: artifactIdForContent(input.sha256),
889
+ format: input.format,
890
+ sha256: input.sha256,
891
+ size: input.size,
892
+ media_type: null,
893
+ architecture: null,
894
+ content_state: input.contentState,
895
+ limitations: []
896
+ });
897
+ rootOccurrenceFor = (node, metadata) => ({
898
+ occurrence_id: occurrenceIdForLocation({
899
+ rootArtifactId: node.artifact_id,
900
+ logicalPath: ".",
901
+ entryKind: metadata.format === "directory" ? "directory" : "file"
902
+ }),
903
+ artifact_id: node.artifact_id,
904
+ parent_occurrence_id: null,
905
+ logical_path: ".",
906
+ entry_kind: metadata.format === "directory" ? "directory" : "file",
907
+ artifact_kind: metadata.format === "directory" || isZipPackageFormat(metadata.format) || [
908
+ "asar",
909
+ "dmg",
910
+ "pkg"
911
+ ].includes(metadata.format) ? "container" : artifactRoleForFormat(metadata.path, metadata.format).kind,
912
+ artifact_format: metadata.format,
913
+ declared_size: metadata.size,
914
+ compressed_size: null,
915
+ executable: metadata.executable,
916
+ encrypted: false,
917
+ hash_status: "verified",
918
+ source_location: null,
919
+ limitations: []
920
+ });
921
+ rekeyOccurrences = (rootArtifactId, occurrences) => {
922
+ const replacements = new Map();
923
+ for (const occurrence of occurrences) replacements.set(occurrence.occurrence_id, occurrenceIdForLocation({
924
+ rootArtifactId,
925
+ logicalPath: occurrence.logical_path,
926
+ entryKind: occurrence.entry_kind
927
+ }));
928
+ for (const occurrence of occurrences) {
929
+ occurrence.occurrence_id = replacements.get(occurrence.occurrence_id) ?? occurrence.occurrence_id;
930
+ if (occurrence.parent_occurrence_id !== null) occurrence.parent_occurrence_id = replacements.get(occurrence.parent_occurrence_id) ?? occurrence.parent_occurrence_id;
931
+ }
932
+ };
933
+ createArtifactEdges = (rootArtifactId, occurrences, producer) => {
934
+ const byId = new Map(occurrences.map((item) => [item.occurrence_id, item]));
935
+ const byPath = indexOccurrencesByPath(occurrences);
936
+ const edges = [];
937
+ for (const occurrence of occurrences) {
938
+ if (occurrence.parent_occurrence_id === null || occurrence.artifact_id === null) continue;
939
+ const mappedSource = occurrence.logical_path.toLowerCase().endsWith(".map") ? byPath.get(occurrence.logical_path.slice(0, -".map".length)) : undefined;
940
+ const parentArtifactId = mappedSource?.artifact_id ?? byId.get(occurrence.parent_occurrence_id)?.artifact_id ?? rootArtifactId;
941
+ const semantic = {
942
+ parent_artifact_id: parentArtifactId,
943
+ relation: occurrence.entry_kind === "slice" ? "slice-of" : relationFor(occurrence.logical_path),
944
+ occurrence_id: occurrence.occurrence_id
945
+ };
946
+ edges.push({
947
+ edge_id: artifactEdgeId(semantic, occurrence),
948
+ ...semantic,
949
+ producer: occurrence.entry_kind === "slice" ? producer ?? null : null,
950
+ ordinal: edges.length
951
+ });
952
+ }
953
+ return edges;
954
+ };
955
+ resolveOccurrenceParents = (occurrences, byPath, expandedContainerIds) => {
956
+ const root = { children: new Map() };
957
+ for (const occurrence of byPath.values()) {
958
+ if (occurrence.entry_kind !== "directory" && !expandedContainerIds.has(occurrence.occurrence_id)) continue;
959
+ let branch = root;
960
+ for (const segment of occurrence.logical_path.split("/")) {
961
+ let child = branch.children.get(segment);
962
+ if (child === undefined) {
963
+ child = { children: new Map() };
964
+ branch.children.set(segment, child);
965
+ }
966
+ branch = child;
967
+ }
968
+ branch.occurrence = occurrence;
969
+ }
970
+ for (const occurrence of occurrences) {
971
+ const path = occurrence.logical_path;
972
+ let branch = root;
973
+ let parent;
974
+ for (let start = 0;;) {
975
+ const slash = path.indexOf("/", start);
976
+ if (slash < 0) break;
977
+ const segment = path.slice(start, slash);
978
+ const child = branch.children.get(segment);
979
+ if (child === undefined) break;
980
+ branch = child;
981
+ parent = branch.occurrence ?? parent;
982
+ start = slash + 1;
983
+ }
984
+ occurrence.parent_occurrence_id = parent?.occurrence_id ?? null;
985
+ }
986
+ };
987
+ classifyArtifactPath = (path) => {
988
+ const lower = path.toLowerCase();
989
+ if (lower.endsWith(".map")) return {
990
+ kind: "source-map",
991
+ format: "source-map"
992
+ };
993
+ if (/\.(?:m?js|cjs)$/u.test(lower)) return {
994
+ kind: "javascript",
995
+ format: "javascript-bundle"
996
+ };
997
+ if (/\.framework(?:\/|$)/u.test(lower)) return {
998
+ kind: "framework",
999
+ format: "file"
1000
+ };
1001
+ if (/\.(?:node|dylib|so)$/u.test(lower)) return {
1002
+ kind: lower.endsWith(".node") ? "native-addon" : "dynamic-library",
1003
+ format: "file"
1004
+ };
1005
+ if (lower.endsWith(".plist")) return {
1006
+ kind: "plist",
1007
+ format: "plist"
1008
+ };
1009
+ if (lower.endsWith(".entitlements")) return {
1010
+ kind: "entitlements",
1011
+ format: "entitlements"
1012
+ };
1013
+ return {
1014
+ kind: "resource",
1015
+ format: "file"
1016
+ };
1017
+ };
1018
+ classifyArtifactContent = (path, prefix, fileSize = prefix.length) => {
1019
+ const format = classifyArtifactBytes(prefix, fileSize);
1020
+ if (format === "file" && path.toLowerCase().endsWith(".asar") && hasAsarHeader(prefix)) return {
1021
+ kind: "container",
1022
+ format: "asar"
1023
+ };
1024
+ return artifactRoleForFormat(path, format);
1025
+ };
1026
+ hasAsarHeader = (prefix) => {
1027
+ if (prefix.length < 17 || prefix.readUInt32LE(0) !== 4) return false;
1028
+ const headerSize = prefix.readUInt32LE(4);
1029
+ const payloadSize = prefix.readUInt32LE(8);
1030
+ if (headerSize < 16 || payloadSize !== headerSize - 4) return false;
1031
+ const stringLength = prefix.readUInt32LE(12);
1032
+ return stringLength >= 2 && stringLength <= payloadSize - 4 && prefix[16] === 123;
1033
+ };
1034
+ artifactRoleForFormat = (path, format) => {
1035
+ const byPath = classifyArtifactPath(path);
1036
+ if (format === "file" || format === byPath.format) return byPath;
1037
+ if (format === "unknown") return {
1038
+ kind: "unknown",
1039
+ format
1040
+ };
1041
+ if (format === "zip") return {
1042
+ kind: "container",
1043
+ format: zipPackageFormatForPath(path) ?? format
1044
+ };
1045
+ if (format === "plist") return {
1046
+ kind: "plist",
1047
+ format
1048
+ };
1049
+ return {
1050
+ kind: ["native-addon", "dynamic-library"].includes(byPath.kind) ? byPath.kind : "executable",
1051
+ format
1052
+ };
1053
+ };
1054
+ classifyArtifactBytes = (prefix, fileSize = prefix.length) => {
1055
+ if (hasZipSignature(prefix)) return "zip";
1056
+ if (prefix.subarray(0, 8).equals(Buffer.from("bplist00"))) return "plist";
1057
+ if (prefix.length >= 4) {
1058
+ const magic = prefix.readUInt32BE(0);
1059
+ if ([
1060
+ 3405691582,
1061
+ 3199925962,
1062
+ 3405691583,
1063
+ 3216703178
1064
+ ].includes(magic)) return "mach-o-universal";
1065
+ if ([
1066
+ 4277009102,
1067
+ 4277009103,
1068
+ 3472551422,
1069
+ 3489328638
1070
+ ].includes(magic)) return "mach-o";
1071
+ if (prefix.subarray(0, 4).equals(Buffer.from([
1072
+ 127,
1073
+ 69,
1074
+ 76,
1075
+ 70
1076
+ ]))) return "elf";
1077
+ }
1078
+ if (prefix.length >= 2 && prefix[0] === 77 && prefix[1] === 90) {
1079
+ if (!Number.isSafeInteger(fileSize) || fileSize < prefix.length || prefix.length < Math.min(fileSize, 64)) return "unknown";
1080
+ const windowsOffset = mzWindowsHeaderOffset(prefix);
1081
+ if (windowsOffset !== null) {
1082
+ if (windowsOffset >= 64 && windowsOffset <= prefix.length - 4 && prefix.subarray(windowsOffset, windowsOffset + 4).equals(Buffer.from([
1083
+ 80,
1084
+ 69,
1085
+ 0,
1086
+ 0
1087
+ ]))) return "pe";
1088
+ } else if (parseDosMzHeader(prefix, fileSize).ok) return "dos-mz";
1089
+ return "unknown";
1090
+ }
1091
+ return "file";
1092
+ };
1093
+ relationFor = (path) => {
1094
+ const lower = path.toLowerCase();
1095
+ if (lower.endsWith(".map")) return "maps-source";
1096
+ if (lower.includes(".framework/")) return "embeds";
1097
+ return "contains";
1098
+ };
1099
+ depth = (path) => path.split("/").length;
1100
+ })))();
1101
+ }
1102
+
1103
+ //#endregion
1104
+ //#region dist/artifacts/inventory/hashStableRootArtifact.js
1105
+ var openRootArtifact, hashStableRootArtifact, hashStableRootArtifactHandle;
1106
+ function init_hashStableRootArtifact() {
1107
+ return (init_hashStableRootArtifact = __esmMin((() => {
1108
+ init_readFileHandleChunks();
1109
+ init_OwnedFileHandle();
1110
+ init_ArtifactReader();
1111
+ init_RegularFile();
1112
+ init_ArtifactHash();
1113
+ openRootArtifact = async (path, resourceScope, signal) => {
1114
+ try {
1115
+ return new OwnedFileHandle(await openRegularFile(path, {
1116
+ symlinks: "reject",
1117
+ signal
1118
+ }));
1119
+ } catch (cause) {
1120
+ const primary = cause instanceof RegularFileAdmissionFailure ? cause.cause : cause;
1121
+ const failure = primary instanceof NonRegularFileReadError ? new ArtifactReaderFailure("format", `Artifact root is not a regular file: ${path}`, { cause: primary }) : primary;
1122
+ if (cause instanceof RegularFileAdmissionFailure) {
1123
+ const resource = `root artifact descriptor for ${path}`;
1124
+ const cleanup = await resourceScope.release({
1125
+ kind: "file-handle",
1126
+ resource,
1127
+ handle: cause.owner
1128
+ });
1129
+ if (cleanup.kind === "failed") throw ArtifactReaderFailure.withCleanup(failure, ArtifactReaderFailure.cleanupObservation(cleanup.cause, resource));
1130
+ }
1131
+ throw failure;
1132
+ }
1133
+ };
1134
+ hashStableRootArtifact = async (path, resourceScope, signal) => {
1135
+ const owner = await openRootArtifact(path, resourceScope, signal);
1136
+ const handle = owner.handle;
1137
+ let outcome;
1138
+ try {
1139
+ const initial = await handle.stat();
1140
+ outcome = {
1141
+ kind: "completed",
1142
+ value: await hashStableRootArtifactHandle(path, handle, initial, signal)
1143
+ };
1144
+ } catch (cause) {
1145
+ outcome = {
1146
+ kind: "failed",
1147
+ cause
1148
+ };
1149
+ }
1150
+ const resource = `root artifact descriptor for ${path}`;
1151
+ const cleanup = await resourceScope.release({
1152
+ kind: "file-handle",
1153
+ resource,
1154
+ handle: owner
1155
+ });
1156
+ if (cleanup.kind === "failed") throw ArtifactReaderFailure.withCleanup(outcome.kind === "failed" ? outcome.cause : cleanup.cause, ArtifactReaderFailure.cleanupObservation(cleanup.cause, resource));
1157
+ if (outcome.kind === "failed") throw outcome.cause;
1158
+ return outcome.value;
1159
+ };
1160
+ hashStableRootArtifactHandle = async (path, handle, initial, signal) => {
1161
+ const digest = await hashReadable(readFileHandleChunks(handle, {
1162
+ start: 0,
1163
+ end: initial.size
1164
+ }), signal);
1165
+ abortIfNeeded(signal);
1166
+ const [opened, currentPath] = await Promise.all([handle.stat(), lstat(path)]);
1167
+ if (!sameRegularFileState(initial, opened) || !sameRegularFileState(initial, currentPath) || digest.bytes !== initial.size) throw new ArtifactReaderFailure("integrity", `Root artifact changed during inventory: ${path}`);
1168
+ return digest;
1169
+ };
1170
+ })))();
1171
+ }
1172
+
1173
+ //#endregion
1174
+ //#region dist/artifacts/inventory/classify.js
1175
+ var classifyAndHashRoot, classifyAndHashRootForInventory, classifyRootFormat, zipRootPackageFormat, hasKolyTrailer;
1176
+ function init_classify() {
1177
+ return (init_classify = __esmMin((() => {
1178
+ init_RegularFile();
1179
+ init_ArtifactGraphConstruction();
1180
+ init_ArtifactHash();
1181
+ init_zipPackageFormat();
1182
+ init_ArtifactReader();
1183
+ init_hashStableRootArtifact();
1184
+ classifyAndHashRoot = async (path, directory, expectedMetadata, options) => {
1185
+ return options.resourceScope.run(async () => {
1186
+ const result = await classifyAndHashRootForInventory(path, directory, expectedMetadata, options);
1187
+ const rootSource = result.rootSource;
1188
+ if (rootSource !== undefined) {
1189
+ const owner = {
1190
+ kind: "file-handle",
1191
+ handle: rootSource.owner,
1192
+ resource: `root artifact descriptor for ${path}`
1193
+ };
1194
+ const cleanupAttempt = await options.resourceScope.release(owner);
1195
+ if (cleanupAttempt.kind === "failed") throw ArtifactReaderFailure.withCleanup(cleanupAttempt.cause, ArtifactReaderFailure.cleanupObservation(cleanupAttempt.cause, owner.resource));
1196
+ }
1197
+ return {
1198
+ format: result.format,
1199
+ digest: result.digest
1200
+ };
1201
+ });
1202
+ };
1203
+ classifyAndHashRootForInventory = async (path, directory, expectedMetadata, options) => {
1204
+ if (directory) return {
1205
+ format: "directory",
1206
+ digest: null,
1207
+ rootSource: undefined
1208
+ };
1209
+ const ownedHandle = await openRootArtifact(path, options.resourceScope, options.signal);
1210
+ const handle = ownedHandle.handle;
1211
+ const owner = {
1212
+ kind: "file-handle",
1213
+ handle: ownedHandle,
1214
+ resource: `root artifact descriptor for ${path}`
1215
+ };
1216
+ let outcome;
1217
+ try {
1218
+ const initial = await handle.stat();
1219
+ if (!sameRegularFileState(expectedMetadata, initial)) throw new ArtifactReaderFailure("integrity", `Root artifact changed before inventory: ${path}`);
1220
+ const format = await classifyRootFormat(path, handle);
1221
+ const digest = await hashStableRootArtifactHandle(path, handle, initial, options.signal);
1222
+ const retainSource = isZipPackageFormat(format) || format === "mach-o-universal";
1223
+ outcome = {
1224
+ kind: "completed",
1225
+ value: {
1226
+ format,
1227
+ digest,
1228
+ rootSource: retainSource ? {
1229
+ handle,
1230
+ initial,
1231
+ owner: ownedHandle
1232
+ } : undefined
1233
+ }
1234
+ };
1235
+ } catch (cause) {
1236
+ outcome = {
1237
+ kind: "failed",
1238
+ cause
1239
+ };
1240
+ }
1241
+ if (outcome.kind === "failed" || outcome.value.rootSource === undefined) {
1242
+ const cleanupAttempt = await options.resourceScope.release(owner);
1243
+ if (cleanupAttempt.kind === "failed") throw ArtifactReaderFailure.withCleanup(outcome.kind === "failed" ? outcome.cause : cleanupAttempt.cause, ArtifactReaderFailure.cleanupObservation(cleanupAttempt.cause, owner.resource));
1244
+ }
1245
+ if (outcome.kind === "failed") throw outcome.cause;
1246
+ return outcome.value;
1247
+ };
1248
+ classifyRootFormat = async (path, handle) => {
1249
+ const magic = Buffer.alloc(ARTIFACT_CLASSIFICATION_PREFIX_BYTES);
1250
+ const observed = await handle.read(magic, 0, magic.length, 0);
1251
+ const prefix = magic.subarray(0, observed.bytesRead);
1252
+ const lower = path.toLowerCase();
1253
+ if (hasZipSignature(prefix)) return zipRootPackageFormat(lower);
1254
+ if (lower.endsWith(".pkg") && prefix.subarray(0, 4).equals(Buffer.from("xar!"))) return "pkg";
1255
+ if (lower.endsWith(".dmg") && await hasKolyTrailer(handle)) return "dmg";
1256
+ return classifyArtifactContent(path, prefix, (await handle.stat()).size).format;
1257
+ };
1258
+ zipRootPackageFormat = (lower) => lower.endsWith(".app") ? "app-pack" : zipPackageFormatForPath(lower) ?? "zip";
1259
+ hasKolyTrailer = async (handle) => {
1260
+ const size = (await handle.stat()).size;
1261
+ if (size < 512) return false;
1262
+ const trailer = Buffer.alloc(4);
1263
+ const read = await handle.read(trailer, 0, trailer.length, size - 512);
1264
+ return read.bytesRead === 4 && trailer.equals(Buffer.from("koly"));
1265
+ };
1266
+ })))();
1267
+ }
1268
+
1269
+ //#endregion
1270
+ //#region dist/artifacts/apple/MachoLoadCommandReader.js
1271
+ var MAX_LOAD_COMMAND_BYTES, MAX_FAT_ARCHITECTURES, KNOWN_CPU_TYPES, MH_MAGIC, MH_MAGIC_64, MH_CIGAM, MH_CIGAM_64, FAT_MAGIC, FAT_MAGIC_64, FAT_CIGAM, FAT_CIGAM_64, LC_ID_DYLIB, LC_LOAD_DYLIB, LC_LOAD_WEAK_DYLIB, LC_REEXPORT_DYLIB, LC_LAZY_LOAD_DYLIB, LC_LOAD_UPWARD_DYLIB, LC_RPATH, LC_DYLD_ENVIRONMENT, LC_CODE_SIGNATURE, LC_VERSION_MIN_MACOSX, LC_VERSION_MIN_IPHONEOS, LC_VERSION_MIN_TVOS, LC_VERSION_MIN_WATCHOS, LC_BUILD_VERSION, PLATFORM_MACOS, PLATFORM_IOS, PLATFORM_TVOS, PLATFORM_WATCHOS, PLATFORM_IOSSIMULATOR, PLATFORM_TVOSSIMULATOR, PLATFORM_WATCHOSSIMULATOR, CPU_TYPE_I386, CPU_TYPE_X86_64, legacyVersionMinPlatform, DYLIB_USE_MARKER, DYLIB_USE_WEAK_LINK, DYLIB_USE_REEXPORT, DYLIB_USE_UPWARD, DYLIB_USE_DELAYED_INIT, DEPENDENCY_COMMANDS, MachoFormatIssue, hasMachoMagic, readMachoImage, readFatSlices, readSlice, decodeCommands, decodeCommand, decodeDependency, commandString, readExact, CPU_ARCH_ABI64, CPU_ARCH_ABI64_32, CPU_TYPE_X86, CPU_TYPE_ARM, CPU_SUBTYPE_MASK, CPU_SUBTYPE_ARM64E, CPU_SUBTYPE_ARM64E_X1, CPU_SUBTYPE_X86_64_H, architectureName, fileTypeName, version, swap, viewOf;
1272
+ function init_MachoLoadCommandReader() {
1273
+ return (init_MachoLoadCommandReader = __esmMin((() => {
1274
+ init_machoContainer();
1275
+ MAX_LOAD_COMMAND_BYTES = 16 * 1024 * 1024;
1276
+ MAX_FAT_ARCHITECTURES = 128;
1277
+ KNOWN_CPU_TYPES = [
1278
+ 7,
1279
+ 16777223,
1280
+ 12,
1281
+ 16777228,
1282
+ 33554444,
1283
+ 18,
1284
+ 16777234
1285
+ ];
1286
+ MH_MAGIC = 4277009102;
1287
+ MH_MAGIC_64 = 4277009103;
1288
+ MH_CIGAM = 3472551422;
1289
+ MH_CIGAM_64 = 3489328638;
1290
+ FAT_MAGIC = 3405691582;
1291
+ FAT_MAGIC_64 = 3405691583;
1292
+ FAT_CIGAM = 3199925962;
1293
+ FAT_CIGAM_64 = 3216703178;
1294
+ LC_ID_DYLIB = 13;
1295
+ LC_LOAD_DYLIB = 12;
1296
+ LC_LOAD_WEAK_DYLIB = 2147483672;
1297
+ LC_REEXPORT_DYLIB = 2147483679;
1298
+ LC_LAZY_LOAD_DYLIB = 32;
1299
+ LC_LOAD_UPWARD_DYLIB = 2147483683;
1300
+ LC_RPATH = 2147483676;
1301
+ LC_DYLD_ENVIRONMENT = 39;
1302
+ LC_CODE_SIGNATURE = 29;
1303
+ LC_VERSION_MIN_MACOSX = 36;
1304
+ LC_VERSION_MIN_IPHONEOS = 37;
1305
+ LC_VERSION_MIN_TVOS = 47;
1306
+ LC_VERSION_MIN_WATCHOS = 48;
1307
+ LC_BUILD_VERSION = 50;
1308
+ PLATFORM_MACOS = 1;
1309
+ PLATFORM_IOS = 2;
1310
+ PLATFORM_TVOS = 3;
1311
+ PLATFORM_WATCHOS = 4;
1312
+ PLATFORM_IOSSIMULATOR = 7;
1313
+ PLATFORM_TVOSSIMULATOR = 8;
1314
+ PLATFORM_WATCHOSSIMULATOR = 9;
1315
+ CPU_TYPE_I386 = 7;
1316
+ CPU_TYPE_X86_64 = 16777223;
1317
+ legacyVersionMinPlatform = (command, cpuType) => {
1318
+ const isIntel = cpuType === CPU_TYPE_I386 || cpuType === CPU_TYPE_X86_64;
1319
+ switch (command) {
1320
+ case LC_VERSION_MIN_MACOSX: return PLATFORM_MACOS;
1321
+ case LC_VERSION_MIN_IPHONEOS: return isIntel ? PLATFORM_IOSSIMULATOR : PLATFORM_IOS;
1322
+ case LC_VERSION_MIN_TVOS: return cpuType === CPU_TYPE_X86_64 ? PLATFORM_TVOSSIMULATOR : PLATFORM_TVOS;
1323
+ case LC_VERSION_MIN_WATCHOS: return isIntel ? PLATFORM_WATCHOSSIMULATOR : PLATFORM_WATCHOS;
1324
+ default: return undefined;
1325
+ }
1326
+ };
1327
+ DYLIB_USE_MARKER = 443815936;
1328
+ DYLIB_USE_WEAK_LINK = 1;
1329
+ DYLIB_USE_REEXPORT = 2;
1330
+ DYLIB_USE_UPWARD = 4;
1331
+ DYLIB_USE_DELAYED_INIT = 8;
1332
+ DEPENDENCY_COMMANDS = new Map([
1333
+ [LC_LOAD_DYLIB, "LC_LOAD_DYLIB"],
1334
+ [LC_LOAD_WEAK_DYLIB, "LC_LOAD_WEAK_DYLIB"],
1335
+ [LC_REEXPORT_DYLIB, "LC_REEXPORT_DYLIB"],
1336
+ [LC_LAZY_LOAD_DYLIB, "LC_LAZY_LOAD_DYLIB"],
1337
+ [LC_LOAD_UPWARD_DYLIB, "LC_LOAD_UPWARD_DYLIB"]
1338
+ ]);
1339
+ MachoFormatIssue = class extends Error {
1340
+ status;
1341
+ constructor(status, message) {
1342
+ super(message);
1343
+ this.status = status;
1344
+ }
1345
+ };
1346
+ hasMachoMagic = (head) => {
1347
+ if (head.byteLength < 4) return false;
1348
+ const magic = new DataView(head.buffer, head.byteOffset, head.byteLength).getUint32(0, false);
1349
+ return [
1350
+ MH_MAGIC,
1351
+ MH_MAGIC_64,
1352
+ MH_CIGAM,
1353
+ MH_CIGAM_64,
1354
+ FAT_MAGIC,
1355
+ FAT_MAGIC_64,
1356
+ FAT_CIGAM,
1357
+ FAT_CIGAM_64
1358
+ ].includes(magic);
1359
+ };
1360
+ readMachoImage = async (readAt, size) => {
1361
+ try {
1362
+ const head = await readAt(0, Math.min(size, 8));
1363
+ if (head.byteLength < 8) return hasMachoMagic(head) ? {
1364
+ status: "malformed",
1365
+ reason: "Mach-O header is truncated"
1366
+ } : { status: "not-mach-o" };
1367
+ const view = viewOf(head);
1368
+ const magic = view.getUint32(0, false);
1369
+ if ([
1370
+ FAT_MAGIC,
1371
+ FAT_MAGIC_64,
1372
+ FAT_CIGAM,
1373
+ FAT_CIGAM_64
1374
+ ].includes(magic)) {
1375
+ const littleEndian = magic === FAT_CIGAM || magic === FAT_CIGAM_64;
1376
+ const count = view.getUint32(4, littleEndian);
1377
+ const wide = magic === FAT_MAGIC_64 || magic === FAT_CIGAM_64;
1378
+ if (count === 0) return {
1379
+ status: "malformed",
1380
+ reason: "FAT header declares no architectures"
1381
+ };
1382
+ if (count > MAX_FAT_ARCHITECTURES || 8 + count * (wide ? 32 : 20) > size) return { status: "not-mach-o" };
1383
+ const tableBytes = await readExact(readAt, 8, count * (wide ? 32 : 20), "FAT table");
1384
+ const declarations = readFatSliceDeclarations(tableBytes, {
1385
+ count,
1386
+ wide,
1387
+ littleEndian
1388
+ });
1389
+ if (declarations.status !== "parsed") throw new MachoFormatIssue("malformed", declarations.reason);
1390
+ if (!declarations.slices.some(({ cpuType }) => KNOWN_CPU_TYPES.includes(cpuType))) {
1391
+ let hasMachOSliceHeader = false;
1392
+ for (const declaration of declarations.slices) {
1393
+ if (validateFatSlice(declaration, size, 8 + count * (wide ? 32 : 20)) !== null) continue;
1394
+ const bytes = await readAt(declaration.offset, 4);
1395
+ if (bytes.byteLength < 4) continue;
1396
+ const sliceMagic = viewOf(bytes).getUint32(0, false);
1397
+ if ([
1398
+ MH_MAGIC,
1399
+ MH_MAGIC_64,
1400
+ MH_CIGAM,
1401
+ MH_CIGAM_64
1402
+ ].includes(sliceMagic)) {
1403
+ hasMachOSliceHeader = true;
1404
+ break;
1405
+ }
1406
+ }
1407
+ if (!hasMachOSliceHeader) return { status: "not-mach-o" };
1408
+ }
1409
+ return {
1410
+ status: "parsed",
1411
+ slices: await readFatSlices(readAt, size, 8 + count * (wide ? 32 : 20), declarations.slices)
1412
+ };
1413
+ }
1414
+ if (magic === MH_CIGAM || magic === MH_CIGAM_64) return {
1415
+ status: "parsed",
1416
+ slices: [await readSlice(readAt, 0, size)]
1417
+ };
1418
+ if (magic === MH_MAGIC || magic === MH_MAGIC_64) throw new MachoFormatIssue("unsupported", "big-endian Mach-O images are not supported");
1419
+ return { status: "not-mach-o" };
1420
+ } catch (cause) {
1421
+ if (cause instanceof MachoFormatIssue) return {
1422
+ status: cause.status,
1423
+ reason: cause.message
1424
+ };
1425
+ throw cause;
1426
+ }
1427
+ };
1428
+ readFatSlices = async (readAt, size, tableEnd, declarations) => {
1429
+ const slices = [];
1430
+ for (const declaration of declarations) {
1431
+ const { offset, size: length, cpuType, cpuSubtype } = declaration;
1432
+ const rangeIssue = validateFatSlice(declaration, size, tableEnd);
1433
+ if (rangeIssue !== null) throw new MachoFormatIssue(rangeIssue.includes("unsupported") ? "unsupported" : "malformed", rangeIssue);
1434
+ const slice = await readSlice(readAt, offset, length, {
1435
+ fatCpuType: cpuType,
1436
+ fatCpuSubtype: cpuSubtype,
1437
+ alignmentExponent: declaration.alignmentExponent
1438
+ });
1439
+ const identityIssue = validateFatSlice(declaration, size, tableEnd, {
1440
+ cpuType: slice.cpu_type,
1441
+ cpuSubtype: slice.cpu_subtype
1442
+ });
1443
+ if (identityIssue !== null) throw new MachoFormatIssue("malformed", identityIssue);
1444
+ slices.push(slice);
1445
+ }
1446
+ return slices;
1447
+ };
1448
+ readSlice = async (readAt, base, length, fat = null) => {
1449
+ const header = viewOf(await readExact(readAt, base, 28, "Mach-O header"));
1450
+ const magic = header.getUint32(0, true);
1451
+ if (magic === MH_MAGIC_64 || magic === MH_MAGIC) {
1452
+ const wide = magic === MH_MAGIC_64;
1453
+ const headerSize = wide ? 32 : 28;
1454
+ const commandCount = header.getUint32(16, true);
1455
+ const commandBytes = header.getUint32(20, true);
1456
+ if (commandBytes > 16777216) throw new MachoFormatIssue("unsupported", `load commands occupy ${commandBytes} bytes, above the ${MAX_LOAD_COMMAND_BYTES}-byte limit`);
1457
+ if (headerSize + commandBytes > length) throw new MachoFormatIssue("malformed", "load commands extend beyond the Mach-O slice");
1458
+ const commands = await readExact(readAt, base + headerSize, commandBytes, "load commands");
1459
+ const slice = decodeCommands(commands, {
1460
+ wide,
1461
+ cpuType: header.getUint32(4, true),
1462
+ cpuSubtype: header.getUint32(8, true),
1463
+ fileType: header.getUint32(12, true),
1464
+ commandCount,
1465
+ sliceOffset: base,
1466
+ sliceSize: length,
1467
+ fatCpuType: fat?.fatCpuType ?? null,
1468
+ fatCpuSubtype: fat?.fatCpuSubtype ?? null,
1469
+ fatAlignmentExponent: fat?.alignmentExponent ?? null
1470
+ });
1471
+ const distinctPlatforms = [...new Set(slice.platforms)];
1472
+ slice.platform = distinctPlatforms.length === 1 ? distinctPlatforms[0] ?? null : null;
1473
+ return slice;
1474
+ }
1475
+ throw new MachoFormatIssue(magic === swap(MH_MAGIC) || magic === swap(MH_MAGIC_64) ? "unsupported" : "malformed", magic === swap(MH_MAGIC) || magic === swap(MH_MAGIC_64) ? "big-endian Mach-O slices are not supported" : `slice at offset ${base} has no Mach-O header`);
1476
+ };
1477
+ decodeCommands = (bytes, header) => {
1478
+ const alignment = header.wide ? 8 : 4;
1479
+ const view = viewOf(bytes);
1480
+ const slice = {
1481
+ architecture: architectureName(header.cpuType, header.cpuSubtype),
1482
+ slice_offset: header.sliceOffset,
1483
+ slice_size: header.sliceSize,
1484
+ cpu_type: header.cpuType,
1485
+ cpu_subtype: header.cpuSubtype,
1486
+ fat_cpu_type: header.fatCpuType,
1487
+ fat_cpu_subtype: header.fatCpuSubtype,
1488
+ fat_alignment_exponent: header.fatAlignmentExponent,
1489
+ file_type: fileTypeName(header.fileType),
1490
+ file_type_code: header.fileType,
1491
+ platform: null,
1492
+ platforms: [],
1493
+ install_name: null,
1494
+ dependencies: [],
1495
+ rpaths: [],
1496
+ dyld_environment: [],
1497
+ code_signature_present: false
1498
+ };
1499
+ let offset = 0;
1500
+ for (let index = 0; index < header.commandCount; index++) {
1501
+ if (offset + 8 > bytes.byteLength) throw new MachoFormatIssue("malformed", `load command ${index} starts beyond sizeofcmds`);
1502
+ const command = view.getUint32(offset, true);
1503
+ const size = view.getUint32(offset + 4, true);
1504
+ if (size < 8 || size % alignment !== 0 || offset + size > bytes.byteLength) throw new MachoFormatIssue("malformed", `load command ${index} at offset ${offset} has invalid cmdsize ${size}`);
1505
+ const body = bytes.subarray(offset, offset + size);
1506
+ decodeCommand(command, body, index, slice);
1507
+ offset += size;
1508
+ }
1509
+ if (offset !== bytes.byteLength) throw new MachoFormatIssue("malformed", `load commands declare ${header.commandCount} commands but sizeofcmds holds ${bytes.byteLength} bytes`);
1510
+ return slice;
1511
+ };
1512
+ decodeCommand = (command, body, index, slice) => {
1513
+ if (command === LC_ID_DYLIB) {
1514
+ slice.install_name = commandString(body, 24, index);
1515
+ return;
1516
+ }
1517
+ if (command === LC_RPATH) {
1518
+ slice.rpaths.push(commandString(body, 12, index));
1519
+ return;
1520
+ }
1521
+ if (command === LC_DYLD_ENVIRONMENT) {
1522
+ slice.dyld_environment.push(commandString(body, 12, index));
1523
+ return;
1524
+ }
1525
+ if (command === LC_CODE_SIGNATURE) {
1526
+ if (body.byteLength < 16) throw new MachoFormatIssue("malformed", `load command ${index} is too short for LC_CODE_SIGNATURE`);
1527
+ slice.code_signature_present = true;
1528
+ return;
1529
+ }
1530
+ if (command === LC_BUILD_VERSION) {
1531
+ if (body.byteLength < 24) throw new MachoFormatIssue("malformed", `load command ${index} is too short for LC_BUILD_VERSION`);
1532
+ const view = viewOf(body);
1533
+ const toolCount = view.getUint32(20, true);
1534
+ if (toolCount > Math.floor((body.byteLength - 24) / 8)) throw new MachoFormatIssue("malformed", `load command ${index} LC_BUILD_VERSION tool records exceed cmdsize`);
1535
+ const platform = view.getUint32(8, true);
1536
+ slice.platforms.push(platform);
1537
+ return;
1538
+ }
1539
+ const legacyPlatform = legacyVersionMinPlatform(command, slice.cpu_type);
1540
+ if (legacyPlatform !== undefined) {
1541
+ if (body.byteLength < 16) throw new MachoFormatIssue("malformed", `load command ${index} is too short for a version-min command`);
1542
+ slice.platforms.push(legacyPlatform);
1543
+ return;
1544
+ }
1545
+ const name = DEPENDENCY_COMMANDS.get(command);
1546
+ if (name !== undefined) slice.dependencies.push(decodeDependency(name, body, index));
1547
+ };
1548
+ decodeDependency = (command, body, index) => {
1549
+ if (body.byteLength < 24) throw new MachoFormatIssue("malformed", `load command ${index} is too short for a dylib command`);
1550
+ const view = viewOf(body);
1551
+ const nameOffset = view.getUint32(8, true);
1552
+ const usesFlags = nameOffset === 28 && body.byteLength >= 28 && view.getUint32(12, true) === DYLIB_USE_MARKER;
1553
+ const flags = usesFlags ? view.getUint32(24, true) : 0;
1554
+ return {
1555
+ command,
1556
+ encoding: usesFlags ? "dylib_use_command" : "dylib_command",
1557
+ install_name: commandString(body, usesFlags ? 28 : 24, index),
1558
+ weak: command === "LC_LOAD_WEAK_DYLIB" || (flags & DYLIB_USE_WEAK_LINK) !== 0,
1559
+ upward: command === "LC_LOAD_UPWARD_DYLIB" || (flags & DYLIB_USE_UPWARD) !== 0,
1560
+ reexport: command === "LC_REEXPORT_DYLIB" || (flags & DYLIB_USE_REEXPORT) !== 0,
1561
+ delayed_init: (flags & DYLIB_USE_DELAYED_INIT) !== 0,
1562
+ current_version: version(view.getUint32(16, true)),
1563
+ compatibility_version: version(view.getUint32(20, true))
1564
+ };
1565
+ };
1566
+ commandString = (body, minimumOffset, index) => {
1567
+ if (body.byteLength < 12) throw new MachoFormatIssue("malformed", `load command ${index} is too short to hold a string offset`);
1568
+ const offset = viewOf(body).getUint32(8, true);
1569
+ if (offset < minimumOffset || offset >= body.byteLength) throw new MachoFormatIssue("malformed", `load command ${index} has string offset ${offset} outside the command`);
1570
+ const end = body.indexOf(0, offset);
1571
+ if (end < 0) throw new MachoFormatIssue("malformed", `load command ${index} has an unterminated string`);
1572
+ try {
1573
+ return new TextDecoder("utf-8", { fatal: true }).decode(body.subarray(offset, end));
1574
+ } catch {
1575
+ throw new MachoFormatIssue("malformed", `load command ${index} has a string that is not UTF-8`);
1576
+ }
1577
+ };
1578
+ readExact = async (readAt, offset, length, label) => {
1579
+ const bytes = await readAt(offset, length);
1580
+ if (bytes.byteLength < length) throw new MachoFormatIssue("malformed", `${label} is truncated`);
1581
+ return bytes;
1582
+ };
1583
+ CPU_ARCH_ABI64 = 16777216;
1584
+ CPU_ARCH_ABI64_32 = 33554432;
1585
+ CPU_TYPE_X86 = 7;
1586
+ CPU_TYPE_ARM = 12;
1587
+ CPU_SUBTYPE_MASK = 4278190080;
1588
+ CPU_SUBTYPE_ARM64E = 2;
1589
+ CPU_SUBTYPE_ARM64E_X1 = 12;
1590
+ CPU_SUBTYPE_X86_64_H = 8;
1591
+ architectureName = (cpuType, cpuSubtype) => {
1592
+ const subtype = cpuSubtype & ~CPU_SUBTYPE_MASK;
1593
+ if (cpuType === (CPU_TYPE_ARM | CPU_ARCH_ABI64)) return subtype === CPU_SUBTYPE_ARM64E || subtype === CPU_SUBTYPE_ARM64E_X1 ? "arm64e" : "arm64";
1594
+ if (cpuType === (CPU_TYPE_ARM | CPU_ARCH_ABI64_32)) return "arm64_32";
1595
+ if (cpuType === (CPU_TYPE_X86 | CPU_ARCH_ABI64)) return subtype === CPU_SUBTYPE_X86_64_H ? "x86_64h" : "x86_64";
1596
+ if (cpuType === CPU_TYPE_X86) return "i386";
1597
+ if (cpuType === CPU_TYPE_ARM) return "arm";
1598
+ return `cpu-${cpuType.toString(16)}`;
1599
+ };
1600
+ fileTypeName = (fileType) => fileType === 2 ? "execute" : fileType === 6 ? "dylib" : fileType === 8 ? "bundle" : "other";
1601
+ version = (value) => `${value >>> 16}.${value >>> 8 & 255}.${value & 255}`;
1602
+ swap = (value) => ((value & 255) << 24 | (value & 65280) << 8 | value >>> 8 & 65280 | value >>> 24) >>> 0;
1603
+ viewOf = (bytes) => new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
1604
+ })))();
1605
+ }
1606
+
1607
+ //#endregion
1608
+ //#region dist/artifacts/MachOSliceArtifactReader.js
1609
+ var MachOSliceArtifactReader, readStructuralSlices, lipoMatchesSlice, lipoSubtypeMatches, lipoNameMatches;
1610
+ function init_MachOSliceArtifactReader() {
1611
+ return (init_MachOSliceArtifactReader = __esmMin((() => {
1612
+ init_CommandRunner();
1613
+ init_lipo();
1614
+ init_OwnedFileHandle();
1615
+ init_MachoLoadCommandReader();
1616
+ init_ArtifactReader();
1617
+ init_StreamBytes();
1618
+ init_RegularFile();
1619
+ init_readFileHandleChunks();
1620
+ MachOSliceArtifactReader = class {
1621
+ path;
1622
+ runner;
1623
+ format = "file";
1624
+ #command;
1625
+ #source;
1626
+ #ownedSource;
1627
+ #pendingSource;
1628
+ #entries = new Map();
1629
+ #pendingCommands = new Set();
1630
+ #ownsSource;
1631
+ #closed = false;
1632
+ #closePromise;
1633
+ constructor(path, environment, runner = new XcrunCommandRunner(environment), source) {
1634
+ this.path = path;
1635
+ this.runner = runner;
1636
+ this.#source = source;
1637
+ this.#ownsSource = source === undefined;
1638
+ }
1639
+ async *entries(signal) {
1640
+ this.#entries.clear();
1641
+ const source = await this.#ensureSource();
1642
+ await this.#verifySource(source);
1643
+ if (this.#closed) throw new ArtifactReaderFailure("unavailable", "Universal Mach-O reader is closed");
1644
+ const command = this.runner.run("lipo", ["-detailed_info", this.path], signal === undefined ? {} : { signal });
1645
+ this.#pendingCommands.add(command);
1646
+ let captured;
1647
+ try {
1648
+ captured = await command;
1649
+ } finally {
1650
+ this.#pendingCommands.delete(command);
1651
+ }
1652
+ if (!captured.ok) throw new ArtifactReaderFailure(captured.error.reason === "cancelled" ? "cancelled" : "unavailable", "lipo could not enumerate universal Mach-O slices", {
1653
+ cause: captured.error,
1654
+ ...captured.error.cleanupFailure === null && captured.error.cleanupResources.length === 0 ? {} : { cleanup: {
1655
+ reason: captured.error.cleanupFailure ?? "Native command cleanup remains unverified",
1656
+ resources: [...captured.error.cleanupResources]
1657
+ } }
1658
+ });
1659
+ if (this.#closed) throw new ArtifactReaderFailure("unavailable", "Universal Mach-O reader closed during slice discovery");
1660
+ this.#command = {
1661
+ tool: captured.value.tool,
1662
+ arguments: ["-detailed_info", "$ARTIFACT"],
1663
+ tool_version: captured.value.toolVersion,
1664
+ executable_sha256: captured.value.executableSha256,
1665
+ exit_code: captured.value.exitCode,
1666
+ effects: ["read"]
1667
+ };
1668
+ await this.#verifySource(source);
1669
+ const fileSize = source.initial.size;
1670
+ const architectures = parseLipoArchitectures(captured.value.stdout);
1671
+ const structural = await readStructuralSlices(source.handle, fileSize);
1672
+ await this.#verifySource(source);
1673
+ if (structural.status === "malformed") throw new ArtifactReaderFailure("integrity", `Mach-O structural slice index is malformed: ${structural.reason}`);
1674
+ if (structural.status === "unsupported") throw new ArtifactReaderFailure("format", `Mach-O structural slice index is unsupported: ${structural.reason}`);
1675
+ const slices = structural.status === "parsed" ? structural.slices : null;
1676
+ const matchingSlices = new Map();
1677
+ if (slices !== null) {
1678
+ if (slices.length !== architectures.length) throw new ArtifactReaderFailure("integrity", "lipo architecture count disagrees with the Mach-O FAT table");
1679
+ const unmatched = [...slices];
1680
+ for (const reported of architectures) {
1681
+ const match = unmatched.findIndex((observed) => lipoMatchesSlice(reported, observed, slices.length === 1));
1682
+ 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"})`);
1683
+ const [observed] = unmatched.splice(match, 1);
1684
+ if (observed !== undefined) matchingSlices.set(reported, observed);
1685
+ }
1686
+ }
1687
+ for (const architecture of architectures) {
1688
+ const structuralSlice = matchingSlices.get(architecture);
1689
+ const offset = architecture.file_offset ?? structuralSlice?.slice_offset;
1690
+ const sliceSize = architecture.size ?? structuralSlice?.slice_size;
1691
+ if (offset === undefined || sliceSize === undefined) throw new ArtifactReaderFailure("integrity", "lipo omitted a universal slice byte range");
1692
+ 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}`);
1693
+ const entry = {
1694
+ path: `slices/${architecture.name}`,
1695
+ kind: "slice",
1696
+ declaredSize: sliceSize,
1697
+ compressedSize: null,
1698
+ executable: true,
1699
+ encrypted: false,
1700
+ byteOffset: offset,
1701
+ declaredSha256: null,
1702
+ unpacked: false,
1703
+ limitations: [
1704
+ ...structural.status === "not-mach-o" ? ["Structural Mach-O facts were unavailable; slice range is based on lipo output."] : [],
1705
+ ...architecture.file_offset === null || architecture.size === null ? ["Slice range was derived from structural Mach-O facts because lipo omitted it."] : [],
1706
+ ...architecture.cpu_type !== null && architecture.cpu_type_code === null ? [`lipo CPU type is retained as unnormalized source text: ${architecture.cpu_type}`] : [],
1707
+ ...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}`}`] : []
1708
+ ],
1709
+ adapterKey: `${String(offset)}:${String(sliceSize)}`
1710
+ };
1711
+ this.#entries.set(entry.adapterKey, copyArtifactEntry(entry));
1712
+ yield entry;
1713
+ }
1714
+ }
1715
+ async open(entry, signal) {
1716
+ if (signal?.aborted === true) return Promise.reject(new ArtifactReaderFailure("cancelled", "Mach-O slice read cancelled"));
1717
+ const produced = this.#entries.get(entry.adapterKey);
1718
+ if (produced === undefined || !sameArtifactEntry(entry, produced)) throw new ArtifactReaderFailure("integrity", "Mach-O slice entry metadata does not match this reader's inventory");
1719
+ const offset = produced.byteOffset;
1720
+ const size = produced.declaredSize;
1721
+ 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");
1722
+ const source = await this.#ensureSource();
1723
+ await this.#verifySource(source);
1724
+ if (!Number.isSafeInteger(offset + size) || offset + size > source.initial.size) throw new ArtifactReaderFailure("integrity", `Mach-O slice range is outside the artifact: ${entry.path}`);
1725
+ const sourceStream = readFileHandleChunks(source.handle, {
1726
+ start: offset,
1727
+ end: offset + size - 1,
1728
+ ...signal === undefined ? {} : { signal }
1729
+ });
1730
+ const verifySource = () => this.#verifySource(source);
1731
+ return Readable.from((async function* () {
1732
+ let observedBytes = 0;
1733
+ try {
1734
+ for await (const raw of sourceStream) {
1735
+ const chunk = streamChunkToBuffer(raw);
1736
+ observedBytes += chunk.byteLength;
1737
+ if (observedBytes > size) throw new ArtifactReaderFailure("integrity", `Mach-O slice exceeded its reported size: ${entry.path}`);
1738
+ yield chunk;
1739
+ }
1740
+ } catch (cause) {
1741
+ if (cause instanceof ArtifactReaderFailure) throw cause;
1742
+ if (signal?.aborted === true) throw new ArtifactReaderFailure("cancelled", "Mach-O slice read cancelled", { cause });
1743
+ throw new ArtifactReaderFailure("integrity", `Could not read Mach-O slice range: ${entry.path}`, { cause });
1744
+ }
1745
+ if (observedBytes !== size) throw new ArtifactReaderFailure("integrity", `Mach-O slice size disagrees with lipo metadata: ${entry.path}`);
1746
+ await verifySource();
1747
+ })());
1748
+ }
1749
+ provenance() {
1750
+ return this.#command === undefined ? [] : [structuredClone(this.#command)];
1751
+ }
1752
+ async close() {
1753
+ this.#closed = true;
1754
+ this.#closePromise ??= this.#releaseResources().catch((cause) => {
1755
+ this.#closePromise = undefined;
1756
+ throw cause;
1757
+ });
1758
+ return this.#closePromise;
1759
+ }
1760
+ async #releaseResources() {
1761
+ await Promise.allSettled(this.#pendingCommands);
1762
+ let cleanup;
1763
+ try {
1764
+ const failures = await this.runner.retryCleanup?.() ?? [];
1765
+ if (failures.length > 0) cleanup = {
1766
+ reason: failures.map(({ reason, resources }) => `${resources.join(", ")}: ${reason}`).join("; "),
1767
+ resources: [...new Set(failures.flatMap(({ resources }) => resources))]
1768
+ };
1769
+ } catch (cause) {
1770
+ cleanup = ArtifactReaderFailure.cleanupObservation(cause, "native-command-process-cleanup");
1771
+ }
1772
+ try {
1773
+ await this.#closeSource();
1774
+ } catch (cause) {
1775
+ if (cleanup === undefined) throw cause;
1776
+ throw ArtifactReaderFailure.withCleanup(cause, cleanup);
1777
+ }
1778
+ if (cleanup !== undefined) throw new ArtifactReaderFailure("unavailable", "Native command process cleanup remains incomplete", { cleanup });
1779
+ }
1780
+ async #ensureSource() {
1781
+ if (this.#closed) throw new ArtifactReaderFailure("unavailable", "Universal Mach-O reader is closed");
1782
+ if (this.#source !== undefined) return this.#source;
1783
+ this.#pendingSource ??= this.#acquireSource();
1784
+ const source = await this.#pendingSource;
1785
+ if (this.#closed) throw new ArtifactReaderFailure("unavailable", "Universal Mach-O reader closed during source acquisition");
1786
+ return source;
1787
+ }
1788
+ async #acquireSource() {
1789
+ let handle;
1790
+ try {
1791
+ handle = await openRegularFile(this.path, { symlinks: "reject" });
1792
+ } catch (cause) {
1793
+ if (!(cause instanceof RegularFileAdmissionFailure)) throw cause;
1794
+ this.#ownedSource = cause.owner;
1795
+ 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;
1796
+ throw ArtifactReaderFailure.withCleanup(primary, ArtifactReaderFailure.cleanupObservation(cause.cleanupCause, this.path));
1797
+ }
1798
+ const owner = new OwnedFileHandle(handle);
1799
+ this.#ownedSource = owner;
1800
+ try {
1801
+ const initial = await handle.stat();
1802
+ const source = {
1803
+ handle,
1804
+ initial
1805
+ };
1806
+ this.#source = source;
1807
+ return source;
1808
+ } catch (cause) {
1809
+ try {
1810
+ await owner.close();
1811
+ this.#ownedSource = undefined;
1812
+ } catch (cleanupCause) {
1813
+ throw ArtifactReaderFailure.withCleanup(cause, ArtifactReaderFailure.cleanupObservation(cleanupCause, this.path));
1814
+ }
1815
+ throw cause;
1816
+ }
1817
+ }
1818
+ async #closeSource() {
1819
+ await this.#pendingSource?.catch(() => undefined);
1820
+ if (!this.#ownsSource || this.#ownedSource === undefined) return;
1821
+ await this.#ownedSource.close();
1822
+ this.#ownedSource = undefined;
1823
+ this.#source = undefined;
1824
+ }
1825
+ async #verifySource(source) {
1826
+ const [opened, currentPath] = await Promise.all([source.handle.stat(), lstat(this.path)]);
1827
+ if (!sameRegularFileState(source.initial, opened) || !sameRegularFileState(source.initial, currentPath)) throw new ArtifactReaderFailure("integrity", `Universal Mach-O source changed during inventory: ${this.path}`);
1828
+ }
1829
+ };
1830
+ readStructuralSlices = async (file, size) => {
1831
+ const readAt = async (offset, length) => {
1832
+ const bytes = Buffer.alloc(length);
1833
+ const { bytesRead } = await file.read(bytes, 0, length, offset);
1834
+ return bytes.subarray(0, bytesRead);
1835
+ };
1836
+ return readMachoImage(readAt, size);
1837
+ };
1838
+ lipoMatchesSlice = (reported, observed, structurallyUnique) => {
1839
+ const observedCpuType = observed.fat_cpu_type ?? observed.cpu_type;
1840
+ const observedCpuSubtype = observed.fat_cpu_subtype ?? observed.cpu_subtype;
1841
+ const hasPhysicalIdentity = reported.file_offset !== null || reported.size !== null || reported.cpu_type_code !== null || reported.cpu_subtype_code !== null;
1842
+ 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);
1843
+ };
1844
+ lipoSubtypeMatches = (reported, observedCpuSubtype) => {
1845
+ if (reported.cpu_subtype_code !== null) return reported.cpu_subtype_code === observedCpuSubtype;
1846
+ const bits = lipoSubtypeBits(reported.cpu_subtype);
1847
+ return bits === null || bits === (observedCpuSubtype & 16777215);
1848
+ };
1849
+ lipoNameMatches = (reported, observed) => reported === observed || observed === "arm64e" && /^arm64e\.[A-Za-z0-9_]+$/u.test(reported);
1850
+ })))();
1851
+ }
1852
+
1853
+ //#endregion
1854
+ //#region dist/artifacts/NativeDmgOwnership.js
1855
+ var systemEntitySchema, attachOutputSchema, infoOutputSchema, parseNativeDmgInfo, parseNativeDmgAttachOutput, resolveNativeDmgOwnership, ownershipFromAttachOutput, topLevelDevices, isBelowRoot;
1856
+ function init_NativeDmgOwnership() {
1857
+ return (init_NativeDmgOwnership = __esmMin((() => {
1858
+ systemEntitySchema = z.object({
1859
+ "dev-entry": z.string().startsWith("/dev/"),
1860
+ "mount-point": z.string().optional()
1861
+ });
1862
+ attachOutputSchema = z.object({ "system-entities": z.array(systemEntitySchema) });
1863
+ infoOutputSchema = z.object({ images: z.array(z.object({ "system-entities": z.array(systemEntitySchema) })) });
1864
+ parseNativeDmgInfo = (stdout) => infoOutputSchema.parse(parse(stdout));
1865
+ parseNativeDmgAttachOutput = (stdout) => attachOutputSchema.parse(parse(stdout));
1866
+ resolveNativeDmgOwnership = (input) => {
1867
+ const rootedImages = input.info.images.filter((image) => image["system-entities"].some(({ "mount-point": mountPoint }) => mountPoint !== undefined && isBelowRoot(input.mountRoot, mountPoint)));
1868
+ if (rootedImages.length > 1) return {
1869
+ status: "unknown",
1870
+ reason: "multiple hdiutil image groups report mounts beneath the owned root"
1871
+ };
1872
+ const rootedImage = rootedImages[0];
1873
+ if (rootedImage !== undefined) {
1874
+ const hasOutsideMount = rootedImage["system-entities"].some(({ "mount-point": mountPoint }) => mountPoint !== undefined && !isBelowRoot(input.mountRoot, mountPoint));
1875
+ const groupDevices = rootedImage["system-entities"].map(({ "dev-entry": device }) => device);
1876
+ const devices = topLevelDevices(groupDevices);
1877
+ const overlapsBaseline = groupDevices.some((device) => input.baselineDevices.has(device));
1878
+ if (hasOutsideMount || overlapsBaseline || devices.length === 0) return {
1879
+ status: "unknown",
1880
+ 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"
1881
+ };
1882
+ return {
1883
+ status: "owned",
1884
+ devices,
1885
+ source: "info"
1886
+ };
1887
+ }
1888
+ if (input.attachOutputReturned) {
1889
+ const attachOwnership = ownershipFromAttachOutput(input.attachOutput, input.mountRoot, input.baselineDevices);
1890
+ if (attachOwnership.status === "owned") {
1891
+ return attachOwnership;
1892
+ }
1893
+ if (attachOwnership.status === "unknown") return attachOwnership;
1894
+ }
1895
+ const newlyListedDevice = input.info.images.some((image) => image["system-entities"].some(({ "dev-entry": device }) => !input.baselineDevices.has(device)));
1896
+ if (newlyListedDevice) return {
1897
+ status: "unknown",
1898
+ reason: "hdiutil lists devices absent from the pre-attach baseline, but none is tied uniquely to the owned root; ownership is unknown"
1899
+ };
1900
+ return { status: "none" };
1901
+ };
1902
+ ownershipFromAttachOutput = (output, mountRoot, baselineDevices) => {
1903
+ if (output === undefined) return {
1904
+ status: "unknown",
1905
+ reason: "hdiutil attach succeeded but its ownership facts were malformed"
1906
+ };
1907
+ const entities = output["system-entities"];
1908
+ const hasRootMount = entities.some(({ "mount-point": mountPoint }) => mountPoint !== undefined && isBelowRoot(mountRoot, mountPoint));
1909
+ const hasOutsideMount = entities.some(({ "mount-point": mountPoint }) => mountPoint !== undefined && !isBelowRoot(mountRoot, mountPoint));
1910
+ const devices = entities.map(({ "dev-entry": device }) => device);
1911
+ const uniqueDevices = topLevelDevices(devices);
1912
+ const overlapsBaseline = devices.some((device) => baselineDevices.has(device));
1913
+ if (hasRootMount) {
1914
+ if (hasOutsideMount || overlapsBaseline || uniqueDevices.length === 0) return {
1915
+ status: "unknown",
1916
+ 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"
1917
+ };
1918
+ return {
1919
+ status: "owned",
1920
+ devices: uniqueDevices,
1921
+ source: "attach"
1922
+ };
1923
+ }
1924
+ if (devices.length === 0) return {
1925
+ status: "unknown",
1926
+ reason: "hdiutil attach succeeded without reporting device ownership facts"
1927
+ };
1928
+ if (devices.some((device) => !baselineDevices.has(device))) return {
1929
+ status: "unknown",
1930
+ reason: "the attach result reports new devices without a mount beneath the owned root"
1931
+ };
1932
+ return { status: "none" };
1933
+ };
1934
+ topLevelDevices = (devices) => {
1935
+ const unique = [...new Set(devices)];
1936
+ 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))));
1937
+ };
1938
+ isBelowRoot = (root, path) => {
1939
+ const child = relative(root, resolve(path));
1940
+ return child !== "" && child !== "." && child !== ".." && !child.startsWith(`..${sep}`);
1941
+ };
1942
+ })))();
1943
+ }
1944
+
1945
+ //#endregion
1946
+ //#region dist/artifacts/NativeDmgArtifactReader.js
1947
+ var HDIUTIL_COMMAND_TIMEOUT_MS, DETACH_SETTLE_DELAYS_MS, delay, NativeDmgCommandFailure, createSystemHost, NativeDmgArtifactReader, failureMessage, processNotStarted, runChecked, describeCommandFailure, processExitCode, processOutput, commandFailureReason, verifyFailureReason, verifyFailureDiagnostic, command;
1948
+ function init_NativeDmgArtifactReader() {
1949
+ return (init_NativeDmgArtifactReader = __esmMin((() => {
1950
+ init_ArtifactReader();
1951
+ init_DirectoryArtifactReader();
1952
+ init_ExecFileOutput();
1953
+ init_NativeDmgOwnership();
1954
+ HDIUTIL_COMMAND_TIMEOUT_MS = 12e4;
1955
+ DETACH_SETTLE_DELAYS_MS = [
1956
+ 250,
1957
+ 500,
1958
+ 1e3
1959
+ ];
1960
+ delay = (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds));
1961
+ NativeDmgCommandFailure = class extends ArtifactReaderFailure {
1962
+ stdout;
1963
+ processNotStarted;
1964
+ constructor(reason, message, stdout, options) {
1965
+ super(reason, message, options?.cause === undefined ? undefined : { cause: options.cause });
1966
+ this.stdout = stdout;
1967
+ this.processNotStarted = options?.processNotStarted ?? false;
1968
+ }
1969
+ };
1970
+ createSystemHost = (environment) => ({
1971
+ delay,
1972
+ async run(arguments_, signal, options) {
1973
+ try {
1974
+ const { stdout, stderr } = await execFileOutput("/usr/bin/hdiutil", [...arguments_], {
1975
+ env: environment,
1976
+ stopSignal: "SIGTERM",
1977
+ ...options === undefined ? {} : { timeout: options.timeoutMs },
1978
+ ...signal === undefined ? {} : { signal }
1979
+ });
1980
+ return {
1981
+ stdout,
1982
+ stderr,
1983
+ exitCode: 0
1984
+ };
1985
+ } catch (cause) {
1986
+ const output = execFileOutputFailure(cause);
1987
+ if (cause instanceof Error && cause.name === "AbortError") throw new NativeDmgCommandFailure("cancelled", "DMG operation cancelled", output?.stdout ?? "", { cause });
1988
+ const exitCode = typeof output?.code === "number" ? output.code : processExitCode(cause);
1989
+ if (exitCode !== undefined) return {
1990
+ stdout: output?.stdout ?? processOutput(cause, "stdout"),
1991
+ stderr: output?.stderr ?? processOutput(cause, "stderr"),
1992
+ exitCode,
1993
+ cause
1994
+ };
1995
+ throw new NativeDmgCommandFailure(commandFailureReason(cause, arguments_[0]), `hdiutil ${arguments_[0] ?? "operation"} failed: ${describeCommandFailure(cause, arguments_)}`, output?.stdout ?? "", {
1996
+ cause,
1997
+ processNotStarted: processNotStarted(cause)
1998
+ });
1999
+ }
2000
+ }
2001
+ });
2002
+ NativeDmgArtifactReader = class {
2003
+ path;
2004
+ format = "file";
2005
+ host;
2006
+ #provenance = [];
2007
+ #initialization;
2008
+ #directory;
2009
+ #devices = [];
2010
+ #inventoryConfirmedDevices = new Set();
2011
+ #mountRoot;
2012
+ #baselineDevices = new Set();
2013
+ #attachOutput;
2014
+ #attachOutputReturned = false;
2015
+ #attachMayHaveMounted = false;
2016
+ #ownershipUncertainty;
2017
+ #closed = false;
2018
+ #closePromise;
2019
+ #activeDirectoryOperations = new Set();
2020
+ constructor(path, environment, host) {
2021
+ this.path = path;
2022
+ if (process.platform !== "darwin" && host === undefined) throw new ArtifactReaderFailure("unavailable", "Native DMG traversal is available only on macOS");
2023
+ this.host = host ?? createSystemHost(environment);
2024
+ }
2025
+ async *entries(signal) {
2026
+ await this.#ensureAttached(signal);
2027
+ const directory = this.#directory;
2028
+ if (directory === undefined) throw new ArtifactReaderFailure("unavailable", "DMG is not attached");
2029
+ const prefix = basename(this.path);
2030
+ const entries = directory.entries(signal)[Symbol.asyncIterator]();
2031
+ try {
2032
+ for (;;) {
2033
+ if (this.#closed) return;
2034
+ const next = await this.#trackDirectoryOperation(() => entries.next());
2035
+ if (this.#closed) return;
2036
+ if (next.done) return;
2037
+ yield {
2038
+ ...next.value,
2039
+ path: `${prefix}/${next.value.path}`
2040
+ };
2041
+ }
2042
+ } finally {
2043
+ await entries.return?.();
2044
+ }
2045
+ }
2046
+ async open(entry, signal) {
2047
+ await this.#ensureAttached(signal);
2048
+ const directory = this.#directory;
2049
+ if (directory === undefined) throw new ArtifactReaderFailure("unavailable", "DMG is not attached");
2050
+ return this.#trackDirectoryOperation(() => directory.open(entry, signal));
2051
+ }
2052
+ provenance() {
2053
+ return structuredClone(this.#provenance);
2054
+ }
2055
+ close() {
2056
+ this.#closed = true;
2057
+ this.#closePromise ??= this.#closeOwnedResources().catch((cause) => {
2058
+ this.#closePromise = undefined;
2059
+ throw cause;
2060
+ });
2061
+ return this.#closePromise;
2062
+ }
2063
+ async #closeOwnedResources() {
2064
+ await this.#initialization?.catch(() => undefined);
2065
+ await Promise.allSettled(this.#activeDirectoryOperations);
2066
+ await this.#closeMountedDirectory();
2067
+ let detachFailure = await this.#detachOwnedDevices();
2068
+ if (this.#devices.length === 0 && this.#mountRoot !== undefined && !this.#attachMayHaveMounted) await rm(this.#mountRoot, {
2069
+ recursive: true,
2070
+ force: true
2071
+ }).then(() => {
2072
+ this.#mountRoot = undefined;
2073
+ this.#directory = undefined;
2074
+ }, (cause) => {
2075
+ detachFailure ??= cause;
2076
+ });
2077
+ if (this.#attachMayHaveMounted) {
2078
+ detachFailure ??= new Error(this.#ownershipUncertainty ?? "hdiutil attachment ownership remains unknown");
2079
+ }
2080
+ if (detachFailure !== undefined) throw new ArtifactReaderFailure("unavailable", `DMG detach or mount-root cleanup failed for ${JSON.stringify(this.path)}: ${failureMessage(detachFailure)}`, {
2081
+ cause: detachFailure,
2082
+ cleanup: {
2083
+ reason: failureMessage(detachFailure),
2084
+ resources: [
2085
+ ...this.#devices.map((device) => `DMG device ${device}`),
2086
+ ...this.#attachMayHaveMounted ? [`DMG attachment ownership unknown at mount root ${this.#mountRoot ?? this.path}`] : [],
2087
+ ...this.#mountRoot === undefined ? [] : [`DMG mount root ${this.#mountRoot}`]
2088
+ ]
2089
+ }
2090
+ });
2091
+ }
2092
+ async #detachOwnedDevices() {
2093
+ let detachFailure = await this.#reconcileAttachState();
2094
+ let remainingDevices = [];
2095
+ for (const device of [...this.#devices].reverse()) {
2096
+ const failure = await this.#detach(device);
2097
+ if (failure !== undefined) {
2098
+ remainingDevices.push(device);
2099
+ detachFailure ??= failure;
2100
+ }
2101
+ }
2102
+ for (const delayMs of DETACH_SETTLE_DELAYS_MS) {
2103
+ if (remainingDevices.length === 0) break;
2104
+ await (this.host.delay ?? delay)(delayMs);
2105
+ const stillAttached = [];
2106
+ for (const device of remainingDevices) {
2107
+ if (!await this.#isAttached(device)) continue;
2108
+ const failure = await this.#detach(device);
2109
+ if (failure !== undefined) {
2110
+ stillAttached.push(device);
2111
+ detachFailure = failure;
2112
+ }
2113
+ }
2114
+ remainingDevices = stillAttached;
2115
+ }
2116
+ if (remainingDevices.length === 0) detachFailure = undefined;
2117
+ this.#devices = remainingDevices.reverse();
2118
+ return detachFailure;
2119
+ }
2120
+ async #closeMountedDirectory() {
2121
+ if (this.#directory !== undefined) {
2122
+ try {
2123
+ await this.#directory.close();
2124
+ this.#directory = undefined;
2125
+ } catch (cause) {
2126
+ const mountRoot = this.#mountRoot ?? this.path;
2127
+ throw ArtifactReaderFailure.withCleanup(cause, {
2128
+ reason: `DMG mounted directory remains owned: ${failureMessage(cause)}`,
2129
+ resources: [
2130
+ `DMG mounted directory at ${mountRoot}`,
2131
+ `DMG mount root ${mountRoot}`,
2132
+ ...this.#devices.map((device) => `DMG device ${device}`)
2133
+ ]
2134
+ });
2135
+ }
2136
+ }
2137
+ }
2138
+ /** Detach one device; return the failure only while it remains attached. */
2139
+ async #detach(device) {
2140
+ try {
2141
+ await runChecked(this.host, ["detach", device], undefined, { timeoutMs: HDIUTIL_COMMAND_TIMEOUT_MS });
2142
+ this.#provenance.push(command(["detach", device], ["mount"]));
2143
+ return undefined;
2144
+ } catch (cause) {
2145
+ return await this.#isAttached(device) ? cause : undefined;
2146
+ }
2147
+ }
2148
+ async #reconcileAttachState() {
2149
+ if (!this.#attachMayHaveMounted) return undefined;
2150
+ try {
2151
+ await this.#resolveAttachOwnership();
2152
+ return undefined;
2153
+ } catch (cause) {
2154
+ this.#ownershipUncertainty = failureMessage(cause);
2155
+ return cause;
2156
+ }
2157
+ }
2158
+ /** Treat unknown hdiutil state as attached during cleanup. */
2159
+ async #isAttached(device) {
2160
+ try {
2161
+ const parsed = await this.#readInfo();
2162
+ const isListed = parsed.images.some((image) => image["system-entities"].some((entity) => entity["dev-entry"] === device));
2163
+ if (isListed) {
2164
+ this.#inventoryConfirmedDevices.add(device);
2165
+ return true;
2166
+ }
2167
+ return !this.#inventoryConfirmedDevices.has(device);
2168
+ } catch {
2169
+ return true;
2170
+ }
2171
+ }
2172
+ async #ensureAttached(signal) {
2173
+ if (this.#closed) throw new ArtifactReaderFailure("unavailable", "DMG reader is closed");
2174
+ this.#initialization ??= this.#attach(signal);
2175
+ await this.#initialization;
2176
+ if (this.#closed) throw new ArtifactReaderFailure("unavailable", "DMG reader is closed");
2177
+ }
2178
+ async #trackDirectoryOperation(operation) {
2179
+ if (this.#closed) throw new ArtifactReaderFailure("unavailable", "DMG reader is closed");
2180
+ const running = Promise.resolve().then(operation);
2181
+ this.#activeDirectoryOperations.add(running);
2182
+ try {
2183
+ return await running;
2184
+ } finally {
2185
+ this.#activeDirectoryOperations.delete(running);
2186
+ }
2187
+ }
2188
+ async #attach(signal) {
2189
+ await runChecked(this.host, ["verify", this.path], signal);
2190
+ this.#provenance.push(command(["verify", this.path], ["read"]));
2191
+ const baseline = await this.#readInfo();
2192
+ this.#baselineDevices = new Set(baseline.images.flatMap((image) => image["system-entities"].map(({ "dev-entry": device }) => device)));
2193
+ const mountRoot = await realpath(await mkdtemp(join(tmpdir(), "rea-dmg-")));
2194
+ this.#mountRoot = mountRoot;
2195
+ try {
2196
+ this.#attachMayHaveMounted = true;
2197
+ const attached = await runChecked(this.host, [
2198
+ "attach",
2199
+ "-readonly",
2200
+ "-nobrowse",
2201
+ "-plist",
2202
+ "-mountroot",
2203
+ mountRoot,
2204
+ this.path
2205
+ ], signal, { timeoutMs: HDIUTIL_COMMAND_TIMEOUT_MS });
2206
+ this.#attachOutputReturned = true;
2207
+ let parsed;
2208
+ try {
2209
+ parsed = parseNativeDmgAttachOutput(attached.stdout);
2210
+ } catch (cause) {
2211
+ throw new ArtifactReaderFailure("format", "hdiutil returned a malformed attachment plist", { cause });
2212
+ }
2213
+ if (parsed["system-entities"].length === 0) throw new ArtifactReaderFailure("format", "hdiutil returned no attached devices");
2214
+ this.#attachOutput = parsed;
2215
+ const ownership = await this.#resolveAttachOwnership();
2216
+ 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");
2217
+ this.#provenance.push(command([
2218
+ "attach",
2219
+ "-readonly",
2220
+ "-nobrowse",
2221
+ "-plist",
2222
+ "-mountroot",
2223
+ mountRoot,
2224
+ this.path
2225
+ ], ["read", "mount"]));
2226
+ this.#directory = new DirectoryArtifactReader(mountRoot);
2227
+ } catch (cause) {
2228
+ if (cause instanceof NativeDmgCommandFailure && cause.stdout !== "") {
2229
+ try {
2230
+ this.#attachOutput = parseNativeDmgAttachOutput(cause.stdout);
2231
+ this.#attachOutputReturned = true;
2232
+ } catch {}
2233
+ }
2234
+ if (cause instanceof NativeDmgCommandFailure && cause.processNotStarted) {
2235
+ this.#attachMayHaveMounted = false;
2236
+ this.#ownershipUncertainty = undefined;
2237
+ }
2238
+ throw cause;
2239
+ }
2240
+ }
2241
+ async #readInfo() {
2242
+ const info = await runChecked(this.host, ["info", "-plist"], undefined, { timeoutMs: HDIUTIL_COMMAND_TIMEOUT_MS });
2243
+ return parseNativeDmgInfo(info.stdout);
2244
+ }
2245
+ async #resolveAttachOwnership() {
2246
+ const mountRoot = this.#mountRoot;
2247
+ if (mountRoot === undefined) throw new Error("DMG mount root is unavailable for ownership discovery");
2248
+ const ownership = resolveNativeDmgOwnership({
2249
+ info: await this.#readInfo(),
2250
+ ...this.#attachOutput === undefined ? {} : { attachOutput: this.#attachOutput },
2251
+ attachOutputReturned: this.#attachOutputReturned,
2252
+ mountRoot,
2253
+ baselineDevices: this.#baselineDevices
2254
+ });
2255
+ if (ownership.status === "owned") {
2256
+ this.#devices = [...ownership.devices];
2257
+ if (ownership.source === "info") for (const device of ownership.devices) this.#inventoryConfirmedDevices.add(device);
2258
+ this.#attachMayHaveMounted = false;
2259
+ this.#ownershipUncertainty = undefined;
2260
+ return "owned";
2261
+ }
2262
+ if (ownership.status === "unknown") {
2263
+ this.#ownershipUncertainty = ownership.reason;
2264
+ return "unknown";
2265
+ }
2266
+ this.#attachMayHaveMounted = false;
2267
+ this.#ownershipUncertainty = undefined;
2268
+ this.#devices = [];
2269
+ return "none";
2270
+ }
2271
+ };
2272
+ failureMessage = (cause) => cause instanceof Error ? cause.message : String(cause);
2273
+ processNotStarted = (cause) => {
2274
+ if (!(cause instanceof Error)) return false;
2275
+ const syscall = Reflect.get(cause, "syscall");
2276
+ const code = Reflect.get(cause, "code");
2277
+ const errno = Reflect.get(cause, "errno");
2278
+ return typeof syscall === "string" && syscall.startsWith("spawn ") && (typeof code === "string" || typeof code === "number" || typeof errno === "number");
2279
+ };
2280
+ runChecked = async (host, arguments_, signal, options) => {
2281
+ let result;
2282
+ try {
2283
+ result = await host.run(arguments_, signal, options);
2284
+ } catch (cause) {
2285
+ if (cause instanceof ArtifactReaderFailure) throw cause;
2286
+ if (cause instanceof Error && cause.name === "AbortError") throw new NativeDmgCommandFailure("cancelled", "DMG operation cancelled", execFileOutputFailure(cause)?.stdout ?? "", { cause });
2287
+ const output = execFileOutputFailure(cause);
2288
+ throw new NativeDmgCommandFailure(commandFailureReason(cause, arguments_[0]), `hdiutil ${arguments_[0] ?? "operation"} failed: ${describeCommandFailure(cause, arguments_)}`, output?.stdout ?? "", {
2289
+ cause,
2290
+ processNotStarted: processNotStarted(cause)
2291
+ });
2292
+ }
2293
+ if (result.exitCode !== 0) {
2294
+ const failure = {
2295
+ command: "/usr/bin/hdiutil",
2296
+ exitCode: result.exitCode,
2297
+ ...result.cause === undefined ? {} : { code: processExitCode(result.cause) },
2298
+ stdout: result.stdout,
2299
+ ...result.stderr === undefined ? {} : { stderr: result.stderr }
2300
+ };
2301
+ const reason = commandFailureReason(failure, arguments_[0]);
2302
+ const details = describeCommandFailure(failure, arguments_);
2303
+ const unknownVerifyFailure = arguments_[0] === "verify" && reason === "unavailable";
2304
+ throw new NativeDmgCommandFailure(reason, unknownVerifyFailure ? `hdiutil verify failed; captured diagnostics do not establish the failure cause: ${details}` : `hdiutil ${arguments_[0] ?? "operation"} failed: ${details}`, result.stdout, { cause: result.cause ?? failure });
2305
+ }
2306
+ return {
2307
+ stdout: result.stdout,
2308
+ exitCode: 0
2309
+ };
2310
+ };
2311
+ describeCommandFailure = (cause, arguments_) => {
2312
+ const fields = {
2313
+ command: "/usr/bin/hdiutil",
2314
+ arguments: [...arguments_]
2315
+ };
2316
+ if (typeof cause === "object" && cause !== null) {
2317
+ for (const key of [
2318
+ "code",
2319
+ "exitCode",
2320
+ "errno",
2321
+ "syscall",
2322
+ "signal",
2323
+ "stdout",
2324
+ "stderr"
2325
+ ]) {
2326
+ const value = Reflect.get(cause, key);
2327
+ if (typeof value === "string" || typeof value === "number") fields[key] = value;
2328
+ }
2329
+ const code = Reflect.get(cause, "code");
2330
+ if (typeof code === "number") fields.exitCode = code;
2331
+ }
2332
+ if (cause instanceof ArtifactReaderFailure) fields.message = cause.message;
2333
+ else if (cause instanceof Error) fields.message = cause.message;
2334
+ return JSON.stringify(fields);
2335
+ };
2336
+ processExitCode = (cause) => {
2337
+ if (typeof cause !== "object" || cause === null) return undefined;
2338
+ const exitCode = Reflect.get(cause, "exitCode");
2339
+ if (typeof exitCode === "number") return exitCode;
2340
+ const code = Reflect.get(cause, "code");
2341
+ return typeof code === "number" ? code : undefined;
2342
+ };
2343
+ processOutput = (cause, field) => {
2344
+ if (typeof cause !== "object" || cause === null) return "";
2345
+ const value = Reflect.get(cause, field);
2346
+ return typeof value === "string" ? value : "";
2347
+ };
2348
+ commandFailureReason = (cause, operation) => {
2349
+ if (typeof cause !== "object" || cause === null) return "unavailable";
2350
+ const code = Reflect.get(cause, "code");
2351
+ const exitCode = Reflect.get(cause, "exitCode");
2352
+ if (typeof code === "number" || typeof exitCode === "number") return operation === "verify" ? verifyFailureReason(cause) : "unavailable";
2353
+ if (code === "ENOENT") {
2354
+ const syscall = Reflect.get(cause, "syscall");
2355
+ return typeof syscall === "string" && syscall.startsWith("spawn") ? "unavailable" : "io";
2356
+ }
2357
+ if (code === "EACCES" || code === "EPERM" || code === "EIO" || code === "ENOTDIR" || code === "EISDIR" || code === "ENODEV" || code === "EROFS" || code === "EMFILE" || code === "ENFILE") return "io";
2358
+ return "unavailable";
2359
+ };
2360
+ verifyFailureReason = (cause) => {
2361
+ const diagnostic = verifyFailureDiagnostic(processOutput(cause, "stdout"), processOutput(cause, "stderr"));
2362
+ switch (diagnostic) {
2363
+ case "image not recognized": return "format";
2364
+ case "invalid checksum":
2365
+ case "image data corrupted": return "integrity";
2366
+ case "No such file or directory":
2367
+ case "Permission denied":
2368
+ case "Input/output error": return "io";
2369
+ default: return "unavailable";
2370
+ }
2371
+ };
2372
+ verifyFailureDiagnostic = (stdout, stderr) => {
2373
+ const prefix = "hdiutil: verify failed - ";
2374
+ return `${stdout}\n${stderr}`.split(/\r?\n/u).map((line) => line.trim()).find((line) => line.startsWith(prefix))?.slice(prefix.length);
2375
+ };
2376
+ command = (arguments_, effects) => ({
2377
+ tool: "/usr/bin/hdiutil",
2378
+ arguments: [...arguments_],
2379
+ tool_version: null,
2380
+ executable_sha256: null,
2381
+ exit_code: 0,
2382
+ effects
2383
+ });
2384
+ })))();
2385
+ }
2386
+
2387
+ //#endregion
2388
+ //#region dist/artifacts/inventory/reader.js
2389
+ var createReader, inventoryLimitations;
2390
+ function init_reader() {
2391
+ return (init_reader = __esmMin((() => {
2392
+ init_AsarArtifactReader();
2393
+ init_DirectoryArtifactReader();
2394
+ init_MachOSliceArtifactReader();
2395
+ init_NativeDmgArtifactReader();
2396
+ init_ZipArtifactReader();
2397
+ init_zipPackageFormat();
2398
+ createReader = (path, format, environment, rootSource) => {
2399
+ if (isZipPackageFormat(format)) return new ZipArtifactReader(path, format, undefined, rootSource);
2400
+ switch (format) {
2401
+ case "directory": return new DirectoryArtifactReader(path);
2402
+ case "asar": return new AsarArtifactReader(path);
2403
+ case "mach-o-universal": return process.platform === "darwin" ? new MachOSliceArtifactReader(path, environment, undefined, rootSource) : undefined;
2404
+ case "dmg":
2405
+ if (process.platform !== "darwin") return undefined;
2406
+ return new NativeDmgArtifactReader(path, environment);
2407
+ default: return undefined;
2408
+ }
2409
+ };
2410
+ inventoryLimitations = (format, reader) => {
2411
+ if (reader !== undefined) return isZipPackageFormat(reader.format) ? [ZIP_NON_ENTRY_TAIL_LIMITATION] : [];
2412
+ if (format === "dmg" || format === "pkg") return [`${format.toUpperCase()} root hash is observed; child inventory requires a native macOS adapter.`];
2413
+ if (format === "mach-o-universal" && process.platform !== "darwin") return ["Universal Mach-O slices require the native macOS lipo adapter."];
2414
+ return ["Artifact has no child container entries."];
2415
+ };
2416
+ })))();
2417
+ }
2418
+
2419
+ //#endregion
2420
+ //#region dist/artifacts/inventory/types.js
2421
+ var STRICT_INTEGRITY_POLICY;
2422
+ function init_types() {
2423
+ return (init_types = __esmMin((() => {
2424
+ STRICT_INTEGRITY_POLICY = { mode: "fail" };
2425
+ })))();
2426
+ }
2427
+
2428
+ //#endregion
2429
+ //#region dist/artifacts/inventory/scanReader.js
2430
+ var UNAVAILABLE_UNPACKED_LIMITATION, emptyScan, scanReader, visitArtifactEntries, digestArtifactEntry, isExpandableAsar, isUnavailableUnpackedEntry;
2431
+ function init_scanReader() {
2432
+ return (init_scanReader = __esmMin((() => {
2433
+ init_ArtifactPaths();
2434
+ init_ArtifactReader();
2435
+ init_AsarArtifactReader();
2436
+ init_ArtifactGraphConstruction();
2437
+ init_types();
2438
+ init_ArtifactHash();
2439
+ UNAVAILABLE_UNPACKED_LIMITATION = "ASAR unpacked companion bytes were unavailable; no content hash or child artifact was produced.";
2440
+ emptyScan = () => ({
2441
+ nodes: new Map(),
2442
+ occurrences: [],
2443
+ pendingContradictions: []
2444
+ });
2445
+ scanReader = async (reader, ownedReaders, signal, integrity = STRICT_INTEGRITY_POLICY) => {
2446
+ const { nodes, occurrences, pendingContradictions } = emptyScan();
2447
+ if (reader === undefined) return {
2448
+ nodes,
2449
+ occurrences,
2450
+ pendingContradictions,
2451
+ caseCollisionLimitation: undefined
2452
+ };
2453
+ const context = {
2454
+ reader,
2455
+ signal,
2456
+ integrity,
2457
+ nodes,
2458
+ occurrences,
2459
+ pendingContradictions,
2460
+ occurrenceByPath: new Map(),
2461
+ registry: new ArtifactPathRegistry(),
2462
+ expandedContainerIds: new Set(),
2463
+ ownedReaders
2464
+ };
2465
+ await visitArtifactEntries(context, reader, "");
2466
+ resolveOccurrenceParents(occurrences, context.occurrenceByPath, context.expandedContainerIds);
2467
+ return {
2468
+ nodes,
2469
+ occurrences,
2470
+ pendingContradictions,
2471
+ caseCollisionLimitation: annotateEnglishUnicodeCaseCollisions(occurrences)
2472
+ };
2473
+ };
2474
+ visitArtifactEntries = async (context, currentReader, prefix) => {
2475
+ const stack = [{
2476
+ reader: currentReader,
2477
+ prefix,
2478
+ iterator: currentReader.entries(context.signal)[Symbol.asyncIterator]()
2479
+ }];
2480
+ let failure;
2481
+ try {
2482
+ while (stack.length > 0) {
2483
+ const frame = stack.at(-1);
2484
+ if (frame === undefined) break;
2485
+ const next = await frame.iterator.next();
2486
+ if (next.done) {
2487
+ stack.pop();
2488
+ continue;
2489
+ }
2490
+ const entry = next.value;
2491
+ const logicalPath = normalizeArtifactPath(frame.prefix.length === 0 ? entry.path : `${frame.prefix}/${entry.path}`);
2492
+ const expandableAsar = isExpandableAsar(entry, logicalPath);
2493
+ context.registry.add(logicalPath, expandableAsar ? "directory" : entry.kind);
2494
+ const occurrence = createOccurrence(entry, logicalPath, null);
2495
+ let digested;
2496
+ try {
2497
+ digested = await digestArtifactEntry(context, frame.reader, entry, logicalPath);
2498
+ } catch (cause) {
2499
+ if (!isUnavailableUnpackedEntry(cause, entry)) throw cause;
2500
+ occurrence.hash_status = "unavailable";
2501
+ occurrence.limitations.push(UNAVAILABLE_UNPACKED_LIMITATION);
2502
+ }
2503
+ if (digested === undefined) noteUnreadContainerSuffix(occurrence);
2504
+ else {
2505
+ context.nodes.set(digested.node.artifact_id, digested.node);
2506
+ occurrence.artifact_id = digested.node.artifact_id;
2507
+ occurrence.artifact_kind = digested.classification.kind;
2508
+ occurrence.artifact_format = digested.classification.format;
2509
+ occurrence.hash_status = digested.mismatched ? "mismatched" : "verified";
2510
+ if (digested.mismatched) occurrence.limitations.push("Declared integrity metadata contradicts observed bytes.");
2511
+ }
2512
+ context.occurrences.push(occurrence);
2513
+ context.occurrenceByPath.set(logicalPath, occurrence);
2514
+ if (expandableAsar && digested !== undefined && digested.classification.format === "asar" && !digested.mismatched) {
2515
+ const nested = new AsarArtifactReader(entry.adapterKey);
2516
+ context.ownedReaders.push(nested);
2517
+ await nested.prepareContainer(digested.node.sha256, context.signal);
2518
+ context.expandedContainerIds.add(occurrence.occurrence_id);
2519
+ stack.push({
2520
+ reader: nested,
2521
+ prefix: logicalPath,
2522
+ iterator: nested.entries(context.signal)[Symbol.asyncIterator]()
2523
+ });
2524
+ }
2525
+ }
2526
+ } catch (cause) {
2527
+ failure = { cause };
2528
+ } finally {
2529
+ for (const { iterator, prefix, reader } of stack.reverse()) {
2530
+ try {
2531
+ await iterator.return?.();
2532
+ } catch (cause) {
2533
+ failure = { cause: ArtifactReaderFailure.withCleanup(failure === undefined ? cause : failure.cause, ArtifactReaderFailure.cleanupObservation(cause, `artifact traversal for ${prefix || reader.format}`)) };
2534
+ }
2535
+ }
2536
+ }
2537
+ if (failure !== undefined) throw failure.cause;
2538
+ };
2539
+ digestArtifactEntry = async (context, currentReader, entry, logicalPath) => {
2540
+ if (entry.kind !== "file" && entry.kind !== "slice" || entry.encrypted) return undefined;
2541
+ const digest = await hashReadable(await currentReader.open(entry, context.signal), context.signal);
2542
+ const mismatched = entry.declaredSha256 !== null && entry.declaredSha256 !== digest.sha256;
2543
+ if (mismatched && entry.declaredSha256 !== null) {
2544
+ if (context.integrity.mode === "fail") throw new ArtifactReaderFailure("integrity", `Artifact integrity metadata disagrees with content: ${logicalPath}`, undefined, {
2545
+ logicalPath,
2546
+ declaredSha256: entry.declaredSha256,
2547
+ calculatedSha256: digest.sha256,
2548
+ unpacked: entry.unpacked
2549
+ });
2550
+ context.pendingContradictions.push({
2551
+ logicalPath,
2552
+ declaredSha256: entry.declaredSha256,
2553
+ observedSha256: digest.sha256,
2554
+ entryKind: entry.kind,
2555
+ unpacked: entry.unpacked
2556
+ });
2557
+ }
2558
+ const classified = entry.kind === "slice" ? {
2559
+ kind: "universal-slice",
2560
+ format: "mach-o"
2561
+ } : classifyArtifactContent(logicalPath, digest.prefix, digest.bytes);
2562
+ return {
2563
+ node: createArtifactNode({
2564
+ sha256: digest.sha256,
2565
+ size: digest.bytes,
2566
+ format: classifyArtifactBytes(digest.prefix, digest.bytes),
2567
+ contentState: "embedded"
2568
+ }),
2569
+ mismatched,
2570
+ classification: classified
2571
+ };
2572
+ };
2573
+ isExpandableAsar = (entry, logicalPath) => entry.kind === "file" && logicalPath.toLowerCase().endsWith(".asar") && isAbsolute(entry.adapterKey);
2574
+ isUnavailableUnpackedEntry = (cause, entry) => entry.unpacked && cause instanceof ArtifactReaderFailure && cause.reason === "unavailable";
2575
+ })))();
2576
+ }
2577
+
2578
+ //#endregion
2579
+ //#region dist/artifacts/inventory/scanCanonical.js
2580
+ var scanCanonicalArtifactInventory, scanCanonicalArtifactInventoryInScope, cleanupInventoryOwners, buildInventorySnapshot, buildIntegrityContradictions, verifyRootDigest, sortNodes, sortOccurrences, sortEdges, buildManifest, buildLimitations;
2581
+ function init_scanCanonical() {
2582
+ return (init_scanCanonical = __esmMin((() => {
2583
+ init_unicodeCodePointOrder();
2584
+ init_AsarArtifactReader();
2585
+ init_ArtifactReader();
2586
+ init_artifactGraph();
2587
+ init_ArtifactGraphConstruction();
2588
+ init_artifactIdentity();
2589
+ init_classify();
2590
+ init_hostExecutableMarking();
2591
+ init_hashStableRootArtifact();
2592
+ init_reader();
2593
+ init_scanReader();
2594
+ init_types();
2595
+ scanCanonicalArtifactInventory = async (path, options, readerFactory = createReader) => options.resourceScope.run(() => scanCanonicalArtifactInventoryInScope(path, options, readerFactory));
2596
+ scanCanonicalArtifactInventoryInScope = async (path, options, readerFactory = createReader) => {
2597
+ const integrity = options.integrity ?? STRICT_INTEGRITY_POLICY;
2598
+ const metadata = await lstat(path);
2599
+ const { format: rootFormat, digest: rootDigest, rootSource } = await classifyAndHashRootForInventory(path, metadata.isDirectory(), metadata, options);
2600
+ let reader;
2601
+ let readerCreationFailure;
2602
+ try {
2603
+ reader = readerFactory(path, rootFormat, options.environment ?? {}, rootSource);
2604
+ } catch (cause) {
2605
+ readerCreationFailure = { cause };
2606
+ }
2607
+ const ownedReaders = reader === undefined ? [] : [reader];
2608
+ let outcome;
2609
+ try {
2610
+ if (readerCreationFailure !== undefined) throw readerCreationFailure.cause;
2611
+ if (reader instanceof AsarArtifactReader) await reader.prepareContainer(rootDigest?.sha256, options.signal);
2612
+ const { nodes, occurrences, pendingContradictions, caseCollisionLimitation } = await scanReader(reader, ownedReaders, options.signal, integrity);
2613
+ outcome = {
2614
+ kind: "completed",
2615
+ snapshot: await buildInventorySnapshot({
2616
+ path,
2617
+ metadata,
2618
+ rootFormat,
2619
+ rootDigest,
2620
+ rootSource,
2621
+ resourceScope: options.resourceScope,
2622
+ reader,
2623
+ signal: options.signal,
2624
+ nodes,
2625
+ occurrences,
2626
+ pendingContradictions,
2627
+ caseCollisionLimitation
2628
+ })
2629
+ };
2630
+ } catch (cause) {
2631
+ outcome = {
2632
+ kind: "failed",
2633
+ cause
2634
+ };
2635
+ }
2636
+ const cleanupFailure = await cleanupInventoryOwners({
2637
+ path,
2638
+ options,
2639
+ rootSource,
2640
+ ownedReaders,
2641
+ outcome
2642
+ });
2643
+ if (cleanupFailure !== undefined) throw cleanupFailure;
2644
+ if (outcome.kind === "failed") throw outcome.cause;
2645
+ return outcome.snapshot;
2646
+ };
2647
+ cleanupInventoryOwners = async ({ path, options, rootSource, ownedReaders, outcome }) => {
2648
+ let cleanupFailure;
2649
+ const owners = [...ownedReaders].reverse().map((reader) => ({
2650
+ kind: "reader",
2651
+ reader,
2652
+ resource: `artifact reader for ${path}`
2653
+ }));
2654
+ if (rootSource !== undefined) owners.push({
2655
+ kind: "file-handle",
2656
+ handle: rootSource.owner,
2657
+ resource: `root artifact descriptor for ${path}`
2658
+ });
2659
+ for (const owner of owners) {
2660
+ const attempt = await options.resourceScope.release(owner);
2661
+ if (attempt.kind === "released") continue;
2662
+ const primary = cleanupFailure ?? (outcome.kind === "failed" ? outcome.cause : attempt.cause);
2663
+ cleanupFailure = ArtifactReaderFailure.withCleanup(primary, ArtifactReaderFailure.cleanupObservation(attempt.cause, owner.resource), outcome.kind === "completed" ? {
2664
+ kind: "artifact-inventory",
2665
+ inventory: outcome.snapshot
2666
+ } : undefined);
2667
+ }
2668
+ return cleanupFailure;
2669
+ };
2670
+ buildInventorySnapshot = async (input) => {
2671
+ const { path, metadata, rootFormat, rootDigest, rootSource, reader, signal } = input;
2672
+ materializeDirectoryNodes(input.occurrences, input.nodes);
2673
+ const rootNode = createRootNode({
2674
+ digest: rootDigest,
2675
+ occurrences: input.occurrences
2676
+ });
2677
+ input.nodes.set(rootNode.artifact_id, rootNode);
2678
+ rekeyOccurrences(rootNode.artifact_id, input.occurrences);
2679
+ const rootOccurrence = rootOccurrenceFor(rootNode, {
2680
+ size: metadata.size,
2681
+ executable: hostExecutableMarking(path, metadata),
2682
+ format: rootFormat,
2683
+ path
2684
+ });
2685
+ for (const occurrence of input.occurrences) if (occurrence.parent_occurrence_id === null) occurrence.parent_occurrence_id = rootOccurrence.occurrence_id;
2686
+ input.occurrences.unshift(rootOccurrence);
2687
+ const occurrenceById = new Map(input.occurrences.map((occurrence) => [occurrence.occurrence_id, occurrence]));
2688
+ const occurrenceByPath = indexOccurrencesByPath(input.occurrences);
2689
+ const integrityContradictions = buildIntegrityContradictions(input.pendingContradictions, occurrenceByPath, occurrenceById, rootNode);
2690
+ const edges = createArtifactEdges(rootNode.artifact_id, input.occurrences, reader?.provenance()[0]);
2691
+ const orderedNodes = sortNodes([...input.nodes.values()]);
2692
+ const orderedOccurrences = sortOccurrences(input.occurrences);
2693
+ const orderedEdges = sortEdges(edges).map((edge, ordinal) => ({
2694
+ ...edge,
2695
+ ordinal
2696
+ }));
2697
+ await verifyRootDigest(path, rootDigest, rootSource, input.resourceScope, signal);
2698
+ const graphSha256 = artifactGraphDigest({
2699
+ nodes: orderedNodes,
2700
+ occurrences: orderedOccurrences,
2701
+ edges: orderedEdges,
2702
+ contradictions: integrityContradictions
2703
+ });
2704
+ const manifest = buildManifest({
2705
+ rootNode,
2706
+ rootFormat,
2707
+ graphSha256,
2708
+ orderedNodes,
2709
+ orderedOccurrences,
2710
+ orderedEdges
2711
+ });
2712
+ return {
2713
+ manifest,
2714
+ nodes: orderedNodes,
2715
+ occurrences: orderedOccurrences,
2716
+ edges: orderedEdges,
2717
+ provenance: reader?.provenance() ?? [],
2718
+ integrity_contradictions: integrityContradictions,
2719
+ limitations: buildLimitations(rootFormat, reader, integrityContradictions, input.caseCollisionLimitation)
2720
+ };
2721
+ };
2722
+ buildIntegrityContradictions = (pending, occurrenceByPath, occurrenceById, rootNode) => pending.map((contradiction) => {
2723
+ const occurrence = occurrenceByPath.get(contradiction.logicalPath);
2724
+ if (occurrence === undefined) throw new ArtifactReaderFailure("integrity", "Integrity contradiction lost its graph occurrence");
2725
+ const parent = occurrence.parent_occurrence_id === null ? undefined : occurrenceById.get(occurrence.parent_occurrence_id);
2726
+ const parentArtifactId = parent?.artifact_id ?? rootNode.artifact_id;
2727
+ return {
2728
+ contradiction_id: artifactContradictionId({
2729
+ rootArtifactId: rootNode.artifact_id,
2730
+ logicalPath: contradiction.logicalPath,
2731
+ declaredSha256: contradiction.declaredSha256,
2732
+ observedSha256: contradiction.observedSha256
2733
+ }),
2734
+ occurrence_id: occurrence.occurrence_id,
2735
+ parent_artifact_id: parentArtifactId,
2736
+ logical_path: contradiction.logicalPath,
2737
+ declared_sha256: contradiction.declaredSha256,
2738
+ observed_sha256: contradiction.observedSha256,
2739
+ entry_kind: contradiction.entryKind,
2740
+ unpacked: contradiction.unpacked,
2741
+ trust: "observed-untrusted",
2742
+ provenance: "container-integrity-metadata-versus-observed-bytes",
2743
+ limitations: ["Observed bytes contradict declared integrity metadata and cannot support equivalence."]
2744
+ };
2745
+ });
2746
+ verifyRootDigest = async (path, rootDigest, rootSource, resourceScope, signal) => {
2747
+ if (rootDigest === null) return;
2748
+ const verified = rootSource === undefined ? await hashStableRootArtifact(path, resourceScope, signal) : await hashStableRootArtifactHandle(path, rootSource.handle, rootSource.initial, signal);
2749
+ if (verified.sha256 !== rootDigest.sha256 || verified.bytes !== rootDigest.bytes) throw new ArtifactReaderFailure("integrity", "Root artifact changed during inventory");
2750
+ };
2751
+ sortNodes = (nodes) => nodes.sort((left, right) => compareUnicodeCodePoints(left.artifact_id, right.artifact_id));
2752
+ sortOccurrences = (occurrences) => occurrences.sort((left, right) => compareUnicodeCodePoints(left.logical_path, right.logical_path));
2753
+ sortEdges = (edges) => edges.sort((left, right) => compareUnicodeCodePoints(left.edge_id, right.edge_id));
2754
+ buildManifest = ({ rootNode, rootFormat, graphSha256, orderedNodes, orderedOccurrences, orderedEdges }) => artifactInventoryResultSchema.shape.manifest.parse({
2755
+ manifest_id: artifactManifestId(rootNode.artifact_id, graphSha256),
2756
+ root_artifact_id: rootNode.artifact_id,
2757
+ root_sha256: rootNode.sha256,
2758
+ root_format: rootFormat,
2759
+ graph_sha256: graphSha256,
2760
+ node_count: orderedNodes.length,
2761
+ occurrence_count: orderedOccurrences.length,
2762
+ edge_count: orderedEdges.length
2763
+ });
2764
+ buildLimitations = (rootFormat, reader, integrityContradictions, caseCollisionLimitation) => [
2765
+ ...inventoryLimitations(rootFormat, reader),
2766
+ ...caseCollisionLimitation === undefined ? [] : [caseCollisionLimitation],
2767
+ ...integrityContradictions.length === 0 ? [] : [`${String(integrityContradictions.length)} integrity contradiction(s) were recorded; mismatched content is observed-untrusted.`]
2768
+ ];
2769
+ })))();
2770
+ }
2771
+
2772
+ //#endregion
2773
+ export { AsarArtifactReader, DirectoryArtifactReader, MachOSliceArtifactReader, abortIfNeeded, hasMachoMagic, hashReadable, init_ArtifactHash, init_AsarArtifactReader, init_DirectoryArtifactReader, init_MachOSliceArtifactReader, init_MachoLoadCommandReader, init_scanCanonical, readMachoImage, scanCanonicalArtifactInventoryInScope };