@ai-matrx/chat 0.3.15 → 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 (114) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist/agents/components/agent-widgets/chat-assistant/CompactAssistantInput.js +1 -1
  3. package/dist/agents/components/inputs/AgentVariablesInline.js +1 -1
  4. package/dist/agents/components/inputs/smart-input/AgentTextarea.js +1 -1
  5. package/dist/agents/components/inputs/smart-input/InputActionButtons.js +1 -1
  6. package/dist/agents/components/inputs/smart-input/composer/ComposerAgentPeek.js +6 -6
  7. package/dist/agents/components/run/AgentRunHeader.js +1 -2
  8. package/dist/agents/components/shared/AgentConversationColumn.js +1 -1
  9. package/dist/agents/components/shared/AgentHeader.js +1 -2
  10. package/dist/agents/components/shared/AgentHeaderMobile.js +1 -2
  11. package/dist/agents/components/working-document/DocumentLinkPicker.d.ts +1 -1
  12. package/dist/agents/components/working-document/WorkingDocumentPanel.js +1 -1
  13. package/dist/agents/components/working-document/documents-workspace/DocumentsListRail.js +2 -2
  14. package/dist/agents/components/working-document/documents-workspace/DocumentsWorkspace.js +2 -2
  15. package/dist/agents/hooks/useInstanceInputUndoRedo.d.ts +1 -1
  16. package/dist/agents/hooks/useInstanceInputUndoRedo.js +1 -1
  17. package/dist/agents/hooks/useWorkingDocument.js +7 -6
  18. package/dist/agents/model-registry/model-classes.d.ts +1 -43
  19. package/dist/agents/model-registry/model-classes.js +1 -40
  20. package/dist/agents/model-registry/parse.d.ts +1 -88
  21. package/dist/agents/model-registry/parse.js +1 -246
  22. package/dist/agents/redux/agent-definition/selectors.d.ts +8 -8
  23. package/dist/agents/redux/execution-system/instance-working-document/cx-working-document.service.d.ts +18 -16
  24. package/dist/agents/redux/execution-system/instance-working-document/cx-working-document.service.js +101 -52
  25. package/dist/agents/redux/execution-system/instance-working-document/instance-working-document.slice.d.ts +2 -2
  26. package/dist/agents/redux/execution-system/instance-working-document/instance-working-document.thunks.d.ts +1 -1
  27. package/dist/agents/redux/execution-system/instance-working-document/scratchpad.thunks.d.ts +1 -1
  28. package/dist/agents/utils/platform-keys.d.ts +15 -0
  29. package/dist/agents/utils/platform-keys.js +69 -0
  30. package/dist/cx-chat/components/user-input/ConversationInput.js +1 -1
  31. package/dist/cx-conversation/ConversationInput.js +1 -1
  32. package/dist/host/db-types.d.ts +1017 -1692
  33. package/dist/host/ui-slots.d.ts +47 -64
  34. package/dist/host/ui-slots.js +10 -52
  35. package/dist/public-chat/components/GuidedVariableInputs.js +1 -1
  36. package/dist/public-chat/components/PublicVariableInputs.js +1 -1
  37. package/dist/react.cjs +11 -23
  38. package/dist/react.cjs.map +1 -1
  39. package/dist/react.js +11 -23
  40. package/dist/react.js.map +1 -1
  41. package/dist/surfaces/manifests/_conversation-document.manifest.js +1 -1
  42. package/dist/tool-call-visualization/registry/registry.js +13 -0
  43. package/dist/ui/composer/useTouchOnlyDevice.js +1 -1
  44. package/dist/ui/skills-types.d.ts +1 -275
  45. package/dist/ui/skills-types.js +1 -0
  46. package/package.json +56 -30
  47. package/dist/agents/components/run/run-sidebar/AgentRunsSidebar.d.ts +0 -15
  48. package/dist/agents/components/run/run-sidebar/AgentRunsSidebar.js +0 -201
  49. package/dist/agents/components/run-controls/AgentExecutionTestModal.d.ts +0 -36
  50. package/dist/agents/components/run-controls/AgentExecutionTestModal.js +0 -440
  51. package/dist/agents/components/run-controls/AgentLauncherSidebarTester.d.ts +0 -6
  52. package/dist/agents/components/run-controls/AgentLauncherSidebarTester.js +0 -127
  53. package/dist/agents/components/run-controls/AgentWidgetInvokerTester.d.ts +0 -6
  54. package/dist/agents/components/run-controls/AgentWidgetInvokerTester.js +0 -84
  55. package/dist/agents/components/run-controls/CreatorRunPanel.d.ts +0 -22
  56. package/dist/agents/components/run-controls/CreatorRunPanel.js +0 -108
  57. package/dist/agents/components/run-controls/CreatorRunTabContent.d.ts +0 -30
  58. package/dist/agents/components/run-controls/CreatorRunTabContent.js +0 -319
  59. package/dist/agents/components/run-controls/PayloadTab.d.ts +0 -5
  60. package/dist/agents/components/run-controls/PayloadTab.js +0 -388
  61. package/dist/agents/components/run-controls/TesterSettingsPanel.d.ts +0 -71
  62. package/dist/agents/components/run-controls/TesterSettingsPanel.js +0 -470
  63. package/dist/agents/components/shared/AgentOptionsMenu.d.ts +0 -8
  64. package/dist/agents/components/shared/AgentOptionsMenu.js +0 -776
  65. package/dist/agents/components/shared/AgentPeekDuplicateButton.d.ts +0 -8
  66. package/dist/agents/components/shared/AgentPeekDuplicateButton.js +0 -66
  67. package/dist/agents/components/shared/AgentSaveStatus.d.ts +0 -7
  68. package/dist/agents/components/shared/AgentSaveStatus.js +0 -128
  69. package/dist/agents/components/shared/AgentSaveTapButton.d.ts +0 -18
  70. package/dist/agents/components/shared/AgentSaveTapButton.js +0 -105
  71. package/dist/agents/components/shared/useAgentSaveAction.d.ts +0 -33
  72. package/dist/agents/components/shared/useAgentSaveAction.js +0 -179
  73. package/dist/agents/components/shell/AgentsListHeader.d.ts +0 -1
  74. package/dist/agents/components/shell/AgentsListHeader.js +0 -69
  75. package/dist/agents/components/undo-history/AgentEditHistory.d.ts +0 -9
  76. package/dist/agents/components/undo-history/AgentEditHistory.js +0 -244
  77. package/dist/agents/components/unused/AgentSharedHeader.d.ts +0 -3
  78. package/dist/agents/components/unused/AgentSharedHeader.js +0 -134
  79. package/dist/agents/components/widgets/AgentWidgetsPage.d.ts +0 -11
  80. package/dist/agents/components/widgets/AgentWidgetsPage.js +0 -571
  81. package/dist/agents/components/widgets/WidgetVariableInputs.d.ts +0 -8
  82. package/dist/agents/components/widgets/WidgetVariableInputs.js +0 -80
  83. package/dist/agents/components/widgets/build-widget-launch.d.ts +0 -70
  84. package/dist/agents/components/widgets/build-widget-launch.js +0 -90
  85. package/dist/agents/hooks/useAgentAutoSave.d.ts +0 -1
  86. package/dist/agents/hooks/useAgentAutoSave.js +0 -127
  87. package/dist/agents/hooks/useAgentBuilderWriteHandlers.d.ts +0 -9
  88. package/dist/agents/hooks/useAgentBuilderWriteHandlers.js +0 -102
  89. package/dist/agents/hooks/useAgentDuplicateFlow.d.ts +0 -25
  90. package/dist/agents/hooks/useAgentDuplicateFlow.js +0 -133
  91. package/dist/agents/hooks/useAgentUndoRedo.d.ts +0 -31
  92. package/dist/agents/hooks/useAgentUndoRedo.js +0 -134
  93. package/dist/agents/hooks/useAgentUsages.d.ts +0 -17
  94. package/dist/agents/hooks/useAgentUsages.js +0 -36
  95. package/dist/agents/hooks/useDriftAlerts.d.ts +0 -11
  96. package/dist/agents/hooks/useDriftAlerts.js +0 -36
  97. package/dist/agents/hooks/useDriftReport.d.ts +0 -20
  98. package/dist/agents/hooks/useDriftReport.js +0 -34
  99. package/dist/agents/lifecycle/useAgentLifecycleActions.d.ts +0 -17
  100. package/dist/agents/lifecycle/useAgentLifecycleActions.js +0 -63
  101. package/dist/agents/message-flags/useMessageFlags.d.ts +0 -8
  102. package/dist/agents/message-flags/useMessageFlags.js +0 -68
  103. package/dist/agents/services/agent-definition-snapshot.service.d.ts +0 -15
  104. package/dist/agents/services/agent-definition-snapshot.service.js +0 -20
  105. package/dist/agents/surface-catalog-profile.d.ts +0 -96
  106. package/dist/agents/surface-catalog-profile.js +0 -79
  107. package/dist/cx-chat/hooks/useAgentBootstrap.d.ts +0 -1
  108. package/dist/cx-chat/hooks/useAgentBootstrap.js +0 -110
  109. package/dist/host/builder-door.d.ts +0 -61
  110. package/dist/host/builder-door.js +0 -25
  111. package/dist/next/lazy/CreatorRunPanel.d.ts +0 -1
  112. package/dist/next/lazy/CreatorRunPanel.js +0 -11
  113. package/dist/ui/composer/composerSubmit.d.ts +0 -50
  114. package/dist/ui/composer/composerSubmit.js +0 -32
