rea-agents 6.4.0 → 6.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1211) hide show
  1. package/DISCLAIMER.md +136 -0
  2. package/README.md +67 -16
  3. package/THIRD_PARTY_NOTICES.md +134 -0
  4. package/bridge/android/ReaJadxBridge.java +123 -11
  5. package/bridge/cutter/rea_bridge.py +816 -0
  6. package/bridge/ghidra/ReaGhidraAnalysisOptions.java +38 -0
  7. package/bridge/ghidra/ReaGhidraBridge.java +1181 -123
  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 +103 -69
  12. package/bridge/mitmproxy/capture.py +189 -13
  13. package/bridge/native/rea_lldb_tracer.py +40 -6
  14. package/bridge/process/ProcessRunTokenReader.swift +76 -34
  15. package/bridge/pwntools/layout_impl.py +5 -0
  16. package/bridge/pwntools/recorded_crash_impl.py +31 -10
  17. package/dist/adb/AdbConfiguration.js +15 -3
  18. package/dist/adb/AdbDeviceOutput.js +59 -37
  19. package/dist/adb/AdbDirectoryListing.js +80 -0
  20. package/dist/adb/AdbHostFileName.js +34 -0
  21. package/dist/adb/AdbProvider.js +416 -173
  22. package/dist/adb/AdbShellOutput.js +55 -57
  23. package/dist/android/JadxAnalysis.js +32 -7
  24. package/dist/android/JadxConfiguration.js +119 -29
  25. package/dist/android/JadxDoctor.js +115 -0
  26. package/dist/android/JadxMcpTransport.js +5 -3
  27. package/dist/android/JadxProtocol.js +14 -0
  28. package/dist/android/JadxProvider.js +15 -9
  29. package/dist/android/JadxRelease.js +12 -1
  30. package/dist/android/JadxWorkspaceRoot.js +157 -0
  31. package/dist/apktool/ApktoolConfiguration.js +165 -22
  32. package/dist/apktool/ApktoolDecodeOutput.js +124 -41
  33. package/dist/apktool/ApktoolProvider.js +70 -33
  34. package/dist/application/AnalysisContextQueries.js +5 -8
  35. package/dist/application/AnalysisProvider.js +24 -20
  36. package/dist/application/AppBundleExecutable.js +5 -5
  37. package/dist/application/BinaryTargetResolver.js +195 -38
  38. package/dist/application/BrowserEvidence.js +1 -1
  39. package/dist/application/BrowserObservationService.js +13 -2
  40. package/dist/application/BrowserScenarioCaptureService.js +0 -1
  41. package/dist/application/CallPathTracing.js +52 -13
  42. package/dist/application/CapabilityInventory.js +168 -28
  43. package/dist/application/ClaudeDesktopConfigLocation.js +152 -0
  44. package/dist/application/ClientConfigurationDocument.js +102 -25
  45. package/dist/application/ClientConfigurationFiles.js +51 -14
  46. package/dist/application/ClientRegistrationEnvironment.js +10 -4
  47. package/dist/application/ClientRegistrationIdentity.js +94 -29
  48. package/dist/application/ClientRegistrationStatus.js +180 -59
  49. package/dist/application/DirectAnalysis.js +85 -30
  50. package/dist/application/DirectAnalysisStatus.js +13 -1
  51. package/dist/application/Doctor.js +113 -32
  52. package/dist/application/DoctorDiagnostics.js +34 -12
  53. package/dist/application/DoctorProviderIds.js +2 -0
  54. package/dist/application/DoctorScope.js +11 -2
  55. package/dist/application/DshCordisPatch.js +355 -0
  56. package/dist/application/DshCordisYaml.js +155 -0
  57. package/dist/application/EnhancedLiteralTracing.js +30 -16
  58. package/dist/application/EnhancedToolTypes.js +0 -1
  59. package/dist/application/EnhancedTools.js +164 -54
  60. package/dist/application/EvidenceBundleCommands.js +30 -7
  61. package/dist/application/EvidenceBundleFiles.js +29 -7
  62. package/dist/application/FunctionAnalysisEvidence.js +3 -0
  63. package/dist/application/GeminiClientSettings.js +25 -13
  64. package/dist/application/HermesConfigurationYaml.js +272 -0
  65. package/dist/application/InventoryProjectionEvidence.js +0 -1
  66. package/dist/application/InvestigationProviders.js +13 -3
  67. package/dist/application/JsonFiles.js +110 -20
  68. package/dist/application/JsonInputFile.js +220 -62
  69. package/dist/application/LinuxHopper.js +126 -48
  70. package/dist/application/MacHopper.js +21 -17
  71. package/dist/application/MacHopperPaths.js +40 -0
  72. package/dist/application/{MipsElfAbiFlags.js → MipsElfMetadata.js} +70 -9
  73. package/dist/application/MipsElfSharedLoad.js +164 -0
  74. package/dist/application/MipsGnuAttributes.js +90 -0
  75. package/dist/application/MsixPackageStorage.js +133 -0
  76. package/dist/application/ProgressReporter.js +1 -1
  77. package/dist/application/ProviderOperationExecution.js +11 -3
  78. package/dist/application/ReconstructionCoverageService.js +0 -1
  79. package/dist/application/ReconstructionObligationCandidates.js +3 -2
  80. package/dist/application/ReconstructionObligationLedgerDiagnostics.js +2 -2
  81. package/dist/application/ReconstructionObligationLedgerEvaluation.js +15 -33
  82. package/dist/application/ReconstructionObligationLedgerProjection.js +3 -72
  83. package/dist/application/ReconstructionObligationLedgerService.js +3 -1
  84. package/dist/application/ReconstructionObligationOriginalCases.js +2 -1
  85. package/dist/application/ReferenceSourceImport.js +24 -8
  86. package/dist/application/ReferenceSourceImportEntries.js +22 -21
  87. package/dist/application/ReferenceSourceImportTypes.js +0 -1
  88. package/dist/application/ReferenceSourceVcsAdapter.js +33 -16
  89. package/dist/application/RegularFileRead.js +46 -18
  90. package/dist/application/Setup.js +36 -10
  91. package/dist/application/SetupClientConfiguration.js +206 -37
  92. package/dist/application/SetupClients.js +12 -6
  93. package/dist/application/SetupHost.js +66 -24
  94. package/dist/application/SetupInstallFailure.js +42 -2
  95. package/dist/application/SetupPlan.js +79 -50
  96. package/dist/application/SetupRecoveryBackup.js +66 -0
  97. package/dist/application/SetupRegistrationEnvironment.js +2 -1
  98. package/dist/application/SetupSkill.js +323 -76
  99. package/dist/application/SupportedClients.js +162 -28
  100. package/dist/application/TypeScriptEmittedSourceCandidates.js +26 -0
  101. package/dist/application/Uninstall.js +273 -82
  102. package/dist/application/UninstallFailure.js +14 -0
  103. package/dist/application/Update.js +54 -25
  104. package/dist/application/UpdateFailure.js +17 -0
  105. package/dist/application/UpdateMaintenance.js +11 -29
  106. package/dist/application/UpdateRuntime.js +141 -27
  107. package/dist/application/WebModuleTraceService.js +7 -0
  108. package/dist/application/WebNetworkCaptureService.js +16 -7
  109. package/dist/application/WebSourceLocationService.js +20 -4
  110. package/dist/application/WindowsCapabilities.js +18 -15
  111. package/dist/application/WorkflowEvidence.js +24 -1
  112. package/dist/application/analysisView/AnalysisViewService.js +90 -12
  113. package/dist/application/android/AndroidPackageInspection.js +25 -0
  114. package/dist/application/android/AndroidSearchEvidenceSummary.js +100 -0
  115. package/dist/application/binary/AnalysisProviderEvaluation.js +1 -1
  116. package/dist/application/binary/AnalysisProviderRegistry.js +36 -21
  117. package/dist/application/binary/AnalysisSnapshotCache.js +41 -20
  118. package/dist/application/binary/AnalysisSnapshotFiles.js +75 -9
  119. package/dist/application/binary/BinarySession.js +248 -96
  120. package/dist/application/binary/BinarySessionExecution.js +5 -4
  121. package/dist/application/binary/BinarySessionOpen.js +13 -6
  122. package/dist/application/binary/BinarySessionRecords.js +33 -7
  123. package/dist/application/binary/BinarySessionStatus.js +93 -23
  124. package/dist/application/binary/BinaryTargetSummary.js +9 -0
  125. package/dist/application/binary/CompositeProvider.js +71 -28
  126. package/dist/application/binary/LazyAnalysisProvider.js +3 -1
  127. package/dist/application/binary/SessionProviderRouter.js +5 -2
  128. package/dist/application/binaryDiagnostics/BinaryLayoutService.js +11 -1
  129. package/dist/application/binaryDiagnostics/PeResourcesService.js +3 -0
  130. package/dist/application/binaryDiagnostics/RecordedCrashService.js +14 -3
  131. package/dist/application/captures/PacketCaptureService.js +83 -0
  132. package/dist/application/closeOwnedWebResources.js +7 -0
  133. package/dist/application/electron/ElectronFusePort.js +1 -0
  134. package/dist/application/electron/ElectronFuseService.js +80 -0
  135. package/dist/application/evm/EvmInterfaceService.js +1 -0
  136. package/dist/application/flutter/DartAotInspection.js +26 -0
  137. package/dist/application/flutter/FlutterBuildAnalysisPort.js +1 -0
  138. package/dist/application/flutter/FlutterBuildAnalysisService.js +13 -0
  139. package/dist/application/frida/FridaInstrumentationPort.js +8 -0
  140. package/dist/application/frida/FridaInstrumentationService.js +310 -0
  141. package/dist/application/frida/fridaInputErrors.js +17 -0
  142. package/dist/application/go/GoBinaryPort.js +1 -0
  143. package/dist/application/go/GoBinaryService.js +80 -0
  144. package/dist/application/harmony/HarmonyApplicationService.js +17 -0
  145. package/dist/application/investigation/EvidenceLedger.js +40 -14
  146. package/dist/application/investigation/InvestigationRecords.js +12 -21
  147. package/dist/application/investigation/UnknownEvidence.js +22 -18
  148. package/dist/application/javascript/ElectronActiveObservationService.js +55 -25
  149. package/dist/application/javascript/ElectronBoundaryAnalysis.js +17 -3
  150. package/dist/application/javascript/ElectronBoundaryGraph.js +2 -0
  151. package/dist/application/javascript/ElectronBoundaryGraphCallPaths.js +144 -0
  152. package/dist/application/javascript/ElectronBoundaryGraphIpc.js +26 -7
  153. package/dist/application/javascript/ElectronBoundaryGraphNative.js +1 -1
  154. package/dist/application/javascript/ElectronBoundaryGraphWindows.js +47 -9
  155. package/dist/application/javascript/ElectronObservationService.js +0 -1
  156. package/dist/application/javascript/JavaScriptApplicationEvidence.js +15 -0
  157. package/dist/application/javascript/JavaScriptApplicationService.js +29 -14
  158. package/dist/application/javascript/JavaScriptApplicationWorkflowService.js +0 -1
  159. package/dist/application/javascript/JavaScriptArtifactAnalysis.js +86 -34
  160. package/dist/application/javascript/JavaScriptArtifactGraphAccumulator.js +51 -21
  161. package/dist/application/javascript/JavaScriptArtifactGraphBuilder.js +31 -7
  162. package/dist/application/javascript/JavaScriptArtifactGraphContext.js +25 -4
  163. package/dist/application/javascript/JavaScriptArtifactGraphDocuments.js +25 -14
  164. package/dist/application/javascript/JavaScriptArtifactGraphFindings.js +147 -41
  165. package/dist/application/javascript/JavaScriptArtifactGraphStructure.js +156 -7
  166. package/dist/application/javascript/JavaScriptArtifactPathResolution.js +892 -181
  167. package/dist/application/javascript/JavaScriptArtifactReconstruction.js +43 -30
  168. package/dist/application/javascript/JavaScriptArtifactReconstructionInput.js +2 -0
  169. package/dist/application/javascript/JavaScriptModuleRelationships.js +33 -11
  170. package/dist/application/javascript/JavaScriptRecoveryService.js +29 -9
  171. package/dist/application/javascript/JavaScriptRuntimeObservationService.js +2 -1
  172. package/dist/application/javascript/JavaScriptRuntimeReconciliationService.js +0 -1
  173. package/dist/application/javascript/JavaScriptSemanticGraphBuilder.js +42 -26
  174. package/dist/application/javascript/JavaScriptSemanticGraphElectronProjection.js +67 -0
  175. package/dist/application/javascript/JavaScriptSemanticTraceService.js +0 -1
  176. package/dist/application/managed/ManagedApplicationGraphService.js +0 -1
  177. package/dist/application/managed/ManagedMemberComparisonService.js +72 -54
  178. package/dist/application/managed/ManagedNativeVerificationService.js +0 -1
  179. package/dist/application/managed/ManagedReconstructionService.js +0 -1
  180. package/dist/application/native/NativeCallRoutes.js +54 -34
  181. package/dist/application/native/NativeDispatchMetadataInspection.js +6 -2
  182. package/dist/application/native/NativeUiActionTrace.js +35 -22
  183. package/dist/application/native/NativeValueTrace.js +57 -23
  184. package/dist/application/pcap/PcapAnalysisPort.js +1 -0
  185. package/dist/application/pcap/PcapAnalysisService.js +24 -0
  186. package/dist/application/process/ProcessCli.js +33 -13
  187. package/dist/application/reverse/ReverseEngineeringCommandPort.js +1 -0
  188. package/dist/application/reverse/ReverseEngineeringService.js +688 -0
  189. package/dist/application/rust/RustBinaryPort.js +1 -0
  190. package/dist/application/rust/RustBinaryService.js +80 -0
  191. package/dist/application/signals/SignalRecordingService.js +83 -0
  192. package/dist/application/sqlite/SqliteDatabaseCapability.js +30 -0
  193. package/dist/application/sqlite/SqliteDatabasePort.js +1 -0
  194. package/dist/application/sqlite/SqliteDatabaseService.js +76 -0
  195. package/dist/application/wasm/WasmArtifactPort.js +1 -0
  196. package/dist/application/wasm/WasmArtifactService.js +77 -0
  197. package/dist/application/wasm/WasmInterfaceComparisonService.js +188 -0
  198. package/dist/artifacts/ArtifactHash.js +13 -2
  199. package/dist/artifacts/ArtifactPaths.js +4 -7
  200. package/dist/artifacts/ArtifactProvider.js +8 -4
  201. package/dist/artifacts/ArtifactReader.js +13 -1
  202. package/dist/artifacts/ArtifactResourceScope.js +12 -3
  203. package/dist/artifacts/AsarArtifactReader.js +177 -112
  204. package/dist/artifacts/AsarListing.js +78 -0
  205. package/dist/artifacts/DirectoryArtifactReader.js +94 -24
  206. package/dist/artifacts/MachOSliceArtifactReader.js +83 -10
  207. package/dist/artifacts/NativeDmgArtifactReader.js +161 -58
  208. package/dist/artifacts/OrderedReads.js +57 -0
  209. package/dist/artifacts/SafeOutputTree.js +19 -4
  210. package/dist/artifacts/ZipArtifactReader.js +117 -12
  211. package/dist/artifacts/apple/AppleAssetCatalogAnalysis.js +77 -68
  212. package/dist/artifacts/apple/DylibResolutionReader.js +11 -5
  213. package/dist/artifacts/apple/InterfaceBuilderAnalysis.js +57 -21
  214. package/dist/artifacts/apple/InterfaceBuilderDecodeBudget.js +64 -12
  215. package/dist/artifacts/apple/KeyedArchiveReader.js +3 -2
  216. package/dist/artifacts/apple/MachoLoadCommandReader.js +62 -61
  217. package/dist/artifacts/apple/NibArchive.js +11 -4
  218. package/dist/artifacts/apple/PlistNumberLiterals.js +2 -2
  219. package/dist/artifacts/extraction/ArtifactExtraction.js +6 -7
  220. package/dist/artifacts/hostExecutableMarking.js +16 -0
  221. package/dist/artifacts/inventory/ArtifactGraphConstruction.js +134 -34
  222. package/dist/artifacts/inventory/ArtifactInventory.js +2 -2
  223. package/dist/artifacts/inventory/classify.js +32 -15
  224. package/dist/artifacts/inventory/reader.js +36 -21
  225. package/dist/artifacts/inventory/scanCanonical.js +25 -18
  226. package/dist/artifacts/inventory/scanReader.js +36 -10
  227. package/dist/artifacts/javascript/JavaScriptArtifactFiles.js +163 -7
  228. package/dist/artifacts/readStableArtifact.js +28 -4
  229. package/dist/browser/BrowserProcessStartup.js +20 -9
  230. package/dist/browser/BrowserScenarioPartialObservation.js +60 -44
  231. package/dist/browser/BrowserScenarioSecrets.js +176 -46
  232. package/dist/browser/CdpBrowserProvider.js +70 -99
  233. package/dist/browser/CdpCaptureDocuments.js +231 -69
  234. package/dist/browser/CdpCaptureDomSvg.js +94 -61
  235. package/dist/browser/CdpCaptureEventBodyShapes.js +9 -5
  236. package/dist/browser/CdpCaptureEventHandlers.js +23 -12
  237. package/dist/browser/CdpCaptureEvents.js +49 -10
  238. package/dist/browser/CdpCaptureStorage.js +22 -5
  239. package/dist/browser/CdpCaptureStorageFingerprints.js +54 -11
  240. package/dist/browser/CdpCaptureValues.js +0 -1
  241. package/dist/browser/CdpConnection.js +3 -4
  242. package/dist/browser/CdpElectronInspection.js +14 -4
  243. package/dist/browser/CdpElectronProvider.js +7 -2
  244. package/dist/browser/CdpElectronScripts.js +2 -1
  245. package/dist/browser/CdpElectronWorkers.js +7 -2
  246. package/dist/browser/CdpEndpoint.js +143 -17
  247. package/dist/browser/CdpObservationSession.js +24 -8
  248. package/dist/browser/CdpPageCapture.js +66 -16
  249. package/dist/browser/CdpPageCaptureScripts.js +4 -3
  250. package/dist/browser/CdpPageCaptureWorkers.js +5 -1
  251. package/dist/browser/CdpSafeMetadata.js +9 -5
  252. package/dist/browser/CdpScreenshot.js +5 -14
  253. package/dist/browser/CdpSnapshotStrings.js +21 -0
  254. package/dist/browser/CdpTargetSession.js +29 -2
  255. package/dist/browser/CdpWebMcpDiscovery.js +23 -6
  256. package/dist/browser/PlaywrightBrowserScenarioProvider.js +4 -4
  257. package/dist/browser/PlaywrightElectronActiveActions.js +4 -4
  258. package/dist/browser/PlaywrightElectronActiveProjection.js +16 -4
  259. package/dist/browser/PlaywrightElectronActiveProvider.js +103 -30
  260. package/dist/browser/PlaywrightExecutionBoundary.js +2 -2
  261. package/dist/browser/PlaywrightScenarioBrowser.js +9 -6
  262. package/dist/browser/PlaywrightScenarioEvents.js +198 -36
  263. package/dist/browser/PlaywrightScenarioServiceWorkers.js +249 -0
  264. package/dist/browser/PlaywrightScenarioSession.js +61 -29
  265. package/dist/browser/WebSourceMapFetcher.js +163 -80
  266. package/dist/browser/assets/LocalWebScriptArtifacts.js +24 -3
  267. package/dist/browser/assets/PublishWebScripts.js +13 -2
  268. package/dist/browser/assets/ScenarioScriptCapture.js +2 -1
  269. package/dist/browser/assets/WebArtifactReads.js +11 -3
  270. package/dist/browser/assets/WebSourceLocationArtifacts.js +38 -3
  271. package/dist/browser/history/CaptureFailures.js +22 -8
  272. package/dist/browser/history/CaptureFormatError.js +2 -2
  273. package/dist/browser/history/{HarJson.js → CaptureJson.js} +14 -4
  274. package/dist/browser/history/CaptureRedaction.js +16 -3
  275. package/dist/browser/history/CaptureRelease.js +20 -2
  276. package/dist/browser/history/HarCapture.js +16 -23
  277. package/dist/browser/history/HarSchema.js +36 -36
  278. package/dist/browser/history/HistoricalCaptureDecoder.js +93 -25
  279. package/dist/browser/history/NodeCaptureAdapter.js +48 -0
  280. package/dist/browser/history/{HarCaptureProcess.js → NodeCaptureProcess.js} +18 -9
  281. package/dist/browser/history/QlogCapture.js +385 -0
  282. package/dist/browser/history/SazCapture.js +130 -0
  283. package/dist/browser/history/SazHttp.js +61 -0
  284. package/dist/browser/history/SazMetadata.js +92 -0
  285. package/dist/browser/history/SazProjection.js +90 -0
  286. package/dist/browser/modules/NativeModuleResolver.js +177 -110
  287. package/dist/browser/modules/WebModuleArtifacts.js +40 -3
  288. package/dist/browser/network/PlaywrightNetworkContent.js +40 -5
  289. package/dist/browser/network/PlaywrightScenarioNetwork.js +125 -11
  290. package/dist/captures/TsharkCaptureProvider.js +370 -0
  291. package/dist/captures/parseFieldDiscovery.js +66 -0
  292. package/dist/captures/parsePacketOutput.js +21 -0
  293. package/dist/catalogIdentity.js +46 -35
  294. package/dist/cli/adbCommands.js +2 -2
  295. package/dist/cli/analysisViewCommands.js +1 -1
  296. package/dist/cli/androidCommands.js +11 -2
  297. package/dist/cli/apktoolCommands.js +10 -11
  298. package/dist/cli/applicationCommands.js +44 -17
  299. package/dist/cli/artifactCommands.js +1 -1
  300. package/dist/cli/binaryDiagnosticsCommands.js +14 -10
  301. package/dist/cli/browserAdvancedCommands.js +37 -24
  302. package/dist/cli/browserCommands.js +46 -29
  303. package/dist/cli/captureCommands.js +72 -0
  304. package/dist/cli/cliResultOutput.js +188 -0
  305. package/dist/cli/coreBinaryCommands.js +73 -27
  306. package/dist/cli/coreNativeCommands.js +53 -31
  307. package/dist/cli/cutterCommands.js +50 -0
  308. package/dist/cli/electronCommands.js +45 -3
  309. package/dist/cli/evmCommands.js +4 -5
  310. package/dist/cli/finishAnalysisCommand.js +44 -0
  311. package/dist/cli/firmwareCommands.js +14 -36
  312. package/dist/cli/flutterCommands.js +69 -0
  313. package/dist/cli/fridaCommands.js +211 -0
  314. package/dist/cli/goCommands.js +20 -0
  315. package/dist/cli/interactiveSetup.js +11 -1
  316. package/dist/cli/javascriptApplicationAnalysis.js +1 -1
  317. package/dist/cli/javascriptRecoveryCommands.js +7 -0
  318. package/dist/cli/jsonOutput.js +2 -2
  319. package/dist/cli/managedCommands.js +31 -3
  320. package/dist/cli/options.js +20 -2
  321. package/dist/cli/pcapCommands.js +47 -0
  322. package/dist/cli/processCommands.js +1 -1
  323. package/dist/cli/reverseEngineeringCommands.js +268 -0
  324. package/dist/cli/rustCommands.js +21 -0
  325. package/dist/cli/setupCommands.js +40 -12
  326. package/dist/cli/signalCommands.js +72 -0
  327. package/dist/cli/sqliteCommands.js +79 -0
  328. package/dist/cli/utilityCommands.js +116 -74
  329. package/dist/cli/wasmCommands.js +61 -0
  330. package/dist/cli/webModuleCommands.js +36 -32
  331. package/dist/cli/webNetworkCaptureCommands.js +8 -8
  332. package/dist/cli-runtime/AbortablePromise-BVBemxbD.js +123 -0
  333. package/dist/cli-runtime/AnalysisProvider-D0Us2OTk.js +27 -0
  334. package/dist/cli-runtime/AnalysisSnapshotCache-BXS0wRd2.js +710 -0
  335. package/dist/cli-runtime/ArtifactReader-BXkffc1D.js +55 -0
  336. package/dist/cli-runtime/ArtifactResourceScope-DQWTcUwE.js +114 -0
  337. package/dist/cli-runtime/AsarHeader-CnzOzYEH.js +31 -0
  338. package/dist/cli-runtime/BinarySessionStatus-DnMxMk-r.js +211 -0
  339. package/dist/cli-runtime/BinaryTargetResolver-CVIJ_s1A.js +1308 -0
  340. package/dist/cli-runtime/BoundedFileBytes-BU30odTm.js +39 -0
  341. package/dist/cli-runtime/CdpTargetSession-DGX5pV9w.js +650 -0
  342. package/dist/cli-runtime/ClientConfigPath-c6jr6INc.js +36 -0
  343. package/dist/cli-runtime/ClientConfigurationDocument-ffQ9X0Se.js +1957 -0
  344. package/dist/cli-runtime/ClientRegistrationStatus-DszCyPEU.js +509 -0
  345. package/dist/cli-runtime/CurrentEntrypointPath-D5FRNdkq.js +14 -0
  346. package/dist/cli-runtime/DirectAnalysis-BgvAtpN3.js +528 -0
  347. package/dist/cli-runtime/Doctor-DIpf_I7N.js +588 -0
  348. package/dist/cli-runtime/ElectronFileScope-dpHm2nrS.js +1054 -0
  349. package/dist/cli-runtime/ExecFileOutput-BEQs-lDD.js +117 -0
  350. package/dist/cli-runtime/IdaConfiguration-CtGP7EKo.js +1094 -0
  351. package/dist/cli-runtime/InterfaceBuilderDecodeBudget-D4omRUe4.js +279 -0
  352. package/dist/cli-runtime/InventoryProjectionEvidence-DIsI4DJ6.js +49 -0
  353. package/dist/cli-runtime/InvestigationProviders-DoQRIHii.js +117 -0
  354. package/dist/cli-runtime/JavaScriptApplicationEvidenceGraph-D5aI_FSJ.js +160 -0
  355. package/dist/cli-runtime/JavaScriptApplicationWorkflowEvidence-Bz4-V0Ct.js +75 -0
  356. package/dist/cli-runtime/JavaScriptWorkerMemoryLimit-B1bwMM1a.js +86 -0
  357. package/dist/cli-runtime/JebMcpEndpoint-DUytrn5G.js +428 -0
  358. package/dist/cli-runtime/JsonFiles-DQa1PRKy.js +708 -0
  359. package/dist/cli-runtime/MacCodeSignature-MgYbRK_H.js +24 -0
  360. package/dist/cli-runtime/MacHopperPaths-CwL5lYPX.js +434 -0
  361. package/dist/cli-runtime/MachoLoadCommandReader-C7e074Ze.js +510 -0
  362. package/dist/cli-runtime/ManagedSnapshot-rqyBHcdL.js +4185 -0
  363. package/dist/cli-runtime/OwnedCommand-Cj9GhmPR.js +112 -0
  364. package/dist/cli-runtime/PrivateRuntimeRoot-DAy0PiBM.js +263 -0
  365. package/dist/cli-runtime/ProcessOwnership-DXC5-UWt.js +1378 -0
  366. package/dist/cli-runtime/ProviderDeadline-8m2pFRDc.js +122 -0
  367. package/dist/cli-runtime/RegularFile-B_6KPCNQ.js +139 -0
  368. package/dist/cli-runtime/RegularFileRead-DVlC5faM.js +125 -0
  369. package/dist/cli-runtime/SafeOutputTree-D6U15GXd.js +524 -0
  370. package/dist/cli-runtime/SetupHost-FkYWswsq.js +1098 -0
  371. package/dist/cli-runtime/SupportedClients-DaX6Lt2d.js +1049 -0
  372. package/dist/cli-runtime/UninstallFailure-1blyKXHE.js +22 -0
  373. package/dist/cli-runtime/Update-CbTC_eg1.js +143 -0
  374. package/dist/cli-runtime/UpdateFailure-BcFNxEZZ.js +24 -0
  375. package/dist/cli-runtime/ZipArtifactReader-B8ZgNe4D.js +248 -0
  376. package/dist/cli-runtime/analysisErrorCleanup-Do6YeeoD.js +32 -0
  377. package/dist/cli-runtime/analysisErrorPresentation-DGt7TdsH.js +497 -0
  378. package/dist/cli-runtime/appleArchiveFormat-tVoI2ykA.js +263 -0
  379. package/dist/cli-runtime/application__DirectAnalysisStatus-DpOejOf0.js +150 -0
  380. package/dist/cli-runtime/application__EnhancedTools-oFE2bOjs.js +1787 -0
  381. package/dist/cli-runtime/application__FunctionAnalysisEvidence-B6osuhvW.js +41 -0
  382. package/dist/cli-runtime/application__ReconstructionCoverageService-DN3wTFQj.js +32 -0
  383. package/dist/cli-runtime/application__ReconstructionObligationLedgerService-CKcTppX9.js +815 -0
  384. package/dist/cli-runtime/application__Setup-XpMaRNjy.js +514 -0
  385. package/dist/cli-runtime/application__Uninstall-_23pU2yB.js +427 -0
  386. package/dist/cli-runtime/application__UpdateRuntime-DPvY8ohd.js +345 -0
  387. package/dist/cli-runtime/application__android__AndroidApplicationService-CFgIFPM4.js +31 -0
  388. package/dist/cli-runtime/application__apple__AppleApplicationService-Db6QCsun.js +31 -0
  389. package/dist/cli-runtime/application__harmony__HarmonyApplicationService-CFjocHoK.js +31 -0
  390. package/dist/cli-runtime/application__javascript__ElectronActiveObservationService-CmVDUI_Z.js +118 -0
  391. package/dist/cli-runtime/application__javascript__ElectronObservationService-DEsR8KDN.js +63 -0
  392. package/dist/cli-runtime/application__javascript__JavaScriptApplicationService-CCkp8KBh.js +11450 -0
  393. package/dist/cli-runtime/application__javascript__JavaScriptApplicationWorkflowService-lPy0tzr3.js +2329 -0
  394. package/dist/cli-runtime/application__javascript__JavaScriptRuntimeReconciliationService-DWleA8K9.js +88 -0
  395. package/dist/cli-runtime/application__javascript__JavaScriptSemanticTraceService-DkALH4rL.js +299 -0
  396. package/dist/cli-runtime/artifactOperationError-B7n03FbD.js +27 -0
  397. package/dist/cli-runtime/artifacts__ArtifactProvider-zXI0QjSL.js +2187 -0
  398. package/dist/cli-runtime/binary-BVOr2mgE.js +14206 -0
  399. package/dist/cli-runtime/browserObservationError-Dx6xRTjb.js +40 -0
  400. package/dist/cli-runtime/catalogIdentity-DLoXgfIR.js +933 -0
  401. package/dist/cli-runtime/cli.js +41848 -0
  402. package/dist/cli-runtime/cliOutput-BC1BdAcB.js +122 -0
  403. package/dist/cli-runtime/cliOutput.js +5 -0
  404. package/dist/cli-runtime/cliResultOutput-DsRMI8CJ.js +780 -0
  405. package/dist/cli-runtime/cliResultOutput.js +5 -0
  406. package/dist/cli-runtime/composition__browserScenario-DHXC1a8n.js +2927 -0
  407. package/dist/cli-runtime/composition__electronObservation-GecK2EID.js +555 -0
  408. package/dist/cli-runtime/composition__electronScenario-CEZnVrAL.js +653 -0
  409. package/dist/cli-runtime/cutterToolContracts-TZH9EHr5.js +5134 -0
  410. package/dist/cli-runtime/doctorRuntime-BE5ZX8it.js +258 -0
  411. package/dist/cli-runtime/dotnet__ManagedStaticProvider-C8_yZCDc.js +5 -0
  412. package/dist/cli-runtime/errorSchemas-CTRmvMl3.js +601 -0
  413. package/dist/cli-runtime/javascriptApplicationAnalysis-HgMzVMQw.js +2068 -0
  414. package/dist/cli-runtime/javascriptExportReturnShapeProjection-Dg00g35t.js +78 -0
  415. package/dist/cli-runtime/javascriptExportShapeComparisonSchemas-BYnoIqIk.js +1242 -0
  416. package/dist/cli-runtime/javascriptRuntimeReconciliation-DNjDoL3S.js +1507 -0
  417. package/dist/cli-runtime/javascriptRuntimeReconciliationSchemas-BWpGWNcI.js +247 -0
  418. package/dist/cli-runtime/javascriptSemanticTraceSchemas-BTCNcvbc.js +126 -0
  419. package/dist/cli-runtime/lipo-DSWP6fv-.js +396 -0
  420. package/dist/cli-runtime/logger-CQQCI4a2.js +48 -0
  421. package/dist/cli-runtime/machoContainer-C8BIkkq3.js +172 -0
  422. package/dist/cli-runtime/managedApplicationGraph-B08jb3jq.js +1130 -0
  423. package/dist/cli-runtime/managedToolContracts-D60QmIYj.js +99 -0
  424. package/dist/cli-runtime/mcpDoctor.js +359 -0
  425. package/dist/cli-runtime/mcpStartupPolicy-CVVSOmRc.js +21 -0
  426. package/dist/cli-runtime/native__NativeMacOSProvider-YBTvUeJO.js +4875 -0
  427. package/dist/cli-runtime/officialToolContracts-CCFF0an9.js +1501 -0
  428. package/dist/cli-runtime/propertyListKeys-G8e74YWb.js +248 -0
  429. package/dist/cli-runtime/providerAdapterError-DAjhICdr.js +25 -0
  430. package/dist/cli-runtime/providerCleanupError-Ceq8f0wK.js +27 -0
  431. package/dist/cli-runtime/providerIdentities-Ao1XTvwx.js +31 -0
  432. package/dist/cli-runtime/providerStartupTimeout-B2tF2LtZ.js +17 -0
  433. package/dist/cli-runtime/readFileHandleChunks-dp60iZ6v.js +38 -0
  434. package/dist/cli-runtime/reconstructionObligationLedgerSchemas-Bao0xMr-.js +19478 -0
  435. package/dist/cli-runtime/rolldown-runtime-DXoylpqc.js +121 -0
  436. package/dist/cli-runtime/runtimeVersion-CMGd0bDu.js +23 -0
  437. package/dist/cli-runtime/safeJson-DKKACtdy.js +25 -0
  438. package/dist/cli-runtime/scanCanonical-KP4T9jSl.js +2724 -0
  439. package/dist/cli-runtime/snapshotEnvironment-D_tWyOub.js +813 -0
  440. package/dist/cli-runtime/toolContracts-D2FOG_Nb.js +3721 -0
  441. package/dist/cli-runtime/toolOutputSchemaGroups-DRiYs1je.js +12070 -0
  442. package/dist/cli-runtime/workflowInputError-n8Oo-bLA.js +26 -0
  443. package/dist/cli.js +38 -5
  444. package/dist/cliBrowserScenarioCommands.js +39 -4
  445. package/dist/cliCommandNames.js +48 -0
  446. package/dist/cliEvidenceCommands.js +0 -1
  447. package/dist/cliJavaScriptRuntimeCommands.js +16 -14
  448. package/dist/cliJsonInput.js +12 -4
  449. package/dist/cliLogging.js +50 -14
  450. package/dist/cliObservationOptions.js +6 -0
  451. package/dist/cliOutput.js +38 -5
  452. package/dist/composition/binary.js +4 -0
  453. package/dist/composition/captures.js +3 -0
  454. package/dist/composition/directAnalysis.js +28 -11
  455. package/dist/composition/electronFuses.js +4 -0
  456. package/dist/composition/evm.js +12 -0
  457. package/dist/composition/flutter.js +3 -0
  458. package/dist/composition/go.js +4 -0
  459. package/dist/composition/javascriptAnalysisWorkerProcess.js +5 -4
  460. package/dist/composition/jeb.js +33 -4
  461. package/dist/composition/pcap.js +3 -0
  462. package/dist/composition/resolveWindowsProviderExecutable.js +61 -0
  463. package/dist/composition/reverseEngineering.js +29 -0
  464. package/dist/composition/rust.js +4 -0
  465. package/dist/composition/signals.js +3 -0
  466. package/dist/composition/sqlite.js +4 -0
  467. package/dist/composition/wasm.js +22 -0
  468. package/dist/composition/webNetworkCaptures.js +7 -2
  469. package/dist/config/environment.js +45 -4
  470. package/dist/config/ghidraDisabledAnalyzers.js +25 -0
  471. package/dist/config/homeDirectory.js +9 -6
  472. package/dist/config/mcpInputSchemaProfile.js +4 -0
  473. package/dist/config/mcpOutputSchemaProfile.js +22 -0
  474. package/dist/config/parseConfig.js +21 -31
  475. package/dist/config/parsers.js +4 -3
  476. package/dist/config/{ghidraStartupTimeout.js → providerStartupTimeout.js} +7 -3
  477. package/dist/contracts/adb/adbToolContracts.js +7 -7
  478. package/dist/contracts/analysisDetail.js +6 -3
  479. package/dist/contracts/analysisViewApiSurfaceExample.js +68 -0
  480. package/dist/contracts/analysisViewToolContracts.js +24 -3
  481. package/dist/contracts/android/androidToolContracts.js +17 -8
  482. package/dist/contracts/applicationToolContracts.js +17 -2
  483. package/dist/contracts/artifactToolContracts.js +14 -2
  484. package/dist/contracts/browserToolContracts.js +1 -0
  485. package/dist/contracts/captures/captureToolContracts.js +42 -0
  486. package/dist/contracts/compactInputSchema.js +26 -6
  487. package/dist/contracts/cutterToolContracts.js +84 -0
  488. package/dist/contracts/enhancedToolContracts.js +2 -2
  489. package/dist/contracts/evm/evmToolContracts.js +30 -15
  490. package/dist/contracts/firmware/firmwareToolContracts.js +1 -1
  491. package/dist/contracts/flutter/flutterToolContracts.js +47 -0
  492. package/dist/contracts/fridaRemoteAddress.js +23 -0
  493. package/dist/contracts/fridaToolContracts.js +273 -0
  494. package/dist/contracts/functionComparisonExample.js +12 -1
  495. package/dist/contracts/gdbToolContracts.js +103 -0
  496. package/dist/contracts/go/goToolContracts.js +20 -0
  497. package/dist/contracts/hopperMemoryContracts.js +15 -0
  498. package/dist/contracts/inputSchemaPresentation.js +81 -14
  499. package/dist/contracts/investigationExamples.js +1 -0
  500. package/dist/contracts/javascript/electronToolContracts.js +27 -2
  501. package/dist/contracts/javascript/javascriptRecoveryToolContracts.js +13 -1
  502. package/dist/contracts/managed/managedToolContracts.js +43 -4
  503. package/dist/contracts/managed/managedWorkflowExamples.js +7 -1
  504. package/dist/contracts/managed/managedWorkflowToolContracts.js +4 -30
  505. package/dist/contracts/mobileApplicationGraphExamples.js +12 -0
  506. package/dist/contracts/native/binaryDiagnosticsToolContracts.js +3 -2
  507. package/dist/contracts/native/nativeToolContracts.js +10 -6
  508. package/dist/contracts/officialToolContracts.js +5 -5
  509. package/dist/contracts/pcap/pcapToolContracts.js +33 -0
  510. package/dist/contracts/providerSelection.js +1 -0
  511. package/dist/contracts/reconstructionReadinessExample.js +126 -119
  512. package/dist/contracts/reverseEngineeringToolContracts.js +52 -0
  513. package/dist/contracts/rizinDebugToolContracts.js +96 -0
  514. package/dist/contracts/rust/rustToolContracts.js +20 -0
  515. package/dist/contracts/sessionLifecycleInputs.js +34 -2
  516. package/dist/contracts/sessionToolContracts.js +2 -2
  517. package/dist/contracts/sessionToolSchemas.js +14 -0
  518. package/dist/contracts/signals/signalToolContracts.js +40 -0
  519. package/dist/contracts/sqlite/sqliteToolContracts.js +36 -0
  520. package/dist/contracts/toolContractExamples.js +29 -0
  521. package/dist/contracts/toolContractTypes.js +2 -0
  522. package/dist/contracts/toolContracts.js +26 -0
  523. package/dist/contracts/toolEffects.js +247 -8
  524. package/dist/contracts/toolOutputSchemaGroups.js +75 -32
  525. package/dist/contracts/toolOutputSchemaPrimitives.js +111 -10
  526. package/dist/contracts/toolSchemaMetadata.js +16 -2
  527. package/dist/contracts/unknownContractExamples.js +1 -1
  528. package/dist/contracts/wasm/wasmComparisonContracts.js +52 -0
  529. package/dist/contracts/wasm/wasmToolContracts.js +33 -0
  530. package/dist/contracts/webNetworkCaptureToolContracts.js +15 -4
  531. package/dist/cutter/CutterBridgeClient.js +621 -0
  532. package/dist/cutter/CutterBridgeService.js +139 -0
  533. package/dist/doctorRuntime.js +20 -8
  534. package/dist/domain/adb/adbDeviceAnalysis.js +26 -4
  535. package/dist/domain/analysisErrorBase.js +20 -0
  536. package/dist/domain/analysisErrorCleanup.js +1 -1
  537. package/dist/domain/analysisErrorCore.js +19 -0
  538. package/dist/domain/analysisErrorPresentation.js +58 -17
  539. package/dist/domain/analysisErrorProjection.js +31 -12
  540. package/dist/domain/analysisProfile.js +7 -3
  541. package/dist/domain/analysisSnapshot.js +311 -184
  542. package/dist/domain/analysisView/WebNetworkApiSurfaceAccumulator.js +414 -0
  543. package/dist/domain/analysisView/analysisView.js +366 -44
  544. package/dist/domain/analysisView/analysisViewCoverage.js +32 -0
  545. package/dist/domain/analysisView/analysisViewErrors.js +4 -0
  546. package/dist/domain/analysisView/analysisViewParent.js +12 -0
  547. package/dist/domain/analysisView/analysisViewText.js +29 -0
  548. package/dist/domain/analysisView/androidPackageView.js +102 -0
  549. package/dist/domain/analysisView/artifactInventoryView.js +140 -0
  550. package/dist/domain/analysisView/binaryLayoutView.js +11 -4
  551. package/dist/domain/analysisView/dartAotView.js +93 -0
  552. package/dist/domain/analysisView/evmInterfaceView.js +105 -0
  553. package/dist/domain/analysisView/interfaceBuilderView.js +182 -0
  554. package/dist/domain/analysisView/javascriptApplicationView.js +29 -28
  555. package/dist/domain/analysisView/machoView.js +186 -0
  556. package/dist/domain/analysisView/managedArtifactView.js +108 -0
  557. package/dist/domain/analysisView/managedMemberView.js +209 -0
  558. package/dist/domain/analysisView/nativeFunctionView.js +20 -25
  559. package/dist/domain/analysisView/pcapCaptureView.js +264 -0
  560. package/dist/domain/analysisView/qlogCaptureView.js +198 -0
  561. package/dist/domain/analysisView/wasmArtifactView.js +162 -0
  562. package/dist/domain/analysisView/webNetworkApiSurfaceView.js +123 -0
  563. package/dist/domain/analysisView/webNetworkCaptureView.js +388 -0
  564. package/dist/domain/android/androidAnalysis.js +36 -2
  565. package/dist/domain/android/androidApplication.js +32 -60
  566. package/dist/domain/apktool/apktoolResourceAnalysis.js +19 -7
  567. package/dist/domain/apple/appleApplication.js +31 -29
  568. package/dist/domain/apple/appleArchiveFormat.js +184 -0
  569. package/dist/domain/apple/appleAssetCatalog.js +15 -0
  570. package/dist/domain/apple/appleBundleAnatomy.js +1 -1
  571. package/dist/domain/apple/dyldPaths.js +9 -2
  572. package/dist/domain/apple/dylibResolution.js +19 -9
  573. package/dist/domain/apple/dylibResolutionFindings.js +8 -9
  574. package/dist/domain/apple/interfaceBuilderGraph.js +50 -26
  575. package/dist/domain/apple/interfaceBuilderKeyedArchive.js +28 -8
  576. package/dist/domain/apple/machoContainer.js +120 -8
  577. package/dist/domain/apple/machoCpuIdentity.js +4 -0
  578. package/dist/domain/apple/plistValue.js +6 -1
  579. package/dist/domain/artifactComparison.js +109 -32
  580. package/dist/domain/artifactDecompressionBudget.js +26 -0
  581. package/dist/domain/artifactGraph.js +23 -6
  582. package/dist/domain/artifactIdentity.js +4 -1
  583. package/dist/domain/artifactInspection.js +44 -2
  584. package/dist/domain/artifactInventoryEvidence.js +137 -39
  585. package/dist/domain/binaryTarget.js +251 -94
  586. package/dist/domain/binaryTargetTypes.js +14 -1
  587. package/dist/domain/browserNetworkEvidence.js +4 -0
  588. package/dist/domain/browserObservation.js +88 -29
  589. package/dist/domain/browserObservationSchemas.js +4 -1
  590. package/dist/domain/browserScenarioCapture.js +2 -1
  591. package/dist/domain/browserScenarioCaptureValues.js +26 -2
  592. package/dist/domain/browserScenarioDiff.js +120 -11
  593. package/dist/domain/browserScenarioDiffEvidence.js +46 -13
  594. package/dist/domain/browserScenarioDiffValues.js +10 -3
  595. package/dist/domain/browserScenarioNetworkComparison.js +158 -0
  596. package/dist/domain/browserScenarioNormalization.js +10 -13
  597. package/dist/domain/browserScenarioValues.js +2 -12
  598. package/dist/domain/browserSession.js +2 -2
  599. package/dist/domain/bundleComparison.js +1 -5
  600. package/dist/domain/callPath.js +40 -3
  601. package/dist/domain/captures/packetCapture.js +138 -0
  602. package/dist/domain/captures/packetFields.js +81 -0
  603. package/dist/domain/changedBehavior.js +43 -41
  604. package/dist/domain/comparisonSourceEvidence.js +6 -0
  605. package/dist/domain/dosCom.js +2 -2
  606. package/dist/domain/dosMz.js +52 -14
  607. package/dist/domain/electron/electronFuses.js +360 -0
  608. package/dist/domain/elfFixedHeader.js +42 -0
  609. package/dist/domain/evidence.js +103 -38
  610. package/dist/domain/evidenceBundle.js +58 -20
  611. package/dist/domain/evidenceErrors.js +5 -0
  612. package/dist/domain/evm/evmInterface.js +18 -4
  613. package/dist/domain/evm/solidityMetadata.js +70 -0
  614. package/dist/domain/explicitSensitiveFailure.js +42 -24
  615. package/dist/domain/firmware/firmwareAnalysis.js +29 -0
  616. package/dist/domain/flutter/flutterBuildAnalysis.js +141 -0
  617. package/dist/domain/functionCallCoverage.js +60 -0
  618. package/dist/domain/functionComparisonDimensions.js +101 -10
  619. package/dist/domain/functionComparisonNormalization.js +66 -10
  620. package/dist/domain/functionComparisonResults.js +7 -6
  621. package/dist/domain/functionComparisonSchemas.js +14 -3
  622. package/dist/domain/functionDossierEvidence.js +3 -0
  623. package/dist/domain/go/goBinary.js +96 -0
  624. package/dist/domain/harmony/harmonyApplication.js +156 -0
  625. package/dist/domain/hopperErrors.js +15 -16
  626. package/dist/domain/hopperPublisher.js +12 -0
  627. package/dist/domain/hopperValues.js +112 -34
  628. package/dist/domain/javascript/electronObservation.js +4 -1
  629. package/dist/domain/javascript/electronStaticAnalysisBrowser.js +15 -14
  630. package/dist/domain/javascript/electronStaticAnalysisIpc.js +3 -1
  631. package/dist/domain/javascript/electronStaticAnalysisNative.js +19 -5
  632. package/dist/domain/javascript/electronStaticAnalysisValues.js +14 -8
  633. package/dist/domain/javascript/electronWrappedCallPaths.js +498 -0
  634. package/dist/domain/javascript/htmlArtifactReferences.js +94 -4
  635. package/dist/domain/javascript/javascriptAnalysisResourceControls.js +21 -1
  636. package/dist/domain/javascript/javascriptApplicationAnalysis.js +3 -0
  637. package/dist/domain/javascript/javascriptApplicationChangeGraph.js +7 -2
  638. package/dist/domain/javascript/javascriptApplicationEvidenceSchemas.js +1 -1
  639. package/dist/domain/javascript/javascriptApplicationGraph.js +17 -1
  640. package/dist/domain/javascript/javascriptApplicationGraphSchemas.js +1 -0
  641. package/dist/domain/javascript/javascriptApplicationProjectionResources.js +8 -0
  642. package/dist/domain/javascript/javascriptApplicationVersionKeys.js +31 -18
  643. package/dist/domain/javascript/javascriptArtifactFiles.js +2 -1
  644. package/dist/domain/javascript/javascriptAstFingerprint.js +51 -17
  645. package/dist/domain/javascript/javascriptAstValues.js +52 -3
  646. package/dist/domain/javascript/javascriptBootstrap.js +94 -0
  647. package/dist/domain/javascript/javascriptBootstrapIntegrity.js +372 -0
  648. package/dist/domain/javascript/javascriptBuiltinResourceMethods.js +8 -0
  649. package/dist/domain/javascript/javascriptBundledRequireOrigin.js +291 -0
  650. package/dist/domain/javascript/javascriptContextBridgeExposure.js +23 -0
  651. package/dist/domain/javascript/javascriptElectronMemberWrites.js +86 -22
  652. package/dist/domain/javascript/javascriptExportShapeComparisonSchemas.js +6 -5
  653. package/dist/domain/javascript/javascriptExportShapeVariants.js +1 -1
  654. package/dist/domain/javascript/javascriptFeatureSeed.js +33 -16
  655. package/dist/domain/javascript/javascriptFeatureTrace.js +9 -3
  656. package/dist/domain/javascript/javascriptFeatureTraceSchemas.js +42 -11
  657. package/dist/domain/javascript/javascriptIntrinsicInvocation.js +132 -0
  658. package/dist/domain/javascript/javascriptModuleDeclaration.js +28 -0
  659. package/dist/domain/javascript/javascriptModuleInterop.js +618 -0
  660. package/dist/domain/javascript/javascriptModuleResolutionMode.js +18 -0
  661. package/dist/domain/javascript/javascriptModuleSpecifier.js +5 -0
  662. package/dist/domain/javascript/javascriptNativeHandoff.js +0 -1
  663. package/dist/domain/javascript/javascriptPackageImportAliases.js +58 -0
  664. package/dist/domain/javascript/javascriptRecovery.js +12 -5
  665. package/dist/domain/javascript/javascriptRpcEndpoints.js +119 -41
  666. package/dist/domain/javascript/javascriptRuntimeLoadState.js +11 -0
  667. package/dist/domain/javascript/javascriptRuntimeObservation.js +4 -1
  668. package/dist/domain/javascript/javascriptRuntimeReconciliationCaptureParsing.js +10 -4
  669. package/dist/domain/javascript/javascriptRuntimeReconciliationMatching.js +15 -2
  670. package/dist/domain/javascript/javascriptRuntimeReconciliationResult.js +0 -1
  671. package/dist/domain/javascript/javascriptRuntimeReconciliationSchemas.js +5 -4
  672. package/dist/domain/javascript/javascriptRuntimeStaticCandidates.js +113 -11
  673. package/dist/domain/javascript/javascriptSemanticAmbientWrites.js +251 -0
  674. package/dist/domain/javascript/javascriptSemanticAnalysis.js +340 -108
  675. package/dist/domain/javascript/javascriptSemanticAsyncEffects.js +17 -34
  676. package/dist/domain/javascript/javascriptSemanticCallResolution.js +4 -3
  677. package/dist/domain/javascript/javascriptSemanticCallableStack.js +52 -0
  678. package/dist/domain/javascript/javascriptSemanticCalls.js +6 -11
  679. package/dist/domain/javascript/javascriptSemanticChildProcesses.js +42 -55
  680. package/dist/domain/javascript/javascriptSemanticDataEffectHelpers.js +428 -32
  681. package/dist/domain/javascript/javascriptSemanticDataEffects.js +14 -20
  682. package/dist/domain/javascript/javascriptSemanticDependencies.js +69 -0
  683. package/dist/domain/javascript/javascriptSemanticFingerprints.js +11 -14
  684. package/dist/domain/javascript/javascriptSemanticGraph.js +5 -1
  685. package/dist/domain/javascript/javascriptSemanticGraphSchemas.js +0 -1
  686. package/dist/domain/javascript/javascriptSemanticIterationSources.js +2 -2
  687. package/dist/domain/javascript/javascriptSemanticMemberMutations.js +224 -91
  688. package/dist/domain/javascript/javascriptSemanticMutationInitializers.js +199 -3
  689. package/dist/domain/javascript/javascriptSemanticObjectReferences.js +333 -43
  690. package/dist/domain/javascript/javascriptSemanticObjects.js +20 -16
  691. package/dist/domain/javascript/javascriptSemanticProjection.js +151 -43
  692. package/dist/domain/javascript/javascriptSemanticPromises.js +6 -9
  693. package/dist/domain/javascript/javascriptSemanticProvenance.js +5 -1
  694. package/dist/domain/javascript/javascriptSemanticQuery.js +7 -2
  695. package/dist/domain/javascript/javascriptSemanticReferenceSources.js +25 -0
  696. package/dist/domain/javascript/javascriptSemanticRequireOrigin.js +331 -8
  697. package/dist/domain/javascript/javascriptSemanticResources.js +6 -40
  698. package/dist/domain/javascript/javascriptSemanticReturnedReferences.js +14 -0
  699. package/dist/domain/javascript/javascriptSemanticReturns.js +37 -30
  700. package/dist/domain/javascript/javascriptSemanticState.js +39 -2
  701. package/dist/domain/javascript/javascriptSemanticTraversal.js +6 -4
  702. package/dist/domain/javascript/javascriptSemanticValues.js +227 -30
  703. package/dist/domain/javascript/javascriptSourceMapPaths.js +44 -17
  704. package/dist/domain/javascript/javascriptSourceParser.js +72 -3
  705. package/dist/domain/javascript/javascriptSourceSelection.js +11 -0
  706. package/dist/domain/javascript/javascriptStaticAnalysis.js +51 -17
  707. package/dist/domain/javascript/javascriptStaticAnalysisBundler.js +97 -23
  708. package/dist/domain/javascript/javascriptStaticAnalysisCalls.js +224 -44
  709. package/dist/domain/javascript/javascriptStaticAnalysisHelpers.js +166 -56
  710. package/dist/domain/javascript/javascriptStaticAnalysisState.js +1 -0
  711. package/dist/domain/javascript/javascriptStaticAnalysisTypes.js +2 -1
  712. package/dist/domain/javascript/javascriptSymbolicBindings.js +836 -0
  713. package/dist/domain/javascript/javascriptSymbolicControlFlow.js +40 -0
  714. package/dist/domain/javascript/javascriptSymbolicValues.js +34 -0
  715. package/dist/domain/javascript/sourceToBundleComparison.js +3 -1
  716. package/dist/domain/javascript/sourceToBundleComparisonSchemas.js +2 -0
  717. package/dist/domain/javascript/sourceToBundleSignals.js +47 -13
  718. package/dist/domain/jsonValue.js +37 -12
  719. package/dist/domain/localPath.js +6 -3
  720. package/dist/domain/managed/managedApplicationGraph.js +5 -0
  721. package/dist/domain/managed/managedApplicationGraphCoverage.js +6 -2
  722. package/dist/domain/managed/managedApplicationGraphNodes.js +0 -1
  723. package/dist/domain/managed/managedArtifact.js +51 -1
  724. package/dist/domain/managed/managedInspectionEvidence.js +5 -6
  725. package/dist/domain/managed/managedMemberComparison.js +3 -0
  726. package/dist/domain/managed/managedMemberComparisonCoverage.js +23 -3
  727. package/dist/domain/managed/managedMemberComparisonItems.js +23 -19
  728. package/dist/domain/managed/managedMemberComparisonMatch.js +209 -18
  729. package/dist/domain/managed/managedNativeVerificationMatch.js +49 -26
  730. package/dist/domain/managed/managedNativeVerificationSchemas.js +13 -2
  731. package/dist/domain/managed/managedReconstruction.js +5 -8
  732. package/dist/domain/mobileApplicationGraphProjection.js +80 -0
  733. package/dist/domain/native/addressCoordinate.js +11 -0
  734. package/dist/domain/native/binaryLayout.js +2 -4
  735. package/dist/domain/native/bytePattern.js +100 -0
  736. package/dist/domain/native/nativeAotPe.js +2 -2
  737. package/dist/domain/native/nativeInspection.js +38 -4
  738. package/dist/domain/native/nativeInstruction.js +17 -2
  739. package/dist/domain/native/nativeInvestigationGraph.js +9 -5
  740. package/dist/domain/native/nativeLoadImage.js +19 -1
  741. package/dist/domain/native/nativeUiObservation.js +5 -6
  742. package/dist/domain/native/objcSwiftMetadata.js +4 -1
  743. package/dist/domain/native/peResources.js +8 -2
  744. package/dist/domain/native/recordedCrash.js +79 -10
  745. package/dist/domain/offsetDateTime.js +60 -0
  746. package/dist/domain/pcap/pcapAnalysis.js +91 -0
  747. package/dist/domain/pcap/pcapEvidence.js +15 -0
  748. package/dist/domain/peMachine.js +36 -0
  749. package/dist/domain/pngHeader.js +18 -0
  750. package/dist/domain/process/processCaptureCoverage.js +26 -3
  751. package/dist/domain/process/processCaptureExample.js +2 -0
  752. package/dist/domain/process/processCaptureValidation.js +33 -8
  753. package/dist/domain/process/processComparison.js +41 -13
  754. package/dist/domain/process/processScenario.js +7 -0
  755. package/dist/domain/process/processTraceEvaluation.js +54 -50
  756. package/dist/domain/process/processTraceSpecification.js +243 -89
  757. package/dist/domain/propertyListKeys.js +211 -11
  758. package/dist/domain/propertyListXmlText.js +20 -4
  759. package/dist/domain/providerAdapterError.js +0 -5
  760. package/dist/domain/providerConfigurationRefusal.js +12 -0
  761. package/dist/domain/providerSelectionError.js +2 -1
  762. package/dist/domain/qlogCapture.js +62 -0
  763. package/dist/domain/rawBinary.js +96 -0
  764. package/dist/domain/reconstructionCoverage.js +5 -1
  765. package/dist/domain/reconstructionCoverageEvaluation.js +18 -15
  766. package/dist/domain/reconstructionCoverageVerifierResults.js +35 -0
  767. package/dist/domain/reconstructionObligationLedgerIntegrity.js +114 -0
  768. package/dist/domain/reconstructionObligationLedgerSchemas.js +104 -1
  769. package/dist/domain/reconstructionReadiness.js +4 -8
  770. package/dist/domain/reconstructionReadinessJourneyFindings.js +4 -1
  771. package/dist/domain/reconstructionUnknowns.js +9 -1
  772. package/dist/domain/reconstructionVerification.js +54 -25
  773. package/dist/domain/recordedTransportUrl.js +59 -0
  774. package/dist/domain/referenceSourceClassification.js +27 -23
  775. package/dist/domain/referenceSourceGraph.js +51 -13
  776. package/dist/domain/referenceSourceImportParsing.js +23 -13
  777. package/dist/domain/referenceSourcePathIdentity.js +11 -1
  778. package/dist/domain/referenceSourceRequireBindings.js +5 -12
  779. package/dist/domain/referenceSourceSummary.js +92 -0
  780. package/dist/domain/relationshipCoverage.js +44 -0
  781. package/dist/domain/residualUnknown.js +93 -26
  782. package/dist/domain/reverseEngineering.js +31 -0
  783. package/dist/domain/runtimeVersion.js +8 -0
  784. package/dist/domain/rust/rustBinary.js +200 -0
  785. package/dist/domain/signals/annotationTextWindow.js +31 -0
  786. package/dist/domain/signals/signalDecoders.js +69 -0
  787. package/dist/domain/signals/signalRecording.js +115 -0
  788. package/dist/domain/sourceMapContents.js +10 -3
  789. package/dist/domain/sourceMapEnvelope.js +17 -11
  790. package/dist/domain/sqlite/sqliteDatabase.js +188 -0
  791. package/dist/domain/staticRuntimeCorrelation.js +7 -9
  792. package/dist/domain/swiftSymbolClassification.js +17 -0
  793. package/dist/domain/symbolAnalysis.js +16 -4
  794. package/dist/domain/urlComponents.js +6 -0
  795. package/dist/domain/wasm/wasmArtifact.js +119 -0
  796. package/dist/domain/wasm/wasmInterface.js +89 -0
  797. package/dist/domain/webBundleAnalysis.js +14 -3
  798. package/dist/domain/webBundleAnalyzerAst.js +7 -2
  799. package/dist/domain/webBundleAnalyzerInspection.js +54 -38
  800. package/dist/domain/webBundleAnalyzerResult.js +18 -6
  801. package/dist/domain/webCaptureDiff.js +140 -39
  802. package/dist/domain/webCaptureFrameComparison.js +49 -0
  803. package/dist/domain/webMcpDiscovery.js +5 -2
  804. package/dist/domain/webModuleImports.js +22 -27
  805. package/dist/domain/webModuleTrace.js +3 -8
  806. package/dist/domain/webNetworkCapture.js +101 -39
  807. package/dist/domain/webNetworkCaptureCoordinates.js +21 -0
  808. package/dist/domain/webRuntime.js +0 -1
  809. package/dist/domain/webScreenshot.js +2 -2
  810. package/dist/domain/webScriptArtifacts.js +2 -4
  811. package/dist/domain/webScriptExport.js +6 -8
  812. package/dist/domain/webScriptExportPlan.js +2 -2
  813. package/dist/domain/webSourceLocation.js +20 -9
  814. package/dist/domain/zipPackageFormat.js +29 -3
  815. package/dist/dotnet/ManagedArtifactInspector.js +27 -12
  816. package/dist/dotnet/ManagedDecodeBudget.js +66 -8
  817. package/dist/dotnet/ManagedMemberInspector.js +101 -21
  818. package/dist/dotnet/ManagedMemberInspectorCore.js +356 -140
  819. package/dist/dotnet/ManagedMemberInstructionDecoder.js +109 -37
  820. package/dist/dotnet/ManagedMemberOwnership.js +65 -0
  821. package/dist/dotnet/ManagedMemberPointers.js +69 -0
  822. package/dist/dotnet/ManagedMemberRows.js +179 -46
  823. package/dist/dotnet/ManagedMetadataHeaps.js +110 -24
  824. package/dist/dotnet/ManagedMetadataInventory.js +5 -5
  825. package/dist/dotnet/ManagedMetadataInventoryRows.js +36 -52
  826. package/dist/dotnet/ManagedMetadataLayout.js +9 -1
  827. package/dist/dotnet/ManagedMetadataRowSizes.js +1 -1
  828. package/dist/dotnet/ManagedMethodBodyReader.js +29 -11
  829. package/dist/dotnet/ManagedMethodSpecs.js +78 -0
  830. package/dist/dotnet/ManagedNativeBoundaryHelpers.js +2 -2
  831. package/dist/dotnet/ManagedNativeBoundaryInspector.js +6 -13
  832. package/dist/dotnet/ManagedPeReader.js +55 -27
  833. package/dist/dotnet/ManagedReaderFailure.js +9 -0
  834. package/dist/dotnet/ManagedSnapshot.js +88 -0
  835. package/dist/dotnet/ManagedStaticProvider.js +55 -64
  836. package/dist/dotnet/ManagedTypeMemberLists.js +105 -0
  837. package/dist/dotnet/ManagedTypeNames.js +98 -0
  838. package/dist/dotnet/ManagedUserStrings.js +75 -0
  839. package/dist/electron/ElectronFusePath.js +247 -0
  840. package/dist/electron/ElectronFuseProvider.js +113 -0
  841. package/dist/electron/ElectronFuseReader.js +317 -0
  842. package/dist/evaluation/AgentEvaluationFixtures.js +194 -11
  843. package/dist/evaluation/CodexAgentEval.js +19 -40
  844. package/dist/evaluation/KnownAnswerEvaluation.js +126 -57
  845. package/dist/evm/EvmoleFailures.js +19 -14
  846. package/dist/evm/EvmoleInterfaceAdapter.js +5 -1
  847. package/dist/evm/EvmoleInterfaceProvider.js +141 -31
  848. package/dist/evm/EvmoleInterfaceWorker.js +2 -0
  849. package/dist/evm/SolidityMetadata.js +139 -0
  850. package/dist/filesystem/OwnedStagedOutput.js +138 -0
  851. package/dist/filesystem/RegularFile.js +48 -4
  852. package/dist/filesystem/readFileHandleChunks.js +17 -8
  853. package/dist/firmware/FirmwareCommand.js +2 -2
  854. package/dist/firmware/FirmwareFiles.js +8 -12
  855. package/dist/firmware/FirmwareProvider.js +2 -0
  856. package/dist/firmware/FirmwarePublication.js +218 -1
  857. package/dist/firmware/FirmwareReports.js +202 -12
  858. package/dist/flutter/DartElf.js +418 -0
  859. package/dist/flutter/ElfBuildId.js +137 -0
  860. package/dist/flutter/ElfLoadMap.js +91 -0
  861. package/dist/flutter/FlutterBuildProvider.js +826 -0
  862. package/dist/flutter/FlutterPayloadScan.js +180 -0
  863. package/dist/frida/FridaInstrumentationManager.js +1104 -0
  864. package/dist/gdb/GdbSessionManager.js +1451 -0
  865. package/dist/generatedPackageMetadata.js +2 -2
  866. package/dist/ghidra/GhidraAnalysisProfile.js +130 -12
  867. package/dist/ghidra/GhidraClient.js +195 -88
  868. package/dist/ghidra/GhidraDiagnostics.js +7 -0
  869. package/dist/ghidra/GhidraDoctor.js +15 -12
  870. package/dist/ghidra/GhidraFunctionValues.js +49 -2
  871. package/dist/ghidra/GhidraInstallation.js +215 -19
  872. package/dist/ghidra/GhidraInstallationPolicy.js +79 -29
  873. package/dist/ghidra/GhidraInventoryValues.js +30 -0
  874. package/dist/ghidra/GhidraJavaLaunch.js +91 -10
  875. package/dist/ghidra/GhidraJavaProperties.js +117 -0
  876. package/dist/ghidra/GhidraLanguageCatalog.js +74 -4
  877. package/dist/ghidra/GhidraLauncher.js +234 -57
  878. package/dist/ghidra/GhidraLoadImageAttest.js +28 -8
  879. package/dist/ghidra/GhidraLoadImageValues.js +72 -0
  880. package/dist/ghidra/GhidraMipsProfile.js +250 -14
  881. package/dist/ghidra/GhidraPeProfile.js +21 -0
  882. package/dist/ghidra/GhidraPowerPcProfile.js +51 -0
  883. package/dist/ghidra/GhidraProvider.js +54 -16
  884. package/dist/ghidra/GhidraProviderCapabilities.js +13 -12
  885. package/dist/ghidra/GhidraProviderClient.js +260 -57
  886. package/dist/ghidra/GhidraPspExtension.js +140 -0
  887. package/dist/ghidra/GhidraPspProfile.js +59 -0
  888. package/dist/ghidra/GhidraRawBinaryLanguage.js +40 -0
  889. package/dist/ghidra/GhidraRiscvProfile.js +100 -0
  890. package/dist/ghidra/GhidraSessionError.js +155 -11
  891. package/dist/ghidra/GhidraSessionValues.js +66 -0
  892. package/dist/ghidra/GhidraTransport.js +2 -1
  893. package/dist/go/GoBinaryContainer.js +140 -0
  894. package/dist/go/GoBinaryImage.js +210 -0
  895. package/dist/go/GoBinaryProvider.js +151 -0
  896. package/dist/go/GoElfImage.js +211 -0
  897. package/dist/go/GoMachoImage.js +164 -0
  898. package/dist/go/GoModuleText.js +217 -0
  899. package/dist/go/GoPeImage.js +124 -0
  900. package/dist/hopper/BridgeLauncher.js +35 -2
  901. package/dist/hopper/HopperAnalysisProfile.js +21 -11
  902. package/dist/hopper/HopperCleanup.js +15 -3
  903. package/dist/hopper/HopperClient.js +188 -36
  904. package/dist/hopper/HopperMacPublisher.js +29 -0
  905. package/dist/hopper/HopperMachOImage.js +61 -29
  906. package/dist/hopper/HopperProcessDiagnostic.js +27 -0
  907. package/dist/hopper/HopperProvider.js +59 -28
  908. package/dist/hopper/HopperProviderCapabilities.js +7 -3
  909. package/dist/hopper/HopperRequestQueue.js +17 -5
  910. package/dist/hopper/HopperSessionValues.js +10 -1
  911. package/dist/hopper/HopperTargetLease.js +66 -19
  912. package/dist/ida/IdaBusyHealth.js +44 -0
  913. package/dist/ida/IdaCallGraph.js +134 -0
  914. package/dist/ida/IdaConfiguration.js +7 -2
  915. package/dist/ida/IdaDiagnosticRedactor.js +199 -0
  916. package/dist/ida/IdaDiagnosticWriter.js +62 -0
  917. package/dist/ida/IdaDoctor.js +7 -5
  918. package/dist/ida/IdaJsonDiagnostic.js +138 -0
  919. package/dist/ida/IdaMcpConnection.js +297 -27
  920. package/dist/ida/IdaNativeProtocol.js +93 -0
  921. package/dist/ida/IdaOperationRunner.js +246 -43
  922. package/dist/ida/IdaProtocolValues.js +86 -4
  923. package/dist/ida/IdaProvider.js +29 -10
  924. package/dist/ida/IdaProviderCapabilities.js +37 -8
  925. package/dist/ida/IdaSessionClient.js +331 -54
  926. package/dist/ida/IdaWorkspace.js +54 -6
  927. package/dist/inspector/V8InspectorCaptureProjection.js +7 -2
  928. package/dist/inspector/V8InspectorEndpoint.js +15 -13
  929. package/dist/inspector/V8InspectorProvider.js +41 -7
  930. package/dist/javascript/analysis/JavaScriptAnalysisTransfer.js +19 -8
  931. package/dist/javascript/analysis/JavaScriptAnalysisWorker.js +103 -29
  932. package/dist/javascript/analysis/JavaScriptAnalysisWorkerProtocol.js +6 -4
  933. package/dist/javascript/analysis/JavaScriptAnalysisWorkerSchemas.js +78 -9
  934. package/dist/javascript/analysis/JavaScriptAnalysisWorkerServer.js +15 -5
  935. package/dist/javascript/recovery/RecoveryFiles.js +51 -6
  936. package/dist/javascript/recovery/WakaruExecution.js +19 -11
  937. package/dist/javascript/recovery/WakaruProvider.js +12 -9
  938. package/dist/javascript/recovery/WakaruPublication.js +24 -10
  939. package/dist/javascript/recovery/WakaruRelease.js +1 -1
  940. package/dist/javascript/recovery/WakaruReport.js +3 -2
  941. package/dist/javascript/sourceMaps/DecodedSourceMap.js +2 -16
  942. package/dist/javascript/sourceMaps/SourceMapCommand.js +22 -4
  943. package/dist/javascript/sourceMaps/SourceMapDecoder.js +22 -4
  944. package/dist/javascript/sourceMaps/SourceMapFormat.js +25 -38
  945. package/dist/javascript/sourceMaps/TraceSourceMap.js +34 -6
  946. package/dist/jeb/JebMcpConnection.js +19 -12
  947. package/dist/jeb/JebMcpEndpoint.js +6 -1
  948. package/dist/jeb/JebProvider.js +5 -7
  949. package/dist/logger.js +14 -1
  950. package/dist/main/shutdown.js +3 -0
  951. package/dist/main/transport.js +48 -4
  952. package/dist/main.js +14 -3
  953. package/dist/mcp/AnalysisSnapshotFiles-BAbiJQOc.js +1412 -0
  954. package/dist/mcp/ArtifactProvider-DViCU_rn.js +2183 -0
  955. package/dist/mcp/ArtifactProviderMetadata-b7pOK5_t.js +76 -0
  956. package/dist/mcp/ArtifactReader-OyM03Gjn.js +55 -0
  957. package/dist/mcp/ArtifactResourceScope-P3tq5z8Z.js +162 -0
  958. package/dist/mcp/AsarHeader-WsPgoooH.js +31 -0
  959. package/dist/mcp/BinarySessionStatus-B4P9gf-S.js +212 -0
  960. package/dist/mcp/BinaryTargetResolver-BMaE_0H1.js +1427 -0
  961. package/dist/mcp/BoundedFileBytes-DuczXiQZ.js +68 -0
  962. package/dist/mcp/CdpCaptureDocuments-HDiF2O7k.js +746 -0
  963. package/dist/mcp/CdpCaptureValues-M-j6CIh1.js +90 -0
  964. package/dist/mcp/CdpConnection-BpDfz4MK.js +570 -0
  965. package/dist/mcp/CdpOptionalCommand-BPjRD9Kz.js +120 -0
  966. package/dist/mcp/CdpTargetSession-BsPoKhEU.js +86 -0
  967. package/dist/mcp/DirectAnalysis-DrafbXke.js +409 -0
  968. package/dist/mcp/DirectAnalysisStatus-CjjeDLzW.js +44 -0
  969. package/dist/mcp/ElectronFileScope-BPG_YoyU.js +110 -0
  970. package/dist/mcp/InterfaceBuilderDecodeBudget-5F2AkxJT.js +652 -0
  971. package/dist/mcp/ManagedStaticProvider-BthZbKyZ.js +5028 -0
  972. package/dist/mcp/NativeMacOSProvider-Bh79k8dI.js +4867 -0
  973. package/dist/mcp/NativeMacOSProviderMetadata-N1lPOaY_.js +307 -0
  974. package/dist/mcp/ProcedureAddressResolution-CQpuwm1h.js +19 -0
  975. package/dist/mcp/ProcessOwnership-Bl_3ejLe.js +1502 -0
  976. package/dist/mcp/ProviderDeadline-DskQ94YD.js +932 -0
  977. package/dist/mcp/WorkflowEvidence-umWrB_wm.js +111 -0
  978. package/dist/mcp/analysisErrorCore-DXRTvF_m.js +235 -0
  979. package/dist/mcp/analysisErrorProjection-BN0EPM-3.js +892 -0
  980. package/dist/mcp/artifactOperationError-CkHMMaf7.js +27 -0
  981. package/dist/mcp/artifactToolContracts-Di4qZlEt.js +72 -0
  982. package/dist/mcp/browserObservation-C0s4i8UI.js +4468 -0
  983. package/dist/mcp/browserObservationError-CyLugqX4.js +40 -0
  984. package/dist/mcp/browserObservationSchemas-tgqjH7aA.js +573 -0
  985. package/dist/mcp/browserScenario-CAQ8Fns9.js +2929 -0
  986. package/dist/mcp/browserScenarioCapture-CTNFN-FI.js +479 -0
  987. package/dist/mcp/canonicalDigest-Bi_0_zGi.js +71 -0
  988. package/dist/mcp/digests-BFoWUT_-.js +223 -0
  989. package/dist/mcp/electronActiveObservation-lDvQTMR0.js +226 -0
  990. package/dist/mcp/electronObservation-DFOFEood.js +112 -0
  991. package/dist/mcp/electronObservation-i7LcILQ-.js +562 -0
  992. package/dist/mcp/electronScenario-nCzE6IfJ.js +653 -0
  993. package/dist/mcp/emptyArraySchema-tL6Qymyd.js +140 -0
  994. package/dist/mcp/enhancedInputs-DgdEnzHy.js +56 -0
  995. package/dist/mcp/javascriptRuntimeObservation-61NhCf7H.js +690 -0
  996. package/dist/mcp/javascriptRuntimeObservation-PIUoLfX6.js +121 -0
  997. package/dist/mcp/jsonSerialization-V-wWiFRE.js +152 -0
  998. package/dist/mcp/lipo-Bnkoq_6W.js +502 -0
  999. package/dist/mcp/localPath-AxvW9aPe.js +19 -0
  1000. package/dist/mcp/logger-BQY5ulYv.js +48 -0
  1001. package/dist/mcp/main-kBXHZ8S5.js +69390 -0
  1002. package/dist/mcp/main.js +6 -0
  1003. package/dist/mcp/managedToolContracts-CK--I_s7.js +101 -0
  1004. package/dist/mcp/nativeValueTrace-DR9UE62L.js +3439 -0
  1005. package/dist/mcp/officialToolContracts-B67NJ2tC.js +1413 -0
  1006. package/dist/mcp/pngHeader-DQ-ObyY2.js +147 -0
  1007. package/dist/mcp/propertyListKeys-DD25WsjI.js +553 -0
  1008. package/dist/mcp/providerAdapterError-sDxToNal.js +25 -0
  1009. package/dist/mcp/providerIdentities--ptAh481.js +31 -0
  1010. package/dist/mcp/providerIdentity-BCQ5n5tw.js +16 -0
  1011. package/dist/mcp/providerOperationHealth-CTYa3iLf.js +48 -0
  1012. package/dist/mcp/rolldown-runtime-BjeaiXFo.js +121 -0
  1013. package/dist/mcp/safeJson-NeGfpkrI.js +25 -0
  1014. package/dist/mcp/scanCanonical-CRXSpule.js +3982 -0
  1015. package/dist/mcp/serverIdentity-Cio4iFV3.js +1328 -0
  1016. package/dist/mcp/sourceMapEnvelope-C0uJlrOh.js +94 -0
  1017. package/dist/mcp/toolContracts-BW05wpcr.js +12200 -0
  1018. package/dist/mcp/toolOutputSchemaGroups-ColvNZ1r.js +17533 -0
  1019. package/dist/mcp/unicodeCodePointOrder-BezCbTpg.js +26 -0
  1020. package/dist/mcp/webContentArtifact-Dzjc1z-R.js +284 -0
  1021. package/dist/mcp/webRuntime-K__NYzXm.js +74 -0
  1022. package/dist/mcp/webSourceLocation-DbMAT2J9.js +11130 -0
  1023. package/dist/mcpDoctor.js +93 -70
  1024. package/dist/mcpStartupPolicy.js +3 -0
  1025. package/dist/native/AppleDispatchCoverage.js +57 -17
  1026. package/dist/native/AppleDispatchMetadata.js +6 -2
  1027. package/dist/native/AppleMachoFixups.js +188 -25
  1028. package/dist/native/AppleMachoSelection.js +30 -23
  1029. package/dist/native/AppleObjcCategories.js +1 -2
  1030. package/dist/native/AppleObjcDispatchFacets.js +76 -7
  1031. package/dist/native/CommandRunner.js +142 -32
  1032. package/dist/native/LldbCallTracer.js +5 -3
  1033. package/dist/native/MachoArchitectureSelection.js +50 -0
  1034. package/dist/native/NativeCallObservation.js +2 -1
  1035. package/dist/native/NativeMacOSProvider.js +90 -29
  1036. package/dist/native/NativeMachoInspection.js +136 -76
  1037. package/dist/native/NativeUiObservation.js +2 -2
  1038. package/dist/native/SignatureTargetBinding.js +118 -55
  1039. package/dist/native/parsers/codesign.js +27 -10
  1040. package/dist/native/parsers/demangle.js +7 -1
  1041. package/dist/native/parsers/dyldInfo.js +73 -4
  1042. package/dist/native/parsers/lipo.js +53 -19
  1043. package/dist/native/parsers/machoUuid.js +150 -0
  1044. package/dist/native/parsers/otool.js +232 -29
  1045. package/dist/native/pe/PeResourcesProvider.js +20 -6
  1046. package/dist/native/pwndbg/PwndbgCoreContext.js +20 -20
  1047. package/dist/native/pwntools/PwntoolsDecoder.js +264 -40
  1048. package/dist/native/pwntools/PwntoolsFailures.js +2 -1
  1049. package/dist/native/pwntools/PwntoolsInputLimit.js +27 -0
  1050. package/dist/native/pwntools/PwntoolsRecordedCrashProvider.js +27 -15
  1051. package/dist/native/pwntools/PwntoolsResourceLimits.js +3 -3
  1052. package/dist/native/pwntools/RecordedCrashSourceBindings.js +12 -8
  1053. package/dist/native/pwntools/RecordedCrashStructureBindings.js +3 -1
  1054. package/dist/objdump/ObjdumpCommand.js +21 -0
  1055. package/dist/pcap/PcapCommand.js +146 -0
  1056. package/dist/pcap/PcapConfiguration.js +93 -0
  1057. package/dist/pcap/PcapNativeBound.js +58 -0
  1058. package/dist/pcap/PcapOutput.js +240 -0
  1059. package/dist/pcap/PcapProvider.js +424 -0
  1060. package/dist/pcap/PcapSnapshot.js +171 -0
  1061. package/dist/process/ArtifactAnalysisResources.js +213 -0
  1062. package/dist/process/CurrentEntrypointPath.js +6 -0
  1063. package/dist/process/DarwinProcessRunTokenReader.js +117 -13
  1064. package/dist/process/ExecFileBoundedOutput.js +44 -0
  1065. package/dist/process/ExecFileOutput.js +30 -6
  1066. package/dist/process/JavaScriptWorkerMemoryLimit.js +25 -0
  1067. package/dist/process/LinuxResourceLimits.js +80 -0
  1068. package/dist/process/MacCodeSignature.js +3 -0
  1069. package/dist/process/OwnedCommand.js +37 -13
  1070. package/dist/process/PrivateRuntimeRoot.js +9 -19
  1071. package/dist/process/PrivateRuntimeRootUnavailableError.js +10 -0
  1072. package/dist/process/ProcessOwnership.js +70 -17
  1073. package/dist/process/ProcessOwnershipObservation.js +35 -4
  1074. package/dist/process/ProviderDeadline.js +58 -12
  1075. package/dist/process/ProviderProcess.js +108 -11
  1076. package/dist/process/WindowsAuthority.js +48 -39
  1077. package/dist/process/WindowsBatchCommand.js +46 -0
  1078. package/dist/process/boundedUtf8Text.js +13 -0
  1079. package/dist/process/capture/FilesystemSnapshot.js +60 -9
  1080. package/dist/process/capture/ProcessCaptureClock.js +2 -0
  1081. package/dist/process/capture/ProcessCaptureError.js +22 -3
  1082. package/dist/process/capture/ProcessCaptureJournal.js +2 -1
  1083. package/dist/process/capture/ProcessCaptureLifecycle.js +87 -36
  1084. package/dist/process/capture/ProcessCaptureProgress.js +2 -1
  1085. package/dist/process/capture/ProcessHarness.js +17 -14
  1086. package/dist/process/capture/ProcessNormalization.js +278 -36
  1087. package/dist/process/capture/ProcessSampling.js +3 -2
  1088. package/dist/process/capture/ProcessScenarioRuntimeValidation.js +13 -13
  1089. package/dist/process/capture/TerminalRenderer.js +31 -10
  1090. package/dist/process/ownedDebuggerSession.js +203 -0
  1091. package/dist/reference/ReferenceSourceReader.js +0 -1
  1092. package/dist/reference/ReferenceSourceReaderEntries.js +68 -54
  1093. package/dist/reference/ReferenceSourceReaderErrors.js +5 -1
  1094. package/dist/reference/ReferenceSourceReaderFile.js +0 -1
  1095. package/dist/reference/ReferenceSourceReaderTypes.js +1 -2
  1096. package/dist/reference/ReferenceSourceReaderValidate.js +0 -1
  1097. package/dist/rizin/RizinCommand.js +14 -0
  1098. package/dist/rizin/RizinDebugSessionManager.js +1072 -0
  1099. package/dist/rust/RustAuditableReader.js +309 -0
  1100. package/dist/rust/RustBinaryImage.js +116 -0
  1101. package/dist/rust/RustBinaryProvider.js +162 -0
  1102. package/dist/server/EvidenceMcpServer.js +160 -37
  1103. package/dist/server/admittedToolOperation.js +7 -2
  1104. package/dist/server/contractToolHandler.js +8 -1
  1105. package/dist/server/createServer.js +157 -27
  1106. package/dist/server/externalMutationAdmission.js +50 -0
  1107. package/dist/server/mcpProgress.js +4 -2
  1108. package/dist/server/promptCompletion.js +19 -6
  1109. package/dist/server/providerEnvironment.js +3 -0
  1110. package/dist/server/registerAnalysisViewTool.js +6 -2
  1111. package/dist/server/registerAndroidTools.js +22 -4
  1112. package/dist/server/registerApplicationTools/projectMobileApplicationGraph.js +8 -1
  1113. package/dist/server/registerArtifactTools.js +21 -1
  1114. package/dist/server/registerBrowserTools.js +2 -4
  1115. package/dist/server/registerBundleComparisonTool.js +4 -4
  1116. package/dist/server/registerCaptureTools.js +12 -0
  1117. package/dist/server/registerCutterTools.js +33 -0
  1118. package/dist/server/registerElectronTools.js +12 -9
  1119. package/dist/server/registerEnhancedTools.js +7 -6
  1120. package/dist/server/registerEvidenceTools.js +14 -10
  1121. package/dist/server/registerEvmTools.js +22 -4
  1122. package/dist/server/registerFlutterTools.js +17 -0
  1123. package/dist/server/registerFridaTools.js +205 -0
  1124. package/dist/server/registerFunctionComparisonTool.js +29 -9
  1125. package/dist/server/registerGdbTools.js +64 -0
  1126. package/dist/server/registerGoTools.js +9 -0
  1127. package/dist/server/registerInvestigationTools/helpers.js +2 -2
  1128. package/dist/server/registerInvestigationTools.js +12 -8
  1129. package/dist/server/registerJavaScriptRuntimeObservationTools.js +1 -5
  1130. package/dist/server/registerManagedTools.js +11 -1
  1131. package/dist/server/registerNativeTools.js +14 -0
  1132. package/dist/server/registerOfficialTools.js +5 -0
  1133. package/dist/server/registerPcapTools.js +35 -0
  1134. package/dist/server/registerProcessComparisonTool.js +9 -2
  1135. package/dist/server/registerReverseEngineeringTools.js +86 -0
  1136. package/dist/server/registerRizinDebugTools.js +53 -0
  1137. package/dist/server/registerRustTools.js +9 -0
  1138. package/dist/server/registerSessionRecordTools.js +19 -13
  1139. package/dist/server/registerSessionStatusTool.js +22 -4
  1140. package/dist/server/registerSessionTools.js +29 -16
  1141. package/dist/server/registerSignalTools.js +12 -0
  1142. package/dist/server/registerSqliteTools.js +9 -0
  1143. package/dist/server/registerWasmTools.js +46 -0
  1144. package/dist/server/registerWebNetworkCaptureTool.js +24 -10
  1145. package/dist/server/retainedSummaryDelivery.js +28 -0
  1146. package/dist/server/sessionAvailabilityPolicy.js +3 -0
  1147. package/dist/server/toolRegistrationOptions.js +8 -0
  1148. package/dist/server/toolResult.js +52 -19
  1149. package/dist/server/toolResultEncoding.js +36 -3
  1150. package/dist/serverIdentity.js +17 -8
  1151. package/dist/signals/SigrokRecordingProvider.js +339 -0
  1152. package/dist/signals/parseDecoderDiscovery.js +65 -0
  1153. package/dist/sqlite/SqliteDatabaseFailures.js +134 -0
  1154. package/dist/sqlite/SqliteDatabaseInspection.js +421 -0
  1155. package/dist/sqlite/SqliteDatabaseLimits.js +16 -0
  1156. package/dist/sqlite/SqliteDatabaseProvider.js +295 -0
  1157. package/dist/sqlite/SqliteDatabaseSnapshot.js +156 -0
  1158. package/dist/sqlite/SqliteDatabaseWorker.js +46 -0
  1159. package/dist/sqlite/SqliteDatabaseWorkerExecution.js +112 -0
  1160. package/dist/wasm/WabtArtifactProvider.js +336 -0
  1161. package/dist/wasm/WabtFailures.js +101 -0
  1162. package/dist/wasm/WabtInterface.js +309 -0
  1163. package/dist/wasm/WabtOutput.js +60 -0
  1164. package/dist/wasm/WabtRelease.js +12 -0
  1165. package/dist/wasm/WabtString.js +48 -0
  1166. package/dist/wasm/WabtWat.js +147 -0
  1167. package/dist/wasm/WasmGlueAdapter.js +53 -0
  1168. package/dist/wasm/WasmInterfaceBudget.js +11 -0
  1169. package/dist/windows/WindowsNativeLoader.js +37 -7
  1170. package/dist/windows/WindowsOwnedProcess.js +150 -17
  1171. package/dist/windows/WindowsPrivateRuntime.js +22 -1
  1172. package/install.sh +157 -98
  1173. package/licenses/Apache-2.0.txt +202 -0
  1174. package/licenses/GCC-Runtime-Library-Exception-3.1.txt +73 -0
  1175. package/licenses/GPL-3.0.txt +674 -0
  1176. package/licenses/LGPL-2.0.txt +480 -0
  1177. package/licenses/MIT-template.txt +18 -0
  1178. package/licenses/MinGW-w64-runtime.txt +240 -0
  1179. package/licenses/Node-22.19.0-LICENSE.txt +2666 -0
  1180. package/licenses/README.md +68 -0
  1181. package/licenses/cfworker-MIT.txt +21 -0
  1182. package/licenses/dotnet-runtime-MIT.txt +23 -0
  1183. package/licenses/frida-17.23.2-COPYING.txt +50 -0
  1184. package/licenses/ghidra-12.1.4-DISCLAIMER.txt +13 -0
  1185. package/licenses/ghidra-12.1.4-LICENSE.txt +201 -0
  1186. package/licenses/ghidra-12.1.4-NOTICE.txt +49 -0
  1187. package/licenses/npm-dependencies.txt +3612 -0
  1188. package/licenses/npm-runtime-notices.txt +8548 -0
  1189. package/licenses/upstream-sources.json +72 -0
  1190. package/licenses/xterm-MIT.txt +21 -0
  1191. package/native/windows/README.md +92 -11
  1192. package/native/windows/build/manifest.json +2 -2
  1193. package/native/windows/build/rea-windows-x64.node +0 -0
  1194. package/package.json +89 -22
  1195. package/scripts/electron-active-hook.cjs +4 -1
  1196. package/scripts/hopper-demo-x11.py +53 -3
  1197. package/scripts/prepack.mjs +5 -0
  1198. package/scripts/rea-android-workspace-guardian.mjs +46 -0
  1199. package/scripts/rea.mjs +28 -12
  1200. package/scripts/verify-windows-native-artifact.mjs +2 -2
  1201. package/skills/reverse-engineer-anything/SKILL.md +131 -10
  1202. package/skills/reverse-engineer-anything/references/connection-and-recovery.md +10 -10
  1203. package/skills/reverse-engineer-anything/references/evidence-workflows.md +23 -0
  1204. package/skills/reverse-engineer-anything/references/javascript-applications.md +28 -2
  1205. package/skills/reverse-engineer-anything/references/native-and-artifacts.md +125 -15
  1206. package/skills/reverse-engineer-anything/references/runtime-observation.md +57 -7
  1207. package/third_party/README.md +1 -1
  1208. package/third_party/wabt/README.md +24 -0
  1209. package/dist/browser/history/HarCaptureAdapter.js +0 -20
  1210. package/dist/cli/streamedJsonOutput.js +0 -135
  1211. /package/dist/{application/binary → process}/AbortablePromise.js +0 -0
