@open-mercato/ui 0.10.1-develop.8278.1.f7f8e5ab1a → 0.10.1-develop.8287.1.7313a0fe67
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/.turbo/turbo-build.log +1 -1
- package/dist/ai/AiChat.js +40 -14
- package/dist/ai/AiChat.js.map +2 -2
- package/dist/ai/LoopTracePanel.js +30 -23
- package/dist/ai/LoopTracePanel.js.map +2 -2
- package/dist/ai/citations/merge.js +72 -0
- package/dist/ai/citations/merge.js.map +7 -0
- package/dist/ai/citations/registry.js +97 -0
- package/dist/ai/citations/registry.js.map +7 -0
- package/dist/ai/conversation-store.js +4 -1
- package/dist/ai/conversation-store.js.map +2 -2
- package/dist/ai/index.js +40 -1
- package/dist/ai/index.js.map +2 -2
- package/dist/ai/parts/CitationsPart.js +135 -0
- package/dist/ai/parts/CitationsPart.js.map +7 -0
- package/dist/ai/parts/index.js +2 -0
- package/dist/ai/parts/index.js.map +2 -2
- package/dist/ai/run-trace-link.js +33 -0
- package/dist/ai/run-trace-link.js.map +7 -0
- package/dist/ai/ui-part-registry.js +12 -0
- package/dist/ai/ui-part-registry.js.map +2 -2
- package/dist/ai/useAiChat.js +7 -3
- package/dist/ai/useAiChat.js.map +2 -2
- package/dist/backend/DataTable.js +1 -1
- package/dist/backend/DataTable.js.map +2 -2
- package/dist/backend/detail/AttachmentMetadataDialog.js +137 -101
- package/dist/backend/detail/AttachmentMetadataDialog.js.map +2 -2
- package/dist/backend/detail/DocumentStructurePanel.js +384 -0
- package/dist/backend/detail/DocumentStructurePanel.js.map +7 -0
- package/package.json +3 -3
- package/src/ai/AiChat.tsx +47 -22
- package/src/ai/LoopTracePanel.tsx +44 -10
- package/src/ai/__tests__/AiChat.run-trace.test.tsx +264 -0
- package/src/ai/citations/__tests__/href-safety-cases.ts +33 -0
- package/src/ai/citations/__tests__/registry.test.ts +156 -0
- package/src/ai/citations/merge.ts +83 -0
- package/src/ai/citations/registry.ts +138 -0
- package/src/ai/conversation-store.ts +3 -0
- package/src/ai/index.ts +27 -0
- package/src/ai/parts/CitationsPart.tsx +146 -0
- package/src/ai/parts/__tests__/CitationsPart.test.tsx +105 -0
- package/src/ai/parts/index.ts +1 -0
- package/src/ai/run-trace-link.ts +33 -0
- package/src/ai/ui-part-registry.ts +13 -0
- package/src/ai/useAiChat.ts +13 -5
- package/src/backend/DataTable.tsx +3 -1
- package/src/backend/__tests__/AttachmentMetadataDialog.test.tsx +32 -1
- package/src/backend/__tests__/lazy-heavy-libraries.test.ts +7 -0
- package/src/backend/detail/AttachmentMetadataDialog.tsx +161 -119
- package/src/backend/detail/DocumentStructurePanel.tsx +514 -0
- package/src/backend/detail/__tests__/AttachmentMetadataDialog.tabs.test.tsx +89 -0
- package/src/backend/detail/__tests__/DocumentStructurePanel.test.tsx +153 -0
package/.turbo/turbo-build.log
CHANGED
package/dist/ai/AiChat.js
CHANGED
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
Wrench,
|
|
35
35
|
X
|
|
36
36
|
} from "lucide-react";
|
|
37
|
+
import Link from "next/link";
|
|
37
38
|
import ReactMarkdown from "react-markdown";
|
|
38
39
|
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
39
40
|
import { cn } from "@open-mercato/shared/lib/utils";
|
|
@@ -60,12 +61,14 @@ import {
|
|
|
60
61
|
defaultAiUiPartRegistry,
|
|
61
62
|
isReservedAiUiPartId
|
|
62
63
|
} from "./ui-part-registry.js";
|
|
64
|
+
import { mergeConsecutiveCitationParts } from "./citations/merge.js";
|
|
63
65
|
import {
|
|
64
66
|
useAiChat
|
|
65
67
|
} from "./useAiChat.js";
|
|
66
68
|
import { useAiChatUpload } from "./useAiChatUpload.js";
|
|
67
69
|
import { useAiShortcuts } from "./useAiShortcuts.js";
|
|
68
70
|
import { LoopTracePanel } from "./LoopTracePanel.js";
|
|
71
|
+
import { buildAiRunTraceHref, useCanViewAiRunTrace } from "./run-trace-link.js";
|
|
69
72
|
import { AiIcon } from "./AiIcon.js";
|
|
70
73
|
import { readModelPickerValue, writeModelPickerValue } from "./modelPickerStorage.js";
|
|
71
74
|
import { createLogger } from "@open-mercato/shared/lib/logger";
|
|
@@ -556,6 +559,8 @@ function MessageRow({
|
|
|
556
559
|
const isOtherUsersMessage = !isAssistant && isOwner === false;
|
|
557
560
|
const label = isAssistant ? t("ai_assistant.chat.assistantRoleLabel", "Assistant") : isOtherUsersMessage ? t("ai_assistant.chat.ownerRoleLabel", "Owner") : t("ai_assistant.chat.userRoleLabel", "You");
|
|
558
561
|
const Icon = isAssistant ? Bot : User;
|
|
562
|
+
const canViewRunTrace = useCanViewAiRunTrace();
|
|
563
|
+
const runTraceHref = isAssistant && message.runId && canViewRunTrace ? buildAiRunTraceHref(message.runId) : null;
|
|
559
564
|
const [copied, setCopied] = React.useState(false);
|
|
560
565
|
const copyTimerRef = React.useRef(null);
|
|
561
566
|
const visibleTaskPlan = isAssistant && message.taskPlan ? message.taskPlan.filter((task) => task.source === "agent") : [];
|
|
@@ -610,19 +615,40 @@ function MessageRow({
|
|
|
610
615
|
/* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-1", children: [
|
|
611
616
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
612
617
|
/* @__PURE__ */ jsx("div", { className: "text-xs font-medium text-muted-foreground", children: label }),
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
618
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
619
|
+
runTraceHref ? /* @__PURE__ */ jsx(
|
|
620
|
+
IconButton,
|
|
621
|
+
{
|
|
622
|
+
asChild: true,
|
|
623
|
+
variant: "ghost",
|
|
624
|
+
size: "sm",
|
|
625
|
+
className: "opacity-0 transition-opacity group-hover/message:opacity-100 focus-visible:opacity-100",
|
|
626
|
+
children: /* @__PURE__ */ jsx(
|
|
627
|
+
Link,
|
|
628
|
+
{
|
|
629
|
+
href: runTraceHref,
|
|
630
|
+
"aria-label": t("ai_assistant.chat.viewRunTrace", "View run trace"),
|
|
631
|
+
title: t("ai_assistant.chat.viewRunTrace", "View run trace"),
|
|
632
|
+
"data-ai-chat-run-trace-link": message.runId,
|
|
633
|
+
children: /* @__PURE__ */ jsx(Activity, { className: "size-3.5", "aria-hidden": true })
|
|
634
|
+
}
|
|
635
|
+
)
|
|
636
|
+
}
|
|
637
|
+
) : null,
|
|
638
|
+
message.content ? /* @__PURE__ */ jsx(
|
|
639
|
+
IconButton,
|
|
640
|
+
{
|
|
641
|
+
type: "button",
|
|
642
|
+
variant: "ghost",
|
|
643
|
+
size: "sm",
|
|
644
|
+
onClick: handleCopy,
|
|
645
|
+
"aria-label": copied ? t("ai_assistant.chat.copied", "Copied") : t("ai_assistant.chat.copyMessage", "Copy message"),
|
|
646
|
+
"data-ai-chat-copy-button": "",
|
|
647
|
+
className: "opacity-0 transition-opacity group-hover/message:opacity-100 focus-visible:opacity-100",
|
|
648
|
+
children: copied ? /* @__PURE__ */ jsx(Check, { className: "size-3.5 text-status-success-icon", "aria-hidden": true }) : /* @__PURE__ */ jsx(Copy, { className: "size-3.5", "aria-hidden": true })
|
|
649
|
+
}
|
|
650
|
+
) : null
|
|
651
|
+
] })
|
|
626
652
|
] }),
|
|
627
653
|
message.files && message.files.length > 0 ? /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2 py-1", children: message.files.map((file, i) => /* @__PURE__ */ jsx(MessageFileAttachment, { file }, `${file.id ?? file.name}:${i}`)) }) : null,
|
|
628
654
|
isAssistant && message.reasoning ? /* @__PURE__ */ jsx(
|
|
@@ -653,7 +679,7 @@ function MessageUiParts({
|
|
|
653
679
|
registry,
|
|
654
680
|
onMutationRequested
|
|
655
681
|
}) {
|
|
656
|
-
return /* @__PURE__ */ jsx("div", { className: "mt-2 flex flex-col gap-2", "data-ai-message-ui-parts": "", children: parts.map((part) => /* @__PURE__ */ jsx(
|
|
682
|
+
return /* @__PURE__ */ jsx("div", { className: "mt-2 flex flex-col gap-2", "data-ai-message-ui-parts": "", children: mergeConsecutiveCitationParts(parts).map((part) => /* @__PURE__ */ jsx(
|
|
657
683
|
AiUiPartRenderer,
|
|
658
684
|
{
|
|
659
685
|
part: {
|