@eyeauras/insight-cli 0.8.4 → 0.9.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 (609) hide show
  1. package/.cli-package-build.json +1 -1
  2. package/README.md +16 -23
  3. package/SKILL.md +6 -44
  4. package/dist/src/activity-audit.d.ts +33 -46
  5. package/dist/src/activity-audit.js +120 -195
  6. package/dist/src/analysis-default.d.ts +10 -2
  7. package/dist/src/analysis-default.js +62 -47
  8. package/dist/src/analysis-storage.d.ts +13 -13
  9. package/dist/src/analysis-storage.js +127 -258
  10. package/dist/src/artifacts.d.ts +5 -1
  11. package/dist/src/artifacts.js +31 -46
  12. package/dist/src/audit-commands.d.ts +6 -1
  13. package/dist/src/audit-commands.js +9 -2
  14. package/dist/src/audit-retention.d.ts +5 -23
  15. package/dist/src/audit-retention.js +37 -150
  16. package/dist/src/binary.js +4 -13
  17. package/dist/src/budgets.d.ts +2 -2
  18. package/dist/src/budgets.js +7 -9
  19. package/dist/src/capture.js +17 -30
  20. package/dist/src/cli.d.ts +9 -4
  21. package/dist/src/cli.js +288 -473
  22. package/dist/src/code-references.d.ts +2 -13
  23. package/dist/src/code-references.js +7 -99
  24. package/dist/src/context-diagnostics.d.ts +1 -23
  25. package/dist/src/context-diagnostics.js +1 -83
  26. package/dist/src/core/coordinator.d.ts +298 -0
  27. package/dist/src/core/coordinator.js +591 -0
  28. package/dist/src/core/layout.d.ts +51 -0
  29. package/dist/src/core/layout.js +55 -0
  30. package/dist/src/core/legacy-import.d.ts +55 -0
  31. package/dist/src/core/legacy-import.js +193 -0
  32. package/dist/src/cross-results.d.ts +3 -3
  33. package/dist/src/cross-results.js +4 -42
  34. package/dist/src/cross.js +2 -3
  35. package/dist/src/debugger-results.d.ts +1 -6
  36. package/dist/src/debugger-results.js +21 -153
  37. package/dist/src/debugger.d.ts +21 -11
  38. package/dist/src/debugger.js +106 -168
  39. package/dist/src/decode-results.d.ts +2 -1
  40. package/dist/src/decode-results.js +4 -20
  41. package/dist/src/diagnostic-error.d.ts +1 -1
  42. package/dist/src/diagnostic-error.js +4 -23
  43. package/dist/src/die.js +1 -23
  44. package/dist/src/dnspy-runtime.js +5 -12
  45. package/dist/src/dnspy.js +13 -28
  46. package/dist/src/dotnet-diagnostics.js +1 -1
  47. package/dist/src/extensions.d.ts +2 -3
  48. package/dist/src/extensions.js +14 -91
  49. package/dist/src/frida-worker.js +0 -20
  50. package/dist/src/frida.js +3 -26
  51. package/dist/src/function-boundaries.d.ts +2 -2
  52. package/dist/src/function-boundaries.js +9 -61
  53. package/dist/src/function-entries.d.ts +2 -2
  54. package/dist/src/function-entries.js +6 -36
  55. package/dist/src/function-inspection.d.ts +2 -2
  56. package/dist/src/function-inspection.js +17 -33
  57. package/dist/src/function-results.d.ts +1 -3
  58. package/dist/src/function-results.js +2 -13
  59. package/dist/src/hub/admin.d.ts +101 -0
  60. package/dist/src/hub/admin.js +314 -0
  61. package/dist/src/hub/autostart.d.ts +111 -0
  62. package/dist/src/hub/autostart.js +207 -0
  63. package/dist/src/hub/bundle.d.ts +33 -0
  64. package/dist/src/hub/bundle.js +25 -0
  65. package/dist/src/hub/client.d.ts +90 -0
  66. package/dist/src/hub/client.js +256 -0
  67. package/dist/src/hub/commands.d.ts +13 -0
  68. package/dist/src/hub/commands.js +280 -0
  69. package/dist/src/hub/contract.d.ts +87 -0
  70. package/dist/src/hub/contract.js +3 -0
  71. package/dist/src/hub/extensions.d.ts +41 -0
  72. package/dist/src/hub/extensions.js +3 -0
  73. package/dist/src/hub/ghidra.d.ts +70 -0
  74. package/dist/src/hub/ghidra.js +197 -0
  75. package/dist/src/hub/index.d.ts +6 -0
  76. package/dist/src/hub/index.js +7 -0
  77. package/dist/src/{work/store.d.ts → hub/ledger-store.d.ts} +57 -94
  78. package/dist/src/hub/ledger-store.js +919 -0
  79. package/dist/src/hub/ledger.d.ts +4 -0
  80. package/dist/src/hub/ledger.js +173 -0
  81. package/dist/src/hub/lock.d.ts +7 -0
  82. package/dist/src/hub/lock.js +53 -0
  83. package/dist/src/hub/repository.d.ts +45 -0
  84. package/dist/src/hub/repository.js +130 -0
  85. package/dist/src/hub/server.d.ts +86 -0
  86. package/dist/src/hub/server.js +414 -0
  87. package/dist/src/hub/settings.d.ts +36 -0
  88. package/dist/src/hub/settings.js +112 -0
  89. package/dist/src/hub/storage.d.ts +13 -0
  90. package/dist/src/hub/storage.js +46 -0
  91. package/dist/src/hub/store.d.ts +75 -0
  92. package/dist/src/hub/store.js +188 -0
  93. package/dist/src/ilspy.js +1 -1
  94. package/dist/src/internal-timing.d.ts +2 -9
  95. package/dist/src/internal-timing.js +2 -95
  96. package/dist/src/lldb.js +3 -15
  97. package/dist/src/llvm.js +0 -9
  98. package/dist/src/managed-heap.js +3 -7
  99. package/dist/src/managed-metadata.js +2 -5
  100. package/dist/src/memory-inputs.d.ts +1 -4
  101. package/dist/src/memory-inputs.js +10 -40
  102. package/dist/src/mitmproxy.d.ts +35 -4
  103. package/dist/src/mitmproxy.js +59 -40
  104. package/dist/src/model.d.ts +0 -73
  105. package/dist/src/model.js +0 -45
  106. package/dist/src/mutations.d.ts +1 -1
  107. package/dist/src/mutations.js +5 -10
  108. package/dist/src/native/contract.d.ts +130 -0
  109. package/dist/src/native/ghidra.d.ts +58 -0
  110. package/dist/src/native/ghidra.js +77 -0
  111. package/dist/src/native/host.d.ts +71 -0
  112. package/dist/src/native/host.js +265 -0
  113. package/dist/src/native/index.d.ts +13 -0
  114. package/dist/src/native/index.js +19 -0
  115. package/dist/src/native/jvm.d.ts +54 -0
  116. package/dist/src/native/jvm.js +47 -0
  117. package/dist/src/native/worker.d.ts +70 -0
  118. package/dist/src/native/worker.js +240 -0
  119. package/dist/src/native-inputs.d.ts +9 -14
  120. package/dist/src/native-inputs.js +22 -110
  121. package/dist/src/native-merge-patches.d.ts +2 -2
  122. package/dist/src/native-merge-patches.js +14 -14
  123. package/dist/src/persistent-client.js +53 -25
  124. package/dist/src/procmon.js +17 -31
  125. package/dist/src/program-files.d.ts +42 -0
  126. package/dist/src/program-files.js +148 -0
  127. package/dist/src/queries.js +2 -15
  128. package/dist/src/query-policy.d.ts +0 -2
  129. package/dist/src/query-policy.js +1 -14
  130. package/dist/src/research.d.ts +59 -238
  131. package/dist/src/research.js +212 -906
  132. package/dist/src/runtime-identity.d.ts +8 -0
  133. package/dist/src/runtime-identity.js +26 -0
  134. package/dist/src/runtime-manager.d.ts +1 -11
  135. package/dist/src/runtime-manager.js +10 -145
  136. package/dist/src/runtime-selection.d.ts +1 -1
  137. package/dist/src/runtime-selection.js +5 -37
  138. package/dist/src/saved-materials.js +8 -51
  139. package/dist/src/scripts.d.ts +1 -1
  140. package/dist/src/scripts.js +15 -15
  141. package/dist/src/sdk-contracts.js +2 -2
  142. package/dist/src/sdk.js +8 -8
  143. package/dist/src/sevenzip.js +1 -3
  144. package/dist/src/strace.js +0 -3
  145. package/dist/src/string-anchors.d.ts +2 -3
  146. package/dist/src/string-anchors.js +8 -101
  147. package/dist/src/text-window.d.ts +5 -4
  148. package/dist/src/text-window.js +4 -4
  149. package/dist/src/tool-runtime/archives.d.ts +1 -1
  150. package/dist/src/tool-runtime/archives.js +11 -20
  151. package/dist/src/tool-runtime/catalog.js +2 -5
  152. package/dist/src/tool-runtime/commands.js +1 -3
  153. package/dist/src/tool-runtime/deadline.js +2 -7
  154. package/dist/src/tool-runtime/definition.js +1 -31
  155. package/dist/src/tool-runtime/identity.js +6 -87
  156. package/dist/src/tool-runtime/installer.d.ts +2 -6
  157. package/dist/src/tool-runtime/installer.js +14 -76
  158. package/dist/src/tool-runtime/java-arguments.js +4 -10
  159. package/dist/src/tool-runtime/launch-worker.js +2 -8
  160. package/dist/src/tool-runtime/run.d.ts +2 -0
  161. package/dist/src/tool-runtime/run.js +20 -8
  162. package/dist/src/tool-runtime/store.d.ts +3 -3
  163. package/dist/src/tool-runtime/store.js +21 -83
  164. package/dist/src/tool-runtime/supervisor.d.ts +6 -11
  165. package/dist/src/tool-runtime/supervisor.js +155 -214
  166. package/dist/src/tool-runtime/windows-helper.d.ts +5 -0
  167. package/dist/src/tool-runtime/windows-helper.js +13 -0
  168. package/dist/src/tool-runtime/windows-job.d.ts +5 -5
  169. package/dist/src/tool-runtime/windows-job.js +13 -31
  170. package/dist/src/tshark.js +14 -27
  171. package/dist/src/ui-results.d.ts +3 -2
  172. package/dist/src/ui-results.js +16 -53
  173. package/dist/src/ui.d.ts +12 -13
  174. package/dist/src/ui.js +32 -70
  175. package/dist/src/version-tracking.d.ts +25 -39
  176. package/dist/src/version-tracking.js +70 -174
  177. package/dist/src/windbg.d.ts +1 -1
  178. package/dist/src/windbg.js +2 -8
  179. package/dist/src/work/client.d.ts +63 -0
  180. package/dist/src/work/client.js +163 -0
  181. package/dist/src/work/commands.d.ts +3 -1
  182. package/dist/src/work/commands.js +158 -184
  183. package/dist/src/work/dashboard.d.ts +2 -2
  184. package/dist/src/work/dashboard.js +7 -8
  185. package/dist/src/work/legacy.d.ts +8 -0
  186. package/dist/src/work/legacy.js +70 -0
  187. package/dist/src/work/model.d.ts +0 -3
  188. package/dist/src/work/model.js +0 -10
  189. package/dist/src/work/timing.d.ts +3 -3
  190. package/dist/src/work/timing.js +21 -25
  191. package/dist/src/workspace.d.ts +4 -250
  192. package/dist/src/workspace.js +11 -699
  193. package/node_modules/@eyeauras/cli-factory/README.md +6 -0
  194. package/node_modules/@eyeauras/cli-factory/dist/src/cli.d.ts.map +1 -1
  195. package/node_modules/@eyeauras/cli-factory/dist/src/cli.js +76 -28
  196. package/node_modules/@eyeauras/cli-factory/dist/src/cli.js.map +1 -1
  197. package/node_modules/@eyeauras/cli-factory/dist/src/command.d.ts +1 -1
  198. package/node_modules/@eyeauras/cli-factory/dist/src/command.d.ts.map +1 -1
  199. package/node_modules/@eyeauras/cli-factory/dist/src/command.js +1 -0
  200. package/node_modules/@eyeauras/cli-factory/dist/src/command.js.map +1 -1
  201. package/node_modules/@eyeauras/cli-factory/dist/src/errors.d.ts +1 -1
  202. package/node_modules/@eyeauras/cli-factory/dist/src/errors.d.ts.map +1 -1
  203. package/node_modules/@eyeauras/cli-factory/dist/src/errors.js +18 -6
  204. package/node_modules/@eyeauras/cli-factory/dist/src/errors.js.map +1 -1
  205. package/node_modules/@eyeauras/cli-factory/dist/src/file-publication.d.ts +44 -0
  206. package/node_modules/@eyeauras/cli-factory/dist/src/file-publication.d.ts.map +1 -0
  207. package/node_modules/@eyeauras/cli-factory/dist/src/{profile-file.js → file-publication.js} +41 -113
  208. package/node_modules/@eyeauras/cli-factory/dist/src/file-publication.js.map +1 -0
  209. package/node_modules/@eyeauras/cli-factory/dist/src/help.d.ts +5 -0
  210. package/node_modules/@eyeauras/cli-factory/dist/src/help.d.ts.map +1 -0
  211. package/node_modules/@eyeauras/cli-factory/dist/src/help.js +17 -0
  212. package/node_modules/@eyeauras/cli-factory/dist/src/help.js.map +1 -0
  213. package/node_modules/@eyeauras/cli-factory/dist/src/index.d.ts +9 -4
  214. package/node_modules/@eyeauras/cli-factory/dist/src/index.d.ts.map +1 -1
  215. package/node_modules/@eyeauras/cli-factory/dist/src/index.js +5 -2
  216. package/node_modules/@eyeauras/cli-factory/dist/src/index.js.map +1 -1
  217. package/node_modules/@eyeauras/cli-factory/dist/src/json-rpc.d.ts.map +1 -1
  218. package/node_modules/@eyeauras/cli-factory/dist/src/json-rpc.js +11 -18
  219. package/node_modules/@eyeauras/cli-factory/dist/src/json-rpc.js.map +1 -1
  220. package/node_modules/@eyeauras/cli-factory/dist/src/output-write.d.ts +10 -0
  221. package/node_modules/@eyeauras/cli-factory/dist/src/output-write.d.ts.map +1 -0
  222. package/node_modules/@eyeauras/cli-factory/dist/src/output-write.js +69 -0
  223. package/node_modules/@eyeauras/cli-factory/dist/src/output-write.js.map +1 -0
  224. package/node_modules/@eyeauras/cli-factory/dist/src/output.d.ts +3 -1
  225. package/node_modules/@eyeauras/cli-factory/dist/src/output.d.ts.map +1 -1
  226. package/node_modules/@eyeauras/cli-factory/dist/src/output.js +74 -14
  227. package/node_modules/@eyeauras/cli-factory/dist/src/output.js.map +1 -1
  228. package/node_modules/@eyeauras/cli-factory/dist/src/pagination.d.ts +3 -0
  229. package/node_modules/@eyeauras/cli-factory/dist/src/pagination.d.ts.map +1 -0
  230. package/node_modules/@eyeauras/cli-factory/dist/src/pagination.js +9 -0
  231. package/node_modules/@eyeauras/cli-factory/dist/src/pagination.js.map +1 -0
  232. package/node_modules/@eyeauras/cli-factory/dist/src/permissions.d.ts.map +1 -1
  233. package/node_modules/@eyeauras/cli-factory/dist/src/permissions.js +3 -1
  234. package/node_modules/@eyeauras/cli-factory/dist/src/permissions.js.map +1 -1
  235. package/node_modules/@eyeauras/cli-factory/dist/src/stream-result.d.ts +16 -0
  236. package/node_modules/@eyeauras/cli-factory/dist/src/stream-result.d.ts.map +1 -0
  237. package/node_modules/@eyeauras/cli-factory/dist/src/stream-result.js +83 -0
  238. package/node_modules/@eyeauras/cli-factory/dist/src/stream-result.js.map +1 -0
  239. package/node_modules/@eyeauras/cli-factory/dist/src/types.d.ts +5 -0
  240. package/node_modules/@eyeauras/cli-factory/dist/src/types.d.ts.map +1 -1
  241. package/node_modules/@eyeauras/cli-factory/dist/src/view.d.ts +49 -7
  242. package/node_modules/@eyeauras/cli-factory/dist/src/view.d.ts.map +1 -1
  243. package/node_modules/@eyeauras/cli-factory/dist/src/view.js +83 -6
  244. package/node_modules/@eyeauras/cli-factory/dist/src/view.js.map +1 -1
  245. package/node_modules/@eyeauras/cli-factory/package.json +1 -1
  246. package/node_modules/@eyeauras/cli-factory-ipc/dist/cli-host.proto +19 -19
  247. package/node_modules/@eyeauras/cli-factory-ipc/dist/src/build.d.ts +7 -1
  248. package/node_modules/@eyeauras/cli-factory-ipc/dist/src/build.d.ts.map +1 -1
  249. package/node_modules/@eyeauras/cli-factory-ipc/dist/src/build.js +9 -4
  250. package/node_modules/@eyeauras/cli-factory-ipc/dist/src/build.js.map +1 -1
  251. package/node_modules/@eyeauras/cli-factory-ipc/dist/src/host.d.ts.map +1 -1
  252. package/node_modules/@eyeauras/cli-factory-ipc/dist/src/host.js +5 -4
  253. package/node_modules/@eyeauras/cli-factory-ipc/dist/src/host.js.map +1 -1
  254. package/node_modules/@eyeauras/cli-factory-ipc/dist/src/package-build.d.ts +11 -1
  255. package/node_modules/@eyeauras/cli-factory-ipc/dist/src/package-build.d.ts.map +1 -1
  256. package/node_modules/@eyeauras/cli-factory-ipc/dist/src/package-build.js +85 -57
  257. package/node_modules/@eyeauras/cli-factory-ipc/dist/src/package-build.js.map +1 -1
  258. package/node_modules/@eyeauras/cli-factory-ipc/package.json +2 -2
  259. package/package.json +4 -5
  260. package/references/native/InsightAnalyzerOptions.java +10 -0
  261. package/references/native/InsightAnchorScan.java +1 -11
  262. package/references/native/InsightCodeReferences.java +2 -3
  263. package/references/native/InsightCopyType.java +24 -0
  264. package/references/native/InsightFunctionBoundaries.java +0 -1
  265. package/references/native/InsightFunctionDatabases.java +20 -16
  266. package/references/native/InsightHelperCall.java +17 -0
  267. package/references/native/InsightHubServer.java +214 -0
  268. package/references/native/InsightNativeHost.java +112 -0
  269. package/references/native/InsightPlugins.java +0 -1
  270. package/references/native/InsightPythonWheels.java +3 -2
  271. package/references/native/InsightResearchQueries.java +3 -4
  272. package/references/native/InsightResearchView.java +4 -10
  273. package/references/native/InsightSdkFiles.java +7 -15
  274. package/references/native/InsightSdkScript.java +1 -4
  275. package/references/native/InsightSdkTools.java +36 -97
  276. package/references/native/InsightSdkTypes.java +13 -43
  277. package/references/native/InsightStringAnchors.java +1 -3
  278. package/references/native/InsightTraceState.java +13 -96
  279. package/references/native/InsightTraceTools.java +3 -5
  280. package/references/native/InsightVersionTracking.java +0 -6
  281. package/references/native/{HeadlessProgramMergeManager.java → InsightWcMerge.java} +17 -24
  282. package/references/native/InsightWcOps.java +449 -0
  283. package/references/native/InsightWcWorker.java +142 -0
  284. package/references/native/NATIVE-MERGE-NOTICE.txt +4 -8
  285. package/runtime/GhidraMCP-7.0.0.jar +0 -0
  286. package/runtime/managed/insight-heap/README.md +3 -3
  287. package/runtime/managed/insight-managed/README.md +3 -3
  288. package/runtime/native/binary/README.md +5 -4
  289. package/runtime/native/windows/DirectoryAlias.cs +24 -0
  290. package/runtime/native/windows/Insight.Windows.csproj +27 -0
  291. package/runtime/native/windows/Native.cs +36 -0
  292. package/runtime/native/windows/OwnedJob.cs +86 -0
  293. package/runtime/native/windows/Program.cs +50 -0
  294. package/runtime/native/windows/RegistryRedirect.cs +42 -0
  295. package/runtime/native/windows/insight-windows-x64.exe +0 -0
  296. package/runtime/native/windows/packages.lock.json +35 -0
  297. package/runtime/native/windows/provenance.json +17 -0
  298. package/runtime/research-view.provenance.json +6 -7
  299. package/runtime/toolbox.json +33 -114
  300. package/skill-bundle/insight-artifacts/SKILL.md +5 -19
  301. package/skill-bundle/insight-binary/SKILL.md +5 -35
  302. package/skill-bundle/insight-capture/SKILL.md +5 -45
  303. package/skill-bundle/insight-cli/SKILL.md +6 -44
  304. package/skill-bundle/insight-die/SKILL.md +5 -38
  305. package/skill-bundle/insight-dnspy/SKILL.md +5 -54
  306. package/skill-bundle/insight-dotnet-dump/SKILL.md +5 -35
  307. package/skill-bundle/insight-dotnet-stack/SKILL.md +5 -28
  308. package/skill-bundle/insight-dotnet-trace/SKILL.md +5 -34
  309. package/skill-bundle/insight-frida/SKILL.md +5 -56
  310. package/skill-bundle/insight-ghidra/SKILL.md +14 -113
  311. package/skill-bundle/insight-ilspy/SKILL.md +5 -34
  312. package/skill-bundle/insight-interop/SKILL.md +5 -43
  313. package/skill-bundle/insight-lldb/SKILL.md +5 -43
  314. package/skill-bundle/insight-llvm/SKILL.md +5 -45
  315. package/skill-bundle/insight-managed-heap/SKILL.md +5 -32
  316. package/skill-bundle/insight-managed-metadata/SKILL.md +5 -41
  317. package/skill-bundle/insight-mitmproxy/SKILL.md +5 -51
  318. package/skill-bundle/insight-overview/SKILL.md +5 -68
  319. package/skill-bundle/insight-procmon/SKILL.md +5 -38
  320. package/skill-bundle/insight-re/SKILL.md +10 -127
  321. package/skill-bundle/insight-sevenzip/SKILL.md +5 -31
  322. package/skill-bundle/insight-strace/SKILL.md +5 -35
  323. package/skill-bundle/insight-tshark/SKILL.md +5 -38
  324. package/skill-bundle/insight-windbg/SKILL.md +5 -35
  325. package/skill-bundle/manifest.json +1 -1
  326. package/skills/insight-artifacts/SKILL.md +5 -19
  327. package/skills/insight-binary/SKILL.md +5 -35
  328. package/skills/insight-capture/SKILL.md +5 -45
  329. package/skills/insight-die/SKILL.md +5 -38
  330. package/skills/insight-dnspy/SKILL.md +5 -54
  331. package/skills/insight-dotnet-dump/SKILL.md +5 -35
  332. package/skills/insight-dotnet-stack/SKILL.md +5 -28
  333. package/skills/insight-dotnet-trace/SKILL.md +5 -34
  334. package/skills/insight-frida/SKILL.md +5 -56
  335. package/skills/insight-ghidra/SKILL.md +14 -113
  336. package/skills/insight-ilspy/SKILL.md +5 -34
  337. package/skills/insight-interop/SKILL.md +5 -43
  338. package/skills/insight-lldb/SKILL.md +5 -43
  339. package/skills/insight-llvm/SKILL.md +5 -45
  340. package/skills/insight-managed-heap/SKILL.md +5 -32
  341. package/skills/insight-managed-metadata/SKILL.md +5 -41
  342. package/skills/insight-mitmproxy/SKILL.md +5 -51
  343. package/skills/insight-overview/SKILL.md +5 -68
  344. package/skills/insight-procmon/SKILL.md +5 -38
  345. package/skills/insight-re/SKILL.md +10 -127
  346. package/skills/insight-sevenzip/SKILL.md +5 -31
  347. package/skills/insight-strace/SKILL.md +5 -35
  348. package/skills/insight-tshark/SKILL.md +5 -38
  349. package/skills/insight-windbg/SKILL.md +5 -35
  350. package/dist/src/administration-results.d.ts +0 -1
  351. package/dist/src/administration-results.js +0 -84
  352. package/dist/src/administration.d.ts +0 -14
  353. package/dist/src/administration.js +0 -134
  354. package/dist/src/archive-contract.d.ts +0 -6
  355. package/dist/src/archive-contract.js +0 -108
  356. package/dist/src/archive.d.ts +0 -12
  357. package/dist/src/archive.js +0 -116
  358. package/dist/src/comment-effects.d.ts +0 -3
  359. package/dist/src/comment-effects.js +0 -55
  360. package/dist/src/context-credential.d.ts +0 -18
  361. package/dist/src/context-credential.js +0 -44
  362. package/dist/src/contexts.d.ts +0 -387
  363. package/dist/src/contexts.js +0 -2805
  364. package/dist/src/coordinator.d.ts +0 -41
  365. package/dist/src/coordinator.js +0 -160
  366. package/dist/src/cross-peer.d.ts +0 -20
  367. package/dist/src/cross-peer.js +0 -53
  368. package/dist/src/data-effects.d.ts +0 -3
  369. package/dist/src/data-effects.js +0 -103
  370. package/dist/src/debugger-caller.d.ts +0 -17
  371. package/dist/src/debugger-caller.js +0 -129
  372. package/dist/src/debugger-launch.d.ts +0 -2
  373. package/dist/src/debugger-launch.js +0 -17
  374. package/dist/src/debugger-supervisor.js +0 -179
  375. package/dist/src/directory-identity.d.ts +0 -6
  376. package/dist/src/directory-identity.js +0 -45
  377. package/dist/src/documentation-effects.d.ts +0 -5
  378. package/dist/src/documentation-effects.js +0 -56
  379. package/dist/src/function-effects.d.ts +0 -4
  380. package/dist/src/function-effects.js +0 -112
  381. package/dist/src/ghidra-processes.d.ts +0 -6
  382. package/dist/src/ghidra-processes.js +0 -138
  383. package/dist/src/ghidra.d.ts +0 -50
  384. package/dist/src/ghidra.js +0 -468
  385. package/dist/src/initial-model.d.ts +0 -7
  386. package/dist/src/initial-model.js +0 -115
  387. package/dist/src/initial-progress.d.ts +0 -4
  388. package/dist/src/initial-progress.js +0 -74
  389. package/dist/src/inline-script.d.ts +0 -15
  390. package/dist/src/inline-script.js +0 -61
  391. package/dist/src/legacy-migration.d.ts +0 -37
  392. package/dist/src/legacy-migration.js +0 -238
  393. package/dist/src/lifecycle.d.ts +0 -77
  394. package/dist/src/lifecycle.js +0 -315
  395. package/dist/src/merge.d.ts +0 -29
  396. package/dist/src/merge.js +0 -66
  397. package/dist/src/mutation-effects.d.ts +0 -4
  398. package/dist/src/mutation-effects.js +0 -321
  399. package/dist/src/native-queries.d.ts +0 -2
  400. package/dist/src/native-queries.js +0 -24
  401. package/dist/src/native-service.d.ts +0 -40
  402. package/dist/src/native-service.js +0 -406
  403. package/dist/src/projects.d.ts +0 -31
  404. package/dist/src/projects.js +0 -302
  405. package/dist/src/prototype-cli.d.ts +0 -8
  406. package/dist/src/prototype-cli.js +0 -155
  407. package/dist/src/query-results.d.ts +0 -2
  408. package/dist/src/query-results.js +0 -224
  409. package/dist/src/research-view.d.ts +0 -6
  410. package/dist/src/research-view.js +0 -9
  411. package/dist/src/sdk-files.d.ts +0 -29
  412. package/dist/src/sdk-files.js +0 -249
  413. package/dist/src/server.d.ts +0 -102
  414. package/dist/src/server.js +0 -663
  415. package/dist/src/storage-gc.d.ts +0 -23
  416. package/dist/src/storage-gc.js +0 -600
  417. package/dist/src/store.d.ts +0 -33
  418. package/dist/src/store.js +0 -178
  419. package/dist/src/sync-policy.d.ts +0 -22
  420. package/dist/src/sync-policy.js +0 -129
  421. package/dist/src/timed-backend.d.ts +0 -3
  422. package/dist/src/timed-backend.js +0 -24
  423. package/dist/src/timing-report.d.ts +0 -32
  424. package/dist/src/timing-report.js +0 -74
  425. package/dist/src/tool-runtime/native-process-proof.d.ts +0 -2
  426. package/dist/src/tool-runtime/native-process-proof.js +0 -26
  427. package/dist/src/transport.d.ts +0 -60
  428. package/dist/src/transport.js +0 -223
  429. package/dist/src/unresolved-guidance.d.ts +0 -46
  430. package/dist/src/unresolved-guidance.js +0 -55
  431. package/dist/src/work/backup.d.ts +0 -66
  432. package/dist/src/work/backup.js +0 -446
  433. package/dist/src/work/store.js +0 -1107
  434. package/dist/src/worker-lease.d.ts +0 -17
  435. package/dist/src/worker-lease.js +0 -50
  436. package/node_modules/@eyeauras/cli-factory/dist/src/profile-file.d.ts +0 -37
  437. package/node_modules/@eyeauras/cli-factory/dist/src/profile-file.d.ts.map +0 -1
  438. package/node_modules/@eyeauras/cli-factory/dist/src/profile-file.js.map +0 -1
  439. package/references/InsightRepositoryProbe.java +0 -55
  440. package/references/administration.md +0 -34
  441. package/references/agent-execution.md +0 -36
  442. package/references/agent-setup.md +0 -60
  443. package/references/archive.md +0 -32
  444. package/references/artifacts.md +0 -52
  445. package/references/debugger.md +0 -64
  446. package/references/extensions-and-sync.md +0 -125
  447. package/references/ilspy.md +0 -33
  448. package/references/managed-runtime.md +0 -162
  449. package/references/native/InsightArchivePayloads.java +0 -36
  450. package/references/native/InsightBlockTransfer.java +0 -57
  451. package/references/native/InsightGuiMain.java +0 -33
  452. package/references/native/InsightHeadlessMain.java +0 -18
  453. package/references/native/InsightImportProgress.java +0 -60
  454. package/references/native/InsightInitialImport.java +0 -48
  455. package/references/native/InsightInitialJournal.java +0 -57
  456. package/references/native/InsightInitialPublication.java +0 -142
  457. package/references/native/InsightInitialRecovery.java +0 -131
  458. package/references/native/InsightInlineExecutor.java +0 -143
  459. package/references/native/InsightInlineScript.java +0 -14
  460. package/references/native/InsightNativeCheckout.java +0 -487
  461. package/references/native/InsightNativeFingerprint.java +0 -80
  462. package/references/native/InsightNativeMigration.java +0 -155
  463. package/references/native/InsightNativeRead.java +0 -80
  464. package/references/native/InsightNativeReceipt.java +0 -31
  465. package/references/native/InsightNativeService.java +0 -43
  466. package/references/native/InsightNativeView.java +0 -40
  467. package/references/native/InsightOfflineAuthenticator.java +0 -20
  468. package/references/native/InsightOwnedScripts.java +0 -170
  469. package/references/native/InsightProjectFiles.java +0 -92
  470. package/references/native/InsightPublicationRecovery.java +0 -63
  471. package/references/native/InsightServerAdministration.java +0 -82
  472. package/references/native/InsightServerInit.java +0 -62
  473. package/references/native/InsightServerMain.java +0 -43
  474. package/references/native/InsightServerProbe.java +0 -29
  475. package/references/native/InsightSnapshotFields.java +0 -74
  476. package/references/native/InsightSnapshotInspect.java +0 -191
  477. package/references/native/InsightSnapshotPublisher.java +0 -123
  478. package/references/native/InsightStopDebugger.java +0 -20
  479. package/references/native/InsightTraceInspect.java +0 -24
  480. package/references/native/InsightWorkerLease.java +0 -132
  481. package/references/native-workflows.md +0 -124
  482. package/references/persistent-client.mjs +0 -147
  483. package/references/persistent.md +0 -90
  484. package/references/query-semantics.md +0 -109
  485. package/references/recovery.md +0 -235
  486. package/references/research.md +0 -296
  487. package/references/setup.md +0 -135
  488. package/references/sparse-navigation.md +0 -173
  489. package/references/storage.md +0 -139
  490. package/references/work-tracking.md +0 -261
  491. package/runtime/native/file-version.ps1 +0 -7
  492. package/runtime/native/mitmproxy/bridge.py +0 -180
  493. package/runtime/native/windows-job/DirectoryAlias.cs +0 -24
  494. package/runtime/native/windows-job/Insight.WindowsJob.csproj +0 -1
  495. package/runtime/native/windows-job/Insight.WindowsJob.dll +0 -0
  496. package/runtime/native/windows-job/OwnedJob.cs +0 -79
  497. package/runtime/native/windows-job/RegistryRedirect.cs +0 -45
  498. package/runtime/native/windows-job/packages.lock.json +0 -21
  499. package/runtime/native/windows-job/provenance.json +0 -16
  500. package/runtime/native/windows-job/windows-job.ps1 +0 -8
  501. package/skill-bundle/insight-artifacts/references/agent-execution.md +0 -36
  502. package/skill-bundle/insight-artifacts/references/artifacts.md +0 -52
  503. package/skill-bundle/insight-artifacts/references/recovery.md +0 -235
  504. package/skill-bundle/insight-artifacts/references/storage.md +0 -139
  505. package/skill-bundle/insight-binary/references/agent-execution.md +0 -36
  506. package/skill-bundle/insight-capture/references/agent-execution.md +0 -36
  507. package/skill-bundle/insight-cli/references/agent-execution.md +0 -36
  508. package/skill-bundle/insight-cli/references/agent-setup.md +0 -60
  509. package/skill-bundle/insight-cli/references/archive.md +0 -32
  510. package/skill-bundle/insight-cli/references/managed-runtime.md +0 -162
  511. package/skill-bundle/insight-cli/references/persistent-client.mjs +0 -147
  512. package/skill-bundle/insight-cli/references/persistent.md +0 -90
  513. package/skill-bundle/insight-cli/references/recovery.md +0 -235
  514. package/skill-bundle/insight-cli/references/setup.md +0 -135
  515. package/skill-bundle/insight-cli/references/storage.md +0 -139
  516. package/skill-bundle/insight-die/references/agent-execution.md +0 -36
  517. package/skill-bundle/insight-dnspy/references/agent-execution.md +0 -36
  518. package/skill-bundle/insight-dotnet-dump/references/agent-execution.md +0 -36
  519. package/skill-bundle/insight-dotnet-stack/references/agent-execution.md +0 -36
  520. package/skill-bundle/insight-dotnet-trace/references/agent-execution.md +0 -36
  521. package/skill-bundle/insight-frida/references/agent-execution.md +0 -36
  522. package/skill-bundle/insight-ghidra/references/administration.md +0 -34
  523. package/skill-bundle/insight-ghidra/references/agent-execution.md +0 -36
  524. package/skill-bundle/insight-ghidra/references/archive.md +0 -32
  525. package/skill-bundle/insight-ghidra/references/artifacts.md +0 -52
  526. package/skill-bundle/insight-ghidra/references/debugger.md +0 -64
  527. package/skill-bundle/insight-ghidra/references/extensions-and-sync.md +0 -125
  528. package/skill-bundle/insight-ghidra/references/managed-runtime.md +0 -162
  529. package/skill-bundle/insight-ghidra/references/native-workflows.md +0 -124
  530. package/skill-bundle/insight-ghidra/references/persistent-client.mjs +0 -147
  531. package/skill-bundle/insight-ghidra/references/persistent.md +0 -90
  532. package/skill-bundle/insight-ghidra/references/query-semantics.md +0 -109
  533. package/skill-bundle/insight-ghidra/references/recovery.md +0 -235
  534. package/skill-bundle/insight-ghidra/references/research.md +0 -296
  535. package/skill-bundle/insight-ghidra/references/setup.md +0 -135
  536. package/skill-bundle/insight-ghidra/references/sparse-navigation.md +0 -173
  537. package/skill-bundle/insight-ghidra/references/storage.md +0 -139
  538. package/skill-bundle/insight-ilspy/references/agent-execution.md +0 -36
  539. package/skill-bundle/insight-ilspy/references/ilspy.md +0 -33
  540. package/skill-bundle/insight-interop/references/agent-execution.md +0 -36
  541. package/skill-bundle/insight-lldb/references/agent-execution.md +0 -36
  542. package/skill-bundle/insight-llvm/references/agent-execution.md +0 -36
  543. package/skill-bundle/insight-managed-heap/references/agent-execution.md +0 -36
  544. package/skill-bundle/insight-managed-metadata/references/agent-execution.md +0 -36
  545. package/skill-bundle/insight-mitmproxy/references/agent-execution.md +0 -36
  546. package/skill-bundle/insight-overview/references/agent-execution.md +0 -36
  547. package/skill-bundle/insight-procmon/references/agent-execution.md +0 -36
  548. package/skill-bundle/insight-re/references/agent-execution.md +0 -36
  549. package/skill-bundle/insight-re/references/artifacts.md +0 -52
  550. package/skill-bundle/insight-re/references/persistent-client.mjs +0 -147
  551. package/skill-bundle/insight-re/references/persistent.md +0 -90
  552. package/skill-bundle/insight-re/references/recovery.md +0 -235
  553. package/skill-bundle/insight-re/references/storage.md +0 -139
  554. package/skill-bundle/insight-re/references/work-tracking.md +0 -261
  555. package/skill-bundle/insight-sevenzip/references/agent-execution.md +0 -36
  556. package/skill-bundle/insight-strace/references/agent-execution.md +0 -36
  557. package/skill-bundle/insight-tshark/references/agent-execution.md +0 -36
  558. package/skill-bundle/insight-windbg/references/agent-execution.md +0 -36
  559. package/skills/insight-artifacts/references/agent-execution.md +0 -36
  560. package/skills/insight-artifacts/references/artifacts.md +0 -52
  561. package/skills/insight-artifacts/references/recovery.md +0 -235
  562. package/skills/insight-artifacts/references/storage.md +0 -139
  563. package/skills/insight-binary/references/agent-execution.md +0 -36
  564. package/skills/insight-capture/references/agent-execution.md +0 -36
  565. package/skills/insight-die/references/agent-execution.md +0 -36
  566. package/skills/insight-dnspy/references/agent-execution.md +0 -36
  567. package/skills/insight-dotnet-dump/references/agent-execution.md +0 -36
  568. package/skills/insight-dotnet-stack/references/agent-execution.md +0 -36
  569. package/skills/insight-dotnet-trace/references/agent-execution.md +0 -36
  570. package/skills/insight-frida/references/agent-execution.md +0 -36
  571. package/skills/insight-ghidra/references/administration.md +0 -34
  572. package/skills/insight-ghidra/references/agent-execution.md +0 -36
  573. package/skills/insight-ghidra/references/archive.md +0 -32
  574. package/skills/insight-ghidra/references/artifacts.md +0 -52
  575. package/skills/insight-ghidra/references/debugger.md +0 -64
  576. package/skills/insight-ghidra/references/extensions-and-sync.md +0 -125
  577. package/skills/insight-ghidra/references/managed-runtime.md +0 -162
  578. package/skills/insight-ghidra/references/native-workflows.md +0 -124
  579. package/skills/insight-ghidra/references/persistent-client.mjs +0 -147
  580. package/skills/insight-ghidra/references/persistent.md +0 -90
  581. package/skills/insight-ghidra/references/query-semantics.md +0 -109
  582. package/skills/insight-ghidra/references/recovery.md +0 -235
  583. package/skills/insight-ghidra/references/research.md +0 -296
  584. package/skills/insight-ghidra/references/setup.md +0 -135
  585. package/skills/insight-ghidra/references/sparse-navigation.md +0 -173
  586. package/skills/insight-ghidra/references/storage.md +0 -139
  587. package/skills/insight-ilspy/references/agent-execution.md +0 -36
  588. package/skills/insight-ilspy/references/ilspy.md +0 -33
  589. package/skills/insight-interop/references/agent-execution.md +0 -36
  590. package/skills/insight-lldb/references/agent-execution.md +0 -36
  591. package/skills/insight-llvm/references/agent-execution.md +0 -36
  592. package/skills/insight-managed-heap/references/agent-execution.md +0 -36
  593. package/skills/insight-managed-metadata/references/agent-execution.md +0 -36
  594. package/skills/insight-mitmproxy/references/agent-execution.md +0 -36
  595. package/skills/insight-overview/references/agent-execution.md +0 -36
  596. package/skills/insight-procmon/references/agent-execution.md +0 -36
  597. package/skills/insight-re/references/agent-execution.md +0 -36
  598. package/skills/insight-re/references/artifacts.md +0 -52
  599. package/skills/insight-re/references/persistent-client.mjs +0 -147
  600. package/skills/insight-re/references/persistent.md +0 -90
  601. package/skills/insight-re/references/recovery.md +0 -235
  602. package/skills/insight-re/references/storage.md +0 -139
  603. package/skills/insight-re/references/work-tracking.md +0 -261
  604. package/skills/insight-sevenzip/references/agent-execution.md +0 -36
  605. package/skills/insight-strace/references/agent-execution.md +0 -36
  606. package/skills/insight-tshark/references/agent-execution.md +0 -36
  607. package/skills/insight-windbg/references/agent-execution.md +0 -36
  608. /package/dist/src/{debugger-supervisor.d.ts → native/contract.js} +0 -0
  609. /package/runtime/native/{windows-job → windows}/NuGet.Config +0 -0
