@tangle-network/agent-app 0.63.27 → 0.63.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DesignCanvas-CFNV5JGQ.js → DesignCanvas-3DGZQOD7.js} +2 -2
- package/dist/{DesignCanvasEditor-KH4BDUE3.js → DesignCanvasEditor-OG4QY5WJ.js} +2 -2
- package/dist/{TimelineEditor-VB2UJ34D.js → TimelineEditor-MUY35ULL.js} +3 -3
- package/dist/app-auth/index.js +4 -4
- package/dist/assistant/index.js +9 -9
- package/dist/chat-react/index.js +3 -3
- package/dist/chat-routes/index.js +2 -2
- package/dist/chunk-53ZX7XZY.js +371 -0
- package/dist/chunk-53ZX7XZY.js.map +1 -0
- package/dist/{chunk-IVBREL7A.js → chunk-5HBIN366.js} +10 -10
- package/dist/{chunk-BQGJ5IDP.js → chunk-6UMIOEDR.js} +1046 -885
- package/dist/chunk-6UMIOEDR.js.map +1 -0
- package/dist/{chunk-ZNE4NYU7.js → chunk-DPTNKH22.js} +121 -2
- package/dist/chunk-DPTNKH22.js.map +1 -0
- package/dist/{chunk-Y3GO6SG3.js → chunk-F6J5J4H6.js} +22 -3
- package/dist/chunk-F6J5J4H6.js.map +1 -0
- package/dist/chunk-N425HGJW.js +261 -0
- package/dist/chunk-N425HGJW.js.map +1 -0
- package/dist/{chunk-ZZTPTCMY.js → chunk-XJXAULNI.js} +7 -7
- package/dist/{chunk-WTNW4NFS.js → chunk-ZD2AUFIT.js} +3 -3
- package/dist/conformance/cli.d.ts +2 -0
- package/dist/conformance/cli.js +67 -0
- package/dist/conformance/cli.js.map +1 -0
- package/dist/conformance/index.d.ts +3 -0
- package/dist/conformance/index.js +9 -0
- package/dist/conformance/index.js.map +1 -0
- package/dist/conformance/revision.d.ts +13 -0
- package/dist/conformance/run.d.ts +48 -0
- package/dist/conformance/session.d.ts +24 -0
- package/dist/conformance/turns.d.ts +37 -0
- package/dist/design-canvas/index.js +7 -7
- package/dist/design-canvas-react/engine.js +1 -1
- package/dist/design-canvas-react/index.js +5 -5
- package/dist/design-canvas-react/lazy.js +1 -1
- package/dist/operator/index.js +24 -252
- package/dist/operator/index.js.map +1 -1
- package/dist/platform/index.js +9 -9
- package/dist/public-consultation/index.d.ts +2 -2
- package/dist/public-consultation/index.js +2 -2
- package/dist/sequences/index.js +1 -1
- package/dist/sequences-react/index.js +3 -3
- package/dist/settings-react/index.js +1 -1
- package/dist/teams/invitations-api.js +1 -1
- package/dist/teams/members-api.d.ts +16 -1
- package/dist/teams/members-api.js +1 -1
- package/dist/teams-react/components/InviteTokenPage.d.ts +24 -0
- package/dist/teams-react/components/index.d.ts +1 -0
- package/dist/teams-react/index.js +40 -0
- package/dist/teams-react/index.js.map +1 -1
- package/dist/web/chat-stream-error.d.ts +63 -0
- package/dist/web/index.d.ts +1 -0
- package/dist/web/index.js +11 -1
- package/dist/web-react/durable-plan-flow-card.d.ts +25 -0
- package/dist/web-react/index.d.ts +3 -0
- package/dist/web-react/index.js +34 -28
- package/dist/web-react/sandbox-terminal-panel.d.ts +27 -0
- package/dist/web-react/terminal.d.ts +1 -0
- package/dist/web-react/terminal.js +109 -0
- package/dist/web-react/terminal.js.map +1 -1
- package/dist/web-react/use-models.d.ts +24 -0
- package/dist/web-react/use-plan-mode-selection.d.ts +17 -0
- package/dist/workspace-react/index.js +5 -5
- package/package.json +8 -2
- package/dist/chunk-BQGJ5IDP.js.map +0 -1
- package/dist/chunk-Y3GO6SG3.js.map +0 -1
- package/dist/chunk-ZNE4NYU7.js.map +0 -1
- /package/dist/{DesignCanvas-CFNV5JGQ.js.map → DesignCanvas-3DGZQOD7.js.map} +0 -0
- /package/dist/{DesignCanvasEditor-KH4BDUE3.js.map → DesignCanvasEditor-OG4QY5WJ.js.map} +0 -0
- /package/dist/{TimelineEditor-VB2UJ34D.js.map → TimelineEditor-MUY35ULL.js.map} +0 -0
- /package/dist/{chunk-IVBREL7A.js.map → chunk-5HBIN366.js.map} +0 -0
- /package/dist/{chunk-ZZTPTCMY.js.map → chunk-XJXAULNI.js.map} +0 -0
- /package/dist/{chunk-WTNW4NFS.js.map → chunk-ZD2AUFIT.js.map} +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
loadHistoryPage,
|
|
3
|
+
useHistoryControls,
|
|
4
|
+
useInfiniteScroll
|
|
5
|
+
} from "./chunk-UHSUY6H6.js";
|
|
1
6
|
import {
|
|
2
7
|
PATH_CONTINUATION_CHAR,
|
|
3
8
|
WORD_CHAR,
|
|
4
9
|
charAt,
|
|
5
10
|
charBefore
|
|
6
11
|
} from "./chunk-3HUFJ5LO.js";
|
|
7
|
-
import {
|
|
8
|
-
loadHistoryPage,
|
|
9
|
-
useHistoryControls,
|
|
10
|
-
useInfiniteScroll
|
|
11
|
-
} from "./chunk-UHSUY6H6.js";
|
|
12
12
|
import {
|
|
13
13
|
BrandMark
|
|
14
14
|
} from "./chunk-7PULOECS.js";
|
|
@@ -26,13 +26,6 @@ import {
|
|
|
26
26
|
ActionDialog,
|
|
27
27
|
ActionDialogButton
|
|
28
28
|
} from "./chunk-2VG6Q4TS.js";
|
|
29
|
-
import {
|
|
30
|
-
UNTITLED_SESSION_LABEL,
|
|
31
|
-
filterCommandPaletteItems,
|
|
32
|
-
groupCommandPaletteItems,
|
|
33
|
-
mergeSessionPages,
|
|
34
|
-
sessionLabel
|
|
35
|
-
} from "./chunk-SJWIZT7B.js";
|
|
36
29
|
import {
|
|
37
30
|
BrainGlyph,
|
|
38
31
|
ChevronDown,
|
|
@@ -44,6 +37,13 @@ import {
|
|
|
44
37
|
usePending,
|
|
45
38
|
usePopover
|
|
46
39
|
} from "./chunk-RO25WIVS.js";
|
|
40
|
+
import {
|
|
41
|
+
UNTITLED_SESSION_LABEL,
|
|
42
|
+
filterCommandPaletteItems,
|
|
43
|
+
groupCommandPaletteItems,
|
|
44
|
+
mergeSessionPages,
|
|
45
|
+
sessionLabel
|
|
46
|
+
} from "./chunk-SJWIZT7B.js";
|
|
47
47
|
import {
|
|
48
48
|
ReviewFeedbackForm
|
|
49
49
|
} from "./chunk-TEZETVLE.js";
|
|
@@ -2052,8 +2052,59 @@ function DurablePlanCard({
|
|
|
2052
2052
|
] });
|
|
2053
2053
|
}
|
|
2054
2054
|
|
|
2055
|
+
// src/web-react/durable-plan-flow-card.tsx
|
|
2056
|
+
import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2057
|
+
function DurablePlanFlowCard({
|
|
2058
|
+
plan,
|
|
2059
|
+
client,
|
|
2060
|
+
canWrite,
|
|
2061
|
+
onUpdated,
|
|
2062
|
+
attachFollowUp,
|
|
2063
|
+
renderMarkdown,
|
|
2064
|
+
className
|
|
2065
|
+
}) {
|
|
2066
|
+
const flow = useDurablePlanFlow({ plan, client, onUpdated, attachFollowUp, autoRestore: true });
|
|
2067
|
+
const current = flow.plan;
|
|
2068
|
+
const decided = current.status === "approved" || current.status === "rejected";
|
|
2069
|
+
const rejected = current.status === "rejected";
|
|
2070
|
+
return /* @__PURE__ */ jsxs8("div", { className: "space-y-2", children: [
|
|
2071
|
+
/* @__PURE__ */ jsx8(
|
|
2072
|
+
DurablePlanCard,
|
|
2073
|
+
{
|
|
2074
|
+
plan: current,
|
|
2075
|
+
canWrite,
|
|
2076
|
+
decide: flow.decide,
|
|
2077
|
+
deciding: flow.deciding,
|
|
2078
|
+
error: flow.error ?? flow.attachError,
|
|
2079
|
+
renderMarkdown,
|
|
2080
|
+
className
|
|
2081
|
+
}
|
|
2082
|
+
),
|
|
2083
|
+
flow.effectPending && decided && /* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap items-center justify-between gap-2 rounded-lg border border-border p-3 text-sm", children: [
|
|
2084
|
+
/* @__PURE__ */ jsx8("p", { children: "The decision is saved. Its follow-up still needs confirmation." }),
|
|
2085
|
+
/* @__PURE__ */ jsx8(
|
|
2086
|
+
InteractionActionButton,
|
|
2087
|
+
{
|
|
2088
|
+
disabled: !canWrite || flow.deciding !== null,
|
|
2089
|
+
onClick: () => void flow.decide(rejected ? "rejected" : "approved", current.status === "rejected" ? current.feedback : void 0),
|
|
2090
|
+
children: flow.deciding ? "Continuing\u2026" : rejected ? "Continue revision" : "Continue plan"
|
|
2091
|
+
}
|
|
2092
|
+
)
|
|
2093
|
+
] }),
|
|
2094
|
+
flow.attachError && /* @__PURE__ */ jsx8(
|
|
2095
|
+
"button",
|
|
2096
|
+
{
|
|
2097
|
+
type: "button",
|
|
2098
|
+
onClick: flow.retryAttach,
|
|
2099
|
+
className: "text-xs font-medium text-primary underline-offset-2 hover:underline",
|
|
2100
|
+
children: "Retry notifying the agent"
|
|
2101
|
+
}
|
|
2102
|
+
)
|
|
2103
|
+
] });
|
|
2104
|
+
}
|
|
2105
|
+
|
|
2055
2106
|
// src/web-react/durable-chat-cards.tsx
|
|
2056
|
-
import { jsx as
|
|
2107
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
2057
2108
|
function planIdentity(planId, revision) {
|
|
2058
2109
|
return `${planId}:${revision}`;
|
|
2059
2110
|
}
|
|
@@ -2094,9 +2145,9 @@ function DurableChatCards({
|
|
|
2094
2145
|
}) {
|
|
2095
2146
|
const cards = durableChatCardsFromParts(parts);
|
|
2096
2147
|
if (cards.length === 0) return null;
|
|
2097
|
-
return /* @__PURE__ */
|
|
2148
|
+
return /* @__PURE__ */ jsx9("div", { className: `space-y-3 ${className ?? ""}`, children: cards.map((card) => {
|
|
2098
2149
|
if (card.kind === "plan") {
|
|
2099
|
-
return /* @__PURE__ */
|
|
2150
|
+
return /* @__PURE__ */ jsx9(
|
|
2100
2151
|
DurablePlanCard,
|
|
2101
2152
|
{
|
|
2102
2153
|
plan: card.plan,
|
|
@@ -2110,7 +2161,7 @@ function DurableChatCards({
|
|
|
2110
2161
|
);
|
|
2111
2162
|
}
|
|
2112
2163
|
if (card.interaction.kind === "plan") {
|
|
2113
|
-
return /* @__PURE__ */
|
|
2164
|
+
return /* @__PURE__ */ jsx9(
|
|
2114
2165
|
InteractionPlanCard,
|
|
2115
2166
|
{
|
|
2116
2167
|
interaction: card.interaction,
|
|
@@ -2124,7 +2175,7 @@ function DurableChatCards({
|
|
|
2124
2175
|
card.key
|
|
2125
2176
|
);
|
|
2126
2177
|
}
|
|
2127
|
-
return /* @__PURE__ */
|
|
2178
|
+
return /* @__PURE__ */ jsx9(
|
|
2128
2179
|
InteractionQuestionCard,
|
|
2129
2180
|
{
|
|
2130
2181
|
interaction: card.interaction,
|
|
@@ -2524,24 +2575,131 @@ function segmentMentionContent(content, parts) {
|
|
|
2524
2575
|
return { segments, matched };
|
|
2525
2576
|
}
|
|
2526
2577
|
|
|
2578
|
+
// src/web-react/use-plan-mode-selection.ts
|
|
2579
|
+
import { useCallback as useCallback5, useEffect as useEffect6, useRef as useRef8, useState as useState12 } from "react";
|
|
2580
|
+
function usePlanModeSelection(threadId, initialPlanMode, options = {}) {
|
|
2581
|
+
const [value, setValueState] = useState12(initialPlanMode);
|
|
2582
|
+
const [saving, setSaving] = useState12(false);
|
|
2583
|
+
const inFlightRef = useRef8(0);
|
|
2584
|
+
const seqRef = useRef8(0);
|
|
2585
|
+
const { threadUrl } = options;
|
|
2586
|
+
useEffect6(() => {
|
|
2587
|
+
if (inFlightRef.current === 0) setValueState(initialPlanMode);
|
|
2588
|
+
}, [initialPlanMode]);
|
|
2589
|
+
const update = useCallback5(
|
|
2590
|
+
async (next) => {
|
|
2591
|
+
const prev = value;
|
|
2592
|
+
if (next === prev) return;
|
|
2593
|
+
const seq = ++seqRef.current;
|
|
2594
|
+
setValueState(next);
|
|
2595
|
+
if (!threadId) return;
|
|
2596
|
+
inFlightRef.current += 1;
|
|
2597
|
+
setSaving(true);
|
|
2598
|
+
try {
|
|
2599
|
+
const url = threadUrl?.(threadId) ?? `/api/threads/${encodeURIComponent(threadId)}`;
|
|
2600
|
+
const res = await fetch(url, {
|
|
2601
|
+
method: "PATCH",
|
|
2602
|
+
headers: { "Content-Type": "application/json" },
|
|
2603
|
+
body: JSON.stringify({ planMode: next })
|
|
2604
|
+
});
|
|
2605
|
+
if (!res.ok && seqRef.current === seq) setValueState(prev);
|
|
2606
|
+
} catch {
|
|
2607
|
+
if (seqRef.current === seq) setValueState(prev);
|
|
2608
|
+
} finally {
|
|
2609
|
+
inFlightRef.current -= 1;
|
|
2610
|
+
setSaving(inFlightRef.current > 0);
|
|
2611
|
+
}
|
|
2612
|
+
},
|
|
2613
|
+
[threadId, threadUrl, value]
|
|
2614
|
+
);
|
|
2615
|
+
return { enabled: value, setEnabled: (next) => void update(next), saving };
|
|
2616
|
+
}
|
|
2617
|
+
|
|
2618
|
+
// src/web-react/use-models.ts
|
|
2619
|
+
import { useEffect as useEffect7, useRef as useRef9, useState as useState13 } from "react";
|
|
2620
|
+
var modelCache = /* @__PURE__ */ new Map();
|
|
2621
|
+
var STALE_AFTER_MS = 10 * 60 * 1e3;
|
|
2622
|
+
function useModels(options = {}) {
|
|
2623
|
+
const { enabled = true, url = "/api/models" } = options;
|
|
2624
|
+
const cached = modelCache.get(url);
|
|
2625
|
+
const [models, setModels] = useState13(cached?.data ?? []);
|
|
2626
|
+
const [catalog, setCatalog] = useState13(cached?.catalog ?? []);
|
|
2627
|
+
const [loading, setLoading] = useState13(enabled && !cached);
|
|
2628
|
+
const [error, setError] = useState13(null);
|
|
2629
|
+
const [reloadKey, setReloadKey] = useState13(0);
|
|
2630
|
+
const forceFetch = useRef9(false);
|
|
2631
|
+
useEffect7(() => {
|
|
2632
|
+
if (!enabled) {
|
|
2633
|
+
setLoading(false);
|
|
2634
|
+
return;
|
|
2635
|
+
}
|
|
2636
|
+
const entry = modelCache.get(url);
|
|
2637
|
+
const force = forceFetch.current;
|
|
2638
|
+
forceFetch.current = false;
|
|
2639
|
+
if (entry && Date.now() - entry.fetchedAt < STALE_AFTER_MS && !force) {
|
|
2640
|
+
setModels(entry.data);
|
|
2641
|
+
setCatalog(entry.catalog);
|
|
2642
|
+
setError(null);
|
|
2643
|
+
setLoading(false);
|
|
2644
|
+
return;
|
|
2645
|
+
}
|
|
2646
|
+
let cancelled = false;
|
|
2647
|
+
setLoading(true);
|
|
2648
|
+
setError(null);
|
|
2649
|
+
if (!entry) {
|
|
2650
|
+
setModels([]);
|
|
2651
|
+
setCatalog([]);
|
|
2652
|
+
}
|
|
2653
|
+
fetch(url, { credentials: "include" }).then(async (res) => {
|
|
2654
|
+
if (!res.ok) throw new Error(`${url} returned ${res.status}`);
|
|
2655
|
+
return res.json();
|
|
2656
|
+
}).then((body) => {
|
|
2657
|
+
if (cancelled) return;
|
|
2658
|
+
const data = Array.isArray(body.data) ? body.data : [];
|
|
2659
|
+
const catalogList = Array.isArray(body.catalog) ? body.catalog : [];
|
|
2660
|
+
modelCache.set(url, { fetchedAt: Date.now(), data, catalog: catalogList });
|
|
2661
|
+
setModels(data);
|
|
2662
|
+
setCatalog(catalogList);
|
|
2663
|
+
}).catch((err) => {
|
|
2664
|
+
if (cancelled) return;
|
|
2665
|
+
setError(err instanceof Error ? err.message : "Failed to load models");
|
|
2666
|
+
}).finally(() => {
|
|
2667
|
+
if (!cancelled) setLoading(false);
|
|
2668
|
+
});
|
|
2669
|
+
return () => {
|
|
2670
|
+
cancelled = true;
|
|
2671
|
+
};
|
|
2672
|
+
}, [enabled, url, reloadKey]);
|
|
2673
|
+
return {
|
|
2674
|
+
models,
|
|
2675
|
+
catalog,
|
|
2676
|
+
loading,
|
|
2677
|
+
error,
|
|
2678
|
+
reload: () => {
|
|
2679
|
+
forceFetch.current = true;
|
|
2680
|
+
setReloadKey((key) => key + 1);
|
|
2681
|
+
}
|
|
2682
|
+
};
|
|
2683
|
+
}
|
|
2684
|
+
|
|
2527
2685
|
// src/web-react/message-attachments.tsx
|
|
2528
|
-
import { useCallback as
|
|
2529
|
-
import { jsx as
|
|
2686
|
+
import { useCallback as useCallback6, useEffect as useEffect8, useState as useState14 } from "react";
|
|
2687
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2530
2688
|
function FileGlyph({ className }) {
|
|
2531
|
-
return /* @__PURE__ */
|
|
2532
|
-
/* @__PURE__ */
|
|
2533
|
-
/* @__PURE__ */
|
|
2689
|
+
return /* @__PURE__ */ jsxs9("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
2690
|
+
/* @__PURE__ */ jsx10("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
2691
|
+
/* @__PURE__ */ jsx10("path", { d: "M14 2v6h6" })
|
|
2534
2692
|
] });
|
|
2535
2693
|
}
|
|
2536
2694
|
function ImageGlyph({ className }) {
|
|
2537
|
-
return /* @__PURE__ */
|
|
2538
|
-
/* @__PURE__ */
|
|
2539
|
-
/* @__PURE__ */
|
|
2540
|
-
/* @__PURE__ */
|
|
2695
|
+
return /* @__PURE__ */ jsxs9("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
2696
|
+
/* @__PURE__ */ jsx10("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
|
|
2697
|
+
/* @__PURE__ */ jsx10("circle", { cx: "9", cy: "9", r: "2" }),
|
|
2698
|
+
/* @__PURE__ */ jsx10("path", { d: "m21 15-5-5L5 21" })
|
|
2541
2699
|
] });
|
|
2542
2700
|
}
|
|
2543
2701
|
function WarningGlyph({ className }) {
|
|
2544
|
-
return /* @__PURE__ */
|
|
2702
|
+
return /* @__PURE__ */ jsx10("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx10("path", { d: "M12 9v4m0 4h.01M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z" }) });
|
|
2545
2703
|
}
|
|
2546
2704
|
function iconForMediaType(mediaType) {
|
|
2547
2705
|
return mediaType?.startsWith("image/") ? ImageGlyph : FileGlyph;
|
|
@@ -2600,8 +2758,8 @@ function triggerAttachmentDownload(name, blob) {
|
|
|
2600
2758
|
}
|
|
2601
2759
|
}
|
|
2602
2760
|
function useAttachmentObjectUrl(blob) {
|
|
2603
|
-
const [url, setUrl] =
|
|
2604
|
-
|
|
2761
|
+
const [url, setUrl] = useState14(null);
|
|
2762
|
+
useEffect8(() => {
|
|
2605
2763
|
if (!blob) {
|
|
2606
2764
|
setUrl(null);
|
|
2607
2765
|
return;
|
|
@@ -2613,32 +2771,32 @@ function useAttachmentObjectUrl(blob) {
|
|
|
2613
2771
|
return url;
|
|
2614
2772
|
}
|
|
2615
2773
|
function AttachmentThumbnailError({ name }) {
|
|
2616
|
-
return /* @__PURE__ */
|
|
2617
|
-
/* @__PURE__ */
|
|
2618
|
-
/* @__PURE__ */
|
|
2774
|
+
return /* @__PURE__ */ jsxs9("span", { className: "inline-flex h-16 w-16 shrink-0 flex-col items-center justify-center gap-1 rounded-md border border-destructive/40 bg-destructive/10 px-1 text-center text-destructive", children: [
|
|
2775
|
+
/* @__PURE__ */ jsx10(WarningGlyph, { className: "h-4 w-4 shrink-0" }),
|
|
2776
|
+
/* @__PURE__ */ jsx10("span", { className: "line-clamp-2 text-xs leading-tight", children: name })
|
|
2619
2777
|
] });
|
|
2620
2778
|
}
|
|
2621
2779
|
function AttachmentUnavailable({ shape }) {
|
|
2622
2780
|
if (shape === "thumbnail") {
|
|
2623
|
-
return /* @__PURE__ */
|
|
2781
|
+
return /* @__PURE__ */ jsxs9(
|
|
2624
2782
|
"span",
|
|
2625
2783
|
{
|
|
2626
2784
|
"aria-disabled": "true",
|
|
2627
2785
|
className: "inline-flex h-16 w-16 shrink-0 flex-col items-center justify-center gap-1 rounded-md border border-border bg-muted px-1 text-center text-muted-foreground",
|
|
2628
2786
|
children: [
|
|
2629
|
-
/* @__PURE__ */
|
|
2630
|
-
/* @__PURE__ */
|
|
2787
|
+
/* @__PURE__ */ jsx10(WarningGlyph, { className: "h-4 w-4 shrink-0" }),
|
|
2788
|
+
/* @__PURE__ */ jsx10("span", { className: "line-clamp-2 text-xs leading-tight", children: "Attachment unavailable" })
|
|
2631
2789
|
]
|
|
2632
2790
|
}
|
|
2633
2791
|
);
|
|
2634
2792
|
}
|
|
2635
|
-
return /* @__PURE__ */
|
|
2793
|
+
return /* @__PURE__ */ jsxs9(
|
|
2636
2794
|
"span",
|
|
2637
2795
|
{
|
|
2638
2796
|
"aria-disabled": "true",
|
|
2639
2797
|
className: "inline-flex items-center gap-1 rounded-md border border-border bg-muted px-2 py-0.5 text-xs text-muted-foreground",
|
|
2640
2798
|
children: [
|
|
2641
|
-
/* @__PURE__ */
|
|
2799
|
+
/* @__PURE__ */ jsx10(WarningGlyph, { className: "h-3 w-3 shrink-0" }),
|
|
2642
2800
|
"Attachment unavailable"
|
|
2643
2801
|
]
|
|
2644
2802
|
}
|
|
@@ -2647,8 +2805,8 @@ function AttachmentUnavailable({ shape }) {
|
|
|
2647
2805
|
function AttachmentThumbnail({ part, resolveFileUrl, fetchFile }) {
|
|
2648
2806
|
const url = resolveFileUrl(part);
|
|
2649
2807
|
const displayName = attachmentDisplayName(part);
|
|
2650
|
-
const [result, setResult] =
|
|
2651
|
-
|
|
2808
|
+
const [result, setResult] = useState14(null);
|
|
2809
|
+
useEffect8(() => {
|
|
2652
2810
|
if (!displayName) return;
|
|
2653
2811
|
let cancelled = false;
|
|
2654
2812
|
setResult(null);
|
|
@@ -2660,35 +2818,35 @@ function AttachmentThumbnail({ part, resolveFileUrl, fetchFile }) {
|
|
|
2660
2818
|
};
|
|
2661
2819
|
}, [url, fetchFile, displayName]);
|
|
2662
2820
|
const objectUrl = useAttachmentObjectUrl(result?.ok ? result.blob : void 0);
|
|
2663
|
-
const handleClick =
|
|
2821
|
+
const handleClick = useCallback6(() => {
|
|
2664
2822
|
if (!objectUrl) return;
|
|
2665
2823
|
window.open(objectUrl, "_blank", "noopener");
|
|
2666
2824
|
}, [objectUrl]);
|
|
2667
2825
|
if (!displayName) {
|
|
2668
|
-
return /* @__PURE__ */
|
|
2826
|
+
return /* @__PURE__ */ jsx10(AttachmentUnavailable, { shape: "thumbnail" });
|
|
2669
2827
|
}
|
|
2670
2828
|
if (!result) {
|
|
2671
|
-
return /* @__PURE__ */
|
|
2829
|
+
return /* @__PURE__ */ jsx10("span", { "aria-hidden": "true", className: "inline-block h-16 w-16 shrink-0 animate-pulse rounded-md bg-muted" });
|
|
2672
2830
|
}
|
|
2673
2831
|
if (!result.ok || !objectUrl) {
|
|
2674
|
-
return /* @__PURE__ */
|
|
2832
|
+
return /* @__PURE__ */ jsx10(AttachmentThumbnailError, { name: displayName });
|
|
2675
2833
|
}
|
|
2676
|
-
return /* @__PURE__ */
|
|
2834
|
+
return /* @__PURE__ */ jsx10(
|
|
2677
2835
|
"button",
|
|
2678
2836
|
{
|
|
2679
2837
|
type: "button",
|
|
2680
2838
|
onClick: handleClick,
|
|
2681
2839
|
"aria-label": `Open ${displayName}`,
|
|
2682
2840
|
className: "h-16 w-16 shrink-0 overflow-hidden rounded-md border border-border",
|
|
2683
|
-
children: /* @__PURE__ */
|
|
2841
|
+
children: /* @__PURE__ */ jsx10("img", { src: objectUrl, alt: displayName, className: "h-16 w-16 object-cover" })
|
|
2684
2842
|
}
|
|
2685
2843
|
);
|
|
2686
2844
|
}
|
|
2687
2845
|
function AttachmentChip({ part, resolveFileUrl, fetchFile }) {
|
|
2688
2846
|
const displayName = attachmentDisplayName(part);
|
|
2689
|
-
const [status, setStatus] =
|
|
2690
|
-
const [errorMessage, setErrorMessage] =
|
|
2691
|
-
const handleClick =
|
|
2847
|
+
const [status, setStatus] = useState14("idle");
|
|
2848
|
+
const [errorMessage, setErrorMessage] = useState14(null);
|
|
2849
|
+
const handleClick = useCallback6(() => {
|
|
2692
2850
|
if (!displayName || status === "loading") return;
|
|
2693
2851
|
setStatus("loading");
|
|
2694
2852
|
setErrorMessage(null);
|
|
@@ -2709,14 +2867,14 @@ function AttachmentChip({ part, resolveFileUrl, fetchFile }) {
|
|
|
2709
2867
|
});
|
|
2710
2868
|
}, [displayName, status, resolveFileUrl, part, fetchFile]);
|
|
2711
2869
|
if (!displayName) {
|
|
2712
|
-
return /* @__PURE__ */
|
|
2870
|
+
return /* @__PURE__ */ jsx10(AttachmentUnavailable, { shape: "chip" });
|
|
2713
2871
|
}
|
|
2714
2872
|
const Icon = status === "error" ? WarningGlyph : iconForMediaType(part.mediaType);
|
|
2715
2873
|
const className = [
|
|
2716
2874
|
"inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-xs",
|
|
2717
2875
|
status === "error" ? "border-destructive/40 bg-destructive/10 text-destructive" : "border-border bg-secondary text-muted-foreground"
|
|
2718
2876
|
].join(" ");
|
|
2719
|
-
return /* @__PURE__ */
|
|
2877
|
+
return /* @__PURE__ */ jsxs9(
|
|
2720
2878
|
"button",
|
|
2721
2879
|
{
|
|
2722
2880
|
type: "button",
|
|
@@ -2724,9 +2882,9 @@ function AttachmentChip({ part, resolveFileUrl, fetchFile }) {
|
|
|
2724
2882
|
title: status === "error" ? errorMessage ?? void 0 : void 0,
|
|
2725
2883
|
className,
|
|
2726
2884
|
children: [
|
|
2727
|
-
/* @__PURE__ */
|
|
2885
|
+
/* @__PURE__ */ jsx10(Icon, { className: "h-3 w-3 shrink-0" }),
|
|
2728
2886
|
displayName,
|
|
2729
|
-
typeof part.size === "number" && /* @__PURE__ */
|
|
2887
|
+
typeof part.size === "number" && /* @__PURE__ */ jsxs9("span", { className: "text-muted-foreground/70", children: [
|
|
2730
2888
|
"\xB7 ",
|
|
2731
2889
|
formatDisplayBytes(part.size)
|
|
2732
2890
|
] })
|
|
@@ -2736,13 +2894,13 @@ function AttachmentChip({ part, resolveFileUrl, fetchFile }) {
|
|
|
2736
2894
|
}
|
|
2737
2895
|
function MessageAttachments({ parts, resolveFileUrl, justify = "end", fetchFile }) {
|
|
2738
2896
|
if (parts.length === 0) return null;
|
|
2739
|
-
return /* @__PURE__ */
|
|
2740
|
-
(part) => part.type === "image" ? /* @__PURE__ */
|
|
2897
|
+
return /* @__PURE__ */ jsx10("div", { className: `flex flex-wrap gap-1.5 ${justify === "start" ? "justify-start" : "justify-end"}`, children: parts.map(
|
|
2898
|
+
(part) => part.type === "image" ? /* @__PURE__ */ jsx10(AttachmentThumbnail, { part, resolveFileUrl, fetchFile }, `${part.path}:${part.name}`) : /* @__PURE__ */ jsx10(AttachmentChip, { part, resolveFileUrl, fetchFile }, `${part.path}:${part.name}`)
|
|
2741
2899
|
) });
|
|
2742
2900
|
}
|
|
2743
2901
|
|
|
2744
2902
|
// src/web-react/smooth-text.ts
|
|
2745
|
-
import { useEffect as
|
|
2903
|
+
import { useEffect as useEffect9, useRef as useRef10, useState as useState15 } from "react";
|
|
2746
2904
|
function nextRevealCount(shown, targetLength, dtMs, opts = {}) {
|
|
2747
2905
|
if (shown >= targetLength) return targetLength;
|
|
2748
2906
|
const base = opts.baseCharsPerSecond ?? 90;
|
|
@@ -2753,15 +2911,15 @@ function nextRevealCount(shown, targetLength, dtMs, opts = {}) {
|
|
|
2753
2911
|
return Math.min(targetLength, shown + rate * dtMs / 1e3);
|
|
2754
2912
|
}
|
|
2755
2913
|
function useSmoothText(target, enabled, opts) {
|
|
2756
|
-
const [, force] =
|
|
2757
|
-
const shownRef =
|
|
2758
|
-
const lastTargetRef =
|
|
2914
|
+
const [, force] = useState15(0);
|
|
2915
|
+
const shownRef = useRef10(0);
|
|
2916
|
+
const lastTargetRef = useRef10("");
|
|
2759
2917
|
if (!target.startsWith(lastTargetRef.current.slice(0, Math.floor(shownRef.current)))) {
|
|
2760
2918
|
shownRef.current = 0;
|
|
2761
2919
|
}
|
|
2762
2920
|
lastTargetRef.current = target;
|
|
2763
2921
|
if (!enabled) shownRef.current = target.length;
|
|
2764
|
-
|
|
2922
|
+
useEffect9(() => {
|
|
2765
2923
|
if (!enabled) return;
|
|
2766
2924
|
let raf = 0;
|
|
2767
2925
|
let last = null;
|
|
@@ -2782,9 +2940,9 @@ function useSmoothText(target, enabled, opts) {
|
|
|
2782
2940
|
}
|
|
2783
2941
|
|
|
2784
2942
|
// src/web-react/mission-activity.tsx
|
|
2785
|
-
import { useCallback as
|
|
2943
|
+
import { useCallback as useCallback7, useEffect as useEffect10, useState as useState16 } from "react";
|
|
2786
2944
|
import { FlowWaterfall } from "@tangle-network/charts/react";
|
|
2787
|
-
import { Fragment as Fragment2, jsx as
|
|
2945
|
+
import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2788
2946
|
var LIVE_STATUSES = /* @__PURE__ */ new Set(["pending", "running"]);
|
|
2789
2947
|
var OK_STATUSES = /* @__PURE__ */ new Set(["completed", "done", "succeeded"]);
|
|
2790
2948
|
var ERROR_STATUSES = /* @__PURE__ */ new Set(["failed", "error", "cancelled", "aborted"]);
|
|
@@ -2815,20 +2973,20 @@ function mergeActivityPages(existing, incoming) {
|
|
|
2815
2973
|
return [...byTask.values()].sort((a, b) => Date.parse(b.startedAt) - Date.parse(a.startedAt));
|
|
2816
2974
|
}
|
|
2817
2975
|
function ChevronGlyph({ className }) {
|
|
2818
|
-
return /* @__PURE__ */
|
|
2976
|
+
return /* @__PURE__ */ jsx11("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx11("path", { d: "m6 9 6 6 6-6" }) });
|
|
2819
2977
|
}
|
|
2820
2978
|
function RefreshGlyph({ className }) {
|
|
2821
|
-
return /* @__PURE__ */
|
|
2979
|
+
return /* @__PURE__ */ jsx11("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx11("path", { d: "M21 12a9 9 0 1 1-2.64-6.36M21 3v6h-6" }) });
|
|
2822
2980
|
}
|
|
2823
2981
|
function CopyGlyph({ className }) {
|
|
2824
|
-
return /* @__PURE__ */
|
|
2825
|
-
/* @__PURE__ */
|
|
2826
|
-
/* @__PURE__ */
|
|
2982
|
+
return /* @__PURE__ */ jsxs10("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
2983
|
+
/* @__PURE__ */ jsx11("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }),
|
|
2984
|
+
/* @__PURE__ */ jsx11("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
2827
2985
|
] });
|
|
2828
2986
|
}
|
|
2829
2987
|
function TraceIdCopy({ traceId }) {
|
|
2830
|
-
const [copied, setCopied] =
|
|
2831
|
-
const copy =
|
|
2988
|
+
const [copied, setCopied] = useState16(false);
|
|
2989
|
+
const copy = useCallback7(() => {
|
|
2832
2990
|
void navigator.clipboard?.writeText(traceId).then(
|
|
2833
2991
|
() => {
|
|
2834
2992
|
setCopied(true);
|
|
@@ -2838,7 +2996,7 @@ function TraceIdCopy({ traceId }) {
|
|
|
2838
2996
|
}
|
|
2839
2997
|
);
|
|
2840
2998
|
}, [traceId]);
|
|
2841
|
-
return /* @__PURE__ */
|
|
2999
|
+
return /* @__PURE__ */ jsxs10(
|
|
2842
3000
|
"button",
|
|
2843
3001
|
{
|
|
2844
3002
|
type: "button",
|
|
@@ -2847,29 +3005,29 @@ function TraceIdCopy({ traceId }) {
|
|
|
2847
3005
|
"aria-label": "Copy trace id",
|
|
2848
3006
|
className: "inline-flex min-w-0 items-center gap-1.5 rounded text-left font-mono text-muted-foreground transition hover:text-foreground",
|
|
2849
3007
|
children: [
|
|
2850
|
-
/* @__PURE__ */
|
|
2851
|
-
/* @__PURE__ */
|
|
2852
|
-
copied && /* @__PURE__ */
|
|
3008
|
+
/* @__PURE__ */ jsx11("span", { className: "truncate", children: traceId }),
|
|
3009
|
+
/* @__PURE__ */ jsx11(CopyGlyph, { className: "h-3 w-3 shrink-0" }),
|
|
3010
|
+
copied && /* @__PURE__ */ jsx11("span", { className: "shrink-0 not-italic text-success", children: "copied" })
|
|
2853
3011
|
]
|
|
2854
3012
|
}
|
|
2855
3013
|
);
|
|
2856
3014
|
}
|
|
2857
3015
|
function StatusDot({ tone }) {
|
|
2858
|
-
return /* @__PURE__ */
|
|
2859
|
-
/* @__PURE__ */
|
|
3016
|
+
return /* @__PURE__ */ jsxs10("span", { className: "inline-flex items-center", children: [
|
|
3017
|
+
/* @__PURE__ */ jsx11(
|
|
2860
3018
|
"span",
|
|
2861
3019
|
{
|
|
2862
3020
|
"aria-hidden": true,
|
|
2863
3021
|
className: `h-2 w-2 shrink-0 rounded-full ${tone === "live" ? "bg-warning" : tone === "ok" ? "bg-success" : tone === "error" ? "bg-destructive" : "bg-muted-foreground/40"}`
|
|
2864
3022
|
}
|
|
2865
3023
|
),
|
|
2866
|
-
/* @__PURE__ */
|
|
3024
|
+
/* @__PURE__ */ jsx11("span", { className: "sr-only", children: tone })
|
|
2867
3025
|
] });
|
|
2868
3026
|
}
|
|
2869
3027
|
function RunLabel({ tool, detail, live }) {
|
|
2870
|
-
return /* @__PURE__ */
|
|
2871
|
-
/* @__PURE__ */
|
|
2872
|
-
/* @__PURE__ */
|
|
3028
|
+
return /* @__PURE__ */ jsxs10("span", { className: "min-w-0 flex-1 truncate", children: [
|
|
3029
|
+
/* @__PURE__ */ jsx11("span", { className: live ? "agent-shimmer font-medium" : "font-medium", "data-motion": live ? "essential" : void 0, children: tool }),
|
|
3030
|
+
/* @__PURE__ */ jsxs10("span", { className: "text-muted-foreground", children: [
|
|
2873
3031
|
" \u2014 ",
|
|
2874
3032
|
detail
|
|
2875
3033
|
] })
|
|
@@ -2880,35 +3038,35 @@ function LaneRow({ run, staggerIndex }) {
|
|
|
2880
3038
|
const tone = activityTone(run.status);
|
|
2881
3039
|
const cost = formatActivityCost(run.costUsd);
|
|
2882
3040
|
const duration = formatActivityDuration(run.durationMs);
|
|
2883
|
-
return /* @__PURE__ */
|
|
2884
|
-
/* @__PURE__ */
|
|
2885
|
-
/* @__PURE__ */
|
|
2886
|
-
tone === "live" && (run.iteration !== void 0 || run.phase !== void 0) && /* @__PURE__ */
|
|
2887
|
-
/* @__PURE__ */
|
|
2888
|
-
tone !== "live" && tone !== "ok" && /* @__PURE__ */
|
|
2889
|
-
cost && /* @__PURE__ */
|
|
2890
|
-
duration && /* @__PURE__ */
|
|
3041
|
+
return /* @__PURE__ */ jsxs10("div", { className: "agent-arrive flex items-center gap-2 py-1 text-xs", style: arrival, children: [
|
|
3042
|
+
/* @__PURE__ */ jsx11(StatusDot, { tone }),
|
|
3043
|
+
/* @__PURE__ */ jsx11(RunLabel, { tool: run.tool, detail: run.detail, live: tone === "live" }),
|
|
3044
|
+
tone === "live" && (run.iteration !== void 0 || run.phase !== void 0) && /* @__PURE__ */ jsx11("span", { className: "shrink-0 rounded-full bg-warning/10 px-1.5 py-0.5 font-mono text-xs text-warning", children: [run.iteration !== void 0 ? `iter ${run.iteration}` : null, run.phase ?? null].filter(Boolean).join(" \xB7 ") }),
|
|
3045
|
+
/* @__PURE__ */ jsxs10("span", { className: "flex shrink-0 items-center gap-1.5 font-mono text-xs tabular-nums text-muted-foreground/70", children: [
|
|
3046
|
+
tone !== "live" && tone !== "ok" && /* @__PURE__ */ jsx11("span", { children: run.status }),
|
|
3047
|
+
cost && /* @__PURE__ */ jsx11("span", { children: cost }),
|
|
3048
|
+
duration && /* @__PURE__ */ jsx11("span", { children: duration })
|
|
2891
3049
|
] })
|
|
2892
3050
|
] });
|
|
2893
3051
|
}
|
|
2894
3052
|
function MissionActivityLane({ activity, startedAt, nowMs }) {
|
|
2895
|
-
const [expanded, setExpanded] =
|
|
3053
|
+
const [expanded, setExpanded] = useState16(false);
|
|
2896
3054
|
if (activity.length === 0) return null;
|
|
2897
|
-
return /* @__PURE__ */
|
|
2898
|
-
activity.map((run, index) => /* @__PURE__ */
|
|
2899
|
-
/* @__PURE__ */
|
|
3055
|
+
return /* @__PURE__ */ jsxs10("div", { className: "mt-1 border-l border-border pl-3", children: [
|
|
3056
|
+
activity.map((run, index) => /* @__PURE__ */ jsx11(LaneRow, { run, staggerIndex: index }, run.taskId)),
|
|
3057
|
+
/* @__PURE__ */ jsxs10(
|
|
2900
3058
|
"button",
|
|
2901
3059
|
{
|
|
2902
3060
|
type: "button",
|
|
2903
3061
|
onClick: () => setExpanded((v) => !v),
|
|
2904
3062
|
className: "flex items-center gap-1 py-0.5 text-xs font-medium text-muted-foreground/70 transition hover:text-foreground",
|
|
2905
3063
|
children: [
|
|
2906
|
-
/* @__PURE__ */
|
|
3064
|
+
/* @__PURE__ */ jsx11(ChevronGlyph, { className: `h-3 w-3 transition-transform ${expanded ? "rotate-180" : ""}` }),
|
|
2907
3065
|
"timeline"
|
|
2908
3066
|
]
|
|
2909
3067
|
}
|
|
2910
3068
|
),
|
|
2911
|
-
expanded && /* @__PURE__ */
|
|
3069
|
+
expanded && /* @__PURE__ */ jsx11("div", { className: "rounded-md border border-border bg-secondary p-2", children: /* @__PURE__ */ jsx11(
|
|
2912
3070
|
FlowWaterfall,
|
|
2913
3071
|
{
|
|
2914
3072
|
trace: stepActivityFlowTrace(activity, {
|
|
@@ -2925,39 +3083,39 @@ function ActivityRow({
|
|
|
2925
3083
|
staggerIndex
|
|
2926
3084
|
}) {
|
|
2927
3085
|
const arrival = useArrivalStyle(staggerIndex);
|
|
2928
|
-
const [open, setOpen] =
|
|
3086
|
+
const [open, setOpen] = useState16(false);
|
|
2929
3087
|
const tone = activityTone(record.status);
|
|
2930
3088
|
const cost = formatActivityCost(record.costUsd);
|
|
2931
3089
|
const duration = formatActivityDuration(record.durationMs);
|
|
2932
|
-
return /* @__PURE__ */
|
|
2933
|
-
/* @__PURE__ */
|
|
2934
|
-
/* @__PURE__ */
|
|
2935
|
-
/* @__PURE__ */
|
|
2936
|
-
tone === "live" && (record.iteration !== void 0 || record.phase !== void 0) && /* @__PURE__ */
|
|
2937
|
-
/* @__PURE__ */
|
|
3090
|
+
return /* @__PURE__ */ jsxs10("div", { className: "agent-arrive rounded-lg border border-card-edge bg-card", style: arrival, children: [
|
|
3091
|
+
/* @__PURE__ */ jsxs10("button", { type: "button", onClick: () => setOpen((v) => !v), className: "flex w-full items-center gap-2.5 px-3 py-2 text-left text-sm", children: [
|
|
3092
|
+
/* @__PURE__ */ jsx11(StatusDot, { tone }),
|
|
3093
|
+
/* @__PURE__ */ jsx11(RunLabel, { tool: record.tool, detail: record.detail, live: tone === "live" }),
|
|
3094
|
+
tone === "live" && (record.iteration !== void 0 || record.phase !== void 0) && /* @__PURE__ */ jsx11("span", { className: "shrink-0 rounded-full bg-warning/10 px-2 py-0.5 font-mono text-xs text-warning", children: [record.iteration !== void 0 ? `iter ${record.iteration}` : null, record.phase ?? null].filter(Boolean).join(" \xB7 ") }),
|
|
3095
|
+
/* @__PURE__ */ jsx11(
|
|
2938
3096
|
"span",
|
|
2939
3097
|
{
|
|
2940
3098
|
className: `shrink-0 rounded-full px-2 py-0.5 text-xs font-medium ${tone === "ok" ? "bg-success/10 text-success" : tone === "error" ? "bg-destructive/10 text-destructive" : tone === "live" ? "bg-warning/10 text-warning" : "bg-secondary text-muted-foreground"}`,
|
|
2941
3099
|
children: record.status
|
|
2942
3100
|
}
|
|
2943
3101
|
),
|
|
2944
|
-
cost && /* @__PURE__ */
|
|
2945
|
-
/* @__PURE__ */
|
|
3102
|
+
cost && /* @__PURE__ */ jsx11("span", { className: "shrink-0 font-mono text-xs tabular-nums text-muted-foreground", children: cost }),
|
|
3103
|
+
/* @__PURE__ */ jsx11(ChevronGlyph, { className: `h-3 w-3 shrink-0 text-muted-foreground transition-transform ${open ? "rotate-180" : ""}` })
|
|
2946
3104
|
] }),
|
|
2947
|
-
open && /* @__PURE__ */
|
|
2948
|
-
record.durationMs !== void 0 && /* @__PURE__ */
|
|
2949
|
-
/* @__PURE__ */
|
|
2950
|
-
/* @__PURE__ */
|
|
2951
|
-
/* @__PURE__ */
|
|
2952
|
-
/* @__PURE__ */
|
|
2953
|
-
/* @__PURE__ */
|
|
2954
|
-
duration && /* @__PURE__ */
|
|
2955
|
-
/* @__PURE__ */
|
|
2956
|
-
/* @__PURE__ */
|
|
3105
|
+
open && /* @__PURE__ */ jsxs10("div", { className: "space-y-2.5 border-t border-border px-3 py-2.5", children: [
|
|
3106
|
+
record.durationMs !== void 0 && /* @__PURE__ */ jsx11("div", { className: "rounded-md border border-border bg-secondary p-2", children: /* @__PURE__ */ jsx11(FlowWaterfall, { trace: stepActivityFlowTrace([record]) }) }),
|
|
3107
|
+
/* @__PURE__ */ jsxs10("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 font-mono text-xs", children: [
|
|
3108
|
+
/* @__PURE__ */ jsx11("dt", { className: "text-muted-foreground/60", children: "task" }),
|
|
3109
|
+
/* @__PURE__ */ jsx11("dd", { className: "truncate text-muted-foreground", children: record.taskId }),
|
|
3110
|
+
/* @__PURE__ */ jsx11("dt", { className: "text-muted-foreground/60", children: "started" }),
|
|
3111
|
+
/* @__PURE__ */ jsx11("dd", { className: "text-muted-foreground", children: new Date(record.startedAt).toLocaleString() }),
|
|
3112
|
+
duration && /* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
3113
|
+
/* @__PURE__ */ jsx11("dt", { className: "text-muted-foreground/60", children: "duration" }),
|
|
3114
|
+
/* @__PURE__ */ jsx11("dd", { className: "text-muted-foreground", children: duration })
|
|
2957
3115
|
] }),
|
|
2958
|
-
record.traceId && /* @__PURE__ */
|
|
2959
|
-
/* @__PURE__ */
|
|
2960
|
-
/* @__PURE__ */
|
|
3116
|
+
record.traceId && /* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
3117
|
+
/* @__PURE__ */ jsx11("dt", { className: "text-muted-foreground/60", children: "trace" }),
|
|
3118
|
+
/* @__PURE__ */ jsx11("dd", { className: "min-w-0", children: /* @__PURE__ */ jsx11(TraceIdCopy, { traceId: record.traceId }) })
|
|
2961
3119
|
] })
|
|
2962
3120
|
] }),
|
|
2963
3121
|
record.missionRef && renderMissionRef?.(record.missionRef, record)
|
|
@@ -2965,11 +3123,11 @@ function ActivityRow({
|
|
|
2965
3123
|
] });
|
|
2966
3124
|
}
|
|
2967
3125
|
function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent activity", emptyLabel = "No agent runs yet." }) {
|
|
2968
|
-
const [rows, setRows] =
|
|
2969
|
-
const [cursor, setCursor] =
|
|
2970
|
-
const [status, setStatus] =
|
|
2971
|
-
const [error, setError] =
|
|
2972
|
-
const load =
|
|
3126
|
+
const [rows, setRows] = useState16([]);
|
|
3127
|
+
const [cursor, setCursor] = useState16(void 0);
|
|
3128
|
+
const [status, setStatus] = useState16("loading");
|
|
3129
|
+
const [error, setError] = useState16(null);
|
|
3130
|
+
const load = useCallback7(
|
|
2973
3131
|
async (from) => {
|
|
2974
3132
|
setStatus("loading");
|
|
2975
3133
|
setError(null);
|
|
@@ -2985,14 +3143,14 @@ function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent ac
|
|
|
2985
3143
|
},
|
|
2986
3144
|
[fetchActivity]
|
|
2987
3145
|
);
|
|
2988
|
-
|
|
3146
|
+
useEffect10(() => {
|
|
2989
3147
|
void load();
|
|
2990
3148
|
}, [load]);
|
|
2991
3149
|
const loading = status === "loading";
|
|
2992
|
-
return /* @__PURE__ */
|
|
2993
|
-
/* @__PURE__ */
|
|
2994
|
-
/* @__PURE__ */
|
|
2995
|
-
/* @__PURE__ */
|
|
3150
|
+
return /* @__PURE__ */ jsxs10("div", { className: "space-y-2", children: [
|
|
3151
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
3152
|
+
/* @__PURE__ */ jsx11("h2", { className: "flex-1 text-sm font-semibold", children: title }),
|
|
3153
|
+
/* @__PURE__ */ jsx11(
|
|
2996
3154
|
"button",
|
|
2997
3155
|
{
|
|
2998
3156
|
type: "button",
|
|
@@ -3000,15 +3158,15 @@ function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent ac
|
|
|
3000
3158
|
disabled: loading,
|
|
3001
3159
|
"aria-label": "Refresh",
|
|
3002
3160
|
className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-accent hover:text-foreground disabled:opacity-50",
|
|
3003
|
-
children: /* @__PURE__ */
|
|
3161
|
+
children: /* @__PURE__ */ jsx11(RefreshGlyph, { className: `h-3.5 w-3.5 ${loading ? "animate-spin" : ""}` })
|
|
3004
3162
|
}
|
|
3005
3163
|
)
|
|
3006
3164
|
] }),
|
|
3007
|
-
status === "error" && /* @__PURE__ */
|
|
3008
|
-
status === "ready" && rows.length === 0 && /* @__PURE__ */
|
|
3009
|
-
/* @__PURE__ */
|
|
3010
|
-
/* @__PURE__ */
|
|
3011
|
-
cursor && /* @__PURE__ */
|
|
3165
|
+
status === "error" && /* @__PURE__ */ jsx11("p", { role: "alert", className: "rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive", children: error }),
|
|
3166
|
+
status === "ready" && rows.length === 0 && /* @__PURE__ */ jsx11("p", { className: "px-1 text-sm text-muted-foreground", children: emptyLabel }),
|
|
3167
|
+
/* @__PURE__ */ jsx11("span", { role: "status", "aria-live": "polite", "aria-busy": loading, className: "sr-only", children: loading ? "Loading activity\u2026" : "" }),
|
|
3168
|
+
/* @__PURE__ */ jsx11("div", { className: "space-y-1.5", "aria-busy": loading, children: rows.map((record, index) => /* @__PURE__ */ jsx11(ActivityRow, { record, renderMissionRef, staggerIndex: index }, record.taskId)) }),
|
|
3169
|
+
cursor && /* @__PURE__ */ jsx11(
|
|
3012
3170
|
"button",
|
|
3013
3171
|
{
|
|
3014
3172
|
type: "button",
|
|
@@ -3022,7 +3180,7 @@ function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent ac
|
|
|
3022
3180
|
}
|
|
3023
3181
|
|
|
3024
3182
|
// src/web-react/provenance.tsx
|
|
3025
|
-
import { useCallback as
|
|
3183
|
+
import { useCallback as useCallback8, useEffect as useEffect11, useId, useRef as useRef11, useState as useState17 } from "react";
|
|
3026
3184
|
|
|
3027
3185
|
// src/web-react/provenance-model.ts
|
|
3028
3186
|
var PROVENANCE_BASES = ["extracted", "entered", "computed", "asserted"];
|
|
@@ -3182,7 +3340,7 @@ function provenanceTriggerLabel(record, standing) {
|
|
|
3182
3340
|
}
|
|
3183
3341
|
|
|
3184
3342
|
// src/web-react/provenance.tsx
|
|
3185
|
-
import { jsx as
|
|
3343
|
+
import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3186
3344
|
var BASIS_TONES = {
|
|
3187
3345
|
extracted: "border-primary/30 bg-primary/10 text-primary",
|
|
3188
3346
|
entered: "border-success/30 bg-success/10 text-success",
|
|
@@ -3207,27 +3365,27 @@ function BasisGlyph({ basis, className }) {
|
|
|
3207
3365
|
};
|
|
3208
3366
|
switch (basis) {
|
|
3209
3367
|
case "extracted":
|
|
3210
|
-
return /* @__PURE__ */
|
|
3211
|
-
/* @__PURE__ */
|
|
3212
|
-
/* @__PURE__ */
|
|
3213
|
-
/* @__PURE__ */
|
|
3368
|
+
return /* @__PURE__ */ jsxs11("svg", { ...shared, children: [
|
|
3369
|
+
/* @__PURE__ */ jsx12("path", { d: "M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z" }),
|
|
3370
|
+
/* @__PURE__ */ jsx12("polyline", { points: "14 3 14 8 19 8" }),
|
|
3371
|
+
/* @__PURE__ */ jsx12("line", { x1: "9", y1: "13", x2: "15", y2: "13" })
|
|
3214
3372
|
] });
|
|
3215
3373
|
case "entered":
|
|
3216
|
-
return /* @__PURE__ */
|
|
3217
|
-
/* @__PURE__ */
|
|
3218
|
-
/* @__PURE__ */
|
|
3374
|
+
return /* @__PURE__ */ jsxs11("svg", { ...shared, children: [
|
|
3375
|
+
/* @__PURE__ */ jsx12("path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }),
|
|
3376
|
+
/* @__PURE__ */ jsx12("circle", { cx: "12", cy: "7", r: "4" })
|
|
3219
3377
|
] });
|
|
3220
3378
|
case "computed":
|
|
3221
|
-
return /* @__PURE__ */
|
|
3222
|
-
/* @__PURE__ */
|
|
3223
|
-
/* @__PURE__ */
|
|
3224
|
-
/* @__PURE__ */
|
|
3225
|
-
/* @__PURE__ */
|
|
3379
|
+
return /* @__PURE__ */ jsxs11("svg", { ...shared, children: [
|
|
3380
|
+
/* @__PURE__ */ jsx12("line", { x1: "4", y1: "9", x2: "20", y2: "9" }),
|
|
3381
|
+
/* @__PURE__ */ jsx12("line", { x1: "4", y1: "15", x2: "20", y2: "15" }),
|
|
3382
|
+
/* @__PURE__ */ jsx12("line", { x1: "10", y1: "3", x2: "8", y2: "21" }),
|
|
3383
|
+
/* @__PURE__ */ jsx12("line", { x1: "16", y1: "3", x2: "14", y2: "21" })
|
|
3226
3384
|
] });
|
|
3227
3385
|
case "asserted":
|
|
3228
|
-
return /* @__PURE__ */
|
|
3229
|
-
/* @__PURE__ */
|
|
3230
|
-
/* @__PURE__ */
|
|
3386
|
+
return /* @__PURE__ */ jsxs11("svg", { ...shared, children: [
|
|
3387
|
+
/* @__PURE__ */ jsx12("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" }),
|
|
3388
|
+
/* @__PURE__ */ jsx12("circle", { cx: "12", cy: "12", r: "3.2" })
|
|
3231
3389
|
] });
|
|
3232
3390
|
}
|
|
3233
3391
|
}
|
|
@@ -3247,11 +3405,11 @@ function SourceRow({
|
|
|
3247
3405
|
const status = source.status ?? "ready";
|
|
3248
3406
|
const statusLine = describeProvenanceSourceStatus(source);
|
|
3249
3407
|
const openable = status === "ready" && (onOpenSource !== void 0 || source.href !== void 0);
|
|
3250
|
-
return /* @__PURE__ */
|
|
3251
|
-
/* @__PURE__ */
|
|
3252
|
-
/* @__PURE__ */
|
|
3253
|
-
source.locator && /* @__PURE__ */
|
|
3254
|
-
openable && (onOpenSource ? /* @__PURE__ */
|
|
3408
|
+
return /* @__PURE__ */ jsxs11("li", { className: "rounded-md border border-card-edge bg-card px-2.5 py-2", children: [
|
|
3409
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap items-baseline gap-x-2 gap-y-1", children: [
|
|
3410
|
+
/* @__PURE__ */ jsx12("span", { className: "text-sm font-medium text-foreground", children: source.label }),
|
|
3411
|
+
source.locator && /* @__PURE__ */ jsx12("span", { className: "text-xs text-muted-foreground", children: source.locator }),
|
|
3412
|
+
openable && (onOpenSource ? /* @__PURE__ */ jsxs11(
|
|
3255
3413
|
"button",
|
|
3256
3414
|
{
|
|
3257
3415
|
type: "button",
|
|
@@ -3262,7 +3420,7 @@ function SourceRow({
|
|
|
3262
3420
|
source.label
|
|
3263
3421
|
]
|
|
3264
3422
|
}
|
|
3265
|
-
) : /* @__PURE__ */
|
|
3423
|
+
) : /* @__PURE__ */ jsxs11(
|
|
3266
3424
|
"a",
|
|
3267
3425
|
{
|
|
3268
3426
|
href: source.href,
|
|
@@ -3276,7 +3434,7 @@ function SourceRow({
|
|
|
3276
3434
|
}
|
|
3277
3435
|
))
|
|
3278
3436
|
] }),
|
|
3279
|
-
source.quote && /* @__PURE__ */
|
|
3437
|
+
source.quote && /* @__PURE__ */ jsxs11("blockquote", { className: "mt-1 border-l-2 border-primary/50 pl-2 text-[12px] italic leading-snug text-foreground", children: [
|
|
3280
3438
|
"\u201C",
|
|
3281
3439
|
source.quote,
|
|
3282
3440
|
"\u201D"
|
|
@@ -3285,14 +3443,14 @@ function SourceRow({
|
|
|
3285
3443
|
// update is theirs to read, not an interruption. Either way it is TEXT
|
|
3286
3444
|
// — a spinner alone and a greyed row alone both render as "nothing
|
|
3287
3445
|
// here".
|
|
3288
|
-
/* @__PURE__ */
|
|
3446
|
+
/* @__PURE__ */ jsxs11(
|
|
3289
3447
|
"p",
|
|
3290
3448
|
{
|
|
3291
3449
|
role: "status",
|
|
3292
3450
|
className: `mt-1 text-xs ${status === "unavailable" ? "text-destructive" : "text-muted-foreground"}`,
|
|
3293
3451
|
children: [
|
|
3294
3452
|
statusLine,
|
|
3295
|
-
status === "unavailable" && onRetrySource && /* @__PURE__ */
|
|
3453
|
+
status === "unavailable" && onRetrySource && /* @__PURE__ */ jsx12(
|
|
3296
3454
|
"button",
|
|
3297
3455
|
{
|
|
3298
3456
|
type: "button",
|
|
@@ -3316,9 +3474,9 @@ function ProvenanceValue({
|
|
|
3316
3474
|
missingValueLabel = DEFAULT_MISSING_VALUE_LABEL,
|
|
3317
3475
|
className
|
|
3318
3476
|
}) {
|
|
3319
|
-
const [open, setOpen] =
|
|
3320
|
-
const triggerRef =
|
|
3321
|
-
const rootRef =
|
|
3477
|
+
const [open, setOpen] = useState17(defaultOpen);
|
|
3478
|
+
const triggerRef = useRef11(null);
|
|
3479
|
+
const rootRef = useRef11(null);
|
|
3322
3480
|
const panelId = useId();
|
|
3323
3481
|
const standing = rollUpProvenanceStanding(record, confidencePolicy);
|
|
3324
3482
|
const basisMeta = provenanceBasisMeta(record.basis);
|
|
@@ -3328,7 +3486,7 @@ function ProvenanceValue({
|
|
|
3328
3486
|
const sources = record.sources ?? [];
|
|
3329
3487
|
const inputs = record.inputs ?? [];
|
|
3330
3488
|
const hasValue = record.display.trim() !== "";
|
|
3331
|
-
const onKeyDown =
|
|
3489
|
+
const onKeyDown = useCallback8(
|
|
3332
3490
|
(event) => {
|
|
3333
3491
|
if (event.key !== "Escape" || !open) return;
|
|
3334
3492
|
event.stopPropagation();
|
|
@@ -3337,11 +3495,11 @@ function ProvenanceValue({
|
|
|
3337
3495
|
},
|
|
3338
3496
|
[open]
|
|
3339
3497
|
);
|
|
3340
|
-
const onToggle =
|
|
3498
|
+
const onToggle = useCallback8(() => {
|
|
3341
3499
|
if (!open) closeTrailsOutside(rootRef.current);
|
|
3342
3500
|
setOpen(!open);
|
|
3343
3501
|
}, [open]);
|
|
3344
|
-
|
|
3502
|
+
useEffect11(() => {
|
|
3345
3503
|
const root = rootRef.current;
|
|
3346
3504
|
if (!open || root === null) return;
|
|
3347
3505
|
const entry = { root, close: () => setOpen(false) };
|
|
@@ -3359,12 +3517,12 @@ function ProvenanceValue({
|
|
|
3359
3517
|
document.removeEventListener("touchstart", onPointerDown, true);
|
|
3360
3518
|
};
|
|
3361
3519
|
}, [open]);
|
|
3362
|
-
const summary = /* @__PURE__ */
|
|
3363
|
-
record.label && /* @__PURE__ */
|
|
3364
|
-
/* @__PURE__ */
|
|
3520
|
+
const summary = /* @__PURE__ */ jsxs11("span", { className: "inline-flex flex-wrap items-baseline gap-x-1.5", children: [
|
|
3521
|
+
record.label && /* @__PURE__ */ jsx12("span", { className: "text-xs text-muted-foreground", children: record.label }),
|
|
3522
|
+
/* @__PURE__ */ jsx12("span", { className: hasValue ? "text-sm text-foreground" : "text-sm italic text-muted-foreground", children: hasValue ? record.display : missingValueLabel })
|
|
3365
3523
|
] });
|
|
3366
3524
|
if (maxDepth <= 0) {
|
|
3367
|
-
return /* @__PURE__ */
|
|
3525
|
+
return /* @__PURE__ */ jsxs11(
|
|
3368
3526
|
"div",
|
|
3369
3527
|
{
|
|
3370
3528
|
className: `inline-block max-w-full [overflow-wrap:anywhere] ${className ?? ""}`,
|
|
@@ -3372,22 +3530,22 @@ function ProvenanceValue({
|
|
|
3372
3530
|
"data-provenance-standing": standing,
|
|
3373
3531
|
children: [
|
|
3374
3532
|
summary,
|
|
3375
|
-
/* @__PURE__ */
|
|
3533
|
+
/* @__PURE__ */ jsxs11(
|
|
3376
3534
|
"span",
|
|
3377
3535
|
{
|
|
3378
3536
|
className: `ml-1.5 inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-xs font-medium ${BASIS_TONES[record.basis]}`,
|
|
3379
3537
|
children: [
|
|
3380
|
-
/* @__PURE__ */
|
|
3538
|
+
/* @__PURE__ */ jsx12(BasisGlyph, { basis: record.basis, className: "h-3 w-3" }),
|
|
3381
3539
|
basisMeta.label
|
|
3382
3540
|
]
|
|
3383
3541
|
}
|
|
3384
3542
|
),
|
|
3385
|
-
/* @__PURE__ */
|
|
3543
|
+
/* @__PURE__ */ jsx12("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: describeProvenance(record) })
|
|
3386
3544
|
]
|
|
3387
3545
|
}
|
|
3388
3546
|
);
|
|
3389
3547
|
}
|
|
3390
|
-
return /* @__PURE__ */
|
|
3548
|
+
return /* @__PURE__ */ jsxs11(
|
|
3391
3549
|
"div",
|
|
3392
3550
|
{
|
|
3393
3551
|
ref: rootRef,
|
|
@@ -3396,9 +3554,9 @@ function ProvenanceValue({
|
|
|
3396
3554
|
"data-provenance-basis": record.basis,
|
|
3397
3555
|
"data-provenance-standing": standing,
|
|
3398
3556
|
children: [
|
|
3399
|
-
/* @__PURE__ */
|
|
3557
|
+
/* @__PURE__ */ jsxs11("span", { className: "inline-flex flex-wrap items-baseline gap-1.5", children: [
|
|
3400
3558
|
summary,
|
|
3401
|
-
/* @__PURE__ */
|
|
3559
|
+
/* @__PURE__ */ jsxs11(
|
|
3402
3560
|
"button",
|
|
3403
3561
|
{
|
|
3404
3562
|
ref: triggerRef,
|
|
@@ -3409,17 +3567,17 @@ function ProvenanceValue({
|
|
|
3409
3567
|
"aria-label": provenanceTriggerLabel(record, standing),
|
|
3410
3568
|
className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-xs font-medium transition hover:brightness-105 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring ${BASIS_TONES[record.basis]}`,
|
|
3411
3569
|
children: [
|
|
3412
|
-
/* @__PURE__ */
|
|
3413
|
-
/* @__PURE__ */
|
|
3570
|
+
/* @__PURE__ */ jsx12(BasisGlyph, { basis: record.basis, className: "h-3 w-3" }),
|
|
3571
|
+
/* @__PURE__ */ jsx12("span", { "aria-hidden": true, children: basisMeta.label })
|
|
3414
3572
|
]
|
|
3415
3573
|
}
|
|
3416
3574
|
),
|
|
3417
3575
|
standing !== "settled" && // Legible at rest: what to do about the value does not wait for
|
|
3418
3576
|
// someone to open the panel. `aria-hidden` because the trigger's
|
|
3419
3577
|
// accessible name already carries it — this is the visual half.
|
|
3420
|
-
/* @__PURE__ */
|
|
3578
|
+
/* @__PURE__ */ jsx12("span", { "aria-hidden": true, className: `text-xs font-medium ${STANDING_TONES[standing]}`, children: standingMeta.label })
|
|
3421
3579
|
] }),
|
|
3422
|
-
open && /* @__PURE__ */
|
|
3580
|
+
open && /* @__PURE__ */ jsxs11(
|
|
3423
3581
|
"div",
|
|
3424
3582
|
{
|
|
3425
3583
|
id: panelId,
|
|
@@ -3427,19 +3585,19 @@ function ProvenanceValue({
|
|
|
3427
3585
|
"aria-label": provenanceTriggerLabel(record, standing),
|
|
3428
3586
|
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",
|
|
3429
3587
|
children: [
|
|
3430
|
-
/* @__PURE__ */
|
|
3431
|
-
/* @__PURE__ */
|
|
3432
|
-
/* @__PURE__ */
|
|
3588
|
+
/* @__PURE__ */ jsxs11("div", { children: [
|
|
3589
|
+
/* @__PURE__ */ jsx12("p", { className: "text-[12px] leading-snug text-foreground", children: describeProvenance(record) }),
|
|
3590
|
+
/* @__PURE__ */ jsxs11("p", { className: `mt-0.5 text-xs leading-snug ${STANDING_TONES[standing]}`, children: [
|
|
3433
3591
|
standingMeta.label,
|
|
3434
3592
|
" \u2014 ",
|
|
3435
3593
|
provenanceNextMove(record, standing, confidencePolicy)
|
|
3436
3594
|
] }),
|
|
3437
|
-
basisMeta.checkableAgainst === null && /* @__PURE__ */
|
|
3595
|
+
basisMeta.checkableAgainst === null && /* @__PURE__ */ jsxs11("p", { className: "mt-0.5 text-xs leading-snug text-muted-foreground", children: [
|
|
3438
3596
|
basisMeta.meaning,
|
|
3439
3597
|
" There is nothing outside the model to check it against."
|
|
3440
3598
|
] })
|
|
3441
3599
|
] }),
|
|
3442
|
-
sources.length > 0 && /* @__PURE__ */
|
|
3600
|
+
sources.length > 0 && /* @__PURE__ */ jsx12("ul", { className: "space-y-1.5", children: sources.map((source, index) => /* @__PURE__ */ jsx12(
|
|
3443
3601
|
SourceRow,
|
|
3444
3602
|
{
|
|
3445
3603
|
source,
|
|
@@ -3452,12 +3610,12 @@ function ProvenanceValue({
|
|
|
3452
3610
|
gaps.filter((gap) => gap.kind !== "unavailable-source").map((gap) => (
|
|
3453
3611
|
// An unavailable source already states itself on its own row; a
|
|
3454
3612
|
// structural gap has no row to state it, so it gets one here.
|
|
3455
|
-
/* @__PURE__ */
|
|
3613
|
+
/* @__PURE__ */ jsx12("p", { className: "rounded-md bg-destructive/10 px-2 py-1.5 text-xs leading-snug text-destructive", children: gap.message }, gap.kind)
|
|
3456
3614
|
)),
|
|
3457
|
-
loading.length > 0 && sources.length === 0 && /* @__PURE__ */
|
|
3458
|
-
inputs.length > 0 && /* @__PURE__ */
|
|
3459
|
-
/* @__PURE__ */
|
|
3460
|
-
/* @__PURE__ */
|
|
3615
|
+
loading.length > 0 && sources.length === 0 && /* @__PURE__ */ jsx12("p", { role: "status", className: "text-xs text-muted-foreground", children: "Looking up where this came from\u2026" }),
|
|
3616
|
+
inputs.length > 0 && /* @__PURE__ */ jsxs11("div", { className: "border-t border-border pt-2", children: [
|
|
3617
|
+
/* @__PURE__ */ jsx12("p", { className: "text-xs font-medium uppercase tracking-[0.05em] text-muted-foreground", children: record.derivation ? `Computed from ${record.derivation}` : "Computed from" }),
|
|
3618
|
+
/* @__PURE__ */ jsx12("ul", { className: "mt-1.5 space-y-1.5", children: inputs.map((input, index) => /* @__PURE__ */ jsx12("li", { children: /* @__PURE__ */ jsx12(
|
|
3461
3619
|
ProvenanceValue,
|
|
3462
3620
|
{
|
|
3463
3621
|
record: input,
|
|
@@ -3478,26 +3636,26 @@ function ProvenanceValue({
|
|
|
3478
3636
|
}
|
|
3479
3637
|
function ProvenanceLegend({ bases, className }) {
|
|
3480
3638
|
if (bases.length === 0) return null;
|
|
3481
|
-
return /* @__PURE__ */
|
|
3639
|
+
return /* @__PURE__ */ jsx12("ul", { className: `flex flex-wrap items-center gap-x-3 gap-y-1.5 ${className ?? ""}`, children: bases.map((basis) => {
|
|
3482
3640
|
const meta = provenanceBasisMeta(basis);
|
|
3483
|
-
return /* @__PURE__ */
|
|
3484
|
-
/* @__PURE__ */
|
|
3641
|
+
return /* @__PURE__ */ jsxs11("li", { className: "flex items-center gap-1.5 text-xs text-muted-foreground", children: [
|
|
3642
|
+
/* @__PURE__ */ jsxs11(
|
|
3485
3643
|
"span",
|
|
3486
3644
|
{
|
|
3487
3645
|
className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-xs font-medium ${BASIS_TONES[basis]}`,
|
|
3488
3646
|
children: [
|
|
3489
|
-
/* @__PURE__ */
|
|
3647
|
+
/* @__PURE__ */ jsx12(BasisGlyph, { basis, className: "h-3 w-3" }),
|
|
3490
3648
|
meta.label
|
|
3491
3649
|
]
|
|
3492
3650
|
}
|
|
3493
3651
|
),
|
|
3494
|
-
/* @__PURE__ */
|
|
3652
|
+
/* @__PURE__ */ jsx12("span", { children: meta.meaning })
|
|
3495
3653
|
] }, basis);
|
|
3496
3654
|
}) });
|
|
3497
3655
|
}
|
|
3498
3656
|
|
|
3499
3657
|
// src/web-react/seat-paywall.tsx
|
|
3500
|
-
import { Fragment as Fragment3, jsx as
|
|
3658
|
+
import { Fragment as Fragment3, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3501
3659
|
function usd(cents) {
|
|
3502
3660
|
return new Intl.NumberFormat("en-US", {
|
|
3503
3661
|
style: "currency",
|
|
@@ -3507,7 +3665,7 @@ function usd(cents) {
|
|
|
3507
3665
|
}).format(cents / 100);
|
|
3508
3666
|
}
|
|
3509
3667
|
function CheckGlyph3() {
|
|
3510
|
-
return /* @__PURE__ */
|
|
3668
|
+
return /* @__PURE__ */ jsx13(
|
|
3511
3669
|
"svg",
|
|
3512
3670
|
{
|
|
3513
3671
|
className: "h-4 w-4 shrink-0 text-primary",
|
|
@@ -3518,14 +3676,14 @@ function CheckGlyph3() {
|
|
|
3518
3676
|
strokeLinecap: "round",
|
|
3519
3677
|
strokeLinejoin: "round",
|
|
3520
3678
|
"aria-hidden": true,
|
|
3521
|
-
children: /* @__PURE__ */
|
|
3679
|
+
children: /* @__PURE__ */ jsx13("path", { d: "M20 6 9 17l-5-5" })
|
|
3522
3680
|
}
|
|
3523
3681
|
);
|
|
3524
3682
|
}
|
|
3525
3683
|
function Benefit({ children }) {
|
|
3526
|
-
return /* @__PURE__ */
|
|
3527
|
-
/* @__PURE__ */
|
|
3528
|
-
/* @__PURE__ */
|
|
3684
|
+
return /* @__PURE__ */ jsxs12("li", { className: "flex items-start gap-2.5 text-sm text-foreground", children: [
|
|
3685
|
+
/* @__PURE__ */ jsx13("span", { className: "mt-0.5", children: /* @__PURE__ */ jsx13(CheckGlyph3, {}) }),
|
|
3686
|
+
/* @__PURE__ */ jsx13("span", { children })
|
|
3529
3687
|
] });
|
|
3530
3688
|
}
|
|
3531
3689
|
function SeatPaywall({
|
|
@@ -3543,45 +3701,45 @@ function SeatPaywall({
|
|
|
3543
3701
|
const recurringPrice = offer ? usd(offer.recurring.priceCents) : `$${priceUsd}`;
|
|
3544
3702
|
const recurringUsage = offer ? usd(offer.recurring.includedCreditsCents) : `$${includedUsageUsd}`;
|
|
3545
3703
|
const introductory = offer?.introductory ?? null;
|
|
3546
|
-
return /* @__PURE__ */
|
|
3547
|
-
/* @__PURE__ */
|
|
3548
|
-
/* @__PURE__ */
|
|
3704
|
+
return /* @__PURE__ */ jsx13("div", { className: "flex min-h-[60vh] w-full items-center justify-center p-6", children: /* @__PURE__ */ jsxs12("div", { className: "w-full max-w-md rounded-2xl border border-card-edge bg-card p-8", children: [
|
|
3705
|
+
/* @__PURE__ */ jsx13("p", { className: "text-xs font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: product }),
|
|
3706
|
+
/* @__PURE__ */ jsxs12("h1", { className: "mt-2 text-2xl font-semibold tracking-tight text-foreground", children: [
|
|
3549
3707
|
"Unlock ",
|
|
3550
3708
|
product
|
|
3551
3709
|
] }),
|
|
3552
|
-
tagline && /* @__PURE__ */
|
|
3553
|
-
introductory ? /* @__PURE__ */
|
|
3554
|
-
/* @__PURE__ */
|
|
3555
|
-
/* @__PURE__ */
|
|
3556
|
-
/* @__PURE__ */
|
|
3710
|
+
tagline && /* @__PURE__ */ jsx13("p", { className: "mt-2 text-sm text-muted-foreground", children: tagline }),
|
|
3711
|
+
introductory ? /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
3712
|
+
/* @__PURE__ */ jsxs12("div", { className: "mt-6 flex items-baseline gap-1.5", children: [
|
|
3713
|
+
/* @__PURE__ */ jsx13("span", { className: "text-3xl font-semibold text-foreground", children: usd(introductory.priceCents) }),
|
|
3714
|
+
/* @__PURE__ */ jsx13("span", { className: "text-sm text-muted-foreground", children: "first month" })
|
|
3557
3715
|
] }),
|
|
3558
|
-
/* @__PURE__ */
|
|
3716
|
+
/* @__PURE__ */ jsxs12("p", { className: "mt-1 text-sm text-muted-foreground", children: [
|
|
3559
3717
|
"Includes ",
|
|
3560
3718
|
usd(introductory.includedCreditsCents),
|
|
3561
3719
|
" of AI usage in your first month"
|
|
3562
3720
|
] }),
|
|
3563
|
-
/* @__PURE__ */
|
|
3721
|
+
/* @__PURE__ */ jsxs12("p", { className: "mt-1 text-sm text-muted-foreground", children: [
|
|
3564
3722
|
"Then ",
|
|
3565
3723
|
recurringPrice,
|
|
3566
3724
|
"/mo \xB7 includes ",
|
|
3567
3725
|
recurringUsage,
|
|
3568
3726
|
"/mo of AI usage"
|
|
3569
3727
|
] })
|
|
3570
|
-
] }) : /* @__PURE__ */
|
|
3571
|
-
/* @__PURE__ */
|
|
3572
|
-
/* @__PURE__ */
|
|
3573
|
-
/* @__PURE__ */
|
|
3728
|
+
] }) : /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
3729
|
+
/* @__PURE__ */ jsxs12("div", { className: "mt-6 flex items-baseline gap-1.5", children: [
|
|
3730
|
+
/* @__PURE__ */ jsx13("span", { className: "text-3xl font-semibold text-foreground", children: recurringPrice }),
|
|
3731
|
+
/* @__PURE__ */ jsx13("span", { className: "text-sm text-muted-foreground", children: "/mo" })
|
|
3574
3732
|
] }),
|
|
3575
|
-
/* @__PURE__ */
|
|
3733
|
+
/* @__PURE__ */ jsxs12("p", { className: "mt-1 text-sm text-muted-foreground", children: [
|
|
3576
3734
|
"Includes ",
|
|
3577
3735
|
recurringUsage,
|
|
3578
3736
|
"/mo of AI usage"
|
|
3579
3737
|
] })
|
|
3580
3738
|
] }),
|
|
3581
|
-
/* @__PURE__ */
|
|
3739
|
+
/* @__PURE__ */ jsx13("ul", { className: "mt-6 space-y-2.5", children: (benefits ?? [
|
|
3582
3740
|
`Full access to ${product}`
|
|
3583
|
-
]).map((benefit, i) => /* @__PURE__ */
|
|
3584
|
-
/* @__PURE__ */
|
|
3741
|
+
]).map((benefit, i) => /* @__PURE__ */ jsx13(Benefit, { children: benefit }, i)) }),
|
|
3742
|
+
/* @__PURE__ */ jsx13(
|
|
3585
3743
|
"button",
|
|
3586
3744
|
{
|
|
3587
3745
|
type: "button",
|
|
@@ -3591,12 +3749,12 @@ function SeatPaywall({
|
|
|
3591
3749
|
children: pending ? "Opening checkout\u2026" : ctaLabel ?? "Continue to checkout"
|
|
3592
3750
|
}
|
|
3593
3751
|
),
|
|
3594
|
-
footnote && /* @__PURE__ */
|
|
3752
|
+
footnote && /* @__PURE__ */ jsx13("p", { className: "mt-3 text-center text-xs text-muted-foreground/70", children: footnote })
|
|
3595
3753
|
] }) });
|
|
3596
3754
|
}
|
|
3597
3755
|
|
|
3598
3756
|
// src/web-react/use-session-history.ts
|
|
3599
|
-
import { useCallback as
|
|
3757
|
+
import { useCallback as useCallback9, useEffect as useEffect12, useMemo as useMemo6, useRef as useRef12, useState as useState18 } from "react";
|
|
3600
3758
|
function seedSignature(page) {
|
|
3601
3759
|
return JSON.stringify({
|
|
3602
3760
|
nextCursor: page.nextCursor ?? null,
|
|
@@ -3617,24 +3775,24 @@ function useSessionHistory({
|
|
|
3617
3775
|
initialPage,
|
|
3618
3776
|
defaultSort = "newest"
|
|
3619
3777
|
}) {
|
|
3620
|
-
const [items, setItems] =
|
|
3621
|
-
const [nextCursor, setNextCursor] =
|
|
3622
|
-
const [phase, setPhase] =
|
|
3623
|
-
const [reloadKey, setReloadKey] =
|
|
3624
|
-
const seqRef =
|
|
3625
|
-
const resetAbortRef =
|
|
3626
|
-
const loadMoreAbortRef =
|
|
3627
|
-
const loadingMoreRef =
|
|
3628
|
-
const lastOpRef =
|
|
3629
|
-
const nextCursorRef =
|
|
3778
|
+
const [items, setItems] = useState18(initialPage.items);
|
|
3779
|
+
const [nextCursor, setNextCursor] = useState18(initialPage.nextCursor ?? null);
|
|
3780
|
+
const [phase, setPhase] = useState18("idle");
|
|
3781
|
+
const [reloadKey, setReloadKey] = useState18(0);
|
|
3782
|
+
const seqRef = useRef12(0);
|
|
3783
|
+
const resetAbortRef = useRef12(null);
|
|
3784
|
+
const loadMoreAbortRef = useRef12(null);
|
|
3785
|
+
const loadingMoreRef = useRef12(false);
|
|
3786
|
+
const lastOpRef = useRef12("first");
|
|
3787
|
+
const nextCursorRef = useRef12(nextCursor);
|
|
3630
3788
|
nextCursorRef.current = nextCursor;
|
|
3631
|
-
const viewRef =
|
|
3789
|
+
const viewRef = useRef12({ q, sort, fetchPage });
|
|
3632
3790
|
viewRef.current = { q, sort, fetchPage };
|
|
3633
|
-
const seedRef =
|
|
3791
|
+
const seedRef = useRef12(initialPage);
|
|
3634
3792
|
seedRef.current = initialPage;
|
|
3635
3793
|
const isDefaultView = q === "" && sort === defaultSort;
|
|
3636
3794
|
const seedKey = useMemo6(() => seedSignature(initialPage), [initialPage]);
|
|
3637
|
-
|
|
3795
|
+
useEffect12(() => {
|
|
3638
3796
|
resetAbortRef.current?.abort();
|
|
3639
3797
|
loadMoreAbortRef.current?.abort();
|
|
3640
3798
|
loadingMoreRef.current = false;
|
|
@@ -3665,7 +3823,7 @@ function useSessionHistory({
|
|
|
3665
3823
|
})();
|
|
3666
3824
|
return () => controller.abort();
|
|
3667
3825
|
}, [q, sort, seedKey, isDefaultView, reloadKey]);
|
|
3668
|
-
const loadMore =
|
|
3826
|
+
const loadMore = useCallback9(() => {
|
|
3669
3827
|
const cursor = nextCursorRef.current;
|
|
3670
3828
|
if (!cursor || loadingMoreRef.current) return;
|
|
3671
3829
|
const { q: currentQ, sort: currentSort, fetchPage: currentFetch } = viewRef.current;
|
|
@@ -3693,9 +3851,9 @@ function useSessionHistory({
|
|
|
3693
3851
|
}
|
|
3694
3852
|
|
|
3695
3853
|
// src/web-react/use-session-actions.tsx
|
|
3696
|
-
import { useCallback as
|
|
3854
|
+
import { useCallback as useCallback10, useState as useState19 } from "react";
|
|
3697
3855
|
import { Input } from "@tangle-network/ui/primitives";
|
|
3698
|
-
import { Fragment as Fragment4, jsx as
|
|
3856
|
+
import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3699
3857
|
var DEFAULT_LABELS = {
|
|
3700
3858
|
renameTitle: "Rename session",
|
|
3701
3859
|
renameField: "Title",
|
|
@@ -3719,21 +3877,21 @@ function useSessionActions({
|
|
|
3719
3877
|
labels
|
|
3720
3878
|
}) {
|
|
3721
3879
|
const text = { ...DEFAULT_LABELS, ...labels };
|
|
3722
|
-
const [renameTarget, setRenameTarget] =
|
|
3723
|
-
const [renameValue, setRenameValue] =
|
|
3724
|
-
const [deleteTarget, setDeleteTarget] =
|
|
3725
|
-
const [busy, setBusy] =
|
|
3726
|
-
const [error, setError] =
|
|
3727
|
-
const openRename =
|
|
3880
|
+
const [renameTarget, setRenameTarget] = useState19(null);
|
|
3881
|
+
const [renameValue, setRenameValue] = useState19("");
|
|
3882
|
+
const [deleteTarget, setDeleteTarget] = useState19(null);
|
|
3883
|
+
const [busy, setBusy] = useState19(false);
|
|
3884
|
+
const [error, setError] = useState19(null);
|
|
3885
|
+
const openRename = useCallback10((session) => {
|
|
3728
3886
|
setError(null);
|
|
3729
3887
|
setRenameTarget(session);
|
|
3730
3888
|
setRenameValue(session.title ?? "");
|
|
3731
3889
|
}, []);
|
|
3732
|
-
const openDelete =
|
|
3890
|
+
const openDelete = useCallback10((session) => {
|
|
3733
3891
|
setError(null);
|
|
3734
3892
|
setDeleteTarget(session);
|
|
3735
3893
|
}, []);
|
|
3736
|
-
const submitRename =
|
|
3894
|
+
const submitRename = useCallback10(async () => {
|
|
3737
3895
|
if (!renameTarget) return;
|
|
3738
3896
|
const title = renameValue.trim();
|
|
3739
3897
|
if (!title || title === renameTarget.title) {
|
|
@@ -3755,7 +3913,7 @@ function useSessionActions({
|
|
|
3755
3913
|
setBusy(false);
|
|
3756
3914
|
}
|
|
3757
3915
|
}, [renameTarget, renameValue, renameSession, notify, onChanged, text.renamed, text.renameFailed]);
|
|
3758
|
-
const confirmDelete =
|
|
3916
|
+
const confirmDelete = useCallback10(async () => {
|
|
3759
3917
|
if (!deleteTarget) return;
|
|
3760
3918
|
const deletingCurrent = currentSessionId != null && deleteTarget.id === currentSessionId;
|
|
3761
3919
|
setBusy(true);
|
|
@@ -3774,21 +3932,21 @@ function useSessionActions({
|
|
|
3774
3932
|
setBusy(false);
|
|
3775
3933
|
}
|
|
3776
3934
|
}, [deleteTarget, currentSessionId, deleteSession, notify, onChanged, onDeletedCurrent, text.deleted, text.deleteFailed]);
|
|
3777
|
-
const dialogs = /* @__PURE__ */
|
|
3778
|
-
renameTarget && /* @__PURE__ */
|
|
3935
|
+
const dialogs = /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
3936
|
+
renameTarget && /* @__PURE__ */ jsxs13(
|
|
3779
3937
|
ActionDialog,
|
|
3780
3938
|
{
|
|
3781
3939
|
title: text.renameTitle,
|
|
3782
3940
|
onClose: () => setRenameTarget(null),
|
|
3783
3941
|
busy,
|
|
3784
3942
|
error,
|
|
3785
|
-
footer: /* @__PURE__ */
|
|
3786
|
-
/* @__PURE__ */
|
|
3787
|
-
/* @__PURE__ */
|
|
3943
|
+
footer: /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
3944
|
+
/* @__PURE__ */ jsx14(ActionDialogButton, { onClick: () => setRenameTarget(null), disabled: busy, variant: "ghost", children: text.cancel }),
|
|
3945
|
+
/* @__PURE__ */ jsx14(ActionDialogButton, { onClick: () => void submitRename(), disabled: busy || !renameValue.trim(), children: text.renameSubmit })
|
|
3788
3946
|
] }),
|
|
3789
3947
|
children: [
|
|
3790
|
-
/* @__PURE__ */
|
|
3791
|
-
/* @__PURE__ */
|
|
3948
|
+
/* @__PURE__ */ jsx14("label", { htmlFor: "agent-app-rename-session", className: "text-xs text-muted-foreground", children: text.renameField }),
|
|
3949
|
+
/* @__PURE__ */ jsx14(
|
|
3792
3950
|
Input,
|
|
3793
3951
|
{
|
|
3794
3952
|
id: "agent-app-rename-session",
|
|
@@ -3807,18 +3965,18 @@ function useSessionActions({
|
|
|
3807
3965
|
]
|
|
3808
3966
|
}
|
|
3809
3967
|
),
|
|
3810
|
-
deleteTarget && /* @__PURE__ */
|
|
3968
|
+
deleteTarget && /* @__PURE__ */ jsx14(
|
|
3811
3969
|
ActionDialog,
|
|
3812
3970
|
{
|
|
3813
3971
|
title: text.deleteTitle,
|
|
3814
3972
|
onClose: () => setDeleteTarget(null),
|
|
3815
3973
|
busy,
|
|
3816
3974
|
error,
|
|
3817
|
-
footer: /* @__PURE__ */
|
|
3818
|
-
/* @__PURE__ */
|
|
3819
|
-
/* @__PURE__ */
|
|
3975
|
+
footer: /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
3976
|
+
/* @__PURE__ */ jsx14(ActionDialogButton, { onClick: () => setDeleteTarget(null), disabled: busy, variant: "ghost", children: text.cancel }),
|
|
3977
|
+
/* @__PURE__ */ jsx14(ActionDialogButton, { onClick: () => void confirmDelete(), disabled: busy, variant: "destructive", children: text.deleteSubmit })
|
|
3820
3978
|
] }),
|
|
3821
|
-
children: /* @__PURE__ */
|
|
3979
|
+
children: /* @__PURE__ */ jsx14("p", { className: "text-sm text-muted-foreground", children: text.deleteBody(sessionLabel(deleteTarget)) })
|
|
3822
3980
|
}
|
|
3823
3981
|
)
|
|
3824
3982
|
] });
|
|
@@ -3826,12 +3984,12 @@ function useSessionActions({
|
|
|
3826
3984
|
}
|
|
3827
3985
|
|
|
3828
3986
|
// src/web-react/session-history-panel.tsx
|
|
3829
|
-
import { useCallback as
|
|
3987
|
+
import { useCallback as useCallback11, useEffect as useEffect13, useId as useId2, useRef as useRef13, useState as useState20 } from "react";
|
|
3830
3988
|
import { Button as Button3, Checkbox, Input as Input2, Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@tangle-network/ui/primitives";
|
|
3831
3989
|
import { ShellHeader } from "@tangle-network/sandbox-ui/workspace";
|
|
3832
|
-
import { Fragment as Fragment5, jsx as
|
|
3990
|
+
import { Fragment as Fragment5, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3833
3991
|
function AnchorLink({ to, className, children }) {
|
|
3834
|
-
return /* @__PURE__ */
|
|
3992
|
+
return /* @__PURE__ */ jsx15("a", { href: to, className, children });
|
|
3835
3993
|
}
|
|
3836
3994
|
var MINUTE = 6e4;
|
|
3837
3995
|
var HOUR = 60 * MINUTE;
|
|
@@ -3848,17 +4006,17 @@ function formatSessionTimestamp(isoDate) {
|
|
|
3848
4006
|
return new Date(at).toLocaleDateString(void 0, { month: "short", day: "numeric" });
|
|
3849
4007
|
}
|
|
3850
4008
|
function SkeletonRows() {
|
|
3851
|
-
return /* @__PURE__ */
|
|
3852
|
-
/* @__PURE__ */
|
|
3853
|
-
/* @__PURE__ */
|
|
3854
|
-
/* @__PURE__ */
|
|
3855
|
-
/* @__PURE__ */
|
|
3856
|
-
/* @__PURE__ */
|
|
4009
|
+
return /* @__PURE__ */ jsxs14(Fragment5, { children: [
|
|
4010
|
+
/* @__PURE__ */ jsx15("span", { role: "status", "aria-live": "polite", "aria-busy": true, className: "sr-only", children: "Loading sessions\u2026" }),
|
|
4011
|
+
/* @__PURE__ */ jsx15("div", { className: "flex flex-col gap-0.5", "aria-hidden": true, children: Array.from({ length: 8 }).map((_, i) => /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-3 px-3 py-2.5", children: [
|
|
4012
|
+
/* @__PURE__ */ jsx15("div", { className: "h-4 w-4 animate-pulse rounded bg-muted" }),
|
|
4013
|
+
/* @__PURE__ */ jsx15("div", { className: "h-4 w-1/2 animate-pulse rounded bg-muted" }),
|
|
4014
|
+
/* @__PURE__ */ jsx15("div", { className: "ml-auto h-3 w-12 animate-pulse rounded bg-muted" })
|
|
3857
4015
|
] }, i)) })
|
|
3858
4016
|
] });
|
|
3859
4017
|
}
|
|
3860
4018
|
function MessageIcon({ className }) {
|
|
3861
|
-
return /* @__PURE__ */
|
|
4019
|
+
return /* @__PURE__ */ jsx15("svg", { viewBox: "0 0 24 24", className, fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx15("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }) });
|
|
3862
4020
|
}
|
|
3863
4021
|
function useSessionHistoryPanelViewState({
|
|
3864
4022
|
history,
|
|
@@ -3886,7 +4044,7 @@ function useSessionHistoryPanelViewState({
|
|
|
3886
4044
|
contentWidth = "reading",
|
|
3887
4045
|
className
|
|
3888
4046
|
}) {
|
|
3889
|
-
const scrollRef =
|
|
4047
|
+
const scrollRef = useRef13(null);
|
|
3890
4048
|
const sentinelRef = useInfiniteScroll(history.loadMore, {
|
|
3891
4049
|
enabled: history.hasMore && !history.isLoadingMore && !history.isError,
|
|
3892
4050
|
root: scrollRef,
|
|
@@ -3895,15 +4053,15 @@ function useSessionHistoryPanelViewState({
|
|
|
3895
4053
|
const searchTerm = query.trim();
|
|
3896
4054
|
const isSearching = searchTerm.length > 0;
|
|
3897
4055
|
const column = contentWidth === "full" ? "w-full" : "mx-auto w-full max-w-4xl";
|
|
3898
|
-
const [selectedIds, setSelectedIds] =
|
|
3899
|
-
const [ageDays, setAgeDays] =
|
|
3900
|
-
const [bulkTarget, setBulkTarget] =
|
|
3901
|
-
const [bulkBusy, setBulkBusy] =
|
|
3902
|
-
const [bulkError, setBulkError] =
|
|
3903
|
-
|
|
4056
|
+
const [selectedIds, setSelectedIds] = useState20(/* @__PURE__ */ new Set());
|
|
4057
|
+
const [ageDays, setAgeDays] = useState20("30");
|
|
4058
|
+
const [bulkTarget, setBulkTarget] = useState20(null);
|
|
4059
|
+
const [bulkBusy, setBulkBusy] = useState20(false);
|
|
4060
|
+
const [bulkError, setBulkError] = useState20(null);
|
|
4061
|
+
useEffect13(() => {
|
|
3904
4062
|
setSelectedIds(/* @__PURE__ */ new Set());
|
|
3905
4063
|
}, [searchTerm, sort]);
|
|
3906
|
-
|
|
4064
|
+
useEffect13(() => {
|
|
3907
4065
|
const visible = new Set(history.items.map((item) => item.id));
|
|
3908
4066
|
setSelectedIds((current) => {
|
|
3909
4067
|
const next = new Set([...current].filter((id) => visible.has(id)));
|
|
@@ -3914,7 +4072,7 @@ function useSessionHistoryPanelViewState({
|
|
|
3914
4072
|
const allVisibleSelected = history.items.length > 0 && history.items.every((item) => selectedIds.has(item.id));
|
|
3915
4073
|
const parsedAgeDays = Number(ageDays);
|
|
3916
4074
|
const validAgeDays = Number.isInteger(parsedAgeDays) && parsedAgeDays >= 1 && parsedAgeDays <= 36500;
|
|
3917
|
-
const openBulkAction =
|
|
4075
|
+
const openBulkAction = useCallback11((action) => {
|
|
3918
4076
|
const verb = deleteLabel.toLowerCase();
|
|
3919
4077
|
if (action.kind === "selected") {
|
|
3920
4078
|
setBulkTarget({
|
|
@@ -3931,7 +4089,7 @@ function useSessionHistoryPanelViewState({
|
|
|
3931
4089
|
body: "This applies to every matching session in this workspace, including sessions not currently loaded in this list."
|
|
3932
4090
|
});
|
|
3933
4091
|
}, [deleteLabel]);
|
|
3934
|
-
const confirmBulkAction =
|
|
4092
|
+
const confirmBulkAction = useCallback11(async () => {
|
|
3935
4093
|
if (!bulkTarget || !onBulkAction) return;
|
|
3936
4094
|
setBulkBusy(true);
|
|
3937
4095
|
setBulkError(null);
|
|
@@ -3994,7 +4152,7 @@ function useSessionHistoryPanelViewState({
|
|
|
3994
4152
|
}
|
|
3995
4153
|
function SessionHistoryPanel(props) {
|
|
3996
4154
|
const view = useSessionHistoryPanelViewState(props);
|
|
3997
|
-
return /* @__PURE__ */
|
|
4155
|
+
return /* @__PURE__ */ jsx15(SessionHistoryPanelView, { ...view });
|
|
3998
4156
|
}
|
|
3999
4157
|
function SessionHistoryPanelView({
|
|
4000
4158
|
className,
|
|
@@ -4041,25 +4199,25 @@ function SessionHistoryPanelView({
|
|
|
4041
4199
|
bulkError,
|
|
4042
4200
|
confirmBulkAction
|
|
4043
4201
|
}) {
|
|
4044
|
-
return /* @__PURE__ */
|
|
4045
|
-
showHeader && /* @__PURE__ */
|
|
4046
|
-
/* @__PURE__ */
|
|
4047
|
-
newSessionHref && /* @__PURE__ */
|
|
4202
|
+
return /* @__PURE__ */ jsxs14("div", { className: `flex min-h-0 min-w-0 flex-1 flex-col ${className ?? ""}`, children: [
|
|
4203
|
+
showHeader && /* @__PURE__ */ jsx15(ShellHeader, { as: "header", className: "bg-transparent px-4 sm:px-6", children: /* @__PURE__ */ jsxs14("div", { className: `flex items-center gap-3 px-3 ${column}`, children: [
|
|
4204
|
+
/* @__PURE__ */ jsx15("h1", { className: "flex-1 truncate text-sm font-semibold text-foreground", children: title }),
|
|
4205
|
+
newSessionHref && /* @__PURE__ */ jsxs14(
|
|
4048
4206
|
Link,
|
|
4049
4207
|
{
|
|
4050
4208
|
to: newSessionHref,
|
|
4051
4209
|
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",
|
|
4052
4210
|
children: [
|
|
4053
|
-
/* @__PURE__ */
|
|
4211
|
+
/* @__PURE__ */ jsx15("span", { "aria-hidden": true, className: "text-sm leading-none", children: "+" }),
|
|
4054
4212
|
"New chat"
|
|
4055
4213
|
]
|
|
4056
4214
|
}
|
|
4057
4215
|
)
|
|
4058
4216
|
] }) }),
|
|
4059
|
-
/* @__PURE__ */
|
|
4060
|
-
hasAnySessions && /* @__PURE__ */
|
|
4061
|
-
/* @__PURE__ */
|
|
4062
|
-
/* @__PURE__ */
|
|
4217
|
+
/* @__PURE__ */ jsxs14("div", { ref: scrollRef, className: "min-h-0 flex-1 overflow-y-auto", children: [
|
|
4218
|
+
hasAnySessions && /* @__PURE__ */ jsxs14("div", { className: "sticky top-0 z-10 bg-background px-4 sm:px-6", children: [
|
|
4219
|
+
/* @__PURE__ */ jsxs14("div", { className: `flex flex-col gap-2 px-3 pb-3 pt-4 sm:flex-row sm:items-center sm:gap-3 ${column}`, children: [
|
|
4220
|
+
/* @__PURE__ */ jsx15(
|
|
4063
4221
|
Input2,
|
|
4064
4222
|
{
|
|
4065
4223
|
type: "search",
|
|
@@ -4070,17 +4228,17 @@ function SessionHistoryPanelView({
|
|
|
4070
4228
|
className: "sm:flex-1 [&::-webkit-search-cancel-button]:appearance-none"
|
|
4071
4229
|
}
|
|
4072
4230
|
),
|
|
4073
|
-
/* @__PURE__ */
|
|
4074
|
-
/* @__PURE__ */
|
|
4075
|
-
/* @__PURE__ */
|
|
4076
|
-
/* @__PURE__ */
|
|
4077
|
-
/* @__PURE__ */
|
|
4231
|
+
/* @__PURE__ */ jsxs14(Select, { value: sort, onValueChange: (value) => onSortChange(value), children: [
|
|
4232
|
+
/* @__PURE__ */ jsx15(SelectTrigger, { "aria-label": "Sort sessions", className: "shrink-0 sm:w-[132px]", children: /* @__PURE__ */ jsx15(SelectValue, {}) }),
|
|
4233
|
+
/* @__PURE__ */ jsxs14(SelectContent, { children: [
|
|
4234
|
+
/* @__PURE__ */ jsx15(SelectItem, { value: "newest", children: "Newest" }),
|
|
4235
|
+
/* @__PURE__ */ jsx15(SelectItem, { value: "oldest", children: "Oldest" })
|
|
4078
4236
|
] })
|
|
4079
4237
|
] })
|
|
4080
4238
|
] }),
|
|
4081
|
-
onBulkAction && /* @__PURE__ */
|
|
4082
|
-
/* @__PURE__ */
|
|
4083
|
-
/* @__PURE__ */
|
|
4239
|
+
onBulkAction && /* @__PURE__ */ jsxs14("div", { className: `flex flex-col gap-2 border-t border-border px-3 py-3 ${column}`, children: [
|
|
4240
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
4241
|
+
/* @__PURE__ */ jsx15(
|
|
4084
4242
|
Button3,
|
|
4085
4243
|
{
|
|
4086
4244
|
type: "button",
|
|
@@ -4091,7 +4249,7 @@ function SessionHistoryPanelView({
|
|
|
4091
4249
|
children: "Select all"
|
|
4092
4250
|
}
|
|
4093
4251
|
),
|
|
4094
|
-
/* @__PURE__ */
|
|
4252
|
+
/* @__PURE__ */ jsx15(
|
|
4095
4253
|
Button3,
|
|
4096
4254
|
{
|
|
4097
4255
|
type: "button",
|
|
@@ -4102,7 +4260,7 @@ function SessionHistoryPanelView({
|
|
|
4102
4260
|
children: "Deselect all"
|
|
4103
4261
|
}
|
|
4104
4262
|
),
|
|
4105
|
-
selectedCount > 0 && /* @__PURE__ */
|
|
4263
|
+
selectedCount > 0 && /* @__PURE__ */ jsxs14(
|
|
4106
4264
|
Button3,
|
|
4107
4265
|
{
|
|
4108
4266
|
type: "button",
|
|
@@ -4116,9 +4274,9 @@ function SessionHistoryPanelView({
|
|
|
4116
4274
|
}
|
|
4117
4275
|
)
|
|
4118
4276
|
] }),
|
|
4119
|
-
/* @__PURE__ */
|
|
4120
|
-
/* @__PURE__ */
|
|
4121
|
-
/* @__PURE__ */
|
|
4277
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
4278
|
+
/* @__PURE__ */ jsx15("label", { htmlFor: "agent-app-session-age", className: "text-xs text-muted-foreground", children: "Session age" }),
|
|
4279
|
+
/* @__PURE__ */ jsx15(
|
|
4122
4280
|
Input2,
|
|
4123
4281
|
{
|
|
4124
4282
|
id: "agent-app-session-age",
|
|
@@ -4132,8 +4290,8 @@ function SessionHistoryPanelView({
|
|
|
4132
4290
|
className: "w-20 tabular-nums"
|
|
4133
4291
|
}
|
|
4134
4292
|
),
|
|
4135
|
-
/* @__PURE__ */
|
|
4136
|
-
/* @__PURE__ */
|
|
4293
|
+
/* @__PURE__ */ jsx15("span", { className: "text-xs text-muted-foreground", children: "days" }),
|
|
4294
|
+
/* @__PURE__ */ jsxs14(
|
|
4137
4295
|
Button3,
|
|
4138
4296
|
{
|
|
4139
4297
|
type: "button",
|
|
@@ -4147,7 +4305,7 @@ function SessionHistoryPanelView({
|
|
|
4147
4305
|
]
|
|
4148
4306
|
}
|
|
4149
4307
|
),
|
|
4150
|
-
/* @__PURE__ */
|
|
4308
|
+
/* @__PURE__ */ jsxs14(
|
|
4151
4309
|
Button3,
|
|
4152
4310
|
{
|
|
4153
4311
|
type: "button",
|
|
@@ -4164,15 +4322,15 @@ function SessionHistoryPanelView({
|
|
|
4164
4322
|
] })
|
|
4165
4323
|
] })
|
|
4166
4324
|
] }),
|
|
4167
|
-
/* @__PURE__ */
|
|
4168
|
-
/* @__PURE__ */
|
|
4169
|
-
/* @__PURE__ */
|
|
4170
|
-
] }) : history.isLoadingFirst ? /* @__PURE__ */
|
|
4325
|
+
/* @__PURE__ */ jsx15("div", { className: `px-4 pb-8 pt-1 sm:px-6 ${column}`, children: !hasAnySessions ? /* @__PURE__ */ jsxs14("div", { className: "flex min-h-[50vh] flex-col items-center justify-center gap-2 text-center", children: [
|
|
4326
|
+
/* @__PURE__ */ jsx15("p", { className: "text-sm font-medium text-foreground", children: emptyTitle }),
|
|
4327
|
+
/* @__PURE__ */ jsx15("p", { className: "max-w-xs text-xs text-muted-foreground", children: emptyDescription })
|
|
4328
|
+
] }) : history.isLoadingFirst ? /* @__PURE__ */ jsx15(SkeletonRows, {}) : history.items.length === 0 ? history.isError ? /* @__PURE__ */ jsx15(ErrorBlock, { onRetry: history.retry, message: "Couldn\u2019t load your sessions." }) : isSearching ? /* @__PURE__ */ jsxs14("p", { className: "py-16 text-center text-sm text-muted-foreground", children: [
|
|
4171
4329
|
"No sessions match \u201C",
|
|
4172
4330
|
searchTerm,
|
|
4173
4331
|
"\u201D."
|
|
4174
|
-
] }) : /* @__PURE__ */
|
|
4175
|
-
history.items.map((session) => /* @__PURE__ */
|
|
4332
|
+
] }) : /* @__PURE__ */ jsx15("p", { className: "py-16 text-center text-sm text-muted-foreground", children: "No sessions remain." }) : /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-0.5", children: [
|
|
4333
|
+
history.items.map((session) => /* @__PURE__ */ jsx15(
|
|
4176
4334
|
SessionRow,
|
|
4177
4335
|
{
|
|
4178
4336
|
session,
|
|
@@ -4199,10 +4357,10 @@ function SessionHistoryPanelView({
|
|
|
4199
4357
|
},
|
|
4200
4358
|
session.id
|
|
4201
4359
|
)),
|
|
4202
|
-
history.isError ? /* @__PURE__ */
|
|
4360
|
+
history.isError ? /* @__PURE__ */ jsx15(ErrorBlock, { onRetry: history.retry, message: "Couldn\u2019t load more sessions.", inline: true }) : history.hasMore ? /* @__PURE__ */ jsx15("div", { ref: sentinelRef, className: "flex items-center justify-center py-6", children: history.isLoadingMore && /* @__PURE__ */ jsx15("span", { role: "status", "aria-live": "polite", "aria-busy": true, className: "text-xs text-muted-foreground", children: "Loading\u2026" }) }) : null
|
|
4203
4361
|
] }) })
|
|
4204
4362
|
] }),
|
|
4205
|
-
bulkTarget && /* @__PURE__ */
|
|
4363
|
+
bulkTarget && /* @__PURE__ */ jsx15(
|
|
4206
4364
|
ActionDialog,
|
|
4207
4365
|
{
|
|
4208
4366
|
title: bulkTarget.title,
|
|
@@ -4214,8 +4372,8 @@ function SessionHistoryPanelView({
|
|
|
4214
4372
|
},
|
|
4215
4373
|
busy: bulkBusy,
|
|
4216
4374
|
error: bulkError,
|
|
4217
|
-
footer: /* @__PURE__ */
|
|
4218
|
-
/* @__PURE__ */
|
|
4375
|
+
footer: /* @__PURE__ */ jsxs14(Fragment5, { children: [
|
|
4376
|
+
/* @__PURE__ */ jsx15(
|
|
4219
4377
|
ActionDialogButton,
|
|
4220
4378
|
{
|
|
4221
4379
|
onClick: () => {
|
|
@@ -4227,21 +4385,21 @@ function SessionHistoryPanelView({
|
|
|
4227
4385
|
children: "Cancel"
|
|
4228
4386
|
}
|
|
4229
4387
|
),
|
|
4230
|
-
/* @__PURE__ */
|
|
4388
|
+
/* @__PURE__ */ jsx15(ActionDialogButton, { onClick: () => void confirmBulkAction(), disabled: bulkBusy, variant: "destructive", children: bulkBusy ? "Working\u2026" : deleteLabel })
|
|
4231
4389
|
] }),
|
|
4232
|
-
children: /* @__PURE__ */
|
|
4390
|
+
children: /* @__PURE__ */ jsx15("p", { className: "text-sm text-muted-foreground", children: bulkTarget.body })
|
|
4233
4391
|
}
|
|
4234
4392
|
)
|
|
4235
4393
|
] });
|
|
4236
4394
|
}
|
|
4237
4395
|
function ErrorBlock({ message, onRetry, inline }) {
|
|
4238
|
-
return /* @__PURE__ */
|
|
4396
|
+
return /* @__PURE__ */ jsxs14(
|
|
4239
4397
|
"div",
|
|
4240
4398
|
{
|
|
4241
4399
|
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",
|
|
4242
4400
|
children: [
|
|
4243
|
-
/* @__PURE__ */
|
|
4244
|
-
/* @__PURE__ */
|
|
4401
|
+
/* @__PURE__ */ jsx15("span", { className: "text-sm text-muted-foreground", children: message }),
|
|
4402
|
+
/* @__PURE__ */ jsx15(Button3, { type: "button", variant: "outline", size: "sm", onClick: onRetry, children: "Retry" })
|
|
4245
4403
|
]
|
|
4246
4404
|
}
|
|
4247
4405
|
);
|
|
@@ -4262,14 +4420,14 @@ function SessionRow({
|
|
|
4262
4420
|
selected,
|
|
4263
4421
|
onSelectedChange
|
|
4264
4422
|
}) {
|
|
4265
|
-
const [menuOpen, setMenuOpen] =
|
|
4423
|
+
const [menuOpen, setMenuOpen] = useState20(false);
|
|
4266
4424
|
const panelId = useId2();
|
|
4267
4425
|
const { containerRef, triggerRef, panelRef, triggerProps } = usePopover(menuOpen, setMenuOpen);
|
|
4268
4426
|
const extras = extraActions?.(session) ?? [];
|
|
4269
4427
|
const hasMenu = Boolean(onRename) || Boolean(onDelete) || extras.length > 0;
|
|
4270
4428
|
const showUnread = Boolean(session.unread) && !responding;
|
|
4271
|
-
return /* @__PURE__ */
|
|
4272
|
-
selectable && /* @__PURE__ */
|
|
4429
|
+
return /* @__PURE__ */ jsxs14("div", { className: `group relative flex items-center gap-2 rounded-lg px-3 py-2.5 transition-colors hover:bg-accent ${selected ? "bg-primary/10" : ""}`, children: [
|
|
4430
|
+
selectable && /* @__PURE__ */ jsx15(
|
|
4273
4431
|
Checkbox,
|
|
4274
4432
|
{
|
|
4275
4433
|
checked: selected,
|
|
@@ -4277,10 +4435,10 @@ function SessionRow({
|
|
|
4277
4435
|
"aria-label": `Select ${sessionLabel(session, untitledLabel)}`
|
|
4278
4436
|
}
|
|
4279
4437
|
),
|
|
4280
|
-
/* @__PURE__ */
|
|
4281
|
-
showUnread && /* @__PURE__ */
|
|
4282
|
-
/* @__PURE__ */
|
|
4283
|
-
/* @__PURE__ */
|
|
4438
|
+
/* @__PURE__ */ jsxs14(Link, { to: href, className: "flex min-w-0 flex-1 items-center gap-3", children: [
|
|
4439
|
+
showUnread && /* @__PURE__ */ jsx15("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-primary", "aria-hidden": true }),
|
|
4440
|
+
/* @__PURE__ */ jsx15(MessageIcon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
4441
|
+
/* @__PURE__ */ jsx15(
|
|
4284
4442
|
"span",
|
|
4285
4443
|
{
|
|
4286
4444
|
className: `truncate text-sm ${responding ? "text-muted-foreground" : "text-foreground"} ${showUnread ? "font-semibold" : ""}`,
|
|
@@ -4289,9 +4447,9 @@ function SessionRow({
|
|
|
4289
4447
|
}
|
|
4290
4448
|
)
|
|
4291
4449
|
] }),
|
|
4292
|
-
/* @__PURE__ */
|
|
4293
|
-
hasMenu && /* @__PURE__ */
|
|
4294
|
-
/* @__PURE__ */
|
|
4450
|
+
/* @__PURE__ */ jsx15("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: timestamp }),
|
|
4451
|
+
hasMenu && /* @__PURE__ */ jsxs14("div", { ref: containerRef, className: "relative shrink-0", children: [
|
|
4452
|
+
/* @__PURE__ */ jsx15(
|
|
4295
4453
|
Button3,
|
|
4296
4454
|
{
|
|
4297
4455
|
type: "button",
|
|
@@ -4302,10 +4460,10 @@ function SessionRow({
|
|
|
4302
4460
|
"aria-controls": menuOpen ? panelId : void 0,
|
|
4303
4461
|
onClick: () => setMenuOpen((open) => !open),
|
|
4304
4462
|
className: "text-muted-foreground focus-visible:opacity-100 sm:opacity-0 sm:group-hover:opacity-100 aria-expanded:opacity-100",
|
|
4305
|
-
children: /* @__PURE__ */
|
|
4463
|
+
children: /* @__PURE__ */ jsx15("span", { "aria-hidden": true, className: "text-base leading-none", children: "\u22EF" })
|
|
4306
4464
|
}
|
|
4307
4465
|
),
|
|
4308
|
-
/* @__PURE__ */
|
|
4466
|
+
/* @__PURE__ */ jsxs14(
|
|
4309
4467
|
PopoverSurface,
|
|
4310
4468
|
{
|
|
4311
4469
|
open: menuOpen,
|
|
@@ -4315,7 +4473,7 @@ function SessionRow({
|
|
|
4315
4473
|
panelRef,
|
|
4316
4474
|
className: `w-36 overflow-hidden rounded-md border border-card-edge bg-popover py-1 ${OVERLAY_SHADOW}`,
|
|
4317
4475
|
children: [
|
|
4318
|
-
onRename && /* @__PURE__ */
|
|
4476
|
+
onRename && /* @__PURE__ */ jsx15(
|
|
4319
4477
|
"button",
|
|
4320
4478
|
{
|
|
4321
4479
|
type: "button",
|
|
@@ -4328,7 +4486,7 @@ function SessionRow({
|
|
|
4328
4486
|
children: renameLabel
|
|
4329
4487
|
}
|
|
4330
4488
|
),
|
|
4331
|
-
extras.map((action) => /* @__PURE__ */
|
|
4489
|
+
extras.map((action) => /* @__PURE__ */ jsx15(
|
|
4332
4490
|
"button",
|
|
4333
4491
|
{
|
|
4334
4492
|
type: "button",
|
|
@@ -4342,7 +4500,7 @@ function SessionRow({
|
|
|
4342
4500
|
},
|
|
4343
4501
|
action.id
|
|
4344
4502
|
)),
|
|
4345
|
-
onDelete && /* @__PURE__ */
|
|
4503
|
+
onDelete && /* @__PURE__ */ jsx15(
|
|
4346
4504
|
"button",
|
|
4347
4505
|
{
|
|
4348
4506
|
type: "button",
|
|
@@ -4814,21 +4972,21 @@ async function createRecordGridRow({
|
|
|
4814
4972
|
import {
|
|
4815
4973
|
Fragment as Fragment6,
|
|
4816
4974
|
isValidElement,
|
|
4817
|
-
useCallback as
|
|
4818
|
-
useEffect as
|
|
4975
|
+
useCallback as useCallback13,
|
|
4976
|
+
useEffect as useEffect14,
|
|
4819
4977
|
useId as useId3,
|
|
4820
4978
|
useMemo as useMemo8,
|
|
4821
|
-
useRef as
|
|
4822
|
-
useState as
|
|
4979
|
+
useRef as useRef14,
|
|
4980
|
+
useState as useState21
|
|
4823
4981
|
} from "react";
|
|
4824
4982
|
import { Button as Button4, EmptyState, Skeleton, Table, TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell } from "@tangle-network/ui/primitives";
|
|
4825
4983
|
|
|
4826
4984
|
// src/web-react/record-grid-review-actions.tsx
|
|
4827
|
-
import { jsx as
|
|
4985
|
+
import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4828
4986
|
function ReviewActions({ rowId, kind, rowLabel, onAccept, onReject }) {
|
|
4829
4987
|
const noun = kind === "changed" ? `proposed change to ${rowLabel}` : kind === "added" ? `new row ${rowLabel}` : `removal of ${rowLabel}`;
|
|
4830
|
-
return /* @__PURE__ */
|
|
4831
|
-
onReject && /* @__PURE__ */
|
|
4988
|
+
return /* @__PURE__ */ jsxs15("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
4989
|
+
onReject && /* @__PURE__ */ jsx16(
|
|
4832
4990
|
"button",
|
|
4833
4991
|
{
|
|
4834
4992
|
type: "button",
|
|
@@ -4838,7 +4996,7 @@ function ReviewActions({ rowId, kind, rowLabel, onAccept, onReject }) {
|
|
|
4838
4996
|
children: "Reject"
|
|
4839
4997
|
}
|
|
4840
4998
|
),
|
|
4841
|
-
onAccept && /* @__PURE__ */
|
|
4999
|
+
onAccept && /* @__PURE__ */ jsx16(
|
|
4842
5000
|
"button",
|
|
4843
5001
|
{
|
|
4844
5002
|
type: "button",
|
|
@@ -4853,7 +5011,7 @@ function ReviewActions({ rowId, kind, rowLabel, onAccept, onReject }) {
|
|
|
4853
5011
|
|
|
4854
5012
|
// src/web-react/record-grid-editors.tsx
|
|
4855
5013
|
import { useMemo as useMemo7 } from "react";
|
|
4856
|
-
import { jsx as
|
|
5014
|
+
import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4857
5015
|
var INPUT_CLASS = "w-full rounded-md border border-strong bg-background px-2 py-1 text-sm text-foreground outline-none focus:border-primary/60 focus:ring-1 focus:ring-primary/40";
|
|
4858
5016
|
function groupColumns(columns) {
|
|
4859
5017
|
const groups = [];
|
|
@@ -4874,7 +5032,7 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
4874
5032
|
className: INPUT_CLASS
|
|
4875
5033
|
};
|
|
4876
5034
|
if (column.kind === "select") {
|
|
4877
|
-
return /* @__PURE__ */
|
|
5035
|
+
return /* @__PURE__ */ jsxs16(
|
|
4878
5036
|
"select",
|
|
4879
5037
|
{
|
|
4880
5038
|
...shared,
|
|
@@ -4891,8 +5049,8 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
4891
5049
|
},
|
|
4892
5050
|
onBlur: () => onCommit(text),
|
|
4893
5051
|
children: [
|
|
4894
|
-
/* @__PURE__ */
|
|
4895
|
-
column.options.map((option) => /* @__PURE__ */
|
|
5052
|
+
/* @__PURE__ */ jsx17("option", { value: "", children: "\u2014" }),
|
|
5053
|
+
column.options.map((option) => /* @__PURE__ */ jsx17("option", { value: option.value, children: option.label }, option.value))
|
|
4896
5054
|
]
|
|
4897
5055
|
}
|
|
4898
5056
|
);
|
|
@@ -4910,7 +5068,7 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
4910
5068
|
}
|
|
4911
5069
|
};
|
|
4912
5070
|
if (column.kind === "text" && column.multiline === true) {
|
|
4913
|
-
return /* @__PURE__ */
|
|
5071
|
+
return /* @__PURE__ */ jsx17(
|
|
4914
5072
|
"textarea",
|
|
4915
5073
|
{
|
|
4916
5074
|
...shared,
|
|
@@ -4922,7 +5080,7 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
4922
5080
|
}
|
|
4923
5081
|
);
|
|
4924
5082
|
}
|
|
4925
|
-
return /* @__PURE__ */
|
|
5083
|
+
return /* @__PURE__ */ jsx17(
|
|
4926
5084
|
"input",
|
|
4927
5085
|
{
|
|
4928
5086
|
...shared,
|
|
@@ -4948,7 +5106,7 @@ function AddRecordForm({
|
|
|
4948
5106
|
onCancel
|
|
4949
5107
|
}) {
|
|
4950
5108
|
const groups = useMemo7(() => groupColumns(columns), [columns]);
|
|
4951
|
-
return /* @__PURE__ */
|
|
5109
|
+
return /* @__PURE__ */ jsxs16(
|
|
4952
5110
|
"form",
|
|
4953
5111
|
{
|
|
4954
5112
|
noValidate: true,
|
|
@@ -4959,31 +5117,31 @@ function AddRecordForm({
|
|
|
4959
5117
|
},
|
|
4960
5118
|
className: "space-y-4 rounded-xl border border-card-edge bg-card p-4",
|
|
4961
5119
|
children: [
|
|
4962
|
-
/* @__PURE__ */
|
|
4963
|
-
formError !== null && /* @__PURE__ */
|
|
5120
|
+
/* @__PURE__ */ jsx17("h3", { className: "text-sm font-semibold text-foreground", children: label }),
|
|
5121
|
+
formError !== null && /* @__PURE__ */ jsx17("p", { role: "alert", className: "rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive", children: formError }),
|
|
4964
5122
|
groups.map((group) => {
|
|
4965
5123
|
const fields = group.columns.filter((column) => isRecordGridCellApplicable(column, draft));
|
|
4966
5124
|
if (fields.length === 0) return null;
|
|
4967
|
-
return /* @__PURE__ */
|
|
5125
|
+
return /* @__PURE__ */ jsxs16(
|
|
4968
5126
|
"fieldset",
|
|
4969
5127
|
{
|
|
4970
5128
|
className: group.label === null ? "min-w-0" : "min-w-0 rounded-lg border border-card-edge p-3",
|
|
4971
5129
|
children: [
|
|
4972
|
-
group.label !== null && /* @__PURE__ */
|
|
4973
|
-
/* @__PURE__ */
|
|
5130
|
+
group.label !== null && /* @__PURE__ */ jsx17("legend", { className: "px-1 text-xs font-medium text-muted-foreground", children: group.label }),
|
|
5131
|
+
/* @__PURE__ */ jsx17("div", { className: "grid gap-3 sm:grid-cols-2", children: fields.map((column) => {
|
|
4974
5132
|
const fieldId = `${fieldPrefix}-${column.id}`;
|
|
4975
5133
|
const errorId = `${fieldId}-error`;
|
|
4976
5134
|
const message = errors[column.id];
|
|
4977
|
-
return /* @__PURE__ */
|
|
5135
|
+
return /* @__PURE__ */ jsxs16(
|
|
4978
5136
|
"div",
|
|
4979
5137
|
{
|
|
4980
5138
|
className: column.kind === "text" && column.multiline === true ? "sm:col-span-2" : "",
|
|
4981
5139
|
children: [
|
|
4982
|
-
/* @__PURE__ */
|
|
5140
|
+
/* @__PURE__ */ jsxs16("label", { htmlFor: fieldId, className: "mb-1 block text-xs font-medium text-muted-foreground", children: [
|
|
4983
5141
|
column.header,
|
|
4984
|
-
column.required === true && /* @__PURE__ */
|
|
5142
|
+
column.required === true && /* @__PURE__ */ jsx17("span", { className: "ml-0.5 text-destructive", children: "*" })
|
|
4985
5143
|
] }),
|
|
4986
|
-
/* @__PURE__ */
|
|
5144
|
+
/* @__PURE__ */ jsx17(
|
|
4987
5145
|
DraftField,
|
|
4988
5146
|
{
|
|
4989
5147
|
column,
|
|
@@ -4994,8 +5152,8 @@ function AddRecordForm({
|
|
|
4994
5152
|
onValue: (next) => setDraft({ ...draft, [column.id]: next })
|
|
4995
5153
|
}
|
|
4996
5154
|
),
|
|
4997
|
-
column.hint && /* @__PURE__ */
|
|
4998
|
-
message !== void 0 && /* @__PURE__ */
|
|
5155
|
+
column.hint && /* @__PURE__ */ jsx17("p", { className: "mt-1 text-xs text-muted-foreground", children: column.hint }),
|
|
5156
|
+
message !== void 0 && /* @__PURE__ */ jsx17("p", { id: errorId, role: "alert", className: "mt-1 text-xs text-destructive", children: message })
|
|
4999
5157
|
]
|
|
5000
5158
|
},
|
|
5001
5159
|
column.id
|
|
@@ -5006,8 +5164,8 @@ function AddRecordForm({
|
|
|
5006
5164
|
group.label ?? "_"
|
|
5007
5165
|
);
|
|
5008
5166
|
}),
|
|
5009
|
-
/* @__PURE__ */
|
|
5010
|
-
/* @__PURE__ */
|
|
5167
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2", children: [
|
|
5168
|
+
/* @__PURE__ */ jsx17(
|
|
5011
5169
|
"button",
|
|
5012
5170
|
{
|
|
5013
5171
|
type: "submit",
|
|
@@ -5016,7 +5174,7 @@ function AddRecordForm({
|
|
|
5016
5174
|
children: busy ? "Saving\u2026" : "Save"
|
|
5017
5175
|
}
|
|
5018
5176
|
),
|
|
5019
|
-
/* @__PURE__ */
|
|
5177
|
+
/* @__PURE__ */ jsx17(
|
|
5020
5178
|
"button",
|
|
5021
5179
|
{
|
|
5022
5180
|
type: "button",
|
|
@@ -5037,7 +5195,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
5037
5195
|
"aria-describedby": describedBy
|
|
5038
5196
|
};
|
|
5039
5197
|
if (column.kind === "boolean") {
|
|
5040
|
-
return /* @__PURE__ */
|
|
5198
|
+
return /* @__PURE__ */ jsx17(
|
|
5041
5199
|
"input",
|
|
5042
5200
|
{
|
|
5043
5201
|
...shared,
|
|
@@ -5049,7 +5207,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
5049
5207
|
);
|
|
5050
5208
|
}
|
|
5051
5209
|
if (column.kind === "select") {
|
|
5052
|
-
return /* @__PURE__ */
|
|
5210
|
+
return /* @__PURE__ */ jsxs16(
|
|
5053
5211
|
"select",
|
|
5054
5212
|
{
|
|
5055
5213
|
...shared,
|
|
@@ -5057,14 +5215,14 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
5057
5215
|
value: typeof value === "string" ? value : "",
|
|
5058
5216
|
onChange: (event) => onValue(event.target.value === "" ? null : event.target.value),
|
|
5059
5217
|
children: [
|
|
5060
|
-
/* @__PURE__ */
|
|
5061
|
-
column.options.map((option) => /* @__PURE__ */
|
|
5218
|
+
/* @__PURE__ */ jsx17("option", { value: "", children: "\u2014" }),
|
|
5219
|
+
column.options.map((option) => /* @__PURE__ */ jsx17("option", { value: option.value, children: option.label }, option.value))
|
|
5062
5220
|
]
|
|
5063
5221
|
}
|
|
5064
5222
|
);
|
|
5065
5223
|
}
|
|
5066
5224
|
if (column.kind === "text" && column.multiline === true) {
|
|
5067
|
-
return /* @__PURE__ */
|
|
5225
|
+
return /* @__PURE__ */ jsx17(
|
|
5068
5226
|
"textarea",
|
|
5069
5227
|
{
|
|
5070
5228
|
...shared,
|
|
@@ -5076,7 +5234,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
5076
5234
|
);
|
|
5077
5235
|
}
|
|
5078
5236
|
if (column.kind === "number" || column.kind === "currency") {
|
|
5079
|
-
return /* @__PURE__ */
|
|
5237
|
+
return /* @__PURE__ */ jsx17(
|
|
5080
5238
|
"input",
|
|
5081
5239
|
{
|
|
5082
5240
|
...shared,
|
|
@@ -5096,7 +5254,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
5096
5254
|
}
|
|
5097
5255
|
);
|
|
5098
5256
|
}
|
|
5099
|
-
return /* @__PURE__ */
|
|
5257
|
+
return /* @__PURE__ */ jsx17(
|
|
5100
5258
|
"input",
|
|
5101
5259
|
{
|
|
5102
5260
|
...shared,
|
|
@@ -5109,8 +5267,8 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
5109
5267
|
}
|
|
5110
5268
|
|
|
5111
5269
|
// src/web-react/record-grid-source-marker.tsx
|
|
5112
|
-
import { useCallback as
|
|
5113
|
-
import { jsx as
|
|
5270
|
+
import { useCallback as useCallback12 } from "react";
|
|
5271
|
+
import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5114
5272
|
var BASIS_TONES2 = {
|
|
5115
5273
|
extracted: "border-primary/60 text-primary",
|
|
5116
5274
|
entered: "border-success/60 text-success",
|
|
@@ -5125,15 +5283,15 @@ var BASIS_TITLES = {
|
|
|
5125
5283
|
};
|
|
5126
5284
|
function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle }) {
|
|
5127
5285
|
const basis = source.basis ?? "asserted";
|
|
5128
|
-
const setOpen =
|
|
5286
|
+
const setOpen = useCallback12(
|
|
5129
5287
|
(next) => {
|
|
5130
5288
|
if (!next) onToggle();
|
|
5131
5289
|
},
|
|
5132
5290
|
[onToggle]
|
|
5133
5291
|
);
|
|
5134
5292
|
const { containerRef, triggerRef, panelRef, triggerProps } = usePopover(open, setOpen);
|
|
5135
|
-
return /* @__PURE__ */
|
|
5136
|
-
/* @__PURE__ */
|
|
5293
|
+
return /* @__PURE__ */ jsxs17("span", { ref: containerRef, className: "relative inline-flex", children: [
|
|
5294
|
+
/* @__PURE__ */ jsx18(
|
|
5137
5295
|
"button",
|
|
5138
5296
|
{
|
|
5139
5297
|
type: "button",
|
|
@@ -5146,7 +5304,7 @@ function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle
|
|
|
5146
5304
|
onToggle();
|
|
5147
5305
|
},
|
|
5148
5306
|
className: `inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full border ${BASIS_TONES2[basis]}`,
|
|
5149
|
-
children: /* @__PURE__ */
|
|
5307
|
+
children: /* @__PURE__ */ jsx18(
|
|
5150
5308
|
"svg",
|
|
5151
5309
|
{
|
|
5152
5310
|
viewBox: "0 0 24 24",
|
|
@@ -5156,12 +5314,12 @@ function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle
|
|
|
5156
5314
|
strokeWidth: "2.5",
|
|
5157
5315
|
strokeLinecap: "round",
|
|
5158
5316
|
"aria-hidden": true,
|
|
5159
|
-
children: /* @__PURE__ */
|
|
5317
|
+
children: /* @__PURE__ */ jsx18("path", { d: "M9 8h6M9 12h6M9 16h3" })
|
|
5160
5318
|
}
|
|
5161
5319
|
)
|
|
5162
5320
|
}
|
|
5163
5321
|
),
|
|
5164
|
-
/* @__PURE__ */
|
|
5322
|
+
/* @__PURE__ */ jsxs17(
|
|
5165
5323
|
PopoverSurface,
|
|
5166
5324
|
{
|
|
5167
5325
|
open,
|
|
@@ -5171,17 +5329,17 @@ function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle
|
|
|
5171
5329
|
panelRef,
|
|
5172
5330
|
className: `w-64 rounded-lg border border-card-edge bg-popover p-3 text-left ${OVERLAY_SHADOW}`,
|
|
5173
5331
|
children: [
|
|
5174
|
-
source.quote && /* @__PURE__ */
|
|
5332
|
+
source.quote && /* @__PURE__ */ jsxs17("span", { className: "block border-l-2 border-primary/50 pl-2 text-xs italic leading-snug text-foreground", children: [
|
|
5175
5333
|
"\u201C",
|
|
5176
5334
|
source.quote,
|
|
5177
5335
|
"\u201D"
|
|
5178
5336
|
] }),
|
|
5179
|
-
/* @__PURE__ */
|
|
5337
|
+
/* @__PURE__ */ jsxs17("span", { className: "mt-2 block text-xs text-muted-foreground", children: [
|
|
5180
5338
|
source.label ?? "Source",
|
|
5181
5339
|
source.locator ? ` \xB7 ${source.locator}` : "",
|
|
5182
5340
|
` \xB7 ${BASIS_TITLES[basis]}`
|
|
5183
5341
|
] }),
|
|
5184
|
-
source.href && /* @__PURE__ */
|
|
5342
|
+
source.href && /* @__PURE__ */ jsx18(
|
|
5185
5343
|
"a",
|
|
5186
5344
|
{
|
|
5187
5345
|
href: source.href,
|
|
@@ -5199,7 +5357,7 @@ function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle
|
|
|
5199
5357
|
}
|
|
5200
5358
|
|
|
5201
5359
|
// src/web-react/record-grid.tsx
|
|
5202
|
-
import { jsx as
|
|
5360
|
+
import { jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
5203
5361
|
var EMPTY_RECORD_GRID_ROWS = [];
|
|
5204
5362
|
var CELL_KEY_SEPARATOR = "\0";
|
|
5205
5363
|
function cellKey(rowId, columnId) {
|
|
@@ -5236,29 +5394,29 @@ function useRecordGridViewState({
|
|
|
5236
5394
|
className
|
|
5237
5395
|
}) {
|
|
5238
5396
|
const fieldPrefix = useId3();
|
|
5239
|
-
const [overlay, setOverlay] =
|
|
5240
|
-
const [editing, setEditingState] =
|
|
5241
|
-
const [cellErrors, setCellErrors] =
|
|
5242
|
-
const [rowErrors, setRowErrors] =
|
|
5243
|
-
const [pendingRows, setPendingRows] =
|
|
5244
|
-
const [focus, setFocus] =
|
|
5245
|
-
const [openSource, setOpenSource] =
|
|
5246
|
-
const [confirmDelete, setConfirmDelete] =
|
|
5247
|
-
const [adding, setAdding] =
|
|
5248
|
-
const [draft, setDraft] =
|
|
5249
|
-
const [draftErrors, setDraftErrors] =
|
|
5250
|
-
const [draftError, setDraftError] =
|
|
5251
|
-
const [creating, setCreating] =
|
|
5252
|
-
const cellRefs =
|
|
5253
|
-
const settling =
|
|
5254
|
-
const draftCounter =
|
|
5255
|
-
const editingRef =
|
|
5256
|
-
const setEditing =
|
|
5397
|
+
const [overlay, setOverlay] = useState21(EMPTY_RECORD_GRID_OVERLAY);
|
|
5398
|
+
const [editing, setEditingState] = useState21(null);
|
|
5399
|
+
const [cellErrors, setCellErrors] = useState21({});
|
|
5400
|
+
const [rowErrors, setRowErrors] = useState21({});
|
|
5401
|
+
const [pendingRows, setPendingRows] = useState21({});
|
|
5402
|
+
const [focus, setFocus] = useState21(null);
|
|
5403
|
+
const [openSource, setOpenSource] = useState21(null);
|
|
5404
|
+
const [confirmDelete, setConfirmDelete] = useState21(null);
|
|
5405
|
+
const [adding, setAdding] = useState21(false);
|
|
5406
|
+
const [draft, setDraft] = useState21({ ...newRowDefaults ?? {} });
|
|
5407
|
+
const [draftErrors, setDraftErrors] = useState21({});
|
|
5408
|
+
const [draftError, setDraftError] = useState21(null);
|
|
5409
|
+
const [creating, setCreating] = useState21(false);
|
|
5410
|
+
const cellRefs = useRef14(/* @__PURE__ */ new Map());
|
|
5411
|
+
const settling = useRef14(false);
|
|
5412
|
+
const draftCounter = useRef14(0);
|
|
5413
|
+
const editingRef = useRef14(null);
|
|
5414
|
+
const setEditing = useCallback13((next) => {
|
|
5257
5415
|
editingRef.current = next;
|
|
5258
5416
|
setEditingState(next);
|
|
5259
5417
|
}, []);
|
|
5260
5418
|
const callerRows = state.status === "ready" || state.status === "empty" ? state.value : EMPTY_RECORD_GRID_ROWS;
|
|
5261
|
-
|
|
5419
|
+
useEffect14(() => {
|
|
5262
5420
|
setOverlay((current) => pruneRecordGridOverlay(callerRows, current));
|
|
5263
5421
|
}, [callerRows]);
|
|
5264
5422
|
const visibleRows = useMemo8(() => projectRecordGridRows(callerRows, overlay), [callerRows, overlay]);
|
|
@@ -5285,7 +5443,7 @@ function useRecordGridViewState({
|
|
|
5285
5443
|
if (!columns.some((column) => column.id === focus.columnId)) return null;
|
|
5286
5444
|
return focus;
|
|
5287
5445
|
}, [columns, focus, visibleRows]);
|
|
5288
|
-
const setCellError =
|
|
5446
|
+
const setCellError = useCallback13((key, message) => {
|
|
5289
5447
|
setCellErrors((current) => {
|
|
5290
5448
|
if (message === null) {
|
|
5291
5449
|
if (!(key in current)) return current;
|
|
@@ -5297,7 +5455,7 @@ function useRecordGridViewState({
|
|
|
5297
5455
|
return { ...current, [key]: message };
|
|
5298
5456
|
});
|
|
5299
5457
|
}, []);
|
|
5300
|
-
const setRowError =
|
|
5458
|
+
const setRowError = useCallback13((rowId, message) => {
|
|
5301
5459
|
setRowErrors((current) => {
|
|
5302
5460
|
if (message === null) {
|
|
5303
5461
|
if (!(rowId in current)) return current;
|
|
@@ -5308,7 +5466,7 @@ function useRecordGridViewState({
|
|
|
5308
5466
|
return { ...current, [rowId]: message };
|
|
5309
5467
|
});
|
|
5310
5468
|
}, []);
|
|
5311
|
-
const setRowPending =
|
|
5469
|
+
const setRowPending = useCallback13((rowId, pending) => {
|
|
5312
5470
|
setPendingRows((current) => {
|
|
5313
5471
|
if (pending) return rowId in current ? current : { ...current, [rowId]: true };
|
|
5314
5472
|
if (!(rowId in current)) return current;
|
|
@@ -5317,11 +5475,11 @@ function useRecordGridViewState({
|
|
|
5317
5475
|
return next;
|
|
5318
5476
|
});
|
|
5319
5477
|
}, []);
|
|
5320
|
-
const focusCell =
|
|
5478
|
+
const focusCell = useCallback13((rowId, columnId) => {
|
|
5321
5479
|
setFocus({ rowId, columnId });
|
|
5322
5480
|
cellRefs.current.get(cellKey(rowId, columnId))?.focus();
|
|
5323
5481
|
}, []);
|
|
5324
|
-
const beginEdit =
|
|
5482
|
+
const beginEdit = useCallback13(
|
|
5325
5483
|
(row, column) => {
|
|
5326
5484
|
setCellError(cellKey(row.id, column.id), null);
|
|
5327
5485
|
setEditing({
|
|
@@ -5332,7 +5490,7 @@ function useRecordGridViewState({
|
|
|
5332
5490
|
},
|
|
5333
5491
|
[setCellError, setEditing]
|
|
5334
5492
|
);
|
|
5335
|
-
const applyCellWrite =
|
|
5493
|
+
const applyCellWrite = useCallback13(
|
|
5336
5494
|
(row, column, value) => writeRecordGridCell(row, column, value, {
|
|
5337
5495
|
onUpdate,
|
|
5338
5496
|
setOverlay,
|
|
@@ -5342,7 +5500,7 @@ function useRecordGridViewState({
|
|
|
5342
5500
|
}),
|
|
5343
5501
|
[locale, onUpdate, setRowError, setRowPending]
|
|
5344
5502
|
);
|
|
5345
|
-
const commitEdit =
|
|
5503
|
+
const commitEdit = useCallback13(
|
|
5346
5504
|
async (row, column, text) => {
|
|
5347
5505
|
const open = editingRef.current;
|
|
5348
5506
|
if (open === null || open.rowId !== row.id || open.columnId !== column.id) return;
|
|
@@ -5366,7 +5524,7 @@ function useRecordGridViewState({
|
|
|
5366
5524
|
},
|
|
5367
5525
|
[applyCellWrite, setCellError, setEditing]
|
|
5368
5526
|
);
|
|
5369
|
-
const cancelEdit =
|
|
5527
|
+
const cancelEdit = useCallback13(
|
|
5370
5528
|
(row, column) => {
|
|
5371
5529
|
setCellError(cellKey(row.id, column.id), null);
|
|
5372
5530
|
setEditing(null);
|
|
@@ -5374,20 +5532,20 @@ function useRecordGridViewState({
|
|
|
5374
5532
|
},
|
|
5375
5533
|
[focusCell, setCellError, setEditing]
|
|
5376
5534
|
);
|
|
5377
|
-
const performDelete =
|
|
5535
|
+
const performDelete = useCallback13(
|
|
5378
5536
|
(row) => deleteRecordGridRow(row, { onDelete, setConfirmDelete, setRowError, setOverlay, columns }),
|
|
5379
5537
|
[columns, onDelete, setRowError]
|
|
5380
5538
|
);
|
|
5381
|
-
const resetDraft =
|
|
5539
|
+
const resetDraft = useCallback13(() => {
|
|
5382
5540
|
setDraft({ ...newRowDefaults ?? {} });
|
|
5383
5541
|
setDraftErrors({});
|
|
5384
5542
|
setDraftError(null);
|
|
5385
5543
|
}, [newRowDefaults]);
|
|
5386
|
-
const openAdd =
|
|
5544
|
+
const openAdd = useCallback13(() => {
|
|
5387
5545
|
resetDraft();
|
|
5388
5546
|
setAdding(true);
|
|
5389
5547
|
}, [resetDraft]);
|
|
5390
|
-
const submitDraft =
|
|
5548
|
+
const submitDraft = useCallback13(() => createRecordGridRow({
|
|
5391
5549
|
onCreate,
|
|
5392
5550
|
columns,
|
|
5393
5551
|
draft,
|
|
@@ -5400,7 +5558,7 @@ function useRecordGridViewState({
|
|
|
5400
5558
|
setAdding,
|
|
5401
5559
|
resetDraft
|
|
5402
5560
|
}), [columns, draft, fieldPrefix, onCreate, resetDraft]);
|
|
5403
|
-
const handleGridKeyDown =
|
|
5561
|
+
const handleGridKeyDown = useCallback13(
|
|
5404
5562
|
(event) => {
|
|
5405
5563
|
if (editing !== null) return;
|
|
5406
5564
|
const target = event.target;
|
|
@@ -5494,7 +5652,7 @@ function useRecordGridViewState({
|
|
|
5494
5652
|
}
|
|
5495
5653
|
function RecordGrid(props) {
|
|
5496
5654
|
const view = useRecordGridViewState(props);
|
|
5497
|
-
return /* @__PURE__ */
|
|
5655
|
+
return /* @__PURE__ */ jsx19(RecordGridView, { ...view });
|
|
5498
5656
|
}
|
|
5499
5657
|
function RecordGridView({
|
|
5500
5658
|
state,
|
|
@@ -5550,9 +5708,9 @@ function RecordGridView({
|
|
|
5550
5708
|
setConfirmDelete
|
|
5551
5709
|
}) {
|
|
5552
5710
|
if (state.status === "idle" || state.status === "loading") {
|
|
5553
|
-
return /* @__PURE__ */
|
|
5711
|
+
return /* @__PURE__ */ jsxs18("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
5554
5712
|
toolbar,
|
|
5555
|
-
/* @__PURE__ */
|
|
5713
|
+
/* @__PURE__ */ jsxs18(
|
|
5556
5714
|
"div",
|
|
5557
5715
|
{
|
|
5558
5716
|
role: "status",
|
|
@@ -5560,22 +5718,22 @@ function RecordGridView({
|
|
|
5560
5718
|
"aria-live": "polite",
|
|
5561
5719
|
className: "space-y-2 rounded-xl border border-card-edge bg-card p-4",
|
|
5562
5720
|
children: [
|
|
5563
|
-
/* @__PURE__ */
|
|
5721
|
+
/* @__PURE__ */ jsxs18("span", { className: "sr-only", children: [
|
|
5564
5722
|
"Loading ",
|
|
5565
5723
|
caption
|
|
5566
5724
|
] }),
|
|
5567
|
-
Array.from({ length: Math.max(1, loadingRowCount) }, (_, index) => /* @__PURE__ */
|
|
5725
|
+
Array.from({ length: Math.max(1, loadingRowCount) }, (_, index) => /* @__PURE__ */ jsx19(Skeleton, { className: "h-8", "aria-hidden": true }, index))
|
|
5568
5726
|
]
|
|
5569
5727
|
}
|
|
5570
5728
|
)
|
|
5571
5729
|
] });
|
|
5572
5730
|
}
|
|
5573
5731
|
if (state.status === "error") {
|
|
5574
|
-
return /* @__PURE__ */
|
|
5732
|
+
return /* @__PURE__ */ jsxs18("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
5575
5733
|
toolbar,
|
|
5576
|
-
/* @__PURE__ */
|
|
5577
|
-
/* @__PURE__ */
|
|
5578
|
-
/* @__PURE__ */
|
|
5734
|
+
/* @__PURE__ */ jsxs18("div", { role: "alert", className: "rounded-xl border border-destructive/40 bg-destructive/10 px-4 py-4", children: [
|
|
5735
|
+
/* @__PURE__ */ jsx19("p", { className: "text-sm font-medium text-destructive", children: state.message }),
|
|
5736
|
+
/* @__PURE__ */ jsx19(
|
|
5579
5737
|
"button",
|
|
5580
5738
|
{
|
|
5581
5739
|
type: "button",
|
|
@@ -5587,7 +5745,7 @@ function RecordGridView({
|
|
|
5587
5745
|
] })
|
|
5588
5746
|
] });
|
|
5589
5747
|
}
|
|
5590
|
-
const addForm = adding && onCreate && !reviewing ? /* @__PURE__ */
|
|
5748
|
+
const addForm = adding && onCreate && !reviewing ? /* @__PURE__ */ jsx19(
|
|
5591
5749
|
AddRecordForm,
|
|
5592
5750
|
{
|
|
5593
5751
|
columns,
|
|
@@ -5606,17 +5764,17 @@ function RecordGridView({
|
|
|
5606
5764
|
}
|
|
5607
5765
|
) : null;
|
|
5608
5766
|
if (visibleRows.length === 0 && !reviewing) {
|
|
5609
|
-
return /* @__PURE__ */
|
|
5767
|
+
return /* @__PURE__ */ jsxs18("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
5610
5768
|
toolbar,
|
|
5611
|
-
addForm ?? /* @__PURE__ */
|
|
5769
|
+
addForm ?? /* @__PURE__ */ jsx19(
|
|
5612
5770
|
EmptyState,
|
|
5613
5771
|
{
|
|
5614
5772
|
title: empty.title,
|
|
5615
5773
|
description: empty.description,
|
|
5616
5774
|
className: "rounded-xl border border-dashed border-border",
|
|
5617
|
-
action: /* @__PURE__ */
|
|
5618
|
-
empty.action && (isValidElement(empty.action) ? empty.action : /* @__PURE__ */
|
|
5619
|
-
onCreate && /* @__PURE__ */
|
|
5775
|
+
action: /* @__PURE__ */ jsxs18("div", { className: "flex flex-wrap items-center justify-center gap-2", children: [
|
|
5776
|
+
empty.action && (isValidElement(empty.action) ? empty.action : /* @__PURE__ */ jsx19(Button4, { type: "button", variant: "outline", size: "sm", onClick: empty.action.onClick, children: empty.action.label })),
|
|
5777
|
+
onCreate && /* @__PURE__ */ jsx19(Button4, { type: "button", variant: "outline", size: "sm", onClick: openAdd, children: addLabel })
|
|
5620
5778
|
] })
|
|
5621
5779
|
}
|
|
5622
5780
|
)
|
|
@@ -5634,18 +5792,18 @@ function RecordGridView({
|
|
|
5634
5792
|
addedCount > 0 ? `${addedCount} added` : null,
|
|
5635
5793
|
removedCount > 0 ? `${removedCount} removed` : null
|
|
5636
5794
|
].filter((part) => part !== null).join(" \xB7 ");
|
|
5637
|
-
const reviewBar = reviewing ? /* @__PURE__ */
|
|
5795
|
+
const reviewBar = reviewing ? /* @__PURE__ */ jsxs18(
|
|
5638
5796
|
"div",
|
|
5639
5797
|
{
|
|
5640
5798
|
"data-record-grid-review": "",
|
|
5641
5799
|
className: "flex flex-wrap items-center justify-between gap-3 rounded-xl border border-card-edge bg-card px-4 py-2.5",
|
|
5642
5800
|
children: [
|
|
5643
|
-
/* @__PURE__ */
|
|
5644
|
-
/* @__PURE__ */
|
|
5645
|
-
/* @__PURE__ */
|
|
5801
|
+
/* @__PURE__ */ jsxs18("div", { className: "min-w-0", children: [
|
|
5802
|
+
/* @__PURE__ */ jsx19("p", { className: "text-[11px] font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: "Proposed changes" }),
|
|
5803
|
+
/* @__PURE__ */ jsx19("p", { className: "mt-0.5 text-xs tabular-nums text-muted-foreground", children: reviewSummary })
|
|
5646
5804
|
] }),
|
|
5647
|
-
(onAcceptAll || onRejectAll) && /* @__PURE__ */
|
|
5648
|
-
onRejectAll && /* @__PURE__ */
|
|
5805
|
+
(onAcceptAll || onRejectAll) && /* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-2", children: [
|
|
5806
|
+
onRejectAll && /* @__PURE__ */ jsx19(
|
|
5649
5807
|
"button",
|
|
5650
5808
|
{
|
|
5651
5809
|
type: "button",
|
|
@@ -5655,7 +5813,7 @@ function RecordGridView({
|
|
|
5655
5813
|
children: "Reject all"
|
|
5656
5814
|
}
|
|
5657
5815
|
),
|
|
5658
|
-
onAcceptAll && /* @__PURE__ */
|
|
5816
|
+
onAcceptAll && /* @__PURE__ */ jsx19(
|
|
5659
5817
|
"button",
|
|
5660
5818
|
{
|
|
5661
5819
|
type: "button",
|
|
@@ -5669,10 +5827,10 @@ function RecordGridView({
|
|
|
5669
5827
|
]
|
|
5670
5828
|
}
|
|
5671
5829
|
) : null;
|
|
5672
|
-
return /* @__PURE__ */
|
|
5830
|
+
return /* @__PURE__ */ jsxs18("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
5673
5831
|
toolbar,
|
|
5674
5832
|
reviewBar,
|
|
5675
|
-
/* @__PURE__ */
|
|
5833
|
+
/* @__PURE__ */ jsx19("div", { className: "overflow-x-auto rounded-xl border border-card-edge bg-card", children: /* @__PURE__ */ jsxs18(
|
|
5676
5834
|
Table,
|
|
5677
5835
|
{
|
|
5678
5836
|
wrapper: false,
|
|
@@ -5681,8 +5839,8 @@ function RecordGridView({
|
|
|
5681
5839
|
className: "border-collapse text-left",
|
|
5682
5840
|
onKeyDown: handleGridKeyDown,
|
|
5683
5841
|
children: [
|
|
5684
|
-
/* @__PURE__ */
|
|
5685
|
-
columns.map((column) => /* @__PURE__ */
|
|
5842
|
+
/* @__PURE__ */ jsx19(TableHeader, { children: /* @__PURE__ */ jsxs18(TableRow, { role: "row", className: "text-xs uppercase tracking-[0.05em] text-muted-foreground", children: [
|
|
5843
|
+
columns.map((column) => /* @__PURE__ */ jsx19(
|
|
5686
5844
|
TableHead,
|
|
5687
5845
|
{
|
|
5688
5846
|
role: "columnheader",
|
|
@@ -5692,9 +5850,9 @@ function RecordGridView({
|
|
|
5692
5850
|
},
|
|
5693
5851
|
column.id
|
|
5694
5852
|
)),
|
|
5695
|
-
showActionsColumn && /* @__PURE__ */
|
|
5853
|
+
showActionsColumn && /* @__PURE__ */ jsx19(TableHead, { role: "columnheader", scope: "col", className: "h-auto w-px px-3 py-2", children: /* @__PURE__ */ jsx19("span", { className: "sr-only", children: reviewing ? "Review" : "Row actions" }) })
|
|
5696
5854
|
] }) }),
|
|
5697
|
-
/* @__PURE__ */
|
|
5855
|
+
/* @__PURE__ */ jsx19(
|
|
5698
5856
|
RecordGridRows,
|
|
5699
5857
|
{
|
|
5700
5858
|
visibleRows,
|
|
@@ -5729,8 +5887,8 @@ function RecordGridView({
|
|
|
5729
5887
|
addedRows
|
|
5730
5888
|
}
|
|
5731
5889
|
),
|
|
5732
|
-
hasFooter && /* @__PURE__ */
|
|
5733
|
-
columns.map((column) => /* @__PURE__ */
|
|
5890
|
+
hasFooter && /* @__PURE__ */ jsx19(TableFooter, { children: /* @__PURE__ */ jsxs18(TableRow, { role: "row", className: "border-t-2 border-border", children: [
|
|
5891
|
+
columns.map((column) => /* @__PURE__ */ jsx19(
|
|
5734
5892
|
TableCell,
|
|
5735
5893
|
{
|
|
5736
5894
|
role: "gridcell",
|
|
@@ -5739,21 +5897,21 @@ function RecordGridView({
|
|
|
5739
5897
|
},
|
|
5740
5898
|
column.id
|
|
5741
5899
|
)),
|
|
5742
|
-
showActionsColumn && /* @__PURE__ */
|
|
5900
|
+
showActionsColumn && /* @__PURE__ */ jsx19(TableCell, { role: "gridcell" })
|
|
5743
5901
|
] }) })
|
|
5744
5902
|
]
|
|
5745
5903
|
}
|
|
5746
5904
|
) }),
|
|
5747
|
-
onCreate && !reviewing && (addForm ?? /* @__PURE__ */
|
|
5905
|
+
onCreate && !reviewing && (addForm ?? /* @__PURE__ */ jsxs18(
|
|
5748
5906
|
"button",
|
|
5749
5907
|
{
|
|
5750
5908
|
type: "button",
|
|
5751
5909
|
onClick: openAdd,
|
|
5752
5910
|
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",
|
|
5753
5911
|
children: [
|
|
5754
|
-
/* @__PURE__ */
|
|
5755
|
-
/* @__PURE__ */
|
|
5756
|
-
/* @__PURE__ */
|
|
5912
|
+
/* @__PURE__ */ jsxs18(RecordGridActionGlyph, { children: [
|
|
5913
|
+
/* @__PURE__ */ jsx19("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
|
|
5914
|
+
/* @__PURE__ */ jsx19("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
|
|
5757
5915
|
] }),
|
|
5758
5916
|
addLabel
|
|
5759
5917
|
]
|
|
@@ -5762,7 +5920,7 @@ function RecordGridView({
|
|
|
5762
5920
|
] });
|
|
5763
5921
|
}
|
|
5764
5922
|
function RecordGridActionGlyph({ children }) {
|
|
5765
|
-
return /* @__PURE__ */
|
|
5923
|
+
return /* @__PURE__ */ jsx19(
|
|
5766
5924
|
"svg",
|
|
5767
5925
|
{
|
|
5768
5926
|
viewBox: "0 0 24 24",
|
|
@@ -5809,15 +5967,15 @@ function RecordGridRows({
|
|
|
5809
5967
|
columnSpan,
|
|
5810
5968
|
addedRows
|
|
5811
5969
|
}) {
|
|
5812
|
-
return /* @__PURE__ */
|
|
5970
|
+
return /* @__PURE__ */ jsxs18(TableBody, { children: [
|
|
5813
5971
|
visibleRows.map((row) => {
|
|
5814
5972
|
const rowLabel = recordGridRowLabel(columns, row);
|
|
5815
5973
|
const pending = row.id in pendingRows;
|
|
5816
5974
|
const rowError = rowErrors[row.id];
|
|
5817
5975
|
const rowDiff = reviewing ? diffByRow.get(row.id) : void 0;
|
|
5818
5976
|
const removedRow = rowDiff?.kind === "removed";
|
|
5819
|
-
return /* @__PURE__ */
|
|
5820
|
-
/* @__PURE__ */
|
|
5977
|
+
return /* @__PURE__ */ jsxs18(Fragment6, { children: [
|
|
5978
|
+
/* @__PURE__ */ jsxs18(
|
|
5821
5979
|
TableRow,
|
|
5822
5980
|
{
|
|
5823
5981
|
role: "row",
|
|
@@ -5837,8 +5995,8 @@ function RecordGridRows({
|
|
|
5837
5995
|
const errorId = `${fieldPrefix}-cell-error-${row.id}-${column.id}`;
|
|
5838
5996
|
const cellDiff = rowDiff?.kind === "changed" ? diffCellByKey.get(key) : void 0;
|
|
5839
5997
|
if (isEditing && editable) {
|
|
5840
|
-
return /* @__PURE__ */
|
|
5841
|
-
/* @__PURE__ */
|
|
5998
|
+
return /* @__PURE__ */ jsxs18(TableCell, { role: "gridcell", className: `px-3 py-1.5 ${alignmentClass(column)}`, children: [
|
|
5999
|
+
/* @__PURE__ */ jsx19(
|
|
5842
6000
|
CellEditor,
|
|
5843
6001
|
{
|
|
5844
6002
|
column,
|
|
@@ -5851,11 +6009,11 @@ function RecordGridRows({
|
|
|
5851
6009
|
onCancel: () => cancelEdit(row, column)
|
|
5852
6010
|
}
|
|
5853
6011
|
),
|
|
5854
|
-
cellError !== void 0 && /* @__PURE__ */
|
|
6012
|
+
cellError !== void 0 && /* @__PURE__ */ jsx19("p", { id: errorId, role: "alert", className: "mt-1 text-xs leading-snug text-destructive", children: cellError })
|
|
5855
6013
|
] }, column.id);
|
|
5856
6014
|
}
|
|
5857
6015
|
if (column.kind === "boolean" && editable) {
|
|
5858
|
-
return /* @__PURE__ */
|
|
6016
|
+
return /* @__PURE__ */ jsx19(TableCell, { role: "gridcell", className: `px-3 py-2 ${alignmentClass(column)}`, children: /* @__PURE__ */ jsx19(
|
|
5859
6017
|
"input",
|
|
5860
6018
|
{
|
|
5861
6019
|
type: "checkbox",
|
|
@@ -5874,7 +6032,7 @@ function RecordGridRows({
|
|
|
5874
6032
|
) }, column.id);
|
|
5875
6033
|
}
|
|
5876
6034
|
const display = applicable ? formatRecordGridValue(column, value, locale) : "";
|
|
5877
|
-
return /* @__PURE__ */
|
|
6035
|
+
return /* @__PURE__ */ jsx19(
|
|
5878
6036
|
TableCell,
|
|
5879
6037
|
{
|
|
5880
6038
|
role: "gridcell",
|
|
@@ -5892,20 +6050,20 @@ function RecordGridRows({
|
|
|
5892
6050
|
className: `px-3 py-2 outline-none focus:ring-2 focus:ring-inset focus:ring-primary/50 ${alignmentClass(
|
|
5893
6051
|
column
|
|
5894
6052
|
)} ${editable ? "cursor-text" : ""}`,
|
|
5895
|
-
children: /* @__PURE__ */
|
|
5896
|
-
column.id === columns[0]?.id && removedRow && /* @__PURE__ */
|
|
5897
|
-
cellDiff ? /* @__PURE__ */
|
|
5898
|
-
/* @__PURE__ */
|
|
5899
|
-
/* @__PURE__ */
|
|
5900
|
-
/* @__PURE__ */
|
|
5901
|
-
] }) : /* @__PURE__ */
|
|
6053
|
+
children: /* @__PURE__ */ jsxs18("span", { className: "inline-flex max-w-full items-center gap-1.5", children: [
|
|
6054
|
+
column.id === columns[0]?.id && removedRow && /* @__PURE__ */ jsx19("span", { className: "inline-flex shrink-0 rounded border border-destructive/60 px-1 py-px text-[11px] font-semibold uppercase tracking-[0.05em] text-destructive", children: "Remove" }),
|
|
6055
|
+
cellDiff ? /* @__PURE__ */ jsxs18("span", { className: "inline-flex max-w-full flex-wrap items-baseline gap-x-1.5", children: [
|
|
6056
|
+
/* @__PURE__ */ jsx19("span", { className: "tabular-nums text-destructive line-through decoration-destructive/60", children: formatRecordGridValue(column, cellDiff.before, locale) || "\u2014" }),
|
|
6057
|
+
/* @__PURE__ */ jsx19("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u2192" }),
|
|
6058
|
+
/* @__PURE__ */ jsx19("span", { className: "tabular-nums font-medium text-success", children: formatRecordGridValue(column, cellDiff.after, locale) || "\u2014" })
|
|
6059
|
+
] }) : /* @__PURE__ */ jsx19(
|
|
5902
6060
|
"span",
|
|
5903
6061
|
{
|
|
5904
6062
|
className: removedRow ? "truncate text-destructive line-through decoration-destructive/60" : display === "" ? "text-muted-foreground" : "truncate text-foreground",
|
|
5905
6063
|
children: display === "" ? applicable ? "\u2014" : "n/a" : display
|
|
5906
6064
|
}
|
|
5907
6065
|
),
|
|
5908
|
-
source && /* @__PURE__ */
|
|
6066
|
+
source && /* @__PURE__ */ jsx19(
|
|
5909
6067
|
SourceMarker,
|
|
5910
6068
|
{
|
|
5911
6069
|
panelId: `${fieldPrefix}-source-${row.id}-${column.id}`,
|
|
@@ -5921,7 +6079,7 @@ function RecordGridRows({
|
|
|
5921
6079
|
column.id
|
|
5922
6080
|
);
|
|
5923
6081
|
}),
|
|
5924
|
-
showActionsColumn && /* @__PURE__ */
|
|
6082
|
+
showActionsColumn && /* @__PURE__ */ jsx19(TableCell, { role: "gridcell", className: "px-3 py-2 text-right", children: reviewing ? rowDiff && /* @__PURE__ */ jsx19(
|
|
5925
6083
|
ReviewActions,
|
|
5926
6084
|
{
|
|
5927
6085
|
rowId: row.id,
|
|
@@ -5930,8 +6088,8 @@ function RecordGridRows({
|
|
|
5930
6088
|
onAccept: onAcceptRow,
|
|
5931
6089
|
onReject: onRejectRow
|
|
5932
6090
|
}
|
|
5933
|
-
) : row.readOnly === true ? null : confirmDelete === row.id ? /* @__PURE__ */
|
|
5934
|
-
/* @__PURE__ */
|
|
6091
|
+
) : row.readOnly === true ? null : confirmDelete === row.id ? /* @__PURE__ */ jsxs18("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
6092
|
+
/* @__PURE__ */ jsx19(
|
|
5935
6093
|
"button",
|
|
5936
6094
|
{
|
|
5937
6095
|
type: "button",
|
|
@@ -5941,7 +6099,7 @@ function RecordGridRows({
|
|
|
5941
6099
|
children: "Delete"
|
|
5942
6100
|
}
|
|
5943
6101
|
),
|
|
5944
|
-
/* @__PURE__ */
|
|
6102
|
+
/* @__PURE__ */ jsx19(
|
|
5945
6103
|
"button",
|
|
5946
6104
|
{
|
|
5947
6105
|
type: "button",
|
|
@@ -5951,28 +6109,28 @@ function RecordGridRows({
|
|
|
5951
6109
|
children: "Cancel"
|
|
5952
6110
|
}
|
|
5953
6111
|
)
|
|
5954
|
-
] }) : /* @__PURE__ */
|
|
6112
|
+
] }) : /* @__PURE__ */ jsx19(
|
|
5955
6113
|
"button",
|
|
5956
6114
|
{
|
|
5957
6115
|
type: "button",
|
|
5958
6116
|
"aria-label": `Delete ${rowLabel}`,
|
|
5959
6117
|
onClick: () => setConfirmDelete(row.id),
|
|
5960
6118
|
className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-destructive/10 hover:text-destructive",
|
|
5961
|
-
children: /* @__PURE__ */
|
|
5962
|
-
/* @__PURE__ */
|
|
5963
|
-
/* @__PURE__ */
|
|
6119
|
+
children: /* @__PURE__ */ jsxs18(RecordGridActionGlyph, { children: [
|
|
6120
|
+
/* @__PURE__ */ jsx19("polyline", { points: "3 6 5 6 21 6" }),
|
|
6121
|
+
/* @__PURE__ */ jsx19("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" })
|
|
5964
6122
|
] })
|
|
5965
6123
|
}
|
|
5966
6124
|
) })
|
|
5967
6125
|
]
|
|
5968
6126
|
}
|
|
5969
6127
|
),
|
|
5970
|
-
rowError !== void 0 && /* @__PURE__ */
|
|
6128
|
+
rowError !== void 0 && /* @__PURE__ */ jsx19(TableRow, { role: "row", children: /* @__PURE__ */ jsx19(TableCell, { role: "gridcell", colSpan: columnSpan, className: "px-3 pb-2", children: /* @__PURE__ */ jsx19("p", { role: "alert", className: "rounded-md bg-destructive/10 px-2.5 py-1.5 text-xs text-destructive", children: rowError }) }) })
|
|
5971
6129
|
] }, row.id);
|
|
5972
6130
|
}),
|
|
5973
6131
|
reviewing && addedRows.map((row) => {
|
|
5974
6132
|
const rowLabel = recordGridRowLabel(columns, row);
|
|
5975
|
-
return /* @__PURE__ */
|
|
6133
|
+
return /* @__PURE__ */ jsxs18(
|
|
5976
6134
|
TableRow,
|
|
5977
6135
|
{
|
|
5978
6136
|
role: "row",
|
|
@@ -5983,9 +6141,9 @@ function RecordGridRows({
|
|
|
5983
6141
|
const applicable = isRecordGridCellApplicable(column, row.values);
|
|
5984
6142
|
const value = row.values[column.id] ?? null;
|
|
5985
6143
|
const display = applicable ? formatRecordGridValue(column, value, locale) : "";
|
|
5986
|
-
return /* @__PURE__ */
|
|
5987
|
-
columnIndex === 0 && /* @__PURE__ */
|
|
5988
|
-
/* @__PURE__ */
|
|
6144
|
+
return /* @__PURE__ */ jsx19(TableCell, { role: "gridcell", className: `px-3 py-2 ${alignmentClass(column)}`, children: /* @__PURE__ */ jsxs18("span", { className: "inline-flex max-w-full items-center gap-1.5", children: [
|
|
6145
|
+
columnIndex === 0 && /* @__PURE__ */ jsx19("span", { className: "inline-flex shrink-0 rounded border border-success/60 px-1 py-px text-[11px] font-semibold uppercase tracking-[0.05em] text-success", children: "New" }),
|
|
6146
|
+
/* @__PURE__ */ jsx19(
|
|
5989
6147
|
"span",
|
|
5990
6148
|
{
|
|
5991
6149
|
className: `tabular-nums ${display === "" ? "text-muted-foreground" : "truncate text-foreground"}`,
|
|
@@ -5994,7 +6152,7 @@ function RecordGridRows({
|
|
|
5994
6152
|
)
|
|
5995
6153
|
] }) }, column.id);
|
|
5996
6154
|
}),
|
|
5997
|
-
/* @__PURE__ */
|
|
6155
|
+
/* @__PURE__ */ jsx19(TableCell, { role: "gridcell", className: "px-3 py-2 text-right", children: /* @__PURE__ */ jsx19(
|
|
5998
6156
|
ReviewActions,
|
|
5999
6157
|
{
|
|
6000
6158
|
rowId: row.id,
|
|
@@ -6014,19 +6172,19 @@ function RecordGridRows({
|
|
|
6014
6172
|
|
|
6015
6173
|
// src/web-react/command-palette.tsx
|
|
6016
6174
|
import {
|
|
6017
|
-
useCallback as
|
|
6018
|
-
useEffect as
|
|
6175
|
+
useCallback as useCallback14,
|
|
6176
|
+
useEffect as useEffect15,
|
|
6019
6177
|
useId as useId4,
|
|
6020
6178
|
useMemo as useMemo9,
|
|
6021
|
-
useRef as
|
|
6022
|
-
useState as
|
|
6179
|
+
useRef as useRef15,
|
|
6180
|
+
useState as useState22
|
|
6023
6181
|
} from "react";
|
|
6024
6182
|
import { Dialog, DialogContent, DialogTitle } from "@tangle-network/ui/primitives";
|
|
6025
|
-
import { jsx as
|
|
6183
|
+
import { jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
6026
6184
|
function SearchGlyph({ className }) {
|
|
6027
|
-
return /* @__PURE__ */
|
|
6028
|
-
/* @__PURE__ */
|
|
6029
|
-
/* @__PURE__ */
|
|
6185
|
+
return /* @__PURE__ */ jsxs19("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
6186
|
+
/* @__PURE__ */ jsx20("circle", { cx: "11", cy: "11", r: "8" }),
|
|
6187
|
+
/* @__PURE__ */ jsx20("path", { d: "m21 21-4.3-4.3" })
|
|
6030
6188
|
] });
|
|
6031
6189
|
}
|
|
6032
6190
|
function CommandPalette({
|
|
@@ -6043,25 +6201,25 @@ function CommandPalette({
|
|
|
6043
6201
|
emptyMessage,
|
|
6044
6202
|
label = "Command palette"
|
|
6045
6203
|
}) {
|
|
6046
|
-
const [internalOpen, setInternalOpen] =
|
|
6204
|
+
const [internalOpen, setInternalOpen] = useState22(false);
|
|
6047
6205
|
const open = controlledOpen ?? internalOpen;
|
|
6048
|
-
const setOpen =
|
|
6206
|
+
const setOpen = useCallback14(
|
|
6049
6207
|
(next) => {
|
|
6050
6208
|
if (controlledOpen === void 0) setInternalOpen(next);
|
|
6051
6209
|
onOpenChange?.(next);
|
|
6052
6210
|
},
|
|
6053
6211
|
[controlledOpen, onOpenChange]
|
|
6054
6212
|
);
|
|
6055
|
-
const [query, setQuery] =
|
|
6056
|
-
const [active, setActive] =
|
|
6057
|
-
const inputRef =
|
|
6213
|
+
const [query, setQuery] = useState22(initialQuery ?? "");
|
|
6214
|
+
const [active, setActive] = useState22(0);
|
|
6215
|
+
const inputRef = useRef15(null);
|
|
6058
6216
|
const surfaceId = useId4();
|
|
6059
6217
|
const listId = `${surfaceId}-list`;
|
|
6060
6218
|
const flat = useMemo9(() => filterCommandPaletteItems(items, query), [items, query]);
|
|
6061
6219
|
const sections = useMemo9(() => groupCommandPaletteItems(flat), [flat]);
|
|
6062
6220
|
const activeIndex = flat.length === 0 ? 0 : Math.min(active, flat.length - 1);
|
|
6063
6221
|
const activeId = flat.length > 0 ? `${listId}-${activeIndex}` : void 0;
|
|
6064
|
-
|
|
6222
|
+
useEffect15(() => {
|
|
6065
6223
|
if (!hotkey) return;
|
|
6066
6224
|
function onKeyDown(e) {
|
|
6067
6225
|
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k") {
|
|
@@ -6072,18 +6230,18 @@ function CommandPalette({
|
|
|
6072
6230
|
document.addEventListener("keydown", onKeyDown);
|
|
6073
6231
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
6074
6232
|
}, [hotkey, open, setOpen]);
|
|
6075
|
-
const restoreFocusRef =
|
|
6076
|
-
|
|
6233
|
+
const restoreFocusRef = useRef15(null);
|
|
6234
|
+
useEffect15(() => {
|
|
6077
6235
|
if (open) return;
|
|
6078
6236
|
setQuery(initialQuery ?? "");
|
|
6079
6237
|
onQueryChange?.(initialQuery ?? "");
|
|
6080
6238
|
setActive(0);
|
|
6081
6239
|
}, [open]);
|
|
6082
|
-
|
|
6240
|
+
useEffect15(() => {
|
|
6083
6241
|
if (!open || !activeId) return;
|
|
6084
6242
|
document.getElementById(activeId)?.scrollIntoView?.({ block: "nearest" });
|
|
6085
6243
|
}, [open, activeId]);
|
|
6086
|
-
const choose =
|
|
6244
|
+
const choose = useCallback14(
|
|
6087
6245
|
(item) => {
|
|
6088
6246
|
onSelect(item);
|
|
6089
6247
|
setOpen(false);
|
|
@@ -6104,7 +6262,7 @@ function CommandPalette({
|
|
|
6104
6262
|
}
|
|
6105
6263
|
};
|
|
6106
6264
|
let rowIndex = -1;
|
|
6107
|
-
return /* @__PURE__ */
|
|
6265
|
+
return /* @__PURE__ */ jsx20(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs19(
|
|
6108
6266
|
DialogContent,
|
|
6109
6267
|
{
|
|
6110
6268
|
hideCloseButton: true,
|
|
@@ -6123,10 +6281,10 @@ function CommandPalette({
|
|
|
6123
6281
|
...{ [POPOVER_SURFACE_ATTR]: surfaceId },
|
|
6124
6282
|
className: `top-[15%] z-[1000] flex max-h-[70vh] w-[560px] max-w-[calc(100vw-2rem)] translate-y-0 flex-col gap-0 overflow-hidden rounded-xl border-card-edge bg-popover p-0 ${OVERLAY_SHADOW}`,
|
|
6125
6283
|
children: [
|
|
6126
|
-
/* @__PURE__ */
|
|
6127
|
-
/* @__PURE__ */
|
|
6128
|
-
/* @__PURE__ */
|
|
6129
|
-
/* @__PURE__ */
|
|
6284
|
+
/* @__PURE__ */ jsx20(DialogTitle, { className: "sr-only", children: label }),
|
|
6285
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex shrink-0 items-center gap-2 border-b border-border px-3 py-2.5", children: [
|
|
6286
|
+
/* @__PURE__ */ jsx20(SearchGlyph, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
6287
|
+
/* @__PURE__ */ jsx20(
|
|
6130
6288
|
"input",
|
|
6131
6289
|
{
|
|
6132
6290
|
ref: inputRef,
|
|
@@ -6148,15 +6306,15 @@ function CommandPalette({
|
|
|
6148
6306
|
}
|
|
6149
6307
|
)
|
|
6150
6308
|
] }),
|
|
6151
|
-
/* @__PURE__ */
|
|
6152
|
-
loading && /* @__PURE__ */
|
|
6153
|
-
!loading && flat.length === 0 && /* @__PURE__ */
|
|
6154
|
-
!loading && sections.map((section) => /* @__PURE__ */
|
|
6155
|
-
/* @__PURE__ */
|
|
6309
|
+
/* @__PURE__ */ jsxs19("div", { role: "listbox", id: listId, className: "min-h-0 flex-1 overflow-y-auto p-1 pb-2", children: [
|
|
6310
|
+
loading && /* @__PURE__ */ jsx20("div", { className: "px-3 py-4 text-center text-sm text-muted-foreground", children: "Loading\u2026" }),
|
|
6311
|
+
!loading && flat.length === 0 && /* @__PURE__ */ jsx20("div", { className: "px-3 py-4 text-center text-sm text-muted-foreground", children: emptyMessage ?? (query.trim() ? `No results for \u201C${query.trim()}\u201D` : "Nothing here yet") }),
|
|
6312
|
+
!loading && sections.map((section) => /* @__PURE__ */ jsxs19("div", { children: [
|
|
6313
|
+
/* @__PURE__ */ jsx20("div", { className: "px-3 pb-1 pt-3 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: section.group }),
|
|
6156
6314
|
section.items.map((item) => {
|
|
6157
6315
|
rowIndex += 1;
|
|
6158
6316
|
const index = rowIndex;
|
|
6159
|
-
return /* @__PURE__ */
|
|
6317
|
+
return /* @__PURE__ */ jsxs19(
|
|
6160
6318
|
"div",
|
|
6161
6319
|
{
|
|
6162
6320
|
id: `${listId}-${index}`,
|
|
@@ -6166,9 +6324,9 @@ function CommandPalette({
|
|
|
6166
6324
|
onClick: () => choose(item),
|
|
6167
6325
|
className: `flex w-full cursor-pointer items-center gap-2.5 rounded-md px-3 py-2.5 text-left text-sm ${index === activeIndex ? "bg-accent" : ""}`,
|
|
6168
6326
|
children: [
|
|
6169
|
-
/* @__PURE__ */
|
|
6170
|
-
item.description && /* @__PURE__ */
|
|
6171
|
-
item.hint && /* @__PURE__ */
|
|
6327
|
+
/* @__PURE__ */ jsx20("span", { className: "truncate text-foreground", children: item.label }),
|
|
6328
|
+
item.description && /* @__PURE__ */ jsx20("span", { className: "truncate text-xs text-muted-foreground", children: item.description }),
|
|
6329
|
+
item.hint && /* @__PURE__ */ jsx20("span", { className: "ml-auto shrink-0 text-xs tabular-nums text-muted-foreground", children: item.hint })
|
|
6172
6330
|
]
|
|
6173
6331
|
},
|
|
6174
6332
|
item.id
|
|
@@ -6176,15 +6334,15 @@ function CommandPalette({
|
|
|
6176
6334
|
})
|
|
6177
6335
|
] }, section.group))
|
|
6178
6336
|
] }),
|
|
6179
|
-
/* @__PURE__ */
|
|
6180
|
-
/* @__PURE__ */
|
|
6181
|
-
/* @__PURE__ */
|
|
6182
|
-
/* @__PURE__ */
|
|
6183
|
-
/* @__PURE__ */
|
|
6184
|
-
/* @__PURE__ */
|
|
6185
|
-
/* @__PURE__ */
|
|
6186
|
-
/* @__PURE__ */
|
|
6187
|
-
/* @__PURE__ */
|
|
6337
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex shrink-0 items-center justify-between border-t border-border px-3 py-2 text-xs text-muted-foreground", children: [
|
|
6338
|
+
/* @__PURE__ */ jsx20("span", { className: "tabular-nums", children: query.trim() ? `${flat.length} of ${items.length}` : `${items.length} items` }),
|
|
6339
|
+
/* @__PURE__ */ jsxs19("span", { className: "flex items-center gap-1.5", children: [
|
|
6340
|
+
/* @__PURE__ */ jsx20("kbd", { className: "rounded border border-border bg-background px-1 py-0.5", children: "\u2191\u2193" }),
|
|
6341
|
+
/* @__PURE__ */ jsx20("span", { children: "navigate" }),
|
|
6342
|
+
/* @__PURE__ */ jsx20("kbd", { className: "ml-1.5 rounded border border-border bg-background px-1 py-0.5", children: "\u21B5" }),
|
|
6343
|
+
/* @__PURE__ */ jsx20("span", { children: "select" }),
|
|
6344
|
+
/* @__PURE__ */ jsx20("kbd", { className: "ml-1.5 rounded border border-border bg-background px-1 py-0.5", children: "esc" }),
|
|
6345
|
+
/* @__PURE__ */ jsx20("span", { children: "close" })
|
|
6188
6346
|
] })
|
|
6189
6347
|
] })
|
|
6190
6348
|
]
|
|
@@ -6193,7 +6351,7 @@ function CommandPalette({
|
|
|
6193
6351
|
}
|
|
6194
6352
|
|
|
6195
6353
|
// src/web-react/sparkline.tsx
|
|
6196
|
-
import { jsx as
|
|
6354
|
+
import { jsx as jsx21, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
6197
6355
|
var DEFAULT_SPARKLINE_WIDTH = 96;
|
|
6198
6356
|
var DEFAULT_SPARKLINE_HEIGHT = 24;
|
|
6199
6357
|
var DEFAULT_INSET = 2.5;
|
|
@@ -6299,21 +6457,21 @@ function Sparkline({
|
|
|
6299
6457
|
const geometry = sparklineGeometry(values, { width, height });
|
|
6300
6458
|
const accessibleName = sparklineLabel(values, { label, format });
|
|
6301
6459
|
if (geometry.points.length === 0) {
|
|
6302
|
-
return /* @__PURE__ */
|
|
6460
|
+
return /* @__PURE__ */ jsxs20(
|
|
6303
6461
|
"span",
|
|
6304
6462
|
{
|
|
6305
6463
|
"data-sparkline": geometry.gaps > 0 ? "unavailable" : "empty",
|
|
6306
6464
|
className: joinClasses("text-[11px] text-muted-foreground", className),
|
|
6307
6465
|
children: [
|
|
6308
|
-
/* @__PURE__ */
|
|
6309
|
-
/* @__PURE__ */
|
|
6466
|
+
/* @__PURE__ */ jsx21("span", { className: "sr-only", children: accessibleName }),
|
|
6467
|
+
/* @__PURE__ */ jsx21("span", { "aria-hidden": "true", children: geometry.gaps > 0 ? unavailableLabel : emptyLabel })
|
|
6310
6468
|
]
|
|
6311
6469
|
}
|
|
6312
6470
|
);
|
|
6313
6471
|
}
|
|
6314
6472
|
const drawsLine = geometry.segments.some((segment) => segment.length > 1);
|
|
6315
6473
|
const end = geometry.points[geometry.points.length - 1];
|
|
6316
|
-
return /* @__PURE__ */
|
|
6474
|
+
return /* @__PURE__ */ jsxs20(
|
|
6317
6475
|
"svg",
|
|
6318
6476
|
{
|
|
6319
6477
|
role: "img",
|
|
@@ -6330,7 +6488,7 @@ function Sparkline({
|
|
|
6330
6488
|
geometry.segments.map((segment, index) => {
|
|
6331
6489
|
const key = `segment-${index}`;
|
|
6332
6490
|
if (segment.length > 1) {
|
|
6333
|
-
return /* @__PURE__ */
|
|
6491
|
+
return /* @__PURE__ */ jsx21(
|
|
6334
6492
|
"polyline",
|
|
6335
6493
|
{
|
|
6336
6494
|
points: sparklinePointsAttribute(segment),
|
|
@@ -6346,9 +6504,9 @@ function Sparkline({
|
|
|
6346
6504
|
}
|
|
6347
6505
|
const only = segment[0];
|
|
6348
6506
|
if (only.x === end.x && only.y === end.y) return null;
|
|
6349
|
-
return /* @__PURE__ */
|
|
6507
|
+
return /* @__PURE__ */ jsx21("circle", { cx: only.x, cy: only.y, r: DOT_RADIUS, fill: "currentColor" }, key);
|
|
6350
6508
|
}),
|
|
6351
|
-
/* @__PURE__ */
|
|
6509
|
+
/* @__PURE__ */ jsx21("circle", { cx: end.x, cy: end.y, r: DOT_RADIUS, fill: "currentColor" })
|
|
6352
6510
|
]
|
|
6353
6511
|
}
|
|
6354
6512
|
);
|
|
@@ -6357,12 +6515,12 @@ function Sparkline({
|
|
|
6357
6515
|
// src/web-react/insight-card.tsx
|
|
6358
6516
|
import {
|
|
6359
6517
|
isValidElement as isValidElement2,
|
|
6360
|
-
useCallback as
|
|
6361
|
-
useEffect as
|
|
6362
|
-
useRef as
|
|
6363
|
-
useState as
|
|
6518
|
+
useCallback as useCallback15,
|
|
6519
|
+
useEffect as useEffect16,
|
|
6520
|
+
useRef as useRef16,
|
|
6521
|
+
useState as useState23
|
|
6364
6522
|
} from "react";
|
|
6365
|
-
import { Fragment as Fragment7, jsx as
|
|
6523
|
+
import { Fragment as Fragment7, jsx as jsx22, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
6366
6524
|
function insightDelta(value, previous) {
|
|
6367
6525
|
if (typeof value !== "number" || !Number.isFinite(value)) return null;
|
|
6368
6526
|
if (typeof previous !== "number" || !Number.isFinite(previous)) return null;
|
|
@@ -6415,7 +6573,7 @@ function InsightCard({
|
|
|
6415
6573
|
const tone = delta ? insightDeltaTone(delta.direction, polarity) : "neutral";
|
|
6416
6574
|
const unavailable = typeof value === "number" && !Number.isFinite(value);
|
|
6417
6575
|
const shown = typeof value === "number" ? format(value) : value;
|
|
6418
|
-
return /* @__PURE__ */
|
|
6576
|
+
return /* @__PURE__ */ jsxs21(
|
|
6419
6577
|
"article",
|
|
6420
6578
|
{
|
|
6421
6579
|
"data-insight-card": "",
|
|
@@ -6423,40 +6581,40 @@ function InsightCard({
|
|
|
6423
6581
|
className: joinClasses("agent-arrive flex h-full flex-col rounded-xl border border-card-edge bg-card p-4", className),
|
|
6424
6582
|
style,
|
|
6425
6583
|
children: [
|
|
6426
|
-
eyebrow ? /* @__PURE__ */
|
|
6427
|
-
/* @__PURE__ */
|
|
6428
|
-
/* @__PURE__ */
|
|
6584
|
+
eyebrow ? /* @__PURE__ */ jsx22("p", { "data-insight-eyebrow": "", className: "mb-0.5 text-[11px] font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: eyebrow }) : null,
|
|
6585
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-baseline justify-between gap-2", children: [
|
|
6586
|
+
/* @__PURE__ */ jsx22("h3", { className: "text-[13px] font-medium text-muted-foreground", children: title }),
|
|
6429
6587
|
live ? (
|
|
6430
6588
|
// No `data-motion` opt-out: the word is the signal and the sweep is
|
|
6431
6589
|
// emphasis, so the reduced-motion floor reaches this like everything
|
|
6432
6590
|
// else and leaves a static, legible label.
|
|
6433
|
-
/* @__PURE__ */
|
|
6591
|
+
/* @__PURE__ */ jsx22("span", { className: "agent-shimmer shrink-0 text-[11px] font-medium", "data-insight-live": "", children: liveLabel })
|
|
6434
6592
|
) : null
|
|
6435
6593
|
] }),
|
|
6436
|
-
/* @__PURE__ */
|
|
6437
|
-
/* @__PURE__ */
|
|
6438
|
-
/* @__PURE__ */
|
|
6439
|
-
] }) : /* @__PURE__ */
|
|
6440
|
-
/* @__PURE__ */
|
|
6441
|
-
unit ? /* @__PURE__ */
|
|
6594
|
+
/* @__PURE__ */ jsx22("p", { className: "mt-1 flex items-baseline gap-1", children: unavailable ? /* @__PURE__ */ jsxs21("span", { "data-insight-value": "unavailable", className: "text-xl font-semibold text-muted-foreground", children: [
|
|
6595
|
+
/* @__PURE__ */ jsx22("span", { "aria-hidden": "true", children: INSIGHT_UNAVAILABLE_GLYPH }),
|
|
6596
|
+
/* @__PURE__ */ jsx22("span", { className: "sr-only", children: INSIGHT_UNAVAILABLE_LABEL })
|
|
6597
|
+
] }) : /* @__PURE__ */ jsxs21(Fragment7, { children: [
|
|
6598
|
+
/* @__PURE__ */ jsx22("span", { className: "text-xl font-semibold tabular-nums text-foreground", children: shown }),
|
|
6599
|
+
unit ? /* @__PURE__ */ jsx22("span", { className: "text-[11px] text-muted-foreground", children: unit }) : null
|
|
6442
6600
|
] }) }),
|
|
6443
|
-
delta ? /* @__PURE__ */
|
|
6444
|
-
/* @__PURE__ */
|
|
6601
|
+
delta ? /* @__PURE__ */ jsxs21("p", { "data-insight-delta": delta.direction, className: `mt-0.5 text-[11px] font-medium ${TONE_CLASS[tone]}`, children: [
|
|
6602
|
+
/* @__PURE__ */ jsxs21("span", { "aria-hidden": "true", children: [
|
|
6445
6603
|
DIRECTION_GLYPH[delta.direction],
|
|
6446
6604
|
" "
|
|
6447
6605
|
] }),
|
|
6448
6606
|
formatInsightDelta(delta, format)
|
|
6449
6607
|
] }) : null,
|
|
6450
|
-
description ? /* @__PURE__ */
|
|
6451
|
-
series ? /* @__PURE__ */
|
|
6452
|
-
action ? /* @__PURE__ */
|
|
6608
|
+
description ? /* @__PURE__ */ jsx22("p", { className: "mt-1 text-[11px] text-muted-foreground", children: description }) : null,
|
|
6609
|
+
series ? /* @__PURE__ */ jsx22("div", { className: "mt-2 text-muted-foreground", children: /* @__PURE__ */ jsx22(Sparkline, { values: series, label: seriesLabel ?? title, format }) }) : null,
|
|
6610
|
+
action ? /* @__PURE__ */ jsx22("div", { className: "mt-3", children: renderInsightAction(action) }) : null
|
|
6453
6611
|
]
|
|
6454
6612
|
}
|
|
6455
6613
|
);
|
|
6456
6614
|
}
|
|
6457
6615
|
function renderInsightAction(action) {
|
|
6458
6616
|
if (isValidElement2(action)) return action;
|
|
6459
|
-
return /* @__PURE__ */
|
|
6617
|
+
return /* @__PURE__ */ jsx22(
|
|
6460
6618
|
"button",
|
|
6461
6619
|
{
|
|
6462
6620
|
type: "button",
|
|
@@ -6525,15 +6683,15 @@ function InsightDeck({
|
|
|
6525
6683
|
className,
|
|
6526
6684
|
onPageChange
|
|
6527
6685
|
}) {
|
|
6528
|
-
const [page, setPage] =
|
|
6529
|
-
const [held, setHeld] =
|
|
6686
|
+
const [page, setPage] = useState23(0);
|
|
6687
|
+
const [held, setHeld] = useState23(null);
|
|
6530
6688
|
const answered = state.status === "error" || state.status === "empty";
|
|
6531
6689
|
const carried = state.status === "ready" ? state.value : answered ? null : held;
|
|
6532
6690
|
if (carried !== held) setHeld(carried);
|
|
6533
6691
|
const shown = carried !== null && state.status !== "ready" ? { status: "ready", value: carried, retry: state.retry } : state;
|
|
6534
6692
|
const refreshing = shown !== state;
|
|
6535
|
-
const reported =
|
|
6536
|
-
const settlePage =
|
|
6693
|
+
const reported = useRef16(0);
|
|
6694
|
+
const settlePage = useCallback15(
|
|
6537
6695
|
(next) => {
|
|
6538
6696
|
if (reported.current === next) return;
|
|
6539
6697
|
reported.current = next;
|
|
@@ -6541,7 +6699,7 @@ function InsightDeck({
|
|
|
6541
6699
|
},
|
|
6542
6700
|
[onPageChange]
|
|
6543
6701
|
);
|
|
6544
|
-
return /* @__PURE__ */
|
|
6702
|
+
return /* @__PURE__ */ jsx22(
|
|
6545
6703
|
AsyncView,
|
|
6546
6704
|
{
|
|
6547
6705
|
state: shown,
|
|
@@ -6549,7 +6707,7 @@ function InsightDeck({
|
|
|
6549
6707
|
loadingLabel,
|
|
6550
6708
|
retryLabel,
|
|
6551
6709
|
className,
|
|
6552
|
-
children: (insights) => /* @__PURE__ */
|
|
6710
|
+
children: (insights) => /* @__PURE__ */ jsx22(
|
|
6553
6711
|
InsightPages,
|
|
6554
6712
|
{
|
|
6555
6713
|
insights,
|
|
@@ -6616,18 +6774,18 @@ function InsightPages({
|
|
|
6616
6774
|
const pageCount = insightPageCount(insights.length, size);
|
|
6617
6775
|
const current = Math.min(Math.max(page, 0), pageCount - 1);
|
|
6618
6776
|
const visible = insightPageSlice(insights, current, size);
|
|
6619
|
-
const sectionRef =
|
|
6620
|
-
const listRef =
|
|
6621
|
-
const recoverFocus =
|
|
6622
|
-
|
|
6777
|
+
const sectionRef = useRef16(null);
|
|
6778
|
+
const listRef = useRef16(null);
|
|
6779
|
+
const recoverFocus = useRef16(false);
|
|
6780
|
+
useEffect16(() => {
|
|
6623
6781
|
onPageSettled(current);
|
|
6624
6782
|
}, [current, onPageSettled]);
|
|
6625
|
-
|
|
6783
|
+
useEffect16(() => {
|
|
6626
6784
|
if (!recoverFocus.current) return;
|
|
6627
6785
|
recoverFocus.current = false;
|
|
6628
6786
|
sectionRef.current?.focus();
|
|
6629
6787
|
}, [current]);
|
|
6630
|
-
const goTo =
|
|
6788
|
+
const goTo = useCallback15(
|
|
6631
6789
|
(next) => {
|
|
6632
6790
|
const clamped = Math.min(Math.max(next, 0), pageCount - 1);
|
|
6633
6791
|
if (clamped === current) return false;
|
|
@@ -6662,7 +6820,7 @@ function InsightPages({
|
|
|
6662
6820
|
}
|
|
6663
6821
|
if (moved) event.preventDefault();
|
|
6664
6822
|
};
|
|
6665
|
-
return /* @__PURE__ */
|
|
6823
|
+
return /* @__PURE__ */ jsxs21(
|
|
6666
6824
|
"section",
|
|
6667
6825
|
{
|
|
6668
6826
|
ref: sectionRef,
|
|
@@ -6674,7 +6832,7 @@ function InsightPages({
|
|
|
6674
6832
|
tabIndex: pageCount > 1 ? 0 : void 0,
|
|
6675
6833
|
"aria-keyshortcuts": pageCount > 1 ? "ArrowLeft ArrowRight PageUp PageDown Home End" : void 0,
|
|
6676
6834
|
children: [
|
|
6677
|
-
/* @__PURE__ */
|
|
6835
|
+
/* @__PURE__ */ jsx22("ul", { ref: listRef, className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-3", children: visible.map(({ id, style, ...card }, index) => (
|
|
6678
6836
|
// The page index is in the key on purpose: a page turn is an arrival,
|
|
6679
6837
|
// and reusing the node would swap the text under a card that never
|
|
6680
6838
|
// moved. Remounting replays `.agent-arrive` with the new stagger.
|
|
@@ -6685,10 +6843,10 @@ function InsightPages({
|
|
|
6685
6843
|
// does not arrive a second time. The key does BOTH jobs — but only
|
|
6686
6844
|
// because the deck now keeps this subtree mounted across a reload
|
|
6687
6845
|
// (see `InsightDeck`); a key is never compared across a teardown.
|
|
6688
|
-
/* @__PURE__ */
|
|
6846
|
+
/* @__PURE__ */ jsx22("li", { children: /* @__PURE__ */ jsx22(InsightCard, { ...card, style: staggerStyle(index, style) }) }, `${current}:${id}`)
|
|
6689
6847
|
)) }),
|
|
6690
|
-
/* @__PURE__ */
|
|
6691
|
-
/* @__PURE__ */
|
|
6848
|
+
/* @__PURE__ */ jsxs21("div", { className: pageCount > 1 ? "flex items-center justify-between gap-2" : void 0, children: [
|
|
6849
|
+
/* @__PURE__ */ jsxs21(
|
|
6692
6850
|
"p",
|
|
6693
6851
|
{
|
|
6694
6852
|
role: "status",
|
|
@@ -6702,8 +6860,8 @@ function InsightPages({
|
|
|
6702
6860
|
]
|
|
6703
6861
|
}
|
|
6704
6862
|
),
|
|
6705
|
-
pageCount > 1 ? /* @__PURE__ */
|
|
6706
|
-
/* @__PURE__ */
|
|
6863
|
+
pageCount > 1 ? /* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-1", children: [
|
|
6864
|
+
/* @__PURE__ */ jsx22(PagerButton, { label: "Previous insights", glyph: "\u2039", atEnd: current === 0, onClick: () => goTo(current - 1) }),
|
|
6707
6865
|
pageCount <= MAX_PAGE_DOTS ? Array.from({ length: pageCount }, (_, index) => (
|
|
6708
6866
|
// WCAG 2.2 SC 2.5.8 wants a 24x24 CSS px target. The dot stays
|
|
6709
6867
|
// 8px because a 24px dot is a different control; the BUTTON
|
|
@@ -6711,7 +6869,7 @@ function InsightPages({
|
|
|
6711
6869
|
// and the span is the graphic. The Spacing exception cannot
|
|
6712
6870
|
// rescue the bare dot — at a 12px pitch the 24px circle around
|
|
6713
6871
|
// each centre overlaps its neighbour's.
|
|
6714
|
-
/* @__PURE__ */
|
|
6872
|
+
/* @__PURE__ */ jsx22(
|
|
6715
6873
|
"button",
|
|
6716
6874
|
{
|
|
6717
6875
|
type: "button",
|
|
@@ -6719,7 +6877,7 @@ function InsightPages({
|
|
|
6719
6877
|
"aria-current": index === current ? "page" : void 0,
|
|
6720
6878
|
onClick: () => goTo(index),
|
|
6721
6879
|
className: "group flex h-6 w-6 shrink-0 items-center justify-center rounded-full",
|
|
6722
|
-
children: /* @__PURE__ */
|
|
6880
|
+
children: /* @__PURE__ */ jsx22(
|
|
6723
6881
|
"span",
|
|
6724
6882
|
{
|
|
6725
6883
|
"aria-hidden": "true",
|
|
@@ -6733,7 +6891,7 @@ function InsightPages({
|
|
|
6733
6891
|
index
|
|
6734
6892
|
)
|
|
6735
6893
|
)) : null,
|
|
6736
|
-
/* @__PURE__ */
|
|
6894
|
+
/* @__PURE__ */ jsx22(
|
|
6737
6895
|
PagerButton,
|
|
6738
6896
|
{
|
|
6739
6897
|
label: "Next insights",
|
|
@@ -6754,7 +6912,7 @@ function PagerButton({
|
|
|
6754
6912
|
atEnd,
|
|
6755
6913
|
onClick
|
|
6756
6914
|
}) {
|
|
6757
|
-
return /* @__PURE__ */
|
|
6915
|
+
return /* @__PURE__ */ jsx22(
|
|
6758
6916
|
"button",
|
|
6759
6917
|
{
|
|
6760
6918
|
type: "button",
|
|
@@ -6764,15 +6922,15 @@ function PagerButton({
|
|
|
6764
6922
|
if (!atEnd) onClick();
|
|
6765
6923
|
},
|
|
6766
6924
|
className: `flex h-6 w-6 items-center justify-center rounded-md border border-border text-xs text-muted-foreground transition ${atEnd ? "opacity-40" : "hover:bg-accent hover:text-foreground"}`,
|
|
6767
|
-
children: /* @__PURE__ */
|
|
6925
|
+
children: /* @__PURE__ */ jsx22("span", { "aria-hidden": "true", children: glyph })
|
|
6768
6926
|
}
|
|
6769
6927
|
);
|
|
6770
6928
|
}
|
|
6771
6929
|
|
|
6772
6930
|
// src/web-react/review-inbox.tsx
|
|
6773
|
-
import { useEffect as
|
|
6931
|
+
import { useEffect as useEffect17, useRef as useRef17, useState as useState24 } from "react";
|
|
6774
6932
|
import { Button as Button5, PageHeader } from "@tangle-network/ui/primitives";
|
|
6775
|
-
import { Fragment as Fragment8, jsx as
|
|
6933
|
+
import { Fragment as Fragment8, jsx as jsx23, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
6776
6934
|
var revisionKey = (item) => JSON.stringify([item.id, item.revision]);
|
|
6777
6935
|
function comparisonOrder(items, seed) {
|
|
6778
6936
|
const result = [...items].sort((a, b) => a.id < b.id ? -1 : a.id > b.id ? 1 : 0);
|
|
@@ -6789,20 +6947,20 @@ function ordered(items) {
|
|
|
6789
6947
|
return [...items].sort((left, right) => left.createdAt - right.createdAt || (left.id < right.id ? -1 : left.id > right.id ? 1 : 0));
|
|
6790
6948
|
}
|
|
6791
6949
|
function ReviewInbox({ items, initialSelectedId, renderItem, renderCompareBrief, onVerdict, onFeedback, loading = false, error, onRefresh }) {
|
|
6792
|
-
const [round2, setRound] =
|
|
6793
|
-
const [answered, setAnswered] =
|
|
6794
|
-
const [resolvedElsewhere, setResolvedElsewhere] =
|
|
6795
|
-
const [activeId, setActiveId] =
|
|
6796
|
-
const [busy, setBusy] =
|
|
6797
|
-
const [refreshing, setRefreshing] =
|
|
6798
|
-
const [restart, setRestart] =
|
|
6799
|
-
const [refreshError, setRefreshError] =
|
|
6800
|
-
const cache =
|
|
6801
|
-
const comparisons =
|
|
6802
|
-
const drafts =
|
|
6803
|
-
const pending =
|
|
6804
|
-
const section =
|
|
6805
|
-
const form =
|
|
6950
|
+
const [round2, setRound] = useState24(() => ordered(items).map((item) => item.id));
|
|
6951
|
+
const [answered, setAnswered] = useState24(/* @__PURE__ */ new Set());
|
|
6952
|
+
const [resolvedElsewhere, setResolvedElsewhere] = useState24(/* @__PURE__ */ new Set());
|
|
6953
|
+
const [activeId, setActiveId] = useState24(() => items.some((item) => item.id === initialSelectedId) ? initialSelectedId : ordered(items)[0]?.id ?? null);
|
|
6954
|
+
const [busy, setBusy] = useState24(false);
|
|
6955
|
+
const [refreshing, setRefreshing] = useState24(false);
|
|
6956
|
+
const [restart, setRestart] = useState24(false);
|
|
6957
|
+
const [refreshError, setRefreshError] = useState24("");
|
|
6958
|
+
const cache = useRef17(/* @__PURE__ */ new Map());
|
|
6959
|
+
const comparisons = useRef17(/* @__PURE__ */ new Map());
|
|
6960
|
+
const drafts = useRef17(/* @__PURE__ */ new Map());
|
|
6961
|
+
const pending = useRef17(false);
|
|
6962
|
+
const section = useRef17(null);
|
|
6963
|
+
const form = useRef17(null);
|
|
6806
6964
|
for (const item of items) {
|
|
6807
6965
|
cache.current.set(item.id, item);
|
|
6808
6966
|
if (!comparisons.current.has(item.id)) comparisons.current.set(item.id, item.compare ? { ...item.compare } : void 0);
|
|
@@ -6834,7 +6992,7 @@ function ReviewInbox({ items, initialSelectedId, renderItem, renderCompareBrief,
|
|
|
6834
6992
|
position: compareItems.findIndex((cell) => cell.id === item.id),
|
|
6835
6993
|
itemIds: compareItems.map((cell) => cell.id)
|
|
6836
6994
|
} : void 0;
|
|
6837
|
-
|
|
6995
|
+
useEffect17(() => {
|
|
6838
6996
|
if (loading || !restart && (round2.length > 0 || items.length === 0)) return;
|
|
6839
6997
|
const next = ordered(items).map((item) => item.id);
|
|
6840
6998
|
comparisons.current = new Map(items.map((item) => [item.id, item.compare ? { ...item.compare } : void 0]));
|
|
@@ -6844,7 +7002,7 @@ function ReviewInbox({ items, initialSelectedId, renderItem, renderCompareBrief,
|
|
|
6844
7002
|
setResolvedElsewhere(/* @__PURE__ */ new Set());
|
|
6845
7003
|
setRestart(false);
|
|
6846
7004
|
}, [items, loading, restart, round2.length, initialSelectedId]);
|
|
6847
|
-
|
|
7005
|
+
useEffect17(() => {
|
|
6848
7006
|
if (loading || error || busy || refreshing) return;
|
|
6849
7007
|
const present = new Set(items.map((item) => item.id));
|
|
6850
7008
|
setResolvedElsewhere((previous) => {
|
|
@@ -6852,7 +7010,7 @@ function ReviewInbox({ items, initialSelectedId, renderItem, renderCompareBrief,
|
|
|
6852
7010
|
return next.size === previous.size && [...next].every((id) => previous.has(id)) ? previous : next;
|
|
6853
7011
|
});
|
|
6854
7012
|
}, [items, loading, error, busy, refreshing, round2]);
|
|
6855
|
-
|
|
7013
|
+
useEffect17(() => {
|
|
6856
7014
|
setActiveId(currentId ?? null);
|
|
6857
7015
|
if (!compare) section.current?.focus({ preventScroll: true });
|
|
6858
7016
|
}, [currentKey, !!compare]);
|
|
@@ -6906,7 +7064,7 @@ function ReviewInbox({ items, initialSelectedId, renderItem, renderCompareBrief,
|
|
|
6906
7064
|
setRefreshing(false);
|
|
6907
7065
|
}
|
|
6908
7066
|
}
|
|
6909
|
-
|
|
7067
|
+
useEffect17(() => {
|
|
6910
7068
|
function shortcut(event) {
|
|
6911
7069
|
if (event.defaultPrevented || event.repeat || event.altKey || event.ctrlKey || event.metaKey || event.isComposing) return;
|
|
6912
7070
|
const target = event.target instanceof Element ? event.target : null;
|
|
@@ -6935,7 +7093,7 @@ function ReviewInbox({ items, initialSelectedId, renderItem, renderCompareBrief,
|
|
|
6935
7093
|
window.addEventListener("keydown", shortcut);
|
|
6936
7094
|
return () => window.removeEventListener("keydown", shortcut);
|
|
6937
7095
|
});
|
|
6938
|
-
return /* @__PURE__ */
|
|
7096
|
+
return /* @__PURE__ */ jsxs22(
|
|
6939
7097
|
"section",
|
|
6940
7098
|
{
|
|
6941
7099
|
ref: section,
|
|
@@ -6945,44 +7103,44 @@ function ReviewInbox({ items, initialSelectedId, renderItem, renderCompareBrief,
|
|
|
6945
7103
|
className: `mx-auto min-w-0 space-y-5 outline-none ${compare ? "max-w-none" : "max-w-4xl"}`,
|
|
6946
7104
|
"data-review-inbox": true,
|
|
6947
7105
|
children: [
|
|
6948
|
-
/* @__PURE__ */
|
|
7106
|
+
/* @__PURE__ */ jsx23(
|
|
6949
7107
|
PageHeader,
|
|
6950
7108
|
{
|
|
6951
7109
|
title: "Review inbox",
|
|
6952
7110
|
description: "Review the oldest work first. Every decision includes your score and feedback.",
|
|
6953
|
-
actions: onRefresh && /* @__PURE__ */
|
|
6954
|
-
meta: /* @__PURE__ */
|
|
7111
|
+
actions: onRefresh && /* @__PURE__ */ jsx23(Button5, { variant: "outline", disabled: busy || refreshing || loading, onClick: () => void refresh(), children: refreshing ? "Refreshing\u2026" : "Refresh" }),
|
|
7112
|
+
meta: /* @__PURE__ */ jsx23("p", { role: "status", "data-review-progress": true, children: active ? `${compare ? reviewed : rank} of ${round2.length}${compare ? " resolved" : ""}` : `${reviewed} of ${round2.length} resolved` })
|
|
6955
7113
|
}
|
|
6956
7114
|
),
|
|
6957
|
-
(error || refreshError) && /* @__PURE__ */
|
|
6958
|
-
round2.length > 0 && /* @__PURE__ */
|
|
6959
|
-
(loading || error) && !active ? /* @__PURE__ */
|
|
6960
|
-
/* @__PURE__ */
|
|
6961
|
-
/* @__PURE__ */
|
|
7115
|
+
(error || refreshError) && /* @__PURE__ */ jsx23("p", { role: "alert", className: "text-sm text-[var(--surface-danger-text)]", children: error || refreshError }),
|
|
7116
|
+
round2.length > 0 && /* @__PURE__ */ jsx23("progress", { "aria-label": "Items resolved this round", value: reviewed, max: round2.length, className: "h-1.5 w-full accent-primary" }),
|
|
7117
|
+
(loading || error) && !active ? /* @__PURE__ */ jsx23("p", { role: "status", children: loading ? "Loading the review inbox\u2026" : "The review inbox could not load." }) : !active ? /* @__PURE__ */ jsxs22("div", { className: "py-12 text-center", children: [
|
|
7118
|
+
/* @__PURE__ */ jsx23("h2", { className: "text-xl font-semibold", children: "All caught up" }),
|
|
7119
|
+
/* @__PURE__ */ jsxs22("p", { className: "mt-2 text-sm text-muted-foreground", children: [
|
|
6962
7120
|
reviewed,
|
|
6963
7121
|
" of ",
|
|
6964
7122
|
round2.length,
|
|
6965
7123
|
" resolved this round."
|
|
6966
7124
|
] })
|
|
6967
|
-
] }) : /* @__PURE__ */
|
|
6968
|
-
/* @__PURE__ */
|
|
6969
|
-
/* @__PURE__ */
|
|
6970
|
-
!compare && /* @__PURE__ */
|
|
6971
|
-
/* @__PURE__ */
|
|
7125
|
+
] }) : /* @__PURE__ */ jsxs22(Fragment8, { children: [
|
|
7126
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [
|
|
7127
|
+
/* @__PURE__ */ jsxs22("div", { className: "min-w-0", children: [
|
|
7128
|
+
!compare && /* @__PURE__ */ jsx23("p", { className: "text-sm text-muted-foreground", children: active.kind }),
|
|
7129
|
+
/* @__PURE__ */ jsx23("h2", { className: "break-words text-lg font-semibold", "data-review-title": true, children: compare ? "Compare drafts" : active.title })
|
|
6972
7130
|
] }),
|
|
6973
|
-
/* @__PURE__ */
|
|
6974
|
-
/* @__PURE__ */
|
|
6975
|
-
/* @__PURE__ */
|
|
7131
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex gap-2", children: [
|
|
7132
|
+
/* @__PURE__ */ jsx23(Button5, { variant: "outline", "aria-keyshortcuts": "K", disabled: busy || unanswered.length < 2, onClick: () => navigate(-1), children: "Previous" }),
|
|
7133
|
+
/* @__PURE__ */ jsx23(Button5, { variant: "outline", "aria-keyshortcuts": "J", disabled: busy || unanswered.length < 2, onClick: () => navigate(1), children: "Next" })
|
|
6976
7134
|
] })
|
|
6977
7135
|
] }),
|
|
6978
|
-
compare ? /* @__PURE__ */
|
|
6979
|
-
renderCompareBrief && /* @__PURE__ */
|
|
6980
|
-
!compareValid && /* @__PURE__ */
|
|
6981
|
-
/* @__PURE__ */
|
|
7136
|
+
compare ? /* @__PURE__ */ jsxs22(Fragment8, { children: [
|
|
7137
|
+
renderCompareBrief && /* @__PURE__ */ jsx23("div", { "data-review-compare-brief": true, children: renderCompareBrief(compare.rowId) }),
|
|
7138
|
+
!compareValid && /* @__PURE__ */ jsx23("p", { role: "alert", children: "This comparison changed. Refresh the inbox before reviewing it." }),
|
|
7139
|
+
/* @__PURE__ */ jsx23("div", { className: "grid min-w-0 grid-cols-1 gap-4 lg:grid-cols-2 xl:grid-cols-3", "data-review-compare-row": true, children: compareItems.map((item, index) => {
|
|
6982
7140
|
const key = revisionKey(item);
|
|
6983
7141
|
const done = isAnswered(item);
|
|
6984
7142
|
const present = currentItems.has(item.id);
|
|
6985
|
-
return /* @__PURE__ */
|
|
7143
|
+
return /* @__PURE__ */ jsxs22(
|
|
6986
7144
|
"article",
|
|
6987
7145
|
{
|
|
6988
7146
|
"aria-label": `Draft ${index + 1}`,
|
|
@@ -6992,13 +7150,13 @@ function ReviewInbox({ items, initialSelectedId, renderItem, renderCompareBrief,
|
|
|
6992
7150
|
if (!done && present) setActiveId(item.id);
|
|
6993
7151
|
},
|
|
6994
7152
|
children: [
|
|
6995
|
-
/* @__PURE__ */
|
|
7153
|
+
/* @__PURE__ */ jsxs22("h3", { className: "text-lg font-semibold", children: [
|
|
6996
7154
|
"Draft ",
|
|
6997
7155
|
index + 1
|
|
6998
7156
|
] }),
|
|
6999
|
-
/* @__PURE__ */
|
|
7000
|
-
present && !done && !item.canReview && /* @__PURE__ */
|
|
7001
|
-
done ? /* @__PURE__ */
|
|
7157
|
+
/* @__PURE__ */ jsx23("div", { className: "min-w-0", "data-review-content": true, children: renderItem(item) }),
|
|
7158
|
+
present && !done && !item.canReview && /* @__PURE__ */ jsx23("p", { className: "text-sm text-muted-foreground", children: "You do not have permission to review this item." }),
|
|
7159
|
+
done ? /* @__PURE__ */ jsx23("p", { role: "status", children: "Review saved" }) : !present ? /* @__PURE__ */ jsx23("p", { role: "status", children: "This draft is no longer waiting." }) : /* @__PURE__ */ jsx23(
|
|
7002
7160
|
ReviewFeedbackForm,
|
|
7003
7161
|
{
|
|
7004
7162
|
draftKey: key,
|
|
@@ -7018,10 +7176,10 @@ function ReviewInbox({ items, initialSelectedId, renderItem, renderCompareBrief,
|
|
|
7018
7176
|
key
|
|
7019
7177
|
);
|
|
7020
7178
|
}) })
|
|
7021
|
-
] }) : /* @__PURE__ */
|
|
7022
|
-
available && !active.canReview && /* @__PURE__ */
|
|
7023
|
-
/* @__PURE__ */
|
|
7024
|
-
/* @__PURE__ */
|
|
7179
|
+
] }) : /* @__PURE__ */ jsxs22(Fragment8, { children: [
|
|
7180
|
+
available && !active.canReview && /* @__PURE__ */ jsx23("p", { className: "text-sm text-muted-foreground", children: "You do not have permission to review this item." }),
|
|
7181
|
+
/* @__PURE__ */ jsx23("div", { className: "min-w-0", "data-review-content": true, children: renderItem(active) }),
|
|
7182
|
+
/* @__PURE__ */ jsx23(
|
|
7025
7183
|
ReviewFeedbackForm,
|
|
7026
7184
|
{
|
|
7027
7185
|
ref: form,
|
|
@@ -7039,7 +7197,7 @@ function ReviewInbox({ items, initialSelectedId, renderItem, renderCompareBrief,
|
|
|
7039
7197
|
currentKey
|
|
7040
7198
|
)
|
|
7041
7199
|
] }),
|
|
7042
|
-
!compare && /* @__PURE__ */
|
|
7200
|
+
!compare && /* @__PURE__ */ jsx23("p", { className: "text-xs leading-5 text-muted-foreground", children: "A approve \xB7 R request changes \xB7 S score \xB7 J/K next/previous \xB7 Esc leave a field. Shortcuts pause while typing." })
|
|
7043
7201
|
] })
|
|
7044
7202
|
]
|
|
7045
7203
|
}
|
|
@@ -7061,48 +7219,48 @@ function formatTokensPerSecond(msg) {
|
|
|
7061
7219
|
}
|
|
7062
7220
|
|
|
7063
7221
|
// src/web-react/run-drill-in.tsx
|
|
7064
|
-
import { jsx as
|
|
7222
|
+
import { jsx as jsx24, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
7065
7223
|
function RunDrillIn({ run, onClose }) {
|
|
7066
|
-
return /* @__PURE__ */
|
|
7067
|
-
/* @__PURE__ */
|
|
7068
|
-
/* @__PURE__ */
|
|
7224
|
+
return /* @__PURE__ */ jsxs23("div", { className: `fixed inset-y-0 right-0 z-50 flex w-[480px] max-w-full flex-col border-l border-card-edge bg-popover ${OVERLAY_SHADOW}`, children: [
|
|
7225
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-2 border-b border-border px-4 py-3", children: [
|
|
7226
|
+
/* @__PURE__ */ jsx24(
|
|
7069
7227
|
"span",
|
|
7070
7228
|
{
|
|
7071
7229
|
className: `h-2 w-2 shrink-0 rounded-full ${run.status === "running" ? "bg-warning" : run.status === "error" ? "bg-destructive" : "bg-success"}`
|
|
7072
7230
|
}
|
|
7073
7231
|
),
|
|
7074
|
-
/* @__PURE__ */
|
|
7075
|
-
/* @__PURE__ */
|
|
7076
|
-
/* @__PURE__ */
|
|
7232
|
+
/* @__PURE__ */ jsxs23("div", { className: "min-w-0 flex-1", children: [
|
|
7233
|
+
/* @__PURE__ */ jsx24("p", { className: "truncate text-[15px] font-semibold", children: run.title }),
|
|
7234
|
+
/* @__PURE__ */ jsx24("p", { className: "truncate font-mono text-xs text-muted-foreground", children: run.toolName })
|
|
7077
7235
|
] }),
|
|
7078
|
-
/* @__PURE__ */
|
|
7236
|
+
/* @__PURE__ */ jsx24(
|
|
7079
7237
|
"button",
|
|
7080
7238
|
{
|
|
7081
7239
|
type: "button",
|
|
7082
7240
|
onClick: onClose,
|
|
7083
7241
|
"aria-label": "Close",
|
|
7084
7242
|
className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-accent hover:text-foreground",
|
|
7085
|
-
children: /* @__PURE__ */
|
|
7243
|
+
children: /* @__PURE__ */ jsx24("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx24("path", { d: "M18 6 6 18M6 6l12 12" }) })
|
|
7086
7244
|
}
|
|
7087
7245
|
)
|
|
7088
7246
|
] }),
|
|
7089
|
-
/* @__PURE__ */
|
|
7090
|
-
run.steps.length === 0 && /* @__PURE__ */
|
|
7091
|
-
run.steps.map((step, i) => /* @__PURE__ */
|
|
7092
|
-
/* @__PURE__ */
|
|
7093
|
-
/* @__PURE__ */
|
|
7094
|
-
/* @__PURE__ */
|
|
7095
|
-
/* @__PURE__ */
|
|
7247
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex-1 space-y-3 overflow-y-auto p-4", children: [
|
|
7248
|
+
run.steps.length === 0 && /* @__PURE__ */ jsx24("p", { className: "text-sm text-muted-foreground", children: "No steps recorded yet." }),
|
|
7249
|
+
run.steps.map((step, i) => /* @__PURE__ */ jsxs23("div", { className: "rounded-lg border border-card-edge bg-card", children: [
|
|
7250
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex items-baseline gap-2 border-b border-border px-3 py-1.5", children: [
|
|
7251
|
+
/* @__PURE__ */ jsx24("span", { className: `font-mono text-xs ${step.status === "error" ? "text-destructive" : "text-muted-foreground"}`, children: step.status === "error" ? "\u2717" : "$" }),
|
|
7252
|
+
/* @__PURE__ */ jsx24("code", { className: "min-w-0 flex-1 truncate font-mono text-xs", children: step.label }),
|
|
7253
|
+
/* @__PURE__ */ jsx24("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: new Date(step.at).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) })
|
|
7096
7254
|
] }),
|
|
7097
|
-
step.detail && /* @__PURE__ */
|
|
7255
|
+
step.detail && /* @__PURE__ */ jsx24("pre", { className: "max-h-48 overflow-auto whitespace-pre-wrap px-3 py-2 font-mono text-xs leading-relaxed text-muted-foreground", children: step.detail })
|
|
7098
7256
|
] }, i))
|
|
7099
7257
|
] }),
|
|
7100
|
-
/* @__PURE__ */
|
|
7258
|
+
/* @__PURE__ */ jsx24("p", { className: "border-t border-border px-4 py-2 text-xs text-muted-foreground", children: "Read-only transcript \u2014 reply in the main chat." })
|
|
7101
7259
|
] });
|
|
7102
7260
|
}
|
|
7103
7261
|
|
|
7104
7262
|
// src/web-react/chat-empty-state.tsx
|
|
7105
|
-
import { jsx as
|
|
7263
|
+
import { jsx as jsx25, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
7106
7264
|
function ChatEmptyState({
|
|
7107
7265
|
productName = "Agent",
|
|
7108
7266
|
headline = "Ask the agent to do something",
|
|
@@ -7111,23 +7269,23 @@ function ChatEmptyState({
|
|
|
7111
7269
|
}) {
|
|
7112
7270
|
const doorCount = Math.min(doors?.length ?? 0, 3);
|
|
7113
7271
|
const doorsGridClass = doorCount === 1 ? "mx-auto max-w-sm sm:grid-cols-1" : doorCount === 2 ? "sm:grid-cols-2" : "sm:grid-cols-3";
|
|
7114
|
-
return /* @__PURE__ */
|
|
7115
|
-
/* @__PURE__ */
|
|
7116
|
-
/* @__PURE__ */
|
|
7117
|
-
/* @__PURE__ */
|
|
7118
|
-
subline && /* @__PURE__ */
|
|
7119
|
-
doors && doors.length > 0 && /* @__PURE__ */
|
|
7272
|
+
return /* @__PURE__ */ jsxs24("div", { className: "mx-auto flex w-full max-w-2xl flex-col items-center px-6 py-12 text-center sm:py-20", children: [
|
|
7273
|
+
/* @__PURE__ */ jsx25("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__ */ jsx25(BrandMark, { size: 32, className: "shrink-0" }) }),
|
|
7274
|
+
/* @__PURE__ */ jsx25("p", { className: "text-xs font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: productName }),
|
|
7275
|
+
/* @__PURE__ */ jsx25("h2", { className: "mt-1.5 text-balance text-2xl font-semibold leading-tight text-foreground", children: headline }),
|
|
7276
|
+
subline && /* @__PURE__ */ jsx25("p", { className: "mt-3 max-w-md text-[15px] leading-relaxed text-muted-foreground", children: subline }),
|
|
7277
|
+
doors && doors.length > 0 && /* @__PURE__ */ jsx25("div", { className: `mt-7 grid w-full gap-2.5 ${doorsGridClass}`, children: doors.slice(0, 3).map((door, i) => /* @__PURE__ */ jsxs24(
|
|
7120
7278
|
"button",
|
|
7121
7279
|
{
|
|
7122
7280
|
type: "button",
|
|
7123
7281
|
onClick: door.onSelect,
|
|
7124
7282
|
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",
|
|
7125
7283
|
children: [
|
|
7126
|
-
/* @__PURE__ */
|
|
7284
|
+
/* @__PURE__ */ jsxs24("span", { className: "flex items-center gap-2 text-sm font-semibold text-foreground", children: [
|
|
7127
7285
|
door.icon,
|
|
7128
7286
|
door.label
|
|
7129
7287
|
] }),
|
|
7130
|
-
door.description && /* @__PURE__ */
|
|
7288
|
+
door.description && /* @__PURE__ */ jsx25("span", { className: "mt-0.5 text-[12px] leading-snug text-muted-foreground", children: door.description })
|
|
7131
7289
|
]
|
|
7132
7290
|
},
|
|
7133
7291
|
i
|
|
@@ -7136,10 +7294,10 @@ function ChatEmptyState({
|
|
|
7136
7294
|
}
|
|
7137
7295
|
|
|
7138
7296
|
// src/web-react/chat-tool-call.tsx
|
|
7139
|
-
import { useState as
|
|
7297
|
+
import { useState as useState25 } from "react";
|
|
7140
7298
|
import { TerminalDisplay, TerminalLine } from "@tangle-network/ui/primitives";
|
|
7141
7299
|
import { InlineToolItem } from "@tangle-network/ui/run";
|
|
7142
|
-
import { Fragment as Fragment9, jsx as
|
|
7300
|
+
import { Fragment as Fragment9, jsx as jsx26, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
7143
7301
|
function pendingApprovalOf(call) {
|
|
7144
7302
|
const outcome = call.result;
|
|
7145
7303
|
if (!outcome?.ok || outcome.result?.status !== "queued_for_approval" || !outcome.result.proposalId) return null;
|
|
@@ -7147,26 +7305,26 @@ function pendingApprovalOf(call) {
|
|
|
7147
7305
|
}
|
|
7148
7306
|
function ToolGlyph({ name, className }) {
|
|
7149
7307
|
if (name.startsWith("sandbox_")) {
|
|
7150
|
-
return /* @__PURE__ */
|
|
7151
|
-
/* @__PURE__ */
|
|
7152
|
-
/* @__PURE__ */
|
|
7308
|
+
return /* @__PURE__ */ jsxs25("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
7309
|
+
/* @__PURE__ */ jsx26("polyline", { points: "4 17 10 11 4 5" }),
|
|
7310
|
+
/* @__PURE__ */ jsx26("line", { x1: "12", y1: "19", x2: "20", y2: "19" })
|
|
7153
7311
|
] });
|
|
7154
7312
|
}
|
|
7155
7313
|
if (name === "submit_proposal") {
|
|
7156
|
-
return /* @__PURE__ */
|
|
7157
|
-
/* @__PURE__ */
|
|
7158
|
-
/* @__PURE__ */
|
|
7314
|
+
return /* @__PURE__ */ jsxs25("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
7315
|
+
/* @__PURE__ */ jsx26("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
7316
|
+
/* @__PURE__ */ jsx26("path", { d: "M14 2v6h6M9 15l2 2 4-4" })
|
|
7159
7317
|
] });
|
|
7160
7318
|
}
|
|
7161
7319
|
if (name === "schedule_followup") {
|
|
7162
|
-
return /* @__PURE__ */
|
|
7163
|
-
/* @__PURE__ */
|
|
7164
|
-
/* @__PURE__ */
|
|
7320
|
+
return /* @__PURE__ */ jsxs25("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": true, children: [
|
|
7321
|
+
/* @__PURE__ */ jsx26("circle", { cx: "12", cy: "12", r: "9" }),
|
|
7322
|
+
/* @__PURE__ */ jsx26("path", { d: "M12 7v5l3 3" })
|
|
7165
7323
|
] });
|
|
7166
7324
|
}
|
|
7167
|
-
return /* @__PURE__ */
|
|
7168
|
-
/* @__PURE__ */
|
|
7169
|
-
/* @__PURE__ */
|
|
7325
|
+
return /* @__PURE__ */ jsxs25("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
7326
|
+
/* @__PURE__ */ jsx26("path", { d: "M12 3v3m0 12v3M3 12h3m12 0h3" }),
|
|
7327
|
+
/* @__PURE__ */ jsx26("circle", { cx: "12", cy: "12", r: "4" })
|
|
7170
7328
|
] });
|
|
7171
7329
|
}
|
|
7172
7330
|
function toolOutcomeOf(call) {
|
|
@@ -7252,37 +7410,37 @@ function truncate(v, max = 240) {
|
|
|
7252
7410
|
function KvRows({ data }) {
|
|
7253
7411
|
const entries = Object.entries(data).filter(([, v]) => v !== void 0 && v !== null && v !== "");
|
|
7254
7412
|
if (!entries.length) return null;
|
|
7255
|
-
return /* @__PURE__ */
|
|
7256
|
-
/* @__PURE__ */
|
|
7257
|
-
/* @__PURE__ */
|
|
7413
|
+
return /* @__PURE__ */ jsx26("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-1", children: entries.map(([k, v]) => /* @__PURE__ */ jsxs25("div", { className: "contents", children: [
|
|
7414
|
+
/* @__PURE__ */ jsx26("dt", { className: "font-mono text-xs text-muted-foreground", children: k }),
|
|
7415
|
+
/* @__PURE__ */ jsx26("dd", { className: "min-w-0 whitespace-pre-wrap break-words font-mono text-xs text-muted-foreground", children: truncate(v) })
|
|
7258
7416
|
] }, k)) });
|
|
7259
7417
|
}
|
|
7260
7418
|
function ShellDetail({ call }) {
|
|
7261
7419
|
const outcome = toolOutcomeOf(call);
|
|
7262
7420
|
const r = outcome?.result ?? {};
|
|
7263
|
-
return /* @__PURE__ */
|
|
7264
|
-
/* @__PURE__ */
|
|
7265
|
-
r.exitCode != null && /* @__PURE__ */
|
|
7421
|
+
return /* @__PURE__ */ jsxs25(TerminalDisplay, { showHeader: false, autoScroll: false, maxHeight: "14rem", className: "text-xs", children: [
|
|
7422
|
+
/* @__PURE__ */ jsx26(TerminalLine, { type: "command", children: String(call.args?.command ?? "") }),
|
|
7423
|
+
r.exitCode != null && /* @__PURE__ */ jsxs25(TerminalLine, { type: r.exitCode === 0 ? "success" : "error", children: [
|
|
7266
7424
|
"exit ",
|
|
7267
7425
|
r.exitCode
|
|
7268
7426
|
] }),
|
|
7269
|
-
/* @__PURE__ */
|
|
7427
|
+
/* @__PURE__ */ jsx26(TerminalLine, { type: outcome?.ok === false ? "error" : "output", children: outcome?.ok === false ? outcome.message ?? "failed" : [r.stdout, r.stderr].filter(Boolean).join("\n") || "(no output)" })
|
|
7270
7428
|
] });
|
|
7271
7429
|
}
|
|
7272
7430
|
function DefaultToolDetail({ call }) {
|
|
7273
7431
|
const result = call.result;
|
|
7274
7432
|
const envelope = typeof result === "object" && result !== null ? result : null;
|
|
7275
|
-
return /* @__PURE__ */
|
|
7276
|
-
call.args && Object.keys(call.args).length > 0 && /* @__PURE__ */
|
|
7277
|
-
/* @__PURE__ */
|
|
7278
|
-
/* @__PURE__ */
|
|
7433
|
+
return /* @__PURE__ */ jsxs25("div", { className: "space-y-2", children: [
|
|
7434
|
+
call.args && Object.keys(call.args).length > 0 && /* @__PURE__ */ jsxs25("div", { children: [
|
|
7435
|
+
/* @__PURE__ */ jsx26("p", { className: "mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Called with" }),
|
|
7436
|
+
/* @__PURE__ */ jsx26(KvRows, { data: call.args })
|
|
7279
7437
|
] }),
|
|
7280
|
-
envelope ? /* @__PURE__ */
|
|
7281
|
-
/* @__PURE__ */
|
|
7282
|
-
envelope.ok === false ? /* @__PURE__ */
|
|
7283
|
-
] }) : result != null ? /* @__PURE__ */
|
|
7284
|
-
/* @__PURE__ */
|
|
7285
|
-
/* @__PURE__ */
|
|
7438
|
+
envelope ? /* @__PURE__ */ jsxs25("div", { children: [
|
|
7439
|
+
/* @__PURE__ */ jsx26("p", { className: "mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: envelope.ok === false ? "Failed" : "Result" }),
|
|
7440
|
+
envelope.ok === false ? /* @__PURE__ */ jsx26("p", { className: "text-xs text-destructive", children: envelope.message ?? "Tool failed" }) : envelope.result && typeof envelope.result === "object" ? /* @__PURE__ */ jsx26(KvRows, { data: envelope.result }) : envelope.result != null ? /* @__PURE__ */ jsx26("p", { className: "font-mono text-xs text-muted-foreground", children: truncate(envelope.result) }) : null
|
|
7441
|
+
] }) : result != null ? /* @__PURE__ */ jsxs25("div", { children: [
|
|
7442
|
+
/* @__PURE__ */ jsx26("p", { className: "mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Result" }),
|
|
7443
|
+
/* @__PURE__ */ jsx26("p", { className: "font-mono text-xs text-muted-foreground", children: truncate(result) })
|
|
7286
7444
|
] }) : null
|
|
7287
7445
|
] });
|
|
7288
7446
|
}
|
|
@@ -7293,24 +7451,24 @@ function ProposalCard({
|
|
|
7293
7451
|
approval,
|
|
7294
7452
|
renderers
|
|
7295
7453
|
}) {
|
|
7296
|
-
const [expanded, setExpanded] =
|
|
7454
|
+
const [expanded, setExpanded] = useState25(false);
|
|
7297
7455
|
const { summary, meta, typeSlug } = proposalPreview(call);
|
|
7298
7456
|
const custom = renderers?.[call.name]?.(call, message);
|
|
7299
7457
|
const { pending: deciding, run: decide } = usePending();
|
|
7300
|
-
return /* @__PURE__ */
|
|
7301
|
-
/* @__PURE__ */
|
|
7302
|
-
/* @__PURE__ */
|
|
7303
|
-
/* @__PURE__ */
|
|
7304
|
-
/* @__PURE__ */
|
|
7305
|
-
/* @__PURE__ */
|
|
7306
|
-
summary && /* @__PURE__ */
|
|
7307
|
-
typeSlug && /* @__PURE__ */
|
|
7308
|
-
meta.length > 0 && /* @__PURE__ */
|
|
7458
|
+
return /* @__PURE__ */ jsxs25("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: [
|
|
7459
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex items-start gap-2.5 px-4 pt-3.5", children: [
|
|
7460
|
+
/* @__PURE__ */ jsx26("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__ */ jsx26(ToolGlyph, { name: call.name, className: "h-3.5 w-3.5" }) }),
|
|
7461
|
+
/* @__PURE__ */ jsxs25("div", { className: "min-w-0 flex-1", children: [
|
|
7462
|
+
/* @__PURE__ */ jsx26("p", { className: "text-xs font-semibold uppercase tracking-[0.05em] text-warning-strong", children: approval ? "Needs your approval" : "Awaiting approval" }),
|
|
7463
|
+
/* @__PURE__ */ jsx26("p", { className: "mt-0.5 text-[15px] font-semibold leading-snug text-foreground", children: friendlyToolTitle(call) }),
|
|
7464
|
+
summary && /* @__PURE__ */ jsx26("p", { className: "mt-1 text-xs leading-relaxed text-muted-foreground", children: summary }),
|
|
7465
|
+
typeSlug && /* @__PURE__ */ jsx26("p", { className: "mt-1 font-mono text-xs text-muted-foreground", children: typeSlug }),
|
|
7466
|
+
meta.length > 0 && /* @__PURE__ */ jsx26("div", { className: "mt-1.5 flex flex-wrap items-center gap-1.5", children: meta.map((m, i) => /* @__PURE__ */ jsx26("span", { className: "rounded-full bg-secondary px-2 py-0.5 text-xs font-medium text-muted-foreground", children: m }, i)) })
|
|
7309
7467
|
] })
|
|
7310
7468
|
] }),
|
|
7311
|
-
/* @__PURE__ */
|
|
7312
|
-
approval && /* @__PURE__ */
|
|
7313
|
-
/* @__PURE__ */
|
|
7469
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex flex-wrap items-center gap-2 px-4 pb-3.5 pt-3", children: [
|
|
7470
|
+
approval && /* @__PURE__ */ jsxs25(Fragment9, { children: [
|
|
7471
|
+
/* @__PURE__ */ jsx26(
|
|
7314
7472
|
"button",
|
|
7315
7473
|
{
|
|
7316
7474
|
type: "button",
|
|
@@ -7320,7 +7478,7 @@ function ProposalCard({
|
|
|
7320
7478
|
children: "Approve & run"
|
|
7321
7479
|
}
|
|
7322
7480
|
),
|
|
7323
|
-
/* @__PURE__ */
|
|
7481
|
+
/* @__PURE__ */ jsx26(
|
|
7324
7482
|
"button",
|
|
7325
7483
|
{
|
|
7326
7484
|
type: "button",
|
|
@@ -7331,7 +7489,7 @@ function ProposalCard({
|
|
|
7331
7489
|
}
|
|
7332
7490
|
)
|
|
7333
7491
|
] }),
|
|
7334
|
-
/* @__PURE__ */
|
|
7492
|
+
/* @__PURE__ */ jsxs25(
|
|
7335
7493
|
"button",
|
|
7336
7494
|
{
|
|
7337
7495
|
type: "button",
|
|
@@ -7340,12 +7498,12 @@ function ProposalCard({
|
|
|
7340
7498
|
className: "ml-auto inline-flex items-center gap-1 rounded text-[12px] font-medium text-muted-foreground transition hover:text-foreground",
|
|
7341
7499
|
children: [
|
|
7342
7500
|
expanded ? "Hide details" : "View details",
|
|
7343
|
-
/* @__PURE__ */
|
|
7501
|
+
/* @__PURE__ */ jsx26(ChevronDown, { className: `h-3 w-3 transition-transform ${expanded ? "rotate-180" : ""}` })
|
|
7344
7502
|
]
|
|
7345
7503
|
}
|
|
7346
7504
|
)
|
|
7347
7505
|
] }),
|
|
7348
|
-
expanded && /* @__PURE__ */
|
|
7506
|
+
expanded && /* @__PURE__ */ jsx26("div", { className: "border-t border-warning/20 px-4 py-3 text-xs", children: custom ?? /* @__PURE__ */ jsx26(DefaultToolDetail, { call }) })
|
|
7349
7507
|
] });
|
|
7350
7508
|
}
|
|
7351
7509
|
function formatFollowupWhen(when) {
|
|
@@ -7360,14 +7518,14 @@ function FollowupCard({ call }) {
|
|
|
7360
7518
|
const when = typeof a.when === "string" ? a.when : typeof a.at === "string" ? a.at : typeof a.schedule === "string" ? a.schedule : null;
|
|
7361
7519
|
const failed = toolCallFailed(call);
|
|
7362
7520
|
const errorText = failed ? toolOutcomeOf(call)?.message ?? "Scheduling failed" : null;
|
|
7363
|
-
return /* @__PURE__ */
|
|
7364
|
-
/* @__PURE__ */
|
|
7365
|
-
/* @__PURE__ */
|
|
7366
|
-
/* @__PURE__ */
|
|
7367
|
-
when && /* @__PURE__ */
|
|
7368
|
-
/* @__PURE__ */
|
|
7521
|
+
return /* @__PURE__ */ jsx26("div", { className: "flex items-start gap-2", children: /* @__PURE__ */ jsxs25("div", { className: "min-w-0 flex-1 overflow-hidden rounded-[var(--radius-lg)] border border-[var(--border-subtle)] bg-[var(--md3-surface-container)]", children: [
|
|
7522
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex w-full items-center gap-2.5 px-3 py-2", children: [
|
|
7523
|
+
/* @__PURE__ */ jsx26("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-[var(--radius-sm)] border border-border bg-muted text-muted-foreground", children: /* @__PURE__ */ jsx26(ToolGlyph, { name: call.name, className: "h-3.5 w-3.5" }) }),
|
|
7524
|
+
/* @__PURE__ */ jsx26("span", { className: "shrink-0 whitespace-nowrap text-xs font-medium text-foreground", children: friendlyToolTitle(call) }),
|
|
7525
|
+
when && /* @__PURE__ */ jsx26("span", { title: when, className: "hidden min-w-0 flex-1 truncate font-mono text-xs tabular-nums text-muted-foreground sm:inline", children: formatFollowupWhen(when) }),
|
|
7526
|
+
/* @__PURE__ */ jsx26("span", { className: "ml-auto flex shrink-0 items-center gap-1.5", children: call.status === "running" ? /* @__PURE__ */ jsx26("svg", { className: "h-3 w-3 shrink-0 animate-spin text-[var(--accent-text)]", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": true, children: /* @__PURE__ */ jsx26("path", { d: "M21 12a9 9 0 1 1-6.219-8.56", strokeLinecap: "round" }) }) : /* @__PURE__ */ jsx26("span", { className: `h-1.5 w-1.5 shrink-0 rounded-full ${failed ? "bg-[var(--surface-danger-text)]" : "bg-[var(--surface-success-text)]"}` }) })
|
|
7369
7527
|
] }),
|
|
7370
|
-
errorText && /* @__PURE__ */
|
|
7528
|
+
errorText && /* @__PURE__ */ jsx26("div", { className: "border-t border-border px-3 py-2 text-xs text-[var(--surface-danger-text)]", children: errorText })
|
|
7371
7529
|
] }) });
|
|
7372
7530
|
}
|
|
7373
7531
|
function toolRowTitle(call) {
|
|
@@ -7390,10 +7548,10 @@ function ToolCallCard({
|
|
|
7390
7548
|
const arrival = useArrivalStyle(staggerIndex ?? 0);
|
|
7391
7549
|
const pending = call.status === "done" ? pendingApprovalOf(call) : null;
|
|
7392
7550
|
const kind = blockKindOf(call);
|
|
7393
|
-
const arrive = (row) => /* @__PURE__ */
|
|
7551
|
+
const arrive = (row) => /* @__PURE__ */ jsx26("div", { className: "agent-arrive", style: arrival, children: row });
|
|
7394
7552
|
if (pending) {
|
|
7395
7553
|
return arrive(
|
|
7396
|
-
/* @__PURE__ */
|
|
7554
|
+
/* @__PURE__ */ jsx26(
|
|
7397
7555
|
ProposalCard,
|
|
7398
7556
|
{
|
|
7399
7557
|
call,
|
|
@@ -7406,18 +7564,18 @@ function ToolCallCard({
|
|
|
7406
7564
|
);
|
|
7407
7565
|
}
|
|
7408
7566
|
if (kind === "followup") {
|
|
7409
|
-
return arrive(/* @__PURE__ */
|
|
7567
|
+
return arrive(/* @__PURE__ */ jsx26(FollowupCard, { call }));
|
|
7410
7568
|
}
|
|
7411
7569
|
const custom = renderers?.[call.name]?.(call, message);
|
|
7412
7570
|
return arrive(
|
|
7413
|
-
/* @__PURE__ */
|
|
7571
|
+
/* @__PURE__ */ jsx26(
|
|
7414
7572
|
InlineToolItem,
|
|
7415
7573
|
{
|
|
7416
7574
|
part: chatToolCallPart(call),
|
|
7417
7575
|
title: toolRowTitle(call),
|
|
7418
7576
|
description: toolRowDescription(call),
|
|
7419
|
-
renderToolDetail: () => custom ?? (call.name === "sandbox_run_command" ? /* @__PURE__ */
|
|
7420
|
-
actions: onOpenRun && call.name.startsWith("sandbox_") ? /* @__PURE__ */
|
|
7577
|
+
renderToolDetail: () => custom ?? (call.name === "sandbox_run_command" ? /* @__PURE__ */ jsx26(ShellDetail, { call }) : /* @__PURE__ */ jsx26(DefaultToolDetail, { call })),
|
|
7578
|
+
actions: onOpenRun && call.name.startsWith("sandbox_") ? /* @__PURE__ */ jsx26(
|
|
7421
7579
|
"button",
|
|
7422
7580
|
{
|
|
7423
7581
|
type: "button",
|
|
@@ -7425,9 +7583,9 @@ function ToolCallCard({
|
|
|
7425
7583
|
"aria-label": "Open full transcript",
|
|
7426
7584
|
title: "Open full transcript",
|
|
7427
7585
|
className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-accent hover:text-foreground",
|
|
7428
|
-
children: /* @__PURE__ */
|
|
7429
|
-
/* @__PURE__ */
|
|
7430
|
-
/* @__PURE__ */
|
|
7586
|
+
children: /* @__PURE__ */ jsxs25("svg", { className: "h-3.5 w-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
7587
|
+
/* @__PURE__ */ jsx26("path", { d: "M7 17 17 7" }),
|
|
7588
|
+
/* @__PURE__ */ jsx26("path", { d: "M7 7h10v10" })
|
|
7431
7589
|
] })
|
|
7432
7590
|
}
|
|
7433
7591
|
) : void 0
|
|
@@ -7437,14 +7595,14 @@ function ToolCallCard({
|
|
|
7437
7595
|
}
|
|
7438
7596
|
|
|
7439
7597
|
// src/web-react/chat-messages.tsx
|
|
7440
|
-
import { useEffect as
|
|
7598
|
+
import { useEffect as useEffect18, useMemo as useMemo11, useRef as useRef18, useState as useState26, memo } from "react";
|
|
7441
7599
|
import { isViewerMessage, MessageAuthor, TRANSCRIPT_TEXT } from "@tangle-network/ui/chat";
|
|
7442
7600
|
|
|
7443
7601
|
// src/web-react/chat-message-body.tsx
|
|
7444
7602
|
import { useMemo as useMemo10 } from "react";
|
|
7445
|
-
import { jsx as
|
|
7603
|
+
import { jsx as jsx27, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
7446
7604
|
function StreamingCaret() {
|
|
7447
|
-
return /* @__PURE__ */
|
|
7605
|
+
return /* @__PURE__ */ jsx27(
|
|
7448
7606
|
"span",
|
|
7449
7607
|
{
|
|
7450
7608
|
className: "ml-0.5 inline-block h-[1.1em] w-[3px] translate-y-[2px] animate-[agent-caret_1s_step-end_infinite] rounded-sm bg-foreground/70",
|
|
@@ -7469,9 +7627,9 @@ function SegmentText({
|
|
|
7469
7627
|
// the container on top of that makes the paragraph shimmer while it types.
|
|
7470
7628
|
// The distinction is what separates "the answer materialised" from "the
|
|
7471
7629
|
// log was appended to".
|
|
7472
|
-
/* @__PURE__ */
|
|
7630
|
+
/* @__PURE__ */ jsxs26("div", { className: `${messageClassName}${streaming ? "" : " agent-stream-in"}`, children: [
|
|
7473
7631
|
body,
|
|
7474
|
-
showCaret && /* @__PURE__ */
|
|
7632
|
+
showCaret && /* @__PURE__ */ jsx27(StreamingCaret, {})
|
|
7475
7633
|
] })
|
|
7476
7634
|
);
|
|
7477
7635
|
}
|
|
@@ -7496,7 +7654,7 @@ function SegmentedBody({
|
|
|
7496
7654
|
const leftoverToolCalls = (msg.toolCalls ?? []).filter(
|
|
7497
7655
|
(tc) => !segmentToolIds.has(tc.id)
|
|
7498
7656
|
);
|
|
7499
|
-
const renderToolCard = (call, index) => /* @__PURE__ */
|
|
7657
|
+
const renderToolCard = (call, index) => /* @__PURE__ */ jsx27(
|
|
7500
7658
|
ToolCallCard,
|
|
7501
7659
|
{
|
|
7502
7660
|
call,
|
|
@@ -7525,12 +7683,12 @@ function SegmentedBody({
|
|
|
7525
7683
|
const children = [];
|
|
7526
7684
|
for (const g of groups) {
|
|
7527
7685
|
if (g.kind === "notice") {
|
|
7528
|
-
children.push(/* @__PURE__ */
|
|
7686
|
+
children.push(/* @__PURE__ */ jsx27(SegmentNotice, { tone: g.tone, content: g.content }, `notice-${g.index}`));
|
|
7529
7687
|
continue;
|
|
7530
7688
|
}
|
|
7531
7689
|
if (g.kind === "text") {
|
|
7532
7690
|
children.push(
|
|
7533
|
-
/* @__PURE__ */
|
|
7691
|
+
/* @__PURE__ */ jsx27(
|
|
7534
7692
|
SegmentText,
|
|
7535
7693
|
{
|
|
7536
7694
|
content: g.content,
|
|
@@ -7546,13 +7704,13 @@ function SegmentedBody({
|
|
|
7546
7704
|
}
|
|
7547
7705
|
if (!streaming && g.calls.length >= COLLAPSE_TOOL_RUN_AT && !g.calls.some(isImportantTool)) {
|
|
7548
7706
|
children.push(
|
|
7549
|
-
/* @__PURE__ */
|
|
7550
|
-
/* @__PURE__ */
|
|
7707
|
+
/* @__PURE__ */ jsxs26("details", { children: [
|
|
7708
|
+
/* @__PURE__ */ jsxs26("summary", { className: "cursor-pointer select-none rounded-md py-0.5 text-xs font-medium text-muted-foreground [transition:color_var(--motion-control)] hover:text-foreground", children: [
|
|
7551
7709
|
"Worked through ",
|
|
7552
7710
|
g.calls.length,
|
|
7553
7711
|
" steps"
|
|
7554
7712
|
] }),
|
|
7555
|
-
/* @__PURE__ */
|
|
7713
|
+
/* @__PURE__ */ jsx27("div", { className: "mt-1.5 flex flex-col gap-1.5", children: g.calls.map(renderToolCard) })
|
|
7556
7714
|
] }, `tools-fold-${g.index}`)
|
|
7557
7715
|
);
|
|
7558
7716
|
continue;
|
|
@@ -7561,33 +7719,33 @@ function SegmentedBody({
|
|
|
7561
7719
|
}
|
|
7562
7720
|
leftoverToolCalls.forEach((call, index) => children.push(renderToolCard(call, index)));
|
|
7563
7721
|
if (streaming && segments[lastIndex]?.kind === "tool") {
|
|
7564
|
-
children.push(/* @__PURE__ */
|
|
7722
|
+
children.push(/* @__PURE__ */ jsx27(StreamingCaret, {}, "streaming-caret"));
|
|
7565
7723
|
}
|
|
7566
|
-
return /* @__PURE__ */
|
|
7724
|
+
return /* @__PURE__ */ jsx27("div", { className: "flex flex-col gap-2", children });
|
|
7567
7725
|
}
|
|
7568
7726
|
var NOTICE_TONE_CLASS = {
|
|
7569
7727
|
error: "border-destructive/40 bg-destructive/5 text-destructive",
|
|
7570
7728
|
warning: "border-warning/40 bg-warning/10 text-warning-strong"
|
|
7571
7729
|
};
|
|
7572
7730
|
function SegmentNotice({ tone, content }) {
|
|
7573
|
-
return /* @__PURE__ */
|
|
7731
|
+
return /* @__PURE__ */ jsxs26(
|
|
7574
7732
|
"div",
|
|
7575
7733
|
{
|
|
7576
7734
|
"data-notice-tone": tone,
|
|
7577
7735
|
className: `flex items-start gap-2.5 rounded-lg border px-3 py-2.5 text-sm ${NOTICE_TONE_CLASS[tone]}`,
|
|
7578
7736
|
children: [
|
|
7579
|
-
/* @__PURE__ */
|
|
7580
|
-
/* @__PURE__ */
|
|
7581
|
-
/* @__PURE__ */
|
|
7737
|
+
/* @__PURE__ */ jsxs26("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: [
|
|
7738
|
+
/* @__PURE__ */ jsx27("circle", { cx: "12", cy: "12", r: "9" }),
|
|
7739
|
+
/* @__PURE__ */ jsx27("path", { d: "M12 8v4m0 4h.01" })
|
|
7582
7740
|
] }),
|
|
7583
|
-
/* @__PURE__ */
|
|
7741
|
+
/* @__PURE__ */ jsx27("span", { className: "min-w-0 flex-1 whitespace-pre-wrap break-words", children: content })
|
|
7584
7742
|
]
|
|
7585
7743
|
}
|
|
7586
7744
|
);
|
|
7587
7745
|
}
|
|
7588
7746
|
|
|
7589
7747
|
// src/web-react/chat-messages.tsx
|
|
7590
|
-
import { Fragment as Fragment10, jsx as
|
|
7748
|
+
import { Fragment as Fragment10, jsx as jsx28, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
7591
7749
|
var QUIET_META_LANE_CLASS = "mt-1 flex h-[18px] items-center gap-2 text-xs tabular-nums text-muted-foreground opacity-0 transition-opacity duration-150 group-hover:opacity-100 group-focus-within:opacity-100 motion-reduce:transition-none [@media(hover:none)]:opacity-100";
|
|
7592
7750
|
function copyTextOf(msg) {
|
|
7593
7751
|
const textRuns = msg.segments?.filter((s) => s.kind === "text") ?? [];
|
|
@@ -7595,9 +7753,9 @@ function copyTextOf(msg) {
|
|
|
7595
7753
|
return msg.content;
|
|
7596
7754
|
}
|
|
7597
7755
|
function CopyMessageButton({ text }) {
|
|
7598
|
-
const [copied, setCopied] =
|
|
7599
|
-
const timerRef =
|
|
7600
|
-
|
|
7756
|
+
const [copied, setCopied] = useState26(false);
|
|
7757
|
+
const timerRef = useRef18(null);
|
|
7758
|
+
useEffect18(
|
|
7601
7759
|
() => () => {
|
|
7602
7760
|
if (timerRef.current !== null) clearTimeout(timerRef.current);
|
|
7603
7761
|
},
|
|
@@ -7616,7 +7774,7 @@ function CopyMessageButton({ text }) {
|
|
|
7616
7774
|
}
|
|
7617
7775
|
);
|
|
7618
7776
|
};
|
|
7619
|
-
return /* @__PURE__ */
|
|
7777
|
+
return /* @__PURE__ */ jsx28(
|
|
7620
7778
|
"button",
|
|
7621
7779
|
{
|
|
7622
7780
|
type: "button",
|
|
@@ -7624,9 +7782,9 @@ function CopyMessageButton({ text }) {
|
|
|
7624
7782
|
"aria-label": "Copy message",
|
|
7625
7783
|
title: "Copy message",
|
|
7626
7784
|
className: "rounded p-0.5 text-muted-foreground transition hover:bg-accent hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
7627
|
-
children: copied ? /* @__PURE__ */
|
|
7628
|
-
/* @__PURE__ */
|
|
7629
|
-
/* @__PURE__ */
|
|
7785
|
+
children: copied ? /* @__PURE__ */ jsx28("svg", { className: "h-3.5 w-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx28("polyline", { points: "20 6 9 17 4 12" }) }) : /* @__PURE__ */ jsxs27("svg", { className: "h-3.5 w-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
7786
|
+
/* @__PURE__ */ jsx28("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }),
|
|
7787
|
+
/* @__PURE__ */ jsx28("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
7630
7788
|
] })
|
|
7631
7789
|
}
|
|
7632
7790
|
);
|
|
@@ -7652,21 +7810,21 @@ function AssistantMessageImpl({
|
|
|
7652
7810
|
const segments = msg.segments;
|
|
7653
7811
|
const hasAnswerText = content !== "" || (segments?.some((s) => (s.kind === "text" || s.kind === "notice") && s.content.trim() !== "") ?? false);
|
|
7654
7812
|
const quiet = chrome === "quiet";
|
|
7655
|
-
return /* @__PURE__ */
|
|
7656
|
-
quiet && msg.author && /* @__PURE__ */
|
|
7657
|
-
!quiet && /* @__PURE__ */
|
|
7813
|
+
return /* @__PURE__ */ jsxs27("div", { className: `mx-auto w-full max-w-3xl px-6 ${quiet ? "group pb-1 pt-3" : "py-3"}`, children: [
|
|
7814
|
+
quiet && msg.author && /* @__PURE__ */ jsx28(MessageAuthor, { author: msg.author, className: "mb-1.5" }),
|
|
7815
|
+
!quiet && /* @__PURE__ */ jsxs27(
|
|
7658
7816
|
"div",
|
|
7659
7817
|
{
|
|
7660
7818
|
className: `mb-1 flex ${msg.author ? "items-center" : "items-baseline"} gap-2 text-xs tabular-nums text-muted-foreground`,
|
|
7661
7819
|
children: [
|
|
7662
|
-
msg.author ? /* @__PURE__ */
|
|
7663
|
-
msg.modelUsed && /* @__PURE__ */
|
|
7664
|
-
formatTokensPerSecond(msg) && /* @__PURE__ */
|
|
7665
|
-
formatModelCost(msg, models) && /* @__PURE__ */
|
|
7820
|
+
msg.author ? /* @__PURE__ */ jsx28(MessageAuthor, { author: msg.author }) : /* @__PURE__ */ jsx28("span", { className: "font-semibold uppercase tracking-[0.05em]", children: agentLabel }),
|
|
7821
|
+
msg.modelUsed && /* @__PURE__ */ jsx28("span", { className: "font-mono normal-case", children: msg.modelUsed }),
|
|
7822
|
+
formatTokensPerSecond(msg) && /* @__PURE__ */ jsx28("span", { children: formatTokensPerSecond(msg) }),
|
|
7823
|
+
formatModelCost(msg, models) && /* @__PURE__ */ jsx28("span", { children: formatModelCost(msg, models) })
|
|
7666
7824
|
]
|
|
7667
7825
|
}
|
|
7668
7826
|
),
|
|
7669
|
-
/* @__PURE__ */
|
|
7827
|
+
/* @__PURE__ */ jsx28(
|
|
7670
7828
|
ReasoningRow,
|
|
7671
7829
|
{
|
|
7672
7830
|
className: "mb-2",
|
|
@@ -7676,7 +7834,7 @@ function AssistantMessageImpl({
|
|
|
7676
7834
|
thinking: streaming && !hasAnswerText && msg.reasoningEndedAt === void 0
|
|
7677
7835
|
}
|
|
7678
7836
|
),
|
|
7679
|
-
segments && segments.length > 0 ? /* @__PURE__ */
|
|
7837
|
+
segments && segments.length > 0 ? /* @__PURE__ */ jsx28(
|
|
7680
7838
|
SegmentedBody,
|
|
7681
7839
|
{
|
|
7682
7840
|
segments,
|
|
@@ -7688,12 +7846,12 @@ function AssistantMessageImpl({
|
|
|
7688
7846
|
toolRenderers,
|
|
7689
7847
|
messageClassName
|
|
7690
7848
|
}
|
|
7691
|
-
) : /* @__PURE__ */
|
|
7692
|
-
/* @__PURE__ */
|
|
7849
|
+
) : /* @__PURE__ */ jsxs27(Fragment10, { children: [
|
|
7850
|
+
/* @__PURE__ */ jsxs27("div", { className: messageClassName, children: [
|
|
7693
7851
|
body,
|
|
7694
|
-
streaming && content && !msg.toolCalls?.length && /* @__PURE__ */
|
|
7852
|
+
streaming && content && !msg.toolCalls?.length && /* @__PURE__ */ jsx28(StreamingCaret, {})
|
|
7695
7853
|
] }),
|
|
7696
|
-
msg.toolCalls && msg.toolCalls.length > 0 && /* @__PURE__ */
|
|
7854
|
+
msg.toolCalls && msg.toolCalls.length > 0 && /* @__PURE__ */ jsx28("div", { className: "mt-2 flex flex-col gap-1.5", children: msg.toolCalls.map((tc, index) => /* @__PURE__ */ jsx28(
|
|
7697
7855
|
ToolCallCard,
|
|
7698
7856
|
{
|
|
7699
7857
|
call: tc,
|
|
@@ -7706,7 +7864,7 @@ function AssistantMessageImpl({
|
|
|
7706
7864
|
tc.id
|
|
7707
7865
|
)) })
|
|
7708
7866
|
] }),
|
|
7709
|
-
durableCards && msg.parts && /* @__PURE__ */
|
|
7867
|
+
durableCards && msg.parts && /* @__PURE__ */ jsx28(
|
|
7710
7868
|
DurableChatCards,
|
|
7711
7869
|
{
|
|
7712
7870
|
...durableCards,
|
|
@@ -7715,7 +7873,7 @@ function AssistantMessageImpl({
|
|
|
7715
7873
|
className: "mt-3"
|
|
7716
7874
|
}
|
|
7717
7875
|
),
|
|
7718
|
-
workProductCards && workProductPartsFromMessageParts(msg.parts).map((part) => /* @__PURE__ */
|
|
7876
|
+
workProductCards && workProductPartsFromMessageParts(msg.parts).map((part) => /* @__PURE__ */ jsx28(
|
|
7719
7877
|
WorkProductCard,
|
|
7720
7878
|
{
|
|
7721
7879
|
part,
|
|
@@ -7725,7 +7883,7 @@ function AssistantMessageImpl({
|
|
|
7725
7883
|
`${part.ref.id}:${part.ref.version}`
|
|
7726
7884
|
)),
|
|
7727
7885
|
renderExtras?.(msg),
|
|
7728
|
-
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */
|
|
7886
|
+
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */ jsx28("div", { className: "mt-2", children: /* @__PURE__ */ jsx28(
|
|
7729
7887
|
MessageAttachments,
|
|
7730
7888
|
{
|
|
7731
7889
|
parts: attachmentPartsFromMessageParts(msg.parts),
|
|
@@ -7733,18 +7891,18 @@ function AssistantMessageImpl({
|
|
|
7733
7891
|
justify: "start"
|
|
7734
7892
|
}
|
|
7735
7893
|
) }),
|
|
7736
|
-
quiet && /* @__PURE__ */
|
|
7737
|
-
/* @__PURE__ */
|
|
7738
|
-
msg.modelUsed && /* @__PURE__ */
|
|
7739
|
-
formatTokensPerSecond(msg) && /* @__PURE__ */
|
|
7740
|
-
formatModelCost(msg, models) && /* @__PURE__ */
|
|
7894
|
+
quiet && /* @__PURE__ */ jsxs27("div", { "data-testid": "message-meta-lane", className: QUIET_META_LANE_CLASS, children: [
|
|
7895
|
+
/* @__PURE__ */ jsx28(CopyMessageButton, { text: copyTextOf(msg) }),
|
|
7896
|
+
msg.modelUsed && /* @__PURE__ */ jsx28("span", { className: "font-mono", children: msg.modelUsed }),
|
|
7897
|
+
formatTokensPerSecond(msg) && /* @__PURE__ */ jsx28("span", { children: formatTokensPerSecond(msg) }),
|
|
7898
|
+
formatModelCost(msg, models) && /* @__PURE__ */ jsx28("span", { children: formatModelCost(msg, models) })
|
|
7741
7899
|
] })
|
|
7742
7900
|
] });
|
|
7743
7901
|
}
|
|
7744
7902
|
var AssistantMessage = memo(AssistantMessageImpl);
|
|
7745
7903
|
function useThinkingSeconds(active) {
|
|
7746
|
-
const [seconds, setSeconds] =
|
|
7747
|
-
|
|
7904
|
+
const [seconds, setSeconds] = useState26(0);
|
|
7905
|
+
useEffect18(() => {
|
|
7748
7906
|
if (!active) return;
|
|
7749
7907
|
setSeconds(0);
|
|
7750
7908
|
const id = setInterval(() => setSeconds((s) => s + 1), 1e3);
|
|
@@ -7753,19 +7911,19 @@ function useThinkingSeconds(active) {
|
|
|
7753
7911
|
return seconds;
|
|
7754
7912
|
}
|
|
7755
7913
|
function ThinkingRow({ agentLabel, chrome = "labeled", phase }) {
|
|
7756
|
-
return /* @__PURE__ */
|
|
7757
|
-
chrome !== "quiet" && /* @__PURE__ */
|
|
7758
|
-
/* @__PURE__ */
|
|
7914
|
+
return /* @__PURE__ */ jsxs27("div", { className: "mx-auto w-full max-w-3xl px-6 py-3", children: [
|
|
7915
|
+
chrome !== "quiet" && /* @__PURE__ */ jsx28("p", { className: "mb-1 text-xs font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: agentLabel }),
|
|
7916
|
+
/* @__PURE__ */ jsx28(TurnProgress, { phase, pendingMessage: "Thinking\u2026", className: "text-[15px]" })
|
|
7759
7917
|
] });
|
|
7760
7918
|
}
|
|
7761
7919
|
function StreamErrorRow({ message, onRetry }) {
|
|
7762
|
-
return /* @__PURE__ */
|
|
7763
|
-
/* @__PURE__ */
|
|
7764
|
-
/* @__PURE__ */
|
|
7765
|
-
/* @__PURE__ */
|
|
7920
|
+
return /* @__PURE__ */ jsx28("div", { className: "mx-auto w-full max-w-3xl px-6 py-3", children: /* @__PURE__ */ jsxs27("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: [
|
|
7921
|
+
/* @__PURE__ */ jsxs27("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: [
|
|
7922
|
+
/* @__PURE__ */ jsx28("circle", { cx: "12", cy: "12", r: "9" }),
|
|
7923
|
+
/* @__PURE__ */ jsx28("path", { d: "M12 8v4m0 4h.01" })
|
|
7766
7924
|
] }),
|
|
7767
|
-
/* @__PURE__ */
|
|
7768
|
-
onRetry && /* @__PURE__ */
|
|
7925
|
+
/* @__PURE__ */ jsx28("span", { className: "min-w-0 flex-1 break-words", children: message }),
|
|
7926
|
+
onRetry && /* @__PURE__ */ jsx28(
|
|
7769
7927
|
"button",
|
|
7770
7928
|
{
|
|
7771
7929
|
type: "button",
|
|
@@ -7784,19 +7942,19 @@ function OtherPersonMessage({
|
|
|
7784
7942
|
resolveAttachmentUrl
|
|
7785
7943
|
}) {
|
|
7786
7944
|
const attachments = resolveAttachmentUrl ? attachmentPartsFromMessageParts(msg.parts) : [];
|
|
7787
|
-
return /* @__PURE__ */
|
|
7788
|
-
/* @__PURE__ */
|
|
7789
|
-
/* @__PURE__ */
|
|
7790
|
-
/* @__PURE__ */
|
|
7945
|
+
return /* @__PURE__ */ jsxs27("div", { className: `mx-auto w-full max-w-3xl px-6 ${quiet ? "group pb-1 pt-3" : "py-3"}`, children: [
|
|
7946
|
+
/* @__PURE__ */ jsxs27("div", { className: `w-fit ${quiet ? "max-w-[72%]" : "max-w-[85%]"}`, children: [
|
|
7947
|
+
/* @__PURE__ */ jsx28(MessageAuthor, { author, className: "mb-1.5" }),
|
|
7948
|
+
/* @__PURE__ */ jsx28(
|
|
7791
7949
|
"div",
|
|
7792
7950
|
{
|
|
7793
7951
|
className: `w-fit max-w-full rounded-2xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] px-4 py-2.5 text-[hsl(var(--foreground))] ${quiet ? "" : "rounded-tl-md "}${messageClassName}`,
|
|
7794
|
-
children: /* @__PURE__ */
|
|
7952
|
+
children: /* @__PURE__ */ jsx28("p", { className: "whitespace-pre-wrap", children: msg.content })
|
|
7795
7953
|
}
|
|
7796
7954
|
),
|
|
7797
|
-
resolveAttachmentUrl && attachments.length > 0 && /* @__PURE__ */
|
|
7955
|
+
resolveAttachmentUrl && attachments.length > 0 && /* @__PURE__ */ jsx28("div", { className: "mt-1.5", children: /* @__PURE__ */ jsx28(MessageAttachments, { parts: attachments, resolveFileUrl: resolveAttachmentUrl, justify: "start" }) })
|
|
7798
7956
|
] }),
|
|
7799
|
-
quiet && /* @__PURE__ */
|
|
7957
|
+
quiet && /* @__PURE__ */ jsx28("div", { "data-testid": "message-meta-lane", className: `${QUIET_META_LANE_CLASS} justify-start`, children: /* @__PURE__ */ jsx28(CopyMessageButton, { text: msg.content }) })
|
|
7800
7958
|
] });
|
|
7801
7959
|
}
|
|
7802
7960
|
function ChatMessages({
|
|
@@ -7826,22 +7984,22 @@ function ChatMessages({
|
|
|
7826
7984
|
const messageClassName = messageSize === "large" ? `agent-app-message-copy ${TRANSCRIPT_TEXT} [--transcript-font-size:1.0625rem]` : `agent-app-message-copy ${TRANSCRIPT_TEXT}`;
|
|
7827
7985
|
const assistantMessageClassName = `${messageClassName} bg-transparent text-[hsl(var(--foreground))]`;
|
|
7828
7986
|
const renderBody = useMemo11(
|
|
7829
|
-
() => renderMarkdown ?? ((content) => /* @__PURE__ */
|
|
7987
|
+
() => renderMarkdown ?? ((content) => /* @__PURE__ */ jsx28("p", { className: "whitespace-pre-wrap", children: content })),
|
|
7830
7988
|
[renderMarkdown]
|
|
7831
7989
|
);
|
|
7832
7990
|
const lastIsUser = messages[messages.length - 1]?.role === "user";
|
|
7833
7991
|
const quiet = chrome === "quiet";
|
|
7834
7992
|
if (messages.length === 0 && !loading && !error) {
|
|
7835
|
-
const empty = renderEmpty ? renderEmpty() : /* @__PURE__ */
|
|
7836
|
-
return /* @__PURE__ */
|
|
7993
|
+
const empty = renderEmpty ? renderEmpty() : /* @__PURE__ */ jsx28(ChatEmptyState, { ...emptyState });
|
|
7994
|
+
return /* @__PURE__ */ jsxs27(Fragment10, { children: [
|
|
7837
7995
|
header,
|
|
7838
7996
|
empty
|
|
7839
7997
|
] });
|
|
7840
7998
|
}
|
|
7841
|
-
return /* @__PURE__ */
|
|
7999
|
+
return /* @__PURE__ */ jsxs27(Fragment10, { children: [
|
|
7842
8000
|
header,
|
|
7843
8001
|
messages.map(
|
|
7844
|
-
(msg) => msg.role === "user" && msg.author && !isViewerMessage(msg.author, viewerId) ? /* @__PURE__ */
|
|
8002
|
+
(msg) => msg.role === "user" && msg.author && !isViewerMessage(msg.author, viewerId) ? /* @__PURE__ */ jsx28(
|
|
7845
8003
|
OtherPersonMessage,
|
|
7846
8004
|
{
|
|
7847
8005
|
msg,
|
|
@@ -7851,17 +8009,17 @@ function ChatMessages({
|
|
|
7851
8009
|
resolveAttachmentUrl
|
|
7852
8010
|
},
|
|
7853
8011
|
msg.id
|
|
7854
|
-
) : msg.role === "user" ? /* @__PURE__ */
|
|
7855
|
-
/* @__PURE__ */
|
|
7856
|
-
!quiet && /* @__PURE__ */
|
|
7857
|
-
/* @__PURE__ */
|
|
8012
|
+
) : msg.role === "user" ? /* @__PURE__ */ jsxs27("div", { className: `mx-auto w-full max-w-3xl px-6 ${quiet ? "group pb-1 pt-3" : "py-3"}`, children: [
|
|
8013
|
+
/* @__PURE__ */ jsxs27("div", { className: `ml-auto w-fit ${quiet ? "max-w-[72%]" : "max-w-[85%]"}`, children: [
|
|
8014
|
+
!quiet && /* @__PURE__ */ jsx28("p", { className: "mb-1 text-right text-xs font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: userLabel }),
|
|
8015
|
+
/* @__PURE__ */ jsx28(
|
|
7858
8016
|
"div",
|
|
7859
8017
|
{
|
|
7860
8018
|
className: `rounded-2xl bg-[hsl(var(--foreground))] px-4 py-2.5 text-[hsl(var(--background))] ${quiet ? "" : "rounded-tr-md "}${messageClassName}`,
|
|
7861
|
-
children: /* @__PURE__ */
|
|
8019
|
+
children: /* @__PURE__ */ jsx28("p", { className: "whitespace-pre-wrap", children: msg.content })
|
|
7862
8020
|
}
|
|
7863
8021
|
),
|
|
7864
|
-
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */
|
|
8022
|
+
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */ jsx28("div", { className: "mt-1.5", children: /* @__PURE__ */ jsx28(
|
|
7865
8023
|
MessageAttachments,
|
|
7866
8024
|
{
|
|
7867
8025
|
parts: attachmentPartsFromMessageParts(msg.parts),
|
|
@@ -7870,8 +8028,8 @@ function ChatMessages({
|
|
|
7870
8028
|
}
|
|
7871
8029
|
) })
|
|
7872
8030
|
] }),
|
|
7873
|
-
quiet && /* @__PURE__ */
|
|
7874
|
-
] }, msg.id) : /* @__PURE__ */
|
|
8031
|
+
quiet && /* @__PURE__ */ jsx28("div", { "data-testid": "message-meta-lane", className: `${QUIET_META_LANE_CLASS} justify-end`, children: /* @__PURE__ */ jsx28(CopyMessageButton, { text: msg.content }) })
|
|
8032
|
+
] }, msg.id) : /* @__PURE__ */ jsx28(
|
|
7875
8033
|
AssistantMessage,
|
|
7876
8034
|
{
|
|
7877
8035
|
msg,
|
|
@@ -7892,15 +8050,15 @@ function ChatMessages({
|
|
|
7892
8050
|
msg.id
|
|
7893
8051
|
)
|
|
7894
8052
|
),
|
|
7895
|
-
loading && lastIsUser && /* @__PURE__ */
|
|
7896
|
-
error && !loading && /* @__PURE__ */
|
|
8053
|
+
loading && lastIsUser && /* @__PURE__ */ jsx28(ThinkingRow, { agentLabel, chrome, phase: turnPhase }),
|
|
8054
|
+
error && !loading && /* @__PURE__ */ jsx28(StreamErrorRow, { message: error, onRetry })
|
|
7897
8055
|
] });
|
|
7898
8056
|
}
|
|
7899
8057
|
|
|
7900
8058
|
// src/web-react/api-access-panel.tsx
|
|
7901
|
-
import { useEffect as
|
|
8059
|
+
import { useEffect as useEffect19, useRef as useRef19, useState as useState27 } from "react";
|
|
7902
8060
|
import { Button as Button6, Input as Input3, PageHeader as PageHeader2 } from "@tangle-network/ui/primitives";
|
|
7903
|
-
import { jsx as
|
|
8061
|
+
import { jsx as jsx29, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
7904
8062
|
var defaultExpiryChoices = [1, 7, 30];
|
|
7905
8063
|
function pruneScopes(scopes, access) {
|
|
7906
8064
|
const offered = new Map(access.map((option) => [option.scope, option]));
|
|
@@ -7966,31 +8124,31 @@ function ApiAccessPanel({
|
|
|
7966
8124
|
onRevoke = revokeKeyViaApi,
|
|
7967
8125
|
onChanged
|
|
7968
8126
|
}) {
|
|
7969
|
-
const [name, setName] =
|
|
7970
|
-
const [reach, setReach] =
|
|
8127
|
+
const [name, setName] = useState27("");
|
|
8128
|
+
const [reach, setReach] = useState27("");
|
|
7971
8129
|
const selectedWorkspace = workspaces?.some((workspace) => workspace.id === reach) ? reach : "";
|
|
7972
8130
|
const workspaceName = (id) => workspaces?.find((workspace) => workspace.id === id)?.name ?? `A removed ${workspaceNoun.singular}`;
|
|
7973
8131
|
const allowedDays = [...new Set(expiryDays)].filter((days2) => days2 > 0 && Number.isFinite(new Date(Date.now() + days2 * 864e5).getTime()));
|
|
7974
8132
|
const fallbackDays = allowedDays.includes(defaultExpiryDays) ? defaultExpiryDays : allowedDays[0];
|
|
7975
|
-
const [days, setDays] =
|
|
8133
|
+
const [days, setDays] = useState27(fallbackDays);
|
|
7976
8134
|
const selectedDays = days !== void 0 && allowedDays.includes(days) ? days : fallbackDays;
|
|
7977
|
-
const [scopes, setScopes] =
|
|
7978
|
-
const [creating, setCreating] =
|
|
7979
|
-
const [revoking, setRevoking] =
|
|
7980
|
-
const [created, setCreated] =
|
|
7981
|
-
const [notice, setNotice] =
|
|
7982
|
-
const [error, setError] =
|
|
7983
|
-
const keyHeading =
|
|
7984
|
-
const nameInput =
|
|
7985
|
-
const keyWasShown =
|
|
8135
|
+
const [scopes, setScopes] = useState27(() => expandScopes(defaultScopes, access));
|
|
8136
|
+
const [creating, setCreating] = useState27(false);
|
|
8137
|
+
const [revoking, setRevoking] = useState27(null);
|
|
8138
|
+
const [created, setCreated] = useState27(null);
|
|
8139
|
+
const [notice, setNotice] = useState27(null);
|
|
8140
|
+
const [error, setError] = useState27(null);
|
|
8141
|
+
const keyHeading = useRef19(null);
|
|
8142
|
+
const nameInput = useRef19(null);
|
|
8143
|
+
const keyWasShown = useRef19(false);
|
|
7986
8144
|
const selectedScopes = pruneScopes(scopes, access);
|
|
7987
|
-
|
|
8145
|
+
useEffect19(() => {
|
|
7988
8146
|
setScopes((current) => {
|
|
7989
8147
|
const next = pruneScopes(current, access);
|
|
7990
8148
|
return next.length === current.length ? current : next;
|
|
7991
8149
|
});
|
|
7992
8150
|
}, [access]);
|
|
7993
|
-
|
|
8151
|
+
useEffect19(() => {
|
|
7994
8152
|
if (created) {
|
|
7995
8153
|
keyHeading.current?.focus();
|
|
7996
8154
|
keyWasShown.current = true;
|
|
@@ -8036,10 +8194,10 @@ function ApiAccessPanel({
|
|
|
8036
8194
|
setRevoking(null);
|
|
8037
8195
|
}
|
|
8038
8196
|
}
|
|
8039
|
-
return /* @__PURE__ */
|
|
8040
|
-
/* @__PURE__ */
|
|
8041
|
-
accountHref && /* @__PURE__ */
|
|
8042
|
-
/* @__PURE__ */
|
|
8197
|
+
return /* @__PURE__ */ jsx29("main", { className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ jsxs28("div", { className: "mx-auto max-w-2xl space-y-8 px-4 py-8 sm:px-8", children: [
|
|
8198
|
+
/* @__PURE__ */ jsxs28("div", { className: "space-y-2", children: [
|
|
8199
|
+
accountHref && /* @__PURE__ */ jsx29("a", { href: accountHref, className: "text-sm text-muted-foreground hover:text-foreground", children: "Account" }),
|
|
8200
|
+
/* @__PURE__ */ jsx29(
|
|
8043
8201
|
PageHeader2,
|
|
8044
8202
|
{
|
|
8045
8203
|
className: "mb-0",
|
|
@@ -8048,14 +8206,14 @@ function ApiAccessPanel({
|
|
|
8048
8206
|
}
|
|
8049
8207
|
)
|
|
8050
8208
|
] }),
|
|
8051
|
-
error && /* @__PURE__ */
|
|
8052
|
-
notice && /* @__PURE__ */
|
|
8053
|
-
created ? /* @__PURE__ */
|
|
8054
|
-
/* @__PURE__ */
|
|
8055
|
-
/* @__PURE__ */
|
|
8056
|
-
/* @__PURE__ */
|
|
8057
|
-
/* @__PURE__ */
|
|
8058
|
-
/* @__PURE__ */
|
|
8209
|
+
error && /* @__PURE__ */ jsx29("p", { role: "alert", className: "rounded-lg border border-destructive/40 p-3 text-sm text-destructive", children: error }),
|
|
8210
|
+
notice && /* @__PURE__ */ jsx29("p", { role: "status", className: "text-sm text-muted-foreground", children: notice }),
|
|
8211
|
+
created ? /* @__PURE__ */ jsxs28("section", { "aria-labelledby": "save-api-key", className: "space-y-4 rounded-xl border border-border bg-card p-5", children: [
|
|
8212
|
+
/* @__PURE__ */ jsx29("h2", { ref: keyHeading, tabIndex: -1, id: "save-api-key", className: "font-medium outline-none", children: "Save your key" }),
|
|
8213
|
+
/* @__PURE__ */ jsx29("p", { className: "text-sm text-muted-foreground", children: "Copy it directly into your client\u2019s secret storage. It is shown only now. Keep it out of chat messages and prompts." }),
|
|
8214
|
+
/* @__PURE__ */ jsxs28("div", { className: "flex gap-2", children: [
|
|
8215
|
+
/* @__PURE__ */ jsx29(Input3, { size: "lg", "aria-label": "New API key", type: "password", value: created.key, readOnly: true, autoComplete: "off", className: "min-w-0 font-mono" }),
|
|
8216
|
+
/* @__PURE__ */ jsx29(Button6, { onClick: async () => {
|
|
8059
8217
|
try {
|
|
8060
8218
|
await navigator.clipboard.writeText(created.key);
|
|
8061
8219
|
setNotice("Key copied");
|
|
@@ -8064,46 +8222,46 @@ function ApiAccessPanel({
|
|
|
8064
8222
|
}
|
|
8065
8223
|
}, children: "Copy key" })
|
|
8066
8224
|
] }),
|
|
8067
|
-
/* @__PURE__ */
|
|
8225
|
+
/* @__PURE__ */ jsx29(Button6, { variant: "outline", onClick: () => {
|
|
8068
8226
|
setCreated(null);
|
|
8069
8227
|
setNotice(null);
|
|
8070
8228
|
}, children: "I\u2019ve saved it" })
|
|
8071
|
-
] }) : /* @__PURE__ */
|
|
8072
|
-
/* @__PURE__ */
|
|
8073
|
-
/* @__PURE__ */
|
|
8074
|
-
/* @__PURE__ */
|
|
8075
|
-
/* @__PURE__ */
|
|
8076
|
-
/* @__PURE__ */
|
|
8229
|
+
] }) : /* @__PURE__ */ jsxs28("form", { onSubmit: createKey, className: "space-y-5 rounded-xl border border-border bg-card p-5", children: [
|
|
8230
|
+
/* @__PURE__ */ jsx29("h2", { className: "font-medium", children: "Create a key" }),
|
|
8231
|
+
/* @__PURE__ */ jsxs28("div", { className: "grid gap-4 sm:grid-cols-[1fr_10rem]", children: [
|
|
8232
|
+
/* @__PURE__ */ jsxs28("div", { className: "space-y-1.5", children: [
|
|
8233
|
+
/* @__PURE__ */ jsx29("label", { className: "text-sm font-medium", htmlFor: "key-name", children: "Name" }),
|
|
8234
|
+
/* @__PURE__ */ jsx29(Input3, { size: "lg", ref: nameInput, id: "key-name", value: name, onChange: (event) => setName(event.target.value), placeholder: "Client on my server", maxLength: 100, required: true, autoComplete: "off" })
|
|
8077
8235
|
] }),
|
|
8078
|
-
/* @__PURE__ */
|
|
8079
|
-
/* @__PURE__ */
|
|
8080
|
-
/* @__PURE__ */
|
|
8236
|
+
/* @__PURE__ */ jsxs28("div", { className: "space-y-1.5", children: [
|
|
8237
|
+
/* @__PURE__ */ jsx29("label", { className: "text-sm font-medium", htmlFor: "key-expiry", children: "Expires in" }),
|
|
8238
|
+
/* @__PURE__ */ jsx29("select", { id: "key-expiry", value: selectedDays ?? "", onChange: (event) => setDays(Number(event.target.value)), className: "h-11 w-full rounded-lg border border-input bg-background px-3 text-sm", children: allowedDays.map((days2) => /* @__PURE__ */ jsxs28("option", { value: days2, children: [
|
|
8081
8239
|
days2,
|
|
8082
8240
|
" ",
|
|
8083
8241
|
days2 === 1 ? "day" : "days"
|
|
8084
8242
|
] }, days2)) })
|
|
8085
8243
|
] })
|
|
8086
8244
|
] }),
|
|
8087
|
-
workspaces && workspaces.length > 0 && /* @__PURE__ */
|
|
8088
|
-
/* @__PURE__ */
|
|
8089
|
-
/* @__PURE__ */
|
|
8090
|
-
/* @__PURE__ */
|
|
8245
|
+
workspaces && workspaces.length > 0 && /* @__PURE__ */ jsxs28("div", { className: "space-y-1.5", children: [
|
|
8246
|
+
/* @__PURE__ */ jsx29("label", { className: "text-sm font-medium", htmlFor: "key-reach", children: "Reaches" }),
|
|
8247
|
+
/* @__PURE__ */ jsxs28("select", { id: "key-reach", value: selectedWorkspace, onChange: (event) => setReach(event.target.value), className: "h-11 w-full rounded-lg border border-input bg-background px-3 text-sm", children: [
|
|
8248
|
+
/* @__PURE__ */ jsxs28("option", { value: "", children: [
|
|
8091
8249
|
"All ",
|
|
8092
8250
|
workspaceNoun.plural,
|
|
8093
8251
|
", including new ones"
|
|
8094
8252
|
] }),
|
|
8095
|
-
workspaces.map((workspace) => /* @__PURE__ */
|
|
8253
|
+
workspaces.map((workspace) => /* @__PURE__ */ jsxs28("option", { value: workspace.id, children: [
|
|
8096
8254
|
"Only ",
|
|
8097
8255
|
workspace.name
|
|
8098
8256
|
] }, workspace.id))
|
|
8099
8257
|
] })
|
|
8100
8258
|
] }),
|
|
8101
|
-
/* @__PURE__ */
|
|
8102
|
-
/* @__PURE__ */
|
|
8259
|
+
/* @__PURE__ */ jsxs28("fieldset", { className: "space-y-3", children: [
|
|
8260
|
+
/* @__PURE__ */ jsx29("legend", { className: "mb-3 text-sm font-medium", children: "Permissions" }),
|
|
8103
8261
|
access.map((option) => {
|
|
8104
8262
|
const unavailable = !expandScopes([option.scope], access).includes(option.scope);
|
|
8105
|
-
return /* @__PURE__ */
|
|
8106
|
-
/* @__PURE__ */
|
|
8263
|
+
return /* @__PURE__ */ jsxs28("label", { className: "flex cursor-pointer items-start gap-3", children: [
|
|
8264
|
+
/* @__PURE__ */ jsx29(
|
|
8107
8265
|
"input",
|
|
8108
8266
|
{
|
|
8109
8267
|
type: "checkbox",
|
|
@@ -8113,42 +8271,42 @@ function ApiAccessPanel({
|
|
|
8113
8271
|
onChange: (event) => setScopes((current) => event.target.checked ? expandScopes([...current, option.scope], access) : pruneScopes(current.filter((scope) => scope !== option.scope), access))
|
|
8114
8272
|
}
|
|
8115
8273
|
),
|
|
8116
|
-
/* @__PURE__ */
|
|
8117
|
-
/* @__PURE__ */
|
|
8118
|
-
/* @__PURE__ */
|
|
8119
|
-
unavailable && /* @__PURE__ */
|
|
8274
|
+
/* @__PURE__ */ jsxs28("span", { className: "text-sm", children: [
|
|
8275
|
+
/* @__PURE__ */ jsx29("span", { className: "block font-medium", children: option.label }),
|
|
8276
|
+
/* @__PURE__ */ jsx29("span", { className: "text-muted-foreground", children: option.description }),
|
|
8277
|
+
unavailable && /* @__PURE__ */ jsx29("span", { className: "block text-muted-foreground", children: "Required permission unavailable." })
|
|
8120
8278
|
] })
|
|
8121
8279
|
] }, option.scope);
|
|
8122
8280
|
})
|
|
8123
8281
|
] }),
|
|
8124
|
-
limitsDescription && /* @__PURE__ */
|
|
8125
|
-
/* @__PURE__ */
|
|
8282
|
+
limitsDescription && /* @__PURE__ */ jsx29("p", { className: "text-sm text-muted-foreground", children: limitsDescription }),
|
|
8283
|
+
/* @__PURE__ */ jsx29(Button6, { type: "submit", disabled: creating || !name.trim() || !selectedScopes.length || selectedDays === void 0, children: creating ? "Creating\u2026" : "Create key" })
|
|
8126
8284
|
] }),
|
|
8127
|
-
/* @__PURE__ */
|
|
8128
|
-
/* @__PURE__ */
|
|
8129
|
-
keys.length === 0 ? /* @__PURE__ */
|
|
8130
|
-
/* @__PURE__ */
|
|
8131
|
-
/* @__PURE__ */
|
|
8132
|
-
/* @__PURE__ */
|
|
8133
|
-
/* @__PURE__ */
|
|
8134
|
-
workspaces && /* @__PURE__ */
|
|
8285
|
+
/* @__PURE__ */ jsxs28("section", { "aria-labelledby": "existing-keys", className: "space-y-3", children: [
|
|
8286
|
+
/* @__PURE__ */ jsx29("h2", { id: "existing-keys", className: "font-medium", children: "Your keys" }),
|
|
8287
|
+
keys.length === 0 ? /* @__PURE__ */ jsx29("p", { className: "text-sm text-muted-foreground", children: "No keys yet." }) : /* @__PURE__ */ jsx29("ul", { className: "divide-y divide-border rounded-xl border border-border bg-card", children: keys.map((key) => /* @__PURE__ */ jsxs28("li", { className: "flex items-start justify-between gap-3 p-4", children: [
|
|
8288
|
+
/* @__PURE__ */ jsxs28("div", { className: "min-w-0 space-y-1", children: [
|
|
8289
|
+
/* @__PURE__ */ jsx29("p", { className: "break-words text-sm font-medium", children: key.name }),
|
|
8290
|
+
/* @__PURE__ */ jsx29("p", { className: "text-sm text-muted-foreground", children: key.expiresAt ? `${new Date(key.expiresAt).getTime() <= Date.now() ? "Expired" : "Expires"} ${new Date(key.expiresAt).toLocaleDateString()}` : "No expiry" }),
|
|
8291
|
+
/* @__PURE__ */ jsx29("p", { className: "text-sm text-muted-foreground", children: key.scopes.map((scope) => access.find((access2) => access2.scope === scope)?.label ?? scope).join(" \xB7 ") }),
|
|
8292
|
+
workspaces && /* @__PURE__ */ jsx29("p", { className: "text-sm text-muted-foreground", children: key.workspaceIds?.length ? `Only ${key.workspaceIds.map(workspaceName).join(", ")}` : `All ${workspaceNoun.plural}` })
|
|
8135
8293
|
] }),
|
|
8136
|
-
/* @__PURE__ */
|
|
8294
|
+
/* @__PURE__ */ jsx29(Button6, { variant: "outline", disabled: revoking !== null, onClick: () => revokeKey(key.id), "aria-label": `Revoke ${key.name}`, children: revoking === key.id ? "Revoking\u2026" : "Revoke" })
|
|
8137
8295
|
] }, key.id)) })
|
|
8138
8296
|
] }),
|
|
8139
|
-
/* @__PURE__ */
|
|
8297
|
+
/* @__PURE__ */ jsxs28("p", { className: "text-sm text-muted-foreground", children: [
|
|
8140
8298
|
"Use ",
|
|
8141
|
-
/* @__PURE__ */
|
|
8299
|
+
/* @__PURE__ */ jsx29("code", { className: "text-sm", children: baseUrl }),
|
|
8142
8300
|
" as the API base and send the key as a Bearer credential."
|
|
8143
8301
|
] })
|
|
8144
8302
|
] }) });
|
|
8145
8303
|
}
|
|
8146
8304
|
|
|
8147
8305
|
// src/web-react/agent-setup-block.tsx
|
|
8148
|
-
import { useState as
|
|
8149
|
-
import { jsx as
|
|
8306
|
+
import { useState as useState28 } from "react";
|
|
8307
|
+
import { jsx as jsx30, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
8150
8308
|
function AgentSetupBlock({ productName, setupUrl, markdown, description, className }) {
|
|
8151
|
-
const [notice, setNotice] =
|
|
8309
|
+
const [notice, setNotice] = useState28(null);
|
|
8152
8310
|
const prompt = markdown ?? `Set up ${productName} for me. Fetch ${setupUrl} and follow every step in it.`;
|
|
8153
8311
|
async function copy() {
|
|
8154
8312
|
try {
|
|
@@ -8158,15 +8316,15 @@ function AgentSetupBlock({ productName, setupUrl, markdown, description, classNa
|
|
|
8158
8316
|
setNotice(`Clipboard unavailable. Open ${setupUrl} and copy it from there.`);
|
|
8159
8317
|
}
|
|
8160
8318
|
}
|
|
8161
|
-
return /* @__PURE__ */
|
|
8319
|
+
return /* @__PURE__ */ jsxs29(
|
|
8162
8320
|
"section",
|
|
8163
8321
|
{
|
|
8164
8322
|
"aria-labelledby": "agent-setup-heading",
|
|
8165
8323
|
className: `space-y-3 rounded-xl border border-border bg-card p-5 ${className ?? ""}`.trim(),
|
|
8166
8324
|
children: [
|
|
8167
|
-
/* @__PURE__ */
|
|
8168
|
-
/* @__PURE__ */
|
|
8169
|
-
/* @__PURE__ */
|
|
8325
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [
|
|
8326
|
+
/* @__PURE__ */ jsx30("h2", { id: "agent-setup-heading", className: "font-medium text-foreground", children: "Hand this to your agent" }),
|
|
8327
|
+
/* @__PURE__ */ jsx30(
|
|
8170
8328
|
"button",
|
|
8171
8329
|
{
|
|
8172
8330
|
type: "button",
|
|
@@ -8176,13 +8334,13 @@ function AgentSetupBlock({ productName, setupUrl, markdown, description, classNa
|
|
|
8176
8334
|
}
|
|
8177
8335
|
)
|
|
8178
8336
|
] }),
|
|
8179
|
-
/* @__PURE__ */
|
|
8180
|
-
/* @__PURE__ */
|
|
8337
|
+
/* @__PURE__ */ jsx30("p", { className: "text-sm text-muted-foreground", children: description ?? `Your coding agent sets up ${productName} end to end: it asks you to approve once, gets its own capped key, installs the client, and verifies a first call.` }),
|
|
8338
|
+
/* @__PURE__ */ jsxs29("p", { className: "text-sm text-muted-foreground", children: [
|
|
8181
8339
|
"Raw prompt:",
|
|
8182
8340
|
" ",
|
|
8183
|
-
/* @__PURE__ */
|
|
8341
|
+
/* @__PURE__ */ jsx30("a", { href: setupUrl, className: "font-mono text-foreground underline", children: setupUrl })
|
|
8184
8342
|
] }),
|
|
8185
|
-
notice ? /* @__PURE__ */
|
|
8343
|
+
notice ? /* @__PURE__ */ jsx30("p", { role: "status", className: "text-sm text-foreground", children: notice }) : null
|
|
8186
8344
|
]
|
|
8187
8345
|
}
|
|
8188
8346
|
);
|
|
@@ -8190,37 +8348,37 @@ function AgentSetupBlock({ productName, setupUrl, markdown, description, classNa
|
|
|
8190
8348
|
|
|
8191
8349
|
// src/web-react/agent-profile-choices.tsx
|
|
8192
8350
|
import { useId as useId5 } from "react";
|
|
8193
|
-
import { jsx as
|
|
8351
|
+
import { jsx as jsx31, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
8194
8352
|
function AgentProfileChoices({ value, profiles, onChange, disabled, locked, lockReason, onNewChat, label = "Agent profile" }) {
|
|
8195
8353
|
const name = useId5();
|
|
8196
8354
|
const selected = profiles.find((profile) => profile.id === value);
|
|
8197
8355
|
if (locked) {
|
|
8198
|
-
return /* @__PURE__ */
|
|
8199
|
-
/* @__PURE__ */
|
|
8200
|
-
/* @__PURE__ */
|
|
8201
|
-
onNewChat && !disabled && /* @__PURE__ */
|
|
8356
|
+
return /* @__PURE__ */ jsxs30("div", { className: "space-y-2 rounded-lg border border-border p-3 text-sm", children: [
|
|
8357
|
+
/* @__PURE__ */ jsx31("p", { className: "font-medium text-foreground", children: selected?.name ?? value }),
|
|
8358
|
+
/* @__PURE__ */ jsx31("p", { className: "text-muted-foreground", children: lockReason ?? "This conversation stays on its current profile." }),
|
|
8359
|
+
onNewChat && !disabled && /* @__PURE__ */ jsx31("button", { type: "button", onClick: onNewChat, className: "text-sm font-medium text-primary underline underline-offset-4", children: "New chat to switch profile" })
|
|
8202
8360
|
] });
|
|
8203
8361
|
}
|
|
8204
|
-
return /* @__PURE__ */
|
|
8205
|
-
/* @__PURE__ */
|
|
8206
|
-
/* @__PURE__ */
|
|
8207
|
-
profiles.map((profile) => /* @__PURE__ */
|
|
8208
|
-
/* @__PURE__ */
|
|
8362
|
+
return /* @__PURE__ */ jsxs30("fieldset", { disabled, className: "min-w-0 space-y-1", children: [
|
|
8363
|
+
/* @__PURE__ */ jsx31("legend", { className: "sr-only", children: label }),
|
|
8364
|
+
/* @__PURE__ */ jsxs30("div", { className: "max-h-48 space-y-1 overflow-y-auto", children: [
|
|
8365
|
+
profiles.map((profile) => /* @__PURE__ */ jsxs30("label", { className: "flex min-h-10 cursor-pointer items-start gap-2 rounded-lg border border-transparent p-2 text-sm hover:bg-muted has-[:checked]:border-border has-[:checked]:bg-muted has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-60", children: [
|
|
8366
|
+
/* @__PURE__ */ jsx31("input", { type: "radio", name, value: profile.id, checked: profile.id === value, disabled, onChange: () => {
|
|
8209
8367
|
if (!disabled) onChange(profile.id);
|
|
8210
8368
|
}, className: "mt-1 shrink-0 accent-primary" }),
|
|
8211
|
-
/* @__PURE__ */
|
|
8212
|
-
/* @__PURE__ */
|
|
8213
|
-
profile.description && /* @__PURE__ */
|
|
8369
|
+
/* @__PURE__ */ jsxs30("span", { className: "min-w-0", children: [
|
|
8370
|
+
/* @__PURE__ */ jsx31("span", { className: "block font-medium text-foreground", children: profile.name }),
|
|
8371
|
+
profile.description && /* @__PURE__ */ jsx31("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: profile.description })
|
|
8214
8372
|
] })
|
|
8215
8373
|
] }, profile.id)),
|
|
8216
|
-
profiles.length === 0 && /* @__PURE__ */
|
|
8374
|
+
profiles.length === 0 && /* @__PURE__ */ jsx31("p", { role: "status", className: "p-2 text-sm text-muted-foreground", children: "No profiles available." })
|
|
8217
8375
|
] })
|
|
8218
8376
|
] });
|
|
8219
8377
|
}
|
|
8220
8378
|
|
|
8221
8379
|
// src/web-react/composer-profile-pill.tsx
|
|
8222
8380
|
import { AgentProfilePicker } from "@tangle-network/sandbox-ui/chat";
|
|
8223
|
-
import { jsx as
|
|
8381
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
8224
8382
|
var TRIGGER = {
|
|
8225
8383
|
composer: "max-w-[180px]",
|
|
8226
8384
|
// A menu panel repoints surface-container to its own tone, which would leave
|
|
@@ -8245,7 +8403,7 @@ function ComposerProfilePill({
|
|
|
8245
8403
|
placement = "composer",
|
|
8246
8404
|
className
|
|
8247
8405
|
}) {
|
|
8248
|
-
return /* @__PURE__ */
|
|
8406
|
+
return /* @__PURE__ */ jsx32(
|
|
8249
8407
|
AgentProfilePicker,
|
|
8250
8408
|
{
|
|
8251
8409
|
value: selection.value,
|
|
@@ -8303,6 +8461,7 @@ export {
|
|
|
8303
8461
|
createDurablePlanDecisionClient,
|
|
8304
8462
|
useDurablePlanFlow,
|
|
8305
8463
|
DurablePlanCard,
|
|
8464
|
+
DurablePlanFlowCard,
|
|
8306
8465
|
durableChatCardsFromParts,
|
|
8307
8466
|
DurableChatCards,
|
|
8308
8467
|
createSessionInteractionAttemptStore,
|
|
@@ -8322,6 +8481,8 @@ export {
|
|
|
8322
8481
|
DEFAULT_MENTION_EMPTY_TEXT,
|
|
8323
8482
|
useFileMentions,
|
|
8324
8483
|
segmentMentionContent,
|
|
8484
|
+
usePlanModeSelection,
|
|
8485
|
+
useModels,
|
|
8325
8486
|
__resetAttachmentFileCacheForTests,
|
|
8326
8487
|
loadAttachmentFile,
|
|
8327
8488
|
triggerAttachmentDownload,
|
|
@@ -8414,4 +8575,4 @@ export {
|
|
|
8414
8575
|
AgentProfileChoices,
|
|
8415
8576
|
ComposerProfilePill
|
|
8416
8577
|
};
|
|
8417
|
-
//# sourceMappingURL=chunk-
|
|
8578
|
+
//# sourceMappingURL=chunk-6UMIOEDR.js.map
|