@ai-matrx/chat 0.3.11 → 0.3.19

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 (129) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/dist/agent-copy/export.d.ts +10 -2
  3. package/dist/agent-copy/export.js +3 -2
  4. package/dist/agents/components/agent-widgets/chat-assistant/CompactAssistantInput.js +1 -1
  5. package/dist/agents/components/debug/SandboxFileViewer.js +1 -3
  6. package/dist/agents/components/inputs/AgentVariablesInline.js +1 -1
  7. package/dist/agents/components/inputs/smart-input/AgentTextarea.js +1 -1
  8. package/dist/agents/components/inputs/smart-input/InputActionButtons.js +1 -1
  9. package/dist/agents/components/inputs/smart-input/composer/ComposerAgentPeek.js +6 -6
  10. package/dist/agents/components/messages-display/TranscriptIntegrityCopyButton.js +4 -4
  11. package/dist/agents/components/messages-display/user/UserActionBar.js +3 -18
  12. package/dist/agents/components/run/AgentRunHeader.js +1 -2
  13. package/dist/agents/components/shared/AgentConversationColumn.js +1 -1
  14. package/dist/agents/components/shared/AgentHeader.js +1 -2
  15. package/dist/agents/components/shared/AgentHeaderMobile.js +1 -2
  16. package/dist/agents/components/working-document/DocumentLinkPicker.d.ts +1 -1
  17. package/dist/agents/components/working-document/WorkingDocumentPanel.js +1 -1
  18. package/dist/agents/components/working-document/documents-workspace/DocumentsListRail.js +2 -2
  19. package/dist/agents/components/working-document/documents-workspace/DocumentsWorkspace.js +2 -2
  20. package/dist/agents/hooks/useInstanceInputUndoRedo.d.ts +1 -1
  21. package/dist/agents/hooks/useInstanceInputUndoRedo.js +1 -1
  22. package/dist/agents/hooks/useWorkingDocument.js +7 -6
  23. package/dist/agents/model-registry/model-classes.d.ts +1 -43
  24. package/dist/agents/model-registry/model-classes.js +1 -40
  25. package/dist/agents/model-registry/parse.d.ts +1 -88
  26. package/dist/agents/model-registry/parse.js +1 -246
  27. package/dist/agents/prompt-preview/PromptPreviewContent.js +1 -3
  28. package/dist/agents/redux/agent-definition/selectors.d.ts +8 -8
  29. package/dist/agents/redux/execution-system/active-requests/active-requests.selectors.d.ts +14 -0
  30. package/dist/agents/redux/execution-system/active-requests/active-requests.selectors.js +30 -0
  31. package/dist/agents/redux/execution-system/client-capabilities/desktop-native.provider.js +10 -1
  32. package/dist/agents/redux/execution-system/instance-working-document/cx-working-document.service.d.ts +18 -16
  33. package/dist/agents/redux/execution-system/instance-working-document/cx-working-document.service.js +101 -52
  34. package/dist/agents/redux/execution-system/instance-working-document/instance-working-document.slice.d.ts +2 -2
  35. package/dist/agents/redux/execution-system/instance-working-document/instance-working-document.thunks.d.ts +1 -1
  36. package/dist/agents/redux/execution-system/instance-working-document/scratchpad.thunks.d.ts +1 -1
  37. package/dist/agents/redux/execution-system/message-crud/refetch-single-message.thunk.js +5 -0
  38. package/dist/agents/redux/execution-system/thunks/process-stream.js +2 -2
  39. package/dist/agents/redux/execution-system/utils/stream-block-accumulator.d.ts +14 -0
  40. package/dist/agents/redux/execution-system/utils/stream-block-accumulator.js +28 -0
  41. package/dist/agents/utils/platform-keys.d.ts +15 -0
  42. package/dist/agents/utils/platform-keys.js +69 -0
  43. package/dist/context/sources/scopes.d.ts +1 -1
  44. package/dist/cx-chat/components/user-input/ConversationInput.js +1 -1
  45. package/dist/cx-conversation/ConversationInput.js +1 -1
  46. package/dist/host/db-types.d.ts +23242 -23071
  47. package/dist/host/ui-slots.d.ts +50 -64
  48. package/dist/host/ui-slots.js +12 -52
  49. package/dist/public-chat/components/GuidedVariableInputs.js +1 -1
  50. package/dist/public-chat/components/PublicVariableInputs.js +1 -1
  51. package/dist/react.cjs +11 -23
  52. package/dist/react.cjs.map +1 -1
  53. package/dist/react.js +11 -23
  54. package/dist/react.js.map +1 -1
  55. package/dist/surfaces/manifests/_conversation-document.manifest.js +1 -1
  56. package/dist/tool-call-visualization/registry/registry.js +13 -0
  57. package/dist/ui/composer/useTouchOnlyDevice.js +1 -1
  58. package/dist/ui/skills-types.d.ts +1 -275
  59. package/dist/ui/skills-types.js +1 -0
  60. package/dist/voice-agent/components/VoiceDebugPanel.js +1 -3
  61. package/package.json +60 -34
  62. package/dist/agents/components/run/run-sidebar/AgentRunsSidebar.d.ts +0 -15
  63. package/dist/agents/components/run/run-sidebar/AgentRunsSidebar.js +0 -201
  64. package/dist/agents/components/run-controls/AgentExecutionTestModal.d.ts +0 -36
  65. package/dist/agents/components/run-controls/AgentExecutionTestModal.js +0 -440
  66. package/dist/agents/components/run-controls/AgentLauncherSidebarTester.d.ts +0 -6
  67. package/dist/agents/components/run-controls/AgentLauncherSidebarTester.js +0 -127
  68. package/dist/agents/components/run-controls/AgentWidgetInvokerTester.d.ts +0 -6
  69. package/dist/agents/components/run-controls/AgentWidgetInvokerTester.js +0 -84
  70. package/dist/agents/components/run-controls/CreatorRunPanel.d.ts +0 -22
  71. package/dist/agents/components/run-controls/CreatorRunPanel.js +0 -108
  72. package/dist/agents/components/run-controls/CreatorRunTabContent.d.ts +0 -30
  73. package/dist/agents/components/run-controls/CreatorRunTabContent.js +0 -319
  74. package/dist/agents/components/run-controls/PayloadTab.d.ts +0 -5
  75. package/dist/agents/components/run-controls/PayloadTab.js +0 -388
  76. package/dist/agents/components/run-controls/TesterSettingsPanel.d.ts +0 -71
  77. package/dist/agents/components/run-controls/TesterSettingsPanel.js +0 -470
  78. package/dist/agents/components/shared/AgentOptionsMenu.d.ts +0 -8
  79. package/dist/agents/components/shared/AgentOptionsMenu.js +0 -776
  80. package/dist/agents/components/shared/AgentPeekDuplicateButton.d.ts +0 -8
  81. package/dist/agents/components/shared/AgentPeekDuplicateButton.js +0 -66
  82. package/dist/agents/components/shared/AgentSaveStatus.d.ts +0 -7
  83. package/dist/agents/components/shared/AgentSaveStatus.js +0 -128
  84. package/dist/agents/components/shared/AgentSaveTapButton.d.ts +0 -18
  85. package/dist/agents/components/shared/AgentSaveTapButton.js +0 -105
  86. package/dist/agents/components/shared/useAgentSaveAction.d.ts +0 -33
  87. package/dist/agents/components/shared/useAgentSaveAction.js +0 -179
  88. package/dist/agents/components/shell/AgentsListHeader.d.ts +0 -1
  89. package/dist/agents/components/shell/AgentsListHeader.js +0 -69
  90. package/dist/agents/components/undo-history/AgentEditHistory.d.ts +0 -9
  91. package/dist/agents/components/undo-history/AgentEditHistory.js +0 -244
  92. package/dist/agents/components/unused/AgentSharedHeader.d.ts +0 -3
  93. package/dist/agents/components/unused/AgentSharedHeader.js +0 -134
  94. package/dist/agents/components/widgets/AgentWidgetsPage.d.ts +0 -11
  95. package/dist/agents/components/widgets/AgentWidgetsPage.js +0 -571
  96. package/dist/agents/components/widgets/WidgetVariableInputs.d.ts +0 -8
  97. package/dist/agents/components/widgets/WidgetVariableInputs.js +0 -80
  98. package/dist/agents/components/widgets/build-widget-launch.d.ts +0 -70
  99. package/dist/agents/components/widgets/build-widget-launch.js +0 -90
  100. package/dist/agents/hooks/useAgentAutoSave.d.ts +0 -1
  101. package/dist/agents/hooks/useAgentAutoSave.js +0 -127
  102. package/dist/agents/hooks/useAgentBuilderWriteHandlers.d.ts +0 -9
  103. package/dist/agents/hooks/useAgentBuilderWriteHandlers.js +0 -102
  104. package/dist/agents/hooks/useAgentDuplicateFlow.d.ts +0 -25
  105. package/dist/agents/hooks/useAgentDuplicateFlow.js +0 -133
  106. package/dist/agents/hooks/useAgentUndoRedo.d.ts +0 -31
  107. package/dist/agents/hooks/useAgentUndoRedo.js +0 -134
  108. package/dist/agents/hooks/useAgentUsages.d.ts +0 -17
  109. package/dist/agents/hooks/useAgentUsages.js +0 -36
  110. package/dist/agents/hooks/useDriftAlerts.d.ts +0 -11
  111. package/dist/agents/hooks/useDriftAlerts.js +0 -36
  112. package/dist/agents/hooks/useDriftReport.d.ts +0 -20
  113. package/dist/agents/hooks/useDriftReport.js +0 -34
  114. package/dist/agents/lifecycle/useAgentLifecycleActions.d.ts +0 -17
  115. package/dist/agents/lifecycle/useAgentLifecycleActions.js +0 -63
  116. package/dist/agents/message-flags/useMessageFlags.d.ts +0 -8
  117. package/dist/agents/message-flags/useMessageFlags.js +0 -68
  118. package/dist/agents/services/agent-definition-snapshot.service.d.ts +0 -15
  119. package/dist/agents/services/agent-definition-snapshot.service.js +0 -20
  120. package/dist/agents/surface-catalog-profile.d.ts +0 -96
  121. package/dist/agents/surface-catalog-profile.js +0 -79
  122. package/dist/cx-chat/hooks/useAgentBootstrap.d.ts +0 -1
  123. package/dist/cx-chat/hooks/useAgentBootstrap.js +0 -110
  124. package/dist/host/builder-door.d.ts +0 -61
  125. package/dist/host/builder-door.js +0 -25
  126. package/dist/next/lazy/CreatorRunPanel.d.ts +0 -1
  127. package/dist/next/lazy/CreatorRunPanel.js +0 -11
  128. package/dist/ui/composer/composerSubmit.d.ts +0 -50
  129. package/dist/ui/composer/composerSubmit.js +0 -32
