@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,571 +0,0 @@
1
- "use client";
2
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { logFailure } from "../../../ui/expectedRefusal.js";
4
- import { useEffect, useRef, useState } from "react";
5
- import { Link } from "../../../host/navigation.js";
6
- import { DynamicIcon } from "@ai-matrx/icons";
7
- import { Loader2, TestTube, ChevronDown, Rocket } from "lucide-react";
8
- import { useAppDispatch, useAppSelector } from "../../../store/hooks.js";
9
- import { fetchAgentExecutionMinimal } from "../../redux/agent-definition/thunks.js";
10
- import {
11
- selectAgentExecutionPayload,
12
- selectAgentVariableDefinitions,
13
- selectAgentError
14
- } from "../../redux/agent-definition/selectors.js";
15
- import { useAgentLauncher } from "../../hooks/useAgentLauncher.js";
16
- import { AgentSelectorIsland } from "../shared/AgentSelectorIsland.js";
17
- import { AgentModeController } from "../shared/AgentModeController.js";
18
- import { AgentSaveStatus } from "../shared/AgentSaveStatus.js";
19
- import { AgentOptionsMenu } from "../shared/AgentOptionsMenu.js";
20
- import { ChevronLeftTapButton } from "@ai-matrx/tap-target/buttons";
21
- import {
22
- getAllDisplayTypes,
23
- getDisplayMeta
24
- } from "../../utils/run-ui-utils.js";
25
- import {
26
- TesterSettingsPanel
27
- } from "../run-controls/TesterSettingsPanel.js";
28
- import { WidgetVariableInputs } from "./WidgetVariableInputs.js";
29
- import { ReadFailure } from "../../../host/ui-slots.js";
30
- import {
31
- buildWidgetLaunchDraft,
32
- sealWidgetLaunchOptions
33
- } from "./build-widget-launch.js";
34
- import { CopyButtons } from "../../../host/ui-slots.js";
35
- import { csvExportItem, jsonExportItem } from "../../../agent-copy/export.js";
36
- import {
37
- agentWidgetTesterKpis,
38
- agentWidgetTesterSummary,
39
- buildAgentWidgetVariableRows
40
- } from "../../format.js";
41
- import { Label } from "@ai-matrx/design-system";
42
- import { Button } from "@ai-matrx/design-system/controls";
43
- import { Badge } from "@ai-matrx/design-system";
44
- import {
45
- DropdownMenu,
46
- DropdownMenuContent,
47
- DropdownMenuItem,
48
- DropdownMenuLabel,
49
- DropdownMenuSeparator,
50
- DropdownMenuTrigger
51
- } from "@ai-matrx/design-system";
52
- import { ProTextarea } from "../../../host/ui-slots.js";
53
- import { afterCurrentLayerCloses } from "../../../ui/after-current-layer-closes.js";
54
- const SURFACE_KEY_PREFIX = "agent-widgets-page";
55
- const DEFAULT_EDITOR_SELECTION = "The capital of France is Paris.";
56
- const DEFAULT_EDITOR_BEFORE = "Many people confuse capital cities.";
57
- const DEFAULT_EDITOR_AFTER = "It is known for the Eiffel Tower.";
58
- const DEFAULT_EDITOR_CONTENT = "Many people confuse capital cities. The capital of France is Paris. It is known for the Eiffel Tower. Some also mix it up with other European landmarks.";
59
- const DEFAULT_EDITOR_CONTEXT = "This is part of a geography quiz about European capitals and common misconceptions.";
60
- function AgentWidgetsPage({
61
- agentId,
62
- currentPath,
63
- initialAgentName,
64
- basePath = "/agents"
65
- }) {
66
- const dispatch = useAppDispatch();
67
- const { launchAgent } = useAgentLauncher();
68
- const launchCounterRef = useRef(0);
69
- const executionPayload = useAppSelector(
70
- (state) => selectAgentExecutionPayload(state, agentId)
71
- );
72
- const variableDefinitions = useAppSelector(
73
- (state) => selectAgentVariableDefinitions(state, agentId)
74
- );
75
- const agentReadError = useAppSelector(
76
- (state) => selectAgentError(state, agentId)
77
- );
78
- useEffect(() => {
79
- if (!executionPayload.isReady) {
80
- dispatch(fetchAgentExecutionMinimal(agentId)).catch(
81
- (err) => logFailure("[AgentWidgetsPage] Failed to load agent execution payload:", err)
82
- );
83
- }
84
- }, [agentId, executionPayload.isReady, dispatch]);
85
- const [variableValues, setVariableValues] = useState(
86
- {}
87
- );
88
- const [userInput, setUserInput] = useState("");
89
- const [autoRun, setAutoRun] = useState(true);
90
- const [showVariablePanel, setShowVariablePanel] = useState(true);
91
- const [variablesPanelStyle, setVariablesPanelStyle] = useState("inline");
92
- const [showPreExecutionGate, setShowPreExecutionGate] = useState(false);
93
- const [preExecutionMessage, setPreExecutionMessage] = useState("");
94
- const [showDefinitionMessages, setShowDefinitionMessages] = useState(true);
95
- const [showDefinitionMessageContent, setShowDefinitionMessageContent] = useState(false);
96
- const [allowChat, setAllowChat] = useState(true);
97
- const [hideReasoning, setHideReasoning] = useState(false);
98
- const [hideToolResults, setHideToolResults] = useState(false);
99
- const [includeEditorContext, setIncludeEditorContext] = useState(false);
100
- const [editorSelection, setEditorSelection] = useState(
101
- DEFAULT_EDITOR_SELECTION
102
- );
103
- const [editorTextBefore, setEditorTextBefore] = useState(
104
- DEFAULT_EDITOR_BEFORE
105
- );
106
- const [editorTextAfter, setEditorTextAfter] = useState(DEFAULT_EDITOR_AFTER);
107
- const [editorContent, setEditorContent] = useState(DEFAULT_EDITOR_CONTENT);
108
- const [editorContext, setEditorContext] = useState(DEFAULT_EDITOR_CONTEXT);
109
- const [apiEndpointMode, setApiEndpointMode] = useState("agent");
110
- const [showAutoClearToggle, setShowAutoClearToggle] = useState(false);
111
- const [autoClearConversation, setAutoClearConversation] = useState(false);
112
- const [jsonExtractionEnabled, setJsonExtractionEnabled] = useState(false);
113
- const [jsonExtractionFuzzy, setJsonExtractionFuzzy] = useState(false);
114
- const [jsonExtractionMaxResults, setJsonExtractionMaxResults] = useState("");
115
- const [overridesJson, setOverridesJson] = useState("");
116
- const [applicationScopeJson, setApplicationScopeJson] = useState("");
117
- const [jsonError, setJsonError] = useState(null);
118
- const controller = {
119
- autoRun,
120
- setAutoRun,
121
- showVariablePanel,
122
- setShowVariablePanel,
123
- variablesPanelStyle,
124
- setVariablesPanelStyle,
125
- showPreExecutionGate,
126
- setShowPreExecutionGate,
127
- preExecutionMessage,
128
- setPreExecutionMessage,
129
- showDefinitionMessages,
130
- setShowDefinitionMessages,
131
- showDefinitionMessageContent,
132
- setShowDefinitionMessageContent,
133
- allowChat,
134
- setAllowChat,
135
- hideReasoning,
136
- setHideReasoning,
137
- hideToolResults,
138
- setHideToolResults,
139
- includeEditorContext,
140
- setIncludeEditorContext,
141
- editorSelection,
142
- setEditorSelection,
143
- editorTextBefore,
144
- setEditorTextBefore,
145
- editorTextAfter,
146
- setEditorTextAfter,
147
- editorContent,
148
- setEditorContent,
149
- editorContext,
150
- setEditorContext,
151
- apiEndpointMode,
152
- setApiEndpointMode,
153
- showAutoClearToggle,
154
- setShowAutoClearToggle,
155
- autoClearConversation,
156
- setAutoClearConversation,
157
- jsonExtractionEnabled,
158
- setJsonExtractionEnabled,
159
- jsonExtractionFuzzy,
160
- setJsonExtractionFuzzy,
161
- jsonExtractionMaxResults,
162
- setJsonExtractionMaxResults,
163
- overridesJson,
164
- setOverridesJson,
165
- applicationScopeJson,
166
- setApplicationScopeJson,
167
- jsonError
168
- };
169
- const displayTypes = getAllDisplayTypes().filter((m) => m !== "direct" && m !== "background").map((displayMode) => {
170
- const meta = getDisplayMeta(displayMode);
171
- const IconComponent = (props) => /* @__PURE__ */ jsx(DynamicIcon, { name: meta.icon, ...props });
172
- return {
173
- name: meta.label,
174
- icon: IconComponent,
175
- color: meta.color,
176
- displayMode,
177
- note: meta.description,
178
- testMode: meta.testMode
179
- };
180
- });
181
- const launchState = {
182
- variableValues,
183
- userInput,
184
- autoRun,
185
- showVariablePanel,
186
- variablesPanelStyle,
187
- showPreExecutionGate,
188
- preExecutionMessage,
189
- showDefinitionMessages,
190
- showDefinitionMessageContent,
191
- allowChat,
192
- hideReasoning,
193
- hideToolResults,
194
- includeEditorContext,
195
- editorSelection,
196
- editorTextBefore,
197
- editorTextAfter,
198
- editorContent,
199
- editorContext,
200
- apiEndpointMode,
201
- showAutoClearToggle,
202
- autoClearConversation,
203
- jsonExtractionEnabled,
204
- jsonExtractionFuzzy,
205
- jsonExtractionMaxResults,
206
- overridesJson,
207
- applicationScopeJson
208
- };
209
- const openWithDisplayType = async (displayMode) => {
210
- await afterCurrentLayerCloses();
211
- launchCounterRef.current += 1;
212
- const uniqueSurfaceKey = `${SURFACE_KEY_PREFIX}:${agentId}:${displayMode}:${launchCounterRef.current}:${Date.now()}`;
213
- setJsonError(null);
214
- const build = buildWidgetLaunchDraft(launchState);
215
- if (!build.ok) {
216
- setJsonError(build.error);
217
- return;
218
- }
219
- try {
220
- await launchAgent(
221
- agentId,
222
- sealWidgetLaunchOptions(build.draft, {
223
- surfaceKey: uniqueSurfaceKey,
224
- displayMode
225
- })
226
- );
227
- } catch (error) {
228
- console.error("Widget launch failed:", error);
229
- setJsonError(
230
- `Launch failed: ${error instanceof Error ? error.message : "unknown"}`
231
- );
232
- }
233
- };
234
- useEffect(() => {
235
- setVariableValues({});
236
- }, [agentId]);
237
- const isLoading = !executionPayload.isReady;
238
- const location = `AI Matrx \u2014 Agent widget tester (${basePath}/${agentId}/widgets)`;
239
- const definitions = variableDefinitions ?? [];
240
- const variableRows = () => buildAgentWidgetVariableRows(definitions, variableValues);
241
- const kpis = () => agentWidgetTesterKpis({
242
- definitions,
243
- values: variableValues,
244
- userInput,
245
- includeEditorContext,
246
- jsonError
247
- });
248
- const displayModeNames = displayTypes.map((d) => d.name);
249
- const launchPreview = () => {
250
- const build = buildWidgetLaunchDraft(launchState);
251
- return build.ok ? {
252
- status: "ready",
253
- note: "surfaceKey and config.displayMode are assigned when a display mode is clicked; everything else below is exactly what ships to launchAgent.",
254
- display_modes_available: displayModeNames,
255
- draft: build.draft
256
- } : {
257
- status: "blocked",
258
- note: "Clicking a display mode right now would not launch \u2014 this error is what the tester shows instead.",
259
- error: build.error,
260
- display_modes_available: displayModeNames
261
- };
262
- };
263
- const testerView = () => ({
264
- agent: { id: agentId, name: initialAgentName },
265
- state: isLoading ? "loading agent definition" : "ready",
266
- kpis: kpis(),
267
- error_on_screen: jsonError,
268
- variables: variableRows(),
269
- user_input: userInput,
270
- settings: {
271
- auto_run: autoRun,
272
- allow_chat: allowChat,
273
- show_variable_panel: showVariablePanel,
274
- variables_panel_style: variablesPanelStyle,
275
- show_pre_execution_gate: showPreExecutionGate,
276
- pre_execution_message: preExecutionMessage,
277
- show_definition_messages: showDefinitionMessages,
278
- show_definition_message_content: showDefinitionMessageContent,
279
- hide_reasoning: hideReasoning,
280
- hide_tool_results: hideToolResults
281
- },
282
- editor_context: {
283
- included: includeEditorContext,
284
- selection: editorSelection,
285
- text_before: editorTextBefore,
286
- text_after: editorTextAfter,
287
- content: editorContent,
288
- context: editorContext
289
- },
290
- advanced: {
291
- api_endpoint_mode: apiEndpointMode,
292
- show_auto_clear_toggle: showAutoClearToggle,
293
- auto_clear_conversation: autoClearConversation,
294
- json_extraction_enabled: jsonExtractionEnabled,
295
- json_extraction_fuzzy: jsonExtractionFuzzy,
296
- json_extraction_max_results: jsonExtractionMaxResults,
297
- overrides_json: overridesJson,
298
- application_scope_json: applicationScopeJson
299
- },
300
- launch_preview: launchPreview()
301
- });
302
- const testerHuman = () => agentWidgetTesterSummary({
303
- agentId,
304
- agentName: initialAgentName,
305
- kpis: kpis(),
306
- variables: variableRows(),
307
- userInput,
308
- jsonError,
309
- isLoading,
310
- displayModes: displayModeNames
311
- });
312
- const testerAttributes = () => ({
313
- ...kpis(),
314
- agent_id: agentId,
315
- launch_status: launchPreview().status
316
- });
317
- return /* @__PURE__ */ jsxs("div", { className: "relative flex flex-col h-full overflow-hidden", children: [
318
- /* @__PURE__ */ jsxs("div", { className: "@container/agent-header hidden lg:flex items-center justify-between w-full gap-2 shrink-0 pr-12", children: [
319
- /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
320
- /* @__PURE__ */ jsx(Link, { href: basePath, "aria-label": "Back to Agents", children: /* @__PURE__ */ jsx(ChevronLeftTapButton, { variant: "transparent" }) }),
321
- /* @__PURE__ */ jsx(
322
- AgentSelectorIsland,
323
- {
324
- agentId,
325
- initialName: initialAgentName,
326
- basePath
327
- }
328
- )
329
- ] }),
330
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
331
- AgentModeController,
332
- {
333
- agentId,
334
- basePath,
335
- currentPath
336
- }
337
- ) }),
338
- /* @__PURE__ */ jsxs("div", { className: "flex items-center pt-0.5 shrink-0", children: [
339
- /* @__PURE__ */ jsx(
340
- CopyButtons,
341
- {
342
- size: "icon",
343
- label: `Widget tester \u2014 ${initialAgentName}`,
344
- human: testerHuman,
345
- json: testerView,
346
- agent: () => ({
347
- kind: "agent-widget-tester",
348
- location,
349
- description: `The agent widget tester for ${initialAgentName} exactly as configured on screen right now: live variable values, user input, every launch setting, and the launch options a display-mode click would ship.`,
350
- data: testerView(),
351
- summary: testerHuman(),
352
- attributes: testerAttributes(),
353
- context: { agent_name: initialAgentName, base_path: basePath }
354
- }),
355
- agentVariant: {
356
- label: "This page (what I see)",
357
- hint: "Live form state + the launch draft it produces",
358
- position: "first"
359
- },
360
- aiVariants: [
361
- {
362
- id: "launch-options",
363
- label: "Launch options only",
364
- hint: "Just what ships to launchAgent",
365
- build: () => ({
366
- kind: "agent-widget-launch-options",
367
- location,
368
- description: `The launch options the widget tester would send for ${initialAgentName}, built by the same builder the Launch dropdown uses.`,
369
- data: {
370
- agent: { id: agentId, name: initialAgentName },
371
- kpis: kpis(),
372
- error_on_screen: jsonError,
373
- launch_preview: launchPreview()
374
- },
375
- attributes: testerAttributes()
376
- })
377
- },
378
- {
379
- id: "variables",
380
- label: "Variables + input",
381
- hint: "Definitions, live values, and the user input",
382
- build: () => ({
383
- kind: "agent-widget-variables",
384
- location,
385
- description: `The variable definitions for ${initialAgentName} with the values currently typed into the tester, plus the user input box.`,
386
- data: {
387
- agent: { id: agentId, name: initialAgentName },
388
- kpis: kpis(),
389
- error_on_screen: jsonError,
390
- variables: variableRows(),
391
- user_input: userInput
392
- },
393
- attributes: testerAttributes()
394
- })
395
- }
396
- ],
397
- export: {
398
- items: [
399
- jsonExportItem(testerView, "JSON (page state)"),
400
- jsonExportItem(launchPreview, "JSON (launch options)"),
401
- csvExportItem(
402
- () => variableRows().map((row) => ({
403
- name: row.name,
404
- required: row.required,
405
- input_kind: row.input_kind,
406
- filled: row.filled,
407
- current_value: row.current_value === void 0 ? "" : JSON.stringify(row.current_value),
408
- default_value: row.default_value === void 0 ? "" : JSON.stringify(row.default_value),
409
- help_text: row.help_text ?? "",
410
- bound_to_context_item: row.bound_to_context_item ?? ""
411
- })),
412
- "CSV (all variables)"
413
- )
414
- ]
415
- }
416
- }
417
- ),
418
- /* @__PURE__ */ jsx("div", { className: "px-[calc(var(--matrx-tap-gap)/2)]", children: /* @__PURE__ */ jsx(AgentSaveStatus, { agentId }) }),
419
- /* @__PURE__ */ jsx(AgentOptionsMenu, { agentId, basePath })
420
- ] })
421
- ] }),
422
- /* @__PURE__ */ jsxs("div", { className: "flex-1 overflow-hidden flex min-w-0", children: [
423
- /* @__PURE__ */ jsx("aside", { className: "w-[280px] shrink-0 overflow-y-auto", children: /* @__PURE__ */ jsxs("div", { className: "p-2 space-y-2", children: [
424
- /* @__PURE__ */ jsxs(DropdownMenu, { children: [
425
- /* @__PURE__ */ jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
426
- Button,
427
- {
428
- iconEnd: /* @__PURE__ */ jsx(ChevronDown, { className: "opacity-70" }),
429
- variant: "outline",
430
- disabled: isLoading,
431
- className: "w-full justify-between",
432
- children: /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
433
- /* @__PURE__ */ jsx(Rocket, { className: "w-3.5 h-3.5 text-primary" }),
434
- "Launch Display Mode"
435
- ] })
436
- }
437
- ) }),
438
- /* @__PURE__ */ jsxs(DropdownMenuContent, { align: "start", className: "w-[260px]", children: [
439
- /* @__PURE__ */ jsx(DropdownMenuLabel, { className: "text-[10px] uppercase tracking-wider text-primary", children: "Pick a Display Mode" }),
440
- /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
441
- displayTypes.map((display) => /* @__PURE__ */ jsxs(
442
- DropdownMenuItem,
443
- {
444
- onSelect: () => openWithDisplayType(display.displayMode),
445
- title: display.note,
446
- className: "gap-2 text-xs",
447
- children: [
448
- display.icon && /* @__PURE__ */ jsx(
449
- display.icon,
450
- {
451
- className: `w-4 h-4 shrink-0 ${display.color}`
452
- }
453
- ),
454
- /* @__PURE__ */ jsx("span", { className: "flex-1 font-medium", children: display.name }),
455
- display.testMode && /* @__PURE__ */ jsx(Badge, { variant: "outline", className: "text-[8px] h-4 px-1", children: /* @__PURE__ */ jsx(TestTube, { className: "w-2.5 h-2.5" }) })
456
- ]
457
- },
458
- display.displayMode
459
- ))
460
- ] })
461
- ] }),
462
- /* @__PURE__ */ jsx(
463
- TesterSettingsPanel,
464
- {
465
- controller,
466
- idPrefix: "widgets-page"
467
- }
468
- )
469
- ] }) }),
470
- /* @__PURE__ */ jsx("main", { className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ jsx("div", { className: "p-4 max-w-3xl space-y-5", children: agentReadError && isLoading ? /* @__PURE__ */ jsx(
471
- ReadFailure,
472
- {
473
- error: agentReadError,
474
- what: "this agent's definition",
475
- onRetry: () => void dispatch(fetchAgentExecutionMinimal(agentId))
476
- }
477
- ) : isLoading ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
478
- /* @__PURE__ */ jsx(Loader2, { className: "h-3.5 w-3.5 animate-spin" }),
479
- "Loading agent definition\u2026"
480
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
481
- /* @__PURE__ */ jsxs("section", { className: "group/vars space-y-2", children: [
482
- /* @__PURE__ */ jsxs("div", { className: "flex items-baseline justify-between gap-2", children: [
483
- /* @__PURE__ */ jsx(Label, { className: "text-xs font-semibold text-foreground uppercase tracking-wider", children: "Variables" }),
484
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
485
- /* @__PURE__ */ jsxs("span", { className: "text-[10px] text-muted-foreground", children: [
486
- definitions.length,
487
- " defined"
488
- ] }),
489
- /* @__PURE__ */ jsx("span", { className: "opacity-0 transition-opacity focus-within:opacity-100 group-hover/vars:opacity-100", children: /* @__PURE__ */ jsx(
490
- CopyButtons,
491
- {
492
- size: "xs",
493
- label: "Widget tester variables",
494
- human: () => variableRows().length ? variableRows().map(
495
- (row) => `- ${row.name}${row.required ? " *" : ""}: ${row.filled ? JSON.stringify(row.current_value) : "(empty)"}`
496
- ).join("\n") : "This agent has no variable definitions.",
497
- json: variableRows,
498
- agent: () => ({
499
- kind: "agent-widget-variables",
500
- location,
501
- description: `The Variables section of the widget tester for ${initialAgentName} \u2014 every definition with the value currently typed in.`,
502
- data: {
503
- agent: { id: agentId, name: initialAgentName },
504
- kpis: kpis(),
505
- error_on_screen: jsonError,
506
- variables: variableRows()
507
- },
508
- attributes: testerAttributes()
509
- })
510
- }
511
- ) })
512
- ] })
513
- ] }),
514
- /* @__PURE__ */ jsx(
515
- WidgetVariableInputs,
516
- {
517
- definitions,
518
- values: variableValues,
519
- onChange: setVariableValues
520
- }
521
- )
522
- ] }),
523
- /* @__PURE__ */ jsxs("section", { className: "group/input space-y-1.5", children: [
524
- /* @__PURE__ */ jsxs("div", { className: "flex items-baseline justify-between gap-2", children: [
525
- /* @__PURE__ */ jsx(
526
- Label,
527
- {
528
- htmlFor: "widgets-user-input",
529
- className: "text-xs font-semibold text-foreground uppercase tracking-wider",
530
- children: "User Input"
531
- }
532
- ),
533
- /* @__PURE__ */ jsx("span", { className: "opacity-0 transition-opacity focus-within:opacity-100 group-hover/input:opacity-100", children: /* @__PURE__ */ jsx(
534
- CopyButtons,
535
- {
536
- size: "xs",
537
- label: "Widget tester user input",
538
- human: () => userInput || "(empty)",
539
- agent: () => ({
540
- kind: "agent-widget-user-input",
541
- location,
542
- description: `The user-input text currently typed into the widget tester for ${initialAgentName} \u2014 the text that would ship as runtime.userInput.`,
543
- data: {
544
- agent: { id: agentId, name: initialAgentName },
545
- kpis: kpis(),
546
- user_input: userInput
547
- },
548
- attributes: testerAttributes()
549
- })
550
- }
551
- ) })
552
- ] }),
553
- /* @__PURE__ */ jsx(
554
- ProTextarea,
555
- {
556
- id: "widgets-user-input",
557
- value: userInput,
558
- onChange: (e) => setUserInput(e.target.value),
559
- rows: 4,
560
- placeholder: "Text the user would send with this launch (optional)",
561
- className: "w-full resize-y rounded-md border border-border bg-background px-2 py-1.5 text-sm leading-relaxed placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
562
- }
563
- )
564
- ] })
565
- ] }) }) })
566
- ] })
567
- ] });
568
- }
569
- export {
570
- AgentWidgetsPage
571
- };
@@ -1,8 +0,0 @@
1
- import type { VariableDefinition } from "../../types/agent-definition.types.js";
2
- interface WidgetVariableInputsProps {
3
- definitions: VariableDefinition[];
4
- values: Record<string, unknown>;
5
- onChange: (next: Record<string, unknown>) => void;
6
- }
7
- export declare function WidgetVariableInputs({ definitions, values, onChange, }: WidgetVariableInputsProps): import("react").JSX.Element;
8
- export {};
@@ -1,80 +0,0 @@
1
- "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import { Label } from "@ai-matrx/design-system";
4
- import { ProTextarea } from "../../../host/ui-slots.js";
5
- import { variableRunLabel } from "@ai-matrx/agents";
6
- function kindFromDefinition(def) {
7
- const type = def.customComponent?.type;
8
- if (type === "number" || type === "slider") return "number";
9
- return "text";
10
- }
11
- function WidgetVariableInputs({
12
- definitions,
13
- values,
14
- onChange
15
- }) {
16
- if (!definitions || definitions.length === 0) {
17
- return /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground italic", children: "This agent has no variable definitions." });
18
- }
19
- const setValue = (name, value) => {
20
- const next = { ...values, [name]: value };
21
- if (value === "" || value === null || value === void 0) {
22
- delete next[name];
23
- }
24
- onChange(next);
25
- };
26
- return /* @__PURE__ */ jsx("div", { className: "space-y-3", children: definitions.map((def) => {
27
- const id = `widgets-var-${def.name}`;
28
- const kind = kindFromDefinition(def);
29
- const current = values[def.name];
30
- return /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
31
- /* @__PURE__ */ jsxs("div", { className: "flex items-baseline justify-between gap-2", children: [
32
- /* @__PURE__ */ jsxs(
33
- Label,
34
- {
35
- htmlFor: id,
36
- className: "text-xs font-medium text-foreground cursor-pointer",
37
- children: [
38
- variableRunLabel(def),
39
- def.required && /* @__PURE__ */ jsx("span", { className: "text-destructive ml-0.5", children: "*" })
40
- ]
41
- }
42
- ),
43
- def.customComponent?.type && /* @__PURE__ */ jsx("span", { className: "text-[10px] text-muted-foreground font-mono", children: def.customComponent.type })
44
- ] }),
45
- def.helpText && /* @__PURE__ */ jsx("p", { className: "text-[10.5px] text-muted-foreground leading-tight", children: def.helpText }),
46
- kind === "number" ? /* @__PURE__ */ jsx(
47
- "input",
48
- {
49
- id,
50
- type: "number",
51
- value: typeof current === "number" || typeof current === "string" ? String(current) : "",
52
- onChange: (e) => {
53
- const raw = e.target.value;
54
- if (raw === "") {
55
- setValue(def.name, "");
56
- return;
57
- }
58
- const num = Number(raw);
59
- setValue(def.name, Number.isFinite(num) ? num : raw);
60
- },
61
- placeholder: def.defaultValue != null ? String(def.defaultValue) : "0",
62
- className: "w-full h-8 rounded-md border border-border bg-background px-2 text-sm leading-tight placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
63
- }
64
- ) : /* @__PURE__ */ jsx(
65
- ProTextarea,
66
- {
67
- id,
68
- value: typeof current === "string" ? current : current == null ? "" : String(current),
69
- onChange: (e) => setValue(def.name, e.target.value),
70
- rows: 2,
71
- placeholder: def.defaultValue != null ? String(def.defaultValue) : "",
72
- className: "w-full resize-y rounded-md border border-border bg-background px-2 py-1 text-sm leading-relaxed placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
73
- }
74
- )
75
- ] }, def.name);
76
- }) });
77
- }
78
- export {
79
- WidgetVariableInputs
80
- };