@parhelia/core 0.1.12242 → 0.1.12267
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/agents-view/AgentsWorkspaceView.js +9 -1
- package/dist/agents-view/AgentsWorkspaceView.js.map +1 -1
- package/dist/components/MarkdownDisplay.d.ts +10 -0
- package/dist/components/MarkdownDisplay.js +197 -0
- package/dist/components/MarkdownDisplay.js.map +1 -0
- package/dist/config/config.js +4 -1
- package/dist/config/config.js.map +1 -1
- package/dist/config/notificationRoutes.d.ts +2 -0
- package/dist/config/notificationRoutes.js +195 -0
- package/dist/config/notificationRoutes.js.map +1 -0
- package/dist/config/types.d.ts +7 -0
- package/dist/config/types.js.map +1 -1
- package/dist/editor/ContentTree.d.ts +2 -1
- package/dist/editor/ContentTree.js +11 -3
- package/dist/editor/ContentTree.js.map +1 -1
- package/dist/editor/Editor.js +12 -3
- package/dist/editor/Editor.js.map +1 -1
- package/dist/editor/GlobalMenuBar.js +29 -1
- package/dist/editor/GlobalMenuBar.js.map +1 -1
- package/dist/editor/ai/AgentTerminal.d.ts +9 -1
- package/dist/editor/ai/AgentTerminal.js +233 -53
- package/dist/editor/ai/AgentTerminal.js.map +1 -1
- package/dist/editor/ai/dialogs/AgentDialogHandler.js +5 -0
- package/dist/editor/ai/dialogs/AgentDialogHandler.js.map +1 -1
- package/dist/editor/ai/dialogs/QuestionnaireInline.d.ts +3 -1
- package/dist/editor/ai/dialogs/QuestionnaireInline.js +5 -5
- package/dist/editor/ai/dialogs/QuestionnaireInline.js.map +1 -1
- package/dist/editor/client/EditorShell.js +9 -4
- package/dist/editor/client/EditorShell.js.map +1 -1
- package/dist/editor/client/editContext.d.ts +4 -1
- package/dist/editor/client/editContext.js.map +1 -1
- package/dist/editor/client/hooks/useEditorWebSocket.js +36 -4
- package/dist/editor/client/hooks/useEditorWebSocket.js.map +1 -1
- package/dist/editor/client/hooks/useSocketMessageHandler.js +2 -0
- package/dist/editor/client/hooks/useSocketMessageHandler.js.map +1 -1
- package/dist/editor/client/operations.d.ts +2 -1
- package/dist/editor/client/operations.js +8 -0
- package/dist/editor/client/operations.js.map +1 -1
- package/dist/editor/client/ui/EditorChrome.js +1 -1
- package/dist/editor/client/ui/EditorChrome.js.map +1 -1
- package/dist/editor/commands/itemCommands.d.ts +1 -0
- package/dist/editor/commands/itemCommands.js +23 -1
- package/dist/editor/commands/itemCommands.js.map +1 -1
- package/dist/editor/menubar/toolbar-sections/ManualBrowser.js +2 -134
- package/dist/editor/menubar/toolbar-sections/ManualBrowser.js.map +1 -1
- package/dist/editor/notifications/NotificationCenter.d.ts +1 -0
- package/dist/editor/notifications/NotificationCenter.js +69 -0
- package/dist/editor/notifications/NotificationCenter.js.map +1 -0
- package/dist/editor/notifications/NotificationItem.d.ts +14 -0
- package/dist/editor/notifications/NotificationItem.js +40 -0
- package/dist/editor/notifications/NotificationItem.js.map +1 -0
- package/dist/editor/notifications/WatchButton.d.ts +7 -0
- package/dist/editor/notifications/WatchButton.js +191 -0
- package/dist/editor/notifications/WatchButton.js.map +1 -0
- package/dist/editor/notifications/notificationListState.d.ts +25 -0
- package/dist/editor/notifications/notificationListState.js +38 -0
- package/dist/editor/notifications/notificationListState.js.map +1 -0
- package/dist/editor/notifications/notificationRoutes.d.ts +15 -0
- package/dist/editor/notifications/notificationRoutes.js +58 -0
- package/dist/editor/notifications/notificationRoutes.js.map +1 -0
- package/dist/editor/notifications/useNotificationSubscriptions.d.ts +14 -0
- package/dist/editor/notifications/useNotificationSubscriptions.js +88 -0
- package/dist/editor/notifications/useNotificationSubscriptions.js.map +1 -0
- package/dist/editor/notifications/useNotifications.d.ts +28 -0
- package/dist/editor/notifications/useNotifications.js +166 -0
- package/dist/editor/notifications/useNotifications.js.map +1 -0
- package/dist/editor/page-viewer/MiniMap.d.ts +1 -3
- package/dist/editor/page-viewer/MiniMap.js +73 -22
- package/dist/editor/page-viewer/MiniMap.js.map +1 -1
- package/dist/editor/page-viewer/PageViewerFrame.js +1 -1
- package/dist/editor/page-viewer/PageViewerFrame.js.map +1 -1
- package/dist/editor/reviews/CreateReviewConfirmStep.d.ts +2 -1
- package/dist/editor/reviews/CreateReviewConfirmStep.js +3 -3
- package/dist/editor/reviews/CreateReviewConfirmStep.js.map +1 -1
- package/dist/editor/reviews/CreateReviewDialog.js +24 -9
- package/dist/editor/reviews/CreateReviewDialog.js.map +1 -1
- package/dist/editor/reviews/ReviewDetail.js +2 -1
- package/dist/editor/reviews/ReviewDetail.js.map +1 -1
- package/dist/editor/services/agentService.d.ts +6 -0
- package/dist/editor/services/agentService.js +32 -10
- package/dist/editor/services/agentService.js.map +1 -1
- package/dist/editor/services/contentService.d.ts +1 -0
- package/dist/editor/services/contentService.js +3 -0
- package/dist/editor/services/contentService.js.map +1 -1
- package/dist/editor/services/notificationService.d.ts +73 -0
- package/dist/editor/services/notificationService.js +72 -0
- package/dist/editor/services/notificationService.js.map +1 -0
- package/dist/editor/ui/PublishItemDialog.d.ts +8 -0
- package/dist/editor/ui/PublishItemDialog.js +193 -0
- package/dist/editor/ui/PublishItemDialog.js.map +1 -0
- package/dist/editor/ui/PublishRestrictionsDialog.js +165 -75
- package/dist/editor/ui/PublishRestrictionsDialog.js.map +1 -1
- package/dist/editor/ui/TreeListSelector.d.ts +2 -1
- package/dist/editor/ui/TreeListSelector.js +2 -2
- package/dist/editor/ui/TreeListSelector.js.map +1 -1
- package/dist/revision.d.ts +2 -2
- package/dist/revision.js +2 -2
- package/dist/splash-screen/ParheliaAssistantChat.js +9 -9
- package/dist/splash-screen/ParheliaAssistantChat.js.map +1 -1
- package/dist/splash-screen/RecentPages.js +2 -2
- package/dist/splash-screen/RecentPages.js.map +1 -1
- package/dist/task-board/TaskBoardWorkspace.js +716 -402
- package/dist/task-board/TaskBoardWorkspace.js.map +1 -1
- package/dist/task-board/components/AssignAgentDialog.js +2 -3
- package/dist/task-board/components/AssignAgentDialog.js.map +1 -1
- package/dist/task-board/components/CreateProjectDialog.d.ts +4 -1
- package/dist/task-board/components/CreateProjectDialog.js +23 -8
- package/dist/task-board/components/CreateProjectDialog.js.map +1 -1
- package/dist/task-board/components/TaskAgentPanel.js +10 -6
- package/dist/task-board/components/TaskAgentPanel.js.map +1 -1
- package/dist/task-board/components/TaskBoardMyTasksSidebar.js +48 -2
- package/dist/task-board/components/TaskBoardMyTasksSidebar.js.map +1 -1
- package/dist/task-board/components/TaskBoardTitlebar.js +4 -4
- package/dist/task-board/components/TaskBoardTitlebar.js.map +1 -1
- package/dist/task-board/components/TaskDetailPanel.js +2 -1
- package/dist/task-board/components/TaskDetailPanel.js.map +1 -1
- package/dist/task-board/components/TaskReviewActions.d.ts +8 -0
- package/dist/task-board/components/TaskReviewActions.js +110 -0
- package/dist/task-board/components/TaskReviewActions.js.map +1 -0
- package/dist/task-board/components/TaskRow.js +1 -1
- package/dist/task-board/components/TaskRow.js.map +1 -1
- package/dist/task-board/components/WizardCommunicationCenter.d.ts +30 -0
- package/dist/task-board/components/WizardCommunicationCenter.js +185 -0
- package/dist/task-board/components/WizardCommunicationCenter.js.map +1 -0
- package/dist/task-board/taskAgentConfig.d.ts +1 -3
- package/dist/task-board/taskAgentConfig.js +5 -15
- package/dist/task-board/taskAgentConfig.js.map +1 -1
- package/dist/task-board/taskAgentLink.js +4 -2
- package/dist/task-board/taskAgentLink.js.map +1 -1
- package/dist/task-board/taskBoardNavStore.d.ts +0 -1
- package/dist/task-board/taskBoardNavStore.js +0 -1
- package/dist/task-board/taskBoardNavStore.js.map +1 -1
- package/dist/task-board/taskExecutionStatus.js +13 -3
- package/dist/task-board/taskExecutionStatus.js.map +1 -1
- package/dist/task-board/types.d.ts +2 -0
- package/dist/task-board/views/KanbanView.js +3 -0
- package/dist/task-board/views/KanbanView.js.map +1 -1
- package/dist/task-board/views/ListView.js +3 -0
- package/dist/task-board/views/ListView.js.map +1 -1
- package/dist/task-board/views/WizardView.d.ts +9 -7
- package/dist/task-board/views/WizardView.js +164 -39
- package/dist/task-board/views/WizardView.js.map +1 -1
- package/dist/types.d.ts +19 -1
- package/package.json +1 -2
- package/styles.css +9 -10
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import React, { useEffect, useState, useRef, useCallback, useLayoutEffect, useMemo, } from "react";
|
|
3
|
-
import { Send, AlertCircle, Loader2, User, Wand2, Square, Mic, MicOff, ChevronDown, ChevronUp, ListTodo, ArrowLeft, DollarSign, ExternalLink, Settings2, Target,
|
|
4
|
-
import { getAgent, startAgent, updateAgentSettings, updateAgentCostLimit, updateAgentContext,
|
|
3
|
+
import { Send, AlertCircle, Loader2, User, Wand2, Square, Mic, MicOff, ChevronDown, ChevronUp, ListTodo, ArrowLeft, DollarSign, ExternalLink, Settings2, Target, X, } from "lucide-react";
|
|
4
|
+
import { getAgent, startAgent, updateAgentSettings, updateAgentCostLimit, updateAgentContext, getAgentSkillCatalog, getAgentTriggerSubscriptions, cancelAgent, canonicalizeAgentMetadata, getPendingPrompts, } from "../services/agentService";
|
|
5
5
|
import { useEditContext, useFieldsEditContext } from "../client/editContext";
|
|
6
6
|
import { localStorageService } from "../services/localStorageService";
|
|
7
7
|
import { Textarea } from "../../components/ui/textarea";
|
|
8
8
|
import { Button } from "../../components/ui/button";
|
|
9
|
-
import { Input } from "../../components/ui/input";
|
|
10
9
|
import { PlaceholderInput, } from "../../components/ui/PlaceholderInput";
|
|
11
10
|
import { AiResponseMessage } from "./AiResponseMessage";
|
|
12
11
|
import { ContextInfoBar } from "./ContextInfoBar";
|
|
@@ -16,6 +15,7 @@ import { SpawnedAgentsPanel } from "./SpawnedAgentsPanel";
|
|
|
16
15
|
import { getComponentById } from "../componentTreeHelper";
|
|
17
16
|
import { AgentGreeting } from "./AgentGreeting";
|
|
18
17
|
import { getAgentHistory } from "../services/editService";
|
|
18
|
+
import { QuestionnaireInline } from "./dialogs/QuestionnaireInline";
|
|
19
19
|
import { Popover, PopoverContent, PopoverTrigger, } from "../../components/ui/popover";
|
|
20
20
|
import { SecretAgentIcon } from "../ui/Icons";
|
|
21
21
|
import { formatTime, formatDateTime } from "../utils";
|
|
@@ -24,6 +24,7 @@ import { Select } from "../../components/ui/select";
|
|
|
24
24
|
import { AgentTerminalStatusBar } from "./AgentTerminalStatusBar";
|
|
25
25
|
import { useMediaQuery } from "../client/hooks/useMediaQuery";
|
|
26
26
|
import { SimpleTabs } from "../ui/SimpleTabs";
|
|
27
|
+
import { ScrollingContentTree } from "../ScrollingContentTree";
|
|
27
28
|
function buildPlaceholderAgentDetails(agentStub) {
|
|
28
29
|
const now = new Date().toISOString();
|
|
29
30
|
const updated = agentStub.updatedDate || now;
|
|
@@ -659,7 +660,7 @@ const convertAgentMessagesToAiFormat = (agentMessages) => {
|
|
|
659
660
|
// interface AgentTerminalProps {
|
|
660
661
|
// agentStub: Agent;
|
|
661
662
|
// }
|
|
662
|
-
export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive = true, compact = false, hideContext = false, hideBottomControls = false, hideGreeting = false, simpleMode = false, className, initialPrompt, onAgentUpdate, }) {
|
|
663
|
+
export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive = true, compact = false, displayMode = "full", showSummaryInput = false, hideContext = false, hideBottomControls = false, hideGreeting = false, simpleMode = false, className, initialPrompt, onAgentUpdate, onInteractionSubmitted, questionnaireFooterActions, hideSummaryMessages = false, summaryPlaceholderActions, hideSummaryWaitingPlaceholder = false, }) {
|
|
663
664
|
const editContext = useEditContext();
|
|
664
665
|
const fieldsContext = useFieldsEditContext();
|
|
665
666
|
const [agent, setAgent] = useState(() => buildPlaceholderAgentDetails(agentStub));
|
|
@@ -782,8 +783,9 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
782
783
|
const [hiddenContextPanelTabIds, setHiddenContextPanelTabIds] = useState(new Set());
|
|
783
784
|
const [showCostAndAgent, setShowCostAndAgent] = useState(false);
|
|
784
785
|
const [showAgentSettings, setShowAgentSettings] = useState(false);
|
|
785
|
-
const [skillSearchTerm, setSkillSearchTerm] = useState("");
|
|
786
786
|
const [availableSkills, setAvailableSkills] = useState([]);
|
|
787
|
+
const [skillRootIds, setSkillRootIds] = useState([]);
|
|
788
|
+
const [selectableTemplateIds, setSelectableTemplateIds] = useState([]);
|
|
787
789
|
const [skillsLoading, setSkillsLoading] = useState(false);
|
|
788
790
|
const [skillsError, setSkillsError] = useState(null);
|
|
789
791
|
const [triggerSubscriptions, setTriggerSubscriptions] = useState([]);
|
|
@@ -889,14 +891,19 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
889
891
|
try {
|
|
890
892
|
setSkillsLoading(true);
|
|
891
893
|
setSkillsError(null);
|
|
892
|
-
const
|
|
894
|
+
const catalog = await getAgentSkillCatalog(false);
|
|
893
895
|
if (active) {
|
|
894
|
-
setAvailableSkills(skills.filter((s) => !s.disabled));
|
|
896
|
+
setAvailableSkills(catalog.skills.filter((s) => !s.disabled));
|
|
897
|
+
setSkillRootIds(catalog.rootIds);
|
|
898
|
+
setSelectableTemplateIds(catalog.selectableTemplateIds);
|
|
895
899
|
}
|
|
896
900
|
}
|
|
897
901
|
catch (e) {
|
|
898
902
|
if (active) {
|
|
899
903
|
setSkillsError(e?.message || "Failed to load skills");
|
|
904
|
+
setAvailableSkills([]);
|
|
905
|
+
setSkillRootIds([]);
|
|
906
|
+
setSelectableTemplateIds([]);
|
|
900
907
|
}
|
|
901
908
|
}
|
|
902
909
|
finally {
|
|
@@ -1031,23 +1038,13 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
1031
1038
|
}
|
|
1032
1039
|
return availableSkills.filter((skill) => allowedProfileSkillIdSet.has(skill.id.toLowerCase()));
|
|
1033
1040
|
}, [availableSkills, allowedProfileSkillIdSet]);
|
|
1041
|
+
const profileFilteredSkillIdSet = useMemo(() => new Set(profileFilteredSkills.map((skill) => skill.id.toLowerCase())), [profileFilteredSkills]);
|
|
1042
|
+
const selectableTemplateIdSet = useMemo(() => new Set(selectableTemplateIds.map((id) => id.toLowerCase())), [selectableTemplateIds]);
|
|
1034
1043
|
const selectedSkills = useMemo(() => selectedSkillIds
|
|
1035
1044
|
.map((id) => profileFilteredSkills.find((s) => s.id.toLowerCase() === id.toLowerCase()))
|
|
1036
1045
|
.filter((s) => !!s), [profileFilteredSkills, selectedSkillIds]);
|
|
1037
1046
|
const selectedSkillSet = useMemo(() => new Set(selectedSkillIds.map((id) => id.toLowerCase())), [selectedSkillIds]);
|
|
1038
1047
|
const backendAssignedSkillSet = useMemo(() => new Set(backendAssignedSkillIds.map((id) => id.toLowerCase())), [backendAssignedSkillIds]);
|
|
1039
|
-
const selectableSkills = useMemo(() => profileFilteredSkills.filter((skill) => !selectedSkillSet.has(skill.id.toLowerCase())), [profileFilteredSkills, selectedSkillSet]);
|
|
1040
|
-
const filteredSelectableSkills = useMemo(() => {
|
|
1041
|
-
const q = skillSearchTerm.trim().toLowerCase();
|
|
1042
|
-
if (!q)
|
|
1043
|
-
return selectableSkills;
|
|
1044
|
-
return selectableSkills.filter((skill) => {
|
|
1045
|
-
const name = (skill.name || "").toLowerCase();
|
|
1046
|
-
const description = (skill.description || "").toLowerCase();
|
|
1047
|
-
const id = (skill.id || "").toLowerCase();
|
|
1048
|
-
return name.includes(q) || description.includes(q) || id.includes(q);
|
|
1049
|
-
});
|
|
1050
|
-
}, [selectableSkills, skillSearchTerm]);
|
|
1051
1048
|
// Remove deprecated cost limit fields from metadata to avoid confusion with agent/profile settings
|
|
1052
1049
|
const sanitizeAgentMetadata = useCallback((meta) => {
|
|
1053
1050
|
try {
|
|
@@ -3241,7 +3238,17 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
3241
3238
|
return;
|
|
3242
3239
|
}
|
|
3243
3240
|
console.log("[AgentTerminal] Received inline dialog request:", request);
|
|
3244
|
-
setActiveInlineDialog({
|
|
3241
|
+
setActiveInlineDialog({
|
|
3242
|
+
request,
|
|
3243
|
+
onComplete: (result) => {
|
|
3244
|
+
onComplete(result);
|
|
3245
|
+
onInteractionSubmitted?.();
|
|
3246
|
+
},
|
|
3247
|
+
onCancel: () => {
|
|
3248
|
+
onCancel();
|
|
3249
|
+
onInteractionSubmitted?.();
|
|
3250
|
+
},
|
|
3251
|
+
});
|
|
3245
3252
|
// Notify AgentDialogHandler that we accepted the dialog (stops retry mechanism)
|
|
3246
3253
|
if (request.callbackId) {
|
|
3247
3254
|
window.dispatchEvent(new CustomEvent("agent:dialog:accepted", {
|
|
@@ -3397,6 +3404,17 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
3397
3404
|
.trim();
|
|
3398
3405
|
return cleaned || fallback;
|
|
3399
3406
|
};
|
|
3407
|
+
const cancelActiveInlineDialog = useCallback(() => {
|
|
3408
|
+
const activeDialog = activeInlineDialogRef.current;
|
|
3409
|
+
if (!activeDialog)
|
|
3410
|
+
return;
|
|
3411
|
+
try {
|
|
3412
|
+
activeDialog.onCancel();
|
|
3413
|
+
}
|
|
3414
|
+
finally {
|
|
3415
|
+
setActiveInlineDialog(null);
|
|
3416
|
+
}
|
|
3417
|
+
}, []);
|
|
3400
3418
|
const handleSubmit = async () => {
|
|
3401
3419
|
// Guard against double-submit and missing context
|
|
3402
3420
|
if (isSubmitting) {
|
|
@@ -3440,6 +3458,8 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
3440
3458
|
setError("Agent not ready. Please try again.");
|
|
3441
3459
|
return;
|
|
3442
3460
|
}
|
|
3461
|
+
// A new user prompt supersedes any active questionnaire/inline dialog.
|
|
3462
|
+
cancelActiveInlineDialog();
|
|
3443
3463
|
// Generate a temporary ID for optimistic UI - will be replaced by server ID
|
|
3444
3464
|
const tempMessageId = `temp-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
3445
3465
|
try {
|
|
@@ -3569,6 +3589,7 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
3569
3589
|
...prev.filter((p) => p !== savedPrompt).slice(0, 9),
|
|
3570
3590
|
]);
|
|
3571
3591
|
setCurrentHistoryIndex(-1);
|
|
3592
|
+
await onInteractionSubmitted?.();
|
|
3572
3593
|
// WebSocket connection is already active via subscription - no need for SSE
|
|
3573
3594
|
}
|
|
3574
3595
|
catch (err) {
|
|
@@ -3801,6 +3822,7 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
3801
3822
|
await startAgent(request);
|
|
3802
3823
|
// If user changed mode/model while the agent was new, persist them now
|
|
3803
3824
|
await persistPendingSettingsIfNeeded();
|
|
3825
|
+
await onInteractionSubmitted?.();
|
|
3804
3826
|
// WebSocket connection is already active via subscription - no need for SSE
|
|
3805
3827
|
}
|
|
3806
3828
|
catch (err) {
|
|
@@ -4343,9 +4365,7 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
4343
4365
|
detail: { agentId: parentAgentId },
|
|
4344
4366
|
}));
|
|
4345
4367
|
}, [parentAgentId]);
|
|
4346
|
-
|
|
4347
|
-
return (_jsx("div", { className: "flex h-full items-center justify-center", children: _jsxs("div", { className: "flex items-center gap-2 text-[11px] text-gray-500", children: [_jsx(Loader2, { className: "h-4 w-4 animate-spin", strokeWidth: 1 }), "Loading agent..."] }) }));
|
|
4348
|
-
}
|
|
4368
|
+
const loadingContent = isLoading && !activeInlineDialog ? (_jsx("div", { className: "flex h-full items-center justify-center", children: _jsxs("div", { className: "flex items-center gap-2 text-[11px] text-gray-500", children: [_jsx(Loader2, { className: "h-4 w-4 animate-spin", strokeWidth: 1 }), "Loading agent..."] }) })) : null;
|
|
4349
4369
|
const renderContextInfoBar = () => (_jsx(ContextInfoBar, { agent: agent, agentMetadata: agentMetadata, setAgentMetadata: setAgentMetadata, setAgent: setAgent, resolvedPageName: resolvedPageName, resolvedComponentName: resolvedComponentName, resolvedFieldName: resolvedFieldName, isLiveEditorContextMode: isLiveEditorContextMode, onRefreshContext: handleRefreshContext }));
|
|
4350
4370
|
const renderCostLimitBanner = () => {
|
|
4351
4371
|
if (!costLimitExceeded)
|
|
@@ -4385,7 +4405,172 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
4385
4405
|
return null;
|
|
4386
4406
|
return (_jsx("div", { className: "m-3 rounded border border-red-300 bg-red-50 p-3 text-[11px] text-red-900", children: _jsxs("div", { className: "flex items-start gap-2", children: [_jsx(AlertCircle, { className: "mt-0.5 h-4 w-4 shrink-0 text-red-500", strokeWidth: 1 }), _jsxs("div", { className: "flex-1", children: [_jsx("div", { className: "mb-1 font-semibold", children: "Agent Error" }), _jsx("div", { className: "text-red-800", children: errorMessage })] })] }) }));
|
|
4387
4407
|
};
|
|
4388
|
-
|
|
4408
|
+
const renderInlineDialogContent = () => {
|
|
4409
|
+
if (!activeInlineDialog)
|
|
4410
|
+
return null;
|
|
4411
|
+
if (activeInlineDialog.request.dialogType === "questionnaire") {
|
|
4412
|
+
return (_jsx("div", { className: "agent-inline-dialog", children: _jsx(QuestionnaireInline, { title: activeInlineDialog.request.title, description: activeInlineDialog.request.description, parameters: activeInlineDialog.request.parameters, footerActions: questionnaireFooterActions, onClose: (result) => {
|
|
4413
|
+
activeInlineDialog.onComplete(result);
|
|
4414
|
+
setActiveInlineDialog(null);
|
|
4415
|
+
void onInteractionSubmitted?.();
|
|
4416
|
+
}, onCancel: () => {
|
|
4417
|
+
activeInlineDialog.onCancel();
|
|
4418
|
+
setActiveInlineDialog(null);
|
|
4419
|
+
} }) }));
|
|
4420
|
+
}
|
|
4421
|
+
const dialogRegistration = editContext?.configuration?.editor?.agentDialogs?.find((d) => d.dialogType === activeInlineDialog.request.dialogType);
|
|
4422
|
+
if (dialogRegistration) {
|
|
4423
|
+
const DialogComponent = dialogRegistration.component;
|
|
4424
|
+
return (_jsx("div", { className: "agent-inline-dialog", children: _jsx(DialogComponent, { title: activeInlineDialog.request.title, description: activeInlineDialog.request.description, parameters: activeInlineDialog.request.parameters, onClose: (result) => {
|
|
4425
|
+
activeInlineDialog.onComplete(result);
|
|
4426
|
+
setActiveInlineDialog(null);
|
|
4427
|
+
if (activeInlineDialog.request.dialogType === "questionnaire") {
|
|
4428
|
+
void onInteractionSubmitted?.();
|
|
4429
|
+
}
|
|
4430
|
+
}, onCancel: () => {
|
|
4431
|
+
activeInlineDialog.onCancel();
|
|
4432
|
+
setActiveInlineDialog(null);
|
|
4433
|
+
} }) }));
|
|
4434
|
+
}
|
|
4435
|
+
return (_jsx("div", { className: "agent-inline-dialog", children: _jsxs("div", { className: "p-4 text-sm text-red-500", children: ["Unknown dialog type: ", activeInlineDialog.request.dialogType] }) }));
|
|
4436
|
+
};
|
|
4437
|
+
const latestSummaryAssistantGroup = useMemo(() => {
|
|
4438
|
+
if (hideSummaryMessages)
|
|
4439
|
+
return null;
|
|
4440
|
+
const groups = groupConsecutiveMessages(messages);
|
|
4441
|
+
for (let groupIndex = groups.length - 1; groupIndex >= 0; groupIndex -= 1) {
|
|
4442
|
+
const group = groups[groupIndex];
|
|
4443
|
+
if (!group || group.type !== "assistant-group")
|
|
4444
|
+
continue;
|
|
4445
|
+
const filteredMessages = group.messages.filter((msg) => {
|
|
4446
|
+
const content = msg.content || "";
|
|
4447
|
+
return !content.startsWith("⚠️") || !content.includes("Cost limit");
|
|
4448
|
+
});
|
|
4449
|
+
if (filteredMessages.length === 0)
|
|
4450
|
+
continue;
|
|
4451
|
+
return {
|
|
4452
|
+
messages: filteredMessages,
|
|
4453
|
+
isLastGroup: groupIndex === groups.length - 1,
|
|
4454
|
+
};
|
|
4455
|
+
}
|
|
4456
|
+
return null;
|
|
4457
|
+
}, [messages, hideSummaryMessages]);
|
|
4458
|
+
const summaryModeContent = displayMode === "summary" ? (() => {
|
|
4459
|
+
const inlineDialog = renderInlineDialogContent();
|
|
4460
|
+
const summaryMessages = latestSummaryAssistantGroup
|
|
4461
|
+
? convertAgentMessagesToAiFormat(latestSummaryAssistantGroup.messages)
|
|
4462
|
+
: [];
|
|
4463
|
+
const summaryOperations = latestSummaryAssistantGroup
|
|
4464
|
+
? getOperationsForMessageGroup(summaryMessages, agentOperations)
|
|
4465
|
+
: [];
|
|
4466
|
+
return (_jsxs("div", { className: `flex h-full min-h-0 flex-col ${className || ""}`, children: [_jsxs("div", { ref: messagesContainerRef, className: "flex-1 overflow-y-auto", onScroll: handleScroll, children: [error && (_jsx("div", { className: "m-4 rounded-lg border-l-4 border-red-500 bg-red-50 p-3 select-text", children: _jsxs("div", { className: "flex items-start", children: [_jsx(AlertCircle, { className: "mt-0.5 h-5 w-5 text-red-400", strokeWidth: 1 }), _jsxs("div", { className: "ml-3", children: [_jsx("p", { className: "text-[11px] font-medium text-red-800", children: "Error" }), _jsx("p", { className: "mt-1 text-[11px] text-red-700", children: error })] })] }) })), messages.length === 0 &&
|
|
4467
|
+
!error &&
|
|
4468
|
+
hideGreeting &&
|
|
4469
|
+
(isSubmitting || isConnecting) && (_jsx("div", { className: "flex h-full items-center justify-center p-8", children: _jsxs("div", { className: "flex flex-col items-center gap-4", children: [activeProfile?.svgIcon ? (_jsx("div", { className: "flex h-16 w-16 items-center justify-center text-gray-400 [&>svg]:h-full [&>svg]:w-full", dangerouslySetInnerHTML: {
|
|
4470
|
+
__html: activeProfile.svgIcon,
|
|
4471
|
+
} })) : (_jsx(SecretAgentIcon, { size: 64, strokeWidth: 1, className: "text-gray-400" })), _jsxs("div", { className: "flex items-center gap-1", children: [_jsx("span", { className: "h-2 w-2 animate-bounce rounded-full bg-gray-400 [animation-delay:-0.3s]" }), _jsx("span", { className: "h-2 w-2 animate-bounce rounded-full bg-gray-400 [animation-delay:-0.15s]" }), _jsx("span", { className: "h-2 w-2 animate-bounce rounded-full bg-gray-400" })] })] }) })), renderErrorBanner(), inlineDialog ? (inlineDialog) : latestSummaryAssistantGroup ? (_jsx("div", { className: "space-y-0 divide-y divide-gray-100 select-text", children: _jsx(AiResponseMessage, { messages: summaryMessages, finished: !latestSummaryAssistantGroup.isLastGroup || !isExecuting, editOperations: summaryOperations, error: error || undefined, profileSvgIcon: activeProfile?.svgIcon, agentId: agent?.id || agentStub.id, agentName: activeProfile?.agentName ||
|
|
4472
|
+
activeProfile?.displayTitle ||
|
|
4473
|
+
activeProfile?.name, allPendingApprovals: allPendingApprovals, onSwitchToAutonomous: handleSwitchToAutonomous, onQuickAction: (action) => {
|
|
4474
|
+
const text = (action.prompt ||
|
|
4475
|
+
action.value ||
|
|
4476
|
+
action.label ||
|
|
4477
|
+
"").trim();
|
|
4478
|
+
if (!text)
|
|
4479
|
+
return;
|
|
4480
|
+
if (isExecuting) {
|
|
4481
|
+
try {
|
|
4482
|
+
handleStop();
|
|
4483
|
+
}
|
|
4484
|
+
catch { }
|
|
4485
|
+
}
|
|
4486
|
+
sendQuickMessage(text);
|
|
4487
|
+
} }) })) : hideSummaryWaitingPlaceholder ? (_jsx("div", { className: "flex h-full min-h-[220px] items-center justify-center p-6", children: summaryPlaceholderActions ? (_jsx("div", { className: "flex justify-center", children: summaryPlaceholderActions })) : null })) : (_jsx("div", { className: "flex h-full min-h-[220px] items-center justify-center p-6", children: _jsxs("div", { className: "max-w-md rounded-xl border border-slate-200 bg-slate-50 px-5 py-4 text-center text-sm text-slate-600", children: [_jsx("div", { children: shouldShowThinkingDots || isExecuting
|
|
4488
|
+
? "The agent is still working. The next update will appear here automatically."
|
|
4489
|
+
: agent?.statusMessage || "Waiting for the next agent update." }), summaryPlaceholderActions ? (_jsx("div", { className: "mt-3 flex justify-center", children: summaryPlaceholderActions })) : null] }) })), shouldShowThinkingDots &&
|
|
4490
|
+
!inlineDialog &&
|
|
4491
|
+
!latestSummaryAssistantGroup && (_jsxs("div", { className: "flex gap-3 px-4 py-3", "data-testid": "agent-thinking-dots", children: [_jsx("div", { className: "shrink-0", children: activeProfile?.svgIcon ? (_jsx("div", { className: "text-gray-2 flex h-6 w-6 items-center justify-center [&>svg]:h-full [&>svg]:w-full", dangerouslySetInnerHTML: {
|
|
4492
|
+
__html: activeProfile.svgIcon,
|
|
4493
|
+
} })) : (_jsx(SecretAgentIcon, { size: 20, strokeWidth: 1, className: "text-gray-2" })) }), _jsxs("div", { className: "min-w-0 flex-1", children: [_jsxs("div", { className: "mb-1 flex items-center gap-2", children: [_jsx("span", { className: "text-dark text-xs font-medium", children: activeProfile?.agentName ||
|
|
4494
|
+
activeProfile?.displayTitle ||
|
|
4495
|
+
activeProfile?.name ||
|
|
4496
|
+
"Agent" }), _jsx("span", { className: "text-xs text-gray-400", children: formatTime(new Date()) })] }), _jsxs("div", { className: "flex items-center gap-1 pt-2", children: [_jsx("div", { className: "h-1 w-1 animate-bounce rounded-full bg-gray-400 [animation-delay:-0.3s]" }), _jsx("div", { className: "h-1 w-1 animate-bounce rounded-full bg-gray-400 [animation-delay:-0.15s]" }), _jsx("div", { className: "h-1 w-1 animate-bounce rounded-full bg-gray-400" })] })] })] })), _jsx("div", { ref: messagesEndRef })] }), showSummaryInput && !activeInlineDialog ? (_jsxs("div", { className: cn("border-t border-gray-200 p-4", simpleMode && "pb-10"), children: [activePlaceholderInput ? (_jsx(PlaceholderInput, { ref: placeholderInputRef, text: activePlaceholderInput.text, showButtons: hideBottomControls, buttonsClassName: hideBottomControls ? "justify-end" : "", onFilledChange: setAllPlaceholdersFilled, onComplete: (filledText) => {
|
|
4497
|
+
setActivePlaceholderInput(null);
|
|
4498
|
+
setAllPlaceholdersFilled(false);
|
|
4499
|
+
if (activePlaceholderInput.behavior === "compose" &&
|
|
4500
|
+
!hideBottomControls) {
|
|
4501
|
+
setPrompt(filledText);
|
|
4502
|
+
setInputPlaceholder("Review and edit, then press Enter to send");
|
|
4503
|
+
if (textareaRef.current) {
|
|
4504
|
+
try {
|
|
4505
|
+
textareaRef.current.focus();
|
|
4506
|
+
const v = textareaRef.current.value || "";
|
|
4507
|
+
textareaRef.current.selectionStart = v.length;
|
|
4508
|
+
textareaRef.current.selectionEnd = v.length;
|
|
4509
|
+
}
|
|
4510
|
+
catch { }
|
|
4511
|
+
}
|
|
4512
|
+
}
|
|
4513
|
+
else {
|
|
4514
|
+
if (isExecuting) {
|
|
4515
|
+
try {
|
|
4516
|
+
handleStop();
|
|
4517
|
+
}
|
|
4518
|
+
catch { }
|
|
4519
|
+
}
|
|
4520
|
+
sendQuickMessage(filledText);
|
|
4521
|
+
}
|
|
4522
|
+
}, onCancel: () => {
|
|
4523
|
+
setActivePlaceholderInput(null);
|
|
4524
|
+
setAllPlaceholdersFilled(false);
|
|
4525
|
+
} })) : prompt && /\{\{[^{}]+\}\}|<<[^<>]+>>/.test(prompt) ? (_jsx(PlaceholderInput, { ref: promptPlaceholderInputRef, text: prompt, showButtons: hideBottomControls, buttonsClassName: hideBottomControls ? "justify-end" : "", onFilledChange: setAllPlaceholdersFilled, onComplete: (filledText) => {
|
|
4526
|
+
setPrompt(filledText);
|
|
4527
|
+
setAllPlaceholdersFilled(false);
|
|
4528
|
+
if (filledText.trim()) {
|
|
4529
|
+
if (isExecuting) {
|
|
4530
|
+
try {
|
|
4531
|
+
handleStop();
|
|
4532
|
+
}
|
|
4533
|
+
catch { }
|
|
4534
|
+
}
|
|
4535
|
+
sendQuickMessage(filledText);
|
|
4536
|
+
}
|
|
4537
|
+
}, onCancel: () => {
|
|
4538
|
+
setPrompt("");
|
|
4539
|
+
setAllPlaceholdersFilled(false);
|
|
4540
|
+
setInputPlaceholder("Type your message... (Enter to send, Shift+Enter or Ctrl+Enter for new line)");
|
|
4541
|
+
} })) : (_jsx("div", { className: "flex items-stretch gap-2", children: _jsx(Textarea, { ref: textareaRef, style: { viewTransitionName: "assistant-chat-input" }, value: prompt, onChange: (e) => {
|
|
4542
|
+
setPrompt(e.target.value);
|
|
4543
|
+
if (!/\{\{[^{}]+\}\}|<<[^<>]+>>/.test(e.target.value)) {
|
|
4544
|
+
setAllPlaceholdersFilled(false);
|
|
4545
|
+
}
|
|
4546
|
+
if (currentHistoryIndex !== -1) {
|
|
4547
|
+
setCurrentHistoryIndex(-1);
|
|
4548
|
+
}
|
|
4549
|
+
}, onKeyDown: handleKeyPress, onPaste: handlePaste, onFocus: () => {
|
|
4550
|
+
shouldMaintainFocusRef.current = true;
|
|
4551
|
+
}, onBlur: () => {
|
|
4552
|
+
shouldMaintainFocusRef.current = false;
|
|
4553
|
+
}, placeholder: inputPlaceholder, className: "max-h-[250px] min-h-[80px] flex-1 resize-y overflow-y-auto text-[12px] lg:max-h-[450px]", "data-testid": "agent-terminal-prompt", disabled: isSubmitting }) })), (() => {
|
|
4554
|
+
const isInPlaceholderMode = activePlaceholderInput ||
|
|
4555
|
+
(prompt && /\{\{[^{}]+\}\}|<<[^<>]+>>/.test(prompt));
|
|
4556
|
+
const placeholderShowsOwnButtons = hideBottomControls && isInPlaceholderMode;
|
|
4557
|
+
if (placeholderShowsOwnButtons)
|
|
4558
|
+
return null;
|
|
4559
|
+
return (_jsxs("div", { className: cn("mt-2 flex items-stretch gap-2", hideBottomControls || simpleMode || isInPlaceholderMode
|
|
4560
|
+
? "justify-end"
|
|
4561
|
+
: "justify-between"), children: [!hideBottomControls && !simpleMode && !isInPlaceholderMode ? (_jsx("div", { className: "flex-1" })) : null, _jsx(Button, { type: "button", size: "sm", onClick: () => {
|
|
4562
|
+
if (isExecuting) {
|
|
4563
|
+
handleStop();
|
|
4564
|
+
}
|
|
4565
|
+
else {
|
|
4566
|
+
handleSubmit();
|
|
4567
|
+
}
|
|
4568
|
+
}, disabled: !isExecuting &&
|
|
4569
|
+
!activePlaceholderInput &&
|
|
4570
|
+
(!prompt.trim() || isSubmitting), "data-testid": "agent-send-stop-button", children: isExecuting ? "Stop" : "Send" })] }));
|
|
4571
|
+
})()] })) : null] }));
|
|
4572
|
+
})() : null;
|
|
4573
|
+
return (loadingContent ? (loadingContent) : displayMode === "summary" && summaryModeContent ? (summaryModeContent) : (_jsxs("div", { className: `flex h-full min-h-0 flex-col ${className || ""}`, children: [parentAgentId && !simpleMode && (_jsx("div", { className: "border-b border-gray-200 bg-gray-50 px-4 py-2", children: _jsxs("button", { onClick: handleBackToParent, className: "flex items-center gap-2 text-[11px] text-gray-600 transition-colors hover:text-gray-900", title: "Back to parent agent", children: [_jsx(ArrowLeft, { className: "h-3.5 w-3.5", strokeWidth: 1.5 }), _jsx("span", { children: "Back to parent agent" })] }) })), _jsxs("div", { ref: messagesContainerRef, className: "flex-1 overflow-y-auto", onScroll: handleScroll, children: [error && (_jsx("div", { className: "m-4 rounded-lg border-l-4 border-red-500 bg-red-50 p-3 select-text", children: _jsxs("div", { className: "flex items-start", children: [_jsx(AlertCircle, { className: "mt-0.5 h-5 w-5 text-red-400", strokeWidth: 1 }), _jsxs("div", { className: "ml-3", children: [_jsx("p", { className: "text-[11px] font-medium text-red-800", children: "Error" }), _jsx("p", { className: "mt-1 text-[11px] text-red-700", children: error })] })] }) })), messages.length === 0 && !error && !hideGreeting && (_jsx("div", { className: "flex h-full items-center justify-center", children: !activeProfile ? (_jsx(Loader2, { className: "mx-auto h-8 w-8 animate-spin text-gray-400" })) : (_jsx(AgentGreeting, { profile: activeProfile, onPromptClick: (p) => {
|
|
4389
4574
|
setPrompt(p);
|
|
4390
4575
|
// Use setTimeout to ensure state is updated before submission
|
|
4391
4576
|
setTimeout(() => {
|
|
@@ -4556,23 +4741,7 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
4556
4741
|
new Date().toDateString()
|
|
4557
4742
|
? formatTime(new Date(qp.scheduledFor))
|
|
4558
4743
|
: formatDateTime(new Date(qp.scheduledFor))] })] }))] })] }) }) }, qp.id));
|
|
4559
|
-
}) })] }) })),
|
|
4560
|
-
(() => {
|
|
4561
|
-
// Look up dialog component from config
|
|
4562
|
-
const dialogRegistration = editContext?.configuration?.editor?.agentDialogs?.find((d) => d.dialogType === activeInlineDialog.request.dialogType);
|
|
4563
|
-
if (dialogRegistration) {
|
|
4564
|
-
const DialogComponent = dialogRegistration.component;
|
|
4565
|
-
return (_jsx("div", { className: "agent-inline-dialog", children: _jsx(DialogComponent, { title: activeInlineDialog.request.title, description: activeInlineDialog.request.description, parameters: activeInlineDialog.request.parameters, onClose: (result) => {
|
|
4566
|
-
activeInlineDialog.onComplete(result);
|
|
4567
|
-
setActiveInlineDialog(null);
|
|
4568
|
-
}, onCancel: () => {
|
|
4569
|
-
activeInlineDialog.onCancel();
|
|
4570
|
-
setActiveInlineDialog(null);
|
|
4571
|
-
} }) }));
|
|
4572
|
-
}
|
|
4573
|
-
// Fallback for unknown dialog types
|
|
4574
|
-
return (_jsx("div", { className: "agent-inline-dialog", children: _jsxs("div", { className: "p-4 text-sm text-red-500", children: ["Unknown dialog type: ", activeInlineDialog.request.dialogType] }) }));
|
|
4575
|
-
})(), _jsxs("div", { className: cn("border-t border-gray-200 p-4", simpleMode && "pb-10"), children: [activePlaceholderInput ? (
|
|
4744
|
+
}) })] }) })), renderInlineDialogContent(), _jsxs("div", { className: cn("border-t border-gray-200 p-4", simpleMode && "pb-10"), children: [activePlaceholderInput ? (
|
|
4576
4745
|
// Placeholder Input (from quick actions)
|
|
4577
4746
|
// Show internal buttons only in splash mode (hideBottomControls) since external buttons won't be visible there
|
|
4578
4747
|
_jsx(PlaceholderInput, { ref: placeholderInputRef, text: activePlaceholderInput.text, showButtons: hideBottomControls, buttonsClassName: hideBottomControls ? "justify-end" : "", onFilledChange: setAllPlaceholdersFilled, onComplete: (filledText) => {
|
|
@@ -4686,8 +4855,6 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
4686
4855
|
}
|
|
4687
4856
|
} }), _jsxs(Popover, { open: showAgentSettings, onOpenChange: (open) => {
|
|
4688
4857
|
setShowAgentSettings(open);
|
|
4689
|
-
if (!open)
|
|
4690
|
-
setSkillSearchTerm("");
|
|
4691
4858
|
}, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { size: "xs", variant: "outline", className: "h-5 rounded border px-1.5 text-[11px] text-gray-600", "data-testid": "agent-settings-popover-trigger", children: [_jsx(Settings2, { className: "mr-1 h-3 w-3", strokeWidth: 1 }), "Agent settings"] }) }), _jsx(PopoverContent, { className: "w-80 p-3", align: "start", children: _jsxs("div", { className: "space-y-3", children: [profiles?.length > 0 && (_jsxs("div", { children: [_jsx("div", { className: "mb-1 text-[11px] font-medium text-gray-700", children: "Agent profile" }), _jsx(Select, { size: "xs", maxWidth: 300, searchable: profiles.length > 5, searchPlaceholder: "Filter profiles...", className: "h-6 w-full rounded border px-1.5 text-[11px] text-gray-500", value: activeProfile?.id || "", options: profileOptions, "data-testid": "agent-profile-selector", onValueChange: async (val) => {
|
|
4692
4859
|
const nextProfile = profiles.find((x) => x.id === val);
|
|
4693
4860
|
if (!nextProfile)
|
|
@@ -4759,21 +4926,34 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
4759
4926
|
catch (err) {
|
|
4760
4927
|
console.error("Failed to persist agent model", err);
|
|
4761
4928
|
}
|
|
4762
|
-
} })] })) : null, _jsxs("div", { children: [_jsxs("div", { className: "mb-1 flex items-center gap-1 text-[11px] font-medium text-gray-700", children: [_jsx(Target, { className: "h-3 w-3", strokeWidth: 1 }), "Skills"] }),
|
|
4929
|
+
} })] })) : null, _jsxs("div", { children: [_jsxs("div", { className: "mb-1 flex items-center gap-1 text-[11px] font-medium text-gray-700", children: [_jsx(Target, { className: "h-3 w-3", strokeWidth: 1 }), "Skills"] }), selectedSkillIds.length > 0 && (_jsx("div", { className: "mb-2 flex flex-wrap gap-1", children: selectedSkillIds.map((skillId) => {
|
|
4763
4930
|
const skill = selectedSkills.find((s) => s.id === skillId);
|
|
4764
4931
|
return (_jsxs("div", { className: "inline-flex items-center gap-1 rounded-full border border-gray-200 bg-gray-100 px-1.5 py-0.5 text-[10px] text-gray-700", children: [_jsx("span", { children: skill?.name || skillId }), _jsx("button", { type: "button", className: "rounded p-0.5 text-gray-500 hover:bg-gray-200 hover:text-gray-700", title: "Open skill item", "aria-label": `Open ${skill?.name || skillId}`, onClick: () => {
|
|
4765
4932
|
void handleOpenSkillItem(skillId);
|
|
4766
4933
|
}, children: _jsx(ExternalLink, { className: "h-2.5 w-2.5", strokeWidth: 1.5 }) }), backendAssignedSkillSet.has(skillId.toLowerCase()) ? (_jsx("span", { className: "text-[9px] text-gray-500", children: "auto" })) : (_jsx("button", { type: "button", className: "rounded p-0.5 text-gray-500 hover:bg-gray-200 hover:text-gray-700", onClick: () => {
|
|
4767
4934
|
void handleRemoveSkill(skillId);
|
|
4768
4935
|
}, title: "Remove skill", "aria-label": `Remove ${skill?.name || skillId}`, children: _jsx(X, { className: "h-2.5 w-2.5", strokeWidth: 1 }) }))] }, skillId));
|
|
4769
|
-
}) })),
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4936
|
+
}) })), _jsxs("div", { className: "relative h-40 rounded border border-gray-200 bg-gray-50", children: [_jsx(ScrollingContentTree, { rootItemIds: skillRootIds, selectedItemId: selectedSkillIds[selectedSkillIds.length - 1] || undefined, expandedItemId: selectedSkillIds[selectedSkillIds.length - 1] ||
|
|
4937
|
+
skillRootIds[0], scrollToSelected: true, hideRootNodes: false, onSelectionChange: (selection) => {
|
|
4938
|
+
const selected = selection[0];
|
|
4939
|
+
if (!selected?.id)
|
|
4940
|
+
return;
|
|
4941
|
+
if (selectableTemplateIdSet.size > 0 &&
|
|
4942
|
+
(!selected.templateId ||
|
|
4943
|
+
!selectableTemplateIdSet.has(selected.templateId.toLowerCase()))) {
|
|
4944
|
+
return;
|
|
4945
|
+
}
|
|
4946
|
+
if (!profileFilteredSkillIdSet.has(selected.id.toLowerCase())) {
|
|
4947
|
+
return;
|
|
4948
|
+
}
|
|
4949
|
+
void handleAddSkill(selected.id);
|
|
4950
|
+
} }), skillsLoading && (_jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-background/70 text-[10px] text-gray-500", children: "Loading skills..." }))] }), !skillsLoading && profileFilteredSkills.length > 0 && (_jsx("div", { className: "mt-1 text-[10px] text-gray-500", children: "Click a skill item in the tree to add it." })), skillsError && (_jsx("div", { className: "mt-1 text-[10px] text-red-600", children: skillsError })), !skillsLoading &&
|
|
4951
|
+
!skillsError &&
|
|
4952
|
+
skillRootIds.length === 0 && (_jsx("div", { className: "mt-1 text-[10px] text-gray-500", children: "No skill roots available." })), !skillsLoading &&
|
|
4953
|
+
!skillsError &&
|
|
4954
|
+
profileFilteredSkills.length === 0 && (_jsx("div", { className: "mt-1 text-[10px] text-gray-500", children: selectedSkillIds.length > 0
|
|
4955
|
+
? "All allowed skills are selected"
|
|
4956
|
+
: "No skills available for this profile" }))] }), _jsxs("div", { children: [_jsx("div", { className: "mb-1 text-[11px] font-medium text-gray-700", children: "Subscribed triggers" }), _jsx("div", { className: "max-h-28 space-y-1 overflow-y-auto rounded border border-gray-200 bg-gray-50 p-1.5", children: triggerSubscriptionsLoading ? (_jsx("div", { className: "px-1 text-[10px] text-gray-500", children: "Loading subscribed triggers..." })) : activeTriggerSubscriptions.length > 0 ? (activeTriggerSubscriptions.map((sub) => {
|
|
4777
4957
|
const filterText = (sub.filter || "").trim();
|
|
4778
4958
|
return (_jsxs("div", { className: "rounded border border-gray-200 bg-white px-1.5 py-1", children: [_jsx("div", { className: "truncate text-[10px] font-medium text-gray-800", children: sub.triggerName }), filterText.length > 0 && (_jsxs("div", { className: "mt-0.5 line-clamp-2 break-all text-[9px] text-gray-500", children: ["filter: ", filterText] }))] }, sub.id));
|
|
4779
4959
|
})) : (_jsx("div", { className: "px-1 text-[10px] text-gray-500", children: "No active trigger subscriptions" })) }), triggerSubscriptionsError && (_jsx("div", { className: "mt-1 text-[10px] text-red-600", children: triggerSubscriptionsError }))] })] }) })] }), activeProfile?.prompts?.length ? (_jsxs(Popover, { open: showPredefined, onOpenChange: setShowPredefined, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx("button", { className: "rounded p-1 hover:bg-gray-100", onClick: () => { }, title: "Predefined prompts", "aria-label": "Predefined prompts", type: "button", children: _jsx(Wand2, { className: "h-3 w-3", strokeWidth: 1 }) }) }), _jsx(PopoverContent, { className: "w-64 p-0", align: "start", children: _jsx("div", { className: "max-h-56 overflow-y-auto p-2", children: activeProfile.prompts.map((p, index) => (_jsx("div", { className: "cursor-pointer rounded p-1.5 text-[10px] text-gray-700 hover:bg-gray-100", onClick: () => {
|
|
@@ -4829,6 +5009,6 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
4829
5009
|
cacheWriteCost: liveTotals.cacheWriteCost ?? 0,
|
|
4830
5010
|
totalCost: liveTotals.totalCost,
|
|
4831
5011
|
}
|
|
4832
|
-
: totalTokens, effectiveCostLimit: effectiveCostLimit, messages: messages, showCompressionPopover: showCompressionPopover, setShowCompressionPopover: setShowCompressionPopover }))] })] }));
|
|
5012
|
+
: totalTokens, effectiveCostLimit: effectiveCostLimit, messages: messages, showCompressionPopover: showCompressionPopover, setShowCompressionPopover: setShowCompressionPopover }))] })] })));
|
|
4833
5013
|
}
|
|
4834
5014
|
//# sourceMappingURL=AgentTerminal.js.map
|