@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
@@ -1,14 +1,18 @@
1
+ // Debugger of a working copy (#161 wave 2): Ghidra's Debugger tool in the context's GUI worker. The target binary
2
+ // comes from the hub blob cache (hash verified) and is staged inside the working copy for each launch. Live state
3
+ // is Ghidra's; nothing about a launch or trace is stored by insight-cli.
1
4
  import { command, Permission } from '@eyeauras/cli-factory';
2
- import { resolve } from 'node:path';
3
- import { scope, address, number } from './research.js';
4
- import { id, text, object, fail } from './model.js';
5
- import { failUnresolved } from './unresolved-guidance.js';
5
+ import { randomBytes } from 'node:crypto';
6
+ import { copyFile, mkdir, readdir, rm } from 'node:fs/promises';
7
+ import { join, resolve } from 'node:path';
6
8
  import { selectedOptions } from './arguments.js';
7
- import { debuggerResult, debuggerExecutionSettled, debuggerProgramMetadata as metadata } from './debugger-results.js';
8
- import { setTimeout as delay } from 'node:timers/promises';
9
- import { randomUUID } from 'node:crypto';
10
- const lists = ['launch_offers', 'modules', 'list_breakpoints', 'stack_trace'];
9
+ import { address, helperScript, markedLine, number, scope } from './research.js';
10
+ import { fail, object, text } from './model.js';
11
+ import { debuggerResult } from './debugger-results.js';
12
+ const lists = ['launch_offers', 'modules', 'list_breakpoints', 'stack_trace', 'traces'];
11
13
  const liveWrites = new Set(['write_memory', 'write_register']);
