@ai-matrx/chat 0.4.2 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +54 -0
- package/dist/agent-copy/RichCopySplit.d.ts +17 -0
- package/dist/agent-copy/RichCopySplit.js +34 -0
- package/dist/agents/components/agent-widgets/chat-assistant/AssistantMessageCard.js +1 -1
- package/dist/agents/components/chat/ConversationRecordsChip.js +1 -1
- package/dist/agents/components/context-items/bodies/WorkingDocumentBody.d.ts +5 -2
- package/dist/agents/components/context-items/bodies/WorkingDocumentBody.js +6 -1
- package/dist/agents/components/context-policies-display/ContextValueBody.js +1 -1
- package/dist/agents/components/context-preview/ContextCompareView.js +1 -1
- package/dist/agents/components/custom-agent/CustomAgentWindow.js +1 -1
- package/dist/agents/components/inputs/smart-input/AgentTextarea.d.ts +6 -1
- package/dist/agents/components/inputs/smart-input/AgentTextarea.js +2 -2
- package/dist/agents/components/inputs/smart-input/ComposerToolsNotice.d.ts +1 -0
- package/dist/agents/components/inputs/smart-input/ComposerToolsNotice.js +5 -0
- package/dist/agents/components/inputs/smart-input/ConversationContextRail.d.ts +5 -1
- package/dist/agents/components/inputs/smart-input/ConversationContextRail.js +6 -1
- package/dist/agents/components/inputs/smart-input/InboxQueueStrip.d.ts +6 -1
- package/dist/agents/components/inputs/smart-input/InboxQueueStrip.js +6 -1
- package/dist/agents/components/inputs/smart-input/InputActionButtons.js +8 -6
- package/dist/agents/components/inputs/smart-input/SmartInputFileDropTarget.d.ts +5 -1
- package/dist/agents/components/inputs/smart-input/SmartInputFileDropTarget.js +8 -1
- package/dist/agents/components/inputs/smart-input/composer/ComposerAgentPill.js +2 -2
- package/dist/agents/components/inputs/smart-input/composer/ComposerChipsRow.d.ts +5 -2
- package/dist/agents/components/inputs/smart-input/composer/ComposerChipsRow.js +6 -1
- package/dist/agents/components/inputs/smart-input/composer/ComposerMetaRow.d.ts +6 -8
- package/dist/agents/components/inputs/smart-input/composer/ComposerMetaRow.js +13 -1
- package/dist/agents/components/inputs/smart-input/composer/useOutputShapeCatalog.d.ts +1 -1
- package/dist/agents/components/inputs/smart-input/composer/useOutputShapeCatalog.js +1 -1
- package/dist/agents/components/live-run/LiveRunDisplay.js +1 -1
- package/dist/agents/components/live-run/RunSetDisplay.js +1 -1
- package/dist/agents/components/memory/components/AgentMemoryAllView.js +1 -1
- package/dist/agents/components/messages-display/assistant/AgentAssistantMessage.d.ts +1 -0
- package/dist/agents/components/messages-display/assistant/AgentAssistantMessage.js +4 -3
- package/dist/agents/components/messages-display/assistant/AgentEmptyMessageDisplay.js +1 -1
- package/dist/agents/components/messages-display/assistant/AssistantMessageFooter.d.ts +2 -2
- package/dist/agents/components/messages-display/assistant/AssistantMessageFooter.js +4 -7
- package/dist/agents/components/messages-display/assistant/InPlaceAnswerEditor.js +2 -2
- package/dist/agents/components/messages-display/citations/MessageSourcesRow.js +1 -1
- package/dist/agents/components/messages-display/rich-document/chat-message-source.d.ts +2 -0
- package/dist/agents/components/messages-display/rich-document/chat-message-source.js +41 -0
- package/dist/agents/components/messages-display/rich-document/chatMessageActions.d.ts +31 -0
- package/dist/agents/components/messages-display/rich-document/chatMessageActions.js +39 -0
- package/dist/agents/components/messages-display/user/AgentUserMessage.d.ts +1 -0
- package/dist/agents/components/messages-display/user/AgentUserMessage.js +7 -4
- package/dist/agents/components/messages-display/user/CollabNoteMessage.js +1 -1
- package/dist/agents/components/messages-display/user/UserActionBar.js +49 -39
- package/dist/agents/components/working-document/WorkingDocumentEditor.d.ts +1 -1
- package/dist/agents/components/working-document/WorkingDocumentPanel.js +2 -1
- package/dist/agents/identity/run-tier-store.js +3 -0
- package/dist/agents/redux/agent-definition/cache-bust-middleware.js +2 -0
- package/dist/agents/redux/agent-settings/agentSettingsSlice.d.ts +0 -4
- package/dist/agents/redux/agent-settings/agentSettingsSlice.js +12 -5
- package/dist/agents/redux/execution-system/host-conversations/host-conversation.thunks.d.ts +4 -1
- package/dist/agents/redux/execution-system/host-conversations/host-conversation.thunks.js +45 -0
- package/dist/agents/redux/execution-system/inbox/inbox-turn-end.middleware.js +2 -1
- package/dist/agents/redux/execution-system/instance-ui-state/run-configuration-persist.js +2 -0
- package/dist/agents/redux/execution-system/messages/messages.selectors.js +1 -1
- package/dist/agents/redux/execution-system/thunks/execute-instance.thunk.js +6 -0
- package/dist/agents/redux/execution-system/thunks/process-stream.js +1 -1
- package/dist/agents/redux/execution-system/utils/assemble-cx-content-blocks.js +2 -1
- package/dist/agents/redux/execution-system/utils/inbound-render-block.d.ts +8 -0
- package/dist/agents/redux/execution-system/utils/inbound-render-block.js +17 -2
- package/dist/agents/redux/execution-system/utils/normalize-content-blocks.js +1 -1
- package/dist/agents/redux/execution-system/utils/progress-data-block.d.ts +11 -0
- package/dist/agents/redux/execution-system/utils/progress-data-block.js +37 -0
- package/dist/agents/redux/execution-system/utils/stream-block-accumulator.js +10 -8
- package/dist/agents/redux/mcp/mcp.slice.js +15 -7
- package/dist/agents/redux/tools/tools.thunks.js +3 -0
- package/dist/agents/runtime-reconnect/ServerOperationBanner.d.ts +6 -1
- package/dist/agents/runtime-reconnect/ServerOperationBanner.js +6 -1
- package/dist/agents/ui-first-tools/ui/ApprovalCard.js +1 -1
- package/dist/agents/ui-first-tools/ui/AskCard.js +1 -1
- package/dist/agents/ui-first-tools/ui/lists/TaskPanel.js +1 -1
- package/dist/conversation/hooks/useDomCapturePrint.js +1 -1
- package/dist/conversation/utils/markdown-print.js +1 -1
- package/dist/cx-chat/components/messages/AssistantMessage.js +3 -5
- package/dist/cx-conversation/AssistantMessage.js +3 -5
- package/dist/host/app-data-slots.d.ts +85 -0
- package/dist/host/app-data-slots.js +42 -0
- package/dist/host/bare-host-chrome.js +1 -0
- package/dist/host/defaults/prefs.d.ts +11 -0
- package/dist/host/defaults/prefs.js +43 -0
- package/dist/host/defaults/workspace-gate.js +2 -1
- package/dist/host/index.d.ts +1 -1
- package/dist/host/index.js +2 -1
- package/dist/host/react.js +16 -1
- package/dist/host/source.d.ts +21 -0
- package/dist/host/ui-slots.d.ts +1 -23
- package/dist/host/ui-slots.js +0 -34
- package/dist/public-chat/components/PublicMessageOptionsMenu.js +2 -1
- package/dist/surfaces/redux/surfaceConfigSlice.js +2 -0
- package/dist/surfaces/redux/userStateSlice.js +3 -1
- package/dist/surfaces/runtime/agent-offer.js +1 -1
- package/dist/surfaces/runtime/surface-writeback.js +1 -1
- package/dist/tool-call-visualization/db-renderer/fetchToolRendererRow.js +2 -0
- package/dist/tool-call-visualization/renderers/agent-call/AgentCallInline.js +1 -1
- package/dist/tool-call-visualization/renderers/agent-call/CollabCallCard.js +1 -1
- package/dist/tool-call-visualization/renderers/fs/FsInline.js +1 -1
- package/dist/tool-call-visualization/renderers/random-wheel/RandomWheelInline.js +1 -1
- package/dist/tool-call-visualization/renderers/research/ResearchOverlay.js +4 -4
- package/dist/tool-call-visualization/renderers/research/SubagentReportBlock.js +2 -2
- package/dist/tool-call-visualization/renderers/scrape/ScrapeOverlay.js +1 -1
- package/dist/tool-call-visualization/renderers/search/SearchInline.js +1 -1
- package/dist/tool-call-visualization/renderers/search/SearchOverlay.js +1 -1
- package/dist/tool-call-visualization/renderers/sql/SqlInline.js +1 -1
- package/dist/tool-call-visualization/result-fields/KeyValueGrid.js +1 -1
- package/dist/tool-call-visualization/result-fields/ResultMarkdown.js +1 -1
- package/dist/tool-call-visualization/result-fields/ResultValue.js +1 -1
- package/dist/tool-call-visualization/surface-write/SurfaceWriteDiff.js +1 -1
- package/dist/ui/AudioOutputBlockSkeleton.d.ts +17 -0
- package/dist/ui/AudioOutputBlockSkeleton.js +78 -0
- package/dist/ui/chat-protocol-from-stream.d.ts +60 -0
- package/dist/ui/chat-protocol-from-stream.js +135 -0
- package/dist/ui/markdown-stream/EnhancedChatMarkdown.d.ts +59 -0
- package/dist/ui/markdown-stream/EnhancedChatMarkdown.js +1108 -0
- package/dist/ui/markdown-stream/MarkdownStream.d.ts +88 -0
- package/dist/ui/markdown-stream/MarkdownStream.js +14 -0
- package/dist/ui/markdown-stream/MarkdownStreamImpl.d.ts +4 -0
- package/dist/ui/markdown-stream/MarkdownStreamImpl.js +86 -0
- package/dist/ui/markdown-stream/StreamAwareChatMarkdown.d.ts +58 -0
- package/dist/ui/markdown-stream/StreamAwareChatMarkdown.js +294 -0
- package/dist/ui/markdown-stream/internal-handlers/AgentCallChildTrace.d.ts +22 -0
- package/dist/ui/markdown-stream/internal-handlers/AgentCallChildTrace.js +128 -0
- package/dist/ui/markdown-stream/internal-handlers/InlineAssistantError.d.ts +3 -0
- package/dist/ui/markdown-stream/internal-handlers/InlineAssistantError.js +26 -0
- package/dist/ui/markdown-stream/internal-handlers/InlineThinkingSlot.d.ts +14 -0
- package/dist/ui/markdown-stream/internal-handlers/InlineThinkingSlot.js +23 -0
- package/dist/ui/markdown-stream/internal-handlers/ToolHandlers.d.ts +42 -0
- package/dist/ui/markdown-stream/internal-handlers/ToolHandlers.js +109 -0
- package/dist/ui/markdown-stream/useBoundAgentOutputSchema.d.ts +2 -0
- package/dist/ui/markdown-stream/useBoundAgentOutputSchema.js +33 -0
- package/dist/window-panels/windows/agents/AgentAssistantMarkdownDebugWindow.js +1 -1
- package/package.json +7 -5
- package/dist/host/content-ir-slots.d.ts +0 -235
- package/dist/host/content-ir-slots.js +0 -135
- package/dist/host/markdown-slots.d.ts +0 -53
- package/dist/host/markdown-slots.js +0 -32
- package/dist/host/rich-document-slots.d.ts +0 -123
- package/dist/host/rich-document-slots.js +0 -36
- package/dist/utils/content-ir/report-kind-at-raw-renderer.d.ts +0 -19
- package/dist/utils/content-ir/report-kind-at-raw-renderer.js +0 -32
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useMemo, useState } from "react";
|
|
4
|
+
import { useAppDispatch, useAppSelector } from "../../../store/hooks.js";
|
|
5
|
+
import { selectAgentCallTrace } from "../../../agents/redux/execution-system/active-requests/active-requests.selectors.js";
|
|
6
|
+
import {
|
|
7
|
+
selectConversationMessages,
|
|
8
|
+
selectMessagesInterleavedRuns
|
|
9
|
+
} from "../../../agents/redux/execution-system/messages/messages.selectors.js";
|
|
10
|
+
import { loadAgentCallChildConversation } from "../../../agents/redux/execution-system/thunks/load-agent-call-child.thunk.js";
|
|
11
|
+
import {
|
|
12
|
+
childConversationIdFromResult,
|
|
13
|
+
persistedAgentCallTrace
|
|
14
|
+
} from "../../../agents/redux/execution-system/utils/agent-call-trace.js";
|
|
15
|
+
import { useConversationTitle } from "../../../agents/hooks/useConversationTitle.js";
|
|
16
|
+
import { EntityRef } from "../../../host/ui-slots.js";
|
|
17
|
+
import ReasoningVisualization from "@ai-matrx/rich-content/display/blocks/thinking-reasoning/ReasoningVisualization";
|
|
18
|
+
import { isCollaborationAgentCall } from "../../../tool-call-visualization/renderers/agent-call/collab.js";
|
|
19
|
+
import { InlineThinkingSlot } from "./InlineThinkingSlot.js";
|
|
20
|
+
const NO_LIVE_TRACE = () => null;
|
|
21
|
+
const EMPTY_MESSAGES = [];
|
|
22
|
+
const EMPTY_RUNS = [];
|
|
23
|
+
const NO_MESSAGES = () => EMPTY_MESSAGES;
|
|
24
|
+
const NO_RUNS = () => EMPTY_RUNS;
|
|
25
|
+
function AgentCallChildTrace({
|
|
26
|
+
entry,
|
|
27
|
+
conversationId,
|
|
28
|
+
requestId,
|
|
29
|
+
ToolCardComponent
|
|
30
|
+
}) {
|
|
31
|
+
const dispatch = useAppDispatch();
|
|
32
|
+
const liveSelector = useMemo(
|
|
33
|
+
() => requestId ? selectAgentCallTrace(requestId, entry.callId) : NO_LIVE_TRACE,
|
|
34
|
+
[requestId, entry.callId]
|
|
35
|
+
);
|
|
36
|
+
const streamed = useAppSelector(liveSelector);
|
|
37
|
+
const childId = streamed?.childConversationId ?? childConversationIdFromResult(entry.result);
|
|
38
|
+
const settled = entry.status === "completed" || entry.status === "error";
|
|
39
|
+
const live = settled && childId ? null : streamed;
|
|
40
|
+
const persistedId = !live && childId ? childId : null;
|
|
41
|
+
const [failed, setFailed] = useState(false);
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (!persistedId) return;
|
|
44
|
+
dispatch(loadAgentCallChildConversation({ childConversationId: persistedId })).unwrap().then(() => setFailed(false)).catch(() => setFailed(true));
|
|
45
|
+
}, [dispatch, persistedId]);
|
|
46
|
+
const messages = useAppSelector(
|
|
47
|
+
persistedId ? selectConversationMessages(persistedId) : NO_MESSAGES
|
|
48
|
+
);
|
|
49
|
+
const assistantIds = messages.filter((m) => m.role === "assistant").map((m) => m.id);
|
|
50
|
+
const idsKey = assistantIds.join(",");
|
|
51
|
+
const runsSelector = useMemo(
|
|
52
|
+
() => persistedId && idsKey ? selectMessagesInterleavedRuns(persistedId, idsKey.split(",")) : NO_RUNS,
|
|
53
|
+
[persistedId, idsKey]
|
|
54
|
+
);
|
|
55
|
+
const runs = useAppSelector(runsSelector);
|
|
56
|
+
const persisted = persistedAgentCallTrace(runs);
|
|
57
|
+
const title = useConversationTitle(childId);
|
|
58
|
+
const showDoor = !!childId && !isCollaborationAgentCall(entry);
|
|
59
|
+
const hasItems = live ? live.items.length > 0 : persisted.length > 0;
|
|
60
|
+
if (!hasItems && !showDoor && !failed) return null;
|
|
61
|
+
return /* @__PURE__ */ jsxs(
|
|
62
|
+
"div",
|
|
63
|
+
{
|
|
64
|
+
className: "ml-3 mt-1 flex flex-col gap-1 border-l border-border pl-3",
|
|
65
|
+
"data-agent-call-trace": entry.callId,
|
|
66
|
+
children: [
|
|
67
|
+
live ? live.items.map(
|
|
68
|
+
(item) => item.kind === "thinking" ? /* @__PURE__ */ jsx(
|
|
69
|
+
InlineThinkingSlot,
|
|
70
|
+
{
|
|
71
|
+
requestId: requestId ?? "",
|
|
72
|
+
chunkStartIndex: item.chunkStartIndex,
|
|
73
|
+
chunkEndIndex: item.chunkEndIndex,
|
|
74
|
+
renderReasoning: (content, isStreaming) => /* @__PURE__ */ jsx(
|
|
75
|
+
ReasoningVisualization,
|
|
76
|
+
{
|
|
77
|
+
reasoningText: content,
|
|
78
|
+
isStreaming
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
},
|
|
82
|
+
`thinking-${item.chunkStartIndex}`
|
|
83
|
+
) : /* @__PURE__ */ jsx(
|
|
84
|
+
ToolCardComponent,
|
|
85
|
+
{
|
|
86
|
+
callId: item.callId,
|
|
87
|
+
requestId,
|
|
88
|
+
conversationId
|
|
89
|
+
},
|
|
90
|
+
`tool-${item.callId}`
|
|
91
|
+
)
|
|
92
|
+
) : persisted.map(
|
|
93
|
+
(item, i) => item.kind === "thinking" ? /* @__PURE__ */ jsx(
|
|
94
|
+
ReasoningVisualization,
|
|
95
|
+
{
|
|
96
|
+
reasoningText: item.content
|
|
97
|
+
},
|
|
98
|
+
`thinking-${i}`
|
|
99
|
+
) : /* @__PURE__ */ jsx(
|
|
100
|
+
ToolCardComponent,
|
|
101
|
+
{
|
|
102
|
+
callId: item.segment.callId,
|
|
103
|
+
segment: item.segment,
|
|
104
|
+
conversationId
|
|
105
|
+
},
|
|
106
|
+
`tool-${item.segment.callId}`
|
|
107
|
+
)
|
|
108
|
+
),
|
|
109
|
+
failed && /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: "Sub-agent steps unavailable" }),
|
|
110
|
+
showDoor && /* @__PURE__ */ jsx(
|
|
111
|
+
EntityRef,
|
|
112
|
+
{
|
|
113
|
+
token: "conversation",
|
|
114
|
+
id: childId,
|
|
115
|
+
name: title ?? "Sub-agent conversation",
|
|
116
|
+
openInNewTab: true,
|
|
117
|
+
showIcon: false,
|
|
118
|
+
labelClassName: "text-xs",
|
|
119
|
+
className: "self-start"
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
export {
|
|
127
|
+
AgentCallChildTrace
|
|
128
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useAppSelector } from "../../../store/hooks.js";
|
|
4
|
+
import { selectRequestError } from "../../../agents/redux/execution-system/active-requests/active-requests.selectors.js";
|
|
5
|
+
import { AssistantError } from "../../../agents/components/run/AssistantError.js";
|
|
6
|
+
function InlineAssistantError({ requestId }) {
|
|
7
|
+
const streamError = useAppSelector(selectRequestError(requestId));
|
|
8
|
+
if (!streamError) return null;
|
|
9
|
+
const friendly = streamError.user_message ?? streamError.message ?? "The response failed.";
|
|
10
|
+
const technical = streamError.message;
|
|
11
|
+
const detail = technical && technical !== friendly ? technical : void 0;
|
|
12
|
+
const code = streamError.code ?? (streamError.details && typeof streamError.details === "object" && "status_code" in streamError.details ? streamError.details.status_code : void 0);
|
|
13
|
+
return /* @__PURE__ */ jsx(
|
|
14
|
+
AssistantError,
|
|
15
|
+
{
|
|
16
|
+
message: friendly,
|
|
17
|
+
detail,
|
|
18
|
+
errorType: streamError.error_type,
|
|
19
|
+
code,
|
|
20
|
+
details: streamError.details
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
InlineAssistantError
|
|
26
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface InlineThinkingSlotProps {
|
|
3
|
+
requestId: string;
|
|
4
|
+
chunkStartIndex: number;
|
|
5
|
+
/** Absent while the run is still open (tokens may still arrive). */
|
|
6
|
+
chunkEndIndex?: number;
|
|
7
|
+
/**
|
|
8
|
+
* Renders the reasoning text through the caller's block pipeline
|
|
9
|
+
* (EnhancedChatMarkdown's `renderBlock`) so live and persisted thinking
|
|
10
|
+
* share one renderer. `isStreaming` is true while the run is open.
|
|
11
|
+
*/
|
|
12
|
+
renderReasoning: (content: string, isStreaming: boolean) => React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
export declare const InlineThinkingSlot: React.FC<InlineThinkingSlotProps>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useAppSelector } from "../../../store/hooks.js";
|
|
4
|
+
import { selectReasoningRunText } from "../../../agents/redux/execution-system/active-requests/active-requests.selectors.js";
|
|
5
|
+
import { InlineStatusIndicator } from "@ai-matrx/rich-content/display/chat-markdown/internal-handlers/InlineStatusIndicator";
|
|
6
|
+
const InlineThinkingSlot = ({
|
|
7
|
+
requestId,
|
|
8
|
+
chunkStartIndex,
|
|
9
|
+
chunkEndIndex,
|
|
10
|
+
renderReasoning
|
|
11
|
+
}) => {
|
|
12
|
+
const text = useAppSelector(
|
|
13
|
+
selectReasoningRunText(requestId, chunkStartIndex, chunkEndIndex)
|
|
14
|
+
);
|
|
15
|
+
const isOpen = chunkEndIndex === void 0;
|
|
16
|
+
if (!text.trim()) {
|
|
17
|
+
return isOpen ? /* @__PURE__ */ jsx(InlineStatusIndicator, { label: "Reasoning\u2026" }) : null;
|
|
18
|
+
}
|
|
19
|
+
return /* @__PURE__ */ jsx(Fragment, { children: renderReasoning(text, isOpen) });
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
InlineThinkingSlot
|
|
23
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ToolHandlers — inline tool-call cards for the markdown stream.
|
|
3
|
+
*
|
|
4
|
+
* ONE card component (`ToolCard`) and ONE batch component (`ToolBatch`) for
|
|
5
|
+
* both sources: the live stream (`requestId` → `ToolLifecycleEntry` from
|
|
6
|
+
* Redux) and a committed/reloaded turn (a persisted content segment →
|
|
7
|
+
* `persistedToolEntry`). One element type under one key is what keeps a card
|
|
8
|
+
* the same instance when a turn swaps from stream to record.
|
|
9
|
+
*
|
|
10
|
+
* Both route through the canonical shell at
|
|
11
|
+
* `@/features/tool-call-visualization`.
|
|
12
|
+
*/
|
|
13
|
+
import React from "react";
|
|
14
|
+
import { type ContentSegmentDbTool } from "../../../agents/redux/execution-system/active-requests/active-requests.selectors.js";
|
|
15
|
+
export interface ToolCardProps {
|
|
16
|
+
callId: string;
|
|
17
|
+
/**
|
|
18
|
+
* Owning conversation id. Required so this card can self-gate on the
|
|
19
|
+
* instance-level `hideToolResults` flag — when true, this component
|
|
20
|
+
* renders nothing. Centralizing the show/hide check here means a single
|
|
21
|
+
* setting silences every tool call on the surface with no scattered
|
|
22
|
+
* conditionals.
|
|
23
|
+
*/
|
|
24
|
+
conversationId: string;
|
|
25
|
+
/** Live source: the request whose lifecycle carries this call. */
|
|
26
|
+
requestId?: string;
|
|
27
|
+
/** Persisted source: the committed tool_call part joined to its row. */
|
|
28
|
+
segment?: ContentSegmentDbTool;
|
|
29
|
+
}
|
|
30
|
+
export declare const ToolCard: React.FC<ToolCardProps>;
|
|
31
|
+
export interface ToolBatchProps {
|
|
32
|
+
conversationId: string;
|
|
33
|
+
/** Live source. */
|
|
34
|
+
requestId?: string;
|
|
35
|
+
callIds?: string[];
|
|
36
|
+
/** Persisted source. */
|
|
37
|
+
segments?: ContentSegmentDbTool[];
|
|
38
|
+
browserRunOrder?: number;
|
|
39
|
+
browserBreakBefore?: boolean;
|
|
40
|
+
browserBreakAfter?: boolean;
|
|
41
|
+
}
|
|
42
|
+
export declare const ToolBatch: React.FC<ToolBatchProps>;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useAppSelector } from "../../../store/hooks.js";
|
|
4
|
+
import { selectHideToolResults } from "../../../agents/redux/execution-system/instance-ui-state/instance-ui-state.selectors.js";
|
|
5
|
+
import {
|
|
6
|
+
selectToolLifecycle,
|
|
7
|
+
selectToolLifecycleMap
|
|
8
|
+
} from "../../../agents/redux/execution-system/active-requests/active-requests.selectors.js";
|
|
9
|
+
import { ToolCallVisualization } from "../../../tool-call-visualization/components/ToolCallVisualization.js";
|
|
10
|
+
import { ToolCallBatch } from "../../../tool-call-visualization/components/ToolCallBatch.js";
|
|
11
|
+
import { persistedToolEntry } from "../../../tool-call-visualization/utils/cxToolCallToLifecycleEntry.js";
|
|
12
|
+
import { AgentCallChildTrace } from "./AgentCallChildTrace.js";
|
|
13
|
+
const _selectNoLifecycle = () => void 0;
|
|
14
|
+
const ToolCard = ({
|
|
15
|
+
callId,
|
|
16
|
+
conversationId,
|
|
17
|
+
requestId,
|
|
18
|
+
segment
|
|
19
|
+
}) => {
|
|
20
|
+
const hidden = useAppSelector(selectHideToolResults(conversationId));
|
|
21
|
+
const lifecycle = useAppSelector(
|
|
22
|
+
!segment && requestId ? selectToolLifecycle(requestId, callId) : _selectNoLifecycle
|
|
23
|
+
);
|
|
24
|
+
const entry = segment ? persistedToolEntry(segment) : lifecycle;
|
|
25
|
+
if (hidden) return null;
|
|
26
|
+
if (!entry) return null;
|
|
27
|
+
const card = /* @__PURE__ */ jsx(
|
|
28
|
+
ToolCallVisualization,
|
|
29
|
+
{
|
|
30
|
+
entries: [entry],
|
|
31
|
+
requestId: segment ? void 0 : requestId,
|
|
32
|
+
conversationId,
|
|
33
|
+
hasContent: true,
|
|
34
|
+
isPersisted: !!segment
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
if (entry.toolName !== "agent_call") return card;
|
|
38
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
39
|
+
card,
|
|
40
|
+
/* @__PURE__ */ jsx(
|
|
41
|
+
AgentCallChildTrace,
|
|
42
|
+
{
|
|
43
|
+
entry,
|
|
44
|
+
conversationId,
|
|
45
|
+
requestId: segment ? void 0 : requestId,
|
|
46
|
+
ToolCardComponent: ToolCard
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
] });
|
|
50
|
+
};
|
|
51
|
+
const _selectNoLifecycleMap = () => void 0;
|
|
52
|
+
const ToolBatch = ({
|
|
53
|
+
conversationId,
|
|
54
|
+
requestId,
|
|
55
|
+
callIds,
|
|
56
|
+
segments,
|
|
57
|
+
browserRunOrder,
|
|
58
|
+
browserBreakBefore,
|
|
59
|
+
browserBreakAfter
|
|
60
|
+
}) => {
|
|
61
|
+
const hidden = useAppSelector(selectHideToolResults(conversationId));
|
|
62
|
+
const lifecycleMap = useAppSelector(
|
|
63
|
+
!segments && requestId ? selectToolLifecycleMap(requestId) : _selectNoLifecycleMap
|
|
64
|
+
);
|
|
65
|
+
const ids = segments ? segments.map((s) => s.callId) : callIds ?? [];
|
|
66
|
+
const entries = [];
|
|
67
|
+
if (segments) {
|
|
68
|
+
for (const s of segments) entries.push(persistedToolEntry(s));
|
|
69
|
+
} else if (lifecycleMap) {
|
|
70
|
+
for (const id of ids) {
|
|
71
|
+
const e = lifecycleMap[id];
|
|
72
|
+
if (e) entries.push(e);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (hidden) return null;
|
|
76
|
+
if (entries.length === 0) return null;
|
|
77
|
+
return /* @__PURE__ */ jsx(
|
|
78
|
+
ToolCallBatch,
|
|
79
|
+
{
|
|
80
|
+
entries,
|
|
81
|
+
conversationId,
|
|
82
|
+
isPersisted: !!segments,
|
|
83
|
+
browserRunOrder,
|
|
84
|
+
browserBreakBefore,
|
|
85
|
+
browserBreakAfter,
|
|
86
|
+
children: segments ? segments.map((segment) => /* @__PURE__ */ jsx(
|
|
87
|
+
ToolCard,
|
|
88
|
+
{
|
|
89
|
+
callId: segment.callId,
|
|
90
|
+
segment,
|
|
91
|
+
conversationId
|
|
92
|
+
},
|
|
93
|
+
segment.callId
|
|
94
|
+
)) : ids.map((callId) => /* @__PURE__ */ jsx(
|
|
95
|
+
ToolCard,
|
|
96
|
+
{
|
|
97
|
+
callId,
|
|
98
|
+
requestId,
|
|
99
|
+
conversationId
|
|
100
|
+
},
|
|
101
|
+
callId
|
|
102
|
+
))
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
export {
|
|
107
|
+
ToolBatch,
|
|
108
|
+
ToolCard
|
|
109
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { useAppSelector } from "../../store/hooks.js";
|
|
4
|
+
import { selectAgentById } from "../../agents/redux/agent-definition/selectors.js";
|
|
5
|
+
import { hasField } from "@ai-matrx/agents/field-flags";
|
|
6
|
+
import { selectAgentIdFromInstance } from "../../agents/redux/execution-system/conversations/conversations.selectors.js";
|
|
7
|
+
import { fetchAgentOutputSchemas } from "../../mandates/output-contract.js";
|
|
8
|
+
function useBoundAgentOutputSchema(conversationId) {
|
|
9
|
+
const agentId = useAppSelector(
|
|
10
|
+
conversationId ? selectAgentIdFromInstance(conversationId) : () => void 0
|
|
11
|
+
);
|
|
12
|
+
const agent = useAppSelector(
|
|
13
|
+
agentId ? (state) => selectAgentById(state, agentId) : () => void 0
|
|
14
|
+
);
|
|
15
|
+
const loadedSchema = agent && hasField(agent._loadedFields, "outputSchema") ? agent.outputSchema : void 0;
|
|
16
|
+
const [fetched, setFetched] = useState(null);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (!agentId || loadedSchema !== void 0) return;
|
|
19
|
+
let active = true;
|
|
20
|
+
void fetchAgentOutputSchemas([agentId]).then((schemas) => {
|
|
21
|
+
if (active) setFetched({ agentId, schema: schemas[agentId] ?? null });
|
|
22
|
+
});
|
|
23
|
+
return () => {
|
|
24
|
+
active = false;
|
|
25
|
+
};
|
|
26
|
+
}, [agentId, loadedSchema]);
|
|
27
|
+
if (loadedSchema !== void 0) return loadedSchema;
|
|
28
|
+
if (fetched && fetched.agentId === agentId) return fetched.schema;
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
useBoundAgentOutputSchema
|
|
33
|
+
};
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo, useState, useEffect } from "react";
|
|
4
4
|
import { WindowPanel } from "../../../host/ui-slots.js";
|
|
5
|
-
import { RichContent } from "../../../host/ui-slots.js";
|
|
6
5
|
import { Button } from "@ai-matrx/design-system/controls";
|
|
7
6
|
import {
|
|
8
7
|
Select,
|
|
@@ -18,6 +17,7 @@ import {
|
|
|
18
17
|
} from "../../../agents/redux/agent-assistant-markdown-draft.slice.js";
|
|
19
18
|
import { NonEditableContextMenu } from "../../../host/ui-slots.js";
|
|
20
19
|
import { CHAT_WINDOWS } from "../../../host/windows.js";
|
|
20
|
+
import { RichContent } from "@ai-matrx/rich-content/levels/RichContent";
|
|
21
21
|
function AgentAssistantMarkdownDebugWindow({
|
|
22
22
|
isOpen,
|
|
23
23
|
onClose
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-matrx/chat",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7",
|
|
4
4
|
"description": "THE one AI Matrx person-to-agent chat system: the full chat (running agents, conversations, tool calls, streaming, context, surfaces, voice) as per-module subpaths @ai-matrx/chat/<domain>/<module> over a host contract (/host, /host/react) whose only required value is a db; plus the kernel compatibility entries (., /external-store, /matrx, /react, /tools, styles.css, tokens.css) until P28.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -226,14 +226,14 @@
|
|
|
226
226
|
"server-only": "^0.0.1",
|
|
227
227
|
"uuid": "^14.0.2",
|
|
228
228
|
"zod": "^4.6.5",
|
|
229
|
-
"@ai-matrx/agents": "latest",
|
|
230
229
|
"@ai-matrx/alchemy": "latest",
|
|
231
230
|
"@ai-matrx/associations": "latest",
|
|
232
231
|
"@ai-matrx/browser-audio": "latest",
|
|
233
232
|
"@ai-matrx/canvas": "latest",
|
|
233
|
+
"@ai-matrx/agents": "latest",
|
|
234
234
|
"@ai-matrx/content-ir": "latest",
|
|
235
|
-
"@ai-matrx/data": "latest",
|
|
236
235
|
"@ai-matrx/content-ir-react": "latest",
|
|
236
|
+
"@ai-matrx/data": "latest",
|
|
237
237
|
"@ai-matrx/design-system": "latest",
|
|
238
238
|
"@ai-matrx/diff": "latest",
|
|
239
239
|
"@ai-matrx/icons": "latest",
|
|
@@ -244,6 +244,7 @@
|
|
|
244
244
|
"@ai-matrx/records": "latest",
|
|
245
245
|
"@ai-matrx/records-ui": "latest",
|
|
246
246
|
"@ai-matrx/rich-content": "latest",
|
|
247
|
+
"@ai-matrx/rich-editor": "latest",
|
|
247
248
|
"@ai-matrx/tap-target": "latest"
|
|
248
249
|
},
|
|
249
250
|
"devDependencies": {
|
|
@@ -303,11 +304,12 @@
|
|
|
303
304
|
}
|
|
304
305
|
},
|
|
305
306
|
"scripts": {
|
|
306
|
-
"build": "pnpm clean && tsup && node ./scripts/copy-css.mjs && node ./scripts/tsc-own.mjs -p tsconfig.build.json && node ./scripts/finish-build.mjs",
|
|
307
|
+
"build": "pnpm --filter @ai-matrx/rich-editor build && pnpm clean && tsup && node ./scripts/copy-css.mjs && node ./scripts/tsc-own.mjs -p tsconfig.build.json && node ./scripts/finish-build.mjs",
|
|
307
308
|
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
308
|
-
"check:package": "pnpm build && node ../scripts/check-exports-agreement.mjs && pnpm check:canonical-pickers && publint && pnpm verify:tarball && pnpm verify:modules-tarball && pnpm check:front-door:self-test && pnpm check:front-door:canary && pnpm check:host-boundary && pnpm check:no-builder-tier && pnpm check:one-holder && pnpm check:host-doors",
|
|
309
|
+
"check:package": "pnpm build && node ../scripts/check-exports-agreement.mjs && pnpm check:canonical-pickers && publint && pnpm verify:tarball && pnpm verify:modules-tarball && pnpm check:front-door:self-test && pnpm check:front-door:canary && pnpm check:host-boundary && pnpm check:no-builder-tier && pnpm check:one-holder && pnpm check:host-doors && pnpm check:no-package-slots",
|
|
309
310
|
"check:host-boundary": "node ./scripts/check-host-boundary.mjs && node ./scripts/check-host-boundary.mjs --self-test",
|
|
310
311
|
"check:host-doors": "node ./scripts/check-host-source-doors.mjs && node ./scripts/check-host-source-doors.mjs --self-test",
|
|
312
|
+
"check:no-package-slots": "node ./scripts/check-no-package-slots.mjs && node ./scripts/check-no-package-slots.mjs --self-test",
|
|
311
313
|
"check:one-holder": "node ./scripts/check-chat-one-holder.mjs && node ./scripts/check-chat-one-holder.mjs --self-test",
|
|
312
314
|
"check:no-builder-tier": "node ./scripts/check-chat-has-no-builder-tier.mjs && node ./scripts/check-chat-has-no-builder-tier.mjs --self-test",
|
|
313
315
|
"typecheck": "node ./node_modules/typescript/bin/tsc -p tsconfig.json --noEmit && node ./scripts/tsc-own.mjs -p tsconfig.modules.json",
|