@@ -0,0 +1,1957 @@
1
+ import { __esmMin } from "./rolldown-runtime-DXoylpqc.js";
2
+ import { PRODUCT_IDENTITY, compareUnicodeCodePoints, err, init_identity, init_result, init_unicodeCodePointOrder, ok } from "./reconstructionObligationLedgerSchemas-Bao0xMr-.js";
3
+ import { ConfigurationError, init_configurationErrors } from "./errorSchemas-CTRmvMl3.js";
4
+ import { ArtifactReaderFailure, init_ArtifactReader } from "./ArtifactReader-BXkffc1D.js";
5
+ import { NonRegularFileReadError, RegularFileChangedError, init_RegularFile } from "./RegularFile-B_6KPCNQ.js";
6
+ import { init_BoundedFileBytes, readBoundedFileBytes } from "./BoundedFileBytes-BU30odTm.js";
7
+ import { RegularFileCleanupFailure, init_RegularFileRead, readRegularFile, withRegularFile } from "./RegularFileRead-DVlC5faM.js";
8
+ import { clientSkillDirectories, init_SupportedClients, init_environment, parseEnvironment, parseEnvironmentValues } from "./SupportedClients-DaX6Lt2d.js";
9
+ import { z } from "zod";
10
+ import { dirname, join } from "node:path";
11
+ import { createHash } from "node:crypto";
12
+ import { isDeepStrictEqual } from "node:util";
13
+ import { copyFile, lstat, mkdir, readFile, rm } from "node:fs/promises";
14
+ import { constants } from "node:fs";
15
+ import { Document, Schema, isAlias, isMap, isNode, isScalar, isSeq, parseDocument, visit } from "yaml";
16
+ import writeFileAtomic from "write-file-atomic";
17
+ import { applyEdits, findNodeAtLocation, modify, parse, parseTree, printParseErrorCode } from "jsonc-parser";
18
+ import { parse as parse$1, stringify } from "smol-toml";
19
+
20
+ //#region dist/application/SetupRecoveryBackup.js
21
+ var isMissing, errorDetail, selectCurrentRecoveryBackup, preserveRecoveryBackup;
22
+ function init_SetupRecoveryBackup() {
23
+ return (init_SetupRecoveryBackup = __esmMin((() => {
24
+ init_result();
25
+ init_RegularFileRead();
26
+ isMissing = (cause) => cause instanceof Error && "code" in cause && cause.code === "ENOENT";
27
+ errorDetail = (cause) => cause instanceof Error ? cause.message : String(cause);
28
+ selectCurrentRecoveryBackup = async (firstBackupPath, original) => {
29
+ const expected = Buffer.isBuffer(original) ? original : Buffer.from(original, "utf8");
30
+ let firstBackup;
31
+ try {
32
+ firstBackup = await readRegularFile(firstBackupPath, { symlinks: "reject" });
33
+ } catch (cause) {
34
+ if (cause instanceof RegularFileCleanupFailure) throw cause;
35
+ if (!isMissing(cause)) return err({
36
+ kind: "unreadable",
37
+ path: firstBackupPath,
38
+ detail: `The recovery backup could not be checked: ${errorDetail(cause)}`
39
+ });
40
+ }
41
+ if (firstBackup === undefined) return ok({
42
+ backupPath: firstBackupPath,
43
+ present: false
44
+ });
45
+ if (firstBackup.equals(expected)) return ok({
46
+ backupPath: firstBackupPath,
47
+ present: true
48
+ });
49
+ const digest = createHash("sha256").update(expected).digest("hex");
50
+ const recoveryPath = `${firstBackupPath}.${digest}.recovery`;
51
+ let recovery;
52
+ try {
53
+ recovery = await readRegularFile(recoveryPath, { symlinks: "reject" });
54
+ } catch (cause) {
55
+ if (cause instanceof RegularFileCleanupFailure) throw cause;
56
+ if (!isMissing(cause)) return err({
57
+ kind: "unreadable",
58
+ path: recoveryPath,
59
+ detail: `The recovery backup could not be checked: ${errorDetail(cause)}`
60
+ });
61
+ }
62
+ if (recovery !== undefined && !recovery.equals(expected)) return err({
63
+ kind: "occupied",
64
+ path: recoveryPath,
65
+ detail: `The recovery path already contains different data: ${recoveryPath}`
66
+ });
67
+ return ok({
68
+ backupPath: recoveryPath,
69
+ present: recovery !== undefined
70
+ });
71
+ };
72
+ preserveRecoveryBackup = async (source, destination) => {
73
+ try {
74
+ await copyFile(source, destination, constants.COPYFILE_EXCL);
75
+ return true;
76
+ } catch (cause) {
77
+ return cause instanceof Error && "code" in cause && cause.code === "EEXIST";
78
+ }
79
+ };
80
+ })))();
81
+ }
82
+
83
+ //#endregion
84
+ //#region dist/application/SetupSkill.js
85
+ var MANAGED_SKILL_FILES, isManagedSkillManifest, readSkillFile, readSkillFileState, canonicalSkillContent, SetupSkillInstallError, systemSkillInstallFileOperations, skillDestinations, existingSkillDestinations, readOptionalSkillState, inspectSkillDirectory, skillDirectoryIssues, skillDirectoryFailure, validateCanonicalSkillDirectories, canonicalSkillFiles, inspectCanonicalSkill, canonicalSkillNeedsInstall, causeReason, causePath, restoreSkillFiles, preserveCurrentSkillBackup, installCanonicalSkill, readInstalledSkillIdentity;
86
+ function init_SetupSkill() {
87
+ return (init_SetupSkill = __esmMin((() => {
88
+ init_result();
89
+ init_BoundedFileBytes();
90
+ init_ArtifactReader();
91
+ init_identity();
92
+ init_RegularFile();
93
+ init_RegularFileRead();
94
+ init_SupportedClients();
95
+ init_SetupRecoveryBackup();
96
+ MANAGED_SKILL_FILES = [
97
+ "SKILL.md",
98
+ "references/connection-and-recovery.md",
99
+ "references/native-and-artifacts.md",
100
+ "references/javascript-applications.md",
101
+ "references/android-applications.md",
102
+ "references/runtime-observation.md",
103
+ "references/evidence-workflows.md"
104
+ ];
105
+ isManagedSkillManifest = (content) => content.startsWith(`---\nname: ${PRODUCT_IDENTITY.skillName}\n`) || content.startsWith(`---\r\nname: ${PRODUCT_IDENTITY.skillName}\r\n`);
106
+ readSkillFile = (path, resources) => readSkillFileState(path, resources).then(({ bytes }) => bytes.toString("utf8"));
107
+ readSkillFileState = async (path, resources) => withRegularFile(path, async (handle, stats) => {
108
+ const bytes = await readBoundedFileBytes(handle, stats.size, undefined, stats.size);
109
+ if (bytes === undefined || bytes.length !== stats.size) throw new RegularFileChangedError(path);
110
+ return {
111
+ bytes,
112
+ mode: stats.mode & 4095
113
+ };
114
+ }, {
115
+ symlinks: "reject",
116
+ ...resources === undefined ? {} : { resources }
117
+ });
118
+ canonicalSkillContent = (relativePath) => readFile(new URL(`../../skills/${PRODUCT_IDENTITY.skillName}/${relativePath}`, new URL("../application/SetupSkill.js", import.meta.url).href), "utf8");
119
+ SetupSkillInstallError = class extends Error {
120
+ _tag = "SetupSkillInstallError";
121
+ path;
122
+ stage;
123
+ reason;
124
+ rollbackFailures;
125
+ recoveryBackupPaths;
126
+ constructor(input) {
127
+ const message = [`REA skill ${input.stage} failed at ${input.path}: ${input.reason}.`, ...input.rollbackFailures.length === 0 ? [] : [`Rollback also failed for ${input.rollbackFailures.map(({ path, reason }) => `${path} (${reason})`).join(", ")}.`, ...input.recoveryBackupPaths.length === 0 ? [] : [`Existing-file backups remain at ${input.recoveryBackupPaths.join(", ")}.`]]].join(" ");
128
+ super(message, { cause: input.cause });
129
+ this.path = input.path;
130
+ this.stage = input.stage;
131
+ this.reason = input.reason;
132
+ this.rollbackFailures = input.rollbackFailures;
133
+ this.recoveryBackupPaths = input.recoveryBackupPaths;
134
+ }
135
+ get remediation() {
136
+ return `${this.message} Check permissions and rerun setup.`;
137
+ }
138
+ };
139
+ systemSkillInstallFileOperations = {
140
+ mkdir: async (path) => {
141
+ await mkdir(path, { recursive: true });
142
+ },
143
+ backup: async (source, destination) => {
144
+ try {
145
+ await copyFile(source, destination, constants.COPYFILE_EXCL);
146
+ } catch (cause) {
147
+ if (cause instanceof Error && "code" in cause && cause.code === "EEXIST") return;
148
+ throw cause;
149
+ }
150
+ },
151
+ write: (path, content, mode) => writeFileAtomic(path, content, {
152
+ encoding: "utf8",
153
+ mode
154
+ }),
155
+ remove: (path) => rm(path, { force: true })
156
+ };
157
+ skillDestinations = (home, clientIds, environment = {}, platform = process.platform) => clientSkillDirectories(home, clientIds, environment, platform).map(({ client, directory }) => ({
158
+ client,
159
+ path: join(directory, PRODUCT_IDENTITY.skillName)
160
+ }));
161
+ existingSkillDestinations = async (home, environment = {}, platform = process.platform, resources) => {
162
+ const existing = [];
163
+ for (const destination of skillDestinations(home, undefined, environment, platform)) {
164
+ try {
165
+ const issues = await skillDirectoryIssues([destination]);
166
+ if (issues.some(({ kind }) => kind === "unreadable")) throw skillDirectoryFailure(issues);
167
+ if (issues.length > 0) continue;
168
+ const manifest = join(destination.path, "SKILL.md");
169
+ const content = await readSkillFile(manifest, resources);
170
+ if (isManagedSkillManifest(content)) existing.push(destination);
171
+ } catch (cause) {
172
+ if (cause instanceof Error && "code" in cause && cause.code === "ENOENT") continue;
173
+ if (cause instanceof RegularFileCleanupFailure || cause instanceof ArtifactReaderFailure) throw cause;
174
+ if (cause instanceof NonRegularFileReadError) continue;
175
+ throw cause;
176
+ }
177
+ }
178
+ return existing;
179
+ };
180
+ readOptionalSkillState = async (path, resources) => {
181
+ try {
182
+ return await readSkillFileState(path, resources);
183
+ } catch (cause) {
184
+ if (cause instanceof Error && "code" in cause && cause.code === "ENOENT") return undefined;
185
+ throw cause;
186
+ }
187
+ };
188
+ inspectSkillDirectory = async (path) => {
189
+ try {
190
+ const directory = await lstat(path);
191
+ if (directory.isSymbolicLink()) return err({
192
+ path,
193
+ kind: "symbolic_link",
194
+ detail: "Skill directory is a symbolic link."
195
+ });
196
+ if (!directory.isDirectory()) return err({
197
+ path,
198
+ kind: "not_directory",
199
+ detail: "Skill path is not a directory."
200
+ });
201
+ return ok(undefined);
202
+ } catch (cause) {
203
+ if (cause instanceof Error && "code" in cause && cause.code === "ENOENT") return ok(undefined);
204
+ return err({
205
+ path,
206
+ kind: "unreadable",
207
+ detail: cause instanceof Error ? cause.message : String(cause)
208
+ });
209
+ }
210
+ };
211
+ skillDirectoryIssues = async (destinations) => {
212
+ const issues = [];
213
+ for (const { path } of destinations) {
214
+ const root = await inspectSkillDirectory(path);
215
+ if (!root.ok) {
216
+ issues.push(root.error);
217
+ continue;
218
+ }
219
+ const references = await inspectSkillDirectory(join(path, "references"));
220
+ if (!references.ok) issues.push(references.error);
221
+ }
222
+ return issues;
223
+ };
224
+ skillDirectoryFailure = (issues) => new SetupSkillInstallError({
225
+ path: issues[0]?.path ?? "skill bundle",
226
+ stage: "prepare",
227
+ reason: `${issues.map(({ path, detail }) => `${detail} (${path})`).join(" ")} Use a regular skill directory, or run setup with --skill=false to configure the client without installing the skill`,
228
+ rollbackFailures: [],
229
+ recoveryBackupPaths: [],
230
+ cause: issues
231
+ });
232
+ validateCanonicalSkillDirectories = async (home, clientIds, environment = {}, platform = process.platform) => {
233
+ const issues = await skillDirectoryIssues(skillDestinations(home, clientIds, environment, platform));
234
+ return issues.length === 0 ? ok(undefined) : err(skillDirectoryFailure(issues));
235
+ };
236
+ canonicalSkillFiles = async (home, clientIds, environment = {}, platform = process.platform, resources) => {
237
+ const destinations = skillDestinations(home, clientIds, environment, platform);
238
+ const admission = await validateCanonicalSkillDirectories(home, clientIds, environment, platform);
239
+ if (!admission.ok) throw admission.error;
240
+ return Promise.all(destinations.flatMap(({ path: root }) => MANAGED_SKILL_FILES.map(async (relativePath) => {
241
+ const destination = join(root, relativePath);
242
+ return {
243
+ destination,
244
+ content: await canonicalSkillContent(relativePath),
245
+ original: await readOptionalSkillState(destination, resources)
246
+ };
247
+ })));
248
+ };
249
+ inspectCanonicalSkill = async (home, clientIds, environment, platform, resources) => {
250
+ const destinations = skillDestinations(home, clientIds, environment, platform);
251
+ const issues = clientIds === undefined ? [] : [...await skillDirectoryIssues(destinations)];
252
+ if (issues.length > 0) return err({
253
+ _tag: "SkillInspectionFailure",
254
+ issues,
255
+ cause: issues,
256
+ manifest: undefined
257
+ });
258
+ let canonical = true;
259
+ let manifest;
260
+ let failureCause;
261
+ let installedDestination = false;
262
+ for (const destination of destinations) {
263
+ const { path: root } = destination;
264
+ const pathIssues = clientIds === undefined ? await skillDirectoryIssues([destination]) : [];
265
+ if (pathIssues.length > 0) {
266
+ issues.push(...pathIssues);
267
+ if (failureCause === undefined) failureCause = pathIssues;
268
+ installedDestination = true;
269
+ canonical = false;
270
+ continue;
271
+ }
272
+ let rootCanonical = true;
273
+ let rootHasFiles = false;
274
+ const rootIssues = [];
275
+ for (const relativePath of MANAGED_SKILL_FILES) {
276
+ const destination = join(root, relativePath);
277
+ let original;
278
+ try {
279
+ original = await readOptionalSkillState(destination, resources);
280
+ } catch (cause) {
281
+ if (cause instanceof RegularFileCleanupFailure || cause instanceof ArtifactReaderFailure) throw cause;
282
+ rootIssues.push({
283
+ path: destination,
284
+ kind: "unreadable",
285
+ detail: causeReason(cause)
286
+ });
287
+ if (failureCause === undefined) failureCause = cause;
288
+ rootCanonical = false;
289
+ rootHasFiles = true;
290
+ continue;
291
+ }
292
+ if (original !== undefined) rootHasFiles = true;
293
+ if (relativePath === "SKILL.md" && manifest === undefined) manifest = original?.bytes.toString("utf8");
294
+ if (original === undefined) rootCanonical = false;
295
+ else if (rootCanonical) {
296
+ const content = await canonicalSkillContent(relativePath);
297
+ rootCanonical = original.bytes.equals(Buffer.from(content, "utf8"));
298
+ }
299
+ }
300
+ if (clientIds !== undefined || rootHasFiles || rootIssues.length > 0) {
301
+ installedDestination = true;
302
+ canonical = canonical && rootCanonical;
303
+ issues.push(...rootIssues);
304
+ }
305
+ }
306
+ return issues.length === 0 ? ok({
307
+ canonical,
308
+ manifest,
309
+ installedDestination
310
+ }) : err({
311
+ _tag: "SkillInspectionFailure",
312
+ issues,
313
+ cause: failureCause,
314
+ manifest
315
+ });
316
+ };
317
+ canonicalSkillNeedsInstall = async (home, clientIds = [], environment = {}, platform = process.platform, resources) => {
318
+ try {
319
+ const inspection = await inspectCanonicalSkill(home, clientIds, environment, platform, resources);
320
+ return !inspection.ok || !inspection.value.canonical;
321
+ } catch (cause) {
322
+ if (cause instanceof RegularFileCleanupFailure || cause instanceof ArtifactReaderFailure) throw cause;
323
+ void cause;
324
+ return true;
325
+ }
326
+ };
327
+ causeReason = (cause) => cause instanceof Error ? cause.message : String(cause);
328
+ causePath = (cause) => cause instanceof Error && "path" in cause && typeof cause.path === "string" ? cause.path : undefined;
329
+ restoreSkillFiles = async (attempted, operations) => {
330
+ const failures = [];
331
+ for (const { destination, original } of [...attempted].reverse()) {
332
+ try {
333
+ if (original === undefined) await operations.remove(destination);
334
+ else await operations.write(destination, original.bytes, original.mode);
335
+ } catch (cause) {
336
+ failures.push({
337
+ path: destination,
338
+ reason: causeReason(cause)
339
+ });
340
+ }
341
+ }
342
+ return failures;
343
+ };
344
+ preserveCurrentSkillBackup = async (destination, original, operations) => {
345
+ const firstBackupPath = `${destination}.rea.backup`;
346
+ const selection = await selectCurrentRecoveryBackup(firstBackupPath, original);
347
+ if (!selection.ok) throw new Error(selection.error.detail);
348
+ if (selection.value.present) return selection.value.backupPath;
349
+ await operations.backup(destination, selection.value.backupPath);
350
+ const verified = await selectCurrentRecoveryBackup(firstBackupPath, original);
351
+ if (!verified.ok || verified.value.backupPath !== selection.value.backupPath || !verified.value.present) throw new Error(`The current file was not preserved at ${selection.value.backupPath}`);
352
+ return verified.value.backupPath;
353
+ };
354
+ installCanonicalSkill = async (home, clientIds = [], environment = {}, platform = process.platform, operations = systemSkillInstallFileOperations, resources) => {
355
+ let attempted = [];
356
+ let stage = "prepare";
357
+ let failingPath = "skill bundle";
358
+ const recoveryPaths = new Map();
359
+ try {
360
+ const canonical = await canonicalSkillFiles(home, clientIds, environment, platform, resources);
361
+ const changed = canonical.filter(({ content, original }) => original?.bytes.equals(Buffer.from(content, "utf8")) !== true);
362
+ if (changed.length === 0) return ok("unchanged");
363
+ stage = "backup";
364
+ for (const { destination, original } of changed) {
365
+ failingPath = destination;
366
+ await operations.mkdir(dirname(destination));
367
+ if (original !== undefined) {
368
+ recoveryPaths.set(destination, await preserveCurrentSkillBackup(destination, original.bytes, operations));
369
+ }
370
+ }
371
+ stage = "write";
372
+ for (const file of changed) {
373
+ failingPath = file.destination;
374
+ attempted.push(file);
375
+ await operations.write(file.destination, file.content, file.original?.mode ?? 384);
376
+ }
377
+ stage = "readback";
378
+ for (const { destination, content } of changed) {
379
+ failingPath = destination;
380
+ if (!(await readSkillFileState(destination, resources)).bytes.equals(Buffer.from(content, "utf8"))) throw new Error(`skill readback mismatch: ${destination}`);
381
+ }
382
+ return ok("installed");
383
+ } catch (cause) {
384
+ if (stage === "prepare" && cause instanceof SetupSkillInstallError) return err(cause);
385
+ failingPath = causePath(cause) ?? failingPath;
386
+ const rollbackFailures = await restoreSkillFiles(attempted, operations);
387
+ return err(new SetupSkillInstallError({
388
+ path: failingPath,
389
+ stage,
390
+ reason: causeReason(cause),
391
+ rollbackFailures,
392
+ recoveryBackupPaths: attempted.flatMap(({ destination, original }) => original === undefined || recoveryPaths.get(destination) === undefined ? [] : [recoveryPaths.get(destination)]),
393
+ cause
394
+ }));
395
+ }
396
+ };
397
+ readInstalledSkillIdentity = async (home, clientIds, environment = {}, platform = process.platform, resources) => {
398
+ const inspection = await inspectCanonicalSkill(home, clientIds, environment, platform, resources);
399
+ if (inspection.ok && !inspection.value.installedDestination) return undefined;
400
+ const content = inspection.ok ? inspection.value.manifest : inspection.error.manifest;
401
+ const issues = inspection.ok ? [] : inspection.error.issues;
402
+ if (content === undefined && issues.length === 0) return undefined;
403
+ const toolCount = content === undefined ? undefined : /^\s{2}tool_count:\s*(\d+)\s*$/mu.exec(content)?.[1];
404
+ return {
405
+ canonical: inspection.ok && inspection.value.canonical,
406
+ version: content === undefined ? null : /^\s{2}version:\s*"([^"]+)"\s*$/mu.exec(content)?.[1] ?? null,
407
+ toolCount: toolCount === undefined ? null : Number.parseInt(toolCount, 10),
408
+ ...issues.length === 0 ? {} : { issues }
409
+ };
410
+ };
411
+ })))();
412
+ }
413
+
414
+ //#endregion
415
+ //#region dist/application/DshCordisYaml.js
416
+ var CordisExpression, DshCordisYaml;
417
+ function init_DshCordisYaml() {
418
+ return (init_DshCordisYaml = __esmMin((() => {
419
+ init_configurationErrors();
420
+ CordisExpression = class {
421
+ source;
422
+ kind = "cordis-expression";
423
+ constructor(source) {
424
+ this.source = source;
425
+ }
426
+ };
427
+ DshCordisYaml = class {
428
+ document;
429
+ #values = new Map();
430
+ #visiting = new Set();
431
+ constructor(text) {
432
+ this.document = parseDocument(text, {
433
+ customTags: [{
434
+ tag: "tag:yaml.org,2002:js",
435
+ resolve: (source) => source
436
+ }],
437
+ logLevel: "silent"
438
+ });
439
+ if (this.document.errors.length > 0 || this.document.warnings.length > 0) throw new ConfigurationError("Invalid or unsupported Cordis YAML", { cause: this.document.errors[0] ?? this.document.warnings[0] });
440
+ if (this.document.contents === null) this.document.contents = this.document.createNode([]);
441
+ if (!isSeq(this.document.contents)) throw new ConfigurationError("Cordis patches must be a YAML operation list");
442
+ this.value(this.document.contents);
443
+ try {
444
+ this.document.toJS();
445
+ } catch (cause) {
446
+ throw new ConfigurationError("Unsafe Cordis YAML alias expansion", { cause });
447
+ }
448
+ }
449
+ resolve(node) {
450
+ if (!isAlias(node)) return node;
451
+ const resolved = node.resolve(this.document);
452
+ if (resolved === undefined) throw new ConfigurationError("Cordis YAML contains an unresolved alias");
453
+ return resolved;
454
+ }
455
+ value(node) {
456
+ const resolved = this.resolve(node);
457
+ if (!isNode(resolved)) return resolved;
458
+ if (this.#values.has(resolved)) return this.#values.get(resolved);
459
+ if (this.#visiting.has(resolved)) throw new ConfigurationError("Cyclic Cordis YAML cannot be safely edited");
460
+ this.#visiting.add(resolved);
461
+ let value;
462
+ if (isScalar(resolved)) value = resolved.tag === "tag:yaml.org,2002:js" ? new CordisExpression(String(resolved.value)) : resolved.value;
463
+ else if (isSeq(resolved)) value = resolved.items.map((item) => this.value(item));
464
+ else if (isMap(resolved)) {
465
+ const entries = [];
466
+ for (const pair of resolved.items) {
467
+ entries.push([this.#key(pair.key), this.value(pair.value)]);
468
+ }
469
+ value = Object.fromEntries(entries);
470
+ }
471
+ this.#visiting.delete(resolved);
472
+ this.#values.set(resolved, value);
473
+ return value;
474
+ }
475
+ #key(node) {
476
+ const key = this.value(node);
477
+ if (typeof key === "object" && key !== null) throw new ConfigurationError("Cordis YAML mapping keys must be literal scalars");
478
+ return key === null ? "" : String(key);
479
+ }
480
+ field(map, key) {
481
+ return map?.items.findLast((pair) => this.#key(pair.key) === key)?.value;
482
+ }
483
+ /** Preserve unchanged nodes and carry their comments when replacing values. */
484
+ setValue(map, key, value) {
485
+ const original = this.field(map, key);
486
+ if (isDeepStrictEqual(this.value(original), value)) return;
487
+ const replacement = this.document.createNode(value);
488
+ if (isNode(original) && isNode(replacement)) {
489
+ if (original.comment !== undefined) replacement.comment = original.comment;
490
+ if (original.commentBefore !== undefined) replacement.commentBefore = original.commentBefore;
491
+ }
492
+ map.set(key, replacement);
493
+ }
494
+ /** Copy from the source before edits; materialized nodes own no anchors. */
495
+ copy(node, invalidated) {
496
+ if (isAlias(node)) {
497
+ const target = this.resolve(node);
498
+ return invalidated === undefined || isNode(target) && invalidated.has(target) ? this.copy(target) : node.clone();
499
+ }
500
+ if (!isNode(node)) return node;
501
+ const copied = node.clone();
502
+ if ((invalidated === undefined || invalidated.has(node)) && (isScalar(copied) || isMap(copied) || isSeq(copied))) delete copied.anchor;
503
+ if (isSeq(node) && isSeq(copied)) copied.items = node.items.map((item) => this.copy(item, invalidated));
504
+ if (isMap(node) && isMap(copied)) copied.items.forEach((pair, index) => {
505
+ pair.key = this.copy(node.items[index].key, invalidated);
506
+ pair.value = this.copy(node.items[index].value, invalidated);
507
+ });
508
+ return copied;
509
+ }
510
+ /** Replacing an anchor must not change untouched consumers of its old value. */
511
+ detach(node, invalidated) {
512
+ const copied = this.copy(node, invalidated);
513
+ if (isNode(copied)) visit(copied, {
514
+ Pair: (_key, pair) => {
515
+ if (isAlias(pair.key)) pair.key = this.copy(this.resolve(pair.key));
516
+ },
517
+ Value: (_key, value) => {
518
+ delete value.anchor;
519
+ }
520
+ });
521
+ return copied;
522
+ }
523
+ anchors(node) {
524
+ if (!isNode(node)) return [];
525
+ const anchors = [];
526
+ visit(node, { Value: (_key, value) => {
527
+ if (value.anchor) anchors.push(value);
528
+ } });
529
+ return anchors;
530
+ }
531
+ };
532
+ })))();
533
+ }
534
+
535
+ //#endregion
536
+ //#region dist/application/DshCordisPatch.js
537
+ var DSH_ENTRY_ID, DSH_CLIENT_PACKAGE, LAUNCHER_KEYS, SELECTOR_KEYS, isRecord, DshCordisDocument, DshCordisEdit, dshDocument, parseDshCordisDocument, editDshDocument, serializeDshDocument, dshClientRegistrationEntry;
538
+ function init_DshCordisPatch() {
539
+ return (init_DshCordisPatch = __esmMin((() => {
540
+ init_environment();
541
+ init_configurationErrors();
542
+ init_result();
543
+ init_DshCordisYaml();
544
+ DSH_ENTRY_ID = "rea-mcp";
545
+ DSH_CLIENT_PACKAGE = "@deepseek-ai/dsh-mcp-client";
546
+ LAUNCHER_KEYS = new Set([
547
+ "serverName",
548
+ "transport",
549
+ "command",
550
+ "args"
551
+ ]);
552
+ SELECTOR_KEYS = new Set(["id", "name"]);
553
+ isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && !(value instanceof CordisExpression);
554
+ DshCordisDocument = class {
555
+ #yaml;
556
+ #operations;
557
+ #fields = new Map();
558
+ #entryNode;
559
+ #insertions;
560
+ #unknownSelector = false;
561
+ #unknownStructure = false;
562
+ #editabilityError;
563
+ config;
564
+ constructor(text) {
565
+ this.#yaml = new DshCordisYaml(text);
566
+ const root = this.#yaml.document.contents;
567
+ if (!isSeq(root)) throw new ConfigurationError("Cordis patches must be a list");
568
+ const operations = [];
569
+ let insertions = 0;
570
+ let malformedStructure = false;
571
+ for (const source of root.items) {
572
+ const map = this.#map(source);
573
+ if (map === undefined) {
574
+ if (this.#yaml.value(source) instanceof CordisExpression) this.#unknownStructure = true;
575
+ else malformedStructure = true;
576
+ continue;
577
+ }
578
+ const inserted = this.#yaml.resolve(this.#yaml.field(map, "insert"));
579
+ const targetId = this.#id(map);
580
+ const unknownApplicability = targetId !== undefined;
581
+ const insertedValue = this.#yaml.value(inserted);
582
+ const invalidEntries = isSeq(inserted) ? inserted.items.filter((entry) => this.#map(entry) === undefined) : [];
583
+ if (insertedValue instanceof CordisExpression || invalidEntries.some((entry) => this.#yaml.value(entry) instanceof CordisExpression)) this.#unknownStructure = true;
584
+ else if (insertedValue != null && !isSeq(inserted)) malformedStructure = true;
585
+ else if (invalidEntries.length > 0) malformedStructure = true;
586
+ const ownedRows = isSeq(inserted) ? inserted.items.flatMap((entry, index) => this.#id(entry) === "rea-mcp" ? [index] : []) : [];
587
+ const direct = !isSeq(inserted) && targetId === "rea-mcp";
588
+ operations.push({
589
+ source,
590
+ map,
591
+ ownedRows,
592
+ direct,
593
+ unknownApplicability
594
+ });
595
+ if (isSeq(inserted)) {
596
+ for (const index of ownedRows) {
597
+ const entry = this.#map(inserted.items[index]);
598
+ if (entry === undefined) continue;
599
+ insertions += 1;
600
+ this.#entryNode = entry;
601
+ this.#fields.clear();
602
+ this.#unknownSelector = false;
603
+ this.#readFields(entry);
604
+ }
605
+ } else if (direct) {
606
+ if (insertions === 0) continue;
607
+ const selector = this.#yaml.value(this.#yaml.field(map, "name"));
608
+ if (selector instanceof CordisExpression || selector && this.#field("name") instanceof CordisExpression) {
609
+ this.#unknownSelector = true;
610
+ continue;
611
+ }
612
+ if (selector && selector !== this.#field("name")) continue;
613
+ this.#readFields(map, new Set(["id", "name"]));
614
+ }
615
+ }
616
+ this.#operations = operations;
617
+ this.#insertions = insertions;
618
+ this.#editabilityError = this.#unknownStructure ? new ConfigurationError("Expression-backed Cordis patches have unknown structure; use literal patches before setup") : malformedStructure ? new ConfigurationError("Malformed Cordis patches cannot be edited safely; use mapping entries and insert lists before setup") : operations.some((op) => op.unknownApplicability && op.ownedRows.length > 0) ? new ConfigurationError("Cordis REA insertion targets a group with unknown activity; use a direct insertion before setup") : this.#unknownSelector ? new ConfigurationError("Expression-backed Cordis name selectors have unknown applicability; use literal selectors before setup", { settings: [{
619
+ setting: "name",
620
+ constraint: "Use literal selectors before setup"
621
+ }] }) : undefined;
622
+ const config = this.#field("config");
623
+ this.config = insertions === 0 ? undefined : isRecord(config) ? config : {};
624
+ }
625
+ #map(node) {
626
+ const map = this.#yaml.resolve(node);
627
+ return isMap(map) ? map : undefined;
628
+ }
629
+ #id(node) {
630
+ const id = this.#yaml.value(this.#yaml.field(this.#map(node), "id"));
631
+ if (id instanceof CordisExpression) throw new ConfigurationError("Expression-backed Cordis IDs have unknown ownership; use literal IDs before changing registrations");
632
+ return id;
633
+ }
634
+ #field(key) {
635
+ return this.#yaml.value(this.#fields.get(key));
636
+ }
637
+ #readFields(map, omitted = new Set()) {
638
+ for (const pair of map.items) {
639
+ const key = this.#yaml.value(pair.key);
640
+ if (typeof key === "string" && !omitted.has(key)) this.#fields.set(key, pair.value);
641
+ }
642
+ }
643
+ get carriesEntry() {
644
+ return this.#operations.some((op) => op.direct || op.ownedRows.length > 0);
645
+ }
646
+ get hasUnknownStructure() {
647
+ return this.#unknownStructure;
648
+ }
649
+ get editabilityError() {
650
+ return this.#editabilityError;
651
+ }
652
+ get ready() {
653
+ const disabled = this.#field("disabled");
654
+ return this.#insertions === 1 && this.#editabilityError === undefined && this.#field("name") === "@deepseek-ai/dsh-mcp-client" && (disabled === undefined || disabled === false);
655
+ }
656
+ /** Validate literals without treating expression source as an environment value. */
657
+ environment(overrides = {}, validation = "effective") {
658
+ const config = this.#field("config");
659
+ if (config instanceof CordisExpression) return err(new ConfigurationError("Expression-backed Cordis config cannot be safely edited", { settings: [{
660
+ setting: "config",
661
+ constraint: "Use a literal mapping to preserve caller fields during setup"
662
+ }] }));
663
+ if (config !== undefined && !isRecord(config)) return err(new ConfigurationError("Cordis REA config must be a mapping", { settings: [{
664
+ setting: "config",
665
+ constraint: "Use a literal mapping before setup"
666
+ }] }));
667
+ const raw = this.config?.env;
668
+ if (raw !== undefined && !isRecord(raw)) return err(new ConfigurationError("Cordis server environment must be a mapping"));
669
+ const literals = {};
670
+ const unresolvedSettings = new Set();
671
+ for (const [key, value] of Object.entries(raw ?? {})) {
672
+ if (value instanceof CordisExpression) {
673
+ if (overrides[key] === undefined) unresolvedSettings.add(key);
674
+ continue;
675
+ }
676
+ if (typeof value !== "string") return err(new ConfigurationError("Invalid Cordis server environment", { settings: [{
677
+ setting: `env.${key}`,
678
+ constraint: "Environment values must be strings or Cordis expressions"
679
+ }] }));
680
+ literals[key] = value;
681
+ }
682
+ const environment = {
683
+ ...literals,
684
+ ...overrides
685
+ };
686
+ const validated = validation === "fragment" ? parseEnvironmentValues(environment) : parseEnvironment(environment, unresolvedSettings);
687
+ return validated.ok ? ok(environment) : validated;
688
+ }
689
+ desired(command, overrides) {
690
+ if (this.#editabilityError !== undefined) return err(this.#editabilityError);
691
+ const environment = this.environment(overrides);
692
+ if (!environment.ok) return environment;
693
+ const env = {
694
+ ...isRecord(this.config?.env) ? this.config.env : {},
695
+ ...overrides
696
+ };
697
+ const desired = {
698
+ ...this.config,
699
+ ...dshClientRegistrationEntry(command)
700
+ };
701
+ delete desired.env;
702
+ if (Object.keys(env).length > 0) desired.env = env;
703
+ return ok(desired);
704
+ }
705
+ /** Plan every replacement from source snapshots before changing an output tree. */
706
+ serialize(desired) {
707
+ if (this.#editabilityError !== undefined && (this.#unknownStructure || desired !== undefined)) throw this.#editabilityError;
708
+ const root = this.#yaml.document.contents;
709
+ if (!isSeq(root)) throw new ConfigurationError("Cordis patches must be a list");
710
+ const replacements = new Map();
711
+ const invalidated = new Set(this.#operations.flatMap((op) => op.direct || op.ownedRows.length > 0 ? this.#yaml.anchors(op.source) : []));
712
+ let carried = false;
713
+ for (const op of this.#operations) {
714
+ if (op.direct) {
715
+ replacements.set(op.source, undefined);
716
+ continue;
717
+ }
718
+ if (op.ownedRows.length === 0) continue;
719
+ const copy = this.#yaml.detach(op.map, invalidated);
720
+ if (!isMap(copy)) throw new ConfigurationError("Cordis operation is not a mapping");
721
+ const inserted = this.#yaml.detach(this.#yaml.resolve(this.#yaml.field(op.map, "insert")), invalidated);
722
+ if (!isSeq(inserted)) throw new ConfigurationError("Cordis insertion is not a list");
723
+ copy.set("insert", inserted);
724
+ const owned = new Set(op.ownedRows);
725
+ inserted.items = inserted.items.flatMap((entry, index) => {
726
+ if (!owned.has(index)) return [entry];
727
+ if (carried || desired === undefined) return [];
728
+ carried = true;
729
+ return [this.#entry(desired, invalidated)];
730
+ });
731
+ if (inserted.items.length === 0) copy.delete("insert");
732
+ const kept = inserted.items.length > 0 || this.#id(op.map) !== "rea-mcp" && copy.items.some((pair) => !SELECTOR_KEYS.has(this.#yaml.value(pair.key)));
733
+ replacements.set(op.source, kept ? copy : undefined);
734
+ }
735
+ const output = this.#yaml.document.clone();
736
+ const outputRoot = output.contents;
737
+ if (!isSeq(outputRoot)) throw new ConfigurationError("Cordis patches must be a list");
738
+ outputRoot.items = root.items.flatMap((source) => {
739
+ const copy = replacements.has(source) ? replacements.get(source) : this.#yaml.copy(source, invalidated);
740
+ return copy === undefined ? [] : [copy];
741
+ });
742
+ if (!carried && desired !== undefined) outputRoot.items.push(output.createNode({ insert: [{
743
+ id: DSH_ENTRY_ID,
744
+ name: DSH_CLIENT_PACKAGE,
745
+ config: desired
746
+ }] }));
747
+ return output.toString({ lineWidth: 0 });
748
+ }
749
+ #entry(desired, invalidated) {
750
+ const entry = this.#yaml.detach(this.#entryNode, invalidated);
751
+ if (!isMap(entry)) throw new ConfigurationError("Cordis entry is not a mapping");
752
+ this.#yaml.setValue(entry, "id", DSH_ENTRY_ID);
753
+ this.#yaml.setValue(entry, "name", DSH_CLIENT_PACKAGE);
754
+ entry.delete("disabled");
755
+ for (const [key, value] of this.#fields) {
756
+ if ([
757
+ "id",
758
+ "name",
759
+ "config",
760
+ "disabled"
761
+ ].includes(key)) continue;
762
+ entry.set(key, this.#yaml.detach(value, invalidated));
763
+ }
764
+ const sourceConfig = this.#map(this.#fields.get("config"));
765
+ const config = sourceConfig === undefined ? this.#yaml.document.createNode({}) : this.#yaml.detach(sourceConfig, invalidated);
766
+ if (!isMap(config)) throw new ConfigurationError("Cordis registration config is not a mapping");
767
+ for (const key of LAUNCHER_KEYS) this.#yaml.setValue(config, key, desired[key]);
768
+ const env = this.#map(this.#yaml.field(sourceConfig, "env"));
769
+ const desiredEnv = desired.env;
770
+ if (isRecord(desiredEnv)) {
771
+ const nextEnv = env === undefined ? this.#yaml.document.createNode({}) : this.#yaml.detach(env, invalidated);
772
+ if (!isMap(nextEnv)) throw new ConfigurationError("Cordis environment is not a mapping");
773
+ for (const [key, value] of Object.entries(desiredEnv)) {
774
+ this.#yaml.setValue(nextEnv, key, value);
775
+ }
776
+ config.set("env", nextEnv);
777
+ } else config.delete("env");
778
+ entry.set("config", config);
779
+ return entry;
780
+ }
781
+ };
782
+ DshCordisEdit = class {
783
+ source;
784
+ desired;
785
+ constructor(source, desired) {
786
+ this.source = source;
787
+ this.desired = desired;
788
+ }
789
+ };
790
+ dshDocument = (document) => {
791
+ if (!(document.cordis instanceof DshCordisDocument)) throw new ConfigurationError("Missing Cordis document owner");
792
+ return document.cordis;
793
+ };
794
+ parseDshCordisDocument = (text) => {
795
+ const source = new DshCordisDocument(text);
796
+ return {
797
+ document: { cordis: source },
798
+ servers: source.config === undefined ? {} : { rea: source.config },
799
+ serversPath: [],
800
+ dialect: "dsh",
801
+ legacyServers: {}
802
+ };
803
+ };
804
+ editDshDocument = (parsed, desired) => ({ cordis: new DshCordisEdit(dshDocument(parsed.document), desired) });
805
+ serializeDshDocument = (document) => {
806
+ if (!(document.cordis instanceof DshCordisEdit)) throw new ConfigurationError("Missing Cordis edit plan");
807
+ return document.cordis.source.serialize(document.cordis.desired);
808
+ };
809
+ dshClientRegistrationEntry = (command, environment = {}) => {
810
+ const [executable = "rea", ...args] = command;
811
+ return {
812
+ serverName: "rea",
813
+ transport: "stdio",
814
+ command: executable,
815
+ args,
816
+ ...Object.keys(environment).length === 0 ? {} : { env: { ...environment } }
817
+ };
818
+ };
819
+ })))();
820
+ }
821
+
822
+ //#endregion
823
+ //#region dist/application/HermesConfigurationYaml.js
824
+ var SOURCE_SCALAR_TAGS, timestampTag, timestampSource, hermesTimestampImplicit, floorDivide, civilDay, parseHermesTimestamp, numericValue, numericValuesEqual, sameResolvedScalarValue, keepScalarSource, createHermesYamlOptions, stringifyHermesConfigurationYaml, isEmptyYamlRoot, parseHermesDocument, parseHermesConfigurationYaml, editHermesConfigurationYaml;
825
+ function init_HermesConfigurationYaml() {
826
+ return (init_HermesConfigurationYaml = __esmMin((() => {
827
+ SOURCE_SCALAR_TAGS = new Set([
828
+ "tag:yaml.org,2002:int",
829
+ "tag:yaml.org,2002:float",
830
+ "tag:yaml.org,2002:timestamp"
831
+ ]);
832
+ timestampTag = new Schema({ schema: "yaml-1.1" }).tags.find((tag) => tag.tag === "tag:yaml.org,2002:timestamp" && tag.collection === undefined);
833
+ if (timestampTag === undefined) throw new Error("The YAML 1.1 schema must provide its timestamp tag");
834
+ timestampSource = /^(\d{4})-(\d{1,2})-(\d{1,2})(?:(?:[Tt]|[ \t]+)(\d{1,2}):(\d{2}):(\d{2})(?:\.([0-9]*))?(?:[ \t]*(Z|([-+])(\d{1,2})(?::(\d{2}))?))?)?$/;
835
+ hermesTimestampImplicit = /^(?:\d{4}-\d{2}-\d{2}|\d{4}-\d{1,2}-\d{1,2}(?:[Tt]|[ \t]+)\d{1,2}:\d{2}:\d{2}(?:\.[0-9]*)?(?:[ \t]*(?:Z|[-+]\d{1,2}(?::\d{2})?))?)$/;
836
+ floorDivide = (value, divisor) => Math.floor(value / divisor);
837
+ civilDay = (year, month, day) => {
838
+ const adjustedYear = year - (month <= 2 ? 1 : 0);
839
+ const era = floorDivide(adjustedYear, 400);
840
+ const yearOfEra = adjustedYear - era * 400;
841
+ const adjustedMonth = month + (month > 2 ? -3 : 9);
842
+ const dayOfYear = floorDivide(153 * adjustedMonth + 2, 5) + day - 1;
843
+ const dayOfEra = yearOfEra * 365 + floorDivide(yearOfEra, 4) - floorDivide(yearOfEra, 100) + dayOfYear;
844
+ return era * 146097 + dayOfEra - 719468;
845
+ };
846
+ parseHermesTimestamp = (source) => {
847
+ const match = timestampSource.exec(source);
848
+ if (match === null) return undefined;
849
+ const [, yearText, monthText, dayText, hourText, minuteText, secondText, fraction, zone, sign, zoneHourText, zoneMinuteText] = match;
850
+ if (yearText === undefined || monthText === undefined || dayText === undefined) return undefined;
851
+ const year = Number(yearText);
852
+ const month = Number(monthText);
853
+ const dayOfMonth = Number(dayText);
854
+ if (year < 1 || year > 9999 || month < 1 || month > 12) return undefined;
855
+ const leapYear = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
856
+ const monthDays = [
857
+ 31,
858
+ leapYear ? 29 : 28,
859
+ 31,
860
+ 30,
861
+ 31,
862
+ 30,
863
+ 31,
864
+ 31,
865
+ 30,
866
+ 31,
867
+ 30,
868
+ 31
869
+ ];
870
+ if (dayOfMonth < 1 || dayOfMonth > (monthDays[month - 1] ?? 0)) return undefined;
871
+ const date = `${yearText}-${monthText.padStart(2, "0")}-${dayText.padStart(2, "0")}`;
872
+ const day = civilDay(year, month, dayOfMonth);
873
+ if (hourText === undefined) {
874
+ const micros = BigInt(day) * 86400000000n;
875
+ return {
876
+ key: `date:${date}`,
877
+ value: new Date(Number(micros / 1000n))
878
+ };
879
+ }
880
+ const hour = Number(hourText);
881
+ const minute = Number(minuteText);
882
+ const second = Number(secondText);
883
+ if (hour > 23 || minute > 59 || second > 59) return undefined;
884
+ const zoneHour = Number(zoneHourText ?? 0);
885
+ const zoneMinute = Number(zoneMinuteText ?? 0);
886
+ if (zoneHour > 23 || zoneMinute > 59) return undefined;
887
+ let microseconds = 0;
888
+ if (fraction !== undefined && fraction.length > 0) {
889
+ microseconds = Number((fraction.slice(0, 6) + "000000").slice(0, 6));
890
+ if (fraction.length > 6 && Number(fraction[6]) > 4) microseconds += 1;
891
+ }
892
+ const wholeSeconds = hour * 3600 + minute * 60 + second;
893
+ if (year === 9999 && month === 12 && dayOfMonth === 31 && wholeSeconds === 86399 && microseconds === 1e6) return undefined;
894
+ let micros = BigInt(day) * 86400000000n + BigInt(wholeSeconds) * 1000000n + BigInt(microseconds);
895
+ if (zone !== undefined && zone !== "Z") {
896
+ const offset = (zoneHour * 60 + zoneMinute) * (sign === "+" ? 1 : -1);
897
+ micros -= BigInt(offset) * 60000000n;
898
+ }
899
+ return {
900
+ key: zone === undefined ? `datetime-local:${micros}` : `datetime-utc:${micros}`,
901
+ value: new Date(Number(micros / 1000n - (micros % 1000n < 0n ? 1n : 0n)))
902
+ };
903
+ };
904
+ numericValue = (value) => {
905
+ if (typeof value === "boolean") return value ? 1n : 0n;
906
+ if (typeof value === "bigint" || typeof value === "number") return value;
907
+ return undefined;
908
+ };
909
+ numericValuesEqual = (left, right) => {
910
+ if (typeof left === "bigint" && typeof right === "bigint") return left === right;
911
+ if (typeof left === "number" && typeof right === "number") return left === right || Number.isNaN(left) && Number.isNaN(right);
912
+ const integer = typeof left === "bigint" ? left : right;
913
+ const number = typeof left === "number" ? left : right;
914
+ return Number.isFinite(number) && Number.isInteger(number) && BigInt(number) === integer;
915
+ };
916
+ sameResolvedScalarValue = (left, right) => Object.is(left, right) || left instanceof Date && right instanceof Date && left.getTime() === right.getTime();
917
+ keepScalarSource = (tag) => {
918
+ if (typeof tag === "string" || tag.collection !== undefined) return tag;
919
+ const { stringify } = tag;
920
+ if (!SOURCE_SCALAR_TAGS.has(tag.tag) || stringify === undefined) return tag;
921
+ return {
922
+ ...tag,
923
+ stringify: (item, context, ...rest) => {
924
+ const { source } = item;
925
+ if (source === undefined) return stringify(item, context, ...rest);
926
+ const reader = context.doc.schema.tags.find((candidate) => candidate.default === true && candidate.test?.test(source) === true);
927
+ const read = reader?.resolve(source, () => undefined, context.doc.options);
928
+ return sameResolvedScalarValue(isScalar(read) ? read.value : read, item.value) ? source : stringify(item, context, ...rest);
929
+ }
930
+ };
931
+ };
932
+ createHermesYamlOptions = () => {
933
+ const timestamps = new Map();
934
+ const timestampFacts = (source) => {
935
+ if (timestamps.has(source)) return timestamps.get(source);
936
+ const facts = parseHermesTimestamp(source);
937
+ timestamps.set(source, facts);
938
+ return facts;
939
+ };
940
+ const hermesTimestampTag = {
941
+ ...timestampTag,
942
+ test: hermesTimestampImplicit,
943
+ resolve: (source) => {
944
+ const facts = timestampFacts(source);
945
+ if (facts === undefined) throw new Error(`Invalid Hermes YAML timestamp: ${source}`);
946
+ return facts.value;
947
+ }
948
+ };
949
+ const keyFacts = new WeakMap();
950
+ const hermesKey = (node) => {
951
+ const cached = keyFacts.get(node);
952
+ if (cached !== undefined) return cached;
953
+ if (!isScalar(node)) return {
954
+ kind: "other",
955
+ value: node
956
+ };
957
+ const numeric = numericValue(node.value);
958
+ const key = numeric !== undefined ? {
959
+ kind: "numeric",
960
+ value: numeric
961
+ } : node.value instanceof Date ? {
962
+ kind: "timestamp",
963
+ value: timestampFacts(node.source ?? "")?.key ?? `invalid:${node.source ?? ""}`
964
+ } : {
965
+ kind: "other",
966
+ value: node.value
967
+ };
968
+ keyFacts.set(node, key);
969
+ return key;
970
+ };
971
+ /** Python dict key equality is Hermes' duplicate-key behavior (bool is int). */
972
+ const hermesKeysEqual = (leftNode, rightNode) => {
973
+ const left = hermesKey(leftNode);
974
+ const right = hermesKey(rightNode);
975
+ if (left.kind !== right.kind) return false;
976
+ if (left.kind === "numeric" && right.kind === "numeric") return numericValuesEqual(left.value, right.value);
977
+ return left.value === right.value;
978
+ };
979
+ return {
980
+ version: "1.1",
981
+ intAsBigInt: true,
982
+ customTags: (tags) => {
983
+ const hasTimestamp = tags.some((tag) => typeof tag !== "string" && tag.tag === timestampTag.tag);
984
+ const withHermesTimestamp = hasTimestamp ? tags.map((tag) => typeof tag !== "string" && tag.tag === timestampTag.tag ? hermesTimestampTag : tag) : [...tags, hermesTimestampTag];
985
+ return withHermesTimestamp.map(keepScalarSource);
986
+ },
987
+ uniqueKeys: hermesKeysEqual
988
+ };
989
+ };
990
+ stringifyHermesConfigurationYaml = (document) => new Document(document, createHermesYamlOptions()).toString({ lineWidth: 0 });
991
+ isEmptyYamlRoot = (root) => root === null || isScalar(root) && root.value === null && root.source === "" && root.tag === undefined && root.anchor === undefined;
992
+ parseHermesDocument = (text) => {
993
+ const document = parseDocument(text, createHermesYamlOptions());
994
+ const error = document.errors[0];
995
+ if (error !== undefined) throw error;
996
+ return document;
997
+ };
998
+ parseHermesConfigurationYaml = (text) => {
999
+ const document = parseHermesDocument(text);
1000
+ return isEmptyYamlRoot(document.contents) ? {} : document.toJS({ reviver: (_key, value) => typeof value === "bigint" ? Number(value) : value });
1001
+ };
1002
+ editHermesConfigurationYaml = (text, path, value) => {
1003
+ const document = parseHermesDocument(text);
1004
+ const root = document.contents;
1005
+ if (isEmptyYamlRoot(root)) {
1006
+ const map = document.createNode({});
1007
+ if (isScalar(root)) map.commentBefore = [root.commentBefore, root.comment].filter((comment) => comment !== undefined).join("\n");
1008
+ document.contents = map;
1009
+ }
1010
+ if (value === undefined) document.deleteIn(path);
1011
+ else {
1012
+ for (let length = 1; length < path.length; length++) {
1013
+ const parent = path.slice(0, length);
1014
+ if (!document.hasIn(parent)) document.setIn(parent, document.createNode({}));
1015
+ }
1016
+ document.setIn(path, value);
1017
+ }
1018
+ return document.toString({ lineWidth: 0 });
1019
+ };
1020
+ })))();
1021
+ }
1022
+
1023
+ //#endregion
1024
+ //#region dist/application/ClientConfigurationDocument.js
1025
+ var objectSchema, clientConfigurationValuesEqual, normalizeConfigurationValue, clientConfigurationServersKey, isEmptyClientConfigurationText, parseDocument$1, ClientConfigurationShapeError, requireObject, parseZcodeFallbackConfiguration, OPENCODE_V2_MCP_SETTINGS, parseClientConfiguration, effectiveClientServer, withClientServers, valueAt, TOML_BASIC_ESCAPES, skipHorizontalSpace, decodeBasicEscape, parseQuotedKey, parseBareKey, parseTomlTableHeader, tomlStringModeAfter, closeMultiline, isBlankOrComment, looksLikeTomlHeader, isTomlServerTable, parseKeyPath, parseAssignment, skipWsAndComments, endOfTomlValue, endOfContainer, tomlBasicString, tomlInlineKey, tomlInlineValue, readTrivia, commasOutsideComments, hasSeparatorComma, editInlineServerTable, rebuildInlineTable, rebuildDelimitedEntries, tomlStringValue, tomlArrayWithoutString, disabledServerListEdit, disabledServerListLines, upsertTomlServerSection, tomlServerEntry, grokServerListedDisabled, OMP_DISABLED_SERVERS_KEY, ompServerListedDisabled, OMP_ENABLED_SERVERS_KEY, clientServerForcedEnabled, clientServerListedDisabled, serializeGrokConfiguration, withoutEmptyServerTable, serializeCodexConfiguration, tomlTextHolds, commentsBetweenProperties, deleteJsonPropertyPreservingComments, serializeClientConfiguration, clientServerPath, legacyClientServerPath, serializeHermesConfiguration, clientRegistrationEntry, parseGeminiMcpPolicy, normalizeGeminiServerName, geminiServerPolicyBlock;
1026
+ function init_ClientConfigurationDocument() {
1027
+ return (init_ClientConfigurationDocument = __esmMin((() => {
1028
+ init_DshCordisPatch();
1029
+ init_HermesConfigurationYaml();
1030
+ init_identity();
1031
+ init_unicodeCodePointOrder();
1032
+ objectSchema = z.record(z.string(), z.unknown());
1033
+ clientConfigurationValuesEqual = (left, right) => isDeepStrictEqual(normalizeConfigurationValue(left), normalizeConfigurationValue(right));
1034
+ normalizeConfigurationValue = (value) => {
1035
+ if (Array.isArray(value)) return value.map(normalizeConfigurationValue);
1036
+ if (typeof value !== "object" || value === null || value instanceof Date) return value;
1037
+ return Object.fromEntries(Object.entries(value).sort(([left], [right]) => compareUnicodeCodePoints(left, right)).map(([key, nested]) => [key, normalizeConfigurationValue(nested)]));
1038
+ };
1039
+ clientConfigurationServersKey = (format) => {
1040
+ switch (format) {
1041
+ case "toml":
1042
+ case "grok":
1043
+ case "hermes": return "mcp_servers";
1044
+ case "opencode":
1045
+ case "zcode": return "mcp";
1046
+ case "vscode": return "servers";
1047
+ default: return "mcpServers";
1048
+ }
1049
+ };
1050
+ isEmptyClientConfigurationText = (text) => text.replace(/^\uFEFF/, "").trim() === "";
1051
+ parseDocument$1 = (text, format) => {
1052
+ if (format === "toml" || format === "grok") return requireObject(parse$1(text), "The configuration root");
1053
+ if (format === "pi" || format === "kimi") {
1054
+ if (format === "kimi" && text.trim().length === 0) return {};
1055
+ return requireObject(JSON.parse(text), "The configuration root");
1056
+ }
1057
+ if (isEmptyClientConfigurationText(text)) return {};
1058
+ if (format === "hermes") return requireObject(parseHermesConfigurationYaml(text), "The configuration root");
1059
+ if (format === "zcode") return requireObject(JSON.parse(text), "The configuration root");
1060
+ const errors = [];
1061
+ const jsonText = text.startsWith("") ? ` ${text.slice(1)}` : text;
1062
+ const document = parse(jsonText, errors, { allowTrailingComma: true });
1063
+ const firstError = errors[0];
1064
+ if (firstError !== undefined) throw new SyntaxError(`Invalid JSON/JSONC at offset ${firstError.offset}: ${printParseErrorCode(firstError.error)}`);
1065
+ return requireObject(document, "The configuration root");
1066
+ };
1067
+ ClientConfigurationShapeError = class extends TypeError {};
1068
+ requireObject = (value, description) => {
1069
+ const parsed = objectSchema.safeParse(value);
1070
+ if (parsed.success) return parsed.data;
1071
+ throw new ClientConfigurationShapeError(`${description} must be an object`, { cause: parsed.error });
1072
+ };
1073
+ parseZcodeFallbackConfiguration = (text) => {
1074
+ const document = requireObject(JSON.parse(text), "ZCode fallback root");
1075
+ return {
1076
+ document,
1077
+ servers: document.mcpServers === undefined ? {} : requireObject(document.mcpServers, "ZCode fallback mcpServers"),
1078
+ serversPath: ["mcpServers"],
1079
+ dialect: "zcode_fallback",
1080
+ legacyServers: {}
1081
+ };
1082
+ };
1083
+ OPENCODE_V2_MCP_SETTINGS = new Set(["servers", "timeout"]);
1084
+ parseClientConfiguration = (text, format) => {
1085
+ if (format === undefined || format === "unsupported") throw new TypeError("client does not have a supported MCP config format");
1086
+ if (format === "zcode_fallback") return parseZcodeFallbackConfiguration(text);
1087
+ if (format === "dsh") return parseDshCordisDocument(text);
1088
+ const document = parseDocument$1(text, format);
1089
+ const serversKey = clientConfigurationServersKey(format);
1090
+ const value = document[serversKey];
1091
+ const servers = value === undefined ? {} : requireObject(value, `"${serversKey}"`);
1092
+ if (format === "zcode") {
1093
+ const nested = servers.servers;
1094
+ return {
1095
+ document,
1096
+ servers: nested === undefined ? {} : requireObject(nested, `"${serversKey}.servers"`),
1097
+ serversPath: [serversKey, "servers"],
1098
+ dialect: format,
1099
+ legacyServers: {}
1100
+ };
1101
+ }
1102
+ const native = servers.servers;
1103
+ if (format !== "opencode" || native === undefined || typeof native === "object" && native !== null && "type" in native && typeof native.type === "string") return {
1104
+ document,
1105
+ servers,
1106
+ serversPath: [serversKey],
1107
+ dialect: format,
1108
+ legacyServers: {}
1109
+ };
1110
+ return {
1111
+ document,
1112
+ servers: requireObject(native, `"${serversKey}.servers"`),
1113
+ serversPath: [serversKey, "servers"],
1114
+ dialect: "opencode_v2",
1115
+ legacyServers: Object.fromEntries(Object.entries(servers).filter(([name]) => !OPENCODE_V2_MCP_SETTINGS.has(name)))
1116
+ };
1117
+ };
1118
+ effectiveClientServer = (parsed, name) => Object.hasOwn(parsed.servers, name) ? parsed.servers[name] : parsed.legacyServers[name];
1119
+ withClientServers = (parsed, servers, removeLegacy) => {
1120
+ if (parsed.dialect === "dsh") return Object.hasOwn(servers, PRODUCT_IDENTITY.mcpServerKey) ? editDshDocument(parsed, objectSchema.parse(servers[PRODUCT_IDENTITY.mcpServerKey])) : editDshDocument(parsed);
1121
+ const [key = "", nested] = parsed.serversPath;
1122
+ if (nested === undefined) return {
1123
+ ...parsed.document,
1124
+ [key]: servers
1125
+ };
1126
+ const outerValue = parsed.document[key];
1127
+ const outer = outerValue === undefined ? {} : { ...objectSchema.parse(outerValue) };
1128
+ if (parsed.dialect === "opencode_v2" && removeLegacy !== undefined && !OPENCODE_V2_MCP_SETTINGS.has(removeLegacy)) delete outer[removeLegacy];
1129
+ return {
1130
+ ...parsed.document,
1131
+ [key]: {
1132
+ ...outer,
1133
+ [nested]: servers
1134
+ }
1135
+ };
1136
+ };
1137
+ valueAt = (document, path) => {
1138
+ let current = document;
1139
+ for (const key of path) {
1140
+ const object = objectSchema.safeParse(current);
1141
+ if (!object.success || !Object.hasOwn(object.data, key)) return undefined;
1142
+ current = object.data[key];
1143
+ }
1144
+ return current;
1145
+ };
1146
+ TOML_BASIC_ESCAPES = {
1147
+ b: "\b",
1148
+ t: " ",
1149
+ n: "\n",
1150
+ f: "\f",
1151
+ r: "\r",
1152
+ e: "\x1B",
1153
+ "\"": "\"",
1154
+ "\\": "\\"
1155
+ };
1156
+ skipHorizontalSpace = (line, index) => {
1157
+ let next = index;
1158
+ while (line[next] === " " || line[next] === " ") next += 1;
1159
+ return next;
1160
+ };
1161
+ decodeBasicEscape = (line, slash) => {
1162
+ const escape = line[slash + 1];
1163
+ if (escape === undefined) return undefined;
1164
+ const simple = TOML_BASIC_ESCAPES[escape];
1165
+ if (simple !== undefined) return {
1166
+ value: simple,
1167
+ next: slash + 2
1168
+ };
1169
+ if (escape === "x") {
1170
+ const hex = line.slice(slash + 2, slash + 4);
1171
+ if (!/^[0-9A-Fa-f]{2}$/u.test(hex)) return undefined;
1172
+ return {
1173
+ value: String.fromCodePoint(Number.parseInt(hex, 16)),
1174
+ next: slash + 4
1175
+ };
1176
+ }
1177
+ if (escape !== "u" && escape !== "U") return undefined;
1178
+ const length = escape === "u" ? 4 : 8;
1179
+ const hex = line.slice(slash + 2, slash + 2 + length);
1180
+ if (!new RegExp(`^[0-9A-Fa-f]{${String(length)}}$`, "u").test(hex)) return undefined;
1181
+ const code = Number.parseInt(hex, 16);
1182
+ if (code > 1114111 || code >= 55296 && code <= 57343) return undefined;
1183
+ return {
1184
+ value: String.fromCodePoint(code),
1185
+ next: slash + 2 + length
1186
+ };
1187
+ };
1188
+ parseQuotedKey = (line, start) => {
1189
+ const quote = line[start];
1190
+ if (quote !== "\"" && quote !== "'" || line.startsWith(quote === "\"" ? "\"\"\"" : "'''", start)) return undefined;
1191
+ if (quote === "'") {
1192
+ const end = line.indexOf("'", start + 1);
1193
+ if (end < 0 || line.slice(start + 1, end).includes("\n")) return undefined;
1194
+ return {
1195
+ value: line.slice(start + 1, end),
1196
+ next: end + 1
1197
+ };
1198
+ }
1199
+ let value = "";
1200
+ let index = start + 1;
1201
+ while (index < line.length) {
1202
+ const char = line[index];
1203
+ if (char === "\n" || char === "\r") return undefined;
1204
+ if (char === "\"") return {
1205
+ value,
1206
+ next: index + 1
1207
+ };
1208
+ if (char !== "\\") {
1209
+ value += char ?? "";
1210
+ index += 1;
1211
+ continue;
1212
+ }
1213
+ const decoded = decodeBasicEscape(line, index);
1214
+ if (decoded === undefined) return undefined;
1215
+ value += decoded.value;
1216
+ index = decoded.next;
1217
+ }
1218
+ return undefined;
1219
+ };
1220
+ parseBareKey = (line, start) => {
1221
+ let index = start;
1222
+ while (/[A-Za-z0-9_-]/u.test(line[index] ?? "")) index += 1;
1223
+ if (index === start) return undefined;
1224
+ return {
1225
+ value: line.slice(start, index),
1226
+ next: index
1227
+ };
1228
+ };
1229
+ parseTomlTableHeader = (line) => {
1230
+ let index = skipHorizontalSpace(line, 0);
1231
+ const array = line.startsWith("[[", index);
1232
+ if (!array && line[index] !== "[") return undefined;
1233
+ index += array ? 2 : 1;
1234
+ const path = [];
1235
+ for (;;) {
1236
+ index = skipHorizontalSpace(line, index);
1237
+ const key = line[index] === "\"" || line[index] === "'" ? parseQuotedKey(line, index) : parseBareKey(line, index);
1238
+ if (key === undefined) return undefined;
1239
+ path.push(key.value);
1240
+ index = skipHorizontalSpace(line, key.next);
1241
+ if (line[index] !== ".") break;
1242
+ index += 1;
1243
+ }
1244
+ const close = array ? "]]" : "]";
1245
+ if (!line.startsWith(close, index)) return undefined;
1246
+ index = skipHorizontalSpace(line, index + close.length);
1247
+ if (index < line.length && line[index] !== "#") return undefined;
1248
+ return { path };
1249
+ };
1250
+ tomlStringModeAfter = (line, mode, start = 0) => {
1251
+ if (mode === "ml-basic" || mode === "ml-literal") {
1252
+ const delimiter = mode === "ml-basic" ? "\"\"\"" : "'''";
1253
+ const closed = closeMultiline(line, start, delimiter, mode === "ml-basic");
1254
+ if (closed === undefined) return mode;
1255
+ return tomlStringModeAfter(line, "none", closed);
1256
+ }
1257
+ let index = start;
1258
+ while (index < line.length) {
1259
+ if (line[index] === "#") return "none";
1260
+ if (line.startsWith("\"\"\"", index)) {
1261
+ const closed = closeMultiline(line, index + 3, "\"\"\"", true);
1262
+ if (closed === undefined) return "ml-basic";
1263
+ index = closed;
1264
+ continue;
1265
+ }
1266
+ if (line.startsWith("'''", index)) {
1267
+ const closed = closeMultiline(line, index + 3, "'''", false);
1268
+ if (closed === undefined) return "ml-literal";
1269
+ index = closed;
1270
+ continue;
1271
+ }
1272
+ const quote = line[index];
1273
+ if (quote === "\"" || quote === "'") {
1274
+ const quoted = parseQuotedKey(line, index);
1275
+ if (quoted === undefined) return "none";
1276
+ index = quoted.next;
1277
+ continue;
1278
+ }
1279
+ index += 1;
1280
+ }
1281
+ return "none";
1282
+ };
1283
+ closeMultiline = (line, start, delimiter, escapes) => {
1284
+ let index = start;
1285
+ while (index < line.length) {
1286
+ if (escapes && line[index] === "\\") {
1287
+ if (line[index + 1] === undefined) return undefined;
1288
+ index += 2;
1289
+ continue;
1290
+ }
1291
+ if (line.startsWith(delimiter, index)) {
1292
+ let end = index + delimiter.length;
1293
+ const quote = delimiter[0];
1294
+ let extra = 0;
1295
+ while (extra < 2 && line[end] === quote) {
1296
+ extra += 1;
1297
+ end += 1;
1298
+ }
1299
+ return end;
1300
+ }
1301
+ index += 1;
1302
+ }
1303
+ return undefined;
1304
+ };
1305
+ isBlankOrComment = (line) => {
1306
+ const trimmed = line.trimStart();
1307
+ return trimmed === "" || trimmed.startsWith("#");
1308
+ };
1309
+ looksLikeTomlHeader = (line) => line.trimStart().startsWith("[");
1310
+ isTomlServerTable = (path, serverKey) => path[0] === "mcp_servers" && path[1] === serverKey;
1311
+ parseKeyPath = (text, start) => {
1312
+ const segments = [];
1313
+ let index = start;
1314
+ for (;;) {
1315
+ index = skipHorizontalSpace(text, index);
1316
+ const current = text[index];
1317
+ if (current === undefined || current === "\n" || current === "\r") return undefined;
1318
+ const key = current === "\"" || current === "'" ? parseQuotedKey(text, index) : parseBareKey(text, index);
1319
+ if (key === undefined) return undefined;
1320
+ segments.push(key.value);
1321
+ index = skipHorizontalSpace(text, key.next);
1322
+ if (text[index] !== ".") return {
1323
+ segments,
1324
+ next: index
1325
+ };
1326
+ index += 1;
1327
+ }
1328
+ };
1329
+ parseAssignment = (line) => {
1330
+ const key = parseKeyPath(line, 0);
1331
+ if (key === undefined) return undefined;
1332
+ const equals = skipHorizontalSpace(line, key.next);
1333
+ if (line[equals] !== "=") return undefined;
1334
+ return {
1335
+ segments: key.segments,
1336
+ equals
1337
+ };
1338
+ };
1339
+ skipWsAndComments = (text, start) => {
1340
+ let index = start;
1341
+ while (index < text.length) {
1342
+ const char = text[index];
1343
+ if (char === " " || char === " " || char === "\n" || char === "\r") {
1344
+ index += 1;
1345
+ continue;
1346
+ }
1347
+ if (char === "#") {
1348
+ while (index < text.length && text[index] !== "\n") index += 1;
1349
+ continue;
1350
+ }
1351
+ return index;
1352
+ }
1353
+ return index;
1354
+ };
1355
+ endOfTomlValue = (text, start) => {
1356
+ const index = skipWsAndComments(text, start);
1357
+ if (index >= text.length) return index;
1358
+ if (text.startsWith("\"\"\"", index)) {
1359
+ const closed = closeMultiline(text, index + 3, "\"\"\"", true);
1360
+ return closed ?? text.length;
1361
+ }
1362
+ if (text.startsWith("'''", index)) {
1363
+ const closed = closeMultiline(text, index + 3, "'''", false);
1364
+ return closed ?? text.length;
1365
+ }
1366
+ const quote = text[index];
1367
+ if (quote === "\"" || quote === "'") {
1368
+ const quoted = parseQuotedKey(text, index);
1369
+ return quoted === undefined ? text.length : quoted.next;
1370
+ }
1371
+ if (quote === "{" || quote === "[") return endOfContainer(text, index);
1372
+ let cursor = index;
1373
+ while (cursor < text.length) {
1374
+ const char = text[cursor];
1375
+ if (char === "\n" || char === "#" || char === "," || char === "}" || char === "]") break;
1376
+ cursor += 1;
1377
+ }
1378
+ return cursor;
1379
+ };
1380
+ endOfContainer = (text, open) => {
1381
+ const closers = [text[open] === "{" ? "}" : "]"];
1382
+ let index = open + 1;
1383
+ while (index < text.length && closers.length > 0) {
1384
+ if (text.startsWith("\"\"\"", index)) {
1385
+ const closed = closeMultiline(text, index + 3, "\"\"\"", true);
1386
+ if (closed === undefined) return text.length;
1387
+ index = closed;
1388
+ continue;
1389
+ }
1390
+ if (text.startsWith("'''", index)) {
1391
+ const closed = closeMultiline(text, index + 3, "'''", false);
1392
+ if (closed === undefined) return text.length;
1393
+ index = closed;
1394
+ continue;
1395
+ }
1396
+ const quote = text[index];
1397
+ if (quote === "\"" || quote === "'") {
1398
+ const quoted = parseQuotedKey(text, index);
1399
+ if (quoted === undefined) return text.length;
1400
+ index = quoted.next;
1401
+ continue;
1402
+ }
1403
+ if (quote === "#") {
1404
+ while (index < text.length && text[index] !== "\n") index += 1;
1405
+ continue;
1406
+ }
1407
+ if (quote === "{" || quote === "[") {
1408
+ closers.push(quote === "{" ? "}" : "]");
1409
+ index += 1;
1410
+ continue;
1411
+ }
1412
+ if (quote === closers[closers.length - 1]) {
1413
+ closers.pop();
1414
+ index += 1;
1415
+ continue;
1416
+ }
1417
+ index += 1;
1418
+ }
1419
+ return index;
1420
+ };
1421
+ tomlBasicString = (value) => JSON.stringify(value).replaceAll("", "\\u007f");
1422
+ tomlInlineKey = (key) => /^[A-Za-z0-9_-]+$/u.test(key) ? key : tomlBasicString(key);
1423
+ tomlInlineValue = (value) => {
1424
+ if (typeof value === "string") return tomlBasicString(value);
1425
+ if (typeof value === "boolean") return value ? "true" : "false";
1426
+ if (typeof value === "number" && Number.isFinite(value)) return String(value);
1427
+ if (Array.isArray(value)) return `[${value.map((item) => tomlInlineValue(item)).join(", ")}]`;
1428
+ if (typeof value === "object" && value !== null) {
1429
+ const body = Object.entries(value).map(([key, nested]) => `${tomlInlineKey(key)} = ${tomlInlineValue(nested)}`).join(", ");
1430
+ return `{ ${body} }`;
1431
+ }
1432
+ return "\"\"";
1433
+ };
1434
+ readTrivia = (text, start, limit) => {
1435
+ let index = start;
1436
+ while (index < limit) {
1437
+ const char = text[index];
1438
+ if (char === " " || char === " " || char === "\n" || char === "\r" || char === ",") {
1439
+ index += 1;
1440
+ continue;
1441
+ }
1442
+ if (char === "#") {
1443
+ while (index < limit && text[index] !== "\n") index += 1;
1444
+ continue;
1445
+ }
1446
+ break;
1447
+ }
1448
+ return {
1449
+ text: text.slice(start, index),
1450
+ next: index
1451
+ };
1452
+ };
1453
+ commasOutsideComments = (trivia) => trivia.split("\n").map((part) => {
1454
+ const comment = part.indexOf("#");
1455
+ if (comment < 0) return part.replaceAll(",", "");
1456
+ return `${part.slice(0, comment).replaceAll(",", "")}${part.slice(comment)}`;
1457
+ }).join("\n");
1458
+ hasSeparatorComma = (trivia) => trivia.split("\n").some((part) => {
1459
+ const comment = part.indexOf("#");
1460
+ const code = comment < 0 ? part : part.slice(0, comment);
1461
+ return code.includes(",");
1462
+ });
1463
+ editInlineServerTable = (table, serverKey, entry) => {
1464
+ if (!table.startsWith("{")) return undefined;
1465
+ const end = endOfContainer(table, 0);
1466
+ if (table[end - 1] !== "}") return undefined;
1467
+ const pairs = [];
1468
+ let index = 1;
1469
+ let trailing = "";
1470
+ while (index < end - 1) {
1471
+ const trivia = readTrivia(table, index, end - 1);
1472
+ if (trivia.next >= end - 1) {
1473
+ trailing = trivia.text;
1474
+ break;
1475
+ }
1476
+ const key = parseKeyPath(table, trivia.next);
1477
+ if (key === undefined) return undefined;
1478
+ const equals = skipWsAndComments(table, key.next);
1479
+ if (table[equals] !== "=") return undefined;
1480
+ const valueEnd = endOfTomlValue(table, equals + 1);
1481
+ if (valueEnd > end - 1) return undefined;
1482
+ pairs.push({
1483
+ leading: trivia.text,
1484
+ text: table.slice(trivia.next, valueEnd),
1485
+ drop: key.segments[0] === serverKey
1486
+ });
1487
+ index = valueEnd;
1488
+ }
1489
+ const insertion = entry === undefined ? undefined : `${tomlInlineKey(serverKey)} = ${tomlInlineValue(entry)}`;
1490
+ if (insertion === undefined && pairs.every((pair) => !pair.drop)) return table;
1491
+ return rebuildInlineTable(pairs, trailing, insertion);
1492
+ };
1493
+ rebuildInlineTable = (pairs, trailing, insertion) => rebuildDelimitedEntries(pairs, trailing, insertion, "{", "}");
1494
+ rebuildDelimitedEntries = (pairs, trailing, insertion, open, close) => {
1495
+ const parts = [open];
1496
+ let emitted = false;
1497
+ let separatorPending = false;
1498
+ for (const pair of pairs) {
1499
+ if (pair.drop) {
1500
+ if (!pair.leading.includes("#")) continue;
1501
+ const dropped = !emitted || separatorPending ? commasOutsideComments(pair.leading) : pair.leading;
1502
+ parts.push(dropped);
1503
+ separatorPending = separatorPending || hasSeparatorComma(dropped);
1504
+ continue;
1505
+ }
1506
+ const kept = emitted ? pair.leading : commasOutsideComments(pair.leading);
1507
+ parts.push(separatorPending ? commasOutsideComments(kept) : kept);
1508
+ if (emitted && !separatorPending && !pair.leading.includes(",")) parts.push(", ");
1509
+ separatorPending = false;
1510
+ parts.push(pair.text);
1511
+ emitted = true;
1512
+ }
1513
+ if (insertion !== undefined) {
1514
+ if (!(emitted && separatorPending)) parts.push(emitted ? ", " : " ");
1515
+ parts.push(insertion);
1516
+ emitted = true;
1517
+ }
1518
+ if (!emitted) {
1519
+ const retained = `${parts.slice(1).join("")}${commasOutsideComments(trailing)}`;
1520
+ return retained.includes("#") ? `${open}${retained}${close}` : `${open}${close}`;
1521
+ }
1522
+ const tail = commasOutsideComments(trailing);
1523
+ parts.push(tail);
1524
+ if (tail === "" && open === "{") parts.push(" ");
1525
+ parts.push(close);
1526
+ return parts.join("");
1527
+ };
1528
+ tomlStringValue = (text) => {
1529
+ try {
1530
+ const value = parse$1(`value = ${text}`)["value"];
1531
+ return typeof value === "string" ? value : undefined;
1532
+ } catch (cause) {
1533
+ void cause;
1534
+ return undefined;
1535
+ }
1536
+ };
1537
+ tomlArrayWithoutString = (array, serverKey) => {
1538
+ if (!array.startsWith("[")) return undefined;
1539
+ const end = endOfContainer(array, 0);
1540
+ if (end !== array.length || array[end - 1] !== "]") return undefined;
1541
+ const pairs = [];
1542
+ let index = 1;
1543
+ let trailing = "";
1544
+ while (index < end - 1) {
1545
+ const trivia = readTrivia(array, index, end - 1);
1546
+ if (trivia.next >= end - 1) {
1547
+ trailing = trivia.text;
1548
+ break;
1549
+ }
1550
+ const valueEnd = endOfTomlValue(array, trivia.next);
1551
+ if (valueEnd > end - 1) return undefined;
1552
+ const text = array.slice(trivia.next, valueEnd);
1553
+ pairs.push({
1554
+ leading: trivia.text,
1555
+ text,
1556
+ drop: tomlStringValue(text) === serverKey
1557
+ });
1558
+ index = valueEnd;
1559
+ }
1560
+ if (pairs.every((pair) => !pair.drop)) return array;
1561
+ const rebuilt = rebuildDelimitedEntries(pairs, trailing, undefined, "[", "]");
1562
+ return rebuilt === "[]" ? "" : rebuilt;
1563
+ };
1564
+ disabledServerListEdit = (input) => {
1565
+ if (input.entry === undefined || input.tablePath.length !== 0 || input.segments.length !== 1 || input.segments[0] !== "disabled_mcp_servers") return { kind: "ignore" };
1566
+ const open = skipWsAndComments(input.text, input.valueOffset);
1567
+ if (input.text[open] !== "[") return { kind: "ignore" };
1568
+ const arrayText = input.text.slice(open, input.valueEnd);
1569
+ const edited = tomlArrayWithoutString(arrayText, input.serverKey);
1570
+ if (edited === undefined || edited === arrayText) return { kind: "keep" };
1571
+ if (edited === "") {
1572
+ const suffix = input.text.slice(input.valueEnd, input.statementEnd);
1573
+ const hash = suffix.indexOf("#");
1574
+ return {
1575
+ kind: "delete",
1576
+ comment: hash < 0 ? undefined : suffix.slice(hash)
1577
+ };
1578
+ }
1579
+ return {
1580
+ kind: "replace",
1581
+ text: `${input.text.slice(input.lineStart, open)}${edited}${input.text.slice(input.valueEnd, input.statementEnd)}`
1582
+ };
1583
+ };
1584
+ disabledServerListLines = (edit, lines, lineIndex, endLine) => {
1585
+ switch (edit.kind) {
1586
+ case "ignore": return undefined;
1587
+ case "keep": return lines.slice(lineIndex, endLine + 1);
1588
+ case "replace": return edit.text.split("\n");
1589
+ case "delete": return edit.comment === undefined ? [] : [edit.comment];
1590
+ default: {
1591
+ const unreachable = edit;
1592
+ return unreachable;
1593
+ }
1594
+ }
1595
+ };
1596
+ upsertTomlServerSection = (originalText, serverKey, entry, format) => {
1597
+ const bom = originalText.startsWith("");
1598
+ const source = bom ? originalText.slice(1) : originalText;
1599
+ const crlf = source.includes("\r\n") && !source.replaceAll("\r\n", "").includes("\n");
1600
+ const text = source;
1601
+ const lines = text.split("\n");
1602
+ const lineStarts = [];
1603
+ let cursor = 0;
1604
+ for (const line of lines) {
1605
+ lineStarts.push(cursor);
1606
+ cursor += line.length + 1;
1607
+ }
1608
+ const kept = [];
1609
+ const pending = [];
1610
+ let skipping = false;
1611
+ let inlineServerTable = false;
1612
+ let mode = "none";
1613
+ let tablePath = [];
1614
+ const discardPending = () => {
1615
+ pending.length = 0;
1616
+ };
1617
+ const flushPending = () => {
1618
+ kept.push(...pending);
1619
+ pending.length = 0;
1620
+ };
1621
+ const lineIndexAt = (offset) => {
1622
+ let line = 0;
1623
+ for (let index = 0; index < lineStarts.length; index += 1) if ((lineStarts[index] ?? 0) <= offset) line = index;
1624
+ return line;
1625
+ };
1626
+ let lineIndex = 0;
1627
+ while (lineIndex < lines.length) {
1628
+ const physical = lines[lineIndex] ?? "";
1629
+ const line = physical.endsWith("\r") ? physical.slice(0, -1) : physical;
1630
+ if (mode !== "none") {
1631
+ mode = tomlStringModeAfter(line, mode);
1632
+ if (skipping) discardPending();
1633
+ else kept.push(physical);
1634
+ lineIndex += 1;
1635
+ continue;
1636
+ }
1637
+ const header = parseTomlTableHeader(line);
1638
+ if (header !== undefined) {
1639
+ tablePath = header.path;
1640
+ if (isTomlServerTable(header.path, serverKey)) {
1641
+ discardPending();
1642
+ skipping = true;
1643
+ lineIndex += 1;
1644
+ continue;
1645
+ }
1646
+ skipping = false;
1647
+ flushPending();
1648
+ kept.push(physical);
1649
+ lineIndex += 1;
1650
+ continue;
1651
+ }
1652
+ const assignment = parseAssignment(line);
1653
+ if (assignment !== undefined) {
1654
+ const lineStart = lineStarts[lineIndex] ?? 0;
1655
+ const valueOffset = lineStart + assignment.equals + 1;
1656
+ const valueEnd = endOfTomlValue(text, valueOffset);
1657
+ let statementEnd = valueEnd;
1658
+ while (statementEnd < text.length && text[statementEnd] !== "\n") statementEnd += 1;
1659
+ const endLine = lineIndexAt(Math.max(statementEnd - 1, lineStart));
1660
+ if (skipping) {
1661
+ discardPending();
1662
+ lineIndex = endLine + 1;
1663
+ mode = "none";
1664
+ continue;
1665
+ }
1666
+ const disabledLines = format === "grok" ? disabledServerListLines(disabledServerListEdit({
1667
+ text,
1668
+ lineStart,
1669
+ valueOffset,
1670
+ valueEnd,
1671
+ statementEnd,
1672
+ tablePath,
1673
+ segments: assignment.segments,
1674
+ serverKey,
1675
+ entry
1676
+ }), lines, lineIndex, endLine) : undefined;
1677
+ if (disabledLines !== undefined) {
1678
+ flushPending();
1679
+ kept.push(...disabledLines);
1680
+ lineIndex = endLine + 1;
1681
+ mode = "none";
1682
+ continue;
1683
+ }
1684
+ const absolute = [...tablePath, ...assignment.segments];
1685
+ const open = skipWsAndComments(text, valueOffset);
1686
+ const closesServerTable = absolute.length === 1 && absolute[0] === "mcp_servers" && text[open] === "{";
1687
+ if (closesServerTable || isTomlServerTable(absolute, serverKey)) {
1688
+ if (closesServerTable) {
1689
+ flushPending();
1690
+ const edited = editInlineServerTable(text.slice(open, valueEnd), serverKey, entry);
1691
+ const prefix = text.slice(lineStart, open);
1692
+ const suffix = text.slice(valueEnd, statementEnd);
1693
+ const replacement = edited === undefined ? text.slice(lineStart, statementEnd) : `${prefix}${edited}${suffix}`;
1694
+ kept.push(...replacement.split("\n"));
1695
+ inlineServerTable = true;
1696
+ } else discardPending();
1697
+ } else {
1698
+ flushPending();
1699
+ for (let index = lineIndex; index <= endLine; index += 1) kept.push(lines[index] ?? "");
1700
+ }
1701
+ lineIndex = endLine + 1;
1702
+ mode = "none";
1703
+ continue;
1704
+ }
1705
+ if (isBlankOrComment(line)) {
1706
+ if (format === "toml" && line.trimStart().startsWith("#")) {
1707
+ flushPending();
1708
+ kept.push(physical);
1709
+ } else pending.push(physical);
1710
+ lineIndex += 1;
1711
+ continue;
1712
+ }
1713
+ mode = tomlStringModeAfter(line, "none");
1714
+ if (skipping) {
1715
+ if (looksLikeTomlHeader(line)) {
1716
+ flushPending();
1717
+ skipping = false;
1718
+ tablePath = ["\0"];
1719
+ kept.push(physical);
1720
+ } else discardPending();
1721
+ } else {
1722
+ flushPending();
1723
+ kept.push(physical);
1724
+ }
1725
+ lineIndex += 1;
1726
+ }
1727
+ if (!skipping) flushPending();
1728
+ let body = kept.join("\n");
1729
+ if (body.endsWith("\r")) body += "\n";
1730
+ if (entry !== undefined && !inlineServerTable) {
1731
+ let fragment = stringify({ mcp_servers: { [serverKey]: entry } }).replace(/\n+$/u, "");
1732
+ if (crlf) fragment = fragment.replaceAll("\n", "\r\n");
1733
+ const nl = crlf ? "\r\n" : "\n";
1734
+ const endedWithNewline = body.endsWith("\n");
1735
+ const base = body.replace(/\n+$/u, "");
1736
+ const trimmed = endedWithNewline && base.endsWith("\r") ? base.slice(0, -1) : base;
1737
+ body = trimmed.length === 0 ? `${fragment}${nl}` : `${trimmed}${nl}${nl}${fragment}${nl}`;
1738
+ }
1739
+ return bom ? `\uFEFF${body}` : body;
1740
+ };
1741
+ tomlServerEntry = (document, serverKey) => {
1742
+ const servers = objectSchema.safeParse(document.mcp_servers);
1743
+ if (!servers.success || !Object.hasOwn(servers.data, serverKey)) return undefined;
1744
+ return servers.data[serverKey];
1745
+ };
1746
+ grokServerListedDisabled = (document, serverKey) => Array.isArray(document.disabled_mcp_servers) && document.disabled_mcp_servers.includes(serverKey);
1747
+ OMP_DISABLED_SERVERS_KEY = "disabledServers";
1748
+ ompServerListedDisabled = (document, serverKey) => {
1749
+ const listed = document[OMP_DISABLED_SERVERS_KEY];
1750
+ return Array.isArray(listed) && listed.includes(serverKey);
1751
+ };
1752
+ OMP_ENABLED_SERVERS_KEY = "enabledServers";
1753
+ clientServerForcedEnabled = (parsed, serverKey) => {
1754
+ if (parsed.dialect !== "omp") return false;
1755
+ const listed = parsed.document[OMP_ENABLED_SERVERS_KEY];
1756
+ return Array.isArray(listed) && listed.includes(serverKey);
1757
+ };
1758
+ clientServerListedDisabled = (parsed, serverKey) => parsed.dialect === "grok" && grokServerListedDisabled(parsed.document, serverKey) || parsed.dialect === "omp" && ompServerListedDisabled(parsed.document, serverKey);
1759
+ serializeGrokConfiguration = (document, originalText) => {
1760
+ const entry = tomlServerEntry(document, PRODUCT_IDENTITY.mcpServerKey);
1761
+ if (originalText === undefined) return stringify(document);
1762
+ return upsertTomlServerSection(originalText, PRODUCT_IDENTITY.mcpServerKey, entry, "grok");
1763
+ };
1764
+ withoutEmptyServerTable = (document) => {
1765
+ const servers = objectSchema.safeParse(document.mcp_servers);
1766
+ if (!servers.success || Object.keys(servers.data).length > 0) return document;
1767
+ const { mcp_servers: empty, ...rest } = document;
1768
+ void empty;
1769
+ return rest;
1770
+ };
1771
+ serializeCodexConfiguration = (document, originalText) => {
1772
+ if (originalText === undefined || isEmptyClientConfigurationText(originalText)) return stringify(document);
1773
+ const upserted = upsertTomlServerSection(originalText, PRODUCT_IDENTITY.mcpServerKey, tomlServerEntry(document, PRODUCT_IDENTITY.mcpServerKey), "toml");
1774
+ const edited = originalText.endsWith("\n") && !upserted.endsWith("\n") ? `${upserted}${originalText.endsWith("\r\n") ? "\r\n" : "\n"}` : upserted;
1775
+ return tomlTextHolds(edited, document) ? edited : stringify(document);
1776
+ };
1777
+ tomlTextHolds = (text, document) => {
1778
+ try {
1779
+ return clientConfigurationValuesEqual(withoutEmptyServerTable(objectSchema.parse(parse$1(text))), withoutEmptyServerTable(document));
1780
+ } catch (cause) {
1781
+ void cause;
1782
+ return false;
1783
+ }
1784
+ };
1785
+ commentsBetweenProperties = (gap) => {
1786
+ const pieces = [];
1787
+ let index = 0;
1788
+ while (index < gap.length) {
1789
+ const line = gap.indexOf("//", index);
1790
+ const block = gap.indexOf("/*", index);
1791
+ if (line < 0 && block < 0) break;
1792
+ const start = line < 0 ? block : block < 0 ? line : Math.min(line, block);
1793
+ const lineComment = start === line;
1794
+ const close = lineComment ? gap.indexOf("\n", start) : gap.indexOf("*/", start + 2);
1795
+ if (!lineComment && close < 0) return undefined;
1796
+ const end = lineComment ? close < 0 ? gap.length : close : close + 2;
1797
+ const comment = gap.slice(start, end);
1798
+ const lineBreak = gap.lastIndexOf("\n", start - 1);
1799
+ if (lineBreak < 0) pieces.push(` ${comment}`);
1800
+ else {
1801
+ const prefix = gap.slice(lineBreak + 1, start);
1802
+ let indentEnd = 0;
1803
+ while (prefix[indentEnd] === " " || prefix[indentEnd] === " ") indentEnd += 1;
1804
+ const newline = lineBreak > 0 && gap[lineBreak - 1] === "\r" ? "\r\n" : "\n";
1805
+ pieces.push(`${newline}${prefix.slice(0, indentEnd)}${comment}`);
1806
+ }
1807
+ index = end;
1808
+ }
1809
+ return pieces.length === 0 ? undefined : pieces.join("");
1810
+ };
1811
+ deleteJsonPropertyPreservingComments = (text, path) => {
1812
+ const root = parseTree(text, [], { allowTrailingComma: true });
1813
+ const value = root === undefined ? undefined : findNodeAtLocation(root, [...path]);
1814
+ const property = value?.parent;
1815
+ const parent = property?.parent;
1816
+ if (property === undefined || parent?.type !== "object" || property.type !== "property" || parent.children === undefined) return undefined;
1817
+ const propertyIndex = parent.children.indexOf(property);
1818
+ const previous = parent.children[propertyIndex - 1];
1819
+ if (propertyIndex <= 0 || previous === undefined) return undefined;
1820
+ const comments = commentsBetweenProperties(text.slice(previous.offset + previous.length, property.offset));
1821
+ if (comments === undefined) return undefined;
1822
+ let removeEnd = property.offset + property.length;
1823
+ const hasNext = parent.children[propertyIndex + 1] !== undefined;
1824
+ if (hasNext) {
1825
+ let comma = removeEnd;
1826
+ while (comma < text.length) {
1827
+ const char = text[comma];
1828
+ if (char === " " || char === " " || char === "\r" || char === "\n") {
1829
+ comma += 1;
1830
+ continue;
1831
+ }
1832
+ if (text.startsWith("/*", comma)) {
1833
+ const close = text.indexOf("*/", comma + 2);
1834
+ if (close < 0) return undefined;
1835
+ comma = close + 2;
1836
+ continue;
1837
+ }
1838
+ if (text.startsWith("//", comma)) {
1839
+ while (comma < text.length && text[comma] !== "\n" && text[comma] !== "\r") comma += 1;
1840
+ continue;
1841
+ }
1842
+ break;
1843
+ }
1844
+ if (text[comma] !== ",") return undefined;
1845
+ removeEnd = comma + 1;
1846
+ }
1847
+ const remainder = text.slice(removeEnd);
1848
+ let suffix = `${hasNext ? "," : ""}${comments}`;
1849
+ if (suffix.includes("//") && !suffix.endsWith("\n") && !suffix.endsWith("\r") && !remainder.startsWith("\n") && !remainder.startsWith("\r")) suffix += "\n";
1850
+ return `${text.slice(0, previous.offset + previous.length)}${suffix}${remainder}`;
1851
+ };
1852
+ serializeClientConfiguration = (document, format, originalText, editedPaths) => {
1853
+ if (format === undefined || format === "unsupported") throw new TypeError("client does not have a supported MCP config format");
1854
+ if (format === "toml") return serializeCodexConfiguration(document, originalText);
1855
+ if (format === "grok") return serializeGrokConfiguration(document, originalText);
1856
+ if (format === "hermes") return serializeHermesConfiguration(document, originalText);
1857
+ if (format === "dsh") return serializeDshDocument(document);
1858
+ if (originalText !== undefined && !isEmptyClientConfigurationText(originalText) && editedPaths !== undefined) return editedPaths.reduce((text, path) => {
1859
+ const value = valueAt(document, path);
1860
+ if (value === undefined) {
1861
+ const preserved = deleteJsonPropertyPreservingComments(text, path);
1862
+ if (preserved !== undefined) return preserved;
1863
+ }
1864
+ return applyEdits(text, modify(text, [...path], value, { formattingOptions: {
1865
+ insertSpaces: true,
1866
+ tabSize: 2,
1867
+ eol: "\n"
1868
+ } }));
1869
+ }, originalText);
1870
+ return `${JSON.stringify(document, null, 2)}\n`;
1871
+ };
1872
+ clientServerPath = (parsed, name) => [...parsed.serversPath, name];
1873
+ legacyClientServerPath = (parsed, name) => Object.hasOwn(parsed.legacyServers, name) ? [parsed.serversPath[0] ?? "mcp", name] : undefined;
1874
+ serializeHermesConfiguration = (document, originalText) => {
1875
+ if (originalText === undefined || isEmptyClientConfigurationText(originalText)) return stringifyHermesConfigurationYaml(document);
1876
+ const serversKey = clientConfigurationServersKey("hermes");
1877
+ const servers = document[serversKey];
1878
+ const entry = typeof servers === "object" && servers !== null ? servers[PRODUCT_IDENTITY.mcpServerKey] : undefined;
1879
+ return editHermesConfigurationYaml(originalText, [serversKey, PRODUCT_IDENTITY.mcpServerKey], entry);
1880
+ };
1881
+ clientRegistrationEntry = (format, command, environment) => {
1882
+ const [executable = "rea", ...args] = command;
1883
+ switch (format) {
1884
+ case "opencode": return {
1885
+ type: "local",
1886
+ command: [...command],
1887
+ enabled: true,
1888
+ ...Object.keys(environment).length === 0 ? {} : { environment: { ...environment } }
1889
+ };
1890
+ case "kimi": return {
1891
+ command: executable,
1892
+ args,
1893
+ ...Object.keys(environment).length === 0 ? {} : { env: environment }
1894
+ };
1895
+ case "opencode_v2": return {
1896
+ type: "local",
1897
+ command: [...command],
1898
+ ...Object.keys(environment).length === 0 ? {} : { environment: { ...environment } }
1899
+ };
1900
+ case "vscode":
1901
+ case "omp":
1902
+ case "pi": return {
1903
+ type: "stdio",
1904
+ command: executable,
1905
+ args,
1906
+ ...Object.keys(environment).length === 0 ? {} : { env: environment }
1907
+ };
1908
+ case "copilot_cli": return {
1909
+ type: "stdio",
1910
+ command: executable,
1911
+ args,
1912
+ tools: ["*"],
1913
+ ...Object.keys(environment).length === 0 ? {} : { env: environment }
1914
+ };
1915
+ case "commandcode": return {
1916
+ transport: "stdio",
1917
+ enabled: true,
1918
+ command: executable,
1919
+ args,
1920
+ ...Object.keys(environment).length === 0 ? {} : { env: environment }
1921
+ };
1922
+ case "dsh": return dshClientRegistrationEntry(command, environment);
1923
+ case "hermes": return {
1924
+ command: executable,
1925
+ args,
1926
+ ...Object.keys(environment).length === 0 ? {} : { env: environment },
1927
+ enabled: true
1928
+ };
1929
+ default: return {
1930
+ command: executable,
1931
+ args,
1932
+ ...Object.keys(environment).length === 0 ? {} : { env: environment }
1933
+ };
1934
+ }
1935
+ };
1936
+ parseGeminiMcpPolicy = (parsed) => z.object({
1937
+ allowed: z.array(z.string()).optional(),
1938
+ excluded: z.array(z.string()).optional()
1939
+ }).passthrough().parse(parsed.document.mcp ?? {});
1940
+ normalizeGeminiServerName = (name) => name.toLowerCase().trim();
1941
+ geminiServerPolicyBlock = (policies, serverKey) => {
1942
+ const key = normalizeGeminiServerName(serverKey);
1943
+ if (policies.some(({ excluded }) => excluded?.some((name) => normalizeGeminiServerName(name) === key))) return `Gemini mcp.excluded blocks ${serverKey}. Review the selected settings policies before rerunning setup.`;
1944
+ const allowlists = policies.flatMap(({ allowed }) => allowed === undefined ? [] : [allowed]);
1945
+ const allowed = allowlists.reduce((previous, current) => {
1946
+ if (previous === undefined) return current;
1947
+ const normalized = new Set(current.map(normalizeGeminiServerName));
1948
+ return previous.filter((name) => normalized.has(normalizeGeminiServerName(name)));
1949
+ }, undefined);
1950
+ if (allowed !== undefined && allowed.length > 0 && !allowed.some((name) => normalizeGeminiServerName(name) === key)) return `Gemini mcp.allowed does not include ${serverKey}. Review the selected settings policies before rerunning setup.`;
1951
+ return undefined;
1952
+ };
1953
+ })))();
1954
+ }
1955
+
1956
+ //#endregion
1957
+ export { ClientConfigurationShapeError, DshCordisDocument, MANAGED_SKILL_FILES, OMP_DISABLED_SERVERS_KEY, canonicalSkillNeedsInstall, clientConfigurationValuesEqual, clientRegistrationEntry, clientServerForcedEnabled, clientServerListedDisabled, clientServerPath, dshDocument, effectiveClientServer, existingSkillDestinations, geminiServerPolicyBlock, init_ClientConfigurationDocument, init_DshCordisPatch, init_SetupRecoveryBackup, init_SetupSkill, installCanonicalSkill, isManagedSkillManifest, legacyClientServerPath, parseClientConfiguration, parseGeminiMcpPolicy, parseZcodeFallbackConfiguration, preserveRecoveryBackup, readInstalledSkillIdentity, readSkillFile, selectCurrentRecoveryBackup, serializeClientConfiguration, skillDestinations, validateCanonicalSkillDirectories, withClientServers };