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,1704 @@
1
+ import { t as __esmMin } from "./rolldown-runtime-BjeaiXFo.js";
2
+ import { A as err, M as ok, a as AnalysisCapabilityUnavailableError, f as init_analysisErrorCore, j as init_result } from "./analysisErrorCore-BIEP7tvF.js";
3
+ import { n as safeParseJson, t as init_safeJson } from "./safeJson-NeGfpkrI.js";
4
+ import { i as init_ArtifactReader, n as artifactPrimaryCleanupLeases, t as ArtifactReaderFailure } from "./ArtifactReader-BrnwNaKY.js";
5
+ import { S as init_OwnedFileHandle, c as RegularFileCleanupFailure, d as withOwnedFileHandle, f as withOwnedRegularFile, g as RegularFileOperationCancelled, l as init_OwnedRegularFile, s as RegularFileCancelled, v as init_RegularFile, x as OwnedFileHandle } from "./machoContainer-CMSxUBlK.js";
6
+ import { a as init_AnalysisCleanupLease, i as AnalysisCleanupLeaseGroup, n as init_providerCleanupError, r as AnalysisCleanupLease, t as ProviderCleanupError } from "./providerCleanupError-DIRHxzWo.js";
7
+ import { l as init_unicodeCodePointOrder, s as compareUnicodeCodePoints } from "./providerOperationHealth-9DRSGM8N.js";
8
+ import { n as init_analysisErrorCleanup, t as analysisErrorWithCleanupFailure } from "./analysisErrorCleanup-Q344SnTO.js";
9
+ import { basename, isAbsolute, join } from "node:path";
10
+ import { fileURLToPath } from "node:url";
11
+ import { rmSync } from "node:fs";
12
+ import { z } from "zod";
13
+ import { tmpdir } from "node:os";
14
+ import { mkdir, mkdtemp, readFile, rm } from "node:fs/promises";
15
+ import { execFile } from "node:child_process";
16
+ import { promisify } from "node:util";
17
+
18
+ //#region dist/config/providerStartupTimeout.js
19
+ var DEFAULT_GHIDRA_STARTUP_TIMEOUT_MS, DEFAULT_HOPPER_STARTUP_TIMEOUT_MS, DEFAULT_SWIFTC_COMPILE_TIMEOUT_MS, MAX_TIMER_DELAY_MS, providerStartupTimeoutSchema;
20
+ function init_providerStartupTimeout() {
21
+ return (init_providerStartupTimeout = __esmMin((() => {
22
+ DEFAULT_GHIDRA_STARTUP_TIMEOUT_MS = 33e4;
23
+ DEFAULT_HOPPER_STARTUP_TIMEOUT_MS = 12e4;
24
+ DEFAULT_SWIFTC_COMPILE_TIMEOUT_MS = 12e4;
25
+ MAX_TIMER_DELAY_MS = 2147483647;
26
+ providerStartupTimeoutSchema = z.string().regex(/^[1-9]\d*$/u, "must be a positive decimal integer").transform(Number).pipe(z.number().int().min(1).max(MAX_TIMER_DELAY_MS));
27
+ })))();
28
+ }
29
+
30
+ //#endregion
31
+ //#region dist/process/ExecFileOutput.js
32
+ var STOP_GRACE_MS, ExecFileOutputCancelledError, timeoutError, invalidTimeout, execFileOutputFailure, execFileBytes, execFileOutput;
33
+ function init_ExecFileOutput() {
34
+ return (init_ExecFileOutput = __esmMin((() => {
35
+ STOP_GRACE_MS = 5e3;
36
+ ExecFileOutputCancelledError = class extends Error {
37
+ _tag = "ExecFileOutputCancelledError";
38
+ code = "ABORT_ERR";
39
+ constructor(reason) {
40
+ super("The operation was aborted", { cause: reason });
41
+ this.name = "AbortError";
42
+ }
43
+ };
44
+ timeoutError = (command, timeout, exit) => {
45
+ const error = new Error(`Command timed out after ${String(timeout)} ms: ${command}`, exit === null ? undefined : { cause: exit });
46
+ Reflect.set(error, "code", "ETIMEDOUT");
47
+ Reflect.set(error, "killed", true);
48
+ Reflect.set(error, "signal", exit === null ? null : Reflect.get(exit, "signal") ?? null);
49
+ return error;
50
+ };
51
+ invalidTimeout = (timeout) => {
52
+ if (Number.isSafeInteger(timeout) && timeout >= 0) return undefined;
53
+ const error = new RangeError(`The value of "timeout" is out of range. It must be an unsigned integer. Received ${String(timeout)}`);
54
+ Reflect.set(error, "code", "ERR_OUT_OF_RANGE");
55
+ return error;
56
+ };
57
+ execFileOutputFailure = (cause) => {
58
+ if (!(cause instanceof Error)) return undefined;
59
+ const stdout = Reflect.get(cause, "stdout");
60
+ const stderr = Reflect.get(cause, "stderr");
61
+ const code = Reflect.get(cause, "code");
62
+ const signal = Reflect.get(cause, "signal");
63
+ const killed = Reflect.get(cause, "killed");
64
+ const outputTruncated = Reflect.get(cause, "outputTruncated");
65
+ const stdoutBytes = Reflect.get(cause, "stdoutBytes");
66
+ const stderrBytes = Reflect.get(cause, "stderrBytes");
67
+ const collectionFailure = Reflect.get(cause, "collectionFailure");
68
+ if (typeof stdout !== "string" || typeof stderr !== "string") return undefined;
69
+ return {
70
+ stdout,
71
+ stderr,
72
+ ...typeof stdoutBytes === "number" && Number.isSafeInteger(stdoutBytes) && stdoutBytes >= 0 ? { stdoutBytes } : {},
73
+ ...typeof stderrBytes === "number" && Number.isSafeInteger(stderrBytes) && stderrBytes >= 0 ? { stderrBytes } : {},
74
+ code: typeof code === "string" || typeof code === "number" ? code : null,
75
+ signal: typeof signal === "string" ? signal : null,
76
+ killed: killed === true,
77
+ outputTruncated: outputTruncated === true || code === "ERR_CHILD_PROCESS_STDIO_MAXBUFFER",
78
+ ...collectionFailure === true ? { collectionFailure: true } : {}
79
+ };
80
+ };
81
+ execFileBytes = (command, arguments_, options = {}) => new Promise((resolve, reject) => {
82
+ const { stopSignal, signal, timeout, ...execOptions } = options;
83
+ const invalid = timeout === undefined ? undefined : invalidTimeout(timeout);
84
+ if (invalid !== undefined) {
85
+ reject(invalid);
86
+ return;
87
+ }
88
+ if (stopSignal !== undefined && signal?.aborted === true) {
89
+ reject(new ExecFileOutputCancelledError(signal.reason));
90
+ return;
91
+ }
92
+ let stopped;
93
+ let deadline;
94
+ let grace;
95
+ const child = execFile(command, [...arguments_], {
96
+ ...execOptions,
97
+ ...stopSignal === undefined ? {
98
+ ...signal === undefined ? {} : { signal },
99
+ ...timeout === undefined ? {} : { timeout }
100
+ } : { killSignal: stopSignal },
101
+ encoding: "buffer",
102
+ maxBuffer: options.maxBuffer ?? Number.POSITIVE_INFINITY
103
+ }, (error, stdout, stderr) => {
104
+ signal?.removeEventListener("abort", onAbort);
105
+ clearTimeout(deadline);
106
+ clearTimeout(grace);
107
+ const failure = stopped === "abort" && signal !== undefined ? new ExecFileOutputCancelledError(signal.reason) : stopped === "timeout" && timeout !== undefined ? timeoutError(command, timeout, error) : error?.name === "AbortError" && error.code === "ABORT_ERR" ? new ExecFileOutputCancelledError(error.cause) : error;
108
+ if (failure !== null) {
109
+ Reflect.set(failure, "stdout", stdout.toString("utf8"));
110
+ Reflect.set(failure, "stderr", stderr.toString("utf8"));
111
+ Reflect.set(failure, "stdoutBytes", stdout.byteLength);
112
+ Reflect.set(failure, "stderrBytes", stderr.byteLength);
113
+ reject(failure);
114
+ return;
115
+ }
116
+ resolve({
117
+ stdout,
118
+ stderr
119
+ });
120
+ });
121
+ const stop = (reason) => {
122
+ if (stopped !== undefined) return;
123
+ stopped = reason;
124
+ child.kill(stopSignal);
125
+ grace = setTimeout(() => child.kill("SIGKILL"), STOP_GRACE_MS);
126
+ };
127
+ const onAbort = () => {
128
+ stop("abort");
129
+ };
130
+ if (stopSignal === undefined) return;
131
+ signal?.addEventListener("abort", onAbort, { once: true });
132
+ if (timeout !== undefined && timeout > 0) deadline = setTimeout(() => {
133
+ stop("timeout");
134
+ }, timeout);
135
+ });
136
+ execFileOutput = (command, arguments_, options = {}) => execFileBytes(command, arguments_, options).then(({ stdout, stderr }) => ({
137
+ stdout: stdout.toString("utf8"),
138
+ stderr: stderr.toString("utf8"),
139
+ stdoutBytes: stdout.byteLength,
140
+ stderrBytes: stderr.byteLength
141
+ }));
142
+ })))();
143
+ }
144
+
145
+ //#endregion
146
+ //#region dist/process/ProcessCommandIdentity.js
147
+ var matchesOwnedProcessCommand;
148
+ function init_ProcessCommandIdentity() {
149
+ return (init_ProcessCommandIdentity = __esmMin((() => {
150
+ matchesOwnedProcessCommand = (actual, expected, platform = process.platform) => {
151
+ const actualCommand = actual.trim();
152
+ const expectedCommand = expected.trim();
153
+ if (actualCommand === expectedCommand || actualCommand.startsWith(`${expectedCommand} `)) return true;
154
+ if (platform !== "darwin") return false;
155
+ const actualExecutable = actualCommand.split(/\s+/u, 1)[0];
156
+ const expectedExecutable = expectedCommand.split(/\s+/u, 1)[0];
157
+ const normalizedActualExecutable = actualExecutable?.startsWith("(") === true && actualExecutable.endsWith(")") ? actualExecutable.slice(1, -1) : actualExecutable;
158
+ return normalizedActualExecutable !== undefined && expectedExecutable !== undefined && basename(normalizedActualExecutable) === basename(expectedExecutable);
159
+ };
160
+ })))();
161
+ }
162
+
163
+ //#endregion
164
+ //#region dist/process/ProcessOwnershipIdentity.js
165
+ var launcherIdentityFailure;
166
+ function init_ProcessOwnershipIdentity() {
167
+ return (init_ProcessOwnershipIdentity = __esmMin((() => {
168
+ init_ProcessCommandIdentity();
169
+ launcherIdentityFailure = (launcher, ownership) => {
170
+ if (launcher.processGroupId !== ownership.processGroupId) return "owned launcher process-group identity did not match";
171
+ if (ownership.expectedParentPid !== undefined && launcher.parentPid !== ownership.expectedParentPid) return "owned launcher parent identity did not match";
172
+ if (ownership.expectedCommand !== undefined && !matchesOwnedProcessCommand(launcher.command, ownership.expectedCommand)) return `owned launcher command identity did not match (observed=${launcher.command}; expected=${ownership.expectedCommand})`;
173
+ return null;
174
+ };
175
+ })))();
176
+ }
177
+
178
+ //#endregion
179
+ //#region dist/process/ProcessOwnershipProcessTree.js
180
+ var liveProcesses, descendantsOf, selectCapturedProcessGroupIds;
181
+ function init_ProcessOwnershipProcessTree() {
182
+ return (init_ProcessOwnershipProcessTree = __esmMin((() => {
183
+ liveProcesses = (members) => members.filter(({ state }) => !state.startsWith("Z"));
184
+ descendantsOf = (rootPids, processes) => {
185
+ const childrenByParent = new Map();
186
+ for (const process of processes) {
187
+ const siblings = childrenByParent.get(process.parentPid) ?? [];
188
+ siblings.push(process);
189
+ childrenByParent.set(process.parentPid, siblings);
190
+ }
191
+ const descendants = [];
192
+ const pending = rootPids.flatMap((pid) => childrenByParent.get(pid) ?? []);
193
+ const visited = new Set(rootPids);
194
+ for (const process of pending) {
195
+ if (visited.has(process.pid)) continue;
196
+ visited.add(process.pid);
197
+ descendants.push(process);
198
+ pending.push(...childrenByParent.get(process.pid) ?? []);
199
+ }
200
+ return descendants;
201
+ };
202
+ selectCapturedProcessGroupIds = (rootPid, samples) => {
203
+ const processGroupIds = new Set([rootPid]);
204
+ for (const sample of samples) {
205
+ if (sample.pid === sample.process_group_id) processGroupIds.add(sample.pid);
206
+ }
207
+ return [...processGroupIds];
208
+ };
209
+ })))();
210
+ }
211
+
212
+ //#endregion
213
+ //#region dist/process/boundedUtf8Text.js
214
+ var boundedUtf8Text;
215
+ function init_boundedUtf8Text() {
216
+ return (init_boundedUtf8Text = __esmMin((() => {
217
+ boundedUtf8Text = (value, maximumBytes) => {
218
+ let bytes = 0;
219
+ let end = 0;
220
+ for (const codePoint of value) {
221
+ const codePointBytes = Buffer.byteLength(codePoint, "utf8");
222
+ if (bytes + codePointBytes > maximumBytes) return {
223
+ text: value.slice(0, end),
224
+ truncated: true
225
+ };
226
+ bytes += codePointBytes;
227
+ end += codePoint.length;
228
+ }
229
+ return {
230
+ text: value,
231
+ truncated: false
232
+ };
233
+ };
234
+ })))();
235
+ }
236
+
237
+ //#endregion
238
+ //#region dist/process/DarwinProcessRunTokenReader.js
239
+ var responseSchema, identityResponseSchema, sourceFiles, SWIFTC_INTERRUPT, resolveSwiftcCompileTimeoutMs, STDERR_EXCERPT_LIMIT, DarwinProcessOwnershipInspectionError, MAX_COMPILER_OUTPUT_BYTES, compilerFailureFacts, compilerOutcomeDescription, compilerInspectionError, abortReason, isExpectedAbort$1, waitForCompilation, createDarwinProcessRunTokenReader;
240
+ function init_DarwinProcessRunTokenReader() {
241
+ return (init_DarwinProcessRunTokenReader = __esmMin((() => {
242
+ init_providerStartupTimeout();
243
+ init_result();
244
+ init_providerCleanupError();
245
+ init_analysisErrorCleanup();
246
+ init_safeJson();
247
+ init_boundedUtf8Text();
248
+ init_ExecFileOutput();
249
+ responseSchema = z.strictObject({ results: z.array(z.discriminatedUnion("state", [z.strictObject({
250
+ pid: z.number().int().positive(),
251
+ state: z.literal("readable"),
252
+ run_id: z.string().optional(),
253
+ reason: z.null().optional()
254
+ }), z.strictObject({
255
+ pid: z.number().int().positive(),
256
+ state: z.literal("unavailable"),
257
+ run_id: z.union([z.string(), z.null()]).optional(),
258
+ reason: z.string().min(1)
259
+ })])) });
260
+ identityResponseSchema = z.strictObject({ results: z.array(z.discriminatedUnion("state", [z.strictObject({
261
+ pid: z.number().int().positive(),
262
+ state: z.literal("readable"),
263
+ identity: z.string().min(1),
264
+ reason: z.null().optional()
265
+ }), z.strictObject({
266
+ pid: z.number().int().positive(),
267
+ state: z.literal("unavailable"),
268
+ identity: z.null().optional(),
269
+ reason: z.string().min(1)
270
+ })])) });
271
+ sourceFiles = [fileURLToPath(new URL("../../bridge/process/ProcessRunTokenReader.swift", new URL("../process/DarwinProcessRunTokenReader.js", import.meta.url).href)), fileURLToPath(new URL("../../bridge/process/ProcessRunTokenReaderMain.swift", new URL("../process/DarwinProcessRunTokenReader.js", import.meta.url).href))];
272
+ SWIFTC_INTERRUPT = "SIGINT";
273
+ resolveSwiftcCompileTimeoutMs = (options = {}) => {
274
+ if (options.compileTimeoutMs !== undefined) return options.compileTimeoutMs;
275
+ const raw = (options.environment ?? process.env).REA_SWIFTC_COMPILE_TIMEOUT_MS;
276
+ if (raw === undefined) return DEFAULT_SWIFTC_COMPILE_TIMEOUT_MS;
277
+ const parsed = providerStartupTimeoutSchema.safeParse(raw);
278
+ return parsed.success ? parsed.data : DEFAULT_SWIFTC_COMPILE_TIMEOUT_MS;
279
+ };
280
+ STDERR_EXCERPT_LIMIT = 512;
281
+ DarwinProcessOwnershipInspectionError = class DarwinProcessOwnershipInspectionError extends Error {
282
+ #cleanupOwner;
283
+ get cleanupOwner() {
284
+ return this.#cleanupOwner;
285
+ }
286
+ constructor(message, options) {
287
+ const { compilerOutcome, capturedOutput, cleanupFailure, cleanupOwner, cancellation, ...errorOptions } = options ?? {};
288
+ super(message, errorOptions);
289
+ this.name = "DarwinProcessOwnershipInspectionError";
290
+ this.compilerOutcome = compilerOutcome;
291
+ this.capturedOutput = capturedOutput;
292
+ this.#cleanupOwner = cleanupOwner;
293
+ this.cleanupFailure = cleanupFailure;
294
+ this.cancellation = cancellation;
295
+ }
296
+ compilerOutcome;
297
+ capturedOutput;
298
+ cleanupFailure;
299
+ cancellation;
300
+ /** Preserve the physical preparation failure while following the exact cleanup owner. */
301
+ withCleanupFailure(cleanup, owner) {
302
+ const combined = this.cleanupFailure === undefined || this.cleanupFailure === cleanup ? cleanup : analysisErrorWithCleanupFailure(this.cleanupFailure, cleanup).bindCleanupDependencies([this.cleanupFailure, cleanup]);
303
+ return new DarwinProcessOwnershipInspectionError(this.message, {
304
+ ...Object.hasOwn(this, "cause") ? { cause: this.cause } : {},
305
+ ...this.compilerOutcome === undefined ? {} : { compilerOutcome: this.compilerOutcome },
306
+ ...this.capturedOutput === undefined ? {} : { capturedOutput: this.capturedOutput },
307
+ cleanupFailure: combined,
308
+ cleanupOwner: owner ?? this.cleanupOwner,
309
+ ...this.cancellation === undefined ? {} : { cancellation: this.cancellation }
310
+ });
311
+ }
312
+ };
313
+ MAX_COMPILER_OUTPUT_BYTES = 8 * 1024;
314
+ compilerFailureFacts = (cause, timeoutMs) => {
315
+ const failure = execFileOutputFailure(cause);
316
+ if (failure === undefined) return undefined;
317
+ const stderr = boundedUtf8Text(failure.stderr, MAX_COMPILER_OUTPUT_BYTES);
318
+ const stdout = boundedUtf8Text(failure.stdout, MAX_COMPILER_OUTPUT_BYTES);
319
+ const outcome = failure.code === "ETIMEDOUT" ? "timed_out" : typeof failure.code === "number" ? "exited" : failure.signal !== null ? "signaled" : failure.code === "ENOENT" ? "spawn_failed" : "failed";
320
+ return {
321
+ outcome: {
322
+ outcome,
323
+ code: failure.code,
324
+ signal: failure.signal,
325
+ stderr: stderr.text,
326
+ ...failure.stderrBytes === undefined ? {} : { stderrBytes: failure.stderrBytes },
327
+ stderrTruncated: stderr.truncated,
328
+ outputTruncated: failure.outputTruncated,
329
+ killed: failure.killed,
330
+ ...outcome === "timed_out" ? { timeoutMs } : {}
331
+ },
332
+ capturedOutput: {
333
+ stdout: stdout.text,
334
+ stderr: stderr.text,
335
+ truncated: stdout.truncated || stderr.truncated || failure.outputTruncated,
336
+ ...failure.stdoutBytes === undefined ? {} : { stdout_bytes: failure.stdoutBytes },
337
+ ...failure.stderrBytes === undefined ? {} : { stderr_bytes: failure.stderrBytes },
338
+ exit_code: typeof failure.code === "number" ? failure.code : null,
339
+ signal: failure.signal
340
+ }
341
+ };
342
+ };
343
+ compilerOutcomeDescription = (outcome, fallbackCode) => {
344
+ if (outcome === undefined) return `compiler result: ${String(fallbackCode)}`;
345
+ if (outcome.outcome === "exited") return `compiler result: exit code ${String(outcome.code)}`;
346
+ if (outcome.outcome === "timed_out") return `compiler result: timed out after ${String(outcome.timeoutMs)} ms`;
347
+ if (outcome.outcome === "signaled") return `compiler result: stopped by signal ${outcome.signal ?? "an unknown signal"}`;
348
+ return `compiler result: ${String(outcome.code)}`;
349
+ };
350
+ compilerInspectionError = (cause, timeoutMs, compiler) => {
351
+ const facts = compilerFailureFacts(cause, timeoutMs);
352
+ const outcome = facts?.outcome;
353
+ const code = outcome?.code ?? "unknown";
354
+ const description = compilerOutcomeDescription(outcome, code);
355
+ const launcher = compiler.kind === "xcrun" ? "xcrun" : "the selected Swift compiler (REA_DARWIN_SWIFTC_PATH)";
356
+ const prefix = code === "ENOENT" ? `macOS process ownership inspection requires the Apple Swift compiler via ${launcher}` : `macOS process ownership helper compilation failed via ${launcher}`;
357
+ const stderr = boundedUtf8Text(outcome?.stderr ?? "", STDERR_EXCERPT_LIMIT);
358
+ const diagnostics = stderr.text.trim();
359
+ const truncated = stderr.truncated || outcome?.stderrTruncated === true || outcome?.outputTruncated === true;
360
+ const suffix = diagnostics ? `: ${diagnostics}${truncated ? "… [diagnostics truncated]" : ""}` : outcome === undefined ? `: ${cause instanceof Error ? cause.message : String(cause)}` : ": no compiler diagnostics were captured";
361
+ return new DarwinProcessOwnershipInspectionError(`${prefix} (${description})${suffix}`, {
362
+ cause,
363
+ ...facts === undefined ? {} : {
364
+ compilerOutcome: facts.outcome,
365
+ capturedOutput: facts.capturedOutput
366
+ }
367
+ });
368
+ };
369
+ abortReason = (signal) => {
370
+ if (signal.reason !== undefined) return signal.reason;
371
+ const error = new Error("The operation was aborted");
372
+ error.name = "AbortError";
373
+ return error;
374
+ };
375
+ isExpectedAbort$1 = (cause, signal) => signal.aborted && (cause === signal.reason || cause instanceof Error && cause.name === "AbortError");
376
+ waitForCompilation = async (operation, signal) => {
377
+ if (signal === undefined) return {
378
+ kind: "completed",
379
+ result: await operation.promise
380
+ };
381
+ return new Promise((resolve) => {
382
+ let completed = false;
383
+ const finish = (outcome) => {
384
+ if (completed) return;
385
+ completed = true;
386
+ signal.removeEventListener("abort", onAbort);
387
+ resolve(outcome);
388
+ };
389
+ const onAbort = () => {
390
+ if (operation.primaryFailure !== undefined) return;
391
+ finish({
392
+ kind: "cancelled",
393
+ reason: signal.reason
394
+ });
395
+ };
396
+ signal.addEventListener("abort", onAbort, { once: true });
397
+ void operation.promise.then((result) => finish({
398
+ kind: "completed",
399
+ result
400
+ }));
401
+ if (signal.aborted) onAbort();
402
+ });
403
+ };
404
+ createDarwinProcessRunTokenReader = (options = {}) => {
405
+ const compiler = options.compiler ?? {
406
+ kind: "xcrun",
407
+ executable: "/usr/bin/xcrun"
408
+ };
409
+ const compilerTimeoutMs = resolveSwiftcCompileTimeoutMs(options);
410
+ const moduleCachePath = options.moduleCachePath ?? "";
411
+ let root;
412
+ let executable;
413
+ let compilation;
414
+ let closePromise;
415
+ let closed = false;
416
+ let exitCleanupInstalled = false;
417
+ const cleanupAtExit = () => {
418
+ if (root !== undefined) rmSync(root.path, {
419
+ recursive: true,
420
+ force: true
421
+ });
422
+ };
423
+ const cleanupRoot = (target = root) => {
424
+ if (target === undefined) return Promise.resolve();
425
+ target.cleanupPromise ??= Promise.resolve().then(async () => {
426
+ try {
427
+ await rm(target.path, {
428
+ recursive: true,
429
+ force: true
430
+ });
431
+ } catch (cause) {
432
+ const failure = new ProviderCleanupError("process-ownership", [target.path], { reason: "The Darwin ownership helper root remains owned until removal succeeds." }, {
433
+ cause,
434
+ operation: "prepare_owned_process"
435
+ });
436
+ if (target.cleanupAnchor === undefined) target.cleanupAnchor = failure;
437
+ else failure.bindCleanupDependencies([target.cleanupAnchor]);
438
+ throw failure;
439
+ }
440
+ target.cleanupAnchor?.resolveCleanup();
441
+ target.cleanupAnchor = undefined;
442
+ if (root !== target) return;
443
+ root = undefined;
444
+ executable = undefined;
445
+ if (exitCleanupInstalled) process.removeListener("exit", cleanupAtExit);
446
+ exitCleanupInstalled = false;
447
+ }).catch((cause) => {
448
+ target.cleanupPromise = undefined;
449
+ throw cause;
450
+ });
451
+ return target.cleanupPromise;
452
+ };
453
+ const runCompilation = async (operation) => {
454
+ const signal = operation.controller.signal;
455
+ let operationRoot;
456
+ try {
457
+ if (compiler.kind === "swiftc" && (!isAbsolute(compiler.executable) || !isAbsolute(compiler.sdkRoot))) {
458
+ throw new DarwinProcessOwnershipInspectionError("Direct Darwin helper compilation requires absolute REA_DARWIN_SWIFTC_PATH and SDKROOT paths selecting a compatible installed Swift compiler and macOS SDK.");
459
+ }
460
+ operationRoot = { path: await mkdtemp(join(tmpdir(), "rea-process-token-")) };
461
+ root = operationRoot;
462
+ process.once("exit", cleanupAtExit);
463
+ exitCleanupInstalled = true;
464
+ if (signal.aborted || closed) throw abortReason(signal);
465
+ const output = join(operationRoot.path, "reader");
466
+ const compilerTemporary = join(operationRoot.path, "tmp");
467
+ await mkdir(compilerTemporary);
468
+ const compilerEnvironment = {
469
+ ...process.env,
470
+ TMPDIR: compilerTemporary
471
+ };
472
+ const compilerArguments = compiler.kind === "xcrun" ? ["swiftc"] : ["-sdk", compiler.sdkRoot];
473
+ if (compiler.kind === "swiftc") compilerEnvironment.SDKROOT = compiler.sdkRoot;
474
+ if (moduleCachePath === "") {
475
+ delete compilerEnvironment.CLANG_MODULE_CACHE_PATH;
476
+ } else {
477
+ await mkdir(moduleCachePath, { recursive: true });
478
+ compilerArguments.push("-module-cache-path", moduleCachePath);
479
+ compilerEnvironment.CLANG_MODULE_CACHE_PATH = moduleCachePath;
480
+ }
481
+ compilerArguments.push(...sourceFiles, "-o", output);
482
+ try {
483
+ await execFileOutput(compiler.executable, compilerArguments, {
484
+ timeout: compilerTimeoutMs,
485
+ maxBuffer: 1024 * 1024,
486
+ signal,
487
+ stopSignal: SWIFTC_INTERRUPT,
488
+ env: compilerEnvironment
489
+ });
490
+ } catch (cause) {
491
+ if (isExpectedAbort$1(cause, signal)) throw cause;
492
+ throw compilerInspectionError(cause, compilerTimeoutMs, compiler);
493
+ }
494
+ if (signal.aborted || closed) throw abortReason(signal);
495
+ executable = output;
496
+ return output;
497
+ } catch (cause) {
498
+ operation.primaryFailure = { cause };
499
+ if (operationRoot !== undefined) {
500
+ try {
501
+ await cleanupRoot(operationRoot);
502
+ } catch (cleanup) {
503
+ if (!(cleanup instanceof ProviderCleanupError)) throw cleanup;
504
+ const primary = cause instanceof DarwinProcessOwnershipInspectionError ? cause : new DarwinProcessOwnershipInspectionError("Darwin process ownership helper preparation failed", { cause });
505
+ throw primary.withCleanupFailure(cleanup, { close: () => cleanupRoot(operationRoot) });
506
+ }
507
+ }
508
+ throw cause;
509
+ }
510
+ };
511
+ const beginCompilation = () => {
512
+ const controller = new AbortController();
513
+ const operation = {
514
+ controller,
515
+ promise: Promise.resolve().then(() => runCompilation(operation)).then(ok, err).finally(() => {
516
+ operation.settled = true;
517
+ if (compilation === operation) compilation = undefined;
518
+ }),
519
+ waiters: 0,
520
+ aborting: false,
521
+ settled: false
522
+ };
523
+ compilation = operation;
524
+ return operation;
525
+ };
526
+ const compile = async (signal) => {
527
+ if (closed) throw new Error("Darwin process token reader is closed");
528
+ signal?.throwIfAborted();
529
+ while (true) {
530
+ if (closed) throw new Error("Darwin process token reader is closed");
531
+ signal?.throwIfAborted();
532
+ if (executable !== undefined) return executable;
533
+ if (compilation === undefined && root !== undefined) {
534
+ await cleanupRoot();
535
+ continue;
536
+ }
537
+ let operation = compilation;
538
+ if (operation?.aborting === true) {
539
+ const waited = await waitForCompilation(operation, signal);
540
+ if (waited.kind === "cancelled") throw waited.reason;
541
+ if (!waited.result.ok && waited.result.error instanceof DarwinProcessOwnershipInspectionError && waited.result.error.cleanupFailure !== undefined) throw waited.result.error;
542
+ continue;
543
+ }
544
+ operation ??= beginCompilation();
545
+ operation.waiters += 1;
546
+ const waited = await waitForCompilation(operation, signal);
547
+ operation.waiters -= 1;
548
+ if (operation.waiters === 0 && !operation.settled && !operation.aborting) {
549
+ operation.aborting = true;
550
+ operation.controller.abort();
551
+ const finalized = await operation.promise;
552
+ if (waited.kind === "cancelled" && !finalized.ok && finalized.error instanceof DarwinProcessOwnershipInspectionError && finalized.error.cleanupFailure !== undefined) {
553
+ throw new DarwinProcessOwnershipInspectionError("Darwin process ownership helper preparation was cancelled", {
554
+ cause: waited.reason,
555
+ cancellation: { reason: waited.reason },
556
+ cleanupFailure: finalized.error.cleanupFailure,
557
+ cleanupOwner: finalized.error.cleanupOwner
558
+ });
559
+ }
560
+ }
561
+ if (waited.kind === "cancelled") throw waited.reason;
562
+ if (!waited.result.ok) throw waited.result.error;
563
+ return waited.result.value;
564
+ }
565
+ };
566
+ const read = async (processes, signal) => {
567
+ signal?.throwIfAborted();
568
+ if (processes.length === 0) return new Map();
569
+ const binary = await compile(signal);
570
+ const pids = processes.map(({ pid }) => String(pid));
571
+ const { stdout } = await execFileOutput(binary, pids, {
572
+ timeout: 15e3,
573
+ ...signal === undefined ? {} : { signal }
574
+ });
575
+ signal?.throwIfAborted();
576
+ const decoded = safeParseJson(stdout);
577
+ if (!decoded.ok) throw new Error(`macOS process token helper returned invalid JSON: ${decoded.error}`, { cause: decoded.cause });
578
+ const parsed = responseSchema.safeParse(decoded.value);
579
+ if (!parsed.success) throw new Error("macOS process token helper returned an invalid response", { cause: parsed.error });
580
+ const requested = new Set(processes.map(({ pid }) => pid));
581
+ const observations = new Map();
582
+ for (const result of parsed.data.results) {
583
+ if (!requested.has(result.pid) || observations.has(result.pid)) throw new Error("macOS process token helper returned an unexpected PID set");
584
+ observations.set(result.pid, result.state === "readable" ? {
585
+ state: "readable",
586
+ runId: result.run_id
587
+ } : {
588
+ state: "unavailable",
589
+ reason: result.reason ?? "process token observation is unavailable"
590
+ });
591
+ }
592
+ if (observations.size !== requested.size) throw new Error("macOS process token helper returned an incomplete PID set");
593
+ return observations;
594
+ };
595
+ const identities = async (processes, signal) => {
596
+ if (processes.length === 0) return new Map();
597
+ const binary = await compile(signal);
598
+ const pids = processes.map(({ pid }) => String(pid));
599
+ const { stdout } = await execFileOutput(binary, ["--identities", ...pids], {
600
+ timeout: 15e3,
601
+ ...signal === undefined ? {} : { signal }
602
+ });
603
+ const decoded = safeParseJson(stdout);
604
+ if (!decoded.ok) throw new Error(`macOS process identity helper returned invalid JSON: ${decoded.error}`, { cause: decoded.cause });
605
+ const parsed = identityResponseSchema.safeParse(decoded.value);
606
+ if (!parsed.success) throw new Error("macOS process identity helper returned an invalid response", { cause: parsed.error });
607
+ const requested = new Set(processes.map(({ pid }) => pid));
608
+ const observations = new Map();
609
+ for (const result of parsed.data.results) {
610
+ if (!requested.has(result.pid) || observations.has(result.pid)) throw new Error("macOS process identity helper returned an unexpected PID set");
611
+ observations.set(result.pid, result.state === "readable" ? {
612
+ state: "readable",
613
+ identity: result.identity
614
+ } : {
615
+ state: "unavailable",
616
+ reason: result.reason
617
+ });
618
+ }
619
+ if (observations.size !== requested.size) throw new Error("macOS process identity helper returned an incomplete PID set");
620
+ return observations;
621
+ };
622
+ const close = () => {
623
+ if (closePromise !== undefined) return closePromise;
624
+ closed = true;
625
+ const pendingClose = (async () => {
626
+ const operation = compilation;
627
+ if (operation !== undefined && !operation.settled) {
628
+ operation.aborting = true;
629
+ operation.controller.abort();
630
+ await operation.promise;
631
+ }
632
+ await cleanupRoot();
633
+ })().catch((cause) => {
634
+ if (closePromise === pendingClose) closePromise = undefined;
635
+ throw cause;
636
+ });
637
+ closePromise = pendingClose;
638
+ return closePromise;
639
+ };
640
+ return {
641
+ read,
642
+ identities,
643
+ prepare: compile,
644
+ close
645
+ };
646
+ };
647
+ })))();
648
+ }
649
+
650
+ //#endregion
651
+ //#region dist/process/ProcessRunTokenObservations.js
652
+ /** Read only ownership tokens, using per-process fallback for missing batch rows. */
653
+ async function* readProcessRunTokens(host, processes, signal) {
654
+ signal?.throwIfAborted();
655
+ if (processes.length === 0) return;
656
+ let batch;
657
+ let batchFailure;
658
+ if (host.runTokens !== undefined) {
659
+ try {
660
+ batch = signal === undefined ? await host.runTokens(processes) : await host.runTokens(processes, signal);
661
+ } catch (cause) {
662
+ signal?.throwIfAborted();
663
+ batchFailure = errorMessage$1(cause);
664
+ }
665
+ }
666
+ for (const process of processes) {
667
+ signal?.throwIfAborted();
668
+ let observation = batch?.get(process.pid);
669
+ if (observation === undefined) {
670
+ try {
671
+ const environment = signal === undefined ? await host.environment(process.pid) : await host.environment(process.pid, signal);
672
+ observation = {
673
+ state: "readable",
674
+ runId: environment.REA_PROCESS_RUN_ID
675
+ };
676
+ } catch (cause) {
677
+ signal?.throwIfAborted();
678
+ const reason = errorMessage$1(cause);
679
+ observation = {
680
+ state: "unavailable",
681
+ reason: batchFailure === undefined ? reason : `${reason}; run-token batch failed: ${batchFailure}`
682
+ };
683
+ }
684
+ }
685
+ signal?.throwIfAborted();
686
+ yield {
687
+ process,
688
+ observation
689
+ };
690
+ }
691
+ }
692
+ var errorMessage$1;
693
+ function init_ProcessRunTokenObservations() {
694
+ return (init_ProcessRunTokenObservations = __esmMin((() => {
695
+ errorMessage$1 = (cause) => cause instanceof Error ? cause.message : String(cause);
696
+ })))();
697
+ }
698
+
699
+ //#endregion
700
+ //#region dist/process/ProcessOwnershipObservation.js
701
+ var observeOwnedProcessGroups, observeOwnedProcessLineage, unavailableLineage, parseProcessEnvironment, parseLinuxProcessStartTime, isExpectedAbort, createSystemProcessOwnershipHost, systemProcessOwnershipHost, observeProcessStartIdentity, observeProcessStartIdentityExit, signalProcessWithStartIdentity, prepareProcessOwnershipInspection, processIsGone, errorMessage;
702
+ function init_ProcessOwnershipObservation() {
703
+ return (init_ProcessOwnershipObservation = __esmMin((() => {
704
+ init_analysisErrorCore();
705
+ init_ProcessOwnershipIdentity();
706
+ init_ProcessOwnershipProcessTree();
707
+ init_ExecFileOutput();
708
+ init_DarwinProcessRunTokenReader();
709
+ init_ProcessRunTokenObservations();
710
+ observeOwnedProcessGroups = async (runId, processGroupIds, host = systemProcessOwnershipHost, signal) => {
711
+ signal?.throwIfAborted();
712
+ const groupIds = [...new Set(processGroupIds)];
713
+ if (groupIds.length === 0) return new Map();
714
+ let processes;
715
+ try {
716
+ processes = liveProcesses(await host.listProcesses(signal));
717
+ } catch (cause) {
718
+ signal?.throwIfAborted();
719
+ const failure = {
720
+ state: "unverifiable",
721
+ reason: `process group could not be inspected: ${errorMessage(cause)}`
722
+ };
723
+ return new Map(groupIds.map((groupId) => [groupId, failure]));
724
+ }
725
+ signal?.throwIfAborted();
726
+ const membersByGroup = new Map(groupIds.map((groupId) => [groupId, []]));
727
+ for (const process of processes) membersByGroup.get(process.processGroupId)?.push(process);
728
+ const observations = new Map(groupIds.map((groupId) => [groupId, (membersByGroup.get(groupId)?.length ?? 0) > 0 ? { state: "alive" } : { state: "empty" }]));
729
+ const liveMembers = groupIds.flatMap((groupId) => membersByGroup.get(groupId) ?? []);
730
+ const pendingGroups = new Set(groupIds.filter((groupId) => (membersByGroup.get(groupId)?.length ?? 0) > 0));
731
+ for await (const { process: member, observation } of readProcessRunTokens(host, liveMembers, signal)) {
732
+ if (!pendingGroups.has(member.processGroupId)) continue;
733
+ if (observation.state === "readable") {
734
+ if (observation.runId !== runId) {
735
+ observations.set(member.processGroupId, {
736
+ state: "unverifiable",
737
+ reason: "process ownership did not match"
738
+ });
739
+ pendingGroups.delete(member.processGroupId);
740
+ }
741
+ } else {
742
+ const gone = await processIsGone(host, member.pid);
743
+ signal?.throwIfAborted();
744
+ if (!gone) {
745
+ observations.set(member.processGroupId, {
746
+ state: "unverifiable",
747
+ reason: `process ownership could not be revalidated for PID ${member.pid}: ${observation.reason}`
748
+ });
749
+ pendingGroups.delete(member.processGroupId);
750
+ }
751
+ }
752
+ if (pendingGroups.size === 0) break;
753
+ }
754
+ signal?.throwIfAborted();
755
+ return observations;
756
+ };
757
+ observeOwnedProcessLineage = async (ownership, host = systemProcessOwnershipHost) => {
758
+ let processes;
759
+ try {
760
+ processes = liveProcesses(await host.listProcesses());
761
+ } catch (cause) {
762
+ return unavailableLineage(ownership, `process table could not be inspected: ${errorMessage(cause)}`);
763
+ }
764
+ const launcher = processes.find(({ pid }) => pid === ownership.leaderPid);
765
+ if (launcher === undefined) return unavailableLineage(ownership, "owned launcher is not live");
766
+ const identityFailure = launcherIdentityFailure(launcher, ownership);
767
+ if (identityFailure !== null) return unavailableLineage(ownership, identityFailure);
768
+ const descendants = descendantsOf([launcher.pid], processes);
769
+ const verifiedDescendants = [];
770
+ for await (const { process: member, observation } of readProcessRunTokens(host, [launcher, ...descendants])) {
771
+ if (observation.state === "readable") {
772
+ if (observation.runId !== ownership.runId) return unavailableLineage(ownership, "process lineage contains an unowned or PID-reused process");
773
+ if (member.pid !== launcher.pid) verifiedDescendants.push(member);
774
+ } else {
775
+ if (await processIsGone(host, member.pid)) {
776
+ if (member.pid === launcher.pid) return unavailableLineage(ownership, "owned launcher exited during lineage validation");
777
+ continue;
778
+ }
779
+ return unavailableLineage(ownership, `process ownership could not be revalidated for PID ${member.pid}: ${observation.reason}`);
780
+ }
781
+ }
782
+ return {
783
+ status: "verified",
784
+ observedAt: new Date().toISOString(),
785
+ lineage: {
786
+ runId: ownership.runId,
787
+ launcherPid: launcher.pid,
788
+ launcherParentPid: launcher.parentPid,
789
+ processGroupId: launcher.processGroupId,
790
+ descendants: verifiedDescendants.sort((left, right) => left.pid - right.pid).map(({ pid, parentPid, processGroupId }) => ({
791
+ pid,
792
+ parentPid,
793
+ processGroupId
794
+ }))
795
+ }
796
+ };
797
+ };
798
+ unavailableLineage = (ownership, reason) => ({
799
+ status: "unavailable",
800
+ observedAt: new Date().toISOString(),
801
+ runId: ownership.runId,
802
+ launcherPid: ownership.leaderPid,
803
+ processGroupId: ownership.processGroupId,
804
+ reason
805
+ });
806
+ parseProcessEnvironment = (value) => Object.fromEntries(value.split("\0").filter((entry) => entry.indexOf("=") > 0).map((entry) => {
807
+ const separator = entry.indexOf("=");
808
+ return [entry.slice(0, separator), entry.slice(separator + 1)];
809
+ }));
810
+ parseLinuxProcessStartTime = (value) => {
811
+ const commandEnd = value.lastIndexOf(")");
812
+ if (commandEnd < 0) return undefined;
813
+ const fields = value.slice(commandEnd + 1).trim().split(/\s+/u);
814
+ const startTime = fields[19];
815
+ return startTime !== undefined && /^\d+$/u.test(startTime) ? startTime : undefined;
816
+ };
817
+ isExpectedAbort = (cause, signal) => signal?.aborted === true && (cause === signal.reason || cause instanceof Error && cause.name === "AbortError");
818
+ createSystemProcessOwnershipHost = (platform = process.platform, hostEnvironment = process.env, options = {}) => {
819
+ const darwinModuleCachePath = options.darwinModuleCachePath ?? hostEnvironment.REA_DARWIN_MODULE_CACHE_PATH;
820
+ const swiftcPath = hostEnvironment.REA_DARWIN_SWIFTC_PATH;
821
+ const darwinCompiler = options.darwinCompiler ?? (swiftcPath === undefined || swiftcPath === "" ? undefined : {
822
+ kind: "swiftc",
823
+ executable: swiftcPath,
824
+ sdkRoot: hostEnvironment.SDKROOT ?? ""
825
+ });
826
+ const darwinTokens = platform === "darwin" ? createDarwinProcessRunTokenReader({
827
+ ...darwinCompiler === undefined ? {} : { compiler: darwinCompiler },
828
+ ...darwinModuleCachePath === undefined ? {} : { moduleCachePath: darwinModuleCachePath },
829
+ ...options.compileTimeoutMs === undefined ? { environment: hostEnvironment } : { compileTimeoutMs: options.compileTimeoutMs }
830
+ }) : undefined;
831
+ const listProcesses = async (signal) => {
832
+ if (platform === "win32") return [];
833
+ const { stdout } = await execFileOutput("ps", ["-axo", "pid=,ppid=,pgid=,uid=,stat=,command="], {
834
+ env: hostEnvironment,
835
+ ...signal === undefined ? {} : { signal }
836
+ });
837
+ return stdout.split("\n").map((line) => /\s*(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\S+)\s+(.*)/u.exec(line)).filter((match) => match !== null).map((match) => ({
838
+ pid: Number(match[1]),
839
+ parentPid: Number(match[2]),
840
+ processGroupId: Number(match[3]),
841
+ uid: Number(match[4]),
842
+ state: match[5] ?? "",
843
+ command: match[6] ?? ""
844
+ }));
845
+ };
846
+ const processIdentities = async (processes, signal) => {
847
+ if (processes.length === 0) return new Map();
848
+ if (platform === "linux") return new Map(await Promise.all(processes.map(async ({ pid }) => {
849
+ try {
850
+ const stat = await readFile(`/proc/${String(pid)}/stat`, {
851
+ encoding: "utf8",
852
+ ...signal === undefined ? {} : { signal }
853
+ });
854
+ const identity = parseLinuxProcessStartTime(stat);
855
+ return [pid, identity === undefined ? {
856
+ state: "unavailable",
857
+ reason: "malformed_proc_stat"
858
+ } : {
859
+ state: "readable",
860
+ identity: `linux-starttime:${identity}`
861
+ }];
862
+ } catch (cause) {
863
+ if (isExpectedAbort(cause, signal)) throw cause;
864
+ return [pid, {
865
+ state: "unavailable",
866
+ reason: errorMessage(cause)
867
+ }];
868
+ }
869
+ })));
870
+ if (darwinTokens === undefined) return new Map();
871
+ try {
872
+ return await darwinTokens.identities(processes, signal);
873
+ } catch (cause) {
874
+ if (isExpectedAbort(cause, signal)) throw cause;
875
+ const reason = errorMessage(cause);
876
+ return new Map(processes.map(({ pid }) => [pid, {
877
+ state: "unavailable",
878
+ reason
879
+ }]));
880
+ }
881
+ };
882
+ const captureBaseline = async (signal) => {
883
+ if (platform !== "linux" && darwinTokens === undefined) return [];
884
+ const processes = liveProcesses(await listProcesses(signal));
885
+ let identities = await processIdentities(processes, signal);
886
+ const unreadable = processes.filter(({ pid }) => identities.get(pid)?.state !== "readable");
887
+ if (unreadable.length > 0) {
888
+ const stillLive = liveProcesses(await listProcesses(signal)).filter(({ pid }) => unreadable.some((entry) => entry.pid === pid));
889
+ const retried = await processIdentities(stillLive, signal);
890
+ identities = new Map([...identities, ...retried]);
891
+ const unresolved = stillLive.filter(({ pid }) => identities.get(pid)?.state !== "readable");
892
+ const liveAfterRetry = liveProcesses(await listProcesses(signal));
893
+ const stillUnresolved = unresolved.filter(({ pid }) => liveAfterRetry.some((entry) => entry.pid === pid));
894
+ if (stillUnresolved.length > 0) throw new Error(`process identity snapshot is unavailable for ${String(stillUnresolved.length)} live processes`);
895
+ }
896
+ return processes.map(({ pid }) => {
897
+ const observation = identities.get(pid);
898
+ return {
899
+ pid,
900
+ identity: observation?.state === "readable" ? observation.identity : null
901
+ };
902
+ });
903
+ };
904
+ return {
905
+ platform,
906
+ prepare: async (signal) => {
907
+ await darwinTokens?.prepare(signal);
908
+ if (platform === "linux") {
909
+ try {
910
+ const processes = await listProcesses(signal);
911
+ if (!processes.some(({ pid }) => pid === process.pid)) throw new Error("ps did not report REA's current process");
912
+ } catch (cause) {
913
+ if (isExpectedAbort(cause, signal)) throw cause;
914
+ const reason = `Linux process ownership inspection requires a procps-compatible ps on REA's PATH before launching a child: ${errorMessage(cause)}`;
915
+ throw new AnalysisCapabilityUnavailableError("process-ownership", "prepare_owned_process", reason, {
916
+ cause,
917
+ userMessage: reason
918
+ });
919
+ }
920
+ }
921
+ },
922
+ listProcesses,
923
+ async environment(pid, signal) {
924
+ signal?.throwIfAborted();
925
+ if (platform === "linux") return parseProcessEnvironment(await readFile(`/proc/${pid}/environ`, {
926
+ encoding: "utf8",
927
+ signal
928
+ }));
929
+ if (platform === "darwin") {
930
+ const process = (await listProcesses(signal)).find((entry) => entry.pid === pid);
931
+ if (process === undefined) throw new Error(`process ${String(pid)} is not live`);
932
+ const observation = (await darwinTokens?.read([process], signal))?.get(pid);
933
+ if (observation === undefined || observation.state === "unavailable") throw new Error(observation?.reason ?? "process run token could not be read");
934
+ return observation.runId === undefined ? {} : { REA_PROCESS_RUN_ID: observation.runId };
935
+ }
936
+ const { stdout } = await execFileOutput("ps", [
937
+ "eww",
938
+ "-p",
939
+ String(pid)
940
+ ], {
941
+ env: hostEnvironment,
942
+ ...signal === undefined ? {} : { signal }
943
+ });
944
+ const observedEnvironment = {};
945
+ for (const match of stdout.matchAll(/(?:^|\s)([A-Za-z_][A-Za-z0-9_]*)=([^\s]*)/gu)) {
946
+ const name = match[1];
947
+ if (name !== undefined) observedEnvironment[name] = match[2] ?? "";
948
+ }
949
+ return observedEnvironment;
950
+ },
951
+ async runTokens(processes, signal) {
952
+ signal?.throwIfAborted();
953
+ if (platform !== "darwin" || processes.length === 0) return new Map();
954
+ try {
955
+ return await darwinTokens?.read(processes, signal) ?? new Map();
956
+ } catch (cause) {
957
+ if (isExpectedAbort(cause, signal)) throw cause;
958
+ void cause;
959
+ return new Map(processes.map(({ pid }) => [pid, {
960
+ state: "unavailable",
961
+ reason: "reader_failure"
962
+ }]));
963
+ }
964
+ },
965
+ ...platform !== "linux" && darwinTokens === undefined ? {} : {
966
+ processIdentities,
967
+ captureBaseline,
968
+ ...darwinTokens === undefined ? {} : { close: darwinTokens.close }
969
+ },
970
+ signalGroup(processGroupId, signal) {
971
+ process.kill(-processGroupId, signal);
972
+ }
973
+ };
974
+ };
975
+ systemProcessOwnershipHost = createSystemProcessOwnershipHost();
976
+ observeProcessStartIdentity = async (pid, host = systemProcessOwnershipHost, expectedRunId) => {
977
+ const process = (await host.listProcesses()).find((entry) => entry.pid === pid);
978
+ if (process === undefined || liveProcesses([process]).length === 0) return undefined;
979
+ if (host.processIdentities === undefined) return {
980
+ state: "unavailable",
981
+ reason: "process identity is unsupported"
982
+ };
983
+ const identity = (await host.processIdentities([process])).get(pid) ?? {
984
+ state: "unavailable",
985
+ reason: "process identity was not returned"
986
+ };
987
+ if (expectedRunId === undefined || identity.state !== "readable") return identity;
988
+ let owned = false;
989
+ for await (const { observation } of readProcessRunTokens(host, [process])) {
990
+ if (observation.state === "unavailable") return {
991
+ state: "unavailable",
992
+ reason: `process ownership token could not be read for PID ${String(pid)}: ${observation.reason}`
993
+ };
994
+ if (observation.runId !== expectedRunId) return {
995
+ state: "unavailable",
996
+ reason: `process ownership token did not match the captured run for PID ${String(pid)}`
997
+ };
998
+ owned = true;
999
+ }
1000
+ if (!owned) return {
1001
+ state: "unavailable",
1002
+ reason: `process ownership token was not returned for PID ${String(pid)}`
1003
+ };
1004
+ const confirmed = await observeProcessStartIdentity(pid, host);
1005
+ if (confirmed === undefined || confirmed.state !== "readable") return confirmed;
1006
+ return confirmed.identity === identity.identity ? identity : {
1007
+ state: "unavailable",
1008
+ reason: `process identity changed while validating the captured run token for PID ${String(pid)}`
1009
+ };
1010
+ };
1011
+ observeProcessStartIdentityExit = async (pid, expectedIdentity, host = systemProcessOwnershipHost) => {
1012
+ try {
1013
+ const observed = await observeProcessStartIdentity(pid, host);
1014
+ if (observed === undefined) return "exited";
1015
+ if (observed.state !== "readable") return "unverified";
1016
+ return observed.identity === expectedIdentity ? "present" : "exited";
1017
+ } catch {
1018
+ return "unverified";
1019
+ }
1020
+ };
1021
+ signalProcessWithStartIdentity = async (pid, expectedIdentity, signal, options = {}) => {
1022
+ const host = options.host ?? systemProcessOwnershipHost;
1023
+ try {
1024
+ const observed = await observeProcessStartIdentity(pid, host);
1025
+ if (observed === undefined) return "gone";
1026
+ if (observed.state !== "readable") return "unverified";
1027
+ if (observed.identity !== expectedIdentity) return "identity-changed";
1028
+ (options.sendSignal ?? process.kill)(pid, signal);
1029
+ return "signaled";
1030
+ } catch {
1031
+ return "unverified";
1032
+ }
1033
+ };
1034
+ prepareProcessOwnershipInspection = async (signal) => {
1035
+ await systemProcessOwnershipHost.prepare?.(signal);
1036
+ };
1037
+ processIsGone = async (host, pid) => {
1038
+ try {
1039
+ return !liveProcesses(await host.listProcesses()).some((process) => process.pid === pid);
1040
+ } catch (cause) {
1041
+ void cause;
1042
+ return false;
1043
+ }
1044
+ };
1045
+ errorMessage = (cause) => cause instanceof Error ? cause.message : String(cause);
1046
+ })))();
1047
+ }
1048
+
1049
+ //#endregion
1050
+ //#region dist/process/ProcessOwnership.js
1051
+ var execFileAsync, cleanupWindowsProcessTree, systemWindowsProcessTreeHost, readProcessRunId, withUnverifiedObservations, cleanupOwnedProcessGroup, verifyNoTokenOwnedProcesses, readLiveProcessTable, settleLauncherExit, createOwnedCleanupPlan, mergeProcessOwnershipFailure, ownershipFailurePriority, revalidateOwnedProcessGroup, cleanupValidationFailure, sanitizedTokenReadFailure, processOwnershipFailures, processRunTokenFailures, recheckOwnershipFailures, TOKEN_READ_RETRY_ATTEMPTS, TOKEN_READ_RETRY_DELAY_MS, PLATFORM_BINARY_ENVIRONMENT_WITHHELD, RESTRICTED_PROCESS_ENVIRONMENT_WITHHELD, currentProcessUid, environmentWithheldFromInspection, scanTokenOwnedProcesses, settleUnreadableTokenCandidates;
1052
+ function init_ProcessOwnership() {
1053
+ return (init_ProcessOwnership = __esmMin((() => {
1054
+ init_ProcessOwnershipObservation();
1055
+ init_ProcessOwnershipIdentity();
1056
+ init_ProcessOwnershipProcessTree();
1057
+ init_ProcessRunTokenObservations();
1058
+ init_unicodeCodePointOrder();
1059
+ execFileAsync = promisify(execFile);
1060
+ cleanupWindowsProcessTree = async (rootPid, host = systemWindowsProcessTreeHost) => {
1061
+ if (!Number.isSafeInteger(rootPid) || rootPid <= 0) return {
1062
+ cleaned: false,
1063
+ reason: "Windows process-tree PID is invalid"
1064
+ };
1065
+ try {
1066
+ const result = await host.terminateTree(rootPid);
1067
+ return {
1068
+ cleaned: true,
1069
+ signaled: result === "terminated"
1070
+ };
1071
+ } catch (cause) {
1072
+ return {
1073
+ cleaned: false,
1074
+ reason: `Windows process-tree termination failed for PID ${String(rootPid)}: ${errorMessage(cause)}`
1075
+ };
1076
+ }
1077
+ };
1078
+ systemWindowsProcessTreeHost = { async terminateTree(rootPid) {
1079
+ try {
1080
+ await execFileAsync("taskkill.exe", [
1081
+ "/pid",
1082
+ String(rootPid),
1083
+ "/t",
1084
+ "/f"
1085
+ ], {
1086
+ windowsHide: true,
1087
+ timeout: 5e3
1088
+ });
1089
+ return "terminated";
1090
+ } catch (cause) {
1091
+ if (cause instanceof Error && "code" in cause && (cause.code === 128 || cause.code === "ESRCH")) return "missing";
1092
+ throw cause;
1093
+ }
1094
+ } };
1095
+ readProcessRunId = async (pid, host = systemProcessOwnershipHost, signal) => (await host.environment(pid, signal)).REA_PROCESS_RUN_ID;
1096
+ withUnverifiedObservations = (result, unverified) => unverified.length === 0 || (result.unverified?.length ?? 0) > 0 ? result : {
1097
+ ...result,
1098
+ unverified
1099
+ };
1100
+ cleanupOwnedProcessGroup = async (ownership, host = systemProcessOwnershipHost) => {
1101
+ const processTable = await readLiveProcessTable(host);
1102
+ if (!processTable.available) return {
1103
+ cleaned: false,
1104
+ reason: `process table could not be inspected: ${processTable.reason}`
1105
+ };
1106
+ const plan = await createOwnedCleanupPlan(ownership, processTable.processes, host);
1107
+ if ("cleaned" in plan) return plan;
1108
+ let signaled = false;
1109
+ for (const processGroupId of plan.signalOrder) {
1110
+ const revalidation = await revalidateOwnedProcessGroup(processGroupId, ownership, host, plan.tokenOwnedIdentities);
1111
+ if ("cleaned" in revalidation) {
1112
+ if (!revalidation.cleaned) return withUnverifiedObservations(revalidation, plan.unverified);
1113
+ return {
1114
+ ...revalidation,
1115
+ ...revalidation.unverified?.length || plan.unverified.length === 0 ? {} : { unverified: plan.unverified }
1116
+ };
1117
+ }
1118
+ if (revalidation.empty) continue;
1119
+ try {
1120
+ host.signalGroup(processGroupId, "SIGKILL");
1121
+ signaled = true;
1122
+ } catch (cause) {
1123
+ const code = cause instanceof Error && "code" in cause ? cause.code : undefined;
1124
+ if (code !== "ESRCH") return withUnverifiedObservations({
1125
+ cleaned: false,
1126
+ reason: `owned process group signal failed: ${errorMessage(cause)}`
1127
+ }, plan.unverified);
1128
+ }
1129
+ }
1130
+ if (plan.unresolved.length > 0) return cleanupValidationFailure(plan.unresolved, plan.unverified);
1131
+ return {
1132
+ cleaned: true,
1133
+ signaled,
1134
+ ...plan.unverified.length === 0 ? {} : { unverified: plan.unverified }
1135
+ };
1136
+ };
1137
+ verifyNoTokenOwnedProcesses = async (runId, host = systemProcessOwnershipHost, captureBaseline, relation) => {
1138
+ const processTable = await readLiveProcessTable(host);
1139
+ if (!processTable.available) return {
1140
+ cleaned: false,
1141
+ reason: `process table could not be inspected: ${processTable.reason}`
1142
+ };
1143
+ const scan = await scanTokenOwnedProcesses(processTable.processes, runId, host, captureBaseline, relation);
1144
+ if (scan.failures.length > 0) return cleanupValidationFailure(scan.failures, scan.unverified);
1145
+ if (scan.owned.length > 0) return {
1146
+ cleaned: false,
1147
+ reason: "token-owned process remained after cleanup",
1148
+ ...scan.unverified.length === 0 ? {} : { unverified: scan.unverified }
1149
+ };
1150
+ return {
1151
+ cleaned: true,
1152
+ signaled: false,
1153
+ ...scan.unverified.length === 0 ? {} : { unverified: scan.unverified }
1154
+ };
1155
+ };
1156
+ readLiveProcessTable = async (host) => {
1157
+ try {
1158
+ return {
1159
+ available: true,
1160
+ processes: liveProcesses(await host.listProcesses())
1161
+ };
1162
+ } catch (cause) {
1163
+ return {
1164
+ available: false,
1165
+ reason: errorMessage(cause)
1166
+ };
1167
+ }
1168
+ };
1169
+ settleLauncherExit = async (ownership, processes, host) => {
1170
+ const launcher = processes.find(({ pid }) => pid === ownership.leaderPid);
1171
+ if (launcher === undefined) return processes;
1172
+ const reason = launcherIdentityFailure(launcher, ownership);
1173
+ if (reason === null) return processes;
1174
+ const refreshed = await readLiveProcessTable(host);
1175
+ if (refreshed.available && !refreshed.processes.some(({ pid }) => pid === launcher.pid)) {
1176
+ const descendants = descendantsOf([launcher.pid], processes);
1177
+ const descendantPids = new Set(descendants.map(({ pid }) => pid));
1178
+ const descendantGroupIds = new Set(descendants.map(({ processGroupId }) => processGroupId));
1179
+ const refreshedDescendantPids = new Set(descendantsOf(descendants.map(({ pid }) => pid), refreshed.processes).map(({ pid }) => pid));
1180
+ if (refreshed.processes.some((process) => process.processGroupId !== ownership.processGroupId && (refreshedDescendantPids.has(process.pid) || descendantPids.has(process.pid) || descendantGroupIds.has(process.processGroupId)))) return {
1181
+ cleaned: false,
1182
+ reason
1183
+ };
1184
+ return refreshed.processes;
1185
+ }
1186
+ return {
1187
+ cleaned: false,
1188
+ reason
1189
+ };
1190
+ };
1191
+ createOwnedCleanupPlan = async (ownership, initialProcesses, host) => {
1192
+ const processes = await settleLauncherExit(ownership, initialProcesses, host);
1193
+ if ("cleaned" in processes) return processes;
1194
+ const sampledProcessGroupIds = new Set((ownership.sampledProcessGroupIds ?? []).filter((processGroupId) => Number.isSafeInteger(processGroupId) && processGroupId > 0));
1195
+ const tokenOwned = ownership.sweepTokenOwnedProcesses === true ? await scanTokenOwnedProcesses(processes, ownership.runId, host, ownership.captureBaseline, {
1196
+ leaderPid: ownership.leaderPid,
1197
+ processGroupId: ownership.processGroupId,
1198
+ ...sampledProcessGroupIds.size === 0 ? {} : { sampledProcessGroupIds: [...sampledProcessGroupIds] }
1199
+ }) : {
1200
+ owned: [],
1201
+ failures: [],
1202
+ unverified: [],
1203
+ identities: new Map()
1204
+ };
1205
+ const tokenOwnedGroupIds = new Set(tokenOwned.owned.map(({ processGroupId }) => processGroupId));
1206
+ const launcher = processes.find(({ pid }) => pid === ownership.leaderPid);
1207
+ const rootMembers = processes.filter(({ processGroupId }) => processGroupId === ownership.processGroupId);
1208
+ if (launcher === undefined && rootMembers.length === 0 && tokenOwned.owned.length === 0 && !processes.some(({ processGroupId }) => sampledProcessGroupIds.has(processGroupId))) return tokenOwned.failures.length > 0 ? {
1209
+ signalOrder: [],
1210
+ tokenOwnedIdentities: tokenOwned.identities,
1211
+ unresolved: tokenOwned.failures,
1212
+ unverified: tokenOwned.unverified
1213
+ } : {
1214
+ cleaned: true,
1215
+ signaled: false,
1216
+ ...tokenOwned.unverified.length === 0 ? {} : { unverified: tokenOwned.unverified }
1217
+ };
1218
+ let descendants = [];
1219
+ if (launcher !== undefined) {
1220
+ descendants = descendantsOf([launcher.pid], processes);
1221
+ }
1222
+ const descendantPids = new Set(descendants.map(({ pid }) => pid));
1223
+ const processGroupIds = new Set([ownership.processGroupId]);
1224
+ for (const descendant of descendants) processGroupIds.add(descendant.processGroupId);
1225
+ for (const process of tokenOwned.owned) processGroupIds.add(process.processGroupId);
1226
+ for (const processGroupId of sampledProcessGroupIds) processGroupIds.add(processGroupId);
1227
+ const signalableGroups = new Set();
1228
+ const unresolved = [...tokenOwned.failures];
1229
+ const unverifiableSampledGroups = new Set();
1230
+ for (const processGroupId of processGroupIds) {
1231
+ if (processGroupId === ownership.processGroupId) continue;
1232
+ const groupLeader = processes.find(({ pid, processGroupId: observedGroupId }) => pid === processGroupId && observedGroupId === processGroupId);
1233
+ if ((groupLeader === undefined || !descendantPids.has(groupLeader.pid)) && !tokenOwnedGroupIds.has(processGroupId) && !sampledProcessGroupIds.has(processGroupId)) return {
1234
+ cleaned: false,
1235
+ reason: "descendant process-group leader identity could not be verified"
1236
+ };
1237
+ if ((groupLeader === undefined || !descendantPids.has(groupLeader.pid)) && !tokenOwnedGroupIds.has(processGroupId)) unverifiableSampledGroups.add(processGroupId);
1238
+ }
1239
+ const liveMembers = processes.filter(({ processGroupId }) => processGroupIds.has(processGroupId));
1240
+ for (const processGroupId of processGroupIds) {
1241
+ const members = liveMembers.filter(({ processGroupId: observedGroupId }) => observedGroupId === processGroupId);
1242
+ if (members.length === 0) continue;
1243
+ const failures = await processOwnershipFailures(members, ownership.runId, host, tokenOwned.identities);
1244
+ if (failures.length === 0 && unverifiableSampledGroups.has(processGroupId)) unresolved.push(...members.map(({ pid }) => ({
1245
+ pid,
1246
+ reason: "process-identity-unavailable",
1247
+ diagnostic: "sampled process-group leader identity could not be verified"
1248
+ })));
1249
+ const scanFailures = tokenOwned.failures.filter(({ pid }) => members.some((member) => member.pid === pid));
1250
+ for (const failure of failures) mergeProcessOwnershipFailure(unresolved, failure);
1251
+ if (failures.length === 0 && scanFailures.length === 0 && !unverifiableSampledGroups.has(processGroupId)) signalableGroups.add(processGroupId);
1252
+ }
1253
+ if (ownership.sweepTokenOwnedProcesses !== true && unresolved.length > 0) return cleanupValidationFailure(unresolved, tokenOwned.unverified);
1254
+ return {
1255
+ signalOrder: [...signalableGroups].filter((groupId) => processGroupIds.has(groupId)).sort((left, right) => left === ownership.processGroupId ? -1 : right === ownership.processGroupId ? 1 : left - right),
1256
+ tokenOwnedIdentities: tokenOwned.identities,
1257
+ unresolved,
1258
+ unverified: tokenOwned.unverified
1259
+ };
1260
+ };
1261
+ mergeProcessOwnershipFailure = (failures, next) => {
1262
+ const index = failures.findIndex(({ pid }) => pid === next.pid);
1263
+ if (index < 0) {
1264
+ failures.push(next);
1265
+ return;
1266
+ }
1267
+ const previous = failures[index];
1268
+ if (previous !== undefined && ownershipFailurePriority(next.reason) >= ownershipFailurePriority(previous.reason)) failures[index] = next;
1269
+ };
1270
+ ownershipFailurePriority = (reason) => reason === "run-token-mismatch" ? 3 : reason === "process-identity-unavailable" ? 2 : reason === "environment-unreadable" ? 1 : 0;
1271
+ revalidateOwnedProcessGroup = async (processGroupId, ownership, host, expectedIdentities) => {
1272
+ let members;
1273
+ try {
1274
+ const processes = await settleLauncherExit(ownership, liveProcesses(await host.listProcesses()), host);
1275
+ if ("cleaned" in processes) return processes;
1276
+ members = processes.filter(({ processGroupId: observedGroupId }) => observedGroupId === processGroupId);
1277
+ } catch (cause) {
1278
+ return {
1279
+ cleaned: false,
1280
+ reason: `process ownership could not be revalidated: ${errorMessage(cause)}`
1281
+ };
1282
+ }
1283
+ const failures = await processOwnershipFailures(members, ownership.runId, host, expectedIdentities);
1284
+ if (failures.length > 0) return cleanupValidationFailure(failures);
1285
+ if (processGroupId !== ownership.processGroupId && members.length > 0 && !members.some(({ pid }) => pid === processGroupId) && ownership.sweepTokenOwnedProcesses !== true) return {
1286
+ cleaned: false,
1287
+ reason: "descendant process-group leader identity could not be revalidated"
1288
+ };
1289
+ return { empty: members.length === 0 };
1290
+ };
1291
+ cleanupValidationFailure = (failures, unverified = []) => {
1292
+ const unverifiedEntry = unverified.length === 0 ? {} : { unverified };
1293
+ const unreadable = failures.filter(({ reason }) => reason === "environment-unreadable");
1294
+ if (failures.some(({ reason }) => reason === "run-token-mismatch")) return {
1295
+ cleaned: false,
1296
+ reason: `process ownership token mismatch for PID(s): ${[...new Set(failures.filter(({ reason }) => reason === "run-token-mismatch").map(({ pid }) => pid))].sort((left, right) => left - right).join(", ")}`,
1297
+ failures,
1298
+ ...unverifiedEntry
1299
+ };
1300
+ if (failures.some(({ reason }) => reason === "process-identity-unavailable")) return {
1301
+ cleaned: false,
1302
+ reason: "process identity could not be revalidated",
1303
+ failures,
1304
+ ...unverifiedEntry
1305
+ };
1306
+ if (unreadable.length > 0) {
1307
+ const counts = new Map();
1308
+ for (const { diagnostic } of unreadable) {
1309
+ const category = sanitizedTokenReadFailure(diagnostic);
1310
+ counts.set(category, (counts.get(category) ?? 0) + 1);
1311
+ }
1312
+ const breakdown = [...counts].sort(([left], [right]) => compareUnicodeCodePoints(left, right)).map(([category, count]) => `${category}=${String(count)}`).join(", ");
1313
+ const candidates = unreadable.map(({ pid, diagnostic }) => `${String(pid)}=${sanitizedTokenReadFailure(diagnostic)}`).sort((left, right) => compareUnicodeCodePoints(left, right));
1314
+ return {
1315
+ cleaned: false,
1316
+ reason: `process ownership token could not be read for ${String(unreadable.length)} live process(es): ${breakdown}; live candidates ${candidates.join(", ")}`,
1317
+ failures,
1318
+ ...unverifiedEntry
1319
+ };
1320
+ }
1321
+ return {
1322
+ cleaned: false,
1323
+ reason: "process ownership could not be revalidated",
1324
+ failures,
1325
+ ...unverifiedEntry
1326
+ };
1327
+ };
1328
+ sanitizedTokenReadFailure = (diagnostic) => {
1329
+ if (diagnostic === "environment_unavailable") return diagnostic;
1330
+ if (diagnostic === "platform_binary_environment_withheld") return diagnostic;
1331
+ if (diagnostic === "restricted_process_environment_withheld") return diagnostic;
1332
+ const environmentErrno = /^(EACCES|EPERM|ENOENT|ESRCH):/u.exec(diagnostic ?? "");
1333
+ if (environmentErrno?.[1] !== undefined) return `environment_errno_${environmentErrno[1]}`;
1334
+ if (diagnostic === "apple_vector_unavailable") return diagnostic;
1335
+ if (diagnostic === "ambiguous_environment_boundary") return diagnostic;
1336
+ if (diagnostic === "malformed_procargs") return diagnostic;
1337
+ if (diagnostic === "process_identity_changed_during_token_read") return diagnostic;
1338
+ if (diagnostic === "process_not_in_snapshot") return diagnostic;
1339
+ const processTableFailure = /^process_table_failed_(\d+)$/u.exec(diagnostic ?? "");
1340
+ if (processTableFailure?.[1] !== undefined) return `process_table_errno_${processTableFailure[1]}`;
1341
+ const sysctlFailure = /^sysctl_failed_(\d+)$/u.exec(diagnostic ?? "");
1342
+ if (sysctlFailure?.[1] !== undefined) return `sysctl_errno_${sysctlFailure[1]}`;
1343
+ if (diagnostic === "reader_failure") return diagnostic;
1344
+ if (diagnostic === "duplicate_run_token") return diagnostic;
1345
+ if (diagnostic === "invalid_run_token_encoding") return diagnostic;
1346
+ return "other_unavailable";
1347
+ };
1348
+ processOwnershipFailures = async (members, runId, host, expectedIdentities = new Map()) => {
1349
+ const failures = [];
1350
+ if (expectedIdentities.size > 0 && host.processIdentities !== undefined) {
1351
+ const expectedMembers = members.filter(({ pid }) => expectedIdentities.has(pid));
1352
+ const observed = await host.processIdentities(expectedMembers);
1353
+ const identityFailures = [];
1354
+ for (const member of expectedMembers) {
1355
+ const expected = expectedIdentities.get(member.pid);
1356
+ const current = observed.get(member.pid);
1357
+ if (expected === null || current?.state !== "readable" || current.identity !== expected) {
1358
+ identityFailures.push({
1359
+ pid: member.pid,
1360
+ reason: "process-identity-unavailable",
1361
+ diagnostic: "process identity changed or became unavailable before signal"
1362
+ });
1363
+ }
1364
+ }
1365
+ failures.push(...await recheckOwnershipFailures(identityFailures, host));
1366
+ }
1367
+ failures.push(...await processRunTokenFailures(members, runId, host));
1368
+ if (failures.length === 0 && expectedIdentities.size > 0 && host.processIdentities !== undefined) {
1369
+ const expectedMembers = members.filter(({ pid }) => expectedIdentities.has(pid));
1370
+ const observed = await host.processIdentities(expectedMembers);
1371
+ const identityFailures = [];
1372
+ for (const member of expectedMembers) {
1373
+ const expected = expectedIdentities.get(member.pid);
1374
+ const current = observed.get(member.pid);
1375
+ if (expected !== null && current?.state === "readable" && current.identity === expected) continue;
1376
+ identityFailures.push({
1377
+ pid: member.pid,
1378
+ reason: "process-identity-unavailable",
1379
+ diagnostic: "process identity changed or became unavailable during token validation"
1380
+ });
1381
+ }
1382
+ failures.push(...await recheckOwnershipFailures(identityFailures, host));
1383
+ }
1384
+ return failures;
1385
+ };
1386
+ processRunTokenFailures = async (members, runId, host) => {
1387
+ const failures = [];
1388
+ for await (const { process: member, observation } of readProcessRunTokens(host, members)) {
1389
+ if (observation.state === "readable") {
1390
+ if (observation.runId !== runId) failures.push({
1391
+ pid: member.pid,
1392
+ reason: "run-token-mismatch"
1393
+ });
1394
+ continue;
1395
+ }
1396
+ failures.push({
1397
+ pid: member.pid,
1398
+ reason: "environment-unreadable",
1399
+ diagnostic: observation.reason
1400
+ });
1401
+ }
1402
+ return recheckOwnershipFailures(failures, host);
1403
+ };
1404
+ recheckOwnershipFailures = async (failures, host) => {
1405
+ if (!failures.some(({ reason }) => reason !== "run-token-mismatch")) return failures;
1406
+ try {
1407
+ let processes = await host.listProcesses();
1408
+ const isDarwin = (host.platform ?? process.platform) === "darwin";
1409
+ for (let attempt = 0; isDarwin && attempt < TOKEN_READ_RETRY_ATTEMPTS && processes.some(({ pid, state }) => failures.some((failure) => failure.pid === pid && failure.reason !== "run-token-mismatch") && state.slice(1).includes("E")); attempt += 1) {
1410
+ await new Promise((resolve) => setTimeout(resolve, TOKEN_READ_RETRY_DELAY_MS));
1411
+ processes = await host.listProcesses();
1412
+ }
1413
+ const live = new Set(liveProcesses(processes).map(({ pid }) => pid));
1414
+ return failures.filter(({ pid, reason }) => reason === "run-token-mismatch" || live.has(pid));
1415
+ } catch (cause) {
1416
+ return failures.map((failure) => failure.reason === "run-token-mismatch" ? failure : {
1417
+ ...failure,
1418
+ diagnostic: `${failure.diagnostic}; process liveness recheck failed: ${errorMessage(cause)}`
1419
+ });
1420
+ }
1421
+ };
1422
+ TOKEN_READ_RETRY_ATTEMPTS = 3;
1423
+ TOKEN_READ_RETRY_DELAY_MS = 40;
1424
+ PLATFORM_BINARY_ENVIRONMENT_WITHHELD = "platform_binary_environment_withheld";
1425
+ RESTRICTED_PROCESS_ENVIRONMENT_WITHHELD = "restricted_process_environment_withheld";
1426
+ currentProcessUid = () => typeof process.getuid === "function" ? process.getuid() : undefined;
1427
+ environmentWithheldFromInspection = (entry, diagnostic) => {
1428
+ const uid = currentProcessUid();
1429
+ if (uid !== undefined && entry.uid !== undefined && entry.uid !== uid) return true;
1430
+ return diagnostic === PLATFORM_BINARY_ENVIRONMENT_WITHHELD || diagnostic === RESTRICTED_PROCESS_ENVIRONMENT_WITHHELD;
1431
+ };
1432
+ scanTokenOwnedProcesses = async (processes, runId, host, captureBaseline, relation) => {
1433
+ let candidates = processes;
1434
+ let candidateIdentities = new Map();
1435
+ if (host.processIdentities !== undefined) {
1436
+ const current = await host.processIdentities(processes);
1437
+ candidateIdentities = current;
1438
+ if (captureBaseline !== undefined) {
1439
+ const baseline = new Map(captureBaseline.map(({ pid, identity }) => [pid, identity]));
1440
+ candidates = processes.filter((process) => {
1441
+ const before = baseline.get(process.pid);
1442
+ const now = current.get(process.pid);
1443
+ return !(before !== undefined && before !== null && now?.state === "readable" && now.identity === before);
1444
+ });
1445
+ }
1446
+ }
1447
+ const failures = [];
1448
+ if (captureBaseline !== undefined && host.processIdentities !== undefined) {
1449
+ const stableCandidates = [];
1450
+ const identityFailures = [];
1451
+ for (const process of candidates) {
1452
+ if (candidateIdentities.get(process.pid)?.state === "readable") {
1453
+ stableCandidates.push(process);
1454
+ continue;
1455
+ }
1456
+ identityFailures.push({
1457
+ pid: process.pid,
1458
+ reason: "process-identity-unavailable",
1459
+ diagnostic: "process identity was unavailable during token scan"
1460
+ });
1461
+ }
1462
+ failures.push(...await recheckOwnershipFailures(identityFailures, host));
1463
+ candidates = stableCandidates;
1464
+ }
1465
+ const owned = [];
1466
+ const ownedIdentities = new Map();
1467
+ const recordOwned = (process) => {
1468
+ owned.push(process);
1469
+ const identity = candidateIdentities.get(process.pid);
1470
+ ownedIdentities.set(process.pid, identity?.state === "readable" ? identity.identity : null);
1471
+ };
1472
+ const unreadable = [];
1473
+ for await (const { process, observation } of readProcessRunTokens(host, candidates)) {
1474
+ if (observation.state === "readable") {
1475
+ if (observation.runId === runId) recordOwned(process);
1476
+ } else unreadable.push({
1477
+ process,
1478
+ diagnostic: observation.reason
1479
+ });
1480
+ }
1481
+ const remaining = await settleUnreadableTokenCandidates(unreadable, runId, host, recordOwned);
1482
+ const relatedPids = new Set();
1483
+ const relatedGroupIds = new Set();
1484
+ if (relation !== undefined) {
1485
+ relatedPids.add(relation.leaderPid);
1486
+ for (const descendant of descendantsOf([relation.leaderPid], processes)) relatedPids.add(descendant.pid);
1487
+ relatedGroupIds.add(relation.processGroupId);
1488
+ for (const processGroupId of relation.sampledProcessGroupIds ?? []) if (Number.isSafeInteger(processGroupId) && processGroupId > 0) relatedGroupIds.add(processGroupId);
1489
+ for (const process of owned) relatedGroupIds.add(process.processGroupId);
1490
+ }
1491
+ const unverified = [];
1492
+ const strict = [];
1493
+ const withheld = [];
1494
+ for (const candidate of remaining) {
1495
+ const isRelated = relation === undefined || relatedPids.has(candidate.process.pid) || relatedGroupIds.has(candidate.process.processGroupId);
1496
+ if (!isRelated && environmentWithheldFromInspection(candidate.process, candidate.diagnostic)) {
1497
+ withheld.push(candidate);
1498
+ continue;
1499
+ }
1500
+ strict.push(candidate);
1501
+ }
1502
+ let finalLive;
1503
+ try {
1504
+ finalLive = new Set(liveProcesses(await host.listProcesses()).map(({ pid }) => pid));
1505
+ } catch (cause) {
1506
+ void cause;
1507
+ finalLive = undefined;
1508
+ }
1509
+ for (const candidate of strict) {
1510
+ if (finalLive !== undefined && !finalLive.has(candidate.process.pid)) continue;
1511
+ failures.push({
1512
+ pid: candidate.process.pid,
1513
+ reason: "environment-unreadable",
1514
+ diagnostic: candidate.diagnostic
1515
+ });
1516
+ }
1517
+ for (const candidate of withheld) {
1518
+ if (finalLive !== undefined && !finalLive.has(candidate.process.pid)) continue;
1519
+ unverified.push({
1520
+ pid: candidate.process.pid,
1521
+ diagnostic: candidate.diagnostic
1522
+ });
1523
+ }
1524
+ if (candidates.length > 0 && host.processIdentities !== undefined) {
1525
+ const afterRead = await host.processIdentities(candidates);
1526
+ const stillOwned = [];
1527
+ const identityFailures = [];
1528
+ const ownedPids = new Set(owned.map(({ pid }) => pid));
1529
+ for (const process of candidates) {
1530
+ const before = candidateIdentities.get(process.pid);
1531
+ const current = afterRead.get(process.pid);
1532
+ if (before?.state === "readable" && current?.state === "readable" && current.identity === before.identity) {
1533
+ if (ownedPids.has(process.pid)) stillOwned.push(process);
1534
+ continue;
1535
+ }
1536
+ identityFailures.push({
1537
+ pid: process.pid,
1538
+ reason: "process-identity-unavailable",
1539
+ diagnostic: "process identity changed or became unavailable during token validation"
1540
+ });
1541
+ }
1542
+ failures.push(...await recheckOwnershipFailures(identityFailures, host));
1543
+ return {
1544
+ owned: stillOwned,
1545
+ failures,
1546
+ unverified,
1547
+ identities: ownedIdentities
1548
+ };
1549
+ }
1550
+ return {
1551
+ owned,
1552
+ failures,
1553
+ unverified,
1554
+ identities: ownedIdentities
1555
+ };
1556
+ };
1557
+ settleUnreadableTokenCandidates = async (pending, runId, host, recordOwned) => {
1558
+ let remaining = pending;
1559
+ for (let attempt = 0; attempt < TOKEN_READ_RETRY_ATTEMPTS && remaining.length > 0; attempt += 1) {
1560
+ await new Promise((resolve) => setTimeout(resolve, TOKEN_READ_RETRY_DELAY_MS));
1561
+ let live;
1562
+ try {
1563
+ live = new Set(liveProcesses(await host.listProcesses()).map(({ pid }) => pid));
1564
+ } catch (cause) {
1565
+ void cause;
1566
+ live = undefined;
1567
+ }
1568
+ const stillUnreadable = [];
1569
+ const candidates = remaining.map(({ process }) => process).filter(({ pid }) => live === undefined || live.has(pid));
1570
+ for await (const { process, observation } of readProcessRunTokens(host, candidates)) {
1571
+ if (observation.state === "readable") {
1572
+ if (observation.runId === runId) recordOwned(process);
1573
+ continue;
1574
+ }
1575
+ stillUnreadable.push({
1576
+ process,
1577
+ diagnostic: observation.reason
1578
+ });
1579
+ }
1580
+ remaining = stillUnreadable;
1581
+ }
1582
+ return remaining;
1583
+ };
1584
+ })))();
1585
+ }
1586
+
1587
+ //#endregion
1588
+ //#region dist/artifacts/ArtifactFileOperation.js
1589
+ var ArtifactFileCleanupFailure, mapArtifactFileFailure, artifactFilePrimaryFailure, ArtifactFileCancelled, bindArtifactFileCleanup, artifactFileCancellationCause, assertArtifactReadActive, withArtifactRegularFile, withArtifactFileHandle, artifactOperationCause;
1590
+ function init_ArtifactFileOperation() {
1591
+ return (init_ArtifactFileOperation = __esmMin((() => {
1592
+ init_RegularFile();
1593
+ init_OwnedFileHandle();
1594
+ init_OwnedRegularFile();
1595
+ init_ArtifactReader();
1596
+ init_AnalysisCleanupLease();
1597
+ ArtifactFileCleanupFailure = class extends ArtifactReaderFailure {
1598
+ cleanupLease;
1599
+ cleanupLeases;
1600
+ fileCleanupFailure;
1601
+ constructor(fileCleanupFailure, cleanupLease) {
1602
+ const outcome = fileCleanupFailure.outcome;
1603
+ if (outcome.kind === "failed" && outcome.cause instanceof RegularFileOperationCancelled) fileCleanupFailure = new RegularFileCleanupFailure(fileCleanupFailure.path, fileCleanupFailure.owner, {
1604
+ kind: "failed",
1605
+ cause: artifactOperationCause(outcome.cause)
1606
+ }, fileCleanupFailure.cleanupCause, fileCleanupFailure.retention, fileCleanupFailure.completionCancellation);
1607
+ const completionCancellation = fileCleanupFailure.completionCancellation;
1608
+ const primary = fileCleanupFailure.outcome.kind === "failed" ? fileCleanupFailure.outcome.cause : completionCancellation === undefined ? fileCleanupFailure.cleanupCause : new ArtifactReaderFailure("cancelled", "Artifact read cancelled during close", { cause: completionCancellation.reason });
1609
+ const projected = ArtifactReaderFailure.withCleanup(primary, ArtifactReaderFailure.cleanupObservation(fileCleanupFailure.cleanupCause, fileCleanupFailure.path));
1610
+ super(projected.reason, projected.message, {
1611
+ cause: fileCleanupFailure,
1612
+ cleanup: projected.cleanup,
1613
+ partialObservation: projected.partialObservation,
1614
+ cancellation: projected.cancellation,
1615
+ ...projected.boundary === undefined ? {} : { boundary: projected.boundary }
1616
+ }, projected.details);
1617
+ this.cleanupLease = cleanupLease;
1618
+ this.fileCleanupFailure = fileCleanupFailure;
1619
+ const inherited = fileCleanupFailure.outcome.kind === "failed" ? artifactPrimaryCleanupLeases(fileCleanupFailure.outcome.cause) : [];
1620
+ this.cleanupLeases = inherited === undefined ? undefined : [...new Set([cleanupLease, ...inherited])];
1621
+ }
1622
+ };
1623
+ mapArtifactFileFailure = (cause, classify) => {
1624
+ if (!(cause instanceof ArtifactFileCleanupFailure)) return classify(cause);
1625
+ const physical = cause.fileCleanupFailure;
1626
+ if (physical.outcome.kind !== "failed") return cause;
1627
+ const primary = physical.outcome.cause instanceof ArtifactFileCleanupFailure ? mapArtifactFileFailure(physical.outcome.cause, classify) : classify(physical.outcome.cause);
1628
+ if (primary === physical.outcome.cause) return cause;
1629
+ return new ArtifactFileCleanupFailure(new RegularFileCleanupFailure(physical.path, physical.owner, {
1630
+ kind: "failed",
1631
+ cause: primary
1632
+ }, physical.cleanupCause, physical.retention, physical.completionCancellation), cause.cleanupLease);
1633
+ };
1634
+ artifactFilePrimaryFailure = (cause) => {
1635
+ while (cause instanceof ArtifactFileCleanupFailure && cause.fileCleanupFailure.outcome.kind === "failed") cause = cause.fileCleanupFailure.outcome.cause;
1636
+ return cause;
1637
+ };
1638
+ ArtifactFileCancelled = class extends ArtifactReaderFailure {
1639
+ fileCancellation;
1640
+ constructor(fileCancellation) {
1641
+ super("cancelled", "Artifact read cancelled", { cause: fileCancellation.reason });
1642
+ this.fileCancellation = fileCancellation;
1643
+ }
1644
+ };
1645
+ bindArtifactFileCleanup = (cause, error) => {
1646
+ const leases = cause instanceof ArtifactReaderFailure ? cause.cleanupLeases : undefined;
1647
+ if (leases !== undefined) new AnalysisCleanupLeaseGroup(error, leases);
1648
+ };
1649
+ artifactFileCancellationCause = (cause) => {
1650
+ return cause.cancellation === undefined ? cause.cause : cause.cancellation.reason;
1651
+ };
1652
+ assertArtifactReadActive = (signal) => {
1653
+ if (signal?.aborted) throw new ArtifactReaderFailure("cancelled", "Artifact read cancelled", { cause: signal.reason });
1654
+ };
1655
+ withArtifactRegularFile = async (path, resources, signal, operation, symlinks = "reject") => {
1656
+ let cleanupLease;
1657
+ assertArtifactReadActive(signal);
1658
+ try {
1659
+ const value = await withOwnedRegularFile(path, {
1660
+ symlinks,
1661
+ ...signal === undefined ? {} : { signal },
1662
+ retainFailedClose: (owner) => {
1663
+ cleanupLease = new AnalysisCleanupLease(() => owner.close(), [path]);
1664
+ resources.retain({
1665
+ kind: "lease",
1666
+ resource: path,
1667
+ lease: cleanupLease
1668
+ });
1669
+ }
1670
+ }, async (file) => {
1671
+ assertArtifactReadActive(signal);
1672
+ return await operation(file);
1673
+ });
1674
+ return value;
1675
+ } catch (cause) {
1676
+ if (cause instanceof RegularFileCleanupFailure && cleanupLease !== undefined) throw new ArtifactFileCleanupFailure(cause, cleanupLease);
1677
+ if (cause instanceof RegularFileCancelled) throw new ArtifactFileCancelled(cause);
1678
+ throw artifactOperationCause(cause);
1679
+ }
1680
+ };
1681
+ withArtifactFileHandle = async (path, file, resources, signal, operation) => {
1682
+ const owner = new OwnedFileHandle(file);
1683
+ const cleanupLease = new AnalysisCleanupLease(() => owner.close(), [path]);
1684
+ try {
1685
+ return await withOwnedFileHandle(path, owner, {
1686
+ ...signal === undefined ? {} : { signal },
1687
+ retainFailedClose: () => resources?.retain({
1688
+ kind: "lease",
1689
+ resource: path,
1690
+ lease: cleanupLease
1691
+ })
1692
+ }, operation);
1693
+ } catch (cause) {
1694
+ if (cause instanceof RegularFileCleanupFailure) throw new ArtifactFileCleanupFailure(cause, cleanupLease);
1695
+ if (cause instanceof RegularFileCancelled) throw new ArtifactFileCancelled(cause);
1696
+ throw artifactOperationCause(cause);
1697
+ }
1698
+ };
1699
+ artifactOperationCause = (cause) => cause instanceof RegularFileOperationCancelled ? new ArtifactReaderFailure("cancelled", "Artifact file operation cancelled", { cause: cause.reason }) : cause;
1700
+ })))();
1701
+ }
1702
+
1703
+ //#endregion
1704
+ export { init_ProcessOwnershipProcessTree as A, init_providerStartupTimeout as B, signalProcessWithStartIdentity as C, init_DarwinProcessRunTokenReader as D, SWIFTC_INTERRUPT as E, execFileOutputFailure as F, init_ExecFileOutput as I, DEFAULT_GHIDRA_STARTUP_TIMEOUT_MS as L, ExecFileOutputCancelledError as M, execFileBytes as N, boundedUtf8Text as O, execFileOutput as P, DEFAULT_HOPPER_STARTUP_TIMEOUT_MS as R, prepareProcessOwnershipInspection as S, DarwinProcessOwnershipInspectionError as T, providerStartupTimeoutSchema as V, observeOwnedProcessGroups as _, assertArtifactReadActive as a, observeProcessStartIdentityExit as b, mapArtifactFileFailure as c, cleanupOwnedProcessGroup as d, cleanupWindowsProcessTree as f, init_ProcessOwnershipObservation as g, verifyNoTokenOwnedProcesses as h, artifactFilePrimaryFailure as i, selectCapturedProcessGroupIds as j, init_boundedUtf8Text as k, withArtifactFileHandle as l, readProcessRunId as m, ArtifactFileCleanupFailure as n, bindArtifactFileCleanup as o, init_ProcessOwnership as p, artifactFileCancellationCause as r, init_ArtifactFileOperation as s, ArtifactFileCancelled as t, withArtifactRegularFile as u, observeOwnedProcessLineage as v, systemProcessOwnershipHost as w, parseLinuxProcessStartTime as x, observeProcessStartIdentity as y, DEFAULT_SWIFTC_COMPILE_TIMEOUT_MS as z };