@parhelia/core 0.1.12572 → 0.1.12601

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.
Files changed (43) hide show
  1. package/dist/editor/QuickItemSwitcher.js +19 -45
  2. package/dist/editor/QuickItemSwitcher.js.map +1 -1
  3. package/dist/editor/ai/AgentGreeting.js +4 -4
  4. package/dist/editor/ai/AgentGreeting.js.map +1 -1
  5. package/dist/editor/ai/AgentTerminal.js +94 -86
  6. package/dist/editor/ai/AgentTerminal.js.map +1 -1
  7. package/dist/editor/ai/AgentTerminalStatusBar.d.ts +2 -2
  8. package/dist/editor/ai/AgentTerminalStatusBar.js +2 -2
  9. package/dist/editor/ai/AgentTerminalStatusBar.js.map +1 -1
  10. package/dist/editor/ai/EditOperationsPanel.d.ts +3 -2
  11. package/dist/editor/ai/EditOperationsPanel.js +21 -78
  12. package/dist/editor/ai/EditOperationsPanel.js.map +1 -1
  13. package/dist/editor/ai/ToolCallDisplay.js +0 -3
  14. package/dist/editor/ai/ToolCallDisplay.js.map +1 -1
  15. package/dist/editor/ai/dialogs/agentDialogTypes.d.ts +2 -0
  16. package/dist/editor/ai/dialogs/agentDialogTypes.js.map +1 -1
  17. package/dist/editor/client/EditorShell.js +16 -5
  18. package/dist/editor/client/EditorShell.js.map +1 -1
  19. package/dist/editor/reviews/Comment.d.ts +2 -1
  20. package/dist/editor/reviews/Comment.js +67 -4
  21. package/dist/editor/reviews/Comment.js.map +1 -1
  22. package/dist/editor/reviews/CommentDisplayPopover.js +64 -1
  23. package/dist/editor/reviews/CommentDisplayPopover.js.map +1 -1
  24. package/dist/editor/reviews/CommentView.d.ts +3 -1
  25. package/dist/editor/reviews/CommentView.js +8 -3
  26. package/dist/editor/reviews/CommentView.js.map +1 -1
  27. package/dist/editor/reviews/Comments.js +52 -4
  28. package/dist/editor/reviews/Comments.js.map +1 -1
  29. package/dist/editor/reviews/useReviews.d.ts +2 -1
  30. package/dist/editor/reviews/useReviews.js +12 -5
  31. package/dist/editor/reviews/useReviews.js.map +1 -1
  32. package/dist/editor/settings/panels/ModelConfigPanel.js +1 -1
  33. package/dist/editor/settings/panels/ModelConfigPanel.js.map +1 -1
  34. package/dist/editor/settings/panels/ModelsPanel.js +3 -8
  35. package/dist/editor/settings/panels/ModelsPanel.js.map +1 -1
  36. package/dist/revision.d.ts +2 -2
  37. package/dist/revision.js +2 -2
  38. package/dist/setup/services/setupWizardService.d.ts +3 -5
  39. package/dist/setup/services/setupWizardService.js.map +1 -1
  40. package/dist/setup/wizard/steps/ImportModelDialog.js +10 -3
  41. package/dist/setup/wizard/steps/ImportModelDialog.js.map +1 -1
  42. package/dist/types.d.ts +1 -0
  43. package/package.json +1 -1
@@ -3,8 +3,6 @@ import React, { useEffect, useState, useRef } from "react";
3
3
  import { Dialog, DialogContent, DialogTitle } from "../components/ui/dialog";
4
4
  import { cn } from "../lib/utils";
5
5
  import { useEditContext } from "./client/editContext";
6
- import { SingleEditView } from "./views/SingleEditView";
7
- import { EditorSlotContextProvider, } from "./views/editorSlotContext";
8
6
  import { usePageViewContext } from "./page-viewer/pageViewContext";
9
7
  import { getAbsoluteIconUrl } from "./utils";
10
8
  // Helper to determine if a workspace shows EditView as main content
@@ -15,7 +13,6 @@ function workspaceShowsEditView(workspaceId) {
15
13
  }
16
14
  // Skeleton placeholder for non-EditView previews
17
15
  const SkeletonPreview = () => (_jsxs("div", { className: "h-full w-full animate-pulse bg-gray-100 p-4", children: [_jsx("div", { className: "mb-2 h-4 rounded bg-gray-300" }), _jsx("div", { className: "mb-2 h-4 w-3/4 rounded bg-gray-300" }), _jsx("div", { className: "h-4 w-1/2 rounded bg-gray-300" })] }));
