@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
@@ -11,10 +11,7 @@ export interface SelectedTool extends ToolInstallation, ToolLaunch {
11
11
  externalInputs?: Record<string, string>;
12
12
  noticeDigest?: string;
13
13
  execution?: ToolLaunch;
14
- executionFingerprint?: string;
15
14
  }
16
- /** Read-only verification used by an owned child after the command owner has staged a runtime. */
17
- export declare function verifyManagedInstallation(directory: string, tool: string, selected: SelectedTool): Promise<void>;
18
15
  export interface InstallDescriptor {
19
16
  id: string;
20
17
  primary: string;
@@ -29,7 +26,7 @@ export interface InstallDescriptor {
29
26
  /** Known sibling executables/data files needed by an external tool family. */
30
27
  externalInputs?: (executable: string, c: CommandContext) => Promise<Record<string, string>>;
31
28
  /** Full retained notices copied into owned installation storage, including external selections. */
32
- noticeFiles?: Record<string, string>;
29
+ noticeFiles?: () => Record<string, string>;
33
30
  }
34
31
  /** Standard archive-based tools supply layout and a real probe; exceptional tools reuse the stage primitives. */
35
32
  export declare class ToolInstaller {
@@ -74,7 +71,7 @@ export declare class ToolInstaller {
74
71
  install(o: Record<string, unknown>): Promise<{
75
72
  tool: string;
76
73
  state: string;
77
- mode: "external" | "managed";
74
+ mode: "managed" | "external";
78
75
  installation: string;
79
76
  executable: string;
80
77
  components: {
@@ -82,7 +79,6 @@ export declare class ToolInstaller {
82
79
  };
83
80
  checks: Record<string, unknown>;
84
81
  }>;
85
- private verify;
86
82
  use<T>(action: (selection: SelectedTool) => Promise<T>): Promise<T>;
87
83
  selected(): Promise<SelectedTool>;
88
84
  doctor(): Promise<{
@@ -1,22 +1,10 @@
1
1
  import { analysisDirectory } from '../analysis-storage.js';
2
- import { mkdir, stat, rm, readdir, writeFile, readFile, realpath } from 'node:fs/promises';
3
- import { join, resolve, sep, dirname } from 'node:path';
4
- import { cacheArtifact, consumeArchive, extractArchive, fileSha256, archiveName } from './archives.js';
5
- import { atomicWrite, readJson, toolRoot, withToolLock, installationStage, removeInstallation, treeFingerprint, assertUnused, withToolUse } from './store.js';
2
+ import { mkdir, stat, rm, readdir, writeFile } from 'node:fs/promises';
3
+ import { join, resolve, dirname } from 'node:path';
4
+ import { cacheArtifact, consumeArchive, extractArchive, fileSha256 } from './archives.js';
5
+ import { atomicWrite, readJson, toolRoot, withToolLock, installationStage, removeInstallation, assertUnused, withToolUse } from './store.js';
6
6
  import { listProcesses } from './supervisor.js';
7
7
  import { digest, fail, text } from '../model.js';
8
- /** Read-only verification used by an owned child after the command owner has staged a runtime. */
9
- export async function verifyManagedInstallation(directory, tool, selected) {
10
- const root = join(toolRoot(directory, tool), 'installations', selected.id);
11
- if (selected.schema !== 1 || selected.tool !== tool || selected.mode !== 'managed' || selected.uninstalledAt || !/^[a-f0-9]{64}$/.test(selected.id) || await realpath(selected.root) !== await realpath(root) || !(await realpath(selected.executable)).startsWith(await realpath(root) + sep))
12
- fail('binding', 'Invalid managed tool installation receipt.');
13
- const ready = await readJson(join(root, 'ready.json'));
14
- const binding = (v) => { const { selectedAt, uninstalledAt, ...rest } = v; return rest; };
15
- if (!ready || digest(binding(ready)) !== digest(binding(selected)))
16
- fail('binding', 'Managed tool receipt differs from its verified installation.');
17
- if (await treeFingerprint(root) !== selected.fingerprint)
18
- fail('binding', 'Managed tool code differs from its verified installation.');
19
- }
20
8
  /** Standard archive-based tools supply layout and a real probe; exceptional tools reuse the stage primitives. */
21
9
  export class ToolInstaller {
22
10
  c;
@@ -45,7 +33,7 @@ export class ToolInstaller {
45
33
  }
46
34
  const stages = await readdir(join(this.root, 'stages')).catch(e => { if (e.code === 'ENOENT')
47
35
  return []; throw e; });
48
- const processes = (await listProcesses(this.directory, { tool: this.descriptor.id })).filter(r => !['exited', 'failed'].includes(r.state));
36
+ const processes = await listProcesses(this.directory, { tool: this.descriptor.id, active: true });
49
37
  return { retainedStages: stages.slice(0, 100), processes, tool: this.descriptor.id, state: present ? 'installed' : 'not_ready', mode: selected?.mode ?? 'unconfigured', installation: selected?.id, executable: selected?.executable, components: selected?.components ?? {}, lastProbe: selected?.lastProbe, recommended: 'managed' };
50
38
  }
51
39
  async download(offline = false, vendorDirect = false) {
@@ -61,82 +49,36 @@ export class ToolInstaller {
61
49
  fail('invalid', 'Choose --executable or --archive.');
62
50
  const external = o.executable ? resolve(this.c.cwd, text(o.executable, 4096)) : undefined, parts = external ? {} : this.descriptor.components(), consumed = {};
63
51
  for (const [id, artifact] of Object.entries(parts)) {
64
- const key = id === this.descriptor.primary ? 'archive' : id + 'Archive', checksum = id === this.descriptor.primary ? 'archiveSha256' : id + 'ArchiveSha256';
65
- if (o[checksum] && !o[key])
66
- fail('invalid', 'Archive checksum requires its archive path.');
67
- consumed[id] = o[key] ? await consumeArchive(resolve(this.c.cwd, text(o[key], 4096)), this.cache, artifact, o[checksum] === undefined ? undefined : text(o[checksum], 64), this.c.signal) : { path: await cacheArtifact(artifact, this.cache, this.c.fetch, this.c.signal, Boolean(o.offline), Boolean(o.vendorDirect)), artifact };
52
+ const key = id === this.descriptor.primary ? 'archive' : id + 'Archive';
53
+ consumed[id] = o[key] ? await consumeArchive(resolve(this.c.cwd, text(o[key], 4096)), this.cache, artifact, this.c.signal) : { path: await cacheArtifact(artifact, this.cache, this.c.fetch, this.c.signal, Boolean(o.offline), Boolean(o.vendorDirect)), artifact };
68
54
  }
69
55
  const components = Object.fromEntries(Object.entries(consumed).map(([id, v]) => [id, v.artifact.sha256]));
70
56
  const externalDigest = external ? await fileSha256(external, this.c.signal) : undefined;
71
57
  const externalInputs = external && this.descriptor.externalInputs ? await this.descriptor.externalInputs(external, this.c) : undefined;
72
- const noticeDigest = this.descriptor.noticeFiles ? digest(this.descriptor.noticeFiles) : undefined;
58
+ const notices = this.descriptor.noticeFiles?.(), noticeDigest = notices ? digest(notices) : undefined;
73
59
  const id = digest({ tool: this.descriptor.id, schema: 1, platform: process.platform, architecture: process.arch, external, externalDigest, components, ...(externalInputs ? { externalInputs } : {}), ...(noticeDigest ? { noticeDigest } : {}), ...(this.descriptor.preparationId ? { preparationId: this.descriptor.preparationId } : {}) });
74
- const rootsAt = (directory) => Object.fromEntries(Object.entries(consumed).map(([part, v]) => { archiveName(v.artifact.root); return [part, join(directory, part, v.artifact.root)]; }));
60
+ const rootsAt = (directory) => Object.fromEntries(Object.entries(consumed).map(([part, v]) => [part, join(directory, part, v.artifact.root)]));
75
61
  const selected = await installationStage(this.root, id, async (stage, installed) => {
76
62
  for (const [part, v] of Object.entries(consumed))
77
63
  await extractArchive(v.path, join(stage, part), v.artifact.format, this.c.signal);
78
64
  if (!external)
79
65
  await this.descriptor.prepare?.(rootsAt(stage), this.c);
80
66
  const execution = external ? await this.descriptor.prepareExternal?.(external, stage, this.c) : undefined;
81
- if (execution && !resolve(execution.executable).startsWith(resolve(stage) + sep))
82
- fail('binding', 'Prepared external execution must use owned staging.');
83
- for (const [name, body] of Object.entries(this.descriptor.noticeFiles ?? {})) {
84
- archiveName(name);
85
- if (!name || Buffer.byteLength(body) > 1024 ** 2)
86
- fail('configuration', 'Invalid bundled license notice.');
67
+ for (const [name, body] of Object.entries(notices ?? {})) {
87
68
  const destination = join(stage, name);
88
69
  await mkdir(dirname(destination), { recursive: true, mode: 0o700 });
89
70
  await writeFile(destination, body, { flag: 'wx', mode: 0o600 });
90
71
  }
91
72
  const stageLaunch = external ? { executable: external, arguments: [], environment: {} } : this.descriptor.launch(rootsAt(stage));
92
73
  const lastProbe = await this.descriptor.probe(execution ?? stageLaunch, this.c), launch = external ? stageLaunch : this.descriptor.launch(rootsAt(installed));
93
- const fingerprint = external ? await fileSha256(external, this.c.signal) : await treeFingerprint(stage);
94
- if (external && fingerprint !== externalDigest)
95
- fail('binding', 'External tool changed during installation.');
96
- if (externalInputs && digest(await this.descriptor.externalInputs(external, this.c)) !== digest(externalInputs))
97
- fail('binding', 'External tool family changed during installation.');
74
+ const fingerprint = externalDigest ?? id;
98
75
  const installedExecution = execution ? { ...execution, executable: join(installed, execution.executable.slice(stage.length + 1)) } : undefined;
99
- return { schema: 1, tool: this.descriptor.id, id, mode: external ? 'external' : 'managed', root: installed, ...launch, roots: rootsAt(installed), components, fingerprint, lastProbe, ...(externalInputs ? { externalInputs } : {}), ...(noticeDigest ? { noticeDigest } : {}), ...(installedExecution ? { execution: installedExecution, executionFingerprint: await treeFingerprint(stage) } : {}), selectedAt: new Date().toISOString() };
100
- }, value => this.verify(value), this.c.signal);
76
+ return { schema: 1, tool: this.descriptor.id, id, mode: external ? 'external' : 'managed', root: installed, ...launch, roots: rootsAt(installed), components, fingerprint, lastProbe, ...(externalInputs ? { externalInputs } : {}), ...(noticeDigest ? { noticeDigest } : {}), ...(installedExecution ? { execution: installedExecution } : {}), selectedAt: new Date().toISOString() };
77
+ }, undefined, this.c.signal);
101
78
  await atomicWrite(join(this.root, 'selection.json'), { ...selected, selectedAt: new Date().toISOString() });
102
79
  return { tool: this.descriptor.id, state: 'installed', mode: selected.mode, installation: id, executable: selected.executable, components, checks: selected.lastProbe };
103
80
  }, this.c.signal);
104
81
  }
105
- async verify(selected) {
106
- if (selected.schema !== 1 || selected.tool !== this.descriptor.id || !/^[a-f0-9]{64}$/.test(selected.id))
107
- fail('binding', 'Invalid tool installation receipt.');
108
- const root = join(this.root, 'installations', selected.id);
109
- if (await realpath(selected.root) !== await realpath(root) || selected.mode === 'managed' && !(await realpath(selected.executable)).startsWith(await realpath(root) + sep))
110
- fail('binding', 'Selected tool points outside its owned installation.');
111
- const ready = await readJson(join(root, 'ready.json'));
112
- const binding = (v) => { const { selectedAt, uninstalledAt, ...rest } = v; return rest; };
113
- if (!ready || digest(binding(ready)) !== digest(binding(selected)))
114
- fail('binding', 'Selected tool receipt differs from its verified installation.');
115
- if (this.descriptor.noticeFiles) {
116
- if (selected.noticeDigest !== digest(this.descriptor.noticeFiles))
117
- fail('binding', 'Bundled license notices changed; reinstall the selected tool.');
118
- for (const [name, body] of Object.entries(this.descriptor.noticeFiles)) {
119
- archiveName(name);
120
- try {
121
- if (await readFile(join(root, name), 'utf8') !== body)
122
- fail('binding', 'Installed license notice differs from its retained text.');
123
- }
124
- catch (error) {
125
- if (error.code === 'ENOENT')
126
- fail('binding', 'Installed license notice is missing.');
127
- throw error;
128
- }
129
- }
130
- }
131
- if (selected.mode === 'managed')
132
- await verifyManagedInstallation(this.directory, this.descriptor.id, selected);
133
- else if (await fileSha256(selected.executable, this.c.signal) !== selected.fingerprint)
134
- fail('binding', 'Selected tool code differs from its verified installation.');
135
- if (selected.execution && (!(await realpath(selected.execution.executable)).startsWith(await realpath(root) + sep) || await treeFingerprint(root) !== selected.executionFingerprint))
136
- fail('binding', 'Owned external-tool execution copy differs from its verified installation.');
137
- if (selected.mode === 'external' && this.descriptor.externalInputs && (!selected.externalInputs || digest(await this.descriptor.externalInputs(selected.executable, this.c)) !== digest(selected.externalInputs)))
138
- fail('binding', 'External tool family differs from its verified installation.');
139
- }
140
82
  async use(action) {
141
83
  const lease = await withToolUse(this.directory, this.descriptor.id, () => this.selected(), this.c.signal);
142
84
  try {
@@ -150,7 +92,6 @@ export class ToolInstaller {
150
92
  const selected = await this.receipt();
151
93
  if (!selected || selected.uninstalledAt)
152
94
  fail('configuration', 'Tool is not installed; run insight-cli ' + this.descriptor.id + ' install.');
153
- await this.verify(selected);
154
95
  return selected;
155
96
  }
156
97
  async doctor() {
@@ -168,12 +109,9 @@ export class ToolInstaller {
168
109
  fail('configuration', 'No selected tool installation exists.');
169
110
  await removeInstallation(this.root, selected.id);
170
111
  if (purgeCache)
171
- for (const sha of Object.values(selected.components)) {
172
- if (!/^[a-f0-9]{64}$/.test(sha))
173
- fail('binding', 'Invalid component digest.');
112
+ for (const sha of Object.values(selected.components))
174
113
  for (const extension of ['zip', 'tgz'])
175
114
  await rm(join(this.cache, sha + '.' + extension), { force: true });
176
- }
177
115
  await atomicWrite(join(this.root, 'selection.json'), { ...selected, uninstalledAt: new Date().toISOString() });
178
116
  return { tool: this.descriptor.id, state: 'uninstalled', externalInstallationPreserved: selected.mode === 'external', researchPreserved: true, materialsPreserved: true };
179
117
  }, this.c.signal);
@@ -1,20 +1,14 @@
1
1
  import { writeFile, realpath } from 'node:fs/promises';
2
2
  import { join, win32 } from 'node:path';
3
- import { execFile } from 'node:child_process';
4
- import { promisify } from 'node:util';
5
- const exec = promisify(execFile);
3
+ import { windowsHelperRun } from './windows-helper.js';
6
4
  /** The Windows java launcher uses ACP, while Java 21 javac reads UTF-8 @files. */
7
5
  export async function encodeJavaLauncherFile(value) {
8
6
  if (!/[^\x00-\x7f]/.test(value))
9
7
  return Buffer.from(value, 'ascii');
10
- // Fixed script; text travels over stdin, never through PowerShell's command parser.
11
- // Match the native launcher without silently replacing unmappable path characters.
12
- const script = '[Console]::InputEncoding=[Text.UTF8Encoding]::new($false,$true);$s=[Console]::In.ReadToEnd();$e=[Text.Encoding]::GetEncoding([Text.Encoding]::Default.CodePage,[Text.EncoderExceptionFallback]::new(),[Text.DecoderExceptionFallback]::new());[Console]::Out.Write([Convert]::ToBase64String($e.GetBytes($s)))';
13
- const pending = exec(join(process.env.SystemRoot ?? 'C:\\Windows', 'System32/WindowsPowerShell/v1.0/powershell.exe'), ['-NoProfile', '-NonInteractive', '-Command', script], { windowsHide: true, timeout: 15000, maxBuffer: Math.max(4096, Buffer.byteLength(value) * 4) });
14
- pending.child.stdin?.on('error', () => { });
15
- pending.child.stdin?.end(value, 'utf8');
8
+ // The packaged helper encodes stdin to the ANSI code page and fails on unmappable characters instead of
9
+ // silently replacing them, matching the native launcher.
16
10
  try {
17
- return Buffer.from((await pending).stdout.trim(), 'base64');
11
+ return await windowsHelperRun(['ansi-encode'], Buffer.from(value, 'utf8'), Math.max(4096, Buffer.byteLength(value) * 4));
18
12
  }
19
13
  catch {
20
14
  throw new Error('Java classpath cannot be encoded for the Windows launcher; no process was started. Inspect the retained run and the JDK system-code-page path restrictions.');
@@ -11,21 +11,15 @@ async function main() {
11
11
  throw Error('Invalid launch identity');
12
12
  const root = await realpath(directory), path = join(root, 'runtime/processes', id + '.json');
13
13
  const record = await readJson(path);
14
- if (!record || record.id !== id || record.pid || record.ownerPid !== process.ppid)
15
- throw Error('Launch owner changed');
14
+ if (!record)
15
+ throw Error('Launch record is missing');
16
16
  let input = '';
17
17
  for await (const b of createReadStream('', { fd: Number(fd), autoClose: true })) {
18
18
  input += b.toString();
19
19
  if (input.length > 4 * 1024 ** 2)
20
20
  throw Error('Launch input exceeds its bound');
21
21
  }
22
- // Factory's stable profile remains local while the complete runtime tree can be
23
- // an authorized analysis-storage alias. Child paths must still stay inside it.
24
- if (await realpath(String(record.root)) !== join(await realpath(join(root, 'runtime')), 'runs', id))
25
- throw Error('Launch storage changed');
26
22
  const plan = JSON.parse(input);
27
- if (plan.executable !== record.executable)
28
- throw Error('Launch executable changed');
29
23
  const identity = await processIdentity(process.pid);
30
24
  if (!identity)
31
25
  throw Error('Launch process identity unavailable');
@@ -20,6 +20,8 @@ export interface RunSpec {
20
20
  retainRawOutput?: boolean;
21
21
  /** Adapter's native helper constructor persists per-exec deadline receipts in the run root. */
22
22
  nativeChildDeadlines?: boolean;
23
+ /** Ask the tool to finish (SIGTERM) after this window; its own exit then completes the run. timeoutMs still bounds it. */
24
+ stopAfterMs?: number;
23
25
  /** Hold an authenticated borrowed Windows subject handle; never assign it to the owned job. */
24
26
  observedSubject?: {
25
27
  pid: number;
@@ -1,11 +1,10 @@
1
1
  import { writeFile } from 'node:fs/promises';
2
- import { join, isAbsolute, resolve } from 'node:path';
2
+ import { join, isAbsolute } from 'node:path';
3
3
  import { randomUUID } from 'node:crypto';
4
4
  import { performance } from 'node:perf_hooks';
5
5
  import { CliError } from '@eyeauras/cli-factory';
6
- import { atomicWrite, withToolUse, toolRoot, readJson, prepareRunRoot } from './store.js';
6
+ import { atomicWrite, holdToolUse, toolRoot, readJson, prepareRunRoot } from './store.js';
7
7
  import { launchProcess } from './supervisor.js';
8
- import { digest } from '../model.js';
9
8
  import { deadlineLaunch } from './deadline.js';
10
9
  import { windowsJobLaunch, windowsJobResult } from './windows-job.js';
11
10
  export async function runTool(c, spec) {
@@ -22,8 +21,15 @@ export async function runTool(c, spec) {
22
21
  const id = randomUUID(), root = join(directory, 'runtime/runs', id), path = join(directory, 'runtime/processes', id + '.json');
23
22
  const started = performance.now(), limit = spec.maxOutputBytes ?? 4 * 1024 ** 2;
24
23
  let child, outcome, truncated = false, bytes = 0;
25
- const stdout = [], stderr = [], record = { schema: 1, id, tool: spec.tool, role: spec.role, installation: spec.installation ?? 'probe', state: 'starting', executable: spec.executable, createdAt: new Date().toISOString(), root, ownerPid: process.pid, profileBinding: digest(resolve(directory)), gated: process.platform !== 'win32' && typeof process.execve === 'function', phase: 'reserved', ...(spec.session ? { session: spec.session } : {}), ...(spec.target ? { target: spec.target } : {}) };
26
- const lease = await withToolUse(directory, spec.tool, async () => { await prepareRunRoot(directory, id); }, c.signal);
24
+ const stdout = [], stderr = [], record = { schema: 1, id, tool: spec.tool, role: spec.role, installation: spec.installation ?? 'probe', state: 'starting', executable: spec.executable, createdAt: new Date().toISOString(), root, ownerPid: process.pid, gated: process.platform !== 'win32' && typeof process.execve === 'function', phase: 'reserved', ...(spec.session ? { session: spec.session } : {}), ...(spec.target ? { target: spec.target } : {}) };
25
+ const release = holdToolUse(directory, spec.tool);
26
+ try {
27
+ await prepareRunRoot(directory, id);
28
+ }
29
+ catch (error) {
30
+ release();
31
+ throw error;
32
+ }
27
33
  const environment = { PATH: c.environment.PATH ?? process.env.PATH, HOME: root, TMPDIR: root, ...(process.platform === 'win32' ? { SystemRoot: process.env.SystemRoot, WINDIR: process.env.WINDIR, ComSpec: process.env.ComSpec, TEMP: root, TMP: root, USERPROFILE: root, LOCALAPPDATA: root, APPDATA: root } : {}), ...spec.environment };
28
34
  const secrets = Object.entries(environment).filter(([key, value]) => /TOKEN|PASSWORD|SECRET|KEY/i.test(key) && value && value.length >= 4).map(([, v]) => v);
29
35
  const redact = (value) => secrets.reduce((text, secret) => text.split(secret).join('[redacted]'), value);
@@ -43,7 +49,7 @@ export async function runTool(c, spec) {
43
49
  retained = result;
44
50
  return result;
45
51
  };
46
- let timer, force, drain, hard, settled = false, abandon;
52
+ let timer, finish, force, drain, hard, settled = false, abandon;
47
53
  const signal = (name) => {
48
54
  if (!child?.pid || settled)
49
55
  return;
@@ -92,6 +98,10 @@ export async function runTool(c, spec) {
92
98
  aborted();
93
99
  timer = setTimeout(() => stop('timeout'), spec.timeoutMs ?? 120000);
94
100
  timer.unref();
101
+ if (spec.stopAfterMs) {
102
+ finish = setTimeout(() => signal('SIGTERM'), spec.stopAfterMs);
103
+ finish.unref();
104
+ }
95
105
  } });
96
106
  await Promise.race([child.toolClosed, new Promise((_ok, bad) => { abandon = bad; })]);
97
107
  settled = true;
@@ -101,7 +111,7 @@ export async function runTool(c, spec) {
101
111
  let exitCode = child.exitCode;
102
112
  if (spec.nativeDeadline && process.platform === 'win32' && !outcome) {
103
113
  try {
104
- const job = await windowsJobResult(root, id, child.pid, Boolean(spec.nativeRegistry));
114
+ const job = await windowsJobResult(root);
105
115
  exitCode = job.childExitCode;
106
116
  Object.assign(record, { windowsJob: job });
107
117
  if (job.phase !== 'completed')
@@ -160,6 +170,8 @@ export async function runTool(c, spec) {
160
170
  finally {
161
171
  if (timer)
162
172
  clearTimeout(timer);
173
+ if (finish)
174
+ clearTimeout(finish);
163
175
  if (force)
164
176
  clearTimeout(force);
165
177
  if (drain)
@@ -167,6 +179,6 @@ export async function runTool(c, spec) {
167
179
  if (hard)
168
180
  clearTimeout(hard);
169
181
  c.signal.removeEventListener('abort', aborted);
170
- lease.release();
182
+ release();
171
183
  }
172
184
  }
@@ -1,5 +1,4 @@
1
1
  export declare function atomicWrite(path: string, value: unknown): Promise<void>;
2
- /** Create new run folders through the physical runtime, retaining logical receipt identity. */
3
2
  export declare function prepareRunRoot(directory: string, id: string): Promise<void>;
4
3
  export declare function readJson<T>(path: string): Promise<T | undefined>;
5
4
  export declare function toolRoot(directory: string, tool: string): string;
@@ -7,11 +6,12 @@ export declare function toolRoot(directory: string, tool: string): string;
7
6
  export declare function withToolLock<T>(directory: string, tool: string, action: () => Promise<T>, signal?: AbortSignal): Promise<T>;
8
7
  export declare function toolProfileBusy(directory: string): boolean;
9
8
  export declare function toolUseCount(directory: string, tool: string): number;
9
+ /** Count a running use without the per-tool lock, so parallel uses never queue; `assertUnused` refuses while any is held. */
10
+ export declare function holdToolUse(directory: string, tool: string): () => void;
10
11
  export declare function withToolUse<T>(directory: string, tool: string, acquire: () => Promise<T>, signal?: AbortSignal): Promise<{
11
12
  value: T;
12
13
  release: () => void;
13
14
  }>;
14
15
  export declare function assertUnused(directory: string, tool: string): Promise<void>;
15
- export declare function installationStage<T>(root: string, id: string, prepare: (stage: string, installed: string) => Promise<T>, verify: (receipt: T) => Promise<void>, signal?: AbortSignal): Promise<T>;
16
+ export declare function installationStage<T>(root: string, id: string, prepare: (stage: string, installed: string) => Promise<T>, verify?: (receipt: T) => Promise<void>, signal?: AbortSignal): Promise<T>;
16
17
  export declare function removeInstallation(root: string, id: string): Promise<void>;
17
- export declare function treeFingerprint(root: string): Promise<string>;
@@ -1,14 +1,13 @@
1
- import { mkdir, open, rename, rm, readFile, readdir, lstat, realpath } from 'node:fs/promises';
2
- import { createReadStream, existsSync } from 'node:fs';
3
- import { dirname, basename, join, resolve, relative, sep } from 'node:path';
4
- import { randomUUID, createHash } from 'node:crypto';
1
+ import { mkdir, open, rename, rm, readFile, readdir, lstat } from 'node:fs/promises';
2
+ import { dirname, join, resolve } from 'node:path';
3
+ import { randomUUID } from 'node:crypto';
5
4
  import { AsyncLocalStorage } from 'node:async_hooks';
6
5
  import { CliError } from '@eyeauras/cli-factory';
7
6
  import { fail } from '../model.js';
8
7
  export async function atomicWrite(path, value) {
9
- const parent = await physicalDirectory(dirname(path)), target = join(parent, basename(path));
8
+ const parent = dirname(path);
10
9
  await mkdir(parent, { recursive: true, mode: 0o700 });
11
- const temporary = target + '.new-' + randomUUID(), file = await open(temporary, 'wx', 0o600);
10
+ const temporary = path + '.new-' + randomUUID(), file = await open(temporary, 'wx', 0o600);
12
11
  try {
13
12
  await file.writeFile(JSON.stringify(value, null, 2) + '\n');
14
13
  await file.sync();
@@ -16,7 +15,7 @@ export async function atomicWrite(path, value) {
16
15
  finally {
17
16
  await file.close();
18
17
  }
19
- await rename(temporary, target);
18
+ await rename(temporary, path);
20
19
  if (process.platform !== 'win32') {
21
20
  const handle = await open(parent, 'r');
22
21
  try {
@@ -27,22 +26,8 @@ export async function atomicWrite(path, value) {
27
26
  }
28
27
  }
29
28
  }
30
- async function physicalDirectory(path) {
31
- try {
32
- return await realpath(path);
33
- }
34
- catch (error) {
35
- if (error.code !== 'ENOENT' || dirname(path) === path)
36
- throw error;
37
- return join(await physicalDirectory(dirname(path)), basename(path));
38
- }
39
- }
40
- /** Create new run folders through the physical runtime, retaining logical receipt identity. */
41
29
  export async function prepareRunRoot(directory, id) {
42
- const runtime = join(directory, 'runtime');
43
- if (!existsSync(runtime))
44
- await mkdir(runtime, { recursive: true, mode: 0o700 });
45
- await mkdir(join(await realpath(runtime), 'runs', id), { recursive: true, mode: 0o700 });
30
+ await mkdir(join(directory, 'runtime', 'runs', id), { recursive: true, mode: 0o700 });
46
31
  }
47
32
  export async function readJson(path) { try {
48
33
  return JSON.parse(await readFile(path, 'utf8'));
@@ -82,18 +67,22 @@ export async function withToolLock(directory, tool, action, signal) {
82
67
  }
83
68
  export function toolProfileBusy(directory) { const prefix = resolve(directory) + '\0'; return [...queues.keys(), ...uses.keys()].some(k => k.startsWith(prefix)); }
84
69
  export function toolUseCount(directory, tool) { return uses.get(key(directory, tool)) ?? 0; }
70
+ /** Count a running use without the per-tool lock, so parallel uses never queue; `assertUnused` refuses while any is held. */
71
+ export function holdToolUse(directory, tool) {
72
+ const k = key(directory, tool);
73
+ uses.set(k, (uses.get(k) ?? 0) + 1);
74
+ let released = false;
75
+ return () => { if (released)
76
+ return; released = true; const n = (uses.get(k) ?? 1) - 1; if (n)
77
+ uses.set(k, n);
78
+ else
79
+ uses.delete(k); };
80
+ }
85
81
  export async function withToolUse(directory, tool, acquire, signal) {
86
82
  return withToolLock(directory, tool, async () => {
87
83
  const value = await acquire();
88
84
  signal?.throwIfAborted();
89
- const k = key(directory, tool);
90
- uses.set(k, (uses.get(k) ?? 0) + 1);
91
- let released = false;
92
- return { value, release() { if (released)
93
- return; released = true; const n = (uses.get(k) ?? 1) - 1; if (n)
94
- uses.set(k, n);
95
- else
96
- uses.delete(k); } };
85
+ return { value, release: holdToolUse(directory, tool) };
97
86
  }, signal);
98
87
  }
99
88
  export async function assertUnused(directory, tool) {
@@ -118,9 +107,6 @@ export async function assertUnused(directory, tool) {
118
107
  const { processStatus } = await import('./supervisor.js'), record = await processStatus(directory, name.slice(0, -5));
119
108
  if (['exited', 'failed'].includes(record.state))
120
109
  continue;
121
- // A moved collector's helper receipts cannot be inspected; its own PID says nothing about its helpers.
122
- if (record.phase === 'profile_binding_changed' && record.metadata?.nativeChildDeadlines === true)
123
- fail('busy', 'Tool has a moved collector whose native helpers cannot be inspected; inspect its retained records before changing installations.');
124
110
  if (record.phase === 'native_children_pending' || record.phase === 'native_children_unverified')
125
111
  fail('busy', 'Tool has an active or unverified native helper; inspect its retained records before changing installations.');
126
112
  if (!record.pid) {
@@ -146,12 +132,10 @@ export async function assertUnused(directory, tool) {
146
132
  }
147
133
  }
148
134
  export async function installationStage(root, id, prepare, verify, signal) {
149
- if (!/^[a-f0-9]{64}$/.test(id))
150
- fail('invalid', 'Invalid installation identity.');
151
135
  signal?.throwIfAborted();
152
136
  const installed = join(root, 'installations', id), receipt = await readJson(join(installed, 'ready.json'));
153
137
  if (receipt) {
154
- await verify(receipt);
138
+ await verify?.(receipt);
155
139
  return receipt;
156
140
  }
157
141
  const stage = join(root, 'stages', randomUUID());
@@ -190,51 +174,5 @@ export async function installationStage(root, id, prepare, verify, signal) {
190
174
  }
191
175
  }
192
176
  export async function removeInstallation(root, id) {
193
- if (!/^[a-f0-9]{64}$/.test(id))
194
- fail('binding', 'Invalid installation identity.');
195
- const path = join(root, 'installations', id);
196
- let actual;
197
- try {
198
- actual = await realpath(path);
199
- }
200
- catch (e) {
201
- if (e.code === 'ENOENT')
202
- return;
203
- throw e;
204
- }
205
- if (actual !== join(await realpath(root), 'installations', id))
206
- fail('binding', 'Owned installation path was replaced by an external link.');
207
- await rm(path, { recursive: true, force: true });
208
- }
209
- export async function treeFingerprint(root) {
210
- const hash = createHash('sha256'), canonicalRoot = await realpath(root);
211
- let count = 0;
212
- async function visit(path) {
213
- for (const name of (await readdir(path)).sort()) {
214
- if (path === root && name === 'ready.json')
215
- continue;
216
- const at = join(path, name), st = await lstat(at);
217
- if (++count > 100000)
218
- fail('limit', 'Tool installation exceeds its file bound.');
219
- hash.update(relative(root, at).replaceAll('\\', '/') + '\0');
220
- if (st.isDirectory())
221
- await visit(at);
222
- else if (st.isSymbolicLink()) {
223
- const destination = await realpath(at);
224
- if (!destination.startsWith(canonicalRoot + sep))
225
- fail('binding', 'Installed component link escapes its owned directory.');
226
- hash.update('link:' + relative(canonicalRoot, destination));
227
- }
228
- else if (st.isFile()) {
229
- const leaf = createHash('sha256');
230
- for await (const b of createReadStream(at))
231
- leaf.update(b);
232
- hash.update('file:' + st.size + ':' + leaf.digest('hex') + '\0');
233
- }
234
- else
235
- fail('binding', 'Unsupported tool installation entry.');
236
- }
237
- }
238
- await visit(root);
239
- return hash.digest('hex');
177
+ await rm(join(root, 'installations', id), { recursive: true, force: true });
240
178
  }
@@ -3,7 +3,6 @@ import type { ToolProcess } from './definition.js';
3
3
  export interface ProcessRecord extends ToolProcess {
4
4
  root: string;
5
5
  ownerPid: number;
6
- profileBinding: string;
7
6
  phase?: string;
8
7
  strongIdentity?: boolean;
9
8
  processGroup?: number;
@@ -26,25 +25,23 @@ export interface TrackedChild extends ChildProcess {
26
25
  toolClosed: Promise<void>;
27
26
  }
28
27
  export type OwnershipVerifier = (record: ProcessRecord) => Promise<boolean | undefined>;
29
- /**
30
- * The process a receipt recorded is gone from its PID, proved freshly and never from the receipt's stored state or
31
- * phase: no process holds the PID, or its holder has a different canonical birth. A child this owner still holds
32
- * alive is never gone. Grants no authority over the PID's current holder.
33
- */
34
- export declare function recordedProcessGone(directory: string, id: string): Promise<ProcessRecord | undefined>;
35
- /** Exactly what the receipt writer emits (`Date#toISOString`); impossible dates are not normalized into evidence. */
36
- export declare function validEnd(value: unknown): boolean;
37
28
  export declare function launchProcess(directory: string, spec: ProcessSpec, executable: string, args: string[], options?: SpawnOptions, control?: {
38
29
  id?: string;
39
30
  finalize?: boolean;
40
31
  onSpawn?: (child: TrackedChild) => void | Promise<void>;
41
32
  signal?: AbortSignal;
42
33
  }): Promise<TrackedChild>;
34
+ /** A receipt in `<directory>/runtime/processes` belongs to `<directory>`. */
43
35
  export declare function processStatus(directory: string, id: string, verify?: OwnershipVerifier): Promise<ProcessRecord>;
36
+ /**
37
+ * Receipts are filtered by their stored fields first; only the remaining ones are observed. With `active`, a receipt
38
+ * whose stored state is terminal is skipped unobserved, and only observed live or unverified processes are returned.
39
+ */
44
40
  export declare function listProcesses(directory: string, filter?: {
45
41
  tool?: string;
46
42
  session?: string;
47
43
  target?: string;
44
+ active?: boolean;
48
45
  }, verify?: OwnershipVerifier): Promise<ProcessRecord[]>;
49
46
  export declare function terminateProcess(directory: string, id: string, force: boolean, verify?: OwnershipVerifier, graceful?: (record: ProcessRecord) => Promise<void>): Promise<{
50
47
  process: string;
@@ -61,5 +58,3 @@ export declare function terminateProcess(directory: string, id: string, force: b
61
58
  session: string | undefined;
62
59
  target: string | undefined;
63
60
  }>;
64
- /** Migration/reconnection only: an adapter must authenticate a known existing tool before registration. */
65
- export declare function registerExistingProcess(directory: string, spec: ProcessSpec, executable: string, pid: number, verify: OwnershipVerifier): Promise<string>;