@tangle-network/agent-app 0.45.22 → 0.45.23

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.
@@ -36,7 +36,7 @@ import {
36
36
  } from "./chunk-TH7L265V.js";
37
37
 
38
38
  // src/web-react/index.tsx
39
- import { useEffect as useEffect11, useMemo as useMemo9, useRef as useRef10, useState as useState15, memo } from "react";
39
+ import { useEffect as useEffect12, useMemo as useMemo9, useRef as useRef11, useState as useState16, memo } from "react";
40
40
 
41
41
  // src/web-react/smooth-text.ts
42
42
  import { useEffect, useRef, useState } from "react";
@@ -2700,8 +2700,483 @@ function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent ac
2700
2700
  ] });
2701
2701
  }
2702
2702
 
2703
+ // src/web-react/provenance.tsx
2704
+ import { useCallback as useCallback7, useEffect as useEffect9, useId, useRef as useRef8, useState as useState12 } from "react";
2705
+
2706
+ // src/web-react/provenance-model.ts
2707
+ var PROVENANCE_BASES = ["extracted", "entered", "computed", "asserted"];
2708
+ var BASIS_META = {
2709
+ extracted: {
2710
+ label: "From document",
2711
+ meaning: "Read out of a source document.",
2712
+ checkableAgainst: "the document it was read from"
2713
+ },
2714
+ entered: {
2715
+ label: "Entered by a person",
2716
+ meaning: "A person typed or confirmed this value.",
2717
+ checkableAgainst: "the person who entered it"
2718
+ },
2719
+ computed: {
2720
+ label: "Computed",
2721
+ meaning: "Produced from other values.",
2722
+ checkableAgainst: "the values it was computed from"
2723
+ },
2724
+ asserted: {
2725
+ label: "Agent, unverified",
2726
+ meaning: "The agent stated this. No source was recorded behind it.",
2727
+ checkableAgainst: null
2728
+ }
2729
+ };
2730
+ function provenanceBasisMeta(basis) {
2731
+ return BASIS_META[basis];
2732
+ }
2733
+ var STANDING_META = {
2734
+ settled: { label: "Traced", action: "Nothing to check \u2014 this value can be traced to where it came from." },
2735
+ check: { label: "Check the source", action: "Open the source and confirm this value before you rely on it." },
2736
+ confirm: { label: "Needs a person", action: "Someone has to confirm this value before it is used." }
2737
+ };
2738
+ function provenanceStandingMeta(standing) {
2739
+ return STANDING_META[standing];
2740
+ }
2741
+ var STANDING_SEVERITY = { settled: 0, check: 1, confirm: 2 };
2742
+ function weakerProvenanceStanding(a, b) {
2743
+ return STANDING_SEVERITY[a] >= STANDING_SEVERITY[b] ? a : b;
2744
+ }
2745
+ var DEFAULT_PROVENANCE_CONFIDENCE_POLICY = {
2746
+ settledAtOrAbove: 0.9,
2747
+ checkAtOrAbove: 0.6
2748
+ };
2749
+ function standingFromConfidence(confidence, policy = DEFAULT_PROVENANCE_CONFIDENCE_POLICY) {
2750
+ if (confidence >= policy.settledAtOrAbove) return "settled";
2751
+ if (confidence >= policy.checkAtOrAbove) return "check";
2752
+ return "confirm";
2753
+ }
2754
+ function standingFromBasis(basis) {
2755
+ return basis === "asserted" ? "check" : "settled";
2756
+ }
2757
+ function describeProvenanceSourceStatus(source) {
2758
+ if (source.status === "loading") return `Looking up ${source.label}\u2026`;
2759
+ if (source.status === "unavailable") {
2760
+ return source.unavailableReason ? `${source.label} could not be opened \u2014 ${source.unavailableReason}` : `${source.label} could not be opened.`;
2761
+ }
2762
+ return null;
2763
+ }
2764
+ function provenanceGaps(record) {
2765
+ const gaps = [];
2766
+ const sources = record.sources ?? [];
2767
+ if (record.basis === "extracted" && sources.length === 0) {
2768
+ gaps.push({
2769
+ kind: "no-source",
2770
+ message: "Read from a document, but no document is on file \u2014 nothing here shows where this came from."
2771
+ });
2772
+ }
2773
+ if (record.basis === "computed" && (record.inputs ?? []).length === 0) {
2774
+ gaps.push({
2775
+ kind: "no-inputs",
2776
+ message: "Computed, but the values it was computed from are not recorded."
2777
+ });
2778
+ }
2779
+ for (const source of sources) {
2780
+ if (source.status !== "unavailable") continue;
2781
+ gaps.push({
2782
+ kind: "unavailable-source",
2783
+ message: describeProvenanceSourceStatus(source) ?? `${source.label} could not be opened.`,
2784
+ source
2785
+ });
2786
+ }
2787
+ return gaps;
2788
+ }
2789
+ function loadingProvenanceSources(record) {
2790
+ return (record.sources ?? []).filter((source) => source.status === "loading");
2791
+ }
2792
+ function resolveProvenanceStanding(record, policy = DEFAULT_PROVENANCE_CONFIDENCE_POLICY) {
2793
+ let standing = record.standing ?? (record.confidence === void 0 ? standingFromBasis(record.basis) : standingFromConfidence(record.confidence, policy));
2794
+ if (record.basis === "asserted") standing = weakerProvenanceStanding(standing, "check");
2795
+ for (const gap of provenanceGaps(record)) {
2796
+ standing = weakerProvenanceStanding(standing, gap.kind === "unavailable-source" ? "check" : "confirm");
2797
+ }
2798
+ return standing;
2799
+ }
2800
+ function rollUpProvenanceStanding(record, policy = DEFAULT_PROVENANCE_CONFIDENCE_POLICY, seen = /* @__PURE__ */ new Set()) {
2801
+ if (seen.has(record)) return "settled";
2802
+ seen.add(record);
2803
+ let standing = resolveProvenanceStanding(record, policy);
2804
+ for (const input of record.inputs ?? []) {
2805
+ standing = weakerProvenanceStanding(standing, rollUpProvenanceStanding(input, policy, seen));
2806
+ }
2807
+ return standing;
2808
+ }
2809
+ function sourcePhrase(source) {
2810
+ return source.locator ? `${source.label}, ${source.locator}` : source.label;
2811
+ }
2812
+ function inputPhrase(input) {
2813
+ return input.label ?? input.display;
2814
+ }
2815
+ function describeProvenance(record) {
2816
+ const sources = record.sources ?? [];
2817
+ const first = sources[0];
2818
+ const more = sources.length > 1 ? ` and ${sources.length - 1} more source${sources.length > 2 ? "s" : ""}` : "";
2819
+ switch (record.basis) {
2820
+ case "extracted":
2821
+ return first ? `Read from ${sourcePhrase(first)}${more}.` : "Read from a document, but no document is on file.";
2822
+ case "entered":
2823
+ return first ? `Entered by ${sourcePhrase(first)}.` : "Entered by a person.";
2824
+ case "computed": {
2825
+ const inputs = record.inputs ?? [];
2826
+ if (record.derivation) return `Computed from ${record.derivation}.`;
2827
+ if (inputs.length === 0) return "Computed, but the values it was computed from are not recorded.";
2828
+ return `Computed from ${inputs.map(inputPhrase).join(", ")}.`;
2829
+ }
2830
+ case "asserted":
2831
+ return first ? `Stated by the agent, pointing at ${sourcePhrase(first)} \u2014 not verified against it.` : "Stated by the agent, with no source to check it against.";
2832
+ }
2833
+ }
2834
+ function provenanceNextMove(record, standing, policy = DEFAULT_PROVENANCE_CONFIDENCE_POLICY) {
2835
+ const generic = provenanceStandingMeta(standing).action;
2836
+ if (standing === "settled") return generic;
2837
+ const gaps = provenanceGaps(record);
2838
+ if (gaps.some((gap) => gap.kind === "no-source")) {
2839
+ return "Nobody recorded where this came from. Confirm the value and record its source before it is used.";
2840
+ }
2841
+ if (gaps.some((gap) => gap.kind === "no-inputs")) {
2842
+ return "Nobody recorded what this was computed from. Confirm the value and record its inputs before it is used.";
2843
+ }
2844
+ if (gaps.some((gap) => gap.kind === "unavailable-source")) {
2845
+ return "The source could not be opened. Try again, or confirm this value another way before you rely on it.";
2846
+ }
2847
+ if (record.basis === "asserted" && (record.sources ?? []).length === 0) {
2848
+ return "The agent gave no source. Check this against the real document before you rely on it.";
2849
+ }
2850
+ if (record.basis === "computed" && (record.inputs ?? []).length > 0 && resolveProvenanceStanding(record, policy) === "settled") {
2851
+ return "One of the values this was computed from still needs checking \u2014 open the marked ones below.";
2852
+ }
2853
+ return generic;
2854
+ }
2855
+ function provenanceTriggerLabel(record, standing) {
2856
+ const value = record.display.trim() === "" ? "this missing value" : `\u201C${record.display}\u201D`;
2857
+ const named = record.label ? `${record.label} ${value}` : value;
2858
+ const basis = provenanceBasisMeta(record.basis).label;
2859
+ const next = standing === "settled" ? "" : ` ${provenanceStandingMeta(standing).label}.`;
2860
+ return `Where ${named} came from \u2014 ${basis}.${next}`;
2861
+ }
2862
+
2863
+ // src/web-react/provenance.tsx
2864
+ import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
2865
+ var BASIS_TONES = {
2866
+ extracted: "border-primary/30 bg-primary/10 text-primary",
2867
+ entered: "border-success/30 bg-success/10 text-success",
2868
+ computed: "border-border bg-muted/50 text-foreground",
2869
+ asserted: "border-warning/40 bg-warning/10 text-warning"
2870
+ };
2871
+ var STANDING_TONES = {
2872
+ settled: "text-muted-foreground",
2873
+ check: "text-warning",
2874
+ confirm: "text-destructive"
2875
+ };
2876
+ function BasisGlyph({ basis, className }) {
2877
+ const shared = {
2878
+ viewBox: "0 0 24 24",
2879
+ fill: "none",
2880
+ stroke: "currentColor",
2881
+ strokeWidth: 2,
2882
+ strokeLinecap: "round",
2883
+ strokeLinejoin: "round",
2884
+ "aria-hidden": true,
2885
+ className
2886
+ };
2887
+ switch (basis) {
2888
+ case "extracted":
2889
+ return /* @__PURE__ */ jsxs9("svg", { ...shared, children: [
2890
+ /* @__PURE__ */ jsx11("path", { d: "M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z" }),
2891
+ /* @__PURE__ */ jsx11("polyline", { points: "14 3 14 8 19 8" }),
2892
+ /* @__PURE__ */ jsx11("line", { x1: "9", y1: "13", x2: "15", y2: "13" })
2893
+ ] });
2894
+ case "entered":
2895
+ return /* @__PURE__ */ jsxs9("svg", { ...shared, children: [
2896
+ /* @__PURE__ */ jsx11("path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }),
2897
+ /* @__PURE__ */ jsx11("circle", { cx: "12", cy: "7", r: "4" })
2898
+ ] });
2899
+ case "computed":
2900
+ return /* @__PURE__ */ jsxs9("svg", { ...shared, children: [
2901
+ /* @__PURE__ */ jsx11("line", { x1: "4", y1: "9", x2: "20", y2: "9" }),
2902
+ /* @__PURE__ */ jsx11("line", { x1: "4", y1: "15", x2: "20", y2: "15" }),
2903
+ /* @__PURE__ */ jsx11("line", { x1: "10", y1: "3", x2: "8", y2: "21" }),
2904
+ /* @__PURE__ */ jsx11("line", { x1: "16", y1: "3", x2: "14", y2: "21" })
2905
+ ] });
2906
+ case "asserted":
2907
+ return /* @__PURE__ */ jsxs9("svg", { ...shared, children: [
2908
+ /* @__PURE__ */ jsx11("path", { d: "M12 3v3M12 18v3M3 12h3M18 12h3M5.6 5.6l2.1 2.1M16.3 16.3l2.1 2.1M18.4 5.6l-2.1 2.1M7.7 16.3l-2.1 2.1" }),
2909
+ /* @__PURE__ */ jsx11("circle", { cx: "12", cy: "12", r: "3.2" })
2910
+ ] });
2911
+ }
2912
+ }
2913
+ var openPanels = /* @__PURE__ */ new Set();
2914
+ function closeTrailsOutside(root) {
2915
+ for (const other of Array.from(openPanels)) {
2916
+ if (root === null || !other.root.contains(root)) other.close();
2917
+ }
2918
+ }
2919
+ var DEFAULT_MISSING_VALUE_LABEL = "No value recorded";
2920
+ function SourceRow({
2921
+ source,
2922
+ record,
2923
+ onOpenSource,
2924
+ onRetrySource
2925
+ }) {
2926
+ const status = source.status ?? "ready";
2927
+ const statusLine = describeProvenanceSourceStatus(source);
2928
+ const openable = status === "ready" && (onOpenSource !== void 0 || source.href !== void 0);
2929
+ return /* @__PURE__ */ jsxs9("li", { className: "rounded-md border border-border/60 bg-background/40 px-2.5 py-2", children: [
2930
+ /* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap items-baseline gap-x-2 gap-y-1", children: [
2931
+ /* @__PURE__ */ jsx11("span", { className: "text-[13px] font-medium text-foreground", children: source.label }),
2932
+ source.locator && /* @__PURE__ */ jsx11("span", { className: "text-[11px] text-muted-foreground", children: source.locator }),
2933
+ openable && (onOpenSource ? /* @__PURE__ */ jsxs9(
2934
+ "button",
2935
+ {
2936
+ type: "button",
2937
+ onClick: () => onOpenSource(source, record),
2938
+ className: "rounded px-1 text-[11px] font-medium text-primary underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
2939
+ children: [
2940
+ "Open ",
2941
+ source.label
2942
+ ]
2943
+ }
2944
+ ) : /* @__PURE__ */ jsxs9(
2945
+ "a",
2946
+ {
2947
+ href: source.href,
2948
+ target: "_blank",
2949
+ rel: "noreferrer",
2950
+ className: "rounded px-1 text-[11px] font-medium text-primary underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
2951
+ children: [
2952
+ "Open ",
2953
+ source.label
2954
+ ]
2955
+ }
2956
+ ))
2957
+ ] }),
2958
+ source.quote && /* @__PURE__ */ jsxs9("blockquote", { className: "mt-1 border-l-2 border-primary/50 pl-2 text-[12px] italic leading-snug text-foreground", children: [
2959
+ "\u201C",
2960
+ source.quote,
2961
+ "\u201D"
2962
+ ] }),
2963
+ statusLine && // `role="status"` and not `alert`: the reader opened this panel, so the
2964
+ // update is theirs to read, not an interruption. Either way it is TEXT
2965
+ // — a spinner alone and a greyed row alone both render as "nothing
2966
+ // here".
2967
+ /* @__PURE__ */ jsxs9(
2968
+ "p",
2969
+ {
2970
+ role: "status",
2971
+ className: `mt-1 text-[11px] ${status === "unavailable" ? "text-destructive" : "text-muted-foreground"}`,
2972
+ children: [
2973
+ statusLine,
2974
+ status === "unavailable" && onRetrySource && /* @__PURE__ */ jsx11(
2975
+ "button",
2976
+ {
2977
+ type: "button",
2978
+ onClick: () => onRetrySource(source, record),
2979
+ className: "ml-2 rounded border border-border px-1.5 py-0.5 text-[11px] font-medium text-foreground hover:bg-accent/30 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
2980
+ children: "Try again"
2981
+ }
2982
+ )
2983
+ ]
2984
+ }
2985
+ )
2986
+ ] });
2987
+ }
2988
+ function ProvenanceValue({
2989
+ record,
2990
+ onOpenSource,
2991
+ onRetrySource,
2992
+ confidencePolicy,
2993
+ maxDepth = 2,
2994
+ defaultOpen = false,
2995
+ missingValueLabel = DEFAULT_MISSING_VALUE_LABEL,
2996
+ className
2997
+ }) {
2998
+ const [open, setOpen] = useState12(defaultOpen);
2999
+ const triggerRef = useRef8(null);
3000
+ const rootRef = useRef8(null);
3001
+ const panelId = useId();
3002
+ const standing = rollUpProvenanceStanding(record, confidencePolicy);
3003
+ const basisMeta = provenanceBasisMeta(record.basis);
3004
+ const standingMeta = provenanceStandingMeta(standing);
3005
+ const gaps = provenanceGaps(record);
3006
+ const loading = loadingProvenanceSources(record);
3007
+ const sources = record.sources ?? [];
3008
+ const inputs = record.inputs ?? [];
3009
+ const hasValue = record.display.trim() !== "";
3010
+ const onKeyDown = useCallback7(
3011
+ (event) => {
3012
+ if (event.key !== "Escape" || !open) return;
3013
+ event.stopPropagation();
3014
+ setOpen(false);
3015
+ triggerRef.current?.focus();
3016
+ },
3017
+ [open]
3018
+ );
3019
+ const onToggle = useCallback7(() => {
3020
+ if (!open) closeTrailsOutside(rootRef.current);
3021
+ setOpen(!open);
3022
+ }, [open]);
3023
+ useEffect9(() => {
3024
+ const root = rootRef.current;
3025
+ if (!open || root === null) return;
3026
+ const entry = { root, close: () => setOpen(false) };
3027
+ openPanels.add(entry);
3028
+ const onPointerDown = (event) => {
3029
+ const target = event.target;
3030
+ if (target instanceof Node && root.contains(target)) return;
3031
+ setOpen(false);
3032
+ };
3033
+ document.addEventListener("mousedown", onPointerDown, true);
3034
+ document.addEventListener("touchstart", onPointerDown, true);
3035
+ return () => {
3036
+ openPanels.delete(entry);
3037
+ document.removeEventListener("mousedown", onPointerDown, true);
3038
+ document.removeEventListener("touchstart", onPointerDown, true);
3039
+ };
3040
+ }, [open]);
3041
+ const summary = /* @__PURE__ */ jsxs9("span", { className: "inline-flex flex-wrap items-baseline gap-x-1.5", children: [
3042
+ record.label && /* @__PURE__ */ jsx11("span", { className: "text-[11px] text-muted-foreground", children: record.label }),
3043
+ /* @__PURE__ */ jsx11("span", { className: hasValue ? "text-sm text-foreground" : "text-sm italic text-muted-foreground", children: hasValue ? record.display : missingValueLabel })
3044
+ ] });
3045
+ if (maxDepth <= 0) {
3046
+ return /* @__PURE__ */ jsxs9(
3047
+ "div",
3048
+ {
3049
+ className: `inline-block max-w-full ${className ?? ""}`,
3050
+ "data-provenance-basis": record.basis,
3051
+ "data-provenance-standing": standing,
3052
+ children: [
3053
+ summary,
3054
+ /* @__PURE__ */ jsxs9(
3055
+ "span",
3056
+ {
3057
+ className: `ml-1.5 inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px] font-medium ${BASIS_TONES[record.basis]}`,
3058
+ children: [
3059
+ /* @__PURE__ */ jsx11(BasisGlyph, { basis: record.basis, className: "h-3 w-3" }),
3060
+ basisMeta.label
3061
+ ]
3062
+ }
3063
+ ),
3064
+ /* @__PURE__ */ jsx11("span", { className: "mt-0.5 block text-[11px] text-muted-foreground", children: describeProvenance(record) })
3065
+ ]
3066
+ }
3067
+ );
3068
+ }
3069
+ return /* @__PURE__ */ jsxs9(
3070
+ "div",
3071
+ {
3072
+ ref: rootRef,
3073
+ className: `inline-block max-w-full ${className ?? ""}`,
3074
+ onKeyDown,
3075
+ "data-provenance-basis": record.basis,
3076
+ "data-provenance-standing": standing,
3077
+ children: [
3078
+ /* @__PURE__ */ jsxs9("span", { className: "inline-flex flex-wrap items-baseline gap-1.5", children: [
3079
+ summary,
3080
+ /* @__PURE__ */ jsxs9(
3081
+ "button",
3082
+ {
3083
+ ref: triggerRef,
3084
+ type: "button",
3085
+ onClick: onToggle,
3086
+ "aria-expanded": open,
3087
+ "aria-controls": panelId,
3088
+ "aria-label": provenanceTriggerLabel(record, standing),
3089
+ className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px] font-medium transition hover:brightness-105 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring ${BASIS_TONES[record.basis]}`,
3090
+ children: [
3091
+ /* @__PURE__ */ jsx11(BasisGlyph, { basis: record.basis, className: "h-3 w-3" }),
3092
+ /* @__PURE__ */ jsx11("span", { "aria-hidden": true, children: basisMeta.label })
3093
+ ]
3094
+ }
3095
+ ),
3096
+ standing !== "settled" && // Legible at rest: what to do about the value does not wait for
3097
+ // someone to open the panel. `aria-hidden` because the trigger's
3098
+ // accessible name already carries it — this is the visual half.
3099
+ /* @__PURE__ */ jsx11("span", { "aria-hidden": true, className: `text-[10px] font-medium ${STANDING_TONES[standing]}`, children: standingMeta.label })
3100
+ ] }),
3101
+ open && /* @__PURE__ */ jsxs9(
3102
+ "div",
3103
+ {
3104
+ id: panelId,
3105
+ role: "group",
3106
+ "aria-label": provenanceTriggerLabel(record, standing),
3107
+ className: "mt-1.5 w-full min-w-0 space-y-2 rounded-lg border border-border bg-card px-3 py-2.5 text-left",
3108
+ children: [
3109
+ /* @__PURE__ */ jsxs9("div", { children: [
3110
+ /* @__PURE__ */ jsx11("p", { className: "text-[12px] leading-snug text-foreground", children: describeProvenance(record) }),
3111
+ /* @__PURE__ */ jsxs9("p", { className: `mt-0.5 text-[11px] leading-snug ${STANDING_TONES[standing]}`, children: [
3112
+ standingMeta.label,
3113
+ " \u2014 ",
3114
+ provenanceNextMove(record, standing, confidencePolicy)
3115
+ ] }),
3116
+ basisMeta.checkableAgainst === null && /* @__PURE__ */ jsxs9("p", { className: "mt-0.5 text-[11px] leading-snug text-muted-foreground", children: [
3117
+ basisMeta.meaning,
3118
+ " There is nothing outside the model to check it against."
3119
+ ] })
3120
+ ] }),
3121
+ sources.length > 0 && /* @__PURE__ */ jsx11("ul", { className: "space-y-1.5", children: sources.map((source, index) => /* @__PURE__ */ jsx11(
3122
+ SourceRow,
3123
+ {
3124
+ source,
3125
+ record,
3126
+ onOpenSource,
3127
+ onRetrySource
3128
+ },
3129
+ `${source.label}-${source.locator ?? ""}-${index}`
3130
+ )) }),
3131
+ gaps.filter((gap) => gap.kind !== "unavailable-source").map((gap) => (
3132
+ // An unavailable source already states itself on its own row; a
3133
+ // structural gap has no row to state it, so it gets one here.
3134
+ /* @__PURE__ */ jsx11("p", { className: "rounded-md bg-destructive/10 px-2 py-1.5 text-[11px] leading-snug text-destructive", children: gap.message }, gap.kind)
3135
+ )),
3136
+ loading.length > 0 && sources.length === 0 && /* @__PURE__ */ jsx11("p", { role: "status", className: "text-[11px] text-muted-foreground", children: "Looking up where this came from\u2026" }),
3137
+ inputs.length > 0 && /* @__PURE__ */ jsxs9("div", { className: "border-t border-border/60 pt-2", children: [
3138
+ /* @__PURE__ */ jsx11("p", { className: "text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: record.derivation ? `Computed from ${record.derivation}` : "Computed from" }),
3139
+ /* @__PURE__ */ jsx11("ul", { className: "mt-1.5 space-y-1.5", children: inputs.map((input, index) => /* @__PURE__ */ jsx11("li", { children: /* @__PURE__ */ jsx11(
3140
+ ProvenanceValue,
3141
+ {
3142
+ record: input,
3143
+ onOpenSource,
3144
+ onRetrySource,
3145
+ confidencePolicy,
3146
+ maxDepth: maxDepth - 1,
3147
+ missingValueLabel
3148
+ }
3149
+ ) }, `${input.label ?? input.display}-${index}`)) })
3150
+ ] })
3151
+ ]
3152
+ }
3153
+ )
3154
+ ]
3155
+ }
3156
+ );
3157
+ }
3158
+ function ProvenanceLegend({ bases, className }) {
3159
+ if (bases.length === 0) return null;
3160
+ return /* @__PURE__ */ jsx11("ul", { className: `flex flex-wrap items-center gap-x-3 gap-y-1.5 ${className ?? ""}`, children: bases.map((basis) => {
3161
+ const meta = provenanceBasisMeta(basis);
3162
+ return /* @__PURE__ */ jsxs9("li", { className: "flex items-center gap-1.5 text-[11px] text-muted-foreground", children: [
3163
+ /* @__PURE__ */ jsxs9(
3164
+ "span",
3165
+ {
3166
+ className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px] font-medium ${BASIS_TONES[basis]}`,
3167
+ children: [
3168
+ /* @__PURE__ */ jsx11(BasisGlyph, { basis, className: "h-3 w-3" }),
3169
+ meta.label
3170
+ ]
3171
+ }
3172
+ ),
3173
+ /* @__PURE__ */ jsx11("span", { children: meta.meaning })
3174
+ ] }, basis);
3175
+ }) });
3176
+ }
3177
+
2703
3178
  // src/web-react/seat-paywall.tsx