@@ -1,244 +0,0 @@
1
- "use client";
2
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { useCallback } from "react";
4
- import { formatRelativeTime } from "@ai-matrx/kit/format";
5
- import { Button, Tile } from "@ai-matrx/design-system/controls";
6
- import { ScrollArea } from "@ai-matrx/design-system";
7
- import { Separator } from "@ai-matrx/design-system";
8
- import { formatFileSize } from "@ai-matrx/kit/format";
9
- import {
10
- Undo2,
11
- Redo2,
12
- History,
13
- Trash2,
14
- ArrowUp,
15
- ArrowDown
16
- } from "lucide-react";
17
- import { useAppSelector, useAppDispatch } from "../../../store/hooks.js";
18
- import {
19
- selectAgentById,
20
- selectAgentCanUndo,
21
- selectAgentCanRedo,
22
- selectAgentName
23
- } from "../../redux/agent-definition/selectors.js";
24
- import {
25
- undoAgentEdit,
26
- redoAgentEdit,
27
- clearAgentUndoHistory
28
- } from "../../redux/agent-definition/slice.js";
29
- import {
30
- getUndoShortcutHint,
31
- getRedoShortcutHint
32
- } from "../../hooks/useAgentUndoRedo.js";
33
- import { AiModelRef, AiToolRef } from "../../../host/ui-slots.js";
34
- import { ModelTierIdentityList } from "../model-tiers/ModelTierIdentityList.js";
35
- const FIELD_LABELS = {
36
- messages: "Messages",
37
- name: "Name",
38
- description: "Description",
39
- settings: "Settings",
40
- tools: "Tools",
41
- customTools: "Custom Tools",
42
- variableDefinitions: "Variables",
43
- contextPolicies: "Context Policies",
44
- modelId: "Model",
45
- modelTiers: "Model Tiers",
46
- outputSchema: "Output Schema",
47
- tags: "Tags",
48
- category: "Category",
49
- isActive: "Active",
50
- isArchived: "Archived",
51
- isFavorite: "Favorite"
52
- };
53
- function formatField(field) {
54
- return FIELD_LABELS[field] ?? field;
55
- }
56
- function formatTimestamp(ts) {
57
- const d = new Date(ts);
58
- if (Date.now() - ts < 36e5) {
59
- return formatRelativeTime(ts, { style: "short" });
60
- }
61
- return d.toLocaleTimeString(void 0, {
62
- hour: "2-digit",
63
- minute: "2-digit"
64
- });
65
- }
66
- function previewValue(entry) {
67
- const val = entry.value;
68
- if (val == null) return "empty";
69
- if (entry.field === "modelId" && typeof val === "string") {
70
- return /* @__PURE__ */ jsx(AiModelRef, { modelId: val, showId: true, showIcon: false, disableNavigation: true });
71
- }
72
- if (entry.field === "modelTiers") {
73
- return /* @__PURE__ */ jsx(ModelTierIdentityList, { value: val, showId: true, disableNavigation: true });
74
- }
75
- if (entry.field === "tools" && Array.isArray(val) && val.every((toolId) => typeof toolId === "string")) {
76
- if (val.length === 0) return "No tools";
77
- return /* @__PURE__ */ jsx("span", { className: "flex flex-col gap-1", children: val.map((toolId) => /* @__PURE__ */ jsx(
78
- AiToolRef,
79
- {
80
- toolId,
81
- showId: true,
82
- showIcon: false,
83
- disableNavigation: true
84
- },
85
- toolId
86
- )) });
87
- }
88
- if (typeof val === "string") {
89
- if (val.length === 0) return "empty";
90
- return val.length > 60 ? `"${val.slice(0, 57)}..."` : `"${val}"`;
91
- }
92
- if (typeof val === "boolean") return val ? "true" : "false";
93
- if (typeof val === "number") return String(val);
94
- if (Array.isArray(val))
95
- return `${val.length} item${val.length !== 1 ? "s" : ""}`;
96
- return "object";
97
- }
98
- function AgentEditHistory({ agentId }) {
99
- const dispatch = useAppDispatch();
100
- const record = useAppSelector((s) => selectAgentById(s, agentId));
101
- const agentName = useAppSelector((s) => selectAgentName(s, agentId));
102
- const canUndo = useAppSelector((s) => selectAgentCanUndo(s, agentId));
103
- const canRedo = useAppSelector((s) => selectAgentCanRedo(s, agentId));
104
- const past = record?._undoPast ?? [];
105
- const future = record?._undoFuture ?? [];
106
- const handleUndo = useCallback(() => {
107
- dispatch(undoAgentEdit({ id: agentId }));
108
- }, [dispatch, agentId]);
109
- const handleRedo = useCallback(() => {
110
- dispatch(redoAgentEdit({ id: agentId }));
111
- }, [dispatch, agentId]);
112
- const handleClear = useCallback(() => {
113
- dispatch(clearAgentUndoHistory({ id: agentId }));
114
- }, [dispatch, agentId]);
115
- const handleUndoToEntry = useCallback(
116
- (targetIndex) => {
117
- const steps = past.length - targetIndex;
118
- for (let i = 0; i < steps; i++) {
119
- dispatch(undoAgentEdit({ id: agentId }));
120
- }
121
- },
122
- [dispatch, agentId, past.length]
123
- );
124
- const handleRedoToEntry = useCallback(
125
- (targetIndex) => {
126
- const steps = future.length - targetIndex;
127
- for (let i = 0; i < steps; i++) {
128
- dispatch(redoAgentEdit({ id: agentId }));
129
- }
130
- },
131
- [dispatch, agentId, future.length]
132
- );
133
- const totalBytes = [...past, ...future].reduce(
134
- (sum, e) => sum + e.byteEstimate,
135
- 0
136
- );
137
- return /* @__PURE__ */ jsxs("div", { className: "flex h-full min-h-0 flex-col bg-background", children: [
138
- /* @__PURE__ */ jsx("div", { className: "truncate px-4 pt-3 pb-1 text-[11px] text-muted-foreground", children: `${agentName ?? "Agent"} \xB7 ${past.length} undo \xB7 ${future.length} redo \xB7 ${formatFileSize(totalBytes)}` }),
139
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2 px-4 pb-2", children: [
140
- /* @__PURE__ */ jsxs(
141
- Button,
142
- {
143
- icon: /* @__PURE__ */ jsx(Undo2, {}),
144
- variant: "outline",
145
- onClick: handleUndo,
146
- disabled: !canUndo,
147
- children: [
148
- "Undo",
149
- /* @__PURE__ */ jsx("kbd", { className: "ml-1 text-[10px] text-muted-foreground", children: getUndoShortcutHint() })
150
- ]
151
- }
152
- ),
153
- /* @__PURE__ */ jsxs(
154
- Button,
155
- {
156
- icon: /* @__PURE__ */ jsx(Redo2, {}),
157
- variant: "outline",
158
- onClick: handleRedo,
159
- disabled: !canRedo,
160
- children: [
161
- "Redo",
162
- /* @__PURE__ */ jsx("kbd", { className: "ml-1 text-[10px] text-muted-foreground", children: getRedoShortcutHint() })
163
- ]
164
- }
165
- ),
166
- /* @__PURE__ */ jsx("div", { className: "flex-1" }),
167
- /* @__PURE__ */ jsx(
168
- Button,
169
- {
170
- icon: /* @__PURE__ */ jsx(Trash2, {}),
171
- variant: "quiet",
172
- onClick: handleClear,
173
- disabled: past.length === 0 && future.length === 0,
174
- children: "Clear"
175
- }
176
- )
177
- ] }),
178
- /* @__PURE__ */ jsx(Separator, {}),
179
- /* @__PURE__ */ jsx(ScrollArea, { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsxs("div", { className: "px-4 py-2 space-y-1", children: [
180
- future.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
181
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 py-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground", children: [
182
- /* @__PURE__ */ jsx(ArrowDown, { className: "h-3 w-3" }),
183
- "Redo (",
184
- future.length,
185
- ")"
186
- ] }),
187
- [...future].reverse().map((entry, visualIdx) => {
188
- const stackIdx = future.length - 1 - visualIdx;
189
- return /* @__PURE__ */ jsx(
190
- Tile,
191
- {
192
- variant: "quiet",
193
- onClick: () => handleRedoToEntry(stackIdx),
194
- icon: /* @__PURE__ */ jsx(Redo2, {}),
195
- glyphTone: "info",
196
- title: formatField(entry.field),
197
- line: previewValue(entry),
198
- end: formatTimestamp(entry.timestamp)
199
- },
200
- `redo-${stackIdx}`
201
- );
202
- }),
203
- /* @__PURE__ */ jsx(Separator, { className: "my-1" })
204
- ] }),
205
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 py-1.5 px-2", children: [
206
- /* @__PURE__ */ jsx("div", { className: "h-2 w-2 rounded-full bg-green-500 flex-shrink-0" }),
207
- /* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-green-600 dark:text-green-400", children: "Current State" })
208
- ] }),
209
- past.length > 0 && /* @__PURE__ */ jsx(Separator, { className: "my-1" }),
210
- past.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
211
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 py-1 text-[10px] font-medium uppercase tracking-wider text-muted-foreground", children: [
212
- /* @__PURE__ */ jsx(ArrowUp, { className: "h-3 w-3" }),
213
- "Undo (",
214
- past.length,
215
- ")"
216
- ] }),
217
- [...past].reverse().map((entry, visualIdx) => {
218
- const stackIdx = past.length - 1 - visualIdx;
219
- return /* @__PURE__ */ jsx(
220
- Tile,
221
- {
222
- variant: "quiet",
223
- onClick: () => handleUndoToEntry(stackIdx),
224
- icon: /* @__PURE__ */ jsx(Undo2, {}),
225
- glyphTone: "warning",
226
- title: formatField(entry.field),
227
- line: previewValue(entry),
228
- end: formatTimestamp(entry.timestamp)
229
- },
230
- `undo-${stackIdx}`
231
- );
232
- })
233
- ] }),
234
- past.length === 0 && future.length === 0 && /* @__PURE__ */ jsxs("div", { className: "py-8 text-center", children: [
235
- /* @__PURE__ */ jsx(History, { className: "h-8 w-8 text-muted-foreground/30 mx-auto mb-2" }),
236
- /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "No edit history yet" }),
237
- /* @__PURE__ */ jsx("p", { className: "text-[10px] text-muted-foreground mt-1", children: "Changes will appear here as you edit" })
238
- ] })
239
- ] }) })
240
- ] });
241
- }
242
- export {
243
- AgentEditHistory
244
- };
@@ -1,3 +0,0 @@
1
- export declare function AgentSharedHeader({ agentId }: {
2
- agentId: string;
3
- }): import("react").JSX.Element;
@@ -1,134 +0,0 @@
1
- "use client";
2
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { useState, useTransition } from "react";
4
- import { useRouter, usePathname } from "../../../host/navigation.js";
5
- import { Eye, Pencil, Play, History, Plus } from "lucide-react";
6
- import { Button } from "@ai-matrx/design-system/controls";
7
- import { useAppSelector } from "../../../store/hooks.js";
8
- import {
9
- selectAgentIsDirty,
10
- selectAgentById,
11
- selectAgentVersion
12
- } from "../../redux/agent-definition/selectors.js";
13
- import { AgentListDropdown } from "@ai-matrx/agents/catalog/react";
14
- import { AgentSaveStatus } from "../shared/AgentSaveStatus.js";
15
- import { AgentOptionsMenu } from "../shared/AgentOptionsMenu.js";
16
- import {
17
- AlertDialog,
18
- AlertDialogAction,
19
- AlertDialogCancel,
20
- AlertDialogContent,
21
- AlertDialogDescription,
22
- AlertDialogFooter,
23
- AlertDialogHeader,
24
- AlertDialogTitle
25
- } from "@ai-matrx/design-system";
26
- const MODES = [
27
- { id: "view", label: "View", icon: Eye },
28
- { id: "edit", label: "Build", icon: Pencil },
29
- { id: "run", label: "Run", icon: Play },
30
- { id: "versions", label: "Versions", icon: History },
31
- { id: "new", label: "New", icon: Plus }
32
- ];
33
- function deriveMode(pathname, agentId) {
34
- const base = `/agents/${agentId}`;
35
- if (pathname.startsWith(`${base}/run`)) return "run";
36
- if (pathname.startsWith(`${base}/build`)) return "edit";
37
- if (pathname.startsWith(`${base}/latest`) || /^\/agents\/[^/]+\/\d+$/.test(pathname))
38
- return "versions";
39
- return "view";
40
- }
41
- function AgentSharedHeader({ agentId }) {
42
- const router = useRouter();
43
- const pathname = usePathname();
44
- const [, startTransition] = useTransition();
45
- const agentName = useAppSelector((state) => selectAgentById(state, agentId)?.name) ?? "";
46
- const version = useAppSelector((state) => selectAgentVersion(state, agentId));
47
- const isDirty = useAppSelector((state) => selectAgentIsDirty(state, agentId));
48
- const [showDirtyDialog, setShowDirtyDialog] = useState(false);
49
- const [pendingNew, setPendingNew] = useState(false);
50
- const mode = deriveMode(pathname, agentId);
51
- const navigateTo = (path) => {
52
- startTransition(() => router.push(path));
53
- };
54
- const handleModeChange = (next) => {
55
- if (next === mode) return;
56
- if (next === "new") {
57
- if (isDirty) {
58
- setPendingNew(true);
59
- setShowDirtyDialog(true);
60
- } else {
61
- navigateTo("/agents/new");
62
- }
63
- return;
64
- }
65
- const pathMap = {
66
- view: `/agents/${agentId}`,
67
- edit: `/agents/${agentId}/build`,
68
- run: `/agents/${agentId}/run`,
69
- versions: `/agents/${agentId}/latest`
70
- };
71
- navigateTo(pathMap[next]);
72
- };
73
- const handleAgentSelect = (selectedId) => {
74
- const suffixByMode = {
75
- view: "",
76
- edit: "/build",
77
- run: "/run",
78
- versions: "/latest"
79
- };
80
- const suffix = suffixByMode[mode];
81
- navigateTo(`/agents/${selectedId}${suffix}`);
82
- };
83
- const handleDirtyDiscard = () => {
84
- setShowDirtyDialog(false);
85
- if (pendingNew) {
86
- setPendingNew(false);
87
- navigateTo("/agents/new");
88
- }
89
- };
90
- const handleDirtyCancel = () => {
91
- setShowDirtyDialog(false);
92
- setPendingNew(false);
93
- };
94
- return /* @__PURE__ */ jsxs(Fragment, { children: [
95
- /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between w-full gap-2 px-1", children: [
96
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 min-w-0 shrink", children: [
97
- /* @__PURE__ */ jsx(
98
- AgentListDropdown,
99
- {
100
- onSelect: handleAgentSelect,
101
- label: agentName,
102
- className: "max-w-[120px] md:max-w-[180px]"
103
- }
104
- ),
105
- version != null && /* @__PURE__ */ jsxs("span", { className: "text-[0.625rem] font-medium text-[var(--shell-nav-text)] tabular-nums shrink-0", children: [
106
- "v",
107
- version
108
- ] })
109
- ] }),
110
- /* @__PURE__ */ jsx("div", { className: "matrx-glass-thin-border flex items-center gap-0.5 rounded-full p-0.5", children: MODES.map(({ id, label, icon: Icon }) => {
111
- const isActive = id === mode;
112
- return /* @__PURE__ */ jsx(Button, { variant: "quiet", pressed: isActive, icon: /* @__PURE__ */ jsx(Icon, {}), onClick: () => handleModeChange(id), title: label, children: /* @__PURE__ */ jsx("span", { className: "hidden md:inline", children: label }) }, id);
113
- }) }),
114
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5 shrink-0", children: [
115
- /* @__PURE__ */ jsx(AgentSaveStatus, { agentId }),
116
- /* @__PURE__ */ jsx("div", { className: "w-px h-4 bg-border/50" }),
117
- /* @__PURE__ */ jsx(AgentOptionsMenu, { agentId })
118
- ] })
119
- ] }),
120
- /* @__PURE__ */ jsx(AlertDialog, { open: showDirtyDialog, onOpenChange: setShowDirtyDialog, children: /* @__PURE__ */ jsxs(AlertDialogContent, { children: [
121
- /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [
122
- /* @__PURE__ */ jsx(AlertDialogTitle, { children: "Unsaved Changes" }),
123
- /* @__PURE__ */ jsx(AlertDialogDescription, { children: "You have unsaved changes to this agent. If you leave now, your changes will be lost." })
124
- ] }),
125
- /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [
126
- /* @__PURE__ */ jsx(AlertDialogCancel, { onClick: handleDirtyCancel, children: "Stay" }),
127
- /* @__PURE__ */ jsx(AlertDialogAction, { onClick: handleDirtyDiscard, children: "Discard & Continue" })
128
- ] })
129
- ] }) })
130
- ] });
131
- }
132
- export {
133
- AgentSharedHeader
134
- };
@@ -1,11 +0,0 @@
1
- interface AgentWidgetsPageProps {
2
- agentId: string;
3
- initialAgentName: string;
4
- /** Base path for the embedded mode controller. Defaults to `/agents`. */
5
- basePath?: string;
6
- /** SSR-friendly current path. Optional — passed through to the mode
7
- * controller, which falls back to `usePathname()` when omitted. */
8
- currentPath?: string;
9
- }
10
- export declare function AgentWidgetsPage({ agentId, currentPath, initialAgentName, basePath, }: AgentWidgetsPageProps): import("react").JSX.Element;
11
- export {};