@tangle-network/agent-app 4.0.25 → 4.0.27
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/assistant/index.js +2 -1
- package/dist/assistant/index.js.map +1 -1
- package/dist/chat-routes/draft-persistence.d.ts +1 -4
- package/dist/chat-routes/index.js +10 -8
- package/dist/chat-routes/index.js.map +1 -1
- package/dist/{chunk-GPCQRTWF.js → chunk-7ZNW7NOX.js} +11 -8
- package/dist/chunk-7ZNW7NOX.js.map +1 -0
- package/dist/{chunk-ZZZLYVZX.js → chunk-H7NMUXNZ.js} +6 -5
- package/dist/chunk-H7NMUXNZ.js.map +1 -0
- package/dist/chunk-IMSNXL2S.js +1 -0
- package/dist/{chunk-V3YVG7DJ.js → chunk-LSUJ2RIC.js} +2 -2
- package/dist/{chunk-BQH5HAKO.js → chunk-O6MFZVNS.js} +1 -5
- package/dist/chunk-O6MFZVNS.js.map +1 -0
- package/dist/chunk-QM5TPZQY.js +18 -0
- package/dist/chunk-QM5TPZQY.js.map +1 -0
- package/dist/{chunk-M4LA7JMU.js → chunk-R57ZNKJB.js} +976 -784
- package/dist/chunk-R57ZNKJB.js.map +1 -0
- package/dist/{chunk-HCNEVBPJ.js → chunk-RK2VCJQW.js} +2 -2
- package/dist/{chunk-Z5M2Z2QK.js → chunk-U4HKZV5U.js} +2 -2
- package/dist/{chunk-75DKKZQ3.js → chunk-UFR4BXCC.js} +2 -2
- package/dist/preset-cloudflare/index.js +7 -5
- package/dist/preset-cloudflare/index.js.map +1 -1
- package/dist/public-consultation/index.d.ts +1 -1
- package/dist/public-consultation/index.js +6 -5
- package/dist/public-consultation/index.js.map +1 -1
- package/dist/runtime/index.js +3 -3
- package/dist/runtime/router-turn.js +2 -2
- package/dist/sandbox/index.js +2 -2
- package/dist/stories/fixtures/turn-trace.d.ts +1799 -0
- package/dist/turn-trace/index.d.ts +1 -0
- package/dist/turn-trace/index.js +9 -3
- package/dist/turn-trace/url.d.ts +12 -0
- package/dist/web-react/index.d.ts +2 -0
- package/dist/web-react/index.js +10 -1
- package/dist/web-react/turn-trace-drawer.d.ts +26 -0
- package/dist/web-react/turn-trace-flow.d.ts +20 -0
- package/package.json +1 -1
- package/dist/chunk-BQH5HAKO.js.map +0 -1
- package/dist/chunk-GPCQRTWF.js.map +0 -1
- package/dist/chunk-KG2Y44XT.js +0 -1
- package/dist/chunk-M4LA7JMU.js.map +0 -1
- package/dist/chunk-ZZZLYVZX.js.map +0 -1
- /package/dist/{chunk-KG2Y44XT.js.map → chunk-IMSNXL2S.js.map} +0 -0
- /package/dist/{chunk-V3YVG7DJ.js.map → chunk-LSUJ2RIC.js.map} +0 -0
- /package/dist/{chunk-HCNEVBPJ.js.map → chunk-RK2VCJQW.js.map} +0 -0
- /package/dist/{chunk-Z5M2Z2QK.js.map → chunk-U4HKZV5U.js.map} +0 -0
- /package/dist/{chunk-75DKKZQ3.js.map → chunk-UFR4BXCC.js.map} +0 -0
|
@@ -50,6 +50,10 @@ import {
|
|
|
50
50
|
import {
|
|
51
51
|
AsyncView
|
|
52
52
|
} from "./chunk-AVP5SNIG.js";
|
|
53
|
+
import {
|
|
54
|
+
executionIdOfAssistantRow,
|
|
55
|
+
turnTraceUrl
|
|
56
|
+
} from "./chunk-QM5TPZQY.js";
|
|
53
57
|
import {
|
|
54
58
|
attachmentPartsFromMessageParts
|
|
55
59
|
} from "./chunk-4YZKDWMB.js";
|
|
@@ -388,7 +392,7 @@ function TurnProgress({ phase, pendingMessage = "Sending\u2026", startedAt, show
|
|
|
388
392
|
const id = setInterval(() => setNow(Date.now()), 1e3);
|
|
389
393
|
return () => clearInterval(id);
|
|
390
394
|
}, []);
|
|
391
|
-
const
|
|
395
|
+
const seconds2 = Math.max(0, Math.floor((now - (startedAt ?? mountedAt)) / 1e3));
|
|
392
396
|
const message = phase?.message?.trim() || pendingMessage;
|
|
393
397
|
return /* @__PURE__ */ jsxs(
|
|
394
398
|
"div",
|
|
@@ -398,8 +402,8 @@ function TurnProgress({ phase, pendingMessage = "Sending\u2026", startedAt, show
|
|
|
398
402
|
className: ["flex min-w-0 items-center gap-2 text-sm text-muted-foreground", className].filter(Boolean).join(" "),
|
|
399
403
|
children: [
|
|
400
404
|
/* @__PURE__ */ jsx(TextShimmer, { className: "min-w-0 truncate", children: message }),
|
|
401
|
-
showElapsed &&
|
|
402
|
-
|
|
405
|
+
showElapsed && seconds2 >= ELAPSED_VISIBLE_FROM_SECONDS && /* @__PURE__ */ jsxs("span", { "aria-hidden": true, className: "shrink-0 tabular-nums", children: [
|
|
406
|
+
seconds2,
|
|
403
407
|
"s"
|
|
404
408
|
] })
|
|
405
409
|
]
|
|
@@ -582,8 +586,8 @@ function reasoningPreview(text) {
|
|
|
582
586
|
return flat.length > 120 ? `${flat.slice(0, 119)}\u2026` : flat;
|
|
583
587
|
}
|
|
584
588
|
function thoughtForLabel(durationMs) {
|
|
585
|
-
const
|
|
586
|
-
return `Thought for ${
|
|
589
|
+
const seconds2 = Math.max(1, Math.round(durationMs / 1e3));
|
|
590
|
+
return `Thought for ${seconds2} second${seconds2 === 1 ? "" : "s"}`;
|
|
587
591
|
}
|
|
588
592
|
function useSecondTick(active) {
|
|
589
593
|
const [, setTick] = useState3(0);
|
|
@@ -3018,10 +3022,10 @@ function AttachmentChip({ part, resolveFileUrl, fetchFile }) {
|
|
|
3018
3022
|
setErrorMessage(result.message);
|
|
3019
3023
|
return;
|
|
3020
3024
|
}
|
|
3021
|
-
const
|
|
3022
|
-
if (!
|
|
3025
|
+
const download2 = triggerAttachmentDownload(displayName, result.blob);
|
|
3026
|
+
if (!download2.ok) {
|
|
3023
3027
|
setStatus("error");
|
|
3024
|
-
setErrorMessage(
|
|
3028
|
+
setErrorMessage(download2.message);
|
|
3025
3029
|
return;
|
|
3026
3030
|
}
|
|
3027
3031
|
setStatus("idle");
|
|
@@ -3123,8 +3127,8 @@ function formatActivityDuration(durationMs) {
|
|
|
3123
3127
|
const totalSeconds = Math.round(durationMs / 1e3);
|
|
3124
3128
|
if (totalSeconds < 60) return `${totalSeconds}s`;
|
|
3125
3129
|
const minutes = Math.floor(totalSeconds / 60);
|
|
3126
|
-
const
|
|
3127
|
-
if (minutes < 60) return `${minutes}m ${String(
|
|
3130
|
+
const seconds2 = totalSeconds % 60;
|
|
3131
|
+
if (minutes < 60) return `${minutes}m ${String(seconds2).padStart(2, "0")}s`;
|
|
3128
3132
|
return `${Math.floor(minutes / 60)}h ${String(minutes % 60).padStart(2, "0")}m`;
|
|
3129
3133
|
}
|
|
3130
3134
|
function mergeActivityPages(existing, incoming) {
|
|
@@ -3340,8 +3344,192 @@ function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent ac
|
|
|
3340
3344
|
] });
|
|
3341
3345
|
}
|
|
3342
3346
|
|
|
3347
|
+
// src/web-react/turn-trace-drawer.tsx
|
|
3348
|
+
import { FlowWaterfall as FlowWaterfall2 } from "@tangle-network/charts/react";
|
|
3349
|
+
import { Button as Button3, Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, SheetTrigger } from "@tangle-network/ui/primitives";
|
|
3350
|
+
import { Activity } from "lucide-react";
|
|
3351
|
+
import { useCallback as useCallback8, useEffect as useEffect11, useRef as useRef12, useState as useState17 } from "react";
|
|
3352
|
+
|
|
3353
|
+
// src/web-react/turn-trace-flow.ts
|
|
3354
|
+
import { decodeOtlpTraceExport } from "@tangle-network/agent-trace-contract/otlp";
|
|
3355
|
+
function turnTraceUrlForMessage(turnPath, messageId) {
|
|
3356
|
+
const executionId = executionIdOfAssistantRow(messageId);
|
|
3357
|
+
return executionId ? turnTraceUrl(turnPath, executionId) : null;
|
|
3358
|
+
}
|
|
3359
|
+
var num = (value) => {
|
|
3360
|
+
const n = typeof value === "string" ? Number(value) : value;
|
|
3361
|
+
return typeof n === "number" && Number.isFinite(n) ? n : void 0;
|
|
3362
|
+
};
|
|
3363
|
+
var nanosToMs = (nanos) => nanos ? Number(BigInt(nanos) / 1000n) / 1e3 : 0;
|
|
3364
|
+
function flowKind(name, spanKind, isRoot) {
|
|
3365
|
+
if (isRoot) return "pipeline";
|
|
3366
|
+
if (spanKind === "model" || name === "model.call") return "model";
|
|
3367
|
+
if (spanKind === "tool" || name === "tool.call") return "tool";
|
|
3368
|
+
return "waiting";
|
|
3369
|
+
}
|
|
3370
|
+
function turnTraceFlow(exported) {
|
|
3371
|
+
const all = decodeOtlpTraceExport(exported);
|
|
3372
|
+
const root = all.filter((span) => span.name === "agent_app.turn" && !span.parent_span_id).sort((a, b) => nanosToMs(b.start_time_unix_nano) - nanosToMs(a.start_time_unix_nano))[0];
|
|
3373
|
+
if (!root) return null;
|
|
3374
|
+
const kept = /* @__PURE__ */ new Set([root.span_id]);
|
|
3375
|
+
for (let size = 0; size !== kept.size; ) {
|
|
3376
|
+
size = kept.size;
|
|
3377
|
+
for (const span of all) if (span.parent_span_id && kept.has(span.parent_span_id)) kept.add(span.span_id);
|
|
3378
|
+
}
|
|
3379
|
+
const spans = all.filter((span) => kept.has(span.span_id));
|
|
3380
|
+
const origin = nanosToMs(root.start_time_unix_nano);
|
|
3381
|
+
const attr = root.span_attributes;
|
|
3382
|
+
const flow = spans.map((span) => {
|
|
3383
|
+
const a = span.span_attributes;
|
|
3384
|
+
const isRoot = span === root;
|
|
3385
|
+
const detail = a["gen_ai.request.model"] ?? a["gen_ai.tool.name"];
|
|
3386
|
+
const promptTokens2 = num(a["gen_ai.usage.input_tokens"]);
|
|
3387
|
+
const completionTokens2 = num(a["gen_ai.usage.output_tokens"]);
|
|
3388
|
+
const cachedTokens = num(a["gen_ai.usage.cache_read.input_tokens"]);
|
|
3389
|
+
return {
|
|
3390
|
+
id: span.span_id,
|
|
3391
|
+
...!isRoot && span.parent_span_id ? { parentId: span.parent_span_id } : {},
|
|
3392
|
+
kind: flowKind(span.name, a["tangle.turn.span_kind"], isRoot),
|
|
3393
|
+
name: isRoot ? "Turn" : span.name,
|
|
3394
|
+
startMs: nanosToMs(span.start_time_unix_nano) - origin,
|
|
3395
|
+
endMs: nanosToMs(span.end_time_unix_nano) - origin,
|
|
3396
|
+
status: span.status_code === 2 ? "failed" : "done",
|
|
3397
|
+
...typeof detail === "string" && !isRoot ? { detail } : {},
|
|
3398
|
+
...isRoot && typeof a["gen_ai.request.model"] === "string" ? { detail: a["gen_ai.request.model"] } : {},
|
|
3399
|
+
...promptTokens2 !== void 0 ? { promptTokens: promptTokens2 } : {},
|
|
3400
|
+
...completionTokens2 !== void 0 ? { completionTokens: completionTokens2 } : {},
|
|
3401
|
+
...cachedTokens !== void 0 ? { cachedTokens } : {},
|
|
3402
|
+
...a.approx === true ? { approx: true } : {}
|
|
3403
|
+
};
|
|
3404
|
+
});
|
|
3405
|
+
const calls = flow.filter((span) => span.kind === "model" && span.promptTokens !== void 0);
|
|
3406
|
+
const total = (key) => calls.length === 0 ? void 0 : calls.reduce((sum, span) => sum + (span[key] ?? 0), 0);
|
|
3407
|
+
const promptTokens = total("promptTokens");
|
|
3408
|
+
const completionTokens = total("completionTokens");
|
|
3409
|
+
const modelCalls = num(attr["tangle.turn.model_calls"]);
|
|
3410
|
+
const toolCalls = num(attr["tangle.turn.tool_calls"]);
|
|
3411
|
+
const wallMs = num(attr["tangle.turn.wall_ms"]);
|
|
3412
|
+
const coveragePct = num(attr["tangle.turn.coverage_pct"]);
|
|
3413
|
+
const firstVisibleMs = num(attr["tangle.turn.first_visible_ms"]);
|
|
3414
|
+
const firstTextMs = num(attr["tangle.turn.first_text_ms"]);
|
|
3415
|
+
return {
|
|
3416
|
+
traceId: root.trace_id,
|
|
3417
|
+
flow: {
|
|
3418
|
+
spans: flow,
|
|
3419
|
+
totalMs: nanosToMs(root.end_time_unix_nano) - origin,
|
|
3420
|
+
...promptTokens !== void 0 ? { promptTokens } : {},
|
|
3421
|
+
...completionTokens !== void 0 ? { completionTokens } : {},
|
|
3422
|
+
...modelCalls !== void 0 ? { modelCalls } : {},
|
|
3423
|
+
...toolCalls !== void 0 ? { toolCalls } : {},
|
|
3424
|
+
// The turn's own failure is its status, not one more failed step.
|
|
3425
|
+
errors: flow.filter((span) => span.status === "failed" && span.kind !== "pipeline").length
|
|
3426
|
+
},
|
|
3427
|
+
...wallMs !== void 0 ? { wallMs } : {},
|
|
3428
|
+
...coveragePct !== void 0 ? { coveragePct } : {},
|
|
3429
|
+
...firstVisibleMs !== void 0 ? { firstVisibleMs } : {},
|
|
3430
|
+
...firstTextMs !== void 0 ? { firstTextMs } : {}
|
|
3431
|
+
};
|
|
3432
|
+
}
|
|
3433
|
+
|
|
3434
|
+
// src/web-react/turn-trace-drawer.tsx
|
|
3435
|
+
import { Fragment as Fragment3, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3436
|
+
var NO_TRACE_YET = "No trace for this turn yet. A trace is saved a few seconds after its turn finishes; older turns may have none.";
|
|
3437
|
+
function absentState(code) {
|
|
3438
|
+
return code === "turn_trace_unreadable" ? { status: "absent", retry: false, message: "This app does not keep turn traces." } : { status: "absent", retry: true, message: NO_TRACE_YET };
|
|
3439
|
+
}
|
|
3440
|
+
async function readTrace(traceUrl, fetchImpl, signal) {
|
|
3441
|
+
const response = await fetchImpl(traceUrl, { credentials: "same-origin", headers: { accept: "application/json" }, signal });
|
|
3442
|
+
const body = await response.text();
|
|
3443
|
+
let parsed;
|
|
3444
|
+
try {
|
|
3445
|
+
parsed = JSON.parse(body);
|
|
3446
|
+
} catch {
|
|
3447
|
+
return { status: "failed", message: "The trace link did not answer with a trace." };
|
|
3448
|
+
}
|
|
3449
|
+
if (response.status === 404) return absentState(parsed?.code);
|
|
3450
|
+
if (!response.ok) return { status: "failed", message: `The trace could not be read (HTTP ${response.status}).` };
|
|
3451
|
+
const trace = turnTraceFlow(parsed);
|
|
3452
|
+
return trace ? { status: "ready", body, trace } : absentState(void 0);
|
|
3453
|
+
}
|
|
3454
|
+
var seconds = (ms) => ms === void 0 ? "unknown" : `${(ms / 1e3).toFixed(1)} s`;
|
|
3455
|
+
function summaryLine(trace) {
|
|
3456
|
+
return [
|
|
3457
|
+
`${seconds(trace.wallMs ?? trace.flow.totalMs)} in all`,
|
|
3458
|
+
`first output after ${seconds(trace.firstVisibleMs)}`,
|
|
3459
|
+
`first answer text after ${seconds(trace.firstTextMs)}`,
|
|
3460
|
+
...trace.coveragePct === void 0 ? [] : [`${trace.coveragePct}% of the time inside a named step`]
|
|
3461
|
+
].join(" \xB7 ");
|
|
3462
|
+
}
|
|
3463
|
+
function download(body, traceId) {
|
|
3464
|
+
const href = URL.createObjectURL(new Blob([body], { type: "application/json" }));
|
|
3465
|
+
const link = Object.assign(document.createElement("a"), { href, download: `turn-${traceId}.otlp.json` });
|
|
3466
|
+
link.click();
|
|
3467
|
+
setTimeout(() => URL.revokeObjectURL(href), 0);
|
|
3468
|
+
}
|
|
3469
|
+
function TurnTraceDrawer({ traceUrl, open, onOpenChange, trigger, renderIcon, fetchImpl }) {
|
|
3470
|
+
const [state, setState] = useState17({ status: "loading" });
|
|
3471
|
+
const [attempt, setAttempt] = useState17(0);
|
|
3472
|
+
const fetchRef = useRef12(fetchImpl);
|
|
3473
|
+
fetchRef.current = fetchImpl;
|
|
3474
|
+
useEffect11(() => {
|
|
3475
|
+
if (!open) return;
|
|
3476
|
+
const controller = new AbortController();
|
|
3477
|
+
setState({ status: "loading" });
|
|
3478
|
+
readTrace(traceUrl, fetchRef.current ?? fetch, controller.signal).then(
|
|
3479
|
+
(next) => {
|
|
3480
|
+
if (!controller.signal.aborted) setState(next);
|
|
3481
|
+
},
|
|
3482
|
+
() => {
|
|
3483
|
+
if (!controller.signal.aborted) setState({ status: "failed", message: "The trace could not be read. Check your connection and try again." });
|
|
3484
|
+
}
|
|
3485
|
+
);
|
|
3486
|
+
return () => controller.abort();
|
|
3487
|
+
}, [open, traceUrl, attempt]);
|
|
3488
|
+
const retry = useCallback8(() => setAttempt((n) => n + 1), []);
|
|
3489
|
+
return /* @__PURE__ */ jsxs11(Sheet, { open, onOpenChange, children: [
|
|
3490
|
+
trigger && /* @__PURE__ */ jsx13(SheetTrigger, { asChild: true, children: trigger }),
|
|
3491
|
+
/* @__PURE__ */ jsxs11(SheetContent, { side: "right", className: "flex w-full flex-col gap-4 overflow-y-auto sm:max-w-3xl", children: [
|
|
3492
|
+
/* @__PURE__ */ jsxs11(SheetHeader, { children: [
|
|
3493
|
+
/* @__PURE__ */ jsx13(SheetTitle, { children: "Turn trace" }),
|
|
3494
|
+
/* @__PURE__ */ jsx13(SheetDescription, { children: state.status === "ready" ? summaryLine(state.trace) : "Where this turn spent its time: each step, model call and tool call, on one clock." })
|
|
3495
|
+
] }),
|
|
3496
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-4 px-4 pb-6", "aria-live": "polite", children: [
|
|
3497
|
+
state.status === "loading" && /* @__PURE__ */ jsx13("p", { className: "text-sm text-muted-foreground", children: "Reading the trace\u2026" }),
|
|
3498
|
+
state.status === "absent" && /* @__PURE__ */ jsxs11("div", { className: "flex flex-col items-start gap-2 text-sm text-muted-foreground", children: [
|
|
3499
|
+
/* @__PURE__ */ jsx13("p", { children: state.message }),
|
|
3500
|
+
state.retry && /* @__PURE__ */ jsx13(Button3, { variant: "outline", size: "sm", onClick: retry, children: "Read again" })
|
|
3501
|
+
] }),
|
|
3502
|
+
state.status === "failed" && /* @__PURE__ */ jsxs11("div", { className: "flex flex-col items-start gap-2 text-sm", children: [
|
|
3503
|
+
/* @__PURE__ */ jsx13("p", { role: "alert", children: state.message }),
|
|
3504
|
+
/* @__PURE__ */ jsx13(Button3, { variant: "outline", size: "sm", onClick: retry, children: "Try again" })
|
|
3505
|
+
] }),
|
|
3506
|
+
state.status === "ready" && /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
3507
|
+
/* @__PURE__ */ jsx13("div", { className: "rounded-md border border-border bg-secondary p-2", children: /* @__PURE__ */ jsx13(FlowWaterfall2, { trace: state.trace.flow, defaultView: "spans", ...renderIcon ? { renderIcon } : {} }) }),
|
|
3508
|
+
/* @__PURE__ */ jsx13("div", { children: /* @__PURE__ */ jsx13(Button3, { variant: "outline", size: "sm", onClick: () => download(state.body, state.trace.traceId), children: "Download OTLP" }) })
|
|
3509
|
+
] })
|
|
3510
|
+
] })
|
|
3511
|
+
] })
|
|
3512
|
+
] });
|
|
3513
|
+
}
|
|
3514
|
+
var TRACE_ACTION_CLASS = "inline-flex items-center gap-1 rounded p-0.5 text-xs text-muted-foreground transition hover:bg-accent hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring";
|
|
3515
|
+
function TurnTraceButton({ label = "Trace", ...drawer }) {
|
|
3516
|
+
const [open, setOpen] = useState17(false);
|
|
3517
|
+
return /* @__PURE__ */ jsx13(
|
|
3518
|
+
TurnTraceDrawer,
|
|
3519
|
+
{
|
|
3520
|
+
...drawer,
|
|
3521
|
+
open,
|
|
3522
|
+
onOpenChange: setOpen,
|
|
3523
|
+
trigger: /* @__PURE__ */ jsxs11("button", { type: "button", title: "Where this turn spent its time", className: TRACE_ACTION_CLASS, children: [
|
|
3524
|
+
/* @__PURE__ */ jsx13(Activity, { className: "h-3.5 w-3.5", "aria-hidden": true }),
|
|
3525
|
+
label
|
|
3526
|
+
] })
|
|
3527
|
+
}
|
|
3528
|
+
);
|
|
3529
|
+
}
|
|
3530
|
+
|
|
3343
3531
|
// src/web-react/provenance.tsx
|
|
3344
|
-
import { useCallback as
|
|
3532
|
+
import { useCallback as useCallback9, useEffect as useEffect12, useId, useRef as useRef13, useState as useState18 } from "react";
|
|
3345
3533
|
|
|
3346
3534
|
// src/web-react/provenance-model.ts
|
|
3347
3535
|
var PROVENANCE_BASES = ["extracted", "entered", "computed", "asserted"];
|
|
@@ -3501,7 +3689,7 @@ function provenanceTriggerLabel(record2, standing) {
|
|
|
3501
3689
|
}
|
|
3502
3690
|
|
|
3503
3691
|
// src/web-react/provenance.tsx
|
|
3504
|
-
import { jsx as
|
|
3692
|
+
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3505
3693
|
var BASIS_TONES = {
|
|
3506
3694
|
extracted: "border-primary/30 bg-primary/10 text-primary",
|
|
3507
3695
|
entered: "border-success/30 bg-success/10 text-success",
|
|
@@ -3526,27 +3714,27 @@ function BasisGlyph({ basis, className }) {
|
|
|
3526
3714
|
};
|
|
3527
3715
|
switch (basis) {
|
|
3528
3716
|
case "extracted":
|
|
3529
|
-
return /* @__PURE__ */
|
|
3530
|
-
/* @__PURE__ */
|
|
3531
|
-
/* @__PURE__ */
|
|
3532
|
-
/* @__PURE__ */
|
|
3717
|
+
return /* @__PURE__ */ jsxs12("svg", { ...shared, children: [
|
|
3718
|
+
/* @__PURE__ */ jsx14("path", { d: "M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z" }),
|
|
3719
|
+
/* @__PURE__ */ jsx14("polyline", { points: "14 3 14 8 19 8" }),
|
|
3720
|
+
/* @__PURE__ */ jsx14("line", { x1: "9", y1: "13", x2: "15", y2: "13" })
|
|
3533
3721
|
] });
|
|
3534
3722
|
case "entered":
|
|
3535
|
-
return /* @__PURE__ */
|
|
3536
|
-
/* @__PURE__ */
|
|
3537
|
-
/* @__PURE__ */
|
|
3723
|
+
return /* @__PURE__ */ jsxs12("svg", { ...shared, children: [
|
|
3724
|
+
/* @__PURE__ */ jsx14("path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }),
|
|
3725
|
+
/* @__PURE__ */ jsx14("circle", { cx: "12", cy: "7", r: "4" })
|
|
3538
3726
|
] });
|
|
3539
3727
|
case "computed":
|
|
3540
|
-
return /* @__PURE__ */
|
|
3541
|
-
/* @__PURE__ */
|
|
3542
|
-
/* @__PURE__ */
|
|
3543
|
-
/* @__PURE__ */
|
|
3544
|
-
/* @__PURE__ */
|
|
3728
|
+
return /* @__PURE__ */ jsxs12("svg", { ...shared, children: [
|
|
3729
|
+
/* @__PURE__ */ jsx14("line", { x1: "4", y1: "9", x2: "20", y2: "9" }),
|
|
3730
|
+
/* @__PURE__ */ jsx14("line", { x1: "4", y1: "15", x2: "20", y2: "15" }),
|
|
3731
|
+
/* @__PURE__ */ jsx14("line", { x1: "10", y1: "3", x2: "8", y2: "21" }),
|
|
3732
|
+
/* @__PURE__ */ jsx14("line", { x1: "16", y1: "3", x2: "14", y2: "21" })
|
|
3545
3733
|
] });
|
|
3546
3734
|
case "asserted":
|
|
3547
|
-
return /* @__PURE__ */
|
|
3548
|
-
/* @__PURE__ */
|
|
3549
|
-
/* @__PURE__ */
|
|
3735
|
+
return /* @__PURE__ */ jsxs12("svg", { ...shared, children: [
|
|
3736
|
+
/* @__PURE__ */ jsx14("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" }),
|
|
3737
|
+
/* @__PURE__ */ jsx14("circle", { cx: "12", cy: "12", r: "3.2" })
|
|
3550
3738
|
] });
|
|
3551
3739
|
}
|
|
3552
3740
|
}
|
|
@@ -3566,11 +3754,11 @@ function SourceRow({
|
|
|
3566
3754
|
const status = source.status ?? "ready";
|
|
3567
3755
|
const statusLine = describeProvenanceSourceStatus(source);
|
|
3568
3756
|
const openable = status === "ready" && (onOpenSource !== void 0 || source.href !== void 0);
|
|
3569
|
-
return /* @__PURE__ */
|
|
3570
|
-
/* @__PURE__ */
|
|
3571
|
-
/* @__PURE__ */
|
|
3572
|
-
source.locator && /* @__PURE__ */
|
|
3573
|
-
openable && (onOpenSource ? /* @__PURE__ */
|
|
3757
|
+
return /* @__PURE__ */ jsxs12("li", { className: "rounded-md border border-card-edge bg-card px-2.5 py-2", children: [
|
|
3758
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex flex-wrap items-baseline gap-x-2 gap-y-1", children: [
|
|
3759
|
+
/* @__PURE__ */ jsx14("span", { className: "text-sm font-medium text-foreground", children: source.label }),
|
|
3760
|
+
source.locator && /* @__PURE__ */ jsx14("span", { className: "text-xs text-muted-foreground", children: source.locator }),
|
|
3761
|
+
openable && (onOpenSource ? /* @__PURE__ */ jsxs12(
|
|
3574
3762
|
"button",
|
|
3575
3763
|
{
|
|
3576
3764
|
type: "button",
|
|
@@ -3581,7 +3769,7 @@ function SourceRow({
|
|
|
3581
3769
|
source.label
|
|
3582
3770
|
]
|
|
3583
3771
|
}
|
|
3584
|
-
) : /* @__PURE__ */
|
|
3772
|
+
) : /* @__PURE__ */ jsxs12(
|
|
3585
3773
|
"a",
|
|
3586
3774
|
{
|
|
3587
3775
|
href: source.href,
|
|
@@ -3595,7 +3783,7 @@ function SourceRow({
|
|
|
3595
3783
|
}
|
|
3596
3784
|
))
|
|
3597
3785
|
] }),
|
|
3598
|
-
source.quote && /* @__PURE__ */
|
|
3786
|
+
source.quote && /* @__PURE__ */ jsxs12("blockquote", { className: "mt-1 border-l-2 border-primary/50 pl-2 text-[12px] italic leading-snug text-foreground", children: [
|
|
3599
3787
|
"\u201C",
|
|
3600
3788
|
source.quote,
|
|
3601
3789
|
"\u201D"
|
|
@@ -3604,14 +3792,14 @@ function SourceRow({
|
|
|
3604
3792
|
// update is theirs to read, not an interruption. Either way it is TEXT
|
|
3605
3793
|
// — a spinner alone and a greyed row alone both render as "nothing
|
|
3606
3794
|
// here".
|
|
3607
|
-
/* @__PURE__ */
|
|
3795
|
+
/* @__PURE__ */ jsxs12(
|
|
3608
3796
|
"p",
|
|
3609
3797
|
{
|
|
3610
3798
|
role: "status",
|
|
3611
3799
|
className: `mt-1 text-xs ${status === "unavailable" ? "text-destructive" : "text-muted-foreground"}`,
|
|
3612
3800
|
children: [
|
|
3613
3801
|
statusLine,
|
|
3614
|
-
status === "unavailable" && onRetrySource && /* @__PURE__ */
|
|
3802
|
+
status === "unavailable" && onRetrySource && /* @__PURE__ */ jsx14(
|
|
3615
3803
|
"button",
|
|
3616
3804
|
{
|
|
3617
3805
|
type: "button",
|
|
@@ -3635,9 +3823,9 @@ function ProvenanceValue({
|
|
|
3635
3823
|
missingValueLabel = DEFAULT_MISSING_VALUE_LABEL,
|
|
3636
3824
|
className
|
|
3637
3825
|
}) {
|
|
3638
|
-
const [open, setOpen] =
|
|
3639
|
-
const triggerRef =
|
|
3640
|
-
const rootRef =
|
|
3826
|
+
const [open, setOpen] = useState18(defaultOpen);
|
|
3827
|
+
const triggerRef = useRef13(null);
|
|
3828
|
+
const rootRef = useRef13(null);
|
|
3641
3829
|
const panelId = useId();
|
|
3642
3830
|
const standing = rollUpProvenanceStanding(record2, confidencePolicy);
|
|
3643
3831
|
const basisMeta = provenanceBasisMeta(record2.basis);
|
|
@@ -3647,7 +3835,7 @@ function ProvenanceValue({
|
|
|
3647
3835
|
const sources = record2.sources ?? [];
|
|
3648
3836
|
const inputs = record2.inputs ?? [];
|
|
3649
3837
|
const hasValue = record2.display.trim() !== "";
|
|
3650
|
-
const onKeyDown =
|
|
3838
|
+
const onKeyDown = useCallback9(
|
|
3651
3839
|
(event) => {
|
|
3652
3840
|
if (event.key !== "Escape" || !open) return;
|
|
3653
3841
|
event.stopPropagation();
|
|
@@ -3656,11 +3844,11 @@ function ProvenanceValue({
|
|
|
3656
3844
|
},
|
|
3657
3845
|
[open]
|
|
3658
3846
|
);
|
|
3659
|
-
const onToggle =
|
|
3847
|
+
const onToggle = useCallback9(() => {
|
|
3660
3848
|
if (!open) closeTrailsOutside(rootRef.current);
|
|
3661
3849
|
setOpen(!open);
|
|
3662
3850
|
}, [open]);
|
|
3663
|
-
|
|
3851
|
+
useEffect12(() => {
|
|
3664
3852
|
const root = rootRef.current;
|
|
3665
3853
|
if (!open || root === null) return;
|
|
3666
3854
|
const entry = { root, close: () => setOpen(false) };
|
|
@@ -3678,12 +3866,12 @@ function ProvenanceValue({
|
|
|
3678
3866
|
document.removeEventListener("touchstart", onPointerDown, true);
|
|
3679
3867
|
};
|
|
3680
3868
|
}, [open]);
|
|
3681
|
-
const summary = /* @__PURE__ */
|
|
3682
|
-
record2.label && /* @__PURE__ */
|
|
3683
|
-
/* @__PURE__ */
|
|
3869
|
+
const summary = /* @__PURE__ */ jsxs12("span", { className: "inline-flex flex-wrap items-baseline gap-x-1.5", children: [
|
|
3870
|
+
record2.label && /* @__PURE__ */ jsx14("span", { className: "text-xs text-muted-foreground", children: record2.label }),
|
|
3871
|
+
/* @__PURE__ */ jsx14("span", { className: hasValue ? "text-sm text-foreground" : "text-sm italic text-muted-foreground", children: hasValue ? record2.display : missingValueLabel })
|
|
3684
3872
|
] });
|
|
3685
3873
|
if (maxDepth <= 0) {
|
|
3686
|
-
return /* @__PURE__ */
|
|
3874
|
+
return /* @__PURE__ */ jsxs12(
|
|
3687
3875
|
"div",
|
|
3688
3876
|
{
|
|
3689
3877
|
className: `inline-block max-w-full [overflow-wrap:anywhere] ${className ?? ""}`,
|
|
@@ -3691,22 +3879,22 @@ function ProvenanceValue({
|
|
|
3691
3879
|
"data-provenance-standing": standing,
|
|
3692
3880
|
children: [
|
|
3693
3881
|
summary,
|
|
3694
|
-
/* @__PURE__ */
|
|
3882
|
+
/* @__PURE__ */ jsxs12(
|
|
3695
3883
|
"span",
|
|
3696
3884
|
{
|
|
3697
3885
|
className: `ml-1.5 inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-xs font-medium ${BASIS_TONES[record2.basis]}`,
|
|
3698
3886
|
children: [
|
|
3699
|
-
/* @__PURE__ */
|
|
3887
|
+
/* @__PURE__ */ jsx14(BasisGlyph, { basis: record2.basis, className: "h-3 w-3" }),
|
|
3700
3888
|
basisMeta.label
|
|
3701
3889
|
]
|
|
3702
3890
|
}
|
|
3703
3891
|
),
|
|
3704
|
-
/* @__PURE__ */
|
|
3892
|
+
/* @__PURE__ */ jsx14("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: describeProvenance(record2) })
|
|
3705
3893
|
]
|
|
3706
3894
|
}
|
|
3707
3895
|
);
|
|
3708
3896
|
}
|
|
3709
|
-
return /* @__PURE__ */
|
|
3897
|
+
return /* @__PURE__ */ jsxs12(
|
|
3710
3898
|
"div",
|
|
3711
3899
|
{
|
|
3712
3900
|
ref: rootRef,
|
|
@@ -3715,9 +3903,9 @@ function ProvenanceValue({
|
|
|
3715
3903
|
"data-provenance-basis": record2.basis,
|
|
3716
3904
|
"data-provenance-standing": standing,
|
|
3717
3905
|
children: [
|
|
3718
|
-
/* @__PURE__ */
|
|
3906
|
+
/* @__PURE__ */ jsxs12("span", { className: "inline-flex flex-wrap items-baseline gap-1.5", children: [
|
|
3719
3907
|
summary,
|
|
3720
|
-
/* @__PURE__ */
|
|
3908
|
+
/* @__PURE__ */ jsxs12(
|
|
3721
3909
|
"button",
|
|
3722
3910
|
{
|
|
3723
3911
|
ref: triggerRef,
|
|
@@ -3728,17 +3916,17 @@ function ProvenanceValue({
|
|
|
3728
3916
|
"aria-label": provenanceTriggerLabel(record2, standing),
|
|
3729
3917
|
className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-xs font-medium transition hover:brightness-105 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring ${BASIS_TONES[record2.basis]}`,
|
|
3730
3918
|
children: [
|
|
3731
|
-
/* @__PURE__ */
|
|
3732
|
-
/* @__PURE__ */
|
|
3919
|
+
/* @__PURE__ */ jsx14(BasisGlyph, { basis: record2.basis, className: "h-3 w-3" }),
|
|
3920
|
+
/* @__PURE__ */ jsx14("span", { "aria-hidden": true, children: basisMeta.label })
|
|
3733
3921
|
]
|
|
3734
3922
|
}
|
|
3735
3923
|
),
|
|
3736
3924
|
standing !== "settled" && // Legible at rest: what to do about the value does not wait for
|
|
3737
3925
|
// someone to open the panel. `aria-hidden` because the trigger's
|
|
3738
3926
|
// accessible name already carries it — this is the visual half.
|
|
3739
|
-
/* @__PURE__ */
|
|
3927
|
+
/* @__PURE__ */ jsx14("span", { "aria-hidden": true, className: `text-xs font-medium ${STANDING_TONES[standing]}`, children: standingMeta.label })
|
|
3740
3928
|
] }),
|
|
3741
|
-
open && /* @__PURE__ */
|
|
3929
|
+
open && /* @__PURE__ */ jsxs12(
|
|
3742
3930
|
"div",
|
|
3743
3931
|
{
|
|
3744
3932
|
id: panelId,
|
|
@@ -3746,19 +3934,19 @@ function ProvenanceValue({
|
|
|
3746
3934
|
"aria-label": provenanceTriggerLabel(record2, standing),
|
|
3747
3935
|
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",
|
|
3748
3936
|
children: [
|
|
3749
|
-
/* @__PURE__ */
|
|
3750
|
-
/* @__PURE__ */
|
|
3751
|
-
/* @__PURE__ */
|
|
3937
|
+
/* @__PURE__ */ jsxs12("div", { children: [
|
|
3938
|
+
/* @__PURE__ */ jsx14("p", { className: "text-[12px] leading-snug text-foreground", children: describeProvenance(record2) }),
|
|
3939
|
+
/* @__PURE__ */ jsxs12("p", { className: `mt-0.5 text-xs leading-snug ${STANDING_TONES[standing]}`, children: [
|
|
3752
3940
|
standingMeta.label,
|
|
3753
3941
|
" \u2014 ",
|
|
3754
3942
|
provenanceNextMove(record2, standing, confidencePolicy)
|
|
3755
3943
|
] }),
|
|
3756
|
-
basisMeta.checkableAgainst === null && /* @__PURE__ */
|
|
3944
|
+
basisMeta.checkableAgainst === null && /* @__PURE__ */ jsxs12("p", { className: "mt-0.5 text-xs leading-snug text-muted-foreground", children: [
|
|
3757
3945
|
basisMeta.meaning,
|
|
3758
3946
|
" There is nothing outside the model to check it against."
|
|
3759
3947
|
] })
|
|
3760
3948
|
] }),
|
|
3761
|
-
sources.length > 0 && /* @__PURE__ */
|
|
3949
|
+
sources.length > 0 && /* @__PURE__ */ jsx14("ul", { className: "space-y-1.5", children: sources.map((source, index) => /* @__PURE__ */ jsx14(
|
|
3762
3950
|
SourceRow,
|
|
3763
3951
|
{
|
|
3764
3952
|
source,
|
|
@@ -3771,12 +3959,12 @@ function ProvenanceValue({
|
|
|
3771
3959
|
gaps.filter((gap) => gap.kind !== "unavailable-source").map((gap) => (
|
|
3772
3960
|
// An unavailable source already states itself on its own row; a
|
|
3773
3961
|
// structural gap has no row to state it, so it gets one here.
|
|
3774
|
-
/* @__PURE__ */
|
|
3962
|
+
/* @__PURE__ */ jsx14("p", { className: "rounded-md bg-destructive/10 px-2 py-1.5 text-xs leading-snug text-destructive", children: gap.message }, gap.kind)
|
|
3775
3963
|
)),
|
|
3776
|
-
loading.length > 0 && sources.length === 0 && /* @__PURE__ */
|
|
3777
|
-
inputs.length > 0 && /* @__PURE__ */
|
|
3778
|
-
/* @__PURE__ */
|
|
3779
|
-
/* @__PURE__ */
|
|
3964
|
+
loading.length > 0 && sources.length === 0 && /* @__PURE__ */ jsx14("p", { role: "status", className: "text-xs text-muted-foreground", children: "Looking up where this came from\u2026" }),
|
|
3965
|
+
inputs.length > 0 && /* @__PURE__ */ jsxs12("div", { className: "border-t border-border pt-2", children: [
|
|
3966
|
+
/* @__PURE__ */ jsx14("p", { className: "text-xs font-medium uppercase tracking-[0.05em] text-muted-foreground", children: record2.derivation ? `Computed from ${record2.derivation}` : "Computed from" }),
|
|
3967
|
+
/* @__PURE__ */ jsx14("ul", { className: "mt-1.5 space-y-1.5", children: inputs.map((input, index) => /* @__PURE__ */ jsx14("li", { children: /* @__PURE__ */ jsx14(
|
|
3780
3968
|
ProvenanceValue,
|
|
3781
3969
|
{
|
|
3782
3970
|
record: input,
|
|
@@ -3797,26 +3985,26 @@ function ProvenanceValue({
|
|
|
3797
3985
|
}
|
|
3798
3986
|
function ProvenanceLegend({ bases, className }) {
|
|
3799
3987
|
if (bases.length === 0) return null;
|
|
3800
|
-
return /* @__PURE__ */
|
|
3988
|
+
return /* @__PURE__ */ jsx14("ul", { className: `flex flex-wrap items-center gap-x-3 gap-y-1.5 ${className ?? ""}`, children: bases.map((basis) => {
|
|
3801
3989
|
const meta = provenanceBasisMeta(basis);
|
|
3802
|
-
return /* @__PURE__ */
|
|
3803
|
-
/* @__PURE__ */
|
|
3990
|
+
return /* @__PURE__ */ jsxs12("li", { className: "flex items-center gap-1.5 text-xs text-muted-foreground", children: [
|
|
3991
|
+
/* @__PURE__ */ jsxs12(
|
|
3804
3992
|
"span",
|
|
3805
3993
|
{
|
|
3806
3994
|
className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-xs font-medium ${BASIS_TONES[basis]}`,
|
|
3807
3995
|
children: [
|
|
3808
|
-
/* @__PURE__ */
|
|
3996
|
+
/* @__PURE__ */ jsx14(BasisGlyph, { basis, className: "h-3 w-3" }),
|
|
3809
3997
|
meta.label
|
|
3810
3998
|
]
|
|
3811
3999
|
}
|
|
3812
4000
|
),
|
|
3813
|
-
/* @__PURE__ */
|
|
4001
|
+
/* @__PURE__ */ jsx14("span", { children: meta.meaning })
|
|
3814
4002
|
] }, basis);
|
|
3815
4003
|
}) });
|
|
3816
4004
|
}
|
|
3817
4005
|
|
|
3818
4006
|
// src/web-react/seat-paywall.tsx
|
|
3819
|
-
import { Fragment as
|
|
4007
|
+
import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3820
4008
|
function usd(cents) {
|
|
3821
4009
|
return new Intl.NumberFormat("en-US", {
|
|
3822
4010
|
style: "currency",
|
|
@@ -3826,7 +4014,7 @@ function usd(cents) {
|
|
|
3826
4014
|
}).format(cents / 100);
|
|
3827
4015
|
}
|
|
3828
4016
|
function CheckGlyph3() {
|
|
3829
|
-
return /* @__PURE__ */
|
|
4017
|
+
return /* @__PURE__ */ jsx15(
|
|
3830
4018
|
"svg",
|
|
3831
4019
|
{
|
|
3832
4020
|
className: "h-4 w-4 shrink-0 text-primary",
|
|
@@ -3837,14 +4025,14 @@ function CheckGlyph3() {
|
|
|
3837
4025
|
strokeLinecap: "round",
|
|
3838
4026
|
strokeLinejoin: "round",
|
|
3839
4027
|
"aria-hidden": true,
|
|
3840
|
-
children: /* @__PURE__ */
|
|
4028
|
+
children: /* @__PURE__ */ jsx15("path", { d: "M20 6 9 17l-5-5" })
|
|
3841
4029
|
}
|
|
3842
4030
|
);
|
|
3843
4031
|
}
|
|
3844
4032
|
function Benefit({ children }) {
|
|
3845
|
-
return /* @__PURE__ */
|
|
3846
|
-
/* @__PURE__ */
|
|
3847
|
-
/* @__PURE__ */
|
|
4033
|
+
return /* @__PURE__ */ jsxs13("li", { className: "flex items-start gap-2.5 text-sm text-foreground", children: [
|
|
4034
|
+
/* @__PURE__ */ jsx15("span", { className: "mt-0.5", children: /* @__PURE__ */ jsx15(CheckGlyph3, {}) }),
|
|
4035
|
+
/* @__PURE__ */ jsx15("span", { children })
|
|
3848
4036
|
] });
|
|
3849
4037
|
}
|
|
3850
4038
|
function SeatPaywall({
|
|
@@ -3862,45 +4050,45 @@ function SeatPaywall({
|
|
|
3862
4050
|
const recurringPrice = offer ? usd(offer.recurring.priceCents) : `$${priceUsd}`;
|
|
3863
4051
|
const recurringUsage = offer ? usd(offer.recurring.includedCreditsCents) : `$${includedUsageUsd}`;
|
|
3864
4052
|
const introductory = offer?.introductory ?? null;
|
|
3865
|
-
return /* @__PURE__ */
|
|
3866
|
-
/* @__PURE__ */
|
|
3867
|
-
/* @__PURE__ */
|
|
4053
|
+
return /* @__PURE__ */ jsx15("div", { className: "flex min-h-[60vh] w-full items-center justify-center p-6", children: /* @__PURE__ */ jsxs13("div", { className: "w-full max-w-md rounded-2xl border border-card-edge bg-card p-8", children: [
|
|
4054
|
+
/* @__PURE__ */ jsx15("p", { className: "text-xs font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: product }),
|
|
4055
|
+
/* @__PURE__ */ jsxs13("h1", { className: "mt-2 text-2xl font-semibold tracking-tight text-foreground", children: [
|
|
3868
4056
|
"Unlock ",
|
|
3869
4057
|
product
|
|
3870
4058
|
] }),
|
|
3871
|
-
tagline && /* @__PURE__ */
|
|
3872
|
-
introductory ? /* @__PURE__ */
|
|
3873
|
-
/* @__PURE__ */
|
|
3874
|
-
/* @__PURE__ */
|
|
3875
|
-
/* @__PURE__ */
|
|
4059
|
+
tagline && /* @__PURE__ */ jsx15("p", { className: "mt-2 text-sm text-muted-foreground", children: tagline }),
|
|
4060
|
+
introductory ? /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
4061
|
+
/* @__PURE__ */ jsxs13("div", { className: "mt-6 flex items-baseline gap-1.5", children: [
|
|
4062
|
+
/* @__PURE__ */ jsx15("span", { className: "text-3xl font-semibold text-foreground", children: usd(introductory.priceCents) }),
|
|
4063
|
+
/* @__PURE__ */ jsx15("span", { className: "text-sm text-muted-foreground", children: "first month" })
|
|
3876
4064
|
] }),
|
|
3877
|
-
/* @__PURE__ */
|
|
4065
|
+
/* @__PURE__ */ jsxs13("p", { className: "mt-1 text-sm text-muted-foreground", children: [
|
|
3878
4066
|
"Includes ",
|
|
3879
4067
|
usd(introductory.includedCreditsCents),
|
|
3880
4068
|
" of AI usage in your first month"
|
|
3881
4069
|
] }),
|
|
3882
|
-
/* @__PURE__ */
|
|
4070
|
+
/* @__PURE__ */ jsxs13("p", { className: "mt-1 text-sm text-muted-foreground", children: [
|
|
3883
4071
|
"Then ",
|
|
3884
4072
|
recurringPrice,
|
|
3885
4073
|
"/mo \xB7 includes ",
|
|
3886
4074
|
recurringUsage,
|
|
3887
4075
|
"/mo of AI usage"
|
|
3888
4076
|
] })
|
|
3889
|
-
] }) : /* @__PURE__ */
|
|
3890
|
-
/* @__PURE__ */
|
|
3891
|
-
/* @__PURE__ */
|
|
3892
|
-
/* @__PURE__ */
|
|
4077
|
+
] }) : /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
4078
|
+
/* @__PURE__ */ jsxs13("div", { className: "mt-6 flex items-baseline gap-1.5", children: [
|
|
4079
|
+
/* @__PURE__ */ jsx15("span", { className: "text-3xl font-semibold text-foreground", children: recurringPrice }),
|
|
4080
|
+
/* @__PURE__ */ jsx15("span", { className: "text-sm text-muted-foreground", children: "/mo" })
|
|
3893
4081
|
] }),
|
|
3894
|
-
/* @__PURE__ */
|
|
4082
|
+
/* @__PURE__ */ jsxs13("p", { className: "mt-1 text-sm text-muted-foreground", children: [
|
|
3895
4083
|
"Includes ",
|
|
3896
4084
|
recurringUsage,
|
|
3897
4085
|
"/mo of AI usage"
|
|
3898
4086
|
] })
|
|
3899
4087
|
] }),
|
|
3900
|
-
/* @__PURE__ */
|
|
4088
|
+
/* @__PURE__ */ jsx15("ul", { className: "mt-6 space-y-2.5", children: (benefits ?? [
|
|
3901
4089
|
`Full access to ${product}`
|
|
3902
|
-
]).map((benefit, i) => /* @__PURE__ */
|
|
3903
|
-
/* @__PURE__ */
|
|
4090
|
+
]).map((benefit, i) => /* @__PURE__ */ jsx15(Benefit, { children: benefit }, i)) }),
|
|
4091
|
+
/* @__PURE__ */ jsx15(
|
|
3904
4092
|
"button",
|
|
3905
4093
|
{
|
|
3906
4094
|
type: "button",
|
|
@@ -3910,12 +4098,12 @@ function SeatPaywall({
|
|
|
3910
4098
|
children: pending ? "Opening checkout\u2026" : ctaLabel ?? "Continue to checkout"
|
|
3911
4099
|
}
|
|
3912
4100
|
),
|
|
3913
|
-
footnote && /* @__PURE__ */
|
|
4101
|
+
footnote && /* @__PURE__ */ jsx15("p", { className: "mt-3 text-center text-xs text-muted-foreground/70", children: footnote })
|
|
3914
4102
|
] }) });
|
|
3915
4103
|
}
|
|
3916
4104
|
|
|
3917
4105
|
// src/web-react/use-session-history.ts
|
|
3918
|
-
import { useCallback as
|
|
4106
|
+
import { useCallback as useCallback10, useEffect as useEffect13, useMemo as useMemo6, useRef as useRef14, useState as useState19 } from "react";
|
|
3919
4107
|
function seedSignature(page) {
|
|
3920
4108
|
return JSON.stringify({
|
|
3921
4109
|
nextCursor: page.nextCursor ?? null,
|
|
@@ -3936,24 +4124,24 @@ function useSessionHistory({
|
|
|
3936
4124
|
initialPage,
|
|
3937
4125
|
defaultSort = "newest"
|
|
3938
4126
|
}) {
|
|
3939
|
-
const [items, setItems] =
|
|
3940
|
-
const [nextCursor, setNextCursor] =
|
|
3941
|
-
const [phase, setPhase] =
|
|
3942
|
-
const [reloadKey, setReloadKey] =
|
|
3943
|
-
const seqRef =
|
|
3944
|
-
const resetAbortRef =
|
|
3945
|
-
const loadMoreAbortRef =
|
|
3946
|
-
const loadingMoreRef =
|
|
3947
|
-
const lastOpRef =
|
|
3948
|
-
const nextCursorRef =
|
|
4127
|
+
const [items, setItems] = useState19(initialPage.items);
|
|
4128
|
+
const [nextCursor, setNextCursor] = useState19(initialPage.nextCursor ?? null);
|
|
4129
|
+
const [phase, setPhase] = useState19("idle");
|
|
4130
|
+
const [reloadKey, setReloadKey] = useState19(0);
|
|
4131
|
+
const seqRef = useRef14(0);
|
|
4132
|
+
const resetAbortRef = useRef14(null);
|
|
4133
|
+
const loadMoreAbortRef = useRef14(null);
|
|
4134
|
+
const loadingMoreRef = useRef14(false);
|
|
4135
|
+
const lastOpRef = useRef14("first");
|
|
4136
|
+
const nextCursorRef = useRef14(nextCursor);
|
|
3949
4137
|
nextCursorRef.current = nextCursor;
|
|
3950
|
-
const viewRef =
|
|
4138
|
+
const viewRef = useRef14({ q, sort, fetchPage });
|
|
3951
4139
|
viewRef.current = { q, sort, fetchPage };
|
|
3952
|
-
const seedRef =
|
|
4140
|
+
const seedRef = useRef14(initialPage);
|
|
3953
4141
|
seedRef.current = initialPage;
|
|
3954
4142
|
const isDefaultView = q === "" && sort === defaultSort;
|
|
3955
4143
|
const seedKey = useMemo6(() => seedSignature(initialPage), [initialPage]);
|
|
3956
|
-
|
|
4144
|
+
useEffect13(() => {
|
|
3957
4145
|
resetAbortRef.current?.abort();
|
|
3958
4146
|
loadMoreAbortRef.current?.abort();
|
|
3959
4147
|
loadingMoreRef.current = false;
|
|
@@ -3984,7 +4172,7 @@ function useSessionHistory({
|
|
|
3984
4172
|
})();
|
|
3985
4173
|
return () => controller.abort();
|
|
3986
4174
|
}, [q, sort, seedKey, isDefaultView, reloadKey]);
|
|
3987
|
-
const loadMore =
|
|
4175
|
+
const loadMore = useCallback10(() => {
|
|
3988
4176
|
const cursor = nextCursorRef.current;
|
|
3989
4177
|
if (!cursor || loadingMoreRef.current) return;
|
|
3990
4178
|
const { q: currentQ, sort: currentSort, fetchPage: currentFetch } = viewRef.current;
|
|
@@ -4012,9 +4200,9 @@ function useSessionHistory({
|
|
|
4012
4200
|
}
|
|
4013
4201
|
|
|
4014
4202
|
// src/web-react/use-session-actions.tsx
|
|
4015
|
-
import { useCallback as
|
|
4203
|
+
import { useCallback as useCallback11, useState as useState20 } from "react";
|
|
4016
4204
|
import { Input } from "@tangle-network/ui/primitives";
|
|
4017
|
-
import { Fragment as
|
|
4205
|
+
import { Fragment as Fragment5, jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4018
4206
|
var DEFAULT_LABELS = {
|
|
4019
4207
|
renameTitle: "Rename session",
|
|
4020
4208
|
renameField: "Title",
|
|
@@ -4038,21 +4226,21 @@ function useSessionActions({
|
|
|
4038
4226
|
labels
|
|
4039
4227
|
}) {
|
|
4040
4228
|
const text = { ...DEFAULT_LABELS, ...labels };
|
|
4041
|
-
const [renameTarget, setRenameTarget] =
|
|
4042
|
-
const [renameValue, setRenameValue] =
|
|
4043
|
-
const [deleteTarget, setDeleteTarget] =
|
|
4044
|
-
const [busy, setBusy] =
|
|
4045
|
-
const [error, setError] =
|
|
4046
|
-
const openRename =
|
|
4229
|
+
const [renameTarget, setRenameTarget] = useState20(null);
|
|
4230
|
+
const [renameValue, setRenameValue] = useState20("");
|
|
4231
|
+
const [deleteTarget, setDeleteTarget] = useState20(null);
|
|
4232
|
+
const [busy, setBusy] = useState20(false);
|
|
4233
|
+
const [error, setError] = useState20(null);
|
|
4234
|
+
const openRename = useCallback11((session) => {
|
|
4047
4235
|
setError(null);
|
|
4048
4236
|
setRenameTarget(session);
|
|
4049
4237
|
setRenameValue(session.title ?? "");
|
|
4050
4238
|
}, []);
|
|
4051
|
-
const openDelete =
|
|
4239
|
+
const openDelete = useCallback11((session) => {
|
|
4052
4240
|
setError(null);
|
|
4053
4241
|
setDeleteTarget(session);
|
|
4054
4242
|
}, []);
|
|
4055
|
-
const submitRename =
|
|
4243
|
+
const submitRename = useCallback11(async () => {
|
|
4056
4244
|
if (!renameTarget) return;
|
|
4057
4245
|
const title = renameValue.trim();
|
|
4058
4246
|
if (!title || title === renameTarget.title) {
|
|
@@ -4074,7 +4262,7 @@ function useSessionActions({
|
|
|
4074
4262
|
setBusy(false);
|
|
4075
4263
|
}
|
|
4076
4264
|
}, [renameTarget, renameValue, renameSession, notify, onChanged, text.renamed, text.renameFailed]);
|
|
4077
|
-
const confirmDelete =
|
|
4265
|
+
const confirmDelete = useCallback11(async () => {
|
|
4078
4266
|
if (!deleteTarget) return;
|
|
4079
4267
|
const deletingCurrent = currentSessionId != null && deleteTarget.id === currentSessionId;
|
|
4080
4268
|
setBusy(true);
|
|
@@ -4093,21 +4281,21 @@ function useSessionActions({
|
|
|
4093
4281
|
setBusy(false);
|
|
4094
4282
|
}
|
|
4095
4283
|
}, [deleteTarget, currentSessionId, deleteSession, notify, onChanged, onDeletedCurrent, text.deleted, text.deleteFailed]);
|
|
4096
|
-
const dialogs = /* @__PURE__ */
|
|
4097
|
-
renameTarget && /* @__PURE__ */
|
|
4284
|
+
const dialogs = /* @__PURE__ */ jsxs14(Fragment5, { children: [
|
|
4285
|
+
renameTarget && /* @__PURE__ */ jsxs14(
|
|
4098
4286
|
ActionDialog,
|
|
4099
4287
|
{
|
|
4100
4288
|
title: text.renameTitle,
|
|
4101
4289
|
onClose: () => setRenameTarget(null),
|
|
4102
4290
|
busy,
|
|
4103
4291
|
error,
|
|
4104
|
-
footer: /* @__PURE__ */
|
|
4105
|
-
/* @__PURE__ */
|
|
4106
|
-
/* @__PURE__ */
|
|
4292
|
+
footer: /* @__PURE__ */ jsxs14(Fragment5, { children: [
|
|
4293
|
+
/* @__PURE__ */ jsx16(ActionDialogButton, { onClick: () => setRenameTarget(null), disabled: busy, variant: "ghost", children: text.cancel }),
|
|
4294
|
+
/* @__PURE__ */ jsx16(ActionDialogButton, { onClick: () => void submitRename(), disabled: busy || !renameValue.trim(), children: text.renameSubmit })
|
|
4107
4295
|
] }),
|
|
4108
4296
|
children: [
|
|
4109
|
-
/* @__PURE__ */
|
|
4110
|
-
/* @__PURE__ */
|
|
4297
|
+
/* @__PURE__ */ jsx16("label", { htmlFor: "agent-app-rename-session", className: "text-xs text-muted-foreground", children: text.renameField }),
|
|
4298
|
+
/* @__PURE__ */ jsx16(
|
|
4111
4299
|
Input,
|
|
4112
4300
|
{
|
|
4113
4301
|
id: "agent-app-rename-session",
|
|
@@ -4126,18 +4314,18 @@ function useSessionActions({
|
|
|
4126
4314
|
]
|
|
4127
4315
|
}
|
|
4128
4316
|
),
|
|
4129
|
-
deleteTarget && /* @__PURE__ */
|
|
4317
|
+
deleteTarget && /* @__PURE__ */ jsx16(
|
|
4130
4318
|
ActionDialog,
|
|
4131
4319
|
{
|
|
4132
4320
|
title: text.deleteTitle,
|
|
4133
4321
|
onClose: () => setDeleteTarget(null),
|
|
4134
4322
|
busy,
|
|
4135
4323
|
error,
|
|
4136
|
-
footer: /* @__PURE__ */
|
|
4137
|
-
/* @__PURE__ */
|
|
4138
|
-
/* @__PURE__ */
|
|
4324
|
+
footer: /* @__PURE__ */ jsxs14(Fragment5, { children: [
|
|
4325
|
+
/* @__PURE__ */ jsx16(ActionDialogButton, { onClick: () => setDeleteTarget(null), disabled: busy, variant: "ghost", children: text.cancel }),
|
|
4326
|
+
/* @__PURE__ */ jsx16(ActionDialogButton, { onClick: () => void confirmDelete(), disabled: busy, variant: "destructive", children: text.deleteSubmit })
|
|
4139
4327
|
] }),
|
|
4140
|
-
children: /* @__PURE__ */
|
|
4328
|
+
children: /* @__PURE__ */ jsx16("p", { className: "text-sm text-muted-foreground", children: text.deleteBody(sessionLabel(deleteTarget)) })
|
|
4141
4329
|
}
|
|
4142
4330
|
)
|
|
4143
4331
|
] });
|
|
@@ -4145,12 +4333,12 @@ function useSessionActions({
|
|
|
4145
4333
|
}
|
|
4146
4334
|
|
|
4147
4335
|
// src/web-react/session-history-panel.tsx
|
|
4148
|
-
import { useCallback as
|
|
4149
|
-
import { Button as
|
|
4336
|
+
import { useCallback as useCallback12, useEffect as useEffect14, useId as useId2, useRef as useRef15, useState as useState21 } from "react";
|
|
4337
|
+
import { Button as Button4, Checkbox, Input as Input2, Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@tangle-network/ui/primitives";
|
|
4150
4338
|
import { ShellHeader } from "@tangle-network/sandbox-ui/workspace";
|
|
4151
|
-
import { Fragment as
|
|
4339
|
+
import { Fragment as Fragment6, jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4152
4340
|
function AnchorLink({ to, className, children }) {
|
|
4153
|
-
return /* @__PURE__ */
|
|
4341
|
+
return /* @__PURE__ */ jsx17("a", { href: to, className, children });
|
|
4154
4342
|
}
|
|
4155
4343
|
var MINUTE = 6e4;
|
|
4156
4344
|
var HOUR = 60 * MINUTE;
|
|
@@ -4167,17 +4355,17 @@ function formatSessionTimestamp(isoDate) {
|
|
|
4167
4355
|
return new Date(at).toLocaleDateString(void 0, { month: "short", day: "numeric" });
|
|
4168
4356
|
}
|
|
4169
4357
|
function SkeletonRows() {
|
|
4170
|
-
return /* @__PURE__ */
|
|
4171
|
-
/* @__PURE__ */
|
|
4172
|
-
/* @__PURE__ */
|
|
4173
|
-
/* @__PURE__ */
|
|
4174
|
-
/* @__PURE__ */
|
|
4175
|
-
/* @__PURE__ */
|
|
4358
|
+
return /* @__PURE__ */ jsxs15(Fragment6, { children: [
|
|
4359
|
+
/* @__PURE__ */ jsx17("span", { role: "status", "aria-live": "polite", "aria-busy": true, className: "sr-only", children: "Loading sessions\u2026" }),
|
|
4360
|
+
/* @__PURE__ */ jsx17("div", { className: "flex flex-col gap-0.5", "aria-hidden": true, children: Array.from({ length: 8 }).map((_, i) => /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-3 px-3 py-2.5", children: [
|
|
4361
|
+
/* @__PURE__ */ jsx17("div", { className: "h-4 w-4 animate-pulse rounded bg-muted" }),
|
|
4362
|
+
/* @__PURE__ */ jsx17("div", { className: "h-4 w-1/2 animate-pulse rounded bg-muted" }),
|
|
4363
|
+
/* @__PURE__ */ jsx17("div", { className: "ml-auto h-3 w-12 animate-pulse rounded bg-muted" })
|
|
4176
4364
|
] }, i)) })
|
|
4177
4365
|
] });
|
|
4178
4366
|
}
|
|
4179
4367
|
function MessageIcon({ className }) {
|
|
4180
|
-
return /* @__PURE__ */
|
|
4368
|
+
return /* @__PURE__ */ jsx17("svg", { viewBox: "0 0 24 24", className, fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx17("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }) });
|
|
4181
4369
|
}
|
|
4182
4370
|
function useSessionHistoryPanelViewState({
|
|
4183
4371
|
history,
|
|
@@ -4205,7 +4393,7 @@ function useSessionHistoryPanelViewState({
|
|
|
4205
4393
|
contentWidth = "reading",
|
|
4206
4394
|
className
|
|
4207
4395
|
}) {
|
|
4208
|
-
const scrollRef =
|
|
4396
|
+
const scrollRef = useRef15(null);
|
|
4209
4397
|
const sentinelRef = useInfiniteScroll(history.loadMore, {
|
|
4210
4398
|
enabled: history.hasMore && !history.isLoadingMore && !history.isError,
|
|
4211
4399
|
root: scrollRef,
|
|
@@ -4214,15 +4402,15 @@ function useSessionHistoryPanelViewState({
|
|
|
4214
4402
|
const searchTerm = query.trim();
|
|
4215
4403
|
const isSearching = searchTerm.length > 0;
|
|
4216
4404
|
const column = contentWidth === "full" ? "w-full" : "mx-auto w-full max-w-4xl";
|
|
4217
|
-
const [selectedIds, setSelectedIds] =
|
|
4218
|
-
const [ageDays, setAgeDays] =
|
|
4219
|
-
const [bulkTarget, setBulkTarget] =
|
|
4220
|
-
const [bulkBusy, setBulkBusy] =
|
|
4221
|
-
const [bulkError, setBulkError] =
|
|
4222
|
-
|
|
4405
|
+
const [selectedIds, setSelectedIds] = useState21(/* @__PURE__ */ new Set());
|
|
4406
|
+
const [ageDays, setAgeDays] = useState21("30");
|
|
4407
|
+
const [bulkTarget, setBulkTarget] = useState21(null);
|
|
4408
|
+
const [bulkBusy, setBulkBusy] = useState21(false);
|
|
4409
|
+
const [bulkError, setBulkError] = useState21(null);
|
|
4410
|
+
useEffect14(() => {
|
|
4223
4411
|
setSelectedIds(/* @__PURE__ */ new Set());
|
|
4224
4412
|
}, [searchTerm, sort]);
|
|
4225
|
-
|
|
4413
|
+
useEffect14(() => {
|
|
4226
4414
|
const visible = new Set(history.items.map((item) => item.id));
|
|
4227
4415
|
setSelectedIds((current) => {
|
|
4228
4416
|
const next = new Set([...current].filter((id) => visible.has(id)));
|
|
@@ -4233,7 +4421,7 @@ function useSessionHistoryPanelViewState({
|
|
|
4233
4421
|
const allVisibleSelected = history.items.length > 0 && history.items.every((item) => selectedIds.has(item.id));
|
|
4234
4422
|
const parsedAgeDays = Number(ageDays);
|
|
4235
4423
|
const validAgeDays = Number.isInteger(parsedAgeDays) && parsedAgeDays >= 1 && parsedAgeDays <= 36500;
|
|
4236
|
-
const openBulkAction =
|
|
4424
|
+
const openBulkAction = useCallback12((action) => {
|
|
4237
4425
|
const verb = deleteLabel.toLowerCase();
|
|
4238
4426
|
if (action.kind === "selected") {
|
|
4239
4427
|
setBulkTarget({
|
|
@@ -4250,7 +4438,7 @@ function useSessionHistoryPanelViewState({
|
|
|
4250
4438
|
body: "This applies to every matching session in this workspace, including sessions not currently loaded in this list."
|
|
4251
4439
|
});
|
|
4252
4440
|
}, [deleteLabel]);
|
|
4253
|
-
const confirmBulkAction =
|
|
4441
|
+
const confirmBulkAction = useCallback12(async () => {
|
|
4254
4442
|
if (!bulkTarget || !onBulkAction) return;
|
|
4255
4443
|
setBulkBusy(true);
|
|
4256
4444
|
setBulkError(null);
|
|
@@ -4313,7 +4501,7 @@ function useSessionHistoryPanelViewState({
|
|
|
4313
4501
|
}
|
|
4314
4502
|
function SessionHistoryPanel(props) {
|
|
4315
4503
|
const view = useSessionHistoryPanelViewState(props);
|
|
4316
|
-
return /* @__PURE__ */
|
|
4504
|
+
return /* @__PURE__ */ jsx17(SessionHistoryPanelView, { ...view });
|
|
4317
4505
|
}
|
|
4318
4506
|
function SessionHistoryPanelView({
|
|
4319
4507
|
className,
|
|
@@ -4360,25 +4548,25 @@ function SessionHistoryPanelView({
|
|
|
4360
4548
|
bulkError,
|
|
4361
4549
|
confirmBulkAction
|
|
4362
4550
|
}) {
|
|
4363
|
-
return /* @__PURE__ */
|
|
4364
|
-
showHeader && /* @__PURE__ */
|
|
4365
|
-
/* @__PURE__ */
|
|
4366
|
-
newSessionHref && /* @__PURE__ */
|
|
4551
|
+
return /* @__PURE__ */ jsxs15("div", { className: `flex min-h-0 min-w-0 flex-1 flex-col ${className ?? ""}`, children: [
|
|
4552
|
+
showHeader && /* @__PURE__ */ jsx17(ShellHeader, { as: "header", className: "bg-transparent px-4 sm:px-6", children: /* @__PURE__ */ jsxs15("div", { className: `flex items-center gap-3 px-3 ${column}`, children: [
|
|
4553
|
+
/* @__PURE__ */ jsx17("h1", { className: "flex-1 truncate text-sm font-semibold text-foreground", children: title }),
|
|
4554
|
+
newSessionHref && /* @__PURE__ */ jsxs15(
|
|
4367
4555
|
Link,
|
|
4368
4556
|
{
|
|
4369
4557
|
to: newSessionHref,
|
|
4370
4558
|
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",
|
|
4371
4559
|
children: [
|
|
4372
|
-
/* @__PURE__ */
|
|
4560
|
+
/* @__PURE__ */ jsx17("span", { "aria-hidden": true, className: "text-sm leading-none", children: "+" }),
|
|
4373
4561
|
"New chat"
|
|
4374
4562
|
]
|
|
4375
4563
|
}
|
|
4376
4564
|
)
|
|
4377
4565
|
] }) }),
|
|
4378
|
-
/* @__PURE__ */
|
|
4379
|
-
hasAnySessions && /* @__PURE__ */
|
|
4380
|
-
/* @__PURE__ */
|
|
4381
|
-
/* @__PURE__ */
|
|
4566
|
+
/* @__PURE__ */ jsxs15("div", { ref: scrollRef, className: "min-h-0 flex-1 overflow-y-auto", children: [
|
|
4567
|
+
hasAnySessions && /* @__PURE__ */ jsxs15("div", { className: "sticky top-0 z-10 bg-background px-4 sm:px-6", children: [
|
|
4568
|
+
/* @__PURE__ */ jsxs15("div", { className: `flex flex-col gap-2 px-3 pb-3 pt-4 sm:flex-row sm:items-center sm:gap-3 ${column}`, children: [
|
|
4569
|
+
/* @__PURE__ */ jsx17(
|
|
4382
4570
|
Input2,
|
|
4383
4571
|
{
|
|
4384
4572
|
type: "search",
|
|
@@ -4389,18 +4577,18 @@ function SessionHistoryPanelView({
|
|
|
4389
4577
|
className: "sm:flex-1 [&::-webkit-search-cancel-button]:appearance-none"
|
|
4390
4578
|
}
|
|
4391
4579
|
),
|
|
4392
|
-
/* @__PURE__ */
|
|
4393
|
-
/* @__PURE__ */
|
|
4394
|
-
/* @__PURE__ */
|
|
4395
|
-
/* @__PURE__ */
|
|
4396
|
-
/* @__PURE__ */
|
|
4580
|
+
/* @__PURE__ */ jsxs15(Select, { value: sort, onValueChange: (value) => onSortChange(value), children: [
|
|
4581
|
+
/* @__PURE__ */ jsx17(SelectTrigger, { "aria-label": "Sort sessions", className: "shrink-0 sm:w-[132px]", children: /* @__PURE__ */ jsx17(SelectValue, {}) }),
|
|
4582
|
+
/* @__PURE__ */ jsxs15(SelectContent, { children: [
|
|
4583
|
+
/* @__PURE__ */ jsx17(SelectItem, { value: "newest", children: "Newest" }),
|
|
4584
|
+
/* @__PURE__ */ jsx17(SelectItem, { value: "oldest", children: "Oldest" })
|
|
4397
4585
|
] })
|
|
4398
4586
|
] })
|
|
4399
4587
|
] }),
|
|
4400
|
-
onBulkAction && /* @__PURE__ */
|
|
4401
|
-
/* @__PURE__ */
|
|
4402
|
-
/* @__PURE__ */
|
|
4403
|
-
|
|
4588
|
+
onBulkAction && /* @__PURE__ */ jsxs15("div", { className: `flex flex-col gap-2 border-t border-border px-3 py-3 ${column}`, children: [
|
|
4589
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
4590
|
+
/* @__PURE__ */ jsx17(
|
|
4591
|
+
Button4,
|
|
4404
4592
|
{
|
|
4405
4593
|
type: "button",
|
|
4406
4594
|
variant: "outline",
|
|
@@ -4410,8 +4598,8 @@ function SessionHistoryPanelView({
|
|
|
4410
4598
|
children: "Select all"
|
|
4411
4599
|
}
|
|
4412
4600
|
),
|
|
4413
|
-
/* @__PURE__ */
|
|
4414
|
-
|
|
4601
|
+
/* @__PURE__ */ jsx17(
|
|
4602
|
+
Button4,
|
|
4415
4603
|
{
|
|
4416
4604
|
type: "button",
|
|
4417
4605
|
variant: "outline",
|
|
@@ -4421,8 +4609,8 @@ function SessionHistoryPanelView({
|
|
|
4421
4609
|
children: "Deselect all"
|
|
4422
4610
|
}
|
|
4423
4611
|
),
|
|
4424
|
-
selectedCount > 0 && /* @__PURE__ */
|
|
4425
|
-
|
|
4612
|
+
selectedCount > 0 && /* @__PURE__ */ jsxs15(
|
|
4613
|
+
Button4,
|
|
4426
4614
|
{
|
|
4427
4615
|
type: "button",
|
|
4428
4616
|
variant: "destructive",
|
|
@@ -4435,9 +4623,9 @@ function SessionHistoryPanelView({
|
|
|
4435
4623
|
}
|
|
4436
4624
|
)
|
|
4437
4625
|
] }),
|
|
4438
|
-
/* @__PURE__ */
|
|
4439
|
-
/* @__PURE__ */
|
|
4440
|
-
/* @__PURE__ */
|
|
4626
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
4627
|
+
/* @__PURE__ */ jsx17("label", { htmlFor: "agent-app-session-age", className: "text-xs text-muted-foreground", children: "Session age" }),
|
|
4628
|
+
/* @__PURE__ */ jsx17(
|
|
4441
4629
|
Input2,
|
|
4442
4630
|
{
|
|
4443
4631
|
id: "agent-app-session-age",
|
|
@@ -4451,9 +4639,9 @@ function SessionHistoryPanelView({
|
|
|
4451
4639
|
className: "w-20 tabular-nums"
|
|
4452
4640
|
}
|
|
4453
4641
|
),
|
|
4454
|
-
/* @__PURE__ */
|
|
4455
|
-
/* @__PURE__ */
|
|
4456
|
-
|
|
4642
|
+
/* @__PURE__ */ jsx17("span", { className: "text-xs text-muted-foreground", children: "days" }),
|
|
4643
|
+
/* @__PURE__ */ jsxs15(
|
|
4644
|
+
Button4,
|
|
4457
4645
|
{
|
|
4458
4646
|
type: "button",
|
|
4459
4647
|
variant: "outline",
|
|
@@ -4466,8 +4654,8 @@ function SessionHistoryPanelView({
|
|
|
4466
4654
|
]
|
|
4467
4655
|
}
|
|
4468
4656
|
),
|
|
4469
|
-
/* @__PURE__ */
|
|
4470
|
-
|
|
4657
|
+
/* @__PURE__ */ jsxs15(
|
|
4658
|
+
Button4,
|
|
4471
4659
|
{
|
|
4472
4660
|
type: "button",
|
|
4473
4661
|
variant: "outline",
|
|
@@ -4483,15 +4671,15 @@ function SessionHistoryPanelView({
|
|
|
4483
4671
|
] })
|
|
4484
4672
|
] })
|
|
4485
4673
|
] }),
|
|
4486
|
-
/* @__PURE__ */
|
|
4487
|
-
/* @__PURE__ */
|
|
4488
|
-
/* @__PURE__ */
|
|
4489
|
-
] }) : history.isLoadingFirst ? /* @__PURE__ */
|
|
4674
|
+
/* @__PURE__ */ jsx17("div", { className: `px-4 pb-8 pt-1 sm:px-6 ${column}`, children: !hasAnySessions ? /* @__PURE__ */ jsxs15("div", { className: "flex min-h-[50vh] flex-col items-center justify-center gap-2 text-center", children: [
|
|
4675
|
+
/* @__PURE__ */ jsx17("p", { className: "text-sm font-medium text-foreground", children: emptyTitle }),
|
|
4676
|
+
/* @__PURE__ */ jsx17("p", { className: "max-w-xs text-xs text-muted-foreground", children: emptyDescription })
|
|
4677
|
+
] }) : history.isLoadingFirst ? /* @__PURE__ */ jsx17(SkeletonRows, {}) : history.items.length === 0 ? history.isError ? /* @__PURE__ */ jsx17(ErrorBlock, { onRetry: history.retry, message: "Couldn\u2019t load your sessions." }) : isSearching ? /* @__PURE__ */ jsxs15("p", { className: "py-16 text-center text-sm text-muted-foreground", children: [
|
|
4490
4678
|
"No sessions match \u201C",
|
|
4491
4679
|
searchTerm,
|
|
4492
4680
|
"\u201D."
|
|
4493
|
-
] }) : /* @__PURE__ */
|
|
4494
|
-
history.items.map((session) => /* @__PURE__ */
|
|
4681
|
+
] }) : /* @__PURE__ */ jsx17("p", { className: "py-16 text-center text-sm text-muted-foreground", children: "No sessions remain." }) : /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-0.5", children: [
|
|
4682
|
+
history.items.map((session) => /* @__PURE__ */ jsx17(
|
|
4495
4683
|
SessionRow,
|
|
4496
4684
|
{
|
|
4497
4685
|
session,
|
|
@@ -4518,10 +4706,10 @@ function SessionHistoryPanelView({
|
|
|
4518
4706
|
},
|
|
4519
4707
|
session.id
|
|
4520
4708
|
)),
|
|
4521
|
-
history.isError ? /* @__PURE__ */
|
|
4709
|
+
history.isError ? /* @__PURE__ */ jsx17(ErrorBlock, { onRetry: history.retry, message: "Couldn\u2019t load more sessions.", inline: true }) : history.hasMore ? /* @__PURE__ */ jsx17("div", { ref: sentinelRef, className: "flex items-center justify-center py-6", children: history.isLoadingMore && /* @__PURE__ */ jsx17("span", { role: "status", "aria-live": "polite", "aria-busy": true, className: "text-xs text-muted-foreground", children: "Loading\u2026" }) }) : null
|
|
4522
4710
|
] }) })
|
|
4523
4711
|
] }),
|
|
4524
|
-
bulkTarget && /* @__PURE__ */
|
|
4712
|
+
bulkTarget && /* @__PURE__ */ jsx17(
|
|
4525
4713
|
ActionDialog,
|
|
4526
4714
|
{
|
|
4527
4715
|
title: bulkTarget.title,
|
|
@@ -4533,8 +4721,8 @@ function SessionHistoryPanelView({
|
|
|
4533
4721
|
},
|
|
4534
4722
|
busy: bulkBusy,
|
|
4535
4723
|
error: bulkError,
|
|
4536
|
-
footer: /* @__PURE__ */
|
|
4537
|
-
/* @__PURE__ */
|
|
4724
|
+
footer: /* @__PURE__ */ jsxs15(Fragment6, { children: [
|
|
4725
|
+
/* @__PURE__ */ jsx17(
|
|
4538
4726
|
ActionDialogButton,
|
|
4539
4727
|
{
|
|
4540
4728
|
onClick: () => {
|
|
@@ -4546,21 +4734,21 @@ function SessionHistoryPanelView({
|
|
|
4546
4734
|
children: "Cancel"
|
|
4547
4735
|
}
|
|
4548
4736
|
),
|
|
4549
|
-
/* @__PURE__ */
|
|
4737
|
+
/* @__PURE__ */ jsx17(ActionDialogButton, { onClick: () => void confirmBulkAction(), disabled: bulkBusy, variant: "destructive", children: bulkBusy ? "Working\u2026" : deleteLabel })
|
|
4550
4738
|
] }),
|
|
4551
|
-
children: /* @__PURE__ */
|
|
4739
|
+
children: /* @__PURE__ */ jsx17("p", { className: "text-sm text-muted-foreground", children: bulkTarget.body })
|
|
4552
4740
|
}
|
|
4553
4741
|
)
|
|
4554
4742
|
] });
|
|
4555
4743
|
}
|
|
4556
4744
|
function ErrorBlock({ message, onRetry, inline }) {
|
|
4557
|
-
return /* @__PURE__ */
|
|
4745
|
+
return /* @__PURE__ */ jsxs15(
|
|
4558
4746
|
"div",
|
|
4559
4747
|
{
|
|
4560
4748
|
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",
|
|
4561
4749
|
children: [
|
|
4562
|
-
/* @__PURE__ */
|
|
4563
|
-
/* @__PURE__ */
|
|
4750
|
+
/* @__PURE__ */ jsx17("span", { className: "text-sm text-muted-foreground", children: message }),
|
|
4751
|
+
/* @__PURE__ */ jsx17(Button4, { type: "button", variant: "outline", size: "sm", onClick: onRetry, children: "Retry" })
|
|
4564
4752
|
]
|
|
4565
4753
|
}
|
|
4566
4754
|
);
|
|
@@ -4581,14 +4769,14 @@ function SessionRow({
|
|
|
4581
4769
|
selected,
|
|
4582
4770
|
onSelectedChange
|
|
4583
4771
|
}) {
|
|
4584
|
-
const [menuOpen, setMenuOpen] =
|
|
4772
|
+
const [menuOpen, setMenuOpen] = useState21(false);
|
|
4585
4773
|
const panelId = useId2();
|
|
4586
4774
|
const { containerRef, triggerRef, panelRef, triggerProps } = usePopover(menuOpen, setMenuOpen);
|
|
4587
4775
|
const extras = extraActions?.(session) ?? [];
|
|
4588
4776
|
const hasMenu = Boolean(onRename) || Boolean(onDelete) || extras.length > 0;
|
|
4589
4777
|
const showUnread = Boolean(session.unread) && !responding;
|
|
4590
|
-
return /* @__PURE__ */
|
|
4591
|
-
selectable && /* @__PURE__ */
|
|
4778
|
+
return /* @__PURE__ */ jsxs15("div", { className: `group relative flex items-center gap-2 rounded-lg px-3 py-2.5 transition-colors hover:bg-accent ${selected ? "bg-primary/10" : ""}`, children: [
|
|
4779
|
+
selectable && /* @__PURE__ */ jsx17(
|
|
4592
4780
|
Checkbox,
|
|
4593
4781
|
{
|
|
4594
4782
|
checked: selected,
|
|
@@ -4596,10 +4784,10 @@ function SessionRow({
|
|
|
4596
4784
|
"aria-label": `Select ${sessionLabel(session, untitledLabel)}`
|
|
4597
4785
|
}
|
|
4598
4786
|
),
|
|
4599
|
-
/* @__PURE__ */
|
|
4600
|
-
showUnread && /* @__PURE__ */
|
|
4601
|
-
/* @__PURE__ */
|
|
4602
|
-
/* @__PURE__ */
|
|
4787
|
+
/* @__PURE__ */ jsxs15(Link, { to: href, className: "flex min-w-0 flex-1 items-center gap-3", children: [
|
|
4788
|
+
showUnread && /* @__PURE__ */ jsx17("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-primary", "aria-hidden": true }),
|
|
4789
|
+
/* @__PURE__ */ jsx17(MessageIcon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
4790
|
+
/* @__PURE__ */ jsx17(
|
|
4603
4791
|
"span",
|
|
4604
4792
|
{
|
|
4605
4793
|
className: `truncate text-sm ${responding ? "text-muted-foreground" : "text-foreground"} ${showUnread ? "font-semibold" : ""}`,
|
|
@@ -4608,10 +4796,10 @@ function SessionRow({
|
|
|
4608
4796
|
}
|
|
4609
4797
|
)
|
|
4610
4798
|
] }),
|
|
4611
|
-
/* @__PURE__ */
|
|
4612
|
-
hasMenu && /* @__PURE__ */
|
|
4613
|
-
/* @__PURE__ */
|
|
4614
|
-
|
|
4799
|
+
/* @__PURE__ */ jsx17("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: timestamp }),
|
|
4800
|
+
hasMenu && /* @__PURE__ */ jsxs15("div", { ref: containerRef, className: "relative shrink-0", children: [
|
|
4801
|
+
/* @__PURE__ */ jsx17(
|
|
4802
|
+
Button4,
|
|
4615
4803
|
{
|
|
4616
4804
|
type: "button",
|
|
4617
4805
|
variant: "ghost",
|
|
@@ -4621,10 +4809,10 @@ function SessionRow({
|
|
|
4621
4809
|
"aria-controls": menuOpen ? panelId : void 0,
|
|
4622
4810
|
onClick: () => setMenuOpen((open) => !open),
|
|
4623
4811
|
className: "text-muted-foreground focus-visible:opacity-100 sm:opacity-0 sm:group-hover:opacity-100 aria-expanded:opacity-100",
|
|
4624
|
-
children: /* @__PURE__ */
|
|
4812
|
+
children: /* @__PURE__ */ jsx17("span", { "aria-hidden": true, className: "text-base leading-none", children: "\u22EF" })
|
|
4625
4813
|
}
|
|
4626
4814
|
),
|
|
4627
|
-
/* @__PURE__ */
|
|
4815
|
+
/* @__PURE__ */ jsxs15(
|
|
4628
4816
|
PopoverSurface,
|
|
4629
4817
|
{
|
|
4630
4818
|
open: menuOpen,
|
|
@@ -4634,7 +4822,7 @@ function SessionRow({
|
|
|
4634
4822
|
panelRef,
|
|
4635
4823
|
className: `w-36 overflow-hidden rounded-md border border-card-edge bg-popover py-1 ${OVERLAY_SHADOW}`,
|
|
4636
4824
|
children: [
|
|
4637
|
-
onRename && /* @__PURE__ */
|
|
4825
|
+
onRename && /* @__PURE__ */ jsx17(
|
|
4638
4826
|
"button",
|
|
4639
4827
|
{
|
|
4640
4828
|
type: "button",
|
|
@@ -4647,7 +4835,7 @@ function SessionRow({
|
|
|
4647
4835
|
children: renameLabel
|
|
4648
4836
|
}
|
|
4649
4837
|
),
|
|
4650
|
-
extras.map((action) => /* @__PURE__ */
|
|
4838
|
+
extras.map((action) => /* @__PURE__ */ jsx17(
|
|
4651
4839
|
"button",
|
|
4652
4840
|
{
|
|
4653
4841
|
type: "button",
|
|
@@ -4661,7 +4849,7 @@ function SessionRow({
|
|
|
4661
4849
|
},
|
|
4662
4850
|
action.id
|
|
4663
4851
|
)),
|
|
4664
|
-
onDelete && /* @__PURE__ */
|
|
4852
|
+
onDelete && /* @__PURE__ */ jsx17(
|
|
4665
4853
|
"button",
|
|
4666
4854
|
{
|
|
4667
4855
|
type: "button",
|
|
@@ -5131,23 +5319,23 @@ async function createRecordGridRow({
|
|
|
5131
5319
|
|
|
5132
5320
|
// src/web-react/record-grid.tsx
|
|
5133
5321
|
import {
|
|
5134
|
-
Fragment as
|
|
5322
|
+
Fragment as Fragment7,
|
|
5135
5323
|
isValidElement,
|
|
5136
|
-
useCallback as
|
|
5137
|
-
useEffect as
|
|
5324
|
+
useCallback as useCallback14,
|
|
5325
|
+
useEffect as useEffect15,
|
|
5138
5326
|
useId as useId3,
|
|
5139
5327
|
useMemo as useMemo8,
|
|
5140
|
-
useRef as
|
|
5141
|
-
useState as
|
|
5328
|
+
useRef as useRef16,
|
|
5329
|
+
useState as useState22
|
|
5142
5330
|
} from "react";
|
|
5143
|
-
import { Button as
|
|
5331
|
+
import { Button as Button5, EmptyState, Skeleton, Table, TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell } from "@tangle-network/ui/primitives";
|
|
5144
5332
|
|
|
5145
5333
|
// src/web-react/record-grid-review-actions.tsx
|
|
5146
|
-
import { jsx as
|
|
5334
|
+
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5147
5335
|
function ReviewActions({ rowId, kind, rowLabel, onAccept, onReject }) {
|
|
5148
5336
|
const noun = kind === "changed" ? `proposed change to ${rowLabel}` : kind === "added" ? `new row ${rowLabel}` : `removal of ${rowLabel}`;
|
|
5149
|
-
return /* @__PURE__ */
|
|
5150
|
-
onReject && /* @__PURE__ */
|
|
5337
|
+
return /* @__PURE__ */ jsxs16("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
5338
|
+
onReject && /* @__PURE__ */ jsx18(
|
|
5151
5339
|
"button",
|
|
5152
5340
|
{
|
|
5153
5341
|
type: "button",
|
|
@@ -5157,7 +5345,7 @@ function ReviewActions({ rowId, kind, rowLabel, onAccept, onReject }) {
|
|
|
5157
5345
|
children: "Reject"
|
|
5158
5346
|
}
|
|
5159
5347
|
),
|
|
5160
|
-
onAccept && /* @__PURE__ */
|
|
5348
|
+
onAccept && /* @__PURE__ */ jsx18(
|
|
5161
5349
|
"button",
|
|
5162
5350
|
{
|
|
5163
5351
|
type: "button",
|
|
@@ -5172,7 +5360,7 @@ function ReviewActions({ rowId, kind, rowLabel, onAccept, onReject }) {
|
|
|
5172
5360
|
|
|
5173
5361
|
// src/web-react/record-grid-editors.tsx
|
|
5174
5362
|
import { useMemo as useMemo7 } from "react";
|
|
5175
|
-
import { jsx as
|
|
5363
|
+
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5176
5364
|
var INPUT_CLASS = "w-full rounded-md border border-strong bg-background px-2 py-1 text-sm text-foreground outline-none focus:border-primary/60 focus:ring-1 focus:ring-primary/40";
|
|
5177
5365
|
function groupColumns(columns) {
|
|
5178
5366
|
const groups = [];
|
|
@@ -5193,7 +5381,7 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
5193
5381
|
className: INPUT_CLASS
|
|
5194
5382
|
};
|
|
5195
5383
|
if (column.kind === "select") {
|
|
5196
|
-
return /* @__PURE__ */
|
|
5384
|
+
return /* @__PURE__ */ jsxs17(
|
|
5197
5385
|
"select",
|
|
5198
5386
|
{
|
|
5199
5387
|
...shared,
|
|
@@ -5210,8 +5398,8 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
5210
5398
|
},
|
|
5211
5399
|
onBlur: () => onCommit(text),
|
|
5212
5400
|
children: [
|
|
5213
|
-
/* @__PURE__ */
|
|
5214
|
-
column.options.map((option) => /* @__PURE__ */
|
|
5401
|
+
/* @__PURE__ */ jsx19("option", { value: "", children: "\u2014" }),
|
|
5402
|
+
column.options.map((option) => /* @__PURE__ */ jsx19("option", { value: option.value, children: option.label }, option.value))
|
|
5215
5403
|
]
|
|
5216
5404
|
}
|
|
5217
5405
|
);
|
|
@@ -5229,7 +5417,7 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
5229
5417
|
}
|
|
5230
5418
|
};
|
|
5231
5419
|
if (column.kind === "text" && column.multiline === true) {
|
|
5232
|
-
return /* @__PURE__ */
|
|
5420
|
+
return /* @__PURE__ */ jsx19(
|
|
5233
5421
|
"textarea",
|
|
5234
5422
|
{
|
|
5235
5423
|
...shared,
|
|
@@ -5241,7 +5429,7 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
5241
5429
|
}
|
|
5242
5430
|
);
|
|
5243
5431
|
}
|
|
5244
|
-
return /* @__PURE__ */
|
|
5432
|
+
return /* @__PURE__ */ jsx19(
|
|
5245
5433
|
"input",
|
|
5246
5434
|
{
|
|
5247
5435
|
...shared,
|
|
@@ -5267,7 +5455,7 @@ function AddRecordForm({
|
|
|
5267
5455
|
onCancel
|
|
5268
5456
|
}) {
|
|
5269
5457
|
const groups = useMemo7(() => groupColumns(columns), [columns]);
|
|
5270
|
-
return /* @__PURE__ */
|
|
5458
|
+
return /* @__PURE__ */ jsxs17(
|
|
5271
5459
|
"form",
|
|
5272
5460
|
{
|
|
5273
5461
|
noValidate: true,
|
|
@@ -5278,31 +5466,31 @@ function AddRecordForm({
|
|
|
5278
5466
|
},
|
|
5279
5467
|
className: "space-y-4 rounded-xl border border-card-edge bg-card p-4",
|
|
5280
5468
|
children: [
|
|
5281
|
-
/* @__PURE__ */
|
|
5282
|
-
formError !== null && /* @__PURE__ */
|
|
5469
|
+
/* @__PURE__ */ jsx19("h3", { className: "text-sm font-semibold text-foreground", children: label }),
|
|
5470
|
+
formError !== null && /* @__PURE__ */ jsx19("p", { role: "alert", className: "rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive", children: formError }),
|
|
5283
5471
|
groups.map((group) => {
|
|
5284
5472
|
const fields = group.columns.filter((column) => isRecordGridCellApplicable(column, draft));
|
|
5285
5473
|
if (fields.length === 0) return null;
|
|
5286
|
-
return /* @__PURE__ */
|
|
5474
|
+
return /* @__PURE__ */ jsxs17(
|
|
5287
5475
|
"fieldset",
|
|
5288
5476
|
{
|
|
5289
5477
|
className: group.label === null ? "min-w-0" : "min-w-0 rounded-lg border border-card-edge p-3",
|
|
5290
5478
|
children: [
|
|
5291
|
-
group.label !== null && /* @__PURE__ */
|
|
5292
|
-
/* @__PURE__ */
|
|
5479
|
+
group.label !== null && /* @__PURE__ */ jsx19("legend", { className: "px-1 text-xs font-medium text-muted-foreground", children: group.label }),
|
|
5480
|
+
/* @__PURE__ */ jsx19("div", { className: "grid gap-3 sm:grid-cols-2", children: fields.map((column) => {
|
|
5293
5481
|
const fieldId = `${fieldPrefix}-${column.id}`;
|
|
5294
5482
|
const errorId = `${fieldId}-error`;
|
|
5295
5483
|
const message = errors[column.id];
|
|
5296
|
-
return /* @__PURE__ */
|
|
5484
|
+
return /* @__PURE__ */ jsxs17(
|
|
5297
5485
|
"div",
|
|
5298
5486
|
{
|
|
5299
5487
|
className: column.kind === "text" && column.multiline === true ? "sm:col-span-2" : "",
|
|
5300
5488
|
children: [
|
|
5301
|
-
/* @__PURE__ */
|
|
5489
|
+
/* @__PURE__ */ jsxs17("label", { htmlFor: fieldId, className: "mb-1 block text-xs font-medium text-muted-foreground", children: [
|
|
5302
5490
|
column.header,
|
|
5303
|
-
column.required === true && /* @__PURE__ */
|
|
5491
|
+
column.required === true && /* @__PURE__ */ jsx19("span", { className: "ml-0.5 text-destructive", children: "*" })
|
|
5304
5492
|
] }),
|
|
5305
|
-
/* @__PURE__ */
|
|
5493
|
+
/* @__PURE__ */ jsx19(
|
|
5306
5494
|
DraftField,
|
|
5307
5495
|
{
|
|
5308
5496
|
column,
|
|
@@ -5313,8 +5501,8 @@ function AddRecordForm({
|
|
|
5313
5501
|
onValue: (next) => setDraft({ ...draft, [column.id]: next })
|
|
5314
5502
|
}
|
|
5315
5503
|
),
|
|
5316
|
-
column.hint && /* @__PURE__ */
|
|
5317
|
-
message !== void 0 && /* @__PURE__ */
|
|
5504
|
+
column.hint && /* @__PURE__ */ jsx19("p", { className: "mt-1 text-xs text-muted-foreground", children: column.hint }),
|
|
5505
|
+
message !== void 0 && /* @__PURE__ */ jsx19("p", { id: errorId, role: "alert", className: "mt-1 text-xs text-destructive", children: message })
|
|
5318
5506
|
]
|
|
5319
5507
|
},
|
|
5320
5508
|
column.id
|
|
@@ -5325,8 +5513,8 @@ function AddRecordForm({
|
|
|
5325
5513
|
group.label ?? "_"
|
|
5326
5514
|
);
|
|
5327
5515
|
}),
|
|
5328
|
-
/* @__PURE__ */
|
|
5329
|
-
/* @__PURE__ */
|
|
5516
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2", children: [
|
|
5517
|
+
/* @__PURE__ */ jsx19(
|
|
5330
5518
|
"button",
|
|
5331
5519
|
{
|
|
5332
5520
|
type: "submit",
|
|
@@ -5335,7 +5523,7 @@ function AddRecordForm({
|
|
|
5335
5523
|
children: busy ? "Saving\u2026" : "Save"
|
|
5336
5524
|
}
|
|
5337
5525
|
),
|
|
5338
|
-
/* @__PURE__ */
|
|
5526
|
+
/* @__PURE__ */ jsx19(
|
|
5339
5527
|
"button",
|
|
5340
5528
|
{
|
|
5341
5529
|
type: "button",
|
|
@@ -5356,7 +5544,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
5356
5544
|
"aria-describedby": describedBy
|
|
5357
5545
|
};
|
|
5358
5546
|
if (column.kind === "boolean") {
|
|
5359
|
-
return /* @__PURE__ */
|
|
5547
|
+
return /* @__PURE__ */ jsx19(
|
|
5360
5548
|
"input",
|
|
5361
5549
|
{
|
|
5362
5550
|
...shared,
|
|
@@ -5368,7 +5556,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
5368
5556
|
);
|
|
5369
5557
|
}
|
|
5370
5558
|
if (column.kind === "select") {
|
|
5371
|
-
return /* @__PURE__ */
|
|
5559
|
+
return /* @__PURE__ */ jsxs17(
|
|
5372
5560
|
"select",
|
|
5373
5561
|
{
|
|
5374
5562
|
...shared,
|
|
@@ -5376,14 +5564,14 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
5376
5564
|
value: typeof value === "string" ? value : "",
|
|
5377
5565
|
onChange: (event) => onValue(event.target.value === "" ? null : event.target.value),
|
|
5378
5566
|
children: [
|
|
5379
|
-
/* @__PURE__ */
|
|
5380
|
-
column.options.map((option) => /* @__PURE__ */
|
|
5567
|
+
/* @__PURE__ */ jsx19("option", { value: "", children: "\u2014" }),
|
|
5568
|
+
column.options.map((option) => /* @__PURE__ */ jsx19("option", { value: option.value, children: option.label }, option.value))
|
|
5381
5569
|
]
|
|
5382
5570
|
}
|
|
5383
5571
|
);
|
|
5384
5572
|
}
|
|
5385
5573
|
if (column.kind === "text" && column.multiline === true) {
|
|
5386
|
-
return /* @__PURE__ */
|
|
5574
|
+
return /* @__PURE__ */ jsx19(
|
|
5387
5575
|
"textarea",
|
|
5388
5576
|
{
|
|
5389
5577
|
...shared,
|
|
@@ -5395,7 +5583,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
5395
5583
|
);
|
|
5396
5584
|
}
|
|
5397
5585
|
if (column.kind === "number" || column.kind === "currency") {
|
|
5398
|
-
return /* @__PURE__ */
|
|
5586
|
+
return /* @__PURE__ */ jsx19(
|
|
5399
5587
|
"input",
|
|
5400
5588
|
{
|
|
5401
5589
|
...shared,
|
|
@@ -5415,7 +5603,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
5415
5603
|
}
|
|
5416
5604
|
);
|
|
5417
5605
|
}
|
|
5418
|
-
return /* @__PURE__ */
|
|
5606
|
+
return /* @__PURE__ */ jsx19(
|
|
5419
5607
|
"input",
|
|
5420
5608
|
{
|
|
5421
5609
|
...shared,
|
|
@@ -5428,8 +5616,8 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
5428
5616
|
}
|
|
5429
5617
|
|
|
5430
5618
|
// src/web-react/record-grid-source-marker.tsx
|
|
5431
|
-
import { useCallback as
|
|
5432
|
-
import { jsx as
|
|
5619
|
+
import { useCallback as useCallback13 } from "react";
|
|
5620
|
+
import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
5433
5621
|
var BASIS_TONES2 = {
|
|
5434
5622
|
extracted: "border-primary/60 text-primary",
|
|
5435
5623
|
entered: "border-success/60 text-success",
|
|
@@ -5444,15 +5632,15 @@ var BASIS_TITLES = {
|
|
|
5444
5632
|
};
|
|
5445
5633
|
function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle }) {
|
|
5446
5634
|
const basis = source.basis ?? "asserted";
|
|
5447
|
-
const setOpen =
|
|
5635
|
+
const setOpen = useCallback13(
|
|
5448
5636
|
(next) => {
|
|
5449
5637
|
if (!next) onToggle();
|
|
5450
5638
|
},
|
|
5451
5639
|
[onToggle]
|
|
5452
5640
|
);
|
|
5453
5641
|
const { containerRef, triggerRef, panelRef, triggerProps } = usePopover(open, setOpen);
|
|
5454
|
-
return /* @__PURE__ */
|
|
5455
|
-
/* @__PURE__ */
|
|
5642
|
+
return /* @__PURE__ */ jsxs18("span", { ref: containerRef, className: "relative inline-flex", children: [
|
|
5643
|
+
/* @__PURE__ */ jsx20(
|
|
5456
5644
|
"button",
|
|
5457
5645
|
{
|
|
5458
5646
|
type: "button",
|
|
@@ -5465,7 +5653,7 @@ function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle
|
|
|
5465
5653
|
onToggle();
|
|
5466
5654
|
},
|
|
5467
5655
|
className: `inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full border ${BASIS_TONES2[basis]}`,
|
|
5468
|
-
children: /* @__PURE__ */
|
|
5656
|
+
children: /* @__PURE__ */ jsx20(
|
|
5469
5657
|
"svg",
|
|
5470
5658
|
{
|
|
5471
5659
|
viewBox: "0 0 24 24",
|
|
@@ -5475,12 +5663,12 @@ function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle
|
|
|
5475
5663
|
strokeWidth: "2.5",
|
|
5476
5664
|
strokeLinecap: "round",
|
|
5477
5665
|
"aria-hidden": true,
|
|
5478
|
-
children: /* @__PURE__ */
|
|
5666
|
+
children: /* @__PURE__ */ jsx20("path", { d: "M9 8h6M9 12h6M9 16h3" })
|
|
5479
5667
|
}
|
|
5480
5668
|
)
|
|
5481
5669
|
}
|
|
5482
5670
|
),
|
|
5483
|
-
/* @__PURE__ */
|
|
5671
|
+
/* @__PURE__ */ jsxs18(
|
|
5484
5672
|
PopoverSurface,
|
|
5485
5673
|
{
|
|
5486
5674
|
open,
|
|
@@ -5490,17 +5678,17 @@ function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle
|
|
|
5490
5678
|
panelRef,
|
|
5491
5679
|
className: `w-64 rounded-lg border border-card-edge bg-popover p-3 text-left ${OVERLAY_SHADOW}`,
|
|
5492
5680
|
children: [
|
|
5493
|
-
source.quote && /* @__PURE__ */
|
|
5681
|
+
source.quote && /* @__PURE__ */ jsxs18("span", { className: "block border-l-2 border-primary/50 pl-2 text-xs italic leading-snug text-foreground", children: [
|
|
5494
5682
|
"\u201C",
|
|
5495
5683
|
source.quote,
|
|
5496
5684
|
"\u201D"
|
|
5497
5685
|
] }),
|
|
5498
|
-
/* @__PURE__ */
|
|
5686
|
+
/* @__PURE__ */ jsxs18("span", { className: "mt-2 block text-xs text-muted-foreground", children: [
|
|
5499
5687
|
source.label ?? "Source",
|
|
5500
5688
|
source.locator ? ` \xB7 ${source.locator}` : "",
|
|
5501
5689
|
` \xB7 ${BASIS_TITLES[basis]}`
|
|
5502
5690
|
] }),
|
|
5503
|
-
source.href && /* @__PURE__ */
|
|
5691
|
+
source.href && /* @__PURE__ */ jsx20(
|
|
5504
5692
|
"a",
|
|
5505
5693
|
{
|
|
5506
5694
|
href: source.href,
|
|
@@ -5518,7 +5706,7 @@ function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle
|
|
|
5518
5706
|
}
|
|
5519
5707
|
|
|
5520
5708
|
// src/web-react/record-grid.tsx
|
|
5521
|
-
import { jsx as
|
|
5709
|
+
import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
5522
5710
|
var EMPTY_RECORD_GRID_ROWS = [];
|
|
5523
5711
|
var CELL_KEY_SEPARATOR = "\0";
|
|
5524
5712
|
function cellKey(rowId, columnId) {
|
|
@@ -5555,29 +5743,29 @@ function useRecordGridViewState({
|
|
|
5555
5743
|
className
|
|
5556
5744
|
}) {
|
|
5557
5745
|
const fieldPrefix = useId3();
|
|
5558
|
-
const [overlay, setOverlay] =
|
|
5559
|
-
const [editing, setEditingState] =
|
|
5560
|
-
const [cellErrors, setCellErrors] =
|
|
5561
|
-
const [rowErrors, setRowErrors] =
|
|
5562
|
-
const [pendingRows, setPendingRows] =
|
|
5563
|
-
const [focus, setFocus] =
|
|
5564
|
-
const [openSource, setOpenSource] =
|
|
5565
|
-
const [confirmDelete, setConfirmDelete] =
|
|
5566
|
-
const [adding, setAdding] =
|
|
5567
|
-
const [draft, setDraft] =
|
|
5568
|
-
const [draftErrors, setDraftErrors] =
|
|
5569
|
-
const [draftError, setDraftError] =
|
|
5570
|
-
const [creating, setCreating] =
|
|
5571
|
-
const cellRefs =
|
|
5572
|
-
const settling =
|
|
5573
|
-
const draftCounter =
|
|
5574
|
-
const editingRef =
|
|
5575
|
-
const setEditing =
|
|
5746
|
+
const [overlay, setOverlay] = useState22(EMPTY_RECORD_GRID_OVERLAY);
|
|
5747
|
+
const [editing, setEditingState] = useState22(null);
|
|
5748
|
+
const [cellErrors, setCellErrors] = useState22({});
|
|
5749
|
+
const [rowErrors, setRowErrors] = useState22({});
|
|
5750
|
+
const [pendingRows, setPendingRows] = useState22({});
|
|
5751
|
+
const [focus, setFocus] = useState22(null);
|
|
5752
|
+
const [openSource, setOpenSource] = useState22(null);
|
|
5753
|
+
const [confirmDelete, setConfirmDelete] = useState22(null);
|
|
5754
|
+
const [adding, setAdding] = useState22(false);
|
|
5755
|
+
const [draft, setDraft] = useState22({ ...newRowDefaults ?? {} });
|
|
5756
|
+
const [draftErrors, setDraftErrors] = useState22({});
|
|
5757
|
+
const [draftError, setDraftError] = useState22(null);
|
|
5758
|
+
const [creating, setCreating] = useState22(false);
|
|
5759
|
+
const cellRefs = useRef16(/* @__PURE__ */ new Map());
|
|
5760
|
+
const settling = useRef16(false);
|
|
5761
|
+
const draftCounter = useRef16(0);
|
|
5762
|
+
const editingRef = useRef16(null);
|
|
5763
|
+
const setEditing = useCallback14((next) => {
|
|
5576
5764
|
editingRef.current = next;
|
|
5577
5765
|
setEditingState(next);
|
|
5578
5766
|
}, []);
|
|
5579
5767
|
const callerRows = state.status === "ready" || state.status === "empty" ? state.value : EMPTY_RECORD_GRID_ROWS;
|
|
5580
|
-
|
|
5768
|
+
useEffect15(() => {
|
|
5581
5769
|
setOverlay((current) => pruneRecordGridOverlay(callerRows, current));
|
|
5582
5770
|
}, [callerRows]);
|
|
5583
5771
|
const visibleRows = useMemo8(() => projectRecordGridRows(callerRows, overlay), [callerRows, overlay]);
|
|
@@ -5604,7 +5792,7 @@ function useRecordGridViewState({
|
|
|
5604
5792
|
if (!columns.some((column) => column.id === focus.columnId)) return null;
|
|
5605
5793
|
return focus;
|
|
5606
5794
|
}, [columns, focus, visibleRows]);
|
|
5607
|
-
const setCellError =
|
|
5795
|
+
const setCellError = useCallback14((key, message) => {
|
|
5608
5796
|
setCellErrors((current) => {
|
|
5609
5797
|
if (message === null) {
|
|
5610
5798
|
if (!(key in current)) return current;
|
|
@@ -5616,7 +5804,7 @@ function useRecordGridViewState({
|
|
|
5616
5804
|
return { ...current, [key]: message };
|
|
5617
5805
|
});
|
|
5618
5806
|
}, []);
|
|
5619
|
-
const setRowError =
|
|
5807
|
+
const setRowError = useCallback14((rowId, message) => {
|
|
5620
5808
|
setRowErrors((current) => {
|
|
5621
5809
|
if (message === null) {
|
|
5622
5810
|
if (!(rowId in current)) return current;
|
|
@@ -5627,7 +5815,7 @@ function useRecordGridViewState({
|
|
|
5627
5815
|
return { ...current, [rowId]: message };
|
|
5628
5816
|
});
|
|
5629
5817
|
}, []);
|
|
5630
|
-
const setRowPending =
|
|
5818
|
+
const setRowPending = useCallback14((rowId, pending) => {
|
|
5631
5819
|
setPendingRows((current) => {
|
|
5632
5820
|
if (pending) return rowId in current ? current : { ...current, [rowId]: true };
|
|
5633
5821
|
if (!(rowId in current)) return current;
|
|
@@ -5636,11 +5824,11 @@ function useRecordGridViewState({
|
|
|
5636
5824
|
return next;
|
|
5637
5825
|
});
|
|
5638
5826
|
}, []);
|
|
5639
|
-
const focusCell =
|
|
5827
|
+
const focusCell = useCallback14((rowId, columnId) => {
|
|
5640
5828
|
setFocus({ rowId, columnId });
|
|
5641
5829
|
cellRefs.current.get(cellKey(rowId, columnId))?.focus();
|
|
5642
5830
|
}, []);
|
|
5643
|
-
const beginEdit =
|
|
5831
|
+
const beginEdit = useCallback14(
|
|
5644
5832
|
(row, column) => {
|
|
5645
5833
|
setCellError(cellKey(row.id, column.id), null);
|
|
5646
5834
|
setEditing({
|
|
@@ -5651,7 +5839,7 @@ function useRecordGridViewState({
|
|
|
5651
5839
|
},
|
|
5652
5840
|
[setCellError, setEditing]
|
|
5653
5841
|
);
|
|
5654
|
-
const applyCellWrite =
|
|
5842
|
+
const applyCellWrite = useCallback14(
|
|
5655
5843
|
(row, column, value) => writeRecordGridCell(row, column, value, {
|
|
5656
5844
|
onUpdate,
|
|
5657
5845
|
setOverlay,
|
|
@@ -5661,7 +5849,7 @@ function useRecordGridViewState({
|
|
|
5661
5849
|
}),
|
|
5662
5850
|
[locale, onUpdate, setRowError, setRowPending]
|
|
5663
5851
|
);
|
|
5664
|
-
const commitEdit =
|
|
5852
|
+
const commitEdit = useCallback14(
|
|
5665
5853
|
async (row, column, text) => {
|
|
5666
5854
|
const open = editingRef.current;
|
|
5667
5855
|
if (open === null || open.rowId !== row.id || open.columnId !== column.id) return;
|
|
@@ -5685,7 +5873,7 @@ function useRecordGridViewState({
|
|
|
5685
5873
|
},
|
|
5686
5874
|
[applyCellWrite, setCellError, setEditing]
|
|
5687
5875
|
);
|
|
5688
|
-
const cancelEdit =
|
|
5876
|
+
const cancelEdit = useCallback14(
|
|
5689
5877
|
(row, column) => {
|
|
5690
5878
|
setCellError(cellKey(row.id, column.id), null);
|
|
5691
5879
|
setEditing(null);
|
|
@@ -5693,20 +5881,20 @@ function useRecordGridViewState({
|
|
|
5693
5881
|
},
|
|
5694
5882
|
[focusCell, setCellError, setEditing]
|
|
5695
5883
|
);
|
|
5696
|
-
const performDelete =
|
|
5884
|
+
const performDelete = useCallback14(
|
|
5697
5885
|
(row) => deleteRecordGridRow(row, { onDelete, setConfirmDelete, setRowError, setOverlay, columns }),
|
|
5698
5886
|
[columns, onDelete, setRowError]
|
|
5699
5887
|
);
|
|
5700
|
-
const resetDraft =
|
|
5888
|
+
const resetDraft = useCallback14(() => {
|
|
5701
5889
|
setDraft({ ...newRowDefaults ?? {} });
|
|
5702
5890
|
setDraftErrors({});
|
|
5703
5891
|
setDraftError(null);
|
|
5704
5892
|
}, [newRowDefaults]);
|
|
5705
|
-
const openAdd =
|
|
5893
|
+
const openAdd = useCallback14(() => {
|
|
5706
5894
|
resetDraft();
|
|
5707
5895
|
setAdding(true);
|
|
5708
5896
|
}, [resetDraft]);
|
|
5709
|
-
const submitDraft =
|
|
5897
|
+
const submitDraft = useCallback14(() => createRecordGridRow({
|
|
5710
5898
|
onCreate,
|
|
5711
5899
|
columns,
|
|
5712
5900
|
draft,
|
|
@@ -5719,7 +5907,7 @@ function useRecordGridViewState({
|
|
|
5719
5907
|
setAdding,
|
|
5720
5908
|
resetDraft
|
|
5721
5909
|
}), [columns, draft, fieldPrefix, onCreate, resetDraft]);
|
|
5722
|
-
const handleGridKeyDown =
|
|
5910
|
+
const handleGridKeyDown = useCallback14(
|
|
5723
5911
|
(event) => {
|
|
5724
5912
|
if (editing !== null) return;
|
|
5725
5913
|
const target = event.target;
|
|
@@ -5813,7 +6001,7 @@ function useRecordGridViewState({
|
|
|
5813
6001
|
}
|
|
5814
6002
|
function RecordGrid(props) {
|
|
5815
6003
|
const view = useRecordGridViewState(props);
|
|
5816
|
-
return /* @__PURE__ */
|
|
6004
|
+
return /* @__PURE__ */ jsx21(RecordGridView, { ...view });
|
|
5817
6005
|
}
|
|
5818
6006
|
function RecordGridView({
|
|
5819
6007
|
state,
|
|
@@ -5869,9 +6057,9 @@ function RecordGridView({
|
|
|
5869
6057
|
setConfirmDelete
|
|
5870
6058
|
}) {
|
|
5871
6059
|
if (state.status === "idle" || state.status === "loading") {
|
|
5872
|
-
return /* @__PURE__ */
|
|
6060
|
+
return /* @__PURE__ */ jsxs19("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
5873
6061
|
toolbar,
|
|
5874
|
-
/* @__PURE__ */
|
|
6062
|
+
/* @__PURE__ */ jsxs19(
|
|
5875
6063
|
"div",
|
|
5876
6064
|
{
|
|
5877
6065
|
role: "status",
|
|
@@ -5879,22 +6067,22 @@ function RecordGridView({
|
|
|
5879
6067
|
"aria-live": "polite",
|
|
5880
6068
|
className: "space-y-2 rounded-xl border border-card-edge bg-card p-4",
|
|
5881
6069
|
children: [
|
|
5882
|
-
/* @__PURE__ */
|
|
6070
|
+
/* @__PURE__ */ jsxs19("span", { className: "sr-only", children: [
|
|
5883
6071
|
"Loading ",
|
|
5884
6072
|
caption
|
|
5885
6073
|
] }),
|
|
5886
|
-
Array.from({ length: Math.max(1, loadingRowCount) }, (_, index) => /* @__PURE__ */
|
|
6074
|
+
Array.from({ length: Math.max(1, loadingRowCount) }, (_, index) => /* @__PURE__ */ jsx21(Skeleton, { className: "h-8", "aria-hidden": true }, index))
|
|
5887
6075
|
]
|
|
5888
6076
|
}
|
|
5889
6077
|
)
|
|
5890
6078
|
] });
|
|
5891
6079
|
}
|
|
5892
6080
|
if (state.status === "error") {
|
|
5893
|
-
return /* @__PURE__ */
|
|
6081
|
+
return /* @__PURE__ */ jsxs19("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
5894
6082
|
toolbar,
|
|
5895
|
-
/* @__PURE__ */
|
|
5896
|
-
/* @__PURE__ */
|
|
5897
|
-
/* @__PURE__ */
|
|
6083
|
+
/* @__PURE__ */ jsxs19("div", { role: "alert", className: "rounded-xl border border-destructive/40 bg-destructive/10 px-4 py-4", children: [
|
|
6084
|
+
/* @__PURE__ */ jsx21("p", { className: "text-sm font-medium text-destructive", children: state.message }),
|
|
6085
|
+
/* @__PURE__ */ jsx21(
|
|
5898
6086
|
"button",
|
|
5899
6087
|
{
|
|
5900
6088
|
type: "button",
|
|
@@ -5906,7 +6094,7 @@ function RecordGridView({
|
|
|
5906
6094
|
] })
|
|
5907
6095
|
] });
|
|
5908
6096
|
}
|
|
5909
|
-
const addForm = adding && onCreate && !reviewing ? /* @__PURE__ */
|
|
6097
|
+
const addForm = adding && onCreate && !reviewing ? /* @__PURE__ */ jsx21(
|
|
5910
6098
|
AddRecordForm,
|
|
5911
6099
|
{
|
|
5912
6100
|
columns,
|
|
@@ -5925,17 +6113,17 @@ function RecordGridView({
|
|
|
5925
6113
|
}
|
|
5926
6114
|
) : null;
|
|
5927
6115
|
if (visibleRows.length === 0 && !reviewing) {
|
|
5928
|
-
return /* @__PURE__ */
|
|
6116
|
+
return /* @__PURE__ */ jsxs19("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
5929
6117
|
toolbar,
|
|
5930
|
-
addForm ?? /* @__PURE__ */
|
|
6118
|
+
addForm ?? /* @__PURE__ */ jsx21(
|
|
5931
6119
|
EmptyState,
|
|
5932
6120
|
{
|
|
5933
6121
|
title: empty.title,
|
|
5934
6122
|
description: empty.description,
|
|
5935
6123
|
className: "rounded-xl border border-dashed border-border",
|
|
5936
|
-
action: /* @__PURE__ */
|
|
5937
|
-
empty.action && (isValidElement(empty.action) ? empty.action : /* @__PURE__ */
|
|
5938
|
-
onCreate && /* @__PURE__ */
|
|
6124
|
+
action: /* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap items-center justify-center gap-2", children: [
|
|
6125
|
+
empty.action && (isValidElement(empty.action) ? empty.action : /* @__PURE__ */ jsx21(Button5, { type: "button", variant: "outline", size: "sm", onClick: empty.action.onClick, children: empty.action.label })),
|
|
6126
|
+
onCreate && /* @__PURE__ */ jsx21(Button5, { type: "button", variant: "outline", size: "sm", onClick: openAdd, children: addLabel })
|
|
5939
6127
|
] })
|
|
5940
6128
|
}
|
|
5941
6129
|
)
|
|
@@ -5953,18 +6141,18 @@ function RecordGridView({
|
|
|
5953
6141
|
addedCount > 0 ? `${addedCount} added` : null,
|
|
5954
6142
|
removedCount > 0 ? `${removedCount} removed` : null
|
|
5955
6143
|
].filter((part) => part !== null).join(" \xB7 ");
|
|
5956
|
-
const reviewBar = reviewing ? /* @__PURE__ */
|
|
6144
|
+
const reviewBar = reviewing ? /* @__PURE__ */ jsxs19(
|
|
5957
6145
|
"div",
|
|
5958
6146
|
{
|
|
5959
6147
|
"data-record-grid-review": "",
|
|
5960
6148
|
className: "flex flex-wrap items-center justify-between gap-3 rounded-xl border border-card-edge bg-card px-4 py-2.5",
|
|
5961
6149
|
children: [
|
|
5962
|
-
/* @__PURE__ */
|
|
5963
|
-
/* @__PURE__ */
|
|
5964
|
-
/* @__PURE__ */
|
|
6150
|
+
/* @__PURE__ */ jsxs19("div", { className: "min-w-0", children: [
|
|
6151
|
+
/* @__PURE__ */ jsx21("p", { className: "text-[11px] font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: "Proposed changes" }),
|
|
6152
|
+
/* @__PURE__ */ jsx21("p", { className: "mt-0.5 text-xs tabular-nums text-muted-foreground", children: reviewSummary })
|
|
5965
6153
|
] }),
|
|
5966
|
-
(onAcceptAll || onRejectAll) && /* @__PURE__ */
|
|
5967
|
-
onRejectAll && /* @__PURE__ */
|
|
6154
|
+
(onAcceptAll || onRejectAll) && /* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-2", children: [
|
|
6155
|
+
onRejectAll && /* @__PURE__ */ jsx21(
|
|
5968
6156
|
"button",
|
|
5969
6157
|
{
|
|
5970
6158
|
type: "button",
|
|
@@ -5974,7 +6162,7 @@ function RecordGridView({
|
|
|
5974
6162
|
children: "Reject all"
|
|
5975
6163
|
}
|
|
5976
6164
|
),
|
|
5977
|
-
onAcceptAll && /* @__PURE__ */
|
|
6165
|
+
onAcceptAll && /* @__PURE__ */ jsx21(
|
|
5978
6166
|
"button",
|
|
5979
6167
|
{
|
|
5980
6168
|
type: "button",
|
|
@@ -5988,10 +6176,10 @@ function RecordGridView({
|
|
|
5988
6176
|
]
|
|
5989
6177
|
}
|
|
5990
6178
|
) : null;
|
|
5991
|
-
return /* @__PURE__ */
|
|
6179
|
+
return /* @__PURE__ */ jsxs19("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
5992
6180
|
toolbar,
|
|
5993
6181
|
reviewBar,
|
|
5994
|
-
/* @__PURE__ */
|
|
6182
|
+
/* @__PURE__ */ jsx21("div", { className: "overflow-x-auto rounded-xl border border-card-edge bg-card", children: /* @__PURE__ */ jsxs19(
|
|
5995
6183
|
Table,
|
|
5996
6184
|
{
|
|
5997
6185
|
wrapper: false,
|
|
@@ -6000,8 +6188,8 @@ function RecordGridView({
|
|
|
6000
6188
|
className: "border-collapse text-left",
|
|
6001
6189
|
onKeyDown: handleGridKeyDown,
|
|
6002
6190
|
children: [
|
|
6003
|
-
/* @__PURE__ */
|
|
6004
|
-
columns.map((column) => /* @__PURE__ */
|
|
6191
|
+
/* @__PURE__ */ jsx21(TableHeader, { children: /* @__PURE__ */ jsxs19(TableRow, { role: "row", className: "text-xs uppercase tracking-[0.05em] text-muted-foreground", children: [
|
|
6192
|
+
columns.map((column) => /* @__PURE__ */ jsx21(
|
|
6005
6193
|
TableHead,
|
|
6006
6194
|
{
|
|
6007
6195
|
role: "columnheader",
|
|
@@ -6011,9 +6199,9 @@ function RecordGridView({
|
|
|
6011
6199
|
},
|
|
6012
6200
|
column.id
|
|
6013
6201
|
)),
|
|
6014
|
-
showActionsColumn && /* @__PURE__ */
|
|
6202
|
+
showActionsColumn && /* @__PURE__ */ jsx21(TableHead, { role: "columnheader", scope: "col", className: "h-auto w-px px-3 py-2", children: /* @__PURE__ */ jsx21("span", { className: "sr-only", children: reviewing ? "Review" : "Row actions" }) })
|
|
6015
6203
|
] }) }),
|
|
6016
|
-
/* @__PURE__ */
|
|
6204
|
+
/* @__PURE__ */ jsx21(
|
|
6017
6205
|
RecordGridRows,
|
|
6018
6206
|
{
|
|
6019
6207
|
visibleRows,
|
|
@@ -6048,8 +6236,8 @@ function RecordGridView({
|
|
|
6048
6236
|
addedRows
|
|
6049
6237
|
}
|
|
6050
6238
|
),
|
|
6051
|
-
hasFooter && /* @__PURE__ */
|
|
6052
|
-
columns.map((column) => /* @__PURE__ */
|
|
6239
|
+
hasFooter && /* @__PURE__ */ jsx21(TableFooter, { children: /* @__PURE__ */ jsxs19(TableRow, { role: "row", className: "border-t-2 border-border", children: [
|
|
6240
|
+
columns.map((column) => /* @__PURE__ */ jsx21(
|
|
6053
6241
|
TableCell,
|
|
6054
6242
|
{
|
|
6055
6243
|
role: "gridcell",
|
|
@@ -6058,21 +6246,21 @@ function RecordGridView({
|
|
|
6058
6246
|
},
|
|
6059
6247
|
column.id
|
|
6060
6248
|
)),
|
|
6061
|
-
showActionsColumn && /* @__PURE__ */
|
|
6249
|
+
showActionsColumn && /* @__PURE__ */ jsx21(TableCell, { role: "gridcell" })
|
|
6062
6250
|
] }) })
|
|
6063
6251
|
]
|
|
6064
6252
|
}
|
|
6065
6253
|
) }),
|
|
6066
|
-
onCreate && !reviewing && (addForm ?? /* @__PURE__ */
|
|
6254
|
+
onCreate && !reviewing && (addForm ?? /* @__PURE__ */ jsxs19(
|
|
6067
6255
|
"button",
|
|
6068
6256
|
{
|
|
6069
6257
|
type: "button",
|
|
6070
6258
|
onClick: openAdd,
|
|
6071
6259
|
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",
|
|
6072
6260
|
children: [
|
|
6073
|
-
/* @__PURE__ */
|
|
6074
|
-
/* @__PURE__ */
|
|
6075
|
-
/* @__PURE__ */
|
|
6261
|
+
/* @__PURE__ */ jsxs19(RecordGridActionGlyph, { children: [
|
|
6262
|
+
/* @__PURE__ */ jsx21("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
|
|
6263
|
+
/* @__PURE__ */ jsx21("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
|
|
6076
6264
|
] }),
|
|
6077
6265
|
addLabel
|
|
6078
6266
|
]
|
|
@@ -6081,7 +6269,7 @@ function RecordGridView({
|
|
|
6081
6269
|
] });
|
|
6082
6270
|
}
|
|
6083
6271
|
function RecordGridActionGlyph({ children }) {
|
|
6084
|
-
return /* @__PURE__ */
|
|
6272
|
+
return /* @__PURE__ */ jsx21(
|
|
6085
6273
|
"svg",
|
|
6086
6274
|
{
|
|
6087
6275
|
viewBox: "0 0 24 24",
|
|
@@ -6128,15 +6316,15 @@ function RecordGridRows({
|
|
|
6128
6316
|
columnSpan,
|
|
6129
6317
|
addedRows
|
|
6130
6318
|
}) {
|
|
6131
|
-
return /* @__PURE__ */
|
|
6319
|
+
return /* @__PURE__ */ jsxs19(TableBody, { children: [
|
|
6132
6320
|
visibleRows.map((row) => {
|
|
6133
6321
|
const rowLabel = recordGridRowLabel(columns, row);
|
|
6134
6322
|
const pending = row.id in pendingRows;
|
|
6135
6323
|
const rowError = rowErrors[row.id];
|
|
6136
6324
|
const rowDiff = reviewing ? diffByRow.get(row.id) : void 0;
|
|
6137
6325
|
const removedRow = rowDiff?.kind === "removed";
|
|
6138
|
-
return /* @__PURE__ */
|
|
6139
|
-
/* @__PURE__ */
|
|
6326
|
+
return /* @__PURE__ */ jsxs19(Fragment7, { children: [
|
|
6327
|
+
/* @__PURE__ */ jsxs19(
|
|
6140
6328
|
TableRow,
|
|
6141
6329
|
{
|
|
6142
6330
|
role: "row",
|
|
@@ -6156,8 +6344,8 @@ function RecordGridRows({
|
|
|
6156
6344
|
const errorId = `${fieldPrefix}-cell-error-${row.id}-${column.id}`;
|
|
6157
6345
|
const cellDiff = rowDiff?.kind === "changed" ? diffCellByKey.get(key) : void 0;
|
|
6158
6346
|
if (isEditing && editable) {
|
|
6159
|
-
return /* @__PURE__ */
|
|
6160
|
-
/* @__PURE__ */
|
|
6347
|
+
return /* @__PURE__ */ jsxs19(TableCell, { role: "gridcell", className: `px-3 py-1.5 ${alignmentClass(column)}`, children: [
|
|
6348
|
+
/* @__PURE__ */ jsx21(
|
|
6161
6349
|
CellEditor,
|
|
6162
6350
|
{
|
|
6163
6351
|
column,
|
|
@@ -6170,11 +6358,11 @@ function RecordGridRows({
|
|
|
6170
6358
|
onCancel: () => cancelEdit(row, column)
|
|
6171
6359
|
}
|
|
6172
6360
|
),
|
|
6173
|
-
cellError !== void 0 && /* @__PURE__ */
|
|
6361
|
+
cellError !== void 0 && /* @__PURE__ */ jsx21("p", { id: errorId, role: "alert", className: "mt-1 text-xs leading-snug text-destructive", children: cellError })
|
|
6174
6362
|
] }, column.id);
|
|
6175
6363
|
}
|
|
6176
6364
|
if (column.kind === "boolean" && editable) {
|
|
6177
|
-
return /* @__PURE__ */
|
|
6365
|
+
return /* @__PURE__ */ jsx21(TableCell, { role: "gridcell", className: `px-3 py-2 ${alignmentClass(column)}`, children: /* @__PURE__ */ jsx21(
|
|
6178
6366
|
"input",
|
|
6179
6367
|
{
|
|
6180
6368
|
type: "checkbox",
|
|
@@ -6193,7 +6381,7 @@ function RecordGridRows({
|
|
|
6193
6381
|
) }, column.id);
|
|
6194
6382
|
}
|
|
6195
6383
|
const display = applicable ? formatRecordGridValue(column, value, locale) : "";
|
|
6196
|
-
return /* @__PURE__ */
|
|
6384
|
+
return /* @__PURE__ */ jsx21(
|
|
6197
6385
|
TableCell,
|
|
6198
6386
|
{
|
|
6199
6387
|
role: "gridcell",
|
|
@@ -6211,20 +6399,20 @@ function RecordGridRows({
|
|
|
6211
6399
|
className: `px-3 py-2 outline-none focus:ring-2 focus:ring-inset focus:ring-primary/50 ${alignmentClass(
|
|
6212
6400
|
column
|
|
6213
6401
|
)} ${editable ? "cursor-text" : ""}`,
|
|
6214
|
-
children: /* @__PURE__ */
|
|
6215
|
-
column.id === columns[0]?.id && removedRow && /* @__PURE__ */
|
|
6216
|
-
cellDiff ? /* @__PURE__ */
|
|
6217
|
-
/* @__PURE__ */
|
|
6218
|
-
/* @__PURE__ */
|
|
6219
|
-
/* @__PURE__ */
|
|
6220
|
-
] }) : /* @__PURE__ */
|
|
6402
|
+
children: /* @__PURE__ */ jsxs19("span", { className: "inline-flex max-w-full items-center gap-1.5", children: [
|
|
6403
|
+
column.id === columns[0]?.id && removedRow && /* @__PURE__ */ jsx21("span", { className: "inline-flex shrink-0 rounded border border-destructive/60 px-1 py-px text-[11px] font-semibold uppercase tracking-[0.05em] text-destructive", children: "Remove" }),
|
|
6404
|
+
cellDiff ? /* @__PURE__ */ jsxs19("span", { className: "inline-flex max-w-full flex-wrap items-baseline gap-x-1.5", children: [
|
|
6405
|
+
/* @__PURE__ */ jsx21("span", { className: "tabular-nums text-destructive line-through decoration-destructive/60", children: formatRecordGridValue(column, cellDiff.before, locale) || "\u2014" }),
|
|
6406
|
+
/* @__PURE__ */ jsx21("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u2192" }),
|
|
6407
|
+
/* @__PURE__ */ jsx21("span", { className: "tabular-nums font-medium text-success", children: formatRecordGridValue(column, cellDiff.after, locale) || "\u2014" })
|
|
6408
|
+
] }) : /* @__PURE__ */ jsx21(
|
|
6221
6409
|
"span",
|
|
6222
6410
|
{
|
|
6223
6411
|
className: removedRow ? "truncate text-destructive line-through decoration-destructive/60" : display === "" ? "text-muted-foreground" : "truncate text-foreground",
|
|
6224
6412
|
children: display === "" ? applicable ? "\u2014" : "n/a" : display
|
|
6225
6413
|
}
|
|
6226
6414
|
),
|
|
6227
|
-
source && /* @__PURE__ */
|
|
6415
|
+
source && /* @__PURE__ */ jsx21(
|
|
6228
6416
|
SourceMarker,
|
|
6229
6417
|
{
|
|
6230
6418
|
panelId: `${fieldPrefix}-source-${row.id}-${column.id}`,
|
|
@@ -6240,7 +6428,7 @@ function RecordGridRows({
|
|
|
6240
6428
|
column.id
|
|
6241
6429
|
);
|
|
6242
6430
|
}),
|
|
6243
|
-
showActionsColumn && /* @__PURE__ */
|
|
6431
|
+
showActionsColumn && /* @__PURE__ */ jsx21(TableCell, { role: "gridcell", className: "px-3 py-2 text-right", children: reviewing ? rowDiff && /* @__PURE__ */ jsx21(
|
|
6244
6432
|
ReviewActions,
|
|
6245
6433
|
{
|
|
6246
6434
|
rowId: row.id,
|
|
@@ -6249,8 +6437,8 @@ function RecordGridRows({
|
|
|
6249
6437
|
onAccept: onAcceptRow,
|
|
6250
6438
|
onReject: onRejectRow
|
|
6251
6439
|
}
|
|
6252
|
-
) : row.readOnly === true ? null : confirmDelete === row.id ? /* @__PURE__ */
|
|
6253
|
-
/* @__PURE__ */
|
|
6440
|
+
) : row.readOnly === true ? null : confirmDelete === row.id ? /* @__PURE__ */ jsxs19("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
6441
|
+
/* @__PURE__ */ jsx21(
|
|
6254
6442
|
"button",
|
|
6255
6443
|
{
|
|
6256
6444
|
type: "button",
|
|
@@ -6260,7 +6448,7 @@ function RecordGridRows({
|
|
|
6260
6448
|
children: "Delete"
|
|
6261
6449
|
}
|
|
6262
6450
|
),
|
|
6263
|
-
/* @__PURE__ */
|
|
6451
|
+
/* @__PURE__ */ jsx21(
|
|
6264
6452
|
"button",
|
|
6265
6453
|
{
|
|
6266
6454
|
type: "button",
|
|
@@ -6270,28 +6458,28 @@ function RecordGridRows({
|
|
|
6270
6458
|
children: "Cancel"
|
|
6271
6459
|
}
|
|
6272
6460
|
)
|
|
6273
|
-
] }) : /* @__PURE__ */
|
|
6461
|
+
] }) : /* @__PURE__ */ jsx21(
|
|
6274
6462
|
"button",
|
|
6275
6463
|
{
|
|
6276
6464
|
type: "button",
|
|
6277
6465
|
"aria-label": `Delete ${rowLabel}`,
|
|
6278
6466
|
onClick: () => setConfirmDelete(row.id),
|
|
6279
6467
|
className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-destructive/10 hover:text-destructive",
|
|
6280
|
-
children: /* @__PURE__ */
|
|
6281
|
-
/* @__PURE__ */
|
|
6282
|
-
/* @__PURE__ */
|
|
6468
|
+
children: /* @__PURE__ */ jsxs19(RecordGridActionGlyph, { children: [
|
|
6469
|
+
/* @__PURE__ */ jsx21("polyline", { points: "3 6 5 6 21 6" }),
|
|
6470
|
+
/* @__PURE__ */ jsx21("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" })
|
|
6283
6471
|
] })
|
|
6284
6472
|
}
|
|
6285
6473
|
) })
|
|
6286
6474
|
]
|
|
6287
6475
|
}
|
|
6288
6476
|
),
|
|
6289
|
-
rowError !== void 0 && /* @__PURE__ */
|
|
6477
|
+
rowError !== void 0 && /* @__PURE__ */ jsx21(TableRow, { role: "row", children: /* @__PURE__ */ jsx21(TableCell, { role: "gridcell", colSpan: columnSpan, className: "px-3 pb-2", children: /* @__PURE__ */ jsx21("p", { role: "alert", className: "rounded-md bg-destructive/10 px-2.5 py-1.5 text-xs text-destructive", children: rowError }) }) })
|
|
6290
6478
|
] }, row.id);
|
|
6291
6479
|
}),
|
|
6292
6480
|
reviewing && addedRows.map((row) => {
|
|
6293
6481
|
const rowLabel = recordGridRowLabel(columns, row);
|
|
6294
|
-
return /* @__PURE__ */
|
|
6482
|
+
return /* @__PURE__ */ jsxs19(
|
|
6295
6483
|
TableRow,
|
|
6296
6484
|
{
|
|
6297
6485
|
role: "row",
|
|
@@ -6302,9 +6490,9 @@ function RecordGridRows({
|
|
|
6302
6490
|
const applicable = isRecordGridCellApplicable(column, row.values);
|
|
6303
6491
|
const value = row.values[column.id] ?? null;
|
|
6304
6492
|
const display = applicable ? formatRecordGridValue(column, value, locale) : "";
|
|
6305
|
-
return /* @__PURE__ */
|
|
6306
|
-
columnIndex === 0 && /* @__PURE__ */
|
|
6307
|
-
/* @__PURE__ */
|
|
6493
|
+
return /* @__PURE__ */ jsx21(TableCell, { role: "gridcell", className: `px-3 py-2 ${alignmentClass(column)}`, children: /* @__PURE__ */ jsxs19("span", { className: "inline-flex max-w-full items-center gap-1.5", children: [
|
|
6494
|
+
columnIndex === 0 && /* @__PURE__ */ jsx21("span", { className: "inline-flex shrink-0 rounded border border-success/60 px-1 py-px text-[11px] font-semibold uppercase tracking-[0.05em] text-success", children: "New" }),
|
|
6495
|
+
/* @__PURE__ */ jsx21(
|
|
6308
6496
|
"span",
|
|
6309
6497
|
{
|
|
6310
6498
|
className: `tabular-nums ${display === "" ? "text-muted-foreground" : "truncate text-foreground"}`,
|
|
@@ -6313,7 +6501,7 @@ function RecordGridRows({
|
|
|
6313
6501
|
)
|
|
6314
6502
|
] }) }, column.id);
|
|
6315
6503
|
}),
|
|
6316
|
-
/* @__PURE__ */
|
|
6504
|
+
/* @__PURE__ */ jsx21(TableCell, { role: "gridcell", className: "px-3 py-2 text-right", children: /* @__PURE__ */ jsx21(
|
|
6317
6505
|
ReviewActions,
|
|
6318
6506
|
{
|
|
6319
6507
|
rowId: row.id,
|
|
@@ -6333,19 +6521,19 @@ function RecordGridRows({
|
|
|
6333
6521
|
|
|
6334
6522
|
// src/web-react/command-palette.tsx
|
|
6335
6523
|
import {
|
|
6336
|
-
useCallback as
|
|
6337
|
-
useEffect as
|
|
6524
|
+
useCallback as useCallback15,
|
|
6525
|
+
useEffect as useEffect16,
|
|
6338
6526
|
useId as useId4,
|
|
6339
6527
|
useMemo as useMemo9,
|
|
6340
|
-
useRef as
|
|
6341
|
-
useState as
|
|
6528
|
+
useRef as useRef17,
|
|
6529
|
+
useState as useState23
|
|
6342
6530
|
} from "react";
|
|
6343
6531
|
import { Dialog, DialogContent, DialogTitle } from "@tangle-network/ui/primitives";
|
|
6344
|
-
import { jsx as
|
|
6532
|
+
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
6345
6533
|
function SearchGlyph({ className }) {
|
|
6346
|
-
return /* @__PURE__ */
|
|
6347
|
-
/* @__PURE__ */
|
|
6348
|
-
/* @__PURE__ */
|
|
6534
|
+
return /* @__PURE__ */ jsxs20("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
6535
|
+
/* @__PURE__ */ jsx22("circle", { cx: "11", cy: "11", r: "8" }),
|
|
6536
|
+
/* @__PURE__ */ jsx22("path", { d: "m21 21-4.3-4.3" })
|
|
6349
6537
|
] });
|
|
6350
6538
|
}
|
|
6351
6539
|
function CommandPalette({
|
|
@@ -6362,25 +6550,25 @@ function CommandPalette({
|
|
|
6362
6550
|
emptyMessage,
|
|
6363
6551
|
label = "Command palette"
|
|
6364
6552
|
}) {
|
|
6365
|
-
const [internalOpen, setInternalOpen] =
|
|
6553
|
+
const [internalOpen, setInternalOpen] = useState23(false);
|
|
6366
6554
|
const open = controlledOpen ?? internalOpen;
|
|
6367
|
-
const setOpen =
|
|
6555
|
+
const setOpen = useCallback15(
|
|
6368
6556
|
(next) => {
|
|
6369
6557
|
if (controlledOpen === void 0) setInternalOpen(next);
|
|
6370
6558
|
onOpenChange?.(next);
|
|
6371
6559
|
},
|
|
6372
6560
|
[controlledOpen, onOpenChange]
|
|
6373
6561
|
);
|
|
6374
|
-
const [query, setQuery] =
|
|
6375
|
-
const [active, setActive] =
|
|
6376
|
-
const inputRef =
|
|
6562
|
+
const [query, setQuery] = useState23(initialQuery ?? "");
|
|
6563
|
+
const [active, setActive] = useState23(0);
|
|
6564
|
+
const inputRef = useRef17(null);
|
|
6377
6565
|
const surfaceId = useId4();
|
|
6378
6566
|
const listId = `${surfaceId}-list`;
|
|
6379
6567
|
const flat = useMemo9(() => filterCommandPaletteItems(items, query), [items, query]);
|
|
6380
6568
|
const sections = useMemo9(() => groupCommandPaletteItems(flat), [flat]);
|
|
6381
6569
|
const activeIndex = flat.length === 0 ? 0 : Math.min(active, flat.length - 1);
|
|
6382
6570
|
const activeId = flat.length > 0 ? `${listId}-${activeIndex}` : void 0;
|
|
6383
|
-
|
|
6571
|
+
useEffect16(() => {
|
|
6384
6572
|
if (!hotkey) return;
|
|
6385
6573
|
function onKeyDown(e) {
|
|
6386
6574
|
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k") {
|
|
@@ -6391,18 +6579,18 @@ function CommandPalette({
|
|
|
6391
6579
|
document.addEventListener("keydown", onKeyDown);
|
|
6392
6580
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
6393
6581
|
}, [hotkey, open, setOpen]);
|
|
6394
|
-
const restoreFocusRef =
|
|
6395
|
-
|
|
6582
|
+
const restoreFocusRef = useRef17(null);
|
|
6583
|
+
useEffect16(() => {
|
|
6396
6584
|
if (open) return;
|
|
6397
6585
|
setQuery(initialQuery ?? "");
|
|
6398
6586
|
onQueryChange?.(initialQuery ?? "");
|
|
6399
6587
|
setActive(0);
|
|
6400
6588
|
}, [open]);
|
|
6401
|
-
|
|
6589
|
+
useEffect16(() => {
|
|
6402
6590
|
if (!open || !activeId) return;
|
|
6403
6591
|
document.getElementById(activeId)?.scrollIntoView?.({ block: "nearest" });
|
|
6404
6592
|
}, [open, activeId]);
|
|
6405
|
-
const choose =
|
|
6593
|
+
const choose = useCallback15(
|
|
6406
6594
|
(item) => {
|
|
6407
6595
|
onSelect(item);
|
|
6408
6596
|
setOpen(false);
|
|
@@ -6423,7 +6611,7 @@ function CommandPalette({
|
|
|
6423
6611
|
}
|
|
6424
6612
|
};
|
|
6425
6613
|
let rowIndex = -1;
|
|
6426
|
-
return /* @__PURE__ */
|
|
6614
|
+
return /* @__PURE__ */ jsx22(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs20(
|
|
6427
6615
|
DialogContent,
|
|
6428
6616
|
{
|
|
6429
6617
|
hideCloseButton: true,
|
|
@@ -6442,10 +6630,10 @@ function CommandPalette({
|
|
|
6442
6630
|
...{ [POPOVER_SURFACE_ATTR]: surfaceId },
|
|
6443
6631
|
className: `top-[15%] z-[1000] flex max-h-[70vh] w-[560px] max-w-[calc(100vw-2rem)] translate-y-0 flex-col gap-0 overflow-hidden rounded-xl border-card-edge bg-popover p-0 ${OVERLAY_SHADOW}`,
|
|
6444
6632
|
children: [
|
|
6445
|
-
/* @__PURE__ */
|
|
6446
|
-
/* @__PURE__ */
|
|
6447
|
-
/* @__PURE__ */
|
|
6448
|
-
/* @__PURE__ */
|
|
6633
|
+
/* @__PURE__ */ jsx22(DialogTitle, { className: "sr-only", children: label }),
|
|
6634
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex shrink-0 items-center gap-2 border-b border-border px-3 py-2.5", children: [
|
|
6635
|
+
/* @__PURE__ */ jsx22(SearchGlyph, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
6636
|
+
/* @__PURE__ */ jsx22(
|
|
6449
6637
|
"input",
|
|
6450
6638
|
{
|
|
6451
6639
|
ref: inputRef,
|
|
@@ -6467,15 +6655,15 @@ function CommandPalette({
|
|
|
6467
6655
|
}
|
|
6468
6656
|
)
|
|
6469
6657
|
] }),
|
|
6470
|
-
/* @__PURE__ */
|
|
6471
|
-
loading && /* @__PURE__ */
|
|
6472
|
-
!loading && flat.length === 0 && /* @__PURE__ */
|
|
6473
|
-
!loading && sections.map((section) => /* @__PURE__ */
|
|
6474
|
-
/* @__PURE__ */
|
|
6658
|
+
/* @__PURE__ */ jsxs20("div", { role: "listbox", id: listId, className: "min-h-0 flex-1 overflow-y-auto p-1 pb-2", children: [
|
|
6659
|
+
loading && /* @__PURE__ */ jsx22("div", { className: "px-3 py-4 text-center text-sm text-muted-foreground", children: "Loading\u2026" }),
|
|
6660
|
+
!loading && flat.length === 0 && /* @__PURE__ */ jsx22("div", { className: "px-3 py-4 text-center text-sm text-muted-foreground", children: emptyMessage ?? (query.trim() ? `No results for \u201C${query.trim()}\u201D` : "Nothing here yet") }),
|
|
6661
|
+
!loading && sections.map((section) => /* @__PURE__ */ jsxs20("div", { children: [
|
|
6662
|
+
/* @__PURE__ */ jsx22("div", { className: "px-3 pb-1 pt-3 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: section.group }),
|
|
6475
6663
|
section.items.map((item) => {
|
|
6476
6664
|
rowIndex += 1;
|
|
6477
6665
|
const index = rowIndex;
|
|
6478
|
-
return /* @__PURE__ */
|
|
6666
|
+
return /* @__PURE__ */ jsxs20(
|
|
6479
6667
|
"div",
|
|
6480
6668
|
{
|
|
6481
6669
|
id: `${listId}-${index}`,
|
|
@@ -6485,9 +6673,9 @@ function CommandPalette({
|
|
|
6485
6673
|
onClick: () => choose(item),
|
|
6486
6674
|
className: `flex w-full cursor-pointer items-center gap-2.5 rounded-md px-3 py-2.5 text-left text-sm ${index === activeIndex ? "bg-accent" : ""}`,
|
|
6487
6675
|
children: [
|
|
6488
|
-
/* @__PURE__ */
|
|
6489
|
-
item.description && /* @__PURE__ */
|
|
6490
|
-
item.hint && /* @__PURE__ */
|
|
6676
|
+
/* @__PURE__ */ jsx22("span", { className: "truncate text-foreground", children: item.label }),
|
|
6677
|
+
item.description && /* @__PURE__ */ jsx22("span", { className: "truncate text-xs text-muted-foreground", children: item.description }),
|
|
6678
|
+
item.hint && /* @__PURE__ */ jsx22("span", { className: "ml-auto shrink-0 text-xs tabular-nums text-muted-foreground", children: item.hint })
|
|
6491
6679
|
]
|
|
6492
6680
|
},
|
|
6493
6681
|
item.id
|
|
@@ -6495,15 +6683,15 @@ function CommandPalette({
|
|
|
6495
6683
|
})
|
|
6496
6684
|
] }, section.group))
|
|
6497
6685
|
] }),
|
|
6498
|
-
/* @__PURE__ */
|
|
6499
|
-
/* @__PURE__ */
|
|
6500
|
-
/* @__PURE__ */
|
|
6501
|
-
/* @__PURE__ */
|
|
6502
|
-
/* @__PURE__ */
|
|
6503
|
-
/* @__PURE__ */
|
|
6504
|
-
/* @__PURE__ */
|
|
6505
|
-
/* @__PURE__ */
|
|
6506
|
-
/* @__PURE__ */
|
|
6686
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex shrink-0 items-center justify-between border-t border-border px-3 py-2 text-xs text-muted-foreground", children: [
|
|
6687
|
+
/* @__PURE__ */ jsx22("span", { className: "tabular-nums", children: query.trim() ? `${flat.length} of ${items.length}` : `${items.length} items` }),
|
|
6688
|
+
/* @__PURE__ */ jsxs20("span", { className: "flex items-center gap-1.5", children: [
|
|
6689
|
+
/* @__PURE__ */ jsx22("kbd", { className: "rounded border border-border bg-background px-1 py-0.5", children: "\u2191\u2193" }),
|
|
6690
|
+
/* @__PURE__ */ jsx22("span", { children: "navigate" }),
|
|
6691
|
+
/* @__PURE__ */ jsx22("kbd", { className: "ml-1.5 rounded border border-border bg-background px-1 py-0.5", children: "\u21B5" }),
|
|
6692
|
+
/* @__PURE__ */ jsx22("span", { children: "select" }),
|
|
6693
|
+
/* @__PURE__ */ jsx22("kbd", { className: "ml-1.5 rounded border border-border bg-background px-1 py-0.5", children: "esc" }),
|
|
6694
|
+
/* @__PURE__ */ jsx22("span", { children: "close" })
|
|
6507
6695
|
] })
|
|
6508
6696
|
] })
|
|
6509
6697
|
]
|
|
@@ -6512,7 +6700,7 @@ function CommandPalette({
|
|
|
6512
6700
|
}
|
|
6513
6701
|
|
|
6514
6702
|
// src/web-react/sparkline.tsx
|
|
6515
|
-
import { jsx as
|
|
6703
|
+
import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
6516
6704
|
var DEFAULT_SPARKLINE_WIDTH = 96;
|
|
6517
6705
|
var DEFAULT_SPARKLINE_HEIGHT = 24;
|
|
6518
6706
|
var DEFAULT_INSET = 2.5;
|
|
@@ -6618,21 +6806,21 @@ function Sparkline({
|
|
|
6618
6806
|
const geometry = sparklineGeometry(values, { width, height });
|
|
6619
6807
|
const accessibleName = sparklineLabel(values, { label, format });
|
|
6620
6808
|
if (geometry.points.length === 0) {
|
|
6621
|
-
return /* @__PURE__ */
|
|
6809
|
+
return /* @__PURE__ */ jsxs21(
|
|
6622
6810
|
"span",
|
|
6623
6811
|
{
|
|
6624
6812
|
"data-sparkline": geometry.gaps > 0 ? "unavailable" : "empty",
|
|
6625
6813
|
className: joinClasses("text-[11px] text-muted-foreground", className),
|
|
6626
6814
|
children: [
|
|
6627
|
-
/* @__PURE__ */
|
|
6628
|
-
/* @__PURE__ */
|
|
6815
|
+
/* @__PURE__ */ jsx23("span", { className: "sr-only", children: accessibleName }),
|
|
6816
|
+
/* @__PURE__ */ jsx23("span", { "aria-hidden": "true", children: geometry.gaps > 0 ? unavailableLabel : emptyLabel })
|
|
6629
6817
|
]
|
|
6630
6818
|
}
|
|
6631
6819
|
);
|
|
6632
6820
|
}
|
|
6633
6821
|
const drawsLine = geometry.segments.some((segment) => segment.length > 1);
|
|
6634
6822
|
const end = geometry.points[geometry.points.length - 1];
|
|
6635
|
-
return /* @__PURE__ */
|
|
6823
|
+
return /* @__PURE__ */ jsxs21(
|
|
6636
6824
|
"svg",
|
|
6637
6825
|
{
|
|
6638
6826
|
role: "img",
|
|
@@ -6649,7 +6837,7 @@ function Sparkline({
|
|
|
6649
6837
|
geometry.segments.map((segment, index) => {
|
|
6650
6838
|
const key = `segment-${index}`;
|
|
6651
6839
|
if (segment.length > 1) {
|
|
6652
|
-
return /* @__PURE__ */
|
|
6840
|
+
return /* @__PURE__ */ jsx23(
|
|
6653
6841
|
"polyline",
|
|
6654
6842
|
{
|
|
6655
6843
|
points: sparklinePointsAttribute(segment),
|
|
@@ -6665,9 +6853,9 @@ function Sparkline({
|
|
|
6665
6853
|
}
|
|
6666
6854
|
const only = segment[0];
|
|
6667
6855
|
if (only.x === end.x && only.y === end.y) return null;
|
|
6668
|
-
return /* @__PURE__ */
|
|
6856
|
+
return /* @__PURE__ */ jsx23("circle", { cx: only.x, cy: only.y, r: DOT_RADIUS, fill: "currentColor" }, key);
|
|
6669
6857
|
}),
|
|
6670
|
-
/* @__PURE__ */
|
|
6858
|
+
/* @__PURE__ */ jsx23("circle", { cx: end.x, cy: end.y, r: DOT_RADIUS, fill: "currentColor" })
|
|
6671
6859
|
]
|
|
6672
6860
|
}
|
|
6673
6861
|
);
|
|
@@ -6676,12 +6864,12 @@ function Sparkline({
|
|
|
6676
6864
|
// src/web-react/insight-card.tsx
|
|
6677
6865
|
import {
|
|
6678
6866
|
isValidElement as isValidElement2,
|
|
6679
|
-
useCallback as
|
|
6680
|
-
useEffect as
|
|
6681
|
-
useRef as
|
|
6682
|
-
useState as
|
|
6867
|
+
useCallback as useCallback16,
|
|
6868
|
+
useEffect as useEffect17,
|
|
6869
|
+
useRef as useRef18,
|
|
6870
|
+
useState as useState24
|
|
6683
6871
|
} from "react";
|
|
6684
|
-
import { Fragment as
|
|
6872
|
+
import { Fragment as Fragment8, jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
6685
6873
|
function insightDelta(value, previous) {
|
|
6686
6874
|
if (typeof value !== "number" || !Number.isFinite(value)) return null;
|
|
6687
6875
|
if (typeof previous !== "number" || !Number.isFinite(previous)) return null;
|
|
@@ -6734,7 +6922,7 @@ function InsightCard({
|
|
|
6734
6922
|
const tone = delta ? insightDeltaTone(delta.direction, polarity) : "neutral";
|
|
6735
6923
|
const unavailable = typeof value === "number" && !Number.isFinite(value);
|
|
6736
6924
|
const shown = typeof value === "number" ? format(value) : value;
|
|
6737
|
-
return /* @__PURE__ */
|
|
6925
|
+
return /* @__PURE__ */ jsxs22(
|
|
6738
6926
|
"article",
|
|
6739
6927
|
{
|
|
6740
6928
|
"data-insight-card": "",
|
|
@@ -6742,40 +6930,40 @@ function InsightCard({
|
|
|
6742
6930
|
className: joinClasses("agent-arrive flex h-full flex-col rounded-xl border border-card-edge bg-card p-4", className),
|
|
6743
6931
|
style,
|
|
6744
6932
|
children: [
|
|
6745
|
-
eyebrow ? /* @__PURE__ */
|
|
6746
|
-
/* @__PURE__ */
|
|
6747
|
-
/* @__PURE__ */
|
|
6933
|
+
eyebrow ? /* @__PURE__ */ jsx24("p", { "data-insight-eyebrow": "", className: "mb-0.5 text-[11px] font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: eyebrow }) : null,
|
|
6934
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-baseline justify-between gap-2", children: [
|
|
6935
|
+
/* @__PURE__ */ jsx24("h3", { className: "text-[13px] font-medium text-muted-foreground", children: title }),
|
|
6748
6936
|
live ? (
|
|
6749
6937
|
// No `data-motion` opt-out: the word is the signal and the sweep is
|
|
6750
6938
|
// emphasis, so the reduced-motion floor reaches this like everything
|
|
6751
6939
|
// else and leaves a static, legible label.
|
|
6752
|
-
/* @__PURE__ */
|
|
6940
|
+
/* @__PURE__ */ jsx24("span", { className: "agent-shimmer shrink-0 text-[11px] font-medium", "data-insight-live": "", children: liveLabel })
|
|
6753
6941
|
) : null
|
|
6754
6942
|
] }),
|
|
6755
|
-
/* @__PURE__ */
|
|
6756
|
-
/* @__PURE__ */
|
|
6757
|
-
/* @__PURE__ */
|
|
6758
|
-
] }) : /* @__PURE__ */
|
|
6759
|
-
/* @__PURE__ */
|
|
6760
|
-
unit ? /* @__PURE__ */
|
|
6943
|
+
/* @__PURE__ */ jsx24("p", { className: "mt-1 flex items-baseline gap-1", children: unavailable ? /* @__PURE__ */ jsxs22("span", { "data-insight-value": "unavailable", className: "text-xl font-semibold text-muted-foreground", children: [
|
|
6944
|
+
/* @__PURE__ */ jsx24("span", { "aria-hidden": "true", children: INSIGHT_UNAVAILABLE_GLYPH }),
|
|
6945
|
+
/* @__PURE__ */ jsx24("span", { className: "sr-only", children: INSIGHT_UNAVAILABLE_LABEL })
|
|
6946
|
+
] }) : /* @__PURE__ */ jsxs22(Fragment8, { children: [
|
|
6947
|
+
/* @__PURE__ */ jsx24("span", { className: "text-xl font-semibold tabular-nums text-foreground", children: shown }),
|
|
6948
|
+
unit ? /* @__PURE__ */ jsx24("span", { className: "text-[11px] text-muted-foreground", children: unit }) : null
|
|
6761
6949
|
] }) }),
|
|
6762
|
-
delta ? /* @__PURE__ */
|
|
6763
|
-
/* @__PURE__ */
|
|
6950
|
+
delta ? /* @__PURE__ */ jsxs22("p", { "data-insight-delta": delta.direction, className: `mt-0.5 text-[11px] font-medium ${TONE_CLASS[tone]}`, children: [
|
|
6951
|
+
/* @__PURE__ */ jsxs22("span", { "aria-hidden": "true", children: [
|
|
6764
6952
|
DIRECTION_GLYPH[delta.direction],
|
|
6765
6953
|
" "
|
|
6766
6954
|
] }),
|
|
6767
6955
|
formatInsightDelta(delta, format)
|
|
6768
6956
|
] }) : null,
|
|
6769
|
-
description ? /* @__PURE__ */
|
|
6770
|
-
series ? /* @__PURE__ */
|
|
6771
|
-
action ? /* @__PURE__ */
|
|
6957
|
+
description ? /* @__PURE__ */ jsx24("p", { className: "mt-1 text-[11px] text-muted-foreground", children: description }) : null,
|
|
6958
|
+
series ? /* @__PURE__ */ jsx24("div", { className: "mt-2 text-muted-foreground", children: /* @__PURE__ */ jsx24(Sparkline, { values: series, label: seriesLabel ?? title, format }) }) : null,
|
|
6959
|
+
action ? /* @__PURE__ */ jsx24("div", { className: "mt-3", children: renderInsightAction(action) }) : null
|
|
6772
6960
|
]
|
|
6773
6961
|
}
|
|
6774
6962
|
);
|
|
6775
6963
|
}
|
|
6776
6964
|
function renderInsightAction(action) {
|
|
6777
6965
|
if (isValidElement2(action)) return action;
|
|
6778
|
-
return /* @__PURE__ */
|
|
6966
|
+
return /* @__PURE__ */ jsx24(
|
|
6779
6967
|
"button",
|
|
6780
6968
|
{
|
|
6781
6969
|
type: "button",
|
|
@@ -6844,15 +7032,15 @@ function InsightDeck({
|
|
|
6844
7032
|
className,
|
|
6845
7033
|
onPageChange
|
|
6846
7034
|
}) {
|
|
6847
|
-
const [page, setPage] =
|
|
6848
|
-
const [held, setHeld] =
|
|
7035
|
+
const [page, setPage] = useState24(0);
|
|
7036
|
+
const [held, setHeld] = useState24(null);
|
|
6849
7037
|
const answered = state.status === "error" || state.status === "empty";
|
|
6850
7038
|
const carried = state.status === "ready" ? state.value : answered ? null : held;
|
|
6851
7039
|
if (carried !== held) setHeld(carried);
|
|
6852
7040
|
const shown = carried !== null && state.status !== "ready" ? { status: "ready", value: carried, retry: state.retry } : state;
|
|
6853
7041
|
const refreshing = shown !== state;
|
|
6854
|
-
const reported =
|
|
6855
|
-
const settlePage =
|
|
7042
|
+
const reported = useRef18(0);
|
|
7043
|
+
const settlePage = useCallback16(
|
|
6856
7044
|
(next) => {
|
|
6857
7045
|
if (reported.current === next) return;
|
|
6858
7046
|
reported.current = next;
|
|
@@ -6860,7 +7048,7 @@ function InsightDeck({
|
|
|
6860
7048
|
},
|
|
6861
7049
|
[onPageChange]
|
|
6862
7050
|
);
|
|
6863
|
-
return /* @__PURE__ */
|
|
7051
|
+
return /* @__PURE__ */ jsx24(
|
|
6864
7052
|
AsyncView,
|
|
6865
7053
|
{
|
|
6866
7054
|
state: shown,
|
|
@@ -6868,7 +7056,7 @@ function InsightDeck({
|
|
|
6868
7056
|
loadingLabel,
|
|
6869
7057
|
retryLabel,
|
|
6870
7058
|
className,
|
|
6871
|
-
children: (insights) => /* @__PURE__ */
|
|
7059
|
+
children: (insights) => /* @__PURE__ */ jsx24(
|
|
6872
7060
|
InsightPages,
|
|
6873
7061
|
{
|
|
6874
7062
|
insights,
|
|
@@ -6935,18 +7123,18 @@ function InsightPages({
|
|
|
6935
7123
|
const pageCount = insightPageCount(insights.length, size);
|
|
6936
7124
|
const current = Math.min(Math.max(page, 0), pageCount - 1);
|
|
6937
7125
|
const visible = insightPageSlice(insights, current, size);
|
|
6938
|
-
const sectionRef =
|
|
6939
|
-
const listRef =
|
|
6940
|
-
const recoverFocus =
|
|
6941
|
-
|
|
7126
|
+
const sectionRef = useRef18(null);
|
|
7127
|
+
const listRef = useRef18(null);
|
|
7128
|
+
const recoverFocus = useRef18(false);
|
|
7129
|
+
useEffect17(() => {
|
|
6942
7130
|
onPageSettled(current);
|
|
6943
7131
|
}, [current, onPageSettled]);
|
|
6944
|
-
|
|
7132
|
+
useEffect17(() => {
|
|
6945
7133
|
if (!recoverFocus.current) return;
|
|
6946
7134
|
recoverFocus.current = false;
|
|
6947
7135
|
sectionRef.current?.focus();
|
|
6948
7136
|
}, [current]);
|
|
6949
|
-
const goTo =
|
|
7137
|
+
const goTo = useCallback16(
|
|
6950
7138
|
(next) => {
|
|
6951
7139
|
const clamped = Math.min(Math.max(next, 0), pageCount - 1);
|
|
6952
7140
|
if (clamped === current) return false;
|
|
@@ -6981,7 +7169,7 @@ function InsightPages({
|
|
|
6981
7169
|
}
|
|
6982
7170
|
if (moved) event.preventDefault();
|
|
6983
7171
|
};
|
|
6984
|
-
return /* @__PURE__ */
|
|
7172
|
+
return /* @__PURE__ */ jsxs22(
|
|
6985
7173
|
"section",
|
|
6986
7174
|
{
|
|
6987
7175
|
ref: sectionRef,
|
|
@@ -6993,7 +7181,7 @@ function InsightPages({
|
|
|
6993
7181
|
tabIndex: pageCount > 1 ? 0 : void 0,
|
|
6994
7182
|
"aria-keyshortcuts": pageCount > 1 ? "ArrowLeft ArrowRight PageUp PageDown Home End" : void 0,
|
|
6995
7183
|
children: [
|
|
6996
|
-
/* @__PURE__ */
|
|
7184
|
+
/* @__PURE__ */ jsx24("ul", { ref: listRef, className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-3", children: visible.map(({ id, style, ...card }, index) => (
|
|
6997
7185
|
// The page index is in the key on purpose: a page turn is an arrival,
|
|
6998
7186
|
// and reusing the node would swap the text under a card that never
|
|
6999
7187
|
// moved. Remounting replays `.agent-arrive` with the new stagger.
|
|
@@ -7004,10 +7192,10 @@ function InsightPages({
|
|
|
7004
7192
|
// does not arrive a second time. The key does BOTH jobs — but only
|
|
7005
7193
|
// because the deck now keeps this subtree mounted across a reload
|
|
7006
7194
|
// (see `InsightDeck`); a key is never compared across a teardown.
|
|
7007
|
-
/* @__PURE__ */
|
|
7195
|
+
/* @__PURE__ */ jsx24("li", { children: /* @__PURE__ */ jsx24(InsightCard, { ...card, style: staggerStyle(index, style) }) }, `${current}:${id}`)
|
|
7008
7196
|
)) }),
|
|
7009
|
-
/* @__PURE__ */
|
|
7010
|
-
/* @__PURE__ */
|
|
7197
|
+
/* @__PURE__ */ jsxs22("div", { className: pageCount > 1 ? "flex items-center justify-between gap-2" : void 0, children: [
|
|
7198
|
+
/* @__PURE__ */ jsxs22(
|
|
7011
7199
|
"p",
|
|
7012
7200
|
{
|
|
7013
7201
|
role: "status",
|
|
@@ -7021,8 +7209,8 @@ function InsightPages({
|
|
|
7021
7209
|
]
|
|
7022
7210
|
}
|
|
7023
7211
|
),
|
|
7024
|
-
pageCount > 1 ? /* @__PURE__ */
|
|
7025
|
-
/* @__PURE__ */
|
|
7212
|
+
pageCount > 1 ? /* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-1", children: [
|
|
7213
|
+
/* @__PURE__ */ jsx24(PagerButton, { label: "Previous insights", glyph: "\u2039", atEnd: current === 0, onClick: () => goTo(current - 1) }),
|
|
7026
7214
|
pageCount <= MAX_PAGE_DOTS ? Array.from({ length: pageCount }, (_, index) => (
|
|
7027
7215
|
// WCAG 2.2 SC 2.5.8 wants a 24x24 CSS px target. The dot stays
|
|
7028
7216
|
// 8px because a 24px dot is a different control; the BUTTON
|
|
@@ -7030,7 +7218,7 @@ function InsightPages({
|
|
|
7030
7218
|
// and the span is the graphic. The Spacing exception cannot
|
|
7031
7219
|
// rescue the bare dot — at a 12px pitch the 24px circle around
|
|
7032
7220
|
// each centre overlaps its neighbour's.
|
|
7033
|
-
/* @__PURE__ */
|
|
7221
|
+
/* @__PURE__ */ jsx24(
|
|
7034
7222
|
"button",
|
|
7035
7223
|
{
|
|
7036
7224
|
type: "button",
|
|
@@ -7038,7 +7226,7 @@ function InsightPages({
|
|
|
7038
7226
|
"aria-current": index === current ? "page" : void 0,
|
|
7039
7227
|
onClick: () => goTo(index),
|
|
7040
7228
|
className: "group flex h-6 w-6 shrink-0 items-center justify-center rounded-full",
|
|
7041
|
-
children: /* @__PURE__ */
|
|
7229
|
+
children: /* @__PURE__ */ jsx24(
|
|
7042
7230
|
"span",
|
|
7043
7231
|
{
|
|
7044
7232
|
"aria-hidden": "true",
|
|
@@ -7052,7 +7240,7 @@ function InsightPages({
|
|
|
7052
7240
|
index
|
|
7053
7241
|
)
|
|
7054
7242
|
)) : null,
|
|
7055
|
-
/* @__PURE__ */
|
|
7243
|
+
/* @__PURE__ */ jsx24(
|
|
7056
7244
|
PagerButton,
|
|
7057
7245
|
{
|
|
7058
7246
|
label: "Next insights",
|
|
@@ -7073,7 +7261,7 @@ function PagerButton({
|
|
|
7073
7261
|
atEnd,
|
|
7074
7262
|
onClick
|
|
7075
7263
|
}) {
|
|
7076
|
-
return /* @__PURE__ */
|
|
7264
|
+
return /* @__PURE__ */ jsx24(
|
|
7077
7265
|
"button",
|
|
7078
7266
|
{
|
|
7079
7267
|
type: "button",
|
|
@@ -7083,15 +7271,15 @@ function PagerButton({
|
|
|
7083
7271
|
if (!atEnd) onClick();
|
|
7084
7272
|
},
|
|
7085
7273
|
className: `flex h-6 w-6 items-center justify-center rounded-md border border-border text-xs text-muted-foreground transition ${atEnd ? "opacity-40" : "hover:bg-accent hover:text-foreground"}`,
|
|
7086
|
-
children: /* @__PURE__ */
|
|
7274
|
+
children: /* @__PURE__ */ jsx24("span", { "aria-hidden": "true", children: glyph })
|
|
7087
7275
|
}
|
|
7088
7276
|
);
|
|
7089
7277
|
}
|
|
7090
7278
|
|
|
7091
7279
|
// src/web-react/review-inbox.tsx
|
|
7092
|
-
import { useEffect as
|
|
7093
|
-
import { Button as
|
|
7094
|
-
import { Fragment as
|
|
7280
|
+
import { useEffect as useEffect18, useRef as useRef19, useState as useState25 } from "react";
|
|
7281
|
+
import { Button as Button6, PageHeader } from "@tangle-network/ui/primitives";
|
|
7282
|
+
import { Fragment as Fragment9, jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
7095
7283
|
var revisionKey = (item) => JSON.stringify([item.id, item.revision]);
|
|
7096
7284
|
function comparisonOrder(items, seed) {
|
|
7097
7285
|
const result = [...items].sort((a, b) => a.id < b.id ? -1 : a.id > b.id ? 1 : 0);
|
|
@@ -7108,20 +7296,20 @@ function ordered(items) {
|
|
|
7108
7296
|
return [...items].sort((left, right) => left.createdAt - right.createdAt || (left.id < right.id ? -1 : left.id > right.id ? 1 : 0));
|
|
7109
7297
|
}
|
|
7110
7298
|
function ReviewInbox({ items, initialSelectedId, renderItem, renderCompareBrief, onVerdict, resolveCurrentRevision, onFeedback, loading = false, error, onRefresh }) {
|
|
7111
|
-
const [round2, setRound] =
|
|
7112
|
-
const [answered, setAnswered] =
|
|
7113
|
-
const [resolvedElsewhere, setResolvedElsewhere] =
|
|
7114
|
-
const [activeId, setActiveId] =
|
|
7115
|
-
const [busy, setBusy] =
|
|
7116
|
-
const [refreshing, setRefreshing] =
|
|
7117
|
-
const [restart, setRestart] =
|
|
7118
|
-
const [refreshError, setRefreshError] =
|
|
7119
|
-
const cache =
|
|
7120
|
-
const comparisons =
|
|
7121
|
-
const drafts =
|
|
7122
|
-
const pending =
|
|
7123
|
-
const section =
|
|
7124
|
-
const form =
|
|
7299
|
+
const [round2, setRound] = useState25(() => ordered(items).map((item) => item.id));
|
|
7300
|
+
const [answered, setAnswered] = useState25(/* @__PURE__ */ new Set());
|
|
7301
|
+
const [resolvedElsewhere, setResolvedElsewhere] = useState25(/* @__PURE__ */ new Set());
|
|
7302
|
+
const [activeId, setActiveId] = useState25(() => items.some((item) => item.id === initialSelectedId) ? initialSelectedId : ordered(items)[0]?.id ?? null);
|
|
7303
|
+
const [busy, setBusy] = useState25(false);
|
|
7304
|
+
const [refreshing, setRefreshing] = useState25(false);
|
|
7305
|
+
const [restart, setRestart] = useState25(false);
|
|
7306
|
+
const [refreshError, setRefreshError] = useState25("");
|
|
7307
|
+
const cache = useRef19(/* @__PURE__ */ new Map());
|
|
7308
|
+
const comparisons = useRef19(/* @__PURE__ */ new Map());
|
|
7309
|
+
const drafts = useRef19(/* @__PURE__ */ new Map());
|
|
7310
|
+
const pending = useRef19(false);
|
|
7311
|
+
const section = useRef19(null);
|
|
7312
|
+
const form = useRef19(null);
|
|
7125
7313
|
for (const item of items) {
|
|
7126
7314
|
cache.current.set(item.id, item);
|
|
7127
7315
|
if (!comparisons.current.has(item.id)) comparisons.current.set(item.id, item.compare ? { ...item.compare } : void 0);
|
|
@@ -7153,7 +7341,7 @@ function ReviewInbox({ items, initialSelectedId, renderItem, renderCompareBrief,
|
|
|
7153
7341
|
position: compareItems.findIndex((cell) => cell.id === item.id),
|
|
7154
7342
|
itemIds: compareItems.map((cell) => cell.id)
|
|
7155
7343
|
} : void 0;
|
|
7156
|
-
|
|
7344
|
+
useEffect18(() => {
|
|
7157
7345
|
if (loading || !restart && (round2.length > 0 || items.length === 0)) return;
|
|
7158
7346
|
const next = ordered(items).map((item) => item.id);
|
|
7159
7347
|
comparisons.current = new Map(items.map((item) => [item.id, item.compare ? { ...item.compare } : void 0]));
|
|
@@ -7163,7 +7351,7 @@ function ReviewInbox({ items, initialSelectedId, renderItem, renderCompareBrief,
|
|
|
7163
7351
|
setResolvedElsewhere(/* @__PURE__ */ new Set());
|
|
7164
7352
|
setRestart(false);
|
|
7165
7353
|
}, [items, loading, restart, round2.length, initialSelectedId]);
|
|
7166
|
-
|
|
7354
|
+
useEffect18(() => {
|
|
7167
7355
|
if (loading || error || busy || refreshing) return;
|
|
7168
7356
|
const present = new Set(items.map((item) => item.id));
|
|
7169
7357
|
setResolvedElsewhere((previous) => {
|
|
@@ -7171,7 +7359,7 @@ function ReviewInbox({ items, initialSelectedId, renderItem, renderCompareBrief,
|
|
|
7171
7359
|
return next.size === previous.size && [...next].every((id) => previous.has(id)) ? previous : next;
|
|
7172
7360
|
});
|
|
7173
7361
|
}, [items, loading, error, busy, refreshing, round2]);
|
|
7174
|
-
|
|
7362
|
+
useEffect18(() => {
|
|
7175
7363
|
setActiveId(currentId ?? null);
|
|
7176
7364
|
if (!compare) section.current?.focus({ preventScroll: true });
|
|
7177
7365
|
}, [currentKey, !!compare]);
|
|
@@ -7231,7 +7419,7 @@ function ReviewInbox({ items, initialSelectedId, renderItem, renderCompareBrief,
|
|
|
7231
7419
|
setRefreshing(false);
|
|
7232
7420
|
}
|
|
7233
7421
|
}
|
|
7234
|
-
|
|
7422
|
+
useEffect18(() => {
|
|
7235
7423
|
function shortcut(event) {
|
|
7236
7424
|
if (event.defaultPrevented || event.repeat || event.altKey || event.ctrlKey || event.metaKey || event.isComposing) return;
|
|
7237
7425
|
const target = event.target instanceof Element ? event.target : null;
|
|
@@ -7260,7 +7448,7 @@ function ReviewInbox({ items, initialSelectedId, renderItem, renderCompareBrief,
|
|
|
7260
7448
|
window.addEventListener("keydown", shortcut);
|
|
7261
7449
|
return () => window.removeEventListener("keydown", shortcut);
|
|
7262
7450
|
});
|
|
7263
|
-
return /* @__PURE__ */
|
|
7451
|
+
return /* @__PURE__ */ jsxs23(
|
|
7264
7452
|
"section",
|
|
7265
7453
|
{
|
|
7266
7454
|
ref: section,
|
|
@@ -7270,44 +7458,44 @@ function ReviewInbox({ items, initialSelectedId, renderItem, renderCompareBrief,
|
|
|
7270
7458
|
className: `mx-auto min-w-0 space-y-5 outline-none ${compare ? "max-w-none" : "max-w-4xl"}`,
|
|
7271
7459
|
"data-review-inbox": true,
|
|
7272
7460
|
children: [
|
|
7273
|
-
/* @__PURE__ */
|
|
7461
|
+
/* @__PURE__ */ jsx25(
|
|
7274
7462
|
PageHeader,
|
|
7275
7463
|
{
|
|
7276
7464
|
title: "Review inbox",
|
|
7277
7465
|
description: "Review the oldest work first. Every decision includes your score and feedback.",
|
|
7278
|
-
actions: onRefresh && /* @__PURE__ */
|
|
7279
|
-
meta: /* @__PURE__ */
|
|
7466
|
+
actions: onRefresh && /* @__PURE__ */ jsx25(Button6, { variant: "outline", disabled: busy || refreshing || loading, onClick: () => void refresh(), children: refreshing ? "Refreshing\u2026" : "Refresh" }),
|
|
7467
|
+
meta: /* @__PURE__ */ jsx25("p", { role: "status", "data-review-progress": true, children: active ? `${compare ? reviewed : rank} of ${round2.length}${compare ? " resolved" : ""}` : `${reviewed} of ${round2.length} resolved` })
|
|
7280
7468
|
}
|
|
7281
7469
|
),
|
|
7282
|
-
(error || refreshError) && /* @__PURE__ */
|
|
7283
|
-
round2.length > 0 && /* @__PURE__ */
|
|
7284
|
-
(loading || error) && !active ? /* @__PURE__ */
|
|
7285
|
-
/* @__PURE__ */
|
|
7286
|
-
/* @__PURE__ */
|
|
7470
|
+
(error || refreshError) && /* @__PURE__ */ jsx25("p", { role: "alert", className: "text-sm text-[var(--surface-danger-text)]", children: error || refreshError }),
|
|
7471
|
+
round2.length > 0 && /* @__PURE__ */ jsx25("progress", { "aria-label": "Items resolved this round", value: reviewed, max: round2.length, className: "h-1.5 w-full accent-primary" }),
|
|
7472
|
+
(loading || error) && !active ? /* @__PURE__ */ jsx25("p", { role: "status", children: loading ? "Loading the review inbox\u2026" : "The review inbox could not load." }) : !active ? /* @__PURE__ */ jsxs23("div", { className: "py-12 text-center", children: [
|
|
7473
|
+
/* @__PURE__ */ jsx25("h2", { className: "text-xl font-semibold", children: "All caught up" }),
|
|
7474
|
+
/* @__PURE__ */ jsxs23("p", { className: "mt-2 text-sm text-muted-foreground", children: [
|
|
7287
7475
|
reviewed,
|
|
7288
7476
|
" of ",
|
|
7289
7477
|
round2.length,
|
|
7290
7478
|
" resolved this round."
|
|
7291
7479
|
] })
|
|
7292
|
-
] }) : /* @__PURE__ */
|
|
7293
|
-
/* @__PURE__ */
|
|
7294
|
-
/* @__PURE__ */
|
|
7295
|
-
!compare && /* @__PURE__ */
|
|
7296
|
-
/* @__PURE__ */
|
|
7480
|
+
] }) : /* @__PURE__ */ jsxs23(Fragment9, { children: [
|
|
7481
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [
|
|
7482
|
+
/* @__PURE__ */ jsxs23("div", { className: "min-w-0", children: [
|
|
7483
|
+
!compare && /* @__PURE__ */ jsx25("p", { className: "text-sm text-muted-foreground", children: active.kind }),
|
|
7484
|
+
/* @__PURE__ */ jsx25("h2", { className: "break-words text-lg font-semibold", "data-review-title": true, children: compare ? "Compare drafts" : active.title })
|
|
7297
7485
|
] }),
|
|
7298
|
-
/* @__PURE__ */
|
|
7299
|
-
/* @__PURE__ */
|
|
7300
|
-
/* @__PURE__ */
|
|
7486
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex gap-2", children: [
|
|
7487
|
+
/* @__PURE__ */ jsx25(Button6, { variant: "outline", "aria-keyshortcuts": "K", disabled: busy || unanswered.length < 2, onClick: () => navigate(-1), children: "Previous" }),
|
|
7488
|
+
/* @__PURE__ */ jsx25(Button6, { variant: "outline", "aria-keyshortcuts": "J", disabled: busy || unanswered.length < 2, onClick: () => navigate(1), children: "Next" })
|
|
7301
7489
|
] })
|
|
7302
7490
|
] }),
|
|
7303
|
-
compare ? /* @__PURE__ */
|
|
7304
|
-
renderCompareBrief && /* @__PURE__ */
|
|
7305
|
-
!compareValid && /* @__PURE__ */
|
|
7306
|
-
/* @__PURE__ */
|
|
7491
|
+
compare ? /* @__PURE__ */ jsxs23(Fragment9, { children: [
|
|
7492
|
+
renderCompareBrief && /* @__PURE__ */ jsx25("div", { "data-review-compare-brief": true, children: renderCompareBrief(compare.rowId) }),
|
|
7493
|
+
!compareValid && /* @__PURE__ */ jsx25("p", { role: "alert", children: "This comparison changed. Refresh the inbox before reviewing it." }),
|
|
7494
|
+
/* @__PURE__ */ jsx25("div", { className: "grid min-w-0 grid-cols-1 gap-4 lg:grid-cols-2 xl:grid-cols-3", "data-review-compare-row": true, children: compareItems.map((item, index) => {
|
|
7307
7495
|
const key = revisionKey(item);
|
|
7308
7496
|
const done = isAnswered(item);
|
|
7309
7497
|
const present = currentItems.has(item.id);
|
|
7310
|
-
return /* @__PURE__ */
|
|
7498
|
+
return /* @__PURE__ */ jsxs23(
|
|
7311
7499
|
"article",
|
|
7312
7500
|
{
|
|
7313
7501
|
"aria-label": `Draft ${index + 1}`,
|
|
@@ -7317,13 +7505,13 @@ function ReviewInbox({ items, initialSelectedId, renderItem, renderCompareBrief,
|
|
|
7317
7505
|
if (!done && present) setActiveId(item.id);
|
|
7318
7506
|
},
|
|
7319
7507
|
children: [
|
|
7320
|
-
/* @__PURE__ */
|
|
7508
|
+
/* @__PURE__ */ jsxs23("h3", { className: "text-lg font-semibold", children: [
|
|
7321
7509
|
"Draft ",
|
|
7322
7510
|
index + 1
|
|
7323
7511
|
] }),
|
|
7324
|
-
/* @__PURE__ */
|
|
7325
|
-
present && !done && !item.canReview && /* @__PURE__ */
|
|
7326
|
-
done ? /* @__PURE__ */
|
|
7512
|
+
/* @__PURE__ */ jsx25("div", { className: "min-w-0", "data-review-content": true, children: renderItem(item) }),
|
|
7513
|
+
present && !done && !item.canReview && /* @__PURE__ */ jsx25("p", { className: "text-sm text-muted-foreground", children: "You do not have permission to review this item." }),
|
|
7514
|
+
done ? /* @__PURE__ */ jsx25("p", { role: "status", children: "Review saved" }) : !present ? /* @__PURE__ */ jsx25("p", { role: "status", children: "This draft is no longer waiting." }) : /* @__PURE__ */ jsx25(
|
|
7327
7515
|
ReviewFeedbackForm,
|
|
7328
7516
|
{
|
|
7329
7517
|
draftKey: key,
|
|
@@ -7343,10 +7531,10 @@ function ReviewInbox({ items, initialSelectedId, renderItem, renderCompareBrief,
|
|
|
7343
7531
|
key
|
|
7344
7532
|
);
|
|
7345
7533
|
}) })
|
|
7346
|
-
] }) : /* @__PURE__ */
|
|
7347
|
-
available && !active.canReview && /* @__PURE__ */
|
|
7348
|
-
/* @__PURE__ */
|
|
7349
|
-
/* @__PURE__ */
|
|
7534
|
+
] }) : /* @__PURE__ */ jsxs23(Fragment9, { children: [
|
|
7535
|
+
available && !active.canReview && /* @__PURE__ */ jsx25("p", { className: "text-sm text-muted-foreground", children: "You do not have permission to review this item." }),
|
|
7536
|
+
/* @__PURE__ */ jsx25("div", { className: "min-w-0", "data-review-content": true, children: renderItem(active) }),
|
|
7537
|
+
/* @__PURE__ */ jsx25(
|
|
7350
7538
|
ReviewFeedbackForm,
|
|
7351
7539
|
{
|
|
7352
7540
|
ref: form,
|
|
@@ -7364,7 +7552,7 @@ function ReviewInbox({ items, initialSelectedId, renderItem, renderCompareBrief,
|
|
|
7364
7552
|
currentKey
|
|
7365
7553
|
)
|
|
7366
7554
|
] }),
|
|
7367
|
-
!compare && /* @__PURE__ */
|
|
7555
|
+
!compare && /* @__PURE__ */ jsx25("p", { className: "text-xs leading-5 text-muted-foreground", children: "A approve \xB7 R request changes \xB7 S score \xB7 J/K next/previous \xB7 Esc leave a field. Shortcuts pause while typing." })
|
|
7368
7556
|
] })
|
|
7369
7557
|
]
|
|
7370
7558
|
}
|
|
@@ -7386,48 +7574,48 @@ function formatTokensPerSecond(msg) {
|
|
|
7386
7574
|
}
|
|
7387
7575
|
|
|
7388
7576
|
// src/web-react/run-drill-in.tsx
|
|
7389
|
-
import { jsx as
|
|
7577
|
+
import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
7390
7578
|
function RunDrillIn({ run, onClose }) {
|
|
7391
|
-
return /* @__PURE__ */
|
|
7392
|
-
/* @__PURE__ */
|
|
7393
|
-
/* @__PURE__ */
|
|
7579
|
+
return /* @__PURE__ */ jsxs24("div", { className: `fixed inset-y-0 right-0 z-50 flex w-[480px] max-w-full flex-col border-l border-card-edge bg-popover ${OVERLAY_SHADOW}`, children: [
|
|
7580
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-2 border-b border-border px-4 py-3", children: [
|
|
7581
|
+
/* @__PURE__ */ jsx26(
|
|
7394
7582
|
"span",
|
|
7395
7583
|
{
|
|
7396
7584
|
className: `h-2 w-2 shrink-0 rounded-full ${run.status === "running" ? "bg-warning" : run.status === "error" ? "bg-destructive" : "bg-success"}`
|
|
7397
7585
|
}
|
|
7398
7586
|
),
|
|
7399
|
-
/* @__PURE__ */
|
|
7400
|
-
/* @__PURE__ */
|
|
7401
|
-
/* @__PURE__ */
|
|
7587
|
+
/* @__PURE__ */ jsxs24("div", { className: "min-w-0 flex-1", children: [
|
|
7588
|
+
/* @__PURE__ */ jsx26("p", { className: "truncate text-[15px] font-semibold", children: run.title }),
|
|
7589
|
+
/* @__PURE__ */ jsx26("p", { className: "truncate font-mono text-xs text-muted-foreground", children: run.toolName })
|
|
7402
7590
|
] }),
|
|
7403
|
-
/* @__PURE__ */
|
|
7591
|
+
/* @__PURE__ */ jsx26(
|
|
7404
7592
|
"button",
|
|
7405
7593
|
{
|
|
7406
7594
|
type: "button",
|
|
7407
7595
|
onClick: onClose,
|
|
7408
7596
|
"aria-label": "Close",
|
|
7409
7597
|
className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-accent hover:text-foreground",
|
|
7410
|
-
children: /* @__PURE__ */
|
|
7598
|
+
children: /* @__PURE__ */ jsx26("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx26("path", { d: "M18 6 6 18M6 6l12 12" }) })
|
|
7411
7599
|
}
|
|
7412
7600
|
)
|
|
7413
7601
|
] }),
|
|
7414
|
-
/* @__PURE__ */
|
|
7415
|
-
run.steps.length === 0 && /* @__PURE__ */
|
|
7416
|
-
run.steps.map((step, i) => /* @__PURE__ */
|
|
7417
|
-
/* @__PURE__ */
|
|
7418
|
-
/* @__PURE__ */
|
|
7419
|
-
/* @__PURE__ */
|
|
7420
|
-
/* @__PURE__ */
|
|
7602
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex-1 space-y-3 overflow-y-auto p-4", children: [
|
|
7603
|
+
run.steps.length === 0 && /* @__PURE__ */ jsx26("p", { className: "text-sm text-muted-foreground", children: "No steps recorded yet." }),
|
|
7604
|
+
run.steps.map((step, i) => /* @__PURE__ */ jsxs24("div", { className: "rounded-lg border border-card-edge bg-card", children: [
|
|
7605
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-baseline gap-2 border-b border-border px-3 py-1.5", children: [
|
|
7606
|
+
/* @__PURE__ */ jsx26("span", { className: `font-mono text-xs ${step.status === "error" ? "text-destructive" : "text-muted-foreground"}`, children: step.status === "error" ? "\u2717" : "$" }),
|
|
7607
|
+
/* @__PURE__ */ jsx26("code", { className: "min-w-0 flex-1 truncate font-mono text-xs", children: step.label }),
|
|
7608
|
+
/* @__PURE__ */ jsx26("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: new Date(step.at).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) })
|
|
7421
7609
|
] }),
|
|
7422
|
-
step.detail && /* @__PURE__ */
|
|
7610
|
+
step.detail && /* @__PURE__ */ jsx26("pre", { className: "max-h-48 overflow-auto whitespace-pre-wrap px-3 py-2 font-mono text-xs leading-relaxed text-muted-foreground", children: step.detail })
|
|
7423
7611
|
] }, i))
|
|
7424
7612
|
] }),
|
|
7425
|
-
/* @__PURE__ */
|
|
7613
|
+
/* @__PURE__ */ jsx26("p", { className: "border-t border-border px-4 py-2 text-xs text-muted-foreground", children: "Read-only transcript \u2014 reply in the main chat." })
|
|
7426
7614
|
] });
|
|
7427
7615
|
}
|
|
7428
7616
|
|
|
7429
7617
|
// src/web-react/chat-empty-state.tsx
|
|
7430
|
-
import { jsx as
|
|
7618
|
+
import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
7431
7619
|
function ChatEmptyState({
|
|
7432
7620
|
productName = "Agent",
|
|
7433
7621
|
headline = "Ask the agent to do something",
|
|
@@ -7436,23 +7624,23 @@ function ChatEmptyState({
|
|
|
7436
7624
|
}) {
|
|
7437
7625
|
const doorCount = Math.min(doors?.length ?? 0, 3);
|
|
7438
7626
|
const doorsGridClass = doorCount === 1 ? "mx-auto max-w-sm sm:grid-cols-1" : doorCount === 2 ? "sm:grid-cols-2" : "sm:grid-cols-3";
|
|
7439
|
-
return /* @__PURE__ */
|
|
7440
|
-
/* @__PURE__ */
|
|
7441
|
-
/* @__PURE__ */
|
|
7442
|
-
/* @__PURE__ */
|
|
7443
|
-
subline && /* @__PURE__ */
|
|
7444
|
-
doors && doors.length > 0 && /* @__PURE__ */
|
|
7627
|
+
return /* @__PURE__ */ jsxs25("div", { className: "mx-auto flex w-full max-w-2xl flex-col items-center px-6 py-12 text-center sm:py-20", children: [
|
|
7628
|
+
/* @__PURE__ */ jsx27("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__ */ jsx27(BrandMark, { size: 32, className: "shrink-0" }) }),
|
|
7629
|
+
/* @__PURE__ */ jsx27("p", { className: "text-xs font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: productName }),
|
|
7630
|
+
/* @__PURE__ */ jsx27("h2", { className: "mt-1.5 text-balance text-2xl font-semibold leading-tight text-foreground", children: headline }),
|
|
7631
|
+
subline && /* @__PURE__ */ jsx27("p", { className: "mt-3 max-w-md text-[15px] leading-relaxed text-muted-foreground", children: subline }),
|
|
7632
|
+
doors && doors.length > 0 && /* @__PURE__ */ jsx27("div", { className: `mt-7 grid w-full gap-2.5 ${doorsGridClass}`, children: doors.slice(0, 3).map((door, i) => /* @__PURE__ */ jsxs25(
|
|
7445
7633
|
"button",
|
|
7446
7634
|
{
|
|
7447
7635
|
type: "button",
|
|
7448
7636
|
onClick: door.onSelect,
|
|
7449
7637
|
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",
|
|
7450
7638
|
children: [
|
|
7451
|
-
/* @__PURE__ */
|
|
7639
|
+
/* @__PURE__ */ jsxs25("span", { className: "flex items-center gap-2 text-sm font-semibold text-foreground", children: [
|
|
7452
7640
|
door.icon,
|
|
7453
7641
|
door.label
|
|
7454
7642
|
] }),
|
|
7455
|
-
door.description && /* @__PURE__ */
|
|
7643
|
+
door.description && /* @__PURE__ */ jsx27("span", { className: "mt-0.5 text-[12px] leading-snug text-muted-foreground", children: door.description })
|
|
7456
7644
|
]
|
|
7457
7645
|
},
|
|
7458
7646
|
i
|
|
@@ -7461,10 +7649,10 @@ function ChatEmptyState({
|
|
|
7461
7649
|
}
|
|
7462
7650
|
|
|
7463
7651
|
// src/web-react/chat-tool-call.tsx
|
|
7464
|
-
import { useState as
|
|
7652
|
+
import { useState as useState26 } from "react";
|
|
7465
7653
|
import { TerminalDisplay, TerminalLine } from "@tangle-network/ui/primitives";
|
|
7466
7654
|
import { InlineToolItem } from "@tangle-network/ui/run";
|
|
7467
|
-
import { Fragment as
|
|
7655
|
+
import { Fragment as Fragment10, jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
7468
7656
|
function resolveToolPresentation(rendered) {
|
|
7469
7657
|
if (typeof rendered === "object" && rendered !== null) {
|
|
7470
7658
|
const presentation = rendered;
|
|
@@ -7479,26 +7667,26 @@ function pendingApprovalOf(call) {
|
|
|
7479
7667
|
}
|
|
7480
7668
|
function ToolGlyph({ name, className }) {
|
|
7481
7669
|
if (name.startsWith("sandbox_")) {
|
|
7482
|
-
return /* @__PURE__ */
|
|
7483
|
-
/* @__PURE__ */
|
|
7484
|
-
/* @__PURE__ */
|
|
7670
|
+
return /* @__PURE__ */ jsxs26("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
7671
|
+
/* @__PURE__ */ jsx28("polyline", { points: "4 17 10 11 4 5" }),
|
|
7672
|
+
/* @__PURE__ */ jsx28("line", { x1: "12", y1: "19", x2: "20", y2: "19" })
|
|
7485
7673
|
] });
|
|
7486
7674
|
}
|
|
7487
7675
|
if (name === "submit_proposal") {
|
|
7488
|
-
return /* @__PURE__ */
|
|
7489
|
-
/* @__PURE__ */
|
|
7490
|
-
/* @__PURE__ */
|
|
7676
|
+
return /* @__PURE__ */ jsxs26("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
7677
|
+
/* @__PURE__ */ jsx28("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
7678
|
+
/* @__PURE__ */ jsx28("path", { d: "M14 2v6h6M9 15l2 2 4-4" })
|
|
7491
7679
|
] });
|
|
7492
7680
|
}
|
|
7493
7681
|
if (name === "schedule_followup") {
|
|
7494
|
-
return /* @__PURE__ */
|
|
7495
|
-
/* @__PURE__ */
|
|
7496
|
-
/* @__PURE__ */
|
|
7682
|
+
return /* @__PURE__ */ jsxs26("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": true, children: [
|
|
7683
|
+
/* @__PURE__ */ jsx28("circle", { cx: "12", cy: "12", r: "9" }),
|
|
7684
|
+
/* @__PURE__ */ jsx28("path", { d: "M12 7v5l3 3" })
|
|
7497
7685
|
] });
|
|
7498
7686
|
}
|
|
7499
|
-
return /* @__PURE__ */
|
|
7500
|
-
/* @__PURE__ */
|
|
7501
|
-
/* @__PURE__ */
|
|
7687
|
+
return /* @__PURE__ */ jsxs26("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
7688
|
+
/* @__PURE__ */ jsx28("path", { d: "M12 3v3m0 12v3M3 12h3m12 0h3" }),
|
|
7689
|
+
/* @__PURE__ */ jsx28("circle", { cx: "12", cy: "12", r: "4" })
|
|
7502
7690
|
] });
|
|
7503
7691
|
}
|
|
7504
7692
|
function toolOutcomeOf(call) {
|
|
@@ -7584,37 +7772,37 @@ function truncate(v, max = 240) {
|
|
|
7584
7772
|
function KvRows({ data }) {
|
|
7585
7773
|
const entries = Object.entries(data).filter(([, v]) => v !== void 0 && v !== null && v !== "");
|
|
7586
7774
|
if (!entries.length) return null;
|
|
7587
|
-
return /* @__PURE__ */
|
|
7588
|
-
/* @__PURE__ */
|
|
7589
|
-
/* @__PURE__ */
|
|
7775
|
+
return /* @__PURE__ */ jsx28("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-1", children: entries.map(([k, v]) => /* @__PURE__ */ jsxs26("div", { className: "contents", children: [
|
|
7776
|
+
/* @__PURE__ */ jsx28("dt", { className: "font-mono text-xs text-muted-foreground", children: k }),
|
|
7777
|
+
/* @__PURE__ */ jsx28("dd", { className: "min-w-0 whitespace-pre-wrap break-words font-mono text-xs text-muted-foreground", children: truncate(v) })
|
|
7590
7778
|
] }, k)) });
|
|
7591
7779
|
}
|
|
7592
7780
|
function ShellDetail({ call }) {
|
|
7593
7781
|
const outcome = toolOutcomeOf(call);
|
|
7594
7782
|
const r = outcome?.result ?? {};
|
|
7595
|
-
return /* @__PURE__ */
|
|
7596
|
-
/* @__PURE__ */
|
|
7597
|
-
r.exitCode != null && /* @__PURE__ */
|
|
7783
|
+
return /* @__PURE__ */ jsxs26(TerminalDisplay, { showHeader: false, autoScroll: false, maxHeight: "14rem", className: "text-xs", children: [
|
|
7784
|
+
/* @__PURE__ */ jsx28(TerminalLine, { type: "command", children: String(call.args?.command ?? "") }),
|
|
7785
|
+
r.exitCode != null && /* @__PURE__ */ jsxs26(TerminalLine, { type: r.exitCode === 0 ? "success" : "error", children: [
|
|
7598
7786
|
"exit ",
|
|
7599
7787
|
r.exitCode
|
|
7600
7788
|
] }),
|
|
7601
|
-
/* @__PURE__ */
|
|
7789
|
+
/* @__PURE__ */ jsx28(TerminalLine, { type: outcome?.ok === false ? "error" : "output", children: outcome?.ok === false ? outcome.message ?? "failed" : [r.stdout, r.stderr].filter(Boolean).join("\n") || "(no output)" })
|
|
7602
7790
|
] });
|
|
7603
7791
|
}
|
|
7604
7792
|
function DefaultToolDetail({ call }) {
|
|
7605
7793
|
const result = call.result;
|
|
7606
7794
|
const envelope = typeof result === "object" && result !== null ? result : null;
|
|
7607
|
-
return /* @__PURE__ */
|
|
7608
|
-
call.args && Object.keys(call.args).length > 0 && /* @__PURE__ */
|
|
7609
|
-
/* @__PURE__ */
|
|
7610
|
-
/* @__PURE__ */
|
|
7795
|
+
return /* @__PURE__ */ jsxs26("div", { className: "space-y-2", children: [
|
|
7796
|
+
call.args && Object.keys(call.args).length > 0 && /* @__PURE__ */ jsxs26("div", { children: [
|
|
7797
|
+
/* @__PURE__ */ jsx28("p", { className: "mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Called with" }),
|
|
7798
|
+
/* @__PURE__ */ jsx28(KvRows, { data: call.args })
|
|
7611
7799
|
] }),
|
|
7612
|
-
envelope ? /* @__PURE__ */
|
|
7613
|
-
/* @__PURE__ */
|
|
7614
|
-
envelope.ok === false ? /* @__PURE__ */
|
|
7615
|
-
] }) : result != null ? /* @__PURE__ */
|
|
7616
|
-
/* @__PURE__ */
|
|
7617
|
-
/* @__PURE__ */
|
|
7800
|
+
envelope ? /* @__PURE__ */ jsxs26("div", { children: [
|
|
7801
|
+
/* @__PURE__ */ jsx28("p", { className: "mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: envelope.ok === false ? "Failed" : "Result" }),
|
|
7802
|
+
envelope.ok === false ? /* @__PURE__ */ jsx28("p", { className: "text-xs text-destructive", children: envelope.message ?? "Tool failed" }) : envelope.result && typeof envelope.result === "object" ? /* @__PURE__ */ jsx28(KvRows, { data: envelope.result }) : envelope.result != null ? /* @__PURE__ */ jsx28("p", { className: "font-mono text-xs text-muted-foreground", children: truncate(envelope.result) }) : null
|
|
7803
|
+
] }) : result != null ? /* @__PURE__ */ jsxs26("div", { children: [
|
|
7804
|
+
/* @__PURE__ */ jsx28("p", { className: "mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Result" }),
|
|
7805
|
+
/* @__PURE__ */ jsx28("p", { className: "font-mono text-xs text-muted-foreground", children: truncate(result) })
|
|
7618
7806
|
] }) : null
|
|
7619
7807
|
] });
|
|
7620
7808
|
}
|
|
@@ -7625,24 +7813,24 @@ function ProposalCard({
|
|
|
7625
7813
|
approval,
|
|
7626
7814
|
renderers
|
|
7627
7815
|
}) {
|
|
7628
|
-
const [expanded, setExpanded] =
|
|
7816
|
+
const [expanded, setExpanded] = useState26(false);
|
|
7629
7817
|
const { summary, meta, typeSlug } = proposalPreview(call);
|
|
7630
7818
|
const custom = resolveToolPresentation(renderers?.[call.name]?.(call, message)).detail;
|
|
7631
7819
|
const { pending: deciding, run: decide } = usePending();
|
|
7632
|
-
return /* @__PURE__ */
|
|
7633
|
-
/* @__PURE__ */
|
|
7634
|
-
/* @__PURE__ */
|
|
7635
|
-
/* @__PURE__ */
|
|
7636
|
-
/* @__PURE__ */
|
|
7637
|
-
/* @__PURE__ */
|
|
7638
|
-
summary && /* @__PURE__ */
|
|
7639
|
-
typeSlug && /* @__PURE__ */
|
|
7640
|
-
meta.length > 0 && /* @__PURE__ */
|
|
7820
|
+
return /* @__PURE__ */ jsxs26("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: [
|
|
7821
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex items-start gap-2.5 px-4 pt-3.5", children: [
|
|
7822
|
+
/* @__PURE__ */ jsx28("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__ */ jsx28(ToolGlyph, { name: call.name, className: "h-3.5 w-3.5" }) }),
|
|
7823
|
+
/* @__PURE__ */ jsxs26("div", { className: "min-w-0 flex-1", children: [
|
|
7824
|
+
/* @__PURE__ */ jsx28("p", { className: "text-xs font-semibold uppercase tracking-[0.05em] text-warning-strong", children: approval ? "Needs your approval" : "Awaiting approval" }),
|
|
7825
|
+
/* @__PURE__ */ jsx28("p", { className: "mt-0.5 text-[15px] font-semibold leading-snug text-foreground", children: friendlyToolTitle(call) }),
|
|
7826
|
+
summary && /* @__PURE__ */ jsx28("p", { className: "mt-1 text-xs leading-relaxed text-muted-foreground", children: summary }),
|
|
7827
|
+
typeSlug && /* @__PURE__ */ jsx28("p", { className: "mt-1 font-mono text-xs text-muted-foreground", children: typeSlug }),
|
|
7828
|
+
meta.length > 0 && /* @__PURE__ */ jsx28("div", { className: "mt-1.5 flex flex-wrap items-center gap-1.5", children: meta.map((m, i) => /* @__PURE__ */ jsx28("span", { className: "rounded-full bg-secondary px-2 py-0.5 text-xs font-medium text-muted-foreground", children: m }, i)) })
|
|
7641
7829
|
] })
|
|
7642
7830
|
] }),
|
|
7643
|
-
/* @__PURE__ */
|
|
7644
|
-
approval && /* @__PURE__ */
|
|
7645
|
-
/* @__PURE__ */
|
|
7831
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex flex-wrap items-center gap-2 px-4 pb-3.5 pt-3", children: [
|
|
7832
|
+
approval && /* @__PURE__ */ jsxs26(Fragment10, { children: [
|
|
7833
|
+
/* @__PURE__ */ jsx28(
|
|
7646
7834
|
"button",
|
|
7647
7835
|
{
|
|
7648
7836
|
type: "button",
|
|
@@ -7652,7 +7840,7 @@ function ProposalCard({
|
|
|
7652
7840
|
children: "Approve & run"
|
|
7653
7841
|
}
|
|
7654
7842
|
),
|
|
7655
|
-
/* @__PURE__ */
|
|
7843
|
+
/* @__PURE__ */ jsx28(
|
|
7656
7844
|
"button",
|
|
7657
7845
|
{
|
|
7658
7846
|
type: "button",
|
|
@@ -7663,7 +7851,7 @@ function ProposalCard({
|
|
|
7663
7851
|
}
|
|
7664
7852
|
)
|
|
7665
7853
|
] }),
|
|
7666
|
-
/* @__PURE__ */
|
|
7854
|
+
/* @__PURE__ */ jsxs26(
|
|
7667
7855
|
"button",
|
|
7668
7856
|
{
|
|
7669
7857
|
type: "button",
|
|
@@ -7672,12 +7860,12 @@ function ProposalCard({
|
|
|
7672
7860
|
className: "ml-auto inline-flex items-center gap-1 rounded text-[12px] font-medium text-muted-foreground transition hover:text-foreground",
|
|
7673
7861
|
children: [
|
|
7674
7862
|
expanded ? "Hide details" : "View details",
|
|
7675
|
-
/* @__PURE__ */
|
|
7863
|
+
/* @__PURE__ */ jsx28(ChevronDown, { className: `h-3 w-3 transition-transform ${expanded ? "rotate-180" : ""}` })
|
|
7676
7864
|
]
|
|
7677
7865
|
}
|
|
7678
7866
|
)
|
|
7679
7867
|
] }),
|
|
7680
|
-
expanded && /* @__PURE__ */
|
|
7868
|
+
expanded && /* @__PURE__ */ jsx28("div", { className: "border-t border-warning/20 px-4 py-3 text-xs", children: custom ?? /* @__PURE__ */ jsx28(DefaultToolDetail, { call }) })
|
|
7681
7869
|
] });
|
|
7682
7870
|
}
|
|
7683
7871
|
function formatFollowupWhen(when) {
|
|
@@ -7692,14 +7880,14 @@ function FollowupCard({ call }) {
|
|
|
7692
7880
|
const when = typeof a.when === "string" ? a.when : typeof a.at === "string" ? a.at : typeof a.schedule === "string" ? a.schedule : null;
|
|
7693
7881
|
const failed = toolCallFailed(call);
|
|
7694
7882
|
const errorText = failed ? toolOutcomeOf(call)?.message ?? "Scheduling failed" : null;
|
|
7695
|
-
return /* @__PURE__ */
|
|
7696
|
-
/* @__PURE__ */
|
|
7697
|
-
/* @__PURE__ */
|
|
7698
|
-
/* @__PURE__ */
|
|
7699
|
-
when && /* @__PURE__ */
|
|
7700
|
-
/* @__PURE__ */
|
|
7883
|
+
return /* @__PURE__ */ jsx28("div", { className: "flex items-start gap-2", children: /* @__PURE__ */ jsxs26("div", { className: "min-w-0 flex-1 overflow-hidden rounded-[var(--radius-lg)] border border-[var(--border-subtle)] bg-[var(--md3-surface-container)]", children: [
|
|
7884
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex w-full items-center gap-2.5 px-3 py-2", children: [
|
|
7885
|
+
/* @__PURE__ */ jsx28("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-[var(--radius-sm)] border border-border bg-muted text-muted-foreground", children: /* @__PURE__ */ jsx28(ToolGlyph, { name: call.name, className: "h-3.5 w-3.5" }) }),
|
|
7886
|
+
/* @__PURE__ */ jsx28("span", { className: "shrink-0 whitespace-nowrap text-xs font-medium text-foreground", children: friendlyToolTitle(call) }),
|
|
7887
|
+
when && /* @__PURE__ */ jsx28("span", { title: when, className: "hidden min-w-0 flex-1 truncate font-mono text-xs tabular-nums text-muted-foreground sm:inline", children: formatFollowupWhen(when) }),
|
|
7888
|
+
/* @__PURE__ */ jsx28("span", { className: "ml-auto flex shrink-0 items-center gap-1.5", children: call.status === "running" ? /* @__PURE__ */ jsx28("svg", { className: "h-3 w-3 shrink-0 animate-spin text-[var(--accent-text)]", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": true, children: /* @__PURE__ */ jsx28("path", { d: "M21 12a9 9 0 1 1-6.219-8.56", strokeLinecap: "round" }) }) : /* @__PURE__ */ jsx28("span", { className: `h-1.5 w-1.5 shrink-0 rounded-full ${failed ? "bg-[var(--surface-danger-text)]" : "bg-[var(--surface-success-text)]"}` }) })
|
|
7701
7889
|
] }),
|
|
7702
|
-
errorText && /* @__PURE__ */
|
|
7890
|
+
errorText && /* @__PURE__ */ jsx28("div", { className: "border-t border-border px-3 py-2 text-xs text-[var(--surface-danger-text)]", children: errorText })
|
|
7703
7891
|
] }) });
|
|
7704
7892
|
}
|
|
7705
7893
|
function toolRowTitle(call) {
|
|
@@ -7722,10 +7910,10 @@ function ToolCallCard({
|
|
|
7722
7910
|
const arrival = useArrivalStyle(staggerIndex ?? 0);
|
|
7723
7911
|
const pending = call.status === "done" ? pendingApprovalOf(call) : null;
|
|
7724
7912
|
const kind = blockKindOf(call);
|
|
7725
|
-
const arrive = (row) => /* @__PURE__ */
|
|
7913
|
+
const arrive = (row) => /* @__PURE__ */ jsx28("div", { className: "agent-arrive", style: arrival, children: row });
|
|
7726
7914
|
if (pending) {
|
|
7727
7915
|
return arrive(
|
|
7728
|
-
/* @__PURE__ */
|
|
7916
|
+
/* @__PURE__ */ jsx28(
|
|
7729
7917
|
ProposalCard,
|
|
7730
7918
|
{
|
|
7731
7919
|
call,
|
|
@@ -7738,18 +7926,18 @@ function ToolCallCard({
|
|
|
7738
7926
|
);
|
|
7739
7927
|
}
|
|
7740
7928
|
if (kind === "followup") {
|
|
7741
|
-
return arrive(/* @__PURE__ */
|
|
7929
|
+
return arrive(/* @__PURE__ */ jsx28(FollowupCard, { call }));
|
|
7742
7930
|
}
|
|
7743
7931
|
const custom = resolveToolPresentation(renderers?.[call.name]?.(call, message));
|
|
7744
7932
|
return arrive(
|
|
7745
|
-
/* @__PURE__ */
|
|
7933
|
+
/* @__PURE__ */ jsx28(
|
|
7746
7934
|
InlineToolItem,
|
|
7747
7935
|
{
|
|
7748
7936
|
part: chatToolCallPart(call),
|
|
7749
7937
|
title: custom.title ?? toolRowTitle(call),
|
|
7750
7938
|
description: custom.description ?? toolRowDescription(call),
|
|
7751
|
-
renderToolDetail: () => custom.detail ?? (call.name === "sandbox_run_command" ? /* @__PURE__ */
|
|
7752
|
-
actions: onOpenRun && call.name.startsWith("sandbox_") ? /* @__PURE__ */
|
|
7939
|
+
renderToolDetail: () => custom.detail ?? (call.name === "sandbox_run_command" ? /* @__PURE__ */ jsx28(ShellDetail, { call }) : /* @__PURE__ */ jsx28(DefaultToolDetail, { call })),
|
|
7940
|
+
actions: onOpenRun && call.name.startsWith("sandbox_") ? /* @__PURE__ */ jsx28(
|
|
7753
7941
|
"button",
|
|
7754
7942
|
{
|
|
7755
7943
|
type: "button",
|
|
@@ -7757,9 +7945,9 @@ function ToolCallCard({
|
|
|
7757
7945
|
"aria-label": "Open full transcript",
|
|
7758
7946
|
title: "Open full transcript",
|
|
7759
7947
|
className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-accent hover:text-foreground",
|
|
7760
|
-
children: /* @__PURE__ */
|
|
7761
|
-
/* @__PURE__ */
|
|
7762
|
-
/* @__PURE__ */
|
|
7948
|
+
children: /* @__PURE__ */ jsxs26("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: [
|
|
7949
|
+
/* @__PURE__ */ jsx28("path", { d: "M7 17 17 7" }),
|
|
7950
|
+
/* @__PURE__ */ jsx28("path", { d: "M7 7h10v10" })
|
|
7763
7951
|
] })
|
|
7764
7952
|
}
|
|
7765
7953
|
) : void 0
|
|
@@ -7769,14 +7957,14 @@ function ToolCallCard({
|
|
|
7769
7957
|
}
|
|
7770
7958
|
|
|
7771
7959
|
// src/web-react/chat-messages.tsx
|
|
7772
|
-
import { useEffect as
|
|
7960
|
+
import { useEffect as useEffect19, useMemo as useMemo11, useRef as useRef20, useState as useState27, memo } from "react";
|
|
7773
7961
|
import { isViewerMessage, MessageAuthor, partitionBySpeaker, SpeakerHeader, TRANSCRIPT_TEXT } from "@tangle-network/ui/chat";
|
|
7774
7962
|
|
|
7775
7963
|
// src/web-react/chat-message-body.tsx
|
|
7776
7964
|
import { useMemo as useMemo10 } from "react";
|
|
7777
|
-
import { jsx as
|
|
7965
|
+
import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
7778
7966
|
function StreamingCaret() {
|
|
7779
|
-
return /* @__PURE__ */
|
|
7967
|
+
return /* @__PURE__ */ jsx29(
|
|
7780
7968
|
"span",
|
|
7781
7969
|
{
|
|
7782
7970
|
className: "ml-0.5 inline-block h-[1.1em] w-[3px] translate-y-[2px] animate-[agent-caret_1s_step-end_infinite] rounded-sm bg-foreground/70",
|
|
@@ -7801,9 +7989,9 @@ function SegmentText({
|
|
|
7801
7989
|
// the container on top of that makes the paragraph shimmer while it types.
|
|
7802
7990
|
// The distinction is what separates "the answer materialised" from "the
|
|
7803
7991
|
// log was appended to".
|
|
7804
|
-
/* @__PURE__ */
|
|
7992
|
+
/* @__PURE__ */ jsxs27("div", { className: `${messageClassName}${streaming ? "" : " agent-stream-in"}`, children: [
|
|
7805
7993
|
body,
|
|
7806
|
-
showCaret && /* @__PURE__ */
|
|
7994
|
+
showCaret && /* @__PURE__ */ jsx29(StreamingCaret, {})
|
|
7807
7995
|
] })
|
|
7808
7996
|
);
|
|
7809
7997
|
}
|
|
@@ -7829,7 +8017,7 @@ function SegmentedBody({
|
|
|
7829
8017
|
const leftoverToolCalls = (msg.toolCalls ?? []).filter(
|
|
7830
8018
|
(tc) => !segmentToolIds.has(tc.id)
|
|
7831
8019
|
);
|
|
7832
|
-
const renderToolCard = (call, index) => /* @__PURE__ */
|
|
8020
|
+
const renderToolCard = (call, index) => /* @__PURE__ */ jsx29(
|
|
7833
8021
|
ToolCallCard,
|
|
7834
8022
|
{
|
|
7835
8023
|
call,
|
|
@@ -7858,12 +8046,12 @@ function SegmentedBody({
|
|
|
7858
8046
|
const children = [];
|
|
7859
8047
|
for (const g of groups) {
|
|
7860
8048
|
if (g.kind === "notice") {
|
|
7861
|
-
children.push(/* @__PURE__ */
|
|
8049
|
+
children.push(/* @__PURE__ */ jsx29(SegmentNotice, { tone: g.tone, content: g.content }, `notice-${g.index}`));
|
|
7862
8050
|
continue;
|
|
7863
8051
|
}
|
|
7864
8052
|
if (g.kind === "text") {
|
|
7865
8053
|
children.push(
|
|
7866
|
-
/* @__PURE__ */
|
|
8054
|
+
/* @__PURE__ */ jsx29(
|
|
7867
8055
|
SegmentText,
|
|
7868
8056
|
{
|
|
7869
8057
|
content: g.content,
|
|
@@ -7881,9 +8069,9 @@ function SegmentedBody({
|
|
|
7881
8069
|
const running = g.calls.filter((call) => call.status === "running");
|
|
7882
8070
|
const summary = running.length > 1 ? `Working \xB7 ${running.length} active steps` : running.length === 1 ? `Working \xB7 step ${g.calls.indexOf(running[0]) + 1}` : `Worked through ${g.calls.length} steps`;
|
|
7883
8071
|
children.push(
|
|
7884
|
-
/* @__PURE__ */
|
|
7885
|
-
/* @__PURE__ */
|
|
7886
|
-
/* @__PURE__ */
|
|
8072
|
+
/* @__PURE__ */ jsxs27("details", { children: [
|
|
8073
|
+
/* @__PURE__ */ jsx29("summary", { className: "cursor-pointer select-none rounded-md py-0.5 text-xs font-medium text-muted-foreground [transition:color_var(--motion-control)] hover:text-foreground", children: /* @__PURE__ */ jsx29("span", { "aria-live": "polite", children: summary }) }),
|
|
8074
|
+
/* @__PURE__ */ jsx29("div", { className: "mt-1.5 flex flex-col gap-1.5", children: g.calls.map(renderToolCard) })
|
|
7887
8075
|
] }, `tools-fold-${g.index}`)
|
|
7888
8076
|
);
|
|
7889
8077
|
continue;
|
|
@@ -7892,33 +8080,33 @@ function SegmentedBody({
|
|
|
7892
8080
|
}
|
|
7893
8081
|
leftoverToolCalls.forEach((call, index) => children.push(renderToolCard(call, index)));
|
|
7894
8082
|
if (showCaret && streaming && segments[lastIndex]?.kind === "tool") {
|
|
7895
|
-
children.push(/* @__PURE__ */
|
|
8083
|
+
children.push(/* @__PURE__ */ jsx29(StreamingCaret, {}, "streaming-caret"));
|
|
7896
8084
|
}
|
|
7897
|
-
return /* @__PURE__ */
|
|
8085
|
+
return /* @__PURE__ */ jsx29("div", { className: "flex flex-col gap-2", children });
|
|
7898
8086
|
}
|
|
7899
8087
|
var NOTICE_TONE_CLASS = {
|
|
7900
8088
|
error: "border-destructive/40 bg-destructive/5 text-destructive",
|
|
7901
8089
|
warning: "border-warning/40 bg-warning/10 text-warning-strong"
|
|
7902
8090
|
};
|
|
7903
8091
|
function SegmentNotice({ tone, content }) {
|
|
7904
|
-
return /* @__PURE__ */
|
|
8092
|
+
return /* @__PURE__ */ jsxs27(
|
|
7905
8093
|
"div",
|
|
7906
8094
|
{
|
|
7907
8095
|
"data-notice-tone": tone,
|
|
7908
8096
|
className: `flex items-start gap-2.5 rounded-lg border px-3 py-2.5 text-sm ${NOTICE_TONE_CLASS[tone]}`,
|
|
7909
8097
|
children: [
|
|
7910
|
-
/* @__PURE__ */
|
|
7911
|
-
/* @__PURE__ */
|
|
7912
|
-
/* @__PURE__ */
|
|
8098
|
+
/* @__PURE__ */ jsxs27("svg", { className: "mt-0.5 h-4 w-4 shrink-0", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
8099
|
+
/* @__PURE__ */ jsx29("circle", { cx: "12", cy: "12", r: "9" }),
|
|
8100
|
+
/* @__PURE__ */ jsx29("path", { d: "M12 8v4m0 4h.01" })
|
|
7913
8101
|
] }),
|
|
7914
|
-
/* @__PURE__ */
|
|
8102
|
+
/* @__PURE__ */ jsx29("span", { className: "min-w-0 flex-1 whitespace-pre-wrap break-words", children: content })
|
|
7915
8103
|
]
|
|
7916
8104
|
}
|
|
7917
8105
|
);
|
|
7918
8106
|
}
|
|
7919
8107
|
|
|
7920
8108
|
// src/web-react/chat-messages.tsx
|
|
7921
|
-
import { Fragment as
|
|
8109
|
+
import { Fragment as Fragment11, jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
7922
8110
|
function splitBySpeaker(rows) {
|
|
7923
8111
|
return rows.flatMap((row) => {
|
|
7924
8112
|
const sections = row.role === "assistant" && row.parts ? partitionBySpeaker(row.parts) : [];
|
|
@@ -7949,9 +8137,9 @@ function copyTextOf(msg) {
|
|
|
7949
8137
|
return msg.content;
|
|
7950
8138
|
}
|
|
7951
8139
|
function CopyMessageButton({ text }) {
|
|
7952
|
-
const [copied, setCopied] =
|
|
7953
|
-
const timerRef =
|
|
7954
|
-
|
|
8140
|
+
const [copied, setCopied] = useState27(false);
|
|
8141
|
+
const timerRef = useRef20(null);
|
|
8142
|
+
useEffect19(
|
|
7955
8143
|
() => () => {
|
|
7956
8144
|
if (timerRef.current !== null) clearTimeout(timerRef.current);
|
|
7957
8145
|
},
|
|
@@ -7970,7 +8158,7 @@ function CopyMessageButton({ text }) {
|
|
|
7970
8158
|
}
|
|
7971
8159
|
);
|
|
7972
8160
|
};
|
|
7973
|
-
return /* @__PURE__ */
|
|
8161
|
+
return /* @__PURE__ */ jsx30(
|
|
7974
8162
|
"button",
|
|
7975
8163
|
{
|
|
7976
8164
|
type: "button",
|
|
@@ -7978,9 +8166,9 @@ function CopyMessageButton({ text }) {
|
|
|
7978
8166
|
"aria-label": "Copy message",
|
|
7979
8167
|
title: "Copy message",
|
|
7980
8168
|
className: "rounded p-0.5 text-muted-foreground transition hover:bg-accent hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
7981
|
-
children: copied ? /* @__PURE__ */
|
|
7982
|
-
/* @__PURE__ */
|
|
7983
|
-
/* @__PURE__ */
|
|
8169
|
+
children: copied ? /* @__PURE__ */ jsx30("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__ */ jsx30("polyline", { points: "20 6 9 17 4 12" }) }) : /* @__PURE__ */ jsxs28("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: [
|
|
8170
|
+
/* @__PURE__ */ jsx30("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }),
|
|
8171
|
+
/* @__PURE__ */ jsx30("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
7984
8172
|
] })
|
|
7985
8173
|
}
|
|
7986
8174
|
);
|
|
@@ -8010,23 +8198,23 @@ function AssistantMessageImpl({
|
|
|
8010
8198
|
const answerScroll = useChatScroll();
|
|
8011
8199
|
const quiet = chrome === "quiet";
|
|
8012
8200
|
const authorClassName = quiet ? "mb-1.5" : void 0;
|
|
8013
|
-
const author = msg.speaker ? /* @__PURE__ */
|
|
8014
|
-
return /* @__PURE__ */
|
|
8201
|
+
const author = msg.speaker ? /* @__PURE__ */ jsx30(SpeakerHeader, { speaker: msg.speaker, live: streaming, className: authorClassName }) : msg.author ? /* @__PURE__ */ jsx30(MessageAuthor, { author: msg.author, className: authorClassName }) : null;
|
|
8202
|
+
return /* @__PURE__ */ jsxs28("div", { className: `mx-auto w-full max-w-3xl px-6 ${quiet ? "group pb-1 pt-3" : "py-3"}`, children: [
|
|
8015
8203
|
quiet && author,
|
|
8016
|
-
!quiet && /* @__PURE__ */
|
|
8204
|
+
!quiet && /* @__PURE__ */ jsxs28(
|
|
8017
8205
|
"div",
|
|
8018
8206
|
{
|
|
8019
8207
|
className: `mb-1 flex ${author ? "items-center" : "items-baseline"} gap-2 text-xs tabular-nums text-muted-foreground`,
|
|
8020
8208
|
children: [
|
|
8021
|
-
author ?? /* @__PURE__ */
|
|
8022
|
-
msg.modelUsed && /* @__PURE__ */
|
|
8023
|
-
formatTokensPerSecond(msg) && /* @__PURE__ */
|
|
8024
|
-
formatModelCost(msg, models) && /* @__PURE__ */
|
|
8209
|
+
author ?? /* @__PURE__ */ jsx30("span", { className: "font-semibold uppercase tracking-[0.05em]", children: agentLabel }),
|
|
8210
|
+
msg.modelUsed && /* @__PURE__ */ jsx30("span", { className: "font-mono normal-case", children: msg.modelUsed }),
|
|
8211
|
+
formatTokensPerSecond(msg) && /* @__PURE__ */ jsx30("span", { children: formatTokensPerSecond(msg) }),
|
|
8212
|
+
formatModelCost(msg, models) && /* @__PURE__ */ jsx30("span", { children: formatModelCost(msg, models) })
|
|
8025
8213
|
]
|
|
8026
8214
|
}
|
|
8027
8215
|
),
|
|
8028
|
-
/* @__PURE__ */
|
|
8029
|
-
/* @__PURE__ */
|
|
8216
|
+
/* @__PURE__ */ jsx30("div", { ref: msg.speaker ? answerScroll.viewportRef : void 0, className: msg.speaker ? "agent-speaker-answer" : void 0, tabIndex: msg.speaker ? 0 : void 0, role: msg.speaker ? "region" : void 0, "aria-label": msg.speaker ? `Answer from ${msg.speaker.name}` : void 0, children: /* @__PURE__ */ jsxs28("div", { ref: msg.speaker ? answerScroll.contentRef : void 0, children: [
|
|
8217
|
+
/* @__PURE__ */ jsx30(
|
|
8030
8218
|
ReasoningRow,
|
|
8031
8219
|
{
|
|
8032
8220
|
className: "mb-2",
|
|
@@ -8036,7 +8224,7 @@ function AssistantMessageImpl({
|
|
|
8036
8224
|
thinking: streaming && !hasAnswerText && msg.reasoningEndedAt === void 0
|
|
8037
8225
|
}
|
|
8038
8226
|
),
|
|
8039
|
-
segments && segments.length > 0 ? /* @__PURE__ */
|
|
8227
|
+
segments && segments.length > 0 ? /* @__PURE__ */ jsx30(
|
|
8040
8228
|
SegmentedBody,
|
|
8041
8229
|
{
|
|
8042
8230
|
segments,
|
|
@@ -8049,12 +8237,12 @@ function AssistantMessageImpl({
|
|
|
8049
8237
|
toolRenderers,
|
|
8050
8238
|
messageClassName
|
|
8051
8239
|
}
|
|
8052
|
-
) : /* @__PURE__ */
|
|
8053
|
-
/* @__PURE__ */
|
|
8240
|
+
) : /* @__PURE__ */ jsxs28(Fragment11, { children: [
|
|
8241
|
+
/* @__PURE__ */ jsxs28("div", { className: messageClassName, children: [
|
|
8054
8242
|
body,
|
|
8055
|
-
!msg.speaker && streaming && content && !msg.toolCalls?.length && /* @__PURE__ */
|
|
8243
|
+
!msg.speaker && streaming && content && !msg.toolCalls?.length && /* @__PURE__ */ jsx30(StreamingCaret, {})
|
|
8056
8244
|
] }),
|
|
8057
|
-
msg.toolCalls && msg.toolCalls.length > 0 && /* @__PURE__ */
|
|
8245
|
+
msg.toolCalls && msg.toolCalls.length > 0 && /* @__PURE__ */ jsx30("div", { className: "mt-2 flex flex-col gap-1.5", children: msg.toolCalls.map((tc, index) => /* @__PURE__ */ jsx30(
|
|
8058
8246
|
ToolCallCard,
|
|
8059
8247
|
{
|
|
8060
8248
|
call: tc,
|
|
@@ -8067,7 +8255,7 @@ function AssistantMessageImpl({
|
|
|
8067
8255
|
tc.id
|
|
8068
8256
|
)) })
|
|
8069
8257
|
] }),
|
|
8070
|
-
durableCards && msg.parts && /* @__PURE__ */
|
|
8258
|
+
durableCards && msg.parts && /* @__PURE__ */ jsx30(
|
|
8071
8259
|
DurableChatCards,
|
|
8072
8260
|
{
|
|
8073
8261
|
...durableCards,
|
|
@@ -8076,7 +8264,7 @@ function AssistantMessageImpl({
|
|
|
8076
8264
|
className: "mt-3"
|
|
8077
8265
|
}
|
|
8078
8266
|
),
|
|
8079
|
-
workProductCards && workProductPartsFromMessageParts(msg.parts).map((part) => /* @__PURE__ */
|
|
8267
|
+
workProductCards && workProductPartsFromMessageParts(msg.parts).map((part) => /* @__PURE__ */ jsx30(
|
|
8080
8268
|
WorkProductCard,
|
|
8081
8269
|
{
|
|
8082
8270
|
part,
|
|
@@ -8086,7 +8274,7 @@ function AssistantMessageImpl({
|
|
|
8086
8274
|
`${part.ref.id}:${part.ref.version}`
|
|
8087
8275
|
)),
|
|
8088
8276
|
renderExtras?.(msg),
|
|
8089
|
-
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */
|
|
8277
|
+
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */ jsx30("div", { className: "mt-2", children: /* @__PURE__ */ jsx30(
|
|
8090
8278
|
MessageAttachments,
|
|
8091
8279
|
{
|
|
8092
8280
|
parts: attachmentPartsFromMessageParts(msg.parts),
|
|
@@ -8095,39 +8283,39 @@ function AssistantMessageImpl({
|
|
|
8095
8283
|
}
|
|
8096
8284
|
) })
|
|
8097
8285
|
] }) }),
|
|
8098
|
-
quiet && /* @__PURE__ */
|
|
8099
|
-
/* @__PURE__ */
|
|
8100
|
-
msg.modelUsed && /* @__PURE__ */
|
|
8101
|
-
formatTokensPerSecond(msg) && /* @__PURE__ */
|
|
8102
|
-
formatModelCost(msg, models) && /* @__PURE__ */
|
|
8286
|
+
quiet && /* @__PURE__ */ jsxs28("div", { "data-testid": "message-meta-lane", className: QUIET_META_LANE_CLASS, children: [
|
|
8287
|
+
/* @__PURE__ */ jsx30(CopyMessageButton, { text: copyTextOf(msg) }),
|
|
8288
|
+
msg.modelUsed && /* @__PURE__ */ jsx30("span", { className: "font-mono", children: msg.modelUsed }),
|
|
8289
|
+
formatTokensPerSecond(msg) && /* @__PURE__ */ jsx30("span", { children: formatTokensPerSecond(msg) }),
|
|
8290
|
+
formatModelCost(msg, models) && /* @__PURE__ */ jsx30("span", { children: formatModelCost(msg, models) })
|
|
8103
8291
|
] })
|
|
8104
8292
|
] });
|
|
8105
8293
|
}
|
|
8106
8294
|
var AssistantMessage = memo(AssistantMessageImpl);
|
|
8107
8295
|
function useThinkingSeconds(active) {
|
|
8108
|
-
const [
|
|
8109
|
-
|
|
8296
|
+
const [seconds2, setSeconds] = useState27(0);
|
|
8297
|
+
useEffect19(() => {
|
|
8110
8298
|
if (!active) return;
|
|
8111
8299
|
setSeconds(0);
|
|
8112
8300
|
const id = setInterval(() => setSeconds((s) => s + 1), 1e3);
|
|
8113
8301
|
return () => clearInterval(id);
|
|
8114
8302
|
}, [active]);
|
|
8115
|
-
return
|
|
8303
|
+
return seconds2;
|
|
8116
8304
|
}
|
|
8117
8305
|
function ThinkingRow({ agentLabel, chrome = "labeled", phase }) {
|
|
8118
|
-
return /* @__PURE__ */
|
|
8119
|
-
chrome !== "quiet" && /* @__PURE__ */
|
|
8120
|
-
/* @__PURE__ */
|
|
8306
|
+
return /* @__PURE__ */ jsxs28("div", { className: "mx-auto w-full max-w-3xl px-6 py-3", children: [
|
|
8307
|
+
chrome !== "quiet" && /* @__PURE__ */ jsx30("p", { className: "mb-1 text-xs font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: agentLabel }),
|
|
8308
|
+
/* @__PURE__ */ jsx30(TurnProgress, { phase, pendingMessage: "Thinking\u2026", className: "text-[15px]" })
|
|
8121
8309
|
] });
|
|
8122
8310
|
}
|
|
8123
8311
|
function StreamErrorRow({ message, onRetry }) {
|
|
8124
|
-
return /* @__PURE__ */
|
|
8125
|
-
/* @__PURE__ */
|
|
8126
|
-
/* @__PURE__ */
|
|
8127
|
-
/* @__PURE__ */
|
|
8312
|
+
return /* @__PURE__ */ jsx30("div", { className: "mx-auto w-full max-w-3xl px-6 py-3", children: /* @__PURE__ */ jsxs28("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: [
|
|
8313
|
+
/* @__PURE__ */ jsxs28("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: [
|
|
8314
|
+
/* @__PURE__ */ jsx30("circle", { cx: "12", cy: "12", r: "9" }),
|
|
8315
|
+
/* @__PURE__ */ jsx30("path", { d: "M12 8v4m0 4h.01" })
|
|
8128
8316
|
] }),
|
|
8129
|
-
/* @__PURE__ */
|
|
8130
|
-
onRetry && /* @__PURE__ */
|
|
8317
|
+
/* @__PURE__ */ jsx30("span", { className: "min-w-0 flex-1 break-words", children: message }),
|
|
8318
|
+
onRetry && /* @__PURE__ */ jsx30(
|
|
8131
8319
|
"button",
|
|
8132
8320
|
{
|
|
8133
8321
|
type: "button",
|
|
@@ -8146,22 +8334,22 @@ function OtherPersonMessage({
|
|
|
8146
8334
|
resolveAttachmentUrl
|
|
8147
8335
|
}) {
|
|
8148
8336
|
const attachments = resolveAttachmentUrl ? attachmentPartsFromMessageParts(msg.parts) : [];
|
|
8149
|
-
return /* @__PURE__ */
|
|
8150
|
-
/* @__PURE__ */
|
|
8151
|
-
/* @__PURE__ */
|
|
8152
|
-
/* @__PURE__ */
|
|
8337
|
+
return /* @__PURE__ */ jsxs28("div", { className: `mx-auto w-full max-w-3xl px-6 ${quiet ? "group pb-1 pt-3" : "py-3"}`, children: [
|
|
8338
|
+
/* @__PURE__ */ jsxs28("div", { className: `w-fit ${quiet ? "max-w-[72%]" : "max-w-[85%]"}`, children: [
|
|
8339
|
+
/* @__PURE__ */ jsx30(MessageAuthor, { author, className: "mb-1.5" }),
|
|
8340
|
+
/* @__PURE__ */ jsx30(
|
|
8153
8341
|
"div",
|
|
8154
8342
|
{
|
|
8155
8343
|
className: `w-fit max-w-full rounded-2xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] px-4 py-2.5 text-[hsl(var(--foreground))] ${quiet ? "" : "rounded-tl-md "}${messageClassName}`,
|
|
8156
|
-
children: /* @__PURE__ */
|
|
8344
|
+
children: /* @__PURE__ */ jsx30("p", { className: "whitespace-pre-wrap", children: msg.content })
|
|
8157
8345
|
}
|
|
8158
8346
|
),
|
|
8159
|
-
resolveAttachmentUrl && attachments.length > 0 && /* @__PURE__ */
|
|
8347
|
+
resolveAttachmentUrl && attachments.length > 0 && /* @__PURE__ */ jsx30("div", { className: "mt-1.5", children: /* @__PURE__ */ jsx30(MessageAttachments, { parts: attachments, resolveFileUrl: resolveAttachmentUrl, justify: "start" }) })
|
|
8160
8348
|
] }),
|
|
8161
|
-
quiet && /* @__PURE__ */
|
|
8349
|
+
quiet && /* @__PURE__ */ jsx30("div", { "data-testid": "message-meta-lane", className: `${QUIET_META_LANE_CLASS} justify-start`, children: /* @__PURE__ */ jsx30(CopyMessageButton, { text: msg.content }) })
|
|
8162
8350
|
] });
|
|
8163
8351
|
}
|
|
8164
|
-
var renderPlainBody = (content) => /* @__PURE__ */
|
|
8352
|
+
var renderPlainBody = (content) => /* @__PURE__ */ jsx30("p", { className: "whitespace-pre-wrap", children: content });
|
|
8165
8353
|
function ChatMessages({
|
|
8166
8354
|
messages: storedMessages,
|
|
8167
8355
|
messageSize = "default",
|
|
@@ -8194,16 +8382,16 @@ function ChatMessages({
|
|
|
8194
8382
|
const lastIsUser = messages[messages.length - 1]?.role === "user";
|
|
8195
8383
|
const quiet = chrome === "quiet";
|
|
8196
8384
|
if (messages.length === 0 && !loading && !error) {
|
|
8197
|
-
const empty = renderEmpty ? renderEmpty() : /* @__PURE__ */
|
|
8198
|
-
return /* @__PURE__ */
|
|
8385
|
+
const empty = renderEmpty ? renderEmpty() : /* @__PURE__ */ jsx30(ChatEmptyState, { ...emptyState });
|
|
8386
|
+
return /* @__PURE__ */ jsxs28(Fragment11, { children: [
|
|
8199
8387
|
header,
|
|
8200
8388
|
empty
|
|
8201
8389
|
] });
|
|
8202
8390
|
}
|
|
8203
|
-
return /* @__PURE__ */
|
|
8391
|
+
return /* @__PURE__ */ jsxs28(Fragment11, { children: [
|
|
8204
8392
|
header,
|
|
8205
8393
|
messages.map(
|
|
8206
|
-
(msg) => msg.role === "user" && msg.author && !isViewerMessage(msg.author, viewerId) ? /* @__PURE__ */
|
|
8394
|
+
(msg) => msg.role === "user" && msg.author && !isViewerMessage(msg.author, viewerId) ? /* @__PURE__ */ jsx30(
|
|
8207
8395
|
OtherPersonMessage,
|
|
8208
8396
|
{
|
|
8209
8397
|
msg,
|
|
@@ -8213,17 +8401,17 @@ function ChatMessages({
|
|
|
8213
8401
|
resolveAttachmentUrl
|
|
8214
8402
|
},
|
|
8215
8403
|
msg.id
|
|
8216
|
-
) : msg.role === "user" ? /* @__PURE__ */
|
|
8217
|
-
/* @__PURE__ */
|
|
8218
|
-
!quiet && /* @__PURE__ */
|
|
8219
|
-
/* @__PURE__ */
|
|
8404
|
+
) : msg.role === "user" ? /* @__PURE__ */ jsxs28("div", { className: `mx-auto w-full max-w-3xl px-6 ${quiet ? "group pb-1 pt-3" : "py-3"}`, children: [
|
|
8405
|
+
/* @__PURE__ */ jsxs28("div", { className: `ml-auto w-fit ${quiet ? "max-w-[72%]" : "max-w-[85%]"}`, children: [
|
|
8406
|
+
!quiet && /* @__PURE__ */ jsx30("p", { className: "mb-1 text-right text-xs font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: userLabel }),
|
|
8407
|
+
/* @__PURE__ */ jsx30(
|
|
8220
8408
|
"div",
|
|
8221
8409
|
{
|
|
8222
8410
|
className: `rounded-2xl bg-[hsl(var(--foreground))] px-4 py-2.5 text-[hsl(var(--background))] ${quiet ? "" : "rounded-tr-md "}${messageClassName}`,
|
|
8223
|
-
children: /* @__PURE__ */
|
|
8411
|
+
children: /* @__PURE__ */ jsx30("p", { className: "whitespace-pre-wrap", children: msg.content })
|
|
8224
8412
|
}
|
|
8225
8413
|
),
|
|
8226
|
-
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */
|
|
8414
|
+
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */ jsx30("div", { className: "mt-1.5", children: /* @__PURE__ */ jsx30(
|
|
8227
8415
|
MessageAttachments,
|
|
8228
8416
|
{
|
|
8229
8417
|
parts: attachmentPartsFromMessageParts(msg.parts),
|
|
@@ -8232,8 +8420,8 @@ function ChatMessages({
|
|
|
8232
8420
|
}
|
|
8233
8421
|
) })
|
|
8234
8422
|
] }),
|
|
8235
|
-
quiet && /* @__PURE__ */
|
|
8236
|
-
] }, msg.id) : /* @__PURE__ */
|
|
8423
|
+
quiet && /* @__PURE__ */ jsx30("div", { "data-testid": "message-meta-lane", className: `${QUIET_META_LANE_CLASS} justify-end`, children: /* @__PURE__ */ jsx30(CopyMessageButton, { text: msg.content }) })
|
|
8424
|
+
] }, msg.id) : /* @__PURE__ */ jsx30(
|
|
8237
8425
|
AssistantMessage,
|
|
8238
8426
|
{
|
|
8239
8427
|
msg,
|
|
@@ -8254,15 +8442,15 @@ function ChatMessages({
|
|
|
8254
8442
|
msg.id
|
|
8255
8443
|
)
|
|
8256
8444
|
),
|
|
8257
|
-
loading && lastIsUser && /* @__PURE__ */
|
|
8258
|
-
error && !loading && /* @__PURE__ */
|
|
8445
|
+
loading && lastIsUser && /* @__PURE__ */ jsx30(ThinkingRow, { agentLabel, chrome, phase: turnPhase }),
|
|
8446
|
+
error && !loading && /* @__PURE__ */ jsx30(StreamErrorRow, { message: error, onRetry })
|
|
8259
8447
|
] });
|
|
8260
8448
|
}
|
|
8261
8449
|
|
|
8262
8450
|
// src/web-react/api-access-panel.tsx
|
|
8263
|
-
import { useEffect as
|
|
8264
|
-
import { Button as
|
|
8265
|
-
import { jsx as
|
|
8451
|
+
import { useEffect as useEffect20, useRef as useRef21, useState as useState28 } from "react";
|
|
8452
|
+
import { Button as Button7, Input as Input3, PageHeader as PageHeader2 } from "@tangle-network/ui/primitives";
|
|
8453
|
+
import { jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
8266
8454
|
var defaultExpiryChoices = [1, 7, 30];
|
|
8267
8455
|
function pruneScopes(scopes, access) {
|
|
8268
8456
|
const offered = new Map(access.map((option) => [option.scope, option]));
|
|
@@ -8328,31 +8516,31 @@ function ApiAccessPanel({
|
|
|
8328
8516
|
onRevoke = revokeKeyViaApi,
|
|
8329
8517
|
onChanged
|
|
8330
8518
|
}) {
|
|
8331
|
-
const [name, setName] =
|
|
8332
|
-
const [reach, setReach] =
|
|
8519
|
+
const [name, setName] = useState28("");
|
|
8520
|
+
const [reach, setReach] = useState28("");
|
|
8333
8521
|
const selectedWorkspace = workspaces?.some((workspace) => workspace.id === reach) ? reach : "";
|
|
8334
8522
|
const workspaceName = (id) => workspaces?.find((workspace) => workspace.id === id)?.name ?? `A removed ${workspaceNoun.singular}`;
|
|
8335
8523
|
const allowedDays = [...new Set(expiryDays)].filter((days2) => days2 > 0 && Number.isFinite(new Date(Date.now() + days2 * 864e5).getTime()));
|
|
8336
8524
|
const fallbackDays = allowedDays.includes(defaultExpiryDays) ? defaultExpiryDays : allowedDays[0];
|
|
8337
|
-
const [days, setDays] =
|
|
8525
|
+
const [days, setDays] = useState28(fallbackDays);
|
|
8338
8526
|
const selectedDays = days !== void 0 && allowedDays.includes(days) ? days : fallbackDays;
|
|
8339
|
-
const [scopes, setScopes] =
|
|
8340
|
-
const [creating, setCreating] =
|
|
8341
|
-
const [revoking, setRevoking] =
|
|
8342
|
-
const [created, setCreated] =
|
|
8343
|
-
const [notice, setNotice] =
|
|
8344
|
-
const [error, setError] =
|
|
8345
|
-
const keyHeading =
|
|
8346
|
-
const nameInput =
|
|
8347
|
-
const keyWasShown =
|
|
8527
|
+
const [scopes, setScopes] = useState28(() => expandScopes(defaultScopes, access));
|
|
8528
|
+
const [creating, setCreating] = useState28(false);
|
|
8529
|
+
const [revoking, setRevoking] = useState28(null);
|
|
8530
|
+
const [created, setCreated] = useState28(null);
|
|
8531
|
+
const [notice, setNotice] = useState28(null);
|
|
8532
|
+
const [error, setError] = useState28(null);
|
|
8533
|
+
const keyHeading = useRef21(null);
|
|
8534
|
+
const nameInput = useRef21(null);
|
|
8535
|
+
const keyWasShown = useRef21(false);
|
|
8348
8536
|
const selectedScopes = pruneScopes(scopes, access);
|
|
8349
|
-
|
|
8537
|
+
useEffect20(() => {
|
|
8350
8538
|
setScopes((current) => {
|
|
8351
8539
|
const next = pruneScopes(current, access);
|
|
8352
8540
|
return next.length === current.length ? current : next;
|
|
8353
8541
|
});
|
|
8354
8542
|
}, [access]);
|
|
8355
|
-
|
|
8543
|
+
useEffect20(() => {
|
|
8356
8544
|
if (created) {
|
|
8357
8545
|
keyHeading.current?.focus();
|
|
8358
8546
|
keyWasShown.current = true;
|
|
@@ -8398,10 +8586,10 @@ function ApiAccessPanel({
|
|
|
8398
8586
|
setRevoking(null);
|
|
8399
8587
|
}
|
|
8400
8588
|
}
|
|
8401
|
-
return /* @__PURE__ */
|
|
8402
|
-
/* @__PURE__ */
|
|
8403
|
-
accountHref && /* @__PURE__ */
|
|
8404
|
-
/* @__PURE__ */
|
|
8589
|
+
return /* @__PURE__ */ jsx31("main", { className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ jsxs29("div", { className: "mx-auto max-w-2xl space-y-8 px-4 py-8 sm:px-8", children: [
|
|
8590
|
+
/* @__PURE__ */ jsxs29("div", { className: "space-y-2", children: [
|
|
8591
|
+
accountHref && /* @__PURE__ */ jsx31("a", { href: accountHref, className: "text-sm text-muted-foreground hover:text-foreground", children: "Account" }),
|
|
8592
|
+
/* @__PURE__ */ jsx31(
|
|
8405
8593
|
PageHeader2,
|
|
8406
8594
|
{
|
|
8407
8595
|
className: "mb-0",
|
|
@@ -8410,14 +8598,14 @@ function ApiAccessPanel({
|
|
|
8410
8598
|
}
|
|
8411
8599
|
)
|
|
8412
8600
|
] }),
|
|
8413
|
-
error && /* @__PURE__ */
|
|
8414
|
-
notice && /* @__PURE__ */
|
|
8415
|
-
created ? /* @__PURE__ */
|
|
8416
|
-
/* @__PURE__ */
|
|
8417
|
-
/* @__PURE__ */
|
|
8418
|
-
/* @__PURE__ */
|
|
8419
|
-
/* @__PURE__ */
|
|
8420
|
-
/* @__PURE__ */
|
|
8601
|
+
error && /* @__PURE__ */ jsx31("p", { role: "alert", className: "rounded-lg border border-destructive/40 p-3 text-sm text-destructive", children: error }),
|
|
8602
|
+
notice && /* @__PURE__ */ jsx31("p", { role: "status", className: "text-sm text-muted-foreground", children: notice }),
|
|
8603
|
+
created ? /* @__PURE__ */ jsxs29("section", { "aria-labelledby": "save-api-key", className: "space-y-4 rounded-xl border border-border bg-card p-5", children: [
|
|
8604
|
+
/* @__PURE__ */ jsx31("h2", { ref: keyHeading, tabIndex: -1, id: "save-api-key", className: "font-medium outline-none", children: "Save your key" }),
|
|
8605
|
+
/* @__PURE__ */ jsx31("p", { className: "text-sm text-muted-foreground", children: "Copy it directly into your client\u2019s secret storage. It is shown only now. Keep it out of chat messages and prompts." }),
|
|
8606
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex gap-2", children: [
|
|
8607
|
+
/* @__PURE__ */ jsx31(Input3, { size: "lg", "aria-label": "New API key", type: "password", value: created.key, readOnly: true, autoComplete: "off", className: "min-w-0 font-mono" }),
|
|
8608
|
+
/* @__PURE__ */ jsx31(Button7, { onClick: async () => {
|
|
8421
8609
|
try {
|
|
8422
8610
|
await navigator.clipboard.writeText(created.key);
|
|
8423
8611
|
setNotice("Key copied");
|
|
@@ -8426,46 +8614,46 @@ function ApiAccessPanel({
|
|
|
8426
8614
|
}
|
|
8427
8615
|
}, children: "Copy key" })
|
|
8428
8616
|
] }),
|
|
8429
|
-
/* @__PURE__ */
|
|
8617
|
+
/* @__PURE__ */ jsx31(Button7, { variant: "outline", onClick: () => {
|
|
8430
8618
|
setCreated(null);
|
|
8431
8619
|
setNotice(null);
|
|
8432
8620
|
}, children: "I\u2019ve saved it" })
|
|
8433
|
-
] }) : /* @__PURE__ */
|
|
8434
|
-
/* @__PURE__ */
|
|
8435
|
-
/* @__PURE__ */
|
|
8436
|
-
/* @__PURE__ */
|
|
8437
|
-
/* @__PURE__ */
|
|
8438
|
-
/* @__PURE__ */
|
|
8621
|
+
] }) : /* @__PURE__ */ jsxs29("form", { onSubmit: createKey, className: "space-y-5 rounded-xl border border-border bg-card p-5", children: [
|
|
8622
|
+
/* @__PURE__ */ jsx31("h2", { className: "font-medium", children: "Create a key" }),
|
|
8623
|
+
/* @__PURE__ */ jsxs29("div", { className: "grid gap-4 sm:grid-cols-[1fr_10rem]", children: [
|
|
8624
|
+
/* @__PURE__ */ jsxs29("div", { className: "space-y-1.5", children: [
|
|
8625
|
+
/* @__PURE__ */ jsx31("label", { className: "text-sm font-medium", htmlFor: "key-name", children: "Name" }),
|
|
8626
|
+
/* @__PURE__ */ jsx31(Input3, { size: "lg", ref: nameInput, id: "key-name", value: name, onChange: (event) => setName(event.target.value), placeholder: "Client on my server", maxLength: 100, required: true, autoComplete: "off" })
|
|
8439
8627
|
] }),
|
|
8440
|
-
/* @__PURE__ */
|
|
8441
|
-
/* @__PURE__ */
|
|
8442
|
-
/* @__PURE__ */
|
|
8628
|
+
/* @__PURE__ */ jsxs29("div", { className: "space-y-1.5", children: [
|
|
8629
|
+
/* @__PURE__ */ jsx31("label", { className: "text-sm font-medium", htmlFor: "key-expiry", children: "Expires in" }),
|
|
8630
|
+
/* @__PURE__ */ jsx31("select", { id: "key-expiry", value: selectedDays ?? "", onChange: (event) => setDays(Number(event.target.value)), className: "h-11 w-full rounded-lg border border-input bg-background px-3 text-sm", children: allowedDays.map((days2) => /* @__PURE__ */ jsxs29("option", { value: days2, children: [
|
|
8443
8631
|
days2,
|
|
8444
8632
|
" ",
|
|
8445
8633
|
days2 === 1 ? "day" : "days"
|
|
8446
8634
|
] }, days2)) })
|
|
8447
8635
|
] })
|
|
8448
8636
|
] }),
|
|
8449
|
-
workspaces && workspaces.length > 0 && /* @__PURE__ */
|
|
8450
|
-
/* @__PURE__ */
|
|
8451
|
-
/* @__PURE__ */
|
|
8452
|
-
/* @__PURE__ */
|
|
8637
|
+
workspaces && workspaces.length > 0 && /* @__PURE__ */ jsxs29("div", { className: "space-y-1.5", children: [
|
|
8638
|
+
/* @__PURE__ */ jsx31("label", { className: "text-sm font-medium", htmlFor: "key-reach", children: "Reaches" }),
|
|
8639
|
+
/* @__PURE__ */ jsxs29("select", { id: "key-reach", value: selectedWorkspace, onChange: (event) => setReach(event.target.value), className: "h-11 w-full rounded-lg border border-input bg-background px-3 text-sm", children: [
|
|
8640
|
+
/* @__PURE__ */ jsxs29("option", { value: "", children: [
|
|
8453
8641
|
"All ",
|
|
8454
8642
|
workspaceNoun.plural,
|
|
8455
8643
|
", including new ones"
|
|
8456
8644
|
] }),
|
|
8457
|
-
workspaces.map((workspace) => /* @__PURE__ */
|
|
8645
|
+
workspaces.map((workspace) => /* @__PURE__ */ jsxs29("option", { value: workspace.id, children: [
|
|
8458
8646
|
"Only ",
|
|
8459
8647
|
workspace.name
|
|
8460
8648
|
] }, workspace.id))
|
|
8461
8649
|
] })
|
|
8462
8650
|
] }),
|
|
8463
|
-
/* @__PURE__ */
|
|
8464
|
-
/* @__PURE__ */
|
|
8651
|
+
/* @__PURE__ */ jsxs29("fieldset", { className: "space-y-3", children: [
|
|
8652
|
+
/* @__PURE__ */ jsx31("legend", { className: "mb-3 text-sm font-medium", children: "Permissions" }),
|
|
8465
8653
|
access.map((option) => {
|
|
8466
8654
|
const unavailable = !expandScopes([option.scope], access).includes(option.scope);
|
|
8467
|
-
return /* @__PURE__ */
|
|
8468
|
-
/* @__PURE__ */
|
|
8655
|
+
return /* @__PURE__ */ jsxs29("label", { className: "flex cursor-pointer items-start gap-3", children: [
|
|
8656
|
+
/* @__PURE__ */ jsx31(
|
|
8469
8657
|
"input",
|
|
8470
8658
|
{
|
|
8471
8659
|
type: "checkbox",
|
|
@@ -8475,32 +8663,32 @@ function ApiAccessPanel({
|
|
|
8475
8663
|
onChange: (event) => setScopes((current) => event.target.checked ? expandScopes([...current, option.scope], access) : pruneScopes(current.filter((scope) => scope !== option.scope), access))
|
|
8476
8664
|
}
|
|
8477
8665
|
),
|
|
8478
|
-
/* @__PURE__ */
|
|
8479
|
-
/* @__PURE__ */
|
|
8480
|
-
/* @__PURE__ */
|
|
8481
|
-
unavailable && /* @__PURE__ */
|
|
8666
|
+
/* @__PURE__ */ jsxs29("span", { className: "text-sm", children: [
|
|
8667
|
+
/* @__PURE__ */ jsx31("span", { className: "block font-medium", children: option.label }),
|
|
8668
|
+
/* @__PURE__ */ jsx31("span", { className: "text-muted-foreground", children: option.description }),
|
|
8669
|
+
unavailable && /* @__PURE__ */ jsx31("span", { className: "block text-muted-foreground", children: "Required permission unavailable." })
|
|
8482
8670
|
] })
|
|
8483
8671
|
] }, option.scope);
|
|
8484
8672
|
})
|
|
8485
8673
|
] }),
|
|
8486
|
-
limitsDescription && /* @__PURE__ */
|
|
8487
|
-
/* @__PURE__ */
|
|
8674
|
+
limitsDescription && /* @__PURE__ */ jsx31("p", { className: "text-sm text-muted-foreground", children: limitsDescription }),
|
|
8675
|
+
/* @__PURE__ */ jsx31(Button7, { type: "submit", disabled: creating || !name.trim() || !selectedScopes.length || selectedDays === void 0, children: creating ? "Creating\u2026" : "Create key" })
|
|
8488
8676
|
] }),
|
|
8489
|
-
/* @__PURE__ */
|
|
8490
|
-
/* @__PURE__ */
|
|
8491
|
-
keys.length === 0 ? /* @__PURE__ */
|
|
8492
|
-
/* @__PURE__ */
|
|
8493
|
-
/* @__PURE__ */
|
|
8494
|
-
/* @__PURE__ */
|
|
8495
|
-
/* @__PURE__ */
|
|
8496
|
-
workspaces && /* @__PURE__ */
|
|
8677
|
+
/* @__PURE__ */ jsxs29("section", { "aria-labelledby": "existing-keys", className: "space-y-3 rounded-xl border border-border bg-card p-5", children: [
|
|
8678
|
+
/* @__PURE__ */ jsx31("h2", { id: "existing-keys", className: "font-medium", children: "Your keys" }),
|
|
8679
|
+
keys.length === 0 ? /* @__PURE__ */ jsx31("p", { className: "text-sm text-muted-foreground", children: "No keys yet." }) : /* @__PURE__ */ jsx31("ul", { className: "divide-y divide-border", children: keys.map((key) => /* @__PURE__ */ jsxs29("li", { className: "flex items-start justify-between gap-3 p-4", children: [
|
|
8680
|
+
/* @__PURE__ */ jsxs29("div", { className: "min-w-0 space-y-1", children: [
|
|
8681
|
+
/* @__PURE__ */ jsx31("p", { className: "break-words text-sm font-medium", children: key.name }),
|
|
8682
|
+
/* @__PURE__ */ jsx31("p", { className: "text-sm text-muted-foreground", children: key.expiresAt ? `${new Date(key.expiresAt).getTime() <= Date.now() ? "Expired" : "Expires"} ${new Date(key.expiresAt).toLocaleDateString()}` : "No expiry" }),
|
|
8683
|
+
/* @__PURE__ */ jsx31("p", { className: "text-sm text-muted-foreground", children: key.scopes.map((scope) => access.find((access2) => access2.scope === scope)?.label ?? scope).join(" \xB7 ") }),
|
|
8684
|
+
workspaces && /* @__PURE__ */ jsx31("p", { className: "text-sm text-muted-foreground", children: key.workspaceIds?.length ? `Only ${key.workspaceIds.map(workspaceName).join(", ")}` : `All ${workspaceNoun.plural}` })
|
|
8497
8685
|
] }),
|
|
8498
|
-
/* @__PURE__ */
|
|
8686
|
+
/* @__PURE__ */ jsx31(Button7, { variant: "outline", disabled: revoking !== null, onClick: () => revokeKey(key.id), "aria-label": `Revoke ${key.name}`, children: revoking === key.id ? "Revoking\u2026" : "Revoke" })
|
|
8499
8687
|
] }, key.id)) })
|
|
8500
8688
|
] }),
|
|
8501
|
-
/* @__PURE__ */
|
|
8689
|
+
/* @__PURE__ */ jsxs29("p", { className: "text-sm text-muted-foreground", children: [
|
|
8502
8690
|
"Use ",
|
|
8503
|
-
/* @__PURE__ */
|
|
8691
|
+
/* @__PURE__ */ jsx31("code", { className: "text-sm", children: baseUrl }),
|
|
8504
8692
|
" as the API base and send the key as a Bearer credential."
|
|
8505
8693
|
] })
|
|
8506
8694
|
] }) });
|
|
@@ -8508,15 +8696,15 @@ function ApiAccessPanel({
|
|
|
8508
8696
|
|
|
8509
8697
|
// src/web-react/agent-setup-block.tsx
|
|
8510
8698
|
import { Check } from "lucide-react";
|
|
8511
|
-
import { useEffect as
|
|
8512
|
-
import { Fragment as
|
|
8699
|
+
import { useEffect as useEffect21, useRef as useRef22, useState as useState29 } from "react";
|
|
8700
|
+
import { Fragment as Fragment12, jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
8513
8701
|
function AgentSetupBlock({ productName, setupUrl, markdown, description, className }) {
|
|
8514
|
-
const [notice, setNotice] =
|
|
8515
|
-
const [copied, setCopied] =
|
|
8516
|
-
const copiedResetTimer =
|
|
8517
|
-
const mounted =
|
|
8702
|
+
const [notice, setNotice] = useState29(null);
|
|
8703
|
+
const [copied, setCopied] = useState29(false);
|
|
8704
|
+
const copiedResetTimer = useRef22(null);
|
|
8705
|
+
const mounted = useRef22(true);
|
|
8518
8706
|
const prompt = markdown ?? `Set up ${productName} for me. Fetch ${setupUrl} and follow every step in it.`;
|
|
8519
|
-
|
|
8707
|
+
useEffect21(() => {
|
|
8520
8708
|
mounted.current = true;
|
|
8521
8709
|
return () => {
|
|
8522
8710
|
mounted.current = false;
|
|
@@ -8542,34 +8730,34 @@ function AgentSetupBlock({ productName, setupUrl, markdown, description, classNa
|
|
|
8542
8730
|
setNotice(`Clipboard unavailable. Open ${setupUrl} and copy it from there.`);
|
|
8543
8731
|
}
|
|
8544
8732
|
}
|
|
8545
|
-
return /* @__PURE__ */
|
|
8733
|
+
return /* @__PURE__ */ jsxs30(
|
|
8546
8734
|
"section",
|
|
8547
8735
|
{
|
|
8548
8736
|
"aria-labelledby": "agent-setup-heading",
|
|
8549
8737
|
className: `space-y-3 rounded-xl border border-border bg-card p-5 ${className ?? ""}`.trim(),
|
|
8550
8738
|
children: [
|
|
8551
|
-
/* @__PURE__ */
|
|
8552
|
-
/* @__PURE__ */
|
|
8553
|
-
/* @__PURE__ */
|
|
8739
|
+
/* @__PURE__ */ jsxs30("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [
|
|
8740
|
+
/* @__PURE__ */ jsx32("h2", { id: "agent-setup-heading", className: "font-medium text-foreground", children: "Hand this to your agent" }),
|
|
8741
|
+
/* @__PURE__ */ jsx32(
|
|
8554
8742
|
"button",
|
|
8555
8743
|
{
|
|
8556
8744
|
type: "button",
|
|
8557
8745
|
onClick: copy,
|
|
8558
8746
|
className: "inline-flex items-center justify-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground",
|
|
8559
|
-
children: copied ? /* @__PURE__ */
|
|
8560
|
-
/* @__PURE__ */
|
|
8747
|
+
children: copied ? /* @__PURE__ */ jsxs30(Fragment12, { children: [
|
|
8748
|
+
/* @__PURE__ */ jsx32(Check, { "aria-hidden": "true", className: "h-4 w-4" }),
|
|
8561
8749
|
"Copied"
|
|
8562
8750
|
] }) : "Copy setup prompt"
|
|
8563
8751
|
}
|
|
8564
8752
|
)
|
|
8565
8753
|
] }),
|
|
8566
|
-
/* @__PURE__ */
|
|
8567
|
-
/* @__PURE__ */
|
|
8754
|
+
/* @__PURE__ */ jsx32("p", { className: "text-sm text-muted-foreground", children: description ?? `Your coding agent sets up ${productName} end to end: it asks you to approve once, gets its own capped key, installs the client, and verifies a first call.` }),
|
|
8755
|
+
/* @__PURE__ */ jsxs30("p", { className: "text-sm text-muted-foreground", children: [
|
|
8568
8756
|
"Raw prompt:",
|
|
8569
8757
|
" ",
|
|
8570
|
-
/* @__PURE__ */
|
|
8758
|
+
/* @__PURE__ */ jsx32("a", { href: setupUrl, className: "font-mono text-foreground underline", children: setupUrl })
|
|
8571
8759
|
] }),
|
|
8572
|
-
notice ? /* @__PURE__ */
|
|
8760
|
+
notice ? /* @__PURE__ */ jsx32("p", { role: "status", className: "text-sm text-foreground", children: notice }) : null
|
|
8573
8761
|
]
|
|
8574
8762
|
}
|
|
8575
8763
|
);
|
|
@@ -8577,37 +8765,37 @@ function AgentSetupBlock({ productName, setupUrl, markdown, description, classNa
|
|
|
8577
8765
|
|
|
8578
8766
|
// src/web-react/agent-profile-choices.tsx
|
|
8579
8767
|
import { useId as useId5 } from "react";
|
|
8580
|
-
import { jsx as
|
|
8768
|
+
import { jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
8581
8769
|
function AgentProfileChoices({ value, profiles, onChange, disabled, locked, lockReason, onNewChat, label = "Agent profile" }) {
|
|
8582
8770
|
const name = useId5();
|
|
8583
8771
|
const selected = profiles.find((profile) => profile.id === value);
|
|
8584
8772
|
if (locked) {
|
|
8585
|
-
return /* @__PURE__ */
|
|
8586
|
-
/* @__PURE__ */
|
|
8587
|
-
/* @__PURE__ */
|
|
8588
|
-
onNewChat && !disabled && /* @__PURE__ */
|
|
8773
|
+
return /* @__PURE__ */ jsxs31("div", { className: "space-y-2 rounded-lg border border-border p-3 text-sm", children: [
|
|
8774
|
+
/* @__PURE__ */ jsx33("p", { className: "font-medium text-foreground", children: selected?.name ?? value }),
|
|
8775
|
+
/* @__PURE__ */ jsx33("p", { className: "text-muted-foreground", children: lockReason ?? "This conversation stays on its current profile." }),
|
|
8776
|
+
onNewChat && !disabled && /* @__PURE__ */ jsx33("button", { type: "button", onClick: onNewChat, className: "text-sm font-medium text-primary underline underline-offset-4", children: "New chat to switch profile" })
|
|
8589
8777
|
] });
|
|
8590
8778
|
}
|
|
8591
|
-
return /* @__PURE__ */
|
|
8592
|
-
/* @__PURE__ */
|
|
8593
|
-
/* @__PURE__ */
|
|
8594
|
-
profiles.map((profile) => /* @__PURE__ */
|
|
8595
|
-
/* @__PURE__ */
|
|
8779
|
+
return /* @__PURE__ */ jsxs31("fieldset", { disabled, className: "min-w-0 space-y-1", children: [
|
|
8780
|
+
/* @__PURE__ */ jsx33("legend", { className: "sr-only", children: label }),
|
|
8781
|
+
/* @__PURE__ */ jsxs31("div", { className: "max-h-48 space-y-1 overflow-y-auto", children: [
|
|
8782
|
+
profiles.map((profile) => /* @__PURE__ */ jsxs31("label", { className: "flex min-h-10 cursor-pointer items-start gap-2 rounded-lg border border-transparent p-2 text-sm hover:bg-muted has-[:checked]:border-border has-[:checked]:bg-muted has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-60", children: [
|
|
8783
|
+
/* @__PURE__ */ jsx33("input", { type: "radio", name, value: profile.id, checked: profile.id === value, disabled, onChange: () => {
|
|
8596
8784
|
if (!disabled) onChange(profile.id);
|
|
8597
8785
|
}, className: "mt-1 shrink-0 accent-primary" }),
|
|
8598
|
-
/* @__PURE__ */
|
|
8599
|
-
/* @__PURE__ */
|
|
8600
|
-
profile.description && /* @__PURE__ */
|
|
8786
|
+
/* @__PURE__ */ jsxs31("span", { className: "min-w-0", children: [
|
|
8787
|
+
/* @__PURE__ */ jsx33("span", { className: "block font-medium text-foreground", children: profile.name }),
|
|
8788
|
+
profile.description && /* @__PURE__ */ jsx33("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: profile.description })
|
|
8601
8789
|
] })
|
|
8602
8790
|
] }, profile.id)),
|
|
8603
|
-
profiles.length === 0 && /* @__PURE__ */
|
|
8791
|
+
profiles.length === 0 && /* @__PURE__ */ jsx33("p", { role: "status", className: "p-2 text-sm text-muted-foreground", children: "No profiles available." })
|
|
8604
8792
|
] })
|
|
8605
8793
|
] });
|
|
8606
8794
|
}
|
|
8607
8795
|
|
|
8608
8796
|
// src/web-react/composer-profile-pill.tsx
|
|
8609
8797
|
import { AgentProfilePicker } from "@tangle-network/sandbox-ui/chat";
|
|
8610
|
-
import { jsx as
|
|
8798
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
8611
8799
|
var TRIGGER = {
|
|
8612
8800
|
composer: "max-w-[180px]",
|
|
8613
8801
|
// A menu panel repoints surface-container to its own tone, which would leave
|
|
@@ -8632,7 +8820,7 @@ function ComposerProfilePill({
|
|
|
8632
8820
|
placement = "composer",
|
|
8633
8821
|
className
|
|
8634
8822
|
}) {
|
|
8635
|
-
return /* @__PURE__ */
|
|
8823
|
+
return /* @__PURE__ */ jsx34(
|
|
8636
8824
|
AgentProfilePicker,
|
|
8637
8825
|
{
|
|
8638
8826
|
value: selection.value,
|
|
@@ -8729,6 +8917,10 @@ export {
|
|
|
8729
8917
|
mergeActivityPages,
|
|
8730
8918
|
MissionActivityLane,
|
|
8731
8919
|
AgentActivityPanel,
|
|
8920
|
+
turnTraceUrlForMessage,
|
|
8921
|
+
turnTraceFlow,
|
|
8922
|
+
TurnTraceDrawer,
|
|
8923
|
+
TurnTraceButton,
|
|
8732
8924
|
PROVENANCE_BASES,
|
|
8733
8925
|
provenanceBasisMeta,
|
|
8734
8926
|
provenanceStandingMeta,
|
|
@@ -8810,4 +9002,4 @@ export {
|
|
|
8810
9002
|
AgentProfileChoices,
|
|
8811
9003
|
ComposerProfilePill
|
|
8812
9004
|
};
|
|
8813
|
-
//# sourceMappingURL=chunk-
|
|
9005
|
+
//# sourceMappingURL=chunk-R57ZNKJB.js.map
|