@ai-matrx/agents 0.28.1 → 0.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/content-transfer/index.cjs +1 -0
- package/dist/content-transfer/index.cjs.map +1 -1
- package/dist/content-transfer/index.d.cts +2 -1
- package/dist/content-transfer/index.d.ts +2 -1
- package/dist/content-transfer/index.js +1 -0
- package/dist/content-transfer/index.js.map +1 -1
- package/dist/content-transfer/react/index.cjs +1 -0
- package/dist/content-transfer/react/index.cjs.map +1 -1
- package/dist/content-transfer/react/index.js +1 -0
- package/dist/content-transfer/react/index.js.map +1 -1
- package/dist/context/index.cjs +29 -5
- package/dist/context/index.cjs.map +1 -1
- package/dist/context/index.d.cts +65 -13
- package/dist/context/index.d.ts +65 -13
- package/dist/context/index.js +29 -5
- package/dist/context/index.js.map +1 -1
- package/dist/context/react/index.cjs +262 -78
- package/dist/context/react/index.cjs.map +1 -1
- package/dist/context/react/index.d.cts +100 -21
- package/dist/context/react/index.d.ts +100 -21
- package/dist/context/react/index.js +261 -77
- package/dist/context/react/index.js.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/mandates/index.cjs +3 -2
- package/dist/mandates/index.cjs.map +1 -1
- package/dist/mandates/index.d.cts +6 -5
- package/dist/mandates/index.d.ts +6 -5
- package/dist/mandates/index.js +3 -2
- package/dist/mandates/index.js.map +1 -1
- package/dist/matrx/index.d.cts +4 -2
- package/dist/matrx/index.d.ts +4 -2
- package/dist/{operations-Dp4ut-ac.d.ts → operations-C3iHFcnt.d.ts} +2 -94
- package/dist/{operations--f5ko9Su.d.cts → operations-C9QvBH_2.d.cts} +2 -94
- package/dist/portable/index.cjs +164 -0
- package/dist/portable/index.cjs.map +1 -0
- package/dist/portable/index.d.cts +74 -0
- package/dist/portable/index.d.ts +74 -0
- package/dist/portable/index.js +141 -0
- package/dist/portable/index.js.map +1 -0
- package/dist/portable/mcp.cjs +512 -0
- package/dist/portable/mcp.cjs.map +1 -0
- package/dist/portable/mcp.d.cts +81 -0
- package/dist/portable/mcp.d.ts +81 -0
- package/dist/portable/mcp.js +492 -0
- package/dist/portable/mcp.js.map +1 -0
- package/dist/transport-CxD0fL8p.d.cts +94 -0
- package/dist/transport-CxD0fL8p.d.ts +94 -0
- package/dist/types.generated-BydVlqDC.d.cts +49 -0
- package/dist/types.generated-BydVlqDC.d.ts +49 -0
- package/mandates/snapshots/keys.0.29.0.json +652 -0
- package/mandates/snapshots/keys.0.29.1.json +653 -0
- package/package.json +22 -2
|
@@ -13,6 +13,14 @@ import {
|
|
|
13
13
|
// context/index.ts
|
|
14
14
|
var DEFAULT_INLINE_MAX_CHARS = 200;
|
|
15
15
|
var DEFAULT_INLINE_CAP = 5e4;
|
|
16
|
+
var CONTEXT_ROW_BLOCKS = {
|
|
17
|
+
organization: ["organization_catalog"]
|
|
18
|
+
};
|
|
19
|
+
function unclaimedBlocks(blocks, rowKeys) {
|
|
20
|
+
const claimed = /* @__PURE__ */ new Set();
|
|
21
|
+
for (const key of rowKeys) for (const id of CONTEXT_ROW_BLOCKS[key] ?? []) claimed.add(id);
|
|
22
|
+
return (blocks ?? []).filter((b) => !claimed.has(b.id));
|
|
23
|
+
}
|
|
16
24
|
var SERVER_AUTHORITATIVE_KEYS = {
|
|
17
25
|
user: "manifest",
|
|
18
26
|
client: "manifest",
|
|
@@ -557,7 +565,7 @@ import {
|
|
|
557
565
|
cn as cn3
|
|
558
566
|
} from "@ai-matrx/design-system";
|
|
559
567
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
560
|
-
var BLIND_TOOLTIP = "This model can't read
|
|
568
|
+
var BLIND_TOOLTIP = "This model can't read these values";
|
|
561
569
|
var BLIND_LABEL = "Not read";
|
|
562
570
|
function summarizeContextRows(rows) {
|
|
563
571
|
let count = 0;
|
|
@@ -622,6 +630,8 @@ function ContextRulesChip({
|
|
|
622
630
|
onOpenChange?.(next);
|
|
623
631
|
};
|
|
624
632
|
const { count, charsLabel } = summarizeContextRows(rows);
|
|
633
|
+
const name = label?.trim() ?? "";
|
|
634
|
+
const faceName = name ? `${name} \xB7 ${count} included` : `${count} included`;
|
|
625
635
|
const anyOverride = rows.some(hasOverride);
|
|
626
636
|
const blind = !modelReadsContext;
|
|
627
637
|
const warn = mismatchCount > 0 && !blind;
|
|
@@ -632,20 +642,21 @@ function ContextRulesChip({
|
|
|
632
642
|
"button",
|
|
633
643
|
{
|
|
634
644
|
type: "button",
|
|
635
|
-
"aria-label":
|
|
645
|
+
"aria-label": faceName,
|
|
636
646
|
"data-mismatch": warn ? "true" : void 0,
|
|
637
647
|
"data-blind": blind ? "true" : void 0,
|
|
638
648
|
onClick: isMobile ? () => setOpen(true) : void 0,
|
|
639
649
|
className: cn3(
|
|
640
|
-
"inline-flex h-
|
|
650
|
+
"relative inline-flex h-6 max-w-[12rem] shrink-0 items-center gap-1 rounded-md border border-border bg-card px-1.5 text-xs font-medium text-foreground transition-colors hover:bg-accent",
|
|
651
|
+
comfortable && "after:absolute after:-inset-x-1.5 after:-inset-y-2.5 after:content-['']",
|
|
641
652
|
!eyeOpen && "text-muted-foreground",
|
|
642
653
|
blind && "border-dashed",
|
|
643
654
|
warn && "border-warning/60 ring-1 ring-warning",
|
|
644
655
|
className
|
|
645
656
|
),
|
|
646
657
|
children: [
|
|
647
|
-
eyeOpen ? /* @__PURE__ */ jsx4(EyeIcon, { className: "h-3
|
|
648
|
-
/* @__PURE__ */ jsx4("span", { className: "min-w-0 truncate", children:
|
|
658
|
+
eyeOpen ? /* @__PURE__ */ jsx4(EyeIcon, { className: "h-3 w-3 shrink-0" }) : /* @__PURE__ */ jsx4(EyeOffIcon, { className: "h-3 w-3 shrink-0" }),
|
|
659
|
+
name ? /* @__PURE__ */ jsx4("span", { className: "min-w-0 truncate", children: name }) : null,
|
|
649
660
|
/* @__PURE__ */ jsx4("span", { className: "shrink-0 tabular-nums text-muted-foreground", children: count }),
|
|
650
661
|
warn ? /* @__PURE__ */ jsxs4("span", { className: "inline-flex shrink-0 items-center gap-0.5 tabular-nums text-warning", children: [
|
|
651
662
|
/* @__PURE__ */ jsx4(TriangleAlertIcon, { className: "h-3 w-3" }),
|
|
@@ -654,9 +665,10 @@ function ContextRulesChip({
|
|
|
654
665
|
]
|
|
655
666
|
}
|
|
656
667
|
);
|
|
657
|
-
const
|
|
668
|
+
const faceTip = blind ? BLIND_TOOLTIP : name ? null : faceName;
|
|
669
|
+
const withBlindTip = (trigger) => faceTip ? /* @__PURE__ */ jsxs4(Tooltip3, { children: [
|
|
658
670
|
/* @__PURE__ */ jsx4(TooltipTrigger3, { asChild: true, children: trigger }),
|
|
659
|
-
/* @__PURE__ */ jsx4(TooltipContent3, { children:
|
|
671
|
+
/* @__PURE__ */ jsx4(TooltipContent3, { children: faceTip })
|
|
660
672
|
] }) : trigger;
|
|
661
673
|
const body = /* @__PURE__ */ jsxs4("div", { className: "flex min-h-0 flex-col", children: [
|
|
662
674
|
/* @__PURE__ */ jsxs4(
|
|
@@ -668,7 +680,7 @@ function ContextRulesChip({
|
|
|
668
680
|
),
|
|
669
681
|
children: [
|
|
670
682
|
eyeOpen ? /* @__PURE__ */ jsx4(EyeIcon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }) : /* @__PURE__ */ jsx4(EyeOffIcon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
671
|
-
/* @__PURE__ */ jsx4("span", { className: "min-w-0 truncate text-sm font-medium", children:
|
|
683
|
+
name ? /* @__PURE__ */ jsx4("span", { className: "min-w-0 truncate text-sm font-medium", children: name }) : null,
|
|
672
684
|
/* @__PURE__ */ jsx4("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: `${count} \xB7 ${charsLabel} chars` }),
|
|
673
685
|
/* @__PURE__ */ jsxs4("div", { className: "ml-auto flex shrink-0 items-center gap-0.5", children: [
|
|
674
686
|
blind ? /* @__PURE__ */ jsx4("span", { className: "mr-1 text-xs text-muted-foreground", children: BLIND_LABEL }) : null,
|
|
@@ -676,7 +688,7 @@ function ContextRulesChip({
|
|
|
676
688
|
Switch2,
|
|
677
689
|
{
|
|
678
690
|
size: "sm",
|
|
679
|
-
"aria-label": "
|
|
691
|
+
"aria-label": "Include this page",
|
|
680
692
|
checked: on,
|
|
681
693
|
disabled: readOnly || !onToggleAll,
|
|
682
694
|
onCheckedChange: (next) => onToggleAll?.(next),
|
|
@@ -716,7 +728,7 @@ function ContextRulesChip({
|
|
|
716
728
|
if (isMobile) {
|
|
717
729
|
return /* @__PURE__ */ jsxs4(TooltipProvider2, { delayDuration: 300, titleTooltips: false, children: [
|
|
718
730
|
withBlindTip(faceButton),
|
|
719
|
-
/* @__PURE__ */ jsx4(BottomSheet, { open, onOpenChange: setOpen, title:
|
|
731
|
+
/* @__PURE__ */ jsx4(BottomSheet, { open, onOpenChange: setOpen, title: name || faceName, surface: "solid", children: body })
|
|
720
732
|
] });
|
|
721
733
|
}
|
|
722
734
|
return /* @__PURE__ */ jsx4(TooltipProvider2, { delayDuration: 300, titleTooltips: false, children: /* @__PURE__ */ jsxs4(Popover, { open, onOpenChange: setOpen, children: [
|
|
@@ -724,7 +736,7 @@ function ContextRulesChip({
|
|
|
724
736
|
/* @__PURE__ */ jsx4(
|
|
725
737
|
PopoverContent,
|
|
726
738
|
{
|
|
727
|
-
align: "
|
|
739
|
+
align: "end",
|
|
728
740
|
className: "w-[26rem] max-w-[calc(100vw-1rem)] overflow-hidden p-0",
|
|
729
741
|
children: body
|
|
730
742
|
}
|
|
@@ -733,36 +745,104 @@ function ContextRulesChip({
|
|
|
733
745
|
}
|
|
734
746
|
|
|
735
747
|
// context/react/ContextRulesPanelBody.tsx
|
|
736
|
-
import * as
|
|
748
|
+
import * as React4 from "react";
|
|
737
749
|
import {
|
|
738
750
|
Input as Input2,
|
|
739
751
|
Switch as Switch3,
|
|
740
752
|
TooltipProvider as TooltipProvider3,
|
|
741
|
-
cn as
|
|
753
|
+
cn as cn6
|
|
742
754
|
} from "@ai-matrx/design-system";
|
|
743
755
|
|
|
744
756
|
// context/react/ContextDeliveredValue.tsx
|
|
745
|
-
import
|
|
757
|
+
import * as React3 from "react";
|
|
758
|
+
import { Skeleton, cn as cn4 } from "@ai-matrx/design-system";
|
|
746
759
|
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
747
760
|
function ContextDeliveredValue({
|
|
748
761
|
row,
|
|
762
|
+
load,
|
|
749
763
|
className
|
|
750
764
|
}) {
|
|
751
|
-
|
|
765
|
+
const blocks = row.deliveredBlocks ?? [];
|
|
766
|
+
if (!row.delivered && !row.onRequest && blocks.length === 0) {
|
|
752
767
|
return isServerAuthoritativeKey(row.key) ? /* @__PURE__ */ jsx5("p", { "data-testid": "context-server-fills", className: cn4("text-xs text-muted-foreground", className), children: "Filled in by the server" }) : null;
|
|
753
768
|
}
|
|
754
769
|
return /* @__PURE__ */ jsxs5("div", { className: cn4("flex flex-col gap-3", className), children: [
|
|
755
|
-
row.delivered ? /* @__PURE__ */ jsx5(
|
|
756
|
-
|
|
770
|
+
row.delivered ? /* @__PURE__ */ jsx5(
|
|
771
|
+
DeliveredSection,
|
|
772
|
+
{
|
|
773
|
+
title: "Agent received",
|
|
774
|
+
target: { kind: "delivered", key: row.key },
|
|
775
|
+
ref_: row.delivered,
|
|
776
|
+
load
|
|
777
|
+
}
|
|
778
|
+
) : null,
|
|
779
|
+
blocks.map((block) => /* @__PURE__ */ jsx5(
|
|
780
|
+
DeliveredSection,
|
|
781
|
+
{
|
|
782
|
+
title: block.label,
|
|
783
|
+
target: { kind: "block", key: block.id },
|
|
784
|
+
ref_: block.delivered,
|
|
785
|
+
load
|
|
786
|
+
},
|
|
787
|
+
block.id
|
|
788
|
+
)),
|
|
789
|
+
row.onRequest ? /* @__PURE__ */ jsx5(
|
|
790
|
+
DeliveredSection,
|
|
791
|
+
{
|
|
792
|
+
title: "Returned on request",
|
|
793
|
+
target: { kind: "on_request", key: row.key },
|
|
794
|
+
ref_: row.onRequest,
|
|
795
|
+
load
|
|
796
|
+
}
|
|
797
|
+
) : null
|
|
757
798
|
] });
|
|
758
799
|
}
|
|
759
|
-
function
|
|
760
|
-
|
|
800
|
+
function DeliveredSection({
|
|
801
|
+
title,
|
|
802
|
+
target,
|
|
803
|
+
ref_,
|
|
804
|
+
load
|
|
805
|
+
}) {
|
|
806
|
+
const [loaded, setLoaded] = React3.useState({ state: "loading" });
|
|
807
|
+
const [attempt, setAttempt] = React3.useState(0);
|
|
808
|
+
const { kind, key } = target;
|
|
809
|
+
React3.useEffect(() => {
|
|
810
|
+
if (!load) return;
|
|
811
|
+
let live = true;
|
|
812
|
+
setLoaded({ state: "loading" });
|
|
813
|
+
load({ kind, key }).then(
|
|
814
|
+
(viewed) => {
|
|
815
|
+
if (live) setLoaded({ state: "done", text: viewed.text });
|
|
816
|
+
},
|
|
817
|
+
(error) => {
|
|
818
|
+
if (live)
|
|
819
|
+
setLoaded({
|
|
820
|
+
state: "error",
|
|
821
|
+
message: error instanceof Error && error.message ? error.message : "Couldn't load"
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
);
|
|
825
|
+
return () => {
|
|
826
|
+
live = false;
|
|
827
|
+
};
|
|
828
|
+
}, [load, kind, key, attempt]);
|
|
829
|
+
return /* @__PURE__ */ jsxs5("section", { className: "flex flex-col gap-1", "aria-label": title, "data-view-kind": kind, "data-view-key": key, children: [
|
|
761
830
|
/* @__PURE__ */ jsxs5("div", { className: "flex items-baseline gap-2 text-xs", children: [
|
|
762
831
|
/* @__PURE__ */ jsx5("span", { className: "font-medium", children: title }),
|
|
763
|
-
|
|
832
|
+
/* @__PURE__ */ jsx5("span", { className: "tabular-nums text-muted-foreground", children: `${formatChars(ref_.chars)} chars` })
|
|
764
833
|
] }),
|
|
765
|
-
/* @__PURE__ */ jsx5(
|
|
834
|
+
!load ? /* @__PURE__ */ jsx5("span", { className: "text-xs text-muted-foreground", children: "\u2014" }) : loaded.state === "loading" ? /* @__PURE__ */ jsx5(Skeleton, { "data-testid": "context-delivered-loading", className: "h-16 w-full" }) : loaded.state === "error" ? /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-2 text-xs text-destructive", role: "alert", children: [
|
|
835
|
+
/* @__PURE__ */ jsx5("span", { className: "min-w-0 truncate", title: loaded.message, children: loaded.message }),
|
|
836
|
+
/* @__PURE__ */ jsx5(
|
|
837
|
+
"button",
|
|
838
|
+
{
|
|
839
|
+
type: "button",
|
|
840
|
+
onClick: () => setAttempt((n) => n + 1),
|
|
841
|
+
className: "shrink-0 rounded px-1.5 py-0.5 text-foreground hover:bg-accent",
|
|
842
|
+
children: "Retry"
|
|
843
|
+
}
|
|
844
|
+
)
|
|
845
|
+
] }) : /* @__PURE__ */ jsx5(
|
|
766
846
|
"pre",
|
|
767
847
|
{
|
|
768
848
|
"data-testid": "context-delivered-text",
|
|
@@ -771,14 +851,88 @@ function DeliveredBlock({ title, text }) {
|
|
|
771
851
|
"whitespace-pre-wrap break-words rounded border border-border",
|
|
772
852
|
"bg-muted/40 p-2 font-mono text-[11px] text-foreground"
|
|
773
853
|
),
|
|
774
|
-
children:
|
|
854
|
+
children: loaded.text
|
|
855
|
+
}
|
|
856
|
+
)
|
|
857
|
+
] });
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
// context/react/ContextReceiptBlocks.tsx
|
|
861
|
+
import { cn as cn5 } from "@ai-matrx/design-system";
|
|
862
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
863
|
+
function ContextReceiptBlocks({
|
|
864
|
+
blocks,
|
|
865
|
+
selectedId,
|
|
866
|
+
onOpenBlock,
|
|
867
|
+
density = "compact",
|
|
868
|
+
className
|
|
869
|
+
}) {
|
|
870
|
+
if (blocks.length === 0) return null;
|
|
871
|
+
const comfortable = density === "comfortable";
|
|
872
|
+
return /* @__PURE__ */ jsx6("div", { role: "table", "aria-label": "Also sent", className: cn5("text-xs", className), children: /* @__PURE__ */ jsxs6("div", { role: "rowgroup", children: [
|
|
873
|
+
/* @__PURE__ */ jsx6(
|
|
874
|
+
"div",
|
|
875
|
+
{
|
|
876
|
+
role: "row",
|
|
877
|
+
className: "flex h-6 items-center bg-muted/40 px-2 font-medium text-muted-foreground",
|
|
878
|
+
children: /* @__PURE__ */ jsx6("span", { role: "cell", children: "Also sent" })
|
|
879
|
+
}
|
|
880
|
+
),
|
|
881
|
+
blocks.map((block) => /* @__PURE__ */ jsxs6(
|
|
882
|
+
"div",
|
|
883
|
+
{
|
|
884
|
+
role: "row",
|
|
885
|
+
"data-block-id": block.id,
|
|
886
|
+
"aria-selected": selectedId === block.id || void 0,
|
|
887
|
+
className: cn5(
|
|
888
|
+
CONTEXT_RULES_GRID[density],
|
|
889
|
+
"border-b border-border/50",
|
|
890
|
+
comfortable ? "min-h-11" : "h-7",
|
|
891
|
+
selectedId === block.id && "bg-accent"
|
|
892
|
+
),
|
|
893
|
+
children: [
|
|
894
|
+
/* @__PURE__ */ jsx6("div", { role: "cell", className: "col-span-2 flex min-w-0 items-center", children: onOpenBlock ? /* @__PURE__ */ jsx6(
|
|
895
|
+
"button",
|
|
896
|
+
{
|
|
897
|
+
type: "button",
|
|
898
|
+
title: block.label,
|
|
899
|
+
onClick: () => onOpenBlock(block.id),
|
|
900
|
+
className: "block min-w-0 flex-1 truncate text-left hover:underline focus-visible:underline focus-visible:outline-none",
|
|
901
|
+
children: block.label
|
|
902
|
+
}
|
|
903
|
+
) : /* @__PURE__ */ jsx6("span", { title: block.label, className: "block min-w-0 flex-1 truncate", children: block.label }) }),
|
|
904
|
+
/* @__PURE__ */ jsx6("div", { role: "cell", className: "text-right tabular-nums", children: formatChars(block.delivered.chars) }),
|
|
905
|
+
/* @__PURE__ */ jsx6("div", { role: "cell" })
|
|
906
|
+
]
|
|
907
|
+
},
|
|
908
|
+
block.id
|
|
909
|
+
))
|
|
910
|
+
] }) });
|
|
911
|
+
}
|
|
912
|
+
function ContextReceiptBlockDetail({
|
|
913
|
+
block,
|
|
914
|
+
load,
|
|
915
|
+
className
|
|
916
|
+
}) {
|
|
917
|
+
return /* @__PURE__ */ jsxs6("div", { className: cn5("flex flex-col gap-3 p-3", className), children: [
|
|
918
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex min-w-0 items-baseline gap-2", children: [
|
|
919
|
+
/* @__PURE__ */ jsx6("h3", { className: "min-w-0 truncate text-sm font-medium", children: block.label }),
|
|
920
|
+
/* @__PURE__ */ jsx6("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: `${formatChars(block.delivered.chars)} chars \xB7 ${DELIVERY_LABEL.inline}` })
|
|
921
|
+
] }),
|
|
922
|
+
/* @__PURE__ */ jsx6(
|
|
923
|
+
DeliveredSection,
|
|
924
|
+
{
|
|
925
|
+
title: "Agent received",
|
|
926
|
+
target: { kind: "block", key: block.id },
|
|
927
|
+
ref_: block.delivered,
|
|
928
|
+
load
|
|
775
929
|
}
|
|
776
930
|
)
|
|
777
931
|
] });
|
|
778
932
|
}
|
|
779
933
|
|
|
780
934
|
// context/react/ContextRulesPanelBody.tsx
|
|
781
|
-
import { Fragment as Fragment2, jsx as
|
|
935
|
+
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
782
936
|
function layerCells(row) {
|
|
783
937
|
const { surface, agent, default_max } = row.layers ?? {};
|
|
784
938
|
const declared = agent?.declared === true;
|
|
@@ -801,38 +955,38 @@ function layerCells(row) {
|
|
|
801
955
|
var LAYERS = ["default", "page", "agent", "you"];
|
|
802
956
|
function LayerTable({ row }) {
|
|
803
957
|
const cells = layerCells(row);
|
|
804
|
-
const cell = (text, winning) => /* @__PURE__ */
|
|
958
|
+
const cell = (text, winning) => /* @__PURE__ */ jsx7(
|
|
805
959
|
"span",
|
|
806
960
|
{
|
|
807
961
|
role: "cell",
|
|
808
962
|
"data-winning": winning ? "true" : void 0,
|
|
809
|
-
className:
|
|
963
|
+
className: cn6(
|
|
810
964
|
"rounded px-1.5 py-0.5 text-right tabular-nums",
|
|
811
965
|
winning ? "bg-primary/10 font-medium text-foreground" : "text-muted-foreground"
|
|
812
966
|
),
|
|
813
967
|
children: text
|
|
814
968
|
}
|
|
815
969
|
);
|
|
816
|
-
return /* @__PURE__ */
|
|
817
|
-
/* @__PURE__ */
|
|
970
|
+
return /* @__PURE__ */ jsxs7("div", { role: "table", "aria-label": "Layers", className: "text-xs", children: [
|
|
971
|
+
/* @__PURE__ */ jsxs7(
|
|
818
972
|
"div",
|
|
819
973
|
{
|
|
820
974
|
role: "row",
|
|
821
975
|
className: "grid h-7 grid-cols-[1fr_5rem_5rem] items-center gap-x-2 border-b border-border font-medium text-muted-foreground",
|
|
822
976
|
children: [
|
|
823
|
-
/* @__PURE__ */
|
|
824
|
-
/* @__PURE__ */
|
|
825
|
-
/* @__PURE__ */
|
|
977
|
+
/* @__PURE__ */ jsx7("span", { role: "columnheader", children: "Layer" }),
|
|
978
|
+
/* @__PURE__ */ jsx7("span", { role: "columnheader", className: "text-right", children: "Include" }),
|
|
979
|
+
/* @__PURE__ */ jsx7("span", { role: "columnheader", className: "text-right", children: "Inline max" })
|
|
826
980
|
]
|
|
827
981
|
}
|
|
828
982
|
),
|
|
829
|
-
LAYERS.map((layer) => /* @__PURE__ */
|
|
983
|
+
LAYERS.map((layer) => /* @__PURE__ */ jsxs7(
|
|
830
984
|
"div",
|
|
831
985
|
{
|
|
832
986
|
role: "row",
|
|
833
987
|
className: "grid h-7 grid-cols-[1fr_5rem_5rem] items-center gap-x-2 border-b border-border/50",
|
|
834
988
|
children: [
|
|
835
|
-
/* @__PURE__ */
|
|
989
|
+
/* @__PURE__ */ jsx7("span", { role: "cell", children: LAYER_LABEL[layer] }),
|
|
836
990
|
cell(cells[layer].include, row.decided_by.include === layer),
|
|
837
991
|
cell(cells[layer].limit, row.decided_by.max_inline_chars === layer)
|
|
838
992
|
]
|
|
@@ -848,20 +1002,21 @@ function RowDetail({
|
|
|
848
1002
|
mismatches,
|
|
849
1003
|
onChange,
|
|
850
1004
|
renderDetail,
|
|
851
|
-
comfortable
|
|
1005
|
+
comfortable,
|
|
1006
|
+
loadView
|
|
852
1007
|
}) {
|
|
853
|
-
return /* @__PURE__ */
|
|
854
|
-
/* @__PURE__ */
|
|
855
|
-
/* @__PURE__ */
|
|
856
|
-
/* @__PURE__ */
|
|
1008
|
+
return /* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-3 p-3", children: [
|
|
1009
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex min-w-0 items-baseline gap-2", children: [
|
|
1010
|
+
/* @__PURE__ */ jsx7("h3", { className: "min-w-0 truncate text-sm font-medium", children: row.label }),
|
|
1011
|
+
/* @__PURE__ */ jsx7("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: `${formatChars(row.chars)} chars \xB7 ${DELIVERY_LABEL[row.delivery]}` })
|
|
857
1012
|
] }),
|
|
858
|
-
mismatches.length > 0 ? /* @__PURE__ */
|
|
859
|
-
/* @__PURE__ */
|
|
860
|
-
/* @__PURE__ */
|
|
1013
|
+
mismatches.length > 0 ? /* @__PURE__ */ jsxs7("div", { className: "flex items-start gap-1.5 rounded-md border border-warning/40 bg-warning/10 px-2 py-1.5 text-xs text-warning", children: [
|
|
1014
|
+
/* @__PURE__ */ jsx7(TriangleAlertIcon, { className: "mt-0.5 h-3.5 w-3.5 shrink-0" }),
|
|
1015
|
+
/* @__PURE__ */ jsx7("span", { children: describeMismatches(mismatches) })
|
|
861
1016
|
] }) : null,
|
|
862
|
-
/* @__PURE__ */
|
|
863
|
-
/* @__PURE__ */
|
|
864
|
-
/* @__PURE__ */
|
|
1017
|
+
/* @__PURE__ */ jsxs7("div", { className: "grid grid-cols-[auto_1fr] items-center gap-x-4 gap-y-2 text-xs", children: [
|
|
1018
|
+
/* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", children: "Include" }),
|
|
1019
|
+
/* @__PURE__ */ jsx7("div", { className: cn6("flex items-center", comfortable ? "h-11" : "h-7"), children: /* @__PURE__ */ jsx7(
|
|
865
1020
|
Switch3,
|
|
866
1021
|
{
|
|
867
1022
|
size: "sm",
|
|
@@ -871,8 +1026,8 @@ function RowDetail({
|
|
|
871
1026
|
onCheckedChange: (next) => onChange(row.key, row.surfaceKey, withInclude(row, next))
|
|
872
1027
|
}
|
|
873
1028
|
) }),
|
|
874
|
-
/* @__PURE__ */
|
|
875
|
-
/* @__PURE__ */
|
|
1029
|
+
/* @__PURE__ */ jsx7("span", { className: "text-muted-foreground", children: "Inline max" }),
|
|
1030
|
+
/* @__PURE__ */ jsx7("div", { className: "flex", children: /* @__PURE__ */ jsx7(
|
|
876
1031
|
InlineMaxInput,
|
|
877
1032
|
{
|
|
878
1033
|
label: row.label,
|
|
@@ -886,8 +1041,8 @@ function RowDetail({
|
|
|
886
1041
|
}
|
|
887
1042
|
) })
|
|
888
1043
|
] }),
|
|
889
|
-
/* @__PURE__ */
|
|
890
|
-
/* @__PURE__ */
|
|
1044
|
+
/* @__PURE__ */ jsx7(LayerTable, { row }),
|
|
1045
|
+
/* @__PURE__ */ jsx7(ContextDeliveredValue, { row, load: loadView }),
|
|
891
1046
|
renderDetail ? renderDetail(row) : null
|
|
892
1047
|
] });
|
|
893
1048
|
}
|
|
@@ -895,6 +1050,8 @@ function ContextRulesPanelBody({
|
|
|
895
1050
|
rows,
|
|
896
1051
|
cap,
|
|
897
1052
|
mismatches,
|
|
1053
|
+
blocks,
|
|
1054
|
+
loadView,
|
|
898
1055
|
readOnly,
|
|
899
1056
|
onChange,
|
|
900
1057
|
renderDetail,
|
|
@@ -903,20 +1060,32 @@ function ContextRulesPanelBody({
|
|
|
903
1060
|
onSelectedKeyChange,
|
|
904
1061
|
className
|
|
905
1062
|
}) {
|
|
906
|
-
const [selectedState, setSelectedState] =
|
|
907
|
-
const [query, setQuery] =
|
|
1063
|
+
const [selectedState, setSelectedState] = React4.useState(null);
|
|
1064
|
+
const [query, setQuery] = React4.useState("");
|
|
1065
|
+
const [openBlockId, setOpenBlockId] = React4.useState(null);
|
|
908
1066
|
const selectedKey = selectedProp !== void 0 ? selectedProp : selectedState;
|
|
909
1067
|
const select = (key) => {
|
|
1068
|
+
setOpenBlockId(null);
|
|
910
1069
|
if (selectedProp === void 0) setSelectedState(key);
|
|
911
1070
|
onSelectedKeyChange?.(key);
|
|
912
1071
|
};
|
|
1072
|
+
const openBlock = (id) => {
|
|
1073
|
+
select(null);
|
|
1074
|
+
setOpenBlockId(id);
|
|
1075
|
+
};
|
|
913
1076
|
const q = query.trim().toLowerCase();
|
|
914
1077
|
const visible = q ? rows.filter((r) => r.label.toLowerCase().includes(q) || r.key.toLowerCase().includes(q)) : rows;
|
|
915
|
-
const
|
|
1078
|
+
const alsoSent = unclaimedBlocks(
|
|
1079
|
+
blocks,
|
|
1080
|
+
rows.filter((r) => r.delivered).map((r) => r.key)
|
|
1081
|
+
);
|
|
1082
|
+
const visibleBlocks = q ? alsoSent.filter((b) => b.label.toLowerCase().includes(q) || b.id.toLowerCase().includes(q)) : alsoSent;
|
|
1083
|
+
const openedBlock = openBlockId ? (blocks ?? []).find((b) => b.id === openBlockId) ?? null : null;
|
|
1084
|
+
const selected = !openedBlock && selectedKey ? rows.find((r) => r.key === selectedKey) ?? null : null;
|
|
916
1085
|
const comfortable = !!isMobile;
|
|
917
|
-
const search = /* @__PURE__ */
|
|
918
|
-
/* @__PURE__ */
|
|
919
|
-
/* @__PURE__ */
|
|
1086
|
+
const search = /* @__PURE__ */ jsxs7("div", { className: "relative shrink-0 border-b border-border p-2", children: [
|
|
1087
|
+
/* @__PURE__ */ jsx7(SearchIcon, { className: "pointer-events-none absolute left-4 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
|
|
1088
|
+
/* @__PURE__ */ jsx7(
|
|
920
1089
|
Input2,
|
|
921
1090
|
{
|
|
922
1091
|
type: "search",
|
|
@@ -924,24 +1093,35 @@ function ContextRulesPanelBody({
|
|
|
924
1093
|
placeholder: "Search",
|
|
925
1094
|
value: query,
|
|
926
1095
|
onChange: (e) => setQuery(e.target.value),
|
|
927
|
-
className:
|
|
1096
|
+
className: cn6("pl-7 shadow-none", comfortable ? "h-11 text-base" : "h-8 text-xs")
|
|
928
1097
|
}
|
|
929
1098
|
)
|
|
930
1099
|
] });
|
|
931
|
-
const table = /* @__PURE__ */
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
1100
|
+
const table = /* @__PURE__ */ jsxs7("div", { className: "min-h-0 flex-1 overflow-y-auto", children: [
|
|
1101
|
+
/* @__PURE__ */ jsx7(
|
|
1102
|
+
ContextRulesTable,
|
|
1103
|
+
{
|
|
1104
|
+
rows: visible,
|
|
1105
|
+
cap,
|
|
1106
|
+
readOnly,
|
|
1107
|
+
density: comfortable ? "comfortable" : "compact",
|
|
1108
|
+
selectedKey,
|
|
1109
|
+
onChange,
|
|
1110
|
+
onOpenRow: (key) => select(key),
|
|
1111
|
+
...mismatches ? { mismatches } : {}
|
|
1112
|
+
}
|
|
1113
|
+
),
|
|
1114
|
+
/* @__PURE__ */ jsx7(
|
|
1115
|
+
ContextReceiptBlocks,
|
|
1116
|
+
{
|
|
1117
|
+
blocks: visibleBlocks,
|
|
1118
|
+
selectedId: openedBlock?.id ?? null,
|
|
1119
|
+
onOpenBlock: openBlock,
|
|
1120
|
+
density: comfortable ? "comfortable" : "compact"
|
|
1121
|
+
}
|
|
1122
|
+
)
|
|
1123
|
+
] });
|
|
1124
|
+
const detail = openedBlock ? /* @__PURE__ */ jsx7(ContextReceiptBlockDetail, { block: openedBlock, load: loadView }) : selected ? /* @__PURE__ */ jsx7(
|
|
945
1125
|
RowDetail,
|
|
946
1126
|
{
|
|
947
1127
|
row: selected,
|
|
@@ -950,42 +1130,46 @@ function ContextRulesPanelBody({
|
|
|
950
1130
|
mismatches: mismatches?.filter((m) => m.key === selected.key) ?? [],
|
|
951
1131
|
onChange,
|
|
952
1132
|
renderDetail,
|
|
953
|
-
comfortable
|
|
1133
|
+
comfortable,
|
|
1134
|
+
loadView
|
|
954
1135
|
}
|
|
955
1136
|
) : null;
|
|
956
1137
|
if (isMobile) {
|
|
957
|
-
return /* @__PURE__ */
|
|
958
|
-
/* @__PURE__ */
|
|
1138
|
+
return /* @__PURE__ */ jsx7(TooltipProvider3, { delayDuration: 300, titleTooltips: false, children: /* @__PURE__ */ jsx7("div", { className: cn6("flex h-full min-h-0 flex-col", className), children: detail ? /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
1139
|
+
/* @__PURE__ */ jsx7("div", { className: "flex h-12 shrink-0 items-center border-b border-border px-1", children: /* @__PURE__ */ jsxs7(
|
|
959
1140
|
"button",
|
|
960
1141
|
{
|
|
961
1142
|
type: "button",
|
|
962
1143
|
onClick: () => select(null),
|
|
963
1144
|
className: "inline-flex h-11 items-center gap-1 rounded-md px-2 text-sm text-muted-foreground hover:text-foreground",
|
|
964
1145
|
children: [
|
|
965
|
-
/* @__PURE__ */
|
|
1146
|
+
/* @__PURE__ */ jsx7(ChevronLeftIcon, { className: "h-4 w-4" }),
|
|
966
1147
|
"Back"
|
|
967
1148
|
]
|
|
968
1149
|
}
|
|
969
1150
|
) }),
|
|
970
|
-
/* @__PURE__ */
|
|
971
|
-
] }) : /* @__PURE__ */
|
|
1151
|
+
/* @__PURE__ */ jsx7("div", { className: "min-h-0 flex-1 overflow-y-auto", children: detail })
|
|
1152
|
+
] }) : /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
972
1153
|
search,
|
|
973
1154
|
table
|
|
974
1155
|
] }) }) });
|
|
975
1156
|
}
|
|
976
|
-
return /* @__PURE__ */
|
|
977
|
-
/* @__PURE__ */
|
|
1157
|
+
return /* @__PURE__ */ jsx7(TooltipProvider3, { delayDuration: 300, titleTooltips: false, children: /* @__PURE__ */ jsxs7("div", { className: cn6("flex h-full min-h-0", className), children: [
|
|
1158
|
+
/* @__PURE__ */ jsxs7("aside", { className: "flex w-[22rem] shrink-0 flex-col border-r border-border", children: [
|
|
978
1159
|
search,
|
|
979
1160
|
table
|
|
980
1161
|
] }),
|
|
981
|
-
/* @__PURE__ */
|
|
1162
|
+
/* @__PURE__ */ jsx7("section", { className: "min-h-0 min-w-0 flex-1 overflow-y-auto", children: detail ?? /* @__PURE__ */ jsx7("div", { className: "flex h-full items-center justify-center text-xs text-muted-foreground", children: "Select an item" }) })
|
|
982
1163
|
] }) });
|
|
983
1164
|
}
|
|
984
1165
|
export {
|
|
985
1166
|
ContextDeliveredValue,
|
|
1167
|
+
ContextReceiptBlockDetail,
|
|
1168
|
+
ContextReceiptBlocks,
|
|
986
1169
|
ContextRulesChip,
|
|
987
1170
|
ContextRulesPanelBody,
|
|
988
1171
|
ContextRulesTable,
|
|
1172
|
+
DeliveredSection,
|
|
989
1173
|
InlineMaxInput,
|
|
990
1174
|
summarizeContextRows
|
|
991
1175
|
};
|