@@ -0,0 +1,8 @@
1
+ export declare function runtimeIdentity(ghidraHome: string): string;
2
+ /** An identity recorded by an older version: a hash of the whole installation, which compares with nothing. */
3
+ export declare const installationHash: (identity: unknown) => boolean;
4
+ /** The identity of a recorded runtime: an older installation hash is read again from its Ghidra home, if still there. */
5
+ export declare function currentIdentity(recorded: {
6
+ ghidraHome: string;
7
+ fingerprint: string;
8
+ }): string;
@@ -0,0 +1,26 @@
1
+ // What a client and a hub's Ghidra Server must share (#161): the Ghidra version, which fixes the server protocol and
2
+ // the database formats. Read from application.properties; installations are never hashed, so the same version
3
+ // matches on every machine and operating system.
4
+ import { readFileSync } from 'node:fs';
5
+ import { join } from 'node:path';
6
+ import { fail } from './model.js';
7
+ export function runtimeIdentity(ghidraHome) {
8
+ const properties = readFileSync(join(ghidraHome, 'Ghidra', 'application.properties'), 'utf8');
9
+ const version = /^application.version=(.+)$/m.exec(properties)?.[1]?.trim();
10
+ if (!version)
11
+ fail('configuration', 'Ghidra application.properties names no version.');
12
+ return 'ghidra-' + version;
13
+ }
14
+ /** An identity recorded by an older version: a hash of the whole installation, which compares with nothing. */
15
+ export const installationHash = (identity) => typeof identity === 'string' && /^[a-f0-9]{64}$/.test(identity);
16
+ /** The identity of a recorded runtime: an older installation hash is read again from its Ghidra home, if still there. */
17
+ export function currentIdentity(recorded) {
18
+ if (!installationHash(recorded.fingerprint))
19
+ return recorded.fingerprint;
20
+ try {
21
+ return runtimeIdentity(recorded.ghidraHome);
22
+ }
23
+ catch {
24
+ return recorded.fingerprint;
25
+ }
26
+ }
@@ -1,8 +1,6 @@
1
1
  import { type CommandContext, type CommandDefinition } from '@eyeauras/cli-factory';
