@nimblesite/lsp-profiler-ui 0.0.0-stage → 0.0.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 (352) hide show
  1. package/LICENSE +21 -0
  2. package/out/src/bind-host.d.ts +3 -0
  3. package/out/src/bind-host.js +52 -0
  4. package/out/src/bind-host.js.map +1 -0
  5. package/out/src/context-keys.d.ts +4 -0
  6. package/out/src/context-keys.js +54 -0
  7. package/out/src/context-keys.js.map +1 -0
  8. package/out/src/dap-evaluate.d.ts +84 -0
  9. package/out/src/dap-evaluate.js +442 -0
  10. package/out/src/dap-evaluate.js.map +1 -0
  11. package/out/src/dap-output.d.ts +50 -0
  12. package/out/src/dap-output.js +177 -0
  13. package/out/src/dap-output.js.map +1 -0
  14. package/out/src/debug/adapter-resolution.d.ts +56 -0
  15. package/out/src/debug/adapter-resolution.js +112 -0
  16. package/out/src/debug/adapter-resolution.js.map +1 -0
  17. package/out/src/debug/dap-messages.d.ts +18 -0
  18. package/out/src/debug/dap-messages.js +71 -0
  19. package/out/src/debug/dap-messages.js.map +1 -0
  20. package/out/src/debug/index.d.ts +7 -0
  21. package/out/src/debug/index.js +27 -0
  22. package/out/src/debug/index.js.map +1 -0
  23. package/out/src/debug/launch-config.d.ts +42 -0
  24. package/out/src/debug/launch-config.js +73 -0
  25. package/out/src/debug/launch-config.js.map +1 -0
  26. package/out/src/debug/launch-lifecycle.d.ts +29 -0
  27. package/out/src/debug/launch-lifecycle.js +40 -0
  28. package/out/src/debug/launch-lifecycle.js.map +1 -0
  29. package/out/src/debug/poll.d.ts +25 -0
  30. package/out/src/debug/poll.js +70 -0
  31. package/out/src/debug/poll.js.map +1 -0
  32. package/out/src/debug/profiling.d.ts +34 -0
  33. package/out/src/debug/profiling.js +81 -0
  34. package/out/src/debug/profiling.js.map +1 -0
  35. package/out/src/debug/testing/assertions.d.ts +27 -0
  36. package/out/src/debug/testing/assertions.js +111 -0
  37. package/out/src/debug/testing/assertions.js.map +1 -0
  38. package/out/src/debug/testing/dap-client.d.ts +86 -0
  39. package/out/src/debug/testing/dap-client.js +204 -0
  40. package/out/src/debug/testing/dap-client.js.map +1 -0
  41. package/out/src/debug/testing/index.d.ts +7 -0
  42. package/out/src/debug/testing/index.js +31 -0
  43. package/out/src/debug/testing/index.js.map +1 -0
  44. package/out/src/debug/testing/vscode-harness.d.ts +44 -0
  45. package/out/src/debug/testing/vscode-harness.js +81 -0
  46. package/out/src/debug/testing/vscode-harness.js.map +1 -0
  47. package/out/src/debug/ui-stubs.d.ts +26 -0
  48. package/out/src/debug/ui-stubs.js +88 -0
  49. package/out/src/debug/ui-stubs.js.map +1 -0
  50. package/out/src/debug-link-setup.d.ts +4 -0
  51. package/out/src/debug-link-setup.js +19 -0
  52. package/out/src/debug-link-setup.js.map +1 -0
  53. package/out/src/debug-link-view.d.ts +4 -0
  54. package/out/src/debug-link-view.js +49 -0
  55. package/out/src/debug-link-view.js.map +1 -0
  56. package/out/src/debug-link.d.ts +6 -0
  57. package/out/src/debug-link.js +95 -0
  58. package/out/src/debug-link.js.map +1 -0
  59. package/out/src/debug-selection.d.ts +14 -0
  60. package/out/src/debug-selection.js +33 -0
  61. package/out/src/debug-selection.js.map +1 -0
  62. package/out/src/debuggee-pause.d.ts +11 -0
  63. package/out/src/debuggee-pause.js +109 -0
  64. package/out/src/debuggee-pause.js.map +1 -0
  65. package/out/src/editor-path-key.d.ts +52 -0
  66. package/out/src/editor-path-key.js +105 -0
  67. package/out/src/editor-path-key.js.map +1 -0
  68. package/out/src/failure.d.ts +5 -0
  69. package/out/src/failure.js +53 -0
  70. package/out/src/failure.js.map +1 -0
  71. package/out/src/file-log-sink.d.ts +20 -0
  72. package/out/src/file-log-sink.js +74 -0
  73. package/out/src/file-log-sink.js.map +1 -0
  74. package/out/src/flame-html.d.ts +8 -0
  75. package/out/src/flame-html.js +104 -0
  76. package/out/src/flame-html.js.map +1 -0
  77. package/out/src/flame-model.d.ts +93 -0
  78. package/out/src/flame-model.js +242 -0
  79. package/out/src/flame-model.js.map +1 -0
  80. package/out/src/flame-script-helpers.d.ts +26 -0
  81. package/out/src/flame-script-helpers.js +71 -0
  82. package/out/src/flame-script-helpers.js.map +1 -0
  83. package/out/src/flame-script.d.ts +1 -0
  84. package/out/src/flame-script.js +332 -0
  85. package/out/src/flame-script.js.map +1 -0
  86. package/out/src/flame-time-order.d.ts +14 -0
  87. package/out/src/flame-time-order.js +112 -0
  88. package/out/src/flame-time-order.js.map +1 -0
  89. package/out/src/flamegraph-artifact.d.ts +9 -0
  90. package/out/src/flamegraph-artifact.js +45 -0
  91. package/out/src/flamegraph-artifact.js.map +1 -0
  92. package/out/src/host.d.ts +31 -0
  93. package/out/src/host.js +6 -0
  94. package/out/src/host.js.map +1 -0
  95. package/out/src/ids.d.ts +27 -0
  96. package/out/src/ids.js +63 -0
  97. package/out/src/ids.js.map +1 -0
  98. package/out/src/index.d.ts +42 -0
  99. package/out/src/index.js +98 -0
  100. package/out/src/index.js.map +1 -0
  101. package/out/src/logger.d.ts +50 -0
  102. package/out/src/logger.js +86 -0
  103. package/out/src/logger.js.map +1 -0
  104. package/out/src/memory-autopilot.d.ts +64 -0
  105. package/out/src/memory-autopilot.js +306 -0
  106. package/out/src/memory-autopilot.js.map +1 -0
  107. package/out/src/memory-capture-ids.d.ts +17 -0
  108. package/out/src/memory-capture-ids.js +45 -0
  109. package/out/src/memory-capture-ids.js.map +1 -0
  110. package/out/src/memory-capture-ingest.d.ts +15 -0
  111. package/out/src/memory-capture-ingest.js +84 -0
  112. package/out/src/memory-capture-ingest.js.map +1 -0
  113. package/out/src/memory-capture-legs.d.ts +4 -0
  114. package/out/src/memory-capture-legs.js +55 -0
  115. package/out/src/memory-capture-legs.js.map +1 -0
  116. package/out/src/memory-capture-present.d.ts +32 -0
  117. package/out/src/memory-capture-present.js +71 -0
  118. package/out/src/memory-capture-present.js.map +1 -0
  119. package/out/src/memory-capture-roundtrip.d.ts +17 -0
  120. package/out/src/memory-capture-roundtrip.js +75 -0
  121. package/out/src/memory-capture-roundtrip.js.map +1 -0
  122. package/out/src/memory-capture-state.d.ts +23 -0
  123. package/out/src/memory-capture-state.js +89 -0
  124. package/out/src/memory-capture-state.js.map +1 -0
  125. package/out/src/memory-capture-types.d.ts +28 -0
  126. package/out/src/memory-capture-types.js +70 -0
  127. package/out/src/memory-capture-types.js.map +1 -0
  128. package/out/src/memory-capture.d.ts +24 -0
  129. package/out/src/memory-capture.js +51 -0
  130. package/out/src/memory-capture.js.map +1 -0
  131. package/out/src/memory-dashboard-html.d.ts +3 -0
  132. package/out/src/memory-dashboard-html.js +327 -0
  133. package/out/src/memory-dashboard-html.js.map +1 -0
  134. package/out/src/memory-dashboard-mapping.d.ts +34 -0
  135. package/out/src/memory-dashboard-mapping.js +135 -0
  136. package/out/src/memory-dashboard-mapping.js.map +1 -0
  137. package/out/src/memory-dashboard.d.ts +82 -0
  138. package/out/src/memory-dashboard.js +142 -0
  139. package/out/src/memory-dashboard.js.map +1 -0
  140. package/out/src/memory-decorations.d.ts +61 -0
  141. package/out/src/memory-decorations.js +247 -0
  142. package/out/src/memory-decorations.js.map +1 -0
  143. package/out/src/memory-finalize.d.ts +25 -0
  144. package/out/src/memory-finalize.js +207 -0
  145. package/out/src/memory-finalize.js.map +1 -0
  146. package/out/src/memory-guidance.d.ts +14 -0
  147. package/out/src/memory-guidance.js +36 -0
  148. package/out/src/memory-guidance.js.map +1 -0
  149. package/out/src/memory-inspect-commands.d.ts +20 -0
  150. package/out/src/memory-inspect-commands.js +114 -0
  151. package/out/src/memory-inspect-commands.js.map +1 -0
  152. package/out/src/memory-launch-direct.d.ts +12 -0
  153. package/out/src/memory-launch-direct.js +74 -0
  154. package/out/src/memory-launch-direct.js.map +1 -0
  155. package/out/src/memory-launch.d.ts +4 -0
  156. package/out/src/memory-launch.js +92 -0
  157. package/out/src/memory-launch.js.map +1 -0
  158. package/out/src/memory-leak-offer.d.ts +18 -0
  159. package/out/src/memory-leak-offer.js +51 -0
  160. package/out/src/memory-leak-offer.js.map +1 -0
  161. package/out/src/memory-profiler.d.ts +27 -0
  162. package/out/src/memory-profiler.js +71 -0
  163. package/out/src/memory-profiler.js.map +1 -0
  164. package/out/src/memory-ref-graph.d.ts +62 -0
  165. package/out/src/memory-ref-graph.js +248 -0
  166. package/out/src/memory-ref-graph.js.map +1 -0
  167. package/out/src/memory-ref-picker.d.ts +21 -0
  168. package/out/src/memory-ref-picker.js +103 -0
  169. package/out/src/memory-ref-picker.js.map +1 -0
  170. package/out/src/memory-registration.d.ts +4 -0
  171. package/out/src/memory-registration.js +63 -0
  172. package/out/src/memory-registration.js.map +1 -0
  173. package/out/src/memory-start-core.d.ts +8 -0
  174. package/out/src/memory-start-core.js +165 -0
  175. package/out/src/memory-start-core.js.map +1 -0
  176. package/out/src/memory-start-stop-commands.d.ts +10 -0
  177. package/out/src/memory-start-stop-commands.js +75 -0
  178. package/out/src/memory-start-stop-commands.js.map +1 -0
  179. package/out/src/memory-start.d.ts +6 -0
  180. package/out/src/memory-start.js +13 -0
  181. package/out/src/memory-start.js.map +1 -0
  182. package/out/src/memory-status.d.ts +24 -0
  183. package/out/src/memory-status.js +135 -0
  184. package/out/src/memory-status.js.map +1 -0
  185. package/out/src/palette-vscode.d.ts +2 -0
  186. package/out/src/palette-vscode.js +50 -0
  187. package/out/src/palette-vscode.js.map +1 -0
  188. package/out/src/palette.d.ts +70 -0
  189. package/out/src/palette.js +150 -0
  190. package/out/src/palette.js.map +1 -0
  191. package/out/src/process-bind-panel.d.ts +11 -0
  192. package/out/src/process-bind-panel.js +65 -0
  193. package/out/src/process-bind-panel.js.map +1 -0
  194. package/out/src/process-commands.d.ts +5 -0
  195. package/out/src/process-commands.js +112 -0
  196. package/out/src/process-commands.js.map +1 -0
  197. package/out/src/process-context-keys.d.ts +11 -0
  198. package/out/src/process-context-keys.js +48 -0
  199. package/out/src/process-context-keys.js.map +1 -0
  200. package/out/src/process-decoration.d.ts +18 -0
  201. package/out/src/process-decoration.js +76 -0
  202. package/out/src/process-decoration.js.map +1 -0
  203. package/out/src/process-explorer-rows.d.ts +59 -0
  204. package/out/src/process-explorer-rows.js +47 -0
  205. package/out/src/process-explorer-rows.js.map +1 -0
  206. package/out/src/process-explorer.d.ts +66 -0
  207. package/out/src/process-explorer.js +241 -0
  208. package/out/src/process-explorer.js.map +1 -0
  209. package/out/src/process-group-item.d.ts +8 -0
  210. package/out/src/process-group-item.js +55 -0
  211. package/out/src/process-group-item.js.map +1 -0
  212. package/out/src/process-launch-item.d.ts +12 -0
  213. package/out/src/process-launch-item.js +57 -0
  214. package/out/src/process-launch-item.js.map +1 -0
  215. package/out/src/process-launch.d.ts +47 -0
  216. package/out/src/process-launch.js +205 -0
  217. package/out/src/process-launch.js.map +1 -0
  218. package/out/src/process-message-item.d.ts +10 -0
  219. package/out/src/process-message-item.js +53 -0
  220. package/out/src/process-message-item.js.map +1 -0
  221. package/out/src/process-poll.d.ts +26 -0
  222. package/out/src/process-poll.js +125 -0
  223. package/out/src/process-poll.js.map +1 -0
  224. package/out/src/process-reactivity.d.ts +55 -0
  225. package/out/src/process-reactivity.js +188 -0
  226. package/out/src/process-reactivity.js.map +1 -0
  227. package/out/src/process-registration.d.ts +11 -0
  228. package/out/src/process-registration.js +55 -0
  229. package/out/src/process-registration.js.map +1 -0
  230. package/out/src/process-tree-item.d.ts +18 -0
  231. package/out/src/process-tree-item.js +219 -0
  232. package/out/src/process-tree-item.js.map +1 -0
  233. package/out/src/processes-state.d.ts +75 -0
  234. package/out/src/processes-state.js +76 -0
  235. package/out/src/processes-state.js.map +1 -0
  236. package/out/src/profile-on-launch.d.ts +4 -0
  237. package/out/src/profile-on-launch.js +16 -0
  238. package/out/src/profile-on-launch.js.map +1 -0
  239. package/out/src/profile-server.d.ts +24 -0
  240. package/out/src/profile-server.js +170 -0
  241. package/out/src/profile-server.js.map +1 -0
  242. package/out/src/profiler-attach.d.ts +19 -0
  243. package/out/src/profiler-attach.js +129 -0
  244. package/out/src/profiler-attach.js.map +1 -0
  245. package/out/src/profiler-commands.d.ts +8 -0
  246. package/out/src/profiler-commands.js +110 -0
  247. package/out/src/profiler-commands.js.map +1 -0
  248. package/out/src/profiler-decorations.d.ts +74 -0
  249. package/out/src/profiler-decorations.js +237 -0
  250. package/out/src/profiler-decorations.js.map +1 -0
  251. package/out/src/profiler-dispose.d.ts +6 -0
  252. package/out/src/profiler-dispose.js +20 -0
  253. package/out/src/profiler-dispose.js.map +1 -0
  254. package/out/src/profiler-flamegraph-html.d.ts +61 -0
  255. package/out/src/profiler-flamegraph-html.js +366 -0
  256. package/out/src/profiler-flamegraph-html.js.map +1 -0
  257. package/out/src/profiler-format.d.ts +10 -0
  258. package/out/src/profiler-format.js +28 -0
  259. package/out/src/profiler-format.js.map +1 -0
  260. package/out/src/profiler-launch-cooperative.d.ts +16 -0
  261. package/out/src/profiler-launch-cooperative.js +167 -0
  262. package/out/src/profiler-launch-cooperative.js.map +1 -0
  263. package/out/src/profiler-launch.d.ts +29 -0
  264. package/out/src/profiler-launch.js +123 -0
  265. package/out/src/profiler-launch.js.map +1 -0
  266. package/out/src/profiler-results.d.ts +22 -0
  267. package/out/src/profiler-results.js +104 -0
  268. package/out/src/profiler-results.js.map +1 -0
  269. package/out/src/profiler-session-core.d.ts +42 -0
  270. package/out/src/profiler-session-core.js +116 -0
  271. package/out/src/profiler-session-core.js.map +1 -0
  272. package/out/src/profiler-state.d.ts +87 -0
  273. package/out/src/profiler-state.js +83 -0
  274. package/out/src/profiler-state.js.map +1 -0
  275. package/out/src/profiler-status.d.ts +38 -0
  276. package/out/src/profiler-status.js +163 -0
  277. package/out/src/profiler-status.js.map +1 -0
  278. package/out/src/profiler-styles.d.ts +21 -0
  279. package/out/src/profiler-styles.js +160 -0
  280. package/out/src/profiler-styles.js.map +1 -0
  281. package/out/src/profiler-webview.d.ts +95 -0
  282. package/out/src/profiler-webview.js +243 -0
  283. package/out/src/profiler-webview.js.map +1 -0
  284. package/out/src/profiler.d.ts +23 -0
  285. package/out/src/profiler.js +113 -0
  286. package/out/src/profiler.js.map +1 -0
  287. package/out/src/progress-ops.d.ts +24 -0
  288. package/out/src/progress-ops.js +135 -0
  289. package/out/src/progress-ops.js.map +1 -0
  290. package/out/src/reactive-refresh.d.ts +24 -0
  291. package/out/src/reactive-refresh.js +33 -0
  292. package/out/src/reactive-refresh.js.map +1 -0
  293. package/out/src/sample-summary.d.ts +39 -0
  294. package/out/src/sample-summary.js +32 -0
  295. package/out/src/sample-summary.js.map +1 -0
  296. package/out/src/sampled-view.d.ts +15 -0
  297. package/out/src/sampled-view.js +56 -0
  298. package/out/src/sampled-view.js.map +1 -0
  299. package/out/src/server-command.d.ts +4 -0
  300. package/out/src/server-command.js +14 -0
  301. package/out/src/server-command.js.map +1 -0
  302. package/out/src/settings.d.ts +1 -0
  303. package/out/src/settings.js +22 -0
  304. package/out/src/settings.js.map +1 -0
  305. package/out/src/store.d.ts +34 -0
  306. package/out/src/store.js +64 -0
  307. package/out/src/store.js.map +1 -0
  308. package/out/src/testing/cpu-capture-assertions.d.ts +8 -0
  309. package/out/src/testing/cpu-capture-assertions.js +71 -0
  310. package/out/src/testing/cpu-capture-assertions.js.map +1 -0
  311. package/out/src/testing/cpu-capture-contract.d.ts +8 -0
  312. package/out/src/testing/cpu-capture-contract.js +123 -0
  313. package/out/src/testing/cpu-capture-contract.js.map +1 -0
  314. package/out/src/testing/webview-contract-helpers.d.ts +24 -0
  315. package/out/src/testing/webview-contract-helpers.js +125 -0
  316. package/out/src/testing/webview-contract-helpers.js.map +1 -0
  317. package/out/src/testing/webview-contract-leak.d.ts +2 -0
  318. package/out/src/testing/webview-contract-leak.js +80 -0
  319. package/out/src/testing/webview-contract-leak.js.map +1 -0
  320. package/out/src/testing/webview-contract-memory.d.ts +5 -0
  321. package/out/src/testing/webview-contract-memory.js +221 -0
  322. package/out/src/testing/webview-contract-memory.js.map +1 -0
  323. package/out/src/testing/webview-contract-palette.d.ts +6 -0
  324. package/out/src/testing/webview-contract-palette.js +121 -0
  325. package/out/src/testing/webview-contract-palette.js.map +1 -0
  326. package/out/src/testing/webview-contract-panel.d.ts +7 -0
  327. package/out/src/testing/webview-contract-panel.js +100 -0
  328. package/out/src/testing/webview-contract-panel.js.map +1 -0
  329. package/out/src/testing/webview-contract-results.d.ts +6 -0
  330. package/out/src/testing/webview-contract-results.js +136 -0
  331. package/out/src/testing/webview-contract-results.js.map +1 -0
  332. package/out/src/testing/webview-contract.d.ts +18 -0
  333. package/out/src/testing/webview-contract.js +23 -0
  334. package/out/src/testing/webview-contract.js.map +1 -0
  335. package/out/src/timeouts.d.ts +21 -0
  336. package/out/src/timeouts.js +30 -0
  337. package/out/src/timeouts.js.map +1 -0
  338. package/out/src/trace-actions.d.ts +33 -0
  339. package/out/src/trace-actions.js +135 -0
  340. package/out/src/trace-actions.js.map +1 -0
  341. package/out/src/unknown-shape.d.ts +58 -0
  342. package/out/src/unknown-shape.js +110 -0
  343. package/out/src/unknown-shape.js.map +1 -0
  344. package/out/src/wire-adapters.d.ts +18 -0
  345. package/out/src/wire-adapters.js +160 -0
  346. package/out/src/wire-adapters.js.map +1 -0
  347. package/out/src/wire-generated.d.ts +760 -0
  348. package/out/src/wire-generated.js +38 -0
  349. package/out/src/wire-generated.js.map +1 -0
  350. package/package.json +53 -4
  351. package/scripts/contributions.mjs +187 -0
  352. package/README.md +0 -3
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.presentSnapshot = presentSnapshot;
4
+ exports.presentDiff = presentDiff;
5
+ exports.captureSnapshotAndDiff = captureSnapshotAndDiff;
6
+ // Implements [PROF-UI-MEMORY] + [PROF-UI-AUTOPILOT]. See docs/specs/LSP-PROFILER-SPEC.md
7
+ const logger_1 = require("./logger");
8
+ const memory_decorations_1 = require("./memory-decorations");
9
+ const memory_dashboard_mapping_1 = require("./memory-dashboard-mapping");
10
+ const memory_dashboard_1 = require("./memory-dashboard");
11
+ const memory_capture_state_1 = require("./memory-capture-state");
12
+ const memory_capture_roundtrip_1 = require("./memory-capture-roundtrip");
13
+ const memory_capture_ids_1 = require("./memory-capture-ids");
14
+ /**
15
+ * Land a snapshot result: paint the allocation track, append a timeline
16
+ * point, and retain it for a later "Compare". With `openResultsView` (the
17
+ * manual "Take Memory Snapshot" affordance), open the memory dashboard
18
+ * — the raw V8 `.heapprofile` stays one click away on its own button
19
+ * ([PROF-CPU-START]). Without it (the autopilot's quiet per-pass capture) only
20
+ * the decorations + timeline update — the diff step surfaces the dashboard.
21
+ */
22
+ async function presentSnapshot(result, options) {
23
+ await (0, memory_decorations_1.applyMemoryDecorations)((0, memory_dashboard_mapping_1.toSnapshotResult)(result));
24
+ const dashboard = (0, memory_dashboard_mapping_1.toDashboardSnapshot)(result);
25
+ (0, memory_capture_state_1.recordTimelinePoint)(dashboard);
26
+ dashboard.timeline = [...(0, memory_capture_state_1.currentTimeline)()];
27
+ (0, memory_capture_state_1.setDashboardSnapshot)(dashboard);
28
+ logger_1.Logger.info(`Memory snapshot: ${String(dashboard.currentMemory)} bytes current`);
29
+ if (options.openResultsView) {
30
+ (0, memory_dashboard_1.openMemoryDashboard)(dashboard);
31
+ }
32
+ }
33
+ /**
34
+ * Land a diff result: paint the leak decorations (confidence-coloured) and refresh
35
+ * the dashboard with the leak analysis alongside the last snapshot. Returns the
36
+ * typed diff so callers (the autopilot) can read suspected-leak confidence.
37
+ */
38
+ async function presentDiff(result) {
39
+ const diff = (0, memory_dashboard_mapping_1.toDiffResult)(result);
40
+ await (0, memory_decorations_1.applyLeakDecorations)(diff);
41
+ const lastSnapshot = (0, memory_capture_state_1.currentDashboardSnapshot)();
42
+ if (lastSnapshot !== null) {
43
+ (0, memory_dashboard_1.openMemoryDashboard)(lastSnapshot, (0, memory_dashboard_mapping_1.toDashboardDiff)(result));
44
+ }
45
+ const leaks = diff.suspectedLeaks;
46
+ logger_1.Logger.info(`Memory diff: ${String(leaks.length)} suspected leak(s)`);
47
+ return diff;
48
+ }
49
+ /**
50
+ * The autopilot's combined capture: a snapshot then a diff, presented quietly
51
+ * (decorations + dashboard + timeline, no new `.heapprofile` tab on each pass).
52
+ * Brackets the whole pair as one in-flight op so the transparent pauses it may
53
+ * perform never trigger a second auto-capture ([PROF-UI-AUTOPILOT]).
54
+ */
55
+ async function captureSnapshotAndDiff(store, report) {
56
+ const quietOp = (command) => ({ store, command, extraArgs: {}, report, quiet: true });
57
+ (0, memory_capture_state_1.beginMemoryOp)();
58
+ try {
59
+ const snapshotResult = await (0, memory_capture_roundtrip_1.runMemoryOperation)(quietOp(memory_capture_ids_1.LSP_MEM_CMD.snapshot));
60
+ if (snapshotResult?.kind === "snapshot") {
61
+ await presentSnapshot(snapshotResult, { openResultsView: false });
62
+ }
63
+ const diffResult = await (0, memory_capture_roundtrip_1.runMemoryOperation)(quietOp(memory_capture_ids_1.LSP_MEM_CMD.diff));
64
+ const diff = diffResult?.kind === "diff" ? await presentDiff(diffResult) : null;
65
+ return { snapshot: snapshotResult, diff };
66
+ }
67
+ finally {
68
+ (0, memory_capture_state_1.endMemoryOp)();
69
+ }
70
+ }
71
+ //# sourceMappingURL=memory-capture-present.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-capture-present.js","sourceRoot":"","sources":["../../src/memory-capture-present.ts"],"names":[],"mappings":";;;;;AAAA,yFAAyF;AACzF,qCAAkC;AAGlC,6DAAoF;AAGpF,yEAAkH;AAClH,yDAAyD;AACzD,iEAA0J;AAC1J,yEAAgE;AAChE,6DAAmD;AAEnD;;;;;;;GAOG;AACI,KAAK,0BAA0B,MAA0B,EAAE,OAAqC;IACrG,MAAM,IAAA,2CAAsB,EAAC,IAAA,2CAAgB,EAAC,MAAM,CAAC,CAAC,CAAC;IACvD,MAAM,SAAS,GAAG,IAAA,8CAAmB,EAAC,MAAM,CAAC,CAAC;IAC9C,IAAA,0CAAmB,EAAC,SAAS,CAAC,CAAC;IAC/B,SAAS,CAAC,QAAQ,GAAG,CAAC,GAAG,IAAA,sCAAe,GAAE,CAAC,CAAC;IAC5C,IAAA,2CAAoB,EAAC,SAAS,CAAC,CAAC;IAChC,eAAM,CAAC,IAAI,CAAC,oBAAoB,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;IACjF,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;QAC5B,IAAA,sCAAmB,EAAC,SAAS,CAAC,CAAC;IACjC,CAAC;AACH,CAAC;AAED;;;;GAIG;AACI,KAAK,sBAAsB,MAA0B;IAC1D,MAAM,IAAI,GAAG,IAAA,uCAAY,EAAC,MAAM,CAAC,CAAC;IAClC,MAAM,IAAA,yCAAoB,EAAC,IAAI,CAAC,CAAC;IACjC,MAAM,YAAY,GAAG,IAAA,+CAAwB,GAAE,CAAC;IAChD,IAAI,YAAY,KAAK,IAAI,EAAE,CAAC;QAC1B,IAAA,sCAAmB,EAAC,YAAY,EAAE,IAAA,0CAAe,EAAC,MAAM,CAAC,CAAC,CAAC;IAC7D,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,CAAC,cAAc,CAAC;IAClC,eAAM,CAAC,IAAI,CAAC,gBAAgB,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;IACtE,OAAO,IAAI,CAAC;AACd,CAAC;AAQD;;;;;GAKG;AACI,KAAK,iCACV,KAAY,EACZ,MAAiC;IAEjC,MAAM,OAAO,GAAG,CAAC,OAAe,EAAmB,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/G,IAAA,oCAAa,GAAE,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,cAAc,GAAG,MAAM,IAAA,6CAAkB,EAAC,OAAO,CAAC,gCAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC/E,IAAI,cAAc,EAAE,IAAI,KAAK,UAAU,EAAE,CAAC;YACxC,MAAM,eAAe,CAAC,cAAc,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC,CAAC;QACpE,CAAC;QACD,MAAM,UAAU,GAAG,MAAM,IAAA,6CAAkB,EAAC,OAAO,CAAC,gCAAW,CAAC,IAAI,CAAC,CAAC,CAAC;QACvE,MAAM,IAAI,GAAG,UAAU,EAAE,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAChF,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC;IAC5C,CAAC;YAAS,CAAC;QACT,IAAA,kCAAW,GAAE,CAAC;IAChB,CAAC;AACH,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { ProfilerStore as Store } from "./store";
2
+ import type { MemoryOperation } from "./memory-capture-types";
3
+ import { requestStep } from "./memory-capture-legs";
4
+ /**
5
+ * End the tracked session on the server ([PROF-MEMORY-SESSION]): it answers no
6
+ * further step and its heap graphs are deleted ([PROF-DOTNET-MEMORY] `stop`).
7
+ * Call it while the store still holds the session id; a failure is logged,
8
+ * because the UI's own tracking ends either way.
9
+ */
10
+ export declare function endServerSession(store: Store): Promise<void>;
11
+ /**
12
+ * Run one memory operation's round-trip and return the LSP's structured result.
13
+ *
14
+ * Returns null (with an actionable message unless `quiet`) when there is no
15
+ * session, the debuggee cannot be paused, or evaluation fails.
16
+ */
17
+ export declare function runMemoryOperation(op: MemoryOperation): Promise<ReturnType<typeof requestStep>>;
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.endServerSession = endServerSession;
4
+ exports.runMemoryOperation = runMemoryOperation;
5
+ // Implements [PROF-UI-MEMORY] + [PROF-UI-AUTOPILOT]. See docs/specs/LSP-PROFILER-SPEC.md
6
+ const ids_1 = require("./ids");
7
+ const logger_1 = require("./logger");
8
+ const failure_1 = require("./failure");
9
+ const server_command_1 = require("./server-command");
10
+ const debuggee_pause_1 = require("./debuggee-pause");
11
+ const memory_capture_state_1 = require("./memory-capture-state");
12
+ const memory_capture_types_1 = require("./memory-capture-types");
13
+ const memory_capture_ids_1 = require("./memory-capture-ids");
14
+ const memory_capture_legs_1 = require("./memory-capture-legs");
15
+ /**
16
+ * End the tracked session on the server ([PROF-MEMORY-SESSION]): it answers no
17
+ * further step and its heap graphs are deleted ([PROF-DOTNET-MEMORY] `stop`).
18
+ * Call it while the store still holds the session id; a failure is logged,
19
+ * because the UI's own tracking ends either way.
20
+ */
21
+ async function endServerSession(store) {
22
+ const client = store.client.value;
23
+ const { memorySessionId } = store.profiler.value;
24
+ if (client?.isRunning() !== true || memorySessionId === undefined) {
25
+ return;
26
+ }
27
+ try {
28
+ await (0, server_command_1.executeServerCommand)(client, memory_capture_ids_1.LSP_MEM_CMD.stop, { memory_session_id: memorySessionId });
29
+ }
30
+ catch (error) {
31
+ logger_1.Logger.warn(`[Memory] ${memory_capture_ids_1.LSP_MEM_CMD.stop} failed: ${(0, failure_1.errorText)(error)}`);
32
+ }
33
+ }
34
+ /**
35
+ * Run one memory operation's round-trip and return the LSP's structured result.
36
+ *
37
+ * Returns null (with an actionable message unless `quiet`) when there is no
38
+ * session, the debuggee cannot be paused, or evaluation fails.
39
+ */
40
+ async function runMemoryOperation(op) {
41
+ const active = (0, memory_capture_types_1.resolveActiveSession)(op);
42
+ if (active === null || refusedWhilePaused(op)) {
43
+ return null;
44
+ }
45
+ (0, memory_capture_state_1.beginMemoryOp)();
46
+ try {
47
+ return await (0, memory_capture_legs_1.requestStep)(op, active);
48
+ }
49
+ catch (error) {
50
+ return handleMemoryOperationError(op, error);
51
+ }
52
+ finally {
53
+ (0, memory_capture_state_1.endMemoryOp)();
54
+ }
55
+ }
56
+ /** Log and surface one failed memory round-trip, always resolving to null. */
57
+ function handleMemoryOperationError(op, error) {
58
+ const msg = (0, failure_1.errorText)(error);
59
+ logger_1.Logger.warn(`[Memory] ${op.command} round-trip failed: ${msg}`);
60
+ (0, memory_capture_types_1.warnUnlessQuiet)(op, `${(0, ids_1.brand)()}: ${msg}`);
61
+ return null;
62
+ }
63
+ /**
64
+ * A direct runtime reads the live heap, which it cannot do while the debugger
65
+ * holds the program paused: the step would wait for a resume that may never
66
+ * come ([PROF-MEMORY-MODE]). Refuse it and say why.
67
+ */
68
+ function refusedWhilePaused(op) {
69
+ if (!(0, memory_capture_state_1.isDirectMemorySession)() || !(0, debuggee_pause_1.isDebuggeePaused)(op.store.profiler.value.memoryDebugSessionId)) {
70
+ return false;
71
+ }
72
+ (0, memory_capture_types_1.warnUnlessQuiet)(op, `${(0, ids_1.brand)()}: Continue the program to read its memory — its heap cannot be read while the debugger holds it paused.`);
73
+ return true;
74
+ }
75
+ //# sourceMappingURL=memory-capture-roundtrip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-capture-roundtrip.js","sourceRoot":"","sources":["../../src/memory-capture-roundtrip.ts"],"names":[],"mappings":";;;;AAAA,yFAAyF;AACzF,+BAA8B;AAC9B,qCAAkC;AAClC,uCAAsC;AACtC,qDAAwD;AAExD,qDAAoD;AACpD,iEAA2F;AAE3F,iEAA+E;AAC/E,6DAAmD;AACnD,+DAAoD;AAEpD;;;;;GAKG;AACI,KAAK,2BAA2B,KAAY;IACjD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;IAClC,MAAM,EAAE,eAAe,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;IACjD,IAAI,MAAM,EAAE,SAAS,EAAE,KAAK,IAAI,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;QAAC,OAAO;IAAC,CAAC;IAC9E,IAAI,CAAC;QACH,MAAM,IAAA,qCAAoB,EAAU,MAAM,EAAE,gCAAW,CAAC,IAAI,EAAE,EAAE,iBAAiB,EAAE,eAAe,EAAE,CAAC,CAAC;IACxG,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,eAAM,CAAC,IAAI,CAAC,YAAY,gCAAW,CAAC,IAAI,YAAY,IAAA,mBAAS,EAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC1E,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACI,KAAK,6BAA6B,EAAmB;IAC1D,MAAM,MAAM,GAAG,IAAA,2CAAoB,EAAC,EAAE,CAAC,CAAC;IACxC,IAAI,MAAM,KAAK,IAAI,IAAI,kBAAkB,CAAC,EAAE,CAAC,EAAE,CAAC;QAAC,OAAO,IAAI,CAAC;IAAC,CAAC;IAC/D,IAAA,oCAAa,GAAE,CAAC;IAChB,IAAI,CAAC;QACH,OAAO,MAAM,IAAA,iCAAW,EAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IACvC,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,OAAO,0BAA0B,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;IAC/C,CAAC;YAAS,CAAC;QACT,IAAA,kCAAW,GAAE,CAAC;IAChB,CAAC;AACH,CAAC;AAED,8EAA8E;AAC9E,SAAS,0BAA0B,CAAC,EAAmB,EAAE,KAAc;IACrE,MAAM,GAAG,GAAG,IAAA,mBAAS,EAAC,KAAK,CAAC,CAAC;IAC7B,eAAM,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,OAAO,uBAAuB,GAAG,EAAE,CAAC,CAAC;IAChE,IAAA,sCAAe,EAAC,EAAE,EAAE,GAAG,IAAA,WAAK,GAAE,KAAK,GAAG,EAAE,CAAC,CAAC;IAC1C,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,SAAS,kBAAkB,CAAC,EAAmB;IAC7C,IAAI,CAAC,IAAA,4CAAqB,GAAE,IAAI,CAAC,IAAA,iCAAgB,EAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,oBAAoB,CAAC,EAAE,CAAC;QAAC,OAAO,KAAK,CAAC;IAAC,CAAC;IAClH,IAAA,sCAAe,EAAC,EAAE,EAAE,GAAG,IAAA,WAAK,GAAE,yGAAyG,CAAC,CAAC;IACzI,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { MemoryDashboardSnapshot, MemoryTimelinePoint } from "./memory-dashboard";
2
+ /** True while any memory round-trip (manual or auto) is mid-flight. */
3
+ export declare function isMemoryOperationInFlight(): boolean;
4
+ export declare function beginMemoryOp(): void;
5
+ export declare function endMemoryOp(): void;
6
+ /** The most recent memory snapshot the dashboard rendered, with its timeline (e2e seam). */
7
+ export declare function lastMemorySnapshot(): MemoryDashboardSnapshot | undefined;
8
+ /** Whether a snapshot has been captured (so "stop" can report honestly). */
9
+ export declare function hasCapturedSnapshot(): boolean;
10
+ /** Drop per-session presentation state (called when tracking stops). */
11
+ export declare function resetCaptureState(): void;
12
+ /** Record the mode of the memory session that just started. */
13
+ export declare function setDirectMemorySession(direct: boolean): void;
14
+ /** Whether the active memory session reads its heap directly, with no debugger pause. */
15
+ export declare function isDirectMemorySession(): boolean;
16
+ /** The snapshot the dashboard is currently rendering, or null before the first. */
17
+ export declare function currentDashboardSnapshot(): MemoryDashboardSnapshot | null;
18
+ /** Replace the snapshot the dashboard renders (the "Compare" baseline). */
19
+ export declare function setDashboardSnapshot(snapshot: MemoryDashboardSnapshot): void;
20
+ /** The rolling timeline of snapshots this session. */
21
+ export declare function currentTimeline(): MemoryTimelinePoint[];
22
+ /** Append a timeline point for a snapshot (seconds-epoch x-axis the chart reads). */
23
+ export declare function recordTimelinePoint(snapshot: MemoryDashboardSnapshot): void;
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isMemoryOperationInFlight = isMemoryOperationInFlight;
4
+ exports.beginMemoryOp = beginMemoryOp;
5
+ exports.endMemoryOp = endMemoryOp;
6
+ exports.lastMemorySnapshot = lastMemorySnapshot;
7
+ exports.hasCapturedSnapshot = hasCapturedSnapshot;
8
+ exports.resetCaptureState = resetCaptureState;
9
+ exports.setDirectMemorySession = setDirectMemorySession;
10
+ exports.isDirectMemorySession = isDirectMemorySession;
11
+ exports.currentDashboardSnapshot = currentDashboardSnapshot;
12
+ exports.setDashboardSnapshot = setDashboardSnapshot;
13
+ exports.currentTimeline = currentTimeline;
14
+ exports.recordTimelinePoint = recordTimelinePoint;
15
+ /** Milliseconds per second (timeline x-axis is in seconds). */
16
+ const MS_PER_SECOND = 1000;
17
+ // ── In-flight guard ─────────────────────────────────────────────────────────
18
+ //
19
+ // [PROF-UI-AUTOPILOT] A capture transparently pauses a running
20
+ // program, which emits its own `stopped` event; the autopilot must NOT treat that
21
+ // (or any in-progress manual op) as a fresh user pause. Every operation brackets
22
+ // itself with begin/end, so `isMemoryOperationInFlight()` is true for the whole
23
+ // pause→evaluate→resume window — the one synchronous fact both layers agree on.
24
+ let memoryOpsInFlight = 0;
25
+ /** True while any memory round-trip (manual or auto) is mid-flight. */
26
+ function isMemoryOperationInFlight() {
27
+ return memoryOpsInFlight > 0;
28
+ }
29
+ function beginMemoryOp() {
30
+ memoryOpsInFlight += 1;
31
+ }
32
+ function endMemoryOp() {
33
+ memoryOpsInFlight = Math.max(0, memoryOpsInFlight - 1);
34
+ }
35
+ // ── Presentation state ──────────────────────────────────────────────────────
36
+ /** Most recent snapshot, so a later "Compare" can show it alongside the diff. */
37
+ let lastDashboardSnapshot = null;
38
+ /** The most recent memory snapshot the dashboard rendered, with its timeline (e2e seam). */
39
+ function lastMemorySnapshot() {
40
+ return lastDashboardSnapshot ?? undefined;
41
+ }
42
+ /**
43
+ * Rolling timeline of every snapshot captured this session. The dashboard chart
44
+ * comes alive across repeated (especially autopilot) captures — "watch the leak
45
+ * grow" — instead of always reading "take multiple snapshots". Reset on stop.
46
+ */
47
+ let captureTimeline = [];
48
+ /** Whether the active memory session's runtime reads its heap directly ([PROF-MEMORY-MODE]). */
49
+ let directSession = false;
50
+ /** Whether a snapshot has been captured (so "stop" can report honestly). */
51
+ function hasCapturedSnapshot() {
52
+ return lastDashboardSnapshot !== null;
53
+ }
54
+ /** Drop per-session presentation state (called when tracking stops). */
55
+ function resetCaptureState() {
56
+ lastDashboardSnapshot = null;
57
+ captureTimeline = [];
58
+ directSession = false;
59
+ }
60
+ /** Record the mode of the memory session that just started. */
61
+ function setDirectMemorySession(direct) {
62
+ directSession = direct;
63
+ }
64
+ /** Whether the active memory session reads its heap directly, with no debugger pause. */
65
+ function isDirectMemorySession() {
66
+ return directSession;
67
+ }
68
+ /** The snapshot the dashboard is currently rendering, or null before the first. */
69
+ function currentDashboardSnapshot() {
70
+ return lastDashboardSnapshot;
71
+ }
72
+ /** Replace the snapshot the dashboard renders (the "Compare" baseline). */
73
+ function setDashboardSnapshot(snapshot) {
74
+ lastDashboardSnapshot = snapshot;
75
+ }
76
+ /** The rolling timeline of snapshots this session. */
77
+ function currentTimeline() {
78
+ return captureTimeline;
79
+ }
80
+ /** Append a timeline point for a snapshot (seconds-epoch x-axis the chart reads). */
81
+ function recordTimelinePoint(snapshot) {
82
+ captureTimeline.push({
83
+ timestamp: Date.now() / MS_PER_SECOND,
84
+ currentMemory: snapshot.currentMemory,
85
+ peakMemory: snapshot.peakMemory,
86
+ gcObjects: snapshot.gcObjects,
87
+ });
88
+ }
89
+ //# sourceMappingURL=memory-capture-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-capture-state.js","sourceRoot":"","sources":["../../src/memory-capture-state.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAGA,+DAA+D;AAC/D,MAAM,aAAa,GAAG,IAAI,CAAC;AAE3B,+EAA+E;AAC/E,EAAE;AACF,+DAA+D;AAC/D,kFAAkF;AAClF,iFAAiF;AACjF,gFAAgF;AAChF,gFAAgF;AAEhF,IAAI,iBAAiB,GAAG,CAAC,CAAC;AAE1B,uEAAuE;AACvE;IACE,OAAO,iBAAiB,GAAG,CAAC,CAAC;AAC/B,CAAC;AAED;IACE,iBAAiB,IAAI,CAAC,CAAC;AACzB,CAAC;AAED;IACE,iBAAiB,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,iBAAiB,GAAG,CAAC,CAAC,CAAC;AACzD,CAAC;AAED,+EAA+E;AAE/E,iFAAiF;AACjF,IAAI,qBAAqB,GAAmC,IAAI,CAAC;AAEjE,4FAA4F;AAC5F;IACE,OAAO,qBAAqB,IAAI,SAAS,CAAC;AAC5C,CAAC;AAED;;;;GAIG;AACH,IAAI,eAAe,GAA0B,EAAE,CAAC;AAEhD,gGAAgG;AAChG,IAAI,aAAa,GAAG,KAAK,CAAC;AAE1B,4EAA4E;AAC5E;IACE,OAAO,qBAAqB,KAAK,IAAI,CAAC;AACxC,CAAC;AAED,wEAAwE;AACxE;IACE,qBAAqB,GAAG,IAAI,CAAC;IAC7B,eAAe,GAAG,EAAE,CAAC;IACrB,aAAa,GAAG,KAAK,CAAC;AACxB,CAAC;AAED,+DAA+D;AAC/D,gCAAuC,MAAe;IACpD,aAAa,GAAG,MAAM,CAAC;AACzB,CAAC;AAED,yFAAyF;AACzF;IACE,OAAO,aAAa,CAAC;AACvB,CAAC;AAED,mFAAmF;AACnF;IACE,OAAO,qBAAqB,CAAC;AAC/B,CAAC;AAED,2EAA2E;AAC3E,8BAAqC,QAAiC;IACpE,qBAAqB,GAAG,QAAQ,CAAC;AACnC,CAAC;AAED,sDAAsD;AACtD;IACE,OAAO,eAAe,CAAC;AACzB,CAAC;AAED,qFAAqF;AACrF,6BAAoC,QAAiC;IACnE,eAAe,CAAC,IAAI,CAAC;QACnB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,aAAa;QACrC,aAAa,EAAE,QAAQ,CAAC,aAAa;QACrC,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,SAAS,EAAE,QAAQ,CAAC,SAAS;KAC9B,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,28 @@
1
+ import type { ProfilerStore as Store } from "./store";
2
+ /** The running LSP client handle. */
3
+ export type LspClient = NonNullable<Store["client"]["value"]>;
4
+ /** Everything one staged memory round-trip needs. */
5
+ export interface MemoryOperation {
6
+ readonly store: Store;
7
+ readonly command: string;
8
+ readonly extraArgs: Record<string, unknown>;
9
+ readonly report: (message: string) => void;
10
+ /** Suppress user-facing warnings (the autopilot captures silently). */
11
+ readonly quiet: boolean;
12
+ }
13
+ /** The running client and the memory session it tracks. */
14
+ export interface ActiveMemorySession {
15
+ readonly client: LspClient;
16
+ readonly memorySessionId: string;
17
+ }
18
+ /** The acquired-frame context one round-trip evaluates against. */
19
+ export interface OperationContext extends ActiveMemorySession {
20
+ readonly frameId: number;
21
+ }
22
+ /** Show `message` unless the operation captures silently. */
23
+ export declare function warnUnlessQuiet(op: MemoryOperation, message: string): void;
24
+ /**
25
+ * Resolve the running client + active memory session, or null (warning unless
26
+ * `quiet`) when the LSP is down or tracking is not active.
27
+ */
28
+ export declare function resolveActiveSession(op: MemoryOperation): ActiveMemorySession | null;
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.warnUnlessQuiet = warnUnlessQuiet;
37
+ exports.resolveActiveSession = resolveActiveSession;
38
+ // Implements [PROF-UI-MEMORY]. See docs/specs/LSP-PROFILER-SPEC.md
39
+ const vscode = __importStar(require("vscode"));
40
+ const ids_1 = require("./ids");
41
+ /** Show `message` unless the operation captures silently. */
42
+ function warnUnlessQuiet(op, message) {
43
+ if (!op.quiet) {
44
+ void vscode.window.showWarningMessage(message);
45
+ }
46
+ }
47
+ /**
48
+ * Resolve the running client + active memory session, or null (warning unless
49
+ * `quiet`) when the LSP is down or tracking is not active.
50
+ */
51
+ function resolveActiveSession(op) {
52
+ const client = op.store.client.value;
53
+ if (client === undefined || !client.isRunning()) {
54
+ return notConnected(op);
55
+ }
56
+ const { memorySessionId } = op.store.profiler.value;
57
+ if (op.store.profiler.value.memory !== "active" || memorySessionId === undefined) {
58
+ warnUnlessQuiet(op, `${(0, ids_1.brand)()}: Start memory tracking first.`);
59
+ return null;
60
+ }
61
+ return { client, memorySessionId };
62
+ }
63
+ /** The "LSP not connected" refusal, with a warning unless the op is quiet. */
64
+ function notConnected(op) {
65
+ if (!op.quiet) {
66
+ void vscode.window.showErrorMessage(`${(0, ids_1.brand)()} LSP not connected`);
67
+ }
68
+ return null;
69
+ }
70
+ //# sourceMappingURL=memory-capture-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-capture-types.js","sourceRoot":"","sources":["../../src/memory-capture-types.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mEAAmE;AACnE,MAAY,MAAM,mCAAe;AACjC,+BAA8B;AA2B9B,6DAA6D;AAC7D,yBAAgC,EAAmB,EAAE,OAAe;IAClE,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;QAAC,KAAK,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAAC,CAAC;AACpE,CAAC;AAED;;;GAGG;AACH,8BAAqC,EAAmB;IACtD,MAAM,MAAM,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC;IACrC,IAAI,MAAM,KAAK,SAAS,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,CAAC;QAChD,OAAO,YAAY,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC;IACD,MAAM,EAAE,eAAe,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;IACpD,IAAI,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,KAAK,QAAQ,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;QACjF,eAAe,CAAC,EAAE,EAAE,GAAG,IAAA,WAAK,GAAE,gCAAgC,CAAC,CAAC;QAChE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;AACrC,CAAC;AAED,8EAA8E;AAC9E,SAAS,YAAY,CAAC,EAAmB;IACvC,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;QAAC,KAAK,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,GAAG,IAAA,WAAK,GAAE,oBAAoB,CAAC,CAAC;IAAC,CAAC;IACvF,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * The editor-as-courier memory round-trip and result presentation.
3
+ *
4
+ * The capture engine is split into focused siblings (command ids, shared state,
5
+ * the two round-trip legs, orchestration and presentation) and re-exported here
6
+ * so callers keep one import site. Both the manual commands and the autopilot
7
+ * drive memory through the same primitives, so an auto-capture is
8
+ * byte-for-byte the same flow as a hand-clicked one.
9
+ */
10
+ import type { ProfilerStore as Store } from "./store";
11
+ import type { MemoryIngestResult } from "./memory-dashboard-mapping";
12
+ export { LSP_MEM_CMD, TRACEBACK_DEPTH, memStartTitle } from "./memory-capture-ids";
13
+ export { isMemoryOperationInFlight, lastMemorySnapshot, hasCapturedSnapshot, resetCaptureState, setDirectMemorySession, isDirectMemorySession } from "./memory-capture-state";
14
+ export { ingestOutput, readFinalSnapshot, snapshotCurrentMemory } from "./memory-capture-ingest";
15
+ export { endServerSession } from "./memory-capture-roundtrip";
16
+ export { captureSnapshotAndDiff, presentDiff, presentSnapshot } from "./memory-capture-present";
17
+ export type { CaptureResult } from "./memory-capture-present";
18
+ /**
19
+ * Run one memory operation under a user-facing progress notification (the manual
20
+ * command path: snapshot / diff / gc / references). The pause → evaluate → analyze
21
+ * round-trip takes a beat, so its stages narrate under one notification
22
+ * ([PROF-UI-STATE]).
23
+ */
24
+ export declare function runMemoryScript(store: Store, command: string, extraArgs?: Record<string, unknown>): Promise<MemoryIngestResult | null>;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ // Implements [PROF-UI-MEMORY] + [PROF-UI-AUTOPILOT]. See docs/specs/LSP-PROFILER-SPEC.md
3
+ /**
4
+ * The editor-as-courier memory round-trip and result presentation.
5
+ *
6
+ * The capture engine is split into focused siblings (command ids, shared state,
7
+ * the two round-trip legs, orchestration and presentation) and re-exported here
8
+ * so callers keep one import site. Both the manual commands and the autopilot
9
+ * drive memory through the same primitives, so an auto-capture is
10
+ * byte-for-byte the same flow as a hand-clicked one.
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.presentSnapshot = exports.presentDiff = exports.captureSnapshotAndDiff = exports.endServerSession = exports.snapshotCurrentMemory = exports.readFinalSnapshot = exports.ingestOutput = exports.isDirectMemorySession = exports.setDirectMemorySession = exports.resetCaptureState = exports.hasCapturedSnapshot = exports.lastMemorySnapshot = exports.isMemoryOperationInFlight = exports.memStartTitle = exports.TRACEBACK_DEPTH = exports.LSP_MEM_CMD = void 0;
14
+ exports.runMemoryScript = runMemoryScript;
15
+ const progress_ops_1 = require("./progress-ops");
16
+ const memory_capture_ids_1 = require("./memory-capture-ids");
17
+ const memory_capture_roundtrip_1 = require("./memory-capture-roundtrip");
18
+ var memory_capture_ids_2 = require("./memory-capture-ids");
19
+ Object.defineProperty(exports, "LSP_MEM_CMD", { enumerable: true, get: function () { return memory_capture_ids_2.LSP_MEM_CMD; } });
20
+ Object.defineProperty(exports, "TRACEBACK_DEPTH", { enumerable: true, get: function () { return memory_capture_ids_2.TRACEBACK_DEPTH; } });
21
+ Object.defineProperty(exports, "memStartTitle", { enumerable: true, get: function () { return memory_capture_ids_2.memStartTitle; } });
22
+ var memory_capture_state_1 = require("./memory-capture-state");
23
+ Object.defineProperty(exports, "isMemoryOperationInFlight", { enumerable: true, get: function () { return memory_capture_state_1.isMemoryOperationInFlight; } });
24
+ Object.defineProperty(exports, "lastMemorySnapshot", { enumerable: true, get: function () { return memory_capture_state_1.lastMemorySnapshot; } });
25
+ Object.defineProperty(exports, "hasCapturedSnapshot", { enumerable: true, get: function () { return memory_capture_state_1.hasCapturedSnapshot; } });
26
+ Object.defineProperty(exports, "resetCaptureState", { enumerable: true, get: function () { return memory_capture_state_1.resetCaptureState; } });
27
+ Object.defineProperty(exports, "setDirectMemorySession", { enumerable: true, get: function () { return memory_capture_state_1.setDirectMemorySession; } });
28
+ Object.defineProperty(exports, "isDirectMemorySession", { enumerable: true, get: function () { return memory_capture_state_1.isDirectMemorySession; } });
29
+ var memory_capture_ingest_1 = require("./memory-capture-ingest");
30
+ Object.defineProperty(exports, "ingestOutput", { enumerable: true, get: function () { return memory_capture_ingest_1.ingestOutput; } });
31
+ Object.defineProperty(exports, "readFinalSnapshot", { enumerable: true, get: function () { return memory_capture_ingest_1.readFinalSnapshot; } });
32
+ Object.defineProperty(exports, "snapshotCurrentMemory", { enumerable: true, get: function () { return memory_capture_ingest_1.snapshotCurrentMemory; } });
33
+ var memory_capture_roundtrip_2 = require("./memory-capture-roundtrip");
34
+ Object.defineProperty(exports, "endServerSession", { enumerable: true, get: function () { return memory_capture_roundtrip_2.endServerSession; } });
35
+ var memory_capture_present_1 = require("./memory-capture-present");
36
+ Object.defineProperty(exports, "captureSnapshotAndDiff", { enumerable: true, get: function () { return memory_capture_present_1.captureSnapshotAndDiff; } });
37
+ Object.defineProperty(exports, "presentDiff", { enumerable: true, get: function () { return memory_capture_present_1.presentDiff; } });
38
+ Object.defineProperty(exports, "presentSnapshot", { enumerable: true, get: function () { return memory_capture_present_1.presentSnapshot; } });
39
+ /**
40
+ * Run one memory operation under a user-facing progress notification (the manual
41
+ * command path: snapshot / diff / gc / references). The pause → evaluate → analyze
42
+ * round-trip takes a beat, so its stages narrate under one notification
43
+ * ([PROF-UI-STATE]).
44
+ */
45
+ async function runMemoryScript(store, command, extraArgs = {}) {
46
+ return (0, progress_ops_1.withUserProgress)((0, memory_capture_ids_1.memOpTitle)(command), async (report) => {
47
+ const result = await (0, memory_capture_roundtrip_1.runMemoryOperation)({ store, command, extraArgs, report, quiet: false });
48
+ return result;
49
+ });
50
+ }
51
+ //# sourceMappingURL=memory-capture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-capture.js","sourceRoot":"","sources":["../../src/memory-capture.ts"],"names":[],"mappings":";AAAA,yFAAyF;AACzF;;;;;;;;GAQG;;;;AAEH,iDAAkD;AAGlD,6DAAkD;AAClD,yEAAgE;AAEhE,2DAAmF;AAA1E,iHAAA,WAAW,OAAA;AAAE,qHAAA,eAAe,OAAA;AAAE,mHAAA,aAAa,OAAA;AACpD,+DAA8K;AAArK,iIAAA,yBAAyB,OAAA;AAAE,0HAAA,kBAAkB,OAAA;AAAE,2HAAA,mBAAmB,OAAA;AAAE,yHAAA,iBAAiB,OAAA;AAAE,8HAAA,sBAAsB,OAAA;AAAE,6HAAA,qBAAqB,OAAA;AAC7I,iEAAiG;AAAxF,qHAAA,YAAY,OAAA;AAAE,0HAAA,iBAAiB,OAAA;AAAE,8HAAA,qBAAqB,OAAA;AAC/D,uEAA8D;AAArD,4HAAA,gBAAgB,OAAA;AACzB,mEAAgG;AAAvF,gIAAA,sBAAsB,OAAA;AAAE,qHAAA,WAAW,OAAA;AAAE,yHAAA,eAAe,OAAA;AAG7D;;;;;GAKG;AACI,KAAK,0BACV,KAAY,EACZ,OAAe,EACf,SAAS,GAA4B,EAAE;IAEvC,OAAO,IAAA,+BAAgB,EACrB,IAAA,+BAAU,EAAC,OAAO,CAAC,EACnB,KAAK,EAAE,MAAM,EAAE,EAAE;QACf,MAAM,MAAM,GAAG,MAAM,IAAA,6CAAkB,EAAC,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QAC7F,OAAO,MAAM,CAAC;IAChB,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { MemoryDashboardSnapshot, MemoryDiffData } from "./memory-dashboard";
2
+ /** Build the complete dashboard HTML (exported as an e2e seam). */
3
+ export declare function buildMemoryDashboardHtml(snapshot: MemoryDashboardSnapshot, diff?: MemoryDiffData): string;