@ai-matrx/chat 0.4.0 → 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 +80 -0
- package/dist/agent-copy/RichCopySplit.d.ts +17 -0
- package/dist/agent-copy/RichCopySplit.js +34 -0
- package/dist/agents/addressing/useAgentHref.js +4 -1
- package/dist/agents/api/submit-tool-results.js +11 -1
- 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/chat/useCanvasScopedToConversation.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/AgentConversationDisplay.js +4 -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/run-controls/panels/shared.d.ts +1 -0
- package/dist/agents/components/shared/AgentConversationColumn.js +3 -2
- package/dist/agents/components/working-document/WorkingDocumentEditor.d.ts +1 -1
- package/dist/agents/components/working-document/WorkingDocumentPanel.js +2 -1
- package/dist/agents/components/working-document/workingDocumentSurface.d.ts +1 -1
- package/dist/agents/identity/model-catalog.js +5 -3
- 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-definition/selectors.d.ts +237 -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/agent-settings/selectors.d.ts +12 -0
- package/dist/agents/redux/agent-shortcut-categories/selectors.d.ts +50 -0
- package/dist/agents/redux/agent-shortcuts/selectors.d.ts +147 -0
- package/dist/agents/redux/conversation-history/selectors.d.ts +16 -0
- package/dist/agents/redux/conversation-list/conversation-list.selectors.d.ts +2 -0
- package/dist/agents/redux/execution-system/active-requests/active-requests.selectors.d.ts +54 -0
- package/dist/agents/redux/execution-system/context-state/context-state.selectors.d.ts +14 -0
- package/dist/agents/redux/execution-system/conversations/conversations.selectors.d.ts +5 -0
- package/dist/agents/redux/execution-system/host-conversations/conversation-abilities.d.ts +12 -0
- package/dist/agents/redux/execution-system/host-conversations/conversation-abilities.js +25 -0
- package/dist/agents/redux/execution-system/host-conversations/host-conversation.thunks.d.ts +53 -0
- package/dist/agents/redux/execution-system/host-conversations/host-conversation.thunks.js +412 -0
- package/dist/agents/redux/execution-system/host-conversations/host-conversations.selectors.d.ts +28 -0
- package/dist/agents/redux/execution-system/host-conversations/host-conversations.selectors.js +41 -0
- package/dist/agents/redux/execution-system/host-conversations/host-conversations.slice.d.ts +43 -0
- package/dist/agents/redux/execution-system/host-conversations/host-conversations.slice.js +38 -0
- package/dist/agents/redux/execution-system/host-conversations/source-registry.d.ts +9 -0
- package/dist/agents/redux/execution-system/host-conversations/source-registry.js +15 -0
- package/dist/agents/redux/execution-system/host-conversations/useHostConversation.d.ts +4 -0
- package/dist/agents/redux/execution-system/host-conversations/useHostConversation.js +24 -0
- package/dist/agents/redux/execution-system/inbox/inbox-turn-end.middleware.js +2 -1
- package/dist/agents/redux/execution-system/instance-context/instance-context.selectors.d.ts +3 -0
- package/dist/agents/redux/execution-system/instance-resources/default-remark-durability.d.ts +22 -0
- package/dist/agents/redux/execution-system/instance-resources/default-remark-durability.js +164 -0
- package/dist/agents/redux/execution-system/instance-resources/instance-resources.selectors.d.ts +8 -0
- package/dist/agents/redux/execution-system/instance-ui-state/instance-ui-state.selectors.d.ts +5 -0
- package/dist/agents/redux/execution-system/instance-ui-state/run-configuration-persist.js +2 -0
- package/dist/agents/redux/execution-system/instance-user-input/composer-draft-store.js +20 -0
- package/dist/agents/redux/execution-system/instance-user-input/useComposerDraftRestore.js +2 -1
- package/dist/agents/redux/execution-system/instance-variable-values/instance-variable-values.selectors.d.ts +7 -0
- package/dist/agents/redux/execution-system/messages/messages.selectors.d.ts +1 -0
- package/dist/agents/redux/execution-system/messages/messages.selectors.js +1 -1
- package/dist/agents/redux/execution-system/observability/observability.selectors.d.ts +7 -0
- package/dist/agents/redux/execution-system/observational-memory/observational-memory.selectors.d.ts +1 -0
- package/dist/agents/redux/execution-system/selectors/aggregate.selectors.d.ts +14 -0
- package/dist/agents/redux/execution-system/thunks/execute-instance.thunk.js +8 -1
- package/dist/agents/redux/execution-system/thunks/execute-manual-instance.thunk.js +2 -1
- package/dist/agents/redux/execution-system/thunks/load-conversation.thunk.js +6 -0
- package/dist/agents/redux/execution-system/thunks/load-older-messages.thunk.js +12 -0
- package/dist/agents/redux/execution-system/thunks/process-stream.js +6 -4
- package/dist/agents/redux/execution-system/thunks/resolve-base-url.js +1 -1
- package/dist/agents/redux/execution-system/thunks/smart-execute.thunk.js +43 -0
- package/dist/agents/redux/execution-system/utils/assemble-cx-content-blocks.js +2 -1
- package/dist/agents/redux/execution-system/utils/continuation-body.d.ts +1 -0
- package/dist/agents/redux/execution-system/utils/continuation-body.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/proposed-directives/proposedDirectivesSlice.d.ts +1 -0
- package/dist/agents/redux/tools/tools.selectors.d.ts +1 -0
- package/dist/agents/redux/tools/tools.thunks.js +3 -0
- package/dist/agents/resources/default-picker-items.d.ts +17 -0
- package/dist/agents/resources/default-picker-items.js +48 -0
- package/dist/agents/runtime-reconnect/ServerOperationBanner.d.ts +6 -1
- package/dist/agents/runtime-reconnect/ServerOperationBanner.js +6 -1
- package/dist/agents/types/instance.types.d.ts +2 -1
- package/dist/agents/ui-first-tools/redux/agent-lists.selectors.d.ts +2 -0
- 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/SsrSidebarChats.js +1 -1
- package/dist/cx-chat/components/messages/AssistantMessage.js +3 -5
- package/dist/cx-chat/components/sidebar/SidebarUserFooter.js +1 -1
- 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/app-identity.d.ts +20 -0
- package/dist/host/app-identity.js +21 -0
- package/dist/host/bare-host-chrome.d.ts +14 -0
- package/dist/host/bare-host-chrome.js +45 -0
- package/dist/host/configure.d.ts +9 -1
- package/dist/host/configure.js +44 -8
- package/dist/host/contract.d.ts +39 -2
- package/dist/host/db-types.d.ts +99 -1
- package/dist/host/defaults/navigation-hooks.d.ts +2 -0
- package/dist/host/defaults/navigation-hooks.js +7 -1
- package/dist/host/defaults/navigation.d.ts +4 -3
- package/dist/host/defaults/navigation.js +38 -7
- package/dist/host/defaults/org.d.ts +12 -4
- package/dist/host/defaults/org.js +39 -1
- package/dist/host/defaults/prefs.d.ts +11 -0
- package/dist/host/defaults/prefs.js +43 -0
- package/dist/host/defaults/workspace-gate.d.ts +16 -0
- package/dist/host/defaults/workspace-gate.js +89 -0
- package/dist/host/diagnostics.d.ts +7 -2
- package/dist/host/diagnostics.js +6 -0
- package/dist/host/identity.js +2 -1
- package/dist/host/index.d.ts +6 -3
- package/dist/host/index.js +23 -2
- package/dist/host/no-database.d.ts +38 -0
- package/dist/host/no-database.js +107 -0
- package/dist/host/react.d.ts +1 -0
- package/dist/host/react.js +40 -2
- package/dist/host/registered-source.js +2 -2
- package/dist/host/source.d.ts +130 -0
- package/dist/host/source.js +86 -0
- package/dist/host/ui-slots.d.ts +9 -31
- package/dist/host/ui-slots.js +5 -37
- package/dist/mandates/useMandate.js +13 -0
- package/dist/public-chat/components/PublicMessageOptionsMenu.js +3 -2
- package/dist/store/create-chat-store.d.ts +4 -2
- package/dist/store/middlewares.d.ts +5 -0
- package/dist/store/slices.d.ts +1 -0
- package/dist/store/slices.js +4 -1
- package/dist/surfaces/redux/selectors.d.ts +2 -0
- 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/testing/turn-harness.d.ts +35 -0
- package/dist/testing/turn-harness.js +85 -0
- package/dist/tool-call-visualization/db-renderer/fetchToolRendererRow.js +2 -0
- package/dist/tool-call-visualization/redux/selectors.d.ts +1 -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 +10 -5
- package/dist/host/content-ir-slots.d.ts +0 -231
- package/dist/host/content-ir-slots.js +0 -131
- 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
|
@@ -54,14 +54,13 @@ import {
|
|
|
54
54
|
isUnclosedGenericXmlOpening,
|
|
55
55
|
startUnrecognizedXmlContainer,
|
|
56
56
|
normalizeCodeLanguage,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
} from "../../../../host/content-ir-slots.js";
|
|
57
|
+
SPECIAL_CODE_LANGUAGES
|
|
58
|
+
} from "@ai-matrx/rich-content/display/markdown-classification/processors/utils/content-splitter-v2";
|
|
59
|
+
import { kindRegistry } from "@ai-matrx/rich-content/host/kind-registry";
|
|
60
|
+
import { componentRegistry } from "@ai-matrx/rich-content/host/component-registry";
|
|
61
|
+
import { hostSplitterEnvelopes } from "@ai-matrx/rich-content/host/splitter-envelopes";
|
|
62
|
+
import { withIrEnvelope } from "@ai-matrx/rich-content/kinds/registry/region-envelope-memo";
|
|
63
|
+
import { sessionEnvelope } from "@ai-matrx/rich-content/kinds/registry/kind-correctors";
|
|
65
64
|
import { disposeParseSession, openParseSession } from "@ai-matrx/content-ir";
|
|
66
65
|
import {
|
|
67
66
|
IR_ENVELOPE_KEY
|
|
@@ -71,6 +70,9 @@ import {
|
|
|
71
70
|
splitAroundEmbeddedKindJson
|
|
72
71
|
} from "../../../../utils/content-ir/surfaces/embedded-kind-json.js";
|
|
73
72
|
import { captureError } from "../../../../host/diagnostics.js";
|
|
73
|
+
const isSpecialCodeLanguage = (language) => SPECIAL_CODE_LANGUAGES.includes(language);
|
|
74
|
+
const envelopeForCompletedXmlRegion = (tag, regionText) => hostSplitterEnvelopes()?.xmlRegion(tag, regionText) ?? null;
|
|
75
|
+
const envelopeForCompletedFenceRegion = (language, regionText) => hostSplitterEnvelopes()?.fenceRegion(language, regionText) ?? null;
|
|
74
76
|
function countStructuralObjectBraces(source) {
|
|
75
77
|
let opens = 0;
|
|
76
78
|
let closes = 0;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createSlice, createAsyncThunk } from "@reduxjs/toolkit";
|
|
2
|
+
import { chatHostHasDatabase } from "../../../host/configure.js";
|
|
2
3
|
import {
|
|
3
4
|
fetchMcpCatalog,
|
|
4
5
|
connectMcpServer as connectMcpServerService
|
|
@@ -22,12 +23,14 @@ const initialState = {
|
|
|
22
23
|
availabilityError: null
|
|
23
24
|
};
|
|
24
25
|
const EMPTY_MCP_AVAILABILITY = {};
|
|
26
|
+
const NEEDS_DATABASE = { condition: () => chatHostHasDatabase() };
|
|
25
27
|
const fetchCatalog = createAsyncThunk("mcp/fetchCatalog", async () => {
|
|
26
28
|
return fetchMcpCatalog();
|
|
27
|
-
});
|
|
29
|
+
}, NEEDS_DATABASE);
|
|
28
30
|
const fetchAvailability = createAsyncThunk(
|
|
29
31
|
"mcp/fetchAvailability",
|
|
30
|
-
async ({ organizationId, slugs }) => fetchMcpAvailability(organizationId, slugs)
|
|
32
|
+
async ({ organizationId, slugs }) => fetchMcpAvailability(organizationId, slugs),
|
|
33
|
+
NEEDS_DATABASE
|
|
31
34
|
);
|
|
32
35
|
const connectServer = createAsyncThunk(
|
|
33
36
|
"mcp/connectServer",
|
|
@@ -35,7 +38,8 @@ const connectServer = createAsyncThunk(
|
|
|
35
38
|
const connectionId = await connectMcpServerService(params);
|
|
36
39
|
dispatch(fetchCatalog());
|
|
37
40
|
return { serverId: params.serverId, connectionId };
|
|
38
|
-
}
|
|
41
|
+
},
|
|
42
|
+
NEEDS_DATABASE
|
|
39
43
|
);
|
|
40
44
|
const connectServerWithCredentials = createAsyncThunk(
|
|
41
45
|
"mcp/connectServerWithCredentials",
|
|
@@ -49,7 +53,8 @@ const connectServerWithCredentials = createAsyncThunk(
|
|
|
49
53
|
});
|
|
50
54
|
dispatch(fetchCatalog());
|
|
51
55
|
return { serverId: params.serverId, connectionId: summary.connection_id };
|
|
52
|
-
}
|
|
56
|
+
},
|
|
57
|
+
NEEDS_DATABASE
|
|
53
58
|
);
|
|
54
59
|
const disconnectServer = createAsyncThunk(
|
|
55
60
|
"mcp/disconnectServer",
|
|
@@ -57,7 +62,8 @@ const disconnectServer = createAsyncThunk(
|
|
|
57
62
|
await disconnectMcpConnection(serverId);
|
|
58
63
|
dispatch(fetchCatalog());
|
|
59
64
|
return serverId;
|
|
60
|
-
}
|
|
65
|
+
},
|
|
66
|
+
NEEDS_DATABASE
|
|
61
67
|
);
|
|
62
68
|
const discoverServerTools = createAsyncThunk(
|
|
63
69
|
"mcp/discoverServerTools",
|
|
@@ -70,14 +76,16 @@ const discoverServerTools = createAsyncThunk(
|
|
|
70
76
|
resources: [],
|
|
71
77
|
prompts: []
|
|
72
78
|
};
|
|
73
|
-
}
|
|
79
|
+
},
|
|
80
|
+
NEEDS_DATABASE
|
|
74
81
|
);
|
|
75
82
|
const refreshServerToken = createAsyncThunk(
|
|
76
83
|
"mcp/refreshServerToken",
|
|
77
84
|
async (serverId) => {
|
|
78
85
|
await refreshMcpConnection(serverId);
|
|
79
86
|
return serverId;
|
|
80
|
-
}
|
|
87
|
+
},
|
|
88
|
+
NEEDS_DATABASE
|
|
81
89
|
);
|
|
82
90
|
const mcpSlice = createSlice({
|
|
83
91
|
name: "mcp",
|
|
@@ -110,6 +110,7 @@ export declare const selectProposedDirectives: (conversationId: string) => ((sta
|
|
|
110
110
|
agentSettings: import("../agent-settings/types.js").AgentSettingsState;
|
|
111
111
|
conversationAttachments: import("../../connectors/attachments.slice.js").AttachmentsSliceState;
|
|
112
112
|
chatHost: import("../../../store/chat-host.slice.js").ChatHostState;
|
|
113
|
+
hostConversations: import("../execution-system/host-conversations/host-conversations.slice.js").HostConversationsState;
|
|
113
114
|
} & import("../../../store/root-state.js").ChatHostReadSlices) => ProposedDirective[]) & {
|
|
114
115
|
clearCache: () => void;
|
|
115
116
|
resultsCount: () => number;
|
|
@@ -124,6 +124,7 @@ export declare const makeSelectToolById: () => ((state: {
|
|
|
124
124
|
agentSettings: import("../agent-settings/types.js").AgentSettingsState;
|
|
125
125
|
conversationAttachments: import("../../connectors/attachments.slice.js").AttachmentsSliceState;
|
|
126
126
|
chatHost: import("../../../store/chat-host.slice.js").ChatHostState;
|
|
127
|
+
hostConversations: import("../execution-system/host-conversations/host-conversations.slice.js").HostConversationsState;
|
|
127
128
|
} & import("../../../store/root-state.js").ChatHostReadSlices, toolId: string) => {
|
|
128
129
|
admin_only: boolean;
|
|
129
130
|
annotations: import("../../../host/db-types.js").Json | null;
|
|
@@ -2,7 +2,9 @@ import { createAsyncThunk } from "@reduxjs/toolkit";
|
|
|
2
2
|
import { supabase } from "../../../host/db.js";
|
|
3
3
|
import { pgErrorToError } from "@ai-matrx/data";
|
|
4
4
|
import { recordUnavailable } from "../../../host/diagnostics.js";
|
|
5
|
+
import { chatHostHasDatabase } from "../../../host/configure.js";
|
|
5
6
|
const fetchAvailableTools = createAsyncThunk("tools/fetchAvailable", async (_, { getState }) => {
|
|
7
|
+
if (!chatHostHasDatabase()) return [];
|
|
6
8
|
if (getState().tools.status === "succeeded") {
|
|
7
9
|
return getState().tools.tools;
|
|
8
10
|
}
|
|
@@ -28,6 +30,7 @@ const fetchToolById = createAsyncThunk(
|
|
|
28
30
|
},
|
|
29
31
|
{
|
|
30
32
|
condition: (toolId, { getState }) => {
|
|
33
|
+
if (!chatHostHasDatabase()) return false;
|
|
31
34
|
const state = getState().tools;
|
|
32
35
|
if (state.tools.some((tool) => tool.id === toolId)) return false;
|
|
33
36
|
if (state.identityById[toolId]) return false;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The resource picker's item list as a bare host sees it: every view id with its label and icon.
|
|
3
|
+
* matrx-frontend registers its own list (brand icons, tints, capability gates) through the
|
|
4
|
+
* `flattenResourcePickerItems` slot; a host that registers none gets these, so the composer's
|
|
5
|
+
* Tools / Connections / Skills doors and the workspace rows have a label instead of throwing.
|
|
6
|
+
*/
|
|
7
|
+
import { type LucideIcon } from "lucide-react";
|
|
8
|
+
import type { ResourcePickerViewId } from "./picker-view-id.js";
|
|
9
|
+
export interface DefaultResourcePickerItem {
|
|
10
|
+
id: Exclude<ResourcePickerViewId, null>;
|
|
11
|
+
label: string;
|
|
12
|
+
icon: LucideIcon;
|
|
13
|
+
iconClassName: string;
|
|
14
|
+
requiresCapability: null | "supportsImageUrls" | "supportsFileUrls" | "supportsYoutubeVideos" | "supportsAudio";
|
|
15
|
+
}
|
|
16
|
+
export declare const DEFAULT_RESOURCE_PICKER_ITEMS: readonly DefaultResourcePickerItem[];
|
|
17
|
+
export declare function defaultResourcePickerItems(): DefaultResourcePickerItem[];
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AppWindow,
|
|
3
|
+
CheckSquare,
|
|
4
|
+
CirclePlay,
|
|
5
|
+
File,
|
|
6
|
+
FileText,
|
|
7
|
+
FolderOpen,
|
|
8
|
+
Globe,
|
|
9
|
+
Image,
|
|
10
|
+
Layers,
|
|
11
|
+
Lightbulb,
|
|
12
|
+
MessagesSquare,
|
|
13
|
+
Mic,
|
|
14
|
+
Notebook,
|
|
15
|
+
Plug,
|
|
16
|
+
Search,
|
|
17
|
+
StickyNote,
|
|
18
|
+
Table2,
|
|
19
|
+
Wrench
|
|
20
|
+
} from "lucide-react";
|
|
21
|
+
const item = (id, label, icon, requiresCapability = null) => ({ id, label, icon, iconClassName: "", requiresCapability });
|
|
22
|
+
const DEFAULT_RESOURCE_PICKER_ITEMS = [
|
|
23
|
+
item("files", "Files", FolderOpen),
|
|
24
|
+
item("audio", "Voice Pad", Mic),
|
|
25
|
+
item("webpage", "Web page", Globe),
|
|
26
|
+
item("google", "Google", Search),
|
|
27
|
+
item("cloud_browser", "Cloud browser", AppWindow),
|
|
28
|
+
item("tools", "Tools", Wrench),
|
|
29
|
+
item("connections", "Connections", Plug),
|
|
30
|
+
item("skills", "Skills", Lightbulb),
|
|
31
|
+
item("conversations", "Chats", MessagesSquare),
|
|
32
|
+
item("tables", "Tables", Table2),
|
|
33
|
+
item("notes", "Notes", StickyNote),
|
|
34
|
+
item("tasks", "Tasks", CheckSquare),
|
|
35
|
+
item("workbooks", "Workbooks", Notebook),
|
|
36
|
+
item("documents", "Documents", FileText),
|
|
37
|
+
item("context_values", "Context values", Layers),
|
|
38
|
+
item("image_url", "Image link", Image, "supportsImageUrls"),
|
|
39
|
+
item("file_url", "File link", File, "supportsFileUrls"),
|
|
40
|
+
item("youtube", "YouTube", CirclePlay, "supportsYoutubeVideos")
|
|
41
|
+
];
|
|
42
|
+
function defaultResourcePickerItems() {
|
|
43
|
+
return [...DEFAULT_RESOURCE_PICKER_ITEMS];
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
DEFAULT_RESOURCE_PICKER_ITEMS,
|
|
47
|
+
defaultResourcePickerItems
|
|
48
|
+
};
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* A run that outlived its stream on the platform server (resume, reconnect, parked on a
|
|
3
|
+
* person). A host-owned conversation has no server operation, so the banner is absent there
|
|
4
|
+
* (G-DOOR gate).
|
|
5
|
+
*/
|
|
6
|
+
export declare function ServerOperationBanner({ conversationId }: {
|
|
2
7
|
conversationId: string;
|
|
3
8
|
}): import("react").JSX.Element | null;
|
|
@@ -13,7 +13,12 @@ import { useAppDispatch, useAppSelector } from "../../store/hooks.js";
|
|
|
13
13
|
import { selectActivePendingAsksForConversation } from "../ui-first-tools/redux/pending-asks.slice.js";
|
|
14
14
|
import { resumeInstance } from "../redux/execution-system/thunks/resume-instance.thunk.js";
|
|
15
15
|
import { reconnectServerOperation } from "./reconnect-server-operation.thunk.js";
|
|
16
|
-
|
|
16
|
+
import { useConversationAbilities } from "../redux/execution-system/host-conversations/conversation-abilities.js";
|
|
17
|
+
function ServerOperationBanner({ conversationId }) {
|
|
18
|
+
const { hosted } = useConversationAbilities();
|
|
19
|
+
return hosted ? null : /* @__PURE__ */ jsx(ServerOperationBannerBody, { conversationId });
|
|
20
|
+
}
|
|
21
|
+
function ServerOperationBannerBody({
|
|
17
22
|
conversationId
|
|
18
23
|
}) {
|
|
19
24
|
const dispatch = useAppDispatch();
|
|
@@ -58,7 +58,8 @@ export type UnregisteredSourceApp = string & {
|
|
|
58
58
|
export type SourceAppValue = SourceApp | UnregisteredSourceApp;
|
|
59
59
|
/** Preserve DB fidelity while preventing new producer call sites from inventing strings. */
|
|
60
60
|
export declare function sourceAppFromStorage(value: string): SourceAppValue;
|
|
61
|
-
|
|
61
|
+
/** "host": a host-owned message source carries the turn (`host/source`), never a server door. */
|
|
62
|
+
export type ApiEndpointMode = "agent" | "manual" | "host";
|
|
62
63
|
/**
|
|
63
64
|
* Client attestation of HOW an AI request was triggered — the only provenance
|
|
64
65
|
* input the client may send. The server DERIVES `origin_class` from witnessed
|
|
@@ -55,6 +55,7 @@ export declare const selectAgentTaskCounts: (conversationId: string) => ((state:
|
|
|
55
55
|
agentSettings: import("../../redux/agent-settings/types.js").AgentSettingsState;
|
|
56
56
|
conversationAttachments: import("../../connectors/attachments.slice.js").AttachmentsSliceState;
|
|
57
57
|
chatHost: import("../../../store/chat-host.slice.js").ChatHostState;
|
|
58
|
+
hostConversations: import("../../redux/execution-system/host-conversations/host-conversations.slice.js").HostConversationsState;
|
|
58
59
|
} & import("../../../store/root-state.js").ChatHostReadSlices) => {
|
|
59
60
|
total: number;
|
|
60
61
|
done: number;
|
|
@@ -139,6 +140,7 @@ export declare const selectUserTodoCounts: (conversationId: string) => ((state:
|
|
|
139
140
|
agentSettings: import("../../redux/agent-settings/types.js").AgentSettingsState;
|
|
140
141
|
conversationAttachments: import("../../connectors/attachments.slice.js").AttachmentsSliceState;
|
|
141
142
|
chatHost: import("../../../store/chat-host.slice.js").ChatHostState;
|
|
143
|
+
hostConversations: import("../../redux/execution-system/host-conversations/host-conversations.slice.js").HostConversationsState;
|
|
142
144
|
} & import("../../../store/root-state.js").ChatHostReadSlices) => {
|
|
143
145
|
total: number;
|
|
144
146
|
done: number;
|
|
@@ -17,7 +17,7 @@ import { Button } from "@ai-matrx/design-system";
|
|
|
17
17
|
import { Checkbox } from "../../../ui/checkbox.js";
|
|
18
18
|
import { Textarea } from "@ai-matrx/design-system";
|
|
19
19
|
import { ChangeDiff } from "../../../host/ui-slots.js";
|
|
20
|
-
import { KindInstanceRender } from "
|
|
20
|
+
import { KindInstanceRender } from "@ai-matrx/rich-content/host/app-bindings";
|
|
21
21
|
import { StructuredValueView } from "../../../host/ui-slots.js";
|
|
22
22
|
import { cn } from "@ai-matrx/design-system";
|
|
23
23
|
import { useAppDispatch } from "../../../store/hooks.js";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useMemo, useState } from "react";
|
|
4
|
-
import { RichContent } from "../../../host/ui-slots.js";
|
|
5
4
|
import {
|
|
6
5
|
Info,
|
|
7
6
|
AlertTriangle,
|
|
@@ -35,6 +34,7 @@ import { getAskDraft, setAskDraft } from "../redux/ask-draft-registry.js";
|
|
|
35
34
|
import { AskCardCountdown } from "./AskCardCountdown.js";
|
|
36
35
|
import { AgentCardShell } from "./AgentCardShell.js";
|
|
37
36
|
import { Button } from "@ai-matrx/design-system/controls";
|
|
37
|
+
import { RichContent } from "@ai-matrx/rich-content/levels/RichContent";
|
|
38
38
|
const SINGLE_LABELS = { send: "Send", skip: "Skip" };
|
|
39
39
|
const OTHER_SENTINEL = "__matrx_other__";
|
|
40
40
|
const LEVEL_ICONS = {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { readOf } from "../../../../host/ui-slots.js";
|
|
4
|
-
import { RichContent } from "../../../../host/ui-slots.js";
|
|
5
4
|
import { UntrustedCount } from "../../../../host/ui-slots.js";
|
|
6
5
|
import { useCallback, useEffect, useState } from "react";
|
|
7
6
|
import {
|
|
@@ -48,6 +47,7 @@ import { confirm as confirmDialog } from "../../../../host/ui-slots.js";
|
|
|
48
47
|
import { selectUserId } from "../../../../host/identity.js";
|
|
49
48
|
import { useChatCanvasTab } from "../../../../host/canvas.js";
|
|
50
49
|
import { CONVERSATION_LISTS_KIND } from "../../../../host/canvas-tabs.js";
|
|
50
|
+
import { RichContent } from "@ai-matrx/rich-content/levels/RichContent";
|
|
51
51
|
function useConversationListsTab(conversationId) {
|
|
52
52
|
const tab = useChatCanvasTab({ kind: CONVERSATION_LISTS_KIND, key: conversationId });
|
|
53
53
|
return {
|
|
@@ -16,7 +16,7 @@ function useDomCapturePrint() {
|
|
|
16
16
|
setError(null);
|
|
17
17
|
let releaseRenderAll = null;
|
|
18
18
|
try {
|
|
19
|
-
const { renderAllDiagrams } = await import("
|
|
19
|
+
const { renderAllDiagrams } = await import("@ai-matrx/rich-content/mermaid/lazy-draw");
|
|
20
20
|
releaseRenderAll = (await renderAllDiagrams()).release;
|
|
21
21
|
const [{ captureDocumentPdf }, { downloadFile }] = await Promise.all([
|
|
22
22
|
import("@ai-matrx/alchemy/operate/capture"),
|
|
@@ -13,7 +13,7 @@ function printMarkdownContent(markdown, title = "AI Response") {
|
|
|
13
13
|
prepare: async () => {
|
|
14
14
|
let drawn;
|
|
15
15
|
try {
|
|
16
|
-
const { drawMermaidForPrint } = await import("
|
|
16
|
+
const { drawMermaidForPrint } = await import("@ai-matrx/rich-content/mermaid/print-render");
|
|
17
17
|
drawn = await drawMermaidForPrint(markdown);
|
|
18
18
|
} catch (error) {
|
|
19
19
|
console.error("[print] diagrams could not be drawn", error);
|
|
@@ -13,10 +13,8 @@ import {
|
|
|
13
13
|
Save
|
|
14
14
|
} from "lucide-react";
|
|
15
15
|
import { Button } from "@ai-matrx/design-system/controls";
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
AudioOutputBlockSkeleton
|
|
19
|
-
} from "../../../host/markdown-slots.js";
|
|
16
|
+
import { MarkdownStream } from "../../../ui/markdown-stream/MarkdownStream.js";
|
|
17
|
+
import AudioOutputBlockSkeleton from "../../../ui/AudioOutputBlockSkeleton.js";
|
|
20
18
|
import { useDomCapturePrint } from "../../../conversation/hooks/useDomCapturePrint.js";
|
|
21
19
|
import { useAppSelector, useAppDispatch } from "../../../store/hooks.js";
|
|
22
20
|
import { selectMessageHasUnsavedChanges } from "../../_legacy-stubs.js";
|
|
@@ -24,7 +22,7 @@ import { editMessage } from "../../_legacy-stubs.js";
|
|
|
24
22
|
import { buildContentBlocksForSave } from "../../utils/buildContentBlocksForSave.js";
|
|
25
23
|
import { useMediaLoadRecovery } from "@ai-matrx/media/core";
|
|
26
24
|
import { chatConversationsActions } from "../../_legacy-stubs.js";
|
|
27
|
-
import { RichDocumentActions } from "
|
|
25
|
+
import { RichDocumentActions } from "@ai-matrx/rich-content/rich-document/RichDocumentActions";
|
|
28
26
|
import { MessageTimestamp } from "../../../agents/components/messages-display/MessageTimestamp.js";
|
|
29
27
|
import { ErrorAlchemyMenu } from "../../../host/ui-slots.js";
|
|
30
28
|
import { downloadFile } from "@ai-matrx/kit/download";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Link } from "../../../host/navigation.js";
|
|
4
|
-
import { useSelector } from "
|
|
4
|
+
import { useAppSelector as useSelector } from "../../../store/hooks.js";
|
|
5
5
|
import {
|
|
6
6
|
selectUserId,
|
|
7
7
|
selectDisplayName,
|
|
@@ -13,10 +13,8 @@ import {
|
|
|
13
13
|
Save
|
|
14
14
|
} from "lucide-react";
|
|
15
15
|
import { Button } from "@ai-matrx/design-system/controls";
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
AudioOutputBlockSkeleton
|
|
19
|
-
} from "../host/markdown-slots.js";
|
|
16
|
+
import { MarkdownStream } from "../ui/markdown-stream/MarkdownStream.js";
|
|
17
|
+
import AudioOutputBlockSkeleton from "../ui/AudioOutputBlockSkeleton.js";
|
|
20
18
|
import { useDomCapturePrint } from "../conversation/hooks/useDomCapturePrint.js";
|
|
21
19
|
import { useAppSelector, useAppDispatch } from "../store/hooks.js";
|
|
22
20
|
import { selectMessageHasUnsavedChanges } from "./_legacy-stubs.js";
|
|
@@ -24,7 +22,7 @@ import { editMessage } from "./_legacy-stubs.js";
|
|
|
24
22
|
import { buildContentBlocksForSave } from "./utils/buildContentBlocksForSave.js";
|
|
25
23
|
import { useMediaLoadRecovery } from "@ai-matrx/media/core";
|
|
26
24
|
import { chatConversationsActions } from "./_legacy-stubs.js";
|
|
27
|
-
import { RichDocumentActions } from "
|
|
25
|
+
import { RichDocumentActions } from "@ai-matrx/rich-content/rich-document/RichDocumentActions";
|
|
28
26
|
import { MessageTimestamp } from "../agents/components/messages-display/MessageTimestamp.js";
|
|
29
27
|
import { ErrorAlchemyMenu } from "../host/ui-slots.js";
|
|
30
28
|
import { downloadFile } from "@ai-matrx/kit/download";
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* host/app-data-slots — the app's DATA and optional enhancements around a rendered message:
|
|
3
|
+
* the records anchored to a chat, the shape (kind) catalog, the live kind validator, the
|
|
4
|
+
* Source Inspector a citation opens and the full-screen editor. None of these is the formatted
|
|
5
|
+
* text engine — chat imports that (`@ai-matrx/rich-content`) directly and renders formatted text
|
|
6
|
+
* on any host (P29a). These are what only the app has; each has an honest stand-in, reported once
|
|
7
|
+
* (Law 4). The app registers them in `providers/chatUiRegistration.ts`.
|
|
8
|
+
*
|
|
9
|
+
* The slot names extend `ChatUiSlots` by augmentation, so `registerChatUi` accepts them.
|
|
10
|
+
*/
|
|
11
|
+
import type { KindValidator } from "@ai-matrx/content-ir/registry";
|
|
12
|
+
import type { EntityListPage, EntityListQuery, EntityListSort } from "@ai-matrx/records/list";
|
|
13
|
+
import type { ComponentType } from "react";
|
|
14
|
+
import type { MessageCitationSource } from "../agents/redux/execution-system/messages/message-citations.js";
|
|
15
|
+
declare module "./ui-slots" {
|
|
16
|
+
interface ChatUiSlots {
|
|
17
|
+
/** The host's kind validator (the live kind catalog's contracts). */
|
|
18
|
+
contentIrKindValidator: () => KindValidator;
|
|
19
|
+
/** The list of records anchored to one thing (the host's `AnchorRecordsList`), same props. */
|
|
20
|
+
AnchorRecordsList: ComponentType<any>;
|
|
21
|
+
/** Reads the records anchored to one thing; `enabled` false reads nothing (zero-prefetch). */
|
|
22
|
+
useAnchorRecords: (anchor: {
|
|
23
|
+
type: string;
|
|
24
|
+
id: string;
|
|
25
|
+
} | null, enabled?: boolean) => AnchorRecordsState;
|
|
26
|
+
/** One page of the host's shape (kind) catalog. */
|
|
27
|
+
fetchShapePage: (query: EntityListQuery, sort: EntityListSort) => Promise<EntityListPage<ShapeBrowseRow>>;
|
|
28
|
+
/** One shape row by kind slug, or null. */
|
|
29
|
+
fetchShapeByKind: (kind: string) => Promise<ShapeBrowseRow | null>;
|
|
30
|
+
/** Opens one numbered message source (the host's Source Inspector): returns `(source) => void`. */
|
|
31
|
+
useOpenCitationSource: () => (source: MessageCitationSource) => void;
|
|
32
|
+
/** The full-screen markdown editor a message's "Edit" opens (the host's `FullScreenMarkdownEditor`), same props. */
|
|
33
|
+
FullScreenMarkdownEditor: ComponentType<any>;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/** What an anchor's record read reports (the host's `AnchorRecordsState`). */
|
|
37
|
+
export interface AnchorRecordsState {
|
|
38
|
+
status: "loading" | "ready" | "error";
|
|
39
|
+
records: readonly unknown[];
|
|
40
|
+
active: readonly unknown[];
|
|
41
|
+
archived: readonly unknown[];
|
|
42
|
+
message: string | null;
|
|
43
|
+
reload: () => void;
|
|
44
|
+
}
|
|
45
|
+
/** The anchor type of a conversation's own records. */
|
|
46
|
+
export declare const CONVERSATION_ANCHOR_TYPE = "conversation";
|
|
47
|
+
/** One row, exactly as the host's shape list returns it. */
|
|
48
|
+
export interface ShapeBrowseRow {
|
|
49
|
+
access_level: string;
|
|
50
|
+
authoring_owner: string;
|
|
51
|
+
created_at: string;
|
|
52
|
+
created_by: string;
|
|
53
|
+
description: string;
|
|
54
|
+
family: string;
|
|
55
|
+
has_component: boolean;
|
|
56
|
+
id: string;
|
|
57
|
+
is_active: boolean;
|
|
58
|
+
is_owner: boolean;
|
|
59
|
+
kind: string;
|
|
60
|
+
label: string;
|
|
61
|
+
organization_id: string;
|
|
62
|
+
organization_name: string;
|
|
63
|
+
origin: string;
|
|
64
|
+
owner_email: string;
|
|
65
|
+
total_count: number;
|
|
66
|
+
updated_at: string;
|
|
67
|
+
version: number;
|
|
68
|
+
visibility: string;
|
|
69
|
+
}
|
|
70
|
+
/** A host with no kind catalog checks nothing and says so: a skip is never a pass. */
|
|
71
|
+
export declare const contentIrKindValidator: () => KindValidator;
|
|
72
|
+
/** A host with no record store shows no records list (reported once). */
|
|
73
|
+
export declare const AnchorRecordsList: ComponentType<any>;
|
|
74
|
+
/** A host with no record store reads no records: the list stays empty. */
|
|
75
|
+
export declare const useAnchorRecords: (anchor: {
|
|
76
|
+
type: string;
|
|
77
|
+
id: string;
|
|
78
|
+
} | null, enabled?: boolean) => AnchorRecordsState;
|
|
79
|
+
/** A host with no shape catalog has no shapes to browse: the read says so, the picker shows it. */
|
|
80
|
+
export declare const fetchShapePage: (query: EntityListQuery, sort: EntityListSort) => Promise<EntityListPage<ShapeBrowseRow>>;
|
|
81
|
+
export declare const fetchShapeByKind: (kind: string) => Promise<ShapeBrowseRow | null>;
|
|
82
|
+
/** A host with no Source Inspector opens a web source in a new tab; a file source has no target here. */
|
|
83
|
+
export declare const useOpenCitationSource: () => (source: MessageCitationSource) => void;
|
|
84
|
+
/** A host with no full-screen editor opens none: the message's text stays as drawn (reported once). */
|
|
85
|
+
export declare const FullScreenMarkdownEditor: ComponentType<any>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { hostFn, hostSlot } from "./ui-slots.js";
|
|
2
|
+
const CONVERSATION_ANCHOR_TYPE = "conversation";
|
|
3
|
+
const contentIrKindValidator = hostFn("contentIrKindValidator", () => ({
|
|
4
|
+
validate: async (_value, kind) => ({
|
|
5
|
+
kind,
|
|
6
|
+
checked: false,
|
|
7
|
+
ok: false,
|
|
8
|
+
errors: ["This host has no kind catalog to check against (registerChatUi contentIrKindValidator)."],
|
|
9
|
+
degradedReason: "catalog_unreachable"
|
|
10
|
+
}),
|
|
11
|
+
cachedSchema: async () => null,
|
|
12
|
+
invalidate: () => void 0
|
|
13
|
+
}));
|
|
14
|
+
const AnchorRecordsList = hostSlot("AnchorRecordsList");
|
|
15
|
+
const useAnchorRecords = hostFn("useAnchorRecords", () => ({
|
|
16
|
+
status: "ready",
|
|
17
|
+
records: [],
|
|
18
|
+
active: [],
|
|
19
|
+
archived: [],
|
|
20
|
+
message: null,
|
|
21
|
+
reload: () => void 0
|
|
22
|
+
}));
|
|
23
|
+
const fetchShapePage = hostFn("fetchShapePage", async () => {
|
|
24
|
+
throw new Error("This host has no shape catalog (registerChatUi fetchShapePage)");
|
|
25
|
+
});
|
|
26
|
+
const fetchShapeByKind = hostFn("fetchShapeByKind", async () => {
|
|
27
|
+
throw new Error("This host has no shape catalog (registerChatUi fetchShapeByKind)");
|
|
28
|
+
});
|
|
29
|
+
const useOpenCitationSource = hostFn("useOpenCitationSource", () => (source) => {
|
|
30
|
+
if (source.url && typeof window !== "undefined") window.open(source.url, "_blank", "noopener,noreferrer");
|
|
31
|
+
});
|
|
32
|
+
const FullScreenMarkdownEditor = hostSlot("FullScreenMarkdownEditor");
|
|
33
|
+
export {
|
|
34
|
+
AnchorRecordsList,
|
|
35
|
+
CONVERSATION_ANCHOR_TYPE,
|
|
36
|
+
FullScreenMarkdownEditor,
|
|
37
|
+
contentIrKindValidator,
|
|
38
|
+
fetchShapeByKind,
|
|
39
|
+
fetchShapePage,
|
|
40
|
+
useAnchorRecords,
|
|
41
|
+
useOpenCitationSource
|
|
42
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* host/app-identity — what the app calls itself on the conversations it starts.
|
|
3
|
+
*
|
|
4
|
+
* Every send stamps `source_app` (and `source_feature`) on the request; the host's `app` option
|
|
5
|
+
* decides them (contract: `ChatHost.app`). A host that named no app is the neutral `chat`
|
|
6
|
+
* producer — said once — never the main frontend's label. Non-React code reads the configured
|
|
7
|
+
* host at call time; with no host configured the instance's own stamp stands.
|
|
8
|
+
*/
|
|
9
|
+
import type { ChatAppIdentity } from "./contract.js";
|
|
10
|
+
export interface WireAttribution {
|
|
11
|
+
sourceApp: string | undefined;
|
|
12
|
+
sourceFeature: string | undefined;
|
|
13
|
+
}
|
|
14
|
+
/** The identity this app stamps (the host's `app`, else the neutral default). */
|
|
15
|
+
export declare function currentChatApp(): ChatAppIdentity | null;
|
|
16
|
+
/** The `source_app` / `source_feature` a send carries: the host's identity over the instance's own. */
|
|
17
|
+
export declare function attributionForSend(instance: {
|
|
18
|
+
sourceApp?: string | undefined;
|
|
19
|
+
sourceFeature?: string | undefined;
|
|
20
|
+
}): WireAttribution;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DEFAULT_CHAT_APP, getChatHost, isChatHostConfigured } from "./configure.js";
|
|
2
|
+
import { announceOnce } from "./errors.js";
|
|
3
|
+
function currentChatApp() {
|
|
4
|
+
return isChatHostConfigured() ? getChatHost().app : null;
|
|
5
|
+
}
|
|
6
|
+
function attributionForSend(instance) {
|
|
7
|
+
const app = currentChatApp();
|
|
8
|
+
if (!app) return { sourceApp: instance.sourceApp, sourceFeature: instance.sourceFeature };
|
|
9
|
+
if (app === DEFAULT_CHAT_APP) {
|
|
10
|
+
announceOnce(
|
|
11
|
+
"chat-host-app-unnamed",
|
|
12
|
+
`The host named no \`app\`, so its conversations are labelled "${app.sourceApp}". Pass app: { sourceApp, sourceFeature? } to ChatProvider's host to name it.`,
|
|
13
|
+
"info"
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
return { sourceApp: app.sourceApp, sourceFeature: app.sourceFeature ?? instance.sourceFeature };
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
attributionForSend,
|
|
20
|
+
currentChatApp
|
|
21
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a bare host (a private chat store: extension, desktop, a fresh Vite app) gets mounted
|
|
3
|
+
* for it, because the chat UI cannot render without them and the host has nothing to say about
|
|
4
|
+
* them beyond the db it already gave: one tooltip provider, one associations store over
|
|
5
|
+
* `host.db`, the model catalog + favorites, and the agent catalog the host resolves (`host.catalog()`, built over `db`). A host that passes its own `store` (matrx-frontend) already mounts both above the
|
|
6
|
+
* chat with its own ports, so they are never shadowed there.
|
|
7
|
+
* Proof: canary/ (P29a) renders the transcript and composer with only `{ db }`.
|
|
8
|
+
*/
|
|
9
|
+
import { type ReactNode } from "react";
|
|
10
|
+
import type { ResolvedChatHost } from "./contract.js";
|
|
11
|
+
export declare function BareHostChrome({ host, children }: {
|
|
12
|
+
host: ResolvedChatHost;
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { TooltipProvider } from "@ai-matrx/design-system";
|
|
5
|
+
import { createAssociationsStore } from "@ai-matrx/associations/core";
|
|
6
|
+
import { AssociationsProvider } from "@ai-matrx/associations/react";
|
|
7
|
+
import { AgentCatalogProvider } from "@ai-matrx/agents/catalog/react";
|
|
8
|
+
import { createModelCatalog, createModelFavorites } from "@ai-matrx/agents/models";
|
|
9
|
+
import { ModelCatalogProvider } from "@ai-matrx/agents/models/react";
|
|
10
|
+
import { hasChatScopes, registerChatScopes } from "../context/sources/scopes.js";
|
|
11
|
+
const SAVE_REASON = "save this";
|
|
12
|
+
function BareHostChrome({ host, children }) {
|
|
13
|
+
const [associations] = useState(
|
|
14
|
+
() => createAssociationsStore({
|
|
15
|
+
dataSource: host.db,
|
|
16
|
+
identity: {
|
|
17
|
+
requireUserId: () => {
|
|
18
|
+
const userId = host.identity.current().userId;
|
|
19
|
+
if (!userId) throw new Error("@ai-matrx/chat: no one is signed in, so this cannot be saved.");
|
|
20
|
+
return userId;
|
|
21
|
+
},
|
|
22
|
+
// A variable, not a literal: finish-build reads `require("…")` as an import.
|
|
23
|
+
ensureOrgId: () => host.org.require(SAVE_REASON)
|
|
24
|
+
}
|
|
25
|
+
})
|
|
26
|
+
);
|
|
27
|
+
useState(() => {
|
|
28
|
+
if (!hasChatScopes("associationsService")) {
|
|
29
|
+
registerChatScopes({
|
|
30
|
+
associationsService: associations.services.associations,
|
|
31
|
+
favoritesService: associations.favorites,
|
|
32
|
+
getAssociationsStore: (() => associations)
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const [catalog] = useState(() => host.catalog());
|
|
37
|
+
const [models] = useState(() => ({
|
|
38
|
+
catalog: createModelCatalog({ client: host.db }),
|
|
39
|
+
favorites: createModelFavorites({ client: host.db })
|
|
40
|
+
}));
|
|
41
|
+
return /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 200, children: /* @__PURE__ */ jsx(AgentCatalogProvider, { catalog, children: /* @__PURE__ */ jsx(AssociationsProvider, { store: associations, children: /* @__PURE__ */ jsx(ModelCatalogProvider, { catalog: models.catalog, favorites: models.favorites, children }) }) }) });
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
BareHostChrome
|
|
45
|
+
};
|