18
- const noop = () => { };
19
16
  export function QuickItemSwitcher({ visible, entries, selectedIndex, onSelect, onClose, }) {
20
17
  const editContext = useEditContext();
21
18
  // Track which cards have been selected/visited to enable their previews
@@ -58,7 +55,12 @@ export function QuickItemSwitcher({ visible, entries, selectedIndex, onSelect, o
58
55
  return null;
59
56
  if (!visible || entries.length === 0)
60
57
  return null;
61
- return (_jsx(Dialog, { open: visible, onOpenChange: onClose, children: _jsxs(DialogContent, { className: "max-h-[85vh] max-w-[90vw] gap-0 p-0", overlayClassName: "bg-black/60", showCloseButton: false, children: [_jsx(DialogTitle, { className: "sr-only", children: "Navigation History" }), _jsxs("div", { className: "flex flex-col gap-7 p-6", children: [_jsx("div", { className: "text-center text-sm text-gray-600", children: "Navigation History (Live Previews) \u2022 Hold Ctrl, tap Q to navigate \u2022 Release Ctrl to select \u2022 Escape to cancel" }), _jsx("div", { className: "grid grid-cols-2 gap-5 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5", children: entries.map((entry, index) => {
58
+ const handleOpenChange = (open) => {
59
+ if (!open) {
60
+ onClose();
61
+ }
62
+ };
63
+ return (_jsx(Dialog, { open: visible, onOpenChange: handleOpenChange, children: _jsxs(DialogContent, { className: "max-h-[85vh] max-w-[90vw] gap-0 p-0", overlayClassName: "bg-black/60", showCloseButton: false, children: [_jsx(DialogTitle, { className: "sr-only", children: "Navigation History" }), _jsxs("div", { className: "flex flex-col gap-7 p-6", children: [_jsx("div", { className: "text-center text-sm text-gray-600", children: "Navigation History (Live Previews) \u2022 Hold Ctrl, tap Q to navigate \u2022 Release Ctrl to select \u2022 Escape to cancel" }), _jsx("div", { className: "grid grid-cols-2 gap-5 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5", children: entries.map((entry, index) => {
62
64
  const isSelected = index === selectedIndex;
63
65
  return (_jsxs("div", { "data-switcher-index": index, className: cn("flex cursor-pointer flex-col items-center gap-2 rounded-lg border p-3 transition-all", isSelected
64
66
  ? "scale-105 shadow-2xl"
@@ -72,14 +74,20 @@ export function QuickItemSwitcher({ visible, entries, selectedIndex, onSelect, o
72
74
  height: "200px",
73
75
  borderColor: "var(--color-theme-secondary-light)",
74
76
  }
75
- : { height: "200px" }, children: visitedIndices.has(index) ? (_jsx(CardPreview, { index: index, entry: entry, itemsRepository: editContext.itemsRepository, configuration: editContext.configuration })) : (_jsx(SkeletonPreview, {})) }), _jsxs("div", { className: "flex w-full flex-col gap-1", children: [_jsxs("div", { className: "flex w-full items-center gap-2", children: [workspaceShowsEditView(entry.workspaceId) &&
77
+ : { height: "200px" }, children: visitedIndices.has(index) ? (_jsx(CardPreview, { entry: entry, itemsRepository: editContext.itemsRepository, configuration: editContext.configuration })) : (_jsx(SkeletonPreview, {})) }), _jsxs("div", { className: "flex w-full flex-col gap-1", children: [_jsxs("div", { className: "flex w-full items-center gap-2", children: [workspaceShowsEditView(entry.workspaceId) &&
76
78
  entry.item &&
77
- entry.itemIcon && (_jsx("img", { src: getAbsoluteIconUrl(entry.itemIcon), alt: "", className: "flex-shrink-0", style: { height: "16px", width: "16px" } })), _jsx("div", { className: cn("flex-1 truncate text-sm font-medium", "text-gray-900"), title: entry.displayName, children: entry.displayName })] }), workspaceShowsEditView(entry.workspaceId) &&
79
+ entry.itemIcon && (_jsx("img", { src: getAbsoluteIconUrl(entry.itemIcon), alt: "", className: "shrink-0", style: { height: "16px", width: "16px" } })), _jsx("div", { className: cn("flex-1 truncate text-sm font-medium", "text-gray-900"), title: entry.displayName, children: entry.displayName })] }), workspaceShowsEditView(entry.workspaceId) &&
78
80
  entry.item &&
79
81
  entry.itemPath && (_jsx("div", { className: cn("w-full truncate text-xs", "text-gray-600"), title: entry.itemPath, children: entry.itemPath }))] })] }, `${entry.workspaceId}-${entry.item?.id || "noitem"}-${index}`));
80
82
  }) })] })] }) }));
81
83
  }
82
- const CardPreview = React.memo(function CardPreview({ index, entry, itemsRepository, configuration, }) {
84
+ const CardPreview = React.memo(function CardPreview({ entry, itemsRepository, configuration, }) {
85
+ if (!entry.item || !workspaceShowsEditView(entry.workspaceId)) {
86
+ return _jsx(SkeletonPreview, {});
87
+ }
88
+ return (_jsx(CardPreviewFrame, { entry: entry, itemsRepository: itemsRepository, configuration: configuration }));
89
+ });
90
+ function CardPreviewFrame({ entry, itemsRepository, configuration, }) {
83
91
  const descriptor = entry.item
84
92
  ? {
85
93
  id: entry.item.id,
@@ -92,44 +100,10 @@ const CardPreview = React.memo(function CardPreview({ index, entry, itemsReposit
92
100
  itemsRepository,
93
101
  configuration,
94
102
  });
95
- const [fullItem, setFullItem] = useState(undefined);
96
- useEffect(() => {
97
- let cancelled = false;
98
- async function load() {
99
- if (!descriptor)
100
- return;
101
- const loaded = await itemsRepository.getItem(descriptor);
102
- if (cancelled)
103
- return;
104
- setFullItem(loaded);
105
- }
106
- load();
107
- return () => {
108
- cancelled = true;
109
- };
110
- }, [descriptor?.id, descriptor?.language, descriptor?.version, itemsRepository]);
111
- // Show skeleton if no item or if view doesn't show EditView
112
- if (!entry.item || !workspaceShowsEditView(entry.workspaceId) || !fullItem) {
103
+ const previewSrc = pageView.previewUrl || pageView.editUrl;
104
+ if (!previewSrc) {
113
105
  return _jsx(SkeletonPreview, {});
114
106
  }
115
- const previewSlotContext = {
116
- slotId: `switcher-preview-${index}`,
117
- itemDescriptor: descriptor,
118
- item: fullItem,
119
- isLoading: false,
120
- pageViewContexts: [pageView],
121
- primaryPageViewContext: pageView,
122
- compareMode: false,
123
- setCompareMode: noop,
124
- compareTo: undefined,
125
- setCompareTo: noop,
126
- compareItem: undefined,
127
- isActive: false,
128
- };
129
- return (_jsx("div", { className: "pointer-events-none absolute top-0 left-0 h-full w-full origin-top-left select-none", style: {
130
- transform: "scale(0.4)",
131
- width: "250%",
132
- height: "250%",
133
- }, children: _jsx(EditorSlotContextProvider, { value: previewSlotContext, children: _jsx(SingleEditView, { compareView: false, name: `switcher-preview-${index}`, view: "primary" }) }) }));
134
- });
107
+ return (_jsx("div", { className: "pointer-events-none absolute top-0 left-0 h-full w-full overflow-hidden bg-white select-none", "aria-hidden": "true", children: _jsx("iframe", { title: entry.displayName, src: previewSrc, tabIndex: -1, loading: "eager", className: "h-full w-full border-0" }, previewSrc) }));
108
+ }
135
109
  //# sourceMappingURL=QuickItemSwitcher.js.map
@@ -1 +1 @@
1
- {"version":3,"file":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,GAAG,kBAAkB,CAAC;QAClC,kBAAkB,EAAE,UAAU;QAC9B,eAAe;QACf,aAAa;KACd,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,IAAI,QAAQ,CAAC,OAAO,CAAC;IAE3D,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,KAAC,eAAe,KAAG,CAAC;IAC7B,CAAC;IAED,OAAO,CACL,cACE,SAAS,EAAC,8FAA8F,iBAC5F,MAAM,YAElB,iBAEE,KAAK,EAAE,KAAK,CAAC,WAAW,EACxB,GAAG,EAAE,UAAU,EACf,QAAQ,EAAE,CAAC,CAAC,EACZ,OAAO,EAAC,OAAO,EACf,SAAS,EAAC,wBAAwB,IAL7B,UAAU,CAMf,GACE,CACP,CAAC;AACJ,CAAC"}
@@ -1,13 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Sparkles, MessageSquare, ArrowRight } from "lucide-react";
2
+ import { MessageSquare, ArrowRight } from "lucide-react";
3
3
  import { SecretAgentIcon } from "../ui/Icons";
4
4
  import { cn } from "../../lib/utils";
5
5
  import { sanitizeHtml, sanitizeSvg } from "../../lib/sanitize";
6
6
  export function AgentGreeting({ profile, onPromptClick, className, }) {
7
7
  const prompts = profile.prompts || [];
8
- return (_jsxs("div", { className: cn("flex h-full flex-col items-center justify-center p-8 text-center", className), children: [_jsxs("div", { className: "relative mb-8", children: [_jsx("div", { className: "absolute inset-0 -m-8 animate-pulse bg-linear-to-r from-blue-500/10 via-purple-500/10 to-pink-500/10 blur-3xl" }), _jsxs("div", { className: "relative flex h-32 w-32 items-center justify-center rounded-full bg-white p-4 shadow-xl ring-1 ring-black/5", children: [profile.svgIcon ? (_jsx("div", { className: "h-full w-full text-gray-700 [&>svg]:h-full [&>svg]:w-full", dangerouslySetInnerHTML: {
9
- __html: sanitizeSvg(profile.svgIcon),
10
- } })) : (_jsx(SecretAgentIcon, { size: 80, strokeWidth: 1, className: "text-gray-400" })), _jsx("div", { className: "absolute -top-2 -right-2 flex h-8 w-8 items-center justify-center rounded-full bg-linear-to-br from-indigo-500 to-purple-600 text-white shadow-lg ring-2 ring-white", children: _jsx(Sparkles, { size: 14 }) })] })] }), _jsxs("div", { className: "animate-in fade-in slide-in-from-bottom-4 duration-1000", children: [_jsx("h2", { className: "mb-2 text-2xl font-semibold tracking-tight text-gray-900", children: profile.agentName || profile.name }), profile.greetingMessage ? (_jsx("div", { className: "prose prose-slate mx-auto max-w-prose text-lg leading-relaxed text-gray-600", dangerouslySetInnerHTML: {
8
+ return (_jsxs("div", { className: cn("flex h-full flex-col items-center justify-center p-8 text-center", className), children: [_jsx("div", { className: "mb-8 flex h-32 w-32 items-center justify-center", children: profile.svgIcon ? (_jsx("div", { className: "h-full w-full text-gray-700 [&>svg]:h-full [&>svg]:w-full", dangerouslySetInnerHTML: {
9
+ __html: sanitizeSvg(profile.svgIcon),
10
+ } })) : (_jsx(SecretAgentIcon, { size: 80, strokeWidth: 1, className: "text-gray-400" })) }), _jsxs("div", { className: "animate-in fade-in slide-in-from-bottom-4 duration-1000", children: [_jsx("h2", { className: "mb-2 text-2xl font-semibold tracking-tight text-gray-900", children: profile.agentName || profile.name }), profile.greetingMessage ? (_jsx("div", { className: "prose prose-slate mx-auto max-w-prose text-lg leading-relaxed text-gray-600", dangerouslySetInnerHTML: {
11
11
  __html: sanitizeHtml(profile.greetingMessage),
12
12
  } })) : (_jsx("p", { className: "mx-auto max-w-prose text-lg leading-relaxed text-gray-600", children: profile.description || "How can I help you today?" }))] }), prompts.length > 0 && (_jsx("div", { className: "animate-in fade-in slide-in-from-bottom-6 mt-12 flex w-full max-w-2xl flex-wrap justify-center gap-3 duration-1000 [animation-delay:400ms]", children: prompts.map((prompt, index) => (_jsxs("button", { onClick: () => onPromptClick?.(prompt.prompt), className: "group flex items-center gap-3 rounded-2xl border border-gray-200 bg-white/50 px-5 py-3 text-xs font-medium text-gray-700 backdrop-blur-sm transition-all hover:border-indigo-300 hover:bg-white hover:text-indigo-600 hover:shadow-md active:scale-95", children: [_jsx(MessageSquare, { size: 16, className: "text-gray-400 transition-colors group-hover:text-indigo-500" }), _jsx("span", { children: prompt.title }), _jsx(ArrowRight, { size: 14, className: "ml-1 -translate-x-2 opacity-0 transition-all group-hover:translate-x-0 group-hover:opacity-100" })] }, index))) }))] }));
13
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AgentGreeting.js","sourceRoot":"","sources":["../../../src/editor/ai/AgentGreeting.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAQ/D,MAAM,UAAU,aAAa,CAAC,EAC5B,OAAO,EACP,aAAa,EACb,SAAS,GACU;IACnB,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC;IAEtC,OAAO,CACL,eACE,SAAS,EAAE,EAAE,CACX,kEAAkE,EAClE,SAAS,CACV,aAED,eAAK,SAAS,EAAC,eAAe,aAE5B,cAAK,SAAS,EAAC,+GAA+G,GAAG,EAEjI,eAAK,SAAS,EAAC,6GAA6G,aACzH,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CACjB,cACE,SAAS,EAAC,2DAA2D,EACrE,uBAAuB,EAAE;oCACvB,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC;iCACrC,GACD,CACH,CAAC,CAAC,CAAC,CACF,KAAC,eAAe,IACd,IAAI,EAAE,EAAE,EACR,WAAW,EAAE,CAAC,EACd,SAAS,EAAC,eAAe,GACzB,CACH,EAGD,cAAK,SAAS,EAAC,qKAAqK,YAClL,KAAC,QAAQ,IAAC,IAAI,EAAE,EAAE,G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,SAAS,EAAC,6DAA6D,GACvE,EACF,yBAAO,MAAM,CAAC,KAAK,GAAQ,EAC3B,KAAC,UAAU,IACT,IAAI,EAAE,EAAE,EACR,SAAS,EAAC,gGAAgG,GAC1G,KAZG,KAAK,CAaH,CACV,CAAC,GACE,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
@@ -32,6 +32,16 @@ import { SimpleTabs } from "../ui/SimpleTabs";
32
32
  import { Splitter } from "../ui/Splitter";
33
33
  import { ScrollingContentTree } from "../ScrollingContentTree";
34
34
  import { MarkdownDisplay, } from "../../components/MarkdownDisplay";
35
+ const AGENT_HISTORY_LIMIT = 1000;
36
+ function mergeAgentOperationHistory(existing, incoming, limit = AGENT_HISTORY_LIMIT) {
37
+ const merged = new Map(existing.map((operation) => [operation.id, operation]));
38
+ for (const operation of incoming) {
39
+ merged.set(operation.id, operation);
40
+ }
41
+ return Array.from(merged.values())
42
+ .sort((left, right) => new Date(right.date).getTime() - new Date(left.date).getTime())
43
+ .slice(0, limit);
44
+ }
35
45
  const userMessageMarkdownComponents = {
36
46
  h1: (props) => (_jsx("h1", { ...props, className: "mb-2 text-sm leading-5 font-semibold text-gray-900" })),
37
47
  h2: (props) => (_jsx("h2", { ...props, className: "mb-1.5 text-[13px] leading-5 font-semibold text-gray-900" })),
@@ -931,8 +941,38 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
931
941
  // while a stop operation is in progress. This prevents race conditions where
932
942
  // messages arriving during the stop process could flip the UI back to "executing".
933
943
  const isStoppingRef = useRef(false);
944
+ const [isStopGuardActive, setIsStopGuardActive] = useState(false);
945
+ const stopGuardReleaseTimeoutRef = useRef(null);
946
+ function clearStopGuard() {
947
+ isStoppingRef.current = false;
948
+ setIsStopGuardActive(false);
949
+ if (stopGuardReleaseTimeoutRef.current) {
950
+ clearTimeout(stopGuardReleaseTimeoutRef.current);
951
+ stopGuardReleaseTimeoutRef.current = null;
952
+ }
953
+ }
954
+ function armStopGuard() {
955
+ isStoppingRef.current = true;
956
+ setIsStopGuardActive(true);
957
+ if (stopGuardReleaseTimeoutRef.current) {
958
+ clearTimeout(stopGuardReleaseTimeoutRef.current);
959
+ }
960
+ stopGuardReleaseTimeoutRef.current = setTimeout(() => {
961
+ stopGuardReleaseTimeoutRef.current = null;
962
+ isStoppingRef.current = false;
963
+ setIsStopGuardActive(false);
964
+ }, 30000);
965
+ }
934
966
  // Server-driven state: true when agent is actively processing (set by WebSocket messages)
935
967
  const [isAgentThinking, setIsAgentThinking] = useState(false);
968
+ useEffect(() => {
969
+ return () => {
970
+ if (stopGuardReleaseTimeoutRef.current) {
971
+ clearTimeout(stopGuardReleaseTimeoutRef.current);
972
+ stopGuardReleaseTimeoutRef.current = null;
973
+ }
974
+ };
975
+ }, []);
936
976
  useEffect(() => {
937
977
  if (!initialMetadata)
938
978
  return;
@@ -1129,7 +1169,7 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
1129
1169
  return isUpdating;
1130
1170
  }, [agentMetadata, messages]);
1131
1171
  const prevAgentIdRef = useRef(undefined);
1132
- const [hasHistoryContent, setHasHistoryContent] = useState(false);
1172
+ const hasHistoryContent = agentOperations.length > 0;
1133
1173
  useEffect(() => {
1134
1174
  const currentId = agent?.id;
1135
1175
  if (prevAgentIdRef.current !== currentId) {
@@ -1144,50 +1184,6 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
1144
1184
  });
1145
1185
  }
1146
1186
  }, [agent?.id]);
1147
- useEffect(() => {
1148
- if (!agent?.id) {
1149
- setHasHistoryContent(false);
1150
- return;
1151
- }
1152
- setHasHistoryContent(false);
1153
- let cancelled = false;
1154
- getAgentHistory(agent.id, 10)
1155
- .then((result) => {
1156
- if (cancelled)
1157
- return;
1158
- if (result.type === "success" &&
1159
- result.data &&
1160
- result.data.length > 0) {
1161
- setHasHistoryContent(true);
1162
- }
1163
- else {
1164
- setHasHistoryContent(false);
1165
- }
1166
- })
1167
- .catch(() => {
1168
- if (!cancelled)
1169
- setHasHistoryContent(false);
1170
- });
1171
- return () => {
1172
- cancelled = true;
1173
- };
1174
- }, [agent?.id]);
1175
- const agentIdForHistoryRef = useRef(agent?.id);
1176
- agentIdForHistoryRef.current = agent?.id;
1177
- useEffect(() => {
1178
- if (!agent?.id || !editContext?.addSocketMessageListener)
1179
- return;
1180
- const unsubscribe = editContext.addSocketMessageListener((message) => {
1181
- if (message.type !== "edit-operation")
1182
- return;
1183
- const op = message.payload;
1184
- const operationAgentId = op.agentId || op.user?.agentId;
1185
- if (operationAgentId === agentIdForHistoryRef.current) {
1186
- setHasHistoryContent(true);
1187
- }
1188
- });
1189
- return () => unsubscribe();
1190
- }, [agent?.id, editContext?.addSocketMessageListener]);
1191
1187
  useEffect(() => {
1192
1188
  let active = true;
1193
1189
  const loadSkills = async () => {
@@ -2705,6 +2701,11 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
2705
2701
  if (!messageId || !toolCallId)
2706
2702
  return;
2707
2703
  // Update local state to reflect approval status
2704
+ const currentMessages = messagesRef.current || [];
2705
+ const hasMatchingToolCall = currentMessages.some((m) => (m.toolCalls || []).some((tc) => tc.toolCallId === toolCallId));
2706
+ if (!hasMatchingToolCall) {
2707
+ return;
2708
+ }
2708
2709
  setMessages((prev) => {
2709
2710
  const updated = prev.map((m) => {
2710
2711
  // Update tool calls in ANY message that contains this toolCallId
@@ -3124,8 +3125,9 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
3124
3125
  setAgentOperations([]);
3125
3126
  return;
3126
3127
  }
3128
+ setAgentOperations([]);
3127
3129
  try {
3128
- const result = await getAgentHistory(agent.id, 1000);
3130
+ const result = await getAgentHistory(agent.id, AGENT_HISTORY_LIMIT);
3129
3131
  if (result.type === "success") {
3130
3132
  setAgentOperations(result.data ?? []);
3131
3133
  }
@@ -3261,12 +3263,7 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
3261
3263
  const op = message.payload;
3262
3264
  const operationAgentId = op.agentId || op.user?.agentId;
3263
3265
  if (operationAgentId === agent.id) {
3264
- // Reload operations when this agent performs an operation
3265
- getAgentHistory(agent.id, 1000).then((result) => {
3266
- if (result.type === "success") {
3267
- setAgentOperations(result.data ?? []);
3268
- }
3269
- });
3266
+ setAgentOperations((previous) => mergeAgentOperationHistory(previous, [op]));
3270
3267
  }
3271
3268
  return;
3272
3269
  }
@@ -3524,6 +3521,7 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
3524
3521
  const normalizedStatus = parseAgentStatus(statusData?.state) ||
3525
3522
  parseAgentStatus(statusData?.status);
3526
3523
  if (normalizedStatus === "idle") {
3524
+ clearStopGuard();
3527
3525
  // Stop indicators and mark any in-progress streaming messages as completed
3528
3526
  clearHeartbeatMessages();
3529
3527
  setAgent((prev) => (prev ? { ...prev, status: "idle" } : prev));
@@ -3663,6 +3661,7 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
3663
3661
  }
3664
3662
  // Handle waiting states explicitly
3665
3663
  if (normalizedStatus === "waitingForApproval") {
3664
+ clearStopGuard();
3666
3665
  setPendingBrowserCaptureDialogType(null);
3667
3666
  setAgent((prev) => prev ? { ...prev, status: "waitingForApproval" } : prev);
3668
3667
  setIsConnecting(false);
@@ -3672,6 +3671,7 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
3672
3671
  return;
3673
3672
  }
3674
3673
  if (normalizedStatus === "waitingForInput") {
3674
+ clearStopGuard();
3675
3675
  const dialogType = typeof statusData?.dialogType === "string"
3676
3676
  ? statusData.dialogType
3677
3677
  : null;
@@ -3695,6 +3695,7 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
3695
3695
  return;
3696
3696
  }
3697
3697
  if (normalizedStatus === "costLimitReached") {
3698
+ clearStopGuard();
3698
3699
  setPendingBrowserCaptureDialogType(null);
3699
3700
  const totalCost = Number(statusData.totalCost) || 0;
3700
3701
  const costLimit = Number(statusData.costLimit) || agent?.costLimit || 0;
@@ -3743,6 +3744,7 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
3743
3744
  }
3744
3745
  // Handle "completed" state (fallback for legacy code paths that send status instead of lifecycle event)
3745
3746
  if (normalizedStatus === "completed") {
3747
+ clearStopGuard();
3746
3748
  // Reset deduplication for the next run
3747
3749
  lastSeqRef.current = 0;
3748
3750
  clearHeartbeatMessages();
@@ -3770,6 +3772,9 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
3770
3772
  }
3771
3773
  // Handle "Running" state - agent is actively processing
3772
3774
  if (normalizedStatus === "running") {
3775
+ if (isStoppingRef.current) {
3776
+ return;
3777
+ }
3773
3778
  // Update agent status to running and clear any previous error statusMessage
3774
3779
  setAgent((prev) => prev
3775
3780
  ? { ...prev, status: "running", statusMessage: undefined }
@@ -3781,6 +3786,7 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
3781
3786
  }
3782
3787
  // Handle "Error" state
3783
3788
  if (normalizedStatus === "error") {
3789
+ clearStopGuard();
3784
3790
  const errorMsg = toUserFacingAgentErrorMessage(statusData?.statusMessage ?? statusData?.error) || "Unknown error";
3785
3791
  clearHeartbeatMessages();
3786
3792
  setAgent((prev) => prev
@@ -4373,6 +4379,7 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
4373
4379
  setError("Agent not ready. Please try again.");
4374
4380
  return;
4375
4381
  }
4382
+ clearStopGuard();
4376
4383
  const hadQuestionnaireDialogOpen = activeInlineDialogRef.current?.request.dialogType === "questionnaire";
4377
4384
  const suppressedQueuedPromptToken = hadQuestionnaireDialogOpen && savedPrompt
4378
4385
  ? registerSuppressedQueuedPrompt(agentId, savedPrompt)
@@ -5227,14 +5234,18 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
5227
5234
  try {
5228
5235
  // 1. Set the stopping guard to prevent WebSocket handlers from re-enabling states
5229
5236
  // This must happen FIRST, before any other state changes
5230
- isStoppingRef.current = true;
5237
+ armStopGuard();
5231
5238
  // 2. Update all UI state to reflect stopped status
5232
5239
  setIsWaitingForResponse(false);
5233
5240
  isWaitingRef.current = false;
5234
5241
  setIsConnecting(false);
5235
5242
  setIsSubmitting(false);
5243
+ setAgent((prev) => prev ? { ...prev, status: "idle", statusMessage: undefined } : prev);
5244
+ shouldCreateNewMessage.current = false;
5236
5245
  // User stopped the agent, hide thinking dots
5237
5246
  setIsAgentThinking(false);
5247
+ // Stopping an agent discards queued follow-up prompts for that run.
5248
+ setQueuedPrompts([]);
5238
5249
  // 3. Mark any in-progress streaming messages as completed in UI
5239
5250
  setMessages((prev) => {
5240
5251
  const updated = prev.map((msg) => !msg.isCompleted && msg.messageType === "streaming"
@@ -5252,39 +5263,27 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
5252
5263
  catch (err) {
5253
5264
  console.error("Failed to cancel agent on backend:", err);
5254
5265
  // Continue - UI is already in stopped state, but backend may still be running
5255
- // The isStoppingRef guard will be cleared below so future runs can proceed
5266
+ // The stop guard has its own timeout so future runs can proceed.
5256
5267
  }
5257
5268
  }
5258
5269
  }
5259
5270
  catch (e) {
5260
5271
  console.error("Failed to stop agent execution", e);
5261
5272
  }
5262
- finally {
5263
- // Clear the stopping guard so future runs can proceed normally
5264
- // This happens after backend confirmation (or error)
5265
- isStoppingRef.current = false;
5266
- }
5267
5273
  }, []);
5268
- // Determine effective cost limit from agent, profile, or metadata so the cost display
5269
- // is visible immediately even before any messages or server-side persistence.
5270
- let effectiveCostLimit;
5271
- try {
5272
- const candidates = [
5273
- agent?.costLimit,
5274
- activeProfile?.costLimit,
5275
- ];
5276
- for (const c of candidates) {
5277
- const n = c != null ? Number(c) : 0;
5278
- if (Number.isFinite(n) && n > 0) {
5279
- effectiveCostLimit = n;
5280
- break;
5281
- }
5274
+ // Cost limit is owned by the persisted agent record. Profiles can provide defaults
5275
+ // during creation, but once an agent exists the frontend should only display the
5276
+ // backend-provided value for that specific agent.
5277
+ const agentCostLimit = (() => {
5278
+ try {
5279
+ const value = agent?.costLimit;
5280
+ const parsed = value != null ? Number(value) : 0;
5281
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : undefined;
5282
5282
  }
5283
- }
5284
- catch { }
5285
- if (effectiveCostLimit === undefined) {
5286
- effectiveCostLimit = undefined;
5287
- }
5283
+ catch {
5284
+ return undefined;
5285
+ }
5286
+ })();
5288
5287
  // Calculate total token usage for cost display.
5289
5288
  // Message rows do not currently persist imageCost, so on refresh we fall back
5290
5289
  // to the persisted agent aggregate for that single field.
@@ -5295,11 +5294,20 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
5295
5294
  imageCost: totals.imageCost || Number(agent?.totalImageCost) || 0,
5296
5295
  };
5297
5296
  })();
5297
+ const normalizedAgentStatus = parseAgentStatus(agent?.status);
5298
+ const hasSettledToNonExecutingStatus = normalizedAgentStatus === "idle" ||
5299
+ normalizedAgentStatus === "completed" ||
5300
+ normalizedAgentStatus === "error" ||
5301
+ normalizedAgentStatus === "closed" ||
5302
+ normalizedAgentStatus === "waitingForApproval" ||
5303
+ normalizedAgentStatus === "waitingForInput" ||
5304
+ normalizedAgentStatus === "costLimitReached";
5298
5305
  // Determine if the agent is actively executing (submitting, connecting, waiting, or streaming)
5299
- const isExecuting = isSubmitting ||
5300
- isConnecting ||
5301
- isWaitingForResponse ||
5302
- hasActiveStreaming();
5306
+ const isExecuting = !isStopGuardActive &&
5307
+ (isSubmitting ||
5308
+ isConnecting ||
5309
+ (!hasSettledToNonExecutingStatus &&
5310
+ (isWaitingForResponse || hasActiveStreaming())));
5303
5311
  const assistantMessageCount = useMemo(() => messages.filter((message) => message.role === "assistant").length, [messages]);
5304
5312
  const messagesWithToolCallsCount = useMemo(() => messages.filter((message) => (message.toolCalls || []).length > 0).length, [messages]);
5305
5313
  const totalToolCallCount = useMemo(() => messages.reduce((sum, message) => sum + (message.toolCalls?.length || 0), 0), [messages]);
@@ -5859,7 +5867,7 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
5859
5867
  {
5860
5868
  id: "history",
5861
5869
  label: "History",
5862
- content: (_jsx(AgentEditOperationsPanel, { agentId: agent.id })),
5870
+ content: (_jsx(AgentEditOperationsPanel, { operations: agentOperations })),
5863
5871
  },
5864
5872
  ]
5865
5873
  : []),
@@ -5869,7 +5877,7 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
5869
5877
  hasTodoContent,
5870
5878
  hasSpawnedAgents,
5871
5879
  agent?.id && hasHistoryContent,
5872
- ].filter(Boolean).length - 1)), setActiveTab: setContextPanelsActiveTab, className: "justify-start px-4" }) })) : (_jsxs(_Fragment, { children: [renderContextInfoBar(), agent?.id && activeProfile && (_jsx(AgentDocumentList, { ref: documentListRef, agentId: agent.id, maxFileSizeMB: activeProfile.maxDocumentSizeMB ?? 10, enabled: activeProfile.enableDocumentUpload ?? false, profileId: activeProfile.id }, `${agent.id}-${agent.updatedDate || ""}-${activeProfile.id}`)), _jsx(TodoListPanel, { messages: messages, agentMetadata: agentMetadata }), _jsx(SpawnedAgentsPanel, { agentMetadata: agentMetadata }), agent?.id && _jsx(AgentEditOperationsPanel, { agentId: agent.id })] }))), queuedPrompts.length > 0 && !simpleMode && (_jsx("div", { className: "border-t border-gray-200 bg-amber-50/50", "data-testid": "queued-prompts-section", children: _jsxs("div", { className: "px-4 pt-2.5 pb-2", children: [_jsxs("div", { className: "mb-1.5 flex items-center gap-1.5", children: [_jsx("div", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-amber-400" }), _jsxs("span", { className: "text-[10px] font-medium tracking-wide text-amber-600 uppercase", "data-testid": "queued-prompts-count", children: ["Queued (", queuedPrompts.length, ")"] })] }), _jsx("div", { className: "max-h-64 space-y-0.5 overflow-y-auto", children: queuedPrompts.map((qp) => {
5880
+ ].filter(Boolean).length - 1)), setActiveTab: setContextPanelsActiveTab, className: "justify-start px-4" }) })) : (_jsxs(_Fragment, { children: [renderContextInfoBar(), agent?.id && activeProfile && (_jsx(AgentDocumentList, { ref: documentListRef, agentId: agent.id, maxFileSizeMB: activeProfile.maxDocumentSizeMB ?? 10, enabled: activeProfile.enableDocumentUpload ?? false, profileId: activeProfile.id }, `${agent.id}-${agent.updatedDate || ""}-${activeProfile.id}`)), _jsx(TodoListPanel, { messages: messages, agentMetadata: agentMetadata }), _jsx(SpawnedAgentsPanel, { agentMetadata: agentMetadata }), agent?.id && (_jsx(AgentEditOperationsPanel, { operations: agentOperations }))] }))), queuedPrompts.length > 0 && !simpleMode && (_jsx("div", { className: "border-t border-gray-200 bg-amber-50/50", "data-testid": "queued-prompts-section", children: _jsxs("div", { className: "px-4 pt-2.5 pb-2", children: [_jsxs("div", { className: "mb-1.5 flex items-center gap-1.5", children: [_jsx("div", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-amber-400" }), _jsxs("span", { className: "text-[10px] font-medium tracking-wide text-amber-600 uppercase", "data-testid": "queued-prompts-count", children: ["Queued (", queuedPrompts.length, ")"] })] }), _jsx("div", { className: "max-h-64 space-y-0.5 overflow-y-auto", children: queuedPrompts.map((qp) => {
5873
5881
  let triggerName = "";
5874
5882
  if (qp.data) {
5875
5883
  try {
@@ -6215,7 +6223,7 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
6215
6223
  imageCost: liveTotals.imageCost ?? 0,
6216
6224
  totalCost: liveTotals.totalCost,
6217
6225
  }
6218
- : totalTokens, effectiveCostLimit: effectiveCostLimit, messages: messages, showCompressionPopover: showCompressionPopover, setShowCompressionPopover: setShowCompressionPopover }) }) })] }))] })), _jsxs("div", { className: "flex items-center gap-1 self-end", children: [_jsx("span", { title: isVoiceDisabled
6226
+ : totalTokens, costLimit: agentCostLimit, messages: messages, showCompressionPopover: showCompressionPopover, setShowCompressionPopover: setShowCompressionPopover }) }) })] }))] })), _jsxs("div", { className: "flex items-center gap-1 self-end", children: [_jsx("span", { title: isVoiceDisabled
6219
6227
  ? "Your browser does not support Speech Recognition"
6220
6228
  : isListening
6221
6229
  ? "Stop voice input"
@@ -6252,6 +6260,6 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
6252
6260
  imageCost: liveTotals.imageCost ?? 0,
6253
6261
  totalCost: liveTotals.totalCost,
6254
6262
  }
6255
- : totalTokens, effectiveCostLimit: effectiveCostLimit, messages: messages, showCompressionPopover: showCompressionPopover, setShowCompressionPopover: setShowCompressionPopover }))] })] }));
6263
+ : totalTokens, costLimit: agentCostLimit, messages: messages, showCompressionPopover: showCompressionPopover, setShowCompressionPopover: setShowCompressionPopover }))] })] }));
6256
6264
  }
6257
6265
  //# sourceMappingURL=AgentTerminal.js.map