@nimblesite/lsp-profiler-ui 0.0.0-stage → 0.3.0

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,207 @@
1
+ "use strict";
2
+ // Implements [PROF-UI-MEMORY], [PROF-PY-MEMORY-FINAL]. See docs/specs/LSP-PROFILER-SPEC.md
3
+ /**
4
+ * Ending memory tracking: a manual stop, and the tracked debug session's end,
5
+ * which turns the run into a visible result. Stopping never silently produces
6
+ * nothing (#146).
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
20
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
21
+ }) : function(o, v) {
22
+ o["default"] = v;
23
+ });
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.clearPendingSnapshotCleanup = clearPendingSnapshotCleanup;
43
+ exports.scheduleSnapshotCleanup = scheduleSnapshotCleanup;
44
+ exports.showActionableToast = showActionableToast;
45
+ exports.handleMemoryStop = handleMemoryStop;
46
+ exports.settleMemoryOnSessionEnd = settleMemoryOnSessionEnd;
47
+ const vscode = __importStar(require("vscode"));
48
+ const ids_1 = require("./ids");
49
+ const logger_1 = require("./logger");
50
+ const failure_1 = require("./failure");
51
+ const profiler_state_1 = require("./profiler-state");
52
+ const memory_dashboard_1 = require("./memory-dashboard");
53
+ const memory_decorations_1 = require("./memory-decorations");
54
+ const memory_capture_1 = require("./memory-capture");
55
+ /**
56
+ * Final-snapshot files awaiting cleanup, keyed by debug-session id. When the
57
+ * user stops tracking *mid-run*, the debuggee's `atexit` hook is still armed and
58
+ * will write its file when the program eventually exits; it is deleted on that
59
+ * session's termination so a manual stop never orphans a temp file
60
+ * ([PROF-PY-MEMORY-FINAL]).
61
+ */
62
+ const pendingSnapshotCleanup = new Map();
63
+ /** Forget every pending cleanup (disposal). */
64
+ function clearPendingSnapshotCleanup() {
65
+ pendingSnapshotCleanup.clear();
66
+ }
67
+ /** Schedule the tracked session's at-exit file for deletion when that session ends. */
68
+ function scheduleSnapshotCleanup(store) {
69
+ const debugSessionId = store.profiler.value.memoryDebugSessionId;
70
+ const finalSnapshotFile = store.profiler.value.memoryFinalSnapshotFile;
71
+ if (debugSessionId !== undefined && finalSnapshotFile !== undefined) {
72
+ pendingSnapshotCleanup.set(debugSessionId, finalSnapshotFile);
73
+ }
74
+ }
75
+ /**
76
+ * Show a toast whose named action is offered as a button — a message must
77
+ * never demand an action it doesn't offer ([PROF-UI-MEMORY], #263).
78
+ * Fire-and-forget: a sticky notification must not block the flow.
79
+ */
80
+ function showActionableToast(message, action, command) {
81
+ void offerToastAction(message, action, command);
82
+ }
83
+ /** Await the toast choice and run the offered command when it is picked. */
84
+ async function offerToastAction(message, action, command) {
85
+ const choice = await vscode.window.showInformationMessage(message, action);
86
+ if (choice === action) {
87
+ await vscode.commands.executeCommand(command);
88
+ }
89
+ }
90
+ /** Settle the UI's tracking state to idle. */
91
+ function handleMemoryStop(store) {
92
+ store.memoryTrackingStopped();
93
+ (0, memory_capture_1.resetCaptureState)();
94
+ (0, memory_decorations_1.clearMemoryDecorations)();
95
+ logger_1.Logger.info("Memory tracking stopped");
96
+ }
97
+ /**
98
+ * A debug session ended. Only the *tracked* session's end finalises the run
99
+ * ([PROF-PY-MEMORY-FINAL], #146); an unrelated session never tears down live
100
+ * tracking. A manually stopped session deletes its orphaned at-exit file.
101
+ */
102
+ function settleMemoryOnSessionEnd(store, session) {
103
+ if ((0, profiler_state_1.isMemoryBusy)(store.profiler.value) && isTrackedSession(store, session)) {
104
+ pendingSnapshotCleanup.delete(session.id);
105
+ void finalizeMemorySessionOnEnd(store);
106
+ return;
107
+ }
108
+ const orphan = pendingSnapshotCleanup.get(session.id);
109
+ if (orphan !== undefined) {
110
+ pendingSnapshotCleanup.delete(session.id);
111
+ // Reads + unlinks; the payload is discarded.
112
+ void (0, memory_capture_1.readFinalSnapshot)(orphan);
113
+ }
114
+ }
115
+ /**
116
+ * Whether `session` is the tracked one. Without a captured session id
117
+ * (`activeDebugSession` was momentarily undefined at start, memui-3), any
118
+ * host-debug-type session is: only one memory session exists at a time, so
119
+ * tracking always settles instead of hanging on "Memory: tracking".
120
+ */
121
+ function isTrackedSession(store, session) {
122
+ const trackedId = store.profiler.value.memoryDebugSessionId;
123
+ return trackedId === undefined ? session.type === (0, ids_1.debugType)() : session.id === trackedId;
124
+ }
125
+ /**
126
+ * Finalise a courier session when its debug session ends. A run with no
127
+ * breakpoint has no paused frame to snapshot from, so the start script
128
+ * registered an `atexit` hook that wrote a final snapshot to a file. The
129
+ * tracking state is torn down first so the panel settles, then that file is
130
+ * ingested and presented exactly like a manual snapshot.
131
+ */
132
+ async function finalizeMemorySessionOnEnd(store) {
133
+ if ((0, memory_capture_1.isDirectMemorySession)()) {
134
+ finishDirectRunOnEnd(store);
135
+ return;
136
+ }
137
+ const { memorySessionId, memoryFinalSnapshotFile: finalSnapshotFile } = store.profiler.value;
138
+ handleMemoryStop(store);
139
+ if (memorySessionId === undefined || finalSnapshotFile === undefined) {
140
+ return;
141
+ }
142
+ await presentFinalSnapshotFile(store, memorySessionId, finalSnapshotFile);
143
+ }
144
+ /** Read the at-exit snapshot and present it, warning when it never arrived. */
145
+ async function presentFinalSnapshotFile(store, memorySessionId, finalSnapshotFile) {
146
+ const output = await (0, memory_capture_1.readFinalSnapshot)(finalSnapshotFile);
147
+ if (output === null) {
148
+ warnNoFinalSnapshot();
149
+ return;
150
+ }
151
+ await presentFinalSnapshot(store, memorySessionId, output);
152
+ }
153
+ /** The at-exit snapshot never arrived; say why without claiming it finished. */
154
+ function warnNoFinalSnapshot() {
155
+ // No tracked allocations, or an exit too abrupt for even the SIGTERM/SIGINT
156
+ // hook (a native crash, SIGKILL, os._exit). Never claim it "finished" (ux-1).
157
+ void vscode.window.showInformationMessage(`${(0, ids_1.brand)()}: No final memory snapshot was captured — the program either made no tracked allocations or exited abruptly (a crash, kill, or os._exit). Set a breakpoint and take a snapshot to inspect allocations.`);
158
+ }
159
+ /** A final snapshot was captured at exit, `but` something then went wrong. */
160
+ function warnCapturedBut(but) {
161
+ void vscode.window.showWarningMessage(`${(0, ids_1.brand)()}: Captured a final memory snapshot at exit, but ${but}.`);
162
+ }
163
+ /**
164
+ * The snapshot WAS captured: every failure to turn it into a view is surfaced,
165
+ * never swallowed (memui-2).
166
+ */
167
+ async function presentFinalSnapshot(store, memorySessionId, output) {
168
+ const client = store.client.value;
169
+ if (client?.isRunning() !== true) {
170
+ warnCapturedBut("the language server is not running, so it could not be analyzed");
171
+ return;
172
+ }
173
+ try {
174
+ await presentIngestedSnapshot(client, memorySessionId, output);
175
+ }
176
+ catch (error) {
177
+ logger_1.Logger.warn(`[Memory] final snapshot ingest failed: ${(0, failure_1.errorText)(error)}`);
178
+ warnCapturedBut(`analyzing it failed — ${(0, failure_1.errorText)(error)}`);
179
+ }
180
+ }
181
+ /** The snapshot was captured: turn the ingest reply into the allocation view. */
182
+ async function presentIngestedSnapshot(client, memorySessionId, output) {
183
+ const result = await (0, memory_capture_1.ingestOutput)(client, memorySessionId, output);
184
+ if (result?.kind !== "snapshot") {
185
+ warnCapturedBut("it could not be analyzed into an allocation view");
186
+ return;
187
+ }
188
+ await (0, memory_capture_1.presentSnapshot)(result, { openResultsView: true });
189
+ void vscode.window.showInformationMessage(`${(0, ids_1.brand)()}: Captured a final memory snapshot at exit — opened the allocation view.`);
190
+ }
191
+ /**
192
+ * A direct runtime's heap is gone once its program has ended, so the run's
193
+ * result is the last snapshot taken while it ran: open it, never nothing
194
+ * ([PROF-PY-MEMORY-FINAL], #146).
195
+ */
196
+ function finishDirectRunOnEnd(store) {
197
+ const last = (0, memory_capture_1.lastMemorySnapshot)();
198
+ void (0, memory_capture_1.endServerSession)(store);
199
+ handleMemoryStop(store);
200
+ if (last === undefined) {
201
+ showActionableToast(`${(0, ids_1.brand)()}: The tracked program ended before a memory snapshot was taken.`, "Memory Actions…", (0, ids_1.cmd)("memoryMenu"));
202
+ return;
203
+ }
204
+ (0, memory_dashboard_1.openMemoryDashboard)(last);
205
+ void vscode.window.showInformationMessage(`${(0, ids_1.brand)()}: The tracked program ended — opened its last memory snapshot.`);
206
+ }
207
+ //# sourceMappingURL=memory-finalize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-finalize.js","sourceRoot":"","sources":["../../src/memory-finalize.ts"],"names":[],"mappings":";AAAA,2FAA2F;AAC3F;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,MAAY,MAAM,mCAAe;AAEjC,+BAA8C;AAC9C,qCAAkC;AAElC,uCAAsC;AACtC,qDAAgD;AAChD,yDAAyD;AACzD,6DAA8D;AAC9D,qDAQ0B;AAE1B;;;;;;GAMG;AACH,MAAM,sBAAsB,GAAG,IAAI,GAAG,EAAkB,CAAC;AAEzD,+CAA+C;AAC/C;IACE,sBAAsB,CAAC,KAAK,EAAE,CAAC;AACjC,CAAC;AAED,uFAAuF;AACvF,iCAAwC,KAAY;IAClD,MAAM,cAAc,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,oBAAoB,CAAC;IACjE,MAAM,iBAAiB,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,uBAAuB,CAAC;IACvE,IAAI,cAAc,KAAK,SAAS,IAAI,iBAAiB,KAAK,SAAS,EAAE,CAAC;QACpE,sBAAsB,CAAC,GAAG,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;IAChE,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,6BAAoC,OAAe,EAAE,MAAc,EAAE,OAAe;IAClF,KAAK,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAA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CAAC;IAClC,KAAK,IAAA,iCAAgB,EAAC,KAAK,CAAC,CAAC;IAC7B,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACxB,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,mBAAmB,CACjB,GAAG,IAAA,WAAK,GAAE,iEAAiE,EAC3E,iBAAiB,EACjB,IAAA,SAAG,EAAC,YAAY,CAAC,CAClB,CAAC;QACF,OAAO;IACT,CAAC;IACD,IAAA,sCAAmB,EAAC,IAAI,CAAC,CAAC;IAC1B,KAAK,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,GAAG,IAAA,WAAK,GAAE,gEAAgE,CAAC,CAAC;AACxH,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * What memory tracking does next, said in the terms of the runtime it tracks.
3
+ *
4
+ * A courier runtime is captured at each pause; a direct one never is, since a
5
+ * heap the debugger holds paused cannot be read ([PROF-MEMORY-MODE]). Telling a
6
+ * .NET user to "press Continue to auto-capture each pause" sent them looking
7
+ * for captures that never came.
8
+ *
9
+ * Implements [PROF-UI-AUTOPILOT].
10
+ */
11
+ /** The toast tracking opens with; `intervalSecs` while interval capture is on. */
12
+ export declare function trackingGuidance(direct: boolean, intervalSecs: number | undefined): string;
13
+ /** The toast when tracking stops before any snapshot: how to get one next time. */
14
+ export declare function stoppedWithoutSnapshot(direct: boolean): string;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ /**
3
+ * What memory tracking does next, said in the terms of the runtime it tracks.
4
+ *
5
+ * A courier runtime is captured at each pause; a direct one never is, since a
6
+ * heap the debugger holds paused cannot be read ([PROF-MEMORY-MODE]). Telling a
7
+ * .NET user to "press Continue to auto-capture each pause" sent them looking
8
+ * for captures that never came.
9
+ *
10
+ * Implements [PROF-UI-AUTOPILOT].
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.trackingGuidance = trackingGuidance;
14
+ exports.stoppedWithoutSnapshot = stoppedWithoutSnapshot;
15
+ const ids_1 = require("./ids");
16
+ /** A courier runtime's next steps: each pause is captured, and so is the exit. */
17
+ const COURIER_NEXT = "Press Continue to auto-capture each pause, or let the program finish for an automatic final snapshot.";
18
+ /** The toast tracking opens with; `intervalSecs` while interval capture is on. */
19
+ function trackingGuidance(direct, intervalSecs) {
20
+ return `${(0, ids_1.brand)()}: Memory tracking started. ${direct ? directNext(intervalSecs) : COURIER_NEXT}`;
21
+ }
22
+ /** A direct runtime's next steps: read while it runs, never while paused. */
23
+ function directNext(intervalSecs) {
24
+ const reads = intervalSecs === undefined
25
+ ? "Take a snapshot while it runs"
26
+ : `It is captured every ${String(intervalSecs)} s while it runs`;
27
+ return `${reads}, never while paused; when it ends, its last snapshot opens.`;
28
+ }
29
+ /** The toast when tracking stops before any snapshot: how to get one next time. */
30
+ function stoppedWithoutSnapshot(direct) {
31
+ const next = direct
32
+ ? "Take a snapshot while the program runs, never while paused"
33
+ : "Take a snapshot while paused, or let the program finish";
34
+ return `${(0, ids_1.brand)()}: Memory tracking stopped — no snapshot was taken. ${next}, to inspect allocations.`;
35
+ }
36
+ //# sourceMappingURL=memory-guidance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-guidance.js","sourceRoot":"","sources":["../../src/memory-guidance.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;AAEH,+BAA8B;AAE9B,kFAAkF;AAClF,MAAM,YAAY,GAChB,uGAAuG,CAAC;AAE1G,kFAAkF;AAClF,0BAAiC,MAAe,EAAE,YAAgC;IAChF,OAAO,GAAG,IAAA,WAAK,GAAE,8BAA8B,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC;AACpG,CAAC;AAED,6EAA6E;AAC7E,SAAS,UAAU,CAAC,YAAgC;IAClD,MAAM,KAAK,GAAG,YAAY,KAAK,SAAS;QACtC,CAAC,CAAC,+BAA+B;QACjC,CAAC,CAAC,wBAAwB,MAAM,CAAC,YAAY,CAAC,kBAAkB,CAAC;IACnE,OAAO,GAAG,KAAK,8DAA8D,CAAC;AAChF,CAAC;AAED,mFAAmF;AACnF,gCAAuC,MAAe;IACpD,MAAM,IAAI,GAAG,MAAM;QACjB,CAAC,CAAC,4DAA4D;QAC9D,CAAC,CAAC,yDAAyD,CAAC;IAC9D,OAAO,GAAG,IAAA,WAAK,GAAE,sDAAsD,IAAI,2BAA2B,CAAC;AACzG,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { ProfilerStore as Store } from "./store";
2
+ import type { MemoryIngestResult } from "./memory-dashboard-mapping";
3
+ /** Quick-pick menu of memory actions — the clickable alternative to the palette. */
4
+ export declare function handleMemoryMenu(store: Store): Promise<void>;
5
+ export declare function handleMemorySnapshot(store: Store): Promise<void>;
6
+ export declare function handleMemoryDiff(store: Store): Promise<void>;
7
+ export declare function handleMemoryGcCollect(store: Store): Promise<void>;
8
+ /**
9
+ * The toast after a forced collection, in terms every runtime shares: bytes
10
+ * released and, when the runtime reports any, what could not be collected.
11
+ * `collected` is runtime-defined (objects for some, collections observed for
12
+ * others — [PROF-MEMORY-OUTCOME]), so it is never shown as an object count.
13
+ */
14
+ export declare function gcSummary(result: MemoryIngestResult): string;
15
+ /**
16
+ * Show Reference Graph — pick a type from the data-driven Quick Pick (the active
17
+ * file's classes + container builtins) and walk its retainers
18
+ * ([PROF-UI-REFGRAPH]); no blank "type a name" box.
19
+ */
20
+ export declare function handleMemoryReferences(store: Store): Promise<void>;
@@ -0,0 +1,114 @@
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.handleMemoryMenu = handleMemoryMenu;
37
+ exports.handleMemorySnapshot = handleMemorySnapshot;
38
+ exports.handleMemoryDiff = handleMemoryDiff;
39
+ exports.handleMemoryGcCollect = handleMemoryGcCollect;
40
+ exports.gcSummary = gcSummary;
41
+ exports.handleMemoryReferences = handleMemoryReferences;
42
+ // Implements [PROF-UI-MEMORY]. See docs/specs/LSP-PROFILER-SPEC.md
43
+ const vscode = __importStar(require("vscode"));
44
+ const ids_1 = require("./ids");
45
+ const profiler_styles_1 = require("./profiler-styles");
46
+ const memory_capture_1 = require("./memory-capture");
47
+ const memory_ref_picker_1 = require("./memory-ref-picker");
48
+ /** Quick-pick menu of memory actions — the clickable alternative to the palette. */
49
+ async function handleMemoryMenu(store) {
50
+ const tracking = store.profiler.value.memory === "active";
51
+ const items = tracking
52
+ ? [
53
+ { label: "$(device-camera) Take Memory Snapshot", command: (0, ids_1.cmd)("memorySnapshot") },
54
+ { label: "$(diff) Compare Memory Snapshots", command: (0, ids_1.cmd)("memoryDiff") },
55
+ { label: "$(type-hierarchy) Show Reference Graph", command: (0, ids_1.cmd)("memoryReferences") },
56
+ { label: "$(trash) Force Garbage Collection", command: (0, ids_1.cmd)("memoryGcCollect") },
57
+ { label: "$(debug-stop) Stop Memory Tracking", command: (0, ids_1.cmd)("memoryStop") },
58
+ ]
59
+ : [{ label: "$(database) Start Memory Tracking", command: (0, ids_1.cmd)("memoryStart") }];
60
+ const pick = await vscode.window.showQuickPick(items, {
61
+ placeHolder: tracking ? `${(0, ids_1.brand)()} memory profiling` : "Start memory tracking (briefly pauses the program)",
62
+ });
63
+ if (pick !== undefined) {
64
+ await vscode.commands.executeCommand(pick.command);
65
+ }
66
+ }
67
+ async function handleMemorySnapshot(store) {
68
+ const result = await (0, memory_capture_1.runMemoryScript)(store, memory_capture_1.LSP_MEM_CMD.snapshot);
69
+ if (result?.kind === "snapshot") {
70
+ await (0, memory_capture_1.presentSnapshot)(result, { openResultsView: true });
71
+ }
72
+ }
73
+ async function handleMemoryDiff(store) {
74
+ const result = await (0, memory_capture_1.runMemoryScript)(store, memory_capture_1.LSP_MEM_CMD.diff);
75
+ if (result?.kind === "diff") {
76
+ const diff = await (0, memory_capture_1.presentDiff)(result);
77
+ void vscode.window.showInformationMessage(`${(0, ids_1.brand)()}: Compared snapshots — ${String(diff.suspectedLeaks.length)} suspected leak(s)`);
78
+ }
79
+ }
80
+ async function handleMemoryGcCollect(store) {
81
+ const result = await (0, memory_capture_1.runMemoryScript)(store, memory_capture_1.LSP_MEM_CMD.gcCollect);
82
+ if (result?.kind === "gc") {
83
+ void vscode.window.showInformationMessage(gcSummary(result));
84
+ }
85
+ }
86
+ /**
87
+ * The toast after a forced collection, in terms every runtime shares: bytes
88
+ * released and, when the runtime reports any, what could not be collected.
89
+ * `collected` is runtime-defined (objects for some, collections observed for
90
+ * others — [PROF-MEMORY-OUTCOME]), so it is never shown as an object count.
91
+ */
92
+ function gcSummary(result) {
93
+ const freed = (0, profiler_styles_1.formatBytes)(Math.max(0, Number(result.freedBytes ?? 0)));
94
+ const uncollectable = Number(result.uncollectable ?? 0);
95
+ const stuck = uncollectable > 0 ? `; ${String(uncollectable)} object(s) could not be collected` : "";
96
+ return `${(0, ids_1.brand)()}: Garbage collection ran — freed ${freed}${stuck}`;
97
+ }
98
+ /**
99
+ * Show Reference Graph — pick a type from the data-driven Quick Pick (the active
100
+ * file's classes + container builtins) and walk its retainers
101
+ * ([PROF-UI-REFGRAPH]); no blank "type a name" box.
102
+ */
103
+ async function handleMemoryReferences(store) {
104
+ if (store.profiler.value.memory !== "active") {
105
+ void vscode.window.showWarningMessage(`${(0, ids_1.brand)()}: Start memory tracking first.`);
106
+ return;
107
+ }
108
+ const typeName = await (0, memory_ref_picker_1.pickReferenceType)();
109
+ if (typeName === undefined || typeName.trim() === "") {
110
+ return;
111
+ }
112
+ await (0, memory_ref_picker_1.walkReferences)(store, typeName.trim());
113
+ }
114
+ //# sourceMappingURL=memory-inspect-commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-inspect-commands.js","sourceRoot":"","sources":["../../src/memory-inspect-commands.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mEAAmE;AACnE,MAAY,MAAM,mCAAe;AACjC,+BAAmC;AAGnC,uDAAgD;AAChD,qDAA8F;AAC9F,2DAAwE;AAExE,oFAAoF;AAC7E,KAAK,2BAA2B,KAAY;IACjD,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC;IAC1D,MAAM,KAAK,GAAyC,QAAQ;QAC1D,CAAC,CAAC;YACE,EAAE,KAAK,EAAE,uCAAuC,EAAE,OAAO,EAAE,IAAA,SAAG,EAAC,gBAAgB,CAAC,EAAE;YAClF,EAAE,KAAK,EAAE,kCAAkC,EAAE,OAAO,EAAE,IAAA,SAAG,EAAC,YAAY,CAAC,EAAE;YACzE,EAAE,KAAK,EAAE,wCAAwC,EAAE,OAAO,EAAE,IAAA,SAAG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AI,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QAAC,OAAO;IAAC,CAAC;IACjE,MAAM,IAAA,kCAAc,EAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,12 @@
1
+ import * as vscode from "vscode";
2
+ import type { ProfilerStore as Store } from "./store";
3
+ /** Whether every runtime the server advertises memory for reads its heap directly. */
4
+ export declare function memoryIsDirectEverywhere(store: Store): boolean;
5
+ /**
6
+ * "Run & Track Memory" for a direct runtime ([PROF-MEMORY-MODE]): nothing has
7
+ * to pause, so tracking starts as soon as the debuggee reports its process, and
8
+ * a baseline snapshot is taken so the run always has a result to show (#146).
9
+ * Each pass after that is captured when the program continues
10
+ * ([PROF-UI-AUTOPILOT]).
11
+ */
12
+ export declare function startDirectTrackingOnLaunch(store: Store, session: vscode.DebugSession): Promise<void>;
@@ -0,0 +1,74 @@
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.memoryIsDirectEverywhere = memoryIsDirectEverywhere;
37
+ exports.startDirectTrackingOnLaunch = startDirectTrackingOnLaunch;
38
+ // Implements [PROF-UI-MEMORY], [PROF-UI-PROCESSES] (memory leg). See docs/specs/LSP-PROFILER-SPEC.md
39
+ const vscode = __importStar(require("vscode"));
40
+ const ids_1 = require("./ids");
41
+ const progress_ops_1 = require("./progress-ops");
42
+ const profiler_launch_1 = require("./profiler-launch");
43
+ const memory_guidance_1 = require("./memory-guidance");
44
+ const memory_autopilot_1 = require("./memory-autopilot");
45
+ const memory_capture_1 = require("./memory-capture");
46
+ const memory_start_core_1 = require("./memory-start-core");
47
+ /** Whether every runtime the server advertises memory for reads its heap directly. */
48
+ function memoryIsDirectEverywhere(store) {
49
+ const runtimes = (store.capabilities.value?.runtimes ?? []).filter((runtime) => runtime.memory !== undefined);
50
+ return runtimes.length > 0 && runtimes.every((runtime) => runtime.memory?.mode.kind === "Direct");
51
+ }
52
+ /**
53
+ * "Run & Track Memory" for a direct runtime ([PROF-MEMORY-MODE]): nothing has
54
+ * to pause, so tracking starts as soon as the debuggee reports its process, and
55
+ * a baseline snapshot is taken so the run always has a result to show (#146).
56
+ * Each pass after that is captured when the program continues
57
+ * ([PROF-UI-AUTOPILOT]).
58
+ */
59
+ async function startDirectTrackingOnLaunch(store, session) {
60
+ await (0, progress_ops_1.withUserProgress)((0, memory_capture_1.memStartTitle)(), async (report) => {
61
+ report("Waiting for the program to start…");
62
+ const pid = (await (0, profiler_launch_1.waitForDebuggeePid)(store, session.id)) ? store.getDebuggeeProcessId(session.id) : undefined;
63
+ if (pid === undefined) {
64
+ void vscode.window.showWarningMessage(`${(0, ids_1.brand)()}: The program never reported its process — track its memory from its row in the Processes panel.`);
65
+ return;
66
+ }
67
+ if (!(await (0, memory_start_core_1.handleMemoryStart)(store, report, pid))) {
68
+ return;
69
+ }
70
+ await (0, memory_capture_1.captureSnapshotAndDiff)(store, report);
71
+ void vscode.window.showInformationMessage((0, memory_guidance_1.trackingGuidance)(true, (0, memory_autopilot_1.captureIntervalSeconds)()));
72
+ });
73
+ }
74
+ //# sourceMappingURL=memory-launch-direct.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-launch-direct.js","sourceRoot":"","sources":["../../src/memory-launch-direct.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qGAAqG;AACrG,MAAY,MAAM,mCAAe;AACjC,+BAA8B;AAE9B,iDAAkD;AAClD,uDAAuD;AACvD,uDAAqD;AACrD,yDAA4D;AAC5D,qDAAyE;AACzE,2DAAwD;AAExD,sFAAsF;AACtF,kCAAyC,KAAY;IACnD,MAAM,QAAQ,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC;IAC9G,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;AACpG,CAAC;AAED;;;;;;GAMG;AACI,KAAK,sCAAsC,KAAY,EAAE,OAA4B;IAC1F,MAAM,IAAA,+BAAgB,EAAC,IAAA,8BAAa,GAAE,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACvD,MAAM,CAAC,mCAAmC,CAAC,CAAC;QAC5C,MAAM,GAAG,GAAG,CAAC,MAAM,IAAA,oCAAkB,EAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC/G,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtB,KAAK,MAAM,CAAC,MAAM,CAAC,kBAAkB,CACnC,GAAG,IAAA,WAAK,GAAE,kGAAkG,CAC7G,CAAC;YACF,OAAO;QACT,CAAC;QACD,IAAI,CAAC,CAAC,MAAM,IAAA,qCAAiB,EAAC,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;YAAC,OAAO;QAAC,CAAC;QAC/D,MAAM,IAAA,uCAAsB,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAC5C,KAAK,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,IAAA,kCAAgB,EAAC,IAAI,EAAE,IAAA,yCAAsB,GAAE,CAAC,CAAC,CAAC;IAC9F,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,4 @@
1
+ import * as vscode from "vscode";
2
+ import type { ProfilerStore as Store } from "./store";
3
+ /** "Run & Track Memory (Current File)" (#82): track a launch that asked for it. */
4
+ export declare function trackMemoryOnLaunch(store: Store, session: vscode.DebugSession): void;
@@ -0,0 +1,92 @@
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.trackMemoryOnLaunch = trackMemoryOnLaunch;
37
+ // Implements [PROF-UI-MEMORY], [PROF-UI-PROCESSES] (memory leg). See docs/specs/LSP-PROFILER-SPEC.md
38
+ const vscode = __importStar(require("vscode"));
39
+ const ids_1 = require("./ids");
40
+ const logger_1 = require("./logger");
41
+ const dap_evaluate_1 = require("./dap-evaluate");
42
+ const progress_ops_1 = require("./progress-ops");
43
+ const memory_capture_1 = require("./memory-capture");
44
+ const memory_start_core_1 = require("./memory-start-core");
45
+ const memory_launch_direct_1 = require("./memory-launch-direct");
46
+ /** "Run & Track Memory (Current File)" (#82): track a launch that asked for it. */
47
+ function trackMemoryOnLaunch(store, session) {
48
+ if (session.type === (0, ids_1.debugType)() && session.configuration.memoryTrackOnLaunch === true) {
49
+ void startMemoryTrackingOnLaunch(store, session);
50
+ }
51
+ }
52
+ /**
53
+ * Memory tracking on a courier runtime needs a paused debuggee
54
+ * ([PROF-UI-MEMORY]), so the launch config sets `stopOnEntry`; the tracker is
55
+ * injected at the entry pause and the debuggee resumed. With a breakpoint set,
56
+ * the autopilot then captures each pass ([PROF-UI-AUTOPILOT]); with none, a
57
+ * final snapshot opens at exit ([PROF-PY-MEMORY-FINAL]).
58
+ */
59
+ async function startMemoryTrackingOnLaunch(store, session) {
60
+ if ((0, memory_launch_direct_1.memoryIsDirectEverywhere)(store)) {
61
+ await (0, memory_launch_direct_1.startDirectTrackingOnLaunch)(store, session);
62
+ return;
63
+ }
64
+ // One notification spans the whole auto-start ([PROF-UI-STATE]).
65
+ await (0, progress_ops_1.withUserProgress)((0, memory_capture_1.memStartTitle)(), async (report) => { await trackFromEntryPause(store, report); });
66
+ }
67
+ /** Start tracking at the launch's entry pause, then resume the program. */
68
+ async function trackFromEntryPause(store, report) {
69
+ report("Waiting for the program to pause at entry…");
70
+ if ((await (0, dap_evaluate_1.waitForStoppedFrame)()) === null) {
71
+ void vscode.window.showWarningMessage(`${(0, ids_1.brand)()}: The debuggee did not pause at entry — pause at a breakpoint, then start memory tracking.`);
72
+ return;
73
+ }
74
+ if (!(await (0, memory_start_core_1.handleMemoryStart)(store, report))) {
75
+ return;
76
+ }
77
+ logger_1.Logger.info("Memory tracking started on launch — resuming the debuggee");
78
+ void vscode.window.showInformationMessage(launchTrackingMessage());
79
+ report("Resuming the program…");
80
+ await vscode.commands.executeCommand("workbench.action.debug.continue");
81
+ }
82
+ /**
83
+ * The outcome, stated up front so the toast never points nowhere: a run with a
84
+ * breakpoint auto-captures each pass ([PROF-UI-AUTOPILOT]); one without
85
+ * finalises at exit ([PROF-PY-MEMORY-FINAL], #146).
86
+ */
87
+ function launchTrackingMessage() {
88
+ return vscode.debug.breakpoints.length > 0
89
+ ? `${(0, ids_1.brand)()}: Tracking memory — press Continue and each pause is captured automatically.`
90
+ : `${(0, ids_1.brand)()}: Tracking memory — a final snapshot opens automatically when the program finishes.`;
91
+ }
92
+ //# sourceMappingURL=memory-launch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory-launch.js","sourceRoot":"","sources":["../../src/memory-launch.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qGAAqG;AACrG,MAA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IACzE,KAAK,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,qBAAqB,EAAE,CAAC,CAAC;IACnE,MAAM,CAAC,uBAAuB,CAAC,CAAC;IAChC,MAAM,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC,iCAAiC,CAAC,CAAC;AAC1E,CAAC;AAED;;;;GAIG;AACH,SAAS,qBAAqB;IAC5B,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC;QACxC,CAAC,CAAC,GAAG,IAAA,WAAK,GAAE,8EAA8E;QAC1F,CAAC,CAAC,GAAG,IAAA,WAAK,GAAE,qFAAqF,CAAC;AACtG,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Which suspected leak the autopilot offers, and how the offer names it.
3
+ *
4
+ * A runtime reports a leak's type, its source line, both or neither: a .NET
5
+ * `byte[]` grown by user code has a type and no line of its own. The offer
6
+ * named every leak by `file:line`, so a type-only leak read "Suspected memory
7
+ * leak at :0". It now names what the runtime reported, and among equally
8
+ * confident leaks it offers one the user can open at its line.
9
+ *
10
+ * Implements [PROF-UI-AUTOPILOT].
11
+ */
12
+ import type { SuspectedLeak } from "./memory-decorations";
13
+ /** Whether the runtime placed `leak` on a source line. */
14
+ export declare function isLocated(leak: SuspectedLeak): boolean;
15
+ /** The leak to offer: the most confident, and among equals one with a source line. */
16
+ export declare function leakToOffer(leaks: readonly SuspectedLeak[]): SuspectedLeak | undefined;
17
+ /** How an offer names `leak`: its type and its source line, as far as the runtime reported them. */
18
+ export declare function describeLeak(leak: SuspectedLeak): string;