2704
- import { Fragment as Fragment5, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
3179
+ import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
2705
3180
  function usd(cents) {
2706
3181
  return new Intl.NumberFormat("en-US", {
2707
3182
  style: "currency",
@@ -2711,7 +3186,7 @@ function usd(cents) {
2711
3186
  }).format(cents / 100);
2712
3187
  }
2713
3188
  function CheckGlyph3() {
2714
- return /* @__PURE__ */ jsx11(
3189
+ return /* @__PURE__ */ jsx12(
2715
3190
  "svg",
2716
3191
  {
2717
3192
  className: "h-4 w-4 shrink-0 text-primary",
@@ -2722,14 +3197,14 @@ function CheckGlyph3() {
2722
3197
  strokeLinecap: "round",
2723
3198
  strokeLinejoin: "round",
2724
3199
  "aria-hidden": true,
2725
- children: /* @__PURE__ */ jsx11("path", { d: "M20 6 9 17l-5-5" })
3200
+ children: /* @__PURE__ */ jsx12("path", { d: "M20 6 9 17l-5-5" })
2726
3201
  }
2727
3202
  );
2728
3203
  }
2729
3204
  function Benefit({ children }) {
2730
- return /* @__PURE__ */ jsxs9("li", { className: "flex items-start gap-2.5 text-sm text-foreground", children: [
2731
- /* @__PURE__ */ jsx11("span", { className: "mt-0.5", children: /* @__PURE__ */ jsx11(CheckGlyph3, {}) }),
2732
- /* @__PURE__ */ jsx11("span", { children })
3205
+ return /* @__PURE__ */ jsxs10("li", { className: "flex items-start gap-2.5 text-sm text-foreground", children: [
3206
+ /* @__PURE__ */ jsx12("span", { className: "mt-0.5", children: /* @__PURE__ */ jsx12(CheckGlyph3, {}) }),
3207
+ /* @__PURE__ */ jsx12("span", { children })
2733
3208
  ] });
2734
3209
  }
2735
3210
  function SeatPaywall({
@@ -2747,46 +3222,46 @@ function SeatPaywall({
2747
3222
  const recurringPrice = offer ? usd(offer.recurring.priceCents) : `$${priceUsd}`;
2748
3223
  const recurringUsage = offer ? usd(offer.recurring.includedCreditsCents) : `$${includedUsageUsd}`;
2749
3224
  const introductory = offer?.introductory ?? null;
2750
- return /* @__PURE__ */ jsx11("div", { className: "flex min-h-[60vh] w-full items-center justify-center p-6", children: /* @__PURE__ */ jsxs9("div", { className: "w-full max-w-md rounded-2xl border border-border bg-card p-8 shadow-sm", children: [
2751
- /* @__PURE__ */ jsx11("p", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: product }),
2752
- /* @__PURE__ */ jsxs9("h1", { className: "mt-2 text-2xl font-semibold tracking-tight text-foreground", children: [
3225
+ return /* @__PURE__ */ jsx12("div", { className: "flex min-h-[60vh] w-full items-center justify-center p-6", children: /* @__PURE__ */ jsxs10("div", { className: "w-full max-w-md rounded-2xl border border-border bg-card p-8 shadow-sm", children: [
3226
+ /* @__PURE__ */ jsx12("p", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: product }),
3227
+ /* @__PURE__ */ jsxs10("h1", { className: "mt-2 text-2xl font-semibold tracking-tight text-foreground", children: [
2753
3228
  "Unlock ",
2754
3229
  product
2755
3230
  ] }),
2756
- tagline && /* @__PURE__ */ jsx11("p", { className: "mt-2 text-sm text-muted-foreground", children: tagline }),
2757
- introductory ? /* @__PURE__ */ jsxs9(Fragment5, { children: [
2758
- /* @__PURE__ */ jsxs9("div", { className: "mt-6 flex items-baseline gap-1.5", children: [
2759
- /* @__PURE__ */ jsx11("span", { className: "text-3xl font-semibold text-foreground", children: usd(introductory.priceCents) }),
2760
- /* @__PURE__ */ jsx11("span", { className: "text-sm text-muted-foreground", children: "first month" })
3231
+ tagline && /* @__PURE__ */ jsx12("p", { className: "mt-2 text-sm text-muted-foreground", children: tagline }),
3232
+ introductory ? /* @__PURE__ */ jsxs10(Fragment5, { children: [
3233
+ /* @__PURE__ */ jsxs10("div", { className: "mt-6 flex items-baseline gap-1.5", children: [
3234
+ /* @__PURE__ */ jsx12("span", { className: "text-3xl font-semibold text-foreground", children: usd(introductory.priceCents) }),
3235
+ /* @__PURE__ */ jsx12("span", { className: "text-sm text-muted-foreground", children: "first month" })
2761
3236
  ] }),
2762
- /* @__PURE__ */ jsxs9("p", { className: "mt-1 text-sm text-muted-foreground", children: [
3237
+ /* @__PURE__ */ jsxs10("p", { className: "mt-1 text-sm text-muted-foreground", children: [
2763
3238
  "Includes ",
2764
3239
  usd(introductory.includedCreditsCents),
2765
3240
  " of AI usage in your first month"
2766
3241
  ] }),
2767
- /* @__PURE__ */ jsxs9("p", { className: "mt-1 text-sm text-muted-foreground", children: [
3242
+ /* @__PURE__ */ jsxs10("p", { className: "mt-1 text-sm text-muted-foreground", children: [
2768
3243
  "Then ",
2769
3244
  recurringPrice,
2770
3245
  "/mo \xB7 includes ",
2771
3246
  recurringUsage,
2772
3247
  "/mo of AI usage"
2773
3248
  ] })
2774
- ] }) : /* @__PURE__ */ jsxs9(Fragment5, { children: [
2775
- /* @__PURE__ */ jsxs9("div", { className: "mt-6 flex items-baseline gap-1.5", children: [
2776
- /* @__PURE__ */ jsx11("span", { className: "text-3xl font-semibold text-foreground", children: recurringPrice }),
2777
- /* @__PURE__ */ jsx11("span", { className: "text-sm text-muted-foreground", children: "/mo" })
3249
+ ] }) : /* @__PURE__ */ jsxs10(Fragment5, { children: [
3250
+ /* @__PURE__ */ jsxs10("div", { className: "mt-6 flex items-baseline gap-1.5", children: [
3251
+ /* @__PURE__ */ jsx12("span", { className: "text-3xl font-semibold text-foreground", children: recurringPrice }),
3252
+ /* @__PURE__ */ jsx12("span", { className: "text-sm text-muted-foreground", children: "/mo" })
2778
3253
  ] }),
2779
- /* @__PURE__ */ jsxs9("p", { className: "mt-1 text-sm text-muted-foreground", children: [
3254
+ /* @__PURE__ */ jsxs10("p", { className: "mt-1 text-sm text-muted-foreground", children: [
2780
3255
  "Includes ",
2781
3256
  recurringUsage,
2782
3257
  "/mo of AI usage"
2783
3258
  ] })
2784
3259
  ] }),
2785
- /* @__PURE__ */ jsx11("ul", { className: "mt-6 space-y-2.5", children: (benefits ?? [
3260
+ /* @__PURE__ */ jsx12("ul", { className: "mt-6 space-y-2.5", children: (benefits ?? [
2786
3261
  `Full access to ${product}`,
2787
3262
  `${recurringUsage}/mo of AI usage included`
2788
- ]).map((benefit, i) => /* @__PURE__ */ jsx11(Benefit, { children: benefit }, i)) }),
2789
- /* @__PURE__ */ jsx11(
3263
+ ]).map((benefit, i) => /* @__PURE__ */ jsx12(Benefit, { children: benefit }, i)) }),
3264
+ /* @__PURE__ */ jsx12(
2790
3265
  "button",
2791
3266
  {
2792
3267
  type: "button",
@@ -2796,32 +3271,32 @@ function SeatPaywall({
2796
3271
  children: pending ? "Opening checkout\u2026" : ctaLabel ?? `Unlock ${product}`
2797
3272
  }
2798
3273
  ),
2799
- footnote && /* @__PURE__ */ jsx11("p", { className: "mt-3 text-center text-xs text-muted-foreground/70", children: footnote })
3274
+ footnote && /* @__PURE__ */ jsx12("p", { className: "mt-3 text-center text-xs text-muted-foreground/70", children: footnote })
2800
3275
  ] }) });
2801
3276
  }
2802
3277
 
2803
3278
  // src/web-react/session-history.tsx
2804
3279
  import {
2805
- useCallback as useCallback7,
2806
- useEffect as useEffect9,
3280
+ useCallback as useCallback8,
3281
+ useEffect as useEffect10,
2807
3282
  useMemo as useMemo6,
2808
- useRef as useRef8,
2809
- useState as useState12
3283
+ useRef as useRef9,
3284
+ useState as useState13
2810
3285
  } from "react";
2811
- import { Fragment as Fragment6, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
3286
+ import { Fragment as Fragment6, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
2812
3287
  function rethrowAsync(error) {
2813
3288
  queueMicrotask(() => {
2814
3289
  throw error;
2815
3290
  });
2816
3291
  }
2817
3292
  function useInfiniteScroll(onLoadMore, { enabled, root, rootMargin = "300px" }) {
2818
- const [sentinel, setSentinel] = useState12(null);
2819
- const sentinelRef = useCallback7((node) => setSentinel(node), []);
2820
- const onLoadMoreRef = useRef8(onLoadMore);
2821
- useEffect9(() => {
3293
+ const [sentinel, setSentinel] = useState13(null);
3294
+ const sentinelRef = useCallback8((node) => setSentinel(node), []);
3295
+ const onLoadMoreRef = useRef9(onLoadMore);
3296
+ useEffect10(() => {
2822
3297
  onLoadMoreRef.current = onLoadMore;
2823
3298
  }, [onLoadMore]);
2824
- useEffect9(() => {
3299
+ useEffect10(() => {
2825
3300
  if (!sentinel || !enabled) return;
2826
3301
  if (typeof IntersectionObserver === "undefined") return;
2827
3302
  const observer = new IntersectionObserver(
@@ -2850,24 +3325,24 @@ function useSessionHistory({
2850
3325
  initialPage,
2851
3326
  defaultSort = "newest"
2852
3327
  }) {
2853
- const [items, setItems] = useState12(initialPage.items);
2854
- const [nextCursor, setNextCursor] = useState12(initialPage.nextCursor ?? null);
2855
- const [phase, setPhase] = useState12("idle");
2856
- const [reloadKey, setReloadKey] = useState12(0);
2857
- const seqRef = useRef8(0);
2858
- const resetAbortRef = useRef8(null);
2859
- const loadMoreAbortRef = useRef8(null);
2860
- const loadingMoreRef = useRef8(false);
2861
- const lastOpRef = useRef8("first");
2862
- const nextCursorRef = useRef8(nextCursor);
3328
+ const [items, setItems] = useState13(initialPage.items);
3329
+ const [nextCursor, setNextCursor] = useState13(initialPage.nextCursor ?? null);
3330
+ const [phase, setPhase] = useState13("idle");
3331
+ const [reloadKey, setReloadKey] = useState13(0);
3332
+ const seqRef = useRef9(0);
3333
+ const resetAbortRef = useRef9(null);
3334
+ const loadMoreAbortRef = useRef9(null);
3335
+ const loadingMoreRef = useRef9(false);
3336
+ const lastOpRef = useRef9("first");
3337
+ const nextCursorRef = useRef9(nextCursor);
2863
3338
  nextCursorRef.current = nextCursor;
2864
- const viewRef = useRef8({ q, sort, fetchPage });
3339
+ const viewRef = useRef9({ q, sort, fetchPage });
2865
3340
  viewRef.current = { q, sort, fetchPage };
2866
- const seedRef = useRef8(initialPage);
3341
+ const seedRef = useRef9(initialPage);
2867
3342
  seedRef.current = initialPage;
2868
3343
  const isDefaultView = q === "" && sort === defaultSort;
2869
3344
  const seedKey = useMemo6(() => seedSignature(initialPage), [initialPage]);
2870
- useEffect9(() => {
3345
+ useEffect10(() => {
2871
3346
  resetAbortRef.current?.abort();
2872
3347
  loadMoreAbortRef.current?.abort();
2873
3348
  loadingMoreRef.current = false;
@@ -2898,7 +3373,7 @@ function useSessionHistory({
2898
3373
  })();
2899
3374
  return () => controller.abort();
2900
3375
  }, [q, sort, seedKey, isDefaultView, reloadKey]);
2901
- const loadMore = useCallback7(() => {
3376
+ const loadMore = useCallback8(() => {
2902
3377
  const cursor = nextCursorRef.current;
2903
3378
  if (!cursor || loadingMoreRef.current) return;
2904
3379
  const { q: currentQ, sort: currentSort, fetchPage: currentFetch } = viewRef.current;
@@ -2923,14 +3398,14 @@ function useSessionHistory({
2923
3398
  }
2924
3399
  })();
2925
3400
  }, []);
2926
- const retry = useCallback7(() => {
3401
+ const retry = useCallback8(() => {
2927
3402
  if (lastOpRef.current === "more") loadMore();
2928
3403
  else setReloadKey((key) => key + 1);
2929
3404
  }, [loadMore]);
2930
- const reload = useCallback7(() => {
3405
+ const reload = useCallback8(() => {
2931
3406
  setReloadKey((key) => key + 1);
2932
3407
  }, []);
2933
- useEffect9(
3408
+ useEffect10(
2934
3409
  () => () => {
2935
3410
  resetAbortRef.current?.abort();
2936
3411
  loadMoreAbortRef.current?.abort();
@@ -2971,21 +3446,21 @@ function useSessionActions({
2971
3446
  labels
2972
3447
  }) {
2973
3448
  const text = { ...DEFAULT_LABELS, ...labels };
2974
- const [renameTarget, setRenameTarget] = useState12(null);
2975
- const [renameValue, setRenameValue] = useState12("");
2976
- const [deleteTarget, setDeleteTarget] = useState12(null);
2977
- const [busy, setBusy] = useState12(false);
2978
- const [error, setError] = useState12(null);
2979
- const openRename = useCallback7((session) => {
3449
+ const [renameTarget, setRenameTarget] = useState13(null);
3450
+ const [renameValue, setRenameValue] = useState13("");
3451
+ const [deleteTarget, setDeleteTarget] = useState13(null);
3452
+ const [busy, setBusy] = useState13(false);
3453
+ const [error, setError] = useState13(null);
3454
+ const openRename = useCallback8((session) => {
2980
3455
  setError(null);
2981
3456
  setRenameTarget(session);
2982
3457
  setRenameValue(session.title ?? "");
2983
3458
  }, []);
2984
- const openDelete = useCallback7((session) => {
3459
+ const openDelete = useCallback8((session) => {
2985
3460
  setError(null);
2986
3461
  setDeleteTarget(session);
2987
3462
  }, []);
2988
- const submitRename = useCallback7(async () => {
3463
+ const submitRename = useCallback8(async () => {
2989
3464
  if (!renameTarget) return;
2990
3465
  const title = renameValue.trim();
2991
3466
  if (!title || title === renameTarget.title) {
@@ -3007,7 +3482,7 @@ function useSessionActions({
3007
3482
  setBusy(false);
3008
3483
  }
3009
3484
  }, [renameTarget, renameValue, renameSession, notify, onChanged, text.renamed, text.renameFailed]);
3010
- const confirmDelete = useCallback7(async () => {
3485
+ const confirmDelete = useCallback8(async () => {
3011
3486
  if (!deleteTarget) return;
3012
3487
  const deletingCurrent = currentSessionId != null && deleteTarget.id === currentSessionId;
3013
3488
  setBusy(true);
@@ -3026,21 +3501,21 @@ function useSessionActions({
3026
3501
  setBusy(false);
3027
3502
  }
3028
3503
  }, [deleteTarget, currentSessionId, deleteSession, notify, onChanged, onDeletedCurrent, text.deleted, text.deleteFailed]);
3029
- const dialogs = /* @__PURE__ */ jsxs10(Fragment6, { children: [
3030
- renameTarget && /* @__PURE__ */ jsxs10(
3504
+ const dialogs = /* @__PURE__ */ jsxs11(Fragment6, { children: [
3505
+ renameTarget && /* @__PURE__ */ jsxs11(
3031
3506
  SessionDialog,
3032
3507
  {
3033
3508
  title: text.renameTitle,
3034
3509
  onClose: () => setRenameTarget(null),
3035
3510
  busy,
3036
3511
  error,
3037
- footer: /* @__PURE__ */ jsxs10(Fragment6, { children: [
3038
- /* @__PURE__ */ jsx12(DialogButton, { onClick: () => setRenameTarget(null), disabled: busy, variant: "ghost", children: text.cancel }),
3039
- /* @__PURE__ */ jsx12(DialogButton, { onClick: () => void submitRename(), disabled: busy || !renameValue.trim(), children: text.renameSubmit })
3512
+ footer: /* @__PURE__ */ jsxs11(Fragment6, { children: [
3513
+ /* @__PURE__ */ jsx13(DialogButton, { onClick: () => setRenameTarget(null), disabled: busy, variant: "ghost", children: text.cancel }),
3514
+ /* @__PURE__ */ jsx13(DialogButton, { onClick: () => void submitRename(), disabled: busy || !renameValue.trim(), children: text.renameSubmit })
3040
3515
  ] }),
3041
3516
  children: [
3042
- /* @__PURE__ */ jsx12("label", { htmlFor: "agent-app-rename-session", className: "text-xs text-muted-foreground", children: text.renameField }),
3043
- /* @__PURE__ */ jsx12(
3517
+ /* @__PURE__ */ jsx13("label", { htmlFor: "agent-app-rename-session", className: "text-xs text-muted-foreground", children: text.renameField }),
3518
+ /* @__PURE__ */ jsx13(
3044
3519
  "input",
3045
3520
  {
3046
3521
  id: "agent-app-rename-session",
@@ -3059,18 +3534,18 @@ function useSessionActions({
3059
3534
  ]
3060
3535
  }
3061
3536
  ),
3062
- deleteTarget && /* @__PURE__ */ jsx12(
3537
+ deleteTarget && /* @__PURE__ */ jsx13(
3063
3538
  SessionDialog,
3064
3539
  {
3065
3540
  title: text.deleteTitle,
3066
3541
  onClose: () => setDeleteTarget(null),
3067
3542
  busy,
3068
3543
  error,
3069
- footer: /* @__PURE__ */ jsxs10(Fragment6, { children: [
3070
- /* @__PURE__ */ jsx12(DialogButton, { onClick: () => setDeleteTarget(null), disabled: busy, variant: "ghost", children: text.cancel }),
3071
- /* @__PURE__ */ jsx12(DialogButton, { onClick: () => void confirmDelete(), disabled: busy, variant: "destructive", children: text.deleteSubmit })
3544
+ footer: /* @__PURE__ */ jsxs11(Fragment6, { children: [
3545
+ /* @__PURE__ */ jsx13(DialogButton, { onClick: () => setDeleteTarget(null), disabled: busy, variant: "ghost", children: text.cancel }),
3546
+ /* @__PURE__ */ jsx13(DialogButton, { onClick: () => void confirmDelete(), disabled: busy, variant: "destructive", children: text.deleteSubmit })
3072
3547
  ] }),
3073
- children: /* @__PURE__ */ jsx12("p", { className: "text-sm text-muted-foreground", children: text.deleteBody(sessionLabel(deleteTarget)) })
3548
+ children: /* @__PURE__ */ jsx13("p", { className: "text-sm text-muted-foreground", children: text.deleteBody(sessionLabel(deleteTarget)) })
3074
3549
  }
3075
3550
  )
3076
3551
  ] });
@@ -3083,7 +3558,7 @@ function DialogButton({
3083
3558
  variant = "primary"
3084
3559
  }) {
3085
3560
  const tone = variant === "ghost" ? "text-muted-foreground hover:bg-accent/30 hover:text-foreground" : variant === "destructive" ? "bg-destructive text-destructive-foreground hover:opacity-90" : "bg-primary text-primary-foreground hover:opacity-90";
3086
- return /* @__PURE__ */ jsx12(
3561
+ return /* @__PURE__ */ jsx13(
3087
3562
  "button",
3088
3563
  {
3089
3564
  type: "button",
@@ -3102,15 +3577,15 @@ function SessionDialog({
3102
3577
  busy,
3103
3578
  error
3104
3579
  }) {
3105
- useEffect9(() => {
3580
+ useEffect10(() => {
3106
3581
  const onKey = (e) => {
3107
3582
  if (e.key === "Escape" && !busy) onClose();
3108
3583
  };
3109
3584
  document.addEventListener("keydown", onKey);
3110
3585
  return () => document.removeEventListener("keydown", onKey);
3111
3586
  }, [busy, onClose]);
3112
- return /* @__PURE__ */ jsxs10("div", { className: "fixed inset-0 z-50 flex items-center justify-center p-4", children: [
3113
- /* @__PURE__ */ jsx12(
3587
+ return /* @__PURE__ */ jsxs11("div", { className: "fixed inset-0 z-50 flex items-center justify-center p-4", children: [
3588
+ /* @__PURE__ */ jsx13(
3114
3589
  "div",
3115
3590
  {
3116
3591
  className: "absolute inset-0 bg-black/50",
@@ -3120,7 +3595,7 @@ function SessionDialog({
3120
3595
  "aria-hidden": true
3121
3596
  }
3122
3597
  ),
3123
- /* @__PURE__ */ jsxs10(
3598
+ /* @__PURE__ */ jsxs11(
3124
3599
  "div",
3125
3600
  {
3126
3601
  role: "dialog",
@@ -3128,17 +3603,17 @@ function SessionDialog({
3128
3603
  "aria-label": title,
3129
3604
  className: "relative w-full max-w-sm rounded-xl border border-border bg-card p-5 shadow-lg",
3130
3605
  children: [
3131
- /* @__PURE__ */ jsx12("h2", { className: "text-sm font-semibold text-foreground", children: title }),
3132
- /* @__PURE__ */ jsx12("div", { className: "mt-3", children }),
3133
- error && /* @__PURE__ */ jsx12("p", { role: "alert", className: "mt-3 rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive", children: error }),
3134
- /* @__PURE__ */ jsx12("div", { className: "mt-5 flex justify-end gap-2", children: footer })
3606
+ /* @__PURE__ */ jsx13("h2", { className: "text-sm font-semibold text-foreground", children: title }),
3607
+ /* @__PURE__ */ jsx13("div", { className: "mt-3", children }),
3608
+ error && /* @__PURE__ */ jsx13("p", { role: "alert", className: "mt-3 rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive", children: error }),
3609
+ /* @__PURE__ */ jsx13("div", { className: "mt-5 flex justify-end gap-2", children: footer })
3135
3610
  ]
3136
3611
  }
3137
3612
  )
3138
3613
  ] });
3139
3614
  }
3140
3615
  function AnchorLink({ to, className, children }) {
3141
- return /* @__PURE__ */ jsx12("a", { href: to, className, children });
3616
+ return /* @__PURE__ */ jsx13("a", { href: to, className, children });
3142
3617
  }
3143
3618
  var MINUTE = 6e4;
3144
3619
  var HOUR = 60 * MINUTE;
@@ -3155,14 +3630,14 @@ function formatSessionTimestamp(isoDate) {
3155
3630
  return new Date(at).toLocaleDateString(void 0, { month: "short", day: "numeric" });
3156
3631
  }
3157
3632
  function SkeletonRows() {
3158
- return /* @__PURE__ */ jsx12("div", { className: "flex flex-col gap-0.5", "aria-hidden": true, children: Array.from({ length: 8 }).map((_, i) => /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-3 px-3 py-2.5", children: [
3159
- /* @__PURE__ */ jsx12("div", { className: "h-4 w-4 animate-pulse rounded bg-muted" }),
3160
- /* @__PURE__ */ jsx12("div", { className: "h-4 w-1/2 animate-pulse rounded bg-muted" }),
3161
- /* @__PURE__ */ jsx12("div", { className: "ml-auto h-3 w-12 animate-pulse rounded bg-muted" })
3633
+ return /* @__PURE__ */ jsx13("div", { className: "flex flex-col gap-0.5", "aria-hidden": true, children: Array.from({ length: 8 }).map((_, i) => /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-3 px-3 py-2.5", children: [
3634
+ /* @__PURE__ */ jsx13("div", { className: "h-4 w-4 animate-pulse rounded bg-muted" }),
3635
+ /* @__PURE__ */ jsx13("div", { className: "h-4 w-1/2 animate-pulse rounded bg-muted" }),
3636
+ /* @__PURE__ */ jsx13("div", { className: "ml-auto h-3 w-12 animate-pulse rounded bg-muted" })
3162
3637
  ] }, i)) });
3163
3638
  }
3164
3639
  function MessageIcon({ className }) {
3165
- return /* @__PURE__ */ jsx12("svg", { viewBox: "0 0 24 24", className, fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx12("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }) });
3640
+ return /* @__PURE__ */ jsx13("svg", { viewBox: "0 0 24 24", className, fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx13("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }) });
3166
3641
  }
3167
3642
  function SessionHistoryPanel({
3168
3643
  history,
@@ -3189,7 +3664,7 @@ function SessionHistoryPanel({
3189
3664
  contentWidth = "reading",
3190
3665
  className
3191
3666
  }) {
3192
- const scrollRef = useRef8(null);
3667
+ const scrollRef = useRef9(null);
3193
3668
  const sentinelRef = useInfiniteScroll(history.loadMore, {
3194
3669
  enabled: history.hasMore && !history.isLoadingMore && !history.isError,
3195
3670
  root: scrollRef,
@@ -3198,15 +3673,15 @@ function SessionHistoryPanel({
3198
3673
  const searchTerm = query.trim();
3199
3674
  const isSearching = searchTerm.length > 0;
3200
3675
  const column = contentWidth === "full" ? "w-full" : "mx-auto w-full max-w-4xl";
3201
- const [selectedIds, setSelectedIds] = useState12(/* @__PURE__ */ new Set());
3202
- const [ageDays, setAgeDays] = useState12("30");
3203
- const [bulkTarget, setBulkTarget] = useState12(null);
3204
- const [bulkBusy, setBulkBusy] = useState12(false);
3205
- const [bulkError, setBulkError] = useState12(null);
3206
- useEffect9(() => {
3676
+ const [selectedIds, setSelectedIds] = useState13(/* @__PURE__ */ new Set());
3677
+ const [ageDays, setAgeDays] = useState13("30");
3678
+ const [bulkTarget, setBulkTarget] = useState13(null);
3679
+ const [bulkBusy, setBulkBusy] = useState13(false);
3680
+ const [bulkError, setBulkError] = useState13(null);
3681
+ useEffect10(() => {
3207
3682
  setSelectedIds(/* @__PURE__ */ new Set());
3208
3683
  }, [searchTerm, sort]);
3209
- useEffect9(() => {
3684
+ useEffect10(() => {
3210
3685
  const visible = new Set(history.items.map((item) => item.id));
3211
3686
  setSelectedIds((current) => {
3212
3687
  const next = new Set([...current].filter((id) => visible.has(id)));
@@ -3217,7 +3692,7 @@ function SessionHistoryPanel({
3217
3692
  const allVisibleSelected = history.items.length > 0 && history.items.every((item) => selectedIds.has(item.id));
3218
3693
  const parsedAgeDays = Number(ageDays);
3219
3694
  const validAgeDays = Number.isInteger(parsedAgeDays) && parsedAgeDays >= 1 && parsedAgeDays <= 36500;
3220
- const openBulkAction = useCallback7((action) => {
3695
+ const openBulkAction = useCallback8((action) => {
3221
3696
  const verb = deleteLabel.toLowerCase();
3222
3697
  if (action.kind === "selected") {
3223
3698
  setBulkTarget({
@@ -3234,7 +3709,7 @@ function SessionHistoryPanel({
3234
3709
  body: "This applies to every matching session in this workspace, including sessions not currently loaded in this list."
3235
3710
  });
3236
3711
  }, [deleteLabel]);
3237
- const confirmBulkAction = useCallback7(async () => {
3712
+ const confirmBulkAction = useCallback8(async () => {
3238
3713
  if (!bulkTarget || !onBulkAction) return;
3239
3714
  setBulkBusy(true);
3240
3715
  setBulkError(null);
@@ -3249,25 +3724,25 @@ function SessionHistoryPanel({
3249
3724
  setBulkBusy(false);
3250
3725
  }
3251
3726
  }, [bulkTarget, deleteLabel, history, onBulkAction]);
3252
- return /* @__PURE__ */ jsxs10("div", { className: `flex min-h-0 min-w-0 flex-1 flex-col ${className ?? ""}`, children: [
3253
- /* @__PURE__ */ jsx12("header", { className: "flex h-14 shrink-0 items-center border-b border-border px-4 sm:px-6", children: /* @__PURE__ */ jsxs10("div", { className: `flex items-center gap-3 px-3 ${column}`, children: [
3254
- /* @__PURE__ */ jsx12("h1", { className: "flex-1 truncate text-sm font-semibold text-foreground", children: title }),
3255
- newSessionHref && /* @__PURE__ */ jsxs10(
3727
+ return /* @__PURE__ */ jsxs11("div", { className: `flex min-h-0 min-w-0 flex-1 flex-col ${className ?? ""}`, children: [
3728
+ /* @__PURE__ */ jsx13("header", { className: "flex h-14 shrink-0 items-center border-b border-border px-4 sm:px-6", children: /* @__PURE__ */ jsxs11("div", { className: `flex items-center gap-3 px-3 ${column}`, children: [
3729
+ /* @__PURE__ */ jsx13("h1", { className: "flex-1 truncate text-sm font-semibold text-foreground", children: title }),
3730
+ newSessionHref && /* @__PURE__ */ jsxs11(
3256
3731
  Link,
3257
3732
  {
3258
3733
  to: newSessionHref,
3259
3734
  className: "inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground transition hover:opacity-90",
3260
3735
  children: [
3261
- /* @__PURE__ */ jsx12("span", { "aria-hidden": true, className: "text-sm leading-none", children: "+" }),
3736
+ /* @__PURE__ */ jsx13("span", { "aria-hidden": true, className: "text-sm leading-none", children: "+" }),
3262
3737
  "New chat"
3263
3738
  ]
3264
3739
  }
3265
3740
  )
3266
3741
  ] }) }),
3267
- /* @__PURE__ */ jsxs10("div", { ref: scrollRef, className: "min-h-0 flex-1 overflow-y-auto", children: [
3268
- hasAnySessions && /* @__PURE__ */ jsxs10("div", { className: "sticky top-0 z-10 bg-background px-4 sm:px-6", children: [
3269
- /* @__PURE__ */ jsxs10("div", { className: `flex flex-col gap-2 px-3 pb-3 pt-4 sm:flex-row sm:items-center sm:gap-3 ${column}`, children: [
3270
- /* @__PURE__ */ jsx12(
3742
+ /* @__PURE__ */ jsxs11("div", { ref: scrollRef, className: "min-h-0 flex-1 overflow-y-auto", children: [
3743
+ hasAnySessions && /* @__PURE__ */ jsxs11("div", { className: "sticky top-0 z-10 bg-background px-4 sm:px-6", children: [
3744
+ /* @__PURE__ */ jsxs11("div", { className: `flex flex-col gap-2 px-3 pb-3 pt-4 sm:flex-row sm:items-center sm:gap-3 ${column}`, children: [
3745
+ /* @__PURE__ */ jsx13(
3271
3746
  "input",
3272
3747
  {
3273
3748
  type: "search",
@@ -3278,7 +3753,7 @@ function SessionHistoryPanel({
3278
3753
  className: "h-9 min-w-0 appearance-none rounded-md border border-border bg-card px-3 text-sm text-foreground outline-none placeholder:text-muted-foreground focus-visible:ring-2 focus-visible:ring-ring sm:flex-1 [&::-webkit-search-cancel-button]:appearance-none"
3279
3754
  }
3280
3755
  ),
3281
- /* @__PURE__ */ jsxs10(
3756
+ /* @__PURE__ */ jsxs11(
3282
3757
  "select",
3283
3758
  {
3284
3759
  value: sort,
@@ -3286,15 +3761,15 @@ function SessionHistoryPanel({
3286
3761
  "aria-label": "Sort sessions",
3287
3762
  className: "h-9 shrink-0 appearance-none rounded-md border border-border bg-card px-2 text-sm text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring sm:w-[132px]",
3288
3763
  children: [
3289
- /* @__PURE__ */ jsx12("option", { value: "newest", children: "Newest" }),
3290
- /* @__PURE__ */ jsx12("option", { value: "oldest", children: "Oldest" })
3764
+ /* @__PURE__ */ jsx13("option", { value: "newest", children: "Newest" }),
3765
+ /* @__PURE__ */ jsx13("option", { value: "oldest", children: "Oldest" })
3291
3766
  ]
3292
3767
  }
3293
3768
  )
3294
3769
  ] }),
3295
- onBulkAction && /* @__PURE__ */ jsxs10("div", { className: `flex flex-col gap-2 border-t border-border/60 px-3 py-3 ${column}`, children: [
3296
- /* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap items-center gap-2", children: [
3297
- /* @__PURE__ */ jsx12(
3770
+ onBulkAction && /* @__PURE__ */ jsxs11("div", { className: `flex flex-col gap-2 border-t border-border/60 px-3 py-3 ${column}`, children: [
3771
+ /* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap items-center gap-2", children: [
3772
+ /* @__PURE__ */ jsx13(
3298
3773
  "button",
3299
3774
  {
3300
3775
  type: "button",
@@ -3304,7 +3779,7 @@ function SessionHistoryPanel({
3304
3779
  children: "Select all"
3305
3780
  }
3306
3781
  ),
3307
- /* @__PURE__ */ jsx12(
3782
+ /* @__PURE__ */ jsx13(
3308
3783
  "button",
3309
3784
  {
3310
3785
  type: "button",
@@ -3314,11 +3789,11 @@ function SessionHistoryPanel({
3314
3789
  children: "Deselect all"
3315
3790
  }
3316
3791
  ),
3317
- /* @__PURE__ */ jsxs10("span", { className: "text-xs text-muted-foreground", "aria-live": "polite", children: [
3792
+ /* @__PURE__ */ jsxs11("span", { className: "text-xs text-muted-foreground", "aria-live": "polite", children: [
3318
3793
  selectedCount,
3319
3794
  " selected"
3320
3795
  ] }),
3321
- selectedCount > 0 && /* @__PURE__ */ jsxs10(
3796
+ selectedCount > 0 && /* @__PURE__ */ jsxs11(
3322
3797
  "button",
3323
3798
  {
3324
3799
  type: "button",
@@ -3331,9 +3806,9 @@ function SessionHistoryPanel({
3331
3806
  }
3332
3807
  )
3333
3808
  ] }),
3334
- /* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap items-center gap-2", children: [
3335
- /* @__PURE__ */ jsx12("label", { htmlFor: "agent-app-session-age", className: "text-xs text-muted-foreground", children: "Session age" }),
3336
- /* @__PURE__ */ jsx12(
3809
+ /* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap items-center gap-2", children: [
3810
+ /* @__PURE__ */ jsx13("label", { htmlFor: "agent-app-session-age", className: "text-xs text-muted-foreground", children: "Session age" }),
3811
+ /* @__PURE__ */ jsx13(
3337
3812
  "input",
3338
3813
  {
3339
3814
  id: "agent-app-session-age",
@@ -3346,8 +3821,8 @@ function SessionHistoryPanel({
3346
3821
  className: "h-8 w-20 rounded-md border border-border bg-card px-2 text-xs tabular-nums text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring"
3347
3822
  }
3348
3823
  ),
3349
- /* @__PURE__ */ jsx12("span", { className: "text-xs text-muted-foreground", children: "days" }),
3350
- /* @__PURE__ */ jsxs10(
3824
+ /* @__PURE__ */ jsx13("span", { className: "text-xs text-muted-foreground", children: "days" }),
3825
+ /* @__PURE__ */ jsxs11(
3351
3826
  "button",
3352
3827
  {
3353
3828
  type: "button",
@@ -3360,7 +3835,7 @@ function SessionHistoryPanel({
3360
3835
  ]
3361
3836
  }
3362
3837
  ),
3363
- /* @__PURE__ */ jsxs10(
3838
+ /* @__PURE__ */ jsxs11(
3364
3839
  "button",
3365
3840
  {
3366
3841
  type: "button",
@@ -3376,15 +3851,15 @@ function SessionHistoryPanel({
3376
3851
  ] })
3377
3852
  ] })
3378
3853
  ] }),
3379
- /* @__PURE__ */ jsx12("div", { className: `px-4 pb-8 pt-1 sm:px-6 ${column}`, children: !hasAnySessions ? /* @__PURE__ */ jsxs10("div", { className: "flex min-h-[50vh] flex-col items-center justify-center gap-2 text-center", children: [
3380
- /* @__PURE__ */ jsx12("p", { className: "text-sm font-medium text-foreground", children: emptyTitle }),
3381
- /* @__PURE__ */ jsx12("p", { className: "max-w-xs text-xs text-muted-foreground", children: emptyDescription })
3382
- ] }) : history.isLoadingFirst ? /* @__PURE__ */ jsx12(SkeletonRows, {}) : history.items.length === 0 ? history.isError ? /* @__PURE__ */ jsx12(ErrorBlock, { onRetry: history.retry, message: "Couldn\u2019t load your sessions." }) : isSearching ? /* @__PURE__ */ jsxs10("p", { className: "py-16 text-center text-sm text-muted-foreground", children: [
3854
+ /* @__PURE__ */ jsx13("div", { className: `px-4 pb-8 pt-1 sm:px-6 ${column}`, children: !hasAnySessions ? /* @__PURE__ */ jsxs11("div", { className: "flex min-h-[50vh] flex-col items-center justify-center gap-2 text-center", children: [
3855
+ /* @__PURE__ */ jsx13("p", { className: "text-sm font-medium text-foreground", children: emptyTitle }),
3856
+ /* @__PURE__ */ jsx13("p", { className: "max-w-xs text-xs text-muted-foreground", children: emptyDescription })
3857
+ ] }) : history.isLoadingFirst ? /* @__PURE__ */ jsx13(SkeletonRows, {}) : history.items.length === 0 ? history.isError ? /* @__PURE__ */ jsx13(ErrorBlock, { onRetry: history.retry, message: "Couldn\u2019t load your sessions." }) : isSearching ? /* @__PURE__ */ jsxs11("p", { className: "py-16 text-center text-sm text-muted-foreground", children: [
3383
3858
  "No sessions match \u201C",
3384
3859
  searchTerm,
3385
3860
  "\u201D."
3386
- ] }) : /* @__PURE__ */ jsx12("p", { className: "py-16 text-center text-sm text-muted-foreground", children: "No sessions remain." }) : /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-0.5", children: [
3387
- history.items.map((session) => /* @__PURE__ */ jsx12(
3861
+ ] }) : /* @__PURE__ */ jsx13("p", { className: "py-16 text-center text-sm text-muted-foreground", children: "No sessions remain." }) : /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-0.5", children: [
3862
+ history.items.map((session) => /* @__PURE__ */ jsx13(
3388
3863
  SessionRow,
3389
3864
  {
3390
3865
  session,
@@ -3411,10 +3886,10 @@ function SessionHistoryPanel({
3411
3886
  },
3412
3887
  session.id
3413
3888
  )),
3414
- history.isError ? /* @__PURE__ */ jsx12(ErrorBlock, { onRetry: history.retry, message: "Couldn\u2019t load more sessions.", inline: true }) : history.hasMore ? /* @__PURE__ */ jsx12("div", { ref: sentinelRef, className: "flex items-center justify-center py-6", children: history.isLoadingMore && /* @__PURE__ */ jsx12("span", { className: "text-xs text-muted-foreground", children: "Loading\u2026" }) }) : null
3889
+ history.isError ? /* @__PURE__ */ jsx13(ErrorBlock, { onRetry: history.retry, message: "Couldn\u2019t load more sessions.", inline: true }) : history.hasMore ? /* @__PURE__ */ jsx13("div", { ref: sentinelRef, className: "flex items-center justify-center py-6", children: history.isLoadingMore && /* @__PURE__ */ jsx13("span", { className: "text-xs text-muted-foreground", children: "Loading\u2026" }) }) : null
3415
3890
  ] }) })
3416
3891
  ] }),
3417
- bulkTarget && /* @__PURE__ */ jsx12(
3892
+ bulkTarget && /* @__PURE__ */ jsx13(
3418
3893
  SessionDialog,
3419
3894
  {
3420
3895
  title: bulkTarget.title,
@@ -3426,8 +3901,8 @@ function SessionHistoryPanel({
3426
3901
  },
3427
3902
  busy: bulkBusy,
3428
3903
  error: bulkError,
3429
- footer: /* @__PURE__ */ jsxs10(Fragment6, { children: [
3430
- /* @__PURE__ */ jsx12(
3904
+ footer: /* @__PURE__ */ jsxs11(Fragment6, { children: [
3905
+ /* @__PURE__ */ jsx13(
3431
3906
  DialogButton,
3432
3907
  {
3433
3908
  onClick: () => {
@@ -3439,21 +3914,21 @@ function SessionHistoryPanel({
3439
3914
  children: "Cancel"
3440
3915
  }
3441
3916
  ),
3442
- /* @__PURE__ */ jsx12(DialogButton, { onClick: () => void confirmBulkAction(), disabled: bulkBusy, variant: "destructive", children: bulkBusy ? "Working\u2026" : deleteLabel })
3917
+ /* @__PURE__ */ jsx13(DialogButton, { onClick: () => void confirmBulkAction(), disabled: bulkBusy, variant: "destructive", children: bulkBusy ? "Working\u2026" : deleteLabel })
3443
3918
  ] }),
3444
- children: /* @__PURE__ */ jsx12("p", { className: "text-sm text-muted-foreground", children: bulkTarget.body })
3919
+ children: /* @__PURE__ */ jsx13("p", { className: "text-sm text-muted-foreground", children: bulkTarget.body })
3445
3920
  }
3446
3921
  )
3447
3922
  ] });
3448
3923
  }
3449
3924
  function ErrorBlock({ message, onRetry, inline }) {
3450
- return /* @__PURE__ */ jsxs10(
3925
+ return /* @__PURE__ */ jsxs11(
3451
3926
  "div",
3452
3927
  {
3453
3928
  className: inline ? "flex items-center justify-center gap-3 py-6 text-sm text-muted-foreground" : "flex min-h-[40vh] flex-col items-center justify-center gap-3 text-center",
3454
3929
  children: [
3455
- /* @__PURE__ */ jsx12("span", { className: "text-sm text-muted-foreground", children: message }),
3456
- /* @__PURE__ */ jsx12(
3930
+ /* @__PURE__ */ jsx13("span", { className: "text-sm text-muted-foreground", children: message }),
3931
+ /* @__PURE__ */ jsx13(
3457
3932
  "button",
3458
3933
  {
3459
3934
  type: "button",
@@ -3482,12 +3957,12 @@ function SessionRow({
3482
3957
  selected,
3483
3958
  onSelectedChange
3484
3959
  }) {
3485
- const [menuOpen, setMenuOpen] = useState12(false);
3960
+ const [menuOpen, setMenuOpen] = useState13(false);
3486
3961
  const extras = extraActions?.(session) ?? [];
3487
3962
  const hasMenu = Boolean(onRename) || Boolean(onDelete) || extras.length > 0;
3488
3963
  const showUnread = Boolean(session.unread) && !responding;
3489
- return /* @__PURE__ */ jsxs10("div", { className: "group relative flex items-center gap-2 rounded-lg px-3 py-2.5 transition-colors hover:bg-accent/20", children: [
3490
- selectable && /* @__PURE__ */ jsx12(
3964
+ return /* @__PURE__ */ jsxs11("div", { className: "group relative flex items-center gap-2 rounded-lg px-3 py-2.5 transition-colors hover:bg-accent/20", children: [
3965
+ selectable && /* @__PURE__ */ jsx13(
3491
3966
  "input",
3492
3967
  {
3493
3968
  type: "checkbox",
@@ -3497,10 +3972,10 @@ function SessionRow({
3497
3972
  className: "h-4 w-4 shrink-0 rounded border-border accent-primary"
3498
3973
  }
3499
3974
  ),
3500
- /* @__PURE__ */ jsxs10(Link, { to: href, className: "flex min-w-0 flex-1 items-center gap-3", children: [
3501
- showUnread && /* @__PURE__ */ jsx12("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-primary", "aria-hidden": true }),
3502
- /* @__PURE__ */ jsx12(MessageIcon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
3503
- /* @__PURE__ */ jsx12(
3975
+ /* @__PURE__ */ jsxs11(Link, { to: href, className: "flex min-w-0 flex-1 items-center gap-3", children: [
3976
+ showUnread && /* @__PURE__ */ jsx13("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-primary", "aria-hidden": true }),
3977
+ /* @__PURE__ */ jsx13(MessageIcon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
3978
+ /* @__PURE__ */ jsx13(
3504
3979
  "span",
3505
3980
  {
3506
3981
  className: `truncate text-sm ${responding ? "text-muted-foreground" : "text-foreground"} ${showUnread ? "font-semibold" : ""}`,
@@ -3509,9 +3984,9 @@ function SessionRow({
3509
3984
  }
3510
3985
  )
3511
3986
  ] }),
3512
- /* @__PURE__ */ jsx12("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: timestamp }),
3513
- hasMenu && /* @__PURE__ */ jsxs10("div", { className: "relative shrink-0", children: [
3514
- /* @__PURE__ */ jsx12(
3987
+ /* @__PURE__ */ jsx13("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: timestamp }),
3988
+ hasMenu && /* @__PURE__ */ jsxs11("div", { className: "relative shrink-0", children: [
3989
+ /* @__PURE__ */ jsx13(
3515
3990
  "button",
3516
3991
  {
3517
3992
  type: "button",
@@ -3519,13 +3994,13 @@ function SessionRow({
3519
3994
  "aria-expanded": menuOpen,
3520
3995
  onClick: () => setMenuOpen((open) => !open),
3521
3996
  className: "flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition hover:bg-muted hover:text-foreground focus-visible:opacity-100 sm:opacity-0 sm:group-hover:opacity-100 aria-expanded:opacity-100",
3522
- children: /* @__PURE__ */ jsx12("span", { "aria-hidden": true, className: "text-base leading-none", children: "\u22EF" })
3997
+ children: /* @__PURE__ */ jsx13("span", { "aria-hidden": true, className: "text-base leading-none", children: "\u22EF" })
3523
3998
  }
3524
3999
  ),
3525
- menuOpen && /* @__PURE__ */ jsxs10(Fragment6, { children: [
3526
- /* @__PURE__ */ jsx12("div", { className: "fixed inset-0 z-20", onClick: () => setMenuOpen(false), "aria-hidden": true }),
3527
- /* @__PURE__ */ jsxs10("div", { className: "absolute right-0 z-30 mt-1 w-36 overflow-hidden rounded-md border border-border bg-card py-1 shadow-lg", children: [
3528
- onRename && /* @__PURE__ */ jsx12(
4000
+ menuOpen && /* @__PURE__ */ jsxs11(Fragment6, { children: [
4001
+ /* @__PURE__ */ jsx13("div", { className: "fixed inset-0 z-20", onClick: () => setMenuOpen(false), "aria-hidden": true }),
4002
+ /* @__PURE__ */ jsxs11("div", { className: "absolute right-0 z-30 mt-1 w-36 overflow-hidden rounded-md border border-border bg-card py-1 shadow-lg", children: [
4003
+ onRename && /* @__PURE__ */ jsx13(
3529
4004
  "button",
3530
4005
  {
3531
4006
  type: "button",
@@ -3537,7 +4012,7 @@ function SessionRow({
3537
4012
  children: renameLabel
3538
4013
  }
3539
4014
  ),
3540
- extras.map((action) => /* @__PURE__ */ jsx12(
4015
+ extras.map((action) => /* @__PURE__ */ jsx13(
3541
4016
  "button",
3542
4017
  {
3543
4018
  type: "button",
@@ -3550,7 +4025,7 @@ function SessionRow({
3550
4025
  },
3551
4026
  action.id
3552
4027
  )),
3553
- onDelete && /* @__PURE__ */ jsx12(
4028
+ onDelete && /* @__PURE__ */ jsx13(
3554
4029
  "button",
3555
4030
  {
3556
4031
  type: "button",
@@ -3571,12 +4046,12 @@ function SessionRow({
3571
4046
  // src/web-react/record-grid.tsx
3572
4047
  import {
3573
4048
  Fragment as Fragment7,
3574
- useCallback as useCallback8,
3575
- useEffect as useEffect10,
3576
- useId,
4049
+ useCallback as useCallback9,
4050
+ useEffect as useEffect11,
4051
+ useId as useId2,
3577
4052
  useMemo as useMemo7,
3578
- useRef as useRef9,
3579
- useState as useState13
4053
+ useRef as useRef10,
4054
+ useState as useState14
3580
4055
  } from "react";
3581
4056
 
3582
4057
  // src/web-react/record-grid-model.ts
@@ -3906,7 +4381,7 @@ function pruneRecordGridOverlay(rows, overlay) {
3906
4381
  }
3907
4382
 
3908
4383
  // src/web-react/record-grid.tsx
3909
- import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
4384
+ import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
3910
4385
  var CELL_KEY_SEPARATOR = "\0";
3911
4386
  function cellKey(rowId, columnId) {
3912
4387
  return `${rowId}${CELL_KEY_SEPARATOR}${columnId}`;
@@ -3932,7 +4407,7 @@ function groupColumns(columns) {
3932
4407
  return groups;
3933
4408
  }
3934
4409
  var INPUT_CLASS = "w-full rounded-md border border-border bg-background px-2 py-1 text-sm text-foreground outline-none focus:border-primary/60 focus:ring-1 focus:ring-primary/40";
3935
- var BASIS_TONES = {
4410
+ var BASIS_TONES2 = {
3936
4411
  source: "border-primary/60 text-primary",
3937
4412
  confirmed: "border-success/60 text-success",
3938
4413
  derived: "border-border text-muted-foreground"
@@ -3960,29 +4435,29 @@ function RecordGrid({
3960
4435
  loadingRowCount = 3,
3961
4436
  className
3962
4437
  }) {
3963
- const fieldPrefix = useId();
3964
- const [overlay, setOverlay] = useState13(EMPTY_RECORD_GRID_OVERLAY);
3965
- const [editing, setEditingState] = useState13(null);
3966
- const [cellErrors, setCellErrors] = useState13({});
3967
- const [rowErrors, setRowErrors] = useState13({});
3968
- const [pendingRows, setPendingRows] = useState13({});
3969
- const [focus, setFocus] = useState13(null);
3970
- const [openSource, setOpenSource] = useState13(null);
3971
- const [confirmDelete, setConfirmDelete] = useState13(null);
3972
- const [adding, setAdding] = useState13(false);
3973
- const [draft, setDraft] = useState13({ ...newRowDefaults ?? {} });
3974
- const [draftErrors, setDraftErrors] = useState13({});
3975
- const [draftError, setDraftError] = useState13(null);
3976
- const [creating, setCreating] = useState13(false);
3977
- const cellRefs = useRef9(/* @__PURE__ */ new Map());
3978
- const settling = useRef9(false);
3979
- const draftCounter = useRef9(0);
3980
- const editingRef = useRef9(null);
3981
- const setEditing = useCallback8((next) => {
4438
+ const fieldPrefix = useId2();
4439
+ const [overlay, setOverlay] = useState14(EMPTY_RECORD_GRID_OVERLAY);
4440
+ const [editing, setEditingState] = useState14(null);
4441
+ const [cellErrors, setCellErrors] = useState14({});
4442
+ const [rowErrors, setRowErrors] = useState14({});
4443
+ const [pendingRows, setPendingRows] = useState14({});
4444
+ const [focus, setFocus] = useState14(null);
4445
+ const [openSource, setOpenSource] = useState14(null);
4446
+ const [confirmDelete, setConfirmDelete] = useState14(null);
4447
+ const [adding, setAdding] = useState14(false);
4448
+ const [draft, setDraft] = useState14({ ...newRowDefaults ?? {} });
4449
+ const [draftErrors, setDraftErrors] = useState14({});
4450
+ const [draftError, setDraftError] = useState14(null);
4451
+ const [creating, setCreating] = useState14(false);
4452
+ const cellRefs = useRef10(/* @__PURE__ */ new Map());
4453
+ const settling = useRef10(false);
4454
+ const draftCounter = useRef10(0);
4455
+ const editingRef = useRef10(null);
4456
+ const setEditing = useCallback9((next) => {
3982
4457
  editingRef.current = next;
3983
4458
  setEditingState(next);
3984
4459
  }, []);
3985
- useEffect10(() => {
4460
+ useEffect11(() => {
3986
4461
  setOverlay((current) => pruneRecordGridOverlay(rows, current));
3987
4462
  }, [rows]);
3988
4463
  const visibleRows = useMemo7(() => projectRecordGridRows(rows, overlay), [rows, overlay]);
@@ -3992,7 +4467,7 @@ function RecordGrid({
3992
4467
  if (!columns.some((column) => column.id === focus.columnId)) return null;
3993
4468
  return focus;
3994
4469
  }, [columns, focus, visibleRows]);
3995
- const setCellError = useCallback8((key, message) => {
4470
+ const setCellError = useCallback9((key, message) => {
3996
4471
  setCellErrors((current) => {
3997
4472
  if (message === null) {
3998
4473
  if (!(key in current)) return current;
@@ -4004,7 +4479,7 @@ function RecordGrid({
4004
4479
  return { ...current, [key]: message };
4005
4480
  });
4006
4481
  }, []);
4007
- const setRowError = useCallback8((rowId, message) => {
4482
+ const setRowError = useCallback9((rowId, message) => {
4008
4483
  setRowErrors((current) => {
4009
4484
  if (message === null) {
4010
4485
  if (!(rowId in current)) return current;
@@ -4015,7 +4490,7 @@ function RecordGrid({
4015
4490
  return { ...current, [rowId]: message };
4016
4491
  });
4017
4492
  }, []);
4018
- const setRowPending = useCallback8((rowId, pending) => {
4493
+ const setRowPending = useCallback9((rowId, pending) => {
4019
4494
  setPendingRows((current) => {
4020
4495
  if (pending) return rowId in current ? current : { ...current, [rowId]: true };
4021
4496
  if (!(rowId in current)) return current;
@@ -4024,11 +4499,11 @@ function RecordGrid({
4024
4499
  return next;
4025
4500
  });
4026
4501
  }, []);
4027
- const focusCell = useCallback8((rowId, columnId) => {
4502
+ const focusCell = useCallback9((rowId, columnId) => {
4028
4503
  setFocus({ rowId, columnId });
4029
4504
  cellRefs.current.get(cellKey(rowId, columnId))?.focus();
4030
4505
  }, []);
4031
- const beginEdit = useCallback8(
4506
+ const beginEdit = useCallback9(
4032
4507
  (row, column) => {
4033
4508
  setCellError(cellKey(row.id, column.id), null);
4034
4509
  setEditing({
@@ -4039,7 +4514,7 @@ function RecordGrid({
4039
4514
  },
4040
4515
  [setCellError, setEditing]
4041
4516
  );
4042
- const applyCellWrite = useCallback8(
4517
+ const applyCellWrite = useCallback9(
4043
4518
  async (row, column, value) => {
4044
4519
  if (!onUpdate) return;
4045
4520
  const values = { ...row.values, [column.id]: value };
@@ -4067,7 +4542,7 @@ function RecordGrid({
4067
4542
  },
4068
4543
  [locale, onUpdate, setRowError, setRowPending]
4069
4544
  );
4070
- const commitEdit = useCallback8(
4545
+ const commitEdit = useCallback9(
4071
4546
  async (row, column, text) => {
4072
4547
  const open = editingRef.current;
4073
4548
  if (open === null || open.rowId !== row.id || open.columnId !== column.id) return;
@@ -4091,7 +4566,7 @@ function RecordGrid({
4091
4566
  },
4092
4567
  [applyCellWrite, setCellError, setEditing]
4093
4568
  );
4094
- const cancelEdit = useCallback8(
4569
+ const cancelEdit = useCallback9(
4095
4570
  (row, column) => {
4096
4571
  setCellError(cellKey(row.id, column.id), null);
4097
4572
  setEditing(null);
@@ -4099,7 +4574,7 @@ function RecordGrid({
4099
4574
  },
4100
4575
  [focusCell, setCellError, setEditing]
4101
4576
  );
4102
- const performDelete = useCallback8(
4577
+ const performDelete = useCallback9(
4103
4578
  async (row) => {
4104
4579
  if (!onDelete) return;
4105
4580
  setConfirmDelete(null);
@@ -4117,16 +4592,16 @@ function RecordGrid({
4117
4592
  },
4118
4593
  [columns, onDelete, setRowError]
4119
4594
  );
4120
- const resetDraft = useCallback8(() => {
4595
+ const resetDraft = useCallback9(() => {
4121
4596
  setDraft({ ...newRowDefaults ?? {} });
4122
4597
  setDraftErrors({});
4123
4598
  setDraftError(null);
4124
4599
  }, [newRowDefaults]);
4125
- const openAdd = useCallback8(() => {
4600
+ const openAdd = useCallback9(() => {
4126
4601
  resetDraft();
4127
4602
  setAdding(true);
4128
4603
  }, [resetDraft]);
4129
- const submitDraft = useCallback8(async () => {
4604
+ const submitDraft = useCallback9(async () => {
4130
4605
  if (!onCreate) return;
4131
4606
  const validated = validateRecordGridRow(columns, draft);
4132
4607
  if (!validated.succeeded) {
@@ -4156,7 +4631,7 @@ function RecordGrid({
4156
4631
  setOverlay((current) => withoutRecordGridCreated(current, draftId));
4157
4632
  setDraftError(outcome.error);
4158
4633
  }, [columns, draft, fieldPrefix, onCreate, resetDraft]);
4159
- const handleGridKeyDown = useCallback8(
4634
+ const handleGridKeyDown = useCallback9(
4160
4635
  (event) => {
4161
4636
  if (editing !== null) return;
4162
4637
  const target = event.target;
@@ -4196,9 +4671,9 @@ function RecordGrid({
4196
4671
  );
4197
4672
  const dataState = typeof error === "string" && error !== "" ? "error" : state;
4198
4673
  if (dataState === "loading") {
4199
- return /* @__PURE__ */ jsxs11("div", { className: `space-y-3 ${className ?? ""}`, children: [
4674
+ return /* @__PURE__ */ jsxs12("div", { className: `space-y-3 ${className ?? ""}`, children: [
4200
4675
  toolbar,
4201
- /* @__PURE__ */ jsxs11(
4676
+ /* @__PURE__ */ jsxs12(
4202
4677
  "div",
4203
4678
  {
4204
4679
  role: "status",
@@ -4206,22 +4681,22 @@ function RecordGrid({
4206
4681
  "aria-live": "polite",
4207
4682
  className: "space-y-2 rounded-xl border border-border bg-card p-4",
4208
4683
  children: [
4209
- /* @__PURE__ */ jsxs11("span", { className: "sr-only", children: [
4684
+ /* @__PURE__ */ jsxs12("span", { className: "sr-only", children: [
4210
4685
  "Loading ",
4211
4686
  caption
4212
4687
  ] }),
4213
- Array.from({ length: Math.max(1, loadingRowCount) }, (_, index) => /* @__PURE__ */ jsx13("div", { className: "h-8 animate-pulse rounded-md bg-muted/50", "aria-hidden": true }, index))
4688
+ Array.from({ length: Math.max(1, loadingRowCount) }, (_, index) => /* @__PURE__ */ jsx14("div", { className: "h-8 animate-pulse rounded-md bg-muted/50", "aria-hidden": true }, index))
4214
4689
  ]
4215
4690
  }
4216
4691
  )
4217
4692
  ] });
4218
4693
  }
4219
4694
  if (dataState === "error") {
4220
- return /* @__PURE__ */ jsxs11("div", { className: `space-y-3 ${className ?? ""}`, children: [
4695
+ return /* @__PURE__ */ jsxs12("div", { className: `space-y-3 ${className ?? ""}`, children: [
4221
4696
  toolbar,
4222
- /* @__PURE__ */ jsxs11("div", { role: "alert", className: "rounded-xl border border-destructive/40 bg-destructive/10 px-4 py-4", children: [
4223
- /* @__PURE__ */ jsx13("p", { className: "text-sm font-medium text-destructive", children: typeof error === "string" && error !== "" ? error : `${caption} could not be loaded.` }),
4224
- onRetry && /* @__PURE__ */ jsx13(
4697
+ /* @__PURE__ */ jsxs12("div", { role: "alert", className: "rounded-xl border border-destructive/40 bg-destructive/10 px-4 py-4", children: [
4698
+ /* @__PURE__ */ jsx14("p", { className: "text-sm font-medium text-destructive", children: typeof error === "string" && error !== "" ? error : `${caption} could not be loaded.` }),
4699
+ onRetry && /* @__PURE__ */ jsx14(
4225
4700
  "button",
4226
4701
  {
4227
4702
  type: "button",
@@ -4233,7 +4708,7 @@ function RecordGrid({
4233
4708
  ] })
4234
4709
  ] });
4235
4710
  }
4236
- const addForm = adding && onCreate ? /* @__PURE__ */ jsx13(
4711
+ const addForm = adding && onCreate ? /* @__PURE__ */ jsx14(
4237
4712
  AddRecordForm,
4238
4713
  {
4239
4714
  columns,
@@ -4252,14 +4727,14 @@ function RecordGrid({
4252
4727
  }
4253
4728
  ) : null;
4254
4729
  if (visibleRows.length === 0) {
4255
- return /* @__PURE__ */ jsxs11("div", { className: `space-y-3 ${className ?? ""}`, children: [
4730
+ return /* @__PURE__ */ jsxs12("div", { className: `space-y-3 ${className ?? ""}`, children: [
4256
4731
  toolbar,
4257
- addForm ?? /* @__PURE__ */ jsxs11("div", { className: "rounded-xl border border-dashed border-border px-6 py-10 text-center", children: [
4258
- /* @__PURE__ */ jsx13("p", { className: "text-sm font-medium text-foreground", children: empty.title }),
4259
- empty.description && /* @__PURE__ */ jsx13("p", { className: "mx-auto mt-1 max-w-md text-sm text-muted-foreground", children: empty.description }),
4260
- /* @__PURE__ */ jsxs11("div", { className: "mt-4 flex flex-wrap items-center justify-center gap-2", children: [
4732
+ addForm ?? /* @__PURE__ */ jsxs12("div", { className: "rounded-xl border border-dashed border-border px-6 py-10 text-center", children: [
4733
+ /* @__PURE__ */ jsx14("p", { className: "text-sm font-medium text-foreground", children: empty.title }),
4734
+ empty.description && /* @__PURE__ */ jsx14("p", { className: "mx-auto mt-1 max-w-md text-sm text-muted-foreground", children: empty.description }),
4735
+ /* @__PURE__ */ jsxs12("div", { className: "mt-4 flex flex-wrap items-center justify-center gap-2", children: [
4261
4736
  empty.action,
4262
- onCreate && /* @__PURE__ */ jsx13(
4737
+ onCreate && /* @__PURE__ */ jsx14(
4263
4738
  "button",
4264
4739
  {
4265
4740
  type: "button",
@@ -4274,9 +4749,9 @@ function RecordGrid({
4274
4749
  }
4275
4750
  const hasFooter = columns.some((column) => column.footerValue !== void 0);
4276
4751
  const columnSpan = columns.length + (onDelete ? 1 : 0);
4277
- return /* @__PURE__ */ jsxs11("div", { className: `space-y-3 ${className ?? ""}`, children: [
4752
+ return /* @__PURE__ */ jsxs12("div", { className: `space-y-3 ${className ?? ""}`, children: [
4278
4753
  toolbar,
4279
- /* @__PURE__ */ jsx13("div", { className: "overflow-x-auto rounded-xl border border-border bg-card", children: /* @__PURE__ */ jsxs11(
4754
+ /* @__PURE__ */ jsx14("div", { className: "overflow-x-auto rounded-xl border border-border bg-card", children: /* @__PURE__ */ jsxs12(
4280
4755
  "table",
4281
4756
  {
4282
4757
  role: "grid",
@@ -4284,8 +4759,8 @@ function RecordGrid({
4284
4759
  className: "w-full border-collapse text-left text-sm",
4285
4760
  onKeyDown: handleGridKeyDown,
4286
4761
  children: [
4287
- /* @__PURE__ */ jsx13("thead", { children: /* @__PURE__ */ jsxs11("tr", { role: "row", className: "border-b border-border text-[11px] uppercase tracking-wide text-muted-foreground", children: [
4288
- columns.map((column) => /* @__PURE__ */ jsx13(
4762
+ /* @__PURE__ */ jsx14("thead", { children: /* @__PURE__ */ jsxs12("tr", { role: "row", className: "border-b border-border text-[11px] uppercase tracking-wide text-muted-foreground", children: [
4763
+ columns.map((column) => /* @__PURE__ */ jsx14(
4289
4764
  "th",
4290
4765
  {
4291
4766
  role: "columnheader",
@@ -4295,14 +4770,14 @@ function RecordGrid({
4295
4770
  },
4296
4771
  column.id
4297
4772
  )),
4298
- onDelete && /* @__PURE__ */ jsx13("th", { role: "columnheader", scope: "col", className: "w-px px-3 py-2 font-medium", children: /* @__PURE__ */ jsx13("span", { className: "sr-only", children: "Row actions" }) })
4773
+ onDelete && /* @__PURE__ */ jsx14("th", { role: "columnheader", scope: "col", className: "w-px px-3 py-2 font-medium", children: /* @__PURE__ */ jsx14("span", { className: "sr-only", children: "Row actions" }) })
4299
4774
  ] }) }),
4300
- /* @__PURE__ */ jsx13("tbody", { children: visibleRows.map((row) => {
4775
+ /* @__PURE__ */ jsx14("tbody", { children: visibleRows.map((row) => {
4301
4776
  const rowLabel = recordGridRowLabel(columns, row);
4302
4777
  const pending = row.id in pendingRows;
4303
4778
  const rowError = rowErrors[row.id];
4304
- return /* @__PURE__ */ jsxs11(Fragment7, { children: [
4305
- /* @__PURE__ */ jsxs11("tr", { role: "row", "aria-busy": pending, className: `border-b border-border/50 ${pending ? "opacity-60" : ""}`, children: [
4779
+ return /* @__PURE__ */ jsxs12(Fragment7, { children: [
4780
+ /* @__PURE__ */ jsxs12("tr", { role: "row", "aria-busy": pending, className: `border-b border-border/50 ${pending ? "opacity-60" : ""}`, children: [
4306
4781
  columns.map((column) => {
4307
4782
  const key = cellKey(row.id, column.id);
4308
4783
  const applicable = isRecordGridCellApplicable(column, row.values);
@@ -4314,8 +4789,8 @@ function RecordGrid({
4314
4789
  const source = row.sources?.[column.id];
4315
4790
  const errorId = `${fieldPrefix}-cell-error-${row.id}-${column.id}`;
4316
4791
  if (isEditing && editable) {
4317
- return /* @__PURE__ */ jsxs11("td", { role: "gridcell", className: `px-3 py-1.5 ${alignmentClass(column)}`, children: [
4318
- /* @__PURE__ */ jsx13(
4792
+ return /* @__PURE__ */ jsxs12("td", { role: "gridcell", className: `px-3 py-1.5 ${alignmentClass(column)}`, children: [
4793
+ /* @__PURE__ */ jsx14(
4319
4794
  CellEditor,
4320
4795
  {
4321
4796
  column,
@@ -4328,11 +4803,11 @@ function RecordGrid({
4328
4803
  onCancel: () => cancelEdit(row, column)
4329
4804
  }
4330
4805
  ),
4331
- cellError !== void 0 && /* @__PURE__ */ jsx13("p", { id: errorId, role: "alert", className: "mt-1 text-[11px] leading-snug text-destructive", children: cellError })
4806
+ cellError !== void 0 && /* @__PURE__ */ jsx14("p", { id: errorId, role: "alert", className: "mt-1 text-[11px] leading-snug text-destructive", children: cellError })
4332
4807
  ] }, column.id);
4333
4808
  }
4334
4809
  if (column.kind === "boolean" && editable) {
4335
- return /* @__PURE__ */ jsx13("td", { role: "gridcell", className: `px-3 py-2 ${alignmentClass(column)}`, children: /* @__PURE__ */ jsx13(
4810
+ return /* @__PURE__ */ jsx14("td", { role: "gridcell", className: `px-3 py-2 ${alignmentClass(column)}`, children: /* @__PURE__ */ jsx14(
4336
4811
  "input",
4337
4812
  {
4338
4813
  type: "checkbox",
@@ -4351,7 +4826,7 @@ function RecordGrid({
4351
4826
  ) }, column.id);
4352
4827
  }
4353
4828
  const display = applicable ? formatRecordGridValue(column, value, locale) : "";
4354
- return /* @__PURE__ */ jsx13(
4829
+ return /* @__PURE__ */ jsx14(
4355
4830
  "td",
4356
4831
  {
4357
4832
  role: "gridcell",
@@ -4369,9 +4844,9 @@ function RecordGrid({
4369
4844
  className: `px-3 py-2 outline-none focus:ring-2 focus:ring-inset focus:ring-primary/50 ${alignmentClass(
4370
4845
  column
4371
4846
  )} ${editable ? "cursor-text" : ""}`,
4372
- children: /* @__PURE__ */ jsxs11("span", { className: "inline-flex max-w-full items-center gap-1.5", children: [
4373
- /* @__PURE__ */ jsx13("span", { className: display === "" ? "text-muted-foreground" : "truncate text-foreground", children: display === "" ? applicable ? "\u2014" : "n/a" : display }),
4374
- source && /* @__PURE__ */ jsx13(
4847
+ children: /* @__PURE__ */ jsxs12("span", { className: "inline-flex max-w-full items-center gap-1.5", children: [
4848
+ /* @__PURE__ */ jsx14("span", { className: display === "" ? "text-muted-foreground" : "truncate text-foreground", children: display === "" ? applicable ? "\u2014" : "n/a" : display }),
4849
+ source && /* @__PURE__ */ jsx14(
4375
4850
  SourceMarker,
4376
4851
  {
4377
4852
  panelId: `${fieldPrefix}-source-${row.id}-${column.id}`,
@@ -4387,8 +4862,8 @@ function RecordGrid({
4387
4862
  column.id
4388
4863
  );
4389
4864
  }),
4390
- onDelete && /* @__PURE__ */ jsx13("td", { role: "gridcell", className: "px-3 py-2 text-right", children: row.readOnly === true ? null : confirmDelete === row.id ? /* @__PURE__ */ jsxs11("span", { className: "inline-flex items-center gap-1.5", children: [
4391
- /* @__PURE__ */ jsx13(
4865
+ onDelete && /* @__PURE__ */ jsx14("td", { role: "gridcell", className: "px-3 py-2 text-right", children: row.readOnly === true ? null : confirmDelete === row.id ? /* @__PURE__ */ jsxs12("span", { className: "inline-flex items-center gap-1.5", children: [
4866
+ /* @__PURE__ */ jsx14(
4392
4867
  "button",
4393
4868
  {
4394
4869
  type: "button",
@@ -4398,7 +4873,7 @@ function RecordGrid({
4398
4873
  children: "Delete"
4399
4874
  }
4400
4875
  ),
4401
- /* @__PURE__ */ jsx13(
4876
+ /* @__PURE__ */ jsx14(
4402
4877
  "button",
4403
4878
  {
4404
4879
  type: "button",
@@ -4408,14 +4883,14 @@ function RecordGrid({
4408
4883
  children: "Cancel"
4409
4884
  }
4410
4885
  )
4411
- ] }) : /* @__PURE__ */ jsx13(
4886
+ ] }) : /* @__PURE__ */ jsx14(
4412
4887
  "button",
4413
4888
  {
4414
4889
  type: "button",
4415
4890
  "aria-label": `Delete ${rowLabel}`,
4416
4891
  onClick: () => setConfirmDelete(row.id),
4417
4892
  className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-destructive/10 hover:text-destructive",
4418
- children: /* @__PURE__ */ jsxs11(
4893
+ children: /* @__PURE__ */ jsxs12(
4419
4894
  "svg",
4420
4895
  {
4421
4896
  viewBox: "0 0 24 24",
@@ -4427,19 +4902,19 @@ function RecordGrid({
4427
4902
  strokeLinejoin: "round",
4428
4903
  "aria-hidden": true,
4429
4904
  children: [
4430
- /* @__PURE__ */ jsx13("polyline", { points: "3 6 5 6 21 6" }),
4431
- /* @__PURE__ */ jsx13("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
4905
+ /* @__PURE__ */ jsx14("polyline", { points: "3 6 5 6 21 6" }),
4906
+ /* @__PURE__ */ jsx14("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
4432
4907
  ]
4433
4908
  }
4434
4909
  )
4435
4910
  }
4436
4911
  ) })
4437
4912
  ] }),
4438
- rowError !== void 0 && /* @__PURE__ */ jsx13("tr", { role: "row", className: "border-b border-border/50", children: /* @__PURE__ */ jsx13("td", { role: "gridcell", colSpan: columnSpan, className: "px-3 pb-2", children: /* @__PURE__ */ jsx13("p", { role: "alert", className: "rounded-md bg-destructive/10 px-2.5 py-1.5 text-xs text-destructive", children: rowError }) }) })
4913
+ rowError !== void 0 && /* @__PURE__ */ jsx14("tr", { role: "row", className: "border-b border-border/50", children: /* @__PURE__ */ jsx14("td", { role: "gridcell", colSpan: columnSpan, className: "px-3 pb-2", children: /* @__PURE__ */ jsx14("p", { role: "alert", className: "rounded-md bg-destructive/10 px-2.5 py-1.5 text-xs text-destructive", children: rowError }) }) })
4439
4914
  ] }, row.id);
4440
4915
  }) }),
4441
- hasFooter && /* @__PURE__ */ jsx13("tfoot", { children: /* @__PURE__ */ jsxs11("tr", { role: "row", className: "border-t-2 border-border", children: [
4442
- columns.map((column) => /* @__PURE__ */ jsx13(
4916
+ hasFooter && /* @__PURE__ */ jsx14("tfoot", { children: /* @__PURE__ */ jsxs12("tr", { role: "row", className: "border-t-2 border-border", children: [
4917
+ columns.map((column) => /* @__PURE__ */ jsx14(
4443
4918
  "td",
4444
4919
  {
4445
4920
  role: "gridcell",
@@ -4448,19 +4923,19 @@ function RecordGrid({
4448
4923
  },
4449
4924
  column.id
4450
4925
  )),
4451
- onDelete && /* @__PURE__ */ jsx13("td", { role: "gridcell" })
4926
+ onDelete && /* @__PURE__ */ jsx14("td", { role: "gridcell" })
4452
4927
  ] }) })
4453
4928
  ]
4454
4929
  }
4455
4930
  ) }),
4456
- onCreate && (addForm ?? /* @__PURE__ */ jsxs11(
4931
+ onCreate && (addForm ?? /* @__PURE__ */ jsxs12(
4457
4932
  "button",
4458
4933
  {
4459
4934
  type: "button",
4460
4935
  onClick: openAdd,
4461
4936
  className: "inline-flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-sm font-medium text-foreground transition hover:bg-accent/30",
4462
4937
  children: [
4463
- /* @__PURE__ */ jsxs11(
4938
+ /* @__PURE__ */ jsxs12(
4464
4939
  "svg",
4465
4940
  {
4466
4941
  viewBox: "0 0 24 24",
@@ -4472,8 +4947,8 @@ function RecordGrid({
4472
4947
  strokeLinejoin: "round",
4473
4948
  "aria-hidden": true,
4474
4949
  children: [
4475
- /* @__PURE__ */ jsx13("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
4476
- /* @__PURE__ */ jsx13("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
4950
+ /* @__PURE__ */ jsx14("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
4951
+ /* @__PURE__ */ jsx14("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
4477
4952
  ]
4478
4953
  }
4479
4954
  ),
@@ -4492,7 +4967,7 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
4492
4967
  className: INPUT_CLASS
4493
4968
  };
4494
4969
  if (column.kind === "select") {
4495
- return /* @__PURE__ */ jsxs11(
4970
+ return /* @__PURE__ */ jsxs12(
4496
4971
  "select",
4497
4972
  {
4498
4973
  ...shared,
@@ -4509,8 +4984,8 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
4509
4984
  },
4510
4985
  onBlur: () => onCommit(text),
4511
4986
  children: [
4512
- /* @__PURE__ */ jsx13("option", { value: "", children: "\u2014" }),
4513
- column.options.map((option) => /* @__PURE__ */ jsx13("option", { value: option.value, children: option.label }, option.value))
4987
+ /* @__PURE__ */ jsx14("option", { value: "", children: "\u2014" }),
4988
+ column.options.map((option) => /* @__PURE__ */ jsx14("option", { value: option.value, children: option.label }, option.value))
4514
4989
  ]
4515
4990
  }
4516
4991
  );
@@ -4528,7 +5003,7 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
4528
5003
  }
4529
5004
  };
4530
5005
  if (column.kind === "text" && column.multiline === true) {
4531
- return /* @__PURE__ */ jsx13(
5006
+ return /* @__PURE__ */ jsx14(
4532
5007
  "textarea",
4533
5008
  {
4534
5009
  ...shared,
@@ -4540,7 +5015,7 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
4540
5015
  }
4541
5016
  );
4542
5017
  }
4543
- return /* @__PURE__ */ jsx13(
5018
+ return /* @__PURE__ */ jsx14(
4544
5019
  "input",
4545
5020
  {
4546
5021
  ...shared,
@@ -4555,8 +5030,8 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
4555
5030
  }
4556
5031
  function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle }) {
4557
5032
  const basis = source.basis ?? "source";
4558
- return /* @__PURE__ */ jsxs11("span", { className: "relative inline-flex", children: [
4559
- /* @__PURE__ */ jsx13(
5033
+ return /* @__PURE__ */ jsxs12("span", { className: "relative inline-flex", children: [
5034
+ /* @__PURE__ */ jsx14(
4560
5035
  "button",
4561
5036
  {
4562
5037
  type: "button",
@@ -4568,8 +5043,8 @@ function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle
4568
5043
  event.stopPropagation();
4569
5044
  onToggle();
4570
5045
  },
4571
- className: `inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full border ${BASIS_TONES[basis]}`,
4572
- children: /* @__PURE__ */ jsx13(
5046
+ className: `inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full border ${BASIS_TONES2[basis]}`,
5047
+ children: /* @__PURE__ */ jsx14(
4573
5048
  "svg",
4574
5049
  {
4575
5050
  viewBox: "0 0 24 24",
@@ -4579,29 +5054,29 @@ function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle
4579
5054
  strokeWidth: "2.5",
4580
5055
  strokeLinecap: "round",
4581
5056
  "aria-hidden": true,
4582
- children: /* @__PURE__ */ jsx13("path", { d: "M9 8h6M9 12h6M9 16h3" })
5057
+ children: /* @__PURE__ */ jsx14("path", { d: "M9 8h6M9 12h6M9 16h3" })
4583
5058
  }
4584
5059
  )
4585
5060
  }
4586
5061
  ),
4587
- open && /* @__PURE__ */ jsxs11(
5062
+ open && /* @__PURE__ */ jsxs12(
4588
5063
  "span",
4589
5064
  {
4590
5065
  id: panelId,
4591
5066
  role: "note",
4592
5067
  className: "absolute left-0 top-5 z-10 w-64 rounded-lg border border-border bg-card p-3 text-left shadow-lg",
4593
5068
  children: [
4594
- source.quote && /* @__PURE__ */ jsxs11("span", { className: "block border-l-2 border-primary/50 pl-2 text-xs italic leading-snug text-foreground", children: [
5069
+ source.quote && /* @__PURE__ */ jsxs12("span", { className: "block border-l-2 border-primary/50 pl-2 text-xs italic leading-snug text-foreground", children: [
4595
5070
  "\u201C",
4596
5071
  source.quote,
4597
5072
  "\u201D"
4598
5073
  ] }),
4599
- /* @__PURE__ */ jsxs11("span", { className: "mt-2 block text-[11px] text-muted-foreground", children: [
5074
+ /* @__PURE__ */ jsxs12("span", { className: "mt-2 block text-[11px] text-muted-foreground", children: [
4600
5075
  source.label ?? "Source",
4601
5076
  source.locator ? ` \xB7 ${source.locator}` : "",
4602
5077
  ` \xB7 ${BASIS_TITLES[basis]}`
4603
5078
  ] }),
4604
- source.href && /* @__PURE__ */ jsx13(
5079
+ source.href && /* @__PURE__ */ jsx14(
4605
5080
  "a",
4606
5081
  {
4607
5082
  href: source.href,
@@ -4630,7 +5105,7 @@ function AddRecordForm({
4630
5105
  onCancel
4631
5106
  }) {
4632
5107
  const groups = useMemo7(() => groupColumns(columns), [columns]);
4633
- return /* @__PURE__ */ jsxs11(
5108
+ return /* @__PURE__ */ jsxs12(
4634
5109
  "form",
4635
5110
  {
4636
5111
  noValidate: true,
@@ -4641,31 +5116,31 @@ function AddRecordForm({
4641
5116
  },
4642
5117
  className: "space-y-4 rounded-xl border border-border bg-card p-4",
4643
5118
  children: [
4644
- /* @__PURE__ */ jsx13("h3", { className: "text-sm font-semibold text-foreground", children: label }),
4645
- formError !== null && /* @__PURE__ */ jsx13("p", { role: "alert", className: "rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive", children: formError }),
5119
+ /* @__PURE__ */ jsx14("h3", { className: "text-sm font-semibold text-foreground", children: label }),
5120
+ formError !== null && /* @__PURE__ */ jsx14("p", { role: "alert", className: "rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive", children: formError }),
4646
5121
  groups.map((group) => {
4647
5122
  const fields = group.columns.filter((column) => isRecordGridCellApplicable(column, draft));
4648
5123
  if (fields.length === 0) return null;
4649
- return /* @__PURE__ */ jsxs11(
5124
+ return /* @__PURE__ */ jsxs12(
4650
5125
  "fieldset",
4651
5126
  {
4652
5127
  className: group.label === null ? "min-w-0" : "min-w-0 rounded-lg border border-border/70 p-3",
4653
5128
  children: [
4654
- group.label !== null && /* @__PURE__ */ jsx13("legend", { className: "px-1 text-xs font-medium text-muted-foreground", children: group.label }),
4655
- /* @__PURE__ */ jsx13("div", { className: "grid gap-3 sm:grid-cols-2", children: fields.map((column) => {
5129
+ group.label !== null && /* @__PURE__ */ jsx14("legend", { className: "px-1 text-xs font-medium text-muted-foreground", children: group.label }),
5130
+ /* @__PURE__ */ jsx14("div", { className: "grid gap-3 sm:grid-cols-2", children: fields.map((column) => {
4656
5131
  const fieldId = `${fieldPrefix}-${column.id}`;
4657
5132
  const errorId = `${fieldId}-error`;
4658
5133
  const message = errors[column.id];
4659
- return /* @__PURE__ */ jsxs11(
5134
+ return /* @__PURE__ */ jsxs12(
4660
5135
  "div",
4661
5136
  {
4662
5137
  className: column.kind === "text" && column.multiline === true ? "sm:col-span-2" : "",
4663
5138
  children: [
4664
- /* @__PURE__ */ jsxs11("label", { htmlFor: fieldId, className: "mb-1 block text-xs font-medium text-muted-foreground", children: [
5139
+ /* @__PURE__ */ jsxs12("label", { htmlFor: fieldId, className: "mb-1 block text-xs font-medium text-muted-foreground", children: [
4665
5140
  column.header,
4666
- column.required === true && /* @__PURE__ */ jsx13("span", { className: "ml-0.5 text-destructive", children: "*" })
5141
+ column.required === true && /* @__PURE__ */ jsx14("span", { className: "ml-0.5 text-destructive", children: "*" })
4667
5142
  ] }),
4668
- /* @__PURE__ */ jsx13(
5143
+ /* @__PURE__ */ jsx14(
4669
5144
  DraftField,
4670
5145
  {
4671
5146
  column,
@@ -4676,8 +5151,8 @@ function AddRecordForm({
4676
5151
  onValue: (next) => setDraft({ ...draft, [column.id]: next })
4677
5152
  }
4678
5153
  ),
4679
- column.hint && /* @__PURE__ */ jsx13("p", { className: "mt-1 text-[11px] text-muted-foreground", children: column.hint }),
4680
- message !== void 0 && /* @__PURE__ */ jsx13("p", { id: errorId, role: "alert", className: "mt-1 text-[11px] text-destructive", children: message })
5154
+ column.hint && /* @__PURE__ */ jsx14("p", { className: "mt-1 text-[11px] text-muted-foreground", children: column.hint }),
5155
+ message !== void 0 && /* @__PURE__ */ jsx14("p", { id: errorId, role: "alert", className: "mt-1 text-[11px] text-destructive", children: message })
4681
5156
  ]
4682
5157
  },
4683
5158
  column.id
@@ -4688,8 +5163,8 @@ function AddRecordForm({
4688
5163
  group.label ?? "_"
4689
5164
  );
4690
5165
  }),
4691
- /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
4692
- /* @__PURE__ */ jsx13(
5166
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
5167
+ /* @__PURE__ */ jsx14(
4693
5168
  "button",
4694
5169
  {
4695
5170
  type: "submit",
@@ -4698,7 +5173,7 @@ function AddRecordForm({
4698
5173
  children: busy ? "Saving\u2026" : "Save"
4699
5174
  }
4700
5175
  ),
4701
- /* @__PURE__ */ jsx13(
5176
+ /* @__PURE__ */ jsx14(
4702
5177
  "button",
4703
5178
  {
4704
5179
  type: "button",
@@ -4719,7 +5194,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
4719
5194
  "aria-describedby": describedBy
4720
5195
  };
4721
5196
  if (column.kind === "boolean") {
4722
- return /* @__PURE__ */ jsx13(
5197
+ return /* @__PURE__ */ jsx14(
4723
5198
  "input",
4724
5199
  {
4725
5200
  ...shared,
@@ -4731,7 +5206,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
4731
5206
  );
4732
5207
  }
4733
5208
  if (column.kind === "select") {
4734
- return /* @__PURE__ */ jsxs11(
5209
+ return /* @__PURE__ */ jsxs12(
4735
5210
  "select",
4736
5211
  {
4737
5212
  ...shared,
@@ -4739,14 +5214,14 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
4739
5214
  value: typeof value === "string" ? value : "",
4740
5215
  onChange: (event) => onValue(event.target.value === "" ? null : event.target.value),
4741
5216
  children: [
4742
- /* @__PURE__ */ jsx13("option", { value: "", children: "\u2014" }),
4743
- column.options.map((option) => /* @__PURE__ */ jsx13("option", { value: option.value, children: option.label }, option.value))
5217
+ /* @__PURE__ */ jsx14("option", { value: "", children: "\u2014" }),
5218
+ column.options.map((option) => /* @__PURE__ */ jsx14("option", { value: option.value, children: option.label }, option.value))
4744
5219
  ]
4745
5220
  }
4746
5221
  );
4747
5222
  }
4748
5223
  if (column.kind === "text" && column.multiline === true) {
4749
- return /* @__PURE__ */ jsx13(
5224
+ return /* @__PURE__ */ jsx14(
4750
5225
  "textarea",
4751
5226
  {
4752
5227
  ...shared,
@@ -4758,7 +5233,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
4758
5233
  );
4759
5234
  }
4760
5235
  if (column.kind === "number" || column.kind === "currency") {
4761
- return /* @__PURE__ */ jsx13(
5236
+ return /* @__PURE__ */ jsx14(
4762
5237
  "input",
4763
5238
  {
4764
5239
  ...shared,
@@ -4778,7 +5253,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
4778
5253
  }
4779
5254
  );
4780
5255
  }
4781
- return /* @__PURE__ */ jsx13(
5256
+ return /* @__PURE__ */ jsx14(
4782
5257
  "input",
4783
5258
  {
4784
5259
  ...shared,
@@ -4791,8 +5266,8 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
4791
5266
  }
4792
5267
 
4793
5268
  // src/web-react/agent-session-controls.tsx
4794
- import { useMemo as useMemo8, useState as useState14 } from "react";
4795
- import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
5269
+ import { useMemo as useMemo8, useState as useState15 } from "react";
5270
+ import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
4796
5271
  var HARNESS_LABELS = {
4797
5272
  opencode: "OpenCode (any model)",
4798
5273
  "claude-code": "Claude Code (Anthropic)",
@@ -4812,12 +5287,12 @@ function harnessLabel(h) {
4812
5287
  return HARNESS_LABELS[h] ?? h;
4813
5288
  }
4814
5289
  function ChevronDown2({ className }) {
4815
- return /* @__PURE__ */ jsx14("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx14("path", { d: "m6 9 6 6 6-6" }) });
5290
+ return /* @__PURE__ */ jsx15("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx15("path", { d: "m6 9 6 6 6-6" }) });
4816
5291
  }
4817
5292
  function GearGlyph({ className }) {
4818
- return /* @__PURE__ */ jsxs12("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
4819
- /* @__PURE__ */ jsx14("circle", { cx: "12", cy: "12", r: "3" }),
4820
- /* @__PURE__ */ jsx14("path", { d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1Z" })
5293
+ return /* @__PURE__ */ jsxs13("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
5294
+ /* @__PURE__ */ jsx15("circle", { cx: "12", cy: "12", r: "3" }),
5295
+ /* @__PURE__ */ jsx15("path", { d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1Z" })
4821
5296
  ] });
4822
5297
  }
4823
5298
  var FOCUS_RING = "focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background";
@@ -4826,11 +5301,11 @@ function HarnessPicker({
4826
5301
  onChange,
4827
5302
  available
4828
5303
  }) {
4829
- const [open, setOpen] = useState14(false);
5304
+ const [open, setOpen] = useState15(false);
4830
5305
  const { containerRef, triggerProps } = usePopover(open, setOpen);
4831
5306
  const options = available ?? Object.keys(HARNESS_LABELS);
4832
- return /* @__PURE__ */ jsxs12("div", { ref: containerRef, className: "relative inline-flex", children: [
4833
- /* @__PURE__ */ jsxs12(
5307
+ return /* @__PURE__ */ jsxs13("div", { ref: containerRef, className: "relative inline-flex", children: [
5308
+ /* @__PURE__ */ jsxs13(
4834
5309
  "button",
4835
5310
  {
4836
5311
  type: "button",
@@ -4839,12 +5314,12 @@ function HarnessPicker({
4839
5314
  title: "Agent backend",
4840
5315
  className: `inline-flex w-full items-center justify-between gap-1.5 rounded-lg border border-border bg-card px-3 py-1.5 text-sm font-medium text-foreground transition hover:bg-accent/30 ${FOCUS_RING}`,
4841
5316
  children: [
4842
- /* @__PURE__ */ jsx14("span", { className: "truncate", children: harnessLabel(value) }),
4843
- /* @__PURE__ */ jsx14(ChevronDown2, { className: "h-3.5 w-3.5 text-muted-foreground" })
5317
+ /* @__PURE__ */ jsx15("span", { className: "truncate", children: harnessLabel(value) }),
5318
+ /* @__PURE__ */ jsx15(ChevronDown2, { className: "h-3.5 w-3.5 text-muted-foreground" })
4844
5319
  ]
4845
5320
  }
4846
5321
  ),
4847
- open && /* @__PURE__ */ jsx14("div", { role: "menu", className: "absolute bottom-full left-0 z-50 mb-2 max-h-64 w-full min-w-[220px] overflow-y-auto rounded-xl border border-border bg-card p-1 shadow-lg", children: options.map((h) => /* @__PURE__ */ jsx14(
5322
+ open && /* @__PURE__ */ jsx15("div", { role: "menu", className: "absolute bottom-full left-0 z-50 mb-2 max-h-64 w-full min-w-[220px] overflow-y-auto rounded-xl border border-border bg-card p-1 shadow-lg", children: options.map((h) => /* @__PURE__ */ jsx15(
4848
5323
  "button",
4849
5324
  {
4850
5325
  type: "button",
@@ -4891,11 +5366,11 @@ function AgentSessionControls(props) {
4891
5366
  className
4892
5367
  } = props;
4893
5368
  const { onModel, onHarness } = useCoherentHandlers(props);
4894
- const [open, setOpen] = useState14(false);
5369
+ const [open, setOpen] = useState15(false);
4895
5370
  const { containerRef: popoverRef, triggerProps } = usePopover(open, setOpen);
4896
5371
  const selectedModel = models.find((m) => m.id === model);
4897
5372
  const showEffort = selectedModel?.supportsReasoning ?? true;
4898
- const modelPicker = /* @__PURE__ */ jsx14(
5373
+ const modelPicker = /* @__PURE__ */ jsx15(
4899
5374
  ModelPicker,
4900
5375
  {
4901
5376
  value: model,
@@ -4906,17 +5381,17 @@ function AgentSessionControls(props) {
4906
5381
  }
4907
5382
  );
4908
5383
  if (layout === "inline") {
4909
- return /* @__PURE__ */ jsxs12("div", { className: `flex items-center gap-1.5 ${className ?? ""}`, children: [
5384
+ return /* @__PURE__ */ jsxs13("div", { className: `flex items-center gap-1.5 ${className ?? ""}`, children: [
4910
5385
  modelPicker,
4911
- showHarness && /* @__PURE__ */ jsx14(HarnessPicker, { value: harness, onChange: onHarness, available: availableHarnesses }),
4912
- showEffort && /* @__PURE__ */ jsx14(EffortPicker, { value: effort, onChange: onEffortChange })
5386
+ showHarness && /* @__PURE__ */ jsx15(HarnessPicker, { value: harness, onChange: onHarness, available: availableHarnesses }),
5387
+ showEffort && /* @__PURE__ */ jsx15(EffortPicker, { value: effort, onChange: onEffortChange })
4913
5388
  ] });
4914
5389
  }
4915
5390
  const hasAdvanced = showHarness || showEffort;
4916
- return /* @__PURE__ */ jsxs12("div", { className: `flex items-center gap-1.5 ${className ?? ""}`, children: [
5391
+ return /* @__PURE__ */ jsxs13("div", { className: `flex items-center gap-1.5 ${className ?? ""}`, children: [
4917
5392
  modelPicker,
4918
- hasAdvanced && /* @__PURE__ */ jsxs12("div", { ref: popoverRef, className: "relative inline-flex", children: [
4919
- /* @__PURE__ */ jsx14(
5393
+ hasAdvanced && /* @__PURE__ */ jsxs13("div", { ref: popoverRef, className: "relative inline-flex", children: [
5394
+ /* @__PURE__ */ jsx15(
4920
5395
  "button",
4921
5396
  {
4922
5397
  type: "button",
@@ -4925,19 +5400,19 @@ function AgentSessionControls(props) {
4925
5400
  title: "Model settings \u2014 pick the agent backend and how hard it thinks",
4926
5401
  className: `flex h-8 w-8 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted hover:text-foreground data-[state=open]:bg-muted ${FOCUS_RING}`,
4927
5402
  "data-state": open ? "open" : "closed",
4928
- children: /* @__PURE__ */ jsx14(GearGlyph, { className: "h-4 w-4" })
5403
+ children: /* @__PURE__ */ jsx15(GearGlyph, { className: "h-4 w-4" })
4929
5404
  }
4930
5405
  ),
4931
- open && /* @__PURE__ */ jsxs12("div", { className: "absolute bottom-full left-0 z-50 mb-2 w-72 space-y-3 rounded-xl border border-border bg-card p-3 shadow-lg", children: [
4932
- showHarness && /* @__PURE__ */ jsxs12("div", { className: "space-y-1.5", children: [
4933
- /* @__PURE__ */ jsx14("p", { className: "text-xs font-medium text-foreground", children: "Agent backend" }),
4934
- /* @__PURE__ */ jsx14(HarnessPicker, { value: harness, onChange: onHarness, available: availableHarnesses }),
4935
- /* @__PURE__ */ jsx14("p", { className: "text-[11px] leading-snug text-muted-foreground", children: "The engine that runs the agent. Switching it keeps your model choice compatible." })
5406
+ open && /* @__PURE__ */ jsxs13("div", { className: "absolute bottom-full left-0 z-50 mb-2 w-72 space-y-3 rounded-xl border border-border bg-card p-3 shadow-lg", children: [
5407
+ showHarness && /* @__PURE__ */ jsxs13("div", { className: "space-y-1.5", children: [
5408
+ /* @__PURE__ */ jsx15("p", { className: "text-xs font-medium text-foreground", children: "Agent backend" }),
5409
+ /* @__PURE__ */ jsx15(HarnessPicker, { value: harness, onChange: onHarness, available: availableHarnesses }),
5410
+ /* @__PURE__ */ jsx15("p", { className: "text-[11px] leading-snug text-muted-foreground", children: "The engine that runs the agent. Switching it keeps your model choice compatible." })
4936
5411
  ] }),
4937
- showEffort && /* @__PURE__ */ jsxs12("div", { className: "space-y-1.5", children: [
4938
- /* @__PURE__ */ jsx14("p", { className: "text-xs font-medium text-foreground", children: "Thinking" }),
4939
- /* @__PURE__ */ jsx14(EffortPicker, { value: effort, onChange: onEffortChange, label: "" }),
4940
- /* @__PURE__ */ jsx14("p", { className: "text-[11px] leading-snug text-muted-foreground", children: "How hard the agent thinks before answering. Higher is slower but more thorough." })
5412
+ showEffort && /* @__PURE__ */ jsxs13("div", { className: "space-y-1.5", children: [
5413
+ /* @__PURE__ */ jsx15("p", { className: "text-xs font-medium text-foreground", children: "Thinking" }),
5414
+ /* @__PURE__ */ jsx15(EffortPicker, { value: effort, onChange: onEffortChange, label: "" }),
5415
+ /* @__PURE__ */ jsx15("p", { className: "text-[11px] leading-snug text-muted-foreground", children: "How hard the agent thinks before answering. Higher is slower but more thorough." })
4941
5416
  ] })
4942
5417
  ] })
4943
5418
  ] })
@@ -4945,7 +5420,7 @@ function AgentSessionControls(props) {
4945
5420
  }
4946
5421
 
4947
5422
  // src/web-react/index.tsx
4948
- import { Fragment as Fragment8, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
5423
+ import { Fragment as Fragment8, jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
4949
5424
  function formatModelCost(msg, models) {
4950
5425
  if (msg.promptTokens == null && msg.completionTokens == null) return null;
4951
5426
  const pricing = models.find((m) => m.id === msg.modelUsed)?.pricing;
@@ -4959,41 +5434,41 @@ function formatTokensPerSecond(msg) {
4959
5434
  return `${Math.round(msg.completionTokens / (msg.durationMs / 1e3))} tok/s`;
4960
5435
  }
4961
5436
  function RunDrillIn({ run, onClose }) {
4962
- return /* @__PURE__ */ jsxs13("div", { className: "fixed inset-y-0 right-0 z-50 flex w-[480px] max-w-full flex-col border-l border-border bg-card shadow-xl", children: [
4963
- /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2 border-b border-border px-4 py-3", children: [
4964
- /* @__PURE__ */ jsx15(
5437
+ return /* @__PURE__ */ jsxs14("div", { className: "fixed inset-y-0 right-0 z-50 flex w-[480px] max-w-full flex-col border-l border-border bg-card shadow-xl", children: [
5438
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2 border-b border-border px-4 py-3", children: [
5439
+ /* @__PURE__ */ jsx16(
4965
5440
  "span",
4966
5441
  {
4967
5442
  className: `h-2 w-2 shrink-0 rounded-full ${run.status === "running" ? "bg-warning" : run.status === "error" ? "bg-destructive" : "bg-success"}`
4968
5443
  }
4969
5444
  ),
4970
- /* @__PURE__ */ jsxs13("div", { className: "min-w-0 flex-1", children: [
4971
- /* @__PURE__ */ jsx15("p", { className: "truncate text-sm font-semibold", children: run.title }),
4972
- /* @__PURE__ */ jsx15("p", { className: "truncate font-mono text-[11px] text-muted-foreground", children: run.toolName })
5445
+ /* @__PURE__ */ jsxs14("div", { className: "min-w-0 flex-1", children: [
5446
+ /* @__PURE__ */ jsx16("p", { className: "truncate text-sm font-semibold", children: run.title }),
5447
+ /* @__PURE__ */ jsx16("p", { className: "truncate font-mono text-[11px] text-muted-foreground", children: run.toolName })
4973
5448
  ] }),
4974
- /* @__PURE__ */ jsx15(
5449
+ /* @__PURE__ */ jsx16(
4975
5450
  "button",
4976
5451
  {
4977
5452
  type: "button",
4978
5453
  onClick: onClose,
4979
5454
  "aria-label": "Close",
4980
5455
  className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-accent/30 hover:text-foreground",
4981
- children: /* @__PURE__ */ jsx15("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx15("path", { d: "M18 6 6 18M6 6l12 12" }) })
5456
+ children: /* @__PURE__ */ jsx16("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx16("path", { d: "M18 6 6 18M6 6l12 12" }) })
4982
5457
  }
4983
5458
  )
4984
5459
  ] }),
4985
- /* @__PURE__ */ jsxs13("div", { className: "flex-1 space-y-3 overflow-y-auto p-4", children: [
4986
- run.steps.length === 0 && /* @__PURE__ */ jsx15("p", { className: "text-sm text-muted-foreground", children: "No steps recorded yet." }),
4987
- run.steps.map((step, i) => /* @__PURE__ */ jsxs13("div", { className: "rounded-lg border border-border/60 bg-background", children: [
4988
- /* @__PURE__ */ jsxs13("div", { className: "flex items-baseline gap-2 border-b border-border/40 px-3 py-1.5", children: [
4989
- /* @__PURE__ */ jsx15("span", { className: `font-mono text-[11px] ${step.status === "error" ? "text-destructive" : "text-muted-foreground"}`, children: step.status === "error" ? "\u2717" : "$" }),
4990
- /* @__PURE__ */ jsx15("code", { className: "min-w-0 flex-1 truncate font-mono text-xs", children: step.label }),
4991
- /* @__PURE__ */ jsx15("span", { className: "shrink-0 text-[10px] text-muted-foreground", children: new Date(step.at).toLocaleTimeString() })
5460
+ /* @__PURE__ */ jsxs14("div", { className: "flex-1 space-y-3 overflow-y-auto p-4", children: [
5461
+ run.steps.length === 0 && /* @__PURE__ */ jsx16("p", { className: "text-sm text-muted-foreground", children: "No steps recorded yet." }),
5462
+ run.steps.map((step, i) => /* @__PURE__ */ jsxs14("div", { className: "rounded-lg border border-border/60 bg-background", children: [
5463
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-baseline gap-2 border-b border-border/40 px-3 py-1.5", children: [
5464
+ /* @__PURE__ */ jsx16("span", { className: `font-mono text-[11px] ${step.status === "error" ? "text-destructive" : "text-muted-foreground"}`, children: step.status === "error" ? "\u2717" : "$" }),
5465
+ /* @__PURE__ */ jsx16("code", { className: "min-w-0 flex-1 truncate font-mono text-xs", children: step.label }),
5466
+ /* @__PURE__ */ jsx16("span", { className: "shrink-0 text-[10px] text-muted-foreground", children: new Date(step.at).toLocaleTimeString() })
4992
5467
  ] }),
4993
- step.detail && /* @__PURE__ */ jsx15("pre", { className: "max-h-48 overflow-auto whitespace-pre-wrap px-3 py-2 font-mono text-[11px] leading-relaxed text-muted-foreground", children: step.detail })
5468
+ step.detail && /* @__PURE__ */ jsx16("pre", { className: "max-h-48 overflow-auto whitespace-pre-wrap px-3 py-2 font-mono text-[11px] leading-relaxed text-muted-foreground", children: step.detail })
4994
5469
  ] }, i))
4995
5470
  ] }),
4996
- /* @__PURE__ */ jsx15("p", { className: "border-t border-border px-4 py-2 text-[11px] text-muted-foreground", children: "Readonly drill-in. Follow up in the main chat." })
5471
+ /* @__PURE__ */ jsx16("p", { className: "border-t border-border px-4 py-2 text-[11px] text-muted-foreground", children: "Readonly drill-in. Follow up in the main chat." })
4997
5472
  ] });
4998
5473
  }
4999
5474
  function pendingApprovalOf(call) {
@@ -5007,20 +5482,20 @@ function ChatEmptyState({
5007
5482
  subline = "Describe the outcome you want. The agent works through it step by step, and pauses for your approval before anything irreversible.",
5008
5483
  doors
5009
5484
  }) {
5010
- return /* @__PURE__ */ jsxs13("div", { className: "mx-auto flex w-full max-w-2xl flex-col items-center px-6 py-12 text-center sm:py-20", children: [
5011
- /* @__PURE__ */ jsx15("span", { className: "mb-5 inline-flex h-14 w-14 items-center justify-center rounded-2xl bg-primary/10 ring-1 ring-primary/15", children: /* @__PURE__ */ jsx15(BrandMark, { size: 32, className: "shrink-0" }) }),
5012
- /* @__PURE__ */ jsx15("p", { className: "text-[11px] font-semibold uppercase tracking-[0.18em] text-muted-foreground", children: productName }),
5013
- /* @__PURE__ */ jsx15("h2", { className: "mt-1.5 text-balance text-2xl font-semibold leading-tight text-foreground sm:text-[28px]", children: headline }),
5014
- subline && /* @__PURE__ */ jsx15("p", { className: "mt-3 max-w-md text-[15px] leading-relaxed text-muted-foreground", children: subline }),
5015
- doors && doors.length > 0 && /* @__PURE__ */ jsx15("div", { className: "mt-7 grid w-full gap-2.5 sm:grid-cols-3", children: doors.slice(0, 3).map((door, i) => /* @__PURE__ */ jsxs13(
5485
+ return /* @__PURE__ */ jsxs14("div", { className: "mx-auto flex w-full max-w-2xl flex-col items-center px-6 py-12 text-center sm:py-20", children: [
5486
+ /* @__PURE__ */ jsx16("span", { className: "mb-5 inline-flex h-14 w-14 items-center justify-center rounded-2xl bg-primary/10 ring-1 ring-primary/15", children: /* @__PURE__ */ jsx16(BrandMark, { size: 32, className: "shrink-0" }) }),
5487
+ /* @__PURE__ */ jsx16("p", { className: "text-[11px] font-semibold uppercase tracking-[0.18em] text-muted-foreground", children: productName }),
5488
+ /* @__PURE__ */ jsx16("h2", { className: "mt-1.5 text-balance text-2xl font-semibold leading-tight text-foreground sm:text-[28px]", children: headline }),
5489
+ subline && /* @__PURE__ */ jsx16("p", { className: "mt-3 max-w-md text-[15px] leading-relaxed text-muted-foreground", children: subline }),
5490
+ doors && doors.length > 0 && /* @__PURE__ */ jsx16("div", { className: "mt-7 grid w-full gap-2.5 sm:grid-cols-3", children: doors.slice(0, 3).map((door, i) => /* @__PURE__ */ jsxs14(
5016
5491
  "button",
5017
5492
  {
5018
5493
  type: "button",
5019
5494
  onClick: door.onSelect,
5020
5495
  className: "group flex min-h-[44px] flex-col items-start rounded-xl border border-border bg-card px-4 py-3 text-left transition hover:border-primary/40 hover:bg-accent/30 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
5021
5496
  children: [
5022
- /* @__PURE__ */ jsx15("span", { className: "text-sm font-semibold text-foreground", children: door.label }),
5023
- door.description && /* @__PURE__ */ jsx15("span", { className: "mt-0.5 text-[12px] leading-snug text-muted-foreground", children: door.description })
5497
+ /* @__PURE__ */ jsx16("span", { className: "text-sm font-semibold text-foreground", children: door.label }),
5498
+ door.description && /* @__PURE__ */ jsx16("span", { className: "mt-0.5 text-[12px] leading-snug text-muted-foreground", children: door.description })
5024
5499
  ]
5025
5500
  },
5026
5501
  i
@@ -5029,26 +5504,26 @@ function ChatEmptyState({
5029
5504
  }
5030
5505
  function ToolGlyph({ name, className }) {
5031
5506
  if (name.startsWith("sandbox_")) {
5032
- return /* @__PURE__ */ jsxs13("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
5033
- /* @__PURE__ */ jsx15("polyline", { points: "4 17 10 11 4 5" }),
5034
- /* @__PURE__ */ jsx15("line", { x1: "12", y1: "19", x2: "20", y2: "19" })
5507
+ return /* @__PURE__ */ jsxs14("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
5508
+ /* @__PURE__ */ jsx16("polyline", { points: "4 17 10 11 4 5" }),
5509
+ /* @__PURE__ */ jsx16("line", { x1: "12", y1: "19", x2: "20", y2: "19" })
5035
5510
  ] });
5036
5511
  }
5037
5512
  if (name === "submit_proposal") {
5038
- return /* @__PURE__ */ jsxs13("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
5039
- /* @__PURE__ */ jsx15("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
5040
- /* @__PURE__ */ jsx15("path", { d: "M14 2v6h6M9 15l2 2 4-4" })
5513
+ return /* @__PURE__ */ jsxs14("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
5514
+ /* @__PURE__ */ jsx16("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
5515
+ /* @__PURE__ */ jsx16("path", { d: "M14 2v6h6M9 15l2 2 4-4" })
5041
5516
  ] });
5042
5517
  }
5043
5518
  if (name === "schedule_followup") {
5044
- return /* @__PURE__ */ jsxs13("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": true, children: [
5045
- /* @__PURE__ */ jsx15("circle", { cx: "12", cy: "12", r: "9" }),
5046
- /* @__PURE__ */ jsx15("path", { d: "M12 7v5l3 3" })
5519
+ return /* @__PURE__ */ jsxs14("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": true, children: [
5520
+ /* @__PURE__ */ jsx16("circle", { cx: "12", cy: "12", r: "9" }),
5521
+ /* @__PURE__ */ jsx16("path", { d: "M12 7v5l3 3" })
5047
5522
  ] });
5048
5523
  }
5049
- return /* @__PURE__ */ jsxs13("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
5050
- /* @__PURE__ */ jsx15("path", { d: "M12 3v3m0 12v3M3 12h3m12 0h3" }),
5051
- /* @__PURE__ */ jsx15("circle", { cx: "12", cy: "12", r: "4" })
5524
+ return /* @__PURE__ */ jsxs14("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
5525
+ /* @__PURE__ */ jsx16("path", { d: "M12 3v3m0 12v3M3 12h3m12 0h3" }),
5526
+ /* @__PURE__ */ jsx16("circle", { cx: "12", cy: "12", r: "4" })
5052
5527
  ] });
5053
5528
  }
5054
5529
  function toolOutcomeOf(call) {
@@ -5116,40 +5591,40 @@ function truncate(v, max = 240) {
5116
5591
  function KvRows({ data }) {
5117
5592
  const entries = Object.entries(data).filter(([, v]) => v !== void 0 && v !== null && v !== "");
5118
5593
  if (!entries.length) return null;
5119
- return /* @__PURE__ */ jsx15("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-1", children: entries.map(([k, v]) => /* @__PURE__ */ jsxs13("div", { className: "contents", children: [
5120
- /* @__PURE__ */ jsx15("dt", { className: "font-mono text-[11px] text-muted-foreground", children: k }),
5121
- /* @__PURE__ */ jsx15("dd", { className: "min-w-0 whitespace-pre-wrap break-words font-mono text-[11px] text-muted-foreground", children: truncate(v) })
5594
+ return /* @__PURE__ */ jsx16("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-1", children: entries.map(([k, v]) => /* @__PURE__ */ jsxs14("div", { className: "contents", children: [
5595
+ /* @__PURE__ */ jsx16("dt", { className: "font-mono text-[11px] text-muted-foreground", children: k }),
5596
+ /* @__PURE__ */ jsx16("dd", { className: "min-w-0 whitespace-pre-wrap break-words font-mono text-[11px] text-muted-foreground", children: truncate(v) })
5122
5597
  ] }, k)) });
5123
5598
  }
5124
5599
  function ShellDetail({ call }) {
5125
5600
  const outcome = toolOutcomeOf(call);
5126
5601
  const r = outcome?.result ?? {};
5127
- return /* @__PURE__ */ jsxs13("div", { className: "overflow-hidden rounded-md bg-zinc-900 font-mono text-[11px] leading-relaxed", children: [
5128
- /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2 px-3 pt-2 text-zinc-400", children: [
5129
- /* @__PURE__ */ jsx15("span", { className: "select-none text-zinc-500", children: "$" }),
5130
- /* @__PURE__ */ jsx15("span", { className: "min-w-0 flex-1 truncate text-zinc-200", children: String(call.args?.command ?? "") }),
5131
- r.exitCode != null && /* @__PURE__ */ jsxs13("span", { className: r.exitCode === 0 ? "text-success" : "text-destructive", children: [
5602
+ return /* @__PURE__ */ jsxs14("div", { className: "overflow-hidden rounded-md bg-zinc-900 font-mono text-[11px] leading-relaxed", children: [
5603
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2 px-3 pt-2 text-zinc-400", children: [
5604
+ /* @__PURE__ */ jsx16("span", { className: "select-none text-zinc-500", children: "$" }),
5605
+ /* @__PURE__ */ jsx16("span", { className: "min-w-0 flex-1 truncate text-zinc-200", children: String(call.args?.command ?? "") }),
5606
+ r.exitCode != null && /* @__PURE__ */ jsxs14("span", { className: r.exitCode === 0 ? "text-success" : "text-destructive", children: [
5132
5607
  "exit ",
5133
5608
  r.exitCode
5134
5609
  ] })
5135
5610
  ] }),
5136
- /* @__PURE__ */ jsx15("pre", { className: "max-h-56 overflow-auto whitespace-pre-wrap px-3 pb-2.5 pt-1.5 text-zinc-300", children: outcome?.ok === false ? outcome.message ?? "failed" : [r.stdout, r.stderr].filter(Boolean).join("\n") || "(no output)" })
5611
+ /* @__PURE__ */ jsx16("pre", { className: "max-h-56 overflow-auto whitespace-pre-wrap px-3 pb-2.5 pt-1.5 text-zinc-300", children: outcome?.ok === false ? outcome.message ?? "failed" : [r.stdout, r.stderr].filter(Boolean).join("\n") || "(no output)" })
5137
5612
  ] });
5138
5613
  }
5139
5614
  function DefaultToolDetail({ call }) {
5140
5615
  const result = call.result;
5141
5616
  const envelope = typeof result === "object" && result !== null ? result : null;
5142
- return /* @__PURE__ */ jsxs13("div", { className: "space-y-2", children: [
5143
- call.args && Object.keys(call.args).length > 0 && /* @__PURE__ */ jsxs13("div", { children: [
5144
- /* @__PURE__ */ jsx15("p", { className: "mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground", children: "Called with" }),
5145
- /* @__PURE__ */ jsx15(KvRows, { data: call.args })
5617
+ return /* @__PURE__ */ jsxs14("div", { className: "space-y-2", children: [
5618
+ call.args && Object.keys(call.args).length > 0 && /* @__PURE__ */ jsxs14("div", { children: [
5619
+ /* @__PURE__ */ jsx16("p", { className: "mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground", children: "Called with" }),
5620
+ /* @__PURE__ */ jsx16(KvRows, { data: call.args })
5146
5621
  ] }),
5147
- envelope ? /* @__PURE__ */ jsxs13("div", { children: [
5148
- /* @__PURE__ */ jsx15("p", { className: "mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground", children: envelope.ok === false ? "Failed" : "Result" }),
5149
- envelope.ok === false ? /* @__PURE__ */ jsx15("p", { className: "text-xs text-destructive", children: envelope.message ?? "Tool failed" }) : envelope.result && typeof envelope.result === "object" ? /* @__PURE__ */ jsx15(KvRows, { data: envelope.result }) : envelope.result != null ? /* @__PURE__ */ jsx15("p", { className: "font-mono text-[11px] text-muted-foreground", children: truncate(envelope.result) }) : null
5150
- ] }) : result != null ? /* @__PURE__ */ jsxs13("div", { children: [
5151
- /* @__PURE__ */ jsx15("p", { className: "mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground", children: "Result" }),
5152
- /* @__PURE__ */ jsx15("p", { className: "font-mono text-[11px] text-muted-foreground", children: truncate(result) })
5622
+ envelope ? /* @__PURE__ */ jsxs14("div", { children: [
5623
+ /* @__PURE__ */ jsx16("p", { className: "mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground", children: envelope.ok === false ? "Failed" : "Result" }),
5624
+ envelope.ok === false ? /* @__PURE__ */ jsx16("p", { className: "text-xs text-destructive", children: envelope.message ?? "Tool failed" }) : envelope.result && typeof envelope.result === "object" ? /* @__PURE__ */ jsx16(KvRows, { data: envelope.result }) : envelope.result != null ? /* @__PURE__ */ jsx16("p", { className: "font-mono text-[11px] text-muted-foreground", children: truncate(envelope.result) }) : null
5625
+ ] }) : result != null ? /* @__PURE__ */ jsxs14("div", { children: [
5626
+ /* @__PURE__ */ jsx16("p", { className: "mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground", children: "Result" }),
5627
+ /* @__PURE__ */ jsx16("p", { className: "font-mono text-[11px] text-muted-foreground", children: truncate(result) })
5153
5628
  ] }) : null
5154
5629
  ] });
5155
5630
  }
@@ -5160,23 +5635,23 @@ function ProposalCard({
5160
5635
  approval,
5161
5636
  renderers
5162
5637
  }) {
5163
- const [expanded, setExpanded] = useState15(false);
5638
+ const [expanded, setExpanded] = useState16(false);
5164
5639
  const { summary, meta } = proposalPreview(call);
5165
5640
  const custom = renderers?.[call.name]?.(call, message);
5166
5641
  const { pending: deciding, run: decide } = usePending();
5167
- return /* @__PURE__ */ jsxs13("div", { className: "w-full max-w-full rounded-xl border border-warning/50 bg-warning/[0.06] text-sm shadow-sm ring-1 ring-warning/10", children: [
5168
- /* @__PURE__ */ jsxs13("div", { className: "flex items-start gap-2.5 px-4 pt-3.5", children: [
5169
- /* @__PURE__ */ jsx15("span", { className: "mt-0.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-warning/15 text-warning", children: /* @__PURE__ */ jsx15(ToolGlyph, { name: call.name, className: "h-3.5 w-3.5" }) }),
5170
- /* @__PURE__ */ jsxs13("div", { className: "min-w-0 flex-1", children: [
5171
- /* @__PURE__ */ jsx15("p", { className: "text-[10px] font-semibold uppercase tracking-wider text-warning-foreground", children: "Needs your approval" }),
5172
- /* @__PURE__ */ jsx15("p", { className: "mt-0.5 text-[15px] font-semibold leading-snug text-foreground", children: friendlyToolTitle(call) }),
5173
- summary && /* @__PURE__ */ jsx15("p", { className: "mt-1 text-[13px] leading-relaxed text-muted-foreground", children: summary }),
5174
- meta.length > 0 && /* @__PURE__ */ jsx15("div", { className: "mt-1.5 flex flex-wrap items-center gap-1.5", children: meta.map((m, i) => /* @__PURE__ */ jsx15("span", { className: "rounded-full bg-muted/60 px-2 py-0.5 text-[11px] font-medium text-muted-foreground", children: m }, i)) })
5642
+ return /* @__PURE__ */ jsxs14("div", { className: "w-full max-w-full rounded-xl border border-warning/50 bg-warning/[0.06] text-sm shadow-sm ring-1 ring-warning/10", children: [
5643
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-start gap-2.5 px-4 pt-3.5", children: [
5644
+ /* @__PURE__ */ jsx16("span", { className: "mt-0.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-warning/15 text-warning", children: /* @__PURE__ */ jsx16(ToolGlyph, { name: call.name, className: "h-3.5 w-3.5" }) }),
5645
+ /* @__PURE__ */ jsxs14("div", { className: "min-w-0 flex-1", children: [
5646
+ /* @__PURE__ */ jsx16("p", { className: "text-[10px] font-semibold uppercase tracking-wider text-warning-foreground", children: "Needs your approval" }),
5647
+ /* @__PURE__ */ jsx16("p", { className: "mt-0.5 text-[15px] font-semibold leading-snug text-foreground", children: friendlyToolTitle(call) }),
5648
+ summary && /* @__PURE__ */ jsx16("p", { className: "mt-1 text-[13px] leading-relaxed text-muted-foreground", children: summary }),
5649
+ meta.length > 0 && /* @__PURE__ */ jsx16("div", { className: "mt-1.5 flex flex-wrap items-center gap-1.5", children: meta.map((m, i) => /* @__PURE__ */ jsx16("span", { className: "rounded-full bg-muted/60 px-2 py-0.5 text-[11px] font-medium text-muted-foreground", children: m }, i)) })
5175
5650
  ] })
5176
5651
  ] }),
5177
- /* @__PURE__ */ jsxs13("div", { className: "flex flex-wrap items-center gap-2 px-4 pb-3.5 pt-3", children: [
5178
- approval ? /* @__PURE__ */ jsxs13(Fragment8, { children: [
5179
- /* @__PURE__ */ jsx15(
5652
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center gap-2 px-4 pb-3.5 pt-3", children: [
5653
+ approval ? /* @__PURE__ */ jsxs14(Fragment8, { children: [
5654
+ /* @__PURE__ */ jsx16(
5180
5655
  "button",
5181
5656
  {
5182
5657
  type: "button",
@@ -5186,7 +5661,7 @@ function ProposalCard({
5186
5661
  children: "Approve & run"
5187
5662
  }
5188
5663
  ),
5189
- /* @__PURE__ */ jsx15(
5664
+ /* @__PURE__ */ jsx16(
5190
5665
  "button",
5191
5666
  {
5192
5667
  type: "button",
@@ -5196,8 +5671,8 @@ function ProposalCard({
5196
5671
  children: "Reject"
5197
5672
  }
5198
5673
  )
5199
- ] }) : /* @__PURE__ */ jsx15("span", { className: "text-[12px] font-medium text-muted-foreground", children: "Awaiting approval\u2026" }),
5200
- /* @__PURE__ */ jsxs13(
5674
+ ] }) : /* @__PURE__ */ jsx16("span", { className: "text-[12px] font-medium text-muted-foreground", children: "Awaiting approval\u2026" }),
5675
+ /* @__PURE__ */ jsxs14(
5201
5676
  "button",
5202
5677
  {
5203
5678
  type: "button",
@@ -5206,23 +5681,23 @@ function ProposalCard({
5206
5681
  className: "ml-auto inline-flex items-center gap-1 rounded text-[12px] font-medium text-muted-foreground transition hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
5207
5682
  children: [
5208
5683
  expanded ? "Hide details" : "View details",
5209
- /* @__PURE__ */ jsx15(ChevronDown, { className: `h-3 w-3 transition-transform ${expanded ? "rotate-180" : ""}` })
5684
+ /* @__PURE__ */ jsx16(ChevronDown, { className: `h-3 w-3 transition-transform ${expanded ? "rotate-180" : ""}` })
5210
5685
  ]
5211
5686
  }
5212
5687
  )
5213
5688
  ] }),
5214
- expanded && /* @__PURE__ */ jsx15("div", { className: "border-t border-warning/20 px-4 py-3 text-xs", children: custom ?? /* @__PURE__ */ jsx15(DefaultToolDetail, { call }) })
5689
+ expanded && /* @__PURE__ */ jsx16("div", { className: "border-t border-warning/20 px-4 py-3 text-xs", children: custom ?? /* @__PURE__ */ jsx16(DefaultToolDetail, { call }) })
5215
5690
  ] });
5216
5691
  }
5217
5692
  function FollowupCard({ call }) {
5218
5693
  const a = call.args ?? {};
5219
5694
  const when = typeof a.when === "string" ? a.when : typeof a.at === "string" ? a.at : typeof a.schedule === "string" ? a.schedule : null;
5220
- return /* @__PURE__ */ jsxs13("div", { className: "w-fit min-w-[260px] max-w-full rounded-lg border border-border/60 border-l-2 border-l-primary/60 bg-muted/20 px-3 py-2 text-sm", children: [
5221
- /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
5222
- /* @__PURE__ */ jsx15(ToolGlyph, { name: call.name, className: "h-3.5 w-3.5 shrink-0 text-primary/80" }),
5223
- /* @__PURE__ */ jsx15("span", { className: "min-w-0 flex-1 truncate font-medium text-foreground", children: friendlyToolTitle(call) })
5695
+ return /* @__PURE__ */ jsxs14("div", { className: "w-fit min-w-[260px] max-w-full rounded-lg border border-border/60 border-l-2 border-l-primary/60 bg-muted/20 px-3 py-2 text-sm", children: [
5696
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2", children: [
5697
+ /* @__PURE__ */ jsx16(ToolGlyph, { name: call.name, className: "h-3.5 w-3.5 shrink-0 text-primary/80" }),
5698
+ /* @__PURE__ */ jsx16("span", { className: "min-w-0 flex-1 truncate font-medium text-foreground", children: friendlyToolTitle(call) })
5224
5699
  ] }),
5225
- when && /* @__PURE__ */ jsx15("p", { className: "mt-0.5 pl-[22px] text-[12px] text-muted-foreground", children: when })
5700
+ when && /* @__PURE__ */ jsx16("p", { className: "mt-0.5 pl-[22px] text-[12px] text-muted-foreground", children: when })
5226
5701
  ] });
5227
5702
  }
5228
5703
  function ToolCallCard({
@@ -5232,13 +5707,13 @@ function ToolCallCard({
5232
5707
  onOpenRun,
5233
5708
  renderers
5234
5709
  }) {
5235
- const [expanded, setExpanded] = useState15(false);
5710
+ const [expanded, setExpanded] = useState16(false);
5236
5711
  const pending = call.status === "done" ? pendingApprovalOf(call) : null;
5237
5712
  const kind = blockKindOf(call);
5238
5713
  const failed = call.status === "error" || toolOutcomeOf(call)?.ok === false;
5239
5714
  const custom = renderers?.[call.name]?.(call, message);
5240
5715
  if (pending) {
5241
- return /* @__PURE__ */ jsx15(
5716
+ return /* @__PURE__ */ jsx16(
5242
5717
  ProposalCard,
5243
5718
  {
5244
5719
  call,
@@ -5250,16 +5725,16 @@ function ToolCallCard({
5250
5725
  );
5251
5726
  }
5252
5727
  if (kind === "followup" && !failed) {
5253
- return /* @__PURE__ */ jsx15(FollowupCard, { call });
5728
+ return /* @__PURE__ */ jsx16(FollowupCard, { call });
5254
5729
  }
5255
5730
  const isCommand = kind === "command";
5256
- return /* @__PURE__ */ jsxs13(
5731
+ return /* @__PURE__ */ jsxs14(
5257
5732
  "div",
5258
5733
  {
5259
5734
  className: `w-fit min-w-[280px] max-w-full rounded-lg border text-xs transition ${failed ? "border-destructive/40 bg-destructive/5" : "border-border/60 bg-muted/20"}`,
5260
5735
  children: [
5261
- /* @__PURE__ */ jsxs13("div", { className: "flex w-full items-center gap-2 px-3 py-2", children: [
5262
- /* @__PURE__ */ jsxs13(
5736
+ /* @__PURE__ */ jsxs14("div", { className: "flex w-full items-center gap-2 px-3 py-2", children: [
5737
+ /* @__PURE__ */ jsxs14(
5263
5738
  "button",
5264
5739
  {
5265
5740
  type: "button",
@@ -5267,14 +5742,14 @@ function ToolCallCard({
5267
5742
  "aria-expanded": expanded,
5268
5743
  className: "flex min-w-0 flex-1 items-center gap-2 rounded text-left focus:outline-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
5269
5744
  children: [
5270
- /* @__PURE__ */ jsx15(
5745
+ /* @__PURE__ */ jsx16(
5271
5746
  "span",
5272
5747
  {
5273
5748
  className: `h-2 w-2 shrink-0 rounded-full ${call.status === "running" ? "animate-pulse bg-warning" : failed ? "bg-destructive" : "bg-success"}`
5274
5749
  }
5275
5750
  ),
5276
- /* @__PURE__ */ jsx15(ToolGlyph, { name: call.name, className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
5277
- /* @__PURE__ */ jsx15(
5751
+ /* @__PURE__ */ jsx16(ToolGlyph, { name: call.name, className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
5752
+ /* @__PURE__ */ jsx16(
5278
5753
  "span",
5279
5754
  {
5280
5755
  className: `min-w-0 flex-1 truncate ${isCommand ? "font-mono text-[12px] tracking-tight text-foreground/90" : "font-medium"}`,
@@ -5284,8 +5759,8 @@ function ToolCallCard({
5284
5759
  ]
5285
5760
  }
5286
5761
  ),
5287
- /* @__PURE__ */ jsx15("span", { className: "shrink-0 text-[11px] text-muted-foreground", children: call.status === "running" ? "running\u2026" : failed ? "failed" : "done" }),
5288
- /* @__PURE__ */ jsx15(
5762
+ /* @__PURE__ */ jsx16("span", { className: "shrink-0 text-[11px] text-muted-foreground", children: call.status === "running" ? "running\u2026" : failed ? "failed" : "done" }),
5763
+ /* @__PURE__ */ jsx16(
5289
5764
  "button",
5290
5765
  {
5291
5766
  type: "button",
@@ -5293,13 +5768,13 @@ function ToolCallCard({
5293
5768
  "aria-label": expanded ? "Collapse details" : "Expand details",
5294
5769
  "aria-expanded": expanded,
5295
5770
  className: "shrink-0 rounded p-0.5 focus:outline-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
5296
- children: /* @__PURE__ */ jsx15(ChevronDown, { className: `h-3 w-3 text-muted-foreground transition-transform ${expanded ? "rotate-180" : ""}` })
5771
+ children: /* @__PURE__ */ jsx16(ChevronDown, { className: `h-3 w-3 text-muted-foreground transition-transform ${expanded ? "rotate-180" : ""}` })
5297
5772
  }
5298
5773
  )
5299
5774
  ] }),
5300
- expanded && /* @__PURE__ */ jsxs13("div", { className: "border-t border-border/40 px-3 py-2.5", children: [
5301
- custom ?? (call.name === "sandbox_run_command" ? /* @__PURE__ */ jsx15(ShellDetail, { call }) : /* @__PURE__ */ jsx15(DefaultToolDetail, { call })),
5302
- onOpenRun && call.name.startsWith("sandbox_") && /* @__PURE__ */ jsx15(
5775
+ expanded && /* @__PURE__ */ jsxs14("div", { className: "border-t border-border/40 px-3 py-2.5", children: [
5776
+ custom ?? (call.name === "sandbox_run_command" ? /* @__PURE__ */ jsx16(ShellDetail, { call }) : /* @__PURE__ */ jsx16(DefaultToolDetail, { call })),
5777
+ onOpenRun && call.name.startsWith("sandbox_") && /* @__PURE__ */ jsx16(
5303
5778
  "button",
5304
5779
  {
5305
5780
  type: "button",
@@ -5314,7 +5789,7 @@ function ToolCallCard({
5314
5789
  );
5315
5790
  }
5316
5791
  function StreamingCaret() {
5317
- return /* @__PURE__ */ jsx15(
5792
+ return /* @__PURE__ */ jsx16(
5318
5793
  "span",
5319
5794
  {
5320
5795
  className: "ml-0.5 inline-block h-[1.1em] w-[3px] translate-y-[2px] animate-pulse rounded-sm bg-foreground/70",
@@ -5332,9 +5807,9 @@ function SegmentText({
5332
5807
  const text = useSmoothText(content, streaming);
5333
5808
  const body = useMemo9(() => renderBody(text), [renderBody, text]);
5334
5809
  if (!content.trim() && !showCaret) return null;
5335
- return /* @__PURE__ */ jsxs13("div", { className: messageClassName, children: [
5810
+ return /* @__PURE__ */ jsxs14("div", { className: messageClassName, children: [
5336
5811
  body,
5337
- showCaret && /* @__PURE__ */ jsx15(StreamingCaret, {})
5812
+ showCaret && /* @__PURE__ */ jsx16(StreamingCaret, {})
5338
5813
  ] });
5339
5814
  }
5340
5815
  var COLLAPSE_TOOL_RUN_AT = 3;
@@ -5358,7 +5833,7 @@ function SegmentedBody({
5358
5833
  const leftoverToolCalls = (msg.toolCalls ?? []).filter(
5359
5834
  (tc) => !segmentToolIds.has(tc.id)
5360
5835
  );
5361
- const renderToolCard = (call) => /* @__PURE__ */ jsx15(
5836
+ const renderToolCard = (call) => /* @__PURE__ */ jsx16(
5362
5837
  ToolCallCard,
5363
5838
  {
5364
5839
  call,
@@ -5381,9 +5856,9 @@ function SegmentedBody({
5381
5856
  else groups.push({ kind: "tools", index: i, calls: [seg.call] });
5382
5857
  }
5383
5858
  }
5384
- return /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-2", children: [
5859
+ return /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-2", children: [
5385
5860
  groups.map(
5386
- (g) => g.kind === "text" ? /* @__PURE__ */ jsx15(
5861
+ (g) => g.kind === "text" ? /* @__PURE__ */ jsx16(
5387
5862
  SegmentText,
5388
5863
  {
5389
5864
  content: g.content,
@@ -5393,24 +5868,24 @@ function SegmentedBody({
5393
5868
  messageClassName
5394
5869
  },
5395
5870
  `text-${g.index}`
5396
- ) : !streaming && g.calls.length >= COLLAPSE_TOOL_RUN_AT && !g.calls.some(isImportantTool) ? /* @__PURE__ */ jsxs13(
5871
+ ) : !streaming && g.calls.length >= COLLAPSE_TOOL_RUN_AT && !g.calls.some(isImportantTool) ? /* @__PURE__ */ jsxs14(
5397
5872
  "details",
5398
5873
  {
5399
5874
  className: "rounded-lg border-l-2 border-border/70 bg-muted/20 px-3 py-2",
5400
5875
  children: [
5401
- /* @__PURE__ */ jsxs13("summary", { className: "cursor-pointer select-none text-xs font-medium text-muted-foreground", children: [
5876
+ /* @__PURE__ */ jsxs14("summary", { className: "cursor-pointer select-none text-xs font-medium text-muted-foreground", children: [
5402
5877
  "Worked through ",
5403
5878
  g.calls.length,
5404
5879
  " steps"
5405
5880
  ] }),
5406
- /* @__PURE__ */ jsx15("div", { className: "mt-2 flex flex-col gap-2", children: g.calls.map(renderToolCard) })
5881
+ /* @__PURE__ */ jsx16("div", { className: "mt-2 flex flex-col gap-2", children: g.calls.map(renderToolCard) })
5407
5882
  ]
5408
5883
  },
5409
5884
  `tools-${g.index}`
5410
- ) : /* @__PURE__ */ jsx15("div", { className: "flex flex-col gap-2", children: g.calls.map(renderToolCard) }, `tools-${g.index}`)
5885
+ ) : /* @__PURE__ */ jsx16("div", { className: "flex flex-col gap-2", children: g.calls.map(renderToolCard) }, `tools-${g.index}`)
5411
5886
  ),
5412
5887
  leftoverToolCalls.map(renderToolCard),
5413
- streaming && segments[lastIndex]?.kind === "tool" && /* @__PURE__ */ jsx15(StreamingCaret, {})
5888
+ streaming && segments[lastIndex]?.kind === "tool" && /* @__PURE__ */ jsx16(StreamingCaret, {})
5414
5889
  ] });
5415
5890
  }
5416
5891
  function AssistantMessageImpl({
@@ -5433,37 +5908,37 @@ function AssistantMessageImpl({
5433
5908
  const body = useMemo9(() => renderBody(content), [renderBody, content]);
5434
5909
  const segments = msg.segments;
5435
5910
  const hasAnswerText = content !== "" || (segments?.some((s) => s.kind === "text" && s.content.trim() !== "") ?? false);
5436
- const reasoningScrollRef = useRef10(null);
5437
- const thinkStartRef = useRef10(null);
5438
- const thinkMsRef = useRef10(null);
5911
+ const reasoningScrollRef = useRef11(null);
5912
+ const thinkStartRef = useRef11(null);
5913
+ const thinkMsRef = useRef11(null);
5439
5914
  if (streaming && reasoning && !hasAnswerText && thinkStartRef.current === null) {
5440
5915
  thinkStartRef.current = performance.now();
5441
5916
  }
5442
5917
  if (hasAnswerText && thinkStartRef.current !== null && thinkMsRef.current === null) {
5443
5918
  thinkMsRef.current = performance.now() - thinkStartRef.current;
5444
5919
  }
5445
- useEffect11(() => {
5920
+ useEffect12(() => {
5446
5921
  const el = reasoningScrollRef.current;
5447
5922
  if (el && streaming && !hasAnswerText) el.scrollTop = el.scrollHeight;
5448
5923
  }, [reasoning, streaming, hasAnswerText]);
5449
5924
  const thinkingSeconds = useThinkingSeconds(
5450
5925
  streaming && !!reasoning && !hasAnswerText
5451
5926
  );
5452
- return /* @__PURE__ */ jsxs13("div", { className: "mx-auto w-full max-w-3xl px-6 py-3", children: [
5453
- /* @__PURE__ */ jsxs13("div", { className: "mb-1 flex items-baseline gap-2 text-[11px] tracking-wide text-muted-foreground", children: [
5454
- /* @__PURE__ */ jsx15("span", { className: "font-semibold uppercase", children: agentLabel }),
5455
- msg.modelUsed && /* @__PURE__ */ jsx15("span", { className: "font-mono normal-case", children: msg.modelUsed }),
5456
- formatTokensPerSecond(msg) && /* @__PURE__ */ jsx15("span", { children: formatTokensPerSecond(msg) }),
5457
- formatModelCost(msg, models) && /* @__PURE__ */ jsx15("span", { children: formatModelCost(msg, models) })
5927
+ return /* @__PURE__ */ jsxs14("div", { className: "mx-auto w-full max-w-3xl px-6 py-3", children: [
5928
+ /* @__PURE__ */ jsxs14("div", { className: "mb-1 flex items-baseline gap-2 text-[11px] tracking-wide text-muted-foreground", children: [
5929
+ /* @__PURE__ */ jsx16("span", { className: "font-semibold uppercase", children: agentLabel }),
5930
+ msg.modelUsed && /* @__PURE__ */ jsx16("span", { className: "font-mono normal-case", children: msg.modelUsed }),
5931
+ formatTokensPerSecond(msg) && /* @__PURE__ */ jsx16("span", { children: formatTokensPerSecond(msg) }),
5932
+ formatModelCost(msg, models) && /* @__PURE__ */ jsx16("span", { children: formatModelCost(msg, models) })
5458
5933
  ] }),
5459
- reasoning && /* @__PURE__ */ jsxs13("details", { className: "mb-2 rounded-lg border-l-2 border-border/70 bg-muted/20 px-3 py-2", open: !hasAnswerText, children: [
5460
- /* @__PURE__ */ jsx15("summary", { className: "cursor-pointer select-none text-xs font-medium text-muted-foreground", children: !hasAnswerText ? /* @__PURE__ */ jsxs13("span", { className: "animate-pulse", children: [
5934
+ reasoning && /* @__PURE__ */ jsxs14("details", { className: "mb-2 rounded-lg border-l-2 border-border/70 bg-muted/20 px-3 py-2", open: !hasAnswerText, children: [
5935
+ /* @__PURE__ */ jsx16("summary", { className: "cursor-pointer select-none text-xs font-medium text-muted-foreground", children: !hasAnswerText ? /* @__PURE__ */ jsxs14("span", { className: "animate-pulse", children: [
5461
5936
  "Thinking",
5462
5937
  thinkingSeconds >= 3 ? ` \xB7 ${thinkingSeconds}s` : "\u2026"
5463
5938
  ] }) : thinkMsRef.current != null ? `Thought for ${Math.max(1, Math.round(thinkMsRef.current / 1e3))}s` : "Thought process" }),
5464
- /* @__PURE__ */ jsx15("div", { ref: reasoningScrollRef, className: "mt-2 max-h-48 overflow-y-auto whitespace-pre-wrap text-[13px] leading-relaxed text-muted-foreground", children: reasoning })
5939
+ /* @__PURE__ */ jsx16("div", { ref: reasoningScrollRef, className: "mt-2 max-h-48 overflow-y-auto whitespace-pre-wrap text-[13px] leading-relaxed text-muted-foreground", children: reasoning })
5465
5940
  ] }),
5466
- segments && segments.length > 0 ? /* @__PURE__ */ jsx15(
5941
+ segments && segments.length > 0 ? /* @__PURE__ */ jsx16(
5467
5942
  SegmentedBody,
5468
5943
  {
5469
5944
  segments,
@@ -5475,12 +5950,12 @@ function AssistantMessageImpl({
5475
5950
  toolRenderers,
5476
5951
  messageClassName
5477
5952
  }
5478
- ) : /* @__PURE__ */ jsxs13(Fragment8, { children: [
5479
- /* @__PURE__ */ jsxs13("div", { className: messageClassName, children: [
5953
+ ) : /* @__PURE__ */ jsxs14(Fragment8, { children: [
5954
+ /* @__PURE__ */ jsxs14("div", { className: messageClassName, children: [
5480
5955
  body,
5481
- streaming && content && !msg.toolCalls?.length && /* @__PURE__ */ jsx15(StreamingCaret, {})
5956
+ streaming && content && !msg.toolCalls?.length && /* @__PURE__ */ jsx16(StreamingCaret, {})
5482
5957
  ] }),
5483
- msg.toolCalls && msg.toolCalls.length > 0 && /* @__PURE__ */ jsx15("div", { className: "mt-2 flex flex-col gap-1.5", children: msg.toolCalls.map((tc) => /* @__PURE__ */ jsx15(
5958
+ msg.toolCalls && msg.toolCalls.length > 0 && /* @__PURE__ */ jsx16("div", { className: "mt-2 flex flex-col gap-1.5", children: msg.toolCalls.map((tc) => /* @__PURE__ */ jsx16(
5484
5959
  ToolCallCard,
5485
5960
  {
5486
5961
  call: tc,
@@ -5492,7 +5967,7 @@ function AssistantMessageImpl({
5492
5967
  tc.id
5493
5968
  )) })
5494
5969
  ] }),
5495
- durableCards && msg.parts && /* @__PURE__ */ jsx15(
5970
+ durableCards && msg.parts && /* @__PURE__ */ jsx16(
5496
5971
  DurableChatCards,
5497
5972
  {
5498
5973
  ...durableCards,
@@ -5501,7 +5976,7 @@ function AssistantMessageImpl({
5501
5976
  className: "mt-3"
5502
5977
  }
5503
5978
  ),
5504
- workProductCards && workProductPartsFromMessageParts(msg.parts).map((part) => /* @__PURE__ */ jsx15(
5979
+ workProductCards && workProductPartsFromMessageParts(msg.parts).map((part) => /* @__PURE__ */ jsx16(
5505
5980
  WorkProductCard,
5506
5981
  {
5507
5982
  part,
@@ -5511,7 +5986,7 @@ function AssistantMessageImpl({
5511
5986
  `${part.ref.id}:${part.ref.version}`
5512
5987
  )),
5513
5988
  renderExtras?.(msg),
5514
- resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */ jsx15("div", { className: "mt-2", children: /* @__PURE__ */ jsx15(
5989
+ resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */ jsx16("div", { className: "mt-2", children: /* @__PURE__ */ jsx16(
5515
5990
  MessageAttachments,
5516
5991
  {
5517
5992
  parts: attachmentPartsFromMessageParts(msg.parts),
@@ -5523,8 +5998,8 @@ function AssistantMessageImpl({
5523
5998
  }
5524
5999
  var AssistantMessage = memo(AssistantMessageImpl);
5525
6000
  function useThinkingSeconds(active) {
5526
- const [seconds, setSeconds] = useState15(0);
5527
- useEffect11(() => {
6001
+ const [seconds, setSeconds] = useState16(0);
6002
+ useEffect12(() => {
5528
6003
  if (!active) return;
5529
6004
  setSeconds(0);
5530
6005
  const id = setInterval(() => setSeconds((s) => s + 1), 1e3);
@@ -5534,23 +6009,23 @@ function useThinkingSeconds(active) {
5534
6009
  }
5535
6010
  function ThinkingRow({ agentLabel }) {
5536
6011
  const seconds = useThinkingSeconds(true);
5537
- return /* @__PURE__ */ jsxs13("div", { className: "mx-auto w-full max-w-3xl px-6 py-3", children: [
5538
- /* @__PURE__ */ jsx15("p", { className: "mb-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: agentLabel }),
5539
- /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2 text-base text-muted-foreground", children: [
5540
- /* @__PURE__ */ jsx15("svg", { className: "h-4 w-4 animate-spin", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": true, children: /* @__PURE__ */ jsx15("path", { d: "M21 12a9 9 0 1 1-6.219-8.56", strokeLinecap: "round" }) }),
6012
+ return /* @__PURE__ */ jsxs14("div", { className: "mx-auto w-full max-w-3xl px-6 py-3", children: [
6013
+ /* @__PURE__ */ jsx16("p", { className: "mb-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: agentLabel }),
6014
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2 text-base text-muted-foreground", children: [
6015
+ /* @__PURE__ */ jsx16("svg", { className: "h-4 w-4 animate-spin", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": true, children: /* @__PURE__ */ jsx16("path", { d: "M21 12a9 9 0 1 1-6.219-8.56", strokeLinecap: "round" }) }),
5541
6016
  "Thinking",
5542
6017
  seconds >= 3 ? ` \xB7 ${seconds}s` : "..."
5543
6018
  ] })
5544
6019
  ] });
5545
6020
  }
5546
6021
  function StreamErrorRow({ message, onRetry }) {
5547
- return /* @__PURE__ */ jsx15("div", { className: "mx-auto w-full max-w-3xl px-6 py-3", children: /* @__PURE__ */ jsxs13("div", { role: "alert", className: "flex items-start gap-2.5 rounded-lg border border-destructive/40 bg-destructive/5 px-3 py-2.5 text-sm text-destructive", children: [
5548
- /* @__PURE__ */ jsxs13("svg", { className: "mt-0.5 h-4 w-4 shrink-0", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
5549
- /* @__PURE__ */ jsx15("circle", { cx: "12", cy: "12", r: "9" }),
5550
- /* @__PURE__ */ jsx15("path", { d: "M12 8v4m0 4h.01" })
6022
+ return /* @__PURE__ */ jsx16("div", { className: "mx-auto w-full max-w-3xl px-6 py-3", children: /* @__PURE__ */ jsxs14("div", { role: "alert", className: "flex items-start gap-2.5 rounded-lg border border-destructive/40 bg-destructive/5 px-3 py-2.5 text-sm text-destructive", children: [
6023
+ /* @__PURE__ */ jsxs14("svg", { className: "mt-0.5 h-4 w-4 shrink-0", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
6024
+ /* @__PURE__ */ jsx16("circle", { cx: "12", cy: "12", r: "9" }),
6025
+ /* @__PURE__ */ jsx16("path", { d: "M12 8v4m0 4h.01" })
5551
6026
  ] }),
5552
- /* @__PURE__ */ jsx15("span", { className: "min-w-0 flex-1 break-words", children: message }),
5553
- onRetry && /* @__PURE__ */ jsx15(
6027
+ /* @__PURE__ */ jsx16("span", { className: "min-w-0 flex-1 break-words", children: message }),
6028
+ onRetry && /* @__PURE__ */ jsx16(
5554
6029
  "button",
5555
6030
  {
5556
6031
  type: "button",
@@ -5584,30 +6059,30 @@ function ChatMessages({
5584
6059
  }) {
5585
6060
  const messageClassName = messageSize === "large" ? "agent-app-message-copy text-[17px] leading-[1.75]" : "agent-app-message-copy text-base leading-[1.75]";
5586
6061
  const renderBody = useMemo9(
5587
- () => renderMarkdown ?? ((content) => /* @__PURE__ */ jsx15("p", { className: "whitespace-pre-wrap", children: content })),
6062
+ () => renderMarkdown ?? ((content) => /* @__PURE__ */ jsx16("p", { className: "whitespace-pre-wrap", children: content })),
5588
6063
  [renderMarkdown]
5589
6064
  );
5590
6065
  const lastIsUser = messages[messages.length - 1]?.role === "user";
5591
6066
  if (messages.length === 0 && !loading && !error) {
5592
- const empty = renderEmpty ? renderEmpty() : /* @__PURE__ */ jsx15(ChatEmptyState, { ...emptyState });
5593
- return /* @__PURE__ */ jsxs13(Fragment8, { children: [
6067
+ const empty = renderEmpty ? renderEmpty() : /* @__PURE__ */ jsx16(ChatEmptyState, { ...emptyState });
6068
+ return /* @__PURE__ */ jsxs14(Fragment8, { children: [
5594
6069
  header,
5595
6070
  empty
5596
6071
  ] });
5597
6072
  }
5598
- return /* @__PURE__ */ jsxs13(Fragment8, { children: [
6073
+ return /* @__PURE__ */ jsxs14(Fragment8, { children: [
5599
6074
  header,
5600
6075
  messages.map(
5601
- (msg) => msg.role === "user" ? /* @__PURE__ */ jsx15("div", { className: "mx-auto w-full max-w-3xl px-6 py-3", children: /* @__PURE__ */ jsxs13("div", { className: "ml-auto w-fit max-w-[85%]", children: [
5602
- /* @__PURE__ */ jsx15("p", { className: "mb-1 text-right text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: userLabel }),
5603
- /* @__PURE__ */ jsx15(
6076
+ (msg) => msg.role === "user" ? /* @__PURE__ */ jsx16("div", { className: "mx-auto w-full max-w-3xl px-6 py-3", children: /* @__PURE__ */ jsxs14("div", { className: "ml-auto w-fit max-w-[85%]", children: [
6077
+ /* @__PURE__ */ jsx16("p", { className: "mb-1 text-right text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: userLabel }),
6078
+ /* @__PURE__ */ jsx16(
5604
6079
  "div",
5605
6080
  {
5606
6081
  className: `rounded-2xl rounded-tr-md bg-primary/10 px-4 py-2.5 ${messageClassName}`,
5607
- children: /* @__PURE__ */ jsx15("p", { className: "whitespace-pre-wrap", children: msg.content })
6082
+ children: /* @__PURE__ */ jsx16("p", { className: "whitespace-pre-wrap", children: msg.content })
5608
6083
  }
5609
6084
  ),
5610
- resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */ jsx15("div", { className: "mt-1.5", children: /* @__PURE__ */ jsx15(
6085
+ resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */ jsx16("div", { className: "mt-1.5", children: /* @__PURE__ */ jsx16(
5611
6086
  MessageAttachments,
5612
6087
  {
5613
6088
  parts: attachmentPartsFromMessageParts(msg.parts),
@@ -5615,7 +6090,7 @@ function ChatMessages({
5615
6090
  justify: "end"
5616
6091
  }
5617
6092
  ) })
5618
- ] }) }, msg.id) : /* @__PURE__ */ jsx15(
6093
+ ] }) }, msg.id) : /* @__PURE__ */ jsx16(
5619
6094
  AssistantMessage,
5620
6095
  {
5621
6096
  msg,
@@ -5635,8 +6110,8 @@ function ChatMessages({
5635
6110
  msg.id
5636
6111
  )
5637
6112
  ),
5638
- loading && lastIsUser && /* @__PURE__ */ jsx15(ThinkingRow, { agentLabel }),
5639
- error && !loading && /* @__PURE__ */ jsx15(StreamErrorRow, { message: error, onRetry })
6113
+ loading && lastIsUser && /* @__PURE__ */ jsx16(ThinkingRow, { agentLabel }),
6114
+ error && !loading && /* @__PURE__ */ jsx16(StreamErrorRow, { message: error, onRetry })
5640
6115
  ] });
5641
6116
  }
5642
6117
 
@@ -5706,6 +6181,22 @@ export {
5706
6181
  FlowWaterfall,
5707
6182
  MissionActivityLane,
5708
6183
  AgentActivityPanel,
6184
+ PROVENANCE_BASES,
6185
+ provenanceBasisMeta,
6186
+ provenanceStandingMeta,
6187
+ weakerProvenanceStanding,
6188
+ DEFAULT_PROVENANCE_CONFIDENCE_POLICY,
6189
+ standingFromConfidence,
6190
+ describeProvenanceSourceStatus,
6191
+ provenanceGaps,
6192
+ loadingProvenanceSources,
6193
+ resolveProvenanceStanding,
6194
+ rollUpProvenanceStanding,
6195
+ describeProvenance,
6196
+ provenanceNextMove,
6197
+ provenanceTriggerLabel,
6198
+ ProvenanceValue,
6199
+ ProvenanceLegend,
5709
6200
  SeatPaywall,
5710
6201
  useInfiniteScroll,
5711
6202
  useSessionHistory,
@@ -5744,4 +6235,4 @@ export {
5744
6235
  useThinkingSeconds,
5745
6236
  ChatMessages
5746
6237
  };
5747
- //# sourceMappingURL=chunk-NZVBJM73.js.map
6238
+ //# sourceMappingURL=chunk-7PFFFRVU.js.map