@@ -1,8 +0,0 @@
1
- export declare function AgentPeekDuplicateButton({ agentId, onStart, }: {
2
- agentId: string;
3
- /**
4
- * Close the peek as the copy starts: the organization question (when none is
5
- * chosen) and the new tab must never open behind a menu.
6
- */
7
- onStart?: () => void;
8
- }): import("react").JSX.Element | null;
@@ -1,66 +0,0 @@
1
- "use client";
2
- import { jsx } from "react/jsx-runtime";
3
- import { useState } from "react";
4
- import { CopyPlus, Loader2 } from "lucide-react";
5
- import { Button } from "@ai-matrx/design-system/controls";
6
- import { getUserMessage } from "@ai-matrx/agents/matrx";
7
- import { useAppDispatch, useAppSelector } from "../../../store/hooks.js";
8
- import { selectUserId } from "../../../host/identity.js";
9
- import { getBuilderDoor } from "../../../host/builder-door.js";
10
- import { toast } from "../../../host/notify.js";
11
- import { isOrganizationSelectionCancelled } from "../../../host/org.js";
12
- import { selectAgentById, selectAgentReadyForBuilder } from "../../redux/agent-definition/selectors.js";
13
- import { agentGoHref } from "../../addressing/agentAddress.js";
14
- function AgentPeekDuplicateButton({
15
- agentId,
16
- onStart
17
- }) {
18
- const dispatch = useAppDispatch();
19
- const userId = useAppSelector(selectUserId);
20
- const record = useAppSelector((state) => selectAgentById(state, agentId));
21
- const isReady = useAppSelector((state) => selectAgentReadyForBuilder(state, agentId));
22
- const [busy, setBusy] = useState(false);
23
- const door = getBuilderDoor();
24
- if (!door || !isReady || !record) return null;
25
- const ownsIt = record.isOwner === true || record.createdBy != null && record.createdBy === userId;
26
- if (ownsIt) return null;
27
- const duplicate = async () => {
28
- if (busy) return;
29
- setBusy(true);
30
- onStart?.();
31
- try {
32
- const newId = await dispatch(door.duplicateAgent(agentId)).unwrap();
33
- const href = agentGoHref(newId, "/build");
34
- const tab = window.open(href, "_blank");
35
- if (tab) {
36
- tab.opener = null;
37
- toast.success(`Duplicated "${record.name}" \u2014 opened in a new tab`);
38
- } else {
39
- toast.success(`Duplicated "${record.name}"`, {
40
- description: "Your browser kept the new tab closed",
41
- action: { label: "Open", onClick: () => window.open(href, "_blank", "noopener") }
42
- });
43
- }
44
- } catch (err) {
45
- if (!isOrganizationSelectionCancelled(err)) {
46
- toast.error("Could not duplicate agent", { description: getUserMessage(err) });
47
- }
48
- } finally {
49
- setBusy(false);
50
- }
51
- };
52
- return /* @__PURE__ */ jsx(
53
- Button,
54
- {
55
- icon: busy ? /* @__PURE__ */ jsx(Loader2, { className: "animate-spin" }) : /* @__PURE__ */ jsx(CopyPlus, {}),
56
- variant: "outline",
57
- onClick: duplicate,
58
- disabled: busy,
59
- title: "Make your own copy of this agent, in a new tab",
60
- children: "Duplicate"
61
- }
62
- );
63
- }
64
- export {
65
- AgentPeekDuplicateButton
66
- };
@@ -1,7 +0,0 @@
1
- export declare function AgentSaveStatus({ agentId, editModeOverride, versionClassName, }: {
2
- agentId: string;
3
- /** When true, expose save affordances outside `/agents/.../build` (e.g. window panels). */
4
- editModeOverride?: boolean;
5
- /** Extra classes for the version pill — a host header folds it away when narrow. */
6
- versionClassName?: string;
7
- }): import("react").JSX.Element | null;
@@ -1,128 +0,0 @@
1
- "use client";
2
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { Badge, Button } from "@ai-matrx/design-system/controls";
4
- import { useState } from "react";
5
- import { Save, Loader2, AlertTriangle, Eye, Undo2 } from "lucide-react";
6
- import { useAppDispatch } from "../../../store/hooks.js";
7
- import { resetAllAgentFields } from "../../redux/agent-definition/slice.js";
8
- import { useChatCanvasTab } from "../../../host/canvas.js";
9
- import { AGENT_UNSAVED_CHANGES_KIND } from "../../../host/canvas-tabs.js";
10
- import { cn } from "@ai-matrx/design-system";
11
- import {
12
- AlertDialog,
13
- AlertDialogAction,
14
- AlertDialogCancel,
15
- AlertDialogContent,
16
- AlertDialogDescription,
17
- AlertDialogFooter,
18
- AlertDialogHeader,
19
- AlertDialogTitle
20
- } from "@ai-matrx/design-system";
21
- import { AgentSettingsModal } from "../../../host/ui-slots.js";
22
- import { useAgentSaveAction } from "./useAgentSaveAction.js";
23
- import { ErrorAlchemyMenu } from "../../../host/ui-slots.js";
24
- function AgentSaveStatus({
25
- agentId,
26
- editModeOverride,
27
- versionClassName
28
- }) {
29
- const {
30
- isDirty,
31
- isLoading,
32
- version,
33
- isNewRoute,
34
- isEditMode,
35
- canSave,
36
- isReadOnly,
37
- isReadOnlySave,
38
- handleSave,
39
- showModelWarning,
40
- setShowModelWarning,
41
- readOnlySavePrompt,
42
- duplicateDialog,
43
- reachBadge,
44
- available
45
- } = useAgentSaveAction(agentId, { editModeOverride });
46
- const dispatch = useAppDispatch();
47
- const [settingsOpen, setSettingsOpen] = useState(false);
48
- const [confirmDiscardOpen, setConfirmDiscardOpen] = useState(false);
49
- const diffTab = useChatCanvasTab({ kind: AGENT_UNSAVED_CHANGES_KIND, key: agentId });
50
- const handleSelectModel = () => {
51
- setShowModelWarning(false);
52
- setSettingsOpen(true);
53
- };
54
- if (!available) return null;
55
- return /* @__PURE__ */ jsxs(Fragment, { children: [
56
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
57
- version != null && /* @__PURE__ */ jsxs(
58
- "span",
59
- {
60
- className: cn(
61
- "text-[10px] font-medium text-muted-foreground tabular-nums px-1.5 py-0.5 rounded bg-muted/60",
62
- versionClassName
63
- ),
64
- children: [
65
- "v",
66
- version
67
- ]
68
- }
69
- ),
70
- isEditMode && isReadOnly && /* @__PURE__ */ jsx(Badge, { tone: "warning", children: "View only" }),
71
- isEditMode && isDirty && /* @__PURE__ */ jsxs(Fragment, { children: [
72
- /* @__PURE__ */ jsx(Badge, { tone: "warning", children: isNewRoute ? "Not saved" : "Unsaved" }),
73
- /* @__PURE__ */ jsx(ErrorAlchemyMenu, {}),
74
- !isNewRoute && /* @__PURE__ */ jsx(Button, { variant: "quiet", icon: /* @__PURE__ */ jsx(Undo2, {}), onClick: () => setConfirmDiscardOpen(true), disabled: isLoading, title: "Discard unsaved changes", "aria-label": "Discard unsaved changes" }),
75
- !isNewRoute && /* @__PURE__ */ jsx(Button, { variant: "quiet", pressed: diffTab.isVisible, icon: /* @__PURE__ */ jsx(Eye, {}), onClick: () => diffTab.toggle({ title: "Unsaved changes", data: { agentId } }), title: "View unsaved changes", "aria-label": "View unsaved changes" })
76
- ] }),
77
- isEditMode && /* @__PURE__ */ jsx(Button, { variant: "quiet", icon: isLoading ? /* @__PURE__ */ jsx(Loader2, { className: "animate-spin" }) : /* @__PURE__ */ jsx(Save, {}), onClick: handleSave, disabled: !canSave, title: isReadOnlySave ? "View only \u2014 create your copy to save changes" : isNewRoute ? "Save new agent" : isDirty ? "Save changes" : "No unsaved changes", "aria-label": isReadOnlySave ? "View only \u2014 create your copy to save changes" : isNewRoute ? "Save new agent" : isDirty ? "Save changes" : "No unsaved changes" }),
78
- isEditMode && reachBadge
79
- ] }),
80
- /* @__PURE__ */ jsx(AlertDialog, { open: showModelWarning, onOpenChange: setShowModelWarning, children: /* @__PURE__ */ jsxs(AlertDialogContent, { children: [
81
- /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [
82
- /* @__PURE__ */ jsxs(AlertDialogTitle, { className: "flex items-center gap-2", children: [
83
- /* @__PURE__ */ jsx(AlertTriangle, { className: "w-4 h-4 text-yellow-500" }),
84
- "No Model Selected"
85
- ] }),
86
- /* @__PURE__ */ jsxs(AlertDialogDescription, { children: [
87
- "Your agent was saved, but",
88
- " ",
89
- /* @__PURE__ */ jsx("strong", { children: "no model has been selected" }),
90
- ". A model is required for the agent to run. Would you like to select one now?"
91
- ] })
92
- ] }),
93
- /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [
94
- /* @__PURE__ */ jsx(AlertDialogCancel, { children: "Ignore for Now" }),
95
- /* @__PURE__ */ jsx(AlertDialogAction, { onClick: handleSelectModel, children: "Select a Model" })
96
- ] })
97
- ] }) }),
98
- /* @__PURE__ */ jsx(AlertDialog, { open: confirmDiscardOpen, onOpenChange: setConfirmDiscardOpen, children: /* @__PURE__ */ jsxs(AlertDialogContent, { children: [
99
- /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [
100
- /* @__PURE__ */ jsx(AlertDialogTitle, { children: "Discard unsaved changes?" }),
101
- /* @__PURE__ */ jsx(AlertDialogDescription, { children: "The agent goes back to its last saved version." })
102
- ] }),
103
- /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [
104
- /* @__PURE__ */ jsx(AlertDialogCancel, { children: "Keep editing" }),
105
- /* @__PURE__ */ jsx(
106
- AlertDialogAction,
107
- {
108
- onClick: () => dispatch(resetAllAgentFields({ id: agentId })),
109
- children: "Discard"
110
- }
111
- )
112
- ] })
113
- ] }) }),
114
- /* @__PURE__ */ jsx(
115
- AgentSettingsModal,
116
- {
117
- agentId,
118
- open: settingsOpen,
119
- onOpenChange: setSettingsOpen
120
- }
121
- ),
122
- readOnlySavePrompt,
123
- duplicateDialog
124
- ] });
125
- }
126
- export {
127
- AgentSaveStatus
128
- };
@@ -1,18 +0,0 @@
1
- interface AgentSaveTapButtonProps {
2
- agentId: string;
3
- }
4
- /**
5
- * Mobile-friendly save affordance for the agent header.
6
- *
7
- * Renders a single 44pt tap target with state-aware coloring:
8
- * - clean → muted save icon, disabled
9
- * - dirty → primary save icon + amber dot indicator
10
- * - new → primary save icon (no dot — entire agent is unsaved)
11
- * - saving → spinner, disabled
12
- *
13
- * Mirrors the desktop `AgentSaveStatus` save semantics (only renders in edit
14
- * mode, opens the model-missing warning post-save, etc.) but skips the
15
- * desktop-only diff/version chips that don't fit the constrained mobile bar.
16
- */
17
- export declare function AgentSaveTapButton({ agentId }: AgentSaveTapButtonProps): import("react").JSX.Element | null;
18
- export {};
@@ -1,105 +0,0 @@
1
- "use client";
2
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { useState } from "react";
4
- import { AlertTriangle, Loader2, Save } from "lucide-react";
5
- import { TapTargetButtonTransparent } from "@ai-matrx/tap-target";
6
- import {
7
- AlertDialog,
8
- AlertDialogAction,
9
- AlertDialogCancel,
10
- AlertDialogContent,
11
- AlertDialogDescription,
12
- AlertDialogFooter,
13
- AlertDialogHeader,
14
- AlertDialogTitle
15
- } from "@ai-matrx/design-system";
16
- import { AgentSettingsModal } from "../../../host/ui-slots.js";
17
- import { cn } from "@ai-matrx/design-system";
18
- import { useAgentSaveAction } from "./useAgentSaveAction.js";
19
- function AgentSaveTapButton({ agentId }) {
20
- const {
21
- isDirty,
22
- isLoading,
23
- isNewRoute,
24
- isEditMode,
25
- canSave,
26
- isReadOnly,
27
- isReadOnlySave,
28
- handleSave,
29
- showModelWarning,
30
- setShowModelWarning,
31
- readOnlySavePrompt,
32
- duplicateDialog,
33
- reachTapBadge,
34
- available
35
- } = useAgentSaveAction(agentId);
36
- const [settingsOpen, setSettingsOpen] = useState(false);
37
- if (!isEditMode || !available) return null;
38
- const ariaLabel = isReadOnlySave ? "View only \u2014 create your copy to save changes" : isNewRoute ? "Save new agent" : isDirty ? "Save changes" : "No unsaved changes";
39
- const icon = isLoading ? /* @__PURE__ */ jsx(Loader2, { className: "w-4 h-4 animate-spin text-muted-foreground" }) : /* @__PURE__ */ jsx(
40
- Save,
41
- {
42
- className: cn(
43
- "w-4 h-4",
44
- canSave ? "text-primary" : "text-muted-foreground/60"
45
- )
46
- }
47
- );
48
- const showDirtyDot = isDirty && !isNewRoute && !isLoading;
49
- const handleSelectModel = () => {
50
- setShowModelWarning(false);
51
- setSettingsOpen(true);
52
- };
53
- return /* @__PURE__ */ jsxs(Fragment, { children: [
54
- reachTapBadge && !isDirty && !isNewRoute ? reachTapBadge : /* @__PURE__ */ jsxs("div", { className: "relative shrink-0", children: [
55
- /* @__PURE__ */ jsx(
56
- TapTargetButtonTransparent,
57
- {
58
- icon,
59
- ariaLabel,
60
- tooltip: false,
61
- onClick: handleSave,
62
- disabled: !canSave
63
- }
64
- ),
65
- showDirtyDot && /* @__PURE__ */ jsx(
66
- "span",
67
- {
68
- "aria-hidden": "true",
69
- className: "pointer-events-none absolute top-1.5 right-1.5 h-1.5 w-1.5 rounded-full bg-amber-500"
70
- }
71
- )
72
- ] }),
73
- /* @__PURE__ */ jsx(AlertDialog, { open: showModelWarning, onOpenChange: setShowModelWarning, children: /* @__PURE__ */ jsxs(AlertDialogContent, { children: [
74
- /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [
75
- /* @__PURE__ */ jsxs(AlertDialogTitle, { className: "flex items-center gap-2", children: [
76
- /* @__PURE__ */ jsx(AlertTriangle, { className: "w-4 h-4 text-yellow-500" }),
77
- "No Model Selected"
78
- ] }),
79
- /* @__PURE__ */ jsxs(AlertDialogDescription, { children: [
80
- "Your agent was saved, but",
81
- " ",
82
- /* @__PURE__ */ jsx("strong", { children: "no model has been selected" }),
83
- ". A model is required for the agent to run. Would you like to select one now?"
84
- ] })
85
- ] }),
86
- /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [
87
- /* @__PURE__ */ jsx(AlertDialogCancel, { children: "Ignore for Now" }),
88
- /* @__PURE__ */ jsx(AlertDialogAction, { onClick: handleSelectModel, children: "Select a Model" })
89
- ] })
90
- ] }) }),
91
- /* @__PURE__ */ jsx(
92
- AgentSettingsModal,
93
- {
94
- agentId,
95
- open: settingsOpen,
96
- onOpenChange: setSettingsOpen
97
- }
98
- ),
99
- readOnlySavePrompt,
100
- duplicateDialog
101
- ] });
102
- }
103
- export {
104
- AgentSaveTapButton
105
- };
@@ -1,33 +0,0 @@
1
- /**
2
- * Shared save behaviour for an agent record.
3
- *
4
- * Centralises the desktop save-status pill (`AgentSaveStatus`) and the mobile
5
- * save tap target (`AgentSaveTapButton`) so the create-vs-update branching,
6
- * post-save toasts, and model-missing warning live in exactly one place.
7
- *
8
- * Returned `isEditMode` mirrors the legacy desktop check — only the `/build`
9
- * route or the in-flight `/agents/new` route should expose a save affordance.
10
- */
11
- export declare function useAgentSaveAction(agentId: string, options?: {
12
- editModeOverride?: boolean;
13
- }): {
14
- readonly isDirty: boolean;
15
- readonly isLoading: boolean;
16
- readonly version: number | null;
17
- readonly isNewRoute: boolean;
18
- readonly isEditMode: boolean;
19
- readonly canSave: boolean;
20
- readonly isReadOnly: boolean;
21
- readonly isReadOnlySave: boolean;
22
- readonly handleSave: () => Promise<void>;
23
- readonly showModelWarning: boolean;
24
- readonly setShowModelWarning: import("react").Dispatch<import("react").SetStateAction<boolean>>;
25
- readonly readOnlySavePrompt: import("react").JSX.Element;
26
- readonly duplicateDialog: import("react").JSX.Element;
27
- /** The post-save reach icon + count (Agent Change Impact I6), or null. */
28
- readonly reachBadge: any;
29
- /** The same badge as one 44pt tap target, for the mobile header. */
30
- readonly reachTapBadge: any;
31
- /** False in a host that registered no builder door: save controls are left out (reported once). */
32
- readonly available: boolean;
33
- };
@@ -1,179 +0,0 @@
1
- "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import { useState } from "react";
4
- import { usePathname, useRouter } from "../../../host/navigation.js";
5
- import { useAppDispatch, useAppSelector } from "../../../store/hooks.js";
6
- import {
7
- selectAgentIsDirty,
8
- selectAgentIsLoading,
9
- selectAgentVersion,
10
- selectAgentModelMissing,
11
- selectAgentById,
12
- selectAgentIsReadOnly,
13
- selectAgentAccessResolved
14
- } from "../../redux/agent-definition/selectors.js";
15
- import { getBuilderDoor, requireBuilderDoor } from "../../../host/builder-door.js";
16
- import { toast } from "../../../host/notify.js";
17
- import { agentNameTaken } from "../../redux/agent-definition/agentNameTaken.js";
18
- import { setAgentField } from "../../redux/agent-definition/slice.js";
19
- import {
20
- AlertDialog,
21
- AlertDialogAction,
22
- AlertDialogCancel,
23
- AlertDialogContent,
24
- AlertDialogDescription,
25
- AlertDialogFooter,
26
- AlertDialogHeader,
27
- AlertDialogTitle
28
- } from "@ai-matrx/design-system";
29
- import { useAgentDuplicateFlow } from "../../hooks/useAgentDuplicateFlow.js";
30
- import { useAgentChangeReach } from "../../../host/ui-slots.js";
31
- function useAgentSaveAction(agentId, options) {
32
- const dispatch = useAppDispatch();
33
- const pathname = usePathname();
34
- const router = useRouter();
35
- const isDirty = useAppSelector((state) => selectAgentIsDirty(state, agentId));
36
- const isLoading = useAppSelector(
37
- (state) => selectAgentIsLoading(state, agentId)
38
- );
39
- const version = useAppSelector((state) => selectAgentVersion(state, agentId));
40
- const modelMissing = useAppSelector(
41
- (state) => selectAgentModelMissing(state, agentId)
42
- );
43
- const agentRecord = useAppSelector(
44
- (state) => selectAgentById(state, agentId)
45
- );
46
- const accessResolved = useAppSelector(
47
- (state) => selectAgentAccessResolved(state, agentId)
48
- );
49
- const isReadOnly = useAppSelector(
50
- (state) => selectAgentIsReadOnly(state, agentId)
51
- );
52
- const [showModelWarning, setShowModelWarning] = useState(false);
53
- const [readOnlySavePromptOpen, setReadOnlySavePromptOpen] = useState(false);
54
- const {
55
- startDuplicate,
56
- dialog: duplicateDialog,
57
- isDuplicating
58
- } = useAgentDuplicateFlow(agentId);
59
- const {
60
- badge: reachBadge,
61
- tapBadge: reachTapBadge,
62
- announce: announceReach
63
- } = useAgentChangeReach(agentId);
64
- const isNewRoute = pathname === "/agents/new";
65
- const isEditMode = options?.editModeOverride === true || isNewRoute || // agent-link-ok: save-as creates a user agent for this user; the pathname check is a route test, not a link
66
- !!pathname?.includes(`/agents/${agentId}/build`);
67
- const canSave = (isDirty || isNewRoute) && !isLoading;
68
- const isReadOnlySave = accessResolved && isReadOnly && !isNewRoute;
69
- const handleSave = async () => {
70
- if (isLoading || isDuplicating) return;
71
- if (isReadOnlySave) {
72
- setReadOnlySavePromptOpen(true);
73
- return;
74
- }
75
- try {
76
- if (isNewRoute) {
77
- if (!agentRecord) return;
78
- const newId = await dispatch(
79
- requireBuilderDoor().createAgent({
80
- name: agentRecord.name,
81
- description: agentRecord.description,
82
- agentType: agentRecord.agentType,
83
- messages: agentRecord.messages,
84
- variableDefinitions: agentRecord.variableDefinitions,
85
- modelId: agentRecord.modelId,
86
- settings: agentRecord.settings,
87
- tools: agentRecord.tools,
88
- customTools: agentRecord.customTools,
89
- contextPolicies: agentRecord.contextPolicies,
90
- category: agentRecord.category,
91
- tags: agentRecord.tags,
92
- isActive: agentRecord.isActive,
93
- isArchived: agentRecord.isArchived,
94
- isFavorite: agentRecord.isFavorite,
95
- mcpServers: agentRecord.mcpServers
96
- })
97
- ).unwrap();
98
- toast.success("Agent created!");
99
- router.replace(`/agents/${newId}/build`);
100
- return;
101
- }
102
- await dispatch(requireBuilderDoor().saveAgent(agentId)).unwrap();
103
- toast.success("Agent saved!");
104
- void announceReach(agentRecord?.name ?? null);
105
- if (modelMissing) {
106
- setShowModelWarning(true);
107
- }
108
- } catch (e) {
109
- const taken = agentNameTaken(e);
110
- if (taken && agentId) {
111
- toast.error(taken.sentence, {
112
- action: {
113
- label: `Use "${taken.suggestion}"`,
114
- onClick: () => {
115
- dispatch(setAgentField({ id: agentId, field: "name", value: taken.suggestion }));
116
- void handleSave();
117
- }
118
- }
119
- });
120
- return;
121
- }
122
- toast.error(
123
- isNewRoute ? "Failed to create agent." : "Failed to save agent."
124
- );
125
- }
126
- };
127
- const handleReadOnlyDuplicate = async () => {
128
- setReadOnlySavePromptOpen(false);
129
- await startDuplicate();
130
- };
131
- const readOnlySavePrompt = /* @__PURE__ */ jsx(
132
- AlertDialog,
133
- {
134
- open: readOnlySavePromptOpen,
135
- onOpenChange: setReadOnlySavePromptOpen,
136
- children: /* @__PURE__ */ jsxs(AlertDialogContent, { children: [
137
- /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [
138
- /* @__PURE__ */ jsx(AlertDialogTitle, { children: "View-only agent" }),
139
- /* @__PURE__ */ jsx(AlertDialogDescription, { children: "This agent is shared with you as view-only, so changes cannot be saved here. Create your own copy to edit it. Unsaved edits in this session will not carry over \u2014 the copy starts from the last saved version." })
140
- ] }),
141
- /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [
142
- /* @__PURE__ */ jsx(AlertDialogCancel, { children: "Keep browsing" }),
143
- /* @__PURE__ */ jsx(
144
- AlertDialogAction,
145
- {
146
- disabled: isDuplicating,
147
- onClick: () => void handleReadOnlyDuplicate(),
148
- children: "Create my copy"
149
- }
150
- )
151
- ] })
152
- ] })
153
- }
154
- );
155
- return {
156
- isDirty,
157
- isLoading,
158
- version,
159
- isNewRoute,
160
- isEditMode,
161
- canSave,
162
- isReadOnly: accessResolved && isReadOnly,
163
- isReadOnlySave,
164
- handleSave,
165
- showModelWarning,
166
- setShowModelWarning,
167
- readOnlySavePrompt,
168
- duplicateDialog,
169
- /** The post-save reach icon + count (Agent Change Impact I6), or null. */
170
- reachBadge,
171
- /** The same badge as one 44pt tap target, for the mobile header. */
172
- reachTapBadge,
173
- /** False in a host that registered no builder door: save controls are left out (reported once). */
174
- available: getBuilderDoor() !== null
175
- };
176
- }
177
- export {
178
- useAgentSaveAction
179
- };
@@ -1 +0,0 @@
1
- export declare function AgentsListHeader(): import("react").JSX.Element;
@@ -1,69 +0,0 @@
1
- "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import { Link } from "../../../host/navigation.js";
4
- import { useEffect } from "react";
5
- import { FileChartColumn, Webhook } from "lucide-react";
6
- import { Button } from "@ai-matrx/design-system/controls";
7
- import { useDriftAlerts } from "../../hooks/useDriftAlerts.js";
8
- import { DriftSeverityBadge } from "../../../ui/usages/DriftSeverityBadge.js";
9
- import {
10
- DRIFT_SEVERITY_META,
11
- sumSeverityCounts,
12
- worstSeverityFromCounts
13
- } from "../../../ui/usages/severity.js";
14
- import { HeaderActionsSlot } from "../../../host/chrome.js";
15
- const INFO_ONLY = /* @__PURE__ */ new Set(["info"]);
16
- function AgentsListHeader() {
17
- const { alerts, markViewed } = useDriftAlerts();
18
- useEffect(() => {
19
- for (const a of alerts) {
20
- if (!a.viewedAt) markViewed(a.id);
21
- }
22
- }, [alerts, markViewed]);
23
- const totals = sumSeverityCounts(
24
- alerts.map((a) => ({
25
- breaking: a.breakingCount,
26
- silent_breaking: a.silentCount,
27
- warning: a.warningCount,
28
- info: a.infoCount
29
- }))
30
- );
31
- const worstSev = worstSeverityFromCounts(totals, INFO_ONLY);
32
- const meta = worstSev ? DRIFT_SEVERITY_META[worstSev] : null;
33
- return /* @__PURE__ */ jsxs("div", { className: "flex items-center w-full gap-2 px-1", children: [
34
- /* @__PURE__ */ jsx(Webhook, { className: "w-4 h-4 text-muted-foreground shrink-0" }),
35
- /* @__PURE__ */ jsx("h1", { className: "text-sm font-semibold text-foreground", children: "Agents" }),
36
- /* @__PURE__ */ jsx(HeaderActionsSlot, { className: "ml-auto flex shrink-0 items-center", children: /* @__PURE__ */ jsx(
37
- Button,
38
- {
39
- asChild: true,
40
- variant: "quiet",
41
- "aria-label": worstSev ? `Agent drift report \u2014 ${totals[worstSev]} ${worstSev.replace("_", " ")}` : "Agent drift report",
42
- tone: worstSev === "warning" ? "warning" : worstSev ? "destructive" : void 0,
43
- children: /* @__PURE__ */ jsxs(
44
- Link,
45
- {
46
- href: "/reports/agent-drift",
47
- title: meta?.description ?? "Open agent drift report",
48
- children: [
49
- worstSev ? /* @__PURE__ */ jsx(
50
- DriftSeverityBadge,
51
- {
52
- severity: worstSev,
53
- count: totals[worstSev],
54
- size: "sm",
55
- iconOnly: true,
56
- className: "border-0 bg-transparent p-0"
57
- }
58
- ) : /* @__PURE__ */ jsx(FileChartColumn, { className: "h-3.5 w-3.5" }),
59
- /* @__PURE__ */ jsx("span", { className: "hidden sm:inline", children: "Drift" })
60
- ]
61
- }
62
- )
63
- }
64
- ) })
65
- ] });
66
- }
67
- export {
68
- AgentsListHeader
69
- };
@@ -1,9 +0,0 @@
1
- interface AgentEditHistoryProps {
2
- agentId: string;
3
- }
4
- /**
5
- * An agent's in-session undo/redo timeline. A plain body: the host shows it in
6
- * a canvas tab (kind `agent-edit-history`), whose pane header is the chrome.
7
- */
8
- export declare function AgentEditHistory({ agentId }: AgentEditHistoryProps): import("react").JSX.Element;
9
- export {};