@eyeauras/insight-cli 0.1.0 → 0.2.1

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 (391) hide show
  1. package/.cli-package-build.json +1 -1
  2. package/README.md +33 -2
  3. package/SKILL.md +38 -51
  4. package/dist/src/administration-results.js +1 -1
  5. package/dist/src/administration.d.ts +1 -1
  6. package/dist/src/administration.js +16 -2
  7. package/dist/src/binary.d.ts +3 -0
  8. package/dist/src/binary.js +74 -0
  9. package/dist/src/capture.d.ts +3 -0
  10. package/dist/src/capture.js +220 -0
  11. package/dist/src/cli.js +91 -14
  12. package/dist/src/contexts.d.ts +5 -0
  13. package/dist/src/contexts.js +54 -18
  14. package/dist/src/debugger-caller.d.ts +17 -0
  15. package/dist/src/debugger-caller.js +129 -0
  16. package/dist/src/debugger-launch.d.ts +2 -0
  17. package/dist/src/debugger-launch.js +17 -0
  18. package/dist/src/debugger-results.d.ts +1 -0
  19. package/dist/src/debugger-results.js +8 -0
  20. package/dist/src/debugger-supervisor.js +56 -13
  21. package/dist/src/debugger.js +16 -7
  22. package/dist/src/die.d.ts +12 -0
  23. package/dist/src/die.js +127 -0
  24. package/dist/src/dnspy-runtime.d.ts +8 -0
  25. package/dist/src/dnspy-runtime.js +46 -0
  26. package/dist/src/dnspy.d.ts +22 -0
  27. package/dist/src/dnspy.js +160 -0
  28. package/dist/src/dotnet-diagnostics.d.ts +13 -0
  29. package/dist/src/dotnet-diagnostics.js +101 -0
  30. package/dist/src/frida-worker.d.ts +1 -0
  31. package/dist/src/frida-worker.js +125 -0
  32. package/dist/src/frida.d.ts +16 -0
  33. package/dist/src/frida.js +125 -0
  34. package/dist/src/ghidra-debugger-runtime.d.ts +7 -0
  35. package/dist/src/ghidra-debugger-runtime.js +31 -0
  36. package/dist/src/ghidra-processes.d.ts +6 -0
  37. package/dist/src/ghidra-processes.js +121 -0
  38. package/dist/src/ghidra.js +6 -6
  39. package/dist/src/ilspy.d.ts +7 -0
  40. package/dist/src/ilspy.js +122 -0
  41. package/dist/src/lifecycle.d.ts +1 -1
  42. package/dist/src/lifecycle.js +8 -2
  43. package/dist/src/lldb.d.ts +10 -0
  44. package/dist/src/lldb.js +99 -0
  45. package/dist/src/llvm.d.ts +6 -0
  46. package/dist/src/llvm.js +133 -0
  47. package/dist/src/managed-heap.d.ts +4 -0
  48. package/dist/src/managed-heap.js +73 -0
  49. package/dist/src/managed-metadata.d.ts +11 -0
  50. package/dist/src/managed-metadata.js +66 -0
  51. package/dist/src/mitmproxy.d.ts +55 -0
  52. package/dist/src/mitmproxy.js +172 -0
  53. package/dist/src/native-inputs.d.ts +3 -2
  54. package/dist/src/native-inputs.js +21 -5
  55. package/dist/src/package-version.d.ts +1 -0
  56. package/dist/src/package-version.js +3 -0
  57. package/dist/src/procmon-config.d.ts +2 -0
  58. package/dist/src/procmon-config.js +15 -0
  59. package/dist/src/procmon-events.d.ts +13 -0
  60. package/dist/src/procmon-events.js +82 -0
  61. package/dist/src/procmon.d.ts +4 -0
  62. package/dist/src/procmon.js +107 -0
  63. package/dist/src/research.d.ts +11 -2
  64. package/dist/src/research.js +5 -3
  65. package/dist/src/runtime-catalog.d.ts +13 -0
  66. package/dist/src/runtime-catalog.js +26 -0
  67. package/dist/src/runtime-manager.d.ts +125 -0
  68. package/dist/src/runtime-manager.js +385 -0
  69. package/dist/src/runtime-selection.d.ts +13 -0
  70. package/dist/src/runtime-selection.js +42 -0
  71. package/dist/src/server.d.ts +15 -0
  72. package/dist/src/server.js +77 -96
  73. package/dist/src/sevenzip.d.ts +15 -0
  74. package/dist/src/sevenzip.js +119 -0
  75. package/dist/src/strace.d.ts +10 -0
  76. package/dist/src/strace.js +71 -0
  77. package/dist/src/text-window.d.ts +11 -0
  78. package/dist/src/text-window.js +6 -0
  79. package/dist/src/tool-runtime/archives.d.ts +10 -0
  80. package/dist/src/tool-runtime/archives.js +194 -0
  81. package/dist/src/tool-runtime/catalog.d.ts +3 -0
  82. package/dist/src/tool-runtime/catalog.js +13 -0
  83. package/dist/src/tool-runtime/commands.d.ts +9 -0
  84. package/dist/src/tool-runtime/commands.js +39 -0
  85. package/dist/src/tool-runtime/deadline.d.ts +11 -0
  86. package/dist/src/tool-runtime/deadline.js +32 -0
  87. package/dist/src/tool-runtime/definition.d.ts +73 -0
  88. package/dist/src/tool-runtime/definition.js +49 -0
  89. package/dist/src/tool-runtime/dotnet.d.ts +4 -0
  90. package/dist/src/tool-runtime/dotnet.js +22 -0
  91. package/dist/src/tool-runtime/identity.d.ts +6 -0
  92. package/dist/src/tool-runtime/identity.js +50 -0
  93. package/dist/src/tool-runtime/installer.d.ts +101 -0
  94. package/dist/src/tool-runtime/installer.js +180 -0
  95. package/dist/src/tool-runtime/launch-worker.d.ts +1 -0
  96. package/dist/src/tool-runtime/launch-worker.js +58 -0
  97. package/dist/src/tool-runtime/run.d.ts +51 -0
  98. package/dist/src/tool-runtime/run.js +159 -0
  99. package/dist/src/tool-runtime/store.d.ts +15 -0
  100. package/dist/src/tool-runtime/store.js +219 -0
  101. package/dist/src/tool-runtime/supervisor.d.ts +57 -0
  102. package/dist/src/tool-runtime/supervisor.js +266 -0
  103. package/dist/src/tool-runtime/windows-job.d.ts +22 -0
  104. package/dist/src/tool-runtime/windows-job.js +43 -0
  105. package/dist/src/toolbox.d.ts +84 -0
  106. package/dist/src/toolbox.js +35 -0
  107. package/dist/src/tshark.d.ts +23 -0
  108. package/dist/src/tshark.js +174 -0
  109. package/dist/src/windbg.d.ts +14 -0
  110. package/dist/src/windbg.js +119 -0
  111. package/dist/src/workspace.d.ts +1 -0
  112. package/dist/src/workspace.js +6 -0
  113. package/package.json +7 -4
  114. package/references/administration.md +2 -1
  115. package/references/agent-execution.md +36 -0
  116. package/references/agent-setup.md +61 -0
  117. package/references/artifacts.md +5 -0
  118. package/references/debugger.md +22 -0
  119. package/references/ilspy.md +33 -0
  120. package/references/managed-runtime.md +157 -0
  121. package/references/native/InsightPythonWheels.java +283 -2
  122. package/references/native/InsightRuntimeDoctor.java +33 -0
  123. package/references/native/InsightTraceState.java +28 -13
  124. package/references/setup.md +6 -3
  125. package/runtime/managed/insight-heap/Azure.Core.dll +0 -0
  126. package/runtime/managed/insight-heap/Azure.Identity.dll +0 -0
  127. package/runtime/managed/insight-heap/Insight.Heap.csproj +1 -0
  128. package/runtime/managed/insight-heap/Insight.Heap.deps.json +391 -0
  129. package/runtime/managed/insight-heap/Insight.Heap.dll +0 -0
  130. package/runtime/managed/insight-heap/Insight.Heap.runtimeconfig.json +13 -0
  131. package/runtime/managed/insight-heap/Microsoft.Bcl.AsyncInterfaces.dll +0 -0
  132. package/runtime/managed/insight-heap/Microsoft.Diagnostics.NETCore.Client.dll +0 -0
  133. package/runtime/managed/insight-heap/Microsoft.Diagnostics.Runtime.dll +0 -0
  134. package/runtime/managed/insight-heap/Microsoft.Extensions.Configuration.Abstractions.dll +0 -0
  135. package/runtime/managed/insight-heap/Microsoft.Extensions.DependencyInjection.Abstractions.dll +0 -0
  136. package/runtime/managed/insight-heap/Microsoft.Extensions.Diagnostics.Abstractions.dll +0 -0
  137. package/runtime/managed/insight-heap/Microsoft.Extensions.FileProviders.Abstractions.dll +0 -0
  138. package/runtime/managed/insight-heap/Microsoft.Extensions.Hosting.Abstractions.dll +0 -0
  139. package/runtime/managed/insight-heap/Microsoft.Extensions.Logging.Abstractions.dll +0 -0
  140. package/runtime/managed/insight-heap/Microsoft.Extensions.Options.dll +0 -0
  141. package/runtime/managed/insight-heap/Microsoft.Extensions.Primitives.dll +0 -0
  142. package/runtime/managed/insight-heap/Microsoft.Identity.Client.Extensions.Msal.dll +0 -0
  143. package/runtime/managed/insight-heap/Microsoft.Identity.Client.dll +0 -0
  144. package/runtime/managed/insight-heap/Microsoft.IdentityModel.Abstractions.dll +0 -0
  145. package/runtime/managed/insight-heap/Microsoft.Security.AntiSSRF.dll +0 -0
  146. package/runtime/managed/insight-heap/NuGet.Config +1 -0
  147. package/runtime/managed/insight-heap/Program.cs +20 -0
  148. package/runtime/managed/insight-heap/README.md +16 -0
  149. package/runtime/managed/insight-heap/System.ClientModel.dll +0 -0
  150. package/runtime/managed/insight-heap/System.Memory.Data.dll +0 -0
  151. package/runtime/managed/insight-heap/System.Security.Cryptography.ProtectedData.dll +0 -0
  152. package/runtime/managed/insight-heap/dependencies.json +436 -0
  153. package/runtime/managed/insight-heap/notices/Azure.Core-LICENSE.txt +21 -0
  154. package/runtime/managed/insight-heap/notices/Azure.Identity-LICENSE.txt +21 -0
  155. package/runtime/managed/insight-heap/notices/Microsoft.Bcl.AsyncInterfaces-LICENSE.txt +23 -0
  156. package/runtime/managed/insight-heap/notices/Microsoft.Bcl.AsyncInterfaces-THIRD-PARTY-NOTICES.TXT +1418 -0
  157. package/runtime/managed/insight-heap/notices/Microsoft.Diagnostics.NETCore.Client-LICENSE.txt +23 -0
  158. package/runtime/managed/insight-heap/notices/Microsoft.Diagnostics.Runtime-LICENSE.txt +23 -0
  159. package/runtime/managed/insight-heap/notices/Microsoft.Extensions.Configuration.Abstractions-LICENSE.txt +23 -0
  160. package/runtime/managed/insight-heap/notices/Microsoft.Extensions.Configuration.Abstractions-THIRD-PARTY-NOTICES.TXT +1418 -0
  161. package/runtime/managed/insight-heap/notices/Microsoft.Extensions.DependencyInjection.Abstractions-LICENSE.txt +23 -0
  162. package/runtime/managed/insight-heap/notices/Microsoft.Extensions.DependencyInjection.Abstractions-THIRD-PARTY-NOTICES.TXT +1418 -0
  163. package/runtime/managed/insight-heap/notices/Microsoft.Extensions.Diagnostics.Abstractions-LICENSE.txt +23 -0
  164. package/runtime/managed/insight-heap/notices/Microsoft.Extensions.Diagnostics.Abstractions-THIRD-PARTY-NOTICES.TXT +1418 -0
  165. package/runtime/managed/insight-heap/notices/Microsoft.Extensions.FileProviders.Abstractions-LICENSE.txt +23 -0
  166. package/runtime/managed/insight-heap/notices/Microsoft.Extensions.FileProviders.Abstractions-THIRD-PARTY-NOTICES.TXT +1418 -0
  167. package/runtime/managed/insight-heap/notices/Microsoft.Extensions.Hosting.Abstractions-LICENSE.txt +23 -0
  168. package/runtime/managed/insight-heap/notices/Microsoft.Extensions.Hosting.Abstractions-THIRD-PARTY-NOTICES.TXT +1418 -0
  169. package/runtime/managed/insight-heap/notices/Microsoft.Extensions.Logging.Abstractions-LICENSE.txt +23 -0
  170. package/runtime/managed/insight-heap/notices/Microsoft.Extensions.Logging.Abstractions-THIRD-PARTY-NOTICES.TXT +1418 -0
  171. package/runtime/managed/insight-heap/notices/Microsoft.Extensions.Options-LICENSE.txt +23 -0
  172. package/runtime/managed/insight-heap/notices/Microsoft.Extensions.Options-THIRD-PARTY-NOTICES.TXT +1418 -0
  173. package/runtime/managed/insight-heap/notices/Microsoft.Extensions.Primitives-LICENSE.txt +23 -0
  174. package/runtime/managed/insight-heap/notices/Microsoft.Extensions.Primitives-THIRD-PARTY-NOTICES.TXT +1418 -0
  175. package/runtime/managed/insight-heap/notices/Microsoft.Identity.Client-LICENSE.txt +21 -0
  176. package/runtime/managed/insight-heap/notices/Microsoft.Identity.Client.Extensions.Msal-LICENSE.txt +21 -0
  177. package/runtime/managed/insight-heap/notices/Microsoft.IdentityModel.Abstractions-LICENSE.txt +21 -0
  178. package/runtime/managed/insight-heap/notices/Microsoft.Security.AntiSSRF-LICENSE.txt +21 -0
  179. package/runtime/managed/insight-heap/notices/System.ClientModel-LICENSE.txt +21 -0
  180. package/runtime/managed/insight-heap/notices/System.Memory.Data-LICENSE.txt +23 -0
  181. package/runtime/managed/insight-heap/notices/System.Memory.Data-THIRD-PARTY-NOTICES.TXT +1418 -0
  182. package/runtime/managed/insight-heap/notices/System.Security.Cryptography.ProtectedData-LICENSE.TXT +23 -0
  183. package/runtime/managed/insight-heap/notices/System.Security.Cryptography.ProtectedData-THIRD-PARTY-NOTICES.TXT +309 -0
  184. package/runtime/managed/insight-heap/packages.lock.json +165 -0
  185. package/runtime/managed/insight-heap/provenance.json +146 -0
  186. package/runtime/managed/insight-heap/runtimes/win/lib/netstandard2.0/System.Security.Cryptography.ProtectedData.dll +0 -0
  187. package/runtime/managed/insight-managed/Insight.Managed.csproj +4 -0
  188. package/runtime/managed/insight-managed/Insight.Managed.deps.json +41 -0
  189. package/runtime/managed/insight-managed/Insight.Managed.dll +0 -0
  190. package/runtime/managed/insight-managed/Insight.Managed.runtimeconfig.json +13 -0
  191. package/runtime/managed/insight-managed/LICENSE.dnlib.txt +20 -0
  192. package/runtime/managed/insight-managed/NuGet.Config +1 -0
  193. package/runtime/managed/insight-managed/Program.cs +31 -0
  194. package/runtime/managed/insight-managed/README.md +16 -0
  195. package/runtime/managed/insight-managed/dnlib.dll +0 -0
  196. package/runtime/managed/insight-managed/packages.lock.json +13 -0
  197. package/runtime/managed/insight-managed/provenance.json +40 -0
  198. package/runtime/native/binary/README.md +22 -0
  199. package/runtime/native/binary/dependencies.json +166 -0
  200. package/runtime/native/binary/helper.cpp +44 -0
  201. package/runtime/native/binary/insight-binary-darwin-arm64 +0 -0
  202. package/runtime/native/binary/notices/Catch2-3.12.0--Catch2-3.12.0__LICENSE.txt +23 -0
  203. package/runtime/native/binary/notices/LIEF-LICENSE.txt +202 -0
  204. package/runtime/native/binary/notices/LIEF-attribution.txt +37 -0
  205. package/runtime/native/binary/notices/Melkor_ELF_Fuzzer-ac2495b--elf_fuzzer-master__LICENSE.txt +674 -0
  206. package/runtime/native/binary/notices/expected-1.3.1--expected-1.3.1__COPYING +121 -0
  207. package/runtime/native/binary/notices/frozen-61dce5a--frozen-61dce5ae18ca59931e27675c468e64118aba8744__AUTHORS +3 -0
  208. package/runtime/native/binary/notices/frozen-61dce5a--frozen-61dce5ae18ca59931e27675c468e64118aba8744__LICENSE +202 -0
  209. package/runtime/native/binary/notices/json-LICENSE.MIT +21 -0
  210. package/runtime/native/binary/notices/mbedtls-4.0.0.r0.gec4044008d--LICENSE +553 -0
  211. package/runtime/native/binary/notices/mbedtls-4.0.0.r0.gec4044008d--framework__LICENSE +553 -0
  212. package/runtime/native/binary/notices/mbedtls-4.0.0.r0.gec4044008d--tf-psa-crypto__LICENSE +552 -0
  213. package/runtime/native/binary/notices/mbedtls-4.0.0.r0.gec4044008d--tf-psa-crypto__framework__LICENSE +553 -0
  214. package/runtime/native/binary/notices/nanobind-2.13.0.r18.g4db9ed3f--LICENSE +26 -0
  215. package/runtime/native/binary/notices/nanobind-2.13.0.r18.g4db9ed3f--ext__robin_map__LICENSE +21 -0
  216. package/runtime/native/binary/notices/span-LICENSE_1_0.txt +23 -0
  217. package/runtime/native/binary/notices/span-attribution.txt +11 -0
  218. package/runtime/native/binary/notices/spdlog-1.17.0--spdlog-1.17.0__LICENSE +25 -0
  219. package/runtime/native/binary/notices/utfcpp-4.0.9--utfcpp-4.0.9__LICENSE +23 -0
  220. package/runtime/native/binary/provenance.json +48 -0
  221. package/runtime/native/child-deadline-linux-x64 +0 -0
  222. package/runtime/native/child-deadline-linux.c +24 -0
  223. package/runtime/native/child-deadline-linux.provenance.json +17 -0
  224. package/runtime/native/deadline-alarm-darwin-universal.dylib +0 -0
  225. package/runtime/native/deadline-alarm.c +33 -0
  226. package/runtime/native/deadline-alarm.provenance.json +22 -0
  227. package/runtime/native/deadline-exec-darwin-arm64 +0 -0
  228. package/runtime/native/deadline-exec.c +24 -0
  229. package/runtime/native/deadline-exec.provenance.json +17 -0
  230. package/runtime/native/dnspy-extension/Bridge.cs +58 -0
  231. package/runtime/native/dnspy-extension/Insight.DnSpy.csproj +13 -0
  232. package/runtime/native/dnspy-extension/Insight.DnSpy.x.dll +0 -0
  233. package/runtime/native/dnspy-extension/NuGet.Config +1 -0
  234. package/runtime/native/dnspy-extension/UNICODE-LOADER.md +26 -0
  235. package/runtime/native/dnspy-extension/packages.lock.json +6 -0
  236. package/runtime/native/dnspy-extension/provenance.json +27 -0
  237. package/runtime/native/dnspy-extension/upstream-public-build.snk +0 -0
  238. package/runtime/native/dnspy-extension/vendor-files.json +4341 -0
  239. package/runtime/native/file-version.ps1 +7 -0
  240. package/runtime/native/insight-registry-win-x64.dll +0 -0
  241. package/runtime/native/mitmproxy/bridge.py +180 -0
  242. package/runtime/native/mitmproxy/notices.json +476 -0
  243. package/runtime/native/sources/detours-LICENSE.md +23 -0
  244. package/runtime/native/sources/detours-e4bfd6b.tar.gz +0 -0
  245. package/runtime/native/sources/detours-provenance.json +10 -0
  246. package/runtime/native/tshark-layout.json +2247 -0
  247. package/runtime/native/windows-job/DirectoryAlias.cs +24 -0
  248. package/runtime/native/windows-job/Insight.WindowsJob.csproj +1 -0
  249. package/runtime/native/windows-job/Insight.WindowsJob.dll +0 -0
  250. package/runtime/native/windows-job/NuGet.Config +1 -0
  251. package/runtime/native/windows-job/OwnedJob.cs +79 -0
  252. package/runtime/native/windows-job/RegistryRedirect.cs +45 -0
  253. package/runtime/native/windows-job/packages.lock.json +21 -0
  254. package/runtime/native/windows-job/provenance.json +16 -0
  255. package/runtime/native/windows-job/windows-job.ps1 +8 -0
  256. package/runtime/native/windows-registry.c +21 -0
  257. package/runtime/native/windows-registry.def +3 -0
  258. package/runtime/native/windows-registry.provenance.json +14 -0
  259. package/runtime/notices/diagnostics-10.0.750501.txt +23 -0
  260. package/runtime/tool-catalog.json +290 -0
  261. package/runtime/toolbox.json +1401 -0
  262. package/skill-bundle/insight-artifacts/SKILL.md +30 -0
  263. package/skill-bundle/insight-artifacts/references/agent-execution.md +36 -0
  264. package/skill-bundle/insight-artifacts/references/artifacts.md +52 -0
  265. package/skill-bundle/insight-binary/SKILL.md +46 -0
  266. package/skill-bundle/insight-binary/references/agent-execution.md +36 -0
  267. package/skill-bundle/insight-capture/SKILL.md +56 -0
  268. package/skill-bundle/insight-capture/references/agent-execution.md +36 -0
  269. package/skill-bundle/insight-cli/SKILL.md +42 -0
  270. package/skill-bundle/insight-cli/references/agent-execution.md +36 -0
  271. package/skill-bundle/insight-cli/references/agent-setup.md +61 -0
  272. package/skill-bundle/insight-die/SKILL.md +49 -0
  273. package/skill-bundle/insight-die/references/agent-execution.md +36 -0
  274. package/skill-bundle/insight-dnspy/SKILL.md +65 -0
  275. package/skill-bundle/insight-dnspy/references/agent-execution.md +36 -0
  276. package/skill-bundle/insight-dotnet-dump/SKILL.md +46 -0
  277. package/skill-bundle/insight-dotnet-dump/references/agent-execution.md +36 -0
  278. package/skill-bundle/insight-dotnet-stack/SKILL.md +39 -0
  279. package/skill-bundle/insight-dotnet-stack/references/agent-execution.md +36 -0
  280. package/skill-bundle/insight-dotnet-trace/SKILL.md +45 -0
  281. package/skill-bundle/insight-dotnet-trace/references/agent-execution.md +36 -0
  282. package/skill-bundle/insight-frida/SKILL.md +67 -0
  283. package/skill-bundle/insight-frida/references/agent-execution.md +36 -0
  284. package/skill-bundle/insight-ghidra/SKILL.md +91 -0
  285. package/skill-bundle/insight-ghidra/references/administration.md +34 -0
  286. package/skill-bundle/insight-ghidra/references/agent-execution.md +36 -0
  287. package/skill-bundle/insight-ghidra/references/archive.md +32 -0
  288. package/skill-bundle/insight-ghidra/references/artifacts.md +52 -0
  289. package/skill-bundle/insight-ghidra/references/debugger.md +62 -0
  290. package/skill-bundle/insight-ghidra/references/extensions-and-sync.md +124 -0
  291. package/skill-bundle/insight-ghidra/references/managed-runtime.md +157 -0
  292. package/skill-bundle/insight-ghidra/references/native-workflows.md +112 -0
  293. package/skill-bundle/insight-ghidra/references/query-semantics.md +96 -0
  294. package/skill-bundle/insight-ghidra/references/recovery.md +53 -0
  295. package/skill-bundle/insight-ghidra/references/research.md +101 -0
  296. package/skill-bundle/insight-ghidra/references/setup.md +50 -0
  297. package/skill-bundle/insight-ilspy/SKILL.md +45 -0
  298. package/skill-bundle/insight-ilspy/references/agent-execution.md +36 -0
  299. package/skill-bundle/insight-ilspy/references/ilspy.md +33 -0
  300. package/skill-bundle/insight-interop/SKILL.md +54 -0
  301. package/skill-bundle/insight-interop/references/agent-execution.md +36 -0
  302. package/skill-bundle/insight-lldb/SKILL.md +54 -0
  303. package/skill-bundle/insight-lldb/references/agent-execution.md +36 -0
  304. package/skill-bundle/insight-llvm/SKILL.md +56 -0
  305. package/skill-bundle/insight-llvm/references/agent-execution.md +36 -0
  306. package/skill-bundle/insight-managed-heap/SKILL.md +43 -0
  307. package/skill-bundle/insight-managed-heap/references/agent-execution.md +36 -0
  308. package/skill-bundle/insight-managed-metadata/SKILL.md +52 -0
  309. package/skill-bundle/insight-managed-metadata/references/agent-execution.md +36 -0
  310. package/skill-bundle/insight-mitmproxy/SKILL.md +62 -0
  311. package/skill-bundle/insight-mitmproxy/references/agent-execution.md +36 -0
  312. package/skill-bundle/insight-overview/SKILL.md +79 -0
  313. package/skill-bundle/insight-overview/references/agent-execution.md +36 -0
  314. package/skill-bundle/insight-procmon/SKILL.md +49 -0
  315. package/skill-bundle/insight-procmon/references/agent-execution.md +36 -0
  316. package/skill-bundle/insight-re/SKILL.md +121 -0
  317. package/skill-bundle/insight-re/references/agent-execution.md +36 -0
  318. package/skill-bundle/insight-re/references/artifacts.md +52 -0
  319. package/skill-bundle/insight-re/references/recovery.md +53 -0
  320. package/skill-bundle/insight-sevenzip/SKILL.md +42 -0
  321. package/skill-bundle/insight-sevenzip/references/agent-execution.md +36 -0
  322. package/skill-bundle/insight-strace/SKILL.md +46 -0
  323. package/skill-bundle/insight-strace/references/agent-execution.md +36 -0
  324. package/skill-bundle/insight-tshark/SKILL.md +49 -0
  325. package/skill-bundle/insight-tshark/references/agent-execution.md +36 -0
  326. package/skill-bundle/insight-windbg/SKILL.md +46 -0
  327. package/skill-bundle/insight-windbg/references/agent-execution.md +36 -0
  328. package/skill-bundle/manifest.json +32 -0
  329. package/skills/insight-artifacts/SKILL.md +30 -0
  330. package/skills/insight-artifacts/references/agent-execution.md +36 -0
  331. package/skills/insight-artifacts/references/artifacts.md +52 -0
  332. package/skills/insight-binary/SKILL.md +46 -0
  333. package/skills/insight-binary/references/agent-execution.md +36 -0
  334. package/skills/insight-capture/SKILL.md +56 -0
  335. package/skills/insight-capture/references/agent-execution.md +36 -0
  336. package/skills/insight-die/SKILL.md +49 -0
  337. package/skills/insight-die/references/agent-execution.md +36 -0
  338. package/skills/insight-dnspy/SKILL.md +65 -0
  339. package/skills/insight-dnspy/references/agent-execution.md +36 -0
  340. package/skills/insight-dotnet-dump/SKILL.md +46 -0
  341. package/skills/insight-dotnet-dump/references/agent-execution.md +36 -0
  342. package/skills/insight-dotnet-stack/SKILL.md +39 -0
  343. package/skills/insight-dotnet-stack/references/agent-execution.md +36 -0
  344. package/skills/insight-dotnet-trace/SKILL.md +45 -0
  345. package/skills/insight-dotnet-trace/references/agent-execution.md +36 -0
  346. package/skills/insight-frida/SKILL.md +67 -0
  347. package/skills/insight-frida/references/agent-execution.md +36 -0
  348. package/skills/insight-ghidra/SKILL.md +91 -0
  349. package/skills/insight-ghidra/references/administration.md +34 -0
  350. package/skills/insight-ghidra/references/agent-execution.md +36 -0
  351. package/skills/insight-ghidra/references/archive.md +32 -0
  352. package/skills/insight-ghidra/references/artifacts.md +52 -0
  353. package/skills/insight-ghidra/references/debugger.md +62 -0
  354. package/skills/insight-ghidra/references/extensions-and-sync.md +124 -0
  355. package/skills/insight-ghidra/references/managed-runtime.md +157 -0
  356. package/skills/insight-ghidra/references/native-workflows.md +112 -0
  357. package/skills/insight-ghidra/references/query-semantics.md +96 -0
  358. package/skills/insight-ghidra/references/recovery.md +53 -0
  359. package/skills/insight-ghidra/references/research.md +101 -0
  360. package/skills/insight-ghidra/references/setup.md +50 -0
  361. package/skills/insight-ilspy/SKILL.md +45 -0
  362. package/skills/insight-ilspy/references/agent-execution.md +36 -0
  363. package/skills/insight-ilspy/references/ilspy.md +33 -0
  364. package/skills/insight-interop/SKILL.md +54 -0
  365. package/skills/insight-interop/references/agent-execution.md +36 -0
  366. package/skills/insight-lldb/SKILL.md +54 -0
  367. package/skills/insight-lldb/references/agent-execution.md +36 -0
  368. package/skills/insight-llvm/SKILL.md +56 -0
  369. package/skills/insight-llvm/references/agent-execution.md +36 -0
  370. package/skills/insight-managed-heap/SKILL.md +43 -0
  371. package/skills/insight-managed-heap/references/agent-execution.md +36 -0
  372. package/skills/insight-managed-metadata/SKILL.md +52 -0
  373. package/skills/insight-managed-metadata/references/agent-execution.md +36 -0
  374. package/skills/insight-mitmproxy/SKILL.md +62 -0
  375. package/skills/insight-mitmproxy/references/agent-execution.md +36 -0
  376. package/skills/insight-overview/SKILL.md +79 -0
  377. package/skills/insight-overview/references/agent-execution.md +36 -0
  378. package/skills/insight-procmon/SKILL.md +49 -0
  379. package/skills/insight-procmon/references/agent-execution.md +36 -0
  380. package/skills/insight-re/SKILL.md +22 -9
  381. package/skills/insight-re/references/agent-execution.md +36 -0
  382. package/skills/insight-re/references/artifacts.md +52 -0
  383. package/skills/insight-re/references/recovery.md +53 -0
  384. package/skills/insight-sevenzip/SKILL.md +42 -0
  385. package/skills/insight-sevenzip/references/agent-execution.md +36 -0
  386. package/skills/insight-strace/SKILL.md +46 -0
  387. package/skills/insight-strace/references/agent-execution.md +36 -0
  388. package/skills/insight-tshark/SKILL.md +49 -0
  389. package/skills/insight-tshark/references/agent-execution.md +36 -0
  390. package/skills/insight-windbg/SKILL.md +46 -0
  391. package/skills/insight-windbg/references/agent-execution.md +36 -0
