@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
package/dist/src/sdk.js CHANGED
@@ -3,7 +3,7 @@ import { sdkOperations } from './sdk-contracts.js';
3
3
  import { option, key, parsed, selectedOptions } from './arguments.js';
4
4
  import { scope, address, number } from './research.js';
5
5
  import { id, fail, object, text } from './model.js';
6
- import { verifyMutation } from './mutation-effects.js';
6
+ import { stat } from 'node:fs/promises';
7
7
  import { resolve } from 'node:path';
8
8
  export function sdkInputs(operation, p) {
9
9
  if (['type-structure', 'type-layout', 'type-settings'].includes(operation) && !/^\/(?:[^/\0]+\/)*[^/\0]+$/.test(String(p.path)))
@@ -104,22 +104,22 @@ export function sdkCommands(research) {
104
104
  sdkInputs(entry.operation, p);
105
105
  const api = research(c), operation = '/sdk/' + entry.operation;
106
106
  if (entry.operation === 'type-archive-import') {
107
- const archive = await api.workspace.artifacts.capture(resolve(c.cwd, String(p.input)), 'input');
108
- if (archive.size > 67108864)
107
+ const input = resolve(c.cwd, String(p.input));
108
+ if ((await stat(input)).size > 67108864)
109
109
  fail('limit', 'Type archive exceeds 64 MiB.');
110
110
  delete p.input;
111
- p.archive = archive;
111
+ p.input_path = input;
112
112
  }
113
113
  if (entry.write)
114
- return api.mutate(selected, operation, p, async () => ({}), o.requestId === undefined ? undefined : id(o.requestId, '--request-id'), (backend, snapshot, response) => verifyMutation(backend, snapshot, operation, p, response));
115
- const other = entry.pair ? { session: o.otherSession === undefined ? selected.session : id(o.otherSession), target: id(o.otherTarget) } : undefined;
114
+ return api.mutate(selected, operation, p);
115
+ // Without --other-target a comparison uses the version this working copy is based on.
116
+ const other = entry.pair ? o.otherTarget === undefined ? 'base' : { session: o.otherSession === undefined ? selected.session : id(o.otherSession), target: id(o.otherTarget) } : undefined;
116
117
  const value = object(other ? await api.crossRead(selected, other, operation, p) : await api.read(selected, operation, p));
117
118
  if (Buffer.byteLength(JSON.stringify(value)) > 1048576)
118
119
  fail('limit', 'SDK result exceeds 1 MiB; narrow the operation.');
119
120
  return { ...selected, ...(other ? { other } : {}), value };
120
121
  }, { permission: entry.write ? 'Destructive' : Permission.ReadOnly, options: [...selectedOptions, ...entry.params.map(option),
121
- ...(entry.pair ? [{ flags: '--other-target <id>', description: 'Second immutable target', required: true }, { flags: '--other-session <id>', description: 'Second session (default selected session)' }] : []),
122
- ...(entry.write ? [{ flags: '--request-id <id>', description: 'Retrieve this changing intent without repeating it' }] : [])] }));
122
+ ...(entry.pair ? [{ flags: '--other-target <id>', description: 'Second context target (default: compare with the base version of this working copy)' }, { flags: '--other-session <id>', description: 'Second session (default selected session)' }] : [])] }));
123
123
  }
124
124
  return [...groups].map(([name, children]) => command(name, name + ' native SDK workflows', children));
125
125
  }
@@ -1,6 +1,6 @@
1
1
  import { command, Permission } from '@eyeauras/cli-factory';
2
2
  import { join, resolve, dirname } from 'node:path';
3
- import { mkdir, lstat } from 'node:fs/promises';
3
+ import { mkdir } from 'node:fs/promises';
4
4
  import { ToolInstaller } from './tool-runtime/installer.js';
5
5
  import { defineTool, lifecycleCommands } from './tool-runtime/definition.js';
6
6
  import { catalogArtifact } from './tool-runtime/catalog.js';
@@ -108,8 +108,6 @@ export function sevenzipCommands(workspace) {
108
108
  }
109
109
  await mkdir(dirname(destination), { recursive: true, mode: 0o700 });
110
110
  const result = await invoke('recover', ['x', '-so', '-spd', '-bd', '-y', '-p', '--', input, entry.path], { maxOutputBytes: Math.max(65536, entry.size + 65536), outputFile: destination });
111
- if ((await lstat(destination)).size !== entry.size)
112
- fail('binding', 'Recovered file size differs from the inventory; retained partial output requires inspection.');
113
111
  files.push({ path: entry.path, size: entry.size, process: result.process });
114
112
  }
115
113
  return { ...base, state: 'extracted', outputDirectory: output, files, bytes, publication: 'ordinary files; no shared analysis merge' };
@@ -7,7 +7,6 @@ import { ToolInstaller } from './tool-runtime/installer.js';
7
7
  import { defineTool, lifecycleCommands } from './tool-runtime/definition.js';
8
8
  import { catalogArtifact } from './tool-runtime/catalog.js';
9
9
  import { runTool } from './tool-runtime/run.js';
10
- import { fileSha256 } from './tool-runtime/archives.js';
11
10
  import { fail, text, id } from './model.js';
12
11
  import { number } from './research.js';
13
12
  // Exact binary from the reviewed reproducible Linux source build.