2
2
  import { atomicWrite } from './tool-runtime/store.js';
3
3
  export declare const runtimeWrite: typeof atomicWrite;
4
- /** Passive, conservative inventory: an unproved PID blocks deletion; it never grants kill authority. */
5
- export declare function runtimeProcesses(directory: string, control?: string): Promise<Record<string, unknown>[]>;
6
4
  export declare function externalGhidra(path: string): Promise<string>;
7
5
  export declare class RuntimeManager {
8
6
  private readonly c;
@@ -43,12 +41,6 @@ export declare class RuntimeManager {
43
41
  requires?: undefined;
44
42
  };
45
43
  };
46
- server: {
47
- pid?: unknown;
48
- mode: string;
49
- state: string;
50
- };
51
- processes: Record<string, unknown>[];
52
44
  installations: {
53
45
  id: string;
54
46
  selected: boolean;
@@ -83,7 +75,6 @@ export declare class RuntimeManager {
83
75
  }[];
84
76
  }>;
85
77
  private archive;
86
- private cleanupProbes;
87
78
  install(o: Record<string, unknown>): Promise<{
88
79
  debugger?: {
89
80
  backend: string;
@@ -103,7 +94,7 @@ export declare class RuntimeManager {
103
94
  }>;
104
95
  uninstall(purgeCache?: boolean): Promise<{
105
96
  state: string;
106
- mode: "external" | "managed";
97
+ mode: "managed" | "external";
107
98
  externalInstallationPreserved: boolean;
108
99
  researchPreserved: boolean;
109
100
  materialsPreserved: boolean;
@@ -117,7 +108,6 @@ export declare class RuntimeManager {
117
108
  checkedAt: string;
118
109
  headless: unknown;
119
110
  decompiler: unknown;
120
- server: boolean;
121
111
  debugger: Record<string, unknown>;
122
112
  diagnostics: string;
123
113
  }>;
@@ -1,4 +1,3 @@
1
- import { ownedDirectory } from './directory-identity.js';
2
1
  import { runTool } from './tool-runtime/run.js';
3
2
  import { analysisDirectory } from './analysis-storage.js';
4
3
  import { readFile, mkdir, rename, rm, realpath, readdir, stat, cp } from 'node:fs/promises';
@@ -9,94 +8,12 @@ import { runtimeRoot, runtimeSelection, runtimeValues } from './runtime-selectio
9
8
  import { runtimeCatalog } from './runtime-catalog.js';
10
9
  import { cacheArtifact, extractArchive, consumeArchive } from './tool-runtime/archives.js';
11
10
  import { nativeInputs, nativeHelpers, nativeJvmDirectories, pinnedMcpJar } from './native-inputs.js';
12
- import { GhidraServer, stopLocalServer } from './server.js';
13
11
  import { fail, text, digest, object } from './model.js';
14
12
  import { atomicWrite, installationStage, removeInstallation, withToolLock, assertUnused } from './tool-runtime/store.js';
15
13
  import { lifecycleCommands as sharedLifecycle } from './tool-runtime/definition.js';
16
- import { recordedProcessGone } from './tool-runtime/supervisor.js';
17
14
  import { managedGhidraDebugger, ghidraDebuggerInstaller, prepareGhidraDebugger } from './ghidra-debugger-runtime.js';
18
15
  const suffix = process.platform === 'win32' ? '.exe' : '';
19
16
  export const runtimeWrite = atomicWrite;
20
- const live = (pid) => { if (!Number.isSafeInteger(pid) || Number(pid) < 1)
21
- return false; try {
22
- process.kill(Number(pid), 0);
23
- return true;
24
- }
25
- catch (error) {
26
- if (error.code === 'ESRCH')
27
- return false;
28
- throw error;
29
- } };
30
- /**
31
- * A Ghidra binding bound to a supervisor receipt is settled by that receipt when it is the same Ghidra role, PID and
32
- * root and has provably ended (including a proven PID reuse). Bindings without a matching receipt stay conservative.
33
- * Receipts live in the Factory control directory, which can differ from the scanned analysis directory.
34
- */
35
- async function supervisorEnded(control, binding, role, root, rootKey) {
36
- if (typeof binding.toolProcessId !== 'string')
37
- return false;
38
- try {
39
- // The binding's PID is alive: only a fresh proof, on one validated receipt snapshot, settles it.
40
- const row = await recordedProcessGone(control, binding.toolProcessId), recorded = row?.metadata?.[rootKey];
41
- if (!row || row.tool !== 'ghidra' || row.role !== role || row.pid !== binding.pid || typeof recorded !== 'string')
42
- return false;
43
- const scanned = await realpath(root);
44
- if (typeof binding.root === 'string' && await realpath(binding.root) !== scanned)
45
- return false;
46
- return await realpath(recorded) === scanned;
47
- }
48
- catch {
49
- return false;
50
- }
51
- }
52
- /** Passive, conservative inventory: an unproved PID blocks deletion; it never grants kill authority. */
53
- export async function runtimeProcesses(directory, control = directory) {
54
- const items = [];
55
- async function walk(path, depth = 0) {
56
- if (depth > 6)
57
- return;
58
- let entries;
59
- try {
60
- entries = await readdir(path, { withFileTypes: true });
61
- }
62
- catch (error) {
63
- if (error.code === 'ENOENT')
64
- return;
65
- throw error;
66
- }
67
- for (const entry of entries) {
68
- const at = join(path, entry.name);
69
- if (entry.isDirectory())
70
- await walk(at, depth + 1);
71
- else if (entry.name === 'process.json') {
72
- const p = object(JSON.parse(await readFile(at, 'utf8')));
73
- let stopped = false;
74
- try {
75
- const s = object(JSON.parse(await readFile(join(path, 'stopped.json'), 'utf8')));
76
- stopped = s.pid === p.pid && s.tokenSecret === p.tokenSecret;
77
- }
78
- catch (error) {
79
- if (error.code !== 'ENOENT')
80
- throw error;
81
- }
82
- // A GUI worker can own debugger state; it is settled only with debugger cleanup evidence (#153).
83
- if (!stopped && live(p.pid) && (p.mode === 'gui' || !await supervisorEnded(control, p, String(p.kind), path, 'contextRoot')))
84
- items.push({ kind: p.kind, pid: p.pid, sessionContext: p.context, ...(typeof p.session === 'string' ? { session: p.session } : {}), target: p.target, mode: p.mode });
85
- }
86
- }
87
- }
88
- await walk(join(directory, 'workspace', 'ghidra-native'));
89
- try {
90
- const s = object(JSON.parse(await readFile(join(directory, 'workspace/server/local.json'), 'utf8')));
91
- if (live(s.pid) && !await supervisorEnded(control, s, 'server', join(directory, 'workspace'), 'serverDirectory'))
92
- items.push({ kind: 'server', pid: s.pid });
93
- }
94
- catch (error) {
95
- if (error.code !== 'ENOENT')
96
- throw error;
97
- }
98
- return items;
99
- }
100
17
  export async function externalGhidra(path) {
101
18
  const resolved = await realpath(path), kind = await stat(resolved);
102
19
  const parent = kind.isDirectory() ? resolved : dirname(dirname(resolved));
@@ -190,11 +107,10 @@ export class RuntimeManager {
190
107
  if (error.code !== 'ENOENT')
191
108
  throw error;
192
109
  }
193
- const processes = await runtimeProcesses(this.directory), server = processes.find(p => p.kind === 'server');
194
110
  return { state: missing.length ? 'not_ready' : 'installed', mode: selected?.mode ?? (home || java ? 'external' : 'unconfigured'), recommended: 'managed', ghidraVersion: version, java, ghidraHome: home,
195
111
  ...(selected ? { installation: selected.id, fingerprint: selected.fingerprint } : {}), missing, capabilities: { headless: !missing.length, decompiler: !missing.length, gui: !missing.length,
196
112
  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' } },
197
- 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,
113
+ installations, retainedStages: stages, lastCheck: lastCheck ? { ...lastCheck, appliesToSelection: lastCheck.fingerprint === selected?.fingerprint && !selected?.uninstalledAt } : undefined,
198
114
  storage: { runtime: this.root, research: join(this.directory, 'workspace'), materials: join(this.directory, 'materials') } };
199
115
  }
200
116
  async download(offline = false) {
@@ -208,54 +124,24 @@ export class RuntimeManager {
208
124
  items.push({ name: 'LLDB/Python', path: item.path, sha256: item.sha256, license: item.license });
209
125
  return { state: 'downloaded', ghidraVersion: catalog.ghidraVersion, javaVersion: catalog.javaVersion, items };
210
126
  }
211
- async archive(artifact, provided, checksum, offline) {
127
+ async archive(artifact, provided, offline) {
212
128
  if (provided === undefined)
213
129
  return { path: await cacheArtifact(artifact, join(this.root, 'cache'), this.c.fetch, this.c.signal, offline), artifact };
214
- return consumeArchive(resolve(this.c.cwd, text(provided, 4096)), join(this.root, 'cache'), artifact, checksum === undefined ? undefined : text(checksum, 64), this.c.signal);
215
- }
216
- async cleanupProbes() {
217
- // A killed owner may leave a disposable validation server alive. Its authenticated
218
- // receipt, not PID existence, authorizes recovery; no research repository is touched.
219
- for (const parent of ['stages', 'checks']) {
220
- let names;
221
- try {
222
- names = await readdir(join(this.root, parent));
223
- }
224
- catch (error) {
225
- if (error.code === 'ENOENT')
226
- continue;
227
- throw error;
228
- }
229
- for (const name of names) {
230
- if (!/^[a-f0-9-]{36}$/.test(name))
231
- continue;
232
- const root = join(analysisDirectory(this.c), 'runtime', parent, name, ...(parent === 'stages' ? ['validation'] : []));
233
- if (existsSync(join(root, 'server/local.json'))) {
234
- if (!ownedDirectory(root, analysisDirectory(this.c), ['runtime', parent, name, ...(parent === 'stages' ? ['validation'] : [])]))
235
- fail('binding', 'Retained runtime probe moved outside its owned storage.');
236
- await stopLocalServer(root, this.c);
237
- }
238
- }
239
- }
130
+ return consumeArchive(resolve(this.c.cwd, text(provided, 4096)), join(this.root, 'cache'), artifact, this.c.signal);
240
131
  }
241
132
  async install(o) {
242
133
  return withToolLock(this.directory, 'ghidra', async () => {
243
134
  await assertUnused(this.directory, 'ghidra');
244
- await this.cleanupProbes();
245
135
  if (o.executable && o.archive)
246
136
  fail('invalid', 'Choose --executable or --archive.');
247
- if (o.archiveSha256 && !o.archive || o.javaArchiveSha256 && !o.javaArchive)
248
- fail('invalid', 'Archive checksum requires its archive path.');
249
- if (o.debuggerArchiveSha256 && !o.debuggerArchive)
250
- fail('invalid', 'Debugger archive checksum requires its archive path.');
251
- if ((o.debuggerArchive || o.debuggerArchiveSha256) && !managedGhidraDebugger())
137
+ if (o.debuggerArchive && !managedGhidraDebugger())
252
138
  fail('unsupported', 'A managed debugger archive requires macOS 15+ ARM64.');
253
139
  const catalog = runtimeCatalog(), offline = Boolean(o.offline), external = o.executable ? await externalGhidra(resolve(this.c.cwd, text(o.executable, 4096))) : undefined;
254
- const ghidra = external ? undefined : await this.archive(catalog.ghidra, o.archive, o.archiveSha256, offline);
140
+ const ghidra = external ? undefined : await this.archive(catalog.ghidra, o.archive, offline);
255
141
  const java = o.java ? await realpath(resolve(this.c.cwd, text(o.java, 4096))) : undefined;
256
142
  if (java && o.javaArchive)
257
143
  fail('invalid', 'Choose --java or --java-archive.');
258
- const jdk = java ? undefined : await this.archive(catalog.java, o.javaArchive, o.javaArchiveSha256, offline);
144
+ const jdk = java ? undefined : await this.archive(catalog.java, o.javaArchive, offline);
259
145
  const identity = digest({ schema: 1, platform: process.platform, architecture: process.arch, external, java, ghidra: ghidra?.artifact.sha256, jdk: jdk?.artifact.sha256, bridge: pinnedMcpJar });
260
146
  const receipt = await installationStage(this.root, identity, async (temporary, installation) => {
261
147
  let ghidraHome = external, nativeOverlay;
@@ -294,15 +180,12 @@ export class RuntimeManager {
294
180
  await this.probe(inputs, join(temporary, 'validation'));
295
181
  await rm(join(temporary, 'validation'), { recursive: true, force: true });
296
182
  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'),
297
- 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'] };
183
+ 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'] };
298
184
  return receipt;
299
185
  }, async (receipt) => {
300
- const inputs = await nativeInputs({ ...this.c.profile.values, java: receipt.java, ghidraHome: receipt.ghidraHome }, undefined, this.c);
301
- if (inputs.fingerprint !== receipt.fingerprint)
302
- fail('binding', 'Installed runtime differs from its verified installation receipt.');
303
186
  }, this.c.signal);
304
187
  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() };
305
- const debuggerRuntime = managedGhidraDebugger() ? await prepareGhidraDebugger(this.c, { archive: o.debuggerArchive, archiveSha256: o.debuggerArchiveSha256, offline: o.offline }) : undefined;
188
+ const debuggerRuntime = managedGhidraDebugger() ? await prepareGhidraDebugger(this.c, { archive: o.debuggerArchive, offline: o.offline }) : undefined;
306
189
  await runtimeWrite(join(this.root, 'selection.json'), selected);
307
190
  return { state: 'installed', ...selected, checks: receipt.checks, ...(debuggerRuntime ? { debugger: { backend: 'managed-lldb', installation: debuggerRuntime.id, fingerprint: debuggerRuntime.fingerprint } } : {}) };
308
191
  }, this.c.signal);
@@ -310,7 +193,6 @@ export class RuntimeManager {
310
193
  async uninstall(purgeCache = false) {
311
194
  return withToolLock(this.directory, 'ghidra', async () => {
312
195
  await assertUnused(this.directory, 'ghidra');
313
- await this.cleanupProbes();
314
196
  const selected = runtimeSelection(this.directory, analysisDirectory(this.c));
315
197
  if (!selected)
316
198
  fail('configuration', 'No managed selection exists; externally configured profile paths are never removed.');
@@ -348,23 +230,9 @@ export class RuntimeManager {
348
230
  const value = object(JSON.parse(output.stdout));
349
231
  if (value.state !== 'ready' || value.decompiler !== true || value.expectedReturn !== 42)
350
232
  fail('partial', 'Native decompiler probe did not verify its expected result.');
351
- const probeContext = { ...this.c, profile: { ...this.c.profile, values: { ...this.c.profile.values, server: undefined } } };
352
- const server = new GhidraServer(root, inputs, probeContext);
353
- try {
354
- const result = await server.administration('connect', {});
355
- if (result.connected !== true || result.mode !== 'local')
356
- fail('partial', 'Owned server probe did not connect.');
357
- const checked = await server.administration('status', {});
358
- if (checked.connected !== true)
359
- fail('partial', 'Owned server identity/authority probe failed.');
360
- }
361
- finally {
362
- await server.stop();
363
- }
364
233
  return value;
365
234
  }
366
235
  async doctor() {
367
- await this.cleanupProbes();
368
236
  const root = join(analysisDirectory(this.c), 'runtime/checks', randomUUID()), values = runtimeValues(this.directory, this.c.profile.values, analysisDirectory(this.c));
369
237
  const inputs = await nativeInputs(values, undefined, this.c), native = await this.probe(inputs, root);
370
238
  let debuggerCheck = { state: 'host_specific' };
@@ -384,10 +252,10 @@ export class RuntimeManager {
384
252
  catch {
385
253
  debuggerCheck = { state: 'missing', backend: 'system-lldb', reason: 'Apple developer tools or debugger authorization is unavailable' };
386
254
  }
387
- 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 };
255
+ const result = { state: 'verified', fingerprint: inputs.fingerprint, ghidraVersion: inputs.ghidraVersion, checkedAt: new Date().toISOString(), headless: native.headless, decompiler: native.decompiler, debugger: debuggerCheck, diagnostics: root };
388
256
  await runtimeWrite(join(this.root, 'last-check.json'), result);
389
257
  if (debuggerCheck.state === 'missing')
390
- fail('partial', 'Static analysis and local server passed; the host debugger is unavailable.', { ...result, state: 'partial' });
258
+ fail('partial', 'Static analysis passed; the host debugger is unavailable.', { ...result, state: 'partial' });
391
259
  return result;
392
260
  }
393
261
  }
@@ -395,10 +263,7 @@ function runtimeValuesForStatus(selection, values) { return { ...values, java: s
395
263
  export function runtimeCommands(exclusive) {
396
264
  const source = [{ flags: '--archive <path>', description: 'Local Ghidra zip/tar.gz; missing dependencies are downloaded' },
397
265
  { flags: '--debugger-archive <path>', description: 'Local pinned LLDB/Python runtime archive (macOS 15+ ARM64)' },
398
- { flags: '--debugger-archive-sha256 <sha256>', description: 'Expected SHA256 for the supplied debugger runtime archive' },
399
- { flags: '--archive-sha256 <sha256>', description: 'Expected SHA256 for the supplied Ghidra archive' },
400
266
  { flags: '--java-archive <path>', description: 'Local Java 21 JDK zip/tar.gz' },
401
- { flags: '--java-archive-sha256 <sha256>', description: 'Expected SHA256 for the supplied JDK archive' },
402
267
  { flags: '--java <path>', description: 'Use an external Java 21 JDK executable' },
403
268
  { flags: '--executable <path>', description: 'Use an external Ghidra launcher or installation directory; never deleted' },
404
269
  { flags: '--offline', description: 'Use local archives/cache only; never access the network' }];
@@ -9,5 +9,5 @@ export interface RuntimeSelection {
9
9
  uninstalledAt?: string;
10
10
  }
11
11
  export declare const runtimeRoot: (directory: string) => string;
12
- export declare function runtimeSelection(directory: string, analysis?: string): RuntimeSelection | undefined;
12
+ export declare function runtimeSelection(directory: string, _analysis?: string): RuntimeSelection | undefined;
13
13
  export declare function runtimeValues(directory: string, values: Record<string, unknown>, analysis?: string): Record<string, unknown>;
@@ -1,42 +1,12 @@
1
- import { sameDirectory, ownedDirectory } from './directory-identity.js';
2
- import { readFileSync, existsSync, realpathSync } from 'node:fs';
3
- import { join, isAbsolute, resolve } from 'node:path';
4
- import { fail, object, digest } from './model.js';
1
+ import { readFileSync, existsSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { fail } from './model.js';
5
4
  export const runtimeRoot = (directory) => join(directory, 'runtime');
6
- export function runtimeSelection(directory, analysis = directory) {
5
+ export function runtimeSelection(directory, _analysis = directory) {
7
6
  const path = join(runtimeRoot(directory), 'selection.json');
8
7
  if (!existsSync(path))
9
8
  return;
10
- const value = object(JSON.parse(readFileSync(path, 'utf8')));
11
- 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)))
12
- fail('binding', 'Runtime selection receipt is invalid.');
13
- if (value.mode === 'managed') {
14
- const id = String(value.id), recordedProfile = resolve(value.ghidraHome, '../../../..');
15
- if (!/^[a-f0-9]{64}$/.test(id) || value.ghidraHome !== join(runtimeRoot(recordedProfile), 'installations', id, 'ghidra'))
16
- fail('binding', 'Managed runtime moved outside its owned installation.');
17
- // Workspace resolves AppData physically; older install receipts can retain a profile
18
- // alias such as /tmp -> /private/tmp. Accept that same profile, never an inner escape.
19
- let profile, recorded, owned, home, retained = false;
20
- try {
21
- profile = realpathSync.native(directory);
22
- recorded = realpathSync.native(recordedProfile);
23
- owned = realpathSync.native(analysis);
24
- if (!sameDirectory(recorded, profile) && !sameDirectory(recorded, owned)) {
25
- const marker = object(JSON.parse(readFileSync(join(recorded, '.insight-analysis.json'), 'utf8')));
26
- retained = marker.schema === 1 && marker.binding === digest(profile);
27
- }
28
- if (!ownedDirectory(runtimeRoot(directory), owned, ['runtime']) || !ownedDirectory(runtimeRoot(recordedProfile), owned, ['runtime']))
29
- fail('binding', 'Managed runtime root differs from its configured analysis owner.');
30
- if (existsSync(value.ghidraHome))
31
- home = realpathSync.native(value.ghidraHome);
32
- }
33
- catch {
34
- fail('binding', 'Managed runtime profile ownership could not be verified.');
35
- }
36
- if (!sameDirectory(recorded, profile) && !sameDirectory(recorded, owned) && !retained || home !== undefined && !ownedDirectory(home, owned, ['runtime', 'installations', id, 'ghidra']))
37
- fail('binding', 'Managed runtime moved outside its owned installation.');
38
- }
39
- return value;
9
+ return JSON.parse(readFileSync(path, 'utf8'));
40
10
  }
41
11
  export function runtimeValues(directory, values, analysis) {
42
12
  const selected = runtimeSelection(directory, analysis);
@@ -44,7 +14,5 @@ export function runtimeValues(directory, values, analysis) {
44
14
  return values;
45
15
  if (selected.uninstalledAt)
46
16
  fail('configuration', 'Selected Ghidra runtime was uninstalled. Run insight-cli ghidra install.');
47
- if (selected.mode === 'managed' && !existsSync(join(runtimeRoot(directory), 'installations', selected.id, 'ready.json')))
48
- fail('configuration', 'Selected managed Ghidra is not installed. Run insight-cli ghidra install.');
49
17
  return { ...values, java: selected.java, ghidraHome: selected.ghidraHome };
50
18
  }
@@ -1,18 +1,13 @@
1
1
  import { command, CliError, Permission } from '@eyeauras/cli-factory';
2
2
  import { createHash, randomUUID } from 'node:crypto';
3
3
  import { constants } from 'node:fs';
4
- import { lstat, mkdir, open, opendir, realpath, rename, rm } from 'node:fs/promises';
5
- import { basename, isAbsolute, join, relative, resolve, sep } from 'node:path';
4
+ import { lstat, mkdir, open, opendir, rename, rm } from 'node:fs/promises';
5
+ import { basename, join, resolve } from 'node:path';
6
6
  import { analysisDirectory } from './analysis-storage.js';
7
7
  const maximumEntries = 100_000, maximumDepth = 128;
8
8
  function fail(code, message) { throw new CliError(message, { code: 'artifacts.' + code }); }
9
9
  function check(signal) { if (signal?.aborted)
10
10
  fail('cancelled', 'Saving materials was cancelled; no snapshot was published.'); }
11
- function inside(parent, child) {
12
- const value = relative(parent, child);
13
- return value === '' || (!isAbsolute(value) && value !== '..' && !value.startsWith('..' + sep));
14
- }
15
- function stamp(info) { return [info.dev, info.ino, info.mode, info.size, info.mtimeNs, info.ctimeNs].join(':'); }
16
11
  async function syncDirectory(path) {
17
12
  if (process.platform === 'win32')
18
13
  return;
@@ -30,12 +25,10 @@ async function inventory(source, signal) {
30
25
  check(signal);
31
26
  if (depth > maximumDepth || entries.length >= maximumEntries)
32
27
  fail('limit', 'Materials exceed the traversal bound of 100000 entries or 128 directory levels; save a smaller selection.');
33
- const info = await lstat(path, { bigint: true });
28
+ const info = await lstat(path);
34
29
  if (!info.isFile() && !info.isDirectory())
35
30
  fail('unsupported', 'Materials must contain only ordinary files and directories; symbolic links and special files are unsupported.');
36
- if (info.size > BigInt(Number.MAX_SAFE_INTEGER))
37
- fail('limit', 'A materials entry exceeds the supported size counter.');
38
- entries.push({ path: name, kind: info.isFile() ? 'file' : 'directory', stamp: stamp(info), size: Number(info.size) });
31
+ entries.push({ path: name, kind: info.isFile() ? 'file' : 'directory' });
39
32
  if (info.isDirectory()) {
40
33
  // Sorting by code unit keeps manifest digests independent of locale and enumeration order.
41
34
  const names = [];
@@ -48,43 +41,23 @@ async function inventory(source, signal) {
48
41
  names.sort();
49
42
  for (const child of names)
50
43
  await visit(join(path, child), name ? name + '/' + child : child, depth + 1);
51
- if (stamp(await lstat(path, { bigint: true })) !== stamp(info))
52
- fail('changed', 'Source changed while saving; save a stable file or directory.');
53
44
  }
54
45
  }
55
46
  await visit(source, '', 0);
56
47
  return entries;
57
48
  }
58
- async function verifyParents(source, entry, entries) {
59
- let parent = entry.path ? entry.path.split('/').slice(0, -1).join('/') : undefined;
60
- while (parent !== undefined) {
61
- const expected = entries.get(parent);
62
- if (stamp(await lstat(parent ? join(source, parent) : source, { bigint: true })) !== expected.stamp)
63
- fail('changed', 'Source directory changed while saving; no snapshot was published.');
64
- parent = parent ? parent.split('/').slice(0, -1).join('/') : undefined;
65
- }
66
- }
67
49
  /** Copy user materials without initializing Ghidra, targets, sessions or Workspace. */
68
50
  export async function saveMaterials(appDataDirectory, source, signal) {
69
51
  let stage, published;
70
52
  try {
71
53
  check(signal);
72
- const sourcePath = resolve(source);
73
- // Reject a symbolic source itself before resolving its parents (e.g. macOS /tmp).
74
- const info = await lstat(sourcePath, { bigint: true });
54
+ const canonicalSource = resolve(source);
55
+ const info = await lstat(canonicalSource);
75
56
  if (!info.isFile() && !info.isDirectory())
76
57
  fail('unsupported', 'Save an ordinary file or directory; symbolic links and special files are unsupported.');
77
- const canonicalSource = await realpath(sourcePath);
78
- await mkdir(appDataDirectory, { recursive: true, mode: 0o700 });
79
- const appData = await realpath(appDataDirectory), storage = join(appData, 'materials');
80
- if (info.isDirectory() && inside(canonicalSource, storage))
81
- fail('recursive', 'Source contains the materials storage; choose a source outside its storage ancestry.');
58
+ const storage = join(appDataDirectory, 'materials');
82
59
  await mkdir(storage, { recursive: true, mode: 0o700 });
83
- if ((await lstat(storage)).isSymbolicLink() || await realpath(storage) !== storage)
84
- fail('storage', 'Materials storage must be an ordinary profile-owned directory.');
85
- const entries = await inventory(canonicalSource, signal), byPath = new Map(entries.map(entry => [entry.path, entry]));
86
- if (entries[0].stamp !== stamp(info))
87
- fail('changed', 'Source changed while preparing its snapshot; save a stable file or directory.');
60
+ const entries = await inventory(canonicalSource, signal);
88
61
  const identity = randomUUID(), candidate = join(storage, '.pending-' + identity);
89
62
  const final = join(storage, identity), content = join(candidate, 'content');
90
63
  await mkdir(candidate, { mode: 0o700 });
@@ -96,7 +69,6 @@ export async function saveMaterials(appDataDirectory, source, signal) {
96
69
  const buffer = Buffer.allocUnsafe(1024 * 1024);
97
70
  for (const entry of entries) {
98
71
  check(signal);
99
- await verifyParents(canonicalSource, entry, byPath);
100
72
  const inputPath = entry.path ? join(canonicalSource, entry.path) : canonicalSource;
101
73
  const outputPath = entry.path ? join(output, entry.path) : output;
102
74
  if (entry.kind === 'directory') {
@@ -108,9 +80,6 @@ export async function saveMaterials(appDataDirectory, source, signal) {
108
80
  // NONBLOCK avoids a hang if a regular source is exchanged for a FIFO before open.
109
81
  const input = await open(inputPath, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
110
82
  try {
111
- const before = await input.stat({ bigint: true });
112
- if (!before.isFile() || stamp(before) !== entry.stamp)
113
- fail('changed', 'Source file changed while saving; no snapshot was published.');
114
83
  const destination = await open(outputPath, 'wx', 0o600), hash = createHash('sha256');
115
84
  let copied = 0;
116
85
  try {
@@ -120,15 +89,10 @@ export async function saveMaterials(appDataDirectory, source, signal) {
120
89
  if (!bytesRead)
121
90
  break;
122
91
  copied += bytesRead;
123
- if (copied > entry.size)
124
- fail('changed', 'Source file grew while saving; no snapshot was published.');
125
92
  const chunk = buffer.subarray(0, bytesRead);
126
93
  hash.update(chunk);
127
94
  await destination.writeFile(chunk);
128
95
  }
129
- if (copied !== entry.size || stamp(await input.stat({ bigint: true })) !== entry.stamp ||
130
- stamp(await lstat(inputPath, { bigint: true })) !== entry.stamp)
131
- fail('changed', 'Source file changed while saving; no snapshot was published.');
132
96
  await destination.sync();
133
97
  }
134
98
  finally {
@@ -139,18 +103,11 @@ export async function saveMaterials(appDataDirectory, source, signal) {
139
103
  fileDigest = sha256;
140
104
  files++;
141
105
  bytes += copied;
142
- if (!Number.isSafeInteger(bytes))
143
- fail('limit', 'Materials exceed the supported size counter.');
144
106
  }
145
107
  finally {
146
108
  await input.close();
147
109
  }
148
110
  }
149
- // Detect edits to earlier files and directory membership changes during the entire capture.
150
- const after = await inventory(canonicalSource, signal);
151
- if (JSON.stringify(after) !== JSON.stringify(entries) || await realpath(sourcePath) !== canonicalSource ||
152
- stamp(await lstat(sourcePath, { bigint: true })) !== stamp(info))
153
- fail('changed', 'Source changed while saving; no snapshot was published.');
154
111
  const manifestBytes = JSON.stringify({ version: 1, entries: manifest }) + '\n';
155
112
  const metadata = await open(join(stage, 'manifest.json'), 'wx', 0o600);
156
113
  try {
@@ -13,7 +13,7 @@ export interface ScriptPage {
13
13
  limit: number;
14
14
  truncated: boolean;
15
15
  }
16
- /** Resolve only an explicit inventory ID; native search paths never choose another script. */
16
+ /** The file of an explicit inventory ID (`installation:<module path>/<name>`, `extension:<module>/<name>`, `context:<name>`). */
17
17
  export declare function scriptPath(home: string, contextRoot: string, script: string, extensions?: string[]): Promise<string>;
18
18
  /** Enumerate configured installation and owned context scripts without exposing native paths. */
19
19
  export declare function scriptInventory(home: string, contextRoot: string, filter: string, limit: number, offset: number, extensions?: string[]): Promise<ScriptPage>;
@@ -2,24 +2,26 @@ import { readdir, open } from 'node:fs/promises';
2
2
  import { join, relative, sep } from 'node:path';
3
3
  import { constants } from 'node:fs';
4
4
  import { fail } from './model.js';
5
- /** Resolve only an explicit inventory ID; native search paths never choose another script. */
5
+ /** The file of an explicit inventory ID (`installation:<module path>/<name>`, `extension:<module>/<name>`, `context:<name>`). */
6
6
  export async function scriptPath(home, contextRoot, script, extensions = []) {
7
7
  if (!/^(installation|context|extension):[^\0]+\.(java|py)$/.test(script) || script.includes('..') || script.includes('\\'))
8
8
  fail('invalid', 'Choose an explicit script ID returned by ghidra scripts list.');
9
- const page = await scriptInventory(home, contextRoot, script, 20000, 0, extensions), item = page.items.find(item => item.script === script);
10
- if (!item)
11
- fail('notFound', 'Script ID is absent from this context and installation.');
12
- const part = script.slice(script.indexOf(':') + 1);
13
- if (item.origin === 'extension') {
9
+ const origin = script.slice(0, script.indexOf(':')), part = script.slice(script.indexOf(':') + 1), segments = part.split('/'), filename = segments.pop();
10
+ let path;
11
+ if (origin === 'extension') {
14
12
  const [module, ...rest] = part.split('/'), root = extensions.find(p => p.split(/[\\/]/).pop() === module);
15
- if (!root)
16
- fail('binding', 'Script module is no longer enabled.');
17
- return join(root, 'ghidra_scripts', ...rest);
13
+ if (!root || !rest.length)
14
+ fail('notFound', 'Script module is not enabled.');
15
+ path = join(root, 'ghidra_scripts', ...rest);
18
16
  }
19
- if (item.origin === 'context')
20
- return join(contextRoot, 'ghidra_scripts', part);
21
- const segments = part.split('/'), filename = segments.pop();
22
- return join(home, 'Ghidra', ...segments, 'ghidra_scripts', filename);
17
+ else if (origin === 'context') {
18
+ if (segments.length)
19
+ fail('notFound', 'Script ID is absent from this context and installation.');
20
+ path = join(contextRoot, 'ghidra_scripts', filename);
21
+ }
22
+ else
23
+ path = join(home, 'Ghidra', ...segments, 'ghidra_scripts', filename);
24
+ return path;
23
25
  }
24
26
  /** Enumerate configured installation and owned context scripts without exposing native paths. */
25
27
  export async function scriptInventory(home, contextRoot, filter, limit, offset, extensions = []) {
@@ -44,8 +46,6 @@ export async function scriptInventory(home, contextRoot, filter, limit, offset,
44
46
  let category;
45
47
  try {
46
48
  const data = Buffer.alloc(4096), read = await handle.read(data, 0, data.length, 0);
47
- if (!(await handle.stat()).isFile())
48
- fail('binding', 'Script inventory file changed during inspection.');
49
49
  category = /^\s*(?:\/\/|#)\s*@category\s+([^\r\n]+)/m.exec(data.subarray(0, read.bytesRead).toString('utf8'))?.[1]?.trim().slice(0, 256);
50
50
  }
51
51
  finally {
@@ -9,8 +9,8 @@ export const sdkOperations = [
9
9
  { operation: 'type-layout', group: 'types', name: 'layout', description: 'Read native packing, alignment, bitfields, settings and source archive identity', params: [str('path')] },
10
10
  { operation: 'type-structure', group: 'types', name: 'define-layout', description: 'Create a native structure with packing/alignment/bitfields; replace only an explicitly selected empty placeholder', write: true, params: [str('path'), json('fields', 'array'), { name: 'packing', type: 'integer', required: false, default: '0' }, { name: 'alignment', type: 'integer', required: false, default: '0' }, bool('replace_placeholder')] },
11
11
  { operation: 'type-settings', group: 'types', name: 'set-settings', description: 'Edit default settings by actual native definition names; null clears an explicit setting', write: true, params: [str('path'), json('settings')] },
12
- { operation: 'type-archive-import', group: 'types', name: 'archive-import', description: 'Import explicit GDT type paths with archive identity and saved layout verification', write: true, params: [str('input'), json('types', 'array')] },
13
- { operation: 'changes', group: 'changes', name: 'compare', description: 'Categorized native ProgramDiff of two saved private contexts; does not merge', pair: true, params: [{ ...json('categories', 'array', false), default: '["bytes","comments","symbols","functions"]' }, count('max_ranges', '100'), count('timeout_seconds', '30')] },
12
+ { operation: 'type-archive-import', group: 'types', name: 'archive-import', description: 'Import explicit GDT type paths with their archive identity', write: true, params: [str('input'), json('types', 'array')] },
13
+ { operation: 'changes', group: 'changes', name: 'compare', description: 'Categorized native ProgramDiff of this working copy against its base version or another context; does not merge', pair: true, params: [{ ...json('categories', 'array', false), default: '["bytes","code_units","comments","symbols","functions","references","context","properties"]' }, count('max_ranges', '100'), count('timeout_seconds', '30')] },
14
14
  { operation: 'block-state', group: 'memory', name: 'block-state', description: 'Read exact block layout and bounded full-content digest', params: [str('name')] },
15
15
  { operation: 'assembly-preview', group: 'assembly', name: 'preview', description: 'Assemble in this program language and processor context without writing', params: [at(), json('instructions', 'array')] },
16
16
  { operation: 'patch-bytes', group: 'memory', name: 'patch-bytes', description: 'Replace equal-length bytes only when the expected bytes match; clears overlapping listing', write: true, params: [at(), str('expect_hex'), str('bytes_hex')] },