@swmansion/argent 0.12.1 → 0.13.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.
@@ -1,10 +1,19 @@
1
1
  -- Argent — CPU hotspots.
2
2
  --
3
3
  -- One output row per (thread_name, leaf_function) — the leaf frame name IS the
4
- -- dominant function, so one SQL row maps 1:1 to one aggregateCpuHotspots group
5
- -- (we drop leaf_mapping, which was unused and only fragmented the grouping).
4
+ -- dominant function, so one SQL row maps 1:1 to one aggregateCpuHotspots group.
6
5
  -- The aggregator normalises the thread name and applies severity bands.
7
6
  --
7
+ -- We ALSO carry the leaf frame's mapping (the loaded object the symbol lives in,
8
+ -- e.g. `/system/lib64/libhwui.so` for app/framework code or `/kernel` for kernel
9
+ -- frames) through to the classifier. Name patterns alone can't tell `writel`
10
+ -- (a kernel MMIO write) from app code, but the mapping can: a leaf in `/kernel`
11
+ -- is unambiguously system/emulator overhead. To keep one output row per
12
+ -- (thread_name, leaf_function) — so the SQL→aggregator 1:1 mapping is preserved
13
+ -- and the grouping is NOT fragmented — the mapping is folded in with MIN() (a
14
+ -- given leaf symbol resolves to a single mapping in practice, so MIN is just a
15
+ -- grouping-safe pick, not a lossy aggregate).
16
+ --
8
17
  -- Burst windows are computed here in SQL rather than shipping every sample
9
18
  -- timestamp (the old `GROUP_CONCAT(ts_ns)` shipped ~54 KB of timestamps that
10
19
  -- JS re-parsed). A "burst" is a run of samples for the same (thread, function)
@@ -40,12 +49,14 @@ WITH samples AS (
40
49
  ps.ts AS ts_ns,
41
50
  t.name AS thread_name,
42
51
  t.is_main_thread AS is_main_thread,
43
- spf.name AS leaf_function
52
+ spf.name AS leaf_function,
53
+ spm.name AS leaf_mapping
44
54
  FROM perf_sample ps
45
55
  JOIN thread t USING (utid)
46
56
  JOIN process p USING (upid)
47
57
  LEFT JOIN stack_profile_callsite spc ON ps.callsite_id = spc.id
48
58
  LEFT JOIN stack_profile_frame spf ON spc.frame_id = spf.id
59
+ LEFT JOIN stack_profile_mapping spm ON spf.mapping = spm.id
49
60
  WHERE p.name = (SELECT target_process FROM _argent_args)
50
61
  ),
51
62
  -- Flag each sample whose gap to the previous sample of the same