14
+ const traceOperations = new Set(['write_memory', 'write_register', 'timeline', 'objects', 'object_values', 'schedule']);
15
+ const changing = new Set(['launch', 'resume', 'interrupt', 'step', 'set_breakpoint', 'remove_breakpoint', ...liveWrites]);
12
16
  function traceInteger(value) {
13
17
  const encoded = text(String(value), 32);
14
18
  if (!/^-?\d+$/.test(encoded))
@@ -31,179 +35,119 @@ export function debuggerWriteInputs(operation, p) {
31
35
  if (!/^(?:0x)?[a-f0-9]{1,128}$/i.test(String(p[key])))
32
36
  fail('invalid', 'Register values must be exact unsigned hex integers.');
33
37
  }
38
+ /** GUI workers whose Debugger tool InsightStartDebugger has started. */
39
+ const debuggerStarted = new WeakSet();
34
40
  export class Debugger {
35
- workspace;
36
- research;
37
- backend;
38
- constructor(workspace, research, backend) {
39
- this.workspace = workspace;
40
- this.research = research;
41
- this.backend = backend;
41
+ core;
42
+ profile;
43
+ constructor(core, profile = {}) {
44
+ this.core = core;
45
+ this.profile = profile;
42
46
  }
43
- async prepared(selected, trace, reading = false) {
44
- const backend = await this.backend(), unresolved = this.workspace.unresolved(selected);
45
- if (!backend.debuggerCall || !backend.debuggerStart || !backend.debuggerSaved)
46
- fail('configuration', 'Selected backend lacks debugger support.');
47
- if (unresolved.length) {
48
- if (!reading || unresolved.some(request => object(request.execution ?? {}).kind !== 'debugger'))
49
- failUnresolved(this.workspace, selected, 'Selected context retains an unresolved operation.');
50
- }
51
- else {
52
- await backend.open(selected);
53
- await backend.mode(selected, 'gui');
54
- await backend.debuggerStart(selected);
55
- }
56
- if (trace) {
57
- if (!backend.debuggerSelect || !this.workspace.context(selected).debugger?.traces.some(item => item.id === trace))
58
- fail('notFound', 'Trace is not saved in the selected context.');
59
- await backend.debuggerSelect(selected, trace);
47
+ /** Switches the context to GUI and starts Ghidra's Debugger tool with the program open, once per GUI worker. */
48
+ async prepared(s, action) {
49
+ await this.core.setMode(s, 'gui');
50
+ return this.core.withWorker(s, async (worker) => {
51
+ if (!debuggerStarted.has(worker)) {
52
+ const ready = await helperScript(worker, 'InsightStartDebugger');
53
+ if (ready.success !== true || !String(ready.console_output ?? '').includes('INSIGHT_DEBUGGER_READY'))
54
+ fail('partial', 'Ghidra\'s Debugger tool did not start' + (typeof ready.error === 'string' ? ': ' + ready.error.slice(0, 500) : '.'), { ...s });
55
+ debuggerStarted.add(worker);
56
+ }
57
+ return action(worker);
58
+ });
59
+ }
60
+ trace(s, worker, p) {
61
+ return helperScript(worker, 'InsightTraceState', Buffer.from(JSON.stringify({ ...p, owned_root: this.core.copyRoot(s) })).toString('base64'))
62
+ .then(result => markedLine(result, 'INSIGHT_TRACE_STATE '));
63
+ }
64
+ async bridge(s, worker, operation, p = {}) {
65
+ if (traceOperations.has(operation))
66
+ return this.trace(s, worker, { ...p, operation });
67
+ if (operation === 'list_breakpoints')
68
+ return (await this.trace(s, worker, { operation: 'breakpoints' })).items;
69
+ if (['resume', 'interrupt', 'step', 'set_breakpoint', 'remove_breakpoint'].includes(operation))
70
+ await this.trace(s, worker, { operation: 'focus' });
71
+ if (operation === 'read_memory')
72
+ await this.trace(s, worker, { operation: 'read_memory', address: p.address, size: p.size });
73
+ const raw = await worker.request(['launch', 'resume', 'interrupt', 'step', 'set_breakpoint', 'remove_breakpoint'].includes(operation) ? 'POST' : 'GET', '/debugger/' + operation, { ...p, ...(['launch', 'launch_offers', 'static_to_dynamic'].includes(operation) && worker.program ? { program: worker.program } : {}) });
74
+ if (raw && typeof raw === 'object' && !Array.isArray(raw)) {
75
+ const { program: _p, executable_path: _e, target_description: _d, ...rest } = object(raw);
76
+ return rest;
60
77
  }
61
- return backend;
78
+ return raw;
62
79
  }
63
- async read(selected, operation, p, trace) {
64
- return this.research.ordered(selected, async () => {
65
- const backend = await this.prepared(selected, trace, true);
66
- let value;
80
+ /**
81
+ * Removes staged launch directories. Called only when no target is connected (a new launch, or a status showing the
82
+ * debugger stopped), so no live process runs from them; a file still in use is left for the next call.
83
+ */
84
+ async clearRuns(s) {
85
+ const runs = join(this.core.copyRoot(s), 'debugger-run');
86
+ for (const name of (await readdir(runs).catch(() => [])).filter(n => /^r_[a-f0-9]{12}$/.test(n)))
87
+ await rm(join(runs, name), { recursive: true, force: true }).catch(() => { });
88
+ }
89
+ /** Copies the target's original binary (hub blob cache, hash verified) into the working copy for one launch; earlier launches' copies are removed. */
90
+ async stage(s) {
91
+ await this.clearRuns(s);
92
+ const source = await this.core.targetFile(s.target), root = join(this.core.copyRoot(s), 'debugger-run', 'r_' + randomBytes(6).toString('hex'));
93
+ await mkdir(root, { recursive: true });
94
+ const executable = join(root, process.platform === 'win32' ? 'image.exe' : 'image');
95
+ await copyFile(source, executable);
96
+ return { root, executable };
97
+ }
98
+ async read(s, operation, p) {
99
+ return this.prepared(s, async (worker) => {
100
+ const { limit, offset, ...rest } = p;
101
+ let value = await this.bridge(s, worker, operation, rest);
67
102
  if (operation !== 'traces')
68
- value = debuggerResult(operation, p, await backend.debuggerCall(selected, operation, Object.fromEntries(Object.entries(p).filter(([key]) => !['limit', 'offset'].includes(key)))));
69
- const current = this.workspace.context(selected), beforeMetadata = current.workingSnapshot ? await metadata(backend, current.workingSnapshot) : undefined;
70
- const saved = await backend.debuggerSaved(selected), snapshot = await backend.saved(selected);
71
- const changed = beforeMetadata !== undefined && beforeMetadata !== await metadata(backend, snapshot);
72
- const complexChanges = changed ? [...current.complexChanges, 'debugger-metadata-' + randomUUID()] : current.complexChanges;
73
- this.workspace.saveContext(selected, current.generation, { debugger: saved, workingSnapshot: snapshot, complexChanges });
74
- if (operation === 'traces')
75
- value = saved.traces.map(row => ({ trace: row.id, name: this.workspace.target(selected.target).name, current: row.id === saved.active, snap: row.snap, module_count: row.modules, thread_count: row.threads, connected: row.connected }));
76
- if (operation === 'traces' || lists.includes(operation)) {
77
- const rows = value, offset = Number(p.offset ?? 0), limit = Number(p.limit ?? 50);
78
- value = { items: rows.slice(offset, offset + limit), total: rows.length, offset, limit, truncated: offset + limit < rows.length };
103
+ value = debuggerResult(operation, p, value);
104
+ if (operation === 'status' && object(value).target_connected !== true)
105
+ await this.clearRuns(s);
106
+ if (lists.includes(operation)) {
107
+ const rows = value, from = Number(offset ?? 0), size = Number(limit ?? 50);
108
+ value = { items: rows.slice(from, from + size), total: rows.length, offset: from, limit: size, truncated: from + size < rows.length };
79
109
  }
80
- return { ...selected, ...(saved.active ? { trace: saved.active } : {}), connectionState: saved.connected ? 'connected' : saved.traces.length ? 'disconnected' : 'idle', pendingChanges: current.scalars.length + complexChanges.length, value };
110
+ return { ...s, value };
81
111
  });
82
112
  }
83
- async change(selected, operation, p, callerId, trace) {
84
- const reserved = this.workspace.reserveRequest(selected, 'ghidra.debugger.' + operation, { ...p, ...(trace ? { trace } : {}) }, callerId);
85
- return this.research.ordered(selected, async () => {
86
- const request = this.workspace.request(reserved.request.id);
87
- if (reserved.replay && request.state !== 'accepted') {
88
- if (request.state === 'applied')
89
- return request.result;
90
- const result = object(request.result ?? {});
91
- if (request.state === 'failed' && result.reason === 'disconnected')
92
- fail('disconnected', 'Selected trace has no live target.', result);
93
- if (request.state === 'failed' && result.reason === 'busy')
94
- fail('busy', 'This context still has a connected debugger; close/reopen it or use another session before a new launch.', result);
95
- if (request.state === 'failed' && result.reason === 'native_precondition')
96
- fail('rejected', 'The native live precondition failed; the target write was not started.', result);
97
- fail('unknown', 'Debugger action is retained and is not repeated.', request.result);
98
- }
99
- const backend = await this.prepared(selected, trace), context = this.workspace.context(selected);
100
- if (operation === 'launch' && (await backend.debuggerSaved(selected)).connected) {
101
- const result = { ...selected, state: 'not_started', reason: 'busy' };
102
- this.workspace.recordRequest(request.id, 'failed', result);
103
- fail('busy', 'This context still has a connected debugger; close/reopen it or use another session before a new launch.', result);
104
- }
105
- const before = debuggerResult('status', {}, await backend.debuggerCall(selected, 'status'));
106
- if (operation !== 'launch' && object(before).target_connected !== true) {
107
- const result = { ...selected, state: 'not_started', reason: 'disconnected' };
108
- this.workspace.recordRequest(request.id, 'failed', result);
109
- fail('disconnected', 'Selected trace has no live target.', result);
110
- }
111
- const beforeMetadata = context.workingSnapshot ? await metadata(backend, context.workingSnapshot) : undefined;
112
- this.workspace.startRequest(request.id, { kind: 'debugger', operation, generation: context.generation, before });
113
- let saved, savedSnapshot, metadataChanged = false;
114
- try {
115
- let raw;
116
- if (operation === 'launch') {
117
- if (!backend.debuggerLaunch)
118
- fail('configuration', 'Owned target staging is unavailable.');
119
- raw = await backend.debuggerLaunch(selected, p, request.id);
120
- }
121
- else
122
- raw = await backend.debuggerCall(selected, operation, p);
123
- if (liveWrites.has(operation) && object(raw).status === 'rejected' && object(raw).target_effect_started === false) {
124
- const result = { ...selected, state: 'not_started', reason: 'native_precondition', value: raw };
125
- this.workspace.recordRequest(request.id, 'failed', result);
126
- fail('rejected', 'Native live preconditions rejected the write before target dispatch.', result);
127
- }
128
- const value = debuggerResult(operation, p, raw);
129
- if (['resume', 'interrupt', 'step'].includes(operation)) {
130
- let observed = false;
131
- for (let attempt = 0; attempt < 40; attempt++) {
132
- const status = object(debuggerResult('status', {}, await backend.debuggerCall(selected, 'status')));
133
- if (debuggerExecutionSettled(operation, object(before), status)) {
134
- observed = true;
135
- break;
136
- }
137
- await delay(100);
138
- }
139
- if (!observed)
140
- fail('partial', 'Debugger execution state did not settle after the action.');
141
- }
142
- if (operation === 'set_breakpoint' || operation === 'remove_breakpoint') {
143
- let observed = false;
144
- for (let attempt = 0; attempt < 50; attempt++) {
145
- const rows = debuggerResult('list_breakpoints', {}, await backend.debuggerCall(selected, 'list_breakpoints'));
146
- if (rows.some(row => address(row.address) === address(p.address) && Number(row.trace_location_count) > 0) === (operation === 'set_breakpoint')) {
147
- observed = true;
148
- break;
149
- }
150
- await delay(100);
151
- }
152
- if (!observed)
153
- fail('partial', 'Breakpoint inventory did not verify the action.');
154
- }
155
- if (operation === 'launch' && p.stop_at_entry === true) {
156
- const stopped = object(debuggerResult('status', {}, await backend.debuggerCall(selected, 'status')));
157
- if (stopped.target_connected !== true || stopped.execution_state !== 'STOPPED')
158
- fail('partial', 'Entry-stop launch did not verify a stopped live target.');
159
- }
160
- saved = await backend.debuggerSaved(selected);
161
- savedSnapshot = await backend.saved(selected);
162
- metadataChanged = beforeMetadata !== undefined && beforeMetadata !== await metadata(backend, savedSnapshot);
163
- const complexChanges = metadataChanged ? [...context.complexChanges, request.id] : context.complexChanges;
164
- const result = { ...selected, state: 'applied', ...(operation === 'launch' && p.stop_at_entry === true ? { stoppedAtEntry: true } : {}), ...(saved.active ? { trace: saved.active } : {}), pendingChanges: context.scalars.length + complexChanges.length, sharedState: context.scalars.length || complexChanges.length ? 'pending' : 'shared', value };
165
- this.workspace.completeSavedRequest(selected, request.id, context.generation, { debugger: saved, workingSnapshot: savedSnapshot, complexChanges }, result);
166
- return result;
167
- }
168
- catch (error) {
169
- if (this.workspace.request(request.id).state === 'failed')
170
- throw error;
171
- try {
172
- saved ??= await backend.debuggerSaved(selected);
173
- }
174
- catch { }
175
- try {
176
- savedSnapshot ??= await backend.saved(selected);
177
- metadataChanged = beforeMetadata !== undefined && beforeMetadata !== await metadata(backend, savedSnapshot);
178
- }
179
- catch { }
180
- this.workspace.recordRequest(request.id, 'unknown', { ...selected, state: 'unknown', operation, ...(saved ? { savedDebugger: saved } : {}), ...(savedSnapshot ? { savedSnapshot, metadataChanged } : {}) });
181
- throw error;
113
+ async change(s, operation, p) {
114
+ return this.prepared(s, async (worker) => {
115
+ let raw;
116
+ if (operation === 'launch') {
117
+ const { root, executable } = await this.stage(s), { stop_at_entry: _, ...parameters } = p;
118
+ raw = await this.bridge(s, worker, 'launch', { ...parameters, executable_path: executable, cwd: p.cwd ?? root,
119
+ ...(typeof this.profile.debuggerPython === 'string' ? { python_executable: this.profile.debuggerPython } : {}),
120
+ ...(typeof this.profile.windbgDir === 'string' ? { windbg_dir: this.profile.windbgDir } : {}) });
182
121
  }
122
+ else
123
+ raw = await this.bridge(s, worker, operation, p);
124
+ if (liveWrites.has(operation) && object(raw).status === 'rejected' && object(raw).target_effect_started === false)
125
+ fail('rejected', 'The live precondition did not hold; nothing was written to the target.', { ...s, value: raw });
126
+ return { ...s, state: 'applied', value: debuggerResult(operation, p, raw) };
183
127
  });
184
128
  }
185
129
  }
186
130
  export function debuggerCommands(service) {
187
- const leaves = [], request = { flags: '--request-id <id>', description: 'Retrieve the outcome without repeating execution' }, trace = { flags: '--trace <id>', description: 'Select a saved trace within this context' };
131
+ const leaves = [];
188
132
  const operations = ['launch', 'launch_offers', 'status', 'traces', 'resume', 'interrupt', 'step', 'set_breakpoint', 'remove_breakpoint', 'list_breakpoints', 'registers', 'read_memory', 'stack_trace', 'modules', 'static_to_dynamic', 'dynamic_to_static', 'write_memory', 'write_register', 'timeline', 'objects', 'object_values', 'schedule'];
189
133
  for (const operation of operations) {
190
- const changing = ['launch', 'resume', 'interrupt', 'step', 'set_breakpoint', 'remove_breakpoint'].includes(operation) || liveWrites.has(operation), at = ['set_breakpoint', 'remove_breakpoint', 'read_memory', 'static_to_dynamic', 'dynamic_to_static', 'write_memory'].includes(operation), paged = operation === 'traces' || lists.includes(operation);
191
- const options = [...selectedOptions, ...(operation === 'launch' ? [] : [trace]), ...(at ? [{ flags: '--address <address>', description: 'Explicit static or trace address', required: true }] : []),
134
+ const at = ['set_breakpoint', 'remove_breakpoint', 'read_memory', 'static_to_dynamic', 'dynamic_to_static', 'write_memory'].includes(operation), paged = lists.includes(operation);
135
+ const options = [...selectedOptions, ...(at ? [{ flags: '--address <address>', description: 'Explicit static or trace address', required: true }] : []),
192
136
  ...(operation === 'read_memory' ? [{ flags: '--size <bytes>', description: 'Read 1–4096 bytes', defaultValue: 64 }] : []), ...(operation === 'stack_trace' ? [{ flags: '--depth <count>', description: 'Maximum frames 1–1000', defaultValue: 20 }] : []),
193
- ...(operation === 'write_memory' ? [{ flags: '--expect-hex <hex>', description: 'Exact current bytes before stopped-target write', required: true }, { flags: '--bytes-hex <hex>', description: 'Equal-length replacement bytes, at most 4096', required: true }] : []),
194
- ...(operation === 'write_register' ? [{ flags: '--register <name>', description: 'Exact target platform register', required: true }, { flags: '--expect-value <hex>', description: 'Exact current unsigned hex value', required: true }, { flags: '--value <hex>', description: 'Replacement unsigned hex value within native register width', required: true }] : []),
137
+ ...(operation === 'write_memory' ? [{ flags: '--expect-hex <hex>', description: 'Exact current bytes before the write', required: true }, { flags: '--bytes-hex <hex>', description: 'Equal-length replacement bytes, at most 4096', required: true }] : []),
138
+ ...(operation === 'write_register' ? [{ flags: '--register <name>', description: 'Exact target register', required: true }, { flags: '--expect-value <hex>', description: 'Exact current unsigned hex value', required: true }, { flags: '--value <hex>', description: 'Replacement unsigned hex value', required: true }] : []),
195
139
  ...(['timeline', 'objects'].includes(operation) ? [{ flags: '--limit <count>', description: 'Maximum returned rows 1–1000', defaultValue: 100 }] : []),
196
- ...(operation === 'timeline' ? [{ flags: '--before-snap <integer>', description: 'Latest included snapshot key; result gives next-before-snap' }] : []),
197
- ...(operation === 'objects' ? [{ flags: '--path-prefix <text>', description: 'Literal canonical path prefix; @target hides the owned staging root', defaultValue: '' }, { flags: '--max-scan <count>', description: 'Maximum visited objects 1–200000', defaultValue: 10000 }] : []),
140
+ ...(operation === 'timeline' ? [{ flags: '--before-snap <integer>', description: 'Latest included snapshot key; the result gives next-before-snap' }] : []),
141
+ ...(operation === 'objects' ? [{ flags: '--path-prefix <text>', description: 'Literal canonical path prefix', defaultValue: '' }, { flags: '--max-scan <count>', description: 'Maximum visited objects 1–200000', defaultValue: 10000 }] : []),
198
142
  ...(['objects', 'object_values'].includes(operation) ? [{ flags: '--snap <integer>', description: 'Snapshot key (default selected time)' }] : []),
199
- ...(operation === 'object_values' ? [{ flags: '--object-id <integer>', description: 'Object ID returned by objects; scoped to the selected trace', required: true }, { flags: '--key <name>', description: 'Exact native attribute/element key', required: true },
143
+ ...(operation === 'object_values' ? [{ flags: '--object-id <integer>', description: 'Object ID returned by objects', required: true }, { flags: '--key <name>', description: 'Exact native attribute/element key', required: true },
200
144
  { flags: '--from-snap <integer>', description: 'Start of a bounded history range' }, { flags: '--to-snap <integer>', description: 'End of a range of at most 1000 snaps' }] : []),
201
145
  ...(operation === 'schedule' ? [{ flags: '--schedule <time>', description: 'Parse and validate a native time schedule without executing it', required: true }] : []),
202
146
  ...(paged ? [{ flags: '--limit <count>', description: 'Page size 1–100', defaultValue: 50 }, { flags: '--offset <count>', description: 'Page offset', defaultValue: 0 }] : []),
203
147
  ...(operation === 'step' ? [{ flags: '--kind <kind>', description: 'into, over or out', defaultValue: 'into' }] : []),
204
- ...(operation === 'launch' ? [{ flags: '--stop-at-entry', description: 'macOS local LLDB: launch stopped at entry for inspection before running' }, { flags: '--args <text>', description: 'Target command-line arguments', defaultValue: '' }, { flags: '--cwd <directory>', description: 'Target working directory (default owned run folder)' },
205
- { flags: '--offer <name>', description: 'Launch offer title or configuration name', defaultValue: process.platform === 'win32' ? 'dbgeng' : process.platform === 'darwin' ? 'lldb' : 'gdb' }, { flags: '--timeout-seconds <count>', description: 'Launch wait 1–300 seconds', defaultValue: 60 }] : []), ...(changing ? [request] : [])];
206
- leaves.push(command(operation.replaceAll('_', '-'), 'Use the selected context debugger', ({ options: o }, c) => {
148
+ ...(operation === 'launch' ? [{ flags: '--args <text>', description: 'Target command-line arguments', defaultValue: '' }, { flags: '--cwd <directory>', description: 'Target working directory (default: the staging folder in the working copy)' },
149
+ { flags: '--offer <name>', description: 'Launch offer title or configuration name', defaultValue: process.platform === 'win32' ? 'dbgeng' : process.platform === 'darwin' ? 'lldb' : 'gdb' }, { flags: '--timeout-seconds <count>', description: 'Launch wait 1–300 seconds', defaultValue: 60 }] : [])];
150
+ leaves.push(command(operation.replaceAll('_', '-'), 'Use the context debugger (switches the context to GUI mode)', ({ options: o }, c) => {
207
151
  const p = {};
208
152
  if (at)
209
153
  p.address = address(o.address);
@@ -254,11 +198,6 @@ export function debuggerCommands(service) {
254
198
  fail('invalid', 'Step kind must be into, over or out.');
255
199
  }
256
200
  if (operation === 'launch') {
257
- if (o.stopAtEntry === true) {
258
- if (process.platform !== 'darwin' || o.offer !== 'lldb')
259
- fail('unsupported', '--stop-at-entry requires the local macOS lldb offer.');
260
- p.stop_at_entry = true;
261
- }
262
201
  if (typeof o.args !== 'string' || o.args.length > 8192 || o.args.includes('\0'))
263
202
  fail('invalid', 'Arguments must be bounded text.');
264
203
  p.args = o.args;
@@ -270,9 +209,8 @@ export function debuggerCommands(service) {
270
209
  fail('invalid', 'Debugger working directory must be a single filesystem path.');
271
210
  }
272
211
  }
273
- const selected = scope(o), selectedTrace = o.trace === undefined ? undefined : id(o.trace);
274
- return changing ? service(c).change(selected, operation, p, o.requestId === undefined ? undefined : id(o.requestId, '--request-id'), selectedTrace) : service(c).read(selected, operation, p, selectedTrace);
275
- }, { permission: operation === 'remove_breakpoint' || liveWrites.has(operation) ? 'Destructive' : changing ? Permission.Update : Permission.ReadOnly, options }));
212
+ return changing.has(operation) ? service(c).change(scope(o), operation, p) : service(c).read(scope(o), operation, p);
213
+ }, { permission: operation === 'remove_breakpoint' || liveWrites.has(operation) ? 'Destructive' : changing.has(operation) ? Permission.Update : Permission.ReadOnly, options }));
276
214
  }
277
- return [command('debugger', 'Debug the selected immutable target in an owned GUI', leaves)];
215
+ return [command('debugger', 'Debug the target in the context\'s GUI worker', leaves)];
278
216
  }
@@ -1 +1,2 @@
1
- export declare function decodedInstructions(raw: unknown, at: string, maxBytes: number, maxInstructions: number): Record<string, unknown>;
1
+ /** Ghidra's bounded linear decode, as returned. */
2
+ export declare function decodedInstructions(raw: unknown, _at: string, _maxBytes: number, _maxInstructions: number): Record<string, unknown>;
@@ -1,21 +1,5 @@
1
- import { createHash } from 'node:crypto';
2
- import { object, fail } from './model.js';
3
- import { address } from './research.js';
4
- export function decodedInstructions(raw, at, maxBytes, maxInstructions) {
5
- const value = object(raw), input = value.input_bytes;
6
- if (typeof input !== 'string' || !/^(?:[a-f0-9]{2})+$/.test(input) || input.length > maxBytes * 2 || value.input_sha256 !== createHash('sha256').update(Buffer.from(input, 'hex')).digest('hex') || address(value.address) !== at || !Array.isArray(value.instructions) || value.instructions.length > maxInstructions || typeof value.language !== 'string' || typeof value.stop_reason !== 'string' || !['byte_limit', 'instruction_limit', 'truncated_instruction', 'executable_block_end', 'terminal_flow', 'control_flow', 'context_unavailable', 'undecodable'].includes(value.stop_reason))
7
- fail('partial', 'Malformed bounded instruction result.');
8
- let consumed = 0;
9
- for (const raw of value.instructions) {
10
- const row = object(raw);
11
- if (!Number.isSafeInteger(row.length) || Number(row.length) < 1 || typeof row.bytes !== 'string' || row.bytes !== input.slice(consumed * 2, (consumed + Number(row.length)) * 2) || row.bytes.length !== Number(row.length) * 2 || typeof row.mnemonic !== 'string' || !Array.isArray(row.operands) || row.operands.some(v => typeof v !== 'string') || !Array.isArray(row.direct_targets) || row.direct_targets.some(v => typeof v !== 'string') || typeof row.computed_flow !== 'boolean' || row.computed_flow && row.direct_targets.length)
12
- fail('partial', 'Decoded instruction does not match input bytes or flow.');
13
- const [space, offset] = at.includes(':') ? at.split(':') : [undefined, at];
14
- if (address(row.address) !== (space ? space + ':' : '') + (BigInt('0x' + offset) + BigInt(consumed)).toString(16))
15
- fail('partial', 'Decoded instruction address changed.');
16
- consumed += Number(row.length);
17
- }
18
- if (value.consumed_bytes !== consumed || object(value.read_only ?? {}).modification_unchanged !== true)
19
- fail('partial', 'Decoder omitted consumed bytes or read-only proof.');
20
- return value;
1
+ import { object } from './model.js';
2
+ /** Ghidra's bounded linear decode, as returned. */
3
+ export function decodedInstructions(raw, _at, _maxBytes, _maxInstructions) {
4
+ return object(raw);
21
5
  }
@@ -8,5 +8,5 @@ export declare function transportDiagnostic(error: unknown, phase: TransportPhas
8
8
  method: string;
9
9
  port: number;
10
10
  };
11
- /** Revalidate even our own error results before persisting any structured diagnostics. */
11
+ /** The code and transport diagnostic (built by transportDiagnostic) of one of our own errors, for the audit. */
12
12
  export declare function diagnosticFailure(error: unknown): Record<string, unknown> | undefined;
@@ -54,29 +54,10 @@ export function transportDiagnostic(error, phase, method, port, status) {
54
54
  const name = field(error, 'name');
55
55
  return { phase, method, port, ...(typeof name === 'string' && names.has(name) ? { errorName: name } : {}), causeCodes: [...codes], ...(status !== undefined ? { httpStatus: status } : {}) };
56
56
  }
57
- /** Revalidate even our own error results before persisting any structured diagnostics. */
57
+ /** The code and transport diagnostic (built by transportDiagnostic) of one of our own errors, for the audit. */
58
58
  export function diagnosticFailure(error) {
59
- try {
60
- if (!(error instanceof CliError) || !errorCodes.has(error.code))
61
- return undefined;
62
- const result = { code: error.code }, raw = field(error.result, 'transport') ?? field(field(error.result, 'detail'), 'transport');
63
- const phase = field(raw, 'phase'), method = field(raw, 'method'), port = field(raw, 'port');
64
- if (typeof phase !== 'string' || !['fetch', 'body', 'status'].includes(phase) || typeof method !== 'string' || !['GET', 'POST'].includes(method) || !Number.isSafeInteger(port) || Number(port) < 0 || Number(port) > 65535)
65
- return result;
66
- const name = field(raw, 'errorName'), codes = field(raw, 'causeCodes'), status = field(raw, 'httpStatus'), safeCodes = [];
67
- const length = field(codes, 'length');
68
- if (array(codes) && typeof length === 'number')
69
- for (let i = 0; i < 4 && i < length; i++) {
70
- const code = field(codes, String(i));
71
- if (typeof code === 'string' && networkCodes.has(code))
72
- safeCodes.push(code);
73
- }
74
- result.transport = { phase, method, port, ...(typeof name === 'string' && names.has(name) ? { errorName: name } : {}),
75
- causeCodes: safeCodes,
76
- ...(Number.isInteger(status) && Number(status) >= 100 && Number(status) <= 599 ? { httpStatus: status } : {}) };
77
- return result;
78
- }
79
- catch {
59
+ if (!(error instanceof CliError) || !errorCodes.has(error.code))
80
60
  return undefined;
81
- }
61
+ const transport = field(error.result, 'transport') ?? field(field(error.result, 'detail'), 'transport');
62
+ return { code: error.code, ...(transport && typeof transport === 'object' ? { transport } : {}) };
82
63
  }
package/dist/src/die.js CHANGED
@@ -3,40 +3,18 @@ import { dirname, join, resolve } from 'node:path';
3
3
  import { release } from 'node:os';
4
4
  import { mkdir, writeFile, stat } from 'node:fs/promises';
5
5
  import { ToolInstaller } from './tool-runtime/installer.js';
6
- import { treeFingerprint } from './tool-runtime/store.js';
7
6
  import { defineTool, lifecycleCommands } from './tool-runtime/definition.js';
8
7
  import { catalogArtifact } from './tool-runtime/catalog.js';
9
8
  import { runTool } from './tool-runtime/run.js';
10
- import { fileSha256 } from './tool-runtime/archives.js';
11
9
  import { fail, text, id } from './model.js';
12
10
  import { number } from './research.js';
13
- const frameworks = ['QtConcurrent', 'QtCore', 'QtCore5Compat', 'QtNetwork', 'QtQml'];
14
11
  const contents = (executable) => dirname(dirname(executable));
15
12
  export function dieInstaller(c) {
16
13
  return new ToolInstaller(c, { id: 'die', primary: 'die', components: () => {
17
14
  if (process.platform !== 'darwin' || process.arch !== 'arm64' || Number(release().split('.')[0]) < 22)
18
15
  fail('unsupported', 'Managed DiE requires macOS 13+ ARM64.');
19
16
  return { die: catalogArtifact('5fc9f1d870b4c791ae688a07ccbae0dcdf677eedeeb6ae732bbc83eac61148af') };
20
- }, launch: roots => ({ executable: join(roots.die, 'MacOS/diec'), arguments: [], environment: {} }), externalInputs: async (executable) => {
21
- const root = contents(executable), inputs = {};
22
- // The database is executable signature code: fingerprint it as part of the external tool.
23
- for (const name of ['db', 'db_custom'])
24
- inputs['Resources/' + name] = await treeFingerprint(join(root, 'Resources', name));
25
- inputs['Resources/qt.conf'] = await fileSha256(join(root, 'Resources/qt.conf'));
26
- for (const path of ['MacOS/qt.conf', 'Info.plist', 'PlugIns'])
27
- try {
28
- const at = join(root, path);
29
- inputs[path] = (await stat(at)).isDirectory() ? await treeFingerprint(at) : await fileSha256(at);
30
- }
31
- catch (error) {
32
- if (error.code !== 'ENOENT')
33
- throw error;
34
- }
35
- if (process.platform === 'darwin')
36
- for (const name of frameworks)
37
- inputs[name] = await treeFingerprint(join(root, 'Frameworks', name + '.framework'));
38
- return inputs;
39
- }, probe: async (launch, context) => {
17
+ }, launch: roots => ({ executable: join(roots.die, 'MacOS/diec'), arguments: [], environment: {} }), probe: async (launch, context) => {
40
18
  const root = contents(launch.executable);
41
19
  await stat(join(root, 'Resources/db/_init'));
42
20
  const r = await runTool(context, { tool: 'die', role: 'version', executable: launch.executable, arguments: ['--version'], maxOutputBytes: 65536, timeoutMs: 30000 });
@@ -1,10 +1,10 @@
1
1
  import { join, dirname } from 'node:path';
2
2
  import { fileURLToPath } from 'node:url';
3
- import { mkdir, copyFile, rename, lstat } from 'node:fs/promises';
3
+ import { mkdir, copyFile, rename } from 'node:fs/promises';
4
4
  import { constants } from 'node:fs';
5
5
  import { randomUUID } from 'node:crypto';
6
6
  import { atomicWrite, readJson } from './tool-runtime/store.js';
7
- import { fileSha256, archiveName } from './tool-runtime/archives.js';
7
+ import { fileSha256 } from './tool-runtime/archives.js';
8
8
  import { runTool } from './tool-runtime/run.js';
9
9
  import { fail } from './model.js';
10
10
  export const dnspyNative = fileURLToPath(new URL('../../runtime/native/dnspy-extension/', import.meta.url));
@@ -20,26 +20,19 @@ export async function prepareDnspy(root, c) {
20
20
  await atomicWrite(plan, { Schema: 1, Nonce: nonce, Mode: 'patch-engine', Input: input, Output: output, BuildKey: join(dnspyNative, 'upstream-public-build.snk'), Result: result });
21
21
  await runTool(c, { tool: 'dnspy', role: 'prepare-unicode-loader', executable: join(root, 'dnSpy.exe'), arguments: ['--multiple', '--no-activate', '--settings-file', join(directory, 'settings.xml'), '--extension-directory', extension, '--insight-plan:' + plan], nativeDeadline: true, timeoutMs: 60000, maxOutputBytes: 65536 });
22
22
  const receipt = await readJson(result);
23
- if (receipt?.schema !== 1 || receipt.nonce !== nonce || receipt.data?.state !== 'completed' || receipt.data.mode !== 'patch-engine' || receipt.data.beforeSha256 !== original || !receipt.data.unicodeLoader || !receipt.data.strongNameIdentityPreserved || await fileSha256(output) !== receipt.data.afterSha256)
23
+ if (receipt?.data?.state !== 'completed' || !receipt.data.unicodeLoader || !receipt.data.strongNameIdentityPreserved)
24
24
  fail('binding', 'Owned dnSpy Unicode-loader preparation was not verified.', { diagnostics: directory });
25
25
  // The one-shot process has exited and the native Job has closed before replacing any mapped engine.
26
26
  await rename(output, input);
27
27
  await atomicWrite(join(root, 'insight-unicode-loader.json'), receipt.data);
28
28
  }
29
29
  export async function prepareExternalDnspy(executable, stage, c) {
30
- const manifest = await readJson(join(dnspyNative, 'vendor-files.json'));
31
- if (manifest?.schema !== 1 || manifest.files.length !== 867)
32
- fail('binding', 'Pinned dnSpy file inventory is missing.');
30
+ const manifest = (await readJson(join(dnspyNative, 'vendor-files.json')));
33
31
  const originalRoot = dirname(executable), owned = join(stage, 'execution');
34
32
  for (const entry of manifest.files) {
35
- archiveName(entry.path);
36
- const source = join(originalRoot, entry.path), destination = join(owned, entry.path), info = await lstat(source);
37
- if (!info.isFile() || info.size !== entry.size || await fileSha256(source) !== entry.sha256)
38
- fail('binding', 'External dnSpy component differs from the pinned vendor bundle.', { component: entry.path });
33
+ const source = join(originalRoot, entry.path), destination = join(owned, entry.path);
39
34
  await mkdir(dirname(destination), { recursive: true, mode: 0o700 });
40
35
  await copyFile(source, destination, constants.COPYFILE_EXCL);
41
- if (await fileSha256(destination) !== entry.sha256)
42
- fail('binding', 'Copied dnSpy component differs from the pinned vendor bundle.');
43
36
  }
44
37
  await prepareDnspy(owned, c);
45
38
  return { executable: join(owned, 'dnSpy.exe'), arguments: [], environment: {} };