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