@parhelia/core 0.1.12397 → 0.1.12404
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/components/ui/input.d.ts +1 -1
- package/dist/components/ui/input.js +5 -3
- package/dist/components/ui/input.js.map +1 -1
- package/dist/editor/FieldHistory.js +47 -17
- package/dist/editor/FieldHistory.js.map +1 -1
- package/dist/editor/ai/AgentTerminal.js +136 -23
- package/dist/editor/ai/AgentTerminal.js.map +1 -1
- package/dist/editor/ai/AgentTerminalStatusBar.d.ts +5 -1
- package/dist/editor/ai/AgentTerminalStatusBar.js +182 -22
- package/dist/editor/ai/AgentTerminalStatusBar.js.map +1 -1
- package/dist/editor/ai/ContentInspectorPopover.js +105 -24
- package/dist/editor/ai/ContentInspectorPopover.js.map +1 -1
- package/dist/editor/ai/ContextInfoBar.d.ts +2 -1
- package/dist/editor/ai/ContextInfoBar.js +9 -6
- package/dist/editor/ai/ContextInfoBar.js.map +1 -1
- package/dist/editor/ai/agentDiagnostics.d.ts +36 -0
- package/dist/editor/ai/agentDiagnostics.js +120 -0
- package/dist/editor/ai/agentDiagnostics.js.map +1 -0
- package/dist/editor/ai/dialogs/QuestionnaireInline.d.ts +2 -1
- package/dist/editor/ai/dialogs/QuestionnaireInline.js +452 -63
- package/dist/editor/ai/dialogs/QuestionnaireInline.js.map +1 -1
- package/dist/editor/ai/dialogs/agentDialogTypes.d.ts +27 -5
- package/dist/editor/ai/dialogs/agentDialogTypes.js.map +1 -1
- package/dist/editor/client/EditorShell.js +8 -0
- package/dist/editor/client/EditorShell.js.map +1 -1
- package/dist/editor/client/editContext.d.ts +2 -0
- package/dist/editor/client/editContext.js.map +1 -1
- package/dist/editor/client/hooks/useEditorWebSocket.d.ts +3 -0
- package/dist/editor/client/hooks/useEditorWebSocket.js +66 -1
- package/dist/editor/client/hooks/useEditorWebSocket.js.map +1 -1
- package/dist/editor/client/socketDiagnostics.d.ts +19 -0
- package/dist/editor/client/socketDiagnostics.js +32 -0
- package/dist/editor/client/socketDiagnostics.js.map +1 -0
- package/dist/editor/reviews/CreateReviewDetailsStep.d.ts +1 -1
- package/dist/editor/reviews/CreateReviewDialog.js +3 -2
- package/dist/editor/reviews/CreateReviewDialog.js.map +1 -1
- package/dist/editor/services/agentService.d.ts +57 -0
- package/dist/editor/services/agentService.js +30 -0
- package/dist/editor/services/agentService.js.map +1 -1
- package/dist/editor/services/aiService.d.ts +5 -0
- package/dist/editor/services/aiService.js.map +1 -1
- package/dist/editor/services/contentService.js.map +1 -1
- package/dist/editor/settings/panels/AgentProfileConfigPanel.js +1 -0
- package/dist/editor/settings/panels/AgentProfileConfigPanel.js.map +1 -1
- package/dist/editor/settings/panels/ProjectTemplatesPanel.js +15 -103
- package/dist/editor/settings/panels/ProjectTemplatesPanel.js.map +1 -1
- package/dist/editor/ui/ItemCollectionEditor.d.ts +2 -1
- package/dist/editor/ui/ItemCollectionEditor.js +70 -27
- package/dist/editor/ui/ItemCollectionEditor.js.map +1 -1
- package/dist/editor/ui/TreeListSelector.d.ts +4 -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/task-board/TaskBoardWorkspace.js +8 -16
- package/dist/task-board/TaskBoardWorkspace.js.map +1 -1
- package/dist/task-board/components/ItemCollectionEditorDialog.js +28 -17
- package/dist/task-board/components/ItemCollectionEditorDialog.js.map +1 -1
- package/dist/task-board/components/TaskAssigneePicker.d.ts +3 -2
- package/dist/task-board/components/TaskAssigneePicker.js +10 -6
- package/dist/task-board/components/TaskAssigneePicker.js.map +1 -1
- package/dist/task-board/services/taskService.d.ts +1 -0
- package/dist/task-board/services/taskService.js +8 -0
- package/dist/task-board/services/taskService.js.map +1 -1
- package/dist/task-board/utils/taskDependencyOrdering.d.ts +3 -0
- package/dist/task-board/utils/taskDependencyOrdering.js +64 -0
- package/dist/task-board/utils/taskDependencyOrdering.js.map +1 -0
- package/dist/task-board/views/WizardView.js +5 -15
- package/dist/task-board/views/WizardView.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
declare
|
|
2
|
+
declare const Input: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
3
3
|
export { Input };
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
2
3
|
import { cn } from "../../lib/utils";
|
|
3
|
-
function Input({ className, type, ...props }) {
|
|
4
|
-
return (_jsx("input", { type: type, "data-slot": "input", className: cn("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex w-full min-w-0 rounded-md border bg-transparent p-1 px-3 text-base transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-xs file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-xs",
|
|
4
|
+
const Input = React.forwardRef(function Input({ className, type, ...props }, ref) {
|
|
5
|
+
return (_jsx("input", { ref: ref, type: type, "data-slot": "input", className: cn("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex w-full min-w-0 rounded-md border bg-transparent p-1 px-3 text-base transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-xs file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-xs",
|
|
5
6
|
// Use outline for focus instead of ring (box-shadow) so it doesn't override .focus-shadow
|
|
6
7
|
"focus-visible:border-ring focus-visible:outline-ring/70 focus-visible:outline focus-visible:-outline-offset-2", "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", className), ...props }));
|
|
7
|
-
}
|
|
8
|
+
});
|
|
9
|
+
Input.displayName = "Input";
|
|
8
10
|
export { Input };
|
|
9
11
|
//# sourceMappingURL=input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/components/ui/input.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../../src/components/ui/input.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAErC,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAG5B,SAAS,KAAK,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG;IACjD,OAAO,CACL,gBACE,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,eACA,OAAO,EACjB,SAAS,EAAE,EAAE,CACX,kbAAkb;QAClb,0FAA0F;QAC1F,+GAA+G,EAC/G,wGAAwG,EACxG,SAAS,CACV,KACG,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC;AAE5B,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { getFieldHistory } from "../editor/services/editService";
|
|
3
3
|
import { useEffect } from "react";
|
|
4
4
|
import { useState } from "react";
|
|
@@ -6,12 +6,36 @@ import { useEditContext } from "./client/editContext";
|
|
|
6
6
|
import { formatDate } from "./utils";
|
|
7
7
|
import { SimpleTable } from "./ui/SimpleTable";
|
|
8
8
|
import { SimpleIconButton } from "./ui/SimpleIconButton";
|
|
9
|
-
import { Undo } from "lucide-react";
|
|
9
|
+
import { Brush, FileText, GalleryVertical, GitCompare, Undo } from "lucide-react";
|
|
10
10
|
import { Checkbox } from "../components/ui/checkbox";
|
|
11
|
+
import { cn } from "../lib/utils";
|
|
12
|
+
import { DiffView } from "./reviews/DiffView";
|
|
13
|
+
function isTextLikeFieldType(type) {
|
|
14
|
+
return (type === "raw" ||
|
|
15
|
+
type === "single-line text" ||
|
|
16
|
+
type === "multi-line text" ||
|
|
17
|
+
type === "rich text");
|
|
18
|
+
}
|
|
19
|
+
function fieldHistoryEntriesEqual(a, b) {
|
|
20
|
+
return (a.date === b.date &&
|
|
21
|
+
a.version === b.version &&
|
|
22
|
+
a.rawValue === b.rawValue &&
|
|
23
|
+
a.user === b.user &&
|
|
24
|
+
a.agentId === b.agentId &&
|
|
25
|
+
a.ai === b.ai &&
|
|
26
|
+
a.undone === b.undone);
|
|
27
|
+
}
|
|
28
|
+
function isCurrentHistoryEntry(item, fieldHistory) {
|
|
29
|
+
const latestEntry = fieldHistory[0];
|
|
30
|
+
return latestEntry ? fieldHistoryEntriesEqual(item, latestEntry) : false;
|
|
31
|
+
}
|
|
11
32
|
export function FieldHistory({ field, onRevert, configuration, showRawValue: initialShowRawValue, }) {
|
|
12
33
|
const [fieldHistory, setFieldHistory] = useState([]);
|
|
13
34
|
const [selectedEntry, setSelectedEntry] = useState();
|
|
14
35
|
const [showRawValue, setShowRawValue] = useState(initialShowRawValue);
|
|
36
|
+
const [viewMode, setViewMode] = useState("plain");
|
|
37
|
+
const [ignoreFormatting, setIgnoreFormatting] = useState(false);
|
|
38
|
+
const [clipUnchanged, setClipUnchanged] = useState(true);
|
|
15
39
|
const editContext = useEditContext();
|
|
16
40
|
if (!editContext) {
|
|
17
41
|
return null;
|
|
@@ -44,39 +68,45 @@ export function FieldHistory({ field, onRevert, configuration, showRawValue: ini
|
|
|
44
68
|
collapsed.push(entry);
|
|
45
69
|
}
|
|
46
70
|
setFieldHistory(collapsed);
|
|
71
|
+
setSelectedEntry(collapsed[0]);
|
|
47
72
|
});
|
|
48
73
|
}, [field]);
|
|
49
74
|
if (fieldHistory.length === 0)
|
|
50
75
|
return (_jsx("div", { "data-testid": "field-history", className: "h-[500px] flex items-center justify-center", children: _jsx("div", { className: "p-2 text-xs text-gray-500", children: "No history" }) }));
|
|
76
|
+
const effectiveFieldType = showRawValue ? "raw" : field.type;
|
|
77
|
+
const isTextLike = isTextLikeFieldType(effectiveFieldType);
|
|
51
78
|
// Render field editor for preview - always visible to avoid layout shifts
|
|
52
79
|
const renderFieldEditor = () => {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
80
|
+
if (!selectedEntry)
|
|
81
|
+
return null;
|
|
82
|
+
const displayField = {
|
|
83
|
+
...field,
|
|
84
|
+
value: selectedEntry.value,
|
|
85
|
+
rawValue: selectedEntry.rawValue,
|
|
86
|
+
isHistoric: true,
|
|
87
|
+
};
|
|
61
88
|
const fieldType = showRawValue ? "raw" : field.type;
|
|
62
89
|
const typeConfig = configuration.fieldTypes[fieldType] ??
|
|
63
90
|
configuration.fieldTypes["single-line text"];
|
|
64
91
|
if (!typeConfig)
|
|
65
92
|
return null;
|
|
66
|
-
|
|
93
|
+
const currentRaw = field.rawValue ?? "";
|
|
94
|
+
const historicRaw = selectedEntry.rawValue ?? "";
|
|
95
|
+
return (_jsxs("div", { className: "flex flex-col h-full", children: [_jsxs("div", { className: "mb-1 flex shrink-0 flex-wrap items-center justify-between gap-2", children: [_jsx("div", { className: "text-xs text-gray-500", children: "Historic Value Preview" }), _jsxs("div", { className: "flex flex-wrap items-center gap-1.5 text-xs", children: [isTextLike && (_jsxs(_Fragment, { children: [_jsx(SimpleIconButton, { icon: _jsx(FileText, { size: 14, className: "p-0.5", strokeWidth: 1 }), label: "Plain", selected: viewMode === "plain", onClick: () => setViewMode("plain"), className: cn("text-gray-500", viewMode === "plain" ? "bg-gray-200" : "") }), _jsx(SimpleIconButton, { icon: _jsx(GitCompare, { size: 14, className: "p-0.5", strokeWidth: 1 }), label: "Diff", selected: viewMode === "diff", onClick: () => setViewMode("diff"), className: cn("text-gray-500", viewMode === "diff" ? "bg-gray-200" : "") })] })), _jsx(Checkbox, { className: "size-3.5", checked: showRawValue, onCheckedChange: (checked) => setShowRawValue(!!checked) }), _jsx("label", { className: "cursor-pointer text-gray-500", onClick: () => setShowRawValue(!showRawValue), children: "Raw" })] })] }), viewMode === "diff" && isTextLike ? (_jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-2 overflow-auto", children: [_jsxs("div", { className: "flex shrink-0 flex-wrap gap-2", children: [_jsx(SimpleIconButton, { icon: _jsx(Brush, { size: 14, className: "p-0.5", strokeWidth: 1 }), label: "Ignore Formatting", onClick: () => setIgnoreFormatting((prev) => !prev), className: cn("text-gray-500", ignoreFormatting ? "bg-gray-200" : "") }), _jsx(SimpleIconButton, { icon: _jsx(GalleryVertical, { size: 14, className: "p-0.5", strokeWidth: 1 }), label: "Clip", onClick: () => setClipUnchanged((prev) => !prev), className: cn("text-gray-500", clipUnchanged ? "bg-gray-200" : "") })] }), _jsxs("div", { className: "min-h-0 flex-1 overflow-auto rounded bg-gray-50 p-2 text-xs", children: [_jsx("div", { className: "mb-1 text-[10px] uppercase tracking-wide text-gray-400", children: "Current \u2192 historic snapshot" }), _jsx(DiffView, { oldText: currentRaw, newText: historicRaw, ignoreFormatting: ignoreFormatting, clipUnchanged: clipUnchanged, clipThreshold: 50, clipContext: 10 })] })] })) : (_jsx("div", { className: "min-h-0 flex-1 overflow-auto rounded bg-gray-50 p-2 text-xs", children: _jsx(typeConfig.editor, { field: displayField, readOnly: true, isFocusedField: false, updateFieldValue: () => { }, tabIndex: undefined }) }))] }));
|
|
67
96
|
};
|
|
68
|
-
return (_jsxs("div", { "data-testid": "field-history", className: "flex flex-col h-[500px]", children: [_jsxs("div", { className: "p-2 text-xs text-gray-500
|
|
69
|
-
? "
|
|
70
|
-
: "
|
|
97
|
+
return (_jsxs("div", { "data-testid": "field-history", className: "flex flex-col h-[500px]", children: [_jsxs("div", { className: "shrink-0 p-2 text-xs text-gray-500", children: ["Field History: ", field.displayName || field.name || "Unknown Field"] }), _jsxs("div", { className: "flex min-h-0 flex-1 gap-2", children: [_jsx("div", { className: "flex min-w-0 flex-1 flex-col", children: _jsx("div", { className: "min-h-0 flex-1 overflow-auto", children: _jsx(SimpleTable, { items: fieldHistory, onRowClick: ({ item }) => setSelectedEntry(item), "data-testid": "field-history-table", rowClassName: (x) => cn("cursor-pointer hover:bg-neutral-100", x.undone ? "text-gray-300" : "", selectedEntry && fieldHistoryEntriesEqual(x, selectedEntry)
|
|
98
|
+
? "bg-blue-50 hover:bg-blue-100"
|
|
99
|
+
: ""), columns: [
|
|
71
100
|
{ header: "Date", body: (x) => formatDate(new Date(x.date)) },
|
|
72
101
|
{
|
|
73
102
|
header: "User",
|
|
74
|
-
body: (x) => x.agentId ? `Agent: ${x.agentId}` : x.user
|
|
103
|
+
body: (x) => (x.agentId ? `Agent: ${x.agentId}` : x.user),
|
|
75
104
|
},
|
|
76
105
|
{ header: "Version", body: (x) => x.version },
|
|
77
106
|
{
|
|
78
107
|
header: "Revert",
|
|
79
|
-
body: (x) => (_jsx(SimpleIconButton, { icon: _jsx(Undo, { className: "h-4 w-4" }), onClick: async () => {
|
|
108
|
+
body: (x) => isCurrentHistoryEntry(x, fieldHistory) ? (_jsx("span", { className: "text-gray-400", children: "Current" })) : (_jsx(SimpleIconButton, { icon: _jsx(Undo, { className: "h-4 w-4" }), onClick: async (ev) => {
|
|
109
|
+
ev.stopPropagation();
|
|
80
110
|
await editContext.operations.editField({
|
|
81
111
|
field: field.descriptor,
|
|
82
112
|
rawValue: x.rawValue,
|
|
@@ -85,6 +115,6 @@ export function FieldHistory({ field, onRevert, configuration, showRawValue: ini
|
|
|
85
115
|
onRevert?.();
|
|
86
116
|
}, label: "Revert" })),
|
|
87
117
|
},
|
|
88
|
-
] }) }) }), _jsx("div", { className: "flex-
|
|
118
|
+
] }) }) }), _jsx("div", { className: "flex min-w-0 flex-1 flex-col border-l border-gray-200 pl-2", children: renderFieldEditor() })] })] }));
|
|
89
119
|
}
|
|
90
120
|
//# sourceMappingURL=FieldHistory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldHistory.js","sourceRoot":"","sources":["../../src/editor/FieldHistory.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"FieldHistory.js","sourceRoot":"","sources":["../../src/editor/FieldHistory.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAElF,OAAO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@@ -65,15 +65,39 @@ function formatAllowanceSource(source) {
|
|
|
65
65
|
if (normalized.startsWith("preconfigured:skill:"))
|
|
66
66
|
return "Skill";
|
|
67
67
|
if (normalized.startsWith("system:")) {
|
|
68
|
-
return normalized
|
|
69
|
-
.slice("system:".length)
|
|
70
|
-
.replace(/[-_]+/g, " ")
|
|
71
|
-
.trim();
|
|
68
|
+
return normalized.slice("system:".length).replace(/[-_]+/g, " ").trim();
|
|
72
69
|
}
|
|
73
70
|
return normalized;
|
|
74
71
|
}
|
|
75
72
|
function formatAllowanceLabel(allowance) {
|
|
76
|
-
return `${allowance.operationType || "*"}${"itemPath" in allowance
|
|
73
|
+
return `${allowance.operationType || "*"}${"itemPath" in allowance
|
|
74
|
+
? ` ${allowance.itemPath}`
|
|
75
|
+
: ` ${allowance.normalizedPath}`}`;
|
|
76
|
+
}
|
|
77
|
+
function getAgentRunMessageAgentId(payload) {
|
|
78
|
+
const agentId = payload?.agentId;
|
|
79
|
+
return typeof agentId === "string" ? normalizeDialogAgentId(agentId) : null;
|
|
80
|
+
}
|
|
81
|
+
function getAgentRunMessageSeq(payload) {
|
|
82
|
+
return typeof payload?.seq === "number" ? payload.seq : null;
|
|
83
|
+
}
|
|
84
|
+
function getAgentRunMessageDetail(type, payload) {
|
|
85
|
+
if (type === "agent:run:delta") {
|
|
86
|
+
return payload?.type || null;
|
|
87
|
+
}
|
|
88
|
+
if (type === "agent:run:status") {
|
|
89
|
+
return payload?.data?.state || payload?.data?.status || null;
|
|
90
|
+
}
|
|
91
|
+
if (type === "agent:run:error") {
|
|
92
|
+
return payload?.error || null;
|
|
93
|
+
}
|
|
94
|
+
if (type === "agent:run:complete") {
|
|
95
|
+
return payload?.finalStatus || null;
|
|
96
|
+
}
|
|
97
|
+
if (type === "agent:run:start") {
|
|
98
|
+
return payload?.agentName || null;
|
|
99
|
+
}
|
|
100
|
+
return null;
|
|
77
101
|
}
|
|
78
102
|
function getVisibleDialogRegistry() {
|
|
79
103
|
const registry = globalThis.__agentDialogVisibleCallbacks;
|
|
@@ -626,10 +650,12 @@ const extractToolCallFields = (data) => {
|
|
|
626
650
|
"unknown";
|
|
627
651
|
const toolCallId = data?.toolCallId || data?.id || envelope?.id || envelope?.Id;
|
|
628
652
|
const functionArguments = stringifyToolField(data?.functionArguments) ||
|
|
653
|
+
stringifyToolField(data?.Arguments) ||
|
|
629
654
|
stringifyToolField(data?.arguments) ||
|
|
630
655
|
stringifyToolField(functionPayload?.arguments) ||
|
|
631
656
|
stringifyToolField(functionPayload?.Arguments) ||
|
|
632
657
|
stringifyToolField(envelope?.functionArguments) ||
|
|
658
|
+
stringifyToolField(envelope?.Arguments) ||
|
|
633
659
|
stringifyToolField(envelope?.arguments) ||
|
|
634
660
|
"{}";
|
|
635
661
|
return {
|
|
@@ -843,6 +869,30 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
843
869
|
const current = messagesRef.current || [];
|
|
844
870
|
return current.some((m) => !m.isCompleted && m.messageType === "streaming");
|
|
845
871
|
}, []);
|
|
872
|
+
const currentAgentId = agent?.id || agentStub.id;
|
|
873
|
+
const recentAgentRunEvents = useMemo(() => {
|
|
874
|
+
const normalizedAgentId = normalizeDialogAgentId(currentAgentId);
|
|
875
|
+
if (!normalizedAgentId) {
|
|
876
|
+
return [];
|
|
877
|
+
}
|
|
878
|
+
if (!editContext) {
|
|
879
|
+
return [];
|
|
880
|
+
}
|
|
881
|
+
return (editContext.webSocketMessages || [])
|
|
882
|
+
.filter((message) => {
|
|
883
|
+
if (!message?.type?.startsWith("agent:run:")) {
|
|
884
|
+
return false;
|
|
885
|
+
}
|
|
886
|
+
return getAgentRunMessageAgentId(message.payload) === normalizedAgentId;
|
|
887
|
+
})
|
|
888
|
+
.slice(-8)
|
|
889
|
+
.map((message) => ({
|
|
890
|
+
timestamp: message.timestamp,
|
|
891
|
+
type: message.type,
|
|
892
|
+
seq: getAgentRunMessageSeq(message.payload),
|
|
893
|
+
detail: getAgentRunMessageDetail(message.type, message.payload),
|
|
894
|
+
}));
|
|
895
|
+
}, [currentAgentId, editContext?.webSocketMessages]);
|
|
846
896
|
// Collect all pending tool calls for batch approval functionality
|
|
847
897
|
const allPendingApprovals = useMemo(() => {
|
|
848
898
|
const pending = [];
|
|
@@ -1727,7 +1777,8 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
1727
1777
|
outputCost: Number(cost.output) || 0,
|
|
1728
1778
|
cachedCost: Number(cost.cached) || 0,
|
|
1729
1779
|
cacheWriteCost: Number(cost.cacheWrite) || 0,
|
|
1730
|
-
imageCost: Number(cost.imageCost ?? cost.totalImageCost) ||
|
|
1780
|
+
imageCost: Number(cost.imageCost ?? cost.totalImageCost) ||
|
|
1781
|
+
0,
|
|
1731
1782
|
totalCost: Number(cost.total) || 0,
|
|
1732
1783
|
currency: "USD",
|
|
1733
1784
|
};
|
|
@@ -2097,12 +2148,19 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
2097
2148
|
const existingToolCall = updatedMessage.toolCalls[toolCallIndex];
|
|
2098
2149
|
if (existingToolCall && message.data) {
|
|
2099
2150
|
const updatedToolCalls = [...updatedMessage.toolCalls];
|
|
2151
|
+
const nextArgsText = stringifyToolField(extractedToolCall.functionArguments) || "";
|
|
2152
|
+
const existingArgsText = stringifyToolField(existingToolCall.functionArguments) || "";
|
|
2153
|
+
const hasMoreCompleteArgs = (nextArgsText.length > existingArgsText.length &&
|
|
2154
|
+
nextArgsText !== existingArgsText) ||
|
|
2155
|
+
(existingArgsText === "{}" && nextArgsText !== "{}");
|
|
2100
2156
|
const toolCall = {
|
|
2101
2157
|
id: existingToolCall.id,
|
|
2102
2158
|
messageId: existingToolCall.messageId,
|
|
2103
2159
|
toolCallId: existingToolCall.toolCallId,
|
|
2104
2160
|
functionName: existingToolCall.functionName,
|
|
2105
|
-
functionArguments:
|
|
2161
|
+
functionArguments: hasMoreCompleteArgs
|
|
2162
|
+
? nextArgsText
|
|
2163
|
+
: existingToolCall.functionArguments,
|
|
2106
2164
|
functionResult: message.data.functionResult || message.data.result || "",
|
|
2107
2165
|
functionError: message.data.functionError || message.data.error || "",
|
|
2108
2166
|
isCompleted: true,
|
|
@@ -3538,7 +3596,10 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
3538
3596
|
setActiveProfile((prev) => {
|
|
3539
3597
|
if (!prev || prev.id !== candidate.id)
|
|
3540
3598
|
return candidate;
|
|
3541
|
-
const skillKey = (p) => JSON.stringify((p.allowedSkills ?? []).map((s) => [
|
|
3599
|
+
const skillKey = (p) => JSON.stringify((p.allowedSkills ?? []).map((s) => [
|
|
3600
|
+
String(s?.id ?? ""),
|
|
3601
|
+
String(s?.name ?? ""),
|
|
3602
|
+
]));
|
|
3542
3603
|
if (skillKey(prev) === skillKey(candidate))
|
|
3543
3604
|
return prev;
|
|
3544
3605
|
return candidate;
|
|
@@ -4425,6 +4486,15 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
4425
4486
|
const handleRefreshContext = useCallback(async () => {
|
|
4426
4487
|
if (!agent?.id)
|
|
4427
4488
|
return;
|
|
4489
|
+
const normalizedAgentProfileId = agent?.profileId?.toLowerCase();
|
|
4490
|
+
const refreshProfile = activeProfile ||
|
|
4491
|
+
profiles.find((p) => p.id?.toLowerCase() === normalizedAgentProfileId);
|
|
4492
|
+
if (refreshProfile?.editorContextMode === "none") {
|
|
4493
|
+
editContext?.showInfoToast({
|
|
4494
|
+
summary: "This profile excludes editor context.",
|
|
4495
|
+
});
|
|
4496
|
+
return;
|
|
4497
|
+
}
|
|
4428
4498
|
try {
|
|
4429
4499
|
const currentCtx = buildCurrentContext();
|
|
4430
4500
|
if (!currentCtx) {
|
|
@@ -4465,6 +4535,8 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
4465
4535
|
buildCurrentContext,
|
|
4466
4536
|
sanitizeAgentMetadata,
|
|
4467
4537
|
editContext,
|
|
4538
|
+
activeProfile,
|
|
4539
|
+
profiles,
|
|
4468
4540
|
]);
|
|
4469
4541
|
// Stop current execution/stream safely
|
|
4470
4542
|
const handleStop = useCallback(async () => {
|
|
@@ -4544,7 +4616,37 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
4544
4616
|
isConnecting ||
|
|
4545
4617
|
isWaitingForResponse ||
|
|
4546
4618
|
hasActiveStreaming();
|
|
4547
|
-
const
|
|
4619
|
+
const runDiagnosticsSnapshot = useMemo(() => {
|
|
4620
|
+
const lastEvent = recentAgentRunEvents[recentAgentRunEvents.length - 1];
|
|
4621
|
+
return {
|
|
4622
|
+
agentId: currentAgentId,
|
|
4623
|
+
isSubmitting,
|
|
4624
|
+
isConnecting,
|
|
4625
|
+
isWaitingForResponse,
|
|
4626
|
+
isAgentThinking,
|
|
4627
|
+
isExecuting,
|
|
4628
|
+
hasActiveStreaming: hasActiveStreaming(),
|
|
4629
|
+
isSubscribed: normalizeDialogAgentId(subscribedAgentIdRef.current) ===
|
|
4630
|
+
normalizeDialogAgentId(currentAgentId),
|
|
4631
|
+
lastSeq: lastSeqRef.current,
|
|
4632
|
+
lastEventType: lastEvent?.type ?? null,
|
|
4633
|
+
lastEventAt: lastEvent?.timestamp ?? null,
|
|
4634
|
+
recentEvents: recentAgentRunEvents,
|
|
4635
|
+
};
|
|
4636
|
+
}, [
|
|
4637
|
+
currentAgentId,
|
|
4638
|
+
hasActiveStreaming,
|
|
4639
|
+
isAgentThinking,
|
|
4640
|
+
isConnecting,
|
|
4641
|
+
isExecuting,
|
|
4642
|
+
isSubmitting,
|
|
4643
|
+
isWaitingForResponse,
|
|
4644
|
+
recentAgentRunEvents,
|
|
4645
|
+
]);
|
|
4646
|
+
const showInitialThinkingSplash = messages.length === 0 &&
|
|
4647
|
+
!error &&
|
|
4648
|
+
hideGreeting &&
|
|
4649
|
+
(isSubmitting || isConnecting);
|
|
4548
4650
|
// Compute dots visibility: only show BEFORE any assistant message exists
|
|
4549
4651
|
// This prevents duplicate headers - the dots indicator has its own header,
|
|
4550
4652
|
// and we don't want to show a second header below existing messages
|
|
@@ -4588,18 +4690,19 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
4588
4690
|
showInitialThinkingSplash,
|
|
4589
4691
|
]);
|
|
4590
4692
|
// Move useMemo hook before early return to comply with Rules of Hooks
|
|
4591
|
-
const
|
|
4693
|
+
const resolvedEditorContextMode = React.useMemo(() => {
|
|
4592
4694
|
try {
|
|
4593
4695
|
const normalizedAgentProfileId = agent?.profileId?.toLowerCase();
|
|
4594
4696
|
const profile = activeProfile ||
|
|
4595
4697
|
profiles.find((p) => p.id?.toLowerCase() === normalizedAgentProfileId);
|
|
4596
|
-
|
|
4597
|
-
return mode === "live";
|
|
4698
|
+
return profile?.editorContextMode ?? null;
|
|
4598
4699
|
}
|
|
4599
4700
|
catch {
|
|
4600
|
-
return
|
|
4701
|
+
return null;
|
|
4601
4702
|
}
|
|
4602
4703
|
}, [activeProfile, profiles, agent?.profileId]);
|
|
4704
|
+
const isLiveEditorContextMode = resolvedEditorContextMode === "live";
|
|
4705
|
+
const omitsEditorContext = resolvedEditorContextMode === "none";
|
|
4603
4706
|
// Get parent agent ID from agent or agentStub (handle both camelCase and PascalCase)
|
|
4604
4707
|
const parentAgentId = agent?.parentAgentId ||
|
|
4605
4708
|
agent?.ParentAgentId ||
|
|
@@ -4614,7 +4717,7 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
4614
4717
|
}));
|
|
4615
4718
|
}, [parentAgentId]);
|
|
4616
4719
|
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;
|
|
4617
|
-
const renderContextInfoBar = () => (_jsx(ContextInfoBar, { agent: agent, agentMetadata: agentMetadata, setAgentMetadata: setAgentMetadata, setAgent: setAgent, resolvedPageName: resolvedPageName, resolvedComponentName: resolvedComponentName, resolvedFieldName: resolvedFieldName, isLiveEditorContextMode: isLiveEditorContextMode, onRefreshContext: handleRefreshContext }));
|
|
4720
|
+
const renderContextInfoBar = () => (_jsx(ContextInfoBar, { agent: agent, agentMetadata: agentMetadata, setAgentMetadata: setAgentMetadata, setAgent: setAgent, resolvedPageName: resolvedPageName, resolvedComponentName: resolvedComponentName, resolvedFieldName: resolvedFieldName, isLiveEditorContextMode: isLiveEditorContextMode, omitEditorContext: omitsEditorContext, onRefreshContext: handleRefreshContext }));
|
|
4618
4721
|
const renderCostLimitBanner = () => {
|
|
4619
4722
|
if (!costLimitExceeded)
|
|
4620
4723
|
return null;
|
|
@@ -4657,7 +4760,7 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
4657
4760
|
if (!activeInlineDialog)
|
|
4658
4761
|
return null;
|
|
4659
4762
|
if (activeInlineDialog.request.dialogType === "questionnaire") {
|
|
4660
|
-
return (_jsx("div", { ref: inlineDialogContainerRef, className: cn("agent-inline-dialog min-h-0 overflow-hidden", displayMode === "full" && "h-full"), children: _jsx(QuestionnaireInline, { requestId: activeInlineDialog.request.callbackId, title: activeInlineDialog.request.title, description: activeInlineDialog.request.description, parameters: activeInlineDialog.request.parameters, footerActions: questionnaireFooterActions, onClose: (result) => {
|
|
4763
|
+
return (_jsx("div", { ref: inlineDialogContainerRef, className: cn("agent-inline-dialog min-h-0 overflow-hidden", displayMode === "full" && "h-full"), children: _jsx(QuestionnaireInline, { requestId: activeInlineDialog.request.callbackId, agentId: activeInlineDialog.request.agentId, title: activeInlineDialog.request.title, description: activeInlineDialog.request.description, parameters: activeInlineDialog.request.parameters, footerActions: questionnaireFooterActions, onClose: (result) => {
|
|
4661
4764
|
activeInlineDialog.onComplete(result);
|
|
4662
4765
|
setActiveInlineDialog(null);
|
|
4663
4766
|
void onInteractionSubmitted?.();
|
|
@@ -5199,7 +5302,7 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
5199
5302
|
catch (err) {
|
|
5200
5303
|
console.error("Failed to persist agent model", err);
|
|
5201
5304
|
}
|
|
5202
|
-
} })] })) : null, _jsxs("div", { children: [_jsxs("div", { className: "mb-1 flex items-center justify-between gap-2", children: [_jsxs("div", { className: "flex items-center gap-1 text-[11px] font-medium text-gray-700", children: [_jsx(Target, { className: "h-3 w-3", strokeWidth: 1 }), "Skills"] }), _jsxs(Popover, { open: showSkillPicker, onOpenChange: setShowSkillPicker, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { size: "xs", variant: "outline", className: "h-5 rounded border px-1.5 text-[10px] text-gray-600", "data-testid": "agent-skill-picker-trigger", children: [_jsx(Plus, { className: "mr-1 h-3 w-3", strokeWidth: 1.5 }), "Add"] }) }), _jsx(PopoverContent, { className: "w-
|
|
5305
|
+
} })] })) : null, _jsxs("div", { children: [_jsxs("div", { className: "mb-1 flex items-center justify-between gap-2", children: [_jsxs("div", { className: "flex items-center gap-1 text-[11px] font-medium text-gray-700", children: [_jsx(Target, { className: "h-3 w-3", strokeWidth: 1 }), "Skills"] }), _jsxs(Popover, { open: showSkillPicker, onOpenChange: setShowSkillPicker, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { size: "xs", variant: "outline", className: "h-5 rounded border px-1.5 text-[10px] text-gray-600", "data-testid": "agent-skill-picker-trigger", children: [_jsx(Plus, { className: "mr-1 h-3 w-3", strokeWidth: 1.5 }), "Add"] }) }), _jsx(PopoverContent, { className: "w-88 p-2", align: "end", side: "bottom", children: _jsxs("div", { className: "space-y-2", children: [_jsx("div", { className: "text-[11px] font-medium text-gray-700", children: "Select a skill" }), _jsxs("div", { className: "relative h-56 rounded border border-gray-200 bg-gray-50", children: [_jsx(ScrollingContentTree, { rootItemIds: skillRootIds, selectedItemId: selectedSkillIds[selectedSkillIds.length - 1] || undefined, expandedItemId: selectedSkillIds[selectedSkillIds.length - 1] || skillRootIds[0], scrollToSelected: true, hideRootNodes: false, onSelectionChange: (selection) => {
|
|
5203
5306
|
const selected = selection[0];
|
|
5204
5307
|
if (!selected?.id)
|
|
5205
5308
|
return;
|
|
@@ -5228,27 +5331,34 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
5228
5331
|
}, 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: () => {
|
|
5229
5332
|
void handleRemoveSkill(skillId);
|
|
5230
5333
|
}, title: "Remove skill", "aria-label": `Remove ${skill?.name || skillId}`, children: _jsx(X, { className: "h-2.5 w-2.5", strokeWidth: 1 }) }))] }, skillId));
|
|
5231
|
-
}) }))] }), _jsxs("div", { children: [_jsx("div", { className: "mb-0.5 px-0.5 text-[11px] font-medium text-gray-700", children: "Allowances" }), _jsx("div", { className: "max-h-36 overflow-y-auto rounded border border-gray-100 bg-gray-50/50 p-1", "data-testid": "agent-allowances-section", children: operationAllowancesLoading ? (_jsx("div", { className: "px-1 text-[10px] text-gray-500", children: "Loading allowances..." })) : hasAnyAllowances ? (_jsx("div", { className: "space-y-1", children: allowanceGroups.map((group) => group.rows.length > 0 ? (_jsxs("div", { className: "space-y-0.5", children: [_jsx("div", { className: "px-1 text-[9px] font-medium
|
|
5334
|
+
}) }))] }), _jsxs("div", { children: [_jsx("div", { className: "mb-0.5 px-0.5 text-[11px] font-medium text-gray-700", children: "Allowances" }), _jsx("div", { className: "max-h-36 overflow-y-auto rounded border border-gray-100 bg-gray-50/50 p-1", "data-testid": "agent-allowances-section", children: operationAllowancesLoading ? (_jsx("div", { className: "px-1 text-[10px] text-gray-500", children: "Loading allowances..." })) : hasAnyAllowances ? (_jsx("div", { className: "space-y-1", children: allowanceGroups.map((group) => group.rows.length > 0 ? (_jsxs("div", { className: "space-y-0.5", children: [_jsx("div", { className: "px-1 text-[9px] font-medium tracking-wide text-gray-400 uppercase", children: group.label }), group.rows.map((allowance, index) => {
|
|
5232
5335
|
const sourceLabel = formatAllowanceSource(allowance.source);
|
|
5233
5336
|
const pathLabel = "itemPath" in allowance
|
|
5234
5337
|
? allowance.itemPath
|
|
5235
5338
|
: allowance.normalizedPath;
|
|
5236
|
-
return (_jsxs("div", { className: "rounded px-1 py-0.5 hover:bg-white/60
|
|
5237
|
-
allowance.grantedBy) && (_jsx("div", { className: "truncate pl-6 text-[9px] text-gray-400", children: [
|
|
5339
|
+
return (_jsxs("div", { className: "rounded px-1 py-0.5 transition-colors hover:bg-white/60", "data-testid": `agent-allowance-row-${group.key}`, children: [_jsxs("div", { className: "flex items-baseline gap-1.5", children: [_jsx("div", { className: "shrink-0 text-[10px] font-medium text-gray-700", children: allowance.operationType || "*" }), _jsx("div", { className: "truncate text-[9px] text-gray-500", title: formatAllowanceLabel(allowance), children: pathLabel })] }), (sourceLabel ||
|
|
5340
|
+
allowance.grantedBy) && (_jsx("div", { className: "truncate pl-6 text-[9px] text-gray-400", children: [
|
|
5341
|
+
sourceLabel,
|
|
5342
|
+
allowance.grantedBy,
|
|
5343
|
+
]
|
|
5238
5344
|
.filter(Boolean)
|
|
5239
5345
|
.join(" · ") }))] }, `${group.key}-${allowance.operationType}-${pathLabel}-${index}`));
|
|
5240
5346
|
})] }, group.key)) : null) })) : (_jsx("div", { className: "px-1 text-[10px] text-gray-500", children: "No active allowances" })) }), operationAllowancesError && (_jsx("div", { className: "mt-1 text-[10px] text-red-600", children: operationAllowancesError }))] }), _jsxs("div", { children: [_jsx("div", { className: "mb-0.5 px-0.5 text-[11px] font-medium text-gray-700", children: "Subscribed triggers" }), _jsx("div", { className: "max-h-28 overflow-y-auto rounded border border-gray-100 bg-gray-50/50 p-1", children: triggerSubscriptionsLoading ? (_jsx("div", { className: "px-1 text-[10px] text-gray-500", children: "Loading subscribed triggers..." })) : activeTriggerSubscriptions.length > 0 ? (_jsx("div", { className: "space-y-0.5", children: activeTriggerSubscriptions.map((sub) => {
|
|
5241
5347
|
const filterText = (sub.filter || "").trim();
|
|
5242
|
-
return (_jsxs("div", { className: "flex items-baseline gap-1.5 rounded px-1 py-0.5 hover:bg-white/60
|
|
5348
|
+
return (_jsxs("div", { className: "flex items-baseline gap-1.5 rounded px-1 py-0.5 transition-colors hover:bg-white/60", children: [_jsx("div", { className: "shrink-0 text-[10px] font-medium text-gray-700", children: sub.triggerName }), filterText.length > 0 && (_jsx("div", { className: "truncate text-[9px] text-gray-400", title: filterText, children: filterText }))] }, sub.id));
|
|
5243
5349
|
}) })) : (_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: () => {
|
|
5244
5350
|
setPrompt(p.prompt);
|
|
5245
5351
|
setShowPredefined(false);
|
|
5246
5352
|
if (textareaRef.current)
|
|
5247
5353
|
textareaRef.current.focus();
|
|
5248
|
-
}, children: p.title }, index))) }) })] })) : null, !hideBottomControls &&
|
|
5354
|
+
}, children: p.title }, index))) }) })] })) : null, !hideBottomControls &&
|
|
5355
|
+
!simpleMode &&
|
|
5356
|
+
editContext?.isMobile && (_jsxs(Popover, { open: showCostAndAgent, onOpenChange: setShowCostAndAgent, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx(Button, { onClick: () => {
|
|
5249
5357
|
if (editContext?.isMobile)
|
|
5250
5358
|
setShowCostAndAgent((prev) => !prev);
|
|
5251
|
-
}, variant: "outline", size: "sm", className: "h-5.5 w-5.5 cursor-pointer rounded-full", "aria-expanded": editContext?.isMobile
|
|
5359
|
+
}, variant: "outline", size: "sm", className: "h-5.5 w-5.5 cursor-pointer rounded-full", "aria-expanded": editContext?.isMobile
|
|
5360
|
+
? showCostAndAgent
|
|
5361
|
+
: undefined, "aria-label": "Toggle cost and context info", children: _jsx(DollarSign, { className: "size-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: _jsx(AgentTerminalStatusBar, { agent: agent, contextWindowStatus: contextWindowStatus, effectiveModelName: effectiveModelName, socketDiagnostics: editContext.socketDiagnostics, runDiagnosticsSnapshot: runDiagnosticsSnapshot, liveTotals: liveTotals, totalTokens: liveTotals
|
|
5252
5362
|
? {
|
|
5253
5363
|
input: liveTotals.input,
|
|
5254
5364
|
output: liveTotals.output,
|
|
@@ -5282,7 +5392,10 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, isActive =
|
|
|
5282
5392
|
: allPendingApprovals.length > 0
|
|
5283
5393
|
? "Approve or reject pending tool calls first"
|
|
5284
5394
|
: "Send", "aria-label": isExecuting ? "Stop" : "Send", "data-testid": "agent-send-stop-button", "data-executing": isExecuting ? "true" : "false", children: isExecuting ? (_jsx(Square, { className: "size-3", strokeWidth: 1 })) : (_jsx(Send, { className: "size-3", strokeWidth: 1 })) })] })] }));
|
|
5285
|
-
})(), !hideBottomControls &&
|
|
5395
|
+
})(), !hideBottomControls &&
|
|
5396
|
+
!simpleMode &&
|
|
5397
|
+
editContext &&
|
|
5398
|
+
!editContext.isMobile && (_jsx(AgentTerminalStatusBar, { agent: agent, contextWindowStatus: contextWindowStatus, effectiveModelName: effectiveModelName, socketDiagnostics: editContext.socketDiagnostics, runDiagnosticsSnapshot: runDiagnosticsSnapshot, liveTotals: liveTotals, totalTokens: liveTotals
|
|
5286
5399
|
? {
|
|
5287
5400
|
input: liveTotals.input,
|
|
5288
5401
|
output: liveTotals.output,
|