@ai-matrx/chat 0.4.2 → 0.4.8
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 +60 -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 +25 -12
- package/dist/agents/redux/execution-system/thunks/run-headless-agent-json.d.ts +2 -0
- package/dist/agents/redux/execution-system/thunks/run-headless-agent-json.js +25 -4
- 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/runtime-reconnect/reconnect-server-operation.thunk.js +10 -6
- 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 +19 -0
- package/dist/host/defaults/prefs.js +52 -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 +10 -8
- 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,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
|
+
};
|
|
@@ -28,6 +28,7 @@ function BareHostChrome({ host, children }) {
|
|
|
28
28
|
if (!hasChatScopes("associationsService")) {
|
|
29
29
|
registerChatScopes({
|
|
30
30
|
associationsService: associations.services.associations,
|
|
31
|
+
favoritesService: associations.favorites,
|
|
31
32
|
getAssociationsStore: (() => associations)
|
|
32
33
|
});
|
|
33
34
|
}
|
|
@@ -23,3 +23,22 @@ export declare const PREFERENCE_FIELDS: Readonly<Record<string, keyof ChatPrefer
|
|
|
23
23
|
export declare function createUnhostedKnobs(): ChatKnobsPort;
|
|
24
24
|
export declare const CHAT_PREFS_PREFIX = "ai-matrx-chat:";
|
|
25
25
|
export declare function createWebPrefs(): ChatPrefsPort;
|
|
26
|
+
/** A host-kept prefs port, plus the late arrival of the host's saved values. */
|
|
27
|
+
export interface HostKeptPrefs extends ChatPrefsPort {
|
|
28
|
+
/**
|
|
29
|
+
* The host's saved values arrived after the port was made (read over a socket or IPC). A key
|
|
30
|
+
* already written this session keeps the newer value; every other key is set and announced.
|
|
31
|
+
*/
|
|
32
|
+
load(values: Readonly<Record<string, string>>): void;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A prefs port the HOST keeps (HOST-OWNED-SOURCE-PLAN §2.2 "Drafts"): a page whose origin
|
|
36
|
+
* changes between launches (a local host on a new port, a desktop window) cannot keep drafts in
|
|
37
|
+
* web storage. The host hands its saved values in (`initial`, or `load` when they arrive later)
|
|
38
|
+
* and receives every change (`persist`, `null` = removed) to write where it keeps them — a file,
|
|
39
|
+
* an IPC store. Reads are synchronous from memory.
|
|
40
|
+
*/
|
|
41
|
+
export declare function createHostKeptPrefs(options: {
|
|
42
|
+
initial?: Readonly<Record<string, string>>;
|
|
43
|
+
persist: (key: string, value: string | null) => void;
|
|
44
|
+
}): HostKeptPrefs;
|
|
@@ -168,11 +168,63 @@ function createWebPrefs() {
|
|
|
168
168
|
};
|
|
169
169
|
return port;
|
|
170
170
|
}
|
|
171
|
+
function createHostKeptPrefs(options) {
|
|
172
|
+
const memory = new Map(Object.entries(options.initial ?? {}));
|
|
173
|
+
const written = /* @__PURE__ */ new Set();
|
|
174
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
175
|
+
const emit = (key) => {
|
|
176
|
+
for (const listener of listeners) listener(key);
|
|
177
|
+
};
|
|
178
|
+
const write = (key, value) => {
|
|
179
|
+
written.add(key);
|
|
180
|
+
try {
|
|
181
|
+
options.persist(key, value);
|
|
182
|
+
} catch (error) {
|
|
183
|
+
announceOnce(
|
|
184
|
+
"prefs-host-write-failed",
|
|
185
|
+
`The host could not save a chat preference or draft (${error instanceof Error ? error.message : String(error)}); it is kept for this session.`
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
const port = {
|
|
190
|
+
get: (key) => memory.get(key) ?? null,
|
|
191
|
+
set(key, value) {
|
|
192
|
+
if (memory.get(key) === value) return;
|
|
193
|
+
memory.set(key, value);
|
|
194
|
+
write(key, value);
|
|
195
|
+
emit(key);
|
|
196
|
+
},
|
|
197
|
+
remove(key) {
|
|
198
|
+
if (!memory.has(key)) return;
|
|
199
|
+
memory.delete(key);
|
|
200
|
+
write(key, null);
|
|
201
|
+
emit(key);
|
|
202
|
+
},
|
|
203
|
+
subscribe(listener) {
|
|
204
|
+
listeners.add(listener);
|
|
205
|
+
return () => {
|
|
206
|
+
listeners.delete(listener);
|
|
207
|
+
};
|
|
208
|
+
},
|
|
209
|
+
knob: (key, fallback) => parseKnob(memory.get(key) ?? null, fallback),
|
|
210
|
+
knobs: createUnhostedKnobs(),
|
|
211
|
+
snapshot: () => Object.fromEntries(memory),
|
|
212
|
+
load(values) {
|
|
213
|
+
for (const [key, value] of Object.entries(values)) {
|
|
214
|
+
if (written.has(key) || memory.get(key) === value) continue;
|
|
215
|
+
memory.set(key, value);
|
|
216
|
+
emit(key);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
return port;
|
|
221
|
+
}
|
|
171
222
|
export {
|
|
172
223
|
CHAT_PREFS_PREFIX,
|
|
173
224
|
DEFAULT_CHAT_PREFERENCES,
|
|
174
225
|
PREFERENCE_FIELDS,
|
|
175
226
|
applyPreferenceWrite,
|
|
227
|
+
createHostKeptPrefs,
|
|
176
228
|
createUnhostedKnobs,
|
|
177
229
|
createWebPrefs
|
|
178
230
|
};
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useMemo, useState, useSyncExternalStore } from "react";
|
|
4
4
|
import { useChatHost } from "../react.js";
|
|
5
|
+
import { chatHostHasDatabase } from "../configure.js";
|
|
5
6
|
import { invalidateMandateCache } from "../../mandates/service.js";
|
|
6
7
|
const PAGE = 500;
|
|
7
8
|
const CHUNK = 100;
|
|
8
9
|
function DefaultWorkspaceGate({ blocked, sentence, description, children, className }) {
|
|
9
10
|
const host = useChatHost();
|
|
10
11
|
const active = useSyncExternalStore(host.org.subscribe, host.org.active, () => null);
|
|
11
|
-
if (!blocked || active || !host.org.choose) return /* @__PURE__ */ jsx(Fragment, { children });
|
|
12
|
+
if (!blocked || active || !host.org.choose || !chatHostHasDatabase()) return /* @__PURE__ */ jsx(Fragment, { children });
|
|
12
13
|
return /* @__PURE__ */ jsx(WorkspacePicker, { sentence, description, className });
|
|
13
14
|
}
|
|
14
15
|
function WorkspacePicker({ sentence, description, className }) {
|
package/dist/host/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { createDbIdentity, SIGNED_OUT_IDENTITY } from "./defaults/identity.js";
|
|
|
10
10
|
export { createNoPickerOrg, createStoredOrg, CHAT_ACTIVE_ORG_STORAGE_KEY } from "./defaults/org.js";
|
|
11
11
|
export { createDefaultServer, DEFAULT_CHAT_SERVER_URL, } from "./defaults/server.js";
|
|
12
12
|
export { createDomNotifier } from "./defaults/notify.js";
|
|
13
|
-
export { createWebPrefs, CHAT_PREFS_PREFIX } from "./defaults/prefs.js";
|
|
13
|
+
export { createWebPrefs, createHostKeptPrefs, CHAT_PREFS_PREFIX, type HostKeptPrefs } from "./defaults/prefs.js";
|
|
14
14
|
export { createWindowNavigation } from "./defaults/navigation.js";
|
|
15
15
|
export { createUnhostedWindows } from "./defaults/windows.js";
|
|
16
16
|
export { CHAT_WINDOWS, CHAT_WINDOW_IDS, DEFAULT_WINDOW_INSTANCE_ID, isChatWindowId, type ChatWindowId, } from "./windows.js";
|
package/dist/host/index.js
CHANGED
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
DEFAULT_CHAT_SERVER_URL
|
|
28
28
|
} from "./defaults/server.js";
|
|
29
29
|
import { createDomNotifier } from "./defaults/notify.js";
|
|
30
|
-
import { createWebPrefs, CHAT_PREFS_PREFIX } from "./defaults/prefs.js";
|
|
30
|
+
import { createWebPrefs, createHostKeptPrefs, CHAT_PREFS_PREFIX } from "./defaults/prefs.js";
|
|
31
31
|
import { createWindowNavigation } from "./defaults/navigation.js";
|
|
32
32
|
import { createUnhostedWindows } from "./defaults/windows.js";
|
|
33
33
|
import {
|
|
@@ -85,6 +85,7 @@ export {
|
|
|
85
85
|
createDefaultChrome,
|
|
86
86
|
createDefaultServer,
|
|
87
87
|
createDomNotifier,
|
|
88
|
+
createHostKeptPrefs,
|
|
88
89
|
createLogClientErrorDiagnostics,
|
|
89
90
|
createNoDatabaseStandIn,
|
|
90
91
|
createNoPickerOrg,
|
package/dist/host/react.js
CHANGED
|
@@ -9,6 +9,8 @@ import { createChatStore } from "../store/create-chat-store.js";
|
|
|
9
9
|
import { useChatHostSync } from "../store/chat-host-sync.js";
|
|
10
10
|
import { setStoreSingleton } from "../store/store-singleton.js";
|
|
11
11
|
import { BareHostChrome } from "./bare-host-chrome.js";
|
|
12
|
+
import { AlchemyActionsProvider, useOptionalAlchemyActions } from "@ai-matrx/alchemy/react/host";
|
|
13
|
+
import { captureError } from "./diagnostics.js";
|
|
12
14
|
import {
|
|
13
15
|
isRemarkDurabilityRegistered,
|
|
14
16
|
registerRemarkDurability
|
|
@@ -39,8 +41,21 @@ function ChatProvider({ host, store, children }) {
|
|
|
39
41
|
const serverState = privateStore?.snapshot ?? (parent && parent.store === store ? parent.getServerState?.() : void 0);
|
|
40
42
|
if (typeof window !== "undefined") setStoreSingleton(chatStore);
|
|
41
43
|
useChatHostSync(chatStore, resolved);
|
|
42
|
-
|
|
44
|
+
const outerAlchemy = useOptionalAlchemyActions();
|
|
45
|
+
const body = privateStore ? /* @__PURE__ */ jsx(BareHostChrome, { host: resolved, children }) : children;
|
|
46
|
+
return /* @__PURE__ */ jsx(ChatHostContext.Provider, { value: resolved, children: /* @__PURE__ */ jsx(Provider, { store: chatStore, context: ChatStoreContext, serverState, children: outerAlchemy ? body : /* @__PURE__ */ jsx(AlchemyActionsProvider, { ports: BARE_ALCHEMY_PORTS, children: body }) }) });
|
|
43
47
|
}
|
|
48
|
+
const BARE_ALCHEMY_PORTS = {
|
|
49
|
+
diagnostics: {
|
|
50
|
+
capture: (error, context) => {
|
|
51
|
+
captureError({
|
|
52
|
+
source: "chat",
|
|
53
|
+
message: `Alchemy ${context.area}: ${error instanceof Error ? error.message : String(error)}`,
|
|
54
|
+
raw: context.detail
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
44
59
|
function useMaybeChatHost() {
|
|
45
60
|
return useContext(ChatHostContext);
|
|
46
61
|
}
|
package/dist/host/source.d.ts
CHANGED
|
@@ -24,8 +24,29 @@ export interface HostMessageRecord {
|
|
|
24
24
|
code?: string | null;
|
|
25
25
|
} | null;
|
|
26
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* One finished (or still running) tool call in the host's history: what a saved `tool_call` part's
|
|
29
|
+
* card shows — its result, its failure, its display name. A database-backed conversation reads
|
|
30
|
+
* these from its tool-call rows; a host hands them over with the page.
|
|
31
|
+
*/
|
|
32
|
+
export interface HostToolCall {
|
|
33
|
+
/** The `call_id` of the `tool_call` part it belongs to. */
|
|
34
|
+
callId: string;
|
|
35
|
+
name: string;
|
|
36
|
+
/** What the card's title says ("Run a command"), when the host has a friendlier name. */
|
|
37
|
+
displayName?: string | null;
|
|
38
|
+
arguments: Record<string, unknown>;
|
|
39
|
+
/** The tool's output as text (JSON text renders structured); null while it runs. */
|
|
40
|
+
output: string | null;
|
|
41
|
+
isError: boolean;
|
|
42
|
+
status: "running" | "completed" | "failed";
|
|
43
|
+
/** The assistant message it belongs to. */
|
|
44
|
+
messageId?: string | null;
|
|
45
|
+
}
|
|
27
46
|
export interface HostHistoryPage {
|
|
28
47
|
records: HostMessageRecord[];
|
|
48
|
+
/** The tool calls the records' `tool_call` parts refer to. */
|
|
49
|
+
toolCalls?: HostToolCall[];
|
|
29
50
|
hasMoreOlder: boolean;
|
|
30
51
|
/** The host's sentence when its history could not be read ("This chat's file could not be read"). */
|
|
31
52
|
unavailable?: string | null;
|
package/dist/host/ui-slots.d.ts
CHANGED
|
@@ -90,7 +90,6 @@ type SlotComponent<P> = ComponentType<P> | {
|
|
|
90
90
|
}["bivarianceHack"];
|
|
91
91
|
type AnyFn = (...args: any[]) => any;
|
|
92
92
|
export interface ChatUiSlots {
|
|
93
|
-
RichContent: AnyComponent;
|
|
94
93
|
CopyButtons: AnyComponent;
|
|
95
94
|
InfoHint: AnyComponent;
|
|
96
95
|
AnswerValueView: AnyComponent;
|
|
@@ -105,14 +104,10 @@ export interface ChatUiSlots {
|
|
|
105
104
|
TableChooser: AnyComponent;
|
|
106
105
|
FileResourceChip: AnyComponent;
|
|
107
106
|
ConnectorMark: AnyComponent;
|
|
108
|
-
InPlaceEditor: AnyComponent;
|
|
109
|
-
EditInPlace: AnyComponent;
|
|
110
107
|
MessageFilesStrip: AnyComponent;
|
|
111
108
|
RulebookNudge: AnyComponent;
|
|
112
109
|
NegativeVerdictFollowUp: AnyComponent;
|
|
113
110
|
SpeakerButton: AnyComponent;
|
|
114
|
-
/** The split Copy (one click = the person's flavor; the chevron offers markdown or plain text) over one markdown string: `{ text, label?, size? }`. */
|
|
115
|
-
CopySplit: AnyComponent;
|
|
116
111
|
GmailReviewCard: AnyComponent;
|
|
117
112
|
ShareButton: AnyComponent;
|
|
118
113
|
ShareModal: AnyComponent;
|
|
@@ -128,16 +123,11 @@ export interface ChatUiSlots {
|
|
|
128
123
|
NoteFooter: AnyComponent;
|
|
129
124
|
NoteTitleActions: AnyComponent;
|
|
130
125
|
TaskBody: AnyComponent;
|
|
131
|
-
RichDocument: AnyComponent;
|
|
132
126
|
SystemInstructionModal: AnyComponent;
|
|
133
127
|
confirm: AnyFn;
|
|
134
|
-
copyRichContent: AnyFn;
|
|
135
|
-
copyContent: AnyFn;
|
|
136
128
|
useTablesEverywhere: AnyFn;
|
|
137
|
-
useTextareaFormatting: AnyFn;
|
|
138
129
|
useClipboardPaste: AnyFn;
|
|
139
130
|
useCenterControlFit: AnyFn;
|
|
140
|
-
useInPlaceTrigger: AnyFn;
|
|
141
131
|
connectorDefinitionFromMcp: AnyFn;
|
|
142
132
|
notesCreate: AnyFn;
|
|
143
133
|
useKnowledgeAttachSearch: AnyFn;
|
|
@@ -435,8 +425,6 @@ export declare function resetChatUiForTests(): void;
|
|
|
435
425
|
* unregistered -> the stand-in, reported once.
|
|
436
426
|
*/
|
|
437
427
|
export declare function hostSlot<K extends keyof ChatUiSlots>(name: K, Fallback?: AnyComponent): ChatUiSlots[K];
|
|
438
|
-
/** A host with no rich renderer shows the text as it is. */
|
|
439
|
-
export declare const RichContent: AnyComponent;
|
|
440
428
|
export declare const CopyButtons: AnyComponent;
|
|
441
429
|
export declare const InfoHint: AnyComponent;
|
|
442
430
|
export declare const AnswerValueView: AnyComponent;
|
|
@@ -454,14 +442,10 @@ export declare const NonEditableContextMenu: ComponentType<import("../context-me
|
|
|
454
442
|
export declare const TableChooser: AnyComponent;
|
|
455
443
|
export declare const FileResourceChip: AnyComponent;
|
|
456
444
|
export declare const ConnectorMark: AnyComponent;
|
|
457
|
-
export declare const InPlaceEditor: AnyComponent;
|
|
458
|
-
/** A host with no in-place editor shows the text and offers no edit. */
|
|
459
|
-
export declare const EditInPlace: AnyComponent;
|
|
460
445
|
export declare const MessageFilesStrip: AnyComponent;
|
|
461
446
|
export declare const RulebookNudge: AnyComponent;
|
|
462
447
|
export declare const NegativeVerdictFollowUp: AnyComponent;
|
|
463
448
|
export declare const SpeakerButton: AnyComponent;
|
|
464
|
-
export declare const CopySplit: AnyComponent;
|
|
465
449
|
export declare const GmailReviewCard: AnyComponent;
|
|
466
450
|
export declare const ShareButton: AnyComponent;
|
|
467
451
|
export declare const ShareModal: AnyComponent;
|
|
@@ -473,17 +457,13 @@ export declare const ConnectorPromptHost: AnyComponent;
|
|
|
473
457
|
export declare const WebpageSnapshotView: AnyComponent;
|
|
474
458
|
/**
|
|
475
459
|
* A named function or hook slot declared outside this file (by `ChatUiSlots` augmentation, e.g.
|
|
476
|
-
* host/
|
|
460
|
+
* host/app-data-slots), with its stand-in. Same contract as the slots below.
|
|
477
461
|
*/
|
|
478
462
|
export declare function hostFn<K extends keyof ChatUiSlots>(name: K, fallback?: AnyFn): ChatUiSlots[K];
|
|
479
463
|
export declare const confirm: AnyFn;
|
|
480
|
-
export declare const copyRichContent: AnyFn;
|
|
481
|
-
export declare const copyContent: AnyFn;
|
|
482
464
|
export declare const useTablesEverywhere: AnyFn;
|
|
483
|
-
export declare const useTextareaFormatting: AnyFn;
|
|
484
465
|
export declare const useClipboardPaste: AnyFn;
|
|
485
466
|
export declare const useCenterControlFit: AnyFn;
|
|
486
|
-
export declare const useInPlaceTrigger: AnyFn;
|
|
487
467
|
export declare const connectorDefinitionFromMcp: AnyFn;
|
|
488
468
|
export declare const notesCreate: AnyFn;
|
|
489
469
|
export declare const useKnowledgeAttachSearch: AnyFn;
|
|
@@ -509,8 +489,6 @@ export declare const traceWarRoomRenderPath: AnyFn;
|
|
|
509
489
|
export declare const isWarRoomThreadAgentSurface: AnyFn;
|
|
510
490
|
/** A host with no cloud browser opens nothing; the opener is a reported no-op. */
|
|
511
491
|
export declare const useOpenCloudBrowserCanvas: AnyFn;
|
|
512
|
-
/** A host with no rich document viewer shows the text as it is, marked as the stand-in. */
|
|
513
|
-
export declare const RichDocument: AnyComponent;
|
|
514
492
|
/** The canvas identity of one chat's cloud browser (the host's own scheme; a bare host just keys by chat). */
|
|
515
493
|
export declare const cloudBrowserCanvasSourceId: AnyFn;
|
|
516
494
|
/** Builder doors: a host without the agent builder shows one labelled line where the editor would be. */
|
package/dist/host/ui-slots.js
CHANGED
|
@@ -7,7 +7,6 @@ import { reportUnregisteredHostSlot as reportUnregistered } from "./diagnostics.
|
|
|
7
7
|
import { DefaultWebpageSnapshotView } from "./defaults/webpage-snapshot-view.js";
|
|
8
8
|
import { DefaultWorkspaceGate } from "./defaults/workspace-gate.js";
|
|
9
9
|
import { DefaultFullScreenOverlay, DefaultWindowPanel } from "./defaults/window-panel.js";
|
|
10
|
-
import { copyText } from "@ai-matrx/kit/clipboard";
|
|
11
10
|
const slots = {};
|
|
12
11
|
function registerChatUi(next) {
|
|
13
12
|
Object.assign(slots, next);
|
|
@@ -67,15 +66,6 @@ const failingThunk = (name) => () => () => {
|
|
|
67
66
|
};
|
|
68
67
|
const STAND_INS = {
|
|
69
68
|
confirm: async () => false,
|
|
70
|
-
copyRichContent: async () => false,
|
|
71
|
-
// Content-shaped like the host's `copyContent(content, options)`: a string copies as text, anything
|
|
72
|
-
// else as JSON. A failed copy is reported through `onError` and returns false, never swallowed.
|
|
73
|
-
copyContent: async (content, options) => {
|
|
74
|
-
const text = typeof content === "string" ? content : JSON.stringify(content, null, 2);
|
|
75
|
-
const landed = await copyText(text ?? "");
|
|
76
|
-
if (!landed) options?.onError?.(new Error("Failed to copy"));
|
|
77
|
-
return landed;
|
|
78
|
-
},
|
|
79
69
|
useTablesEverywhere: () => NONE,
|
|
80
70
|
useCenterControlFit: () => true,
|
|
81
71
|
connectorDefinitionFromMcp: () => null,
|
|
@@ -167,10 +157,6 @@ function slotFn(name, declared) {
|
|
|
167
157
|
};
|
|
168
158
|
return fn;
|
|
169
159
|
}
|
|
170
|
-
const RichContent = slotComponent(
|
|
171
|
-
"RichContent",
|
|
172
|
-
({ source, className }) => createElement("div", { className, "data-chat-slot-fallback": "RichContent" }, typeof source === "string" ? source : "")
|
|
173
|
-
);
|
|
174
160
|
const CopyButtons = slotComponent("CopyButtons");
|
|
175
161
|
const InfoHint = slotComponent("InfoHint");
|
|
176
162
|
const AnswerValueView = slotComponent("AnswerValueView");
|
|
@@ -201,13 +187,10 @@ const NonEditableContextMenu = slotComponent("NonEditableContextMenu", contentWi
|
|
|
201
187
|
const TableChooser = slotComponent("TableChooser");
|
|
202
188
|
const FileResourceChip = slotComponent("FileResourceChip");
|
|
203
189
|
const ConnectorMark = slotComponent("ConnectorMark");
|
|
204
|
-
const InPlaceEditor = slotComponent("InPlaceEditor");
|
|
205
|
-
const EditInPlace = slotComponent("EditInPlace", ({ children }) => children ?? null);
|
|
206
190
|
const MessageFilesStrip = slotComponent("MessageFilesStrip", unregisteredWidget("MessageFilesStrip"));
|
|
207
191
|
const RulebookNudge = slotComponent("RulebookNudge", unregisteredWidget("RulebookNudge"));
|
|
208
192
|
const NegativeVerdictFollowUp = slotComponent("NegativeVerdictFollowUp", unregisteredWidget("NegativeVerdictFollowUp"));
|
|
209
193
|
const SpeakerButton = slotComponent("SpeakerButton", unregisteredWidget("SpeakerButton"));
|
|
210
|
-
const CopySplit = slotComponent("CopySplit", unregisteredWidget("CopySplit"));
|
|
211
194
|
const GmailReviewCard = slotComponent("GmailReviewCard", unregisteredWidget("GmailReviewCard"));
|
|
212
195
|
const ShareButton = slotComponent("ShareButton", unregisteredWidget("ShareButton"));
|
|
213
196
|
const ShareModal = slotComponent("ShareModal", unregisteredWidget("ShareModal"));
|
|
@@ -220,13 +203,9 @@ function hostFn(name, fallback) {
|
|
|
220
203
|
return slotFn(name, fallback);
|
|
221
204
|
}
|
|
222
205
|
const confirm = slotFn("confirm");
|
|
223
|
-
const copyRichContent = slotFn("copyRichContent");
|
|
224
|
-
const copyContent = slotFn("copyContent");
|
|
225
206
|
const useTablesEverywhere = slotFn("useTablesEverywhere");
|
|
226
|
-
const useTextareaFormatting = slotFn("useTextareaFormatting", () => void 0);
|
|
227
207
|
const useClipboardPaste = slotFn("useClipboardPaste", () => void 0);
|
|
228
208
|
const useCenterControlFit = slotFn("useCenterControlFit");
|
|
229
|
-
const useInPlaceTrigger = slotFn("useInPlaceTrigger", () => ({ readProps: {} }));
|
|
230
209
|
const connectorDefinitionFromMcp = slotFn("connectorDefinitionFromMcp");
|
|
231
210
|
const notesCreate = slotFn("notesCreate");
|
|
232
211
|
const useKnowledgeAttachSearch = slotFn("useKnowledgeAttachSearch");
|
|
@@ -250,10 +229,6 @@ const loadedSkills = slotFn("loadedSkills", () => ({ status: "idle", skills: []
|
|
|
250
229
|
const traceWarRoomRenderPath = slotFn("traceWarRoomRenderPath", () => void 0);
|
|
251
230
|
const isWarRoomThreadAgentSurface = slotFn("isWarRoomThreadAgentSurface", () => false);
|
|
252
231
|
const useOpenCloudBrowserCanvas = slotFn("useOpenCloudBrowserCanvas", () => () => void 0);
|
|
253
|
-
const RichDocument = slotComponent(
|
|
254
|
-
"RichDocument",
|
|
255
|
-
({ content, className }) => createElement("div", { className: `whitespace-pre-wrap text-sm ${className ?? ""}`, "data-chat-slot-fallback": "RichDocument" }, typeof content === "string" ? content : "")
|
|
256
|
-
);
|
|
257
232
|
const cloudBrowserCanvasSourceId = slotFn("cloudBrowserCanvasSourceId", (conversationId) => `cloud-browser:${conversationId}`);
|
|
258
233
|
const SystemInstructionModal = slotComponent("SystemInstructionModal", unregisteredWidget("SystemInstructionModal"));
|
|
259
234
|
const WindowPanel = slotComponent("WindowPanel", DefaultWindowPanel);
|
|
@@ -506,14 +481,12 @@ export {
|
|
|
506
481
|
ConnectorPromptHost,
|
|
507
482
|
ConversationHoverPreview,
|
|
508
483
|
CopyButtons,
|
|
509
|
-
CopySplit,
|
|
510
484
|
Cost,
|
|
511
485
|
CreatorRunPanel,
|
|
512
486
|
CustomDataBindingPreview,
|
|
513
487
|
CustomDataBindingSummary,
|
|
514
488
|
DataRefPreviewContent,
|
|
515
489
|
DockedSidePanel,
|
|
516
|
-
EditInPlace,
|
|
517
490
|
EditableContextMenu,
|
|
518
491
|
EmailInputDialog,
|
|
519
492
|
EntityCommentPopover,
|
|
@@ -531,7 +504,6 @@ export {
|
|
|
531
504
|
GmailReviewCard,
|
|
532
505
|
HtmlPreviewFullScreenEditor,
|
|
533
506
|
IconButton,
|
|
534
|
-
InPlaceEditor,
|
|
535
507
|
InfoHint,
|
|
536
508
|
InputCapabilitiesEditor,
|
|
537
509
|
ItemMenu,
|
|
@@ -569,8 +541,6 @@ export {
|
|
|
569
541
|
ResourcePickerMenu,
|
|
570
542
|
ResourcePickerWindow,
|
|
571
543
|
ReviewAnswersLink,
|
|
572
|
-
RichContent,
|
|
573
|
-
RichDocument,
|
|
574
544
|
RulebookNudge,
|
|
575
545
|
SearchGroup,
|
|
576
546
|
SearchGroupTrigger,
|
|
@@ -611,8 +581,6 @@ export {
|
|
|
611
581
|
confirm,
|
|
612
582
|
connectorDefinitionFromMcp,
|
|
613
583
|
convertMarkdownToHtml,
|
|
614
|
-
copyContent,
|
|
615
|
-
copyRichContent,
|
|
616
584
|
createHtmlPage,
|
|
617
585
|
createSandboxFilesystemAdapter,
|
|
618
586
|
currentCostUnit,
|
|
@@ -711,7 +679,6 @@ export {
|
|
|
711
679
|
useGitHubConnection,
|
|
712
680
|
useHeldWriteTableName,
|
|
713
681
|
useHtmlPreviewState,
|
|
714
|
-
useInPlaceTrigger,
|
|
715
682
|
useKnowledgeAttachSearch,
|
|
716
683
|
useLoginHref,
|
|
717
684
|
useModelFull,
|
|
@@ -729,6 +696,5 @@ export {
|
|
|
729
696
|
useRunControlCounts,
|
|
730
697
|
useSkills,
|
|
731
698
|
useTablesEverywhere,
|
|
732
|
-
useTextareaFormatting,
|
|
733
699
|
useUrlSync
|
|
734
700
|
};
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
Share2
|
|
18
18
|
} from "lucide-react";
|
|
19
19
|
import { getMarkdownStylesheet } from "@ai-matrx/print/markdown";
|
|
20
|
-
import { AdvancedMenu
|
|
20
|
+
import { AdvancedMenu } from "../../host/ui-slots.js";
|
|
21
21
|
import { EmailInputDialog } from "../../host/ui-slots.js";
|
|
22
22
|
import { AuthGateDialog } from "../../host/ui-slots.js";
|
|
23
23
|
import { notesCreate } from "../../host/ui-slots.js";
|
|
@@ -30,6 +30,7 @@ import { kindTextToMarkdown } from "../../utils/content-ir/surfaces/kind-text-to
|
|
|
30
30
|
import { removeCodeSpans, replaceFences } from "@ai-matrx/content-ir/source";
|
|
31
31
|
import { selectOrganizationId, ensureOrganizationContext, isOrganizationSelectionCancelled } from "../../host/org.js";
|
|
32
32
|
import { downloadFile } from "@ai-matrx/kit/download";
|
|
33
|
+
import { copyContent } from "@ai-matrx/rich-content/copy/copy-commands";
|
|
33
34
|
const PENDING_ACTION_KEY = "matrx_pending_post_auth_action";
|
|
34
35
|
const PublicMessageOptionsMenu = ({
|
|
35
36
|
content: answerContent,
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
fetchSurfaceConfigBundle,
|
|
7
7
|
resolveSurfaceConfig
|
|
8
8
|
} from "../services/surface-config.service.js";
|
|
9
|
+
import { chatHostHasDatabase } from "../../host/configure.js";
|
|
9
10
|
const initialState = { bySurfaceName: {} };
|
|
10
11
|
const inflight = /* @__PURE__ */ new Map();
|
|
11
12
|
const ensureSurfaceConfig = createAsyncThunk(
|
|
@@ -22,6 +23,7 @@ const ensureSurfaceConfig = createAsyncThunk(
|
|
|
22
23
|
},
|
|
23
24
|
{
|
|
24
25
|
condition: ({ surfaceName, force }, { getState }) => {
|
|
26
|
+
if (!chatHostHasDatabase()) return false;
|
|
25
27
|
if (force) return true;
|
|
26
28
|
const entry = getState().surfaceConfig?.bySurfaceName[surfaceName];
|
|
27
29
|
return !entry || entry.status === "idle" || entry.status === "error";
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
surfaceUserStateService
|
|
4
4
|
} from "../user-state/service.js";
|
|
5
5
|
import { requireUserId } from "../../host/identity.js";
|
|
6
|
+
import { chatHostHasDatabase } from "../../host/configure.js";
|
|
6
7
|
const initialState = { byFeature: {} };
|
|
7
8
|
function ensureFeature(state, feature) {
|
|
8
9
|
if (!state.byFeature[feature]) {
|
|
@@ -50,7 +51,7 @@ function ensureSurfaceFeatureLoaded(feature, force = false) {
|
|
|
50
51
|
const p = (async () => {
|
|
51
52
|
dispatch(surfaceUserStateActions.featureLoading(feature));
|
|
52
53
|
try {
|
|
53
|
-
const rows = await surfaceUserStateService.loadFeature(requireUserId(), feature);
|
|
54
|
+
const rows = !chatHostHasDatabase() ? {} : await surfaceUserStateService.loadFeature(requireUserId(), feature);
|
|
54
55
|
dispatch(surfaceUserStateActions.featureReceived({ feature, rows }));
|
|
55
56
|
} catch (e) {
|
|
56
57
|
dispatch(
|
|
@@ -67,6 +68,7 @@ function ensureSurfaceFeatureLoaded(feature, force = false) {
|
|
|
67
68
|
function saveSurfaceState(feature, surfaceKey, state) {
|
|
68
69
|
return async (dispatch) => {
|
|
69
70
|
dispatch(surfaceUserStateActions.rowSet({ feature, surfaceKey, state }));
|
|
71
|
+
if (!chatHostHasDatabase()) return;
|
|
70
72
|
try {
|
|
71
73
|
await surfaceUserStateService.save(requireUserId(), feature, surfaceKey, state);
|
|
72
74
|
} catch (e) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { KIND_KEY } from "@ai-matrx/content-ir";
|
|
2
|
-
import { contentIrKindValidator } from "../../host/
|
|
2
|
+
import { contentIrKindValidator } from "../../host/app-data-slots.js";
|
|
3
3
|
function summarizeKindSchema(schema) {
|
|
4
4
|
if (typeof schema !== "object" || schema === null) return null;
|
|
5
5
|
const s = schema;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { supabase } from "../../host/db.js";
|
|
2
|
+
import { chatHostHasDatabase } from "../../host/configure.js";
|
|
2
3
|
import { WEB_TOOL_UI_SURFACE } from "./surface.js";
|
|
3
4
|
async function fetchToolRendererRow(toolName) {
|
|
5
|
+
if (!chatHostHasDatabase()) return null;
|
|
4
6
|
const { data, error } = await supabase.schema("tool").from("ui").select(
|
|
5
7
|
"inline_code, allowed_imports, display_name, results_label, header_subtitle_code, keep_expanded_on_stream"
|
|
6
8
|
).is("deleted_at", null).eq("tool_name", toolName).eq("surface_name", WEB_TOOL_UI_SURFACE).eq("is_active", true).maybeSingle();
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
4
|
import { Aperture, ImageIcon } from "lucide-react";
|
|
5
|
-
import { MarkdownStream } from "../../../
|
|
5
|
+
import { MarkdownStream } from "../../../ui/markdown-stream/MarkdownStream.js";
|
|
6
6
|
import { useAppSelector } from "../../../store/hooks.js";
|
|
7
7
|
import { selectAgentCallChildStream } from "../../../agents/redux/execution-system/active-requests/active-requests.selectors.js";
|
|
8
8
|
import { GenericRenderer } from "../../registry/GenericRenderer.js";
|
|
@@ -7,7 +7,7 @@ import { useAppSelector } from "../../../store/hooks.js";
|
|
|
7
7
|
import { selectAgentCallChildStream } from "../../../agents/redux/execution-system/active-requests/active-requests.selectors.js";
|
|
8
8
|
import { useConversationTitle } from "../../../agents/hooks/useConversationTitle.js";
|
|
9
9
|
import { EntityRef } from "../../../host/ui-slots.js";
|
|
10
|
-
import { MarkdownStream } from "../../../
|
|
10
|
+
import { MarkdownStream } from "../../../ui/markdown-stream/MarkdownStream.js";
|
|
11
11
|
import { AnswerValueView } from "../../../host/ui-slots.js";
|
|
12
12
|
import { stripThinkingStreaming } from "@ai-matrx/kit/text";
|
|
13
13
|
import { cn } from "@ai-matrx/design-system";
|