@nice-code/action 0.2.13 → 0.2.15

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.
@@ -128,8 +128,7 @@ class ActionDevtoolsCore {
128
128
  }
129
129
  }
130
130
  // src/devtools/browser/NiceActionDevtools.tsx
131
- import { useVirtualizer } from "@tanstack/react-virtual";
132
- import { useCallback, useEffect as useEffect2, useLayoutEffect, useMemo as useMemo2, useRef as useRef2, useState as useState6 } from "react";
131
+ import { useCallback, useEffect as useEffect3, useMemo as useMemo2, useRef as useRef2, useState as useState6 } from "react";
133
132
 
134
133
  // src/devtools/browser/components/ActionDetailPanel.tsx
135
134
  import { useMemo, useState as useState5 } from "react";
@@ -196,6 +195,7 @@ function DomainHierarchyTooltip({
196
195
  }, undefined, false, undefined, this);
197
196
  }
198
197
  function DomainChip({
198
+ subtle = false,
199
199
  domain,
200
200
  allDomains,
201
201
  size
@@ -216,10 +216,10 @@ function DomainChip({
216
216
  display: "flex",
217
217
  alignItems: "center",
218
218
  gap: "0.4em",
219
- color: "#818cf8",
219
+ color: subtle ? "#4b5563" : "#818cf8",
220
220
  fontSize,
221
221
  background: "#0f172a",
222
- border: "1px solid #312e81",
222
+ border: !subtle ? "1px solid #312e81" : "1px solid transparent",
223
223
  padding,
224
224
  borderRadius: "0.6rem",
225
225
  flexShrink: 0,
@@ -435,59 +435,9 @@ function CallStackSection({
435
435
  }, undefined, true, undefined, this);
436
436
  }
437
437
 
438
- // src/devtools/browser/components/Chip.tsx
439
- import { jsxDEV as jsxDEV5 } from "react/jsx-dev-runtime";
440
- function Chip({
441
- color,
442
- borderColor,
443
- fontSize = "8px",
444
- padding = "1px 4px",
445
- children,
446
- style
447
- }) {
448
- return /* @__PURE__ */ jsxDEV5("span", {
449
- style: {
450
- color,
451
- fontSize,
452
- background: "#0f172a",
453
- border: `1px solid ${borderColor}`,
454
- padding,
455
- borderRadius: "3px",
456
- flexShrink: 0,
457
- whiteSpace: "nowrap",
458
- ...style
459
- },
460
- children
461
- }, undefined, false, undefined, this);
462
- }
463
-
464
- // src/devtools/browser/components/ChildDispatchChips.tsx
465
- import { jsxDEV as jsxDEV6, Fragment as Fragment2 } from "react/jsx-dev-runtime";
466
- function ChildDispatchChips({
467
- labels,
468
- size = "sm"
469
- }) {
470
- if (labels == null || labels.length === 0)
471
- return null;
472
- const fontSize = size === "md" ? "9px" : "8px";
473
- const padding = size === "md" ? "1px 4px" : "1px 3px";
474
- return /* @__PURE__ */ jsxDEV6(Fragment2, {
475
- children: labels.map((label) => /* @__PURE__ */ jsxDEV6(Chip, {
476
- color: "#c084fc",
477
- borderColor: "#581c87",
478
- fontSize,
479
- padding,
480
- children: [
481
- "↳ ",
482
- label
483
- ]
484
- }, label, true, undefined, this))
485
- }, undefined, false, undefined, this);
486
- }
487
-
488
438
  // src/devtools/browser/components/DetailSection.tsx
489
439
  import { useState as useState2 } from "react";
490
- import { jsxDEV as jsxDEV7 } from "react/jsx-dev-runtime";
440
+ import { jsxDEV as jsxDEV5 } from "react/jsx-dev-runtime";
491
441
  var COMPACT_CHAR_LIMIT = 120;
492
442
  function DetailSection({
493
443
  label,
@@ -499,9 +449,9 @@ function DetailSection({
499
449
  const compactJson = safeStringify(value, 0);
500
450
  const canExpand = fullJson !== compactJson || compactJson.length > COMPACT_CHAR_LIMIT;
501
451
  const compactDisplay = compactJson.length > COMPACT_CHAR_LIMIT ? `${compactJson.slice(0, COMPACT_CHAR_LIMIT)}…` : compactJson;
502
- return /* @__PURE__ */ jsxDEV7("div", {
452
+ return /* @__PURE__ */ jsxDEV5("div", {
503
453
  children: [
504
- /* @__PURE__ */ jsxDEV7("div", {
454
+ /* @__PURE__ */ jsxDEV5("div", {
505
455
  style: {
506
456
  display: "flex",
507
457
  alignItems: "center",
@@ -509,7 +459,7 @@ function DetailSection({
509
459
  marginBottom: "3px"
510
460
  },
511
461
  children: [
512
- /* @__PURE__ */ jsxDEV7("div", {
462
+ /* @__PURE__ */ jsxDEV5("div", {
513
463
  style: {
514
464
  color,
515
465
  fontSize: "10px",
@@ -518,13 +468,13 @@ function DetailSection({
518
468
  },
519
469
  children: label
520
470
  }, undefined, false, undefined, this),
521
- canExpand && /* @__PURE__ */ jsxDEV7("span", {
471
+ canExpand && /* @__PURE__ */ jsxDEV5("span", {
522
472
  style: { color: "#334155", fontSize: "11px" },
523
473
  children: expanded ? "▾" : "▸"
524
474
  }, undefined, false, undefined, this)
525
475
  ]
526
476
  }, undefined, true, undefined, this),
527
- expanded ? /* @__PURE__ */ jsxDEV7("div", {
477
+ expanded ? /* @__PURE__ */ jsxDEV5("div", {
528
478
  onClick: canExpand ? () => setExpanded(false) : undefined,
529
479
  style: {
530
480
  margin: 0,
@@ -540,7 +490,7 @@ function DetailSection({
540
490
  cursor: canExpand ? "pointer" : "default"
541
491
  },
542
492
  children: fullJson
543
- }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV7("div", {
493
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV5("div", {
544
494
  onClick: canExpand ? () => setExpanded(true) : undefined,
545
495
  style: {
546
496
  padding: "5px 8px",
@@ -560,31 +510,64 @@ function DetailSection({
560
510
  }, undefined, true, undefined, this);
561
511
  }
562
512
 
513
+ // src/devtools/core/devtools_colors.ts
514
+ var DEVTOOL_COLOR_HANDLER_LOCAL_TEXT = "#34bb89";
515
+ var DEVTOOL_COLOR_HANDLER_LOCAL_BORDER = "#144427";
516
+ var DEVTOOL_COLOR_HANDLER_EXTERNAL_TEXT = "#cfa12a";
517
+ var DEVTOOL_COLOR_HANDLER_EXTERNAL_BORDER = "#723917";
518
+
519
+ // src/devtools/browser/components/Chip.tsx
520
+ import { jsxDEV as jsxDEV6 } from "react/jsx-dev-runtime";
521
+ function Chip({
522
+ color,
523
+ borderColor,
524
+ fontSize = "8px",
525
+ padding = "1px 4px",
526
+ children,
527
+ style
528
+ }) {
529
+ return /* @__PURE__ */ jsxDEV6("span", {
530
+ style: {
531
+ color,
532
+ fontSize,
533
+ background: "#0f172a",
534
+ border: `1px solid ${borderColor}`,
535
+ padding,
536
+ borderRadius: "3px",
537
+ flexShrink: 0,
538
+ whiteSpace: "nowrap",
539
+ ...style
540
+ },
541
+ children
542
+ }, undefined, false, undefined, this);
543
+ }
544
+
563
545
  // src/devtools/browser/components/HandlerChips.tsx
564
- import { jsxDEV as jsxDEV8, Fragment as Fragment3 } from "react/jsx-dev-runtime";
546
+ import { jsxDEV as jsxDEV7, Fragment as Fragment2 } from "react/jsx-dev-runtime";
565
547
  function getExternalLabel(hop) {
566
548
  if (hop.handlerType !== "external")
567
549
  return null;
568
550
  return hop.handlerClient != null ? `${hop.transport ?? "ext"} → ${hop.handlerClient.envId}` : `→ ${hop.transport ?? "ext"}`;
569
551
  }
570
- function HandlerChips({ entry, size, alwaysShowLocal = false }) {
552
+ function HandlerChips({ entry, size }) {
571
553
  const firstHop = entry.meta.routing[0];
572
554
  const localEnvId = firstHop != null ? firstHop.runtime.envId : null;
573
555
  const externalLabel = firstHop != null ? getExternalLabel(firstHop) : null;
574
- const fontSize = size === "md" ? "9px" : "8px";
556
+ const fontSize = size === "md" ? "1em" : "0.8em";
575
557
  const padding = size === "md" ? "1px 5px" : "1px 4px";
576
- return /* @__PURE__ */ jsxDEV8(Fragment3, {
558
+ const firstHopIsLocal = firstHop != null && firstHop.handlerType === "local";
559
+ return /* @__PURE__ */ jsxDEV7(Fragment2, {
577
560
  children: [
578
- localEnvId != null && (alwaysShowLocal || externalLabel == null) && /* @__PURE__ */ jsxDEV8(Chip, {
579
- color: "#34d399",
580
- borderColor: "#14532d",
561
+ localEnvId != null && (firstHopIsLocal || externalLabel == null) && /* @__PURE__ */ jsxDEV7(Chip, {
562
+ color: DEVTOOL_COLOR_HANDLER_LOCAL_TEXT,
563
+ borderColor: DEVTOOL_COLOR_HANDLER_LOCAL_BORDER,
581
564
  fontSize,
582
565
  padding,
583
- children: localEnvId
566
+ children: "local"
584
567
  }, undefined, false, undefined, this),
585
- externalLabel != null && /* @__PURE__ */ jsxDEV8(Chip, {
586
- color: "#fbbf24",
587
- borderColor: "#78350f",
568
+ externalLabel != null && /* @__PURE__ */ jsxDEV7(Chip, {
569
+ color: DEVTOOL_COLOR_HANDLER_EXTERNAL_TEXT,
570
+ borderColor: DEVTOOL_COLOR_HANDLER_EXTERNAL_BORDER,
588
571
  fontSize,
589
572
  padding,
590
573
  children: externalLabel
@@ -595,19 +578,19 @@ function HandlerChips({ entry, size, alwaysShowLocal = false }) {
595
578
 
596
579
  // src/devtools/browser/components/MetaSection.tsx
597
580
  import { useState as useState3 } from "react";
598
- import { jsxDEV as jsxDEV9 } from "react/jsx-dev-runtime";
581
+ import { jsxDEV as jsxDEV8 } from "react/jsx-dev-runtime";
599
582
  function MetaChip({ label, value }) {
600
- return /* @__PURE__ */ jsxDEV9("span", {
583
+ return /* @__PURE__ */ jsxDEV8("span", {
601
584
  style: { whiteSpace: "nowrap" },
602
585
  children: [
603
- /* @__PURE__ */ jsxDEV9("span", {
586
+ /* @__PURE__ */ jsxDEV8("span", {
604
587
  style: { color: "#475569" },
605
588
  children: [
606
589
  label,
607
590
  " "
608
591
  ]
609
592
  }, undefined, true, undefined, this),
610
- /* @__PURE__ */ jsxDEV9("span", {
593
+ /* @__PURE__ */ jsxDEV8("span", {
611
594
  style: { color: "#cbd5e1" },
612
595
  children: value
613
596
  }, undefined, false, undefined, this)
@@ -623,9 +606,9 @@ function MetaSection({ entry }) {
623
606
  ...meta.originClient.perId != null ? [{ label: "perId", value: meta.originClient.perId }] : [],
624
607
  ...meta.originClient.insId != null ? [{ label: "insId", value: meta.originClient.insId }] : []
625
608
  ];
626
- return /* @__PURE__ */ jsxDEV9("div", {
609
+ return /* @__PURE__ */ jsxDEV8("div", {
627
610
  children: [
628
- /* @__PURE__ */ jsxDEV9("div", {
611
+ /* @__PURE__ */ jsxDEV8("div", {
629
612
  style: {
630
613
  display: "flex",
631
614
  alignItems: "center",
@@ -633,7 +616,7 @@ function MetaSection({ entry }) {
633
616
  marginBottom: "3px"
634
617
  },
635
618
  children: [
636
- /* @__PURE__ */ jsxDEV9("div", {
619
+ /* @__PURE__ */ jsxDEV8("div", {
637
620
  style: {
638
621
  color: "#60a5fa",
639
622
  fontSize: "10px",
@@ -642,16 +625,16 @@ function MetaSection({ entry }) {
642
625
  },
643
626
  children: "Meta"
644
627
  }, undefined, false, undefined, this),
645
- /* @__PURE__ */ jsxDEV9("span", {
628
+ /* @__PURE__ */ jsxDEV8("span", {
646
629
  style: { color: "#334155", fontSize: "11px" },
647
630
  children: expanded ? "▾" : "▸"
648
631
  }, undefined, false, undefined, this)
649
632
  ]
650
633
  }, undefined, true, undefined, this),
651
- expanded ? /* @__PURE__ */ jsxDEV9("div", {
634
+ expanded ? /* @__PURE__ */ jsxDEV8("div", {
652
635
  onClick: () => setExpanded(false),
653
636
  style: { background: "#1e293b", borderRadius: "4px", overflow: "hidden", cursor: "pointer" },
654
- children: expandedRows.map(({ label, value }, i) => /* @__PURE__ */ jsxDEV9("div", {
637
+ children: expandedRows.map(({ label, value }, i) => /* @__PURE__ */ jsxDEV8("div", {
655
638
  style: {
656
639
  display: "grid",
657
640
  gridTemplateColumns: "52px 1fr",
@@ -661,17 +644,17 @@ function MetaSection({ entry }) {
661
644
  alignItems: "start"
662
645
  },
663
646
  children: [
664
- /* @__PURE__ */ jsxDEV9("span", {
647
+ /* @__PURE__ */ jsxDEV8("span", {
665
648
  style: { textAlign: "left", color: "#475569", fontSize: "10px", paddingTop: "1px" },
666
649
  children: label
667
650
  }, undefined, false, undefined, this),
668
- /* @__PURE__ */ jsxDEV9("span", {
651
+ /* @__PURE__ */ jsxDEV8("span", {
669
652
  style: { textAlign: "left", color: "#cbd5e1", fontSize: "11px", wordBreak: "break-all" },
670
653
  children: value
671
654
  }, undefined, false, undefined, this)
672
655
  ]
673
656
  }, label, true, undefined, this))
674
- }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV9("div", {
657
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV8("div", {
675
658
  onClick: () => setExpanded(true),
676
659
  style: {
677
660
  background: "#1e293b",
@@ -685,19 +668,19 @@ function MetaSection({ entry }) {
685
668
  cursor: "pointer"
686
669
  },
687
670
  children: [
688
- /* @__PURE__ */ jsxDEV9(MetaChip, {
671
+ /* @__PURE__ */ jsxDEV8(MetaChip, {
689
672
  label: "cuid",
690
673
  value: `…${cuid.slice(-8)}`
691
674
  }, undefined, false, undefined, this),
692
- /* @__PURE__ */ jsxDEV9(MetaChip, {
675
+ /* @__PURE__ */ jsxDEV8(MetaChip, {
693
676
  label: "origin",
694
677
  value: meta.originClient.envId
695
678
  }, undefined, false, undefined, this),
696
- meta.originClient.perId != null && /* @__PURE__ */ jsxDEV9(MetaChip, {
679
+ meta.originClient.perId != null && /* @__PURE__ */ jsxDEV8(MetaChip, {
697
680
  label: "perId",
698
681
  value: meta.originClient.perId.length > 10 ? `${meta.originClient.perId.slice(0, 10)}…` : meta.originClient.perId
699
682
  }, undefined, false, undefined, this),
700
- meta.originClient.insId != null && /* @__PURE__ */ jsxDEV9(MetaChip, {
683
+ meta.originClient.insId != null && /* @__PURE__ */ jsxDEV8(MetaChip, {
701
684
  label: "insId",
702
685
  value: meta.originClient.insId.length > 10 ? `${meta.originClient.insId.slice(0, 10)}…` : meta.originClient.insId
703
686
  }, undefined, false, undefined, this)
@@ -708,7 +691,7 @@ function MetaSection({ entry }) {
708
691
  }
709
692
 
710
693
  // src/devtools/browser/components/RoutingSection.tsx
711
- import { jsxDEV as jsxDEV10 } from "react/jsx-dev-runtime";
694
+ import { jsxDEV as jsxDEV9 } from "react/jsx-dev-runtime";
712
695
  function RoutingSection({
713
696
  entry,
714
697
  minHopCount = 0
@@ -718,12 +701,12 @@ function RoutingSection({
718
701
  const phantomCount = Math.max(0, minHopCount - hopCount);
719
702
  if (hopCount === 0 && phantomCount === 0)
720
703
  return null;
721
- return /* @__PURE__ */ jsxDEV10("div", {
704
+ return /* @__PURE__ */ jsxDEV9("div", {
722
705
  children: [
723
- /* @__PURE__ */ jsxDEV10(SectionLabel, {
706
+ /* @__PURE__ */ jsxDEV9(SectionLabel, {
724
707
  label: hopCount > 0 ? `Routing · ${hopCount} hop${hopCount !== 1 ? "s" : ""}` : "Routing"
725
708
  }, undefined, false, undefined, this),
726
- /* @__PURE__ */ jsxDEV10("div", {
709
+ /* @__PURE__ */ jsxDEV9("div", {
727
710
  style: { display: "flex", flexDirection: "column", gap: "2px" },
728
711
  children: [
729
712
  meta.routing.map((hop, i) => {
@@ -732,7 +715,7 @@ function RoutingSection({
732
715
  const badgeColor = isLocal ? "#34d399" : "#fbbf24";
733
716
  const badgeText = isLocal ? "● exec" : `→ ${hop.transport ?? "ext"}`;
734
717
  const runtimeTitle = [hop.runtime.perId, hop.runtime.insId].filter(Boolean).join(" · ") || undefined;
735
- return /* @__PURE__ */ jsxDEV10("div", {
718
+ return /* @__PURE__ */ jsxDEV9("div", {
736
719
  style: {
737
720
  background: "#1e293b",
738
721
  borderRadius: "4px",
@@ -745,14 +728,14 @@ function RoutingSection({
745
728
  padding: "4px 8px"
746
729
  },
747
730
  children: [
748
- /* @__PURE__ */ jsxDEV10("span", {
731
+ /* @__PURE__ */ jsxDEV9("span", {
749
732
  style: { display: "flex", flexDirection: "row", alignItems: "center", gap: "10px" },
750
733
  children: [
751
- /* @__PURE__ */ jsxDEV10("span", {
734
+ /* @__PURE__ */ jsxDEV9("span", {
752
735
  style: { color: "#334155", fontSize: "10px", width: "16px", textAlign: "right" },
753
736
  children: i + 1
754
737
  }, undefined, false, undefined, this),
755
- /* @__PURE__ */ jsxDEV10("span", {
738
+ /* @__PURE__ */ jsxDEV9("span", {
756
739
  title: runtimeTitle,
757
740
  style: {
758
741
  color: "#94a3b8",
@@ -766,11 +749,11 @@ function RoutingSection({
766
749
  }, undefined, false, undefined, this)
767
750
  ]
768
751
  }, undefined, true, undefined, this),
769
- /* @__PURE__ */ jsxDEV10("span", {
752
+ /* @__PURE__ */ jsxDEV9("span", {
770
753
  style: { color: badgeColor, fontSize: "10px", whiteSpace: "nowrap" },
771
754
  children: badgeText
772
755
  }, undefined, false, undefined, this),
773
- /* @__PURE__ */ jsxDEV10("span", {
756
+ /* @__PURE__ */ jsxDEV9("span", {
774
757
  style: {
775
758
  display: "flex",
776
759
  alignItems: "center",
@@ -779,7 +762,7 @@ function RoutingSection({
779
762
  overflow: "hidden"
780
763
  },
781
764
  children: [
782
- /* @__PURE__ */ jsxDEV10("span", {
765
+ /* @__PURE__ */ jsxDEV9("span", {
783
766
  style: {
784
767
  color: "#475569",
785
768
  fontSize: "10px",
@@ -789,7 +772,7 @@ function RoutingSection({
789
772
  },
790
773
  children: hop.handlerClient != null ? `↳ ${hop.handlerClient.envId}` : ""
791
774
  }, undefined, false, undefined, this),
792
- /* @__PURE__ */ jsxDEV10("span", {
775
+ /* @__PURE__ */ jsxDEV9("span", {
793
776
  style: { color: "#334155", fontSize: "10px", flexShrink: 0, marginLeft: "auto" },
794
777
  children: [
795
778
  "+",
@@ -802,7 +785,7 @@ function RoutingSection({
802
785
  ]
803
786
  }, `${hop.time}-${hop.runtime.envId}`, true, undefined, this);
804
787
  }),
805
- Array.from({ length: phantomCount }, (_, i) => `routing-phantom-${hopCount + i}`).map((key) => /* @__PURE__ */ jsxDEV10("div", {
788
+ Array.from({ length: phantomCount }, (_, i) => `routing-phantom-${hopCount + i}`).map((key) => /* @__PURE__ */ jsxDEV9("div", {
806
789
  "aria-hidden": "true",
807
790
  style: {
808
791
  visibility: "hidden",
@@ -815,24 +798,24 @@ function RoutingSection({
815
798
  padding: "4px 8px"
816
799
  },
817
800
  children: [
818
- /* @__PURE__ */ jsxDEV10("span", {
801
+ /* @__PURE__ */ jsxDEV9("span", {
819
802
  style: { display: "flex", flexDirection: "row", alignItems: "center", gap: "10px" },
820
803
  children: [
821
- /* @__PURE__ */ jsxDEV10("span", {
804
+ /* @__PURE__ */ jsxDEV9("span", {
822
805
  style: { fontSize: "10px", width: "16px" },
823
806
  children: "0"
824
807
  }, undefined, false, undefined, this),
825
- /* @__PURE__ */ jsxDEV10("span", {
808
+ /* @__PURE__ */ jsxDEV9("span", {
826
809
  style: { fontSize: "11px" },
827
810
  children: "placeholder"
828
811
  }, undefined, false, undefined, this)
829
812
  ]
830
813
  }, undefined, true, undefined, this),
831
- /* @__PURE__ */ jsxDEV10("span", {
814
+ /* @__PURE__ */ jsxDEV9("span", {
832
815
  style: { fontSize: "10px" },
833
816
  children: "placeholder"
834
817
  }, undefined, false, undefined, this),
835
- /* @__PURE__ */ jsxDEV10("span", {}, undefined, false, undefined, this)
818
+ /* @__PURE__ */ jsxDEV9("span", {}, undefined, false, undefined, this)
836
819
  ]
837
820
  }, key, true, undefined, this))
838
821
  ]
@@ -842,8 +825,66 @@ function RoutingSection({
842
825
  }
843
826
 
844
827
  // src/devtools/browser/components/StackTraceSection.tsx
845
- import { useState as useState4 } from "react";
846
- import { jsxDEV as jsxDEV11 } from "react/jsx-dev-runtime";
828
+ import { useEffect as useEffect2, useState as useState4 } from "react";
829
+
830
+ // src/devtools/browser/components/sourceMapResolver.ts
831
+ import { SourceMapConsumer } from "source-map-js";
832
+ var consumerCache = new Map;
833
+ async function loadConsumer(fileUrl) {
834
+ try {
835
+ if (!fileUrl.startsWith("http://") && !fileUrl.startsWith("https://"))
836
+ return null;
837
+ const resp = await fetch(fileUrl);
838
+ if (!resp.ok)
839
+ return null;
840
+ const text = await resp.text();
841
+ const match = text.match(/\/\/[#@] sourceMappingURL=(\S+)/);
842
+ if (match == null)
843
+ return null;
844
+ const mapRef = match[1];
845
+ let mapJson;
846
+ if (mapRef.startsWith("data:")) {
847
+ const commaIdx = mapRef.indexOf(",");
848
+ if (commaIdx === -1)
849
+ return null;
850
+ const header = mapRef.slice(5, commaIdx);
851
+ const payload = mapRef.slice(commaIdx + 1);
852
+ mapJson = header.includes("base64") ? atob(payload) : decodeURIComponent(payload);
853
+ } else {
854
+ const mapUrl = new URL(mapRef, fileUrl).href;
855
+ const mapResp = await fetch(mapUrl);
856
+ if (!mapResp.ok)
857
+ return null;
858
+ mapJson = await mapResp.text();
859
+ }
860
+ return new SourceMapConsumer(JSON.parse(mapJson));
861
+ } catch {
862
+ return null;
863
+ }
864
+ }
865
+ function getConsumer(fileUrl) {
866
+ const key = fileUrl.split("?")[0] ?? fileUrl;
867
+ if (!consumerCache.has(key)) {
868
+ consumerCache.set(key, loadConsumer(fileUrl));
869
+ }
870
+ return consumerCache.get(key);
871
+ }
872
+ async function resolveCompiledPosition(fileUrl, line, col) {
873
+ try {
874
+ const consumer = await getConsumer(fileUrl);
875
+ if (consumer == null)
876
+ return null;
877
+ const pos = consumer.originalPositionFor({ line, column: col });
878
+ if (pos.source == null || pos.line == null)
879
+ return null;
880
+ return { file: pos.source, line: pos.line, col: pos.column ?? 0 };
881
+ } catch {
882
+ return null;
883
+ }
884
+ }
885
+
886
+ // src/devtools/browser/components/StackTraceSection.tsx
887
+ import { jsxDEV as jsxDEV10 } from "react/jsx-dev-runtime";
847
888
  var INTERNAL_PATTERNS = [
848
889
  "/nice-action/",
849
890
  "@nice-code/action",
@@ -863,16 +904,39 @@ function parseStackFrames(stack) {
863
904
  const matchFn = raw.match(/^at (.+?) \((.+):(\d+):(\d+)\)$/);
864
905
  if (matchFn != null) {
865
906
  const file = matchFn[2];
866
- return { fn: matchFn[1], file, raw, isInternal: isInternalFrame(file) };
907
+ return {
908
+ fn: matchFn[1],
909
+ file,
910
+ line: parseInt(matchFn[3], 10),
911
+ col: parseInt(matchFn[4], 10),
912
+ raw,
913
+ isInternal: isInternalFrame(file)
914
+ };
867
915
  }
868
916
  const matchUrl = raw.match(/^at (.+):(\d+):(\d+)$/);
869
917
  if (matchUrl != null) {
870
918
  const file = matchUrl[1];
871
- return { file, raw, isInternal: isInternalFrame(file) };
919
+ return {
920
+ file,
921
+ line: parseInt(matchUrl[2], 10),
922
+ col: parseInt(matchUrl[3], 10),
923
+ raw,
924
+ isInternal: isInternalFrame(file)
925
+ };
872
926
  }
873
927
  return { raw, isInternal: true };
874
928
  }).filter((f) => f != null);
875
929
  }
930
+ async function resolveSourceMapPositions(frames) {
931
+ return Promise.all(frames.map(async (frame) => {
932
+ if (frame.isInternal || frame.file == null || frame.line == null)
933
+ return frame;
934
+ const resolved = await resolveCompiledPosition(frame.file, frame.line, frame.col ?? 0);
935
+ if (resolved == null)
936
+ return frame;
937
+ return { ...frame, file: resolved.file, line: resolved.line, col: resolved.col };
938
+ }));
939
+ }
876
940
  function formatFrameFile(file) {
877
941
  if (file == null)
878
942
  return "?";
@@ -894,17 +958,32 @@ function StackTraceSection({
894
958
  color = "#60a5fa"
895
959
  }) {
896
960
  const [showAll, setShowAll] = useState4(false);
961
+ const [resolvedFrames, setResolvedFrames] = useState4(null);
962
+ useEffect2(() => {
963
+ if (stack == null)
964
+ return;
965
+ setResolvedFrames(null);
966
+ const parsed = parseStackFrames(stack);
967
+ let cancelled = false;
968
+ resolveSourceMapPositions(parsed).then((frames) => {
969
+ if (!cancelled)
970
+ setResolvedFrames(frames);
971
+ });
972
+ return () => {
973
+ cancelled = true;
974
+ };
975
+ }, [stack]);
897
976
  if (stack == null)
898
977
  return null;
899
- const allFrames = parseStackFrames(stack);
978
+ const allFrames = resolvedFrames ?? parseStackFrames(stack);
900
979
  const userFrames = allFrames.filter((f) => !f.isInternal);
901
980
  const hasInternalFrames = allFrames.length > userFrames.length;
902
981
  const displayFrames = showAll ? allFrames : userFrames;
903
982
  if (allFrames.length === 0)
904
983
  return null;
905
- return /* @__PURE__ */ jsxDEV11("div", {
984
+ return /* @__PURE__ */ jsxDEV10("div", {
906
985
  children: [
907
- /* @__PURE__ */ jsxDEV11("div", {
986
+ /* @__PURE__ */ jsxDEV10("div", {
908
987
  style: {
909
988
  display: "flex",
910
989
  alignItems: "center",
@@ -912,17 +991,17 @@ function StackTraceSection({
912
991
  marginBottom: "3px"
913
992
  },
914
993
  children: [
915
- /* @__PURE__ */ jsxDEV11(SectionLabel, {
994
+ /* @__PURE__ */ jsxDEV10(SectionLabel, {
916
995
  label,
917
996
  color
918
997
  }, undefined, false, undefined, this),
919
- hasInternalFrames && /* @__PURE__ */ jsxDEV11("span", {
998
+ hasInternalFrames && /* @__PURE__ */ jsxDEV10("span", {
920
999
  style: { color: "#475569", fontSize: "9px" },
921
1000
  children: !showAll ? "user only" : `all (${allFrames.length})`
922
1001
  }, undefined, false, undefined, this)
923
1002
  ]
924
1003
  }, undefined, true, undefined, this),
925
- /* @__PURE__ */ jsxDEV11("div", {
1004
+ /* @__PURE__ */ jsxDEV10("div", {
926
1005
  onClick: () => setShowAll((s) => !s),
927
1006
  style: {
928
1007
  background: "#040a13",
@@ -931,7 +1010,7 @@ function StackTraceSection({
931
1010
  overflow: "hidden",
932
1011
  cursor: "pointer"
933
1012
  },
934
- children: displayFrames.length === 0 ? /* @__PURE__ */ jsxDEV11("div", {
1013
+ children: displayFrames.length === 0 ? /* @__PURE__ */ jsxDEV10("div", {
935
1014
  style: { padding: "6px 10px", color: "#64748b", fontSize: "10px", fontStyle: "italic" },
936
1015
  children: "no user frames captured"
937
1016
  }, undefined, false, undefined, this) : displayFrames.map((frame, idx) => {
@@ -941,7 +1020,7 @@ function StackTraceSection({
941
1020
  const bareFilename = slashIdx >= 0 ? displayFile.slice(slashIdx + 1) : displayFile;
942
1021
  const titleStr = frame.file != null ? frame.file : frame.raw;
943
1022
  const isUser = !frame.isInternal;
944
- return /* @__PURE__ */ jsxDEV11("div", {
1023
+ return /* @__PURE__ */ jsxDEV10("div", {
945
1024
  title: titleStr,
946
1025
  style: {
947
1026
  display: "flex",
@@ -951,7 +1030,7 @@ function StackTraceSection({
951
1030
  borderBottom: idx < displayFrames.length - 1 ? "1px solid #0f172a" : undefined
952
1031
  },
953
1032
  children: [
954
- /* @__PURE__ */ jsxDEV11("span", {
1033
+ /* @__PURE__ */ jsxDEV10("span", {
955
1034
  style: {
956
1035
  color: isUser ? "#64748b" : "#2d3f53",
957
1036
  fontSize: "10px",
@@ -962,12 +1041,12 @@ function StackTraceSection({
962
1041
  },
963
1042
  children: idx + 1
964
1043
  }, undefined, false, undefined, this),
965
- /* @__PURE__ */ jsxDEV11("div", {
1044
+ /* @__PURE__ */ jsxDEV10("div", {
966
1045
  style: { display: "flex", flexDirection: "column", gap: "0.15em", lineHeight: 1.2 },
967
1046
  children: [
968
- /* @__PURE__ */ jsxDEV11("div", {
1047
+ /* @__PURE__ */ jsxDEV10("div", {
969
1048
  style: { display: "flex", alignItems: "center" },
970
- children: /* @__PURE__ */ jsxDEV11("span", {
1049
+ children: /* @__PURE__ */ jsxDEV10("span", {
971
1050
  style: {
972
1051
  color: isUser ? "#e2e8f0" : "#50698b",
973
1052
  fontSize: "12px",
@@ -979,10 +1058,10 @@ function StackTraceSection({
979
1058
  children: frame.fn ?? "(anonymous)"
980
1059
  }, undefined, false, undefined, this)
981
1060
  }, undefined, false, undefined, this),
982
- /* @__PURE__ */ jsxDEV11("div", {
1061
+ /* @__PURE__ */ jsxDEV10("div", {
983
1062
  style: { display: "flex", alignItems: "baseline", overflow: "hidden" },
984
1063
  children: [
985
- folderPrefix !== "" && /* @__PURE__ */ jsxDEV11("span", {
1064
+ folderPrefix !== "" && /* @__PURE__ */ jsxDEV10("span", {
986
1065
  style: {
987
1066
  color: isUser ? "#596b83" : "#2d3f53",
988
1067
  fontSize: "10px",
@@ -994,7 +1073,7 @@ function StackTraceSection({
994
1073
  },
995
1074
  children: folderPrefix
996
1075
  }, undefined, false, undefined, this),
997
- /* @__PURE__ */ jsxDEV11("span", {
1076
+ /* @__PURE__ */ jsxDEV10("span", {
998
1077
  style: {
999
1078
  color: isUser ? "#8a9ebb" : "#425979",
1000
1079
  fontSize: "10px",
@@ -1002,13 +1081,26 @@ function StackTraceSection({
1002
1081
  flexShrink: 0
1003
1082
  },
1004
1083
  children: bareFilename
1005
- }, undefined, false, undefined, this)
1084
+ }, undefined, false, undefined, this),
1085
+ frame.line != null && /* @__PURE__ */ jsxDEV10("span", {
1086
+ style: {
1087
+ color: isUser ? "#4a7fa8" : "#2d4a63",
1088
+ fontSize: "10px",
1089
+ whiteSpace: "nowrap",
1090
+ flexShrink: 0,
1091
+ fontVariantNumeric: "tabular-nums"
1092
+ },
1093
+ children: [
1094
+ ":",
1095
+ frame.line
1096
+ ]
1097
+ }, undefined, true, undefined, this)
1006
1098
  ]
1007
1099
  }, undefined, true, undefined, this)
1008
1100
  ]
1009
1101
  }, undefined, true, undefined, this)
1010
1102
  ]
1011
- }, `${frame.fn ?? "anon"}@${frame.file ?? "unknown"}`, true, undefined, this);
1103
+ }, frame.raw, true, undefined, this);
1012
1104
  })
1013
1105
  }, undefined, false, undefined, this)
1014
1106
  ]
@@ -1016,7 +1108,7 @@ function StackTraceSection({
1016
1108
  }
1017
1109
 
1018
1110
  // src/devtools/browser/components/ActionDetailPanel.tsx
1019
- import { jsxDEV as jsxDEV12, Fragment as Fragment4 } from "react/jsx-dev-runtime";
1111
+ import { jsxDEV as jsxDEV11, Fragment as Fragment3 } from "react/jsx-dev-runtime";
1020
1112
  function DetailHeader({
1021
1113
  entry,
1022
1114
  isActive,
@@ -1026,7 +1118,7 @@ function DetailHeader({
1026
1118
  const color = STATUS_COLOR[entry.status];
1027
1119
  const symbol = STATUS_SYMBOL[entry.status];
1028
1120
  const timestamp = formatTimestamp(entry.startTime);
1029
- return /* @__PURE__ */ jsxDEV12("div", {
1121
+ return /* @__PURE__ */ jsxDEV11("div", {
1030
1122
  onClick: !isActive ? onClick : undefined,
1031
1123
  style: {
1032
1124
  padding: "10px 12px",
@@ -1040,7 +1132,7 @@ function DetailHeader({
1040
1132
  cursor: isActive ? "default" : "pointer"
1041
1133
  },
1042
1134
  children: [
1043
- /* @__PURE__ */ jsxDEV12("span", {
1135
+ /* @__PURE__ */ jsxDEV11("span", {
1044
1136
  style: {
1045
1137
  color,
1046
1138
  fontSize: "15px",
@@ -1050,16 +1142,20 @@ function DetailHeader({
1050
1142
  },
1051
1143
  children: symbol
1052
1144
  }, undefined, false, undefined, this),
1053
- /* @__PURE__ */ jsxDEV12("div", {
1054
- style: { flex: 1, minWidth: 0, display: "flex", flexDirection: "column", gap: "5px" },
1145
+ /* @__PURE__ */ jsxDEV11("div", {
1146
+ style: { flex: 1, minWidth: 0, display: "flex", flexDirection: "column", gap: "0.5em" },
1055
1147
  children: [
1056
- /* @__PURE__ */ jsxDEV12("div", {
1057
- style: { display: "flex", alignItems: "center", minWidth: 0, gap: "0.5em" },
1148
+ /* @__PURE__ */ jsxDEV11("div", {
1149
+ style: { display: "flex", alignItems: "center", minWidth: 0, gap: "0.4em" },
1058
1150
  children: [
1059
- /* @__PURE__ */ jsxDEV12("span", {
1151
+ /* @__PURE__ */ jsxDEV11("span", {
1152
+ style: { fontSize: "1.2em" },
1153
+ children: "⚡"
1154
+ }, undefined, false, undefined, this),
1155
+ /* @__PURE__ */ jsxDEV11("span", {
1060
1156
  style: {
1061
1157
  color: "#f1f5f9",
1062
- fontSize: "13px",
1158
+ fontSize: "1.2em",
1063
1159
  fontWeight: "600",
1064
1160
  overflow: "hidden",
1065
1161
  textOverflow: "ellipsis",
@@ -1069,14 +1165,14 @@ function DetailHeader({
1069
1165
  },
1070
1166
  children: entry.actionId
1071
1167
  }, undefined, false, undefined, this),
1072
- /* @__PURE__ */ jsxDEV12(DomainChip, {
1168
+ /* @__PURE__ */ jsxDEV11(DomainChip, {
1073
1169
  domain: entry.domain,
1074
1170
  allDomains: entry.allDomains,
1075
1171
  size: "md"
1076
1172
  }, undefined, false, undefined, this)
1077
1173
  ]
1078
1174
  }, undefined, true, undefined, this),
1079
- /* @__PURE__ */ jsxDEV12("div", {
1175
+ /* @__PURE__ */ jsxDEV11("div", {
1080
1176
  style: {
1081
1177
  display: "flex",
1082
1178
  alignItems: "center",
@@ -1084,7 +1180,7 @@ function DetailHeader({
1084
1180
  gap: "8px"
1085
1181
  },
1086
1182
  children: [
1087
- /* @__PURE__ */ jsxDEV12("div", {
1183
+ /* @__PURE__ */ jsxDEV11("div", {
1088
1184
  style: {
1089
1185
  display: "flex",
1090
1186
  alignItems: "center",
@@ -1092,28 +1188,21 @@ function DetailHeader({
1092
1188
  minWidth: 0,
1093
1189
  overflow: "hidden"
1094
1190
  },
1095
- children: [
1096
- /* @__PURE__ */ jsxDEV12(HandlerChips, {
1097
- entry,
1098
- size: "md",
1099
- alwaysShowLocal: true
1100
- }, undefined, false, undefined, this),
1101
- /* @__PURE__ */ jsxDEV12(ChildDispatchChips, {
1102
- labels: childExternalLabels,
1103
- size: "md"
1104
- }, undefined, false, undefined, this)
1105
- ]
1106
- }, undefined, true, undefined, this),
1107
- /* @__PURE__ */ jsxDEV12("div", {
1191
+ children: /* @__PURE__ */ jsxDEV11(HandlerChips, {
1192
+ entry,
1193
+ size: "md"
1194
+ }, undefined, false, undefined, this)
1195
+ }, undefined, false, undefined, this),
1196
+ /* @__PURE__ */ jsxDEV11("div", {
1108
1197
  style: { display: "flex", alignItems: "center", gap: "8px", flexShrink: 0 },
1109
1198
  children: [
1110
- /* @__PURE__ */ jsxDEV12("span", {
1199
+ /* @__PURE__ */ jsxDEV11("span", {
1111
1200
  style: { color: "#334155", fontSize: "10px", letterSpacing: "0.02em" },
1112
1201
  children: timestamp
1113
1202
  }, undefined, false, undefined, this),
1114
- /* @__PURE__ */ jsxDEV12("span", {
1203
+ /* @__PURE__ */ jsxDEV11("span", {
1115
1204
  style: { color, fontSize: "12px", fontWeight: "500" },
1116
- children: /* @__PURE__ */ jsxDEV12(DurationDisplay, {
1205
+ children: /* @__PURE__ */ jsxDEV11(DurationDisplay, {
1117
1206
  entry
1118
1207
  }, undefined, false, undefined, this)
1119
1208
  }, undefined, false, undefined, this)
@@ -1153,7 +1242,7 @@ function ActionDetailPanel({
1153
1242
  const handleFocusChild = (cuid) => {
1154
1243
  setFocusedChildCuid((prev) => prev === cuid ? null : cuid);
1155
1244
  };
1156
- return /* @__PURE__ */ jsxDEV12("div", {
1245
+ return /* @__PURE__ */ jsxDEV11("div", {
1157
1246
  style: {
1158
1247
  flex: 1,
1159
1248
  display: "flex",
@@ -1163,13 +1252,13 @@ function ActionDetailPanel({
1163
1252
  background: "#0f172a"
1164
1253
  },
1165
1254
  children: [
1166
- /* @__PURE__ */ jsxDEV12(DetailHeader, {
1255
+ /* @__PURE__ */ jsxDEV11(DetailHeader, {
1167
1256
  entry,
1168
1257
  isActive: focusedChildCuid === null,
1169
1258
  onClick: () => setFocusedChildCuid(null),
1170
1259
  childExternalLabels
1171
1260
  }, undefined, false, undefined, this),
1172
- /* @__PURE__ */ jsxDEV12("div", {
1261
+ /* @__PURE__ */ jsxDEV11("div", {
1173
1262
  style: {
1174
1263
  flex: 1,
1175
1264
  overflowY: "auto",
@@ -1180,63 +1269,63 @@ function ActionDetailPanel({
1180
1269
  gap: "8px"
1181
1270
  },
1182
1271
  children: [
1183
- /* @__PURE__ */ jsxDEV12(CallStackSection, {
1272
+ /* @__PURE__ */ jsxDEV11(CallStackSection, {
1184
1273
  parent,
1185
1274
  childEntries,
1186
1275
  focusedChildCuid,
1187
1276
  onFocusChild: handleFocusChild,
1188
1277
  onSelectParent: onSelectEntry
1189
1278
  }, undefined, false, undefined, this),
1190
- /* @__PURE__ */ jsxDEV12(MetaSection, {
1279
+ /* @__PURE__ */ jsxDEV11(MetaSection, {
1191
1280
  entry: focusedEntry
1192
1281
  }, undefined, false, undefined, this),
1193
- /* @__PURE__ */ jsxDEV12(RoutingSection, {
1282
+ /* @__PURE__ */ jsxDEV11(RoutingSection, {
1194
1283
  entry: focusedEntry,
1195
1284
  minHopCount: maxRoutingHops
1196
1285
  }, undefined, false, undefined, this),
1197
- /* @__PURE__ */ jsxDEV12(StackTraceSection, {
1286
+ /* @__PURE__ */ jsxDEV11(StackTraceSection, {
1198
1287
  label: "Dispatch Site",
1199
1288
  stack: focusedEntry.callSite,
1200
1289
  color: "#94a3b8"
1201
1290
  }, undefined, false, undefined, this),
1202
- /* @__PURE__ */ jsxDEV12(DetailSection, {
1291
+ /* @__PURE__ */ jsxDEV11(DetailSection, {
1203
1292
  label: "Input",
1204
1293
  value: focusedEntry.input
1205
1294
  }, undefined, false, undefined, this),
1206
- focusedEntry.status === "success" && /* @__PURE__ */ jsxDEV12(DetailSection, {
1295
+ focusedEntry.status === "success" && /* @__PURE__ */ jsxDEV11(DetailSection, {
1207
1296
  label: "Output",
1208
1297
  value: focusedEntry.output,
1209
1298
  color: "#4ade80"
1210
1299
  }, undefined, false, undefined, this),
1211
- focusedEntry.status === "failed" && /* @__PURE__ */ jsxDEV12(Fragment4, {
1300
+ focusedEntry.status === "failed" && /* @__PURE__ */ jsxDEV11(Fragment3, {
1212
1301
  children: [
1213
- /* @__PURE__ */ jsxDEV12(DetailSection, {
1302
+ /* @__PURE__ */ jsxDEV11(DetailSection, {
1214
1303
  label: "Error",
1215
1304
  value: focusedEntry.error,
1216
1305
  color: "#f87171"
1217
1306
  }, undefined, false, undefined, this),
1218
- /* @__PURE__ */ jsxDEV12(StackTraceSection, {
1307
+ /* @__PURE__ */ jsxDEV11(StackTraceSection, {
1219
1308
  label: "Error Stack",
1220
1309
  stack: focusedEntry.errorStack,
1221
1310
  color: "#f87171"
1222
1311
  }, undefined, false, undefined, this)
1223
1312
  ]
1224
1313
  }, undefined, true, undefined, this),
1225
- focusedEntry.status === "aborted" && /* @__PURE__ */ jsxDEV12(Fragment4, {
1314
+ focusedEntry.status === "aborted" && /* @__PURE__ */ jsxDEV11(Fragment3, {
1226
1315
  children: [
1227
- focusedEntry.abortReason != null && /* @__PURE__ */ jsxDEV12(DetailSection, {
1316
+ focusedEntry.abortReason != null && /* @__PURE__ */ jsxDEV11(DetailSection, {
1228
1317
  label: "Abort Reason",
1229
1318
  value: focusedEntry.abortReason,
1230
1319
  color: "#9ca3af"
1231
1320
  }, undefined, false, undefined, this),
1232
- /* @__PURE__ */ jsxDEV12(StackTraceSection, {
1321
+ /* @__PURE__ */ jsxDEV11(StackTraceSection, {
1233
1322
  label: "Abort Stack",
1234
1323
  stack: focusedEntry.errorStack,
1235
1324
  color: "#9ca3af"
1236
1325
  }, undefined, false, undefined, this)
1237
1326
  ]
1238
1327
  }, undefined, true, undefined, this),
1239
- focusedEntry.progressUpdates.length > 0 && /* @__PURE__ */ jsxDEV12(DetailSection, {
1328
+ focusedEntry.progressUpdates.length > 0 && /* @__PURE__ */ jsxDEV11(DetailSection, {
1240
1329
  label: `Progress (${focusedEntry.progressUpdates.length})`,
1241
1330
  value: focusedEntry.progressUpdates
1242
1331
  }, undefined, false, undefined, this)
@@ -1246,6 +1335,30 @@ function ActionDetailPanel({
1246
1335
  }, undefined, true, undefined, this);
1247
1336
  }
1248
1337
 
1338
+ // src/devtools/browser/components/ChildDispatchChips.tsx
1339
+ import { jsxDEV as jsxDEV12, Fragment as Fragment4 } from "react/jsx-dev-runtime";
1340
+ function ChildDispatchChips({
1341
+ labels,
1342
+ size = "sm"
1343
+ }) {
1344
+ if (labels == null || labels.length === 0)
1345
+ return null;
1346
+ const fontSize = size === "md" ? "1em" : "0.8em";
1347
+ const padding = size === "md" ? "1px 4px" : "1px 3px";
1348
+ return /* @__PURE__ */ jsxDEV12(Fragment4, {
1349
+ children: labels.map((label) => /* @__PURE__ */ jsxDEV12(Chip, {
1350
+ color: DEVTOOL_COLOR_HANDLER_EXTERNAL_TEXT,
1351
+ borderColor: DEVTOOL_COLOR_HANDLER_EXTERNAL_BORDER,
1352
+ fontSize,
1353
+ padding,
1354
+ children: [
1355
+ "↳ ",
1356
+ label
1357
+ ]
1358
+ }, label, true, undefined, this))
1359
+ }, undefined, false, undefined, this);
1360
+ }
1361
+
1249
1362
  // src/devtools/browser/components/ActionEntryRow.tsx
1250
1363
  import { jsxDEV as jsxDEV13 } from "react/jsx-dev-runtime";
1251
1364
  function ActionEntryRow({
@@ -1280,6 +1393,12 @@ function ActionEntryRow({
1280
1393
  style: { color: "#334155", fontSize: "10px", flexShrink: 0 },
1281
1394
  children: symbol
1282
1395
  }, undefined, false, undefined, this),
1396
+ /* @__PURE__ */ jsxDEV13(DomainChip, {
1397
+ subtle: true,
1398
+ domain: entry.domain,
1399
+ allDomains: entry.allDomains,
1400
+ size: "sm"
1401
+ }, undefined, false, undefined, this),
1283
1402
  /* @__PURE__ */ jsxDEV13("span", {
1284
1403
  children: [
1285
1404
  /* @__PURE__ */ jsxDEV13("span", {
@@ -1300,11 +1419,6 @@ function ActionEntryRow({
1300
1419
  }, undefined, false, undefined, this)
1301
1420
  ]
1302
1421
  }, undefined, true, undefined, this),
1303
- /* @__PURE__ */ jsxDEV13(DomainChip, {
1304
- domain: entry.domain,
1305
- allDomains: entry.allDomains,
1306
- size: "sm"
1307
- }, undefined, false, undefined, this),
1308
1422
  /* @__PURE__ */ jsxDEV13("span", {
1309
1423
  style: { color: "#334155", fontSize: "11px", flexShrink: 0 },
1310
1424
  children: /* @__PURE__ */ jsxDEV13(DurationDisplay, {
@@ -1368,9 +1482,18 @@ function ActionEntryRow({
1368
1482
  alignItems: "center",
1369
1483
  minWidth: 0,
1370
1484
  overflow: "hidden",
1371
- gap: "0.5em"
1485
+ gap: "0.3em"
1372
1486
  },
1373
1487
  children: [
1488
+ /* @__PURE__ */ jsxDEV13(DomainChip, {
1489
+ domain: entry.domain,
1490
+ allDomains: entry.allDomains,
1491
+ size: "md"
1492
+ }, undefined, false, undefined, this),
1493
+ /* @__PURE__ */ jsxDEV13("span", {
1494
+ style: { color: isSelected ? "#818cf8" : "#3730a3", fontSize: "1em" },
1495
+ children: "⚡"
1496
+ }, undefined, false, undefined, this),
1374
1497
  /* @__PURE__ */ jsxDEV13("span", {
1375
1498
  style: {
1376
1499
  color: "#cbd5e1",
@@ -1382,11 +1505,6 @@ function ActionEntryRow({
1382
1505
  minWidth: "24px"
1383
1506
  },
1384
1507
  children: entry.actionId
1385
- }, undefined, false, undefined, this),
1386
- /* @__PURE__ */ jsxDEV13(DomainChip, {
1387
- domain: entry.domain,
1388
- allDomains: entry.allDomains,
1389
- size: "md"
1390
1508
  }, undefined, false, undefined, this)
1391
1509
  ]
1392
1510
  }, undefined, true, undefined, this),
@@ -1427,7 +1545,7 @@ function ActionEntryRow({
1427
1545
  fontSize: "9px",
1428
1546
  padding: "1px 5px",
1429
1547
  children: [
1430
- "×",
1548
+ "x",
1431
1549
  groupCount
1432
1550
  ]
1433
1551
  }, undefined, true, undefined, this),
@@ -1611,14 +1729,18 @@ if (typeof document !== "undefined" && !document.getElementById("__nice-action-d
1611
1729
  0%, 100% { opacity: 1; }
1612
1730
  50% { opacity: 0.35; }
1613
1731
  }
1732
+ @keyframes __nice-action-shine {
1733
+ 0% { transform: translateX(-100%); opacity: 0; }
1734
+ 15% { opacity: 1; }
1735
+ 85% { opacity: 1; }
1736
+ 100% { transform: translateX(200%); opacity: 0; }
1737
+ }
1614
1738
  `;
1615
1739
  document.head?.appendChild(style);
1616
1740
  }
1617
1741
  var PREFS_KEY = "__nice-action-devtools-prefs";
1618
1742
  var DOCKED_HEIGHT_DEFAULT = 320;
1619
1743
  var DOCKED_WIDTH_DEFAULT = 420;
1620
- var ROW_HEIGHT = 50;
1621
- var SUB_ROW_HEIGHT = 30;
1622
1744
  function readPrefs(defaultPosition, initialOpen) {
1623
1745
  const fallback = {
1624
1746
  position: defaultPosition,
@@ -1689,10 +1811,10 @@ function NiceActionDevtools_Panel({
1689
1811
  const showDomainTooltip = useCallback((rect, allDomains) => setDomainTooltip({ rect, allDomains }), []);
1690
1812
  const hideDomainTooltip = useCallback(() => setDomainTooltip(null), []);
1691
1813
  const domainTooltipCtx = useMemo2(() => ({ show: showDomainTooltip, hide: hideDomainTooltip }), [showDomainTooltip, hideDomainTooltip]);
1692
- useEffect2(() => core.subscribe(setEntries), [core]);
1814
+ useEffect3(() => core.subscribe(setEntries), [core]);
1693
1815
  const groups = useMemo2(() => {
1694
1816
  const byCuid = new Map(entries.map((e) => [e.cuid, e]));
1695
- const roots = entries.filter((e) => e.parentCuid == null || !byCuid.has(e.parentCuid));
1817
+ const roots = entries.filter((e) => e.status !== "running" && (e.parentCuid == null || !byCuid.has(e.parentCuid)));
1696
1818
  return groupEntries(roots);
1697
1819
  }, [entries]);
1698
1820
  const childExternalLabelsMap = useMemo2(() => {
@@ -1714,19 +1836,20 @@ function NiceActionDevtools_Panel({
1714
1836
  }, [entries]);
1715
1837
  const handleGroupRowClick = (group) => {
1716
1838
  const repCuid = group.representative.cuid;
1717
- const isExpanded = expandedGroupCuids.has(repCuid);
1718
- const isSelected = selectedCuid === repCuid;
1719
- if (group.rest.length === 0) {
1720
- setSelectedCuid(isSelected ? null : repCuid);
1721
- setExpandedGroupCuids(new Set);
1722
- } else if (isSelected && isExpanded) {
1723
- setSelectedCuid(null);
1724
- setExpandedGroupCuids(new Set);
1725
- } else {
1839
+ const allInGroup = [group.representative, ...group.rest];
1840
+ const selectedInGroup = allInGroup.find((e) => e.cuid === selectedCuid) ?? null;
1841
+ setExpandedGroupCuids(new Set);
1842
+ if (selectedInGroup != null && selectedCuid !== repCuid) {
1726
1843
  setSelectedCuid(repCuid);
1727
- setExpandedGroupCuids(new Set([repCuid]));
1844
+ } else {
1845
+ setSelectedCuid(selectedCuid === repCuid ? null : repCuid);
1728
1846
  }
1729
1847
  };
1848
+ const handleExpandGroup = (group) => {
1849
+ const oldestCuid = (group.rest[group.rest.length - 1] ?? group.representative).cuid;
1850
+ setSelectedCuid(null);
1851
+ setExpandedGroupCuids(new Set([oldestCuid]));
1852
+ };
1730
1853
  const setPrefs = (update) => {
1731
1854
  setPrefsRaw((prev) => {
1732
1855
  const next = { ...prev, ...update };
@@ -1740,7 +1863,7 @@ function NiceActionDevtools_Panel({
1740
1863
  const dockedSize = isHorizDock ? dockedHeight : dockedWidth;
1741
1864
  const selectedEntry = selectedCuid != null ? entries.find((e) => e.cuid === selectedCuid) : null;
1742
1865
  const runningCount = entries.filter((e) => e.status === "running").length;
1743
- useEffect2(() => {
1866
+ useEffect3(() => {
1744
1867
  const sides = ["top", "bottom", "left", "right"];
1745
1868
  const clearAll = () => {
1746
1869
  sides.forEach((s) => {
@@ -1863,7 +1986,11 @@ function NiceActionDevtools_Panel({
1863
1986
  selectedCuid,
1864
1987
  expandedGroupCuids,
1865
1988
  onGroupClick: handleGroupRowClick,
1866
- onSubClick: (cuid, isSelected) => setSelectedCuid(isSelected ? null : cuid),
1989
+ onSubClick: (cuid, isSelected) => {
1990
+ setSelectedCuid(isSelected ? null : cuid);
1991
+ setExpandedGroupCuids(new Set);
1992
+ },
1993
+ onExpandGroup: handleExpandGroup,
1867
1994
  childExternalLabelsMap
1868
1995
  };
1869
1996
  return /* @__PURE__ */ jsxDEV15(DomainTooltipCtx.Provider, {
@@ -1893,7 +2020,7 @@ function NiceActionDevtools_Panel({
1893
2020
  isHorizDock ? /* @__PURE__ */ jsxDEV15("div", {
1894
2021
  style: { flex: 1, display: "flex", overflow: "hidden" },
1895
2022
  children: [
1896
- /* @__PURE__ */ jsxDEV15(VirtualActionList, {
2023
+ /* @__PURE__ */ jsxDEV15(ActionList, {
1897
2024
  ...virtualListProps,
1898
2025
  style: {
1899
2026
  width: "340px",
@@ -1922,7 +2049,7 @@ function NiceActionDevtools_Panel({
1922
2049
  ]
1923
2050
  }, undefined, true, undefined, this) : /* @__PURE__ */ jsxDEV15(Fragment5, {
1924
2051
  children: [
1925
- /* @__PURE__ */ jsxDEV15(VirtualActionList, {
2052
+ /* @__PURE__ */ jsxDEV15(ActionList, {
1926
2053
  ...virtualListProps,
1927
2054
  style: {
1928
2055
  overflowY: "auto",
@@ -1952,64 +2079,65 @@ function NiceActionDevtools_Panel({
1952
2079
  }, undefined, true, undefined, this)
1953
2080
  }, undefined, false, undefined, this);
1954
2081
  }
1955
- function VirtualActionList({
2082
+ function getFlatItemKey(item) {
2083
+ const oldestCuid = item.group.rest[item.group.rest.length - 1]?.cuid ?? item.group.representative.cuid;
2084
+ if (item.type === "group")
2085
+ return `g:${oldestCuid}`;
2086
+ if (item.type === "sub")
2087
+ return `s:${item.entry.cuid}`;
2088
+ return `c:${item.position}:${oldestCuid}`;
2089
+ }
2090
+ function ActionList({
1956
2091
  groups,
1957
2092
  selectedCuid,
1958
2093
  expandedGroupCuids,
1959
2094
  onGroupClick,
1960
2095
  onSubClick,
2096
+ onExpandGroup,
1961
2097
  childExternalLabelsMap,
1962
2098
  style
1963
2099
  }) {
1964
- const outerRef = useRef2(null);
2100
+ const containerRef = useRef2(null);
1965
2101
  const latestTime = groups[0]?.representative.startTime;
1966
2102
  const flatItems = useMemo2(() => {
1967
2103
  const result = [];
1968
2104
  for (let gi = 0;gi < groups.length; gi++) {
1969
2105
  const group = groups[gi];
1970
2106
  const repCuid = group.representative.cuid;
1971
- const isExpanded = expandedGroupCuids.has(repCuid) || group.rest.some((e) => e.cuid === selectedCuid);
2107
+ const allInGroup = [group.representative, ...group.rest];
2108
+ const selectedIdx = allInGroup.findIndex((e) => e.cuid === selectedCuid);
1972
2109
  result.push({ type: "group", group, groupIndex: gi });
1973
- if (isExpanded) {
1974
- for (const entry of group.rest) {
1975
- result.push({ type: "sub", entry, group });
2110
+ const oldestCuid = (group.rest[group.rest.length - 1] ?? group.representative).cuid;
2111
+ if (selectedIdx > 0) {
2112
+ const aboveCount = selectedIdx;
2113
+ const belowCount = allInGroup.length - selectedIdx - 1;
2114
+ if (aboveCount > 0)
2115
+ result.push({ type: "group-count", count: aboveCount, position: "above", group });
2116
+ result.push({ type: "sub", entry: allInGroup[selectedIdx], group });
2117
+ if (belowCount > 0)
2118
+ result.push({ type: "group-count", count: belowCount, position: "below", group });
2119
+ } else if (selectedIdx === 0 && group.rest.length > 0) {
2120
+ result.push({ type: "group-count", count: group.rest.length, position: "below", group });
2121
+ } else {
2122
+ const isExpanded = expandedGroupCuids.has(repCuid) || expandedGroupCuids.has(oldestCuid);
2123
+ if (isExpanded) {
2124
+ for (const entry of group.rest) {
2125
+ result.push({ type: "sub", entry, group });
2126
+ }
1976
2127
  }
1977
2128
  }
1978
2129
  }
1979
2130
  return result;
1980
2131
  }, [groups, expandedGroupCuids, selectedCuid]);
1981
- const flatItemsRef = useRef2(flatItems);
1982
- flatItemsRef.current = flatItems;
1983
- const virtualizer = useVirtualizer({
1984
- count: flatItems.length,
1985
- getScrollElement: () => outerRef.current,
1986
- estimateSize: (i) => flatItemsRef.current[i]?.type === "sub" ? SUB_ROW_HEIGHT : ROW_HEIGHT,
1987
- overscan: 5,
1988
- measureElement: (el) => el.getBoundingClientRect().height
1989
- });
1990
- const prevGroupLenRef = useRef2(groups.length);
1991
- useLayoutEffect(() => {
1992
- const el = outerRef.current;
1993
- if (el == null)
1994
- return;
1995
- const prev = prevGroupLenRef.current;
1996
- prevGroupLenRef.current = groups.length;
1997
- const added = groups.length - prev;
1998
- if (added > 0 && el.scrollTop > 10) {
1999
- el.scrollTop += added * ROW_HEIGHT;
2000
- }
2001
- }, [groups]);
2002
2132
  const prevSelectedRef = useRef2(selectedCuid);
2003
- useEffect2(() => {
2133
+ useEffect3(() => {
2004
2134
  if (selectedCuid === prevSelectedRef.current)
2005
2135
  return;
2006
2136
  prevSelectedRef.current = selectedCuid;
2007
2137
  if (selectedCuid == null)
2008
2138
  return;
2009
- const idx = flatItemsRef.current.findIndex((item) => item.type === "group" && (item.group.representative.cuid === selectedCuid || item.group.rest.some((e) => e.cuid === selectedCuid)) || item.type === "sub" && item.entry.cuid === selectedCuid);
2010
- if (idx >= 0)
2011
- virtualizer.scrollToIndex(idx, { align: "auto" });
2012
- }, [selectedCuid, virtualizer]);
2139
+ containerRef.current?.querySelector(`[data-cuid="${selectedCuid}"]`)?.scrollIntoView({ block: "nearest" });
2140
+ }, [selectedCuid]);
2013
2141
  if (groups.length === 0) {
2014
2142
  return /* @__PURE__ */ jsxDEV15("div", {
2015
2143
  style,
@@ -2019,28 +2147,25 @@ function VirtualActionList({
2019
2147
  }, undefined, false, undefined, this)
2020
2148
  }, undefined, false, undefined, this);
2021
2149
  }
2022
- const virtualItems = virtualizer.getVirtualItems();
2023
2150
  return /* @__PURE__ */ jsxDEV15("div", {
2024
- ref: outerRef,
2151
+ ref: containerRef,
2025
2152
  style,
2026
- children: /* @__PURE__ */ jsxDEV15("div", {
2027
- style: { height: `${virtualizer.getTotalSize()}px`, position: "relative" },
2028
- children: virtualItems.map((vi) => {
2029
- const item = flatItems[vi.index];
2030
- if (item == null)
2031
- return null;
2032
- return /* @__PURE__ */ jsxDEV15("div", {
2033
- "data-index": vi.index,
2034
- ref: virtualizer.measureElement,
2035
- style: {
2036
- position: "absolute",
2037
- top: 0,
2038
- left: 0,
2039
- width: "100%",
2040
- transform: `translateY(${vi.start}px)`,
2041
- borderBottom: "1px solid #101109"
2042
- },
2043
- children: item.type === "group" ? /* @__PURE__ */ jsxDEV15(ActionEntryRow, {
2153
+ children: flatItems.map((item) => {
2154
+ const key = getFlatItemKey(item);
2155
+ return /* @__PURE__ */ jsxDEV15("div", {
2156
+ "data-cuid": item.type === "group" ? item.group.representative.cuid : item.type === "sub" ? item.entry.cuid : undefined,
2157
+ style: { borderBottom: "1px solid #101109", position: "relative", overflow: "hidden" },
2158
+ children: [
2159
+ item.type === "group" && /* @__PURE__ */ jsxDEV15("div", {
2160
+ style: {
2161
+ position: "absolute",
2162
+ inset: 0,
2163
+ pointerEvents: "none",
2164
+ background: "linear-gradient(90deg, transparent 0%, rgba(148, 210, 255, 0.13) 50%, transparent 100%)",
2165
+ animation: "__nice-action-shine 0.65s ease-out forwards"
2166
+ }
2167
+ }, item.group.representative.cuid, false, undefined, this),
2168
+ item.type === "group" ? /* @__PURE__ */ jsxDEV15(ActionEntryRow, {
2044
2169
  entry: item.group.representative,
2045
2170
  isSelected: selectedCuid === item.group.representative.cuid,
2046
2171
  groupCount: item.group.rest.length > 0 ? item.group.rest.length + 1 : undefined,
@@ -2048,7 +2173,34 @@ function VirtualActionList({
2048
2173
  latestTime,
2049
2174
  childExternalLabels: childExternalLabelsMap.get(item.group.representative.cuid),
2050
2175
  onClick: () => onGroupClick(item.group)
2051
- }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV15(ActionEntryRow, {
2176
+ }, undefined, false, undefined, this) : item.type === "group-count" ? /* @__PURE__ */ jsxDEV15("div", {
2177
+ onClick: () => onExpandGroup(item.group),
2178
+ style: {
2179
+ padding: "2px 28px",
2180
+ fontSize: "10px",
2181
+ color: "#475569",
2182
+ display: "flex",
2183
+ alignItems: "center",
2184
+ gap: "5px",
2185
+ background: "#0a1120",
2186
+ cursor: "pointer",
2187
+ userSelect: "none"
2188
+ },
2189
+ children: [
2190
+ /* @__PURE__ */ jsxDEV15("span", {
2191
+ style: { opacity: 0.6 },
2192
+ children: item.position === "above" ? "↑" : "↓"
2193
+ }, undefined, false, undefined, this),
2194
+ /* @__PURE__ */ jsxDEV15("span", {
2195
+ children: [
2196
+ item.count,
2197
+ " ",
2198
+ item.position === "above" ? "newer" : "older",
2199
+ " — click to browse"
2200
+ ]
2201
+ }, undefined, true, undefined, this)
2202
+ ]
2203
+ }, undefined, true, undefined, this) : /* @__PURE__ */ jsxDEV15(ActionEntryRow, {
2052
2204
  entry: item.entry,
2053
2205
  isSelected: selectedCuid === item.entry.cuid,
2054
2206
  isSubEntry: true,
@@ -2056,9 +2208,9 @@ function VirtualActionList({
2056
2208
  latestTime,
2057
2209
  onClick: () => onSubClick(item.entry.cuid, selectedCuid === item.entry.cuid)
2058
2210
  }, undefined, false, undefined, this)
2059
- }, vi.key, false, undefined, this);
2060
- })
2061
- }, undefined, false, undefined, this)
2211
+ ]
2212
+ }, key, true, undefined, this);
2213
+ })
2062
2214
  }, undefined, false, undefined, this);
2063
2215
  }
2064
2216
  export {