@@ -54,8 +53,6 @@ export function straceCommands(workspace) {
54
53
  await mkdir(directory, { recursive: true, mode: 0o700 });
55
54
  await copyFile(input, subject, constants.COPYFILE_EXCL);
56
55
  await chmod(subject, 0o700);
57
- if (await fileSha256(subject) !== target.binarySha256)
58
- fail('binding', 'Owned ELF bytes differ from the immutable target.');
59
56
  return straceInstaller(c).use(async (selected) => {
60
57
  const result = await runTool(c, { tool: 'strace', role: 'trace', installation: selected.id, executable: selected.executable, arguments: [...plan.arguments, '--', subject, ...plan.programArguments], cwd: c.cwd, target: target.id, timeoutMs, nativeDeadline: true, metadata: { inputSha256: target.binarySha256, events: plan.events } }), lines = result.stderr.trimEnd().split(/\r?\n/);
61
58
  const base = { state: 'completed', target: target.id, inputSha256: target.binarySha256, process: result.process, elapsedMs: result.elapsedMs, diagnostics: result.diagnostics, events: plan.events, programStdout: result.stdout, coverage: 'Observed syscalls from one owned launch and its traced descendants. Native trace and program stderr share the stderr stream. Strings and category/path filters are bounded; unobserved operations are unknown. Application side effects require authorization; adjacent executable sidecars are not copied.' };
@@ -1,6 +1,6 @@
1
1
  import { type CommandContext } from '@eyeauras/cli-factory';
2
2
  import { type Research, type ResearchBackend } from './research.js';
3
- import type { Scope } from './workspace.js';
3
+ import type { Scope } from './core/coordinator.js';
4
4
  export declare const anchorAlgorithm = "raw-string-anchors-v1";
5
5
  export declare const anchorEncodings: readonly ["ascii", "utf16le"];
6
6
  type Encoding = typeof anchorEncodings[number];
@@ -28,8 +28,7 @@ export interface AnchorRequest {
28
28
  expectedView?: string;
29
29
  }
30
30
  export declare function anchorRequest(o: Record<string, unknown>, who: Scope): AnchorRequest;
31
- export declare function anchorResult(raw: unknown, r: AnchorRequest, modification: string): Record<string, unknown>;
32
- export declare function inspectAnchors(backend: ResearchBackend, who: Scope, r: AnchorRequest, view: string, observation: unknown, observe: () => Promise<unknown>): Promise<{
31
+ export declare function inspectAnchors(backend: ResearchBackend, who: Scope, r: AnchorRequest, view: string): Promise<{
33
32
  value: {
34
33
  view: {
35
34
  identity: string;
@@ -1,8 +1,7 @@
1
1
  import { command, Permission } from '@eyeauras/cli-factory';
2
2
  import { scope, number, address } from './research.js';
3
3
  import { selectedOptions } from './arguments.js';
4
- import { fail, object, digest, stable } from './model.js';
5
- import { parseDomainJson } from './json.js';
4
+ import { fail, object, stable } from './model.js';
6
5
  export const anchorAlgorithm = 'raw-string-anchors-v1';
7
6
  export const anchorEncodings = ['ascii', 'utf16le'];
8
7
  const defaults = { max_bytes: 4194304, max_candidates: 10000, timeout_seconds: 5, limit: 100 };
@@ -40,122 +39,30 @@ function query(raw) {
40
39
  return { text, encodings, start, end, cap };
41
40
  }
42
41
  function budgets(o, base = defaults) { return { max_bytes: number(o.maxBytes ?? base.max_bytes, 16777216, 32768), max_candidates: number(o.maxCandidates ?? base.max_candidates, 100000, 1), timeout_seconds: number(o.timeoutSeconds ?? base.timeout_seconds, 30, 1), limit: number(o.limit ?? base.limit, 1000, 1) }; }
43
- function frontier(raw, q) {
44
- const f = object(raw), at = hex(f.address);
45
- if (big(at) < big(q.start) || big(at) > big(q.end) || !q.encodings.includes(f.encoding))
46
- fail('invalid', 'String-anchor frontier is outside the query.');
47
- return { address: at, encoding: f.encoding };
48
- }
49
- function ordinal(f, q) { return big(f.address) * BigInt(q.encodings.length) + BigInt(q.encodings.indexOf(f.encoding)); }
50
42
  export function anchorRequest(o, who) {
51
43
  if (o.cursor !== undefined) {
52
44
  if (['text', 'encodings', 'scanFrom', 'scanThrough', 'maxStringBytes'].some(k => o[k] !== undefined))
53
45
  fail('invalid', 'Cursor excludes text, encodings, range and context-cap selectors.');
54
- if (typeof o.cursor !== 'string' || o.cursor.length > 16384 || !/^sa1\.[A-Za-z0-9_-]+$/.test(o.cursor))
55
- fail('invalid', 'Malformed string-anchor cursor.');
56
46
  let c;
57
47
  try {
58
- const encoded = o.cursor.slice(4), b = Buffer.from(encoded, 'base64url');
59
- if (b.toString('base64url') !== encoded)
60
- throw Error();
61
- c = object(parseDomainJson(b.toString('utf8')));
48
+ c = object(JSON.parse(Buffer.from(String(o.cursor).slice(4), 'base64url').toString('utf8')));
62
49
  }
63
50
  catch {
64
51
  fail('invalid', 'Malformed string-anchor cursor.');
65
52
  }
66
- if (c.version !== 1 || c.algorithm !== anchorAlgorithm || stable(c.scope) !== stable(who) || typeof c.view !== 'string' || !/^[a-f0-9]{64}$/.test(c.view))
67
- fail('invalid', 'Cursor scope, algorithm or view is incompatible.');
68
- const q = query(c.query), b = object(c.budgets);
69
- if (['max_bytes', 'max_candidates', 'timeout_seconds', 'limit'].some(k => !Number.isSafeInteger(b[k])))
70
- fail('invalid', 'Malformed cursor budgets.');
71
- return { query: q, from: frontier(c.next, q), expectedView: c.view, budgets: budgets(o, budgets({ maxBytes: b.max_bytes, maxCandidates: b.max_candidates, timeoutSeconds: b.timeout_seconds, limit: b.limit })) };
53
+ return { query: c.query, from: c.next, expectedView: String(c.view), budgets: budgets(o, object(c.budgets)) };
72
54
  }
73
55
  if (typeof o.text !== 'string' || typeof o.encodings !== 'string' || typeof o.scanFrom !== 'string' || typeof o.scanThrough !== 'string')
74
56
  fail('invalid', 'Supply --text, --encodings, --scan-from and --scan-through, or --cursor.');
75
- const q = query({ text: o.text, encodings: o.encodings.split(',').map(x => x.trim()), start: o.scanFrom, end: o.scanThrough, cap: o.maxStringBytes ?? 1024 });
57
+ const q = query({ text: o.text, encodings: o.encodings.trim() === 'both' ? ['ascii', 'utf16le'] : o.encodings.split(',').map(x => x.trim()), start: o.scanFrom, end: o.scanThrough, cap: o.maxStringBytes ?? 1024 });
76
58
  return { query: q, from: { address: q.start, encoding: q.encodings[0] }, budgets: budgets(o) };
77
59
  }
78
- function decoded(raw, e) {
79
- if (e === 'ascii')
80
- return raw.some(x => x > 127) ? null : raw.toString('ascii');
81
- try {
82
- return new TextDecoder('utf-16le', { fatal: true, ignoreBOM: true }).decode(raw);
83
- }
84
- catch {
85
- return null;
86
- }
87
- }
88
- export function anchorResult(raw, r, modification) {
89
- const v = object(raw), s = object(v.scan), q = r.query, b = r.budgets;
90
- if (v.algorithm !== anchorAlgorithm || stable(v.encodings) !== stable(q.encodings) || v.modification !== modification) {
91
- if (typeof v.modification === 'string' && v.modification !== modification)
92
- fail('binding', 'Native view changed during string-anchor scan.', { reason: 'changed_view' });
93
- fail('partial', 'Malformed string-anchor protocol facts.');
94
- }
95
- if (!Array.isArray(v.matches) || v.matches.length > b.limit || stable(s.from) !== stable(r.from) || s.through !== q.end || typeof s.complete !== 'boolean' || s.complete !== (s.reason === 'exhausted') || !['exhausted', 'byte_limit', 'candidate_limit', 'timeout', 'result_limit'].includes(String(s.reason)))
96
- fail('partial', 'Malformed string-anchor coverage.');
97
- for (const k of ['bytesRead', 'testedPairs', 'candidates'])
98
- if (!Number.isSafeInteger(s[k]) || Number(s[k]) < 0)
99
- fail('partial', 'Malformed string-anchor counters.');
100
- if (Number(s.bytesRead) > b.max_bytes || Number(s.testedPairs) > Number(s.bytesRead) * q.encodings.length || Number(s.candidates) > b.max_candidates || Number(s.candidates) < v.matches.length || Number(s.candidates) > Number(s.testedPairs) + 1 || !Number.isFinite(s.elapsedMs) || Number(s.elapsedMs) < 0)
101
- fail('partial', 'Inconsistent string-anchor budgets.');
102
- const next = s.complete ? null : frontier(s.next, q);
103
- if (s.complete && s.next !== null || next && ordinal(next, q) < ordinal(r.from, q) || next && BigInt(Number(s.testedPairs)) > ordinal(next, q) - ordinal(r.from, q))
104
- fail('partial', 'String-anchor frontier changed.');
105
- if (next && ordinal(next, q) === ordinal(r.from, q) && s.reason !== 'timeout')
106
- fail('partial', 'String-anchor scan made no progress despite its minimum work budget.');
107
- let previous = ordinal(r.from, q) - 1n;
108
- for (const item of v.matches) {
109
- const row = object(item), at = hex(row.matchAddress), encoding = row.encoding;
110
- if (!q.encodings.includes(encoding))
111
- fail('partial', 'Unknown string-anchor encoding.');
112
- const pair = { address: at, encoding }, order = ordinal(pair, q), needle = bytes(q.text, encoding), unit = encoding === 'ascii' ? 1 : 2, l = object(row.literalCandidate);
113
- if (order <= previous || order < ordinal(r.from, q) || next && order >= ordinal(next, q) || big(at) + BigInt(needle.length - 1) > big(q.end) || row.matchByteLength !== needle.length)
114
- fail('partial', 'String-anchor pair/order changed.');
115
- previous = order;
116
- if (typeof l.textBytes !== 'string' || !/^(?:[a-f0-9]{2})+$/.test(l.textBytes) || l.textBytes.length > q.cap * 2)
117
- fail('partial', 'String-anchor context bytes are missing or unbounded.');
118
- const data = Buffer.from(l.textBytes, 'hex'), from = hex(l.textFrom), offset = big(at) - big(from), left = l.start === null ? null : hex(l.start), right = l.terminatorAddress === null ? null : hex(l.terminatorAddress);
119
- if (offset < 0n || offset > BigInt(q.cap) || Number(offset) % unit || data.length % unit || l.textByteLength !== data.length || big(from) < big(q.start) || big(from) + BigInt(data.length - 1) > big(q.end) || !data.subarray(Number(offset), Number(offset) + needle.length).equals(needle))
120
- fail('partial', 'String-anchor preview does not contain its byte match.');
121
- for (let i = 0; i < data.length; i += unit)
122
- if (data[i] === 0 && (unit === 1 || data[i + 1] === 0))
123
- fail('partial', 'String-anchor preview crossed a NUL boundary.');
124
- const boundaries = ['nul', 'range_edge', 'memory_edge', 'string_limit'];
125
- if (!boundaries.includes(String(l.leftBoundary)) || !boundaries.includes(String(l.rightBoundary)) || (l.leftBoundary === 'nul') !== (left !== null) || (l.rightBoundary === 'nul') !== (right !== null))
126
- fail('partial', 'String-anchor boundary facts changed.');
127
- if (left !== null && (big(left) > big(at) || big(left) < big(q.start) + BigInt(unit) || big(left) > big(from) || row.matchOffsetBytes !== Number(big(at) - big(left)) || Number(big(at) - big(left)) % unit || Number(big(at) - big(left)) > q.cap - needle.length) || left === null && row.matchOffsetBytes !== null)
128
- fail('partial', 'Invalid candidate start/offset.');
129
- if (right !== null && (big(right) < big(at) + BigInt(needle.length) || big(right) + BigInt(unit - 1) > big(q.end) || big(right) < big(from) + BigInt(data.length) || Number(big(right) - big(at) - BigInt(needle.length)) % unit || Number(big(right) - big(at) - BigInt(needle.length)) > q.cap - needle.length))
130
- fail('partial', 'Invalid candidate terminator.');
131
- const bounded = left !== null && right !== null, total = bounded ? Number(big(right) - big(left)) : null, text = decoded(data, encoding), complete = bounded && total <= q.cap && text !== null;
132
- const reason = complete ? 'complete' : total !== null && total > q.cap || l.leftBoundary === 'string_limit' || l.rightBoundary === 'string_limit' ? 'string_limit' : !bounded ? 'missing_boundary' : 'invalid_encoding';
133
- if (l.boundariesComplete !== bounded || l.byteLength !== total || l.text !== text || l.decoding !== (text === null ? 'invalid' : 'valid') || l.complete !== complete || l.reason !== reason || complete && (from !== left || data.length !== total))
134
- fail('partial', 'Inconsistent string-anchor context/decoding facts.');
135
- }
136
- if (Buffer.byteLength(JSON.stringify(v)) > 1000000)
137
- fail('limit', 'String-anchor native response exceeds its envelope reserve.');
138
- return v;
139
- }
140
- export async function inspectAnchors(backend, who, r, view, observation, observe) {
60
+ export async function inspectAnchors(backend, who, r, view) {
141
61
  if (r.expectedView !== undefined && r.expectedView !== view)
142
62
  fail('binding', 'String-anchor continuation view changed.', { reason: 'changed_view' });
143
- const modification = object(observation).modification;
144
- if (typeof modification !== 'string')
145
- fail('unsupported', 'String anchors require guarded native observations.');
146
63
  const q = r.query;
147
- let raw;
148
- try {
149
- raw = await backend.call(who, '/insight/string-anchors/v1', { text: q.text, encodings: q.encodings.join(','), scan_from: q.start, scan_through: q.end, resume_address: r.from.address, resume_encoding: r.from.encoding, max_string_bytes: q.cap, ...r.budgets });
150
- }
151
- catch (error) {
152
- if (digest(observation) !== digest(await observe()))
153
- fail('binding', 'Native view changed during string-anchor scan.', { reason: 'changed_view' });
154
- throw error;
155
- }
156
- if (digest(observation) !== digest(await observe()))
157
- fail('binding', 'Native view changed during string-anchor scan.', { reason: 'changed_view' });
158
- const value = anchorResult(raw, r, modification), cursor = value.scan && object(value.scan).complete ? null : 'sa1.' + Buffer.from(stable({ version: 1, algorithm: anchorAlgorithm, scope: who, query: q, next: object(value.scan).next, view, budgets: r.budgets })).toString('base64url');
64
+ const raw = await backend.call(who, '/insight/string-anchors/v1', { text: q.text, encodings: q.encodings.join(','), scan_from: q.start, scan_through: q.end, resume_address: r.from.address, resume_encoding: r.from.encoding, max_string_bytes: q.cap, ...r.budgets });
65
+ const value = object(raw), cursor = object(value.scan).complete ? null : 'sa1.' + Buffer.from(stable({ version: 1, algorithm: anchorAlgorithm, scope: who, query: q, next: object(value.scan).next, view, budgets: r.budgets })).toString('base64url');
159
66
  const result = { ...who, value: { ...value, view: { identity: view }, cursor } };
160
67
  if (Buffer.byteLength(JSON.stringify(result)) > 1048576)
161
68
  fail('limit', 'String-anchor response exceeds one MiB.');
@@ -164,7 +71,7 @@ export async function inspectAnchors(backend, who, r, view, observation, observe
164
71
  export function stringAnchorCommands(research) {
165
72
  return [command('strings', 'String research', [command('anchors', 'Find raw literal byte hits and separate bounded NUL-delimited candidate context', ({ options: o }, c) => { const who = scope(o); return research(c).stringAnchors(who, anchorRequest(o, who)); }, { permission: Permission.ReadOnly, options: [...selectedOptions,
166
73
  { flags: '--text <literal>', description: 'Case-sensitive literal, 1–256 UTF-16 units, no NUL' },
167
- { flags: '--encodings <encodings>', description: 'Explicit ascii, utf16le, or both; no alignment assumption' },
74
+ { flags: '--encodings <encodings>', description: "ascii, utf16le, ascii,utf16le or 'both'; no alignment assumption" },
168
75
  { flags: '--scan-from <address>', description: 'Inclusive range start; context stays inside the range' },
169
76
  { flags: '--scan-through <address>', description: 'Inclusive range end; the whole needle must fit' },
170
77
  { flags: '--max-string-bytes <count>', description: 'Even candidate/preview payload cap 16–8192, default 1024' },
@@ -1,11 +1,12 @@
1
- /** Public text coordinates are Unicode code points, never native bytes or UTF-16 halves. */
2
- export declare function textWindow(source: string, limit: number, offset: number, sourceTruncated?: boolean): {
3
- content: string;
4
- textSha256: string;
1
+ /** Public text coordinates are Unicode code points, never native bytes or UTF-16 halves. `hash` adds the text's SHA-256 (saved-file names). */
2
+ export declare function textWindow(source: string, limit: number, offset: number, sourceTruncated?: boolean, hash?: boolean): {
5
3
  totalCharacters: number;
6
4
  limit: number;
7
5
  offset: number;
8
6
  sourceTruncated: boolean;
9
7
  truncated: boolean;
10
8
  coordinates: string;
9
+ textSha256?: string | undefined;
10
+ content: string;
11
+ returnedCharacters: number;
11
12
  };
@@ -1,6 +1,6 @@
1
1
  import { createHash } from 'node:crypto';
2
- /** Public text coordinates are Unicode code points, never native bytes or UTF-16 halves. */
3
- export function textWindow(source, limit, offset, sourceTruncated = false) {
4
- const characters = Array.from(source);
5
- return { content: characters.slice(offset, offset + limit).join(''), textSha256: createHash('sha256').update(source).digest('hex'), totalCharacters: characters.length, limit, offset, sourceTruncated, truncated: sourceTruncated || offset + limit < characters.length, coordinates: 'Unicode characters in the returned native text; hash binds that text, which may itself be a truncated prefix' };
2
+ /** Public text coordinates are Unicode code points, never native bytes or UTF-16 halves. `hash` adds the text's SHA-256 (saved-file names). */
3
+ export function textWindow(source, limit, offset, sourceTruncated = false, hash = true) {
4
+ const characters = Array.from(source), selected = characters.slice(offset, offset + limit);
5
+ return { content: selected.join(''), returnedCharacters: selected.length, ...(hash ? { textSha256: createHash('sha256').update(source).digest('hex') } : {}), totalCharacters: characters.length, limit, offset, sourceTruncated, truncated: sourceTruncated || offset + limit < characters.length, coordinates: 'Unicode characters in the returned native text' + (hash ? '; hash binds that text,' : ',') + ' which may itself be a truncated prefix' };
6
6
  }
@@ -4,7 +4,7 @@ export declare function archiveName(name: string): string;
4
4
  export declare function extractArchive(file: string, destination: string, format: 'tgz' | 'zip', signal?: AbortSignal): Promise<void>;
5
5
  export declare function cacheArtifact(artifact: ToolArtifact, cache: string, fetcher: typeof fetch, signal: AbortSignal, offline?: boolean, vendorDirect?: boolean): Promise<string>;
6
6
  /** Consume local input once; extraction never races later edits to the caller's archive. */
7
- export declare function consumeArchive(path: string, cache: string, artifact: ToolArtifact, checksum?: string, signal?: AbortSignal): Promise<{
7
+ export declare function consumeArchive(path: string, cache: string, artifact: ToolArtifact, signal?: AbortSignal): Promise<{
8
8
  path: string;
9
9
  artifact: ToolArtifact;
10
10
  }>;
@@ -1,5 +1,5 @@
1
1
  import { createHash, randomUUID } from 'node:crypto';
2
- import { createReadStream, createWriteStream, constants } from 'node:fs';
2
+ import { createReadStream, createWriteStream } from 'node:fs';
3
3
  import { mkdir, open, rename, rm, lstat } from 'node:fs/promises';
4
4
  import { dirname, join, posix } from 'node:path';
5
5
  import { pipeline } from 'node:stream/promises';
@@ -22,7 +22,7 @@ export async function extractArchive(file, destination, format, signal) {
22
22
  fail('limit', 'Runtime archive exceeds extraction bounds.'); };
23
23
  if (format === 'tgz') {
24
24
  let unsafe;
25
- await readTar(file, tar.t({ strict: true, filter: (path, entry) => {
25
+ await readTar(file, tar.x({ cwd: destination, strict: true, preserveOwner: false, noChmod: false, filter: (path, entry) => {
26
26
  try {
27
27
  if (!('type' in entry))
28
28
  fail('invalid', 'Unsupported runtime archive metadata.');
@@ -44,10 +44,9 @@ export async function extractArchive(file, destination, format, signal) {
44
44
  unsafe ??= error;
45
45
  return false;
46
46
  }
47
- } }), 'end', signal);
47
+ } }), 'close', signal);
48
48
  if (unsafe)
49
49
  throw unsafe;
50
- await readTar(file, tar.x({ cwd: destination, strict: true, preserveOwner: false, noChmod: false }), 'close', signal);
51
50
  return;
52
51
  }
53
52
  const archive = await new Promise((ok, bad) => zip.open(file, { lazyEntries: true, strictFileNames: true }, (e, z) => e ? bad(e) : ok(z)));
@@ -81,10 +80,8 @@ export async function cacheArtifact(artifact, cache, fetcher, signal, offline =
81
80
  await mkdir(cache, { recursive: true, mode: 0o700 });
82
81
  const path = join(cache, artifact.sha256 + '.' + artifact.format);
83
82
  try {
84
- const cached = await lstat(path);
85
- if (cached.isFile() && (artifact.size === undefined || cached.size === artifact.size) && await fileSha256(path, signal) === artifact.sha256)
86
- return path;
87
- fail('binding', 'Cached runtime archive failed its SHA256 check; remove the corrupt cache entry before retrying.');
83
+ await lstat(path);
84
+ return path;
88
85
  }
89
86
  catch (error) {
90
87
  if (error.code !== 'ENOENT')
@@ -100,13 +97,12 @@ export async function cacheArtifact(artifact, cache, fetcher, signal, offline =
100
97
  if (!response.ok || !response.body)
101
98
  fail('download', 'Pinned runtime download failed.', { artifact: artifact.name, status: response.status });
102
99
  let size = 0;
103
- const hash = createHash('sha256'), handle = await open(temporary, 'wx', 0o600);
100
+ const handle = await open(temporary, 'wx', 0o600);
104
101
  try {
105
102
  for await (const chunk of response.body) {
106
103
  signal.throwIfAborted();
107
104
  if ((size += chunk.byteLength) > (artifact.size ?? 2 * 1024 ** 3))
108
105
  fail('limit', 'Runtime download exceeds two GiB.');
109
- hash.update(chunk);
110
106
  await handle.writeFile(chunk);
111
107
  }
112
108
  await handle.sync();
@@ -116,10 +112,8 @@ export async function cacheArtifact(artifact, cache, fetcher, signal, offline =
116
112
  }
117
113
  if (artifact.size !== undefined && size !== artifact.size)
118
114
  fail('binding', 'Downloaded runtime archive has an unexpected size.');
119
- if (hash.digest('hex') !== artifact.sha256)
120
- fail('binding', 'Downloaded runtime archive failed its pinned SHA256 check.');
121
115
  // Windows can briefly deny replacement while another downloader publishes the same key.
122
- // Retry the atomic rename only; never unlink the verified destination to make room.
116
+ // Retry the atomic rename only; never unlink the published destination to make room.
123
117
  for (let attempt = 0;; attempt++) {
124
118
  signal.throwIfAborted();
125
119
  try {
@@ -156,9 +150,9 @@ async function readTar(file, parser, event, signal) {
156
150
  });
157
151
  }
158
152
  /** Consume local input once; extraction never races later edits to the caller's archive. */
159
- export async function consumeArchive(path, cache, artifact, checksum, signal) {
160
- const { realpath, stat } = await import('node:fs/promises');
161
- const source = await realpath(path), input = await open(source, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0)), temporary = join(cache, 'local.partial-' + randomUUID());
153
+ export async function consumeArchive(path, cache, artifact, signal) {
154
+ const { realpath } = await import('node:fs/promises');
155
+ const source = await realpath(path), input = await open(source, 'r'), temporary = join(cache, 'local.partial-' + randomUUID());
162
156
  try {
163
157
  const metadata = await input.stat();
164
158
  if (!metadata.isFile() || metadata.size > 2 * 1024 ** 3)
@@ -180,8 +174,6 @@ export async function consumeArchive(path, cache, artifact, checksum, signal) {
180
174
  await file.close();
181
175
  }
182
176
  const sha256 = hash.digest('hex');
183
- if (checksum !== undefined && checksum.toLowerCase() !== sha256)
184
- fail('binding', 'Local runtime archive differs from its expected SHA256.');
185
177
  const handle = await open(temporary, 'r'), magic = Buffer.alloc(2);
186
178
  try {
187
179
  await handle.read(magic, 0, 2, 0);
@@ -191,8 +183,7 @@ export async function consumeArchive(path, cache, artifact, checksum, signal) {
191
183
  }
192
184
  const format = magic.toString('hex') === '504b' ? 'zip' : 'tgz', owned = join(cache, sha256 + '.' + format);
193
185
  try {
194
- if (await fileSha256(owned) !== sha256)
195
- fail('binding', 'Existing local-archive cache is corrupt.');
186
+ await lstat(owned);
196
187
  }
197
188
  catch (e) {
198
189
  if (e.code !== 'ENOENT')
@@ -4,10 +4,7 @@ const catalog = JSON.parse(readFileSync(new URL('../../../runtime/tool-catalog.j
4
4
  /** Expected bytes come from the installed package, never a replaceable remote manifest. */
5
5
  export function catalogArtifact(sha256) {
6
6
  const a = catalog[sha256];
7
- const dnspy = a?.url === 'https://github.com/dnSpyEx/dnSpy/releases/download/v6.6.0/dnSpy-net-win64.zip' && a.sha256 === '8ed48f165dc355e869f3a0037ad4f9216147f995a5ae0258b296eeef1f73aab0' && a.delivery?.publisher === 'dnSpyEx' && a.delivery.termsUrl === 'https://visualstudio.microsoft.com/license-terms/mlt552233/';
8
- const microsoft = a?.delivery?.publisher === 'Microsoft' && new URL(a.delivery.termsUrl).hostname === 'learn.microsoft.com' && new URL(a.delivery.termsUrl).protocol === 'https:' && new URL(a.url).protocol === 'https:' && ['download.sysinternals.com', 'windbg.download.prss.microsoft.com'].includes(new URL(a.url).hostname);
9
- const vendor = a?.delivery?.kind === 'vendor-direct' && Boolean(a.delivery.reason) && (dnspy || microsoft);
10
- if (!a || a.sha256 !== sha256 || !(a.url.startsWith('https://github.com/iXab3r/insight-cli/releases/download/tool-') || vendor) || !Number.isSafeInteger(a.size) || a.size < 1)
11
- fail('binding', 'Pinned tool distribution is absent or invalid in the retained catalog.');
7
+ if (!a)
8
+ fail('binding', 'Pinned tool distribution is absent from the packaged catalog.');
12
9
  return { ...a };
13
10
  }
@@ -14,9 +14,7 @@ export function toolProcessCommands(hooks = {}, metadata = []) {
14
14
  { flags: '--offset <count>', description: 'Skip records before this page', defaultValue: 0, parse: v => number(v, 2147483647) }],
15
15
  async run({ options: o }, c) {
16
16
  await discover(c);
17
- let items = await listProcesses(c.appArguments.AppDataDirectory, { tool: o.tool === undefined ? undefined : text(o.tool, 64), session: o.session === undefined ? undefined : text(o.session, 128), target: o.target === undefined ? undefined : text(o.target, 128) }, verifier(c));
18
- if (!o.all)
19
- items = items.filter(r => !['exited', 'failed'].includes(r.state));
17
+ const items = await listProcesses(c.appArguments.AppDataDirectory, { tool: o.tool === undefined ? undefined : text(o.tool, 64), session: o.session === undefined ? undefined : text(o.session, 128), target: o.target === undefined ? undefined : text(o.target, 128), active: !o.all }, verifier(c));
20
18
  const limit = number(o.limit, 1000, 1), offset = number(o.offset, 2147483647);
21
19
  return { items: items.slice(offset, offset + limit), total: items.length, limit, offset, truncated: items.length > offset + limit };
22
20
  },
@@ -1,14 +1,13 @@
1
1
  import { fileURLToPath } from 'node:url';
2
2
  import { CliError } from '@eyeauras/cli-factory';
3
- import { fileSha256 } from './archives.js';
4
3
  import { isAbsolute } from 'node:path';
5
4
  /** For reviewed native helper execs started inside an adapter worker, never an external target. */
6
5
  export async function inheritedDeadlineEnvironment(deadlineUnixSeconds, receipts) {
7
6
  if (process.platform !== 'darwin' || process.arch !== 'arm64' || !Number.isInteger(deadlineUnixSeconds) || deadlineUnixSeconds <= Date.now() / 1000 || deadlineUnixSeconds > Date.now() / 1000 + 600 || !isAbsolute(receipts))
8
7
  throw new CliError('Invalid inherited native deadline.', { code: 'tool.configuration' });
9
8
  const library = fileURLToPath(new URL('../../../runtime/native/deadline-alarm-darwin-universal.dylib', import.meta.url));
10
- if (library.includes(':') || await fileSha256(library) !== 'cd5ebd65aa419b79cb327f2ae872f98f3fd222b93049c909e409776eab65b8ef')
11
- throw new CliError('Inherited deadline library differs from its reviewed build or has an unsupported loader path.', { code: 'tool.binding' });
9
+ if (library.includes(':'))
10
+ throw new CliError('Inherited deadline library has an unsupported loader path.', { code: 'tool.binding' });
12
11
  return { DYLD_INSERT_LIBRARIES: library, INSIGHT_NATIVE_DEADLINE_UNIX_SECONDS: String(deadlineUnixSeconds), INSIGHT_NATIVE_DEADLINE_RECEIPTS: receipts };
13
12
  }
14
13
  /** Internal, first-party exec helper. No service or timer in the owner is needed after exec. */
@@ -17,8 +16,6 @@ export async function deadlineLaunch(executable, args, timeoutMs) {
17
16
  if (!Number.isInteger(timeoutMs) || timeoutMs < 1000 || timeoutMs > 600000)
18
17
  throw new CliError('Native deadline must be 1–600 seconds.', { code: 'tool.configuration' });
19
18
  const helper = fileURLToPath(new URL('../../../runtime/native/child-deadline-linux-x64', import.meta.url));
20
- if (await fileSha256(helper) !== 'e070e2de9a21aea78f224062877cdc0264be11229af314d3b88ff3b6bd77e26f')
21
- throw new CliError('Packaged Linux launcher differs from its reviewed build.', { code: 'tool.binding' });
22
19
  return { executable: helper, arguments: [String(Math.ceil(timeoutMs / 1000)), String(process.pid), executable, ...args] };
23
20
  }
24
21
  if (process.platform !== 'darwin' || process.arch !== 'arm64')
@@ -26,7 +23,5 @@ export async function deadlineLaunch(executable, args, timeoutMs) {
26
23
  if (!Number.isInteger(timeoutMs) || timeoutMs < 1000 || timeoutMs > 600000)
27
24
  throw new CliError('Native deadline must be between one and 600 seconds.', { code: 'tool.configuration' });
28
25
  const helper = fileURLToPath(new URL('../../../runtime/native/deadline-exec-darwin-arm64', import.meta.url));
29
- if (await fileSha256(helper) !== '32c146075d1c83422b068eeedd4a244d5e30cb768b279b185756c5d3b8008d88')
30
- throw new CliError('Packaged native deadline differs from its reviewed build.', { code: 'tool.binding' });
31
26
  return { executable: helper, arguments: [String(Math.ceil(timeoutMs / 1000)), '--', executable, ...args] };
32
27
  }
@@ -1,40 +1,10 @@
1
1
  import { command, Permission } from '@eyeauras/cli-factory';
2
- import { fail } from '../model.js';
3
2
  /** Definitions are data/hooks. Factory remains the only parser, permission and output owner. */
4
- export function defineTool(value) {
5
- if (!/^[a-z][a-z0-9-]*$/.test(value.id))
6
- fail('invalid', 'Invalid tool name.');
7
- const components = new Map(value.components.map(item => [item.id, item]));
8
- if (components.size !== value.components.length)
9
- fail('invalid', 'Duplicate tool component.');
10
- const done = new Set(), pending = new Set();
11
- function visit(id) {
12
- const component = components.get(id);
13
- if (!component)
14
- fail('invalid', 'Unknown tool dependency.');
15
- if (pending.has(id))
16
- fail('invalid', 'Cyclic tool dependency.');
17
- if (done.has(id))
18
- return;
19
- pending.add(id);
20
- for (const dependency of component.dependencies ?? [])
21
- visit(dependency);
22
- pending.delete(id);
23
- done.add(id);
24
- for (const artifact of component.artifacts) {
25
- if (!/^[a-f0-9]{64}$/.test(artifact.sha256) || new URL(artifact.url).protocol !== 'https:')
26
- fail('invalid', 'Tool artifact requires HTTPS and a pinned SHA256.');
27
- }
28
- }
29
- for (const id of components.keys())
30
- visit(id);
31
- return value;
32
- }
3
+ export function defineTool(value) { return value; }
33
4
  export function lifecycleCommands(tool) {
34
5
  const offline = { flags: '--offline', description: 'Use verified local archives and cache without network access' };
35
6
  const vendor = tool.vendorDirect ? [{ flags: '--vendor-direct', description: 'Explicitly acquire pinned non-redistributable bytes from the named vendor' }] : [];
36
7
  const source = [...vendor, { flags: '--archive <path>', description: 'Install from a local tool archive' },
37
- { flags: '--archive-sha256 <sha256>', description: 'Expected SHA256 of the local tool archive' },
38
8
  { flags: '--executable <path>', description: 'Use an external executable; its files are never deleted' }, offline];
39
9
  const leaf = (name, description, permission, options) => command(name, description, ({ options: o }, c) => tool.lifecycle[name](o, c), { permission, options });
40
10
  return [
@@ -1,8 +1,7 @@
1
1
  import { readFile } from 'node:fs/promises';
2
- import { execFile, spawn } from 'node:child_process';
2
+ import { execFile } from 'node:child_process';
3
3
  import { promisify } from 'node:util';
4
- import { tmpdir } from 'node:os';
5
- import { timed } from '../internal-timing.js';
4
+ import { windowsHelperText } from './windows-helper.js';
6
5
  const exec = promisify(execFile);
7
6
  function unavailable(pid) { try {
8
7
  process.kill(pid, 0);
@@ -47,7 +46,7 @@ export function birthChanged(recorded, current) {
47
46
  return comparableBirth(recorded) && current !== undefined && comparableBirth(current.birth) && current.birth !== recorded;
48
47
  }
49
48
  export async function processIdentity(pid) {
50
- return timed('tool.identity', process.platform, () => probeIdentity(pid));
49
+ return probeIdentity(pid);
51
50
  }
52
51
  async function probeIdentity(pid) {
53
52
  if (!Number.isSafeInteger(pid) || pid < 1)
@@ -70,13 +69,9 @@ async function probeIdentity(pid) {
70
69
  return { birth: match[3], strong: false, group: Number(match[2]) };
71
70
  }
72
71
  if (process.platform === 'win32') {
73
- // A warm probe answers in milliseconds; the original one-shot probe remains the fallback.
74
- const warm = await windowsBirth(pid);
75
- if (warm !== undefined)
76
- return warm === 'error' ? unavailable(pid) : warm ? { birth: warm, strong: true } : unavailable(pid);
77
- const script = 'try{$p=[Diagnostics.Process]::GetProcessById(' + pid + ');try{$p.StartTime.ToUniversalTime().Ticks.ToString()}finally{$p.Dispose()}}catch [ArgumentException]{}';
78
- const r = await exec('powershell.exe', ['-NoProfile', '-NonInteractive', '-Command', script], { windowsHide: true, timeout: 15000, maxBuffer: 4096 });
79
- return r.stdout.trim() ? { birth: r.stdout.trim(), strong: true } : unavailable(pid);
72
+ // The packaged helper answers `<pid> <UTC creation ticks>`, `<pid> absent` or `<pid> error`.
73
+ const answer = (await windowsHelperText(['birth', String(pid)])).split(' ')[1];
74
+ return answer === 'absent' ? undefined : answer && /^\d+$/.test(answer) ? { birth: answer, strong: true } : unavailable(pid);
80
75
  }
81
76
  try {
82
77
  process.kill(pid, 0);
@@ -92,79 +87,3 @@ async function probeIdentity(pid) {
92
87
  throw error;
93
88
  }
94
89
  }
95
- let host;
96
- const loop = '$ErrorActionPreference="Stop";while($null -ne ($line=[Console]::In.ReadLine())){$out="";try{$p=[Diagnostics.Process]::GetProcessById([int]$line);try{$out=$p.StartTime.ToUniversalTime().Ticks.ToString()}finally{$p.Dispose()}}catch [ArgumentException]{$out=""}catch{$out="error"};[Console]::Out.WriteLine("r:"+$out);[Console]::Out.Flush()}';
97
- function retire() {
98
- const current = host;
99
- host = undefined;
100
- if (!current)
101
- return;
102
- for (const p of current.pending.splice(0)) {
103
- clearTimeout(p.timer);
104
- p.resolve(undefined);
105
- }
106
- try {
107
- current.child.kill();
108
- }
109
- catch { /* Already exited. */ }
110
- }
111
- function windowsHost() {
112
- if (host && host.child.exitCode === null && host.child.signalCode === null)
113
- return host;
114
- // A long-lived host must not hold the caller's working directory (it would block its removal).
115
- const child = spawn('powershell.exe', ['-NoProfile', '-NonInteractive', '-Command', loop], { cwd: process.env.SystemRoot ?? tmpdir(), windowsHide: true, stdio: ['pipe', 'pipe', 'pipe'] });
116
- const created = { child, pending: [], buffer: '' };
117
- host = created;
118
- child.on('error', () => { if (host === created)
119
- retire(); });
120
- child.on('exit', () => { if (host === created)
121
- retire(); });
122
- child.stdin.on('error', () => { if (host === created)
123
- retire(); });
124
- child.stderr.resume();
125
- child.stdout.setEncoding('utf8');
126
- child.stdout.on('data', (chunk) => {
127
- created.buffer += chunk;
128
- let index;
129
- while ((index = created.buffer.indexOf('\n')) >= 0) {
130
- const line = created.buffer.slice(0, index).trim();
131
- created.buffer = created.buffer.slice(index + 1);
132
- if (!line.startsWith('r:'))
133
- continue;
134
- const next = created.pending.shift();
135
- if (!next)
136
- continue;
137
- clearTimeout(next.timer);
138
- next.resolve(line.slice(2));
139
- }
140
- if (created.buffer.length > 65536 && host === created)
141
- retire();
142
- });
143
- // The host never keeps the owner alive.
144
- child.unref();
145
- for (const stream of [child.stdin, child.stdout, child.stderr])
146
- stream.unref?.();
147
- return created;
148
- }
149
- async function windowsBirth(pid) {
150
- let current;
151
- try {
152
- current = windowsHost();
153
- }
154
- catch {
155
- return undefined;
156
- }
157
- return new Promise(resolve => {
158
- // The referenced deadline keeps the process alive only while an answer is pending.
159
- const timer = setTimeout(() => { if (host === current)
160
- retire(); resolve(undefined); }, 15000);
161
- current.pending.push({ resolve, timer });
162
- try {
163
- current.child.stdin.write(String(pid) + '\n');
164
- }
165
- catch {
166
- if (host === current)
167
- retire();
168
- }
169
- });
170
- }