@@ -53,7 +64,7 @@ WITH samples AS (
53
64
  -- NULL, so its CASE yields 0 — the opening sample never counts as a gap.
54
65
  flagged AS (
55
66
  SELECT
56
- thread_name, is_main_thread, leaf_function, ts_ns,
67
+ thread_name, is_main_thread, leaf_function, leaf_mapping, ts_ns,
57
68
  CASE
58
69
  WHEN ts_ns - LAG(ts_ns) OVER w > (SELECT burst_gap_ns FROM _argent_args) THEN 1
59
70
  ELSE 0
@@ -65,7 +76,7 @@ flagged AS (
65
76
  -- each thread+function partition.
66
77
  ided AS (
67
78
  SELECT
68
- thread_name, is_main_thread, leaf_function, ts_ns,
79
+ thread_name, is_main_thread, leaf_function, leaf_mapping, ts_ns,
69
80
  SUM(is_new_burst) OVER (
70
81
  PARTITION BY thread_name, leaf_function
71
82
  ORDER BY ts_ns
@@ -76,10 +87,13 @@ ided AS (
76
87
  -- Collapse each burst to [start_ns, end_ns, sample_count]. Every sample lands
77
88
  -- in exactly one burst, so summing burst counts == total samples and
78
89
  -- MIN/MAX of burst bounds == first/last sample of the (thread, function).
90
+ -- leaf_mapping is grouping-invariant per (thread, function), so MIN() picks it
91
+ -- without affecting the per-burst cardinality.
79
92
  per_burst AS (
80
93
  SELECT
81
94
  thread_name, leaf_function,
82
95
  MAX(is_main_thread) AS is_main_thread,
96
+ MIN(leaf_mapping) AS leaf_mapping,
83
97
  MIN(ts_ns) AS burst_start_ns,
84
98
  MAX(ts_ns) AS burst_end_ns,
85
99
  COUNT(*) AS burst_count
@@ -90,6 +104,9 @@ SELECT
90
104
  thread_name,
91
105
  MAX(is_main_thread) AS is_main_thread,
92
106
  leaf_function,
107
+ -- One mapping per (thread, function) group; MIN() keeps cardinality 1:1 with
108
+ -- the existing GROUP BY so the grouping is not fragmented.
109
+ MIN(leaf_mapping) AS leaf_mapping,
93
110
  SUM(burst_count) AS sample_count,
94
111
  MIN(burst_start_ns) AS first_ts_ns,
95
112
  MAX(burst_end_ns) AS last_ts_ns,
Binary file
package/dist/cli-cmds.mjs CHANGED
@@ -5606,6 +5606,8 @@ var FAILURE_CODES = {
5606
5606
  UNINSTALL_TOOLSERVER_STOP_FAILED: "UNINSTALL_TOOLSERVER_STOP_FAILED",
5607
5607
  UNINSTALL_PACKAGE_ACTION_FAILED: "UNINSTALL_PACKAGE_ACTION_FAILED",
5608
5608
  UNINSTALL_UNCLASSIFIED_FAILED: "UNINSTALL_UNCLASSIFIED_FAILED",
5609
+ VEGA_CLI_COMMAND_FAILED: "VEGA_CLI_COMMAND_FAILED",
5610
+ VEGA_INPUT_UNAVAILABLE: "VEGA_INPUT_UNAVAILABLE",
5609
5611
  ANDROID_ADB_NOT_FOUND: "ANDROID_ADB_NOT_FOUND",
5610
5612
  ANDROID_EMULATOR_NOT_FOUND: "ANDROID_EMULATOR_NOT_FOUND",
5611
5613
  ANDROID_ADB_COMMAND_FAILED: "ANDROID_ADB_COMMAND_FAILED",
@@ -5754,6 +5756,7 @@ var FAILURE_KINDS = [
5754
5756
  var FAILURE_COMMANDS = [
5755
5757
  "adb",
5756
5758
  "emulator",
5759
+ "vega",
5757
5760
  "xcrun_simctl",
5758
5761
  "xctrace",
5759
5762
  "native_devtools",
@@ -5794,7 +5797,7 @@ var FAILURE_SPAWN_CODE_SET = new Set(FAILURE_SPAWN_CODES);
5794
5797
  import { randomUUID as randomUUID2 } from "node:crypto";
5795
5798
 
5796
5799
  // ../telemetry/src/events.ts
5797
- var PLATFORMS = ["ios", "android", "chromium"];
5800
+ var PLATFORMS = ["ios", "android", "chromium", "vega"];
5798
5801
 
5799
5802
  // ../telemetry/src/ai-identity.ts
5800
5803
  var AI_CLIENTS = [
@@ -5972,8 +5975,7 @@ var ALLOWED = {
5972
5975
  uptime_ms: DURATION_MS,
5973
5976
  total_tool_calls: COUNT,
5974
5977
  ...FAILURE_SIGNAL
5975
- },
5976
- "telemetry:opt_out": {}
5978
+ }
5977
5979
  };
5978
5980
  function sanitize(event, raw) {
5979
5981
  const validators = ALLOWED[event];
@@ -6396,7 +6398,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
6396
6398
  var SESSION_ID2 = randomUUID3();
6397
6399
  function readCliVersion() {
6398
6400
  if (true) {
6399
- return "0.12.1";
6401
+ return "0.13.0";
6400
6402
  }
6401
6403
  return "0.0.0";
6402
6404
  }
@@ -6828,39 +6830,12 @@ async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
6828
6830
  state = null;
6829
6831
  }
6830
6832
  }
6831
- function isEnabled2() {
6832
- return isEnabled();
6833
- }
6834
6833
  function markEnabled() {
6835
6834
  writeConsentFlag(true);
6836
6835
  }
6837
6836
  async function markDisabled() {
6838
6837
  try {
6839
- const wasEnabled = isEnabled();
6840
- let client2 = getConstructedClient();
6841
- if (wasEnabled && peekAnonId() !== null) {
6842
- const built = buildPayload("telemetry:opt_out", {});
6843
- if (built && isDebugEnabled()) {
6844
- emitDebugPayload({
6845
- event: "telemetry:opt_out",
6846
- distinctId: built.distinctId,
6847
- properties: built.properties,
6848
- ts: (/* @__PURE__ */ new Date()).toISOString()
6849
- });
6850
- }
6851
- client2 = getClient();
6852
- if (built && client2) {
6853
- try {
6854
- client2.capture({
6855
- distinctId: built.distinctId,
6856
- event: "telemetry:opt_out",
6857
- properties: built.properties
6858
- });
6859
- } catch (err) {
6860
- emitDebugError("markDisabled: capture(telemetry:opt_out) failed", err);
6861
- }
6862
- }
6863
- }
6838
+ const client2 = getConstructedClient();
6864
6839
  writeConsentFlag(false);
6865
6840
  if (client2) {
6866
6841
  try {
@@ -9719,7 +9694,7 @@ function printStatus() {
9719
9694
  console.log(` anon id: ${anonLabel}`);
9720
9695
  }
9721
9696
  async function cmdEnable() {
9722
- const wasEnabled = isEnabled2();
9697
+ const wasEnabled = isEnabled();
9723
9698
  markEnabled();
9724
9699
  if (wasEnabled) {
9725
9700
  console.log(import_picocolors3.default.dim("Telemetry was already enabled."));
@@ -9729,7 +9704,7 @@ async function cmdEnable() {
9729
9704
  await shutdown();
9730
9705
  }
9731
9706
  async function cmdDisable() {
9732
- const wasEnabled = isEnabled2();
9707
+ const wasEnabled = isEnabled();
9733
9708
  if (!wasEnabled) {
9734
9709
  console.log(import_picocolors3.default.dim("Telemetry was already disabled."));
9735
9710
  await shutdown();
@@ -15907,6 +15907,8 @@ var FAILURE_CODES = {
15907
15907
  UNINSTALL_TOOLSERVER_STOP_FAILED: "UNINSTALL_TOOLSERVER_STOP_FAILED",
15908
15908
  UNINSTALL_PACKAGE_ACTION_FAILED: "UNINSTALL_PACKAGE_ACTION_FAILED",
15909
15909
  UNINSTALL_UNCLASSIFIED_FAILED: "UNINSTALL_UNCLASSIFIED_FAILED",
15910
+ VEGA_CLI_COMMAND_FAILED: "VEGA_CLI_COMMAND_FAILED",
15911
+ VEGA_INPUT_UNAVAILABLE: "VEGA_INPUT_UNAVAILABLE",
15910
15912
  ANDROID_ADB_NOT_FOUND: "ANDROID_ADB_NOT_FOUND",
15911
15913
  ANDROID_EMULATOR_NOT_FOUND: "ANDROID_EMULATOR_NOT_FOUND",
15912
15914
  ANDROID_ADB_COMMAND_FAILED: "ANDROID_ADB_COMMAND_FAILED",
@@ -16055,6 +16057,7 @@ var FAILURE_KINDS = [
16055
16057
  var FAILURE_COMMANDS = [
16056
16058
  "adb",
16057
16059
  "emulator",
16060
+ "vega",
16058
16061
  "xcrun_simctl",
16059
16062
  "xctrace",
16060
16063
  "native_devtools",
@@ -16095,7 +16098,7 @@ var FAILURE_SPAWN_CODE_SET = new Set(FAILURE_SPAWN_CODES);
16095
16098
  import { randomUUID as randomUUID2 } from "node:crypto";
16096
16099
 
16097
16100
  // ../telemetry/src/events.ts
16098
- var PLATFORMS = ["ios", "android", "chromium"];
16101
+ var PLATFORMS = ["ios", "android", "chromium", "vega"];
16099
16102
 
16100
16103
  // ../telemetry/src/ai-identity.ts
16101
16104
  var AI_CLIENTS = [
@@ -16273,8 +16276,7 @@ var ALLOWED = {
16273
16276
  uptime_ms: DURATION_MS,
16274
16277
  total_tool_calls: COUNT,
16275
16278
  ...FAILURE_SIGNAL
16276
- },
16277
- "telemetry:opt_out": {}
16279
+ }
16278
16280
  };
16279
16281
  function sanitize(event, raw) {
16280
16282
  const validators = ALLOWED[event];
@@ -16697,7 +16699,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
16697
16699
  var SESSION_ID = randomUUID3();
16698
16700
  function readCliVersion() {
16699
16701
  if (true) {
16700
- return "0.12.1";
16702
+ return "0.13.0";
16701
16703
  }
16702
16704
  return "0.0.0";
16703
16705
  }
@@ -17550,6 +17550,8 @@ var FAILURE_CODES = {
17550
17550
  UNINSTALL_TOOLSERVER_STOP_FAILED: "UNINSTALL_TOOLSERVER_STOP_FAILED",
17551
17551
  UNINSTALL_PACKAGE_ACTION_FAILED: "UNINSTALL_PACKAGE_ACTION_FAILED",
17552
17552
  UNINSTALL_UNCLASSIFIED_FAILED: "UNINSTALL_UNCLASSIFIED_FAILED",
17553
+ VEGA_CLI_COMMAND_FAILED: "VEGA_CLI_COMMAND_FAILED",
17554
+ VEGA_INPUT_UNAVAILABLE: "VEGA_INPUT_UNAVAILABLE",
17553
17555
  ANDROID_ADB_NOT_FOUND: "ANDROID_ADB_NOT_FOUND",
17554
17556
  ANDROID_EMULATOR_NOT_FOUND: "ANDROID_EMULATOR_NOT_FOUND",
17555
17557
  ANDROID_ADB_COMMAND_FAILED: "ANDROID_ADB_COMMAND_FAILED",
@@ -17698,6 +17700,7 @@ var FAILURE_KINDS = [
17698
17700
  var FAILURE_COMMANDS = [
17699
17701
  "adb",
17700
17702
  "emulator",
17703
+ "vega",
17701
17704
  "xcrun_simctl",
17702
17705
  "xctrace",
17703
17706
  "native_devtools",
@@ -17738,7 +17741,7 @@ var FAILURE_SPAWN_CODE_SET = new Set(FAILURE_SPAWN_CODES);
17738
17741
  import { randomUUID as randomUUID2 } from "node:crypto";
17739
17742
 
17740
17743
  // ../telemetry/src/events.ts
17741
- var PLATFORMS = ["ios", "android", "chromium"];
17744
+ var PLATFORMS = ["ios", "android", "chromium", "vega"];
17742
17745
 
17743
17746
  // ../telemetry/src/ai-identity.ts
17744
17747
  var AI_CLIENTS = [
@@ -17937,8 +17940,7 @@ var ALLOWED = {
17937
17940
  uptime_ms: DURATION_MS,
17938
17941
  total_tool_calls: COUNT,
17939
17942
  ...FAILURE_SIGNAL
17940
- },
17941
- "telemetry:opt_out": {}
17943
+ }
17942
17944
  };
17943
17945
 
17944
17946
  // ../telemetry/src/base-props.ts
@@ -4296,24 +4296,14 @@
4296
4296
  const allChosen = vp.proposals.length > 0 && vp.proposals.every((p) => vp.staged[p.id]);
4297
4297
  footEl.classList.toggle("ready", allChosen && !vp.submitting);
4298
4298
 
4299
- // Off-screen proposals stay folded away (the "N hidden" badge) until the
4300
- // user opts in. Once every ON-screen choice is staged, offer to reveal
4301
- // the rest via a prompt above the footbar. Dismissing it collapses to a
4302
- // persistent pill the hidden choices are always one click from visible.
4299
+ // Whenever ANY proposal's element is off-screen, surface the reveal
4300
+ // prompt above the footbar so the user can always bring the hidden
4301
+ // choices into view. (Previously this was gated on every on-screen
4302
+ // choice already being staged, which stranded the user with a "N hidden"
4303
+ // count and no affordance to act on it.) `offscreenPromptCollapsed` only
4304
+ // selects between the full card and the collapsed pill (see below).
4303
4305
  const offScreenCount = vp.proposals.filter((p) => !p._node).length;
4304
- // Every currently-on-screen choice is staged. `every` is vacuously true
4305
- // when NONE are on screen (e.g. all proposals target another screen), so
4306
- // the reveal prompt still appears in that case instead of stranding the
4307
- // user with inert "N hidden" cards and no way to surface them.
4308
- const onScreenStaged = vp.proposals.every((p) => !p._node || vp.staged[p.id]);
4309
- // Latch on `offscreenPromptCollapsed`: once dismissed to the pill, keep it
4310
- // shown even if an on-screen pick is later un-staged — the hidden choices
4311
- // must ALWAYS stay one click from visible (the pill never disappears).
4312
- const showPrompt =
4313
- offScreenCount > 0 &&
4314
- !vp.revealOffscreen &&
4315
- !vp.submitting &&
4316
- (onScreenStaged || vp.offscreenPromptCollapsed);
4306
+ const showPrompt = offScreenCount > 0 && !vp.revealOffscreen && !vp.submitting;
4317
4307
  offscreenPrompt.hidden = !showPrompt;
4318
4308
  if (showPrompt) {
4319
4309
  offscreenPrompt.classList.toggle("collapsed", !!vp.offscreenPromptCollapsed);