@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,188 @@
1
+ "use strict";
2
+ // Implements [PROF-UI-PROCESSES]. See docs/specs/LSP-PROFILER-SPEC.md
3
+ /**
4
+ * Makes the Processes panel react to the store's profiling state.
5
+ *
6
+ * One `effect` over `store.profiler` drives three things whenever a session
7
+ * starts, streams samples, or stops:
8
+ * 1. the view's native chrome โ€” a live message ("๐Ÿ”ฅ Profiling PID 1234 ยท
9
+ * 12.3K samples (4s)") and a badge dot;
10
+ * 2. the per-activity gating context keys (`<prefix>.profiler.cpuBusy` / `.memoryBusy`,
11
+ * plus the aggregate `.profilerBusy` and `.profiling` / `.memoryTracking` /
12
+ * `.profilerStarting`) that hide the matching "Run & Profile" launch and
13
+ * reveal the Stop affordances in package.json;
14
+ * 3. a tree repaint, so the actively-profiled row swaps its inline Profile
15
+ * button for a Stop button (the marker itself derives from the store's
16
+ * profiler signal inside the provider โ€” no pushed field, #148).
17
+ *
18
+ * The message/badge update on every change (cheap), but the context keys and
19
+ * the tree rebuild only fire when the *gating* state changes โ€” a per-second
20
+ * sample-count tick must not rebuild the whole tree.
21
+ */
22
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
23
+ if (k2 === undefined) k2 = k;
24
+ var desc = Object.getOwnPropertyDescriptor(m, k);
25
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
26
+ desc = { enumerable: true, get: function() { return m[k]; } };
27
+ }
28
+ Object.defineProperty(o, k2, desc);
29
+ }) : (function(o, m, k, k2) {
30
+ if (k2 === undefined) k2 = k;
31
+ o[k2] = m[k];
32
+ }));
33
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
34
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
35
+ }) : function(o, v) {
36
+ o["default"] = v;
37
+ });
38
+ var __importStar = (this && this.__importStar) || (function () {
39
+ var ownKeys = function(o) {
40
+ ownKeys = Object.getOwnPropertyNames || function (o) {
41
+ var ar = [];
42
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
43
+ return ar;
44
+ };
45
+ return ownKeys(o);
46
+ };
47
+ return function (mod) {
48
+ if (mod && mod.__esModule) return mod;
49
+ var result = {};
50
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
51
+ __setModuleDefault(result, mod);
52
+ return result;
53
+ };
54
+ })();
55
+ Object.defineProperty(exports, "__esModule", { value: true });
56
+ exports.bindProcessPanelReactivity = bindProcessPanelReactivity;
57
+ exports.bindDebuggeeTracking = bindDebuggeeTracking;
58
+ exports.panelMessage = panelMessage;
59
+ exports.panelBadge = panelBadge;
60
+ exports.processesViewState = processesViewState;
61
+ const vscode = __importStar(require("vscode"));
62
+ const context_keys_1 = require("./context-keys");
63
+ const ids_1 = require("./ids");
64
+ const signals_core_1 = require("@preact/signals-core");
65
+ const profiler_format_1 = require("./profiler-format");
66
+ /** The live tree view, exposed read-only for the e2e seam below. */
67
+ const boundProcessPanel = { view: undefined };
68
+ /**
69
+ * Bind the panel to the store's profiling state. Returns a disposable that
70
+ * stops the effect and drops the seam reference.
71
+ */
72
+ function bindProcessPanelReactivity(store, treeView, provider) {
73
+ boundProcessPanel.view = treeView;
74
+ const regate = onGateChange(provider);
75
+ const disposeEffect = (0, signals_core_1.effect)(() => {
76
+ const session = store.profiler.value;
77
+ // Cheap, every change: the live readout above the tree.
78
+ treeView.message = panelMessage(session);
79
+ treeView.badge = panelBadge(session);
80
+ regate(session);
81
+ });
82
+ return { dispose() { disposeEffect(); boundProcessPanel.view = undefined; } };
83
+ }
84
+ /** The expensive leg (context keys + tree rebuild), run only on gating transitions. */
85
+ function onGateChange(provider) {
86
+ let lastGate = "";
87
+ return (session) => {
88
+ const gate = `${session.cpu}|${String(session.cpuPid ?? "")}|${session.memory}`;
89
+ if (gate === lastGate) {
90
+ return;
91
+ }
92
+ lastGate = gate;
93
+ applyContextKeys(session);
94
+ provider.refresh();
95
+ };
96
+ }
97
+ /**
98
+ * Keep the store's "which PID is the active debuggee" marker in sync, so only
99
+ * that row exposes the inline Track Memory action ([PROF-UI-PROCESSES]).
100
+ * Memory tracking rides the DAP courier ([PROF-UI-MEMORY]), so it can only
101
+ * ever target the process of the active host-debug-type session โ€” never an
102
+ * external process in the list. The debuggee changes when the active session
103
+ * changes or when the DAP `process` event resolves its PID into the store's
104
+ * `sessionIdToPid` map, so react to both. Writing the store signal bumps
105
+ * `processesRevision`, which repaints every subscribed panel (#148).
106
+ */
107
+ function bindDebuggeeTracking(store) {
108
+ function update() {
109
+ // Read on every pass, so the effect re-runs when a debuggee PID resolves or clears.
110
+ const pids = store.sessionIdToPid.value;
111
+ const session = vscode.debug.activeDebugSession;
112
+ store.setActiveDebuggeePid(session?.type === (0, ids_1.debugType)() ? pids.get(session.id) : undefined);
113
+ }
114
+ const disposeEffect = (0, signals_core_1.effect)(() => {
115
+ update();
116
+ });
117
+ const subscriptions = [
118
+ vscode.debug.onDidChangeActiveDebugSession(update),
119
+ vscode.debug.onDidStartDebugSession(update),
120
+ vscode.debug.onDidTerminateDebugSession(update),
121
+ ];
122
+ return { dispose() { disposeEffect(); for (const sub of subscriptions) {
123
+ sub.dispose();
124
+ } } };
125
+ }
126
+ /** Push the gating context keys every profiling `when` clause keys off. */
127
+ function applyContextKeys(session) {
128
+ const cpuBusy = session.cpu !== "idle";
129
+ const memoryBusy = session.memory !== "idle";
130
+ // Per-activity gates: CPU starts hide on cpuBusy, memory starts on memoryBusy,
131
+ // so the two metrics can run concurrently while a second SAME-metric start
132
+ // stays blocked ([PROF-UI-PROCESSES]).
133
+ (0, context_keys_1.setContextKey)("cpuBusy", cpuBusy);
134
+ (0, context_keys_1.setContextKey)("memoryBusy", memoryBusy);
135
+ // Aggregate, kept as a convenience key for any "anything running?" consumer.
136
+ (0, context_keys_1.setContextKey)("profilerBusy", cpuBusy || memoryBusy);
137
+ (0, context_keys_1.setContextKey)("profiling", session.cpu === "active");
138
+ (0, context_keys_1.setContextKey)("memoryTracking", session.memory === "active");
139
+ (0, context_keys_1.setContextKey)("profilerStarting", session.cpu === "starting" || session.memory === "starting");
140
+ }
141
+ /**
142
+ * The live message shown above the tree, or undefined when idle. Pure so it can
143
+ * be asserted directly; the live view value is read via [`processesViewState`].
144
+ */
145
+ function panelMessage(session) {
146
+ if (session.cpu === "starting") {
147
+ return "โณ Starting CPU profilerโ€ฆ";
148
+ }
149
+ if (session.cpu === "active") {
150
+ return activeCpuMessage(session);
151
+ }
152
+ if (session.memory === "starting") {
153
+ return "โณ Starting memory trackingโ€ฆ";
154
+ }
155
+ if (session.memory === "active") {
156
+ return "๐Ÿ—„๏ธ Tracking memory allocationsโ€ฆ";
157
+ }
158
+ return undefined;
159
+ }
160
+ /** The live CPU readout while a session is active. */
161
+ function activeCpuMessage(session) {
162
+ const head = `๐Ÿ”ฅ Profiling PID ${String(session.cpuPid ?? "?")}`;
163
+ if (session.sampleCount > 0) {
164
+ const live = `${(0, profiler_format_1.formatSampleCount)(session.sampleCount)} samples (${(0, profiler_format_1.formatProfileDuration)(session.durationSecs)})`;
165
+ const top = session.topFunction !== undefined && session.topFunction !== ""
166
+ ? ` ยท ${session.topFunction}`
167
+ : "";
168
+ return `${head} ยท ${live}${top}`;
169
+ }
170
+ return `${head}โ€ฆ`;
171
+ }
172
+ /** A badge dot while busy (its tooltip mirrors the message), else none. */
173
+ function panelBadge(session) {
174
+ const message = panelMessage(session);
175
+ if (message === undefined) {
176
+ return undefined;
177
+ }
178
+ return { value: 1, tooltip: message };
179
+ }
180
+ /**
181
+ * The panel's live chrome, or `undefined`s when idle. E2e seam for
182
+ * [PROF-UI-PROCESSES]: TreeView message/badge are not otherwise
183
+ * readable once the view is owned by VS Code.
184
+ */
185
+ function processesViewState() {
186
+ return { message: boundProcessPanel.view?.message, badge: boundProcessPanel.view?.badge?.value };
187
+ }
188
+ //# sourceMappingURL=process-reactivity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-reactivity.js","sourceRoot":"","sources":["../../src/process-reactivity.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE;;;;;;;;;;;;;;;;;;GAkBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,MAAY,MAAM,mCAAe;AACjC,iDAA+C;AAC/C,+BAAkC;AAClC,uDAA8C;AAI9C,uDAA6E;AAE7E,oEAAoE;AACpE,MAAM,iBAAiB,GAAmD,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;AAE9F;;;GAGG;AACH,oCACE,KAAY,EACZ,QAAkC,EAClC,QAA2B;I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B;IACjD,MAAM,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IACtC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAAC,OAAO,SAAS,CAAC;IAAC,CAAC;IAChD,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AACxC,CAAC;AAED;;;;GAIG;AACH;IACE,OAAO,EAAE,OAAO,EAAE,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,iBAAiB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;AACnG,CAAC"}
@@ -0,0 +1,11 @@
1
+ import * as vscode from "vscode";
2
+ import { ProcessesProvider } from "./process-explorer";
3
+ import type { ProfilerStore as Store } from "./store";
4
+ /**
5
+ * Register the Processes panel. Returns command disposables for
6
+ * `singletonDisposables`; the tree view and provider go to subscriptions.
7
+ */
8
+ export declare function registerProcessesView(context: vscode.ExtensionContext, store: Store): {
9
+ provider: ProcessesProvider;
10
+ disposables: vscode.Disposable[];
11
+ };
@@ -0,0 +1,55 @@
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.registerProcessesView = registerProcessesView;
37
+ // Implements [PROF-UI-PROCESSES]. See docs/specs/LSP-PROFILER-SPEC.md
38
+ const vscode = __importStar(require("vscode"));
39
+ const ids_1 = require("./ids");
40
+ const process_explorer_1 = require("./process-explorer");
41
+ const process_launch_1 = require("./process-launch");
42
+ const process_commands_1 = require("./process-commands");
43
+ const process_bind_panel_1 = require("./process-bind-panel");
44
+ /**
45
+ * Register the Processes panel. Returns command disposables for
46
+ * `singletonDisposables`; the tree view and provider go to subscriptions.
47
+ */
48
+ function registerProcessesView(context, store) {
49
+ const provider = new process_explorer_1.ProcessesProvider(store);
50
+ const treeView = vscode.window.createTreeView((0, ids_1.viewId)(), { treeDataProvider: provider });
51
+ context.subscriptions.push(treeView, provider);
52
+ (0, process_bind_panel_1.bindPanel)(store, treeView, provider);
53
+ return { provider, disposables: [...(0, process_launch_1.registerLaunchCommands)(store, treeView), ...(0, process_commands_1.registerViewCommands)(store, provider)] };
54
+ }
55
+ //# sourceMappingURL=process-registration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-registration.js","sourceRoot":"","sources":["../../src/process-registration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAAsE;AACtE,MAAY,MAAM,mCAAe;AACjC,+BAA+B;AAC/B,yDAAuD;AACvD,qDAA0D;AAC1D,yDAA0D;AAC1D,6DAAiD;AAGjD;;;GAGG;AACH,+BACE,OAAgC,EAChC,KAAY;IAEZ,MAAM,QAAQ,GAAG,IAAI,oCAAiB,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,IAAA,YAAM,GAAE,EAAE,EAAE,gBAAgB,EAAE,QAAQ,EAAE,CAAC,CAAC;IACxF,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC/C,IAAA,8BAAS,EAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACrC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,GAAG,IAAA,uCAAsB,EAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,GAAG,IAAA,uCAAoB,EAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC;AAC3H,CAAC"}
@@ -0,0 +1,18 @@
1
+ import * as vscode from "vscode";
2
+ import type { ProcessInfo, RowRuntime } from "./process-explorer-rows";
3
+ /** The live state one process row is constructed from. */
4
+ export interface ProcessTreeItemOptions {
5
+ readonly activeProfilingPid?: number;
6
+ readonly activeDebuggeePid?: number;
7
+ readonly runtime?: RowRuntime;
8
+ }
9
+ /**
10
+ * A single process row. Carries the visual cues for [PROF-UI-PROCESSES]:
11
+ * a ๐Ÿšซ-prefixed, greyed, sunk row when not `debuggable`; a green row when
12
+ * `inWorkspace`; a launcher chip; and the flame for the actively-profiled row.
13
+ */
14
+ export declare class ProcessTreeItem extends vscode.TreeItem {
15
+ readonly process: ProcessInfo;
16
+ constructor(process: ProcessInfo, options?: ProcessTreeItemOptions);
17
+ private applyCues;
18
+ }
@@ -0,0 +1,219 @@
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.ProcessTreeItem = void 0;
37
+ // Implements [PROF-UI-PROCESSES]. See docs/specs/LSP-PROFILER-SPEC.md
38
+ const vscode = __importStar(require("vscode"));
39
+ const ids_1 = require("./ids");
40
+ const BYTES_PER_UNIT = 1024;
41
+ const MEMORY_UNITS = ["B", "KB", "MB", "GB", "TB"];
42
+ const SECONDS_PER_MINUTE = 60;
43
+ const SECONDS_PER_HOUR = 3600;
44
+ /** Human-readable memory size, e.g. `88 MB`. */
45
+ function formatBytes(bytes) {
46
+ if (bytes <= 0) {
47
+ return "0 B";
48
+ }
49
+ const exponent = Math.min(Math.floor(Math.log(bytes) / Math.log(BYTES_PER_UNIT)), MEMORY_UNITS.length - 1);
50
+ const value = bytes / BYTES_PER_UNIT ** exponent;
51
+ const rounded = exponent === 0 ? value : Math.round(value);
52
+ return `${String(rounded)} ${MEMORY_UNITS[exponent]}`;
53
+ }
54
+ /** Human-readable elapsed runtime, e.g. `3m`, `2h 14m`. */
55
+ function formatRuntime(seconds) {
56
+ if (seconds < SECONDS_PER_MINUTE) {
57
+ return `${String(seconds)}s`;
58
+ }
59
+ if (seconds < SECONDS_PER_HOUR) {
60
+ return `${String(Math.floor(seconds / SECONDS_PER_MINUTE))}m`;
61
+ }
62
+ const hours = Math.floor(seconds / SECONDS_PER_HOUR);
63
+ const minutes = Math.floor((seconds % SECONDS_PER_HOUR) / SECONDS_PER_MINUTE);
64
+ return `${String(hours)}h ${String(minutes)}m`;
65
+ }
66
+ /** Final path component, used to render a script's basename. */
67
+ function basename(path) {
68
+ const lastSep = Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\"));
69
+ return lastSep >= 0 ? path.slice(lastSep + 1) : path;
70
+ }
71
+ /** ๐Ÿšซ marker prefixed to the label of a process the profiler can't attach to. */
72
+ const BLOCKED_MARK = "๐Ÿšซ ";
73
+ /**
74
+ * A single process row. Carries the visual cues for [PROF-UI-PROCESSES]:
75
+ * a ๐Ÿšซ-prefixed, greyed, sunk row when not `debuggable`; a green row when
76
+ * `inWorkspace`; a launcher chip; and the flame for the actively-profiled row.
77
+ */
78
+ class ProcessTreeItem extends vscode.TreeItem {
79
+ process;
80
+ constructor(process, options = {}) {
81
+ super(rowLabel(process), vscode.TreeItemCollapsibleState.None);
82
+ this.process = process;
83
+ const rowRuntime = options.runtime ?? { directMemory: false, name: process.runtime, sourceEntries: false };
84
+ // Stable identity across the 2s auto-refresh, or VS Code can fail to map an
85
+ // inline-button click to a recreated element and pass no argument (#79).
86
+ this.id = `process:${String(process.pid)}`;
87
+ this.applyCues(process, rowRuntime, { activeProfilingPid: options.activeProfilingPid, activeDebuggeePid: options.activeDebuggeePid });
88
+ }
89
+ applyCues(process, runtime, pids) {
90
+ const { profilingThis, tracksMemory, memoryTrackable } = rowState(process, runtime, pids);
91
+ this.description = rowDescription(process, profilingThis);
92
+ this.tooltip = rowTooltip(process, runtime.name, { profilingThis, memoryNeedsLaunch: tracksMemory && !memoryTrackable });
93
+ this.iconPath = processIcon(process, profilingThis);
94
+ this.contextValue = rowContextValue(process, profilingThis, memoryTrackable);
95
+ // The decoration provider colours the label from this URI ([PROF-UI-PROCESSES]).
96
+ this.resourceUri = processResourceUri(process);
97
+ this.command = entryCommand(process, runtime);
98
+ }
99
+ }
100
+ exports.ProcessTreeItem = ProcessTreeItem;
101
+ /** The row's label: name and entry script, ๐Ÿšซ-prefixed when it cannot be profiled. */
102
+ function rowLabel(process) {
103
+ const base = process.script === null ? process.name : `${process.name} โ€” ${basename(process.script)}`;
104
+ return process.debuggable ? base : `${BLOCKED_MARK}${base}`;
105
+ }
106
+ function rowState(process, runtime, pids) {
107
+ const tracksMemory = runtime.memory !== false;
108
+ const debuggee = pids.activeDebuggeePid !== undefined && pids.activeDebuggeePid === process.pid;
109
+ return {
110
+ profilingThis: pids.activeProfilingPid !== undefined && pids.activeProfilingPid === process.pid,
111
+ tracksMemory,
112
+ memoryTrackable: tracksMemory && (debuggee || (runtime.directMemory && process.debuggable)),
113
+ };
114
+ }
115
+ /**
116
+ * Clicking opens the entry only when the runtime says it is source the editor
117
+ * can show โ€” never a native binary or an assembly ([PROF-UI-CAPABILITIES]).
118
+ */
119
+ function entryCommand(process, runtime) {
120
+ if (process.script === null || !runtime.sourceEntries) {
121
+ return undefined;
122
+ }
123
+ return { command: "vscode.open", title: "Reveal Script", arguments: [vscode.Uri.file(process.script)] };
124
+ }
125
+ /** A synthetic URI encoding the row's workspace + debuggability for decoration. */
126
+ function processResourceUri(process) {
127
+ const ws = process.inWorkspace ? "1" : "0";
128
+ const dbg = process.debuggable ? "1" : "0";
129
+ return vscode.Uri.from({ scheme: (0, ids_1.processUriScheme)(), path: `/${String(process.pid)}`, query: `ws=${ws}&dbg=${dbg}` });
130
+ }
131
+ /** The launcher chip (`[uvicorn] `) for a row's description, or empty. */
132
+ function launcherChip(process) {
133
+ return process.launcher === null ? "" : `[${process.launcher}] `;
134
+ }
135
+ /** The description line: launcher chip, then the key live metrics. */
136
+ function rowDescription(process, profilingThis) {
137
+ const version = process.runtimeVersion ?? "โ€”";
138
+ const profilingSuffix = profilingThis ? " ยท profiling" : "";
139
+ return `${launcherChip(process)}PID ${String(process.pid)} ยท ${version} ยท ${process.cpuPercent.toFixed(1)}% ยท ${formatBytes(process.memoryBytes)}${profilingSuffix}`;
140
+ }
141
+ /**
142
+ * The row's contextValue, which selects its package.json affordances:
143
+ * `blockedProcess` (no Profile/Track actions โ€” the panel already says
144
+ * "Can't profile", so the menus must not offer an attach that is known to fail,
145
+ * #266), `processProfiling` (Stop), `processDebuggee` (Track Memory
146
+ * enabled), `processElevated` (lock), or plain `process`. The
147
+ * profiling clauses match `/^process/`, which `blockedProcess`
148
+ * deliberately does not.
149
+ */
150
+ function rowContextValue(process, profilingThis, memoryTrackable) {
151
+ if (!process.debuggable) {
152
+ return "blockedProcess";
153
+ }
154
+ if (profilingThis) {
155
+ return "processProfiling";
156
+ }
157
+ if (memoryTrackable) {
158
+ return "processDebuggee";
159
+ }
160
+ return process.requiresElevation ? "processElevated" : "process";
161
+ }
162
+ /** Multi-line hover tooltip surfacing every resolved detail for a process row. */
163
+ function rowTooltip(process, runtimeName, notices) {
164
+ return [...rowFacts(process, runtimeName), ...rowNotices(process, notices.profilingThis, notices.memoryNeedsLaunch)]
165
+ .filter(Boolean).join("\n");
166
+ }
167
+ /** The process as resolved: identity, runtime, load and owner. */
168
+ function rowFacts(process, runtimeName) {
169
+ return [
170
+ `${process.name} (PID ${String(process.pid)})`,
171
+ process.interpreterPath === null ? "" : `Executable: ${process.interpreterPath}`,
172
+ process.script === null ? "" : `Entry: ${process.script}`,
173
+ `${runtimeName}: ${process.runtimeVersion ?? "unknown"}`,
174
+ `CPU: ${process.cpuPercent.toFixed(1)}% ยท Memory: ${formatBytes(process.memoryBytes)}`,
175
+ `Runtime: ${formatRuntime(process.runtimeSecs)}`,
176
+ process.user === null ? "" : `User: ${process.user}`,
177
+ process.launcher === null ? "" : `Launcher: ${process.launcher}`,
178
+ ];
179
+ }
180
+ /**
181
+ * What the profiler can do with the process. An external process is profilable
182
+ * only with elevation. A courier runtime tracks memory only on a process the
183
+ * host launched ([PROF-UI-MEMORY]), so elsewhere the row points at the
184
+ * current-file launch; a runtime with no memory backend suggests nothing
185
+ * ([PROF-UI-CAPABILITIES]).
186
+ */
187
+ function rowNotices(process, profilingThis, memoryNeedsLaunch) {
188
+ return [
189
+ process.inWorkspace ? "๐Ÿ“ Workspace process" : "",
190
+ profilingThis ? `๐Ÿ”ฅ ${(0, ids_1.brand)()} is profiling this process โ€” click Stop to finish` : "",
191
+ !process.debuggable && process.undebuggableReason !== null ? `๐Ÿšซ Can't profile โ€” ${process.undebuggableReason}` : "",
192
+ process.debuggable && process.requiresElevation ? "๐Ÿ”’ Profiling this process will prompt for elevation" : "",
193
+ process.debuggable && memoryNeedsLaunch
194
+ ? `๐Ÿง  Memory tracking needs the process under ${(0, ids_1.brand)()} โ€” use โ€œRun & Track Memory (Current File)โ€`
195
+ : "",
196
+ ];
197
+ }
198
+ /**
199
+ * Leading icon for a process row: the flame while profiling, `circle-slash` when
200
+ * not debuggable, a `lock` when it needs elevation, `rocket` for launchers, else
201
+ * a running-VM glyph. In-workspace debuggable rows are tinted green to match the
202
+ * label decoration.
203
+ */
204
+ function processIcon(process, profilingThis) {
205
+ if (profilingThis) {
206
+ return new vscode.ThemeIcon("flame", new vscode.ThemeColor("statusBarItem.warningBackground"));
207
+ }
208
+ if (!process.debuggable) {
209
+ return new vscode.ThemeIcon("circle-slash", new vscode.ThemeColor("disabledForeground"));
210
+ }
211
+ if (process.requiresElevation) {
212
+ return new vscode.ThemeIcon("lock", new vscode.ThemeColor("list.warningForeground"));
213
+ }
214
+ const glyph = process.launcher === null ? "vm-running" : "rocket";
215
+ return process.inWorkspace
216
+ ? new vscode.ThemeIcon(glyph, new vscode.ThemeColor("charts.green"))
217
+ : new vscode.ThemeIcon(glyph);
218
+ }
219
+ //# sourceMappingURL=process-tree-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process-tree-item.js","sourceRoot":"","sources":["../../src/process-tree-item.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAAsE;AACtE,MAAY,MAAM,mCAAe;AACjC,+BAAgD;AAGhD,MAAM,cAAc,GAAG,IAAI,CAAC;AAC5B,MAAM,YAAY,GAAsB,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACtE,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAC9B,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAE9B,gDAAgD;AAChD,SAAS,WAAW,CAAC,KAAa;IAChC,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QAAC,OAAO,KAAK,CAAC;IAAC,CAAC;IACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CACvB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,EACtD,YAAY,CAAC,MAAM,GAAG,CAAC,CACxB,CAAC;IACF,MAAM,KAAK,GAAG,KAAK,GAAG,cAAc,IAAI,QAAQ,CAAC;IACjD,MAAM,OAAO,GAAG,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC3D,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC;AACxD,CAAC;AAED,2DAA2D;AAC3D,SAAS,aAAa,CAAC,OAAe;IACpC,IAAI,OAAO,GAAG,kBAAkB,EAAE,CAAC;QAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC;IAAC,CAAC;IACnE,IAAI,OAAO,GAA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SAAS,CAAC,KAAK,EAAE,IAAI,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;QACpE,CAAC,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * The centralised, reactive state of the Processes panel (#148).
3
+ *
4
+ * The panel used to own its data privately โ€” `this.processes`, `this.fetched`,
5
+ * sort/group/filter fields โ€” and refresh itself on a panel-local timer. Per the
6
+ * architecture (CLAUDE.md: all mutable state lives in the single store as
7
+ * Signals; no panel polls itself), that state is hoisted here: the store owns
8
+ * one `ProcessPanelState` Signal, the store-side poll (process-poll.ts) feeds
9
+ * it, and the tree provider renders it as a pure projection, subscribing via
10
+ * `subscribeRevision` exactly like the Modules panel.
11
+ *
12
+ * Defined outside store.ts so the store file only grows by the signal wiring,
13
+ * not the type surface and action bodies (the profiler-state.ts pattern).
14
+ */
15
+ import type { Signal } from "@preact/signals-core";
16
+ import type { GroupMode, ProcessInfo, SortMode } from "./process-explorer-rows";
17
+ /**
18
+ * The process-fetch lifecycle, mirrored to the `<prefix>.profiler.processesState` context
19
+ * key so the empty-state welcome never lies: "No processes running" shows
20
+ * only after a fetch actually succeeded (`loaded`), while a still-loading or
21
+ * errored fetch says so honestly ([PROF-UI-PROCESSES], #147).
22
+ */
23
+ export type ProcessesFetchState = "loading" | "loaded" | "error";
24
+ /**
25
+ * Reactive snapshot of everything the Processes panel renders from.
26
+ * Copy-on-write: actions replace the whole object (bumping `revision`) so the
27
+ * backing Signal notifies subscribers.
28
+ */
29
+ export interface ProcessPanelState {
30
+ /** The last process table fetched from the LSP (empty until a fetch lands). */
31
+ readonly list: readonly ProcessInfo[];
32
+ /** Fetch lifecycle behind the welcome's empty/loading/error honesty (#147). */
33
+ readonly fetch: ProcessesFetchState;
34
+ /** Active sort mode (cycled from the title bar). */
35
+ readonly sortMode: SortMode;
36
+ /** Active grouping mode (cycled from the title bar). */
37
+ readonly groupMode: GroupMode;
38
+ /** The user's search filter, pre-normalised (trimmed, lowercased). */
39
+ readonly filterText: string;
40
+ /** PID of the active host debuggee โ€” the only row that can be memory-tracked. */
41
+ readonly activeDebuggeePid: number | undefined;
42
+ /**
43
+ * Monotonic change counter, bumped by every action. Panels subscribe to it via
44
+ * `subscribeRevision` ([PROF-UI-STATE]) and re-render on each bump.
45
+ */
46
+ readonly revision: number;
47
+ }
48
+ /**
49
+ * The initial state: nothing fetched yet, so the welcome honestly says "loading".
50
+ * Rows open grouped by runtime version ([PROF-UI-PROCESSES]).
51
+ */
52
+ export declare const IDLE_PROCESS_PANEL: ProcessPanelState;
53
+ /** The only way to mutate the process-panel state โ€” exposed on the Store. */
54
+ export interface ProcessPanelActions {
55
+ /**
56
+ * A fetch could not run (LSP not running yet). Stays honestly "loading" โ€”
57
+ * never asserting the definitive "no processes" (#147) โ€” and clears any rows
58
+ * from a previous server session so the tree never shows stale processes.
59
+ */
60
+ processesLoading: () => void;
61
+ /** A fetch succeeded; only now is an empty list a genuine "no processes" (#147). */
62
+ processesLoaded: (list: readonly ProcessInfo[]) => void;
63
+ /** A fetch failed โ€” the welcome says "couldn't load", not "no processes" (#147). */
64
+ processesFetchFailed: () => void;
65
+ /** Advance to the next sort mode and return it (for the status-bar hint). */
66
+ cycleProcessSort: () => SortMode;
67
+ /** Advance to the next grouping mode and return it (for the status-bar hint). */
68
+ cycleProcessGroup: () => GroupMode;
69
+ /** Set the search filter (normalised here so every reader sees one form). */
70
+ setProcessFilter: (text: string) => void;
71
+ /** Mark which PID is the active host debuggee; `undefined` clears it. */
72
+ setActiveDebuggeePid: (pid: number | undefined) => void;
73
+ }
74
+ /** Build the process-panel actions over the store's backing Signal. */
75
+ export declare function createProcessPanelActions(panel: Signal<ProcessPanelState>): ProcessPanelActions;