@tangle-network/agent-app 0.45.28 → 0.45.30
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-3RRPVPCP.js → DesignCanvas-RSWQCXM3.js} +2 -2
- package/dist/{DesignCanvasEditor-KAMMEX7E.js → DesignCanvasEditor-XZMGIST7.js} +4 -4
- package/dist/{use-file-mentions-CZ-Ua_sb.d.ts → agent-session-controls-BwImzYKC.d.ts} +32 -1
- package/dist/alerting/index.d.ts +178 -0
- package/dist/alerting/index.js +9 -0
- package/dist/alerting/index.js.map +1 -0
- package/dist/assistant/index.d.ts +65 -42
- package/dist/assistant/index.js +31 -12
- package/dist/assistant/index.js.map +1 -1
- package/dist/chat-react/index.d.ts +20 -140
- package/dist/chat-react/index.js +15 -133
- package/dist/chat-react/index.js.map +1 -1
- package/dist/chat-routes/index.js +7 -7
- package/dist/chunk-COP2K4LF.js +190 -0
- package/dist/chunk-COP2K4LF.js.map +1 -0
- package/dist/{chunk-NC2V63EL.js → chunk-FNM7JYME.js} +88 -21
- package/dist/chunk-FNM7JYME.js.map +1 -0
- package/dist/{chunk-WC43OQMR.js → chunk-IFYJDX3J.js} +867 -1260
- package/dist/chunk-IFYJDX3J.js.map +1 -0
- package/dist/chunk-L7FHRORY.js +763 -0
- package/dist/chunk-L7FHRORY.js.map +1 -0
- package/dist/{chunk-4QVG4WJQ.js → chunk-OYTMILRK.js} +10 -3
- package/dist/chunk-OYTMILRK.js.map +1 -0
- package/dist/{chunk-OYGM5WLD.js → chunk-PURHUAOR.js} +52 -15
- package/dist/chunk-PURHUAOR.js.map +1 -0
- package/dist/{chunk-AWPK7ZDS.js → chunk-QGOU3VXH.js} +3 -3
- package/dist/{chunk-OTLEYHOG.js → chunk-RRH23CGS.js} +24 -4
- package/dist/chunk-RRH23CGS.js.map +1 -0
- package/dist/{chunk-5FAKBTCK.js → chunk-XDB7IBYE.js} +22 -1
- package/dist/chunk-XDB7IBYE.js.map +1 -0
- package/dist/design-canvas-react/engine.d.ts +15 -1
- package/dist/design-canvas-react/engine.js +6 -2
- package/dist/design-canvas-react/index.d.ts +13 -1
- package/dist/design-canvas-react/index.js +13 -8
- package/dist/design-canvas-react/index.js.map +1 -1
- package/dist/design-canvas-react/lazy.js +1 -1
- package/dist/preflight/cli.js +2 -1
- package/dist/preflight/cli.js.map +1 -1
- package/dist/preflight/index.d.ts +35 -2
- package/dist/preflight/index.js +6 -3
- package/dist/sandbox/index.d.ts +11 -1
- package/dist/sandbox/index.js +1 -1
- package/dist/teams/index.js +5 -5
- package/dist/teams/invitations-api.js +4 -4
- package/dist/web-react/index.d.ts +26 -35
- package/dist/web-react/index.js +10 -10
- package/package.json +19 -3
- package/dist/chunk-4QVG4WJQ.js.map +0 -1
- package/dist/chunk-5FAKBTCK.js.map +0 -1
- package/dist/chunk-E4DHYENH.js +0 -292
- package/dist/chunk-E4DHYENH.js.map +0 -1
- package/dist/chunk-NC2V63EL.js.map +0 -1
- package/dist/chunk-OTLEYHOG.js.map +0 -1
- package/dist/chunk-OYGM5WLD.js.map +0 -1
- package/dist/chunk-WC43OQMR.js.map +0 -1
- /package/dist/{DesignCanvas-3RRPVPCP.js.map → DesignCanvas-RSWQCXM3.js.map} +0 -0
- /package/dist/{DesignCanvasEditor-KAMMEX7E.js.map → DesignCanvasEditor-XZMGIST7.js.map} +0 -0
- /package/dist/{chunk-AWPK7ZDS.js.map → chunk-QGOU3VXH.js.map} +0 -0
|
@@ -5,6 +5,11 @@ import {
|
|
|
5
5
|
WorkProductCard,
|
|
6
6
|
workProductPartsFromMessageParts
|
|
7
7
|
} from "./chunk-HZ4WCA37.js";
|
|
8
|
+
import {
|
|
9
|
+
ChevronDown,
|
|
10
|
+
POPOVER_OPTION_FOCUS,
|
|
11
|
+
usePending
|
|
12
|
+
} from "./chunk-L7FHRORY.js";
|
|
8
13
|
import {
|
|
9
14
|
UNTITLED_SESSION_LABEL,
|
|
10
15
|
mergeSessionPages,
|
|
@@ -30,13 +35,9 @@ import {
|
|
|
30
35
|
parsePlanSubmittedEvent,
|
|
31
36
|
persistedPartToPlan
|
|
32
37
|
} from "./chunk-YJMCRXQQ.js";
|
|
33
|
-
import {
|
|
34
|
-
snapHarnessToModel,
|
|
35
|
-
snapModelToHarness
|
|
36
|
-
} from "./chunk-TH7L265V.js";
|
|
37
38
|
|
|
38
39
|
// src/web-react/index.tsx
|
|
39
|
-
import { useEffect as
|
|
40
|
+
import { useEffect as useEffect11, useMemo as useMemo7, useRef as useRef10, useState as useState14, memo } from "react";
|
|
40
41
|
|
|
41
42
|
// src/web-react/smooth-text.ts
|
|
42
43
|
import { useEffect, useRef, useState } from "react";
|
|
@@ -78,309 +79,11 @@ function useSmoothText(target, enabled, opts) {
|
|
|
78
79
|
return target.slice(0, Math.floor(shownRef.current));
|
|
79
80
|
}
|
|
80
81
|
|
|
81
|
-
// src/web-react/controls.tsx
|
|
82
|
-
import { useEffect as useEffect2, useMemo, useRef as useRef2, useState as useState2 } from "react";
|
|
83
|
-
|
|
84
|
-
// src/web-react/provider-logo.tsx
|
|
85
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
86
|
-
var LOGOS = {
|
|
87
|
-
anthropic: { viewBox: "0 0 24 24", fill: "#D97757", paths: ["M17.3041 3.541h-3.6718l6.696 16.918H24Zm-10.6082 0L0 20.459h3.7442l1.3693-3.5527h7.0052l1.3693 3.5528h3.7442L10.5363 3.5409Zm-.3712 10.2232 2.2914-5.9456 2.2914 5.9456Z"] },
|
|
88
|
-
google: { viewBox: "0 0 24 24", fill: "#8E75B2", paths: ["M11.04 19.32Q12 21.51 12 24q0-2.49.93-4.68.96-2.19 2.58-3.81t3.81-2.55Q21.51 12 24 12q-2.49 0-4.68-.93a12.3 12.3 0 0 1-3.81-2.58 12.3 12.3 0 0 1-2.58-3.81Q12 2.49 12 0q0 2.49-.96 4.68-.93 2.19-2.55 3.81a12.3 12.3 0 0 1-3.81 2.58Q2.49 12 0 12q2.49 0 4.68.96 2.19.93 3.81 2.55t2.55 3.81"] },
|
|
89
|
-
deepseek: { viewBox: "0 0 24 24", fill: "#4D6BFE", paths: ["M23.748 4.651c-.254-.124-.364.113-.512.233-.051.04-.094.09-.137.137-.372.397-.806.657-1.373.626-.829-.046-1.537.214-2.163.848-.133-.782-.575-1.248-1.247-1.548-.352-.155-.708-.311-.955-.65-.172-.24-.219-.509-.305-.774-.055-.16-.11-.323-.293-.35-.2-.031-.278.136-.356.276-.313.572-.434 1.202-.422 1.84.027 1.436.633 2.58 1.838 3.393.137.094.172.187.129.323-.082.28-.18.553-.266.833-.055.179-.137.218-.328.14a5.5 5.5 0 0 1-1.737-1.179c-.857-.828-1.631-1.743-2.597-2.46a12 12 0 0 0-.689-.47c-.985-.957.13-1.743.387-1.836.27-.098.094-.433-.778-.428-.872.003-1.67.295-2.687.685a3 3 0 0 1-.465.136 9.6 9.6 0 0 0-2.883-.101c-1.885.21-3.39 1.1-4.497 2.622C.082 8.776-.231 10.854.152 13.02c.403 2.284 1.568 4.175 3.36 5.653 1.857 1.533 3.997 2.284 6.438 2.14 1.482-.085 3.132-.284 4.994-1.86.47.234.962.328 1.78.398.629.058 1.235-.031 1.705-.129.735-.155.684-.836.418-.961-2.155-1.004-1.682-.595-2.112-.926 1.095-1.295 2.768-3.598 3.284-6.733.05-.346.115-.834.108-1.114-.004-.171.035-.238.23-.257a4.2 4.2 0 0 0 1.545-.475c1.397-.763 1.96-2.016 2.093-3.517.02-.23-.004-.467-.247-.588M11.58 18.168c-2.088-1.642-3.101-2.183-3.52-2.16-.39.024-.32.472-.234.763.09.288.207.487.371.74.114.167.192.416-.113.603-.673.416-1.842-.14-1.897-.168-1.361-.801-2.5-1.86-3.301-3.306-.775-1.393-1.225-2.888-1.299-4.482-.02-.385.094-.522.477-.592a4.7 4.7 0 0 1 1.53-.038c2.131.311 3.946 1.264 5.467 2.774.868.86 1.525 1.887 2.202 2.89.72 1.066 1.494 2.082 2.48 2.915.348.291.626.513.892.677-.802.09-2.14.109-3.055-.615zm1.001-6.44a.306.306 0 0 1 .415-.287.3.3 0 0 1 .113.074.3.3 0 0 1 .086.214c0 .17-.136.307-.308.307a.303.303 0 0 1-.306-.307m3.11 1.596c-.2.081-.4.151-.591.16a1.25 1.25 0 0 1-.798-.254c-.274-.23-.47-.358-.551-.758a1.7 1.7 0 0 1 .015-.588c.07-.327-.007-.537-.238-.727-.188-.156-.426-.199-.689-.199a.6.6 0 0 1-.254-.078.253.253 0 0 1-.114-.358 1 1 0 0 1 .192-.21c.356-.202.767-.136 1.146.016.352.144.618.408 1.001.782.392.451.462.576.685.915.176.264.336.536.446.848.066.194-.02.353-.25.45"] },
|
|
90
|
-
mistral: { viewBox: "0 0 24 24", fill: "#FA520F", paths: ["M17.143 3.429v3.428h-3.429v3.429h-3.428V6.857H6.857V3.43H3.43v13.714H0v3.428h10.286v-3.428H6.857v-3.429h3.429v3.429h3.429v-3.429h3.428v3.429h-3.428v3.428H24v-3.428h-3.43V3.429z"] },
|
|
91
|
-
xai: { viewBox: "0 0 24 24", fill: "#000000", paths: ["M14.234 10.162 22.977 0h-2.072l-7.591 8.824L7.251 0H.258l9.168 13.343L.258 24H2.33l8.016-9.318L16.749 24h6.993zm-2.837 3.299-.929-1.329L3.076 1.56h3.182l5.965 8.532.929 1.329 7.754 11.09h-3.182z"] },
|
|
92
|
-
nvidia: { viewBox: "0 0 24 24", fill: "#76B900", paths: ["M8.948 8.798v-1.43a6.7 6.7 0 0 1 .424-.018c3.922-.124 6.493 3.374 6.493 3.374s-2.774 3.851-5.75 3.851c-.398 0-.787-.062-1.158-.185v-4.346c1.528.185 1.837.857 2.747 2.385l2.04-1.714s-1.492-1.952-4-1.952a6.016 6.016 0 0 0-.796.035m0-4.735v2.138l.424-.027c5.45-.185 9.01 4.47 9.01 4.47s-4.08 4.964-8.33 4.964c-.37 0-.733-.035-1.095-.097v1.325c.3.035.61.062.91.062 3.957 0 6.82-2.023 9.593-4.408.459.371 2.34 1.263 2.73 1.652-2.633 2.208-8.772 3.984-12.253 3.984-.335 0-.653-.018-.971-.053v1.864H24V4.063zm0 10.326v1.131c-3.657-.654-4.673-4.46-4.673-4.46s1.758-1.944 4.673-2.262v1.237H8.94c-1.528-.186-2.73 1.245-2.73 1.245s.68 2.412 2.739 3.11M2.456 10.9s2.164-3.197 6.5-3.533V6.201C4.153 6.59 0 10.653 0 10.653s2.35 6.802 8.948 7.42v-1.237c-4.84-.6-6.492-5.936-6.492-5.936z"] },
|
|
93
|
-
meta: { viewBox: "0 0 24 24", fill: "#0467DF", paths: ["M6.915 4.03c-1.968 0-3.683 1.28-4.871 3.113C.704 9.208 0 11.883 0 14.449c0 .706.07 1.369.21 1.973a6.624 6.624 0 0 0 .265.86 5.297 5.297 0 0 0 .371.761c.696 1.159 1.818 1.927 3.593 1.927 1.497 0 2.633-.671 3.965-2.444.76-1.012 1.144-1.626 2.663-4.32l.756-1.339.186-.325c.061.1.121.196.183.3l2.152 3.595c.724 1.21 1.665 2.556 2.47 3.314 1.046.987 1.992 1.22 3.06 1.22 1.075 0 1.876-.355 2.455-.843a3.743 3.743 0 0 0 .81-.973c.542-.939.861-2.127.861-3.745 0-2.72-.681-5.357-2.084-7.45-1.282-1.912-2.957-2.93-4.716-2.93-1.047 0-2.088.467-3.053 1.308-.652.57-1.257 1.29-1.82 2.05-.69-.875-1.335-1.547-1.958-2.056-1.182-.966-2.315-1.303-3.454-1.303zm10.16 2.053c1.147 0 2.188.758 2.992 1.999 1.132 1.748 1.647 4.195 1.647 6.4 0 1.548-.368 2.9-1.839 2.9-.58 0-1.027-.23-1.664-1.004-.496-.601-1.343-1.878-2.832-4.358l-.617-1.028a44.908 44.908 0 0 0-1.255-1.98c.07-.109.141-.224.211-.327 1.12-1.667 2.118-2.602 3.358-2.602zm-10.201.553c1.265 0 2.058.791 2.675 1.446.307.327.737.871 1.234 1.579l-1.02 1.566c-.757 1.163-1.882 3.017-2.837 4.338-1.191 1.649-1.81 1.817-2.486 1.817-.524 0-1.038-.237-1.383-.794-.263-.426-.464-1.13-.464-2.046 0-2.221.63-4.535 1.66-6.088.454-.687.964-1.226 1.533-1.533a2.264 2.264 0 0 1 1.088-.285z"] },
|
|
94
|
-
moonshotai: { viewBox: "0 0 24 24", fill: "#16191E", paths: ["m1.053 16.91 9.538 2.55a21 20.981 0 0 0 .06 2.031l5.956 1.592a12 11.99 0 0 1-15.554-6.172m-1.02-5.79 11.352 3.035a21 20.981 0 0 0-.469 2.01l10.817 2.89a12 11.99 0 0 1-1.845 2.004L.658 15.918a12 11.99 0 0 1-.625-4.796m1.593-5.146L13.573 9.17a21 20.981 0 0 0-1.01 1.874l11.297 3.02a21 20.981 0 0 1-.67 2.362l-11.55-3.087L.125 10.26a12 11.99 0 0 1 1.499-4.285ZM6.067 1.58l11.285 3.016a21 20.981 0 0 0-1.688 1.719l7.824 2.091a21 20.981 0 0 1 .513 2.664L2.107 5.218a12 11.99 0 0 1 3.96-3.638M21.68 4.866 7.222 1.003A12 11.99 0 0 1 21.68 4.866"] },
|
|
95
|
-
openai: { viewBox: "0 0 256 260", fill: "#10A37F", paths: ["M239.184 106.203a64.72 64.72 0 0 0-5.576-53.103C219.452 28.459 191 15.784 163.213 21.74A65.586 65.586 0 0 0 52.096 45.22a64.72 64.72 0 0 0-43.23 31.36c-14.31 24.602-11.061 55.634 8.033 76.74a64.67 64.67 0 0 0 5.525 53.102c14.174 24.65 42.644 37.324 70.446 31.36a64.72 64.72 0 0 0 48.754 21.744c28.481.025 53.714-18.361 62.414-45.481a64.77 64.77 0 0 0 43.229-31.36c14.137-24.558 10.875-55.423-8.083-76.483m-97.56 136.338a48.4 48.4 0 0 1-31.105-11.255l1.535-.87l51.67-29.825a8.6 8.6 0 0 0 4.247-7.367v-72.85l21.845 12.636c.218.111.37.32.409.563v60.367c-.056 26.818-21.783 48.545-48.601 48.601M37.158 197.93a48.35 48.35 0 0 1-5.781-32.589l1.534.921l51.722 29.826a8.34 8.34 0 0 0 8.441 0l63.181-36.425v25.221a.87.87 0 0 1-.358.665l-52.335 30.184c-23.257 13.398-52.97 5.431-66.404-17.803M23.549 85.38a48.5 48.5 0 0 1 25.58-21.333v61.39a8.29 8.29 0 0 0 4.195 7.316l62.874 36.272l-21.845 12.636a.82.82 0 0 1-.767 0L41.353 151.53c-23.211-13.454-31.171-43.144-17.804-66.405zm179.466 41.695l-63.08-36.63L161.73 77.86a.82.82 0 0 1 .768 0l52.233 30.184a48.6 48.6 0 0 1-7.316 87.635v-61.391a8.54 8.54 0 0 0-4.4-7.213m21.742-32.69l-1.535-.922l-51.619-30.081a8.39 8.39 0 0 0-8.492 0L99.98 99.808V74.587a.72.72 0 0 1 .307-.665l52.233-30.133a48.652 48.652 0 0 1 72.236 50.391zM88.061 139.097l-21.845-12.585a.87.87 0 0 1-.41-.614V65.685a48.652 48.652 0 0 1 79.757-37.346l-1.535.87l-51.67 29.825a8.6 8.6 0 0 0-4.246 7.367zm11.868-25.58L128.067 97.3l28.188 16.218v32.434l-28.086 16.218l-28.188-16.218z"] }
|
|
96
|
-
};
|
|
97
|
-
var ALIASES = {
|
|
98
|
-
moonshot: "moonshotai",
|
|
99
|
-
deepseek_ai: "deepseek",
|
|
100
|
-
"x-ai": "xai",
|
|
101
|
-
"meta-llama": "meta"
|
|
102
|
-
};
|
|
103
|
-
var MONOGRAM = {
|
|
104
|
-
cohere: { bg: "#fae8ff", fg: "#c026d3" },
|
|
105
|
-
groq: { bg: "#fce7f3", fg: "#db2777" },
|
|
106
|
-
cerebras: { bg: "#ccfbf1", fg: "#0d9488" },
|
|
107
|
-
zai: { bg: "#ede9fe", fg: "#7c3aed" },
|
|
108
|
-
"z-ai": { bg: "#ede9fe", fg: "#7c3aed" },
|
|
109
|
-
tuner: { bg: "#dbeafe", fg: "#2563eb" }
|
|
110
|
-
};
|
|
111
|
-
function ProviderLogo({ provider, size = 16 }) {
|
|
112
|
-
const key = ALIASES[provider ?? ""] ?? provider ?? "";
|
|
113
|
-
const logo = LOGOS[key];
|
|
114
|
-
if (logo) {
|
|
115
|
-
return /* @__PURE__ */ jsx("svg", { width: size, height: size, viewBox: logo.viewBox, role: "img", "aria-label": key, children: logo.paths.map((d, i) => /* @__PURE__ */ jsx("path", { d, fill: logo.fill }, i)) });
|
|
116
|
-
}
|
|
117
|
-
const mono = MONOGRAM[key] ?? { bg: "#f3f4f6", fg: "#6b7280" };
|
|
118
|
-
return /* @__PURE__ */ jsxs("svg", { width: size, height: size, viewBox: "0 0 16 16", role: "img", "aria-label": key || "model", children: [
|
|
119
|
-
/* @__PURE__ */ jsx("rect", { width: "16", height: "16", rx: "4", fill: mono.bg }),
|
|
120
|
-
/* @__PURE__ */ jsx("text", { x: "8", y: "11.6", textAnchor: "middle", fill: mono.fg, fontSize: "9", fontWeight: "700", fontFamily: "system-ui, sans-serif", children: (key || "?").charAt(0).toUpperCase() })
|
|
121
|
-
] });
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// src/web-react/controls.tsx
|
|
125
|
-
import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
126
|
-
function ChevronDown({ className }) {
|
|
127
|
-
return /* @__PURE__ */ jsx2("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx2("path", { d: "m6 9 6 6 6-6" }) });
|
|
128
|
-
}
|
|
129
|
-
function SearchGlyph({ className }) {
|
|
130
|
-
return /* @__PURE__ */ jsxs2("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
131
|
-
/* @__PURE__ */ jsx2("circle", { cx: "11", cy: "11", r: "8" }),
|
|
132
|
-
/* @__PURE__ */ jsx2("path", { d: "m21 21-4.3-4.3" })
|
|
133
|
-
] });
|
|
134
|
-
}
|
|
135
|
-
function SparkleGlyph({ className }) {
|
|
136
|
-
return /* @__PURE__ */ jsx2("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx2("path", { d: "M12 3v3m0 12v3M3 12h3m12 0h3M5.6 5.6l2.1 2.1m8.6 8.6 2.1 2.1m0-12.8-2.1 2.1M7.7 16.3l-2.1 2.1" }) });
|
|
137
|
-
}
|
|
138
|
-
function usePopover(open, setOpen) {
|
|
139
|
-
const containerRef = useRef2(null);
|
|
140
|
-
const triggerRef = useRef2(null);
|
|
141
|
-
useEffect2(() => {
|
|
142
|
-
if (!open) return;
|
|
143
|
-
function onMouseDown(e) {
|
|
144
|
-
if (containerRef.current && !containerRef.current.contains(e.target)) setOpen(false);
|
|
145
|
-
}
|
|
146
|
-
function onKeyDown(e) {
|
|
147
|
-
if (e.key === "Escape") {
|
|
148
|
-
setOpen(false);
|
|
149
|
-
triggerRef.current?.focus();
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
document.addEventListener("mousedown", onMouseDown);
|
|
153
|
-
document.addEventListener("keydown", onKeyDown);
|
|
154
|
-
return () => {
|
|
155
|
-
document.removeEventListener("mousedown", onMouseDown);
|
|
156
|
-
document.removeEventListener("keydown", onKeyDown);
|
|
157
|
-
};
|
|
158
|
-
}, [open, setOpen]);
|
|
159
|
-
return {
|
|
160
|
-
containerRef,
|
|
161
|
-
triggerRef,
|
|
162
|
-
triggerProps: {
|
|
163
|
-
ref: triggerRef,
|
|
164
|
-
"aria-haspopup": true,
|
|
165
|
-
"aria-expanded": open
|
|
166
|
-
}
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
var POPOVER_OPTION_FOCUS = "focus-visible:[outline-offset:-2px]";
|
|
170
|
-
function usePending() {
|
|
171
|
-
const [pending, setPending] = useState2(false);
|
|
172
|
-
const inFlight = useRef2(false);
|
|
173
|
-
const mounted = useRef2(true);
|
|
174
|
-
useEffect2(() => {
|
|
175
|
-
mounted.current = true;
|
|
176
|
-
return () => {
|
|
177
|
-
mounted.current = false;
|
|
178
|
-
};
|
|
179
|
-
}, []);
|
|
180
|
-
const run = (action) => {
|
|
181
|
-
if (inFlight.current) return;
|
|
182
|
-
let result;
|
|
183
|
-
try {
|
|
184
|
-
result = action();
|
|
185
|
-
} catch {
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
if (!(result instanceof Promise)) return;
|
|
189
|
-
inFlight.current = true;
|
|
190
|
-
setPending(true);
|
|
191
|
-
void result.finally(() => {
|
|
192
|
-
inFlight.current = false;
|
|
193
|
-
if (mounted.current) setPending(false);
|
|
194
|
-
});
|
|
195
|
-
};
|
|
196
|
-
return { pending, run };
|
|
197
|
-
}
|
|
198
|
-
function formatPrice(p) {
|
|
199
|
-
if (!p) return void 0;
|
|
200
|
-
const n = Number(p);
|
|
201
|
-
if (isNaN(n) || n === 0) return void 0;
|
|
202
|
-
const perM = n * 1e6;
|
|
203
|
-
return perM >= 1 ? `$${perM.toFixed(0)}/M` : `$${perM.toFixed(2)}/M`;
|
|
204
|
-
}
|
|
205
|
-
function formatContext(len) {
|
|
206
|
-
if (!len) return void 0;
|
|
207
|
-
if (len >= 1e6) return `${(len / 1e6).toFixed(1)}M ctx`;
|
|
208
|
-
if (len >= 1e3) return `${Math.round(len / 1e3)}K ctx`;
|
|
209
|
-
return `${len} ctx`;
|
|
210
|
-
}
|
|
211
|
-
function SectionHeader({ children }) {
|
|
212
|
-
return /* @__PURE__ */ jsx2("div", { className: "px-3 pb-1 pt-3 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children });
|
|
213
|
-
}
|
|
214
|
-
function ModelRow({
|
|
215
|
-
model,
|
|
216
|
-
selected,
|
|
217
|
-
onSelect,
|
|
218
|
-
renderProviderBadge
|
|
219
|
-
}) {
|
|
220
|
-
const price = formatPrice(model.pricing?.prompt);
|
|
221
|
-
const ctx = formatContext(model.contextLength);
|
|
222
|
-
return /* @__PURE__ */ jsxs2(
|
|
223
|
-
"button",
|
|
224
|
-
{
|
|
225
|
-
type: "button",
|
|
226
|
-
onClick: onSelect,
|
|
227
|
-
className: `flex w-full items-center gap-2.5 rounded-md px-3 py-2.5 text-left text-sm transition ${POPOVER_OPTION_FOCUS} ${selected ? "bg-primary/10 font-medium" : "hover:bg-accent/30"}`,
|
|
228
|
-
children: [
|
|
229
|
-
renderProviderBadge ? renderProviderBadge(model.provider) : /* @__PURE__ */ jsx2(ProviderLogo, { provider: model.provider, size: 16 }),
|
|
230
|
-
/* @__PURE__ */ jsx2("span", { className: "truncate", children: model.name }),
|
|
231
|
-
!model.supportsTools && /* @__PURE__ */ jsx2("span", { className: "shrink-0 rounded bg-muted/60 px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground", children: "no tools" }),
|
|
232
|
-
/* @__PURE__ */ jsxs2("span", { className: "ml-auto flex shrink-0 items-center gap-2 text-xs text-muted-foreground", children: [
|
|
233
|
-
ctx && /* @__PURE__ */ jsx2("span", { children: ctx }),
|
|
234
|
-
price && /* @__PURE__ */ jsx2("span", { children: price })
|
|
235
|
-
] })
|
|
236
|
-
]
|
|
237
|
-
}
|
|
238
|
-
);
|
|
239
|
-
}
|
|
240
|
-
function ModelPicker({ value, onChange, models, loading, renderProviderBadge, recommendedLabel = "Recommended", priorityGroup }) {
|
|
241
|
-
const [open, setOpen] = useState2(false);
|
|
242
|
-
const [query, setQuery] = useState2("");
|
|
243
|
-
const { containerRef, triggerProps } = usePopover(open, setOpen);
|
|
244
|
-
const inputRef = useRef2(null);
|
|
245
|
-
useEffect2(() => {
|
|
246
|
-
if (open) inputRef.current?.focus();
|
|
247
|
-
}, [open]);
|
|
248
|
-
const selected = models.find((m) => m.id === value);
|
|
249
|
-
const filtered = useMemo(() => {
|
|
250
|
-
const q = query.trim().toLowerCase();
|
|
251
|
-
if (!q) return null;
|
|
252
|
-
return models.filter(
|
|
253
|
-
(m) => m.id.toLowerCase().includes(q) || m.name.toLowerCase().includes(q) || (m.description?.toLowerCase() ?? "").includes(q) || m.provider.toLowerCase().includes(q)
|
|
254
|
-
);
|
|
255
|
-
}, [models, query]);
|
|
256
|
-
const sections = useMemo(() => {
|
|
257
|
-
const isPriority = priorityGroup ? (m) => priorityGroup.match(m) : () => false;
|
|
258
|
-
const priority = priorityGroup ? models.filter(isPriority) : [];
|
|
259
|
-
const recommended = models.filter((m) => m.featured && !isPriority(m));
|
|
260
|
-
const byProvider = [];
|
|
261
|
-
for (const m of models) {
|
|
262
|
-
if (m.featured || isPriority(m)) continue;
|
|
263
|
-
const last = byProvider[byProvider.length - 1];
|
|
264
|
-
if (last && last.provider === m.provider) last.items.push(m);
|
|
265
|
-
else byProvider.push({ provider: m.provider, items: [m] });
|
|
266
|
-
}
|
|
267
|
-
return { priority, recommended, byProvider };
|
|
268
|
-
}, [models, priorityGroup]);
|
|
269
|
-
const select = (id) => {
|
|
270
|
-
onChange(id);
|
|
271
|
-
setOpen(false);
|
|
272
|
-
setQuery("");
|
|
273
|
-
};
|
|
274
|
-
return /* @__PURE__ */ jsxs2("div", { ref: containerRef, className: "relative inline-flex", children: [
|
|
275
|
-
/* @__PURE__ */ jsxs2(
|
|
276
|
-
"button",
|
|
277
|
-
{
|
|
278
|
-
type: "button",
|
|
279
|
-
...triggerProps,
|
|
280
|
-
onClick: () => setOpen(!open),
|
|
281
|
-
className: "inline-flex items-center gap-1.5 rounded-full border border-border bg-card px-3 py-1.5 text-sm font-medium text-foreground transition hover:bg-accent/30",
|
|
282
|
-
children: [
|
|
283
|
-
selected ? renderProviderBadge ? renderProviderBadge(selected.provider) : /* @__PURE__ */ jsx2(ProviderLogo, { provider: selected.provider, size: 16 }) : /* @__PURE__ */ jsx2(SparkleGlyph, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
284
|
-
/* @__PURE__ */ jsx2("span", { className: "max-w-[160px] truncate", children: selected?.name ?? value }),
|
|
285
|
-
/* @__PURE__ */ jsx2(ChevronDown, { className: "h-3.5 w-3.5 text-muted-foreground" })
|
|
286
|
-
]
|
|
287
|
-
}
|
|
288
|
-
),
|
|
289
|
-
open && /* @__PURE__ */ jsxs2("div", { className: "absolute bottom-full left-0 z-50 mb-2 w-[420px] max-w-[calc(100vw-2rem)] overflow-hidden rounded-xl border border-border bg-card shadow-lg", children: [
|
|
290
|
-
/* @__PURE__ */ jsx2("div", { className: "border-b border-border px-3 py-2", children: /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2 rounded-lg border border-border bg-background px-3 py-2", children: [
|
|
291
|
-
/* @__PURE__ */ jsx2(SearchGlyph, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
292
|
-
/* @__PURE__ */ jsx2(
|
|
293
|
-
"input",
|
|
294
|
-
{
|
|
295
|
-
ref: inputRef,
|
|
296
|
-
type: "text",
|
|
297
|
-
value: query,
|
|
298
|
-
onChange: (e) => setQuery(e.target.value),
|
|
299
|
-
placeholder: "Search models...",
|
|
300
|
-
className: "flex-1 bg-transparent text-sm placeholder:text-muted-foreground"
|
|
301
|
-
}
|
|
302
|
-
)
|
|
303
|
-
] }) }),
|
|
304
|
-
/* @__PURE__ */ jsxs2("div", { className: "max-h-[400px] overflow-y-auto p-1 pb-2", children: [
|
|
305
|
-
loading && /* @__PURE__ */ jsx2("div", { className: "px-3 py-4 text-center text-sm text-muted-foreground", children: "Loading models..." }),
|
|
306
|
-
!loading && filtered && /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
307
|
-
filtered.length === 0 && /* @__PURE__ */ jsx2("div", { className: "px-3 py-4 text-center text-sm text-muted-foreground", children: "No models match your search" }),
|
|
308
|
-
filtered.map((m) => /* @__PURE__ */ jsx2(ModelRow, { model: m, selected: m.id === value, onSelect: () => select(m.id), renderProviderBadge }, m.id))
|
|
309
|
-
] }),
|
|
310
|
-
!loading && !filtered && models.length === 0 && /* @__PURE__ */ jsx2("div", { className: "px-3 py-4 text-center text-sm text-muted-foreground", children: "No models available" }),
|
|
311
|
-
!loading && !filtered && models.length > 0 && /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
312
|
-
priorityGroup && sections.priority.length > 0 && /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
313
|
-
/* @__PURE__ */ jsx2(SectionHeader, { children: priorityGroup.label }),
|
|
314
|
-
sections.priority.map((m) => /* @__PURE__ */ jsx2(ModelRow, { model: m, selected: m.id === value, onSelect: () => select(m.id), renderProviderBadge }, m.id))
|
|
315
|
-
] }),
|
|
316
|
-
sections.recommended.length > 0 && /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
317
|
-
/* @__PURE__ */ jsx2(SectionHeader, { children: recommendedLabel }),
|
|
318
|
-
sections.recommended.map((m) => /* @__PURE__ */ jsx2(ModelRow, { model: m, selected: m.id === value, onSelect: () => select(m.id), renderProviderBadge }, m.id))
|
|
319
|
-
] }),
|
|
320
|
-
sections.byProvider.map((g) => /* @__PURE__ */ jsxs2("div", { children: [
|
|
321
|
-
/* @__PURE__ */ jsx2(SectionHeader, { children: g.provider }),
|
|
322
|
-
g.items.map((m) => /* @__PURE__ */ jsx2(ModelRow, { model: m, selected: m.id === value, onSelect: () => select(m.id), renderProviderBadge }, m.id))
|
|
323
|
-
] }, g.provider))
|
|
324
|
-
] })
|
|
325
|
-
] })
|
|
326
|
-
] })
|
|
327
|
-
] });
|
|
328
|
-
}
|
|
329
|
-
var DEFAULT_EFFORT_LEVELS = [
|
|
330
|
-
{ id: "off", label: "Off" },
|
|
331
|
-
{ id: "low", label: "Quick" },
|
|
332
|
-
{ id: "medium", label: "Standard" },
|
|
333
|
-
{ id: "high", label: "Extended" }
|
|
334
|
-
];
|
|
335
|
-
function EffortPicker({ value, onChange, levels = DEFAULT_EFFORT_LEVELS, label = "Thinking" }) {
|
|
336
|
-
const [open, setOpen] = useState2(false);
|
|
337
|
-
const { containerRef, triggerProps } = usePopover(open, setOpen);
|
|
338
|
-
const selected = levels.find((l) => l.id === value) ?? levels[2] ?? levels[0];
|
|
339
|
-
return /* @__PURE__ */ jsxs2("div", { ref: containerRef, className: "relative inline-flex", children: [
|
|
340
|
-
/* @__PURE__ */ jsxs2(
|
|
341
|
-
"button",
|
|
342
|
-
{
|
|
343
|
-
type: "button",
|
|
344
|
-
...triggerProps,
|
|
345
|
-
onClick: () => setOpen(!open),
|
|
346
|
-
title: label ? `${label} \u2014 how hard the agent reasons before answering` : "Reasoning effort",
|
|
347
|
-
className: "inline-flex min-h-[36px] items-center gap-1.5 rounded-full border border-border bg-card px-3 py-1.5 text-sm font-medium text-foreground transition hover:bg-accent/30",
|
|
348
|
-
children: [
|
|
349
|
-
/* @__PURE__ */ jsx2(SparkleGlyph, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
350
|
-
/* @__PURE__ */ jsxs2("span", { children: [
|
|
351
|
-
label ? /* @__PURE__ */ jsxs2("span", { className: "text-muted-foreground", children: [
|
|
352
|
-
label,
|
|
353
|
-
": "
|
|
354
|
-
] }) : null,
|
|
355
|
-
selected?.label
|
|
356
|
-
] }),
|
|
357
|
-
/* @__PURE__ */ jsx2(ChevronDown, { className: "h-3.5 w-3.5 text-muted-foreground" })
|
|
358
|
-
]
|
|
359
|
-
}
|
|
360
|
-
),
|
|
361
|
-
open && /* @__PURE__ */ jsx2("div", { role: "menu", className: "absolute bottom-full left-0 z-50 mb-2 w-40 overflow-hidden rounded-xl border border-border bg-card p-1 shadow-lg", children: levels.map((l) => /* @__PURE__ */ jsx2(
|
|
362
|
-
"button",
|
|
363
|
-
{
|
|
364
|
-
type: "button",
|
|
365
|
-
role: "menuitemradio",
|
|
366
|
-
"aria-checked": l.id === value,
|
|
367
|
-
onClick: () => {
|
|
368
|
-
onChange(l.id);
|
|
369
|
-
setOpen(false);
|
|
370
|
-
},
|
|
371
|
-
className: `flex min-h-[40px] w-full items-center rounded-md px-3 py-2 text-left text-sm transition ${POPOVER_OPTION_FOCUS} ${l.id === value ? "bg-primary/10 font-medium" : "hover:bg-accent/30"}`,
|
|
372
|
-
children: l.label
|
|
373
|
-
},
|
|
374
|
-
l.id
|
|
375
|
-
)) })
|
|
376
|
-
] });
|
|
377
|
-
}
|
|
378
|
-
|
|
379
82
|
// src/web-react/brand-mark.tsx
|
|
380
83
|
import { lazy, Suspense } from "react";
|
|
381
|
-
import { jsx
|
|
84
|
+
import { jsx } from "react/jsx-runtime";
|
|
382
85
|
function MarkSpacer({ size = 24, className }) {
|
|
383
|
-
return /* @__PURE__ */
|
|
86
|
+
return /* @__PURE__ */ jsx("span", { "aria-hidden": true, style: { display: "inline-block", width: size, height: size }, className });
|
|
384
87
|
}
|
|
385
88
|
var LazyKnot = lazy(async () => {
|
|
386
89
|
try {
|
|
@@ -391,14 +94,14 @@ var LazyKnot = lazy(async () => {
|
|
|
391
94
|
}
|
|
392
95
|
});
|
|
393
96
|
function BrandMark({ size = 24, className }) {
|
|
394
|
-
return /* @__PURE__ */
|
|
97
|
+
return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(MarkSpacer, { size, className }), children: /* @__PURE__ */ jsx(LazyKnot, { size, className }) });
|
|
395
98
|
}
|
|
396
99
|
|
|
397
100
|
// src/web-react/durable-plan-card.tsx
|
|
398
|
-
import { useEffect as
|
|
101
|
+
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
399
102
|
|
|
400
103
|
// src/web-react/interaction-question-card.tsx
|
|
401
|
-
import { useEffect as
|
|
104
|
+
import { useEffect as useEffect2, useMemo, useRef as useRef2, useState as useState2 } from "react";
|
|
402
105
|
|
|
403
106
|
// src/web-react/interaction-card-support.ts
|
|
404
107
|
function interactionStatusLabels(labels) {
|
|
@@ -557,9 +260,9 @@ function createInteractionAnswerSubmitter(options) {
|
|
|
557
260
|
}
|
|
558
261
|
|
|
559
262
|
// src/web-react/interaction-question-card.tsx
|
|
560
|
-
import { Fragment
|
|
263
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
561
264
|
function CheckGlyph({ className }) {
|
|
562
|
-
return /* @__PURE__ */
|
|
265
|
+
return /* @__PURE__ */ jsx2("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx2("path", { d: "M20 6 9 17l-5-5" }) });
|
|
563
266
|
}
|
|
564
267
|
var BADGE_VARIANT_CLASSES = {
|
|
565
268
|
outline: "border-border text-foreground",
|
|
@@ -567,7 +270,7 @@ var BADGE_VARIANT_CLASSES = {
|
|
|
567
270
|
destructive: "border-transparent bg-destructive/15 text-destructive"
|
|
568
271
|
};
|
|
569
272
|
function InteractionBadge({ variant, children }) {
|
|
570
|
-
return /* @__PURE__ */
|
|
273
|
+
return /* @__PURE__ */ jsx2("span", { className: `inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-medium ${BADGE_VARIANT_CLASSES[variant]}`, children });
|
|
571
274
|
}
|
|
572
275
|
function InteractionActionButton({
|
|
573
276
|
variant = "primary",
|
|
@@ -576,7 +279,7 @@ function InteractionActionButton({
|
|
|
576
279
|
children
|
|
577
280
|
}) {
|
|
578
281
|
const variantClasses = variant === "primary" ? "bg-primary text-primary-foreground shadow-sm hover:bg-primary/90" : "border border-border bg-transparent text-foreground hover:bg-accent/40";
|
|
579
|
-
return /* @__PURE__ */
|
|
282
|
+
return /* @__PURE__ */ jsx2(
|
|
580
283
|
"button",
|
|
581
284
|
{
|
|
582
285
|
type: "button",
|
|
@@ -597,11 +300,11 @@ function QuestionOptionList({
|
|
|
597
300
|
disabled,
|
|
598
301
|
onToggle
|
|
599
302
|
}) {
|
|
600
|
-
return /* @__PURE__ */
|
|
303
|
+
return /* @__PURE__ */ jsx2(Fragment, { children: options.map((option, optionIndex) => {
|
|
601
304
|
const inputId = `${idPrefix}-${optionIndex}`;
|
|
602
305
|
const checked = selectedValues.includes(option.value);
|
|
603
|
-
return /* @__PURE__ */
|
|
604
|
-
/* @__PURE__ */
|
|
306
|
+
return /* @__PURE__ */ jsxs("label", { htmlFor: inputId, className: "flex cursor-pointer gap-2 rounded-lg border border-border/70 p-3 transition-colors hover:bg-muted/50", children: [
|
|
307
|
+
/* @__PURE__ */ jsx2(
|
|
605
308
|
"input",
|
|
606
309
|
{
|
|
607
310
|
id: inputId,
|
|
@@ -616,9 +319,9 @@ function QuestionOptionList({
|
|
|
616
319
|
className: "mt-0.5 h-4 w-4 shrink-0 accent-primary"
|
|
617
320
|
}
|
|
618
321
|
),
|
|
619
|
-
/* @__PURE__ */
|
|
620
|
-
/* @__PURE__ */
|
|
621
|
-
option.description && /* @__PURE__ */
|
|
322
|
+
/* @__PURE__ */ jsxs("span", { className: "min-w-0", children: [
|
|
323
|
+
/* @__PURE__ */ jsx2("span", { id: `${inputId}-label`, className: "block text-sm font-medium leading-5 text-foreground", children: option.label }),
|
|
324
|
+
option.description && /* @__PURE__ */ jsx2("span", { id: `${inputId}-description`, className: "mt-0.5 block text-xs leading-5 text-muted-foreground", children: option.description })
|
|
622
325
|
] })
|
|
623
326
|
] }, `${option.value}-${optionIndex}`);
|
|
624
327
|
}) });
|
|
@@ -662,13 +365,13 @@ function InteractionQuestionCard({
|
|
|
662
365
|
renderMarkdown,
|
|
663
366
|
className
|
|
664
367
|
}) {
|
|
665
|
-
const [values, setValues] =
|
|
666
|
-
const [submitting, setSubmitting] =
|
|
667
|
-
const [localStatus, setLocalStatus] =
|
|
668
|
-
const [lateAnswerSent, setLateAnswerSent] =
|
|
669
|
-
const [error, setError] =
|
|
670
|
-
const submitInFlightRef =
|
|
671
|
-
const [askId, setAskId] =
|
|
368
|
+
const [values, setValues] = useState2(() => fieldValuesFromAnswers(interaction.fields, interaction.answers));
|
|
369
|
+
const [submitting, setSubmitting] = useState2(false);
|
|
370
|
+
const [localStatus, setLocalStatus] = useState2(null);
|
|
371
|
+
const [lateAnswerSent, setLateAnswerSent] = useState2(false);
|
|
372
|
+
const [error, setError] = useState2(null);
|
|
373
|
+
const submitInFlightRef = useRef2(false);
|
|
374
|
+
const [askId, setAskId] = useState2(interaction.id);
|
|
672
375
|
if (askId !== interaction.id) {
|
|
673
376
|
setAskId(interaction.id);
|
|
674
377
|
setValues(fieldValuesFromAnswers(interaction.fields, interaction.answers));
|
|
@@ -676,7 +379,7 @@ function InteractionQuestionCard({
|
|
|
676
379
|
setLateAnswerSent(false);
|
|
677
380
|
setError(null);
|
|
678
381
|
}
|
|
679
|
-
|
|
382
|
+
useEffect2(() => {
|
|
680
383
|
if (!interaction.answers) return;
|
|
681
384
|
setValues(fieldValuesFromAnswers(interaction.fields, interaction.answers));
|
|
682
385
|
}, [interaction.answers, interaction.fields]);
|
|
@@ -686,7 +389,7 @@ function InteractionQuestionCard({
|
|
|
686
389
|
const secretLateAnswerBlocked = lateAnswerable && hasSecretField(interaction.fields);
|
|
687
390
|
const canLateAnswer = canWrite && lateAnswerable && !lateAnswerSent && !secretLateAnswerBlocked;
|
|
688
391
|
const disabled = !canWrite || status !== "pending" && !canLateAnswer || submitting;
|
|
689
|
-
const answerData =
|
|
392
|
+
const answerData = useMemo(() => buildAnswerData(interaction.fields, values), [interaction.fields, values]);
|
|
690
393
|
const setFieldValue = (name, patch) => {
|
|
691
394
|
setValues((prev) => ({ ...prev, [name]: { ...prev[name], ...patch } }));
|
|
692
395
|
};
|
|
@@ -753,24 +456,24 @@ function InteractionQuestionCard({
|
|
|
753
456
|
} else if (submitting) {
|
|
754
457
|
submitLabel = "Submitting\u2026";
|
|
755
458
|
}
|
|
756
|
-
return /* @__PURE__ */
|
|
757
|
-
/* @__PURE__ */
|
|
758
|
-
/* @__PURE__ */
|
|
759
|
-
/* @__PURE__ */
|
|
760
|
-
/* @__PURE__ */
|
|
459
|
+
return /* @__PURE__ */ jsxs("div", { className: `rounded-xl border border-border bg-card p-4 shadow-sm ${className ?? ""}`, children: [
|
|
460
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-3 flex flex-wrap items-center justify-between gap-2", children: [
|
|
461
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
462
|
+
/* @__PURE__ */ jsx2(InteractionBadge, { variant: "outline", children: kindLabel ?? "Question" }),
|
|
463
|
+
/* @__PURE__ */ jsx2(InteractionBadge, { variant: answered ? "default" : status === "expired" || status === "declined" ? "destructive" : "outline", children: STATUS_LABELS[status] })
|
|
761
464
|
] }),
|
|
762
|
-
/* @__PURE__ */
|
|
465
|
+
/* @__PURE__ */ jsx2("span", { className: "text-xs text-muted-foreground", children: sourceNote ?? "The agent asked for input" })
|
|
763
466
|
] }),
|
|
764
|
-
interaction.title.trim() && interaction.fields.every((field) => field.label !== interaction.title) && /* @__PURE__ */
|
|
765
|
-
interaction.body && (renderMarkdown ? /* @__PURE__ */
|
|
766
|
-
/* @__PURE__ */
|
|
467
|
+
interaction.title.trim() && interaction.fields.every((field) => field.label !== interaction.title) && /* @__PURE__ */ jsx2("p", { className: "mb-3 text-sm font-medium leading-5 text-foreground", children: interaction.title }),
|
|
468
|
+
interaction.body && (renderMarkdown ? /* @__PURE__ */ jsx2("div", { className: "mb-3 text-sm leading-5 text-muted-foreground", children: renderMarkdown(interaction.body) }) : /* @__PURE__ */ jsx2("p", { className: "mb-3 text-sm leading-5 text-muted-foreground", children: interaction.body })),
|
|
469
|
+
/* @__PURE__ */ jsx2("div", { className: "space-y-4", children: interaction.fields.map((field) => {
|
|
767
470
|
const value = values[field.name] ?? {};
|
|
768
471
|
const select = selectField(field);
|
|
769
472
|
const freeText = freeTextField(field);
|
|
770
|
-
return /* @__PURE__ */
|
|
771
|
-
/* @__PURE__ */
|
|
772
|
-
select ? /* @__PURE__ */
|
|
773
|
-
/* @__PURE__ */
|
|
473
|
+
return /* @__PURE__ */ jsxs("fieldset", { className: "space-y-2", children: [
|
|
474
|
+
/* @__PURE__ */ jsx2("p", { className: "text-sm font-medium leading-5 text-foreground", children: field.label }),
|
|
475
|
+
select ? /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
476
|
+
/* @__PURE__ */ jsx2(
|
|
774
477
|
QuestionOptionList,
|
|
775
478
|
{
|
|
776
479
|
groupName: `${interaction.id}-${field.name}`,
|
|
@@ -782,7 +485,7 @@ function InteractionQuestionCard({
|
|
|
782
485
|
onToggle: (optionValue) => toggleSelected(select, optionValue)
|
|
783
486
|
}
|
|
784
487
|
),
|
|
785
|
-
select.allowCustom === true && /* @__PURE__ */
|
|
488
|
+
select.allowCustom === true && /* @__PURE__ */ jsx2(
|
|
786
489
|
"input",
|
|
787
490
|
{
|
|
788
491
|
type: "text",
|
|
@@ -794,8 +497,8 @@ function InteractionQuestionCard({
|
|
|
794
497
|
className: FIELD_INPUT_CLASSES
|
|
795
498
|
}
|
|
796
499
|
)
|
|
797
|
-
] }) : field.type === "boolean" ? /* @__PURE__ */
|
|
798
|
-
/* @__PURE__ */
|
|
500
|
+
] }) : field.type === "boolean" ? /* @__PURE__ */ jsx2("div", { className: "flex gap-4", children: ["true", "false"].map((boolValue) => /* @__PURE__ */ jsxs("label", { className: "flex cursor-pointer items-center gap-2 text-sm text-foreground", children: [
|
|
501
|
+
/* @__PURE__ */ jsx2(
|
|
799
502
|
"input",
|
|
800
503
|
{
|
|
801
504
|
type: "radio",
|
|
@@ -808,7 +511,7 @@ function InteractionQuestionCard({
|
|
|
808
511
|
}
|
|
809
512
|
),
|
|
810
513
|
boolValue === "true" ? "Yes" : "No"
|
|
811
|
-
] }, boolValue)) }) : field.type === "number" ? /* @__PURE__ */
|
|
514
|
+
] }, boolValue)) }) : field.type === "number" ? /* @__PURE__ */ jsx2(
|
|
812
515
|
"input",
|
|
813
516
|
{
|
|
814
517
|
type: "number",
|
|
@@ -818,7 +521,7 @@ function InteractionQuestionCard({
|
|
|
818
521
|
onChange: (event) => setFieldValue(field.name, { text: event.target.value }),
|
|
819
522
|
className: FIELD_INPUT_CLASSES
|
|
820
523
|
}
|
|
821
|
-
) : field.type === "secret" ? /* @__PURE__ */
|
|
524
|
+
) : field.type === "secret" ? /* @__PURE__ */ jsx2(
|
|
822
525
|
"input",
|
|
823
526
|
{
|
|
824
527
|
type: "password",
|
|
@@ -830,7 +533,7 @@ function InteractionQuestionCard({
|
|
|
830
533
|
maxLength: freeText ? textFieldMaxLength(freeText) : void 0,
|
|
831
534
|
className: FIELD_INPUT_CLASSES
|
|
832
535
|
}
|
|
833
|
-
) : /* @__PURE__ */
|
|
536
|
+
) : /* @__PURE__ */ jsx2(
|
|
834
537
|
"textarea",
|
|
835
538
|
{
|
|
836
539
|
value: value.text ?? "",
|
|
@@ -845,25 +548,25 @@ function InteractionQuestionCard({
|
|
|
845
548
|
)
|
|
846
549
|
] }, field.name);
|
|
847
550
|
}) }),
|
|
848
|
-
error && /* @__PURE__ */
|
|
849
|
-
terminalNote && /* @__PURE__ */
|
|
850
|
-
(showSubmitButton || showTimeoutNote) && /* @__PURE__ */
|
|
851
|
-
showTimeoutNote && /* @__PURE__ */
|
|
852
|
-
showSubmitButton && /* @__PURE__ */
|
|
551
|
+
error && /* @__PURE__ */ jsx2("p", { role: "alert", className: "mt-3 text-xs text-destructive", children: error }),
|
|
552
|
+
terminalNote && /* @__PURE__ */ jsx2("p", { className: "mt-3 text-xs text-muted-foreground", children: terminalNote }),
|
|
553
|
+
(showSubmitButton || showTimeoutNote) && /* @__PURE__ */ jsxs("div", { className: "mt-4 flex flex-wrap items-center justify-end gap-2", children: [
|
|
554
|
+
showTimeoutNote && /* @__PURE__ */ jsx2("div", { className: "mr-auto text-xs text-muted-foreground", children: timeoutNote }),
|
|
555
|
+
showSubmitButton && /* @__PURE__ */ jsx2(InteractionActionButton, { onClick: () => void submit(), disabled: disabled || !answerData, children: submitLabel })
|
|
853
556
|
] }),
|
|
854
|
-
answered && /* @__PURE__ */
|
|
855
|
-
/* @__PURE__ */
|
|
557
|
+
answered && /* @__PURE__ */ jsx2("div", { className: "mt-4 flex items-center justify-end", children: /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1 text-xs text-muted-foreground", children: [
|
|
558
|
+
/* @__PURE__ */ jsx2(CheckGlyph, { className: "h-3 w-3" }),
|
|
856
559
|
"Answered"
|
|
857
560
|
] }) }),
|
|
858
|
-
lateAnswerSent && /* @__PURE__ */
|
|
859
|
-
/* @__PURE__ */
|
|
561
|
+
lateAnswerSent && /* @__PURE__ */ jsx2("div", { className: "mt-4 flex items-center justify-end", children: /* @__PURE__ */ jsxs("span", { className: "inline-flex items-center gap-1 text-xs text-muted-foreground", children: [
|
|
562
|
+
/* @__PURE__ */ jsx2(CheckGlyph, { className: "h-3 w-3" }),
|
|
860
563
|
"Sent as new message"
|
|
861
564
|
] }) })
|
|
862
565
|
] });
|
|
863
566
|
}
|
|
864
567
|
|
|
865
568
|
// src/web-react/durable-plan-card.tsx
|
|
866
|
-
import { jsx as
|
|
569
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
867
570
|
function statusLabel(plan) {
|
|
868
571
|
switch (plan.status) {
|
|
869
572
|
case "pending":
|
|
@@ -889,10 +592,10 @@ function DurablePlanCard({
|
|
|
889
592
|
renderMarkdown,
|
|
890
593
|
className
|
|
891
594
|
}) {
|
|
892
|
-
const [feedback, setFeedback] =
|
|
893
|
-
const [expanded, setExpanded] =
|
|
894
|
-
const [localError, setLocalError] =
|
|
895
|
-
|
|
595
|
+
const [feedback, setFeedback] = useState3("");
|
|
596
|
+
const [expanded, setExpanded] = useState3(false);
|
|
597
|
+
const [localError, setLocalError] = useState3(null);
|
|
598
|
+
useEffect3(() => setLocalError(null), [plan.planId, plan.revision, plan.status]);
|
|
896
599
|
const actionable = plan.status === "pending";
|
|
897
600
|
const disabled = !canWrite || !actionable || deciding !== null;
|
|
898
601
|
async function submit(decision) {
|
|
@@ -904,22 +607,22 @@ function DurablePlanCard({
|
|
|
904
607
|
setLocalError(null);
|
|
905
608
|
await decide(decision, decision === "rejected" ? trimmed : void 0);
|
|
906
609
|
}
|
|
907
|
-
return /* @__PURE__ */
|
|
908
|
-
/* @__PURE__ */
|
|
909
|
-
/* @__PURE__ */
|
|
910
|
-
/* @__PURE__ */
|
|
911
|
-
/* @__PURE__ */
|
|
610
|
+
return /* @__PURE__ */ jsxs2("div", { className: `rounded-xl border border-primary/40 bg-card p-4 shadow-sm ${className ?? ""}`, children: [
|
|
611
|
+
/* @__PURE__ */ jsxs2("div", { className: "mb-3 flex flex-wrap items-center justify-between gap-2", children: [
|
|
612
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
613
|
+
/* @__PURE__ */ jsx3(InteractionBadge, { variant: "outline", children: "Plan decision" }),
|
|
614
|
+
/* @__PURE__ */ jsx3(InteractionBadge, { variant: plan.status === "approved" ? "default" : plan.status === "rejected" || plan.status === "withdrawn" ? "destructive" : "outline", children: statusLabel(plan) })
|
|
912
615
|
] }),
|
|
913
|
-
/* @__PURE__ */
|
|
616
|
+
/* @__PURE__ */ jsxs2("span", { className: "text-xs text-muted-foreground", children: [
|
|
914
617
|
"Revision ",
|
|
915
618
|
plan.revision
|
|
916
619
|
] })
|
|
917
620
|
] }),
|
|
918
|
-
plan.title && /* @__PURE__ */
|
|
919
|
-
/* @__PURE__ */
|
|
920
|
-
/* @__PURE__ */
|
|
921
|
-
!expanded && /* @__PURE__ */
|
|
922
|
-
/* @__PURE__ */
|
|
621
|
+
plan.title && /* @__PURE__ */ jsx3("p", { className: "mb-3 text-sm font-medium leading-5 text-foreground", children: plan.title }),
|
|
622
|
+
/* @__PURE__ */ jsxs2("div", { className: "relative", children: [
|
|
623
|
+
/* @__PURE__ */ jsx3("div", { className: "overflow-hidden text-sm", style: expanded ? void 0 : { maxHeight: 320 }, children: renderMarkdown ? renderMarkdown(plan.body) : /* @__PURE__ */ jsx3("p", { className: "whitespace-pre-wrap leading-5", children: plan.body }) }),
|
|
624
|
+
!expanded && /* @__PURE__ */ jsx3("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-card to-transparent" }),
|
|
625
|
+
/* @__PURE__ */ jsx3(
|
|
923
626
|
"button",
|
|
924
627
|
{
|
|
925
628
|
type: "button",
|
|
@@ -929,9 +632,9 @@ function DurablePlanCard({
|
|
|
929
632
|
}
|
|
930
633
|
)
|
|
931
634
|
] }),
|
|
932
|
-
actionable && /* @__PURE__ */
|
|
933
|
-
/* @__PURE__ */
|
|
934
|
-
/* @__PURE__ */
|
|
635
|
+
actionable && /* @__PURE__ */ jsxs2("div", { className: "mt-3 space-y-2", children: [
|
|
636
|
+
/* @__PURE__ */ jsx3("label", { className: "block text-sm font-medium leading-5 text-foreground", htmlFor: `durable-plan-feedback-${plan.planId}-${plan.revision}`, children: "Feedback for requested changes" }),
|
|
637
|
+
/* @__PURE__ */ jsx3(
|
|
935
638
|
"textarea",
|
|
936
639
|
{
|
|
937
640
|
id: `durable-plan-feedback-${plan.planId}-${plan.revision}`,
|
|
@@ -944,22 +647,22 @@ function DurablePlanCard({
|
|
|
944
647
|
}
|
|
945
648
|
)
|
|
946
649
|
] }),
|
|
947
|
-
(localError ?? error) && /* @__PURE__ */
|
|
948
|
-
actionable && /* @__PURE__ */
|
|
949
|
-
/* @__PURE__ */
|
|
950
|
-
/* @__PURE__ */
|
|
650
|
+
(localError ?? error) && /* @__PURE__ */ jsx3("p", { className: "mt-3 text-xs text-destructive", children: localError ?? error }),
|
|
651
|
+
actionable && /* @__PURE__ */ jsxs2("div", { className: "mt-4 flex items-center justify-end gap-2", children: [
|
|
652
|
+
/* @__PURE__ */ jsx3(InteractionActionButton, { variant: "outline", onClick: () => void submit("rejected"), disabled, children: deciding === "rejected" ? "Sending\u2026" : "Request changes" }),
|
|
653
|
+
/* @__PURE__ */ jsx3(InteractionActionButton, { onClick: () => void submit("approved"), disabled, children: deciding === "approved" ? "Approving\u2026" : "Approve plan" })
|
|
951
654
|
] })
|
|
952
655
|
] });
|
|
953
656
|
}
|
|
954
657
|
|
|
955
658
|
// src/web-react/interaction-plan-card.tsx
|
|
956
|
-
import { useMemo as
|
|
957
|
-
import { jsx as
|
|
659
|
+
import { useMemo as useMemo2, useRef as useRef3, useState as useState4 } from "react";
|
|
660
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
958
661
|
function CheckGlyph2({ className }) {
|
|
959
|
-
return /* @__PURE__ */
|
|
662
|
+
return /* @__PURE__ */ jsx4("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx4("path", { d: "M20 6 9 17l-5-5" }) });
|
|
960
663
|
}
|
|
961
664
|
function ChevronDownGlyph({ className }) {
|
|
962
|
-
return /* @__PURE__ */
|
|
665
|
+
return /* @__PURE__ */ jsx4("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx4("path", { d: "m6 9 6 6 6-6" }) });
|
|
963
666
|
}
|
|
964
667
|
var STATUS_LABELS2 = interactionStatusLabels({
|
|
965
668
|
pending: "Waiting for your approval",
|
|
@@ -981,19 +684,19 @@ function InteractionPlanCard({
|
|
|
981
684
|
renderMarkdown,
|
|
982
685
|
className
|
|
983
686
|
}) {
|
|
984
|
-
const [values, setValues] =
|
|
985
|
-
const [expanded, setExpanded] =
|
|
986
|
-
const [submitting, setSubmitting] =
|
|
987
|
-
const [localStatus, setLocalStatus] =
|
|
988
|
-
const [reRequested, setReRequested] =
|
|
989
|
-
const [error, setError] =
|
|
990
|
-
const submitInFlightRef =
|
|
687
|
+
const [values, setValues] = useState4({});
|
|
688
|
+
const [expanded, setExpanded] = useState4(false);
|
|
689
|
+
const [submitting, setSubmitting] = useState4(null);
|
|
690
|
+
const [localStatus, setLocalStatus] = useState4(null);
|
|
691
|
+
const [reRequested, setReRequested] = useState4(false);
|
|
692
|
+
const [error, setError] = useState4(null);
|
|
693
|
+
const submitInFlightRef = useRef3(false);
|
|
991
694
|
const status = isTerminalInteractionStatus(interaction.status) ? interaction.status : localStatus ?? interaction.status;
|
|
992
695
|
const reRequestable = isLateAnswerableStatus(status) && onReRequest !== void 0;
|
|
993
696
|
const canReRequest = canWrite && reRequestable && !reRequested;
|
|
994
697
|
const disabled = !canWrite || status !== "pending" || submitting !== null;
|
|
995
|
-
const approveData =
|
|
996
|
-
const rejectData =
|
|
698
|
+
const approveData = useMemo2(() => buildAnswerData(interaction.fields, values), [interaction.fields, values]);
|
|
699
|
+
const rejectData = useMemo2(() => {
|
|
997
700
|
const data = {};
|
|
998
701
|
for (const field of interaction.fields) {
|
|
999
702
|
const answer = fieldAnswer(field, values);
|
|
@@ -1048,41 +751,41 @@ function InteractionPlanCard({
|
|
|
1048
751
|
}
|
|
1049
752
|
const terminalNote = TERMINAL_NOTES2[status];
|
|
1050
753
|
const approved = status === "answered";
|
|
1051
|
-
return /* @__PURE__ */
|
|
1052
|
-
/* @__PURE__ */
|
|
1053
|
-
/* @__PURE__ */
|
|
1054
|
-
/* @__PURE__ */
|
|
1055
|
-
/* @__PURE__ */
|
|
754
|
+
return /* @__PURE__ */ jsxs3("div", { className: `rounded-xl border border-border bg-card p-4 shadow-sm ${className ?? ""}`, children: [
|
|
755
|
+
/* @__PURE__ */ jsxs3("div", { className: "mb-3 flex flex-wrap items-center justify-between gap-2", children: [
|
|
756
|
+
/* @__PURE__ */ jsxs3("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
757
|
+
/* @__PURE__ */ jsx4(InteractionBadge, { variant: "outline", children: "Plan" }),
|
|
758
|
+
/* @__PURE__ */ jsx4(InteractionBadge, { variant: approved ? "default" : status === "expired" || status === "declined" ? "destructive" : "outline", children: STATUS_LABELS2[status] })
|
|
1056
759
|
] }),
|
|
1057
|
-
/* @__PURE__ */
|
|
760
|
+
/* @__PURE__ */ jsx4("span", { className: "text-xs text-muted-foreground", children: "The agent proposed a plan" })
|
|
1058
761
|
] }),
|
|
1059
|
-
interaction.title.trim() && /* @__PURE__ */
|
|
1060
|
-
interaction.body && /* @__PURE__ */
|
|
1061
|
-
/* @__PURE__ */
|
|
762
|
+
interaction.title.trim() && /* @__PURE__ */ jsx4("p", { className: "mb-3 text-sm font-medium leading-5 text-foreground", children: interaction.title }),
|
|
763
|
+
interaction.body && /* @__PURE__ */ jsxs3("div", { className: "relative", children: [
|
|
764
|
+
/* @__PURE__ */ jsx4(
|
|
1062
765
|
"div",
|
|
1063
766
|
{
|
|
1064
767
|
className: "overflow-hidden text-sm text-foreground",
|
|
1065
768
|
style: expanded ? void 0 : { maxHeight: COLLAPSED_MAX_HEIGHT },
|
|
1066
|
-
children: renderMarkdown ? renderMarkdown(interaction.body) : /* @__PURE__ */
|
|
769
|
+
children: renderMarkdown ? renderMarkdown(interaction.body) : /* @__PURE__ */ jsx4("p", { className: "whitespace-pre-wrap leading-5", children: interaction.body })
|
|
1067
770
|
}
|
|
1068
771
|
),
|
|
1069
|
-
!expanded && /* @__PURE__ */
|
|
1070
|
-
/* @__PURE__ */
|
|
772
|
+
!expanded && /* @__PURE__ */ jsx4("div", { className: "pointer-events-none absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-card to-transparent" }),
|
|
773
|
+
/* @__PURE__ */ jsxs3(
|
|
1071
774
|
"button",
|
|
1072
775
|
{
|
|
1073
776
|
type: "button",
|
|
1074
777
|
onClick: () => setExpanded((prev) => !prev),
|
|
1075
778
|
className: "mt-1 inline-flex items-center gap-1 text-xs text-muted-foreground transition hover:text-foreground",
|
|
1076
779
|
children: [
|
|
1077
|
-
/* @__PURE__ */
|
|
780
|
+
/* @__PURE__ */ jsx4(ChevronDownGlyph, { className: `h-3 w-3 transition-transform ${expanded ? "rotate-180" : ""}` }),
|
|
1078
781
|
expanded ? "Collapse plan" : "Show full plan"
|
|
1079
782
|
]
|
|
1080
783
|
}
|
|
1081
784
|
)
|
|
1082
785
|
] }),
|
|
1083
|
-
interaction.fields.length > 0 && /* @__PURE__ */
|
|
1084
|
-
/* @__PURE__ */
|
|
1085
|
-
fieldAcceptsFreeText(field) ? /* @__PURE__ */
|
|
786
|
+
interaction.fields.length > 0 && /* @__PURE__ */ jsx4("div", { className: "mt-3 space-y-4", children: interaction.fields.map((field) => /* @__PURE__ */ jsxs3("fieldset", { className: "space-y-2", children: [
|
|
787
|
+
/* @__PURE__ */ jsx4("p", { className: "text-sm font-medium leading-5 text-foreground", children: field.label }),
|
|
788
|
+
fieldAcceptsFreeText(field) ? /* @__PURE__ */ jsx4(
|
|
1086
789
|
"textarea",
|
|
1087
790
|
{
|
|
1088
791
|
value: values[field.name]?.text ?? "",
|
|
@@ -1093,7 +796,7 @@ function InteractionPlanCard({
|
|
|
1093
796
|
placeholder: field.type === "text" ? field.placeholder ?? "Optional feedback for the agent" : void 0,
|
|
1094
797
|
className: "w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground focus:border-primary disabled:opacity-50"
|
|
1095
798
|
}
|
|
1096
|
-
) : /* @__PURE__ */
|
|
799
|
+
) : /* @__PURE__ */ jsx4(
|
|
1097
800
|
"input",
|
|
1098
801
|
{
|
|
1099
802
|
type: "text",
|
|
@@ -1105,26 +808,26 @@ function InteractionPlanCard({
|
|
|
1105
808
|
}
|
|
1106
809
|
)
|
|
1107
810
|
] }, field.name)) }),
|
|
1108
|
-
error && /* @__PURE__ */
|
|
1109
|
-
terminalNote && /* @__PURE__ */
|
|
1110
|
-
canReRequest && /* @__PURE__ */
|
|
1111
|
-
reRequested && /* @__PURE__ */
|
|
1112
|
-
/* @__PURE__ */
|
|
811
|
+
error && /* @__PURE__ */ jsx4("p", { className: "mt-3 text-xs text-destructive", children: error }),
|
|
812
|
+
terminalNote && /* @__PURE__ */ jsx4("p", { className: "mt-3 text-xs text-muted-foreground", children: terminalNote }),
|
|
813
|
+
canReRequest && /* @__PURE__ */ jsx4("div", { className: "mt-4 flex items-center justify-end", children: /* @__PURE__ */ jsx4(InteractionActionButton, { variant: "outline", onClick: () => void requestReSubmission(), disabled: submitting !== null, children: submitting === "requesting" ? "Asking\u2026" : reRequestLabel ?? DEFAULT_RE_REQUEST_LABEL }) }),
|
|
814
|
+
reRequested && /* @__PURE__ */ jsx4("div", { className: "mt-4 flex items-center justify-end", children: /* @__PURE__ */ jsxs3("span", { className: "inline-flex items-center gap-1 text-xs text-muted-foreground", children: [
|
|
815
|
+
/* @__PURE__ */ jsx4(CheckGlyph2, { className: "h-3 w-3" }),
|
|
1113
816
|
"Re-submission requested"
|
|
1114
817
|
] }) }),
|
|
1115
|
-
status === "pending" && /* @__PURE__ */
|
|
1116
|
-
/* @__PURE__ */
|
|
1117
|
-
/* @__PURE__ */
|
|
818
|
+
status === "pending" && /* @__PURE__ */ jsxs3("div", { className: "mt-4 flex items-center justify-end gap-2", children: [
|
|
819
|
+
/* @__PURE__ */ jsx4(InteractionActionButton, { variant: "outline", onClick: () => void submit("declined"), disabled, children: submitting === "reject" ? "Sending\u2026" : "Request changes" }),
|
|
820
|
+
/* @__PURE__ */ jsx4(InteractionActionButton, { onClick: () => void submit("accepted"), disabled: disabled || approveData === null, children: submitting === "approve" ? "Approving\u2026" : "Approve plan" })
|
|
1118
821
|
] }),
|
|
1119
|
-
approved && /* @__PURE__ */
|
|
1120
|
-
/* @__PURE__ */
|
|
822
|
+
approved && /* @__PURE__ */ jsx4("div", { className: "mt-4 flex items-center justify-end", children: /* @__PURE__ */ jsxs3("span", { className: "inline-flex items-center gap-1 text-xs text-muted-foreground", children: [
|
|
823
|
+
/* @__PURE__ */ jsx4(CheckGlyph2, { className: "h-3 w-3" }),
|
|
1121
824
|
"Approved"
|
|
1122
825
|
] }) })
|
|
1123
826
|
] });
|
|
1124
827
|
}
|
|
1125
828
|
|
|
1126
829
|
// src/web-react/durable-chat-cards.tsx
|
|
1127
|
-
import { jsx as
|
|
830
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
1128
831
|
function planIdentity(planId, revision) {
|
|
1129
832
|
return `${planId}:${revision}`;
|
|
1130
833
|
}
|
|
@@ -1165,9 +868,9 @@ function DurableChatCards({
|
|
|
1165
868
|
}) {
|
|
1166
869
|
const cards = durableChatCardsFromParts(parts);
|
|
1167
870
|
if (cards.length === 0) return null;
|
|
1168
|
-
return /* @__PURE__ */
|
|
871
|
+
return /* @__PURE__ */ jsx5("div", { className: `space-y-3 ${className ?? ""}`, children: cards.map((card) => {
|
|
1169
872
|
if (card.kind === "plan") {
|
|
1170
|
-
return /* @__PURE__ */
|
|
873
|
+
return /* @__PURE__ */ jsx5(
|
|
1171
874
|
DurablePlanCard,
|
|
1172
875
|
{
|
|
1173
876
|
plan: card.plan,
|
|
@@ -1181,7 +884,7 @@ function DurableChatCards({
|
|
|
1181
884
|
);
|
|
1182
885
|
}
|
|
1183
886
|
if (card.interaction.kind === "plan") {
|
|
1184
|
-
return /* @__PURE__ */
|
|
887
|
+
return /* @__PURE__ */ jsx5(
|
|
1185
888
|
InteractionPlanCard,
|
|
1186
889
|
{
|
|
1187
890
|
interaction: card.interaction,
|
|
@@ -1195,7 +898,7 @@ function DurableChatCards({
|
|
|
1195
898
|
card.key
|
|
1196
899
|
);
|
|
1197
900
|
}
|
|
1198
|
-
return /* @__PURE__ */
|
|
901
|
+
return /* @__PURE__ */ jsx5(
|
|
1199
902
|
InteractionQuestionCard,
|
|
1200
903
|
{
|
|
1201
904
|
interaction: card.interaction,
|
|
@@ -1210,23 +913,23 @@ function DurableChatCards({
|
|
|
1210
913
|
}
|
|
1211
914
|
|
|
1212
915
|
// src/web-react/message-attachments.tsx
|
|
1213
|
-
import { useCallback, useEffect as
|
|
1214
|
-
import { jsx as
|
|
916
|
+
import { useCallback, useEffect as useEffect4, useState as useState5 } from "react";
|
|
917
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1215
918
|
function FileGlyph({ className }) {
|
|
1216
|
-
return /* @__PURE__ */
|
|
1217
|
-
/* @__PURE__ */
|
|
1218
|
-
/* @__PURE__ */
|
|
919
|
+
return /* @__PURE__ */ jsxs4("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
920
|
+
/* @__PURE__ */ jsx6("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
921
|
+
/* @__PURE__ */ jsx6("path", { d: "M14 2v6h6" })
|
|
1219
922
|
] });
|
|
1220
923
|
}
|
|
1221
924
|
function ImageGlyph({ className }) {
|
|
1222
|
-
return /* @__PURE__ */
|
|
1223
|
-
/* @__PURE__ */
|
|
1224
|
-
/* @__PURE__ */
|
|
1225
|
-
/* @__PURE__ */
|
|
925
|
+
return /* @__PURE__ */ jsxs4("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
926
|
+
/* @__PURE__ */ jsx6("rect", { x: "3", y: "3", width: "18", height: "18", rx: "2" }),
|
|
927
|
+
/* @__PURE__ */ jsx6("circle", { cx: "9", cy: "9", r: "2" }),
|
|
928
|
+
/* @__PURE__ */ jsx6("path", { d: "m21 15-5-5L5 21" })
|
|
1226
929
|
] });
|
|
1227
930
|
}
|
|
1228
931
|
function WarningGlyph({ className }) {
|
|
1229
|
-
return /* @__PURE__ */
|
|
932
|
+
return /* @__PURE__ */ jsx6("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx6("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" }) });
|
|
1230
933
|
}
|
|
1231
934
|
function iconForMediaType(mediaType) {
|
|
1232
935
|
return mediaType?.startsWith("image/") ? ImageGlyph : FileGlyph;
|
|
@@ -1273,8 +976,8 @@ function triggerAttachmentDownload(name, blob) {
|
|
|
1273
976
|
}
|
|
1274
977
|
}
|
|
1275
978
|
function useAttachmentObjectUrl(blob) {
|
|
1276
|
-
const [url, setUrl] =
|
|
1277
|
-
|
|
979
|
+
const [url, setUrl] = useState5(null);
|
|
980
|
+
useEffect4(() => {
|
|
1278
981
|
if (!blob) {
|
|
1279
982
|
setUrl(null);
|
|
1280
983
|
return;
|
|
@@ -1286,15 +989,15 @@ function useAttachmentObjectUrl(blob) {
|
|
|
1286
989
|
return url;
|
|
1287
990
|
}
|
|
1288
991
|
function AttachmentThumbnailError({ name }) {
|
|
1289
|
-
return /* @__PURE__ */
|
|
1290
|
-
/* @__PURE__ */
|
|
1291
|
-
/* @__PURE__ */
|
|
992
|
+
return /* @__PURE__ */ jsxs4("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: [
|
|
993
|
+
/* @__PURE__ */ jsx6(WarningGlyph, { className: "h-4 w-4 shrink-0" }),
|
|
994
|
+
/* @__PURE__ */ jsx6("span", { className: "line-clamp-2 text-[10px] leading-tight", children: name })
|
|
1292
995
|
] });
|
|
1293
996
|
}
|
|
1294
997
|
function AttachmentThumbnail({ part, resolveFileUrl, fetchFile }) {
|
|
1295
998
|
const url = resolveFileUrl(part);
|
|
1296
|
-
const [result, setResult] =
|
|
1297
|
-
|
|
999
|
+
const [result, setResult] = useState5(null);
|
|
1000
|
+
useEffect4(() => {
|
|
1298
1001
|
let cancelled = false;
|
|
1299
1002
|
setResult(null);
|
|
1300
1003
|
loadAttachmentFile(url, fetchFile).then((next) => {
|
|
@@ -1310,25 +1013,25 @@ function AttachmentThumbnail({ part, resolveFileUrl, fetchFile }) {
|
|
|
1310
1013
|
window.open(objectUrl, "_blank", "noopener");
|
|
1311
1014
|
}, [objectUrl]);
|
|
1312
1015
|
if (!result) {
|
|
1313
|
-
return /* @__PURE__ */
|
|
1016
|
+
return /* @__PURE__ */ jsx6("span", { "aria-hidden": "true", className: "inline-block h-16 w-16 shrink-0 animate-pulse rounded-md bg-muted" });
|
|
1314
1017
|
}
|
|
1315
1018
|
if (!result.ok || !objectUrl) {
|
|
1316
|
-
return /* @__PURE__ */
|
|
1019
|
+
return /* @__PURE__ */ jsx6(AttachmentThumbnailError, { name: part.name });
|
|
1317
1020
|
}
|
|
1318
|
-
return /* @__PURE__ */
|
|
1021
|
+
return /* @__PURE__ */ jsx6(
|
|
1319
1022
|
"button",
|
|
1320
1023
|
{
|
|
1321
1024
|
type: "button",
|
|
1322
1025
|
onClick: handleClick,
|
|
1323
1026
|
"aria-label": `Open ${part.name}`,
|
|
1324
1027
|
className: "h-16 w-16 shrink-0 overflow-hidden rounded-md border border-border",
|
|
1325
|
-
children: /* @__PURE__ */
|
|
1028
|
+
children: /* @__PURE__ */ jsx6("img", { src: objectUrl, alt: part.name, className: "h-16 w-16 object-cover" })
|
|
1326
1029
|
}
|
|
1327
1030
|
);
|
|
1328
1031
|
}
|
|
1329
1032
|
function AttachmentChip({ part, resolveFileUrl, fetchFile }) {
|
|
1330
|
-
const [status, setStatus] =
|
|
1331
|
-
const [errorMessage, setErrorMessage] =
|
|
1033
|
+
const [status, setStatus] = useState5("idle");
|
|
1034
|
+
const [errorMessage, setErrorMessage] = useState5(null);
|
|
1332
1035
|
const handleClick = useCallback(() => {
|
|
1333
1036
|
if (status === "loading") return;
|
|
1334
1037
|
setStatus("loading");
|
|
@@ -1354,7 +1057,7 @@ function AttachmentChip({ part, resolveFileUrl, fetchFile }) {
|
|
|
1354
1057
|
"inline-flex items-center gap-1 rounded-md border px-2 py-0.5 text-[11px]",
|
|
1355
1058
|
status === "error" ? "border-destructive/40 bg-destructive/10 text-destructive" : "border-border bg-muted/60 text-muted-foreground"
|
|
1356
1059
|
].join(" ");
|
|
1357
|
-
return /* @__PURE__ */
|
|
1060
|
+
return /* @__PURE__ */ jsxs4(
|
|
1358
1061
|
"button",
|
|
1359
1062
|
{
|
|
1360
1063
|
type: "button",
|
|
@@ -1362,9 +1065,9 @@ function AttachmentChip({ part, resolveFileUrl, fetchFile }) {
|
|
|
1362
1065
|
title: status === "error" ? errorMessage ?? void 0 : void 0,
|
|
1363
1066
|
className,
|
|
1364
1067
|
children: [
|
|
1365
|
-
/* @__PURE__ */
|
|
1068
|
+
/* @__PURE__ */ jsx6(Icon, { className: "h-3 w-3 shrink-0" }),
|
|
1366
1069
|
part.name,
|
|
1367
|
-
typeof part.size === "number" && /* @__PURE__ */
|
|
1070
|
+
typeof part.size === "number" && /* @__PURE__ */ jsxs4("span", { className: "text-muted-foreground/70", children: [
|
|
1368
1071
|
"\xB7 ",
|
|
1369
1072
|
formatBytes(part.size)
|
|
1370
1073
|
] })
|
|
@@ -1374,8 +1077,8 @@ function AttachmentChip({ part, resolveFileUrl, fetchFile }) {
|
|
|
1374
1077
|
}
|
|
1375
1078
|
function MessageAttachments({ parts, resolveFileUrl, justify = "end", fetchFile }) {
|
|
1376
1079
|
if (parts.length === 0) return null;
|
|
1377
|
-
return /* @__PURE__ */
|
|
1378
|
-
(part) => part.type === "image" ? /* @__PURE__ */
|
|
1080
|
+
return /* @__PURE__ */ jsx6("div", { className: `flex flex-wrap gap-1.5 ${justify === "start" ? "justify-start" : "justify-end"}`, children: parts.map(
|
|
1081
|
+
(part) => part.type === "image" ? /* @__PURE__ */ jsx6(AttachmentThumbnail, { part, resolveFileUrl, fetchFile }, `${part.path}:${part.name}`) : /* @__PURE__ */ jsx6(AttachmentChip, { part, resolveFileUrl, fetchFile }, `${part.path}:${part.name}`)
|
|
1379
1082
|
) });
|
|
1380
1083
|
}
|
|
1381
1084
|
|
|
@@ -1562,31 +1265,31 @@ async function streamChatTurn(opts) {
|
|
|
1562
1265
|
// src/web-react/chat-composer.tsx
|
|
1563
1266
|
import {
|
|
1564
1267
|
useCallback as useCallback2,
|
|
1565
|
-
useEffect as
|
|
1566
|
-
useRef as
|
|
1567
|
-
useState as
|
|
1268
|
+
useEffect as useEffect5,
|
|
1269
|
+
useRef as useRef4,
|
|
1270
|
+
useState as useState6
|
|
1568
1271
|
} from "react";
|
|
1569
|
-
import { Fragment as
|
|
1272
|
+
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1570
1273
|
function SendGlyph({ className }) {
|
|
1571
|
-
return /* @__PURE__ */
|
|
1274
|
+
return /* @__PURE__ */ jsx7("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx7("path", { d: "M22 2 11 13M22 2l-7 20-4-9-9-4 20-7z" }) });
|
|
1572
1275
|
}
|
|
1573
1276
|
function StopGlyph({ className }) {
|
|
1574
|
-
return /* @__PURE__ */
|
|
1277
|
+
return /* @__PURE__ */ jsx7("svg", { className, viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": true, children: /* @__PURE__ */ jsx7("rect", { x: "6", y: "6", width: "12", height: "12", rx: "2" }) });
|
|
1575
1278
|
}
|
|
1576
1279
|
function PaperclipGlyph({ className }) {
|
|
1577
|
-
return /* @__PURE__ */
|
|
1280
|
+
return /* @__PURE__ */ jsx7("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx7("path", { d: "m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48" }) });
|
|
1578
1281
|
}
|
|
1579
1282
|
function FolderGlyph({ className }) {
|
|
1580
|
-
return /* @__PURE__ */
|
|
1581
|
-
/* @__PURE__ */
|
|
1582
|
-
/* @__PURE__ */
|
|
1283
|
+
return /* @__PURE__ */ jsxs5("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
1284
|
+
/* @__PURE__ */ jsx7("path", { d: "M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z" }),
|
|
1285
|
+
/* @__PURE__ */ jsx7("path", { d: "M12 10v6m-3-3h6" })
|
|
1583
1286
|
] });
|
|
1584
1287
|
}
|
|
1585
1288
|
function CloseGlyph({ className }) {
|
|
1586
|
-
return /* @__PURE__ */
|
|
1289
|
+
return /* @__PURE__ */ jsx7("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx7("path", { d: "M18 6 6 18M6 6l12 12" }) });
|
|
1587
1290
|
}
|
|
1588
1291
|
function UploadGlyph({ className }) {
|
|
1589
|
-
return /* @__PURE__ */
|
|
1292
|
+
return /* @__PURE__ */ jsx7("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx7("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12" }) });
|
|
1590
1293
|
}
|
|
1591
1294
|
var MAX_HEIGHT = 168;
|
|
1592
1295
|
var DEFAULT_SEND_FAILURE = "Message not sent. Your draft is still here \u2014 try again.";
|
|
@@ -1630,19 +1333,20 @@ function ChatComposer({
|
|
|
1630
1333
|
dropTitle = "Drop files to add context",
|
|
1631
1334
|
dropDescription = "They attach to your next message.",
|
|
1632
1335
|
focusShortcut = true,
|
|
1336
|
+
floating = false,
|
|
1633
1337
|
sendLabel = "Send",
|
|
1634
1338
|
className
|
|
1635
1339
|
}) {
|
|
1636
1340
|
const isControlled = value !== void 0;
|
|
1637
|
-
const [internal, setInternal] =
|
|
1341
|
+
const [internal, setInternal] = useState6(initialValue ?? "");
|
|
1638
1342
|
const text = isControlled ? value : internal;
|
|
1639
|
-
const textRef =
|
|
1343
|
+
const textRef = useRef4(text);
|
|
1640
1344
|
textRef.current = text;
|
|
1641
|
-
const textareaRef =
|
|
1642
|
-
const fileInputRef =
|
|
1643
|
-
const folderInputRef =
|
|
1644
|
-
const [dragOver, setDragOver] =
|
|
1645
|
-
const dragDepth =
|
|
1345
|
+
const textareaRef = useRef4(null);
|
|
1346
|
+
const fileInputRef = useRef4(null);
|
|
1347
|
+
const folderInputRef = useRef4(null);
|
|
1348
|
+
const [dragOver, setDragOver] = useState6(false);
|
|
1349
|
+
const dragDepth = useRef4(0);
|
|
1646
1350
|
const setText = useCallback2(
|
|
1647
1351
|
(next) => {
|
|
1648
1352
|
if (!isControlled) setInternal(next);
|
|
@@ -1650,15 +1354,15 @@ function ChatComposer({
|
|
|
1650
1354
|
},
|
|
1651
1355
|
[isControlled, onValueChange]
|
|
1652
1356
|
);
|
|
1653
|
-
|
|
1357
|
+
useEffect5(() => {
|
|
1654
1358
|
const el = textareaRef.current;
|
|
1655
1359
|
if (!el) return;
|
|
1656
1360
|
el.style.height = "auto";
|
|
1657
1361
|
el.style.height = `${Math.min(el.scrollHeight, MAX_HEIGHT)}px`;
|
|
1658
1362
|
}, [text]);
|
|
1659
|
-
const prevSeedRef =
|
|
1660
|
-
const pendingCaretRef =
|
|
1661
|
-
|
|
1363
|
+
const prevSeedRef = useRef4(null);
|
|
1364
|
+
const pendingCaretRef = useRef4(null);
|
|
1365
|
+
useEffect5(() => {
|
|
1662
1366
|
const prev = prevSeedRef.current;
|
|
1663
1367
|
prevSeedRef.current = seed ?? null;
|
|
1664
1368
|
if (seed == null || seed === prev || isControlled) return;
|
|
@@ -1672,7 +1376,7 @@ function ChatComposer({
|
|
|
1672
1376
|
pendingCaretRef.current = seed;
|
|
1673
1377
|
}
|
|
1674
1378
|
}, [seed, setText, onSeedApplied, isControlled]);
|
|
1675
|
-
|
|
1379
|
+
useEffect5(() => {
|
|
1676
1380
|
if (pendingCaretRef.current == null || pendingCaretRef.current !== text)
|
|
1677
1381
|
return;
|
|
1678
1382
|
pendingCaretRef.current = null;
|
|
@@ -1681,8 +1385,8 @@ function ChatComposer({
|
|
|
1681
1385
|
el.focus();
|
|
1682
1386
|
el.setSelectionRange(text.length, text.length);
|
|
1683
1387
|
}, [text]);
|
|
1684
|
-
const restoreCaretRef =
|
|
1685
|
-
|
|
1388
|
+
const restoreCaretRef = useRef4(null);
|
|
1389
|
+
useEffect5(() => {
|
|
1686
1390
|
const pending = restoreCaretRef.current;
|
|
1687
1391
|
if (!pending || pending.text !== text) return;
|
|
1688
1392
|
restoreCaretRef.current = null;
|
|
@@ -1693,7 +1397,7 @@ function ChatComposer({
|
|
|
1693
1397
|
const end = Math.min(pending.end, text.length);
|
|
1694
1398
|
el.setSelectionRange(start, end);
|
|
1695
1399
|
}, [text]);
|
|
1696
|
-
|
|
1400
|
+
useEffect5(() => {
|
|
1697
1401
|
if (!focusShortcut || disabled) return;
|
|
1698
1402
|
function onKeyDown(e) {
|
|
1699
1403
|
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "l") {
|
|
@@ -1707,7 +1411,7 @@ function ChatComposer({
|
|
|
1707
1411
|
const readyFileCount = pendingFiles.filter((f) => f.status === "ready").length;
|
|
1708
1412
|
const hasSendable = text.trim().length > 0 || readyFileCount > 0;
|
|
1709
1413
|
const canSend = hasSendable && !isStreaming && !disabled;
|
|
1710
|
-
const [failedSend, setFailedSend] =
|
|
1414
|
+
const [failedSend, setFailedSend] = useState6(null);
|
|
1711
1415
|
const failSend = useCallback2(
|
|
1712
1416
|
(error, draft, trimmed, parts, caret) => {
|
|
1713
1417
|
const message = sendFailureText(error, sendFailureMessage);
|
|
@@ -1819,7 +1523,7 @@ function ChatComposer({
|
|
|
1819
1523
|
const fileChips = pendingFiles.filter((f) => f.kind !== "folder");
|
|
1820
1524
|
const showAbove = controls != null && controlsPlacement === "above";
|
|
1821
1525
|
const showInline = controls != null && !showAbove;
|
|
1822
|
-
return /* @__PURE__ */
|
|
1526
|
+
return /* @__PURE__ */ jsxs5(
|
|
1823
1527
|
"div",
|
|
1824
1528
|
{
|
|
1825
1529
|
className: `relative ${className ?? ""}`,
|
|
@@ -1828,22 +1532,22 @@ function ChatComposer({
|
|
|
1828
1532
|
onDragOver: onAttach ? handleDragOver : void 0,
|
|
1829
1533
|
onDrop: onAttach ? handleDrop : void 0,
|
|
1830
1534
|
children: [
|
|
1831
|
-
dragOver && /* @__PURE__ */
|
|
1832
|
-
/* @__PURE__ */
|
|
1833
|
-
/* @__PURE__ */
|
|
1834
|
-
/* @__PURE__ */
|
|
1535
|
+
dragOver && /* @__PURE__ */ jsx7("div", { className: "pointer-events-none absolute inset-0 z-10 flex items-center justify-center rounded-2xl border-2 border-dashed border-primary/50 bg-card/95", children: /* @__PURE__ */ jsxs5("div", { className: "text-center", children: [
|
|
1536
|
+
/* @__PURE__ */ jsx7("span", { className: "mx-auto mb-2 flex h-11 w-11 items-center justify-center rounded-xl bg-primary/10 text-primary", children: /* @__PURE__ */ jsx7(UploadGlyph, { className: "h-5 w-5" }) }),
|
|
1537
|
+
/* @__PURE__ */ jsx7("p", { className: "text-sm font-semibold text-foreground", children: dropTitle }),
|
|
1538
|
+
/* @__PURE__ */ jsx7("p", { className: "mt-0.5 text-xs text-muted-foreground", children: dropDescription })
|
|
1835
1539
|
] }) }),
|
|
1836
|
-
showAbove && /* @__PURE__ */
|
|
1837
|
-
failedSend && /* @__PURE__ */
|
|
1540
|
+
showAbove && /* @__PURE__ */ jsx7("div", { className: "mb-1.5 flex flex-wrap items-center gap-1.5 px-1", children: controls }),
|
|
1541
|
+
failedSend && /* @__PURE__ */ jsxs5(
|
|
1838
1542
|
"div",
|
|
1839
1543
|
{
|
|
1840
1544
|
role: "alert",
|
|
1841
1545
|
"data-testid": "composer-send-error",
|
|
1842
1546
|
className: "mb-2 rounded-xl border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",
|
|
1843
1547
|
children: [
|
|
1844
|
-
/* @__PURE__ */
|
|
1845
|
-
/* @__PURE__ */
|
|
1846
|
-
/* @__PURE__ */
|
|
1548
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-start gap-2", children: [
|
|
1549
|
+
/* @__PURE__ */ jsx7("span", { className: "min-w-0 flex-1", children: failedSend.message }),
|
|
1550
|
+
/* @__PURE__ */ jsx7(
|
|
1847
1551
|
"button",
|
|
1848
1552
|
{
|
|
1849
1553
|
type: "button",
|
|
@@ -1854,8 +1558,8 @@ function ChatComposer({
|
|
|
1854
1558
|
}
|
|
1855
1559
|
)
|
|
1856
1560
|
] }),
|
|
1857
|
-
!failedSend.restored && /* @__PURE__ */
|
|
1858
|
-
/* @__PURE__ */
|
|
1561
|
+
!failedSend.restored && /* @__PURE__ */ jsxs5("div", { className: "mt-1.5", children: [
|
|
1562
|
+
/* @__PURE__ */ jsx7(
|
|
1859
1563
|
"p",
|
|
1860
1564
|
{
|
|
1861
1565
|
"data-testid": "composer-unsent-draft",
|
|
@@ -1863,7 +1567,7 @@ function ChatComposer({
|
|
|
1863
1567
|
children: failedSend.text
|
|
1864
1568
|
}
|
|
1865
1569
|
),
|
|
1866
|
-
/* @__PURE__ */
|
|
1570
|
+
/* @__PURE__ */ jsx7(
|
|
1867
1571
|
"button",
|
|
1868
1572
|
{
|
|
1869
1573
|
type: "button",
|
|
@@ -1878,40 +1582,40 @@ function ChatComposer({
|
|
|
1878
1582
|
]
|
|
1879
1583
|
}
|
|
1880
1584
|
),
|
|
1881
|
-
pendingFiles.length > 0 && /* @__PURE__ */
|
|
1585
|
+
pendingFiles.length > 0 && /* @__PURE__ */ jsx7("div", { className: "mb-2 flex flex-wrap gap-1.5", children: [...folderChips, ...fileChips].map((f) => /* @__PURE__ */ jsxs5(
|
|
1882
1586
|
"span",
|
|
1883
1587
|
{
|
|
1884
1588
|
className: `inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs ${f.status === "error" ? "border-destructive/40 text-destructive" : "border-border bg-muted/50 text-foreground"}`,
|
|
1885
1589
|
children: [
|
|
1886
|
-
f.kind === "folder" ? /* @__PURE__ */
|
|
1887
|
-
/* @__PURE__ */
|
|
1888
|
-
f.fileCount !== void 0 && /* @__PURE__ */
|
|
1590
|
+
f.kind === "folder" ? /* @__PURE__ */ jsx7(FolderGlyph, { className: "h-3 w-3 shrink-0" }) : /* @__PURE__ */ jsx7(PaperclipGlyph, { className: "h-3 w-3 shrink-0" }),
|
|
1591
|
+
/* @__PURE__ */ jsx7("span", { className: "max-w-[150px] truncate", children: f.name }),
|
|
1592
|
+
f.fileCount !== void 0 && /* @__PURE__ */ jsxs5("span", { className: "text-muted-foreground", children: [
|
|
1889
1593
|
"(",
|
|
1890
1594
|
f.fileCount,
|
|
1891
1595
|
")"
|
|
1892
1596
|
] }),
|
|
1893
|
-
f.status === "uploading" && /* @__PURE__ */
|
|
1894
|
-
onRemoveFile && /* @__PURE__ */
|
|
1597
|
+
f.status === "uploading" && /* @__PURE__ */ jsx7("span", { className: "h-3 w-3 animate-spin rounded-full border-2 border-primary border-t-transparent" }),
|
|
1598
|
+
onRemoveFile && /* @__PURE__ */ jsx7(
|
|
1895
1599
|
"button",
|
|
1896
1600
|
{
|
|
1897
1601
|
type: "button",
|
|
1898
1602
|
"aria-label": `Remove ${f.name}`,
|
|
1899
1603
|
onClick: () => onRemoveFile(f.id),
|
|
1900
1604
|
className: "rounded p-0.5 text-muted-foreground transition hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1901
|
-
children: /* @__PURE__ */
|
|
1605
|
+
children: /* @__PURE__ */ jsx7(CloseGlyph, { className: "h-3 w-3" })
|
|
1902
1606
|
}
|
|
1903
1607
|
)
|
|
1904
1608
|
]
|
|
1905
1609
|
},
|
|
1906
1610
|
f.id
|
|
1907
1611
|
)) }),
|
|
1908
|
-
/* @__PURE__ */
|
|
1612
|
+
/* @__PURE__ */ jsxs5(
|
|
1909
1613
|
"div",
|
|
1910
1614
|
{
|
|
1911
1615
|
"data-testid": "composer-card",
|
|
1912
|
-
className:
|
|
1616
|
+
className: `flex flex-col gap-1.5 rounded-2xl border border-border bg-card px-3 py-2.5 transition focus-within:border-primary/40 focus-within:ring-2 focus-within:ring-primary/15 ${floating ? "shadow-[0_1px_2px_hsl(var(--foreground)/0.05),0_12px_28px_hsl(var(--foreground)/0.07)] dark:shadow-[0_1px_2px_hsl(var(--foreground)/0.14),0_12px_28px_hsl(var(--foreground)/0.22)]" : ""}`,
|
|
1913
1617
|
children: [
|
|
1914
|
-
/* @__PURE__ */
|
|
1618
|
+
/* @__PURE__ */ jsx7(
|
|
1915
1619
|
"textarea",
|
|
1916
1620
|
{
|
|
1917
1621
|
ref: textareaRef,
|
|
@@ -1925,9 +1629,9 @@ function ChatComposer({
|
|
|
1925
1629
|
className: "max-h-[168px] min-h-[56px] w-full resize-none bg-transparent px-1.5 py-1 text-[15px] leading-6 text-foreground outline-none placeholder:text-muted-foreground disabled:opacity-50"
|
|
1926
1630
|
}
|
|
1927
1631
|
),
|
|
1928
|
-
/* @__PURE__ */
|
|
1929
|
-
onAttach && /* @__PURE__ */
|
|
1930
|
-
/* @__PURE__ */
|
|
1632
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex items-end gap-2", children: [
|
|
1633
|
+
onAttach && /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
1634
|
+
/* @__PURE__ */ jsx7(
|
|
1931
1635
|
"button",
|
|
1932
1636
|
{
|
|
1933
1637
|
type: "button",
|
|
@@ -1936,13 +1640,13 @@ function ChatComposer({
|
|
|
1936
1640
|
"aria-label": "Attach files",
|
|
1937
1641
|
title: "Attach files",
|
|
1938
1642
|
className: "shrink-0 rounded-lg p-2 text-muted-foreground transition hover:bg-accent/40 hover:text-foreground disabled:opacity-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1939
|
-
children: /* @__PURE__ */
|
|
1643
|
+
children: /* @__PURE__ */ jsx7(PaperclipGlyph, { className: "h-4 w-4" })
|
|
1940
1644
|
}
|
|
1941
1645
|
),
|
|
1942
|
-
/* @__PURE__ */
|
|
1646
|
+
/* @__PURE__ */ jsx7("input", { ref: fileInputRef, type: "file", multiple: true, className: "hidden", accept, onChange: handleFileChange })
|
|
1943
1647
|
] }),
|
|
1944
|
-
onAttachFolder && /* @__PURE__ */
|
|
1945
|
-
/* @__PURE__ */
|
|
1648
|
+
onAttachFolder && /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
1649
|
+
/* @__PURE__ */ jsx7(
|
|
1946
1650
|
"button",
|
|
1947
1651
|
{
|
|
1948
1652
|
type: "button",
|
|
@@ -1951,10 +1655,10 @@ function ChatComposer({
|
|
|
1951
1655
|
"aria-label": "Attach folder",
|
|
1952
1656
|
title: "Attach folder",
|
|
1953
1657
|
className: "shrink-0 rounded-lg p-2 text-muted-foreground transition hover:bg-accent/40 hover:text-foreground disabled:opacity-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
1954
|
-
children: /* @__PURE__ */
|
|
1658
|
+
children: /* @__PURE__ */ jsx7(FolderGlyph, { className: "h-4 w-4" })
|
|
1955
1659
|
}
|
|
1956
1660
|
),
|
|
1957
|
-
/* @__PURE__ */
|
|
1661
|
+
/* @__PURE__ */ jsx7(
|
|
1958
1662
|
"input",
|
|
1959
1663
|
{
|
|
1960
1664
|
ref: folderInputRef,
|
|
@@ -1966,8 +1670,15 @@ function ChatComposer({
|
|
|
1966
1670
|
}
|
|
1967
1671
|
)
|
|
1968
1672
|
] }),
|
|
1969
|
-
/* @__PURE__ */
|
|
1970
|
-
|
|
1673
|
+
/* @__PURE__ */ jsx7(
|
|
1674
|
+
"div",
|
|
1675
|
+
{
|
|
1676
|
+
"data-testid": "composer-controls",
|
|
1677
|
+
className: "flex min-w-0 flex-1 flex-wrap items-center gap-1.5",
|
|
1678
|
+
children: showInline && controls
|
|
1679
|
+
}
|
|
1680
|
+
),
|
|
1681
|
+
isStreaming ? /* @__PURE__ */ jsxs5(
|
|
1971
1682
|
"button",
|
|
1972
1683
|
{
|
|
1973
1684
|
type: "button",
|
|
@@ -1975,11 +1686,11 @@ function ChatComposer({
|
|
|
1975
1686
|
"aria-label": "Stop response",
|
|
1976
1687
|
className: "inline-flex shrink-0 items-center gap-1.5 rounded-full bg-destructive/15 px-3.5 py-2 text-sm font-medium text-destructive transition hover:bg-destructive/25 focus:outline-none focus-visible:ring-2 focus-visible:ring-destructive/50",
|
|
1977
1688
|
children: [
|
|
1978
|
-
/* @__PURE__ */
|
|
1979
|
-
/* @__PURE__ */
|
|
1689
|
+
/* @__PURE__ */ jsx7(StopGlyph, { className: "h-3.5 w-3.5" }),
|
|
1690
|
+
/* @__PURE__ */ jsx7("span", { children: "Stop" })
|
|
1980
1691
|
]
|
|
1981
1692
|
}
|
|
1982
|
-
) : /* @__PURE__ */
|
|
1693
|
+
) : /* @__PURE__ */ jsxs5(
|
|
1983
1694
|
"button",
|
|
1984
1695
|
{
|
|
1985
1696
|
type: "button",
|
|
@@ -1988,8 +1699,8 @@ function ChatComposer({
|
|
|
1988
1699
|
"aria-label": sendLabel,
|
|
1989
1700
|
className: "inline-flex shrink-0 items-center gap-1.5 rounded-full bg-primary px-3.5 py-2 text-sm font-medium text-primary-foreground shadow-sm transition hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-40 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-card",
|
|
1990
1701
|
children: [
|
|
1991
|
-
/* @__PURE__ */
|
|
1992
|
-
/* @__PURE__ */
|
|
1702
|
+
/* @__PURE__ */ jsx7(SendGlyph, { className: "h-3.5 w-3.5" }),
|
|
1703
|
+
/* @__PURE__ */ jsx7("span", { children: sendLabel })
|
|
1993
1704
|
]
|
|
1994
1705
|
}
|
|
1995
1706
|
)
|
|
@@ -1997,10 +1708,10 @@ function ChatComposer({
|
|
|
1997
1708
|
]
|
|
1998
1709
|
}
|
|
1999
1710
|
),
|
|
2000
|
-
focusShortcut && /* @__PURE__ */
|
|
2001
|
-
/* @__PURE__ */
|
|
2002
|
-
/* @__PURE__ */
|
|
2003
|
-
/* @__PURE__ */
|
|
1711
|
+
focusShortcut && /* @__PURE__ */ jsx7("div", { className: "mt-1.5 flex justify-end px-1", children: /* @__PURE__ */ jsxs5("span", { className: "text-xs text-muted-foreground", children: [
|
|
1712
|
+
/* @__PURE__ */ jsx7("kbd", { className: "rounded border border-border bg-background px-1 py-0.5 text-[10px]", children: "Cmd" }),
|
|
1713
|
+
/* @__PURE__ */ jsx7("kbd", { className: "ml-0.5 rounded border border-border bg-background px-1 py-0.5 text-[10px]", children: "L" }),
|
|
1714
|
+
/* @__PURE__ */ jsx7("span", { className: "ml-1", children: "to focus" })
|
|
2004
1715
|
] }) })
|
|
2005
1716
|
]
|
|
2006
1717
|
}
|
|
@@ -2008,7 +1719,7 @@ function ChatComposer({
|
|
|
2008
1719
|
}
|
|
2009
1720
|
|
|
2010
1721
|
// src/web-react/durable-plan-flow.ts
|
|
2011
|
-
import { useCallback as useCallback3, useEffect as
|
|
1722
|
+
import { useCallback as useCallback3, useEffect as useEffect6, useRef as useRef5, useState as useState7 } from "react";
|
|
2012
1723
|
var DurablePlanClientError = class extends Error {
|
|
2013
1724
|
constructor(message, status, code, currentPlan) {
|
|
2014
1725
|
super(message);
|
|
@@ -2095,13 +1806,13 @@ function createDurablePlanDecisionClient(options) {
|
|
|
2095
1806
|
};
|
|
2096
1807
|
}
|
|
2097
1808
|
function useDurablePlanFlow(options) {
|
|
2098
|
-
const [plan, setPlan] =
|
|
2099
|
-
const [deciding, setDeciding] =
|
|
2100
|
-
const [restoring, setRestoring] =
|
|
2101
|
-
const [error, setError] =
|
|
2102
|
-
const attachments =
|
|
2103
|
-
const decisionInFlight =
|
|
2104
|
-
|
|
1809
|
+
const [plan, setPlan] = useState7(options.plan);
|
|
1810
|
+
const [deciding, setDeciding] = useState7(null);
|
|
1811
|
+
const [restoring, setRestoring] = useState7(false);
|
|
1812
|
+
const [error, setError] = useState7(null);
|
|
1813
|
+
const attachments = useRef5(/* @__PURE__ */ new Map());
|
|
1814
|
+
const decisionInFlight = useRef5(false);
|
|
1815
|
+
useEffect6(() => setPlan(options.plan), [options.plan]);
|
|
2105
1816
|
const apply = useCallback3(async (result) => {
|
|
2106
1817
|
setPlan(result.plan);
|
|
2107
1818
|
options.onUpdated?.(result.plan);
|
|
@@ -2270,7 +1981,7 @@ function createDurableInteractionAnswerSubmitter(options) {
|
|
|
2270
1981
|
}
|
|
2271
1982
|
|
|
2272
1983
|
// src/web-react/use-chat-interactions.ts
|
|
2273
|
-
import { useCallback as useCallback4, useMemo as
|
|
1984
|
+
import { useCallback as useCallback4, useMemo as useMemo3, useState as useState8 } from "react";
|
|
2274
1985
|
function hasPendingContentDuplicate(list, interaction) {
|
|
2275
1986
|
if (interaction.status !== "pending") return false;
|
|
2276
1987
|
const signature = questionInteractionContentSignature(interaction);
|
|
@@ -2349,7 +2060,7 @@ function hydrateChatInteractions(list, persisted) {
|
|
|
2349
2060
|
return persisted.reduce(upsertChatInteraction, list);
|
|
2350
2061
|
}
|
|
2351
2062
|
function useChatInteractions(options = {}) {
|
|
2352
|
-
const [interactions, setInteractions] =
|
|
2063
|
+
const [interactions, setInteractions] = useState8([]);
|
|
2353
2064
|
const upsert = useCallback4((interaction) => {
|
|
2354
2065
|
setInteractions((prev) => upsertChatInteraction(prev, interaction));
|
|
2355
2066
|
}, []);
|
|
@@ -2371,12 +2082,12 @@ function useChatInteractions(options = {}) {
|
|
|
2371
2082
|
setInteractions((prev) => terminalizePendingChatInteractions(prev, status));
|
|
2372
2083
|
}, []);
|
|
2373
2084
|
const reset = useCallback4(() => setInteractions([]), []);
|
|
2374
|
-
const pending =
|
|
2085
|
+
const pending = useMemo3(() => interactions.filter((item) => item.status === "pending"), [interactions]);
|
|
2375
2086
|
return { interactions, pending, upsert, applyCancel, markResolved, restore, hydrate, terminalizePending, reset };
|
|
2376
2087
|
}
|
|
2377
2088
|
|
|
2378
2089
|
// src/web-react/use-file-mentions.ts
|
|
2379
|
-
import { useCallback as useCallback5, useMemo as
|
|
2090
|
+
import { useCallback as useCallback5, useMemo as useMemo4, useRef as useRef6, useState as useState9 } from "react";
|
|
2380
2091
|
var FILE_MENTION_KIND = "file";
|
|
2381
2092
|
function toMentionItem(file) {
|
|
2382
2093
|
return { id: file.path, label: file.name, detail: file.path, kind: FILE_MENTION_KIND };
|
|
@@ -2434,11 +2145,11 @@ function useFileMentions(options) {
|
|
|
2434
2145
|
emptyText = DEFAULT_MENTION_EMPTY_TEXT
|
|
2435
2146
|
} = options;
|
|
2436
2147
|
const fetchImpl = options.fetchImpl ?? fetch;
|
|
2437
|
-
const [state, setState] =
|
|
2438
|
-
const stateRef =
|
|
2148
|
+
const [state, setState] = useState9({ kind: "idle" });
|
|
2149
|
+
const stateRef = useRef6(state);
|
|
2439
2150
|
stateRef.current = state;
|
|
2440
|
-
const inFlightRef =
|
|
2441
|
-
const [mentions, setMentions] =
|
|
2151
|
+
const inFlightRef = useRef6(null);
|
|
2152
|
+
const [mentions, setMentions] = useState9([]);
|
|
2442
2153
|
const load = useCallback5(() => {
|
|
2443
2154
|
if (inFlightRef.current) return inFlightRef.current;
|
|
2444
2155
|
if (stateRef.current.kind === "idle") {
|
|
@@ -2493,7 +2204,7 @@ function useFileMentions(options) {
|
|
|
2493
2204
|
setMentions(items.filter((item) => item.kind === void 0 || item.kind === FILE_MENTION_KIND).map(toFileMention));
|
|
2494
2205
|
}, []);
|
|
2495
2206
|
const clearMentions = useCallback5(() => setMentions([]), []);
|
|
2496
|
-
const mention =
|
|
2207
|
+
const mention = useMemo4(
|
|
2497
2208
|
() => ({
|
|
2498
2209
|
fetchItems,
|
|
2499
2210
|
onMentionsChange,
|
|
@@ -2547,8 +2258,8 @@ function segmentMentionContent(content, parts) {
|
|
|
2547
2258
|
}
|
|
2548
2259
|
|
|
2549
2260
|
// src/web-react/mission-activity.tsx
|
|
2550
|
-
import { useCallback as useCallback6, useEffect as
|
|
2551
|
-
import { Fragment as
|
|
2261
|
+
import { useCallback as useCallback6, useEffect as useEffect7, useState as useState10 } from "react";
|
|
2262
|
+
import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
2552
2263
|
var LIVE_STATUSES = /* @__PURE__ */ new Set(["pending", "running"]);
|
|
2553
2264
|
var OK_STATUSES = /* @__PURE__ */ new Set(["completed", "done", "succeeded"]);
|
|
2554
2265
|
var ERROR_STATUSES = /* @__PURE__ */ new Set(["failed", "error", "cancelled", "aborted"]);
|
|
@@ -2595,19 +2306,19 @@ function waterfallLayout(trace) {
|
|
|
2595
2306
|
});
|
|
2596
2307
|
}
|
|
2597
2308
|
function ChevronGlyph({ className }) {
|
|
2598
|
-
return /* @__PURE__ */
|
|
2309
|
+
return /* @__PURE__ */ jsx8("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx8("path", { d: "m6 9 6 6 6-6" }) });
|
|
2599
2310
|
}
|
|
2600
2311
|
function RefreshGlyph({ className }) {
|
|
2601
|
-
return /* @__PURE__ */
|
|
2312
|
+
return /* @__PURE__ */ jsx8("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx8("path", { d: "M21 12a9 9 0 1 1-2.64-6.36M21 3v6h-6" }) });
|
|
2602
2313
|
}
|
|
2603
2314
|
function CopyGlyph({ className }) {
|
|
2604
|
-
return /* @__PURE__ */
|
|
2605
|
-
/* @__PURE__ */
|
|
2606
|
-
/* @__PURE__ */
|
|
2315
|
+
return /* @__PURE__ */ jsxs6("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
2316
|
+
/* @__PURE__ */ jsx8("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }),
|
|
2317
|
+
/* @__PURE__ */ jsx8("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
2607
2318
|
] });
|
|
2608
2319
|
}
|
|
2609
2320
|
function TraceIdCopy({ traceId }) {
|
|
2610
|
-
const [copied, setCopied] =
|
|
2321
|
+
const [copied, setCopied] = useState10(false);
|
|
2611
2322
|
const copy = useCallback6(() => {
|
|
2612
2323
|
void navigator.clipboard?.writeText(traceId).then(
|
|
2613
2324
|
() => {
|
|
@@ -2618,7 +2329,7 @@ function TraceIdCopy({ traceId }) {
|
|
|
2618
2329
|
}
|
|
2619
2330
|
);
|
|
2620
2331
|
}, [traceId]);
|
|
2621
|
-
return /* @__PURE__ */
|
|
2332
|
+
return /* @__PURE__ */ jsxs6(
|
|
2622
2333
|
"button",
|
|
2623
2334
|
{
|
|
2624
2335
|
type: "button",
|
|
@@ -2627,23 +2338,23 @@ function TraceIdCopy({ traceId }) {
|
|
|
2627
2338
|
"aria-label": "Copy trace id",
|
|
2628
2339
|
className: "inline-flex min-w-0 items-center gap-1.5 rounded text-left font-mono text-muted-foreground transition hover:text-foreground",
|
|
2629
2340
|
children: [
|
|
2630
|
-
/* @__PURE__ */
|
|
2631
|
-
/* @__PURE__ */
|
|
2632
|
-
copied && /* @__PURE__ */
|
|
2341
|
+
/* @__PURE__ */ jsx8("span", { className: "truncate", children: traceId }),
|
|
2342
|
+
/* @__PURE__ */ jsx8(CopyGlyph, { className: "h-3 w-3 shrink-0" }),
|
|
2343
|
+
copied && /* @__PURE__ */ jsx8("span", { className: "shrink-0 not-italic text-success", children: "copied" })
|
|
2633
2344
|
]
|
|
2634
2345
|
}
|
|
2635
2346
|
);
|
|
2636
2347
|
}
|
|
2637
2348
|
function StatusDot({ tone }) {
|
|
2638
|
-
return /* @__PURE__ */
|
|
2639
|
-
/* @__PURE__ */
|
|
2349
|
+
return /* @__PURE__ */ jsxs6("span", { className: "inline-flex items-center", children: [
|
|
2350
|
+
/* @__PURE__ */ jsx8(
|
|
2640
2351
|
"span",
|
|
2641
2352
|
{
|
|
2642
2353
|
"aria-hidden": true,
|
|
2643
2354
|
className: `h-2 w-2 shrink-0 rounded-full ${tone === "live" ? "animate-pulse bg-warning" : tone === "ok" ? "bg-success" : tone === "error" ? "bg-destructive" : "bg-muted-foreground/40"}`
|
|
2644
2355
|
}
|
|
2645
2356
|
),
|
|
2646
|
-
/* @__PURE__ */
|
|
2357
|
+
/* @__PURE__ */ jsx8("span", { className: "sr-only", children: tone })
|
|
2647
2358
|
] });
|
|
2648
2359
|
}
|
|
2649
2360
|
var BAR_CLASS = {
|
|
@@ -2655,19 +2366,19 @@ function FlowWaterfall({ trace }) {
|
|
|
2655
2366
|
const rows = waterfallLayout(trace);
|
|
2656
2367
|
if (rows.length === 0) return null;
|
|
2657
2368
|
const cost = formatActivityCost(trace.costUsd);
|
|
2658
|
-
return /* @__PURE__ */
|
|
2659
|
-
rows.map((row, i) => /* @__PURE__ */
|
|
2660
|
-
/* @__PURE__ */
|
|
2661
|
-
/* @__PURE__ */
|
|
2369
|
+
return /* @__PURE__ */ jsxs6("div", { className: "space-y-1", children: [
|
|
2370
|
+
rows.map((row, i) => /* @__PURE__ */ jsxs6("div", { className: "grid grid-cols-[minmax(0,2fr)_minmax(0,3fr)_auto] items-center gap-2", children: [
|
|
2371
|
+
/* @__PURE__ */ jsx8("span", { className: "truncate font-mono text-[11px] text-muted-foreground", title: row.name, children: row.name }),
|
|
2372
|
+
/* @__PURE__ */ jsx8("div", { className: "relative h-2 rounded-sm bg-muted/40", children: /* @__PURE__ */ jsx8(
|
|
2662
2373
|
"div",
|
|
2663
2374
|
{
|
|
2664
2375
|
className: `absolute inset-y-0 rounded-sm ${row.ok ? BAR_CLASS[row.kind] : "bg-destructive/80"} ${row.approx ? "opacity-70" : ""}`,
|
|
2665
2376
|
style: { left: `${row.offsetPct}%`, width: `${row.widthPct}%` }
|
|
2666
2377
|
}
|
|
2667
2378
|
) }),
|
|
2668
|
-
/* @__PURE__ */
|
|
2379
|
+
/* @__PURE__ */ jsx8("span", { className: "shrink-0 font-mono text-[10px] tabular-nums text-muted-foreground/70", children: row.durationLabel })
|
|
2669
2380
|
] }, i)),
|
|
2670
|
-
/* @__PURE__ */
|
|
2381
|
+
/* @__PURE__ */ jsxs6("p", { className: "pt-0.5 text-right font-mono text-[10px] tabular-nums text-muted-foreground/60", children: [
|
|
2671
2382
|
(trace.totalMs / 1e3).toFixed(1),
|
|
2672
2383
|
"s",
|
|
2673
2384
|
cost ? ` \xB7 ${cost}` : ""
|
|
@@ -2675,43 +2386,43 @@ function FlowWaterfall({ trace }) {
|
|
|
2675
2386
|
] });
|
|
2676
2387
|
}
|
|
2677
2388
|
function MissionActivityLane({ activity, startedAt, nowMs }) {
|
|
2678
|
-
const [expanded, setExpanded] =
|
|
2389
|
+
const [expanded, setExpanded] = useState10(false);
|
|
2679
2390
|
if (activity.length === 0) return null;
|
|
2680
|
-
return /* @__PURE__ */
|
|
2391
|
+
return /* @__PURE__ */ jsxs6("div", { className: "mt-1 border-l border-border/50 pl-3", children: [
|
|
2681
2392
|
activity.map((run) => {
|
|
2682
2393
|
const tone = activityTone(run.status);
|
|
2683
2394
|
const cost = formatActivityCost(run.costUsd);
|
|
2684
2395
|
const duration = formatActivityDuration(run.durationMs);
|
|
2685
|
-
return /* @__PURE__ */
|
|
2686
|
-
/* @__PURE__ */
|
|
2687
|
-
/* @__PURE__ */
|
|
2688
|
-
/* @__PURE__ */
|
|
2689
|
-
/* @__PURE__ */
|
|
2396
|
+
return /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2 py-1 text-xs", children: [
|
|
2397
|
+
/* @__PURE__ */ jsx8(StatusDot, { tone }),
|
|
2398
|
+
/* @__PURE__ */ jsxs6("span", { className: "min-w-0 flex-1 truncate", children: [
|
|
2399
|
+
/* @__PURE__ */ jsx8("span", { className: "font-medium", children: run.tool }),
|
|
2400
|
+
/* @__PURE__ */ jsxs6("span", { className: "text-muted-foreground", children: [
|
|
2690
2401
|
" \u2014 ",
|
|
2691
2402
|
run.detail
|
|
2692
2403
|
] })
|
|
2693
2404
|
] }),
|
|
2694
|
-
tone === "live" && (run.iteration !== void 0 || run.phase !== void 0) && /* @__PURE__ */
|
|
2695
|
-
/* @__PURE__ */
|
|
2696
|
-
tone !== "live" && tone !== "ok" && /* @__PURE__ */
|
|
2697
|
-
cost && /* @__PURE__ */
|
|
2698
|
-
duration && /* @__PURE__ */
|
|
2405
|
+
tone === "live" && (run.iteration !== void 0 || run.phase !== void 0) && /* @__PURE__ */ jsx8("span", { className: "shrink-0 rounded-full bg-warning/10 px-1.5 py-0.5 font-mono text-[10px] text-warning", children: [run.iteration !== void 0 ? `iter ${run.iteration}` : null, run.phase ?? null].filter(Boolean).join(" \xB7 ") }),
|
|
2406
|
+
/* @__PURE__ */ jsxs6("span", { className: "flex shrink-0 items-center gap-1.5 font-mono text-[10px] tabular-nums text-muted-foreground/70", children: [
|
|
2407
|
+
tone !== "live" && tone !== "ok" && /* @__PURE__ */ jsx8("span", { children: run.status }),
|
|
2408
|
+
cost && /* @__PURE__ */ jsx8("span", { children: cost }),
|
|
2409
|
+
duration && /* @__PURE__ */ jsx8("span", { children: duration })
|
|
2699
2410
|
] })
|
|
2700
2411
|
] }, run.taskId);
|
|
2701
2412
|
}),
|
|
2702
|
-
/* @__PURE__ */
|
|
2413
|
+
/* @__PURE__ */ jsxs6(
|
|
2703
2414
|
"button",
|
|
2704
2415
|
{
|
|
2705
2416
|
type: "button",
|
|
2706
2417
|
onClick: () => setExpanded((v) => !v),
|
|
2707
2418
|
className: "flex items-center gap-1 py-0.5 text-[10px] font-medium text-muted-foreground/70 transition hover:text-foreground",
|
|
2708
2419
|
children: [
|
|
2709
|
-
/* @__PURE__ */
|
|
2420
|
+
/* @__PURE__ */ jsx8(ChevronGlyph, { className: `h-3 w-3 transition-transform ${expanded ? "rotate-180" : ""}` }),
|
|
2710
2421
|
"timeline"
|
|
2711
2422
|
]
|
|
2712
2423
|
}
|
|
2713
2424
|
),
|
|
2714
|
-
expanded && /* @__PURE__ */
|
|
2425
|
+
expanded && /* @__PURE__ */ jsx8("div", { className: "rounded-md border border-border/50 bg-muted/10 p-2", children: /* @__PURE__ */ jsx8(
|
|
2715
2426
|
FlowWaterfall,
|
|
2716
2427
|
{
|
|
2717
2428
|
trace: stepActivityFlowTrace(activity, {
|
|
@@ -2726,45 +2437,45 @@ function ActivityRow({
|
|
|
2726
2437
|
record,
|
|
2727
2438
|
renderMissionRef
|
|
2728
2439
|
}) {
|
|
2729
|
-
const [open, setOpen] =
|
|
2440
|
+
const [open, setOpen] = useState10(false);
|
|
2730
2441
|
const tone = activityTone(record.status);
|
|
2731
2442
|
const cost = formatActivityCost(record.costUsd);
|
|
2732
2443
|
const duration = formatActivityDuration(record.durationMs);
|
|
2733
|
-
return /* @__PURE__ */
|
|
2734
|
-
/* @__PURE__ */
|
|
2735
|
-
/* @__PURE__ */
|
|
2736
|
-
/* @__PURE__ */
|
|
2737
|
-
/* @__PURE__ */
|
|
2738
|
-
/* @__PURE__ */
|
|
2444
|
+
return /* @__PURE__ */ jsxs6("div", { className: "rounded-lg border border-border/60 bg-card", children: [
|
|
2445
|
+
/* @__PURE__ */ jsxs6("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: [
|
|
2446
|
+
/* @__PURE__ */ jsx8(StatusDot, { tone }),
|
|
2447
|
+
/* @__PURE__ */ jsxs6("span", { className: "min-w-0 flex-1 truncate", children: [
|
|
2448
|
+
/* @__PURE__ */ jsx8("span", { className: "font-medium", children: record.tool }),
|
|
2449
|
+
/* @__PURE__ */ jsxs6("span", { className: "text-muted-foreground", children: [
|
|
2739
2450
|
" \u2014 ",
|
|
2740
2451
|
record.detail
|
|
2741
2452
|
] })
|
|
2742
2453
|
] }),
|
|
2743
|
-
tone === "live" && (record.iteration !== void 0 || record.phase !== void 0) && /* @__PURE__ */
|
|
2744
|
-
/* @__PURE__ */
|
|
2454
|
+
tone === "live" && (record.iteration !== void 0 || record.phase !== void 0) && /* @__PURE__ */ jsx8("span", { className: "shrink-0 rounded-full bg-warning/10 px-2 py-0.5 font-mono text-[10px] text-warning", children: [record.iteration !== void 0 ? `iter ${record.iteration}` : null, record.phase ?? null].filter(Boolean).join(" \xB7 ") }),
|
|
2455
|
+
/* @__PURE__ */ jsx8(
|
|
2745
2456
|
"span",
|
|
2746
2457
|
{
|
|
2747
2458
|
className: `shrink-0 rounded-full px-2 py-0.5 text-[10px] font-medium ${tone === "ok" ? "bg-success/10 text-success" : tone === "error" ? "bg-destructive/10 text-destructive" : tone === "live" ? "bg-warning/10 text-warning" : "bg-muted/60 text-muted-foreground"}`,
|
|
2748
2459
|
children: record.status
|
|
2749
2460
|
}
|
|
2750
2461
|
),
|
|
2751
|
-
cost && /* @__PURE__ */
|
|
2752
|
-
/* @__PURE__ */
|
|
2462
|
+
cost && /* @__PURE__ */ jsx8("span", { className: "shrink-0 font-mono text-[11px] tabular-nums text-muted-foreground", children: cost }),
|
|
2463
|
+
/* @__PURE__ */ jsx8(ChevronGlyph, { className: `h-3 w-3 shrink-0 text-muted-foreground transition-transform ${open ? "rotate-180" : ""}` })
|
|
2753
2464
|
] }),
|
|
2754
|
-
open && /* @__PURE__ */
|
|
2755
|
-
record.durationMs !== void 0 && /* @__PURE__ */
|
|
2756
|
-
/* @__PURE__ */
|
|
2757
|
-
/* @__PURE__ */
|
|
2758
|
-
/* @__PURE__ */
|
|
2759
|
-
/* @__PURE__ */
|
|
2760
|
-
/* @__PURE__ */
|
|
2761
|
-
duration && /* @__PURE__ */
|
|
2762
|
-
/* @__PURE__ */
|
|
2763
|
-
/* @__PURE__ */
|
|
2465
|
+
open && /* @__PURE__ */ jsxs6("div", { className: "space-y-2.5 border-t border-border/40 px-3 py-2.5", children: [
|
|
2466
|
+
record.durationMs !== void 0 && /* @__PURE__ */ jsx8("div", { className: "rounded-md border border-border/50 bg-muted/10 p-2", children: /* @__PURE__ */ jsx8(FlowWaterfall, { trace: stepActivityFlowTrace([record]) }) }),
|
|
2467
|
+
/* @__PURE__ */ jsxs6("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 font-mono text-[11px]", children: [
|
|
2468
|
+
/* @__PURE__ */ jsx8("dt", { className: "text-muted-foreground/60", children: "task" }),
|
|
2469
|
+
/* @__PURE__ */ jsx8("dd", { className: "truncate text-muted-foreground", children: record.taskId }),
|
|
2470
|
+
/* @__PURE__ */ jsx8("dt", { className: "text-muted-foreground/60", children: "started" }),
|
|
2471
|
+
/* @__PURE__ */ jsx8("dd", { className: "text-muted-foreground", children: new Date(record.startedAt).toLocaleString() }),
|
|
2472
|
+
duration && /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
2473
|
+
/* @__PURE__ */ jsx8("dt", { className: "text-muted-foreground/60", children: "duration" }),
|
|
2474
|
+
/* @__PURE__ */ jsx8("dd", { className: "text-muted-foreground", children: duration })
|
|
2764
2475
|
] }),
|
|
2765
|
-
record.traceId && /* @__PURE__ */
|
|
2766
|
-
/* @__PURE__ */
|
|
2767
|
-
/* @__PURE__ */
|
|
2476
|
+
record.traceId && /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
2477
|
+
/* @__PURE__ */ jsx8("dt", { className: "text-muted-foreground/60", children: "trace" }),
|
|
2478
|
+
/* @__PURE__ */ jsx8("dd", { className: "min-w-0", children: /* @__PURE__ */ jsx8(TraceIdCopy, { traceId: record.traceId }) })
|
|
2768
2479
|
] })
|
|
2769
2480
|
] }),
|
|
2770
2481
|
record.missionRef && renderMissionRef?.(record.missionRef, record)
|
|
@@ -2772,10 +2483,10 @@ function ActivityRow({
|
|
|
2772
2483
|
] });
|
|
2773
2484
|
}
|
|
2774
2485
|
function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent activity", emptyLabel = "No agent runs yet." }) {
|
|
2775
|
-
const [rows, setRows] =
|
|
2776
|
-
const [cursor, setCursor] =
|
|
2777
|
-
const [status, setStatus] =
|
|
2778
|
-
const [error, setError] =
|
|
2486
|
+
const [rows, setRows] = useState10([]);
|
|
2487
|
+
const [cursor, setCursor] = useState10(void 0);
|
|
2488
|
+
const [status, setStatus] = useState10("loading");
|
|
2489
|
+
const [error, setError] = useState10(null);
|
|
2779
2490
|
const load = useCallback6(
|
|
2780
2491
|
async (from) => {
|
|
2781
2492
|
setStatus("loading");
|
|
@@ -2792,14 +2503,14 @@ function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent ac
|
|
|
2792
2503
|
},
|
|
2793
2504
|
[fetchActivity]
|
|
2794
2505
|
);
|
|
2795
|
-
|
|
2506
|
+
useEffect7(() => {
|
|
2796
2507
|
void load();
|
|
2797
2508
|
}, [load]);
|
|
2798
2509
|
const loading = status === "loading";
|
|
2799
|
-
return /* @__PURE__ */
|
|
2800
|
-
/* @__PURE__ */
|
|
2801
|
-
/* @__PURE__ */
|
|
2802
|
-
/* @__PURE__ */
|
|
2510
|
+
return /* @__PURE__ */ jsxs6("div", { className: "space-y-2", children: [
|
|
2511
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
|
|
2512
|
+
/* @__PURE__ */ jsx8("h2", { className: "flex-1 text-sm font-semibold", children: title }),
|
|
2513
|
+
/* @__PURE__ */ jsx8(
|
|
2803
2514
|
"button",
|
|
2804
2515
|
{
|
|
2805
2516
|
type: "button",
|
|
@@ -2807,15 +2518,15 @@ function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent ac
|
|
|
2807
2518
|
disabled: loading,
|
|
2808
2519
|
"aria-label": "Refresh",
|
|
2809
2520
|
className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-accent/30 hover:text-foreground disabled:opacity-50",
|
|
2810
|
-
children: /* @__PURE__ */
|
|
2521
|
+
children: /* @__PURE__ */ jsx8(RefreshGlyph, { className: `h-3.5 w-3.5 ${loading ? "animate-spin" : ""}` })
|
|
2811
2522
|
}
|
|
2812
2523
|
)
|
|
2813
2524
|
] }),
|
|
2814
|
-
status === "error" && /* @__PURE__ */
|
|
2815
|
-
status === "ready" && rows.length === 0 && /* @__PURE__ */
|
|
2816
|
-
/* @__PURE__ */
|
|
2817
|
-
/* @__PURE__ */
|
|
2818
|
-
cursor && /* @__PURE__ */
|
|
2525
|
+
status === "error" && /* @__PURE__ */ jsx8("p", { role: "alert", className: "rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive", children: error }),
|
|
2526
|
+
status === "ready" && rows.length === 0 && /* @__PURE__ */ jsx8("p", { className: "px-1 text-sm text-muted-foreground", children: emptyLabel }),
|
|
2527
|
+
/* @__PURE__ */ jsx8("span", { role: "status", "aria-live": "polite", "aria-busy": loading, className: "sr-only", children: loading ? "Loading activity\u2026" : "" }),
|
|
2528
|
+
/* @__PURE__ */ jsx8("div", { className: "space-y-1.5", "aria-busy": loading, children: rows.map((record) => /* @__PURE__ */ jsx8(ActivityRow, { record, renderMissionRef }, record.taskId)) }),
|
|
2529
|
+
cursor && /* @__PURE__ */ jsx8(
|
|
2819
2530
|
"button",
|
|
2820
2531
|
{
|
|
2821
2532
|
type: "button",
|
|
@@ -2829,7 +2540,7 @@ function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent ac
|
|
|
2829
2540
|
}
|
|
2830
2541
|
|
|
2831
2542
|
// src/web-react/provenance.tsx
|
|
2832
|
-
import { useCallback as useCallback7, useEffect as
|
|
2543
|
+
import { useCallback as useCallback7, useEffect as useEffect8, useId, useRef as useRef7, useState as useState11 } from "react";
|
|
2833
2544
|
|
|
2834
2545
|
// src/web-react/provenance-model.ts
|
|
2835
2546
|
var PROVENANCE_BASES = ["extracted", "entered", "computed", "asserted"];
|
|
@@ -2989,7 +2700,7 @@ function provenanceTriggerLabel(record, standing) {
|
|
|
2989
2700
|
}
|
|
2990
2701
|
|
|
2991
2702
|
// src/web-react/provenance.tsx
|
|
2992
|
-
import { jsx as
|
|
2703
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2993
2704
|
var BASIS_TONES = {
|
|
2994
2705
|
extracted: "border-primary/30 bg-primary/10 text-primary",
|
|
2995
2706
|
entered: "border-success/30 bg-success/10 text-success",
|
|
@@ -3014,27 +2725,27 @@ function BasisGlyph({ basis, className }) {
|
|
|
3014
2725
|
};
|
|
3015
2726
|
switch (basis) {
|
|
3016
2727
|
case "extracted":
|
|
3017
|
-
return /* @__PURE__ */
|
|
3018
|
-
/* @__PURE__ */
|
|
3019
|
-
/* @__PURE__ */
|
|
3020
|
-
/* @__PURE__ */
|
|
2728
|
+
return /* @__PURE__ */ jsxs7("svg", { ...shared, children: [
|
|
2729
|
+
/* @__PURE__ */ jsx9("path", { d: "M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z" }),
|
|
2730
|
+
/* @__PURE__ */ jsx9("polyline", { points: "14 3 14 8 19 8" }),
|
|
2731
|
+
/* @__PURE__ */ jsx9("line", { x1: "9", y1: "13", x2: "15", y2: "13" })
|
|
3021
2732
|
] });
|
|
3022
2733
|
case "entered":
|
|
3023
|
-
return /* @__PURE__ */
|
|
3024
|
-
/* @__PURE__ */
|
|
3025
|
-
/* @__PURE__ */
|
|
2734
|
+
return /* @__PURE__ */ jsxs7("svg", { ...shared, children: [
|
|
2735
|
+
/* @__PURE__ */ jsx9("path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }),
|
|
2736
|
+
/* @__PURE__ */ jsx9("circle", { cx: "12", cy: "7", r: "4" })
|
|
3026
2737
|
] });
|
|
3027
2738
|
case "computed":
|
|
3028
|
-
return /* @__PURE__ */
|
|
3029
|
-
/* @__PURE__ */
|
|
3030
|
-
/* @__PURE__ */
|
|
3031
|
-
/* @__PURE__ */
|
|
3032
|
-
/* @__PURE__ */
|
|
2739
|
+
return /* @__PURE__ */ jsxs7("svg", { ...shared, children: [
|
|
2740
|
+
/* @__PURE__ */ jsx9("line", { x1: "4", y1: "9", x2: "20", y2: "9" }),
|
|
2741
|
+
/* @__PURE__ */ jsx9("line", { x1: "4", y1: "15", x2: "20", y2: "15" }),
|
|
2742
|
+
/* @__PURE__ */ jsx9("line", { x1: "10", y1: "3", x2: "8", y2: "21" }),
|
|
2743
|
+
/* @__PURE__ */ jsx9("line", { x1: "16", y1: "3", x2: "14", y2: "21" })
|
|
3033
2744
|
] });
|
|
3034
2745
|
case "asserted":
|
|
3035
|
-
return /* @__PURE__ */
|
|
3036
|
-
/* @__PURE__ */
|
|
3037
|
-
/* @__PURE__ */
|
|
2746
|
+
return /* @__PURE__ */ jsxs7("svg", { ...shared, children: [
|
|
2747
|
+
/* @__PURE__ */ jsx9("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" }),
|
|
2748
|
+
/* @__PURE__ */ jsx9("circle", { cx: "12", cy: "12", r: "3.2" })
|
|
3038
2749
|
] });
|
|
3039
2750
|
}
|
|
3040
2751
|
}
|
|
@@ -3054,11 +2765,11 @@ function SourceRow({
|
|
|
3054
2765
|
const status = source.status ?? "ready";
|
|
3055
2766
|
const statusLine = describeProvenanceSourceStatus(source);
|
|
3056
2767
|
const openable = status === "ready" && (onOpenSource !== void 0 || source.href !== void 0);
|
|
3057
|
-
return /* @__PURE__ */
|
|
3058
|
-
/* @__PURE__ */
|
|
3059
|
-
/* @__PURE__ */
|
|
3060
|
-
source.locator && /* @__PURE__ */
|
|
3061
|
-
openable && (onOpenSource ? /* @__PURE__ */
|
|
2768
|
+
return /* @__PURE__ */ jsxs7("li", { className: "rounded-md border border-border/60 bg-background/40 px-2.5 py-2", children: [
|
|
2769
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap items-baseline gap-x-2 gap-y-1", children: [
|
|
2770
|
+
/* @__PURE__ */ jsx9("span", { className: "text-[13px] font-medium text-foreground", children: source.label }),
|
|
2771
|
+
source.locator && /* @__PURE__ */ jsx9("span", { className: "text-[11px] text-muted-foreground", children: source.locator }),
|
|
2772
|
+
openable && (onOpenSource ? /* @__PURE__ */ jsxs7(
|
|
3062
2773
|
"button",
|
|
3063
2774
|
{
|
|
3064
2775
|
type: "button",
|
|
@@ -3069,7 +2780,7 @@ function SourceRow({
|
|
|
3069
2780
|
source.label
|
|
3070
2781
|
]
|
|
3071
2782
|
}
|
|
3072
|
-
) : /* @__PURE__ */
|
|
2783
|
+
) : /* @__PURE__ */ jsxs7(
|
|
3073
2784
|
"a",
|
|
3074
2785
|
{
|
|
3075
2786
|
href: source.href,
|
|
@@ -3083,7 +2794,7 @@ function SourceRow({
|
|
|
3083
2794
|
}
|
|
3084
2795
|
))
|
|
3085
2796
|
] }),
|
|
3086
|
-
source.quote && /* @__PURE__ */
|
|
2797
|
+
source.quote && /* @__PURE__ */ jsxs7("blockquote", { className: "mt-1 border-l-2 border-primary/50 pl-2 text-[12px] italic leading-snug text-foreground", children: [
|
|
3087
2798
|
"\u201C",
|
|
3088
2799
|
source.quote,
|
|
3089
2800
|
"\u201D"
|
|
@@ -3092,14 +2803,14 @@ function SourceRow({
|
|
|
3092
2803
|
// update is theirs to read, not an interruption. Either way it is TEXT
|
|
3093
2804
|
// — a spinner alone and a greyed row alone both render as "nothing
|
|
3094
2805
|
// here".
|
|
3095
|
-
/* @__PURE__ */
|
|
2806
|
+
/* @__PURE__ */ jsxs7(
|
|
3096
2807
|
"p",
|
|
3097
2808
|
{
|
|
3098
2809
|
role: "status",
|
|
3099
2810
|
className: `mt-1 text-[11px] ${status === "unavailable" ? "text-destructive" : "text-muted-foreground"}`,
|
|
3100
2811
|
children: [
|
|
3101
2812
|
statusLine,
|
|
3102
|
-
status === "unavailable" && onRetrySource && /* @__PURE__ */
|
|
2813
|
+
status === "unavailable" && onRetrySource && /* @__PURE__ */ jsx9(
|
|
3103
2814
|
"button",
|
|
3104
2815
|
{
|
|
3105
2816
|
type: "button",
|
|
@@ -3123,9 +2834,9 @@ function ProvenanceValue({
|
|
|
3123
2834
|
missingValueLabel = DEFAULT_MISSING_VALUE_LABEL,
|
|
3124
2835
|
className
|
|
3125
2836
|
}) {
|
|
3126
|
-
const [open, setOpen] =
|
|
3127
|
-
const triggerRef =
|
|
3128
|
-
const rootRef =
|
|
2837
|
+
const [open, setOpen] = useState11(defaultOpen);
|
|
2838
|
+
const triggerRef = useRef7(null);
|
|
2839
|
+
const rootRef = useRef7(null);
|
|
3129
2840
|
const panelId = useId();
|
|
3130
2841
|
const standing = rollUpProvenanceStanding(record, confidencePolicy);
|
|
3131
2842
|
const basisMeta = provenanceBasisMeta(record.basis);
|
|
@@ -3148,7 +2859,7 @@ function ProvenanceValue({
|
|
|
3148
2859
|
if (!open) closeTrailsOutside(rootRef.current);
|
|
3149
2860
|
setOpen(!open);
|
|
3150
2861
|
}, [open]);
|
|
3151
|
-
|
|
2862
|
+
useEffect8(() => {
|
|
3152
2863
|
const root = rootRef.current;
|
|
3153
2864
|
if (!open || root === null) return;
|
|
3154
2865
|
const entry = { root, close: () => setOpen(false) };
|
|
@@ -3166,12 +2877,12 @@ function ProvenanceValue({
|
|
|
3166
2877
|
document.removeEventListener("touchstart", onPointerDown, true);
|
|
3167
2878
|
};
|
|
3168
2879
|
}, [open]);
|
|
3169
|
-
const summary = /* @__PURE__ */
|
|
3170
|
-
record.label && /* @__PURE__ */
|
|
3171
|
-
/* @__PURE__ */
|
|
2880
|
+
const summary = /* @__PURE__ */ jsxs7("span", { className: "inline-flex flex-wrap items-baseline gap-x-1.5", children: [
|
|
2881
|
+
record.label && /* @__PURE__ */ jsx9("span", { className: "text-[11px] text-muted-foreground", children: record.label }),
|
|
2882
|
+
/* @__PURE__ */ jsx9("span", { className: hasValue ? "text-sm text-foreground" : "text-sm italic text-muted-foreground", children: hasValue ? record.display : missingValueLabel })
|
|
3172
2883
|
] });
|
|
3173
2884
|
if (maxDepth <= 0) {
|
|
3174
|
-
return /* @__PURE__ */
|
|
2885
|
+
return /* @__PURE__ */ jsxs7(
|
|
3175
2886
|
"div",
|
|
3176
2887
|
{
|
|
3177
2888
|
className: `inline-block max-w-full ${className ?? ""}`,
|
|
@@ -3179,22 +2890,22 @@ function ProvenanceValue({
|
|
|
3179
2890
|
"data-provenance-standing": standing,
|
|
3180
2891
|
children: [
|
|
3181
2892
|
summary,
|
|
3182
|
-
/* @__PURE__ */
|
|
2893
|
+
/* @__PURE__ */ jsxs7(
|
|
3183
2894
|
"span",
|
|
3184
2895
|
{
|
|
3185
2896
|
className: `ml-1.5 inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px] font-medium ${BASIS_TONES[record.basis]}`,
|
|
3186
2897
|
children: [
|
|
3187
|
-
/* @__PURE__ */
|
|
2898
|
+
/* @__PURE__ */ jsx9(BasisGlyph, { basis: record.basis, className: "h-3 w-3" }),
|
|
3188
2899
|
basisMeta.label
|
|
3189
2900
|
]
|
|
3190
2901
|
}
|
|
3191
2902
|
),
|
|
3192
|
-
/* @__PURE__ */
|
|
2903
|
+
/* @__PURE__ */ jsx9("span", { className: "mt-0.5 block text-[11px] text-muted-foreground", children: describeProvenance(record) })
|
|
3193
2904
|
]
|
|
3194
2905
|
}
|
|
3195
2906
|
);
|
|
3196
2907
|
}
|
|
3197
|
-
return /* @__PURE__ */
|
|
2908
|
+
return /* @__PURE__ */ jsxs7(
|
|
3198
2909
|
"div",
|
|
3199
2910
|
{
|
|
3200
2911
|
ref: rootRef,
|
|
@@ -3203,9 +2914,9 @@ function ProvenanceValue({
|
|
|
3203
2914
|
"data-provenance-basis": record.basis,
|
|
3204
2915
|
"data-provenance-standing": standing,
|
|
3205
2916
|
children: [
|
|
3206
|
-
/* @__PURE__ */
|
|
2917
|
+
/* @__PURE__ */ jsxs7("span", { className: "inline-flex flex-wrap items-baseline gap-1.5", children: [
|
|
3207
2918
|
summary,
|
|
3208
|
-
/* @__PURE__ */
|
|
2919
|
+
/* @__PURE__ */ jsxs7(
|
|
3209
2920
|
"button",
|
|
3210
2921
|
{
|
|
3211
2922
|
ref: triggerRef,
|
|
@@ -3216,17 +2927,17 @@ function ProvenanceValue({
|
|
|
3216
2927
|
"aria-label": provenanceTriggerLabel(record, standing),
|
|
3217
2928
|
className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px] font-medium transition hover:brightness-105 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring ${BASIS_TONES[record.basis]}`,
|
|
3218
2929
|
children: [
|
|
3219
|
-
/* @__PURE__ */
|
|
3220
|
-
/* @__PURE__ */
|
|
2930
|
+
/* @__PURE__ */ jsx9(BasisGlyph, { basis: record.basis, className: "h-3 w-3" }),
|
|
2931
|
+
/* @__PURE__ */ jsx9("span", { "aria-hidden": true, children: basisMeta.label })
|
|
3221
2932
|
]
|
|
3222
2933
|
}
|
|
3223
2934
|
),
|
|
3224
2935
|
standing !== "settled" && // Legible at rest: what to do about the value does not wait for
|
|
3225
2936
|
// someone to open the panel. `aria-hidden` because the trigger's
|
|
3226
2937
|
// accessible name already carries it — this is the visual half.
|
|
3227
|
-
/* @__PURE__ */
|
|
2938
|
+
/* @__PURE__ */ jsx9("span", { "aria-hidden": true, className: `text-[10px] font-medium ${STANDING_TONES[standing]}`, children: standingMeta.label })
|
|
3228
2939
|
] }),
|
|
3229
|
-
open && /* @__PURE__ */
|
|
2940
|
+
open && /* @__PURE__ */ jsxs7(
|
|
3230
2941
|
"div",
|
|
3231
2942
|
{
|
|
3232
2943
|
id: panelId,
|
|
@@ -3234,19 +2945,19 @@ function ProvenanceValue({
|
|
|
3234
2945
|
"aria-label": provenanceTriggerLabel(record, standing),
|
|
3235
2946
|
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",
|
|
3236
2947
|
children: [
|
|
3237
|
-
/* @__PURE__ */
|
|
3238
|
-
/* @__PURE__ */
|
|
3239
|
-
/* @__PURE__ */
|
|
2948
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
2949
|
+
/* @__PURE__ */ jsx9("p", { className: "text-[12px] leading-snug text-foreground", children: describeProvenance(record) }),
|
|
2950
|
+
/* @__PURE__ */ jsxs7("p", { className: `mt-0.5 text-[11px] leading-snug ${STANDING_TONES[standing]}`, children: [
|
|
3240
2951
|
standingMeta.label,
|
|
3241
2952
|
" \u2014 ",
|
|
3242
2953
|
provenanceNextMove(record, standing, confidencePolicy)
|
|
3243
2954
|
] }),
|
|
3244
|
-
basisMeta.checkableAgainst === null && /* @__PURE__ */
|
|
2955
|
+
basisMeta.checkableAgainst === null && /* @__PURE__ */ jsxs7("p", { className: "mt-0.5 text-[11px] leading-snug text-muted-foreground", children: [
|
|
3245
2956
|
basisMeta.meaning,
|
|
3246
2957
|
" There is nothing outside the model to check it against."
|
|
3247
2958
|
] })
|
|
3248
2959
|
] }),
|
|
3249
|
-
sources.length > 0 && /* @__PURE__ */
|
|
2960
|
+
sources.length > 0 && /* @__PURE__ */ jsx9("ul", { className: "space-y-1.5", children: sources.map((source, index) => /* @__PURE__ */ jsx9(
|
|
3250
2961
|
SourceRow,
|
|
3251
2962
|
{
|
|
3252
2963
|
source,
|
|
@@ -3259,12 +2970,12 @@ function ProvenanceValue({
|
|
|
3259
2970
|
gaps.filter((gap) => gap.kind !== "unavailable-source").map((gap) => (
|
|
3260
2971
|
// An unavailable source already states itself on its own row; a
|
|
3261
2972
|
// structural gap has no row to state it, so it gets one here.
|
|
3262
|
-
/* @__PURE__ */
|
|
2973
|
+
/* @__PURE__ */ jsx9("p", { className: "rounded-md bg-destructive/10 px-2 py-1.5 text-[11px] leading-snug text-destructive", children: gap.message }, gap.kind)
|
|
3263
2974
|
)),
|
|
3264
|
-
loading.length > 0 && sources.length === 0 && /* @__PURE__ */
|
|
3265
|
-
inputs.length > 0 && /* @__PURE__ */
|
|
3266
|
-
/* @__PURE__ */
|
|
3267
|
-
/* @__PURE__ */
|
|
2975
|
+
loading.length > 0 && sources.length === 0 && /* @__PURE__ */ jsx9("p", { role: "status", className: "text-[11px] text-muted-foreground", children: "Looking up where this came from\u2026" }),
|
|
2976
|
+
inputs.length > 0 && /* @__PURE__ */ jsxs7("div", { className: "border-t border-border/60 pt-2", children: [
|
|
2977
|
+
/* @__PURE__ */ jsx9("p", { className: "text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: record.derivation ? `Computed from ${record.derivation}` : "Computed from" }),
|
|
2978
|
+
/* @__PURE__ */ jsx9("ul", { className: "mt-1.5 space-y-1.5", children: inputs.map((input, index) => /* @__PURE__ */ jsx9("li", { children: /* @__PURE__ */ jsx9(
|
|
3268
2979
|
ProvenanceValue,
|
|
3269
2980
|
{
|
|
3270
2981
|
record: input,
|
|
@@ -3285,26 +2996,26 @@ function ProvenanceValue({
|
|
|
3285
2996
|
}
|
|
3286
2997
|
function ProvenanceLegend({ bases, className }) {
|
|
3287
2998
|
if (bases.length === 0) return null;
|
|
3288
|
-
return /* @__PURE__ */
|
|
2999
|
+
return /* @__PURE__ */ jsx9("ul", { className: `flex flex-wrap items-center gap-x-3 gap-y-1.5 ${className ?? ""}`, children: bases.map((basis) => {
|
|
3289
3000
|
const meta = provenanceBasisMeta(basis);
|
|
3290
|
-
return /* @__PURE__ */
|
|
3291
|
-
/* @__PURE__ */
|
|
3001
|
+
return /* @__PURE__ */ jsxs7("li", { className: "flex items-center gap-1.5 text-[11px] text-muted-foreground", children: [
|
|
3002
|
+
/* @__PURE__ */ jsxs7(
|
|
3292
3003
|
"span",
|
|
3293
3004
|
{
|
|
3294
3005
|
className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px] font-medium ${BASIS_TONES[basis]}`,
|
|
3295
3006
|
children: [
|
|
3296
|
-
/* @__PURE__ */
|
|
3007
|
+
/* @__PURE__ */ jsx9(BasisGlyph, { basis, className: "h-3 w-3" }),
|
|
3297
3008
|
meta.label
|
|
3298
3009
|
]
|
|
3299
3010
|
}
|
|
3300
3011
|
),
|
|
3301
|
-
/* @__PURE__ */
|
|
3012
|
+
/* @__PURE__ */ jsx9("span", { children: meta.meaning })
|
|
3302
3013
|
] }, basis);
|
|
3303
3014
|
}) });
|
|
3304
3015
|
}
|
|
3305
3016
|
|
|
3306
3017
|
// src/web-react/seat-paywall.tsx
|
|
3307
|
-
import { Fragment as
|
|
3018
|
+
import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3308
3019
|
function usd(cents) {
|
|
3309
3020
|
return new Intl.NumberFormat("en-US", {
|
|
3310
3021
|
style: "currency",
|
|
@@ -3314,7 +3025,7 @@ function usd(cents) {
|
|
|
3314
3025
|
}).format(cents / 100);
|
|
3315
3026
|
}
|
|
3316
3027
|
function CheckGlyph3() {
|
|
3317
|
-
return /* @__PURE__ */
|
|
3028
|
+
return /* @__PURE__ */ jsx10(
|
|
3318
3029
|
"svg",
|
|
3319
3030
|
{
|
|
3320
3031
|
className: "h-4 w-4 shrink-0 text-primary",
|
|
@@ -3325,14 +3036,14 @@ function CheckGlyph3() {
|
|
|
3325
3036
|
strokeLinecap: "round",
|
|
3326
3037
|
strokeLinejoin: "round",
|
|
3327
3038
|
"aria-hidden": true,
|
|
3328
|
-
children: /* @__PURE__ */
|
|
3039
|
+
children: /* @__PURE__ */ jsx10("path", { d: "M20 6 9 17l-5-5" })
|
|
3329
3040
|
}
|
|
3330
3041
|
);
|
|
3331
3042
|
}
|
|
3332
3043
|
function Benefit({ children }) {
|
|
3333
|
-
return /* @__PURE__ */
|
|
3334
|
-
/* @__PURE__ */
|
|
3335
|
-
/* @__PURE__ */
|
|
3044
|
+
return /* @__PURE__ */ jsxs8("li", { className: "flex items-start gap-2.5 text-sm text-foreground", children: [
|
|
3045
|
+
/* @__PURE__ */ jsx10("span", { className: "mt-0.5", children: /* @__PURE__ */ jsx10(CheckGlyph3, {}) }),
|
|
3046
|
+
/* @__PURE__ */ jsx10("span", { children })
|
|
3336
3047
|
] });
|
|
3337
3048
|
}
|
|
3338
3049
|
function SeatPaywall({
|
|
@@ -3350,46 +3061,46 @@ function SeatPaywall({
|
|
|
3350
3061
|
const recurringPrice = offer ? usd(offer.recurring.priceCents) : `$${priceUsd}`;
|
|
3351
3062
|
const recurringUsage = offer ? usd(offer.recurring.includedCreditsCents) : `$${includedUsageUsd}`;
|
|
3352
3063
|
const introductory = offer?.introductory ?? null;
|
|
3353
|
-
return /* @__PURE__ */
|
|
3354
|
-
/* @__PURE__ */
|
|
3355
|
-
/* @__PURE__ */
|
|
3064
|
+
return /* @__PURE__ */ jsx10("div", { className: "flex min-h-[60vh] w-full items-center justify-center p-6", children: /* @__PURE__ */ jsxs8("div", { className: "w-full max-w-md rounded-2xl border border-border bg-card p-8 shadow-sm", children: [
|
|
3065
|
+
/* @__PURE__ */ jsx10("p", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: product }),
|
|
3066
|
+
/* @__PURE__ */ jsxs8("h1", { className: "mt-2 text-2xl font-semibold tracking-tight text-foreground", children: [
|
|
3356
3067
|
"Unlock ",
|
|
3357
3068
|
product
|
|
3358
3069
|
] }),
|
|
3359
|
-
tagline && /* @__PURE__ */
|
|
3360
|
-
introductory ? /* @__PURE__ */
|
|
3361
|
-
/* @__PURE__ */
|
|
3362
|
-
/* @__PURE__ */
|
|
3363
|
-
/* @__PURE__ */
|
|
3070
|
+
tagline && /* @__PURE__ */ jsx10("p", { className: "mt-2 text-sm text-muted-foreground", children: tagline }),
|
|
3071
|
+
introductory ? /* @__PURE__ */ jsxs8(Fragment4, { children: [
|
|
3072
|
+
/* @__PURE__ */ jsxs8("div", { className: "mt-6 flex items-baseline gap-1.5", children: [
|
|
3073
|
+
/* @__PURE__ */ jsx10("span", { className: "text-3xl font-semibold text-foreground", children: usd(introductory.priceCents) }),
|
|
3074
|
+
/* @__PURE__ */ jsx10("span", { className: "text-sm text-muted-foreground", children: "first month" })
|
|
3364
3075
|
] }),
|
|
3365
|
-
/* @__PURE__ */
|
|
3076
|
+
/* @__PURE__ */ jsxs8("p", { className: "mt-1 text-sm text-muted-foreground", children: [
|
|
3366
3077
|
"Includes ",
|
|
3367
3078
|
usd(introductory.includedCreditsCents),
|
|
3368
3079
|
" of AI usage in your first month"
|
|
3369
3080
|
] }),
|
|
3370
|
-
/* @__PURE__ */
|
|
3081
|
+
/* @__PURE__ */ jsxs8("p", { className: "mt-1 text-sm text-muted-foreground", children: [
|
|
3371
3082
|
"Then ",
|
|
3372
3083
|
recurringPrice,
|
|
3373
3084
|
"/mo \xB7 includes ",
|
|
3374
3085
|
recurringUsage,
|
|
3375
3086
|
"/mo of AI usage"
|
|
3376
3087
|
] })
|
|
3377
|
-
] }) : /* @__PURE__ */
|
|
3378
|
-
/* @__PURE__ */
|
|
3379
|
-
/* @__PURE__ */
|
|
3380
|
-
/* @__PURE__ */
|
|
3088
|
+
] }) : /* @__PURE__ */ jsxs8(Fragment4, { children: [
|
|
3089
|
+
/* @__PURE__ */ jsxs8("div", { className: "mt-6 flex items-baseline gap-1.5", children: [
|
|
3090
|
+
/* @__PURE__ */ jsx10("span", { className: "text-3xl font-semibold text-foreground", children: recurringPrice }),
|
|
3091
|
+
/* @__PURE__ */ jsx10("span", { className: "text-sm text-muted-foreground", children: "/mo" })
|
|
3381
3092
|
] }),
|
|
3382
|
-
/* @__PURE__ */
|
|
3093
|
+
/* @__PURE__ */ jsxs8("p", { className: "mt-1 text-sm text-muted-foreground", children: [
|
|
3383
3094
|
"Includes ",
|
|
3384
3095
|
recurringUsage,
|
|
3385
3096
|
"/mo of AI usage"
|
|
3386
3097
|
] })
|
|
3387
3098
|
] }),
|
|
3388
|
-
/* @__PURE__ */
|
|
3099
|
+
/* @__PURE__ */ jsx10("ul", { className: "mt-6 space-y-2.5", children: (benefits ?? [
|
|
3389
3100
|
`Full access to ${product}`,
|
|
3390
3101
|
`${recurringUsage}/mo of AI usage included`
|
|
3391
|
-
]).map((benefit, i) => /* @__PURE__ */
|
|
3392
|
-
/* @__PURE__ */
|
|
3102
|
+
]).map((benefit, i) => /* @__PURE__ */ jsx10(Benefit, { children: benefit }, i)) }),
|
|
3103
|
+
/* @__PURE__ */ jsx10(
|
|
3393
3104
|
"button",
|
|
3394
3105
|
{
|
|
3395
3106
|
type: "button",
|
|
@@ -3399,32 +3110,32 @@ function SeatPaywall({
|
|
|
3399
3110
|
children: pending ? "Opening checkout\u2026" : ctaLabel ?? `Unlock ${product}`
|
|
3400
3111
|
}
|
|
3401
3112
|
),
|
|
3402
|
-
footnote && /* @__PURE__ */
|
|
3113
|
+
footnote && /* @__PURE__ */ jsx10("p", { className: "mt-3 text-center text-xs text-muted-foreground/70", children: footnote })
|
|
3403
3114
|
] }) });
|
|
3404
3115
|
}
|
|
3405
3116
|
|
|
3406
3117
|
// src/web-react/session-history.tsx
|
|
3407
3118
|
import {
|
|
3408
3119
|
useCallback as useCallback8,
|
|
3409
|
-
useEffect as
|
|
3410
|
-
useMemo as
|
|
3411
|
-
useRef as
|
|
3412
|
-
useState as
|
|
3120
|
+
useEffect as useEffect9,
|
|
3121
|
+
useMemo as useMemo5,
|
|
3122
|
+
useRef as useRef8,
|
|
3123
|
+
useState as useState12
|
|
3413
3124
|
} from "react";
|
|
3414
|
-
import { Fragment as
|
|
3125
|
+
import { Fragment as Fragment5, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3415
3126
|
function rethrowAsync(error) {
|
|
3416
3127
|
queueMicrotask(() => {
|
|
3417
3128
|
throw error;
|
|
3418
3129
|
});
|
|
3419
3130
|
}
|
|
3420
3131
|
function useInfiniteScroll(onLoadMore, { enabled, root, rootMargin = "300px" }) {
|
|
3421
|
-
const [sentinel, setSentinel] =
|
|
3132
|
+
const [sentinel, setSentinel] = useState12(null);
|
|
3422
3133
|
const sentinelRef = useCallback8((node) => setSentinel(node), []);
|
|
3423
|
-
const onLoadMoreRef =
|
|
3424
|
-
|
|
3134
|
+
const onLoadMoreRef = useRef8(onLoadMore);
|
|
3135
|
+
useEffect9(() => {
|
|
3425
3136
|
onLoadMoreRef.current = onLoadMore;
|
|
3426
3137
|
}, [onLoadMore]);
|
|
3427
|
-
|
|
3138
|
+
useEffect9(() => {
|
|
3428
3139
|
if (!sentinel || !enabled) return;
|
|
3429
3140
|
if (typeof IntersectionObserver === "undefined") return;
|
|
3430
3141
|
const observer = new IntersectionObserver(
|
|
@@ -3453,24 +3164,24 @@ function useSessionHistory({
|
|
|
3453
3164
|
initialPage,
|
|
3454
3165
|
defaultSort = "newest"
|
|
3455
3166
|
}) {
|
|
3456
|
-
const [items, setItems] =
|
|
3457
|
-
const [nextCursor, setNextCursor] =
|
|
3458
|
-
const [phase, setPhase] =
|
|
3459
|
-
const [reloadKey, setReloadKey] =
|
|
3460
|
-
const seqRef =
|
|
3461
|
-
const resetAbortRef =
|
|
3462
|
-
const loadMoreAbortRef =
|
|
3463
|
-
const loadingMoreRef =
|
|
3464
|
-
const lastOpRef =
|
|
3465
|
-
const nextCursorRef =
|
|
3167
|
+
const [items, setItems] = useState12(initialPage.items);
|
|
3168
|
+
const [nextCursor, setNextCursor] = useState12(initialPage.nextCursor ?? null);
|
|
3169
|
+
const [phase, setPhase] = useState12("idle");
|
|
3170
|
+
const [reloadKey, setReloadKey] = useState12(0);
|
|
3171
|
+
const seqRef = useRef8(0);
|
|
3172
|
+
const resetAbortRef = useRef8(null);
|
|
3173
|
+
const loadMoreAbortRef = useRef8(null);
|
|
3174
|
+
const loadingMoreRef = useRef8(false);
|
|
3175
|
+
const lastOpRef = useRef8("first");
|
|
3176
|
+
const nextCursorRef = useRef8(nextCursor);
|
|
3466
3177
|
nextCursorRef.current = nextCursor;
|
|
3467
|
-
const viewRef =
|
|
3178
|
+
const viewRef = useRef8({ q, sort, fetchPage });
|
|
3468
3179
|
viewRef.current = { q, sort, fetchPage };
|
|
3469
|
-
const seedRef =
|
|
3180
|
+
const seedRef = useRef8(initialPage);
|
|
3470
3181
|
seedRef.current = initialPage;
|
|
3471
3182
|
const isDefaultView = q === "" && sort === defaultSort;
|
|
3472
|
-
const seedKey =
|
|
3473
|
-
|
|
3183
|
+
const seedKey = useMemo5(() => seedSignature(initialPage), [initialPage]);
|
|
3184
|
+
useEffect9(() => {
|
|
3474
3185
|
resetAbortRef.current?.abort();
|
|
3475
3186
|
loadMoreAbortRef.current?.abort();
|
|
3476
3187
|
loadingMoreRef.current = false;
|
|
@@ -3533,7 +3244,7 @@ function useSessionHistory({
|
|
|
3533
3244
|
const reload = useCallback8(() => {
|
|
3534
3245
|
setReloadKey((key) => key + 1);
|
|
3535
3246
|
}, []);
|
|
3536
|
-
|
|
3247
|
+
useEffect9(
|
|
3537
3248
|
() => () => {
|
|
3538
3249
|
resetAbortRef.current?.abort();
|
|
3539
3250
|
loadMoreAbortRef.current?.abort();
|
|
@@ -3574,11 +3285,11 @@ function useSessionActions({
|
|
|
3574
3285
|
labels
|
|
3575
3286
|
}) {
|
|
3576
3287
|
const text = { ...DEFAULT_LABELS, ...labels };
|
|
3577
|
-
const [renameTarget, setRenameTarget] =
|
|
3578
|
-
const [renameValue, setRenameValue] =
|
|
3579
|
-
const [deleteTarget, setDeleteTarget] =
|
|
3580
|
-
const [busy, setBusy] =
|
|
3581
|
-
const [error, setError] =
|
|
3288
|
+
const [renameTarget, setRenameTarget] = useState12(null);
|
|
3289
|
+
const [renameValue, setRenameValue] = useState12("");
|
|
3290
|
+
const [deleteTarget, setDeleteTarget] = useState12(null);
|
|
3291
|
+
const [busy, setBusy] = useState12(false);
|
|
3292
|
+
const [error, setError] = useState12(null);
|
|
3582
3293
|
const openRename = useCallback8((session) => {
|
|
3583
3294
|
setError(null);
|
|
3584
3295
|
setRenameTarget(session);
|
|
@@ -3629,21 +3340,21 @@ function useSessionActions({
|
|
|
3629
3340
|
setBusy(false);
|
|
3630
3341
|
}
|
|
3631
3342
|
}, [deleteTarget, currentSessionId, deleteSession, notify, onChanged, onDeletedCurrent, text.deleted, text.deleteFailed]);
|
|
3632
|
-
const dialogs = /* @__PURE__ */
|
|
3633
|
-
renameTarget && /* @__PURE__ */
|
|
3343
|
+
const dialogs = /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
3344
|
+
renameTarget && /* @__PURE__ */ jsxs9(
|
|
3634
3345
|
SessionDialog,
|
|
3635
3346
|
{
|
|
3636
3347
|
title: text.renameTitle,
|
|
3637
3348
|
onClose: () => setRenameTarget(null),
|
|
3638
3349
|
busy,
|
|
3639
3350
|
error,
|
|
3640
|
-
footer: /* @__PURE__ */
|
|
3641
|
-
/* @__PURE__ */
|
|
3642
|
-
/* @__PURE__ */
|
|
3351
|
+
footer: /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
3352
|
+
/* @__PURE__ */ jsx11(DialogButton, { onClick: () => setRenameTarget(null), disabled: busy, variant: "ghost", children: text.cancel }),
|
|
3353
|
+
/* @__PURE__ */ jsx11(DialogButton, { onClick: () => void submitRename(), disabled: busy || !renameValue.trim(), children: text.renameSubmit })
|
|
3643
3354
|
] }),
|
|
3644
3355
|
children: [
|
|
3645
|
-
/* @__PURE__ */
|
|
3646
|
-
/* @__PURE__ */
|
|
3356
|
+
/* @__PURE__ */ jsx11("label", { htmlFor: "agent-app-rename-session", className: "text-xs text-muted-foreground", children: text.renameField }),
|
|
3357
|
+
/* @__PURE__ */ jsx11(
|
|
3647
3358
|
"input",
|
|
3648
3359
|
{
|
|
3649
3360
|
id: "agent-app-rename-session",
|
|
@@ -3662,18 +3373,18 @@ function useSessionActions({
|
|
|
3662
3373
|
]
|
|
3663
3374
|
}
|
|
3664
3375
|
),
|
|
3665
|
-
deleteTarget && /* @__PURE__ */
|
|
3376
|
+
deleteTarget && /* @__PURE__ */ jsx11(
|
|
3666
3377
|
SessionDialog,
|
|
3667
3378
|
{
|
|
3668
3379
|
title: text.deleteTitle,
|
|
3669
3380
|
onClose: () => setDeleteTarget(null),
|
|
3670
3381
|
busy,
|
|
3671
3382
|
error,
|
|
3672
|
-
footer: /* @__PURE__ */
|
|
3673
|
-
/* @__PURE__ */
|
|
3674
|
-
/* @__PURE__ */
|
|
3383
|
+
footer: /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
3384
|
+
/* @__PURE__ */ jsx11(DialogButton, { onClick: () => setDeleteTarget(null), disabled: busy, variant: "ghost", children: text.cancel }),
|
|
3385
|
+
/* @__PURE__ */ jsx11(DialogButton, { onClick: () => void confirmDelete(), disabled: busy, variant: "destructive", children: text.deleteSubmit })
|
|
3675
3386
|
] }),
|
|
3676
|
-
children: /* @__PURE__ */
|
|
3387
|
+
children: /* @__PURE__ */ jsx11("p", { className: "text-sm text-muted-foreground", children: text.deleteBody(sessionLabel(deleteTarget)) })
|
|
3677
3388
|
}
|
|
3678
3389
|
)
|
|
3679
3390
|
] });
|
|
@@ -3686,7 +3397,7 @@ function DialogButton({
|
|
|
3686
3397
|
variant = "primary"
|
|
3687
3398
|
}) {
|
|
3688
3399
|
const tone = variant === "ghost" ? "text-muted-foreground hover:bg-accent/30 hover:text-foreground" : variant === "destructive" ? "bg-destructive text-destructive-foreground hover:opacity-90" : "bg-primary text-primary-foreground hover:opacity-90";
|
|
3689
|
-
return /* @__PURE__ */
|
|
3400
|
+
return /* @__PURE__ */ jsx11(
|
|
3690
3401
|
"button",
|
|
3691
3402
|
{
|
|
3692
3403
|
type: "button",
|
|
@@ -3705,15 +3416,15 @@ function SessionDialog({
|
|
|
3705
3416
|
busy,
|
|
3706
3417
|
error
|
|
3707
3418
|
}) {
|
|
3708
|
-
|
|
3419
|
+
useEffect9(() => {
|
|
3709
3420
|
const onKey = (e) => {
|
|
3710
3421
|
if (e.key === "Escape" && !busy) onClose();
|
|
3711
3422
|
};
|
|
3712
3423
|
document.addEventListener("keydown", onKey);
|
|
3713
3424
|
return () => document.removeEventListener("keydown", onKey);
|
|
3714
3425
|
}, [busy, onClose]);
|
|
3715
|
-
return /* @__PURE__ */
|
|
3716
|
-
/* @__PURE__ */
|
|
3426
|
+
return /* @__PURE__ */ jsxs9("div", { className: "fixed inset-0 z-50 flex items-center justify-center p-4", children: [
|
|
3427
|
+
/* @__PURE__ */ jsx11(
|
|
3717
3428
|
"div",
|
|
3718
3429
|
{
|
|
3719
3430
|
className: "absolute inset-0 bg-black/50",
|
|
@@ -3723,7 +3434,7 @@ function SessionDialog({
|
|
|
3723
3434
|
"aria-hidden": true
|
|
3724
3435
|
}
|
|
3725
3436
|
),
|
|
3726
|
-
/* @__PURE__ */
|
|
3437
|
+
/* @__PURE__ */ jsxs9(
|
|
3727
3438
|
"div",
|
|
3728
3439
|
{
|
|
3729
3440
|
role: "dialog",
|
|
@@ -3731,17 +3442,17 @@ function SessionDialog({
|
|
|
3731
3442
|
"aria-label": title,
|
|
3732
3443
|
className: "relative w-full max-w-sm rounded-xl border border-border bg-card p-5 shadow-lg",
|
|
3733
3444
|
children: [
|
|
3734
|
-
/* @__PURE__ */
|
|
3735
|
-
/* @__PURE__ */
|
|
3736
|
-
error && /* @__PURE__ */
|
|
3737
|
-
/* @__PURE__ */
|
|
3445
|
+
/* @__PURE__ */ jsx11("h2", { className: "text-sm font-semibold text-foreground", children: title }),
|
|
3446
|
+
/* @__PURE__ */ jsx11("div", { className: "mt-3", children }),
|
|
3447
|
+
error && /* @__PURE__ */ jsx11("p", { role: "alert", className: "mt-3 rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive", children: error }),
|
|
3448
|
+
/* @__PURE__ */ jsx11("div", { className: "mt-5 flex justify-end gap-2", children: footer })
|
|
3738
3449
|
]
|
|
3739
3450
|
}
|
|
3740
3451
|
)
|
|
3741
3452
|
] });
|
|
3742
3453
|
}
|
|
3743
3454
|
function AnchorLink({ to, className, children }) {
|
|
3744
|
-
return /* @__PURE__ */
|
|
3455
|
+
return /* @__PURE__ */ jsx11("a", { href: to, className, children });
|
|
3745
3456
|
}
|
|
3746
3457
|
var MINUTE = 6e4;
|
|
3747
3458
|
var HOUR = 60 * MINUTE;
|
|
@@ -3758,17 +3469,17 @@ function formatSessionTimestamp(isoDate) {
|
|
|
3758
3469
|
return new Date(at).toLocaleDateString(void 0, { month: "short", day: "numeric" });
|
|
3759
3470
|
}
|
|
3760
3471
|
function SkeletonRows() {
|
|
3761
|
-
return /* @__PURE__ */
|
|
3762
|
-
/* @__PURE__ */
|
|
3763
|
-
/* @__PURE__ */
|
|
3764
|
-
/* @__PURE__ */
|
|
3765
|
-
/* @__PURE__ */
|
|
3766
|
-
/* @__PURE__ */
|
|
3472
|
+
return /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
3473
|
+
/* @__PURE__ */ jsx11("span", { role: "status", "aria-live": "polite", "aria-busy": true, className: "sr-only", children: "Loading sessions\u2026" }),
|
|
3474
|
+
/* @__PURE__ */ jsx11("div", { className: "flex flex-col gap-0.5", "aria-hidden": true, children: Array.from({ length: 8 }).map((_, i) => /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-3 px-3 py-2.5", children: [
|
|
3475
|
+
/* @__PURE__ */ jsx11("div", { className: "h-4 w-4 animate-pulse rounded bg-muted" }),
|
|
3476
|
+
/* @__PURE__ */ jsx11("div", { className: "h-4 w-1/2 animate-pulse rounded bg-muted" }),
|
|
3477
|
+
/* @__PURE__ */ jsx11("div", { className: "ml-auto h-3 w-12 animate-pulse rounded bg-muted" })
|
|
3767
3478
|
] }, i)) })
|
|
3768
3479
|
] });
|
|
3769
3480
|
}
|
|
3770
3481
|
function MessageIcon({ className }) {
|
|
3771
|
-
return /* @__PURE__ */
|
|
3482
|
+
return /* @__PURE__ */ jsx11("svg", { viewBox: "0 0 24 24", className, fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx11("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }) });
|
|
3772
3483
|
}
|
|
3773
3484
|
function SessionHistoryPanel({
|
|
3774
3485
|
history,
|
|
@@ -3795,7 +3506,7 @@ function SessionHistoryPanel({
|
|
|
3795
3506
|
contentWidth = "reading",
|
|
3796
3507
|
className
|
|
3797
3508
|
}) {
|
|
3798
|
-
const scrollRef =
|
|
3509
|
+
const scrollRef = useRef8(null);
|
|
3799
3510
|
const sentinelRef = useInfiniteScroll(history.loadMore, {
|
|
3800
3511
|
enabled: history.hasMore && !history.isLoadingMore && !history.isError,
|
|
3801
3512
|
root: scrollRef,
|
|
@@ -3804,15 +3515,15 @@ function SessionHistoryPanel({
|
|
|
3804
3515
|
const searchTerm = query.trim();
|
|
3805
3516
|
const isSearching = searchTerm.length > 0;
|
|
3806
3517
|
const column = contentWidth === "full" ? "w-full" : "mx-auto w-full max-w-4xl";
|
|
3807
|
-
const [selectedIds, setSelectedIds] =
|
|
3808
|
-
const [ageDays, setAgeDays] =
|
|
3809
|
-
const [bulkTarget, setBulkTarget] =
|
|
3810
|
-
const [bulkBusy, setBulkBusy] =
|
|
3811
|
-
const [bulkError, setBulkError] =
|
|
3812
|
-
|
|
3518
|
+
const [selectedIds, setSelectedIds] = useState12(/* @__PURE__ */ new Set());
|
|
3519
|
+
const [ageDays, setAgeDays] = useState12("30");
|
|
3520
|
+
const [bulkTarget, setBulkTarget] = useState12(null);
|
|
3521
|
+
const [bulkBusy, setBulkBusy] = useState12(false);
|
|
3522
|
+
const [bulkError, setBulkError] = useState12(null);
|
|
3523
|
+
useEffect9(() => {
|
|
3813
3524
|
setSelectedIds(/* @__PURE__ */ new Set());
|
|
3814
3525
|
}, [searchTerm, sort]);
|
|
3815
|
-
|
|
3526
|
+
useEffect9(() => {
|
|
3816
3527
|
const visible = new Set(history.items.map((item) => item.id));
|
|
3817
3528
|
setSelectedIds((current) => {
|
|
3818
3529
|
const next = new Set([...current].filter((id) => visible.has(id)));
|
|
@@ -3855,25 +3566,25 @@ function SessionHistoryPanel({
|
|
|
3855
3566
|
setBulkBusy(false);
|
|
3856
3567
|
}
|
|
3857
3568
|
}, [bulkTarget, deleteLabel, history, onBulkAction]);
|
|
3858
|
-
return /* @__PURE__ */
|
|
3859
|
-
/* @__PURE__ */
|
|
3860
|
-
/* @__PURE__ */
|
|
3861
|
-
newSessionHref && /* @__PURE__ */
|
|
3569
|
+
return /* @__PURE__ */ jsxs9("div", { className: `flex min-h-0 min-w-0 flex-1 flex-col ${className ?? ""}`, children: [
|
|
3570
|
+
/* @__PURE__ */ jsx11("header", { className: "flex h-14 shrink-0 items-center border-b border-border px-4 sm:px-6", children: /* @__PURE__ */ jsxs9("div", { className: `flex items-center gap-3 px-3 ${column}`, children: [
|
|
3571
|
+
/* @__PURE__ */ jsx11("h1", { className: "flex-1 truncate text-sm font-semibold text-foreground", children: title }),
|
|
3572
|
+
newSessionHref && /* @__PURE__ */ jsxs9(
|
|
3862
3573
|
Link,
|
|
3863
3574
|
{
|
|
3864
3575
|
to: newSessionHref,
|
|
3865
3576
|
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",
|
|
3866
3577
|
children: [
|
|
3867
|
-
/* @__PURE__ */
|
|
3578
|
+
/* @__PURE__ */ jsx11("span", { "aria-hidden": true, className: "text-sm leading-none", children: "+" }),
|
|
3868
3579
|
"New chat"
|
|
3869
3580
|
]
|
|
3870
3581
|
}
|
|
3871
3582
|
)
|
|
3872
3583
|
] }) }),
|
|
3873
|
-
/* @__PURE__ */
|
|
3874
|
-
hasAnySessions && /* @__PURE__ */
|
|
3875
|
-
/* @__PURE__ */
|
|
3876
|
-
/* @__PURE__ */
|
|
3584
|
+
/* @__PURE__ */ jsxs9("div", { ref: scrollRef, className: "min-h-0 flex-1 overflow-y-auto", children: [
|
|
3585
|
+
hasAnySessions && /* @__PURE__ */ jsxs9("div", { className: "sticky top-0 z-10 bg-background px-4 sm:px-6", children: [
|
|
3586
|
+
/* @__PURE__ */ jsxs9("div", { className: `flex flex-col gap-2 px-3 pb-3 pt-4 sm:flex-row sm:items-center sm:gap-3 ${column}`, children: [
|
|
3587
|
+
/* @__PURE__ */ jsx11(
|
|
3877
3588
|
"input",
|
|
3878
3589
|
{
|
|
3879
3590
|
type: "search",
|
|
@@ -3884,7 +3595,7 @@ function SessionHistoryPanel({
|
|
|
3884
3595
|
className: "h-9 min-w-0 appearance-none rounded-md border border-border bg-card px-3 text-sm text-foreground placeholder:text-muted-foreground sm:flex-1 [&::-webkit-search-cancel-button]:appearance-none"
|
|
3885
3596
|
}
|
|
3886
3597
|
),
|
|
3887
|
-
/* @__PURE__ */
|
|
3598
|
+
/* @__PURE__ */ jsxs9(
|
|
3888
3599
|
"select",
|
|
3889
3600
|
{
|
|
3890
3601
|
value: sort,
|
|
@@ -3892,15 +3603,15 @@ function SessionHistoryPanel({
|
|
|
3892
3603
|
"aria-label": "Sort sessions",
|
|
3893
3604
|
className: "h-9 shrink-0 appearance-none rounded-md border border-border bg-card px-2 text-sm text-foreground sm:w-[132px]",
|
|
3894
3605
|
children: [
|
|
3895
|
-
/* @__PURE__ */
|
|
3896
|
-
/* @__PURE__ */
|
|
3606
|
+
/* @__PURE__ */ jsx11("option", { value: "newest", children: "Newest" }),
|
|
3607
|
+
/* @__PURE__ */ jsx11("option", { value: "oldest", children: "Oldest" })
|
|
3897
3608
|
]
|
|
3898
3609
|
}
|
|
3899
3610
|
)
|
|
3900
3611
|
] }),
|
|
3901
|
-
onBulkAction && /* @__PURE__ */
|
|
3902
|
-
/* @__PURE__ */
|
|
3903
|
-
/* @__PURE__ */
|
|
3612
|
+
onBulkAction && /* @__PURE__ */ jsxs9("div", { className: `flex flex-col gap-2 border-t border-border/60 px-3 py-3 ${column}`, children: [
|
|
3613
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
3614
|
+
/* @__PURE__ */ jsx11(
|
|
3904
3615
|
"button",
|
|
3905
3616
|
{
|
|
3906
3617
|
type: "button",
|
|
@@ -3910,7 +3621,7 @@ function SessionHistoryPanel({
|
|
|
3910
3621
|
children: "Select all"
|
|
3911
3622
|
}
|
|
3912
3623
|
),
|
|
3913
|
-
/* @__PURE__ */
|
|
3624
|
+
/* @__PURE__ */ jsx11(
|
|
3914
3625
|
"button",
|
|
3915
3626
|
{
|
|
3916
3627
|
type: "button",
|
|
@@ -3920,11 +3631,11 @@ function SessionHistoryPanel({
|
|
|
3920
3631
|
children: "Deselect all"
|
|
3921
3632
|
}
|
|
3922
3633
|
),
|
|
3923
|
-
/* @__PURE__ */
|
|
3634
|
+
/* @__PURE__ */ jsxs9("span", { className: "text-xs text-muted-foreground", "aria-live": "polite", children: [
|
|
3924
3635
|
selectedCount,
|
|
3925
3636
|
" selected"
|
|
3926
3637
|
] }),
|
|
3927
|
-
selectedCount > 0 && /* @__PURE__ */
|
|
3638
|
+
selectedCount > 0 && /* @__PURE__ */ jsxs9(
|
|
3928
3639
|
"button",
|
|
3929
3640
|
{
|
|
3930
3641
|
type: "button",
|
|
@@ -3937,9 +3648,9 @@ function SessionHistoryPanel({
|
|
|
3937
3648
|
}
|
|
3938
3649
|
)
|
|
3939
3650
|
] }),
|
|
3940
|
-
/* @__PURE__ */
|
|
3941
|
-
/* @__PURE__ */
|
|
3942
|
-
/* @__PURE__ */
|
|
3651
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
3652
|
+
/* @__PURE__ */ jsx11("label", { htmlFor: "agent-app-session-age", className: "text-xs text-muted-foreground", children: "Session age" }),
|
|
3653
|
+
/* @__PURE__ */ jsx11(
|
|
3943
3654
|
"input",
|
|
3944
3655
|
{
|
|
3945
3656
|
id: "agent-app-session-age",
|
|
@@ -3952,8 +3663,8 @@ function SessionHistoryPanel({
|
|
|
3952
3663
|
className: "h-8 w-20 rounded-md border border-border bg-card px-2 text-xs tabular-nums text-foreground"
|
|
3953
3664
|
}
|
|
3954
3665
|
),
|
|
3955
|
-
/* @__PURE__ */
|
|
3956
|
-
/* @__PURE__ */
|
|
3666
|
+
/* @__PURE__ */ jsx11("span", { className: "text-xs text-muted-foreground", children: "days" }),
|
|
3667
|
+
/* @__PURE__ */ jsxs9(
|
|
3957
3668
|
"button",
|
|
3958
3669
|
{
|
|
3959
3670
|
type: "button",
|
|
@@ -3966,7 +3677,7 @@ function SessionHistoryPanel({
|
|
|
3966
3677
|
]
|
|
3967
3678
|
}
|
|
3968
3679
|
),
|
|
3969
|
-
/* @__PURE__ */
|
|
3680
|
+
/* @__PURE__ */ jsxs9(
|
|
3970
3681
|
"button",
|
|
3971
3682
|
{
|
|
3972
3683
|
type: "button",
|
|
@@ -3982,15 +3693,15 @@ function SessionHistoryPanel({
|
|
|
3982
3693
|
] })
|
|
3983
3694
|
] })
|
|
3984
3695
|
] }),
|
|
3985
|
-
/* @__PURE__ */
|
|
3986
|
-
/* @__PURE__ */
|
|
3987
|
-
/* @__PURE__ */
|
|
3988
|
-
] }) : history.isLoadingFirst ? /* @__PURE__ */
|
|
3696
|
+
/* @__PURE__ */ jsx11("div", { className: `px-4 pb-8 pt-1 sm:px-6 ${column}`, children: !hasAnySessions ? /* @__PURE__ */ jsxs9("div", { className: "flex min-h-[50vh] flex-col items-center justify-center gap-2 text-center", children: [
|
|
3697
|
+
/* @__PURE__ */ jsx11("p", { className: "text-sm font-medium text-foreground", children: emptyTitle }),
|
|
3698
|
+
/* @__PURE__ */ jsx11("p", { className: "max-w-xs text-xs text-muted-foreground", children: emptyDescription })
|
|
3699
|
+
] }) : history.isLoadingFirst ? /* @__PURE__ */ jsx11(SkeletonRows, {}) : history.items.length === 0 ? history.isError ? /* @__PURE__ */ jsx11(ErrorBlock, { onRetry: history.retry, message: "Couldn\u2019t load your sessions." }) : isSearching ? /* @__PURE__ */ jsxs9("p", { className: "py-16 text-center text-sm text-muted-foreground", children: [
|
|
3989
3700
|
"No sessions match \u201C",
|
|
3990
3701
|
searchTerm,
|
|
3991
3702
|
"\u201D."
|
|
3992
|
-
] }) : /* @__PURE__ */
|
|
3993
|
-
history.items.map((session) => /* @__PURE__ */
|
|
3703
|
+
] }) : /* @__PURE__ */ jsx11("p", { className: "py-16 text-center text-sm text-muted-foreground", children: "No sessions remain." }) : /* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-0.5", children: [
|
|
3704
|
+
history.items.map((session) => /* @__PURE__ */ jsx11(
|
|
3994
3705
|
SessionRow,
|
|
3995
3706
|
{
|
|
3996
3707
|
session,
|
|
@@ -4017,10 +3728,10 @@ function SessionHistoryPanel({
|
|
|
4017
3728
|
},
|
|
4018
3729
|
session.id
|
|
4019
3730
|
)),
|
|
4020
|
-
history.isError ? /* @__PURE__ */
|
|
3731
|
+
history.isError ? /* @__PURE__ */ jsx11(ErrorBlock, { onRetry: history.retry, message: "Couldn\u2019t load more sessions.", inline: true }) : history.hasMore ? /* @__PURE__ */ jsx11("div", { ref: sentinelRef, className: "flex items-center justify-center py-6", children: history.isLoadingMore && /* @__PURE__ */ jsx11("span", { role: "status", "aria-live": "polite", "aria-busy": true, className: "text-xs text-muted-foreground", children: "Loading\u2026" }) }) : null
|
|
4021
3732
|
] }) })
|
|
4022
3733
|
] }),
|
|
4023
|
-
bulkTarget && /* @__PURE__ */
|
|
3734
|
+
bulkTarget && /* @__PURE__ */ jsx11(
|
|
4024
3735
|
SessionDialog,
|
|
4025
3736
|
{
|
|
4026
3737
|
title: bulkTarget.title,
|
|
@@ -4032,8 +3743,8 @@ function SessionHistoryPanel({
|
|
|
4032
3743
|
},
|
|
4033
3744
|
busy: bulkBusy,
|
|
4034
3745
|
error: bulkError,
|
|
4035
|
-
footer: /* @__PURE__ */
|
|
4036
|
-
/* @__PURE__ */
|
|
3746
|
+
footer: /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
3747
|
+
/* @__PURE__ */ jsx11(
|
|
4037
3748
|
DialogButton,
|
|
4038
3749
|
{
|
|
4039
3750
|
onClick: () => {
|
|
@@ -4045,21 +3756,21 @@ function SessionHistoryPanel({
|
|
|
4045
3756
|
children: "Cancel"
|
|
4046
3757
|
}
|
|
4047
3758
|
),
|
|
4048
|
-
/* @__PURE__ */
|
|
3759
|
+
/* @__PURE__ */ jsx11(DialogButton, { onClick: () => void confirmBulkAction(), disabled: bulkBusy, variant: "destructive", children: bulkBusy ? "Working\u2026" : deleteLabel })
|
|
4049
3760
|
] }),
|
|
4050
|
-
children: /* @__PURE__ */
|
|
3761
|
+
children: /* @__PURE__ */ jsx11("p", { className: "text-sm text-muted-foreground", children: bulkTarget.body })
|
|
4051
3762
|
}
|
|
4052
3763
|
)
|
|
4053
3764
|
] });
|
|
4054
3765
|
}
|
|
4055
3766
|
function ErrorBlock({ message, onRetry, inline }) {
|
|
4056
|
-
return /* @__PURE__ */
|
|
3767
|
+
return /* @__PURE__ */ jsxs9(
|
|
4057
3768
|
"div",
|
|
4058
3769
|
{
|
|
4059
3770
|
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",
|
|
4060
3771
|
children: [
|
|
4061
|
-
/* @__PURE__ */
|
|
4062
|
-
/* @__PURE__ */
|
|
3772
|
+
/* @__PURE__ */ jsx11("span", { className: "text-sm text-muted-foreground", children: message }),
|
|
3773
|
+
/* @__PURE__ */ jsx11(
|
|
4063
3774
|
"button",
|
|
4064
3775
|
{
|
|
4065
3776
|
type: "button",
|
|
@@ -4088,12 +3799,12 @@ function SessionRow({
|
|
|
4088
3799
|
selected,
|
|
4089
3800
|
onSelectedChange
|
|
4090
3801
|
}) {
|
|
4091
|
-
const [menuOpen, setMenuOpen] =
|
|
3802
|
+
const [menuOpen, setMenuOpen] = useState12(false);
|
|
4092
3803
|
const extras = extraActions?.(session) ?? [];
|
|
4093
3804
|
const hasMenu = Boolean(onRename) || Boolean(onDelete) || extras.length > 0;
|
|
4094
3805
|
const showUnread = Boolean(session.unread) && !responding;
|
|
4095
|
-
return /* @__PURE__ */
|
|
4096
|
-
selectable && /* @__PURE__ */
|
|
3806
|
+
return /* @__PURE__ */ jsxs9("div", { className: "group relative flex items-center gap-2 rounded-lg px-3 py-2.5 transition-colors hover:bg-accent/20", children: [
|
|
3807
|
+
selectable && /* @__PURE__ */ jsx11(
|
|
4097
3808
|
"input",
|
|
4098
3809
|
{
|
|
4099
3810
|
type: "checkbox",
|
|
@@ -4103,10 +3814,10 @@ function SessionRow({
|
|
|
4103
3814
|
className: "h-4 w-4 shrink-0 rounded border-border accent-primary"
|
|
4104
3815
|
}
|
|
4105
3816
|
),
|
|
4106
|
-
/* @__PURE__ */
|
|
4107
|
-
showUnread && /* @__PURE__ */
|
|
4108
|
-
/* @__PURE__ */
|
|
4109
|
-
/* @__PURE__ */
|
|
3817
|
+
/* @__PURE__ */ jsxs9(Link, { to: href, className: "flex min-w-0 flex-1 items-center gap-3", children: [
|
|
3818
|
+
showUnread && /* @__PURE__ */ jsx11("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-primary", "aria-hidden": true }),
|
|
3819
|
+
/* @__PURE__ */ jsx11(MessageIcon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
3820
|
+
/* @__PURE__ */ jsx11(
|
|
4110
3821
|
"span",
|
|
4111
3822
|
{
|
|
4112
3823
|
className: `truncate text-sm ${responding ? "text-muted-foreground" : "text-foreground"} ${showUnread ? "font-semibold" : ""}`,
|
|
@@ -4115,9 +3826,9 @@ function SessionRow({
|
|
|
4115
3826
|
}
|
|
4116
3827
|
)
|
|
4117
3828
|
] }),
|
|
4118
|
-
/* @__PURE__ */
|
|
4119
|
-
hasMenu && /* @__PURE__ */
|
|
4120
|
-
/* @__PURE__ */
|
|
3829
|
+
/* @__PURE__ */ jsx11("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: timestamp }),
|
|
3830
|
+
hasMenu && /* @__PURE__ */ jsxs9("div", { className: "relative shrink-0", children: [
|
|
3831
|
+
/* @__PURE__ */ jsx11(
|
|
4121
3832
|
"button",
|
|
4122
3833
|
{
|
|
4123
3834
|
type: "button",
|
|
@@ -4125,13 +3836,13 @@ function SessionRow({
|
|
|
4125
3836
|
"aria-expanded": menuOpen,
|
|
4126
3837
|
onClick: () => setMenuOpen((open) => !open),
|
|
4127
3838
|
className: "flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition hover:bg-muted hover:text-foreground focus-visible:opacity-100 sm:opacity-0 sm:group-hover:opacity-100 aria-expanded:opacity-100",
|
|
4128
|
-
children: /* @__PURE__ */
|
|
3839
|
+
children: /* @__PURE__ */ jsx11("span", { "aria-hidden": true, className: "text-base leading-none", children: "\u22EF" })
|
|
4129
3840
|
}
|
|
4130
3841
|
),
|
|
4131
|
-
menuOpen && /* @__PURE__ */
|
|
4132
|
-
/* @__PURE__ */
|
|
4133
|
-
/* @__PURE__ */
|
|
4134
|
-
onRename && /* @__PURE__ */
|
|
3842
|
+
menuOpen && /* @__PURE__ */ jsxs9(Fragment5, { children: [
|
|
3843
|
+
/* @__PURE__ */ jsx11("div", { className: "fixed inset-0 z-20", onClick: () => setMenuOpen(false), "aria-hidden": true }),
|
|
3844
|
+
/* @__PURE__ */ jsxs9("div", { className: "absolute right-0 z-30 mt-1 w-36 overflow-hidden rounded-md border border-border bg-card py-1 shadow-lg", children: [
|
|
3845
|
+
onRename && /* @__PURE__ */ jsx11(
|
|
4135
3846
|
"button",
|
|
4136
3847
|
{
|
|
4137
3848
|
type: "button",
|
|
@@ -4143,7 +3854,7 @@ function SessionRow({
|
|
|
4143
3854
|
children: renameLabel
|
|
4144
3855
|
}
|
|
4145
3856
|
),
|
|
4146
|
-
extras.map((action) => /* @__PURE__ */
|
|
3857
|
+
extras.map((action) => /* @__PURE__ */ jsx11(
|
|
4147
3858
|
"button",
|
|
4148
3859
|
{
|
|
4149
3860
|
type: "button",
|
|
@@ -4156,7 +3867,7 @@ function SessionRow({
|
|
|
4156
3867
|
},
|
|
4157
3868
|
action.id
|
|
4158
3869
|
)),
|
|
4159
|
-
onDelete && /* @__PURE__ */
|
|
3870
|
+
onDelete && /* @__PURE__ */ jsx11(
|
|
4160
3871
|
"button",
|
|
4161
3872
|
{
|
|
4162
3873
|
type: "button",
|
|
@@ -4176,14 +3887,14 @@ function SessionRow({
|
|
|
4176
3887
|
|
|
4177
3888
|
// src/web-react/record-grid.tsx
|
|
4178
3889
|
import {
|
|
4179
|
-
Fragment as
|
|
3890
|
+
Fragment as Fragment6,
|
|
4180
3891
|
isValidElement,
|
|
4181
3892
|
useCallback as useCallback9,
|
|
4182
|
-
useEffect as
|
|
3893
|
+
useEffect as useEffect10,
|
|
4183
3894
|
useId as useId2,
|
|
4184
|
-
useMemo as
|
|
4185
|
-
useRef as
|
|
4186
|
-
useState as
|
|
3895
|
+
useMemo as useMemo6,
|
|
3896
|
+
useRef as useRef9,
|
|
3897
|
+
useState as useState13
|
|
4187
3898
|
} from "react";
|
|
4188
3899
|
|
|
4189
3900
|
// src/web-react/record-grid-model.ts
|
|
@@ -4513,7 +4224,7 @@ function pruneRecordGridOverlay(rows, overlay) {
|
|
|
4513
4224
|
}
|
|
4514
4225
|
|
|
4515
4226
|
// src/web-react/record-grid.tsx
|
|
4516
|
-
import { jsx as
|
|
4227
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
4517
4228
|
var EMPTY_RECORD_GRID_ROWS = [];
|
|
4518
4229
|
var CELL_KEY_SEPARATOR = "\0";
|
|
4519
4230
|
function cellKey(rowId, columnId) {
|
|
@@ -4568,33 +4279,33 @@ function RecordGrid({
|
|
|
4568
4279
|
className
|
|
4569
4280
|
}) {
|
|
4570
4281
|
const fieldPrefix = useId2();
|
|
4571
|
-
const [overlay, setOverlay] =
|
|
4572
|
-
const [editing, setEditingState] =
|
|
4573
|
-
const [cellErrors, setCellErrors] =
|
|
4574
|
-
const [rowErrors, setRowErrors] =
|
|
4575
|
-
const [pendingRows, setPendingRows] =
|
|
4576
|
-
const [focus, setFocus] =
|
|
4577
|
-
const [openSource, setOpenSource] =
|
|
4578
|
-
const [confirmDelete, setConfirmDelete] =
|
|
4579
|
-
const [adding, setAdding] =
|
|
4580
|
-
const [draft, setDraft] =
|
|
4581
|
-
const [draftErrors, setDraftErrors] =
|
|
4582
|
-
const [draftError, setDraftError] =
|
|
4583
|
-
const [creating, setCreating] =
|
|
4584
|
-
const cellRefs =
|
|
4585
|
-
const settling =
|
|
4586
|
-
const draftCounter =
|
|
4587
|
-
const editingRef =
|
|
4282
|
+
const [overlay, setOverlay] = useState13(EMPTY_RECORD_GRID_OVERLAY);
|
|
4283
|
+
const [editing, setEditingState] = useState13(null);
|
|
4284
|
+
const [cellErrors, setCellErrors] = useState13({});
|
|
4285
|
+
const [rowErrors, setRowErrors] = useState13({});
|
|
4286
|
+
const [pendingRows, setPendingRows] = useState13({});
|
|
4287
|
+
const [focus, setFocus] = useState13(null);
|
|
4288
|
+
const [openSource, setOpenSource] = useState13(null);
|
|
4289
|
+
const [confirmDelete, setConfirmDelete] = useState13(null);
|
|
4290
|
+
const [adding, setAdding] = useState13(false);
|
|
4291
|
+
const [draft, setDraft] = useState13({ ...newRowDefaults ?? {} });
|
|
4292
|
+
const [draftErrors, setDraftErrors] = useState13({});
|
|
4293
|
+
const [draftError, setDraftError] = useState13(null);
|
|
4294
|
+
const [creating, setCreating] = useState13(false);
|
|
4295
|
+
const cellRefs = useRef9(/* @__PURE__ */ new Map());
|
|
4296
|
+
const settling = useRef9(false);
|
|
4297
|
+
const draftCounter = useRef9(0);
|
|
4298
|
+
const editingRef = useRef9(null);
|
|
4588
4299
|
const setEditing = useCallback9((next) => {
|
|
4589
4300
|
editingRef.current = next;
|
|
4590
4301
|
setEditingState(next);
|
|
4591
4302
|
}, []);
|
|
4592
4303
|
const callerRows = state.status === "ready" || state.status === "empty" ? state.value : EMPTY_RECORD_GRID_ROWS;
|
|
4593
|
-
|
|
4304
|
+
useEffect10(() => {
|
|
4594
4305
|
setOverlay((current) => pruneRecordGridOverlay(callerRows, current));
|
|
4595
4306
|
}, [callerRows]);
|
|
4596
|
-
const visibleRows =
|
|
4597
|
-
const activeFocus =
|
|
4307
|
+
const visibleRows = useMemo6(() => projectRecordGridRows(callerRows, overlay), [callerRows, overlay]);
|
|
4308
|
+
const activeFocus = useMemo6(() => {
|
|
4598
4309
|
if (focus === null) return null;
|
|
4599
4310
|
if (!visibleRows.some((row) => row.id === focus.rowId)) return null;
|
|
4600
4311
|
if (!columns.some((column) => column.id === focus.columnId)) return null;
|
|
@@ -4803,9 +4514,9 @@ function RecordGrid({
|
|
|
4803
4514
|
[beginEdit, columns, editing, focusCell, onUpdate, visibleRows]
|
|
4804
4515
|
);
|
|
4805
4516
|
if (state.status === "idle" || state.status === "loading") {
|
|
4806
|
-
return /* @__PURE__ */
|
|
4517
|
+
return /* @__PURE__ */ jsxs10("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
4807
4518
|
toolbar,
|
|
4808
|
-
/* @__PURE__ */
|
|
4519
|
+
/* @__PURE__ */ jsxs10(
|
|
4809
4520
|
"div",
|
|
4810
4521
|
{
|
|
4811
4522
|
role: "status",
|
|
@@ -4813,22 +4524,22 @@ function RecordGrid({
|
|
|
4813
4524
|
"aria-live": "polite",
|
|
4814
4525
|
className: "space-y-2 rounded-xl border border-border bg-card p-4",
|
|
4815
4526
|
children: [
|
|
4816
|
-
/* @__PURE__ */
|
|
4527
|
+
/* @__PURE__ */ jsxs10("span", { className: "sr-only", children: [
|
|
4817
4528
|
"Loading ",
|
|
4818
4529
|
caption
|
|
4819
4530
|
] }),
|
|
4820
|
-
Array.from({ length: Math.max(1, loadingRowCount) }, (_, index) => /* @__PURE__ */
|
|
4531
|
+
Array.from({ length: Math.max(1, loadingRowCount) }, (_, index) => /* @__PURE__ */ jsx12("div", { className: "h-8 animate-pulse rounded-md bg-muted/50", "aria-hidden": true }, index))
|
|
4821
4532
|
]
|
|
4822
4533
|
}
|
|
4823
4534
|
)
|
|
4824
4535
|
] });
|
|
4825
4536
|
}
|
|
4826
4537
|
if (state.status === "error") {
|
|
4827
|
-
return /* @__PURE__ */
|
|
4538
|
+
return /* @__PURE__ */ jsxs10("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
4828
4539
|
toolbar,
|
|
4829
|
-
/* @__PURE__ */
|
|
4830
|
-
/* @__PURE__ */
|
|
4831
|
-
/* @__PURE__ */
|
|
4540
|
+
/* @__PURE__ */ jsxs10("div", { role: "alert", className: "rounded-xl border border-destructive/40 bg-destructive/10 px-4 py-4", children: [
|
|
4541
|
+
/* @__PURE__ */ jsx12("p", { className: "text-sm font-medium text-destructive", children: state.message }),
|
|
4542
|
+
/* @__PURE__ */ jsx12(
|
|
4832
4543
|
"button",
|
|
4833
4544
|
{
|
|
4834
4545
|
type: "button",
|
|
@@ -4840,7 +4551,7 @@ function RecordGrid({
|
|
|
4840
4551
|
] })
|
|
4841
4552
|
] });
|
|
4842
4553
|
}
|
|
4843
|
-
const addForm = adding && onCreate ? /* @__PURE__ */
|
|
4554
|
+
const addForm = adding && onCreate ? /* @__PURE__ */ jsx12(
|
|
4844
4555
|
AddRecordForm,
|
|
4845
4556
|
{
|
|
4846
4557
|
columns,
|
|
@@ -4859,13 +4570,13 @@ function RecordGrid({
|
|
|
4859
4570
|
}
|
|
4860
4571
|
) : null;
|
|
4861
4572
|
if (visibleRows.length === 0) {
|
|
4862
|
-
return /* @__PURE__ */
|
|
4573
|
+
return /* @__PURE__ */ jsxs10("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
4863
4574
|
toolbar,
|
|
4864
|
-
addForm ?? /* @__PURE__ */
|
|
4865
|
-
/* @__PURE__ */
|
|
4866
|
-
empty.description && /* @__PURE__ */
|
|
4867
|
-
/* @__PURE__ */
|
|
4868
|
-
empty.action && (isValidElement(empty.action) ? empty.action : /* @__PURE__ */
|
|
4575
|
+
addForm ?? /* @__PURE__ */ jsxs10("div", { className: "rounded-xl border border-dashed border-border px-6 py-10 text-center", children: [
|
|
4576
|
+
/* @__PURE__ */ jsx12("p", { className: "text-sm font-medium text-foreground", children: empty.title }),
|
|
4577
|
+
empty.description && /* @__PURE__ */ jsx12("p", { className: "mx-auto mt-1 max-w-md text-sm text-muted-foreground", children: empty.description }),
|
|
4578
|
+
/* @__PURE__ */ jsxs10("div", { className: "mt-4 flex flex-wrap items-center justify-center gap-2", children: [
|
|
4579
|
+
empty.action && (isValidElement(empty.action) ? empty.action : /* @__PURE__ */ jsx12(
|
|
4869
4580
|
"button",
|
|
4870
4581
|
{
|
|
4871
4582
|
type: "button",
|
|
@@ -4874,7 +4585,7 @@ function RecordGrid({
|
|
|
4874
4585
|
children: empty.action.label
|
|
4875
4586
|
}
|
|
4876
4587
|
)),
|
|
4877
|
-
onCreate && /* @__PURE__ */
|
|
4588
|
+
onCreate && /* @__PURE__ */ jsx12(
|
|
4878
4589
|
"button",
|
|
4879
4590
|
{
|
|
4880
4591
|
type: "button",
|
|
@@ -4889,9 +4600,9 @@ function RecordGrid({
|
|
|
4889
4600
|
}
|
|
4890
4601
|
const hasFooter = columns.some((column) => column.footerValue !== void 0);
|
|
4891
4602
|
const columnSpan = columns.length + (onDelete ? 1 : 0);
|
|
4892
|
-
return /* @__PURE__ */
|
|
4603
|
+
return /* @__PURE__ */ jsxs10("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
4893
4604
|
toolbar,
|
|
4894
|
-
/* @__PURE__ */
|
|
4605
|
+
/* @__PURE__ */ jsx12("div", { className: "overflow-x-auto rounded-xl border border-border bg-card", children: /* @__PURE__ */ jsxs10(
|
|
4895
4606
|
"table",
|
|
4896
4607
|
{
|
|
4897
4608
|
role: "grid",
|
|
@@ -4899,8 +4610,8 @@ function RecordGrid({
|
|
|
4899
4610
|
className: "w-full border-collapse text-left text-sm",
|
|
4900
4611
|
onKeyDown: handleGridKeyDown,
|
|
4901
4612
|
children: [
|
|
4902
|
-
/* @__PURE__ */
|
|
4903
|
-
columns.map((column) => /* @__PURE__ */
|
|
4613
|
+
/* @__PURE__ */ jsx12("thead", { children: /* @__PURE__ */ jsxs10("tr", { role: "row", className: "border-b border-border text-[11px] uppercase tracking-wide text-muted-foreground", children: [
|
|
4614
|
+
columns.map((column) => /* @__PURE__ */ jsx12(
|
|
4904
4615
|
"th",
|
|
4905
4616
|
{
|
|
4906
4617
|
role: "columnheader",
|
|
@@ -4910,14 +4621,14 @@ function RecordGrid({
|
|
|
4910
4621
|
},
|
|
4911
4622
|
column.id
|
|
4912
4623
|
)),
|
|
4913
|
-
onDelete && /* @__PURE__ */
|
|
4624
|
+
onDelete && /* @__PURE__ */ jsx12("th", { role: "columnheader", scope: "col", className: "w-px px-3 py-2 font-medium", children: /* @__PURE__ */ jsx12("span", { className: "sr-only", children: "Row actions" }) })
|
|
4914
4625
|
] }) }),
|
|
4915
|
-
/* @__PURE__ */
|
|
4626
|
+
/* @__PURE__ */ jsx12("tbody", { children: visibleRows.map((row) => {
|
|
4916
4627
|
const rowLabel = recordGridRowLabel(columns, row);
|
|
4917
4628
|
const pending = row.id in pendingRows;
|
|
4918
4629
|
const rowError = rowErrors[row.id];
|
|
4919
|
-
return /* @__PURE__ */
|
|
4920
|
-
/* @__PURE__ */
|
|
4630
|
+
return /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
4631
|
+
/* @__PURE__ */ jsxs10("tr", { role: "row", "aria-busy": pending, className: `border-b border-border/50 ${pending ? "opacity-60" : ""}`, children: [
|
|
4921
4632
|
columns.map((column) => {
|
|
4922
4633
|
const key = cellKey(row.id, column.id);
|
|
4923
4634
|
const applicable = isRecordGridCellApplicable(column, row.values);
|
|
@@ -4929,8 +4640,8 @@ function RecordGrid({
|
|
|
4929
4640
|
const source = row.sources?.[column.id];
|
|
4930
4641
|
const errorId = `${fieldPrefix}-cell-error-${row.id}-${column.id}`;
|
|
4931
4642
|
if (isEditing && editable) {
|
|
4932
|
-
return /* @__PURE__ */
|
|
4933
|
-
/* @__PURE__ */
|
|
4643
|
+
return /* @__PURE__ */ jsxs10("td", { role: "gridcell", className: `px-3 py-1.5 ${alignmentClass(column)}`, children: [
|
|
4644
|
+
/* @__PURE__ */ jsx12(
|
|
4934
4645
|
CellEditor,
|
|
4935
4646
|
{
|
|
4936
4647
|
column,
|
|
@@ -4943,11 +4654,11 @@ function RecordGrid({
|
|
|
4943
4654
|
onCancel: () => cancelEdit(row, column)
|
|
4944
4655
|
}
|
|
4945
4656
|
),
|
|
4946
|
-
cellError !== void 0 && /* @__PURE__ */
|
|
4657
|
+
cellError !== void 0 && /* @__PURE__ */ jsx12("p", { id: errorId, role: "alert", className: "mt-1 text-[11px] leading-snug text-destructive", children: cellError })
|
|
4947
4658
|
] }, column.id);
|
|
4948
4659
|
}
|
|
4949
4660
|
if (column.kind === "boolean" && editable) {
|
|
4950
|
-
return /* @__PURE__ */
|
|
4661
|
+
return /* @__PURE__ */ jsx12("td", { role: "gridcell", className: `px-3 py-2 ${alignmentClass(column)}`, children: /* @__PURE__ */ jsx12(
|
|
4951
4662
|
"input",
|
|
4952
4663
|
{
|
|
4953
4664
|
type: "checkbox",
|
|
@@ -4966,7 +4677,7 @@ function RecordGrid({
|
|
|
4966
4677
|
) }, column.id);
|
|
4967
4678
|
}
|
|
4968
4679
|
const display = applicable ? formatRecordGridValue(column, value, locale) : "";
|
|
4969
|
-
return /* @__PURE__ */
|
|
4680
|
+
return /* @__PURE__ */ jsx12(
|
|
4970
4681
|
"td",
|
|
4971
4682
|
{
|
|
4972
4683
|
role: "gridcell",
|
|
@@ -4984,9 +4695,9 @@ function RecordGrid({
|
|
|
4984
4695
|
className: `px-3 py-2 outline-none focus:ring-2 focus:ring-inset focus:ring-primary/50 ${alignmentClass(
|
|
4985
4696
|
column
|
|
4986
4697
|
)} ${editable ? "cursor-text" : ""}`,
|
|
4987
|
-
children: /* @__PURE__ */
|
|
4988
|
-
/* @__PURE__ */
|
|
4989
|
-
source && /* @__PURE__ */
|
|
4698
|
+
children: /* @__PURE__ */ jsxs10("span", { className: "inline-flex max-w-full items-center gap-1.5", children: [
|
|
4699
|
+
/* @__PURE__ */ jsx12("span", { className: display === "" ? "text-muted-foreground" : "truncate text-foreground", children: display === "" ? applicable ? "\u2014" : "n/a" : display }),
|
|
4700
|
+
source && /* @__PURE__ */ jsx12(
|
|
4990
4701
|
SourceMarker,
|
|
4991
4702
|
{
|
|
4992
4703
|
panelId: `${fieldPrefix}-source-${row.id}-${column.id}`,
|
|
@@ -5002,8 +4713,8 @@ function RecordGrid({
|
|
|
5002
4713
|
column.id
|
|
5003
4714
|
);
|
|
5004
4715
|
}),
|
|
5005
|
-
onDelete && /* @__PURE__ */
|
|
5006
|
-
/* @__PURE__ */
|
|
4716
|
+
onDelete && /* @__PURE__ */ jsx12("td", { role: "gridcell", className: "px-3 py-2 text-right", children: row.readOnly === true ? null : confirmDelete === row.id ? /* @__PURE__ */ jsxs10("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
4717
|
+
/* @__PURE__ */ jsx12(
|
|
5007
4718
|
"button",
|
|
5008
4719
|
{
|
|
5009
4720
|
type: "button",
|
|
@@ -5013,7 +4724,7 @@ function RecordGrid({
|
|
|
5013
4724
|
children: "Delete"
|
|
5014
4725
|
}
|
|
5015
4726
|
),
|
|
5016
|
-
/* @__PURE__ */
|
|
4727
|
+
/* @__PURE__ */ jsx12(
|
|
5017
4728
|
"button",
|
|
5018
4729
|
{
|
|
5019
4730
|
type: "button",
|
|
@@ -5023,14 +4734,14 @@ function RecordGrid({
|
|
|
5023
4734
|
children: "Cancel"
|
|
5024
4735
|
}
|
|
5025
4736
|
)
|
|
5026
|
-
] }) : /* @__PURE__ */
|
|
4737
|
+
] }) : /* @__PURE__ */ jsx12(
|
|
5027
4738
|
"button",
|
|
5028
4739
|
{
|
|
5029
4740
|
type: "button",
|
|
5030
4741
|
"aria-label": `Delete ${rowLabel}`,
|
|
5031
4742
|
onClick: () => setConfirmDelete(row.id),
|
|
5032
4743
|
className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-destructive/10 hover:text-destructive",
|
|
5033
|
-
children: /* @__PURE__ */
|
|
4744
|
+
children: /* @__PURE__ */ jsxs10(
|
|
5034
4745
|
"svg",
|
|
5035
4746
|
{
|
|
5036
4747
|
viewBox: "0 0 24 24",
|
|
@@ -5042,19 +4753,19 @@ function RecordGrid({
|
|
|
5042
4753
|
strokeLinejoin: "round",
|
|
5043
4754
|
"aria-hidden": true,
|
|
5044
4755
|
children: [
|
|
5045
|
-
/* @__PURE__ */
|
|
5046
|
-
/* @__PURE__ */
|
|
4756
|
+
/* @__PURE__ */ jsx12("polyline", { points: "3 6 5 6 21 6" }),
|
|
4757
|
+
/* @__PURE__ */ jsx12("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" })
|
|
5047
4758
|
]
|
|
5048
4759
|
}
|
|
5049
4760
|
)
|
|
5050
4761
|
}
|
|
5051
4762
|
) })
|
|
5052
4763
|
] }),
|
|
5053
|
-
rowError !== void 0 && /* @__PURE__ */
|
|
4764
|
+
rowError !== void 0 && /* @__PURE__ */ jsx12("tr", { role: "row", className: "border-b border-border/50", children: /* @__PURE__ */ jsx12("td", { role: "gridcell", colSpan: columnSpan, className: "px-3 pb-2", children: /* @__PURE__ */ jsx12("p", { role: "alert", className: "rounded-md bg-destructive/10 px-2.5 py-1.5 text-xs text-destructive", children: rowError }) }) })
|
|
5054
4765
|
] }, row.id);
|
|
5055
4766
|
}) }),
|
|
5056
|
-
hasFooter && /* @__PURE__ */
|
|
5057
|
-
columns.map((column) => /* @__PURE__ */
|
|
4767
|
+
hasFooter && /* @__PURE__ */ jsx12("tfoot", { children: /* @__PURE__ */ jsxs10("tr", { role: "row", className: "border-t-2 border-border", children: [
|
|
4768
|
+
columns.map((column) => /* @__PURE__ */ jsx12(
|
|
5058
4769
|
"td",
|
|
5059
4770
|
{
|
|
5060
4771
|
role: "gridcell",
|
|
@@ -5063,19 +4774,19 @@ function RecordGrid({
|
|
|
5063
4774
|
},
|
|
5064
4775
|
column.id
|
|
5065
4776
|
)),
|
|
5066
|
-
onDelete && /* @__PURE__ */
|
|
4777
|
+
onDelete && /* @__PURE__ */ jsx12("td", { role: "gridcell" })
|
|
5067
4778
|
] }) })
|
|
5068
4779
|
]
|
|
5069
4780
|
}
|
|
5070
4781
|
) }),
|
|
5071
|
-
onCreate && (addForm ?? /* @__PURE__ */
|
|
4782
|
+
onCreate && (addForm ?? /* @__PURE__ */ jsxs10(
|
|
5072
4783
|
"button",
|
|
5073
4784
|
{
|
|
5074
4785
|
type: "button",
|
|
5075
4786
|
onClick: openAdd,
|
|
5076
4787
|
className: "inline-flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-sm font-medium text-foreground transition hover:bg-accent/30",
|
|
5077
4788
|
children: [
|
|
5078
|
-
/* @__PURE__ */
|
|
4789
|
+
/* @__PURE__ */ jsxs10(
|
|
5079
4790
|
"svg",
|
|
5080
4791
|
{
|
|
5081
4792
|
viewBox: "0 0 24 24",
|
|
@@ -5087,8 +4798,8 @@ function RecordGrid({
|
|
|
5087
4798
|
strokeLinejoin: "round",
|
|
5088
4799
|
"aria-hidden": true,
|
|
5089
4800
|
children: [
|
|
5090
|
-
/* @__PURE__ */
|
|
5091
|
-
/* @__PURE__ */
|
|
4801
|
+
/* @__PURE__ */ jsx12("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
|
|
4802
|
+
/* @__PURE__ */ jsx12("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
|
|
5092
4803
|
]
|
|
5093
4804
|
}
|
|
5094
4805
|
),
|
|
@@ -5107,7 +4818,7 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
5107
4818
|
className: INPUT_CLASS
|
|
5108
4819
|
};
|
|
5109
4820
|
if (column.kind === "select") {
|
|
5110
|
-
return /* @__PURE__ */
|
|
4821
|
+
return /* @__PURE__ */ jsxs10(
|
|
5111
4822
|
"select",
|
|
5112
4823
|
{
|
|
5113
4824
|
...shared,
|
|
@@ -5124,8 +4835,8 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
5124
4835
|
},
|
|
5125
4836
|
onBlur: () => onCommit(text),
|
|
5126
4837
|
children: [
|
|
5127
|
-
/* @__PURE__ */
|
|
5128
|
-
column.options.map((option) => /* @__PURE__ */
|
|
4838
|
+
/* @__PURE__ */ jsx12("option", { value: "", children: "\u2014" }),
|
|
4839
|
+
column.options.map((option) => /* @__PURE__ */ jsx12("option", { value: option.value, children: option.label }, option.value))
|
|
5129
4840
|
]
|
|
5130
4841
|
}
|
|
5131
4842
|
);
|
|
@@ -5143,7 +4854,7 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
5143
4854
|
}
|
|
5144
4855
|
};
|
|
5145
4856
|
if (column.kind === "text" && column.multiline === true) {
|
|
5146
|
-
return /* @__PURE__ */
|
|
4857
|
+
return /* @__PURE__ */ jsx12(
|
|
5147
4858
|
"textarea",
|
|
5148
4859
|
{
|
|
5149
4860
|
...shared,
|
|
@@ -5155,7 +4866,7 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
5155
4866
|
}
|
|
5156
4867
|
);
|
|
5157
4868
|
}
|
|
5158
|
-
return /* @__PURE__ */
|
|
4869
|
+
return /* @__PURE__ */ jsx12(
|
|
5159
4870
|
"input",
|
|
5160
4871
|
{
|
|
5161
4872
|
...shared,
|
|
@@ -5170,8 +4881,8 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
5170
4881
|
}
|
|
5171
4882
|
function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle }) {
|
|
5172
4883
|
const basis = source.basis ?? "asserted";
|
|
5173
|
-
return /* @__PURE__ */
|
|
5174
|
-
/* @__PURE__ */
|
|
4884
|
+
return /* @__PURE__ */ jsxs10("span", { className: "relative inline-flex", children: [
|
|
4885
|
+
/* @__PURE__ */ jsx12(
|
|
5175
4886
|
"button",
|
|
5176
4887
|
{
|
|
5177
4888
|
type: "button",
|
|
@@ -5184,7 +4895,7 @@ function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle
|
|
|
5184
4895
|
onToggle();
|
|
5185
4896
|
},
|
|
5186
4897
|
className: `inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full border ${BASIS_TONES2[basis]}`,
|
|
5187
|
-
children: /* @__PURE__ */
|
|
4898
|
+
children: /* @__PURE__ */ jsx12(
|
|
5188
4899
|
"svg",
|
|
5189
4900
|
{
|
|
5190
4901
|
viewBox: "0 0 24 24",
|
|
@@ -5194,29 +4905,29 @@ function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle
|
|
|
5194
4905
|
strokeWidth: "2.5",
|
|
5195
4906
|
strokeLinecap: "round",
|
|
5196
4907
|
"aria-hidden": true,
|
|
5197
|
-
children: /* @__PURE__ */
|
|
4908
|
+
children: /* @__PURE__ */ jsx12("path", { d: "M9 8h6M9 12h6M9 16h3" })
|
|
5198
4909
|
}
|
|
5199
4910
|
)
|
|
5200
4911
|
}
|
|
5201
4912
|
),
|
|
5202
|
-
open && /* @__PURE__ */
|
|
4913
|
+
open && /* @__PURE__ */ jsxs10(
|
|
5203
4914
|
"span",
|
|
5204
4915
|
{
|
|
5205
4916
|
id: panelId,
|
|
5206
4917
|
role: "note",
|
|
5207
4918
|
className: "absolute left-0 top-5 z-10 w-64 rounded-lg border border-border bg-card p-3 text-left shadow-lg",
|
|
5208
4919
|
children: [
|
|
5209
|
-
source.quote && /* @__PURE__ */
|
|
4920
|
+
source.quote && /* @__PURE__ */ jsxs10("span", { className: "block border-l-2 border-primary/50 pl-2 text-xs italic leading-snug text-foreground", children: [
|
|
5210
4921
|
"\u201C",
|
|
5211
4922
|
source.quote,
|
|
5212
4923
|
"\u201D"
|
|
5213
4924
|
] }),
|
|
5214
|
-
/* @__PURE__ */
|
|
4925
|
+
/* @__PURE__ */ jsxs10("span", { className: "mt-2 block text-[11px] text-muted-foreground", children: [
|
|
5215
4926
|
source.label ?? "Source",
|
|
5216
4927
|
source.locator ? ` \xB7 ${source.locator}` : "",
|
|
5217
4928
|
` \xB7 ${BASIS_TITLES[basis]}`
|
|
5218
4929
|
] }),
|
|
5219
|
-
source.href && /* @__PURE__ */
|
|
4930
|
+
source.href && /* @__PURE__ */ jsx12(
|
|
5220
4931
|
"a",
|
|
5221
4932
|
{
|
|
5222
4933
|
href: source.href,
|
|
@@ -5244,8 +4955,8 @@ function AddRecordForm({
|
|
|
5244
4955
|
onSubmit,
|
|
5245
4956
|
onCancel
|
|
5246
4957
|
}) {
|
|
5247
|
-
const groups =
|
|
5248
|
-
return /* @__PURE__ */
|
|
4958
|
+
const groups = useMemo6(() => groupColumns(columns), [columns]);
|
|
4959
|
+
return /* @__PURE__ */ jsxs10(
|
|
5249
4960
|
"form",
|
|
5250
4961
|
{
|
|
5251
4962
|
noValidate: true,
|
|
@@ -5256,31 +4967,31 @@ function AddRecordForm({
|
|
|
5256
4967
|
},
|
|
5257
4968
|
className: "space-y-4 rounded-xl border border-border bg-card p-4",
|
|
5258
4969
|
children: [
|
|
5259
|
-
/* @__PURE__ */
|
|
5260
|
-
formError !== null && /* @__PURE__ */
|
|
4970
|
+
/* @__PURE__ */ jsx12("h3", { className: "text-sm font-semibold text-foreground", children: label }),
|
|
4971
|
+
formError !== null && /* @__PURE__ */ jsx12("p", { role: "alert", className: "rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive", children: formError }),
|
|
5261
4972
|
groups.map((group) => {
|
|
5262
4973
|
const fields = group.columns.filter((column) => isRecordGridCellApplicable(column, draft));
|
|
5263
4974
|
if (fields.length === 0) return null;
|
|
5264
|
-
return /* @__PURE__ */
|
|
4975
|
+
return /* @__PURE__ */ jsxs10(
|
|
5265
4976
|
"fieldset",
|
|
5266
4977
|
{
|
|
5267
4978
|
className: group.label === null ? "min-w-0" : "min-w-0 rounded-lg border border-border/70 p-3",
|
|
5268
4979
|
children: [
|
|
5269
|
-
group.label !== null && /* @__PURE__ */
|
|
5270
|
-
/* @__PURE__ */
|
|
4980
|
+
group.label !== null && /* @__PURE__ */ jsx12("legend", { className: "px-1 text-xs font-medium text-muted-foreground", children: group.label }),
|
|
4981
|
+
/* @__PURE__ */ jsx12("div", { className: "grid gap-3 sm:grid-cols-2", children: fields.map((column) => {
|
|
5271
4982
|
const fieldId = `${fieldPrefix}-${column.id}`;
|
|
5272
4983
|
const errorId = `${fieldId}-error`;
|
|
5273
4984
|
const message = errors[column.id];
|
|
5274
|
-
return /* @__PURE__ */
|
|
4985
|
+
return /* @__PURE__ */ jsxs10(
|
|
5275
4986
|
"div",
|
|
5276
4987
|
{
|
|
5277
4988
|
className: column.kind === "text" && column.multiline === true ? "sm:col-span-2" : "",
|
|
5278
4989
|
children: [
|
|
5279
|
-
/* @__PURE__ */
|
|
4990
|
+
/* @__PURE__ */ jsxs10("label", { htmlFor: fieldId, className: "mb-1 block text-xs font-medium text-muted-foreground", children: [
|
|
5280
4991
|
column.header,
|
|
5281
|
-
column.required === true && /* @__PURE__ */
|
|
4992
|
+
column.required === true && /* @__PURE__ */ jsx12("span", { className: "ml-0.5 text-destructive", children: "*" })
|
|
5282
4993
|
] }),
|
|
5283
|
-
/* @__PURE__ */
|
|
4994
|
+
/* @__PURE__ */ jsx12(
|
|
5284
4995
|
DraftField,
|
|
5285
4996
|
{
|
|
5286
4997
|
column,
|
|
@@ -5291,8 +5002,8 @@ function AddRecordForm({
|
|
|
5291
5002
|
onValue: (next) => setDraft({ ...draft, [column.id]: next })
|
|
5292
5003
|
}
|
|
5293
5004
|
),
|
|
5294
|
-
column.hint && /* @__PURE__ */
|
|
5295
|
-
message !== void 0 && /* @__PURE__ */
|
|
5005
|
+
column.hint && /* @__PURE__ */ jsx12("p", { className: "mt-1 text-[11px] text-muted-foreground", children: column.hint }),
|
|
5006
|
+
message !== void 0 && /* @__PURE__ */ jsx12("p", { id: errorId, role: "alert", className: "mt-1 text-[11px] text-destructive", children: message })
|
|
5296
5007
|
]
|
|
5297
5008
|
},
|
|
5298
5009
|
column.id
|
|
@@ -5303,8 +5014,8 @@ function AddRecordForm({
|
|
|
5303
5014
|
group.label ?? "_"
|
|
5304
5015
|
);
|
|
5305
5016
|
}),
|
|
5306
|
-
/* @__PURE__ */
|
|
5307
|
-
/* @__PURE__ */
|
|
5017
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
5018
|
+
/* @__PURE__ */ jsx12(
|
|
5308
5019
|
"button",
|
|
5309
5020
|
{
|
|
5310
5021
|
type: "submit",
|
|
@@ -5313,7 +5024,7 @@ function AddRecordForm({
|
|
|
5313
5024
|
children: busy ? "Saving\u2026" : "Save"
|
|
5314
5025
|
}
|
|
5315
5026
|
),
|
|
5316
|
-
/* @__PURE__ */
|
|
5027
|
+
/* @__PURE__ */ jsx12(
|
|
5317
5028
|
"button",
|
|
5318
5029
|
{
|
|
5319
5030
|
type: "button",
|
|
@@ -5334,7 +5045,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
5334
5045
|
"aria-describedby": describedBy
|
|
5335
5046
|
};
|
|
5336
5047
|
if (column.kind === "boolean") {
|
|
5337
|
-
return /* @__PURE__ */
|
|
5048
|
+
return /* @__PURE__ */ jsx12(
|
|
5338
5049
|
"input",
|
|
5339
5050
|
{
|
|
5340
5051
|
...shared,
|
|
@@ -5346,7 +5057,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
5346
5057
|
);
|
|
5347
5058
|
}
|
|
5348
5059
|
if (column.kind === "select") {
|
|
5349
|
-
return /* @__PURE__ */
|
|
5060
|
+
return /* @__PURE__ */ jsxs10(
|
|
5350
5061
|
"select",
|
|
5351
5062
|
{
|
|
5352
5063
|
...shared,
|
|
@@ -5354,14 +5065,14 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
5354
5065
|
value: typeof value === "string" ? value : "",
|
|
5355
5066
|
onChange: (event) => onValue(event.target.value === "" ? null : event.target.value),
|
|
5356
5067
|
children: [
|
|
5357
|
-
/* @__PURE__ */
|
|
5358
|
-
column.options.map((option) => /* @__PURE__ */
|
|
5068
|
+
/* @__PURE__ */ jsx12("option", { value: "", children: "\u2014" }),
|
|
5069
|
+
column.options.map((option) => /* @__PURE__ */ jsx12("option", { value: option.value, children: option.label }, option.value))
|
|
5359
5070
|
]
|
|
5360
5071
|
}
|
|
5361
5072
|
);
|
|
5362
5073
|
}
|
|
5363
5074
|
if (column.kind === "text" && column.multiline === true) {
|
|
5364
|
-
return /* @__PURE__ */
|
|
5075
|
+
return /* @__PURE__ */ jsx12(
|
|
5365
5076
|
"textarea",
|
|
5366
5077
|
{
|
|
5367
5078
|
...shared,
|
|
@@ -5373,7 +5084,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
5373
5084
|
);
|
|
5374
5085
|
}
|
|
5375
5086
|
if (column.kind === "number" || column.kind === "currency") {
|
|
5376
|
-
return /* @__PURE__ */
|
|
5087
|
+
return /* @__PURE__ */ jsx12(
|
|
5377
5088
|
"input",
|
|
5378
5089
|
{
|
|
5379
5090
|
...shared,
|
|
@@ -5393,7 +5104,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
5393
5104
|
}
|
|
5394
5105
|
);
|
|
5395
5106
|
}
|
|
5396
|
-
return /* @__PURE__ */
|
|
5107
|
+
return /* @__PURE__ */ jsx12(
|
|
5397
5108
|
"input",
|
|
5398
5109
|
{
|
|
5399
5110
|
...shared,
|
|
@@ -5405,162 +5116,8 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
5405
5116
|
);
|
|
5406
5117
|
}
|
|
5407
5118
|
|
|
5408
|
-
// src/web-react/agent-session-controls.tsx
|
|
5409
|
-
import { useMemo as useMemo8, useState as useState15 } from "react";
|
|
5410
|
-
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5411
|
-
var HARNESS_LABELS = {
|
|
5412
|
-
opencode: "OpenCode (any model)",
|
|
5413
|
-
"claude-code": "Claude Code (Anthropic)",
|
|
5414
|
-
codex: "Codex (OpenAI)",
|
|
5415
|
-
"kimi-code": "Kimi (Moonshot)",
|
|
5416
|
-
amp: "Amp",
|
|
5417
|
-
"factory-droids": "Factory Droids",
|
|
5418
|
-
cursor: "Cursor",
|
|
5419
|
-
hermes: "Hermes",
|
|
5420
|
-
forge: "Forge",
|
|
5421
|
-
pi: "Pi",
|
|
5422
|
-
openclaw: "OpenClaw",
|
|
5423
|
-
acp: "ACP",
|
|
5424
|
-
"cli-base": "CLI"
|
|
5425
|
-
};
|
|
5426
|
-
function harnessLabel(h) {
|
|
5427
|
-
return HARNESS_LABELS[h] ?? h;
|
|
5428
|
-
}
|
|
5429
|
-
function ChevronDown2({ className }) {
|
|
5430
|
-
return /* @__PURE__ */ jsx15("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx15("path", { d: "m6 9 6 6 6-6" }) });
|
|
5431
|
-
}
|
|
5432
|
-
function GearGlyph({ className }) {
|
|
5433
|
-
return /* @__PURE__ */ jsxs13("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
5434
|
-
/* @__PURE__ */ jsx15("circle", { cx: "12", cy: "12", r: "3" }),
|
|
5435
|
-
/* @__PURE__ */ jsx15("path", { d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1Z" })
|
|
5436
|
-
] });
|
|
5437
|
-
}
|
|
5438
|
-
var FOCUS_RING = "";
|
|
5439
|
-
function HarnessPicker({
|
|
5440
|
-
value,
|
|
5441
|
-
onChange,
|
|
5442
|
-
available
|
|
5443
|
-
}) {
|
|
5444
|
-
const [open, setOpen] = useState15(false);
|
|
5445
|
-
const { containerRef, triggerProps } = usePopover(open, setOpen);
|
|
5446
|
-
const options = available ?? Object.keys(HARNESS_LABELS);
|
|
5447
|
-
return /* @__PURE__ */ jsxs13("div", { ref: containerRef, className: "relative inline-flex", children: [
|
|
5448
|
-
/* @__PURE__ */ jsxs13(
|
|
5449
|
-
"button",
|
|
5450
|
-
{
|
|
5451
|
-
type: "button",
|
|
5452
|
-
...triggerProps,
|
|
5453
|
-
onClick: () => setOpen(!open),
|
|
5454
|
-
title: "Agent backend",
|
|
5455
|
-
className: `inline-flex w-full items-center justify-between gap-1.5 rounded-lg border border-border bg-card px-3 py-1.5 text-sm font-medium text-foreground transition hover:bg-accent/30 ${FOCUS_RING}`,
|
|
5456
|
-
children: [
|
|
5457
|
-
/* @__PURE__ */ jsx15("span", { className: "truncate", children: harnessLabel(value) }),
|
|
5458
|
-
/* @__PURE__ */ jsx15(ChevronDown2, { className: "h-3.5 w-3.5 text-muted-foreground" })
|
|
5459
|
-
]
|
|
5460
|
-
}
|
|
5461
|
-
),
|
|
5462
|
-
open && /* @__PURE__ */ jsx15("div", { role: "menu", className: "absolute bottom-full left-0 z-50 mb-2 max-h-64 w-full min-w-[220px] overflow-y-auto rounded-xl border border-border bg-card p-1 shadow-lg", children: options.map((h) => /* @__PURE__ */ jsx15(
|
|
5463
|
-
"button",
|
|
5464
|
-
{
|
|
5465
|
-
type: "button",
|
|
5466
|
-
role: "menuitemradio",
|
|
5467
|
-
"aria-checked": h === value,
|
|
5468
|
-
onClick: () => {
|
|
5469
|
-
onChange(h);
|
|
5470
|
-
setOpen(false);
|
|
5471
|
-
},
|
|
5472
|
-
className: `flex w-full items-center rounded-md px-3 py-2 text-left text-sm transition ${FOCUS_RING} ${h === value ? "bg-primary/10 font-medium" : "hover:bg-accent/30"}`,
|
|
5473
|
-
children: harnessLabel(h)
|
|
5474
|
-
},
|
|
5475
|
-
h
|
|
5476
|
-
)) })
|
|
5477
|
-
] });
|
|
5478
|
-
}
|
|
5479
|
-
function useCoherentHandlers(props) {
|
|
5480
|
-
const { model, models, harness, onModelChange, onHarnessChange } = props;
|
|
5481
|
-
const canonicalIds = useMemo8(() => models.map((m) => m.id), [models]);
|
|
5482
|
-
const onModel = (next) => {
|
|
5483
|
-
onModelChange(next);
|
|
5484
|
-
const nextHarness = snapHarnessToModel(harness, next);
|
|
5485
|
-
if (nextHarness !== harness) onHarnessChange(nextHarness);
|
|
5486
|
-
};
|
|
5487
|
-
const onHarness = (next) => {
|
|
5488
|
-
onHarnessChange(next);
|
|
5489
|
-
const snapped = snapModelToHarness(next, model, canonicalIds);
|
|
5490
|
-
if (snapped !== model) onModelChange(snapped);
|
|
5491
|
-
};
|
|
5492
|
-
return { onModel, onHarness };
|
|
5493
|
-
}
|
|
5494
|
-
function AgentSessionControls(props) {
|
|
5495
|
-
const {
|
|
5496
|
-
models,
|
|
5497
|
-
modelsLoading,
|
|
5498
|
-
model,
|
|
5499
|
-
harness,
|
|
5500
|
-
availableHarnesses,
|
|
5501
|
-
effort,
|
|
5502
|
-
onEffortChange,
|
|
5503
|
-
layout = "inline",
|
|
5504
|
-
showHarness = true,
|
|
5505
|
-
renderProviderBadge,
|
|
5506
|
-
className
|
|
5507
|
-
} = props;
|
|
5508
|
-
const { onModel, onHarness } = useCoherentHandlers(props);
|
|
5509
|
-
const [open, setOpen] = useState15(false);
|
|
5510
|
-
const { containerRef: popoverRef, triggerProps } = usePopover(open, setOpen);
|
|
5511
|
-
const selectedModel = models.find((m) => m.id === model);
|
|
5512
|
-
const showEffort = selectedModel?.supportsReasoning ?? true;
|
|
5513
|
-
const modelPicker = /* @__PURE__ */ jsx15(
|
|
5514
|
-
ModelPicker,
|
|
5515
|
-
{
|
|
5516
|
-
value: model,
|
|
5517
|
-
onChange: onModel,
|
|
5518
|
-
models,
|
|
5519
|
-
loading: modelsLoading,
|
|
5520
|
-
renderProviderBadge
|
|
5521
|
-
}
|
|
5522
|
-
);
|
|
5523
|
-
if (layout === "inline") {
|
|
5524
|
-
return /* @__PURE__ */ jsxs13("div", { className: `flex items-center gap-1.5 ${className ?? ""}`, children: [
|
|
5525
|
-
modelPicker,
|
|
5526
|
-
showHarness && /* @__PURE__ */ jsx15(HarnessPicker, { value: harness, onChange: onHarness, available: availableHarnesses }),
|
|
5527
|
-
showEffort && /* @__PURE__ */ jsx15(EffortPicker, { value: effort, onChange: onEffortChange })
|
|
5528
|
-
] });
|
|
5529
|
-
}
|
|
5530
|
-
const hasAdvanced = showHarness || showEffort;
|
|
5531
|
-
return /* @__PURE__ */ jsxs13("div", { className: `flex items-center gap-1.5 ${className ?? ""}`, children: [
|
|
5532
|
-
modelPicker,
|
|
5533
|
-
hasAdvanced && /* @__PURE__ */ jsxs13("div", { ref: popoverRef, className: "relative inline-flex", children: [
|
|
5534
|
-
/* @__PURE__ */ jsx15(
|
|
5535
|
-
"button",
|
|
5536
|
-
{
|
|
5537
|
-
type: "button",
|
|
5538
|
-
...triggerProps,
|
|
5539
|
-
onClick: () => setOpen(!open),
|
|
5540
|
-
title: "Model settings \u2014 pick the agent backend and how hard it thinks",
|
|
5541
|
-
className: `flex h-8 w-8 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted hover:text-foreground data-[state=open]:bg-muted ${FOCUS_RING}`,
|
|
5542
|
-
"data-state": open ? "open" : "closed",
|
|
5543
|
-
children: /* @__PURE__ */ jsx15(GearGlyph, { className: "h-4 w-4" })
|
|
5544
|
-
}
|
|
5545
|
-
),
|
|
5546
|
-
open && /* @__PURE__ */ jsxs13("div", { className: "absolute bottom-full left-0 z-50 mb-2 w-72 space-y-3 rounded-xl border border-border bg-card p-3 shadow-lg", children: [
|
|
5547
|
-
showHarness && /* @__PURE__ */ jsxs13("div", { className: "space-y-1.5", children: [
|
|
5548
|
-
/* @__PURE__ */ jsx15("p", { className: "text-xs font-medium text-foreground", children: "Agent backend" }),
|
|
5549
|
-
/* @__PURE__ */ jsx15(HarnessPicker, { value: harness, onChange: onHarness, available: availableHarnesses }),
|
|
5550
|
-
/* @__PURE__ */ jsx15("p", { className: "text-[11px] leading-snug text-muted-foreground", children: "The engine that runs the agent. Switching it keeps your model choice compatible." })
|
|
5551
|
-
] }),
|
|
5552
|
-
showEffort && /* @__PURE__ */ jsxs13("div", { className: "space-y-1.5", children: [
|
|
5553
|
-
/* @__PURE__ */ jsx15("p", { className: "text-xs font-medium text-foreground", children: "Thinking" }),
|
|
5554
|
-
/* @__PURE__ */ jsx15(EffortPicker, { value: effort, onChange: onEffortChange, label: "" }),
|
|
5555
|
-
/* @__PURE__ */ jsx15("p", { className: "text-[11px] leading-snug text-muted-foreground", children: "How hard the agent thinks before answering. Higher is slower but more thorough." })
|
|
5556
|
-
] })
|
|
5557
|
-
] })
|
|
5558
|
-
] })
|
|
5559
|
-
] });
|
|
5560
|
-
}
|
|
5561
|
-
|
|
5562
5119
|
// src/web-react/index.tsx
|
|
5563
|
-
import { Fragment as
|
|
5120
|
+
import { Fragment as Fragment7, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
5564
5121
|
function formatModelCost(msg, models) {
|
|
5565
5122
|
if (msg.promptTokens == null && msg.completionTokens == null) return null;
|
|
5566
5123
|
const pricing = models.find((m) => m.id === msg.modelUsed)?.pricing;
|
|
@@ -5574,41 +5131,41 @@ function formatTokensPerSecond(msg) {
|
|
|
5574
5131
|
return `${Math.round(msg.completionTokens / (msg.durationMs / 1e3))} tok/s`;
|
|
5575
5132
|
}
|
|
5576
5133
|
function RunDrillIn({ run, onClose }) {
|
|
5577
|
-
return /* @__PURE__ */
|
|
5578
|
-
/* @__PURE__ */
|
|
5579
|
-
/* @__PURE__ */
|
|
5134
|
+
return /* @__PURE__ */ jsxs11("div", { className: "fixed inset-y-0 right-0 z-50 flex w-[480px] max-w-full flex-col border-l border-border bg-card shadow-xl", children: [
|
|
5135
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2 border-b border-border px-4 py-3", children: [
|
|
5136
|
+
/* @__PURE__ */ jsx13(
|
|
5580
5137
|
"span",
|
|
5581
5138
|
{
|
|
5582
5139
|
className: `h-2 w-2 shrink-0 rounded-full ${run.status === "running" ? "bg-warning" : run.status === "error" ? "bg-destructive" : "bg-success"}`
|
|
5583
5140
|
}
|
|
5584
5141
|
),
|
|
5585
|
-
/* @__PURE__ */
|
|
5586
|
-
/* @__PURE__ */
|
|
5587
|
-
/* @__PURE__ */
|
|
5142
|
+
/* @__PURE__ */ jsxs11("div", { className: "min-w-0 flex-1", children: [
|
|
5143
|
+
/* @__PURE__ */ jsx13("p", { className: "truncate text-sm font-semibold", children: run.title }),
|
|
5144
|
+
/* @__PURE__ */ jsx13("p", { className: "truncate font-mono text-[11px] text-muted-foreground", children: run.toolName })
|
|
5588
5145
|
] }),
|
|
5589
|
-
/* @__PURE__ */
|
|
5146
|
+
/* @__PURE__ */ jsx13(
|
|
5590
5147
|
"button",
|
|
5591
5148
|
{
|
|
5592
5149
|
type: "button",
|
|
5593
5150
|
onClick: onClose,
|
|
5594
5151
|
"aria-label": "Close",
|
|
5595
5152
|
className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-accent/30 hover:text-foreground",
|
|
5596
|
-
children: /* @__PURE__ */
|
|
5153
|
+
children: /* @__PURE__ */ jsx13("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx13("path", { d: "M18 6 6 18M6 6l12 12" }) })
|
|
5597
5154
|
}
|
|
5598
5155
|
)
|
|
5599
5156
|
] }),
|
|
5600
|
-
/* @__PURE__ */
|
|
5601
|
-
run.steps.length === 0 && /* @__PURE__ */
|
|
5602
|
-
run.steps.map((step, i) => /* @__PURE__ */
|
|
5603
|
-
/* @__PURE__ */
|
|
5604
|
-
/* @__PURE__ */
|
|
5605
|
-
/* @__PURE__ */
|
|
5606
|
-
/* @__PURE__ */
|
|
5157
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex-1 space-y-3 overflow-y-auto p-4", children: [
|
|
5158
|
+
run.steps.length === 0 && /* @__PURE__ */ jsx13("p", { className: "text-sm text-muted-foreground", children: "No steps recorded yet." }),
|
|
5159
|
+
run.steps.map((step, i) => /* @__PURE__ */ jsxs11("div", { className: "rounded-lg border border-border/60 bg-background", children: [
|
|
5160
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-baseline gap-2 border-b border-border/40 px-3 py-1.5", children: [
|
|
5161
|
+
/* @__PURE__ */ jsx13("span", { className: `font-mono text-[11px] ${step.status === "error" ? "text-destructive" : "text-muted-foreground"}`, children: step.status === "error" ? "\u2717" : "$" }),
|
|
5162
|
+
/* @__PURE__ */ jsx13("code", { className: "min-w-0 flex-1 truncate font-mono text-xs", children: step.label }),
|
|
5163
|
+
/* @__PURE__ */ jsx13("span", { className: "shrink-0 text-[10px] text-muted-foreground", children: new Date(step.at).toLocaleTimeString() })
|
|
5607
5164
|
] }),
|
|
5608
|
-
step.detail && /* @__PURE__ */
|
|
5165
|
+
step.detail && /* @__PURE__ */ jsx13("pre", { className: "max-h-48 overflow-auto whitespace-pre-wrap px-3 py-2 font-mono text-[11px] leading-relaxed text-muted-foreground", children: step.detail })
|
|
5609
5166
|
] }, i))
|
|
5610
5167
|
] }),
|
|
5611
|
-
/* @__PURE__ */
|
|
5168
|
+
/* @__PURE__ */ jsx13("p", { className: "border-t border-border px-4 py-2 text-[11px] text-muted-foreground", children: "Readonly drill-in. Follow up in the main chat." })
|
|
5612
5169
|
] });
|
|
5613
5170
|
}
|
|
5614
5171
|
function pendingApprovalOf(call) {
|
|
@@ -5622,20 +5179,20 @@ function ChatEmptyState({
|
|
|
5622
5179
|
subline = "Describe the outcome you want. The agent works through it step by step, and pauses for your approval before anything irreversible.",
|
|
5623
5180
|
doors
|
|
5624
5181
|
}) {
|
|
5625
|
-
return /* @__PURE__ */
|
|
5626
|
-
/* @__PURE__ */
|
|
5627
|
-
/* @__PURE__ */
|
|
5628
|
-
/* @__PURE__ */
|
|
5629
|
-
subline && /* @__PURE__ */
|
|
5630
|
-
doors && doors.length > 0 && /* @__PURE__ */
|
|
5182
|
+
return /* @__PURE__ */ jsxs11("div", { className: "mx-auto flex w-full max-w-2xl flex-col items-center px-6 py-12 text-center sm:py-20", children: [
|
|
5183
|
+
/* @__PURE__ */ jsx13("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__ */ jsx13(BrandMark, { size: 32, className: "shrink-0" }) }),
|
|
5184
|
+
/* @__PURE__ */ jsx13("p", { className: "text-[11px] font-semibold uppercase tracking-[0.18em] text-muted-foreground", children: productName }),
|
|
5185
|
+
/* @__PURE__ */ jsx13("h2", { className: "mt-1.5 text-balance text-2xl font-semibold leading-tight text-foreground sm:text-[28px]", children: headline }),
|
|
5186
|
+
subline && /* @__PURE__ */ jsx13("p", { className: "mt-3 max-w-md text-[15px] leading-relaxed text-muted-foreground", children: subline }),
|
|
5187
|
+
doors && doors.length > 0 && /* @__PURE__ */ jsx13("div", { className: "mt-7 grid w-full gap-2.5 sm:grid-cols-3", children: doors.slice(0, 3).map((door, i) => /* @__PURE__ */ jsxs11(
|
|
5631
5188
|
"button",
|
|
5632
5189
|
{
|
|
5633
5190
|
type: "button",
|
|
5634
5191
|
onClick: door.onSelect,
|
|
5635
5192
|
className: "group flex min-h-[44px] flex-col items-start rounded-xl border border-border bg-card px-4 py-3 text-left transition hover:border-primary/40 hover:bg-accent/30",
|
|
5636
5193
|
children: [
|
|
5637
|
-
/* @__PURE__ */
|
|
5638
|
-
door.description && /* @__PURE__ */
|
|
5194
|
+
/* @__PURE__ */ jsx13("span", { className: "text-sm font-semibold text-foreground", children: door.label }),
|
|
5195
|
+
door.description && /* @__PURE__ */ jsx13("span", { className: "mt-0.5 text-[12px] leading-snug text-muted-foreground", children: door.description })
|
|
5639
5196
|
]
|
|
5640
5197
|
},
|
|
5641
5198
|
i
|
|
@@ -5644,26 +5201,26 @@ function ChatEmptyState({
|
|
|
5644
5201
|
}
|
|
5645
5202
|
function ToolGlyph({ name, className }) {
|
|
5646
5203
|
if (name.startsWith("sandbox_")) {
|
|
5647
|
-
return /* @__PURE__ */
|
|
5648
|
-
/* @__PURE__ */
|
|
5649
|
-
/* @__PURE__ */
|
|
5204
|
+
return /* @__PURE__ */ jsxs11("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
5205
|
+
/* @__PURE__ */ jsx13("polyline", { points: "4 17 10 11 4 5" }),
|
|
5206
|
+
/* @__PURE__ */ jsx13("line", { x1: "12", y1: "19", x2: "20", y2: "19" })
|
|
5650
5207
|
] });
|
|
5651
5208
|
}
|
|
5652
5209
|
if (name === "submit_proposal") {
|
|
5653
|
-
return /* @__PURE__ */
|
|
5654
|
-
/* @__PURE__ */
|
|
5655
|
-
/* @__PURE__ */
|
|
5210
|
+
return /* @__PURE__ */ jsxs11("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
5211
|
+
/* @__PURE__ */ jsx13("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
5212
|
+
/* @__PURE__ */ jsx13("path", { d: "M14 2v6h6M9 15l2 2 4-4" })
|
|
5656
5213
|
] });
|
|
5657
5214
|
}
|
|
5658
5215
|
if (name === "schedule_followup") {
|
|
5659
|
-
return /* @__PURE__ */
|
|
5660
|
-
/* @__PURE__ */
|
|
5661
|
-
/* @__PURE__ */
|
|
5216
|
+
return /* @__PURE__ */ jsxs11("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": true, children: [
|
|
5217
|
+
/* @__PURE__ */ jsx13("circle", { cx: "12", cy: "12", r: "9" }),
|
|
5218
|
+
/* @__PURE__ */ jsx13("path", { d: "M12 7v5l3 3" })
|
|
5662
5219
|
] });
|
|
5663
5220
|
}
|
|
5664
|
-
return /* @__PURE__ */
|
|
5665
|
-
/* @__PURE__ */
|
|
5666
|
-
/* @__PURE__ */
|
|
5221
|
+
return /* @__PURE__ */ jsxs11("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
5222
|
+
/* @__PURE__ */ jsx13("path", { d: "M12 3v3m0 12v3M3 12h3m12 0h3" }),
|
|
5223
|
+
/* @__PURE__ */ jsx13("circle", { cx: "12", cy: "12", r: "4" })
|
|
5667
5224
|
] });
|
|
5668
5225
|
}
|
|
5669
5226
|
function toolOutcomeOf(call) {
|
|
@@ -5731,40 +5288,40 @@ function truncate(v, max = 240) {
|
|
|
5731
5288
|
function KvRows({ data }) {
|
|
5732
5289
|
const entries = Object.entries(data).filter(([, v]) => v !== void 0 && v !== null && v !== "");
|
|
5733
5290
|
if (!entries.length) return null;
|
|
5734
|
-
return /* @__PURE__ */
|
|
5735
|
-
/* @__PURE__ */
|
|
5736
|
-
/* @__PURE__ */
|
|
5291
|
+
return /* @__PURE__ */ jsx13("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-1", children: entries.map(([k, v]) => /* @__PURE__ */ jsxs11("div", { className: "contents", children: [
|
|
5292
|
+
/* @__PURE__ */ jsx13("dt", { className: "font-mono text-[11px] text-muted-foreground", children: k }),
|
|
5293
|
+
/* @__PURE__ */ jsx13("dd", { className: "min-w-0 whitespace-pre-wrap break-words font-mono text-[11px] text-muted-foreground", children: truncate(v) })
|
|
5737
5294
|
] }, k)) });
|
|
5738
5295
|
}
|
|
5739
5296
|
function ShellDetail({ call }) {
|
|
5740
5297
|
const outcome = toolOutcomeOf(call);
|
|
5741
5298
|
const r = outcome?.result ?? {};
|
|
5742
|
-
return /* @__PURE__ */
|
|
5743
|
-
/* @__PURE__ */
|
|
5744
|
-
/* @__PURE__ */
|
|
5745
|
-
/* @__PURE__ */
|
|
5746
|
-
r.exitCode != null && /* @__PURE__ */
|
|
5299
|
+
return /* @__PURE__ */ jsxs11("div", { className: "overflow-hidden rounded-md bg-zinc-900 font-mono text-[11px] leading-relaxed", children: [
|
|
5300
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2 px-3 pt-2 text-zinc-400", children: [
|
|
5301
|
+
/* @__PURE__ */ jsx13("span", { className: "select-none text-zinc-500", children: "$" }),
|
|
5302
|
+
/* @__PURE__ */ jsx13("span", { className: "min-w-0 flex-1 truncate text-zinc-200", children: String(call.args?.command ?? "") }),
|
|
5303
|
+
r.exitCode != null && /* @__PURE__ */ jsxs11("span", { className: r.exitCode === 0 ? "text-success" : "text-destructive", children: [
|
|
5747
5304
|
"exit ",
|
|
5748
5305
|
r.exitCode
|
|
5749
5306
|
] })
|
|
5750
5307
|
] }),
|
|
5751
|
-
/* @__PURE__ */
|
|
5308
|
+
/* @__PURE__ */ jsx13("pre", { className: "max-h-56 overflow-auto whitespace-pre-wrap px-3 pb-2.5 pt-1.5 text-zinc-300", children: outcome?.ok === false ? outcome.message ?? "failed" : [r.stdout, r.stderr].filter(Boolean).join("\n") || "(no output)" })
|
|
5752
5309
|
] });
|
|
5753
5310
|
}
|
|
5754
5311
|
function DefaultToolDetail({ call }) {
|
|
5755
5312
|
const result = call.result;
|
|
5756
5313
|
const envelope = typeof result === "object" && result !== null ? result : null;
|
|
5757
|
-
return /* @__PURE__ */
|
|
5758
|
-
call.args && Object.keys(call.args).length > 0 && /* @__PURE__ */
|
|
5759
|
-
/* @__PURE__ */
|
|
5760
|
-
/* @__PURE__ */
|
|
5314
|
+
return /* @__PURE__ */ jsxs11("div", { className: "space-y-2", children: [
|
|
5315
|
+
call.args && Object.keys(call.args).length > 0 && /* @__PURE__ */ jsxs11("div", { children: [
|
|
5316
|
+
/* @__PURE__ */ jsx13("p", { className: "mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground", children: "Called with" }),
|
|
5317
|
+
/* @__PURE__ */ jsx13(KvRows, { data: call.args })
|
|
5761
5318
|
] }),
|
|
5762
|
-
envelope ? /* @__PURE__ */
|
|
5763
|
-
/* @__PURE__ */
|
|
5764
|
-
envelope.ok === false ? /* @__PURE__ */
|
|
5765
|
-
] }) : result != null ? /* @__PURE__ */
|
|
5766
|
-
/* @__PURE__ */
|
|
5767
|
-
/* @__PURE__ */
|
|
5319
|
+
envelope ? /* @__PURE__ */ jsxs11("div", { children: [
|
|
5320
|
+
/* @__PURE__ */ jsx13("p", { className: "mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground", children: envelope.ok === false ? "Failed" : "Result" }),
|
|
5321
|
+
envelope.ok === false ? /* @__PURE__ */ jsx13("p", { className: "text-xs text-destructive", children: envelope.message ?? "Tool failed" }) : envelope.result && typeof envelope.result === "object" ? /* @__PURE__ */ jsx13(KvRows, { data: envelope.result }) : envelope.result != null ? /* @__PURE__ */ jsx13("p", { className: "font-mono text-[11px] text-muted-foreground", children: truncate(envelope.result) }) : null
|
|
5322
|
+
] }) : result != null ? /* @__PURE__ */ jsxs11("div", { children: [
|
|
5323
|
+
/* @__PURE__ */ jsx13("p", { className: "mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground", children: "Result" }),
|
|
5324
|
+
/* @__PURE__ */ jsx13("p", { className: "font-mono text-[11px] text-muted-foreground", children: truncate(result) })
|
|
5768
5325
|
] }) : null
|
|
5769
5326
|
] });
|
|
5770
5327
|
}
|
|
@@ -5775,23 +5332,23 @@ function ProposalCard({
|
|
|
5775
5332
|
approval,
|
|
5776
5333
|
renderers
|
|
5777
5334
|
}) {
|
|
5778
|
-
const [expanded, setExpanded] =
|
|
5335
|
+
const [expanded, setExpanded] = useState14(false);
|
|
5779
5336
|
const { summary, meta } = proposalPreview(call);
|
|
5780
5337
|
const custom = renderers?.[call.name]?.(call, message);
|
|
5781
5338
|
const { pending: deciding, run: decide } = usePending();
|
|
5782
|
-
return /* @__PURE__ */
|
|
5783
|
-
/* @__PURE__ */
|
|
5784
|
-
/* @__PURE__ */
|
|
5785
|
-
/* @__PURE__ */
|
|
5786
|
-
/* @__PURE__ */
|
|
5787
|
-
/* @__PURE__ */
|
|
5788
|
-
summary && /* @__PURE__ */
|
|
5789
|
-
meta.length > 0 && /* @__PURE__ */
|
|
5339
|
+
return /* @__PURE__ */ jsxs11("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: [
|
|
5340
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-start gap-2.5 px-4 pt-3.5", children: [
|
|
5341
|
+
/* @__PURE__ */ jsx13("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__ */ jsx13(ToolGlyph, { name: call.name, className: "h-3.5 w-3.5" }) }),
|
|
5342
|
+
/* @__PURE__ */ jsxs11("div", { className: "min-w-0 flex-1", children: [
|
|
5343
|
+
/* @__PURE__ */ jsx13("p", { className: "text-[10px] font-semibold uppercase tracking-wider text-warning-strong", children: "Needs your approval" }),
|
|
5344
|
+
/* @__PURE__ */ jsx13("p", { className: "mt-0.5 text-[15px] font-semibold leading-snug text-foreground", children: friendlyToolTitle(call) }),
|
|
5345
|
+
summary && /* @__PURE__ */ jsx13("p", { className: "mt-1 text-[13px] leading-relaxed text-muted-foreground", children: summary }),
|
|
5346
|
+
meta.length > 0 && /* @__PURE__ */ jsx13("div", { className: "mt-1.5 flex flex-wrap items-center gap-1.5", children: meta.map((m, i) => /* @__PURE__ */ jsx13("span", { className: "rounded-full bg-muted/60 px-2 py-0.5 text-[11px] font-medium text-muted-foreground", children: m }, i)) })
|
|
5790
5347
|
] })
|
|
5791
5348
|
] }),
|
|
5792
|
-
/* @__PURE__ */
|
|
5793
|
-
approval ? /* @__PURE__ */
|
|
5794
|
-
/* @__PURE__ */
|
|
5349
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap items-center gap-2 px-4 pb-3.5 pt-3", children: [
|
|
5350
|
+
approval ? /* @__PURE__ */ jsxs11(Fragment7, { children: [
|
|
5351
|
+
/* @__PURE__ */ jsx13(
|
|
5795
5352
|
"button",
|
|
5796
5353
|
{
|
|
5797
5354
|
type: "button",
|
|
@@ -5801,7 +5358,7 @@ function ProposalCard({
|
|
|
5801
5358
|
children: "Approve & run"
|
|
5802
5359
|
}
|
|
5803
5360
|
),
|
|
5804
|
-
/* @__PURE__ */
|
|
5361
|
+
/* @__PURE__ */ jsx13(
|
|
5805
5362
|
"button",
|
|
5806
5363
|
{
|
|
5807
5364
|
type: "button",
|
|
@@ -5811,8 +5368,8 @@ function ProposalCard({
|
|
|
5811
5368
|
children: "Reject"
|
|
5812
5369
|
}
|
|
5813
5370
|
)
|
|
5814
|
-
] }) : /* @__PURE__ */
|
|
5815
|
-
/* @__PURE__ */
|
|
5371
|
+
] }) : /* @__PURE__ */ jsx13("span", { className: "text-[12px] font-medium text-muted-foreground", children: "Awaiting approval\u2026" }),
|
|
5372
|
+
/* @__PURE__ */ jsxs11(
|
|
5816
5373
|
"button",
|
|
5817
5374
|
{
|
|
5818
5375
|
type: "button",
|
|
@@ -5821,23 +5378,23 @@ function ProposalCard({
|
|
|
5821
5378
|
className: "ml-auto inline-flex items-center gap-1 rounded text-[12px] font-medium text-muted-foreground transition hover:text-foreground",
|
|
5822
5379
|
children: [
|
|
5823
5380
|
expanded ? "Hide details" : "View details",
|
|
5824
|
-
/* @__PURE__ */
|
|
5381
|
+
/* @__PURE__ */ jsx13(ChevronDown, { className: `h-3 w-3 transition-transform ${expanded ? "rotate-180" : ""}` })
|
|
5825
5382
|
]
|
|
5826
5383
|
}
|
|
5827
5384
|
)
|
|
5828
5385
|
] }),
|
|
5829
|
-
expanded && /* @__PURE__ */
|
|
5386
|
+
expanded && /* @__PURE__ */ jsx13("div", { className: "border-t border-warning/20 px-4 py-3 text-xs", children: custom ?? /* @__PURE__ */ jsx13(DefaultToolDetail, { call }) })
|
|
5830
5387
|
] });
|
|
5831
5388
|
}
|
|
5832
5389
|
function FollowupCard({ call }) {
|
|
5833
5390
|
const a = call.args ?? {};
|
|
5834
5391
|
const when = typeof a.when === "string" ? a.when : typeof a.at === "string" ? a.at : typeof a.schedule === "string" ? a.schedule : null;
|
|
5835
|
-
return /* @__PURE__ */
|
|
5836
|
-
/* @__PURE__ */
|
|
5837
|
-
/* @__PURE__ */
|
|
5838
|
-
/* @__PURE__ */
|
|
5392
|
+
return /* @__PURE__ */ jsxs11("div", { className: "w-fit min-w-[260px] max-w-full rounded-lg border border-border/60 border-l-2 border-l-primary/60 bg-muted/20 px-3 py-2 text-sm", children: [
|
|
5393
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
5394
|
+
/* @__PURE__ */ jsx13(ToolGlyph, { name: call.name, className: "h-3.5 w-3.5 shrink-0 text-primary/80" }),
|
|
5395
|
+
/* @__PURE__ */ jsx13("span", { className: "min-w-0 flex-1 truncate font-medium text-foreground", children: friendlyToolTitle(call) })
|
|
5839
5396
|
] }),
|
|
5840
|
-
when && /* @__PURE__ */
|
|
5397
|
+
when && /* @__PURE__ */ jsx13("p", { className: "mt-0.5 pl-[22px] text-[12px] text-muted-foreground", children: when })
|
|
5841
5398
|
] });
|
|
5842
5399
|
}
|
|
5843
5400
|
function ToolCallCard({
|
|
@@ -5847,13 +5404,13 @@ function ToolCallCard({
|
|
|
5847
5404
|
onOpenRun,
|
|
5848
5405
|
renderers
|
|
5849
5406
|
}) {
|
|
5850
|
-
const [expanded, setExpanded] =
|
|
5407
|
+
const [expanded, setExpanded] = useState14(false);
|
|
5851
5408
|
const pending = call.status === "done" ? pendingApprovalOf(call) : null;
|
|
5852
5409
|
const kind = blockKindOf(call);
|
|
5853
5410
|
const failed = call.status === "error" || toolOutcomeOf(call)?.ok === false;
|
|
5854
5411
|
const custom = renderers?.[call.name]?.(call, message);
|
|
5855
5412
|
if (pending) {
|
|
5856
|
-
return /* @__PURE__ */
|
|
5413
|
+
return /* @__PURE__ */ jsx13(
|
|
5857
5414
|
ProposalCard,
|
|
5858
5415
|
{
|
|
5859
5416
|
call,
|
|
@@ -5865,16 +5422,16 @@ function ToolCallCard({
|
|
|
5865
5422
|
);
|
|
5866
5423
|
}
|
|
5867
5424
|
if (kind === "followup" && !failed) {
|
|
5868
|
-
return /* @__PURE__ */
|
|
5425
|
+
return /* @__PURE__ */ jsx13(FollowupCard, { call });
|
|
5869
5426
|
}
|
|
5870
5427
|
const isCommand = kind === "command";
|
|
5871
|
-
return /* @__PURE__ */
|
|
5428
|
+
return /* @__PURE__ */ jsxs11(
|
|
5872
5429
|
"div",
|
|
5873
5430
|
{
|
|
5874
5431
|
className: `w-fit min-w-[280px] max-w-full rounded-lg border text-xs transition ${failed ? "border-destructive/40 bg-destructive/5" : "border-border/60 bg-muted/20"}`,
|
|
5875
5432
|
children: [
|
|
5876
|
-
/* @__PURE__ */
|
|
5877
|
-
/* @__PURE__ */
|
|
5433
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex w-full items-center gap-2 px-3 py-2", children: [
|
|
5434
|
+
/* @__PURE__ */ jsxs11(
|
|
5878
5435
|
"button",
|
|
5879
5436
|
{
|
|
5880
5437
|
type: "button",
|
|
@@ -5882,14 +5439,14 @@ function ToolCallCard({
|
|
|
5882
5439
|
"aria-expanded": expanded,
|
|
5883
5440
|
className: "flex min-w-0 flex-1 items-center gap-2 rounded text-left",
|
|
5884
5441
|
children: [
|
|
5885
|
-
/* @__PURE__ */
|
|
5442
|
+
/* @__PURE__ */ jsx13(
|
|
5886
5443
|
"span",
|
|
5887
5444
|
{
|
|
5888
5445
|
className: `h-2 w-2 shrink-0 rounded-full ${call.status === "running" ? "animate-pulse bg-warning" : failed ? "bg-destructive" : "bg-success"}`
|
|
5889
5446
|
}
|
|
5890
5447
|
),
|
|
5891
|
-
/* @__PURE__ */
|
|
5892
|
-
/* @__PURE__ */
|
|
5448
|
+
/* @__PURE__ */ jsx13(ToolGlyph, { name: call.name, className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
5449
|
+
/* @__PURE__ */ jsx13(
|
|
5893
5450
|
"span",
|
|
5894
5451
|
{
|
|
5895
5452
|
className: `min-w-0 flex-1 truncate ${isCommand ? "font-mono text-[12px] tracking-tight text-foreground/90" : "font-medium"}`,
|
|
@@ -5899,8 +5456,8 @@ function ToolCallCard({
|
|
|
5899
5456
|
]
|
|
5900
5457
|
}
|
|
5901
5458
|
),
|
|
5902
|
-
/* @__PURE__ */
|
|
5903
|
-
/* @__PURE__ */
|
|
5459
|
+
/* @__PURE__ */ jsx13("span", { className: "shrink-0 text-[11px] text-muted-foreground", children: call.status === "running" ? "running\u2026" : failed ? "failed" : "done" }),
|
|
5460
|
+
/* @__PURE__ */ jsx13(
|
|
5904
5461
|
"button",
|
|
5905
5462
|
{
|
|
5906
5463
|
type: "button",
|
|
@@ -5908,13 +5465,13 @@ function ToolCallCard({
|
|
|
5908
5465
|
"aria-label": expanded ? "Collapse details" : "Expand details",
|
|
5909
5466
|
"aria-expanded": expanded,
|
|
5910
5467
|
className: "shrink-0 rounded p-0.5",
|
|
5911
|
-
children: /* @__PURE__ */
|
|
5468
|
+
children: /* @__PURE__ */ jsx13(ChevronDown, { className: `h-3 w-3 text-muted-foreground transition-transform ${expanded ? "rotate-180" : ""}` })
|
|
5912
5469
|
}
|
|
5913
5470
|
)
|
|
5914
5471
|
] }),
|
|
5915
|
-
expanded && /* @__PURE__ */
|
|
5916
|
-
custom ?? (call.name === "sandbox_run_command" ? /* @__PURE__ */
|
|
5917
|
-
onOpenRun && call.name.startsWith("sandbox_") && /* @__PURE__ */
|
|
5472
|
+
expanded && /* @__PURE__ */ jsxs11("div", { className: "border-t border-border/40 px-3 py-2.5", children: [
|
|
5473
|
+
custom ?? (call.name === "sandbox_run_command" ? /* @__PURE__ */ jsx13(ShellDetail, { call }) : /* @__PURE__ */ jsx13(DefaultToolDetail, { call })),
|
|
5474
|
+
onOpenRun && call.name.startsWith("sandbox_") && /* @__PURE__ */ jsx13(
|
|
5918
5475
|
"button",
|
|
5919
5476
|
{
|
|
5920
5477
|
type: "button",
|
|
@@ -5929,7 +5486,7 @@ function ToolCallCard({
|
|
|
5929
5486
|
);
|
|
5930
5487
|
}
|
|
5931
5488
|
function StreamingCaret() {
|
|
5932
|
-
return /* @__PURE__ */
|
|
5489
|
+
return /* @__PURE__ */ jsx13(
|
|
5933
5490
|
"span",
|
|
5934
5491
|
{
|
|
5935
5492
|
className: "ml-0.5 inline-block h-[1.1em] w-[3px] translate-y-[2px] animate-pulse rounded-sm bg-foreground/70",
|
|
@@ -5945,11 +5502,11 @@ function SegmentText({
|
|
|
5945
5502
|
messageClassName
|
|
5946
5503
|
}) {
|
|
5947
5504
|
const text = useSmoothText(content, streaming);
|
|
5948
|
-
const body =
|
|
5505
|
+
const body = useMemo7(() => renderBody(text), [renderBody, text]);
|
|
5949
5506
|
if (!content.trim() && !showCaret) return null;
|
|
5950
|
-
return /* @__PURE__ */
|
|
5507
|
+
return /* @__PURE__ */ jsxs11("div", { className: messageClassName, children: [
|
|
5951
5508
|
body,
|
|
5952
|
-
showCaret && /* @__PURE__ */
|
|
5509
|
+
showCaret && /* @__PURE__ */ jsx13(StreamingCaret, {})
|
|
5953
5510
|
] });
|
|
5954
5511
|
}
|
|
5955
5512
|
var COLLAPSE_TOOL_RUN_AT = 3;
|
|
@@ -5973,7 +5530,7 @@ function SegmentedBody({
|
|
|
5973
5530
|
const leftoverToolCalls = (msg.toolCalls ?? []).filter(
|
|
5974
5531
|
(tc) => !segmentToolIds.has(tc.id)
|
|
5975
5532
|
);
|
|
5976
|
-
const renderToolCard = (call) => /* @__PURE__ */
|
|
5533
|
+
const renderToolCard = (call) => /* @__PURE__ */ jsx13(
|
|
5977
5534
|
ToolCallCard,
|
|
5978
5535
|
{
|
|
5979
5536
|
call,
|
|
@@ -5996,9 +5553,9 @@ function SegmentedBody({
|
|
|
5996
5553
|
else groups.push({ kind: "tools", index: i, calls: [seg.call] });
|
|
5997
5554
|
}
|
|
5998
5555
|
}
|
|
5999
|
-
return /* @__PURE__ */
|
|
5556
|
+
return /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-2", children: [
|
|
6000
5557
|
groups.map(
|
|
6001
|
-
(g) => g.kind === "text" ? /* @__PURE__ */
|
|
5558
|
+
(g) => g.kind === "text" ? /* @__PURE__ */ jsx13(
|
|
6002
5559
|
SegmentText,
|
|
6003
5560
|
{
|
|
6004
5561
|
content: g.content,
|
|
@@ -6008,26 +5565,69 @@ function SegmentedBody({
|
|
|
6008
5565
|
messageClassName
|
|
6009
5566
|
},
|
|
6010
5567
|
`text-${g.index}`
|
|
6011
|
-
) : !streaming && g.calls.length >= COLLAPSE_TOOL_RUN_AT && !g.calls.some(isImportantTool) ? /* @__PURE__ */
|
|
5568
|
+
) : !streaming && g.calls.length >= COLLAPSE_TOOL_RUN_AT && !g.calls.some(isImportantTool) ? /* @__PURE__ */ jsxs11(
|
|
6012
5569
|
"details",
|
|
6013
5570
|
{
|
|
6014
5571
|
className: "rounded-lg border-l-2 border-border/70 bg-muted/20 px-3 py-2",
|
|
6015
5572
|
children: [
|
|
6016
|
-
/* @__PURE__ */
|
|
5573
|
+
/* @__PURE__ */ jsxs11("summary", { className: "cursor-pointer select-none text-xs font-medium text-muted-foreground", children: [
|
|
6017
5574
|
"Worked through ",
|
|
6018
5575
|
g.calls.length,
|
|
6019
5576
|
" steps"
|
|
6020
5577
|
] }),
|
|
6021
|
-
/* @__PURE__ */
|
|
5578
|
+
/* @__PURE__ */ jsx13("div", { className: "mt-2 flex flex-col gap-2", children: g.calls.map(renderToolCard) })
|
|
6022
5579
|
]
|
|
6023
5580
|
},
|
|
6024
5581
|
`tools-${g.index}`
|
|
6025
|
-
) : /* @__PURE__ */
|
|
5582
|
+
) : /* @__PURE__ */ jsx13("div", { className: "flex flex-col gap-2", children: g.calls.map(renderToolCard) }, `tools-${g.index}`)
|
|
6026
5583
|
),
|
|
6027
5584
|
leftoverToolCalls.map(renderToolCard),
|
|
6028
|
-
streaming && segments[lastIndex]?.kind === "tool" && /* @__PURE__ */
|
|
5585
|
+
streaming && segments[lastIndex]?.kind === "tool" && /* @__PURE__ */ jsx13(StreamingCaret, {})
|
|
6029
5586
|
] });
|
|
6030
5587
|
}
|
|
5588
|
+
var QUIET_META_LANE_CLASS = "mt-1 flex h-[18px] items-center gap-2 text-[11px] tracking-wide 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";
|
|
5589
|
+
function copyTextOf(msg) {
|
|
5590
|
+
const textRuns = msg.segments?.filter((s) => s.kind === "text") ?? [];
|
|
5591
|
+
if (textRuns.length > 0) return textRuns.map((s) => s.content).join("\n\n");
|
|
5592
|
+
return msg.content;
|
|
5593
|
+
}
|
|
5594
|
+
function CopyMessageButton({ text }) {
|
|
5595
|
+
const [copied, setCopied] = useState14(false);
|
|
5596
|
+
const timerRef = useRef10(null);
|
|
5597
|
+
useEffect11(
|
|
5598
|
+
() => () => {
|
|
5599
|
+
if (timerRef.current !== null) clearTimeout(timerRef.current);
|
|
5600
|
+
},
|
|
5601
|
+
[]
|
|
5602
|
+
);
|
|
5603
|
+
const copy = () => {
|
|
5604
|
+
const clipboard = navigator.clipboard;
|
|
5605
|
+
if (!clipboard) return;
|
|
5606
|
+
void clipboard.writeText(text).then(
|
|
5607
|
+
() => {
|
|
5608
|
+
setCopied(true);
|
|
5609
|
+
if (timerRef.current !== null) clearTimeout(timerRef.current);
|
|
5610
|
+
timerRef.current = setTimeout(() => setCopied(false), 1200);
|
|
5611
|
+
},
|
|
5612
|
+
() => {
|
|
5613
|
+
}
|
|
5614
|
+
);
|
|
5615
|
+
};
|
|
5616
|
+
return /* @__PURE__ */ jsx13(
|
|
5617
|
+
"button",
|
|
5618
|
+
{
|
|
5619
|
+
type: "button",
|
|
5620
|
+
onClick: copy,
|
|
5621
|
+
"aria-label": "Copy message",
|
|
5622
|
+
title: "Copy message",
|
|
5623
|
+
className: "rounded p-0.5 text-muted-foreground transition hover:bg-accent/40 hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
5624
|
+
children: copied ? /* @__PURE__ */ jsx13("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__ */ jsx13("polyline", { points: "20 6 9 17 4 12" }) }) : /* @__PURE__ */ jsxs11("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: [
|
|
5625
|
+
/* @__PURE__ */ jsx13("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }),
|
|
5626
|
+
/* @__PURE__ */ jsx13("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
5627
|
+
] })
|
|
5628
|
+
}
|
|
5629
|
+
);
|
|
5630
|
+
}
|
|
6031
5631
|
function AssistantMessageImpl({
|
|
6032
5632
|
msg,
|
|
6033
5633
|
streaming,
|
|
@@ -6041,44 +5641,46 @@ function AssistantMessageImpl({
|
|
|
6041
5641
|
durableCards,
|
|
6042
5642
|
resolveAttachmentUrl,
|
|
6043
5643
|
workProductCards,
|
|
6044
|
-
messageClassName
|
|
5644
|
+
messageClassName,
|
|
5645
|
+
chrome
|
|
6045
5646
|
}) {
|
|
6046
5647
|
const content = useSmoothText(msg.content, streaming);
|
|
6047
5648
|
const reasoning = useSmoothText(msg.reasoning ?? "", streaming);
|
|
6048
|
-
const body =
|
|
5649
|
+
const body = useMemo7(() => renderBody(content), [renderBody, content]);
|
|
6049
5650
|
const segments = msg.segments;
|
|
6050
5651
|
const hasAnswerText = content !== "" || (segments?.some((s) => s.kind === "text" && s.content.trim() !== "") ?? false);
|
|
6051
|
-
const reasoningScrollRef =
|
|
6052
|
-
const thinkStartRef =
|
|
6053
|
-
const thinkMsRef =
|
|
5652
|
+
const reasoningScrollRef = useRef10(null);
|
|
5653
|
+
const thinkStartRef = useRef10(null);
|
|
5654
|
+
const thinkMsRef = useRef10(null);
|
|
6054
5655
|
if (streaming && reasoning && !hasAnswerText && thinkStartRef.current === null) {
|
|
6055
5656
|
thinkStartRef.current = performance.now();
|
|
6056
5657
|
}
|
|
6057
5658
|
if (hasAnswerText && thinkStartRef.current !== null && thinkMsRef.current === null) {
|
|
6058
5659
|
thinkMsRef.current = performance.now() - thinkStartRef.current;
|
|
6059
5660
|
}
|
|
6060
|
-
|
|
5661
|
+
useEffect11(() => {
|
|
6061
5662
|
const el = reasoningScrollRef.current;
|
|
6062
5663
|
if (el && streaming && !hasAnswerText) el.scrollTop = el.scrollHeight;
|
|
6063
5664
|
}, [reasoning, streaming, hasAnswerText]);
|
|
6064
5665
|
const thinkingSeconds = useThinkingSeconds(
|
|
6065
5666
|
streaming && !!reasoning && !hasAnswerText
|
|
6066
5667
|
);
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
5668
|
+
const quiet = chrome === "quiet";
|
|
5669
|
+
return /* @__PURE__ */ jsxs11("div", { className: `mx-auto w-full max-w-3xl px-6 ${quiet ? "group pb-1 pt-3" : "py-3"}`, children: [
|
|
5670
|
+
!quiet && /* @__PURE__ */ jsxs11("div", { className: "mb-1 flex items-baseline gap-2 text-[11px] tracking-wide text-muted-foreground", children: [
|
|
5671
|
+
/* @__PURE__ */ jsx13("span", { className: "font-semibold uppercase", children: agentLabel }),
|
|
5672
|
+
msg.modelUsed && /* @__PURE__ */ jsx13("span", { className: "font-mono normal-case", children: msg.modelUsed }),
|
|
5673
|
+
formatTokensPerSecond(msg) && /* @__PURE__ */ jsx13("span", { children: formatTokensPerSecond(msg) }),
|
|
5674
|
+
formatModelCost(msg, models) && /* @__PURE__ */ jsx13("span", { children: formatModelCost(msg, models) })
|
|
6073
5675
|
] }),
|
|
6074
|
-
reasoning && /* @__PURE__ */
|
|
6075
|
-
/* @__PURE__ */
|
|
5676
|
+
reasoning && /* @__PURE__ */ jsxs11("details", { className: "mb-2 rounded-lg border-l-2 border-border/70 bg-muted/20 px-3 py-2", open: !hasAnswerText, children: [
|
|
5677
|
+
/* @__PURE__ */ jsx13("summary", { className: "cursor-pointer select-none text-xs font-medium text-muted-foreground", children: !hasAnswerText ? /* @__PURE__ */ jsxs11("span", { className: "animate-pulse", children: [
|
|
6076
5678
|
"Thinking",
|
|
6077
5679
|
thinkingSeconds >= 3 ? ` \xB7 ${thinkingSeconds}s` : "\u2026"
|
|
6078
5680
|
] }) : thinkMsRef.current != null ? `Thought for ${Math.max(1, Math.round(thinkMsRef.current / 1e3))}s` : "Thought process" }),
|
|
6079
|
-
/* @__PURE__ */
|
|
5681
|
+
/* @__PURE__ */ jsx13("div", { ref: reasoningScrollRef, className: "mt-2 max-h-48 overflow-y-auto whitespace-pre-wrap text-[13px] leading-relaxed text-muted-foreground", children: reasoning })
|
|
6080
5682
|
] }),
|
|
6081
|
-
segments && segments.length > 0 ? /* @__PURE__ */
|
|
5683
|
+
segments && segments.length > 0 ? /* @__PURE__ */ jsx13(
|
|
6082
5684
|
SegmentedBody,
|
|
6083
5685
|
{
|
|
6084
5686
|
segments,
|
|
@@ -6090,12 +5692,12 @@ function AssistantMessageImpl({
|
|
|
6090
5692
|
toolRenderers,
|
|
6091
5693
|
messageClassName
|
|
6092
5694
|
}
|
|
6093
|
-
) : /* @__PURE__ */
|
|
6094
|
-
/* @__PURE__ */
|
|
5695
|
+
) : /* @__PURE__ */ jsxs11(Fragment7, { children: [
|
|
5696
|
+
/* @__PURE__ */ jsxs11("div", { className: messageClassName, children: [
|
|
6095
5697
|
body,
|
|
6096
|
-
streaming && content && !msg.toolCalls?.length && /* @__PURE__ */
|
|
5698
|
+
streaming && content && !msg.toolCalls?.length && /* @__PURE__ */ jsx13(StreamingCaret, {})
|
|
6097
5699
|
] }),
|
|
6098
|
-
msg.toolCalls && msg.toolCalls.length > 0 && /* @__PURE__ */
|
|
5700
|
+
msg.toolCalls && msg.toolCalls.length > 0 && /* @__PURE__ */ jsx13("div", { className: "mt-2 flex flex-col gap-1.5", children: msg.toolCalls.map((tc) => /* @__PURE__ */ jsx13(
|
|
6099
5701
|
ToolCallCard,
|
|
6100
5702
|
{
|
|
6101
5703
|
call: tc,
|
|
@@ -6107,7 +5709,7 @@ function AssistantMessageImpl({
|
|
|
6107
5709
|
tc.id
|
|
6108
5710
|
)) })
|
|
6109
5711
|
] }),
|
|
6110
|
-
durableCards && msg.parts && /* @__PURE__ */
|
|
5712
|
+
durableCards && msg.parts && /* @__PURE__ */ jsx13(
|
|
6111
5713
|
DurableChatCards,
|
|
6112
5714
|
{
|
|
6113
5715
|
...durableCards,
|
|
@@ -6116,7 +5718,7 @@ function AssistantMessageImpl({
|
|
|
6116
5718
|
className: "mt-3"
|
|
6117
5719
|
}
|
|
6118
5720
|
),
|
|
6119
|
-
workProductCards && workProductPartsFromMessageParts(msg.parts).map((part) => /* @__PURE__ */
|
|
5721
|
+
workProductCards && workProductPartsFromMessageParts(msg.parts).map((part) => /* @__PURE__ */ jsx13(
|
|
6120
5722
|
WorkProductCard,
|
|
6121
5723
|
{
|
|
6122
5724
|
part,
|
|
@@ -6126,20 +5728,26 @@ function AssistantMessageImpl({
|
|
|
6126
5728
|
`${part.ref.id}:${part.ref.version}`
|
|
6127
5729
|
)),
|
|
6128
5730
|
renderExtras?.(msg),
|
|
6129
|
-
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */
|
|
5731
|
+
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */ jsx13("div", { className: "mt-2", children: /* @__PURE__ */ jsx13(
|
|
6130
5732
|
MessageAttachments,
|
|
6131
5733
|
{
|
|
6132
5734
|
parts: attachmentPartsFromMessageParts(msg.parts),
|
|
6133
5735
|
resolveFileUrl: resolveAttachmentUrl,
|
|
6134
5736
|
justify: "start"
|
|
6135
5737
|
}
|
|
6136
|
-
) })
|
|
5738
|
+
) }),
|
|
5739
|
+
quiet && /* @__PURE__ */ jsxs11("div", { "data-testid": "message-meta-lane", className: QUIET_META_LANE_CLASS, children: [
|
|
5740
|
+
/* @__PURE__ */ jsx13(CopyMessageButton, { text: copyTextOf(msg) }),
|
|
5741
|
+
msg.modelUsed && /* @__PURE__ */ jsx13("span", { className: "font-mono", children: msg.modelUsed }),
|
|
5742
|
+
formatTokensPerSecond(msg) && /* @__PURE__ */ jsx13("span", { children: formatTokensPerSecond(msg) }),
|
|
5743
|
+
formatModelCost(msg, models) && /* @__PURE__ */ jsx13("span", { children: formatModelCost(msg, models) })
|
|
5744
|
+
] })
|
|
6137
5745
|
] });
|
|
6138
5746
|
}
|
|
6139
5747
|
var AssistantMessage = memo(AssistantMessageImpl);
|
|
6140
5748
|
function useThinkingSeconds(active) {
|
|
6141
|
-
const [seconds, setSeconds] =
|
|
6142
|
-
|
|
5749
|
+
const [seconds, setSeconds] = useState14(0);
|
|
5750
|
+
useEffect11(() => {
|
|
6143
5751
|
if (!active) return;
|
|
6144
5752
|
setSeconds(0);
|
|
6145
5753
|
const id = setInterval(() => setSeconds((s) => s + 1), 1e3);
|
|
@@ -6147,25 +5755,25 @@ function useThinkingSeconds(active) {
|
|
|
6147
5755
|
}, [active]);
|
|
6148
5756
|
return seconds;
|
|
6149
5757
|
}
|
|
6150
|
-
function ThinkingRow({ agentLabel }) {
|
|
5758
|
+
function ThinkingRow({ agentLabel, chrome = "labeled" }) {
|
|
6151
5759
|
const seconds = useThinkingSeconds(true);
|
|
6152
|
-
return /* @__PURE__ */
|
|
6153
|
-
/* @__PURE__ */
|
|
6154
|
-
/* @__PURE__ */
|
|
6155
|
-
/* @__PURE__ */
|
|
5760
|
+
return /* @__PURE__ */ jsxs11("div", { className: "mx-auto w-full max-w-3xl px-6 py-3", children: [
|
|
5761
|
+
chrome !== "quiet" && /* @__PURE__ */ jsx13("p", { className: "mb-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: agentLabel }),
|
|
5762
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2 text-base text-muted-foreground", children: [
|
|
5763
|
+
/* @__PURE__ */ jsx13("svg", { className: "h-4 w-4 animate-spin", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": true, children: /* @__PURE__ */ jsx13("path", { d: "M21 12a9 9 0 1 1-6.219-8.56", strokeLinecap: "round" }) }),
|
|
6156
5764
|
"Thinking",
|
|
6157
5765
|
seconds >= 3 ? ` \xB7 ${seconds}s` : "..."
|
|
6158
5766
|
] })
|
|
6159
5767
|
] });
|
|
6160
5768
|
}
|
|
6161
5769
|
function StreamErrorRow({ message, onRetry }) {
|
|
6162
|
-
return /* @__PURE__ */
|
|
6163
|
-
/* @__PURE__ */
|
|
6164
|
-
/* @__PURE__ */
|
|
6165
|
-
/* @__PURE__ */
|
|
5770
|
+
return /* @__PURE__ */ jsx13("div", { className: "mx-auto w-full max-w-3xl px-6 py-3", children: /* @__PURE__ */ jsxs11("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: [
|
|
5771
|
+
/* @__PURE__ */ jsxs11("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: [
|
|
5772
|
+
/* @__PURE__ */ jsx13("circle", { cx: "12", cy: "12", r: "9" }),
|
|
5773
|
+
/* @__PURE__ */ jsx13("path", { d: "M12 8v4m0 4h.01" })
|
|
6166
5774
|
] }),
|
|
6167
|
-
/* @__PURE__ */
|
|
6168
|
-
onRetry && /* @__PURE__ */
|
|
5775
|
+
/* @__PURE__ */ jsx13("span", { className: "min-w-0 flex-1 break-words", children: message }),
|
|
5776
|
+
onRetry && /* @__PURE__ */ jsx13(
|
|
6169
5777
|
"button",
|
|
6170
5778
|
{
|
|
6171
5779
|
type: "button",
|
|
@@ -6179,6 +5787,7 @@ function StreamErrorRow({ message, onRetry }) {
|
|
|
6179
5787
|
function ChatMessages({
|
|
6180
5788
|
messages,
|
|
6181
5789
|
messageSize = "default",
|
|
5790
|
+
chrome = "labeled",
|
|
6182
5791
|
models = [],
|
|
6183
5792
|
renderMarkdown,
|
|
6184
5793
|
renderExtras,
|
|
@@ -6198,39 +5807,43 @@ function ChatMessages({
|
|
|
6198
5807
|
workProductCards
|
|
6199
5808
|
}) {
|
|
6200
5809
|
const messageClassName = messageSize === "large" ? "agent-app-message-copy text-[17px] leading-[1.75]" : "agent-app-message-copy text-base leading-[1.75]";
|
|
6201
|
-
const renderBody =
|
|
6202
|
-
() => renderMarkdown ?? ((content) => /* @__PURE__ */
|
|
5810
|
+
const renderBody = useMemo7(
|
|
5811
|
+
() => renderMarkdown ?? ((content) => /* @__PURE__ */ jsx13("p", { className: "whitespace-pre-wrap", children: content })),
|
|
6203
5812
|
[renderMarkdown]
|
|
6204
5813
|
);
|
|
6205
5814
|
const lastIsUser = messages[messages.length - 1]?.role === "user";
|
|
5815
|
+
const quiet = chrome === "quiet";
|
|
6206
5816
|
if (messages.length === 0 && !loading && !error) {
|
|
6207
|
-
const empty = renderEmpty ? renderEmpty() : /* @__PURE__ */
|
|
6208
|
-
return /* @__PURE__ */
|
|
5817
|
+
const empty = renderEmpty ? renderEmpty() : /* @__PURE__ */ jsx13(ChatEmptyState, { ...emptyState });
|
|
5818
|
+
return /* @__PURE__ */ jsxs11(Fragment7, { children: [
|
|
6209
5819
|
header,
|
|
6210
5820
|
empty
|
|
6211
5821
|
] });
|
|
6212
5822
|
}
|
|
6213
|
-
return /* @__PURE__ */
|
|
5823
|
+
return /* @__PURE__ */ jsxs11(Fragment7, { children: [
|
|
6214
5824
|
header,
|
|
6215
5825
|
messages.map(
|
|
6216
|
-
(msg) => msg.role === "user" ? /* @__PURE__ */
|
|
6217
|
-
/* @__PURE__ */
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
5826
|
+
(msg) => msg.role === "user" ? /* @__PURE__ */ jsxs11("div", { className: `mx-auto w-full max-w-3xl px-6 ${quiet ? "group pb-1 pt-3" : "py-3"}`, children: [
|
|
5827
|
+
/* @__PURE__ */ jsxs11("div", { className: `ml-auto w-fit ${quiet ? "max-w-[72%]" : "max-w-[85%]"}`, children: [
|
|
5828
|
+
!quiet && /* @__PURE__ */ jsx13("p", { className: "mb-1 text-right text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: userLabel }),
|
|
5829
|
+
/* @__PURE__ */ jsx13(
|
|
5830
|
+
"div",
|
|
5831
|
+
{
|
|
5832
|
+
className: quiet ? `rounded-2xl bg-[color-mix(in_srgb,hsl(var(--secondary))_65%,hsl(var(--background)))] px-4 py-2.5 ${messageClassName}` : `rounded-2xl rounded-tr-md bg-primary/10 px-4 py-2.5 ${messageClassName}`,
|
|
5833
|
+
children: /* @__PURE__ */ jsx13("p", { className: "whitespace-pre-wrap", children: msg.content })
|
|
5834
|
+
}
|
|
5835
|
+
),
|
|
5836
|
+
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */ jsx13("div", { className: "mt-1.5", children: /* @__PURE__ */ jsx13(
|
|
5837
|
+
MessageAttachments,
|
|
5838
|
+
{
|
|
5839
|
+
parts: attachmentPartsFromMessageParts(msg.parts),
|
|
5840
|
+
resolveFileUrl: resolveAttachmentUrl,
|
|
5841
|
+
justify: "end"
|
|
5842
|
+
}
|
|
5843
|
+
) })
|
|
5844
|
+
] }),
|
|
5845
|
+
quiet && /* @__PURE__ */ jsx13("div", { "data-testid": "message-meta-lane", className: `${QUIET_META_LANE_CLASS} justify-end`, children: /* @__PURE__ */ jsx13(CopyMessageButton, { text: msg.content }) })
|
|
5846
|
+
] }, msg.id) : /* @__PURE__ */ jsx13(
|
|
6234
5847
|
AssistantMessage,
|
|
6235
5848
|
{
|
|
6236
5849
|
msg,
|
|
@@ -6245,25 +5858,20 @@ function ChatMessages({
|
|
|
6245
5858
|
durableCards,
|
|
6246
5859
|
resolveAttachmentUrl,
|
|
6247
5860
|
workProductCards,
|
|
6248
|
-
messageClassName
|
|
5861
|
+
messageClassName,
|
|
5862
|
+
chrome
|
|
6249
5863
|
},
|
|
6250
5864
|
msg.id
|
|
6251
5865
|
)
|
|
6252
5866
|
),
|
|
6253
|
-
loading && lastIsUser && /* @__PURE__ */
|
|
6254
|
-
error && !loading && /* @__PURE__ */
|
|
5867
|
+
loading && lastIsUser && /* @__PURE__ */ jsx13(ThinkingRow, { agentLabel, chrome }),
|
|
5868
|
+
error && !loading && /* @__PURE__ */ jsx13(StreamErrorRow, { message: error, onRetry })
|
|
6255
5869
|
] });
|
|
6256
5870
|
}
|
|
6257
5871
|
|
|
6258
5872
|
export {
|
|
6259
5873
|
nextRevealCount,
|
|
6260
5874
|
useSmoothText,
|
|
6261
|
-
ProviderLogo,
|
|
6262
|
-
usePopover,
|
|
6263
|
-
usePending,
|
|
6264
|
-
ModelPicker,
|
|
6265
|
-
DEFAULT_EFFORT_LEVELS,
|
|
6266
|
-
EffortPicker,
|
|
6267
5875
|
interactionStatusLabels,
|
|
6268
5876
|
interactionTerminalNotes,
|
|
6269
5877
|
fieldValuesFromAnswers,
|
|
@@ -6366,7 +5974,6 @@ export {
|
|
|
6366
5974
|
withoutRecordGridRemoved,
|
|
6367
5975
|
pruneRecordGridOverlay,
|
|
6368
5976
|
RecordGrid,
|
|
6369
|
-
AgentSessionControls,
|
|
6370
5977
|
formatModelCost,
|
|
6371
5978
|
formatTokensPerSecond,
|
|
6372
5979
|
RunDrillIn,
|
|
@@ -6375,4 +5982,4 @@ export {
|
|
|
6375
5982
|
useThinkingSeconds,
|
|
6376
5983
|
ChatMessages
|
|
6377
5984
|
};
|
|
6378
|
-
//# sourceMappingURL=chunk-
|
|
5985
|
+
//# sourceMappingURL=chunk-IFYJDX3J.js.map
|