@@ -1,3 +1,4 @@
1
+ import { textWindow } from './text-window.js';
1
2
  import { fail, id, object, text, digest } from './model.js';
2
3
  import { fieldKey, scalarMerge, scalarRefresh } from './merge.js';
3
4
  import { verifyMutation } from './mutation-effects.js';
@@ -256,7 +257,7 @@ export class Research {
256
257
  return { ...selected, items, offset, limit, total: page.total, truncated: object(value).truncated === true || offset + items.length < page.total,
257
258
  ...(object(value).scan ? { scan: object(value).scan, totalKnown: object(value).total_known !== false } : {}) };
258
259
  }
259
- async function(selected, at, decompile = false) {
260
+ async function(selected, at, decompile = false, page) {
260
261
  return this.ordered(selected, async () => {
261
262
  const backend = await this.backend();
262
263
  await backend.open(selected);
@@ -267,8 +268,9 @@ export class Research {
267
268
  if (decompile && typeof result.decompiled_code !== 'string')
268
269
  fail('partial', 'Function decompilation did not produce text.');
269
270
  const listing = object(await backend.call(selected, '/get_comment', { address: result.entry_point }));
270
- return { ...selected, address: publicAddress(result.entry_point), name: result.name, signature: result.signature, comments: comments(listing),
271
- ...(decompile ? { code: result.decompiled_code, truncated: Boolean(object(result.truncation ?? {}).decompiled_code) } : {}) };
271
+ const window = decompile ? textWindow(String(result.decompiled_code), page?.limit ?? 16000, page?.offset ?? 0, Boolean(object(result.truncation ?? {}).decompiled_code)) : undefined;
272
+ const { content, ...paging } = window ?? { content: undefined };
273
+ return { ...selected, address: publicAddress(result.entry_point), name: result.name, signature: result.signature, comments: comments(listing), ...(window ? { code: content, ...paging } : {}) };
272
274
  });
273
275
  }
274
276
  async xrefs(selected, at, limit, offset) {
@@ -0,0 +1,13 @@
1
+ import type { ToolArtifact } from './tool-runtime/definition.js';
2
+ export interface RuntimeArtifact extends ToolArtifact {
3
+ }
4
+ export declare const ghidraArchive: ToolArtifact;
5
+ export declare function runtimeCatalog(platform?: string, arch?: string, kernel?: string): {
6
+ schema: number;
7
+ ghidraVersion: string;
8
+ javaVersion: string;
9
+ platform: string;
10
+ architecture: string;
11
+ ghidra: ToolArtifact;
12
+ java: ToolArtifact;
13
+ };
@@ -0,0 +1,26 @@
1
+ import { release } from 'node:os';
2
+ import { fail } from './model.js';
3
+ import { catalogArtifact } from './tool-runtime/catalog.js';
4
+ export const ghidraArchive = catalogArtifact('b62e81a0390618466c019c60d8c2f796ced2509c4c1aea4a37644a77272cf99d');
5
+ const bottles = { arm64_sonoma: '40f68357d6b62a08429c36228907c995e3449283b6d2e08ba5a4e30b53a09725', arm64_sequoia: '90aa942184fca2337ad0a123f818f37372ea642e8e69e969d45cc144a6f26fdf', arm64_tahoe: '079007d8a3a477c8d5901e6596947612d86c8641956424a2bcb71ecd798bedcc', sonoma: 'e30f8c84b64331f87f6ef1890cbdded6672bb7fcc8b674794ac93e4b3e62ad2b' };
6
+ const jdks = {
7
+ 'darwin-arm64': ['aarch64_mac', '6ebcf221c9b41507b14c098e93c6ead6440b8d9bd154f8ec666c4c73abbdb201'],
8
+ 'darwin-x64': ['x64_mac', '34180eb03e6d207c388cce3da668f6cc7cd7508c185c24782fadac2c9c0e66f9'],
9
+ 'linux-x64': ['x64_linux', '4b2220e232a97997b436ca6ab15cbf70171ecff52958a46159dfa5a8c44ca4de'],
10
+ 'win32-x64': ['x64_windows', 'd3625e7cadf23787ea540229544b6e2ab494b3b54da1801879e583e1dfee0a64'],
11
+ };
12
+ export function runtimeCatalog(platform = process.platform, arch = process.arch, kernel = release()) {
13
+ const jdk = jdks[platform + '-' + arch];
14
+ if (!jdk)
15
+ fail('configuration', 'No verified managed runtime for this OS/architecture; use an external compatible Ghidra installation.');
16
+ const java = catalogArtifact(jdk[1]);
17
+ let ghidra = ghidraArchive;
18
+ if (platform === 'darwin') {
19
+ const major = Number(kernel.split('.')[0]);
20
+ if (major < 23)
21
+ fail('configuration', 'Managed macOS runtimes require macOS 14 or newer.');
22
+ const tag = arch === 'x64' ? 'sonoma' : major >= 25 ? 'arm64_tahoe' : major >= 24 ? 'arm64_sequoia' : 'arm64_sonoma', hash = bottles[tag];
23
+ ghidra = catalogArtifact(hash);
24
+ }
25
+ return { schema: 1, ghidraVersion: '12.1.2', javaVersion: '21.0.11+10', platform, architecture: arch, ghidra, java };
26
+ }
@@ -0,0 +1,125 @@
1
+ import { type CommandContext, type CommandDefinition } from '@eyeauras/cli-factory';
2
+ import { atomicWrite } from './tool-runtime/store.js';
3
+ export declare const runtimeWrite: typeof atomicWrite;
4
+ /** Passive, conservative inventory: a reused PID blocks deletion; it never grants kill authority. */
5
+ export declare function runtimeProcesses(directory: string): Promise<Record<string, unknown>[]>;
6
+ export declare function externalGhidra(path: string): Promise<string>;
7
+ export declare class RuntimeManager {
8
+ private readonly c;
9
+ readonly directory: string;
10
+ constructor(c: CommandContext);
11
+ get root(): string;
12
+ status(): Promise<{
13
+ missing: string[];
14
+ capabilities: {
15
+ headless: boolean;
16
+ decompiler: boolean;
17
+ gui: boolean;
18
+ debugger: {
19
+ backend: string;
20
+ runtime: {
21
+ retainedStages: string[];
22
+ processes: import("./tool-runtime/supervisor.js").ProcessRecord[];
23
+ tool: string;
24
+ state: string;
25
+ mode: string;
26
+ installation: string | undefined;
27
+ executable: string | undefined;
28
+ components: Record<string, string>;
29
+ lastProbe: Record<string, unknown> | undefined;
30
+ recommended: string;
31
+ };
32
+ requires: string;
33
+ checkedBy: string;
34
+ } | {
35
+ backend: string;
36
+ requires: string;
37
+ checkedBy: string;
38
+ runtime?: undefined;
39
+ } | {
40
+ backend: string;
41
+ checkedBy: string;
42
+ runtime?: undefined;
43
+ requires?: undefined;
44
+ };
45
+ };
46
+ server: {
47
+ pid?: unknown;
48
+ mode: string;
49
+ state: string;
50
+ };
51
+ processes: Record<string, unknown>[];
52
+ installations: {
53
+ id: string;
54
+ selected: boolean;
55
+ ghidraVersion: unknown;
56
+ verifiedAt: unknown;
57
+ }[];
58
+ retainedStages: string[];
59
+ lastCheck: any;
60
+ storage: {
61
+ runtime: string;
62
+ research: string;
63
+ materials: string;
64
+ };
65
+ installation?: string | undefined;
66
+ fingerprint?: string | undefined;
67
+ state: string;
68
+ mode: string;
69
+ recommended: string;
70
+ ghidraVersion: string | undefined;
71
+ java: string | undefined;
72
+ ghidraHome: string | undefined;
73
+ }>;
74
+ download(offline?: boolean): Promise<{
75
+ state: string;
76
+ ghidraVersion: string;
77
+ javaVersion: string;
78
+ items: {
79
+ name: string;
80
+ path: string;
81
+ sha256: string;
82
+ license: string;
83
+ }[];
84
+ }>;
85
+ private archive;
86
+ private cleanupProbes;
87
+ install(o: Record<string, unknown>): Promise<{
88
+ debugger?: {
89
+ backend: string;
90
+ installation: string;
91
+ fingerprint: string;
92
+ } | undefined;
93
+ checks: unknown;
94
+ schema: 1;
95
+ mode: "managed" | "external";
96
+ id?: string;
97
+ ghidraHome: string;
98
+ java: string;
99
+ fingerprint: string;
100
+ selectedAt: string;
101
+ uninstalledAt?: string;
102
+ state: string;
103
+ }>;
104
+ uninstall(purgeCache?: boolean): Promise<{
105
+ state: string;
106
+ mode: "external" | "managed";
107
+ externalInstallationPreserved: boolean;
108
+ researchPreserved: boolean;
109
+ materialsPreserved: boolean;
110
+ cachePreserved: boolean;
111
+ }>;
112
+ private probe;
113
+ doctor(): Promise<{
114
+ state: string;
115
+ fingerprint: string;
116
+ ghidraVersion: string;
117
+ checkedAt: string;
118
+ headless: unknown;
119
+ decompiler: unknown;
120
+ server: boolean;
121
+ debugger: Record<string, unknown>;
122
+ diagnostics: string;
123
+ }>;
124
+ }
125
+ export declare function runtimeCommands(exclusive: <T>(c: CommandContext, action: () => Promise<T>, quiescent?: boolean) => Promise<T>): CommandDefinition[];
@@ -0,0 +1,385 @@
1
+ import { runTool } from './tool-runtime/run.js';
2
+ import { readFile, mkdir, rename, rm, realpath, readdir, stat, cp } from 'node:fs/promises';
3
+ import { existsSync, realpathSync } from 'node:fs';
4
+ import { join, dirname, resolve, delimiter, basename } from 'node:path';
5
+ import { randomUUID } from 'node:crypto';
6
+ import { runtimeRoot, runtimeSelection, runtimeValues } from './runtime-selection.js';
7
+ import { runtimeCatalog } from './runtime-catalog.js';
8
+ import { cacheArtifact, extractArchive, consumeArchive } from './tool-runtime/archives.js';
9
+ import { nativeInputs, nativeHelpers, nativeJvmDirectories, pinnedMcpJar } from './native-inputs.js';
10
+ import { GhidraServer, stopLocalServer } from './server.js';
11
+ import { fail, text, digest, object } from './model.js';
12
+ import { atomicWrite, installationStage, removeInstallation, withToolLock, assertUnused } from './tool-runtime/store.js';
13
+ import { lifecycleCommands as sharedLifecycle } from './tool-runtime/definition.js';
14
+ import { managedGhidraDebugger, ghidraDebuggerInstaller, prepareGhidraDebugger } from './ghidra-debugger-runtime.js';
15
+ const suffix = process.platform === 'win32' ? '.exe' : '';
16
+ export const runtimeWrite = atomicWrite;
17
+ const live = (pid) => { if (!Number.isSafeInteger(pid) || Number(pid) < 1)
18
+ return false; try {
19
+ process.kill(Number(pid), 0);
20
+ return true;
21
+ }
22
+ catch (error) {
23
+ if (error.code === 'ESRCH')
24
+ return false;
25
+ throw error;
26
+ } };
27
+ /** Passive, conservative inventory: a reused PID blocks deletion; it never grants kill authority. */
28
+ export async function runtimeProcesses(directory) {
29
+ const items = [];
30
+ async function walk(path, depth = 0) {
31
+ if (depth > 6)
32
+ return;
33
+ let entries;
34
+ try {
35
+ entries = await readdir(path, { withFileTypes: true });
36
+ }
37
+ catch (error) {
38
+ if (error.code === 'ENOENT')
39
+ return;
40
+ throw error;
41
+ }
42
+ for (const entry of entries) {
43
+ const at = join(path, entry.name);
44
+ if (entry.isDirectory())
45
+ await walk(at, depth + 1);
46
+ else if (entry.name === 'process.json') {
47
+ const p = object(JSON.parse(await readFile(at, 'utf8')));
48
+ let stopped = false;
49
+ try {
50
+ const s = object(JSON.parse(await readFile(join(path, 'stopped.json'), 'utf8')));
51
+ stopped = s.pid === p.pid && s.tokenSecret === p.tokenSecret;
52
+ }
53
+ catch (error) {
54
+ if (error.code !== 'ENOENT')
55
+ throw error;
56
+ }
57
+ if (!stopped && live(p.pid))
58
+ items.push({ kind: p.kind, pid: p.pid, sessionContext: p.context, ...(typeof p.session === 'string' ? { session: p.session } : {}), target: p.target, mode: p.mode });
59
+ }
60
+ }
61
+ }
62
+ await walk(join(directory, 'workspace', 'ghidra-native'));
63
+ try {
64
+ const s = object(JSON.parse(await readFile(join(directory, 'workspace/server/local.json'), 'utf8')));
65
+ if (live(s.pid))
66
+ items.push({ kind: 'server', pid: s.pid });
67
+ }
68
+ catch (error) {
69
+ if (error.code !== 'ENOENT')
70
+ throw error;
71
+ }
72
+ return items;
73
+ }
74
+ export async function externalGhidra(path) {
75
+ const resolved = await realpath(path), kind = await stat(resolved);
76
+ const parent = kind.isDirectory() ? resolved : dirname(dirname(resolved));
77
+ const candidates = kind.isDirectory() ? [resolved, join(resolved, 'libexec')] : [dirname(resolved), parent, join(parent, 'libexec')];
78
+ for (const home of candidates)
79
+ if (existsSync(join(home, 'Ghidra/application.properties'))) {
80
+ if (!kind.isDirectory() && !['ghidraRun', 'ghidraRun.bat', 'analyzeHeadless', 'analyzeHeadless.bat'].includes(basename(resolved)))
81
+ fail('configuration', 'Use the Ghidra launcher or installation directory, not a target EXE.');
82
+ return home;
83
+ }
84
+ fail('configuration', 'The external path does not identify a complete Ghidra installation. Use its ghidraRun launcher or installation directory.');
85
+ }
86
+ async function findRoot(root, marker, depth = 0) {
87
+ if (existsSync(join(root, marker)))
88
+ return root;
89
+ if (depth >= 4)
90
+ return;
91
+ for (const entry of await readdir(root, { withFileTypes: true }))
92
+ if (entry.isDirectory()) {
93
+ const found = await findRoot(join(root, entry.name), marker, depth + 1);
94
+ if (found)
95
+ return found;
96
+ }
97
+ }
98
+ export class RuntimeManager {
99
+ c;
100
+ directory;
101
+ constructor(c) {
102
+ this.c = c;
103
+ this.directory = c.appArguments.AppDataDirectory;
104
+ }
105
+ // Canonicalize storage once the profile exists, without creating it for passive status.
106
+ // Keep the Factory directory for shared process/lock identity and existing run receipts.
107
+ get root() { return runtimeRoot(existsSync(this.directory) ? realpathSync.native(this.directory) : this.directory); }
108
+ async status() {
109
+ const selected = runtimeSelection(this.directory), values = selected ? runtimeValuesForStatus(selected, this.c.profile.values) : this.c.profile.values;
110
+ const java = typeof values.java === 'string' ? values.java : undefined, home = typeof values.ghidraHome === 'string' ? values.ghidraHome : undefined;
111
+ const missing = [];
112
+ if (!java || !existsSync(java))
113
+ missing.push('jdk');
114
+ if (!home || !existsSync(join(home, 'Ghidra/application.properties')))
115
+ missing.push('ghidra');
116
+ if (selected?.uninstalledAt)
117
+ missing.push('uninstalled');
118
+ if (selected?.mode === 'managed' && !existsSync(join(this.root, 'installations', selected.id, 'ready.json')))
119
+ missing.push('installation_receipt');
120
+ let version;
121
+ if (home)
122
+ try {
123
+ version = /^application.version=(.+)$/m.exec(await readFile(join(home, 'Ghidra/application.properties'), 'utf8'))?.[1]?.trim();
124
+ }
125
+ catch (error) {
126
+ if (error.code !== 'ENOENT')
127
+ throw error;
128
+ }
129
+ const host = process.platform === 'darwin' ? (process.arch === 'arm64' ? 'mac_arm_64' : 'mac_x86_64') : process.platform === 'win32' ? 'win_x86_64' : 'linux_x86_64';
130
+ const native = home ? join(home, 'Ghidra/Features/Decompiler/os', host, 'decompile' + suffix) : undefined;
131
+ if (home && (!native || !existsSync(native)))
132
+ missing.push('decompiler');
133
+ if (version && version !== '12.1.2')
134
+ missing.push('compatible_ghidra');
135
+ let lastCheck;
136
+ try {
137
+ lastCheck = JSON.parse(await readFile(join(this.root, 'last-check.json'), 'utf8'));
138
+ }
139
+ catch (error) {
140
+ if (error.code !== 'ENOENT')
141
+ throw error;
142
+ }
143
+ const installations = [];
144
+ let stages = [];
145
+ try {
146
+ for (const name of (await readdir(join(this.root, 'installations'))).slice(0, 100)) {
147
+ if (!/^[a-f0-9]{64}$/.test(name))
148
+ continue;
149
+ const path = join(this.root, 'installations', name);
150
+ if (existsSync(join(path, 'ready.json'))) {
151
+ const ready = object(JSON.parse(await readFile(join(path, 'ready.json'), 'utf8')));
152
+ installations.push({ id: name, selected: name === selected?.id, ghidraVersion: ready.ghidraVersion, verifiedAt: ready.verifiedAt });
153
+ }
154
+ }
155
+ }
156
+ catch (error) {
157
+ if (error.code !== 'ENOENT')
158
+ throw error;
159
+ }
160
+ try {
161
+ stages = (await readdir(join(this.root, 'stages'))).slice(0, 100);
162
+ }
163
+ catch (error) {
164
+ if (error.code !== 'ENOENT')
165
+ throw error;
166
+ }
167
+ const processes = await runtimeProcesses(this.directory), server = processes.find(p => p.kind === 'server');
168
+ return { state: missing.length ? 'not_ready' : 'installed', mode: selected?.mode ?? (home || java ? 'external' : 'unconfigured'), recommended: 'managed', ghidraVersion: version, java, ghidraHome: home,
169
+ ...(selected ? { installation: selected.id, fingerprint: selected.fingerprint } : {}), missing, capabilities: { headless: !missing.length, decompiler: !missing.length, gui: !missing.length,
170
+ debugger: managedGhidraDebugger() ? { backend: 'managed-lldb', runtime: await ghidraDebuggerInstaller(this.c).status(), requires: 'OS debugger authorization', checkedBy: 'ghidra doctor' } : process.platform === 'darwin' ? { backend: 'system-lldb', requires: 'Apple developer tools and OS debugger authorization', checkedBy: 'ghidra doctor' } : { backend: 'host-debugger', checkedBy: 'ghidra doctor' } },
171
+ server: { mode: this.c.profile.values.server ? 'external' : 'local', state: this.c.profile.values.server ? 'configured' : server ? 'running' : 'stopped', ...(server ? { pid: server.pid } : {}) }, processes, installations, retainedStages: stages, lastCheck: lastCheck ? { ...lastCheck, appliesToSelection: lastCheck.fingerprint === selected?.fingerprint && !selected?.uninstalledAt } : undefined,
172
+ storage: { runtime: this.root, research: join(this.directory, 'workspace'), materials: join(this.directory, 'materials') } };
173
+ }
174
+ async download(offline = false) {
175
+ const catalog = runtimeCatalog(), cache = join(this.root, 'cache'), items = [];
176
+ for (const artifact of [catalog.ghidra, catalog.java]) {
177
+ const path = await cacheArtifact(artifact, cache, this.c.fetch, this.c.signal, offline);
178
+ items.push({ name: artifact.name, path, sha256: artifact.sha256, license: artifact.license });
179
+ }
180
+ if (managedGhidraDebugger())
181
+ for (const item of (await ghidraDebuggerInstaller(this.c).download(offline)).items)
182
+ items.push({ name: 'LLDB/Python', path: item.path, sha256: item.sha256, license: item.license });
183
+ return { state: 'downloaded', ghidraVersion: catalog.ghidraVersion, javaVersion: catalog.javaVersion, items };
184
+ }
185
+ async archive(artifact, provided, checksum, offline) {
186
+ if (provided === undefined)
187
+ return { path: await cacheArtifact(artifact, join(this.root, 'cache'), this.c.fetch, this.c.signal, offline), artifact };
188
+ return consumeArchive(resolve(this.c.cwd, text(provided, 4096)), join(this.root, 'cache'), artifact, checksum === undefined ? undefined : text(checksum, 64), this.c.signal);
189
+ }
190
+ async cleanupProbes() {
191
+ // A killed owner may leave a disposable validation server alive. Its authenticated
192
+ // receipt, not PID existence, authorizes recovery; no research repository is touched.
193
+ for (const parent of ['stages', 'checks']) {
194
+ let names;
195
+ try {
196
+ names = await readdir(join(this.root, parent));
197
+ }
198
+ catch (error) {
199
+ if (error.code === 'ENOENT')
200
+ continue;
201
+ throw error;
202
+ }
203
+ for (const name of names) {
204
+ if (!/^[a-f0-9-]{36}$/.test(name))
205
+ continue;
206
+ const root = join(this.root, parent, name, ...(parent === 'stages' ? ['validation'] : []));
207
+ if (existsSync(join(root, 'server/local.json'))) {
208
+ if (await realpath(root) !== resolve(root))
209
+ fail('binding', 'Retained runtime probe moved outside its owned storage.');
210
+ await stopLocalServer(root, this.c);
211
+ }
212
+ }
213
+ }
214
+ }
215
+ async install(o) {
216
+ return withToolLock(this.directory, 'ghidra', async () => {
217
+ await assertUnused(this.directory, 'ghidra');
218
+ await this.cleanupProbes();
219
+ if (o.executable && o.archive)
220
+ fail('invalid', 'Choose --executable or --archive.');
221
+ if (o.archiveSha256 && !o.archive || o.javaArchiveSha256 && !o.javaArchive)
222
+ fail('invalid', 'Archive checksum requires its archive path.');
223
+ if (o.debuggerArchiveSha256 && !o.debuggerArchive)
224
+ fail('invalid', 'Debugger archive checksum requires its archive path.');
225
+ if ((o.debuggerArchive || o.debuggerArchiveSha256) && !managedGhidraDebugger())
226
+ fail('unsupported', 'A managed debugger archive requires macOS 15+ ARM64.');
227
+ const catalog = runtimeCatalog(), offline = Boolean(o.offline), external = o.executable ? await externalGhidra(resolve(this.c.cwd, text(o.executable, 4096))) : undefined;
228
+ const ghidra = external ? undefined : await this.archive(catalog.ghidra, o.archive, o.archiveSha256, offline);
229
+ const java = o.java ? await realpath(resolve(this.c.cwd, text(o.java, 4096))) : undefined;
230
+ if (java && o.javaArchive)
231
+ fail('invalid', 'Choose --java or --java-archive.');
232
+ const jdk = java ? undefined : await this.archive(catalog.java, o.javaArchive, o.javaArchiveSha256, offline);
233
+ const identity = digest({ schema: 1, platform: process.platform, architecture: process.arch, external, java, ghidra: ghidra?.artifact.sha256, jdk: jdk?.artifact.sha256, bridge: pinnedMcpJar });
234
+ const receipt = await installationStage(this.root, identity, async (temporary, installation) => {
235
+ let ghidraHome = external, nativeOverlay;
236
+ if (ghidra) {
237
+ const extracted = join(temporary, 'ghidra-extract');
238
+ await extractArchive(ghidra.path, extracted, ghidra.artifact.format, this.c.signal);
239
+ const found = await findRoot(extracted, 'Ghidra/application.properties');
240
+ if (!found)
241
+ fail('configuration', 'Archive omitted a complete Ghidra installation.');
242
+ await rename(found, join(temporary, 'ghidra'));
243
+ await rm(extracted, { recursive: true, force: true });
244
+ ghidraHome = join(temporary, 'ghidra');
245
+ const host = process.arch === 'arm64' ? 'mac_arm_64' : 'mac_x86_64';
246
+ if (process.platform === 'darwin' && !existsSync(join(ghidraHome, 'Ghidra/Features/Decompiler/os', host, 'decompile'))) {
247
+ const bottle = await cacheArtifact(catalog.ghidra, join(this.root, 'cache'), this.c.fetch, this.c.signal, offline), nativeRoot = join(temporary, 'native-extract');
248
+ nativeOverlay = catalog.ghidra;
249
+ await extractArchive(bottle, nativeRoot, 'tgz', this.c.signal);
250
+ const nativeHome = join(nativeRoot, catalog.ghidra.root);
251
+ for (const module of ['Decompiler', 'FileFormats'])
252
+ await cp(join(nativeHome, 'Ghidra/Features', module, 'os', host), join(ghidraHome, 'Ghidra/Features', module, 'os', host), { recursive: true, errorOnExist: true });
253
+ await rm(nativeRoot, { recursive: true, force: true });
254
+ }
255
+ }
256
+ let javaPath = java;
257
+ if (jdk) {
258
+ const extracted = join(temporary, 'jdk-extract');
259
+ await extractArchive(jdk.path, extracted, jdk.artifact.format, this.c.signal);
260
+ const home = await findRoot(extracted, 'bin/java' + suffix);
261
+ if (!home)
262
+ fail('configuration', 'Java archive omitted a JDK.');
263
+ await rename(home, join(temporary, 'jdk'));
264
+ await rm(extracted, { recursive: true, force: true });
265
+ javaPath = join(temporary, 'jdk/bin/java' + suffix);
266
+ }
267
+ const inputs = await nativeInputs({ ...this.c.profile.values, java: javaPath, ghidraHome }, undefined, this.c);
268
+ await this.probe(inputs, join(temporary, 'validation'));
269
+ await rm(join(temporary, 'validation'), { recursive: true, force: true });
270
+ const receipt = { schema: 1, id: identity, ghidraVersion: inputs.ghidraVersion, fingerprint: inputs.fingerprint, java: java ?? join(installation, 'jdk/bin/java' + suffix), ghidraHome: external ?? join(installation, 'ghidra'),
271
+ archives: [...(nativeOverlay ? [{ sha256: nativeOverlay.sha256, source: nativeOverlay.url }] : []), ...(ghidra ? [{ sha256: ghidra.artifact.sha256, source: o.archive ? 'local' : catalog.ghidra.url }] : []), ...(jdk ? [{ sha256: jdk.artifact.sha256, source: o.javaArchive ? 'local' : catalog.java.url }] : [])], verifiedAt: new Date().toISOString(), checks: ['jdk', 'native-decompiler', 'local-server-reader-publisher-authority'] };
272
+ return receipt;
273
+ }, async (receipt) => {
274
+ const inputs = await nativeInputs({ ...this.c.profile.values, java: receipt.java, ghidraHome: receipt.ghidraHome }, undefined, this.c);
275
+ if (inputs.fingerprint !== receipt.fingerprint)
276
+ fail('binding', 'Installed runtime differs from its verified installation receipt.');
277
+ }, this.c.signal);
278
+ const selected = { schema: 1, mode: external ? 'external' : 'managed', id: identity, ghidraHome: String(receipt.ghidraHome), java: String(receipt.java), fingerprint: String(receipt.fingerprint), selectedAt: new Date().toISOString() };
279
+ const debuggerRuntime = managedGhidraDebugger() ? await prepareGhidraDebugger(this.c, { archive: o.debuggerArchive, archiveSha256: o.debuggerArchiveSha256, offline: o.offline }) : undefined;
280
+ await runtimeWrite(join(this.root, 'selection.json'), selected);
281
+ return { state: 'installed', ...selected, checks: receipt.checks, ...(debuggerRuntime ? { debugger: { backend: 'managed-lldb', installation: debuggerRuntime.id, fingerprint: debuggerRuntime.fingerprint } } : {}) };
282
+ }, this.c.signal);
283
+ }
284
+ async uninstall(purgeCache = false) {
285
+ return withToolLock(this.directory, 'ghidra', async () => {
286
+ await assertUnused(this.directory, 'ghidra');
287
+ await this.cleanupProbes();
288
+ const selected = runtimeSelection(this.directory);
289
+ if (!selected)
290
+ fail('configuration', 'No managed selection exists; externally configured profile paths are never removed.');
291
+ if (purgeCache && selected.id) {
292
+ const receipt = object(JSON.parse(await readFile(join(this.root, 'installations', selected.id, 'ready.json'), 'utf8')));
293
+ for (const a of Array.isArray(receipt.archives) ? receipt.archives : []) {
294
+ const sha = String(object(a).sha256);
295
+ if (!/^[a-f0-9]{64}$/.test(sha))
296
+ fail('binding', 'Invalid cached component identity.');
297
+ for (const ext of ['zip', 'tgz'])
298
+ await rm(join(this.root, 'cache', sha + '.' + ext), { force: true });
299
+ }
300
+ }
301
+ if (managedGhidraDebugger() && (await ghidraDebuggerInstaller(this.c).status()).state === 'installed')
302
+ await ghidraDebuggerInstaller(this.c).uninstall(purgeCache);
303
+ if (selected.id)
304
+ await removeInstallation(this.root, selected.id);
305
+ await runtimeWrite(join(this.root, 'selection.json'), { ...selected, uninstalledAt: new Date().toISOString() });
306
+ // Retain the selection: an explicit external profile must never become an implicit fallback.
307
+ return { state: 'uninstalled', mode: selected.mode, externalInstallationPreserved: selected.mode === 'external', researchPreserved: true, materialsPreserved: true, cachePreserved: !purgeCache };
308
+ }, this.c.signal);
309
+ }
310
+ async probe(inputs, root) {
311
+ await mkdir(root, { recursive: true, mode: 0o700 });
312
+ const classes = await nativeHelpers(root, inputs, this.c), log = join(root, 'doctor.log');
313
+ let output;
314
+ try {
315
+ output = await runTool(this.c, { tool: 'ghidra', role: 'doctor', installation: inputs.fingerprint, executable: inputs.java, arguments: ['-Djava.awt.headless=true', '-Dghidra.home=' + inputs.ghidraHome, ...nativeJvmDirectories(root), '-cp', classes + delimiter + inputs.classpath, 'InsightRuntimeDoctor'],
316
+ cwd: root, environment: { PATH: dirname(inputs.java), HOME: root, TMPDIR: root }, timeoutMs: 90000, maxOutputBytes: 1024 * 1024 });
317
+ }
318
+ catch (error) {
319
+ await runtimeWrite(log, { failure: String(error.stderr ?? error) });
320
+ fail('configuration', 'Native decompiler probe failed; the diagnostic stage is retained.', { diagnostics: log });
321
+ }
322
+ const value = object(JSON.parse(output.stdout));
323
+ if (value.state !== 'ready' || value.decompiler !== true || value.expectedReturn !== 42)
324
+ fail('partial', 'Native decompiler probe did not verify its expected result.');
325
+ const probeContext = { ...this.c, profile: { ...this.c.profile, values: { ...this.c.profile.values, server: undefined } } };
326
+ const server = new GhidraServer(root, inputs, probeContext);
327
+ try {
328
+ const result = await server.administration('connect', {});
329
+ if (result.connected !== true || result.mode !== 'local')
330
+ fail('partial', 'Owned server probe did not connect.');
331
+ const checked = await server.administration('status', {});
332
+ if (checked.connected !== true)
333
+ fail('partial', 'Owned server identity/authority probe failed.');
334
+ }
335
+ finally {
336
+ await server.stop();
337
+ }
338
+ return value;
339
+ }
340
+ async doctor() {
341
+ await this.cleanupProbes();
342
+ const root = join(this.root, 'checks', randomUUID()), values = runtimeValues(this.directory, this.c.profile.values);
343
+ const inputs = await nativeInputs(values, undefined, this.c), native = await this.probe(inputs, root);
344
+ let debuggerCheck = { state: 'host_specific' };
345
+ if (managedGhidraDebugger())
346
+ try {
347
+ const selected = await ghidraDebuggerInstaller(this.c).selected();
348
+ debuggerCheck = { ...(await ghidraDebuggerInstaller(this.c).doctor()), backend: 'managed-lldb', installation: selected.id };
349
+ }
350
+ catch {
351
+ debuggerCheck = { state: 'missing', backend: 'managed-lldb', reason: 'Run insight-cli ghidra install to prepare or repair its LLDB/Python runtime' };
352
+ }
353
+ else if (process.platform === 'darwin')
354
+ try {
355
+ const checked = await runTool(this.c, { tool: 'ghidra', role: 'debugger-doctor', executable: '/usr/bin/lldb', arguments: ['--no-lldbinit', '--batch', '-o', 'script import lldb,sys; print("INSIGHT_LLDB_PYTHON_OK")'], environment: { PATH: '/usr/bin:/bin', HOME: root, TMPDIR: root }, timeoutMs: 30000, maxOutputBytes: 65536 });
356
+ debuggerCheck = { state: checked.stdout.includes('INSIGHT_LLDB_PYTHON_OK') ? 'ready' : 'missing', backend: 'system-lldb' };
357
+ }
358
+ catch {
359
+ debuggerCheck = { state: 'missing', backend: 'system-lldb', reason: 'Apple developer tools or debugger authorization is unavailable' };
360
+ }
361
+ const result = { state: 'verified', fingerprint: inputs.fingerprint, ghidraVersion: inputs.ghidraVersion, checkedAt: new Date().toISOString(), headless: native.headless, decompiler: native.decompiler, server: true, debugger: debuggerCheck, diagnostics: root };
362
+ await runtimeWrite(join(this.root, 'last-check.json'), result);
363
+ if (debuggerCheck.state === 'missing')
364
+ fail('partial', 'Static analysis and local server passed; the host debugger is unavailable.', { ...result, state: 'partial' });
365
+ return result;
366
+ }
367
+ }
368
+ function runtimeValuesForStatus(selection, values) { return { ...values, java: selection.java, ghidraHome: selection.ghidraHome }; }
369
+ export function runtimeCommands(exclusive) {
370
+ const source = [{ flags: '--archive <path>', description: 'Local Ghidra zip/tar.gz; missing dependencies are downloaded' },
371
+ { flags: '--debugger-archive <path>', description: 'Local pinned LLDB/Python runtime archive (macOS 15+ ARM64)' },
372
+ { flags: '--debugger-archive-sha256 <sha256>', description: 'Expected SHA256 for the supplied debugger runtime archive' },
373
+ { flags: '--archive-sha256 <sha256>', description: 'Expected SHA256 for the supplied Ghidra archive' },
374
+ { flags: '--java-archive <path>', description: 'Local Java 21 JDK zip/tar.gz' },
375
+ { flags: '--java-archive-sha256 <sha256>', description: 'Expected SHA256 for the supplied JDK archive' },
376
+ { flags: '--java <path>', description: 'Use an external Java 21 JDK executable' },
377
+ { flags: '--executable <path>', description: 'Use an external Ghidra launcher or installation directory; never deleted' },
378
+ { flags: '--offline', description: 'Use local archives/cache only; never access the network' }];
379
+ return sharedLifecycle({ id: 'ghidra', description: 'Complete Ghidra runtime', components: [], installOptions: source, lifecycle: {
380
+ download: (o, c) => exclusive(c, () => new RuntimeManager(c).download(Boolean(o.offline)), false),
381
+ install: (o, c) => exclusive(c, () => new RuntimeManager(c).install(o)),
382
+ uninstall: (o, c) => exclusive(c, () => new RuntimeManager(c).uninstall(Boolean(o.purgeCache))),
383
+ doctor: (_o, c) => exclusive(c, () => new RuntimeManager(c).doctor(), false),
384
+ } });
385
+ }
@@ -0,0 +1,13 @@
1
+ export interface RuntimeSelection {
2
+ schema: 1;
3
+ mode: 'managed' | 'external';
4
+ id?: string;
5
+ ghidraHome: string;
6
+ java: string;
7
+ fingerprint: string;
8
+ selectedAt: string;
9
+ uninstalledAt?: string;
10
+ }
11
+ export declare const runtimeRoot: (directory: string) => string;
12
+ export declare function runtimeSelection(directory: string): RuntimeSelection | undefined;
13
+ export declare function runtimeValues(directory: string, values: Record<string, unknown>): Record<string, unknown>;
@@ -0,0 +1,42 @@
1
+ import { readFileSync, existsSync, realpathSync } from 'node:fs';
2
+ import { join, isAbsolute, resolve } from 'node:path';
3
+ import { fail, object } from './model.js';
4
+ export const runtimeRoot = (directory) => join(directory, 'runtime');
5
+ export function runtimeSelection(directory) {
6
+ const path = join(runtimeRoot(directory), 'selection.json');
7
+ if (!existsSync(path))
8
+ return;
9
+ const value = object(JSON.parse(readFileSync(path, 'utf8')));
10
+ if (value.schema !== 1 || !['managed', 'external'].includes(String(value.mode)) || typeof value.java !== 'string' || !isAbsolute(value.java) || typeof value.ghidraHome !== 'string' || !isAbsolute(value.ghidraHome) || !/^[a-f0-9]{64}$/.test(String(value.fingerprint)))
11
+ fail('binding', 'Runtime selection receipt is invalid.');
12
+ if (value.mode === 'managed') {
13
+ const id = String(value.id), recordedProfile = resolve(value.ghidraHome, '../../../..');
14
+ if (!/^[a-f0-9]{64}$/.test(id) || value.ghidraHome !== join(runtimeRoot(recordedProfile), 'installations', id, 'ghidra'))
15
+ fail('binding', 'Managed runtime moved outside its owned installation.');
16
+ // Workspace resolves AppData physically; older install receipts can retain a profile
17
+ // alias such as /tmp -> /private/tmp. Accept that same profile, never an inner escape.
18
+ let profile, recorded, home;
19
+ try {
20
+ profile = realpathSync.native(directory);
21
+ recorded = realpathSync.native(recordedProfile);
22
+ if (existsSync(value.ghidraHome))
23
+ home = realpathSync.native(value.ghidraHome);
24
+ }
25
+ catch {
26
+ fail('binding', 'Managed runtime profile ownership could not be verified.');
27
+ }
28
+ if (recorded !== profile || home !== undefined && home !== join(runtimeRoot(profile), 'installations', id, 'ghidra'))
29
+ fail('binding', 'Managed runtime moved outside its owned installation.');
30
+ }
31
+ return value;
32
+ }
33
+ export function runtimeValues(directory, values) {
34
+ const selected = runtimeSelection(directory);
35
+ if (!selected)
36
+ return values;
37
+ if (selected.uninstalledAt)
38
+ fail('configuration', 'Selected Ghidra runtime was uninstalled. Run insight-cli ghidra install.');
39
+ if (selected.mode === 'managed' && !existsSync(join(runtimeRoot(directory), 'installations', selected.id, 'ready.json')))
40
+ fail('configuration', 'Selected managed Ghidra is not installed. Run insight-cli ghidra install.');
41
+ return { ...values, java: selected.java, ghidraHome: selected.ghidraHome };
42
+ }